ysyt-react-agent-lib 1.2.35 → 1.2.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20,7 +20,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
20
20
  * LICENSE file in the root directory of this source tree.
21
21
  */var tg;function nb(){return tg||(tg=1,process.env.NODE_ENV!=="production"&&function(){var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),a=Symbol.for("react.context"),s=Symbol.for("react.server_context"),A=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),v=!1,C=!1,m=!1,y=!1,w=!1,I;I=Symbol.for("react.module.reference");function O(Y){return!!(typeof Y=="string"||typeof Y=="function"||Y===n||Y===i||w||Y===r||Y===c||Y===u||y||Y===p||v||C||m||typeof Y=="object"&&Y!==null&&(Y.$$typeof===f||Y.$$typeof===d||Y.$$typeof===o||Y.$$typeof===a||Y.$$typeof===A||Y.$$typeof===I||Y.getModuleId!==void 0))}function x(Y){if(typeof Y=="object"&&Y!==null){var de=Y.$$typeof;switch(de){case t:var le=Y.type;switch(le){case n:case i:case r:case c:case u:return le;default:var Se=le&&le.$$typeof;switch(Se){case s:case a:case A:case f:case d:case o:return Se;default:return de}}case e:return de}}}var g=a,M=o,E=t,b=A,h=n,S=f,T=d,R=e,D=i,B=r,k=c,P=u,H=!1,Z=!1;function V(Y){return H||(H=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}function q(Y){return Z||(Z=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1}function U(Y){return x(Y)===a}function $(Y){return x(Y)===o}function z(Y){return typeof Y=="object"&&Y!==null&&Y.$$typeof===t}function J(Y){return x(Y)===A}function W(Y){return x(Y)===n}function te(Y){return x(Y)===f}function _(Y){return x(Y)===d}function se(Y){return x(Y)===e}function ce(Y){return x(Y)===i}function ue(Y){return x(Y)===r}function ne(Y){return x(Y)===c}function me(Y){return x(Y)===u}Ut.ContextConsumer=g,Ut.ContextProvider=M,Ut.Element=E,Ut.ForwardRef=b,Ut.Fragment=h,Ut.Lazy=S,Ut.Memo=T,Ut.Portal=R,Ut.Profiler=D,Ut.StrictMode=B,Ut.Suspense=k,Ut.SuspenseList=P,Ut.isAsyncMode=V,Ut.isConcurrentMode=q,Ut.isContextConsumer=U,Ut.isContextProvider=$,Ut.isElement=z,Ut.isForwardRef=J,Ut.isFragment=W,Ut.isLazy=te,Ut.isMemo=_,Ut.isPortal=se,Ut.isProfiler=ce,Ut.isStrictMode=ue,Ut.isSuspense=ne,Ut.isSuspenseList=me,Ut.isValidElementType=O,Ut.typeOf=x}()),Ut}var ng;function rb(){return ng||(ng=1,process.env.NODE_ENV==="production"?Cs.exports=tb():Cs.exports=nb()),Cs.exports}var kc=rb(),ib=Symbol.for("react.element"),ob=Symbol.for("react.transitional.element"),ab=Symbol.for("react.fragment");function xv(t){return t&&et(t)==="object"&&(t.$$typeof===ib||t.$$typeof===ob)&&t.type===ab}var sb=Number(N.version.split(".")[0]),Qd=function(e,n){typeof e=="function"?e(n):et(e)==="object"&&e&&"current"in e&&(e.current=n)},Lr=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var i=n.filter(Boolean);return i.length<=1?i[0]:function(o){n.forEach(function(a){Qd(a,o)})}},ji=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return Ja(function(){return Lr.apply(void 0,n)},n,function(i,o){return i.length!==o.length||i.every(function(a,s){return a!==o[s]})})},Li=function(e){var n,r;if(!e)return!1;if(jd(e)&&sb>=19)return!0;var i=kc.isMemo(e)?e.type.type:e.type;return!(typeof i=="function"&&!((n=i.prototype)!==null&&n!==void 0&&n.render)&&i.$$typeof!==kc.ForwardRef||typeof e=="function"&&!((r=e.prototype)!==null&&r!==void 0&&r.render)&&e.$$typeof!==kc.ForwardRef)};function jd(t){return N.isValidElement(t)&&!xv(t)}var Ab=function(e){return jd(e)&&Li(e)},co=function(e){if(e&&jd(e)){var n=e;return n.props.propertyIsEnumerable("ref")?n.props.ref:n.ref}return null};function zr(t,e){for(var n=t,r=0;r<e.length;r+=1){if(n==null)return;n=n[e[r]]}return n}function Rv(t){return _m(t)||ev(t)||Md(t)||$m()}function Ov(t,e,n,r){if(!e.length)return n;var i=Rv(e),o=i[0],a=i.slice(1),s;return!t&&typeof o=="number"?s=[]:Array.isArray(t)?s=Re(t):s=L({},t),r&&n===void 0&&a.length===1?delete s[o][a[0]]:s[o]=Ov(s[o],a,n,r),s}function Mr(t,e,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;return e.length&&r&&n===void 0&&!zr(t,e.slice(0,-1))?t:Ov(t,e,n,r)}function cb(t){return et(t)==="object"&&t!==null&&Object.getPrototypeOf(t)===Object.prototype}function rg(t){return Array.isArray(t)?[]:{}}var lb=typeof Reflect>"u"?Object.keys:Reflect.ownKeys;function Ro(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r=rg(e[0]);return e.forEach(function(i){function o(a,s){var A=new Set(s),c=zr(i,a),u=Array.isArray(c);if(u||cb(c)){if(!A.has(c)){A.add(c);var d=zr(r,a);u?r=Mr(r,a,[]):(!d||et(d)!=="object")&&(r=Mr(r,a,rg(c))),lb(c).forEach(function(f){o([].concat(Re(a),[f]),A)})}}else r=Mr(r,a,c)}o([])}),r}function ig(t,e,n,r){var i=L({},e[t]);if(r!=null&&r.deprecatedTokens){var o=r.deprecatedTokens;o.forEach(function(s){var A=ee(s,2),c=A[0],u=A[1];if(process.env.NODE_ENV!=="production"&&yt(!(i!=null&&i[c]),"Component Token `".concat(String(c),"` of ").concat(String(t)," is deprecated. Please use `").concat(String(u),"` instead.")),i!=null&&i[c]||i!=null&&i[u]){var d;(d=i[u])!==null&&d!==void 0||(i[u]=i==null?void 0:i[c])}})}var a=L(L({},n),i);return Object.keys(a).forEach(function(s){a[s]===e[s]&&delete a[s]}),a}var Mv=process.env.NODE_ENV!=="production"||typeof CSSINJS_STATISTIC<"u",Nl=!0;function zt(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];if(!Mv)return Object.assign.apply(Object,[{}].concat(e));Nl=!1;var r={};return e.forEach(function(i){if(et(i)==="object"){var o=Object.keys(i);o.forEach(function(a){Object.defineProperty(r,a,{configurable:!0,enumerable:!0,get:function(){return i[a]}})})}}),Nl=!0,r}var og={};function ub(){}var db=function(e){var n,r=e,i=ub;return Mv&&typeof Proxy<"u"&&(n=new Set,r=new Proxy(e,{get:function(a,s){if(Nl){var A;(A=n)===null||A===void 0||A.add(s)}return a[s]}}),i=function(a,s){var A;og[a]={global:Array.from(n),component:L(L({},(A=og[a])===null||A===void 0?void 0:A.component),s)}}),{token:r,keys:n,flush:i}};function ag(t,e,n){if(typeof n=="function"){var r;return n(zt(e,(r=e[t])!==null&&r!==void 0?r:{}))}return n??{}}function fb(t){return t==="js"?{max:Math.max,min:Math.min}:{max:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return"max(".concat(r.map(function(o){return ye(o)}).join(","),")")},min:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return"min(".concat(r.map(function(o){return ye(o)}).join(","),")")}}}var gb=1e3*60*10,hb=function(){function t(){pn(this,t),Q(this,"map",new Map),Q(this,"objectIDMap",new WeakMap),Q(this,"nextID",0),Q(this,"lastAccessBeat",new Map),Q(this,"accessBeat",0)}return mn(t,[{key:"set",value:function(n,r){this.clear();var i=this.getCompositeKey(n);this.map.set(i,r),this.lastAccessBeat.set(i,Date.now())}},{key:"get",value:function(n){var r=this.getCompositeKey(n),i=this.map.get(r);return this.lastAccessBeat.set(r,Date.now()),this.accessBeat+=1,i}},{key:"getCompositeKey",value:function(n){var r=this,i=n.map(function(o){return o&&et(o)==="object"?"obj_".concat(r.getObjectID(o)):"".concat(et(o),"_").concat(o)});return i.join("|")}},{key:"getObjectID",value:function(n){if(this.objectIDMap.has(n))return this.objectIDMap.get(n);var r=this.nextID;return this.objectIDMap.set(n,r),this.nextID+=1,r}},{key:"clear",value:function(){var n=this;if(this.accessBeat>1e4){var r=Date.now();this.lastAccessBeat.forEach(function(i,o){r-i>gb&&(n.map.delete(o),n.lastAccessBeat.delete(o))}),this.accessBeat=0}}}]),t}(),sg=new hb;function pb(t,e){return N.useMemo(function(){var n=sg.get(e);if(n)return n;var r=t();return sg.set(e,r),r},e)}var mb=function(){return{}};function vb(t){var e=t.useCSP,n=e===void 0?mb:e,r=t.useToken,i=t.usePrefix,o=t.getResetStyles,a=t.getCommonStyle,s=t.getCompUnitless;function A(f,p,v,C){var m=Array.isArray(f)?f[0]:f;function y(E){return"".concat(String(m)).concat(E.slice(0,1).toUpperCase()).concat(E.slice(1))}var w=(C==null?void 0:C.unitless)||{},I=typeof s=="function"?s(f):{},O=L(L({},I),{},Q({},y("zIndexPopup"),!0));Object.keys(w).forEach(function(E){O[y(E)]=w[E]});var x=L(L({},C),{},{unitless:O,prefixToken:y}),g=u(f,p,v,x),M=c(m,v,x);return function(E){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:E,h=g(E,b),S=ee(h,2),T=S[1],R=M(b),D=ee(R,2),B=D[0],k=D[1];return[B,T,k]}}function c(f,p,v){var C=v.unitless,m=v.injectStyle,y=m===void 0?!0:m,w=v.prefixToken,I=v.ignore,O=function(M){var E=M.rootCls,b=M.cssVar,h=b===void 0?{}:b,S=r(),T=S.realToken;return YE({path:[f],prefix:h.prefix,key:h.key,unitless:C,ignore:I,token:T,scope:E},function(){var R=ag(f,T,p),D=ig(f,T,R,{deprecatedTokens:v==null?void 0:v.deprecatedTokens});return Object.keys(R).forEach(function(B){D[w(B)]=D[B],delete D[B]}),D}),null},x=function(M){var E=r(),b=E.cssVar;return[function(h){return y&&b?N.createElement(N.Fragment,null,N.createElement(O,{rootCls:M,cssVar:b,component:f}),h):h},b==null?void 0:b.key]};return x}function u(f,p,v){var C=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},m=Array.isArray(f)?f:[f,f],y=ee(m,1),w=y[0],I=m.join("-"),O=t.layer||{name:"antd"};return function(x){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:x,M=r(),E=M.theme,b=M.realToken,h=M.hashId,S=M.token,T=M.cssVar,R=i(),D=R.rootPrefixCls,B=R.iconPrefixCls,k=n(),P=T?"css":"js",H=pb(function(){var z=new Set;return T&&Object.keys(C.unitless||{}).forEach(function(J){z.add(Qs(J,T.prefix)),z.add(Qs(J,Xf(w,T.prefix)))}),XE(P,z)},[P,w,T==null?void 0:T.prefix]),Z=fb(P),V=Z.max,q=Z.min,U={theme:E,token:S,hashId:h,nonce:function(){return k.nonce},clientOnly:C.clientOnly,layer:O,order:C.order||-999};typeof o=="function"&&Tl(L(L({},U),{},{clientOnly:!1,path:["Shared",D]}),function(){return o(S,{prefix:{rootPrefixCls:D,iconPrefixCls:B},csp:k})});var $=Tl(L(L({},U),{},{path:[I,x,B]}),function(){if(C.injectStyle===!1)return[];var z=db(S),J=z.token,W=z.flush,te=ag(w,b,v),_=".".concat(x),se=ig(w,b,te,{deprecatedTokens:C.deprecatedTokens});T&&te&&et(te)==="object"&&Object.keys(te).forEach(function(me){te[me]="var(".concat(Qs(me,Xf(w,T.prefix)),")")});var ce=zt(J,{componentCls:_,prefixCls:x,iconCls:".".concat(B),antCls:".".concat(D),calc:H,max:V,min:q},T?te:se),ue=p(ce,{hashId:h,prefixCls:x,rootPrefixCls:D,iconPrefixCls:B});W(w,se);var ne=typeof a=="function"?a(ce,x,g,C.resetFont):null;return[C.resetStyle===!1?null:ne,ue]});return[$,h]}}function d(f,p,v){var C=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},m=u(f,p,v,L({resetStyle:!1,order:-998},C)),y=function(I){var O=I.prefixCls,x=I.rootCls,g=x===void 0?O:x;return m(O,g),null};return process.env.NODE_ENV!=="production"&&(y.displayName="SubStyle_".concat(String(Array.isArray(f)?f.join("."):f))),y}return{genStyleHooks:A,genSubStyleComponent:d,genComponentStyleHook:u}}const Bi=["blue","purple","cyan","green","magenta","pink","red","orange","yellow","volcano","geekblue","lime","gold"];function Gs(t){return(t+8)/t}function Cb(t){const e=new Array(10).fill(null).map((n,r)=>{const i=r-1,o=t*Math.pow(Math.E,i/5),a=r>1?Math.floor(o):Math.ceil(o);return Math.floor(a/2)*2});return e[1]=t,e.map(n=>({size:n,lineHeight:Gs(n)}))}const yb="5.24.0",Tv={blue:"#1677FF",purple:"#722ED1",cyan:"#13C2C2",green:"#52C41A",magenta:"#EB2F96",pink:"#EB2F96",red:"#F5222D",orange:"#FA8C16",yellow:"#FADB14",volcano:"#FA541C",geekblue:"#2F54EB",gold:"#FAAD14",lime:"#A0D911"},Da=Object.assign(Object.assign({},Tv),{colorPrimary:"#1677ff",colorSuccess:"#52c41a",colorWarning:"#faad14",colorError:"#ff4d4f",colorInfo:"#1677ff",colorLink:"",colorTextBase:"",colorBgBase:"",fontFamily:`-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
22
22
  'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
23
- 'Noto Color Emoji'`,fontFamilyCode:"'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace",fontSize:14,lineWidth:1,lineType:"solid",motionUnit:.1,motionBase:0,motionEaseOutCirc:"cubic-bezier(0.08, 0.82, 0.17, 1)",motionEaseInOutCirc:"cubic-bezier(0.78, 0.14, 0.15, 0.86)",motionEaseOut:"cubic-bezier(0.215, 0.61, 0.355, 1)",motionEaseInOut:"cubic-bezier(0.645, 0.045, 0.355, 1)",motionEaseOutBack:"cubic-bezier(0.12, 0.4, 0.29, 1.46)",motionEaseInBack:"cubic-bezier(0.71, -0.46, 0.88, 0.6)",motionEaseInQuint:"cubic-bezier(0.755, 0.05, 0.855, 0.06)",motionEaseOutQuint:"cubic-bezier(0.23, 1, 0.32, 1)",borderRadius:6,sizeUnit:4,sizeStep:4,sizePopupArrow:16,controlHeight:32,zIndexBase:0,zIndexPopupBase:1e3,opacityImage:1,wireframe:!1,motion:!0}),In=Math.round;function Pc(t,e){const n=t.replace(/^[^(]*\((.*)/,"$1").replace(/\).*/,"").match(/\d*\.?\d+%?/g)||[],r=n.map(i=>parseFloat(i));for(let i=0;i<3;i+=1)r[i]=e(r[i]||0,n[i]||"",i);return n[3]?r[3]=n[3].includes("%")?r[3]/100:r[3]:r[3]=1,r}const Ag=(t,e,n)=>n===0?t:t/100;function oa(t,e){const n=e||255;return t>n?n:t<0?0:t}class Gt{constructor(e){Q(this,"isValid",!0),Q(this,"r",0),Q(this,"g",0),Q(this,"b",0),Q(this,"a",1),Q(this,"_h",void 0),Q(this,"_s",void 0),Q(this,"_l",void 0),Q(this,"_v",void 0),Q(this,"_max",void 0),Q(this,"_min",void 0),Q(this,"_brightness",void 0);function n(r){return r[0]in e&&r[1]in e&&r[2]in e}if(e)if(typeof e=="string"){let i=function(o){return r.startsWith(o)};const r=e.trim();/^#?[A-F\d]{3,8}$/i.test(r)?this.fromHexString(r):i("rgb")?this.fromRgbString(r):i("hsl")?this.fromHslString(r):(i("hsv")||i("hsb"))&&this.fromHsvString(r)}else if(e instanceof Gt)this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this._h=e._h,this._s=e._s,this._l=e._l,this._v=e._v;else if(n("rgb"))this.r=oa(e.r),this.g=oa(e.g),this.b=oa(e.b),this.a=typeof e.a=="number"?oa(e.a,1):1;else if(n("hsl"))this.fromHsl(e);else if(n("hsv"))this.fromHsv(e);else throw new Error("@ant-design/fast-color: unsupported input "+JSON.stringify(e))}setR(e){return this._sc("r",e)}setG(e){return this._sc("g",e)}setB(e){return this._sc("b",e)}setA(e){return this._sc("a",e,1)}setHue(e){const n=this.toHsv();return n.h=e,this._c(n)}getLuminance(){function e(o){const a=o/255;return a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4)}const n=e(this.r),r=e(this.g),i=e(this.b);return .2126*n+.7152*r+.0722*i}getHue(){if(typeof this._h>"u"){const e=this.getMax()-this.getMin();e===0?this._h=0:this._h=In(60*(this.r===this.getMax()?(this.g-this.b)/e+(this.g<this.b?6:0):this.g===this.getMax()?(this.b-this.r)/e+2:(this.r-this.g)/e+4))}return this._h}getSaturation(){if(typeof this._s>"u"){const e=this.getMax()-this.getMin();e===0?this._s=0:this._s=e/this.getMax()}return this._s}getLightness(){return typeof this._l>"u"&&(this._l=(this.getMax()+this.getMin())/510),this._l}getValue(){return typeof this._v>"u"&&(this._v=this.getMax()/255),this._v}getBrightness(){return typeof this._brightness>"u"&&(this._brightness=(this.r*299+this.g*587+this.b*114)/1e3),this._brightness}darken(e=10){const n=this.getHue(),r=this.getSaturation();let i=this.getLightness()-e/100;return i<0&&(i=0),this._c({h:n,s:r,l:i,a:this.a})}lighten(e=10){const n=this.getHue(),r=this.getSaturation();let i=this.getLightness()+e/100;return i>1&&(i=1),this._c({h:n,s:r,l:i,a:this.a})}mix(e,n=50){const r=this._c(e),i=n/100,o=s=>(r[s]-this[s])*i+this[s],a={r:In(o("r")),g:In(o("g")),b:In(o("b")),a:In(o("a")*100)/100};return this._c(a)}tint(e=10){return this.mix({r:255,g:255,b:255,a:1},e)}shade(e=10){return this.mix({r:0,g:0,b:0,a:1},e)}onBackground(e){const n=this._c(e),r=this.a+n.a*(1-this.a),i=o=>In((this[o]*this.a+n[o]*n.a*(1-this.a))/r);return this._c({r:i("r"),g:i("g"),b:i("b"),a:r})}isDark(){return this.getBrightness()<128}isLight(){return this.getBrightness()>=128}equals(e){return this.r===e.r&&this.g===e.g&&this.b===e.b&&this.a===e.a}clone(){return this._c(this)}toHexString(){let e="#";const n=(this.r||0).toString(16);e+=n.length===2?n:"0"+n;const r=(this.g||0).toString(16);e+=r.length===2?r:"0"+r;const i=(this.b||0).toString(16);if(e+=i.length===2?i:"0"+i,typeof this.a=="number"&&this.a>=0&&this.a<1){const o=In(this.a*255).toString(16);e+=o.length===2?o:"0"+o}return e}toHsl(){return{h:this.getHue(),s:this.getSaturation(),l:this.getLightness(),a:this.a}}toHslString(){const e=this.getHue(),n=In(this.getSaturation()*100),r=In(this.getLightness()*100);return this.a!==1?`hsla(${e},${n}%,${r}%,${this.a})`:`hsl(${e},${n}%,${r}%)`}toHsv(){return{h:this.getHue(),s:this.getSaturation(),v:this.getValue(),a:this.a}}toRgb(){return{r:this.r,g:this.g,b:this.b,a:this.a}}toRgbString(){return this.a!==1?`rgba(${this.r},${this.g},${this.b},${this.a})`:`rgb(${this.r},${this.g},${this.b})`}toString(){return this.toRgbString()}_sc(e,n,r){const i=this.clone();return i[e]=oa(n,r),i}_c(e){return new this.constructor(e)}getMax(){return typeof this._max>"u"&&(this._max=Math.max(this.r,this.g,this.b)),this._max}getMin(){return typeof this._min>"u"&&(this._min=Math.min(this.r,this.g,this.b)),this._min}fromHexString(e){const n=e.replace("#","");function r(i,o){return parseInt(n[i]+n[o||i],16)}n.length<6?(this.r=r(0),this.g=r(1),this.b=r(2),this.a=n[3]?r(3)/255:1):(this.r=r(0,1),this.g=r(2,3),this.b=r(4,5),this.a=n[6]?r(6,7)/255:1)}fromHsl({h:e,s:n,l:r,a:i}){if(this._h=e%360,this._s=n,this._l=r,this.a=typeof i=="number"?i:1,n<=0){const f=In(r*255);this.r=f,this.g=f,this.b=f}let o=0,a=0,s=0;const A=e/60,c=(1-Math.abs(2*r-1))*n,u=c*(1-Math.abs(A%2-1));A>=0&&A<1?(o=c,a=u):A>=1&&A<2?(o=u,a=c):A>=2&&A<3?(a=c,s=u):A>=3&&A<4?(a=u,s=c):A>=4&&A<5?(o=u,s=c):A>=5&&A<6&&(o=c,s=u);const d=r-c/2;this.r=In((o+d)*255),this.g=In((a+d)*255),this.b=In((s+d)*255)}fromHsv({h:e,s:n,v:r,a:i}){this._h=e%360,this._s=n,this._v=r,this.a=typeof i=="number"?i:1;const o=In(r*255);if(this.r=o,this.g=o,this.b=o,n<=0)return;const a=e/60,s=Math.floor(a),A=a-s,c=In(r*(1-n)*255),u=In(r*(1-n*A)*255),d=In(r*(1-n*(1-A))*255);switch(s){case 0:this.g=d,this.b=c;break;case 1:this.r=u,this.b=c;break;case 2:this.r=c,this.b=d;break;case 3:this.r=c,this.g=u;break;case 4:this.r=d,this.g=c;break;case 5:default:this.g=c,this.b=u;break}}fromHsvString(e){const n=Pc(e,Ag);this.fromHsv({h:n[0],s:n[1],v:n[2],a:n[3]})}fromHslString(e){const n=Pc(e,Ag);this.fromHsl({h:n[0],s:n[1],l:n[2],a:n[3]})}fromRgbString(e){const n=Pc(e,(r,i)=>i.includes("%")?In(r/100*255):r);this.r=n[0],this.g=n[1],this.b=n[2],this.a=n[3]}}var ys=2,cg=.16,Eb=.05,bb=.05,Sb=.15,Nv=5,Dv=4,wb=[{index:7,amount:15},{index:6,amount:25},{index:5,amount:30},{index:5,amount:45},{index:5,amount:65},{index:5,amount:85},{index:4,amount:90},{index:3,amount:95},{index:2,amount:97},{index:1,amount:98}];function lg(t,e,n){var r;return Math.round(t.h)>=60&&Math.round(t.h)<=240?r=n?Math.round(t.h)-ys*e:Math.round(t.h)+ys*e:r=n?Math.round(t.h)+ys*e:Math.round(t.h)-ys*e,r<0?r+=360:r>=360&&(r-=360),r}function ug(t,e,n){if(t.h===0&&t.s===0)return t.s;var r;return n?r=t.s-cg*e:e===Dv?r=t.s+cg:r=t.s+Eb*e,r>1&&(r=1),n&&e===Nv&&r>.1&&(r=.1),r<.06&&(r=.06),Math.round(r*100)/100}function dg(t,e,n){var r;return n?r=t.v+bb*e:r=t.v-Sb*e,r=Math.max(0,Math.min(1,r)),Math.round(r*100)/100}function Ba(t){for(var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=[],r=new Gt(t),i=r.toHsv(),o=Nv;o>0;o-=1){var a=new Gt({h:lg(i,o,!0),s:ug(i,o,!0),v:dg(i,o,!0)});n.push(a)}n.push(r);for(var s=1;s<=Dv;s+=1){var A=new Gt({h:lg(i,s),s:ug(i,s),v:dg(i,s)});n.push(A)}return e.theme==="dark"?wb.map(function(c){var u=c.index,d=c.amount;return new Gt(e.backgroundColor||"#141414").mix(n[u],d).toHexString()}):n.map(function(c){return c.toHexString()})}var Qc={red:"#F5222D",volcano:"#FA541C",orange:"#FA8C16",gold:"#FAAD14",yellow:"#FADB14",lime:"#A0D911",green:"#52C41A",cyan:"#13C2C2",blue:"#1677FF",geekblue:"#2F54EB",purple:"#722ED1",magenta:"#EB2F96",grey:"#666666"},Dl=["#fff1f0","#ffccc7","#ffa39e","#ff7875","#ff4d4f","#f5222d","#cf1322","#a8071a","#820014","#5c0011"];Dl.primary=Dl[5];var Bl=["#fff2e8","#ffd8bf","#ffbb96","#ff9c6e","#ff7a45","#fa541c","#d4380d","#ad2102","#871400","#610b00"];Bl.primary=Bl[5];var Fl=["#fff7e6","#ffe7ba","#ffd591","#ffc069","#ffa940","#fa8c16","#d46b08","#ad4e00","#873800","#612500"];Fl.primary=Fl[5];var kl=["#fffbe6","#fff1b8","#ffe58f","#ffd666","#ffc53d","#faad14","#d48806","#ad6800","#874d00","#613400"];kl.primary=kl[5];var Pl=["#feffe6","#ffffb8","#fffb8f","#fff566","#ffec3d","#fadb14","#d4b106","#ad8b00","#876800","#614700"];Pl.primary=Pl[5];var Ql=["#fcffe6","#f4ffb8","#eaff8f","#d3f261","#bae637","#a0d911","#7cb305","#5b8c00","#3f6600","#254000"];Ql.primary=Ql[5];var jl=["#f6ffed","#d9f7be","#b7eb8f","#95de64","#73d13d","#52c41a","#389e0d","#237804","#135200","#092b00"];jl.primary=jl[5];var Ll=["#e6fffb","#b5f5ec","#87e8de","#5cdbd3","#36cfc9","#13c2c2","#08979c","#006d75","#00474f","#002329"];Ll.primary=Ll[5];var oA=["#e6f4ff","#bae0ff","#91caff","#69b1ff","#4096ff","#1677ff","#0958d9","#003eb3","#002c8c","#001d66"];oA.primary=oA[5];var Ul=["#f0f5ff","#d6e4ff","#adc6ff","#85a5ff","#597ef7","#2f54eb","#1d39c4","#10239e","#061178","#030852"];Ul.primary=Ul[5];var Hl=["#f9f0ff","#efdbff","#d3adf7","#b37feb","#9254de","#722ed1","#531dab","#391085","#22075e","#120338"];Hl.primary=Hl[5];var Gl=["#fff0f6","#ffd6e7","#ffadd2","#ff85c0","#f759ab","#eb2f96","#c41d7f","#9e1068","#780650","#520339"];Gl.primary=Gl[5];var ql=["#a6a6a6","#999999","#8c8c8c","#808080","#737373","#666666","#404040","#1a1a1a","#000000","#000000"];ql.primary=ql[5];var jc={red:Dl,volcano:Bl,orange:Fl,gold:kl,yellow:Pl,lime:Ql,green:jl,cyan:Ll,blue:oA,geekblue:Ul,purple:Hl,magenta:Gl,grey:ql};function Ib(t,e){let{generateColorPalettes:n,generateNeutralColorPalettes:r}=e;const{colorSuccess:i,colorWarning:o,colorError:a,colorInfo:s,colorPrimary:A,colorBgBase:c,colorTextBase:u}=t,d=n(A),f=n(i),p=n(o),v=n(a),C=n(s),m=r(c,u),y=t.colorLink||t.colorInfo,w=n(y),I=new Gt(v[1]).mix(new Gt(v[3]),50).toHexString();return Object.assign(Object.assign({},m),{colorPrimaryBg:d[1],colorPrimaryBgHover:d[2],colorPrimaryBorder:d[3],colorPrimaryBorderHover:d[4],colorPrimaryHover:d[5],colorPrimary:d[6],colorPrimaryActive:d[7],colorPrimaryTextHover:d[8],colorPrimaryText:d[9],colorPrimaryTextActive:d[10],colorSuccessBg:f[1],colorSuccessBgHover:f[2],colorSuccessBorder:f[3],colorSuccessBorderHover:f[4],colorSuccessHover:f[4],colorSuccess:f[6],colorSuccessActive:f[7],colorSuccessTextHover:f[8],colorSuccessText:f[9],colorSuccessTextActive:f[10],colorErrorBg:v[1],colorErrorBgHover:v[2],colorErrorBgFilledHover:I,colorErrorBgActive:v[3],colorErrorBorder:v[3],colorErrorBorderHover:v[4],colorErrorHover:v[5],colorError:v[6],colorErrorActive:v[7],colorErrorTextHover:v[8],colorErrorText:v[9],colorErrorTextActive:v[10],colorWarningBg:p[1],colorWarningBgHover:p[2],colorWarningBorder:p[3],colorWarningBorderHover:p[4],colorWarningHover:p[4],colorWarning:p[6],colorWarningActive:p[7],colorWarningTextHover:p[8],colorWarningText:p[9],colorWarningTextActive:p[10],colorInfoBg:C[1],colorInfoBgHover:C[2],colorInfoBorder:C[3],colorInfoBorderHover:C[4],colorInfoHover:C[4],colorInfo:C[6],colorInfoActive:C[7],colorInfoTextHover:C[8],colorInfoText:C[9],colorInfoTextActive:C[10],colorLinkHover:w[4],colorLink:w[6],colorLinkActive:w[7],colorBgMask:new Gt("#000").setA(.45).toRgbString(),colorWhite:"#fff"})}const xb=t=>{let e=t,n=t,r=t,i=t;return t<6&&t>=5?e=t+1:t<16&&t>=6?e=t+2:t>=16&&(e=16),t<7&&t>=5?n=4:t<8&&t>=7?n=5:t<14&&t>=8?n=6:t<16&&t>=14?n=7:t>=16&&(n=8),t<6&&t>=2?r=1:t>=6&&(r=2),t>4&&t<8?i=4:t>=8&&(i=6),{borderRadius:t,borderRadiusXS:r,borderRadiusSM:n,borderRadiusLG:e,borderRadiusOuter:i}};function Rb(t){const{motionUnit:e,motionBase:n,borderRadius:r,lineWidth:i}=t;return Object.assign({motionDurationFast:`${(n+e).toFixed(1)}s`,motionDurationMid:`${(n+e*2).toFixed(1)}s`,motionDurationSlow:`${(n+e*3).toFixed(1)}s`,lineWidthBold:i+1},xb(r))}const Ob=t=>{const{controlHeight:e}=t;return{controlHeightSM:e*.75,controlHeightXS:e*.5,controlHeightLG:e*1.25}},Mb=t=>{const e=Cb(t),n=e.map(u=>u.size),r=e.map(u=>u.lineHeight),i=n[1],o=n[0],a=n[2],s=r[1],A=r[0],c=r[2];return{fontSizeSM:o,fontSize:i,fontSizeLG:a,fontSizeXL:n[3],fontSizeHeading1:n[6],fontSizeHeading2:n[5],fontSizeHeading3:n[4],fontSizeHeading4:n[3],fontSizeHeading5:n[2],lineHeight:s,lineHeightLG:c,lineHeightSM:A,fontHeight:Math.round(s*i),fontHeightLG:Math.round(c*a),fontHeightSM:Math.round(A*o),lineHeightHeading1:r[6],lineHeightHeading2:r[5],lineHeightHeading3:r[4],lineHeightHeading4:r[3],lineHeightHeading5:r[2]}};function Tb(t){const{sizeUnit:e,sizeStep:n}=t;return{sizeXXL:e*(n+8),sizeXL:e*(n+4),sizeLG:e*(n+2),sizeMD:e*(n+1),sizeMS:e*n,size:e*n,sizeSM:e*(n-1),sizeXS:e*(n-2),sizeXXS:e*(n-3)}}const mr=(t,e)=>new Gt(t).setA(e).toRgbString(),aa=(t,e)=>new Gt(t).darken(e).toHexString(),Nb=t=>{const e=Ba(t);return{1:e[0],2:e[1],3:e[2],4:e[3],5:e[4],6:e[5],7:e[6],8:e[4],9:e[5],10:e[6]}},Db=(t,e)=>{const n=t||"#fff",r=e||"#000";return{colorBgBase:n,colorTextBase:r,colorText:mr(r,.88),colorTextSecondary:mr(r,.65),colorTextTertiary:mr(r,.45),colorTextQuaternary:mr(r,.25),colorFill:mr(r,.15),colorFillSecondary:mr(r,.06),colorFillTertiary:mr(r,.04),colorFillQuaternary:mr(r,.02),colorBgSolid:mr(r,1),colorBgSolidHover:mr(r,.75),colorBgSolidActive:mr(r,.95),colorBgLayout:aa(n,4),colorBgContainer:aa(n,0),colorBgElevated:aa(n,0),colorBgSpotlight:mr(r,.85),colorBgBlur:"transparent",colorBorder:aa(n,15),colorBorderSecondary:aa(n,6)}};function Bb(t){Qc.pink=Qc.magenta,jc.pink=jc.magenta;const e=Object.keys(Tv).map(n=>{const r=t[n]===Qc[n]?jc[n]:Ba(t[n]);return new Array(10).fill(1).reduce((i,o,a)=>(i[`${n}-${a+1}`]=r[a],i[`${n}${a+1}`]=r[a],i),{})}).reduce((n,r)=>(n=Object.assign(Object.assign({},n),r),n),{});return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},t),e),Ib(t,{generateColorPalettes:Nb,generateNeutralColorPalettes:Db})),Mb(t.fontSize)),Tb(t)),Ob(t)),Rb(t))}const Bv=Il(Bb),Zl={token:Da,override:{override:Da},hashed:!0},Fv=N.createContext(Zl);function Lc(t){return t>=0&&t<=255}function ha(t,e){const{r:n,g:r,b:i,a:o}=new Gt(t).toRgb();if(o<1)return t;const{r:a,g:s,b:A}=new Gt(e).toRgb();for(let c=.01;c<=1;c+=.01){const u=Math.round((n-a*(1-c))/c),d=Math.round((r-s*(1-c))/c),f=Math.round((i-A*(1-c))/c);if(Lc(u)&&Lc(d)&&Lc(f))return new Gt({r:u,g:d,b:f,a:Math.round(c*100)/100}).toRgbString()}return new Gt({r:n,g:r,b:i,a:1}).toRgbString()}var Fb=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n};function kv(t){const{override:e}=t,n=Fb(t,["override"]),r=Object.assign({},e);Object.keys(Da).forEach(f=>{delete r[f]});const i=Object.assign(Object.assign({},n),r),o=480,a=576,s=768,A=992,c=1200,u=1600;return i.motion===!1&&(i.motionDurationFast="0s",i.motionDurationMid="0s",i.motionDurationSlow="0s"),Object.assign(Object.assign(Object.assign({},i),{colorFillContent:i.colorFillSecondary,colorFillContentHover:i.colorFill,colorFillAlter:i.colorFillQuaternary,colorBgContainerDisabled:i.colorFillTertiary,colorBorderBg:i.colorBgContainer,colorSplit:ha(i.colorBorderSecondary,i.colorBgContainer),colorTextPlaceholder:i.colorTextQuaternary,colorTextDisabled:i.colorTextQuaternary,colorTextHeading:i.colorText,colorTextLabel:i.colorTextSecondary,colorTextDescription:i.colorTextTertiary,colorTextLightSolid:i.colorWhite,colorHighlight:i.colorError,colorBgTextHover:i.colorFillSecondary,colorBgTextActive:i.colorFill,colorIcon:i.colorTextTertiary,colorIconHover:i.colorText,colorErrorOutline:ha(i.colorErrorBg,i.colorBgContainer),colorWarningOutline:ha(i.colorWarningBg,i.colorBgContainer),fontSizeIcon:i.fontSizeSM,lineWidthFocus:i.lineWidth*3,lineWidth:i.lineWidth,controlOutlineWidth:i.lineWidth*2,controlInteractiveSize:i.controlHeight/2,controlItemBgHover:i.colorFillTertiary,controlItemBgActive:i.colorPrimaryBg,controlItemBgActiveHover:i.colorPrimaryBgHover,controlItemBgActiveDisabled:i.colorFill,controlTmpOutline:i.colorFillQuaternary,controlOutline:ha(i.colorPrimaryBg,i.colorBgContainer),lineType:i.lineType,borderRadius:i.borderRadius,borderRadiusXS:i.borderRadiusXS,borderRadiusSM:i.borderRadiusSM,borderRadiusLG:i.borderRadiusLG,fontWeightStrong:600,opacityLoading:.65,linkDecoration:"none",linkHoverDecoration:"none",linkFocusDecoration:"none",controlPaddingHorizontal:12,controlPaddingHorizontalSM:8,paddingXXS:i.sizeXXS,paddingXS:i.sizeXS,paddingSM:i.sizeSM,padding:i.size,paddingMD:i.sizeMD,paddingLG:i.sizeLG,paddingXL:i.sizeXL,paddingContentHorizontalLG:i.sizeLG,paddingContentVerticalLG:i.sizeMS,paddingContentHorizontal:i.sizeMS,paddingContentVertical:i.sizeSM,paddingContentHorizontalSM:i.size,paddingContentVerticalSM:i.sizeXS,marginXXS:i.sizeXXS,marginXS:i.sizeXS,marginSM:i.sizeSM,margin:i.size,marginMD:i.sizeMD,marginLG:i.sizeLG,marginXL:i.sizeXL,marginXXL:i.sizeXXL,boxShadow:`
23
+ 'Noto Color Emoji'`,fontFamilyCode:"'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace",fontSize:14,lineWidth:1,lineType:"solid",motionUnit:.1,motionBase:0,motionEaseOutCirc:"cubic-bezier(0.08, 0.82, 0.17, 1)",motionEaseInOutCirc:"cubic-bezier(0.78, 0.14, 0.15, 0.86)",motionEaseOut:"cubic-bezier(0.215, 0.61, 0.355, 1)",motionEaseInOut:"cubic-bezier(0.645, 0.045, 0.355, 1)",motionEaseOutBack:"cubic-bezier(0.12, 0.4, 0.29, 1.46)",motionEaseInBack:"cubic-bezier(0.71, -0.46, 0.88, 0.6)",motionEaseInQuint:"cubic-bezier(0.755, 0.05, 0.855, 0.06)",motionEaseOutQuint:"cubic-bezier(0.23, 1, 0.32, 1)",borderRadius:6,sizeUnit:4,sizeStep:4,sizePopupArrow:16,controlHeight:32,zIndexBase:0,zIndexPopupBase:1e3,opacityImage:1,wireframe:!1,motion:!0}),xn=Math.round;function Pc(t,e){const n=t.replace(/^[^(]*\((.*)/,"$1").replace(/\).*/,"").match(/\d*\.?\d+%?/g)||[],r=n.map(i=>parseFloat(i));for(let i=0;i<3;i+=1)r[i]=e(r[i]||0,n[i]||"",i);return n[3]?r[3]=n[3].includes("%")?r[3]/100:r[3]:r[3]=1,r}const Ag=(t,e,n)=>n===0?t:t/100;function oa(t,e){const n=e||255;return t>n?n:t<0?0:t}class Gt{constructor(e){Q(this,"isValid",!0),Q(this,"r",0),Q(this,"g",0),Q(this,"b",0),Q(this,"a",1),Q(this,"_h",void 0),Q(this,"_s",void 0),Q(this,"_l",void 0),Q(this,"_v",void 0),Q(this,"_max",void 0),Q(this,"_min",void 0),Q(this,"_brightness",void 0);function n(r){return r[0]in e&&r[1]in e&&r[2]in e}if(e)if(typeof e=="string"){let i=function(o){return r.startsWith(o)};const r=e.trim();/^#?[A-F\d]{3,8}$/i.test(r)?this.fromHexString(r):i("rgb")?this.fromRgbString(r):i("hsl")?this.fromHslString(r):(i("hsv")||i("hsb"))&&this.fromHsvString(r)}else if(e instanceof Gt)this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this._h=e._h,this._s=e._s,this._l=e._l,this._v=e._v;else if(n("rgb"))this.r=oa(e.r),this.g=oa(e.g),this.b=oa(e.b),this.a=typeof e.a=="number"?oa(e.a,1):1;else if(n("hsl"))this.fromHsl(e);else if(n("hsv"))this.fromHsv(e);else throw new Error("@ant-design/fast-color: unsupported input "+JSON.stringify(e))}setR(e){return this._sc("r",e)}setG(e){return this._sc("g",e)}setB(e){return this._sc("b",e)}setA(e){return this._sc("a",e,1)}setHue(e){const n=this.toHsv();return n.h=e,this._c(n)}getLuminance(){function e(o){const a=o/255;return a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4)}const n=e(this.r),r=e(this.g),i=e(this.b);return .2126*n+.7152*r+.0722*i}getHue(){if(typeof this._h>"u"){const e=this.getMax()-this.getMin();e===0?this._h=0:this._h=xn(60*(this.r===this.getMax()?(this.g-this.b)/e+(this.g<this.b?6:0):this.g===this.getMax()?(this.b-this.r)/e+2:(this.r-this.g)/e+4))}return this._h}getSaturation(){if(typeof this._s>"u"){const e=this.getMax()-this.getMin();e===0?this._s=0:this._s=e/this.getMax()}return this._s}getLightness(){return typeof this._l>"u"&&(this._l=(this.getMax()+this.getMin())/510),this._l}getValue(){return typeof this._v>"u"&&(this._v=this.getMax()/255),this._v}getBrightness(){return typeof this._brightness>"u"&&(this._brightness=(this.r*299+this.g*587+this.b*114)/1e3),this._brightness}darken(e=10){const n=this.getHue(),r=this.getSaturation();let i=this.getLightness()-e/100;return i<0&&(i=0),this._c({h:n,s:r,l:i,a:this.a})}lighten(e=10){const n=this.getHue(),r=this.getSaturation();let i=this.getLightness()+e/100;return i>1&&(i=1),this._c({h:n,s:r,l:i,a:this.a})}mix(e,n=50){const r=this._c(e),i=n/100,o=s=>(r[s]-this[s])*i+this[s],a={r:xn(o("r")),g:xn(o("g")),b:xn(o("b")),a:xn(o("a")*100)/100};return this._c(a)}tint(e=10){return this.mix({r:255,g:255,b:255,a:1},e)}shade(e=10){return this.mix({r:0,g:0,b:0,a:1},e)}onBackground(e){const n=this._c(e),r=this.a+n.a*(1-this.a),i=o=>xn((this[o]*this.a+n[o]*n.a*(1-this.a))/r);return this._c({r:i("r"),g:i("g"),b:i("b"),a:r})}isDark(){return this.getBrightness()<128}isLight(){return this.getBrightness()>=128}equals(e){return this.r===e.r&&this.g===e.g&&this.b===e.b&&this.a===e.a}clone(){return this._c(this)}toHexString(){let e="#";const n=(this.r||0).toString(16);e+=n.length===2?n:"0"+n;const r=(this.g||0).toString(16);e+=r.length===2?r:"0"+r;const i=(this.b||0).toString(16);if(e+=i.length===2?i:"0"+i,typeof this.a=="number"&&this.a>=0&&this.a<1){const o=xn(this.a*255).toString(16);e+=o.length===2?o:"0"+o}return e}toHsl(){return{h:this.getHue(),s:this.getSaturation(),l:this.getLightness(),a:this.a}}toHslString(){const e=this.getHue(),n=xn(this.getSaturation()*100),r=xn(this.getLightness()*100);return this.a!==1?`hsla(${e},${n}%,${r}%,${this.a})`:`hsl(${e},${n}%,${r}%)`}toHsv(){return{h:this.getHue(),s:this.getSaturation(),v:this.getValue(),a:this.a}}toRgb(){return{r:this.r,g:this.g,b:this.b,a:this.a}}toRgbString(){return this.a!==1?`rgba(${this.r},${this.g},${this.b},${this.a})`:`rgb(${this.r},${this.g},${this.b})`}toString(){return this.toRgbString()}_sc(e,n,r){const i=this.clone();return i[e]=oa(n,r),i}_c(e){return new this.constructor(e)}getMax(){return typeof this._max>"u"&&(this._max=Math.max(this.r,this.g,this.b)),this._max}getMin(){return typeof this._min>"u"&&(this._min=Math.min(this.r,this.g,this.b)),this._min}fromHexString(e){const n=e.replace("#","");function r(i,o){return parseInt(n[i]+n[o||i],16)}n.length<6?(this.r=r(0),this.g=r(1),this.b=r(2),this.a=n[3]?r(3)/255:1):(this.r=r(0,1),this.g=r(2,3),this.b=r(4,5),this.a=n[6]?r(6,7)/255:1)}fromHsl({h:e,s:n,l:r,a:i}){if(this._h=e%360,this._s=n,this._l=r,this.a=typeof i=="number"?i:1,n<=0){const f=xn(r*255);this.r=f,this.g=f,this.b=f}let o=0,a=0,s=0;const A=e/60,c=(1-Math.abs(2*r-1))*n,u=c*(1-Math.abs(A%2-1));A>=0&&A<1?(o=c,a=u):A>=1&&A<2?(o=u,a=c):A>=2&&A<3?(a=c,s=u):A>=3&&A<4?(a=u,s=c):A>=4&&A<5?(o=u,s=c):A>=5&&A<6&&(o=c,s=u);const d=r-c/2;this.r=xn((o+d)*255),this.g=xn((a+d)*255),this.b=xn((s+d)*255)}fromHsv({h:e,s:n,v:r,a:i}){this._h=e%360,this._s=n,this._v=r,this.a=typeof i=="number"?i:1;const o=xn(r*255);if(this.r=o,this.g=o,this.b=o,n<=0)return;const a=e/60,s=Math.floor(a),A=a-s,c=xn(r*(1-n)*255),u=xn(r*(1-n*A)*255),d=xn(r*(1-n*(1-A))*255);switch(s){case 0:this.g=d,this.b=c;break;case 1:this.r=u,this.b=c;break;case 2:this.r=c,this.b=d;break;case 3:this.r=c,this.g=u;break;case 4:this.r=d,this.g=c;break;case 5:default:this.g=c,this.b=u;break}}fromHsvString(e){const n=Pc(e,Ag);this.fromHsv({h:n[0],s:n[1],v:n[2],a:n[3]})}fromHslString(e){const n=Pc(e,Ag);this.fromHsl({h:n[0],s:n[1],l:n[2],a:n[3]})}fromRgbString(e){const n=Pc(e,(r,i)=>i.includes("%")?xn(r/100*255):r);this.r=n[0],this.g=n[1],this.b=n[2],this.a=n[3]}}var ys=2,cg=.16,Eb=.05,bb=.05,Sb=.15,Nv=5,Dv=4,wb=[{index:7,amount:15},{index:6,amount:25},{index:5,amount:30},{index:5,amount:45},{index:5,amount:65},{index:5,amount:85},{index:4,amount:90},{index:3,amount:95},{index:2,amount:97},{index:1,amount:98}];function lg(t,e,n){var r;return Math.round(t.h)>=60&&Math.round(t.h)<=240?r=n?Math.round(t.h)-ys*e:Math.round(t.h)+ys*e:r=n?Math.round(t.h)+ys*e:Math.round(t.h)-ys*e,r<0?r+=360:r>=360&&(r-=360),r}function ug(t,e,n){if(t.h===0&&t.s===0)return t.s;var r;return n?r=t.s-cg*e:e===Dv?r=t.s+cg:r=t.s+Eb*e,r>1&&(r=1),n&&e===Nv&&r>.1&&(r=.1),r<.06&&(r=.06),Math.round(r*100)/100}function dg(t,e,n){var r;return n?r=t.v+bb*e:r=t.v-Sb*e,r=Math.max(0,Math.min(1,r)),Math.round(r*100)/100}function Ba(t){for(var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=[],r=new Gt(t),i=r.toHsv(),o=Nv;o>0;o-=1){var a=new Gt({h:lg(i,o,!0),s:ug(i,o,!0),v:dg(i,o,!0)});n.push(a)}n.push(r);for(var s=1;s<=Dv;s+=1){var A=new Gt({h:lg(i,s),s:ug(i,s),v:dg(i,s)});n.push(A)}return e.theme==="dark"?wb.map(function(c){var u=c.index,d=c.amount;return new Gt(e.backgroundColor||"#141414").mix(n[u],d).toHexString()}):n.map(function(c){return c.toHexString()})}var Qc={red:"#F5222D",volcano:"#FA541C",orange:"#FA8C16",gold:"#FAAD14",yellow:"#FADB14",lime:"#A0D911",green:"#52C41A",cyan:"#13C2C2",blue:"#1677FF",geekblue:"#2F54EB",purple:"#722ED1",magenta:"#EB2F96",grey:"#666666"},Dl=["#fff1f0","#ffccc7","#ffa39e","#ff7875","#ff4d4f","#f5222d","#cf1322","#a8071a","#820014","#5c0011"];Dl.primary=Dl[5];var Bl=["#fff2e8","#ffd8bf","#ffbb96","#ff9c6e","#ff7a45","#fa541c","#d4380d","#ad2102","#871400","#610b00"];Bl.primary=Bl[5];var Fl=["#fff7e6","#ffe7ba","#ffd591","#ffc069","#ffa940","#fa8c16","#d46b08","#ad4e00","#873800","#612500"];Fl.primary=Fl[5];var kl=["#fffbe6","#fff1b8","#ffe58f","#ffd666","#ffc53d","#faad14","#d48806","#ad6800","#874d00","#613400"];kl.primary=kl[5];var Pl=["#feffe6","#ffffb8","#fffb8f","#fff566","#ffec3d","#fadb14","#d4b106","#ad8b00","#876800","#614700"];Pl.primary=Pl[5];var Ql=["#fcffe6","#f4ffb8","#eaff8f","#d3f261","#bae637","#a0d911","#7cb305","#5b8c00","#3f6600","#254000"];Ql.primary=Ql[5];var jl=["#f6ffed","#d9f7be","#b7eb8f","#95de64","#73d13d","#52c41a","#389e0d","#237804","#135200","#092b00"];jl.primary=jl[5];var Ll=["#e6fffb","#b5f5ec","#87e8de","#5cdbd3","#36cfc9","#13c2c2","#08979c","#006d75","#00474f","#002329"];Ll.primary=Ll[5];var oA=["#e6f4ff","#bae0ff","#91caff","#69b1ff","#4096ff","#1677ff","#0958d9","#003eb3","#002c8c","#001d66"];oA.primary=oA[5];var Ul=["#f0f5ff","#d6e4ff","#adc6ff","#85a5ff","#597ef7","#2f54eb","#1d39c4","#10239e","#061178","#030852"];Ul.primary=Ul[5];var Hl=["#f9f0ff","#efdbff","#d3adf7","#b37feb","#9254de","#722ed1","#531dab","#391085","#22075e","#120338"];Hl.primary=Hl[5];var Gl=["#fff0f6","#ffd6e7","#ffadd2","#ff85c0","#f759ab","#eb2f96","#c41d7f","#9e1068","#780650","#520339"];Gl.primary=Gl[5];var ql=["#a6a6a6","#999999","#8c8c8c","#808080","#737373","#666666","#404040","#1a1a1a","#000000","#000000"];ql.primary=ql[5];var jc={red:Dl,volcano:Bl,orange:Fl,gold:kl,yellow:Pl,lime:Ql,green:jl,cyan:Ll,blue:oA,geekblue:Ul,purple:Hl,magenta:Gl,grey:ql};function Ib(t,e){let{generateColorPalettes:n,generateNeutralColorPalettes:r}=e;const{colorSuccess:i,colorWarning:o,colorError:a,colorInfo:s,colorPrimary:A,colorBgBase:c,colorTextBase:u}=t,d=n(A),f=n(i),p=n(o),v=n(a),C=n(s),m=r(c,u),y=t.colorLink||t.colorInfo,w=n(y),I=new Gt(v[1]).mix(new Gt(v[3]),50).toHexString();return Object.assign(Object.assign({},m),{colorPrimaryBg:d[1],colorPrimaryBgHover:d[2],colorPrimaryBorder:d[3],colorPrimaryBorderHover:d[4],colorPrimaryHover:d[5],colorPrimary:d[6],colorPrimaryActive:d[7],colorPrimaryTextHover:d[8],colorPrimaryText:d[9],colorPrimaryTextActive:d[10],colorSuccessBg:f[1],colorSuccessBgHover:f[2],colorSuccessBorder:f[3],colorSuccessBorderHover:f[4],colorSuccessHover:f[4],colorSuccess:f[6],colorSuccessActive:f[7],colorSuccessTextHover:f[8],colorSuccessText:f[9],colorSuccessTextActive:f[10],colorErrorBg:v[1],colorErrorBgHover:v[2],colorErrorBgFilledHover:I,colorErrorBgActive:v[3],colorErrorBorder:v[3],colorErrorBorderHover:v[4],colorErrorHover:v[5],colorError:v[6],colorErrorActive:v[7],colorErrorTextHover:v[8],colorErrorText:v[9],colorErrorTextActive:v[10],colorWarningBg:p[1],colorWarningBgHover:p[2],colorWarningBorder:p[3],colorWarningBorderHover:p[4],colorWarningHover:p[4],colorWarning:p[6],colorWarningActive:p[7],colorWarningTextHover:p[8],colorWarningText:p[9],colorWarningTextActive:p[10],colorInfoBg:C[1],colorInfoBgHover:C[2],colorInfoBorder:C[3],colorInfoBorderHover:C[4],colorInfoHover:C[4],colorInfo:C[6],colorInfoActive:C[7],colorInfoTextHover:C[8],colorInfoText:C[9],colorInfoTextActive:C[10],colorLinkHover:w[4],colorLink:w[6],colorLinkActive:w[7],colorBgMask:new Gt("#000").setA(.45).toRgbString(),colorWhite:"#fff"})}const xb=t=>{let e=t,n=t,r=t,i=t;return t<6&&t>=5?e=t+1:t<16&&t>=6?e=t+2:t>=16&&(e=16),t<7&&t>=5?n=4:t<8&&t>=7?n=5:t<14&&t>=8?n=6:t<16&&t>=14?n=7:t>=16&&(n=8),t<6&&t>=2?r=1:t>=6&&(r=2),t>4&&t<8?i=4:t>=8&&(i=6),{borderRadius:t,borderRadiusXS:r,borderRadiusSM:n,borderRadiusLG:e,borderRadiusOuter:i}};function Rb(t){const{motionUnit:e,motionBase:n,borderRadius:r,lineWidth:i}=t;return Object.assign({motionDurationFast:`${(n+e).toFixed(1)}s`,motionDurationMid:`${(n+e*2).toFixed(1)}s`,motionDurationSlow:`${(n+e*3).toFixed(1)}s`,lineWidthBold:i+1},xb(r))}const Ob=t=>{const{controlHeight:e}=t;return{controlHeightSM:e*.75,controlHeightXS:e*.5,controlHeightLG:e*1.25}},Mb=t=>{const e=Cb(t),n=e.map(u=>u.size),r=e.map(u=>u.lineHeight),i=n[1],o=n[0],a=n[2],s=r[1],A=r[0],c=r[2];return{fontSizeSM:o,fontSize:i,fontSizeLG:a,fontSizeXL:n[3],fontSizeHeading1:n[6],fontSizeHeading2:n[5],fontSizeHeading3:n[4],fontSizeHeading4:n[3],fontSizeHeading5:n[2],lineHeight:s,lineHeightLG:c,lineHeightSM:A,fontHeight:Math.round(s*i),fontHeightLG:Math.round(c*a),fontHeightSM:Math.round(A*o),lineHeightHeading1:r[6],lineHeightHeading2:r[5],lineHeightHeading3:r[4],lineHeightHeading4:r[3],lineHeightHeading5:r[2]}};function Tb(t){const{sizeUnit:e,sizeStep:n}=t;return{sizeXXL:e*(n+8),sizeXL:e*(n+4),sizeLG:e*(n+2),sizeMD:e*(n+1),sizeMS:e*n,size:e*n,sizeSM:e*(n-1),sizeXS:e*(n-2),sizeXXS:e*(n-3)}}const mr=(t,e)=>new Gt(t).setA(e).toRgbString(),aa=(t,e)=>new Gt(t).darken(e).toHexString(),Nb=t=>{const e=Ba(t);return{1:e[0],2:e[1],3:e[2],4:e[3],5:e[4],6:e[5],7:e[6],8:e[4],9:e[5],10:e[6]}},Db=(t,e)=>{const n=t||"#fff",r=e||"#000";return{colorBgBase:n,colorTextBase:r,colorText:mr(r,.88),colorTextSecondary:mr(r,.65),colorTextTertiary:mr(r,.45),colorTextQuaternary:mr(r,.25),colorFill:mr(r,.15),colorFillSecondary:mr(r,.06),colorFillTertiary:mr(r,.04),colorFillQuaternary:mr(r,.02),colorBgSolid:mr(r,1),colorBgSolidHover:mr(r,.75),colorBgSolidActive:mr(r,.95),colorBgLayout:aa(n,4),colorBgContainer:aa(n,0),colorBgElevated:aa(n,0),colorBgSpotlight:mr(r,.85),colorBgBlur:"transparent",colorBorder:aa(n,15),colorBorderSecondary:aa(n,6)}};function Bb(t){Qc.pink=Qc.magenta,jc.pink=jc.magenta;const e=Object.keys(Tv).map(n=>{const r=t[n]===Qc[n]?jc[n]:Ba(t[n]);return new Array(10).fill(1).reduce((i,o,a)=>(i[`${n}-${a+1}`]=r[a],i[`${n}${a+1}`]=r[a],i),{})}).reduce((n,r)=>(n=Object.assign(Object.assign({},n),r),n),{});return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},t),e),Ib(t,{generateColorPalettes:Nb,generateNeutralColorPalettes:Db})),Mb(t.fontSize)),Tb(t)),Ob(t)),Rb(t))}const Bv=Il(Bb),Zl={token:Da,override:{override:Da},hashed:!0},Fv=N.createContext(Zl);function Lc(t){return t>=0&&t<=255}function ha(t,e){const{r:n,g:r,b:i,a:o}=new Gt(t).toRgb();if(o<1)return t;const{r:a,g:s,b:A}=new Gt(e).toRgb();for(let c=.01;c<=1;c+=.01){const u=Math.round((n-a*(1-c))/c),d=Math.round((r-s*(1-c))/c),f=Math.round((i-A*(1-c))/c);if(Lc(u)&&Lc(d)&&Lc(f))return new Gt({r:u,g:d,b:f,a:Math.round(c*100)/100}).toRgbString()}return new Gt({r:n,g:r,b:i,a:1}).toRgbString()}var Fb=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n};function kv(t){const{override:e}=t,n=Fb(t,["override"]),r=Object.assign({},e);Object.keys(Da).forEach(f=>{delete r[f]});const i=Object.assign(Object.assign({},n),r),o=480,a=576,s=768,A=992,c=1200,u=1600;return i.motion===!1&&(i.motionDurationFast="0s",i.motionDurationMid="0s",i.motionDurationSlow="0s"),Object.assign(Object.assign(Object.assign({},i),{colorFillContent:i.colorFillSecondary,colorFillContentHover:i.colorFill,colorFillAlter:i.colorFillQuaternary,colorBgContainerDisabled:i.colorFillTertiary,colorBorderBg:i.colorBgContainer,colorSplit:ha(i.colorBorderSecondary,i.colorBgContainer),colorTextPlaceholder:i.colorTextQuaternary,colorTextDisabled:i.colorTextQuaternary,colorTextHeading:i.colorText,colorTextLabel:i.colorTextSecondary,colorTextDescription:i.colorTextTertiary,colorTextLightSolid:i.colorWhite,colorHighlight:i.colorError,colorBgTextHover:i.colorFillSecondary,colorBgTextActive:i.colorFill,colorIcon:i.colorTextTertiary,colorIconHover:i.colorText,colorErrorOutline:ha(i.colorErrorBg,i.colorBgContainer),colorWarningOutline:ha(i.colorWarningBg,i.colorBgContainer),fontSizeIcon:i.fontSizeSM,lineWidthFocus:i.lineWidth*3,lineWidth:i.lineWidth,controlOutlineWidth:i.lineWidth*2,controlInteractiveSize:i.controlHeight/2,controlItemBgHover:i.colorFillTertiary,controlItemBgActive:i.colorPrimaryBg,controlItemBgActiveHover:i.colorPrimaryBgHover,controlItemBgActiveDisabled:i.colorFill,controlTmpOutline:i.colorFillQuaternary,controlOutline:ha(i.colorPrimaryBg,i.colorBgContainer),lineType:i.lineType,borderRadius:i.borderRadius,borderRadiusXS:i.borderRadiusXS,borderRadiusSM:i.borderRadiusSM,borderRadiusLG:i.borderRadiusLG,fontWeightStrong:600,opacityLoading:.65,linkDecoration:"none",linkHoverDecoration:"none",linkFocusDecoration:"none",controlPaddingHorizontal:12,controlPaddingHorizontalSM:8,paddingXXS:i.sizeXXS,paddingXS:i.sizeXS,paddingSM:i.sizeSM,padding:i.size,paddingMD:i.sizeMD,paddingLG:i.sizeLG,paddingXL:i.sizeXL,paddingContentHorizontalLG:i.sizeLG,paddingContentVerticalLG:i.sizeMS,paddingContentHorizontal:i.sizeMS,paddingContentVertical:i.sizeSM,paddingContentHorizontalSM:i.size,paddingContentVerticalSM:i.sizeXS,marginXXS:i.sizeXXS,marginXS:i.sizeXS,marginSM:i.sizeSM,margin:i.size,marginMD:i.sizeMD,marginLG:i.sizeLG,marginXL:i.sizeXL,marginXXL:i.sizeXXL,boxShadow:`
24
24
  0 6px 16px 0 rgba(0, 0, 0, 0.08),
25
25
  0 3px 6px -4px rgba(0, 0, 0, 0.12),
26
26
  0 9px 28px 8px rgba(0, 0, 0, 0.05)
@@ -97,7 +97,7 @@ React keys must be passed directly to JSX without using spread:
97
97
  `+A+" | "+qc("",o.column-1," ")+qc("",u-o.column,"^")}else n+=`
98
98
  at `+a}return n}};const VS=function(t,e){const n={},r=(e=e!==void 0?e:{}).grammarSource,i={Contact:119,Name_Addr_Header:156,Record_Route:176,Request_Response:81,SIP_URI:45,Subscription_State:186,Supported:191,Require:182,Via:194,absoluteURI:84,Call_ID:118,Content_Disposition:130,Content_Length:135,Content_Type:136,CSeq:146,displayName:122,Event:149,From:151,host:52,Max_Forwards:154,Min_SE:213,Proxy_Authenticate:157,quoted_string:40,Refer_To:178,Replaces:179,Session_Expires:210,stun_URI:217,To:192,turn_URI:223,uuid:226,WWW_Authenticate:209,challenge:158,sipfrag:230,Referred_By:231};let o=119;const a=[`\r
99
99
  `,y(`\r
100
- `,!1),/^[0-9]/,w([["0","9"]],!1,!1),/^[a-zA-Z]/,w([["a","z"],["A","Z"]],!1,!1),/^[0-9a-fA-F]/,w([["0","9"],["a","f"],["A","F"]],!1,!1),/^[\0-\xFF]/,w([["\0","ÿ"]],!1,!1),/^["]/,w(['"'],!1,!1)," ",y(" ",!1)," ",y(" ",!1),/^[a-zA-Z0-9]/,w([["a","z"],["A","Z"],["0","9"]],!1,!1),";",y(";",!1),"/",y("/",!1),"?",y("?",!1),":",y(":",!1),"@",y("@",!1),"&",y("&",!1),"=",y("=",!1),"+",y("+",!1),"$",y("$",!1),",",y(",",!1),"-",y("-",!1),"_",y("_",!1),".",y(".",!1),"!",y("!",!1),"~",y("~",!1),"*",y("*",!1),"'",y("'",!1),"(",y("(",!1),")",y(")",!1),"%",y("%",!1),function(){return" "},function(){return":"},/^[!-~]/,w([["!","~"]],!1,!1),/^[\x80-\uFFFF]/,w([["€","￿"]],!1,!1),/^[\x80-\xBF]/,w([["€","¿"]],!1,!1),/^[a-f]/,w([["a","f"]],!1,!1),"`",y("`",!1),"<",y("<",!1),">",y(">",!1),"\\",y("\\",!1),"[",y("[",!1),"]",y("]",!1),"{",y("{",!1),"}",y("}",!1),function(){return"*"},function(){return"/"},function(){return"="},function(){return"("},function(){return")"},function(){return">"},function(){return"<"},function(){return","},function(){return";"},function(){return":"},function(){return'"'},/^[!-']/,w([["!","'"]],!1,!1),/^[*-[]/,w([["*","["]],!1,!1),/^[\]-~]/,w([["]","~"]],!1,!1),function(h){return h},/^[#-[]/,w([["#","["]],!1,!1),/^[\0-\t]/,w([["\0"," "]],!1,!1),/^[\v-\f]/,w([["\v","\f"]],!1,!1),/^[\x0E-\x7F]/,w([["",""]],!1,!1),function(){(e=e||{data:{}}).data.uri=new Ni(e.data.scheme,e.data.user,e.data.host,e.data.port),delete e.data.scheme,delete e.data.user,delete e.data.host,delete e.data.host_type,delete e.data.port},function(){(e=e||{data:{}}).data.uri=new Ni(e.data.scheme,e.data.user,e.data.host,e.data.port,e.data.uri_params,e.data.uri_headers),delete e.data.scheme,delete e.data.user,delete e.data.host,delete e.data.host_type,delete e.data.port,delete e.data.uri_params,e.startRule==="SIP_URI"&&(e.data=e.data.uri)},"sips",y("sips",!0),"sip",y("sip",!0),function(h){(e=e||{data:{}}).data.scheme=h},function(){(e=e||{data:{}}).data.user=decodeURIComponent(C().slice(0,-1))},function(){(e=e||{data:{}}).data.password=C()},function(){return(e=e||{data:{}}).data.host=C(),e.data.host},function(){return(e=e||{data:{}}).data.host_type="domain",C()},/^[a-zA-Z0-9_\-]/,w([["a","z"],["A","Z"],["0","9"],"_","-"],!1,!1),/^[a-zA-Z0-9\-]/,w([["a","z"],["A","Z"],["0","9"],"-"],!1,!1),function(){return(e=e||{data:{}}).data.host_type="IPv6",C()},"::",y("::",!1),function(){return(e=e||{data:{}}).data.host_type="IPv6",C()},function(){return(e=e||{data:{}}).data.host_type="IPv4",C()},"25",y("25",!1),/^[0-5]/,w([["0","5"]],!1,!1),"2",y("2",!1),/^[0-4]/,w([["0","4"]],!1,!1),"1",y("1",!1),/^[1-9]/,w([["1","9"]],!1,!1),function(h){return e=e||{data:{}},h=parseInt(h.join("")),e.data.port=h,h},"transport=",y("transport=",!0),"udp",y("udp",!0),"tcp",y("tcp",!0),"sctp",y("sctp",!0),"tls",y("tls",!0),function(h){(e=e||{data:{}}).data.uri_params||(e.data.uri_params={}),e.data.uri_params.transport=h.toLowerCase()},"user=",y("user=",!0),"phone",y("phone",!0),"ip",y("ip",!0),function(h){(e=e||{data:{}}).data.uri_params||(e.data.uri_params={}),e.data.uri_params.user=h.toLowerCase()},"method=",y("method=",!0),function(h){(e=e||{data:{}}).data.uri_params||(e.data.uri_params={}),e.data.uri_params.method=h},"ttl=",y("ttl=",!0),function(h){(e=e||{data:{}}).data.params||(e.data.params={}),e.data.params.ttl=h},"maddr=",y("maddr=",!0),function(h){(e=e||{data:{}}).data.uri_params||(e.data.uri_params={}),e.data.uri_params.maddr=h},"lr",y("lr",!0),function(){(e=e||{data:{}}).data.uri_params||(e.data.uri_params={}),e.data.uri_params.lr=void 0},function(h,S){(e=e||{data:{}}).data.uri_params||(e.data.uri_params={}),S=S===null?void 0:S[1],e.data.uri_params[h.toLowerCase()]=S},function(h,S){h=h.join("").toLowerCase(),S=S.join(""),(e=e||{data:{}}).data.uri_headers||(e.data.uri_headers={}),e.data.uri_headers[h]?e.data.uri_headers[h].push(S):e.data.uri_headers[h]=[S]},function(){(e=e||{data:{}}).startRule==="Refer_To"&&(e.data.uri=new Ni(e.data.scheme,e.data.user,e.data.host,e.data.port,e.data.uri_params,e.data.uri_headers),delete e.data.scheme,delete e.data.user,delete e.data.host,delete e.data.host_type,delete e.data.port,delete e.data.uri_params)},"//",y("//",!1),function(){(e=e||{data:{}}).data.scheme=C()},y("SIP",!0),function(){(e=e||{data:{}}).data.sip_version=C()},"INVITE",y("INVITE",!1),"ACK",y("ACK",!1),"VXACH",y("VXACH",!1),"OPTIONS",y("OPTIONS",!1),"BYE",y("BYE",!1),"CANCEL",y("CANCEL",!1),"REGISTER",y("REGISTER",!1),"SUBSCRIBE",y("SUBSCRIBE",!1),"NOTIFY",y("NOTIFY",!1),"REFER",y("REFER",!1),"PUBLISH",y("PUBLISH",!1),function(){return(e=e||{data:{}}).data.method=C(),e.data.method},function(h){(e=e||{data:{}}).data.status_code=parseInt(h.join(""))},function(){(e=e||{data:{}}).data.reason_phrase=C()},function(){(e=e||{data:{}}).data=C()},function(){var h,S;for(S=(e=e||{data:{}}).data.multi_header.length,h=0;h<S;h++)if(e.data.multi_header[h].parsed===null){e.data=null;break}e.data!==null?e.data=e.data.multi_header:e.data=-1},function(){var h;(e=e||{data:{}}).data.multi_header||(e.data.multi_header=[]);try{h=new $n(e.data.uri,e.data.displayName,e.data.params),delete e.data.uri,delete e.data.displayName,delete e.data.params}catch{h=null}e.data.multi_header.push({position:A,offset:m().start.offset,parsed:h})},function(h){(h=C().trim())[0]==='"'&&(h=h.substring(1,h.length-1)),(e=e||{data:{}}).data.displayName=h},"q",y("q",!0),function(h){(e=e||{data:{}}).data.params||(e.data.params={}),e.data.params.q=h},"expires",y("expires",!0),function(h){(e=e||{data:{}}).data.params||(e.data.params={}),e.data.params.expires=h},function(h){return parseInt(h.join(""))},"0",y("0",!1),function(){return parseFloat(C())},function(h,S){(e=e||{data:{}}).data.params||(e.data.params={}),S=S===null?void 0:S[1],e.data.params[h.toLowerCase()]=S},"render",y("render",!0),"session",y("session",!0),"icon",y("icon",!0),"alert",y("alert",!0),function(){(e=e||{data:{}}).startRule==="Content_Disposition"&&(e.data.type=C().toLowerCase())},"handling",y("handling",!0),"optional",y("optional",!0),"required",y("required",!0),function(h){(e=e||{data:{}}).data=parseInt(h.join(""))},function(){(e=e||{data:{}}).data=C()},"text",y("text",!0),"image",y("image",!0),"audio",y("audio",!0),"video",y("video",!0),"application",y("application",!0),"message",y("message",!0),"multipart",y("multipart",!0),"x-",y("x-",!0),function(h){(e=e||{data:{}}).data.value=parseInt(h.join(""))},function(h){(e=e||{data:{}}).data=h},function(h){(e=e||{data:{}}).data.event=h.toLowerCase()},function(){var h=(e=e||{data:{}}).data.tag;e.data=new $n(e.data.uri,e.data.displayName,e.data.params),h&&e.data.setParam("tag",h)},"tag",y("tag",!0),function(h){(e=e||{data:{}}).data.tag=h},function(h){(e=e||{data:{}}).data=parseInt(h.join(""))},function(h){(e=e||{data:{}}).data=h},function(){(e=e||{data:{}}).data=new $n(e.data.uri,e.data.displayName,e.data.params)},"digest",y("Digest",!0),"realm",y("realm",!0),function(h){(e=e||{data:{}}).data.realm=h},"domain",y("domain",!0),"nonce",y("nonce",!0),function(h){(e=e||{data:{}}).data.nonce=h},"opaque",y("opaque",!0),function(h){(e=e||{data:{}}).data.opaque=h},"stale",y("stale",!0),"true",y("true",!0),function(){(e=e||{data:{}}).data.stale=!0},"false",y("false",!0),function(){(e=e||{data:{}}).data.stale=!1},"algorithm",y("algorithm",!0),"md5",y("MD5",!0),"md5-sess",y("MD5-sess",!0),function(h){(e=e||{data:{}}).data.algorithm=h.toUpperCase()},"qop",y("qop",!0),"auth-int",y("auth-int",!0),"auth",y("auth",!0),function(h){(e=e||{data:{}}).data.qop||(e.data.qop=[]),e.data.qop.push(h.toLowerCase())},function(h){(e=e||{data:{}}).data.value=parseInt(h.join(""))},function(){var h,S;for(S=(e=e||{data:{}}).data.multi_header.length,h=0;h<S;h++)if(e.data.multi_header[h].parsed===null){e.data=null;break}e.data!==null?e.data=e.data.multi_header:e.data=-1},function(){var h;(e=e||{data:{}}).data.multi_header||(e.data.multi_header=[]);try{h=new $n(e.data.uri,e.data.displayName,e.data.params),delete e.data.uri,delete e.data.displayName,delete e.data.params}catch{h=null}e.data.multi_header.push({position:A,offset:m().start.offset,parsed:h})},function(){(e=e||{data:{}}).data=new $n(e.data.uri,e.data.displayName,e.data.params)},function(){(e=e||{data:{}}).data.replaces_from_tag&&e.data.replaces_to_tag||(e.data=-1)},function(){(e=e||{data:{}}).data={call_id:e.data}},"from-tag",y("from-tag",!0),function(h){(e=e||{data:{}}).data.replaces_from_tag=h},"to-tag",y("to-tag",!0),function(h){(e=e||{data:{}}).data.replaces_to_tag=h},"early-only",y("early-only",!0),function(){(e=e||{data:{}}).data.early_only=!0},function(h,S){return S},function(h,S){return function(T,R){return[T].concat(R)}(h,S)},function(h){(e=e||{data:{}}).startRule==="Require"&&(e.data=h||[])},function(h){(e=e||{data:{}}).data.value=parseInt(h.join(""))},"active",y("active",!0),"pending",y("pending",!0),"terminated",y("terminated",!0),function(){(e=e||{data:{}}).data.state=C()},"reason",y("reason",!0),function(h){e=e||{data:{}},h!==void 0&&(e.data.reason=h)},function(h){e=e||{data:{}},h!==void 0&&(e.data.expires=h)},"retry_after",y("retry_after",!0),function(h){e=e||{data:{}},h!==void 0&&(e.data.retry_after=h)},"deactivated",y("deactivated",!0),"probation",y("probation",!0),"rejected",y("rejected",!0),"timeout",y("timeout",!0),"giveup",y("giveup",!0),"noresource",y("noresource",!0),"invariant",y("invariant",!0),function(h){(e=e||{data:{}}).startRule==="Supported"&&(e.data=h||[])},function(){var h=(e=e||{data:{}}).data.tag;e.data=new $n(e.data.uri,e.data.displayName,e.data.params),h&&e.data.setParam("tag",h)},"ttl",y("ttl",!0),function(h){(e=e||{data:{}}).data.ttl=h},"maddr",y("maddr",!0),function(h){(e=e||{data:{}}).data.maddr=h},"received",y("received",!0),function(h){(e=e||{data:{}}).data.received=h},"branch",y("branch",!0),function(h){(e=e||{data:{}}).data.branch=h},"rport",y("rport",!0),function(h){e=e||{data:{}},h!==void 0&&(e.data.rport=h.join(""))},function(h){(e=e||{data:{}}).data.protocol=h},y("UDP",!0),y("TCP",!0),y("TLS",!0),y("SCTP",!0),function(h){(e=e||{data:{}}).data.transport=h},function(){(e=e||{data:{}}).data.host=C()},function(h){(e=e||{data:{}}).data.port=parseInt(h.join(""))},function(h){return parseInt(h.join(""))},function(h){(e=e||{data:{}}).startRule==="Session_Expires"&&(e.data.deltaSeconds=h)},"refresher",y("refresher",!1),"uas",y("uas",!1),"uac",y("uac",!1),function(h){(e=e||{data:{}}).startRule==="Session_Expires"&&(e.data.refresher=h)},function(h){(e=e||{data:{}}).startRule==="Min_SE"&&(e.data=h)},"stuns",y("stuns",!0),"stun",y("stun",!0),function(h){(e=e||{data:{}}).data.scheme=h},function(h){(e=e||{data:{}}).data.host=h},"?transport=",y("?transport=",!1),"turns",y("turns",!0),"turn",y("turn",!0),function(h){(e=e||{data:{}}).data.transport=h},function(){(e=e||{data:{}}).data=C()},"Referred-By",y("Referred-By",!1),"b",y("b",!1),"cid",y("cid",!1)],s=[g('2 ""6 7!'),g('4"""5!7#'),g('4$""5!7%'),g(`4&""5!7'`),g(";'.# &;("),g('4(""5!7)'),g('4*""5!7+'),g('2,""6,7-'),g('2.""6.7/'),g('40""5!71'),g('22""6273.‰ &24""6475.} &26""6677.q &28""6879.e &2:""6:7;.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E'),g(";).# &;,"),g('2F""6F7G.} &2H""6H7I.q &2J""6J7K.e &2L""6L7M.Y &2N""6N7O.M &2P""6P7Q.A &2R""6R7S.5 &2T""6T7U.) &2V""6V7W'),g(`%%2X""6X7Y/5#;#/,$;#/#$+#)(#'#("'#&'#/"!&,)`),g(`%%$;$0#*;$&/,#; /#$+")("'#&'#." &"/=#$;$/&#0#*;$&&&#/'$8":Z" )("'#&'#`),g(';.." &"'),g(`%$;'.# &;(0)*;'.# &;(&/?#28""6879/0$;//'$8#:[# )(#'#("'#&'#`),g(`%%$;2/&#0#*;2&&&#/g#$%$;.0#*;.&/,#;2/#$+")("'#&'#0=*%$;.0#*;.&/,#;2/#$+")("'#&'#&/#$+")("'#&'#/"!&,)`),g('4\\""5!7].# &;3'),g('4^""5!7_'),g('4`""5!7a'),g(';!.) &4b""5!7c'),g('%$;).• &2F""6F7G.‰ &2J""6J7K.} &2L""6L7M.q &2X""6X7Y.e &2P""6P7Q.Y &2H""6H7I.M &2@""6@7A.A &2d""6d7e.5 &2R""6R7S.) &2N""6N7O/ž#0›*;).• &2F""6F7G.‰ &2J""6J7K.} &2L""6L7M.q &2X""6X7Y.e &2P""6P7Q.Y &2H""6H7I.M &2@""6@7A.A &2d""6d7e.5 &2R""6R7S.) &2N""6N7O&&&#/"!&,)'),g('%$;).‰ &2F""6F7G.} &2L""6L7M.q &2X""6X7Y.e &2P""6P7Q.Y &2H""6H7I.M &2@""6@7A.A &2d""6d7e.5 &2R""6R7S.) &2N""6N7O/’#0*;).‰ &2F""6F7G.} &2L""6L7M.q &2X""6X7Y.e &2P""6P7Q.Y &2H""6H7I.M &2@""6@7A.A &2d""6d7e.5 &2R""6R7S.) &2N""6N7O&&&#/"!&,)'),g(`2T""6T7U.ã &2V""6V7W.× &2f""6f7g.Ë &2h""6h7i.¿ &2:""6:7;.³ &2D""6D7E.§ &22""6273.› &28""6879. &2j""6j7k.ƒ &;&.} &24""6475.q &2l""6l7m.e &2n""6n7o.Y &26""6677.M &2>""6>7?.A &2p""6p7q.5 &2r""6r7s.) &;'.# &;(`),g('%$;).ī &2F""6F7G.ğ &2J""6J7K.ē &2L""6L7M.ć &2X""6X7Y.û &2P""6P7Q.ï &2H""6H7I.ã &2@""6@7A.× &2d""6d7e.Ë &2R""6R7S.¿ &2N""6N7O.³ &2T""6T7U.§ &2V""6V7W.› &2f""6f7g. &2h""6h7i.ƒ &28""6879.w &2j""6j7k.k &;&.e &24""6475.Y &2l""6l7m.M &2n""6n7o.A &26""6677.5 &2p""6p7q.) &2r""6r7s/Ĵ#0ı*;).ī &2F""6F7G.ğ &2J""6J7K.ē &2L""6L7M.ć &2X""6X7Y.û &2P""6P7Q.ï &2H""6H7I.ã &2@""6@7A.× &2d""6d7e.Ë &2R""6R7S.¿ &2N""6N7O.³ &2T""6T7U.§ &2V""6V7W.› &2f""6f7g. &2h""6h7i.ƒ &28""6879.w &2j""6j7k.k &;&.e &24""6475.Y &2l""6l7m.M &2n""6n7o.A &26""6677.5 &2p""6p7q.) &2r""6r7s&&&#/"!&,)'),g(`%;//?#2P""6P7Q/0$;//'$8#:t# )(#'#("'#&'#`),g(`%;//?#24""6475/0$;//'$8#:u# )(#'#("'#&'#`),g(`%;//?#2>""6>7?/0$;//'$8#:v# )(#'#("'#&'#`),g(`%;//?#2T""6T7U/0$;//'$8#:w# )(#'#("'#&'#`),g(`%;//?#2V""6V7W/0$;//'$8#:x# )(#'#("'#&'#`),g(`%2h""6h7i/0#;//'$8":y" )("'#&'#`),g(`%;//6#2f""6f7g/'$8":z" )("'#&'#`),g(`%;//?#2D""6D7E/0$;//'$8#:{# )(#'#("'#&'#`),g(`%;//?#22""6273/0$;//'$8#:|# )(#'#("'#&'#`),g(`%;//?#28""6879/0$;//'$8#:}# )(#'#("'#&'#`),g(`%;//0#;&/'$8":~" )("'#&'#`),g(`%;&/0#;//'$8":~" )("'#&'#`),g(`%;=/T#$;G.) &;K.# &;F0/*;G.) &;K.# &;F&/,$;>/#$+#)(#'#("'#&'#`),g('4""5!7€.A &4""5!7‚.5 &4ƒ""5!7„.) &;3.# &;.'),g(`%%;//Q#;&/H$$;J.# &;K0)*;J.# &;K&/,$;&/#$+$)($'#(#'#("'#&'#/"!&,)`),g(`%;//]#;&/T$%$;J.# &;K0)*;J.# &;K&/"!&,)/1$;&/($8$:…$!!)($'#(#'#("'#&'#`),g(';..G &2L""6L7M.; &4†""5!7‡./ &4ƒ""5!7„.# &;3'),g(`%2j""6j7k/J#4ˆ""5!7‰.5 &4Š""5!7‹.) &4Œ""5!7/#$+")("'#&'#`),g(`%;N/M#28""6879/>$;O." &"/0$;S/'$8$:Ž$ )($'#(#'#("'#&'#`),g(`%;N/d#28""6879/U$;O." &"/G$;S/>$;_/5$;l." &"/'$8&:& )(&'#(%'#($'#(#'#("'#&'#`),g(`%3""5$7‘.) &3’""5#7“/' 8!:”!! )`),g(`%;P/]#%28""6879/,#;R/#$+")("'#&'#." &"/6$2:""6:7;/'$8#:•# )(#'#("'#&'#`),g("$;+.) &;-.# &;Q/2#0/*;+.) &;-.# &;Q&&&#"),g('2<""6<7=.q &2>""6>7?.e &2@""6@7A.Y &2B""6B7C.M &2D""6D7E.A &22""6273.5 &26""6677.) &24""6475'),g('%$;+._ &;-.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E0e*;+._ &;-.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E&/& 8!:–! )'),g(`%;T/J#%28""6879/,#;^/#$+")("'#&'#." &"/#$+")("'#&'#`),g("%;U.) &;\\.# &;X/& 8!:—! )"),g(`%$%;V/2#2J""6J7K/#$+")("'#&'#0<*%;V/2#2J""6J7K/#$+")("'#&'#&/D#;W/;$2J""6J7K." &"/'$8#:˜# )(#'#("'#&'#`),g('$4™""5!7š/,#0)*4™""5!7š&&&#'),g(`%4$""5!7%/?#$4›""5!7œ0)*4›""5!7œ&/#$+")("'#&'#`),g(`%2l""6l7m/?#;Y/6$2n""6n7o/'$8#:# )(#'#("'#&'#`),g(`%%;Z/³#28""6879/¤$;Z/›$28""6879/Œ$;Z/ƒ$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+-)(-'#(,'#(+'#(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.ސ &%2ž""6ž7Ÿ/¤#;Z/›$28""6879/Œ$;Z/ƒ$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+,)(,'#(+'#(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.۹ &%2ž""6ž7Ÿ/Œ#;Z/ƒ$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+*)(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.ٺ &%2ž""6ž7Ÿ/t#;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+()(('#(''#(&'#(%'#($'#(#'#("'#&'#.ؓ &%2ž""6ž7Ÿ/\\#;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+&)(&'#(%'#($'#(#'#("'#&'#.ׄ &%2ž""6ž7Ÿ/D#;Z/;$28""6879/,$;[/#$+$)($'#(#'#("'#&'#.֍ &%2ž""6ž7Ÿ/,#;[/#$+")("'#&'#.ծ &%2ž""6ž7Ÿ/,#;Z/#$+")("'#&'#.Տ &%;Z/›#2ž""6ž7Ÿ/Œ$;Z/ƒ$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$++)(+'#(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.Ӈ &%;Z/ª#%28""6879/,#;Z/#$+")("'#&'#." &"/ƒ$2ž""6ž7Ÿ/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+*)(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.а &%;Z/¹#%28""6879/,#;Z/#$+")("'#&'#." &"/’$%28""6879/,#;Z/#$+")("'#&'#." &"/k$2ž""6ž7Ÿ/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+))()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.Ί &%;Z/È#%28""6879/,#;Z/#$+")("'#&'#." &"/¡$%28""6879/,#;Z/#$+")("'#&'#." &"/z$%28""6879/,#;Z/#$+")("'#&'#." &"/S$2ž""6ž7Ÿ/D$;Z/;$28""6879/,$;[/#$+()(('#(''#(&'#(%'#($'#(#'#("'#&'#.˕ &%;Z/×#%28""6879/,#;Z/#$+")("'#&'#." &"/°$%28""6879/,#;Z/#$+")("'#&'#." &"/‰$%28""6879/,#;Z/#$+")("'#&'#." &"/b$%28""6879/,#;Z/#$+")("'#&'#." &"/;$2ž""6ž7Ÿ/,$;[/#$+')(''#(&'#(%'#($'#(#'#("'#&'#.ȑ &%;Z/þ#%28""6879/,#;Z/#$+")("'#&'#." &"/×$%28""6879/,#;Z/#$+")("'#&'#." &"/°$%28""6879/,#;Z/#$+")("'#&'#." &"/‰$%28""6879/,#;Z/#$+")("'#&'#." &"/b$%28""6879/,#;Z/#$+")("'#&'#." &"/;$2ž""6ž7Ÿ/,$;Z/#$+()(('#(''#(&'#(%'#($'#(#'#("'#&'#.Ħ &%;Z/Ĝ#%28""6879/,#;Z/#$+")("'#&'#." &"/õ$%28""6879/,#;Z/#$+")("'#&'#." &"/Î$%28""6879/,#;Z/#$+")("'#&'#." &"/§$%28""6879/,#;Z/#$+")("'#&'#." &"/€$%28""6879/,#;Z/#$+")("'#&'#." &"/Y$%28""6879/,#;Z/#$+")("'#&'#." &"/2$2ž""6ž7Ÿ/#$+()(('#(''#(&'#(%'#($'#(#'#("'#&'#/& 8!: ! )`),g(`%;#/M#;#." &"/?$;#." &"/1$;#." &"/#$+$)($'#(#'#("'#&'#`),g(`%;Z/;#28""6879/,$;Z/#$+#)(#'#("'#&'#.# &;\\`),g(`%;]/o#2J""6J7K/\`$;]/W$2J""6J7K/H$;]/?$2J""6J7K/0$;]/'$8':¡' )(''#(&'#(%'#($'#(#'#("'#&'#`),g(`%2¢""6¢7£/2#4¤""5!7¥/#$+")("'#&'#.˜ &%2¦""6¦7§/;#4¨""5!7©/,$;!/#$+#)(#'#("'#&'#.j &%2ª""6ª7«/5#;!/,$;!/#$+#)(#'#("'#&'#.B &%4¬""5!7­/,#;!/#$+")("'#&'#.# &;!`),g(`%%;!." &"/[#;!." &"/M$;!." &"/?$;!." &"/1$;!." &"/#$+%)(%'#($'#(#'#("'#&'#/' 8!:®!! )`),g(`$%22""6273/,#;\`/#$+")("'#&'#0<*%22""6273/,#;\`/#$+")("'#&'#&`),g(";a.A &;b.; &;c.5 &;d./ &;e.) &;f.# &;g"),g(`%3¯""5*7°/a#3±""5#7².G &3³""5#7´.; &3µ""5$7¶./ &3·""5#7¸.# &;6/($8":¹"! )("'#&'#`),g(`%3º""5%7»/I#3¼""5%7½./ &3¾""5"7¿.# &;6/($8":À"! )("'#&'#`),g(`%3Á""5'7Â/1#;/($8":Ã"! )("'#&'#`),g(`%3Ä""5$7Å/1#;ð/($8":Æ"! )("'#&'#`),g(`%3Ç""5&7È/1#;T/($8":É"! )("'#&'#`),g(`%3Ê""5"7Ë/N#%2>""6>7?/,#;6/#$+")("'#&'#." &"/'$8":Ì" )("'#&'#`),g(`%;h/P#%2>""6>7?/,#;i/#$+")("'#&'#." &"/)$8":Í""! )("'#&'#`),g('%$;j/&#0#*;j&&&#/"!&,)'),g('%$;j/&#0#*;j&&&#/"!&,)'),g(";k.) &;+.# &;-"),g('2l""6l7m.e &2n""6n7o.Y &24""6475.M &28""6879.A &2<""6<7=.5 &2@""6@7A.) &2B""6B7C'),g(`%26""6677/n#;m/e$$%2<""6<7=/,#;m/#$+")("'#&'#0<*%2<""6<7=/,#;m/#$+")("'#&'#&/#$+#)(#'#("'#&'#`),g(`%;n/A#2>""6>7?/2$;o/)$8#:Î#"" )(#'#("'#&'#`),g("$;p.) &;+.# &;-/2#0/*;p.) &;+.# &;-&&&#"),g("$;p.) &;+.# &;-0/*;p.) &;+.# &;-&"),g('2l""6l7m.e &2n""6n7o.Y &24""6475.M &26""6677.A &28""6879.5 &2@""6@7A.) &2B""6B7C'),g(";‘.# &;r"),g(`%;/G#;'/>$;s/5$;'/,$;„/#$+%)(%'#($'#(#'#("'#&'#`),g(";M.# &;t"),g(`%;/E#28""6879/6$;u.# &;x/'$8#:Ï# )(#'#("'#&'#`),g(`%;v.# &;w/J#%26""6677/,#;ƒ/#$+")("'#&'#." &"/#$+")("'#&'#`),g(`%2Ð""6Ð7Ñ/:#;€/1$;w." &"/#$+#)(#'#("'#&'#`),g(`%24""6475/,#;{/#$+")("'#&'#`),g(`%;z/3#$;y0#*;y&/#$+")("'#&'#`),g(";*.) &;+.# &;-"),g(';+. &;-.‰ &22""6273.} &26""6677.q &28""6879.e &2:""6:7;.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E'),g(`%;|/e#$%24""6475/,#;|/#$+")("'#&'#0<*%24""6475/,#;|/#$+")("'#&'#&/#$+")("'#&'#`),g(`%$;~0#*;~&/e#$%22""6273/,#;}/#$+")("'#&'#0<*%22""6273/,#;}/#$+")("'#&'#&/#$+")("'#&'#`),g("$;~0#*;~&"),g(';+.w &;-.q &28""6879.e &2:""6:7;.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E'),g(`%%;"/‡#$;".G &;!.A &2@""6@7A.5 &2F""6F7G.) &2J""6J7K0M*;".G &;!.A &2@""6@7A.5 &2F""6F7G.) &2J""6J7K&/#$+")("'#&'#/& 8!:Ò! )`),g(";.# &;‚"),g(`%%;O/2#2:""6:7;/#$+")("'#&'#." &"/,#;S/#$+")("'#&'#." &"`),g('$;+.ƒ &;-.} &2B""6B7C.q &2D""6D7E.e &22""6273.Y &28""6879.M &2:""6:7;.A &2<""6<7=.5 &2>""6>7?.) &2@""6@7A/Œ#0‰*;+.ƒ &;-.} &2B""6B7C.q &2D""6D7E.e &22""6273.Y &28""6879.M &2:""6:7;.A &2<""6<7=.5 &2>""6>7?.) &2@""6@7A&&&#'),g("$;y0#*;y&"),g(`%3’""5#7Ó/q#24""6475/b$$;!/&#0#*;!&&&#/L$2J""6J7K/=$$;!/&#0#*;!&&&#/'$8%:Ô% )(%'#($'#(#'#("'#&'#`),g('2Õ""6Õ7Ö'),g('2×""6×7Ø'),g('2Ù""6Ù7Ú'),g('2Û""6Û7Ü'),g('2Ý""6Ý7Þ'),g('2ß""6ß7à'),g('2á""6á7â'),g('2ã""6ã7ä'),g('2å""6å7æ'),g('2ç""6ç7è'),g('2é""6é7ê'),g("%;….Y &;†.S &;ˆ.M &;‰.G &;Š.A &;‹.; &;Œ.5 &;./ &;.) &;Ž.# &;6/& 8!:ë! )"),g(`%;„/G#;'/>$;’/5$;'/,$;”/#$+%)(%'#($'#(#'#("'#&'#`),g("%;“/' 8!:ì!! )"),g(`%;!/5#;!/,$;!/#$+#)(#'#("'#&'#`),g("%$;*.A &;+.; &;-.5 &;3./ &;4.) &;'.# &;(0G*;*.A &;+.; &;-.5 &;3./ &;4.) &;'.# &;(&/& 8!:í! )"),g(`%;¶/Y#$%;A/,#;¶/#$+")("'#&'#06*%;A/,#;¶/#$+")("'#&'#&/#$+")("'#&'#`),g(`%;9/N#%2:""6:7;/,#;9/#$+")("'#&'#." &"/'$8":î" )("'#&'#`),g(`%;:.c &%;˜/Y#$%;A/,#;˜/#$+")("'#&'#06*%;A/,#;˜/#$+")("'#&'#&/#$+")("'#&'#/& 8!:ï! )`),g(`%;L.# &;™/]#$%;B/,#;›/#$+")("'#&'#06*%;B/,#;›/#$+")("'#&'#&/'$8":ð" )("'#&'#`),g(`%;š." &"/>#;@/5$;M/,$;?/#$+$)($'#(#'#("'#&'#`),g(`%%;6/Y#$%;./,#;6/#$+")("'#&'#06*%;./,#;6/#$+")("'#&'#&/#$+")("'#&'#.# &;H/' 8!:ñ!! )`),g(";œ.) &;.# &; "),g(`%3ò""5!7ó/:#;</1$;Ÿ/($8#:ô#! )(#'#("'#&'#`),g(`%3õ""5'7ö/:#;</1$;ž/($8#:÷#! )(#'#("'#&'#`),g("%$;!/&#0#*;!&&&#/' 8!:ø!! )"),g(`%2ù""6ù7ú/o#%2J""6J7K/M#;!." &"/?$;!." &"/1$;!." &"/#$+$)($'#(#'#("'#&'#." &"/'$8":û" )("'#&'#`),g(`%;6/J#%;</,#;¡/#$+")("'#&'#." &"/)$8":ü""! )("'#&'#`),g(";6.) &;T.# &;H"),g(`%;£/Y#$%;B/,#;¤/#$+")("'#&'#06*%;B/,#;¤/#$+")("'#&'#&/#$+")("'#&'#`),g(`%3ý""5&7þ.G &3ÿ""5'7Ā.; &3ā""5$7Ă./ &3ă""5%7Ą.# &;6/& 8!:ą! )`),g(";¥.# &; "),g(`%3Ć""5(7ć/M#;</D$3Ĉ""5(7ĉ./ &3Ċ""5(7ċ.# &;6/#$+#)(#'#("'#&'#`),g(`%;6/Y#$%;A/,#;6/#$+")("'#&'#06*%;A/,#;6/#$+")("'#&'#&/#$+")("'#&'#`),g("%$;!/&#0#*;!&&&#/' 8!:Č!! )"),g("%;©/& 8!:č! )"),g(`%;ª/k#;;/b$;¯/Y$$%;B/,#;°/#$+")("'#&'#06*%;B/,#;°/#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#`),g(";«.# &;¬"),g('3Ď""5$7ď.S &3Đ""5%7đ.G &3Ē""5%7ē.; &3Ĕ""5%7ĕ./ &3Ė""5+7ė.# &;­'),g(`3Ę""5'7ę./ &3Ě""5)7ě.# &;­`),g(";6.# &;®"),g(`%3Ĝ""5"7ĝ/,#;6/#$+")("'#&'#`),g(";­.# &;6"),g(`%;6/5#;</,$;±/#$+#)(#'#("'#&'#`),g(";6.# &;H"),g(`%;³/5#;./,$;/#$+#)(#'#("'#&'#`),g("%$;!/&#0#*;!&&&#/' 8!:Ğ!! )"),g("%;ž/' 8!:ğ!! )"),g(`%;¶/^#$%;B/,#; /#$+")("'#&'#06*%;B/,#; /#$+")("'#&'#&/($8":Ġ"!!)("'#&'#`),g(`%%;7/e#$%2J""6J7K/,#;7/#$+")("'#&'#0<*%2J""6J7K/,#;7/#$+")("'#&'#&/#$+")("'#&'#/"!&,)`),g(`%;L.# &;™/]#$%;B/,#;¸/#$+")("'#&'#06*%;B/,#;¸/#$+")("'#&'#&/'$8":ġ" )("'#&'#`),g(";¹.# &; "),g(`%3Ģ""5#7ģ/:#;</1$;6/($8#:Ĥ#! )(#'#("'#&'#`),g("%$;!/&#0#*;!&&&#/' 8!:ĥ!! )"),g("%;ž/' 8!:Ħ!! )"),g(`%$;š0#*;š&/x#;@/o$;M/f$;?/]$$%;B/,#; /#$+")("'#&'#06*%;B/,#; /#$+")("'#&'#&/'$8%:ħ% )(%'#($'#(#'#("'#&'#`),g(";¾"),g(`%3Ĩ""5&7ĩ/k#;./b$;Á/Y$$%;A/,#;Á/#$+")("'#&'#06*%;A/,#;Á/#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#.# &;¿`),g(`%;6/k#;./b$;À/Y$$%;A/,#;À/#$+")("'#&'#06*%;A/,#;À/#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#`),g(`%;6/;#;</2$;6.# &;H/#$+#)(#'#("'#&'#`),g(";Â.G &;Ä.A &;Æ.; &;È.5 &;É./ &;Ê.) &;Ë.# &;À"),g(`%3Ī""5%7ī/5#;</,$;Ã/#$+#)(#'#("'#&'#`),g("%;I/' 8!:Ĭ!! )"),g(`%3ĭ""5&7Į/—#;</Ž$;D/…$;Å/|$$%$;'/&#0#*;'&&&#/,#;Å/#$+")("'#&'#0C*%$;'/&#0#*;'&&&#/,#;Å/#$+")("'#&'#&/,$;E/#$+&)(&'#(%'#($'#(#'#("'#&'#`),g(";t.# &;w"),g(`%3į""5%7İ/5#;</,$;Ç/#$+#)(#'#("'#&'#`),g("%;I/' 8!:ı!! )"),g(`%3IJ""5&7ij/:#;</1$;I/($8#:Ĵ#! )(#'#("'#&'#`),g(`%3ĵ""5%7Ķ/]#;</T$%3ķ""5$7ĸ/& 8!:Ĺ! ).4 &%3ĺ""5%7Ļ/& 8!:ļ! )/#$+#)(#'#("'#&'#`),g(`%3Ľ""5)7ľ/R#;</I$3Ŀ""5#7ŀ./ &3Ł""5(7ł.# &;6/($8#:Ń#! )(#'#("'#&'#`),g(`%3ń""5#7Ņ/“#;</Š$;D/$%;Ì/e#$%2D""6D7E/,#;Ì/#$+")("'#&'#0<*%2D""6D7E/,#;Ì/#$+")("'#&'#&/#$+")("'#&'#/,$;E/#$+%)(%'#($'#(#'#("'#&'#`),g(`%3ņ""5(7Ň./ &3ň""5$7ʼn.# &;6/' 8!:Ŋ!! )`),g(`%;6/Y#$%;A/,#;6/#$+")("'#&'#06*%;A/,#;6/#$+")("'#&'#&/#$+")("'#&'#`),g(`%;Ï/G#;./>$;Ï/5$;./,$;/#$+%)(%'#($'#(#'#("'#&'#`),g("%$;!/&#0#*;!&&&#/' 8!:ŋ!! )"),g(`%;Ñ/]#$%;A/,#;Ñ/#$+")("'#&'#06*%;A/,#;Ñ/#$+")("'#&'#&/'$8":Ō" )("'#&'#`),g(`%;™/]#$%;B/,#; /#$+")("'#&'#06*%;B/,#; /#$+")("'#&'#&/'$8":ō" )("'#&'#`),g(`%;L.O &;™.I &%;@." &"/:#;t/1$;?." &"/#$+#)(#'#("'#&'#/]#$%;B/,#; /#$+")("'#&'#06*%;B/,#; /#$+")("'#&'#&/'$8":Ŏ" )("'#&'#`),g(`%;Ô/]#$%;B/,#;Õ/#$+")("'#&'#06*%;B/,#;Õ/#$+")("'#&'#&/'$8":ŏ" )("'#&'#`),g("%;–/& 8!:Ő! )"),g(`%3ő""5(7Œ/:#;</1$;6/($8#:œ#! )(#'#("'#&'#.g &%3Ŕ""5&7ŕ/:#;</1$;6/($8#:Ŗ#! )(#'#("'#&'#.: &%3ŗ""5*7Ř/& 8!:ř! ).# &; `),g(`%%;6/k#$%;A/2#;6/)$8":Ś""$ )("'#&'#0<*%;A/2#;6/)$8":Ś""$ )("'#&'#&/)$8":ś""! )("'#&'#." &"/' 8!:Ŝ!! )`),g(`%;Ø/Y#$%;A/,#;Ø/#$+")("'#&'#06*%;A/,#;Ø/#$+")("'#&'#&/#$+")("'#&'#`),g(`%;™/Y#$%;B/,#; /#$+")("'#&'#06*%;B/,#; /#$+")("'#&'#&/#$+")("'#&'#`),g("%$;!/&#0#*;!&&&#/' 8!:ŝ!! )"),g(`%;Û/Y#$%;B/,#;Ü/#$+")("'#&'#06*%;B/,#;Ü/#$+")("'#&'#&/#$+")("'#&'#`),g(`%3Ş""5&7ş.; &3Š""5'7š./ &3Ţ""5*7ţ.# &;6/& 8!:Ť! )`),g(`%3ť""5&7Ŧ/:#;</1$;Ý/($8#:ŧ#! )(#'#("'#&'#.} &%3õ""5'7ö/:#;</1$;ž/($8#:Ũ#! )(#'#("'#&'#.P &%3ũ""5+7Ū/:#;</1$;ž/($8#:ū#! )(#'#("'#&'#.# &; `),g(`3Ŭ""5+7ŭ.k &3Ů""5)7ů._ &3Ű""5(7ű.S &3Ų""5'7ų.G &3Ŵ""5&7ŵ.; &3Ŷ""5*7ŷ./ &3Ÿ""5)7Ź.# &;6`),g(';1." &"'),g(`%%;6/k#$%;A/2#;6/)$8":Ś""$ )("'#&'#0<*%;A/2#;6/)$8":Ś""$ )("'#&'#&/)$8":ś""! )("'#&'#." &"/' 8!:ź!! )`),g(`%;L.# &;™/]#$%;B/,#;á/#$+")("'#&'#06*%;B/,#;á/#$+")("'#&'#&/'$8":Ż" )("'#&'#`),g(";¹.# &; "),g(`%;ã/Y#$%;A/,#;ã/#$+")("'#&'#06*%;A/,#;ã/#$+")("'#&'#&/#$+")("'#&'#`),g(`%;ê/k#;./b$;í/Y$$%;B/,#;ä/#$+")("'#&'#06*%;B/,#;ä/#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#`),g(";å.; &;æ.5 &;ç./ &;è.) &;é.# &; "),g(`%3ż""5#7Ž/:#;</1$;ð/($8#:ž#! )(#'#("'#&'#`),g(`%3ſ""5%7ƀ/:#;</1$;T/($8#:Ɓ#! )(#'#("'#&'#`),g(`%3Ƃ""5(7ƃ/F#;</=$;\\.) &;Y.# &;X/($8#:Ƅ#! )(#'#("'#&'#`),g(`%3ƅ""5&7Ɔ/:#;</1$;6/($8#:Ƈ#! )(#'#("'#&'#`),g(`%3ƈ""5%7Ɖ/A#;</8$$;!0#*;!&/($8#:Ɗ#! )(#'#("'#&'#`),g(`%;ë/G#;;/>$;6/5$;;/,$;ì/#$+%)(%'#($'#(#'#("'#&'#`),g(`%3’""5#7Ó.# &;6/' 8!:Ƌ!! )`),g(`%3±""5#7ƌ.G &3³""5#7ƍ.; &3·""5#7Ǝ./ &3µ""5$7Ə.# &;6/' 8!:Ɛ!! )`),g(`%;î/D#%;C/,#;ï/#$+")("'#&'#." &"/#$+")("'#&'#`),g("%;U.) &;\\.# &;X/& 8!:Ƒ! )"),g(`%%;!." &"/[#;!." &"/M$;!." &"/?$;!." &"/1$;!." &"/#$+%)(%'#($'#(#'#("'#&'#/' 8!:ƒ!! )`),g(`%%;!/?#;!." &"/1$;!." &"/#$+#)(#'#("'#&'#/' 8!:Ɠ!! )`),g(";¾"),g(`%;ž/^#$%;B/,#;ó/#$+")("'#&'#06*%;B/,#;ó/#$+")("'#&'#&/($8":Ɣ"!!)("'#&'#`),g(";ô.# &; "),g(`%2ƕ""6ƕ7Ɩ/L#;</C$2Ɨ""6Ɨ7Ƙ.) &2ƙ""6ƙ7ƚ/($8#:ƛ#! )(#'#("'#&'#`),g(`%;ž/^#$%;B/,#; /#$+")("'#&'#06*%;B/,#; /#$+")("'#&'#&/($8":Ɯ"!!)("'#&'#`),g(`%;6/5#;0/,$;÷/#$+#)(#'#("'#&'#`),g("$;2.) &;4.# &;.0/*;2.) &;4.# &;.&"),g("$;%0#*;%&"),g(`%;ú/;#28""6879/,$;û/#$+#)(#'#("'#&'#`),g(`%3Ɲ""5%7ƞ.) &3Ɵ""5$7Ơ/' 8!:ơ!! )`),g(`%;ü/J#%28""6879/,#;^/#$+")("'#&'#." &"/#$+")("'#&'#`),g("%;\\.) &;X.# &;‚/' 8!:Ƣ!! )"),g(';".S &;!.M &2F""6F7G.A &2J""6J7K.5 &2H""6H7I.) &2N""6N7O'),g('2L""6L7M.• &2B""6B7C.‰ &2<""6<7=.} &2R""6R7S.q &2T""6T7U.e &2V""6V7W.Y &2P""6P7Q.M &2@""6@7A.A &2D""6D7E.5 &22""6273.) &2>""6>7?'),g(`%;Ā/b#28""6879/S$;û/J$%2ƣ""6ƣ7Ƥ/,#;ì/#$+")("'#&'#." &"/#$+$)($'#(#'#("'#&'#`),g(`%3ƥ""5%7Ʀ.) &3Ƨ""5$7ƨ/' 8!:ơ!! )`),g(`%3±""5#7².6 &3³""5#7´.* &$;+0#*;+&/' 8!:Ʃ!! )`),g(`%;Ą/‡#2F""6F7G/x$;ă/o$2F""6F7G/\`$;ă/W$2F""6F7G/H$;ă/?$2F""6F7G/0$;ą/'$8):ƪ) )()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#`),g(`%;#/>#;#/5$;#/,$;#/#$+$)($'#(#'#("'#&'#`),g(`%;ă/,#;ă/#$+")("'#&'#`),g(`%;ă/5#;ă/,$;ă/#$+#)(#'#("'#&'#`),g(`%;q/T#$;m0#*;m&/D$%; /,#;ø/#$+")("'#&'#." &"/#$+#)(#'#("'#&'#`),g(`%2ƫ""6ƫ7Ƭ.) &2ƭ""6ƭ7Ʈ/w#;0/n$;Ĉ/e$$%;B/2#;ĉ.# &; /#$+")("'#&'#0<*%;B/2#;ĉ.# &; /#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#`),g(";™.# &;L"),g(`%2Ư""6Ư7ư/5#;</,$;Ċ/#$+#)(#'#("'#&'#`),g(`%;D/S#;,/J$2:""6:7;/;$;,.# &;T/,$;E/#$+%)(%'#($'#(#'#("'#&'#`)];let A=0,c=0;const u=[{line:1,column:1}];let d,f=0,p=[],v=0;if(e.startRule!==void 0){if(!(e.startRule in i))throw new Error(`Can't start parsing from rule "`+e.startRule+'".');o=i[e.startRule]}function C(){return t.substring(c,A)}function m(){return O(c,A)}function y(h,S){return{type:"literal",text:h,ignoreCase:S}}function w(h,S,T){return{type:"class",parts:h,inverted:S,ignoreCase:T}}function I(h){let S,T=u[h];if(T)return T;for(S=h-1;!u[S];)S--;for(T=u[S],T={line:T.line,column:T.column};S<h;)t.charCodeAt(S)===10?(T.line++,T.column=1):T.column++,S++;return u[h]=T,T}function O(h,S){const T=I(h),R=I(S);return{source:r,start:{offset:h,line:T.line,column:T.column},end:{offset:S,line:R.line,column:R.column}}}function x(h){A<f||(A>f&&(f=A,p=[]),p.push(h))}function g(h){return h.split("").map(S=>S.charCodeAt(0)-32)}if(e.data={},d=function h(S){const T=s[S];let R=0;const D=[];let B=T.length;const k=[],P=[];let H;for(;;){for(;R<B;)switch(T[R]){case 0:P.push(a[T[R+1]]),R+=2;break;case 1:P.push(void 0),R++;break;case 2:P.push(null),R++;break;case 3:P.push(n),R++;break;case 4:P.push([]),R++;break;case 5:P.push(A),R++;break;case 6:P.pop(),R++;break;case 7:A=P.pop(),R++;break;case 8:P.length-=T[R+1],R+=2;break;case 9:P.splice(-2,1),R++;break;case 10:P[P.length-2].push(P.pop()),R++;break;case 11:P.push(P.splice(P.length-T[R+1],T[R+1])),R+=2;break;case 12:P.push(t.substring(P.pop(),A)),R++;break;case 13:k.push(B),D.push(R+3+T[R+1]+T[R+2]),P[P.length-1]?(B=R+3+T[R+1],R+=3):(B=R+3+T[R+1]+T[R+2],R+=3+T[R+1]);break;case 14:k.push(B),D.push(R+3+T[R+1]+T[R+2]),P[P.length-1]===n?(B=R+3+T[R+1],R+=3):(B=R+3+T[R+1]+T[R+2],R+=3+T[R+1]);break;case 15:k.push(B),D.push(R+3+T[R+1]+T[R+2]),P[P.length-1]!==n?(B=R+3+T[R+1],R+=3):(B=R+3+T[R+1]+T[R+2],R+=3+T[R+1]);break;case 16:P[P.length-1]!==n?(k.push(B),D.push(R),B=R+2+T[R+1],R+=2):R+=2+T[R+1];break;case 17:k.push(B),D.push(R+3+T[R+1]+T[R+2]),t.length>A?(B=R+3+T[R+1],R+=3):(B=R+3+T[R+1]+T[R+2],R+=3+T[R+1]);break;case 18:k.push(B),D.push(R+4+T[R+2]+T[R+3]),t.substr(A,a[T[R+1]].length)===a[T[R+1]]?(B=R+4+T[R+2],R+=4):(B=R+4+T[R+2]+T[R+3],R+=4+T[R+2]);break;case 19:k.push(B),D.push(R+4+T[R+2]+T[R+3]),t.substr(A,a[T[R+1]].length).toLowerCase()===a[T[R+1]]?(B=R+4+T[R+2],R+=4):(B=R+4+T[R+2]+T[R+3],R+=4+T[R+2]);break;case 20:k.push(B),D.push(R+4+T[R+2]+T[R+3]),a[T[R+1]].test(t.charAt(A))?(B=R+4+T[R+2],R+=4):(B=R+4+T[R+2]+T[R+3],R+=4+T[R+2]);break;case 21:P.push(t.substr(A,T[R+1])),A+=T[R+1],R+=2;break;case 22:P.push(a[T[R+1]]),A+=a[T[R+1]].length,R+=2;break;case 23:P.push(n),v===0&&x(a[T[R+1]]),R+=2;break;case 24:c=P[P.length-1-T[R+1]],R+=2;break;case 25:c=A,R++;break;case 26:H=T.slice(R+4,R+4+T[R+3]).map(function(Z){return P[P.length-1-Z]}),P.splice(P.length-T[R+2],T[R+2],a[T[R+1]].apply(null,H)),R+=4+T[R+3];break;case 27:P.push(h(T[R+1])),R+=2;break;case 28:v++,R++;break;case 29:v--,R++;break;default:throw new Error("Invalid opcode: "+T[R]+".")}if(!(k.length>0))break;B=k.pop(),R=D.pop()}return P[0]}(o),d!==n&&A===t.length)return d;throw d!==n&&A<t.length&&x({type:"end"}),M=p,E=f<t.length?t.charAt(f):null,b=f<t.length?O(f,f+1):O(f,f),new Tg(Tg.buildMessage(M,E),M,E,b);var M,E,b};var En;(function(t){t.parse=function(e,n){const r={startRule:n};try{VS(e,r)}catch{r.data=-1}return r.data},t.nameAddrHeaderParse=function(e){const n=t.parse(e,"Name_Addr_Header");return n!==-1?n:void 0},t.URIParse=function(e){const n=t.parse(e,"SIP_URI");return n!==-1?n:void 0}})(En=En||(En={}));const zS={100:"Trying",180:"Ringing",181:"Call Is Being Forwarded",182:"Queued",183:"Session Progress",199:"Early Dialog Terminated",200:"OK",202:"Accepted",204:"No Notification",300:"Multiple Choices",301:"Moved Permanently",302:"Moved Temporarily",305:"Use Proxy",380:"Alternative Service",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",410:"Gone",412:"Conditional Request Failed",413:"Request Entity Too Large",414:"Request-URI Too Long",415:"Unsupported Media Type",416:"Unsupported URI Scheme",417:"Unknown Resource-Priority",420:"Bad Extension",421:"Extension Required",422:"Session Interval Too Small",423:"Interval Too Brief",428:"Use Identity Header",429:"Provide Referrer Identity",430:"Flow Failed",433:"Anonymity Disallowed",436:"Bad Identity-Info",437:"Unsupported Certificate",438:"Invalid Identity Header",439:"First Hop Lacks Outbound Support",440:"Max-Breadth Exceeded",469:"Bad Info Package",470:"Consent Needed",478:"Unresolvable Destination",480:"Temporarily Unavailable",481:"Call/Transaction Does Not Exist",482:"Loop Detected",483:"Too Many Hops",484:"Address Incomplete",485:"Ambiguous",486:"Busy Here",487:"Request Terminated",488:"Not Acceptable Here",489:"Bad Event",491:"Request Pending",493:"Undecipherable",494:"Security Agreement Required",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Server Time-out",505:"Version Not Supported",513:"Message Too Large",580:"Precondition Failure",600:"Busy Everywhere",603:"Decline",604:"Does Not Exist Anywhere",606:"Not Acceptable"};function zi(t,e=32){let n="";for(let r=0;r<t;r++)n+=Math.floor(Math.random()*e).toString(e);return n}function qA(t){return zS[t]||""}function ZA(){return zi(10)}function Kr(t){const e={"Call-Id":"Call-ID",Cseq:"CSeq","Min-Se":"Min-SE",Rack:"RAck",Rseq:"RSeq","Www-Authenticate":"WWW-Authenticate"},n=t.toLowerCase().replace(/_/g,"-").split("-"),r=n.length;let i="";for(let o=0;o<r;o++)o!==0&&(i+="-"),i+=n[o].charAt(0).toUpperCase()+n[o].substring(1);return e[i]&&(i=e[i]),i}function Qa(t){return encodeURIComponent(t).replace(/%[A-F\d]{2}/g,"U").length}class f0{constructor(){this.headers={}}addHeader(e,n){const r={raw:n};e=Kr(e),this.headers[e]?this.headers[e].push(r):this.headers[e]=[r]}getHeader(e){const n=this.headers[Kr(e)];if(n)return n[0]?n[0].raw:void 0}getHeaders(e){const n=this.headers[Kr(e)],r=[];if(!n)return[];for(const i of n)r.push(i.raw);return r}hasHeader(e){return!!this.headers[Kr(e)]}parseHeader(e,n=0){if(e=Kr(e),!this.headers[e]||n>=this.headers[e].length)return;const r=this.headers[e][n],i=r.raw;if(r.parsed)return r.parsed;const o=En.parse(i,e.replace(/-/g,"_"));return o===-1?void this.headers[e].splice(n,1):(r.parsed=o,o)}s(e,n=0){return this.parseHeader(e,n)}setHeader(e,n){this.headers[Kr(e)]=[{raw:n}]}toString(){return this.data}}let Bo=class extends f0{constructor(){super()}},Fi=class extends f0{constructor(){super()}},qd=class Ys{constructor(e,n,r,i,o,a,s){this.headers={},this.extraHeaders=[],this.options=Ys.getDefaultOptions(),o&&(this.options=Object.assign(Object.assign({},this.options),o),this.options.optionTags&&this.options.optionTags.length&&(this.options.optionTags=this.options.optionTags.slice()),this.options.routeSet&&this.options.routeSet.length&&(this.options.routeSet=this.options.routeSet.slice())),a&&a.length&&(this.extraHeaders=a.slice()),s&&(this.body={body:s.content,contentType:s.contentType}),this.method=e,this.ruri=n.clone(),this.fromURI=r.clone(),this.fromTag=this.options.fromTag?this.options.fromTag:ZA(),this.from=Ys.makeNameAddrHeader(this.fromURI,this.options.fromDisplayName,this.fromTag),this.toURI=i.clone(),this.toTag=this.options.toTag,this.to=Ys.makeNameAddrHeader(this.toURI,this.options.toDisplayName,this.toTag),this.callId=this.options.callId?this.options.callId:this.options.callIdPrefix+zi(15),this.cseq=this.options.cseq,this.setHeader("route",this.options.routeSet),this.setHeader("via",""),this.setHeader("to",this.to.toString()),this.setHeader("from",this.from.toString()),this.setHeader("cseq",this.cseq+" "+this.method),this.setHeader("call-id",this.callId),this.setHeader("max-forwards","70")}static getDefaultOptions(){return{callId:"",callIdPrefix:"",cseq:1,toDisplayName:"",toTag:"",fromDisplayName:"",fromTag:"",forceRport:!1,hackViaTcp:!1,optionTags:["outbound"],routeSet:[],userAgentString:"sip.js",viaHost:""}}static makeNameAddrHeader(e,n,r){const i={};return r&&(i.tag=r),new $n(e,n,i)}getHeader(e){const n=this.headers[Kr(e)];if(n){if(n[0])return n[0]}else{const r=new RegExp("^\\s*"+e+"\\s*:","i");for(const i of this.extraHeaders)if(r.test(i))return i.substring(i.indexOf(":")+1).trim()}}getHeaders(e){const n=[],r=this.headers[Kr(e)];if(r)for(const i of r)n.push(i);else{const i=new RegExp("^\\s*"+e+"\\s*:","i");for(const o of this.extraHeaders)i.test(o)&&n.push(o.substring(o.indexOf(":")+1).trim())}return n}hasHeader(e){if(this.headers[Kr(e)])return!0;{const n=new RegExp("^\\s*"+e+"\\s*:","i");for(const r of this.extraHeaders)if(n.test(r))return!0}return!1}setHeader(e,n){this.headers[Kr(e)]=n instanceof Array?n:[n]}setViaHeader(e,n){this.options.hackViaTcp&&(n="TCP");let r="SIP/2.0/"+n;r+=" "+this.options.viaHost+";branch="+e,this.options.forceRport&&(r+=";rport"),this.setHeader("via",r),this.branch=e}toString(){let e="";e+=this.method+" "+this.ruri.toRaw()+` SIP/2.0\r
100
+ `,!1),/^[0-9]/,w([["0","9"]],!1,!1),/^[a-zA-Z]/,w([["a","z"],["A","Z"]],!1,!1),/^[0-9a-fA-F]/,w([["0","9"],["a","f"],["A","F"]],!1,!1),/^[\0-\xFF]/,w([["\0","ÿ"]],!1,!1),/^["]/,w(['"'],!1,!1)," ",y(" ",!1)," ",y(" ",!1),/^[a-zA-Z0-9]/,w([["a","z"],["A","Z"],["0","9"]],!1,!1),";",y(";",!1),"/",y("/",!1),"?",y("?",!1),":",y(":",!1),"@",y("@",!1),"&",y("&",!1),"=",y("=",!1),"+",y("+",!1),"$",y("$",!1),",",y(",",!1),"-",y("-",!1),"_",y("_",!1),".",y(".",!1),"!",y("!",!1),"~",y("~",!1),"*",y("*",!1),"'",y("'",!1),"(",y("(",!1),")",y(")",!1),"%",y("%",!1),function(){return" "},function(){return":"},/^[!-~]/,w([["!","~"]],!1,!1),/^[\x80-\uFFFF]/,w([["€","￿"]],!1,!1),/^[\x80-\xBF]/,w([["€","¿"]],!1,!1),/^[a-f]/,w([["a","f"]],!1,!1),"`",y("`",!1),"<",y("<",!1),">",y(">",!1),"\\",y("\\",!1),"[",y("[",!1),"]",y("]",!1),"{",y("{",!1),"}",y("}",!1),function(){return"*"},function(){return"/"},function(){return"="},function(){return"("},function(){return")"},function(){return">"},function(){return"<"},function(){return","},function(){return";"},function(){return":"},function(){return'"'},/^[!-']/,w([["!","'"]],!1,!1),/^[*-[]/,w([["*","["]],!1,!1),/^[\]-~]/,w([["]","~"]],!1,!1),function(h){return h},/^[#-[]/,w([["#","["]],!1,!1),/^[\0-\t]/,w([["\0"," "]],!1,!1),/^[\v-\f]/,w([["\v","\f"]],!1,!1),/^[\x0E-\x7F]/,w([["",""]],!1,!1),function(){(e=e||{data:{}}).data.uri=new Ni(e.data.scheme,e.data.user,e.data.host,e.data.port),delete e.data.scheme,delete e.data.user,delete e.data.host,delete e.data.host_type,delete e.data.port},function(){(e=e||{data:{}}).data.uri=new Ni(e.data.scheme,e.data.user,e.data.host,e.data.port,e.data.uri_params,e.data.uri_headers),delete e.data.scheme,delete e.data.user,delete e.data.host,delete e.data.host_type,delete e.data.port,delete e.data.uri_params,e.startRule==="SIP_URI"&&(e.data=e.data.uri)},"sips",y("sips",!0),"sip",y("sip",!0),function(h){(e=e||{data:{}}).data.scheme=h},function(){(e=e||{data:{}}).data.user=decodeURIComponent(C().slice(0,-1))},function(){(e=e||{data:{}}).data.password=C()},function(){return(e=e||{data:{}}).data.host=C(),e.data.host},function(){return(e=e||{data:{}}).data.host_type="domain",C()},/^[a-zA-Z0-9_\-]/,w([["a","z"],["A","Z"],["0","9"],"_","-"],!1,!1),/^[a-zA-Z0-9\-]/,w([["a","z"],["A","Z"],["0","9"],"-"],!1,!1),function(){return(e=e||{data:{}}).data.host_type="IPv6",C()},"::",y("::",!1),function(){return(e=e||{data:{}}).data.host_type="IPv6",C()},function(){return(e=e||{data:{}}).data.host_type="IPv4",C()},"25",y("25",!1),/^[0-5]/,w([["0","5"]],!1,!1),"2",y("2",!1),/^[0-4]/,w([["0","4"]],!1,!1),"1",y("1",!1),/^[1-9]/,w([["1","9"]],!1,!1),function(h){return e=e||{data:{}},h=parseInt(h.join("")),e.data.port=h,h},"transport=",y("transport=",!0),"udp",y("udp",!0),"tcp",y("tcp",!0),"sctp",y("sctp",!0),"tls",y("tls",!0),function(h){(e=e||{data:{}}).data.uri_params||(e.data.uri_params={}),e.data.uri_params.transport=h.toLowerCase()},"user=",y("user=",!0),"phone",y("phone",!0),"ip",y("ip",!0),function(h){(e=e||{data:{}}).data.uri_params||(e.data.uri_params={}),e.data.uri_params.user=h.toLowerCase()},"method=",y("method=",!0),function(h){(e=e||{data:{}}).data.uri_params||(e.data.uri_params={}),e.data.uri_params.method=h},"ttl=",y("ttl=",!0),function(h){(e=e||{data:{}}).data.params||(e.data.params={}),e.data.params.ttl=h},"maddr=",y("maddr=",!0),function(h){(e=e||{data:{}}).data.uri_params||(e.data.uri_params={}),e.data.uri_params.maddr=h},"lr",y("lr",!0),function(){(e=e||{data:{}}).data.uri_params||(e.data.uri_params={}),e.data.uri_params.lr=void 0},function(h,S){(e=e||{data:{}}).data.uri_params||(e.data.uri_params={}),S=S===null?void 0:S[1],e.data.uri_params[h.toLowerCase()]=S},function(h,S){h=h.join("").toLowerCase(),S=S.join(""),(e=e||{data:{}}).data.uri_headers||(e.data.uri_headers={}),e.data.uri_headers[h]?e.data.uri_headers[h].push(S):e.data.uri_headers[h]=[S]},function(){(e=e||{data:{}}).startRule==="Refer_To"&&(e.data.uri=new Ni(e.data.scheme,e.data.user,e.data.host,e.data.port,e.data.uri_params,e.data.uri_headers),delete e.data.scheme,delete e.data.user,delete e.data.host,delete e.data.host_type,delete e.data.port,delete e.data.uri_params)},"//",y("//",!1),function(){(e=e||{data:{}}).data.scheme=C()},y("SIP",!0),function(){(e=e||{data:{}}).data.sip_version=C()},"INVITE",y("INVITE",!1),"ACK",y("ACK",!1),"VXACH",y("VXACH",!1),"OPTIONS",y("OPTIONS",!1),"BYE",y("BYE",!1),"CANCEL",y("CANCEL",!1),"REGISTER",y("REGISTER",!1),"SUBSCRIBE",y("SUBSCRIBE",!1),"NOTIFY",y("NOTIFY",!1),"REFER",y("REFER",!1),"PUBLISH",y("PUBLISH",!1),function(){return(e=e||{data:{}}).data.method=C(),e.data.method},function(h){(e=e||{data:{}}).data.status_code=parseInt(h.join(""))},function(){(e=e||{data:{}}).data.reason_phrase=C()},function(){(e=e||{data:{}}).data=C()},function(){var h,S;for(S=(e=e||{data:{}}).data.multi_header.length,h=0;h<S;h++)if(e.data.multi_header[h].parsed===null){e.data=null;break}e.data!==null?e.data=e.data.multi_header:e.data=-1},function(){var h;(e=e||{data:{}}).data.multi_header||(e.data.multi_header=[]);try{h=new $n(e.data.uri,e.data.displayName,e.data.params),delete e.data.uri,delete e.data.displayName,delete e.data.params}catch{h=null}e.data.multi_header.push({position:A,offset:m().start.offset,parsed:h})},function(h){(h=C().trim())[0]==='"'&&(h=h.substring(1,h.length-1)),(e=e||{data:{}}).data.displayName=h},"q",y("q",!0),function(h){(e=e||{data:{}}).data.params||(e.data.params={}),e.data.params.q=h},"expires",y("expires",!0),function(h){(e=e||{data:{}}).data.params||(e.data.params={}),e.data.params.expires=h},function(h){return parseInt(h.join(""))},"0",y("0",!1),function(){return parseFloat(C())},function(h,S){(e=e||{data:{}}).data.params||(e.data.params={}),S=S===null?void 0:S[1],e.data.params[h.toLowerCase()]=S},"render",y("render",!0),"session",y("session",!0),"icon",y("icon",!0),"alert",y("alert",!0),function(){(e=e||{data:{}}).startRule==="Content_Disposition"&&(e.data.type=C().toLowerCase())},"handling",y("handling",!0),"optional",y("optional",!0),"required",y("required",!0),function(h){(e=e||{data:{}}).data=parseInt(h.join(""))},function(){(e=e||{data:{}}).data=C()},"text",y("text",!0),"image",y("image",!0),"audio",y("audio",!0),"video",y("video",!0),"application",y("application",!0),"message",y("message",!0),"multipart",y("multipart",!0),"x-",y("x-",!0),function(h){(e=e||{data:{}}).data.value=parseInt(h.join(""))},function(h){(e=e||{data:{}}).data=h},function(h){(e=e||{data:{}}).data.event=h.toLowerCase()},function(){var h=(e=e||{data:{}}).data.tag;e.data=new $n(e.data.uri,e.data.displayName,e.data.params),h&&e.data.setParam("tag",h)},"tag",y("tag",!0),function(h){(e=e||{data:{}}).data.tag=h},function(h){(e=e||{data:{}}).data=parseInt(h.join(""))},function(h){(e=e||{data:{}}).data=h},function(){(e=e||{data:{}}).data=new $n(e.data.uri,e.data.displayName,e.data.params)},"digest",y("Digest",!0),"realm",y("realm",!0),function(h){(e=e||{data:{}}).data.realm=h},"domain",y("domain",!0),"nonce",y("nonce",!0),function(h){(e=e||{data:{}}).data.nonce=h},"opaque",y("opaque",!0),function(h){(e=e||{data:{}}).data.opaque=h},"stale",y("stale",!0),"true",y("true",!0),function(){(e=e||{data:{}}).data.stale=!0},"false",y("false",!0),function(){(e=e||{data:{}}).data.stale=!1},"algorithm",y("algorithm",!0),"md5",y("MD5",!0),"md5-sess",y("MD5-sess",!0),function(h){(e=e||{data:{}}).data.algorithm=h.toUpperCase()},"qop",y("qop",!0),"auth-int",y("auth-int",!0),"auth",y("auth",!0),function(h){(e=e||{data:{}}).data.qop||(e.data.qop=[]),e.data.qop.push(h.toLowerCase())},function(h){(e=e||{data:{}}).data.value=parseInt(h.join(""))},function(){var h,S;for(S=(e=e||{data:{}}).data.multi_header.length,h=0;h<S;h++)if(e.data.multi_header[h].parsed===null){e.data=null;break}e.data!==null?e.data=e.data.multi_header:e.data=-1},function(){var h;(e=e||{data:{}}).data.multi_header||(e.data.multi_header=[]);try{h=new $n(e.data.uri,e.data.displayName,e.data.params),delete e.data.uri,delete e.data.displayName,delete e.data.params}catch{h=null}e.data.multi_header.push({position:A,offset:m().start.offset,parsed:h})},function(){(e=e||{data:{}}).data=new $n(e.data.uri,e.data.displayName,e.data.params)},function(){(e=e||{data:{}}).data.replaces_from_tag&&e.data.replaces_to_tag||(e.data=-1)},function(){(e=e||{data:{}}).data={call_id:e.data}},"from-tag",y("from-tag",!0),function(h){(e=e||{data:{}}).data.replaces_from_tag=h},"to-tag",y("to-tag",!0),function(h){(e=e||{data:{}}).data.replaces_to_tag=h},"early-only",y("early-only",!0),function(){(e=e||{data:{}}).data.early_only=!0},function(h,S){return S},function(h,S){return function(T,R){return[T].concat(R)}(h,S)},function(h){(e=e||{data:{}}).startRule==="Require"&&(e.data=h||[])},function(h){(e=e||{data:{}}).data.value=parseInt(h.join(""))},"active",y("active",!0),"pending",y("pending",!0),"terminated",y("terminated",!0),function(){(e=e||{data:{}}).data.state=C()},"reason",y("reason",!0),function(h){e=e||{data:{}},h!==void 0&&(e.data.reason=h)},function(h){e=e||{data:{}},h!==void 0&&(e.data.expires=h)},"retry_after",y("retry_after",!0),function(h){e=e||{data:{}},h!==void 0&&(e.data.retry_after=h)},"deactivated",y("deactivated",!0),"probation",y("probation",!0),"rejected",y("rejected",!0),"timeout",y("timeout",!0),"giveup",y("giveup",!0),"noresource",y("noresource",!0),"invariant",y("invariant",!0),function(h){(e=e||{data:{}}).startRule==="Supported"&&(e.data=h||[])},function(){var h=(e=e||{data:{}}).data.tag;e.data=new $n(e.data.uri,e.data.displayName,e.data.params),h&&e.data.setParam("tag",h)},"ttl",y("ttl",!0),function(h){(e=e||{data:{}}).data.ttl=h},"maddr",y("maddr",!0),function(h){(e=e||{data:{}}).data.maddr=h},"received",y("received",!0),function(h){(e=e||{data:{}}).data.received=h},"branch",y("branch",!0),function(h){(e=e||{data:{}}).data.branch=h},"rport",y("rport",!0),function(h){e=e||{data:{}},h!==void 0&&(e.data.rport=h.join(""))},function(h){(e=e||{data:{}}).data.protocol=h},y("UDP",!0),y("TCP",!0),y("TLS",!0),y("SCTP",!0),function(h){(e=e||{data:{}}).data.transport=h},function(){(e=e||{data:{}}).data.host=C()},function(h){(e=e||{data:{}}).data.port=parseInt(h.join(""))},function(h){return parseInt(h.join(""))},function(h){(e=e||{data:{}}).startRule==="Session_Expires"&&(e.data.deltaSeconds=h)},"refresher",y("refresher",!1),"uas",y("uas",!1),"uac",y("uac",!1),function(h){(e=e||{data:{}}).startRule==="Session_Expires"&&(e.data.refresher=h)},function(h){(e=e||{data:{}}).startRule==="Min_SE"&&(e.data=h)},"stuns",y("stuns",!0),"stun",y("stun",!0),function(h){(e=e||{data:{}}).data.scheme=h},function(h){(e=e||{data:{}}).data.host=h},"?transport=",y("?transport=",!1),"turns",y("turns",!0),"turn",y("turn",!0),function(h){(e=e||{data:{}}).data.transport=h},function(){(e=e||{data:{}}).data=C()},"Referred-By",y("Referred-By",!1),"b",y("b",!1),"cid",y("cid",!1)],s=[g('2 ""6 7!'),g('4"""5!7#'),g('4$""5!7%'),g(`4&""5!7'`),g(";'.# &;("),g('4(""5!7)'),g('4*""5!7+'),g('2,""6,7-'),g('2.""6.7/'),g('40""5!71'),g('22""6273.‰ &24""6475.} &26""6677.q &28""6879.e &2:""6:7;.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E'),g(";).# &;,"),g('2F""6F7G.} &2H""6H7I.q &2J""6J7K.e &2L""6L7M.Y &2N""6N7O.M &2P""6P7Q.A &2R""6R7S.5 &2T""6T7U.) &2V""6V7W'),g(`%%2X""6X7Y/5#;#/,$;#/#$+#)(#'#("'#&'#/"!&,)`),g(`%%$;$0#*;$&/,#; /#$+")("'#&'#." &"/=#$;$/&#0#*;$&&&#/'$8":Z" )("'#&'#`),g(';.." &"'),g(`%$;'.# &;(0)*;'.# &;(&/?#28""6879/0$;//'$8#:[# )(#'#("'#&'#`),g(`%%$;2/&#0#*;2&&&#/g#$%$;.0#*;.&/,#;2/#$+")("'#&'#0=*%$;.0#*;.&/,#;2/#$+")("'#&'#&/#$+")("'#&'#/"!&,)`),g('4\\""5!7].# &;3'),g('4^""5!7_'),g('4`""5!7a'),g(';!.) &4b""5!7c'),g('%$;).• &2F""6F7G.‰ &2J""6J7K.} &2L""6L7M.q &2X""6X7Y.e &2P""6P7Q.Y &2H""6H7I.M &2@""6@7A.A &2d""6d7e.5 &2R""6R7S.) &2N""6N7O/ž#0›*;).• &2F""6F7G.‰ &2J""6J7K.} &2L""6L7M.q &2X""6X7Y.e &2P""6P7Q.Y &2H""6H7I.M &2@""6@7A.A &2d""6d7e.5 &2R""6R7S.) &2N""6N7O&&&#/"!&,)'),g('%$;).‰ &2F""6F7G.} &2L""6L7M.q &2X""6X7Y.e &2P""6P7Q.Y &2H""6H7I.M &2@""6@7A.A &2d""6d7e.5 &2R""6R7S.) &2N""6N7O/’#0*;).‰ &2F""6F7G.} &2L""6L7M.q &2X""6X7Y.e &2P""6P7Q.Y &2H""6H7I.M &2@""6@7A.A &2d""6d7e.5 &2R""6R7S.) &2N""6N7O&&&#/"!&,)'),g(`2T""6T7U.ã &2V""6V7W.× &2f""6f7g.Ë &2h""6h7i.¿ &2:""6:7;.³ &2D""6D7E.§ &22""6273.› &28""6879. &2j""6j7k.ƒ &;&.} &24""6475.q &2l""6l7m.e &2n""6n7o.Y &26""6677.M &2>""6>7?.A &2p""6p7q.5 &2r""6r7s.) &;'.# &;(`),g('%$;).ī &2F""6F7G.ğ &2J""6J7K.ē &2L""6L7M.ć &2X""6X7Y.û &2P""6P7Q.ï &2H""6H7I.ã &2@""6@7A.× &2d""6d7e.Ë &2R""6R7S.¿ &2N""6N7O.³ &2T""6T7U.§ &2V""6V7W.› &2f""6f7g. &2h""6h7i.ƒ &28""6879.w &2j""6j7k.k &;&.e &24""6475.Y &2l""6l7m.M &2n""6n7o.A &26""6677.5 &2p""6p7q.) &2r""6r7s/Ĵ#0ı*;).ī &2F""6F7G.ğ &2J""6J7K.ē &2L""6L7M.ć &2X""6X7Y.û &2P""6P7Q.ï &2H""6H7I.ã &2@""6@7A.× &2d""6d7e.Ë &2R""6R7S.¿ &2N""6N7O.³ &2T""6T7U.§ &2V""6V7W.› &2f""6f7g. &2h""6h7i.ƒ &28""6879.w &2j""6j7k.k &;&.e &24""6475.Y &2l""6l7m.M &2n""6n7o.A &26""6677.5 &2p""6p7q.) &2r""6r7s&&&#/"!&,)'),g(`%;//?#2P""6P7Q/0$;//'$8#:t# )(#'#("'#&'#`),g(`%;//?#24""6475/0$;//'$8#:u# )(#'#("'#&'#`),g(`%;//?#2>""6>7?/0$;//'$8#:v# )(#'#("'#&'#`),g(`%;//?#2T""6T7U/0$;//'$8#:w# )(#'#("'#&'#`),g(`%;//?#2V""6V7W/0$;//'$8#:x# )(#'#("'#&'#`),g(`%2h""6h7i/0#;//'$8":y" )("'#&'#`),g(`%;//6#2f""6f7g/'$8":z" )("'#&'#`),g(`%;//?#2D""6D7E/0$;//'$8#:{# )(#'#("'#&'#`),g(`%;//?#22""6273/0$;//'$8#:|# )(#'#("'#&'#`),g(`%;//?#28""6879/0$;//'$8#:}# )(#'#("'#&'#`),g(`%;//0#;&/'$8":~" )("'#&'#`),g(`%;&/0#;//'$8":~" )("'#&'#`),g(`%;=/T#$;G.) &;K.# &;F0/*;G.) &;K.# &;F&/,$;>/#$+#)(#'#("'#&'#`),g('4""5!7€.A &4""5!7‚.5 &4ƒ""5!7„.) &;3.# &;.'),g(`%%;//Q#;&/H$$;J.# &;K0)*;J.# &;K&/,$;&/#$+$)($'#(#'#("'#&'#/"!&,)`),g(`%;//]#;&/T$%$;J.# &;K0)*;J.# &;K&/"!&,)/1$;&/($8$:…$!!)($'#(#'#("'#&'#`),g(';..G &2L""6L7M.; &4†""5!7‡./ &4ƒ""5!7„.# &;3'),g(`%2j""6j7k/J#4ˆ""5!7‰.5 &4Š""5!7‹.) &4Œ""5!7/#$+")("'#&'#`),g(`%;N/M#28""6879/>$;O." &"/0$;S/'$8$:Ž$ )($'#(#'#("'#&'#`),g(`%;N/d#28""6879/U$;O." &"/G$;S/>$;_/5$;l." &"/'$8&:& )(&'#(%'#($'#(#'#("'#&'#`),g(`%3""5$7‘.) &3’""5#7“/' 8!:”!! )`),g(`%;P/]#%28""6879/,#;R/#$+")("'#&'#." &"/6$2:""6:7;/'$8#:•# )(#'#("'#&'#`),g("$;+.) &;-.# &;Q/2#0/*;+.) &;-.# &;Q&&&#"),g('2<""6<7=.q &2>""6>7?.e &2@""6@7A.Y &2B""6B7C.M &2D""6D7E.A &22""6273.5 &26""6677.) &24""6475'),g('%$;+._ &;-.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E0e*;+._ &;-.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E&/& 8!:–! )'),g(`%;T/J#%28""6879/,#;^/#$+")("'#&'#." &"/#$+")("'#&'#`),g("%;U.) &;\\.# &;X/& 8!:—! )"),g(`%$%;V/2#2J""6J7K/#$+")("'#&'#0<*%;V/2#2J""6J7K/#$+")("'#&'#&/D#;W/;$2J""6J7K." &"/'$8#:˜# )(#'#("'#&'#`),g('$4™""5!7š/,#0)*4™""5!7š&&&#'),g(`%4$""5!7%/?#$4›""5!7œ0)*4›""5!7œ&/#$+")("'#&'#`),g(`%2l""6l7m/?#;Y/6$2n""6n7o/'$8#:# )(#'#("'#&'#`),g(`%%;Z/³#28""6879/¤$;Z/›$28""6879/Œ$;Z/ƒ$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+-)(-'#(,'#(+'#(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.ސ &%2ž""6ž7Ÿ/¤#;Z/›$28""6879/Œ$;Z/ƒ$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+,)(,'#(+'#(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.۹ &%2ž""6ž7Ÿ/Œ#;Z/ƒ$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+*)(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.ٺ &%2ž""6ž7Ÿ/t#;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+()(('#(''#(&'#(%'#($'#(#'#("'#&'#.ؓ &%2ž""6ž7Ÿ/\\#;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+&)(&'#(%'#($'#(#'#("'#&'#.ׄ &%2ž""6ž7Ÿ/D#;Z/;$28""6879/,$;[/#$+$)($'#(#'#("'#&'#.֍ &%2ž""6ž7Ÿ/,#;[/#$+")("'#&'#.ծ &%2ž""6ž7Ÿ/,#;Z/#$+")("'#&'#.Տ &%;Z/›#2ž""6ž7Ÿ/Œ$;Z/ƒ$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$++)(+'#(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.Ӈ &%;Z/ª#%28""6879/,#;Z/#$+")("'#&'#." &"/ƒ$2ž""6ž7Ÿ/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+*)(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.а &%;Z/¹#%28""6879/,#;Z/#$+")("'#&'#." &"/’$%28""6879/,#;Z/#$+")("'#&'#." &"/k$2ž""6ž7Ÿ/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+))()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.Ί &%;Z/È#%28""6879/,#;Z/#$+")("'#&'#." &"/¡$%28""6879/,#;Z/#$+")("'#&'#." &"/z$%28""6879/,#;Z/#$+")("'#&'#." &"/S$2ž""6ž7Ÿ/D$;Z/;$28""6879/,$;[/#$+()(('#(''#(&'#(%'#($'#(#'#("'#&'#.˕ &%;Z/×#%28""6879/,#;Z/#$+")("'#&'#." &"/°$%28""6879/,#;Z/#$+")("'#&'#." &"/‰$%28""6879/,#;Z/#$+")("'#&'#." &"/b$%28""6879/,#;Z/#$+")("'#&'#." &"/;$2ž""6ž7Ÿ/,$;[/#$+')(''#(&'#(%'#($'#(#'#("'#&'#.ȑ &%;Z/þ#%28""6879/,#;Z/#$+")("'#&'#." &"/×$%28""6879/,#;Z/#$+")("'#&'#." &"/°$%28""6879/,#;Z/#$+")("'#&'#." &"/‰$%28""6879/,#;Z/#$+")("'#&'#." &"/b$%28""6879/,#;Z/#$+")("'#&'#." &"/;$2ž""6ž7Ÿ/,$;Z/#$+()(('#(''#(&'#(%'#($'#(#'#("'#&'#.Ħ &%;Z/Ĝ#%28""6879/,#;Z/#$+")("'#&'#." &"/õ$%28""6879/,#;Z/#$+")("'#&'#." &"/Î$%28""6879/,#;Z/#$+")("'#&'#." &"/§$%28""6879/,#;Z/#$+")("'#&'#." &"/€$%28""6879/,#;Z/#$+")("'#&'#." &"/Y$%28""6879/,#;Z/#$+")("'#&'#." &"/2$2ž""6ž7Ÿ/#$+()(('#(''#(&'#(%'#($'#(#'#("'#&'#/& 8!: ! )`),g(`%;#/M#;#." &"/?$;#." &"/1$;#." &"/#$+$)($'#(#'#("'#&'#`),g(`%;Z/;#28""6879/,$;Z/#$+#)(#'#("'#&'#.# &;\\`),g(`%;]/o#2J""6J7K/\`$;]/W$2J""6J7K/H$;]/?$2J""6J7K/0$;]/'$8':¡' )(''#(&'#(%'#($'#(#'#("'#&'#`),g(`%2¢""6¢7£/2#4¤""5!7¥/#$+")("'#&'#.˜ &%2¦""6¦7§/;#4¨""5!7©/,$;!/#$+#)(#'#("'#&'#.j &%2ª""6ª7«/5#;!/,$;!/#$+#)(#'#("'#&'#.B &%4¬""5!7­/,#;!/#$+")("'#&'#.# &;!`),g(`%%;!." &"/[#;!." &"/M$;!." &"/?$;!." &"/1$;!." &"/#$+%)(%'#($'#(#'#("'#&'#/' 8!:®!! )`),g(`$%22""6273/,#;\`/#$+")("'#&'#0<*%22""6273/,#;\`/#$+")("'#&'#&`),g(";a.A &;b.; &;c.5 &;d./ &;e.) &;f.# &;g"),g(`%3¯""5*7°/a#3±""5#7².G &3³""5#7´.; &3µ""5$7¶./ &3·""5#7¸.# &;6/($8":¹"! )("'#&'#`),g(`%3º""5%7»/I#3¼""5%7½./ &3¾""5"7¿.# &;6/($8":À"! )("'#&'#`),g(`%3Á""5'7Â/1#;/($8":Ã"! )("'#&'#`),g(`%3Ä""5$7Å/1#;ð/($8":Æ"! )("'#&'#`),g(`%3Ç""5&7È/1#;T/($8":É"! )("'#&'#`),g(`%3Ê""5"7Ë/N#%2>""6>7?/,#;6/#$+")("'#&'#." &"/'$8":Ì" )("'#&'#`),g(`%;h/P#%2>""6>7?/,#;i/#$+")("'#&'#." &"/)$8":Í""! )("'#&'#`),g('%$;j/&#0#*;j&&&#/"!&,)'),g('%$;j/&#0#*;j&&&#/"!&,)'),g(";k.) &;+.# &;-"),g('2l""6l7m.e &2n""6n7o.Y &24""6475.M &28""6879.A &2<""6<7=.5 &2@""6@7A.) &2B""6B7C'),g(`%26""6677/n#;m/e$$%2<""6<7=/,#;m/#$+")("'#&'#0<*%2<""6<7=/,#;m/#$+")("'#&'#&/#$+#)(#'#("'#&'#`),g(`%;n/A#2>""6>7?/2$;o/)$8#:Î#"" )(#'#("'#&'#`),g("$;p.) &;+.# &;-/2#0/*;p.) &;+.# &;-&&&#"),g("$;p.) &;+.# &;-0/*;p.) &;+.# &;-&"),g('2l""6l7m.e &2n""6n7o.Y &24""6475.M &26""6677.A &28""6879.5 &2@""6@7A.) &2B""6B7C'),g(";‘.# &;r"),g(`%;/G#;'/>$;s/5$;'/,$;„/#$+%)(%'#($'#(#'#("'#&'#`),g(";M.# &;t"),g(`%;/E#28""6879/6$;u.# &;x/'$8#:Ï# )(#'#("'#&'#`),g(`%;v.# &;w/J#%26""6677/,#;ƒ/#$+")("'#&'#." &"/#$+")("'#&'#`),g(`%2Ð""6Ð7Ñ/:#;€/1$;w." &"/#$+#)(#'#("'#&'#`),g(`%24""6475/,#;{/#$+")("'#&'#`),g(`%;z/3#$;y0#*;y&/#$+")("'#&'#`),g(";*.) &;+.# &;-"),g(';+. &;-.‰ &22""6273.} &26""6677.q &28""6879.e &2:""6:7;.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E'),g(`%;|/e#$%24""6475/,#;|/#$+")("'#&'#0<*%24""6475/,#;|/#$+")("'#&'#&/#$+")("'#&'#`),g(`%$;~0#*;~&/e#$%22""6273/,#;}/#$+")("'#&'#0<*%22""6273/,#;}/#$+")("'#&'#&/#$+")("'#&'#`),g("$;~0#*;~&"),g(';+.w &;-.q &28""6879.e &2:""6:7;.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E'),g(`%%;"/‡#$;".G &;!.A &2@""6@7A.5 &2F""6F7G.) &2J""6J7K0M*;".G &;!.A &2@""6@7A.5 &2F""6F7G.) &2J""6J7K&/#$+")("'#&'#/& 8!:Ò! )`),g(";.# &;‚"),g(`%%;O/2#2:""6:7;/#$+")("'#&'#." &"/,#;S/#$+")("'#&'#." &"`),g('$;+.ƒ &;-.} &2B""6B7C.q &2D""6D7E.e &22""6273.Y &28""6879.M &2:""6:7;.A &2<""6<7=.5 &2>""6>7?.) &2@""6@7A/Œ#0‰*;+.ƒ &;-.} &2B""6B7C.q &2D""6D7E.e &22""6273.Y &28""6879.M &2:""6:7;.A &2<""6<7=.5 &2>""6>7?.) &2@""6@7A&&&#'),g("$;y0#*;y&"),g(`%3’""5#7Ó/q#24""6475/b$$;!/&#0#*;!&&&#/L$2J""6J7K/=$$;!/&#0#*;!&&&#/'$8%:Ô% )(%'#($'#(#'#("'#&'#`),g('2Õ""6Õ7Ö'),g('2×""6×7Ø'),g('2Ù""6Ù7Ú'),g('2Û""6Û7Ü'),g('2Ý""6Ý7Þ'),g('2ß""6ß7à'),g('2á""6á7â'),g('2ã""6ã7ä'),g('2å""6å7æ'),g('2ç""6ç7è'),g('2é""6é7ê'),g("%;….Y &;†.S &;ˆ.M &;‰.G &;Š.A &;‹.; &;Œ.5 &;./ &;.) &;Ž.# &;6/& 8!:ë! )"),g(`%;„/G#;'/>$;’/5$;'/,$;”/#$+%)(%'#($'#(#'#("'#&'#`),g("%;“/' 8!:ì!! )"),g(`%;!/5#;!/,$;!/#$+#)(#'#("'#&'#`),g("%$;*.A &;+.; &;-.5 &;3./ &;4.) &;'.# &;(0G*;*.A &;+.; &;-.5 &;3./ &;4.) &;'.# &;(&/& 8!:í! )"),g(`%;¶/Y#$%;A/,#;¶/#$+")("'#&'#06*%;A/,#;¶/#$+")("'#&'#&/#$+")("'#&'#`),g(`%;9/N#%2:""6:7;/,#;9/#$+")("'#&'#." &"/'$8":î" )("'#&'#`),g(`%;:.c &%;˜/Y#$%;A/,#;˜/#$+")("'#&'#06*%;A/,#;˜/#$+")("'#&'#&/#$+")("'#&'#/& 8!:ï! )`),g(`%;L.# &;™/]#$%;B/,#;›/#$+")("'#&'#06*%;B/,#;›/#$+")("'#&'#&/'$8":ð" )("'#&'#`),g(`%;š." &"/>#;@/5$;M/,$;?/#$+$)($'#(#'#("'#&'#`),g(`%%;6/Y#$%;./,#;6/#$+")("'#&'#06*%;./,#;6/#$+")("'#&'#&/#$+")("'#&'#.# &;H/' 8!:ñ!! )`),g(";œ.) &;.# &; "),g(`%3ò""5!7ó/:#;</1$;Ÿ/($8#:ô#! )(#'#("'#&'#`),g(`%3õ""5'7ö/:#;</1$;ž/($8#:÷#! )(#'#("'#&'#`),g("%$;!/&#0#*;!&&&#/' 8!:ø!! )"),g(`%2ù""6ù7ú/o#%2J""6J7K/M#;!." &"/?$;!." &"/1$;!." &"/#$+$)($'#(#'#("'#&'#." &"/'$8":û" )("'#&'#`),g(`%;6/J#%;</,#;¡/#$+")("'#&'#." &"/)$8":ü""! )("'#&'#`),g(";6.) &;T.# &;H"),g(`%;£/Y#$%;B/,#;¤/#$+")("'#&'#06*%;B/,#;¤/#$+")("'#&'#&/#$+")("'#&'#`),g(`%3ý""5&7þ.G &3ÿ""5'7Ā.; &3ā""5$7Ă./ &3ă""5%7Ą.# &;6/& 8!:ą! )`),g(";¥.# &; "),g(`%3Ć""5(7ć/M#;</D$3Ĉ""5(7ĉ./ &3Ċ""5(7ċ.# &;6/#$+#)(#'#("'#&'#`),g(`%;6/Y#$%;A/,#;6/#$+")("'#&'#06*%;A/,#;6/#$+")("'#&'#&/#$+")("'#&'#`),g("%$;!/&#0#*;!&&&#/' 8!:Č!! )"),g("%;©/& 8!:č! )"),g(`%;ª/k#;;/b$;¯/Y$$%;B/,#;°/#$+")("'#&'#06*%;B/,#;°/#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#`),g(";«.# &;¬"),g('3Ď""5$7ď.S &3Đ""5%7đ.G &3Ē""5%7ē.; &3Ĕ""5%7ĕ./ &3Ė""5+7ė.# &;­'),g(`3Ę""5'7ę./ &3Ě""5)7ě.# &;­`),g(";6.# &;®"),g(`%3Ĝ""5"7ĝ/,#;6/#$+")("'#&'#`),g(";­.# &;6"),g(`%;6/5#;</,$;±/#$+#)(#'#("'#&'#`),g(";6.# &;H"),g(`%;³/5#;./,$;/#$+#)(#'#("'#&'#`),g("%$;!/&#0#*;!&&&#/' 8!:Ğ!! )"),g("%;ž/' 8!:ğ!! )"),g(`%;¶/^#$%;B/,#; /#$+")("'#&'#06*%;B/,#; /#$+")("'#&'#&/($8":Ġ"!!)("'#&'#`),g(`%%;7/e#$%2J""6J7K/,#;7/#$+")("'#&'#0<*%2J""6J7K/,#;7/#$+")("'#&'#&/#$+")("'#&'#/"!&,)`),g(`%;L.# &;™/]#$%;B/,#;¸/#$+")("'#&'#06*%;B/,#;¸/#$+")("'#&'#&/'$8":ġ" )("'#&'#`),g(";¹.# &; "),g(`%3Ģ""5#7ģ/:#;</1$;6/($8#:Ĥ#! )(#'#("'#&'#`),g("%$;!/&#0#*;!&&&#/' 8!:ĥ!! )"),g("%;ž/' 8!:Ħ!! )"),g(`%$;š0#*;š&/x#;@/o$;M/f$;?/]$$%;B/,#; /#$+")("'#&'#06*%;B/,#; /#$+")("'#&'#&/'$8%:ħ% )(%'#($'#(#'#("'#&'#`),g(";¾"),g(`%3Ĩ""5&7ĩ/k#;./b$;Á/Y$$%;A/,#;Á/#$+")("'#&'#06*%;A/,#;Á/#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#.# &;¿`),g(`%;6/k#;./b$;À/Y$$%;A/,#;À/#$+")("'#&'#06*%;A/,#;À/#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#`),g(`%;6/;#;</2$;6.# &;H/#$+#)(#'#("'#&'#`),g(";Â.G &;Ä.A &;Æ.; &;È.5 &;É./ &;Ê.) &;Ë.# &;À"),g(`%3Ī""5%7ī/5#;</,$;Ã/#$+#)(#'#("'#&'#`),g("%;I/' 8!:Ĭ!! )"),g(`%3ĭ""5&7Į/—#;</Ž$;D/…$;Å/|$$%$;'/&#0#*;'&&&#/,#;Å/#$+")("'#&'#0C*%$;'/&#0#*;'&&&#/,#;Å/#$+")("'#&'#&/,$;E/#$+&)(&'#(%'#($'#(#'#("'#&'#`),g(";t.# &;w"),g(`%3į""5%7İ/5#;</,$;Ç/#$+#)(#'#("'#&'#`),g("%;I/' 8!:ı!! )"),g(`%3IJ""5&7ij/:#;</1$;I/($8#:Ĵ#! )(#'#("'#&'#`),g(`%3ĵ""5%7Ķ/]#;</T$%3ķ""5$7ĸ/& 8!:Ĺ! ).4 &%3ĺ""5%7Ļ/& 8!:ļ! )/#$+#)(#'#("'#&'#`),g(`%3Ľ""5)7ľ/R#;</I$3Ŀ""5#7ŀ./ &3Ł""5(7ł.# &;6/($8#:Ń#! )(#'#("'#&'#`),g(`%3ń""5#7Ņ/“#;</Š$;D/$%;Ì/e#$%2D""6D7E/,#;Ì/#$+")("'#&'#0<*%2D""6D7E/,#;Ì/#$+")("'#&'#&/#$+")("'#&'#/,$;E/#$+%)(%'#($'#(#'#("'#&'#`),g(`%3ņ""5(7Ň./ &3ň""5$7ʼn.# &;6/' 8!:Ŋ!! )`),g(`%;6/Y#$%;A/,#;6/#$+")("'#&'#06*%;A/,#;6/#$+")("'#&'#&/#$+")("'#&'#`),g(`%;Ï/G#;./>$;Ï/5$;./,$;/#$+%)(%'#($'#(#'#("'#&'#`),g("%$;!/&#0#*;!&&&#/' 8!:ŋ!! )"),g(`%;Ñ/]#$%;A/,#;Ñ/#$+")("'#&'#06*%;A/,#;Ñ/#$+")("'#&'#&/'$8":Ō" )("'#&'#`),g(`%;™/]#$%;B/,#; /#$+")("'#&'#06*%;B/,#; /#$+")("'#&'#&/'$8":ō" )("'#&'#`),g(`%;L.O &;™.I &%;@." &"/:#;t/1$;?." &"/#$+#)(#'#("'#&'#/]#$%;B/,#; /#$+")("'#&'#06*%;B/,#; /#$+")("'#&'#&/'$8":Ŏ" )("'#&'#`),g(`%;Ô/]#$%;B/,#;Õ/#$+")("'#&'#06*%;B/,#;Õ/#$+")("'#&'#&/'$8":ŏ" )("'#&'#`),g("%;–/& 8!:Ő! )"),g(`%3ő""5(7Œ/:#;</1$;6/($8#:œ#! )(#'#("'#&'#.g &%3Ŕ""5&7ŕ/:#;</1$;6/($8#:Ŗ#! )(#'#("'#&'#.: &%3ŗ""5*7Ř/& 8!:ř! ).# &; `),g(`%%;6/k#$%;A/2#;6/)$8":Ś""$ )("'#&'#0<*%;A/2#;6/)$8":Ś""$ )("'#&'#&/)$8":ś""! )("'#&'#." &"/' 8!:Ŝ!! )`),g(`%;Ø/Y#$%;A/,#;Ø/#$+")("'#&'#06*%;A/,#;Ø/#$+")("'#&'#&/#$+")("'#&'#`),g(`%;™/Y#$%;B/,#; /#$+")("'#&'#06*%;B/,#; /#$+")("'#&'#&/#$+")("'#&'#`),g("%$;!/&#0#*;!&&&#/' 8!:ŝ!! )"),g(`%;Û/Y#$%;B/,#;Ü/#$+")("'#&'#06*%;B/,#;Ü/#$+")("'#&'#&/#$+")("'#&'#`),g(`%3Ş""5&7ş.; &3Š""5'7š./ &3Ţ""5*7ţ.# &;6/& 8!:Ť! )`),g(`%3ť""5&7Ŧ/:#;</1$;Ý/($8#:ŧ#! )(#'#("'#&'#.} &%3õ""5'7ö/:#;</1$;ž/($8#:Ũ#! )(#'#("'#&'#.P &%3ũ""5+7Ū/:#;</1$;ž/($8#:ū#! )(#'#("'#&'#.# &; `),g(`3Ŭ""5+7ŭ.k &3Ů""5)7ů._ &3Ű""5(7ű.S &3Ų""5'7ų.G &3Ŵ""5&7ŵ.; &3Ŷ""5*7ŷ./ &3Ÿ""5)7Ź.# &;6`),g(';1." &"'),g(`%%;6/k#$%;A/2#;6/)$8":Ś""$ )("'#&'#0<*%;A/2#;6/)$8":Ś""$ )("'#&'#&/)$8":ś""! )("'#&'#." &"/' 8!:ź!! )`),g(`%;L.# &;™/]#$%;B/,#;á/#$+")("'#&'#06*%;B/,#;á/#$+")("'#&'#&/'$8":Ż" )("'#&'#`),g(";¹.# &; "),g(`%;ã/Y#$%;A/,#;ã/#$+")("'#&'#06*%;A/,#;ã/#$+")("'#&'#&/#$+")("'#&'#`),g(`%;ê/k#;./b$;í/Y$$%;B/,#;ä/#$+")("'#&'#06*%;B/,#;ä/#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#`),g(";å.; &;æ.5 &;ç./ &;è.) &;é.# &; "),g(`%3ż""5#7Ž/:#;</1$;ð/($8#:ž#! )(#'#("'#&'#`),g(`%3ſ""5%7ƀ/:#;</1$;T/($8#:Ɓ#! )(#'#("'#&'#`),g(`%3Ƃ""5(7ƃ/F#;</=$;\\.) &;Y.# &;X/($8#:Ƅ#! )(#'#("'#&'#`),g(`%3ƅ""5&7Ɔ/:#;</1$;6/($8#:Ƈ#! )(#'#("'#&'#`),g(`%3ƈ""5%7Ɖ/A#;</8$$;!0#*;!&/($8#:Ɗ#! )(#'#("'#&'#`),g(`%;ë/G#;;/>$;6/5$;;/,$;ì/#$+%)(%'#($'#(#'#("'#&'#`),g(`%3’""5#7Ó.# &;6/' 8!:Ƌ!! )`),g(`%3±""5#7ƌ.G &3³""5#7ƍ.; &3·""5#7Ǝ./ &3µ""5$7Ə.# &;6/' 8!:Ɛ!! )`),g(`%;î/D#%;C/,#;ï/#$+")("'#&'#." &"/#$+")("'#&'#`),g("%;U.) &;\\.# &;X/& 8!:Ƒ! )"),g(`%%;!." &"/[#;!." &"/M$;!." &"/?$;!." &"/1$;!." &"/#$+%)(%'#($'#(#'#("'#&'#/' 8!:ƒ!! )`),g(`%%;!/?#;!." &"/1$;!." &"/#$+#)(#'#("'#&'#/' 8!:Ɠ!! )`),g(";¾"),g(`%;ž/^#$%;B/,#;ó/#$+")("'#&'#06*%;B/,#;ó/#$+")("'#&'#&/($8":Ɣ"!!)("'#&'#`),g(";ô.# &; "),g(`%2ƕ""6ƕ7Ɩ/L#;</C$2Ɨ""6Ɨ7Ƙ.) &2ƙ""6ƙ7ƚ/($8#:ƛ#! )(#'#("'#&'#`),g(`%;ž/^#$%;B/,#; /#$+")("'#&'#06*%;B/,#; /#$+")("'#&'#&/($8":Ɯ"!!)("'#&'#`),g(`%;6/5#;0/,$;÷/#$+#)(#'#("'#&'#`),g("$;2.) &;4.# &;.0/*;2.) &;4.# &;.&"),g("$;%0#*;%&"),g(`%;ú/;#28""6879/,$;û/#$+#)(#'#("'#&'#`),g(`%3Ɲ""5%7ƞ.) &3Ɵ""5$7Ơ/' 8!:ơ!! )`),g(`%;ü/J#%28""6879/,#;^/#$+")("'#&'#." &"/#$+")("'#&'#`),g("%;\\.) &;X.# &;‚/' 8!:Ƣ!! )"),g(';".S &;!.M &2F""6F7G.A &2J""6J7K.5 &2H""6H7I.) &2N""6N7O'),g('2L""6L7M.• &2B""6B7C.‰ &2<""6<7=.} &2R""6R7S.q &2T""6T7U.e &2V""6V7W.Y &2P""6P7Q.M &2@""6@7A.A &2D""6D7E.5 &22""6273.) &2>""6>7?'),g(`%;Ā/b#28""6879/S$;û/J$%2ƣ""6ƣ7Ƥ/,#;ì/#$+")("'#&'#." &"/#$+$)($'#(#'#("'#&'#`),g(`%3ƥ""5%7Ʀ.) &3Ƨ""5$7ƨ/' 8!:ơ!! )`),g(`%3±""5#7².6 &3³""5#7´.* &$;+0#*;+&/' 8!:Ʃ!! )`),g(`%;Ą/‡#2F""6F7G/x$;ă/o$2F""6F7G/\`$;ă/W$2F""6F7G/H$;ă/?$2F""6F7G/0$;ą/'$8):ƪ) )()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#`),g(`%;#/>#;#/5$;#/,$;#/#$+$)($'#(#'#("'#&'#`),g(`%;ă/,#;ă/#$+")("'#&'#`),g(`%;ă/5#;ă/,$;ă/#$+#)(#'#("'#&'#`),g(`%;q/T#$;m0#*;m&/D$%; /,#;ø/#$+")("'#&'#." &"/#$+#)(#'#("'#&'#`),g(`%2ƫ""6ƫ7Ƭ.) &2ƭ""6ƭ7Ʈ/w#;0/n$;Ĉ/e$$%;B/2#;ĉ.# &; /#$+")("'#&'#0<*%;B/2#;ĉ.# &; /#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#`),g(";™.# &;L"),g(`%2Ư""6Ư7ư/5#;</,$;Ċ/#$+#)(#'#("'#&'#`),g(`%;D/S#;,/J$2:""6:7;/;$;,.# &;T/,$;E/#$+%)(%'#($'#(#'#("'#&'#`)];let A=0,c=0;const u=[{line:1,column:1}];let d,f=0,p=[],v=0;if(e.startRule!==void 0){if(!(e.startRule in i))throw new Error(`Can't start parsing from rule "`+e.startRule+'".');o=i[e.startRule]}function C(){return t.substring(c,A)}function m(){return O(c,A)}function y(h,S){return{type:"literal",text:h,ignoreCase:S}}function w(h,S,T){return{type:"class",parts:h,inverted:S,ignoreCase:T}}function I(h){let S,T=u[h];if(T)return T;for(S=h-1;!u[S];)S--;for(T=u[S],T={line:T.line,column:T.column};S<h;)t.charCodeAt(S)===10?(T.line++,T.column=1):T.column++,S++;return u[h]=T,T}function O(h,S){const T=I(h),R=I(S);return{source:r,start:{offset:h,line:T.line,column:T.column},end:{offset:S,line:R.line,column:R.column}}}function x(h){A<f||(A>f&&(f=A,p=[]),p.push(h))}function g(h){return h.split("").map(S=>S.charCodeAt(0)-32)}if(e.data={},d=function h(S){const T=s[S];let R=0;const D=[];let B=T.length;const k=[],P=[];let H;for(;;){for(;R<B;)switch(T[R]){case 0:P.push(a[T[R+1]]),R+=2;break;case 1:P.push(void 0),R++;break;case 2:P.push(null),R++;break;case 3:P.push(n),R++;break;case 4:P.push([]),R++;break;case 5:P.push(A),R++;break;case 6:P.pop(),R++;break;case 7:A=P.pop(),R++;break;case 8:P.length-=T[R+1],R+=2;break;case 9:P.splice(-2,1),R++;break;case 10:P[P.length-2].push(P.pop()),R++;break;case 11:P.push(P.splice(P.length-T[R+1],T[R+1])),R+=2;break;case 12:P.push(t.substring(P.pop(),A)),R++;break;case 13:k.push(B),D.push(R+3+T[R+1]+T[R+2]),P[P.length-1]?(B=R+3+T[R+1],R+=3):(B=R+3+T[R+1]+T[R+2],R+=3+T[R+1]);break;case 14:k.push(B),D.push(R+3+T[R+1]+T[R+2]),P[P.length-1]===n?(B=R+3+T[R+1],R+=3):(B=R+3+T[R+1]+T[R+2],R+=3+T[R+1]);break;case 15:k.push(B),D.push(R+3+T[R+1]+T[R+2]),P[P.length-1]!==n?(B=R+3+T[R+1],R+=3):(B=R+3+T[R+1]+T[R+2],R+=3+T[R+1]);break;case 16:P[P.length-1]!==n?(k.push(B),D.push(R),B=R+2+T[R+1],R+=2):R+=2+T[R+1];break;case 17:k.push(B),D.push(R+3+T[R+1]+T[R+2]),t.length>A?(B=R+3+T[R+1],R+=3):(B=R+3+T[R+1]+T[R+2],R+=3+T[R+1]);break;case 18:k.push(B),D.push(R+4+T[R+2]+T[R+3]),t.substr(A,a[T[R+1]].length)===a[T[R+1]]?(B=R+4+T[R+2],R+=4):(B=R+4+T[R+2]+T[R+3],R+=4+T[R+2]);break;case 19:k.push(B),D.push(R+4+T[R+2]+T[R+3]),t.substr(A,a[T[R+1]].length).toLowerCase()===a[T[R+1]]?(B=R+4+T[R+2],R+=4):(B=R+4+T[R+2]+T[R+3],R+=4+T[R+2]);break;case 20:k.push(B),D.push(R+4+T[R+2]+T[R+3]),a[T[R+1]].test(t.charAt(A))?(B=R+4+T[R+2],R+=4):(B=R+4+T[R+2]+T[R+3],R+=4+T[R+2]);break;case 21:P.push(t.substr(A,T[R+1])),A+=T[R+1],R+=2;break;case 22:P.push(a[T[R+1]]),A+=a[T[R+1]].length,R+=2;break;case 23:P.push(n),v===0&&x(a[T[R+1]]),R+=2;break;case 24:c=P[P.length-1-T[R+1]],R+=2;break;case 25:c=A,R++;break;case 26:H=T.slice(R+4,R+4+T[R+3]).map(function(Z){return P[P.length-1-Z]}),P.splice(P.length-T[R+2],T[R+2],a[T[R+1]].apply(null,H)),R+=4+T[R+3];break;case 27:P.push(h(T[R+1])),R+=2;break;case 28:v++,R++;break;case 29:v--,R++;break;default:throw new Error("Invalid opcode: "+T[R]+".")}if(!(k.length>0))break;B=k.pop(),R=D.pop()}return P[0]}(o),d!==n&&A===t.length)return d;throw d!==n&&A<t.length&&x({type:"end"}),M=p,E=f<t.length?t.charAt(f):null,b=f<t.length?O(f,f+1):O(f,f),new Tg(Tg.buildMessage(M,E),M,E,b);var M,E,b};var bn;(function(t){t.parse=function(e,n){const r={startRule:n};try{VS(e,r)}catch{r.data=-1}return r.data},t.nameAddrHeaderParse=function(e){const n=t.parse(e,"Name_Addr_Header");return n!==-1?n:void 0},t.URIParse=function(e){const n=t.parse(e,"SIP_URI");return n!==-1?n:void 0}})(bn=bn||(bn={}));const zS={100:"Trying",180:"Ringing",181:"Call Is Being Forwarded",182:"Queued",183:"Session Progress",199:"Early Dialog Terminated",200:"OK",202:"Accepted",204:"No Notification",300:"Multiple Choices",301:"Moved Permanently",302:"Moved Temporarily",305:"Use Proxy",380:"Alternative Service",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",410:"Gone",412:"Conditional Request Failed",413:"Request Entity Too Large",414:"Request-URI Too Long",415:"Unsupported Media Type",416:"Unsupported URI Scheme",417:"Unknown Resource-Priority",420:"Bad Extension",421:"Extension Required",422:"Session Interval Too Small",423:"Interval Too Brief",428:"Use Identity Header",429:"Provide Referrer Identity",430:"Flow Failed",433:"Anonymity Disallowed",436:"Bad Identity-Info",437:"Unsupported Certificate",438:"Invalid Identity Header",439:"First Hop Lacks Outbound Support",440:"Max-Breadth Exceeded",469:"Bad Info Package",470:"Consent Needed",478:"Unresolvable Destination",480:"Temporarily Unavailable",481:"Call/Transaction Does Not Exist",482:"Loop Detected",483:"Too Many Hops",484:"Address Incomplete",485:"Ambiguous",486:"Busy Here",487:"Request Terminated",488:"Not Acceptable Here",489:"Bad Event",491:"Request Pending",493:"Undecipherable",494:"Security Agreement Required",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Server Time-out",505:"Version Not Supported",513:"Message Too Large",580:"Precondition Failure",600:"Busy Everywhere",603:"Decline",604:"Does Not Exist Anywhere",606:"Not Acceptable"};function zi(t,e=32){let n="";for(let r=0;r<t;r++)n+=Math.floor(Math.random()*e).toString(e);return n}function qA(t){return zS[t]||""}function ZA(){return zi(10)}function Kr(t){const e={"Call-Id":"Call-ID",Cseq:"CSeq","Min-Se":"Min-SE",Rack:"RAck",Rseq:"RSeq","Www-Authenticate":"WWW-Authenticate"},n=t.toLowerCase().replace(/_/g,"-").split("-"),r=n.length;let i="";for(let o=0;o<r;o++)o!==0&&(i+="-"),i+=n[o].charAt(0).toUpperCase()+n[o].substring(1);return e[i]&&(i=e[i]),i}function Qa(t){return encodeURIComponent(t).replace(/%[A-F\d]{2}/g,"U").length}class f0{constructor(){this.headers={}}addHeader(e,n){const r={raw:n};e=Kr(e),this.headers[e]?this.headers[e].push(r):this.headers[e]=[r]}getHeader(e){const n=this.headers[Kr(e)];if(n)return n[0]?n[0].raw:void 0}getHeaders(e){const n=this.headers[Kr(e)],r=[];if(!n)return[];for(const i of n)r.push(i.raw);return r}hasHeader(e){return!!this.headers[Kr(e)]}parseHeader(e,n=0){if(e=Kr(e),!this.headers[e]||n>=this.headers[e].length)return;const r=this.headers[e][n],i=r.raw;if(r.parsed)return r.parsed;const o=bn.parse(i,e.replace(/-/g,"_"));return o===-1?void this.headers[e].splice(n,1):(r.parsed=o,o)}s(e,n=0){return this.parseHeader(e,n)}setHeader(e,n){this.headers[Kr(e)]=[{raw:n}]}toString(){return this.data}}let Bo=class extends f0{constructor(){super()}},Fi=class extends f0{constructor(){super()}},qd=class Ys{constructor(e,n,r,i,o,a,s){this.headers={},this.extraHeaders=[],this.options=Ys.getDefaultOptions(),o&&(this.options=Object.assign(Object.assign({},this.options),o),this.options.optionTags&&this.options.optionTags.length&&(this.options.optionTags=this.options.optionTags.slice()),this.options.routeSet&&this.options.routeSet.length&&(this.options.routeSet=this.options.routeSet.slice())),a&&a.length&&(this.extraHeaders=a.slice()),s&&(this.body={body:s.content,contentType:s.contentType}),this.method=e,this.ruri=n.clone(),this.fromURI=r.clone(),this.fromTag=this.options.fromTag?this.options.fromTag:ZA(),this.from=Ys.makeNameAddrHeader(this.fromURI,this.options.fromDisplayName,this.fromTag),this.toURI=i.clone(),this.toTag=this.options.toTag,this.to=Ys.makeNameAddrHeader(this.toURI,this.options.toDisplayName,this.toTag),this.callId=this.options.callId?this.options.callId:this.options.callIdPrefix+zi(15),this.cseq=this.options.cseq,this.setHeader("route",this.options.routeSet),this.setHeader("via",""),this.setHeader("to",this.to.toString()),this.setHeader("from",this.from.toString()),this.setHeader("cseq",this.cseq+" "+this.method),this.setHeader("call-id",this.callId),this.setHeader("max-forwards","70")}static getDefaultOptions(){return{callId:"",callIdPrefix:"",cseq:1,toDisplayName:"",toTag:"",fromDisplayName:"",fromTag:"",forceRport:!1,hackViaTcp:!1,optionTags:["outbound"],routeSet:[],userAgentString:"sip.js",viaHost:""}}static makeNameAddrHeader(e,n,r){const i={};return r&&(i.tag=r),new $n(e,n,i)}getHeader(e){const n=this.headers[Kr(e)];if(n){if(n[0])return n[0]}else{const r=new RegExp("^\\s*"+e+"\\s*:","i");for(const i of this.extraHeaders)if(r.test(i))return i.substring(i.indexOf(":")+1).trim()}}getHeaders(e){const n=[],r=this.headers[Kr(e)];if(r)for(const i of r)n.push(i);else{const i=new RegExp("^\\s*"+e+"\\s*:","i");for(const o of this.extraHeaders)i.test(o)&&n.push(o.substring(o.indexOf(":")+1).trim())}return n}hasHeader(e){if(this.headers[Kr(e)])return!0;{const n=new RegExp("^\\s*"+e+"\\s*:","i");for(const r of this.extraHeaders)if(n.test(r))return!0}return!1}setHeader(e,n){this.headers[Kr(e)]=n instanceof Array?n:[n]}setViaHeader(e,n){this.options.hackViaTcp&&(n="TCP");let r="SIP/2.0/"+n;r+=" "+this.options.viaHost+";branch="+e,this.options.forceRport&&(r+=";rport"),this.setHeader("via",r),this.branch=e}toString(){let e="";e+=this.method+" "+this.ruri.toRaw()+` SIP/2.0\r
101
101
  `;for(const n in this.headers)if(this.headers[n])for(const r of this.headers[n])e+=n+": "+r+`\r
102
102
  `;for(const n of this.extraHeaders)e+=n.trim()+`\r
103
103
  `;return e+="Supported: "+this.options.optionTags.join(", ")+`\r
@@ -111,7 +111,7 @@ React keys must be passed directly to JSX without using spread:
111
111
  \r
112
112
  `:e+=`Content-Length: 0\r
113
113
  \r
114
- `,e}};function g0(t){return t==="application/sdp"?"session":"render"}function lA(t){const e=typeof t=="string"?t:t.body,n=typeof t=="string"?"application/sdp":t.contentType;return{contentDisposition:g0(n),contentType:n,content:e}}function h0(t){return!(!t||typeof t.content!="string"||typeof t.contentType!="string"||t.contentDisposition!==void 0)||typeof t.contentDisposition=="string"}function Ea(t){let e,n,r;if(t instanceof Bo&&t.body){const i=t.parseHeader("Content-Disposition");e=i?i.type:void 0,n=t.parseHeader("Content-Type"),r=t.body}if(t instanceof Fi&&t.body){const i=t.parseHeader("Content-Disposition");e=i?i.type:void 0,n=t.parseHeader("Content-Type"),r=t.body}if(t instanceof qd&&t.body)if(e=t.getHeader("Content-Disposition"),n=t.getHeader("Content-Type"),typeof t.body=="string"){if(!n)throw new Error("Header content type header does not equal body content type.");r=t.body}else{if(n&&n!==t.body.contentType)throw new Error("Header content type header does not equal body content type.");n=t.body.contentType,r=t.body.body}if(h0(t)&&(e=t.contentDisposition,n=t.contentType,r=t.content),r){if(n&&!e&&(e=g0(n)),!e)throw new Error("Content disposition undefined.");if(!n)throw new Error("Content type undefined.");return{contentDisposition:e,contentType:n,content:r}}}var Sr,Pe;(function(t){t.Initial="Initial",t.Early="Early",t.AckWait="AckWait",t.Confirmed="Confirmed",t.Terminated="Terminated"})(Sr=Sr||(Sr={})),function(t){t.Initial="Initial",t.HaveLocalOffer="HaveLocalOffer",t.HaveRemoteOffer="HaveRemoteOffer",t.Stable="Stable",t.Closed="Closed"}(Pe=Pe||(Pe={}));const YS=500,Mn={T1:YS,T2:4e3,TIMER_B:32e3,TIMER_D:0,TIMER_F:32e3,TIMER_H:32e3,TIMER_I:0,TIMER_J:0,TIMER_K:0,TIMER_L:32e3,TIMER_M:32e3,TIMER_N:32e3,PROVISIONAL_RESPONSE_INTERVAL:6e4};let Ii=class extends uo{constructor(e){super(e||"Transaction state error.")}};var Ye;(function(t){t.ACK="ACK",t.BYE="BYE",t.CANCEL="CANCEL",t.INFO="INFO",t.INVITE="INVITE",t.MESSAGE="MESSAGE",t.NOTIFY="NOTIFY",t.OPTIONS="OPTIONS",t.REGISTER="REGISTER",t.UPDATE="UPDATE",t.SUBSCRIBE="SUBSCRIBE",t.PUBLISH="PUBLISH",t.REFER="REFER",t.PRACK="PRACK"})(Ye=Ye||(Ye={}));const Mi=[Ye.ACK,Ye.BYE,Ye.CANCEL,Ye.INFO,Ye.INVITE,Ye.MESSAGE,Ye.NOTIFY,Ye.OPTIONS,Ye.PRACK,Ye.REFER,Ye.REGISTER,Ye.SUBSCRIBE];let p0=class{constructor(e){this.incomingMessageRequest=e}get request(){return this.incomingMessageRequest.message}accept(e){return this.incomingMessageRequest.accept(e),Promise.resolve()}reject(e){return this.incomingMessageRequest.reject(e),Promise.resolve()}},$l=class{constructor(e){this.incomingNotifyRequest=e}get request(){return this.incomingNotifyRequest.message}accept(e){return this.incomingNotifyRequest.accept(e),Promise.resolve()}reject(e){return this.incomingNotifyRequest.reject(e),Promise.resolve()}},WS=class{constructor(e,n){this.incomingReferRequest=e,this.session=n}get referTo(){const e=this.incomingReferRequest.message.parseHeader("refer-to");if(!(e instanceof $n))throw new Error("Failed to parse Refer-To header.");return e}get referredBy(){return this.incomingReferRequest.message.getHeader("referred-by")}get replaces(){const e=this.referTo.uri.getHeader("replaces");return e instanceof Array?e[0]:e}get request(){return this.incomingReferRequest.message}accept(e={statusCode:202}){return this.incomingReferRequest.accept(e),Promise.resolve()}reject(e){return this.incomingReferRequest.reject(e),Promise.resolve()}makeInviter(e){if(this.inviter)return this.inviter;const n=this.referTo.uri.clone();n.clearHeaders();const r=((e=e||{}).extraHeaders||[]).slice(),i=this.replaces;i&&r.push("Replaces: "+decodeURIComponent(i));const o=this.referredBy;return o&&r.push("Referred-By: "+o),e.extraHeaders=r,this.inviter=this.session.userAgent._makeInviter(n,e),this.inviter._referred=this.session,this.session._referral=this.inviter,this.inviter}};var he,Nr;(function(t){t.Initial="Initial",t.Establishing="Establishing",t.Established="Established",t.Terminating="Terminating",t.Terminated="Terminated"})(he=he||(he={}));let Xl=class m0{constructor(e,n={}){this.pendingReinvite=!1,this.pendingReinviteAck=!1,this._state=he.Initial,this.delegate=n.delegate,this._stateEventEmitter=new Pa,this._userAgent=e}dispose(){switch(this.logger.log(`Session ${this.id} in state ${this._state} is being disposed`),delete this.userAgent._sessions[this.id],this._sessionDescriptionHandler&&this._sessionDescriptionHandler.close(),this.state){case he.Initial:case he.Establishing:break;case he.Established:return new Promise(e=>{this._bye({onAccept:()=>e(),onRedirect:()=>e(),onReject:()=>e()})});case he.Terminating:case he.Terminated:break;default:throw new Error("Unknown state.")}return Promise.resolve()}get assertedIdentity(){return this._assertedIdentity}get dialog(){return this._dialog}get id(){return this._id}get replacee(){return this._replacee}get sessionDescriptionHandler(){return this._sessionDescriptionHandler}get sessionDescriptionHandlerFactory(){return this.userAgent.configuration.sessionDescriptionHandlerFactory}get sessionDescriptionHandlerModifiers(){return this._sessionDescriptionHandlerModifiers||[]}set sessionDescriptionHandlerModifiers(e){this._sessionDescriptionHandlerModifiers=e.slice()}get sessionDescriptionHandlerOptions(){return this._sessionDescriptionHandlerOptions||{}}set sessionDescriptionHandlerOptions(e){this._sessionDescriptionHandlerOptions=Object.assign({},e)}get sessionDescriptionHandlerModifiersReInvite(){return this._sessionDescriptionHandlerModifiersReInvite||[]}set sessionDescriptionHandlerModifiersReInvite(e){this._sessionDescriptionHandlerModifiersReInvite=e.slice()}get sessionDescriptionHandlerOptionsReInvite(){return this._sessionDescriptionHandlerOptionsReInvite||{}}set sessionDescriptionHandlerOptionsReInvite(e){this._sessionDescriptionHandlerOptionsReInvite=Object.assign({},e)}get state(){return this._state}get stateChange(){return this._stateEventEmitter}get userAgent(){return this._userAgent}bye(e={}){let n="Session.bye() may only be called if established session.";switch(this.state){case he.Initial:typeof this.cancel=="function"?(n+=" However Inviter.invite() has not yet been called.",n+=" Perhaps you should have called Inviter.cancel()?"):typeof this.reject=="function"&&(n+=" However Invitation.accept() has not yet been called.",n+=" Perhaps you should have called Invitation.reject()?");break;case he.Establishing:typeof this.cancel=="function"?(n+=" However a dialog does not yet exist.",n+=" Perhaps you should have called Inviter.cancel()?"):typeof this.reject=="function"&&(n+=" However Invitation.accept() has not yet been called (or not yet resolved).",n+=" Perhaps you should have called Invitation.reject()?");break;case he.Established:{const r=e.requestDelegate,i=this.copyRequestOptions(e.requestOptions);return this._bye(r,i)}case he.Terminating:n+=" However this session is already terminating.",typeof this.cancel=="function"?n+=" Perhaps you have already called Inviter.cancel()?":typeof this.reject=="function"&&(n+=" Perhaps you have already called Session.bye()?");break;case he.Terminated:n+=" However this session is already terminated.";break;default:throw new Error("Unknown state")}return this.logger.error(n),Promise.reject(new Error(`Invalid session state ${this.state}`))}info(e={}){if(this.state!==he.Established)return this.logger.error("Session.info() may only be called if established session."),Promise.reject(new Error(`Invalid session state ${this.state}`));const n=e.requestDelegate,r=this.copyRequestOptions(e.requestOptions);return this._info(n,r)}invite(e={}){if(this.logger.log("Session.invite"),this.state!==he.Established)return Promise.reject(new Error(`Invalid session state ${this.state}`));if(this.pendingReinvite)return Promise.reject(new _l("Reinvite in progress. Please wait until complete, then try again."));this.pendingReinvite=!0,e.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiersReInvite=e.sessionDescriptionHandlerModifiers),e.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptionsReInvite=e.sessionDescriptionHandlerOptions);const n={onAccept:o=>{const a=Ea(o.message);if(!a)return this.logger.error("Received 2xx response to re-INVITE without a session description"),this.ackAndBye(o,400,"Missing session description"),this.stateTransition(he.Terminated),void(this.pendingReinvite=!1);if(e.withoutSdp){const s={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};this.setOfferAndGetAnswer(a,s).then(A=>{o.ack({body:A})}).catch(A=>{this.logger.error("Failed to handle offer in 2xx response to re-INVITE"),this.logger.error(A.message),this.state===he.Terminated?o.ack():(this.ackAndBye(o,488,"Bad Media Description"),this.stateTransition(he.Terminated))}).then(()=>{this.pendingReinvite=!1,e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(o)})}else{const s={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};this.setAnswer(a,s).then(()=>{o.ack()}).catch(A=>{this.logger.error("Failed to handle answer in 2xx response to re-INVITE"),this.logger.error(A.message),this.state!==he.Terminated?(this.ackAndBye(o,488,"Bad Media Description"),this.stateTransition(he.Terminated)):o.ack()}).then(()=>{this.pendingReinvite=!1,e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(o)})}},onProgress:o=>{},onRedirect:o=>{},onReject:o=>{this.logger.warn("Received a non-2xx response to re-INVITE"),this.pendingReinvite=!1,e.withoutSdp?e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(o):this.rollbackOffer().catch(a=>{if(this.logger.error("Failed to rollback offer on non-2xx response to re-INVITE"),this.logger.error(a.message),this.state!==he.Terminated){if(!this.dialog)throw new Error("Dialog undefined.");const s=[];s.push("Reason: "+this.getReasonHeaderValue(500,"Internal Server Error")),this.dialog.bye(void 0,{extraHeaders:s}),this.stateTransition(he.Terminated)}}).then(()=>{e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(o)})},onTrying:o=>{}},r=e.requestOptions||{};if(r.extraHeaders=(r.extraHeaders||[]).slice(),r.extraHeaders.push("Allow: "+Mi.toString()),r.extraHeaders.push("Contact: "+this._contact),e.withoutSdp){if(!this.dialog)throw this.pendingReinvite=!1,new Error("Dialog undefined.");return Promise.resolve(this.dialog.invite(n,r))}const i={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};return this.getOffer(i).then(o=>{if(!this.dialog)throw this.pendingReinvite=!1,new Error("Dialog undefined.");return r.body=o,this.dialog.invite(n,r)}).catch(o=>{throw this.logger.error(o.message),this.logger.error("Failed to send re-INVITE"),this.pendingReinvite=!1,o})}message(e={}){if(this.state!==he.Established)return this.logger.error("Session.message() may only be called if established session."),Promise.reject(new Error(`Invalid session state ${this.state}`));const n=e.requestDelegate,r=this.copyRequestOptions(e.requestOptions);return this._message(n,r)}refer(e,n={}){if(this.state!==he.Established)return this.logger.error("Session.refer() may only be called if established session."),Promise.reject(new Error(`Invalid session state ${this.state}`));if(e instanceof m0&&!e.dialog)return this.logger.error("Session.refer() may only be called with session which is established. You are perhaps attempting to attended transfer to a target for which there is not dialog yet established. Perhaps you are attempting a 'semi-attended' tansfer? Regardless, this is not supported. The recommended approached is to check to see if the target Session is in the Established state before calling refer(); if the state is not Established you may proceed by falling back using a URI as the target (blind transfer)."),Promise.reject(new Error(`Invalid session state ${this.state}`));const r=n.requestDelegate,i=this.copyRequestOptions(n.requestOptions);return i.extraHeaders=i.extraHeaders?i.extraHeaders.concat(this.referExtraHeaders(this.referToString(e))):this.referExtraHeaders(this.referToString(e)),this._refer(n.onNotify,r,i)}_bye(e,n){if(!this.dialog)return Promise.reject(new Error("Session dialog undefined."));const r=this.dialog;switch(r.sessionState){case Sr.Initial:case Sr.Early:throw new Error(`Invalid dialog state ${r.sessionState}`);case Sr.AckWait:return this.stateTransition(he.Terminating),new Promise(i=>{r.delegate={onAck:()=>{const o=r.bye(e,n);return this.stateTransition(he.Terminated),i(o),Promise.resolve()},onAckTimeout:()=>{const o=r.bye(e,n);this.stateTransition(he.Terminated),i(o)}}});case Sr.Confirmed:{const i=r.bye(e,n);return this.stateTransition(he.Terminated),Promise.resolve(i)}case Sr.Terminated:throw new Error(`Invalid dialog state ${r.sessionState}`);default:throw new Error("Unrecognized state.")}}_info(e,n){return this.dialog?Promise.resolve(this.dialog.info(e,n)):Promise.reject(new Error("Session dialog undefined."))}_message(e,n){return this.dialog?Promise.resolve(this.dialog.message(e,n)):Promise.reject(new Error("Session dialog undefined."))}_refer(e,n,r){return this.dialog?(this.onNotify=e,Promise.resolve(this.dialog.refer(n,r))):Promise.reject(new Error("Session dialog undefined."))}ackAndBye(e,n,r){e.ack();const i=[];n&&i.push("Reason: "+this.getReasonHeaderValue(n,r)),e.session.bye(void 0,{extraHeaders:i})}onAckRequest(e){if(this.logger.log("Session.onAckRequest"),this.state!==he.Established&&this.state!==he.Terminating)return this.logger.error(`ACK received while in state ${this.state}, dropping request`),Promise.resolve();const n=this.dialog;if(!n)throw new Error("Dialog undefined.");const r={sessionDescriptionHandlerOptions:this.pendingReinviteAck?this.sessionDescriptionHandlerOptionsReInvite:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.pendingReinviteAck?this._sessionDescriptionHandlerModifiersReInvite:this._sessionDescriptionHandlerModifiers};if(this.delegate&&this.delegate.onAck){const i=new GS(e);this.delegate.onAck(i)}switch(this.pendingReinviteAck=!1,n.signalingState){case Pe.Initial:{this.logger.error(`Invalid signaling state ${n.signalingState}.`);const i=["Reason: "+this.getReasonHeaderValue(488,"Bad Media Description")];return n.bye(void 0,{extraHeaders:i}),this.stateTransition(he.Terminated),Promise.resolve()}case Pe.Stable:{const i=Ea(e.message);return i?i.contentDisposition==="render"?(this._renderbody=i.content,this._rendertype=i.contentType,Promise.resolve()):i.contentDisposition!=="session"?Promise.resolve():this.setAnswer(i,r).catch(o=>{this.logger.error(o.message);const a=["Reason: "+this.getReasonHeaderValue(488,"Bad Media Description")];n.bye(void 0,{extraHeaders:a}),this.stateTransition(he.Terminated)}):Promise.resolve()}case Pe.HaveLocalOffer:{this.logger.error(`Invalid signaling state ${n.signalingState}.`);const i=["Reason: "+this.getReasonHeaderValue(488,"Bad Media Description")];return n.bye(void 0,{extraHeaders:i}),this.stateTransition(he.Terminated),Promise.resolve()}case Pe.HaveRemoteOffer:{this.logger.error(`Invalid signaling state ${n.signalingState}.`);const i=["Reason: "+this.getReasonHeaderValue(488,"Bad Media Description")];return n.bye(void 0,{extraHeaders:i}),this.stateTransition(he.Terminated),Promise.resolve()}case Pe.Closed:default:throw new Error(`Invalid signaling state ${n.signalingState}.`)}}onByeRequest(e){if(this.logger.log("Session.onByeRequest"),this.state===he.Established){if(this.delegate&&this.delegate.onBye){const n=new qS(e);this.delegate.onBye(n)}else e.accept();this.stateTransition(he.Terminated)}else this.logger.error(`BYE received while in state ${this.state}, dropping request`)}onInfoRequest(e){if(this.logger.log("Session.onInfoRequest"),this.state===he.Established)if(this.delegate&&this.delegate.onInfo){const n=new KS(e);this.delegate.onInfo(n)}else e.accept();else this.logger.error(`INFO received while in state ${this.state}, dropping request`)}onInviteRequest(e){if(this.logger.log("Session.onInviteRequest"),this.state!==he.Established)return void this.logger.error(`INVITE received while in state ${this.state}, dropping request`);this.pendingReinviteAck=!0;const n=["Contact: "+this._contact];if(e.message.hasHeader("P-Asserted-Identity")){const i=e.message.getHeader("P-Asserted-Identity");if(!i)throw new Error("Header undefined.");this._assertedIdentity=En.nameAddrHeaderParse(i)}const r={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};this.generateResponseOfferAnswerInDialog(r).then(i=>{const o=e.accept({statusCode:200,extraHeaders:n,body:i});this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(e.message,o.message,200)}).catch(i=>{if(this.logger.error(i.message),this.logger.error("Failed to handle to re-INVITE request"),!this.dialog)throw new Error("Dialog undefined.");if(this.logger.error(this.dialog.signalingState),this.dialog.signalingState===Pe.Stable){const o=e.reject({statusCode:488});return void(this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(e.message,o.message,488))}this.rollbackOffer().then(()=>{const o=e.reject({statusCode:488});this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(e.message,o.message,488)}).catch(o=>{this.logger.error(o.message),this.logger.error("Failed to rollback offer on re-INVITE request");const a=e.reject({statusCode:488});if(this.state!==he.Terminated){if(!this.dialog)throw new Error("Dialog undefined.");const s=[];s.push("Reason: "+this.getReasonHeaderValue(500,"Internal Server Error")),this.dialog.bye(void 0,{extraHeaders:s}),this.stateTransition(he.Terminated)}this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(e.message,a.message,488)})})}onMessageRequest(e){if(this.logger.log("Session.onMessageRequest"),this.state===he.Established)if(this.delegate&&this.delegate.onMessage){const n=new p0(e);this.delegate.onMessage(n)}else e.accept();else this.logger.error(`MESSAGE received while in state ${this.state}, dropping request`)}onNotifyRequest(e){if(this.logger.log("Session.onNotifyRequest"),this.state===he.Established){if(this.onNotify){const n=new $l(e);return void this.onNotify(n)}if(this.delegate&&this.delegate.onNotify){const n=new $l(e);this.delegate.onNotify(n)}else e.accept()}else this.logger.error(`NOTIFY received while in state ${this.state}, dropping request`)}onPrackRequest(e){if(this.logger.log("Session.onPrackRequest"),this.state===he.Established)throw new Error("Unimplemented.");this.logger.error(`PRACK received while in state ${this.state}, dropping request`)}onReferRequest(e){if(this.logger.log("Session.onReferRequest"),this.state!==he.Established)return void this.logger.error(`REFER received while in state ${this.state}, dropping request`);if(!e.message.hasHeader("refer-to"))return this.logger.warn("Invalid REFER packet. A refer-to header is required. Rejecting."),void e.reject();const n=new WS(e,this);this.delegate&&this.delegate.onRefer?this.delegate.onRefer(n):(this.logger.log("No delegate available to handle REFER, automatically accepting and following."),n.accept().then(()=>n.makeInviter(this._referralInviterOptions).invite()).catch(r=>{this.logger.error(r.message)}))}generateResponseOfferAnswer(e,n){if(this.dialog)return this.generateResponseOfferAnswerInDialog(n);const r=Ea(e.message);return r&&r.contentDisposition==="session"?this.setOfferAndGetAnswer(r,n):this.getOffer(n)}generateResponseOfferAnswerInDialog(e){if(!this.dialog)throw new Error("Dialog undefined.");switch(this.dialog.signalingState){case Pe.Initial:return this.getOffer(e);case Pe.HaveLocalOffer:return Promise.resolve(void 0);case Pe.HaveRemoteOffer:if(!this.dialog.offer)throw new Error(`Session offer undefined in signaling state ${this.dialog.signalingState}.`);return this.setOfferAndGetAnswer(this.dialog.offer,e);case Pe.Stable:return this.state!==he.Established?Promise.resolve(void 0):this.getOffer(e);case Pe.Closed:default:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`)}}getOffer(e){const n=this.setupSessionDescriptionHandler(),r=e.sessionDescriptionHandlerOptions,i=e.sessionDescriptionHandlerModifiers;try{return n.getDescription(r,i).then(o=>lA(o)).catch(o=>{this.logger.error("Session.getOffer: SDH getDescription rejected...");const a=o instanceof Error?o:new Error("Session.getOffer unknown error.");throw this.logger.error(a.message),a})}catch(o){this.logger.error("Session.getOffer: SDH getDescription threw...");const a=o instanceof Error?o:new Error(o);return this.logger.error(a.message),Promise.reject(a)}}rollbackOffer(){const e=this.setupSessionDescriptionHandler();if(e.rollbackDescription===void 0)return Promise.resolve();try{return e.rollbackDescription().catch(n=>{this.logger.error("Session.rollbackOffer: SDH rollbackDescription rejected...");const r=n instanceof Error?n:new Error("Session.rollbackOffer unknown error.");throw this.logger.error(r.message),r})}catch(n){this.logger.error("Session.rollbackOffer: SDH rollbackDescription threw...");const r=n instanceof Error?n:new Error(n);return this.logger.error(r.message),Promise.reject(r)}}setAnswer(e,n){const r=this.setupSessionDescriptionHandler(),i=n.sessionDescriptionHandlerOptions,o=n.sessionDescriptionHandlerModifiers;try{if(!r.hasDescription(e.contentType))return Promise.reject(new Jl)}catch(a){this.logger.error("Session.setAnswer: SDH hasDescription threw...");const s=a instanceof Error?a:new Error(a);return this.logger.error(s.message),Promise.reject(s)}try{return r.setDescription(e.content,i,o).catch(a=>{this.logger.error("Session.setAnswer: SDH setDescription rejected...");const s=a instanceof Error?a:new Error("Session.setAnswer unknown error.");throw this.logger.error(s.message),s})}catch(a){this.logger.error("Session.setAnswer: SDH setDescription threw...");const s=a instanceof Error?a:new Error(a);return this.logger.error(s.message),Promise.reject(s)}}setOfferAndGetAnswer(e,n){const r=this.setupSessionDescriptionHandler(),i=n.sessionDescriptionHandlerOptions,o=n.sessionDescriptionHandlerModifiers;try{if(!r.hasDescription(e.contentType))return Promise.reject(new Jl)}catch(a){this.logger.error("Session.setOfferAndGetAnswer: SDH hasDescription threw...");const s=a instanceof Error?a:new Error(a);return this.logger.error(s.message),Promise.reject(s)}try{return r.setDescription(e.content,i,o).then(()=>r.getDescription(i,o)).then(a=>lA(a)).catch(a=>{this.logger.error("Session.setOfferAndGetAnswer: SDH setDescription or getDescription rejected...");const s=a instanceof Error?a:new Error("Session.setOfferAndGetAnswer unknown error.");throw this.logger.error(s.message),s})}catch(a){this.logger.error("Session.setOfferAndGetAnswer: SDH setDescription or getDescription threw...");const s=a instanceof Error?a:new Error(a);return this.logger.error(s.message),Promise.reject(s)}}setSessionDescriptionHandler(e){if(this._sessionDescriptionHandler)throw new Error("Session description handler defined.");this._sessionDescriptionHandler=e}setupSessionDescriptionHandler(){var e;return this._sessionDescriptionHandler||(this._sessionDescriptionHandler=this.sessionDescriptionHandlerFactory(this,this.userAgent.configuration.sessionDescriptionHandlerFactoryOptions),!((e=this.delegate)===null||e===void 0)&&e.onSessionDescriptionHandler&&this.delegate.onSessionDescriptionHandler(this._sessionDescriptionHandler,!1)),this._sessionDescriptionHandler}stateTransition(e){const n=()=>{throw new Error(`Invalid state transition from ${this._state} to ${e}`)};switch(this._state){case he.Initial:e!==he.Establishing&&e!==he.Established&&e!==he.Terminating&&e!==he.Terminated&&n();break;case he.Establishing:e!==he.Established&&e!==he.Terminating&&e!==he.Terminated&&n();break;case he.Established:e!==he.Terminating&&e!==he.Terminated&&n();break;case he.Terminating:e!==he.Terminated&&n();break;case he.Terminated:n();break;default:throw new Error("Unrecognized state.")}this._state=e,this.logger.log(`Session ${this.id} transitioned to state ${this._state}`),this._stateEventEmitter.emit(this._state),e===he.Terminated&&this.dispose()}copyRequestOptions(e={}){return{extraHeaders:e.extraHeaders?e.extraHeaders.slice():void 0,body:e.body?{contentDisposition:e.body.contentDisposition||"render",contentType:e.body.contentType||"text/plain",content:e.body.content||""}:void 0}}getReasonHeaderValue(e,n){const r=e;let i=qA(e);return!i&&n&&(i=n),"SIP;cause="+r+';text="'+i+'"'}referExtraHeaders(e){const n=[];return n.push("Referred-By: <"+this.userAgent.configuration.uri+">"),n.push("Contact: "+this._contact),n.push("Allow: "+["ACK","CANCEL","INVITE","MESSAGE","BYE","OPTIONS","INFO","NOTIFY","REFER"].toString()),n.push("Refer-To: "+e),n}referToString(e){let n;if(e instanceof Ni)n=e.toString();else{if(!e.dialog)throw new Error("Dialog undefined.");const r=e.remoteIdentity.friendlyName,i=e.dialog.remoteTarget.toString(),o=e.dialog.callId,a=e.dialog.remoteTag,s=e.dialog.localTag;n=`"${r}" <${i}?Replaces=${encodeURIComponent(`${o};to-tag=${a};from-tag=${s}`)}>`}return n}};(function(t){t.Required="Required",t.Supported="Supported",t.Unsupported="Unsupported"})(Nr=Nr||(Nr={}));const JS={"100rel":!0,199:!0,answermode:!0,"early-session":!0,eventlist:!0,explicitsub:!0,"from-change":!0,"geolocation-http":!0,"geolocation-sip":!0,gin:!0,gruu:!0,histinfo:!0,ice:!0,join:!0,"multiple-refer":!0,norefersub:!0,nosub:!0,outbound:!0,path:!0,policy:!0,precondition:!0,pref:!0,privacy:!0,"recipient-list-invite":!0,"recipient-list-message":!0,"recipient-list-subscribe":!0,replaces:!0,"resource-priority":!0,"sdp-anat":!0,"sec-agree":!0,tdialog:!0,timer:!0,uui:!0};let eu=class extends Xl{constructor(e,n){super(e),this.incomingInviteRequest=n,this.disposed=!1,this.expiresTimer=void 0,this.isCanceled=!1,this.rel100="none",this.rseq=Math.floor(1e4*Math.random()),this.userNoAnswerTimer=void 0,this.waitingForPrack=!1,this.logger=e.getLogger("sip.Invitation");const r=this.incomingInviteRequest.message,i=r.getHeader("require");i&&i.toLowerCase().includes("100rel")&&(this.rel100="required");const o=r.getHeader("supported");if(o&&o.toLowerCase().includes("100rel")&&(this.rel100="supported"),r.toTag=n.toTag,typeof r.toTag!="string")throw new TypeError("toTag should have been a string.");if(this.userNoAnswerTimer=setTimeout(()=>{n.reject({statusCode:480}),this.stateTransition(he.Terminated)},this.userAgent.configuration.noAnswerTimeout?1e3*this.userAgent.configuration.noAnswerTimeout:6e4),r.hasHeader("expires")){const A=1e3*Number(r.getHeader("expires")||0);this.expiresTimer=setTimeout(()=>{this.state===he.Initial&&(n.reject({statusCode:487}),this.stateTransition(he.Terminated))},A)}const a=this.request.getHeader("P-Asserted-Identity");a&&(this._assertedIdentity=En.nameAddrHeaderParse(a)),this._contact=this.userAgent.contact.toString();const s=r.parseHeader("Content-Disposition");s&&s.type==="render"&&(this._renderbody=r.body,this._rendertype=r.getHeader("Content-Type")),this._id=r.callId+r.fromTag,this.userAgent._sessions[this._id]=this}dispose(){if(this.disposed)return Promise.resolve();switch(this.disposed=!0,this.expiresTimer&&(clearTimeout(this.expiresTimer),this.expiresTimer=void 0),this.userNoAnswerTimer&&(clearTimeout(this.userNoAnswerTimer),this.userNoAnswerTimer=void 0),this.prackNeverArrived(),this.state){case he.Initial:case he.Establishing:return this.reject().then(()=>super.dispose());case he.Established:case he.Terminating:case he.Terminated:return super.dispose();default:throw new Error("Unknown state.")}}get autoSendAnInitialProvisionalResponse(){return this.rel100!=="required"&&this.userAgent.configuration.sendInitialProvisionalResponse}get body(){return this.incomingInviteRequest.message.body}get localIdentity(){return this.request.to}get remoteIdentity(){return this.request.from}get request(){return this.incomingInviteRequest.message}accept(e={}){if(this.logger.log("Invitation.accept"),this.state!==he.Initial){const n=new Error(`Invalid session state ${this.state}`);return this.logger.error(n.message),Promise.reject(n)}return e.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=e.sessionDescriptionHandlerModifiers),e.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=e.sessionDescriptionHandlerOptions),this.stateTransition(he.Establishing),this.sendAccept(e).then(({message:n,session:r})=>{r.delegate={onAck:i=>this.onAckRequest(i),onAckTimeout:()=>this.onAckTimeout(),onBye:i=>this.onByeRequest(i),onInfo:i=>this.onInfoRequest(i),onInvite:i=>this.onInviteRequest(i),onMessage:i=>this.onMessageRequest(i),onNotify:i=>this.onNotifyRequest(i),onPrack:i=>this.onPrackRequest(i),onRefer:i=>this.onReferRequest(i)},this._dialog=r,this.stateTransition(he.Established),this._replacee&&this._replacee._bye()}).catch(n=>this.handleResponseError(n))}progress(e={}){if(this.logger.log("Invitation.progress"),this.state!==he.Initial){const r=new Error(`Invalid session state ${this.state}`);return this.logger.error(r.message),Promise.reject(r)}const n=e.statusCode||180;if(n<100||n>199)throw new TypeError("Invalid statusCode: "+n);return e.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=e.sessionDescriptionHandlerModifiers),e.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=e.sessionDescriptionHandlerOptions),this.waitingForPrack?(this.logger.warn("Unexpected call for progress while waiting for prack, ignoring"),Promise.resolve()):e.statusCode===100?this.sendProgressTrying().then(()=>{}).catch(r=>this.handleResponseError(r)):this.rel100==="required"||this.rel100==="supported"&&e.rel100||this.rel100==="supported"&&this.userAgent.configuration.sipExtension100rel===Nr.Required?this.sendProgressReliableWaitForPrack(e).then(()=>{}).catch(r=>this.handleResponseError(r)):this.sendProgress(e).then(()=>{}).catch(r=>this.handleResponseError(r))}reject(e={}){if(this.logger.log("Invitation.reject"),this.state!==he.Initial&&this.state!==he.Establishing){const a=new Error(`Invalid session state ${this.state}`);return this.logger.error(a.message),Promise.reject(a)}const n=e.statusCode||480,r=e.reasonPhrase?e.reasonPhrase:qA(n),i=e.extraHeaders||[];if(n<300||n>699)throw new TypeError("Invalid statusCode: "+n);const o=e.body?lA(e.body):void 0;return n<400?this.incomingInviteRequest.redirect([],{statusCode:n,reasonPhrase:r,extraHeaders:i,body:o}):this.incomingInviteRequest.reject({statusCode:n,reasonPhrase:r,extraHeaders:i,body:o}),this.stateTransition(he.Terminated),Promise.resolve()}_onCancel(e){if(this.logger.log("Invitation._onCancel"),this.state===he.Initial||this.state===he.Establishing){if(this.delegate&&this.delegate.onCancel){const n=new ZS(e);this.delegate.onCancel(n)}this.isCanceled=!0,this.incomingInviteRequest.reject({statusCode:487}),this.stateTransition(he.Terminated)}else this.logger.error(`CANCEL received while in state ${this.state}, dropping request`)}handlePrackOfferAnswer(e){if(!this.dialog)throw new Error("Dialog undefined.");const n=Ea(e.message);if(!n||n.contentDisposition!=="session")return Promise.resolve(void 0);const r={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers};switch(this.dialog.signalingState){case Pe.Initial:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`);case Pe.Stable:return this.setAnswer(n,r).then(()=>{});case Pe.HaveLocalOffer:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`);case Pe.HaveRemoteOffer:return this.setOfferAndGetAnswer(n,r);case Pe.Closed:default:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`)}}handleResponseError(e){let n=480;if(e instanceof Error?this.logger.error(e.message):this.logger.error(e),e instanceof Jl?(this.logger.error("A session description handler occurred while sending response (content type unsupported"),n=415):e instanceof HS?this.logger.error("A session description handler occurred while sending response"):e instanceof Gc?this.logger.error("Session ended before response could be formulated and sent (while waiting for PRACK)"):e instanceof Ii&&this.logger.error("Session changed state before response could be formulated and sent"),this.state===he.Initial||this.state===he.Establishing)try{this.incomingInviteRequest.reject({statusCode:n}),this.stateTransition(he.Terminated)}catch(r){throw this.logger.error("An error occurred attempting to reject the request while handling another error"),r}if(!this.isCanceled)throw e;this.logger.warn("An error occurred while attempting to formulate and send a response to an incoming INVITE. However a CANCEL was received and processed while doing so which can (and often does) result in errors occurring as the session terminates in the meantime. Said error is being ignored.")}onAckTimeout(){if(this.logger.log("Invitation.onAckTimeout"),!this.dialog)throw new Error("Dialog undefined.");this.logger.log("No ACK received for an extended period of time, terminating session"),this.dialog.bye(),this.stateTransition(he.Terminated)}sendAccept(e={}){const n={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers},r=e.extraHeaders||[];return this.waitingForPrack?this.waitForArrivalOfPrack().then(()=>clearTimeout(this.userNoAnswerTimer)).then(()=>this.generateResponseOfferAnswer(this.incomingInviteRequest,n)).then(i=>this.incomingInviteRequest.accept({statusCode:200,body:i,extraHeaders:r})):(clearTimeout(this.userNoAnswerTimer),this.generateResponseOfferAnswer(this.incomingInviteRequest,n).then(i=>this.incomingInviteRequest.accept({statusCode:200,body:i,extraHeaders:r})))}sendProgress(e={}){const n=e.statusCode||180,r=e.reasonPhrase,i=(e.extraHeaders||[]).slice(),o=e.body?lA(e.body):void 0;if(n===183&&!o)return this.sendProgressWithSDP(e);try{const a=this.incomingInviteRequest.progress({statusCode:n,reasonPhrase:r,extraHeaders:i,body:o});return this._dialog=a.session,Promise.resolve(a)}catch(a){return Promise.reject(a)}}sendProgressWithSDP(e={}){const n={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers},r=e.statusCode||183,i=e.reasonPhrase,o=(e.extraHeaders||[]).slice();return this.generateResponseOfferAnswer(this.incomingInviteRequest,n).then(a=>this.incomingInviteRequest.progress({statusCode:r,reasonPhrase:i,extraHeaders:o,body:a})).then(a=>(this._dialog=a.session,a))}sendProgressReliable(e={}){return e.extraHeaders=(e.extraHeaders||[]).slice(),e.extraHeaders.push("Require: 100rel"),e.extraHeaders.push("RSeq: "+Math.floor(1e4*Math.random())),this.sendProgressWithSDP(e)}sendProgressReliableWaitForPrack(e={}){const n={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers},r=e.statusCode||183,i=e.reasonPhrase,o=(e.extraHeaders||[]).slice();let a;return o.push("Require: 100rel"),o.push("RSeq: "+this.rseq++),new Promise((s,A)=>{this.waitingForPrack=!0,this.generateResponseOfferAnswer(this.incomingInviteRequest,n).then(c=>(a=c,this.incomingInviteRequest.progress({statusCode:r,reasonPhrase:i,extraHeaders:o,body:a}))).then(c=>{let u,d;this._dialog=c.session,c.session.delegate={onPrack:m=>{u=m,clearTimeout(f),clearTimeout(C),this.waitingForPrack&&(this.waitingForPrack=!1,this.handlePrackOfferAnswer(u).then(y=>{try{d=u.accept({statusCode:200,body:y}),this.prackArrived(),s({prackRequest:u,prackResponse:d,progressResponse:c})}catch(w){A(w)}}).catch(y=>A(y)))}};const f=setTimeout(()=>{this.waitingForPrack&&(this.waitingForPrack=!1,this.logger.warn("No PRACK received, rejecting INVITE."),clearTimeout(C),this.reject({statusCode:504}).then(()=>A(new Gc)).catch(m=>A(m)))},64*Mn.T1),p=()=>{try{this.incomingInviteRequest.progress({statusCode:r,reasonPhrase:i,extraHeaders:o,body:a})}catch(m){return this.waitingForPrack=!1,void A(m)}C=setTimeout(p,v*=2)};let v=Mn.T1,C=setTimeout(p,v)}).catch(c=>{this.waitingForPrack=!1,A(c)})})}sendProgressTrying(){try{const e=this.incomingInviteRequest.trying();return Promise.resolve(e)}catch(e){return Promise.reject(e)}}waitForArrivalOfPrack(){if(this.waitingForPrackPromise)throw new Error("Already waiting for PRACK");return this.waitingForPrackPromise=new Promise((e,n)=>{this.waitingForPrackResolve=e,this.waitingForPrackReject=n}),this.waitingForPrackPromise}prackArrived(){this.waitingForPrackResolve&&this.waitingForPrackResolve(),this.waitingForPrackPromise=void 0,this.waitingForPrackResolve=void 0,this.waitingForPrackReject=void 0}prackNeverArrived(){this.waitingForPrackReject&&this.waitingForPrackReject(new Gc),this.waitingForPrackPromise=void 0,this.waitingForPrackResolve=void 0,this.waitingForPrackReject=void 0}},v0=class extends Xl{constructor(e,n,r={}){super(e,r),this.disposed=!1,this.earlyMedia=!1,this.earlyMediaSessionDescriptionHandlers=new Map,this.isCanceled=!1,this.inviteWithoutSdp=!1,this.logger=e.getLogger("sip.Inviter"),this.earlyMedia=r.earlyMedia!==void 0?r.earlyMedia:this.earlyMedia,this.fromTag=ZA(),this.inviteWithoutSdp=r.inviteWithoutSdp!==void 0?r.inviteWithoutSdp:this.inviteWithoutSdp;const i=Object.assign({},r);i.params=Object.assign({},r.params);const o=r.anonymous||!1,a=e.contact.toString({anonymous:o,outbound:o?!e.contact.tempGruu:!e.contact.pubGruu});o&&e.configuration.uri&&(i.params.fromDisplayName="Anonymous",i.params.fromUri="sip:anonymous@anonymous.invalid");let s=e.userAgentCore.configuration.aor;if(i.params.fromUri&&(s=typeof i.params.fromUri=="string"?En.URIParse(i.params.fromUri):i.params.fromUri),!s)throw new TypeError("Invalid from URI: "+i.params.fromUri);let A=n;if(i.params.toUri&&(A=typeof i.params.toUri=="string"?En.URIParse(i.params.toUri):i.params.toUri),!A)throw new TypeError("Invalid to URI: "+i.params.toUri);const c=Object.assign({},i.params);c.fromTag=this.fromTag;const u=(i.extraHeaders||[]).slice();o&&e.configuration.uri&&(u.push("P-Preferred-Identity: "+e.configuration.uri.toString()),u.push("Privacy: id")),u.push("Contact: "+a),u.push("Allow: "+["ACK","CANCEL","INVITE","MESSAGE","BYE","OPTIONS","INFO","NOTIFY","REFER"].toString()),e.configuration.sipExtension100rel===Nr.Required&&u.push("Require: 100rel"),e.configuration.sipExtensionReplaces===Nr.Required&&u.push("Require: replaces"),i.extraHeaders=u,this.outgoingRequestMessage=e.userAgentCore.makeOutgoingRequestMessage(Ye.INVITE,n,s,A,c,u,void 0),this._contact=a,this._referralInviterOptions=i,this._renderbody=r.renderbody,this._rendertype=r.rendertype,r.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=r.sessionDescriptionHandlerModifiers),r.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=r.sessionDescriptionHandlerOptions),r.sessionDescriptionHandlerModifiersReInvite&&(this.sessionDescriptionHandlerModifiersReInvite=r.sessionDescriptionHandlerModifiersReInvite),r.sessionDescriptionHandlerOptionsReInvite&&(this.sessionDescriptionHandlerOptionsReInvite=r.sessionDescriptionHandlerOptionsReInvite),this._id=this.outgoingRequestMessage.callId+this.fromTag,this.userAgent._sessions[this._id]=this}dispose(){if(this.disposed)return Promise.resolve();switch(this.disposed=!0,this.disposeEarlyMedia(),this.state){case he.Initial:case he.Establishing:return this.cancel().then(()=>super.dispose());case he.Established:case he.Terminating:case he.Terminated:return super.dispose();default:throw new Error("Unknown state.")}}get body(){return this.outgoingRequestMessage.body}get localIdentity(){return this.outgoingRequestMessage.from}get remoteIdentity(){return this.outgoingRequestMessage.to}get request(){return this.outgoingRequestMessage}cancel(e={}){if(this.logger.log("Inviter.cancel"),this.state!==he.Initial&&this.state!==he.Establishing){const n=new Error(`Invalid session state ${this.state}`);return this.logger.error(n.message),Promise.reject(n)}if(this.isCanceled=!0,this.stateTransition(he.Terminating),this.outgoingInviteRequest){let n;e.statusCode&&e.reasonPhrase&&(n=function(r,i){if(r&&r<200||r>699)throw new TypeError("Invalid statusCode: "+r);if(r)return"SIP;cause="+r+';text="'+(qA(r)||i)+'"'}(e.statusCode,e.reasonPhrase)),this.outgoingInviteRequest.cancel(n,e)}else this.logger.warn("Canceled session before INVITE was sent"),this.stateTransition(he.Terminated);return Promise.resolve()}invite(e={}){if(this.logger.log("Inviter.invite"),this.state!==he.Initial)return super.invite(e);if(e.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=e.sessionDescriptionHandlerModifiers),e.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=e.sessionDescriptionHandlerOptions),e.withoutSdp||this.inviteWithoutSdp)return this._renderbody&&this._rendertype&&(this.outgoingRequestMessage.body={contentType:this._rendertype,body:this._renderbody}),this.stateTransition(he.Establishing),Promise.resolve(this.sendInvite(e));const n={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.getOffer(n).then(r=>(this.outgoingRequestMessage.body={body:r.content,contentType:r.contentType},this.stateTransition(he.Establishing),this.sendInvite(e))).catch(r=>{throw this.logger.log(r.message),this.state!==he.Terminated&&this.stateTransition(he.Terminated),r})}sendInvite(e={}){return this.outgoingInviteRequest=this.userAgent.userAgentCore.invite(this.outgoingRequestMessage,{onAccept:n=>this.dialog?(this.logger.log("Additional confirmed dialog, sending ACK and BYE"),void this.ackAndBye(n)):this.isCanceled?(this.logger.log("Canceled session accepted, sending ACK and BYE"),this.ackAndBye(n),void this.stateTransition(he.Terminated)):(this.notifyReferer(n),void this.onAccept(n).then(()=>{this.disposeEarlyMedia()}).catch(()=>{this.disposeEarlyMedia()}).then(()=>{e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(n)})),onProgress:n=>{this.isCanceled||(this.notifyReferer(n),this.onProgress(n).catch(()=>{this.disposeEarlyMedia()}).then(()=>{e.requestDelegate&&e.requestDelegate.onProgress&&e.requestDelegate.onProgress(n)}))},onRedirect:n=>{this.notifyReferer(n),this.onRedirect(n),e.requestDelegate&&e.requestDelegate.onRedirect&&e.requestDelegate.onRedirect(n)},onReject:n=>{this.notifyReferer(n),this.onReject(n),e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(n)},onTrying:n=>{this.notifyReferer(n),this.onTrying(n),e.requestDelegate&&e.requestDelegate.onTrying&&e.requestDelegate.onTrying(n)}}),this.outgoingInviteRequest}disposeEarlyMedia(){this.earlyMediaSessionDescriptionHandlers.forEach(e=>{e.close()}),this.earlyMediaSessionDescriptionHandlers.clear()}notifyReferer(e){if(!this._referred)return;if(!(this._referred instanceof Xl))throw new Error("Referred session not instance of session");if(!this._referred.dialog)return;if(!e.message.statusCode)throw new Error("Status code undefined.");if(!e.message.reasonPhrase)throw new Error("Reason phrase undefined.");const n=`SIP/2.0 ${e.message.statusCode} ${e.message.reasonPhrase}`.trim();this._referred.dialog.notify(void 0,{extraHeaders:["Event: refer","Subscription-State: terminated"],body:{contentDisposition:"render",contentType:"message/sipfrag",content:n}}).delegate={onReject:()=>{this._referred=void 0}}}onAccept(e){if(this.logger.log("Inviter.onAccept"),this.state!==he.Establishing)return this.logger.error(`Accept received while in state ${this.state}, dropping response`),Promise.reject(new Error(`Invalid session state ${this.state}`));const n=e.message,r=e.session;switch(n.hasHeader("P-Asserted-Identity")&&(this._assertedIdentity=En.nameAddrHeaderParse(n.getHeader("P-Asserted-Identity"))),r.delegate={onAck:i=>this.onAckRequest(i),onBye:i=>this.onByeRequest(i),onInfo:i=>this.onInfoRequest(i),onInvite:i=>this.onInviteRequest(i),onMessage:i=>this.onMessageRequest(i),onNotify:i=>this.onNotifyRequest(i),onPrack:i=>this.onPrackRequest(i),onRefer:i=>this.onReferRequest(i)},this._dialog=r,r.signalingState){case Pe.Initial:case Pe.HaveLocalOffer:return this.logger.error("Received 2xx response to INVITE without a session description"),this.ackAndBye(e,400,"Missing session description"),this.stateTransition(he.Terminated),Promise.reject(new Error("Bad Media Description"));case Pe.HaveRemoteOffer:{if(!this._dialog.offer)throw new Error(`Session offer undefined in signaling state ${this._dialog.signalingState}.`);const i={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.setOfferAndGetAnswer(this._dialog.offer,i).then(o=>{e.ack({body:o}),this.stateTransition(he.Established)}).catch(o=>{throw this.ackAndBye(e,488,"Invalid session description"),this.stateTransition(he.Terminated),o})}case Pe.Stable:{if(this.earlyMediaSessionDescriptionHandlers.size>0){const a=this.earlyMediaSessionDescriptionHandlers.get(r.id);if(!a)throw new Error("Session description handler undefined.");return this.setSessionDescriptionHandler(a),this.earlyMediaSessionDescriptionHandlers.delete(r.id),e.ack(),this.stateTransition(he.Established),Promise.resolve()}if(this.earlyMediaDialog){if(this.earlyMediaDialog!==r){this.earlyMedia&&this.logger.error("You have set the 'earlyMedia' option to 'true' which requires that your INVITE requests do not fork and yet this INVITE request did in fact fork. Consequentially and not surprisingly the end point which accepted the INVITE (confirmed dialog) does not match the end point with which early media has been setup (early dialog) and thus this session is unable to proceed. In accordance with the SIP specifications, the SIP servers your end point is connected to determine if an INVITE forks and the forking behavior of those servers cannot be controlled by this library. If you wish to use early media with this library you must configure those servers accordingly. Alternatively you may set the 'earlyMedia' to 'false' which will allow this library to function with any INVITE requests which do fork.");const a=new Error("Early media dialog does not equal confirmed dialog, terminating session");return this.logger.error(a.message),this.ackAndBye(e,488,"Not Acceptable Here"),this.stateTransition(he.Terminated),Promise.reject(a)}return e.ack(),this.stateTransition(he.Established),Promise.resolve()}const i=r.answer;if(!i)throw new Error("Answer is undefined.");const o={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.setAnswer(i,o).then(()=>{let a;this._renderbody&&this._rendertype&&(a={body:{contentDisposition:"render",contentType:this._rendertype,content:this._renderbody}}),e.ack(a),this.stateTransition(he.Established)}).catch(a=>{throw this.logger.error(a.message),this.ackAndBye(e,488,"Not Acceptable Here"),this.stateTransition(he.Terminated),a})}case Pe.Closed:return Promise.reject(new Error("Terminated."));default:throw new Error("Unknown session signaling state.")}}onProgress(e){var n;if(this.logger.log("Inviter.onProgress"),this.state!==he.Establishing)return this.logger.error(`Progress received while in state ${this.state}, dropping response`),Promise.reject(new Error(`Invalid session state ${this.state}`));if(!this.outgoingInviteRequest)throw new Error("Outgoing INVITE request undefined.");const r=e.message,i=e.session;r.hasHeader("P-Asserted-Identity")&&(this._assertedIdentity=En.nameAddrHeaderParse(r.getHeader("P-Asserted-Identity")));const o=r.getHeader("require"),a=r.getHeader("rseq"),s=!!(o&&o.includes("100rel")&&a&&Number(a)),A=[];switch(s&&A.push("RAck: "+r.getHeader("rseq")+" "+r.getHeader("cseq")),i.signalingState){case Pe.Initial:return s&&(this.logger.warn("First reliable provisional response received MUST contain an offer when INVITE does not contain an offer."),e.prack({extraHeaders:A})),Promise.resolve();case Pe.HaveLocalOffer:return s&&e.prack({extraHeaders:A}),Promise.resolve();case Pe.HaveRemoteOffer:if(!s)return this.logger.warn("Non-reliable provisional response MUST NOT contain an initial offer, discarding response."),Promise.resolve();{const c=this.sessionDescriptionHandlerFactory(this,this.userAgent.configuration.sessionDescriptionHandlerFactoryOptions||{});return!((n=this.delegate)===null||n===void 0)&&n.onSessionDescriptionHandler&&this.delegate.onSessionDescriptionHandler(c,!0),this.earlyMediaSessionDescriptionHandlers.set(i.id,c),c.setDescription(r.body,this.sessionDescriptionHandlerOptions,this.sessionDescriptionHandlerModifiers).then(()=>c.getDescription(this.sessionDescriptionHandlerOptions,this.sessionDescriptionHandlerModifiers)).then(u=>{const d={contentDisposition:"session",contentType:u.contentType,content:u.body};e.prack({extraHeaders:A,body:d})}).catch(u=>{throw this.stateTransition(he.Terminated),u})}case Pe.Stable:if(s&&e.prack({extraHeaders:A}),this.earlyMedia&&!this.earlyMediaDialog){this.earlyMediaDialog=i;const c=i.answer;if(!c)throw new Error("Answer is undefined.");const u={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.setAnswer(c,u).catch(d=>{throw this.stateTransition(he.Terminated),d})}return Promise.resolve();case Pe.Closed:return Promise.reject(new Error("Terminated."));default:throw new Error("Unknown session signaling state.")}}onRedirect(e){this.logger.log("Inviter.onRedirect"),this.state===he.Establishing||this.state===he.Terminating?this.stateTransition(he.Terminated):this.logger.error(`Redirect received while in state ${this.state}, dropping response`)}onReject(e){this.logger.log("Inviter.onReject"),this.state===he.Establishing||this.state===he.Terminating?this.stateTransition(he.Terminated):this.logger.error(`Reject received while in state ${this.state}, dropping response`)}onTrying(e){this.logger.log("Inviter.onTrying"),this.state===he.Establishing||this.logger.error(`Trying received while in state ${this.state}, dropping response`)}};var jt,Vt,dt,Dn,On,Ws,oe;(function(t){t.Initial="Initial",t.Registered="Registered",t.Unregistered="Unregistered",t.Terminated="Terminated"})(jt=jt||(jt={}));let tu=class Zi{constructor(e,n={}){this.disposed=!1,this._contacts=[],this._retryAfter=void 0,this._state=jt.Initial,this._waiting=!1,this._stateEventEmitter=new Pa,this._waitingEventEmitter=new Pa,this.userAgent=e;const r=e.configuration.uri.clone();if(r.user=void 0,this.options=Object.assign(Object.assign(Object.assign({},Zi.defaultOptions()),{registrar:r}),Zi.stripUndefinedProperties(n)),this.options.extraContactHeaderParams=(this.options.extraContactHeaderParams||[]).slice(),this.options.extraHeaders=(this.options.extraHeaders||[]).slice(),!this.options.registrar)throw new Error("Registrar undefined.");if(this.options.registrar=this.options.registrar.clone(),this.options.regId&&!this.options.instanceId?this.options.instanceId=this.userAgent.instanceId:!this.options.regId&&this.options.instanceId&&(this.options.regId=1),this.options.instanceId&&En.parse(this.options.instanceId,"uuid")===-1)throw new Error("Invalid instanceId.");if(this.options.regId&&this.options.regId<0)throw new Error("Invalid regId.");const i=this.options.registrar,o=this.options.params&&this.options.params.fromUri||e.userAgentCore.configuration.aor,a=this.options.params&&this.options.params.toUri||e.configuration.uri,s=this.options.params||{},A=(n.extraHeaders||[]).slice();if(this.request=e.userAgentCore.makeOutgoingRequestMessage(Ye.REGISTER,i,o,a,s,A,void 0),this.expires=this.options.expires||Zi.defaultExpires,this.expires<0)throw new Error("Invalid expires.");if(this.refreshFrequency=this.options.refreshFrequency||Zi.defaultRefreshFrequency,this.refreshFrequency<50||this.refreshFrequency>99)throw new Error("Invalid refresh frequency. The value represents a percentage of the expiration time and should be between 50 and 99.");this.logger=e.getLogger("sip.Registerer"),this.options.logConfiguration&&(this.logger.log("Configuration:"),Object.keys(this.options).forEach(c=>{const u=this.options[c];c==="registrar"?this.logger.log("· "+c+": "+u):this.logger.log("· "+c+": "+JSON.stringify(u))})),this.id=this.request.callId+this.request.from.parameters.tag,this.userAgent._registerers[this.id]=this}static defaultOptions(){return{expires:Zi.defaultExpires,extraContactHeaderParams:[],extraHeaders:[],logConfiguration:!0,instanceId:"",params:{},regId:0,registrar:new Ni("sip","anonymous","anonymous.invalid"),refreshFrequency:Zi.defaultRefreshFrequency}}static stripUndefinedProperties(e){return Object.keys(e).reduce((n,r)=>(e[r]!==void 0&&(n[r]=e[r]),n),{})}get contacts(){return this._contacts.slice()}get retryAfter(){return this._retryAfter}get state(){return this._state}get stateChange(){return this._stateEventEmitter}dispose(){return this.disposed?Promise.resolve():(this.disposed=!0,this.logger.log(`Registerer ${this.id} in state ${this.state} is being disposed`),delete this.userAgent._registerers[this.id],new Promise(e=>{const n=()=>{if(!this.waiting&&this._state===jt.Registered)return this.stateChange.addListener(()=>{this.terminated(),e()},{once:!0}),void this.unregister();this.terminated(),e()};this.waiting?this.waitingChange.addListener(()=>{n()},{once:!0}):n()}))}register(e={}){if(this.state===jt.Terminated)throw this.stateError(),new Error("Registerer terminated. Unable to register.");if(this.disposed)throw this.stateError(),new Error("Registerer disposed. Unable to register.");if(this.waiting){this.waitingWarning();const i=new _l("REGISTER request already in progress, waiting for final response");return Promise.reject(i)}e.requestOptions&&(this.options=Object.assign(Object.assign({},this.options),e.requestOptions));const n=(this.options.extraHeaders||[]).slice();n.push("Contact: "+this.generateContactHeader(this.expires)),n.push("Allow: "+["ACK","CANCEL","INVITE","MESSAGE","BYE","OPTIONS","INFO","NOTIFY","REFER"].toString()),this.request.cseq++,this.request.setHeader("cseq",this.request.cseq+" REGISTER"),this.request.extraHeaders=n,this.waitingToggle(!0);const r=this.userAgent.userAgentCore.register(this.request,{onAccept:i=>{let o;i.message.hasHeader("expires")&&(o=Number(i.message.getHeader("expires"))),this._contacts=i.message.getHeaders("contact");let a,s=this._contacts.length;if(!s)return this.logger.error("No Contact header in response to REGISTER, dropping response."),void this.unregistered();for(;s--;){if(a=i.message.parseHeader("contact",s),!a)throw new Error("Contact undefined");if(this.userAgent.contact.pubGruu&&Mg(a.uri,this.userAgent.contact.pubGruu)){o=Number(a.getParam("expires"));break}if(this.userAgent.configuration.contactName===""){if(a.uri.user===this.userAgent.contact.uri.user){o=Number(a.getParam("expires"));break}}else if(Mg(a.uri,this.userAgent.contact.uri)){o=Number(a.getParam("expires"));break}a=void 0}if(a===void 0)return this.logger.error("No Contact header pointing to us, dropping response"),this.unregistered(),void this.waitingToggle(!1);if(o===void 0)return this.logger.error("Contact pointing to us is missing expires parameter, dropping response"),this.unregistered(),void this.waitingToggle(!1);if(a.hasParam("temp-gruu")){const A=a.getParam("temp-gruu");A&&(this.userAgent.contact.tempGruu=En.URIParse(A.replace(/"/g,"")))}if(a.hasParam("pub-gruu")){const A=a.getParam("pub-gruu");A&&(this.userAgent.contact.pubGruu=En.URIParse(A.replace(/"/g,"")))}this.registered(o),e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(i),this.waitingToggle(!1)},onProgress:i=>{e.requestDelegate&&e.requestDelegate.onProgress&&e.requestDelegate.onProgress(i)},onRedirect:i=>{this.logger.error("Redirect received. Not supported."),this.unregistered(),e.requestDelegate&&e.requestDelegate.onRedirect&&e.requestDelegate.onRedirect(i),this.waitingToggle(!1)},onReject:i=>{if(i.message.statusCode===423)return i.message.hasHeader("min-expires")?(this.expires=Number(i.message.getHeader("min-expires")),this.waitingToggle(!1),void this.register()):(this.logger.error("423 response received for REGISTER without Min-Expires, dropping response"),this.unregistered(),void this.waitingToggle(!1));this.logger.warn(`Failed to register, status code ${i.message.statusCode}`);let o=NaN;if(i.message.statusCode===500||i.message.statusCode===503){const a=i.message.getHeader("retry-after");a&&(o=Number.parseInt(a,void 0))}this._retryAfter=isNaN(o)?void 0:o,this.unregistered(),e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(i),this._retryAfter=void 0,this.waitingToggle(!1)},onTrying:i=>{e.requestDelegate&&e.requestDelegate.onTrying&&e.requestDelegate.onTrying(i)}});return Promise.resolve(r)}unregister(e={}){if(this.state===jt.Terminated)throw this.stateError(),new Error("Registerer terminated. Unable to register.");if(this.disposed&&this.state!==jt.Registered)throw this.stateError(),new Error("Registerer disposed. Unable to register.");if(this.waiting){this.waitingWarning();const i=new _l("REGISTER request already in progress, waiting for final response");return Promise.reject(i)}this._state===jt.Registered||e.all||this.logger.warn("Not currently registered, but sending an unregister anyway.");const n=(e.requestOptions&&e.requestOptions.extraHeaders||[]).slice();this.request.extraHeaders=n,e.all?(n.push("Contact: *"),n.push("Expires: 0")):n.push("Contact: "+this.generateContactHeader(0)),this.request.cseq++,this.request.setHeader("cseq",this.request.cseq+" REGISTER"),this.registrationTimer!==void 0&&(clearTimeout(this.registrationTimer),this.registrationTimer=void 0),this.waitingToggle(!0);const r=this.userAgent.userAgentCore.register(this.request,{onAccept:i=>{this._contacts=i.message.getHeaders("contact"),this.unregistered(),e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(i),this.waitingToggle(!1)},onProgress:i=>{e.requestDelegate&&e.requestDelegate.onProgress&&e.requestDelegate.onProgress(i)},onRedirect:i=>{this.logger.error("Unregister redirected. Not currently supported."),this.unregistered(),e.requestDelegate&&e.requestDelegate.onRedirect&&e.requestDelegate.onRedirect(i),this.waitingToggle(!1)},onReject:i=>{this.logger.error(`Unregister rejected with status code ${i.message.statusCode}`),this.unregistered(),e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(i),this.waitingToggle(!1)},onTrying:i=>{e.requestDelegate&&e.requestDelegate.onTrying&&e.requestDelegate.onTrying(i)}});return Promise.resolve(r)}clearTimers(){this.registrationTimer!==void 0&&(clearTimeout(this.registrationTimer),this.registrationTimer=void 0),this.registrationExpiredTimer!==void 0&&(clearTimeout(this.registrationExpiredTimer),this.registrationExpiredTimer=void 0)}generateContactHeader(e){let n=this.userAgent.contact.toString({register:!0});return this.options.regId&&this.options.instanceId&&(n+=";reg-id="+this.options.regId,n+=';+sip.instance="<urn:uuid:'+this.options.instanceId+'>"'),this.options.extraContactHeaderParams&&this.options.extraContactHeaderParams.forEach(r=>{n+=";"+r}),n+=";expires="+e,n}registered(e){this.clearTimers(),this.registrationTimer=setTimeout(()=>{this.registrationTimer=void 0,this.register()},this.refreshFrequency/100*e*1e3),this.registrationExpiredTimer=setTimeout(()=>{this.logger.warn("Registration expired"),this.unregistered()},1e3*e),this._state!==jt.Registered&&this.stateTransition(jt.Registered)}unregistered(){this.clearTimers(),this._state!==jt.Unregistered&&this.stateTransition(jt.Unregistered)}terminated(){this.clearTimers(),this._state!==jt.Terminated&&this.stateTransition(jt.Terminated)}stateTransition(e){const n=()=>{throw new Error(`Invalid state transition from ${this._state} to ${e}`)};switch(this._state){case jt.Initial:e!==jt.Registered&&e!==jt.Unregistered&&e!==jt.Terminated&&n();break;case jt.Registered:e!==jt.Unregistered&&e!==jt.Terminated&&n();break;case jt.Unregistered:e!==jt.Registered&&e!==jt.Terminated&&n();break;case jt.Terminated:n();break;default:throw new Error("Unrecognized state.")}this._state=e,this.logger.log(`Registration transitioned to state ${this._state}`),this._stateEventEmitter.emit(this._state),e===jt.Terminated&&this.dispose()}get waiting(){return this._waiting}get waitingChange(){return this._waitingEventEmitter}waitingToggle(e){if(this._waiting===e)throw new Error(`Invalid waiting transition from ${this._waiting} to ${e}`);this._waiting=e,this.logger.log(`Waiting toggled to ${this._waiting}`),this._waitingEventEmitter.emit(this._waiting)}waitingWarning(){this.logger.warn("An attempt was made to send a REGISTER request while a prior one was still in progress. RFC 3261 requires UAs MUST NOT send a new registration until they have received a final response from the registrar for the previous one or the previous REGISTER request has timed out. Note that if the transport disconnects, you still must wait for the prior request to time out before sending a new REGISTER request or alternatively dispose of the current Registerer and create a new Registerer.")}stateError(){let e=`An attempt was made to send a REGISTER request when the Registerer ${this.state===jt.Terminated?"is in 'Terminated' state":"has been disposed"}.`;e+=" The Registerer transitions to 'Terminated' when Registerer.dispose() is called.",e+=" Perhaps you called UserAgent.stop() which dipsoses of all Registerers?",this.logger.error(e)}};tu.defaultExpires=600,tu.defaultRefreshFrequency=99,function(t){t.Initial="Initial",t.NotifyWait="NotifyWait",t.Pending="Pending",t.Active="Active",t.Terminated="Terminated"}(Vt=Vt||(Vt={})),function(t){t.Connecting="Connecting",t.Connected="Connected",t.Disconnecting="Disconnecting",t.Disconnected="Disconnected"}(dt=dt||(dt={})),function(t){t.Started="Started",t.Stopped="Stopped"}(Dn=Dn||(Dn={}));let bi=class Er{constructor(){this._dataLength=0,this._bufferLength=0,this._state=new Int32Array(4),this._buffer=new ArrayBuffer(68),this._buffer8=new Uint8Array(this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}static hashStr(e,n=!1){return this.onePassHasher.start().appendStr(e).end(n)}static hashAsciiStr(e,n=!1){return this.onePassHasher.start().appendAsciiStr(e).end(n)}static _hex(e){const n=Er.hexChars,r=Er.hexOut;let i,o,a,s;for(s=0;s<4;s+=1)for(o=8*s,i=e[s],a=0;a<8;a+=2)r[o+1+a]=n.charAt(15&i),i>>>=4,r[o+0+a]=n.charAt(15&i),i>>>=4;return r.join("")}static _md5cycle(e,n){let r=e[0],i=e[1],o=e[2],a=e[3];r+=(i&o|~i&a)+n[0]-680876936|0,r=(r<<7|r>>>25)+i|0,a+=(r&i|~r&o)+n[1]-389564586|0,a=(a<<12|a>>>20)+r|0,o+=(a&r|~a&i)+n[2]+606105819|0,o=(o<<17|o>>>15)+a|0,i+=(o&a|~o&r)+n[3]-1044525330|0,i=(i<<22|i>>>10)+o|0,r+=(i&o|~i&a)+n[4]-176418897|0,r=(r<<7|r>>>25)+i|0,a+=(r&i|~r&o)+n[5]+1200080426|0,a=(a<<12|a>>>20)+r|0,o+=(a&r|~a&i)+n[6]-1473231341|0,o=(o<<17|o>>>15)+a|0,i+=(o&a|~o&r)+n[7]-45705983|0,i=(i<<22|i>>>10)+o|0,r+=(i&o|~i&a)+n[8]+1770035416|0,r=(r<<7|r>>>25)+i|0,a+=(r&i|~r&o)+n[9]-1958414417|0,a=(a<<12|a>>>20)+r|0,o+=(a&r|~a&i)+n[10]-42063|0,o=(o<<17|o>>>15)+a|0,i+=(o&a|~o&r)+n[11]-1990404162|0,i=(i<<22|i>>>10)+o|0,r+=(i&o|~i&a)+n[12]+1804603682|0,r=(r<<7|r>>>25)+i|0,a+=(r&i|~r&o)+n[13]-40341101|0,a=(a<<12|a>>>20)+r|0,o+=(a&r|~a&i)+n[14]-1502002290|0,o=(o<<17|o>>>15)+a|0,i+=(o&a|~o&r)+n[15]+1236535329|0,i=(i<<22|i>>>10)+o|0,r+=(i&a|o&~a)+n[1]-165796510|0,r=(r<<5|r>>>27)+i|0,a+=(r&o|i&~o)+n[6]-1069501632|0,a=(a<<9|a>>>23)+r|0,o+=(a&i|r&~i)+n[11]+643717713|0,o=(o<<14|o>>>18)+a|0,i+=(o&r|a&~r)+n[0]-373897302|0,i=(i<<20|i>>>12)+o|0,r+=(i&a|o&~a)+n[5]-701558691|0,r=(r<<5|r>>>27)+i|0,a+=(r&o|i&~o)+n[10]+38016083|0,a=(a<<9|a>>>23)+r|0,o+=(a&i|r&~i)+n[15]-660478335|0,o=(o<<14|o>>>18)+a|0,i+=(o&r|a&~r)+n[4]-405537848|0,i=(i<<20|i>>>12)+o|0,r+=(i&a|o&~a)+n[9]+568446438|0,r=(r<<5|r>>>27)+i|0,a+=(r&o|i&~o)+n[14]-1019803690|0,a=(a<<9|a>>>23)+r|0,o+=(a&i|r&~i)+n[3]-187363961|0,o=(o<<14|o>>>18)+a|0,i+=(o&r|a&~r)+n[8]+1163531501|0,i=(i<<20|i>>>12)+o|0,r+=(i&a|o&~a)+n[13]-1444681467|0,r=(r<<5|r>>>27)+i|0,a+=(r&o|i&~o)+n[2]-51403784|0,a=(a<<9|a>>>23)+r|0,o+=(a&i|r&~i)+n[7]+1735328473|0,o=(o<<14|o>>>18)+a|0,i+=(o&r|a&~r)+n[12]-1926607734|0,i=(i<<20|i>>>12)+o|0,r+=(i^o^a)+n[5]-378558|0,r=(r<<4|r>>>28)+i|0,a+=(r^i^o)+n[8]-2022574463|0,a=(a<<11|a>>>21)+r|0,o+=(a^r^i)+n[11]+1839030562|0,o=(o<<16|o>>>16)+a|0,i+=(o^a^r)+n[14]-35309556|0,i=(i<<23|i>>>9)+o|0,r+=(i^o^a)+n[1]-1530992060|0,r=(r<<4|r>>>28)+i|0,a+=(r^i^o)+n[4]+1272893353|0,a=(a<<11|a>>>21)+r|0,o+=(a^r^i)+n[7]-155497632|0,o=(o<<16|o>>>16)+a|0,i+=(o^a^r)+n[10]-1094730640|0,i=(i<<23|i>>>9)+o|0,r+=(i^o^a)+n[13]+681279174|0,r=(r<<4|r>>>28)+i|0,a+=(r^i^o)+n[0]-358537222|0,a=(a<<11|a>>>21)+r|0,o+=(a^r^i)+n[3]-722521979|0,o=(o<<16|o>>>16)+a|0,i+=(o^a^r)+n[6]+76029189|0,i=(i<<23|i>>>9)+o|0,r+=(i^o^a)+n[9]-640364487|0,r=(r<<4|r>>>28)+i|0,a+=(r^i^o)+n[12]-421815835|0,a=(a<<11|a>>>21)+r|0,o+=(a^r^i)+n[15]+530742520|0,o=(o<<16|o>>>16)+a|0,i+=(o^a^r)+n[2]-995338651|0,i=(i<<23|i>>>9)+o|0,r+=(o^(i|~a))+n[0]-198630844|0,r=(r<<6|r>>>26)+i|0,a+=(i^(r|~o))+n[7]+1126891415|0,a=(a<<10|a>>>22)+r|0,o+=(r^(a|~i))+n[14]-1416354905|0,o=(o<<15|o>>>17)+a|0,i+=(a^(o|~r))+n[5]-57434055|0,i=(i<<21|i>>>11)+o|0,r+=(o^(i|~a))+n[12]+1700485571|0,r=(r<<6|r>>>26)+i|0,a+=(i^(r|~o))+n[3]-1894986606|0,a=(a<<10|a>>>22)+r|0,o+=(r^(a|~i))+n[10]-1051523|0,o=(o<<15|o>>>17)+a|0,i+=(a^(o|~r))+n[1]-2054922799|0,i=(i<<21|i>>>11)+o|0,r+=(o^(i|~a))+n[8]+1873313359|0,r=(r<<6|r>>>26)+i|0,a+=(i^(r|~o))+n[15]-30611744|0,a=(a<<10|a>>>22)+r|0,o+=(r^(a|~i))+n[6]-1560198380|0,o=(o<<15|o>>>17)+a|0,i+=(a^(o|~r))+n[13]+1309151649|0,i=(i<<21|i>>>11)+o|0,r+=(o^(i|~a))+n[4]-145523070|0,r=(r<<6|r>>>26)+i|0,a+=(i^(r|~o))+n[11]-1120210379|0,a=(a<<10|a>>>22)+r|0,o+=(r^(a|~i))+n[2]+718787259|0,o=(o<<15|o>>>17)+a|0,i+=(a^(o|~r))+n[9]-343485551|0,i=(i<<21|i>>>11)+o|0,e[0]=r+e[0]|0,e[1]=i+e[1]|0,e[2]=o+e[2]|0,e[3]=a+e[3]|0}start(){return this._dataLength=0,this._bufferLength=0,this._state.set(Er.stateIdentity),this}appendStr(e){const n=this._buffer8,r=this._buffer32;let i,o,a=this._bufferLength;for(o=0;o<e.length;o+=1){if(i=e.charCodeAt(o),i<128)n[a++]=i;else if(i<2048)n[a++]=(i>>>6)+192,n[a++]=63&i|128;else if(i<55296||i>56319)n[a++]=(i>>>12)+224,n[a++]=i>>>6&63|128,n[a++]=63&i|128;else{if(i=1024*(i-55296)+(e.charCodeAt(++o)-56320)+65536,i>1114111)throw new Error("Unicode standard supports code points up to U+10FFFF");n[a++]=(i>>>18)+240,n[a++]=i>>>12&63|128,n[a++]=i>>>6&63|128,n[a++]=63&i|128}a>=64&&(this._dataLength+=64,Er._md5cycle(this._state,r),a-=64,r[0]=r[16])}return this._bufferLength=a,this}appendAsciiStr(e){const n=this._buffer8,r=this._buffer32;let i,o=this._bufferLength,a=0;for(;;){for(i=Math.min(e.length-a,64-o);i--;)n[o++]=e.charCodeAt(a++);if(o<64)break;this._dataLength+=64,Er._md5cycle(this._state,r),o=0}return this._bufferLength=o,this}appendByteArray(e){const n=this._buffer8,r=this._buffer32;let i,o=this._bufferLength,a=0;for(;;){for(i=Math.min(e.length-a,64-o);i--;)n[o++]=e[a++];if(o<64)break;this._dataLength+=64,Er._md5cycle(this._state,r),o=0}return this._bufferLength=o,this}getState(){const e=this,n=e._state;return{buffer:String.fromCharCode.apply(null,e._buffer8),buflen:e._bufferLength,length:e._dataLength,state:[n[0],n[1],n[2],n[3]]}}setState(e){const n=e.buffer,r=e.state,i=this._state;let o;for(this._dataLength=e.length,this._bufferLength=e.buflen,i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3],o=0;o<n.length;o+=1)this._buffer8[o]=n.charCodeAt(o)}end(e=!1){const n=this._bufferLength,r=this._buffer8,i=this._buffer32,o=1+(n>>2);let a;if(this._dataLength+=n,r[n]=128,r[n+1]=r[n+2]=r[n+3]=0,i.set(Er.buffer32Identity.subarray(o),o),n>55&&(Er._md5cycle(this._state,i),i.set(Er.buffer32Identity)),a=8*this._dataLength,a<=4294967295)i[14]=a;else{const s=a.toString(16).match(/(.*?)(.{0,8})$/);if(s===null)return;const A=parseInt(s[2],16),c=parseInt(s[1],16)||0;i[14]=A,i[15]=c}return Er._md5cycle(this._state,i),e?this._state:Er._hex(this._state)}};function mi(t){return bi.hashStr(t)}bi.stateIdentity=new Int32Array([1732584193,-271733879,-1732584194,271733878]),bi.buffer32Identity=new Int32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),bi.hexChars="0123456789abcdef",bi.hexOut=[],bi.onePassHasher=new bi,bi.hashStr("hello")!=="5d41402abc4b2a76b9719d911017c592"&&console.error("Md5 self test failed.");let _S=class{constructor(e,n,r,i){this.logger=e.getLogger("sipjs.digestauthentication"),this.username=r,this.password=i,this.ha1=n,this.nc=0,this.ncHex="00000000"}authenticate(e,n,r){if(this.algorithm=n.algorithm,this.realm=n.realm,this.nonce=n.nonce,this.opaque=n.opaque,this.stale=n.stale,this.algorithm){if(this.algorithm!=="MD5")return this.logger.warn("challenge with Digest algorithm different than 'MD5', authentication aborted"),!1}else this.algorithm="MD5";if(!this.realm)return this.logger.warn("challenge without Digest realm, authentication aborted"),!1;if(!this.nonce)return this.logger.warn("challenge without Digest nonce, authentication aborted"),!1;if(n.qop)if(n.qop.indexOf("auth")>-1)this.qop="auth";else{if(!(n.qop.indexOf("auth-int")>-1))return this.logger.warn("challenge without Digest qop different than 'auth' or 'auth-int', authentication aborted"),!1;this.qop="auth-int"}else this.qop=void 0;return this.method=e.method,this.uri=e.ruri,this.cnonce=zi(12),this.nc+=1,this.updateNcHex(),this.nc===4294967296&&(this.nc=1,this.ncHex="00000001"),this.calculateResponse(r),!0}toString(){const e=[];if(!this.response)throw new Error("response field does not exist, cannot generate Authorization header");return e.push("algorithm="+this.algorithm),e.push('username="'+this.username+'"'),e.push('realm="'+this.realm+'"'),e.push('nonce="'+this.nonce+'"'),e.push('uri="'+this.uri+'"'),e.push('response="'+this.response+'"'),this.opaque&&e.push('opaque="'+this.opaque+'"'),this.qop&&(e.push("qop="+this.qop),e.push('cnonce="'+this.cnonce+'"'),e.push("nc="+this.ncHex)),"Digest "+e.join(", ")}updateNcHex(){const e=Number(this.nc).toString(16);this.ncHex="00000000".substr(0,8-e.length)+e}calculateResponse(e){let n,r;n=this.ha1,n!==""&&n!==void 0||(n=mi(this.username+":"+this.realm+":"+this.password)),this.qop==="auth"?(r=mi(this.method+":"+this.uri),this.response=mi(n+":"+this.nonce+":"+this.ncHex+":"+this.cnonce+":auth:"+r)):this.qop==="auth-int"?(r=mi(this.method+":"+this.uri+":"+mi(e||"")),this.response=mi(n+":"+this.nonce+":"+this.ncHex+":"+this.cnonce+":auth-int:"+r)):this.qop===void 0&&(r=mi(this.method+":"+this.uri),this.response=mi(n+":"+this.nonce+":"+r))}};(function(t){t[t.error=0]="error",t[t.warn=1]="warn",t[t.log=2]="log",t[t.debug=3]="debug"})(On=On||(On={}));let Ng=class{constructor(e,n,r){this.logger=e,this.category=n,this.label=r}error(e){this.genericLog(On.error,e)}warn(e){this.genericLog(On.warn,e)}log(e){this.genericLog(On.log,e)}debug(e){this.genericLog(On.debug,e)}genericLog(e,n){this.logger.genericLog(e,this.category,this.label,n)}get level(){return this.logger.level}set level(e){this.logger.level=e}},$S=class{constructor(){this.builtinEnabled=!0,this._level=On.log,this.loggers={},this.logger=this.getLogger("sip:loggerfactory")}get level(){return this._level}set level(e){e>=0&&e<=3?this._level=e:e>3?this._level=3:On.hasOwnProperty(e)?this._level=e:this.logger.error("invalid 'level' parameter value: "+JSON.stringify(e))}get connector(){return this._connector}set connector(e){e?typeof e=="function"?this._connector=e:this.logger.error("invalid 'connector' parameter value: "+JSON.stringify(e)):this._connector=void 0}getLogger(e,n){if(n&&this.level===3)return new Ng(this,e,n);if(this.loggers[e])return this.loggers[e];{const r=new Ng(this,e);return this.loggers[e]=r,r}}genericLog(e,n,r,i){this.level>=e&&this.builtinEnabled&&this.print(e,n,r,i),this.connector&&this.connector(On[e],n,r,i)}print(e,n,r,i){if(typeof i=="string"){const o=[new Date,n];r&&o.push(r),i=o.concat(i).join(" | ")}switch(e){case On.error:console.error(i);break;case On.warn:console.warn(i);case On.log:case On.debug:}}};function C0(t,e){if(e.statusCode<100||e.statusCode>699)throw new TypeError("Invalid statusCode: "+e.statusCode);const r=e.reasonPhrase?e.reasonPhrase:qA(e.statusCode);let i="SIP/2.0 "+e.statusCode+" "+r+`\r
114
+ `,e}};function g0(t){return t==="application/sdp"?"session":"render"}function lA(t){const e=typeof t=="string"?t:t.body,n=typeof t=="string"?"application/sdp":t.contentType;return{contentDisposition:g0(n),contentType:n,content:e}}function h0(t){return!(!t||typeof t.content!="string"||typeof t.contentType!="string"||t.contentDisposition!==void 0)||typeof t.contentDisposition=="string"}function Ea(t){let e,n,r;if(t instanceof Bo&&t.body){const i=t.parseHeader("Content-Disposition");e=i?i.type:void 0,n=t.parseHeader("Content-Type"),r=t.body}if(t instanceof Fi&&t.body){const i=t.parseHeader("Content-Disposition");e=i?i.type:void 0,n=t.parseHeader("Content-Type"),r=t.body}if(t instanceof qd&&t.body)if(e=t.getHeader("Content-Disposition"),n=t.getHeader("Content-Type"),typeof t.body=="string"){if(!n)throw new Error("Header content type header does not equal body content type.");r=t.body}else{if(n&&n!==t.body.contentType)throw new Error("Header content type header does not equal body content type.");n=t.body.contentType,r=t.body.body}if(h0(t)&&(e=t.contentDisposition,n=t.contentType,r=t.content),r){if(n&&!e&&(e=g0(n)),!e)throw new Error("Content disposition undefined.");if(!n)throw new Error("Content type undefined.");return{contentDisposition:e,contentType:n,content:r}}}var Sr,Pe;(function(t){t.Initial="Initial",t.Early="Early",t.AckWait="AckWait",t.Confirmed="Confirmed",t.Terminated="Terminated"})(Sr=Sr||(Sr={})),function(t){t.Initial="Initial",t.HaveLocalOffer="HaveLocalOffer",t.HaveRemoteOffer="HaveRemoteOffer",t.Stable="Stable",t.Closed="Closed"}(Pe=Pe||(Pe={}));const YS=500,Mn={T1:YS,T2:4e3,TIMER_B:32e3,TIMER_D:0,TIMER_F:32e3,TIMER_H:32e3,TIMER_I:0,TIMER_J:0,TIMER_K:0,TIMER_L:32e3,TIMER_M:32e3,TIMER_N:32e3,PROVISIONAL_RESPONSE_INTERVAL:6e4};let Ii=class extends uo{constructor(e){super(e||"Transaction state error.")}};var Ye;(function(t){t.ACK="ACK",t.BYE="BYE",t.CANCEL="CANCEL",t.INFO="INFO",t.INVITE="INVITE",t.MESSAGE="MESSAGE",t.NOTIFY="NOTIFY",t.OPTIONS="OPTIONS",t.REGISTER="REGISTER",t.UPDATE="UPDATE",t.SUBSCRIBE="SUBSCRIBE",t.PUBLISH="PUBLISH",t.REFER="REFER",t.PRACK="PRACK"})(Ye=Ye||(Ye={}));const Mi=[Ye.ACK,Ye.BYE,Ye.CANCEL,Ye.INFO,Ye.INVITE,Ye.MESSAGE,Ye.NOTIFY,Ye.OPTIONS,Ye.PRACK,Ye.REFER,Ye.REGISTER,Ye.SUBSCRIBE];let p0=class{constructor(e){this.incomingMessageRequest=e}get request(){return this.incomingMessageRequest.message}accept(e){return this.incomingMessageRequest.accept(e),Promise.resolve()}reject(e){return this.incomingMessageRequest.reject(e),Promise.resolve()}},$l=class{constructor(e){this.incomingNotifyRequest=e}get request(){return this.incomingNotifyRequest.message}accept(e){return this.incomingNotifyRequest.accept(e),Promise.resolve()}reject(e){return this.incomingNotifyRequest.reject(e),Promise.resolve()}},WS=class{constructor(e,n){this.incomingReferRequest=e,this.session=n}get referTo(){const e=this.incomingReferRequest.message.parseHeader("refer-to");if(!(e instanceof $n))throw new Error("Failed to parse Refer-To header.");return e}get referredBy(){return this.incomingReferRequest.message.getHeader("referred-by")}get replaces(){const e=this.referTo.uri.getHeader("replaces");return e instanceof Array?e[0]:e}get request(){return this.incomingReferRequest.message}accept(e={statusCode:202}){return this.incomingReferRequest.accept(e),Promise.resolve()}reject(e){return this.incomingReferRequest.reject(e),Promise.resolve()}makeInviter(e){if(this.inviter)return this.inviter;const n=this.referTo.uri.clone();n.clearHeaders();const r=((e=e||{}).extraHeaders||[]).slice(),i=this.replaces;i&&r.push("Replaces: "+decodeURIComponent(i));const o=this.referredBy;return o&&r.push("Referred-By: "+o),e.extraHeaders=r,this.inviter=this.session.userAgent._makeInviter(n,e),this.inviter._referred=this.session,this.session._referral=this.inviter,this.inviter}};var he,Nr;(function(t){t.Initial="Initial",t.Establishing="Establishing",t.Established="Established",t.Terminating="Terminating",t.Terminated="Terminated"})(he=he||(he={}));let Xl=class m0{constructor(e,n={}){this.pendingReinvite=!1,this.pendingReinviteAck=!1,this._state=he.Initial,this.delegate=n.delegate,this._stateEventEmitter=new Pa,this._userAgent=e}dispose(){switch(this.logger.log(`Session ${this.id} in state ${this._state} is being disposed`),delete this.userAgent._sessions[this.id],this._sessionDescriptionHandler&&this._sessionDescriptionHandler.close(),this.state){case he.Initial:case he.Establishing:break;case he.Established:return new Promise(e=>{this._bye({onAccept:()=>e(),onRedirect:()=>e(),onReject:()=>e()})});case he.Terminating:case he.Terminated:break;default:throw new Error("Unknown state.")}return Promise.resolve()}get assertedIdentity(){return this._assertedIdentity}get dialog(){return this._dialog}get id(){return this._id}get replacee(){return this._replacee}get sessionDescriptionHandler(){return this._sessionDescriptionHandler}get sessionDescriptionHandlerFactory(){return this.userAgent.configuration.sessionDescriptionHandlerFactory}get sessionDescriptionHandlerModifiers(){return this._sessionDescriptionHandlerModifiers||[]}set sessionDescriptionHandlerModifiers(e){this._sessionDescriptionHandlerModifiers=e.slice()}get sessionDescriptionHandlerOptions(){return this._sessionDescriptionHandlerOptions||{}}set sessionDescriptionHandlerOptions(e){this._sessionDescriptionHandlerOptions=Object.assign({},e)}get sessionDescriptionHandlerModifiersReInvite(){return this._sessionDescriptionHandlerModifiersReInvite||[]}set sessionDescriptionHandlerModifiersReInvite(e){this._sessionDescriptionHandlerModifiersReInvite=e.slice()}get sessionDescriptionHandlerOptionsReInvite(){return this._sessionDescriptionHandlerOptionsReInvite||{}}set sessionDescriptionHandlerOptionsReInvite(e){this._sessionDescriptionHandlerOptionsReInvite=Object.assign({},e)}get state(){return this._state}get stateChange(){return this._stateEventEmitter}get userAgent(){return this._userAgent}bye(e={}){let n="Session.bye() may only be called if established session.";switch(this.state){case he.Initial:typeof this.cancel=="function"?(n+=" However Inviter.invite() has not yet been called.",n+=" Perhaps you should have called Inviter.cancel()?"):typeof this.reject=="function"&&(n+=" However Invitation.accept() has not yet been called.",n+=" Perhaps you should have called Invitation.reject()?");break;case he.Establishing:typeof this.cancel=="function"?(n+=" However a dialog does not yet exist.",n+=" Perhaps you should have called Inviter.cancel()?"):typeof this.reject=="function"&&(n+=" However Invitation.accept() has not yet been called (or not yet resolved).",n+=" Perhaps you should have called Invitation.reject()?");break;case he.Established:{const r=e.requestDelegate,i=this.copyRequestOptions(e.requestOptions);return this._bye(r,i)}case he.Terminating:n+=" However this session is already terminating.",typeof this.cancel=="function"?n+=" Perhaps you have already called Inviter.cancel()?":typeof this.reject=="function"&&(n+=" Perhaps you have already called Session.bye()?");break;case he.Terminated:n+=" However this session is already terminated.";break;default:throw new Error("Unknown state")}return this.logger.error(n),Promise.reject(new Error(`Invalid session state ${this.state}`))}info(e={}){if(this.state!==he.Established)return this.logger.error("Session.info() may only be called if established session."),Promise.reject(new Error(`Invalid session state ${this.state}`));const n=e.requestDelegate,r=this.copyRequestOptions(e.requestOptions);return this._info(n,r)}invite(e={}){if(this.logger.log("Session.invite"),this.state!==he.Established)return Promise.reject(new Error(`Invalid session state ${this.state}`));if(this.pendingReinvite)return Promise.reject(new _l("Reinvite in progress. Please wait until complete, then try again."));this.pendingReinvite=!0,e.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiersReInvite=e.sessionDescriptionHandlerModifiers),e.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptionsReInvite=e.sessionDescriptionHandlerOptions);const n={onAccept:o=>{const a=Ea(o.message);if(!a)return this.logger.error("Received 2xx response to re-INVITE without a session description"),this.ackAndBye(o,400,"Missing session description"),this.stateTransition(he.Terminated),void(this.pendingReinvite=!1);if(e.withoutSdp){const s={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};this.setOfferAndGetAnswer(a,s).then(A=>{o.ack({body:A})}).catch(A=>{this.logger.error("Failed to handle offer in 2xx response to re-INVITE"),this.logger.error(A.message),this.state===he.Terminated?o.ack():(this.ackAndBye(o,488,"Bad Media Description"),this.stateTransition(he.Terminated))}).then(()=>{this.pendingReinvite=!1,e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(o)})}else{const s={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};this.setAnswer(a,s).then(()=>{o.ack()}).catch(A=>{this.logger.error("Failed to handle answer in 2xx response to re-INVITE"),this.logger.error(A.message),this.state!==he.Terminated?(this.ackAndBye(o,488,"Bad Media Description"),this.stateTransition(he.Terminated)):o.ack()}).then(()=>{this.pendingReinvite=!1,e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(o)})}},onProgress:o=>{},onRedirect:o=>{},onReject:o=>{this.logger.warn("Received a non-2xx response to re-INVITE"),this.pendingReinvite=!1,e.withoutSdp?e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(o):this.rollbackOffer().catch(a=>{if(this.logger.error("Failed to rollback offer on non-2xx response to re-INVITE"),this.logger.error(a.message),this.state!==he.Terminated){if(!this.dialog)throw new Error("Dialog undefined.");const s=[];s.push("Reason: "+this.getReasonHeaderValue(500,"Internal Server Error")),this.dialog.bye(void 0,{extraHeaders:s}),this.stateTransition(he.Terminated)}}).then(()=>{e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(o)})},onTrying:o=>{}},r=e.requestOptions||{};if(r.extraHeaders=(r.extraHeaders||[]).slice(),r.extraHeaders.push("Allow: "+Mi.toString()),r.extraHeaders.push("Contact: "+this._contact),e.withoutSdp){if(!this.dialog)throw this.pendingReinvite=!1,new Error("Dialog undefined.");return Promise.resolve(this.dialog.invite(n,r))}const i={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};return this.getOffer(i).then(o=>{if(!this.dialog)throw this.pendingReinvite=!1,new Error("Dialog undefined.");return r.body=o,this.dialog.invite(n,r)}).catch(o=>{throw this.logger.error(o.message),this.logger.error("Failed to send re-INVITE"),this.pendingReinvite=!1,o})}message(e={}){if(this.state!==he.Established)return this.logger.error("Session.message() may only be called if established session."),Promise.reject(new Error(`Invalid session state ${this.state}`));const n=e.requestDelegate,r=this.copyRequestOptions(e.requestOptions);return this._message(n,r)}refer(e,n={}){if(this.state!==he.Established)return this.logger.error("Session.refer() may only be called if established session."),Promise.reject(new Error(`Invalid session state ${this.state}`));if(e instanceof m0&&!e.dialog)return this.logger.error("Session.refer() may only be called with session which is established. You are perhaps attempting to attended transfer to a target for which there is not dialog yet established. Perhaps you are attempting a 'semi-attended' tansfer? Regardless, this is not supported. The recommended approached is to check to see if the target Session is in the Established state before calling refer(); if the state is not Established you may proceed by falling back using a URI as the target (blind transfer)."),Promise.reject(new Error(`Invalid session state ${this.state}`));const r=n.requestDelegate,i=this.copyRequestOptions(n.requestOptions);return i.extraHeaders=i.extraHeaders?i.extraHeaders.concat(this.referExtraHeaders(this.referToString(e))):this.referExtraHeaders(this.referToString(e)),this._refer(n.onNotify,r,i)}_bye(e,n){if(!this.dialog)return Promise.reject(new Error("Session dialog undefined."));const r=this.dialog;switch(r.sessionState){case Sr.Initial:case Sr.Early:throw new Error(`Invalid dialog state ${r.sessionState}`);case Sr.AckWait:return this.stateTransition(he.Terminating),new Promise(i=>{r.delegate={onAck:()=>{const o=r.bye(e,n);return this.stateTransition(he.Terminated),i(o),Promise.resolve()},onAckTimeout:()=>{const o=r.bye(e,n);this.stateTransition(he.Terminated),i(o)}}});case Sr.Confirmed:{const i=r.bye(e,n);return this.stateTransition(he.Terminated),Promise.resolve(i)}case Sr.Terminated:throw new Error(`Invalid dialog state ${r.sessionState}`);default:throw new Error("Unrecognized state.")}}_info(e,n){return this.dialog?Promise.resolve(this.dialog.info(e,n)):Promise.reject(new Error("Session dialog undefined."))}_message(e,n){return this.dialog?Promise.resolve(this.dialog.message(e,n)):Promise.reject(new Error("Session dialog undefined."))}_refer(e,n,r){return this.dialog?(this.onNotify=e,Promise.resolve(this.dialog.refer(n,r))):Promise.reject(new Error("Session dialog undefined."))}ackAndBye(e,n,r){e.ack();const i=[];n&&i.push("Reason: "+this.getReasonHeaderValue(n,r)),e.session.bye(void 0,{extraHeaders:i})}onAckRequest(e){if(this.logger.log("Session.onAckRequest"),this.state!==he.Established&&this.state!==he.Terminating)return this.logger.error(`ACK received while in state ${this.state}, dropping request`),Promise.resolve();const n=this.dialog;if(!n)throw new Error("Dialog undefined.");const r={sessionDescriptionHandlerOptions:this.pendingReinviteAck?this.sessionDescriptionHandlerOptionsReInvite:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.pendingReinviteAck?this._sessionDescriptionHandlerModifiersReInvite:this._sessionDescriptionHandlerModifiers};if(this.delegate&&this.delegate.onAck){const i=new GS(e);this.delegate.onAck(i)}switch(this.pendingReinviteAck=!1,n.signalingState){case Pe.Initial:{this.logger.error(`Invalid signaling state ${n.signalingState}.`);const i=["Reason: "+this.getReasonHeaderValue(488,"Bad Media Description")];return n.bye(void 0,{extraHeaders:i}),this.stateTransition(he.Terminated),Promise.resolve()}case Pe.Stable:{const i=Ea(e.message);return i?i.contentDisposition==="render"?(this._renderbody=i.content,this._rendertype=i.contentType,Promise.resolve()):i.contentDisposition!=="session"?Promise.resolve():this.setAnswer(i,r).catch(o=>{this.logger.error(o.message);const a=["Reason: "+this.getReasonHeaderValue(488,"Bad Media Description")];n.bye(void 0,{extraHeaders:a}),this.stateTransition(he.Terminated)}):Promise.resolve()}case Pe.HaveLocalOffer:{this.logger.error(`Invalid signaling state ${n.signalingState}.`);const i=["Reason: "+this.getReasonHeaderValue(488,"Bad Media Description")];return n.bye(void 0,{extraHeaders:i}),this.stateTransition(he.Terminated),Promise.resolve()}case Pe.HaveRemoteOffer:{this.logger.error(`Invalid signaling state ${n.signalingState}.`);const i=["Reason: "+this.getReasonHeaderValue(488,"Bad Media Description")];return n.bye(void 0,{extraHeaders:i}),this.stateTransition(he.Terminated),Promise.resolve()}case Pe.Closed:default:throw new Error(`Invalid signaling state ${n.signalingState}.`)}}onByeRequest(e){if(this.logger.log("Session.onByeRequest"),this.state===he.Established){if(this.delegate&&this.delegate.onBye){const n=new qS(e);this.delegate.onBye(n)}else e.accept();this.stateTransition(he.Terminated)}else this.logger.error(`BYE received while in state ${this.state}, dropping request`)}onInfoRequest(e){if(this.logger.log("Session.onInfoRequest"),this.state===he.Established)if(this.delegate&&this.delegate.onInfo){const n=new KS(e);this.delegate.onInfo(n)}else e.accept();else this.logger.error(`INFO received while in state ${this.state}, dropping request`)}onInviteRequest(e){if(this.logger.log("Session.onInviteRequest"),this.state!==he.Established)return void this.logger.error(`INVITE received while in state ${this.state}, dropping request`);this.pendingReinviteAck=!0;const n=["Contact: "+this._contact];if(e.message.hasHeader("P-Asserted-Identity")){const i=e.message.getHeader("P-Asserted-Identity");if(!i)throw new Error("Header undefined.");this._assertedIdentity=bn.nameAddrHeaderParse(i)}const r={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};this.generateResponseOfferAnswerInDialog(r).then(i=>{const o=e.accept({statusCode:200,extraHeaders:n,body:i});this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(e.message,o.message,200)}).catch(i=>{if(this.logger.error(i.message),this.logger.error("Failed to handle to re-INVITE request"),!this.dialog)throw new Error("Dialog undefined.");if(this.logger.error(this.dialog.signalingState),this.dialog.signalingState===Pe.Stable){const o=e.reject({statusCode:488});return void(this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(e.message,o.message,488))}this.rollbackOffer().then(()=>{const o=e.reject({statusCode:488});this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(e.message,o.message,488)}).catch(o=>{this.logger.error(o.message),this.logger.error("Failed to rollback offer on re-INVITE request");const a=e.reject({statusCode:488});if(this.state!==he.Terminated){if(!this.dialog)throw new Error("Dialog undefined.");const s=[];s.push("Reason: "+this.getReasonHeaderValue(500,"Internal Server Error")),this.dialog.bye(void 0,{extraHeaders:s}),this.stateTransition(he.Terminated)}this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(e.message,a.message,488)})})}onMessageRequest(e){if(this.logger.log("Session.onMessageRequest"),this.state===he.Established)if(this.delegate&&this.delegate.onMessage){const n=new p0(e);this.delegate.onMessage(n)}else e.accept();else this.logger.error(`MESSAGE received while in state ${this.state}, dropping request`)}onNotifyRequest(e){if(this.logger.log("Session.onNotifyRequest"),this.state===he.Established){if(this.onNotify){const n=new $l(e);return void this.onNotify(n)}if(this.delegate&&this.delegate.onNotify){const n=new $l(e);this.delegate.onNotify(n)}else e.accept()}else this.logger.error(`NOTIFY received while in state ${this.state}, dropping request`)}onPrackRequest(e){if(this.logger.log("Session.onPrackRequest"),this.state===he.Established)throw new Error("Unimplemented.");this.logger.error(`PRACK received while in state ${this.state}, dropping request`)}onReferRequest(e){if(this.logger.log("Session.onReferRequest"),this.state!==he.Established)return void this.logger.error(`REFER received while in state ${this.state}, dropping request`);if(!e.message.hasHeader("refer-to"))return this.logger.warn("Invalid REFER packet. A refer-to header is required. Rejecting."),void e.reject();const n=new WS(e,this);this.delegate&&this.delegate.onRefer?this.delegate.onRefer(n):(this.logger.log("No delegate available to handle REFER, automatically accepting and following."),n.accept().then(()=>n.makeInviter(this._referralInviterOptions).invite()).catch(r=>{this.logger.error(r.message)}))}generateResponseOfferAnswer(e,n){if(this.dialog)return this.generateResponseOfferAnswerInDialog(n);const r=Ea(e.message);return r&&r.contentDisposition==="session"?this.setOfferAndGetAnswer(r,n):this.getOffer(n)}generateResponseOfferAnswerInDialog(e){if(!this.dialog)throw new Error("Dialog undefined.");switch(this.dialog.signalingState){case Pe.Initial:return this.getOffer(e);case Pe.HaveLocalOffer:return Promise.resolve(void 0);case Pe.HaveRemoteOffer:if(!this.dialog.offer)throw new Error(`Session offer undefined in signaling state ${this.dialog.signalingState}.`);return this.setOfferAndGetAnswer(this.dialog.offer,e);case Pe.Stable:return this.state!==he.Established?Promise.resolve(void 0):this.getOffer(e);case Pe.Closed:default:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`)}}getOffer(e){const n=this.setupSessionDescriptionHandler(),r=e.sessionDescriptionHandlerOptions,i=e.sessionDescriptionHandlerModifiers;try{return n.getDescription(r,i).then(o=>lA(o)).catch(o=>{this.logger.error("Session.getOffer: SDH getDescription rejected...");const a=o instanceof Error?o:new Error("Session.getOffer unknown error.");throw this.logger.error(a.message),a})}catch(o){this.logger.error("Session.getOffer: SDH getDescription threw...");const a=o instanceof Error?o:new Error(o);return this.logger.error(a.message),Promise.reject(a)}}rollbackOffer(){const e=this.setupSessionDescriptionHandler();if(e.rollbackDescription===void 0)return Promise.resolve();try{return e.rollbackDescription().catch(n=>{this.logger.error("Session.rollbackOffer: SDH rollbackDescription rejected...");const r=n instanceof Error?n:new Error("Session.rollbackOffer unknown error.");throw this.logger.error(r.message),r})}catch(n){this.logger.error("Session.rollbackOffer: SDH rollbackDescription threw...");const r=n instanceof Error?n:new Error(n);return this.logger.error(r.message),Promise.reject(r)}}setAnswer(e,n){const r=this.setupSessionDescriptionHandler(),i=n.sessionDescriptionHandlerOptions,o=n.sessionDescriptionHandlerModifiers;try{if(!r.hasDescription(e.contentType))return Promise.reject(new Jl)}catch(a){this.logger.error("Session.setAnswer: SDH hasDescription threw...");const s=a instanceof Error?a:new Error(a);return this.logger.error(s.message),Promise.reject(s)}try{return r.setDescription(e.content,i,o).catch(a=>{this.logger.error("Session.setAnswer: SDH setDescription rejected...");const s=a instanceof Error?a:new Error("Session.setAnswer unknown error.");throw this.logger.error(s.message),s})}catch(a){this.logger.error("Session.setAnswer: SDH setDescription threw...");const s=a instanceof Error?a:new Error(a);return this.logger.error(s.message),Promise.reject(s)}}setOfferAndGetAnswer(e,n){const r=this.setupSessionDescriptionHandler(),i=n.sessionDescriptionHandlerOptions,o=n.sessionDescriptionHandlerModifiers;try{if(!r.hasDescription(e.contentType))return Promise.reject(new Jl)}catch(a){this.logger.error("Session.setOfferAndGetAnswer: SDH hasDescription threw...");const s=a instanceof Error?a:new Error(a);return this.logger.error(s.message),Promise.reject(s)}try{return r.setDescription(e.content,i,o).then(()=>r.getDescription(i,o)).then(a=>lA(a)).catch(a=>{this.logger.error("Session.setOfferAndGetAnswer: SDH setDescription or getDescription rejected...");const s=a instanceof Error?a:new Error("Session.setOfferAndGetAnswer unknown error.");throw this.logger.error(s.message),s})}catch(a){this.logger.error("Session.setOfferAndGetAnswer: SDH setDescription or getDescription threw...");const s=a instanceof Error?a:new Error(a);return this.logger.error(s.message),Promise.reject(s)}}setSessionDescriptionHandler(e){if(this._sessionDescriptionHandler)throw new Error("Session description handler defined.");this._sessionDescriptionHandler=e}setupSessionDescriptionHandler(){var e;return this._sessionDescriptionHandler||(this._sessionDescriptionHandler=this.sessionDescriptionHandlerFactory(this,this.userAgent.configuration.sessionDescriptionHandlerFactoryOptions),!((e=this.delegate)===null||e===void 0)&&e.onSessionDescriptionHandler&&this.delegate.onSessionDescriptionHandler(this._sessionDescriptionHandler,!1)),this._sessionDescriptionHandler}stateTransition(e){const n=()=>{throw new Error(`Invalid state transition from ${this._state} to ${e}`)};switch(this._state){case he.Initial:e!==he.Establishing&&e!==he.Established&&e!==he.Terminating&&e!==he.Terminated&&n();break;case he.Establishing:e!==he.Established&&e!==he.Terminating&&e!==he.Terminated&&n();break;case he.Established:e!==he.Terminating&&e!==he.Terminated&&n();break;case he.Terminating:e!==he.Terminated&&n();break;case he.Terminated:n();break;default:throw new Error("Unrecognized state.")}this._state=e,this.logger.log(`Session ${this.id} transitioned to state ${this._state}`),this._stateEventEmitter.emit(this._state),e===he.Terminated&&this.dispose()}copyRequestOptions(e={}){return{extraHeaders:e.extraHeaders?e.extraHeaders.slice():void 0,body:e.body?{contentDisposition:e.body.contentDisposition||"render",contentType:e.body.contentType||"text/plain",content:e.body.content||""}:void 0}}getReasonHeaderValue(e,n){const r=e;let i=qA(e);return!i&&n&&(i=n),"SIP;cause="+r+';text="'+i+'"'}referExtraHeaders(e){const n=[];return n.push("Referred-By: <"+this.userAgent.configuration.uri+">"),n.push("Contact: "+this._contact),n.push("Allow: "+["ACK","CANCEL","INVITE","MESSAGE","BYE","OPTIONS","INFO","NOTIFY","REFER"].toString()),n.push("Refer-To: "+e),n}referToString(e){let n;if(e instanceof Ni)n=e.toString();else{if(!e.dialog)throw new Error("Dialog undefined.");const r=e.remoteIdentity.friendlyName,i=e.dialog.remoteTarget.toString(),o=e.dialog.callId,a=e.dialog.remoteTag,s=e.dialog.localTag;n=`"${r}" <${i}?Replaces=${encodeURIComponent(`${o};to-tag=${a};from-tag=${s}`)}>`}return n}};(function(t){t.Required="Required",t.Supported="Supported",t.Unsupported="Unsupported"})(Nr=Nr||(Nr={}));const JS={"100rel":!0,199:!0,answermode:!0,"early-session":!0,eventlist:!0,explicitsub:!0,"from-change":!0,"geolocation-http":!0,"geolocation-sip":!0,gin:!0,gruu:!0,histinfo:!0,ice:!0,join:!0,"multiple-refer":!0,norefersub:!0,nosub:!0,outbound:!0,path:!0,policy:!0,precondition:!0,pref:!0,privacy:!0,"recipient-list-invite":!0,"recipient-list-message":!0,"recipient-list-subscribe":!0,replaces:!0,"resource-priority":!0,"sdp-anat":!0,"sec-agree":!0,tdialog:!0,timer:!0,uui:!0};let eu=class extends Xl{constructor(e,n){super(e),this.incomingInviteRequest=n,this.disposed=!1,this.expiresTimer=void 0,this.isCanceled=!1,this.rel100="none",this.rseq=Math.floor(1e4*Math.random()),this.userNoAnswerTimer=void 0,this.waitingForPrack=!1,this.logger=e.getLogger("sip.Invitation");const r=this.incomingInviteRequest.message,i=r.getHeader("require");i&&i.toLowerCase().includes("100rel")&&(this.rel100="required");const o=r.getHeader("supported");if(o&&o.toLowerCase().includes("100rel")&&(this.rel100="supported"),r.toTag=n.toTag,typeof r.toTag!="string")throw new TypeError("toTag should have been a string.");if(this.userNoAnswerTimer=setTimeout(()=>{n.reject({statusCode:480}),this.stateTransition(he.Terminated)},this.userAgent.configuration.noAnswerTimeout?1e3*this.userAgent.configuration.noAnswerTimeout:6e4),r.hasHeader("expires")){const A=1e3*Number(r.getHeader("expires")||0);this.expiresTimer=setTimeout(()=>{this.state===he.Initial&&(n.reject({statusCode:487}),this.stateTransition(he.Terminated))},A)}const a=this.request.getHeader("P-Asserted-Identity");a&&(this._assertedIdentity=bn.nameAddrHeaderParse(a)),this._contact=this.userAgent.contact.toString();const s=r.parseHeader("Content-Disposition");s&&s.type==="render"&&(this._renderbody=r.body,this._rendertype=r.getHeader("Content-Type")),this._id=r.callId+r.fromTag,this.userAgent._sessions[this._id]=this}dispose(){if(this.disposed)return Promise.resolve();switch(this.disposed=!0,this.expiresTimer&&(clearTimeout(this.expiresTimer),this.expiresTimer=void 0),this.userNoAnswerTimer&&(clearTimeout(this.userNoAnswerTimer),this.userNoAnswerTimer=void 0),this.prackNeverArrived(),this.state){case he.Initial:case he.Establishing:return this.reject().then(()=>super.dispose());case he.Established:case he.Terminating:case he.Terminated:return super.dispose();default:throw new Error("Unknown state.")}}get autoSendAnInitialProvisionalResponse(){return this.rel100!=="required"&&this.userAgent.configuration.sendInitialProvisionalResponse}get body(){return this.incomingInviteRequest.message.body}get localIdentity(){return this.request.to}get remoteIdentity(){return this.request.from}get request(){return this.incomingInviteRequest.message}accept(e={}){if(this.logger.log("Invitation.accept"),this.state!==he.Initial){const n=new Error(`Invalid session state ${this.state}`);return this.logger.error(n.message),Promise.reject(n)}return e.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=e.sessionDescriptionHandlerModifiers),e.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=e.sessionDescriptionHandlerOptions),this.stateTransition(he.Establishing),this.sendAccept(e).then(({message:n,session:r})=>{r.delegate={onAck:i=>this.onAckRequest(i),onAckTimeout:()=>this.onAckTimeout(),onBye:i=>this.onByeRequest(i),onInfo:i=>this.onInfoRequest(i),onInvite:i=>this.onInviteRequest(i),onMessage:i=>this.onMessageRequest(i),onNotify:i=>this.onNotifyRequest(i),onPrack:i=>this.onPrackRequest(i),onRefer:i=>this.onReferRequest(i)},this._dialog=r,this.stateTransition(he.Established),this._replacee&&this._replacee._bye()}).catch(n=>this.handleResponseError(n))}progress(e={}){if(this.logger.log("Invitation.progress"),this.state!==he.Initial){const r=new Error(`Invalid session state ${this.state}`);return this.logger.error(r.message),Promise.reject(r)}const n=e.statusCode||180;if(n<100||n>199)throw new TypeError("Invalid statusCode: "+n);return e.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=e.sessionDescriptionHandlerModifiers),e.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=e.sessionDescriptionHandlerOptions),this.waitingForPrack?(this.logger.warn("Unexpected call for progress while waiting for prack, ignoring"),Promise.resolve()):e.statusCode===100?this.sendProgressTrying().then(()=>{}).catch(r=>this.handleResponseError(r)):this.rel100==="required"||this.rel100==="supported"&&e.rel100||this.rel100==="supported"&&this.userAgent.configuration.sipExtension100rel===Nr.Required?this.sendProgressReliableWaitForPrack(e).then(()=>{}).catch(r=>this.handleResponseError(r)):this.sendProgress(e).then(()=>{}).catch(r=>this.handleResponseError(r))}reject(e={}){if(this.logger.log("Invitation.reject"),this.state!==he.Initial&&this.state!==he.Establishing){const a=new Error(`Invalid session state ${this.state}`);return this.logger.error(a.message),Promise.reject(a)}const n=e.statusCode||480,r=e.reasonPhrase?e.reasonPhrase:qA(n),i=e.extraHeaders||[];if(n<300||n>699)throw new TypeError("Invalid statusCode: "+n);const o=e.body?lA(e.body):void 0;return n<400?this.incomingInviteRequest.redirect([],{statusCode:n,reasonPhrase:r,extraHeaders:i,body:o}):this.incomingInviteRequest.reject({statusCode:n,reasonPhrase:r,extraHeaders:i,body:o}),this.stateTransition(he.Terminated),Promise.resolve()}_onCancel(e){if(this.logger.log("Invitation._onCancel"),this.state===he.Initial||this.state===he.Establishing){if(this.delegate&&this.delegate.onCancel){const n=new ZS(e);this.delegate.onCancel(n)}this.isCanceled=!0,this.incomingInviteRequest.reject({statusCode:487}),this.stateTransition(he.Terminated)}else this.logger.error(`CANCEL received while in state ${this.state}, dropping request`)}handlePrackOfferAnswer(e){if(!this.dialog)throw new Error("Dialog undefined.");const n=Ea(e.message);if(!n||n.contentDisposition!=="session")return Promise.resolve(void 0);const r={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers};switch(this.dialog.signalingState){case Pe.Initial:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`);case Pe.Stable:return this.setAnswer(n,r).then(()=>{});case Pe.HaveLocalOffer:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`);case Pe.HaveRemoteOffer:return this.setOfferAndGetAnswer(n,r);case Pe.Closed:default:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`)}}handleResponseError(e){let n=480;if(e instanceof Error?this.logger.error(e.message):this.logger.error(e),e instanceof Jl?(this.logger.error("A session description handler occurred while sending response (content type unsupported"),n=415):e instanceof HS?this.logger.error("A session description handler occurred while sending response"):e instanceof Gc?this.logger.error("Session ended before response could be formulated and sent (while waiting for PRACK)"):e instanceof Ii&&this.logger.error("Session changed state before response could be formulated and sent"),this.state===he.Initial||this.state===he.Establishing)try{this.incomingInviteRequest.reject({statusCode:n}),this.stateTransition(he.Terminated)}catch(r){throw this.logger.error("An error occurred attempting to reject the request while handling another error"),r}if(!this.isCanceled)throw e;this.logger.warn("An error occurred while attempting to formulate and send a response to an incoming INVITE. However a CANCEL was received and processed while doing so which can (and often does) result in errors occurring as the session terminates in the meantime. Said error is being ignored.")}onAckTimeout(){if(this.logger.log("Invitation.onAckTimeout"),!this.dialog)throw new Error("Dialog undefined.");this.logger.log("No ACK received for an extended period of time, terminating session"),this.dialog.bye(),this.stateTransition(he.Terminated)}sendAccept(e={}){const n={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers},r=e.extraHeaders||[];return this.waitingForPrack?this.waitForArrivalOfPrack().then(()=>clearTimeout(this.userNoAnswerTimer)).then(()=>this.generateResponseOfferAnswer(this.incomingInviteRequest,n)).then(i=>this.incomingInviteRequest.accept({statusCode:200,body:i,extraHeaders:r})):(clearTimeout(this.userNoAnswerTimer),this.generateResponseOfferAnswer(this.incomingInviteRequest,n).then(i=>this.incomingInviteRequest.accept({statusCode:200,body:i,extraHeaders:r})))}sendProgress(e={}){const n=e.statusCode||180,r=e.reasonPhrase,i=(e.extraHeaders||[]).slice(),o=e.body?lA(e.body):void 0;if(n===183&&!o)return this.sendProgressWithSDP(e);try{const a=this.incomingInviteRequest.progress({statusCode:n,reasonPhrase:r,extraHeaders:i,body:o});return this._dialog=a.session,Promise.resolve(a)}catch(a){return Promise.reject(a)}}sendProgressWithSDP(e={}){const n={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers},r=e.statusCode||183,i=e.reasonPhrase,o=(e.extraHeaders||[]).slice();return this.generateResponseOfferAnswer(this.incomingInviteRequest,n).then(a=>this.incomingInviteRequest.progress({statusCode:r,reasonPhrase:i,extraHeaders:o,body:a})).then(a=>(this._dialog=a.session,a))}sendProgressReliable(e={}){return e.extraHeaders=(e.extraHeaders||[]).slice(),e.extraHeaders.push("Require: 100rel"),e.extraHeaders.push("RSeq: "+Math.floor(1e4*Math.random())),this.sendProgressWithSDP(e)}sendProgressReliableWaitForPrack(e={}){const n={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers},r=e.statusCode||183,i=e.reasonPhrase,o=(e.extraHeaders||[]).slice();let a;return o.push("Require: 100rel"),o.push("RSeq: "+this.rseq++),new Promise((s,A)=>{this.waitingForPrack=!0,this.generateResponseOfferAnswer(this.incomingInviteRequest,n).then(c=>(a=c,this.incomingInviteRequest.progress({statusCode:r,reasonPhrase:i,extraHeaders:o,body:a}))).then(c=>{let u,d;this._dialog=c.session,c.session.delegate={onPrack:m=>{u=m,clearTimeout(f),clearTimeout(C),this.waitingForPrack&&(this.waitingForPrack=!1,this.handlePrackOfferAnswer(u).then(y=>{try{d=u.accept({statusCode:200,body:y}),this.prackArrived(),s({prackRequest:u,prackResponse:d,progressResponse:c})}catch(w){A(w)}}).catch(y=>A(y)))}};const f=setTimeout(()=>{this.waitingForPrack&&(this.waitingForPrack=!1,this.logger.warn("No PRACK received, rejecting INVITE."),clearTimeout(C),this.reject({statusCode:504}).then(()=>A(new Gc)).catch(m=>A(m)))},64*Mn.T1),p=()=>{try{this.incomingInviteRequest.progress({statusCode:r,reasonPhrase:i,extraHeaders:o,body:a})}catch(m){return this.waitingForPrack=!1,void A(m)}C=setTimeout(p,v*=2)};let v=Mn.T1,C=setTimeout(p,v)}).catch(c=>{this.waitingForPrack=!1,A(c)})})}sendProgressTrying(){try{const e=this.incomingInviteRequest.trying();return Promise.resolve(e)}catch(e){return Promise.reject(e)}}waitForArrivalOfPrack(){if(this.waitingForPrackPromise)throw new Error("Already waiting for PRACK");return this.waitingForPrackPromise=new Promise((e,n)=>{this.waitingForPrackResolve=e,this.waitingForPrackReject=n}),this.waitingForPrackPromise}prackArrived(){this.waitingForPrackResolve&&this.waitingForPrackResolve(),this.waitingForPrackPromise=void 0,this.waitingForPrackResolve=void 0,this.waitingForPrackReject=void 0}prackNeverArrived(){this.waitingForPrackReject&&this.waitingForPrackReject(new Gc),this.waitingForPrackPromise=void 0,this.waitingForPrackResolve=void 0,this.waitingForPrackReject=void 0}},v0=class extends Xl{constructor(e,n,r={}){super(e,r),this.disposed=!1,this.earlyMedia=!1,this.earlyMediaSessionDescriptionHandlers=new Map,this.isCanceled=!1,this.inviteWithoutSdp=!1,this.logger=e.getLogger("sip.Inviter"),this.earlyMedia=r.earlyMedia!==void 0?r.earlyMedia:this.earlyMedia,this.fromTag=ZA(),this.inviteWithoutSdp=r.inviteWithoutSdp!==void 0?r.inviteWithoutSdp:this.inviteWithoutSdp;const i=Object.assign({},r);i.params=Object.assign({},r.params);const o=r.anonymous||!1,a=e.contact.toString({anonymous:o,outbound:o?!e.contact.tempGruu:!e.contact.pubGruu});o&&e.configuration.uri&&(i.params.fromDisplayName="Anonymous",i.params.fromUri="sip:anonymous@anonymous.invalid");let s=e.userAgentCore.configuration.aor;if(i.params.fromUri&&(s=typeof i.params.fromUri=="string"?bn.URIParse(i.params.fromUri):i.params.fromUri),!s)throw new TypeError("Invalid from URI: "+i.params.fromUri);let A=n;if(i.params.toUri&&(A=typeof i.params.toUri=="string"?bn.URIParse(i.params.toUri):i.params.toUri),!A)throw new TypeError("Invalid to URI: "+i.params.toUri);const c=Object.assign({},i.params);c.fromTag=this.fromTag;const u=(i.extraHeaders||[]).slice();o&&e.configuration.uri&&(u.push("P-Preferred-Identity: "+e.configuration.uri.toString()),u.push("Privacy: id")),u.push("Contact: "+a),u.push("Allow: "+["ACK","CANCEL","INVITE","MESSAGE","BYE","OPTIONS","INFO","NOTIFY","REFER"].toString()),e.configuration.sipExtension100rel===Nr.Required&&u.push("Require: 100rel"),e.configuration.sipExtensionReplaces===Nr.Required&&u.push("Require: replaces"),i.extraHeaders=u,this.outgoingRequestMessage=e.userAgentCore.makeOutgoingRequestMessage(Ye.INVITE,n,s,A,c,u,void 0),this._contact=a,this._referralInviterOptions=i,this._renderbody=r.renderbody,this._rendertype=r.rendertype,r.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=r.sessionDescriptionHandlerModifiers),r.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=r.sessionDescriptionHandlerOptions),r.sessionDescriptionHandlerModifiersReInvite&&(this.sessionDescriptionHandlerModifiersReInvite=r.sessionDescriptionHandlerModifiersReInvite),r.sessionDescriptionHandlerOptionsReInvite&&(this.sessionDescriptionHandlerOptionsReInvite=r.sessionDescriptionHandlerOptionsReInvite),this._id=this.outgoingRequestMessage.callId+this.fromTag,this.userAgent._sessions[this._id]=this}dispose(){if(this.disposed)return Promise.resolve();switch(this.disposed=!0,this.disposeEarlyMedia(),this.state){case he.Initial:case he.Establishing:return this.cancel().then(()=>super.dispose());case he.Established:case he.Terminating:case he.Terminated:return super.dispose();default:throw new Error("Unknown state.")}}get body(){return this.outgoingRequestMessage.body}get localIdentity(){return this.outgoingRequestMessage.from}get remoteIdentity(){return this.outgoingRequestMessage.to}get request(){return this.outgoingRequestMessage}cancel(e={}){if(this.logger.log("Inviter.cancel"),this.state!==he.Initial&&this.state!==he.Establishing){const n=new Error(`Invalid session state ${this.state}`);return this.logger.error(n.message),Promise.reject(n)}if(this.isCanceled=!0,this.stateTransition(he.Terminating),this.outgoingInviteRequest){let n;e.statusCode&&e.reasonPhrase&&(n=function(r,i){if(r&&r<200||r>699)throw new TypeError("Invalid statusCode: "+r);if(r)return"SIP;cause="+r+';text="'+(qA(r)||i)+'"'}(e.statusCode,e.reasonPhrase)),this.outgoingInviteRequest.cancel(n,e)}else this.logger.warn("Canceled session before INVITE was sent"),this.stateTransition(he.Terminated);return Promise.resolve()}invite(e={}){if(this.logger.log("Inviter.invite"),this.state!==he.Initial)return super.invite(e);if(e.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=e.sessionDescriptionHandlerModifiers),e.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=e.sessionDescriptionHandlerOptions),e.withoutSdp||this.inviteWithoutSdp)return this._renderbody&&this._rendertype&&(this.outgoingRequestMessage.body={contentType:this._rendertype,body:this._renderbody}),this.stateTransition(he.Establishing),Promise.resolve(this.sendInvite(e));const n={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.getOffer(n).then(r=>(this.outgoingRequestMessage.body={body:r.content,contentType:r.contentType},this.stateTransition(he.Establishing),this.sendInvite(e))).catch(r=>{throw this.logger.log(r.message),this.state!==he.Terminated&&this.stateTransition(he.Terminated),r})}sendInvite(e={}){return this.outgoingInviteRequest=this.userAgent.userAgentCore.invite(this.outgoingRequestMessage,{onAccept:n=>this.dialog?(this.logger.log("Additional confirmed dialog, sending ACK and BYE"),void this.ackAndBye(n)):this.isCanceled?(this.logger.log("Canceled session accepted, sending ACK and BYE"),this.ackAndBye(n),void this.stateTransition(he.Terminated)):(this.notifyReferer(n),void this.onAccept(n).then(()=>{this.disposeEarlyMedia()}).catch(()=>{this.disposeEarlyMedia()}).then(()=>{e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(n)})),onProgress:n=>{this.isCanceled||(this.notifyReferer(n),this.onProgress(n).catch(()=>{this.disposeEarlyMedia()}).then(()=>{e.requestDelegate&&e.requestDelegate.onProgress&&e.requestDelegate.onProgress(n)}))},onRedirect:n=>{this.notifyReferer(n),this.onRedirect(n),e.requestDelegate&&e.requestDelegate.onRedirect&&e.requestDelegate.onRedirect(n)},onReject:n=>{this.notifyReferer(n),this.onReject(n),e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(n)},onTrying:n=>{this.notifyReferer(n),this.onTrying(n),e.requestDelegate&&e.requestDelegate.onTrying&&e.requestDelegate.onTrying(n)}}),this.outgoingInviteRequest}disposeEarlyMedia(){this.earlyMediaSessionDescriptionHandlers.forEach(e=>{e.close()}),this.earlyMediaSessionDescriptionHandlers.clear()}notifyReferer(e){if(!this._referred)return;if(!(this._referred instanceof Xl))throw new Error("Referred session not instance of session");if(!this._referred.dialog)return;if(!e.message.statusCode)throw new Error("Status code undefined.");if(!e.message.reasonPhrase)throw new Error("Reason phrase undefined.");const n=`SIP/2.0 ${e.message.statusCode} ${e.message.reasonPhrase}`.trim();this._referred.dialog.notify(void 0,{extraHeaders:["Event: refer","Subscription-State: terminated"],body:{contentDisposition:"render",contentType:"message/sipfrag",content:n}}).delegate={onReject:()=>{this._referred=void 0}}}onAccept(e){if(this.logger.log("Inviter.onAccept"),this.state!==he.Establishing)return this.logger.error(`Accept received while in state ${this.state}, dropping response`),Promise.reject(new Error(`Invalid session state ${this.state}`));const n=e.message,r=e.session;switch(n.hasHeader("P-Asserted-Identity")&&(this._assertedIdentity=bn.nameAddrHeaderParse(n.getHeader("P-Asserted-Identity"))),r.delegate={onAck:i=>this.onAckRequest(i),onBye:i=>this.onByeRequest(i),onInfo:i=>this.onInfoRequest(i),onInvite:i=>this.onInviteRequest(i),onMessage:i=>this.onMessageRequest(i),onNotify:i=>this.onNotifyRequest(i),onPrack:i=>this.onPrackRequest(i),onRefer:i=>this.onReferRequest(i)},this._dialog=r,r.signalingState){case Pe.Initial:case Pe.HaveLocalOffer:return this.logger.error("Received 2xx response to INVITE without a session description"),this.ackAndBye(e,400,"Missing session description"),this.stateTransition(he.Terminated),Promise.reject(new Error("Bad Media Description"));case Pe.HaveRemoteOffer:{if(!this._dialog.offer)throw new Error(`Session offer undefined in signaling state ${this._dialog.signalingState}.`);const i={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.setOfferAndGetAnswer(this._dialog.offer,i).then(o=>{e.ack({body:o}),this.stateTransition(he.Established)}).catch(o=>{throw this.ackAndBye(e,488,"Invalid session description"),this.stateTransition(he.Terminated),o})}case Pe.Stable:{if(this.earlyMediaSessionDescriptionHandlers.size>0){const a=this.earlyMediaSessionDescriptionHandlers.get(r.id);if(!a)throw new Error("Session description handler undefined.");return this.setSessionDescriptionHandler(a),this.earlyMediaSessionDescriptionHandlers.delete(r.id),e.ack(),this.stateTransition(he.Established),Promise.resolve()}if(this.earlyMediaDialog){if(this.earlyMediaDialog!==r){this.earlyMedia&&this.logger.error("You have set the 'earlyMedia' option to 'true' which requires that your INVITE requests do not fork and yet this INVITE request did in fact fork. Consequentially and not surprisingly the end point which accepted the INVITE (confirmed dialog) does not match the end point with which early media has been setup (early dialog) and thus this session is unable to proceed. In accordance with the SIP specifications, the SIP servers your end point is connected to determine if an INVITE forks and the forking behavior of those servers cannot be controlled by this library. If you wish to use early media with this library you must configure those servers accordingly. Alternatively you may set the 'earlyMedia' to 'false' which will allow this library to function with any INVITE requests which do fork.");const a=new Error("Early media dialog does not equal confirmed dialog, terminating session");return this.logger.error(a.message),this.ackAndBye(e,488,"Not Acceptable Here"),this.stateTransition(he.Terminated),Promise.reject(a)}return e.ack(),this.stateTransition(he.Established),Promise.resolve()}const i=r.answer;if(!i)throw new Error("Answer is undefined.");const o={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.setAnswer(i,o).then(()=>{let a;this._renderbody&&this._rendertype&&(a={body:{contentDisposition:"render",contentType:this._rendertype,content:this._renderbody}}),e.ack(a),this.stateTransition(he.Established)}).catch(a=>{throw this.logger.error(a.message),this.ackAndBye(e,488,"Not Acceptable Here"),this.stateTransition(he.Terminated),a})}case Pe.Closed:return Promise.reject(new Error("Terminated."));default:throw new Error("Unknown session signaling state.")}}onProgress(e){var n;if(this.logger.log("Inviter.onProgress"),this.state!==he.Establishing)return this.logger.error(`Progress received while in state ${this.state}, dropping response`),Promise.reject(new Error(`Invalid session state ${this.state}`));if(!this.outgoingInviteRequest)throw new Error("Outgoing INVITE request undefined.");const r=e.message,i=e.session;r.hasHeader("P-Asserted-Identity")&&(this._assertedIdentity=bn.nameAddrHeaderParse(r.getHeader("P-Asserted-Identity")));const o=r.getHeader("require"),a=r.getHeader("rseq"),s=!!(o&&o.includes("100rel")&&a&&Number(a)),A=[];switch(s&&A.push("RAck: "+r.getHeader("rseq")+" "+r.getHeader("cseq")),i.signalingState){case Pe.Initial:return s&&(this.logger.warn("First reliable provisional response received MUST contain an offer when INVITE does not contain an offer."),e.prack({extraHeaders:A})),Promise.resolve();case Pe.HaveLocalOffer:return s&&e.prack({extraHeaders:A}),Promise.resolve();case Pe.HaveRemoteOffer:if(!s)return this.logger.warn("Non-reliable provisional response MUST NOT contain an initial offer, discarding response."),Promise.resolve();{const c=this.sessionDescriptionHandlerFactory(this,this.userAgent.configuration.sessionDescriptionHandlerFactoryOptions||{});return!((n=this.delegate)===null||n===void 0)&&n.onSessionDescriptionHandler&&this.delegate.onSessionDescriptionHandler(c,!0),this.earlyMediaSessionDescriptionHandlers.set(i.id,c),c.setDescription(r.body,this.sessionDescriptionHandlerOptions,this.sessionDescriptionHandlerModifiers).then(()=>c.getDescription(this.sessionDescriptionHandlerOptions,this.sessionDescriptionHandlerModifiers)).then(u=>{const d={contentDisposition:"session",contentType:u.contentType,content:u.body};e.prack({extraHeaders:A,body:d})}).catch(u=>{throw this.stateTransition(he.Terminated),u})}case Pe.Stable:if(s&&e.prack({extraHeaders:A}),this.earlyMedia&&!this.earlyMediaDialog){this.earlyMediaDialog=i;const c=i.answer;if(!c)throw new Error("Answer is undefined.");const u={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.setAnswer(c,u).catch(d=>{throw this.stateTransition(he.Terminated),d})}return Promise.resolve();case Pe.Closed:return Promise.reject(new Error("Terminated."));default:throw new Error("Unknown session signaling state.")}}onRedirect(e){this.logger.log("Inviter.onRedirect"),this.state===he.Establishing||this.state===he.Terminating?this.stateTransition(he.Terminated):this.logger.error(`Redirect received while in state ${this.state}, dropping response`)}onReject(e){this.logger.log("Inviter.onReject"),this.state===he.Establishing||this.state===he.Terminating?this.stateTransition(he.Terminated):this.logger.error(`Reject received while in state ${this.state}, dropping response`)}onTrying(e){this.logger.log("Inviter.onTrying"),this.state===he.Establishing||this.logger.error(`Trying received while in state ${this.state}, dropping response`)}};var jt,Vt,dt,Dn,On,Ws,oe;(function(t){t.Initial="Initial",t.Registered="Registered",t.Unregistered="Unregistered",t.Terminated="Terminated"})(jt=jt||(jt={}));let tu=class Zi{constructor(e,n={}){this.disposed=!1,this._contacts=[],this._retryAfter=void 0,this._state=jt.Initial,this._waiting=!1,this._stateEventEmitter=new Pa,this._waitingEventEmitter=new Pa,this.userAgent=e;const r=e.configuration.uri.clone();if(r.user=void 0,this.options=Object.assign(Object.assign(Object.assign({},Zi.defaultOptions()),{registrar:r}),Zi.stripUndefinedProperties(n)),this.options.extraContactHeaderParams=(this.options.extraContactHeaderParams||[]).slice(),this.options.extraHeaders=(this.options.extraHeaders||[]).slice(),!this.options.registrar)throw new Error("Registrar undefined.");if(this.options.registrar=this.options.registrar.clone(),this.options.regId&&!this.options.instanceId?this.options.instanceId=this.userAgent.instanceId:!this.options.regId&&this.options.instanceId&&(this.options.regId=1),this.options.instanceId&&bn.parse(this.options.instanceId,"uuid")===-1)throw new Error("Invalid instanceId.");if(this.options.regId&&this.options.regId<0)throw new Error("Invalid regId.");const i=this.options.registrar,o=this.options.params&&this.options.params.fromUri||e.userAgentCore.configuration.aor,a=this.options.params&&this.options.params.toUri||e.configuration.uri,s=this.options.params||{},A=(n.extraHeaders||[]).slice();if(this.request=e.userAgentCore.makeOutgoingRequestMessage(Ye.REGISTER,i,o,a,s,A,void 0),this.expires=this.options.expires||Zi.defaultExpires,this.expires<0)throw new Error("Invalid expires.");if(this.refreshFrequency=this.options.refreshFrequency||Zi.defaultRefreshFrequency,this.refreshFrequency<50||this.refreshFrequency>99)throw new Error("Invalid refresh frequency. The value represents a percentage of the expiration time and should be between 50 and 99.");this.logger=e.getLogger("sip.Registerer"),this.options.logConfiguration&&(this.logger.log("Configuration:"),Object.keys(this.options).forEach(c=>{const u=this.options[c];c==="registrar"?this.logger.log("· "+c+": "+u):this.logger.log("· "+c+": "+JSON.stringify(u))})),this.id=this.request.callId+this.request.from.parameters.tag,this.userAgent._registerers[this.id]=this}static defaultOptions(){return{expires:Zi.defaultExpires,extraContactHeaderParams:[],extraHeaders:[],logConfiguration:!0,instanceId:"",params:{},regId:0,registrar:new Ni("sip","anonymous","anonymous.invalid"),refreshFrequency:Zi.defaultRefreshFrequency}}static stripUndefinedProperties(e){return Object.keys(e).reduce((n,r)=>(e[r]!==void 0&&(n[r]=e[r]),n),{})}get contacts(){return this._contacts.slice()}get retryAfter(){return this._retryAfter}get state(){return this._state}get stateChange(){return this._stateEventEmitter}dispose(){return this.disposed?Promise.resolve():(this.disposed=!0,this.logger.log(`Registerer ${this.id} in state ${this.state} is being disposed`),delete this.userAgent._registerers[this.id],new Promise(e=>{const n=()=>{if(!this.waiting&&this._state===jt.Registered)return this.stateChange.addListener(()=>{this.terminated(),e()},{once:!0}),void this.unregister();this.terminated(),e()};this.waiting?this.waitingChange.addListener(()=>{n()},{once:!0}):n()}))}register(e={}){if(this.state===jt.Terminated)throw this.stateError(),new Error("Registerer terminated. Unable to register.");if(this.disposed)throw this.stateError(),new Error("Registerer disposed. Unable to register.");if(this.waiting){this.waitingWarning();const i=new _l("REGISTER request already in progress, waiting for final response");return Promise.reject(i)}e.requestOptions&&(this.options=Object.assign(Object.assign({},this.options),e.requestOptions));const n=(this.options.extraHeaders||[]).slice();n.push("Contact: "+this.generateContactHeader(this.expires)),n.push("Allow: "+["ACK","CANCEL","INVITE","MESSAGE","BYE","OPTIONS","INFO","NOTIFY","REFER"].toString()),this.request.cseq++,this.request.setHeader("cseq",this.request.cseq+" REGISTER"),this.request.extraHeaders=n,this.waitingToggle(!0);const r=this.userAgent.userAgentCore.register(this.request,{onAccept:i=>{let o;i.message.hasHeader("expires")&&(o=Number(i.message.getHeader("expires"))),this._contacts=i.message.getHeaders("contact");let a,s=this._contacts.length;if(!s)return this.logger.error("No Contact header in response to REGISTER, dropping response."),void this.unregistered();for(;s--;){if(a=i.message.parseHeader("contact",s),!a)throw new Error("Contact undefined");if(this.userAgent.contact.pubGruu&&Mg(a.uri,this.userAgent.contact.pubGruu)){o=Number(a.getParam("expires"));break}if(this.userAgent.configuration.contactName===""){if(a.uri.user===this.userAgent.contact.uri.user){o=Number(a.getParam("expires"));break}}else if(Mg(a.uri,this.userAgent.contact.uri)){o=Number(a.getParam("expires"));break}a=void 0}if(a===void 0)return this.logger.error("No Contact header pointing to us, dropping response"),this.unregistered(),void this.waitingToggle(!1);if(o===void 0)return this.logger.error("Contact pointing to us is missing expires parameter, dropping response"),this.unregistered(),void this.waitingToggle(!1);if(a.hasParam("temp-gruu")){const A=a.getParam("temp-gruu");A&&(this.userAgent.contact.tempGruu=bn.URIParse(A.replace(/"/g,"")))}if(a.hasParam("pub-gruu")){const A=a.getParam("pub-gruu");A&&(this.userAgent.contact.pubGruu=bn.URIParse(A.replace(/"/g,"")))}this.registered(o),e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(i),this.waitingToggle(!1)},onProgress:i=>{e.requestDelegate&&e.requestDelegate.onProgress&&e.requestDelegate.onProgress(i)},onRedirect:i=>{this.logger.error("Redirect received. Not supported."),this.unregistered(),e.requestDelegate&&e.requestDelegate.onRedirect&&e.requestDelegate.onRedirect(i),this.waitingToggle(!1)},onReject:i=>{if(i.message.statusCode===423)return i.message.hasHeader("min-expires")?(this.expires=Number(i.message.getHeader("min-expires")),this.waitingToggle(!1),void this.register()):(this.logger.error("423 response received for REGISTER without Min-Expires, dropping response"),this.unregistered(),void this.waitingToggle(!1));this.logger.warn(`Failed to register, status code ${i.message.statusCode}`);let o=NaN;if(i.message.statusCode===500||i.message.statusCode===503){const a=i.message.getHeader("retry-after");a&&(o=Number.parseInt(a,void 0))}this._retryAfter=isNaN(o)?void 0:o,this.unregistered(),e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(i),this._retryAfter=void 0,this.waitingToggle(!1)},onTrying:i=>{e.requestDelegate&&e.requestDelegate.onTrying&&e.requestDelegate.onTrying(i)}});return Promise.resolve(r)}unregister(e={}){if(this.state===jt.Terminated)throw this.stateError(),new Error("Registerer terminated. Unable to register.");if(this.disposed&&this.state!==jt.Registered)throw this.stateError(),new Error("Registerer disposed. Unable to register.");if(this.waiting){this.waitingWarning();const i=new _l("REGISTER request already in progress, waiting for final response");return Promise.reject(i)}this._state===jt.Registered||e.all||this.logger.warn("Not currently registered, but sending an unregister anyway.");const n=(e.requestOptions&&e.requestOptions.extraHeaders||[]).slice();this.request.extraHeaders=n,e.all?(n.push("Contact: *"),n.push("Expires: 0")):n.push("Contact: "+this.generateContactHeader(0)),this.request.cseq++,this.request.setHeader("cseq",this.request.cseq+" REGISTER"),this.registrationTimer!==void 0&&(clearTimeout(this.registrationTimer),this.registrationTimer=void 0),this.waitingToggle(!0);const r=this.userAgent.userAgentCore.register(this.request,{onAccept:i=>{this._contacts=i.message.getHeaders("contact"),this.unregistered(),e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(i),this.waitingToggle(!1)},onProgress:i=>{e.requestDelegate&&e.requestDelegate.onProgress&&e.requestDelegate.onProgress(i)},onRedirect:i=>{this.logger.error("Unregister redirected. Not currently supported."),this.unregistered(),e.requestDelegate&&e.requestDelegate.onRedirect&&e.requestDelegate.onRedirect(i),this.waitingToggle(!1)},onReject:i=>{this.logger.error(`Unregister rejected with status code ${i.message.statusCode}`),this.unregistered(),e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(i),this.waitingToggle(!1)},onTrying:i=>{e.requestDelegate&&e.requestDelegate.onTrying&&e.requestDelegate.onTrying(i)}});return Promise.resolve(r)}clearTimers(){this.registrationTimer!==void 0&&(clearTimeout(this.registrationTimer),this.registrationTimer=void 0),this.registrationExpiredTimer!==void 0&&(clearTimeout(this.registrationExpiredTimer),this.registrationExpiredTimer=void 0)}generateContactHeader(e){let n=this.userAgent.contact.toString({register:!0});return this.options.regId&&this.options.instanceId&&(n+=";reg-id="+this.options.regId,n+=';+sip.instance="<urn:uuid:'+this.options.instanceId+'>"'),this.options.extraContactHeaderParams&&this.options.extraContactHeaderParams.forEach(r=>{n+=";"+r}),n+=";expires="+e,n}registered(e){this.clearTimers(),this.registrationTimer=setTimeout(()=>{this.registrationTimer=void 0,this.register()},this.refreshFrequency/100*e*1e3),this.registrationExpiredTimer=setTimeout(()=>{this.logger.warn("Registration expired"),this.unregistered()},1e3*e),this._state!==jt.Registered&&this.stateTransition(jt.Registered)}unregistered(){this.clearTimers(),this._state!==jt.Unregistered&&this.stateTransition(jt.Unregistered)}terminated(){this.clearTimers(),this._state!==jt.Terminated&&this.stateTransition(jt.Terminated)}stateTransition(e){const n=()=>{throw new Error(`Invalid state transition from ${this._state} to ${e}`)};switch(this._state){case jt.Initial:e!==jt.Registered&&e!==jt.Unregistered&&e!==jt.Terminated&&n();break;case jt.Registered:e!==jt.Unregistered&&e!==jt.Terminated&&n();break;case jt.Unregistered:e!==jt.Registered&&e!==jt.Terminated&&n();break;case jt.Terminated:n();break;default:throw new Error("Unrecognized state.")}this._state=e,this.logger.log(`Registration transitioned to state ${this._state}`),this._stateEventEmitter.emit(this._state),e===jt.Terminated&&this.dispose()}get waiting(){return this._waiting}get waitingChange(){return this._waitingEventEmitter}waitingToggle(e){if(this._waiting===e)throw new Error(`Invalid waiting transition from ${this._waiting} to ${e}`);this._waiting=e,this.logger.log(`Waiting toggled to ${this._waiting}`),this._waitingEventEmitter.emit(this._waiting)}waitingWarning(){this.logger.warn("An attempt was made to send a REGISTER request while a prior one was still in progress. RFC 3261 requires UAs MUST NOT send a new registration until they have received a final response from the registrar for the previous one or the previous REGISTER request has timed out. Note that if the transport disconnects, you still must wait for the prior request to time out before sending a new REGISTER request or alternatively dispose of the current Registerer and create a new Registerer.")}stateError(){let e=`An attempt was made to send a REGISTER request when the Registerer ${this.state===jt.Terminated?"is in 'Terminated' state":"has been disposed"}.`;e+=" The Registerer transitions to 'Terminated' when Registerer.dispose() is called.",e+=" Perhaps you called UserAgent.stop() which dipsoses of all Registerers?",this.logger.error(e)}};tu.defaultExpires=600,tu.defaultRefreshFrequency=99,function(t){t.Initial="Initial",t.NotifyWait="NotifyWait",t.Pending="Pending",t.Active="Active",t.Terminated="Terminated"}(Vt=Vt||(Vt={})),function(t){t.Connecting="Connecting",t.Connected="Connected",t.Disconnecting="Disconnecting",t.Disconnected="Disconnected"}(dt=dt||(dt={})),function(t){t.Started="Started",t.Stopped="Stopped"}(Dn=Dn||(Dn={}));let bi=class Er{constructor(){this._dataLength=0,this._bufferLength=0,this._state=new Int32Array(4),this._buffer=new ArrayBuffer(68),this._buffer8=new Uint8Array(this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}static hashStr(e,n=!1){return this.onePassHasher.start().appendStr(e).end(n)}static hashAsciiStr(e,n=!1){return this.onePassHasher.start().appendAsciiStr(e).end(n)}static _hex(e){const n=Er.hexChars,r=Er.hexOut;let i,o,a,s;for(s=0;s<4;s+=1)for(o=8*s,i=e[s],a=0;a<8;a+=2)r[o+1+a]=n.charAt(15&i),i>>>=4,r[o+0+a]=n.charAt(15&i),i>>>=4;return r.join("")}static _md5cycle(e,n){let r=e[0],i=e[1],o=e[2],a=e[3];r+=(i&o|~i&a)+n[0]-680876936|0,r=(r<<7|r>>>25)+i|0,a+=(r&i|~r&o)+n[1]-389564586|0,a=(a<<12|a>>>20)+r|0,o+=(a&r|~a&i)+n[2]+606105819|0,o=(o<<17|o>>>15)+a|0,i+=(o&a|~o&r)+n[3]-1044525330|0,i=(i<<22|i>>>10)+o|0,r+=(i&o|~i&a)+n[4]-176418897|0,r=(r<<7|r>>>25)+i|0,a+=(r&i|~r&o)+n[5]+1200080426|0,a=(a<<12|a>>>20)+r|0,o+=(a&r|~a&i)+n[6]-1473231341|0,o=(o<<17|o>>>15)+a|0,i+=(o&a|~o&r)+n[7]-45705983|0,i=(i<<22|i>>>10)+o|0,r+=(i&o|~i&a)+n[8]+1770035416|0,r=(r<<7|r>>>25)+i|0,a+=(r&i|~r&o)+n[9]-1958414417|0,a=(a<<12|a>>>20)+r|0,o+=(a&r|~a&i)+n[10]-42063|0,o=(o<<17|o>>>15)+a|0,i+=(o&a|~o&r)+n[11]-1990404162|0,i=(i<<22|i>>>10)+o|0,r+=(i&o|~i&a)+n[12]+1804603682|0,r=(r<<7|r>>>25)+i|0,a+=(r&i|~r&o)+n[13]-40341101|0,a=(a<<12|a>>>20)+r|0,o+=(a&r|~a&i)+n[14]-1502002290|0,o=(o<<17|o>>>15)+a|0,i+=(o&a|~o&r)+n[15]+1236535329|0,i=(i<<22|i>>>10)+o|0,r+=(i&a|o&~a)+n[1]-165796510|0,r=(r<<5|r>>>27)+i|0,a+=(r&o|i&~o)+n[6]-1069501632|0,a=(a<<9|a>>>23)+r|0,o+=(a&i|r&~i)+n[11]+643717713|0,o=(o<<14|o>>>18)+a|0,i+=(o&r|a&~r)+n[0]-373897302|0,i=(i<<20|i>>>12)+o|0,r+=(i&a|o&~a)+n[5]-701558691|0,r=(r<<5|r>>>27)+i|0,a+=(r&o|i&~o)+n[10]+38016083|0,a=(a<<9|a>>>23)+r|0,o+=(a&i|r&~i)+n[15]-660478335|0,o=(o<<14|o>>>18)+a|0,i+=(o&r|a&~r)+n[4]-405537848|0,i=(i<<20|i>>>12)+o|0,r+=(i&a|o&~a)+n[9]+568446438|0,r=(r<<5|r>>>27)+i|0,a+=(r&o|i&~o)+n[14]-1019803690|0,a=(a<<9|a>>>23)+r|0,o+=(a&i|r&~i)+n[3]-187363961|0,o=(o<<14|o>>>18)+a|0,i+=(o&r|a&~r)+n[8]+1163531501|0,i=(i<<20|i>>>12)+o|0,r+=(i&a|o&~a)+n[13]-1444681467|0,r=(r<<5|r>>>27)+i|0,a+=(r&o|i&~o)+n[2]-51403784|0,a=(a<<9|a>>>23)+r|0,o+=(a&i|r&~i)+n[7]+1735328473|0,o=(o<<14|o>>>18)+a|0,i+=(o&r|a&~r)+n[12]-1926607734|0,i=(i<<20|i>>>12)+o|0,r+=(i^o^a)+n[5]-378558|0,r=(r<<4|r>>>28)+i|0,a+=(r^i^o)+n[8]-2022574463|0,a=(a<<11|a>>>21)+r|0,o+=(a^r^i)+n[11]+1839030562|0,o=(o<<16|o>>>16)+a|0,i+=(o^a^r)+n[14]-35309556|0,i=(i<<23|i>>>9)+o|0,r+=(i^o^a)+n[1]-1530992060|0,r=(r<<4|r>>>28)+i|0,a+=(r^i^o)+n[4]+1272893353|0,a=(a<<11|a>>>21)+r|0,o+=(a^r^i)+n[7]-155497632|0,o=(o<<16|o>>>16)+a|0,i+=(o^a^r)+n[10]-1094730640|0,i=(i<<23|i>>>9)+o|0,r+=(i^o^a)+n[13]+681279174|0,r=(r<<4|r>>>28)+i|0,a+=(r^i^o)+n[0]-358537222|0,a=(a<<11|a>>>21)+r|0,o+=(a^r^i)+n[3]-722521979|0,o=(o<<16|o>>>16)+a|0,i+=(o^a^r)+n[6]+76029189|0,i=(i<<23|i>>>9)+o|0,r+=(i^o^a)+n[9]-640364487|0,r=(r<<4|r>>>28)+i|0,a+=(r^i^o)+n[12]-421815835|0,a=(a<<11|a>>>21)+r|0,o+=(a^r^i)+n[15]+530742520|0,o=(o<<16|o>>>16)+a|0,i+=(o^a^r)+n[2]-995338651|0,i=(i<<23|i>>>9)+o|0,r+=(o^(i|~a))+n[0]-198630844|0,r=(r<<6|r>>>26)+i|0,a+=(i^(r|~o))+n[7]+1126891415|0,a=(a<<10|a>>>22)+r|0,o+=(r^(a|~i))+n[14]-1416354905|0,o=(o<<15|o>>>17)+a|0,i+=(a^(o|~r))+n[5]-57434055|0,i=(i<<21|i>>>11)+o|0,r+=(o^(i|~a))+n[12]+1700485571|0,r=(r<<6|r>>>26)+i|0,a+=(i^(r|~o))+n[3]-1894986606|0,a=(a<<10|a>>>22)+r|0,o+=(r^(a|~i))+n[10]-1051523|0,o=(o<<15|o>>>17)+a|0,i+=(a^(o|~r))+n[1]-2054922799|0,i=(i<<21|i>>>11)+o|0,r+=(o^(i|~a))+n[8]+1873313359|0,r=(r<<6|r>>>26)+i|0,a+=(i^(r|~o))+n[15]-30611744|0,a=(a<<10|a>>>22)+r|0,o+=(r^(a|~i))+n[6]-1560198380|0,o=(o<<15|o>>>17)+a|0,i+=(a^(o|~r))+n[13]+1309151649|0,i=(i<<21|i>>>11)+o|0,r+=(o^(i|~a))+n[4]-145523070|0,r=(r<<6|r>>>26)+i|0,a+=(i^(r|~o))+n[11]-1120210379|0,a=(a<<10|a>>>22)+r|0,o+=(r^(a|~i))+n[2]+718787259|0,o=(o<<15|o>>>17)+a|0,i+=(a^(o|~r))+n[9]-343485551|0,i=(i<<21|i>>>11)+o|0,e[0]=r+e[0]|0,e[1]=i+e[1]|0,e[2]=o+e[2]|0,e[3]=a+e[3]|0}start(){return this._dataLength=0,this._bufferLength=0,this._state.set(Er.stateIdentity),this}appendStr(e){const n=this._buffer8,r=this._buffer32;let i,o,a=this._bufferLength;for(o=0;o<e.length;o+=1){if(i=e.charCodeAt(o),i<128)n[a++]=i;else if(i<2048)n[a++]=(i>>>6)+192,n[a++]=63&i|128;else if(i<55296||i>56319)n[a++]=(i>>>12)+224,n[a++]=i>>>6&63|128,n[a++]=63&i|128;else{if(i=1024*(i-55296)+(e.charCodeAt(++o)-56320)+65536,i>1114111)throw new Error("Unicode standard supports code points up to U+10FFFF");n[a++]=(i>>>18)+240,n[a++]=i>>>12&63|128,n[a++]=i>>>6&63|128,n[a++]=63&i|128}a>=64&&(this._dataLength+=64,Er._md5cycle(this._state,r),a-=64,r[0]=r[16])}return this._bufferLength=a,this}appendAsciiStr(e){const n=this._buffer8,r=this._buffer32;let i,o=this._bufferLength,a=0;for(;;){for(i=Math.min(e.length-a,64-o);i--;)n[o++]=e.charCodeAt(a++);if(o<64)break;this._dataLength+=64,Er._md5cycle(this._state,r),o=0}return this._bufferLength=o,this}appendByteArray(e){const n=this._buffer8,r=this._buffer32;let i,o=this._bufferLength,a=0;for(;;){for(i=Math.min(e.length-a,64-o);i--;)n[o++]=e[a++];if(o<64)break;this._dataLength+=64,Er._md5cycle(this._state,r),o=0}return this._bufferLength=o,this}getState(){const e=this,n=e._state;return{buffer:String.fromCharCode.apply(null,e._buffer8),buflen:e._bufferLength,length:e._dataLength,state:[n[0],n[1],n[2],n[3]]}}setState(e){const n=e.buffer,r=e.state,i=this._state;let o;for(this._dataLength=e.length,this._bufferLength=e.buflen,i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3],o=0;o<n.length;o+=1)this._buffer8[o]=n.charCodeAt(o)}end(e=!1){const n=this._bufferLength,r=this._buffer8,i=this._buffer32,o=1+(n>>2);let a;if(this._dataLength+=n,r[n]=128,r[n+1]=r[n+2]=r[n+3]=0,i.set(Er.buffer32Identity.subarray(o),o),n>55&&(Er._md5cycle(this._state,i),i.set(Er.buffer32Identity)),a=8*this._dataLength,a<=4294967295)i[14]=a;else{const s=a.toString(16).match(/(.*?)(.{0,8})$/);if(s===null)return;const A=parseInt(s[2],16),c=parseInt(s[1],16)||0;i[14]=A,i[15]=c}return Er._md5cycle(this._state,i),e?this._state:Er._hex(this._state)}};function mi(t){return bi.hashStr(t)}bi.stateIdentity=new Int32Array([1732584193,-271733879,-1732584194,271733878]),bi.buffer32Identity=new Int32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),bi.hexChars="0123456789abcdef",bi.hexOut=[],bi.onePassHasher=new bi,bi.hashStr("hello")!=="5d41402abc4b2a76b9719d911017c592"&&console.error("Md5 self test failed.");let _S=class{constructor(e,n,r,i){this.logger=e.getLogger("sipjs.digestauthentication"),this.username=r,this.password=i,this.ha1=n,this.nc=0,this.ncHex="00000000"}authenticate(e,n,r){if(this.algorithm=n.algorithm,this.realm=n.realm,this.nonce=n.nonce,this.opaque=n.opaque,this.stale=n.stale,this.algorithm){if(this.algorithm!=="MD5")return this.logger.warn("challenge with Digest algorithm different than 'MD5', authentication aborted"),!1}else this.algorithm="MD5";if(!this.realm)return this.logger.warn("challenge without Digest realm, authentication aborted"),!1;if(!this.nonce)return this.logger.warn("challenge without Digest nonce, authentication aborted"),!1;if(n.qop)if(n.qop.indexOf("auth")>-1)this.qop="auth";else{if(!(n.qop.indexOf("auth-int")>-1))return this.logger.warn("challenge without Digest qop different than 'auth' or 'auth-int', authentication aborted"),!1;this.qop="auth-int"}else this.qop=void 0;return this.method=e.method,this.uri=e.ruri,this.cnonce=zi(12),this.nc+=1,this.updateNcHex(),this.nc===4294967296&&(this.nc=1,this.ncHex="00000001"),this.calculateResponse(r),!0}toString(){const e=[];if(!this.response)throw new Error("response field does not exist, cannot generate Authorization header");return e.push("algorithm="+this.algorithm),e.push('username="'+this.username+'"'),e.push('realm="'+this.realm+'"'),e.push('nonce="'+this.nonce+'"'),e.push('uri="'+this.uri+'"'),e.push('response="'+this.response+'"'),this.opaque&&e.push('opaque="'+this.opaque+'"'),this.qop&&(e.push("qop="+this.qop),e.push('cnonce="'+this.cnonce+'"'),e.push("nc="+this.ncHex)),"Digest "+e.join(", ")}updateNcHex(){const e=Number(this.nc).toString(16);this.ncHex="00000000".substr(0,8-e.length)+e}calculateResponse(e){let n,r;n=this.ha1,n!==""&&n!==void 0||(n=mi(this.username+":"+this.realm+":"+this.password)),this.qop==="auth"?(r=mi(this.method+":"+this.uri),this.response=mi(n+":"+this.nonce+":"+this.ncHex+":"+this.cnonce+":auth:"+r)):this.qop==="auth-int"?(r=mi(this.method+":"+this.uri+":"+mi(e||"")),this.response=mi(n+":"+this.nonce+":"+this.ncHex+":"+this.cnonce+":auth-int:"+r)):this.qop===void 0&&(r=mi(this.method+":"+this.uri),this.response=mi(n+":"+this.nonce+":"+r))}};(function(t){t[t.error=0]="error",t[t.warn=1]="warn",t[t.log=2]="log",t[t.debug=3]="debug"})(On=On||(On={}));let Ng=class{constructor(e,n,r){this.logger=e,this.category=n,this.label=r}error(e){this.genericLog(On.error,e)}warn(e){this.genericLog(On.warn,e)}log(e){this.genericLog(On.log,e)}debug(e){this.genericLog(On.debug,e)}genericLog(e,n){this.logger.genericLog(e,this.category,this.label,n)}get level(){return this.logger.level}set level(e){this.logger.level=e}},$S=class{constructor(){this.builtinEnabled=!0,this._level=On.log,this.loggers={},this.logger=this.getLogger("sip:loggerfactory")}get level(){return this._level}set level(e){e>=0&&e<=3?this._level=e:e>3?this._level=3:On.hasOwnProperty(e)?this._level=e:this.logger.error("invalid 'level' parameter value: "+JSON.stringify(e))}get connector(){return this._connector}set connector(e){e?typeof e=="function"?this._connector=e:this.logger.error("invalid 'connector' parameter value: "+JSON.stringify(e)):this._connector=void 0}getLogger(e,n){if(n&&this.level===3)return new Ng(this,e,n);if(this.loggers[e])return this.loggers[e];{const r=new Ng(this,e);return this.loggers[e]=r,r}}genericLog(e,n,r,i){this.level>=e&&this.builtinEnabled&&this.print(e,n,r,i),this.connector&&this.connector(On[e],n,r,i)}print(e,n,r,i){if(typeof i=="string"){const o=[new Date,n];r&&o.push(r),i=o.concat(i).join(" | ")}switch(e){case On.error:console.error(i);break;case On.warn:console.warn(i);case On.log:case On.debug:}}};function C0(t,e){if(e.statusCode<100||e.statusCode>699)throw new TypeError("Invalid statusCode: "+e.statusCode);const r=e.reasonPhrase?e.reasonPhrase:qA(e.statusCode);let i="SIP/2.0 "+e.statusCode+" "+r+`\r
115
115
  `;e.statusCode>=100&&e.statusCode,e.statusCode;const o="From: "+t.getHeader("From")+`\r
116
116
  `,a="Call-ID: "+t.callId+`\r
117
117
  `,s="CSeq: "+t.cseq+" "+t.method+`\r
@@ -126,8 +126,8 @@ React keys must be passed directly to JSX without using spread:
126
126
  `,i+=e.body.content):i+=`Content-Length: 0\r
127
127
  \r
128
128
  `,{message:i}}(function(t){function e(r,i){let o=i,a=0,s=0;if(r.substring(o,o+2).match(/(^\r\n)/))return-2;for(;a===0;){if(s=r.indexOf(`\r
129
- `,o),s===-1)return s;!r.substring(s+2,s+4).match(/(^\r\n)/)&&r.charAt(s+2).match(/(^\s+)/)?o=s+2:a=s}return a}function n(r,i,o,a){const s=i.indexOf(":",o),A=i.substring(o,s).trim(),c=i.substring(s+1,a).trim();let u;switch(A.toLowerCase()){case"via":case"v":r.addHeader("via",c),r.getHeaders("via").length===1?(u=r.parseHeader("Via"),u&&(r.via=u,r.viaBranch=u.branch)):u=0;break;case"from":case"f":r.setHeader("from",c),u=r.parseHeader("from"),u&&(r.from=u,r.fromTag=u.getParam("tag"));break;case"to":case"t":r.setHeader("to",c),u=r.parseHeader("to"),u&&(r.to=u,r.toTag=u.getParam("tag"));break;case"record-route":if(u=En.parse(c,"Record_Route"),u===-1){u=void 0;break}if(!(u instanceof Array)){u=void 0;break}u.forEach(d=>{r.addHeader("record-route",c.substring(d.position,d.offset)),r.headers["Record-Route"][r.getHeaders("record-route").length-1].parsed=d.parsed});break;case"call-id":case"i":r.setHeader("call-id",c),u=r.parseHeader("call-id"),u&&(r.callId=c);break;case"contact":case"m":if(u=En.parse(c,"Contact"),u===-1){u=void 0;break}if(!(u instanceof Array)){u=void 0;break}u.forEach(d=>{r.addHeader("contact",c.substring(d.position,d.offset)),r.headers.Contact[r.getHeaders("contact").length-1].parsed=d.parsed});break;case"content-length":case"l":r.setHeader("content-length",c),u=r.parseHeader("content-length");break;case"content-type":case"c":r.setHeader("content-type",c),u=r.parseHeader("content-type");break;case"cseq":r.setHeader("cseq",c),u=r.parseHeader("cseq"),u&&(r.cseq=u.value),r instanceof Fi&&(r.method=u.method);break;case"max-forwards":r.setHeader("max-forwards",c),u=r.parseHeader("max-forwards");break;case"www-authenticate":r.setHeader("www-authenticate",c),u=r.parseHeader("www-authenticate");break;case"proxy-authenticate":r.setHeader("proxy-authenticate",c),u=r.parseHeader("proxy-authenticate");break;case"refer-to":case"r":r.setHeader("refer-to",c),u=r.parseHeader("refer-to"),u&&(r.referTo=u);break;default:r.addHeader(A.toLowerCase(),c),u=0}return u!==void 0||{error:"error parsing header '"+A+"'"}}t.getHeader=e,t.parseHeader=n,t.parseMessage=function(r,i){let o=0,a=r.indexOf(`\r
130
- `);if(a===-1)return void i.warn("no CRLF found, not a SIP message, discarded");const s=r.substring(0,a),A=En.parse(s,"Request_Response");let c,u;if(A!==-1){for(A.status_code?(c=new Fi,c.statusCode=A.status_code,c.reasonPhrase=A.reason_phrase):(c=new Bo,c.method=A.method,c.ruri=A.uri),c.data=r,o=a+2;;){if(a=e(r,o),a===-2){u=o+2;break}if(a===-1)return void i.error("malformed message");const d=n(c,r,o,a);if(d&&d!==!0)return void i.error(d.error);o=a+2}return c.hasHeader("content-length")?c.body=r.substr(u,Number(c.getHeader("content-length"))):c.body=r.substring(u),c}i.warn('error parsing first line of SIP message: "'+s+'"')}})(Ws=Ws||(Ws={}));let Zc=class extends uo{constructor(e){super(e||"Unspecified transport error.")}},y0=class{constructor(e,n,r,i,o){this._transport=e,this._user=n,this._id=r,this._state=i,this.listeners=new Array,this.logger=n.loggerFactory.getLogger(o,r),this.logger.debug(`Constructing ${this.typeToString()} with id ${this.id}.`)}dispose(){this.logger.debug(`Destroyed ${this.typeToString()} with id ${this.id}.`)}get id(){return this._id}get kind(){throw new Error("Invalid kind.")}get state(){return this._state}get transport(){return this._transport}addStateChangeListener(e,n){const r=()=>{this.removeStateChangeListener(r),e()};(n==null?void 0:n.once)===!0?this.listeners.push(r):this.listeners.push(e)}notifyStateChangeListeners(){this.listeners.slice().forEach(e=>e())}removeStateChangeListener(e){this.listeners=this.listeners.filter(n=>n!==e)}logTransportError(e,n){this.logger.error(e.message),this.logger.error(`Transport error occurred in ${this.typeToString()} with id ${this.id}.`),this.logger.error(n)}send(e){return this.transport.send(e).catch(n=>{if(n instanceof Zc)throw this.onTransportError(n),n;let r;throw r=n&&typeof n.message=="string"?new Zc(n.message):new Zc,this.onTransportError(r),r})}setState(e){this.logger.debug(`State change to "${e}" on ${this.typeToString()} with id ${this.id}.`),this._state=e,this._user.onStateChange&&this._user.onStateChange(e),this.notifyStateChangeListeners()}typeToString(){return"UnknownType"}},E0=class extends y0{constructor(e,n,r,i,o){super(n,r,e.viaBranch,i,o),this._request=e,this.user=r}get request(){return this._request}};(function(t){t.Accepted="Accepted",t.Calling="Calling",t.Completed="Completed",t.Confirmed="Confirmed",t.Proceeding="Proceeding",t.Terminated="Terminated",t.Trying="Trying"})(oe=oe||(oe={}));let Xn=class extends E0{constructor(e,n,r){super(e,n,r,oe.Proceeding,"sip.transaction.ist")}dispose(){this.stopProgressExtensionTimer(),this.H&&(clearTimeout(this.H),this.H=void 0),this.I&&(clearTimeout(this.I),this.I=void 0),this.L&&(clearTimeout(this.L),this.L=void 0),super.dispose()}get kind(){return"ist"}receiveRequest(e){switch(this.state){case oe.Proceeding:if(e.method===Ye.INVITE)return void(this.lastProvisionalResponse&&this.send(this.lastProvisionalResponse).catch(r=>{this.logTransportError(r,"Failed to send retransmission of provisional response.")}));break;case oe.Accepted:if(e.method===Ye.INVITE)return;break;case oe.Completed:if(e.method===Ye.INVITE){if(!this.lastFinalResponse)throw new Error("Last final response undefined.");return void this.send(this.lastFinalResponse).catch(r=>{this.logTransportError(r,"Failed to send retransmission of final response.")})}if(e.method===Ye.ACK)return void this.stateTransition(oe.Confirmed);break;case oe.Confirmed:case oe.Terminated:if(e.method===Ye.INVITE||e.method===Ye.ACK)return;break;default:throw new Error(`Invalid state ${this.state}`)}const n=`INVITE server transaction received unexpected ${e.method} request while in state ${this.state}.`;this.logger.warn(n)}receiveResponse(e,n){if(e<100||e>699)throw new Error(`Invalid status code ${e}`);switch(this.state){case oe.Proceeding:if(e>=100&&e<=199)return this.lastProvisionalResponse=n,e>100&&this.startProgressExtensionTimer(),void this.send(n).catch(i=>{this.logTransportError(i,"Failed to send 1xx response.")});if(e>=200&&e<=299)return this.lastFinalResponse=n,this.stateTransition(oe.Accepted),void this.send(n).catch(i=>{this.logTransportError(i,"Failed to send 2xx response.")});if(e>=300&&e<=699)return this.lastFinalResponse=n,this.stateTransition(oe.Completed),void this.send(n).catch(i=>{this.logTransportError(i,"Failed to send non-2xx final response.")});break;case oe.Accepted:if(e>=200&&e<=299)return void this.send(n).catch(i=>{this.logTransportError(i,"Failed to send 2xx response.")});break;case oe.Completed:case oe.Confirmed:case oe.Terminated:break;default:throw new Error(`Invalid state ${this.state}`)}const r=`INVITE server transaction received unexpected ${e} response from TU while in state ${this.state}.`;throw this.logger.error(r),new Error(r)}retransmitAcceptedResponse(){this.state===oe.Accepted&&this.lastFinalResponse&&this.send(this.lastFinalResponse).catch(e=>{this.logTransportError(e,"Failed to send 2xx response.")})}onTransportError(e){this.user.onTransportError&&this.user.onTransportError(e)}typeToString(){return"INVITE server transaction"}stateTransition(e){const n=()=>{throw new Error(`Invalid state transition from ${this.state} to ${e}`)};switch(e){case oe.Proceeding:n();break;case oe.Accepted:case oe.Completed:this.state!==oe.Proceeding&&n();break;case oe.Confirmed:this.state!==oe.Completed&&n();break;case oe.Terminated:this.state!==oe.Accepted&&this.state!==oe.Completed&&this.state!==oe.Confirmed&&n();break;default:n()}this.stopProgressExtensionTimer(),e===oe.Accepted&&(this.L=setTimeout(()=>this.timerL(),Mn.TIMER_L)),e===oe.Completed&&(this.H=setTimeout(()=>this.timerH(),Mn.TIMER_H)),e===oe.Confirmed&&(this.I=setTimeout(()=>this.timerI(),Mn.TIMER_I)),e===oe.Terminated&&this.dispose(),this.setState(e)}startProgressExtensionTimer(){this.progressExtensionTimer===void 0&&(this.progressExtensionTimer=setInterval(()=>{if(this.logger.debug(`Progress extension timer expired for INVITE server transaction ${this.id}.`),!this.lastProvisionalResponse)throw new Error("Last provisional response undefined.");this.send(this.lastProvisionalResponse).catch(e=>{this.logTransportError(e,"Failed to send retransmission of provisional response.")})},Mn.PROVISIONAL_RESPONSE_INTERVAL))}stopProgressExtensionTimer(){this.progressExtensionTimer!==void 0&&(clearInterval(this.progressExtensionTimer),this.progressExtensionTimer=void 0)}timerG(){}timerH(){this.logger.debug(`Timer H expired for INVITE server transaction ${this.id}.`),this.state===oe.Completed&&(this.logger.warn("ACK to negative final response was never received, terminating transaction."),this.stateTransition(oe.Terminated))}timerI(){this.logger.debug(`Timer I expired for INVITE server transaction ${this.id}.`),this.stateTransition(oe.Terminated)}timerL(){this.logger.debug(`Timer L expired for INVITE server transaction ${this.id}.`),this.state===oe.Accepted&&this.stateTransition(oe.Terminated)}},b0=class S0 extends y0{constructor(e,n,r,i,o){super(n,r,S0.makeId(e),i,o),this._request=e,this.user=r,e.setViaHeader(this.id,n.protocol)}static makeId(e){if(e.method==="CANCEL"){if(!e.branch)throw new Error("Outgoing CANCEL request without a branch.");return e.branch}return"z9hG4bK"+Math.floor(1e7*Math.random())}get request(){return this._request}onRequestTimeout(){this.user.onRequestTimeout&&this.user.onRequestTimeout()}},ur=class extends b0{constructor(e,n,r){super(e,n,r,oe.Trying,"sip.transaction.nict"),this.F=setTimeout(()=>this.timerF(),Mn.TIMER_F),this.send(e.toString()).catch(i=>{this.logTransportError(i,"Failed to send initial outgoing request.")})}dispose(){this.F&&(clearTimeout(this.F),this.F=void 0),this.K&&(clearTimeout(this.K),this.K=void 0),super.dispose()}get kind(){return"nict"}receiveResponse(e){const n=e.statusCode;if(!n||n<100||n>699)throw new Error(`Invalid status code ${n}`);switch(this.state){case oe.Trying:if(n>=100&&n<=199)return this.stateTransition(oe.Proceeding),void(this.user.receiveResponse&&this.user.receiveResponse(e));if(n>=200&&n<=699)return this.stateTransition(oe.Completed),n===408?void this.onRequestTimeout():void(this.user.receiveResponse&&this.user.receiveResponse(e));break;case oe.Proceeding:if(n>=100&&n<=199&&this.user.receiveResponse)return this.user.receiveResponse(e);if(n>=200&&n<=699)return this.stateTransition(oe.Completed),n===408?void this.onRequestTimeout():void(this.user.receiveResponse&&this.user.receiveResponse(e));break;case oe.Completed:case oe.Terminated:return;default:throw new Error(`Invalid state ${this.state}`)}const r=`Non-INVITE client transaction received unexpected ${n} response while in state ${this.state}.`;this.logger.warn(r)}onTransportError(e){this.user.onTransportError&&this.user.onTransportError(e),this.stateTransition(oe.Terminated,!0)}typeToString(){return"non-INVITE client transaction"}stateTransition(e,n=!1){const r=()=>{throw new Error(`Invalid state transition from ${this.state} to ${e}`)};switch(e){case oe.Trying:r();break;case oe.Proceeding:this.state!==oe.Trying&&r();break;case oe.Completed:this.state!==oe.Trying&&this.state!==oe.Proceeding&&r();break;case oe.Terminated:this.state!==oe.Trying&&this.state!==oe.Proceeding&&this.state!==oe.Completed&&(n||r());break;default:r()}e===oe.Completed&&(this.F&&(clearTimeout(this.F),this.F=void 0),this.K=setTimeout(()=>this.timerK(),Mn.TIMER_K)),e===oe.Terminated&&this.dispose(),this.setState(e)}timerF(){this.logger.debug(`Timer F expired for non-INVITE client transaction ${this.id}.`),this.state!==oe.Trying&&this.state!==oe.Proceeding||(this.onRequestTimeout(),this.stateTransition(oe.Terminated))}timerK(){this.state===oe.Completed&&this.stateTransition(oe.Terminated)}},Ho=class{constructor(e,n){this.core=e,this.dialogState=n,this.core.dialogs.set(this.id,this)}static initialDialogStateForUserAgentClient(e,n){const r=n.getHeaders("record-route").reverse(),i=n.parseHeader("contact");if(!i)throw new Error("Contact undefined.");if(!(i instanceof $n))throw new Error("Contact not instance of NameAddrHeader.");const o=i.uri,a=e.cseq,s=e.callId,A=e.fromTag,c=n.toTag;if(!s)throw new Error("Call id undefined.");if(!A)throw new Error("From tag undefined.");if(!c)throw new Error("To tag undefined.");if(!e.from)throw new Error("From undefined.");if(!e.to)throw new Error("To undefined.");const u=e.from.uri,d=e.to.uri;if(!n.statusCode)throw new Error("Incoming response status code undefined.");return{id:s+A+c,early:n.statusCode<200,callId:s,localTag:A,remoteTag:c,localSequenceNumber:a,remoteSequenceNumber:void 0,localURI:u,remoteURI:d,remoteTarget:o,routeSet:r,secure:!1}}static initialDialogStateForUserAgentServer(e,n,r=!1){const i=e.getHeaders("record-route"),o=e.parseHeader("contact");if(!o)throw new Error("Contact undefined.");if(!(o instanceof $n))throw new Error("Contact not instance of NameAddrHeader.");const a=o.uri,s=e.cseq,A=e.callId,c=n,u=e.fromTag,d=e.from.uri;return{id:A+c+u,early:r,callId:A,localTag:c,remoteTag:u,localSequenceNumber:void 0,remoteSequenceNumber:s,localURI:e.to.uri,remoteURI:d,remoteTarget:a,routeSet:i,secure:!1}}dispose(){this.core.dialogs.delete(this.id)}get id(){return this.dialogState.id}get early(){return this.dialogState.early}get callId(){return this.dialogState.callId}get localTag(){return this.dialogState.localTag}get remoteTag(){return this.dialogState.remoteTag}get localSequenceNumber(){return this.dialogState.localSequenceNumber}get remoteSequenceNumber(){return this.dialogState.remoteSequenceNumber}get localURI(){return this.dialogState.localURI}get remoteURI(){return this.dialogState.remoteURI}get remoteTarget(){return this.dialogState.remoteTarget}get routeSet(){return this.dialogState.routeSet}get secure(){return this.dialogState.secure}get userAgentCore(){return this.core}confirm(){this.dialogState.early=!1}receiveRequest(e){if(e.method!==Ye.ACK){if(this.remoteSequenceNumber){if(e.cseq<=this.remoteSequenceNumber)throw new Error("Out of sequence in dialog request. Did you forget to call sequenceGuard()?");this.dialogState.remoteSequenceNumber=e.cseq}this.remoteSequenceNumber||(this.dialogState.remoteSequenceNumber=e.cseq)}}recomputeRouteSet(e){this.dialogState.routeSet=e.getHeaders("record-route").reverse()}createOutgoingRequestMessage(e,n){const r=this.remoteURI,i=this.remoteTag,o=this.localURI,a=this.localTag,s=this.callId;let A;A=n&&n.cseq?n.cseq:this.dialogState.localSequenceNumber?this.dialogState.localSequenceNumber+=1:this.dialogState.localSequenceNumber=1;const c=this.remoteTarget,u=this.routeSet,d=n&&n.extraHeaders,f=n&&n.body;return this.userAgentCore.makeOutgoingRequestMessage(e,c,o,r,{callId:s,cseq:A,fromTag:a,toTag:i,routeSet:u},d,f)}incrementLocalSequenceNumber(){if(!this.dialogState.localSequenceNumber)throw new Error("Local sequence number undefined.");this.dialogState.localSequenceNumber+=1}sequenceGuard(e){return e.method===Ye.ACK||!(this.remoteSequenceNumber&&e.cseq<=this.remoteSequenceNumber)||(this.core.replyStateless(e,{statusCode:500}),!1)}},Ti=class extends b0{constructor(e,n,r){super(e,n,r,oe.Calling,"sip.transaction.ict"),this.ackRetransmissionCache=new Map,this.B=setTimeout(()=>this.timerB(),Mn.TIMER_B),this.send(e.toString()).catch(i=>{this.logTransportError(i,"Failed to send initial outgoing request.")})}dispose(){this.B&&(clearTimeout(this.B),this.B=void 0),this.D&&(clearTimeout(this.D),this.D=void 0),this.M&&(clearTimeout(this.M),this.M=void 0),super.dispose()}get kind(){return"ict"}ackResponse(e){const n=e.toTag;if(!n)throw new Error("To tag undefined.");const r="z9hG4bK"+Math.floor(1e7*Math.random());e.setViaHeader(r,this.transport.protocol),this.ackRetransmissionCache.set(n,e),this.send(e.toString()).catch(i=>{this.logTransportError(i,"Failed to send ACK to 2xx response.")})}receiveResponse(e){const n=e.statusCode;if(!n||n<100||n>699)throw new Error(`Invalid status code ${n}`);switch(this.state){case oe.Calling:if(n>=100&&n<=199)return this.stateTransition(oe.Proceeding),void(this.user.receiveResponse&&this.user.receiveResponse(e));if(n>=200&&n<=299)return this.ackRetransmissionCache.set(e.toTag,void 0),this.stateTransition(oe.Accepted),void(this.user.receiveResponse&&this.user.receiveResponse(e));if(n>=300&&n<=699)return this.stateTransition(oe.Completed),this.ack(e),void(this.user.receiveResponse&&this.user.receiveResponse(e));break;case oe.Proceeding:if(n>=100&&n<=199)return void(this.user.receiveResponse&&this.user.receiveResponse(e));if(n>=200&&n<=299)return this.ackRetransmissionCache.set(e.toTag,void 0),this.stateTransition(oe.Accepted),void(this.user.receiveResponse&&this.user.receiveResponse(e));if(n>=300&&n<=699)return this.stateTransition(oe.Completed),this.ack(e),void(this.user.receiveResponse&&this.user.receiveResponse(e));break;case oe.Accepted:if(n>=200&&n<=299){if(!this.ackRetransmissionCache.has(e.toTag))return this.ackRetransmissionCache.set(e.toTag,void 0),void(this.user.receiveResponse&&this.user.receiveResponse(e));const i=this.ackRetransmissionCache.get(e.toTag);return i?void this.send(i.toString()).catch(o=>{this.logTransportError(o,"Failed to send retransmission of ACK to 2xx response.")}):void 0}break;case oe.Completed:if(n>=300&&n<=699)return void this.ack(e);break;case oe.Terminated:break;default:throw new Error(`Invalid state ${this.state}`)}const r=`Received unexpected ${n} response while in state ${this.state}.`;this.logger.warn(r)}onTransportError(e){this.user.onTransportError&&this.user.onTransportError(e),this.stateTransition(oe.Terminated,!0)}typeToString(){return"INVITE client transaction"}ack(e){const n=this.request.ruri,r=this.request.callId,i=this.request.cseq,o=this.request.getHeader("from"),a=e.getHeader("to"),s=this.request.getHeader("via"),A=this.request.getHeader("route");if(!o)throw new Error("From undefined.");if(!a)throw new Error("To undefined.");if(!s)throw new Error("Via undefined.");let c=`ACK ${n} SIP/2.0\r
129
+ `,o),s===-1)return s;!r.substring(s+2,s+4).match(/(^\r\n)/)&&r.charAt(s+2).match(/(^\s+)/)?o=s+2:a=s}return a}function n(r,i,o,a){const s=i.indexOf(":",o),A=i.substring(o,s).trim(),c=i.substring(s+1,a).trim();let u;switch(A.toLowerCase()){case"via":case"v":r.addHeader("via",c),r.getHeaders("via").length===1?(u=r.parseHeader("Via"),u&&(r.via=u,r.viaBranch=u.branch)):u=0;break;case"from":case"f":r.setHeader("from",c),u=r.parseHeader("from"),u&&(r.from=u,r.fromTag=u.getParam("tag"));break;case"to":case"t":r.setHeader("to",c),u=r.parseHeader("to"),u&&(r.to=u,r.toTag=u.getParam("tag"));break;case"record-route":if(u=bn.parse(c,"Record_Route"),u===-1){u=void 0;break}if(!(u instanceof Array)){u=void 0;break}u.forEach(d=>{r.addHeader("record-route",c.substring(d.position,d.offset)),r.headers["Record-Route"][r.getHeaders("record-route").length-1].parsed=d.parsed});break;case"call-id":case"i":r.setHeader("call-id",c),u=r.parseHeader("call-id"),u&&(r.callId=c);break;case"contact":case"m":if(u=bn.parse(c,"Contact"),u===-1){u=void 0;break}if(!(u instanceof Array)){u=void 0;break}u.forEach(d=>{r.addHeader("contact",c.substring(d.position,d.offset)),r.headers.Contact[r.getHeaders("contact").length-1].parsed=d.parsed});break;case"content-length":case"l":r.setHeader("content-length",c),u=r.parseHeader("content-length");break;case"content-type":case"c":r.setHeader("content-type",c),u=r.parseHeader("content-type");break;case"cseq":r.setHeader("cseq",c),u=r.parseHeader("cseq"),u&&(r.cseq=u.value),r instanceof Fi&&(r.method=u.method);break;case"max-forwards":r.setHeader("max-forwards",c),u=r.parseHeader("max-forwards");break;case"www-authenticate":r.setHeader("www-authenticate",c),u=r.parseHeader("www-authenticate");break;case"proxy-authenticate":r.setHeader("proxy-authenticate",c),u=r.parseHeader("proxy-authenticate");break;case"refer-to":case"r":r.setHeader("refer-to",c),u=r.parseHeader("refer-to"),u&&(r.referTo=u);break;default:r.addHeader(A.toLowerCase(),c),u=0}return u!==void 0||{error:"error parsing header '"+A+"'"}}t.getHeader=e,t.parseHeader=n,t.parseMessage=function(r,i){let o=0,a=r.indexOf(`\r
130
+ `);if(a===-1)return void i.warn("no CRLF found, not a SIP message, discarded");const s=r.substring(0,a),A=bn.parse(s,"Request_Response");let c,u;if(A!==-1){for(A.status_code?(c=new Fi,c.statusCode=A.status_code,c.reasonPhrase=A.reason_phrase):(c=new Bo,c.method=A.method,c.ruri=A.uri),c.data=r,o=a+2;;){if(a=e(r,o),a===-2){u=o+2;break}if(a===-1)return void i.error("malformed message");const d=n(c,r,o,a);if(d&&d!==!0)return void i.error(d.error);o=a+2}return c.hasHeader("content-length")?c.body=r.substr(u,Number(c.getHeader("content-length"))):c.body=r.substring(u),c}i.warn('error parsing first line of SIP message: "'+s+'"')}})(Ws=Ws||(Ws={}));let Zc=class extends uo{constructor(e){super(e||"Unspecified transport error.")}},y0=class{constructor(e,n,r,i,o){this._transport=e,this._user=n,this._id=r,this._state=i,this.listeners=new Array,this.logger=n.loggerFactory.getLogger(o,r),this.logger.debug(`Constructing ${this.typeToString()} with id ${this.id}.`)}dispose(){this.logger.debug(`Destroyed ${this.typeToString()} with id ${this.id}.`)}get id(){return this._id}get kind(){throw new Error("Invalid kind.")}get state(){return this._state}get transport(){return this._transport}addStateChangeListener(e,n){const r=()=>{this.removeStateChangeListener(r),e()};(n==null?void 0:n.once)===!0?this.listeners.push(r):this.listeners.push(e)}notifyStateChangeListeners(){this.listeners.slice().forEach(e=>e())}removeStateChangeListener(e){this.listeners=this.listeners.filter(n=>n!==e)}logTransportError(e,n){this.logger.error(e.message),this.logger.error(`Transport error occurred in ${this.typeToString()} with id ${this.id}.`),this.logger.error(n)}send(e){return this.transport.send(e).catch(n=>{if(n instanceof Zc)throw this.onTransportError(n),n;let r;throw r=n&&typeof n.message=="string"?new Zc(n.message):new Zc,this.onTransportError(r),r})}setState(e){this.logger.debug(`State change to "${e}" on ${this.typeToString()} with id ${this.id}.`),this._state=e,this._user.onStateChange&&this._user.onStateChange(e),this.notifyStateChangeListeners()}typeToString(){return"UnknownType"}},E0=class extends y0{constructor(e,n,r,i,o){super(n,r,e.viaBranch,i,o),this._request=e,this.user=r}get request(){return this._request}};(function(t){t.Accepted="Accepted",t.Calling="Calling",t.Completed="Completed",t.Confirmed="Confirmed",t.Proceeding="Proceeding",t.Terminated="Terminated",t.Trying="Trying"})(oe=oe||(oe={}));let Xn=class extends E0{constructor(e,n,r){super(e,n,r,oe.Proceeding,"sip.transaction.ist")}dispose(){this.stopProgressExtensionTimer(),this.H&&(clearTimeout(this.H),this.H=void 0),this.I&&(clearTimeout(this.I),this.I=void 0),this.L&&(clearTimeout(this.L),this.L=void 0),super.dispose()}get kind(){return"ist"}receiveRequest(e){switch(this.state){case oe.Proceeding:if(e.method===Ye.INVITE)return void(this.lastProvisionalResponse&&this.send(this.lastProvisionalResponse).catch(r=>{this.logTransportError(r,"Failed to send retransmission of provisional response.")}));break;case oe.Accepted:if(e.method===Ye.INVITE)return;break;case oe.Completed:if(e.method===Ye.INVITE){if(!this.lastFinalResponse)throw new Error("Last final response undefined.");return void this.send(this.lastFinalResponse).catch(r=>{this.logTransportError(r,"Failed to send retransmission of final response.")})}if(e.method===Ye.ACK)return void this.stateTransition(oe.Confirmed);break;case oe.Confirmed:case oe.Terminated:if(e.method===Ye.INVITE||e.method===Ye.ACK)return;break;default:throw new Error(`Invalid state ${this.state}`)}const n=`INVITE server transaction received unexpected ${e.method} request while in state ${this.state}.`;this.logger.warn(n)}receiveResponse(e,n){if(e<100||e>699)throw new Error(`Invalid status code ${e}`);switch(this.state){case oe.Proceeding:if(e>=100&&e<=199)return this.lastProvisionalResponse=n,e>100&&this.startProgressExtensionTimer(),void this.send(n).catch(i=>{this.logTransportError(i,"Failed to send 1xx response.")});if(e>=200&&e<=299)return this.lastFinalResponse=n,this.stateTransition(oe.Accepted),void this.send(n).catch(i=>{this.logTransportError(i,"Failed to send 2xx response.")});if(e>=300&&e<=699)return this.lastFinalResponse=n,this.stateTransition(oe.Completed),void this.send(n).catch(i=>{this.logTransportError(i,"Failed to send non-2xx final response.")});break;case oe.Accepted:if(e>=200&&e<=299)return void this.send(n).catch(i=>{this.logTransportError(i,"Failed to send 2xx response.")});break;case oe.Completed:case oe.Confirmed:case oe.Terminated:break;default:throw new Error(`Invalid state ${this.state}`)}const r=`INVITE server transaction received unexpected ${e} response from TU while in state ${this.state}.`;throw this.logger.error(r),new Error(r)}retransmitAcceptedResponse(){this.state===oe.Accepted&&this.lastFinalResponse&&this.send(this.lastFinalResponse).catch(e=>{this.logTransportError(e,"Failed to send 2xx response.")})}onTransportError(e){this.user.onTransportError&&this.user.onTransportError(e)}typeToString(){return"INVITE server transaction"}stateTransition(e){const n=()=>{throw new Error(`Invalid state transition from ${this.state} to ${e}`)};switch(e){case oe.Proceeding:n();break;case oe.Accepted:case oe.Completed:this.state!==oe.Proceeding&&n();break;case oe.Confirmed:this.state!==oe.Completed&&n();break;case oe.Terminated:this.state!==oe.Accepted&&this.state!==oe.Completed&&this.state!==oe.Confirmed&&n();break;default:n()}this.stopProgressExtensionTimer(),e===oe.Accepted&&(this.L=setTimeout(()=>this.timerL(),Mn.TIMER_L)),e===oe.Completed&&(this.H=setTimeout(()=>this.timerH(),Mn.TIMER_H)),e===oe.Confirmed&&(this.I=setTimeout(()=>this.timerI(),Mn.TIMER_I)),e===oe.Terminated&&this.dispose(),this.setState(e)}startProgressExtensionTimer(){this.progressExtensionTimer===void 0&&(this.progressExtensionTimer=setInterval(()=>{if(this.logger.debug(`Progress extension timer expired for INVITE server transaction ${this.id}.`),!this.lastProvisionalResponse)throw new Error("Last provisional response undefined.");this.send(this.lastProvisionalResponse).catch(e=>{this.logTransportError(e,"Failed to send retransmission of provisional response.")})},Mn.PROVISIONAL_RESPONSE_INTERVAL))}stopProgressExtensionTimer(){this.progressExtensionTimer!==void 0&&(clearInterval(this.progressExtensionTimer),this.progressExtensionTimer=void 0)}timerG(){}timerH(){this.logger.debug(`Timer H expired for INVITE server transaction ${this.id}.`),this.state===oe.Completed&&(this.logger.warn("ACK to negative final response was never received, terminating transaction."),this.stateTransition(oe.Terminated))}timerI(){this.logger.debug(`Timer I expired for INVITE server transaction ${this.id}.`),this.stateTransition(oe.Terminated)}timerL(){this.logger.debug(`Timer L expired for INVITE server transaction ${this.id}.`),this.state===oe.Accepted&&this.stateTransition(oe.Terminated)}},b0=class S0 extends y0{constructor(e,n,r,i,o){super(n,r,S0.makeId(e),i,o),this._request=e,this.user=r,e.setViaHeader(this.id,n.protocol)}static makeId(e){if(e.method==="CANCEL"){if(!e.branch)throw new Error("Outgoing CANCEL request without a branch.");return e.branch}return"z9hG4bK"+Math.floor(1e7*Math.random())}get request(){return this._request}onRequestTimeout(){this.user.onRequestTimeout&&this.user.onRequestTimeout()}},ur=class extends b0{constructor(e,n,r){super(e,n,r,oe.Trying,"sip.transaction.nict"),this.F=setTimeout(()=>this.timerF(),Mn.TIMER_F),this.send(e.toString()).catch(i=>{this.logTransportError(i,"Failed to send initial outgoing request.")})}dispose(){this.F&&(clearTimeout(this.F),this.F=void 0),this.K&&(clearTimeout(this.K),this.K=void 0),super.dispose()}get kind(){return"nict"}receiveResponse(e){const n=e.statusCode;if(!n||n<100||n>699)throw new Error(`Invalid status code ${n}`);switch(this.state){case oe.Trying:if(n>=100&&n<=199)return this.stateTransition(oe.Proceeding),void(this.user.receiveResponse&&this.user.receiveResponse(e));if(n>=200&&n<=699)return this.stateTransition(oe.Completed),n===408?void this.onRequestTimeout():void(this.user.receiveResponse&&this.user.receiveResponse(e));break;case oe.Proceeding:if(n>=100&&n<=199&&this.user.receiveResponse)return this.user.receiveResponse(e);if(n>=200&&n<=699)return this.stateTransition(oe.Completed),n===408?void this.onRequestTimeout():void(this.user.receiveResponse&&this.user.receiveResponse(e));break;case oe.Completed:case oe.Terminated:return;default:throw new Error(`Invalid state ${this.state}`)}const r=`Non-INVITE client transaction received unexpected ${n} response while in state ${this.state}.`;this.logger.warn(r)}onTransportError(e){this.user.onTransportError&&this.user.onTransportError(e),this.stateTransition(oe.Terminated,!0)}typeToString(){return"non-INVITE client transaction"}stateTransition(e,n=!1){const r=()=>{throw new Error(`Invalid state transition from ${this.state} to ${e}`)};switch(e){case oe.Trying:r();break;case oe.Proceeding:this.state!==oe.Trying&&r();break;case oe.Completed:this.state!==oe.Trying&&this.state!==oe.Proceeding&&r();break;case oe.Terminated:this.state!==oe.Trying&&this.state!==oe.Proceeding&&this.state!==oe.Completed&&(n||r());break;default:r()}e===oe.Completed&&(this.F&&(clearTimeout(this.F),this.F=void 0),this.K=setTimeout(()=>this.timerK(),Mn.TIMER_K)),e===oe.Terminated&&this.dispose(),this.setState(e)}timerF(){this.logger.debug(`Timer F expired for non-INVITE client transaction ${this.id}.`),this.state!==oe.Trying&&this.state!==oe.Proceeding||(this.onRequestTimeout(),this.stateTransition(oe.Terminated))}timerK(){this.state===oe.Completed&&this.stateTransition(oe.Terminated)}},Ho=class{constructor(e,n){this.core=e,this.dialogState=n,this.core.dialogs.set(this.id,this)}static initialDialogStateForUserAgentClient(e,n){const r=n.getHeaders("record-route").reverse(),i=n.parseHeader("contact");if(!i)throw new Error("Contact undefined.");if(!(i instanceof $n))throw new Error("Contact not instance of NameAddrHeader.");const o=i.uri,a=e.cseq,s=e.callId,A=e.fromTag,c=n.toTag;if(!s)throw new Error("Call id undefined.");if(!A)throw new Error("From tag undefined.");if(!c)throw new Error("To tag undefined.");if(!e.from)throw new Error("From undefined.");if(!e.to)throw new Error("To undefined.");const u=e.from.uri,d=e.to.uri;if(!n.statusCode)throw new Error("Incoming response status code undefined.");return{id:s+A+c,early:n.statusCode<200,callId:s,localTag:A,remoteTag:c,localSequenceNumber:a,remoteSequenceNumber:void 0,localURI:u,remoteURI:d,remoteTarget:o,routeSet:r,secure:!1}}static initialDialogStateForUserAgentServer(e,n,r=!1){const i=e.getHeaders("record-route"),o=e.parseHeader("contact");if(!o)throw new Error("Contact undefined.");if(!(o instanceof $n))throw new Error("Contact not instance of NameAddrHeader.");const a=o.uri,s=e.cseq,A=e.callId,c=n,u=e.fromTag,d=e.from.uri;return{id:A+c+u,early:r,callId:A,localTag:c,remoteTag:u,localSequenceNumber:void 0,remoteSequenceNumber:s,localURI:e.to.uri,remoteURI:d,remoteTarget:a,routeSet:i,secure:!1}}dispose(){this.core.dialogs.delete(this.id)}get id(){return this.dialogState.id}get early(){return this.dialogState.early}get callId(){return this.dialogState.callId}get localTag(){return this.dialogState.localTag}get remoteTag(){return this.dialogState.remoteTag}get localSequenceNumber(){return this.dialogState.localSequenceNumber}get remoteSequenceNumber(){return this.dialogState.remoteSequenceNumber}get localURI(){return this.dialogState.localURI}get remoteURI(){return this.dialogState.remoteURI}get remoteTarget(){return this.dialogState.remoteTarget}get routeSet(){return this.dialogState.routeSet}get secure(){return this.dialogState.secure}get userAgentCore(){return this.core}confirm(){this.dialogState.early=!1}receiveRequest(e){if(e.method!==Ye.ACK){if(this.remoteSequenceNumber){if(e.cseq<=this.remoteSequenceNumber)throw new Error("Out of sequence in dialog request. Did you forget to call sequenceGuard()?");this.dialogState.remoteSequenceNumber=e.cseq}this.remoteSequenceNumber||(this.dialogState.remoteSequenceNumber=e.cseq)}}recomputeRouteSet(e){this.dialogState.routeSet=e.getHeaders("record-route").reverse()}createOutgoingRequestMessage(e,n){const r=this.remoteURI,i=this.remoteTag,o=this.localURI,a=this.localTag,s=this.callId;let A;A=n&&n.cseq?n.cseq:this.dialogState.localSequenceNumber?this.dialogState.localSequenceNumber+=1:this.dialogState.localSequenceNumber=1;const c=this.remoteTarget,u=this.routeSet,d=n&&n.extraHeaders,f=n&&n.body;return this.userAgentCore.makeOutgoingRequestMessage(e,c,o,r,{callId:s,cseq:A,fromTag:a,toTag:i,routeSet:u},d,f)}incrementLocalSequenceNumber(){if(!this.dialogState.localSequenceNumber)throw new Error("Local sequence number undefined.");this.dialogState.localSequenceNumber+=1}sequenceGuard(e){return e.method===Ye.ACK||!(this.remoteSequenceNumber&&e.cseq<=this.remoteSequenceNumber)||(this.core.replyStateless(e,{statusCode:500}),!1)}},Ti=class extends b0{constructor(e,n,r){super(e,n,r,oe.Calling,"sip.transaction.ict"),this.ackRetransmissionCache=new Map,this.B=setTimeout(()=>this.timerB(),Mn.TIMER_B),this.send(e.toString()).catch(i=>{this.logTransportError(i,"Failed to send initial outgoing request.")})}dispose(){this.B&&(clearTimeout(this.B),this.B=void 0),this.D&&(clearTimeout(this.D),this.D=void 0),this.M&&(clearTimeout(this.M),this.M=void 0),super.dispose()}get kind(){return"ict"}ackResponse(e){const n=e.toTag;if(!n)throw new Error("To tag undefined.");const r="z9hG4bK"+Math.floor(1e7*Math.random());e.setViaHeader(r,this.transport.protocol),this.ackRetransmissionCache.set(n,e),this.send(e.toString()).catch(i=>{this.logTransportError(i,"Failed to send ACK to 2xx response.")})}receiveResponse(e){const n=e.statusCode;if(!n||n<100||n>699)throw new Error(`Invalid status code ${n}`);switch(this.state){case oe.Calling:if(n>=100&&n<=199)return this.stateTransition(oe.Proceeding),void(this.user.receiveResponse&&this.user.receiveResponse(e));if(n>=200&&n<=299)return this.ackRetransmissionCache.set(e.toTag,void 0),this.stateTransition(oe.Accepted),void(this.user.receiveResponse&&this.user.receiveResponse(e));if(n>=300&&n<=699)return this.stateTransition(oe.Completed),this.ack(e),void(this.user.receiveResponse&&this.user.receiveResponse(e));break;case oe.Proceeding:if(n>=100&&n<=199)return void(this.user.receiveResponse&&this.user.receiveResponse(e));if(n>=200&&n<=299)return this.ackRetransmissionCache.set(e.toTag,void 0),this.stateTransition(oe.Accepted),void(this.user.receiveResponse&&this.user.receiveResponse(e));if(n>=300&&n<=699)return this.stateTransition(oe.Completed),this.ack(e),void(this.user.receiveResponse&&this.user.receiveResponse(e));break;case oe.Accepted:if(n>=200&&n<=299){if(!this.ackRetransmissionCache.has(e.toTag))return this.ackRetransmissionCache.set(e.toTag,void 0),void(this.user.receiveResponse&&this.user.receiveResponse(e));const i=this.ackRetransmissionCache.get(e.toTag);return i?void this.send(i.toString()).catch(o=>{this.logTransportError(o,"Failed to send retransmission of ACK to 2xx response.")}):void 0}break;case oe.Completed:if(n>=300&&n<=699)return void this.ack(e);break;case oe.Terminated:break;default:throw new Error(`Invalid state ${this.state}`)}const r=`Received unexpected ${n} response while in state ${this.state}.`;this.logger.warn(r)}onTransportError(e){this.user.onTransportError&&this.user.onTransportError(e),this.stateTransition(oe.Terminated,!0)}typeToString(){return"INVITE client transaction"}ack(e){const n=this.request.ruri,r=this.request.callId,i=this.request.cseq,o=this.request.getHeader("from"),a=e.getHeader("to"),s=this.request.getHeader("via"),A=this.request.getHeader("route");if(!o)throw new Error("From undefined.");if(!a)throw new Error("To undefined.");if(!s)throw new Error("Via undefined.");let c=`ACK ${n} SIP/2.0\r
131
131
  `;A&&(c+=`Route: ${A}\r
132
132
  `),c+=`Via: ${s}\r
133
133
  `,c+=`To: ${a}\r
@@ -141,7 +141,7 @@ React keys must be passed directly to JSX without using spread:
141
141
  `:return"inactive";case`a=recvonly\r
142
142
  `:return"recvonly";case`a=sendonly\r
143
143
  `:return"sendonly";case`a=sendrecv\r
144
- `:return"sendrecv";default:throw new Error("Should never happen")}return"sendrecv"})(),r=(()=>{switch(n){case"inactive":return"inactive";case"recvonly":return"sendonly";case"sendonly":return e!=null&&e.hold?"inactive":"recvonly";case"sendrecv":return e!=null&&e.hold?"sendonly":"sendrecv";default:throw new Error("Should never happen")}})();this._peerConnection.getTransceivers().forEach(i=>{i.direction&&i.direction!=="stopped"&&i.direction!==r&&(i.direction=r)})}break;default:return Promise.reject(new Error("Invalid signaling state "+this._peerConnection.signalingState))}return Promise.resolve()}waitForIceGatheringComplete(e=!1,n=0){return this.logger.debug("SessionDescriptionHandler.waitForIceGatheringToComplete"),this._peerConnection===void 0?Promise.reject("Peer connection closed."):e||this._peerConnection.iceGatheringState!=="complete"?(this.iceGatheringCompletePromise!==void 0&&(this.logger.debug("SessionDescriptionHandler.waitForIceGatheringToComplete - rejecting prior waiting promise"),this.iceGatheringCompleteReject&&this.iceGatheringCompleteReject(new Error("Promise superseded.")),this.iceGatheringCompletePromise=void 0,this.iceGatheringCompleteResolve=void 0,this.iceGatheringCompleteReject=void 0),this.iceGatheringCompletePromise=new Promise((r,i)=>{this.iceGatheringCompleteResolve=r,this.iceGatheringCompleteReject=i,n>0&&(this.logger.debug("SessionDescriptionHandler.waitForIceGatheringToComplete - timeout in "+n),this.iceGatheringCompleteTimeoutId=setTimeout(()=>{this.logger.debug("SessionDescriptionHandler.waitForIceGatheringToComplete - timeout"),this.iceGatheringComplete()},n))}),this.iceGatheringCompletePromise):(this.logger.debug("SessionDescriptionHandler.waitForIceGatheringToComplete - already complete"),Promise.resolve())}initPeerConnectionEventHandlers(){if(this.logger.debug("SessionDescriptionHandler.initPeerConnectionEventHandlers"),!this._peerConnection)throw new Error("Peer connection undefined.");const e=this._peerConnection;e.onconnectionstatechange=n=>{var r;const i=e.connectionState;this.logger.debug(`SessionDescriptionHandler.onconnectionstatechange ${i}`),!((r=this._peerConnectionDelegate)===null||r===void 0)&&r.onconnectionstatechange&&this._peerConnectionDelegate.onconnectionstatechange(n)},e.ondatachannel=n=>{var r;this.logger.debug("SessionDescriptionHandler.ondatachannel"),this._dataChannel=n.channel,this.onDataChannel&&this.onDataChannel(this._dataChannel),!((r=this._peerConnectionDelegate)===null||r===void 0)&&r.ondatachannel&&this._peerConnectionDelegate.ondatachannel(n)},e.onicecandidate=n=>{var r;this.logger.debug("SessionDescriptionHandler.onicecandidate"),!((r=this._peerConnectionDelegate)===null||r===void 0)&&r.onicecandidate&&this._peerConnectionDelegate.onicecandidate(n)},e.onicecandidateerror=n=>{var r;this.logger.debug("SessionDescriptionHandler.onicecandidateerror"),!((r=this._peerConnectionDelegate)===null||r===void 0)&&r.onicecandidateerror&&this._peerConnectionDelegate.onicecandidateerror(n)},e.oniceconnectionstatechange=n=>{var r;const i=e.iceConnectionState;this.logger.debug(`SessionDescriptionHandler.oniceconnectionstatechange ${i}`),!((r=this._peerConnectionDelegate)===null||r===void 0)&&r.oniceconnectionstatechange&&this._peerConnectionDelegate.oniceconnectionstatechange(n)},e.onicegatheringstatechange=n=>{var r;const i=e.iceGatheringState;this.logger.debug(`SessionDescriptionHandler.onicegatheringstatechange ${i}`),i==="complete"&&this.iceGatheringComplete(),!((r=this._peerConnectionDelegate)===null||r===void 0)&&r.onicegatheringstatechange&&this._peerConnectionDelegate.onicegatheringstatechange(n)},e.onnegotiationneeded=n=>{var r;this.logger.debug("SessionDescriptionHandler.onnegotiationneeded"),!((r=this._peerConnectionDelegate)===null||r===void 0)&&r.onnegotiationneeded&&this._peerConnectionDelegate.onnegotiationneeded(n)},e.onsignalingstatechange=n=>{var r;const i=e.signalingState;this.logger.debug(`SessionDescriptionHandler.onsignalingstatechange ${i}`),!((r=this._peerConnectionDelegate)===null||r===void 0)&&r.onsignalingstatechange&&this._peerConnectionDelegate.onsignalingstatechange(n)},e.ontrack=n=>{var r;const i=n.track.kind,o=n.track.enabled?"enabled":"disabled";this.logger.debug(`SessionDescriptionHandler.ontrack ${i} ${o}`),this.setRemoteTrack(n.track),!((r=this._peerConnectionDelegate)===null||r===void 0)&&r.ontrack&&this._peerConnectionDelegate.ontrack(n)}}}function mw(t){return(e,n)=>{t===void 0&&(t=o=>o.audio||o.video?navigator.mediaDevices===void 0?Promise.reject(new Error("Media devices not available in insecure contexts.")):navigator.mediaDevices.getUserMedia.call(navigator.mediaDevices,o):Promise.resolve(new MediaStream));const r={iceGatheringTimeout:(n==null?void 0:n.iceGatheringTimeout)!==void 0?n==null?void 0:n.iceGatheringTimeout:5e3,peerConnectionConfiguration:Object.assign(Object.assign({},{bundlePolicy:"balanced",certificates:void 0,iceCandidatePoolSize:0,iceServers:[{urls:"stun:stun.l.google.com:19302"}],iceTransportPolicy:"all",rtcpMuxPolicy:"require"}),n==null?void 0:n.peerConnectionConfiguration)},i=e.userAgent.getLogger("sip.SessionDescriptionHandler");return new ii(i,t,r)}}let R0=class O0{constructor(e,n){if(this._state=dt.Disconnected,this.transitioningState=!1,this._stateEventEmitter=new Pa,this.logger=e,n){const o=n,a=o==null?void 0:o.wsServers,s=o==null?void 0:o.maxReconnectionAttempts;a!==void 0&&this.logger.warn('The transport option "wsServers" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.'),s!==void 0&&this.logger.warn('The transport option "maxReconnectionAttempts" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.'),a&&!n.server&&(typeof a=="string"&&(n.server=a),a instanceof Array&&(n.server=a[0]))}this.configuration=Object.assign(Object.assign({},O0.defaultOptions),n);const r=this.configuration.server,i=En.parse(r,"absoluteURI");if(i===-1)throw this.logger.error(`Invalid WebSocket Server URL "${r}"`),new Error("Invalid WebSocket Server URL");if(!["wss","ws","udp"].includes(i.scheme))throw this.logger.error(`Invalid scheme in WebSocket Server URL "${r}"`),new Error("Invalid scheme in WebSocket Server URL");this._protocol=i.scheme.toUpperCase()}dispose(){return this.disconnect()}get protocol(){return this._protocol}get server(){return this.configuration.server}get state(){return this._state}get stateChange(){return this._stateEventEmitter}get ws(){return this._ws}connect(){return this._connect()}disconnect(){return this._disconnect()}isConnected(){return this.state===dt.Connected}send(e){return this._send(e)}_connect(){switch(this.logger.log(`Connecting ${this.server}`),this.state){case dt.Connecting:if(this.transitioningState)return Promise.reject(this.transitionLoopDetectedError(dt.Connecting));if(!this.connectPromise)throw new Error("Connect promise must be defined.");return this.connectPromise;case dt.Connected:if(this.transitioningState)return Promise.reject(this.transitionLoopDetectedError(dt.Connecting));if(this.connectPromise)throw new Error("Connect promise must not be defined.");return Promise.resolve();case dt.Disconnecting:if(this.connectPromise)throw new Error("Connect promise must not be defined.");try{this.transitionState(dt.Connecting)}catch(n){if(n instanceof ca)return Promise.reject(n);throw n}break;case dt.Disconnected:if(this.connectPromise)throw new Error("Connect promise must not be defined.");try{this.transitionState(dt.Connecting)}catch(n){if(n instanceof ca)return Promise.reject(n);throw n}break;default:throw new Error("Unknown state")}let e;try{e=new WebSocket(this.server,"sip"),e.binaryType="arraybuffer",e.addEventListener("close",n=>this.onWebSocketClose(n,e)),e.addEventListener("error",n=>this.onWebSocketError(n,e)),e.addEventListener("open",n=>this.onWebSocketOpen(n,e)),e.addEventListener("message",n=>this.onWebSocketMessage(n,e)),this._ws=e}catch(n){return this._ws=void 0,this.logger.error("WebSocket construction failed."),this.logger.error(n.toString()),new Promise((r,i)=>{this.connectResolve=r,this.connectReject=i,this.transitionState(dt.Disconnected,n)})}return this.connectPromise=new Promise((n,r)=>{this.connectResolve=n,this.connectReject=r,this.connectTimeout=setTimeout(()=>{this.logger.warn("Connect timed out. Exceeded time set in configuration.connectionTimeout: "+this.configuration.connectionTimeout+"s."),e.close(1e3)},1e3*this.configuration.connectionTimeout)}),this.connectPromise}_disconnect(){switch(this.logger.log(`Disconnecting ${this.server}`),this.state){case dt.Connecting:if(this.disconnectPromise)throw new Error("Disconnect promise must not be defined.");try{this.transitionState(dt.Disconnecting)}catch(n){if(n instanceof ca)return Promise.reject(n);throw n}break;case dt.Connected:if(this.disconnectPromise)throw new Error("Disconnect promise must not be defined.");try{this.transitionState(dt.Disconnecting)}catch(n){if(n instanceof ca)return Promise.reject(n);throw n}break;case dt.Disconnecting:if(this.transitioningState)return Promise.reject(this.transitionLoopDetectedError(dt.Disconnecting));if(!this.disconnectPromise)throw new Error("Disconnect promise must be defined.");return this.disconnectPromise;case dt.Disconnected:if(this.transitioningState)return Promise.reject(this.transitionLoopDetectedError(dt.Disconnecting));if(this.disconnectPromise)throw new Error("Disconnect promise must not be defined.");return Promise.resolve();default:throw new Error("Unknown state")}if(!this._ws)throw new Error("WebSocket must be defined.");const e=this._ws;return this.disconnectPromise=new Promise((n,r)=>{this.disconnectResolve=n,this.disconnectReject=r;try{e.close(1e3)}catch(i){throw this.logger.error("WebSocket close failed."),this.logger.error(i.toString()),i}}),this.disconnectPromise}_send(e){if(this.configuration.traceSip===!0&&this.logger.log(`Sending WebSocket message:
144
+ `:return"sendrecv";default:throw new Error("Should never happen")}return"sendrecv"})(),r=(()=>{switch(n){case"inactive":return"inactive";case"recvonly":return"sendonly";case"sendonly":return e!=null&&e.hold?"inactive":"recvonly";case"sendrecv":return e!=null&&e.hold?"sendonly":"sendrecv";default:throw new Error("Should never happen")}})();this._peerConnection.getTransceivers().forEach(i=>{i.direction&&i.direction!=="stopped"&&i.direction!==r&&(i.direction=r)})}break;default:return Promise.reject(new Error("Invalid signaling state "+this._peerConnection.signalingState))}return Promise.resolve()}waitForIceGatheringComplete(e=!1,n=0){return this.logger.debug("SessionDescriptionHandler.waitForIceGatheringToComplete"),this._peerConnection===void 0?Promise.reject("Peer connection closed."):e||this._peerConnection.iceGatheringState!=="complete"?(this.iceGatheringCompletePromise!==void 0&&(this.logger.debug("SessionDescriptionHandler.waitForIceGatheringToComplete - rejecting prior waiting promise"),this.iceGatheringCompleteReject&&this.iceGatheringCompleteReject(new Error("Promise superseded.")),this.iceGatheringCompletePromise=void 0,this.iceGatheringCompleteResolve=void 0,this.iceGatheringCompleteReject=void 0),this.iceGatheringCompletePromise=new Promise((r,i)=>{this.iceGatheringCompleteResolve=r,this.iceGatheringCompleteReject=i,n>0&&(this.logger.debug("SessionDescriptionHandler.waitForIceGatheringToComplete - timeout in "+n),this.iceGatheringCompleteTimeoutId=setTimeout(()=>{this.logger.debug("SessionDescriptionHandler.waitForIceGatheringToComplete - timeout"),this.iceGatheringComplete()},n))}),this.iceGatheringCompletePromise):(this.logger.debug("SessionDescriptionHandler.waitForIceGatheringToComplete - already complete"),Promise.resolve())}initPeerConnectionEventHandlers(){if(this.logger.debug("SessionDescriptionHandler.initPeerConnectionEventHandlers"),!this._peerConnection)throw new Error("Peer connection undefined.");const e=this._peerConnection;e.onconnectionstatechange=n=>{var r;const i=e.connectionState;this.logger.debug(`SessionDescriptionHandler.onconnectionstatechange ${i}`),!((r=this._peerConnectionDelegate)===null||r===void 0)&&r.onconnectionstatechange&&this._peerConnectionDelegate.onconnectionstatechange(n)},e.ondatachannel=n=>{var r;this.logger.debug("SessionDescriptionHandler.ondatachannel"),this._dataChannel=n.channel,this.onDataChannel&&this.onDataChannel(this._dataChannel),!((r=this._peerConnectionDelegate)===null||r===void 0)&&r.ondatachannel&&this._peerConnectionDelegate.ondatachannel(n)},e.onicecandidate=n=>{var r;this.logger.debug("SessionDescriptionHandler.onicecandidate"),!((r=this._peerConnectionDelegate)===null||r===void 0)&&r.onicecandidate&&this._peerConnectionDelegate.onicecandidate(n)},e.onicecandidateerror=n=>{var r;this.logger.debug("SessionDescriptionHandler.onicecandidateerror"),!((r=this._peerConnectionDelegate)===null||r===void 0)&&r.onicecandidateerror&&this._peerConnectionDelegate.onicecandidateerror(n)},e.oniceconnectionstatechange=n=>{var r;const i=e.iceConnectionState;this.logger.debug(`SessionDescriptionHandler.oniceconnectionstatechange ${i}`),!((r=this._peerConnectionDelegate)===null||r===void 0)&&r.oniceconnectionstatechange&&this._peerConnectionDelegate.oniceconnectionstatechange(n)},e.onicegatheringstatechange=n=>{var r;const i=e.iceGatheringState;this.logger.debug(`SessionDescriptionHandler.onicegatheringstatechange ${i}`),i==="complete"&&this.iceGatheringComplete(),!((r=this._peerConnectionDelegate)===null||r===void 0)&&r.onicegatheringstatechange&&this._peerConnectionDelegate.onicegatheringstatechange(n)},e.onnegotiationneeded=n=>{var r;this.logger.debug("SessionDescriptionHandler.onnegotiationneeded"),!((r=this._peerConnectionDelegate)===null||r===void 0)&&r.onnegotiationneeded&&this._peerConnectionDelegate.onnegotiationneeded(n)},e.onsignalingstatechange=n=>{var r;const i=e.signalingState;this.logger.debug(`SessionDescriptionHandler.onsignalingstatechange ${i}`),!((r=this._peerConnectionDelegate)===null||r===void 0)&&r.onsignalingstatechange&&this._peerConnectionDelegate.onsignalingstatechange(n)},e.ontrack=n=>{var r;const i=n.track.kind,o=n.track.enabled?"enabled":"disabled";this.logger.debug(`SessionDescriptionHandler.ontrack ${i} ${o}`),this.setRemoteTrack(n.track),!((r=this._peerConnectionDelegate)===null||r===void 0)&&r.ontrack&&this._peerConnectionDelegate.ontrack(n)}}}function mw(t){return(e,n)=>{t===void 0&&(t=o=>o.audio||o.video?navigator.mediaDevices===void 0?Promise.reject(new Error("Media devices not available in insecure contexts.")):navigator.mediaDevices.getUserMedia.call(navigator.mediaDevices,o):Promise.resolve(new MediaStream));const r={iceGatheringTimeout:(n==null?void 0:n.iceGatheringTimeout)!==void 0?n==null?void 0:n.iceGatheringTimeout:5e3,peerConnectionConfiguration:Object.assign(Object.assign({},{bundlePolicy:"balanced",certificates:void 0,iceCandidatePoolSize:0,iceServers:[{urls:"stun:stun.l.google.com:19302"}],iceTransportPolicy:"all",rtcpMuxPolicy:"require"}),n==null?void 0:n.peerConnectionConfiguration)},i=e.userAgent.getLogger("sip.SessionDescriptionHandler");return new ii(i,t,r)}}let R0=class O0{constructor(e,n){if(this._state=dt.Disconnected,this.transitioningState=!1,this._stateEventEmitter=new Pa,this.logger=e,n){const o=n,a=o==null?void 0:o.wsServers,s=o==null?void 0:o.maxReconnectionAttempts;a!==void 0&&this.logger.warn('The transport option "wsServers" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.'),s!==void 0&&this.logger.warn('The transport option "maxReconnectionAttempts" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.'),a&&!n.server&&(typeof a=="string"&&(n.server=a),a instanceof Array&&(n.server=a[0]))}this.configuration=Object.assign(Object.assign({},O0.defaultOptions),n);const r=this.configuration.server,i=bn.parse(r,"absoluteURI");if(i===-1)throw this.logger.error(`Invalid WebSocket Server URL "${r}"`),new Error("Invalid WebSocket Server URL");if(!["wss","ws","udp"].includes(i.scheme))throw this.logger.error(`Invalid scheme in WebSocket Server URL "${r}"`),new Error("Invalid scheme in WebSocket Server URL");this._protocol=i.scheme.toUpperCase()}dispose(){return this.disconnect()}get protocol(){return this._protocol}get server(){return this.configuration.server}get state(){return this._state}get stateChange(){return this._stateEventEmitter}get ws(){return this._ws}connect(){return this._connect()}disconnect(){return this._disconnect()}isConnected(){return this.state===dt.Connected}send(e){return this._send(e)}_connect(){switch(this.logger.log(`Connecting ${this.server}`),this.state){case dt.Connecting:if(this.transitioningState)return Promise.reject(this.transitionLoopDetectedError(dt.Connecting));if(!this.connectPromise)throw new Error("Connect promise must be defined.");return this.connectPromise;case dt.Connected:if(this.transitioningState)return Promise.reject(this.transitionLoopDetectedError(dt.Connecting));if(this.connectPromise)throw new Error("Connect promise must not be defined.");return Promise.resolve();case dt.Disconnecting:if(this.connectPromise)throw new Error("Connect promise must not be defined.");try{this.transitionState(dt.Connecting)}catch(n){if(n instanceof ca)return Promise.reject(n);throw n}break;case dt.Disconnected:if(this.connectPromise)throw new Error("Connect promise must not be defined.");try{this.transitionState(dt.Connecting)}catch(n){if(n instanceof ca)return Promise.reject(n);throw n}break;default:throw new Error("Unknown state")}let e;try{e=new WebSocket(this.server,"sip"),e.binaryType="arraybuffer",e.addEventListener("close",n=>this.onWebSocketClose(n,e)),e.addEventListener("error",n=>this.onWebSocketError(n,e)),e.addEventListener("open",n=>this.onWebSocketOpen(n,e)),e.addEventListener("message",n=>this.onWebSocketMessage(n,e)),this._ws=e}catch(n){return this._ws=void 0,this.logger.error("WebSocket construction failed."),this.logger.error(n.toString()),new Promise((r,i)=>{this.connectResolve=r,this.connectReject=i,this.transitionState(dt.Disconnected,n)})}return this.connectPromise=new Promise((n,r)=>{this.connectResolve=n,this.connectReject=r,this.connectTimeout=setTimeout(()=>{this.logger.warn("Connect timed out. Exceeded time set in configuration.connectionTimeout: "+this.configuration.connectionTimeout+"s."),e.close(1e3)},1e3*this.configuration.connectionTimeout)}),this.connectPromise}_disconnect(){switch(this.logger.log(`Disconnecting ${this.server}`),this.state){case dt.Connecting:if(this.disconnectPromise)throw new Error("Disconnect promise must not be defined.");try{this.transitionState(dt.Disconnecting)}catch(n){if(n instanceof ca)return Promise.reject(n);throw n}break;case dt.Connected:if(this.disconnectPromise)throw new Error("Disconnect promise must not be defined.");try{this.transitionState(dt.Disconnecting)}catch(n){if(n instanceof ca)return Promise.reject(n);throw n}break;case dt.Disconnecting:if(this.transitioningState)return Promise.reject(this.transitionLoopDetectedError(dt.Disconnecting));if(!this.disconnectPromise)throw new Error("Disconnect promise must be defined.");return this.disconnectPromise;case dt.Disconnected:if(this.transitioningState)return Promise.reject(this.transitionLoopDetectedError(dt.Disconnecting));if(this.disconnectPromise)throw new Error("Disconnect promise must not be defined.");return Promise.resolve();default:throw new Error("Unknown state")}if(!this._ws)throw new Error("WebSocket must be defined.");const e=this._ws;return this.disconnectPromise=new Promise((n,r)=>{this.disconnectResolve=n,this.disconnectReject=r;try{e.close(1e3)}catch(i){throw this.logger.error("WebSocket close failed."),this.logger.error(i.toString()),i}}),this.disconnectPromise}_send(e){if(this.configuration.traceSip===!0&&this.logger.log(`Sending WebSocket message:
145
145
 
146
146
  `+e+`
147
147
  `),this._state!==dt.Connected)return Promise.reject(new Error("Not connected."));if(!this._ws)throw new Error("WebSocket undefined.");try{this._ws.send(e)}catch(n){return n instanceof Error?Promise.reject(n):Promise.reject(new Error("WebSocket send failed."))}return Promise.resolve()}onWebSocketClose(e,n){if(n!==this._ws)return;const r=`WebSocket closed ${this.server} (code: ${e.code})`,i=this.disconnectPromise?void 0:new Error(r);i&&this.logger.warn("WebSocket closed unexpectedly"),this.logger.log(r),this._ws=void 0,this.transitionState(dt.Disconnected,i)}onWebSocketError(e,n){n===this._ws&&this.logger.error("WebSocket error occurred.")}onWebSocketMessage(e,n){if(n!==this._ws)return;const r=e.data;let i;if(/^(\r\n)+$/.test(r))return this.clearKeepAliveTimeout(),void(this.configuration.traceSip===!0&&this.logger.log("Received WebSocket message with CRLF Keep Alive response"));if(r){if(typeof r!="string"){try{i=new TextDecoder().decode(new Uint8Array(r))}catch(o){return this.logger.error(o.toString()),void this.logger.error("Received WebSocket binary message failed to be converted into string, message discarded")}this.configuration.traceSip===!0&&this.logger.log(`Received WebSocket binary message:
@@ -152,7 +152,7 @@ React keys must be passed directly to JSX without using spread:
152
152
  `+i+`
153
153
  `);if(this.state===dt.Connected){if(this.onMessage)try{this.onMessage(i)}catch(o){throw this.logger.error(o.toString()),this.logger.error("Exception thrown by onMessage callback"),o}}else this.logger.warn("Received message while not connected, discarding...")}else this.logger.warn("Received empty message, discarding...")}onWebSocketOpen(e,n){n===this._ws&&this._state===dt.Connecting&&(this.logger.log(`WebSocket opened ${this.server}`),this.transitionState(dt.Connected))}transitionLoopDetectedError(e){let n="A state transition loop has been detected.";return n+=` An attempt to transition from ${this._state} to ${e} before the prior transition completed.`,n+=" Perhaps you are synchronously calling connect() or disconnect() from a callback or state change handler?",this.logger.error(n),new ca("Loop detected.")}transitionState(e,n){const r=()=>{throw new Error(`Invalid state transition from ${this._state} to ${e}`)};if(this.transitioningState)throw this.transitionLoopDetectedError(e);switch(this.transitioningState=!0,this._state){case dt.Connecting:e!==dt.Connected&&e!==dt.Disconnecting&&e!==dt.Disconnected&&r();break;case dt.Connected:e!==dt.Disconnecting&&e!==dt.Disconnected&&r();break;case dt.Disconnecting:e!==dt.Connecting&&e!==dt.Disconnected&&r();break;case dt.Disconnected:e!==dt.Connecting&&r();break;default:throw new Error("Unknown state.")}const i=this._state;this._state=e;const o=this.connectResolve,a=this.connectReject;i===dt.Connecting&&(this.connectPromise=void 0,this.connectResolve=void 0,this.connectReject=void 0);const s=this.disconnectResolve,A=this.disconnectReject;if(i===dt.Disconnecting&&(this.disconnectPromise=void 0,this.disconnectResolve=void 0,this.disconnectReject=void 0),this.connectTimeout&&(clearTimeout(this.connectTimeout),this.connectTimeout=void 0),this.logger.log(`Transitioned from ${i} to ${this._state}`),this._stateEventEmitter.emit(this._state),e===dt.Connected&&(this.startSendingKeepAlives(),this.onConnect))try{this.onConnect()}catch(c){throw this.logger.error(c.toString()),this.logger.error("Exception thrown by onConnect callback"),c}if(i===dt.Connected&&(this.stopSendingKeepAlives(),this.onDisconnect))try{n?this.onDisconnect(n):this.onDisconnect()}catch(c){throw this.logger.error(c.toString()),this.logger.error("Exception thrown by onDisconnect callback"),c}if(i===dt.Connecting){if(!o)throw new Error("Connect resolve undefined.");if(!a)throw new Error("Connect reject undefined.");e===dt.Connected?o():a(n||new Error("Connect aborted."))}if(i===dt.Disconnecting){if(!s)throw new Error("Disconnect resolve undefined.");if(!A)throw new Error("Disconnect reject undefined.");e===dt.Disconnected?s():A(n||new Error("Disconnect aborted."))}this.transitioningState=!1}clearKeepAliveTimeout(){this.keepAliveDebounceTimeout&&clearTimeout(this.keepAliveDebounceTimeout),this.keepAliveDebounceTimeout=void 0}sendKeepAlive(){return this.keepAliveDebounceTimeout?Promise.resolve():(this.keepAliveDebounceTimeout=setTimeout(()=>{this.clearKeepAliveTimeout()},1e3*this.configuration.keepAliveDebounce),this.send(`\r
154
154
  \r
155
- `))}startSendingKeepAlives(){this.configuration.keepAliveInterval&&!this.keepAliveInterval&&(this.keepAliveInterval=setInterval(()=>{this.sendKeepAlive(),this.startSendingKeepAlives()},(e=>{const n=.8*e;return 1e3*(Math.random()*(e-n)+n)})(this.configuration.keepAliveInterval)))}stopSendingKeepAlives(){this.keepAliveInterval&&clearInterval(this.keepAliveInterval),this.keepAliveDebounceTimeout&&clearTimeout(this.keepAliveDebounceTimeout),this.keepAliveInterval=void 0,this.keepAliveDebounceTimeout=void 0}};R0.defaultOptions={server:"",connectionTimeout:5,keepAliveInterval:0,keepAliveDebounce:10,traceSip:!0};let Fg=class Js{constructor(e={}){if(this._publishers={},this._registerers={},this._sessions={},this._subscriptions={},this._state=Dn.Stopped,this._stateEventEmitter=new Pa,this.delegate=e.delegate,this.options=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Js.defaultOptions()),{sipjsId:zi(5)}),{uri:new Ni("sip","anonymous."+zi(6),"anonymous.invalid")}),{viaHost:zi(12)+".invalid"}),Js.stripUndefinedProperties(e)),this.options.hackIpInContact)if(typeof this.options.hackIpInContact=="boolean"&&this.options.hackIpInContact){const i=Math.floor(Math.random()*254+1);this.options.viaHost="192.0.2."+i}else this.options.hackIpInContact&&(this.options.viaHost=this.options.hackIpInContact);switch(this.loggerFactory=new $S,this.logger=this.loggerFactory.getLogger("sip.UserAgent"),this.loggerFactory.builtinEnabled=this.options.logBuiltinEnabled,this.loggerFactory.connector=this.options.logConnector,this.options.logLevel){case"error":this.loggerFactory.level=On.error;break;case"warn":this.loggerFactory.level=On.warn;break;case"log":this.loggerFactory.level=On.log;break;case"debug":this.loggerFactory.level=On.debug}if(this.options.logConfiguration&&(this.logger.log("Configuration:"),Object.keys(this.options).forEach(n=>{const r=this.options[n];switch(n){case"uri":case"sessionDescriptionHandlerFactory":this.logger.log("· "+n+": "+r);break;case"authorizationPassword":this.logger.log("· "+n+": NOT SHOWN");break;case"transportConstructor":this.logger.log("· "+n+": "+r.name);break;default:this.logger.log("· "+n+": "+JSON.stringify(r))}})),this.options.transportOptions){const n=this.options.transportOptions,r=n.maxReconnectionAttempts,i=n.reconnectionTimeout;r!==void 0&&this.logger.warn('The transport option "maxReconnectionAttempts" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.'),i!==void 0&&this.logger.warn('The transport option "reconnectionTimeout" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.'),e.reconnectionDelay===void 0&&i!==void 0&&(this.options.reconnectionDelay=i),e.reconnectionAttempts===void 0&&r!==void 0&&(this.options.reconnectionAttempts=r)}if(e.reconnectionDelay!==void 0&&this.logger.warn('The user agent option "reconnectionDelay" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.'),e.reconnectionAttempts!==void 0&&this.logger.warn('The user agent option "reconnectionAttempts" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.'),this._transport=new this.options.transportConstructor(this.getLogger("sip.Transport"),this.options.transportOptions),this.initTransportCallbacks(),this._contact=this.initContact(),this._instanceId=this.options.instanceId?this.options.instanceId:Js.newUUID(),En.parse(this._instanceId,"uuid")===-1)throw new Error("Invalid instanceId.");this._userAgentCore=this.initCore()}static makeURI(e){return En.URIParse(e)}static defaultOptions(){return{allowLegacyNotifications:!1,authorizationHa1:"",authorizationPassword:"",authorizationUsername:"",delegate:{},contactName:"",contactParams:{transport:"ws"},displayName:"",forceRport:!1,gracefulShutdown:!0,hackAllowUnregisteredOptionTags:!1,hackIpInContact:!1,hackViaTcp:!1,instanceId:"",instanceIdAlwaysAdded:!1,logBuiltinEnabled:!0,logConfiguration:!0,logConnector:()=>{},logLevel:"log",noAnswerTimeout:60,preloadedRouteSet:[],reconnectionAttempts:0,reconnectionDelay:4,sendInitialProvisionalResponse:!0,sessionDescriptionHandlerFactory:mw(),sessionDescriptionHandlerFactoryOptions:{},sipExtension100rel:Nr.Unsupported,sipExtensionReplaces:Nr.Unsupported,sipExtensionExtraSupported:[],sipjsId:"",transportConstructor:R0,transportOptions:{},uri:new Ni("sip","anonymous","anonymous.invalid"),userAgentString:"SIP.js/0.21.1",viaHost:""}}static newUUID(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const n=Math.floor(16*Math.random());return(e==="x"?n:n%4+8).toString(16)})}static stripUndefinedProperties(e){return Object.keys(e).reduce((n,r)=>(e[r]!==void 0&&(n[r]=e[r]),n),{})}get configuration(){return this.options}get contact(){return this._contact}get instanceId(){return this._instanceId}get state(){return this._state}get stateChange(){return this._stateEventEmitter}get transport(){return this._transport}get userAgentCore(){return this._userAgentCore}getLogger(e,n){return this.loggerFactory.getLogger(e,n)}getLoggerFactory(){return this.loggerFactory}isConnected(){return this.transport.isConnected()}reconnect(){return this.state===Dn.Stopped?Promise.reject(new Error("User agent stopped.")):Promise.resolve().then(()=>this.transport.connect())}start(){return this.state===Dn.Started?(this.logger.warn("User agent already started"),Promise.resolve()):(this.logger.log(`Starting ${this.configuration.uri}`),this.transitionState(Dn.Started),this.transport.connect())}async stop(){if(this.state===Dn.Stopped)return this.logger.warn("User agent already stopped"),Promise.resolve();if(this.logger.log(`Stopping ${this.configuration.uri}`),!this.options.gracefulShutdown)return this.logger.log("Dispose of transport"),this.transport.dispose().catch(s=>{throw this.logger.error(s.message),s}),this.logger.log("Dispose of core"),this.userAgentCore.dispose(),this._publishers={},this._registerers={},this._sessions={},this._subscriptions={},this.transitionState(Dn.Stopped),Promise.resolve();const e=Object.assign({},this._publishers),n=Object.assign({},this._registerers),r=Object.assign({},this._sessions),i=Object.assign({},this._subscriptions),o=this.transport,a=this.userAgentCore;this.logger.log("Dispose of registerers");for(const s in n)n[s]&&await n[s].dispose().catch(A=>{throw this.logger.error(A.message),delete this._registerers[s],A});this.logger.log("Dispose of sessions");for(const s in r)r[s]&&await r[s].dispose().catch(A=>{throw this.logger.error(A.message),delete this._sessions[s],A});this.logger.log("Dispose of subscriptions");for(const s in i)i[s]&&await i[s].dispose().catch(A=>{throw this.logger.error(A.message),delete this._subscriptions[s],A});this.logger.log("Dispose of publishers");for(const s in e)e[s]&&await e[s].dispose().catch(A=>{throw this.logger.error(A.message),delete this._publishers[s],A});this.logger.log("Dispose of transport"),await o.dispose().catch(s=>{throw this.logger.error(s.message),s}),this.logger.log("Dispose of core"),a.dispose(),this.transitionState(Dn.Stopped)}_makeInviter(e,n){return new v0(this,e,n)}attemptReconnection(e=1){const n=this.options.reconnectionAttempts,r=this.options.reconnectionDelay;e>n?this.logger.log("Maximum reconnection attempts reached"):(this.logger.log(`Reconnection attempt ${e} of ${n} - trying`),setTimeout(()=>{this.reconnect().then(()=>{this.logger.log(`Reconnection attempt ${e} of ${n} - succeeded`)}).catch(i=>{this.logger.error(i.message),this.logger.log(`Reconnection attempt ${e} of ${n} - failed`),this.attemptReconnection(++e)})},e===1?0:1e3*r))}initContact(){const e=this.options.contactName!==""?this.options.contactName:zi(8),n=this.options.contactParams;return{pubGruu:void 0,tempGruu:void 0,uri:new Ni("sip",e,this.options.viaHost,void 0,n),toString:(r={})=>{const i=r.anonymous||!1,o=r.outbound||!1,a=r.register||!1;let s="<";return s+=i?this.contact.tempGruu||`sip:anonymous@anonymous.invalid;transport=${n.transport?n.transport:"ws"}`:a?this.contact.uri:this.contact.pubGruu||this.contact.uri,o&&(s+=";ob"),s+=">",this.options.instanceIdAlwaysAdded&&(s+=';+sip.instance="<urn:uuid:'+this._instanceId+'>"'),s}}}initCore(){let e=[];e.push("outbound"),this.options.sipExtension100rel===Nr.Supported&&e.push("100rel"),this.options.sipExtensionReplaces===Nr.Supported&&e.push("replaces"),this.options.sipExtensionExtraSupported&&e.push(...this.options.sipExtensionExtraSupported),this.options.hackAllowUnregisteredOptionTags||(e=e.filter(o=>JS[o])),e=Array.from(new Set(e));const n=e.slice();(this.contact.pubGruu||this.contact.tempGruu)&&n.push("gruu");const r={aor:this.options.uri,contact:this.contact,displayName:this.options.displayName,loggerFactory:this.loggerFactory,hackViaTcp:this.options.hackViaTcp,routeSet:this.options.preloadedRouteSet,supportedOptionTags:e,supportedOptionTagsResponse:n,sipjsId:this.options.sipjsId,userAgentHeaderFieldValue:this.options.userAgentString,viaForceRport:this.options.forceRport,viaHost:this.options.viaHost,authenticationFactory:()=>{const o=this.options.authorizationUsername?this.options.authorizationUsername:this.options.uri.user,a=this.options.authorizationPassword?this.options.authorizationPassword:void 0,s=this.options.authorizationHa1?this.options.authorizationHa1:void 0;return new _S(this.getLoggerFactory(),s,o,a)},transportAccessor:()=>this.transport},i={onInvite:o=>{var a;const s=new eu(this,o);if(o.delegate={onCancel:A=>{s._onCancel(A)},onTransportError:A=>{this.logger.error("A transport error has occurred while handling an incoming INVITE request.")}},o.trying(),this.options.sipExtensionReplaces!==Nr.Unsupported){const A=o.message.parseHeader("replaces");if(A){const c=A.call_id;if(typeof c!="string")throw new Error("Type of call id is not string");const u=A.replaces_to_tag;if(typeof u!="string")throw new Error("Type of to tag is not string");const d=A.replaces_from_tag;if(typeof d!="string")throw new Error("type of from tag is not string");const f=c+u+d,p=this.userAgentCore.dialogs.get(f);if(!p)return void s.reject({statusCode:481});if(!p.early&&A.early_only===!0)return void s.reject({statusCode:486});const v=this._sessions[c+d]||this._sessions[c+u]||void 0;if(!v)throw new Error("Session does not exist.");s._replacee=v}}if(!((a=this.delegate)===null||a===void 0)&&a.onInvite)return s.autoSendAnInitialProvisionalResponse?void s.progress().then(()=>{var A;if(((A=this.delegate)===null||A===void 0?void 0:A.onInvite)===void 0)throw new Error("onInvite undefined.");this.delegate.onInvite(s)}):void this.delegate.onInvite(s);s.reject({statusCode:486})},onMessage:o=>{if(this.delegate&&this.delegate.onMessage){const a=new p0(o);this.delegate.onMessage(a)}else o.accept()},onNotify:o=>{if(this.delegate&&this.delegate.onNotify){const a=new $l(o);this.delegate.onNotify(a)}else this.options.allowLegacyNotifications?o.accept():o.reject({statusCode:481})},onRefer:o=>{this.logger.warn("Received an out of dialog REFER request"),this.delegate&&this.delegate.onReferRequest?this.delegate.onReferRequest(o):o.reject({statusCode:405})},onRegister:o=>{this.logger.warn("Received an out of dialog REGISTER request"),this.delegate&&this.delegate.onRegisterRequest?this.delegate.onRegisterRequest(o):o.reject({statusCode:405})},onSubscribe:o=>{this.logger.warn("Received an out of dialog SUBSCRIBE request"),this.delegate&&this.delegate.onSubscribeRequest?this.delegate.onSubscribeRequest(o):o.reject({statusCode:405})}};return new pw(r,i)}initTransportCallbacks(){this.transport.onConnect=()=>this.onTransportConnect(),this.transport.onDisconnect=e=>this.onTransportDisconnect(e),this.transport.onMessage=e=>this.onTransportMessage(e)}onTransportConnect(){this.state!==Dn.Stopped&&this.delegate&&this.delegate.onConnect&&this.delegate.onConnect()}onTransportDisconnect(e){this.state!==Dn.Stopped&&(this.delegate&&this.delegate.onDisconnect&&this.delegate.onDisconnect(e),e&&this.options.reconnectionAttempts>0&&this.attemptReconnection())}onTransportMessage(e){const n=Ws.parseMessage(e,this.getLogger("sip.Parser"));if(!n)return void this.logger.warn("Failed to parse incoming message. Dropping.");if(this.state===Dn.Stopped&&n instanceof Bo)return void this.logger.warn(`Received ${n.method} request while stopped. Dropping.`);const r=()=>{const i=["from","to","call_id","cseq","via"];for(const o of i)if(!n.hasHeader(o))return this.logger.warn(`Missing mandatory header field : ${o}.`),!1;return!0};if(n instanceof Bo){if(!r())return void this.logger.warn("Request missing mandatory header field. Dropping.");if(!n.toTag&&n.callId.substr(0,5)===this.options.sipjsId)return void this.userAgentCore.replyStateless(n,{statusCode:482});const i=Qa(n.body),o=n.getHeader("content-length");if(o&&i<Number(o))return void this.userAgentCore.replyStateless(n,{statusCode:400})}if(n instanceof Fi){if(!r())return void this.logger.warn("Response missing mandatory header field. Dropping.");if(n.getHeaders("via").length>1)return void this.logger.warn("More than one Via header field present in the response. Dropping.");if(n.via.host!==this.options.viaHost||n.via.port!==void 0)return void this.logger.warn("Via sent-by in the response does not match UA Via host value. Dropping.");const i=Qa(n.body),o=n.getHeader("content-length");if(o&&i<Number(o))return void this.logger.warn("Message body length is lower than the value in Content-Length header field. Dropping.")}if(n instanceof Bo)this.userAgentCore.receiveIncomingRequestFromTransport(n);else{if(!(n instanceof Fi))throw new Error("Invalid message type.");this.userAgentCore.receiveIncomingResponseFromTransport(n)}}transitionState(e,n){const r=()=>{throw new Error(`Invalid state transition from ${this._state} to ${e}`)};switch(this._state){case Dn.Started:e!==Dn.Stopped&&r();break;case Dn.Stopped:e!==Dn.Started&&r();break;default:throw new Error("Unknown state.")}this.logger.log(`Transitioned from ${this._state} to ${e}`),this._state=e,this._stateEventEmitter.emit(this._state)}},M0=class{constructor(e){this.listeners=[],this.keyListeners={},this.data={...e},this.proxy=new Proxy(this.data,{set:(n,r,i)=>(n[r]!==i&&(n[r]=i,this.notify(),this.notifyKey(r,i)),!0)})}getState(){return this.proxy}setState(e,n=!1){let r=!1;for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const o=this.data[i],a=e[i];(n||o!==a)&&(this.data[i]=a,r=!0,this.notifyKey(i,a))}(r||n)&&this.notify()}subscribe(e){return this.listeners.push(e),()=>{this.listeners=this.listeners.filter(n=>n!==e)}}subscribeKey(e,n){return this.keyListeners[e]||(this.keyListeners[e]=[]),this.keyListeners[e].push(n),()=>{this.keyListeners[e]=this.keyListeners[e].filter(r=>r!==n)}}notify(){const e=this.getState();for(const n of this.listeners)n(e)}notifyKey(e,n){const r=this.keyListeners[e];r&&r.forEach(i=>i(n))}};var Mt,xn,it,Ar,ie,He,Kt;(function(t){t[t.IDLE=1]="IDLE",t[t.BUSY=2]="BUSY",t[t.RINGING=3]="RINGING",t[t.OFFLINE=0]="OFFLINE",t[t.UNREGISTERED=4]="UNREGISTERED"})(Mt||(Mt={})),function(t){t.OUTGOING="outgoing",t.INCOMING="incoming",t.CONSULT="consult",t.MEETING="meeting",t.TRANSFER="transfer",t.PREDICT_OUT_CALL="predict_out_call"}(xn||(xn={})),function(t){t[t.OUT_CALL=100]="OUT_CALL",t[t.AGENT_STATE=101]="AGENT_STATE",t[t.OUT_CALL_INCOMING_CALL=102]="OUT_CALL_INCOMING_CALL",t[t.OUT_CALL_RINGING=103]="OUT_CALL_RINGING",t[t.OUT_CALL_ANSWER=104]="OUT_CALL_ANSWER",t[t.CALL_HOLD=105]="CALL_HOLD",t[t.CALL_UNHOLD=106]="CALL_UNHOLD",t[t.OUT_CALL_END=107]="OUT_CALL_END",t[t.CONSULT_REQUEST=108]="CONSULT_REQUEST",t[t.CONSULT_RINGING=109]="CONSULT_RINGING",t[t.CONSULT_ANSWER=110]="CONSULT_ANSWER",t[t.CONSULT_FAIL=111]="CONSULT_FAIL",t[t.MUTE=112]="MUTE",t[t.UNMUTE=113]="UNMUTE",t[t.CONSULT_CALL_IN=114]="CONSULT_CALL_IN",t[t.CONSULT_CALL_IN_SUCCESS=115]="CONSULT_CALL_IN_SUCCESS",t[t.CONSULT_RETURN_CALL=125]="CONSULT_RETURN_CALL",t[t.CONSULT_RETURN_CALL_SUCCESS=126]="CONSULT_RETURN_CALL_SUCCESS",t[t.CONSULT_TRANSFER=116]="CONSULT_TRANSFER",t[t.CONSULT_TRANSFER_FAILED=118]="CONSULT_TRANSFER_FAILED",t[t.CONSULT_TRANSFER_OFF_HOOK=117]="CONSULT_TRANSFER_OFF_HOOK",t[t.INCOMING_CALL=119]="INCOMING_CALL",t[t.INCOMING_CALL_OFF_HOOK=120]="INCOMING_CALL_OFF_HOOK",t[t.INCOMING_CALL_END=121]="INCOMING_CALL_END",t[t.SATISFACTION_EVALUATION=122]="SATISFACTION_EVALUATION",t[t.CONSULT_THREE_WAY=123]="CONSULT_THREE_WAY",t[t.CONSULT_THREE_WAY_RESULT=124]="CONSULT_THREE_WAY_RESULT",t[t.TRANSFER=127]="TRANSFER",t[t.TRANSFER_FAILED=128]="TRANSFER_FAILED",t[t.TRANSFER_INCOMING_CALL=129]="TRANSFER_INCOMING_CALL",t[t.TRANSFER_OFF_HOOK=130]="TRANSFER_OFF_HOOK",t[t.AGENT_HANGUP=131]="AGENT_HANGUP",t[t.KICK_OFFLINE=132]="KICK_OFFLINE",t[t.CONTINUOUS_NOT_ANSWER=133]="CONTINUOUS_NOT_ANSWER",t[t.PREVIEW_OUT_CALL=134]="PREVIEW_OUT_CALL",t[t.SIGN_OUT=135]="SIGN_OUT",t[t.SIGN_IN_SWITCH_DEVICE=136]="SIGN_IN_SWITCH_DEVICE",t[t.LISTEN_CALL_FAILED=137]="LISTEN_CALL_FAILED",t[t.LISTEN_INCOMING_CALL=138]="LISTEN_INCOMING_CALL",t[t.LISTEN_INCOMING_CALL_OFF_HOOK=139]="LISTEN_INCOMING_CALL_OFF_HOOK",t[t.EAR_SPEECH=140]="EAR_SPEECH",t[t.STOP_EAR_SPEECH=141]="STOP_EAR_SPEECH",t[t.CALL_FORCE_INSERT=142]="CALL_FORCE_INSERT",t[t.INTERNAL_CALL_START_CONSULT=145]="INTERNAL_CALL_START_CONSULT",t[t.INTERNAL_CALL_END_CONSULT=146]="INTERNAL_CALL_END_CONSULT",t[t.CALL_SIP_INCOMING_CALL=147]="CALL_SIP_INCOMING_CALL"}(it||(it={})),function(t){t.WEB_RTC_CONNECTING="connecting",t.WEB_RTC_CONNECTED="connected",t.WEB_RTC_DISCONNECTING="disconnecting",t.WEB_RTC_DISCONNECTED="disconnected",t.WEB_RTC_REGISTERED="registered",t.WEB_RTC_UNREGISTERED="unregistered",t.WEB_RTC_TERMINATED="terminated",t.WEB_RTC_REGISTER_FAILED="register_failed",t.WEB_RTC_ANSWER_FAILED="answer_failed",t.WEB_RTC_SEND_DTMF="send_dtmf"}(Ar||(Ar={})),function(t){t.CUSTOMER_INFO="customer_info",t.CALL_PROGRESS="call_progress",t.OUT_INCOMING_CALL="out_call_incoming_call",t.INTERNAL_OUT_INCOMING_CALL="internal_out_incoming_call",t.PREVIEW_OUT_INCOMING_CALL="preview_out_incoming_call",t.OUT_SUCCESS="out_call_success",t.OUT_FAILED="out_call_failed",t.OUT_RINGING="out_call_ringing",t.OUT_OFF_ANSWER="out_call_answer",t.INTERNAL_OUT_OFF_ANSWER="internal_out_call_answer",t.HOLD_SUCCESS="hold_success",t.HOLD_FAILED="hold_failed",t.UNHOLD_SUCCESS="unhold_success",t.UNHOLD_FAILED="unhold_failed",t.OUT_HANGUP="out_call_hangup",t.CONSULT_RINGING="consult_ringing",t.CONSULT_OFF_HOOK="consult_off_hook",t.CONSULT_FAILED="consult_failed",t.CONSULT_INCOMING="consult_incoming",t.CONSULT_CALL_IN_SUCCESS="consult_call_in_success",t.CONSULT_RETURN_CALL_SUCCESS="consult_return_call_success",t.OTHER_SIDE_CONSULT_HANGUP="other_side_consult_hangup",t.OUR_SIDE_CONSULT_HANGUP="our_side_consult_hangup",t.AGENT_STATE="agent_state",t.MUTE_SUCCESS="mute_success",t.MUTE_FAILED="mute_failed",t.UNMUTE_SUCCESS="unmute_success",t.UNMUTE_FAILED="unmute_failed",t.CONSULT_TRANSFER_SUCCESS="consult_transfer_success",t.CONSULT_TRANSFER_FAILED="consult_transfer_failed",t.CONSULT_TRANSFER_OFF_HOOK="consult_transfer_off_hook",t.INCOMING_CALL="incoming_call",t.INCOMING_CALL_IN="incoming_call_in",t.PREDICT_INCOMING_CALL="predict_incoming_call",t.DUAL_CALL_INCOMING_CALL="dual_call_incoming_call",t.INCOMING_CALL_OFF_HOOK="incoming_call_off_hook",t.INCOMING_CALL_IN_OFF_HOOK="incoming_call_in_off_hook",t.INCOMING_CALL_END="incoming_call_end",t.SATISFACTION_EVALUATION_SUCCESS="satisfaction_evaluation_success",t.SATISFACTION_EVALUATION_FAILED="satisfaction_evaluation_failed",t.CONSULT_THREE_WAY_SUCCESS="consult_three_way_success",t.CONSULT_THREE_WAY_FAILED="consult_three_way_failed",t.THREE_WAY_OUR_SIDE_HANGUP="three_way_our_side_hangup",t.TRANSFER_FAILED="transfer_failed",t.TRANSFER_PROGRESS="transfer_progress",t.TRANSFER_INCOMING_CALL="transfer_incoming_call",t.TRANSFER_OFF_HOOK="transfer_off_hook",t.TRANSFER_END="transfer_end",t.REJECT="reject",t.LISTEN_CALL_FAILED="listen_call_failed",t.LISTEN_INCOMING_CALL="listen_incoming_call",t.LISTEN_INCOMING_CALL_OFF_HOOK="listen_incoming_call_off_hook",t.LISTEN_HANGUP="listen_hangup",t.EAR_SPEECH_SUCCESS="ear_speech_success",t.EAR_SPEECH_BE_SUCCESS="ear_speech_be_success",t.EAR_SPEECH_FAILED="ear_speech_failed",t.STOP_EAR_SPEECH_SUCCESS="stop_ear_speech_success",t.STOP_EAR_SPEECH_FAILED="stop_ear_speech_failed",t.CALL_FORCE_INSERT_SUCCESS="call_force_insert_success",t.CALL_FORCE_INSERT_SUCCESS_LISTENER="call_force_insert_success_listener",t.CALL_FORCE_INSERT_FAILED="call_force_insert_failed",t.CALL_SIP_INCOMING_CALL="call_sip_incoming_call"}(ie||(ie={})),function(t){t.EVENT_ALL="event_all",t.NOTIFICATION_CLICK="notification_click",t.UPDATE_ANSWER_DEVICE="update_answer_device",t.PHONE_BAR_OPERATION="phone_bar_operation",t.AGENT_INIT_STATUS="agent_init_status",t.WEBSITE_DELAY="website_delay",t.SELECT_EXTERNAL_NUMBER="select_external_number",t.FAIL_NOTIFICATION="fail_notification",t.KICK_OFF="kick_off",t.DESTROY="destroy",t.NETWORK_OFFLINE="network_offline",t.NETWORK_ONLINE="network_online",t.SIGN_OUT="sign_out",t.SIGN_IN_SWITCH_DEVICE="sign_in_switch_device"}(He||(He={})),function(t){t.RINGING="客户振铃",t.AGENT_RINGING="振铃中",t.CALLING="通话中",t.CONSULTING="正在咨询",t.CONSULT_CALL_IN="咨询来电",t.INCOMING_CALL="客户来电",t.MEETING="会议中",t.TRANSFERRING="转接中",t.TRANSFER_INCOMING_CALL="转接来电",t.HOLDING="保持中",t.MUTING="静音中",t.LISTENING="监听来电",t.LINKING="正在链接",t.OTHER_SIDE_CONSULTING="对方正咨询"}(Kt||(Kt={}));const la={all:vi=vi||new Map,on:function(t,e){var n=vi.get(t);n?n.push(e):vi.set(t,[e])},off:function(t,e){var n=vi.get(t);n&&(e?n.splice(n.indexOf(e)>>>0,1):vi.set(t,[]))},emit:function(t,e){var n=vi.get(t);n&&n.slice().map(function(r){r(e)}),(n=vi.get("*"))&&n.slice().map(function(r){r(t,e)})}};var vi;const fe={on:(t,e)=>(la.on(t,e),fe),off(t,e){la.off(t,e)},emit(t,e){la.emit(t,e),la.emit(He.EVENT_ALL,{event:t,data:e})},clearAllListeners(){la.all.clear()}},K={agentInfo:{},isRtcReconnecting:!1,sessionId:"",enableBrowserAlert:!1,autoStateTimer:null,autoAnswerTimer:null,logBuiltinEnabled:!1,browserAlertTime:3e3,latency:0,monitoredAgentNo:"",earSpeakAgent:"",stateObject:{state:Mt.BUSY,state_name:"忙碌"},isAgentHangup:!1},vr={isCalling:!1,direction:null,outCallIsAnswer:!1,incomingIsAnswer:!1,transferIsAnswer:!1,isMeeting:!1,isHold:!1,displayText:"",isMuted:!1,consultIsAnswer:!1,actionConfigs:[],answerDevice:1,selectOutNumber:"",customerObject:void 0,isNextState:!0,isSipConnected:!1},G=new class extends M0{updateIsCalling(t){this.setState({isCalling:t})}updateDirection(t){this.setState({direction:t})}updateOutCallIsAnswer(t){this.setState({outCallIsAnswer:t})}updateIsHold(t){var n;if(((n=K.stateObject)==null?void 0:n.state)===Mt.UNREGISTERED)return;const e=this.get("actionConfigs");if(t){const r=[...e.filter(i=>i!=="hold")];r.push("unhold"),this.updateActionConfigs(r)}else{const r=[...e.filter(i=>i!=="unhold")];r.push("hold"),this.updateActionConfigs(r)}this.setState({isHold:t})}updateDisplayText(t){this.setState({displayText:t}),fe.emit(ie.CALL_PROGRESS,t)}updateActionConfigs(t,e=!0){const{show_satisfaction:n}=K.agentInfo||{},r=this.get("answerDevice"),i=t.filter(o=>(n!==0||o!=="satisfaction"||!e)&&(r!==2&&r!==3||o!=="answer"));this.setState({actionConfigs:i}),fe.emit(He.PHONE_BAR_OPERATION,i)}updateConsultIsAnswer(t){this.setState({consultIsAnswer:t})}updateIsMuted(t){var n;if(((n=K.stateObject)==null?void 0:n.state)===Mt.UNREGISTERED)return;const e=this.get("actionConfigs");if(t){const r=[...e.filter(i=>i!=="mute")];r.push("unmute"),this.updateActionConfigs(r)}else{const r=[...e.filter(i=>i!=="unmute")];r.push("mute"),this.updateActionConfigs(r)}this.setState({isMuted:t})}updateIncomingIsAnswer(t){this.setState({incomingIsAnswer:t})}updateAnswerDevice(t){this.setState({answerDevice:t}),fe.emit(He.UPDATE_ANSWER_DEVICE,t)}updateIsMeeting(t){this.setState({isMeeting:t})}updateTransferIsAnswer(t){this.setState({transferIsAnswer:t})}updateSelectOutNumber(t){fe.emit(He.SELECT_EXTERNAL_NUMBER,t),this.setState({selectOutNumber:t})}updateCustomerInfo(t){const e=this.get("displayText");if(t&&e){const{contact_count:n,customer_name:r,phone:i,city:o,province:a,is_vip:s,in_contact_count:A,trace_id:c,contact_count_month:u,in_contact_count_month:d,type:f,session_id:p}=t;fe.emit(ie.CUSTOMER_INFO,{customer_name:r||"未知客户",phone:i,city:o||"未知",province:a||"未知",contact_count:n||0,in_contact_count:A||0,is_vip:s,trace_id:c,contact_count_month:u||0,in_contact_count_month:d||0,type:f,session_id:p})}else fe.emit(ie.CUSTOMER_INFO,void 0);this.setState({customerObject:t})}updateIsNextState(t){this.setState({isNextState:t}),t?fe.emit(He.NETWORK_ONLINE):(K.stateObject={state:Mt.OFFLINE,state_name:"离线"},this.updateActionConfigs([]),fe.emit(ie.AGENT_STATE,K.stateObject),fe.emit(He.NETWORK_OFFLINE))}updateIsSipConnected(t){this.setState({isSipConnected:t})}reset(){this.updateAnswerDevice(1),this.updateIsCalling(vr.isCalling),this.updateDirection(vr.direction),this.updateOutCallIsAnswer(vr.outCallIsAnswer),this.updateIsHold(vr.isHold),this.updateDisplayText(vr.displayText),this.updateActionConfigs(vr.actionConfigs),this.updateConsultIsAnswer(vr.consultIsAnswer),this.updateIsMuted(vr.isMuted),this.updateIncomingIsAnswer(vr.incomingIsAnswer),this.updateIsMeeting(vr.isMeeting),this.updateTransferIsAnswer(vr.transferIsAnswer),this.updateCustomerInfo(void 0)}getCallInfo(){return this.getState()}get(t){return this.getState()[t]}}(vr),T0=new class extends M0{updateRttObject(t){this.setState({rttObject:t}),fe.emit(He.WEBSITE_DELAY,t)}}({rttObject:{rtt:null,jitter:null,packetsLost:null,packetsReceived:null,packetsSent:null,sendBitrate:null,recvBitrate:null,codec:null}});let kg=class extends Error{constructor(n,r,i){const o=`${n.status||n.status===0?n.status:""} ${n.statusText||""}`.trim();super(`Request failed with ${o?`status code ${o}`:"an unknown error"}: ${r.method} ${r.url}`);qr(this,"response");qr(this,"request");qr(this,"options");this.name="HTTPError",this.response=n,this.request=r,this.options=i}};class Pg extends Error{constructor(n){super(`Request timed out: ${n.method} ${n.url}`);qr(this,"request");this.name="TimeoutError",this.request=n}}const Qg=(()=>{let t=!1,e=!1;const n=typeof globalThis.ReadableStream=="function",r=typeof globalThis.Request=="function";if(n&&r)try{e=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type")}catch(i){if(i instanceof Error&&i.message==="unsupported BodyInit type")return!1;throw i}return t&&!e})(),vw=typeof globalThis.AbortController=="function",Cw=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",yw=typeof globalThis.ReadableStream=="function",Ew=typeof globalThis.FormData=="function",N0=["get","post","put","patch","head","delete"],bw={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},jg=2147483647,Sw=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,D0=Symbol("stop"),ww={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0},Iw={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,dispatcher:!0,duplex:!0,priority:!0},xw=(t,e)=>{const n=(i=>{if(!i)return 0;if(i instanceof FormData){let o=0;for(const[a,s]of i)o+=Sw,o+=new TextEncoder().encode(`Content-Disposition: form-data; name="${a}"`).length,o+=typeof s=="string"?new TextEncoder().encode(s).length:s.size;return o}if(i instanceof Blob)return i.size;if(i instanceof ArrayBuffer)return i.byteLength;if(typeof i=="string")return new TextEncoder().encode(i).length;if(i instanceof URLSearchParams)return new TextEncoder().encode(i.toString()).length;if("byteLength"in i)return i.byteLength;if(typeof i=="object"&&i!==null)try{const o=JSON.stringify(i);return new TextEncoder().encode(o).length}catch{return 0}return 0})(t.body);let r=0;return new Request(t,{duplex:"half",body:new ReadableStream({async start(i){const o=t.body instanceof ReadableStream?t.body.getReader():new Response("").body.getReader();await async function a(){const{done:s,value:A}=await o.read();if(s)return e&&e({percent:1,transferredBytes:r,totalBytes:Math.max(n,r)},new Uint8Array),void i.close();r+=A.byteLength;let c=n===0?0:r/n;(n<r||c===1)&&(c=.99),e&&e({percent:Number(c.toFixed(2)),transferredBytes:r,totalBytes:n},A),i.enqueue(A),await a()}()}})})},pa=t=>t!==null&&typeof t=="object",xs=(...t)=>{for(const e of t)if((!pa(e)||Array.isArray(e))&&e!==void 0)throw new TypeError("The `options` argument must be an object");return Zd({},...t)},B0=(t={},e={})=>{const n=new globalThis.Headers(t),r=e instanceof globalThis.Headers,i=new globalThis.Headers(e);for(const[o,a]of i.entries())r&&a==="undefined"||a===void 0?n.delete(o):n.set(o,a);return n};function Rs(t,e,n){return Object.hasOwn(e,n)&&e[n]===void 0?[]:Zd(t[n]??[],e[n]??[])}const F0=(t={},e={})=>({beforeRequest:Rs(t,e,"beforeRequest"),beforeRetry:Rs(t,e,"beforeRetry"),afterResponse:Rs(t,e,"afterResponse"),beforeError:Rs(t,e,"beforeError")}),Zd=(...t)=>{let e={},n={},r={};for(const i of t)if(Array.isArray(i))Array.isArray(e)||(e=[]),e=[...e,...i];else if(pa(i)){for(let[o,a]of Object.entries(i))pa(a)&&o in e&&(a=Zd(e[o],a)),e={...e,[o]:a};pa(i.hooks)&&(r=F0(r,i.hooks),e.hooks=r),pa(i.headers)&&(n=B0(n,i.headers),e.headers=n)}return e},Rw=t=>N0.includes(t)?t.toUpperCase():t,Lg={limit:2,methods:["get","put","head","delete","options","trace"],statusCodes:[408,413,429,500,502,503,504],afterStatusCodes:[413,429,503],maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:t=>.3*2**(t-1)*1e3},Ow=(t={})=>{if(typeof t=="number")return{...Lg,limit:t};if(t.methods&&!Array.isArray(t.methods))throw new Error("retry.methods must be an array");if(t.statusCodes&&!Array.isArray(t.statusCodes))throw new Error("retry.statusCodes must be an array");return{...Lg,...t}};class fA{constructor(e,n={}){qr(this,"request");qr(this,"abortController");qr(this,"_retryCount",0);qr(this,"_input");qr(this,"_options");var r,i;if(this._input=e,this._options={...n,headers:B0(this._input.headers,n.headers),hooks:F0({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},n.hooks),method:Rw(n.method??this._input.method??"GET"),prefixUrl:String(n.prefixUrl||""),retry:Ow(n.retry),throwHttpErrors:n.throwHttpErrors!==!1,timeout:n.timeout??1e4,fetch:n.fetch??globalThis.fetch.bind(globalThis)},typeof this._input!="string"&&!(this._input instanceof URL||this._input instanceof globalThis.Request))throw new TypeError("`input` must be a string, URL, or Request");if(this._options.prefixUrl&&typeof this._input=="string"){if(this._input.startsWith("/"))throw new Error("`input` must not begin with a slash when using `prefixUrl`");this._options.prefixUrl.endsWith("/")||(this._options.prefixUrl+="/"),this._input=this._options.prefixUrl+this._input}if(vw&&Cw){const o=this._options.signal??this._input.signal;this.abortController=new globalThis.AbortController,this._options.signal=o?AbortSignal.any([o,this.abortController.signal]):this.abortController.signal}if(Qg&&(this._options.duplex="half"),this._options.json!==void 0&&(this._options.body=((i=(r=this._options).stringifyJson)==null?void 0:i.call(r,this._options.json))??JSON.stringify(this._options.json),this._options.headers.set("content-type",this._options.headers.get("content-type")??"application/json")),this.request=new globalThis.Request(this._input,this._options),this._options.searchParams){const o="?"+(typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(this._options.searchParams).toString()),a=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,o);!(Ew&&this._options.body instanceof globalThis.FormData||this._options.body instanceof URLSearchParams)||this._options.headers&&this._options.headers["content-type"]||this.request.headers.delete("content-type"),this.request=new globalThis.Request(new globalThis.Request(a,{...this.request}),this._options)}if(this._options.onUploadProgress){if(typeof this._options.onUploadProgress!="function")throw new TypeError("The `onUploadProgress` option must be a function");if(!Qg)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request.body&&(this.request=xw(this.request,this._options.onUploadProgress))}}static create(e,n){const r=new fA(e,n),i=async()=>{if(typeof r._options.timeout=="number"&&r._options.timeout>jg)throw new RangeError("The `timeout` option cannot be greater than 2147483647");await Promise.resolve();let a=await r._fetch();for(const s of r._options.hooks.afterResponse){const A=await s(r.request,r._options,r._decorateResponse(a.clone()));A instanceof globalThis.Response&&(a=A)}if(r._decorateResponse(a),!a.ok&&r._options.throwHttpErrors){let s=new kg(a,r.request,r._options);for(const A of r._options.hooks.beforeError)s=await A(s);throw s}if(r._options.onDownloadProgress){if(typeof r._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!yw)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return((s,A)=>{const c=Number(s.headers.get("content-length"))||0;let u=0;return s.status===204?(A&&A({percent:1,totalBytes:c,transferredBytes:u},new Uint8Array),new Response(null,{status:s.status,statusText:s.statusText,headers:s.headers})):new Response(new ReadableStream({async start(d){const f=s.body.getReader();A&&A({percent:0,transferredBytes:0,totalBytes:c},new Uint8Array),await async function p(){const{done:v,value:C}=await f.read();v?d.close():(A&&(u+=C.byteLength,A({percent:c===0?0:u/c,transferredBytes:u,totalBytes:c},C)),d.enqueue(C),await p())}()}}),{status:s.status,statusText:s.statusText,headers:s.headers})})(a.clone(),r._options.onDownloadProgress)}return a},o=(r._options.retry.methods.includes(r.request.method.toLowerCase())?r._retry(i):i()).finally(async()=>{var a;r.request.bodyUsed||await((a=r.request.body)==null?void 0:a.cancel())});for(const[a,s]of Object.entries(bw))o[a]=async()=>{r.request.headers.set("accept",r.request.headers.get("accept")||s);const A=await o;if(a==="json"){if(A.status===204||(await A.clone().arrayBuffer()).byteLength===0)return"";if(n.parseJson)return n.parseJson(await A.text())}return A[a]()};return o}_calculateRetryDelay(e){if(this._retryCount++,this._retryCount>this._options.retry.limit||e instanceof Pg)throw e;if(e instanceof kg){if(!this._options.retry.statusCodes.includes(e.response.status))throw e;const r=e.response.headers.get("Retry-After")??e.response.headers.get("RateLimit-Reset")??e.response.headers.get("X-RateLimit-Reset")??e.response.headers.get("X-Rate-Limit-Reset");if(r&&this._options.retry.afterStatusCodes.includes(e.response.status)){let i=1e3*Number(r);Number.isNaN(i)?i=Date.parse(r)-Date.now():i>=Date.parse("2024-01-01")&&(i-=Date.now());const o=this._options.retry.maxRetryAfter??i;return i<o?i:o}if(e.response.status===413)throw e}const n=this._options.retry.delay(this._retryCount);return Math.min(this._options.retry.backoffLimit,n)}_decorateResponse(e){return this._options.parseJson&&(e.json=async()=>this._options.parseJson(await e.text())),e}async _retry(e){try{return await e()}catch(n){const r=Math.min(this._calculateRetryDelay(n),jg);if(this._retryCount<1)throw n;await async function(i,{signal:o}){return new Promise((a,s)=>{function A(){clearTimeout(c),s(o.reason)}o&&(o.throwIfAborted(),o.addEventListener("abort",A,{once:!0}));const c=setTimeout(()=>{o==null||o.removeEventListener("abort",A),a()},i)})}(r,{signal:this._options.signal});for(const i of this._options.hooks.beforeRetry)if(await i({request:this.request,options:this._options,error:n,retryCount:this._retryCount})===D0)return;return this._retry(e)}}async _fetch(){for(const r of this._options.hooks.beforeRequest){const i=await r(this.request,this._options);if(i instanceof Request){this.request=i;break}if(i instanceof Response)return i}const e=((r,i)=>{const o={};for(const a in i)a in Iw||a in ww||a in r||(o[a]=i[a]);return o})(this.request,this._options),n=this.request;return this.request=n.clone(),this._options.timeout===!1?this._options.fetch(n,e):async function(r,i,o,a){return new Promise((s,A)=>{const c=setTimeout(()=>{o&&o.abort(),A(new Pg(r))},a.timeout);a.fetch(r,i).then(s).catch(A).then(()=>{clearTimeout(c)})})}(n,e,this.abortController,this._options)}}/*! MIT License © Sindre Sorhus */const ru=t=>{const e=(n,r)=>fA.create(n,xs(t,r));for(const n of N0)e[n]=(r,i)=>fA.create(r,xs(t,i,{method:n}));return e.create=n=>ru(xs(n)),e.extend=n=>(typeof n=="function"&&(n=n(t??{})),ru(xs(t,n))),e.stop=D0,e};var Vc,Mw=ru(),Tw=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},k0={exports:{}};/**
155
+ `))}startSendingKeepAlives(){this.configuration.keepAliveInterval&&!this.keepAliveInterval&&(this.keepAliveInterval=setInterval(()=>{this.sendKeepAlive(),this.startSendingKeepAlives()},(e=>{const n=.8*e;return 1e3*(Math.random()*(e-n)+n)})(this.configuration.keepAliveInterval)))}stopSendingKeepAlives(){this.keepAliveInterval&&clearInterval(this.keepAliveInterval),this.keepAliveDebounceTimeout&&clearTimeout(this.keepAliveDebounceTimeout),this.keepAliveInterval=void 0,this.keepAliveDebounceTimeout=void 0}};R0.defaultOptions={server:"",connectionTimeout:5,keepAliveInterval:0,keepAliveDebounce:10,traceSip:!0};let Fg=class Js{constructor(e={}){if(this._publishers={},this._registerers={},this._sessions={},this._subscriptions={},this._state=Dn.Stopped,this._stateEventEmitter=new Pa,this.delegate=e.delegate,this.options=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Js.defaultOptions()),{sipjsId:zi(5)}),{uri:new Ni("sip","anonymous."+zi(6),"anonymous.invalid")}),{viaHost:zi(12)+".invalid"}),Js.stripUndefinedProperties(e)),this.options.hackIpInContact)if(typeof this.options.hackIpInContact=="boolean"&&this.options.hackIpInContact){const i=Math.floor(Math.random()*254+1);this.options.viaHost="192.0.2."+i}else this.options.hackIpInContact&&(this.options.viaHost=this.options.hackIpInContact);switch(this.loggerFactory=new $S,this.logger=this.loggerFactory.getLogger("sip.UserAgent"),this.loggerFactory.builtinEnabled=this.options.logBuiltinEnabled,this.loggerFactory.connector=this.options.logConnector,this.options.logLevel){case"error":this.loggerFactory.level=On.error;break;case"warn":this.loggerFactory.level=On.warn;break;case"log":this.loggerFactory.level=On.log;break;case"debug":this.loggerFactory.level=On.debug}if(this.options.logConfiguration&&(this.logger.log("Configuration:"),Object.keys(this.options).forEach(n=>{const r=this.options[n];switch(n){case"uri":case"sessionDescriptionHandlerFactory":this.logger.log("· "+n+": "+r);break;case"authorizationPassword":this.logger.log("· "+n+": NOT SHOWN");break;case"transportConstructor":this.logger.log("· "+n+": "+r.name);break;default:this.logger.log("· "+n+": "+JSON.stringify(r))}})),this.options.transportOptions){const n=this.options.transportOptions,r=n.maxReconnectionAttempts,i=n.reconnectionTimeout;r!==void 0&&this.logger.warn('The transport option "maxReconnectionAttempts" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.'),i!==void 0&&this.logger.warn('The transport option "reconnectionTimeout" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.'),e.reconnectionDelay===void 0&&i!==void 0&&(this.options.reconnectionDelay=i),e.reconnectionAttempts===void 0&&r!==void 0&&(this.options.reconnectionAttempts=r)}if(e.reconnectionDelay!==void 0&&this.logger.warn('The user agent option "reconnectionDelay" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.'),e.reconnectionAttempts!==void 0&&this.logger.warn('The user agent option "reconnectionAttempts" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.'),this._transport=new this.options.transportConstructor(this.getLogger("sip.Transport"),this.options.transportOptions),this.initTransportCallbacks(),this._contact=this.initContact(),this._instanceId=this.options.instanceId?this.options.instanceId:Js.newUUID(),bn.parse(this._instanceId,"uuid")===-1)throw new Error("Invalid instanceId.");this._userAgentCore=this.initCore()}static makeURI(e){return bn.URIParse(e)}static defaultOptions(){return{allowLegacyNotifications:!1,authorizationHa1:"",authorizationPassword:"",authorizationUsername:"",delegate:{},contactName:"",contactParams:{transport:"ws"},displayName:"",forceRport:!1,gracefulShutdown:!0,hackAllowUnregisteredOptionTags:!1,hackIpInContact:!1,hackViaTcp:!1,instanceId:"",instanceIdAlwaysAdded:!1,logBuiltinEnabled:!0,logConfiguration:!0,logConnector:()=>{},logLevel:"log",noAnswerTimeout:60,preloadedRouteSet:[],reconnectionAttempts:0,reconnectionDelay:4,sendInitialProvisionalResponse:!0,sessionDescriptionHandlerFactory:mw(),sessionDescriptionHandlerFactoryOptions:{},sipExtension100rel:Nr.Unsupported,sipExtensionReplaces:Nr.Unsupported,sipExtensionExtraSupported:[],sipjsId:"",transportConstructor:R0,transportOptions:{},uri:new Ni("sip","anonymous","anonymous.invalid"),userAgentString:"SIP.js/0.21.1",viaHost:""}}static newUUID(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const n=Math.floor(16*Math.random());return(e==="x"?n:n%4+8).toString(16)})}static stripUndefinedProperties(e){return Object.keys(e).reduce((n,r)=>(e[r]!==void 0&&(n[r]=e[r]),n),{})}get configuration(){return this.options}get contact(){return this._contact}get instanceId(){return this._instanceId}get state(){return this._state}get stateChange(){return this._stateEventEmitter}get transport(){return this._transport}get userAgentCore(){return this._userAgentCore}getLogger(e,n){return this.loggerFactory.getLogger(e,n)}getLoggerFactory(){return this.loggerFactory}isConnected(){return this.transport.isConnected()}reconnect(){return this.state===Dn.Stopped?Promise.reject(new Error("User agent stopped.")):Promise.resolve().then(()=>this.transport.connect())}start(){return this.state===Dn.Started?(this.logger.warn("User agent already started"),Promise.resolve()):(this.logger.log(`Starting ${this.configuration.uri}`),this.transitionState(Dn.Started),this.transport.connect())}async stop(){if(this.state===Dn.Stopped)return this.logger.warn("User agent already stopped"),Promise.resolve();if(this.logger.log(`Stopping ${this.configuration.uri}`),!this.options.gracefulShutdown)return this.logger.log("Dispose of transport"),this.transport.dispose().catch(s=>{throw this.logger.error(s.message),s}),this.logger.log("Dispose of core"),this.userAgentCore.dispose(),this._publishers={},this._registerers={},this._sessions={},this._subscriptions={},this.transitionState(Dn.Stopped),Promise.resolve();const e=Object.assign({},this._publishers),n=Object.assign({},this._registerers),r=Object.assign({},this._sessions),i=Object.assign({},this._subscriptions),o=this.transport,a=this.userAgentCore;this.logger.log("Dispose of registerers");for(const s in n)n[s]&&await n[s].dispose().catch(A=>{throw this.logger.error(A.message),delete this._registerers[s],A});this.logger.log("Dispose of sessions");for(const s in r)r[s]&&await r[s].dispose().catch(A=>{throw this.logger.error(A.message),delete this._sessions[s],A});this.logger.log("Dispose of subscriptions");for(const s in i)i[s]&&await i[s].dispose().catch(A=>{throw this.logger.error(A.message),delete this._subscriptions[s],A});this.logger.log("Dispose of publishers");for(const s in e)e[s]&&await e[s].dispose().catch(A=>{throw this.logger.error(A.message),delete this._publishers[s],A});this.logger.log("Dispose of transport"),await o.dispose().catch(s=>{throw this.logger.error(s.message),s}),this.logger.log("Dispose of core"),a.dispose(),this.transitionState(Dn.Stopped)}_makeInviter(e,n){return new v0(this,e,n)}attemptReconnection(e=1){const n=this.options.reconnectionAttempts,r=this.options.reconnectionDelay;e>n?this.logger.log("Maximum reconnection attempts reached"):(this.logger.log(`Reconnection attempt ${e} of ${n} - trying`),setTimeout(()=>{this.reconnect().then(()=>{this.logger.log(`Reconnection attempt ${e} of ${n} - succeeded`)}).catch(i=>{this.logger.error(i.message),this.logger.log(`Reconnection attempt ${e} of ${n} - failed`),this.attemptReconnection(++e)})},e===1?0:1e3*r))}initContact(){const e=this.options.contactName!==""?this.options.contactName:zi(8),n=this.options.contactParams;return{pubGruu:void 0,tempGruu:void 0,uri:new Ni("sip",e,this.options.viaHost,void 0,n),toString:(r={})=>{const i=r.anonymous||!1,o=r.outbound||!1,a=r.register||!1;let s="<";return s+=i?this.contact.tempGruu||`sip:anonymous@anonymous.invalid;transport=${n.transport?n.transport:"ws"}`:a?this.contact.uri:this.contact.pubGruu||this.contact.uri,o&&(s+=";ob"),s+=">",this.options.instanceIdAlwaysAdded&&(s+=';+sip.instance="<urn:uuid:'+this._instanceId+'>"'),s}}}initCore(){let e=[];e.push("outbound"),this.options.sipExtension100rel===Nr.Supported&&e.push("100rel"),this.options.sipExtensionReplaces===Nr.Supported&&e.push("replaces"),this.options.sipExtensionExtraSupported&&e.push(...this.options.sipExtensionExtraSupported),this.options.hackAllowUnregisteredOptionTags||(e=e.filter(o=>JS[o])),e=Array.from(new Set(e));const n=e.slice();(this.contact.pubGruu||this.contact.tempGruu)&&n.push("gruu");const r={aor:this.options.uri,contact:this.contact,displayName:this.options.displayName,loggerFactory:this.loggerFactory,hackViaTcp:this.options.hackViaTcp,routeSet:this.options.preloadedRouteSet,supportedOptionTags:e,supportedOptionTagsResponse:n,sipjsId:this.options.sipjsId,userAgentHeaderFieldValue:this.options.userAgentString,viaForceRport:this.options.forceRport,viaHost:this.options.viaHost,authenticationFactory:()=>{const o=this.options.authorizationUsername?this.options.authorizationUsername:this.options.uri.user,a=this.options.authorizationPassword?this.options.authorizationPassword:void 0,s=this.options.authorizationHa1?this.options.authorizationHa1:void 0;return new _S(this.getLoggerFactory(),s,o,a)},transportAccessor:()=>this.transport},i={onInvite:o=>{var a;const s=new eu(this,o);if(o.delegate={onCancel:A=>{s._onCancel(A)},onTransportError:A=>{this.logger.error("A transport error has occurred while handling an incoming INVITE request.")}},o.trying(),this.options.sipExtensionReplaces!==Nr.Unsupported){const A=o.message.parseHeader("replaces");if(A){const c=A.call_id;if(typeof c!="string")throw new Error("Type of call id is not string");const u=A.replaces_to_tag;if(typeof u!="string")throw new Error("Type of to tag is not string");const d=A.replaces_from_tag;if(typeof d!="string")throw new Error("type of from tag is not string");const f=c+u+d,p=this.userAgentCore.dialogs.get(f);if(!p)return void s.reject({statusCode:481});if(!p.early&&A.early_only===!0)return void s.reject({statusCode:486});const v=this._sessions[c+d]||this._sessions[c+u]||void 0;if(!v)throw new Error("Session does not exist.");s._replacee=v}}if(!((a=this.delegate)===null||a===void 0)&&a.onInvite)return s.autoSendAnInitialProvisionalResponse?void s.progress().then(()=>{var A;if(((A=this.delegate)===null||A===void 0?void 0:A.onInvite)===void 0)throw new Error("onInvite undefined.");this.delegate.onInvite(s)}):void this.delegate.onInvite(s);s.reject({statusCode:486})},onMessage:o=>{if(this.delegate&&this.delegate.onMessage){const a=new p0(o);this.delegate.onMessage(a)}else o.accept()},onNotify:o=>{if(this.delegate&&this.delegate.onNotify){const a=new $l(o);this.delegate.onNotify(a)}else this.options.allowLegacyNotifications?o.accept():o.reject({statusCode:481})},onRefer:o=>{this.logger.warn("Received an out of dialog REFER request"),this.delegate&&this.delegate.onReferRequest?this.delegate.onReferRequest(o):o.reject({statusCode:405})},onRegister:o=>{this.logger.warn("Received an out of dialog REGISTER request"),this.delegate&&this.delegate.onRegisterRequest?this.delegate.onRegisterRequest(o):o.reject({statusCode:405})},onSubscribe:o=>{this.logger.warn("Received an out of dialog SUBSCRIBE request"),this.delegate&&this.delegate.onSubscribeRequest?this.delegate.onSubscribeRequest(o):o.reject({statusCode:405})}};return new pw(r,i)}initTransportCallbacks(){this.transport.onConnect=()=>this.onTransportConnect(),this.transport.onDisconnect=e=>this.onTransportDisconnect(e),this.transport.onMessage=e=>this.onTransportMessage(e)}onTransportConnect(){this.state!==Dn.Stopped&&this.delegate&&this.delegate.onConnect&&this.delegate.onConnect()}onTransportDisconnect(e){this.state!==Dn.Stopped&&(this.delegate&&this.delegate.onDisconnect&&this.delegate.onDisconnect(e),e&&this.options.reconnectionAttempts>0&&this.attemptReconnection())}onTransportMessage(e){const n=Ws.parseMessage(e,this.getLogger("sip.Parser"));if(!n)return void this.logger.warn("Failed to parse incoming message. Dropping.");if(this.state===Dn.Stopped&&n instanceof Bo)return void this.logger.warn(`Received ${n.method} request while stopped. Dropping.`);const r=()=>{const i=["from","to","call_id","cseq","via"];for(const o of i)if(!n.hasHeader(o))return this.logger.warn(`Missing mandatory header field : ${o}.`),!1;return!0};if(n instanceof Bo){if(!r())return void this.logger.warn("Request missing mandatory header field. Dropping.");if(!n.toTag&&n.callId.substr(0,5)===this.options.sipjsId)return void this.userAgentCore.replyStateless(n,{statusCode:482});const i=Qa(n.body),o=n.getHeader("content-length");if(o&&i<Number(o))return void this.userAgentCore.replyStateless(n,{statusCode:400})}if(n instanceof Fi){if(!r())return void this.logger.warn("Response missing mandatory header field. Dropping.");if(n.getHeaders("via").length>1)return void this.logger.warn("More than one Via header field present in the response. Dropping.");if(n.via.host!==this.options.viaHost||n.via.port!==void 0)return void this.logger.warn("Via sent-by in the response does not match UA Via host value. Dropping.");const i=Qa(n.body),o=n.getHeader("content-length");if(o&&i<Number(o))return void this.logger.warn("Message body length is lower than the value in Content-Length header field. Dropping.")}if(n instanceof Bo)this.userAgentCore.receiveIncomingRequestFromTransport(n);else{if(!(n instanceof Fi))throw new Error("Invalid message type.");this.userAgentCore.receiveIncomingResponseFromTransport(n)}}transitionState(e,n){const r=()=>{throw new Error(`Invalid state transition from ${this._state} to ${e}`)};switch(this._state){case Dn.Started:e!==Dn.Stopped&&r();break;case Dn.Stopped:e!==Dn.Started&&r();break;default:throw new Error("Unknown state.")}this.logger.log(`Transitioned from ${this._state} to ${e}`),this._state=e,this._stateEventEmitter.emit(this._state)}},M0=class{constructor(e){this.listeners=[],this.keyListeners={},this.data={...e},this.proxy=new Proxy(this.data,{set:(n,r,i)=>(n[r]!==i&&(n[r]=i,this.notify(),this.notifyKey(r,i)),!0)})}getState(){return this.proxy}setState(e,n=!1){let r=!1;for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const o=this.data[i],a=e[i];(n||o!==a)&&(this.data[i]=a,r=!0,this.notifyKey(i,a))}(r||n)&&this.notify()}subscribe(e){return this.listeners.push(e),()=>{this.listeners=this.listeners.filter(n=>n!==e)}}subscribeKey(e,n){return this.keyListeners[e]||(this.keyListeners[e]=[]),this.keyListeners[e].push(n),()=>{this.keyListeners[e]=this.keyListeners[e].filter(r=>r!==n)}}notify(){const e=this.getState();for(const n of this.listeners)n(e)}notifyKey(e,n){const r=this.keyListeners[e];r&&r.forEach(i=>i(n))}};var Mt,yn,it,Ar,ie,He,Kt;(function(t){t[t.IDLE=1]="IDLE",t[t.BUSY=2]="BUSY",t[t.RINGING=3]="RINGING",t[t.OFFLINE=0]="OFFLINE",t[t.UNREGISTERED=4]="UNREGISTERED"})(Mt||(Mt={})),function(t){t.OUTGOING="outgoing",t.INCOMING="incoming",t.CONSULT="consult",t.MEETING="meeting",t.TRANSFER="transfer",t.PREDICT_OUT_CALL="predict_out_call"}(yn||(yn={})),function(t){t[t.OUT_CALL=100]="OUT_CALL",t[t.AGENT_STATE=101]="AGENT_STATE",t[t.OUT_CALL_INCOMING_CALL=102]="OUT_CALL_INCOMING_CALL",t[t.OUT_CALL_RINGING=103]="OUT_CALL_RINGING",t[t.OUT_CALL_ANSWER=104]="OUT_CALL_ANSWER",t[t.CALL_HOLD=105]="CALL_HOLD",t[t.CALL_UNHOLD=106]="CALL_UNHOLD",t[t.OUT_CALL_END=107]="OUT_CALL_END",t[t.CONSULT_REQUEST=108]="CONSULT_REQUEST",t[t.CONSULT_RINGING=109]="CONSULT_RINGING",t[t.CONSULT_ANSWER=110]="CONSULT_ANSWER",t[t.CONSULT_FAIL=111]="CONSULT_FAIL",t[t.MUTE=112]="MUTE",t[t.UNMUTE=113]="UNMUTE",t[t.CONSULT_CALL_IN=114]="CONSULT_CALL_IN",t[t.CONSULT_CALL_IN_SUCCESS=115]="CONSULT_CALL_IN_SUCCESS",t[t.CONSULT_RETURN_CALL=125]="CONSULT_RETURN_CALL",t[t.CONSULT_RETURN_CALL_SUCCESS=126]="CONSULT_RETURN_CALL_SUCCESS",t[t.CONSULT_TRANSFER=116]="CONSULT_TRANSFER",t[t.CONSULT_TRANSFER_FAILED=118]="CONSULT_TRANSFER_FAILED",t[t.CONSULT_TRANSFER_OFF_HOOK=117]="CONSULT_TRANSFER_OFF_HOOK",t[t.INCOMING_CALL=119]="INCOMING_CALL",t[t.INCOMING_CALL_OFF_HOOK=120]="INCOMING_CALL_OFF_HOOK",t[t.INCOMING_CALL_END=121]="INCOMING_CALL_END",t[t.SATISFACTION_EVALUATION=122]="SATISFACTION_EVALUATION",t[t.CONSULT_THREE_WAY=123]="CONSULT_THREE_WAY",t[t.CONSULT_THREE_WAY_RESULT=124]="CONSULT_THREE_WAY_RESULT",t[t.TRANSFER=127]="TRANSFER",t[t.TRANSFER_FAILED=128]="TRANSFER_FAILED",t[t.TRANSFER_INCOMING_CALL=129]="TRANSFER_INCOMING_CALL",t[t.TRANSFER_OFF_HOOK=130]="TRANSFER_OFF_HOOK",t[t.AGENT_HANGUP=131]="AGENT_HANGUP",t[t.KICK_OFFLINE=132]="KICK_OFFLINE",t[t.CONTINUOUS_NOT_ANSWER=133]="CONTINUOUS_NOT_ANSWER",t[t.PREVIEW_OUT_CALL=134]="PREVIEW_OUT_CALL",t[t.SIGN_OUT=135]="SIGN_OUT",t[t.SIGN_IN_SWITCH_DEVICE=136]="SIGN_IN_SWITCH_DEVICE",t[t.LISTEN_CALL_FAILED=137]="LISTEN_CALL_FAILED",t[t.LISTEN_INCOMING_CALL=138]="LISTEN_INCOMING_CALL",t[t.LISTEN_INCOMING_CALL_OFF_HOOK=139]="LISTEN_INCOMING_CALL_OFF_HOOK",t[t.EAR_SPEECH=140]="EAR_SPEECH",t[t.STOP_EAR_SPEECH=141]="STOP_EAR_SPEECH",t[t.CALL_FORCE_INSERT=142]="CALL_FORCE_INSERT",t[t.INTERNAL_CALL_START_CONSULT=145]="INTERNAL_CALL_START_CONSULT",t[t.INTERNAL_CALL_END_CONSULT=146]="INTERNAL_CALL_END_CONSULT",t[t.CALL_SIP_INCOMING_CALL=147]="CALL_SIP_INCOMING_CALL"}(it||(it={})),function(t){t.WEB_RTC_CONNECTING="connecting",t.WEB_RTC_CONNECTED="connected",t.WEB_RTC_DISCONNECTING="disconnecting",t.WEB_RTC_DISCONNECTED="disconnected",t.WEB_RTC_REGISTERED="registered",t.WEB_RTC_UNREGISTERED="unregistered",t.WEB_RTC_TERMINATED="terminated",t.WEB_RTC_REGISTER_FAILED="register_failed",t.WEB_RTC_ANSWER_FAILED="answer_failed",t.WEB_RTC_SEND_DTMF="send_dtmf"}(Ar||(Ar={})),function(t){t.CUSTOMER_INFO="customer_info",t.CALL_PROGRESS="call_progress",t.OUT_INCOMING_CALL="out_call_incoming_call",t.INTERNAL_OUT_INCOMING_CALL="internal_out_incoming_call",t.PREVIEW_OUT_INCOMING_CALL="preview_out_incoming_call",t.OUT_SUCCESS="out_call_success",t.OUT_FAILED="out_call_failed",t.OUT_RINGING="out_call_ringing",t.OUT_OFF_ANSWER="out_call_answer",t.INTERNAL_OUT_OFF_ANSWER="internal_out_call_answer",t.HOLD_SUCCESS="hold_success",t.HOLD_FAILED="hold_failed",t.UNHOLD_SUCCESS="unhold_success",t.UNHOLD_FAILED="unhold_failed",t.OUT_HANGUP="out_call_hangup",t.CONSULT_RINGING="consult_ringing",t.CONSULT_OFF_HOOK="consult_off_hook",t.CONSULT_FAILED="consult_failed",t.CONSULT_INCOMING="consult_incoming",t.CONSULT_CALL_IN_SUCCESS="consult_call_in_success",t.CONSULT_RETURN_CALL_SUCCESS="consult_return_call_success",t.OTHER_SIDE_CONSULT_HANGUP="other_side_consult_hangup",t.OUR_SIDE_CONSULT_HANGUP="our_side_consult_hangup",t.AGENT_STATE="agent_state",t.MUTE_SUCCESS="mute_success",t.MUTE_FAILED="mute_failed",t.UNMUTE_SUCCESS="unmute_success",t.UNMUTE_FAILED="unmute_failed",t.CONSULT_TRANSFER_SUCCESS="consult_transfer_success",t.CONSULT_TRANSFER_FAILED="consult_transfer_failed",t.CONSULT_TRANSFER_OFF_HOOK="consult_transfer_off_hook",t.INCOMING_CALL="incoming_call",t.INCOMING_CALL_IN="incoming_call_in",t.PREDICT_INCOMING_CALL="predict_incoming_call",t.DUAL_CALL_INCOMING_CALL="dual_call_incoming_call",t.INCOMING_CALL_OFF_HOOK="incoming_call_off_hook",t.INCOMING_CALL_IN_OFF_HOOK="incoming_call_in_off_hook",t.INCOMING_CALL_END="incoming_call_end",t.SATISFACTION_EVALUATION_SUCCESS="satisfaction_evaluation_success",t.SATISFACTION_EVALUATION_FAILED="satisfaction_evaluation_failed",t.CONSULT_THREE_WAY_SUCCESS="consult_three_way_success",t.CONSULT_THREE_WAY_FAILED="consult_three_way_failed",t.THREE_WAY_OUR_SIDE_HANGUP="three_way_our_side_hangup",t.TRANSFER_FAILED="transfer_failed",t.TRANSFER_PROGRESS="transfer_progress",t.TRANSFER_INCOMING_CALL="transfer_incoming_call",t.TRANSFER_OFF_HOOK="transfer_off_hook",t.TRANSFER_END="transfer_end",t.REJECT="reject",t.LISTEN_CALL_FAILED="listen_call_failed",t.LISTEN_INCOMING_CALL="listen_incoming_call",t.LISTEN_INCOMING_CALL_OFF_HOOK="listen_incoming_call_off_hook",t.LISTEN_HANGUP="listen_hangup",t.EAR_SPEECH_SUCCESS="ear_speech_success",t.EAR_SPEECH_BE_SUCCESS="ear_speech_be_success",t.EAR_SPEECH_FAILED="ear_speech_failed",t.STOP_EAR_SPEECH_SUCCESS="stop_ear_speech_success",t.STOP_EAR_SPEECH_FAILED="stop_ear_speech_failed",t.CALL_FORCE_INSERT_SUCCESS="call_force_insert_success",t.CALL_FORCE_INSERT_SUCCESS_LISTENER="call_force_insert_success_listener",t.CALL_FORCE_INSERT_FAILED="call_force_insert_failed",t.CALL_SIP_INCOMING_CALL="call_sip_incoming_call"}(ie||(ie={})),function(t){t.EVENT_ALL="event_all",t.NOTIFICATION_CLICK="notification_click",t.UPDATE_ANSWER_DEVICE="update_answer_device",t.PHONE_BAR_OPERATION="phone_bar_operation",t.AGENT_INIT_STATUS="agent_init_status",t.WEBSITE_DELAY="website_delay",t.SELECT_EXTERNAL_NUMBER="select_external_number",t.FAIL_NOTIFICATION="fail_notification",t.KICK_OFF="kick_off",t.DESTROY="destroy",t.NETWORK_OFFLINE="network_offline",t.NETWORK_ONLINE="network_online",t.SIGN_OUT="sign_out",t.SIGN_IN_SWITCH_DEVICE="sign_in_switch_device"}(He||(He={})),function(t){t.RINGING="客户振铃",t.AGENT_RINGING="振铃中",t.CALLING="通话中",t.CONSULTING="正在咨询",t.CONSULT_CALL_IN="咨询来电",t.INCOMING_CALL="客户来电",t.MEETING="会议中",t.TRANSFERRING="转接中",t.TRANSFER_INCOMING_CALL="转接来电",t.HOLDING="保持中",t.MUTING="静音中",t.LISTENING="监听来电",t.LINKING="正在链接",t.OTHER_SIDE_CONSULTING="对方正咨询"}(Kt||(Kt={}));const la={all:vi=vi||new Map,on:function(t,e){var n=vi.get(t);n?n.push(e):vi.set(t,[e])},off:function(t,e){var n=vi.get(t);n&&(e?n.splice(n.indexOf(e)>>>0,1):vi.set(t,[]))},emit:function(t,e){var n=vi.get(t);n&&n.slice().map(function(r){r(e)}),(n=vi.get("*"))&&n.slice().map(function(r){r(t,e)})}};var vi;const fe={on:(t,e)=>(la.on(t,e),fe),off(t,e){la.off(t,e)},emit(t,e){la.emit(t,e),la.emit(He.EVENT_ALL,{event:t,data:e})},clearAllListeners(){la.all.clear()}},K={agentInfo:{},isRtcReconnecting:!1,sessionId:"",enableBrowserAlert:!1,autoStateTimer:null,autoAnswerTimer:null,logBuiltinEnabled:!1,browserAlertTime:3e3,latency:0,monitoredAgentNo:"",earSpeakAgent:"",stateObject:{state:Mt.BUSY,state_name:"忙碌"},isAgentHangup:!1},vr={isCalling:!1,direction:null,outCallIsAnswer:!1,incomingIsAnswer:!1,transferIsAnswer:!1,isMeeting:!1,isHold:!1,displayText:"",isMuted:!1,consultIsAnswer:!1,actionConfigs:[],answerDevice:1,selectOutNumber:"",customerObject:void 0,isNextState:!0,isSipConnected:!1},G=new class extends M0{updateIsCalling(t){this.setState({isCalling:t})}updateDirection(t){this.setState({direction:t})}updateOutCallIsAnswer(t){this.setState({outCallIsAnswer:t})}updateIsHold(t){var n;if(((n=K.stateObject)==null?void 0:n.state)===Mt.UNREGISTERED)return;const e=this.get("actionConfigs");if(t){const r=[...e.filter(i=>i!=="hold")];r.push("unhold"),this.updateActionConfigs(r)}else{const r=[...e.filter(i=>i!=="unhold")];r.push("hold"),this.updateActionConfigs(r)}this.setState({isHold:t})}updateDisplayText(t){this.setState({displayText:t}),fe.emit(ie.CALL_PROGRESS,t)}updateActionConfigs(t,e=!0){const{show_satisfaction:n}=K.agentInfo||{},r=this.get("answerDevice"),i=t.filter(o=>(n!==0||o!=="satisfaction"||!e)&&(r!==2&&r!==3||o!=="answer"));this.setState({actionConfigs:i}),fe.emit(He.PHONE_BAR_OPERATION,i)}updateConsultIsAnswer(t){this.setState({consultIsAnswer:t})}updateIsMuted(t){var n;if(((n=K.stateObject)==null?void 0:n.state)===Mt.UNREGISTERED)return;const e=this.get("actionConfigs");if(t){const r=[...e.filter(i=>i!=="mute")];r.push("unmute"),this.updateActionConfigs(r)}else{const r=[...e.filter(i=>i!=="unmute")];r.push("mute"),this.updateActionConfigs(r)}this.setState({isMuted:t})}updateIncomingIsAnswer(t){this.setState({incomingIsAnswer:t})}updateAnswerDevice(t){this.setState({answerDevice:t}),fe.emit(He.UPDATE_ANSWER_DEVICE,t)}updateIsMeeting(t){this.setState({isMeeting:t})}updateTransferIsAnswer(t){this.setState({transferIsAnswer:t})}updateSelectOutNumber(t){fe.emit(He.SELECT_EXTERNAL_NUMBER,t),this.setState({selectOutNumber:t})}updateCustomerInfo(t){const e=this.get("displayText");if(t&&e){const{contact_count:n,customer_name:r,phone:i,city:o,province:a,is_vip:s,in_contact_count:A,trace_id:c,contact_count_month:u,in_contact_count_month:d,type:f,session_id:p}=t;fe.emit(ie.CUSTOMER_INFO,{customer_name:r||"未知客户",phone:i,city:o||"未知",province:a||"未知",contact_count:n||0,in_contact_count:A||0,is_vip:s,trace_id:c,contact_count_month:u||0,in_contact_count_month:d||0,type:f,session_id:p})}else fe.emit(ie.CUSTOMER_INFO,void 0);this.setState({customerObject:t})}updateIsNextState(t){this.setState({isNextState:t}),t?fe.emit(He.NETWORK_ONLINE):(K.stateObject={state:Mt.OFFLINE,state_name:"离线"},this.updateActionConfigs([]),fe.emit(ie.AGENT_STATE,K.stateObject),fe.emit(He.NETWORK_OFFLINE))}updateIsSipConnected(t){this.setState({isSipConnected:t})}reset(){this.updateAnswerDevice(1),this.updateIsCalling(vr.isCalling),this.updateDirection(vr.direction),this.updateOutCallIsAnswer(vr.outCallIsAnswer),this.updateIsHold(vr.isHold),this.updateDisplayText(vr.displayText),this.updateActionConfigs(vr.actionConfigs),this.updateConsultIsAnswer(vr.consultIsAnswer),this.updateIsMuted(vr.isMuted),this.updateIncomingIsAnswer(vr.incomingIsAnswer),this.updateIsMeeting(vr.isMeeting),this.updateTransferIsAnswer(vr.transferIsAnswer),this.updateCustomerInfo(void 0)}getCallInfo(){return this.getState()}get(t){return this.getState()[t]}}(vr),T0=new class extends M0{updateRttObject(t){this.setState({rttObject:t}),fe.emit(He.WEBSITE_DELAY,t)}}({rttObject:{rtt:null,jitter:null,packetsLost:null,packetsReceived:null,packetsSent:null,sendBitrate:null,recvBitrate:null,codec:null}});let kg=class extends Error{constructor(n,r,i){const o=`${n.status||n.status===0?n.status:""} ${n.statusText||""}`.trim();super(`Request failed with ${o?`status code ${o}`:"an unknown error"}: ${r.method} ${r.url}`);qr(this,"response");qr(this,"request");qr(this,"options");this.name="HTTPError",this.response=n,this.request=r,this.options=i}};class Pg extends Error{constructor(n){super(`Request timed out: ${n.method} ${n.url}`);qr(this,"request");this.name="TimeoutError",this.request=n}}const Qg=(()=>{let t=!1,e=!1;const n=typeof globalThis.ReadableStream=="function",r=typeof globalThis.Request=="function";if(n&&r)try{e=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type")}catch(i){if(i instanceof Error&&i.message==="unsupported BodyInit type")return!1;throw i}return t&&!e})(),vw=typeof globalThis.AbortController=="function",Cw=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",yw=typeof globalThis.ReadableStream=="function",Ew=typeof globalThis.FormData=="function",N0=["get","post","put","patch","head","delete"],bw={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},jg=2147483647,Sw=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,D0=Symbol("stop"),ww={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0},Iw={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,dispatcher:!0,duplex:!0,priority:!0},xw=(t,e)=>{const n=(i=>{if(!i)return 0;if(i instanceof FormData){let o=0;for(const[a,s]of i)o+=Sw,o+=new TextEncoder().encode(`Content-Disposition: form-data; name="${a}"`).length,o+=typeof s=="string"?new TextEncoder().encode(s).length:s.size;return o}if(i instanceof Blob)return i.size;if(i instanceof ArrayBuffer)return i.byteLength;if(typeof i=="string")return new TextEncoder().encode(i).length;if(i instanceof URLSearchParams)return new TextEncoder().encode(i.toString()).length;if("byteLength"in i)return i.byteLength;if(typeof i=="object"&&i!==null)try{const o=JSON.stringify(i);return new TextEncoder().encode(o).length}catch{return 0}return 0})(t.body);let r=0;return new Request(t,{duplex:"half",body:new ReadableStream({async start(i){const o=t.body instanceof ReadableStream?t.body.getReader():new Response("").body.getReader();await async function a(){const{done:s,value:A}=await o.read();if(s)return e&&e({percent:1,transferredBytes:r,totalBytes:Math.max(n,r)},new Uint8Array),void i.close();r+=A.byteLength;let c=n===0?0:r/n;(n<r||c===1)&&(c=.99),e&&e({percent:Number(c.toFixed(2)),transferredBytes:r,totalBytes:n},A),i.enqueue(A),await a()}()}})})},pa=t=>t!==null&&typeof t=="object",xs=(...t)=>{for(const e of t)if((!pa(e)||Array.isArray(e))&&e!==void 0)throw new TypeError("The `options` argument must be an object");return Zd({},...t)},B0=(t={},e={})=>{const n=new globalThis.Headers(t),r=e instanceof globalThis.Headers,i=new globalThis.Headers(e);for(const[o,a]of i.entries())r&&a==="undefined"||a===void 0?n.delete(o):n.set(o,a);return n};function Rs(t,e,n){return Object.hasOwn(e,n)&&e[n]===void 0?[]:Zd(t[n]??[],e[n]??[])}const F0=(t={},e={})=>({beforeRequest:Rs(t,e,"beforeRequest"),beforeRetry:Rs(t,e,"beforeRetry"),afterResponse:Rs(t,e,"afterResponse"),beforeError:Rs(t,e,"beforeError")}),Zd=(...t)=>{let e={},n={},r={};for(const i of t)if(Array.isArray(i))Array.isArray(e)||(e=[]),e=[...e,...i];else if(pa(i)){for(let[o,a]of Object.entries(i))pa(a)&&o in e&&(a=Zd(e[o],a)),e={...e,[o]:a};pa(i.hooks)&&(r=F0(r,i.hooks),e.hooks=r),pa(i.headers)&&(n=B0(n,i.headers),e.headers=n)}return e},Rw=t=>N0.includes(t)?t.toUpperCase():t,Lg={limit:2,methods:["get","put","head","delete","options","trace"],statusCodes:[408,413,429,500,502,503,504],afterStatusCodes:[413,429,503],maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:t=>.3*2**(t-1)*1e3},Ow=(t={})=>{if(typeof t=="number")return{...Lg,limit:t};if(t.methods&&!Array.isArray(t.methods))throw new Error("retry.methods must be an array");if(t.statusCodes&&!Array.isArray(t.statusCodes))throw new Error("retry.statusCodes must be an array");return{...Lg,...t}};class fA{constructor(e,n={}){qr(this,"request");qr(this,"abortController");qr(this,"_retryCount",0);qr(this,"_input");qr(this,"_options");var r,i;if(this._input=e,this._options={...n,headers:B0(this._input.headers,n.headers),hooks:F0({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},n.hooks),method:Rw(n.method??this._input.method??"GET"),prefixUrl:String(n.prefixUrl||""),retry:Ow(n.retry),throwHttpErrors:n.throwHttpErrors!==!1,timeout:n.timeout??1e4,fetch:n.fetch??globalThis.fetch.bind(globalThis)},typeof this._input!="string"&&!(this._input instanceof URL||this._input instanceof globalThis.Request))throw new TypeError("`input` must be a string, URL, or Request");if(this._options.prefixUrl&&typeof this._input=="string"){if(this._input.startsWith("/"))throw new Error("`input` must not begin with a slash when using `prefixUrl`");this._options.prefixUrl.endsWith("/")||(this._options.prefixUrl+="/"),this._input=this._options.prefixUrl+this._input}if(vw&&Cw){const o=this._options.signal??this._input.signal;this.abortController=new globalThis.AbortController,this._options.signal=o?AbortSignal.any([o,this.abortController.signal]):this.abortController.signal}if(Qg&&(this._options.duplex="half"),this._options.json!==void 0&&(this._options.body=((i=(r=this._options).stringifyJson)==null?void 0:i.call(r,this._options.json))??JSON.stringify(this._options.json),this._options.headers.set("content-type",this._options.headers.get("content-type")??"application/json")),this.request=new globalThis.Request(this._input,this._options),this._options.searchParams){const o="?"+(typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(this._options.searchParams).toString()),a=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,o);!(Ew&&this._options.body instanceof globalThis.FormData||this._options.body instanceof URLSearchParams)||this._options.headers&&this._options.headers["content-type"]||this.request.headers.delete("content-type"),this.request=new globalThis.Request(new globalThis.Request(a,{...this.request}),this._options)}if(this._options.onUploadProgress){if(typeof this._options.onUploadProgress!="function")throw new TypeError("The `onUploadProgress` option must be a function");if(!Qg)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request.body&&(this.request=xw(this.request,this._options.onUploadProgress))}}static create(e,n){const r=new fA(e,n),i=async()=>{if(typeof r._options.timeout=="number"&&r._options.timeout>jg)throw new RangeError("The `timeout` option cannot be greater than 2147483647");await Promise.resolve();let a=await r._fetch();for(const s of r._options.hooks.afterResponse){const A=await s(r.request,r._options,r._decorateResponse(a.clone()));A instanceof globalThis.Response&&(a=A)}if(r._decorateResponse(a),!a.ok&&r._options.throwHttpErrors){let s=new kg(a,r.request,r._options);for(const A of r._options.hooks.beforeError)s=await A(s);throw s}if(r._options.onDownloadProgress){if(typeof r._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!yw)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return((s,A)=>{const c=Number(s.headers.get("content-length"))||0;let u=0;return s.status===204?(A&&A({percent:1,totalBytes:c,transferredBytes:u},new Uint8Array),new Response(null,{status:s.status,statusText:s.statusText,headers:s.headers})):new Response(new ReadableStream({async start(d){const f=s.body.getReader();A&&A({percent:0,transferredBytes:0,totalBytes:c},new Uint8Array),await async function p(){const{done:v,value:C}=await f.read();v?d.close():(A&&(u+=C.byteLength,A({percent:c===0?0:u/c,transferredBytes:u,totalBytes:c},C)),d.enqueue(C),await p())}()}}),{status:s.status,statusText:s.statusText,headers:s.headers})})(a.clone(),r._options.onDownloadProgress)}return a},o=(r._options.retry.methods.includes(r.request.method.toLowerCase())?r._retry(i):i()).finally(async()=>{var a;r.request.bodyUsed||await((a=r.request.body)==null?void 0:a.cancel())});for(const[a,s]of Object.entries(bw))o[a]=async()=>{r.request.headers.set("accept",r.request.headers.get("accept")||s);const A=await o;if(a==="json"){if(A.status===204||(await A.clone().arrayBuffer()).byteLength===0)return"";if(n.parseJson)return n.parseJson(await A.text())}return A[a]()};return o}_calculateRetryDelay(e){if(this._retryCount++,this._retryCount>this._options.retry.limit||e instanceof Pg)throw e;if(e instanceof kg){if(!this._options.retry.statusCodes.includes(e.response.status))throw e;const r=e.response.headers.get("Retry-After")??e.response.headers.get("RateLimit-Reset")??e.response.headers.get("X-RateLimit-Reset")??e.response.headers.get("X-Rate-Limit-Reset");if(r&&this._options.retry.afterStatusCodes.includes(e.response.status)){let i=1e3*Number(r);Number.isNaN(i)?i=Date.parse(r)-Date.now():i>=Date.parse("2024-01-01")&&(i-=Date.now());const o=this._options.retry.maxRetryAfter??i;return i<o?i:o}if(e.response.status===413)throw e}const n=this._options.retry.delay(this._retryCount);return Math.min(this._options.retry.backoffLimit,n)}_decorateResponse(e){return this._options.parseJson&&(e.json=async()=>this._options.parseJson(await e.text())),e}async _retry(e){try{return await e()}catch(n){const r=Math.min(this._calculateRetryDelay(n),jg);if(this._retryCount<1)throw n;await async function(i,{signal:o}){return new Promise((a,s)=>{function A(){clearTimeout(c),s(o.reason)}o&&(o.throwIfAborted(),o.addEventListener("abort",A,{once:!0}));const c=setTimeout(()=>{o==null||o.removeEventListener("abort",A),a()},i)})}(r,{signal:this._options.signal});for(const i of this._options.hooks.beforeRetry)if(await i({request:this.request,options:this._options,error:n,retryCount:this._retryCount})===D0)return;return this._retry(e)}}async _fetch(){for(const r of this._options.hooks.beforeRequest){const i=await r(this.request,this._options);if(i instanceof Request){this.request=i;break}if(i instanceof Response)return i}const e=((r,i)=>{const o={};for(const a in i)a in Iw||a in ww||a in r||(o[a]=i[a]);return o})(this.request,this._options),n=this.request;return this.request=n.clone(),this._options.timeout===!1?this._options.fetch(n,e):async function(r,i,o,a){return new Promise((s,A)=>{const c=setTimeout(()=>{o&&o.abort(),A(new Pg(r))},a.timeout);a.fetch(r,i).then(s).catch(A).then(()=>{clearTimeout(c)})})}(n,e,this.abortController,this._options)}}/*! MIT License © Sindre Sorhus */const ru=t=>{const e=(n,r)=>fA.create(n,xs(t,r));for(const n of N0)e[n]=(r,i)=>fA.create(r,xs(t,i,{method:n}));return e.create=n=>ru(xs(n)),e.extend=n=>(typeof n=="function"&&(n=n(t??{})),ru(xs(t,n))),e.stop=D0,e};var Vc,Mw=ru(),Tw=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},k0={exports:{}};/**
156
156
  * [js-md5]{@link https://github.com/emn178/js-md5}
157
157
  *
158
158
  * @namespace md5
@@ -160,7 +160,7 @@ React keys must be passed directly to JSX without using spread:
160
160
  * @author Chen, Yi-Cyuan [emn178@gmail.com]
161
161
  * @copyright Chen, Yi-Cyuan 2014-2023
162
162
  * @license MIT
163
- */Vc=k0,function(){var t="input is invalid type",e=typeof window=="object",n=e?window:{};n.JS_MD5_NO_WINDOW&&(e=!1);var r=!e&&typeof self=="object",i=!n.JS_MD5_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;i?n=Tw:r&&(n=self);var o,a=!n.JS_MD5_NO_COMMON_JS&&Vc.exports,s=!n.JS_MD5_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",A="0123456789abcdef".split(""),c=[128,32768,8388608,-2147483648],u=[0,8,16,24],d=["hex","array","digest","buffer","arrayBuffer","base64"],f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),p=[];if(s){var v=new ArrayBuffer(68);o=new Uint8Array(v),p=new Uint32Array(v)}var C=Array.isArray;!n.JS_MD5_NO_NODE_JS&&C||(C=function(E){return Object.prototype.toString.call(E)==="[object Array]"});var m=ArrayBuffer.isView;!s||!n.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW&&m||(m=function(E){return typeof E=="object"&&E.buffer&&E.buffer.constructor===ArrayBuffer});var y=function(E){var b=typeof E;if(b==="string")return[E,!0];if(b!=="object"||E===null)throw new Error(t);if(s&&E.constructor===ArrayBuffer)return[new Uint8Array(E),!1];if(!C(E)&&!m(E))throw new Error(t);return[E,!1]},w=function(E){return function(b){return new x(!0).update(b)[E]()}},I=function(E){var b,h=Og,S=Og.Buffer;return b=S.from&&!n.JS_MD5_NO_BUFFER_FROM?S.from:function(T){return new S(T)},function(T){if(typeof T=="string")return h.createHash("md5").update(T,"utf8").digest("hex");if(T==null)throw new Error(t);return T.constructor===ArrayBuffer&&(T=new Uint8Array(T)),C(T)||m(T)||T.constructor===S?h.createHash("md5").update(b(T)).digest("hex"):E(T)}},O=function(E){return function(b,h){return new g(b,!0).update(h)[E]()}};function x(E){if(E)p[0]=p[16]=p[1]=p[2]=p[3]=p[4]=p[5]=p[6]=p[7]=p[8]=p[9]=p[10]=p[11]=p[12]=p[13]=p[14]=p[15]=0,this.blocks=p,this.buffer8=o;else if(s){var b=new ArrayBuffer(68);this.buffer8=new Uint8Array(b),this.blocks=new Uint32Array(b)}else this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.h0=this.h1=this.h2=this.h3=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}function g(E,b){var h,S=y(E);if(E=S[0],S[1]){var T,R=[],D=E.length,B=0;for(h=0;h<D;++h)(T=E.charCodeAt(h))<128?R[B++]=T:T<2048?(R[B++]=192|T>>>6,R[B++]=128|63&T):T<55296||T>=57344?(R[B++]=224|T>>>12,R[B++]=128|T>>>6&63,R[B++]=128|63&T):(T=65536+((1023&T)<<10|1023&E.charCodeAt(++h)),R[B++]=240|T>>>18,R[B++]=128|T>>>12&63,R[B++]=128|T>>>6&63,R[B++]=128|63&T);E=R}E.length>64&&(E=new x(!0).update(E).array());var k=[],P=[];for(h=0;h<64;++h){var H=E[h]||0;k[h]=92^H,P[h]=54^H}x.call(this,b),this.update(P),this.oKeyPad=k,this.inner=!0,this.sharedMemory=b}x.prototype.update=function(E){if(this.finalized)throw new Error("finalize already called");var b=y(E);E=b[0];for(var h,S,T=b[1],R=0,D=E.length,B=this.blocks,k=this.buffer8;R<D;){if(this.hashed&&(this.hashed=!1,B[0]=B[16],B[16]=B[1]=B[2]=B[3]=B[4]=B[5]=B[6]=B[7]=B[8]=B[9]=B[10]=B[11]=B[12]=B[13]=B[14]=B[15]=0),T)if(s)for(S=this.start;R<D&&S<64;++R)(h=E.charCodeAt(R))<128?k[S++]=h:h<2048?(k[S++]=192|h>>>6,k[S++]=128|63&h):h<55296||h>=57344?(k[S++]=224|h>>>12,k[S++]=128|h>>>6&63,k[S++]=128|63&h):(h=65536+((1023&h)<<10|1023&E.charCodeAt(++R)),k[S++]=240|h>>>18,k[S++]=128|h>>>12&63,k[S++]=128|h>>>6&63,k[S++]=128|63&h);else for(S=this.start;R<D&&S<64;++R)(h=E.charCodeAt(R))<128?B[S>>>2]|=h<<u[3&S++]:h<2048?(B[S>>>2]|=(192|h>>>6)<<u[3&S++],B[S>>>2]|=(128|63&h)<<u[3&S++]):h<55296||h>=57344?(B[S>>>2]|=(224|h>>>12)<<u[3&S++],B[S>>>2]|=(128|h>>>6&63)<<u[3&S++],B[S>>>2]|=(128|63&h)<<u[3&S++]):(h=65536+((1023&h)<<10|1023&E.charCodeAt(++R)),B[S>>>2]|=(240|h>>>18)<<u[3&S++],B[S>>>2]|=(128|h>>>12&63)<<u[3&S++],B[S>>>2]|=(128|h>>>6&63)<<u[3&S++],B[S>>>2]|=(128|63&h)<<u[3&S++]);else if(s)for(S=this.start;R<D&&S<64;++R)k[S++]=E[R];else for(S=this.start;R<D&&S<64;++R)B[S>>>2]|=E[R]<<u[3&S++];this.lastByteIndex=S,this.bytes+=S-this.start,S>=64?(this.start=S-64,this.hash(),this.hashed=!0):this.start=S}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this},x.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var E=this.blocks,b=this.lastByteIndex;E[b>>>2]|=c[3&b],b>=56&&(this.hashed||this.hash(),E[0]=E[16],E[16]=E[1]=E[2]=E[3]=E[4]=E[5]=E[6]=E[7]=E[8]=E[9]=E[10]=E[11]=E[12]=E[13]=E[14]=E[15]=0),E[14]=this.bytes<<3,E[15]=this.hBytes<<3|this.bytes>>>29,this.hash()}},x.prototype.hash=function(){var E,b,h,S,T,R,D=this.blocks;this.first?b=((b=((E=((E=D[0]-680876937)<<7|E>>>25)-271733879|0)^(h=((h=(-271733879^(S=((S=(-1732584194^2004318071&E)+D[1]-117830708)<<12|S>>>20)+E|0)&(-271733879^E))+D[2]-1126478375)<<17|h>>>15)+S|0)&(S^E))+D[3]-1316259209)<<22|b>>>10)+h|0:(E=this.h0,b=this.h1,h=this.h2,b=((b+=((E=((E+=((S=this.h3)^b&(h^S))+D[0]-680876936)<<7|E>>>25)+b|0)^(h=((h+=(b^(S=((S+=(h^E&(b^h))+D[1]-389564586)<<12|S>>>20)+E|0)&(E^b))+D[2]+606105819)<<17|h>>>15)+S|0)&(S^E))+D[3]-1044525330)<<22|b>>>10)+h|0),b=((b+=((E=((E+=(S^b&(h^S))+D[4]-176418897)<<7|E>>>25)+b|0)^(h=((h+=(b^(S=((S+=(h^E&(b^h))+D[5]+1200080426)<<12|S>>>20)+E|0)&(E^b))+D[6]-1473231341)<<17|h>>>15)+S|0)&(S^E))+D[7]-45705983)<<22|b>>>10)+h|0,b=((b+=((E=((E+=(S^b&(h^S))+D[8]+1770035416)<<7|E>>>25)+b|0)^(h=((h+=(b^(S=((S+=(h^E&(b^h))+D[9]-1958414417)<<12|S>>>20)+E|0)&(E^b))+D[10]-42063)<<17|h>>>15)+S|0)&(S^E))+D[11]-1990404162)<<22|b>>>10)+h|0,b=((b+=((E=((E+=(S^b&(h^S))+D[12]+1804603682)<<7|E>>>25)+b|0)^(h=((h+=(b^(S=((S+=(h^E&(b^h))+D[13]-40341101)<<12|S>>>20)+E|0)&(E^b))+D[14]-1502002290)<<17|h>>>15)+S|0)&(S^E))+D[15]+1236535329)<<22|b>>>10)+h|0,b=((b+=((S=((S+=(b^h&((E=((E+=(h^S&(b^h))+D[1]-165796510)<<5|E>>>27)+b|0)^b))+D[6]-1069501632)<<9|S>>>23)+E|0)^E&((h=((h+=(E^b&(S^E))+D[11]+643717713)<<14|h>>>18)+S|0)^S))+D[0]-373897302)<<20|b>>>12)+h|0,b=((b+=((S=((S+=(b^h&((E=((E+=(h^S&(b^h))+D[5]-701558691)<<5|E>>>27)+b|0)^b))+D[10]+38016083)<<9|S>>>23)+E|0)^E&((h=((h+=(E^b&(S^E))+D[15]-660478335)<<14|h>>>18)+S|0)^S))+D[4]-405537848)<<20|b>>>12)+h|0,b=((b+=((S=((S+=(b^h&((E=((E+=(h^S&(b^h))+D[9]+568446438)<<5|E>>>27)+b|0)^b))+D[14]-1019803690)<<9|S>>>23)+E|0)^E&((h=((h+=(E^b&(S^E))+D[3]-187363961)<<14|h>>>18)+S|0)^S))+D[8]+1163531501)<<20|b>>>12)+h|0,b=((b+=((S=((S+=(b^h&((E=((E+=(h^S&(b^h))+D[13]-1444681467)<<5|E>>>27)+b|0)^b))+D[2]-51403784)<<9|S>>>23)+E|0)^E&((h=((h+=(E^b&(S^E))+D[7]+1735328473)<<14|h>>>18)+S|0)^S))+D[12]-1926607734)<<20|b>>>12)+h|0,b=((b+=((R=(S=((S+=((T=b^h)^(E=((E+=(T^S)+D[5]-378558)<<4|E>>>28)+b|0))+D[8]-2022574463)<<11|S>>>21)+E|0)^E)^(h=((h+=(R^b)+D[11]+1839030562)<<16|h>>>16)+S|0))+D[14]-35309556)<<23|b>>>9)+h|0,b=((b+=((R=(S=((S+=((T=b^h)^(E=((E+=(T^S)+D[1]-1530992060)<<4|E>>>28)+b|0))+D[4]+1272893353)<<11|S>>>21)+E|0)^E)^(h=((h+=(R^b)+D[7]-155497632)<<16|h>>>16)+S|0))+D[10]-1094730640)<<23|b>>>9)+h|0,b=((b+=((R=(S=((S+=((T=b^h)^(E=((E+=(T^S)+D[13]+681279174)<<4|E>>>28)+b|0))+D[0]-358537222)<<11|S>>>21)+E|0)^E)^(h=((h+=(R^b)+D[3]-722521979)<<16|h>>>16)+S|0))+D[6]+76029189)<<23|b>>>9)+h|0,b=((b+=((R=(S=((S+=((T=b^h)^(E=((E+=(T^S)+D[9]-640364487)<<4|E>>>28)+b|0))+D[12]-421815835)<<11|S>>>21)+E|0)^E)^(h=((h+=(R^b)+D[15]+530742520)<<16|h>>>16)+S|0))+D[2]-995338651)<<23|b>>>9)+h|0,b=((b+=((S=((S+=(b^((E=((E+=(h^(b|~S))+D[0]-198630844)<<6|E>>>26)+b|0)|~h))+D[7]+1126891415)<<10|S>>>22)+E|0)^((h=((h+=(E^(S|~b))+D[14]-1416354905)<<15|h>>>17)+S|0)|~E))+D[5]-57434055)<<21|b>>>11)+h|0,b=((b+=((S=((S+=(b^((E=((E+=(h^(b|~S))+D[12]+1700485571)<<6|E>>>26)+b|0)|~h))+D[3]-1894986606)<<10|S>>>22)+E|0)^((h=((h+=(E^(S|~b))+D[10]-1051523)<<15|h>>>17)+S|0)|~E))+D[1]-2054922799)<<21|b>>>11)+h|0,b=((b+=((S=((S+=(b^((E=((E+=(h^(b|~S))+D[8]+1873313359)<<6|E>>>26)+b|0)|~h))+D[15]-30611744)<<10|S>>>22)+E|0)^((h=((h+=(E^(S|~b))+D[6]-1560198380)<<15|h>>>17)+S|0)|~E))+D[13]+1309151649)<<21|b>>>11)+h|0,b=((b+=((S=((S+=(b^((E=((E+=(h^(b|~S))+D[4]-145523070)<<6|E>>>26)+b|0)|~h))+D[11]-1120210379)<<10|S>>>22)+E|0)^((h=((h+=(E^(S|~b))+D[2]+718787259)<<15|h>>>17)+S|0)|~E))+D[9]-343485551)<<21|b>>>11)+h|0,this.first?(this.h0=E+1732584193|0,this.h1=b-271733879|0,this.h2=h-1732584194|0,this.h3=S+271733878|0,this.first=!1):(this.h0=this.h0+E|0,this.h1=this.h1+b|0,this.h2=this.h2+h|0,this.h3=this.h3+S|0)},x.prototype.hex=function(){this.finalize();var E=this.h0,b=this.h1,h=this.h2,S=this.h3;return A[E>>>4&15]+A[15&E]+A[E>>>12&15]+A[E>>>8&15]+A[E>>>20&15]+A[E>>>16&15]+A[E>>>28&15]+A[E>>>24&15]+A[b>>>4&15]+A[15&b]+A[b>>>12&15]+A[b>>>8&15]+A[b>>>20&15]+A[b>>>16&15]+A[b>>>28&15]+A[b>>>24&15]+A[h>>>4&15]+A[15&h]+A[h>>>12&15]+A[h>>>8&15]+A[h>>>20&15]+A[h>>>16&15]+A[h>>>28&15]+A[h>>>24&15]+A[S>>>4&15]+A[15&S]+A[S>>>12&15]+A[S>>>8&15]+A[S>>>20&15]+A[S>>>16&15]+A[S>>>28&15]+A[S>>>24&15]},x.prototype.toString=x.prototype.hex,x.prototype.digest=function(){this.finalize();var E=this.h0,b=this.h1,h=this.h2,S=this.h3;return[255&E,E>>>8&255,E>>>16&255,E>>>24&255,255&b,b>>>8&255,b>>>16&255,b>>>24&255,255&h,h>>>8&255,h>>>16&255,h>>>24&255,255&S,S>>>8&255,S>>>16&255,S>>>24&255]},x.prototype.array=x.prototype.digest,x.prototype.arrayBuffer=function(){this.finalize();var E=new ArrayBuffer(16),b=new Uint32Array(E);return b[0]=this.h0,b[1]=this.h1,b[2]=this.h2,b[3]=this.h3,E},x.prototype.buffer=x.prototype.arrayBuffer,x.prototype.base64=function(){for(var E,b,h,S="",T=this.array(),R=0;R<15;)E=T[R++],b=T[R++],h=T[R++],S+=f[E>>>2]+f[63&(E<<4|b>>>4)]+f[63&(b<<2|h>>>6)]+f[63&h];return E=T[R],S+=f[E>>>2]+f[E<<4&63]+"=="},g.prototype=new x,g.prototype.finalize=function(){if(x.prototype.finalize.call(this),this.inner){this.inner=!1;var E=this.array();x.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(E),x.prototype.finalize.call(this)}};var M=function(){var E=w("hex");i&&(E=I(E)),E.create=function(){return new x},E.update=function(S){return E.create().update(S)};for(var b=0;b<d.length;++b){var h=d[b];E[h]=w(h)}return E}();M.md5=M,M.md5.hmac=function(){var E=O("hex");E.create=function(S){return new g(S)},E.update=function(S,T){return E.create(S).update(T)};for(var b=0;b<d.length;++b){var h=d[b];E[h]=O(h)}return E}(),a?Vc.exports=M:n.md5=M}();var Nw=k0.exports;const P0=(t,e)=>{const n=Date.now(),r=`${t}:${n}:${Nw.md5(`${e}${n}`)}`,i=new TextEncoder().encode(r);return btoa(String.fromCharCode(...i))},iu=t=>{if(/^\d+$/.test(t)||!t||typeof t!="string"||t.length%4!=0||!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t))return!1;try{const e=atob(t);return btoa(e)===t}catch{return!1}},Yi="/v1/aicc/bmserver",Or="/v1/aicc/ccs";let Si="",Kd="",Vd="",zc="";function Q0(t){const e=P0(Kd,Vd);return Mw.create({prefixUrl:`${Si}`,timeout:!1,headers:{Authorization:e,...t},hooks:{afterResponse:[async(n,r,i)=>{if(i.url.indexOf("heartbeat")!==-1)return i;const o=await i.clone().json();if(o.code!==0)throw new Error(JSON.stringify(o)||"请求失败");return i.json=async()=>o,i}]}})}async function yn(t,e,n){const r=Q0(n),i="api/"+t.replace(/^\/+/,"");return r.post(i,{json:e}).json()}const Ug=(t,e)=>yn(`${Or}/state/change?h=${e}`,t,{h:e}),Dw=()=>async function(t,e){const n=Q0(),r=t.replace(/^\/+/,"");return n.post(r,{json:e}).json()}("/heartbeat",{});class nn{static log(e,n={}){const{level:r="info",module:i="",timestamp:o=!0}=n;if(K.logBuiltinEnabled){const A=i?`[${i}]`:"",c=o?`[${new Date().toLocaleString()}]`:"";switch(r){case"debug":break;case"warn":console.warn(`${c}${A} ${e}`);break;case"error":console.error(`${c}${A} ${e}`)}}const a=K.agentInfo.agent_no;if(a){const A=JSON.stringify({level:r,module:i,content:e,timestamp:new Date().toISOString()});(s={agent_no:a,content:A},yn("/v1/aicc/ccs/softphone/log",s)).catch(()=>{})}var s}static debug(e,n){this.log(e,{level:"debug",module:n})}static info(e,n){this.log(e,{level:"info",module:n})}static warn(e,n){this.log(e,{level:"warn",module:n})}static error(e,n){this.log(e,{level:"error",module:n})}static errorObj(e,n){const r=JSON.stringify({message:e.message,stack:e.stack,name:e.name});this.log(r,{level:"error",module:n})}}class Bw{constructor(e,n){this.config=e,this.eventCallback=n,this.userAgent=null,this.registerer=null,this.activeSession=null,this.callTimeoutTimer=null,this.incomingInvitation=null,this.reconnectAttempts=0,this.maxReconnectAttempts=5,this.reconnectTimer=null,this.isOffline=!1,this.isManuallyStopped=!1,this.registerInterval=6e4,this.handleNetworkInfoChange=r=>{var i,o;if((i=r.rttObject)!=null&&i.rtt){const a=(o=r.rttObject)==null?void 0:o.rtt,s=a!=null&&a>0;s||this.isOffline?s&&this.isOffline&&(this.isOffline=!1,this.handleOnline()):(this.isOffline=!0,this.handleOffline())}},this.handleOffline=()=>{nn.warn("网络断开,准备销毁 SIP 客户端","sip-client.ts 75 handleOffline"),fe.emit(He.FAIL_NOTIFICATION,"网络断开,准备销毁 SIP 客户端"),this.destroy()},this.handleOnline=()=>{nn.warn("网络恢复,准备重新启动 SIP 客户端","sip-client.ts 82 handleOnline"),this.reconnect()},this.sleep=r=>new Promise(i=>setTimeout(i,r)),T0.subscribe(this.handleNetworkInfoChange)}async start(){const e=Fg.makeURI(`sip:${this.config.user}@${this.config.server}`);if(!e)throw new Error("无效的SIP配置");const n={uri:e,authorizationUsername:this.config.user,authorizationPassword:this.config.password,sendInitialProvisionalResponse:!1,transportOptions:{server:this.config.webSocket,connectionTimeout:10,keepAliveInterval:20,keepAliveDebounce:10},contactName:this.config.user,contactParams:{transport:"wss"},userAgentString:"SwiftSIP/2.0.21",sessionDescriptionHandlerFactoryOptions:{alwaysAcquireMediaFirst:!0,peerConnectionConfiguration:{iceServers:[{urls:"stun:stun.l.google.com:19302"}],iceCandidatePoolSize:0,iceTransportPolicy:"all",rtcpMuxPolicy:"require",bundlePolicy:"balanced",certificates:void 0,peerIdentity:void 0},iceGatheringTimeout:1e3},logBuiltinEnabled:K.logBuiltinEnabled};this.userAgent=new Fg(n),this.setupEventListeners(),await this.userAgent.start(),await this.register()}setupEventListeners(){this.userAgent&&(this.userAgent.transport.stateChange.addListener(e=>{var r;let n;switch(e){case dt.Connecting:n=Ar.WEB_RTC_CONNECTING;break;case dt.Connected:n=Ar.WEB_RTC_CONNECTED,this.reconnectAttempts=0,K.isRtcReconnecting=!1,G.updateIsSipConnected(!0),this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null);break;case dt.Disconnecting:n=Ar.WEB_RTC_DISCONNECTING,G.updateIsSipConnected(!1);break;case dt.Disconnected:{if(G.updateIsSipConnected(!1),this.isManuallyStopped)return nn.warn("手动断开,不触发重连","sip-client.ts 204"),void console.warn("[SIP] 手动断开,不触发重连");fe.emit(He.FAIL_NOTIFICATION,"软电话链接失败"),n=Ar.WEB_RTC_DISCONNECTED;const i=G.get("answerDevice");if(!K.isRtcReconnecting&&this.reconnectAttempts<this.maxReconnectAttempts&&i===1){this.reconnectAttempts++;const o=1e3*this.reconnectAttempts;nn.warn(`SIP WebSocket 断开,第 ${this.reconnectAttempts} 次尝试重连,${o}ms 后重试...`,"sip-client.ts 219"),this.reconnectTimer=setTimeout(()=>{this.reconnect()},o)}else this.reconnectAttempts>=this.maxReconnectAttempts&&(nn.warn(`SIP 重连失败:已达到最大重试次数; reconnectAttempts: ${this.reconnectAttempts}; maxReconnectAttempts: ${this.maxReconnectAttempts}`,"sip-client.ts 228"),console.error("SIP 重连失败:已达到最大重试次数"),fe.emit(He.FAIL_NOTIFICATION,"SIP 重连失败:已达到最大重试次数"));break}default:G.updateIsSipConnected(!1),n="unknown"}(r=this.eventCallback)==null||r.call(this,{type:n})}),this.userAgent.delegate={onInvite:e=>{this.handleIncomingCall(e)}})}async refreshRegister(){if(this.registerer)try{await this.registerer.register(),new Date().toLocaleTimeString()}catch(e){console.error("[SIPClient] REGISTER刷新失败",e)}}async register(){var e,n;if(this.userAgent){this.registerer=new tu(this.userAgent,{expires:120,refreshFrequency:80}),(e=this.registerer)==null||e.stateChange.addListener(r=>{var o;let i;switch(r){case jt.Initial:G.updateDisplayText(Kt.LINKING),i="initial";break;case jt.Registered:G.updateDisplayText(""),i=Ar.WEB_RTC_REGISTERED;break;case jt.Unregistered:i=Ar.WEB_RTC_UNREGISTERED;break;case jt.Terminated:nn.warn(`注册流程已终止,无法再注册(如 UA 停止,或网络不可达);regStatus: ${Ar.WEB_RTC_TERMINATED}`,"sip-client.ts 299"),i=Ar.WEB_RTC_TERMINATED;break;default:i="unknown"}(o=this.eventCallback)==null||o.call(this,{type:i})});try{await this.registerer.register()}catch(r){(n=this.eventCallback)==null||n.call(this,{type:Ar.WEB_RTC_REGISTER_FAILED,data:r})}}}attachRemoteAudio(e){const n=e.sessionDescriptionHandler;if(n){const r=n.peerConnection;if(!r)return;const i=new MediaStream;r.getReceivers().forEach(a=>{a.track&&a.track.kind==="audio"&&i.addTrack(a.track)});let o=document.getElementById("sip-remote-audio");o||(o=document.createElement("audio"),o.id="sip-remote-audio",o.autoplay=!0,o.style.display="none",document.body.appendChild(o)),o.srcObject=i,o.play().catch(a=>{console.error("音频播放失败,需要用户交互触发",a)})}}handleSessionState(e,n,r){e.stateChange.addListener(i=>{switch(i){case he.Established:clearTimeout(this.callTimeoutTimer),this.activeSession=e,this.attachRemoteAudio(e);break;case he.Terminating:break;case he.Terminated:this.activeSession=null,clearTimeout(this.callTimeoutTimer);case he.Establishing:}})}handleIncomingCall(e){this.incomingInvitation=e,this.handleSessionState(e,!1),e.progress({statusCode:180,reasonPhrase:"Ringing"}).catch(n=>console.error("发送 180 失败",n)),G.get("direction")===xn.OUTGOING&&this.answerCall()}async answerCall(){var e;if(!this.incomingInvitation)throw new Error("无来电可接听");K.autoAnswerTimer&&(clearTimeout(K.autoAnswerTimer),K.autoAnswerTimer=null);try{await this.incomingInvitation.accept(),this.activeSession=this.incomingInvitation,this.incomingInvitation=null}catch(n){(e=this.eventCallback)==null||e.call(this,{type:Ar.WEB_RTC_ANSWER_FAILED,data:{detail:n}})}}async rejectInCall(){var e;if(this.incomingInvitation)try{await this.incomingInvitation.reject(),this.incomingInvitation=null,G.updateDirection(null),G.updateIsCalling(!1),clearTimeout(this.callTimeoutTimer)}catch(n){(e=this.eventCallback)==null||e.call(this,{type:"error",data:{message:"拒接失败",detail:n}})}}sendDTMF(e){var r;if(!this.activeSession)throw new Error("当前没有活跃的通话");const n=this.activeSession.sessionDescriptionHandler;n&&typeof n.sendDtmf=="function"?(n.sendDtmf(e),(r=this.eventCallback)==null||r.call(this,{type:Ar.WEB_RTC_SEND_DTMF,data:{tone:e}})):(console.warn("DTMF发送不支持或未初始化"),nn.warn("DTMF发送不支持或未初始化","sip-client.ts 490 sendDTMF"))}async hangup(){if(this.activeSession,this.activeSession){clearTimeout(this.callTimeoutTimer);const e=this.activeSession;if(!e)return;const n=e.state;try{n===he.Established?await e.bye():n===he.Establishing&&(e instanceof v0?await e.cancel():e instanceof eu&&await e.reject()),clearTimeout(this.callTimeoutTimer)}catch(r){nn.error("挂断失败","sip-client.ts 522 hangup"),console.error("挂断失败",r)}finally{this.activeSession=null}}}async rejectOutCall(){this.activeSession instanceof eu&&(await this.activeSession.reject(),this.activeSession=null)}async destroy(){if(this.isManuallyStopped=!0,clearTimeout(this.callTimeoutTimer),this.activeSession&&await this.hangup(),this.registerer){try{await this.registerer.unregister()}catch(e){console.warn("注销失败",e)}this.registerer=null}this.userAgent&&(await this.userAgent.stop(),this.userAgent=null)}async reconnect(){if(!K.isRtcReconnecting){K.isRtcReconnecting=!0;try{this.isManuallyStopped=!1,await this.destroy(),await this.start(),this.isOffline=!1,this.reconnectAttempts=0}catch(e){console.error("重连失败",e),K.isRtcReconnecting=!1}finally{K.isRtcReconnecting=!1}}}async getNetworkStats(){var e;if(this.activeSession){const n=(e=this.activeSession.sessionDescriptionHandler)==null?void 0:e.peerConnection;if(!n)return null;const r=await n.getStats(),i={};return r.forEach(o=>{o.type==="candidate-pair"&&o.state==="succeeded"&&o.currentRoundTripTime!=null&&(i.rtt=+(1e3*o.currentRoundTripTime).toFixed(2)),o.type==="inbound-rtp"&&o.kind==="audio"&&(i.jitter=+(1e3*o.jitter).toFixed(2),i.packetsLost=o.packetsLost,i.packetsReceived=o.packetsReceived,o.bytesReceived&&o.timestamp&&(i.recvBitrate=+(o.bytesReceived/1024).toFixed(2))),o.type==="outbound-rtp"&&o.kind==="audio"&&(i.packetsSent=o.packetsSent,o.bytesSent&&o.timestamp&&(i.sendBitrate=+(o.bytesSent/1024).toFixed(2))),o.type==="codec"&&o.mimeType&&(i.codec=o.mimeType)}),{...i,rtt:(i==null?void 0:i.rtt)||40}}return{rtt:K.latency||1}}}class To{static requestPermission(){"Notification"in window&&Notification.permission==="default"&&Notification.requestPermission()}static async requestMediaPermissions(){try{return(await navigator.mediaDevices.enumerateDevices()).some(n=>n.kind==="audioinput"&&n.label!=="")?null:await navigator.mediaDevices.getUserMedia({audio:!0})}catch(e){return console.warn("获取音频权限失败:",e),null}}static show(e,n,r,i){if("Notification"in window&&Notification.permission==="granted"){const o=new Notification(e,{body:n,tag:`xy-global-notification${new Date().getTime()}`,renotify:!0});o.onclick=()=>{window.focus(),o.close(),r==null||r()},setTimeout(()=>o.close(),1e3*(i||3))}}static async checkMediaPermissions(){try{return(await navigator.mediaDevices.enumerateDevices()).some(e=>e.kind==="audioinput"&&e.label!=="")}catch(e){return console.warn("无法检查设备权限:",e),!1}}}const Fw=[],Vn=["call_number"],gA=["call_number"],kw=["hangup"],Ci=["hold","hangup","mute","transfer","consult","satisfaction","dtmf"],Yc=["hold","hangup","mute","transfer","consult"],Hg=["consult_transfer","conference","consult_retrieve"],Pw=["hangup"],Qw=["hangup"],Os=["answer","reject"],Gi=["hangup","consult","transfer","hold","mute","satisfaction","dtmf"],Gg=["hangup","whisper","force_insert","force_disconnect"],jw=["hangup"],Lw=["hangup","cancel_whisper","force_insert"],Uw=["hangup"],Hw=["hangup"];class ja{constructor(){this.roleData={agentInfo:()=>{var e;if(!((e=K.agentInfo)!=null&&e.agent_no))throw new Error(JSON.stringify({code:1,msg:"请先登录"}))},requestInfo:e=>{if(!e.data)throw new Error(JSON.stringify({code:1,msg:'Parameter "data" is required'}))},changeDevice:e=>{if(!e)throw new Error(JSON.stringify({code:1,msg:'Parameter "device" is required'}));const{answer_devices:n}=K.agentInfo;if(!n.split(",").map(r=>Number(r)).includes(e))throw new Error(JSON.stringify({code:1,msg:"当前状态不支持"}))},changeState:(e,n)=>{if(!e)throw new Error(JSON.stringify({code:1,msg:'Parameter "state" is required'}));if(!n)throw new Error(JSON.stringify({code:1,msg:'Parameter "state_name" is required'}));if(e===2&&(n==="通话中"||n==="整理"))throw new Error(JSON.stringify({code:1,msg:"当前状态不支持"}));if(![1,2].includes(e))throw new Error(JSON.stringify({code:1,msg:"当前状态不支持"}))},setAgentExplicit:e=>{const{out_display_select_switch:n,out_display_data:r}=K.agentInfo;if(n!==1)throw new Error(JSON.stringify({code:1,msg:"当前坐席设置未开启允许指定外显"}));if(!e)throw new Error(JSON.stringify({code:1,msg:'Parameter "number" is required'}));if(!(r||"").split("#").includes(e))throw new Error(JSON.stringify({code:1,msg:"当前外显号码不存在"}))}},this.changeDevice=async e=>{try{if(G.get("isCalling"))throw new Error(JSON.stringify({code:1,msg:"当前正在通话中,请勿切换设备"}));this.roleData.agentInfo(),this.roleData.requestInfo(e);const{data:n,success:r}=e,{device:i}=n;i===1&&await ja.initRtcFn(),this.roleData.changeDevice(i);const{agent_no:o}=K.agentInfo;await(s=>yn(`${Or}/device/change`,s))({agent_no:o,answer_device:i}),G.updateAnswerDevice(i);const a=G.get("actionConfigs");G.updateActionConfigs(a),i===2&&K.stateObject.state===Mt.UNREGISTERED&&await this._changeState({data:{...K.stateBeforeChange,state_name:K.stateBeforeChange.state===Mt.IDLE?"空闲":"忙碌"}},"q"),r==null||r({code:0,msg:"请求成功"})}catch(n){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(n.message).msg),n}}}formatDate(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")} ${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}:${String(e.getSeconds()).padStart(2,"0")}`}static setInitRtcFn(e){this.initRtcFn=e}async _agentLogin(e){try{const r=await(n={agent_no:e},yn(`${Or}/agent/login`,n));K.agentInfo=r.data}catch(r){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(r.message).msg),r}var n}async _changeState(e,n){try{K.autoStateTimer&&(clearTimeout(K.autoStateTimer),K.autoStateTimer=null),this.roleData.agentInfo(),this.roleData.requestInfo(e);const{data:r,success:i}=e,{state:o,state_name:a}=r,{agent_no:s}=K.agentInfo;await Ug({agent_no:s,state_name:a,state:o},n),o===Mt.IDLE?G.updateActionConfigs(Vn):o===Mt.BUSY&&G.updateActionConfigs(gA),K.stateObject={state:o,state_name:a},i==null||i({code:0,msg:"请求成功"})}catch(r){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(r.message).msg),r}}async _getInCallCrmDetail(e){var n;try{const{phone:r}=e.data,i={};iu(r)?i.trace_id=r:i.phone=r.replace(/[\s\r\n-]+/g,"");const o=await(a=>yn(`${Yi}/crm/popups`,a))({...i});(n=e.success)==null||n.call(e,o)}catch(r){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(r.message).msg),r}}async changeState(e,n){try{if(G.get("isCalling"))throw new Error(JSON.stringify({code:1,msg:"当前正在通话中,请勿切换设备"}));K.autoStateTimer&&(clearTimeout(K.autoStateTimer),K.autoStateTimer=null),this.roleData.agentInfo(),this.roleData.requestInfo(e);const{data:r,success:i}=e,{state:o,state_name:a}=r;this.roleData.changeState(o,a);const{agent_no:s}=K.agentInfo;await Ug({agent_no:s,state_name:a,state:o},n),(K.stateObject.state===Mt.IDLE||K.stateObject.state===Mt.BUSY&&a!=="整理")&&(K.stateBeforeChange=K.stateObject),o===Mt.IDLE?G.updateActionConfigs(Vn):o===Mt.BUSY&&G.updateActionConfigs(gA),K.stateObject={state:o,state_name:a},i==null||i({code:0,msg:"请求成功"})}catch(r){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(r.message).msg),r}}async getIdleAgentList(e){var r;const{agent_no:n}=K.agentInfo;try{this.roleData.agentInfo();const i=await(o=>yn(`${Or}/agent/free`,o))({agent_no:n});(r=e.success)==null||r.call(e,i)}catch(i){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(i.message).msg),i}}async getAgentState(e){var n;try{const r=await yn(`${Yi}/agent/statecfg/list`,{}),i=(r.data||[]).filter(o=>o.enable===0).filter(o=>o.state!==0&&o.state!==3).filter(o=>o.state_name!=="通话中"&&o.state_name!=="整理"&&o.state_name!=="未注册"&&o.state_name!=="离线接听").map(o=>({state:o.state,state_name:o.state_name})).reverse();(n=e.success)==null||n.call(e,{...r,data:i})}catch(r){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(r.message).msg),r}}async setAgentExplicit(e){var n;try{this.roleData.agentInfo(),this.roleData.requestInfo(e),this.roleData.setAgentExplicit(e.data.number);const{agent_id:r}=K.agentInfo;await(i=>yn(`${Yi}/agent/update`,i))({agent_id:r,out_display_number:e.data.number}),G.updateSelectOutNumber(e.data.number),(n=e.success)==null||n.call(e,{code:0,msg:"请求成功"})}catch(r){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(r.message).msg),r}}async checkAgentLogin(e){var n;try{this.roleData.requestInfo(e);const{agent_no:r}=e.data;if(!r)throw new Error(JSON.stringify({code:1,msg:'Parameter "agent_no" is required'}));const i=await(o=>yn(`${Or}/agent/islogin`,o))({agent_no:r});(n=e.success)==null||n.call(e,i)}catch(r){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(r.message).msg),r}}async getCallRecord(e){try{this.roleData.agentInfo();const{success:n}=e,r=new Date,i=new Date(r.getFullYear(),r.getMonth(),r.getDate(),0,0,0),o=new Date(r.getFullYear(),r.getMonth(),r.getDate(),23,59,59),a=[this.formatDate(i),this.formatDate(o)],{agent_no:s}=K.agentInfo,A=await(f=>yn(`${Yi}/agent/recordpage`,f))({start_time:a[0],end_time:a[1],page_no:1,page_size:10,agent_no_list:[s]}),{code:c,msg:u,data:d}=A;n==null||n({code:c,msg:u,data:d})}catch(n){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(n.message).msg),n}}async logout(e){this.roleData.agentInfo();try{const{agent_no:n}=K.agentInfo,{data:r,success:i}=e;await(o=>yn(`${Or}/agent/logout`,o))({...r,agent_no:n}),i==null||i({code:0,msg:""})}catch(n){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(n.message).msg),n}}async listenCall(e){try{const{agent_no:n}=K.agentInfo,{data:r,success:i}=e;if(this.roleData.agentInfo(),this.roleData.requestInfo(e),!r.monitored_agent_no)throw new Error(JSON.stringify({code:1,msg:'Parameter "monitored_agent_no" is required'}));await(o=>yn(`${Or}/call/monitor`,o))({...r,monitor_agent_no:n}),K.monitoredAgentNo=r.monitored_agent_no,i==null||i({code:0,msg:""})}catch(n){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(n.message).msg),n}}async earCall(e){try{const{agentInfo:n,monitoredAgentNo:r}=K,{agent_no:i}=n;this.roleData.agentInfo();const{success:o}=e;if(!r)throw new Error(JSON.stringify({code:1,msg:"当前未有监听坐席"}));await(a=>yn(`${Or}/call/whisper`,a))({monitored_agent_no:r,monitor_agent_no:i}),o==null||o({code:0,msg:""})}catch(n){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(n.message).msg),n}}async stopEarCall(e){try{const{agentInfo:n,earSpeakAgent:r}=K;if(!r)throw new Error(JSON.stringify({code:1,msg:"当前没有正在耳语的坐席"}));const{agent_no:i}=n;this.roleData.agentInfo();const{success:o}=e;await(a=>yn(`${Or}/call/stopwhisper`,a))({monitor_agent_no:i,monitored_agent_no:r}),o==null||o({code:0,msg:""})}catch(n){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(n.message).msg),n}}async forceInsert(e){try{const{agentInfo:n,monitoredAgentNo:r}=K,{agent_no:i}=n;this.roleData.agentInfo();const{success:o}=e;if(!r)throw new Error(JSON.stringify({code:1,msg:"当前未有监听坐席"}));await(a=>yn(`${Or}/call/bargein`,a))({monitored_agent_no:r,monitor_agent_no:i}),o==null||o({code:0,msg:""})}catch(n){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(n.message).msg),n}}async forceDisconnect(e){try{const{agentInfo:n,monitoredAgentNo:r}=K,{agent_no:i}=n;this.roleData.agentInfo();const{success:o}=e;if(!r)throw new Error(JSON.stringify({code:1,msg:"当前未有监听坐席"}));await(a=>yn(`${Or}/call/intercept`,a))({monitored_agent_no:r,monitor_agent_no:i}),o==null||o({code:0,msg:""})}catch(n){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(n.message).msg),n}}}const Gw=console.log,qg=(...t)=>{K.logBuiltinEnabled&&Gw(...t)};let ni=null;class An{constructor(e,n){this.url=e,this.onOpenCallback=n,this.ws=null,this.heartbeatWorker=null,this.reconnectDelay=3e3,this.manualClose=!1,this.apiClient=new ja,this.sipClient=null,this.pendingMessages=new Map,this.initWebSocket()}static getInstance({url:e,sipClient:n,onOpen:r}){if(!ni){if(!e)throw new Error("WebSocket 尚未初始化");ni=new An(e,r),ni.sipClient=n}return ni}setSipClient(e){this.sipClient=e}stateIdleChange(e){const{state:n}=K.stateObject;n!==Mt.IDLE&&this.apiClient._changeState({data:{...K.stateBeforeChange,state_name:K.stateBeforeChange.state===Mt.IDLE?"空闲":"忙碌"}},e)}inCallAutoAnswer(){const{soft_device_auto_answer:e,auto_answer_time:n}=K.agentInfo,r=e===1,i=G.get("direction");if(r&&i===xn.INCOMING){const o=Number(n)||0;o>0&&(K.autoAnswerTimer=setTimeout(()=>{var a;(a=this.sipClient)==null||a.answerCall(),K.autoAnswerTimer=null},o>0?1e3*o-500:0))}}async getCustomerInfo(e,n){try{await this.apiClient._getInCallCrmDetail({data:{phone:e},success:r=>{const{phone:i,trace_id:o,...a}=r.data,s={...a,type:n,session_id:K.sessionId,phone:r.data.phone,trace_id:r.data.trace_id};G.updateCustomerInfo(s)}})}catch{}}putAgentState(e,n){if(!e)return;if(n===5)return void this.stateIdleChange("device_type5");K.sessionId="";const{post_call_process_time:r}=K.agentInfo,i=r||0;if(K.autoStateTimer&&(clearTimeout(K.autoStateTimer),K.autoStateTimer=null),G.updateCustomerInfo(void 0),i>0){const{state:o}=K.stateObject;if(o===Mt.IDLE)return;this.apiClient._changeState({data:{state:Mt.BUSY,state_name:"整理"}},"ez"),K.autoStateTimer=setTimeout(()=>{K.autoStateTimer=null,this.stateIdleChange(`delay${i}`)},1e3*i)}else this.stateIdleChange("delay0")}stateBusyChange(){K.sessionId="",clearTimeout(K.autoStateTimer),G.updateCustomerInfo(void 0),this.apiClient._changeState({data:{state:Mt.BUSY,state_name:"忙碌"}},"dm")}initWebSocket(){var n;if(((n=this.ws)==null?void 0:n.readyState)===1||!G.get("isNextState")||this.manualClose)return;const e=P0(Kd,Vd);this.ws=new WebSocket(this.url+e),this.ws.onopen=()=>{const r=new Date().getTime();this.sendMessage({type:0,msg_id:r}),this.pendingMessages.set(r,performance.now()),this.startHeartbeat(),this.manualClose=!1,this.onOpenCallback&&this.onOpenCallback()},this.ws.onmessage=async r=>{var u;const i=JSON.parse(r.data),{type:o,data:a,code:s,msg:A,msg_id:c}=i;if(o===0&&c){const d=this.pendingMessages.get(c),f=performance.now()-d;K.latency=parseFloat(f.toFixed(2)),this.pendingMessages.delete(c)}if(o!==0&&qg("%cWebSocket 收到消息:","color: blue; font-weight: bold;",i),o!==it.OUT_CALL&&o!==it.PREVIEW_OUT_CALL||(K.isAgentHangup=!1,s!==0?(G.reset(),fe.emit(ie.OUT_FAILED,A),fe.emit(He.FAIL_NOTIFICATION,A),G.updateActionConfigs(Vn),setTimeout(()=>{G.updateCustomerInfo(void 0)},500),this.stateIdleChange("h")):s===0&&(fe.emit(ie.OUT_SUCCESS),K.sessionId=a.session_id,G.updateIsCalling(!0),clearTimeout(K.autoStateTimer))),o===it.AGENT_STATE){const{state:d,state_name:f}=a;K.stateObject={state:d,state_name:f},(u=K.stateBeforeChange)!=null&&u.state||K.stateObject.state!==Mt.IDLE&&(K.stateObject.state!==Mt.BUSY||f==="整理")||(K.stateBeforeChange=K.stateObject),f==="振铃中"&&G.updateDisplayText(Kt.AGENT_RINGING);const p=G.get("isCalling");d!==Mt.UNREGISTERED||p||G.updateActionConfigs(Fw),d===Mt.IDLE&&G.updateActionConfigs(Vn),fe.emit(ie.AGENT_STATE,{state:d,state_name:f})}else if(o===it.OUT_CALL_INCOMING_CALL)K.isAgentHangup=!1,a.preview_task_id?(this.getCustomerInfo(a.trace_id||a.customer_phone,"preview_out_incoming_call"),fe.emit(ie.PREVIEW_OUT_INCOMING_CALL,{customer_phone:a.customer_phone,session_id:a.session_id,preview_task_id:a.preview_task_id,trace_id:a.trace_id})):a.direction===0?(this.getCustomerInfo(a.trace_id||a.customer_phone,"out_call_incoming_call"),fe.emit(ie.OUT_INCOMING_CALL,{customer_phone:a.customer_phone,session_id:a.session_id,trace_id:a.trace_id})):a.direction===8&&(this.getCustomerInfo(a.trace_id||a.customer_phone,"internal_out_incoming_call"),fe.emit(ie.INTERNAL_OUT_INCOMING_CALL,{customer_phone:a.customer_phone,session_id:a.session_id,trace_id:a.trace_id})),K.sessionId=a.session_id,G.updateActionConfigs(kw,a.direction!==8);else if(o===it.OUT_CALL_END){if(K.sessionId!==a.session_id)return;if(G.updateDisplayText(""),a.device_type===1&&a.agent_no===K.agentInfo.agent_no)G.reset(),fe.emit(ie.OUT_HANGUP,{session_id:a.session_id,isAgentHangup:K.isAgentHangup}),G.updateActionConfigs(Vn),this.putAgentState(!0);else if(a.device_type===2&&a.agent_no===K.agentInfo.agent_no)G.reset(),fe.emit(ie.OUR_SIDE_CONSULT_HANGUP,{session_id:a.session_id}),G.updateActionConfigs(Vn),this.putAgentState(!0);else if(a.device_type===2&&a.agent_no!==K.agentInfo.agent_no)G.get("isCalling")&&(G.updateDisplayText(Kt.CALLING),fe.emit(ie.OTHER_SIDE_CONSULT_HANGUP,{session_id:a.session_id,isAgentHangup:K.isAgentHangup}),G.updateActionConfigs(Ci));else if(a.device_type===3&&a.agent_no===K.agentInfo.agent_no)G.reset(),fe.emit(ie.THREE_WAY_OUR_SIDE_HANGUP,{session_id:a.session_id}),G.updateActionConfigs(Vn),this.putAgentState(!0);else if(a.device_type===4&&a.agent_no===K.agentInfo.agent_no)G.reset(),fe.emit(ie.TRANSFER_END,{session_id:a.session_id}),G.updateActionConfigs(Vn),this.putAgentState(!0);else if(a.device_type===4&&a.agent_no!==K.agentInfo.agent_no){fe.emit(ie.TRANSFER_FAILED,"未知原因"),fe.emit(He.FAIL_NOTIFICATION,"转接失败");const d=G.get("direction");d===xn.OUTGOING?G.updateActionConfigs(Ci):d===xn.INCOMING&&G.updateActionConfigs(Gi)}else a.device_type===5&&a.agent_no===K.agentInfo.agent_no&&(K.monitoredAgentNo="",K.earSpeakAgent="",G.reset(),fe.emit(ie.LISTEN_HANGUP,{session_id:a.session_id}),G.updateActionConfigs(Vn),this.putAgentState(!0,5))}else if(o===it.OUT_CALL_RINGING)a.type===1&&(K.isAgentHangup=!1,fe.emit(ie.OUT_RINGING,{session_id:K.sessionId,type:a.type}),G.updateDisplayText(Kt.RINGING));else if(o===it.OUT_CALL_ANSWER)K.isAgentHangup=!1,clearTimeout(K.autoStateTimer),G.updateIsCalling(!0),G.updateOutCallIsAnswer(!0),G.updateDisplayText(Kt.CALLING),a.direction===8?(fe.emit(ie.INTERNAL_OUT_OFF_ANSWER,{session_id:K.sessionId}),G.updateActionConfigs(Yc)):(fe.emit(ie.OUT_OFF_ANSWER,{session_id:K.sessionId}),G.updateActionConfigs(Ci));else if(o===it.CONSULT_RINGING)K.isAgentHangup=!1,fe.emit(ie.CONSULT_RINGING,{session_id:a.session_id}),G.updateDisplayText(Kt.AGENT_RINGING),G.updateActionConfigs([]),clearTimeout(K.autoStateTimer);else if(o===it.CONSULT_ANSWER)K.isAgentHangup=!1,fe.emit(ie.CONSULT_OFF_HOOK,{session_id:a.session_id}),G.updateConsultIsAnswer(!0),G.updateDisplayText(Kt.CONSULTING),G.updateActionConfigs(Hg);else if(o===it.CONSULT_FAIL)fe.emit(ie.CONSULT_FAILED,{custom_reason:a.custom_reason}),G.updateDisplayText(Kt.CALLING),G.updateActionConfigs(Ci);else if(o===it.CONSULT_CALL_IN)K.isAgentHangup=!1,fe.emit(ie.CONSULT_INCOMING,{agent_no:a.agent_no,agent_mane:a.agent_name,session_id:a.session_id}),K.sessionId=a.session_id,G.updateIsCalling(!0),G.updateDirection(xn.CONSULT),G.updateDisplayText(Kt.CONSULT_CALL_IN),G.updateActionConfigs(Os),K.enableBrowserAlert&&To.show("📞 咨询来电",`坐席 [${a.agent_name}] 正在咨询...`,()=>{fe.emit(He.NOTIFICATION_CLICK,{agent_mane:a.agent_name,agent_no:a.agent_no})},K.browserAlertTime);else if(o===it.CONSULT_CALL_IN_SUCCESS)fe.emit(ie.CONSULT_CALL_IN_SUCCESS,{session_id:a.session_id}),G.updateConsultIsAnswer(!0),G.updateDisplayText(Kt.CALLING),G.updateActionConfigs(Pw);else if(o===it.CONSULT_RETURN_CALL_SUCCESS)a.status==="success"?(G.updateConsultIsAnswer(!1),fe.emit(ie.CONSULT_RETURN_CALL_SUCCESS),G.updateDisplayText(Kt.CALLING),fe.emit(ie.OTHER_SIDE_CONSULT_HANGUP),G.updateActionConfigs(Ci)):fe.emit(He.FAIL_NOTIFICATION,"媒体失败");else if(o===it.MUTE)s===0?(G.updateIsMuted(!0),fe.emit(ie.MUTE_SUCCESS),G.updateDisplayText(Kt.MUTING)):(fe.emit(ie.MUTE_FAILED,A),fe.emit(He.FAIL_NOTIFICATION,A));else if(o===it.UNMUTE)s===0?(G.updateIsMuted(!1),fe.emit(ie.UNMUTE_SUCCESS),G.updateDisplayText(Kt.CALLING)):(fe.emit(ie.UNMUTE_FAILED,A),fe.emit(He.FAIL_NOTIFICATION,A));else if(o===it.CALL_HOLD)s===0?(G.updateIsHold(!0),G.updateDisplayText(Kt.HOLDING),fe.emit(ie.HOLD_SUCCESS)):(fe.emit(ie.HOLD_FAILED,A),fe.emit(He.FAIL_NOTIFICATION,A));else if(o===it.CALL_UNHOLD)s===0?(G.updateDisplayText(Kt.CALLING),G.updateIsHold(!1),fe.emit(ie.UNHOLD_SUCCESS)):(fe.emit(ie.UNHOLD_FAILED,A),fe.emit(He.FAIL_NOTIFICATION,A));else if(o===it.CONSULT_TRANSFER)K.isAgentHangup=!1,s===0?fe.emit(ie.CONSULT_TRANSFER_SUCCESS):(fe.emit(ie.CONSULT_TRANSFER_FAILED,A),fe.emit(He.FAIL_NOTIFICATION,A));else if(o===it.CONSULT_TRANSFER_FAILED)fe.emit(ie.CONSULT_TRANSFER_FAILED,a.status);else if(o===it.CONSULT_TRANSFER_OFF_HOOK)G.updateDirection(xn.INCOMING),G.updateDisplayText(Kt.CALLING),fe.emit(ie.CONSULT_TRANSFER_OFF_HOOK),G.updateActionConfigs(Gi),G.updateIncomingIsAnswer(!0),G.updateConsultIsAnswer(!1);else if(o===it.INCOMING_CALL)K.isAgentHangup=!1,clearTimeout(K.autoStateTimer),K.sessionId=a.session_id,G.updateIsCalling(!0),G.updateDirection(xn.INCOMING),G.updateDisplayText(Kt.INCOMING_CALL),this.inCallAutoAnswer(),a.direction!==1&&a.direction!==4&&a.direction!==7||(this.getCustomerInfo(a.trace_id||a.customer_phone,"incoming_call"),fe.emit(ie.INCOMING_CALL,{customer_phone:a.customer_phone,trace_id:a.trace_id,session_id:a.session_id})),a.direction===8&&(this.getCustomerInfo(a.trace_id||a.customer_phone,"incoming_call_in"),fe.emit(ie.INCOMING_CALL_IN,{customer_phone:a.customer_phone,trace_id:a.trace_id,session_id:a.session_id})),a.direction===3&&(this.getCustomerInfo(a.trace_id||a.customer_phone,"predict_incoming_call"),fe.emit(ie.PREDICT_INCOMING_CALL,{customer_phone:a.customer_phone,trace_id:a.trace_id,session_id:a.session_id})),a.direction===6&&(this.getCustomerInfo(a.trace_id||a.customer_phone,"dual_call_incoming_call"),fe.emit(ie.DUAL_CALL_INCOMING_CALL,{customer_phone:a.customer_phone,trace_id:a.trace_id,session_id:a.session_id})),G.updateActionConfigs(Os),K.enableBrowserAlert&&To.show("📞 客户来电",`客户 [${a.customer_phone}] 正在呼入...`,()=>{fe.emit(He.NOTIFICATION_CLICK,{customer_phone:a.customer_phone})},K.browserAlertTime);else if(o===it.INCOMING_CALL_OFF_HOOK)G.updateIncomingIsAnswer(!0),a.direction===8?(G.updateActionConfigs(Yc),fe.emit(ie.INCOMING_CALL_IN_OFF_HOOK,{session_id:K.sessionId})):(G.updateActionConfigs(Gi),fe.emit(ie.INCOMING_CALL_OFF_HOOK,{session_id:K.sessionId})),G.updateDisplayText(Kt.CALLING);else if(o===it.INCOMING_CALL_END){if(K.sessionId!==a.session_id)return;if(G.updateDisplayText(""),a.device_type!==1&&a.device_type!==7||a.agent_no!==K.agentInfo.agent_no)if(a.device_type===2&&a.agent_no===K.agentInfo.agent_no)G.reset(),fe.emit(ie.OUR_SIDE_CONSULT_HANGUP,{session_id:a.session_id}),this.putAgentState(!0),G.updateActionConfigs(Vn);else if(a.device_type===2&&a.agent_no!==K.agentInfo.agent_no)G.updateDisplayText(Kt.CALLING),fe.emit(ie.OTHER_SIDE_CONSULT_HANGUP,{session_id:a.session_id,isAgentHangup:K.isAgentHangup}),G.updateActionConfigs(Ci);else if(a.device_type===3&&a.agent_no===K.agentInfo.agent_no)this.putAgentState(!0),G.reset(),fe.emit(ie.THREE_WAY_OUR_SIDE_HANGUP,{session_id:a.session_id}),G.updateActionConfigs(Vn);else if(a.device_type===4&&a.agent_no===K.agentInfo.agent_no)this.putAgentState(!0),G.reset(),fe.emit(ie.TRANSFER_END,{session_id:a.session_id}),G.updateActionConfigs(Vn);else if(a.device_type===4&&a.agent_no!==K.agentInfo.agent_no){fe.emit(ie.TRANSFER_FAILED,"未知原因"),fe.emit(He.FAIL_NOTIFICATION,"转接失败");const d=G.get("direction");d===xn.OUTGOING?G.updateActionConfigs(Ci):d===xn.INCOMING&&G.updateActionConfigs(Gi)}else a.device_type===5&&a.agent_no===K.agentInfo.agent_no&&(this.putAgentState(!0,5),K.monitoredAgentNo="",K.earSpeakAgent="",G.reset(),fe.emit(ie.LISTEN_HANGUP,{session_id:a.session_id}),G.updateActionConfigs(Vn));else this.putAgentState(!0),G.reset(),fe.emit(ie.INCOMING_CALL_END,{session_id:a.session_id,isAgentHangup:K.isAgentHangup}),G.updateActionConfigs(Vn)}else if(o===it.SATISFACTION_EVALUATION)s===0?fe.emit(ie.SATISFACTION_EVALUATION_SUCCESS):(fe.emit(ie.SATISFACTION_EVALUATION_FAILED,A),fe.emit(He.FAIL_NOTIFICATION,A));else if(o===it.CONSULT_THREE_WAY)s!==0?(fe.emit(ie.CONSULT_THREE_WAY_FAILED,A),fe.emit(He.FAIL_NOTIFICATION,A)):s===0&&G.updateIsMeeting(!0);else if(o===it.CONSULT_THREE_WAY_RESULT)a.status==="success"?(G.updateDirection(xn.MEETING),G.updateDisplayText(Kt.MEETING),G.updateActionConfigs(Qw),fe.emit(ie.CONSULT_THREE_WAY_SUCCESS)):(fe.emit(ie.CONSULT_THREE_WAY_FAILED,{conf_name:a.conf_name}),G.updateIsMeeting(!1));else if(o===it.TRANSFER_INCOMING_CALL)K.isAgentHangup=!1,clearTimeout(K.autoStateTimer),a.agent_no===K.agentInfo.agent_no?(G.updateDisplayText(Kt.TRANSFERRING),fe.emit(ie.TRANSFER_PROGRESS),G.updateActionConfigs([]),G.updateTransferIsAnswer(!0)):(K.sessionId=a.session_id,fe.emit(ie.TRANSFER_INCOMING_CALL,{agent_no:a.agent_no,agent_name:a.agent_name,session_id:a.session_id}),G.updateIsCalling(!0),G.updateDirection(xn.TRANSFER),G.updateDisplayText(Kt.TRANSFER_INCOMING_CALL),G.updateActionConfigs(Os),K.enableBrowserAlert&&To.show("📞 转接来电",`坐席 [${a.agent_no}] 正在转接...`,()=>{fe.emit(He.NOTIFICATION_CLICK,{agent_no:a.agent_no})},K.browserAlertTime));else if(o===it.TRANSFER_OFF_HOOK)fe.emit(ie.TRANSFER_OFF_HOOK,{session_id:K.sessionId}),G.updateTransferIsAnswer(!1),G.updateDisplayText(Kt.CALLING),G.updateActionConfigs(Gi,a.direction!==8);else if(o===it.TRANSFER_FAILED){if(a.status==="failed"){fe.emit(ie.TRANSFER_FAILED,"未知原因"),fe.emit(He.FAIL_NOTIFICATION,"转接失败");const d=G.get("direction");d===xn.OUTGOING?G.updateActionConfigs(Ci):d===xn.INCOMING&&G.updateActionConfigs(Gi)}}else o===it.KICK_OFFLINE?fe.emit(He.KICK_OFF):o===it.CONTINUOUS_NOT_ANSWER?(fe.emit(He.FAIL_NOTIFICATION,`已连续 ${a.miss_count} 次未接, 设置忙碌`),this.stateBusyChange()):o===it.SIGN_OUT?fe.emit(He.SIGN_OUT):o===it.SIGN_IN_SWITCH_DEVICE?fe.emit(He.SIGN_IN_SWITCH_DEVICE,a):o===it.LISTEN_INCOMING_CALL?(clearTimeout(K.autoStateTimer),K.sessionId=a.session_id,G.updateIsCalling(!0),G.updateDirection(xn.INCOMING),this.inCallAutoAnswer(),G.updateDisplayText(Kt.LISTENING),G.updateActionConfigs(Os),fe.emit(ie.LISTEN_INCOMING_CALL,{session_id:a.session_id}),K.enableBrowserAlert&&To.show("📞 监听来电","正在来电...",()=>{fe.emit(He.NOTIFICATION_CLICK,{customer_phone:a.customer_phone})},K.browserAlertTime)):o===it.LISTEN_INCOMING_CALL_OFF_HOOK?(K.monitoredAgentNo=a.monitored_agent_no,K.earSpeakAgent="",G.updateIncomingIsAnswer(!0),fe.emit(ie.LISTEN_INCOMING_CALL_OFF_HOOK,{session_id:K.sessionId,monitored_agent_no:a.monitored_agent_no}),G.updateActionConfigs(Gg),G.updateDisplayText(Kt.CALLING)):o===it.LISTEN_CALL_FAILED?a.status==="failed"&&(fe.emit(ie.LISTEN_CALL_FAILED),K.monitoredAgentNo=""):o===it.EAR_SPEECH?a.status==="success"?(a.monitored_agent_no===K.agentInfo.agent_no&&(G.updateActionConfigs(jw),fe.emit(ie.EAR_SPEECH_BE_SUCCESS)),a.monitor_agent_no===K.agentInfo.agent_no&&(G.updateActionConfigs(Lw),fe.emit(ie.EAR_SPEECH_SUCCESS,{monitored_agent_no:a.monitored_agent_no,monitor_agent_no:a.monitor_agent_no}),K.earSpeakAgent=a.monitored_agent_no)):fe.emit(ie.EAR_SPEECH_FAILED):o===it.STOP_EAR_SPEECH?a.status==="success"?(a.monitored_agent_no===K.agentInfo.agent_no&&G.updateActionConfigs(Gi),a.monitor_agent_no===K.agentInfo.agent_no&&G.updateActionConfigs(Gg),K.earSpeakAgent="",fe.emit(ie.STOP_EAR_SPEECH_SUCCESS)):fe.emit(ie.STOP_EAR_SPEECH_FAILED):o===it.CALL_FORCE_INSERT?a.status==="success"?(a.monitored_agent_no===K.agentInfo.agent_no&&(G.updateActionConfigs(Hw),fe.emit(ie.CALL_FORCE_INSERT_SUCCESS,{monitored_agent_no:a.monitored_agent_no,monitor_agent_no:a.monitor_agent_no})),a.monitor_agent_no===K.agentInfo.agent_no&&(G.updateActionConfigs(Uw),fe.emit(ie.CALL_FORCE_INSERT_SUCCESS_LISTENER,{monitored_agent_no:a.monitored_agent_no,monitor_agent_no:a.monitor_agent_no}))):fe.emit(ie.CALL_FORCE_INSERT_FAILED):o===it.INTERNAL_CALL_START_CONSULT?a.agent_no===K.agentInfo.agent_no?(G.updateConsultIsAnswer(!0),G.updateActionConfigs(Hg),G.updateDisplayText(Kt.CONSULTING)):(G.updateDisplayText(Kt.OTHER_SIDE_CONSULTING),G.updateActionConfigs([])):o===it.INTERNAL_CALL_END_CONSULT?(G.updateActionConfigs(Yc),G.updateDisplayText(""),G.updateConsultIsAnswer(!1)):o===it.CALL_SIP_INCOMING_CALL&&fe.emit(ie.CALL_SIP_INCOMING_CALL)},this.ws.onclose=r=>{fe.emit(He.FAIL_NOTIFICATION,"链接已断开,请检查网络"),this.stopHeartbeat();const i=G.get("isNextState");!this.manualClose&&i&&setTimeout(()=>this.initWebSocket(),this.reconnectDelay)},this.ws.onerror=r=>{var i;fe.emit(He.FAIL_NOTIFICATION,"连接失败,请检查网络"),(i=this.ws)==null||i.close()}}startHeartbeat(){const e=new Blob([`
163
+ */Vc=k0,function(){var t="input is invalid type",e=typeof window=="object",n=e?window:{};n.JS_MD5_NO_WINDOW&&(e=!1);var r=!e&&typeof self=="object",i=!n.JS_MD5_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;i?n=Tw:r&&(n=self);var o,a=!n.JS_MD5_NO_COMMON_JS&&Vc.exports,s=!n.JS_MD5_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",A="0123456789abcdef".split(""),c=[128,32768,8388608,-2147483648],u=[0,8,16,24],d=["hex","array","digest","buffer","arrayBuffer","base64"],f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),p=[];if(s){var v=new ArrayBuffer(68);o=new Uint8Array(v),p=new Uint32Array(v)}var C=Array.isArray;!n.JS_MD5_NO_NODE_JS&&C||(C=function(E){return Object.prototype.toString.call(E)==="[object Array]"});var m=ArrayBuffer.isView;!s||!n.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW&&m||(m=function(E){return typeof E=="object"&&E.buffer&&E.buffer.constructor===ArrayBuffer});var y=function(E){var b=typeof E;if(b==="string")return[E,!0];if(b!=="object"||E===null)throw new Error(t);if(s&&E.constructor===ArrayBuffer)return[new Uint8Array(E),!1];if(!C(E)&&!m(E))throw new Error(t);return[E,!1]},w=function(E){return function(b){return new x(!0).update(b)[E]()}},I=function(E){var b,h=Og,S=Og.Buffer;return b=S.from&&!n.JS_MD5_NO_BUFFER_FROM?S.from:function(T){return new S(T)},function(T){if(typeof T=="string")return h.createHash("md5").update(T,"utf8").digest("hex");if(T==null)throw new Error(t);return T.constructor===ArrayBuffer&&(T=new Uint8Array(T)),C(T)||m(T)||T.constructor===S?h.createHash("md5").update(b(T)).digest("hex"):E(T)}},O=function(E){return function(b,h){return new g(b,!0).update(h)[E]()}};function x(E){if(E)p[0]=p[16]=p[1]=p[2]=p[3]=p[4]=p[5]=p[6]=p[7]=p[8]=p[9]=p[10]=p[11]=p[12]=p[13]=p[14]=p[15]=0,this.blocks=p,this.buffer8=o;else if(s){var b=new ArrayBuffer(68);this.buffer8=new Uint8Array(b),this.blocks=new Uint32Array(b)}else this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.h0=this.h1=this.h2=this.h3=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}function g(E,b){var h,S=y(E);if(E=S[0],S[1]){var T,R=[],D=E.length,B=0;for(h=0;h<D;++h)(T=E.charCodeAt(h))<128?R[B++]=T:T<2048?(R[B++]=192|T>>>6,R[B++]=128|63&T):T<55296||T>=57344?(R[B++]=224|T>>>12,R[B++]=128|T>>>6&63,R[B++]=128|63&T):(T=65536+((1023&T)<<10|1023&E.charCodeAt(++h)),R[B++]=240|T>>>18,R[B++]=128|T>>>12&63,R[B++]=128|T>>>6&63,R[B++]=128|63&T);E=R}E.length>64&&(E=new x(!0).update(E).array());var k=[],P=[];for(h=0;h<64;++h){var H=E[h]||0;k[h]=92^H,P[h]=54^H}x.call(this,b),this.update(P),this.oKeyPad=k,this.inner=!0,this.sharedMemory=b}x.prototype.update=function(E){if(this.finalized)throw new Error("finalize already called");var b=y(E);E=b[0];for(var h,S,T=b[1],R=0,D=E.length,B=this.blocks,k=this.buffer8;R<D;){if(this.hashed&&(this.hashed=!1,B[0]=B[16],B[16]=B[1]=B[2]=B[3]=B[4]=B[5]=B[6]=B[7]=B[8]=B[9]=B[10]=B[11]=B[12]=B[13]=B[14]=B[15]=0),T)if(s)for(S=this.start;R<D&&S<64;++R)(h=E.charCodeAt(R))<128?k[S++]=h:h<2048?(k[S++]=192|h>>>6,k[S++]=128|63&h):h<55296||h>=57344?(k[S++]=224|h>>>12,k[S++]=128|h>>>6&63,k[S++]=128|63&h):(h=65536+((1023&h)<<10|1023&E.charCodeAt(++R)),k[S++]=240|h>>>18,k[S++]=128|h>>>12&63,k[S++]=128|h>>>6&63,k[S++]=128|63&h);else for(S=this.start;R<D&&S<64;++R)(h=E.charCodeAt(R))<128?B[S>>>2]|=h<<u[3&S++]:h<2048?(B[S>>>2]|=(192|h>>>6)<<u[3&S++],B[S>>>2]|=(128|63&h)<<u[3&S++]):h<55296||h>=57344?(B[S>>>2]|=(224|h>>>12)<<u[3&S++],B[S>>>2]|=(128|h>>>6&63)<<u[3&S++],B[S>>>2]|=(128|63&h)<<u[3&S++]):(h=65536+((1023&h)<<10|1023&E.charCodeAt(++R)),B[S>>>2]|=(240|h>>>18)<<u[3&S++],B[S>>>2]|=(128|h>>>12&63)<<u[3&S++],B[S>>>2]|=(128|h>>>6&63)<<u[3&S++],B[S>>>2]|=(128|63&h)<<u[3&S++]);else if(s)for(S=this.start;R<D&&S<64;++R)k[S++]=E[R];else for(S=this.start;R<D&&S<64;++R)B[S>>>2]|=E[R]<<u[3&S++];this.lastByteIndex=S,this.bytes+=S-this.start,S>=64?(this.start=S-64,this.hash(),this.hashed=!0):this.start=S}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this},x.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var E=this.blocks,b=this.lastByteIndex;E[b>>>2]|=c[3&b],b>=56&&(this.hashed||this.hash(),E[0]=E[16],E[16]=E[1]=E[2]=E[3]=E[4]=E[5]=E[6]=E[7]=E[8]=E[9]=E[10]=E[11]=E[12]=E[13]=E[14]=E[15]=0),E[14]=this.bytes<<3,E[15]=this.hBytes<<3|this.bytes>>>29,this.hash()}},x.prototype.hash=function(){var E,b,h,S,T,R,D=this.blocks;this.first?b=((b=((E=((E=D[0]-680876937)<<7|E>>>25)-271733879|0)^(h=((h=(-271733879^(S=((S=(-1732584194^2004318071&E)+D[1]-117830708)<<12|S>>>20)+E|0)&(-271733879^E))+D[2]-1126478375)<<17|h>>>15)+S|0)&(S^E))+D[3]-1316259209)<<22|b>>>10)+h|0:(E=this.h0,b=this.h1,h=this.h2,b=((b+=((E=((E+=((S=this.h3)^b&(h^S))+D[0]-680876936)<<7|E>>>25)+b|0)^(h=((h+=(b^(S=((S+=(h^E&(b^h))+D[1]-389564586)<<12|S>>>20)+E|0)&(E^b))+D[2]+606105819)<<17|h>>>15)+S|0)&(S^E))+D[3]-1044525330)<<22|b>>>10)+h|0),b=((b+=((E=((E+=(S^b&(h^S))+D[4]-176418897)<<7|E>>>25)+b|0)^(h=((h+=(b^(S=((S+=(h^E&(b^h))+D[5]+1200080426)<<12|S>>>20)+E|0)&(E^b))+D[6]-1473231341)<<17|h>>>15)+S|0)&(S^E))+D[7]-45705983)<<22|b>>>10)+h|0,b=((b+=((E=((E+=(S^b&(h^S))+D[8]+1770035416)<<7|E>>>25)+b|0)^(h=((h+=(b^(S=((S+=(h^E&(b^h))+D[9]-1958414417)<<12|S>>>20)+E|0)&(E^b))+D[10]-42063)<<17|h>>>15)+S|0)&(S^E))+D[11]-1990404162)<<22|b>>>10)+h|0,b=((b+=((E=((E+=(S^b&(h^S))+D[12]+1804603682)<<7|E>>>25)+b|0)^(h=((h+=(b^(S=((S+=(h^E&(b^h))+D[13]-40341101)<<12|S>>>20)+E|0)&(E^b))+D[14]-1502002290)<<17|h>>>15)+S|0)&(S^E))+D[15]+1236535329)<<22|b>>>10)+h|0,b=((b+=((S=((S+=(b^h&((E=((E+=(h^S&(b^h))+D[1]-165796510)<<5|E>>>27)+b|0)^b))+D[6]-1069501632)<<9|S>>>23)+E|0)^E&((h=((h+=(E^b&(S^E))+D[11]+643717713)<<14|h>>>18)+S|0)^S))+D[0]-373897302)<<20|b>>>12)+h|0,b=((b+=((S=((S+=(b^h&((E=((E+=(h^S&(b^h))+D[5]-701558691)<<5|E>>>27)+b|0)^b))+D[10]+38016083)<<9|S>>>23)+E|0)^E&((h=((h+=(E^b&(S^E))+D[15]-660478335)<<14|h>>>18)+S|0)^S))+D[4]-405537848)<<20|b>>>12)+h|0,b=((b+=((S=((S+=(b^h&((E=((E+=(h^S&(b^h))+D[9]+568446438)<<5|E>>>27)+b|0)^b))+D[14]-1019803690)<<9|S>>>23)+E|0)^E&((h=((h+=(E^b&(S^E))+D[3]-187363961)<<14|h>>>18)+S|0)^S))+D[8]+1163531501)<<20|b>>>12)+h|0,b=((b+=((S=((S+=(b^h&((E=((E+=(h^S&(b^h))+D[13]-1444681467)<<5|E>>>27)+b|0)^b))+D[2]-51403784)<<9|S>>>23)+E|0)^E&((h=((h+=(E^b&(S^E))+D[7]+1735328473)<<14|h>>>18)+S|0)^S))+D[12]-1926607734)<<20|b>>>12)+h|0,b=((b+=((R=(S=((S+=((T=b^h)^(E=((E+=(T^S)+D[5]-378558)<<4|E>>>28)+b|0))+D[8]-2022574463)<<11|S>>>21)+E|0)^E)^(h=((h+=(R^b)+D[11]+1839030562)<<16|h>>>16)+S|0))+D[14]-35309556)<<23|b>>>9)+h|0,b=((b+=((R=(S=((S+=((T=b^h)^(E=((E+=(T^S)+D[1]-1530992060)<<4|E>>>28)+b|0))+D[4]+1272893353)<<11|S>>>21)+E|0)^E)^(h=((h+=(R^b)+D[7]-155497632)<<16|h>>>16)+S|0))+D[10]-1094730640)<<23|b>>>9)+h|0,b=((b+=((R=(S=((S+=((T=b^h)^(E=((E+=(T^S)+D[13]+681279174)<<4|E>>>28)+b|0))+D[0]-358537222)<<11|S>>>21)+E|0)^E)^(h=((h+=(R^b)+D[3]-722521979)<<16|h>>>16)+S|0))+D[6]+76029189)<<23|b>>>9)+h|0,b=((b+=((R=(S=((S+=((T=b^h)^(E=((E+=(T^S)+D[9]-640364487)<<4|E>>>28)+b|0))+D[12]-421815835)<<11|S>>>21)+E|0)^E)^(h=((h+=(R^b)+D[15]+530742520)<<16|h>>>16)+S|0))+D[2]-995338651)<<23|b>>>9)+h|0,b=((b+=((S=((S+=(b^((E=((E+=(h^(b|~S))+D[0]-198630844)<<6|E>>>26)+b|0)|~h))+D[7]+1126891415)<<10|S>>>22)+E|0)^((h=((h+=(E^(S|~b))+D[14]-1416354905)<<15|h>>>17)+S|0)|~E))+D[5]-57434055)<<21|b>>>11)+h|0,b=((b+=((S=((S+=(b^((E=((E+=(h^(b|~S))+D[12]+1700485571)<<6|E>>>26)+b|0)|~h))+D[3]-1894986606)<<10|S>>>22)+E|0)^((h=((h+=(E^(S|~b))+D[10]-1051523)<<15|h>>>17)+S|0)|~E))+D[1]-2054922799)<<21|b>>>11)+h|0,b=((b+=((S=((S+=(b^((E=((E+=(h^(b|~S))+D[8]+1873313359)<<6|E>>>26)+b|0)|~h))+D[15]-30611744)<<10|S>>>22)+E|0)^((h=((h+=(E^(S|~b))+D[6]-1560198380)<<15|h>>>17)+S|0)|~E))+D[13]+1309151649)<<21|b>>>11)+h|0,b=((b+=((S=((S+=(b^((E=((E+=(h^(b|~S))+D[4]-145523070)<<6|E>>>26)+b|0)|~h))+D[11]-1120210379)<<10|S>>>22)+E|0)^((h=((h+=(E^(S|~b))+D[2]+718787259)<<15|h>>>17)+S|0)|~E))+D[9]-343485551)<<21|b>>>11)+h|0,this.first?(this.h0=E+1732584193|0,this.h1=b-271733879|0,this.h2=h-1732584194|0,this.h3=S+271733878|0,this.first=!1):(this.h0=this.h0+E|0,this.h1=this.h1+b|0,this.h2=this.h2+h|0,this.h3=this.h3+S|0)},x.prototype.hex=function(){this.finalize();var E=this.h0,b=this.h1,h=this.h2,S=this.h3;return A[E>>>4&15]+A[15&E]+A[E>>>12&15]+A[E>>>8&15]+A[E>>>20&15]+A[E>>>16&15]+A[E>>>28&15]+A[E>>>24&15]+A[b>>>4&15]+A[15&b]+A[b>>>12&15]+A[b>>>8&15]+A[b>>>20&15]+A[b>>>16&15]+A[b>>>28&15]+A[b>>>24&15]+A[h>>>4&15]+A[15&h]+A[h>>>12&15]+A[h>>>8&15]+A[h>>>20&15]+A[h>>>16&15]+A[h>>>28&15]+A[h>>>24&15]+A[S>>>4&15]+A[15&S]+A[S>>>12&15]+A[S>>>8&15]+A[S>>>20&15]+A[S>>>16&15]+A[S>>>28&15]+A[S>>>24&15]},x.prototype.toString=x.prototype.hex,x.prototype.digest=function(){this.finalize();var E=this.h0,b=this.h1,h=this.h2,S=this.h3;return[255&E,E>>>8&255,E>>>16&255,E>>>24&255,255&b,b>>>8&255,b>>>16&255,b>>>24&255,255&h,h>>>8&255,h>>>16&255,h>>>24&255,255&S,S>>>8&255,S>>>16&255,S>>>24&255]},x.prototype.array=x.prototype.digest,x.prototype.arrayBuffer=function(){this.finalize();var E=new ArrayBuffer(16),b=new Uint32Array(E);return b[0]=this.h0,b[1]=this.h1,b[2]=this.h2,b[3]=this.h3,E},x.prototype.buffer=x.prototype.arrayBuffer,x.prototype.base64=function(){for(var E,b,h,S="",T=this.array(),R=0;R<15;)E=T[R++],b=T[R++],h=T[R++],S+=f[E>>>2]+f[63&(E<<4|b>>>4)]+f[63&(b<<2|h>>>6)]+f[63&h];return E=T[R],S+=f[E>>>2]+f[E<<4&63]+"=="},g.prototype=new x,g.prototype.finalize=function(){if(x.prototype.finalize.call(this),this.inner){this.inner=!1;var E=this.array();x.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(E),x.prototype.finalize.call(this)}};var M=function(){var E=w("hex");i&&(E=I(E)),E.create=function(){return new x},E.update=function(S){return E.create().update(S)};for(var b=0;b<d.length;++b){var h=d[b];E[h]=w(h)}return E}();M.md5=M,M.md5.hmac=function(){var E=O("hex");E.create=function(S){return new g(S)},E.update=function(S,T){return E.create(S).update(T)};for(var b=0;b<d.length;++b){var h=d[b];E[h]=O(h)}return E}(),a?Vc.exports=M:n.md5=M}();var Nw=k0.exports;const P0=(t,e)=>{const n=Date.now(),r=`${t}:${n}:${Nw.md5(`${e}${n}`)}`,i=new TextEncoder().encode(r);return btoa(String.fromCharCode(...i))},iu=t=>{if(/^\d+$/.test(t)||!t||typeof t!="string"||t.length%4!=0||!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t))return!1;try{const e=atob(t);return btoa(e)===t}catch{return!1}},Yi="/v1/aicc/bmserver",Or="/v1/aicc/ccs";let Si="",Kd="",Vd="",zc="";function Q0(t){const e=P0(Kd,Vd);return Mw.create({prefixUrl:`${Si}`,timeout:!1,headers:{Authorization:e,...t},hooks:{afterResponse:[async(n,r,i)=>{if(i.url.indexOf("heartbeat")!==-1)return i;const o=await i.clone().json();if(o.code!==0)throw new Error(JSON.stringify(o)||"请求失败");return i.json=async()=>o,i}]}})}async function En(t,e,n){const r=Q0(n),i="api/"+t.replace(/^\/+/,"");return r.post(i,{json:e}).json()}const Ug=(t,e)=>En(`${Or}/state/change?h=${e}`,t,{h:e}),Dw=()=>async function(t,e){const n=Q0(),r=t.replace(/^\/+/,"");return n.post(r,{json:e}).json()}("/heartbeat",{});class nn{static log(e,n={}){const{level:r="info",module:i="",timestamp:o=!0}=n;if(K.logBuiltinEnabled){const A=i?`[${i}]`:"",c=o?`[${new Date().toLocaleString()}]`:"";switch(r){case"debug":break;case"warn":console.warn(`${c}${A} ${e}`);break;case"error":console.error(`${c}${A} ${e}`)}}const a=K.agentInfo.agent_no;if(a){const A=JSON.stringify({level:r,module:i,content:e,timestamp:new Date().toISOString()});(s={agent_no:a,content:A},En("/v1/aicc/ccs/softphone/log",s)).catch(()=>{})}var s}static debug(e,n){this.log(e,{level:"debug",module:n})}static info(e,n){this.log(e,{level:"info",module:n})}static warn(e,n){this.log(e,{level:"warn",module:n})}static error(e,n){this.log(e,{level:"error",module:n})}static errorObj(e,n){const r=JSON.stringify({message:e.message,stack:e.stack,name:e.name});this.log(r,{level:"error",module:n})}}class Bw{constructor(e,n){this.config=e,this.eventCallback=n,this.userAgent=null,this.registerer=null,this.activeSession=null,this.callTimeoutTimer=null,this.incomingInvitation=null,this.reconnectAttempts=0,this.maxReconnectAttempts=5,this.reconnectTimer=null,this.isOffline=!1,this.isManuallyStopped=!1,this.registerInterval=6e4,this.handleNetworkInfoChange=r=>{var i,o;if((i=r.rttObject)!=null&&i.rtt){const a=(o=r.rttObject)==null?void 0:o.rtt,s=a!=null&&a>0;s||this.isOffline?s&&this.isOffline&&(this.isOffline=!1,this.handleOnline()):(this.isOffline=!0,this.handleOffline())}},this.handleOffline=()=>{nn.warn("网络断开,准备销毁 SIP 客户端","sip-client.ts 75 handleOffline"),fe.emit(He.FAIL_NOTIFICATION,"网络断开,准备销毁 SIP 客户端"),this.destroy()},this.handleOnline=()=>{nn.warn("网络恢复,准备重新启动 SIP 客户端","sip-client.ts 82 handleOnline"),this.reconnect()},this.sleep=r=>new Promise(i=>setTimeout(i,r)),T0.subscribe(this.handleNetworkInfoChange)}async start(){const e=Fg.makeURI(`sip:${this.config.user}@${this.config.server}`);if(!e)throw new Error("无效的SIP配置");const n={uri:e,authorizationUsername:this.config.user,authorizationPassword:this.config.password,sendInitialProvisionalResponse:!1,transportOptions:{server:this.config.webSocket,connectionTimeout:10,keepAliveInterval:20,keepAliveDebounce:10},contactName:this.config.user,contactParams:{transport:"wss"},userAgentString:"SwiftSIP/2.0.21",sessionDescriptionHandlerFactoryOptions:{alwaysAcquireMediaFirst:!0,peerConnectionConfiguration:{iceServers:[{urls:"stun:stun.l.google.com:19302"}],iceCandidatePoolSize:0,iceTransportPolicy:"all",rtcpMuxPolicy:"require",bundlePolicy:"balanced",certificates:void 0,peerIdentity:void 0},iceGatheringTimeout:1e3},logBuiltinEnabled:K.logBuiltinEnabled};this.userAgent=new Fg(n),this.setupEventListeners(),await this.userAgent.start(),await this.register()}setupEventListeners(){this.userAgent&&(this.userAgent.transport.stateChange.addListener(e=>{var r;let n;switch(e){case dt.Connecting:n=Ar.WEB_RTC_CONNECTING;break;case dt.Connected:n=Ar.WEB_RTC_CONNECTED,this.reconnectAttempts=0,K.isRtcReconnecting=!1,G.updateIsSipConnected(!0),this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null);break;case dt.Disconnecting:n=Ar.WEB_RTC_DISCONNECTING,G.updateIsSipConnected(!1);break;case dt.Disconnected:{if(G.updateIsSipConnected(!1),this.isManuallyStopped)return nn.warn("手动断开,不触发重连","sip-client.ts 204"),void console.warn("[SIP] 手动断开,不触发重连");fe.emit(He.FAIL_NOTIFICATION,"软电话链接失败"),n=Ar.WEB_RTC_DISCONNECTED;const i=G.get("answerDevice");if(!K.isRtcReconnecting&&this.reconnectAttempts<this.maxReconnectAttempts&&i===1){this.reconnectAttempts++;const o=1e3*this.reconnectAttempts;nn.warn(`SIP WebSocket 断开,第 ${this.reconnectAttempts} 次尝试重连,${o}ms 后重试...`,"sip-client.ts 219"),this.reconnectTimer=setTimeout(()=>{this.reconnect()},o)}else this.reconnectAttempts>=this.maxReconnectAttempts&&(nn.warn(`SIP 重连失败:已达到最大重试次数; reconnectAttempts: ${this.reconnectAttempts}; maxReconnectAttempts: ${this.maxReconnectAttempts}`,"sip-client.ts 228"),console.error("SIP 重连失败:已达到最大重试次数"),fe.emit(He.FAIL_NOTIFICATION,"SIP 重连失败:已达到最大重试次数"));break}default:G.updateIsSipConnected(!1),n="unknown"}(r=this.eventCallback)==null||r.call(this,{type:n})}),this.userAgent.delegate={onInvite:e=>{this.handleIncomingCall(e)}})}async refreshRegister(){if(this.registerer)try{await this.registerer.register(),new Date().toLocaleTimeString()}catch(e){console.error("[SIPClient] REGISTER刷新失败",e)}}async register(){var e,n;if(this.userAgent){this.registerer=new tu(this.userAgent,{expires:120,refreshFrequency:80}),(e=this.registerer)==null||e.stateChange.addListener(r=>{var o;let i;switch(r){case jt.Initial:G.updateDisplayText(Kt.LINKING),i="initial";break;case jt.Registered:G.updateDisplayText(""),i=Ar.WEB_RTC_REGISTERED;break;case jt.Unregistered:i=Ar.WEB_RTC_UNREGISTERED;break;case jt.Terminated:nn.warn(`注册流程已终止,无法再注册(如 UA 停止,或网络不可达);regStatus: ${Ar.WEB_RTC_TERMINATED}`,"sip-client.ts 299"),i=Ar.WEB_RTC_TERMINATED;break;default:i="unknown"}(o=this.eventCallback)==null||o.call(this,{type:i})});try{await this.registerer.register()}catch(r){(n=this.eventCallback)==null||n.call(this,{type:Ar.WEB_RTC_REGISTER_FAILED,data:r})}}}attachRemoteAudio(e){const n=e.sessionDescriptionHandler;if(n){const r=n.peerConnection;if(!r)return;const i=new MediaStream;r.getReceivers().forEach(a=>{a.track&&a.track.kind==="audio"&&i.addTrack(a.track)});let o=document.getElementById("sip-remote-audio");o||(o=document.createElement("audio"),o.id="sip-remote-audio",o.autoplay=!0,o.style.display="none",document.body.appendChild(o)),o.srcObject=i,o.play().catch(a=>{console.error("音频播放失败,需要用户交互触发",a)})}}handleSessionState(e,n,r){e.stateChange.addListener(i=>{switch(i){case he.Established:clearTimeout(this.callTimeoutTimer),this.activeSession=e,this.attachRemoteAudio(e);break;case he.Terminating:break;case he.Terminated:this.activeSession=null,clearTimeout(this.callTimeoutTimer);case he.Establishing:}})}handleIncomingCall(e){this.incomingInvitation=e,this.handleSessionState(e,!1),e.progress({statusCode:180,reasonPhrase:"Ringing"}).catch(n=>console.error("发送 180 失败",n)),G.get("direction")===yn.OUTGOING&&this.answerCall()}async answerCall(){var e;if(!this.incomingInvitation)throw new Error("无来电可接听");K.autoAnswerTimer&&(clearTimeout(K.autoAnswerTimer),K.autoAnswerTimer=null);try{await this.incomingInvitation.accept(),this.activeSession=this.incomingInvitation,this.incomingInvitation=null}catch(n){(e=this.eventCallback)==null||e.call(this,{type:Ar.WEB_RTC_ANSWER_FAILED,data:{detail:n}})}}async rejectInCall(){var e;if(this.incomingInvitation)try{await this.incomingInvitation.reject(),this.incomingInvitation=null,G.updateDirection(null),G.updateIsCalling(!1),clearTimeout(this.callTimeoutTimer)}catch(n){(e=this.eventCallback)==null||e.call(this,{type:"error",data:{message:"拒接失败",detail:n}})}}sendDTMF(e){var r;if(!this.activeSession)throw new Error("当前没有活跃的通话");const n=this.activeSession.sessionDescriptionHandler;n&&typeof n.sendDtmf=="function"?(n.sendDtmf(e),(r=this.eventCallback)==null||r.call(this,{type:Ar.WEB_RTC_SEND_DTMF,data:{tone:e}})):(console.warn("DTMF发送不支持或未初始化"),nn.warn("DTMF发送不支持或未初始化","sip-client.ts 490 sendDTMF"))}async hangup(){if(this.activeSession,this.activeSession){clearTimeout(this.callTimeoutTimer);const e=this.activeSession;if(!e)return;const n=e.state;try{n===he.Established?await e.bye():n===he.Establishing&&(e instanceof v0?await e.cancel():e instanceof eu&&await e.reject()),clearTimeout(this.callTimeoutTimer)}catch(r){nn.error("挂断失败","sip-client.ts 522 hangup"),console.error("挂断失败",r)}finally{this.activeSession=null}}}async rejectOutCall(){this.activeSession instanceof eu&&(await this.activeSession.reject(),this.activeSession=null)}async destroy(){if(this.isManuallyStopped=!0,clearTimeout(this.callTimeoutTimer),this.activeSession&&await this.hangup(),this.registerer){try{await this.registerer.unregister()}catch(e){console.warn("注销失败",e)}this.registerer=null}this.userAgent&&(await this.userAgent.stop(),this.userAgent=null)}async reconnect(){if(!K.isRtcReconnecting){K.isRtcReconnecting=!0;try{this.isManuallyStopped=!1,await this.destroy(),await this.start(),this.isOffline=!1,this.reconnectAttempts=0}catch(e){console.error("重连失败",e),K.isRtcReconnecting=!1}finally{K.isRtcReconnecting=!1}}}async getNetworkStats(){var e;if(this.activeSession){const n=(e=this.activeSession.sessionDescriptionHandler)==null?void 0:e.peerConnection;if(!n)return null;const r=await n.getStats(),i={};return r.forEach(o=>{o.type==="candidate-pair"&&o.state==="succeeded"&&o.currentRoundTripTime!=null&&(i.rtt=+(1e3*o.currentRoundTripTime).toFixed(2)),o.type==="inbound-rtp"&&o.kind==="audio"&&(i.jitter=+(1e3*o.jitter).toFixed(2),i.packetsLost=o.packetsLost,i.packetsReceived=o.packetsReceived,o.bytesReceived&&o.timestamp&&(i.recvBitrate=+(o.bytesReceived/1024).toFixed(2))),o.type==="outbound-rtp"&&o.kind==="audio"&&(i.packetsSent=o.packetsSent,o.bytesSent&&o.timestamp&&(i.sendBitrate=+(o.bytesSent/1024).toFixed(2))),o.type==="codec"&&o.mimeType&&(i.codec=o.mimeType)}),{...i,rtt:(i==null?void 0:i.rtt)||40}}return{rtt:K.latency||1}}}class To{static requestPermission(){"Notification"in window&&Notification.permission==="default"&&Notification.requestPermission()}static async requestMediaPermissions(){try{return(await navigator.mediaDevices.enumerateDevices()).some(n=>n.kind==="audioinput"&&n.label!=="")?null:await navigator.mediaDevices.getUserMedia({audio:!0})}catch(e){return console.warn("获取音频权限失败:",e),null}}static show(e,n,r,i){if("Notification"in window&&Notification.permission==="granted"){const o=new Notification(e,{body:n,tag:`xy-global-notification${new Date().getTime()}`,renotify:!0});o.onclick=()=>{window.focus(),o.close(),r==null||r()},setTimeout(()=>o.close(),1e3*(i||3))}}static async checkMediaPermissions(){try{return(await navigator.mediaDevices.enumerateDevices()).some(e=>e.kind==="audioinput"&&e.label!=="")}catch(e){return console.warn("无法检查设备权限:",e),!1}}}const Fw=[],Vn=["call_number"],gA=["call_number"],kw=["hangup"],Ci=["hold","hangup","mute","transfer","consult","satisfaction","dtmf"],Yc=["hold","hangup","mute","transfer","consult"],Hg=["consult_transfer","conference","consult_retrieve"],Pw=["hangup"],Qw=["hangup"],Os=["answer","reject"],Gi=["hangup","consult","transfer","hold","mute","satisfaction","dtmf"],Gg=["hangup","whisper","force_insert","force_disconnect"],jw=["hangup"],Lw=["hangup","cancel_whisper","force_insert"],Uw=["hangup"],Hw=["hangup"];class ja{constructor(){this.roleData={agentInfo:()=>{var e;if(!((e=K.agentInfo)!=null&&e.agent_no))throw new Error(JSON.stringify({code:1,msg:"请先登录"}))},requestInfo:e=>{if(!e.data)throw new Error(JSON.stringify({code:1,msg:'Parameter "data" is required'}))},changeDevice:e=>{if(!e)throw new Error(JSON.stringify({code:1,msg:'Parameter "device" is required'}));const{answer_devices:n}=K.agentInfo;if(!n.split(",").map(r=>Number(r)).includes(e))throw new Error(JSON.stringify({code:1,msg:"当前状态不支持"}))},changeState:(e,n)=>{if(!e)throw new Error(JSON.stringify({code:1,msg:'Parameter "state" is required'}));if(!n)throw new Error(JSON.stringify({code:1,msg:'Parameter "state_name" is required'}));if(e===2&&(n==="通话中"||n==="整理"))throw new Error(JSON.stringify({code:1,msg:"当前状态不支持"}));if(![1,2].includes(e))throw new Error(JSON.stringify({code:1,msg:"当前状态不支持"}))},setAgentExplicit:e=>{const{out_display_select_switch:n,out_display_data:r}=K.agentInfo;if(n!==1)throw new Error(JSON.stringify({code:1,msg:"当前坐席设置未开启允许指定外显"}));if(!e)throw new Error(JSON.stringify({code:1,msg:'Parameter "number" is required'}));if(!(r||"").split("#").includes(e))throw new Error(JSON.stringify({code:1,msg:"当前外显号码不存在"}))}},this.changeDevice=async e=>{try{if(G.get("isCalling"))throw new Error(JSON.stringify({code:1,msg:"当前正在通话中,请勿切换设备"}));this.roleData.agentInfo(),this.roleData.requestInfo(e);const{data:n,success:r}=e,{device:i}=n;i===1&&await ja.initRtcFn(),this.roleData.changeDevice(i);const{agent_no:o}=K.agentInfo;await(s=>En(`${Or}/device/change`,s))({agent_no:o,answer_device:i}),G.updateAnswerDevice(i);const a=G.get("actionConfigs");G.updateActionConfigs(a),i===2&&K.stateObject.state===Mt.UNREGISTERED&&await this._changeState({data:{...K.stateBeforeChange,state_name:K.stateBeforeChange.state===Mt.IDLE?"空闲":"忙碌"}},"q"),r==null||r({code:0,msg:"请求成功"})}catch(n){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(n.message).msg),n}}}formatDate(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")} ${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}:${String(e.getSeconds()).padStart(2,"0")}`}static setInitRtcFn(e){this.initRtcFn=e}async _agentLogin(e){try{const r=await(n={agent_no:e},En(`${Or}/agent/login`,n));K.agentInfo=r.data}catch(r){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(r.message).msg),r}var n}async _changeState(e,n){try{K.autoStateTimer&&(clearTimeout(K.autoStateTimer),K.autoStateTimer=null),this.roleData.agentInfo(),this.roleData.requestInfo(e);const{data:r,success:i}=e,{state:o,state_name:a}=r,{agent_no:s}=K.agentInfo;await Ug({agent_no:s,state_name:a,state:o},n),o===Mt.IDLE?G.updateActionConfigs(Vn):o===Mt.BUSY&&G.updateActionConfigs(gA),K.stateObject={state:o,state_name:a},i==null||i({code:0,msg:"请求成功"})}catch(r){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(r.message).msg),r}}async _getInCallCrmDetail(e){var n;try{const{phone:r}=e.data,i={};iu(r)?i.trace_id=r:i.phone=r.replace(/[\s\r\n-]+/g,"");const o=await(a=>En(`${Yi}/crm/popups`,a))({...i});(n=e.success)==null||n.call(e,o)}catch(r){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(r.message).msg),r}}async changeState(e,n){try{if(G.get("isCalling"))throw new Error(JSON.stringify({code:1,msg:"当前正在通话中,请勿切换设备"}));K.autoStateTimer&&(clearTimeout(K.autoStateTimer),K.autoStateTimer=null),this.roleData.agentInfo(),this.roleData.requestInfo(e);const{data:r,success:i}=e,{state:o,state_name:a}=r;this.roleData.changeState(o,a);const{agent_no:s}=K.agentInfo;await Ug({agent_no:s,state_name:a,state:o},n),(K.stateObject.state===Mt.IDLE||K.stateObject.state===Mt.BUSY&&a!=="整理")&&(K.stateBeforeChange=K.stateObject),o===Mt.IDLE?G.updateActionConfigs(Vn):o===Mt.BUSY&&G.updateActionConfigs(gA),K.stateObject={state:o,state_name:a},i==null||i({code:0,msg:"请求成功"})}catch(r){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(r.message).msg),r}}async getIdleAgentList(e){var r;const{agent_no:n}=K.agentInfo;try{this.roleData.agentInfo();const i=await(o=>En(`${Or}/agent/free`,o))({agent_no:n});(r=e.success)==null||r.call(e,i)}catch(i){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(i.message).msg),i}}async getAgentState(e){var n;try{const r=await En(`${Yi}/agent/statecfg/list`,{}),i=(r.data||[]).filter(o=>o.enable===0).filter(o=>o.state!==0&&o.state!==3).filter(o=>o.state_name!=="通话中"&&o.state_name!=="整理"&&o.state_name!=="未注册"&&o.state_name!=="离线接听").map(o=>({state:o.state,state_name:o.state_name})).reverse();(n=e.success)==null||n.call(e,{...r,data:i})}catch(r){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(r.message).msg),r}}async setAgentExplicit(e){var n;try{this.roleData.agentInfo(),this.roleData.requestInfo(e),this.roleData.setAgentExplicit(e.data.number);const{agent_id:r}=K.agentInfo;await(i=>En(`${Yi}/agent/update`,i))({agent_id:r,out_display_number:e.data.number}),G.updateSelectOutNumber(e.data.number),(n=e.success)==null||n.call(e,{code:0,msg:"请求成功"})}catch(r){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(r.message).msg),r}}async checkAgentLogin(e){var n;try{this.roleData.requestInfo(e);const{agent_no:r}=e.data;if(!r)throw new Error(JSON.stringify({code:1,msg:'Parameter "agent_no" is required'}));const i=await(o=>En(`${Or}/agent/islogin`,o))({agent_no:r});(n=e.success)==null||n.call(e,i)}catch(r){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(r.message).msg),r}}async getCallRecord(e){try{this.roleData.agentInfo();const{success:n}=e,r=new Date,i=new Date(r.getFullYear(),r.getMonth(),r.getDate(),0,0,0),o=new Date(r.getFullYear(),r.getMonth(),r.getDate(),23,59,59),a=[this.formatDate(i),this.formatDate(o)],{agent_no:s}=K.agentInfo,A=await(f=>En(`${Yi}/agent/recordpage`,f))({start_time:a[0],end_time:a[1],page_no:1,page_size:10,agent_no_list:[s]}),{code:c,msg:u,data:d}=A;n==null||n({code:c,msg:u,data:d})}catch(n){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(n.message).msg),n}}async logout(e){this.roleData.agentInfo();try{const{agent_no:n}=K.agentInfo,{data:r,success:i}=e;await(o=>En(`${Or}/agent/logout`,o))({...r,agent_no:n}),i==null||i({code:0,msg:""})}catch(n){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(n.message).msg),n}}async listenCall(e){try{const{agent_no:n}=K.agentInfo,{data:r,success:i}=e;if(this.roleData.agentInfo(),this.roleData.requestInfo(e),!r.monitored_agent_no)throw new Error(JSON.stringify({code:1,msg:'Parameter "monitored_agent_no" is required'}));await(o=>En(`${Or}/call/monitor`,o))({...r,monitor_agent_no:n}),K.monitoredAgentNo=r.monitored_agent_no,i==null||i({code:0,msg:""})}catch(n){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(n.message).msg),n}}async earCall(e){try{const{agentInfo:n,monitoredAgentNo:r}=K,{agent_no:i}=n;this.roleData.agentInfo();const{success:o}=e;if(!r)throw new Error(JSON.stringify({code:1,msg:"当前未有监听坐席"}));await(a=>En(`${Or}/call/whisper`,a))({monitored_agent_no:r,monitor_agent_no:i}),o==null||o({code:0,msg:""})}catch(n){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(n.message).msg),n}}async stopEarCall(e){try{const{agentInfo:n,earSpeakAgent:r}=K;if(!r)throw new Error(JSON.stringify({code:1,msg:"当前没有正在耳语的坐席"}));const{agent_no:i}=n;this.roleData.agentInfo();const{success:o}=e;await(a=>En(`${Or}/call/stopwhisper`,a))({monitor_agent_no:i,monitored_agent_no:r}),o==null||o({code:0,msg:""})}catch(n){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(n.message).msg),n}}async forceInsert(e){try{const{agentInfo:n,monitoredAgentNo:r}=K,{agent_no:i}=n;this.roleData.agentInfo();const{success:o}=e;if(!r)throw new Error(JSON.stringify({code:1,msg:"当前未有监听坐席"}));await(a=>En(`${Or}/call/bargein`,a))({monitored_agent_no:r,monitor_agent_no:i}),o==null||o({code:0,msg:""})}catch(n){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(n.message).msg),n}}async forceDisconnect(e){try{const{agentInfo:n,monitoredAgentNo:r}=K,{agent_no:i}=n;this.roleData.agentInfo();const{success:o}=e;if(!r)throw new Error(JSON.stringify({code:1,msg:"当前未有监听坐席"}));await(a=>En(`${Or}/call/intercept`,a))({monitored_agent_no:r,monitor_agent_no:i}),o==null||o({code:0,msg:""})}catch(n){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(n.message).msg),n}}}const Gw=console.log,qg=(...t)=>{K.logBuiltinEnabled&&Gw(...t)};let ni=null;class An{constructor(e,n){this.url=e,this.onOpenCallback=n,this.ws=null,this.heartbeatWorker=null,this.reconnectDelay=3e3,this.manualClose=!1,this.apiClient=new ja,this.sipClient=null,this.pendingMessages=new Map,this.initWebSocket()}static getInstance({url:e,sipClient:n,onOpen:r}){if(!ni){if(!e)throw new Error("WebSocket 尚未初始化");ni=new An(e,r),ni.sipClient=n}return ni}setSipClient(e){this.sipClient=e}stateIdleChange(e){const{state:n}=K.stateObject;n!==Mt.IDLE&&this.apiClient._changeState({data:{...K.stateBeforeChange,state_name:K.stateBeforeChange.state===Mt.IDLE?"空闲":"忙碌"}},e)}inCallAutoAnswer(){const{soft_device_auto_answer:e,auto_answer_time:n}=K.agentInfo,r=e===1,i=G.get("direction");if(r&&i===yn.INCOMING){const o=Number(n)||0;o>0&&(K.autoAnswerTimer=setTimeout(()=>{var a;(a=this.sipClient)==null||a.answerCall(),K.autoAnswerTimer=null},o>0?1e3*o-500:0))}}async getCustomerInfo(e,n){try{await this.apiClient._getInCallCrmDetail({data:{phone:e},success:r=>{const{phone:i,trace_id:o,...a}=r.data,s={...a,type:n,session_id:K.sessionId,phone:r.data.phone,trace_id:r.data.trace_id};G.updateCustomerInfo(s)}})}catch{}}putAgentState(e,n){if(!e)return;if(n===5)return void this.stateIdleChange("device_type5");K.sessionId="";const{post_call_process_time:r}=K.agentInfo,i=r||0;if(K.autoStateTimer&&(clearTimeout(K.autoStateTimer),K.autoStateTimer=null),G.updateCustomerInfo(void 0),i>0){const{state:o}=K.stateObject;if(o===Mt.IDLE)return;this.apiClient._changeState({data:{state:Mt.BUSY,state_name:"整理"}},"ez"),K.autoStateTimer=setTimeout(()=>{K.autoStateTimer=null,this.stateIdleChange(`delay${i}`)},1e3*i)}else this.stateIdleChange("delay0")}stateBusyChange(){K.sessionId="",clearTimeout(K.autoStateTimer),G.updateCustomerInfo(void 0),this.apiClient._changeState({data:{state:Mt.BUSY,state_name:"忙碌"}},"dm")}initWebSocket(){var n;if(((n=this.ws)==null?void 0:n.readyState)===1||!G.get("isNextState")||this.manualClose)return;const e=P0(Kd,Vd);this.ws=new WebSocket(this.url+e),this.ws.onopen=()=>{const r=new Date().getTime();this.sendMessage({type:0,msg_id:r}),this.pendingMessages.set(r,performance.now()),this.startHeartbeat(),this.manualClose=!1,this.onOpenCallback&&this.onOpenCallback()},this.ws.onmessage=async r=>{var u;const i=JSON.parse(r.data),{type:o,data:a,code:s,msg:A,msg_id:c}=i;if(o===0&&c){const d=this.pendingMessages.get(c),f=performance.now()-d;K.latency=parseFloat(f.toFixed(2)),this.pendingMessages.delete(c)}if(o!==0&&qg("%cWebSocket 收到消息:","color: blue; font-weight: bold;",i),o!==it.OUT_CALL&&o!==it.PREVIEW_OUT_CALL||(K.isAgentHangup=!1,s!==0?(G.reset(),fe.emit(ie.OUT_FAILED,A),fe.emit(He.FAIL_NOTIFICATION,A),G.updateActionConfigs(Vn),setTimeout(()=>{G.updateCustomerInfo(void 0)},500),this.stateIdleChange("h")):s===0&&(G.updateDirection(yn.OUTGOING),fe.emit(ie.OUT_SUCCESS),K.sessionId=a.session_id,G.updateIsCalling(!0),clearTimeout(K.autoStateTimer))),o===it.AGENT_STATE){const{state:d,state_name:f}=a;K.stateObject={state:d,state_name:f},(u=K.stateBeforeChange)!=null&&u.state||K.stateObject.state!==Mt.IDLE&&(K.stateObject.state!==Mt.BUSY||f==="整理")||(K.stateBeforeChange=K.stateObject),f==="振铃中"&&G.updateDisplayText(Kt.AGENT_RINGING);const p=G.get("isCalling");d!==Mt.UNREGISTERED||p||G.updateActionConfigs(Fw),d===Mt.IDLE&&G.updateActionConfigs(Vn),fe.emit(ie.AGENT_STATE,{state:d,state_name:f})}else if(o===it.OUT_CALL_INCOMING_CALL)K.isAgentHangup=!1,a.preview_task_id?(this.getCustomerInfo(a.trace_id||a.customer_phone,"preview_out_incoming_call"),fe.emit(ie.PREVIEW_OUT_INCOMING_CALL,{customer_phone:a.customer_phone,session_id:a.session_id,preview_task_id:a.preview_task_id,trace_id:a.trace_id})):a.direction===0?(this.getCustomerInfo(a.trace_id||a.customer_phone,"out_call_incoming_call"),fe.emit(ie.OUT_INCOMING_CALL,{customer_phone:a.customer_phone,session_id:a.session_id,trace_id:a.trace_id})):a.direction===8&&(this.getCustomerInfo(a.trace_id||a.customer_phone,"internal_out_incoming_call"),fe.emit(ie.INTERNAL_OUT_INCOMING_CALL,{customer_phone:a.customer_phone,session_id:a.session_id,trace_id:a.trace_id})),K.sessionId=a.session_id,G.updateActionConfigs(kw,a.direction!==8);else if(o===it.OUT_CALL_END){if(K.sessionId!==a.session_id)return;if(G.updateDisplayText(""),a.device_type===1&&a.agent_no===K.agentInfo.agent_no)G.reset(),fe.emit(ie.OUT_HANGUP,{session_id:a.session_id,isAgentHangup:K.isAgentHangup}),G.updateActionConfigs(Vn),this.putAgentState(!0);else if(a.device_type===2&&a.agent_no===K.agentInfo.agent_no)G.reset(),fe.emit(ie.OUR_SIDE_CONSULT_HANGUP,{session_id:a.session_id}),G.updateActionConfigs(Vn),this.putAgentState(!0);else if(a.device_type===2&&a.agent_no!==K.agentInfo.agent_no)G.get("isCalling")&&(G.updateDisplayText(Kt.CALLING),fe.emit(ie.OTHER_SIDE_CONSULT_HANGUP,{session_id:a.session_id,isAgentHangup:K.isAgentHangup}),G.updateActionConfigs(Ci));else if(a.device_type===3&&a.agent_no===K.agentInfo.agent_no)G.reset(),fe.emit(ie.THREE_WAY_OUR_SIDE_HANGUP,{session_id:a.session_id}),G.updateActionConfigs(Vn),this.putAgentState(!0);else if(a.device_type===4&&a.agent_no===K.agentInfo.agent_no)G.reset(),fe.emit(ie.TRANSFER_END,{session_id:a.session_id}),G.updateActionConfigs(Vn),this.putAgentState(!0);else if(a.device_type===4&&a.agent_no!==K.agentInfo.agent_no){fe.emit(ie.TRANSFER_FAILED,"未知原因"),fe.emit(He.FAIL_NOTIFICATION,"转接失败");const d=G.get("direction");d===yn.OUTGOING?G.updateActionConfigs(Ci):d===yn.INCOMING&&G.updateActionConfigs(Gi)}else a.device_type===5&&a.agent_no===K.agentInfo.agent_no&&(K.monitoredAgentNo="",K.earSpeakAgent="",G.reset(),fe.emit(ie.LISTEN_HANGUP,{session_id:a.session_id}),G.updateActionConfigs(Vn),this.putAgentState(!0,5))}else if(o===it.OUT_CALL_RINGING)a.type===1&&(K.isAgentHangup=!1,fe.emit(ie.OUT_RINGING,{session_id:K.sessionId,type:a.type}),G.updateDisplayText(Kt.RINGING));else if(o===it.OUT_CALL_ANSWER)K.isAgentHangup=!1,clearTimeout(K.autoStateTimer),G.updateIsCalling(!0),G.updateOutCallIsAnswer(!0),G.updateDisplayText(Kt.CALLING),a.direction===8?(fe.emit(ie.INTERNAL_OUT_OFF_ANSWER,{session_id:K.sessionId}),G.updateActionConfigs(Yc)):(fe.emit(ie.OUT_OFF_ANSWER,{session_id:K.sessionId}),G.updateActionConfigs(Ci));else if(o===it.CONSULT_RINGING)K.isAgentHangup=!1,fe.emit(ie.CONSULT_RINGING,{session_id:a.session_id}),G.updateDisplayText(Kt.AGENT_RINGING),G.updateActionConfigs([]),clearTimeout(K.autoStateTimer);else if(o===it.CONSULT_ANSWER)K.isAgentHangup=!1,fe.emit(ie.CONSULT_OFF_HOOK,{session_id:a.session_id}),G.updateConsultIsAnswer(!0),G.updateDisplayText(Kt.CONSULTING),G.updateActionConfigs(Hg);else if(o===it.CONSULT_FAIL)fe.emit(ie.CONSULT_FAILED,{custom_reason:a.custom_reason}),G.updateDisplayText(Kt.CALLING),G.updateActionConfigs(Ci);else if(o===it.CONSULT_CALL_IN)K.isAgentHangup=!1,fe.emit(ie.CONSULT_INCOMING,{agent_no:a.agent_no,agent_mane:a.agent_name,session_id:a.session_id}),K.sessionId=a.session_id,G.updateIsCalling(!0),G.updateDirection(yn.CONSULT),G.updateDisplayText(Kt.CONSULT_CALL_IN),G.updateActionConfigs(Os),K.enableBrowserAlert&&To.show("📞 咨询来电",`坐席 [${a.agent_name}] 正在咨询...`,()=>{fe.emit(He.NOTIFICATION_CLICK,{agent_mane:a.agent_name,agent_no:a.agent_no})},K.browserAlertTime);else if(o===it.CONSULT_CALL_IN_SUCCESS)fe.emit(ie.CONSULT_CALL_IN_SUCCESS,{session_id:a.session_id}),G.updateConsultIsAnswer(!0),G.updateDisplayText(Kt.CALLING),G.updateActionConfigs(Pw);else if(o===it.CONSULT_RETURN_CALL_SUCCESS)a.status==="success"?(G.updateConsultIsAnswer(!1),fe.emit(ie.CONSULT_RETURN_CALL_SUCCESS),G.updateDisplayText(Kt.CALLING),fe.emit(ie.OTHER_SIDE_CONSULT_HANGUP),G.updateActionConfigs(Ci)):fe.emit(He.FAIL_NOTIFICATION,"媒体失败");else if(o===it.MUTE)s===0?(G.updateIsMuted(!0),fe.emit(ie.MUTE_SUCCESS),G.updateDisplayText(Kt.MUTING)):(fe.emit(ie.MUTE_FAILED,A),fe.emit(He.FAIL_NOTIFICATION,A));else if(o===it.UNMUTE)s===0?(G.updateIsMuted(!1),fe.emit(ie.UNMUTE_SUCCESS),G.updateDisplayText(Kt.CALLING)):(fe.emit(ie.UNMUTE_FAILED,A),fe.emit(He.FAIL_NOTIFICATION,A));else if(o===it.CALL_HOLD)s===0?(G.updateIsHold(!0),G.updateDisplayText(Kt.HOLDING),fe.emit(ie.HOLD_SUCCESS)):(fe.emit(ie.HOLD_FAILED,A),fe.emit(He.FAIL_NOTIFICATION,A));else if(o===it.CALL_UNHOLD)s===0?(G.updateDisplayText(Kt.CALLING),G.updateIsHold(!1),fe.emit(ie.UNHOLD_SUCCESS)):(fe.emit(ie.UNHOLD_FAILED,A),fe.emit(He.FAIL_NOTIFICATION,A));else if(o===it.CONSULT_TRANSFER)K.isAgentHangup=!1,s===0?fe.emit(ie.CONSULT_TRANSFER_SUCCESS):(fe.emit(ie.CONSULT_TRANSFER_FAILED,A),fe.emit(He.FAIL_NOTIFICATION,A));else if(o===it.CONSULT_TRANSFER_FAILED)fe.emit(ie.CONSULT_TRANSFER_FAILED,a.status);else if(o===it.CONSULT_TRANSFER_OFF_HOOK)G.updateDirection(yn.INCOMING),G.updateDisplayText(Kt.CALLING),fe.emit(ie.CONSULT_TRANSFER_OFF_HOOK),G.updateActionConfigs(Gi),G.updateIncomingIsAnswer(!0),G.updateConsultIsAnswer(!1);else if(o===it.INCOMING_CALL)K.isAgentHangup=!1,clearTimeout(K.autoStateTimer),K.sessionId=a.session_id,G.updateIsCalling(!0),G.updateDirection(yn.INCOMING),G.updateDisplayText(Kt.INCOMING_CALL),this.inCallAutoAnswer(),a.direction!==1&&a.direction!==4&&a.direction!==7||(this.getCustomerInfo(a.trace_id||a.customer_phone,"incoming_call"),fe.emit(ie.INCOMING_CALL,{customer_phone:a.customer_phone,trace_id:a.trace_id,session_id:a.session_id})),a.direction===8&&(this.getCustomerInfo(a.trace_id||a.customer_phone,"incoming_call_in"),fe.emit(ie.INCOMING_CALL_IN,{customer_phone:a.customer_phone,trace_id:a.trace_id,session_id:a.session_id})),a.direction===3&&(this.getCustomerInfo(a.trace_id||a.customer_phone,"predict_incoming_call"),fe.emit(ie.PREDICT_INCOMING_CALL,{customer_phone:a.customer_phone,trace_id:a.trace_id,session_id:a.session_id})),a.direction===6&&(this.getCustomerInfo(a.trace_id||a.customer_phone,"dual_call_incoming_call"),fe.emit(ie.DUAL_CALL_INCOMING_CALL,{customer_phone:a.customer_phone,trace_id:a.trace_id,session_id:a.session_id})),G.updateActionConfigs(Os),K.enableBrowserAlert&&To.show("📞 客户来电",`客户 [${a.customer_phone}] 正在呼入...`,()=>{fe.emit(He.NOTIFICATION_CLICK,{customer_phone:a.customer_phone})},K.browserAlertTime);else if(o===it.INCOMING_CALL_OFF_HOOK)G.updateIncomingIsAnswer(!0),a.direction===8?(G.updateActionConfigs(Yc),fe.emit(ie.INCOMING_CALL_IN_OFF_HOOK,{session_id:K.sessionId})):(G.updateActionConfigs(Gi),fe.emit(ie.INCOMING_CALL_OFF_HOOK,{session_id:K.sessionId})),G.updateDisplayText(Kt.CALLING);else if(o===it.INCOMING_CALL_END){if(K.sessionId!==a.session_id)return;if(G.updateDisplayText(""),a.device_type!==1&&a.device_type!==7||a.agent_no!==K.agentInfo.agent_no)if(a.device_type===2&&a.agent_no===K.agentInfo.agent_no)G.reset(),fe.emit(ie.OUR_SIDE_CONSULT_HANGUP,{session_id:a.session_id}),this.putAgentState(!0),G.updateActionConfigs(Vn);else if(a.device_type===2&&a.agent_no!==K.agentInfo.agent_no)G.updateDisplayText(Kt.CALLING),fe.emit(ie.OTHER_SIDE_CONSULT_HANGUP,{session_id:a.session_id,isAgentHangup:K.isAgentHangup}),G.updateActionConfigs(Ci);else if(a.device_type===3&&a.agent_no===K.agentInfo.agent_no)this.putAgentState(!0),G.reset(),fe.emit(ie.THREE_WAY_OUR_SIDE_HANGUP,{session_id:a.session_id}),G.updateActionConfigs(Vn);else if(a.device_type===4&&a.agent_no===K.agentInfo.agent_no)this.putAgentState(!0),G.reset(),fe.emit(ie.TRANSFER_END,{session_id:a.session_id}),G.updateActionConfigs(Vn);else if(a.device_type===4&&a.agent_no!==K.agentInfo.agent_no){fe.emit(ie.TRANSFER_FAILED,"未知原因"),fe.emit(He.FAIL_NOTIFICATION,"转接失败");const d=G.get("direction");d===yn.OUTGOING?G.updateActionConfigs(Ci):d===yn.INCOMING&&G.updateActionConfigs(Gi)}else a.device_type===5&&a.agent_no===K.agentInfo.agent_no&&(this.putAgentState(!0,5),K.monitoredAgentNo="",K.earSpeakAgent="",G.reset(),fe.emit(ie.LISTEN_HANGUP,{session_id:a.session_id}),G.updateActionConfigs(Vn));else this.putAgentState(!0),G.reset(),fe.emit(ie.INCOMING_CALL_END,{session_id:a.session_id,isAgentHangup:K.isAgentHangup}),G.updateActionConfigs(Vn)}else if(o===it.SATISFACTION_EVALUATION)s===0?fe.emit(ie.SATISFACTION_EVALUATION_SUCCESS):(fe.emit(ie.SATISFACTION_EVALUATION_FAILED,A),fe.emit(He.FAIL_NOTIFICATION,A));else if(o===it.CONSULT_THREE_WAY)s!==0?(fe.emit(ie.CONSULT_THREE_WAY_FAILED,A),fe.emit(He.FAIL_NOTIFICATION,A)):s===0&&G.updateIsMeeting(!0);else if(o===it.CONSULT_THREE_WAY_RESULT)a.status==="success"?(G.updateDirection(yn.MEETING),G.updateDisplayText(Kt.MEETING),G.updateActionConfigs(Qw),fe.emit(ie.CONSULT_THREE_WAY_SUCCESS)):(fe.emit(ie.CONSULT_THREE_WAY_FAILED,{conf_name:a.conf_name}),G.updateIsMeeting(!1));else if(o===it.TRANSFER_INCOMING_CALL)K.isAgentHangup=!1,clearTimeout(K.autoStateTimer),a.agent_no===K.agentInfo.agent_no?(G.updateDisplayText(Kt.TRANSFERRING),fe.emit(ie.TRANSFER_PROGRESS),G.updateActionConfigs([]),G.updateTransferIsAnswer(!0)):(K.sessionId=a.session_id,fe.emit(ie.TRANSFER_INCOMING_CALL,{agent_no:a.agent_no,agent_name:a.agent_name,session_id:a.session_id}),G.updateIsCalling(!0),G.updateDirection(yn.TRANSFER),G.updateDisplayText(Kt.TRANSFER_INCOMING_CALL),G.updateActionConfigs(Os),K.enableBrowserAlert&&To.show("📞 转接来电",`坐席 [${a.agent_no}] 正在转接...`,()=>{fe.emit(He.NOTIFICATION_CLICK,{agent_no:a.agent_no})},K.browserAlertTime));else if(o===it.TRANSFER_OFF_HOOK)fe.emit(ie.TRANSFER_OFF_HOOK,{session_id:K.sessionId}),G.updateTransferIsAnswer(!1),G.updateDisplayText(Kt.CALLING),G.updateActionConfigs(Gi,a.direction!==8);else if(o===it.TRANSFER_FAILED){if(a.status==="failed"){fe.emit(ie.TRANSFER_FAILED,"未知原因"),fe.emit(He.FAIL_NOTIFICATION,"转接失败");const d=G.get("direction");d===yn.OUTGOING?G.updateActionConfigs(Ci):d===yn.INCOMING&&G.updateActionConfigs(Gi)}}else o===it.KICK_OFFLINE?fe.emit(He.KICK_OFF):o===it.CONTINUOUS_NOT_ANSWER?(fe.emit(He.FAIL_NOTIFICATION,`已连续 ${a.miss_count} 次未接, 设置忙碌`),this.stateBusyChange()):o===it.SIGN_OUT?fe.emit(He.SIGN_OUT):o===it.SIGN_IN_SWITCH_DEVICE?fe.emit(He.SIGN_IN_SWITCH_DEVICE,a):o===it.LISTEN_INCOMING_CALL?(clearTimeout(K.autoStateTimer),K.sessionId=a.session_id,G.updateIsCalling(!0),G.updateDirection(yn.INCOMING),this.inCallAutoAnswer(),G.updateDisplayText(Kt.LISTENING),G.updateActionConfigs(Os),fe.emit(ie.LISTEN_INCOMING_CALL,{session_id:a.session_id}),K.enableBrowserAlert&&To.show("📞 监听来电","正在来电...",()=>{fe.emit(He.NOTIFICATION_CLICK,{customer_phone:a.customer_phone})},K.browserAlertTime)):o===it.LISTEN_INCOMING_CALL_OFF_HOOK?(K.monitoredAgentNo=a.monitored_agent_no,K.earSpeakAgent="",G.updateIncomingIsAnswer(!0),fe.emit(ie.LISTEN_INCOMING_CALL_OFF_HOOK,{session_id:K.sessionId,monitored_agent_no:a.monitored_agent_no}),G.updateActionConfigs(Gg),G.updateDisplayText(Kt.CALLING)):o===it.LISTEN_CALL_FAILED?a.status==="failed"&&(fe.emit(ie.LISTEN_CALL_FAILED),K.monitoredAgentNo=""):o===it.EAR_SPEECH?a.status==="success"?(a.monitored_agent_no===K.agentInfo.agent_no&&(G.updateActionConfigs(jw),fe.emit(ie.EAR_SPEECH_BE_SUCCESS)),a.monitor_agent_no===K.agentInfo.agent_no&&(G.updateActionConfigs(Lw),fe.emit(ie.EAR_SPEECH_SUCCESS,{monitored_agent_no:a.monitored_agent_no,monitor_agent_no:a.monitor_agent_no}),K.earSpeakAgent=a.monitored_agent_no)):fe.emit(ie.EAR_SPEECH_FAILED):o===it.STOP_EAR_SPEECH?a.status==="success"?(a.monitored_agent_no===K.agentInfo.agent_no&&G.updateActionConfigs(Gi),a.monitor_agent_no===K.agentInfo.agent_no&&G.updateActionConfigs(Gg),K.earSpeakAgent="",fe.emit(ie.STOP_EAR_SPEECH_SUCCESS)):fe.emit(ie.STOP_EAR_SPEECH_FAILED):o===it.CALL_FORCE_INSERT?a.status==="success"?(a.monitored_agent_no===K.agentInfo.agent_no&&(G.updateActionConfigs(Hw),fe.emit(ie.CALL_FORCE_INSERT_SUCCESS,{monitored_agent_no:a.monitored_agent_no,monitor_agent_no:a.monitor_agent_no})),a.monitor_agent_no===K.agentInfo.agent_no&&(G.updateActionConfigs(Uw),fe.emit(ie.CALL_FORCE_INSERT_SUCCESS_LISTENER,{monitored_agent_no:a.monitored_agent_no,monitor_agent_no:a.monitor_agent_no}))):fe.emit(ie.CALL_FORCE_INSERT_FAILED):o===it.INTERNAL_CALL_START_CONSULT?a.agent_no===K.agentInfo.agent_no?(G.updateConsultIsAnswer(!0),G.updateActionConfigs(Hg),G.updateDisplayText(Kt.CONSULTING)):(G.updateDisplayText(Kt.OTHER_SIDE_CONSULTING),G.updateActionConfigs([])):o===it.INTERNAL_CALL_END_CONSULT?(G.updateActionConfigs(Yc),G.updateDisplayText(""),G.updateConsultIsAnswer(!1)):o===it.CALL_SIP_INCOMING_CALL&&fe.emit(ie.CALL_SIP_INCOMING_CALL)},this.ws.onclose=r=>{fe.emit(He.FAIL_NOTIFICATION,"链接已断开,请检查网络"),this.stopHeartbeat();const i=G.get("isNextState");!this.manualClose&&i&&setTimeout(()=>this.initWebSocket(),this.reconnectDelay)},this.ws.onerror=r=>{var i;fe.emit(He.FAIL_NOTIFICATION,"连接失败,请检查网络"),(i=this.ws)==null||i.close()}}startHeartbeat(){const e=new Blob([`
164
164
  let timer;
165
165
  self.onmessage = function (e) {
166
166
  if (e.data === 'start') {
@@ -171,7 +171,7 @@ React keys must be passed directly to JSX without using spread:
171
171
  clearInterval(timer);
172
172
  }
173
173
  };
174
- `],{type:"application/javascript"}),n=URL.createObjectURL(e);this.heartbeatWorker=new Worker(n),this.heartbeatWorker.onmessage=()=>{const r=new Date().getTime();this.sendMessage({type:0,msg_id:r}),this.pendingMessages.set(r,performance.now())},this.heartbeatWorker.postMessage("start")}stopHeartbeat(){this.heartbeatWorker&&(this.heartbeatWorker.postMessage("stop"),this.heartbeatWorker.terminate(),this.heartbeatWorker=null)}sendMessage(e){var n;((n=this.ws)==null?void 0:n.readyState)===WebSocket.OPEN?(this.ws.send(JSON.stringify(e)),e.type!==0&&qg("%cWebSocket 发送消息:","color: green; font-weight: bold;",e)):console.warn("WebSocket 未连接,消息未发送")}close(){var e;this.manualClose=!0,this.stopHeartbeat(),(e=this.ws)==null||e.close()}reconnect(){this.initWebSocket()}static __internalClose(){ni&&(ni.close(),ni=null)}static __internalSend(e){if(!ni)throw new Error("WebSocket 尚未初始化");ni.sendMessage(e)}}class qw{constructor(e){this.sipClient=null,this.sipClient=e}roleMute(){const e=G.get("isCalling"),n=K.sessionId;if(!e)throw new Error(JSON.stringify({code:1,msg:"当前没有通话"}));if(!n)throw new Error(JSON.stringify({code:1,msg:"当前没有通话"}))}holdCall(){this.roleMute();const e=G.get("isHold"),{sessionId:n}=K;if(n){if(!G.get("actionConfigs").includes("hold"))throw new Error(JSON.stringify({code:1,msg:"当前状态请勿保持"}));if(e)throw new Error(JSON.stringify({code:1,msg:"当前已处于保持状态"}));An.__internalSend({type:it.CALL_HOLD,data:{session_id:n}})}}unholdCall(){this.roleMute();const{isHold:e}=G.getState(),{sessionId:n}=K;if(!G.get("actionConfigs").includes("unhold"))throw new Error(JSON.stringify({code:1,msg:"当前状态请勿取消保持"}));if(n){if(!e)throw new Error(JSON.stringify({code:1,msg:"当前未处于保持状态"}));An.__internalSend({type:it.CALL_UNHOLD,data:{session_id:n}})}}sendDTMF(e){if(G.get("answerDevice")!==1)throw new Error(JSON.stringify({code:1,msg:"当前设备不支持此功能"}));if(!G.get("actionConfigs").includes("dtmf"))throw new Error(JSON.stringify({code:1,msg:"当前状态请勿发送按键"}));const{isCalling:n}=G.getState();if(!n)throw new Error(JSON.stringify({code:1,msg:"当前没有通话"}));this.sipClient.sendDTMF(e)}cancelCall(){if(!G.get("isCalling"))throw nn.error("当前没有通话","call-api.ts 81 cancelCall"),new Error(JSON.stringify({code:1,msg:"当前没有通话"}));const e=K.sessionId;fe.emit(ie.REJECT,{session_id:e}),An.__internalSend({type:it.AGENT_HANGUP,data:{session_id:e}})}async consultCall(e){this.roleMute();const{isCalling:n,outCallIsAnswer:r,consultIsAnswer:i,incomingIsAnswer:o}=G.getState(),a=K.sessionId;if(!G.get("actionConfigs").includes("consult"))throw new Error(JSON.stringify({code:1,msg:"当前状态请勿调用咨询"}));if(i)throw new Error(JSON.stringify({code:1,msg:"当前正在咨询"}));if(!(n||r||o))throw new Error(JSON.stringify({code:1,msg:"当前没有通话"}));if(!a)throw new Error(JSON.stringify({code:1,msg:"sessionId不存在"}));An.__internalSend({type:it.CONSULT_REQUEST,data:{session_id:a,consultation_agent_no:e}})}async answerCall(){const e=G.get("answerDevice");if(e!==1)throw nn.error(`当前设备不支持此功能;answerDevice: ${e}`,"call-api.ts 119 answerCall"),new Error(JSON.stringify({code:1,msg:"当前设备不支持此功能"}));await this.sipClient.answerCall()}makeCall(e){if(typeof e!="string"||e.trim()==="")throw nn.warn(`外呼号码非法;号码: ${e}`,"call-api.ts 126 makeCall"),new Error(JSON.stringify({code:1,msg:"外呼号码非法"}));const n={};iu(e)?n.trace_id=e:n.customer_phone=e.replace(/[\s\r\n-]+/g,"");const r=G.get("isCalling"),i=G.get("selectOutNumber")||"";if(r)throw nn.error(`正在呼叫中,请勿重复点击;session id: ${K.sessionId}`,"call-api.ts 142 makeCall"),new Error(JSON.stringify({code:1,msg:"正在呼叫中,请勿重复点击"}));G.updateDirection(xn.OUTGOING),An.__internalSend({type:it.OUT_CALL,data:{...n,caller:i.replace(/[\s\r\n-]+/g,"")}})}previewCall(e,n){const r={};iu(e)?r.trace_id=e:r.customer_phone=e.replace(/[\s\r\n-]+/g,"");const i=G.get("isCalling"),o=G.get("selectOutNumber")||"";if(i)throw nn.error(`正在呼叫中,请勿重复点击;session id: ${K.sessionId}`,"call-api.ts 162 previewCall"),new Error(JSON.stringify({code:1,msg:"正在呼叫中,请勿重复点击"}));if(typeof e!="string"||e.trim()==="")throw new Error(JSON.stringify({code:1,msg:"外呼号码非法"}));G.updateDirection(xn.OUTGOING),An.__internalSend({type:it.PREVIEW_OUT_CALL,data:{...r,caller:o,preview_task_id:n}})}async hangup(){if(!G.get("isCalling"))throw nn.error("当前没有通话","call-api.ts 178 hangup"),new Error(JSON.stringify({code:1,msg:"当前没有通话"}));K.isAgentHangup=!0;const e=K.sessionId;An.__internalSend({type:it.AGENT_HANGUP,data:{session_id:e}}),await this.sipClient.hangup()}mute(){this.roleMute();const e=G.get("actionConfigs"),n=G.get("isMuted"),r=K.sessionId;if(n)throw new Error(JSON.stringify({code:1,msg:"当前未处于静音状态"}));if(!e.includes("mute"))throw new Error(JSON.stringify({code:1,msg:"当前状态请勿调用静音"}));An.__internalSend({type:it.MUTE,data:{session_id:r}})}unmute(){this.roleMute();const e=G.get("actionConfigs"),n=G.get("isMuted"),r=K.sessionId;if(!n)throw new Error(JSON.stringify({code:1,msg:"当前未处于未静音状态"}));if(!e.includes("unmute"))throw new Error(JSON.stringify({code:1,msg:"当前状态请勿调用静音"}));An.__internalSend({type:it.UNMUTE,data:{session_id:r}})}consultTransfer(){this.roleMute();const e=G.get("consultIsAnswer"),n=K.sessionId,r=G.get("actionConfigs");if(!r.includes("consult_transfer"))throw nn.error(`当前状态请勿调用咨询转移; actionConfigs:${r.join(",")}; consultIsAnswer: ${e}; session id: ${n}`,"call-api.ts 228 consultTransfer"),new Error(JSON.stringify({code:1,msg:"当前状态请勿调用咨询转移"}));if(!e)throw new Error(JSON.stringify({code:1,msg:"当前未处于咨询中"}));An.__internalSend({type:it.CONSULT_TRANSFER,data:{session_id:n}})}satisfactionEvaluation(){this.roleMute();const e=K.sessionId,n=G.get("actionConfigs");if(!n.includes("satisfaction"))throw nn.error(`当前状态请勿调用满意度评价; actionConfigs:${n.join(",")}; session id: ${e}`,"call-api.ts 243 satisfactionEvaluation"),new Error(JSON.stringify({code:1,msg:"当前状态请勿调用满意度评价"}));An.__internalSend({type:it.SATISFACTION_EVALUATION,data:{session_id:e}})}startConference(){this.roleMute();const e=K.sessionId,n=G.get("actionConfigs");if(!n.includes("conference"))throw nn.error(`当前状态请勿调用三方会议; actionConfigs:${n.join(",")}; session id: ${e}`,"call-api.ts 264 startConference"),new Error(JSON.stringify({code:1,msg:"当前状态请勿调用三方会议"}));if(!G.get("consultIsAnswer"))throw new Error(JSON.stringify({code:1,msg:"当前未处于咨询中"}));An.__internalSend({type:it.CONSULT_THREE_WAY,data:{session_id:e}})}consultRetrieve(){this.roleMute();const e=G.get("actionConfigs"),n=K.sessionId;if(!e.includes("consult_retrieve"))throw nn.error(`当前状态请勿取回通话; actionConfigs:${e.join(",")}; session id: ${n}`,"call-api.ts 285 consultRetrieve"),new Error(JSON.stringify({code:1,msg:"当前状态请勿取回通话"}));if(!G.get("consultIsAnswer"))throw new Error(JSON.stringify({code:1,msg:"当前未处于咨询中"}));An.__internalSend({type:it.CONSULT_RETURN_CALL,data:{session_id:n}})}async transferAgent(e){this.roleMute();const n=G.get("actionConfigs"),r=K.sessionId;if(!n.includes("transfer"))throw nn.error(`当前状态请勿转接; actionConfigs:${n.join(",")}; session id: ${r}`,"call-api.ts 306 transferAgent"),new Error(JSON.stringify({code:1,msg:"当前状态请勿转接"}));const{transferIsAnswer:i}=G.getState();if(i)throw new Error(JSON.stringify({code:1,msg:"当前正在转接"}));An.__internalSend({type:it.TRANSFER,data:{session_id:r,transfer_type:0,transfer_dest:e}})}async transferOutline(e){this.roleMute();const n=K.sessionId,r=G.get("actionConfigs");if(!r.includes("transfer"))throw nn.error(`当前状态请勿转接; actionConfigs:${r.join(",")}; session id: ${n}`,"call-api.ts 330 transferOutline"),new Error(JSON.stringify({code:1,msg:"当前状态请勿转接"}));if(!e)throw new Error(JSON.stringify({code:1,msg:"号码不能为空"}));if(!/^\d+$/.test(e))throw nn.error(`当前状态请勿转接; 转接号码:${e}; session id: ${n}`,"call-api.ts 339 transferOutline"),new Error(JSON.stringify({code:1,msg:"号码格式错误"}));const{transferIsAnswer:i}=G.getState();if(i)throw new Error(JSON.stringify({code:1,msg:"当前正在转接"}));An.__internalSend({type:it.TRANSFER,data:{session_id:n,transfer_type:2,transfer_dest:e}})}}var sr,Bn,fn,un,$i,Xi,xi,eo,Ka,Va,to,za,Ya,Qi,j0,L0,Wa,U0;const kA=class kA{constructor(){Kn(this,Qi);Kn(this,Bn);Kn(this,fn);Kn(this,un);Kn(this,$i);Kn(this,Xi);Kn(this,xi);Kn(this,eo);Kn(this,Ka);Kn(this,Va);Kn(this,to);Kn(this,za);Kn(this,Ya);Kn(this,Wa);if(sn(this,Bn,null),sn(this,fn,new ja),sn(this,$i,null),sn(this,Xi,{sounds_url:"",recordings_url:""}),sn(this,xi,{soft_device_ring_switch:0,soft_device_ring_audio_id:"",agent_hangup_ring_switch:0,agent_hangup_ring_audio_id:""}),sn(this,eo,[]),sn(this,to,!1),sn(this,za,()=>{}),sn(this,Ya,()=>{}),this.initWebRtc=async()=>{if(nt(this,Bn))return;const e=K.agentInfo.sip_account_list.find(n=>n.device_type===1);if(!e)throw new Error(JSON.stringify({code:1,msg:"未找到 sip_account_list"}));{const n=e.sip_register_addr;sn(this,Bn,new Bw({server:n.split(":")[0],user:e.sip_account,password:e.sip_password,webSocket:`wss://${n}`,callTimeout:3e4},nt(this,Wa))),await nt(this,Bn).start()}},sn(this,Wa,e=>{const{type:n,data:r}=e;fe.emit(n,r)}),!sr._creatingInstance)throw new Error("请使用 YSYTAgentSdk.getInstance() 获取实例");clearInterval(nt(this,$i)),sn(this,$i,setInterval(async()=>{const e=await ps(this,Qi,U0).call(this);T0.updateRttObject(e)},2e3)),To.requestMediaPermissions(),sn(this,Va,G.subscribeKey("isNextState",async e=>{if(nn.warn(`网络连接状态改变, ${e}`,"index.ts"),e){G.get("answerDevice")===1&&await nt(this,Bn).reconnect();let n="";const r=new URL(Si).host;n=Si.includes("https")?`wss://${r}`:`ws://${r}`;const{agent_no:i}=K.agentInfo;An.getInstance({url:`${n}/ccs-ws/api/v1/ws/call/${i}?Authorization=`,sipClient:nt(this,Bn)}),setTimeout(()=>{nt(this,fn)._changeState({data:{state:Mt.BUSY,state_name:"忙碌"},success:()=>{G.updateDisplayText(""),fe.emit(ie.AGENT_STATE,{state:Mt.BUSY,state_name:"忙碌"})}},"d")},10)}else An.__internalClose(),G.updateIsCalling(!1),G.updateOutCallIsAnswer(!1),G.updateIncomingIsAnswer(!1),G.updateIsMuted(!1),G.updateConsultIsAnswer(!1),G.updateIsHold(!1),G.updateCustomerInfo(void 0),G.updateDisplayText("离线")})),sn(this,Ka,G.subscribeKey("answerDevice",async e=>{e===1?K.stateObject.state===Mt.UNREGISTERED&&await nt(this,fn)._changeState({data:{...K.stateBeforeChange,state_name:K.stateBeforeChange.state===Mt.IDLE?"空闲":"忙碌"}},"qq"):await this.destroyRtc()})),this.on(He.KICK_OFF,()=>{this.destroy()}),window.addEventListener("beforeunload",e=>{e.returnValue="",nn.info("beforeunload","index.ts"),this.destroy()}),window.addEventListener("online",nt(this,za)),window.addEventListener("offline",nt(this,Ya))}static get instance(){return this._instance}static async destroyInstance(){this._instance&&(await this._instance.destroy(),this._instance=null)}static getInstance(e){if(!this._instance){if(!e)throw new Error("首次调用必须传入配置参数");const{url:r,appKey:i,appSecret:o,agentNo:a}=e;Si=r||"https://aicc-api.yescloudy.com",Kd=i,Vd=o,n=a.replace(/\s/g,""),zc=n,sr._creatingInstance=!0,this._instance=new sr,delete sr._creatingInstance}var n;return this._instance}getInit(){return nt(this,to)}async init({enableBrowserAlert:e,logBuiltinEnabled:n,browserAlertTime:r,onCallBack:i}){try{let o="";const a=new URL(Si).host;o=Si.includes("https")?`wss://${a}`:`ws://${a}`;const s=An.getInstance({url:`${o}/ccs-ws/api/v1/ws/call/${zc}?Authorization=`,sipClient:null,onOpen:async()=>{const A=await yn(`${Yi}/config/swiftms`,{});sn(this,Xi,A.data);const c=await yn(`${Yi}/ring/query`,{});sn(this,xi,c.data);const u=await yn(`${Yi}/audio/list`,{});sn(this,eo,u.data),K.logBuiltinEnabled=n||!1,K.browserAlertTime=r||5e3,await nt(this,fn)._agentLogin(zc),nn.info("初始化成功","index.ts");const{current_answer_device:d,current_state:f,out_display_number:p,out_display_select_switch:v}=K.agentInfo;f===Mt.IDLE?(G.updateActionConfigs(Vn),K.stateObject={state:f,state_name:"空闲"},K.stateBeforeChange=K.stateObject):f===Mt.BUSY?(G.updateActionConfigs(gA),K.stateObject={state:f,state_name:"忙碌"},K.stateBeforeChange=K.stateObject):f===Mt.UNREGISTERED&&(G.updateActionConfigs(gA),K.stateObject={state:f,state_name:"未注册"}),v===1?G.updateSelectOutNumber(p):G.updateSelectOutNumber(""),G.updateAnswerDevice(d),ja.setInitRtcFn(this.initWebRtc),d===1&&(await this.initWebRtc(),s.setSipClient(nt(this,Bn))),sn(this,un,new qw(nt(this,Bn))),K.enableBrowserAlert=e,e&&To.requestPermission(),fe.emit(He.AGENT_INIT_STATUS,!0),sn(this,to,!0),clearInterval(sr._timer),sr._timer=null,ps(this,Qi,L0).call(this),i==null||i()}})}catch{fe.emit(He.AGENT_INIT_STATUS,!1),sn(this,to,!1)}}on(e,n){return fe.on(e,n),this}off(e,n){fe.off(e,n)}offAll(){fe.clearAllListeners()}async destroyRtc(){var e;await((e=nt(this,Bn))==null?void 0:e.destroy()),sn(this,Bn,null)}async destroy(){var e,n;sr._instance&&(await this.destroyRtc(),(e=nt(this,Ka))==null||e.call(this),(n=nt(this,Va))==null||n.call(this),clearInterval(nt(this,$i)),An.__internalClose(),fe.emit(He.DESTROY),this.offAll(),sr._instance=null,G.reset(),G.updateSelectOutNumber(""),clearInterval(sr._timer),clearTimeout(K.autoStateTimer),K.autoStateTimer=null,sr._timer=null)}get call_api(){const e=n=>(...r)=>n.apply(this,r);return{answerCall:e(()=>nt(this,un).answerCall()),makeCall:n=>nt(this,un).makeCall(n),previewMakeCall:(n,r)=>nt(this,un).previewCall(n,r),cancelCall:e(()=>nt(this,un).cancelCall()),hangup:e(()=>nt(this,un).hangup()),sendDTMF:e(n=>nt(this,un).sendDTMF(n)),holdCall:e(()=>nt(this,un).holdCall()),unholdCall:e(()=>nt(this,un).unholdCall()),consultCall:e(async n=>{try{await nt(this,un).consultCall(n)}catch(r){throw console.warn(r),r}}),consultRetrieve:e(()=>nt(this,un).consultRetrieve()),consultTransfer:e(()=>nt(this,un).consultTransfer()),mute:e(()=>nt(this,un).mute()),unmute:e(()=>nt(this,un).unmute()),satisfactionEvaluation:e(()=>nt(this,un).satisfactionEvaluation()),startConference:e(()=>nt(this,un).startConference()),transferAgent:e(n=>nt(this,un).transferAgent(n)),transferOutline:e(n=>nt(this,un).transferOutline(n)),earSpeakStart:e(n=>nt(this,fn).earCall(n)),earSpeakStop:e(n=>nt(this,fn).stopEarCall(n)),forceInsert:e(n=>nt(this,fn).forceInsert(n)),forceDisconnect:e(n=>nt(this,fn).forceDisconnect(n))}}get agent_api(){const e=n=>(...r)=>n.apply(this,r);return{changeDevice:e(n=>nt(this,fn).changeDevice(n)),changeState:e(async n=>{const r=G.get("answerDevice");if(K.stateObject.state===Mt.UNREGISTERED&&r===1){await nt(this,Bn).reconnect();let i="";const o=new URL(Si).host;i=Si.includes("https")?`wss://${o}`:`ws://${o}`;const{agent_no:a}=K.agentInfo;An.getInstance({url:`${i}/ccs-ws/api/v1/ws/call/${a}?Authorization=`,sipClient:nt(this,Bn)})}await nt(this,fn).changeState(n,"c")}),getIdleAgentList:e(n=>nt(this,fn).getIdleAgentList(n)),getAgentState:e(n=>nt(this,fn).getAgentState(n)),setAgentExplicit:e(n=>nt(this,fn).setAgentExplicit(n)),checkAgentLogin:n=>nt(this,fn).checkAgentLogin(n),getCallRecord:n=>nt(this,fn).getCallRecord(n),agentLogout:async(n,r)=>{try{await nt(this,fn).logout(n),await this.destroy(),r==null||r({code:0,msg:""})}catch{}},listenAgentCall:n=>nt(this,fn).listenCall(n)}}getAgentData(){const{agent_no:e,agent_name:n,answer_devices:r,out_display_data:i,out_display_select_switch:o,current_state:a}=K.agentInfo,{stateObject:s}=K,{soft_device_ring_switch:A,agent_hangup_ring_switch:c}=nt(this,xi),u={1:"软电话",2:"手机模式",3:"SIP话机"};return{agent_no:e,agent_name:n,init_state:a,default_device:G.get("answerDevice"),out_display_data:i,out_display_select_switch:o,answer_devices:(r||"").split(",").map(d=>({value:Number(d),label:u[Number(d)]})),stateObject:s,soft_device_ring_switch:A===1,agent_hangup_ring_switch:c===1}}async getRealTimeCustomerInfo(){return G.get("customerObject")}setBrowserAlert(e){if(typeof e!="boolean")throw new Error(JSON.stringify({code:1,msg:"参数类型错误"}));K.logBuiltinEnabled=e||!1}setBrowserAlertTime(e){if(typeof e!="number")throw new Error(JSON.stringify({code:1,msg:"参数类型错误"}));K.browserAlertTime=e||3e3}getEarSpeakAgent(){const{sounds_url:e}=nt(this,Xi),{soft_device_ring_audio_id:n}=nt(this,xi),r=nt(this,eo).find(({audio_id:i})=>i===n);if(r!=null&&r.app_id){let i="";return i=r.app_id==="-1"?`/ivr/${r.object}`:`/${r.app_id}/ivr/${r.object}`,`${e}${i}`}return""}getEndSpeakAgent(){const{sounds_url:e}=nt(this,Xi),{agent_hangup_ring_audio_id:n}=nt(this,xi),r=nt(this,eo).find(({audio_id:i})=>i===n);if(r!=null&&r.app_id){let i="";return i=r.app_id==="-1"?`/ivr/${r.object}`:`/${r.app_id}/ivr/${r.object}`,`${e}${i}`}return""}};Bn=new WeakMap,fn=new WeakMap,un=new WeakMap,$i=new WeakMap,Xi=new WeakMap,xi=new WeakMap,eo=new WeakMap,Ka=new WeakMap,Va=new WeakMap,to=new WeakMap,za=new WeakMap,Ya=new WeakMap,Qi=new WeakSet,j0=async function(){const e=G.get("isNextState");try{await Dw(),e||G.updateIsNextState(!0)}catch{fe.emit(He.FAIL_NOTIFICATION,"网络断开,请检查网络"),e&&G.updateIsNextState(!1)}},L0=function(){sr._timer||(sr._timer=setInterval(()=>ps(this,Qi,j0).call(this),3e3))},Wa=new WeakMap,U0=async function(){return nt(this,Bn)?nt(this,Bn).getNetworkStats():{}},kA._instance=null,kA._timer=null;let kn=kA;sr=kn;var er=function(){return er=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},er.apply(this,arguments)};function ao(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))}function Zw(t){var e=Object.create(null);return function(n){return e[n]===void 0&&(e[n]=t(n)),e[n]}}var Kw=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,Vw=Zw(function(t){return Kw.test(t)||t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)<91}),$t="-ms-",ba="-moz-",Ht="-webkit-",H0="comm",KA="rule",zd="decl",zw="@import",G0="@keyframes",Yw="@layer",q0=Math.abs,Yd=String.fromCharCode,ou=Object.assign;function Ww(t,e){return Rn(t,0)^45?(((e<<2^Rn(t,0))<<2^Rn(t,1))<<2^Rn(t,2))<<2^Rn(t,3):0}function Z0(t){return t.trim()}function oi(t,e){return(t=e.exec(t))?t[0]:t}function xt(t,e,n){return t.replace(e,n)}function _s(t,e,n){return t.indexOf(e,n)}function Rn(t,e){return t.charCodeAt(e)|0}function Go(t,e,n){return t.slice(e,n)}function Vr(t){return t.length}function K0(t){return t.length}function ma(t,e){return e.push(t),t}function Jw(t,e){return t.map(e).join("")}function Zg(t,e){return t.filter(function(n){return!oi(n,e)})}var VA=1,qo=1,V0=0,Ir=0,hn=0,_o="";function zA(t,e,n,r,i,o,a,s){return{value:t,root:e,parent:n,type:r,props:i,children:o,line:VA,column:qo,length:a,return:"",siblings:s}}function wi(t,e){return ou(zA("",null,null,"",null,null,0,t.siblings),t,{length:-t.length},e)}function mo(t){for(;t.root;)t=wi(t.root,{children:[t]});ma(t,t.siblings)}function _w(){return hn}function $w(){return hn=Ir>0?Rn(_o,--Ir):0,qo--,hn===10&&(qo=1,VA--),hn}function Fr(){return hn=Ir<V0?Rn(_o,Ir++):0,qo++,hn===10&&(qo=1,VA++),hn}function ro(){return Rn(_o,Ir)}function $s(){return Ir}function YA(t,e){return Go(_o,t,e)}function au(t){switch(t){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function Xw(t){return VA=qo=1,V0=Vr(_o=t),Ir=0,[]}function eI(t){return _o="",t}function Wc(t){return Z0(YA(Ir-1,su(t===91?t+2:t===40?t+1:t)))}function tI(t){for(;(hn=ro())&&hn<33;)Fr();return au(t)>2||au(hn)>3?"":" "}function nI(t,e){for(;--e&&Fr()&&!(hn<48||hn>102||hn>57&&hn<65||hn>70&&hn<97););return YA(t,$s()+(e<6&&ro()==32&&Fr()==32))}function su(t){for(;Fr();)switch(hn){case t:return Ir;case 34:case 39:t!==34&&t!==39&&su(hn);break;case 40:t===41&&su(t);break;case 92:Fr();break}return Ir}function rI(t,e){for(;Fr()&&t+hn!==57;)if(t+hn===84&&ro()===47)break;return"/*"+YA(e,Ir-1)+"*"+Yd(t===47?t:Fr())}function iI(t){for(;!au(ro());)Fr();return YA(t,Ir)}function oI(t){return eI(Xs("",null,null,null,[""],t=Xw(t),0,[0],t))}function Xs(t,e,n,r,i,o,a,s,A){for(var c=0,u=0,d=a,f=0,p=0,v=0,C=1,m=1,y=1,w=0,I="",O=i,x=o,g=r,M=I;m;)switch(v=w,w=Fr()){case 40:if(v!=108&&Rn(M,d-1)==58){_s(M+=xt(Wc(w),"&","&\f"),"&\f",q0(c?s[c-1]:0))!=-1&&(y=-1);break}case 34:case 39:case 91:M+=Wc(w);break;case 9:case 10:case 13:case 32:M+=tI(v);break;case 92:M+=nI($s()-1,7);continue;case 47:switch(ro()){case 42:case 47:ma(aI(rI(Fr(),$s()),e,n,A),A);break;default:M+="/"}break;case 123*C:s[c++]=Vr(M)*y;case 125*C:case 59:case 0:switch(w){case 0:case 125:m=0;case 59+u:y==-1&&(M=xt(M,/\f/g,"")),p>0&&Vr(M)-d&&ma(p>32?Vg(M+";",r,n,d-1,A):Vg(xt(M," ","")+";",r,n,d-2,A),A);break;case 59:M+=";";default:if(ma(g=Kg(M,e,n,c,u,i,s,I,O=[],x=[],d,o),o),w===123)if(u===0)Xs(M,e,g,g,O,o,d,s,x);else switch(f===99&&Rn(M,3)===110?100:f){case 100:case 108:case 109:case 115:Xs(t,g,g,r&&ma(Kg(t,g,g,0,0,i,s,I,i,O=[],d,x),x),i,x,d,s,r?O:x);break;default:Xs(M,g,g,g,[""],x,0,s,x)}}c=u=p=0,C=y=1,I=M="",d=a;break;case 58:d=1+Vr(M),p=v;default:if(C<1){if(w==123)--C;else if(w==125&&C++==0&&$w()==125)continue}switch(M+=Yd(w),w*C){case 38:y=u>0?1:(M+="\f",-1);break;case 44:s[c++]=(Vr(M)-1)*y,y=1;break;case 64:ro()===45&&(M+=Wc(Fr())),f=ro(),u=d=Vr(I=M+=iI($s())),w++;break;case 45:v===45&&Vr(M)==2&&(C=0)}}return o}function Kg(t,e,n,r,i,o,a,s,A,c,u,d){for(var f=i-1,p=i===0?o:[""],v=K0(p),C=0,m=0,y=0;C<r;++C)for(var w=0,I=Go(t,f+1,f=q0(m=a[C])),O=t;w<v;++w)(O=Z0(m>0?p[w]+" "+I:xt(I,/&\f/g,p[w])))&&(A[y++]=O);return zA(t,e,n,i===0?KA:s,A,c,u,d)}function aI(t,e,n,r){return zA(t,e,n,H0,Yd(_w()),Go(t,2,-2),0,r)}function Vg(t,e,n,r,i){return zA(t,e,n,zd,Go(t,0,r),Go(t,r+1,-1),r,i)}function z0(t,e,n){switch(Ww(t,e)){case 5103:return Ht+"print-"+t+t;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return Ht+t+t;case 4789:return ba+t+t;case 5349:case 4246:case 4810:case 6968:case 2756:return Ht+t+ba+t+$t+t+t;case 5936:switch(Rn(t,e+11)){case 114:return Ht+t+$t+xt(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return Ht+t+$t+xt(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return Ht+t+$t+xt(t,/[svh]\w+-[tblr]{2}/,"lr")+t}case 6828:case 4268:case 2903:return Ht+t+$t+t+t;case 6165:return Ht+t+$t+"flex-"+t+t;case 5187:return Ht+t+xt(t,/(\w+).+(:[^]+)/,Ht+"box-$1$2"+$t+"flex-$1$2")+t;case 5443:return Ht+t+$t+"flex-item-"+xt(t,/flex-|-self/g,"")+(oi(t,/flex-|baseline/)?"":$t+"grid-row-"+xt(t,/flex-|-self/g,""))+t;case 4675:return Ht+t+$t+"flex-line-pack"+xt(t,/align-content|flex-|-self/g,"")+t;case 5548:return Ht+t+$t+xt(t,"shrink","negative")+t;case 5292:return Ht+t+$t+xt(t,"basis","preferred-size")+t;case 6060:return Ht+"box-"+xt(t,"-grow","")+Ht+t+$t+xt(t,"grow","positive")+t;case 4554:return Ht+xt(t,/([^-])(transform)/g,"$1"+Ht+"$2")+t;case 6187:return xt(xt(xt(t,/(zoom-|grab)/,Ht+"$1"),/(image-set)/,Ht+"$1"),t,"")+t;case 5495:case 3959:return xt(t,/(image-set\([^]*)/,Ht+"$1$`$1");case 4968:return xt(xt(t,/(.+:)(flex-)?(.*)/,Ht+"box-pack:$3"+$t+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Ht+t+t;case 4200:if(!oi(t,/flex-|baseline/))return $t+"grid-column-align"+Go(t,e)+t;break;case 2592:case 3360:return $t+xt(t,"template-","")+t;case 4384:case 3616:return n&&n.some(function(r,i){return e=i,oi(r.props,/grid-\w+-end/)})?~_s(t+(n=n[e].value),"span",0)?t:$t+xt(t,"-start","")+t+$t+"grid-row-span:"+(~_s(n,"span",0)?oi(n,/\d+/):+oi(n,/\d+/)-+oi(t,/\d+/))+";":$t+xt(t,"-start","")+t;case 4896:case 4128:return n&&n.some(function(r){return oi(r.props,/grid-\w+-start/)})?t:$t+xt(xt(t,"-end","-span"),"span ","")+t;case 4095:case 3583:case 4068:case 2532:return xt(t,/(.+)-inline(.+)/,Ht+"$1$2")+t;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(Vr(t)-1-e>6)switch(Rn(t,e+1)){case 109:if(Rn(t,e+4)!==45)break;case 102:return xt(t,/(.+:)(.+)-([^]+)/,"$1"+Ht+"$2-$3$1"+ba+(Rn(t,e+3)==108?"$3":"$2-$3"))+t;case 115:return~_s(t,"stretch",0)?z0(xt(t,"stretch","fill-available"),e,n)+t:t}break;case 5152:case 5920:return xt(t,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,function(r,i,o,a,s,A,c){return $t+i+":"+o+c+(a?$t+i+"-span:"+(s?A:+A-+o)+c:"")+t});case 4949:if(Rn(t,e+6)===121)return xt(t,":",":"+Ht)+t;break;case 6444:switch(Rn(t,Rn(t,14)===45?18:11)){case 120:return xt(t,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+Ht+(Rn(t,14)===45?"inline-":"")+"box$3$1"+Ht+"$2$3$1"+$t+"$2box$3")+t;case 100:return xt(t,":",":"+$t)+t}break;case 5719:case 2647:case 2135:case 3927:case 2391:return xt(t,"scroll-","scroll-snap-")+t}return t}function hA(t,e){for(var n="",r=0;r<t.length;r++)n+=e(t[r],r,t,e)||"";return n}function sI(t,e,n,r){switch(t.type){case Yw:if(t.children.length)break;case zw:case zd:return t.return=t.return||t.value;case H0:return"";case G0:return t.return=t.value+"{"+hA(t.children,r)+"}";case KA:if(!Vr(t.value=t.props.join(",")))return""}return Vr(n=hA(t.children,r))?t.return=t.value+"{"+n+"}":""}function AI(t){var e=K0(t);return function(n,r,i,o){for(var a="",s=0;s<e;s++)a+=t[s](n,r,i,o)||"";return a}}function cI(t){return function(e){e.root||(e=e.return)&&t(e)}}function lI(t,e,n,r){if(t.length>-1&&!t.return)switch(t.type){case zd:t.return=z0(t.value,t.length,n);return;case G0:return hA([wi(t,{value:xt(t.value,"@","@"+Ht)})],r);case KA:if(t.length)return Jw(n=t.props,function(i){switch(oi(i,r=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":mo(wi(t,{props:[xt(i,/:(read-\w+)/,":"+ba+"$1")]})),mo(wi(t,{props:[i]})),ou(t,{props:Zg(n,r)});break;case"::placeholder":mo(wi(t,{props:[xt(i,/:(plac\w+)/,":"+Ht+"input-$1")]})),mo(wi(t,{props:[xt(i,/:(plac\w+)/,":"+ba+"$1")]})),mo(wi(t,{props:[xt(i,/:(plac\w+)/,$t+"input-$1")]})),mo(wi(t,{props:[i]})),ou(t,{props:Zg(n,r)});break}return""})}}var uI={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},so=typeof process<"u"&&process.env!==void 0&&(process.env.REACT_APP_SC_ATTR||process.env.SC_ATTR)||"data-styled",Y0="active",W0="data-styled-version",WA="6.1.19",Wd=`/*!sc*/
174
+ `],{type:"application/javascript"}),n=URL.createObjectURL(e);this.heartbeatWorker=new Worker(n),this.heartbeatWorker.onmessage=()=>{const r=new Date().getTime();this.sendMessage({type:0,msg_id:r}),this.pendingMessages.set(r,performance.now())},this.heartbeatWorker.postMessage("start")}stopHeartbeat(){this.heartbeatWorker&&(this.heartbeatWorker.postMessage("stop"),this.heartbeatWorker.terminate(),this.heartbeatWorker=null)}sendMessage(e){var n;((n=this.ws)==null?void 0:n.readyState)===WebSocket.OPEN?(this.ws.send(JSON.stringify(e)),e.type!==0&&qg("%cWebSocket 发送消息:","color: green; font-weight: bold;",e)):console.warn("WebSocket 未连接,消息未发送")}close(){var e;this.manualClose=!0,this.stopHeartbeat(),(e=this.ws)==null||e.close()}reconnect(){this.initWebSocket()}static __internalClose(){ni&&(ni.close(),ni=null)}static __internalSend(e){if(!ni)throw new Error("WebSocket 尚未初始化");ni.sendMessage(e)}}class qw{constructor(e){this.sipClient=null,this.sipClient=e}roleMute(){const e=G.get("isCalling"),n=K.sessionId;if(!e)throw new Error(JSON.stringify({code:1,msg:"当前没有通话"}));if(!n)throw new Error(JSON.stringify({code:1,msg:"当前没有通话"}))}holdCall(){this.roleMute();const e=G.get("isHold"),{sessionId:n}=K;if(n){if(!G.get("actionConfigs").includes("hold"))throw new Error(JSON.stringify({code:1,msg:"当前状态请勿保持"}));if(e)throw new Error(JSON.stringify({code:1,msg:"当前已处于保持状态"}));An.__internalSend({type:it.CALL_HOLD,data:{session_id:n}})}}unholdCall(){this.roleMute();const{isHold:e}=G.getState(),{sessionId:n}=K;if(!G.get("actionConfigs").includes("unhold"))throw new Error(JSON.stringify({code:1,msg:"当前状态请勿取消保持"}));if(n){if(!e)throw new Error(JSON.stringify({code:1,msg:"当前未处于保持状态"}));An.__internalSend({type:it.CALL_UNHOLD,data:{session_id:n}})}}sendDTMF(e){if(G.get("answerDevice")!==1)throw new Error(JSON.stringify({code:1,msg:"当前设备不支持此功能"}));if(!G.get("actionConfigs").includes("dtmf"))throw new Error(JSON.stringify({code:1,msg:"当前状态请勿发送按键"}));const{isCalling:n}=G.getState();if(!n)throw new Error(JSON.stringify({code:1,msg:"当前没有通话"}));this.sipClient.sendDTMF(e)}cancelCall(){if(!G.get("isCalling"))throw nn.error("当前没有通话","call-api.ts 81 cancelCall"),new Error(JSON.stringify({code:1,msg:"当前没有通话"}));const e=K.sessionId;fe.emit(ie.REJECT,{session_id:e}),An.__internalSend({type:it.AGENT_HANGUP,data:{session_id:e}})}async consultCall(e){this.roleMute();const{isCalling:n,outCallIsAnswer:r,consultIsAnswer:i,incomingIsAnswer:o}=G.getState(),a=K.sessionId;if(!G.get("actionConfigs").includes("consult"))throw new Error(JSON.stringify({code:1,msg:"当前状态请勿调用咨询"}));if(i)throw new Error(JSON.stringify({code:1,msg:"当前正在咨询"}));if(!(n||r||o))throw new Error(JSON.stringify({code:1,msg:"当前没有通话"}));if(!a)throw new Error(JSON.stringify({code:1,msg:"sessionId不存在"}));An.__internalSend({type:it.CONSULT_REQUEST,data:{session_id:a,consultation_agent_no:e}})}async answerCall(){const e=G.get("answerDevice");if(e!==1)throw nn.error(`当前设备不支持此功能;answerDevice: ${e}`,"call-api.ts 119 answerCall"),new Error(JSON.stringify({code:1,msg:"当前设备不支持此功能"}));await this.sipClient.answerCall()}makeCall(e){if(typeof e!="string"||e.trim()==="")throw nn.warn(`外呼号码非法;号码: ${e}`,"call-api.ts 126 makeCall"),new Error(JSON.stringify({code:1,msg:"外呼号码非法"}));const n={};iu(e)?n.trace_id=e:n.customer_phone=e.replace(/[\s\r\n-]+/g,"");const r=G.get("isCalling"),i=G.get("selectOutNumber")||"";if(r)throw nn.error(`正在呼叫中,请勿重复点击;session id: ${K.sessionId}`,"call-api.ts 142 makeCall"),new Error(JSON.stringify({code:1,msg:"正在呼叫中,请勿重复点击"}));G.updateDirection(yn.OUTGOING),An.__internalSend({type:it.OUT_CALL,data:{...n,caller:i.replace(/[\s\r\n-]+/g,"")}})}previewCall(e,n){const r={};iu(e)?r.trace_id=e:r.customer_phone=e.replace(/[\s\r\n-]+/g,"");const i=G.get("isCalling"),o=G.get("selectOutNumber")||"";if(i)throw nn.error(`正在呼叫中,请勿重复点击;session id: ${K.sessionId}`,"call-api.ts 162 previewCall"),new Error(JSON.stringify({code:1,msg:"正在呼叫中,请勿重复点击"}));if(typeof e!="string"||e.trim()==="")throw new Error(JSON.stringify({code:1,msg:"外呼号码非法"}));G.updateDirection(yn.OUTGOING),An.__internalSend({type:it.PREVIEW_OUT_CALL,data:{...r,caller:o,preview_task_id:n}})}async hangup(){if(!G.get("isCalling"))throw nn.error("当前没有通话","call-api.ts 178 hangup"),new Error(JSON.stringify({code:1,msg:"当前没有通话"}));K.isAgentHangup=!0;const e=K.sessionId;An.__internalSend({type:it.AGENT_HANGUP,data:{session_id:e}}),await this.sipClient.hangup()}mute(){this.roleMute();const e=G.get("actionConfigs"),n=G.get("isMuted"),r=K.sessionId;if(n)throw new Error(JSON.stringify({code:1,msg:"当前未处于静音状态"}));if(!e.includes("mute"))throw new Error(JSON.stringify({code:1,msg:"当前状态请勿调用静音"}));An.__internalSend({type:it.MUTE,data:{session_id:r}})}unmute(){this.roleMute();const e=G.get("actionConfigs"),n=G.get("isMuted"),r=K.sessionId;if(!n)throw new Error(JSON.stringify({code:1,msg:"当前未处于未静音状态"}));if(!e.includes("unmute"))throw new Error(JSON.stringify({code:1,msg:"当前状态请勿调用静音"}));An.__internalSend({type:it.UNMUTE,data:{session_id:r}})}consultTransfer(){this.roleMute();const e=G.get("consultIsAnswer"),n=K.sessionId,r=G.get("actionConfigs");if(!r.includes("consult_transfer"))throw nn.error(`当前状态请勿调用咨询转移; actionConfigs:${r.join(",")}; consultIsAnswer: ${e}; session id: ${n}`,"call-api.ts 228 consultTransfer"),new Error(JSON.stringify({code:1,msg:"当前状态请勿调用咨询转移"}));if(!e)throw new Error(JSON.stringify({code:1,msg:"当前未处于咨询中"}));An.__internalSend({type:it.CONSULT_TRANSFER,data:{session_id:n}})}satisfactionEvaluation(){this.roleMute();const e=K.sessionId,n=G.get("actionConfigs");if(!n.includes("satisfaction"))throw nn.error(`当前状态请勿调用满意度评价; actionConfigs:${n.join(",")}; session id: ${e}`,"call-api.ts 243 satisfactionEvaluation"),new Error(JSON.stringify({code:1,msg:"当前状态请勿调用满意度评价"}));An.__internalSend({type:it.SATISFACTION_EVALUATION,data:{session_id:e}})}startConference(){this.roleMute();const e=K.sessionId,n=G.get("actionConfigs");if(!n.includes("conference"))throw nn.error(`当前状态请勿调用三方会议; actionConfigs:${n.join(",")}; session id: ${e}`,"call-api.ts 264 startConference"),new Error(JSON.stringify({code:1,msg:"当前状态请勿调用三方会议"}));if(!G.get("consultIsAnswer"))throw new Error(JSON.stringify({code:1,msg:"当前未处于咨询中"}));An.__internalSend({type:it.CONSULT_THREE_WAY,data:{session_id:e}})}consultRetrieve(){this.roleMute();const e=G.get("actionConfigs"),n=K.sessionId;if(!e.includes("consult_retrieve"))throw nn.error(`当前状态请勿取回通话; actionConfigs:${e.join(",")}; session id: ${n}`,"call-api.ts 285 consultRetrieve"),new Error(JSON.stringify({code:1,msg:"当前状态请勿取回通话"}));if(!G.get("consultIsAnswer"))throw new Error(JSON.stringify({code:1,msg:"当前未处于咨询中"}));An.__internalSend({type:it.CONSULT_RETURN_CALL,data:{session_id:n}})}async transferAgent(e){this.roleMute();const n=G.get("actionConfigs"),r=K.sessionId;if(!n.includes("transfer"))throw nn.error(`当前状态请勿转接; actionConfigs:${n.join(",")}; session id: ${r}`,"call-api.ts 306 transferAgent"),new Error(JSON.stringify({code:1,msg:"当前状态请勿转接"}));const{transferIsAnswer:i}=G.getState();if(i)throw new Error(JSON.stringify({code:1,msg:"当前正在转接"}));An.__internalSend({type:it.TRANSFER,data:{session_id:r,transfer_type:0,transfer_dest:e}})}async transferOutline(e){this.roleMute();const n=K.sessionId,r=G.get("actionConfigs");if(!r.includes("transfer"))throw nn.error(`当前状态请勿转接; actionConfigs:${r.join(",")}; session id: ${n}`,"call-api.ts 330 transferOutline"),new Error(JSON.stringify({code:1,msg:"当前状态请勿转接"}));if(!e)throw new Error(JSON.stringify({code:1,msg:"号码不能为空"}));if(!/^\d+$/.test(e))throw nn.error(`当前状态请勿转接; 转接号码:${e}; session id: ${n}`,"call-api.ts 339 transferOutline"),new Error(JSON.stringify({code:1,msg:"号码格式错误"}));const{transferIsAnswer:i}=G.getState();if(i)throw new Error(JSON.stringify({code:1,msg:"当前正在转接"}));An.__internalSend({type:it.TRANSFER,data:{session_id:n,transfer_type:2,transfer_dest:e}})}}var sr,Bn,fn,un,$i,Xi,xi,eo,Ka,Va,to,za,Ya,Qi,j0,L0,Wa,U0;const kA=class kA{constructor(){Kn(this,Qi);Kn(this,Bn);Kn(this,fn);Kn(this,un);Kn(this,$i);Kn(this,Xi);Kn(this,xi);Kn(this,eo);Kn(this,Ka);Kn(this,Va);Kn(this,to);Kn(this,za);Kn(this,Ya);Kn(this,Wa);if(sn(this,Bn,null),sn(this,fn,new ja),sn(this,$i,null),sn(this,Xi,{sounds_url:"",recordings_url:""}),sn(this,xi,{soft_device_ring_switch:0,soft_device_ring_audio_id:"",agent_hangup_ring_switch:0,agent_hangup_ring_audio_id:""}),sn(this,eo,[]),sn(this,to,!1),sn(this,za,()=>{}),sn(this,Ya,()=>{}),this.initWebRtc=async()=>{if(nt(this,Bn))return;const e=K.agentInfo.sip_account_list.find(n=>n.device_type===1);if(!e)throw new Error(JSON.stringify({code:1,msg:"未找到 sip_account_list"}));{const n=e.sip_register_addr;sn(this,Bn,new Bw({server:n.split(":")[0],user:e.sip_account,password:e.sip_password,webSocket:`wss://${n}`,callTimeout:3e4},nt(this,Wa))),await nt(this,Bn).start()}},sn(this,Wa,e=>{const{type:n,data:r}=e;fe.emit(n,r)}),!sr._creatingInstance)throw new Error("请使用 YSYTAgentSdk.getInstance() 获取实例");clearInterval(nt(this,$i)),sn(this,$i,setInterval(async()=>{const e=await ps(this,Qi,U0).call(this);T0.updateRttObject(e)},2e3)),To.requestMediaPermissions(),sn(this,Va,G.subscribeKey("isNextState",async e=>{if(nn.warn(`网络连接状态改变, ${e}`,"index.ts"),e){G.get("answerDevice")===1&&await nt(this,Bn).reconnect();let n="";const r=new URL(Si).host;n=Si.includes("https")?`wss://${r}`:`ws://${r}`;const{agent_no:i}=K.agentInfo;An.getInstance({url:`${n}/ccs-ws/api/v1/ws/call/${i}?Authorization=`,sipClient:nt(this,Bn)}),setTimeout(()=>{nt(this,fn)._changeState({data:{state:Mt.BUSY,state_name:"忙碌"},success:()=>{G.updateDisplayText(""),fe.emit(ie.AGENT_STATE,{state:Mt.BUSY,state_name:"忙碌"})}},"d")},10)}else An.__internalClose(),G.updateIsCalling(!1),G.updateOutCallIsAnswer(!1),G.updateIncomingIsAnswer(!1),G.updateIsMuted(!1),G.updateConsultIsAnswer(!1),G.updateIsHold(!1),G.updateCustomerInfo(void 0),G.updateDisplayText("离线")})),sn(this,Ka,G.subscribeKey("answerDevice",async e=>{e===1?K.stateObject.state===Mt.UNREGISTERED&&await nt(this,fn)._changeState({data:{...K.stateBeforeChange,state_name:K.stateBeforeChange.state===Mt.IDLE?"空闲":"忙碌"}},"qq"):await this.destroyRtc()})),this.on(He.KICK_OFF,()=>{this.destroy()}),window.addEventListener("beforeunload",e=>{e.returnValue="",nn.info("beforeunload","index.ts"),this.destroy()}),window.addEventListener("online",nt(this,za)),window.addEventListener("offline",nt(this,Ya))}static get instance(){return this._instance}static async destroyInstance(){this._instance&&(await this._instance.destroy(),this._instance=null)}static getInstance(e){if(!this._instance){if(!e)throw new Error("首次调用必须传入配置参数");const{url:r,appKey:i,appSecret:o,agentNo:a}=e;Si=r||"https://aicc-api.yescloudy.com",Kd=i,Vd=o,n=a.replace(/\s/g,""),zc=n,sr._creatingInstance=!0,this._instance=new sr,delete sr._creatingInstance}var n;return this._instance}getInit(){return nt(this,to)}async init({enableBrowserAlert:e,logBuiltinEnabled:n,browserAlertTime:r,onCallBack:i}){try{let o="";const a=new URL(Si).host;o=Si.includes("https")?`wss://${a}`:`ws://${a}`;const s=An.getInstance({url:`${o}/ccs-ws/api/v1/ws/call/${zc}?Authorization=`,sipClient:null,onOpen:async()=>{const A=await En(`${Yi}/config/swiftms`,{});sn(this,Xi,A.data);const c=await En(`${Yi}/ring/query`,{});sn(this,xi,c.data);const u=await En(`${Yi}/audio/list`,{});sn(this,eo,u.data),K.logBuiltinEnabled=n||!1,K.browserAlertTime=r||5e3,await nt(this,fn)._agentLogin(zc),nn.info("初始化成功","index.ts");const{current_answer_device:d,current_state:f,out_display_number:p,out_display_select_switch:v}=K.agentInfo;f===Mt.IDLE?(G.updateActionConfigs(Vn),K.stateObject={state:f,state_name:"空闲"},K.stateBeforeChange=K.stateObject):f===Mt.BUSY?(G.updateActionConfigs(gA),K.stateObject={state:f,state_name:"忙碌"},K.stateBeforeChange=K.stateObject):f===Mt.UNREGISTERED&&(G.updateActionConfigs(gA),K.stateObject={state:f,state_name:"未注册"}),v===1?G.updateSelectOutNumber(p):G.updateSelectOutNumber(""),G.updateAnswerDevice(d),ja.setInitRtcFn(this.initWebRtc),d===1&&(await this.initWebRtc(),s.setSipClient(nt(this,Bn))),sn(this,un,new qw(nt(this,Bn))),K.enableBrowserAlert=e,e&&To.requestPermission(),fe.emit(He.AGENT_INIT_STATUS,!0),sn(this,to,!0),clearInterval(sr._timer),sr._timer=null,ps(this,Qi,L0).call(this),i==null||i()}})}catch{fe.emit(He.AGENT_INIT_STATUS,!1),sn(this,to,!1)}}on(e,n){return fe.on(e,n),this}off(e,n){fe.off(e,n)}offAll(){fe.clearAllListeners()}async destroyRtc(){var e;await((e=nt(this,Bn))==null?void 0:e.destroy()),sn(this,Bn,null)}async destroy(){var e,n;sr._instance&&(await this.destroyRtc(),(e=nt(this,Ka))==null||e.call(this),(n=nt(this,Va))==null||n.call(this),clearInterval(nt(this,$i)),An.__internalClose(),fe.emit(He.DESTROY),this.offAll(),sr._instance=null,G.reset(),G.updateSelectOutNumber(""),clearInterval(sr._timer),clearTimeout(K.autoStateTimer),K.autoStateTimer=null,sr._timer=null)}get call_api(){const e=n=>(...r)=>n.apply(this,r);return{answerCall:e(()=>nt(this,un).answerCall()),makeCall:n=>nt(this,un).makeCall(n),previewMakeCall:(n,r)=>nt(this,un).previewCall(n,r),cancelCall:e(()=>nt(this,un).cancelCall()),hangup:e(()=>nt(this,un).hangup()),sendDTMF:e(n=>nt(this,un).sendDTMF(n)),holdCall:e(()=>nt(this,un).holdCall()),unholdCall:e(()=>nt(this,un).unholdCall()),consultCall:e(async n=>{try{await nt(this,un).consultCall(n)}catch(r){throw console.warn(r),r}}),consultRetrieve:e(()=>nt(this,un).consultRetrieve()),consultTransfer:e(()=>nt(this,un).consultTransfer()),mute:e(()=>nt(this,un).mute()),unmute:e(()=>nt(this,un).unmute()),satisfactionEvaluation:e(()=>nt(this,un).satisfactionEvaluation()),startConference:e(()=>nt(this,un).startConference()),transferAgent:e(n=>nt(this,un).transferAgent(n)),transferOutline:e(n=>nt(this,un).transferOutline(n)),earSpeakStart:e(n=>nt(this,fn).earCall(n)),earSpeakStop:e(n=>nt(this,fn).stopEarCall(n)),forceInsert:e(n=>nt(this,fn).forceInsert(n)),forceDisconnect:e(n=>nt(this,fn).forceDisconnect(n))}}get agent_api(){const e=n=>(...r)=>n.apply(this,r);return{changeDevice:e(n=>nt(this,fn).changeDevice(n)),changeState:e(async n=>{const r=G.get("answerDevice");if(K.stateObject.state===Mt.UNREGISTERED&&r===1){await nt(this,Bn).reconnect();let i="";const o=new URL(Si).host;i=Si.includes("https")?`wss://${o}`:`ws://${o}`;const{agent_no:a}=K.agentInfo;An.getInstance({url:`${i}/ccs-ws/api/v1/ws/call/${a}?Authorization=`,sipClient:nt(this,Bn)})}await nt(this,fn).changeState(n,"c")}),getIdleAgentList:e(n=>nt(this,fn).getIdleAgentList(n)),getAgentState:e(n=>nt(this,fn).getAgentState(n)),setAgentExplicit:e(n=>nt(this,fn).setAgentExplicit(n)),checkAgentLogin:n=>nt(this,fn).checkAgentLogin(n),getCallRecord:n=>nt(this,fn).getCallRecord(n),agentLogout:async(n,r)=>{try{await nt(this,fn).logout(n),await this.destroy(),r==null||r({code:0,msg:""})}catch{}},listenAgentCall:n=>nt(this,fn).listenCall(n)}}getAgentData(){const{agent_no:e,agent_name:n,answer_devices:r,out_display_data:i,out_display_select_switch:o,current_state:a}=K.agentInfo,{stateObject:s}=K,{soft_device_ring_switch:A,agent_hangup_ring_switch:c}=nt(this,xi),u={1:"软电话",2:"手机模式",3:"SIP话机"};return{agent_no:e,agent_name:n,init_state:a,default_device:G.get("answerDevice"),out_display_data:i,out_display_select_switch:o,answer_devices:(r||"").split(",").map(d=>({value:Number(d),label:u[Number(d)]})),stateObject:s,soft_device_ring_switch:A===1,agent_hangup_ring_switch:c===1}}async getRealTimeCustomerInfo(){return G.get("customerObject")}setBrowserAlert(e){if(typeof e!="boolean")throw new Error(JSON.stringify({code:1,msg:"参数类型错误"}));K.logBuiltinEnabled=e||!1}setBrowserAlertTime(e){if(typeof e!="number")throw new Error(JSON.stringify({code:1,msg:"参数类型错误"}));K.browserAlertTime=e||3e3}getEarSpeakAgent(){const{sounds_url:e}=nt(this,Xi),{soft_device_ring_audio_id:n}=nt(this,xi),r=nt(this,eo).find(({audio_id:i})=>i===n);if(r!=null&&r.app_id){let i="";return i=r.app_id==="-1"?`/ivr/${r.object}`:`/${r.app_id}/ivr/${r.object}`,`${e}${i}`}return""}getEndSpeakAgent(){const{sounds_url:e}=nt(this,Xi),{agent_hangup_ring_audio_id:n}=nt(this,xi),r=nt(this,eo).find(({audio_id:i})=>i===n);if(r!=null&&r.app_id){let i="";return i=r.app_id==="-1"?`/ivr/${r.object}`:`/${r.app_id}/ivr/${r.object}`,`${e}${i}`}return""}};Bn=new WeakMap,fn=new WeakMap,un=new WeakMap,$i=new WeakMap,Xi=new WeakMap,xi=new WeakMap,eo=new WeakMap,Ka=new WeakMap,Va=new WeakMap,to=new WeakMap,za=new WeakMap,Ya=new WeakMap,Qi=new WeakSet,j0=async function(){const e=G.get("isNextState");try{await Dw(),e||G.updateIsNextState(!0)}catch{fe.emit(He.FAIL_NOTIFICATION,"网络断开,请检查网络"),e&&G.updateIsNextState(!1)}},L0=function(){sr._timer||(sr._timer=setInterval(()=>ps(this,Qi,j0).call(this),3e3))},Wa=new WeakMap,U0=async function(){return nt(this,Bn)?nt(this,Bn).getNetworkStats():{}},kA._instance=null,kA._timer=null;let kn=kA;sr=kn;var er=function(){return er=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},er.apply(this,arguments)};function ao(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))}function Zw(t){var e=Object.create(null);return function(n){return e[n]===void 0&&(e[n]=t(n)),e[n]}}var Kw=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,Vw=Zw(function(t){return Kw.test(t)||t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)<91}),$t="-ms-",ba="-moz-",Ht="-webkit-",H0="comm",KA="rule",zd="decl",zw="@import",G0="@keyframes",Yw="@layer",q0=Math.abs,Yd=String.fromCharCode,ou=Object.assign;function Ww(t,e){return Rn(t,0)^45?(((e<<2^Rn(t,0))<<2^Rn(t,1))<<2^Rn(t,2))<<2^Rn(t,3):0}function Z0(t){return t.trim()}function oi(t,e){return(t=e.exec(t))?t[0]:t}function xt(t,e,n){return t.replace(e,n)}function _s(t,e,n){return t.indexOf(e,n)}function Rn(t,e){return t.charCodeAt(e)|0}function Go(t,e,n){return t.slice(e,n)}function Vr(t){return t.length}function K0(t){return t.length}function ma(t,e){return e.push(t),t}function Jw(t,e){return t.map(e).join("")}function Zg(t,e){return t.filter(function(n){return!oi(n,e)})}var VA=1,qo=1,V0=0,Ir=0,hn=0,_o="";function zA(t,e,n,r,i,o,a,s){return{value:t,root:e,parent:n,type:r,props:i,children:o,line:VA,column:qo,length:a,return:"",siblings:s}}function wi(t,e){return ou(zA("",null,null,"",null,null,0,t.siblings),t,{length:-t.length},e)}function mo(t){for(;t.root;)t=wi(t.root,{children:[t]});ma(t,t.siblings)}function _w(){return hn}function $w(){return hn=Ir>0?Rn(_o,--Ir):0,qo--,hn===10&&(qo=1,VA--),hn}function Fr(){return hn=Ir<V0?Rn(_o,Ir++):0,qo++,hn===10&&(qo=1,VA++),hn}function ro(){return Rn(_o,Ir)}function $s(){return Ir}function YA(t,e){return Go(_o,t,e)}function au(t){switch(t){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function Xw(t){return VA=qo=1,V0=Vr(_o=t),Ir=0,[]}function eI(t){return _o="",t}function Wc(t){return Z0(YA(Ir-1,su(t===91?t+2:t===40?t+1:t)))}function tI(t){for(;(hn=ro())&&hn<33;)Fr();return au(t)>2||au(hn)>3?"":" "}function nI(t,e){for(;--e&&Fr()&&!(hn<48||hn>102||hn>57&&hn<65||hn>70&&hn<97););return YA(t,$s()+(e<6&&ro()==32&&Fr()==32))}function su(t){for(;Fr();)switch(hn){case t:return Ir;case 34:case 39:t!==34&&t!==39&&su(hn);break;case 40:t===41&&su(t);break;case 92:Fr();break}return Ir}function rI(t,e){for(;Fr()&&t+hn!==57;)if(t+hn===84&&ro()===47)break;return"/*"+YA(e,Ir-1)+"*"+Yd(t===47?t:Fr())}function iI(t){for(;!au(ro());)Fr();return YA(t,Ir)}function oI(t){return eI(Xs("",null,null,null,[""],t=Xw(t),0,[0],t))}function Xs(t,e,n,r,i,o,a,s,A){for(var c=0,u=0,d=a,f=0,p=0,v=0,C=1,m=1,y=1,w=0,I="",O=i,x=o,g=r,M=I;m;)switch(v=w,w=Fr()){case 40:if(v!=108&&Rn(M,d-1)==58){_s(M+=xt(Wc(w),"&","&\f"),"&\f",q0(c?s[c-1]:0))!=-1&&(y=-1);break}case 34:case 39:case 91:M+=Wc(w);break;case 9:case 10:case 13:case 32:M+=tI(v);break;case 92:M+=nI($s()-1,7);continue;case 47:switch(ro()){case 42:case 47:ma(aI(rI(Fr(),$s()),e,n,A),A);break;default:M+="/"}break;case 123*C:s[c++]=Vr(M)*y;case 125*C:case 59:case 0:switch(w){case 0:case 125:m=0;case 59+u:y==-1&&(M=xt(M,/\f/g,"")),p>0&&Vr(M)-d&&ma(p>32?Vg(M+";",r,n,d-1,A):Vg(xt(M," ","")+";",r,n,d-2,A),A);break;case 59:M+=";";default:if(ma(g=Kg(M,e,n,c,u,i,s,I,O=[],x=[],d,o),o),w===123)if(u===0)Xs(M,e,g,g,O,o,d,s,x);else switch(f===99&&Rn(M,3)===110?100:f){case 100:case 108:case 109:case 115:Xs(t,g,g,r&&ma(Kg(t,g,g,0,0,i,s,I,i,O=[],d,x),x),i,x,d,s,r?O:x);break;default:Xs(M,g,g,g,[""],x,0,s,x)}}c=u=p=0,C=y=1,I=M="",d=a;break;case 58:d=1+Vr(M),p=v;default:if(C<1){if(w==123)--C;else if(w==125&&C++==0&&$w()==125)continue}switch(M+=Yd(w),w*C){case 38:y=u>0?1:(M+="\f",-1);break;case 44:s[c++]=(Vr(M)-1)*y,y=1;break;case 64:ro()===45&&(M+=Wc(Fr())),f=ro(),u=d=Vr(I=M+=iI($s())),w++;break;case 45:v===45&&Vr(M)==2&&(C=0)}}return o}function Kg(t,e,n,r,i,o,a,s,A,c,u,d){for(var f=i-1,p=i===0?o:[""],v=K0(p),C=0,m=0,y=0;C<r;++C)for(var w=0,I=Go(t,f+1,f=q0(m=a[C])),O=t;w<v;++w)(O=Z0(m>0?p[w]+" "+I:xt(I,/&\f/g,p[w])))&&(A[y++]=O);return zA(t,e,n,i===0?KA:s,A,c,u,d)}function aI(t,e,n,r){return zA(t,e,n,H0,Yd(_w()),Go(t,2,-2),0,r)}function Vg(t,e,n,r,i){return zA(t,e,n,zd,Go(t,0,r),Go(t,r+1,-1),r,i)}function z0(t,e,n){switch(Ww(t,e)){case 5103:return Ht+"print-"+t+t;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return Ht+t+t;case 4789:return ba+t+t;case 5349:case 4246:case 4810:case 6968:case 2756:return Ht+t+ba+t+$t+t+t;case 5936:switch(Rn(t,e+11)){case 114:return Ht+t+$t+xt(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return Ht+t+$t+xt(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return Ht+t+$t+xt(t,/[svh]\w+-[tblr]{2}/,"lr")+t}case 6828:case 4268:case 2903:return Ht+t+$t+t+t;case 6165:return Ht+t+$t+"flex-"+t+t;case 5187:return Ht+t+xt(t,/(\w+).+(:[^]+)/,Ht+"box-$1$2"+$t+"flex-$1$2")+t;case 5443:return Ht+t+$t+"flex-item-"+xt(t,/flex-|-self/g,"")+(oi(t,/flex-|baseline/)?"":$t+"grid-row-"+xt(t,/flex-|-self/g,""))+t;case 4675:return Ht+t+$t+"flex-line-pack"+xt(t,/align-content|flex-|-self/g,"")+t;case 5548:return Ht+t+$t+xt(t,"shrink","negative")+t;case 5292:return Ht+t+$t+xt(t,"basis","preferred-size")+t;case 6060:return Ht+"box-"+xt(t,"-grow","")+Ht+t+$t+xt(t,"grow","positive")+t;case 4554:return Ht+xt(t,/([^-])(transform)/g,"$1"+Ht+"$2")+t;case 6187:return xt(xt(xt(t,/(zoom-|grab)/,Ht+"$1"),/(image-set)/,Ht+"$1"),t,"")+t;case 5495:case 3959:return xt(t,/(image-set\([^]*)/,Ht+"$1$`$1");case 4968:return xt(xt(t,/(.+:)(flex-)?(.*)/,Ht+"box-pack:$3"+$t+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Ht+t+t;case 4200:if(!oi(t,/flex-|baseline/))return $t+"grid-column-align"+Go(t,e)+t;break;case 2592:case 3360:return $t+xt(t,"template-","")+t;case 4384:case 3616:return n&&n.some(function(r,i){return e=i,oi(r.props,/grid-\w+-end/)})?~_s(t+(n=n[e].value),"span",0)?t:$t+xt(t,"-start","")+t+$t+"grid-row-span:"+(~_s(n,"span",0)?oi(n,/\d+/):+oi(n,/\d+/)-+oi(t,/\d+/))+";":$t+xt(t,"-start","")+t;case 4896:case 4128:return n&&n.some(function(r){return oi(r.props,/grid-\w+-start/)})?t:$t+xt(xt(t,"-end","-span"),"span ","")+t;case 4095:case 3583:case 4068:case 2532:return xt(t,/(.+)-inline(.+)/,Ht+"$1$2")+t;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(Vr(t)-1-e>6)switch(Rn(t,e+1)){case 109:if(Rn(t,e+4)!==45)break;case 102:return xt(t,/(.+:)(.+)-([^]+)/,"$1"+Ht+"$2-$3$1"+ba+(Rn(t,e+3)==108?"$3":"$2-$3"))+t;case 115:return~_s(t,"stretch",0)?z0(xt(t,"stretch","fill-available"),e,n)+t:t}break;case 5152:case 5920:return xt(t,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,function(r,i,o,a,s,A,c){return $t+i+":"+o+c+(a?$t+i+"-span:"+(s?A:+A-+o)+c:"")+t});case 4949:if(Rn(t,e+6)===121)return xt(t,":",":"+Ht)+t;break;case 6444:switch(Rn(t,Rn(t,14)===45?18:11)){case 120:return xt(t,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+Ht+(Rn(t,14)===45?"inline-":"")+"box$3$1"+Ht+"$2$3$1"+$t+"$2box$3")+t;case 100:return xt(t,":",":"+$t)+t}break;case 5719:case 2647:case 2135:case 3927:case 2391:return xt(t,"scroll-","scroll-snap-")+t}return t}function hA(t,e){for(var n="",r=0;r<t.length;r++)n+=e(t[r],r,t,e)||"";return n}function sI(t,e,n,r){switch(t.type){case Yw:if(t.children.length)break;case zw:case zd:return t.return=t.return||t.value;case H0:return"";case G0:return t.return=t.value+"{"+hA(t.children,r)+"}";case KA:if(!Vr(t.value=t.props.join(",")))return""}return Vr(n=hA(t.children,r))?t.return=t.value+"{"+n+"}":""}function AI(t){var e=K0(t);return function(n,r,i,o){for(var a="",s=0;s<e;s++)a+=t[s](n,r,i,o)||"";return a}}function cI(t){return function(e){e.root||(e=e.return)&&t(e)}}function lI(t,e,n,r){if(t.length>-1&&!t.return)switch(t.type){case zd:t.return=z0(t.value,t.length,n);return;case G0:return hA([wi(t,{value:xt(t.value,"@","@"+Ht)})],r);case KA:if(t.length)return Jw(n=t.props,function(i){switch(oi(i,r=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":mo(wi(t,{props:[xt(i,/:(read-\w+)/,":"+ba+"$1")]})),mo(wi(t,{props:[i]})),ou(t,{props:Zg(n,r)});break;case"::placeholder":mo(wi(t,{props:[xt(i,/:(plac\w+)/,":"+Ht+"input-$1")]})),mo(wi(t,{props:[xt(i,/:(plac\w+)/,":"+ba+"$1")]})),mo(wi(t,{props:[xt(i,/:(plac\w+)/,$t+"input-$1")]})),mo(wi(t,{props:[i]})),ou(t,{props:Zg(n,r)});break}return""})}}var uI={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},so=typeof process<"u"&&process.env!==void 0&&(process.env.REACT_APP_SC_ATTR||process.env.SC_ATTR)||"data-styled",Y0="active",W0="data-styled-version",WA="6.1.19",Wd=`/*!sc*/
175
175
  `,pA=typeof window<"u"&&typeof document<"u",dI=!!(typeof SC_DISABLE_SPEEDY=="boolean"?SC_DISABLE_SPEEDY:typeof process<"u"&&process.env!==void 0&&process.env.REACT_APP_SC_DISABLE_SPEEDY!==void 0&&process.env.REACT_APP_SC_DISABLE_SPEEDY!==""?process.env.REACT_APP_SC_DISABLE_SPEEDY!=="false"&&process.env.REACT_APP_SC_DISABLE_SPEEDY:typeof process<"u"&&process.env!==void 0&&process.env.SC_DISABLE_SPEEDY!==void 0&&process.env.SC_DISABLE_SPEEDY!==""?process.env.SC_DISABLE_SPEEDY!=="false"&&process.env.SC_DISABLE_SPEEDY:process.env.NODE_ENV!=="production"),zg=/invalid hook call/i,Ms=new Set,fI=function(t,e){if(process.env.NODE_ENV!=="production"){var n=e?' with the id of "'.concat(e,'"'):"",r="The component ".concat(t).concat(n,` has been created dynamically.
176
176
  `)+`You may see this warning because you've called styled inside another component.
177
177
  To resolve this only create new StyledComponents outside of any render method and function component.
@@ -530,7 +530,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Ds]+=1);const WI=on.div`
530
530
  onMouseEnter onMouseLeave onMouseMove onMouseOut onMouseOver onMouseUp onSelect onTouchCancel
531
531
  onTouchEnd onTouchMove onTouchStart onScroll onWheel onAbort onCanPlay onCanPlayThrough
532
532
  onDurationChange onEmptied onEncrypted onEnded onError onLoadedData onLoadedMetadata
533
- onLoadStart onPause onPlay onPlaying onProgress onRateChange onSeeked onSeeking onStalled onSuspend onTimeUpdate onVolumeChange onWaiting onLoad onError`,Q6="".concat(k6," ").concat(P6).split(/[\s\n]+/),j6="aria-",L6="data-";function Tp(t,e){return t.indexOf(e)===0}function ki(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n;e===!1?n={aria:!0,data:!0,attr:!0}:e===!0?n={aria:!0}:n=L({},e);var r={};return Object.keys(t).forEach(function(i){(n.aria&&(i==="role"||Tp(i,j6))||n.data&&Tp(i,L6)||n.attr&&Q6.includes(i))&&(r[i]=t[i])}),r}const Ur=t=>{const[,,,,e]=dr();return e?`${t}-css-var`:""},Ui=t=>{const e=N.useContext(Uo);return N.useMemo(()=>t?typeof t=="string"?t??e:t instanceof Function?t(e):e:e,[t,e])},D1=l.createContext(null),U6=D1.Provider,B1=l.createContext(null),H6=B1.Provider;var G6=["prefixCls","className","style","checked","disabled","defaultChecked","type","title","onChange"],q6=N.forwardRef(function(t,e){var n=t.prefixCls,r=n===void 0?"rc-checkbox":n,i=t.className,o=t.style,a=t.checked,s=t.disabled,A=t.defaultChecked,c=A===void 0?!1:A,u=t.type,d=u===void 0?"checkbox":u,f=t.title,p=t.onChange,v=Et(t,G6),C=N.useRef(null),m=N.useRef(null),y=Fn(c,{value:a}),w=ee(y,2),I=w[0],O=w[1];N.useImperativeHandle(e,function(){return{focus:function(E){var b;(b=C.current)===null||b===void 0||b.focus(E)},blur:function(){var E;(E=C.current)===null||E===void 0||E.blur()},input:C.current,nativeElement:m.current}});var x=Ae(r,i,Q(Q({},"".concat(r,"-checked"),I),"".concat(r,"-disabled"),s)),g=function(E){s||("checked"in t||O(E.target.checked),p==null||p({target:L(L({},t),{},{type:d,checked:E.target.checked}),stopPropagation:function(){E.stopPropagation()},preventDefault:function(){E.preventDefault()},nativeEvent:E.nativeEvent}))};return l.createElement("span",{className:x,title:f,style:o,ref:m},l.createElement("input",Qe({},v,{className:"".concat(r,"-input"),ref:C,onChange:g,disabled:s,checked:!!I,type:d})),l.createElement("span",{className:"".concat(r,"-inner")}))});const Af=function(t){if(!t)return!1;if(t instanceof Element){if(t.offsetParent)return!0;if(t.getBBox){var e=t.getBBox(),n=e.width,r=e.height;if(n||r)return!0}if(t.getBoundingClientRect){var i=t.getBoundingClientRect(),o=i.width,a=i.height;if(o||a)return!0}}return!1};function F1(t){return t&&N.isValidElement(t)&&t.type===N.Fragment}const k1=(t,e,n)=>N.isValidElement(t)?N.cloneElement(t,typeof n=="function"?n(t.props||{}):n):e;function kr(t,e){return k1(t,t,e)}const Z6=t=>{const{componentCls:e,colorPrimary:n}=t;return{[e]:{position:"absolute",background:"transparent",pointerEvents:"none",boxSizing:"border-box",color:`var(--wave-color, ${n})`,boxShadow:"0 0 0 0 currentcolor",opacity:.2,"&.wave-motion-appear":{transition:[`box-shadow 0.4s ${t.motionEaseOutCirc}`,`opacity 2s ${t.motionEaseOutCirc}`].join(","),"&-active":{boxShadow:"0 0 0 6px currentcolor",opacity:0},"&.wave-quick":{transition:[`box-shadow ${t.motionDurationSlow} ${t.motionEaseInOut}`,`opacity ${t.motionDurationSlow} ${t.motionEaseInOut}`].join(",")}}}}},K6=Hb("Wave",t=>[Z6(t)]),cf=`${Fa}-wave-target`;function P1(t,e){this.v=t,this.k=e}function Qn(t,e,n,r){var i=Object.defineProperty;try{i({},"",{})}catch{i=0}Qn=function(a,s,A,c){if(s)i?i(a,s,{value:A,enumerable:!c,configurable:!c,writable:!c}):a[s]=A;else{var u=function(f,p){Qn(a,f,function(v){return this._invoke(f,p,v)})};u("next",0),u("throw",1),u("return",2)}},Qn(t,e,n,r)}function lf(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var t,e,n=typeof Symbol=="function"?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(p,v,C,m){var y=v&&v.prototype instanceof s?v:s,w=Object.create(y.prototype);return Qn(w,"_invoke",function(I,O,x){var g,M,E,b=0,h=x||[],S=!1,T={p:0,n:0,v:t,a:R,f:R.bind(t,4),d:function(B,k){return g=B,M=0,E=t,T.n=k,a}};function R(D,B){for(M=D,E=B,e=0;!S&&b&&!k&&e<h.length;e++){var k,P=h[e],H=T.p,Z=P[2];D>3?(k=Z===B)&&(E=P[(M=P[4])?5:(M=3,3)],P[4]=P[5]=t):P[0]<=H&&((k=D<2&&H<P[1])?(M=0,T.v=B,T.n=P[1]):H<Z&&(k=D<3||P[0]>B||B>Z)&&(P[4]=D,P[5]=B,T.n=Z,M=0))}if(k||D>1)return a;throw S=!0,B}return function(D,B,k){if(b>1)throw TypeError("Generator is already running");for(S&&B===1&&R(B,k),M=B,E=k;(e=M<2?t:E)||!S;){g||(M?M<3?(M>1&&(T.n=-1),R(M,E)):T.n=E:T.v=E);try{if(b=2,g){if(M||(D="next"),e=g[D]){if(!(e=e.call(g,E)))throw TypeError("iterator result is not an object");if(!e.done)return e;E=e.value,M<2&&(M=0)}else M===1&&(e=g.return)&&e.call(g),M<2&&(E=TypeError("The iterator does not provide a '"+D+"' method"),M=1);g=t}else if((e=(S=T.n<0)?E:I.call(O,T))!==a)break}catch(P){g=t,M=1,E=P}finally{b=1}}return{value:e,done:S}}}(p,C,m),!0),w}var a={};function s(){}function A(){}function c(){}e=Object.getPrototypeOf;var u=[][r]?e(e([][r]())):(Qn(e={},r,function(){return this}),e),d=c.prototype=s.prototype=Object.create(u);function f(p){return Object.setPrototypeOf?Object.setPrototypeOf(p,c):(p.__proto__=c,Qn(p,i,"GeneratorFunction")),p.prototype=Object.create(d),p}return A.prototype=c,Qn(d,"constructor",c),Qn(c,"constructor",A),A.displayName="GeneratorFunction",Qn(c,i,"GeneratorFunction"),Qn(d),Qn(d,i,"Generator"),Qn(d,r,function(){return this}),Qn(d,"toString",function(){return"[object Generator]"}),(lf=function(){return{w:o,m:f}})()}function CA(t,e){function n(i,o,a,s){try{var A=t[i](o),c=A.value;return c instanceof P1?e.resolve(c.v).then(function(u){n("next",u,a,s)},function(u){n("throw",u,a,s)}):e.resolve(c).then(function(u){A.value=u,a(A)},function(u){return n("throw",u,a,s)})}catch(u){s(u)}}var r;this.next||(Qn(CA.prototype),Qn(CA.prototype,typeof Symbol=="function"&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),Qn(this,"_invoke",function(i,o,a){function s(){return new e(function(A,c){n(i,a,A,c)})}return r=r?r.then(s,s):s()},!0)}function Q1(t,e,n,r,i){return new CA(lf().w(t,e,n,r),i||Promise)}function V6(t,e,n,r,i){var o=Q1(t,e,n,r,i);return o.next().then(function(a){return a.done?a.value:o.next()})}function z6(t){var e=Object(t),n=[];for(var r in e)n.unshift(r);return function i(){for(;n.length;)if((r=n.pop())in e)return i.value=r,i.done=!1,i;return i.done=!0,i}}function Np(t){if(t!=null){var e=t[typeof Symbol=="function"&&Symbol.iterator||"@@iterator"],n=0;if(e)return e.call(t);if(typeof t.next=="function")return t;if(!isNaN(t.length))return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}}throw new TypeError(et(t)+" is not iterable")}function Un(){var t=lf(),e=t.m(Un),n=(Object.getPrototypeOf?Object.getPrototypeOf(e):e.__proto__).constructor;function r(a){var s=typeof a=="function"&&a.constructor;return!!s&&(s===n||(s.displayName||s.name)==="GeneratorFunction")}var i={throw:1,return:2,break:3,continue:3};function o(a){var s,A;return function(c){s||(s={stop:function(){return A(c.a,2)},catch:function(){return c.v},abrupt:function(d,f){return A(c.a,i[d],f)},delegateYield:function(d,f,p){return s.resultName=f,A(c.d,Np(d),p)},finish:function(d){return A(c.f,d)}},A=function(d,f,p){c.p=s.prev,c.n=s.next;try{return d(f,p)}finally{s.next=c.n}}),s.resultName&&(s[s.resultName]=c.v,s.resultName=void 0),s.sent=c.v,s.next=c.n;try{return a.call(this,s)}finally{c.p=s.prev,c.n=s.next}}}return(Un=function(){return{wrap:function(A,c,u,d){return t.w(o(A),c,u,d&&d.reverse())},isGeneratorFunction:r,mark:t.m,awrap:function(A,c){return new P1(A,c)},AsyncIterator:CA,async:function(A,c,u,d,f){return(r(c)?Q1:V6)(o(A),c,u,d,f)},keys:z6,values:Np}})()}function Dp(t,e,n,r,i,o,a){try{var s=t[o](a),A=s.value}catch(c){return void n(c)}s.done?e(A):Promise.resolve(A).then(r,i)}function fo(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function a(A){Dp(o,r,i,a,s,"next",A)}function s(A){Dp(o,r,i,a,s,"throw",A)}a(void 0)})}}var ns=L({},Jm),Y6=ns.version,tl=ns.render,W6=ns.unmountComponentAtNode,tc;try{var J6=Number((Y6||"").split(".")[0]);J6>=18&&(tc=ns.createRoot)}catch{}function Bp(t){var e=ns.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;e&&et(e)==="object"&&(e.usingClientEntryPoint=t)}var yA="__rc_react_root__";function _6(t,e){Bp(!0);var n=e[yA]||tc(e);Bp(!1),n.render(t),e[yA]=n}function $6(t,e){tl==null||tl(t,e)}function X6(t,e){if(tc){_6(t,e);return}$6(t,e)}function ex(t){return ed.apply(this,arguments)}function ed(){return ed=fo(Un().mark(function t(e){return Un().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",Promise.resolve().then(function(){var i;(i=e[yA])===null||i===void 0||i.unmount(),delete e[yA]}));case 1:case"end":return r.stop()}},t)})),ed.apply(this,arguments)}function tx(t){W6(t)}function nx(t){return td.apply(this,arguments)}function td(){return td=fo(Un().mark(function t(e){return Un().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(tc===void 0){r.next=2;break}return r.abrupt("return",ex(e));case 2:tx(e);case 3:case"end":return r.stop()}},t)})),td.apply(this,arguments)}const rx=(t,e)=>{if(process.env.NODE_ENV!=="production"){const n=parseInt(l.version.split(".")[0],10),r=Object.keys(Jm);process.env.NODE_ENV!=="production"&&exports.warning$1(n<19||r.includes("createRoot"),"compatible","antd v5 support React is 16 ~ 18. see https://u.ant.design/v5-for-19 for compatible.")}return X6(t,e),()=>nx(e)};let ix=rx;function uf(){return ix}function nl(t){return t&&t!=="#fff"&&t!=="#ffffff"&&t!=="rgb(255, 255, 255)"&&t!=="rgba(255, 255, 255, 1)"&&!/rgba\((?:\d*, ){3}0\)/.test(t)&&t!=="transparent"}function ox(t){const{borderTopColor:e,borderColor:n,backgroundColor:r}=getComputedStyle(t);return nl(e)?e:nl(n)?n:nl(r)?r:null}function rl(t){return Number.isNaN(t)?0:t}const ax=t=>{const{className:e,target:n,component:r,registerUnmount:i}=t,o=l.useRef(null),a=l.useRef(null);l.useEffect(()=>{a.current=i()},[]);const[s,A]=l.useState(null),[c,u]=l.useState([]),[d,f]=l.useState(0),[p,v]=l.useState(0),[C,m]=l.useState(0),[y,w]=l.useState(0),[I,O]=l.useState(!1),x={left:d,top:p,width:C,height:y,borderRadius:c.map(E=>`${E}px`).join(" ")};s&&(x["--wave-color"]=s);function g(){const E=getComputedStyle(n);A(ox(n));const b=E.position==="static",{borderLeftWidth:h,borderTopWidth:S}=E;f(b?n.offsetLeft:rl(-parseFloat(h))),v(b?n.offsetTop:rl(-parseFloat(S))),m(n.offsetWidth),w(n.offsetHeight);const{borderTopLeftRadius:T,borderTopRightRadius:R,borderBottomLeftRadius:D,borderBottomRightRadius:B}=E;u([T,R,B,D].map(k=>rl(parseFloat(k))))}if(l.useEffect(()=>{if(n){const E=qt(()=>{g(),O(!0)});let b;return typeof ResizeObserver<"u"&&(b=new ResizeObserver(g),b.observe(n)),()=>{qt.cancel(E),b==null||b.disconnect()}}},[]),!I)return null;const M=(r==="Checkbox"||r==="Radio")&&(n==null?void 0:n.classList.contains(cf));return l.createElement(lo,{visible:!0,motionAppear:!0,motionName:"wave-motion",motionDeadline:5e3,onAppearEnd:(E,b)=>{var h,S;if(b.deadline||b.propertyName==="opacity"){const T=(h=o.current)===null||h===void 0?void 0:h.parentElement;(S=a.current)===null||S===void 0||S.call(a).then(()=>{T==null||T.remove()})}return!1}},(E,b)=>{let{className:h}=E;return l.createElement("div",{ref:Lr(o,b),className:Ae(e,h,{"wave-quick":M}),style:x})})},sx=(t,e)=>{var n;const{component:r}=e;if(r==="Checkbox"&&!(!((n=t.querySelector("input"))===null||n===void 0)&&n.checked))return;const i=document.createElement("div");i.style.position="absolute",i.style.left="0px",i.style.top="0px",t==null||t.insertBefore(i,t==null?void 0:t.firstChild);const o=uf();let a=null;function s(){return a}a=o(l.createElement(ax,Object.assign({},e,{target:t,registerUnmount:s})),i)},Ax=(t,e,n)=>{const{wave:r}=l.useContext(Qt),[,i,o]=dr(),a=rn(c=>{const u=t.current;if(r!=null&&r.disabled||!u)return;const d=u.querySelector(`.${cf}`)||u,{showEffect:f}=r||{};(f||sx)(d,{className:e,token:i,component:n,event:c,hashId:o})}),s=l.useRef(null);return c=>{qt.cancel(s.current),s.current=qt(()=>{a(c)})}},nc=t=>{const{children:e,disabled:n,component:r}=t,{getPrefixCls:i}=N.useContext(Qt),o=N.useRef(null),a=i("wave"),[,s]=K6(a),A=Ax(o,Ae(a,s),r);if(N.useEffect(()=>{const u=o.current;if(!u||u.nodeType!==1||n)return;const d=f=>{!Af(f.target)||!u.getAttribute||u.getAttribute("disabled")||u.disabled||u.className.includes("disabled")||u.className.includes("-leave")||A(f)};return u.addEventListener("click",d,!0),()=>{u.removeEventListener("click",d,!0)}},[n]),!N.isValidElement(e))return e??null;const c=Li(e)?Lr(co(e),o):o;return kr(e,{ref:c})};process.env.NODE_ENV!=="production"&&(nc.displayName="Wave");function cx(t){const e=N.useRef(null),n=()=>{qt.cancel(e.current),e.current=null};return[()=>{n(),e.current=qt(()=>{e.current=null})},o=>{e.current&&(o.stopPropagation(),n()),t==null||t(o)}]}function Pr(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=[];return N.Children.forEach(t,function(r){r==null&&!e.keepEmpty||(Array.isArray(r)?n=n.concat(Pr(r)):xv(r)&&r.props?n=n.concat(Pr(r.props.children,e)):n.push(r))}),n}var Ji="RC_FORM_INTERNAL_HOOKS",Yt=function(){yt(!1,"Can not find FormContext. Please make sure you wrap Field under Form.")},Yo=l.createContext({getFieldValue:Yt,getFieldsValue:Yt,getFieldError:Yt,getFieldWarning:Yt,getFieldsError:Yt,isFieldsTouched:Yt,isFieldTouched:Yt,isFieldValidating:Yt,isFieldsValidating:Yt,resetFields:Yt,setFields:Yt,setFieldValue:Yt,setFieldsValue:Yt,validateFields:Yt,submit:Yt,getInternalHooks:function(){return Yt(),{dispatch:Yt,initEntityValue:Yt,registerField:Yt,useSubscribe:Yt,setInitialValues:Yt,destroyForm:Yt,setCallbacks:Yt,registerWatch:Yt,getFields:Yt,setValidateMessages:Yt,setPreserve:Yt,getInitialValue:Yt}}}),EA=l.createContext(null);function nd(t){return t==null?[]:Array.isArray(t)?t:[t]}function lx(t){return t&&!!t._init}function rd(){return{default:"Validation error on field %s",required:"%s is required",enum:"%s must be one of %s",whitespace:"%s cannot be empty",date:{format:"%s date %s is invalid for format %s",parse:"%s date could not be parsed, %s is invalid ",invalid:"%s date %s is invalid"},types:{string:"%s is not a %s",method:"%s is not a %s (function)",array:"%s is not an %s",object:"%s is not an %s",number:"%s is not a %s",date:"%s is not a %s",boolean:"%s is not a %s",integer:"%s is not an %s",float:"%s is not a %s",regexp:"%s is not a valid %s",email:"%s is not a valid %s",url:"%s is not a valid %s",hex:"%s is not a valid %s"},string:{len:"%s must be exactly %s characters",min:"%s must be at least %s characters",max:"%s cannot be longer than %s characters",range:"%s must be between %s and %s characters"},number:{len:"%s must equal %s",min:"%s cannot be less than %s",max:"%s cannot be greater than %s",range:"%s must be between %s and %s"},array:{len:"%s must be exactly %s in length",min:"%s cannot be less than %s in length",max:"%s cannot be greater than %s in length",range:"%s must be between %s and %s in length"},pattern:{mismatch:"%s value %s does not match pattern %s"},clone:function(){var e=JSON.parse(JSON.stringify(this));return e.clone=this.clone,e}}}var id=rd();function ux(t){try{return Function.toString.call(t).indexOf("[native code]")!==-1}catch{return typeof t=="function"}}function dx(t,e,n){if(Dd())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var i=new(t.bind.apply(t,r));return n&&Ma(i,n.prototype),i}function od(t){var e=typeof Map=="function"?new Map:void 0;return od=function(r){if(r===null||!ux(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(e!==void 0){if(e.has(r))return e.get(r);e.set(r,i)}function i(){return dx(r,arguments,Ta(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Ma(i,r)},od(t)}var fx=/%[sdj%]/g,j1=function(){};typeof process<"u"&&process.env&&process.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof document<"u"&&(j1=function(e,n){typeof console<"u"&&console.warn&&typeof ASYNC_VALIDATOR_NO_WARNING>"u"&&n.every(function(r){return typeof r=="string"})&&console.warn(e,n)});function ad(t){if(!t||!t.length)return null;var e={};return t.forEach(function(n){var r=n.field;e[r]=e[r]||[],e[r].push(n)}),e}function lr(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];var i=0,o=n.length;if(typeof t=="function")return t.apply(null,n);if(typeof t=="string"){var a=t.replace(fx,function(s){if(s==="%%")return"%";if(i>=o)return s;switch(s){case"%s":return String(n[i++]);case"%d":return Number(n[i++]);case"%j":try{return JSON.stringify(n[i++])}catch{return"[Circular]"}break;default:return s}});return a}return t}function gx(t){return t==="string"||t==="url"||t==="hex"||t==="email"||t==="date"||t==="pattern"}function bn(t,e){return!!(t==null||e==="array"&&Array.isArray(t)&&!t.length||gx(e)&&typeof t=="string"&&!t)}function hx(t,e,n){var r=[],i=0,o=t.length;function a(s){r.push.apply(r,Re(s||[])),i++,i===o&&n(r)}t.forEach(function(s){e(s,a)})}function Fp(t,e,n){var r=0,i=t.length;function o(a){if(a&&a.length){n(a);return}var s=r;r=r+1,s<i?e(t[s],o):n([])}o([])}function px(t){var e=[];return Object.keys(t).forEach(function(n){e.push.apply(e,Re(t[n]||[]))}),e}var kp=function(t){fi(n,t);var e=gi(n);function n(r,i){var o;return pn(this,n),o=e.call(this,"Async Validation Error"),Q(Ot(o),"errors",void 0),Q(Ot(o),"fields",void 0),o.errors=r,o.fields=i,o}return mn(n)}(od(Error));function mx(t,e,n,r,i){if(e.first){var o=new Promise(function(f,p){var v=function(y){return r(y),y.length?p(new kp(y,ad(y))):f(i)},C=px(t);Fp(C,n,v)});return o.catch(function(f){return f}),o}var a=e.firstFields===!0?Object.keys(t):e.firstFields||[],s=Object.keys(t),A=s.length,c=0,u=[],d=new Promise(function(f,p){var v=function(m){if(u.push.apply(u,m),c++,c===A)return r(u),u.length?p(new kp(u,ad(u))):f(i)};s.length||(r(u),f(i)),s.forEach(function(C){var m=t[C];a.indexOf(C)!==-1?Fp(m,n,v):hx(m,n,v)})});return d.catch(function(f){return f}),d}function vx(t){return!!(t&&t.message!==void 0)}function Cx(t,e){for(var n=t,r=0;r<e.length;r++){if(n==null)return n;n=n[e[r]]}return n}function Pp(t,e){return function(n){var r;return t.fullFields?r=Cx(e,t.fullFields):r=e[n.field||t.fullField],vx(n)?(n.field=n.field||t.fullField,n.fieldValue=r,n):{message:typeof n=="function"?n():n,fieldValue:r,field:n.field||t.fullField}}}function Qp(t,e){if(e){for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];et(r)==="object"&&et(t[n])==="object"?t[n]=L(L({},t[n]),r):t[n]=r}}return t}var vo="enum",yx=function(e,n,r,i,o){e[vo]=Array.isArray(e[vo])?e[vo]:[],e[vo].indexOf(n)===-1&&i.push(lr(o.messages[vo],e.fullField,e[vo].join(", ")))},Ex=function(e,n,r,i,o){if(e.pattern){if(e.pattern instanceof RegExp)e.pattern.lastIndex=0,e.pattern.test(n)||i.push(lr(o.messages.pattern.mismatch,e.fullField,n,e.pattern));else if(typeof e.pattern=="string"){var a=new RegExp(e.pattern);a.test(n)||i.push(lr(o.messages.pattern.mismatch,e.fullField,n,e.pattern))}}},bx=function(e,n,r,i,o){var a=typeof e.len=="number",s=typeof e.min=="number",A=typeof e.max=="number",c=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,u=n,d=null,f=typeof n=="number",p=typeof n=="string",v=Array.isArray(n);if(f?d="number":p?d="string":v&&(d="array"),!d)return!1;v&&(u=n.length),p&&(u=n.replace(c,"_").length),a?u!==e.len&&i.push(lr(o.messages[d].len,e.fullField,e.len)):s&&!A&&u<e.min?i.push(lr(o.messages[d].min,e.fullField,e.min)):A&&!s&&u>e.max?i.push(lr(o.messages[d].max,e.fullField,e.max)):s&&A&&(u<e.min||u>e.max)&&i.push(lr(o.messages[d].range,e.fullField,e.min,e.max))},L1=function(e,n,r,i,o,a){e.required&&(!r.hasOwnProperty(e.field)||bn(n,a||e.type))&&i.push(lr(o.messages.required,e.fullField))},Fs;const Sx=function(){if(Fs)return Fs;var t="[a-fA-F\\d:]",e=function(g){return g&&g.includeBoundaries?"(?:(?<=\\s|^)(?=".concat(t,")|(?<=").concat(t,")(?=\\s|$))"):""},n="(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}",r="[a-fA-F\\d]{1,4}",i=["(?:".concat(r,":){7}(?:").concat(r,"|:)"),"(?:".concat(r,":){6}(?:").concat(n,"|:").concat(r,"|:)"),"(?:".concat(r,":){5}(?::").concat(n,"|(?::").concat(r,"){1,2}|:)"),"(?:".concat(r,":){4}(?:(?::").concat(r,"){0,1}:").concat(n,"|(?::").concat(r,"){1,3}|:)"),"(?:".concat(r,":){3}(?:(?::").concat(r,"){0,2}:").concat(n,"|(?::").concat(r,"){1,4}|:)"),"(?:".concat(r,":){2}(?:(?::").concat(r,"){0,3}:").concat(n,"|(?::").concat(r,"){1,5}|:)"),"(?:".concat(r,":){1}(?:(?::").concat(r,"){0,4}:").concat(n,"|(?::").concat(r,"){1,6}|:)"),"(?::(?:(?::".concat(r,"){0,5}:").concat(n,"|(?::").concat(r,"){1,7}|:))")],o="(?:%[0-9a-zA-Z]{1,})?",a="(?:".concat(i.join("|"),")").concat(o),s=new RegExp("(?:^".concat(n,"$)|(?:^").concat(a,"$)")),A=new RegExp("^".concat(n,"$")),c=new RegExp("^".concat(a,"$")),u=function(g){return g&&g.exact?s:new RegExp("(?:".concat(e(g)).concat(n).concat(e(g),")|(?:").concat(e(g)).concat(a).concat(e(g),")"),"g")};u.v4=function(x){return x&&x.exact?A:new RegExp("".concat(e(x)).concat(n).concat(e(x)),"g")},u.v6=function(x){return x&&x.exact?c:new RegExp("".concat(e(x)).concat(a).concat(e(x)),"g")};var d="(?:(?:[a-z]+:)?//)",f="(?:\\S+(?::\\S*)?@)?",p=u.v4().source,v=u.v6().source,C="(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)",m="(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*",y="(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))",w="(?::\\d{2,5})?",I='(?:[/?#][^\\s"]*)?',O="(?:".concat(d,"|www\\.)").concat(f,"(?:localhost|").concat(p,"|").concat(v,"|").concat(C).concat(m).concat(y,")").concat(w).concat(I);return Fs=new RegExp("(?:^".concat(O,"$)"),"i"),Fs};var jp={email:/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/,hex:/^#?([a-f0-9]{6}|[a-f0-9]{3})$/i},va={integer:function(e){return va.number(e)&&parseInt(e,10)===e},float:function(e){return va.number(e)&&!va.integer(e)},array:function(e){return Array.isArray(e)},regexp:function(e){if(e instanceof RegExp)return!0;try{return!!new RegExp(e)}catch{return!1}},date:function(e){return typeof e.getTime=="function"&&typeof e.getMonth=="function"&&typeof e.getYear=="function"&&!isNaN(e.getTime())},number:function(e){return isNaN(e)?!1:typeof e=="number"},object:function(e){return et(e)==="object"&&!va.array(e)},method:function(e){return typeof e=="function"},email:function(e){return typeof e=="string"&&e.length<=320&&!!e.match(jp.email)},url:function(e){return typeof e=="string"&&e.length<=2048&&!!e.match(Sx())},hex:function(e){return typeof e=="string"&&!!e.match(jp.hex)}},wx=function(e,n,r,i,o){if(e.required&&n===void 0){L1(e,n,r,i,o);return}var a=["integer","float","array","regexp","object","method","email","number","date","url","hex"],s=e.type;a.indexOf(s)>-1?va[s](n)||i.push(lr(o.messages.types[s],e.fullField,e.type)):s&&et(n)!==e.type&&i.push(lr(o.messages.types[s],e.fullField,e.type))},Ix=function(e,n,r,i,o){(/^\s+$/.test(n)||n==="")&&i.push(lr(o.messages.whitespace,e.fullField))};const Dt={required:L1,whitespace:Ix,type:wx,range:bx,enum:yx,pattern:Ex};var xx=function(e,n,r,i,o){var a=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(bn(n)&&!e.required)return r();Dt.required(e,n,i,a,o)}r(a)},Rx=function(e,n,r,i,o){var a=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(n==null&&!e.required)return r();Dt.required(e,n,i,a,o,"array"),n!=null&&(Dt.type(e,n,i,a,o),Dt.range(e,n,i,a,o))}r(a)},Ox=function(e,n,r,i,o){var a=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(bn(n)&&!e.required)return r();Dt.required(e,n,i,a,o),n!==void 0&&Dt.type(e,n,i,a,o)}r(a)},Mx=function(e,n,r,i,o){var a=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(bn(n,"date")&&!e.required)return r();if(Dt.required(e,n,i,a,o),!bn(n,"date")){var A;n instanceof Date?A=n:A=new Date(n),Dt.type(e,A,i,a,o),A&&Dt.range(e,A.getTime(),i,a,o)}}r(a)},Tx="enum",Nx=function(e,n,r,i,o){var a=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(bn(n)&&!e.required)return r();Dt.required(e,n,i,a,o),n!==void 0&&Dt[Tx](e,n,i,a,o)}r(a)},Dx=function(e,n,r,i,o){var a=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(bn(n)&&!e.required)return r();Dt.required(e,n,i,a,o),n!==void 0&&(Dt.type(e,n,i,a,o),Dt.range(e,n,i,a,o))}r(a)},Bx=function(e,n,r,i,o){var a=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(bn(n)&&!e.required)return r();Dt.required(e,n,i,a,o),n!==void 0&&(Dt.type(e,n,i,a,o),Dt.range(e,n,i,a,o))}r(a)},Fx=function(e,n,r,i,o){var a=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(bn(n)&&!e.required)return r();Dt.required(e,n,i,a,o),n!==void 0&&Dt.type(e,n,i,a,o)}r(a)},kx=function(e,n,r,i,o){var a=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(n===""&&(n=void 0),bn(n)&&!e.required)return r();Dt.required(e,n,i,a,o),n!==void 0&&(Dt.type(e,n,i,a,o),Dt.range(e,n,i,a,o))}r(a)},Px=function(e,n,r,i,o){var a=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(bn(n)&&!e.required)return r();Dt.required(e,n,i,a,o),n!==void 0&&Dt.type(e,n,i,a,o)}r(a)},Qx=function(e,n,r,i,o){var a=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(bn(n,"string")&&!e.required)return r();Dt.required(e,n,i,a,o),bn(n,"string")||Dt.pattern(e,n,i,a,o)}r(a)},jx=function(e,n,r,i,o){var a=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(bn(n)&&!e.required)return r();Dt.required(e,n,i,a,o),bn(n)||Dt.type(e,n,i,a,o)}r(a)},Lx=function(e,n,r,i,o){var a=[],s=Array.isArray(n)?"array":et(n);Dt.required(e,n,i,a,o,s),r(a)},Ux=function(e,n,r,i,o){var a=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(bn(n,"string")&&!e.required)return r();Dt.required(e,n,i,a,o,"string"),bn(n,"string")||(Dt.type(e,n,i,a,o),Dt.range(e,n,i,a,o),Dt.pattern(e,n,i,a,o),e.whitespace===!0&&Dt.whitespace(e,n,i,a,o))}r(a)},il=function(e,n,r,i,o){var a=e.type,s=[],A=e.required||!e.required&&i.hasOwnProperty(e.field);if(A){if(bn(n,a)&&!e.required)return r();Dt.required(e,n,i,s,o,a),bn(n,a)||Dt.type(e,n,i,s,o)}r(s)};const Sa={string:Ux,method:Fx,number:kx,boolean:Ox,regexp:jx,integer:Bx,float:Dx,array:Rx,object:Px,enum:Nx,pattern:Qx,date:Mx,url:il,hex:il,email:il,required:Lx,any:xx};var rs=function(){function t(e){pn(this,t),Q(this,"rules",null),Q(this,"_messages",id),this.define(e)}return mn(t,[{key:"define",value:function(n){var r=this;if(!n)throw new Error("Cannot configure a schema with no rules");if(et(n)!=="object"||Array.isArray(n))throw new Error("Rules must be an object");this.rules={},Object.keys(n).forEach(function(i){var o=n[i];r.rules[i]=Array.isArray(o)?o:[o]})}},{key:"messages",value:function(n){return n&&(this._messages=Qp(rd(),n)),this._messages}},{key:"validate",value:function(n){var r=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){},a=n,s=i,A=o;if(typeof s=="function"&&(A=s,s={}),!this.rules||Object.keys(this.rules).length===0)return A&&A(null,a),Promise.resolve(a);function c(v){var C=[],m={};function y(I){if(Array.isArray(I)){var O;C=(O=C).concat.apply(O,Re(I))}else C.push(I)}for(var w=0;w<v.length;w++)y(v[w]);C.length?(m=ad(C),A(C,m)):A(null,a)}if(s.messages){var u=this.messages();u===id&&(u=rd()),Qp(u,s.messages),s.messages=u}else s.messages=this.messages();var d={},f=s.keys||Object.keys(this.rules);f.forEach(function(v){var C=r.rules[v],m=a[v];C.forEach(function(y){var w=y;typeof w.transform=="function"&&(a===n&&(a=L({},a)),m=a[v]=w.transform(m),m!=null&&(w.type=w.type||(Array.isArray(m)?"array":et(m)))),typeof w=="function"?w={validator:w}:w=L({},w),w.validator=r.getValidationMethod(w),w.validator&&(w.field=v,w.fullField=w.fullField||v,w.type=r.getType(w),d[v]=d[v]||[],d[v].push({rule:w,value:m,source:a,field:v}))})});var p={};return mx(d,s,function(v,C){var m=v.rule,y=(m.type==="object"||m.type==="array")&&(et(m.fields)==="object"||et(m.defaultField)==="object");y=y&&(m.required||!m.required&&v.value),m.field=v.field;function w(M,E){return L(L({},E),{},{fullField:"".concat(m.fullField,".").concat(M),fullFields:m.fullFields?[].concat(Re(m.fullFields),[M]):[M]})}function I(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],E=Array.isArray(M)?M:[M];!s.suppressWarning&&E.length&&t.warning("async-validator:",E),E.length&&m.message!==void 0&&(E=[].concat(m.message));var b=E.map(Pp(m,a));if(s.first&&b.length)return p[m.field]=1,C(b);if(!y)C(b);else{if(m.required&&!v.value)return m.message!==void 0?b=[].concat(m.message).map(Pp(m,a)):s.error&&(b=[s.error(m,lr(s.messages.required,m.field))]),C(b);var h={};m.defaultField&&Object.keys(v.value).map(function(R){h[R]=m.defaultField}),h=L(L({},h),v.rule.fields);var S={};Object.keys(h).forEach(function(R){var D=h[R],B=Array.isArray(D)?D:[D];S[R]=B.map(w.bind(null,R))});var T=new t(S);T.messages(s.messages),v.rule.options&&(v.rule.options.messages=s.messages,v.rule.options.error=s.error),T.validate(v.value,v.rule.options||s,function(R){var D=[];b&&b.length&&D.push.apply(D,Re(b)),R&&R.length&&D.push.apply(D,Re(R)),C(D.length?D:null)})}}var O;if(m.asyncValidator)O=m.asyncValidator(m,v.value,I,v.source,s);else if(m.validator){try{O=m.validator(m,v.value,I,v.source,s)}catch(M){var x,g;(x=(g=console).error)===null||x===void 0||x.call(g,M),s.suppressValidatorError||setTimeout(function(){throw M},0),I(M.message)}O===!0?I():O===!1?I(typeof m.message=="function"?m.message(m.fullField||m.field):m.message||"".concat(m.fullField||m.field," fails")):O instanceof Array?I(O):O instanceof Error&&I(O.message)}O&&O.then&&O.then(function(){return I()},function(M){return I(M)})},function(v){c(v)},a)}},{key:"getType",value:function(n){if(n.type===void 0&&n.pattern instanceof RegExp&&(n.type="pattern"),typeof n.validator!="function"&&n.type&&!Sa.hasOwnProperty(n.type))throw new Error(lr("Unknown rule type %s",n.type));return n.type||"string"}},{key:"getValidationMethod",value:function(n){if(typeof n.validator=="function")return n.validator;var r=Object.keys(n),i=r.indexOf("message");return i!==-1&&r.splice(i,1),r.length===1&&r[0]==="required"?Sa.required:Sa[this.getType(n)]||void 0}}]),t}();Q(rs,"register",function(e,n){if(typeof n!="function")throw new Error("Cannot register a validator by type, validator is not a function");Sa[e]=n});Q(rs,"warning",j1);Q(rs,"messages",id);Q(rs,"validators",Sa);var or="'${name}' is not a valid ${type}",U1={default:"Validation error on field '${name}'",required:"'${name}' is required",enum:"'${name}' must be one of [${enum}]",whitespace:"'${name}' cannot be empty",date:{format:"'${name}' is invalid for format date",parse:"'${name}' could not be parsed as date",invalid:"'${name}' is invalid date"},types:{string:or,method:or,array:or,object:or,number:or,date:or,boolean:or,integer:or,float:or,regexp:or,email:or,url:or,hex:or},string:{len:"'${name}' must be exactly ${len} characters",min:"'${name}' must be at least ${min} characters",max:"'${name}' cannot be longer than ${max} characters",range:"'${name}' must be between ${min} and ${max} characters"},number:{len:"'${name}' must equal ${len}",min:"'${name}' cannot be less than ${min}",max:"'${name}' cannot be greater than ${max}",range:"'${name}' must be between ${min} and ${max}"},array:{len:"'${name}' must be exactly ${len} in length",min:"'${name}' cannot be less than ${min} in length",max:"'${name}' cannot be greater than ${max} in length",range:"'${name}' must be between ${min} and ${max} in length"},pattern:{mismatch:"'${name}' does not match pattern ${pattern}"}},Lp=rs;function Hx(t,e){return t.replace(/\\?\$\{\w+\}/g,function(n){if(n.startsWith("\\"))return n.slice(1);var r=n.slice(2,-1);return e[r]})}var Up="CODE_LOGIC_ERROR";function sd(t,e,n,r,i){return Ad.apply(this,arguments)}function Ad(){return Ad=fo(Un().mark(function t(e,n,r,i,o){var a,s,A,c,u,d,f,p,v;return Un().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:return a=L({},r),delete a.ruleIndex,Lp.warning=function(){},a.validator&&(s=a.validator,a.validator=function(){try{return s.apply(void 0,arguments)}catch(y){return console.error(y),Promise.reject(Up)}}),A=null,a&&a.type==="array"&&a.defaultField&&(A=a.defaultField,delete a.defaultField),c=new Lp(Q({},e,[a])),u=Ro(U1,i.validateMessages),c.messages(u),d=[],m.prev=10,m.next=13,Promise.resolve(c.validate(Q({},e,n),L({},i)));case 13:m.next=18;break;case 15:m.prev=15,m.t0=m.catch(10),m.t0.errors&&(d=m.t0.errors.map(function(y,w){var I=y.message,O=I===Up?u.default:I;return l.isValidElement(O)?l.cloneElement(O,{key:"error_".concat(w)}):O}));case 18:if(!(!d.length&&A)){m.next=23;break}return m.next=21,Promise.all(n.map(function(y,w){return sd("".concat(e,".").concat(w),y,A,i,o)}));case 21:return f=m.sent,m.abrupt("return",f.reduce(function(y,w){return[].concat(Re(y),Re(w))},[]));case 23:return p=L(L({},r),{},{name:e,enum:(r.enum||[]).join(", ")},o),v=d.map(function(y){return typeof y=="string"?Hx(y,p):y}),m.abrupt("return",v);case 26:case"end":return m.stop()}},t,null,[[10,15]])})),Ad.apply(this,arguments)}function Gx(t,e,n,r,i,o){var a=t.join("."),s=n.map(function(u,d){var f=u.validator,p=L(L({},u),{},{ruleIndex:d});return f&&(p.validator=function(v,C,m){var y=!1,w=function(){for(var x=arguments.length,g=new Array(x),M=0;M<x;M++)g[M]=arguments[M];Promise.resolve().then(function(){yt(!y,"Your validator function has already return a promise. `callback` will be ignored."),y||m.apply(void 0,g)})},I=f(v,C,w);y=I&&typeof I.then=="function"&&typeof I.catch=="function",yt(y,"`callback` is deprecated. Please return a promise instead."),y&&I.then(function(){m()}).catch(function(O){m(O||" ")})}),p}).sort(function(u,d){var f=u.warningOnly,p=u.ruleIndex,v=d.warningOnly,C=d.ruleIndex;return!!f==!!v?p-C:f?1:-1}),A;if(i===!0)A=new Promise(function(){var u=fo(Un().mark(function d(f,p){var v,C,m;return Un().wrap(function(w){for(;;)switch(w.prev=w.next){case 0:v=0;case 1:if(!(v<s.length)){w.next=12;break}return C=s[v],w.next=5,sd(a,e,C,r,o);case 5:if(m=w.sent,!m.length){w.next=9;break}return p([{errors:m,rule:C}]),w.abrupt("return");case 9:v+=1,w.next=1;break;case 12:f([]);case 13:case"end":return w.stop()}},d)}));return function(d,f){return u.apply(this,arguments)}}());else{var c=s.map(function(u){return sd(a,e,u,r,o).then(function(d){return{errors:d,rule:u}})});A=(i?Zx(c):qx(c)).then(function(u){return Promise.reject(u)})}return A.catch(function(u){return u}),A}function qx(t){return cd.apply(this,arguments)}function cd(){return cd=fo(Un().mark(function t(e){return Un().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",Promise.all(e).then(function(i){var o,a=(o=[]).concat.apply(o,Re(i));return a}));case 1:case"end":return r.stop()}},t)})),cd.apply(this,arguments)}function Zx(t){return ld.apply(this,arguments)}function ld(){return ld=fo(Un().mark(function t(e){var n;return Un().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return n=0,i.abrupt("return",new Promise(function(o){e.forEach(function(a){a.then(function(s){s.errors.length&&o([s]),n+=1,n===e.length&&o([])})})}));case 2:case"end":return i.stop()}},t)})),ld.apply(this,arguments)}function dn(t){return nd(t)}function Hp(t,e){var n={};return e.forEach(function(r){var i=zr(t,r);n=Mr(n,r,i)}),n}function Fo(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return t&&t.some(function(r){return H1(e,r,n)})}function H1(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return!t||!e||!n&&t.length!==e.length?!1:e.every(function(r,i){return t[i]===r})}function Kx(t,e){if(t===e)return!0;if(!t&&e||t&&!e||!t||!e||et(t)!=="object"||et(e)!=="object")return!1;var n=Object.keys(t),r=Object.keys(e),i=new Set([].concat(n,r));return Re(i).every(function(o){var a=t[o],s=e[o];return typeof a=="function"&&typeof s=="function"?!0:a===s})}function Vx(t){var e=arguments.length<=1?void 0:arguments[1];return e&&e.target&&et(e.target)==="object"&&t in e.target?e.target[t]:e}function Gp(t,e,n){var r=t.length;if(e<0||e>=r||n<0||n>=r)return t;var i=t[e],o=e-n;return o>0?[].concat(Re(t.slice(0,n)),[i],Re(t.slice(n,e)),Re(t.slice(e+1,r))):o<0?[].concat(Re(t.slice(0,e)),Re(t.slice(e+1,n+1)),[i],Re(t.slice(n+1,r))):t}var zx=["name"],Cr=[];function ol(t,e,n,r,i,o){return typeof t=="function"?t(e,n,"source"in o?{source:o.source}:{}):r!==i}var df=function(t){fi(n,t);var e=gi(n);function n(r){var i;if(pn(this,n),i=e.call(this,r),Q(Ot(i),"state",{resetCount:0}),Q(Ot(i),"cancelRegisterFunc",null),Q(Ot(i),"mounted",!1),Q(Ot(i),"touched",!1),Q(Ot(i),"dirty",!1),Q(Ot(i),"validatePromise",void 0),Q(Ot(i),"prevValidating",void 0),Q(Ot(i),"errors",Cr),Q(Ot(i),"warnings",Cr),Q(Ot(i),"cancelRegister",function(){var A=i.props,c=A.preserve,u=A.isListField,d=A.name;i.cancelRegisterFunc&&i.cancelRegisterFunc(u,c,dn(d)),i.cancelRegisterFunc=null}),Q(Ot(i),"getNamePath",function(){var A=i.props,c=A.name,u=A.fieldContext,d=u.prefixName,f=d===void 0?[]:d;return c!==void 0?[].concat(Re(f),Re(c)):[]}),Q(Ot(i),"getRules",function(){var A=i.props,c=A.rules,u=c===void 0?[]:c,d=A.fieldContext;return u.map(function(f){return typeof f=="function"?f(d):f})}),Q(Ot(i),"refresh",function(){i.mounted&&i.setState(function(A){var c=A.resetCount;return{resetCount:c+1}})}),Q(Ot(i),"metaCache",null),Q(Ot(i),"triggerMetaEvent",function(A){var c=i.props.onMetaChange;if(c){var u=L(L({},i.getMeta()),{},{destroy:A});Oa(i.metaCache,u)||c(u),i.metaCache=u}else i.metaCache=null}),Q(Ot(i),"onStoreChange",function(A,c,u){var d=i.props,f=d.shouldUpdate,p=d.dependencies,v=p===void 0?[]:p,C=d.onReset,m=u.store,y=i.getNamePath(),w=i.getValue(A),I=i.getValue(m),O=c&&Fo(c,y);switch(u.type==="valueUpdate"&&u.source==="external"&&!Oa(w,I)&&(i.touched=!0,i.dirty=!0,i.validatePromise=null,i.errors=Cr,i.warnings=Cr,i.triggerMetaEvent()),u.type){case"reset":if(!c||O){i.touched=!1,i.dirty=!1,i.validatePromise=void 0,i.errors=Cr,i.warnings=Cr,i.triggerMetaEvent(),C==null||C(),i.refresh();return}break;case"remove":{if(f&&ol(f,A,m,w,I,u)){i.reRender();return}break}case"setField":{var x=u.data;if(O){"touched"in x&&(i.touched=x.touched),"validating"in x&&!("originRCField"in x)&&(i.validatePromise=x.validating?Promise.resolve([]):null),"errors"in x&&(i.errors=x.errors||Cr),"warnings"in x&&(i.warnings=x.warnings||Cr),i.dirty=!0,i.triggerMetaEvent(),i.reRender();return}else if("value"in x&&Fo(c,y,!0)){i.reRender();return}if(f&&!y.length&&ol(f,A,m,w,I,u)){i.reRender();return}break}case"dependenciesUpdate":{var g=v.map(dn);if(g.some(function(M){return Fo(u.relatedFields,M)})){i.reRender();return}break}default:if(O||(!v.length||y.length||f)&&ol(f,A,m,w,I,u)){i.reRender();return}break}f===!0&&i.reRender()}),Q(Ot(i),"validateRules",function(A){var c=i.getNamePath(),u=i.getValue(),d=A||{},f=d.triggerName,p=d.validateOnly,v=p===void 0?!1:p,C=Promise.resolve().then(fo(Un().mark(function m(){var y,w,I,O,x,g,M;return Un().wrap(function(b){for(;;)switch(b.prev=b.next){case 0:if(i.mounted){b.next=2;break}return b.abrupt("return",[]);case 2:if(y=i.props,w=y.validateFirst,I=w===void 0?!1:w,O=y.messageVariables,x=y.validateDebounce,g=i.getRules(),f&&(g=g.filter(function(h){return h}).filter(function(h){var S=h.validateTrigger;if(!S)return!0;var T=nd(S);return T.includes(f)})),!(x&&f)){b.next=10;break}return b.next=8,new Promise(function(h){setTimeout(h,x)});case 8:if(i.validatePromise===C){b.next=10;break}return b.abrupt("return",[]);case 10:return M=Gx(c,u,g,A,I,O),M.catch(function(h){return h}).then(function(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Cr;if(i.validatePromise===C){var S;i.validatePromise=null;var T=[],R=[];(S=h.forEach)===null||S===void 0||S.call(h,function(D){var B=D.rule.warningOnly,k=D.errors,P=k===void 0?Cr:k;B?R.push.apply(R,Re(P)):T.push.apply(T,Re(P))}),i.errors=T,i.warnings=R,i.triggerMetaEvent(),i.reRender()}}),b.abrupt("return",M);case 13:case"end":return b.stop()}},m)})));return v||(i.validatePromise=C,i.dirty=!0,i.errors=Cr,i.warnings=Cr,i.triggerMetaEvent(),i.reRender()),C}),Q(Ot(i),"isFieldValidating",function(){return!!i.validatePromise}),Q(Ot(i),"isFieldTouched",function(){return i.touched}),Q(Ot(i),"isFieldDirty",function(){if(i.dirty||i.props.initialValue!==void 0)return!0;var A=i.props.fieldContext,c=A.getInternalHooks(Ji),u=c.getInitialValue;return u(i.getNamePath())!==void 0}),Q(Ot(i),"getErrors",function(){return i.errors}),Q(Ot(i),"getWarnings",function(){return i.warnings}),Q(Ot(i),"isListField",function(){return i.props.isListField}),Q(Ot(i),"isList",function(){return i.props.isList}),Q(Ot(i),"isPreserve",function(){return i.props.preserve}),Q(Ot(i),"getMeta",function(){i.prevValidating=i.isFieldValidating();var A={touched:i.isFieldTouched(),validating:i.prevValidating,errors:i.errors,warnings:i.warnings,name:i.getNamePath(),validated:i.validatePromise===null};return A}),Q(Ot(i),"getOnlyChild",function(A){if(typeof A=="function"){var c=i.getMeta();return L(L({},i.getOnlyChild(A(i.getControlled(),c,i.props.fieldContext))),{},{isFunction:!0})}var u=Pr(A);return u.length!==1||!l.isValidElement(u[0])?{child:u,isFunction:!1}:{child:u[0],isFunction:!1}}),Q(Ot(i),"getValue",function(A){var c=i.props.fieldContext.getFieldsValue,u=i.getNamePath();return zr(A||c(!0),u)}),Q(Ot(i),"getControlled",function(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},c=i.props,u=c.name,d=c.trigger,f=c.validateTrigger,p=c.getValueFromEvent,v=c.normalize,C=c.valuePropName,m=c.getValueProps,y=c.fieldContext,w=f!==void 0?f:y.validateTrigger,I=i.getNamePath(),O=y.getInternalHooks,x=y.getFieldsValue,g=O(Ji),M=g.dispatch,E=i.getValue(),b=m||function(D){return Q({},C,D)},h=A[d],S=u!==void 0?b(E):{};process.env.NODE_ENV!=="production"&&S&&Object.keys(S).forEach(function(D){yt(typeof S[D]!="function","It's not recommended to generate dynamic function prop by `getValueProps`. Please pass it to child component directly (prop: ".concat(D,")"))});var T=L(L({},A),S);T[d]=function(){i.touched=!0,i.dirty=!0,i.triggerMetaEvent();for(var D,B=arguments.length,k=new Array(B),P=0;P<B;P++)k[P]=arguments[P];p?D=p.apply(void 0,k):D=Vx.apply(void 0,[C].concat(k)),v&&(D=v(D,E,x(!0))),D!==E&&M({type:"updateValue",namePath:I,value:D}),h&&h.apply(void 0,k)};var R=nd(w||[]);return R.forEach(function(D){var B=T[D];T[D]=function(){B&&B.apply(void 0,arguments);var k=i.props.rules;k&&k.length&&M({type:"validateField",namePath:I,triggerName:D})}}),T}),r.fieldContext){var o=r.fieldContext.getInternalHooks,a=o(Ji),s=a.initEntityValue;s(Ot(i))}return i}return mn(n,[{key:"componentDidMount",value:function(){var i=this.props,o=i.shouldUpdate,a=i.fieldContext;if(this.mounted=!0,a){var s=a.getInternalHooks,A=s(Ji),c=A.registerField;this.cancelRegisterFunc=c(this)}o===!0&&this.reRender()}},{key:"componentWillUnmount",value:function(){this.cancelRegister(),this.triggerMetaEvent(!0),this.mounted=!1}},{key:"reRender",value:function(){this.mounted&&this.forceUpdate()}},{key:"render",value:function(){var i=this.state.resetCount,o=this.props.children,a=this.getOnlyChild(o),s=a.child,A=a.isFunction,c;return A?c=s:l.isValidElement(s)?c=l.cloneElement(s,this.getControlled(s.props)):(yt(!s,"`children` of Field is not validate ReactElement."),c=s),l.createElement(l.Fragment,{key:i},c)}}]),n}(l.Component);Q(df,"contextType",Yo);Q(df,"defaultProps",{trigger:"onChange",valuePropName:"value"});function G1(t){var e,n=t.name,r=Et(t,zx),i=l.useContext(Yo),o=l.useContext(EA),a=n!==void 0?dn(n):void 0,s=(e=r.isListField)!==null&&e!==void 0?e:!!o,A="keep";return s||(A="_".concat((a||[]).join("_"))),process.env.NODE_ENV!=="production"&&r.preserve===!1&&s&&a.length<=1&&yt(!1,"`preserve` should not apply on Form.List fields."),l.createElement(df,Qe({key:A,name:a,isListField:s},r,{fieldContext:i}))}function Yx(t){var e=t.name,n=t.initialValue,r=t.children,i=t.rules,o=t.validateTrigger,a=t.isListField,s=l.useContext(Yo),A=l.useContext(EA),c=l.useRef({keys:[],id:0}),u=c.current,d=l.useMemo(function(){var C=dn(s.prefixName)||[];return[].concat(Re(C),Re(dn(e)))},[s.prefixName,e]),f=l.useMemo(function(){return L(L({},s),{},{prefixName:d})},[s,d]),p=l.useMemo(function(){return{getKey:function(m){var y=d.length,w=m[y];return[u.keys[w],m.slice(y+1)]}}},[d]);if(typeof r!="function")return yt(!1,"Form.List only accepts function as children."),null;var v=function(m,y,w){var I=w.source;return I==="internal"?!1:m!==y};return l.createElement(EA.Provider,{value:p},l.createElement(Yo.Provider,{value:f},l.createElement(G1,{name:[],shouldUpdate:v,rules:i,validateTrigger:o,initialValue:n,isList:!0,isListField:a??!!A},function(C,m){var y=C.value,w=y===void 0?[]:y,I=C.onChange,O=s.getFieldValue,x=function(){var b=O(d||[]);return b||[]},g={add:function(b,h){var S=x();h>=0&&h<=S.length?(u.keys=[].concat(Re(u.keys.slice(0,h)),[u.id],Re(u.keys.slice(h))),I([].concat(Re(S.slice(0,h)),[b],Re(S.slice(h))))):(process.env.NODE_ENV!=="production"&&(h<0||h>S.length)&&yt(!1,"The second parameter of the add function should be a valid positive number."),u.keys=[].concat(Re(u.keys),[u.id]),I([].concat(Re(S),[b]))),u.id+=1},remove:function(b){var h=x(),S=new Set(Array.isArray(b)?b:[b]);S.size<=0||(u.keys=u.keys.filter(function(T,R){return!S.has(R)}),I(h.filter(function(T,R){return!S.has(R)})))},move:function(b,h){if(b!==h){var S=x();b<0||b>=S.length||h<0||h>=S.length||(u.keys=Gp(u.keys,b,h),I(Gp(S,b,h)))}}},M=w||[];return Array.isArray(M)||(M=[],process.env.NODE_ENV!=="production"&&yt(!1,"Current value of '".concat(d.join(" > "),"' is not an array type."))),r(M.map(function(E,b){var h=u.keys[b];return h===void 0&&(u.keys[b]=u.id,h=u.keys[b],u.id+=1),{name:b,key:h,isListField:!0}}),g,m)})))}function Wx(t){var e=!1,n=t.length,r=[];return t.length?new Promise(function(i,o){t.forEach(function(a,s){a.catch(function(A){return e=!0,A}).then(function(A){n-=1,r[s]=A,!(n>0)&&(e&&o(r),i(r))})})}):Promise.resolve([])}var q1="__@field_split__";function al(t){return t.map(function(e){return"".concat(et(e),":").concat(e)}).join(q1)}var Co=function(){function t(){pn(this,t),Q(this,"kvs",new Map)}return mn(t,[{key:"set",value:function(n,r){this.kvs.set(al(n),r)}},{key:"get",value:function(n){return this.kvs.get(al(n))}},{key:"update",value:function(n,r){var i=this.get(n),o=r(i);o?this.set(n,o):this.delete(n)}},{key:"delete",value:function(n){this.kvs.delete(al(n))}},{key:"map",value:function(n){return Re(this.kvs.entries()).map(function(r){var i=ee(r,2),o=i[0],a=i[1],s=o.split(q1);return n({key:s.map(function(A){var c=A.match(/^([^:]*):(.*)$/),u=ee(c,3),d=u[1],f=u[2];return d==="number"?Number(f):f}),value:a})})}},{key:"toJSON",value:function(){var n={};return this.map(function(r){var i=r.key,o=r.value;return n[i.join(".")]=o,null}),n}}]),t}(),Jx=["name"],_x=mn(function t(e){var n=this;pn(this,t),Q(this,"formHooked",!1),Q(this,"forceRootUpdate",void 0),Q(this,"subscribable",!0),Q(this,"store",{}),Q(this,"fieldEntities",[]),Q(this,"initialValues",{}),Q(this,"callbacks",{}),Q(this,"validateMessages",null),Q(this,"preserve",null),Q(this,"lastValidatePromise",null),Q(this,"getForm",function(){return{getFieldValue:n.getFieldValue,getFieldsValue:n.getFieldsValue,getFieldError:n.getFieldError,getFieldWarning:n.getFieldWarning,getFieldsError:n.getFieldsError,isFieldsTouched:n.isFieldsTouched,isFieldTouched:n.isFieldTouched,isFieldValidating:n.isFieldValidating,isFieldsValidating:n.isFieldsValidating,resetFields:n.resetFields,setFields:n.setFields,setFieldValue:n.setFieldValue,setFieldsValue:n.setFieldsValue,validateFields:n.validateFields,submit:n.submit,_init:!0,getInternalHooks:n.getInternalHooks}}),Q(this,"getInternalHooks",function(r){return r===Ji?(n.formHooked=!0,{dispatch:n.dispatch,initEntityValue:n.initEntityValue,registerField:n.registerField,useSubscribe:n.useSubscribe,setInitialValues:n.setInitialValues,destroyForm:n.destroyForm,setCallbacks:n.setCallbacks,setValidateMessages:n.setValidateMessages,getFields:n.getFields,setPreserve:n.setPreserve,getInitialValue:n.getInitialValue,registerWatch:n.registerWatch}):(yt(!1,"`getInternalHooks` is internal usage. Should not call directly."),null)}),Q(this,"useSubscribe",function(r){n.subscribable=r}),Q(this,"prevWithoutPreserves",null),Q(this,"setInitialValues",function(r,i){if(n.initialValues=r||{},i){var o,a=Ro(r,n.store);(o=n.prevWithoutPreserves)===null||o===void 0||o.map(function(s){var A=s.key;a=Mr(a,A,zr(r,A))}),n.prevWithoutPreserves=null,n.updateStore(a)}}),Q(this,"destroyForm",function(r){if(r)n.updateStore({});else{var i=new Co;n.getFieldEntities(!0).forEach(function(o){n.isMergedPreserve(o.isPreserve())||i.set(o.getNamePath(),!0)}),n.prevWithoutPreserves=i}}),Q(this,"getInitialValue",function(r){var i=zr(n.initialValues,r);return r.length?Ro(i):i}),Q(this,"setCallbacks",function(r){n.callbacks=r}),Q(this,"setValidateMessages",function(r){n.validateMessages=r}),Q(this,"setPreserve",function(r){n.preserve=r}),Q(this,"watchList",[]),Q(this,"registerWatch",function(r){return n.watchList.push(r),function(){n.watchList=n.watchList.filter(function(i){return i!==r})}}),Q(this,"notifyWatch",function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];if(n.watchList.length){var i=n.getFieldsValue(),o=n.getFieldsValue(!0);n.watchList.forEach(function(a){a(i,o,r)})}}),Q(this,"timeoutId",null),Q(this,"warningUnhooked",function(){process.env.NODE_ENV!=="production"&&!n.timeoutId&&typeof window<"u"&&(n.timeoutId=setTimeout(function(){n.timeoutId=null,n.formHooked||yt(!1,"Instance created by `useForm` is not connected to any Form element. Forget to pass `form` prop?")}))}),Q(this,"updateStore",function(r){n.store=r}),Q(this,"getFieldEntities",function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return r?n.fieldEntities.filter(function(i){return i.getNamePath().length}):n.fieldEntities}),Q(this,"getFieldsMap",function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,i=new Co;return n.getFieldEntities(r).forEach(function(o){var a=o.getNamePath();i.set(a,o)}),i}),Q(this,"getFieldEntitiesForNamePathList",function(r){if(!r)return n.getFieldEntities(!0);var i=n.getFieldsMap(!0);return r.map(function(o){var a=dn(o);return i.get(a)||{INVALIDATE_NAME_PATH:dn(o)}})}),Q(this,"getFieldsValue",function(r,i){n.warningUnhooked();var o,a,s;if(r===!0||Array.isArray(r)?(o=r,a=i):r&&et(r)==="object"&&(s=r.strict,a=r.filter),o===!0&&!a)return n.store;var A=n.getFieldEntitiesForNamePathList(Array.isArray(o)?o:null),c=[];return A.forEach(function(u){var d,f,p="INVALIDATE_NAME_PATH"in u?u.INVALIDATE_NAME_PATH:u.getNamePath();if(s){var v,C;if((v=(C=u).isList)!==null&&v!==void 0&&v.call(C))return}else if(!o&&(d=(f=u).isListField)!==null&&d!==void 0&&d.call(f))return;if(!a)c.push(p);else{var m="getMeta"in u?u.getMeta():null;a(m)&&c.push(p)}}),Hp(n.store,c.map(dn))}),Q(this,"getFieldValue",function(r){n.warningUnhooked();var i=dn(r);return zr(n.store,i)}),Q(this,"getFieldsError",function(r){n.warningUnhooked();var i=n.getFieldEntitiesForNamePathList(r);return i.map(function(o,a){return o&&!("INVALIDATE_NAME_PATH"in o)?{name:o.getNamePath(),errors:o.getErrors(),warnings:o.getWarnings()}:{name:dn(r[a]),errors:[],warnings:[]}})}),Q(this,"getFieldError",function(r){n.warningUnhooked();var i=dn(r),o=n.getFieldsError([i])[0];return o.errors}),Q(this,"getFieldWarning",function(r){n.warningUnhooked();var i=dn(r),o=n.getFieldsError([i])[0];return o.warnings}),Q(this,"isFieldsTouched",function(){n.warningUnhooked();for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];var a=i[0],s=i[1],A,c=!1;i.length===0?A=null:i.length===1?Array.isArray(a)?(A=a.map(dn),c=!1):(A=null,c=a):(A=a.map(dn),c=s);var u=n.getFieldEntities(!0),d=function(m){return m.isFieldTouched()};if(!A)return c?u.every(function(C){return d(C)||C.isList()}):u.some(d);var f=new Co;A.forEach(function(C){f.set(C,[])}),u.forEach(function(C){var m=C.getNamePath();A.forEach(function(y){y.every(function(w,I){return m[I]===w})&&f.update(y,function(w){return[].concat(Re(w),[C])})})});var p=function(m){return m.some(d)},v=f.map(function(C){var m=C.value;return m});return c?v.every(p):v.some(p)}),Q(this,"isFieldTouched",function(r){return n.warningUnhooked(),n.isFieldsTouched([r])}),Q(this,"isFieldsValidating",function(r){n.warningUnhooked();var i=n.getFieldEntities();if(!r)return i.some(function(a){return a.isFieldValidating()});var o=r.map(dn);return i.some(function(a){var s=a.getNamePath();return Fo(o,s)&&a.isFieldValidating()})}),Q(this,"isFieldValidating",function(r){return n.warningUnhooked(),n.isFieldsValidating([r])}),Q(this,"resetWithFieldInitialValue",function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=new Co,o=n.getFieldEntities(!0);o.forEach(function(A){var c=A.props.initialValue,u=A.getNamePath();if(c!==void 0){var d=i.get(u)||new Set;d.add({entity:A,value:c}),i.set(u,d)}});var a=function(c){c.forEach(function(u){var d=u.props.initialValue;if(d!==void 0){var f=u.getNamePath(),p=n.getInitialValue(f);if(p!==void 0)yt(!1,"Form already set 'initialValues' with path '".concat(f.join("."),"'. Field can not overwrite it."));else{var v=i.get(f);if(v&&v.size>1)yt(!1,"Multiple Field with path '".concat(f.join("."),"' set 'initialValue'. Can not decide which one to pick."));else if(v){var C=n.getFieldValue(f),m=u.isListField();!m&&(!r.skipExist||C===void 0)&&n.updateStore(Mr(n.store,f,Re(v)[0].value))}}}})},s;r.entities?s=r.entities:r.namePathList?(s=[],r.namePathList.forEach(function(A){var c=i.get(A);if(c){var u;(u=s).push.apply(u,Re(Re(c).map(function(d){return d.entity})))}})):s=o,a(s)}),Q(this,"resetFields",function(r){n.warningUnhooked();var i=n.store;if(!r){n.updateStore(Ro(n.initialValues)),n.resetWithFieldInitialValue(),n.notifyObservers(i,null,{type:"reset"}),n.notifyWatch();return}var o=r.map(dn);o.forEach(function(a){var s=n.getInitialValue(a);n.updateStore(Mr(n.store,a,s))}),n.resetWithFieldInitialValue({namePathList:o}),n.notifyObservers(i,o,{type:"reset"}),n.notifyWatch(o)}),Q(this,"setFields",function(r){n.warningUnhooked();var i=n.store,o=[];r.forEach(function(a){var s=a.name,A=Et(a,Jx),c=dn(s);o.push(c),"value"in A&&n.updateStore(Mr(n.store,c,A.value)),n.notifyObservers(i,[c],{type:"setField",data:a})}),n.notifyWatch(o)}),Q(this,"getFields",function(){var r=n.getFieldEntities(!0),i=r.map(function(o){var a=o.getNamePath(),s=o.getMeta(),A=L(L({},s),{},{name:a,value:n.getFieldValue(a)});return Object.defineProperty(A,"originRCField",{value:!0}),A});return i}),Q(this,"initEntityValue",function(r){var i=r.props.initialValue;if(i!==void 0){var o=r.getNamePath(),a=zr(n.store,o);a===void 0&&n.updateStore(Mr(n.store,o,i))}}),Q(this,"isMergedPreserve",function(r){var i=r!==void 0?r:n.preserve;return i??!0}),Q(this,"registerField",function(r){n.fieldEntities.push(r);var i=r.getNamePath();if(n.notifyWatch([i]),r.props.initialValue!==void 0){var o=n.store;n.resetWithFieldInitialValue({entities:[r],skipExist:!0}),n.notifyObservers(o,[r.getNamePath()],{type:"valueUpdate",source:"internal"})}return function(a,s){var A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];if(n.fieldEntities=n.fieldEntities.filter(function(d){return d!==r}),!n.isMergedPreserve(s)&&(!a||A.length>1)){var c=a?void 0:n.getInitialValue(i);if(i.length&&n.getFieldValue(i)!==c&&n.fieldEntities.every(function(d){return!H1(d.getNamePath(),i)})){var u=n.store;n.updateStore(Mr(u,i,c,!0)),n.notifyObservers(u,[i],{type:"remove"}),n.triggerDependenciesUpdate(u,i)}}n.notifyWatch([i])}}),Q(this,"dispatch",function(r){switch(r.type){case"updateValue":{var i=r.namePath,o=r.value;n.updateValue(i,o);break}case"validateField":{var a=r.namePath,s=r.triggerName;n.validateFields([a],{triggerName:s});break}}}),Q(this,"notifyObservers",function(r,i,o){if(n.subscribable){var a=L(L({},o),{},{store:n.getFieldsValue(!0)});n.getFieldEntities().forEach(function(s){var A=s.onStoreChange;A(r,i,a)})}else n.forceRootUpdate()}),Q(this,"triggerDependenciesUpdate",function(r,i){var o=n.getDependencyChildrenFields(i);return o.length&&n.validateFields(o),n.notifyObservers(r,o,{type:"dependenciesUpdate",relatedFields:[i].concat(Re(o))}),o}),Q(this,"updateValue",function(r,i){var o=dn(r),a=n.store;n.updateStore(Mr(n.store,o,i)),n.notifyObservers(a,[o],{type:"valueUpdate",source:"internal"}),n.notifyWatch([o]);var s=n.triggerDependenciesUpdate(a,o),A=n.callbacks.onValuesChange;if(A){var c=Hp(n.store,[o]);A(c,n.getFieldsValue())}n.triggerOnFieldsChange([o].concat(Re(s)))}),Q(this,"setFieldsValue",function(r){n.warningUnhooked();var i=n.store;if(r){var o=Ro(n.store,r);n.updateStore(o)}n.notifyObservers(i,null,{type:"valueUpdate",source:"external"}),n.notifyWatch()}),Q(this,"setFieldValue",function(r,i){n.setFields([{name:r,value:i,errors:[],warnings:[]}])}),Q(this,"getDependencyChildrenFields",function(r){var i=new Set,o=[],a=new Co;n.getFieldEntities().forEach(function(A){var c=A.props.dependencies;(c||[]).forEach(function(u){var d=dn(u);a.update(d,function(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Set;return f.add(A),f})})});var s=function A(c){var u=a.get(c)||new Set;u.forEach(function(d){if(!i.has(d)){i.add(d);var f=d.getNamePath();d.isFieldDirty()&&f.length&&(o.push(f),A(f))}})};return s(r),o}),Q(this,"triggerOnFieldsChange",function(r,i){var o=n.callbacks.onFieldsChange;if(o){var a=n.getFields();if(i){var s=new Co;i.forEach(function(c){var u=c.name,d=c.errors;s.set(u,d)}),a.forEach(function(c){c.errors=s.get(c.name)||c.errors})}var A=a.filter(function(c){var u=c.name;return Fo(r,u)});A.length&&o(A,a)}}),Q(this,"validateFields",function(r,i){n.warningUnhooked();var o,a;Array.isArray(r)||typeof r=="string"||typeof i=="string"?(o=r,a=i):a=r;var s=!!o,A=s?o.map(dn):[],c=[],u=String(Date.now()),d=new Set,f=a||{},p=f.recursive,v=f.dirty;n.getFieldEntities(!0).forEach(function(w){if(s||A.push(w.getNamePath()),!(!w.props.rules||!w.props.rules.length)&&!(v&&!w.isFieldDirty())){var I=w.getNamePath();if(d.add(I.join(u)),!s||Fo(A,I,p)){var O=w.validateRules(L({validateMessages:L(L({},U1),n.validateMessages)},a));c.push(O.then(function(){return{name:I,errors:[],warnings:[]}}).catch(function(x){var g,M=[],E=[];return(g=x.forEach)===null||g===void 0||g.call(x,function(b){var h=b.rule.warningOnly,S=b.errors;h?E.push.apply(E,Re(S)):M.push.apply(M,Re(S))}),M.length?Promise.reject({name:I,errors:M,warnings:E}):{name:I,errors:M,warnings:E}}))}}});var C=Wx(c);n.lastValidatePromise=C,C.catch(function(w){return w}).then(function(w){var I=w.map(function(O){var x=O.name;return x});n.notifyObservers(n.store,I,{type:"validateFinish"}),n.triggerOnFieldsChange(I,w)});var m=C.then(function(){return n.lastValidatePromise===C?Promise.resolve(n.getFieldsValue(A)):Promise.reject([])}).catch(function(w){var I=w.filter(function(O){return O&&O.errors.length});return Promise.reject({values:n.getFieldsValue(A),errorFields:I,outOfDate:n.lastValidatePromise!==C})});m.catch(function(w){return w});var y=A.filter(function(w){return d.has(w.join(u))});return n.triggerOnFieldsChange(y),m}),Q(this,"submit",function(){n.warningUnhooked(),n.validateFields().then(function(r){var i=n.callbacks.onFinish;if(i)try{i(r)}catch(o){console.error(o)}}).catch(function(r){var i=n.callbacks.onFinishFailed;i&&i(r)})}),this.forceRootUpdate=e});function Z1(t){var e=l.useRef(),n=l.useState({}),r=ee(n,2),i=r[1];if(!e.current)if(t)e.current=t;else{var o=function(){i({})},a=new _x(o);e.current=a.getForm()}return[e.current]}var ud=l.createContext({triggerFormChange:function(){},triggerFormFinish:function(){},registerForm:function(){},unregisterForm:function(){}}),$x=function(e){var n=e.validateMessages,r=e.onFormChange,i=e.onFormFinish,o=e.children,a=l.useContext(ud),s=l.useRef({});return l.createElement(ud.Provider,{value:L(L({},a),{},{validateMessages:L(L({},a.validateMessages),n),triggerFormChange:function(c,u){r&&r(c,{changedFields:u,forms:s.current}),a.triggerFormChange(c,u)},triggerFormFinish:function(c,u){i&&i(c,{values:u,forms:s.current}),a.triggerFormFinish(c,u)},registerForm:function(c,u){c&&(s.current=L(L({},s.current),{},Q({},c,u))),a.registerForm(c,u)},unregisterForm:function(c){var u=L({},s.current);delete u[c],s.current=u,a.unregisterForm(c)}})},o)},Xx=["name","initialValues","fields","form","preserve","children","component","validateMessages","validateTrigger","onValuesChange","onFieldsChange","onFinish","onFinishFailed","clearOnDestroy"],e3=function(e,n){var r=e.name,i=e.initialValues,o=e.fields,a=e.form,s=e.preserve,A=e.children,c=e.component,u=c===void 0?"form":c,d=e.validateMessages,f=e.validateTrigger,p=f===void 0?"onChange":f,v=e.onValuesChange,C=e.onFieldsChange,m=e.onFinish,y=e.onFinishFailed,w=e.clearOnDestroy,I=Et(e,Xx),O=l.useRef(null),x=l.useContext(ud),g=Z1(a),M=ee(g,1),E=M[0],b=E.getInternalHooks(Ji),h=b.useSubscribe,S=b.setInitialValues,T=b.setCallbacks,R=b.setValidateMessages,D=b.setPreserve,B=b.destroyForm;l.useImperativeHandle(n,function(){return L(L({},E),{},{nativeElement:O.current})}),l.useEffect(function(){return x.registerForm(r,E),function(){x.unregisterForm(r)}},[x,E,r]),R(L(L({},x.validateMessages),d)),T({onValuesChange:v,onFieldsChange:function(z){if(x.triggerFormChange(r,z),C){for(var J=arguments.length,W=new Array(J>1?J-1:0),te=1;te<J;te++)W[te-1]=arguments[te];C.apply(void 0,[z].concat(W))}},onFinish:function(z){x.triggerFormFinish(r,z),m&&m(z)},onFinishFailed:y}),D(s);var k=l.useRef(null);S(i,!k.current),k.current||(k.current=!0),l.useEffect(function(){return function(){return B(w)}},[]);var P,H=typeof A=="function";if(H){var Z=E.getFieldsValue(!0);P=A(Z,E)}else P=A;h(!H);var V=l.useRef();l.useEffect(function(){Kx(V.current||[],o||[])||E.setFields(o||[]),V.current=o},[o,E]);var q=l.useMemo(function(){return L(L({},E),{},{validateTrigger:p})},[E,p]),U=l.createElement(EA.Provider,{value:null},l.createElement(Yo.Provider,{value:q},P));return u===!1?U:l.createElement(u,Qe({},I,{ref:O,onSubmit:function(z){z.preventDefault(),z.stopPropagation(),E.submit()},onReset:function(z){var J;z.preventDefault(),E.resetFields(),(J=I.onReset)===null||J===void 0||J.call(I,z)}}),U)};function qp(t){try{return JSON.stringify(t)}catch{return Math.random()}}var t3=process.env.NODE_ENV!=="production"?function(t){var e=t.join("__RC_FIELD_FORM_SPLIT__"),n=N.useRef(e);yt(n.current===e,"`useWatch` is not support dynamic `namePath`. Please provide static instead.")}:function(){};function n3(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r=e[0],i=e[1],o=i===void 0?{}:i,a=lx(o)?{form:o}:o,s=a.form,A=N.useState(),c=ee(A,2),u=c[0],d=c[1],f=N.useMemo(function(){return qp(u)},[u]),p=N.useRef(f);p.current=f;var v=N.useContext(Yo),C=s||v,m=C&&C._init;process.env.NODE_ENV!=="production"&&yt(e.length===2?s?m:!0:m,"useWatch requires a form instance since it can not auto detect from context.");var y=dn(r),w=N.useRef(y);return w.current=y,t3(y),N.useEffect(function(){if(m){var I=C.getFieldsValue,O=C.getInternalHooks,x=O(Ji),g=x.registerWatch,M=function(S,T){var R=a.preserve?T:S;return typeof r=="function"?r(R):zr(R,w.current)},E=g(function(h,S){var T=M(h,S),R=qp(T);p.current!==R&&(p.current=R,d(T))}),b=M(I(),I(!0));return u!==b&&d(b),E}},[m]),u}var r3=l.forwardRef(e3),is=r3;is.FormProvider=$x;is.Field=G1;is.List=Yx;is.useForm=Z1;is.useWatch=n3;function tr(t,e){var n=Object.assign({},t);return Array.isArray(e)&&e.forEach(function(r){delete n[r]}),n}const Qr=l.createContext({});process.env.NODE_ENV!=="production"&&(Qr.displayName="FormItemInputContext");const i3=t=>{let{children:e,status:n,override:r}=t;const i=l.useContext(Qr),o=l.useMemo(()=>{const a=Object.assign({},i);return r&&delete a.isFormItemInput,n&&(delete a.status,delete a.hasFeedback,delete a.feedbackIcon),a},[n,r,i]);return l.createElement(Qr.Provider,{value:o},e)},o3=l.createContext(void 0);var a3=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n};const s3=(t,e)=>{var n,r;const i=l.useContext(D1),o=l.useContext(B1),{getPrefixCls:a,direction:s,radio:A}=l.useContext(Qt),c=l.useRef(null),u=Lr(e,c),{isFormItemInput:d}=l.useContext(Qr);if(process.env.NODE_ENV!=="production"){const k=cn("Radio");process.env.NODE_ENV!=="production"&&k(!("optionType"in t),"usage","`optionType` is only support in Radio.Group.")}const f=k=>{var P,H;(P=t.onChange)===null||P===void 0||P.call(t,k),(H=i==null?void 0:i.onChange)===null||H===void 0||H.call(i,k)},{prefixCls:p,className:v,rootClassName:C,children:m,style:y,title:w}=t,I=a3(t,["prefixCls","className","rootClassName","children","style","title"]),O=a("radio",p),x=((i==null?void 0:i.optionType)||o)==="button",g=x?`${O}-button`:O,M=Ur(O),[E,b,h]=g1(O,M),S=Object.assign({},I),T=l.useContext(li);i&&(S.name=i.name,S.onChange=f,S.checked=t.value===i.value,S.disabled=(n=S.disabled)!==null&&n!==void 0?n:i.disabled),S.disabled=(r=S.disabled)!==null&&r!==void 0?r:T;const R=Ae(`${g}-wrapper`,{[`${g}-wrapper-checked`]:S.checked,[`${g}-wrapper-disabled`]:S.disabled,[`${g}-wrapper-rtl`]:s==="rtl",[`${g}-wrapper-in-form-item`]:d,[`${g}-wrapper-block`]:!!(i!=null&&i.block)},A==null?void 0:A.className,v,C,b,h,M),[D,B]=cx(S.onClick);return E(l.createElement(nc,{component:"Radio",disabled:S.disabled},l.createElement("label",{className:R,style:Object.assign(Object.assign({},A==null?void 0:A.style),y),onMouseEnter:t.onMouseEnter,onMouseLeave:t.onMouseLeave,title:w,onClick:D},l.createElement(q6,Object.assign({},S,{className:Ae(S.className,{[cf]:!x}),type:"radio",prefixCls:g,ref:u,onClick:B})),m!==void 0?l.createElement("span",{className:`${g}-label`},m):null)))},La=l.forwardRef(s3);process.env.NODE_ENV!=="production"&&(La.displayName="Radio");function A3(){var t=L({},l);return t.useId}var Zp=0,Kp=A3();const rc=Kp?function(e){var n=Kp();return e||(process.env.NODE_ENV==="test"?"test-id":n)}:function(e){var n=l.useState("ssr-id"),r=ee(n,2),i=r[0],o=r[1];return l.useEffect(function(){var a=Zp;Zp+=1,o("rc_unique_".concat(a))},[]),e||(process.env.NODE_ENV==="test"?"test-id":i)},c3=l.forwardRef((t,e)=>{const{getPrefixCls:n,direction:r}=l.useContext(Qt),i=rc(),{prefixCls:o,className:a,rootClassName:s,options:A,buttonStyle:c="outline",disabled:u,children:d,size:f,style:p,id:v,optionType:C,name:m=i,defaultValue:y,value:w,block:I=!1,onChange:O,onMouseEnter:x,onMouseLeave:g,onFocus:M,onBlur:E}=t,[b,h]=Fn(y,{value:w}),S=l.useCallback(U=>{const $=b,z=U.target.value;"value"in t||h(z),z!==$&&(O==null||O(U))},[b,h,O]),T=n("radio",o),R=`${T}-group`,D=Ur(T),[B,k,P]=g1(T,D);let H=d;A&&A.length>0&&(H=A.map(U=>typeof U=="string"||typeof U=="number"?l.createElement(La,{key:U.toString(),prefixCls:T,disabled:u,value:U,checked:b===U},U):l.createElement(La,{key:`radio-group-value-options-${U.value}`,prefixCls:T,disabled:U.disabled||u,value:U.value,checked:b===U.value,title:U.title,style:U.style,id:U.id,required:U.required},U.label)));const Z=Ui(f),V=Ae(R,`${R}-${c}`,{[`${R}-${Z}`]:Z,[`${R}-rtl`]:r==="rtl",[`${R}-block`]:I},a,s,k,P,D),q=l.useMemo(()=>({onChange:S,value:b,disabled:u,name:m,optionType:C,block:I}),[S,b,u,m,C,I]);return B(l.createElement("div",Object.assign({},ki(t,{aria:!0,data:!0}),{className:V,style:p,onMouseEnter:x,onMouseLeave:g,onFocus:M,onBlur:E,id:v,ref:e}),l.createElement(U6,{value:q},H)))}),l3=l.memo(c3);var u3=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n};const d3=(t,e)=>{const{getPrefixCls:n}=l.useContext(Qt),{prefixCls:r}=t,i=u3(t,["prefixCls"]),o=n("radio",r);return l.createElement(H6,{value:"button"},l.createElement(La,Object.assign({prefixCls:o},i,{type:"radio",ref:e})))},f3=l.forwardRef(d3),os=La;os.Button=f3;os.Group=l3;os.__ANT_RADIO=!0;const g3=t=>{const{getPrefixCls:e,direction:n}=N.useContext(Qt),{prefixCls:r,className:i}=t,o=e("input-group",r),a=e("input"),[s,A]=b1(a),c=Ae(o,{[`${o}-lg`]:t.size==="large",[`${o}-sm`]:t.size==="small",[`${o}-compact`]:t.compact,[`${o}-rtl`]:n==="rtl"},A,i),u=N.useContext(Qr),d=N.useMemo(()=>Object.assign(Object.assign({},u),{isFormItemInput:!1}),[u]);return process.env.NODE_ENV!=="production"&&cn("Input.Group").deprecated(!1,"Input.Group","Space.Compact"),s(l.createElement("span",{className:c,style:t.style,onMouseEnter:t.onMouseEnter,onMouseLeave:t.onMouseLeave,onFocus:t.onFocus,onBlur:t.onBlur},l.createElement(Qr.Provider,{value:d},t.children)))};function h3(t){return!!(t.addonBefore||t.addonAfter)}function p3(t){return!!(t.prefix||t.suffix||t.allowClear)}function Vp(t,e,n){var r=e.cloneNode(!0),i=Object.create(t,{target:{value:r},currentTarget:{value:r}});return r.value=n,typeof e.selectionStart=="number"&&typeof e.selectionEnd=="number"&&(r.selectionStart=e.selectionStart,r.selectionEnd=e.selectionEnd),r.setSelectionRange=function(){e.setSelectionRange.apply(e,arguments)},i}function bA(t,e,n,r){if(n){var i=e;if(e.type==="click"){i=Vp(e,t,""),n(i);return}if(t.type!=="file"&&r!==void 0){i=Vp(e,t,r),n(i);return}n(i)}}function K1(t,e){if(t){t.focus(e);var n=e||{},r=n.cursor;if(r){var i=t.value.length;switch(r){case"start":t.setSelectionRange(0,0);break;case"end":t.setSelectionRange(i,i);break;default:t.setSelectionRange(0,i)}}}}var V1=N.forwardRef(function(t,e){var n,r,i,o=t.inputElement,a=t.children,s=t.prefixCls,A=t.prefix,c=t.suffix,u=t.addonBefore,d=t.addonAfter,f=t.className,p=t.style,v=t.disabled,C=t.readOnly,m=t.focused,y=t.triggerFocus,w=t.allowClear,I=t.value,O=t.handleReset,x=t.hidden,g=t.classes,M=t.classNames,E=t.dataAttrs,b=t.styles,h=t.components,S=t.onClear,T=a??o,R=(h==null?void 0:h.affixWrapper)||"span",D=(h==null?void 0:h.groupWrapper)||"span",B=(h==null?void 0:h.wrapper)||"span",k=(h==null?void 0:h.groupAddon)||"span",P=N.useRef(null),H=function(de){var le;(le=P.current)!==null&&le!==void 0&&le.contains(de.target)&&(y==null||y())},Z=p3(t),V=N.cloneElement(T,{value:I,className:Ae((n=T.props)===null||n===void 0?void 0:n.className,!Z&&(M==null?void 0:M.variant))||null}),q=N.useRef(null);if(N.useImperativeHandle(e,function(){return{nativeElement:q.current||P.current}}),Z){var U=null;if(w){var $=!v&&!C&&I,z="".concat(s,"-clear-icon"),J=et(w)==="object"&&w!==null&&w!==void 0&&w.clearIcon?w.clearIcon:"✖";U=N.createElement("button",{type:"button",tabIndex:-1,onClick:function(de){O==null||O(de),S==null||S()},onMouseDown:function(de){return de.preventDefault()},className:Ae(z,Q(Q({},"".concat(z,"-hidden"),!$),"".concat(z,"-has-suffix"),!!c))},J)}var W="".concat(s,"-affix-wrapper"),te=Ae(W,Q(Q(Q(Q(Q({},"".concat(s,"-disabled"),v),"".concat(W,"-disabled"),v),"".concat(W,"-focused"),m),"".concat(W,"-readonly"),C),"".concat(W,"-input-with-clear-btn"),c&&w&&I),g==null?void 0:g.affixWrapper,M==null?void 0:M.affixWrapper,M==null?void 0:M.variant),_=(c||w)&&N.createElement("span",{className:Ae("".concat(s,"-suffix"),M==null?void 0:M.suffix),style:b==null?void 0:b.suffix},U,c);V=N.createElement(R,Qe({className:te,style:b==null?void 0:b.affixWrapper,onClick:H},E==null?void 0:E.affixWrapper,{ref:P}),A&&N.createElement("span",{className:Ae("".concat(s,"-prefix"),M==null?void 0:M.prefix),style:b==null?void 0:b.prefix},A),V,_)}if(h3(t)){var se="".concat(s,"-group"),ce="".concat(se,"-addon"),ue="".concat(se,"-wrapper"),ne=Ae("".concat(s,"-wrapper"),se,g==null?void 0:g.wrapper,M==null?void 0:M.wrapper),me=Ae(ue,Q({},"".concat(ue,"-disabled"),v),g==null?void 0:g.group,M==null?void 0:M.groupWrapper);V=N.createElement(D,{className:me,ref:q},N.createElement(B,{className:ne},u&&N.createElement(k,{className:ce},u),V,d&&N.createElement(k,{className:ce},d)))}return N.cloneElement(V,{className:Ae((r=V.props)===null||r===void 0?void 0:r.className,f)||null,style:L(L({},(i=V.props)===null||i===void 0?void 0:i.style),p),hidden:x})}),m3=["show"];function z1(t,e){return l.useMemo(function(){var n={};e&&(n.show=et(e)==="object"&&e.formatter?e.formatter:!!e),n=L(L({},n),t);var r=n,i=r.show,o=Et(r,m3);return L(L({},o),{},{show:!!i,showFormatter:typeof i=="function"?i:void 0,strategy:o.strategy||function(a){return a.length}})},[t,e])}var v3=["autoComplete","onChange","onFocus","onBlur","onPressEnter","onKeyDown","onKeyUp","prefixCls","disabled","htmlSize","className","maxLength","suffix","showCount","count","type","classes","classNames","styles","onCompositionStart","onCompositionEnd"],C3=N.forwardRef(function(t,e){var n=t.autoComplete,r=t.onChange,i=t.onFocus,o=t.onBlur,a=t.onPressEnter,s=t.onKeyDown,A=t.onKeyUp,c=t.prefixCls,u=c===void 0?"rc-input":c,d=t.disabled,f=t.htmlSize,p=t.className,v=t.maxLength,C=t.suffix,m=t.showCount,y=t.count,w=t.type,I=w===void 0?"text":w,O=t.classes,x=t.classNames,g=t.styles,M=t.onCompositionStart,E=t.onCompositionEnd,b=Et(t,v3),h=N.useState(!1),S=ee(h,2),T=S[0],R=S[1],D=N.useRef(!1),B=N.useRef(!1),k=N.useRef(null),P=N.useRef(null),H=function(pe){k.current&&K1(k.current,pe)},Z=Fn(t.defaultValue,{value:t.value}),V=ee(Z,2),q=V[0],U=V[1],$=q==null?"":String(q),z=N.useState(null),J=ee(z,2),W=J[0],te=J[1],_=z1(y,m),se=_.max||v,ce=_.strategy($),ue=!!se&&ce>se;N.useImperativeHandle(e,function(){var Ie;return{focus:H,blur:function(){var Oe;(Oe=k.current)===null||Oe===void 0||Oe.blur()},setSelectionRange:function(Oe,Ze,tt){var rt;(rt=k.current)===null||rt===void 0||rt.setSelectionRange(Oe,Ze,tt)},select:function(){var Oe;(Oe=k.current)===null||Oe===void 0||Oe.select()},input:k.current,nativeElement:((Ie=P.current)===null||Ie===void 0?void 0:Ie.nativeElement)||k.current}}),N.useEffect(function(){B.current&&(B.current=!1),R(function(Ie){return Ie&&d?!1:Ie})},[d]);var ne=function(pe,Oe,Ze){var tt=Oe;if(!D.current&&_.exceedFormatter&&_.max&&_.strategy(Oe)>_.max){if(tt=_.exceedFormatter(Oe,{max:_.max}),Oe!==tt){var rt,Ge;te([((rt=k.current)===null||rt===void 0?void 0:rt.selectionStart)||0,((Ge=k.current)===null||Ge===void 0?void 0:Ge.selectionEnd)||0])}}else if(Ze.source==="compositionEnd")return;U(tt),k.current&&bA(k.current,pe,r,tt)};N.useEffect(function(){if(W){var Ie;(Ie=k.current)===null||Ie===void 0||Ie.setSelectionRange.apply(Ie,Re(W))}},[W]);var me=function(pe){ne(pe,pe.target.value,{source:"change"})},Y=function(pe){D.current=!1,ne(pe,pe.currentTarget.value,{source:"compositionEnd"}),E==null||E(pe)},de=function(pe){a&&pe.key==="Enter"&&!B.current&&(B.current=!0,a(pe)),s==null||s(pe)},le=function(pe){pe.key==="Enter"&&(B.current=!1),A==null||A(pe)},Se=function(pe){R(!0),i==null||i(pe)},xe=function(pe){B.current&&(B.current=!1),R(!1),o==null||o(pe)},Ce=function(pe){U(""),H(),k.current&&bA(k.current,pe,r)},De=ue&&"".concat(u,"-out-of-range"),je=function(){var pe=tr(t,["prefixCls","onPressEnter","addonBefore","addonAfter","prefix","suffix","allowClear","defaultValue","showCount","count","classes","htmlSize","styles","classNames","onClear"]);return N.createElement("input",Qe({autoComplete:n},pe,{onChange:me,onFocus:Se,onBlur:xe,onKeyDown:de,onKeyUp:le,className:Ae(u,Q({},"".concat(u,"-disabled"),d),x==null?void 0:x.input),style:g==null?void 0:g.input,ref:k,size:f,type:I,onCompositionStart:function(Ze){D.current=!0,M==null||M(Ze)},onCompositionEnd:Y}))},Le=function(){var pe=Number(se)>0;if(C||_.show){var Oe=_.showFormatter?_.showFormatter({value:$,count:ce,maxLength:se}):"".concat(ce).concat(pe?" / ".concat(se):"");return N.createElement(N.Fragment,null,_.show&&N.createElement("span",{className:Ae("".concat(u,"-show-count-suffix"),Q({},"".concat(u,"-show-count-has-suffix"),!!C),x==null?void 0:x.count),style:L({},g==null?void 0:g.count)},Oe),C)}return null};return N.createElement(V1,Qe({},b,{prefixCls:u,className:Ae(p,De),handleReset:Ce,value:$,focused:T,triggerFocus:H,suffix:Le(),disabled:d,classes:O,classNames:x,styles:g}),je())}),Y1=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n};const ic=l.createContext(null),Xo=(t,e)=>{const n=l.useContext(ic),r=l.useMemo(()=>{if(!n)return"";const{compactDirection:i,isFirstItem:o,isLastItem:a}=n,s=i==="vertical"?"-vertical-":"-";return Ae(`${t}-compact${s}item`,{[`${t}-compact${s}first-item`]:o,[`${t}-compact${s}last-item`]:a,[`${t}-compact${s}item-rtl`]:e==="rtl"})},[t,e,n]);return{compactSize:n==null?void 0:n.compactSize,compactDirection:n==null?void 0:n.compactDirection,compactItemClassnames:r}},y3=t=>{const{children:e}=t;return l.createElement(ic.Provider,{value:null},e)},E3=t=>{const{children:e}=t,n=Y1(t,["children"]);return l.createElement(ic.Provider,{value:l.useMemo(()=>n,[n])},e)},b3=t=>{const{getPrefixCls:e,direction:n}=l.useContext(Qt),{size:r,direction:i,block:o,prefixCls:a,className:s,rootClassName:A,children:c}=t,u=Y1(t,["size","direction","block","prefixCls","className","rootClassName","children"]),d=Ui(I=>r??I),f=e("space-compact",a),[p,v]=N1(f),C=Ae(f,v,{[`${f}-rtl`]:n==="rtl",[`${f}-block`]:o,[`${f}-vertical`]:i==="vertical"},s,A),m=l.useContext(ic),y=Pr(c),w=l.useMemo(()=>y.map((I,O)=>{const x=(I==null?void 0:I.key)||`${f}-item-${O}`;return l.createElement(E3,{key:x,compactSize:d,compactDirection:i,isFirstItem:O===0&&(!m||(m==null?void 0:m.isFirstItem)),isLastItem:O===y.length-1&&(!m||(m==null?void 0:m.isLastItem))},I)}),[r,y,m]);return y.length===0?null:p(l.createElement("div",Object.assign({className:C},u),w))},Ua=t=>{const{space:e,form:n,children:r}=t;if(r==null)return null;let i=r;return n&&(i=N.createElement(i3,{override:!0,status:!0},i)),e&&(i=N.createElement(y3,null,i)),i};var S3={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm127.98 274.82h-.04l-.08.06L512 466.75 384.14 338.88c-.04-.05-.06-.06-.08-.06a.12.12 0 00-.07 0c-.03 0-.05.01-.09.05l-45.02 45.02a.2.2 0 00-.05.09.12.12 0 000 .07v.02a.27.27 0 00.06.06L466.75 512 338.88 639.86c-.05.04-.06.06-.06.08a.12.12 0 000 .07c0 .03.01.05.05.09l45.02 45.02a.2.2 0 00.09.05.12.12 0 00.07 0c.02 0 .04-.01.08-.05L512 557.25l127.86 127.87c.04.04.06.05.08.05a.12.12 0 00.07 0c.03 0 .05-.01.09-.05l45.02-45.02a.2.2 0 00.05-.09.12.12 0 000-.07v-.02a.27.27 0 00-.05-.06L557.25 512l127.87-127.86c.04-.04.05-.06.05-.08a.12.12 0 000-.07c0-.03-.01-.05-.05-.09l-45.02-45.02a.2.2 0 00-.09-.05.12.12 0 00-.07 0z"}}]},name:"close-circle",theme:"filled"};function W1(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}function w3(t){return W1(t)instanceof ShadowRoot}function SA(t){return w3(t)?W1(t):null}function I3(t){return t.replace(/-(.)/g,function(e,n){return n.toUpperCase()})}function x3(t,e){yt(t,"[@ant-design/icons] ".concat(e))}function zp(t){return et(t)==="object"&&typeof t.name=="string"&&typeof t.theme=="string"&&(et(t.icon)==="object"||typeof t.icon=="function")}function Yp(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Object.keys(t).reduce(function(e,n){var r=t[n];switch(n){case"class":e.className=r,delete e.class;break;default:delete e[n],e[I3(n)]=r}return e},{})}function dd(t,e,n){return n?N.createElement(t.tag,L(L({key:e},Yp(t.attrs)),n),(t.children||[]).map(function(r,i){return dd(r,"".concat(e,"-").concat(t.tag,"-").concat(i))})):N.createElement(t.tag,L({key:e},Yp(t.attrs)),(t.children||[]).map(function(r,i){return dd(r,"".concat(e,"-").concat(t.tag,"-").concat(i))}))}function J1(t){return Ba(t)[0]}function _1(t){return t?Array.isArray(t)?t:[t]:[]}var R3=`
533
+ onLoadStart onPause onPlay onPlaying onProgress onRateChange onSeeked onSeeking onStalled onSuspend onTimeUpdate onVolumeChange onWaiting onLoad onError`,Q6="".concat(k6," ").concat(P6).split(/[\s\n]+/),j6="aria-",L6="data-";function Tp(t,e){return t.indexOf(e)===0}function ki(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n;e===!1?n={aria:!0,data:!0,attr:!0}:e===!0?n={aria:!0}:n=L({},e);var r={};return Object.keys(t).forEach(function(i){(n.aria&&(i==="role"||Tp(i,j6))||n.data&&Tp(i,L6)||n.attr&&Q6.includes(i))&&(r[i]=t[i])}),r}const Ur=t=>{const[,,,,e]=dr();return e?`${t}-css-var`:""},Ui=t=>{const e=N.useContext(Uo);return N.useMemo(()=>t?typeof t=="string"?t??e:t instanceof Function?t(e):e:e,[t,e])},D1=l.createContext(null),U6=D1.Provider,B1=l.createContext(null),H6=B1.Provider;var G6=["prefixCls","className","style","checked","disabled","defaultChecked","type","title","onChange"],q6=N.forwardRef(function(t,e){var n=t.prefixCls,r=n===void 0?"rc-checkbox":n,i=t.className,o=t.style,a=t.checked,s=t.disabled,A=t.defaultChecked,c=A===void 0?!1:A,u=t.type,d=u===void 0?"checkbox":u,f=t.title,p=t.onChange,v=Et(t,G6),C=N.useRef(null),m=N.useRef(null),y=Fn(c,{value:a}),w=ee(y,2),I=w[0],O=w[1];N.useImperativeHandle(e,function(){return{focus:function(E){var b;(b=C.current)===null||b===void 0||b.focus(E)},blur:function(){var E;(E=C.current)===null||E===void 0||E.blur()},input:C.current,nativeElement:m.current}});var x=Ae(r,i,Q(Q({},"".concat(r,"-checked"),I),"".concat(r,"-disabled"),s)),g=function(E){s||("checked"in t||O(E.target.checked),p==null||p({target:L(L({},t),{},{type:d,checked:E.target.checked}),stopPropagation:function(){E.stopPropagation()},preventDefault:function(){E.preventDefault()},nativeEvent:E.nativeEvent}))};return l.createElement("span",{className:x,title:f,style:o,ref:m},l.createElement("input",Qe({},v,{className:"".concat(r,"-input"),ref:C,onChange:g,disabled:s,checked:!!I,type:d})),l.createElement("span",{className:"".concat(r,"-inner")}))});const Af=function(t){if(!t)return!1;if(t instanceof Element){if(t.offsetParent)return!0;if(t.getBBox){var e=t.getBBox(),n=e.width,r=e.height;if(n||r)return!0}if(t.getBoundingClientRect){var i=t.getBoundingClientRect(),o=i.width,a=i.height;if(o||a)return!0}}return!1};function F1(t){return t&&N.isValidElement(t)&&t.type===N.Fragment}const k1=(t,e,n)=>N.isValidElement(t)?N.cloneElement(t,typeof n=="function"?n(t.props||{}):n):e;function kr(t,e){return k1(t,t,e)}const Z6=t=>{const{componentCls:e,colorPrimary:n}=t;return{[e]:{position:"absolute",background:"transparent",pointerEvents:"none",boxSizing:"border-box",color:`var(--wave-color, ${n})`,boxShadow:"0 0 0 0 currentcolor",opacity:.2,"&.wave-motion-appear":{transition:[`box-shadow 0.4s ${t.motionEaseOutCirc}`,`opacity 2s ${t.motionEaseOutCirc}`].join(","),"&-active":{boxShadow:"0 0 0 6px currentcolor",opacity:0},"&.wave-quick":{transition:[`box-shadow ${t.motionDurationSlow} ${t.motionEaseInOut}`,`opacity ${t.motionDurationSlow} ${t.motionEaseInOut}`].join(",")}}}}},K6=Hb("Wave",t=>[Z6(t)]),cf=`${Fa}-wave-target`;function P1(t,e){this.v=t,this.k=e}function Qn(t,e,n,r){var i=Object.defineProperty;try{i({},"",{})}catch{i=0}Qn=function(a,s,A,c){if(s)i?i(a,s,{value:A,enumerable:!c,configurable:!c,writable:!c}):a[s]=A;else{var u=function(f,p){Qn(a,f,function(v){return this._invoke(f,p,v)})};u("next",0),u("throw",1),u("return",2)}},Qn(t,e,n,r)}function lf(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var t,e,n=typeof Symbol=="function"?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(p,v,C,m){var y=v&&v.prototype instanceof s?v:s,w=Object.create(y.prototype);return Qn(w,"_invoke",function(I,O,x){var g,M,E,b=0,h=x||[],S=!1,T={p:0,n:0,v:t,a:R,f:R.bind(t,4),d:function(B,k){return g=B,M=0,E=t,T.n=k,a}};function R(D,B){for(M=D,E=B,e=0;!S&&b&&!k&&e<h.length;e++){var k,P=h[e],H=T.p,Z=P[2];D>3?(k=Z===B)&&(E=P[(M=P[4])?5:(M=3,3)],P[4]=P[5]=t):P[0]<=H&&((k=D<2&&H<P[1])?(M=0,T.v=B,T.n=P[1]):H<Z&&(k=D<3||P[0]>B||B>Z)&&(P[4]=D,P[5]=B,T.n=Z,M=0))}if(k||D>1)return a;throw S=!0,B}return function(D,B,k){if(b>1)throw TypeError("Generator is already running");for(S&&B===1&&R(B,k),M=B,E=k;(e=M<2?t:E)||!S;){g||(M?M<3?(M>1&&(T.n=-1),R(M,E)):T.n=E:T.v=E);try{if(b=2,g){if(M||(D="next"),e=g[D]){if(!(e=e.call(g,E)))throw TypeError("iterator result is not an object");if(!e.done)return e;E=e.value,M<2&&(M=0)}else M===1&&(e=g.return)&&e.call(g),M<2&&(E=TypeError("The iterator does not provide a '"+D+"' method"),M=1);g=t}else if((e=(S=T.n<0)?E:I.call(O,T))!==a)break}catch(P){g=t,M=1,E=P}finally{b=1}}return{value:e,done:S}}}(p,C,m),!0),w}var a={};function s(){}function A(){}function c(){}e=Object.getPrototypeOf;var u=[][r]?e(e([][r]())):(Qn(e={},r,function(){return this}),e),d=c.prototype=s.prototype=Object.create(u);function f(p){return Object.setPrototypeOf?Object.setPrototypeOf(p,c):(p.__proto__=c,Qn(p,i,"GeneratorFunction")),p.prototype=Object.create(d),p}return A.prototype=c,Qn(d,"constructor",c),Qn(c,"constructor",A),A.displayName="GeneratorFunction",Qn(c,i,"GeneratorFunction"),Qn(d),Qn(d,i,"Generator"),Qn(d,r,function(){return this}),Qn(d,"toString",function(){return"[object Generator]"}),(lf=function(){return{w:o,m:f}})()}function CA(t,e){function n(i,o,a,s){try{var A=t[i](o),c=A.value;return c instanceof P1?e.resolve(c.v).then(function(u){n("next",u,a,s)},function(u){n("throw",u,a,s)}):e.resolve(c).then(function(u){A.value=u,a(A)},function(u){return n("throw",u,a,s)})}catch(u){s(u)}}var r;this.next||(Qn(CA.prototype),Qn(CA.prototype,typeof Symbol=="function"&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),Qn(this,"_invoke",function(i,o,a){function s(){return new e(function(A,c){n(i,a,A,c)})}return r=r?r.then(s,s):s()},!0)}function Q1(t,e,n,r,i){return new CA(lf().w(t,e,n,r),i||Promise)}function V6(t,e,n,r,i){var o=Q1(t,e,n,r,i);return o.next().then(function(a){return a.done?a.value:o.next()})}function z6(t){var e=Object(t),n=[];for(var r in e)n.unshift(r);return function i(){for(;n.length;)if((r=n.pop())in e)return i.value=r,i.done=!1,i;return i.done=!0,i}}function Np(t){if(t!=null){var e=t[typeof Symbol=="function"&&Symbol.iterator||"@@iterator"],n=0;if(e)return e.call(t);if(typeof t.next=="function")return t;if(!isNaN(t.length))return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}}throw new TypeError(et(t)+" is not iterable")}function Un(){var t=lf(),e=t.m(Un),n=(Object.getPrototypeOf?Object.getPrototypeOf(e):e.__proto__).constructor;function r(a){var s=typeof a=="function"&&a.constructor;return!!s&&(s===n||(s.displayName||s.name)==="GeneratorFunction")}var i={throw:1,return:2,break:3,continue:3};function o(a){var s,A;return function(c){s||(s={stop:function(){return A(c.a,2)},catch:function(){return c.v},abrupt:function(d,f){return A(c.a,i[d],f)},delegateYield:function(d,f,p){return s.resultName=f,A(c.d,Np(d),p)},finish:function(d){return A(c.f,d)}},A=function(d,f,p){c.p=s.prev,c.n=s.next;try{return d(f,p)}finally{s.next=c.n}}),s.resultName&&(s[s.resultName]=c.v,s.resultName=void 0),s.sent=c.v,s.next=c.n;try{return a.call(this,s)}finally{c.p=s.prev,c.n=s.next}}}return(Un=function(){return{wrap:function(A,c,u,d){return t.w(o(A),c,u,d&&d.reverse())},isGeneratorFunction:r,mark:t.m,awrap:function(A,c){return new P1(A,c)},AsyncIterator:CA,async:function(A,c,u,d,f){return(r(c)?Q1:V6)(o(A),c,u,d,f)},keys:z6,values:Np}})()}function Dp(t,e,n,r,i,o,a){try{var s=t[o](a),A=s.value}catch(c){return void n(c)}s.done?e(A):Promise.resolve(A).then(r,i)}function fo(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function a(A){Dp(o,r,i,a,s,"next",A)}function s(A){Dp(o,r,i,a,s,"throw",A)}a(void 0)})}}var ns=L({},Jm),Y6=ns.version,tl=ns.render,W6=ns.unmountComponentAtNode,tc;try{var J6=Number((Y6||"").split(".")[0]);J6>=18&&(tc=ns.createRoot)}catch{}function Bp(t){var e=ns.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;e&&et(e)==="object"&&(e.usingClientEntryPoint=t)}var yA="__rc_react_root__";function _6(t,e){Bp(!0);var n=e[yA]||tc(e);Bp(!1),n.render(t),e[yA]=n}function $6(t,e){tl==null||tl(t,e)}function X6(t,e){if(tc){_6(t,e);return}$6(t,e)}function ex(t){return ed.apply(this,arguments)}function ed(){return ed=fo(Un().mark(function t(e){return Un().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",Promise.resolve().then(function(){var i;(i=e[yA])===null||i===void 0||i.unmount(),delete e[yA]}));case 1:case"end":return r.stop()}},t)})),ed.apply(this,arguments)}function tx(t){W6(t)}function nx(t){return td.apply(this,arguments)}function td(){return td=fo(Un().mark(function t(e){return Un().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(tc===void 0){r.next=2;break}return r.abrupt("return",ex(e));case 2:tx(e);case 3:case"end":return r.stop()}},t)})),td.apply(this,arguments)}const rx=(t,e)=>{if(process.env.NODE_ENV!=="production"){const n=parseInt(l.version.split(".")[0],10),r=Object.keys(Jm);process.env.NODE_ENV!=="production"&&exports.warning$1(n<19||r.includes("createRoot"),"compatible","antd v5 support React is 16 ~ 18. see https://u.ant.design/v5-for-19 for compatible.")}return X6(t,e),()=>nx(e)};let ix=rx;function uf(){return ix}function nl(t){return t&&t!=="#fff"&&t!=="#ffffff"&&t!=="rgb(255, 255, 255)"&&t!=="rgba(255, 255, 255, 1)"&&!/rgba\((?:\d*, ){3}0\)/.test(t)&&t!=="transparent"}function ox(t){const{borderTopColor:e,borderColor:n,backgroundColor:r}=getComputedStyle(t);return nl(e)?e:nl(n)?n:nl(r)?r:null}function rl(t){return Number.isNaN(t)?0:t}const ax=t=>{const{className:e,target:n,component:r,registerUnmount:i}=t,o=l.useRef(null),a=l.useRef(null);l.useEffect(()=>{a.current=i()},[]);const[s,A]=l.useState(null),[c,u]=l.useState([]),[d,f]=l.useState(0),[p,v]=l.useState(0),[C,m]=l.useState(0),[y,w]=l.useState(0),[I,O]=l.useState(!1),x={left:d,top:p,width:C,height:y,borderRadius:c.map(E=>`${E}px`).join(" ")};s&&(x["--wave-color"]=s);function g(){const E=getComputedStyle(n);A(ox(n));const b=E.position==="static",{borderLeftWidth:h,borderTopWidth:S}=E;f(b?n.offsetLeft:rl(-parseFloat(h))),v(b?n.offsetTop:rl(-parseFloat(S))),m(n.offsetWidth),w(n.offsetHeight);const{borderTopLeftRadius:T,borderTopRightRadius:R,borderBottomLeftRadius:D,borderBottomRightRadius:B}=E;u([T,R,B,D].map(k=>rl(parseFloat(k))))}if(l.useEffect(()=>{if(n){const E=qt(()=>{g(),O(!0)});let b;return typeof ResizeObserver<"u"&&(b=new ResizeObserver(g),b.observe(n)),()=>{qt.cancel(E),b==null||b.disconnect()}}},[]),!I)return null;const M=(r==="Checkbox"||r==="Radio")&&(n==null?void 0:n.classList.contains(cf));return l.createElement(lo,{visible:!0,motionAppear:!0,motionName:"wave-motion",motionDeadline:5e3,onAppearEnd:(E,b)=>{var h,S;if(b.deadline||b.propertyName==="opacity"){const T=(h=o.current)===null||h===void 0?void 0:h.parentElement;(S=a.current)===null||S===void 0||S.call(a).then(()=>{T==null||T.remove()})}return!1}},(E,b)=>{let{className:h}=E;return l.createElement("div",{ref:Lr(o,b),className:Ae(e,h,{"wave-quick":M}),style:x})})},sx=(t,e)=>{var n;const{component:r}=e;if(r==="Checkbox"&&!(!((n=t.querySelector("input"))===null||n===void 0)&&n.checked))return;const i=document.createElement("div");i.style.position="absolute",i.style.left="0px",i.style.top="0px",t==null||t.insertBefore(i,t==null?void 0:t.firstChild);const o=uf();let a=null;function s(){return a}a=o(l.createElement(ax,Object.assign({},e,{target:t,registerUnmount:s})),i)},Ax=(t,e,n)=>{const{wave:r}=l.useContext(Qt),[,i,o]=dr(),a=rn(c=>{const u=t.current;if(r!=null&&r.disabled||!u)return;const d=u.querySelector(`.${cf}`)||u,{showEffect:f}=r||{};(f||sx)(d,{className:e,token:i,component:n,event:c,hashId:o})}),s=l.useRef(null);return c=>{qt.cancel(s.current),s.current=qt(()=>{a(c)})}},nc=t=>{const{children:e,disabled:n,component:r}=t,{getPrefixCls:i}=N.useContext(Qt),o=N.useRef(null),a=i("wave"),[,s]=K6(a),A=Ax(o,Ae(a,s),r);if(N.useEffect(()=>{const u=o.current;if(!u||u.nodeType!==1||n)return;const d=f=>{!Af(f.target)||!u.getAttribute||u.getAttribute("disabled")||u.disabled||u.className.includes("disabled")||u.className.includes("-leave")||A(f)};return u.addEventListener("click",d,!0),()=>{u.removeEventListener("click",d,!0)}},[n]),!N.isValidElement(e))return e??null;const c=Li(e)?Lr(co(e),o):o;return kr(e,{ref:c})};process.env.NODE_ENV!=="production"&&(nc.displayName="Wave");function cx(t){const e=N.useRef(null),n=()=>{qt.cancel(e.current),e.current=null};return[()=>{n(),e.current=qt(()=>{e.current=null})},o=>{e.current&&(o.stopPropagation(),n()),t==null||t(o)}]}function Pr(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=[];return N.Children.forEach(t,function(r){r==null&&!e.keepEmpty||(Array.isArray(r)?n=n.concat(Pr(r)):xv(r)&&r.props?n=n.concat(Pr(r.props.children,e)):n.push(r))}),n}var Ji="RC_FORM_INTERNAL_HOOKS",Yt=function(){yt(!1,"Can not find FormContext. Please make sure you wrap Field under Form.")},Yo=l.createContext({getFieldValue:Yt,getFieldsValue:Yt,getFieldError:Yt,getFieldWarning:Yt,getFieldsError:Yt,isFieldsTouched:Yt,isFieldTouched:Yt,isFieldValidating:Yt,isFieldsValidating:Yt,resetFields:Yt,setFields:Yt,setFieldValue:Yt,setFieldsValue:Yt,validateFields:Yt,submit:Yt,getInternalHooks:function(){return Yt(),{dispatch:Yt,initEntityValue:Yt,registerField:Yt,useSubscribe:Yt,setInitialValues:Yt,destroyForm:Yt,setCallbacks:Yt,registerWatch:Yt,getFields:Yt,setValidateMessages:Yt,setPreserve:Yt,getInitialValue:Yt}}}),EA=l.createContext(null);function nd(t){return t==null?[]:Array.isArray(t)?t:[t]}function lx(t){return t&&!!t._init}function rd(){return{default:"Validation error on field %s",required:"%s is required",enum:"%s must be one of %s",whitespace:"%s cannot be empty",date:{format:"%s date %s is invalid for format %s",parse:"%s date could not be parsed, %s is invalid ",invalid:"%s date %s is invalid"},types:{string:"%s is not a %s",method:"%s is not a %s (function)",array:"%s is not an %s",object:"%s is not an %s",number:"%s is not a %s",date:"%s is not a %s",boolean:"%s is not a %s",integer:"%s is not an %s",float:"%s is not a %s",regexp:"%s is not a valid %s",email:"%s is not a valid %s",url:"%s is not a valid %s",hex:"%s is not a valid %s"},string:{len:"%s must be exactly %s characters",min:"%s must be at least %s characters",max:"%s cannot be longer than %s characters",range:"%s must be between %s and %s characters"},number:{len:"%s must equal %s",min:"%s cannot be less than %s",max:"%s cannot be greater than %s",range:"%s must be between %s and %s"},array:{len:"%s must be exactly %s in length",min:"%s cannot be less than %s in length",max:"%s cannot be greater than %s in length",range:"%s must be between %s and %s in length"},pattern:{mismatch:"%s value %s does not match pattern %s"},clone:function(){var e=JSON.parse(JSON.stringify(this));return e.clone=this.clone,e}}}var id=rd();function ux(t){try{return Function.toString.call(t).indexOf("[native code]")!==-1}catch{return typeof t=="function"}}function dx(t,e,n){if(Dd())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var i=new(t.bind.apply(t,r));return n&&Ma(i,n.prototype),i}function od(t){var e=typeof Map=="function"?new Map:void 0;return od=function(r){if(r===null||!ux(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(e!==void 0){if(e.has(r))return e.get(r);e.set(r,i)}function i(){return dx(r,arguments,Ta(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Ma(i,r)},od(t)}var fx=/%[sdj%]/g,j1=function(){};typeof process<"u"&&process.env&&process.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof document<"u"&&(j1=function(e,n){typeof console<"u"&&console.warn&&typeof ASYNC_VALIDATOR_NO_WARNING>"u"&&n.every(function(r){return typeof r=="string"})&&console.warn(e,n)});function ad(t){if(!t||!t.length)return null;var e={};return t.forEach(function(n){var r=n.field;e[r]=e[r]||[],e[r].push(n)}),e}function lr(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];var i=0,o=n.length;if(typeof t=="function")return t.apply(null,n);if(typeof t=="string"){var a=t.replace(fx,function(s){if(s==="%%")return"%";if(i>=o)return s;switch(s){case"%s":return String(n[i++]);case"%d":return Number(n[i++]);case"%j":try{return JSON.stringify(n[i++])}catch{return"[Circular]"}break;default:return s}});return a}return t}function gx(t){return t==="string"||t==="url"||t==="hex"||t==="email"||t==="date"||t==="pattern"}function Sn(t,e){return!!(t==null||e==="array"&&Array.isArray(t)&&!t.length||gx(e)&&typeof t=="string"&&!t)}function hx(t,e,n){var r=[],i=0,o=t.length;function a(s){r.push.apply(r,Re(s||[])),i++,i===o&&n(r)}t.forEach(function(s){e(s,a)})}function Fp(t,e,n){var r=0,i=t.length;function o(a){if(a&&a.length){n(a);return}var s=r;r=r+1,s<i?e(t[s],o):n([])}o([])}function px(t){var e=[];return Object.keys(t).forEach(function(n){e.push.apply(e,Re(t[n]||[]))}),e}var kp=function(t){fi(n,t);var e=gi(n);function n(r,i){var o;return pn(this,n),o=e.call(this,"Async Validation Error"),Q(Ot(o),"errors",void 0),Q(Ot(o),"fields",void 0),o.errors=r,o.fields=i,o}return mn(n)}(od(Error));function mx(t,e,n,r,i){if(e.first){var o=new Promise(function(f,p){var v=function(y){return r(y),y.length?p(new kp(y,ad(y))):f(i)},C=px(t);Fp(C,n,v)});return o.catch(function(f){return f}),o}var a=e.firstFields===!0?Object.keys(t):e.firstFields||[],s=Object.keys(t),A=s.length,c=0,u=[],d=new Promise(function(f,p){var v=function(m){if(u.push.apply(u,m),c++,c===A)return r(u),u.length?p(new kp(u,ad(u))):f(i)};s.length||(r(u),f(i)),s.forEach(function(C){var m=t[C];a.indexOf(C)!==-1?Fp(m,n,v):hx(m,n,v)})});return d.catch(function(f){return f}),d}function vx(t){return!!(t&&t.message!==void 0)}function Cx(t,e){for(var n=t,r=0;r<e.length;r++){if(n==null)return n;n=n[e[r]]}return n}function Pp(t,e){return function(n){var r;return t.fullFields?r=Cx(e,t.fullFields):r=e[n.field||t.fullField],vx(n)?(n.field=n.field||t.fullField,n.fieldValue=r,n):{message:typeof n=="function"?n():n,fieldValue:r,field:n.field||t.fullField}}}function Qp(t,e){if(e){for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];et(r)==="object"&&et(t[n])==="object"?t[n]=L(L({},t[n]),r):t[n]=r}}return t}var vo="enum",yx=function(e,n,r,i,o){e[vo]=Array.isArray(e[vo])?e[vo]:[],e[vo].indexOf(n)===-1&&i.push(lr(o.messages[vo],e.fullField,e[vo].join(", ")))},Ex=function(e,n,r,i,o){if(e.pattern){if(e.pattern instanceof RegExp)e.pattern.lastIndex=0,e.pattern.test(n)||i.push(lr(o.messages.pattern.mismatch,e.fullField,n,e.pattern));else if(typeof e.pattern=="string"){var a=new RegExp(e.pattern);a.test(n)||i.push(lr(o.messages.pattern.mismatch,e.fullField,n,e.pattern))}}},bx=function(e,n,r,i,o){var a=typeof e.len=="number",s=typeof e.min=="number",A=typeof e.max=="number",c=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,u=n,d=null,f=typeof n=="number",p=typeof n=="string",v=Array.isArray(n);if(f?d="number":p?d="string":v&&(d="array"),!d)return!1;v&&(u=n.length),p&&(u=n.replace(c,"_").length),a?u!==e.len&&i.push(lr(o.messages[d].len,e.fullField,e.len)):s&&!A&&u<e.min?i.push(lr(o.messages[d].min,e.fullField,e.min)):A&&!s&&u>e.max?i.push(lr(o.messages[d].max,e.fullField,e.max)):s&&A&&(u<e.min||u>e.max)&&i.push(lr(o.messages[d].range,e.fullField,e.min,e.max))},L1=function(e,n,r,i,o,a){e.required&&(!r.hasOwnProperty(e.field)||Sn(n,a||e.type))&&i.push(lr(o.messages.required,e.fullField))},Fs;const Sx=function(){if(Fs)return Fs;var t="[a-fA-F\\d:]",e=function(g){return g&&g.includeBoundaries?"(?:(?<=\\s|^)(?=".concat(t,")|(?<=").concat(t,")(?=\\s|$))"):""},n="(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}",r="[a-fA-F\\d]{1,4}",i=["(?:".concat(r,":){7}(?:").concat(r,"|:)"),"(?:".concat(r,":){6}(?:").concat(n,"|:").concat(r,"|:)"),"(?:".concat(r,":){5}(?::").concat(n,"|(?::").concat(r,"){1,2}|:)"),"(?:".concat(r,":){4}(?:(?::").concat(r,"){0,1}:").concat(n,"|(?::").concat(r,"){1,3}|:)"),"(?:".concat(r,":){3}(?:(?::").concat(r,"){0,2}:").concat(n,"|(?::").concat(r,"){1,4}|:)"),"(?:".concat(r,":){2}(?:(?::").concat(r,"){0,3}:").concat(n,"|(?::").concat(r,"){1,5}|:)"),"(?:".concat(r,":){1}(?:(?::").concat(r,"){0,4}:").concat(n,"|(?::").concat(r,"){1,6}|:)"),"(?::(?:(?::".concat(r,"){0,5}:").concat(n,"|(?::").concat(r,"){1,7}|:))")],o="(?:%[0-9a-zA-Z]{1,})?",a="(?:".concat(i.join("|"),")").concat(o),s=new RegExp("(?:^".concat(n,"$)|(?:^").concat(a,"$)")),A=new RegExp("^".concat(n,"$")),c=new RegExp("^".concat(a,"$")),u=function(g){return g&&g.exact?s:new RegExp("(?:".concat(e(g)).concat(n).concat(e(g),")|(?:").concat(e(g)).concat(a).concat(e(g),")"),"g")};u.v4=function(x){return x&&x.exact?A:new RegExp("".concat(e(x)).concat(n).concat(e(x)),"g")},u.v6=function(x){return x&&x.exact?c:new RegExp("".concat(e(x)).concat(a).concat(e(x)),"g")};var d="(?:(?:[a-z]+:)?//)",f="(?:\\S+(?::\\S*)?@)?",p=u.v4().source,v=u.v6().source,C="(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)",m="(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*",y="(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))",w="(?::\\d{2,5})?",I='(?:[/?#][^\\s"]*)?',O="(?:".concat(d,"|www\\.)").concat(f,"(?:localhost|").concat(p,"|").concat(v,"|").concat(C).concat(m).concat(y,")").concat(w).concat(I);return Fs=new RegExp("(?:^".concat(O,"$)"),"i"),Fs};var jp={email:/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/,hex:/^#?([a-f0-9]{6}|[a-f0-9]{3})$/i},va={integer:function(e){return va.number(e)&&parseInt(e,10)===e},float:function(e){return va.number(e)&&!va.integer(e)},array:function(e){return Array.isArray(e)},regexp:function(e){if(e instanceof RegExp)return!0;try{return!!new RegExp(e)}catch{return!1}},date:function(e){return typeof e.getTime=="function"&&typeof e.getMonth=="function"&&typeof e.getYear=="function"&&!isNaN(e.getTime())},number:function(e){return isNaN(e)?!1:typeof e=="number"},object:function(e){return et(e)==="object"&&!va.array(e)},method:function(e){return typeof e=="function"},email:function(e){return typeof e=="string"&&e.length<=320&&!!e.match(jp.email)},url:function(e){return typeof e=="string"&&e.length<=2048&&!!e.match(Sx())},hex:function(e){return typeof e=="string"&&!!e.match(jp.hex)}},wx=function(e,n,r,i,o){if(e.required&&n===void 0){L1(e,n,r,i,o);return}var a=["integer","float","array","regexp","object","method","email","number","date","url","hex"],s=e.type;a.indexOf(s)>-1?va[s](n)||i.push(lr(o.messages.types[s],e.fullField,e.type)):s&&et(n)!==e.type&&i.push(lr(o.messages.types[s],e.fullField,e.type))},Ix=function(e,n,r,i,o){(/^\s+$/.test(n)||n==="")&&i.push(lr(o.messages.whitespace,e.fullField))};const Dt={required:L1,whitespace:Ix,type:wx,range:bx,enum:yx,pattern:Ex};var xx=function(e,n,r,i,o){var a=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(Sn(n)&&!e.required)return r();Dt.required(e,n,i,a,o)}r(a)},Rx=function(e,n,r,i,o){var a=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(n==null&&!e.required)return r();Dt.required(e,n,i,a,o,"array"),n!=null&&(Dt.type(e,n,i,a,o),Dt.range(e,n,i,a,o))}r(a)},Ox=function(e,n,r,i,o){var a=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(Sn(n)&&!e.required)return r();Dt.required(e,n,i,a,o),n!==void 0&&Dt.type(e,n,i,a,o)}r(a)},Mx=function(e,n,r,i,o){var a=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(Sn(n,"date")&&!e.required)return r();if(Dt.required(e,n,i,a,o),!Sn(n,"date")){var A;n instanceof Date?A=n:A=new Date(n),Dt.type(e,A,i,a,o),A&&Dt.range(e,A.getTime(),i,a,o)}}r(a)},Tx="enum",Nx=function(e,n,r,i,o){var a=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(Sn(n)&&!e.required)return r();Dt.required(e,n,i,a,o),n!==void 0&&Dt[Tx](e,n,i,a,o)}r(a)},Dx=function(e,n,r,i,o){var a=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(Sn(n)&&!e.required)return r();Dt.required(e,n,i,a,o),n!==void 0&&(Dt.type(e,n,i,a,o),Dt.range(e,n,i,a,o))}r(a)},Bx=function(e,n,r,i,o){var a=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(Sn(n)&&!e.required)return r();Dt.required(e,n,i,a,o),n!==void 0&&(Dt.type(e,n,i,a,o),Dt.range(e,n,i,a,o))}r(a)},Fx=function(e,n,r,i,o){var a=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(Sn(n)&&!e.required)return r();Dt.required(e,n,i,a,o),n!==void 0&&Dt.type(e,n,i,a,o)}r(a)},kx=function(e,n,r,i,o){var a=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(n===""&&(n=void 0),Sn(n)&&!e.required)return r();Dt.required(e,n,i,a,o),n!==void 0&&(Dt.type(e,n,i,a,o),Dt.range(e,n,i,a,o))}r(a)},Px=function(e,n,r,i,o){var a=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(Sn(n)&&!e.required)return r();Dt.required(e,n,i,a,o),n!==void 0&&Dt.type(e,n,i,a,o)}r(a)},Qx=function(e,n,r,i,o){var a=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(Sn(n,"string")&&!e.required)return r();Dt.required(e,n,i,a,o),Sn(n,"string")||Dt.pattern(e,n,i,a,o)}r(a)},jx=function(e,n,r,i,o){var a=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(Sn(n)&&!e.required)return r();Dt.required(e,n,i,a,o),Sn(n)||Dt.type(e,n,i,a,o)}r(a)},Lx=function(e,n,r,i,o){var a=[],s=Array.isArray(n)?"array":et(n);Dt.required(e,n,i,a,o,s),r(a)},Ux=function(e,n,r,i,o){var a=[],s=e.required||!e.required&&i.hasOwnProperty(e.field);if(s){if(Sn(n,"string")&&!e.required)return r();Dt.required(e,n,i,a,o,"string"),Sn(n,"string")||(Dt.type(e,n,i,a,o),Dt.range(e,n,i,a,o),Dt.pattern(e,n,i,a,o),e.whitespace===!0&&Dt.whitespace(e,n,i,a,o))}r(a)},il=function(e,n,r,i,o){var a=e.type,s=[],A=e.required||!e.required&&i.hasOwnProperty(e.field);if(A){if(Sn(n,a)&&!e.required)return r();Dt.required(e,n,i,s,o,a),Sn(n,a)||Dt.type(e,n,i,s,o)}r(s)};const Sa={string:Ux,method:Fx,number:kx,boolean:Ox,regexp:jx,integer:Bx,float:Dx,array:Rx,object:Px,enum:Nx,pattern:Qx,date:Mx,url:il,hex:il,email:il,required:Lx,any:xx};var rs=function(){function t(e){pn(this,t),Q(this,"rules",null),Q(this,"_messages",id),this.define(e)}return mn(t,[{key:"define",value:function(n){var r=this;if(!n)throw new Error("Cannot configure a schema with no rules");if(et(n)!=="object"||Array.isArray(n))throw new Error("Rules must be an object");this.rules={},Object.keys(n).forEach(function(i){var o=n[i];r.rules[i]=Array.isArray(o)?o:[o]})}},{key:"messages",value:function(n){return n&&(this._messages=Qp(rd(),n)),this._messages}},{key:"validate",value:function(n){var r=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){},a=n,s=i,A=o;if(typeof s=="function"&&(A=s,s={}),!this.rules||Object.keys(this.rules).length===0)return A&&A(null,a),Promise.resolve(a);function c(v){var C=[],m={};function y(I){if(Array.isArray(I)){var O;C=(O=C).concat.apply(O,Re(I))}else C.push(I)}for(var w=0;w<v.length;w++)y(v[w]);C.length?(m=ad(C),A(C,m)):A(null,a)}if(s.messages){var u=this.messages();u===id&&(u=rd()),Qp(u,s.messages),s.messages=u}else s.messages=this.messages();var d={},f=s.keys||Object.keys(this.rules);f.forEach(function(v){var C=r.rules[v],m=a[v];C.forEach(function(y){var w=y;typeof w.transform=="function"&&(a===n&&(a=L({},a)),m=a[v]=w.transform(m),m!=null&&(w.type=w.type||(Array.isArray(m)?"array":et(m)))),typeof w=="function"?w={validator:w}:w=L({},w),w.validator=r.getValidationMethod(w),w.validator&&(w.field=v,w.fullField=w.fullField||v,w.type=r.getType(w),d[v]=d[v]||[],d[v].push({rule:w,value:m,source:a,field:v}))})});var p={};return mx(d,s,function(v,C){var m=v.rule,y=(m.type==="object"||m.type==="array")&&(et(m.fields)==="object"||et(m.defaultField)==="object");y=y&&(m.required||!m.required&&v.value),m.field=v.field;function w(M,E){return L(L({},E),{},{fullField:"".concat(m.fullField,".").concat(M),fullFields:m.fullFields?[].concat(Re(m.fullFields),[M]):[M]})}function I(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],E=Array.isArray(M)?M:[M];!s.suppressWarning&&E.length&&t.warning("async-validator:",E),E.length&&m.message!==void 0&&(E=[].concat(m.message));var b=E.map(Pp(m,a));if(s.first&&b.length)return p[m.field]=1,C(b);if(!y)C(b);else{if(m.required&&!v.value)return m.message!==void 0?b=[].concat(m.message).map(Pp(m,a)):s.error&&(b=[s.error(m,lr(s.messages.required,m.field))]),C(b);var h={};m.defaultField&&Object.keys(v.value).map(function(R){h[R]=m.defaultField}),h=L(L({},h),v.rule.fields);var S={};Object.keys(h).forEach(function(R){var D=h[R],B=Array.isArray(D)?D:[D];S[R]=B.map(w.bind(null,R))});var T=new t(S);T.messages(s.messages),v.rule.options&&(v.rule.options.messages=s.messages,v.rule.options.error=s.error),T.validate(v.value,v.rule.options||s,function(R){var D=[];b&&b.length&&D.push.apply(D,Re(b)),R&&R.length&&D.push.apply(D,Re(R)),C(D.length?D:null)})}}var O;if(m.asyncValidator)O=m.asyncValidator(m,v.value,I,v.source,s);else if(m.validator){try{O=m.validator(m,v.value,I,v.source,s)}catch(M){var x,g;(x=(g=console).error)===null||x===void 0||x.call(g,M),s.suppressValidatorError||setTimeout(function(){throw M},0),I(M.message)}O===!0?I():O===!1?I(typeof m.message=="function"?m.message(m.fullField||m.field):m.message||"".concat(m.fullField||m.field," fails")):O instanceof Array?I(O):O instanceof Error&&I(O.message)}O&&O.then&&O.then(function(){return I()},function(M){return I(M)})},function(v){c(v)},a)}},{key:"getType",value:function(n){if(n.type===void 0&&n.pattern instanceof RegExp&&(n.type="pattern"),typeof n.validator!="function"&&n.type&&!Sa.hasOwnProperty(n.type))throw new Error(lr("Unknown rule type %s",n.type));return n.type||"string"}},{key:"getValidationMethod",value:function(n){if(typeof n.validator=="function")return n.validator;var r=Object.keys(n),i=r.indexOf("message");return i!==-1&&r.splice(i,1),r.length===1&&r[0]==="required"?Sa.required:Sa[this.getType(n)]||void 0}}]),t}();Q(rs,"register",function(e,n){if(typeof n!="function")throw new Error("Cannot register a validator by type, validator is not a function");Sa[e]=n});Q(rs,"warning",j1);Q(rs,"messages",id);Q(rs,"validators",Sa);var or="'${name}' is not a valid ${type}",U1={default:"Validation error on field '${name}'",required:"'${name}' is required",enum:"'${name}' must be one of [${enum}]",whitespace:"'${name}' cannot be empty",date:{format:"'${name}' is invalid for format date",parse:"'${name}' could not be parsed as date",invalid:"'${name}' is invalid date"},types:{string:or,method:or,array:or,object:or,number:or,date:or,boolean:or,integer:or,float:or,regexp:or,email:or,url:or,hex:or},string:{len:"'${name}' must be exactly ${len} characters",min:"'${name}' must be at least ${min} characters",max:"'${name}' cannot be longer than ${max} characters",range:"'${name}' must be between ${min} and ${max} characters"},number:{len:"'${name}' must equal ${len}",min:"'${name}' cannot be less than ${min}",max:"'${name}' cannot be greater than ${max}",range:"'${name}' must be between ${min} and ${max}"},array:{len:"'${name}' must be exactly ${len} in length",min:"'${name}' cannot be less than ${min} in length",max:"'${name}' cannot be greater than ${max} in length",range:"'${name}' must be between ${min} and ${max} in length"},pattern:{mismatch:"'${name}' does not match pattern ${pattern}"}},Lp=rs;function Hx(t,e){return t.replace(/\\?\$\{\w+\}/g,function(n){if(n.startsWith("\\"))return n.slice(1);var r=n.slice(2,-1);return e[r]})}var Up="CODE_LOGIC_ERROR";function sd(t,e,n,r,i){return Ad.apply(this,arguments)}function Ad(){return Ad=fo(Un().mark(function t(e,n,r,i,o){var a,s,A,c,u,d,f,p,v;return Un().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:return a=L({},r),delete a.ruleIndex,Lp.warning=function(){},a.validator&&(s=a.validator,a.validator=function(){try{return s.apply(void 0,arguments)}catch(y){return console.error(y),Promise.reject(Up)}}),A=null,a&&a.type==="array"&&a.defaultField&&(A=a.defaultField,delete a.defaultField),c=new Lp(Q({},e,[a])),u=Ro(U1,i.validateMessages),c.messages(u),d=[],m.prev=10,m.next=13,Promise.resolve(c.validate(Q({},e,n),L({},i)));case 13:m.next=18;break;case 15:m.prev=15,m.t0=m.catch(10),m.t0.errors&&(d=m.t0.errors.map(function(y,w){var I=y.message,O=I===Up?u.default:I;return l.isValidElement(O)?l.cloneElement(O,{key:"error_".concat(w)}):O}));case 18:if(!(!d.length&&A)){m.next=23;break}return m.next=21,Promise.all(n.map(function(y,w){return sd("".concat(e,".").concat(w),y,A,i,o)}));case 21:return f=m.sent,m.abrupt("return",f.reduce(function(y,w){return[].concat(Re(y),Re(w))},[]));case 23:return p=L(L({},r),{},{name:e,enum:(r.enum||[]).join(", ")},o),v=d.map(function(y){return typeof y=="string"?Hx(y,p):y}),m.abrupt("return",v);case 26:case"end":return m.stop()}},t,null,[[10,15]])})),Ad.apply(this,arguments)}function Gx(t,e,n,r,i,o){var a=t.join("."),s=n.map(function(u,d){var f=u.validator,p=L(L({},u),{},{ruleIndex:d});return f&&(p.validator=function(v,C,m){var y=!1,w=function(){for(var x=arguments.length,g=new Array(x),M=0;M<x;M++)g[M]=arguments[M];Promise.resolve().then(function(){yt(!y,"Your validator function has already return a promise. `callback` will be ignored."),y||m.apply(void 0,g)})},I=f(v,C,w);y=I&&typeof I.then=="function"&&typeof I.catch=="function",yt(y,"`callback` is deprecated. Please return a promise instead."),y&&I.then(function(){m()}).catch(function(O){m(O||" ")})}),p}).sort(function(u,d){var f=u.warningOnly,p=u.ruleIndex,v=d.warningOnly,C=d.ruleIndex;return!!f==!!v?p-C:f?1:-1}),A;if(i===!0)A=new Promise(function(){var u=fo(Un().mark(function d(f,p){var v,C,m;return Un().wrap(function(w){for(;;)switch(w.prev=w.next){case 0:v=0;case 1:if(!(v<s.length)){w.next=12;break}return C=s[v],w.next=5,sd(a,e,C,r,o);case 5:if(m=w.sent,!m.length){w.next=9;break}return p([{errors:m,rule:C}]),w.abrupt("return");case 9:v+=1,w.next=1;break;case 12:f([]);case 13:case"end":return w.stop()}},d)}));return function(d,f){return u.apply(this,arguments)}}());else{var c=s.map(function(u){return sd(a,e,u,r,o).then(function(d){return{errors:d,rule:u}})});A=(i?Zx(c):qx(c)).then(function(u){return Promise.reject(u)})}return A.catch(function(u){return u}),A}function qx(t){return cd.apply(this,arguments)}function cd(){return cd=fo(Un().mark(function t(e){return Un().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",Promise.all(e).then(function(i){var o,a=(o=[]).concat.apply(o,Re(i));return a}));case 1:case"end":return r.stop()}},t)})),cd.apply(this,arguments)}function Zx(t){return ld.apply(this,arguments)}function ld(){return ld=fo(Un().mark(function t(e){var n;return Un().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return n=0,i.abrupt("return",new Promise(function(o){e.forEach(function(a){a.then(function(s){s.errors.length&&o([s]),n+=1,n===e.length&&o([])})})}));case 2:case"end":return i.stop()}},t)})),ld.apply(this,arguments)}function dn(t){return nd(t)}function Hp(t,e){var n={};return e.forEach(function(r){var i=zr(t,r);n=Mr(n,r,i)}),n}function Fo(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return t&&t.some(function(r){return H1(e,r,n)})}function H1(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return!t||!e||!n&&t.length!==e.length?!1:e.every(function(r,i){return t[i]===r})}function Kx(t,e){if(t===e)return!0;if(!t&&e||t&&!e||!t||!e||et(t)!=="object"||et(e)!=="object")return!1;var n=Object.keys(t),r=Object.keys(e),i=new Set([].concat(n,r));return Re(i).every(function(o){var a=t[o],s=e[o];return typeof a=="function"&&typeof s=="function"?!0:a===s})}function Vx(t){var e=arguments.length<=1?void 0:arguments[1];return e&&e.target&&et(e.target)==="object"&&t in e.target?e.target[t]:e}function Gp(t,e,n){var r=t.length;if(e<0||e>=r||n<0||n>=r)return t;var i=t[e],o=e-n;return o>0?[].concat(Re(t.slice(0,n)),[i],Re(t.slice(n,e)),Re(t.slice(e+1,r))):o<0?[].concat(Re(t.slice(0,e)),Re(t.slice(e+1,n+1)),[i],Re(t.slice(n+1,r))):t}var zx=["name"],Cr=[];function ol(t,e,n,r,i,o){return typeof t=="function"?t(e,n,"source"in o?{source:o.source}:{}):r!==i}var df=function(t){fi(n,t);var e=gi(n);function n(r){var i;if(pn(this,n),i=e.call(this,r),Q(Ot(i),"state",{resetCount:0}),Q(Ot(i),"cancelRegisterFunc",null),Q(Ot(i),"mounted",!1),Q(Ot(i),"touched",!1),Q(Ot(i),"dirty",!1),Q(Ot(i),"validatePromise",void 0),Q(Ot(i),"prevValidating",void 0),Q(Ot(i),"errors",Cr),Q(Ot(i),"warnings",Cr),Q(Ot(i),"cancelRegister",function(){var A=i.props,c=A.preserve,u=A.isListField,d=A.name;i.cancelRegisterFunc&&i.cancelRegisterFunc(u,c,dn(d)),i.cancelRegisterFunc=null}),Q(Ot(i),"getNamePath",function(){var A=i.props,c=A.name,u=A.fieldContext,d=u.prefixName,f=d===void 0?[]:d;return c!==void 0?[].concat(Re(f),Re(c)):[]}),Q(Ot(i),"getRules",function(){var A=i.props,c=A.rules,u=c===void 0?[]:c,d=A.fieldContext;return u.map(function(f){return typeof f=="function"?f(d):f})}),Q(Ot(i),"refresh",function(){i.mounted&&i.setState(function(A){var c=A.resetCount;return{resetCount:c+1}})}),Q(Ot(i),"metaCache",null),Q(Ot(i),"triggerMetaEvent",function(A){var c=i.props.onMetaChange;if(c){var u=L(L({},i.getMeta()),{},{destroy:A});Oa(i.metaCache,u)||c(u),i.metaCache=u}else i.metaCache=null}),Q(Ot(i),"onStoreChange",function(A,c,u){var d=i.props,f=d.shouldUpdate,p=d.dependencies,v=p===void 0?[]:p,C=d.onReset,m=u.store,y=i.getNamePath(),w=i.getValue(A),I=i.getValue(m),O=c&&Fo(c,y);switch(u.type==="valueUpdate"&&u.source==="external"&&!Oa(w,I)&&(i.touched=!0,i.dirty=!0,i.validatePromise=null,i.errors=Cr,i.warnings=Cr,i.triggerMetaEvent()),u.type){case"reset":if(!c||O){i.touched=!1,i.dirty=!1,i.validatePromise=void 0,i.errors=Cr,i.warnings=Cr,i.triggerMetaEvent(),C==null||C(),i.refresh();return}break;case"remove":{if(f&&ol(f,A,m,w,I,u)){i.reRender();return}break}case"setField":{var x=u.data;if(O){"touched"in x&&(i.touched=x.touched),"validating"in x&&!("originRCField"in x)&&(i.validatePromise=x.validating?Promise.resolve([]):null),"errors"in x&&(i.errors=x.errors||Cr),"warnings"in x&&(i.warnings=x.warnings||Cr),i.dirty=!0,i.triggerMetaEvent(),i.reRender();return}else if("value"in x&&Fo(c,y,!0)){i.reRender();return}if(f&&!y.length&&ol(f,A,m,w,I,u)){i.reRender();return}break}case"dependenciesUpdate":{var g=v.map(dn);if(g.some(function(M){return Fo(u.relatedFields,M)})){i.reRender();return}break}default:if(O||(!v.length||y.length||f)&&ol(f,A,m,w,I,u)){i.reRender();return}break}f===!0&&i.reRender()}),Q(Ot(i),"validateRules",function(A){var c=i.getNamePath(),u=i.getValue(),d=A||{},f=d.triggerName,p=d.validateOnly,v=p===void 0?!1:p,C=Promise.resolve().then(fo(Un().mark(function m(){var y,w,I,O,x,g,M;return Un().wrap(function(b){for(;;)switch(b.prev=b.next){case 0:if(i.mounted){b.next=2;break}return b.abrupt("return",[]);case 2:if(y=i.props,w=y.validateFirst,I=w===void 0?!1:w,O=y.messageVariables,x=y.validateDebounce,g=i.getRules(),f&&(g=g.filter(function(h){return h}).filter(function(h){var S=h.validateTrigger;if(!S)return!0;var T=nd(S);return T.includes(f)})),!(x&&f)){b.next=10;break}return b.next=8,new Promise(function(h){setTimeout(h,x)});case 8:if(i.validatePromise===C){b.next=10;break}return b.abrupt("return",[]);case 10:return M=Gx(c,u,g,A,I,O),M.catch(function(h){return h}).then(function(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Cr;if(i.validatePromise===C){var S;i.validatePromise=null;var T=[],R=[];(S=h.forEach)===null||S===void 0||S.call(h,function(D){var B=D.rule.warningOnly,k=D.errors,P=k===void 0?Cr:k;B?R.push.apply(R,Re(P)):T.push.apply(T,Re(P))}),i.errors=T,i.warnings=R,i.triggerMetaEvent(),i.reRender()}}),b.abrupt("return",M);case 13:case"end":return b.stop()}},m)})));return v||(i.validatePromise=C,i.dirty=!0,i.errors=Cr,i.warnings=Cr,i.triggerMetaEvent(),i.reRender()),C}),Q(Ot(i),"isFieldValidating",function(){return!!i.validatePromise}),Q(Ot(i),"isFieldTouched",function(){return i.touched}),Q(Ot(i),"isFieldDirty",function(){if(i.dirty||i.props.initialValue!==void 0)return!0;var A=i.props.fieldContext,c=A.getInternalHooks(Ji),u=c.getInitialValue;return u(i.getNamePath())!==void 0}),Q(Ot(i),"getErrors",function(){return i.errors}),Q(Ot(i),"getWarnings",function(){return i.warnings}),Q(Ot(i),"isListField",function(){return i.props.isListField}),Q(Ot(i),"isList",function(){return i.props.isList}),Q(Ot(i),"isPreserve",function(){return i.props.preserve}),Q(Ot(i),"getMeta",function(){i.prevValidating=i.isFieldValidating();var A={touched:i.isFieldTouched(),validating:i.prevValidating,errors:i.errors,warnings:i.warnings,name:i.getNamePath(),validated:i.validatePromise===null};return A}),Q(Ot(i),"getOnlyChild",function(A){if(typeof A=="function"){var c=i.getMeta();return L(L({},i.getOnlyChild(A(i.getControlled(),c,i.props.fieldContext))),{},{isFunction:!0})}var u=Pr(A);return u.length!==1||!l.isValidElement(u[0])?{child:u,isFunction:!1}:{child:u[0],isFunction:!1}}),Q(Ot(i),"getValue",function(A){var c=i.props.fieldContext.getFieldsValue,u=i.getNamePath();return zr(A||c(!0),u)}),Q(Ot(i),"getControlled",function(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},c=i.props,u=c.name,d=c.trigger,f=c.validateTrigger,p=c.getValueFromEvent,v=c.normalize,C=c.valuePropName,m=c.getValueProps,y=c.fieldContext,w=f!==void 0?f:y.validateTrigger,I=i.getNamePath(),O=y.getInternalHooks,x=y.getFieldsValue,g=O(Ji),M=g.dispatch,E=i.getValue(),b=m||function(D){return Q({},C,D)},h=A[d],S=u!==void 0?b(E):{};process.env.NODE_ENV!=="production"&&S&&Object.keys(S).forEach(function(D){yt(typeof S[D]!="function","It's not recommended to generate dynamic function prop by `getValueProps`. Please pass it to child component directly (prop: ".concat(D,")"))});var T=L(L({},A),S);T[d]=function(){i.touched=!0,i.dirty=!0,i.triggerMetaEvent();for(var D,B=arguments.length,k=new Array(B),P=0;P<B;P++)k[P]=arguments[P];p?D=p.apply(void 0,k):D=Vx.apply(void 0,[C].concat(k)),v&&(D=v(D,E,x(!0))),D!==E&&M({type:"updateValue",namePath:I,value:D}),h&&h.apply(void 0,k)};var R=nd(w||[]);return R.forEach(function(D){var B=T[D];T[D]=function(){B&&B.apply(void 0,arguments);var k=i.props.rules;k&&k.length&&M({type:"validateField",namePath:I,triggerName:D})}}),T}),r.fieldContext){var o=r.fieldContext.getInternalHooks,a=o(Ji),s=a.initEntityValue;s(Ot(i))}return i}return mn(n,[{key:"componentDidMount",value:function(){var i=this.props,o=i.shouldUpdate,a=i.fieldContext;if(this.mounted=!0,a){var s=a.getInternalHooks,A=s(Ji),c=A.registerField;this.cancelRegisterFunc=c(this)}o===!0&&this.reRender()}},{key:"componentWillUnmount",value:function(){this.cancelRegister(),this.triggerMetaEvent(!0),this.mounted=!1}},{key:"reRender",value:function(){this.mounted&&this.forceUpdate()}},{key:"render",value:function(){var i=this.state.resetCount,o=this.props.children,a=this.getOnlyChild(o),s=a.child,A=a.isFunction,c;return A?c=s:l.isValidElement(s)?c=l.cloneElement(s,this.getControlled(s.props)):(yt(!s,"`children` of Field is not validate ReactElement."),c=s),l.createElement(l.Fragment,{key:i},c)}}]),n}(l.Component);Q(df,"contextType",Yo);Q(df,"defaultProps",{trigger:"onChange",valuePropName:"value"});function G1(t){var e,n=t.name,r=Et(t,zx),i=l.useContext(Yo),o=l.useContext(EA),a=n!==void 0?dn(n):void 0,s=(e=r.isListField)!==null&&e!==void 0?e:!!o,A="keep";return s||(A="_".concat((a||[]).join("_"))),process.env.NODE_ENV!=="production"&&r.preserve===!1&&s&&a.length<=1&&yt(!1,"`preserve` should not apply on Form.List fields."),l.createElement(df,Qe({key:A,name:a,isListField:s},r,{fieldContext:i}))}function Yx(t){var e=t.name,n=t.initialValue,r=t.children,i=t.rules,o=t.validateTrigger,a=t.isListField,s=l.useContext(Yo),A=l.useContext(EA),c=l.useRef({keys:[],id:0}),u=c.current,d=l.useMemo(function(){var C=dn(s.prefixName)||[];return[].concat(Re(C),Re(dn(e)))},[s.prefixName,e]),f=l.useMemo(function(){return L(L({},s),{},{prefixName:d})},[s,d]),p=l.useMemo(function(){return{getKey:function(m){var y=d.length,w=m[y];return[u.keys[w],m.slice(y+1)]}}},[d]);if(typeof r!="function")return yt(!1,"Form.List only accepts function as children."),null;var v=function(m,y,w){var I=w.source;return I==="internal"?!1:m!==y};return l.createElement(EA.Provider,{value:p},l.createElement(Yo.Provider,{value:f},l.createElement(G1,{name:[],shouldUpdate:v,rules:i,validateTrigger:o,initialValue:n,isList:!0,isListField:a??!!A},function(C,m){var y=C.value,w=y===void 0?[]:y,I=C.onChange,O=s.getFieldValue,x=function(){var b=O(d||[]);return b||[]},g={add:function(b,h){var S=x();h>=0&&h<=S.length?(u.keys=[].concat(Re(u.keys.slice(0,h)),[u.id],Re(u.keys.slice(h))),I([].concat(Re(S.slice(0,h)),[b],Re(S.slice(h))))):(process.env.NODE_ENV!=="production"&&(h<0||h>S.length)&&yt(!1,"The second parameter of the add function should be a valid positive number."),u.keys=[].concat(Re(u.keys),[u.id]),I([].concat(Re(S),[b]))),u.id+=1},remove:function(b){var h=x(),S=new Set(Array.isArray(b)?b:[b]);S.size<=0||(u.keys=u.keys.filter(function(T,R){return!S.has(R)}),I(h.filter(function(T,R){return!S.has(R)})))},move:function(b,h){if(b!==h){var S=x();b<0||b>=S.length||h<0||h>=S.length||(u.keys=Gp(u.keys,b,h),I(Gp(S,b,h)))}}},M=w||[];return Array.isArray(M)||(M=[],process.env.NODE_ENV!=="production"&&yt(!1,"Current value of '".concat(d.join(" > "),"' is not an array type."))),r(M.map(function(E,b){var h=u.keys[b];return h===void 0&&(u.keys[b]=u.id,h=u.keys[b],u.id+=1),{name:b,key:h,isListField:!0}}),g,m)})))}function Wx(t){var e=!1,n=t.length,r=[];return t.length?new Promise(function(i,o){t.forEach(function(a,s){a.catch(function(A){return e=!0,A}).then(function(A){n-=1,r[s]=A,!(n>0)&&(e&&o(r),i(r))})})}):Promise.resolve([])}var q1="__@field_split__";function al(t){return t.map(function(e){return"".concat(et(e),":").concat(e)}).join(q1)}var Co=function(){function t(){pn(this,t),Q(this,"kvs",new Map)}return mn(t,[{key:"set",value:function(n,r){this.kvs.set(al(n),r)}},{key:"get",value:function(n){return this.kvs.get(al(n))}},{key:"update",value:function(n,r){var i=this.get(n),o=r(i);o?this.set(n,o):this.delete(n)}},{key:"delete",value:function(n){this.kvs.delete(al(n))}},{key:"map",value:function(n){return Re(this.kvs.entries()).map(function(r){var i=ee(r,2),o=i[0],a=i[1],s=o.split(q1);return n({key:s.map(function(A){var c=A.match(/^([^:]*):(.*)$/),u=ee(c,3),d=u[1],f=u[2];return d==="number"?Number(f):f}),value:a})})}},{key:"toJSON",value:function(){var n={};return this.map(function(r){var i=r.key,o=r.value;return n[i.join(".")]=o,null}),n}}]),t}(),Jx=["name"],_x=mn(function t(e){var n=this;pn(this,t),Q(this,"formHooked",!1),Q(this,"forceRootUpdate",void 0),Q(this,"subscribable",!0),Q(this,"store",{}),Q(this,"fieldEntities",[]),Q(this,"initialValues",{}),Q(this,"callbacks",{}),Q(this,"validateMessages",null),Q(this,"preserve",null),Q(this,"lastValidatePromise",null),Q(this,"getForm",function(){return{getFieldValue:n.getFieldValue,getFieldsValue:n.getFieldsValue,getFieldError:n.getFieldError,getFieldWarning:n.getFieldWarning,getFieldsError:n.getFieldsError,isFieldsTouched:n.isFieldsTouched,isFieldTouched:n.isFieldTouched,isFieldValidating:n.isFieldValidating,isFieldsValidating:n.isFieldsValidating,resetFields:n.resetFields,setFields:n.setFields,setFieldValue:n.setFieldValue,setFieldsValue:n.setFieldsValue,validateFields:n.validateFields,submit:n.submit,_init:!0,getInternalHooks:n.getInternalHooks}}),Q(this,"getInternalHooks",function(r){return r===Ji?(n.formHooked=!0,{dispatch:n.dispatch,initEntityValue:n.initEntityValue,registerField:n.registerField,useSubscribe:n.useSubscribe,setInitialValues:n.setInitialValues,destroyForm:n.destroyForm,setCallbacks:n.setCallbacks,setValidateMessages:n.setValidateMessages,getFields:n.getFields,setPreserve:n.setPreserve,getInitialValue:n.getInitialValue,registerWatch:n.registerWatch}):(yt(!1,"`getInternalHooks` is internal usage. Should not call directly."),null)}),Q(this,"useSubscribe",function(r){n.subscribable=r}),Q(this,"prevWithoutPreserves",null),Q(this,"setInitialValues",function(r,i){if(n.initialValues=r||{},i){var o,a=Ro(r,n.store);(o=n.prevWithoutPreserves)===null||o===void 0||o.map(function(s){var A=s.key;a=Mr(a,A,zr(r,A))}),n.prevWithoutPreserves=null,n.updateStore(a)}}),Q(this,"destroyForm",function(r){if(r)n.updateStore({});else{var i=new Co;n.getFieldEntities(!0).forEach(function(o){n.isMergedPreserve(o.isPreserve())||i.set(o.getNamePath(),!0)}),n.prevWithoutPreserves=i}}),Q(this,"getInitialValue",function(r){var i=zr(n.initialValues,r);return r.length?Ro(i):i}),Q(this,"setCallbacks",function(r){n.callbacks=r}),Q(this,"setValidateMessages",function(r){n.validateMessages=r}),Q(this,"setPreserve",function(r){n.preserve=r}),Q(this,"watchList",[]),Q(this,"registerWatch",function(r){return n.watchList.push(r),function(){n.watchList=n.watchList.filter(function(i){return i!==r})}}),Q(this,"notifyWatch",function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];if(n.watchList.length){var i=n.getFieldsValue(),o=n.getFieldsValue(!0);n.watchList.forEach(function(a){a(i,o,r)})}}),Q(this,"timeoutId",null),Q(this,"warningUnhooked",function(){process.env.NODE_ENV!=="production"&&!n.timeoutId&&typeof window<"u"&&(n.timeoutId=setTimeout(function(){n.timeoutId=null,n.formHooked||yt(!1,"Instance created by `useForm` is not connected to any Form element. Forget to pass `form` prop?")}))}),Q(this,"updateStore",function(r){n.store=r}),Q(this,"getFieldEntities",function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return r?n.fieldEntities.filter(function(i){return i.getNamePath().length}):n.fieldEntities}),Q(this,"getFieldsMap",function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,i=new Co;return n.getFieldEntities(r).forEach(function(o){var a=o.getNamePath();i.set(a,o)}),i}),Q(this,"getFieldEntitiesForNamePathList",function(r){if(!r)return n.getFieldEntities(!0);var i=n.getFieldsMap(!0);return r.map(function(o){var a=dn(o);return i.get(a)||{INVALIDATE_NAME_PATH:dn(o)}})}),Q(this,"getFieldsValue",function(r,i){n.warningUnhooked();var o,a,s;if(r===!0||Array.isArray(r)?(o=r,a=i):r&&et(r)==="object"&&(s=r.strict,a=r.filter),o===!0&&!a)return n.store;var A=n.getFieldEntitiesForNamePathList(Array.isArray(o)?o:null),c=[];return A.forEach(function(u){var d,f,p="INVALIDATE_NAME_PATH"in u?u.INVALIDATE_NAME_PATH:u.getNamePath();if(s){var v,C;if((v=(C=u).isList)!==null&&v!==void 0&&v.call(C))return}else if(!o&&(d=(f=u).isListField)!==null&&d!==void 0&&d.call(f))return;if(!a)c.push(p);else{var m="getMeta"in u?u.getMeta():null;a(m)&&c.push(p)}}),Hp(n.store,c.map(dn))}),Q(this,"getFieldValue",function(r){n.warningUnhooked();var i=dn(r);return zr(n.store,i)}),Q(this,"getFieldsError",function(r){n.warningUnhooked();var i=n.getFieldEntitiesForNamePathList(r);return i.map(function(o,a){return o&&!("INVALIDATE_NAME_PATH"in o)?{name:o.getNamePath(),errors:o.getErrors(),warnings:o.getWarnings()}:{name:dn(r[a]),errors:[],warnings:[]}})}),Q(this,"getFieldError",function(r){n.warningUnhooked();var i=dn(r),o=n.getFieldsError([i])[0];return o.errors}),Q(this,"getFieldWarning",function(r){n.warningUnhooked();var i=dn(r),o=n.getFieldsError([i])[0];return o.warnings}),Q(this,"isFieldsTouched",function(){n.warningUnhooked();for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];var a=i[0],s=i[1],A,c=!1;i.length===0?A=null:i.length===1?Array.isArray(a)?(A=a.map(dn),c=!1):(A=null,c=a):(A=a.map(dn),c=s);var u=n.getFieldEntities(!0),d=function(m){return m.isFieldTouched()};if(!A)return c?u.every(function(C){return d(C)||C.isList()}):u.some(d);var f=new Co;A.forEach(function(C){f.set(C,[])}),u.forEach(function(C){var m=C.getNamePath();A.forEach(function(y){y.every(function(w,I){return m[I]===w})&&f.update(y,function(w){return[].concat(Re(w),[C])})})});var p=function(m){return m.some(d)},v=f.map(function(C){var m=C.value;return m});return c?v.every(p):v.some(p)}),Q(this,"isFieldTouched",function(r){return n.warningUnhooked(),n.isFieldsTouched([r])}),Q(this,"isFieldsValidating",function(r){n.warningUnhooked();var i=n.getFieldEntities();if(!r)return i.some(function(a){return a.isFieldValidating()});var o=r.map(dn);return i.some(function(a){var s=a.getNamePath();return Fo(o,s)&&a.isFieldValidating()})}),Q(this,"isFieldValidating",function(r){return n.warningUnhooked(),n.isFieldsValidating([r])}),Q(this,"resetWithFieldInitialValue",function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=new Co,o=n.getFieldEntities(!0);o.forEach(function(A){var c=A.props.initialValue,u=A.getNamePath();if(c!==void 0){var d=i.get(u)||new Set;d.add({entity:A,value:c}),i.set(u,d)}});var a=function(c){c.forEach(function(u){var d=u.props.initialValue;if(d!==void 0){var f=u.getNamePath(),p=n.getInitialValue(f);if(p!==void 0)yt(!1,"Form already set 'initialValues' with path '".concat(f.join("."),"'. Field can not overwrite it."));else{var v=i.get(f);if(v&&v.size>1)yt(!1,"Multiple Field with path '".concat(f.join("."),"' set 'initialValue'. Can not decide which one to pick."));else if(v){var C=n.getFieldValue(f),m=u.isListField();!m&&(!r.skipExist||C===void 0)&&n.updateStore(Mr(n.store,f,Re(v)[0].value))}}}})},s;r.entities?s=r.entities:r.namePathList?(s=[],r.namePathList.forEach(function(A){var c=i.get(A);if(c){var u;(u=s).push.apply(u,Re(Re(c).map(function(d){return d.entity})))}})):s=o,a(s)}),Q(this,"resetFields",function(r){n.warningUnhooked();var i=n.store;if(!r){n.updateStore(Ro(n.initialValues)),n.resetWithFieldInitialValue(),n.notifyObservers(i,null,{type:"reset"}),n.notifyWatch();return}var o=r.map(dn);o.forEach(function(a){var s=n.getInitialValue(a);n.updateStore(Mr(n.store,a,s))}),n.resetWithFieldInitialValue({namePathList:o}),n.notifyObservers(i,o,{type:"reset"}),n.notifyWatch(o)}),Q(this,"setFields",function(r){n.warningUnhooked();var i=n.store,o=[];r.forEach(function(a){var s=a.name,A=Et(a,Jx),c=dn(s);o.push(c),"value"in A&&n.updateStore(Mr(n.store,c,A.value)),n.notifyObservers(i,[c],{type:"setField",data:a})}),n.notifyWatch(o)}),Q(this,"getFields",function(){var r=n.getFieldEntities(!0),i=r.map(function(o){var a=o.getNamePath(),s=o.getMeta(),A=L(L({},s),{},{name:a,value:n.getFieldValue(a)});return Object.defineProperty(A,"originRCField",{value:!0}),A});return i}),Q(this,"initEntityValue",function(r){var i=r.props.initialValue;if(i!==void 0){var o=r.getNamePath(),a=zr(n.store,o);a===void 0&&n.updateStore(Mr(n.store,o,i))}}),Q(this,"isMergedPreserve",function(r){var i=r!==void 0?r:n.preserve;return i??!0}),Q(this,"registerField",function(r){n.fieldEntities.push(r);var i=r.getNamePath();if(n.notifyWatch([i]),r.props.initialValue!==void 0){var o=n.store;n.resetWithFieldInitialValue({entities:[r],skipExist:!0}),n.notifyObservers(o,[r.getNamePath()],{type:"valueUpdate",source:"internal"})}return function(a,s){var A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];if(n.fieldEntities=n.fieldEntities.filter(function(d){return d!==r}),!n.isMergedPreserve(s)&&(!a||A.length>1)){var c=a?void 0:n.getInitialValue(i);if(i.length&&n.getFieldValue(i)!==c&&n.fieldEntities.every(function(d){return!H1(d.getNamePath(),i)})){var u=n.store;n.updateStore(Mr(u,i,c,!0)),n.notifyObservers(u,[i],{type:"remove"}),n.triggerDependenciesUpdate(u,i)}}n.notifyWatch([i])}}),Q(this,"dispatch",function(r){switch(r.type){case"updateValue":{var i=r.namePath,o=r.value;n.updateValue(i,o);break}case"validateField":{var a=r.namePath,s=r.triggerName;n.validateFields([a],{triggerName:s});break}}}),Q(this,"notifyObservers",function(r,i,o){if(n.subscribable){var a=L(L({},o),{},{store:n.getFieldsValue(!0)});n.getFieldEntities().forEach(function(s){var A=s.onStoreChange;A(r,i,a)})}else n.forceRootUpdate()}),Q(this,"triggerDependenciesUpdate",function(r,i){var o=n.getDependencyChildrenFields(i);return o.length&&n.validateFields(o),n.notifyObservers(r,o,{type:"dependenciesUpdate",relatedFields:[i].concat(Re(o))}),o}),Q(this,"updateValue",function(r,i){var o=dn(r),a=n.store;n.updateStore(Mr(n.store,o,i)),n.notifyObservers(a,[o],{type:"valueUpdate",source:"internal"}),n.notifyWatch([o]);var s=n.triggerDependenciesUpdate(a,o),A=n.callbacks.onValuesChange;if(A){var c=Hp(n.store,[o]);A(c,n.getFieldsValue())}n.triggerOnFieldsChange([o].concat(Re(s)))}),Q(this,"setFieldsValue",function(r){n.warningUnhooked();var i=n.store;if(r){var o=Ro(n.store,r);n.updateStore(o)}n.notifyObservers(i,null,{type:"valueUpdate",source:"external"}),n.notifyWatch()}),Q(this,"setFieldValue",function(r,i){n.setFields([{name:r,value:i,errors:[],warnings:[]}])}),Q(this,"getDependencyChildrenFields",function(r){var i=new Set,o=[],a=new Co;n.getFieldEntities().forEach(function(A){var c=A.props.dependencies;(c||[]).forEach(function(u){var d=dn(u);a.update(d,function(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Set;return f.add(A),f})})});var s=function A(c){var u=a.get(c)||new Set;u.forEach(function(d){if(!i.has(d)){i.add(d);var f=d.getNamePath();d.isFieldDirty()&&f.length&&(o.push(f),A(f))}})};return s(r),o}),Q(this,"triggerOnFieldsChange",function(r,i){var o=n.callbacks.onFieldsChange;if(o){var a=n.getFields();if(i){var s=new Co;i.forEach(function(c){var u=c.name,d=c.errors;s.set(u,d)}),a.forEach(function(c){c.errors=s.get(c.name)||c.errors})}var A=a.filter(function(c){var u=c.name;return Fo(r,u)});A.length&&o(A,a)}}),Q(this,"validateFields",function(r,i){n.warningUnhooked();var o,a;Array.isArray(r)||typeof r=="string"||typeof i=="string"?(o=r,a=i):a=r;var s=!!o,A=s?o.map(dn):[],c=[],u=String(Date.now()),d=new Set,f=a||{},p=f.recursive,v=f.dirty;n.getFieldEntities(!0).forEach(function(w){if(s||A.push(w.getNamePath()),!(!w.props.rules||!w.props.rules.length)&&!(v&&!w.isFieldDirty())){var I=w.getNamePath();if(d.add(I.join(u)),!s||Fo(A,I,p)){var O=w.validateRules(L({validateMessages:L(L({},U1),n.validateMessages)},a));c.push(O.then(function(){return{name:I,errors:[],warnings:[]}}).catch(function(x){var g,M=[],E=[];return(g=x.forEach)===null||g===void 0||g.call(x,function(b){var h=b.rule.warningOnly,S=b.errors;h?E.push.apply(E,Re(S)):M.push.apply(M,Re(S))}),M.length?Promise.reject({name:I,errors:M,warnings:E}):{name:I,errors:M,warnings:E}}))}}});var C=Wx(c);n.lastValidatePromise=C,C.catch(function(w){return w}).then(function(w){var I=w.map(function(O){var x=O.name;return x});n.notifyObservers(n.store,I,{type:"validateFinish"}),n.triggerOnFieldsChange(I,w)});var m=C.then(function(){return n.lastValidatePromise===C?Promise.resolve(n.getFieldsValue(A)):Promise.reject([])}).catch(function(w){var I=w.filter(function(O){return O&&O.errors.length});return Promise.reject({values:n.getFieldsValue(A),errorFields:I,outOfDate:n.lastValidatePromise!==C})});m.catch(function(w){return w});var y=A.filter(function(w){return d.has(w.join(u))});return n.triggerOnFieldsChange(y),m}),Q(this,"submit",function(){n.warningUnhooked(),n.validateFields().then(function(r){var i=n.callbacks.onFinish;if(i)try{i(r)}catch(o){console.error(o)}}).catch(function(r){var i=n.callbacks.onFinishFailed;i&&i(r)})}),this.forceRootUpdate=e});function Z1(t){var e=l.useRef(),n=l.useState({}),r=ee(n,2),i=r[1];if(!e.current)if(t)e.current=t;else{var o=function(){i({})},a=new _x(o);e.current=a.getForm()}return[e.current]}var ud=l.createContext({triggerFormChange:function(){},triggerFormFinish:function(){},registerForm:function(){},unregisterForm:function(){}}),$x=function(e){var n=e.validateMessages,r=e.onFormChange,i=e.onFormFinish,o=e.children,a=l.useContext(ud),s=l.useRef({});return l.createElement(ud.Provider,{value:L(L({},a),{},{validateMessages:L(L({},a.validateMessages),n),triggerFormChange:function(c,u){r&&r(c,{changedFields:u,forms:s.current}),a.triggerFormChange(c,u)},triggerFormFinish:function(c,u){i&&i(c,{values:u,forms:s.current}),a.triggerFormFinish(c,u)},registerForm:function(c,u){c&&(s.current=L(L({},s.current),{},Q({},c,u))),a.registerForm(c,u)},unregisterForm:function(c){var u=L({},s.current);delete u[c],s.current=u,a.unregisterForm(c)}})},o)},Xx=["name","initialValues","fields","form","preserve","children","component","validateMessages","validateTrigger","onValuesChange","onFieldsChange","onFinish","onFinishFailed","clearOnDestroy"],e3=function(e,n){var r=e.name,i=e.initialValues,o=e.fields,a=e.form,s=e.preserve,A=e.children,c=e.component,u=c===void 0?"form":c,d=e.validateMessages,f=e.validateTrigger,p=f===void 0?"onChange":f,v=e.onValuesChange,C=e.onFieldsChange,m=e.onFinish,y=e.onFinishFailed,w=e.clearOnDestroy,I=Et(e,Xx),O=l.useRef(null),x=l.useContext(ud),g=Z1(a),M=ee(g,1),E=M[0],b=E.getInternalHooks(Ji),h=b.useSubscribe,S=b.setInitialValues,T=b.setCallbacks,R=b.setValidateMessages,D=b.setPreserve,B=b.destroyForm;l.useImperativeHandle(n,function(){return L(L({},E),{},{nativeElement:O.current})}),l.useEffect(function(){return x.registerForm(r,E),function(){x.unregisterForm(r)}},[x,E,r]),R(L(L({},x.validateMessages),d)),T({onValuesChange:v,onFieldsChange:function(z){if(x.triggerFormChange(r,z),C){for(var J=arguments.length,W=new Array(J>1?J-1:0),te=1;te<J;te++)W[te-1]=arguments[te];C.apply(void 0,[z].concat(W))}},onFinish:function(z){x.triggerFormFinish(r,z),m&&m(z)},onFinishFailed:y}),D(s);var k=l.useRef(null);S(i,!k.current),k.current||(k.current=!0),l.useEffect(function(){return function(){return B(w)}},[]);var P,H=typeof A=="function";if(H){var Z=E.getFieldsValue(!0);P=A(Z,E)}else P=A;h(!H);var V=l.useRef();l.useEffect(function(){Kx(V.current||[],o||[])||E.setFields(o||[]),V.current=o},[o,E]);var q=l.useMemo(function(){return L(L({},E),{},{validateTrigger:p})},[E,p]),U=l.createElement(EA.Provider,{value:null},l.createElement(Yo.Provider,{value:q},P));return u===!1?U:l.createElement(u,Qe({},I,{ref:O,onSubmit:function(z){z.preventDefault(),z.stopPropagation(),E.submit()},onReset:function(z){var J;z.preventDefault(),E.resetFields(),(J=I.onReset)===null||J===void 0||J.call(I,z)}}),U)};function qp(t){try{return JSON.stringify(t)}catch{return Math.random()}}var t3=process.env.NODE_ENV!=="production"?function(t){var e=t.join("__RC_FIELD_FORM_SPLIT__"),n=N.useRef(e);yt(n.current===e,"`useWatch` is not support dynamic `namePath`. Please provide static instead.")}:function(){};function n3(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r=e[0],i=e[1],o=i===void 0?{}:i,a=lx(o)?{form:o}:o,s=a.form,A=N.useState(),c=ee(A,2),u=c[0],d=c[1],f=N.useMemo(function(){return qp(u)},[u]),p=N.useRef(f);p.current=f;var v=N.useContext(Yo),C=s||v,m=C&&C._init;process.env.NODE_ENV!=="production"&&yt(e.length===2?s?m:!0:m,"useWatch requires a form instance since it can not auto detect from context.");var y=dn(r),w=N.useRef(y);return w.current=y,t3(y),N.useEffect(function(){if(m){var I=C.getFieldsValue,O=C.getInternalHooks,x=O(Ji),g=x.registerWatch,M=function(S,T){var R=a.preserve?T:S;return typeof r=="function"?r(R):zr(R,w.current)},E=g(function(h,S){var T=M(h,S),R=qp(T);p.current!==R&&(p.current=R,d(T))}),b=M(I(),I(!0));return u!==b&&d(b),E}},[m]),u}var r3=l.forwardRef(e3),is=r3;is.FormProvider=$x;is.Field=G1;is.List=Yx;is.useForm=Z1;is.useWatch=n3;function tr(t,e){var n=Object.assign({},t);return Array.isArray(e)&&e.forEach(function(r){delete n[r]}),n}const Qr=l.createContext({});process.env.NODE_ENV!=="production"&&(Qr.displayName="FormItemInputContext");const i3=t=>{let{children:e,status:n,override:r}=t;const i=l.useContext(Qr),o=l.useMemo(()=>{const a=Object.assign({},i);return r&&delete a.isFormItemInput,n&&(delete a.status,delete a.hasFeedback,delete a.feedbackIcon),a},[n,r,i]);return l.createElement(Qr.Provider,{value:o},e)},o3=l.createContext(void 0);var a3=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n};const s3=(t,e)=>{var n,r;const i=l.useContext(D1),o=l.useContext(B1),{getPrefixCls:a,direction:s,radio:A}=l.useContext(Qt),c=l.useRef(null),u=Lr(e,c),{isFormItemInput:d}=l.useContext(Qr);if(process.env.NODE_ENV!=="production"){const k=cn("Radio");process.env.NODE_ENV!=="production"&&k(!("optionType"in t),"usage","`optionType` is only support in Radio.Group.")}const f=k=>{var P,H;(P=t.onChange)===null||P===void 0||P.call(t,k),(H=i==null?void 0:i.onChange)===null||H===void 0||H.call(i,k)},{prefixCls:p,className:v,rootClassName:C,children:m,style:y,title:w}=t,I=a3(t,["prefixCls","className","rootClassName","children","style","title"]),O=a("radio",p),x=((i==null?void 0:i.optionType)||o)==="button",g=x?`${O}-button`:O,M=Ur(O),[E,b,h]=g1(O,M),S=Object.assign({},I),T=l.useContext(li);i&&(S.name=i.name,S.onChange=f,S.checked=t.value===i.value,S.disabled=(n=S.disabled)!==null&&n!==void 0?n:i.disabled),S.disabled=(r=S.disabled)!==null&&r!==void 0?r:T;const R=Ae(`${g}-wrapper`,{[`${g}-wrapper-checked`]:S.checked,[`${g}-wrapper-disabled`]:S.disabled,[`${g}-wrapper-rtl`]:s==="rtl",[`${g}-wrapper-in-form-item`]:d,[`${g}-wrapper-block`]:!!(i!=null&&i.block)},A==null?void 0:A.className,v,C,b,h,M),[D,B]=cx(S.onClick);return E(l.createElement(nc,{component:"Radio",disabled:S.disabled},l.createElement("label",{className:R,style:Object.assign(Object.assign({},A==null?void 0:A.style),y),onMouseEnter:t.onMouseEnter,onMouseLeave:t.onMouseLeave,title:w,onClick:D},l.createElement(q6,Object.assign({},S,{className:Ae(S.className,{[cf]:!x}),type:"radio",prefixCls:g,ref:u,onClick:B})),m!==void 0?l.createElement("span",{className:`${g}-label`},m):null)))},La=l.forwardRef(s3);process.env.NODE_ENV!=="production"&&(La.displayName="Radio");function A3(){var t=L({},l);return t.useId}var Zp=0,Kp=A3();const rc=Kp?function(e){var n=Kp();return e||(process.env.NODE_ENV==="test"?"test-id":n)}:function(e){var n=l.useState("ssr-id"),r=ee(n,2),i=r[0],o=r[1];return l.useEffect(function(){var a=Zp;Zp+=1,o("rc_unique_".concat(a))},[]),e||(process.env.NODE_ENV==="test"?"test-id":i)},c3=l.forwardRef((t,e)=>{const{getPrefixCls:n,direction:r}=l.useContext(Qt),i=rc(),{prefixCls:o,className:a,rootClassName:s,options:A,buttonStyle:c="outline",disabled:u,children:d,size:f,style:p,id:v,optionType:C,name:m=i,defaultValue:y,value:w,block:I=!1,onChange:O,onMouseEnter:x,onMouseLeave:g,onFocus:M,onBlur:E}=t,[b,h]=Fn(y,{value:w}),S=l.useCallback(U=>{const $=b,z=U.target.value;"value"in t||h(z),z!==$&&(O==null||O(U))},[b,h,O]),T=n("radio",o),R=`${T}-group`,D=Ur(T),[B,k,P]=g1(T,D);let H=d;A&&A.length>0&&(H=A.map(U=>typeof U=="string"||typeof U=="number"?l.createElement(La,{key:U.toString(),prefixCls:T,disabled:u,value:U,checked:b===U},U):l.createElement(La,{key:`radio-group-value-options-${U.value}`,prefixCls:T,disabled:U.disabled||u,value:U.value,checked:b===U.value,title:U.title,style:U.style,id:U.id,required:U.required},U.label)));const Z=Ui(f),V=Ae(R,`${R}-${c}`,{[`${R}-${Z}`]:Z,[`${R}-rtl`]:r==="rtl",[`${R}-block`]:I},a,s,k,P,D),q=l.useMemo(()=>({onChange:S,value:b,disabled:u,name:m,optionType:C,block:I}),[S,b,u,m,C,I]);return B(l.createElement("div",Object.assign({},ki(t,{aria:!0,data:!0}),{className:V,style:p,onMouseEnter:x,onMouseLeave:g,onFocus:M,onBlur:E,id:v,ref:e}),l.createElement(U6,{value:q},H)))}),l3=l.memo(c3);var u3=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n};const d3=(t,e)=>{const{getPrefixCls:n}=l.useContext(Qt),{prefixCls:r}=t,i=u3(t,["prefixCls"]),o=n("radio",r);return l.createElement(H6,{value:"button"},l.createElement(La,Object.assign({prefixCls:o},i,{type:"radio",ref:e})))},f3=l.forwardRef(d3),os=La;os.Button=f3;os.Group=l3;os.__ANT_RADIO=!0;const g3=t=>{const{getPrefixCls:e,direction:n}=N.useContext(Qt),{prefixCls:r,className:i}=t,o=e("input-group",r),a=e("input"),[s,A]=b1(a),c=Ae(o,{[`${o}-lg`]:t.size==="large",[`${o}-sm`]:t.size==="small",[`${o}-compact`]:t.compact,[`${o}-rtl`]:n==="rtl"},A,i),u=N.useContext(Qr),d=N.useMemo(()=>Object.assign(Object.assign({},u),{isFormItemInput:!1}),[u]);return process.env.NODE_ENV!=="production"&&cn("Input.Group").deprecated(!1,"Input.Group","Space.Compact"),s(l.createElement("span",{className:c,style:t.style,onMouseEnter:t.onMouseEnter,onMouseLeave:t.onMouseLeave,onFocus:t.onFocus,onBlur:t.onBlur},l.createElement(Qr.Provider,{value:d},t.children)))};function h3(t){return!!(t.addonBefore||t.addonAfter)}function p3(t){return!!(t.prefix||t.suffix||t.allowClear)}function Vp(t,e,n){var r=e.cloneNode(!0),i=Object.create(t,{target:{value:r},currentTarget:{value:r}});return r.value=n,typeof e.selectionStart=="number"&&typeof e.selectionEnd=="number"&&(r.selectionStart=e.selectionStart,r.selectionEnd=e.selectionEnd),r.setSelectionRange=function(){e.setSelectionRange.apply(e,arguments)},i}function bA(t,e,n,r){if(n){var i=e;if(e.type==="click"){i=Vp(e,t,""),n(i);return}if(t.type!=="file"&&r!==void 0){i=Vp(e,t,r),n(i);return}n(i)}}function K1(t,e){if(t){t.focus(e);var n=e||{},r=n.cursor;if(r){var i=t.value.length;switch(r){case"start":t.setSelectionRange(0,0);break;case"end":t.setSelectionRange(i,i);break;default:t.setSelectionRange(0,i)}}}}var V1=N.forwardRef(function(t,e){var n,r,i,o=t.inputElement,a=t.children,s=t.prefixCls,A=t.prefix,c=t.suffix,u=t.addonBefore,d=t.addonAfter,f=t.className,p=t.style,v=t.disabled,C=t.readOnly,m=t.focused,y=t.triggerFocus,w=t.allowClear,I=t.value,O=t.handleReset,x=t.hidden,g=t.classes,M=t.classNames,E=t.dataAttrs,b=t.styles,h=t.components,S=t.onClear,T=a??o,R=(h==null?void 0:h.affixWrapper)||"span",D=(h==null?void 0:h.groupWrapper)||"span",B=(h==null?void 0:h.wrapper)||"span",k=(h==null?void 0:h.groupAddon)||"span",P=N.useRef(null),H=function(de){var le;(le=P.current)!==null&&le!==void 0&&le.contains(de.target)&&(y==null||y())},Z=p3(t),V=N.cloneElement(T,{value:I,className:Ae((n=T.props)===null||n===void 0?void 0:n.className,!Z&&(M==null?void 0:M.variant))||null}),q=N.useRef(null);if(N.useImperativeHandle(e,function(){return{nativeElement:q.current||P.current}}),Z){var U=null;if(w){var $=!v&&!C&&I,z="".concat(s,"-clear-icon"),J=et(w)==="object"&&w!==null&&w!==void 0&&w.clearIcon?w.clearIcon:"✖";U=N.createElement("button",{type:"button",tabIndex:-1,onClick:function(de){O==null||O(de),S==null||S()},onMouseDown:function(de){return de.preventDefault()},className:Ae(z,Q(Q({},"".concat(z,"-hidden"),!$),"".concat(z,"-has-suffix"),!!c))},J)}var W="".concat(s,"-affix-wrapper"),te=Ae(W,Q(Q(Q(Q(Q({},"".concat(s,"-disabled"),v),"".concat(W,"-disabled"),v),"".concat(W,"-focused"),m),"".concat(W,"-readonly"),C),"".concat(W,"-input-with-clear-btn"),c&&w&&I),g==null?void 0:g.affixWrapper,M==null?void 0:M.affixWrapper,M==null?void 0:M.variant),_=(c||w)&&N.createElement("span",{className:Ae("".concat(s,"-suffix"),M==null?void 0:M.suffix),style:b==null?void 0:b.suffix},U,c);V=N.createElement(R,Qe({className:te,style:b==null?void 0:b.affixWrapper,onClick:H},E==null?void 0:E.affixWrapper,{ref:P}),A&&N.createElement("span",{className:Ae("".concat(s,"-prefix"),M==null?void 0:M.prefix),style:b==null?void 0:b.prefix},A),V,_)}if(h3(t)){var se="".concat(s,"-group"),ce="".concat(se,"-addon"),ue="".concat(se,"-wrapper"),ne=Ae("".concat(s,"-wrapper"),se,g==null?void 0:g.wrapper,M==null?void 0:M.wrapper),me=Ae(ue,Q({},"".concat(ue,"-disabled"),v),g==null?void 0:g.group,M==null?void 0:M.groupWrapper);V=N.createElement(D,{className:me,ref:q},N.createElement(B,{className:ne},u&&N.createElement(k,{className:ce},u),V,d&&N.createElement(k,{className:ce},d)))}return N.cloneElement(V,{className:Ae((r=V.props)===null||r===void 0?void 0:r.className,f)||null,style:L(L({},(i=V.props)===null||i===void 0?void 0:i.style),p),hidden:x})}),m3=["show"];function z1(t,e){return l.useMemo(function(){var n={};e&&(n.show=et(e)==="object"&&e.formatter?e.formatter:!!e),n=L(L({},n),t);var r=n,i=r.show,o=Et(r,m3);return L(L({},o),{},{show:!!i,showFormatter:typeof i=="function"?i:void 0,strategy:o.strategy||function(a){return a.length}})},[t,e])}var v3=["autoComplete","onChange","onFocus","onBlur","onPressEnter","onKeyDown","onKeyUp","prefixCls","disabled","htmlSize","className","maxLength","suffix","showCount","count","type","classes","classNames","styles","onCompositionStart","onCompositionEnd"],C3=N.forwardRef(function(t,e){var n=t.autoComplete,r=t.onChange,i=t.onFocus,o=t.onBlur,a=t.onPressEnter,s=t.onKeyDown,A=t.onKeyUp,c=t.prefixCls,u=c===void 0?"rc-input":c,d=t.disabled,f=t.htmlSize,p=t.className,v=t.maxLength,C=t.suffix,m=t.showCount,y=t.count,w=t.type,I=w===void 0?"text":w,O=t.classes,x=t.classNames,g=t.styles,M=t.onCompositionStart,E=t.onCompositionEnd,b=Et(t,v3),h=N.useState(!1),S=ee(h,2),T=S[0],R=S[1],D=N.useRef(!1),B=N.useRef(!1),k=N.useRef(null),P=N.useRef(null),H=function(pe){k.current&&K1(k.current,pe)},Z=Fn(t.defaultValue,{value:t.value}),V=ee(Z,2),q=V[0],U=V[1],$=q==null?"":String(q),z=N.useState(null),J=ee(z,2),W=J[0],te=J[1],_=z1(y,m),se=_.max||v,ce=_.strategy($),ue=!!se&&ce>se;N.useImperativeHandle(e,function(){var Ie;return{focus:H,blur:function(){var Oe;(Oe=k.current)===null||Oe===void 0||Oe.blur()},setSelectionRange:function(Oe,Ze,tt){var rt;(rt=k.current)===null||rt===void 0||rt.setSelectionRange(Oe,Ze,tt)},select:function(){var Oe;(Oe=k.current)===null||Oe===void 0||Oe.select()},input:k.current,nativeElement:((Ie=P.current)===null||Ie===void 0?void 0:Ie.nativeElement)||k.current}}),N.useEffect(function(){B.current&&(B.current=!1),R(function(Ie){return Ie&&d?!1:Ie})},[d]);var ne=function(pe,Oe,Ze){var tt=Oe;if(!D.current&&_.exceedFormatter&&_.max&&_.strategy(Oe)>_.max){if(tt=_.exceedFormatter(Oe,{max:_.max}),Oe!==tt){var rt,Ge;te([((rt=k.current)===null||rt===void 0?void 0:rt.selectionStart)||0,((Ge=k.current)===null||Ge===void 0?void 0:Ge.selectionEnd)||0])}}else if(Ze.source==="compositionEnd")return;U(tt),k.current&&bA(k.current,pe,r,tt)};N.useEffect(function(){if(W){var Ie;(Ie=k.current)===null||Ie===void 0||Ie.setSelectionRange.apply(Ie,Re(W))}},[W]);var me=function(pe){ne(pe,pe.target.value,{source:"change"})},Y=function(pe){D.current=!1,ne(pe,pe.currentTarget.value,{source:"compositionEnd"}),E==null||E(pe)},de=function(pe){a&&pe.key==="Enter"&&!B.current&&(B.current=!0,a(pe)),s==null||s(pe)},le=function(pe){pe.key==="Enter"&&(B.current=!1),A==null||A(pe)},Se=function(pe){R(!0),i==null||i(pe)},xe=function(pe){B.current&&(B.current=!1),R(!1),o==null||o(pe)},Ce=function(pe){U(""),H(),k.current&&bA(k.current,pe,r)},De=ue&&"".concat(u,"-out-of-range"),je=function(){var pe=tr(t,["prefixCls","onPressEnter","addonBefore","addonAfter","prefix","suffix","allowClear","defaultValue","showCount","count","classes","htmlSize","styles","classNames","onClear"]);return N.createElement("input",Qe({autoComplete:n},pe,{onChange:me,onFocus:Se,onBlur:xe,onKeyDown:de,onKeyUp:le,className:Ae(u,Q({},"".concat(u,"-disabled"),d),x==null?void 0:x.input),style:g==null?void 0:g.input,ref:k,size:f,type:I,onCompositionStart:function(Ze){D.current=!0,M==null||M(Ze)},onCompositionEnd:Y}))},Le=function(){var pe=Number(se)>0;if(C||_.show){var Oe=_.showFormatter?_.showFormatter({value:$,count:ce,maxLength:se}):"".concat(ce).concat(pe?" / ".concat(se):"");return N.createElement(N.Fragment,null,_.show&&N.createElement("span",{className:Ae("".concat(u,"-show-count-suffix"),Q({},"".concat(u,"-show-count-has-suffix"),!!C),x==null?void 0:x.count),style:L({},g==null?void 0:g.count)},Oe),C)}return null};return N.createElement(V1,Qe({},b,{prefixCls:u,className:Ae(p,De),handleReset:Ce,value:$,focused:T,triggerFocus:H,suffix:Le(),disabled:d,classes:O,classNames:x,styles:g}),je())}),Y1=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n};const ic=l.createContext(null),Xo=(t,e)=>{const n=l.useContext(ic),r=l.useMemo(()=>{if(!n)return"";const{compactDirection:i,isFirstItem:o,isLastItem:a}=n,s=i==="vertical"?"-vertical-":"-";return Ae(`${t}-compact${s}item`,{[`${t}-compact${s}first-item`]:o,[`${t}-compact${s}last-item`]:a,[`${t}-compact${s}item-rtl`]:e==="rtl"})},[t,e,n]);return{compactSize:n==null?void 0:n.compactSize,compactDirection:n==null?void 0:n.compactDirection,compactItemClassnames:r}},y3=t=>{const{children:e}=t;return l.createElement(ic.Provider,{value:null},e)},E3=t=>{const{children:e}=t,n=Y1(t,["children"]);return l.createElement(ic.Provider,{value:l.useMemo(()=>n,[n])},e)},b3=t=>{const{getPrefixCls:e,direction:n}=l.useContext(Qt),{size:r,direction:i,block:o,prefixCls:a,className:s,rootClassName:A,children:c}=t,u=Y1(t,["size","direction","block","prefixCls","className","rootClassName","children"]),d=Ui(I=>r??I),f=e("space-compact",a),[p,v]=N1(f),C=Ae(f,v,{[`${f}-rtl`]:n==="rtl",[`${f}-block`]:o,[`${f}-vertical`]:i==="vertical"},s,A),m=l.useContext(ic),y=Pr(c),w=l.useMemo(()=>y.map((I,O)=>{const x=(I==null?void 0:I.key)||`${f}-item-${O}`;return l.createElement(E3,{key:x,compactSize:d,compactDirection:i,isFirstItem:O===0&&(!m||(m==null?void 0:m.isFirstItem)),isLastItem:O===y.length-1&&(!m||(m==null?void 0:m.isLastItem))},I)}),[r,y,m]);return y.length===0?null:p(l.createElement("div",Object.assign({className:C},u),w))},Ua=t=>{const{space:e,form:n,children:r}=t;if(r==null)return null;let i=r;return n&&(i=N.createElement(i3,{override:!0,status:!0},i)),e&&(i=N.createElement(y3,null,i)),i};var S3={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm127.98 274.82h-.04l-.08.06L512 466.75 384.14 338.88c-.04-.05-.06-.06-.08-.06a.12.12 0 00-.07 0c-.03 0-.05.01-.09.05l-45.02 45.02a.2.2 0 00-.05.09.12.12 0 000 .07v.02a.27.27 0 00.06.06L466.75 512 338.88 639.86c-.05.04-.06.06-.06.08a.12.12 0 000 .07c0 .03.01.05.05.09l45.02 45.02a.2.2 0 00.09.05.12.12 0 00.07 0c.02 0 .04-.01.08-.05L512 557.25l127.86 127.87c.04.04.06.05.08.05a.12.12 0 00.07 0c.03 0 .05-.01.09-.05l45.02-45.02a.2.2 0 00.05-.09.12.12 0 000-.07v-.02a.27.27 0 00-.05-.06L557.25 512l127.87-127.86c.04-.04.05-.06.05-.08a.12.12 0 000-.07c0-.03-.01-.05-.05-.09l-45.02-45.02a.2.2 0 00-.09-.05.12.12 0 00-.07 0z"}}]},name:"close-circle",theme:"filled"};function W1(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}function w3(t){return W1(t)instanceof ShadowRoot}function SA(t){return w3(t)?W1(t):null}function I3(t){return t.replace(/-(.)/g,function(e,n){return n.toUpperCase()})}function x3(t,e){yt(t,"[@ant-design/icons] ".concat(e))}function zp(t){return et(t)==="object"&&typeof t.name=="string"&&typeof t.theme=="string"&&(et(t.icon)==="object"||typeof t.icon=="function")}function Yp(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Object.keys(t).reduce(function(e,n){var r=t[n];switch(n){case"class":e.className=r,delete e.class;break;default:delete e[n],e[I3(n)]=r}return e},{})}function dd(t,e,n){return n?N.createElement(t.tag,L(L({key:e},Yp(t.attrs)),n),(t.children||[]).map(function(r,i){return dd(r,"".concat(e,"-").concat(t.tag,"-").concat(i))})):N.createElement(t.tag,L({key:e},Yp(t.attrs)),(t.children||[]).map(function(r,i){return dd(r,"".concat(e,"-").concat(t.tag,"-").concat(i))}))}function J1(t){return Ba(t)[0]}function _1(t){return t?Array.isArray(t)?t:[t]:[]}var R3=`
534
534
  .anticon {
535
535
  display: inline-flex;
536
536
  align-items: center;
@@ -609,7 +609,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Ds]+=1);const WI=on.div`
609
609
  html body {
610
610
  overflow-y: hidden;
611
611
  `.concat(a?"width: calc(100% - ".concat(o,"px);"):"",`
612
- }`),i)}else Ra(i);return function(){Ra(i)}},[e,i])}var K5=!1;function V5(t){return K5}var rm=function(e){return e===!1?!1:!Ln()||!e?null:typeof e=="string"?document.querySelector(e):typeof e=="function"?e():e},gc=l.forwardRef(function(t,e){var n=t.open,r=t.autoLock,i=t.getContainer,o=t.debug,a=t.autoDestroy,s=a===void 0?!0:a,A=t.children,c=l.useState(n),u=ee(c,2),d=u[0],f=u[1],p=d||n;process.env.NODE_ENV!=="production"&&yt(Ln()||!n,"Portal only work in client side. Please call 'useEffect' to show Portal instead default render in SSR."),l.useEffect(function(){(s||n)&&f(n)},[n,s]);var v=l.useState(function(){return rm(i)}),C=ee(v,2),m=C[0],y=C[1];l.useEffect(function(){var T=rm(i);y(T??null)});var w=L5(p&&!m,o),I=ee(w,2),O=I[0],x=I[1],g=m??O;Z5(r&&n&&Ln()&&(g===O||g===document.body));var M=null;if(A&&Li(A)&&e){var E=A;M=E.ref}var b=ji(M,e);if(!p||!Ln()||m===void 0)return null;var h=g===!1||V5(),S=A;return e&&(S=l.cloneElement(A,{ref:b})),l.createElement(SC.Provider,{value:x},h?S:Wr.createPortal(S,g))});process.env.NODE_ENV!=="production"&&(gc.displayName="Portal");const wC=function(){if(typeof navigator>"u"||typeof window>"u")return!1;var t=navigator.userAgent||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(t==null?void 0:t.substr(0,4))};function z5(t){var e=t.prefixCls,n=t.align,r=t.arrow,i=t.arrowPos,o=r||{},a=o.className,s=o.content,A=i.x,c=A===void 0?0:A,u=i.y,d=u===void 0?0:u,f=l.useRef();if(!n||!n.points)return null;var p={position:"absolute"};if(n.autoArrow!==!1){var v=n.points[0],C=n.points[1],m=v[0],y=v[1],w=C[0],I=C[1];m===w||!["t","b"].includes(m)?p.top=d:m==="t"?p.top=0:p.bottom=0,y===I||!["l","r"].includes(y)?p.left=c:y==="l"?p.left=0:p.right=0}return l.createElement("div",{ref:f,className:Ae("".concat(e,"-arrow"),a),style:p},s)}function Y5(t){var e=t.prefixCls,n=t.open,r=t.zIndex,i=t.mask,o=t.motion;return i?l.createElement(lo,Qe({},o,{motionAppear:!0,visible:n,removeOnLeave:!0}),function(a){var s=a.className;return l.createElement("div",{style:{zIndex:r},className:Ae("".concat(e,"-mask"),s)})}):null}var IC=l.memo(function(t){var e=t.children;return e},function(t,e){return e.cache});process.env.NODE_ENV!=="production"&&(IC.displayName="PopupContent");var xC=l.forwardRef(function(t,e){var n=t.popup,r=t.className,i=t.prefixCls,o=t.style,a=t.target,s=t.onVisibleChanged,A=t.open,c=t.keepDom,u=t.fresh,d=t.onClick,f=t.mask,p=t.arrow,v=t.arrowPos,C=t.align,m=t.motion,y=t.maskMotion,w=t.forceRender,I=t.getPopupContainer,O=t.autoDestroy,x=t.portal,g=t.zIndex,M=t.onMouseEnter,E=t.onMouseLeave,b=t.onPointerEnter,h=t.onPointerDownCapture,S=t.ready,T=t.offsetX,R=t.offsetY,D=t.offsetR,B=t.offsetB,k=t.onAlign,P=t.onPrepare,H=t.stretch,Z=t.targetWidth,V=t.targetHeight,q=typeof n=="function"?n():n,U=A||c,$=(I==null?void 0:I.length)>0,z=l.useState(!I||!$),J=ee(z,2),W=J[0],te=J[1];if(Xt(function(){!W&&$&&a&&te(!0)},[W,$,a]),!W)return null;var _="auto",se={left:"-1000vw",top:"-1000vh",right:_,bottom:_};if(S||!A){var ce,ue=C.points,ne=C.dynamicInset||((ce=C._experimental)===null||ce===void 0?void 0:ce.dynamicInset),me=ne&&ue[0][1]==="r",Y=ne&&ue[0][0]==="b";me?(se.right=D,se.left=_):(se.left=T,se.right=_),Y?(se.bottom=B,se.top=_):(se.top=R,se.bottom=_)}var de={};return H&&(H.includes("height")&&V?de.height=V:H.includes("minHeight")&&V&&(de.minHeight=V),H.includes("width")&&Z?de.width=Z:H.includes("minWidth")&&Z&&(de.minWidth=Z)),A||(de.pointerEvents="none"),l.createElement(x,{open:w||U,getContainer:I&&function(){return I(a)},autoDestroy:O},l.createElement(Y5,{prefixCls:i,open:A,zIndex:g,mask:f,motion:y}),l.createElement(hi,{onResize:k,disabled:!A},function(le){return l.createElement(lo,Qe({motionAppear:!0,motionEnter:!0,motionLeave:!0,removeOnLeave:!1,forceRender:w,leavedClassName:"".concat(i,"-hidden")},m,{onAppearPrepare:P,onEnterPrepare:P,visible:A,onVisibleChanged:function(xe){var Ce;m==null||(Ce=m.onVisibleChanged)===null||Ce===void 0||Ce.call(m,xe),s(xe)}}),function(Se,xe){var Ce=Se.className,De=Se.style,je=Ae(i,Ce,r);return l.createElement("div",{ref:Lr(le,e,xe),className:je,style:L(L(L(L({"--arrow-x":"".concat(v.x||0,"px"),"--arrow-y":"".concat(v.y||0,"px")},se),de),De),{},{boxSizing:"border-box",zIndex:g},o),onMouseEnter:M,onMouseLeave:E,onPointerEnter:b,onClick:d,onPointerDownCapture:h},p&&l.createElement(z5,{prefixCls:i,arrow:p,arrowPos:v,align:C}),l.createElement(IC,{cache:!A&&!u},q))})}))});process.env.NODE_ENV!=="production"&&(xC.displayName="Popup");var RC=l.forwardRef(function(t,e){var n=t.children,r=t.getTriggerDOMNode,i=Li(n),o=l.useCallback(function(s){Qd(e,r?r(s):s)},[r]),a=ji(o,co(n));return i?l.cloneElement(n,{ref:a}):n});process.env.NODE_ENV!=="production"&&(RC.displayName="TriggerWrapper");var im=l.createContext(null);function om(t){return t?Array.isArray(t)?t:[t]:[]}function W5(t,e,n,r){return l.useMemo(function(){var i=om(n??e),o=om(r??e),a=new Set(i),s=new Set(o);return t&&(a.has("hover")&&(a.delete("hover"),a.add("click")),s.has("hover")&&(s.delete("hover"),s.add("click"))),[a,s]},[t,e,n,r])}function J5(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0;return n?t[0]===e[0]:t[0]===e[0]&&t[1]===e[1]}function _5(t,e,n,r){for(var i=n.points,o=Object.keys(t),a=0;a<o.length;a+=1){var s,A=o[a];if(J5((s=t[A])===null||s===void 0?void 0:s.points,i,r))return"".concat(e,"-placement-").concat(A)}return""}function am(t,e,n,r){return e||(n?{motionName:"".concat(t,"-").concat(n)}:r?{motionName:r}:null)}function As(t){return t.ownerDocument.defaultView}function md(t){for(var e=[],n=t==null?void 0:t.parentElement,r=["hidden","scroll","clip","auto"];n;){var i=As(n).getComputedStyle(n),o=i.overflowX,a=i.overflowY,s=i.overflow;[o,a,s].some(function(A){return r.includes(A)})&&e.push(n),n=n.parentElement}return e}function Ha(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return Number.isNaN(t)?e:t}function ua(t){return Ha(parseFloat(t),0)}function sm(t,e){var n=L({},t);return(e||[]).forEach(function(r){if(!(r instanceof HTMLBodyElement||r instanceof HTMLHtmlElement)){var i=As(r).getComputedStyle(r),o=i.overflow,a=i.overflowClipMargin,s=i.borderTopWidth,A=i.borderBottomWidth,c=i.borderLeftWidth,u=i.borderRightWidth,d=r.getBoundingClientRect(),f=r.offsetHeight,p=r.clientHeight,v=r.offsetWidth,C=r.clientWidth,m=ua(s),y=ua(A),w=ua(c),I=ua(u),O=Ha(Math.round(d.width/v*1e3)/1e3),x=Ha(Math.round(d.height/f*1e3)/1e3),g=(v-C-w-I)*O,M=(f-p-m-y)*x,E=m*x,b=y*x,h=w*O,S=I*O,T=0,R=0;if(o==="clip"){var D=ua(a);T=D*O,R=D*x}var B=d.x+h-T,k=d.y+E-R,P=B+d.width+2*T-h-S-g,H=k+d.height+2*R-E-b-M;n.left=Math.max(n.left,B),n.top=Math.max(n.top,k),n.right=Math.min(n.right,P),n.bottom=Math.min(n.bottom,H)}}),n}function Am(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n="".concat(e),r=n.match(/^(.*)\%$/);return r?t*(parseFloat(r[1])/100):parseFloat(n)}function cm(t,e){var n=e||[],r=ee(n,2),i=r[0],o=r[1];return[Am(t.width,i),Am(t.height,o)]}function lm(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return[t[0],t[1]]}function yo(t,e){var n=e[0],r=e[1],i,o;return n==="t"?o=t.y:n==="b"?o=t.y+t.height:o=t.y+t.height/2,r==="l"?i=t.x:r==="r"?i=t.x+t.width:i=t.x+t.width/2,{x:i,y:o}}function yi(t,e){var n={t:"b",b:"t",l:"r",r:"l"};return t.map(function(r,i){return i===e?n[r]||"c":r}).join("")}function $5(t,e,n,r,i,o,a){var s=l.useState({ready:!1,offsetX:0,offsetY:0,offsetR:0,offsetB:0,arrowX:0,arrowY:0,scaleX:1,scaleY:1,align:i[r]||{}}),A=ee(s,2),c=A[0],u=A[1],d=l.useRef(0),f=l.useMemo(function(){return e?md(e):[]},[e]),p=l.useRef({}),v=function(){p.current={}};t||v();var C=rn(function(){if(e&&n&&t){let pr=function(ra,ti){var pi=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Oe,ia=U.x+ra,fs=U.y+ti,Ic=ia+Y,xc=fs+me,Rc=Math.max(ia,pi.left),We=Math.max(fs,pi.top),ht=Math.min(Ic,pi.right),tn=Math.min(xc,pi.bottom);return Math.max(0,(ht-Rc)*(tn-We))},ho=function(){ke=U.y+ot,Xe=ke+me,Ft=U.x+Te,ft=Ft+Y};var w,I,O,x,g=e,M=g.ownerDocument,E=As(g),b=E.getComputedStyle(g),h=b.position,S=g.style.left,T=g.style.top,R=g.style.right,D=g.style.bottom,B=g.style.overflow,k=L(L({},i[r]),o),P=M.createElement("div");(w=g.parentElement)===null||w===void 0||w.appendChild(P),P.style.left="".concat(g.offsetLeft,"px"),P.style.top="".concat(g.offsetTop,"px"),P.style.position=h,P.style.height="".concat(g.offsetHeight,"px"),P.style.width="".concat(g.offsetWidth,"px"),g.style.left="0",g.style.top="0",g.style.right="auto",g.style.bottom="auto",g.style.overflow="hidden";var H;if(Array.isArray(n))H={x:n[0],y:n[1],width:0,height:0};else{var Z,V,q=n.getBoundingClientRect();q.x=(Z=q.x)!==null&&Z!==void 0?Z:q.left,q.y=(V=q.y)!==null&&V!==void 0?V:q.top,H={x:q.x,y:q.y,width:q.width,height:q.height}}var U=g.getBoundingClientRect(),$=E.getComputedStyle(g),z=$.height,J=$.width;U.x=(I=U.x)!==null&&I!==void 0?I:U.left,U.y=(O=U.y)!==null&&O!==void 0?O:U.top;var W=M.documentElement,te=W.clientWidth,_=W.clientHeight,se=W.scrollWidth,ce=W.scrollHeight,ue=W.scrollTop,ne=W.scrollLeft,me=U.height,Y=U.width,de=H.height,le=H.width,Se={left:0,top:0,right:te,bottom:_},xe={left:-ne,top:-ue,right:se-ne,bottom:ce-ue},Ce=k.htmlRegion,De="visible",je="visibleFirst";Ce!=="scroll"&&Ce!==je&&(Ce=De);var Le=Ce===je,Ie=sm(xe,f),pe=sm(Se,f),Oe=Ce===De?pe:Ie,Ze=Le?pe:Oe;g.style.left="auto",g.style.top="auto",g.style.right="0",g.style.bottom="0";var tt=g.getBoundingClientRect();g.style.left=S,g.style.top=T,g.style.right=R,g.style.bottom=D,g.style.overflow=B,(x=g.parentElement)===null||x===void 0||x.removeChild(P);var rt=Ha(Math.round(Y/parseFloat(J)*1e3)/1e3),Ge=Ha(Math.round(me/parseFloat(z)*1e3)/1e3);if(rt===0||Ge===0||ka(n)&&!Af(n))return;var be=k.offset,Je=k.targetOffset,lt=cm(U,be),$e=ee(lt,2),Be=$e[0],Me=$e[1],st=cm(H,Je),At=ee(st,2),Ct=At[0],Nt=At[1];H.x-=Ct,H.y-=Nt;var Jt=k.points||[],Wt=ee(Jt,2),en=Wt[0],_t=Wt[1],Zt=lm(_t),Rt=lm(en),pt=yo(H,Zt),Ve=yo(U,Rt),_e=L({},k),Te=pt.x-Ve.x+Be,ot=pt.y-Ve.y+Me,mt=pr(Te,ot),Fe=pr(Te,ot,pe),we=yo(H,["t","l"]),Ke=yo(U,["t","l"]),ze=yo(H,["b","r"]),Ue=yo(U,["b","r"]),F=k.overflow||{},ge=F.adjustX,j=F.adjustY,re=F.shiftX,X=F.shiftY,ve=function(ti){return typeof ti=="boolean"?ti:ti>=0},ke,Xe,Ft,ft;ho();var St=ve(j),Ee=Rt[0]===Zt[0];if(St&&Rt[0]==="t"&&(Xe>Ze.bottom||p.current.bt)){var Ne=ot;Ee?Ne-=me-de:Ne=we.y-Ue.y-Me;var ct=pr(Te,Ne),ut=pr(Te,Ne,pe);ct>mt||ct===mt&&(!Le||ut>=Fe)?(p.current.bt=!0,ot=Ne,Me=-Me,_e.points=[yi(Rt,0),yi(Zt,0)]):p.current.bt=!1}if(St&&Rt[0]==="b"&&(ke<Ze.top||p.current.tb)){var kt=ot;Ee?kt+=me-de:kt=ze.y-Ke.y-Me;var Pn=pr(Te,kt),ln=pr(Te,kt,pe);Pn>mt||Pn===mt&&(!Le||ln>=Fe)?(p.current.tb=!0,ot=kt,Me=-Me,_e.points=[yi(Rt,0),yi(Zt,0)]):p.current.tb=!1}var Yn=ve(ge),Hr=Rt[1]===Zt[1];if(Yn&&Rt[1]==="l"&&(ft>Ze.right||p.current.rl)){var Hn=Te;Hr?Hn-=Y-le:Hn=we.x-Ue.x-Be;var Gn=pr(Hn,ot),xr=pr(Hn,ot,pe);Gn>mt||Gn===mt&&(!Le||xr>=Fe)?(p.current.rl=!0,Te=Hn,Be=-Be,_e.points=[yi(Rt,1),yi(Zt,1)]):p.current.rl=!1}if(Yn&&Rt[1]==="r"&&(Ft<Ze.left||p.current.lr)){var qn=Te;Hr?qn+=Y-le:qn=ze.x-Ke.x-Be;var Xr=pr(qn,ot),Rr=pr(qn,ot,pe);Xr>mt||Xr===mt&&(!Le||Rr>=Fe)?(p.current.lr=!0,Te=qn,Be=-Be,_e.points=[yi(Rt,1),yi(Zt,1)]):p.current.lr=!1}ho();var Zn=re===!0?0:re;typeof Zn=="number"&&(Ft<pe.left&&(Te-=Ft-pe.left-Be,H.x+le<pe.left+Zn&&(Te+=H.x-pe.left+le-Zn)),ft>pe.right&&(Te-=ft-pe.right-Be,H.x>pe.right-Zn&&(Te+=H.x-pe.right+Zn)));var nr=X===!0?0:X;typeof nr=="number"&&(ke<pe.top&&(ot-=ke-pe.top-Me,H.y+de<pe.top+nr&&(ot+=H.y-pe.top+de-nr)),Xe>pe.bottom&&(ot-=Xe-pe.bottom-Me,H.y>pe.bottom-nr&&(ot+=H.y-pe.bottom+nr)));var gr=U.x+Te,hr=gr+Y,Gr=U.y+ot,ei=Gr+me,wt=H.x,qe=wt+le,gt=H.y,bt=gt+de,Tt=Math.max(gr,wt),Bt=Math.min(hr,qe),Sn=(Tt+Bt)/2,wn=Sn-gr,Wn=Math.max(Gr,gt),rr=Math.min(ei,bt),Jn=(Wn+rr)/2,_n=Jn-Gr;a==null||a(e,_e);var vn=tt.right-U.x-(Te+U.width),Hi=tt.bottom-U.y-(ot+U.height);rt===1&&(Te=Math.round(Te),vn=Math.round(vn)),Ge===1&&(ot=Math.round(ot),Hi=Math.round(Hi));var wc={ready:!0,offsetX:Te/rt,offsetY:ot/Ge,offsetR:vn/rt,offsetB:Hi/Ge,arrowX:wn/rt,arrowY:_n/Ge,scaleX:rt,scaleY:Ge,align:_e};u(wc)}}),m=function(){d.current+=1;var I=d.current;Promise.resolve().then(function(){d.current===I&&C()})},y=function(){u(function(I){return L(L({},I),{},{ready:!1})})};return Xt(y,[r]),Xt(function(){t||y()},[t]),[c.ready,c.offsetX,c.offsetY,c.offsetR,c.offsetB,c.arrowX,c.arrowY,c.scaleX,c.scaleY,c.align,m]}function X5(t,e,n,r,i){Xt(function(){if(t&&e&&n){let d=function(){r(),i()};var o=e,a=n,s=md(o),A=md(a),c=As(a),u=new Set([c].concat(Re(s),Re(A)));return u.forEach(function(f){f.addEventListener("scroll",d,{passive:!0})}),c.addEventListener("resize",d,{passive:!0}),r(),function(){u.forEach(function(f){f.removeEventListener("scroll",d),c.removeEventListener("resize",d)})}}},[t,e,n])}function eO(t,e,n,r,i,o,a,s){var A=l.useRef(t);A.current=t;var c=l.useRef(!1);l.useEffect(function(){if(e&&r&&(!i||o)){var d=function(){c.current=!1},f=function(O){var x;A.current&&!a(((x=O.composedPath)===null||x===void 0||(x=x.call(O))===null||x===void 0?void 0:x[0])||O.target)&&!c.current&&s(!1)},p=As(r);p.addEventListener("pointerdown",d,!0),p.addEventListener("mousedown",f,!0),p.addEventListener("contextmenu",f,!0);var v=SA(n);if(v&&(v.addEventListener("mousedown",f,!0),v.addEventListener("contextmenu",f,!0)),process.env.NODE_ENV!=="production"){var C,m,y=n==null||(C=n.getRootNode)===null||C===void 0?void 0:C.call(n),w=(m=r.getRootNode)===null||m===void 0?void 0:m.call(r);Di(y===w,"trigger element and popup element should in same shadow root.")}return function(){p.removeEventListener("pointerdown",d,!0),p.removeEventListener("mousedown",f,!0),p.removeEventListener("contextmenu",f,!0),v&&(v.removeEventListener("mousedown",f,!0),v.removeEventListener("contextmenu",f,!0))}}},[e,n,r,i,o]);function u(){c.current=!0}return u}var tO=["prefixCls","children","action","showAction","hideAction","popupVisible","defaultPopupVisible","onPopupVisibleChange","afterPopupVisibleChange","mouseEnterDelay","mouseLeaveDelay","focusDelay","blurDelay","mask","maskClosable","getPopupContainer","forceRender","autoDestroy","destroyPopupOnHide","popup","popupClassName","popupStyle","popupPlacement","builtinPlacements","popupAlign","zIndex","stretch","getPopupClassNameFromAlign","fresh","alignPoint","onPopupClick","onPopupAlign","arrow","popupMotion","maskMotion","popupTransitionName","popupAnimation","maskTransitionName","maskAnimation","className","getTriggerDOMNode"];function nO(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:gc,e=l.forwardRef(function(n,r){var i=n.prefixCls,o=i===void 0?"rc-trigger-popup":i,a=n.children,s=n.action,A=s===void 0?"hover":s,c=n.showAction,u=n.hideAction,d=n.popupVisible,f=n.defaultPopupVisible,p=n.onPopupVisibleChange,v=n.afterPopupVisibleChange,C=n.mouseEnterDelay,m=n.mouseLeaveDelay,y=m===void 0?.1:m,w=n.focusDelay,I=n.blurDelay,O=n.mask,x=n.maskClosable,g=x===void 0?!0:x,M=n.getPopupContainer,E=n.forceRender,b=n.autoDestroy,h=n.destroyPopupOnHide,S=n.popup,T=n.popupClassName,R=n.popupStyle,D=n.popupPlacement,B=n.builtinPlacements,k=B===void 0?{}:B,P=n.popupAlign,H=n.zIndex,Z=n.stretch,V=n.getPopupClassNameFromAlign,q=n.fresh,U=n.alignPoint,$=n.onPopupClick,z=n.onPopupAlign,J=n.arrow,W=n.popupMotion,te=n.maskMotion,_=n.popupTransitionName,se=n.popupAnimation,ce=n.maskTransitionName,ue=n.maskAnimation,ne=n.className,me=n.getTriggerDOMNode,Y=Et(n,tO),de=b||h||!1,le=l.useState(!1),Se=ee(le,2),xe=Se[0],Ce=Se[1];Xt(function(){Ce(wC())},[]);var De=l.useRef({}),je=l.useContext(im),Le=l.useMemo(function(){return{registerSubPopup:function(ht,tn){De.current[ht]=tn,je==null||je.registerSubPopup(ht,tn)}}},[je]),Ie=rc(),pe=l.useState(null),Oe=ee(pe,2),Ze=Oe[0],tt=Oe[1],rt=l.useRef(null),Ge=rn(function(We){rt.current=We,ka(We)&&Ze!==We&&tt(We),je==null||je.registerSubPopup(Ie,We)}),be=l.useState(null),Je=ee(be,2),lt=Je[0],$e=Je[1],Be=l.useRef(null),Me=rn(function(We){ka(We)&&lt!==We&&($e(We),Be.current=We)}),st=l.Children.only(a),At=(st==null?void 0:st.props)||{},Ct={},Nt=rn(function(We){var ht,tn,Cn=lt;return(Cn==null?void 0:Cn.contains(We))||((ht=SA(Cn))===null||ht===void 0?void 0:ht.host)===We||We===Cn||(Ze==null?void 0:Ze.contains(We))||((tn=SA(Ze))===null||tn===void 0?void 0:tn.host)===We||We===Ze||Object.values(De.current).some(function(an){return(an==null?void 0:an.contains(We))||We===an})}),Jt=am(o,W,se,_),Wt=am(o,te,ue,ce),en=l.useState(f||!1),_t=ee(en,2),Zt=_t[0],Rt=_t[1],pt=d??Zt,Ve=rn(function(We){d===void 0&&Rt(We)});Xt(function(){Rt(d||!1)},[d]);var _e=l.useRef(pt);_e.current=pt;var Te=l.useRef([]);Te.current=[];var ot=rn(function(We){var ht;Ve(We),((ht=Te.current[Te.current.length-1])!==null&&ht!==void 0?ht:pt)!==We&&(Te.current.push(We),p==null||p(We))}),mt=l.useRef(),Fe=function(){clearTimeout(mt.current)},we=function(ht){var tn=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;Fe(),tn===0?ot(ht):mt.current=setTimeout(function(){ot(ht)},tn*1e3)};l.useEffect(function(){return Fe},[]);var Ke=l.useState(!1),ze=ee(Ke,2),Ue=ze[0],F=ze[1];Xt(function(We){(!We||pt)&&F(!0)},[pt]);var ge=l.useState(null),j=ee(ge,2),re=j[0],X=j[1],ve=l.useState(null),ke=ee(ve,2),Xe=ke[0],Ft=ke[1],ft=function(ht){Ft([ht.clientX,ht.clientY])},St=$5(pt,Ze,U&&Xe!==null?Xe:lt,D,k,P,z),Ee=ee(St,11),Ne=Ee[0],ct=Ee[1],ut=Ee[2],kt=Ee[3],Pn=Ee[4],ln=Ee[5],Yn=Ee[6],Hr=Ee[7],Hn=Ee[8],Gn=Ee[9],xr=Ee[10],qn=W5(xe,A,c,u),Xr=ee(qn,2),Rr=Xr[0],Zn=Xr[1],nr=Rr.has("click"),gr=Zn.has("click")||Zn.has("contextMenu"),hr=rn(function(){Ue||xr()}),Gr=function(){_e.current&&U&&gr&&we(!1)};X5(pt,lt,Ze,hr,Gr),Xt(function(){hr()},[Xe,D]),Xt(function(){pt&&!(k!=null&&k[D])&&hr()},[JSON.stringify(P)]);var ei=l.useMemo(function(){var We=_5(k,o,Gn,U);return Ae(We,V==null?void 0:V(Gn))},[Gn,V,k,o,U]);l.useImperativeHandle(r,function(){return{nativeElement:Be.current,popupElement:rt.current,forceAlign:hr}});var wt=l.useState(0),qe=ee(wt,2),gt=qe[0],bt=qe[1],Tt=l.useState(0),Bt=ee(Tt,2),Sn=Bt[0],wn=Bt[1],Wn=function(){if(Z&&lt){var ht=lt.getBoundingClientRect();bt(ht.width),wn(ht.height)}},rr=function(){Wn(),hr()},Jn=function(ht){F(!1),xr(),v==null||v(ht)},_n=function(){return new Promise(function(ht){Wn(),X(function(){return ht})})};Xt(function(){re&&(xr(),re(),X(null))},[re]);function vn(We,ht,tn,Cn){Ct[We]=function(an){var gs;Cn==null||Cn(an),we(ht,tn);for(var Oc=arguments.length,Qf=new Array(Oc>1?Oc-1:0),hs=1;hs<Oc;hs++)Qf[hs-1]=arguments[hs];(gs=At[We])===null||gs===void 0||gs.call.apply(gs,[At,an].concat(Qf))}}(nr||gr)&&(Ct.onClick=function(We){var ht;_e.current&&gr?we(!1):!_e.current&&nr&&(ft(We),we(!0));for(var tn=arguments.length,Cn=new Array(tn>1?tn-1:0),an=1;an<tn;an++)Cn[an-1]=arguments[an];(ht=At.onClick)===null||ht===void 0||ht.call.apply(ht,[At,We].concat(Cn))});var Hi=eO(pt,gr,lt,Ze,O,g,Nt,we),wc=Rr.has("hover"),pr=Zn.has("hover"),ho,ra;wc&&(vn("onMouseEnter",!0,C,function(We){ft(We)}),vn("onPointerEnter",!0,C,function(We){ft(We)}),ho=function(ht){(pt||Ue)&&Ze!==null&&Ze!==void 0&&Ze.contains(ht.target)&&we(!0,C)},U&&(Ct.onMouseMove=function(We){var ht;(ht=At.onMouseMove)===null||ht===void 0||ht.call(At,We)})),pr&&(vn("onMouseLeave",!1,y),vn("onPointerLeave",!1,y),ra=function(){we(!1,y)}),Rr.has("focus")&&vn("onFocus",!0,w),Zn.has("focus")&&vn("onBlur",!1,I),Rr.has("contextMenu")&&(Ct.onContextMenu=function(We){var ht;_e.current&&Zn.has("contextMenu")?we(!1):(ft(We),we(!0)),We.preventDefault();for(var tn=arguments.length,Cn=new Array(tn>1?tn-1:0),an=1;an<tn;an++)Cn[an-1]=arguments[an];(ht=At.onContextMenu)===null||ht===void 0||ht.call.apply(ht,[At,We].concat(Cn))}),ne&&(Ct.className=Ae(At.className,ne));var ti=l.useRef(!1);ti.current||(ti.current=E||pt||Ue);var pi=L(L({},At),Ct),ia={},fs=["onContextMenu","onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur"];fs.forEach(function(We){Y[We]&&(ia[We]=function(){for(var ht,tn=arguments.length,Cn=new Array(tn),an=0;an<tn;an++)Cn[an]=arguments[an];(ht=pi[We])===null||ht===void 0||ht.call.apply(ht,[pi].concat(Cn)),Y[We].apply(Y,Cn)})});var Ic=l.cloneElement(st,L(L({},pi),ia)),xc={x:ln,y:Yn},Rc=J?L({},J!==!0?J:{}):null;return l.createElement(l.Fragment,null,l.createElement(hi,{disabled:!pt,ref:Me,onResize:rr},l.createElement(RC,{getTriggerDOMNode:me},Ic)),ti.current&&l.createElement(im.Provider,{value:Le},l.createElement(xC,{portal:t,ref:Ge,prefixCls:o,popup:S,className:Ae(T,ei),style:R,target:lt,onMouseEnter:ho,onMouseLeave:ra,onPointerEnter:ho,zIndex:H,open:pt,keepDom:Ue,fresh:q,onClick:$,onPointerDownCapture:Hi,mask:O,motion:Jt,maskMotion:Wt,onVisibleChanged:Jn,onPrepare:_n,forceRender:E,autoDestroy:de,getPopupContainer:M,align:Gn,arrow:Rc,arrowPos:xc,ready:Ne,offsetX:ct,offsetY:ut,offsetR:kt,offsetB:Pn,onAlign:hr,stretch:Z,targetWidth:gt/Hr,targetHeight:Sn/Hn})))});return process.env.NODE_ENV!=="production"&&(e.displayName="Trigger"),e}const hc=nO(gc);var rO=at.ESC,iO=at.TAB;function oO(t){var e=t.visible,n=t.triggerRef,r=t.onVisibleChange,i=t.autoFocus,o=t.overlayRef,a=l.useRef(!1),s=function(){if(e){var d,f;(d=n.current)===null||d===void 0||(f=d.focus)===null||f===void 0||f.call(d),r==null||r(!1)}},A=function(){var d;return(d=o.current)!==null&&d!==void 0&&d.focus?(o.current.focus(),a.current=!0,!0):!1},c=function(d){switch(d.keyCode){case rO:s();break;case iO:{var f=!1;a.current||(f=A()),f?d.preventDefault():s();break}}};l.useEffect(function(){return e?(window.addEventListener("keydown",c),i&&qt(A,3),function(){window.removeEventListener("keydown",c),a.current=!1}):function(){a.current=!1}},[e])}var aO=N.forwardRef(function(t,e){var n=t.overlay,r=t.arrow,i=t.prefixCls,o=N.useMemo(function(){var s;return typeof n=="function"?s=n():s=n,s},[n]),a=Lr(e,co(o));return N.createElement(N.Fragment,null,r&&N.createElement("div",{className:"".concat(i,"-arrow")}),N.cloneElement(o,{ref:Li(o)?a:void 0}))}),Eo={adjustX:1,adjustY:1},bo=[0,0],sO={topLeft:{points:["bl","tl"],overflow:Eo,offset:[0,-4],targetOffset:bo},top:{points:["bc","tc"],overflow:Eo,offset:[0,-4],targetOffset:bo},topRight:{points:["br","tr"],overflow:Eo,offset:[0,-4],targetOffset:bo},bottomLeft:{points:["tl","bl"],overflow:Eo,offset:[0,4],targetOffset:bo},bottom:{points:["tc","bc"],overflow:Eo,offset:[0,4],targetOffset:bo},bottomRight:{points:["tr","br"],overflow:Eo,offset:[0,4],targetOffset:bo}},AO=["arrow","prefixCls","transitionName","animation","align","placement","placements","getPopupContainer","showAction","hideAction","overlayClassName","overlayStyle","visible","trigger","autoFocus","overlay","children","onVisibleChange"];function cO(t,e){var n,r=t.arrow,i=r===void 0?!1:r,o=t.prefixCls,a=o===void 0?"rc-dropdown":o,s=t.transitionName,A=t.animation,c=t.align,u=t.placement,d=u===void 0?"bottomLeft":u,f=t.placements,p=f===void 0?sO:f,v=t.getPopupContainer,C=t.showAction,m=t.hideAction,y=t.overlayClassName,w=t.overlayStyle,I=t.visible,O=t.trigger,x=O===void 0?["hover"]:O,g=t.autoFocus,M=t.overlay,E=t.children,b=t.onVisibleChange,h=Et(t,AO),S=N.useState(),T=ee(S,2),R=T[0],D=T[1],B="visible"in t?I:R,k=N.useRef(null),P=N.useRef(null),H=N.useRef(null);N.useImperativeHandle(e,function(){return k.current});var Z=function(_){D(_),b==null||b(_)};oO({visible:B,triggerRef:H,onVisibleChange:Z,autoFocus:g,overlayRef:P});var V=function(_){var se=t.onOverlayClick;D(!1),se&&se(_)},q=function(){return N.createElement(aO,{ref:P,overlay:M,prefixCls:a,arrow:i})},U=function(){return typeof M=="function"?q:q()},$=function(){var _=t.minOverlayWidthMatchTrigger,se=t.alignPoint;return"minOverlayWidthMatchTrigger"in t?_:!se},z=function(){var _=t.openClassName;return _!==void 0?_:"".concat(a,"-open")},J=N.cloneElement(E,{className:Ae((n=E.props)===null||n===void 0?void 0:n.className,B&&z()),ref:Li(E)?Lr(H,co(E)):void 0}),W=m;return!W&&x.indexOf("contextMenu")!==-1&&(W=["click"]),N.createElement(hc,Qe({builtinPlacements:p},h,{prefixCls:a,ref:k,popupClassName:Ae(y,Q({},"".concat(a,"-show-arrow"),i)),popupStyle:w,action:x,showAction:C,hideAction:W,popupPlacement:d,popupAlign:c,popupTransitionName:s,popupAnimation:A,popupVisible:B,stretch:$()?"minWidth":"",popup:U(),onPopupVisibleChange:Z,onPopupClick:V,getPopupContainer:v}),J)}const lO=N.forwardRef(cO),uO=t=>typeof t!="object"&&typeof t!="function"||t===null;function dO(t,e,n,r){if(r===!1)return{adjustX:!1,adjustY:!1};const i=r&&typeof r=="object"?r:{},o={};switch(t){case"top":case"bottom":o.shiftX=e.arrowOffsetHorizontal*2+n,o.shiftY=!0,o.adjustY=!0;break;case"left":case"right":o.shiftY=e.arrowOffsetVertical*2+n,o.shiftX=!0,o.adjustX=!0;break}const a=Object.assign(Object.assign({},o),i);return a.shiftX||(a.adjustX=!0),a.shiftY||(a.adjustY=!0),a}const um={left:{points:["cr","cl"]},right:{points:["cl","cr"]},top:{points:["bc","tc"]},bottom:{points:["tc","bc"]},topLeft:{points:["bl","tl"]},leftTop:{points:["tr","tl"]},topRight:{points:["br","tr"]},rightTop:{points:["tl","tr"]},bottomRight:{points:["tr","br"]},rightBottom:{points:["bl","br"]},bottomLeft:{points:["tl","bl"]},leftBottom:{points:["br","bl"]}},fO={topLeft:{points:["bl","tc"]},leftTop:{points:["tr","cl"]},topRight:{points:["br","tc"]},rightTop:{points:["tl","cr"]},bottomRight:{points:["tr","bc"]},rightBottom:{points:["bl","cr"]},bottomLeft:{points:["tl","bc"]},leftBottom:{points:["br","cl"]}},gO=new Set(["topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]);function OC(t){const{arrowWidth:e,autoAdjustOverflow:n,arrowPointAtCenter:r,offset:i,borderRadius:o,visibleFirst:a}=t,s=e/2,A={};return Object.keys(um).forEach(c=>{const u=r&&fO[c]||um[c],d=Object.assign(Object.assign({},u),{offset:[0,0],dynamicInset:!0});switch(A[c]=d,gO.has(c)&&(d.autoArrow=!1),c){case"top":case"topLeft":case"topRight":d.offset[1]=-s-i;break;case"bottom":case"bottomLeft":case"bottomRight":d.offset[1]=s+i;break;case"left":case"leftTop":case"leftBottom":d.offset[0]=-s-i;break;case"right":case"rightTop":case"rightBottom":d.offset[0]=s+i;break}const f=ec({contentRadius:o,limitVerticalRadius:!0});if(r)switch(c){case"topLeft":case"bottomLeft":d.offset[0]=-f.arrowOffsetHorizontal-s;break;case"topRight":case"bottomRight":d.offset[0]=f.arrowOffsetHorizontal+s;break;case"leftTop":case"rightTop":d.offset[1]=-f.arrowOffsetHorizontal*2+s;break;case"leftBottom":case"rightBottom":d.offset[1]=f.arrowOffsetHorizontal*2-s;break}d.overflow=dO(c,f,e,n),a&&(d.htmlRegion="visibleFirst")}),A}function MC(t){return e=>l.createElement(_r,{theme:{token:{motion:!1,zIndexPopupBase:0}}},l.createElement(t,Object.assign({},e)))}const TC=(t,e,n,r,i)=>MC(a=>{const{prefixCls:s,style:A}=a,c=l.useRef(null),[u,d]=l.useState(0),[f,p]=l.useState(0),[v,C]=Fn(!1,{value:a.open}),{getPrefixCls:m}=l.useContext(Qt),y=m(r||"select",s);l.useEffect(()=>{if(C(!0),typeof ResizeObserver<"u"){const O=new ResizeObserver(g=>{const M=g[0].target;d(M.offsetHeight+8),p(M.offsetWidth)}),x=setInterval(()=>{var g;const M=i?`.${i(y)}`:`.${y}-dropdown`,E=(g=c.current)===null||g===void 0?void 0:g.querySelector(M);E&&(clearInterval(x),O.observe(E))},10);return()=>{clearInterval(x),O.disconnect()}}},[]);let w=Object.assign(Object.assign({},a),{style:Object.assign(Object.assign({},A),{margin:0}),open:v,visible:v,getPopupContainer:()=>c.current});e&&Object.assign(w,{[e]:{overflow:{adjustX:!1,adjustY:!1}}});const I={paddingBottom:u,position:"relative",minWidth:f};return l.createElement("div",{ref:c,style:I},l.createElement(t,Object.assign({},w)))});var hO=["prefixCls","invalidate","item","renderItem","responsive","responsiveDisabled","registerSize","itemKey","className","style","children","display","order","component"],So=void 0;function pO(t,e){var n=t.prefixCls,r=t.invalidate,i=t.item,o=t.renderItem,a=t.responsive,s=t.responsiveDisabled,A=t.registerSize,c=t.itemKey,u=t.className,d=t.style,f=t.children,p=t.display,v=t.order,C=t.component,m=C===void 0?"div":C,y=Et(t,hO),w=a&&!p;function I(E){A(c,E)}l.useEffect(function(){return function(){I(null)}},[]);var O=o&&i!==So?o(i,{index:v}):f,x;r||(x={opacity:w?0:1,height:w?0:So,overflowY:w?"hidden":So,order:a?v:So,pointerEvents:w?"none":So,position:w?"absolute":So});var g={};w&&(g["aria-hidden"]=!0);var M=l.createElement(m,Qe({className:Ae(!r&&n,u),style:L(L({},x),d)},g,y,{ref:e}),O);return a&&(M=l.createElement(hi,{onResize:function(b){var h=b.offsetWidth;I(h)},disabled:s},M)),M}var Ia=l.forwardRef(pO);Ia.displayName="Item";function mO(t){if(typeof MessageChannel>"u")qt(t);else{var e=new MessageChannel;e.port1.onmessage=function(){return t()},e.port2.postMessage(void 0)}}function vO(){var t=l.useRef(null),e=function(r){t.current||(t.current=[],mO(function(){Wr.unstable_batchedUpdates(function(){t.current.forEach(function(i){i()}),t.current=null})})),t.current.push(r)};return e}function da(t,e){var n=l.useState(e),r=ee(n,2),i=r[0],o=r[1],a=rn(function(s){t(function(){o(s)})});return[i,a]}var OA=N.createContext(null),CO=["component"],yO=["className"],EO=["className"],bO=function(e,n){var r=l.useContext(OA);if(!r){var i=e.component,o=i===void 0?"div":i,a=Et(e,CO);return l.createElement(o,Qe({},a,{ref:n}))}var s=r.className,A=Et(r,yO),c=e.className,u=Et(e,EO);return l.createElement(OA.Provider,{value:null},l.createElement(Ia,Qe({ref:n,className:Ae(s,c)},A,u)))},NC=l.forwardRef(bO);NC.displayName="RawItem";var SO=["prefixCls","data","renderItem","renderRawItem","itemKey","itemWidth","ssr","style","className","maxCount","renderRest","renderRawRest","suffix","component","itemComponent","onVisibleChange"],DC="responsive",BC="invalidate";function wO(t){return"+ ".concat(t.length," ...")}function IO(t,e){var n=t.prefixCls,r=n===void 0?"rc-overflow":n,i=t.data,o=i===void 0?[]:i,a=t.renderItem,s=t.renderRawItem,A=t.itemKey,c=t.itemWidth,u=c===void 0?10:c,d=t.ssr,f=t.style,p=t.className,v=t.maxCount,C=t.renderRest,m=t.renderRawRest,y=t.suffix,w=t.component,I=w===void 0?"div":w,O=t.itemComponent,x=t.onVisibleChange,g=Et(t,SO),M=d==="full",E=vO(),b=da(E,null),h=ee(b,2),S=h[0],T=h[1],R=S||0,D=da(E,new Map),B=ee(D,2),k=B[0],P=B[1],H=da(E,0),Z=ee(H,2),V=Z[0],q=Z[1],U=da(E,0),$=ee(U,2),z=$[0],J=$[1],W=da(E,0),te=ee(W,2),_=te[0],se=te[1],ce=N.useState(null),ue=ee(ce,2),ne=ue[0],me=ue[1],Y=N.useState(null),de=ee(Y,2),le=de[0],Se=de[1],xe=l.useMemo(function(){return le===null&&M?Number.MAX_SAFE_INTEGER:le||0},[le,S]),Ce=N.useState(!1),De=ee(Ce,2),je=De[0],Le=De[1],Ie="".concat(r,"-item"),pe=Math.max(V,z),Oe=v===DC,Ze=o.length&&Oe,tt=v===BC,rt=Ze||typeof v=="number"&&o.length>v,Ge=N.useMemo(function(){var Ve=o;return Ze?S===null&&M?Ve=o:Ve=o.slice(0,Math.min(o.length,R/u)):typeof v=="number"&&(Ve=o.slice(0,v)),Ve},[o,u,S,v,Ze]),be=N.useMemo(function(){return Ze?o.slice(xe+1):o.slice(Ge.length)},[o,Ge,Ze,xe]),Je=N.useCallback(function(Ve,_e){var Te;return typeof A=="function"?A(Ve):(Te=A&&(Ve==null?void 0:Ve[A]))!==null&&Te!==void 0?Te:_e},[A]),lt=N.useCallback(a||function(Ve){return Ve},[a]);function $e(Ve,_e,Te){le===Ve&&(_e===void 0||_e===ne)||(Se(Ve),Te||(Le(Ve<o.length-1),x==null||x(Ve)),_e!==void 0&&me(_e))}function Be(Ve,_e){T(_e.clientWidth)}function Me(Ve,_e){P(function(Te){var ot=new Map(Te);return _e===null?ot.delete(Ve):ot.set(Ve,_e),ot})}function st(Ve,_e){J(_e),q(z)}function At(Ve,_e){se(_e)}function Ct(Ve){return k.get(Je(Ge[Ve],Ve))}Xt(function(){if(R&&typeof pe=="number"&&Ge){var Ve=_,_e=Ge.length,Te=_e-1;if(!_e){$e(0,null);return}for(var ot=0;ot<_e;ot+=1){var mt=Ct(ot);if(M&&(mt=mt||0),mt===void 0){$e(ot-1,void 0,!0);break}if(Ve+=mt,Te===0&&Ve<=R||ot===Te-1&&Ve+Ct(Te)<=R){$e(Te,null);break}else if(Ve+pe>R){$e(ot-1,Ve-mt-_+z);break}}y&&Ct(0)+_>R&&me(null)}},[R,k,z,_,Je,Ge]);var Nt=je&&!!be.length,Jt={};ne!==null&&Ze&&(Jt={position:"absolute",left:ne,top:0});var Wt={prefixCls:Ie,responsive:Ze,component:O,invalidate:tt},en=s?function(Ve,_e){var Te=Je(Ve,_e);return l.createElement(OA.Provider,{key:Te,value:L(L({},Wt),{},{order:_e,item:Ve,itemKey:Te,registerSize:Me,display:_e<=xe})},s(Ve,_e))}:function(Ve,_e){var Te=Je(Ve,_e);return l.createElement(Ia,Qe({},Wt,{order:_e,key:Te,item:Ve,renderItem:lt,itemKey:Te,registerSize:Me,display:_e<=xe}))},_t={order:Nt?xe:Number.MAX_SAFE_INTEGER,className:"".concat(Ie,"-rest"),registerSize:st,display:Nt},Zt=C||wO,Rt=m?l.createElement(OA.Provider,{value:L(L({},Wt),_t)},m(be)):l.createElement(Ia,Qe({},Wt,_t),typeof Zt=="function"?Zt(be):Zt),pt=l.createElement(I,Qe({className:Ae(!tt&&r,p),style:f,ref:e},g),Ge.map(en),rt?Rt:null,y&&l.createElement(Ia,Qe({},Wt,{responsive:Oe,responsiveDisabled:!Ze,order:xe,className:"".concat(Ie,"-suffix"),registerSize:At,display:!0,style:Jt}),y));return Oe?l.createElement(hi,{onResize:Be,disabled:!Ze},pt):pt}var Yr=l.forwardRef(IO);Yr.displayName="Overflow";Yr.Item=NC;Yr.RESPONSIVE=DC;Yr.INVALIDATE=BC;var FC=l.createContext(null);function kC(t,e){return t===void 0?null:"".concat(t,"-").concat(e)}function PC(t){var e=l.useContext(FC);return kC(e,t)}var xO=["children","locked"],jr=l.createContext(null);function RO(t,e){var n=L({},t);return Object.keys(e).forEach(function(r){var i=e[r];i!==void 0&&(n[r]=i)}),n}function Ga(t){var e=t.children,n=t.locked,r=Et(t,xO),i=l.useContext(jr),o=Ja(function(){return RO(i,r)},[i,r],function(a,s){return!n&&(a[0]!==s[0]||!Oa(a[1],s[1],!0))});return l.createElement(jr.Provider,{value:o},e)}var OO=[],QC=l.createContext(null);function pc(){return l.useContext(QC)}var jC=l.createContext(OO);function ta(t){var e=l.useContext(jC);return l.useMemo(function(){return t!==void 0?[].concat(Re(e),[t]):e},[e,t])}var LC=l.createContext(null),mf=l.createContext({});function dm(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(Af(t)){var n=t.nodeName.toLowerCase(),r=["input","select","textarea","button"].includes(n)||t.isContentEditable||n==="a"&&!!t.getAttribute("href"),i=t.getAttribute("tabindex"),o=Number(i),a=null;return i&&!Number.isNaN(o)?a=o:r&&a===null&&(a=0),r&&t.disabled&&(a=null),a!==null&&(a>=0||e&&a<0)}return!1}function MO(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=Re(t.querySelectorAll("*")).filter(function(r){return dm(r,e)});return dm(t,e)&&n.unshift(t),n}var vd=at.LEFT,Cd=at.RIGHT,yd=at.UP,nA=at.DOWN,rA=at.ENTER,UC=at.ESC,fa=at.HOME,ga=at.END,fm=[yd,nA,vd,Cd];function TO(t,e,n,r){var i,o="prev",a="next",s="children",A="parent";if(t==="inline"&&r===rA)return{inlineTrigger:!0};var c=Q(Q({},yd,o),nA,a),u=Q(Q(Q(Q({},vd,n?a:o),Cd,n?o:a),nA,s),rA,s),d=Q(Q(Q(Q(Q(Q({},yd,o),nA,a),rA,s),UC,A),vd,n?s:A),Cd,n?A:s),f={inline:c,horizontal:u,vertical:d,inlineSub:c,horizontalSub:d,verticalSub:d},p=(i=f["".concat(t).concat(e?"":"Sub")])===null||i===void 0?void 0:i[r];switch(p){case o:return{offset:-1,sibling:!0};case a:return{offset:1,sibling:!0};case A:return{offset:-1,sibling:!1};case s:return{offset:1,sibling:!1};default:return null}}function NO(t){for(var e=t;e;){if(e.getAttribute("data-menu-list"))return e;e=e.parentElement}return null}function DO(t,e){for(var n=t||document.activeElement;n;){if(e.has(n))return n;n=n.parentElement}return null}function vf(t,e){var n=MO(t,!0);return n.filter(function(r){return e.has(r)})}function gm(t,e,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1;if(!t)return null;var i=vf(t,e),o=i.length,a=i.findIndex(function(s){return n===s});return r<0?a===-1?a=o-1:a-=1:r>0&&(a+=1),a=(a+o)%o,i[a]}var Ed=function(e,n){var r=new Set,i=new Map,o=new Map;return e.forEach(function(a){var s=document.querySelector("[data-menu-id='".concat(kC(n,a),"']"));s&&(r.add(s),o.set(s,a),i.set(a,s))}),{elements:r,key2element:i,element2key:o}};function BO(t,e,n,r,i,o,a,s,A,c){var u=l.useRef(),d=l.useRef();d.current=e;var f=function(){qt.cancel(u.current)};return l.useEffect(function(){return function(){f()}},[]),function(p){var v=p.which;if([].concat(fm,[rA,UC,fa,ga]).includes(v)){var C=o(),m=Ed(C,r),y=m,w=y.elements,I=y.key2element,O=y.element2key,x=I.get(e),g=DO(x,w),M=O.get(g),E=TO(t,a(M,!0).length===1,n,v);if(!E&&v!==fa&&v!==ga)return;(fm.includes(v)||[fa,ga].includes(v))&&p.preventDefault();var b=function(P){if(P){var H=P,Z=P.querySelector("a");Z!=null&&Z.getAttribute("href")&&(H=Z);var V=O.get(P);s(V),f(),u.current=qt(function(){d.current===V&&H.focus()})}};if([fa,ga].includes(v)||E.sibling||!g){var h;!g||t==="inline"?h=i.current:h=NO(g);var S,T=vf(h,w);v===fa?S=T[0]:v===ga?S=T[T.length-1]:S=gm(h,w,g,E.offset),b(S)}else if(E.inlineTrigger)A(M);else if(E.offset>0)A(M,!0),f(),u.current=qt(function(){m=Ed(C,r);var k=g.getAttribute("aria-controls"),P=document.getElementById(k),H=gm(P,m.elements);b(H)},5);else if(E.offset<0){var R=a(M,!0),D=R[R.length-2],B=I.get(D);A(D,!1),b(B)}}c==null||c(p)}}function FO(t){Promise.resolve().then(t)}var Cf="__RC_UTIL_PATH_SPLIT__",hm=function(e){return e.join(Cf)},kO=function(e){return e.split(Cf)},bd="rc-menu-more";function PO(){var t=l.useState({}),e=ee(t,2),n=e[1],r=N.useRef(new Map),i=N.useRef(new Map),o=l.useState([]),a=ee(o,2),s=a[0],A=a[1],c=N.useRef(0),u=N.useRef(!1),d=function(){u.current||n({})},f=N.useCallback(function(I,O){process.env.NODE_ENV!=="production"&&yt(!r.current.has(I),"Duplicated key '".concat(I,"' used in Menu by path [").concat(O.join(" > "),"]"));var x=hm(O);i.current.set(x,I),r.current.set(I,x),c.current+=1;var g=c.current;FO(function(){g===c.current&&d()})},[]),p=N.useCallback(function(I,O){var x=hm(O);i.current.delete(x),r.current.delete(I)},[]),v=N.useCallback(function(I){A(I)},[]),C=N.useCallback(function(I,O){var x=r.current.get(I)||"",g=kO(x);return O&&s.includes(g[0])&&g.unshift(bd),g},[s]),m=N.useCallback(function(I,O){return I.filter(function(x){return x!==void 0}).some(function(x){var g=C(x,!0);return g.includes(O)})},[C]),y=function(){var O=Re(r.current.keys());return s.length&&O.push(bd),O},w=N.useCallback(function(I){var O="".concat(r.current.get(I)).concat(Cf),x=new Set;return Re(i.current.keys()).forEach(function(g){g.startsWith(O)&&x.add(i.current.get(g))}),x},[]);return l.useEffect(function(){return function(){u.current=!0}},[]),{registerPath:f,unregisterPath:p,refreshOverflowKeys:v,isSubPathKey:m,getKeyPath:C,getKeys:y,getSubPathKeys:w}}function Ca(t){var e=l.useRef(t);e.current=t;var n=l.useCallback(function(){for(var r,i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return(r=e.current)===null||r===void 0?void 0:r.call.apply(r,[e].concat(o))},[]);return t?n:void 0}var QO=Math.random().toFixed(5).toString().slice(2),pm=0;function jO(t){var e=Fn(t,{value:t}),n=ee(e,2),r=n[0],i=n[1];return l.useEffect(function(){pm+=1;var o=process.env.NODE_ENV==="test"?"test":"".concat(QO,"-").concat(pm);i("rc-menu-uuid-".concat(o))},[]),r}function HC(t,e,n,r){var i=l.useContext(jr),o=i.activeKey,a=i.onActive,s=i.onInactive,A={active:o===t};return e||(A.onMouseEnter=function(c){n==null||n({key:t,domEvent:c}),a(t)},A.onMouseLeave=function(c){r==null||r({key:t,domEvent:c}),s(t)}),A}function GC(t){var e=l.useContext(jr),n=e.mode,r=e.rtl,i=e.inlineIndent;if(n!=="inline")return null;var o=t;return r?{paddingRight:o*i}:{paddingLeft:o*i}}function qC(t){var e=t.icon,n=t.props,r=t.children,i;return e===null||e===!1?null:(typeof e=="function"?i=l.createElement(e,L({},n)):typeof e!="boolean"&&(i=e),i||r||null)}var LO=["item"];function MA(t){var e=t.item,n=Et(t,LO);return Object.defineProperty(n,"item",{get:function(){return yt(!1,"`info.item` is deprecated since we will move to function component that not provides React Node instance in future."),e}}),n}var UO=["title","attribute","elementRef"],HO=["style","className","eventKey","warnKey","disabled","itemIcon","children","role","onMouseEnter","onMouseLeave","onClick","onKeyDown","onFocus"],GO=["active"],qO=function(t){fi(n,t);var e=gi(n);function n(){return pn(this,n),e.apply(this,arguments)}return mn(n,[{key:"render",value:function(){var i=this.props,o=i.title,a=i.attribute,s=i.elementRef,A=Et(i,UO),c=tr(A,["eventKey","popupClassName","popupOffset","onTitleClick"]);return yt(!a,"`attribute` of Menu.Item is deprecated. Please pass attribute directly."),l.createElement(Yr.Item,Qe({},a,{title:typeof o=="string"?o:void 0},c,{ref:s}))}}]),n}(l.Component),ZO=l.forwardRef(function(t,e){var n=t.style,r=t.className,i=t.eventKey,o=t.warnKey,a=t.disabled,s=t.itemIcon,A=t.children,c=t.role,u=t.onMouseEnter,d=t.onMouseLeave,f=t.onClick,p=t.onKeyDown,v=t.onFocus,C=Et(t,HO),m=PC(i),y=l.useContext(jr),w=y.prefixCls,I=y.onItemClick,O=y.disabled,x=y.overflowDisabled,g=y.itemIcon,M=y.selectedKeys,E=y.onActive,b=l.useContext(mf),h=b._internalRenderMenuItem,S="".concat(w,"-item"),T=l.useRef(),R=l.useRef(),D=O||a,B=ji(e,R),k=ta(i);process.env.NODE_ENV!=="production"&&o&&yt(!1,"MenuItem should not leave undefined `key`.");var P=function(ce){return{key:i,keyPath:Re(k).reverse(),item:T.current,domEvent:ce}},H=s||g,Z=HC(i,D,u,d),V=Z.active,q=Et(Z,GO),U=M.includes(i),$=GC(k.length),z=function(ce){if(!D){var ue=P(ce);f==null||f(MA(ue)),I(ue)}},J=function(ce){if(p==null||p(ce),ce.which===at.ENTER){var ue=P(ce);f==null||f(MA(ue)),I(ue)}},W=function(ce){E(i),v==null||v(ce)},te={};t.role==="option"&&(te["aria-selected"]=U);var _=l.createElement(qO,Qe({ref:T,elementRef:B,role:c===null?"none":c||"menuitem",tabIndex:a?null:-1,"data-menu-id":x&&m?null:m},tr(C,["extra"]),q,te,{component:"li","aria-disabled":a,style:L(L({},$),n),className:Ae(S,Q(Q(Q({},"".concat(S,"-active"),V),"".concat(S,"-selected"),U),"".concat(S,"-disabled"),D),r),onClick:z,onKeyDown:J,onFocus:W}),A,l.createElement(qC,{props:L(L({},t),{},{isSelected:U}),icon:H}));return h&&(_=h(_,t,{selected:U})),_});function KO(t,e){var n=t.eventKey,r=pc(),i=ta(n);return l.useEffect(function(){if(r)return r.registerPath(n,i),function(){r.unregisterPath(n,i)}},[i]),r?null:l.createElement(ZO,Qe({},t,{ref:e}))}const mc=l.forwardRef(KO);var VO=["className","children"],zO=function(e,n){var r=e.className,i=e.children,o=Et(e,VO),a=l.useContext(jr),s=a.prefixCls,A=a.mode,c=a.rtl;return l.createElement("ul",Qe({className:Ae(s,c&&"".concat(s,"-rtl"),"".concat(s,"-sub"),"".concat(s,"-").concat(A==="inline"?"inline":"vertical"),r),role:"menu"},o,{"data-menu-list":!0,ref:n}),i)},yf=l.forwardRef(zO);yf.displayName="SubMenuList";function Ef(t,e){return Pr(t).map(function(n,r){if(l.isValidElement(n)){var i,o,a=n.key,s=(i=(o=n.props)===null||o===void 0?void 0:o.eventKey)!==null&&i!==void 0?i:a,A=s==null;A&&(s="tmp_key-".concat([].concat(Re(e),[r]).join("-")));var c={key:s,eventKey:s};return process.env.NODE_ENV!=="production"&&A&&(c.warnKey=!0),l.cloneElement(n,c)}return n})}var jn={adjustX:1,adjustY:1},YO={topLeft:{points:["bl","tl"],overflow:jn},topRight:{points:["br","tr"],overflow:jn},bottomLeft:{points:["tl","bl"],overflow:jn},bottomRight:{points:["tr","br"],overflow:jn},leftTop:{points:["tr","tl"],overflow:jn},leftBottom:{points:["br","bl"],overflow:jn},rightTop:{points:["tl","tr"],overflow:jn},rightBottom:{points:["bl","br"],overflow:jn}},WO={topLeft:{points:["bl","tl"],overflow:jn},topRight:{points:["br","tr"],overflow:jn},bottomLeft:{points:["tl","bl"],overflow:jn},bottomRight:{points:["tr","br"],overflow:jn},rightTop:{points:["tr","tl"],overflow:jn},rightBottom:{points:["br","bl"],overflow:jn},leftTop:{points:["tl","tr"],overflow:jn},leftBottom:{points:["bl","br"],overflow:jn}};function ZC(t,e,n){if(e)return e;if(n)return n[t]||n.other}var JO={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"};function _O(t){var e=t.prefixCls,n=t.visible,r=t.children,i=t.popup,o=t.popupStyle,a=t.popupClassName,s=t.popupOffset,A=t.disabled,c=t.mode,u=t.onVisibleChange,d=l.useContext(jr),f=d.getPopupContainer,p=d.rtl,v=d.subMenuOpenDelay,C=d.subMenuCloseDelay,m=d.builtinPlacements,y=d.triggerSubMenuAction,w=d.forceSubMenuRender,I=d.rootClassName,O=d.motion,x=d.defaultMotions,g=l.useState(!1),M=ee(g,2),E=M[0],b=M[1],h=L(p?L({},WO):L({},YO),m),S=JO[c],T=ZC(c,O,x),R=l.useRef(T);c!=="inline"&&(R.current=T);var D=L(L({},R.current),{},{leavedClassName:"".concat(e,"-hidden"),removeOnLeave:!1,motionAppear:!0}),B=l.useRef();return l.useEffect(function(){return B.current=qt(function(){b(n)}),function(){qt.cancel(B.current)}},[n]),l.createElement(hc,{prefixCls:e,popupClassName:Ae("".concat(e,"-popup"),Q({},"".concat(e,"-rtl"),p),a,I),stretch:c==="horizontal"?"minWidth":null,getPopupContainer:f,builtinPlacements:h,popupPlacement:S,popupVisible:E,popup:i,popupStyle:o,popupAlign:s&&{offset:s},action:A?[]:[y],mouseEnterDelay:v,mouseLeaveDelay:C,onPopupVisibleChange:u,forceRender:w,popupMotion:D,fresh:!0},r)}function $O(t){var e=t.id,n=t.open,r=t.keyPath,i=t.children,o="inline",a=l.useContext(jr),s=a.prefixCls,A=a.forceSubMenuRender,c=a.motion,u=a.defaultMotions,d=a.mode,f=l.useRef(!1);f.current=d===o;var p=l.useState(!f.current),v=ee(p,2),C=v[0],m=v[1],y=f.current?n:!1;l.useEffect(function(){f.current&&m(!1)},[d]);var w=L({},ZC(o,c,u));r.length>1&&(w.motionAppear=!1);var I=w.onVisibleChanged;return w.onVisibleChanged=function(O){return!f.current&&!O&&m(!0),I==null?void 0:I(O)},C?null:l.createElement(Ga,{mode:o,locked:!f.current},l.createElement(lo,Qe({visible:y},w,{forceRender:A,removeOnLeave:!1,leavedClassName:"".concat(s,"-hidden")}),function(O){var x=O.className,g=O.style;return l.createElement(yf,{id:e,className:x,style:g},i)}))}var XO=["style","className","title","eventKey","warnKey","disabled","internalPopupClose","children","itemIcon","expandIcon","popupClassName","popupOffset","popupStyle","onClick","onMouseEnter","onMouseLeave","onTitleClick","onTitleMouseEnter","onTitleMouseLeave"],eM=["active"],tM=l.forwardRef(function(t,e){var n=t.style,r=t.className,i=t.title,o=t.eventKey,a=t.warnKey,s=t.disabled,A=t.internalPopupClose,c=t.children,u=t.itemIcon,d=t.expandIcon,f=t.popupClassName,p=t.popupOffset,v=t.popupStyle,C=t.onClick,m=t.onMouseEnter,y=t.onMouseLeave,w=t.onTitleClick,I=t.onTitleMouseEnter,O=t.onTitleMouseLeave,x=Et(t,XO),g=PC(o),M=l.useContext(jr),E=M.prefixCls,b=M.mode,h=M.openKeys,S=M.disabled,T=M.overflowDisabled,R=M.activeKey,D=M.selectedKeys,B=M.itemIcon,k=M.expandIcon,P=M.onItemClick,H=M.onOpenChange,Z=M.onActive,V=l.useContext(mf),q=V._internalRenderSubMenuItem,U=l.useContext(LC),$=U.isSubPathKey,z=ta(),J="".concat(E,"-submenu"),W=S||s,te=l.useRef(),_=l.useRef();process.env.NODE_ENV!=="production"&&a&&yt(!1,"SubMenu should not leave undefined `key`.");var se=u??B,ce=d??k,ue=h.includes(o),ne=!T&&ue,me=$(D,o),Y=HC(o,W,I,O),de=Y.active,le=Et(Y,eM),Se=l.useState(!1),xe=ee(Se,2),Ce=xe[0],De=xe[1],je=function(At){W||De(At)},Le=function(At){je(!0),m==null||m({key:o,domEvent:At})},Ie=function(At){je(!1),y==null||y({key:o,domEvent:At})},pe=l.useMemo(function(){return de||(b!=="inline"?Ce||$([R],o):!1)},[b,de,R,Ce,o,$]),Oe=GC(z.length),Ze=function(At){W||(w==null||w({key:o,domEvent:At}),b==="inline"&&H(o,!ue))},tt=Ca(function(st){C==null||C(MA(st)),P(st)}),rt=function(At){b!=="inline"&&H(o,At)},Ge=function(){Z(o)},be=g&&"".concat(g,"-popup"),Je=l.useMemo(function(){return l.createElement(qC,{icon:b!=="horizontal"?ce:void 0,props:L(L({},t),{},{isOpen:ne,isSubMenu:!0})},l.createElement("i",{className:"".concat(J,"-arrow")}))},[b,ce,t,ne,J]),lt=l.createElement("div",Qe({role:"menuitem",style:Oe,className:"".concat(J,"-title"),tabIndex:W?null:-1,ref:te,title:typeof i=="string"?i:null,"data-menu-id":T&&g?null:g,"aria-expanded":ne,"aria-haspopup":!0,"aria-controls":be,"aria-disabled":W,onClick:Ze,onFocus:Ge},le),i,Je),$e=l.useRef(b);if(b!=="inline"&&z.length>1?$e.current="vertical":$e.current=b,!T){var Be=$e.current;lt=l.createElement(_O,{mode:Be,prefixCls:J,visible:!A&&ne&&b!=="inline",popupClassName:f,popupOffset:p,popupStyle:v,popup:l.createElement(Ga,{mode:Be==="horizontal"?"vertical":Be},l.createElement(yf,{id:be,ref:_},c)),disabled:W,onVisibleChange:rt},lt)}var Me=l.createElement(Yr.Item,Qe({ref:e,role:"none"},x,{component:"li",style:n,className:Ae(J,"".concat(J,"-").concat(b),r,Q(Q(Q(Q({},"".concat(J,"-open"),ne),"".concat(J,"-active"),pe),"".concat(J,"-selected"),me),"".concat(J,"-disabled"),W)),onMouseEnter:Le,onMouseLeave:Ie}),lt,!T&&l.createElement($O,{id:be,open:ne,keyPath:z},c));return q&&(Me=q(Me,t,{selected:me,active:pe,open:ne,disabled:W})),l.createElement(Ga,{onItemClick:tt,mode:b==="horizontal"?"vertical":b,itemIcon:se,expandIcon:ce},Me)}),cs=l.forwardRef(function(t,e){var n=t.eventKey,r=t.children,i=ta(n),o=Ef(r,i),a=pc();l.useEffect(function(){if(a)return a.registerPath(n,i),function(){a.unregisterPath(n,i)}},[i]);var s;return a?s=o:s=l.createElement(tM,Qe({ref:e},t),o),l.createElement(jC.Provider,{value:i},s)});process.env.NODE_ENV!=="production"&&(cs.displayName="SubMenu");function bf(t){var e=t.className,n=t.style,r=l.useContext(jr),i=r.prefixCls,o=pc();return o?null:l.createElement("li",{role:"separator",className:Ae("".concat(i,"-item-divider"),e),style:n})}var nM=["className","title","eventKey","children"],rM=l.forwardRef(function(t,e){var n=t.className,r=t.title;t.eventKey;var i=t.children,o=Et(t,nM),a=l.useContext(jr),s=a.prefixCls,A="".concat(s,"-item-group");return l.createElement("li",Qe({ref:e,role:"presentation"},o,{onClick:function(u){return u.stopPropagation()},className:Ae(A,n)}),l.createElement("div",{role:"presentation",className:"".concat(A,"-title"),title:typeof r=="string"?r:void 0},r),l.createElement("ul",{role:"group",className:"".concat(A,"-list")},i))}),vc=l.forwardRef(function(t,e){var n=t.eventKey,r=t.children,i=ta(n),o=Ef(r,i),a=pc();return a?o:l.createElement(rM,Qe({ref:e},tr(t,["warnKey"])),o)});process.env.NODE_ENV!=="production"&&(vc.displayName="MenuItemGroup");var iM=["label","children","key","type","extra"];function Sd(t,e,n){var r=e.item,i=e.group,o=e.submenu,a=e.divider;return(t||[]).map(function(s,A){if(s&&et(s)==="object"){var c=s,u=c.label,d=c.children,f=c.key,p=c.type,v=c.extra,C=Et(c,iM),m=f??"tmp-".concat(A);return d||p==="group"?p==="group"?l.createElement(i,Qe({key:m},C,{title:u}),Sd(d,e,n)):l.createElement(o,Qe({key:m},C,{title:u}),Sd(d,e,n)):p==="divider"?l.createElement(a,Qe({key:m},C)):l.createElement(r,Qe({key:m},C,{extra:v}),u,(!!v||v===0)&&l.createElement("span",{className:"".concat(n,"-item-extra")},v))}return null}).filter(function(s){return s})}function mm(t,e,n,r,i){var o=t,a=L({divider:bf,item:mc,group:vc,submenu:cs},r);return e&&(o=Sd(e,a,i)),Ef(o,n)}var oM=["prefixCls","rootClassName","style","className","tabIndex","items","children","direction","id","mode","inlineCollapsed","disabled","disabledOverflow","subMenuOpenDelay","subMenuCloseDelay","forceSubMenuRender","defaultOpenKeys","openKeys","activeKey","defaultActiveFirst","selectable","multiple","defaultSelectedKeys","selectedKeys","onSelect","onDeselect","inlineIndent","motion","defaultMotions","triggerSubMenuAction","builtinPlacements","itemIcon","expandIcon","overflowedIndicator","overflowedIndicatorPopupClassName","getPopupContainer","onClick","onOpenChange","onKeyDown","openAnimation","openTransitionName","_internalRenderMenuItem","_internalRenderSubMenuItem","_internalComponents"],qi=[],aM=l.forwardRef(function(t,e){var n,r=t,i=r.prefixCls,o=i===void 0?"rc-menu":i,a=r.rootClassName,s=r.style,A=r.className,c=r.tabIndex,u=c===void 0?0:c,d=r.items,f=r.children,p=r.direction,v=r.id,C=r.mode,m=C===void 0?"vertical":C,y=r.inlineCollapsed,w=r.disabled,I=r.disabledOverflow,O=r.subMenuOpenDelay,x=O===void 0?.1:O,g=r.subMenuCloseDelay,M=g===void 0?.1:g,E=r.forceSubMenuRender,b=r.defaultOpenKeys,h=r.openKeys,S=r.activeKey,T=r.defaultActiveFirst,R=r.selectable,D=R===void 0?!0:R,B=r.multiple,k=B===void 0?!1:B,P=r.defaultSelectedKeys,H=r.selectedKeys,Z=r.onSelect,V=r.onDeselect,q=r.inlineIndent,U=q===void 0?24:q,$=r.motion,z=r.defaultMotions,J=r.triggerSubMenuAction,W=J===void 0?"hover":J,te=r.builtinPlacements,_=r.itemIcon,se=r.expandIcon,ce=r.overflowedIndicator,ue=ce===void 0?"...":ce,ne=r.overflowedIndicatorPopupClassName,me=r.getPopupContainer,Y=r.onClick,de=r.onOpenChange,le=r.onKeyDown,Se=r.openAnimation,xe=r.openTransitionName,Ce=r._internalRenderMenuItem,De=r._internalRenderSubMenuItem,je=r._internalComponents,Le=Et(r,oM),Ie=l.useMemo(function(){return[mm(f,d,qi,je,o),mm(f,d,qi,{},o)]},[f,d,je]),pe=ee(Ie,2),Oe=pe[0],Ze=pe[1],tt=l.useState(!1),rt=ee(tt,2),Ge=rt[0],be=rt[1],Je=l.useRef(),lt=jO(v),$e=p==="rtl";process.env.NODE_ENV!=="production"&&yt(!Se&&!xe,"`openAnimation` and `openTransitionName` is removed. Please use `motion` or `defaultMotion` instead.");var Be=Fn(b,{value:h,postState:function(gt){return gt||qi}}),Me=ee(Be,2),st=Me[0],At=Me[1],Ct=function(gt){var bt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;function Tt(){At(gt),de==null||de(gt)}bt?Wr.flushSync(Tt):Tt()},Nt=l.useState(st),Jt=ee(Nt,2),Wt=Jt[0],en=Jt[1],_t=l.useRef(!1),Zt=l.useMemo(function(){return(m==="inline"||m==="vertical")&&y?["vertical",y]:[m,!1]},[m,y]),Rt=ee(Zt,2),pt=Rt[0],Ve=Rt[1],_e=pt==="inline",Te=l.useState(pt),ot=ee(Te,2),mt=ot[0],Fe=ot[1],we=l.useState(Ve),Ke=ee(we,2),ze=Ke[0],Ue=Ke[1];l.useEffect(function(){Fe(pt),Ue(Ve),_t.current&&(_e?At(Wt):Ct(qi))},[pt,Ve]);var F=l.useState(0),ge=ee(F,2),j=ge[0],re=ge[1],X=j>=Oe.length-1||mt!=="horizontal"||I;l.useEffect(function(){_e&&en(st)},[st]),l.useEffect(function(){return _t.current=!0,function(){_t.current=!1}},[]);var ve=PO(),ke=ve.registerPath,Xe=ve.unregisterPath,Ft=ve.refreshOverflowKeys,ft=ve.isSubPathKey,St=ve.getKeyPath,Ee=ve.getKeys,Ne=ve.getSubPathKeys,ct=l.useMemo(function(){return{registerPath:ke,unregisterPath:Xe}},[ke,Xe]),ut=l.useMemo(function(){return{isSubPathKey:ft}},[ft]);l.useEffect(function(){Ft(X?qi:Oe.slice(j+1).map(function(qe){return qe.key}))},[j,X]);var kt=Fn(S||T&&((n=Oe[0])===null||n===void 0?void 0:n.key),{value:S}),Pn=ee(kt,2),ln=Pn[0],Yn=Pn[1],Hr=Ca(function(qe){Yn(qe)}),Hn=Ca(function(){Yn(void 0)});N.useImperativeHandle(e,function(){return{list:Je.current,focus:function(gt){var bt,Tt=Ee(),Bt=Ed(Tt,lt),Sn=Bt.elements,wn=Bt.key2element,Wn=Bt.element2key,rr=vf(Je.current,Sn),Jn=ln??(rr[0]?Wn.get(rr[0]):(bt=Oe.find(function(Hi){return!Hi.props.disabled}))===null||bt===void 0?void 0:bt.key),_n=wn.get(Jn);if(Jn&&_n){var vn;_n==null||(vn=_n.focus)===null||vn===void 0||vn.call(_n,gt)}}}});var Gn=Fn(P||[],{value:H,postState:function(gt){return Array.isArray(gt)?gt:gt==null?qi:[gt]}}),xr=ee(Gn,2),qn=xr[0],Xr=xr[1],Rr=function(gt){if(D){var bt=gt.key,Tt=qn.includes(bt),Bt;k?Tt?Bt=qn.filter(function(wn){return wn!==bt}):Bt=[].concat(Re(qn),[bt]):Bt=[bt],Xr(Bt);var Sn=L(L({},gt),{},{selectedKeys:Bt});Tt?V==null||V(Sn):Z==null||Z(Sn)}!k&&st.length&&mt!=="inline"&&Ct(qi)},Zn=Ca(function(qe){Y==null||Y(MA(qe)),Rr(qe)}),nr=Ca(function(qe,gt){var bt=st.filter(function(Bt){return Bt!==qe});if(gt)bt.push(qe);else if(mt!=="inline"){var Tt=Ne(qe);bt=bt.filter(function(Bt){return!Tt.has(Bt)})}Oa(st,bt,!0)||Ct(bt,!0)}),gr=function(gt,bt){var Tt=bt??!st.includes(gt);nr(gt,Tt)},hr=BO(mt,ln,$e,lt,Je,Ee,St,Yn,gr,le);l.useEffect(function(){be(!0)},[]);var Gr=l.useMemo(function(){return{_internalRenderMenuItem:Ce,_internalRenderSubMenuItem:De}},[Ce,De]),ei=mt!=="horizontal"||I?Oe:Oe.map(function(qe,gt){return l.createElement(Ga,{key:qe.key,overflowDisabled:gt>j},qe)}),wt=l.createElement(Yr,Qe({id:v,ref:Je,prefixCls:"".concat(o,"-overflow"),component:"ul",itemComponent:mc,className:Ae(o,"".concat(o,"-root"),"".concat(o,"-").concat(mt),A,Q(Q({},"".concat(o,"-inline-collapsed"),ze),"".concat(o,"-rtl"),$e),a),dir:p,style:s,role:"menu",tabIndex:u,data:ei,renderRawItem:function(gt){return gt},renderRawRest:function(gt){var bt=gt.length,Tt=bt?Oe.slice(-bt):null;return l.createElement(cs,{eventKey:bd,title:ue,disabled:X,internalPopupClose:bt===0,popupClassName:ne},Tt)},maxCount:mt!=="horizontal"||I?Yr.INVALIDATE:Yr.RESPONSIVE,ssr:"full","data-menu-list":!0,onVisibleChange:function(gt){re(gt)},onKeyDown:hr},Le));return l.createElement(mf.Provider,{value:Gr},l.createElement(FC.Provider,{value:lt},l.createElement(Ga,{prefixCls:o,rootClassName:a,mode:mt,openKeys:st,rtl:$e,disabled:w,motion:Ge?$:null,defaultMotions:Ge?z:null,activeKey:ln,onActive:Hr,onInactive:Hn,selectedKeys:qn,inlineIndent:U,subMenuOpenDelay:x,subMenuCloseDelay:M,forceSubMenuRender:E,builtinPlacements:te,triggerSubMenuAction:W,getPopupContainer:me,itemIcon:_,expandIcon:se,onItemClick:Zn,onOpenChange:nr},l.createElement(LC.Provider,{value:ut},wt),l.createElement("div",{style:{display:"none"},"aria-hidden":!0},l.createElement(QC.Provider,{value:ct},Ze)))))}),ls=aM;ls.Item=mc;ls.SubMenu=cs;ls.ItemGroup=vc;ls.Divider=bf;var sM={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M912 192H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM104 228a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0z"}}]},name:"bars",theme:"outlined"},AM=function(e,n){return l.createElement(Nn,Qe({},e,{ref:n,icon:sM}))},KC=l.forwardRef(AM);process.env.NODE_ENV!=="production"&&(KC.displayName="BarsOutlined");var cM={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 000 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z"}}]},name:"left",theme:"outlined"},lM=function(e,n){return l.createElement(Nn,Qe({},e,{ref:n,icon:cM}))},wd=l.forwardRef(lM);process.env.NODE_ENV!=="production"&&(wd.displayName="LeftOutlined");const uM=l.createContext({siderHook:{addSider:()=>null,removeSider:()=>null}}),dM=t=>{const{antCls:e,componentCls:n,colorText:r,footerBg:i,headerHeight:o,headerPadding:a,headerColor:s,footerPadding:A,fontSize:c,bodyBg:u,headerBg:d}=t;return{[n]:{display:"flex",flex:"auto",flexDirection:"column",minHeight:0,background:u,"&, *":{boxSizing:"border-box"},[`&${n}-has-sider`]:{flexDirection:"row",[`> ${n}, > ${n}-content`]:{width:0}},[`${n}-header, &${n}-footer`]:{flex:"0 0 auto"},"&-rtl":{direction:"rtl"}},[`${n}-header`]:{height:o,padding:a,color:s,lineHeight:ye(o),background:d,[`${e}-menu`]:{lineHeight:"inherit"}},[`${n}-footer`]:{padding:A,color:r,fontSize:c,background:i},[`${n}-content`]:{flex:"auto",color:r,minHeight:0}}},VC=t=>{const{colorBgLayout:e,controlHeight:n,controlHeightLG:r,colorText:i,controlHeightSM:o,marginXXS:a,colorTextLightSolid:s,colorBgContainer:A}=t,c=r*1.25;return{colorBgHeader:"#001529",colorBgBody:e,colorBgTrigger:"#002140",bodyBg:e,headerBg:"#001529",headerHeight:n*2,headerPadding:`0 ${c}px`,headerColor:i,footerPadding:`${o}px ${c}px`,footerBg:e,siderBg:"#001529",triggerHeight:r+a*2,triggerBg:"#002140",triggerColor:s,zeroTriggerWidth:r,zeroTriggerHeight:r,lightSiderBg:A,lightTriggerBg:A,lightTriggerColor:i}},zC=[["colorBgBody","bodyBg"],["colorBgHeader","headerBg"],["colorBgTrigger","triggerBg"]];Tn("Layout",t=>[dM(t)],VC,{deprecatedTokens:zC});const fM=t=>{const{componentCls:e,siderBg:n,motionDurationMid:r,motionDurationSlow:i,antCls:o,triggerHeight:a,triggerColor:s,triggerBg:A,headerHeight:c,zeroTriggerWidth:u,zeroTriggerHeight:d,borderRadiusLG:f,lightSiderBg:p,lightTriggerColor:v,lightTriggerBg:C,bodyBg:m}=t;return{[e]:{position:"relative",minWidth:0,background:n,transition:`all ${r}, background 0s`,"&-has-trigger":{paddingBottom:a},"&-right":{order:1},[`${e}-children`]:{height:"100%",marginTop:-.1,paddingTop:.1,[`${o}-menu${o}-menu-inline-collapsed`]:{width:"auto"}},[`${e}-trigger`]:{position:"fixed",bottom:0,zIndex:1,height:a,color:s,lineHeight:ye(a),textAlign:"center",background:A,cursor:"pointer",transition:`all ${r}`},[`${e}-zero-width`]:{"> *":{overflow:"hidden"},"&-trigger":{position:"absolute",top:c,insetInlineEnd:t.calc(u).mul(-1).equal(),zIndex:1,width:u,height:d,color:s,fontSize:t.fontSizeXL,display:"flex",alignItems:"center",justifyContent:"center",background:n,borderRadius:`0 ${ye(f)} ${ye(f)} 0`,cursor:"pointer",transition:`background ${i} ease`,"&::after":{position:"absolute",inset:0,background:"transparent",transition:`all ${i}`,content:'""'},"&:hover::after":{background:"rgba(255, 255, 255, 0.2)"},"&-right":{insetInlineStart:t.calc(u).mul(-1).equal(),borderRadius:`${ye(f)} 0 0 ${ye(f)}`}}},"&-light":{background:p,[`${e}-trigger`]:{color:v,background:C},[`${e}-zero-width-trigger`]:{color:v,background:C,border:`1px solid ${m}`,borderInlineStart:0}}}}},gM=Tn(["Layout","Sider"],t=>[fM(t)],VC,{deprecatedTokens:zC});var hM=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n};const vm={xs:"479.98px",sm:"575.98px",md:"767.98px",lg:"991.98px",xl:"1199.98px",xxl:"1599.98px"},pM=t=>!Number.isNaN(Number.parseFloat(t))&&isFinite(t),Sf=l.createContext({}),mM=(()=>{let t=0;return function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return t+=1,`${e}${t}`}})(),vM=l.forwardRef((t,e)=>{const{prefixCls:n,className:r,trigger:i,children:o,defaultCollapsed:a=!1,theme:s="dark",style:A={},collapsible:c=!1,reverseArrow:u=!1,width:d=200,collapsedWidth:f=80,zeroWidthTriggerStyle:p,breakpoint:v,onCollapse:C,onBreakpoint:m}=t,y=hM(t,["prefixCls","className","trigger","children","defaultCollapsed","theme","style","collapsible","reverseArrow","width","collapsedWidth","zeroWidthTriggerStyle","breakpoint","onCollapse","onBreakpoint"]),{siderHook:w}=N.useContext(uM),[I,O]=N.useState("collapsed"in t?t.collapsed:a),[x,g]=N.useState(!1);N.useEffect(()=>{"collapsed"in t&&O(t.collapsed)},[t.collapsed]);const M=(_,se)=>{"collapsed"in t||O(_),C==null||C(_,se)},{getPrefixCls:E,direction:b}=N.useContext(Qt),h=E("layout-sider",n),[S,T,R]=gM(h),D=N.useRef(null);D.current=_=>{g(_.matches),m==null||m(_.matches),I!==_.matches&&M(_.matches,"responsive")},N.useEffect(()=>{function _(ce){return D.current(ce)}let se;if(typeof window<"u"){const{matchMedia:ce}=window;if(ce&&v&&v in vm){se=ce(`screen and (max-width: ${vm[v]})`);try{se.addEventListener("change",_)}catch{se.addListener(_)}_(se)}}return()=>{try{se==null||se.removeEventListener("change",_)}catch{se==null||se.removeListener(_)}}},[v]),N.useEffect(()=>{const _=mM("ant-sider-");return w.addSider(_),()=>w.removeSider(_)},[]);const B=()=>{M(!I,"clickTrigger")},k=tr(y,["collapsed"]),P=I?f:d,H=pM(P)?`${P}px`:String(P),Z=parseFloat(String(f||0))===0?l.createElement("span",{onClick:B,className:Ae(`${h}-zero-width-trigger`,`${h}-zero-width-trigger-${u?"right":"left"}`),style:p},i||l.createElement(KC,null)):null,V=b==="rtl"==!u,$={expanded:V?l.createElement(IA,null):l.createElement(wd,null),collapsed:V?l.createElement(wd,null):l.createElement(IA,null)}[I?"collapsed":"expanded"],z=i!==null?Z||l.createElement("div",{className:`${h}-trigger`,onClick:B,style:{width:H}},i||$):null,J=Object.assign(Object.assign({},A),{flex:`0 0 ${H}`,maxWidth:H,minWidth:H,width:H}),W=Ae(h,`${h}-${s}`,{[`${h}-collapsed`]:!!I,[`${h}-has-trigger`]:c&&i!==null&&!Z,[`${h}-below`]:!!x,[`${h}-zero-width`]:parseFloat(H)===0},r,T,R),te=l.useMemo(()=>({siderCollapsed:I}),[I]);return S(l.createElement(Sf.Provider,{value:te},l.createElement("aside",Object.assign({className:W},k,{style:J,ref:e}),l.createElement("div",{className:`${h}-children`},o),c||x&&Z?z:null)))});process.env.NODE_ENV!=="production"&&(vM.displayName="Sider");var CM={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M176 511a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0z"}}]},name:"ellipsis",theme:"outlined"},yM=function(e,n){return l.createElement(Nn,Qe({},e,{ref:n,icon:CM}))},wf=l.forwardRef(yM);process.env.NODE_ENV!=="production"&&(wf.displayName="EllipsisOutlined");const TA=N.createContext({prefixCls:"",firstLevel:!0,inlineCollapsed:!1});var EM=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n};const YC=t=>{const{prefixCls:e,className:n,dashed:r}=t,i=EM(t,["prefixCls","className","dashed"]),{getPrefixCls:o}=l.useContext(Qt),a=o("menu",e),s=Ae({[`${a}-item-divider-dashed`]:!!r},n);return l.createElement(bf,Object.assign({className:s},i))};function If(t){var e=t.children,n=t.prefixCls,r=t.id,i=t.overlayInnerStyle,o=t.bodyClassName,a=t.className,s=t.style;return l.createElement("div",{className:Ae("".concat(n,"-content"),a),style:s},l.createElement("div",{className:Ae("".concat(n,"-inner"),o),id:r,role:"tooltip",style:i},typeof e=="function"?e():e))}var wo={shiftX:64,adjustY:1},Io={adjustX:1,shiftY:!0},yr=[0,0],bM={left:{points:["cr","cl"],overflow:Io,offset:[-4,0],targetOffset:yr},right:{points:["cl","cr"],overflow:Io,offset:[4,0],targetOffset:yr},top:{points:["bc","tc"],overflow:wo,offset:[0,-4],targetOffset:yr},bottom:{points:["tc","bc"],overflow:wo,offset:[0,4],targetOffset:yr},topLeft:{points:["bl","tl"],overflow:wo,offset:[0,-4],targetOffset:yr},leftTop:{points:["tr","tl"],overflow:Io,offset:[-4,0],targetOffset:yr},topRight:{points:["br","tr"],overflow:wo,offset:[0,-4],targetOffset:yr},rightTop:{points:["tl","tr"],overflow:Io,offset:[4,0],targetOffset:yr},bottomRight:{points:["tr","br"],overflow:wo,offset:[0,4],targetOffset:yr},rightBottom:{points:["bl","br"],overflow:Io,offset:[4,0],targetOffset:yr},bottomLeft:{points:["tl","bl"],overflow:wo,offset:[0,4],targetOffset:yr},leftBottom:{points:["br","bl"],overflow:Io,offset:[-4,0],targetOffset:yr}},SM=["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","motion","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle","arrowContent","overlay","id","showArrow","classNames","styles"],wM=function(e,n){var r=e.overlayClassName,i=e.trigger,o=i===void 0?["hover"]:i,a=e.mouseEnterDelay,s=a===void 0?0:a,A=e.mouseLeaveDelay,c=A===void 0?.1:A,u=e.overlayStyle,d=e.prefixCls,f=d===void 0?"rc-tooltip":d,p=e.children,v=e.onVisibleChange,C=e.afterVisibleChange,m=e.transitionName,y=e.animation,w=e.motion,I=e.placement,O=I===void 0?"right":I,x=e.align,g=x===void 0?{}:x,M=e.destroyTooltipOnHide,E=M===void 0?!1:M,b=e.defaultVisible,h=e.getTooltipContainer,S=e.overlayInnerStyle;e.arrowContent;var T=e.overlay,R=e.id,D=e.showArrow,B=D===void 0?!0:D,k=e.classNames,P=e.styles,H=Et(e,SM),Z=rc(R),V=N.useRef(null);N.useImperativeHandle(n,function(){return V.current});var q=L({},H);"visible"in e&&(q.popupVisible=e.visible);var U=function(){return l.createElement(If,{key:"content",prefixCls:f,id:Z,bodyClassName:k==null?void 0:k.body,overlayInnerStyle:L(L({},S),P==null?void 0:P.body)},T)},$=function(){var J=l.Children.only(p),W=(J==null?void 0:J.props)||{},te=L(L({},W),{},{"aria-describedby":T?Z:null});return l.cloneElement(p,te)};return l.createElement(hc,Qe({popupClassName:Ae(r,k==null?void 0:k.root),prefixCls:f,popup:U,action:o,builtinPlacements:bM,popupPlacement:O,ref:V,popupAlign:g,getPopupContainer:h,onPopupVisibleChange:v,afterPopupVisibleChange:C,popupTransitionName:m,popupAnimation:y,popupMotion:w,defaultPopupVisible:b,autoDestroy:E,mouseLeaveDelay:c,popupStyle:L(L({},u),P==null?void 0:P.root),mouseEnterDelay:s,arrow:B},q),$())};const IM=N.forwardRef(wM),xM=Bi.map(t=>`${t}-inverse`),RM=["success","processing","error","default","warning"];function WC(t){return(arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0)?[].concat(Re(xM),Re(Bi)).includes(t):Bi.includes(t)}function OM(t){return RM.includes(t)}function JC(t,e){const n=WC(e),r=Ae({[`${t}-${e}`]:e&&n}),i={},o={};return e&&!n&&(i.background=e,o["--antd-arrow-background-color"]=e),{className:r,overlayStyle:i,arrowStyle:o}}const MM=t=>{const{prefixCls:e,className:n,placement:r="top",title:i,color:o,overlayInnerStyle:a}=t,{getPrefixCls:s}=l.useContext(Qt),A=s("tooltip",e),[c,u,d]=T1(A),f=JC(A,o),p=f.arrowStyle,v=Object.assign(Object.assign({},a),f.overlayStyle),C=Ae(u,d,A,`${A}-pure`,`${A}-placement-${r}`,n,f.className);return c(l.createElement("div",{className:C,style:p},l.createElement("div",{className:`${A}-arrow`}),l.createElement(If,Object.assign({},t,{className:u,prefixCls:A,overlayInnerStyle:v}),i)))};var TM=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n};const NM=l.forwardRef((t,e)=>{var n,r;const{prefixCls:i,openClassName:o,getTooltipContainer:a,color:s,overlayInnerStyle:A,children:c,afterOpenChange:u,afterVisibleChange:d,destroyTooltipOnHide:f,arrow:p=!0,title:v,overlay:C,builtinPlacements:m,arrowPointAtCenter:y=!1,autoAdjustOverflow:w=!0,motion:I,getPopupContainer:O,placement:x="top",mouseEnterDelay:g=.1,mouseLeaveDelay:M=.1,overlayStyle:E,rootClassName:b,overlayClassName:h,styles:S,classNames:T}=t,R=TM(t,["prefixCls","openClassName","getTooltipContainer","color","overlayInnerStyle","children","afterOpenChange","afterVisibleChange","destroyTooltipOnHide","arrow","title","overlay","builtinPlacements","arrowPointAtCenter","autoAdjustOverflow","motion","getPopupContainer","placement","mouseEnterDelay","mouseLeaveDelay","overlayStyle","rootClassName","overlayClassName","styles","classNames"]),D=!!p,[,B]=dr(),{getPopupContainer:k,getPrefixCls:P,direction:H,className:Z,style:V,classNames:q,styles:U}=Jr("tooltip"),$=cn("Tooltip"),z=l.useRef(null),J=()=>{var be;(be=z.current)===null||be===void 0||be.forceAlign()};l.useImperativeHandle(e,()=>{var be,Je;return{forceAlign:J,forcePopupAlign:()=>{$.deprecated(!1,"forcePopupAlign","forceAlign"),J()},nativeElement:(be=z.current)===null||be===void 0?void 0:be.nativeElement,popupElement:(Je=z.current)===null||Je===void 0?void 0:Je.popupElement}}),process.env.NODE_ENV!=="production"&&([["visible","open"],["defaultVisible","defaultOpen"],["onVisibleChange","onOpenChange"],["afterVisibleChange","afterOpenChange"],["arrowPointAtCenter","arrow={{ pointAtCenter: true }}"],["overlayStyle","styles={{ root: {} }}"],["overlayInnerStyle","styles={{ body: {} }}"],["overlayClassName","classNames={{ root: {} }}"]].forEach(be=>{let[Je,lt]=be;$.deprecated(!(Je in t),Je,lt)}),process.env.NODE_ENV!=="production"&&$(!f||typeof f=="boolean","usage","`destroyTooltipOnHide` no need config `keepParent` anymore. Please use `boolean` value directly."),process.env.NODE_ENV!=="production"&&$(!p||typeof p=="boolean"||!("arrowPointAtCenter"in p),"deprecated","`arrowPointAtCenter` in `arrow` is deprecated. Please use `pointAtCenter` instead."));const[W,te]=Fn(!1,{value:(n=t.open)!==null&&n!==void 0?n:t.visible,defaultValue:(r=t.defaultOpen)!==null&&r!==void 0?r:t.defaultVisible}),_=!v&&!C&&v!==0,se=be=>{var Je,lt;te(_?!1:be),_||((Je=t.onOpenChange)===null||Je===void 0||Je.call(t,be),(lt=t.onVisibleChange)===null||lt===void 0||lt.call(t,be))},ce=l.useMemo(()=>{var be,Je;let lt=y;return typeof p=="object"&&(lt=(Je=(be=p.pointAtCenter)!==null&&be!==void 0?be:p.arrowPointAtCenter)!==null&&Je!==void 0?Je:y),m||OC({arrowPointAtCenter:lt,autoAdjustOverflow:w,arrowWidth:D?B.sizePopupArrow:0,borderRadius:B.borderRadius,offset:B.marginXXS,visibleFirst:!0})},[y,p,m,B]),ue=l.useMemo(()=>v===0?v:C||v||"",[C,v]),ne=l.createElement(Ua,{space:!0},typeof ue=="function"?ue():ue),me=P("tooltip",i),Y=P(),de=t["data-popover-inject"];let le=W;!("open"in t)&&!("visible"in t)&&_&&(le=!1);const Se=l.isValidElement(c)&&!F1(c)?c:l.createElement("span",null,c),xe=Se.props,Ce=!xe.className||typeof xe.className=="string"?Ae(xe.className,o||`${me}-open`):xe.className,[De,je,Le]=T1(me,!de),Ie=JC(me,s),pe=Ie.arrowStyle,Oe=Ae(h,{[`${me}-rtl`]:H==="rtl"},Ie.className,b,je,Le,Z,q.root,T==null?void 0:T.root),Ze=Ae(q.body,T==null?void 0:T.body),[tt,rt]=ts("Tooltip",R.zIndex),Ge=l.createElement(IM,Object.assign({},R,{zIndex:tt,showArrow:D,placement:x,mouseEnterDelay:g,mouseLeaveDelay:M,prefixCls:me,classNames:{root:Oe,body:Ze},styles:{root:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},pe),U.root),V),E),S==null?void 0:S.root),body:Object.assign(Object.assign(Object.assign(Object.assign({},U.body),A),S==null?void 0:S.body),Ie.overlayStyle)},getTooltipContainer:O||a||k,ref:z,builtinPlacements:ce,overlay:ne,visible:le,onVisibleChange:se,afterVisibleChange:u??d,arrowContent:l.createElement("span",{className:`${me}-arrow-content`}),motion:{motionName:sc(Y,"zoom-big-fast",t.transitionName),motionDeadline:1e3},destroyTooltipOnHide:!!f}),le?kr(Se,{className:Ce}):Se);return De(l.createElement(es.Provider,{value:rt},Ge))}),us=NM;process.env.NODE_ENV!=="production"&&(us.displayName="Tooltip");us._InternalPanelDoNotUseOrYouWillBeFired=MM;const _C=t=>{var e;const{className:n,children:r,icon:i,title:o,danger:a,extra:s}=t,{prefixCls:A,firstLevel:c,direction:u,disableMenuItemTitleTooltip:d,inlineCollapsed:f}=l.useContext(TA),p=I=>{const O=r==null?void 0:r[0],x=l.createElement("span",{className:Ae(`${A}-title-content`,{[`${A}-title-content-with-extra`]:!!s||s===0})},r);return(!i||l.isValidElement(r)&&r.type==="span")&&r&&I&&c&&typeof O=="string"?l.createElement("div",{className:`${A}-inline-collapsed-noicon`},O.charAt(0)):x},{siderCollapsed:v}=l.useContext(Sf);let C=o;typeof o>"u"?C=c?r:"":o===!1&&(C="");const m={title:C};!v&&!f&&(m.title=null,m.open=!1);const y=Pr(r).length;let w=l.createElement(mc,Object.assign({},tr(t,["title","icon","danger"]),{className:Ae({[`${A}-item-danger`]:a,[`${A}-item-only-child`]:(i?y+1:y)===1},n),title:typeof o=="string"?o:void 0}),kr(i,{className:Ae(l.isValidElement(i)?(e=i.props)===null||e===void 0?void 0:e.className:"",`${A}-item-icon`)}),p(f));return d||(w=l.createElement(us,Object.assign({},m,{placement:u==="rtl"?"left":"right",classNames:{root:`${A}-inline-collapsed-tooltip`}}),w)),w};var DM=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n};const NA=l.createContext(null),BM=l.forwardRef((t,e)=>{const{children:n}=t,r=DM(t,["children"]),i=l.useContext(NA),o=l.useMemo(()=>Object.assign(Object.assign({},i),r),[i,r.prefixCls,r.mode,r.selectable,r.rootClassName]),a=Ab(n),s=ji(e,a?co(n):null);return l.createElement(NA.Provider,{value:o},l.createElement(Ua,{space:!0},a?l.cloneElement(n,{ref:s}):n))}),FM=t=>{const{componentCls:e,motionDurationSlow:n,horizontalLineHeight:r,colorSplit:i,lineWidth:o,lineType:a,itemPaddingInline:s}=t;return{[`${e}-horizontal`]:{lineHeight:r,border:0,borderBottom:`${ye(o)} ${a} ${i}`,boxShadow:"none","&::after":{display:"block",clear:"both",height:0,content:'"\\20"'},[`${e}-item, ${e}-submenu`]:{position:"relative",display:"inline-block",verticalAlign:"bottom",paddingInline:s},[`> ${e}-item:hover,
612
+ }`),i)}else Ra(i);return function(){Ra(i)}},[e,i])}var K5=!1;function V5(t){return K5}var rm=function(e){return e===!1?!1:!Ln()||!e?null:typeof e=="string"?document.querySelector(e):typeof e=="function"?e():e},gc=l.forwardRef(function(t,e){var n=t.open,r=t.autoLock,i=t.getContainer,o=t.debug,a=t.autoDestroy,s=a===void 0?!0:a,A=t.children,c=l.useState(n),u=ee(c,2),d=u[0],f=u[1],p=d||n;process.env.NODE_ENV!=="production"&&yt(Ln()||!n,"Portal only work in client side. Please call 'useEffect' to show Portal instead default render in SSR."),l.useEffect(function(){(s||n)&&f(n)},[n,s]);var v=l.useState(function(){return rm(i)}),C=ee(v,2),m=C[0],y=C[1];l.useEffect(function(){var T=rm(i);y(T??null)});var w=L5(p&&!m,o),I=ee(w,2),O=I[0],x=I[1],g=m??O;Z5(r&&n&&Ln()&&(g===O||g===document.body));var M=null;if(A&&Li(A)&&e){var E=A;M=E.ref}var b=ji(M,e);if(!p||!Ln()||m===void 0)return null;var h=g===!1||V5(),S=A;return e&&(S=l.cloneElement(A,{ref:b})),l.createElement(SC.Provider,{value:x},h?S:Wr.createPortal(S,g))});process.env.NODE_ENV!=="production"&&(gc.displayName="Portal");const wC=function(){if(typeof navigator>"u"||typeof window>"u")return!1;var t=navigator.userAgent||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(t==null?void 0:t.substr(0,4))};function z5(t){var e=t.prefixCls,n=t.align,r=t.arrow,i=t.arrowPos,o=r||{},a=o.className,s=o.content,A=i.x,c=A===void 0?0:A,u=i.y,d=u===void 0?0:u,f=l.useRef();if(!n||!n.points)return null;var p={position:"absolute"};if(n.autoArrow!==!1){var v=n.points[0],C=n.points[1],m=v[0],y=v[1],w=C[0],I=C[1];m===w||!["t","b"].includes(m)?p.top=d:m==="t"?p.top=0:p.bottom=0,y===I||!["l","r"].includes(y)?p.left=c:y==="l"?p.left=0:p.right=0}return l.createElement("div",{ref:f,className:Ae("".concat(e,"-arrow"),a),style:p},s)}function Y5(t){var e=t.prefixCls,n=t.open,r=t.zIndex,i=t.mask,o=t.motion;return i?l.createElement(lo,Qe({},o,{motionAppear:!0,visible:n,removeOnLeave:!0}),function(a){var s=a.className;return l.createElement("div",{style:{zIndex:r},className:Ae("".concat(e,"-mask"),s)})}):null}var IC=l.memo(function(t){var e=t.children;return e},function(t,e){return e.cache});process.env.NODE_ENV!=="production"&&(IC.displayName="PopupContent");var xC=l.forwardRef(function(t,e){var n=t.popup,r=t.className,i=t.prefixCls,o=t.style,a=t.target,s=t.onVisibleChanged,A=t.open,c=t.keepDom,u=t.fresh,d=t.onClick,f=t.mask,p=t.arrow,v=t.arrowPos,C=t.align,m=t.motion,y=t.maskMotion,w=t.forceRender,I=t.getPopupContainer,O=t.autoDestroy,x=t.portal,g=t.zIndex,M=t.onMouseEnter,E=t.onMouseLeave,b=t.onPointerEnter,h=t.onPointerDownCapture,S=t.ready,T=t.offsetX,R=t.offsetY,D=t.offsetR,B=t.offsetB,k=t.onAlign,P=t.onPrepare,H=t.stretch,Z=t.targetWidth,V=t.targetHeight,q=typeof n=="function"?n():n,U=A||c,$=(I==null?void 0:I.length)>0,z=l.useState(!I||!$),J=ee(z,2),W=J[0],te=J[1];if(Xt(function(){!W&&$&&a&&te(!0)},[W,$,a]),!W)return null;var _="auto",se={left:"-1000vw",top:"-1000vh",right:_,bottom:_};if(S||!A){var ce,ue=C.points,ne=C.dynamicInset||((ce=C._experimental)===null||ce===void 0?void 0:ce.dynamicInset),me=ne&&ue[0][1]==="r",Y=ne&&ue[0][0]==="b";me?(se.right=D,se.left=_):(se.left=T,se.right=_),Y?(se.bottom=B,se.top=_):(se.top=R,se.bottom=_)}var de={};return H&&(H.includes("height")&&V?de.height=V:H.includes("minHeight")&&V&&(de.minHeight=V),H.includes("width")&&Z?de.width=Z:H.includes("minWidth")&&Z&&(de.minWidth=Z)),A||(de.pointerEvents="none"),l.createElement(x,{open:w||U,getContainer:I&&function(){return I(a)},autoDestroy:O},l.createElement(Y5,{prefixCls:i,open:A,zIndex:g,mask:f,motion:y}),l.createElement(hi,{onResize:k,disabled:!A},function(le){return l.createElement(lo,Qe({motionAppear:!0,motionEnter:!0,motionLeave:!0,removeOnLeave:!1,forceRender:w,leavedClassName:"".concat(i,"-hidden")},m,{onAppearPrepare:P,onEnterPrepare:P,visible:A,onVisibleChanged:function(xe){var Ce;m==null||(Ce=m.onVisibleChanged)===null||Ce===void 0||Ce.call(m,xe),s(xe)}}),function(Se,xe){var Ce=Se.className,De=Se.style,je=Ae(i,Ce,r);return l.createElement("div",{ref:Lr(le,e,xe),className:je,style:L(L(L(L({"--arrow-x":"".concat(v.x||0,"px"),"--arrow-y":"".concat(v.y||0,"px")},se),de),De),{},{boxSizing:"border-box",zIndex:g},o),onMouseEnter:M,onMouseLeave:E,onPointerEnter:b,onClick:d,onPointerDownCapture:h},p&&l.createElement(z5,{prefixCls:i,arrow:p,arrowPos:v,align:C}),l.createElement(IC,{cache:!A&&!u},q))})}))});process.env.NODE_ENV!=="production"&&(xC.displayName="Popup");var RC=l.forwardRef(function(t,e){var n=t.children,r=t.getTriggerDOMNode,i=Li(n),o=l.useCallback(function(s){Qd(e,r?r(s):s)},[r]),a=ji(o,co(n));return i?l.cloneElement(n,{ref:a}):n});process.env.NODE_ENV!=="production"&&(RC.displayName="TriggerWrapper");var im=l.createContext(null);function om(t){return t?Array.isArray(t)?t:[t]:[]}function W5(t,e,n,r){return l.useMemo(function(){var i=om(n??e),o=om(r??e),a=new Set(i),s=new Set(o);return t&&(a.has("hover")&&(a.delete("hover"),a.add("click")),s.has("hover")&&(s.delete("hover"),s.add("click"))),[a,s]},[t,e,n,r])}function J5(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0;return n?t[0]===e[0]:t[0]===e[0]&&t[1]===e[1]}function _5(t,e,n,r){for(var i=n.points,o=Object.keys(t),a=0;a<o.length;a+=1){var s,A=o[a];if(J5((s=t[A])===null||s===void 0?void 0:s.points,i,r))return"".concat(e,"-placement-").concat(A)}return""}function am(t,e,n,r){return e||(n?{motionName:"".concat(t,"-").concat(n)}:r?{motionName:r}:null)}function As(t){return t.ownerDocument.defaultView}function md(t){for(var e=[],n=t==null?void 0:t.parentElement,r=["hidden","scroll","clip","auto"];n;){var i=As(n).getComputedStyle(n),o=i.overflowX,a=i.overflowY,s=i.overflow;[o,a,s].some(function(A){return r.includes(A)})&&e.push(n),n=n.parentElement}return e}function Ha(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return Number.isNaN(t)?e:t}function ua(t){return Ha(parseFloat(t),0)}function sm(t,e){var n=L({},t);return(e||[]).forEach(function(r){if(!(r instanceof HTMLBodyElement||r instanceof HTMLHtmlElement)){var i=As(r).getComputedStyle(r),o=i.overflow,a=i.overflowClipMargin,s=i.borderTopWidth,A=i.borderBottomWidth,c=i.borderLeftWidth,u=i.borderRightWidth,d=r.getBoundingClientRect(),f=r.offsetHeight,p=r.clientHeight,v=r.offsetWidth,C=r.clientWidth,m=ua(s),y=ua(A),w=ua(c),I=ua(u),O=Ha(Math.round(d.width/v*1e3)/1e3),x=Ha(Math.round(d.height/f*1e3)/1e3),g=(v-C-w-I)*O,M=(f-p-m-y)*x,E=m*x,b=y*x,h=w*O,S=I*O,T=0,R=0;if(o==="clip"){var D=ua(a);T=D*O,R=D*x}var B=d.x+h-T,k=d.y+E-R,P=B+d.width+2*T-h-S-g,H=k+d.height+2*R-E-b-M;n.left=Math.max(n.left,B),n.top=Math.max(n.top,k),n.right=Math.min(n.right,P),n.bottom=Math.min(n.bottom,H)}}),n}function Am(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n="".concat(e),r=n.match(/^(.*)\%$/);return r?t*(parseFloat(r[1])/100):parseFloat(n)}function cm(t,e){var n=e||[],r=ee(n,2),i=r[0],o=r[1];return[Am(t.width,i),Am(t.height,o)]}function lm(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return[t[0],t[1]]}function yo(t,e){var n=e[0],r=e[1],i,o;return n==="t"?o=t.y:n==="b"?o=t.y+t.height:o=t.y+t.height/2,r==="l"?i=t.x:r==="r"?i=t.x+t.width:i=t.x+t.width/2,{x:i,y:o}}function yi(t,e){var n={t:"b",b:"t",l:"r",r:"l"};return t.map(function(r,i){return i===e?n[r]||"c":r}).join("")}function $5(t,e,n,r,i,o,a){var s=l.useState({ready:!1,offsetX:0,offsetY:0,offsetR:0,offsetB:0,arrowX:0,arrowY:0,scaleX:1,scaleY:1,align:i[r]||{}}),A=ee(s,2),c=A[0],u=A[1],d=l.useRef(0),f=l.useMemo(function(){return e?md(e):[]},[e]),p=l.useRef({}),v=function(){p.current={}};t||v();var C=rn(function(){if(e&&n&&t){let pr=function(ra,ti){var pi=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Oe,ia=U.x+ra,fs=U.y+ti,Ic=ia+Y,xc=fs+me,Rc=Math.max(ia,pi.left),We=Math.max(fs,pi.top),ht=Math.min(Ic,pi.right),tn=Math.min(xc,pi.bottom);return Math.max(0,(ht-Rc)*(tn-We))},ho=function(){ke=U.y+ot,Xe=ke+me,Ft=U.x+Te,ft=Ft+Y};var w,I,O,x,g=e,M=g.ownerDocument,E=As(g),b=E.getComputedStyle(g),h=b.position,S=g.style.left,T=g.style.top,R=g.style.right,D=g.style.bottom,B=g.style.overflow,k=L(L({},i[r]),o),P=M.createElement("div");(w=g.parentElement)===null||w===void 0||w.appendChild(P),P.style.left="".concat(g.offsetLeft,"px"),P.style.top="".concat(g.offsetTop,"px"),P.style.position=h,P.style.height="".concat(g.offsetHeight,"px"),P.style.width="".concat(g.offsetWidth,"px"),g.style.left="0",g.style.top="0",g.style.right="auto",g.style.bottom="auto",g.style.overflow="hidden";var H;if(Array.isArray(n))H={x:n[0],y:n[1],width:0,height:0};else{var Z,V,q=n.getBoundingClientRect();q.x=(Z=q.x)!==null&&Z!==void 0?Z:q.left,q.y=(V=q.y)!==null&&V!==void 0?V:q.top,H={x:q.x,y:q.y,width:q.width,height:q.height}}var U=g.getBoundingClientRect(),$=E.getComputedStyle(g),z=$.height,J=$.width;U.x=(I=U.x)!==null&&I!==void 0?I:U.left,U.y=(O=U.y)!==null&&O!==void 0?O:U.top;var W=M.documentElement,te=W.clientWidth,_=W.clientHeight,se=W.scrollWidth,ce=W.scrollHeight,ue=W.scrollTop,ne=W.scrollLeft,me=U.height,Y=U.width,de=H.height,le=H.width,Se={left:0,top:0,right:te,bottom:_},xe={left:-ne,top:-ue,right:se-ne,bottom:ce-ue},Ce=k.htmlRegion,De="visible",je="visibleFirst";Ce!=="scroll"&&Ce!==je&&(Ce=De);var Le=Ce===je,Ie=sm(xe,f),pe=sm(Se,f),Oe=Ce===De?pe:Ie,Ze=Le?pe:Oe;g.style.left="auto",g.style.top="auto",g.style.right="0",g.style.bottom="0";var tt=g.getBoundingClientRect();g.style.left=S,g.style.top=T,g.style.right=R,g.style.bottom=D,g.style.overflow=B,(x=g.parentElement)===null||x===void 0||x.removeChild(P);var rt=Ha(Math.round(Y/parseFloat(J)*1e3)/1e3),Ge=Ha(Math.round(me/parseFloat(z)*1e3)/1e3);if(rt===0||Ge===0||ka(n)&&!Af(n))return;var be=k.offset,Je=k.targetOffset,lt=cm(U,be),$e=ee(lt,2),Be=$e[0],Me=$e[1],st=cm(H,Je),At=ee(st,2),Ct=At[0],Nt=At[1];H.x-=Ct,H.y-=Nt;var Jt=k.points||[],Wt=ee(Jt,2),en=Wt[0],_t=Wt[1],Zt=lm(_t),Rt=lm(en),pt=yo(H,Zt),Ve=yo(U,Rt),_e=L({},k),Te=pt.x-Ve.x+Be,ot=pt.y-Ve.y+Me,mt=pr(Te,ot),Fe=pr(Te,ot,pe),we=yo(H,["t","l"]),Ke=yo(U,["t","l"]),ze=yo(H,["b","r"]),Ue=yo(U,["b","r"]),F=k.overflow||{},ge=F.adjustX,j=F.adjustY,re=F.shiftX,X=F.shiftY,ve=function(ti){return typeof ti=="boolean"?ti:ti>=0},ke,Xe,Ft,ft;ho();var St=ve(j),Ee=Rt[0]===Zt[0];if(St&&Rt[0]==="t"&&(Xe>Ze.bottom||p.current.bt)){var Ne=ot;Ee?Ne-=me-de:Ne=we.y-Ue.y-Me;var ct=pr(Te,Ne),ut=pr(Te,Ne,pe);ct>mt||ct===mt&&(!Le||ut>=Fe)?(p.current.bt=!0,ot=Ne,Me=-Me,_e.points=[yi(Rt,0),yi(Zt,0)]):p.current.bt=!1}if(St&&Rt[0]==="b"&&(ke<Ze.top||p.current.tb)){var kt=ot;Ee?kt+=me-de:kt=ze.y-Ke.y-Me;var Pn=pr(Te,kt),ln=pr(Te,kt,pe);Pn>mt||Pn===mt&&(!Le||ln>=Fe)?(p.current.tb=!0,ot=kt,Me=-Me,_e.points=[yi(Rt,0),yi(Zt,0)]):p.current.tb=!1}var Yn=ve(ge),Hr=Rt[1]===Zt[1];if(Yn&&Rt[1]==="l"&&(ft>Ze.right||p.current.rl)){var Hn=Te;Hr?Hn-=Y-le:Hn=we.x-Ue.x-Be;var Gn=pr(Hn,ot),xr=pr(Hn,ot,pe);Gn>mt||Gn===mt&&(!Le||xr>=Fe)?(p.current.rl=!0,Te=Hn,Be=-Be,_e.points=[yi(Rt,1),yi(Zt,1)]):p.current.rl=!1}if(Yn&&Rt[1]==="r"&&(Ft<Ze.left||p.current.lr)){var qn=Te;Hr?qn+=Y-le:qn=ze.x-Ke.x-Be;var Xr=pr(qn,ot),Rr=pr(qn,ot,pe);Xr>mt||Xr===mt&&(!Le||Rr>=Fe)?(p.current.lr=!0,Te=qn,Be=-Be,_e.points=[yi(Rt,1),yi(Zt,1)]):p.current.lr=!1}ho();var Zn=re===!0?0:re;typeof Zn=="number"&&(Ft<pe.left&&(Te-=Ft-pe.left-Be,H.x+le<pe.left+Zn&&(Te+=H.x-pe.left+le-Zn)),ft>pe.right&&(Te-=ft-pe.right-Be,H.x>pe.right-Zn&&(Te+=H.x-pe.right+Zn)));var nr=X===!0?0:X;typeof nr=="number"&&(ke<pe.top&&(ot-=ke-pe.top-Me,H.y+de<pe.top+nr&&(ot+=H.y-pe.top+de-nr)),Xe>pe.bottom&&(ot-=Xe-pe.bottom-Me,H.y>pe.bottom-nr&&(ot+=H.y-pe.bottom+nr)));var gr=U.x+Te,hr=gr+Y,Gr=U.y+ot,ei=Gr+me,wt=H.x,qe=wt+le,gt=H.y,bt=gt+de,Tt=Math.max(gr,wt),Bt=Math.min(hr,qe),wn=(Tt+Bt)/2,In=wn-gr,Wn=Math.max(Gr,gt),rr=Math.min(ei,bt),Jn=(Wn+rr)/2,_n=Jn-Gr;a==null||a(e,_e);var vn=tt.right-U.x-(Te+U.width),Hi=tt.bottom-U.y-(ot+U.height);rt===1&&(Te=Math.round(Te),vn=Math.round(vn)),Ge===1&&(ot=Math.round(ot),Hi=Math.round(Hi));var wc={ready:!0,offsetX:Te/rt,offsetY:ot/Ge,offsetR:vn/rt,offsetB:Hi/Ge,arrowX:In/rt,arrowY:_n/Ge,scaleX:rt,scaleY:Ge,align:_e};u(wc)}}),m=function(){d.current+=1;var I=d.current;Promise.resolve().then(function(){d.current===I&&C()})},y=function(){u(function(I){return L(L({},I),{},{ready:!1})})};return Xt(y,[r]),Xt(function(){t||y()},[t]),[c.ready,c.offsetX,c.offsetY,c.offsetR,c.offsetB,c.arrowX,c.arrowY,c.scaleX,c.scaleY,c.align,m]}function X5(t,e,n,r,i){Xt(function(){if(t&&e&&n){let d=function(){r(),i()};var o=e,a=n,s=md(o),A=md(a),c=As(a),u=new Set([c].concat(Re(s),Re(A)));return u.forEach(function(f){f.addEventListener("scroll",d,{passive:!0})}),c.addEventListener("resize",d,{passive:!0}),r(),function(){u.forEach(function(f){f.removeEventListener("scroll",d),c.removeEventListener("resize",d)})}}},[t,e,n])}function eO(t,e,n,r,i,o,a,s){var A=l.useRef(t);A.current=t;var c=l.useRef(!1);l.useEffect(function(){if(e&&r&&(!i||o)){var d=function(){c.current=!1},f=function(O){var x;A.current&&!a(((x=O.composedPath)===null||x===void 0||(x=x.call(O))===null||x===void 0?void 0:x[0])||O.target)&&!c.current&&s(!1)},p=As(r);p.addEventListener("pointerdown",d,!0),p.addEventListener("mousedown",f,!0),p.addEventListener("contextmenu",f,!0);var v=SA(n);if(v&&(v.addEventListener("mousedown",f,!0),v.addEventListener("contextmenu",f,!0)),process.env.NODE_ENV!=="production"){var C,m,y=n==null||(C=n.getRootNode)===null||C===void 0?void 0:C.call(n),w=(m=r.getRootNode)===null||m===void 0?void 0:m.call(r);Di(y===w,"trigger element and popup element should in same shadow root.")}return function(){p.removeEventListener("pointerdown",d,!0),p.removeEventListener("mousedown",f,!0),p.removeEventListener("contextmenu",f,!0),v&&(v.removeEventListener("mousedown",f,!0),v.removeEventListener("contextmenu",f,!0))}}},[e,n,r,i,o]);function u(){c.current=!0}return u}var tO=["prefixCls","children","action","showAction","hideAction","popupVisible","defaultPopupVisible","onPopupVisibleChange","afterPopupVisibleChange","mouseEnterDelay","mouseLeaveDelay","focusDelay","blurDelay","mask","maskClosable","getPopupContainer","forceRender","autoDestroy","destroyPopupOnHide","popup","popupClassName","popupStyle","popupPlacement","builtinPlacements","popupAlign","zIndex","stretch","getPopupClassNameFromAlign","fresh","alignPoint","onPopupClick","onPopupAlign","arrow","popupMotion","maskMotion","popupTransitionName","popupAnimation","maskTransitionName","maskAnimation","className","getTriggerDOMNode"];function nO(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:gc,e=l.forwardRef(function(n,r){var i=n.prefixCls,o=i===void 0?"rc-trigger-popup":i,a=n.children,s=n.action,A=s===void 0?"hover":s,c=n.showAction,u=n.hideAction,d=n.popupVisible,f=n.defaultPopupVisible,p=n.onPopupVisibleChange,v=n.afterPopupVisibleChange,C=n.mouseEnterDelay,m=n.mouseLeaveDelay,y=m===void 0?.1:m,w=n.focusDelay,I=n.blurDelay,O=n.mask,x=n.maskClosable,g=x===void 0?!0:x,M=n.getPopupContainer,E=n.forceRender,b=n.autoDestroy,h=n.destroyPopupOnHide,S=n.popup,T=n.popupClassName,R=n.popupStyle,D=n.popupPlacement,B=n.builtinPlacements,k=B===void 0?{}:B,P=n.popupAlign,H=n.zIndex,Z=n.stretch,V=n.getPopupClassNameFromAlign,q=n.fresh,U=n.alignPoint,$=n.onPopupClick,z=n.onPopupAlign,J=n.arrow,W=n.popupMotion,te=n.maskMotion,_=n.popupTransitionName,se=n.popupAnimation,ce=n.maskTransitionName,ue=n.maskAnimation,ne=n.className,me=n.getTriggerDOMNode,Y=Et(n,tO),de=b||h||!1,le=l.useState(!1),Se=ee(le,2),xe=Se[0],Ce=Se[1];Xt(function(){Ce(wC())},[]);var De=l.useRef({}),je=l.useContext(im),Le=l.useMemo(function(){return{registerSubPopup:function(ht,tn){De.current[ht]=tn,je==null||je.registerSubPopup(ht,tn)}}},[je]),Ie=rc(),pe=l.useState(null),Oe=ee(pe,2),Ze=Oe[0],tt=Oe[1],rt=l.useRef(null),Ge=rn(function(We){rt.current=We,ka(We)&&Ze!==We&&tt(We),je==null||je.registerSubPopup(Ie,We)}),be=l.useState(null),Je=ee(be,2),lt=Je[0],$e=Je[1],Be=l.useRef(null),Me=rn(function(We){ka(We)&&lt!==We&&($e(We),Be.current=We)}),st=l.Children.only(a),At=(st==null?void 0:st.props)||{},Ct={},Nt=rn(function(We){var ht,tn,Cn=lt;return(Cn==null?void 0:Cn.contains(We))||((ht=SA(Cn))===null||ht===void 0?void 0:ht.host)===We||We===Cn||(Ze==null?void 0:Ze.contains(We))||((tn=SA(Ze))===null||tn===void 0?void 0:tn.host)===We||We===Ze||Object.values(De.current).some(function(an){return(an==null?void 0:an.contains(We))||We===an})}),Jt=am(o,W,se,_),Wt=am(o,te,ue,ce),en=l.useState(f||!1),_t=ee(en,2),Zt=_t[0],Rt=_t[1],pt=d??Zt,Ve=rn(function(We){d===void 0&&Rt(We)});Xt(function(){Rt(d||!1)},[d]);var _e=l.useRef(pt);_e.current=pt;var Te=l.useRef([]);Te.current=[];var ot=rn(function(We){var ht;Ve(We),((ht=Te.current[Te.current.length-1])!==null&&ht!==void 0?ht:pt)!==We&&(Te.current.push(We),p==null||p(We))}),mt=l.useRef(),Fe=function(){clearTimeout(mt.current)},we=function(ht){var tn=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;Fe(),tn===0?ot(ht):mt.current=setTimeout(function(){ot(ht)},tn*1e3)};l.useEffect(function(){return Fe},[]);var Ke=l.useState(!1),ze=ee(Ke,2),Ue=ze[0],F=ze[1];Xt(function(We){(!We||pt)&&F(!0)},[pt]);var ge=l.useState(null),j=ee(ge,2),re=j[0],X=j[1],ve=l.useState(null),ke=ee(ve,2),Xe=ke[0],Ft=ke[1],ft=function(ht){Ft([ht.clientX,ht.clientY])},St=$5(pt,Ze,U&&Xe!==null?Xe:lt,D,k,P,z),Ee=ee(St,11),Ne=Ee[0],ct=Ee[1],ut=Ee[2],kt=Ee[3],Pn=Ee[4],ln=Ee[5],Yn=Ee[6],Hr=Ee[7],Hn=Ee[8],Gn=Ee[9],xr=Ee[10],qn=W5(xe,A,c,u),Xr=ee(qn,2),Rr=Xr[0],Zn=Xr[1],nr=Rr.has("click"),gr=Zn.has("click")||Zn.has("contextMenu"),hr=rn(function(){Ue||xr()}),Gr=function(){_e.current&&U&&gr&&we(!1)};X5(pt,lt,Ze,hr,Gr),Xt(function(){hr()},[Xe,D]),Xt(function(){pt&&!(k!=null&&k[D])&&hr()},[JSON.stringify(P)]);var ei=l.useMemo(function(){var We=_5(k,o,Gn,U);return Ae(We,V==null?void 0:V(Gn))},[Gn,V,k,o,U]);l.useImperativeHandle(r,function(){return{nativeElement:Be.current,popupElement:rt.current,forceAlign:hr}});var wt=l.useState(0),qe=ee(wt,2),gt=qe[0],bt=qe[1],Tt=l.useState(0),Bt=ee(Tt,2),wn=Bt[0],In=Bt[1],Wn=function(){if(Z&&lt){var ht=lt.getBoundingClientRect();bt(ht.width),In(ht.height)}},rr=function(){Wn(),hr()},Jn=function(ht){F(!1),xr(),v==null||v(ht)},_n=function(){return new Promise(function(ht){Wn(),X(function(){return ht})})};Xt(function(){re&&(xr(),re(),X(null))},[re]);function vn(We,ht,tn,Cn){Ct[We]=function(an){var gs;Cn==null||Cn(an),we(ht,tn);for(var Oc=arguments.length,Qf=new Array(Oc>1?Oc-1:0),hs=1;hs<Oc;hs++)Qf[hs-1]=arguments[hs];(gs=At[We])===null||gs===void 0||gs.call.apply(gs,[At,an].concat(Qf))}}(nr||gr)&&(Ct.onClick=function(We){var ht;_e.current&&gr?we(!1):!_e.current&&nr&&(ft(We),we(!0));for(var tn=arguments.length,Cn=new Array(tn>1?tn-1:0),an=1;an<tn;an++)Cn[an-1]=arguments[an];(ht=At.onClick)===null||ht===void 0||ht.call.apply(ht,[At,We].concat(Cn))});var Hi=eO(pt,gr,lt,Ze,O,g,Nt,we),wc=Rr.has("hover"),pr=Zn.has("hover"),ho,ra;wc&&(vn("onMouseEnter",!0,C,function(We){ft(We)}),vn("onPointerEnter",!0,C,function(We){ft(We)}),ho=function(ht){(pt||Ue)&&Ze!==null&&Ze!==void 0&&Ze.contains(ht.target)&&we(!0,C)},U&&(Ct.onMouseMove=function(We){var ht;(ht=At.onMouseMove)===null||ht===void 0||ht.call(At,We)})),pr&&(vn("onMouseLeave",!1,y),vn("onPointerLeave",!1,y),ra=function(){we(!1,y)}),Rr.has("focus")&&vn("onFocus",!0,w),Zn.has("focus")&&vn("onBlur",!1,I),Rr.has("contextMenu")&&(Ct.onContextMenu=function(We){var ht;_e.current&&Zn.has("contextMenu")?we(!1):(ft(We),we(!0)),We.preventDefault();for(var tn=arguments.length,Cn=new Array(tn>1?tn-1:0),an=1;an<tn;an++)Cn[an-1]=arguments[an];(ht=At.onContextMenu)===null||ht===void 0||ht.call.apply(ht,[At,We].concat(Cn))}),ne&&(Ct.className=Ae(At.className,ne));var ti=l.useRef(!1);ti.current||(ti.current=E||pt||Ue);var pi=L(L({},At),Ct),ia={},fs=["onContextMenu","onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur"];fs.forEach(function(We){Y[We]&&(ia[We]=function(){for(var ht,tn=arguments.length,Cn=new Array(tn),an=0;an<tn;an++)Cn[an]=arguments[an];(ht=pi[We])===null||ht===void 0||ht.call.apply(ht,[pi].concat(Cn)),Y[We].apply(Y,Cn)})});var Ic=l.cloneElement(st,L(L({},pi),ia)),xc={x:ln,y:Yn},Rc=J?L({},J!==!0?J:{}):null;return l.createElement(l.Fragment,null,l.createElement(hi,{disabled:!pt,ref:Me,onResize:rr},l.createElement(RC,{getTriggerDOMNode:me},Ic)),ti.current&&l.createElement(im.Provider,{value:Le},l.createElement(xC,{portal:t,ref:Ge,prefixCls:o,popup:S,className:Ae(T,ei),style:R,target:lt,onMouseEnter:ho,onMouseLeave:ra,onPointerEnter:ho,zIndex:H,open:pt,keepDom:Ue,fresh:q,onClick:$,onPointerDownCapture:Hi,mask:O,motion:Jt,maskMotion:Wt,onVisibleChanged:Jn,onPrepare:_n,forceRender:E,autoDestroy:de,getPopupContainer:M,align:Gn,arrow:Rc,arrowPos:xc,ready:Ne,offsetX:ct,offsetY:ut,offsetR:kt,offsetB:Pn,onAlign:hr,stretch:Z,targetWidth:gt/Hr,targetHeight:wn/Hn})))});return process.env.NODE_ENV!=="production"&&(e.displayName="Trigger"),e}const hc=nO(gc);var rO=at.ESC,iO=at.TAB;function oO(t){var e=t.visible,n=t.triggerRef,r=t.onVisibleChange,i=t.autoFocus,o=t.overlayRef,a=l.useRef(!1),s=function(){if(e){var d,f;(d=n.current)===null||d===void 0||(f=d.focus)===null||f===void 0||f.call(d),r==null||r(!1)}},A=function(){var d;return(d=o.current)!==null&&d!==void 0&&d.focus?(o.current.focus(),a.current=!0,!0):!1},c=function(d){switch(d.keyCode){case rO:s();break;case iO:{var f=!1;a.current||(f=A()),f?d.preventDefault():s();break}}};l.useEffect(function(){return e?(window.addEventListener("keydown",c),i&&qt(A,3),function(){window.removeEventListener("keydown",c),a.current=!1}):function(){a.current=!1}},[e])}var aO=N.forwardRef(function(t,e){var n=t.overlay,r=t.arrow,i=t.prefixCls,o=N.useMemo(function(){var s;return typeof n=="function"?s=n():s=n,s},[n]),a=Lr(e,co(o));return N.createElement(N.Fragment,null,r&&N.createElement("div",{className:"".concat(i,"-arrow")}),N.cloneElement(o,{ref:Li(o)?a:void 0}))}),Eo={adjustX:1,adjustY:1},bo=[0,0],sO={topLeft:{points:["bl","tl"],overflow:Eo,offset:[0,-4],targetOffset:bo},top:{points:["bc","tc"],overflow:Eo,offset:[0,-4],targetOffset:bo},topRight:{points:["br","tr"],overflow:Eo,offset:[0,-4],targetOffset:bo},bottomLeft:{points:["tl","bl"],overflow:Eo,offset:[0,4],targetOffset:bo},bottom:{points:["tc","bc"],overflow:Eo,offset:[0,4],targetOffset:bo},bottomRight:{points:["tr","br"],overflow:Eo,offset:[0,4],targetOffset:bo}},AO=["arrow","prefixCls","transitionName","animation","align","placement","placements","getPopupContainer","showAction","hideAction","overlayClassName","overlayStyle","visible","trigger","autoFocus","overlay","children","onVisibleChange"];function cO(t,e){var n,r=t.arrow,i=r===void 0?!1:r,o=t.prefixCls,a=o===void 0?"rc-dropdown":o,s=t.transitionName,A=t.animation,c=t.align,u=t.placement,d=u===void 0?"bottomLeft":u,f=t.placements,p=f===void 0?sO:f,v=t.getPopupContainer,C=t.showAction,m=t.hideAction,y=t.overlayClassName,w=t.overlayStyle,I=t.visible,O=t.trigger,x=O===void 0?["hover"]:O,g=t.autoFocus,M=t.overlay,E=t.children,b=t.onVisibleChange,h=Et(t,AO),S=N.useState(),T=ee(S,2),R=T[0],D=T[1],B="visible"in t?I:R,k=N.useRef(null),P=N.useRef(null),H=N.useRef(null);N.useImperativeHandle(e,function(){return k.current});var Z=function(_){D(_),b==null||b(_)};oO({visible:B,triggerRef:H,onVisibleChange:Z,autoFocus:g,overlayRef:P});var V=function(_){var se=t.onOverlayClick;D(!1),se&&se(_)},q=function(){return N.createElement(aO,{ref:P,overlay:M,prefixCls:a,arrow:i})},U=function(){return typeof M=="function"?q:q()},$=function(){var _=t.minOverlayWidthMatchTrigger,se=t.alignPoint;return"minOverlayWidthMatchTrigger"in t?_:!se},z=function(){var _=t.openClassName;return _!==void 0?_:"".concat(a,"-open")},J=N.cloneElement(E,{className:Ae((n=E.props)===null||n===void 0?void 0:n.className,B&&z()),ref:Li(E)?Lr(H,co(E)):void 0}),W=m;return!W&&x.indexOf("contextMenu")!==-1&&(W=["click"]),N.createElement(hc,Qe({builtinPlacements:p},h,{prefixCls:a,ref:k,popupClassName:Ae(y,Q({},"".concat(a,"-show-arrow"),i)),popupStyle:w,action:x,showAction:C,hideAction:W,popupPlacement:d,popupAlign:c,popupTransitionName:s,popupAnimation:A,popupVisible:B,stretch:$()?"minWidth":"",popup:U(),onPopupVisibleChange:Z,onPopupClick:V,getPopupContainer:v}),J)}const lO=N.forwardRef(cO),uO=t=>typeof t!="object"&&typeof t!="function"||t===null;function dO(t,e,n,r){if(r===!1)return{adjustX:!1,adjustY:!1};const i=r&&typeof r=="object"?r:{},o={};switch(t){case"top":case"bottom":o.shiftX=e.arrowOffsetHorizontal*2+n,o.shiftY=!0,o.adjustY=!0;break;case"left":case"right":o.shiftY=e.arrowOffsetVertical*2+n,o.shiftX=!0,o.adjustX=!0;break}const a=Object.assign(Object.assign({},o),i);return a.shiftX||(a.adjustX=!0),a.shiftY||(a.adjustY=!0),a}const um={left:{points:["cr","cl"]},right:{points:["cl","cr"]},top:{points:["bc","tc"]},bottom:{points:["tc","bc"]},topLeft:{points:["bl","tl"]},leftTop:{points:["tr","tl"]},topRight:{points:["br","tr"]},rightTop:{points:["tl","tr"]},bottomRight:{points:["tr","br"]},rightBottom:{points:["bl","br"]},bottomLeft:{points:["tl","bl"]},leftBottom:{points:["br","bl"]}},fO={topLeft:{points:["bl","tc"]},leftTop:{points:["tr","cl"]},topRight:{points:["br","tc"]},rightTop:{points:["tl","cr"]},bottomRight:{points:["tr","bc"]},rightBottom:{points:["bl","cr"]},bottomLeft:{points:["tl","bc"]},leftBottom:{points:["br","cl"]}},gO=new Set(["topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]);function OC(t){const{arrowWidth:e,autoAdjustOverflow:n,arrowPointAtCenter:r,offset:i,borderRadius:o,visibleFirst:a}=t,s=e/2,A={};return Object.keys(um).forEach(c=>{const u=r&&fO[c]||um[c],d=Object.assign(Object.assign({},u),{offset:[0,0],dynamicInset:!0});switch(A[c]=d,gO.has(c)&&(d.autoArrow=!1),c){case"top":case"topLeft":case"topRight":d.offset[1]=-s-i;break;case"bottom":case"bottomLeft":case"bottomRight":d.offset[1]=s+i;break;case"left":case"leftTop":case"leftBottom":d.offset[0]=-s-i;break;case"right":case"rightTop":case"rightBottom":d.offset[0]=s+i;break}const f=ec({contentRadius:o,limitVerticalRadius:!0});if(r)switch(c){case"topLeft":case"bottomLeft":d.offset[0]=-f.arrowOffsetHorizontal-s;break;case"topRight":case"bottomRight":d.offset[0]=f.arrowOffsetHorizontal+s;break;case"leftTop":case"rightTop":d.offset[1]=-f.arrowOffsetHorizontal*2+s;break;case"leftBottom":case"rightBottom":d.offset[1]=f.arrowOffsetHorizontal*2-s;break}d.overflow=dO(c,f,e,n),a&&(d.htmlRegion="visibleFirst")}),A}function MC(t){return e=>l.createElement(_r,{theme:{token:{motion:!1,zIndexPopupBase:0}}},l.createElement(t,Object.assign({},e)))}const TC=(t,e,n,r,i)=>MC(a=>{const{prefixCls:s,style:A}=a,c=l.useRef(null),[u,d]=l.useState(0),[f,p]=l.useState(0),[v,C]=Fn(!1,{value:a.open}),{getPrefixCls:m}=l.useContext(Qt),y=m(r||"select",s);l.useEffect(()=>{if(C(!0),typeof ResizeObserver<"u"){const O=new ResizeObserver(g=>{const M=g[0].target;d(M.offsetHeight+8),p(M.offsetWidth)}),x=setInterval(()=>{var g;const M=i?`.${i(y)}`:`.${y}-dropdown`,E=(g=c.current)===null||g===void 0?void 0:g.querySelector(M);E&&(clearInterval(x),O.observe(E))},10);return()=>{clearInterval(x),O.disconnect()}}},[]);let w=Object.assign(Object.assign({},a),{style:Object.assign(Object.assign({},A),{margin:0}),open:v,visible:v,getPopupContainer:()=>c.current});e&&Object.assign(w,{[e]:{overflow:{adjustX:!1,adjustY:!1}}});const I={paddingBottom:u,position:"relative",minWidth:f};return l.createElement("div",{ref:c,style:I},l.createElement(t,Object.assign({},w)))});var hO=["prefixCls","invalidate","item","renderItem","responsive","responsiveDisabled","registerSize","itemKey","className","style","children","display","order","component"],So=void 0;function pO(t,e){var n=t.prefixCls,r=t.invalidate,i=t.item,o=t.renderItem,a=t.responsive,s=t.responsiveDisabled,A=t.registerSize,c=t.itemKey,u=t.className,d=t.style,f=t.children,p=t.display,v=t.order,C=t.component,m=C===void 0?"div":C,y=Et(t,hO),w=a&&!p;function I(E){A(c,E)}l.useEffect(function(){return function(){I(null)}},[]);var O=o&&i!==So?o(i,{index:v}):f,x;r||(x={opacity:w?0:1,height:w?0:So,overflowY:w?"hidden":So,order:a?v:So,pointerEvents:w?"none":So,position:w?"absolute":So});var g={};w&&(g["aria-hidden"]=!0);var M=l.createElement(m,Qe({className:Ae(!r&&n,u),style:L(L({},x),d)},g,y,{ref:e}),O);return a&&(M=l.createElement(hi,{onResize:function(b){var h=b.offsetWidth;I(h)},disabled:s},M)),M}var Ia=l.forwardRef(pO);Ia.displayName="Item";function mO(t){if(typeof MessageChannel>"u")qt(t);else{var e=new MessageChannel;e.port1.onmessage=function(){return t()},e.port2.postMessage(void 0)}}function vO(){var t=l.useRef(null),e=function(r){t.current||(t.current=[],mO(function(){Wr.unstable_batchedUpdates(function(){t.current.forEach(function(i){i()}),t.current=null})})),t.current.push(r)};return e}function da(t,e){var n=l.useState(e),r=ee(n,2),i=r[0],o=r[1],a=rn(function(s){t(function(){o(s)})});return[i,a]}var OA=N.createContext(null),CO=["component"],yO=["className"],EO=["className"],bO=function(e,n){var r=l.useContext(OA);if(!r){var i=e.component,o=i===void 0?"div":i,a=Et(e,CO);return l.createElement(o,Qe({},a,{ref:n}))}var s=r.className,A=Et(r,yO),c=e.className,u=Et(e,EO);return l.createElement(OA.Provider,{value:null},l.createElement(Ia,Qe({ref:n,className:Ae(s,c)},A,u)))},NC=l.forwardRef(bO);NC.displayName="RawItem";var SO=["prefixCls","data","renderItem","renderRawItem","itemKey","itemWidth","ssr","style","className","maxCount","renderRest","renderRawRest","suffix","component","itemComponent","onVisibleChange"],DC="responsive",BC="invalidate";function wO(t){return"+ ".concat(t.length," ...")}function IO(t,e){var n=t.prefixCls,r=n===void 0?"rc-overflow":n,i=t.data,o=i===void 0?[]:i,a=t.renderItem,s=t.renderRawItem,A=t.itemKey,c=t.itemWidth,u=c===void 0?10:c,d=t.ssr,f=t.style,p=t.className,v=t.maxCount,C=t.renderRest,m=t.renderRawRest,y=t.suffix,w=t.component,I=w===void 0?"div":w,O=t.itemComponent,x=t.onVisibleChange,g=Et(t,SO),M=d==="full",E=vO(),b=da(E,null),h=ee(b,2),S=h[0],T=h[1],R=S||0,D=da(E,new Map),B=ee(D,2),k=B[0],P=B[1],H=da(E,0),Z=ee(H,2),V=Z[0],q=Z[1],U=da(E,0),$=ee(U,2),z=$[0],J=$[1],W=da(E,0),te=ee(W,2),_=te[0],se=te[1],ce=N.useState(null),ue=ee(ce,2),ne=ue[0],me=ue[1],Y=N.useState(null),de=ee(Y,2),le=de[0],Se=de[1],xe=l.useMemo(function(){return le===null&&M?Number.MAX_SAFE_INTEGER:le||0},[le,S]),Ce=N.useState(!1),De=ee(Ce,2),je=De[0],Le=De[1],Ie="".concat(r,"-item"),pe=Math.max(V,z),Oe=v===DC,Ze=o.length&&Oe,tt=v===BC,rt=Ze||typeof v=="number"&&o.length>v,Ge=N.useMemo(function(){var Ve=o;return Ze?S===null&&M?Ve=o:Ve=o.slice(0,Math.min(o.length,R/u)):typeof v=="number"&&(Ve=o.slice(0,v)),Ve},[o,u,S,v,Ze]),be=N.useMemo(function(){return Ze?o.slice(xe+1):o.slice(Ge.length)},[o,Ge,Ze,xe]),Je=N.useCallback(function(Ve,_e){var Te;return typeof A=="function"?A(Ve):(Te=A&&(Ve==null?void 0:Ve[A]))!==null&&Te!==void 0?Te:_e},[A]),lt=N.useCallback(a||function(Ve){return Ve},[a]);function $e(Ve,_e,Te){le===Ve&&(_e===void 0||_e===ne)||(Se(Ve),Te||(Le(Ve<o.length-1),x==null||x(Ve)),_e!==void 0&&me(_e))}function Be(Ve,_e){T(_e.clientWidth)}function Me(Ve,_e){P(function(Te){var ot=new Map(Te);return _e===null?ot.delete(Ve):ot.set(Ve,_e),ot})}function st(Ve,_e){J(_e),q(z)}function At(Ve,_e){se(_e)}function Ct(Ve){return k.get(Je(Ge[Ve],Ve))}Xt(function(){if(R&&typeof pe=="number"&&Ge){var Ve=_,_e=Ge.length,Te=_e-1;if(!_e){$e(0,null);return}for(var ot=0;ot<_e;ot+=1){var mt=Ct(ot);if(M&&(mt=mt||0),mt===void 0){$e(ot-1,void 0,!0);break}if(Ve+=mt,Te===0&&Ve<=R||ot===Te-1&&Ve+Ct(Te)<=R){$e(Te,null);break}else if(Ve+pe>R){$e(ot-1,Ve-mt-_+z);break}}y&&Ct(0)+_>R&&me(null)}},[R,k,z,_,Je,Ge]);var Nt=je&&!!be.length,Jt={};ne!==null&&Ze&&(Jt={position:"absolute",left:ne,top:0});var Wt={prefixCls:Ie,responsive:Ze,component:O,invalidate:tt},en=s?function(Ve,_e){var Te=Je(Ve,_e);return l.createElement(OA.Provider,{key:Te,value:L(L({},Wt),{},{order:_e,item:Ve,itemKey:Te,registerSize:Me,display:_e<=xe})},s(Ve,_e))}:function(Ve,_e){var Te=Je(Ve,_e);return l.createElement(Ia,Qe({},Wt,{order:_e,key:Te,item:Ve,renderItem:lt,itemKey:Te,registerSize:Me,display:_e<=xe}))},_t={order:Nt?xe:Number.MAX_SAFE_INTEGER,className:"".concat(Ie,"-rest"),registerSize:st,display:Nt},Zt=C||wO,Rt=m?l.createElement(OA.Provider,{value:L(L({},Wt),_t)},m(be)):l.createElement(Ia,Qe({},Wt,_t),typeof Zt=="function"?Zt(be):Zt),pt=l.createElement(I,Qe({className:Ae(!tt&&r,p),style:f,ref:e},g),Ge.map(en),rt?Rt:null,y&&l.createElement(Ia,Qe({},Wt,{responsive:Oe,responsiveDisabled:!Ze,order:xe,className:"".concat(Ie,"-suffix"),registerSize:At,display:!0,style:Jt}),y));return Oe?l.createElement(hi,{onResize:Be,disabled:!Ze},pt):pt}var Yr=l.forwardRef(IO);Yr.displayName="Overflow";Yr.Item=NC;Yr.RESPONSIVE=DC;Yr.INVALIDATE=BC;var FC=l.createContext(null);function kC(t,e){return t===void 0?null:"".concat(t,"-").concat(e)}function PC(t){var e=l.useContext(FC);return kC(e,t)}var xO=["children","locked"],jr=l.createContext(null);function RO(t,e){var n=L({},t);return Object.keys(e).forEach(function(r){var i=e[r];i!==void 0&&(n[r]=i)}),n}function Ga(t){var e=t.children,n=t.locked,r=Et(t,xO),i=l.useContext(jr),o=Ja(function(){return RO(i,r)},[i,r],function(a,s){return!n&&(a[0]!==s[0]||!Oa(a[1],s[1],!0))});return l.createElement(jr.Provider,{value:o},e)}var OO=[],QC=l.createContext(null);function pc(){return l.useContext(QC)}var jC=l.createContext(OO);function ta(t){var e=l.useContext(jC);return l.useMemo(function(){return t!==void 0?[].concat(Re(e),[t]):e},[e,t])}var LC=l.createContext(null),mf=l.createContext({});function dm(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(Af(t)){var n=t.nodeName.toLowerCase(),r=["input","select","textarea","button"].includes(n)||t.isContentEditable||n==="a"&&!!t.getAttribute("href"),i=t.getAttribute("tabindex"),o=Number(i),a=null;return i&&!Number.isNaN(o)?a=o:r&&a===null&&(a=0),r&&t.disabled&&(a=null),a!==null&&(a>=0||e&&a<0)}return!1}function MO(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=Re(t.querySelectorAll("*")).filter(function(r){return dm(r,e)});return dm(t,e)&&n.unshift(t),n}var vd=at.LEFT,Cd=at.RIGHT,yd=at.UP,nA=at.DOWN,rA=at.ENTER,UC=at.ESC,fa=at.HOME,ga=at.END,fm=[yd,nA,vd,Cd];function TO(t,e,n,r){var i,o="prev",a="next",s="children",A="parent";if(t==="inline"&&r===rA)return{inlineTrigger:!0};var c=Q(Q({},yd,o),nA,a),u=Q(Q(Q(Q({},vd,n?a:o),Cd,n?o:a),nA,s),rA,s),d=Q(Q(Q(Q(Q(Q({},yd,o),nA,a),rA,s),UC,A),vd,n?s:A),Cd,n?A:s),f={inline:c,horizontal:u,vertical:d,inlineSub:c,horizontalSub:d,verticalSub:d},p=(i=f["".concat(t).concat(e?"":"Sub")])===null||i===void 0?void 0:i[r];switch(p){case o:return{offset:-1,sibling:!0};case a:return{offset:1,sibling:!0};case A:return{offset:-1,sibling:!1};case s:return{offset:1,sibling:!1};default:return null}}function NO(t){for(var e=t;e;){if(e.getAttribute("data-menu-list"))return e;e=e.parentElement}return null}function DO(t,e){for(var n=t||document.activeElement;n;){if(e.has(n))return n;n=n.parentElement}return null}function vf(t,e){var n=MO(t,!0);return n.filter(function(r){return e.has(r)})}function gm(t,e,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1;if(!t)return null;var i=vf(t,e),o=i.length,a=i.findIndex(function(s){return n===s});return r<0?a===-1?a=o-1:a-=1:r>0&&(a+=1),a=(a+o)%o,i[a]}var Ed=function(e,n){var r=new Set,i=new Map,o=new Map;return e.forEach(function(a){var s=document.querySelector("[data-menu-id='".concat(kC(n,a),"']"));s&&(r.add(s),o.set(s,a),i.set(a,s))}),{elements:r,key2element:i,element2key:o}};function BO(t,e,n,r,i,o,a,s,A,c){var u=l.useRef(),d=l.useRef();d.current=e;var f=function(){qt.cancel(u.current)};return l.useEffect(function(){return function(){f()}},[]),function(p){var v=p.which;if([].concat(fm,[rA,UC,fa,ga]).includes(v)){var C=o(),m=Ed(C,r),y=m,w=y.elements,I=y.key2element,O=y.element2key,x=I.get(e),g=DO(x,w),M=O.get(g),E=TO(t,a(M,!0).length===1,n,v);if(!E&&v!==fa&&v!==ga)return;(fm.includes(v)||[fa,ga].includes(v))&&p.preventDefault();var b=function(P){if(P){var H=P,Z=P.querySelector("a");Z!=null&&Z.getAttribute("href")&&(H=Z);var V=O.get(P);s(V),f(),u.current=qt(function(){d.current===V&&H.focus()})}};if([fa,ga].includes(v)||E.sibling||!g){var h;!g||t==="inline"?h=i.current:h=NO(g);var S,T=vf(h,w);v===fa?S=T[0]:v===ga?S=T[T.length-1]:S=gm(h,w,g,E.offset),b(S)}else if(E.inlineTrigger)A(M);else if(E.offset>0)A(M,!0),f(),u.current=qt(function(){m=Ed(C,r);var k=g.getAttribute("aria-controls"),P=document.getElementById(k),H=gm(P,m.elements);b(H)},5);else if(E.offset<0){var R=a(M,!0),D=R[R.length-2],B=I.get(D);A(D,!1),b(B)}}c==null||c(p)}}function FO(t){Promise.resolve().then(t)}var Cf="__RC_UTIL_PATH_SPLIT__",hm=function(e){return e.join(Cf)},kO=function(e){return e.split(Cf)},bd="rc-menu-more";function PO(){var t=l.useState({}),e=ee(t,2),n=e[1],r=N.useRef(new Map),i=N.useRef(new Map),o=l.useState([]),a=ee(o,2),s=a[0],A=a[1],c=N.useRef(0),u=N.useRef(!1),d=function(){u.current||n({})},f=N.useCallback(function(I,O){process.env.NODE_ENV!=="production"&&yt(!r.current.has(I),"Duplicated key '".concat(I,"' used in Menu by path [").concat(O.join(" > "),"]"));var x=hm(O);i.current.set(x,I),r.current.set(I,x),c.current+=1;var g=c.current;FO(function(){g===c.current&&d()})},[]),p=N.useCallback(function(I,O){var x=hm(O);i.current.delete(x),r.current.delete(I)},[]),v=N.useCallback(function(I){A(I)},[]),C=N.useCallback(function(I,O){var x=r.current.get(I)||"",g=kO(x);return O&&s.includes(g[0])&&g.unshift(bd),g},[s]),m=N.useCallback(function(I,O){return I.filter(function(x){return x!==void 0}).some(function(x){var g=C(x,!0);return g.includes(O)})},[C]),y=function(){var O=Re(r.current.keys());return s.length&&O.push(bd),O},w=N.useCallback(function(I){var O="".concat(r.current.get(I)).concat(Cf),x=new Set;return Re(i.current.keys()).forEach(function(g){g.startsWith(O)&&x.add(i.current.get(g))}),x},[]);return l.useEffect(function(){return function(){u.current=!0}},[]),{registerPath:f,unregisterPath:p,refreshOverflowKeys:v,isSubPathKey:m,getKeyPath:C,getKeys:y,getSubPathKeys:w}}function Ca(t){var e=l.useRef(t);e.current=t;var n=l.useCallback(function(){for(var r,i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return(r=e.current)===null||r===void 0?void 0:r.call.apply(r,[e].concat(o))},[]);return t?n:void 0}var QO=Math.random().toFixed(5).toString().slice(2),pm=0;function jO(t){var e=Fn(t,{value:t}),n=ee(e,2),r=n[0],i=n[1];return l.useEffect(function(){pm+=1;var o=process.env.NODE_ENV==="test"?"test":"".concat(QO,"-").concat(pm);i("rc-menu-uuid-".concat(o))},[]),r}function HC(t,e,n,r){var i=l.useContext(jr),o=i.activeKey,a=i.onActive,s=i.onInactive,A={active:o===t};return e||(A.onMouseEnter=function(c){n==null||n({key:t,domEvent:c}),a(t)},A.onMouseLeave=function(c){r==null||r({key:t,domEvent:c}),s(t)}),A}function GC(t){var e=l.useContext(jr),n=e.mode,r=e.rtl,i=e.inlineIndent;if(n!=="inline")return null;var o=t;return r?{paddingRight:o*i}:{paddingLeft:o*i}}function qC(t){var e=t.icon,n=t.props,r=t.children,i;return e===null||e===!1?null:(typeof e=="function"?i=l.createElement(e,L({},n)):typeof e!="boolean"&&(i=e),i||r||null)}var LO=["item"];function MA(t){var e=t.item,n=Et(t,LO);return Object.defineProperty(n,"item",{get:function(){return yt(!1,"`info.item` is deprecated since we will move to function component that not provides React Node instance in future."),e}}),n}var UO=["title","attribute","elementRef"],HO=["style","className","eventKey","warnKey","disabled","itemIcon","children","role","onMouseEnter","onMouseLeave","onClick","onKeyDown","onFocus"],GO=["active"],qO=function(t){fi(n,t);var e=gi(n);function n(){return pn(this,n),e.apply(this,arguments)}return mn(n,[{key:"render",value:function(){var i=this.props,o=i.title,a=i.attribute,s=i.elementRef,A=Et(i,UO),c=tr(A,["eventKey","popupClassName","popupOffset","onTitleClick"]);return yt(!a,"`attribute` of Menu.Item is deprecated. Please pass attribute directly."),l.createElement(Yr.Item,Qe({},a,{title:typeof o=="string"?o:void 0},c,{ref:s}))}}]),n}(l.Component),ZO=l.forwardRef(function(t,e){var n=t.style,r=t.className,i=t.eventKey,o=t.warnKey,a=t.disabled,s=t.itemIcon,A=t.children,c=t.role,u=t.onMouseEnter,d=t.onMouseLeave,f=t.onClick,p=t.onKeyDown,v=t.onFocus,C=Et(t,HO),m=PC(i),y=l.useContext(jr),w=y.prefixCls,I=y.onItemClick,O=y.disabled,x=y.overflowDisabled,g=y.itemIcon,M=y.selectedKeys,E=y.onActive,b=l.useContext(mf),h=b._internalRenderMenuItem,S="".concat(w,"-item"),T=l.useRef(),R=l.useRef(),D=O||a,B=ji(e,R),k=ta(i);process.env.NODE_ENV!=="production"&&o&&yt(!1,"MenuItem should not leave undefined `key`.");var P=function(ce){return{key:i,keyPath:Re(k).reverse(),item:T.current,domEvent:ce}},H=s||g,Z=HC(i,D,u,d),V=Z.active,q=Et(Z,GO),U=M.includes(i),$=GC(k.length),z=function(ce){if(!D){var ue=P(ce);f==null||f(MA(ue)),I(ue)}},J=function(ce){if(p==null||p(ce),ce.which===at.ENTER){var ue=P(ce);f==null||f(MA(ue)),I(ue)}},W=function(ce){E(i),v==null||v(ce)},te={};t.role==="option"&&(te["aria-selected"]=U);var _=l.createElement(qO,Qe({ref:T,elementRef:B,role:c===null?"none":c||"menuitem",tabIndex:a?null:-1,"data-menu-id":x&&m?null:m},tr(C,["extra"]),q,te,{component:"li","aria-disabled":a,style:L(L({},$),n),className:Ae(S,Q(Q(Q({},"".concat(S,"-active"),V),"".concat(S,"-selected"),U),"".concat(S,"-disabled"),D),r),onClick:z,onKeyDown:J,onFocus:W}),A,l.createElement(qC,{props:L(L({},t),{},{isSelected:U}),icon:H}));return h&&(_=h(_,t,{selected:U})),_});function KO(t,e){var n=t.eventKey,r=pc(),i=ta(n);return l.useEffect(function(){if(r)return r.registerPath(n,i),function(){r.unregisterPath(n,i)}},[i]),r?null:l.createElement(ZO,Qe({},t,{ref:e}))}const mc=l.forwardRef(KO);var VO=["className","children"],zO=function(e,n){var r=e.className,i=e.children,o=Et(e,VO),a=l.useContext(jr),s=a.prefixCls,A=a.mode,c=a.rtl;return l.createElement("ul",Qe({className:Ae(s,c&&"".concat(s,"-rtl"),"".concat(s,"-sub"),"".concat(s,"-").concat(A==="inline"?"inline":"vertical"),r),role:"menu"},o,{"data-menu-list":!0,ref:n}),i)},yf=l.forwardRef(zO);yf.displayName="SubMenuList";function Ef(t,e){return Pr(t).map(function(n,r){if(l.isValidElement(n)){var i,o,a=n.key,s=(i=(o=n.props)===null||o===void 0?void 0:o.eventKey)!==null&&i!==void 0?i:a,A=s==null;A&&(s="tmp_key-".concat([].concat(Re(e),[r]).join("-")));var c={key:s,eventKey:s};return process.env.NODE_ENV!=="production"&&A&&(c.warnKey=!0),l.cloneElement(n,c)}return n})}var jn={adjustX:1,adjustY:1},YO={topLeft:{points:["bl","tl"],overflow:jn},topRight:{points:["br","tr"],overflow:jn},bottomLeft:{points:["tl","bl"],overflow:jn},bottomRight:{points:["tr","br"],overflow:jn},leftTop:{points:["tr","tl"],overflow:jn},leftBottom:{points:["br","bl"],overflow:jn},rightTop:{points:["tl","tr"],overflow:jn},rightBottom:{points:["bl","br"],overflow:jn}},WO={topLeft:{points:["bl","tl"],overflow:jn},topRight:{points:["br","tr"],overflow:jn},bottomLeft:{points:["tl","bl"],overflow:jn},bottomRight:{points:["tr","br"],overflow:jn},rightTop:{points:["tr","tl"],overflow:jn},rightBottom:{points:["br","bl"],overflow:jn},leftTop:{points:["tl","tr"],overflow:jn},leftBottom:{points:["bl","br"],overflow:jn}};function ZC(t,e,n){if(e)return e;if(n)return n[t]||n.other}var JO={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"};function _O(t){var e=t.prefixCls,n=t.visible,r=t.children,i=t.popup,o=t.popupStyle,a=t.popupClassName,s=t.popupOffset,A=t.disabled,c=t.mode,u=t.onVisibleChange,d=l.useContext(jr),f=d.getPopupContainer,p=d.rtl,v=d.subMenuOpenDelay,C=d.subMenuCloseDelay,m=d.builtinPlacements,y=d.triggerSubMenuAction,w=d.forceSubMenuRender,I=d.rootClassName,O=d.motion,x=d.defaultMotions,g=l.useState(!1),M=ee(g,2),E=M[0],b=M[1],h=L(p?L({},WO):L({},YO),m),S=JO[c],T=ZC(c,O,x),R=l.useRef(T);c!=="inline"&&(R.current=T);var D=L(L({},R.current),{},{leavedClassName:"".concat(e,"-hidden"),removeOnLeave:!1,motionAppear:!0}),B=l.useRef();return l.useEffect(function(){return B.current=qt(function(){b(n)}),function(){qt.cancel(B.current)}},[n]),l.createElement(hc,{prefixCls:e,popupClassName:Ae("".concat(e,"-popup"),Q({},"".concat(e,"-rtl"),p),a,I),stretch:c==="horizontal"?"minWidth":null,getPopupContainer:f,builtinPlacements:h,popupPlacement:S,popupVisible:E,popup:i,popupStyle:o,popupAlign:s&&{offset:s},action:A?[]:[y],mouseEnterDelay:v,mouseLeaveDelay:C,onPopupVisibleChange:u,forceRender:w,popupMotion:D,fresh:!0},r)}function $O(t){var e=t.id,n=t.open,r=t.keyPath,i=t.children,o="inline",a=l.useContext(jr),s=a.prefixCls,A=a.forceSubMenuRender,c=a.motion,u=a.defaultMotions,d=a.mode,f=l.useRef(!1);f.current=d===o;var p=l.useState(!f.current),v=ee(p,2),C=v[0],m=v[1],y=f.current?n:!1;l.useEffect(function(){f.current&&m(!1)},[d]);var w=L({},ZC(o,c,u));r.length>1&&(w.motionAppear=!1);var I=w.onVisibleChanged;return w.onVisibleChanged=function(O){return!f.current&&!O&&m(!0),I==null?void 0:I(O)},C?null:l.createElement(Ga,{mode:o,locked:!f.current},l.createElement(lo,Qe({visible:y},w,{forceRender:A,removeOnLeave:!1,leavedClassName:"".concat(s,"-hidden")}),function(O){var x=O.className,g=O.style;return l.createElement(yf,{id:e,className:x,style:g},i)}))}var XO=["style","className","title","eventKey","warnKey","disabled","internalPopupClose","children","itemIcon","expandIcon","popupClassName","popupOffset","popupStyle","onClick","onMouseEnter","onMouseLeave","onTitleClick","onTitleMouseEnter","onTitleMouseLeave"],eM=["active"],tM=l.forwardRef(function(t,e){var n=t.style,r=t.className,i=t.title,o=t.eventKey,a=t.warnKey,s=t.disabled,A=t.internalPopupClose,c=t.children,u=t.itemIcon,d=t.expandIcon,f=t.popupClassName,p=t.popupOffset,v=t.popupStyle,C=t.onClick,m=t.onMouseEnter,y=t.onMouseLeave,w=t.onTitleClick,I=t.onTitleMouseEnter,O=t.onTitleMouseLeave,x=Et(t,XO),g=PC(o),M=l.useContext(jr),E=M.prefixCls,b=M.mode,h=M.openKeys,S=M.disabled,T=M.overflowDisabled,R=M.activeKey,D=M.selectedKeys,B=M.itemIcon,k=M.expandIcon,P=M.onItemClick,H=M.onOpenChange,Z=M.onActive,V=l.useContext(mf),q=V._internalRenderSubMenuItem,U=l.useContext(LC),$=U.isSubPathKey,z=ta(),J="".concat(E,"-submenu"),W=S||s,te=l.useRef(),_=l.useRef();process.env.NODE_ENV!=="production"&&a&&yt(!1,"SubMenu should not leave undefined `key`.");var se=u??B,ce=d??k,ue=h.includes(o),ne=!T&&ue,me=$(D,o),Y=HC(o,W,I,O),de=Y.active,le=Et(Y,eM),Se=l.useState(!1),xe=ee(Se,2),Ce=xe[0],De=xe[1],je=function(At){W||De(At)},Le=function(At){je(!0),m==null||m({key:o,domEvent:At})},Ie=function(At){je(!1),y==null||y({key:o,domEvent:At})},pe=l.useMemo(function(){return de||(b!=="inline"?Ce||$([R],o):!1)},[b,de,R,Ce,o,$]),Oe=GC(z.length),Ze=function(At){W||(w==null||w({key:o,domEvent:At}),b==="inline"&&H(o,!ue))},tt=Ca(function(st){C==null||C(MA(st)),P(st)}),rt=function(At){b!=="inline"&&H(o,At)},Ge=function(){Z(o)},be=g&&"".concat(g,"-popup"),Je=l.useMemo(function(){return l.createElement(qC,{icon:b!=="horizontal"?ce:void 0,props:L(L({},t),{},{isOpen:ne,isSubMenu:!0})},l.createElement("i",{className:"".concat(J,"-arrow")}))},[b,ce,t,ne,J]),lt=l.createElement("div",Qe({role:"menuitem",style:Oe,className:"".concat(J,"-title"),tabIndex:W?null:-1,ref:te,title:typeof i=="string"?i:null,"data-menu-id":T&&g?null:g,"aria-expanded":ne,"aria-haspopup":!0,"aria-controls":be,"aria-disabled":W,onClick:Ze,onFocus:Ge},le),i,Je),$e=l.useRef(b);if(b!=="inline"&&z.length>1?$e.current="vertical":$e.current=b,!T){var Be=$e.current;lt=l.createElement(_O,{mode:Be,prefixCls:J,visible:!A&&ne&&b!=="inline",popupClassName:f,popupOffset:p,popupStyle:v,popup:l.createElement(Ga,{mode:Be==="horizontal"?"vertical":Be},l.createElement(yf,{id:be,ref:_},c)),disabled:W,onVisibleChange:rt},lt)}var Me=l.createElement(Yr.Item,Qe({ref:e,role:"none"},x,{component:"li",style:n,className:Ae(J,"".concat(J,"-").concat(b),r,Q(Q(Q(Q({},"".concat(J,"-open"),ne),"".concat(J,"-active"),pe),"".concat(J,"-selected"),me),"".concat(J,"-disabled"),W)),onMouseEnter:Le,onMouseLeave:Ie}),lt,!T&&l.createElement($O,{id:be,open:ne,keyPath:z},c));return q&&(Me=q(Me,t,{selected:me,active:pe,open:ne,disabled:W})),l.createElement(Ga,{onItemClick:tt,mode:b==="horizontal"?"vertical":b,itemIcon:se,expandIcon:ce},Me)}),cs=l.forwardRef(function(t,e){var n=t.eventKey,r=t.children,i=ta(n),o=Ef(r,i),a=pc();l.useEffect(function(){if(a)return a.registerPath(n,i),function(){a.unregisterPath(n,i)}},[i]);var s;return a?s=o:s=l.createElement(tM,Qe({ref:e},t),o),l.createElement(jC.Provider,{value:i},s)});process.env.NODE_ENV!=="production"&&(cs.displayName="SubMenu");function bf(t){var e=t.className,n=t.style,r=l.useContext(jr),i=r.prefixCls,o=pc();return o?null:l.createElement("li",{role:"separator",className:Ae("".concat(i,"-item-divider"),e),style:n})}var nM=["className","title","eventKey","children"],rM=l.forwardRef(function(t,e){var n=t.className,r=t.title;t.eventKey;var i=t.children,o=Et(t,nM),a=l.useContext(jr),s=a.prefixCls,A="".concat(s,"-item-group");return l.createElement("li",Qe({ref:e,role:"presentation"},o,{onClick:function(u){return u.stopPropagation()},className:Ae(A,n)}),l.createElement("div",{role:"presentation",className:"".concat(A,"-title"),title:typeof r=="string"?r:void 0},r),l.createElement("ul",{role:"group",className:"".concat(A,"-list")},i))}),vc=l.forwardRef(function(t,e){var n=t.eventKey,r=t.children,i=ta(n),o=Ef(r,i),a=pc();return a?o:l.createElement(rM,Qe({ref:e},tr(t,["warnKey"])),o)});process.env.NODE_ENV!=="production"&&(vc.displayName="MenuItemGroup");var iM=["label","children","key","type","extra"];function Sd(t,e,n){var r=e.item,i=e.group,o=e.submenu,a=e.divider;return(t||[]).map(function(s,A){if(s&&et(s)==="object"){var c=s,u=c.label,d=c.children,f=c.key,p=c.type,v=c.extra,C=Et(c,iM),m=f??"tmp-".concat(A);return d||p==="group"?p==="group"?l.createElement(i,Qe({key:m},C,{title:u}),Sd(d,e,n)):l.createElement(o,Qe({key:m},C,{title:u}),Sd(d,e,n)):p==="divider"?l.createElement(a,Qe({key:m},C)):l.createElement(r,Qe({key:m},C,{extra:v}),u,(!!v||v===0)&&l.createElement("span",{className:"".concat(n,"-item-extra")},v))}return null}).filter(function(s){return s})}function mm(t,e,n,r,i){var o=t,a=L({divider:bf,item:mc,group:vc,submenu:cs},r);return e&&(o=Sd(e,a,i)),Ef(o,n)}var oM=["prefixCls","rootClassName","style","className","tabIndex","items","children","direction","id","mode","inlineCollapsed","disabled","disabledOverflow","subMenuOpenDelay","subMenuCloseDelay","forceSubMenuRender","defaultOpenKeys","openKeys","activeKey","defaultActiveFirst","selectable","multiple","defaultSelectedKeys","selectedKeys","onSelect","onDeselect","inlineIndent","motion","defaultMotions","triggerSubMenuAction","builtinPlacements","itemIcon","expandIcon","overflowedIndicator","overflowedIndicatorPopupClassName","getPopupContainer","onClick","onOpenChange","onKeyDown","openAnimation","openTransitionName","_internalRenderMenuItem","_internalRenderSubMenuItem","_internalComponents"],qi=[],aM=l.forwardRef(function(t,e){var n,r=t,i=r.prefixCls,o=i===void 0?"rc-menu":i,a=r.rootClassName,s=r.style,A=r.className,c=r.tabIndex,u=c===void 0?0:c,d=r.items,f=r.children,p=r.direction,v=r.id,C=r.mode,m=C===void 0?"vertical":C,y=r.inlineCollapsed,w=r.disabled,I=r.disabledOverflow,O=r.subMenuOpenDelay,x=O===void 0?.1:O,g=r.subMenuCloseDelay,M=g===void 0?.1:g,E=r.forceSubMenuRender,b=r.defaultOpenKeys,h=r.openKeys,S=r.activeKey,T=r.defaultActiveFirst,R=r.selectable,D=R===void 0?!0:R,B=r.multiple,k=B===void 0?!1:B,P=r.defaultSelectedKeys,H=r.selectedKeys,Z=r.onSelect,V=r.onDeselect,q=r.inlineIndent,U=q===void 0?24:q,$=r.motion,z=r.defaultMotions,J=r.triggerSubMenuAction,W=J===void 0?"hover":J,te=r.builtinPlacements,_=r.itemIcon,se=r.expandIcon,ce=r.overflowedIndicator,ue=ce===void 0?"...":ce,ne=r.overflowedIndicatorPopupClassName,me=r.getPopupContainer,Y=r.onClick,de=r.onOpenChange,le=r.onKeyDown,Se=r.openAnimation,xe=r.openTransitionName,Ce=r._internalRenderMenuItem,De=r._internalRenderSubMenuItem,je=r._internalComponents,Le=Et(r,oM),Ie=l.useMemo(function(){return[mm(f,d,qi,je,o),mm(f,d,qi,{},o)]},[f,d,je]),pe=ee(Ie,2),Oe=pe[0],Ze=pe[1],tt=l.useState(!1),rt=ee(tt,2),Ge=rt[0],be=rt[1],Je=l.useRef(),lt=jO(v),$e=p==="rtl";process.env.NODE_ENV!=="production"&&yt(!Se&&!xe,"`openAnimation` and `openTransitionName` is removed. Please use `motion` or `defaultMotion` instead.");var Be=Fn(b,{value:h,postState:function(gt){return gt||qi}}),Me=ee(Be,2),st=Me[0],At=Me[1],Ct=function(gt){var bt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;function Tt(){At(gt),de==null||de(gt)}bt?Wr.flushSync(Tt):Tt()},Nt=l.useState(st),Jt=ee(Nt,2),Wt=Jt[0],en=Jt[1],_t=l.useRef(!1),Zt=l.useMemo(function(){return(m==="inline"||m==="vertical")&&y?["vertical",y]:[m,!1]},[m,y]),Rt=ee(Zt,2),pt=Rt[0],Ve=Rt[1],_e=pt==="inline",Te=l.useState(pt),ot=ee(Te,2),mt=ot[0],Fe=ot[1],we=l.useState(Ve),Ke=ee(we,2),ze=Ke[0],Ue=Ke[1];l.useEffect(function(){Fe(pt),Ue(Ve),_t.current&&(_e?At(Wt):Ct(qi))},[pt,Ve]);var F=l.useState(0),ge=ee(F,2),j=ge[0],re=ge[1],X=j>=Oe.length-1||mt!=="horizontal"||I;l.useEffect(function(){_e&&en(st)},[st]),l.useEffect(function(){return _t.current=!0,function(){_t.current=!1}},[]);var ve=PO(),ke=ve.registerPath,Xe=ve.unregisterPath,Ft=ve.refreshOverflowKeys,ft=ve.isSubPathKey,St=ve.getKeyPath,Ee=ve.getKeys,Ne=ve.getSubPathKeys,ct=l.useMemo(function(){return{registerPath:ke,unregisterPath:Xe}},[ke,Xe]),ut=l.useMemo(function(){return{isSubPathKey:ft}},[ft]);l.useEffect(function(){Ft(X?qi:Oe.slice(j+1).map(function(qe){return qe.key}))},[j,X]);var kt=Fn(S||T&&((n=Oe[0])===null||n===void 0?void 0:n.key),{value:S}),Pn=ee(kt,2),ln=Pn[0],Yn=Pn[1],Hr=Ca(function(qe){Yn(qe)}),Hn=Ca(function(){Yn(void 0)});N.useImperativeHandle(e,function(){return{list:Je.current,focus:function(gt){var bt,Tt=Ee(),Bt=Ed(Tt,lt),wn=Bt.elements,In=Bt.key2element,Wn=Bt.element2key,rr=vf(Je.current,wn),Jn=ln??(rr[0]?Wn.get(rr[0]):(bt=Oe.find(function(Hi){return!Hi.props.disabled}))===null||bt===void 0?void 0:bt.key),_n=In.get(Jn);if(Jn&&_n){var vn;_n==null||(vn=_n.focus)===null||vn===void 0||vn.call(_n,gt)}}}});var Gn=Fn(P||[],{value:H,postState:function(gt){return Array.isArray(gt)?gt:gt==null?qi:[gt]}}),xr=ee(Gn,2),qn=xr[0],Xr=xr[1],Rr=function(gt){if(D){var bt=gt.key,Tt=qn.includes(bt),Bt;k?Tt?Bt=qn.filter(function(In){return In!==bt}):Bt=[].concat(Re(qn),[bt]):Bt=[bt],Xr(Bt);var wn=L(L({},gt),{},{selectedKeys:Bt});Tt?V==null||V(wn):Z==null||Z(wn)}!k&&st.length&&mt!=="inline"&&Ct(qi)},Zn=Ca(function(qe){Y==null||Y(MA(qe)),Rr(qe)}),nr=Ca(function(qe,gt){var bt=st.filter(function(Bt){return Bt!==qe});if(gt)bt.push(qe);else if(mt!=="inline"){var Tt=Ne(qe);bt=bt.filter(function(Bt){return!Tt.has(Bt)})}Oa(st,bt,!0)||Ct(bt,!0)}),gr=function(gt,bt){var Tt=bt??!st.includes(gt);nr(gt,Tt)},hr=BO(mt,ln,$e,lt,Je,Ee,St,Yn,gr,le);l.useEffect(function(){be(!0)},[]);var Gr=l.useMemo(function(){return{_internalRenderMenuItem:Ce,_internalRenderSubMenuItem:De}},[Ce,De]),ei=mt!=="horizontal"||I?Oe:Oe.map(function(qe,gt){return l.createElement(Ga,{key:qe.key,overflowDisabled:gt>j},qe)}),wt=l.createElement(Yr,Qe({id:v,ref:Je,prefixCls:"".concat(o,"-overflow"),component:"ul",itemComponent:mc,className:Ae(o,"".concat(o,"-root"),"".concat(o,"-").concat(mt),A,Q(Q({},"".concat(o,"-inline-collapsed"),ze),"".concat(o,"-rtl"),$e),a),dir:p,style:s,role:"menu",tabIndex:u,data:ei,renderRawItem:function(gt){return gt},renderRawRest:function(gt){var bt=gt.length,Tt=bt?Oe.slice(-bt):null;return l.createElement(cs,{eventKey:bd,title:ue,disabled:X,internalPopupClose:bt===0,popupClassName:ne},Tt)},maxCount:mt!=="horizontal"||I?Yr.INVALIDATE:Yr.RESPONSIVE,ssr:"full","data-menu-list":!0,onVisibleChange:function(gt){re(gt)},onKeyDown:hr},Le));return l.createElement(mf.Provider,{value:Gr},l.createElement(FC.Provider,{value:lt},l.createElement(Ga,{prefixCls:o,rootClassName:a,mode:mt,openKeys:st,rtl:$e,disabled:w,motion:Ge?$:null,defaultMotions:Ge?z:null,activeKey:ln,onActive:Hr,onInactive:Hn,selectedKeys:qn,inlineIndent:U,subMenuOpenDelay:x,subMenuCloseDelay:M,forceSubMenuRender:E,builtinPlacements:te,triggerSubMenuAction:W,getPopupContainer:me,itemIcon:_,expandIcon:se,onItemClick:Zn,onOpenChange:nr},l.createElement(LC.Provider,{value:ut},wt),l.createElement("div",{style:{display:"none"},"aria-hidden":!0},l.createElement(QC.Provider,{value:ct},Ze)))))}),ls=aM;ls.Item=mc;ls.SubMenu=cs;ls.ItemGroup=vc;ls.Divider=bf;var sM={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M912 192H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM104 228a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0z"}}]},name:"bars",theme:"outlined"},AM=function(e,n){return l.createElement(Nn,Qe({},e,{ref:n,icon:sM}))},KC=l.forwardRef(AM);process.env.NODE_ENV!=="production"&&(KC.displayName="BarsOutlined");var cM={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 000 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z"}}]},name:"left",theme:"outlined"},lM=function(e,n){return l.createElement(Nn,Qe({},e,{ref:n,icon:cM}))},wd=l.forwardRef(lM);process.env.NODE_ENV!=="production"&&(wd.displayName="LeftOutlined");const uM=l.createContext({siderHook:{addSider:()=>null,removeSider:()=>null}}),dM=t=>{const{antCls:e,componentCls:n,colorText:r,footerBg:i,headerHeight:o,headerPadding:a,headerColor:s,footerPadding:A,fontSize:c,bodyBg:u,headerBg:d}=t;return{[n]:{display:"flex",flex:"auto",flexDirection:"column",minHeight:0,background:u,"&, *":{boxSizing:"border-box"},[`&${n}-has-sider`]:{flexDirection:"row",[`> ${n}, > ${n}-content`]:{width:0}},[`${n}-header, &${n}-footer`]:{flex:"0 0 auto"},"&-rtl":{direction:"rtl"}},[`${n}-header`]:{height:o,padding:a,color:s,lineHeight:ye(o),background:d,[`${e}-menu`]:{lineHeight:"inherit"}},[`${n}-footer`]:{padding:A,color:r,fontSize:c,background:i},[`${n}-content`]:{flex:"auto",color:r,minHeight:0}}},VC=t=>{const{colorBgLayout:e,controlHeight:n,controlHeightLG:r,colorText:i,controlHeightSM:o,marginXXS:a,colorTextLightSolid:s,colorBgContainer:A}=t,c=r*1.25;return{colorBgHeader:"#001529",colorBgBody:e,colorBgTrigger:"#002140",bodyBg:e,headerBg:"#001529",headerHeight:n*2,headerPadding:`0 ${c}px`,headerColor:i,footerPadding:`${o}px ${c}px`,footerBg:e,siderBg:"#001529",triggerHeight:r+a*2,triggerBg:"#002140",triggerColor:s,zeroTriggerWidth:r,zeroTriggerHeight:r,lightSiderBg:A,lightTriggerBg:A,lightTriggerColor:i}},zC=[["colorBgBody","bodyBg"],["colorBgHeader","headerBg"],["colorBgTrigger","triggerBg"]];Tn("Layout",t=>[dM(t)],VC,{deprecatedTokens:zC});const fM=t=>{const{componentCls:e,siderBg:n,motionDurationMid:r,motionDurationSlow:i,antCls:o,triggerHeight:a,triggerColor:s,triggerBg:A,headerHeight:c,zeroTriggerWidth:u,zeroTriggerHeight:d,borderRadiusLG:f,lightSiderBg:p,lightTriggerColor:v,lightTriggerBg:C,bodyBg:m}=t;return{[e]:{position:"relative",minWidth:0,background:n,transition:`all ${r}, background 0s`,"&-has-trigger":{paddingBottom:a},"&-right":{order:1},[`${e}-children`]:{height:"100%",marginTop:-.1,paddingTop:.1,[`${o}-menu${o}-menu-inline-collapsed`]:{width:"auto"}},[`${e}-trigger`]:{position:"fixed",bottom:0,zIndex:1,height:a,color:s,lineHeight:ye(a),textAlign:"center",background:A,cursor:"pointer",transition:`all ${r}`},[`${e}-zero-width`]:{"> *":{overflow:"hidden"},"&-trigger":{position:"absolute",top:c,insetInlineEnd:t.calc(u).mul(-1).equal(),zIndex:1,width:u,height:d,color:s,fontSize:t.fontSizeXL,display:"flex",alignItems:"center",justifyContent:"center",background:n,borderRadius:`0 ${ye(f)} ${ye(f)} 0`,cursor:"pointer",transition:`background ${i} ease`,"&::after":{position:"absolute",inset:0,background:"transparent",transition:`all ${i}`,content:'""'},"&:hover::after":{background:"rgba(255, 255, 255, 0.2)"},"&-right":{insetInlineStart:t.calc(u).mul(-1).equal(),borderRadius:`${ye(f)} 0 0 ${ye(f)}`}}},"&-light":{background:p,[`${e}-trigger`]:{color:v,background:C},[`${e}-zero-width-trigger`]:{color:v,background:C,border:`1px solid ${m}`,borderInlineStart:0}}}}},gM=Tn(["Layout","Sider"],t=>[fM(t)],VC,{deprecatedTokens:zC});var hM=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n};const vm={xs:"479.98px",sm:"575.98px",md:"767.98px",lg:"991.98px",xl:"1199.98px",xxl:"1599.98px"},pM=t=>!Number.isNaN(Number.parseFloat(t))&&isFinite(t),Sf=l.createContext({}),mM=(()=>{let t=0;return function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return t+=1,`${e}${t}`}})(),vM=l.forwardRef((t,e)=>{const{prefixCls:n,className:r,trigger:i,children:o,defaultCollapsed:a=!1,theme:s="dark",style:A={},collapsible:c=!1,reverseArrow:u=!1,width:d=200,collapsedWidth:f=80,zeroWidthTriggerStyle:p,breakpoint:v,onCollapse:C,onBreakpoint:m}=t,y=hM(t,["prefixCls","className","trigger","children","defaultCollapsed","theme","style","collapsible","reverseArrow","width","collapsedWidth","zeroWidthTriggerStyle","breakpoint","onCollapse","onBreakpoint"]),{siderHook:w}=N.useContext(uM),[I,O]=N.useState("collapsed"in t?t.collapsed:a),[x,g]=N.useState(!1);N.useEffect(()=>{"collapsed"in t&&O(t.collapsed)},[t.collapsed]);const M=(_,se)=>{"collapsed"in t||O(_),C==null||C(_,se)},{getPrefixCls:E,direction:b}=N.useContext(Qt),h=E("layout-sider",n),[S,T,R]=gM(h),D=N.useRef(null);D.current=_=>{g(_.matches),m==null||m(_.matches),I!==_.matches&&M(_.matches,"responsive")},N.useEffect(()=>{function _(ce){return D.current(ce)}let se;if(typeof window<"u"){const{matchMedia:ce}=window;if(ce&&v&&v in vm){se=ce(`screen and (max-width: ${vm[v]})`);try{se.addEventListener("change",_)}catch{se.addListener(_)}_(se)}}return()=>{try{se==null||se.removeEventListener("change",_)}catch{se==null||se.removeListener(_)}}},[v]),N.useEffect(()=>{const _=mM("ant-sider-");return w.addSider(_),()=>w.removeSider(_)},[]);const B=()=>{M(!I,"clickTrigger")},k=tr(y,["collapsed"]),P=I?f:d,H=pM(P)?`${P}px`:String(P),Z=parseFloat(String(f||0))===0?l.createElement("span",{onClick:B,className:Ae(`${h}-zero-width-trigger`,`${h}-zero-width-trigger-${u?"right":"left"}`),style:p},i||l.createElement(KC,null)):null,V=b==="rtl"==!u,$={expanded:V?l.createElement(IA,null):l.createElement(wd,null),collapsed:V?l.createElement(wd,null):l.createElement(IA,null)}[I?"collapsed":"expanded"],z=i!==null?Z||l.createElement("div",{className:`${h}-trigger`,onClick:B,style:{width:H}},i||$):null,J=Object.assign(Object.assign({},A),{flex:`0 0 ${H}`,maxWidth:H,minWidth:H,width:H}),W=Ae(h,`${h}-${s}`,{[`${h}-collapsed`]:!!I,[`${h}-has-trigger`]:c&&i!==null&&!Z,[`${h}-below`]:!!x,[`${h}-zero-width`]:parseFloat(H)===0},r,T,R),te=l.useMemo(()=>({siderCollapsed:I}),[I]);return S(l.createElement(Sf.Provider,{value:te},l.createElement("aside",Object.assign({className:W},k,{style:J,ref:e}),l.createElement("div",{className:`${h}-children`},o),c||x&&Z?z:null)))});process.env.NODE_ENV!=="production"&&(vM.displayName="Sider");var CM={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M176 511a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0z"}}]},name:"ellipsis",theme:"outlined"},yM=function(e,n){return l.createElement(Nn,Qe({},e,{ref:n,icon:CM}))},wf=l.forwardRef(yM);process.env.NODE_ENV!=="production"&&(wf.displayName="EllipsisOutlined");const TA=N.createContext({prefixCls:"",firstLevel:!0,inlineCollapsed:!1});var EM=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n};const YC=t=>{const{prefixCls:e,className:n,dashed:r}=t,i=EM(t,["prefixCls","className","dashed"]),{getPrefixCls:o}=l.useContext(Qt),a=o("menu",e),s=Ae({[`${a}-item-divider-dashed`]:!!r},n);return l.createElement(bf,Object.assign({className:s},i))};function If(t){var e=t.children,n=t.prefixCls,r=t.id,i=t.overlayInnerStyle,o=t.bodyClassName,a=t.className,s=t.style;return l.createElement("div",{className:Ae("".concat(n,"-content"),a),style:s},l.createElement("div",{className:Ae("".concat(n,"-inner"),o),id:r,role:"tooltip",style:i},typeof e=="function"?e():e))}var wo={shiftX:64,adjustY:1},Io={adjustX:1,shiftY:!0},yr=[0,0],bM={left:{points:["cr","cl"],overflow:Io,offset:[-4,0],targetOffset:yr},right:{points:["cl","cr"],overflow:Io,offset:[4,0],targetOffset:yr},top:{points:["bc","tc"],overflow:wo,offset:[0,-4],targetOffset:yr},bottom:{points:["tc","bc"],overflow:wo,offset:[0,4],targetOffset:yr},topLeft:{points:["bl","tl"],overflow:wo,offset:[0,-4],targetOffset:yr},leftTop:{points:["tr","tl"],overflow:Io,offset:[-4,0],targetOffset:yr},topRight:{points:["br","tr"],overflow:wo,offset:[0,-4],targetOffset:yr},rightTop:{points:["tl","tr"],overflow:Io,offset:[4,0],targetOffset:yr},bottomRight:{points:["tr","br"],overflow:wo,offset:[0,4],targetOffset:yr},rightBottom:{points:["bl","br"],overflow:Io,offset:[4,0],targetOffset:yr},bottomLeft:{points:["tl","bl"],overflow:wo,offset:[0,4],targetOffset:yr},leftBottom:{points:["br","bl"],overflow:Io,offset:[-4,0],targetOffset:yr}},SM=["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","motion","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle","arrowContent","overlay","id","showArrow","classNames","styles"],wM=function(e,n){var r=e.overlayClassName,i=e.trigger,o=i===void 0?["hover"]:i,a=e.mouseEnterDelay,s=a===void 0?0:a,A=e.mouseLeaveDelay,c=A===void 0?.1:A,u=e.overlayStyle,d=e.prefixCls,f=d===void 0?"rc-tooltip":d,p=e.children,v=e.onVisibleChange,C=e.afterVisibleChange,m=e.transitionName,y=e.animation,w=e.motion,I=e.placement,O=I===void 0?"right":I,x=e.align,g=x===void 0?{}:x,M=e.destroyTooltipOnHide,E=M===void 0?!1:M,b=e.defaultVisible,h=e.getTooltipContainer,S=e.overlayInnerStyle;e.arrowContent;var T=e.overlay,R=e.id,D=e.showArrow,B=D===void 0?!0:D,k=e.classNames,P=e.styles,H=Et(e,SM),Z=rc(R),V=N.useRef(null);N.useImperativeHandle(n,function(){return V.current});var q=L({},H);"visible"in e&&(q.popupVisible=e.visible);var U=function(){return l.createElement(If,{key:"content",prefixCls:f,id:Z,bodyClassName:k==null?void 0:k.body,overlayInnerStyle:L(L({},S),P==null?void 0:P.body)},T)},$=function(){var J=l.Children.only(p),W=(J==null?void 0:J.props)||{},te=L(L({},W),{},{"aria-describedby":T?Z:null});return l.cloneElement(p,te)};return l.createElement(hc,Qe({popupClassName:Ae(r,k==null?void 0:k.root),prefixCls:f,popup:U,action:o,builtinPlacements:bM,popupPlacement:O,ref:V,popupAlign:g,getPopupContainer:h,onPopupVisibleChange:v,afterPopupVisibleChange:C,popupTransitionName:m,popupAnimation:y,popupMotion:w,defaultPopupVisible:b,autoDestroy:E,mouseLeaveDelay:c,popupStyle:L(L({},u),P==null?void 0:P.root),mouseEnterDelay:s,arrow:B},q),$())};const IM=N.forwardRef(wM),xM=Bi.map(t=>`${t}-inverse`),RM=["success","processing","error","default","warning"];function WC(t){return(arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0)?[].concat(Re(xM),Re(Bi)).includes(t):Bi.includes(t)}function OM(t){return RM.includes(t)}function JC(t,e){const n=WC(e),r=Ae({[`${t}-${e}`]:e&&n}),i={},o={};return e&&!n&&(i.background=e,o["--antd-arrow-background-color"]=e),{className:r,overlayStyle:i,arrowStyle:o}}const MM=t=>{const{prefixCls:e,className:n,placement:r="top",title:i,color:o,overlayInnerStyle:a}=t,{getPrefixCls:s}=l.useContext(Qt),A=s("tooltip",e),[c,u,d]=T1(A),f=JC(A,o),p=f.arrowStyle,v=Object.assign(Object.assign({},a),f.overlayStyle),C=Ae(u,d,A,`${A}-pure`,`${A}-placement-${r}`,n,f.className);return c(l.createElement("div",{className:C,style:p},l.createElement("div",{className:`${A}-arrow`}),l.createElement(If,Object.assign({},t,{className:u,prefixCls:A,overlayInnerStyle:v}),i)))};var TM=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n};const NM=l.forwardRef((t,e)=>{var n,r;const{prefixCls:i,openClassName:o,getTooltipContainer:a,color:s,overlayInnerStyle:A,children:c,afterOpenChange:u,afterVisibleChange:d,destroyTooltipOnHide:f,arrow:p=!0,title:v,overlay:C,builtinPlacements:m,arrowPointAtCenter:y=!1,autoAdjustOverflow:w=!0,motion:I,getPopupContainer:O,placement:x="top",mouseEnterDelay:g=.1,mouseLeaveDelay:M=.1,overlayStyle:E,rootClassName:b,overlayClassName:h,styles:S,classNames:T}=t,R=TM(t,["prefixCls","openClassName","getTooltipContainer","color","overlayInnerStyle","children","afterOpenChange","afterVisibleChange","destroyTooltipOnHide","arrow","title","overlay","builtinPlacements","arrowPointAtCenter","autoAdjustOverflow","motion","getPopupContainer","placement","mouseEnterDelay","mouseLeaveDelay","overlayStyle","rootClassName","overlayClassName","styles","classNames"]),D=!!p,[,B]=dr(),{getPopupContainer:k,getPrefixCls:P,direction:H,className:Z,style:V,classNames:q,styles:U}=Jr("tooltip"),$=cn("Tooltip"),z=l.useRef(null),J=()=>{var be;(be=z.current)===null||be===void 0||be.forceAlign()};l.useImperativeHandle(e,()=>{var be,Je;return{forceAlign:J,forcePopupAlign:()=>{$.deprecated(!1,"forcePopupAlign","forceAlign"),J()},nativeElement:(be=z.current)===null||be===void 0?void 0:be.nativeElement,popupElement:(Je=z.current)===null||Je===void 0?void 0:Je.popupElement}}),process.env.NODE_ENV!=="production"&&([["visible","open"],["defaultVisible","defaultOpen"],["onVisibleChange","onOpenChange"],["afterVisibleChange","afterOpenChange"],["arrowPointAtCenter","arrow={{ pointAtCenter: true }}"],["overlayStyle","styles={{ root: {} }}"],["overlayInnerStyle","styles={{ body: {} }}"],["overlayClassName","classNames={{ root: {} }}"]].forEach(be=>{let[Je,lt]=be;$.deprecated(!(Je in t),Je,lt)}),process.env.NODE_ENV!=="production"&&$(!f||typeof f=="boolean","usage","`destroyTooltipOnHide` no need config `keepParent` anymore. Please use `boolean` value directly."),process.env.NODE_ENV!=="production"&&$(!p||typeof p=="boolean"||!("arrowPointAtCenter"in p),"deprecated","`arrowPointAtCenter` in `arrow` is deprecated. Please use `pointAtCenter` instead."));const[W,te]=Fn(!1,{value:(n=t.open)!==null&&n!==void 0?n:t.visible,defaultValue:(r=t.defaultOpen)!==null&&r!==void 0?r:t.defaultVisible}),_=!v&&!C&&v!==0,se=be=>{var Je,lt;te(_?!1:be),_||((Je=t.onOpenChange)===null||Je===void 0||Je.call(t,be),(lt=t.onVisibleChange)===null||lt===void 0||lt.call(t,be))},ce=l.useMemo(()=>{var be,Je;let lt=y;return typeof p=="object"&&(lt=(Je=(be=p.pointAtCenter)!==null&&be!==void 0?be:p.arrowPointAtCenter)!==null&&Je!==void 0?Je:y),m||OC({arrowPointAtCenter:lt,autoAdjustOverflow:w,arrowWidth:D?B.sizePopupArrow:0,borderRadius:B.borderRadius,offset:B.marginXXS,visibleFirst:!0})},[y,p,m,B]),ue=l.useMemo(()=>v===0?v:C||v||"",[C,v]),ne=l.createElement(Ua,{space:!0},typeof ue=="function"?ue():ue),me=P("tooltip",i),Y=P(),de=t["data-popover-inject"];let le=W;!("open"in t)&&!("visible"in t)&&_&&(le=!1);const Se=l.isValidElement(c)&&!F1(c)?c:l.createElement("span",null,c),xe=Se.props,Ce=!xe.className||typeof xe.className=="string"?Ae(xe.className,o||`${me}-open`):xe.className,[De,je,Le]=T1(me,!de),Ie=JC(me,s),pe=Ie.arrowStyle,Oe=Ae(h,{[`${me}-rtl`]:H==="rtl"},Ie.className,b,je,Le,Z,q.root,T==null?void 0:T.root),Ze=Ae(q.body,T==null?void 0:T.body),[tt,rt]=ts("Tooltip",R.zIndex),Ge=l.createElement(IM,Object.assign({},R,{zIndex:tt,showArrow:D,placement:x,mouseEnterDelay:g,mouseLeaveDelay:M,prefixCls:me,classNames:{root:Oe,body:Ze},styles:{root:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},pe),U.root),V),E),S==null?void 0:S.root),body:Object.assign(Object.assign(Object.assign(Object.assign({},U.body),A),S==null?void 0:S.body),Ie.overlayStyle)},getTooltipContainer:O||a||k,ref:z,builtinPlacements:ce,overlay:ne,visible:le,onVisibleChange:se,afterVisibleChange:u??d,arrowContent:l.createElement("span",{className:`${me}-arrow-content`}),motion:{motionName:sc(Y,"zoom-big-fast",t.transitionName),motionDeadline:1e3},destroyTooltipOnHide:!!f}),le?kr(Se,{className:Ce}):Se);return De(l.createElement(es.Provider,{value:rt},Ge))}),us=NM;process.env.NODE_ENV!=="production"&&(us.displayName="Tooltip");us._InternalPanelDoNotUseOrYouWillBeFired=MM;const _C=t=>{var e;const{className:n,children:r,icon:i,title:o,danger:a,extra:s}=t,{prefixCls:A,firstLevel:c,direction:u,disableMenuItemTitleTooltip:d,inlineCollapsed:f}=l.useContext(TA),p=I=>{const O=r==null?void 0:r[0],x=l.createElement("span",{className:Ae(`${A}-title-content`,{[`${A}-title-content-with-extra`]:!!s||s===0})},r);return(!i||l.isValidElement(r)&&r.type==="span")&&r&&I&&c&&typeof O=="string"?l.createElement("div",{className:`${A}-inline-collapsed-noicon`},O.charAt(0)):x},{siderCollapsed:v}=l.useContext(Sf);let C=o;typeof o>"u"?C=c?r:"":o===!1&&(C="");const m={title:C};!v&&!f&&(m.title=null,m.open=!1);const y=Pr(r).length;let w=l.createElement(mc,Object.assign({},tr(t,["title","icon","danger"]),{className:Ae({[`${A}-item-danger`]:a,[`${A}-item-only-child`]:(i?y+1:y)===1},n),title:typeof o=="string"?o:void 0}),kr(i,{className:Ae(l.isValidElement(i)?(e=i.props)===null||e===void 0?void 0:e.className:"",`${A}-item-icon`)}),p(f));return d||(w=l.createElement(us,Object.assign({},m,{placement:u==="rtl"?"left":"right",classNames:{root:`${A}-inline-collapsed-tooltip`}}),w)),w};var DM=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n};const NA=l.createContext(null),BM=l.forwardRef((t,e)=>{const{children:n}=t,r=DM(t,["children"]),i=l.useContext(NA),o=l.useMemo(()=>Object.assign(Object.assign({},i),r),[i,r.prefixCls,r.mode,r.selectable,r.rootClassName]),a=Ab(n),s=ji(e,a?co(n):null);return l.createElement(NA.Provider,{value:o},l.createElement(Ua,{space:!0},a?l.cloneElement(n,{ref:s}):n))}),FM=t=>{const{componentCls:e,motionDurationSlow:n,horizontalLineHeight:r,colorSplit:i,lineWidth:o,lineType:a,itemPaddingInline:s}=t;return{[`${e}-horizontal`]:{lineHeight:r,border:0,borderBottom:`${ye(o)} ${a} ${i}`,boxShadow:"none","&::after":{display:"block",clear:"both",height:0,content:'"\\20"'},[`${e}-item, ${e}-submenu`]:{position:"relative",display:"inline-block",verticalAlign:"bottom",paddingInline:s},[`> ${e}-item:hover,
613
613
  > ${e}-item-active,
614
614
  > ${e}-submenu ${e}-submenu-title:hover`]:{backgroundColor:"transparent"},[`${e}-item, ${e}-submenu-title`]:{transition:[`border-color ${n}`,`background ${n}`].join(",")},[`${e}-submenu-arrow`]:{display:"none"}}}},kM=t=>{let{componentCls:e,menuArrowOffset:n,calc:r}=t;return{[`${e}-rtl`]:{direction:"rtl"},[`${e}-submenu-rtl`]:{transformOrigin:"100% 0"},[`${e}-rtl${e}-vertical,
615
615
  ${e}-submenu-rtl ${e}-vertical`]:{[`${e}-submenu-arrow`]:{"&::before":{transform:`rotate(-45deg) translateY(${ye(r(n).mul(-1).equal())})`},"&::after":{transform:`rotate(45deg) translateY(${ye(n)})`}}}}},Cm=t=>Object.assign({},UA(t)),ym=(t,e)=>{const{componentCls:n,itemColor:r,itemSelectedColor:i,subMenuItemSelectedColor:o,groupTitleColor:a,itemBg:s,subMenuItemBg:A,itemSelectedBg:c,activeBarHeight:u,activeBarWidth:d,activeBarBorderWidth:f,motionDurationSlow:p,motionEaseInOut:v,motionEaseOut:C,itemPaddingInline:m,motionDurationMid:y,itemHoverColor:w,lineType:I,colorSplit:O,itemDisabledColor:x,dangerItemColor:g,dangerItemHoverColor:M,dangerItemSelectedColor:E,dangerItemActiveBg:b,dangerItemSelectedBg:h,popupBg:S,itemHoverBg:T,itemActiveBg:R,menuSubMenuBg:D,horizontalItemSelectedColor:B,horizontalItemSelectedBg:k,horizontalItemBorderRadius:P,horizontalItemHoverBg:H}=t;return{[`${n}-${e}, ${n}-${e} > ${n}`]:{color:r,background:s,[`&${n}-root:focus-visible`]:Object.assign({},Cm(t)),[`${n}-item`]:{"&-group-title, &-extra":{color:a}},[`${n}-submenu-selected > ${n}-submenu-title`]:{color:o},[`${n}-item, ${n}-submenu-title`]:{color:r,[`&:not(${n}-item-disabled):focus-visible`]:Object.assign({},Cm(t))},[`${n}-item-disabled, ${n}-submenu-disabled`]:{color:`${x} !important`},[`${n}-item:not(${n}-item-selected):not(${n}-submenu-selected)`]:{[`&:hover, > ${n}-submenu-title:hover`]:{color:w}},[`&:not(${n}-horizontal)`]:{[`${n}-item:not(${n}-item-selected)`]:{"&:hover":{backgroundColor:T},"&:active":{backgroundColor:R}},[`${n}-submenu-title`]:{"&:hover":{backgroundColor:T},"&:active":{backgroundColor:R}}},[`${n}-item-danger`]:{color:g,[`&${n}-item:hover`]:{[`&:not(${n}-item-selected):not(${n}-submenu-selected)`]:{color:M}},[`&${n}-item:active`]:{background:b}},[`${n}-item a`]:{"&, &:hover":{color:"inherit"}},[`${n}-item-selected`]:{color:i,[`&${n}-item-danger`]:{color:E},"a, a:hover":{color:"inherit"}},[`& ${n}-item-selected`]:{backgroundColor:c,[`&${n}-item-danger`]:{backgroundColor:h}},[`&${n}-submenu > ${n}`]:{backgroundColor:D},[`&${n}-popup > ${n}`]:{backgroundColor:S},[`&${n}-submenu-popup > ${n}`]:{backgroundColor:S},[`&${n}-horizontal`]:Object.assign(Object.assign({},e==="dark"?{borderBottom:0}:{}),{[`> ${n}-item, > ${n}-submenu`]:{top:f,marginTop:t.calc(f).mul(-1).equal(),marginBottom:0,borderRadius:P,"&::after":{position:"absolute",insetInline:m,bottom:0,borderBottom:`${ye(u)} solid transparent`,transition:`border-color ${p} ${v}`,content:'""'},"&:hover, &-active, &-open":{background:H,"&::after":{borderBottomWidth:u,borderBottomColor:B}},"&-selected":{color:B,backgroundColor:k,"&:hover":{backgroundColor:k},"&::after":{borderBottomWidth:u,borderBottomColor:B}}}}),[`&${n}-root`]:{[`&${n}-inline, &${n}-vertical`]:{borderInlineEnd:`${ye(f)} ${I} ${O}`}},[`&${n}-inline`]:{[`${n}-sub${n}-inline`]:{background:A},[`${n}-item`]:{position:"relative","&::after":{position:"absolute",insetBlock:0,insetInlineEnd:0,borderInlineEnd:`${ye(d)} solid ${i}`,transform:"scaleY(0.0001)",opacity:0,transition:[`transform ${y} ${C}`,`opacity ${y} ${C}`].join(","),content:'""'},[`&${n}-item-danger`]:{"&::after":{borderInlineEndColor:E}}},[`${n}-selected, ${n}-item-selected`]:{"&::after":{transform:"scaleY(1)",opacity:1,transition:[`transform ${y} ${v}`,`opacity ${y} ${v}`].join(",")}}}}}},Em=t=>{const{componentCls:e,itemHeight:n,itemMarginInline:r,padding:i,menuArrowSize:o,marginXS:a,itemMarginBlock:s,itemWidth:A,itemPaddingInline:c}=t,u=t.calc(o).add(i).add(a).equal();return{[`${e}-item`]:{position:"relative",overflow:"hidden"},[`${e}-item, ${e}-submenu-title`]:{height:n,lineHeight:ye(n),paddingInline:c,overflow:"hidden",textOverflow:"ellipsis",marginInline:r,marginBlock:s,width:A},[`> ${e}-item,
@@ -623,7 +623,7 @@ html body {
623
623
  `]:{opacity:0},[`${e}-item-icon, ${n}`]:{margin:0,fontSize:m,lineHeight:ye(r),"+ span":{display:"inline-block",opacity:0}}},[`${e}-item-icon, ${n}`]:{display:"inline-block"},"&-tooltip":{pointerEvents:"none",[`${e}-item-icon, ${n}`]:{display:"none"},"a, a:hover":{color:i}},[`${e}-item-group-title`]:Object.assign(Object.assign({},aA),{paddingInline:p})}}]},bm=t=>{const{componentCls:e,motionDurationSlow:n,motionDurationMid:r,motionEaseInOut:i,motionEaseOut:o,iconCls:a,iconSize:s,iconMarginInlineEnd:A}=t;return{[`${e}-item, ${e}-submenu-title`]:{position:"relative",display:"block",margin:0,whiteSpace:"nowrap",cursor:"pointer",transition:[`border-color ${n}`,`background ${n}`,`padding calc(${n} + 0.1s) ${i}`].join(","),[`${e}-item-icon, ${a}`]:{minWidth:s,fontSize:s,transition:[`font-size ${r} ${o}`,`margin ${n} ${i}`,`color ${n}`].join(","),"+ span":{marginInlineStart:A,opacity:1,transition:[`opacity ${n} ${i}`,`margin ${n}`,`color ${n}`].join(",")}},[`${e}-item-icon`]:Object.assign({},$a()),[`&${e}-item-only-child`]:{[`> ${a}, > ${e}-item-icon`]:{marginInlineEnd:0}}},[`${e}-item-disabled, ${e}-submenu-disabled`]:{background:"none !important",cursor:"not-allowed","&::after":{borderColor:"transparent !important"},a:{color:"inherit !important",cursor:"not-allowed",pointerEvents:"none"},[`> ${e}-submenu-title`]:{color:"inherit !important",cursor:"not-allowed"}}}},Sm=t=>{const{componentCls:e,motionDurationSlow:n,motionEaseInOut:r,borderRadius:i,menuArrowSize:o,menuArrowOffset:a}=t;return{[`${e}-submenu`]:{"&-expand-icon, &-arrow":{position:"absolute",top:"50%",insetInlineEnd:t.margin,width:o,color:"currentcolor",transform:"translateY(-50%)",transition:`transform ${n} ${r}, opacity ${n}`},"&-arrow":{"&::before, &::after":{position:"absolute",width:t.calc(o).mul(.6).equal(),height:t.calc(o).mul(.15).equal(),backgroundColor:"currentcolor",borderRadius:i,transition:[`background ${n} ${r}`,`transform ${n} ${r}`,`top ${n} ${r}`,`color ${n} ${r}`].join(","),content:'""'},"&::before":{transform:`rotate(45deg) translateY(${ye(t.calc(a).mul(-1).equal())})`},"&::after":{transform:`rotate(-45deg) translateY(${ye(a)})`}}}}},QM=t=>{const{antCls:e,componentCls:n,fontSize:r,motionDurationSlow:i,motionDurationMid:o,motionEaseInOut:a,paddingXS:s,padding:A,colorSplit:c,lineWidth:u,zIndexPopup:d,borderRadiusLG:f,subMenuItemBorderRadius:p,menuArrowSize:v,menuArrowOffset:C,lineType:m,groupTitleLineHeight:y,groupTitleFontSize:w}=t;return[{"":{[n]:Object.assign(Object.assign({},sA()),{"&-hidden":{display:"none"}})},[`${n}-submenu-hidden`]:{display:"none"}},{[n]:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},zn(t)),sA()),{marginBottom:0,paddingInlineStart:0,fontSize:r,lineHeight:0,listStyle:"none",outline:"none",transition:`width ${i} cubic-bezier(0.2, 0, 0, 1) 0s`,"ul, ol":{margin:0,padding:0,listStyle:"none"},"&-overflow":{display:"flex",[`${n}-item`]:{flex:"none"}},[`${n}-item, ${n}-submenu, ${n}-submenu-title`]:{borderRadius:t.itemBorderRadius},[`${n}-item-group-title`]:{padding:`${ye(s)} ${ye(A)}`,fontSize:w,lineHeight:y,transition:`all ${i}`},[`&-horizontal ${n}-submenu`]:{transition:[`border-color ${i} ${a}`,`background ${i} ${a}`].join(",")},[`${n}-submenu, ${n}-submenu-inline`]:{transition:[`border-color ${i} ${a}`,`background ${i} ${a}`,`padding ${o} ${a}`].join(",")},[`${n}-submenu ${n}-sub`]:{cursor:"initial",transition:[`background ${i} ${a}`,`padding ${i} ${a}`].join(",")},[`${n}-title-content`]:{transition:`color ${i}`,"&-with-extra":{display:"inline-flex",alignItems:"center",width:"100%"},[`> ${e}-typography-ellipsis-single-line`]:{display:"inline",verticalAlign:"unset"},[`${n}-item-extra`]:{marginInlineStart:"auto",paddingInlineStart:t.padding}},[`${n}-item a`]:{"&::before":{position:"absolute",inset:0,backgroundColor:"transparent",content:'""'}},[`${n}-item-divider`]:{overflow:"hidden",lineHeight:0,borderColor:c,borderStyle:m,borderWidth:0,borderTopWidth:u,marginBlock:u,padding:0,"&-dashed":{borderStyle:"dashed"}}}),bm(t)),{[`${n}-item-group`]:{[`${n}-item-group-list`]:{margin:0,padding:0,[`${n}-item, ${n}-submenu-title`]:{paddingInline:`${ye(t.calc(r).mul(2).equal())} ${ye(A)}`}}},"&-submenu":{"&-popup":{position:"absolute",zIndex:d,borderRadius:f,boxShadow:"none",transformOrigin:"0 0",[`&${n}-submenu`]:{background:"transparent"},"&::before":{position:"absolute",inset:0,zIndex:-1,width:"100%",height:"100%",opacity:0,content:'""'},[`> ${n}`]:Object.assign(Object.assign(Object.assign({borderRadius:f},bm(t)),Sm(t)),{[`${n}-item, ${n}-submenu > ${n}-submenu-title`]:{borderRadius:p},[`${n}-submenu-title::after`]:{transition:`transform ${i} ${a}`}})},"\n &-placement-leftTop,\n &-placement-bottomRight,\n ":{transformOrigin:"100% 0"},"\n &-placement-leftBottom,\n &-placement-topRight,\n ":{transformOrigin:"100% 100%"},"\n &-placement-rightBottom,\n &-placement-topLeft,\n ":{transformOrigin:"0 100%"},"\n &-placement-bottomLeft,\n &-placement-rightTop,\n ":{transformOrigin:"0 0"},"\n &-placement-leftTop,\n &-placement-leftBottom\n ":{paddingInlineEnd:t.paddingXS},"\n &-placement-rightTop,\n &-placement-rightBottom\n ":{paddingInlineStart:t.paddingXS},"\n &-placement-topRight,\n &-placement-topLeft\n ":{paddingBottom:t.paddingXS},"\n &-placement-bottomRight,\n &-placement-bottomLeft\n ":{paddingTop:t.paddingXS}}}),Sm(t)),{[`&-inline-collapsed ${n}-submenu-arrow,
624
624
  &-inline ${n}-submenu-arrow`]:{"&::before":{transform:`rotate(-45deg) translateX(${ye(C)})`},"&::after":{transform:`rotate(45deg) translateX(${ye(t.calc(C).mul(-1).equal())})`}},[`${n}-submenu-open${n}-submenu-inline > ${n}-submenu-title > ${n}-submenu-arrow`]:{transform:`translateY(${ye(t.calc(v).mul(.2).mul(-1).equal())})`,"&::after":{transform:`rotate(-45deg) translateX(${ye(t.calc(C).mul(-1).equal())})`},"&::before":{transform:`rotate(45deg) translateX(${ye(C)})`}}})},{[`${e}-layout-header`]:{[n]:{lineHeight:"inherit"}}}]},jM=t=>{var e,n,r;const{colorPrimary:i,colorError:o,colorTextDisabled:a,colorErrorBg:s,colorText:A,colorTextDescription:c,colorBgContainer:u,colorFillAlter:d,colorFillContent:f,lineWidth:p,lineWidthBold:v,controlItemBgActive:C,colorBgTextHover:m,controlHeightLG:y,lineHeight:w,colorBgElevated:I,marginXXS:O,padding:x,fontSize:g,controlHeightSM:M,fontSizeLG:E,colorTextLightSolid:b,colorErrorHover:h}=t,S=(e=t.activeBarWidth)!==null&&e!==void 0?e:0,T=(n=t.activeBarBorderWidth)!==null&&n!==void 0?n:p,R=(r=t.itemMarginInline)!==null&&r!==void 0?r:t.marginXXS,D=new Gt(b).setA(.65).toRgbString();return{dropdownWidth:160,zIndexPopup:t.zIndexPopupBase+50,radiusItem:t.borderRadiusLG,itemBorderRadius:t.borderRadiusLG,radiusSubMenuItem:t.borderRadiusSM,subMenuItemBorderRadius:t.borderRadiusSM,colorItemText:A,itemColor:A,colorItemTextHover:A,itemHoverColor:A,colorItemTextHoverHorizontal:i,horizontalItemHoverColor:i,colorGroupTitle:c,groupTitleColor:c,colorItemTextSelected:i,itemSelectedColor:i,subMenuItemSelectedColor:i,colorItemTextSelectedHorizontal:i,horizontalItemSelectedColor:i,colorItemBg:u,itemBg:u,colorItemBgHover:m,itemHoverBg:m,colorItemBgActive:f,itemActiveBg:C,colorSubItemBg:d,subMenuItemBg:d,colorItemBgSelected:C,itemSelectedBg:C,colorItemBgSelectedHorizontal:"transparent",horizontalItemSelectedBg:"transparent",colorActiveBarWidth:0,activeBarWidth:S,colorActiveBarHeight:v,activeBarHeight:v,colorActiveBarBorderSize:p,activeBarBorderWidth:T,colorItemTextDisabled:a,itemDisabledColor:a,colorDangerItemText:o,dangerItemColor:o,colorDangerItemTextHover:o,dangerItemHoverColor:o,colorDangerItemTextSelected:o,dangerItemSelectedColor:o,colorDangerItemBgActive:s,dangerItemActiveBg:s,colorDangerItemBgSelected:s,dangerItemSelectedBg:s,itemMarginInline:R,horizontalItemBorderRadius:0,horizontalItemHoverBg:"transparent",itemHeight:y,groupTitleLineHeight:w,collapsedWidth:y*2,popupBg:I,itemMarginBlock:O,itemPaddingInline:x,horizontalLineHeight:`${y*1.15}px`,iconSize:g,iconMarginInlineEnd:M-g,collapsedIconSize:E,groupTitleFontSize:g,darkItemDisabledColor:new Gt(b).setA(.25).toRgbString(),darkItemColor:D,darkDangerItemColor:o,darkItemBg:"#001529",darkPopupBg:"#001529",darkSubMenuItemBg:"#000c17",darkItemSelectedColor:b,darkItemSelectedBg:i,darkDangerItemSelectedBg:o,darkItemHoverBg:"transparent",darkGroupTitleColor:D,darkItemHoverColor:b,darkDangerItemHoverColor:h,darkDangerItemSelectedColor:b,darkDangerItemActiveBg:o,itemWidth:S?`calc(100% + ${T}px)`:`calc(100% - ${R*2}px)`}},LM=function(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return Tn("Menu",i=>{const{colorBgElevated:o,controlHeightLG:a,fontSize:s,darkItemColor:A,darkDangerItemColor:c,darkItemBg:u,darkSubMenuItemBg:d,darkItemSelectedColor:f,darkItemSelectedBg:p,darkDangerItemSelectedBg:v,darkItemHoverBg:C,darkGroupTitleColor:m,darkItemHoverColor:y,darkItemDisabledColor:w,darkDangerItemHoverColor:I,darkDangerItemSelectedColor:O,darkDangerItemActiveBg:x,popupBg:g,darkPopupBg:M}=i,E=i.calc(s).div(7).mul(5).equal(),b=zt(i,{menuArrowSize:E,menuHorizontalHeight:i.calc(a).mul(1.15).equal(),menuArrowOffset:i.calc(E).mul(.25).equal(),menuSubMenuBg:o,calc:i.calc,popupBg:g}),h=zt(b,{itemColor:A,itemHoverColor:y,groupTitleColor:m,itemSelectedColor:f,subMenuItemSelectedColor:f,itemBg:u,popupBg:M,subMenuItemBg:d,itemActiveBg:"transparent",itemSelectedBg:p,activeBarHeight:0,activeBarBorderWidth:0,itemHoverBg:C,itemDisabledColor:w,dangerItemColor:c,dangerItemHoverColor:I,dangerItemSelectedColor:O,dangerItemActiveBg:x,dangerItemSelectedBg:v,menuSubMenuBg:d,horizontalItemSelectedColor:f,horizontalItemSelectedBg:p});return[QM(b),FM(b),PM(b),ym(b,"light"),ym(h,"dark"),kM(b),m4(b),zo(b,"slide-up"),zo(b,"slide-down"),Xa(b,"zoom-big")]},jM,{deprecatedTokens:[["colorGroupTitle","groupTitleColor"],["radiusItem","itemBorderRadius"],["radiusSubMenuItem","subMenuItemBorderRadius"],["colorItemText","itemColor"],["colorItemTextHover","itemHoverColor"],["colorItemTextHoverHorizontal","horizontalItemHoverColor"],["colorItemTextSelected","itemSelectedColor"],["colorItemTextSelectedHorizontal","horizontalItemSelectedColor"],["colorItemTextDisabled","itemDisabledColor"],["colorDangerItemText","dangerItemColor"],["colorDangerItemTextHover","dangerItemHoverColor"],["colorDangerItemTextSelected","dangerItemSelectedColor"],["colorDangerItemBgActive","dangerItemActiveBg"],["colorDangerItemBgSelected","dangerItemSelectedBg"],["colorItemBg","itemBg"],["colorItemBgHover","itemHoverBg"],["colorSubItemBg","subMenuItemBg"],["colorItemBgActive","itemActiveBg"],["colorItemBgSelectedHorizontal","horizontalItemSelectedBg"],["colorActiveBarWidth","activeBarWidth"],["colorActiveBarHeight","activeBarHeight"],["colorActiveBarBorderSize","activeBarBorderWidth"],["colorItemBgSelected","itemSelectedBg"]],injectStyle:n,unitless:{groupTitleLineHeight:!0}})(t,e)},$C=t=>{var e;const{popupClassName:n,icon:r,title:i,theme:o}=t,a=l.useContext(TA),{prefixCls:s,inlineCollapsed:A,theme:c}=a,u=ta();let d;if(!r)d=A&&!u.length&&i&&typeof i=="string"?l.createElement("div",{className:`${s}-inline-collapsed-noicon`},i.charAt(0)):l.createElement("span",{className:`${s}-title-content`},i);else{const v=l.isValidElement(i)&&i.type==="span";d=l.createElement(l.Fragment,null,kr(r,{className:Ae(l.isValidElement(r)?(e=r.props)===null||e===void 0?void 0:e.className:"",`${s}-item-icon`)}),v?i:l.createElement("span",{className:`${s}-title-content`},i))}const f=l.useMemo(()=>Object.assign(Object.assign({},a),{firstLevel:!1}),[a]),[p]=ts("Menu");return l.createElement(TA.Provider,{value:f},l.createElement(cs,Object.assign({},tr(t,["icon"]),{title:d,popupClassName:Ae(s,n,`${s}-${o||c}`),popupStyle:Object.assign({zIndex:p},t.popupStyle)})))};var UM=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n};function pl(t){return t===null||t===!1}const HM={item:_C,submenu:$C,divider:YC},GM=N.forwardRef((t,e)=>{var n;const r=l.useContext(NA),i=r||{},{getPrefixCls:o,getPopupContainer:a,direction:s,menu:A}=l.useContext(Qt),c=o(),{prefixCls:u,className:d,style:f,theme:p="light",expandIcon:v,_internalDisableMenuItemTitleTooltip:C,inlineCollapsed:m,siderCollapsed:y,rootClassName:w,mode:I,selectable:O,onClick:x,overflowedIndicatorPopupClassName:g}=t,M=UM(t,["prefixCls","className","style","theme","expandIcon","_internalDisableMenuItemTitleTooltip","inlineCollapsed","siderCollapsed","rootClassName","mode","selectable","onClick","overflowedIndicatorPopupClassName"]),E=tr(M,["collapsedWidth"]);if(process.env.NODE_ENV!=="production"){const U=cn("Menu");process.env.NODE_ENV!=="production"&&U(!("inlineCollapsed"in t&&I!=="inline"),"usage","`inlineCollapsed` should only be used when `mode` is inline."),U.deprecated("items"in t&&!t.children,"children","items")}(n=i.validator)===null||n===void 0||n.call(i,{mode:I});const b=rn(function(){var U;x==null||x.apply(void 0,arguments),(U=i.onClick)===null||U===void 0||U.call(i)}),h=i.mode||I,S=O??i.selectable,T=m??y,R={horizontal:{motionName:`${c}-slide-up`},inline:RR(c),other:{motionName:`${c}-zoom-big`}},D=o("menu",u||i.prefixCls),B=Ur(D),[k,P,H]=LM(D,B,!r),Z=Ae(`${D}-${p}`,A==null?void 0:A.className,d),V=l.useMemo(()=>{var U,$;if(typeof v=="function"||pl(v))return v||null;if(typeof i.expandIcon=="function"||pl(i.expandIcon))return i.expandIcon||null;if(typeof(A==null?void 0:A.expandIcon)=="function"||pl(A==null?void 0:A.expandIcon))return(A==null?void 0:A.expandIcon)||null;const z=(U=v??(i==null?void 0:i.expandIcon))!==null&&U!==void 0?U:A==null?void 0:A.expandIcon;return kr(z,{className:Ae(`${D}-submenu-expand-icon`,l.isValidElement(z)?($=z.props)===null||$===void 0?void 0:$.className:void 0)})},[v,i==null?void 0:i.expandIcon,A==null?void 0:A.expandIcon,D]),q=l.useMemo(()=>({prefixCls:D,inlineCollapsed:T||!1,direction:s,firstLevel:!0,theme:p,mode:h,disableMenuItemTitleTooltip:C}),[D,T,s,C,p]);return k(l.createElement(NA.Provider,{value:null},l.createElement(TA.Provider,{value:q},l.createElement(ls,Object.assign({getPopupContainer:a,overflowedIndicator:l.createElement(wf,null),overflowedIndicatorPopupClassName:Ae(D,`${D}-${p}`,g),mode:h,selectable:S,onClick:b},E,{inlineCollapsed:T,style:Object.assign(Object.assign({},A==null?void 0:A.style),f),className:Z,prefixCls:D,direction:s,defaultMotions:R,expandIcon:V,ref:e,rootClassName:Ae(w,P,i.rootClassName,H,B),_internalComponents:HM})))))}),na=N.forwardRef((t,e)=>{const n=N.useRef(null),r=l.useContext(Sf);return N.useImperativeHandle(e,()=>({menu:n.current,focus:i=>{var o;(o=n.current)===null||o===void 0||o.focus(i)}})),l.createElement(GM,Object.assign({ref:n},t,r))});na.Item=_C;na.SubMenu=$C;na.Divider=YC;na.ItemGroup=vc;process.env.NODE_ENV!=="production"&&(na.displayName="Menu");const ds=t=>{var e;const{menu:n,arrow:r,prefixCls:i,children:o,trigger:a,disabled:s,dropdownRender:A,getPopupContainer:c,overlayClassName:u,rootClassName:d,overlayStyle:f,open:p,onOpenChange:v,visible:C,onVisibleChange:m,mouseEnterDelay:y=.15,mouseLeaveDelay:w=.1,autoAdjustOverflow:I=!0,placement:O="",overlay:x,transitionName:g}=t,{getPopupContainer:M,getPrefixCls:E,direction:b,dropdown:h}=l.useContext(Qt),S=cn("Dropdown");process.env.NODE_ENV!=="production"&&([["visible","open"],["onVisibleChange","onOpenChange"]].forEach(Y=>{let[de,le]=Y;S.deprecated(!(de in t),de,le)}),S.deprecated(!("overlay"in t),"overlay","menu"));const T=l.useMemo(()=>{const Y=E();return g!==void 0?g:O.includes("top")?`${Y}-slide-down`:`${Y}-slide-up`},[E,O,g]),R=l.useMemo(()=>O?O.includes("Center")?O.slice(0,O.indexOf("Center")):O:b==="rtl"?"bottomRight":"bottomLeft",[O,b]);if(process.env.NODE_ENV!=="production"){if(O.includes("Center")){const Y=O.slice(0,O.indexOf("Center"));process.env.NODE_ENV!=="production"&&S(!O.includes("Center"),"deprecated",`You are using '${O}' placement in Dropdown, which is deprecated. Try to use '${Y}' instead.`)}[["visible","open"],["onVisibleChange","onOpenChange"]].forEach(Y=>{let[de,le]=Y;S.deprecated(!(de in t),de,le)})}const D=E("dropdown",i),B=Ur(D),[k,P,H]=W4(D,B),[,Z]=dr(),V=l.Children.only(uO(o)?l.createElement("span",null,o):o),q=kr(V,{className:Ae(`${D}-trigger`,{[`${D}-rtl`]:b==="rtl"},V.props.className),disabled:(e=V.props.disabled)!==null&&e!==void 0?e:s}),U=s?[]:a,$=!!(U!=null&&U.includes("contextMenu")),[z,J]=Fn(!1,{value:p??C}),W=rn(Y=>{v==null||v(Y,{source:"trigger"}),m==null||m(Y),J(Y)}),te=Ae(u,d,P,H,B,h==null?void 0:h.className,{[`${D}-rtl`]:b==="rtl"}),_=OC({arrowPointAtCenter:typeof r=="object"&&r.pointAtCenter,autoAdjustOverflow:I,offset:Z.marginXXS,arrowWidth:r?Z.sizePopupArrow:0,borderRadius:Z.borderRadius}),se=l.useCallback(()=>{n!=null&&n.selectable&&(n!=null&&n.multiple)||(v==null||v(!1,{source:"menu"}),J(!1))},[n==null?void 0:n.selectable,n==null?void 0:n.multiple]),ce=()=>{let Y;return n!=null&&n.items?Y=l.createElement(na,Object.assign({},n)):typeof x=="function"?Y=x():Y=x,A&&(Y=A(Y)),Y=l.Children.only(typeof Y=="string"?l.createElement("span",null,Y):Y),l.createElement(BM,{prefixCls:`${D}-menu`,rootClassName:Ae(H,B),expandIcon:l.createElement("span",{className:`${D}-menu-submenu-arrow`},l.createElement(IA,{className:`${D}-menu-submenu-arrow-icon`})),mode:"vertical",selectable:!1,onClick:se,validator:de=>{let{mode:le}=de;process.env.NODE_ENV!=="production"&&S(!le||le==="vertical","usage",`mode="${le}" is not supported for Dropdown's Menu.`)}},Y)},[ue,ne]=ts("Dropdown",f==null?void 0:f.zIndex);let me=l.createElement(lO,Object.assign({alignPoint:$},tr(t,["rootClassName"]),{mouseEnterDelay:y,mouseLeaveDelay:w,visible:z,builtinPlacements:_,arrow:!!r,overlayClassName:te,prefixCls:D,getPopupContainer:c||M,transitionName:T,trigger:U,overlay:ce,placement:R,onVisibleChange:W,overlayStyle:Object.assign(Object.assign(Object.assign({},h==null?void 0:h.style),f),{zIndex:ue})}),q);return ue&&(me=l.createElement(es.Provider,{value:ne},me)),k(me)},qM=TC(ds,"align",void 0,"dropdown",t=>t),ZM=t=>l.createElement(qM,Object.assign({},t),l.createElement("span",null));ds._InternalPanelDoNotUseOrYouWillBeFired=ZM;process.env.NODE_ENV!=="production"&&(ds.displayName="Dropdown");function wm(t){return["small","middle","large"].includes(t)}function Im(t){return t?typeof t=="number"&&!Number.isNaN(t):!1}const XC=N.createContext({latestIndex:0}),KM=XC.Provider,VM=t=>{let{className:e,index:n,children:r,split:i,style:o}=t;const{latestIndex:a}=l.useContext(XC);return r==null?null:l.createElement(l.Fragment,null,l.createElement("div",{className:e,style:o},r),n<a&&i&&l.createElement("span",{className:`${e}-split`},i))};var zM=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n};const YM=l.forwardRef((t,e)=>{var n;const{getPrefixCls:r,direction:i,size:o,className:a,style:s,classNames:A,styles:c}=Jr("space"),{size:u=o??"small",align:d,className:f,rootClassName:p,children:v,direction:C="horizontal",prefixCls:m,split:y,style:w,wrap:I=!1,classNames:O,styles:x}=t,g=zM(t,["size","align","className","rootClassName","children","direction","prefixCls","split","style","wrap","classNames","styles"]),[M,E]=Array.isArray(u)?u:[u,u],b=wm(E),h=wm(M),S=Im(E),T=Im(M),R=Pr(v,{keepEmpty:!0}),D=d===void 0&&C==="horizontal"?"center":d,B=r("space",m),[k,P,H]=N1(B),Z=Ae(B,a,P,`${B}-${C}`,{[`${B}-rtl`]:i==="rtl",[`${B}-align-${D}`]:D,[`${B}-gap-row-${E}`]:b,[`${B}-gap-col-${M}`]:h},f,p,H),V=Ae(`${B}-item`,(n=O==null?void 0:O.item)!==null&&n!==void 0?n:A.item);let q=0;const U=R.map((J,W)=>{var te;J!=null&&(q=W);const _=(J==null?void 0:J.key)||`${V}-${W}`;return l.createElement(VM,{className:V,key:_,index:W,split:y,style:(te=x==null?void 0:x.item)!==null&&te!==void 0?te:c.item},J)}),$=l.useMemo(()=>({latestIndex:q}),[q]);if(R.length===0)return null;const z={};return I&&(z.flexWrap="wrap"),!h&&T&&(z.columnGap=M),!b&&S&&(z.rowGap=E),k(l.createElement("div",Object.assign({ref:e,className:Z,style:Object.assign(Object.assign(Object.assign({},z),s),w)},g),l.createElement(KM,{value:$},U)))}),Cc=YM;Cc.Compact=b3;process.env.NODE_ENV!=="production"&&(Cc.displayName="Space");var WM=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n};const ey=t=>{const{getPopupContainer:e,getPrefixCls:n,direction:r}=l.useContext(Qt),{prefixCls:i,type:o="default",danger:a,disabled:s,loading:A,onClick:c,htmlType:u,children:d,className:f,menu:p,arrow:v,autoFocus:C,overlay:m,trigger:y,align:w,open:I,onOpenChange:O,placement:x,getPopupContainer:g,href:M,icon:E=l.createElement(wf,null),title:b,buttonsRender:h=_=>_,mouseEnterDelay:S,mouseLeaveDelay:T,overlayClassName:R,overlayStyle:D,destroyPopupOnHide:B,dropdownRender:k}=t,P=WM(t,["prefixCls","type","danger","disabled","loading","onClick","htmlType","children","className","menu","arrow","autoFocus","overlay","trigger","align","open","onOpenChange","placement","getPopupContainer","href","icon","title","buttonsRender","mouseEnterDelay","mouseLeaveDelay","overlayClassName","overlayStyle","destroyPopupOnHide","dropdownRender"]),H=n("dropdown",i),Z=`${H}-button`,V={menu:p,arrow:v,autoFocus:C,align:w,disabled:s,trigger:s?[]:y,onOpenChange:O,getPopupContainer:g||e,mouseEnterDelay:S,mouseLeaveDelay:T,overlayClassName:R,overlayStyle:D,destroyPopupOnHide:B,dropdownRender:k},{compactSize:q,compactItemClassnames:U}=Xo(H,r),$=Ae(Z,U,f);"overlay"in t&&(V.overlay=m),"open"in t&&(V.open=I),"placement"in t?V.placement=x:V.placement=r==="rtl"?"bottomLeft":"bottomRight";const z=l.createElement(Ao,{type:o,danger:a,disabled:s,loading:A,onClick:c,htmlType:u,href:M,title:b},d),J=l.createElement(Ao,{type:o,danger:a,icon:E}),[W,te]=h([z,J]);return l.createElement(Cc.Compact,Object.assign({className:$,size:q,block:!0},P),W,l.createElement(ds,Object.assign({},V),te))};ey.__ANT_BUTTON=!0;const ty=ds;ty.Button=ey;const JM=N.createContext({});var _M={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 01-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z"}}]},name:"check-circle",theme:"filled"},$M=function(e,n){return l.createElement(Nn,Qe({},e,{ref:n,icon:_M}))},xf=l.forwardRef($M);process.env.NODE_ENV!=="production"&&(xf.displayName="CheckCircleFilled");var XM={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-32 232c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V296zm32 440a48.01 48.01 0 010-96 48.01 48.01 0 010 96z"}}]},name:"exclamation-circle",theme:"filled"},eT=function(e,n){return l.createElement(Nn,Qe({},e,{ref:n,icon:XM}))},Rf=l.forwardRef(eT);process.env.NODE_ENV!=="production"&&(Rf.displayName="ExclamationCircleFilled");var tT={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm32 664c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V456c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272zm-32-344a48.01 48.01 0 010-96 48.01 48.01 0 010 96z"}}]},name:"info-circle",theme:"filled"},nT=function(e,n){return l.createElement(Nn,Qe({},e,{ref:n,icon:tT}))},Of=l.forwardRef(nT);process.env.NODE_ENV!=="production"&&(Of.displayName="InfoCircleFilled");var ny=l.forwardRef(function(t,e){var n=t.prefixCls,r=t.style,i=t.className,o=t.duration,a=o===void 0?4.5:o,s=t.showProgress,A=t.pauseOnHover,c=A===void 0?!0:A,u=t.eventKey,d=t.content,f=t.closable,p=t.closeIcon,v=p===void 0?"x":p,C=t.props,m=t.onClick,y=t.onNoticeClose,w=t.times,I=t.hovering,O=l.useState(!1),x=ee(O,2),g=x[0],M=x[1],E=l.useState(0),b=ee(E,2),h=b[0],S=b[1],T=l.useState(0),R=ee(T,2),D=R[0],B=R[1],k=I||g,P=a>0&&s,H=function(){y(u)},Z=function(J){(J.key==="Enter"||J.code==="Enter"||J.keyCode===at.ENTER)&&H()};l.useEffect(function(){if(!k&&a>0){var z=Date.now()-D,J=setTimeout(function(){H()},a*1e3-D);return function(){c&&clearTimeout(J),B(Date.now()-z)}}},[a,k,w]),l.useEffect(function(){if(!k&&P&&(c||D===0)){var z=performance.now(),J,W=function te(){cancelAnimationFrame(J),J=requestAnimationFrame(function(_){var se=_+D-z,ce=Math.min(se/(a*1e3),1);S(ce*100),ce<1&&te()})};return W(),function(){c&&cancelAnimationFrame(J)}}},[a,D,k,P,w]);var V=l.useMemo(function(){return et(f)==="object"&&f!==null?f:f?{closeIcon:v}:{}},[f,v]),q=ki(V,!0),U=100-(!h||h<0?0:h>100?100:h),$="".concat(n,"-notice");return l.createElement("div",Qe({},C,{ref:e,className:Ae($,i,Q({},"".concat($,"-closable"),f)),style:r,onMouseEnter:function(J){var W;M(!0),C==null||(W=C.onMouseEnter)===null||W===void 0||W.call(C,J)},onMouseLeave:function(J){var W;M(!1),C==null||(W=C.onMouseLeave)===null||W===void 0||W.call(C,J)},onClick:m}),l.createElement("div",{className:"".concat($,"-content")},d),f&&l.createElement("a",Qe({tabIndex:0,className:"".concat($,"-close"),onKeyDown:Z,"aria-label":"Close"},q,{onClick:function(J){J.preventDefault(),J.stopPropagation(),H()}}),V.closeIcon),P&&l.createElement("progress",{className:"".concat($,"-progress"),max:"100",value:U},U+"%"))}),ry=N.createContext({}),rT=function(e){var n=e.children,r=e.classNames;return N.createElement(ry.Provider,{value:{classNames:r}},n)},xm=8,Rm=3,Om=16,iT=function(e){var n={offset:xm,threshold:Rm,gap:Om};if(e&&et(e)==="object"){var r,i,o;n.offset=(r=e.offset)!==null&&r!==void 0?r:xm,n.threshold=(i=e.threshold)!==null&&i!==void 0?i:Rm,n.gap=(o=e.gap)!==null&&o!==void 0?o:Om}return[!!e,n]},oT=["className","style","classNames","styles"],iy=function(e){var n=e.configList,r=e.placement,i=e.prefixCls,o=e.className,a=e.style,s=e.motion,A=e.onAllNoticeRemoved,c=e.onNoticeClose,u=e.stack,d=N.useContext(ry),f=d.classNames,p=N.useRef({}),v=N.useState(null),C=ee(v,2),m=C[0],y=C[1],w=N.useState([]),I=ee(w,2),O=I[0],x=I[1],g=n.map(function(k){return{config:k,key:String(k.key)}}),M=iT(u),E=ee(M,2),b=E[0],h=E[1],S=h.offset,T=h.threshold,R=h.gap,D=b&&(O.length>0||g.length<=T),B=typeof s=="function"?s(r):s;return N.useEffect(function(){b&&O.length>1&&x(function(k){return k.filter(function(P){return g.some(function(H){var Z=H.key;return P===Z})})})},[O,g,b]),N.useEffect(function(){var k;if(b&&p.current[(k=g[g.length-1])===null||k===void 0?void 0:k.key]){var P;y(p.current[(P=g[g.length-1])===null||P===void 0?void 0:P.key])}},[g,b]),N.createElement(MS,Qe({key:r,className:Ae(i,"".concat(i,"-").concat(r),f==null?void 0:f.list,o,Q(Q({},"".concat(i,"-stack"),!!b),"".concat(i,"-stack-expanded"),D)),style:a,keys:g,motionAppear:!0},B,{onAllRemoved:function(){A(r)}}),function(k,P){var H=k.config,Z=k.className,V=k.style,q=k.index,U=H,$=U.key,z=U.times,J=String($),W=H,te=W.className,_=W.style,se=W.classNames,ce=W.styles,ue=Et(W,oT),ne=g.findIndex(function(pe){return pe.key===J}),me={};if(b){var Y=g.length-1-(ne>-1?ne:q-1),de=r==="top"||r==="bottom"?"-50%":"0";if(Y>0){var le,Se,xe;me.height=D?(le=p.current[J])===null||le===void 0?void 0:le.offsetHeight:m==null?void 0:m.offsetHeight;for(var Ce=0,De=0;De<Y;De++){var je;Ce+=((je=p.current[g[g.length-1-De].key])===null||je===void 0?void 0:je.offsetHeight)+R}var Le=(D?Ce:Y*S)*(r.startsWith("top")?1:-1),Ie=!D&&m!==null&&m!==void 0&&m.offsetWidth&&(Se=p.current[J])!==null&&Se!==void 0&&Se.offsetWidth?((m==null?void 0:m.offsetWidth)-S*2*(Y<3?Y:3))/((xe=p.current[J])===null||xe===void 0?void 0:xe.offsetWidth):1;me.transform="translate3d(".concat(de,", ").concat(Le,"px, 0) scaleX(").concat(Ie,")")}else me.transform="translate3d(".concat(de,", 0, 0)")}return N.createElement("div",{ref:P,className:Ae("".concat(i,"-notice-wrapper"),Z,se==null?void 0:se.wrapper),style:L(L(L({},V),me),ce==null?void 0:ce.wrapper),onMouseEnter:function(){return x(function(Oe){return Oe.includes(J)?Oe:[].concat(Re(Oe),[J])})},onMouseLeave:function(){return x(function(Oe){return Oe.filter(function(Ze){return Ze!==J})})}},N.createElement(ny,Qe({},ue,{ref:function(Oe){ne>-1?p.current[J]=Oe:delete p.current[J]},prefixCls:i,classNames:se,styles:ce,className:Ae(te,f==null?void 0:f.notice),style:_,times:z,key:$,eventKey:$,onNoticeClose:c,hovering:b&&O.length>0})))})};process.env.NODE_ENV!=="production"&&(iy.displayName="NoticeList");var oy=l.forwardRef(function(t,e){var n=t.prefixCls,r=n===void 0?"rc-notification":n,i=t.container,o=t.motion,a=t.maxCount,s=t.className,A=t.style,c=t.onAllRemoved,u=t.stack,d=t.renderNotifications,f=l.useState([]),p=ee(f,2),v=p[0],C=p[1],m=function(b){var h,S=v.find(function(T){return T.key===b});S==null||(h=S.onClose)===null||h===void 0||h.call(S),C(function(T){return T.filter(function(R){return R.key!==b})})};l.useImperativeHandle(e,function(){return{open:function(b){C(function(h){var S=Re(h),T=S.findIndex(function(B){return B.key===b.key}),R=L({},b);if(T>=0){var D;R.times=(((D=h[T])===null||D===void 0?void 0:D.times)||0)+1,S[T]=R}else R.times=0,S.push(R);return a>0&&S.length>a&&(S=S.slice(-a)),S})},close:function(b){m(b)},destroy:function(){C([])}}});var y=l.useState({}),w=ee(y,2),I=w[0],O=w[1];l.useEffect(function(){var E={};v.forEach(function(b){var h=b.placement,S=h===void 0?"topRight":h;S&&(E[S]=E[S]||[],E[S].push(b))}),Object.keys(I).forEach(function(b){E[b]=E[b]||[]}),O(E)},[v]);var x=function(b){O(function(h){var S=L({},h),T=S[b]||[];return T.length||delete S[b],S})},g=l.useRef(!1);if(l.useEffect(function(){Object.keys(I).length>0?g.current=!0:g.current&&(c==null||c(),g.current=!1)},[I]),!i)return null;var M=Object.keys(I);return Wr.createPortal(l.createElement(l.Fragment,null,M.map(function(E){var b=I[E],h=l.createElement(iy,{key:E,configList:b,placement:E,prefixCls:r,className:s==null?void 0:s(E),style:A==null?void 0:A(E),motion:o,onNoticeClose:m,onAllNoticeRemoved:x,stack:u});return d?d(h,{prefixCls:r,key:E}):h})),i)});process.env.NODE_ENV!=="production"&&(oy.displayName="Notifications");var aT=["getContainer","motion","prefixCls","maxCount","className","style","onAllRemoved","stack","renderNotifications"],sT=function(){return document.body},Mm=0;function AT(){for(var t={},e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return n.forEach(function(i){i&&Object.keys(i).forEach(function(o){var a=i[o];a!==void 0&&(t[o]=a)})}),t}function cT(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=t.getContainer,n=e===void 0?sT:e,r=t.motion,i=t.prefixCls,o=t.maxCount,a=t.className,s=t.style,A=t.onAllRemoved,c=t.stack,u=t.renderNotifications,d=Et(t,aT),f=l.useState(),p=ee(f,2),v=p[0],C=p[1],m=l.useRef(),y=l.createElement(oy,{container:v,ref:m,prefixCls:i,motion:r,maxCount:o,className:a,style:s,onAllRemoved:A,stack:c,renderNotifications:u}),w=l.useState([]),I=ee(w,2),O=I[0],x=I[1],g=rn(function(E){var b=AT(d,E);(b.key===null||b.key===void 0)&&(b.key="rc-notification-".concat(Mm),Mm+=1),x(function(h){return[].concat(Re(h),[{type:"open",config:b}])})}),M=l.useMemo(function(){return{open:g,close:function(b){x(function(h){return[].concat(Re(h),[{type:"close",key:b}])})},destroy:function(){x(function(b){return[].concat(Re(b),[{type:"destroy"}])})}}},[]);return l.useEffect(function(){C(n())}),l.useEffect(function(){if(m.current&&O.length){O.forEach(function(h){switch(h.type){case"open":m.current.open(h.config);break;case"close":m.current.close(h.key);break;case"destroy":m.current.destroy();break}});var E,b;x(function(h){return(E!==h||!b)&&(E=h,b=h.filter(function(S){return!O.includes(S)})),b})}},[O]),[M,y]}var lT=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n};const uT={info:l.createElement(Of,null),success:l.createElement(xf,null),error:l.createElement(as,null),warning:l.createElement(Rf,null),loading:l.createElement(ac,null)},ay=t=>{let{prefixCls:e,type:n,icon:r,children:i}=t;return l.createElement("div",{className:Ae(`${e}-custom-content`,`${e}-${n}`)},r||uT[n],l.createElement("span",null,i))},dT=t=>{const{prefixCls:e,className:n,type:r,icon:i,content:o}=t,a=lT(t,["prefixCls","className","type","icon","content"]),{getPrefixCls:s}=l.useContext(Qt),A=e||s("message"),c=Ur(A),[u,d,f]=I1(A,c);return u(l.createElement(ny,Object.assign({},a,{prefixCls:A,className:Ae(n,d,`${A}-notice-pure-panel`,f,c),eventKey:"pure",duration:null,content:l.createElement(ay,{prefixCls:A,type:r,icon:i},o)})))};var fT={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M799.86 166.31c.02 0 .04.02.08.06l57.69 57.7c.04.03.05.05.06.08a.12.12 0 010 .06c0 .03-.02.05-.06.09L569.93 512l287.7 287.7c.04.04.05.06.06.09a.12.12 0 010 .07c0 .02-.02.04-.06.08l-57.7 57.69c-.03.04-.05.05-.07.06a.12.12 0 01-.07 0c-.03 0-.05-.02-.09-.06L512 569.93l-287.7 287.7c-.04.04-.06.05-.09.06a.12.12 0 01-.07 0c-.02 0-.04-.02-.08-.06l-57.69-57.7c-.04-.03-.05-.05-.06-.07a.12.12 0 010-.07c0-.03.02-.05.06-.09L454.07 512l-287.7-287.7c-.04-.04-.05-.06-.06-.09a.12.12 0 010-.07c0-.02.02-.04.06-.08l57.7-57.69c.03-.04.05-.05.07-.06a.12.12 0 01.07 0c.03 0 .05.02.09.06L512 454.07l287.7-287.7c.04-.04.06-.05.09-.06a.12.12 0 01.07 0z"}}]},name:"close",theme:"outlined"},gT=function(e,n){return l.createElement(Nn,Qe({},e,{ref:n,icon:fT}))},yc=l.forwardRef(gT);process.env.NODE_ENV!=="production"&&(yc.displayName="CloseOutlined");function hT(t,e){return{motionName:e??`${t}-move-up`}}function Mf(t){let e;const n=new Promise(i=>{e=t(()=>{i(!0)})}),r=()=>{e==null||e()};return r.then=(i,o)=>n.then(i,o),r.promise=n,r}var pT=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n};const mT=8,vT=3,CT=t=>{let{children:e,prefixCls:n}=t;const r=Ur(n),[i,o,a]=I1(n,r);return i(l.createElement(rT,{classNames:{list:Ae(o,a,r)}},e))},yT=(t,e)=>{let{prefixCls:n,key:r}=e;return l.createElement(CT,{prefixCls:n,key:r},t)},ET=l.forwardRef((t,e)=>{const{top:n,prefixCls:r,getContainer:i,maxCount:o,duration:a=vT,rtl:s,transitionName:A,onAllRemoved:c}=t,{getPrefixCls:u,getPopupContainer:d,message:f,direction:p}=l.useContext(Qt),v=r||u("message"),C=()=>({left:"50%",transform:"translateX(-50%)",top:n??mT}),m=()=>Ae({[`${v}-rtl`]:s??p==="rtl"}),y=()=>hT(v,A),w=l.createElement("span",{className:`${v}-close-x`},l.createElement(yc,{className:`${v}-close-icon`})),[I,O]=cT({prefixCls:v,style:C,className:m,motion:y,closable:!1,closeIcon:w,duration:a,getContainer:()=>(i==null?void 0:i())||(d==null?void 0:d())||document.body,maxCount:o,onAllRemoved:c,renderNotifications:yT});return l.useImperativeHandle(e,()=>Object.assign(Object.assign({},I),{prefixCls:v,message:f})),O});let Tm=0;function sy(t){const e=l.useRef(null),n=cn("Message");return[l.useMemo(()=>{const i=c=>{var u;(u=e.current)===null||u===void 0||u.close(c)},o=c=>{if(!e.current){process.env.NODE_ENV!=="production"&&n(!1,"usage","You are calling notice in render which will break in React 18 concurrent mode. Please trigger in effect instead.");const M=()=>{};return M.then=()=>{},M}const{open:u,prefixCls:d,message:f}=e.current,p=`${d}-notice`,{content:v,icon:C,type:m,key:y,className:w,style:I,onClose:O}=c,x=pT(c,["content","icon","type","key","className","style","onClose"]);let g=y;return g==null&&(Tm+=1,g=`antd-message-${Tm}`),Mf(M=>(u(Object.assign(Object.assign({},x),{key:g,content:l.createElement(ay,{prefixCls:d,type:m,icon:C},v),placement:"top",className:Ae(m&&`${p}-${m}`,w,f==null?void 0:f.className),style:Object.assign(Object.assign({},f==null?void 0:f.style),I),onClose:()=>{O==null||O(),M()}})),()=>{i(g)}))},s={open:o,destroy:c=>{var u;c!==void 0?i(c):(u=e.current)===null||u===void 0||u.destroy()}};return["info","success","warning","error","loading"].forEach(c=>{const u=(d,f,p)=>{let v;d&&typeof d=="object"&&"content"in d?v=d:v={content:d};let C,m;typeof f=="function"?m=f:(C=f,m=p);const y=Object.assign(Object.assign({onClose:m,duration:C},v),{type:c});return o(y)};s[c]=u}),s},[]),l.createElement(ET,Object.assign({key:"message-holder"},t,{ref:e}))]}function bT(t){return sy(t)}let br=null,_i=t=>t(),qa=[],Za={};function Nm(){const{getContainer:t,duration:e,rtl:n,maxCount:r,top:i}=Za,o=(t==null?void 0:t())||document.body;return{getContainer:()=>o,duration:e,rtl:n,maxCount:r,top:i}}const ST=N.forwardRef((t,e)=>{const{messageConfig:n,sync:r}=t,{getPrefixCls:i}=N.useContext(Qt),o=Za.prefixCls||i("message"),a=N.useContext(JM),[s,A]=sy(Object.assign(Object.assign(Object.assign({},n),{prefixCls:o}),a.message));return N.useImperativeHandle(e,()=>{const c=Object.assign({},s);return Object.keys(c).forEach(u=>{c[u]=function(){return r(),s[u].apply(s,arguments)}}),{instance:c,sync:r}}),A}),wT=N.forwardRef((t,e)=>{const[n,r]=N.useState(Nm),i=()=>{r(Nm)};N.useEffect(i,[]);const o=Gd(),a=o.getRootPrefixCls(),s=o.getIconPrefixCls(),A=o.getTheme(),c=N.createElement(ST,{ref:e,sync:i,messageConfig:n});return N.createElement(_r,{prefixCls:a,iconPrefixCls:s,theme:A},o.holderRender?o.holderRender(c):c)});function Ec(){if(!br){const t=document.createDocumentFragment(),e={fragment:t};br=e,_i(()=>{uf()(N.createElement(wT,{ref:r=>{const{instance:i,sync:o}=r||{};Promise.resolve().then(()=>{!e.instance&&i&&(e.instance=i,e.sync=o,Ec())})}}),t)});return}br.instance&&(qa.forEach(t=>{const{type:e,skipped:n}=t;if(!n)switch(e){case"open":{_i(()=>{const r=br.instance.open(Object.assign(Object.assign({},Za),t.config));r==null||r.then(t.resolve),t.setCloseFn(r)});break}case"destroy":_i(()=>{br==null||br.instance.destroy(t.key)});break;default:_i(()=>{var r;const i=(r=br.instance)[e].apply(r,Re(t.args));i==null||i.then(t.resolve),t.setCloseFn(i)})}}),qa=[])}function IT(t){Za=Object.assign(Object.assign({},Za),t),_i(()=>{var e;(e=br==null?void 0:br.sync)===null||e===void 0||e.call(br)})}function xT(t){const e=Mf(n=>{let r;const i={type:"open",config:t,resolve:n,setCloseFn:o=>{r=o}};return qa.push(i),()=>{r?_i(()=>{r()}):i.skipped=!0}});return Ec(),e}function RT(t,e){const n=Gd();process.env.NODE_ENV!=="production"&&!n.holderRender&&s0("message");const r=Mf(i=>{let o;const a={type:t,args:e,resolve:i,setCloseFn:s=>{o=s}};return qa.push(a),()=>{o?_i(()=>{o()}):a.skipped=!0}});return Ec(),r}const OT=t=>{qa.push({type:"destroy",key:t}),Ec()},MT=["success","info","warning","error","loading"],TT={open:xT,destroy:OT,config:IT,useMessage:bT,_InternalPanelDoNotUseOrYouWillBeFired:dT},It=TT;MT.forEach(t=>{It[t]=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return RT(t,n)}});process.env.NODE_ENV;process.env.NODE_ENV;const DA=t=>t?typeof t=="function"?t():t:null;var NT=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n};const Ay=t=>{let{title:e,content:n,prefixCls:r}=t;return!e&&!n?null:l.createElement(l.Fragment,null,e&&l.createElement("div",{className:`${r}-title`},e),n&&l.createElement("div",{className:`${r}-inner-content`},n))},DT=t=>{const{hashId:e,prefixCls:n,className:r,style:i,placement:o="top",title:a,content:s,children:A}=t,c=DA(a),u=DA(s),d=Ae(e,n,`${n}-pure`,`${n}-placement-${o}`,r);return l.createElement("div",{className:d,style:i},l.createElement("div",{className:`${n}-arrow`}),l.createElement(If,Object.assign({},t,{className:e,prefixCls:n}),A||l.createElement(Ay,{prefixCls:n,title:c,content:u})))},BT=t=>{const{prefixCls:e,className:n}=t,r=NT(t,["prefixCls","className"]),{getPrefixCls:i}=l.useContext(Qt),o=i("popover",e),[a,s,A]=x1(o);return a(l.createElement(DT,Object.assign({},r,{prefixCls:o,hashId:s,className:Ae(n,A)})))};var FT=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n};const kT=l.forwardRef((t,e)=>{var n,r;const{prefixCls:i,title:o,content:a,overlayClassName:s,placement:A="top",trigger:c="hover",children:u,mouseEnterDelay:d=.1,mouseLeaveDelay:f=.1,onOpenChange:p,overlayStyle:v={},styles:C,classNames:m}=t,y=FT(t,["prefixCls","title","content","overlayClassName","placement","trigger","children","mouseEnterDelay","mouseLeaveDelay","onOpenChange","overlayStyle","styles","classNames"]),{getPrefixCls:w,className:I,style:O,classNames:x,styles:g}=Jr("popover"),M=w("popover",i),[E,b,h]=x1(M),S=w(),T=Ae(s,b,h,I,x.root,m==null?void 0:m.root),R=Ae(x.body,m==null?void 0:m.body),[D,B]=Fn(!1,{value:(n=t.open)!==null&&n!==void 0?n:t.visible,defaultValue:(r=t.defaultOpen)!==null&&r!==void 0?r:t.defaultVisible}),k=(q,U)=>{B(q,!0),p==null||p(q,U)},P=q=>{q.keyCode===at.ESC&&k(!1,q)},H=q=>{k(q)},Z=DA(o),V=DA(a);return E(l.createElement(us,Object.assign({placement:A,trigger:c,mouseEnterDelay:d,mouseLeaveDelay:f},y,{prefixCls:M,classNames:{root:T,body:R},styles:{root:Object.assign(Object.assign(Object.assign(Object.assign({},g.root),O),v),C==null?void 0:C.root),body:Object.assign(Object.assign({},g.body),C==null?void 0:C.body)},ref:e,open:D,onOpenChange:H,overlay:Z||V?l.createElement(Ay,{prefixCls:M,title:Z,content:V}):null,transitionName:sc(S,"zoom-big",y.transitionName),"data-popover-inject":!0}),kr(u,{onKeyDown:q=>{var U,$;l.isValidElement(u)&&(($=u==null?void 0:(U=u.props).onKeyDown)===null||$===void 0||$.call(U,q)),P(q)}})))}),No=kT;No._InternalPanelDoNotUseOrYouWillBeFired=BT;process.env.NODE_ENV!=="production"&&(No.displayName="Popover");var bc=function(e){var n=e.className,r=e.customizeIcon,i=e.customizeIconProps,o=e.children,a=e.onMouseDown,s=e.onClick,A=typeof r=="function"?r(i):r;return l.createElement("span",{className:n,onMouseDown:function(u){u.preventDefault(),a==null||a(u)},style:{userSelect:"none",WebkitUserSelect:"none"},unselectable:"on",onClick:s,"aria-hidden":!0},A!==void 0?A:l.createElement("span",{className:Ae(n.split(/\s+/).map(function(c){return"".concat(c,"-icon")}))},o))},PT=function(e,n,r,i,o){var a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!1,s=arguments.length>6?arguments[6]:void 0,A=arguments.length>7?arguments[7]:void 0,c=N.useMemo(function(){if(et(i)==="object")return i.clearIcon;if(o)return o},[i,o]),u=N.useMemo(function(){return!!(!a&&i&&(r.length||s)&&!(A==="combobox"&&s===""))},[i,a,r.length,s,A]);return{allowClear:u,clearIcon:N.createElement(bc,{className:"".concat(e,"-clear"),onMouseDown:n,customizeIcon:c},"×")}},cy=l.createContext(null);function QT(){return l.useContext(cy)}function jT(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:10,e=l.useState(!1),n=ee(e,2),r=n[0],i=n[1],o=l.useRef(null),a=function(){window.clearTimeout(o.current)};l.useEffect(function(){return a},[]);var s=function(c,u){a(),o.current=window.setTimeout(function(){i(c),u&&u()},t)};return[r,s,a]}function ly(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:250,e=l.useRef(null),n=l.useRef(null);l.useEffect(function(){return function(){window.clearTimeout(n.current)}},[]);function r(i){(i||e.current===null)&&(e.current=i),window.clearTimeout(n.current),n.current=window.setTimeout(function(){e.current=null},t)}return[function(){return e.current},r]}function LT(t,e,n,r){var i=l.useRef(null);i.current={open:e,triggerOpen:n,customizedTrigger:r},l.useEffect(function(){function o(a){var s;if(!((s=i.current)!==null&&s!==void 0&&s.customizedTrigger)){var A=a.target;A.shadowRoot&&a.composed&&(A=a.composedPath()[0]||A),i.current.open&&t().filter(function(c){return c}).every(function(c){return!c.contains(A)&&c!==A})&&i.current.triggerOpen(!1)}}return window.addEventListener("mousedown",o),function(){return window.removeEventListener("mousedown",o)}},[])}function UT(t){return t&&![at.ESC,at.SHIFT,at.BACKSPACE,at.TAB,at.WIN_KEY,at.ALT,at.META,at.WIN_KEY_RIGHT,at.CTRL,at.SEMICOLON,at.EQUALS,at.CAPS_LOCK,at.CONTEXT_MENU,at.F1,at.F2,at.F3,at.F4,at.F5,at.F6,at.F7,at.F8,at.F9,at.F10,at.F11,at.F12].includes(t)}function HT(t,e,n){var r=L(L({},t),e);return Object.keys(e).forEach(function(i){var o=e[i];typeof o=="function"&&(r[i]=function(){for(var a,s=arguments.length,A=new Array(s),c=0;c<s;c++)A[c]=arguments[c];return o.apply(void 0,A),(a=t[i])===null||a===void 0?void 0:a.call.apply(a,[t].concat(A))})}),r}var GT=["prefixCls","id","inputElement","autoFocus","autoComplete","editable","activeDescendantId","value","open","attrs"],qT=function(e,n){var r=e.prefixCls,i=e.id,o=e.inputElement,a=e.autoFocus,s=e.autoComplete,A=e.editable,c=e.activeDescendantId,u=e.value,d=e.open,f=e.attrs,p=Et(e,GT),v=o||l.createElement("input",null),C=v,m=C.ref,y=C.props;return Di(!("maxLength"in v.props),"Passing 'maxLength' to input element directly may not work because input in BaseSelect is controlled."),v=l.cloneElement(v,L(L(L({type:"search"},HT(p,y)),{},{id:i,ref:Lr(n,m),autoComplete:s||"off",autoFocus:a,className:Ae("".concat(r,"-selection-search-input"),y==null?void 0:y.className),role:"combobox","aria-expanded":d||!1,"aria-haspopup":"listbox","aria-owns":"".concat(i,"_list"),"aria-autocomplete":"list","aria-controls":"".concat(i,"_list"),"aria-activedescendant":d?c:void 0},f),{},{value:A?u:"",readOnly:!A,unselectable:A?null:"on",style:L(L({},y.style),{},{opacity:A?null:0})})),v},Tf=l.forwardRef(qT);process.env.NODE_ENV!=="production"&&(Tf.displayName="Input");function Nf(t){return Array.isArray(t)?t:t!==void 0?[t]:[]}var ZT=typeof window<"u"&&window.document&&window.document.documentElement,KT=process.env.NODE_ENV!=="test"&&ZT;function VT(t){return t!=null}function zT(t){return!t&&t!==0}function Dm(t){return["string","number"].includes(et(t))}function uy(t){var e=void 0;return t&&(Dm(t.title)?e=t.title.toString():Dm(t.label)&&(e=t.label.toString())),e}function YT(t,e){KT?l.useLayoutEffect(t,e):l.useEffect(t,e)}function WT(t){var e;return(e=t.key)!==null&&e!==void 0?e:t.value}var Bm=function(e){e.preventDefault(),e.stopPropagation()},JT=function(e){var n=e.id,r=e.prefixCls,i=e.values,o=e.open,a=e.searchValue,s=e.autoClearSearchValue,A=e.inputRef,c=e.placeholder,u=e.disabled,d=e.mode,f=e.showSearch,p=e.autoFocus,v=e.autoComplete,C=e.activeDescendantId,m=e.tabIndex,y=e.removeIcon,w=e.maxTagCount,I=e.maxTagTextLength,O=e.maxTagPlaceholder,x=O===void 0?function(Y){return"+ ".concat(Y.length," ...")}:O,g=e.tagRender,M=e.onToggleOpen,E=e.onRemove,b=e.onInputChange,h=e.onInputPaste,S=e.onInputKeyDown,T=e.onInputMouseDown,R=e.onInputCompositionStart,D=e.onInputCompositionEnd,B=e.onInputBlur,k=l.useRef(null),P=N.useState(0),H=ee(P,2),Z=H[0],V=H[1],q=N.useState(!1),U=ee(q,2),$=U[0],z=U[1],J="".concat(r,"-selection"),W=o||d==="multiple"&&s===!1||d==="tags"?a:"",te=d==="tags"||d==="multiple"&&s===!1||f&&(o||$);YT(function(){V(k.current.scrollWidth)},[W]);var _=function(de,le,Se,xe,Ce){return l.createElement("span",{title:uy(de),className:Ae("".concat(J,"-item"),Q({},"".concat(J,"-item-disabled"),Se))},l.createElement("span",{className:"".concat(J,"-item-content")},le),xe&&l.createElement(bc,{className:"".concat(J,"-item-remove"),onMouseDown:Bm,onClick:Ce,customizeIcon:y},"×"))},se=function(de,le,Se,xe,Ce,De){var je=function(Ie){Bm(Ie),M(!o)};return l.createElement("span",{onMouseDown:je},g({label:le,value:de,disabled:Se,closable:xe,onClose:Ce,isMaxTag:!!De}))},ce=function(de){var le=de.disabled,Se=de.label,xe=de.value,Ce=!u&&!le,De=Se;if(typeof I=="number"&&(typeof Se=="string"||typeof Se=="number")){var je=String(De);je.length>I&&(De="".concat(je.slice(0,I),"..."))}var Le=function(pe){pe&&pe.stopPropagation(),E(de)};return typeof g=="function"?se(xe,De,le,Ce,Le):_(de,De,le,Ce,Le)},ue=function(de){if(!i.length)return null;var le=typeof x=="function"?x(de):x;return typeof g=="function"?se(void 0,le,!1,!1,void 0,!0):_({title:le},le,!1)},ne=l.createElement("div",{className:"".concat(J,"-search"),style:{width:Z},onFocus:function(){z(!0)},onBlur:function(){z(!1)}},l.createElement(Tf,{ref:A,open:o,prefixCls:r,id:n,inputElement:null,disabled:u,autoFocus:p,autoComplete:v,editable:te,activeDescendantId:C,value:W,onKeyDown:S,onMouseDown:T,onChange:b,onPaste:h,onCompositionStart:R,onCompositionEnd:D,onBlur:B,tabIndex:m,attrs:ki(e,!0)}),l.createElement("span",{ref:k,className:"".concat(J,"-search-mirror"),"aria-hidden":!0},W," ")),me=l.createElement(Yr,{prefixCls:"".concat(J,"-overflow"),data:i,renderItem:ce,renderRest:ue,suffix:ne,itemKey:WT,maxCount:w});return l.createElement("span",{className:"".concat(J,"-wrap")},me,!i.length&&!W&&l.createElement("span",{className:"".concat(J,"-placeholder")},c))},_T=function(e){var n=e.inputElement,r=e.prefixCls,i=e.id,o=e.inputRef,a=e.disabled,s=e.autoFocus,A=e.autoComplete,c=e.activeDescendantId,u=e.mode,d=e.open,f=e.values,p=e.placeholder,v=e.tabIndex,C=e.showSearch,m=e.searchValue,y=e.activeValue,w=e.maxLength,I=e.onInputKeyDown,O=e.onInputMouseDown,x=e.onInputChange,g=e.onInputPaste,M=e.onInputCompositionStart,E=e.onInputCompositionEnd,b=e.onInputBlur,h=e.title,S=l.useState(!1),T=ee(S,2),R=T[0],D=T[1],B=u==="combobox",k=B||C,P=f[0],H=m||"";B&&y&&!R&&(H=y),l.useEffect(function(){B&&D(!1)},[B,y]);var Z=u!=="combobox"&&!d&&!C?!1:!!H,V=h===void 0?uy(P):h,q=l.useMemo(function(){return P?null:l.createElement("span",{className:"".concat(r,"-selection-placeholder"),style:Z?{visibility:"hidden"}:void 0},p)},[P,Z,p,r]);return l.createElement("span",{className:"".concat(r,"-selection-wrap")},l.createElement("span",{className:"".concat(r,"-selection-search")},l.createElement(Tf,{ref:o,prefixCls:r,id:i,open:d,inputElement:n,disabled:a,autoFocus:s,autoComplete:A,editable:k,activeDescendantId:c,value:H,onKeyDown:I,onMouseDown:O,onChange:function($){D(!0),x($)},onPaste:g,onCompositionStart:M,onCompositionEnd:E,onBlur:b,tabIndex:v,attrs:ki(e,!0),maxLength:B?w:void 0})),!B&&P?l.createElement("span",{className:"".concat(r,"-selection-item"),title:V,style:Z?{visibility:"hidden"}:void 0},P.label):null,q)},$T=function(e,n){var r=N.useRef(null),i=N.useRef(!1),o=e.prefixCls,a=e.open,s=e.mode,A=e.showSearch,c=e.tokenWithEnter,u=e.disabled,d=e.prefix,f=e.autoClearSearchValue,p=e.onSearch,v=e.onSearchSubmit,C=e.onToggleOpen,m=e.onInputKeyDown,y=e.onInputBlur,w=e.domRef;l.useImperativeHandle(n,function(){return{focus:function(V){r.current.focus(V)},blur:function(){r.current.blur()}}});var I=ly(0),O=ee(I,2),x=O[0],g=O[1],M=function(V){var q=V.which,U=r.current instanceof HTMLTextAreaElement;!U&&a&&(q===at.UP||q===at.DOWN)&&V.preventDefault(),m&&m(V),q===at.ENTER&&s==="tags"&&!i.current&&!a&&(v==null||v(V.target.value)),!(U&&!a&&~[at.UP,at.DOWN,at.LEFT,at.RIGHT].indexOf(q))&&UT(q)&&C(!0)},E=function(){g(!0)},b=N.useRef(null),h=function(V){p(V,!0,i.current)!==!1&&C(!0)},S=function(){i.current=!0},T=function(V){i.current=!1,s!=="combobox"&&h(V.target.value)},R=function(V){var q=V.target.value;if(c&&b.current&&/[\r\n]/.test(b.current)){var U=b.current.replace(/[\r\n]+$/,"").replace(/\r\n/g," ").replace(/[\r\n]/g," ");q=q.replace(U,b.current)}b.current=null,h(q)},D=function(V){var q=V.clipboardData,U=q==null?void 0:q.getData("text");b.current=U||""},B=function(V){var q=V.target;if(q!==r.current){var U=document.body.style.msTouchAction!==void 0;U?setTimeout(function(){r.current.focus()}):r.current.focus()}},k=function(V){var q=x();V.target!==r.current&&!q&&!(s==="combobox"&&u)&&V.preventDefault(),(s!=="combobox"&&(!A||!q)||!a)&&(a&&f!==!1&&p("",!0,!1),C())},P={inputRef:r,onInputKeyDown:M,onInputMouseDown:E,onInputChange:R,onInputPaste:D,onInputCompositionStart:S,onInputCompositionEnd:T,onInputBlur:y},H=s==="multiple"||s==="tags"?l.createElement(JT,Qe({},e,P)):l.createElement(_T,Qe({},e,P));return l.createElement("div",{ref:w,className:"".concat(o,"-selector"),onClick:B,onMouseDown:k},d&&l.createElement("div",{className:"".concat(o,"-prefix")},d),H)},dy=l.forwardRef($T);process.env.NODE_ENV!=="production"&&(dy.displayName="Selector");var XT=["prefixCls","disabled","visible","children","popupElement","animation","transitionName","dropdownStyle","dropdownClassName","direction","placement","builtinPlacements","dropdownMatchSelectWidth","dropdownRender","dropdownAlign","getPopupContainer","empty","getTriggerDOMNode","onPopupVisibleChange","onPopupMouseEnter"],e8=function(e){var n=e===!0?0:1;return{bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:n,adjustY:1},htmlRegion:"scroll"},bottomRight:{points:["tr","br"],offset:[0,4],overflow:{adjustX:n,adjustY:1},htmlRegion:"scroll"},topLeft:{points:["bl","tl"],offset:[0,-4],overflow:{adjustX:n,adjustY:1},htmlRegion:"scroll"},topRight:{points:["br","tr"],offset:[0,-4],overflow:{adjustX:n,adjustY:1},htmlRegion:"scroll"}}},t8=function(e,n){var r=e.prefixCls;e.disabled;var i=e.visible,o=e.children,a=e.popupElement,s=e.animation,A=e.transitionName,c=e.dropdownStyle,u=e.dropdownClassName,d=e.direction,f=d===void 0?"ltr":d,p=e.placement,v=e.builtinPlacements,C=e.dropdownMatchSelectWidth,m=e.dropdownRender,y=e.dropdownAlign,w=e.getPopupContainer,I=e.empty,O=e.getTriggerDOMNode,x=e.onPopupVisibleChange,g=e.onPopupMouseEnter,M=Et(e,XT),E="".concat(r,"-dropdown"),b=a;m&&(b=m(a));var h=l.useMemo(function(){return v||e8(C)},[v,C]),S=s?"".concat(E,"-").concat(s):A,T=typeof C=="number",R=l.useMemo(function(){return T?null:C===!1?"minWidth":"width"},[C,T]),D=c;T&&(D=L(L({},D),{},{width:C}));var B=l.useRef(null);return l.useImperativeHandle(n,function(){return{getPopupElement:function(){var P;return(P=B.current)===null||P===void 0?void 0:P.popupElement}}}),l.createElement(hc,Qe({},M,{showAction:x?["click"]:[],hideAction:x?["click"]:[],popupPlacement:p||(f==="rtl"?"bottomRight":"bottomLeft"),builtinPlacements:h,prefixCls:E,popupTransitionName:S,popup:l.createElement("div",{onMouseEnter:g},b),ref:B,stretch:R,popupAlign:y,popupVisible:i,getPopupContainer:w,popupClassName:Ae(u,Q({},"".concat(E,"-empty"),I)),popupStyle:D,getTriggerDOMNode:O,onPopupVisibleChange:x}),o)},fy=l.forwardRef(t8);process.env.NODE_ENV!=="production"&&(fy.displayName="SelectTrigger");function Fm(t,e){var n=t.key,r;return"value"in t&&(r=t.value),n??(r!==void 0?r:"rc-index-key-".concat(e))}function Id(t){return typeof t<"u"&&!Number.isNaN(t)}function gy(t,e){var n=t||{},r=n.label,i=n.value,o=n.options,a=n.groupLabel,s=r||(e?"children":"label");return{label:s,value:i||"value",options:o||"options",groupLabel:a||s}}function n8(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=e.fieldNames,r=e.childrenAsData,i=[],o=gy(n,!1),a=o.label,s=o.value,A=o.options,c=o.groupLabel;function u(d,f){Array.isArray(d)&&d.forEach(function(p){if(f||!(A in p)){var v=p[s];i.push({key:Fm(p,i.length),groupOption:f,data:p,label:p[a],value:v})}else{var C=p[c];C===void 0&&r&&(C=p.label),i.push({key:Fm(p,i.length),group:!0,data:p,label:C}),u(p[A],!0)}})}return u(t,!1),i}function xd(t){var e=L({},t);return"props"in e||Object.defineProperty(e,"props",{get:function(){return yt(!1,"Return type is option instead of Option instance. Please read value directly instead of reading from `props`."),e}}),e}var r8=function(e,n,r){if(!n||!n.length)return null;var i=!1,o=function s(A,c){var u=Rv(c),d=u[0],f=u.slice(1);if(!d)return[A];var p=A.split(d);return i=i||p.length>1,p.reduce(function(v,C){return[].concat(Re(v),Re(s(C,f)))},[]).filter(Boolean)},a=o(e,n);return i?typeof r<"u"?a.slice(0,r):a:null},Df=l.createContext(null);function i8(t){var e=t.visible,n=t.values;if(!e)return null;var r=50;return l.createElement("span",{"aria-live":"polite",style:{width:0,height:0,position:"absolute",overflow:"hidden",opacity:0}},"".concat(n.slice(0,r).map(function(i){var o=i.label,a=i.value;return["number","string"].includes(et(o))?o:a}).join(", ")),n.length>r?", ...":null)}var o8=["id","prefixCls","className","showSearch","tagRender","direction","omitDomProps","displayValues","onDisplayValuesChange","emptyOptions","notFoundContent","onClear","mode","disabled","loading","getInputElement","getRawInputElement","open","defaultOpen","onDropdownVisibleChange","activeValue","onActiveValueChange","activeDescendantId","searchValue","autoClearSearchValue","onSearch","onSearchSplit","tokenSeparators","allowClear","prefix","suffixIcon","clearIcon","OptionList","animation","transitionName","dropdownStyle","dropdownClassName","dropdownMatchSelectWidth","dropdownRender","dropdownAlign","placement","builtinPlacements","getPopupContainer","showAction","onFocus","onBlur","onKeyUp","onKeyDown","onMouseDown"],a8=["value","onChange","removeIcon","placeholder","autoFocus","maxTagCount","maxTagTextLength","maxTagPlaceholder","choiceTransitionName","onInputKeyDown","onPopupScroll","tabIndex"],BA=function(e){return e==="tags"||e==="multiple"},hy=l.forwardRef(function(t,e){var n,r=t.id,i=t.prefixCls,o=t.className,a=t.showSearch,s=t.tagRender,A=t.direction,c=t.omitDomProps,u=t.displayValues,d=t.onDisplayValuesChange,f=t.emptyOptions,p=t.notFoundContent,v=p===void 0?"Not Found":p,C=t.onClear,m=t.mode,y=t.disabled,w=t.loading,I=t.getInputElement,O=t.getRawInputElement,x=t.open,g=t.defaultOpen,M=t.onDropdownVisibleChange,E=t.activeValue,b=t.onActiveValueChange,h=t.activeDescendantId,S=t.searchValue,T=t.autoClearSearchValue,R=t.onSearch,D=t.onSearchSplit,B=t.tokenSeparators,k=t.allowClear,P=t.prefix,H=t.suffixIcon,Z=t.clearIcon,V=t.OptionList,q=t.animation,U=t.transitionName,$=t.dropdownStyle,z=t.dropdownClassName,J=t.dropdownMatchSelectWidth,W=t.dropdownRender,te=t.dropdownAlign,_=t.placement,se=t.builtinPlacements,ce=t.getPopupContainer,ue=t.showAction,ne=ue===void 0?[]:ue,me=t.onFocus,Y=t.onBlur,de=t.onKeyUp,le=t.onKeyDown,Se=t.onMouseDown,xe=Et(t,o8),Ce=BA(m),De=(a!==void 0?a:Ce)||m==="combobox",je=L({},xe);a8.forEach(function(wt){delete je[wt]}),c==null||c.forEach(function(wt){delete je[wt]});var Le=l.useState(!1),Ie=ee(Le,2),pe=Ie[0],Oe=Ie[1];l.useEffect(function(){Oe(wC())},[]);var Ze=l.useRef(null),tt=l.useRef(null),rt=l.useRef(null),Ge=l.useRef(null),be=l.useRef(null),Je=l.useRef(!1),lt=jT(),$e=ee(lt,3),Be=$e[0],Me=$e[1],st=$e[2];l.useImperativeHandle(e,function(){var wt,qe;return{focus:(wt=Ge.current)===null||wt===void 0?void 0:wt.focus,blur:(qe=Ge.current)===null||qe===void 0?void 0:qe.blur,scrollTo:function(bt){var Tt;return(Tt=be.current)===null||Tt===void 0?void 0:Tt.scrollTo(bt)},nativeElement:Ze.current||tt.current}});var At=l.useMemo(function(){var wt;if(m!=="combobox")return S;var qe=(wt=u[0])===null||wt===void 0?void 0:wt.value;return typeof qe=="string"||typeof qe=="number"?String(qe):""},[S,m,u]),Ct=m==="combobox"&&typeof I=="function"&&I()||null,Nt=typeof O=="function"&&O(),Jt=ji(tt,Nt==null||(n=Nt.props)===null||n===void 0?void 0:n.ref),Wt=l.useState(!1),en=ee(Wt,2),_t=en[0],Zt=en[1];Xt(function(){Zt(!0)},[]);var Rt=Fn(!1,{defaultValue:g,value:x}),pt=ee(Rt,2),Ve=pt[0],_e=pt[1],Te=_t?Ve:!1,ot=!v&&f;(y||ot&&Te&&m==="combobox")&&(Te=!1);var mt=ot?!1:Te,Fe=l.useCallback(function(wt){var qe=wt!==void 0?wt:!Te;y||(_e(qe),Te!==qe&&(M==null||M(qe)))},[y,Te,_e,M]),we=l.useMemo(function(){return(B||[]).some(function(wt){return[`
625
625
  `,`\r
626
- `].includes(wt)})},[B]),Ke=l.useContext(Df)||{},ze=Ke.maxCount,Ue=Ke.rawValues,F=function(qe,gt,bt){if(!(Ce&&Id(ze)&&(Ue==null?void 0:Ue.size)>=ze)){var Tt=!0,Bt=qe;b==null||b(null);var Sn=r8(qe,B,Id(ze)?ze-Ue.size:void 0),wn=bt?null:Sn;return m!=="combobox"&&wn&&(Bt="",D==null||D(wn),Fe(!1),Tt=!1),R&&At!==Bt&&R(Bt,{source:gt?"typing":"effect"}),Tt}},ge=function(qe){!qe||!qe.trim()||R(qe,{source:"submit"})};l.useEffect(function(){!Te&&!Ce&&m!=="combobox"&&F("",!1,!1)},[Te]),l.useEffect(function(){Ve&&y&&_e(!1),y&&!Je.current&&Me(!1)},[y]);var j=ly(),re=ee(j,2),X=re[0],ve=re[1],ke=l.useRef(!1),Xe=function(qe){var gt=X(),bt=qe.key,Tt=bt==="Enter";if(Tt&&(m!=="combobox"&&qe.preventDefault(),Te||Fe(!0)),ve(!!At),bt==="Backspace"&&!gt&&Ce&&!At&&u.length){for(var Bt=Re(u),Sn=null,wn=Bt.length-1;wn>=0;wn-=1){var Wn=Bt[wn];if(!Wn.disabled){Bt.splice(wn,1),Sn=Wn;break}}Sn&&d(Bt,{type:"remove",values:[Sn]})}for(var rr=arguments.length,Jn=new Array(rr>1?rr-1:0),_n=1;_n<rr;_n++)Jn[_n-1]=arguments[_n];if(Te&&(!Tt||!ke.current)){var vn;Tt&&(ke.current=!0),(vn=be.current)===null||vn===void 0||vn.onKeyDown.apply(vn,[qe].concat(Jn))}le==null||le.apply(void 0,[qe].concat(Jn))},Ft=function(qe){for(var gt=arguments.length,bt=new Array(gt>1?gt-1:0),Tt=1;Tt<gt;Tt++)bt[Tt-1]=arguments[Tt];if(Te){var Bt;(Bt=be.current)===null||Bt===void 0||Bt.onKeyUp.apply(Bt,[qe].concat(bt))}qe.key==="Enter"&&(ke.current=!1),de==null||de.apply(void 0,[qe].concat(bt))},ft=function(qe){var gt=u.filter(function(bt){return bt!==qe});d(gt,{type:"remove",values:[qe]})},St=function(){ke.current=!1},Ee=l.useRef(!1),Ne=function(){Me(!0),y||(me&&!Ee.current&&me.apply(void 0,arguments),ne.includes("focus")&&Fe(!0)),Ee.current=!0},ct=function(){Je.current=!0,Me(!1,function(){Ee.current=!1,Je.current=!1,Fe(!1)}),!y&&(At&&(m==="tags"?R(At,{source:"submit"}):m==="multiple"&&R("",{source:"blur"})),Y&&Y.apply(void 0,arguments))},ut=[];l.useEffect(function(){return function(){ut.forEach(function(wt){return clearTimeout(wt)}),ut.splice(0,ut.length)}},[]);var kt=function(qe){var gt,bt=qe.target,Tt=(gt=rt.current)===null||gt===void 0?void 0:gt.getPopupElement();if(Tt&&Tt.contains(bt)){var Bt=setTimeout(function(){var rr=ut.indexOf(Bt);if(rr!==-1&&ut.splice(rr,1),st(),!pe&&!Tt.contains(document.activeElement)){var Jn;(Jn=Ge.current)===null||Jn===void 0||Jn.focus()}});ut.push(Bt)}for(var Sn=arguments.length,wn=new Array(Sn>1?Sn-1:0),Wn=1;Wn<Sn;Wn++)wn[Wn-1]=arguments[Wn];Se==null||Se.apply(void 0,[qe].concat(wn))},Pn=l.useState({}),ln=ee(Pn,2),Yn=ln[1];function Hr(){Yn({})}var Hn;Nt&&(Hn=function(qe){Fe(qe)}),LT(function(){var wt;return[Ze.current,(wt=rt.current)===null||wt===void 0?void 0:wt.getPopupElement()]},mt,Fe,!!Nt);var Gn=l.useMemo(function(){return L(L({},t),{},{notFoundContent:v,open:Te,triggerOpen:mt,id:r,showSearch:De,multiple:Ce,toggleOpen:Fe})},[t,v,mt,Te,r,De,Ce,Fe]),xr=!!H||w,qn;xr&&(qn=l.createElement(bc,{className:Ae("".concat(i,"-arrow"),Q({},"".concat(i,"-arrow-loading"),w)),customizeIcon:H,customizeIconProps:{loading:w,searchValue:At,open:Te,focused:Be,showSearch:De}}));var Xr=function(){var qe;C==null||C(),(qe=Ge.current)===null||qe===void 0||qe.focus(),d([],{type:"clear",values:u}),F("",!1,!1)},Rr=PT(i,Xr,u,k,Z,y,At,m),Zn=Rr.allowClear,nr=Rr.clearIcon,gr=l.createElement(V,{ref:be}),hr=Ae(i,o,Q(Q(Q(Q(Q(Q(Q(Q(Q(Q({},"".concat(i,"-focused"),Be),"".concat(i,"-multiple"),Ce),"".concat(i,"-single"),!Ce),"".concat(i,"-allow-clear"),k),"".concat(i,"-show-arrow"),xr),"".concat(i,"-disabled"),y),"".concat(i,"-loading"),w),"".concat(i,"-open"),Te),"".concat(i,"-customize-input"),Ct),"".concat(i,"-show-search"),De)),Gr=l.createElement(fy,{ref:rt,disabled:y,prefixCls:i,visible:mt,popupElement:gr,animation:q,transitionName:U,dropdownStyle:$,dropdownClassName:z,direction:A,dropdownMatchSelectWidth:J,dropdownRender:W,dropdownAlign:te,placement:_,builtinPlacements:se,getPopupContainer:ce,empty:f,getTriggerDOMNode:function(qe){return tt.current||qe},onPopupVisibleChange:Hn,onPopupMouseEnter:Hr},Nt?l.cloneElement(Nt,{ref:Jt}):l.createElement(dy,Qe({},t,{domRef:tt,prefixCls:i,inputElement:Ct,ref:Ge,id:r,prefix:P,showSearch:De,autoClearSearchValue:T,mode:m,activeDescendantId:h,tagRender:s,values:u,open:Te,onToggleOpen:Fe,activeValue:E,searchValue:At,onSearch:F,onSearchSubmit:ge,onRemove:ft,tokenWithEnter:we,onInputBlur:St}))),ei;return Nt?ei=Gr:ei=l.createElement("div",Qe({className:hr},je,{ref:Ze,onMouseDown:kt,onKeyDown:Xe,onKeyUp:Ft,onFocus:Ne,onBlur:ct}),l.createElement(i8,{visible:Be&&!Te,values:u}),Gr,qn,Zn&&nr),l.createElement(cy.Provider,{value:Gn},ei)});process.env.NODE_ENV!=="production"&&(hy.displayName="BaseSelect");var Bf=function(){return null};Bf.isSelectOptGroup=!0;var Ff=function(){return null};Ff.isSelectOption=!0;var py=l.forwardRef(function(t,e){var n=t.height,r=t.offsetY,i=t.offsetX,o=t.children,a=t.prefixCls,s=t.onInnerResize,A=t.innerProps,c=t.rtl,u=t.extra,d={},f={display:"flex",flexDirection:"column"};return r!==void 0&&(d={height:n,position:"relative",overflow:"hidden"},f=L(L({},f),{},Q(Q(Q(Q(Q({transform:"translateY(".concat(r,"px)")},c?"marginRight":"marginLeft",-i),"position","absolute"),"left",0),"right",0),"top",0))),l.createElement("div",{style:d},l.createElement(hi,{onResize:function(v){var C=v.offsetHeight;C&&s&&s()}},l.createElement("div",Qe({style:f,className:Ae(Q({},"".concat(a,"-holder-inner"),a)),ref:e},A),o,u)))});py.displayName="Filler";function s8(t){var e=t.children,n=t.setRef,r=l.useCallback(function(i){n(i)},[]);return l.cloneElement(e,{ref:r})}function A8(t,e,n,r,i,o,a,s){var A=s.getKey;return t.slice(e,n+1).map(function(c,u){var d=e+u,f=a(c,d,{style:{width:r},offsetX:i}),p=A(c);return l.createElement(s8,{key:p,setRef:function(C){return o(c,C)}},f)})}function c8(t,e,n){var r=t.length,i=e.length,o,a;if(r===0&&i===0)return null;r<i?(o=t,a=e):(o=e,a=t);var s={__EMPTY_ITEM__:!0};function A(v){return v!==void 0?n(v):s}for(var c=null,u=Math.abs(r-i)!==1,d=0;d<a.length;d+=1){var f=A(o[d]),p=A(a[d]);if(f!==p){c=d,u=u||f!==A(a[d+1]);break}}return c===null?null:{index:c,multiple:u}}function l8(t,e,n){var r=l.useState(t),i=ee(r,2),o=i[0],a=i[1],s=l.useState(null),A=ee(s,2),c=A[0],u=A[1];return l.useEffect(function(){var d=c8(o||[],t||[],e);(d==null?void 0:d.index)!==void 0&&u(t[d.index]),a(t)},[t]),[c]}var km=(typeof navigator>"u"?"undefined":et(navigator))==="object"&&/Firefox/i.test(navigator.userAgent);const my=function(t,e,n,r){var i=N.useRef(!1),o=N.useRef(null);function a(){clearTimeout(o.current),i.current=!0,o.current=setTimeout(function(){i.current=!1},50)}var s=N.useRef({top:t,bottom:e,left:n,right:r});return s.current.top=t,s.current.bottom=e,s.current.left=n,s.current.right=r,function(A,c){var u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,d=A?c<0&&s.current.left||c>0&&s.current.right:c<0&&s.current.top||c>0&&s.current.bottom;return u&&d?(clearTimeout(o.current),i.current=!1):(!d||i.current)&&a(),!i.current&&d}};function u8(t,e,n,r,i,o,a){var s=N.useRef(0),A=N.useRef(null),c=N.useRef(null),u=N.useRef(!1),d=my(e,n,r,i);function f(w,I){if(qt.cancel(A.current),!d(!1,I)){var O=w;if(!O._virtualHandled)O._virtualHandled=!0;else return;s.current+=I,c.current=I,km||O.preventDefault(),A.current=qt(function(){var x=u.current?10:1;a(s.current*x,!1),s.current=0})}}function p(w,I){a(I,!0),km||w.preventDefault()}var v=N.useRef(null),C=N.useRef(null);function m(w){if(t){qt.cancel(C.current),C.current=qt(function(){v.current=null},2);var I=w.deltaX,O=w.deltaY,x=w.shiftKey,g=I,M=O;(v.current==="sx"||!v.current&&x&&O&&!I)&&(g=O,M=0,v.current="sx");var E=Math.abs(g),b=Math.abs(M);v.current===null&&(v.current=o&&E>b?"x":"y"),v.current==="y"?f(w,M):p(w,g)}}function y(w){t&&(u.current=w.detail===c.current)}return[m,y]}function d8(t,e,n,r){var i=l.useMemo(function(){return[new Map,[]]},[t,n.id,r]),o=ee(i,2),a=o[0],s=o[1],A=function(u){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u,f=a.get(u),p=a.get(d);if(f===void 0||p===void 0)for(var v=t.length,C=s.length;C<v;C+=1){var m,y=t[C],w=e(y);a.set(w,C);var I=(m=n.get(w))!==null&&m!==void 0?m:r;if(s[C]=(s[C-1]||0)+I,w===u&&(f=C),w===d&&(p=C),f!==void 0&&p!==void 0)break}return{top:s[f-1]||0,bottom:s[p]}};return A}var f8=function(){function t(){pn(this,t),Q(this,"maps",void 0),Q(this,"id",0),Q(this,"diffRecords",new Map),this.maps=Object.create(null)}return mn(t,[{key:"set",value:function(n,r){this.diffRecords.set(n,this.maps[n]),this.maps[n]=r,this.id+=1}},{key:"get",value:function(n){return this.maps[n]}},{key:"resetRecord",value:function(){this.diffRecords.clear()}},{key:"getRecord",value:function(){return this.diffRecords}}]),t}();function Pm(t){var e=parseFloat(t);return isNaN(e)?0:e}function g8(t,e,n){var r=l.useState(0),i=ee(r,2),o=i[0],a=i[1],s=N.useRef(new Map),A=N.useRef(new f8),c=N.useRef(0);function u(){c.current+=1}function d(){var p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;u();var v=function(){var y=!1;s.current.forEach(function(w,I){if(w&&w.offsetParent){var O=w.offsetHeight,x=getComputedStyle(w),g=x.marginTop,M=x.marginBottom,E=Pm(g),b=Pm(M),h=O+E+b;A.current.get(I)!==h&&(A.current.set(I,h),y=!0)}}),y&&a(function(w){return w+1})};if(p)v();else{c.current+=1;var C=c.current;Promise.resolve().then(function(){C===c.current&&v()})}}function f(p,v){var C=t(p);s.current.get(C),v?(s.current.set(C,v),d()):s.current.delete(C)}return N.useEffect(function(){return u},[]),[f,d,A.current,o]}var Qm=14/15;function h8(t,e,n){var r=N.useRef(!1),i=N.useRef(0),o=N.useRef(0),a=N.useRef(null),s=N.useRef(null),A,c=function(p){if(r.current){var v=Math.ceil(p.touches[0].pageX),C=Math.ceil(p.touches[0].pageY),m=i.current-v,y=o.current-C,w=Math.abs(m)>Math.abs(y);w?i.current=v:o.current=C;var I=n(w,w?m:y,!1,p);I&&p.preventDefault(),clearInterval(s.current),I&&(s.current=setInterval(function(){w?m*=Qm:y*=Qm;var O=Math.floor(w?m:y);(!n(w,O,!0)||Math.abs(O)<=.1)&&clearInterval(s.current)},16))}},u=function(){r.current=!1,A()},d=function(p){A(),p.touches.length===1&&!r.current&&(r.current=!0,i.current=Math.ceil(p.touches[0].pageX),o.current=Math.ceil(p.touches[0].pageY),a.current=p.target,a.current.addEventListener("touchmove",c,{passive:!1}),a.current.addEventListener("touchend",u,{passive:!0}))};A=function(){a.current&&(a.current.removeEventListener("touchmove",c),a.current.removeEventListener("touchend",u))},Xt(function(){return t&&e.current.addEventListener("touchstart",d,{passive:!0}),function(){var f;(f=e.current)===null||f===void 0||f.removeEventListener("touchstart",d),A(),clearInterval(s.current)}},[t])}function jm(t){return Math.floor(Math.pow(t,.5))}function Rd(t,e){var n="touches"in t?t.touches[0]:t;return n[e?"pageX":"pageY"]-window[e?"scrollX":"scrollY"]}function p8(t,e,n){l.useEffect(function(){var r=e.current;if(t&&r){var i=!1,o,a,s=function(){qt.cancel(o)},A=function f(){s(),o=qt(function(){n(a),f()})},c=function(p){if(!(p.target.draggable||p.button!==0)){var v=p;v._virtualHandled||(v._virtualHandled=!0,i=!0)}},u=function(){i=!1,s()},d=function(p){if(i){var v=Rd(p,!1),C=r.getBoundingClientRect(),m=C.top,y=C.bottom;if(v<=m){var w=m-v;a=-jm(w),A()}else if(v>=y){var I=v-y;a=jm(I),A()}else s()}};return r.addEventListener("mousedown",c),r.ownerDocument.addEventListener("mouseup",u),r.ownerDocument.addEventListener("mousemove",d),function(){r.removeEventListener("mousedown",c),r.ownerDocument.removeEventListener("mouseup",u),r.ownerDocument.removeEventListener("mousemove",d),s()}}},[t])}var Lm=10;function m8(t,e,n,r,i,o,a,s){var A=l.useRef(),c=l.useState(null),u=ee(c,2),d=u[0],f=u[1];return Xt(function(){if(d&&d.times<Lm){if(!t.current){f(function(Z){return L({},Z)});return}o();var p=d.targetAlign,v=d.originAlign,C=d.index,m=d.offset,y=t.current.clientHeight,w=!1,I=p,O=null;if(y){for(var x=p||v,g=0,M=0,E=0,b=Math.min(e.length-1,C),h=0;h<=b;h+=1){var S=i(e[h]);M=g;var T=n.get(S);E=M+(T===void 0?r:T),g=E}for(var R=x==="top"?m:y-m,D=b;D>=0;D-=1){var B=i(e[D]),k=n.get(B);if(k===void 0){w=!0;break}if(R-=k,R<=0)break}switch(x){case"top":O=M-m;break;case"bottom":O=E-y+m;break;default:{var P=t.current.scrollTop,H=P+y;M<P?I="top":E>H&&(I="bottom")}}O!==null&&a(O),O!==d.lastTop&&(w=!0)}w&&f(L(L({},d),{},{times:d.times+1,targetAlign:I,lastTop:O}))}else process.env.NODE_ENV!=="production"&&(d==null?void 0:d.times)===Lm&&yt(!1,"Seems `scrollTo` with `rc-virtual-list` reach the max limitation. Please fire issue for us. Thanks.")},[d,t.current]),function(p){if(p==null){s();return}if(qt.cancel(A.current),typeof p=="number")a(p);else if(p&&et(p)==="object"){var v,C=p.align;"index"in p?v=p.index:v=e.findIndex(function(w){return i(w)===p.key});var m=p.offset,y=m===void 0?0:m;f({times:0,index:v,offset:y,originAlign:C})}}}var Od=l.forwardRef(function(t,e){var n=t.prefixCls,r=t.rtl,i=t.scrollOffset,o=t.scrollRange,a=t.onStartMove,s=t.onStopMove,A=t.onScroll,c=t.horizontal,u=t.spinSize,d=t.containerSize,f=t.style,p=t.thumbStyle,v=t.showScrollBar,C=l.useState(!1),m=ee(C,2),y=m[0],w=m[1],I=l.useState(null),O=ee(I,2),x=O[0],g=O[1],M=l.useState(null),E=ee(M,2),b=E[0],h=E[1],S=!r,T=l.useRef(),R=l.useRef(),D=l.useState(v),B=ee(D,2),k=B[0],P=B[1],H=l.useRef(),Z=function(){v===!0||v===!1||(clearTimeout(H.current),P(!0),H.current=setTimeout(function(){P(!1)},3e3))},V=o-d||0,q=d-u||0,U=l.useMemo(function(){if(i===0||V===0)return 0;var ue=i/V;return ue*q},[i,V,q]),$=function(ne){ne.stopPropagation(),ne.preventDefault()},z=l.useRef({top:U,dragging:y,pageY:x,startTop:b});z.current={top:U,dragging:y,pageY:x,startTop:b};var J=function(ne){w(!0),g(Rd(ne,c)),h(z.current.top),a(),ne.stopPropagation(),ne.preventDefault()};l.useEffect(function(){var ue=function(de){de.preventDefault()},ne=T.current,me=R.current;return ne.addEventListener("touchstart",ue,{passive:!1}),me.addEventListener("touchstart",J,{passive:!1}),function(){ne.removeEventListener("touchstart",ue),me.removeEventListener("touchstart",J)}},[]);var W=l.useRef();W.current=V;var te=l.useRef();te.current=q,l.useEffect(function(){if(y){var ue,ne=function(de){var le=z.current,Se=le.dragging,xe=le.pageY,Ce=le.startTop;qt.cancel(ue);var De=T.current.getBoundingClientRect(),je=d/(c?De.width:De.height);if(Se){var Le=(Rd(de,c)-xe)*je,Ie=Ce;!S&&c?Ie-=Le:Ie+=Le;var pe=W.current,Oe=te.current,Ze=Oe?Ie/Oe:0,tt=Math.ceil(Ze*pe);tt=Math.max(tt,0),tt=Math.min(tt,pe),ue=qt(function(){A(tt,c)})}},me=function(){w(!1),s()};return window.addEventListener("mousemove",ne,{passive:!0}),window.addEventListener("touchmove",ne,{passive:!0}),window.addEventListener("mouseup",me,{passive:!0}),window.addEventListener("touchend",me,{passive:!0}),function(){window.removeEventListener("mousemove",ne),window.removeEventListener("touchmove",ne),window.removeEventListener("mouseup",me),window.removeEventListener("touchend",me),qt.cancel(ue)}}},[y]),l.useEffect(function(){return Z(),function(){clearTimeout(H.current)}},[i]),l.useImperativeHandle(e,function(){return{delayHidden:Z}});var _="".concat(n,"-scrollbar"),se={position:"absolute",visibility:k?null:"hidden"},ce={position:"absolute",borderRadius:99,background:"var(--rc-virtual-list-scrollbar-bg, rgba(0, 0, 0, 0.5))",cursor:"pointer",userSelect:"none"};return c?(Object.assign(se,{height:8,left:0,right:0,bottom:0}),Object.assign(ce,Q({height:"100%",width:u},S?"left":"right",U))):(Object.assign(se,Q({width:8,top:0,bottom:0},S?"right":"left",0)),Object.assign(ce,{width:"100%",height:u,top:U})),l.createElement("div",{ref:T,className:Ae(_,Q(Q(Q({},"".concat(_,"-horizontal"),c),"".concat(_,"-vertical"),!c),"".concat(_,"-visible"),k)),style:L(L({},se),f),onMouseDown:$,onMouseMove:Z},l.createElement("div",{ref:R,className:Ae("".concat(_,"-thumb"),Q({},"".concat(_,"-thumb-moving"),y)),style:L(L({},ce),p),onMouseDown:J}))});process.env.NODE_ENV!=="production"&&(Od.displayName="ScrollBar");var v8=20;function Um(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=t/e*t;return isNaN(n)&&(n=0),n=Math.max(n,v8),Math.floor(n)}var C8=["prefixCls","className","height","itemHeight","fullHeight","style","data","children","itemKey","virtual","direction","scrollWidth","component","onScroll","onVirtualScroll","onVisibleChange","innerProps","extraRender","styles","showScrollBar"],y8=[],E8={overflowY:"auto",overflowAnchor:"none"};function b8(t,e){var n=t.prefixCls,r=n===void 0?"rc-virtual-list":n,i=t.className,o=t.height,a=t.itemHeight,s=t.fullHeight,A=s===void 0?!0:s,c=t.style,u=t.data,d=t.children,f=t.itemKey,p=t.virtual,v=t.direction,C=t.scrollWidth,m=t.component,y=m===void 0?"div":m,w=t.onScroll,I=t.onVirtualScroll,O=t.onVisibleChange,x=t.innerProps,g=t.extraRender,M=t.styles,E=t.showScrollBar,b=E===void 0?"optional":E,h=Et(t,C8),S=l.useCallback(function(Ee){return typeof f=="function"?f(Ee):Ee==null?void 0:Ee[f]},[f]),T=g8(S),R=ee(T,4),D=R[0],B=R[1],k=R[2],P=R[3],H=!!(p!==!1&&o&&a),Z=l.useMemo(function(){return Object.values(k.maps).reduce(function(Ee,Ne){return Ee+Ne},0)},[k.id,k.maps]),V=H&&u&&(Math.max(a*u.length,Z)>o||!!C),q=v==="rtl",U=Ae(r,Q({},"".concat(r,"-rtl"),q),i),$=u||y8,z=N.useRef(),J=N.useRef(),W=N.useRef(),te=N.useState(0),_=ee(te,2),se=_[0],ce=_[1],ue=N.useState(0),ne=ee(ue,2),me=ne[0],Y=ne[1],de=N.useState(!1),le=ee(de,2),Se=le[0],xe=le[1],Ce=function(){xe(!0)},De=function(){xe(!1)},je={getKey:S};function Le(Ee){ce(function(Ne){var ct;typeof Ee=="function"?ct=Ee(Ne):ct=Ee;var ut=Zt(ct);return z.current.scrollTop=ut,ut})}var Ie=N.useRef({start:0,end:$.length}),pe=N.useRef(),Oe=l8($,S),Ze=ee(Oe,1),tt=Ze[0];pe.current=tt;var rt=l.useMemo(function(){if(!H)return{scrollHeight:void 0,start:0,end:$.length-1,offset:void 0};if(!V){var Ee;return{scrollHeight:((Ee=J.current)===null||Ee===void 0?void 0:Ee.offsetHeight)||0,start:0,end:$.length-1,offset:void 0}}for(var Ne=0,ct,ut,kt,Pn=$.length,ln=0;ln<Pn;ln+=1){var Yn=$[ln],Hr=S(Yn),Hn=k.get(Hr),Gn=Ne+(Hn===void 0?a:Hn);Gn>=se&&ct===void 0&&(ct=ln,ut=Ne),Gn>se+o&&kt===void 0&&(kt=ln),Ne=Gn}return ct===void 0&&(ct=0,ut=0,kt=Math.ceil(o/a)),kt===void 0&&(kt=$.length-1),kt=Math.min(kt+1,$.length-1),{scrollHeight:Ne,start:ct,end:kt,offset:ut}},[V,H,se,$,P,o]),Ge=rt.scrollHeight,be=rt.start,Je=rt.end,lt=rt.offset;Ie.current.start=be,Ie.current.end=Je,l.useLayoutEffect(function(){var Ee=k.getRecord();if(Ee.size===1){var Ne=Array.from(Ee.keys())[0],ct=Ee.get(Ne),ut=$[be];if(ut&&ct===void 0){var kt=S(ut);if(kt===Ne){var Pn=k.get(Ne),ln=Pn-a;Le(function(Yn){return Yn+ln})}}}k.resetRecord()},[Ge]);var $e=l.useState({width:0,height:o}),Be=ee($e,2),Me=Be[0],st=Be[1],At=function(Ne){st({width:Ne.offsetWidth,height:Ne.offsetHeight})},Ct=N.useRef(),Nt=N.useRef(),Jt=l.useMemo(function(){return Um(Me.width,C)},[Me.width,C]),Wt=l.useMemo(function(){return Um(Me.height,Ge)},[Me.height,Ge]),en=Ge-o,_t=N.useRef(en);_t.current=en;function Zt(Ee){var Ne=Ee;return Number.isNaN(_t.current)||(Ne=Math.min(Ne,_t.current)),Ne=Math.max(Ne,0),Ne}var Rt=se<=0,pt=se>=en,Ve=me<=0,_e=me>=C,Te=my(Rt,pt,Ve,_e),ot=function(){return{x:q?-me:me,y:se}},mt=N.useRef(ot()),Fe=rn(function(Ee){if(I){var Ne=L(L({},ot()),Ee);(mt.current.x!==Ne.x||mt.current.y!==Ne.y)&&(I(Ne),mt.current=Ne)}});function we(Ee,Ne){var ct=Ee;Ne?(Wr.flushSync(function(){Y(ct)}),Fe()):Le(ct)}function Ke(Ee){var Ne=Ee.currentTarget.scrollTop;Ne!==se&&Le(Ne),w==null||w(Ee),Fe()}var ze=function(Ne){var ct=Ne,ut=C?C-Me.width:0;return ct=Math.max(ct,0),ct=Math.min(ct,ut),ct},Ue=rn(function(Ee,Ne){Ne?(Wr.flushSync(function(){Y(function(ct){var ut=ct+(q?-Ee:Ee);return ze(ut)})}),Fe()):Le(function(ct){var ut=ct+Ee;return ut})}),F=u8(H,Rt,pt,Ve,_e,!!C,Ue),ge=ee(F,2),j=ge[0],re=ge[1];h8(H,z,function(Ee,Ne,ct,ut){var kt=ut;return Te(Ee,Ne,ct)?!1:!kt||!kt._virtualHandled?(kt&&(kt._virtualHandled=!0),j({preventDefault:function(){},deltaX:Ee?Ne:0,deltaY:Ee?0:Ne}),!0):!1}),p8(V,z,function(Ee){Le(function(Ne){return Ne+Ee})}),Xt(function(){function Ee(ct){var ut=Rt&&ct.detail<0,kt=pt&&ct.detail>0;H&&!ut&&!kt&&ct.preventDefault()}var Ne=z.current;return Ne.addEventListener("wheel",j,{passive:!1}),Ne.addEventListener("DOMMouseScroll",re,{passive:!0}),Ne.addEventListener("MozMousePixelScroll",Ee,{passive:!1}),function(){Ne.removeEventListener("wheel",j),Ne.removeEventListener("DOMMouseScroll",re),Ne.removeEventListener("MozMousePixelScroll",Ee)}},[H,Rt,pt]),Xt(function(){if(C){var Ee=ze(me);Y(Ee),Fe({x:Ee})}},[Me.width,C]);var X=function(){var Ne,ct;(Ne=Ct.current)===null||Ne===void 0||Ne.delayHidden(),(ct=Nt.current)===null||ct===void 0||ct.delayHidden()},ve=m8(z,$,k,a,S,function(){return B(!0)},Le,X);l.useImperativeHandle(e,function(){return{nativeElement:W.current,getScrollInfo:ot,scrollTo:function(Ne){function ct(ut){return ut&&et(ut)==="object"&&("left"in ut||"top"in ut)}ct(Ne)?(Ne.left!==void 0&&Y(ze(Ne.left)),ve(Ne.top)):ve(Ne)}}}),Xt(function(){if(O){var Ee=$.slice(be,Je+1);O(Ee,$)}},[be,Je,$]);var ke=d8($,S,k,a),Xe=g==null?void 0:g({start:be,end:Je,virtual:V,offsetX:me,offsetY:lt,rtl:q,getSize:ke}),Ft=A8($,be,Je,C,me,D,d,je),ft=null;o&&(ft=L(Q({},A?"height":"maxHeight",o),E8),H&&(ft.overflowY="hidden",C&&(ft.overflowX="hidden"),Se&&(ft.pointerEvents="none")));var St={};return q&&(St.dir="rtl"),l.createElement("div",Qe({ref:W,style:L(L({},c),{},{position:"relative"}),className:U},St,h),l.createElement(hi,{onResize:At},l.createElement(y,{className:"".concat(r,"-holder"),style:ft,ref:z,onScroll:Ke,onMouseEnter:X},l.createElement(py,{prefixCls:r,height:Ge,offsetX:me,offsetY:lt,scrollWidth:C,onInnerResize:B,ref:J,innerProps:x,rtl:q,extra:Xe},Ft))),V&&Ge>o&&l.createElement(Od,{ref:Ct,prefixCls:r,scrollOffset:se,scrollRange:Ge,rtl:q,onScroll:we,onStartMove:Ce,onStopMove:De,spinSize:Wt,containerSize:Me.height,style:M==null?void 0:M.verticalScrollBar,thumbStyle:M==null?void 0:M.verticalScrollBarThumb,showScrollBar:b}),V&&C>Me.width&&l.createElement(Od,{ref:Nt,prefixCls:r,scrollOffset:me,scrollRange:C,rtl:q,onScroll:we,onStartMove:Ce,onStopMove:De,spinSize:Jt,containerSize:Me.width,horizontal:!0,style:M==null?void 0:M.horizontalScrollBar,thumbStyle:M==null?void 0:M.horizontalScrollBarThumb,showScrollBar:b}))}var vy=l.forwardRef(b8);vy.displayName="List";function S8(){return/(mac\sos|macintosh)/i.test(navigator.appVersion)}var w8=["disabled","title","children","style","className"];function Hm(t){return typeof t=="string"||typeof t=="number"}var I8=function(e,n){var r=QT(),i=r.prefixCls,o=r.id,a=r.open,s=r.multiple,A=r.mode,c=r.searchValue,u=r.toggleOpen,d=r.notFoundContent,f=r.onPopupScroll,p=l.useContext(Df),v=p.maxCount,C=p.flattenOptions,m=p.onActiveValue,y=p.defaultActiveFirstOption,w=p.onSelect,I=p.menuItemSelectedIcon,O=p.rawValues,x=p.fieldNames,g=p.virtual,M=p.direction,E=p.listHeight,b=p.listItemHeight,h=p.optionRender,S="".concat(i,"-item"),T=Ja(function(){return C},[a,C],function(ue,ne){return ne[0]&&ue[1]!==ne[1]}),R=l.useRef(null),D=l.useMemo(function(){return s&&Id(v)&&(O==null?void 0:O.size)>=v},[s,v,O==null?void 0:O.size]),B=function(ne){ne.preventDefault()},k=function(ne){var me;(me=R.current)===null||me===void 0||me.scrollTo(typeof ne=="number"?{index:ne}:ne)},P=l.useCallback(function(ue){return A==="combobox"?!1:O.has(ue)},[A,Re(O).toString(),O.size]),H=function(ne){for(var me=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,Y=T.length,de=0;de<Y;de+=1){var le=(ne+de*me+Y)%Y,Se=T[le]||{},xe=Se.group,Ce=Se.data;if(!xe&&!(Ce!=null&&Ce.disabled)&&(P(Ce.value)||!D))return le}return-1},Z=l.useState(function(){return H(0)}),V=ee(Z,2),q=V[0],U=V[1],$=function(ne){var me=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;U(ne);var Y={source:me?"keyboard":"mouse"},de=T[ne];if(!de){m(null,-1,Y);return}m(de.value,ne,Y)};N.useEffect(function(){$(y!==!1?H(0):-1)},[T.length,c]);var z=l.useCallback(function(ue){return A==="combobox"?String(ue).toLowerCase()===c.toLowerCase():O.has(ue)},[A,c,Re(O).toString(),O.size]);N.useEffect(function(){var ue=setTimeout(function(){if(!s&&a&&O.size===1){var me=Array.from(O)[0],Y=T.findIndex(function(de){var le=de.data;return c?String(le.value).startsWith(c):le.value===me});Y!==-1&&($(Y),k(Y))}});if(a){var ne;(ne=R.current)===null||ne===void 0||ne.scrollTo(void 0)}return function(){return clearTimeout(ue)}},[a,c]);var J=function(ne){ne!==void 0&&w(ne,{selected:!O.has(ne)}),s||u(!1)};if(l.useImperativeHandle(n,function(){return{onKeyDown:function(ne){var me=ne.which,Y=ne.ctrlKey;switch(me){case at.N:case at.P:case at.UP:case at.DOWN:{var de=0;if(me===at.UP?de=-1:me===at.DOWN?de=1:S8()&&Y&&(me===at.N?de=1:me===at.P&&(de=-1)),de!==0){var le=H(q+de,de);k(le),$(le,!0)}break}case at.TAB:case at.ENTER:{var Se,xe=T[q];xe&&!(xe!=null&&(Se=xe.data)!==null&&Se!==void 0&&Se.disabled)&&!D?J(xe.value):J(void 0),a&&ne.preventDefault();break}case at.ESC:u(!1),a&&ne.stopPropagation()}},onKeyUp:function(){},scrollTo:function(ne){k(ne)}}}),T.length===0)return l.createElement("div",{role:"listbox",id:"".concat(o,"_list"),className:"".concat(S,"-empty"),onMouseDown:B},d);var W=Object.keys(x).map(function(ue){return x[ue]}),te=function(ne){return ne.label};function _(ue,ne){var me=ue.group;return{role:me?"presentation":"option",id:"".concat(o,"_list_").concat(ne)}}var se=function(ne){var me=T[ne];if(!me)return null;var Y=me.data||{},de=Y.value,le=me.group,Se=ki(Y,!0),xe=te(me);return me?l.createElement("div",Qe({"aria-label":typeof xe=="string"&&!le?xe:null},Se,{key:ne},_(me,ne),{"aria-selected":z(de)}),de):null},ce={role:"listbox",id:"".concat(o,"_list")};return l.createElement(l.Fragment,null,g&&l.createElement("div",Qe({},ce,{style:{height:0,width:0,overflow:"hidden"}}),se(q-1),se(q),se(q+1)),l.createElement(vy,{itemKey:"key",ref:R,data:T,height:E,itemHeight:b,fullHeight:!1,onMouseDown:B,onScroll:f,virtual:g,direction:M,innerProps:g?null:ce},function(ue,ne){var me=ue.group,Y=ue.groupOption,de=ue.data,le=ue.label,Se=ue.value,xe=de.key;if(me){var Ce,De=(Ce=de.title)!==null&&Ce!==void 0?Ce:Hm(le)?le.toString():void 0;return l.createElement("div",{className:Ae(S,"".concat(S,"-group"),de.className),title:De},le!==void 0?le:xe)}var je=de.disabled,Le=de.title;de.children;var Ie=de.style,pe=de.className,Oe=Et(de,w8),Ze=tr(Oe,W),tt=P(Se),rt=je||!tt&&D,Ge="".concat(S,"-option"),be=Ae(S,Ge,pe,Q(Q(Q(Q({},"".concat(Ge,"-grouped"),Y),"".concat(Ge,"-active"),q===ne&&!rt),"".concat(Ge,"-disabled"),rt),"".concat(Ge,"-selected"),tt)),Je=te(ue),lt=!I||typeof I=="function"||tt,$e=typeof Je=="number"?Je:Je||Se,Be=Hm($e)?$e.toString():void 0;return Le!==void 0&&(Be=Le),l.createElement("div",Qe({},ki(Ze),g?{}:_(ue,ne),{"aria-selected":z(Se),className:be,title:Be,onMouseMove:function(){q===ne||rt||$(ne)},onClick:function(){rt||J(Se)},style:Ie}),l.createElement("div",{className:"".concat(Ge,"-content")},typeof h=="function"?h(ue,{index:ne}):$e),l.isValidElement(I)||tt,lt&&l.createElement(bc,{className:"".concat(S,"-option-state"),customizeIcon:I,customizeIconProps:{value:Se,disabled:rt,isSelected:tt}},tt?"✓":null))}))},Cy=l.forwardRef(I8);process.env.NODE_ENV!=="production"&&(Cy.displayName="OptionList");const x8=function(t,e){var n=l.useRef({values:new Map,options:new Map}),r=l.useMemo(function(){var o=n.current,a=o.values,s=o.options,A=t.map(function(d){if(d.label===void 0){var f;return L(L({},d),{},{label:(f=a.get(d.value))===null||f===void 0?void 0:f.label})}return d}),c=new Map,u=new Map;return A.forEach(function(d){c.set(d.value,d),u.set(d.value,e.get(d.value)||s.get(d.value))}),n.current.values=c,n.current.options=u,A},[t,e]),i=l.useCallback(function(o){return e.get(o)||n.current.options.get(o)},[e]);return[r,i]};function ml(t,e){return Nf(t).join("").toUpperCase().includes(e)}const R8=function(t,e,n,r,i){return l.useMemo(function(){if(!n||r===!1)return t;var o=e.options,a=e.label,s=e.value,A=[],c=typeof r=="function",u=n.toUpperCase(),d=c?r:function(p,v){return i?ml(v[i],u):v[o]?ml(v[a!=="children"?a:"label"],u):ml(v[s],u)},f=c?function(p){return xd(p)}:function(p){return p};return t.forEach(function(p){if(p[o]){var v=d(n,f(p));if(v)A.push(p);else{var C=p[o].filter(function(m){return d(n,f(m))});C.length&&A.push(L(L({},p),{},Q({},o,C)))}return}d(n,f(p))&&A.push(p)}),A},[t,r,i,n,e])};var Gm=0,O8=process.env.NODE_ENV!=="test"&&Ln();function M8(){var t;return O8?(t=Gm,Gm+=1):t="TEST_OR_SSR",t}function T8(t){var e=l.useState(),n=ee(e,2),r=n[0],i=n[1];return l.useEffect(function(){i("rc_select_".concat(M8()))},[]),t||r}var N8=["children","value"],D8=["children"];function B8(t){var e=t,n=e.key,r=e.props,i=r.children,o=r.value,a=Et(r,N8);return L({key:n,value:o!==void 0?o:n,children:i},a)}function kf(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Pr(t).map(function(n,r){if(!l.isValidElement(n)||!n.type)return null;var i=n,o=i.type.isSelectOptGroup,a=i.key,s=i.props,A=s.children,c=Et(s,D8);return e||!o?B8(n):L(L({key:"__RC_SELECT_GRP__".concat(a===null?r:a,"__"),label:a},c),{},{options:kf(A)})}).filter(function(n){return n})}var F8=function(e,n,r,i,o){return l.useMemo(function(){var a=e,s=!e;s&&(a=kf(n));var A=new Map,c=new Map,u=function(p,v,C){C&&typeof C=="string"&&p.set(v[C],v)},d=function f(p){for(var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,C=0;C<p.length;C+=1){var m=p[C];!m[r.options]||v?(A.set(m[r.value],m),u(c,m,r.label),u(c,m,i),u(c,m,o)):f(m[r.options],!0)}};return d(a),{options:a,valueOptions:A,labelOptions:c}},[e,n,r,i,o])};function qm(t){var e=l.useRef();e.current=t;var n=l.useCallback(function(){return e.current.apply(e,arguments)},[]);return n}function k8(t){var e=t.mode,n=t.options,r=t.children,i=t.backfill,o=t.allowClear,a=t.placeholder,s=t.getInputElement,A=t.showSearch,c=t.onSearch,u=t.defaultOpen,d=t.autoFocus,f=t.labelInValue,p=t.value,v=t.inputValue,C=t.optionLabelProp,m=BA(e),y=A!==void 0?A:m||e==="combobox",w=n||kf(r);if(yt(e!=="tags"||w.every(function(g){return!g.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),e==="tags"||e==="combobox"){var I=w.some(function(g){return g.options?g.options.some(function(M){return typeof("value"in M?M.value:M.key)=="number"}):typeof("value"in g?g.value:g.key)=="number"});yt(!I,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(yt(e!=="combobox"||!C,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),yt(e==="combobox"||!i,"`backfill` only works with `combobox` mode."),yt(e==="combobox"||!s,"`getInputElement` only work with `combobox` mode."),Sl(e!=="combobox"||!s||!o||!a,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),c&&!y&&e!=="combobox"&&e!=="tags"&&yt(!1,"`onSearch` should work with `showSearch` instead of use alone."),Sl(!u||d,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),p!=null){var O=Nf(p);yt(!f||O.every(function(g){return et(g)==="object"&&("key"in g||"value"in g)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),yt(!m||Array.isArray(p),"`value` should be array when `mode` is `multiple` or `tags`")}if(r){var x=null;Pr(r).some(function(g){if(!l.isValidElement(g)||!g.type)return!1;var M=g,E=M.type;if(E.isSelectOption)return!1;if(E.isSelectOptGroup){var b=Pr(g.props.children).every(function(h){return!l.isValidElement(h)||!g.type||h.type.isSelectOption?!0:(x=h.type,!1)});return!b}return x=E,!0}),x&&yt(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(x.displayName||x.name||x,"`.")),yt(v===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}function P8(t,e){if(t){var n=function r(i){for(var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=0;a<i.length;a++){var s=i[a];if(s[e==null?void 0:e.value]===null)return yt(!1,"`value` in Select options should not be `null`."),!0;if(!o&&Array.isArray(s[e==null?void 0:e.options])&&r(s[e==null?void 0:e.options],!0))break}};n(t)}}var Q8=["id","mode","prefixCls","backfill","fieldNames","inputValue","searchValue","onSearch","autoClearSearchValue","onSelect","onDeselect","dropdownMatchSelectWidth","filterOption","filterSort","optionFilterProp","optionLabelProp","options","optionRender","children","defaultActiveFirstOption","menuItemSelectedIcon","virtual","direction","listHeight","listItemHeight","labelRender","value","defaultValue","labelInValue","onChange","maxCount"],j8=["inputValue"];function L8(t){return!t||et(t)!=="object"}var yy=l.forwardRef(function(t,e){var n=t.id,r=t.mode,i=t.prefixCls,o=i===void 0?"rc-select":i,a=t.backfill,s=t.fieldNames,A=t.inputValue,c=t.searchValue,u=t.onSearch,d=t.autoClearSearchValue,f=d===void 0?!0:d,p=t.onSelect,v=t.onDeselect,C=t.dropdownMatchSelectWidth,m=C===void 0?!0:C,y=t.filterOption,w=t.filterSort,I=t.optionFilterProp,O=t.optionLabelProp,x=t.options,g=t.optionRender,M=t.children,E=t.defaultActiveFirstOption,b=t.menuItemSelectedIcon,h=t.virtual,S=t.direction,T=t.listHeight,R=T===void 0?200:T,D=t.listItemHeight,B=D===void 0?20:D,k=t.labelRender,P=t.value,H=t.defaultValue,Z=t.labelInValue,V=t.onChange,q=t.maxCount,U=Et(t,Q8),$=T8(n),z=BA(r),J=!!(!x&&M),W=l.useMemo(function(){return y===void 0&&r==="combobox"?!1:y},[y,r]),te=l.useMemo(function(){return gy(s,J)},[JSON.stringify(s),J]),_=Fn("",{value:c!==void 0?c:A,postState:function(we){return we||""}}),se=ee(_,2),ce=se[0],ue=se[1],ne=F8(x,M,te,I,O),me=ne.valueOptions,Y=ne.labelOptions,de=ne.options,le=l.useCallback(function(Fe){var we=Nf(Fe);return we.map(function(Ke){var ze,Ue,F,ge,j;if(L8(Ke))ze=Ke;else{var re;F=Ke.key,Ue=Ke.label,ze=(re=Ke.value)!==null&&re!==void 0?re:F}var X=me.get(ze);if(X){var ve;if(Ue===void 0&&(Ue=X==null?void 0:X[O||te.label]),F===void 0&&(F=(ve=X==null?void 0:X.key)!==null&&ve!==void 0?ve:ze),ge=X==null?void 0:X.disabled,j=X==null?void 0:X.title,process.env.NODE_ENV!=="production"&&!O){var ke=X==null?void 0:X[te.label];ke!==void 0&&!l.isValidElement(ke)&&!l.isValidElement(Ue)&&ke!==Ue&&yt(!1,"`label` of `value` is not same as `label` in Select options.")}}return{label:Ue,value:ze,key:F,disabled:ge,title:j}})},[te,O,me]),Se=Fn(H,{value:P}),xe=ee(Se,2),Ce=xe[0],De=xe[1],je=l.useMemo(function(){var Fe,we=z&&Ce===null?[]:Ce,Ke=le(we);return r==="combobox"&&zT((Fe=Ke[0])===null||Fe===void 0?void 0:Fe.value)?[]:Ke},[Ce,le,r,z]),Le=x8(je,me),Ie=ee(Le,2),pe=Ie[0],Oe=Ie[1],Ze=l.useMemo(function(){if(!r&&pe.length===1){var Fe=pe[0];if(Fe.value===null&&(Fe.label===null||Fe.label===void 0))return[]}return pe.map(function(we){var Ke;return L(L({},we),{},{label:(Ke=typeof k=="function"?k(we):we.label)!==null&&Ke!==void 0?Ke:we.value})})},[r,pe,k]),tt=l.useMemo(function(){return new Set(pe.map(function(Fe){return Fe.value}))},[pe]);l.useEffect(function(){if(r==="combobox"){var Fe,we=(Fe=pe[0])===null||Fe===void 0?void 0:Fe.value;ue(VT(we)?String(we):"")}},[pe]);var rt=qm(function(Fe,we){var Ke=we??Fe;return Q(Q({},te.value,Fe),te.label,Ke)}),Ge=l.useMemo(function(){if(r!=="tags")return de;var Fe=Re(de),we=function(ze){return me.has(ze)};return Re(pe).sort(function(Ke,ze){return Ke.value<ze.value?-1:1}).forEach(function(Ke){var ze=Ke.value;we(ze)||Fe.push(rt(ze,Ke.label))}),Fe},[rt,de,me,pe,r]),be=R8(Ge,te,ce,W,I),Je=l.useMemo(function(){return r!=="tags"||!ce||be.some(function(Fe){return Fe[I||"value"]===ce})||be.some(function(Fe){return Fe[te.value]===ce})?be:[rt(ce)].concat(Re(be))},[rt,I,r,be,ce,te]),lt=function Fe(we){var Ke=Re(we).sort(function(ze,Ue){return w(ze,Ue,{searchValue:ce})});return Ke.map(function(ze){return Array.isArray(ze.options)?L(L({},ze),{},{options:ze.options.length>0?Fe(ze.options):ze.options}):ze})},$e=l.useMemo(function(){return w?lt(Je):Je},[Je,w,ce]),Be=l.useMemo(function(){return n8($e,{fieldNames:te,childrenAsData:J})},[$e,te,J]),Me=function(we){var Ke=le(we);if(De(Ke),V&&(Ke.length!==pe.length||Ke.some(function(F,ge){var j;return((j=pe[ge])===null||j===void 0?void 0:j.value)!==(F==null?void 0:F.value)}))){var ze=Z?Ke:Ke.map(function(F){return F.value}),Ue=Ke.map(function(F){return xd(Oe(F.value))});V(z?ze:ze[0],z?Ue:Ue[0])}},st=l.useState(null),At=ee(st,2),Ct=At[0],Nt=At[1],Jt=l.useState(0),Wt=ee(Jt,2),en=Wt[0],_t=Wt[1],Zt=E!==void 0?E:r!=="combobox",Rt=l.useCallback(function(Fe,we){var Ke=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},ze=Ke.source,Ue=ze===void 0?"keyboard":ze;_t(we),a&&r==="combobox"&&Fe!==null&&Ue==="keyboard"&&Nt(String(Fe))},[a,r]),pt=function(we,Ke,ze){var Ue=function(){var ft,St=Oe(we);return[Z?{label:St==null?void 0:St[te.label],value:we,key:(ft=St==null?void 0:St.key)!==null&&ft!==void 0?ft:we}:we,xd(St)]};if(Ke&&p){var F=Ue(),ge=ee(F,2),j=ge[0],re=ge[1];p(j,re)}else if(!Ke&&v&&ze!=="clear"){var X=Ue(),ve=ee(X,2),ke=ve[0],Xe=ve[1];v(ke,Xe)}},Ve=qm(function(Fe,we){var Ke,ze=z?we.selected:!0;ze?Ke=z?[].concat(Re(pe),[Fe]):[Fe]:Ke=pe.filter(function(Ue){return Ue.value!==Fe}),Me(Ke),pt(Fe,ze),r==="combobox"?Nt(""):(!BA||f)&&(ue(""),Nt(""))}),_e=function(we,Ke){Me(we);var ze=Ke.type,Ue=Ke.values;(ze==="remove"||ze==="clear")&&Ue.forEach(function(F){pt(F.value,!1,ze)})},Te=function(we,Ke){if(ue(we),Nt(null),Ke.source==="submit"){var ze=(we||"").trim();if(ze){var Ue=Array.from(new Set([].concat(Re(tt),[ze])));Me(Ue),pt(ze,!0),ue("")}return}Ke.source!=="blur"&&(r==="combobox"&&Me(we),u==null||u(we))},ot=function(we){var Ke=we;r!=="tags"&&(Ke=we.map(function(Ue){var F=Y.get(Ue);return F==null?void 0:F.value}).filter(function(Ue){return Ue!==void 0}));var ze=Array.from(new Set([].concat(Re(tt),Re(Ke))));Me(ze),ze.forEach(function(Ue){pt(Ue,!0)})},mt=l.useMemo(function(){var Fe=h!==!1&&m!==!1;return L(L({},ne),{},{flattenOptions:Be,onActiveValue:Rt,defaultActiveFirstOption:Zt,onSelect:Ve,menuItemSelectedIcon:b,rawValues:tt,fieldNames:te,virtual:Fe,direction:S,listHeight:R,listItemHeight:B,childrenAsData:J,maxCount:q,optionRender:g})},[q,ne,Be,Rt,Zt,Ve,b,tt,te,h,m,S,R,B,J,g]);return process.env.NODE_ENV!=="production"&&(k8(t),P8(de,te)),l.createElement(Df.Provider,{value:mt},l.createElement(hy,Qe({},U,{id:$,prefixCls:o,ref:e,omitDomProps:j8,mode:r,displayValues:Ze,onDisplayValuesChange:_e,direction:S,searchValue:ce,onSearch:Te,autoClearSearchValue:f,onSearchSplit:ot,dropdownMatchSelectWidth:m,OptionList:Cy,emptyOptions:!Be.length,activeValue:Ct,activeDescendantId:"".concat($,"_list_").concat(en)})))});process.env.NODE_ENV!=="production"&&(yy.displayName="Select");var Pf=yy;Pf.Option=Ff;Pf.OptGroup=Bf;const Ey=()=>{const[,t]=dr(),[e]=HA("Empty"),r=new Gt(t.colorBgBase).toHsl().l<.5?{opacity:.65}:{};return l.createElement("svg",{style:r,width:"184",height:"152",viewBox:"0 0 184 152",xmlns:"http://www.w3.org/2000/svg"},l.createElement("title",null,(e==null?void 0:e.description)||"Empty"),l.createElement("g",{fill:"none",fillRule:"evenodd"},l.createElement("g",{transform:"translate(24 31.67)"},l.createElement("ellipse",{fillOpacity:".8",fill:"#F5F5F7",cx:"67.797",cy:"106.89",rx:"67.797",ry:"12.668"}),l.createElement("path",{d:"M122.034 69.674L98.109 40.229c-1.148-1.386-2.826-2.225-4.593-2.225h-51.44c-1.766 0-3.444.839-4.592 2.225L13.56 69.674v15.383h108.475V69.674z",fill:"#AEB8C2"}),l.createElement("path",{d:"M101.537 86.214L80.63 61.102c-1.001-1.207-2.507-1.867-4.048-1.867H31.724c-1.54 0-3.047.66-4.048 1.867L6.769 86.214v13.792h94.768V86.214z",fill:"url(#linearGradient-1)",transform:"translate(13.56)"}),l.createElement("path",{d:"M33.83 0h67.933a4 4 0 0 1 4 4v93.344a4 4 0 0 1-4 4H33.83a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z",fill:"#F5F5F7"}),l.createElement("path",{d:"M42.678 9.953h50.237a2 2 0 0 1 2 2V36.91a2 2 0 0 1-2 2H42.678a2 2 0 0 1-2-2V11.953a2 2 0 0 1 2-2zM42.94 49.767h49.713a2.262 2.262 0 1 1 0 4.524H42.94a2.262 2.262 0 0 1 0-4.524zM42.94 61.53h49.713a2.262 2.262 0 1 1 0 4.525H42.94a2.262 2.262 0 0 1 0-4.525zM121.813 105.032c-.775 3.071-3.497 5.36-6.735 5.36H20.515c-3.238 0-5.96-2.29-6.734-5.36a7.309 7.309 0 0 1-.222-1.79V69.675h26.318c2.907 0 5.25 2.448 5.25 5.42v.04c0 2.971 2.37 5.37 5.277 5.37h34.785c2.907 0 5.277-2.421 5.277-5.393V75.1c0-2.972 2.343-5.426 5.25-5.426h26.318v33.569c0 .617-.077 1.216-.221 1.789z",fill:"#DCE0E6"})),l.createElement("path",{d:"M149.121 33.292l-6.83 2.65a1 1 0 0 1-1.317-1.23l1.937-6.207c-2.589-2.944-4.109-6.534-4.109-10.408C138.802 8.102 148.92 0 161.402 0 173.881 0 184 8.102 184 18.097c0 9.995-10.118 18.097-22.599 18.097-4.528 0-8.744-1.066-12.28-2.902z",fill:"#DCE0E6"}),l.createElement("g",{transform:"translate(149.65 15.383)",fill:"#FFF"},l.createElement("ellipse",{cx:"20.654",cy:"3.167",rx:"2.849",ry:"2.815"}),l.createElement("path",{d:"M5.698 5.63H0L2.898.704zM9.259.704h4.985V5.63H9.259z"}))))};process.env.NODE_ENV!=="production"&&(Ey.displayName="EmptyImage");const by=()=>{const[,t]=dr(),[e]=HA("Empty"),{colorFill:n,colorFillTertiary:r,colorFillQuaternary:i,colorBgContainer:o}=t,{borderColor:a,shadowColor:s,contentColor:A}=N.useMemo(()=>({borderColor:new Gt(n).onBackground(o).toHexString(),shadowColor:new Gt(r).onBackground(o).toHexString(),contentColor:new Gt(i).onBackground(o).toHexString()}),[n,r,i,o]);return l.createElement("svg",{width:"64",height:"41",viewBox:"0 0 64 41",xmlns:"http://www.w3.org/2000/svg"},l.createElement("title",null,(e==null?void 0:e.description)||"Empty"),l.createElement("g",{transform:"translate(0 1)",fill:"none",fillRule:"evenodd"},l.createElement("ellipse",{fill:s,cx:"32",cy:"33",rx:"32",ry:"7"}),l.createElement("g",{fillRule:"nonzero",stroke:a},l.createElement("path",{d:"M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z"}),l.createElement("path",{d:"M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z",fill:A}))))};process.env.NODE_ENV!=="production"&&(by.displayName="SimpleImage");var U8=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n};const Sy=l.createElement(Ey,null),wy=l.createElement(by,null),si=t=>{const{className:e,rootClassName:n,prefixCls:r,image:i=Sy,description:o,children:a,imageStyle:s,style:A,classNames:c,styles:u}=t,d=U8(t,["className","rootClassName","prefixCls","image","description","children","imageStyle","style","classNames","styles"]),{getPrefixCls:f,direction:p,className:v,style:C,classNames:m,styles:y}=Jr("empty"),w=f("empty",r),[I,O,x]=N6(w),[g]=HA("Empty"),M=typeof o<"u"?o:g==null?void 0:g.description,E=typeof M=="string"?M:"empty";let b=null;if(typeof i=="string"?b=l.createElement("img",{alt:E,src:i}):b=i,process.env.NODE_ENV!=="production"){const h=cn("Empty");[["imageStyle","styles: { image: {} }"]].forEach(S=>{let[T,R]=S;h.deprecated(!(T in t),T,R)})}return I(l.createElement("div",Object.assign({className:Ae(O,x,w,v,{[`${w}-normal`]:i===wy,[`${w}-rtl`]:p==="rtl"},e,n,m.root,c==null?void 0:c.root),style:Object.assign(Object.assign(Object.assign(Object.assign({},y.root),C),u==null?void 0:u.root),A)},d),l.createElement("div",{className:Ae(`${w}-image`,m.image,c==null?void 0:c.image),style:Object.assign(Object.assign(Object.assign({},s),y.image),u==null?void 0:u.image)},b),M&&l.createElement("div",{className:Ae(`${w}-description`,m.description,c==null?void 0:c.description),style:Object.assign(Object.assign({},y.description),u==null?void 0:u.description)},M),a&&l.createElement("div",{className:Ae(`${w}-footer`,m.footer,c==null?void 0:c.footer),style:Object.assign(Object.assign({},y.footer),u==null?void 0:u.footer)},a)))};si.PRESENTED_IMAGE_DEFAULT=Sy;si.PRESENTED_IMAGE_SIMPLE=wy;process.env.NODE_ENV!=="production"&&(si.displayName="Empty");const H8=t=>{const{componentName:e}=t,{getPrefixCls:n}=N.useContext(Qt),r=n("empty");switch(e){case"Table":case"List":return N.createElement(si,{image:si.PRESENTED_IMAGE_SIMPLE});case"Select":case"TreeSelect":case"Cascader":case"Transfer":case"Mentions":return N.createElement(si,{image:si.PRESENTED_IMAGE_SIMPLE,className:`${r}-small`});case"Table.filter":return null;default:return N.createElement(si,null)}},G8=t=>{const n={overflow:{adjustX:!0,adjustY:!0,shiftY:!0},htmlRegion:t==="scroll"?"scroll":"visible",dynamicInset:!0};return{bottomLeft:Object.assign(Object.assign({},n),{points:["tl","bl"],offset:[0,4]}),bottomRight:Object.assign(Object.assign({},n),{points:["tr","br"],offset:[0,4]}),topLeft:Object.assign(Object.assign({},n),{points:["bl","tl"],offset:[0,-4]}),topRight:Object.assign(Object.assign({},n),{points:["br","tr"],offset:[0,-4]})}};function q8(t,e){return t||G8(e)}var Z8={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 00-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z"}}]},name:"check",theme:"outlined"},K8=function(e,n){return l.createElement(Nn,Qe({},e,{ref:n,icon:Z8}))},Iy=l.forwardRef(K8);process.env.NODE_ENV!=="production"&&(Iy.displayName="CheckOutlined");var V8={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"}}]},name:"down",theme:"outlined"},z8=function(e,n){return l.createElement(Nn,Qe({},e,{ref:n,icon:V8}))},xy=l.forwardRef(z8);process.env.NODE_ENV!=="production"&&(xy.displayName="DownOutlined");function Y8(t){let{suffixIcon:e,clearIcon:n,menuItemSelectedIcon:r,removeIcon:i,loading:o,multiple:a,hasFeedback:s,prefixCls:A,showSuffixIcon:c,feedbackIcon:u,showArrow:d,componentName:f}=t;process.env.NODE_ENV!=="production"&&cn(f).deprecated(!n,"clearIcon","allowClear={{ clearIcon: React.ReactNode }}");const p=n??l.createElement(as,null),v=w=>e===null&&!s&&!d?null:l.createElement(l.Fragment,null,c!==!1&&w,s&&u);let C=null;if(e!==void 0)C=v(e);else if(o)C=v(l.createElement(ac,{spin:!0}));else{const w=`${A}-suffix`;C=I=>{let{open:O,showSearch:x}=I;return v(O&&x?l.createElement(gf,{className:w}):l.createElement(xy,{className:w}))}}let m=null;r!==void 0?m=r:a?m=l.createElement(Iy,null):m=null;let y=null;return i!==void 0?y=i:y=l.createElement(yc,null),{clearIcon:p,suffixIcon:C,itemIcon:m,removeIcon:y}}function W8(t,e){return e!==void 0?e:t!==null}var J8=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n};const Ry="SECRET_COMBOBOX_MODE_DO_NOT_USE",Oy=(t,e)=>{var n;const{prefixCls:r,bordered:i,className:o,rootClassName:a,getPopupContainer:s,popupClassName:A,dropdownClassName:c,listHeight:u=256,placement:d,listItemHeight:f,size:p,disabled:v,notFoundContent:C,status:m,builtinPlacements:y,dropdownMatchSelectWidth:w,popupMatchSelectWidth:I,direction:O,style:x,allowClear:g,variant:M,dropdownStyle:E,transitionName:b,tagRender:h,maxCount:S,prefix:T}=t,R=J8(t,["prefixCls","bordered","className","rootClassName","getPopupContainer","popupClassName","dropdownClassName","listHeight","placement","listItemHeight","size","disabled","notFoundContent","status","builtinPlacements","dropdownMatchSelectWidth","popupMatchSelectWidth","direction","style","allowClear","variant","dropdownStyle","transitionName","tagRender","maxCount","prefix"]),{getPopupContainer:D,getPrefixCls:B,renderEmpty:k,direction:P,virtual:H,popupMatchSelectWidth:Z,popupOverflow:V}=l.useContext(Qt),q=Jr("select"),[,U]=dr(),$=f??(U==null?void 0:U.controlHeight),z=B("select",r),J=B(),W=O??P,{compactSize:te,compactItemClassnames:_}=Xo(z,W),[se,ce]=ff("select",M,i),ue=Ur(z),[ne,me,Y]=b6(z,ue),de=l.useMemo(()=>{const{mode:Ct}=t;if(Ct!=="combobox")return Ct===Ry?"combobox":Ct},[t.mode]),le=de==="multiple"||de==="tags",Se=W8(t.suffixIcon,t.showArrow),xe=(n=I??w)!==null&&n!==void 0?n:Z,{status:Ce,hasFeedback:De,isFormItemInput:je,feedbackIcon:Le}=l.useContext(Qr),Ie=oc(Ce,m);let pe;C!==void 0?pe=C:de==="combobox"?pe=null:pe=(k==null?void 0:k("Select"))||l.createElement(H8,{componentName:"Select"});const{suffixIcon:Oe,itemIcon:Ze,removeIcon:tt,clearIcon:rt}=Y8(Object.assign(Object.assign({},R),{multiple:le,hasFeedback:De,feedbackIcon:Le,showSuffixIcon:Se,prefixCls:z,componentName:"Select"})),Ge=g===!0?{clearIcon:rt}:g,be=tr(R,["suffixIcon","itemIcon"]),Je=Ae(A||c,{[`${z}-dropdown-${W}`]:W==="rtl"},a,Y,ue,me),lt=Ui(Ct=>{var Nt;return(Nt=p??te)!==null&&Nt!==void 0?Nt:Ct}),$e=l.useContext(li),Be=v??$e,Me=Ae({[`${z}-lg`]:lt==="large",[`${z}-sm`]:lt==="small",[`${z}-rtl`]:W==="rtl",[`${z}-${se}`]:ce,[`${z}-in-form-item`]:je},wA(z,Ie,De),_,q.className,o,a,Y,ue,me),st=l.useMemo(()=>d!==void 0?d:W==="rtl"?"bottomRight":"bottomLeft",[d,W]);if(process.env.NODE_ENV!=="production"){const Ct=cn("Select");Ct.deprecated(!c,"dropdownClassName","popupClassName"),Ct.deprecated(w===void 0,"dropdownMatchSelectWidth","popupMatchSelectWidth"),process.env.NODE_ENV!=="production"&&Ct(!("showArrow"in t),"deprecated","`showArrow` is deprecated which will be removed in next major version. It will be a default behavior, you can hide it by setting `suffixIcon` to null."),Ct.deprecated(!("bordered"in t),"bordered","variant"),process.env.NODE_ENV!=="production"&&Ct(!(typeof S<"u"&&!le),"usage","`maxCount` only works with mode `multiple` or `tags`")}const[At]=ts("SelectLike",E==null?void 0:E.zIndex);return ne(l.createElement(Pf,Object.assign({ref:e,virtual:H,showSearch:q.showSearch},be,{style:Object.assign(Object.assign({},q.style),x),dropdownMatchSelectWidth:xe,transitionName:sc(J,"slide-up",b),builtinPlacements:q8(y,V),listHeight:u,listItemHeight:$,mode:de,prefixCls:z,placement:st,direction:W,prefix:T,suffixIcon:Oe,menuItemSelectedIcon:Ze,removeIcon:tt,allowClear:Ge,notFoundContent:pe,className:Me,getPopupContainer:s||D,dropdownClassName:Je,disabled:Be,dropdownStyle:Object.assign(Object.assign({},E),{zIndex:At}),maxCount:le?S:void 0,tagRender:le?h:void 0})))};process.env.NODE_ENV!=="production"&&(Oy.displayName="Select");const go=l.forwardRef(Oy),_8=TC(go,"dropdownAlign");go.SECRET_COMBOBOX_MODE_DO_NOT_USE=Ry;go.Option=Ff;go.OptGroup=Bf;go._InternalPanelDoNotUseOrYouWillBeFired=_8;process.env.NODE_ENV!=="production"&&(go.displayName="Select");function $8(t,e,n){var r=n||{},i=r.noTrailing,o=i===void 0?!1:i,a=r.noLeading,s=a===void 0?!1:a,A=r.debounceMode,c=A===void 0?void 0:A,u,d=!1,f=0;function p(){u&&clearTimeout(u)}function v(m){var y=m||{},w=y.upcomingOnly,I=w===void 0?!1:w;p(),d=!I}function C(){for(var m=arguments.length,y=new Array(m),w=0;w<m;w++)y[w]=arguments[w];var I=this,O=Date.now()-f;if(d)return;function x(){f=Date.now(),e.apply(I,y)}function g(){u=void 0}!s&&c&&!u&&x(),p(),c===void 0&&O>t?s?(f=Date.now(),o||(u=setTimeout(c?g:x,t))):x():o!==!0&&(u=setTimeout(c?g:x,c===void 0?t-O:t))}return C.cancel=v,C}function X8(t,e,n){var r={},i=r.atBegin,o=i===void 0?!1:i;return $8(t,e,{debounceMode:o!==!1})}const FA=100,My=FA/5,Ty=FA/2-My/2,vl=Ty*2*Math.PI,Zm=50,Km=t=>{const{dotClassName:e,style:n,hasCircleCls:r}=t;return l.createElement("circle",{className:Ae(`${e}-circle`,{[`${e}-circle-bg`]:r}),r:Ty,cx:Zm,cy:Zm,strokeWidth:My,style:n})},eN=t=>{let{percent:e,prefixCls:n}=t;const r=`${n}-dot`,i=`${r}-holder`,o=`${i}-hidden`,[a,s]=l.useState(!1);Xt(()=>{e!==0&&s(!0)},[e!==0]);const A=Math.max(Math.min(e,100),0);if(!a)return null;const c={strokeDashoffset:`${vl/4}`,strokeDasharray:`${vl*A/100} ${vl*(100-A)/100}`};return l.createElement("span",{className:Ae(i,`${r}-progress`,A<=0&&o)},l.createElement("svg",{viewBox:`0 0 ${FA} ${FA}`,role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":A},l.createElement(Km,{dotClassName:r,hasCircleCls:!0}),l.createElement(Km,{dotClassName:r,style:c})))};function tN(t){const{prefixCls:e,percent:n=0}=t,r=`${e}-dot`,i=`${r}-holder`,o=`${i}-hidden`;return l.createElement(l.Fragment,null,l.createElement("span",{className:Ae(i,n>0&&o)},l.createElement("span",{className:Ae(r,`${e}-dot-spin`)},[1,2,3,4].map(a=>l.createElement("i",{className:`${e}-dot-item`,key:a})))),l.createElement(eN,{prefixCls:e,percent:n}))}function nN(t){const{prefixCls:e,indicator:n,percent:r}=t,i=`${e}-dot`;return n&&l.isValidElement(n)?kr(n,{className:Ae(n.props.className,i),percent:r}):l.createElement(tN,{prefixCls:e,percent:r})}const rN=200,Vm=[[30,.05],[70,.03],[96,.01]];function iN(t,e){const[n,r]=l.useState(0),i=l.useRef(null),o=e==="auto";return l.useEffect(()=>(o&&t&&(r(0),i.current=setInterval(()=>{r(a=>{const s=100-a;for(let A=0;A<Vm.length;A+=1){const[c,u]=Vm[A];if(a<=c)return a+s*u}return a})},rN)),()=>{clearInterval(i.current)}),[o,t]),o?n:e}var oN=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n};let Ny;function aN(t,e){return!!t&&!!e&&!Number.isNaN(Number(e))}const Sc=t=>{var e;const{prefixCls:n,spinning:r=!0,delay:i=0,className:o,rootClassName:a,size:s="default",tip:A,wrapperClassName:c,style:u,children:d,fullscreen:f=!1,indicator:p,percent:v}=t,C=oN(t,["prefixCls","spinning","delay","className","rootClassName","size","tip","wrapperClassName","style","children","fullscreen","indicator","percent"]),{getPrefixCls:m,direction:y,className:w,style:I,indicator:O}=Jr("spin"),x=m("spin",n),[g,M,E]=R6(x),[b,h]=l.useState(()=>r&&!aN(r,i)),S=iN(b,v);l.useEffect(()=>{if(r){const H=X8(i,()=>{h(!0)});return H(),()=>{var Z;(Z=H==null?void 0:H.cancel)===null||Z===void 0||Z.call(H)}}h(!1)},[i,r]);const T=l.useMemo(()=>typeof d<"u"&&!f,[d,f]);if(process.env.NODE_ENV!=="production"){const H=cn("Spin");process.env.NODE_ENV!=="production"&&H(!A||T||f,"usage","`tip` only work in nest or fullscreen pattern.")}const R=Ae(x,w,{[`${x}-sm`]:s==="small",[`${x}-lg`]:s==="large",[`${x}-spinning`]:b,[`${x}-show-text`]:!!A,[`${x}-rtl`]:y==="rtl"},o,!f&&a,M,E),D=Ae(`${x}-container`,{[`${x}-blur`]:b}),B=(e=p??O)!==null&&e!==void 0?e:Ny,k=Object.assign(Object.assign({},I),u),P=l.createElement("div",Object.assign({},C,{style:k,className:R,"aria-live":"polite","aria-busy":b}),l.createElement(nN,{prefixCls:x,indicator:B,percent:S}),A&&(T||f)?l.createElement("div",{className:`${x}-text`},A):null);return g(T?l.createElement("div",Object.assign({},C,{className:Ae(`${x}-nested-loading`,c,M,E)}),b&&l.createElement("div",{key:"loading"},P),l.createElement("div",{className:D,key:"container"},d)):f?l.createElement("div",{className:Ae(`${x}-fullscreen`,{[`${x}-fullscreen-show`]:b},a,M,E)},P):P)};Sc.setDefaultIndicator=t=>{Ny=t};process.env.NODE_ENV!=="production"&&(Sc.displayName="Spin");const sN=["1","2","3","4","5","6","7","8","9","*","0","#"],Dy=({onCallBack:t})=>ae.jsx(AN,{children:sN.map(e=>ae.jsx("div",{className:"ysyt-key-item",onClick:()=>t(e),children:e},e))}),AN=on.div`
626
+ `].includes(wt)})},[B]),Ke=l.useContext(Df)||{},ze=Ke.maxCount,Ue=Ke.rawValues,F=function(qe,gt,bt){if(!(Ce&&Id(ze)&&(Ue==null?void 0:Ue.size)>=ze)){var Tt=!0,Bt=qe;b==null||b(null);var wn=r8(qe,B,Id(ze)?ze-Ue.size:void 0),In=bt?null:wn;return m!=="combobox"&&In&&(Bt="",D==null||D(In),Fe(!1),Tt=!1),R&&At!==Bt&&R(Bt,{source:gt?"typing":"effect"}),Tt}},ge=function(qe){!qe||!qe.trim()||R(qe,{source:"submit"})};l.useEffect(function(){!Te&&!Ce&&m!=="combobox"&&F("",!1,!1)},[Te]),l.useEffect(function(){Ve&&y&&_e(!1),y&&!Je.current&&Me(!1)},[y]);var j=ly(),re=ee(j,2),X=re[0],ve=re[1],ke=l.useRef(!1),Xe=function(qe){var gt=X(),bt=qe.key,Tt=bt==="Enter";if(Tt&&(m!=="combobox"&&qe.preventDefault(),Te||Fe(!0)),ve(!!At),bt==="Backspace"&&!gt&&Ce&&!At&&u.length){for(var Bt=Re(u),wn=null,In=Bt.length-1;In>=0;In-=1){var Wn=Bt[In];if(!Wn.disabled){Bt.splice(In,1),wn=Wn;break}}wn&&d(Bt,{type:"remove",values:[wn]})}for(var rr=arguments.length,Jn=new Array(rr>1?rr-1:0),_n=1;_n<rr;_n++)Jn[_n-1]=arguments[_n];if(Te&&(!Tt||!ke.current)){var vn;Tt&&(ke.current=!0),(vn=be.current)===null||vn===void 0||vn.onKeyDown.apply(vn,[qe].concat(Jn))}le==null||le.apply(void 0,[qe].concat(Jn))},Ft=function(qe){for(var gt=arguments.length,bt=new Array(gt>1?gt-1:0),Tt=1;Tt<gt;Tt++)bt[Tt-1]=arguments[Tt];if(Te){var Bt;(Bt=be.current)===null||Bt===void 0||Bt.onKeyUp.apply(Bt,[qe].concat(bt))}qe.key==="Enter"&&(ke.current=!1),de==null||de.apply(void 0,[qe].concat(bt))},ft=function(qe){var gt=u.filter(function(bt){return bt!==qe});d(gt,{type:"remove",values:[qe]})},St=function(){ke.current=!1},Ee=l.useRef(!1),Ne=function(){Me(!0),y||(me&&!Ee.current&&me.apply(void 0,arguments),ne.includes("focus")&&Fe(!0)),Ee.current=!0},ct=function(){Je.current=!0,Me(!1,function(){Ee.current=!1,Je.current=!1,Fe(!1)}),!y&&(At&&(m==="tags"?R(At,{source:"submit"}):m==="multiple"&&R("",{source:"blur"})),Y&&Y.apply(void 0,arguments))},ut=[];l.useEffect(function(){return function(){ut.forEach(function(wt){return clearTimeout(wt)}),ut.splice(0,ut.length)}},[]);var kt=function(qe){var gt,bt=qe.target,Tt=(gt=rt.current)===null||gt===void 0?void 0:gt.getPopupElement();if(Tt&&Tt.contains(bt)){var Bt=setTimeout(function(){var rr=ut.indexOf(Bt);if(rr!==-1&&ut.splice(rr,1),st(),!pe&&!Tt.contains(document.activeElement)){var Jn;(Jn=Ge.current)===null||Jn===void 0||Jn.focus()}});ut.push(Bt)}for(var wn=arguments.length,In=new Array(wn>1?wn-1:0),Wn=1;Wn<wn;Wn++)In[Wn-1]=arguments[Wn];Se==null||Se.apply(void 0,[qe].concat(In))},Pn=l.useState({}),ln=ee(Pn,2),Yn=ln[1];function Hr(){Yn({})}var Hn;Nt&&(Hn=function(qe){Fe(qe)}),LT(function(){var wt;return[Ze.current,(wt=rt.current)===null||wt===void 0?void 0:wt.getPopupElement()]},mt,Fe,!!Nt);var Gn=l.useMemo(function(){return L(L({},t),{},{notFoundContent:v,open:Te,triggerOpen:mt,id:r,showSearch:De,multiple:Ce,toggleOpen:Fe})},[t,v,mt,Te,r,De,Ce,Fe]),xr=!!H||w,qn;xr&&(qn=l.createElement(bc,{className:Ae("".concat(i,"-arrow"),Q({},"".concat(i,"-arrow-loading"),w)),customizeIcon:H,customizeIconProps:{loading:w,searchValue:At,open:Te,focused:Be,showSearch:De}}));var Xr=function(){var qe;C==null||C(),(qe=Ge.current)===null||qe===void 0||qe.focus(),d([],{type:"clear",values:u}),F("",!1,!1)},Rr=PT(i,Xr,u,k,Z,y,At,m),Zn=Rr.allowClear,nr=Rr.clearIcon,gr=l.createElement(V,{ref:be}),hr=Ae(i,o,Q(Q(Q(Q(Q(Q(Q(Q(Q(Q({},"".concat(i,"-focused"),Be),"".concat(i,"-multiple"),Ce),"".concat(i,"-single"),!Ce),"".concat(i,"-allow-clear"),k),"".concat(i,"-show-arrow"),xr),"".concat(i,"-disabled"),y),"".concat(i,"-loading"),w),"".concat(i,"-open"),Te),"".concat(i,"-customize-input"),Ct),"".concat(i,"-show-search"),De)),Gr=l.createElement(fy,{ref:rt,disabled:y,prefixCls:i,visible:mt,popupElement:gr,animation:q,transitionName:U,dropdownStyle:$,dropdownClassName:z,direction:A,dropdownMatchSelectWidth:J,dropdownRender:W,dropdownAlign:te,placement:_,builtinPlacements:se,getPopupContainer:ce,empty:f,getTriggerDOMNode:function(qe){return tt.current||qe},onPopupVisibleChange:Hn,onPopupMouseEnter:Hr},Nt?l.cloneElement(Nt,{ref:Jt}):l.createElement(dy,Qe({},t,{domRef:tt,prefixCls:i,inputElement:Ct,ref:Ge,id:r,prefix:P,showSearch:De,autoClearSearchValue:T,mode:m,activeDescendantId:h,tagRender:s,values:u,open:Te,onToggleOpen:Fe,activeValue:E,searchValue:At,onSearch:F,onSearchSubmit:ge,onRemove:ft,tokenWithEnter:we,onInputBlur:St}))),ei;return Nt?ei=Gr:ei=l.createElement("div",Qe({className:hr},je,{ref:Ze,onMouseDown:kt,onKeyDown:Xe,onKeyUp:Ft,onFocus:Ne,onBlur:ct}),l.createElement(i8,{visible:Be&&!Te,values:u}),Gr,qn,Zn&&nr),l.createElement(cy.Provider,{value:Gn},ei)});process.env.NODE_ENV!=="production"&&(hy.displayName="BaseSelect");var Bf=function(){return null};Bf.isSelectOptGroup=!0;var Ff=function(){return null};Ff.isSelectOption=!0;var py=l.forwardRef(function(t,e){var n=t.height,r=t.offsetY,i=t.offsetX,o=t.children,a=t.prefixCls,s=t.onInnerResize,A=t.innerProps,c=t.rtl,u=t.extra,d={},f={display:"flex",flexDirection:"column"};return r!==void 0&&(d={height:n,position:"relative",overflow:"hidden"},f=L(L({},f),{},Q(Q(Q(Q(Q({transform:"translateY(".concat(r,"px)")},c?"marginRight":"marginLeft",-i),"position","absolute"),"left",0),"right",0),"top",0))),l.createElement("div",{style:d},l.createElement(hi,{onResize:function(v){var C=v.offsetHeight;C&&s&&s()}},l.createElement("div",Qe({style:f,className:Ae(Q({},"".concat(a,"-holder-inner"),a)),ref:e},A),o,u)))});py.displayName="Filler";function s8(t){var e=t.children,n=t.setRef,r=l.useCallback(function(i){n(i)},[]);return l.cloneElement(e,{ref:r})}function A8(t,e,n,r,i,o,a,s){var A=s.getKey;return t.slice(e,n+1).map(function(c,u){var d=e+u,f=a(c,d,{style:{width:r},offsetX:i}),p=A(c);return l.createElement(s8,{key:p,setRef:function(C){return o(c,C)}},f)})}function c8(t,e,n){var r=t.length,i=e.length,o,a;if(r===0&&i===0)return null;r<i?(o=t,a=e):(o=e,a=t);var s={__EMPTY_ITEM__:!0};function A(v){return v!==void 0?n(v):s}for(var c=null,u=Math.abs(r-i)!==1,d=0;d<a.length;d+=1){var f=A(o[d]),p=A(a[d]);if(f!==p){c=d,u=u||f!==A(a[d+1]);break}}return c===null?null:{index:c,multiple:u}}function l8(t,e,n){var r=l.useState(t),i=ee(r,2),o=i[0],a=i[1],s=l.useState(null),A=ee(s,2),c=A[0],u=A[1];return l.useEffect(function(){var d=c8(o||[],t||[],e);(d==null?void 0:d.index)!==void 0&&u(t[d.index]),a(t)},[t]),[c]}var km=(typeof navigator>"u"?"undefined":et(navigator))==="object"&&/Firefox/i.test(navigator.userAgent);const my=function(t,e,n,r){var i=N.useRef(!1),o=N.useRef(null);function a(){clearTimeout(o.current),i.current=!0,o.current=setTimeout(function(){i.current=!1},50)}var s=N.useRef({top:t,bottom:e,left:n,right:r});return s.current.top=t,s.current.bottom=e,s.current.left=n,s.current.right=r,function(A,c){var u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,d=A?c<0&&s.current.left||c>0&&s.current.right:c<0&&s.current.top||c>0&&s.current.bottom;return u&&d?(clearTimeout(o.current),i.current=!1):(!d||i.current)&&a(),!i.current&&d}};function u8(t,e,n,r,i,o,a){var s=N.useRef(0),A=N.useRef(null),c=N.useRef(null),u=N.useRef(!1),d=my(e,n,r,i);function f(w,I){if(qt.cancel(A.current),!d(!1,I)){var O=w;if(!O._virtualHandled)O._virtualHandled=!0;else return;s.current+=I,c.current=I,km||O.preventDefault(),A.current=qt(function(){var x=u.current?10:1;a(s.current*x,!1),s.current=0})}}function p(w,I){a(I,!0),km||w.preventDefault()}var v=N.useRef(null),C=N.useRef(null);function m(w){if(t){qt.cancel(C.current),C.current=qt(function(){v.current=null},2);var I=w.deltaX,O=w.deltaY,x=w.shiftKey,g=I,M=O;(v.current==="sx"||!v.current&&x&&O&&!I)&&(g=O,M=0,v.current="sx");var E=Math.abs(g),b=Math.abs(M);v.current===null&&(v.current=o&&E>b?"x":"y"),v.current==="y"?f(w,M):p(w,g)}}function y(w){t&&(u.current=w.detail===c.current)}return[m,y]}function d8(t,e,n,r){var i=l.useMemo(function(){return[new Map,[]]},[t,n.id,r]),o=ee(i,2),a=o[0],s=o[1],A=function(u){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u,f=a.get(u),p=a.get(d);if(f===void 0||p===void 0)for(var v=t.length,C=s.length;C<v;C+=1){var m,y=t[C],w=e(y);a.set(w,C);var I=(m=n.get(w))!==null&&m!==void 0?m:r;if(s[C]=(s[C-1]||0)+I,w===u&&(f=C),w===d&&(p=C),f!==void 0&&p!==void 0)break}return{top:s[f-1]||0,bottom:s[p]}};return A}var f8=function(){function t(){pn(this,t),Q(this,"maps",void 0),Q(this,"id",0),Q(this,"diffRecords",new Map),this.maps=Object.create(null)}return mn(t,[{key:"set",value:function(n,r){this.diffRecords.set(n,this.maps[n]),this.maps[n]=r,this.id+=1}},{key:"get",value:function(n){return this.maps[n]}},{key:"resetRecord",value:function(){this.diffRecords.clear()}},{key:"getRecord",value:function(){return this.diffRecords}}]),t}();function Pm(t){var e=parseFloat(t);return isNaN(e)?0:e}function g8(t,e,n){var r=l.useState(0),i=ee(r,2),o=i[0],a=i[1],s=N.useRef(new Map),A=N.useRef(new f8),c=N.useRef(0);function u(){c.current+=1}function d(){var p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;u();var v=function(){var y=!1;s.current.forEach(function(w,I){if(w&&w.offsetParent){var O=w.offsetHeight,x=getComputedStyle(w),g=x.marginTop,M=x.marginBottom,E=Pm(g),b=Pm(M),h=O+E+b;A.current.get(I)!==h&&(A.current.set(I,h),y=!0)}}),y&&a(function(w){return w+1})};if(p)v();else{c.current+=1;var C=c.current;Promise.resolve().then(function(){C===c.current&&v()})}}function f(p,v){var C=t(p);s.current.get(C),v?(s.current.set(C,v),d()):s.current.delete(C)}return N.useEffect(function(){return u},[]),[f,d,A.current,o]}var Qm=14/15;function h8(t,e,n){var r=N.useRef(!1),i=N.useRef(0),o=N.useRef(0),a=N.useRef(null),s=N.useRef(null),A,c=function(p){if(r.current){var v=Math.ceil(p.touches[0].pageX),C=Math.ceil(p.touches[0].pageY),m=i.current-v,y=o.current-C,w=Math.abs(m)>Math.abs(y);w?i.current=v:o.current=C;var I=n(w,w?m:y,!1,p);I&&p.preventDefault(),clearInterval(s.current),I&&(s.current=setInterval(function(){w?m*=Qm:y*=Qm;var O=Math.floor(w?m:y);(!n(w,O,!0)||Math.abs(O)<=.1)&&clearInterval(s.current)},16))}},u=function(){r.current=!1,A()},d=function(p){A(),p.touches.length===1&&!r.current&&(r.current=!0,i.current=Math.ceil(p.touches[0].pageX),o.current=Math.ceil(p.touches[0].pageY),a.current=p.target,a.current.addEventListener("touchmove",c,{passive:!1}),a.current.addEventListener("touchend",u,{passive:!0}))};A=function(){a.current&&(a.current.removeEventListener("touchmove",c),a.current.removeEventListener("touchend",u))},Xt(function(){return t&&e.current.addEventListener("touchstart",d,{passive:!0}),function(){var f;(f=e.current)===null||f===void 0||f.removeEventListener("touchstart",d),A(),clearInterval(s.current)}},[t])}function jm(t){return Math.floor(Math.pow(t,.5))}function Rd(t,e){var n="touches"in t?t.touches[0]:t;return n[e?"pageX":"pageY"]-window[e?"scrollX":"scrollY"]}function p8(t,e,n){l.useEffect(function(){var r=e.current;if(t&&r){var i=!1,o,a,s=function(){qt.cancel(o)},A=function f(){s(),o=qt(function(){n(a),f()})},c=function(p){if(!(p.target.draggable||p.button!==0)){var v=p;v._virtualHandled||(v._virtualHandled=!0,i=!0)}},u=function(){i=!1,s()},d=function(p){if(i){var v=Rd(p,!1),C=r.getBoundingClientRect(),m=C.top,y=C.bottom;if(v<=m){var w=m-v;a=-jm(w),A()}else if(v>=y){var I=v-y;a=jm(I),A()}else s()}};return r.addEventListener("mousedown",c),r.ownerDocument.addEventListener("mouseup",u),r.ownerDocument.addEventListener("mousemove",d),function(){r.removeEventListener("mousedown",c),r.ownerDocument.removeEventListener("mouseup",u),r.ownerDocument.removeEventListener("mousemove",d),s()}}},[t])}var Lm=10;function m8(t,e,n,r,i,o,a,s){var A=l.useRef(),c=l.useState(null),u=ee(c,2),d=u[0],f=u[1];return Xt(function(){if(d&&d.times<Lm){if(!t.current){f(function(Z){return L({},Z)});return}o();var p=d.targetAlign,v=d.originAlign,C=d.index,m=d.offset,y=t.current.clientHeight,w=!1,I=p,O=null;if(y){for(var x=p||v,g=0,M=0,E=0,b=Math.min(e.length-1,C),h=0;h<=b;h+=1){var S=i(e[h]);M=g;var T=n.get(S);E=M+(T===void 0?r:T),g=E}for(var R=x==="top"?m:y-m,D=b;D>=0;D-=1){var B=i(e[D]),k=n.get(B);if(k===void 0){w=!0;break}if(R-=k,R<=0)break}switch(x){case"top":O=M-m;break;case"bottom":O=E-y+m;break;default:{var P=t.current.scrollTop,H=P+y;M<P?I="top":E>H&&(I="bottom")}}O!==null&&a(O),O!==d.lastTop&&(w=!0)}w&&f(L(L({},d),{},{times:d.times+1,targetAlign:I,lastTop:O}))}else process.env.NODE_ENV!=="production"&&(d==null?void 0:d.times)===Lm&&yt(!1,"Seems `scrollTo` with `rc-virtual-list` reach the max limitation. Please fire issue for us. Thanks.")},[d,t.current]),function(p){if(p==null){s();return}if(qt.cancel(A.current),typeof p=="number")a(p);else if(p&&et(p)==="object"){var v,C=p.align;"index"in p?v=p.index:v=e.findIndex(function(w){return i(w)===p.key});var m=p.offset,y=m===void 0?0:m;f({times:0,index:v,offset:y,originAlign:C})}}}var Od=l.forwardRef(function(t,e){var n=t.prefixCls,r=t.rtl,i=t.scrollOffset,o=t.scrollRange,a=t.onStartMove,s=t.onStopMove,A=t.onScroll,c=t.horizontal,u=t.spinSize,d=t.containerSize,f=t.style,p=t.thumbStyle,v=t.showScrollBar,C=l.useState(!1),m=ee(C,2),y=m[0],w=m[1],I=l.useState(null),O=ee(I,2),x=O[0],g=O[1],M=l.useState(null),E=ee(M,2),b=E[0],h=E[1],S=!r,T=l.useRef(),R=l.useRef(),D=l.useState(v),B=ee(D,2),k=B[0],P=B[1],H=l.useRef(),Z=function(){v===!0||v===!1||(clearTimeout(H.current),P(!0),H.current=setTimeout(function(){P(!1)},3e3))},V=o-d||0,q=d-u||0,U=l.useMemo(function(){if(i===0||V===0)return 0;var ue=i/V;return ue*q},[i,V,q]),$=function(ne){ne.stopPropagation(),ne.preventDefault()},z=l.useRef({top:U,dragging:y,pageY:x,startTop:b});z.current={top:U,dragging:y,pageY:x,startTop:b};var J=function(ne){w(!0),g(Rd(ne,c)),h(z.current.top),a(),ne.stopPropagation(),ne.preventDefault()};l.useEffect(function(){var ue=function(de){de.preventDefault()},ne=T.current,me=R.current;return ne.addEventListener("touchstart",ue,{passive:!1}),me.addEventListener("touchstart",J,{passive:!1}),function(){ne.removeEventListener("touchstart",ue),me.removeEventListener("touchstart",J)}},[]);var W=l.useRef();W.current=V;var te=l.useRef();te.current=q,l.useEffect(function(){if(y){var ue,ne=function(de){var le=z.current,Se=le.dragging,xe=le.pageY,Ce=le.startTop;qt.cancel(ue);var De=T.current.getBoundingClientRect(),je=d/(c?De.width:De.height);if(Se){var Le=(Rd(de,c)-xe)*je,Ie=Ce;!S&&c?Ie-=Le:Ie+=Le;var pe=W.current,Oe=te.current,Ze=Oe?Ie/Oe:0,tt=Math.ceil(Ze*pe);tt=Math.max(tt,0),tt=Math.min(tt,pe),ue=qt(function(){A(tt,c)})}},me=function(){w(!1),s()};return window.addEventListener("mousemove",ne,{passive:!0}),window.addEventListener("touchmove",ne,{passive:!0}),window.addEventListener("mouseup",me,{passive:!0}),window.addEventListener("touchend",me,{passive:!0}),function(){window.removeEventListener("mousemove",ne),window.removeEventListener("touchmove",ne),window.removeEventListener("mouseup",me),window.removeEventListener("touchend",me),qt.cancel(ue)}}},[y]),l.useEffect(function(){return Z(),function(){clearTimeout(H.current)}},[i]),l.useImperativeHandle(e,function(){return{delayHidden:Z}});var _="".concat(n,"-scrollbar"),se={position:"absolute",visibility:k?null:"hidden"},ce={position:"absolute",borderRadius:99,background:"var(--rc-virtual-list-scrollbar-bg, rgba(0, 0, 0, 0.5))",cursor:"pointer",userSelect:"none"};return c?(Object.assign(se,{height:8,left:0,right:0,bottom:0}),Object.assign(ce,Q({height:"100%",width:u},S?"left":"right",U))):(Object.assign(se,Q({width:8,top:0,bottom:0},S?"right":"left",0)),Object.assign(ce,{width:"100%",height:u,top:U})),l.createElement("div",{ref:T,className:Ae(_,Q(Q(Q({},"".concat(_,"-horizontal"),c),"".concat(_,"-vertical"),!c),"".concat(_,"-visible"),k)),style:L(L({},se),f),onMouseDown:$,onMouseMove:Z},l.createElement("div",{ref:R,className:Ae("".concat(_,"-thumb"),Q({},"".concat(_,"-thumb-moving"),y)),style:L(L({},ce),p),onMouseDown:J}))});process.env.NODE_ENV!=="production"&&(Od.displayName="ScrollBar");var v8=20;function Um(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=t/e*t;return isNaN(n)&&(n=0),n=Math.max(n,v8),Math.floor(n)}var C8=["prefixCls","className","height","itemHeight","fullHeight","style","data","children","itemKey","virtual","direction","scrollWidth","component","onScroll","onVirtualScroll","onVisibleChange","innerProps","extraRender","styles","showScrollBar"],y8=[],E8={overflowY:"auto",overflowAnchor:"none"};function b8(t,e){var n=t.prefixCls,r=n===void 0?"rc-virtual-list":n,i=t.className,o=t.height,a=t.itemHeight,s=t.fullHeight,A=s===void 0?!0:s,c=t.style,u=t.data,d=t.children,f=t.itemKey,p=t.virtual,v=t.direction,C=t.scrollWidth,m=t.component,y=m===void 0?"div":m,w=t.onScroll,I=t.onVirtualScroll,O=t.onVisibleChange,x=t.innerProps,g=t.extraRender,M=t.styles,E=t.showScrollBar,b=E===void 0?"optional":E,h=Et(t,C8),S=l.useCallback(function(Ee){return typeof f=="function"?f(Ee):Ee==null?void 0:Ee[f]},[f]),T=g8(S),R=ee(T,4),D=R[0],B=R[1],k=R[2],P=R[3],H=!!(p!==!1&&o&&a),Z=l.useMemo(function(){return Object.values(k.maps).reduce(function(Ee,Ne){return Ee+Ne},0)},[k.id,k.maps]),V=H&&u&&(Math.max(a*u.length,Z)>o||!!C),q=v==="rtl",U=Ae(r,Q({},"".concat(r,"-rtl"),q),i),$=u||y8,z=N.useRef(),J=N.useRef(),W=N.useRef(),te=N.useState(0),_=ee(te,2),se=_[0],ce=_[1],ue=N.useState(0),ne=ee(ue,2),me=ne[0],Y=ne[1],de=N.useState(!1),le=ee(de,2),Se=le[0],xe=le[1],Ce=function(){xe(!0)},De=function(){xe(!1)},je={getKey:S};function Le(Ee){ce(function(Ne){var ct;typeof Ee=="function"?ct=Ee(Ne):ct=Ee;var ut=Zt(ct);return z.current.scrollTop=ut,ut})}var Ie=N.useRef({start:0,end:$.length}),pe=N.useRef(),Oe=l8($,S),Ze=ee(Oe,1),tt=Ze[0];pe.current=tt;var rt=l.useMemo(function(){if(!H)return{scrollHeight:void 0,start:0,end:$.length-1,offset:void 0};if(!V){var Ee;return{scrollHeight:((Ee=J.current)===null||Ee===void 0?void 0:Ee.offsetHeight)||0,start:0,end:$.length-1,offset:void 0}}for(var Ne=0,ct,ut,kt,Pn=$.length,ln=0;ln<Pn;ln+=1){var Yn=$[ln],Hr=S(Yn),Hn=k.get(Hr),Gn=Ne+(Hn===void 0?a:Hn);Gn>=se&&ct===void 0&&(ct=ln,ut=Ne),Gn>se+o&&kt===void 0&&(kt=ln),Ne=Gn}return ct===void 0&&(ct=0,ut=0,kt=Math.ceil(o/a)),kt===void 0&&(kt=$.length-1),kt=Math.min(kt+1,$.length-1),{scrollHeight:Ne,start:ct,end:kt,offset:ut}},[V,H,se,$,P,o]),Ge=rt.scrollHeight,be=rt.start,Je=rt.end,lt=rt.offset;Ie.current.start=be,Ie.current.end=Je,l.useLayoutEffect(function(){var Ee=k.getRecord();if(Ee.size===1){var Ne=Array.from(Ee.keys())[0],ct=Ee.get(Ne),ut=$[be];if(ut&&ct===void 0){var kt=S(ut);if(kt===Ne){var Pn=k.get(Ne),ln=Pn-a;Le(function(Yn){return Yn+ln})}}}k.resetRecord()},[Ge]);var $e=l.useState({width:0,height:o}),Be=ee($e,2),Me=Be[0],st=Be[1],At=function(Ne){st({width:Ne.offsetWidth,height:Ne.offsetHeight})},Ct=N.useRef(),Nt=N.useRef(),Jt=l.useMemo(function(){return Um(Me.width,C)},[Me.width,C]),Wt=l.useMemo(function(){return Um(Me.height,Ge)},[Me.height,Ge]),en=Ge-o,_t=N.useRef(en);_t.current=en;function Zt(Ee){var Ne=Ee;return Number.isNaN(_t.current)||(Ne=Math.min(Ne,_t.current)),Ne=Math.max(Ne,0),Ne}var Rt=se<=0,pt=se>=en,Ve=me<=0,_e=me>=C,Te=my(Rt,pt,Ve,_e),ot=function(){return{x:q?-me:me,y:se}},mt=N.useRef(ot()),Fe=rn(function(Ee){if(I){var Ne=L(L({},ot()),Ee);(mt.current.x!==Ne.x||mt.current.y!==Ne.y)&&(I(Ne),mt.current=Ne)}});function we(Ee,Ne){var ct=Ee;Ne?(Wr.flushSync(function(){Y(ct)}),Fe()):Le(ct)}function Ke(Ee){var Ne=Ee.currentTarget.scrollTop;Ne!==se&&Le(Ne),w==null||w(Ee),Fe()}var ze=function(Ne){var ct=Ne,ut=C?C-Me.width:0;return ct=Math.max(ct,0),ct=Math.min(ct,ut),ct},Ue=rn(function(Ee,Ne){Ne?(Wr.flushSync(function(){Y(function(ct){var ut=ct+(q?-Ee:Ee);return ze(ut)})}),Fe()):Le(function(ct){var ut=ct+Ee;return ut})}),F=u8(H,Rt,pt,Ve,_e,!!C,Ue),ge=ee(F,2),j=ge[0],re=ge[1];h8(H,z,function(Ee,Ne,ct,ut){var kt=ut;return Te(Ee,Ne,ct)?!1:!kt||!kt._virtualHandled?(kt&&(kt._virtualHandled=!0),j({preventDefault:function(){},deltaX:Ee?Ne:0,deltaY:Ee?0:Ne}),!0):!1}),p8(V,z,function(Ee){Le(function(Ne){return Ne+Ee})}),Xt(function(){function Ee(ct){var ut=Rt&&ct.detail<0,kt=pt&&ct.detail>0;H&&!ut&&!kt&&ct.preventDefault()}var Ne=z.current;return Ne.addEventListener("wheel",j,{passive:!1}),Ne.addEventListener("DOMMouseScroll",re,{passive:!0}),Ne.addEventListener("MozMousePixelScroll",Ee,{passive:!1}),function(){Ne.removeEventListener("wheel",j),Ne.removeEventListener("DOMMouseScroll",re),Ne.removeEventListener("MozMousePixelScroll",Ee)}},[H,Rt,pt]),Xt(function(){if(C){var Ee=ze(me);Y(Ee),Fe({x:Ee})}},[Me.width,C]);var X=function(){var Ne,ct;(Ne=Ct.current)===null||Ne===void 0||Ne.delayHidden(),(ct=Nt.current)===null||ct===void 0||ct.delayHidden()},ve=m8(z,$,k,a,S,function(){return B(!0)},Le,X);l.useImperativeHandle(e,function(){return{nativeElement:W.current,getScrollInfo:ot,scrollTo:function(Ne){function ct(ut){return ut&&et(ut)==="object"&&("left"in ut||"top"in ut)}ct(Ne)?(Ne.left!==void 0&&Y(ze(Ne.left)),ve(Ne.top)):ve(Ne)}}}),Xt(function(){if(O){var Ee=$.slice(be,Je+1);O(Ee,$)}},[be,Je,$]);var ke=d8($,S,k,a),Xe=g==null?void 0:g({start:be,end:Je,virtual:V,offsetX:me,offsetY:lt,rtl:q,getSize:ke}),Ft=A8($,be,Je,C,me,D,d,je),ft=null;o&&(ft=L(Q({},A?"height":"maxHeight",o),E8),H&&(ft.overflowY="hidden",C&&(ft.overflowX="hidden"),Se&&(ft.pointerEvents="none")));var St={};return q&&(St.dir="rtl"),l.createElement("div",Qe({ref:W,style:L(L({},c),{},{position:"relative"}),className:U},St,h),l.createElement(hi,{onResize:At},l.createElement(y,{className:"".concat(r,"-holder"),style:ft,ref:z,onScroll:Ke,onMouseEnter:X},l.createElement(py,{prefixCls:r,height:Ge,offsetX:me,offsetY:lt,scrollWidth:C,onInnerResize:B,ref:J,innerProps:x,rtl:q,extra:Xe},Ft))),V&&Ge>o&&l.createElement(Od,{ref:Ct,prefixCls:r,scrollOffset:se,scrollRange:Ge,rtl:q,onScroll:we,onStartMove:Ce,onStopMove:De,spinSize:Wt,containerSize:Me.height,style:M==null?void 0:M.verticalScrollBar,thumbStyle:M==null?void 0:M.verticalScrollBarThumb,showScrollBar:b}),V&&C>Me.width&&l.createElement(Od,{ref:Nt,prefixCls:r,scrollOffset:me,scrollRange:C,rtl:q,onScroll:we,onStartMove:Ce,onStopMove:De,spinSize:Jt,containerSize:Me.width,horizontal:!0,style:M==null?void 0:M.horizontalScrollBar,thumbStyle:M==null?void 0:M.horizontalScrollBarThumb,showScrollBar:b}))}var vy=l.forwardRef(b8);vy.displayName="List";function S8(){return/(mac\sos|macintosh)/i.test(navigator.appVersion)}var w8=["disabled","title","children","style","className"];function Hm(t){return typeof t=="string"||typeof t=="number"}var I8=function(e,n){var r=QT(),i=r.prefixCls,o=r.id,a=r.open,s=r.multiple,A=r.mode,c=r.searchValue,u=r.toggleOpen,d=r.notFoundContent,f=r.onPopupScroll,p=l.useContext(Df),v=p.maxCount,C=p.flattenOptions,m=p.onActiveValue,y=p.defaultActiveFirstOption,w=p.onSelect,I=p.menuItemSelectedIcon,O=p.rawValues,x=p.fieldNames,g=p.virtual,M=p.direction,E=p.listHeight,b=p.listItemHeight,h=p.optionRender,S="".concat(i,"-item"),T=Ja(function(){return C},[a,C],function(ue,ne){return ne[0]&&ue[1]!==ne[1]}),R=l.useRef(null),D=l.useMemo(function(){return s&&Id(v)&&(O==null?void 0:O.size)>=v},[s,v,O==null?void 0:O.size]),B=function(ne){ne.preventDefault()},k=function(ne){var me;(me=R.current)===null||me===void 0||me.scrollTo(typeof ne=="number"?{index:ne}:ne)},P=l.useCallback(function(ue){return A==="combobox"?!1:O.has(ue)},[A,Re(O).toString(),O.size]),H=function(ne){for(var me=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,Y=T.length,de=0;de<Y;de+=1){var le=(ne+de*me+Y)%Y,Se=T[le]||{},xe=Se.group,Ce=Se.data;if(!xe&&!(Ce!=null&&Ce.disabled)&&(P(Ce.value)||!D))return le}return-1},Z=l.useState(function(){return H(0)}),V=ee(Z,2),q=V[0],U=V[1],$=function(ne){var me=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;U(ne);var Y={source:me?"keyboard":"mouse"},de=T[ne];if(!de){m(null,-1,Y);return}m(de.value,ne,Y)};N.useEffect(function(){$(y!==!1?H(0):-1)},[T.length,c]);var z=l.useCallback(function(ue){return A==="combobox"?String(ue).toLowerCase()===c.toLowerCase():O.has(ue)},[A,c,Re(O).toString(),O.size]);N.useEffect(function(){var ue=setTimeout(function(){if(!s&&a&&O.size===1){var me=Array.from(O)[0],Y=T.findIndex(function(de){var le=de.data;return c?String(le.value).startsWith(c):le.value===me});Y!==-1&&($(Y),k(Y))}});if(a){var ne;(ne=R.current)===null||ne===void 0||ne.scrollTo(void 0)}return function(){return clearTimeout(ue)}},[a,c]);var J=function(ne){ne!==void 0&&w(ne,{selected:!O.has(ne)}),s||u(!1)};if(l.useImperativeHandle(n,function(){return{onKeyDown:function(ne){var me=ne.which,Y=ne.ctrlKey;switch(me){case at.N:case at.P:case at.UP:case at.DOWN:{var de=0;if(me===at.UP?de=-1:me===at.DOWN?de=1:S8()&&Y&&(me===at.N?de=1:me===at.P&&(de=-1)),de!==0){var le=H(q+de,de);k(le),$(le,!0)}break}case at.TAB:case at.ENTER:{var Se,xe=T[q];xe&&!(xe!=null&&(Se=xe.data)!==null&&Se!==void 0&&Se.disabled)&&!D?J(xe.value):J(void 0),a&&ne.preventDefault();break}case at.ESC:u(!1),a&&ne.stopPropagation()}},onKeyUp:function(){},scrollTo:function(ne){k(ne)}}}),T.length===0)return l.createElement("div",{role:"listbox",id:"".concat(o,"_list"),className:"".concat(S,"-empty"),onMouseDown:B},d);var W=Object.keys(x).map(function(ue){return x[ue]}),te=function(ne){return ne.label};function _(ue,ne){var me=ue.group;return{role:me?"presentation":"option",id:"".concat(o,"_list_").concat(ne)}}var se=function(ne){var me=T[ne];if(!me)return null;var Y=me.data||{},de=Y.value,le=me.group,Se=ki(Y,!0),xe=te(me);return me?l.createElement("div",Qe({"aria-label":typeof xe=="string"&&!le?xe:null},Se,{key:ne},_(me,ne),{"aria-selected":z(de)}),de):null},ce={role:"listbox",id:"".concat(o,"_list")};return l.createElement(l.Fragment,null,g&&l.createElement("div",Qe({},ce,{style:{height:0,width:0,overflow:"hidden"}}),se(q-1),se(q),se(q+1)),l.createElement(vy,{itemKey:"key",ref:R,data:T,height:E,itemHeight:b,fullHeight:!1,onMouseDown:B,onScroll:f,virtual:g,direction:M,innerProps:g?null:ce},function(ue,ne){var me=ue.group,Y=ue.groupOption,de=ue.data,le=ue.label,Se=ue.value,xe=de.key;if(me){var Ce,De=(Ce=de.title)!==null&&Ce!==void 0?Ce:Hm(le)?le.toString():void 0;return l.createElement("div",{className:Ae(S,"".concat(S,"-group"),de.className),title:De},le!==void 0?le:xe)}var je=de.disabled,Le=de.title;de.children;var Ie=de.style,pe=de.className,Oe=Et(de,w8),Ze=tr(Oe,W),tt=P(Se),rt=je||!tt&&D,Ge="".concat(S,"-option"),be=Ae(S,Ge,pe,Q(Q(Q(Q({},"".concat(Ge,"-grouped"),Y),"".concat(Ge,"-active"),q===ne&&!rt),"".concat(Ge,"-disabled"),rt),"".concat(Ge,"-selected"),tt)),Je=te(ue),lt=!I||typeof I=="function"||tt,$e=typeof Je=="number"?Je:Je||Se,Be=Hm($e)?$e.toString():void 0;return Le!==void 0&&(Be=Le),l.createElement("div",Qe({},ki(Ze),g?{}:_(ue,ne),{"aria-selected":z(Se),className:be,title:Be,onMouseMove:function(){q===ne||rt||$(ne)},onClick:function(){rt||J(Se)},style:Ie}),l.createElement("div",{className:"".concat(Ge,"-content")},typeof h=="function"?h(ue,{index:ne}):$e),l.isValidElement(I)||tt,lt&&l.createElement(bc,{className:"".concat(S,"-option-state"),customizeIcon:I,customizeIconProps:{value:Se,disabled:rt,isSelected:tt}},tt?"✓":null))}))},Cy=l.forwardRef(I8);process.env.NODE_ENV!=="production"&&(Cy.displayName="OptionList");const x8=function(t,e){var n=l.useRef({values:new Map,options:new Map}),r=l.useMemo(function(){var o=n.current,a=o.values,s=o.options,A=t.map(function(d){if(d.label===void 0){var f;return L(L({},d),{},{label:(f=a.get(d.value))===null||f===void 0?void 0:f.label})}return d}),c=new Map,u=new Map;return A.forEach(function(d){c.set(d.value,d),u.set(d.value,e.get(d.value)||s.get(d.value))}),n.current.values=c,n.current.options=u,A},[t,e]),i=l.useCallback(function(o){return e.get(o)||n.current.options.get(o)},[e]);return[r,i]};function ml(t,e){return Nf(t).join("").toUpperCase().includes(e)}const R8=function(t,e,n,r,i){return l.useMemo(function(){if(!n||r===!1)return t;var o=e.options,a=e.label,s=e.value,A=[],c=typeof r=="function",u=n.toUpperCase(),d=c?r:function(p,v){return i?ml(v[i],u):v[o]?ml(v[a!=="children"?a:"label"],u):ml(v[s],u)},f=c?function(p){return xd(p)}:function(p){return p};return t.forEach(function(p){if(p[o]){var v=d(n,f(p));if(v)A.push(p);else{var C=p[o].filter(function(m){return d(n,f(m))});C.length&&A.push(L(L({},p),{},Q({},o,C)))}return}d(n,f(p))&&A.push(p)}),A},[t,r,i,n,e])};var Gm=0,O8=process.env.NODE_ENV!=="test"&&Ln();function M8(){var t;return O8?(t=Gm,Gm+=1):t="TEST_OR_SSR",t}function T8(t){var e=l.useState(),n=ee(e,2),r=n[0],i=n[1];return l.useEffect(function(){i("rc_select_".concat(M8()))},[]),t||r}var N8=["children","value"],D8=["children"];function B8(t){var e=t,n=e.key,r=e.props,i=r.children,o=r.value,a=Et(r,N8);return L({key:n,value:o!==void 0?o:n,children:i},a)}function kf(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Pr(t).map(function(n,r){if(!l.isValidElement(n)||!n.type)return null;var i=n,o=i.type.isSelectOptGroup,a=i.key,s=i.props,A=s.children,c=Et(s,D8);return e||!o?B8(n):L(L({key:"__RC_SELECT_GRP__".concat(a===null?r:a,"__"),label:a},c),{},{options:kf(A)})}).filter(function(n){return n})}var F8=function(e,n,r,i,o){return l.useMemo(function(){var a=e,s=!e;s&&(a=kf(n));var A=new Map,c=new Map,u=function(p,v,C){C&&typeof C=="string"&&p.set(v[C],v)},d=function f(p){for(var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,C=0;C<p.length;C+=1){var m=p[C];!m[r.options]||v?(A.set(m[r.value],m),u(c,m,r.label),u(c,m,i),u(c,m,o)):f(m[r.options],!0)}};return d(a),{options:a,valueOptions:A,labelOptions:c}},[e,n,r,i,o])};function qm(t){var e=l.useRef();e.current=t;var n=l.useCallback(function(){return e.current.apply(e,arguments)},[]);return n}function k8(t){var e=t.mode,n=t.options,r=t.children,i=t.backfill,o=t.allowClear,a=t.placeholder,s=t.getInputElement,A=t.showSearch,c=t.onSearch,u=t.defaultOpen,d=t.autoFocus,f=t.labelInValue,p=t.value,v=t.inputValue,C=t.optionLabelProp,m=BA(e),y=A!==void 0?A:m||e==="combobox",w=n||kf(r);if(yt(e!=="tags"||w.every(function(g){return!g.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),e==="tags"||e==="combobox"){var I=w.some(function(g){return g.options?g.options.some(function(M){return typeof("value"in M?M.value:M.key)=="number"}):typeof("value"in g?g.value:g.key)=="number"});yt(!I,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(yt(e!=="combobox"||!C,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),yt(e==="combobox"||!i,"`backfill` only works with `combobox` mode."),yt(e==="combobox"||!s,"`getInputElement` only work with `combobox` mode."),Sl(e!=="combobox"||!s||!o||!a,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),c&&!y&&e!=="combobox"&&e!=="tags"&&yt(!1,"`onSearch` should work with `showSearch` instead of use alone."),Sl(!u||d,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),p!=null){var O=Nf(p);yt(!f||O.every(function(g){return et(g)==="object"&&("key"in g||"value"in g)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),yt(!m||Array.isArray(p),"`value` should be array when `mode` is `multiple` or `tags`")}if(r){var x=null;Pr(r).some(function(g){if(!l.isValidElement(g)||!g.type)return!1;var M=g,E=M.type;if(E.isSelectOption)return!1;if(E.isSelectOptGroup){var b=Pr(g.props.children).every(function(h){return!l.isValidElement(h)||!g.type||h.type.isSelectOption?!0:(x=h.type,!1)});return!b}return x=E,!0}),x&&yt(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(x.displayName||x.name||x,"`.")),yt(v===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}function P8(t,e){if(t){var n=function r(i){for(var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=0;a<i.length;a++){var s=i[a];if(s[e==null?void 0:e.value]===null)return yt(!1,"`value` in Select options should not be `null`."),!0;if(!o&&Array.isArray(s[e==null?void 0:e.options])&&r(s[e==null?void 0:e.options],!0))break}};n(t)}}var Q8=["id","mode","prefixCls","backfill","fieldNames","inputValue","searchValue","onSearch","autoClearSearchValue","onSelect","onDeselect","dropdownMatchSelectWidth","filterOption","filterSort","optionFilterProp","optionLabelProp","options","optionRender","children","defaultActiveFirstOption","menuItemSelectedIcon","virtual","direction","listHeight","listItemHeight","labelRender","value","defaultValue","labelInValue","onChange","maxCount"],j8=["inputValue"];function L8(t){return!t||et(t)!=="object"}var yy=l.forwardRef(function(t,e){var n=t.id,r=t.mode,i=t.prefixCls,o=i===void 0?"rc-select":i,a=t.backfill,s=t.fieldNames,A=t.inputValue,c=t.searchValue,u=t.onSearch,d=t.autoClearSearchValue,f=d===void 0?!0:d,p=t.onSelect,v=t.onDeselect,C=t.dropdownMatchSelectWidth,m=C===void 0?!0:C,y=t.filterOption,w=t.filterSort,I=t.optionFilterProp,O=t.optionLabelProp,x=t.options,g=t.optionRender,M=t.children,E=t.defaultActiveFirstOption,b=t.menuItemSelectedIcon,h=t.virtual,S=t.direction,T=t.listHeight,R=T===void 0?200:T,D=t.listItemHeight,B=D===void 0?20:D,k=t.labelRender,P=t.value,H=t.defaultValue,Z=t.labelInValue,V=t.onChange,q=t.maxCount,U=Et(t,Q8),$=T8(n),z=BA(r),J=!!(!x&&M),W=l.useMemo(function(){return y===void 0&&r==="combobox"?!1:y},[y,r]),te=l.useMemo(function(){return gy(s,J)},[JSON.stringify(s),J]),_=Fn("",{value:c!==void 0?c:A,postState:function(we){return we||""}}),se=ee(_,2),ce=se[0],ue=se[1],ne=F8(x,M,te,I,O),me=ne.valueOptions,Y=ne.labelOptions,de=ne.options,le=l.useCallback(function(Fe){var we=Nf(Fe);return we.map(function(Ke){var ze,Ue,F,ge,j;if(L8(Ke))ze=Ke;else{var re;F=Ke.key,Ue=Ke.label,ze=(re=Ke.value)!==null&&re!==void 0?re:F}var X=me.get(ze);if(X){var ve;if(Ue===void 0&&(Ue=X==null?void 0:X[O||te.label]),F===void 0&&(F=(ve=X==null?void 0:X.key)!==null&&ve!==void 0?ve:ze),ge=X==null?void 0:X.disabled,j=X==null?void 0:X.title,process.env.NODE_ENV!=="production"&&!O){var ke=X==null?void 0:X[te.label];ke!==void 0&&!l.isValidElement(ke)&&!l.isValidElement(Ue)&&ke!==Ue&&yt(!1,"`label` of `value` is not same as `label` in Select options.")}}return{label:Ue,value:ze,key:F,disabled:ge,title:j}})},[te,O,me]),Se=Fn(H,{value:P}),xe=ee(Se,2),Ce=xe[0],De=xe[1],je=l.useMemo(function(){var Fe,we=z&&Ce===null?[]:Ce,Ke=le(we);return r==="combobox"&&zT((Fe=Ke[0])===null||Fe===void 0?void 0:Fe.value)?[]:Ke},[Ce,le,r,z]),Le=x8(je,me),Ie=ee(Le,2),pe=Ie[0],Oe=Ie[1],Ze=l.useMemo(function(){if(!r&&pe.length===1){var Fe=pe[0];if(Fe.value===null&&(Fe.label===null||Fe.label===void 0))return[]}return pe.map(function(we){var Ke;return L(L({},we),{},{label:(Ke=typeof k=="function"?k(we):we.label)!==null&&Ke!==void 0?Ke:we.value})})},[r,pe,k]),tt=l.useMemo(function(){return new Set(pe.map(function(Fe){return Fe.value}))},[pe]);l.useEffect(function(){if(r==="combobox"){var Fe,we=(Fe=pe[0])===null||Fe===void 0?void 0:Fe.value;ue(VT(we)?String(we):"")}},[pe]);var rt=qm(function(Fe,we){var Ke=we??Fe;return Q(Q({},te.value,Fe),te.label,Ke)}),Ge=l.useMemo(function(){if(r!=="tags")return de;var Fe=Re(de),we=function(ze){return me.has(ze)};return Re(pe).sort(function(Ke,ze){return Ke.value<ze.value?-1:1}).forEach(function(Ke){var ze=Ke.value;we(ze)||Fe.push(rt(ze,Ke.label))}),Fe},[rt,de,me,pe,r]),be=R8(Ge,te,ce,W,I),Je=l.useMemo(function(){return r!=="tags"||!ce||be.some(function(Fe){return Fe[I||"value"]===ce})||be.some(function(Fe){return Fe[te.value]===ce})?be:[rt(ce)].concat(Re(be))},[rt,I,r,be,ce,te]),lt=function Fe(we){var Ke=Re(we).sort(function(ze,Ue){return w(ze,Ue,{searchValue:ce})});return Ke.map(function(ze){return Array.isArray(ze.options)?L(L({},ze),{},{options:ze.options.length>0?Fe(ze.options):ze.options}):ze})},$e=l.useMemo(function(){return w?lt(Je):Je},[Je,w,ce]),Be=l.useMemo(function(){return n8($e,{fieldNames:te,childrenAsData:J})},[$e,te,J]),Me=function(we){var Ke=le(we);if(De(Ke),V&&(Ke.length!==pe.length||Ke.some(function(F,ge){var j;return((j=pe[ge])===null||j===void 0?void 0:j.value)!==(F==null?void 0:F.value)}))){var ze=Z?Ke:Ke.map(function(F){return F.value}),Ue=Ke.map(function(F){return xd(Oe(F.value))});V(z?ze:ze[0],z?Ue:Ue[0])}},st=l.useState(null),At=ee(st,2),Ct=At[0],Nt=At[1],Jt=l.useState(0),Wt=ee(Jt,2),en=Wt[0],_t=Wt[1],Zt=E!==void 0?E:r!=="combobox",Rt=l.useCallback(function(Fe,we){var Ke=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},ze=Ke.source,Ue=ze===void 0?"keyboard":ze;_t(we),a&&r==="combobox"&&Fe!==null&&Ue==="keyboard"&&Nt(String(Fe))},[a,r]),pt=function(we,Ke,ze){var Ue=function(){var ft,St=Oe(we);return[Z?{label:St==null?void 0:St[te.label],value:we,key:(ft=St==null?void 0:St.key)!==null&&ft!==void 0?ft:we}:we,xd(St)]};if(Ke&&p){var F=Ue(),ge=ee(F,2),j=ge[0],re=ge[1];p(j,re)}else if(!Ke&&v&&ze!=="clear"){var X=Ue(),ve=ee(X,2),ke=ve[0],Xe=ve[1];v(ke,Xe)}},Ve=qm(function(Fe,we){var Ke,ze=z?we.selected:!0;ze?Ke=z?[].concat(Re(pe),[Fe]):[Fe]:Ke=pe.filter(function(Ue){return Ue.value!==Fe}),Me(Ke),pt(Fe,ze),r==="combobox"?Nt(""):(!BA||f)&&(ue(""),Nt(""))}),_e=function(we,Ke){Me(we);var ze=Ke.type,Ue=Ke.values;(ze==="remove"||ze==="clear")&&Ue.forEach(function(F){pt(F.value,!1,ze)})},Te=function(we,Ke){if(ue(we),Nt(null),Ke.source==="submit"){var ze=(we||"").trim();if(ze){var Ue=Array.from(new Set([].concat(Re(tt),[ze])));Me(Ue),pt(ze,!0),ue("")}return}Ke.source!=="blur"&&(r==="combobox"&&Me(we),u==null||u(we))},ot=function(we){var Ke=we;r!=="tags"&&(Ke=we.map(function(Ue){var F=Y.get(Ue);return F==null?void 0:F.value}).filter(function(Ue){return Ue!==void 0}));var ze=Array.from(new Set([].concat(Re(tt),Re(Ke))));Me(ze),ze.forEach(function(Ue){pt(Ue,!0)})},mt=l.useMemo(function(){var Fe=h!==!1&&m!==!1;return L(L({},ne),{},{flattenOptions:Be,onActiveValue:Rt,defaultActiveFirstOption:Zt,onSelect:Ve,menuItemSelectedIcon:b,rawValues:tt,fieldNames:te,virtual:Fe,direction:S,listHeight:R,listItemHeight:B,childrenAsData:J,maxCount:q,optionRender:g})},[q,ne,Be,Rt,Zt,Ve,b,tt,te,h,m,S,R,B,J,g]);return process.env.NODE_ENV!=="production"&&(k8(t),P8(de,te)),l.createElement(Df.Provider,{value:mt},l.createElement(hy,Qe({},U,{id:$,prefixCls:o,ref:e,omitDomProps:j8,mode:r,displayValues:Ze,onDisplayValuesChange:_e,direction:S,searchValue:ce,onSearch:Te,autoClearSearchValue:f,onSearchSplit:ot,dropdownMatchSelectWidth:m,OptionList:Cy,emptyOptions:!Be.length,activeValue:Ct,activeDescendantId:"".concat($,"_list_").concat(en)})))});process.env.NODE_ENV!=="production"&&(yy.displayName="Select");var Pf=yy;Pf.Option=Ff;Pf.OptGroup=Bf;const Ey=()=>{const[,t]=dr(),[e]=HA("Empty"),r=new Gt(t.colorBgBase).toHsl().l<.5?{opacity:.65}:{};return l.createElement("svg",{style:r,width:"184",height:"152",viewBox:"0 0 184 152",xmlns:"http://www.w3.org/2000/svg"},l.createElement("title",null,(e==null?void 0:e.description)||"Empty"),l.createElement("g",{fill:"none",fillRule:"evenodd"},l.createElement("g",{transform:"translate(24 31.67)"},l.createElement("ellipse",{fillOpacity:".8",fill:"#F5F5F7",cx:"67.797",cy:"106.89",rx:"67.797",ry:"12.668"}),l.createElement("path",{d:"M122.034 69.674L98.109 40.229c-1.148-1.386-2.826-2.225-4.593-2.225h-51.44c-1.766 0-3.444.839-4.592 2.225L13.56 69.674v15.383h108.475V69.674z",fill:"#AEB8C2"}),l.createElement("path",{d:"M101.537 86.214L80.63 61.102c-1.001-1.207-2.507-1.867-4.048-1.867H31.724c-1.54 0-3.047.66-4.048 1.867L6.769 86.214v13.792h94.768V86.214z",fill:"url(#linearGradient-1)",transform:"translate(13.56)"}),l.createElement("path",{d:"M33.83 0h67.933a4 4 0 0 1 4 4v93.344a4 4 0 0 1-4 4H33.83a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z",fill:"#F5F5F7"}),l.createElement("path",{d:"M42.678 9.953h50.237a2 2 0 0 1 2 2V36.91a2 2 0 0 1-2 2H42.678a2 2 0 0 1-2-2V11.953a2 2 0 0 1 2-2zM42.94 49.767h49.713a2.262 2.262 0 1 1 0 4.524H42.94a2.262 2.262 0 0 1 0-4.524zM42.94 61.53h49.713a2.262 2.262 0 1 1 0 4.525H42.94a2.262 2.262 0 0 1 0-4.525zM121.813 105.032c-.775 3.071-3.497 5.36-6.735 5.36H20.515c-3.238 0-5.96-2.29-6.734-5.36a7.309 7.309 0 0 1-.222-1.79V69.675h26.318c2.907 0 5.25 2.448 5.25 5.42v.04c0 2.971 2.37 5.37 5.277 5.37h34.785c2.907 0 5.277-2.421 5.277-5.393V75.1c0-2.972 2.343-5.426 5.25-5.426h26.318v33.569c0 .617-.077 1.216-.221 1.789z",fill:"#DCE0E6"})),l.createElement("path",{d:"M149.121 33.292l-6.83 2.65a1 1 0 0 1-1.317-1.23l1.937-6.207c-2.589-2.944-4.109-6.534-4.109-10.408C138.802 8.102 148.92 0 161.402 0 173.881 0 184 8.102 184 18.097c0 9.995-10.118 18.097-22.599 18.097-4.528 0-8.744-1.066-12.28-2.902z",fill:"#DCE0E6"}),l.createElement("g",{transform:"translate(149.65 15.383)",fill:"#FFF"},l.createElement("ellipse",{cx:"20.654",cy:"3.167",rx:"2.849",ry:"2.815"}),l.createElement("path",{d:"M5.698 5.63H0L2.898.704zM9.259.704h4.985V5.63H9.259z"}))))};process.env.NODE_ENV!=="production"&&(Ey.displayName="EmptyImage");const by=()=>{const[,t]=dr(),[e]=HA("Empty"),{colorFill:n,colorFillTertiary:r,colorFillQuaternary:i,colorBgContainer:o}=t,{borderColor:a,shadowColor:s,contentColor:A}=N.useMemo(()=>({borderColor:new Gt(n).onBackground(o).toHexString(),shadowColor:new Gt(r).onBackground(o).toHexString(),contentColor:new Gt(i).onBackground(o).toHexString()}),[n,r,i,o]);return l.createElement("svg",{width:"64",height:"41",viewBox:"0 0 64 41",xmlns:"http://www.w3.org/2000/svg"},l.createElement("title",null,(e==null?void 0:e.description)||"Empty"),l.createElement("g",{transform:"translate(0 1)",fill:"none",fillRule:"evenodd"},l.createElement("ellipse",{fill:s,cx:"32",cy:"33",rx:"32",ry:"7"}),l.createElement("g",{fillRule:"nonzero",stroke:a},l.createElement("path",{d:"M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z"}),l.createElement("path",{d:"M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z",fill:A}))))};process.env.NODE_ENV!=="production"&&(by.displayName="SimpleImage");var U8=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n};const Sy=l.createElement(Ey,null),wy=l.createElement(by,null),si=t=>{const{className:e,rootClassName:n,prefixCls:r,image:i=Sy,description:o,children:a,imageStyle:s,style:A,classNames:c,styles:u}=t,d=U8(t,["className","rootClassName","prefixCls","image","description","children","imageStyle","style","classNames","styles"]),{getPrefixCls:f,direction:p,className:v,style:C,classNames:m,styles:y}=Jr("empty"),w=f("empty",r),[I,O,x]=N6(w),[g]=HA("Empty"),M=typeof o<"u"?o:g==null?void 0:g.description,E=typeof M=="string"?M:"empty";let b=null;if(typeof i=="string"?b=l.createElement("img",{alt:E,src:i}):b=i,process.env.NODE_ENV!=="production"){const h=cn("Empty");[["imageStyle","styles: { image: {} }"]].forEach(S=>{let[T,R]=S;h.deprecated(!(T in t),T,R)})}return I(l.createElement("div",Object.assign({className:Ae(O,x,w,v,{[`${w}-normal`]:i===wy,[`${w}-rtl`]:p==="rtl"},e,n,m.root,c==null?void 0:c.root),style:Object.assign(Object.assign(Object.assign(Object.assign({},y.root),C),u==null?void 0:u.root),A)},d),l.createElement("div",{className:Ae(`${w}-image`,m.image,c==null?void 0:c.image),style:Object.assign(Object.assign(Object.assign({},s),y.image),u==null?void 0:u.image)},b),M&&l.createElement("div",{className:Ae(`${w}-description`,m.description,c==null?void 0:c.description),style:Object.assign(Object.assign({},y.description),u==null?void 0:u.description)},M),a&&l.createElement("div",{className:Ae(`${w}-footer`,m.footer,c==null?void 0:c.footer),style:Object.assign(Object.assign({},y.footer),u==null?void 0:u.footer)},a)))};si.PRESENTED_IMAGE_DEFAULT=Sy;si.PRESENTED_IMAGE_SIMPLE=wy;process.env.NODE_ENV!=="production"&&(si.displayName="Empty");const H8=t=>{const{componentName:e}=t,{getPrefixCls:n}=N.useContext(Qt),r=n("empty");switch(e){case"Table":case"List":return N.createElement(si,{image:si.PRESENTED_IMAGE_SIMPLE});case"Select":case"TreeSelect":case"Cascader":case"Transfer":case"Mentions":return N.createElement(si,{image:si.PRESENTED_IMAGE_SIMPLE,className:`${r}-small`});case"Table.filter":return null;default:return N.createElement(si,null)}},G8=t=>{const n={overflow:{adjustX:!0,adjustY:!0,shiftY:!0},htmlRegion:t==="scroll"?"scroll":"visible",dynamicInset:!0};return{bottomLeft:Object.assign(Object.assign({},n),{points:["tl","bl"],offset:[0,4]}),bottomRight:Object.assign(Object.assign({},n),{points:["tr","br"],offset:[0,4]}),topLeft:Object.assign(Object.assign({},n),{points:["bl","tl"],offset:[0,-4]}),topRight:Object.assign(Object.assign({},n),{points:["br","tr"],offset:[0,-4]})}};function q8(t,e){return t||G8(e)}var Z8={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 00-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z"}}]},name:"check",theme:"outlined"},K8=function(e,n){return l.createElement(Nn,Qe({},e,{ref:n,icon:Z8}))},Iy=l.forwardRef(K8);process.env.NODE_ENV!=="production"&&(Iy.displayName="CheckOutlined");var V8={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"}}]},name:"down",theme:"outlined"},z8=function(e,n){return l.createElement(Nn,Qe({},e,{ref:n,icon:V8}))},xy=l.forwardRef(z8);process.env.NODE_ENV!=="production"&&(xy.displayName="DownOutlined");function Y8(t){let{suffixIcon:e,clearIcon:n,menuItemSelectedIcon:r,removeIcon:i,loading:o,multiple:a,hasFeedback:s,prefixCls:A,showSuffixIcon:c,feedbackIcon:u,showArrow:d,componentName:f}=t;process.env.NODE_ENV!=="production"&&cn(f).deprecated(!n,"clearIcon","allowClear={{ clearIcon: React.ReactNode }}");const p=n??l.createElement(as,null),v=w=>e===null&&!s&&!d?null:l.createElement(l.Fragment,null,c!==!1&&w,s&&u);let C=null;if(e!==void 0)C=v(e);else if(o)C=v(l.createElement(ac,{spin:!0}));else{const w=`${A}-suffix`;C=I=>{let{open:O,showSearch:x}=I;return v(O&&x?l.createElement(gf,{className:w}):l.createElement(xy,{className:w}))}}let m=null;r!==void 0?m=r:a?m=l.createElement(Iy,null):m=null;let y=null;return i!==void 0?y=i:y=l.createElement(yc,null),{clearIcon:p,suffixIcon:C,itemIcon:m,removeIcon:y}}function W8(t,e){return e!==void 0?e:t!==null}var J8=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n};const Ry="SECRET_COMBOBOX_MODE_DO_NOT_USE",Oy=(t,e)=>{var n;const{prefixCls:r,bordered:i,className:o,rootClassName:a,getPopupContainer:s,popupClassName:A,dropdownClassName:c,listHeight:u=256,placement:d,listItemHeight:f,size:p,disabled:v,notFoundContent:C,status:m,builtinPlacements:y,dropdownMatchSelectWidth:w,popupMatchSelectWidth:I,direction:O,style:x,allowClear:g,variant:M,dropdownStyle:E,transitionName:b,tagRender:h,maxCount:S,prefix:T}=t,R=J8(t,["prefixCls","bordered","className","rootClassName","getPopupContainer","popupClassName","dropdownClassName","listHeight","placement","listItemHeight","size","disabled","notFoundContent","status","builtinPlacements","dropdownMatchSelectWidth","popupMatchSelectWidth","direction","style","allowClear","variant","dropdownStyle","transitionName","tagRender","maxCount","prefix"]),{getPopupContainer:D,getPrefixCls:B,renderEmpty:k,direction:P,virtual:H,popupMatchSelectWidth:Z,popupOverflow:V}=l.useContext(Qt),q=Jr("select"),[,U]=dr(),$=f??(U==null?void 0:U.controlHeight),z=B("select",r),J=B(),W=O??P,{compactSize:te,compactItemClassnames:_}=Xo(z,W),[se,ce]=ff("select",M,i),ue=Ur(z),[ne,me,Y]=b6(z,ue),de=l.useMemo(()=>{const{mode:Ct}=t;if(Ct!=="combobox")return Ct===Ry?"combobox":Ct},[t.mode]),le=de==="multiple"||de==="tags",Se=W8(t.suffixIcon,t.showArrow),xe=(n=I??w)!==null&&n!==void 0?n:Z,{status:Ce,hasFeedback:De,isFormItemInput:je,feedbackIcon:Le}=l.useContext(Qr),Ie=oc(Ce,m);let pe;C!==void 0?pe=C:de==="combobox"?pe=null:pe=(k==null?void 0:k("Select"))||l.createElement(H8,{componentName:"Select"});const{suffixIcon:Oe,itemIcon:Ze,removeIcon:tt,clearIcon:rt}=Y8(Object.assign(Object.assign({},R),{multiple:le,hasFeedback:De,feedbackIcon:Le,showSuffixIcon:Se,prefixCls:z,componentName:"Select"})),Ge=g===!0?{clearIcon:rt}:g,be=tr(R,["suffixIcon","itemIcon"]),Je=Ae(A||c,{[`${z}-dropdown-${W}`]:W==="rtl"},a,Y,ue,me),lt=Ui(Ct=>{var Nt;return(Nt=p??te)!==null&&Nt!==void 0?Nt:Ct}),$e=l.useContext(li),Be=v??$e,Me=Ae({[`${z}-lg`]:lt==="large",[`${z}-sm`]:lt==="small",[`${z}-rtl`]:W==="rtl",[`${z}-${se}`]:ce,[`${z}-in-form-item`]:je},wA(z,Ie,De),_,q.className,o,a,Y,ue,me),st=l.useMemo(()=>d!==void 0?d:W==="rtl"?"bottomRight":"bottomLeft",[d,W]);if(process.env.NODE_ENV!=="production"){const Ct=cn("Select");Ct.deprecated(!c,"dropdownClassName","popupClassName"),Ct.deprecated(w===void 0,"dropdownMatchSelectWidth","popupMatchSelectWidth"),process.env.NODE_ENV!=="production"&&Ct(!("showArrow"in t),"deprecated","`showArrow` is deprecated which will be removed in next major version. It will be a default behavior, you can hide it by setting `suffixIcon` to null."),Ct.deprecated(!("bordered"in t),"bordered","variant"),process.env.NODE_ENV!=="production"&&Ct(!(typeof S<"u"&&!le),"usage","`maxCount` only works with mode `multiple` or `tags`")}const[At]=ts("SelectLike",E==null?void 0:E.zIndex);return ne(l.createElement(Pf,Object.assign({ref:e,virtual:H,showSearch:q.showSearch},be,{style:Object.assign(Object.assign({},q.style),x),dropdownMatchSelectWidth:xe,transitionName:sc(J,"slide-up",b),builtinPlacements:q8(y,V),listHeight:u,listItemHeight:$,mode:de,prefixCls:z,placement:st,direction:W,prefix:T,suffixIcon:Oe,menuItemSelectedIcon:Ze,removeIcon:tt,allowClear:Ge,notFoundContent:pe,className:Me,getPopupContainer:s||D,dropdownClassName:Je,disabled:Be,dropdownStyle:Object.assign(Object.assign({},E),{zIndex:At}),maxCount:le?S:void 0,tagRender:le?h:void 0})))};process.env.NODE_ENV!=="production"&&(Oy.displayName="Select");const go=l.forwardRef(Oy),_8=TC(go,"dropdownAlign");go.SECRET_COMBOBOX_MODE_DO_NOT_USE=Ry;go.Option=Ff;go.OptGroup=Bf;go._InternalPanelDoNotUseOrYouWillBeFired=_8;process.env.NODE_ENV!=="production"&&(go.displayName="Select");function $8(t,e,n){var r=n||{},i=r.noTrailing,o=i===void 0?!1:i,a=r.noLeading,s=a===void 0?!1:a,A=r.debounceMode,c=A===void 0?void 0:A,u,d=!1,f=0;function p(){u&&clearTimeout(u)}function v(m){var y=m||{},w=y.upcomingOnly,I=w===void 0?!1:w;p(),d=!I}function C(){for(var m=arguments.length,y=new Array(m),w=0;w<m;w++)y[w]=arguments[w];var I=this,O=Date.now()-f;if(d)return;function x(){f=Date.now(),e.apply(I,y)}function g(){u=void 0}!s&&c&&!u&&x(),p(),c===void 0&&O>t?s?(f=Date.now(),o||(u=setTimeout(c?g:x,t))):x():o!==!0&&(u=setTimeout(c?g:x,c===void 0?t-O:t))}return C.cancel=v,C}function X8(t,e,n){var r={},i=r.atBegin,o=i===void 0?!1:i;return $8(t,e,{debounceMode:o!==!1})}const FA=100,My=FA/5,Ty=FA/2-My/2,vl=Ty*2*Math.PI,Zm=50,Km=t=>{const{dotClassName:e,style:n,hasCircleCls:r}=t;return l.createElement("circle",{className:Ae(`${e}-circle`,{[`${e}-circle-bg`]:r}),r:Ty,cx:Zm,cy:Zm,strokeWidth:My,style:n})},eN=t=>{let{percent:e,prefixCls:n}=t;const r=`${n}-dot`,i=`${r}-holder`,o=`${i}-hidden`,[a,s]=l.useState(!1);Xt(()=>{e!==0&&s(!0)},[e!==0]);const A=Math.max(Math.min(e,100),0);if(!a)return null;const c={strokeDashoffset:`${vl/4}`,strokeDasharray:`${vl*A/100} ${vl*(100-A)/100}`};return l.createElement("span",{className:Ae(i,`${r}-progress`,A<=0&&o)},l.createElement("svg",{viewBox:`0 0 ${FA} ${FA}`,role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":A},l.createElement(Km,{dotClassName:r,hasCircleCls:!0}),l.createElement(Km,{dotClassName:r,style:c})))};function tN(t){const{prefixCls:e,percent:n=0}=t,r=`${e}-dot`,i=`${r}-holder`,o=`${i}-hidden`;return l.createElement(l.Fragment,null,l.createElement("span",{className:Ae(i,n>0&&o)},l.createElement("span",{className:Ae(r,`${e}-dot-spin`)},[1,2,3,4].map(a=>l.createElement("i",{className:`${e}-dot-item`,key:a})))),l.createElement(eN,{prefixCls:e,percent:n}))}function nN(t){const{prefixCls:e,indicator:n,percent:r}=t,i=`${e}-dot`;return n&&l.isValidElement(n)?kr(n,{className:Ae(n.props.className,i),percent:r}):l.createElement(tN,{prefixCls:e,percent:r})}const rN=200,Vm=[[30,.05],[70,.03],[96,.01]];function iN(t,e){const[n,r]=l.useState(0),i=l.useRef(null),o=e==="auto";return l.useEffect(()=>(o&&t&&(r(0),i.current=setInterval(()=>{r(a=>{const s=100-a;for(let A=0;A<Vm.length;A+=1){const[c,u]=Vm[A];if(a<=c)return a+s*u}return a})},rN)),()=>{clearInterval(i.current)}),[o,t]),o?n:e}var oN=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n};let Ny;function aN(t,e){return!!t&&!!e&&!Number.isNaN(Number(e))}const Sc=t=>{var e;const{prefixCls:n,spinning:r=!0,delay:i=0,className:o,rootClassName:a,size:s="default",tip:A,wrapperClassName:c,style:u,children:d,fullscreen:f=!1,indicator:p,percent:v}=t,C=oN(t,["prefixCls","spinning","delay","className","rootClassName","size","tip","wrapperClassName","style","children","fullscreen","indicator","percent"]),{getPrefixCls:m,direction:y,className:w,style:I,indicator:O}=Jr("spin"),x=m("spin",n),[g,M,E]=R6(x),[b,h]=l.useState(()=>r&&!aN(r,i)),S=iN(b,v);l.useEffect(()=>{if(r){const H=X8(i,()=>{h(!0)});return H(),()=>{var Z;(Z=H==null?void 0:H.cancel)===null||Z===void 0||Z.call(H)}}h(!1)},[i,r]);const T=l.useMemo(()=>typeof d<"u"&&!f,[d,f]);if(process.env.NODE_ENV!=="production"){const H=cn("Spin");process.env.NODE_ENV!=="production"&&H(!A||T||f,"usage","`tip` only work in nest or fullscreen pattern.")}const R=Ae(x,w,{[`${x}-sm`]:s==="small",[`${x}-lg`]:s==="large",[`${x}-spinning`]:b,[`${x}-show-text`]:!!A,[`${x}-rtl`]:y==="rtl"},o,!f&&a,M,E),D=Ae(`${x}-container`,{[`${x}-blur`]:b}),B=(e=p??O)!==null&&e!==void 0?e:Ny,k=Object.assign(Object.assign({},I),u),P=l.createElement("div",Object.assign({},C,{style:k,className:R,"aria-live":"polite","aria-busy":b}),l.createElement(nN,{prefixCls:x,indicator:B,percent:S}),A&&(T||f)?l.createElement("div",{className:`${x}-text`},A):null);return g(T?l.createElement("div",Object.assign({},C,{className:Ae(`${x}-nested-loading`,c,M,E)}),b&&l.createElement("div",{key:"loading"},P),l.createElement("div",{className:D,key:"container"},d)):f?l.createElement("div",{className:Ae(`${x}-fullscreen`,{[`${x}-fullscreen-show`]:b},a,M,E)},P):P)};Sc.setDefaultIndicator=t=>{Ny=t};process.env.NODE_ENV!=="production"&&(Sc.displayName="Spin");const sN=["1","2","3","4","5","6","7","8","9","*","0","#"],Dy=({onCallBack:t})=>ae.jsx(AN,{children:sN.map(e=>ae.jsx("div",{className:"ysyt-key-item",onClick:()=>t(e),children:e},e))}),AN=on.div`
627
627
  margin-top: 10px;
628
628
  display: grid;
629
629
  grid-template-columns: repeat(3, 1fr);
@@ -683,7 +683,7 @@ html body {
683
683
  &:hover {
684
684
  opacity: 0.9;
685
685
  }
686
- `;function bN({title:t,content:e,icon:n,onOk:r,onCancel:i}){const o=document.createElement("div");document.body.appendChild(o);const a=hN.createRoot(o),s=()=>{a.unmount(),o.remove()},A=async()=>{r&&await r(),s()},c=()=>{i==null||i(),s()};a.render(ae.jsx(pN,{children:ae.jsxs(mN,{children:[ae.jsxs(vN,{children:[n&&ae.jsx(CN,{children:n}),t]}),ae.jsx(yN,{children:e}),ae.jsxs(EN,{children:[ae.jsx(Ym,{onClick:c,children:"取消"}),ae.jsx(Ym,{primary:!0,onClick:A,children:"确定"})]})]})}))}const SN={1:ae.jsx(vt,{name:"ruandianhua"}),2:ae.jsx(vt,{name:"pnhone"}),3:ae.jsx(vt,{name:"sip-phone"})},wN={call_number:"",answer:"接听",reject:"拒接",hangup:"挂机",dtmf:"DTMF",unhold:"取消保持",hold:"保持",mute:"静音",unmute:"取消静音",satisfaction:"满意度",consult:"咨询",consult_transfer:"咨询转接",consult_retrieve:"取回通话",conference:"三方会议",whisper:"耳语",cancel_whisper:"取消耳语",force_insert:"强插",force_disconnect:"强拆",transfer:"转接"},IN={空闲:1,离线:0,未注册:4},xN=N.lazy(()=>Promise.resolve().then(()=>require("./ConsultModel-CYR5Tlbb.js"))),RN=N.lazy(()=>Promise.resolve().then(()=>require("./TransferModel-BwLiVDA-.js"))),Cl=on.div`
686
+ `;function bN({title:t,content:e,icon:n,onOk:r,onCancel:i}){const o=document.createElement("div");document.body.appendChild(o);const a=hN.createRoot(o),s=()=>{a.unmount(),o.remove()},A=async()=>{r&&await r(),s()},c=()=>{i==null||i(),s()};a.render(ae.jsx(pN,{children:ae.jsxs(mN,{children:[ae.jsxs(vN,{children:[n&&ae.jsx(CN,{children:n}),t]}),ae.jsx(yN,{children:e}),ae.jsxs(EN,{children:[ae.jsx(Ym,{onClick:c,children:"取消"}),ae.jsx(Ym,{primary:!0,onClick:A,children:"确定"})]})]})}))}const SN={1:ae.jsx(vt,{name:"ruandianhua"}),2:ae.jsx(vt,{name:"pnhone"}),3:ae.jsx(vt,{name:"sip-phone"})},wN={call_number:"",answer:"接听",reject:"拒接",hangup:"挂机",dtmf:"DTMF",unhold:"取消保持",hold:"保持",mute:"静音",unmute:"取消静音",satisfaction:"满意度",consult:"咨询",consult_transfer:"咨询转接",consult_retrieve:"取回通话",conference:"三方会议",whisper:"耳语",cancel_whisper:"取消耳语",force_insert:"强插",force_disconnect:"强拆",transfer:"转接"},IN={空闲:1,离线:0,未注册:4},xN=N.lazy(()=>Promise.resolve().then(()=>require("./ConsultModel-CEDn1Zuk.js"))),RN=N.lazy(()=>Promise.resolve().then(()=>require("./TransferModel-iCPa0IiO.js"))),Cl=on.div`
687
687
  width: 25px;
688
688
  height: 25px;
689
689
  background: ${({bg:t})=>t};
@@ -691,4 +691,4 @@ html body {
691
691
  display: flex;
692
692
  justify-content: center;
693
693
  align-items: center;
694
- `,ON=t=>{var Ue,F,ge;const{style:e,logBuiltinEnabled:n,browserAlertTime:r,enableBrowserAlert:i,agentNo:o,appKey:a,appSecret:s,url:A,onCallBack:c,ringingCardShow:u=!0,onLoginCancel:d,isCheckLogin:f,...p}=t,{height:v,busy:C,idle:m,unavailable:y,selectOutNumberColor:w}=e||{},I=N.useRef(),O=N.useRef(),[x,g]=N.useState(new Audio(fN)),M=N.useRef(),E=N.useRef(),[b,h]=N.useState(),[S,T]=N.useState(),[R,D]=N.useState(!1),[B,k]=N.useState(new Date().getTime()),[P,H]=N.useState(),[Z,V]=N.useState(),[q,U]=N.useState([]),[$,z]=N.useState([]),[J,W]=N.useState(""),[te,_]=N.useState(!1),[se,ce]=N.useState([]),[ue,ne]=N.useState(""),[me,Y]=N.useState(""),[de,le]=N.useState(!1),[Se,xe]=N.useState(!1),[Ce,De]=N.useState(),[je,Le]=N.useState(new Date().getTime()),[Ie,pe]=N.useState(!0),[Oe,Ze]=N.useState(""),tt=j=>{switch(j){case Mt.IDLE:return m||"#1D92E9";case Mt.BUSY:return C||"#F5212D";case Mt.UNREGISTERED:return y||"#faad14";case Mt.OFFLINE:return y||"#8c8c8c";default:return"#1D92E9"}};N.useEffect(()=>((async()=>(D(!0),I.current=kn.getInstance({agentNo:o,appKey:a,appSecret:s,url:A}),rt(),I.current.on(He.PHONE_BAR_OPERATION,j=>{console.log(j),U(j)}),f?await I.current.agent_api.checkAgentLogin({data:{agent_no:o},success:async j=>{j.data.is_login?bN({title:"当前账号已登录!",icon:ae.jsx(vt,{name:"wing",size:20}),content:"是否继续登录",onOk:async()=>{await I.current.init({...p,logBuiltinEnabled:n,browserAlertTime:r,enableBrowserAlert:i,onCallBack:()=>{const re=I.current.getEarSpeakAgent();M.current=new Audio(re);const X=I.current.getEndSpeakAgent();E.current=new Audio(X)}}),O.current=I.current.getAgentData()},onCancel:()=>{d==null||d()}}):(await I.current.init({...p,logBuiltinEnabled:n,browserAlertTime:r,enableBrowserAlert:i,onCallBack:()=>{const re=I.current.getEarSpeakAgent();M.current=new Audio(re);const X=I.current.getEndSpeakAgent();E.current=new Audio(X)}}),O.current=I.current.getAgentData())}}):(await I.current.init({...p,logBuiltinEnabled:n,browserAlertTime:r,enableBrowserAlert:i,onCallBack:()=>{const j=I.current.getEarSpeakAgent();M.current=new Audio(j);const re=I.current.getEndSpeakAgent();E.current=new Audio(re)}}),O.current=I.current.getAgentData()),k(new Date().getTime()),D(!1)))(),()=>{var j;be(x),be(M.current),(j=I.current)==null||j.destroy()}),[]);const rt=()=>{var j,re;(j=I.current)==null||j.on(He.EVENT_ALL,({event:X,data:ve})=>{switch(X){case ie.OUT_SUCCESS:case ie.CONSULT_RINGING:{Ge(x),De("out"),be(E.current);return}case ie.OUT_INCOMING_CALL:case ie.INTERNAL_OUT_INCOMING_CALL:{c==null||c(X,{customer_phone:ve.customer_phone,session_id:ve.session_id,trace_id:ve.trace_id});return}case ie.PREVIEW_OUT_INCOMING_CALL:{c==null||c(ie.PREVIEW_OUT_INCOMING_CALL,{customer_phone:ve.customer_phone,session_id:ve.session_id,preview_task_id:ve.preview_task_id,trace_id:ve.trace_id});return}case ie.OUT_OFF_ANSWER:case ie.INTERNAL_OUT_OFF_ANSWER:case ie.OUT_FAILED:case ie.CONSULT_FAILED:case ie.OUT_RINGING:case ie.CONSULT_OFF_HOOK:{X===ie.OUT_OFF_ANSWER&&(c==null||c(X,{session_id:ve.session_id})),be(x);return}case ie.CONSULT_INCOMING:case ie.TRANSFER_INCOMING_CALL:case ie.LISTEN_INCOMING_CALL:case ie.INCOMING_CALL_IN:case ie.INCOMING_CALL:{De("in"),be(E.current),(X===ie.CONSULT_INCOMING||X===ie.TRANSFER_INCOMING_CALL)&&(c==null||c(X,{agent_no:ve.agent_no,agent_name:ve.agent_name,session_id:ve.session_id})),X===ie.INCOMING_CALL?c==null||c(ie.INCOMING_CALL,{customer_phone:ve.customer_phone,session_id:ve.session_id}):X===ie.INCOMING_CALL_IN?c==null||c(ie.INCOMING_CALL_IN,{customer_phone:ve.customer_phone,session_id:ve.session_id}):X===ie.LISTEN_INCOMING_CALL&&(c==null||c(ie.LISTEN_INCOMING_CALL,{session_id:ve.session_id}));const{soft_device_ring_switch:ke}=I.current.getAgentData();if(!ke)return;Ge(M.current);return}case ie.PREDICT_INCOMING_CALL:{De("out"),be(E.current),X===ie.PREDICT_INCOMING_CALL&&(c==null||c(ie.PREDICT_INCOMING_CALL,{customer_phone:ve.customer_phone,session_id:ve.session_id}));const{soft_device_ring_switch:ke}=I.current.getAgentData();if(!ke)return;Ge(M.current);return}case ie.DUAL_CALL_INCOMING_CALL:{De("out"),be(E.current),X===ie.DUAL_CALL_INCOMING_CALL&&(c==null||c(ie.DUAL_CALL_INCOMING_CALL,{customer_phone:ve.customer_phone,session_id:ve.session_id}));const{soft_device_ring_switch:ke}=I.current.getAgentData();if(!ke)return;Ge(M.current);return}case ie.TRANSFER_OFF_HOOK:case ie.LISTEN_INCOMING_CALL_OFF_HOOK:case ie.CONSULT_CALL_IN_SUCCESS:case ie.INCOMING_CALL_IN_OFF_HOOK:case ie.INCOMING_CALL_OFF_HOOK:{X===ie.LISTEN_INCOMING_CALL_OFF_HOOK?c==null||c(X,{session_id:ve.session_id,monitored_agent_no:ve.monitored_agent_no}):c==null||c(X,{session_id:ve.session_id}),be(M.current);return}case ie.OUT_HANGUP:case ie.LISTEN_HANGUP:case ie.LISTEN_CALL_FAILED:case ie.TRANSFER_END:case ie.THREE_WAY_OUR_SIDE_HANGUP:case ie.OUR_SIDE_CONSULT_HANGUP:case ie.OTHER_SIDE_CONSULT_HANGUP:case ie.INCOMING_CALL_END:{if(c==null||c(X,{session_id:ve.session_id}),be(M.current),be(x),De(void 0),le(!1),xe(!1),X===ie.OUT_HANGUP||X===ie.INCOMING_CALL_END){const{isAgentHangup:ke}=ve,{agent_hangup_ring_switch:Xe}=I.current.getAgentData();!ke&&Xe&&Ge(E.current,!1)}return}case ie.REJECT:c==null||c(X,{session_id:ve.session_id});return;case ie.CUSTOMER_INFO:c(X,ve);return;default:return null}}),(re=I.current)==null||re.on(ie.AGENT_STATE,X=>{if(V(X.state_name),k(new Date().getTime()),c==null||c(ie.AGENT_STATE,X),X.state===Mt.UNREGISTERED){It.warning("当前已掉线,自动重连中,请检查网络"),be(x);const{soft_device_ring_switch:ve}=I.current.getAgentData();if(!ve)return;be(M.current)}}).on(ie.CALL_PROGRESS,X=>{W(X)}).on(He.WEBSITE_DELAY,X=>{h(X)}).on(ie.CUSTOMER_INFO,X=>{T(X),X&&pe(!0)}).on(He.AGENT_INIT_STATUS,X=>{if(X){const{default_device:ve,out_display_select_switch:ke,out_display_data:Xe,stateObject:{state_name:Ft}}=I.current.getAgentData();_(ke===1),ke===1&&ce((Xe||"").split("#")),H(ve),V(Ft),Be()}}).on(He.SELECT_EXTERNAL_NUMBER,X=>{ne(X)}).on(He.FAIL_NOTIFICATION,X=>{be(x),be(M.current),It.error(X)}).on(He.KICK_OFF,()=>{be(x),be(M.current),c?c==null||c(He.KICK_OFF):It.warning("您的座席账号已在别处登录,请重新登录。如非您本人操作,请及时修改密码。"),V("")}).on(He.DESTROY,()=>{c==null||c(He.DESTROY),It.success("已离线"),be(x),be(M.current)}).on(He.NETWORK_OFFLINE,()=>{It.warning("网络已断开,请检查网络设置。"),be(x),be(M.current)}).on(He.NETWORK_ONLINE,()=>{It.success("网络已恢复")}).on(He.SIGN_OUT,()=>{c==null||c(He.SIGN_OUT),It.success("已被签出"),be(x),be(M.current)}).on(ie.LISTEN_CALL_FAILED,()=>{c==null||c(ie.LISTEN_CALL_FAILED),It.error("监听失败")}).on(ie.EAR_SPEECH_SUCCESS,({monitored_agent_no:X})=>{c==null||c(ie.EAR_SPEECH_SUCCESS,{monitored_agent_no:X}),It.success("正在耳语")}).on(ie.EAR_SPEECH_BE_SUCCESS,({monitor_agent_no:X})=>{c==null||c(ie.EAR_SPEECH_BE_SUCCESS,{monitor_agent_no:X}),It.success(`${X}正在与你耳语`)}).on(ie.EAR_SPEECH_FAILED,()=>{c==null||c(ie.EAR_SPEECH_FAILED),It.error("耳语失败")}).on(ie.STOP_EAR_SPEECH_SUCCESS,()=>{c==null||c(ie.STOP_EAR_SPEECH_SUCCESS),It.success("停止耳语")}).on(ie.CALL_FORCE_INSERT_SUCCESS,({monitored_agent_no:X,monitor_agent_no:ve})=>{c==null||c(ie.CALL_FORCE_INSERT_SUCCESS,{monitored_agent_no:X,monitor_agent_no:ve}),It.success("强插成功")}).on(ie.CALL_FORCE_INSERT_SUCCESS_LISTENER,({monitored_agent_no:X,monitor_agent_no:ve})=>{c==null||c(ie.CALL_FORCE_INSERT_SUCCESS_LISTENER,{monitored_agent_no:X,monitor_agent_no:ve}),It.success(`${ve}强插`)}).on(He.SIGN_IN_SWITCH_DEVICE,X=>{c==null||c(He.SIGN_IN_SWITCH_DEVICE),It.success(`已被切换${X.answer_device===2?"手机模式":"SIP 话机"}设备`)}).on(ie.CALL_SIP_INCOMING_CALL,()=>{It.success("SIP话机有新的呼入")})};N.useEffect(()=>{var j;(j=I.current)==null||j.setBrowserAlertTime(r||3)},[r]),N.useEffect(()=>{var j;(j=I.current)==null||j.setBrowserAlert(i||!1)},[i]);const Ge=(j,re=!0)=>{j&&(j.currentTime=0,j.loop=re,j.play())},be=j=>{j&&j.pause()},Je=async j=>{var re;try{await((re=I.current)==null?void 0:re.agent_api.changeDevice({data:{device:j},success:()=>{H(j),It.success("切换设备成功")}}))}catch{}},lt=async(j,re)=>{var X;try{await((X=I.current)==null?void 0:X.agent_api.changeState({data:{state:j,state_name:re},success:()=>{V(re),It.success("切换状态成功")}}))}catch{}},$e=async j=>{var re;try{await((re=I.current)==null?void 0:re.agent_api.setAgentExplicit({data:{number:j},success:()=>{It.success(`切换[${j}]外显号码成功`)}}))}catch{}},Be=async()=>{var j;try{await((j=I.current)==null?void 0:j.agent_api.getAgentState({success:re=>{z(re.data)}}))}catch{}},Me=async j=>{var re;try{await((re=I.current)==null?void 0:re.call_api.makeCall(j))}catch(X){const{msg:ve}=JSON.parse(X.message);It.warning(ve)}},st=async()=>{var j;try{await((j=I.current)==null?void 0:j.call_api.answerCall())}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},At=async()=>{var j;try{(j=I.current)==null||j.call_api.cancelCall()}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},Ct=async()=>{var j;try{await((j=I.current)==null?void 0:j.call_api.hangup())}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},Nt=async()=>{var j;try{(j=I.current)==null||j.call_api.holdCall()}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},Jt=()=>{var j;(j=I.current)==null||j.call_api.unholdCall()},Wt=async j=>{var re;try{await((re=I.current)==null?void 0:re.call_api.consultCall(j))}catch(X){const{msg:ve}=JSON.parse(X.message);It.warning(ve)}},en=async()=>{var j;try{(j=I.current)==null||j.call_api.consultRetrieve()}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},_t=async()=>{var j;try{(j=I.current)==null||j.call_api.consultTransfer()}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},Zt=()=>{var j;try{(j=I.current)==null||j.call_api.mute()}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},Rt=()=>{var j;try{(j=I.current)==null||j.call_api.unmute()}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},pt=()=>{var j;try{(j=I.current)==null||j.call_api.satisfactionEvaluation()}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},Ve=()=>{var j;try{(j=I.current)==null||j.call_api.startConference()}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},_e=async j=>{var re;try{await((re=I.current)==null?void 0:re.call_api.transferAgent(j))}catch(X){const{msg:ve}=JSON.parse(X.message);It.warning(ve)}},Te=async j=>{var re;try{await((re=I.current)==null?void 0:re.call_api.transferOutline(j))}catch(X){const{msg:ve}=JSON.parse(X.message);It.warning(ve)}},ot=async()=>{var j;try{await((j=I.current)==null?void 0:j.call_api.earSpeakStart({success:()=>{}}))}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},mt=async()=>{var j;try{await((j=I.current)==null?void 0:j.call_api.earSpeakStop({success:()=>{}}))}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},Fe=async()=>{var j;try{await((j=I.current)==null?void 0:j.call_api.forceInsert({}))}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},we=async()=>{var j;try{await((j=I.current)==null?void 0:j.call_api.forceDisconnect({}))}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},Ke=ae.jsx(cN,{onPressEnter:j=>{j&&Me(j)}},je),ze=N.useMemo(()=>[{name:"call_number",icon:ae.jsx(No,{trigger:"click",rootClassName:"call-number-popover",destroyTooltipOnHide:!0,onOpenChange:re=>{Le(new Date().getTime())},content:Ke,children:ae.jsx(vt,{name:"boda",color:"#48D866",size:25})})},{name:"answer",icon:ae.jsx(vt,{name:"jieting",onClick:st,size:25})},{name:"hold",icon:ae.jsx(vt,{name:"baochi",color:"#1D92E9",onClick:Nt,size:25})},{name:"unhold",icon:ae.jsx(vt,{name:"quxiaobaochi",color:"#1D92E9",onClick:Jt,size:25})},{name:"mute",icon:ae.jsx(vt,{name:"mk",onClick:Zt,color:"#1D92E9",size:25})},{name:"unmute",icon:ae.jsx(vt,{name:"guanbimk",onClick:Rt,color:"#1D92E9",size:25})},{name:"satisfaction",icon:ae.jsx(vt,{name:"manyidu",onClick:pt,size:25})},{name:"consult",icon:ae.jsx(vt,{name:"zixun",onClick:()=>{le(!0)},size:25})},{name:"consult_transfer",icon:ae.jsx(vt,{name:"zhuanjie",onClick:_t,size:25})},{name:"transfer",icon:ae.jsx(vt,{size:25,name:"zhuanjie",onClick:()=>{xe(!0)}})},{name:"consult_retrieve",icon:ae.jsx(vt,{name:"fanhui",color:"#ffc53d",size:25,onClick:en})},{name:"conference",icon:ae.jsx(vt,{name:"huiyi",onClick:Ve,size:25})},{name:"whisper",icon:ae.jsx(Cl,{bg:"#1D92E9",children:ae.jsx(vt,{name:"whisper",size:15,color:"#fff",onClick:ot})})},{name:"cancel_whisper",icon:ae.jsx(Cl,{bg:"red",children:ae.jsx(vt,{name:"cancel_whisper",size:15,color:"#fff",onClick:mt})})},{name:"force_insert",icon:ae.jsx(Cl,{bg:"#1D92E9",children:ae.jsx(vt,{name:"force_insert",size:15,color:"#fff",onClick:Fe})})},{name:"force_disconnect",icon:ae.jsx(vt,{name:"force_disconnect",onClick:we,size:25})},{name:"reject",icon:ae.jsx(vt,{name:"jujie",color:"red",onClick:At,size:25})},{name:"hangup",icon:ae.jsx(vt,{name:"guaji",color:"red",onClick:Ct,size:25})},{name:"dtmf",icon:ae.jsx(No,{trigger:"click",onOpenChange:()=>{Ze("")},title:ae.jsx(di,{style:{borderRadius:20,textAlign:"center"},placeholder:"点击进行发送按键",value:Oe}),content:ae.jsx("div",{style:{width:300},children:ae.jsx(Dy,{onCallBack:re=>{var ve;const X=Oe+re;Ze(X),(ve=I.current)==null||ve.call_api.sendDTMF(re)}})}),children:ae.jsx(vt,{name:"dtmf",size:25})})}].filter(({name:re})=>q.includes(re)),[q,Oe]);return ae.jsx(ae.Fragment,{children:ae.jsxs(_r,{prefixCls:"ysyt",theme:{components:{Select:{selectorBg:"none"}}},children:[Z?ae.jsx(Sc,{spinning:R,children:ae.jsxs(WI,{height:v,children:[ae.jsx(JI,{children:ae.jsx(go,{variant:"underlined",value:P,onChange:j=>{Je(j)},options:(((Ue=I.current.getAgentData())==null?void 0:Ue.answer_devices)||[]).map(j=>({...j,label:ae.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[SN[j.value],ae.jsx("span",{style:{marginLeft:5},children:j.label})]})})),style:{width:140}})}),ae.jsxs(_I,{background:tt(IN[Z]??2),children:[ae.jsxs("div",{className:"ysyt-strip",children:[ae.jsx("div",{children:J?ae.jsx("span",{className:"ysyt-strip-state-name",children:J}):ae.jsx(ty,{trigger:["click"],menu:{items:$.map(j=>({label:ae.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[j.state===1?ae.jsx(vt,{name:"kongxian",color:"#7cb305",size:16}):ae.jsx(vt,{name:"manglu",color:"#f5222d",size:16}),ae.jsx("span",{style:{marginLeft:10},children:j.state_name})]}),key:j.state_name,onClick:()=>{lt(j.state,j.state_name)}}))},children:ae.jsxs("div",{style:{color:"#fff",cursor:"pointer",display:"flex",alignItems:"center"},children:[Z==="空闲"?ae.jsx(vt,{name:"kongxian",color:"#fff",size:20}):ae.jsx(ae.Fragment,{children:Z==="未注册"?ae.jsx(vt,{name:"unregistered",size:20}):ae.jsx(vt,{name:"manglu2",size:20})}),ae.jsx("span",{style:{margin:"0 10px"},children:Z}),ae.jsx(vt,{name:"xia",color:"#fff"})]})})}),ae.jsx("div",{className:"ysyt-strip-time",children:ae.jsx(dN,{},B)}),u&&S&&ae.jsx("div",{className:"ysyt-strip-call-card",onClick:()=>pe(!Ie),children:Ie?ae.jsx(vt,{name:"unopen",color:"#fff"}):ae.jsx(vt,{name:"open",color:"#fff"})})]}),ae.jsx("div",{className:"ysyt-action",children:ze.map(({name:j,icon:re})=>ae.jsx(us,{title:wN[j],children:re},j))}),te&&ae.jsx(s2,{children:ae.jsx("div",{children:ae.jsx(No,{trigger:"click",title:"外显号码池",onOpenChange:j=>{j||Y("")},content:ae.jsxs(A2,{children:[ae.jsx("div",{children:ae.jsx(di,{value:me,placeholder:"请输入外显号码",onChange:j=>Y(j.target.value)})}),ae.jsx("div",{className:"ysyt-number-content",children:ae.jsx(os.Group,{value:ue,onChange:j=>{$e(j.target.value)},options:se.filter(j=>j.includes(me)).map(j=>({label:ae.jsx(c2,{style:{color:ue===j?"#1D92E9":""},children:j},j),value:j}))})})]}),children:ae.jsxs("div",{style:{fontSize:14,cursor:"pointer",color:w||"#333",display:"flex",alignItems:"center"},children:[ae.jsx(vt,{name:"external",color:w||"#333"}),ae.jsx("span",{style:{margin:"0 5px"},children:"外显号码"}),ae.jsx(vt,{name:"xia",color:w||"#333"})]})})})})]}),ae.jsx(r2,{children:b&&b.rtt&&ae.jsx("div",{children:ae.jsx(No,{content:ae.jsxs("div",{children:[ae.jsxs("div",{children:["延迟: ",b.rtt,"ms"]}),b.jitter&&ae.jsxs("div",{children:["抖动: ",b.jitter,"ms"]}),ae.jsxs("div",{children:["丢包: ",b.packetsLost||0]}),b.packetsReceived?ae.jsxs("div",{children:["接收: ",b.packetsReceived]}):null,b.packetsSent?ae.jsxs("div",{children:["发送: ",b.packetsSent]}):null,b.sendBitrate?ae.jsxs("div",{children:["发送码率: ",b.sendBitrate,"KB/s"]}):null,b.recvBitrate?ae.jsxs("div",{children:["接收码率: ",b.recvBitrate,"KB/s"]}):null]}),placement:"bottomLeft",children:ae.jsxs("div",{style:{padding:"0 10px"},children:[b.rtt>=250?ae.jsx(vt,{name:"wifi1"}):"",b.rtt>=121&&b.rtt<250?ae.jsx(vt,{name:"wifi2"}):"",b.rtt<=120?ae.jsx(vt,{name:"wifi3"}):""]})})})}),u&&ae.jsxs(a2,{height:v,show:!!S&&Ie,children:[ae.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:10},children:[ae.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[(S==null?void 0:S.is_vip)===1&&ae.jsx(vt,{name:"vip"}),ae.jsx("span",{style:{marginLeft:5},children:S==null?void 0:S.customer_name})]}),ae.jsx("b",{children:S==null?void 0:S.phone})]}),ae.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[ae.jsxs("span",{children:[S==null?void 0:S.province,"-",S==null?void 0:S.city]}),Ce&&ae.jsxs("span",{children:["当月",Ce==="out"?"呼出次数:":"呼入次数:",ae.jsx("span",{style:{color:"#1D92E9"},children:Ce==="out"?S==null?void 0:S.contact_count_month:S==null?void 0:S.in_contact_count_month})]})]}),ae.jsx("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center"},children:Ce&&ae.jsxs("span",{children:["总",Ce==="out"?"呼出次数:":"呼入次数:",ae.jsx("span",{style:{color:"#1D92E9"},children:Ce==="out"?(S==null?void 0:S.contact_count)||0:(S==null?void 0:S.in_contact_count)||0})]})})]})]})}):ae.jsx(ae.Fragment,{}),ae.jsx(N.Suspense,{children:de&&((F=I.current)==null?void 0:F.agent_api)&&ae.jsx(xN,{open:de,queryFetch:I.current.agent_api.getIdleAgentList,onCallBack:j=>{le(!1),j&&Wt(j)}})}),ae.jsx(N.Suspense,{children:Se&&((ge=I.current)==null?void 0:ge.agent_api)&&ae.jsx(RN,{open:Se,queryFetch:I.current.agent_api.getIdleAgentList,onCallBack:(j,re)=>{xe(!1),j&&(re===0?_e(j):re===1&&Te(j))}})})]})})},MN=t=>{var e;return(e=kn.getInstance())==null?void 0:e.call_api.makeCall(t)},TN=()=>{var t;return(t=kn.getInstance())==null?void 0:t.getRealTimeCustomerInfo()},NN=async t=>{var e,n;if(t!==Mt.IDLE&&t!==Mt.BUSY)throw new Error("Invalid agent state");try{await((n=(e=kn.getInstance())==null?void 0:e.agent_api)==null?void 0:n.changeState({data:{state:t,state_name:t===Mt.IDLE?"空闲":"忙碌"}}))}catch(r){console.error(r)}},DN=async t=>{var e,n;try{await((n=(e=kn.getInstance())==null?void 0:e.agent_api)==null?void 0:n.changeDevice({data:{device:t}}))}catch(r){console.error(r)}},BN=async(t=!1,e)=>{var n,r;try{await((r=(n=kn.getInstance())==null?void 0:n.agent_api)==null?void 0:r.agentLogout({data:{offline_answer:t},success:()=>{e==null||e()}}))}catch(i){console.log(i)}},FN=async(t,e)=>{var n,r;(r=(n=kn.getInstance())==null?void 0:n.call_api)==null||r.previewMakeCall(t,e)},kN=async t=>{var e,n;try{await((n=(e=kn.getInstance())==null?void 0:e.agent_api)==null?void 0:n.listenAgentCall({data:{monitored_agent_no:t},success:()=>{It.success("监听坐席通话成功")}}))}catch(r){console.error(r)}},PN=async()=>{var t,e;try{await((e=(t=kn.getInstance())==null?void 0:t.call_api)==null?void 0:e.earSpeakStart({}))}catch(n){console.log(n)}},QN=async()=>{var t,e;try{await((e=(t=kn.getInstance())==null?void 0:t.call_api)==null?void 0:e.earSpeakStop({}))}catch(n){console.log(n)}},jN=async()=>{var t,e;try{await((e=(t=kn.getInstance())==null?void 0:t.call_api)==null?void 0:e.forceInsert({}))}catch(n){console.log(n)}},LN=async()=>{var t,e;try{await((e=(t=kn.getInstance())==null?void 0:t.call_api)==null?void 0:e.forceDisconnect({}))}catch(n){console.log(n)}};exports.Button=Ao;exports.CONTAINER_MAX_OFFSET=sf;exports.CSSMotion=lo;exports.ConfigContext=Qt;exports.ConfigProvider=_r;exports.ContextIsolator=Ua;exports.DisabledContextProvider=Vv;exports.Empty=si;exports.FastColor=Gt;exports.Input=di;exports.KeyCode=at;exports.Keyframe=Pt;exports.ModelBody=n2;exports.Portal=gc;exports.Radio=os;exports.RefIcon=yc;exports.RefIcon$1=Rf;exports.RefIcon$2=as;exports.RefIcon$3=xf;exports.RefIcon$4=Of;exports.Space=Cc;exports.Spin=Sc;exports.Wave=nc;exports.YsytBarPhone=ON;exports.YsytIconSvg=vt;exports._extends=Qe;exports._objectSpread2=L;exports._slicedToArray=ee;exports._toConsumableArray=Re;exports._typeof=et;exports.agentLogout=BN;exports.callForceInsert=jN;exports.callForceSplit=LN;exports.canUseDom=Ln;exports.classNames=Ae;exports.clearFix=sA;exports.contains=tv;exports.convertLegacyProps=eR;exports.devUseWarning=cn;exports.genFocusStyle=AA;exports.genPresetColor=Uv;exports.genStyleHooks=Tn;exports.genSubStyleComponent=Lv;exports.getConfirmLocale=Wb;exports.getCustomerInfo=TN;exports.getReactRender=uf;exports.getTransitionName=sc;exports.globalConfig=Gd;exports.initMotion=XA;exports.initZoomMotion=Xa;exports.isPresetColor=WC;exports.isPresetStatusColor=OM;exports.jsxRuntimeExports=ae;exports.listenCall=kN;exports.localeValues=oo;exports.makeCall=MN;exports.merge=zt;exports.omit=tr;exports.pickAttrs=ki;exports.previewMakeCall=FN;exports.replaceElement=k1;exports.resetComponent=zn;exports.setAgentDevice=DN;exports.setAgentInitState=NN;exports.startEarSpeak=PN;exports.stopEarSpeak=QN;exports.unit=ye;exports.useCSSVarCls=Ur;exports.useComponentConfig=Jr;exports.useComposeRef=ji;exports.useEvent=rn;exports.useId=rc;exports.useLocale=HA;exports.useSafeState=Lo;exports.useToken=dr;exports.useZIndex=ts;exports.warnContext=s0;exports.warning=Di;exports.withPureRenderTheme=MC;exports.zIndexContext=es;
694
+ `,ON=t=>{var Ue,F,ge;const{style:e,logBuiltinEnabled:n,browserAlertTime:r,enableBrowserAlert:i,agentNo:o,appKey:a,appSecret:s,url:A,onCallBack:c,ringingCardShow:u=!0,onLoginCancel:d,isCheckLogin:f,...p}=t,{height:v,busy:C,idle:m,unavailable:y,selectOutNumberColor:w}=e||{},I=N.useRef(),O=N.useRef(),[x,g]=N.useState(new Audio(fN)),M=N.useRef(),E=N.useRef(),[b,h]=N.useState(),[S,T]=N.useState(),[R,D]=N.useState(!1),[B,k]=N.useState(new Date().getTime()),[P,H]=N.useState(),[Z,V]=N.useState(),[q,U]=N.useState([]),[$,z]=N.useState([]),[J,W]=N.useState(""),[te,_]=N.useState(!1),[se,ce]=N.useState([]),[ue,ne]=N.useState(""),[me,Y]=N.useState(""),[de,le]=N.useState(!1),[Se,xe]=N.useState(!1),[Ce,De]=N.useState(),[je,Le]=N.useState(new Date().getTime()),[Ie,pe]=N.useState(!0),[Oe,Ze]=N.useState(""),tt=j=>{switch(j){case Mt.IDLE:return m||"#1D92E9";case Mt.BUSY:return C||"#F5212D";case Mt.UNREGISTERED:return y||"#faad14";case Mt.OFFLINE:return y||"#8c8c8c";default:return"#1D92E9"}};N.useEffect(()=>((async()=>(D(!0),I.current=kn.getInstance({agentNo:o,appKey:a,appSecret:s,url:A}),rt(),I.current.on(He.PHONE_BAR_OPERATION,j=>{console.log(j),U(j)}),f?await I.current.agent_api.checkAgentLogin({data:{agent_no:o},success:async j=>{j.data.is_login?bN({title:"当前账号已登录!",icon:ae.jsx(vt,{name:"wing",size:20}),content:"是否继续登录",onOk:async()=>{await I.current.init({...p,logBuiltinEnabled:n,browserAlertTime:r,enableBrowserAlert:i,onCallBack:()=>{const re=I.current.getEarSpeakAgent();M.current=new Audio(re);const X=I.current.getEndSpeakAgent();E.current=new Audio(X)}}),O.current=I.current.getAgentData()},onCancel:()=>{d==null||d()}}):(await I.current.init({...p,logBuiltinEnabled:n,browserAlertTime:r,enableBrowserAlert:i,onCallBack:()=>{const re=I.current.getEarSpeakAgent();M.current=new Audio(re);const X=I.current.getEndSpeakAgent();E.current=new Audio(X)}}),O.current=I.current.getAgentData())}}):(await I.current.init({...p,logBuiltinEnabled:n,browserAlertTime:r,enableBrowserAlert:i,onCallBack:()=>{const j=I.current.getEarSpeakAgent();M.current=new Audio(j);const re=I.current.getEndSpeakAgent();E.current=new Audio(re)}}),O.current=I.current.getAgentData()),k(new Date().getTime()),D(!1)))(),()=>{var j;be(x),be(M.current),(j=I.current)==null||j.destroy()}),[]);const rt=()=>{var j,re;(j=I.current)==null||j.on(He.EVENT_ALL,({event:X,data:ve})=>{switch(X){case ie.OUT_SUCCESS:case ie.CONSULT_RINGING:{Ge(x),De("out"),be(E.current);return}case ie.OUT_INCOMING_CALL:case ie.INTERNAL_OUT_INCOMING_CALL:{c==null||c(X,{customer_phone:ve.customer_phone,session_id:ve.session_id,trace_id:ve.trace_id});return}case ie.PREVIEW_OUT_INCOMING_CALL:{c==null||c(ie.PREVIEW_OUT_INCOMING_CALL,{customer_phone:ve.customer_phone,session_id:ve.session_id,preview_task_id:ve.preview_task_id,trace_id:ve.trace_id});return}case ie.OUT_OFF_ANSWER:case ie.INTERNAL_OUT_OFF_ANSWER:case ie.OUT_FAILED:case ie.CONSULT_FAILED:case ie.OUT_RINGING:case ie.CONSULT_OFF_HOOK:{X===ie.OUT_OFF_ANSWER&&(c==null||c(X,{session_id:ve.session_id})),be(x);return}case ie.CONSULT_INCOMING:case ie.TRANSFER_INCOMING_CALL:case ie.LISTEN_INCOMING_CALL:case ie.INCOMING_CALL_IN:case ie.INCOMING_CALL:{De("in"),be(E.current),(X===ie.CONSULT_INCOMING||X===ie.TRANSFER_INCOMING_CALL)&&(c==null||c(X,{agent_no:ve.agent_no,agent_name:ve.agent_name,session_id:ve.session_id})),X===ie.INCOMING_CALL?c==null||c(ie.INCOMING_CALL,{customer_phone:ve.customer_phone,session_id:ve.session_id}):X===ie.INCOMING_CALL_IN?c==null||c(ie.INCOMING_CALL_IN,{customer_phone:ve.customer_phone,session_id:ve.session_id}):X===ie.LISTEN_INCOMING_CALL&&(c==null||c(ie.LISTEN_INCOMING_CALL,{session_id:ve.session_id}));const{soft_device_ring_switch:ke}=I.current.getAgentData();if(!ke)return;Ge(M.current);return}case ie.PREDICT_INCOMING_CALL:{De("out"),be(E.current),X===ie.PREDICT_INCOMING_CALL&&(c==null||c(ie.PREDICT_INCOMING_CALL,{customer_phone:ve.customer_phone,session_id:ve.session_id}));const{soft_device_ring_switch:ke}=I.current.getAgentData();if(!ke)return;Ge(M.current);return}case ie.DUAL_CALL_INCOMING_CALL:{De("out"),be(E.current),X===ie.DUAL_CALL_INCOMING_CALL&&(c==null||c(ie.DUAL_CALL_INCOMING_CALL,{customer_phone:ve.customer_phone,session_id:ve.session_id}));const{soft_device_ring_switch:ke}=I.current.getAgentData();if(!ke)return;Ge(M.current);return}case ie.TRANSFER_OFF_HOOK:case ie.LISTEN_INCOMING_CALL_OFF_HOOK:case ie.CONSULT_CALL_IN_SUCCESS:case ie.INCOMING_CALL_IN_OFF_HOOK:case ie.INCOMING_CALL_OFF_HOOK:{X===ie.LISTEN_INCOMING_CALL_OFF_HOOK?c==null||c(X,{session_id:ve.session_id,monitored_agent_no:ve.monitored_agent_no}):c==null||c(X,{session_id:ve.session_id}),be(M.current);return}case ie.OUT_HANGUP:case ie.LISTEN_HANGUP:case ie.LISTEN_CALL_FAILED:case ie.TRANSFER_END:case ie.THREE_WAY_OUR_SIDE_HANGUP:case ie.OUR_SIDE_CONSULT_HANGUP:case ie.OTHER_SIDE_CONSULT_HANGUP:case ie.INCOMING_CALL_END:{if(c==null||c(X,{session_id:ve.session_id}),be(M.current),be(x),De(void 0),le(!1),xe(!1),X===ie.OUT_HANGUP||X===ie.INCOMING_CALL_END){const{isAgentHangup:ke}=ve,{agent_hangup_ring_switch:Xe}=I.current.getAgentData();!ke&&Xe&&Ge(E.current,!1)}return}case ie.REJECT:c==null||c(X,{session_id:ve.session_id});return;case ie.CUSTOMER_INFO:c==null||c(X,ve);return;default:return null}}),(re=I.current)==null||re.on(ie.AGENT_STATE,X=>{if(V(X.state_name),k(new Date().getTime()),c==null||c(ie.AGENT_STATE,X),X.state===Mt.UNREGISTERED){It.warning("当前已掉线,自动重连中,请检查网络"),be(x);const{soft_device_ring_switch:ve}=I.current.getAgentData();if(!ve)return;be(M.current)}}).on(ie.CALL_PROGRESS,X=>{W(X)}).on(He.WEBSITE_DELAY,X=>{h(X)}).on(ie.CUSTOMER_INFO,X=>{T(X),X&&pe(!0)}).on(He.AGENT_INIT_STATUS,X=>{if(X){const{default_device:ve,out_display_select_switch:ke,out_display_data:Xe,stateObject:{state_name:Ft}}=I.current.getAgentData();_(ke===1),ke===1&&ce((Xe||"").split("#")),H(ve),V(Ft),Be()}}).on(He.SELECT_EXTERNAL_NUMBER,X=>{ne(X)}).on(He.FAIL_NOTIFICATION,X=>{be(x),be(M.current),It.error(X)}).on(He.KICK_OFF,()=>{be(x),be(M.current),c?c==null||c(He.KICK_OFF):It.warning("您的座席账号已在别处登录,请重新登录。如非您本人操作,请及时修改密码。"),V("")}).on(He.DESTROY,()=>{c==null||c(He.DESTROY),It.success("已离线"),be(x),be(M.current)}).on(He.NETWORK_OFFLINE,()=>{It.warning("网络已断开,请检查网络设置。"),be(x),be(M.current)}).on(He.NETWORK_ONLINE,()=>{It.success("网络已恢复")}).on(He.SIGN_OUT,()=>{c==null||c(He.SIGN_OUT),It.success("已被签出"),be(x),be(M.current)}).on(ie.LISTEN_CALL_FAILED,()=>{c==null||c(ie.LISTEN_CALL_FAILED),It.error("监听失败")}).on(ie.EAR_SPEECH_SUCCESS,({monitored_agent_no:X})=>{c==null||c(ie.EAR_SPEECH_SUCCESS,{monitored_agent_no:X}),It.success("正在耳语")}).on(ie.EAR_SPEECH_BE_SUCCESS,({monitor_agent_no:X})=>{c==null||c(ie.EAR_SPEECH_BE_SUCCESS,{monitor_agent_no:X}),It.success(`${X}正在与你耳语`)}).on(ie.EAR_SPEECH_FAILED,()=>{c==null||c(ie.EAR_SPEECH_FAILED),It.error("耳语失败")}).on(ie.STOP_EAR_SPEECH_SUCCESS,()=>{c==null||c(ie.STOP_EAR_SPEECH_SUCCESS),It.success("停止耳语")}).on(ie.CALL_FORCE_INSERT_SUCCESS,({monitored_agent_no:X,monitor_agent_no:ve})=>{c==null||c(ie.CALL_FORCE_INSERT_SUCCESS,{monitored_agent_no:X,monitor_agent_no:ve}),It.success("强插成功")}).on(ie.CALL_FORCE_INSERT_SUCCESS_LISTENER,({monitored_agent_no:X,monitor_agent_no:ve})=>{c==null||c(ie.CALL_FORCE_INSERT_SUCCESS_LISTENER,{monitored_agent_no:X,monitor_agent_no:ve}),It.success(`${ve}强插`)}).on(He.SIGN_IN_SWITCH_DEVICE,X=>{c==null||c(He.SIGN_IN_SWITCH_DEVICE),It.success(`已被切换${X.answer_device===2?"手机模式":"SIP 话机"}设备`)}).on(ie.CALL_SIP_INCOMING_CALL,()=>{It.success("SIP话机有新的呼入")})};N.useEffect(()=>{var j;(j=I.current)==null||j.setBrowserAlertTime(r||3)},[r]),N.useEffect(()=>{var j;(j=I.current)==null||j.setBrowserAlert(i||!1)},[i]);const Ge=(j,re=!0)=>{j&&(j.currentTime=0,j.loop=re,j.play())},be=j=>{j&&j.pause()},Je=async j=>{var re;try{await((re=I.current)==null?void 0:re.agent_api.changeDevice({data:{device:j},success:()=>{H(j),It.success("切换设备成功")}}))}catch{}},lt=async(j,re)=>{var X;try{await((X=I.current)==null?void 0:X.agent_api.changeState({data:{state:j,state_name:re},success:()=>{V(re),It.success("切换状态成功")}}))}catch{}},$e=async j=>{var re;try{await((re=I.current)==null?void 0:re.agent_api.setAgentExplicit({data:{number:j},success:()=>{It.success(`切换[${j}]外显号码成功`)}}))}catch{}},Be=async()=>{var j;try{await((j=I.current)==null?void 0:j.agent_api.getAgentState({success:re=>{z(re.data)}}))}catch{}},Me=async j=>{var re;try{await((re=I.current)==null?void 0:re.call_api.makeCall(j))}catch(X){const{msg:ve}=JSON.parse(X.message);It.warning(ve)}},st=async()=>{var j;try{await((j=I.current)==null?void 0:j.call_api.answerCall())}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},At=async()=>{var j;try{(j=I.current)==null||j.call_api.cancelCall()}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},Ct=async()=>{var j;try{await((j=I.current)==null?void 0:j.call_api.hangup())}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},Nt=async()=>{var j;try{(j=I.current)==null||j.call_api.holdCall()}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},Jt=()=>{var j;(j=I.current)==null||j.call_api.unholdCall()},Wt=async j=>{var re;try{await((re=I.current)==null?void 0:re.call_api.consultCall(j))}catch(X){const{msg:ve}=JSON.parse(X.message);It.warning(ve)}},en=async()=>{var j;try{(j=I.current)==null||j.call_api.consultRetrieve()}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},_t=async()=>{var j;try{(j=I.current)==null||j.call_api.consultTransfer()}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},Zt=()=>{var j;try{(j=I.current)==null||j.call_api.mute()}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},Rt=()=>{var j;try{(j=I.current)==null||j.call_api.unmute()}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},pt=()=>{var j;try{(j=I.current)==null||j.call_api.satisfactionEvaluation()}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},Ve=()=>{var j;try{(j=I.current)==null||j.call_api.startConference()}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},_e=async j=>{var re;try{await((re=I.current)==null?void 0:re.call_api.transferAgent(j))}catch(X){const{msg:ve}=JSON.parse(X.message);It.warning(ve)}},Te=async j=>{var re;try{await((re=I.current)==null?void 0:re.call_api.transferOutline(j))}catch(X){const{msg:ve}=JSON.parse(X.message);It.warning(ve)}},ot=async()=>{var j;try{await((j=I.current)==null?void 0:j.call_api.earSpeakStart({success:()=>{}}))}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},mt=async()=>{var j;try{await((j=I.current)==null?void 0:j.call_api.earSpeakStop({success:()=>{}}))}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},Fe=async()=>{var j;try{await((j=I.current)==null?void 0:j.call_api.forceInsert({}))}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},we=async()=>{var j;try{await((j=I.current)==null?void 0:j.call_api.forceDisconnect({}))}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},Ke=ae.jsx(cN,{onPressEnter:j=>{j&&Me(j)}},je),ze=N.useMemo(()=>[{name:"call_number",icon:ae.jsx(No,{trigger:"click",rootClassName:"call-number-popover",destroyTooltipOnHide:!0,onOpenChange:re=>{Le(new Date().getTime())},content:Ke,children:ae.jsx(vt,{name:"boda",color:"#48D866",size:25})})},{name:"answer",icon:ae.jsx(vt,{name:"jieting",onClick:st,size:25})},{name:"hold",icon:ae.jsx(vt,{name:"baochi",color:"#1D92E9",onClick:Nt,size:25})},{name:"unhold",icon:ae.jsx(vt,{name:"quxiaobaochi",color:"#1D92E9",onClick:Jt,size:25})},{name:"mute",icon:ae.jsx(vt,{name:"mk",onClick:Zt,color:"#1D92E9",size:25})},{name:"unmute",icon:ae.jsx(vt,{name:"guanbimk",onClick:Rt,color:"#1D92E9",size:25})},{name:"satisfaction",icon:ae.jsx(vt,{name:"manyidu",onClick:pt,size:25})},{name:"consult",icon:ae.jsx(vt,{name:"zixun",onClick:()=>{le(!0)},size:25})},{name:"consult_transfer",icon:ae.jsx(vt,{name:"zhuanjie",onClick:_t,size:25})},{name:"transfer",icon:ae.jsx(vt,{size:25,name:"zhuanjie",onClick:()=>{xe(!0)}})},{name:"consult_retrieve",icon:ae.jsx(vt,{name:"fanhui",color:"#ffc53d",size:25,onClick:en})},{name:"conference",icon:ae.jsx(vt,{name:"huiyi",onClick:Ve,size:25})},{name:"whisper",icon:ae.jsx(Cl,{bg:"#1D92E9",children:ae.jsx(vt,{name:"whisper",size:15,color:"#fff",onClick:ot})})},{name:"cancel_whisper",icon:ae.jsx(Cl,{bg:"red",children:ae.jsx(vt,{name:"cancel_whisper",size:15,color:"#fff",onClick:mt})})},{name:"force_insert",icon:ae.jsx(Cl,{bg:"#1D92E9",children:ae.jsx(vt,{name:"force_insert",size:15,color:"#fff",onClick:Fe})})},{name:"force_disconnect",icon:ae.jsx(vt,{name:"force_disconnect",onClick:we,size:25})},{name:"reject",icon:ae.jsx(vt,{name:"jujie",color:"red",onClick:At,size:25})},{name:"hangup",icon:ae.jsx(vt,{name:"guaji",color:"red",onClick:Ct,size:25})},{name:"dtmf",icon:ae.jsx(No,{trigger:"click",onOpenChange:()=>{Ze("")},title:ae.jsx(di,{style:{borderRadius:20,textAlign:"center"},placeholder:"点击进行发送按键",value:Oe}),content:ae.jsx("div",{style:{width:300},children:ae.jsx(Dy,{onCallBack:re=>{var ve;const X=Oe+re;Ze(X),(ve=I.current)==null||ve.call_api.sendDTMF(re)}})}),children:ae.jsx(vt,{name:"dtmf",size:25})})}].filter(({name:re})=>q.includes(re)),[q,Oe]);return ae.jsx(ae.Fragment,{children:ae.jsxs(_r,{prefixCls:"ysyt",theme:{components:{Select:{selectorBg:"none"}}},children:[Z?ae.jsx(Sc,{spinning:R,children:ae.jsxs(WI,{height:v,children:[ae.jsx(JI,{children:ae.jsx(go,{variant:"underlined",value:P,onChange:j=>{Je(j)},options:(((Ue=I.current.getAgentData())==null?void 0:Ue.answer_devices)||[]).map(j=>({...j,label:ae.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[SN[j.value],ae.jsx("span",{style:{marginLeft:5},children:j.label})]})})),style:{width:140}})}),ae.jsxs(_I,{background:tt(IN[Z]??2),children:[ae.jsxs("div",{className:"ysyt-strip",children:[ae.jsx("div",{children:J?ae.jsx("span",{className:"ysyt-strip-state-name",children:J}):ae.jsx(ty,{trigger:["click"],menu:{items:$.map(j=>({label:ae.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[j.state===1?ae.jsx(vt,{name:"kongxian",color:"#7cb305",size:16}):ae.jsx(vt,{name:"manglu",color:"#f5222d",size:16}),ae.jsx("span",{style:{marginLeft:10},children:j.state_name})]}),key:j.state_name,onClick:()=>{lt(j.state,j.state_name)}}))},children:ae.jsxs("div",{style:{color:"#fff",cursor:"pointer",display:"flex",alignItems:"center"},children:[Z==="空闲"?ae.jsx(vt,{name:"kongxian",color:"#fff",size:20}):ae.jsx(ae.Fragment,{children:Z==="未注册"?ae.jsx(vt,{name:"unregistered",size:20}):ae.jsx(vt,{name:"manglu2",size:20})}),ae.jsx("span",{style:{margin:"0 10px"},children:Z}),ae.jsx(vt,{name:"xia",color:"#fff"})]})})}),ae.jsx("div",{className:"ysyt-strip-time",children:ae.jsx(dN,{},B)}),u&&S&&ae.jsx("div",{className:"ysyt-strip-call-card",onClick:()=>pe(!Ie),children:Ie?ae.jsx(vt,{name:"unopen",color:"#fff"}):ae.jsx(vt,{name:"open",color:"#fff"})})]}),ae.jsx("div",{className:"ysyt-action",children:ze.map(({name:j,icon:re})=>ae.jsx(us,{title:wN[j],children:re},j))}),te&&ae.jsx(s2,{children:ae.jsx("div",{children:ae.jsx(No,{trigger:"click",title:"外显号码池",onOpenChange:j=>{j||Y("")},content:ae.jsxs(A2,{children:[ae.jsx("div",{children:ae.jsx(di,{value:me,placeholder:"请输入外显号码",onChange:j=>Y(j.target.value)})}),ae.jsx("div",{className:"ysyt-number-content",children:ae.jsx(os.Group,{value:ue,onChange:j=>{$e(j.target.value)},options:se.filter(j=>j.includes(me)).map(j=>({label:ae.jsx(c2,{style:{color:ue===j?"#1D92E9":""},children:j},j),value:j}))})})]}),children:ae.jsxs("div",{style:{fontSize:14,cursor:"pointer",color:w||"#333",display:"flex",alignItems:"center"},children:[ae.jsx(vt,{name:"external",color:w||"#333"}),ae.jsx("span",{style:{margin:"0 5px"},children:"外显号码"}),ae.jsx(vt,{name:"xia",color:w||"#333"})]})})})})]}),ae.jsx(r2,{children:b&&b.rtt&&ae.jsx("div",{children:ae.jsx(No,{content:ae.jsxs("div",{children:[ae.jsxs("div",{children:["延迟: ",b.rtt,"ms"]}),b.jitter&&ae.jsxs("div",{children:["抖动: ",b.jitter,"ms"]}),ae.jsxs("div",{children:["丢包: ",b.packetsLost||0]}),b.packetsReceived?ae.jsxs("div",{children:["接收: ",b.packetsReceived]}):null,b.packetsSent?ae.jsxs("div",{children:["发送: ",b.packetsSent]}):null,b.sendBitrate?ae.jsxs("div",{children:["发送码率: ",b.sendBitrate,"KB/s"]}):null,b.recvBitrate?ae.jsxs("div",{children:["接收码率: ",b.recvBitrate,"KB/s"]}):null]}),placement:"bottomLeft",children:ae.jsxs("div",{style:{padding:"0 10px"},children:[b.rtt>=250?ae.jsx(vt,{name:"wifi1"}):"",b.rtt>=121&&b.rtt<250?ae.jsx(vt,{name:"wifi2"}):"",b.rtt<=120?ae.jsx(vt,{name:"wifi3"}):""]})})})}),u&&ae.jsxs(a2,{height:v,show:!!S&&Ie,children:[ae.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:10},children:[ae.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[(S==null?void 0:S.is_vip)===1&&ae.jsx(vt,{name:"vip"}),ae.jsx("span",{style:{marginLeft:5},children:S==null?void 0:S.customer_name})]}),ae.jsx("b",{children:S==null?void 0:S.phone})]}),ae.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[ae.jsxs("span",{children:[S==null?void 0:S.province,"-",S==null?void 0:S.city]}),Ce&&ae.jsxs("span",{children:["当月",Ce==="out"?"呼出次数:":"呼入次数:",ae.jsx("span",{style:{color:"#1D92E9"},children:Ce==="out"?S==null?void 0:S.contact_count_month:S==null?void 0:S.in_contact_count_month})]})]}),ae.jsx("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center"},children:Ce&&ae.jsxs("span",{children:["总",Ce==="out"?"呼出次数:":"呼入次数:",ae.jsx("span",{style:{color:"#1D92E9"},children:Ce==="out"?(S==null?void 0:S.contact_count)||0:(S==null?void 0:S.in_contact_count)||0})]})})]})]})}):ae.jsx(ae.Fragment,{}),ae.jsx(N.Suspense,{children:de&&((F=I.current)==null?void 0:F.agent_api)&&ae.jsx(xN,{open:de,queryFetch:I.current.agent_api.getIdleAgentList,onCallBack:j=>{le(!1),j&&Wt(j)}})}),ae.jsx(N.Suspense,{children:Se&&((ge=I.current)==null?void 0:ge.agent_api)&&ae.jsx(RN,{open:Se,queryFetch:I.current.agent_api.getIdleAgentList,onCallBack:(j,re)=>{xe(!1),j&&(re===0?_e(j):re===1&&Te(j))}})})]})})},MN=t=>{var e;return(e=kn.getInstance())==null?void 0:e.call_api.makeCall(t)},TN=()=>{var t;return(t=kn.getInstance())==null?void 0:t.getRealTimeCustomerInfo()},NN=async t=>{var e,n;if(t!==Mt.IDLE&&t!==Mt.BUSY)throw new Error("Invalid agent state");try{await((n=(e=kn.getInstance())==null?void 0:e.agent_api)==null?void 0:n.changeState({data:{state:t,state_name:t===Mt.IDLE?"空闲":"忙碌"}}))}catch(r){console.error(r)}},DN=async t=>{var e,n;try{await((n=(e=kn.getInstance())==null?void 0:e.agent_api)==null?void 0:n.changeDevice({data:{device:t}}))}catch(r){console.error(r)}},BN=async(t=!1,e)=>{var n,r;try{await((r=(n=kn.getInstance())==null?void 0:n.agent_api)==null?void 0:r.agentLogout({data:{offline_answer:t},success:()=>{e==null||e()}}))}catch(i){console.log(i)}},FN=async(t,e)=>{var n,r;(r=(n=kn.getInstance())==null?void 0:n.call_api)==null||r.previewMakeCall(t,e)},kN=async t=>{var e,n;try{await((n=(e=kn.getInstance())==null?void 0:e.agent_api)==null?void 0:n.listenAgentCall({data:{monitored_agent_no:t},success:()=>{It.success("监听坐席通话成功")}}))}catch(r){console.error(r)}},PN=async()=>{var t,e;try{await((e=(t=kn.getInstance())==null?void 0:t.call_api)==null?void 0:e.earSpeakStart({}))}catch(n){console.log(n)}},QN=async()=>{var t,e;try{await((e=(t=kn.getInstance())==null?void 0:t.call_api)==null?void 0:e.earSpeakStop({}))}catch(n){console.log(n)}},jN=async()=>{var t,e;try{await((e=(t=kn.getInstance())==null?void 0:t.call_api)==null?void 0:e.forceInsert({}))}catch(n){console.log(n)}},LN=async()=>{var t,e;try{await((e=(t=kn.getInstance())==null?void 0:t.call_api)==null?void 0:e.forceDisconnect({}))}catch(n){console.log(n)}};exports.Button=Ao;exports.CONTAINER_MAX_OFFSET=sf;exports.CSSMotion=lo;exports.ConfigContext=Qt;exports.ConfigProvider=_r;exports.ContextIsolator=Ua;exports.DisabledContextProvider=Vv;exports.Empty=si;exports.FastColor=Gt;exports.Input=di;exports.KeyCode=at;exports.Keyframe=Pt;exports.ModelBody=n2;exports.Portal=gc;exports.Radio=os;exports.RefIcon=yc;exports.RefIcon$1=Rf;exports.RefIcon$2=as;exports.RefIcon$3=xf;exports.RefIcon$4=Of;exports.Space=Cc;exports.Spin=Sc;exports.Wave=nc;exports.YsytBarPhone=ON;exports.YsytIconSvg=vt;exports._extends=Qe;exports._objectSpread2=L;exports._slicedToArray=ee;exports._toConsumableArray=Re;exports._typeof=et;exports.agentLogout=BN;exports.callForceInsert=jN;exports.callForceSplit=LN;exports.canUseDom=Ln;exports.classNames=Ae;exports.clearFix=sA;exports.contains=tv;exports.convertLegacyProps=eR;exports.devUseWarning=cn;exports.genFocusStyle=AA;exports.genPresetColor=Uv;exports.genStyleHooks=Tn;exports.genSubStyleComponent=Lv;exports.getConfirmLocale=Wb;exports.getCustomerInfo=TN;exports.getReactRender=uf;exports.getTransitionName=sc;exports.globalConfig=Gd;exports.initMotion=XA;exports.initZoomMotion=Xa;exports.isPresetColor=WC;exports.isPresetStatusColor=OM;exports.jsxRuntimeExports=ae;exports.listenCall=kN;exports.localeValues=oo;exports.makeCall=MN;exports.merge=zt;exports.omit=tr;exports.pickAttrs=ki;exports.previewMakeCall=FN;exports.replaceElement=k1;exports.resetComponent=zn;exports.setAgentDevice=DN;exports.setAgentInitState=NN;exports.startEarSpeak=PN;exports.stopEarSpeak=QN;exports.unit=ye;exports.useCSSVarCls=Ur;exports.useComponentConfig=Jr;exports.useComposeRef=ji;exports.useEvent=rn;exports.useId=rc;exports.useLocale=HA;exports.useSafeState=Lo;exports.useToken=dr;exports.useZIndex=ts;exports.warnContext=s0;exports.warning=Di;exports.withPureRenderTheme=MC;exports.zIndexContext=es;