UNPKG

ahooks

Version:
2 lines 79.3 kB
/*! For license information please see ahooks.js.LICENSE.txt */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("React")):"function"==typeof define&&define.amd?define(["React"],t):"object"==typeof exports?exports.ahooks=t(require("React")):e.ahooks=t(e.React)}(this,e=>(()=>{var t={300(e){e.exports=function(){"use strict";var e=6e4,t=36e5,n="millisecond",r="second",o="minute",i="hour",s="day",u="week",c="month",a="quarter",l="year",d="date",f="Invalid Date",v=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,h=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,p={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],n=e%100;return"["+e+(t[(n-20)%10]||t[n]||t[0])+"]"}},m=function(e,t,n){var r=String(e);return!r||r.length>=t?e:""+Array(t+1-r.length).join(n)+e},g={s:m,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),o=n%60;return(t<=0?"+":"-")+m(r,2,"0")+":"+m(o,2,"0")},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),o=t.clone().add(r,c),i=n-o<0,s=t.clone().add(r+(i?-1:1),c);return+(-(r+(n-o)/(i?o-s:s-o))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:c,y:l,w:u,d:s,D:d,h:i,m:o,s:r,ms:n,Q:a}[e]||String(e||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},y="en",b={};b[y]=p;var w="$isDayjsObject",E=function(e){return e instanceof M||!(!e||!e[w])},S=function e(t,n,r){var o;if(!t)return y;if("string"==typeof t){var i=t.toLowerCase();b[i]&&(o=i),n&&(b[i]=n,o=i);var s=t.split("-");if(!o&&s.length>1)return e(s[0])}else{var u=t.name;b[u]=t,o=u}return!r&&o&&(y=o),o||!r&&y},O=function(e,t){if(E(e))return e.clone();var n="object"==typeof t?t:{};return n.date=e,n.args=arguments,new M(n)},j=g;j.l=S,j.i=E,j.w=function(e,t){return O(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var M=function(){function p(e){this.$L=S(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[w]=!0}var m=p.prototype;return m.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(null===t)return new Date(NaN);if(j.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var r=t.match(v);if(r){var o=r[2]-1||0,i=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],o,r[3]||1,r[4]||0,r[5]||0,r[6]||0,i)):new Date(r[1],o,r[3]||1,r[4]||0,r[5]||0,r[6]||0,i)}}return new Date(t)}(e),this.init()},m.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},m.$utils=function(){return j},m.isValid=function(){return!(this.$d.toString()===f)},m.isSame=function(e,t){var n=O(e);return this.startOf(t)<=n&&n<=this.endOf(t)},m.isAfter=function(e,t){return O(e)<this.startOf(t)},m.isBefore=function(e,t){return this.endOf(t)<O(e)},m.$g=function(e,t,n){return j.u(e)?this[t]:this.set(n,e)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(e,t){var n=this,a=!!j.u(t)||t,f=j.p(e),v=function(e,t){var r=j.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return a?r:r.endOf(s)},h=function(e,t){return j.w(n.toDate()[e].apply(n.toDate("s"),(a?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},p=this.$W,m=this.$M,g=this.$D,y="set"+(this.$u?"UTC":"");switch(f){case l:return a?v(1,0):v(31,11);case c:return a?v(1,m):v(0,m+1);case u:var b=this.$locale().weekStart||0,w=(p<b?p+7:p)-b;return v(a?g-w:g+(6-w),m);case s:case d:return h(y+"Hours",0);case i:return h(y+"Minutes",1);case o:return h(y+"Seconds",2);case r:return h(y+"Milliseconds",3);default:return this.clone()}},m.endOf=function(e){return this.startOf(e,!1)},m.$set=function(e,t){var u,a=j.p(e),f="set"+(this.$u?"UTC":""),v=(u={},u[s]=f+"Date",u[d]=f+"Date",u[c]=f+"Month",u[l]=f+"FullYear",u[i]=f+"Hours",u[o]=f+"Minutes",u[r]=f+"Seconds",u[n]=f+"Milliseconds",u)[a],h=a===s?this.$D+(t-this.$W):t;if(a===c||a===l){var p=this.clone().set(d,1);p.$d[v](h),p.init(),this.$d=p.set(d,Math.min(this.$D,p.daysInMonth())).$d}else v&&this.$d[v](h);return this.init(),this},m.set=function(e,t){return this.clone().$set(e,t)},m.get=function(e){return this[j.p(e)]()},m.add=function(n,a){var d,f=this;n=Number(n);var v=j.p(a),h=function(e){var t=O(f);return j.w(t.date(t.date()+Math.round(e*n)),f)};if(v===c)return this.set(c,this.$M+n);if(v===l)return this.set(l,this.$y+n);if(v===s)return h(1);if(v===u)return h(7);var p=(d={},d[o]=e,d[i]=t,d[r]=1e3,d)[v]||1,m=this.$d.getTime()+n*p;return j.w(m,this)},m.subtract=function(e,t){return this.add(-1*e,t)},m.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||f;var r=e||"YYYY-MM-DDTHH:mm:ssZ",o=j.z(this),i=this.$H,s=this.$m,u=this.$M,c=n.weekdays,a=n.months,l=n.meridiem,d=function(e,n,o,i){return e&&(e[n]||e(t,r))||o[n].slice(0,i)},v=function(e){return j.s(i%12||12,e,"0")},p=l||function(e,t,n){var r=e<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(h,function(e,r){return r||function(e){switch(e){case"YY":return String(t.$y).slice(-2);case"YYYY":return j.s(t.$y,4,"0");case"M":return u+1;case"MM":return j.s(u+1,2,"0");case"MMM":return d(n.monthsShort,u,a,3);case"MMMM":return d(a,u);case"D":return t.$D;case"DD":return j.s(t.$D,2,"0");case"d":return String(t.$W);case"dd":return d(n.weekdaysMin,t.$W,c,2);case"ddd":return d(n.weekdaysShort,t.$W,c,3);case"dddd":return c[t.$W];case"H":return String(i);case"HH":return j.s(i,2,"0");case"h":return v(1);case"hh":return v(2);case"a":return p(i,s,!0);case"A":return p(i,s,!1);case"m":return String(s);case"mm":return j.s(s,2,"0");case"s":return String(t.$s);case"ss":return j.s(t.$s,2,"0");case"SSS":return j.s(t.$ms,3,"0");case"Z":return o}return null}(e)||o.replace(":","")})},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(n,d,f){var v,h=this,p=j.p(d),m=O(n),g=(m.utcOffset()-this.utcOffset())*e,y=this-m,b=function(){return j.m(h,m)};switch(p){case l:v=b()/12;break;case c:v=b();break;case a:v=b()/3;break;case u:v=(y-g)/6048e5;break;case s:v=(y-g)/864e5;break;case i:v=y/t;break;case o:v=y/e;break;case r:v=y/1e3;break;default:v=y}return f?v:j.a(v)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return b[this.$L]},m.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=S(e,t,!0);return r&&(n.$L=r),n},m.clone=function(){return j.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},p}(),_=M.prototype;return O.prototype=_,[["$ms",n],["$s",r],["$m",o],["$H",i],["$W",s],["$M",c],["$y",l],["$D",d]].forEach(function(e){_[e[1]]=function(t){return this.$g(t,e[0],e[1])}}),O.extend=function(e,t){return e.$i||(e(t,M,O),e.$i=!0),O},O.locale=S,O.isDayjs=E,O.unix=function(e){return O(1e3*e)},O.en=b[y],O.Ls=b,O.p={},O}()},6(e,t,n){var r=n(714).Symbol;e.exports=r},271(e,t,n){var r=n(6),o=n(650),i=n(881),s=r?r.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":s&&s in Object(e)?o(e):i(e)}},103(e,t,n){var r=n(997),o=/^\s+/;e.exports=function(e){return e?e.slice(0,r(e)+1).replace(o,""):e}},603(e,t,n){var r="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g;e.exports=r},556(e,t,n){var r=n(546)(Object.getPrototypeOf,Object);e.exports=r},650(e,t,n){var r=n(6),o=Object.prototype,i=o.hasOwnProperty,s=o.toString,u=r?r.toStringTag:void 0;e.exports=function(e){var t=i.call(e,u),n=e[u];try{e[u]=void 0;var r=!0}catch(e){}var o=s.call(e);return r&&(t?e[u]=n:delete e[u]),o}},881(e){var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},546(e){e.exports=function(e,t){return function(n){return e(t(n))}}},714(e,t,n){var r=n(603),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();e.exports=i},997(e){var t=/\s/;e.exports=function(e){for(var n=e.length;n--&&t.test(e.charAt(n)););return n}},12(e,t,n){var r=n(400),o=n(835),i=n(639),s=Math.max,u=Math.min;e.exports=function(e,t,n){var c,a,l,d,f,v,h=0,p=!1,m=!1,g=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function y(t){var n=c,r=a;return c=a=void 0,h=t,d=e.apply(r,n)}function b(e){var n=e-v;return void 0===v||n>=t||n<0||m&&e-h>=l}function w(){var e=o();if(b(e))return E(e);f=setTimeout(w,function(e){var n=t-(e-v);return m?u(n,l-(e-h)):n}(e))}function E(e){return f=void 0,g&&c?y(e):(c=a=void 0,d)}function S(){var e=o(),n=b(e);if(c=arguments,a=this,v=e,n){if(void 0===f)return function(e){return h=e,f=setTimeout(w,t),p?y(e):d}(v);if(m)return clearTimeout(f),f=setTimeout(w,t),y(v)}return void 0===f&&(f=setTimeout(w,t)),d}return t=i(t)||0,r(n)&&(p=!!n.leading,l=(m="maxWait"in n)?s(i(n.maxWait)||0,t):l,g="trailing"in n?!!n.trailing:g),S.cancel=function(){void 0!==f&&clearTimeout(f),h=0,c=v=a=f=void 0},S.flush=function(){return void 0===f?d:E(o())},S}},400(e){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},583(e){e.exports=function(e){return null!=e&&"object"==typeof e}},108(e,t,n){var r=n(271),o=n(556),i=n(583),s=Function.prototype,u=Object.prototype,c=s.toString,a=u.hasOwnProperty,l=c.call(Object);e.exports=function(e){if(!i(e)||"[object Object]"!=r(e))return!1;var t=o(e);if(null===t)return!0;var n=a.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&c.call(n)==l}},975(e,t,n){var r=n(271),o=n(583);e.exports=function(e){return"symbol"==typeof e||o(e)&&"[object Symbol]"==r(e)}},835(e,t,n){var r=n(714);e.exports=function(){return r.Date.now()}},823(e,t,n){var r=n(12),o=n(400);e.exports=function(e,t,n){var i=!0,s=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return o(n)&&(i="leading"in n?!!n.leading:i,s="trailing"in n?!!n.trailing:s),r(e,t,{leading:i,maxWait:t,trailing:s})}},639(e,t,n){var r=n(103),o=n(400),i=n(975),s=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,c=/^0o[0-7]+$/i,a=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(i(e))return NaN;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=r(e);var n=u.test(e);return n||c.test(e)?a(e.slice(2),n?2:8):s.test(e)?NaN:+e}},727(e){var t="undefined"!=typeof Element,n="function"==typeof Map,r="function"==typeof Set,o="function"==typeof ArrayBuffer&&!!ArrayBuffer.isView;function i(e,s){if(e===s)return!0;if(e&&s&&"object"==typeof e&&"object"==typeof s){if(e.constructor!==s.constructor)return!1;var u,c,a,l;if(Array.isArray(e)){if((u=e.length)!=s.length)return!1;for(c=u;0!==c--;)if(!i(e[c],s[c]))return!1;return!0}if(n&&e instanceof Map&&s instanceof Map){if(e.size!==s.size)return!1;for(l=e.entries();!(c=l.next()).done;)if(!s.has(c.value[0]))return!1;for(l=e.entries();!(c=l.next()).done;)if(!i(c.value[1],s.get(c.value[0])))return!1;return!0}if(r&&e instanceof Set&&s instanceof Set){if(e.size!==s.size)return!1;for(l=e.entries();!(c=l.next()).done;)if(!s.has(c.value[0]))return!1;return!0}if(o&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(s)){if((u=e.length)!=s.length)return!1;for(c=u;0!==c--;)if(e[c]!==s[c])return!1;return!0}if(e.constructor===RegExp)return e.source===s.source&&e.flags===s.flags;if(e.valueOf!==Object.prototype.valueOf&&"function"==typeof e.valueOf&&"function"==typeof s.valueOf)return e.valueOf()===s.valueOf();if(e.toString!==Object.prototype.toString&&"function"==typeof e.toString&&"function"==typeof s.toString)return e.toString()===s.toString();if((u=(a=Object.keys(e)).length)!==Object.keys(s).length)return!1;for(c=u;0!==c--;)if(!Object.prototype.hasOwnProperty.call(s,a[c]))return!1;if(t&&e instanceof Element)return!1;for(c=u;0!==c--;)if(("_owner"!==a[c]&&"__v"!==a[c]&&"__o"!==a[c]||!e.$$typeof)&&!i(e[a[c]],s[a[c]]))return!1;return!0}return e!=e&&s!=s}e.exports=function(e,t){try{return i(e,t)}catch(e){if((e.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw e}}},763(e){!function(){"use strict";var t="undefined"!=typeof window&&void 0!==window.document?window.document:{},n=e.exports,r=function(){for(var e,n=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],r=0,o=n.length,i={};r<o;r++)if((e=n[r])&&e[1]in t){for(r=0;r<e.length;r++)i[n[0][r]]=e[r];return i}return!1}(),o={change:r.fullscreenchange,error:r.fullscreenerror},i={request:function(e,n){return new Promise(function(o,i){var s=function(){this.off("change",s),o()}.bind(this);this.on("change",s);var u=(e=e||t.documentElement)[r.requestFullscreen](n);u instanceof Promise&&u.then(s).catch(i)}.bind(this))},exit:function(){return new Promise(function(e,n){if(this.isFullscreen){var o=function(){this.off("change",o),e()}.bind(this);this.on("change",o);var i=t[r.exitFullscreen]();i instanceof Promise&&i.then(o).catch(n)}else e()}.bind(this))},toggle:function(e,t){return this.isFullscreen?this.exit():this.request(e,t)},onchange:function(e){this.on("change",e)},onerror:function(e){this.on("error",e)},on:function(e,n){var r=o[e];r&&t.addEventListener(r,n,!1)},off:function(e,n){var r=o[e];r&&t.removeEventListener(r,n,!1)},raw:r};r?(Object.defineProperties(i,{isFullscreen:{get:function(){return Boolean(t[r.fullscreenElement])}},element:{enumerable:!0,get:function(){return t[r.fullscreenElement]}},isEnabled:{enumerable:!0,get:function(){return Boolean(t[r.fullscreenEnabled])}}}),n?e.exports=i:window.screenfull=i):n?e.exports={isEnabled:!1}:window.screenfull={isEnabled:!1}}()},883(t){"use strict";t.exports=e}},n={};function r(e){var o=n[e];if(void 0!==o)return o.exports;var i=n[e]={exports:{}};return t[e].call(i.exports,i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{"use strict";r.r(o),r.d(o,{CancelledError:()=>k,clearCache:()=>b,configResponsive:()=>Ct,createUpdateEffect:()=>t,isCancelledError:()=>x,useAntdTable:()=>U,useAsyncEffect:()=>G,useBoolean:()=>J,useClickAway:()=>te,useControllableValue:()=>ne,useCookieState:()=>ie,useCountDown:()=>ae,useCounter:()=>de,useCreation:()=>h,useDebounce:()=>ve,useDebounceEffect:()=>he,useDebounceFn:()=>fe,useDeepCompareEffect:()=>be,useDeepCompareLayoutEffect:()=>we,useDocumentVisibility:()=>Oe,useDrag:()=>je,useDrop:()=>Me,useDynamicList:()=>_e,useEventEmitter:()=>ke,useEventListener:()=>Ee,useEventTarget:()=>xe,useExternal:()=>Ce,useFavicon:()=>De,useFocusWithin:()=>Te,useFullscreen:()=>Pe,useFusionTable:()=>$e,useGetState:()=>Ie,useHistoryTravel:()=>He,useHover:()=>Ye,useInViewport:()=>Be,useInfiniteScroll:()=>We,useInterval:()=>qe,useIsomorphicLayoutEffect:()=>Xe,useKeyPress:()=>et,useLatest:()=>p,useLocalStorageState:()=>rt,useLockFn:()=>ot,useLongPress:()=>it,useMap:()=>st,useMemoizedFn:()=>a,useMount:()=>V,useMouse:()=>at,useMutationObserver:()=>_n,useNetwork:()=>vt,usePagination:()=>X,usePrevious:()=>pt,useRafInterval:()=>mt,useRafState:()=>ut,useRafTimeout:()=>gt,useReactive:()=>Ot,useRequest:()=>B,useResetState:()=>jt,useResponsive:()=>At,useSafeState:()=>Tt,useScroll:()=>Ft,useSelections:()=>Nt,useSessionStorageState:()=>Pt,useSet:()=>$t,useSetState:()=>It,useSize:()=>ln,useTextSelection:()=>vn,useTheme:()=>xn,useThrottle:()=>pn,useThrottleEffect:()=>mn,useThrottleFn:()=>hn,useTimeout:()=>gn,useTitle:()=>bn,useToggle:()=>K,useTrackedEffect:()=>wn,useUnmount:()=>m,useUnmountedRef:()=>Dt,useUpdate:()=>W,useUpdateEffect:()=>l,useUpdateLayoutEffect:()=>En,useVirtualList:()=>Sn,useWebSocket:()=>jn,useWhyDidYouUpdate:()=>Mn});var e=r(883);const t=t=>(n,r)=>{const o=(0,e.useRef)(!1);t(()=>()=>{o.current=!1},[]),t(()=>{if(o.current)return n();o.current=!0},r)};function n(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}function i(e,t,n,r){return new(n||(n=Promise))(function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function u(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,u)}c((r=r.apply(e,t||[])).next())})}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;const s=e=>"function"==typeof e,u=e=>"string"==typeof e,c=e=>"number"==typeof e&&!Number.isNaN(e),a=t=>{const n=(0,e.useRef)(t);n.current=(0,e.useMemo)(()=>t,[t]);const r=(0,e.useRef)(void 0);return r.current||(r.current=function(...e){return n.current.apply(this,e)}),r.current},l=t(e.useEffect),d=(t,{manual:n,ready:r=!0,defaultParams:o=[],refreshDeps:i=[],refreshDepsAction:s})=>{const u=(0,e.useRef)(!1);return u.current=!1,l(()=>{!n&&r&&(u.current=!0,t.run(...o))},[r]),l(()=>{u.current||n||(u.current=!0,s?s():t.refresh())},[...i]),{onBefore:()=>{if(!r)return{stopNow:!0}}}};d.onInit=({ready:e=!0,manual:t})=>({loading:!t&&e});const f=d,v=function(e,t){if(e===t)return!0;for(let n=0;n<e.length;n++)if(!Object.is(e[n],t[n]))return!1;return!0},h=(t,n)=>{const{current:r}=(0,e.useRef)({deps:n,obj:void 0,initialized:!1});return!1!==r.initialized&&v(r.deps,n)||(r.deps=n,r.obj=t(),r.initialized=!0),r.obj},p=function(t){const n=(0,e.useRef)(t);return n.current=t,n},m=t=>{const n=p(t);(0,e.useEffect)(()=>()=>{n.current()},[])},g=new Map,y=e=>{(null==e?void 0:e.timer)&&clearTimeout(e.timer)},b=e=>{if(e)(Array.isArray(e)?e:[e]).forEach(e=>{const t=g.get(e);y(t),g.delete(e)});else{for(const e of g.values())y(e);g.clear()}},w=new Map,E={},S=(e,t)=>(E[e]||(E[e]=[]),E[e].push(t),function(){const n=E[e].indexOf(t);E[e].splice(n,1)}),O=(t,{cacheKey:n,cacheTime:r=3e5,staleTime:o=0,setCache:i,getCache:s})=>{const u=(0,e.useRef)(void 0),c=(0,e.useRef)(void 0),a=(e,t)=>{i?i(t):((e,t,n)=>{const r=g.get(e);let o;y(r),t>-1&&(o=setTimeout(()=>{g.delete(e)},t)),g.set(e,Object.assign(Object.assign({},n),{timer:o}))})(e,r,t),((e,t)=>{E[e]&&E[e].forEach(e=>e(t))})(e,t.data)},l=(e,t=[])=>s?s(t):(e=>g.get(e))(e);return h(()=>{if(!n)return;const e=l(n);e&&Object.hasOwnProperty.call(e,"data")&&(t.state.data=e.data,t.state.params=e.params,(-1===o||Date.now()-e.time<=o)&&(t.state.loading=!1)),u.current=S(n,e=>{t.setState({data:e})})},[]),m(()=>{var e;null===(e=u.current)||void 0===e||e.call(u)}),n?{onBefore:e=>{const t=l(n,e);return t&&Object.hasOwnProperty.call(t,"data")?-1===o||Date.now()-t.time<=o?{loading:!1,data:null==t?void 0:t.data,error:void 0,returnNow:!0}:{data:null==t?void 0:t.data,error:void 0}:{}},onRequest:(e,t)=>{let r=(e=>w.get(e))(n);return r&&r!==c.current||(r=e(...t),c.current=r,((e,t)=>{w.set(e,t),t.then(t=>(w.delete(e),t)).catch(()=>{w.delete(e)})})(n,r)),{servicePromise:r}},onSuccess:(e,r)=>{var o;n&&(null===(o=u.current)||void 0===o||o.call(u),a(n,{data:e,params:r,time:Date.now()}),u.current=S(n,e=>{t.setState({data:e})}))},onMutate:e=>{var r;n&&(null===(r=u.current)||void 0===r||r.call(u),a(n,{data:e,params:t.state.params,time:Date.now()}),u.current=S(n,e=>{t.setState({data:e})}))}}:{}};var j,M=r(12),_=r.n(M);const L="__AHOOKS_CANCELLED_ERROR__";class k extends Error{constructor(e="useRequest: the request was cancelled or superseded."){super(e),this[j]=!0,this.name="CancelledError",Object.setPrototypeOf(this,k.prototype)}}function x(e){return e instanceof k||"object"==typeof e&&null!==e&&!0===e[L]}function R(e){var t;null===(t=e.current)||void 0===t||t.call(e,new k),e.current=void 0}j=L;const C=(t,{debounceWait:n,debounceLeading:r,debounceTrailing:o,debounceMaxWait:i,ready:s})=>{const u=(0,e.useRef)(void 0),c=(0,e.useRef)(void 0),a=(0,e.useMemo)(()=>{const e={};return void 0!==r&&(e.leading=r),void 0!==o&&(e.trailing=o),void 0!==i&&(e.maxWait=i),e},[r,o,i]);return(0,e.useEffect)(()=>{if(n){const e=t.runAsync.bind(t);return u.current=_()(e=>{e()},n,a),t.runAsync=(...n)=>!1===t.options.ready?e(...n):(R(c),new Promise((t,r)=>{var o;let i=!1;c.current=r,null===(o=u.current)||void 0===o||o.call(u,()=>{i=!0,c.current=void 0,e(...n).then(t).catch(r)}),i||!1!==a.trailing||R(c)})),()=>{var n;null===(n=u.current)||void 0===n||n.cancel(),R(c),t.runAsync=e}}},[n,a,t]),l(()=>{var e;!1===s&&(null===(e=u.current)||void 0===e||e.cancel(),R(c))},[s]),n?{onCancel:()=>{var e;null===(e=u.current)||void 0===e||e.cancel(),R(c)}}:{}},A=(t,{loadingDelay:n,ready:r})=>{const o=(0,e.useRef)(void 0);if(!n)return{};const i=()=>{o.current&&clearTimeout(o.current)};return{onBefore:()=>(i(),!1!==r&&(o.current=setTimeout(()=>{t.setState({loading:!0})},n)),{loading:!1}),onFinally:()=>{i()},onCancel:()=>{i()}}},D=!("undefined"==typeof window||!window.document||!window.document.createElement);function T(){return!D||"hidden"!==document.visibilityState}const F=new Set;if(D){const e=()=>{T()&&F.forEach(e=>e())};window.addEventListener("visibilitychange",e,!1)}const N=(t,{pollingInterval:n,pollingWhenHidden:r=!0,pollingErrorRetryCount:o=-1})=>{const i=(0,e.useRef)(void 0),s=(0,e.useRef)(void 0),u=(0,e.useRef)(0),c=()=>{var e;i.current&&clearTimeout(i.current),null===(e=s.current)||void 0===e||e.call(s)};return l(()=>{n||c()},[n]),n?{onBefore:()=>{c()},onError:()=>{u.current+=1},onSuccess:()=>{u.current=0},onFinally:()=>{-1===o||-1!==o&&u.current<=o?i.current=setTimeout(()=>{var e;r||T()?t.refresh():s.current=(e=()=>{t.refresh()},F.add(e),function(){F.has(e)&&F.delete(e)})},n):u.current=0},onCancel:()=>{c()}}:{}},P=new Set;if(D){const e=()=>{T()&&(!D||void 0===navigator.onLine||navigator.onLine)&&P.forEach(e=>e())};window.addEventListener("visibilitychange",e,!1),window.addEventListener("focus",e,!1)}const $=(t,{refreshOnWindowFocus:n,focusTimespan:r=5e3})=>{const o=(0,e.useRef)(void 0),i=()=>{var e;null===(e=o.current)||void 0===e||e.call(o)};return(0,e.useEffect)(()=>{if(n){const n=function(e,t){let n=!1;return(...r)=>{n||(n=!0,e(...r),setTimeout(()=>{n=!1},t))}}(t.refresh.bind(t),r);o.current=(e=()=>{n()},P.add(e),function(){P.has(e)&&P.delete(e)})}var e;return()=>{i()}},[n,r]),m(()=>{i()}),{}},I=(t,{retryInterval:n,retryCount:r})=>{const o=(0,e.useRef)(void 0),i=(0,e.useRef)(0),s=(0,e.useRef)(!1);return r?{onBefore:()=>{s.current||(i.current=0),s.current=!1,o.current&&clearTimeout(o.current)},onSuccess:()=>{i.current=0},onError:()=>{if(i.current+=1,-1===r||i.current<=r){const e=null!=n?n:Math.min(1e3*Math.pow(2,i.current),3e4);o.current=setTimeout(()=>{s.current=!0,t.refresh()},e)}else i.current=0},onCancel:()=>{i.current=0,o.current&&clearTimeout(o.current)}}:{}};var z=r(823),H=r.n(z);const Y=(t,{throttleWait:n,throttleLeading:r,throttleTrailing:o})=>{const i=(0,e.useRef)(void 0),s=(0,e.useRef)(void 0),u={};return void 0!==r&&(u.leading=r),void 0!==o&&(u.trailing=o),(0,e.useEffect)(()=>{if(n){const e=t.runAsync.bind(t);return i.current=H()(e=>{e()},n,u),t.runAsync=(...t)=>(R(s),new Promise((n,r)=>{var o;let c=!1;s.current=r,null===(o=i.current)||void 0===o||o.call(i,()=>{c=!0,s.current=void 0,e(...t).then(n).catch(r)}),c||!1!==u.trailing||R(s)})),()=>{var n;t.runAsync=e,null===(n=i.current)||void 0===n||n.cancel(),R(s)}}},[n,r,o]),n?{onCancel:()=>{var e;null===(e=i.current)||void 0===e||e.cancel(),R(s)}}:{}},V=t=>{(0,e.useEffect)(()=>{const e=null==t?void 0:t();var n;if(!(e=>null!=e)(n=e)||!s(n.then))return e},[])},W=()=>{const[,t]=(0,e.useState)({});return a(()=>t({}))};class q{constructor(e,t,n,r={}){this.serviceRef=e,this.options=t,this.subscribe=n,this.initState=r,this.pluginImpls=[],this.count=0,this.state={loading:!1,params:void 0,data:void 0,error:void 0},this.state=Object.assign(Object.assign(Object.assign({},this.state),{loading:!t.manual}),r)}setState(e={}){this.state=Object.assign(Object.assign({},this.state),e),this.subscribe()}runPluginHandler(e,...t){const n=this.pluginImpls.map(n=>{var r;return null===(r=n[e])||void 0===r?void 0:r.call(n,...t)}).filter(Boolean);return Object.assign({},...n)}runAsync(...e){return i(this,void 0,void 0,function*(){var t,r,o,i,s,u,c,a,l,d;this.count+=1;const f=this.count,v=this.runPluginHandler("onBefore",e),{stopNow:h=!1,returnNow:p=!1}=v,m=n(v,["stopNow","returnNow"]);if(h)return Promise.resolve(m.data);if(this.setState(Object.assign({loading:!0,params:e},m)),p)return Promise.resolve(m.data);null===(r=(t=this.options).onBefore)||void 0===r||r.call(t,e);try{let{servicePromise:t}=this.runPluginHandler("onRequest",this.serviceRef.current,e);t||(t=this.serviceRef.current(...e));const n=yield t;if(f!==this.count)throw new k;return this.setState({data:n,error:void 0,loading:!1}),null===(i=(o=this.options).onSuccess)||void 0===i||i.call(o,n,e),this.runPluginHandler("onSuccess",n,e),null===(u=(s=this.options).onFinally)||void 0===u||u.call(s,e,n,void 0),f===this.count&&this.runPluginHandler("onFinally",e,n,void 0),n}catch(t){if(f!==this.count)throw x(t)?t:new k;throw this.setState({error:t,loading:!1}),null===(a=(c=this.options).onError)||void 0===a||a.call(c,t,e),this.runPluginHandler("onError",t,e),null===(d=(l=this.options).onFinally)||void 0===d||d.call(l,e,void 0,t),f===this.count&&this.runPluginHandler("onFinally",e,void 0,t),t}})}run(...e){this.runAsync(...e).catch(e=>{x(e)||this.options.onError||console.error(e)})}cancel(){this.count+=1,this.setState({loading:!1}),this.runPluginHandler("onCancel")}refresh(){this.run(...this.state.params||[])}refreshAsync(){return this.runAsync(...this.state.params||[])}mutate(e){const t=s(e)?e(this.state.data):e;this.runPluginHandler("onMutate",t),this.setState({data:t})}}const B=function(e,t,r){return function(e,t={},r=[]){const{manual:o=!1,ready:i=!0}=t,s=n(t,["manual","ready"]),u=Object.assign({manual:o,ready:i},s),c=p(e),l=W(),d=h(()=>{const e=r.map(e=>{var t;return null===(t=null==e?void 0:e.onInit)||void 0===t?void 0:t.call(e,u)}).filter(Boolean);return new q(c,u,l,Object.assign({},...e))},[]);return d.options=u,d.pluginImpls=r.map(e=>e(d,u)),V(()=>{if(!o&&i){const e=d.state.params||t.defaultParams||[];d.run(...e)}}),m(()=>{d.cancel()}),{loading:d.state.loading,data:d.state.data,error:d.state.error,params:d.state.params||[],cancel:a(d.cancel.bind(d)),refresh:a(d.refresh.bind(d)),refreshAsync:a(d.refreshAsync.bind(d)),run:a(d.run.bind(d)),runAsync:a((...e)=>d.runAsync(...e)),mutate:a(d.mutate.bind(d))}}(e,t,[...r||[],C,A,N,$,Y,f,O,I])},X=(t,r={})=>{var o;const{defaultPageSize:i=10,defaultCurrent:s=1}=r,u=n(r,["defaultPageSize","defaultCurrent"]),c=B(t,Object.assign({defaultParams:[{current:s,pageSize:i}],refreshDepsAction:()=>{p(1)}},u)),{current:l=1,pageSize:d=i}=c.params[0]||{},f=(null===(o=c.data)||void 0===o?void 0:o.total)||0,v=(0,e.useMemo)(()=>Math.ceil(f/d),[d,f]),h=(e,t)=>{let n=e<=0?1:e;const r=t<=0?1:t,o=Math.ceil(f/r);n>o&&(n=Math.max(1,o));const[i={},...s]=c.params||[];c.run(Object.assign(Object.assign({},i),{current:n,pageSize:r}),...s)},p=e=>{h(e,d)};return Object.assign(Object.assign({},c),{pagination:{current:l,pageSize:d,total:f,totalPage:v,onChange:a(h),changeCurrent:a(p),changePageSize:a(e=>{h(l,e)})}})},U=(t,r={})=>{var o;const{form:i,defaultType:s="simple",defaultParams:u,manual:c=!1,refreshDeps:d=[],ready:f=!0}=r,v=n(r,["form","defaultType","defaultParams","manual","refreshDeps","ready"]),h=X(t,Object.assign(Object.assign({ready:f,manual:!0},v),{onSuccess(...e){var t;S.current=!0,null===(t=v.onSuccess)||void 0===t||t.call(v,...e)}})),{params:p=[],run:m}=h,g=p[2]||{},[y,b]=(0,e.useState)((null==g?void 0:g.type)||s),w=(0,e.useRef)({}),E=(0,e.useRef)([]),S=(0,e.useRef)(!1),O=!!(null==i?void 0:i.getInternalHooks),j=()=>{if(!i)return{};if(O)return i.getFieldsValue(null,()=>!0);const e=i.getFieldsValue(),t={};return Object.keys(e).forEach(n=>{i.getFieldInstance&&!i.getFieldInstance(n)||(t[n]=e[n])}),t},M=()=>{if(!i)return;if(O)return i.setFieldsValue(w.current);const e={};Object.keys(w.current).forEach(t=>{i.getFieldInstance&&!i.getFieldInstance(t)||(e[t]=w.current[t])}),i.setFieldsValue(e)},_=e=>{f&&setTimeout(()=>{(()=>{if(!i)return Promise.resolve({});const e=j(),t=Object.keys(e);return O?i.validateFieldsReturnFormatValue?i.validateFieldsReturnFormatValue(t):i.validateFields(t):new Promise((e,n)=>{i.validateFields(t,(t,r)=>{t?n(t):e(r)})})})().then((t={})=>{const n=e||Object.assign(Object.assign({pageSize:r.defaultPageSize||10},(null==p?void 0:p[0])||{}),{current:1});i?(w.current=Object.assign(Object.assign({},w.current),t),m(n,t,{allFormData:w.current,type:y})):m(n)}).catch(e=>e)})};(0,e.useEffect)(()=>{if(p.length>0)return w.current=(null==g?void 0:g.allFormData)||{},M(),void m(...p);f&&(w.current=(null==u?void 0:u[1])||{},M(),c||_(null==u?void 0:u[0]))},[]),l(()=>{f&&M()},[y]);const L=(0,e.useRef)(!1);return L.current=!1,l(()=>{!c&&f&&(L.current=!0,i&&i.resetFields(),w.current=(null==u?void 0:u[1])||{},M(),_(null==u?void 0:u[0]))},[f]),l(()=>{L.current||f&&(c||(L.current=!0,r.refreshDepsAction?r.refreshDepsAction():h.pagination.changeCurrent(1)))},[...d]),Object.assign(Object.assign({},h),{tableProps:{dataSource:(null===(o=h.data)||void 0===o?void 0:o.list)||E.current,loading:h.loading,onChange:a((e,t,n,r)=>{const[o,...i]=p||[];m(Object.assign(Object.assign({},o),{current:e.current,pageSize:e.pageSize,filters:t,sorter:n,extra:r}),...i)}),pagination:{current:h.pagination.current,pageSize:h.pagination.pageSize,total:h.pagination.total}},search:{submit:a(e=>{var t,n,o;null===(t=null==e?void 0:e.preventDefault)||void 0===t||t.call(e),_(S.current?void 0:Object.assign({pageSize:r.defaultPageSize||(null===(o=null===(n=r.defaultParams)||void 0===n?void 0:n[0])||void 0===o?void 0:o.pageSize)||10,current:1},(null==u?void 0:u[0])||{}))}),type:y,changeType:a(()=>{const e=j();w.current=Object.assign(Object.assign({},w.current),e),b(e=>"simple"===e?"advance":"simple")}),reset:a(()=>{var e,t;i&&i.resetFields(),_(Object.assign(Object.assign({},(null==u?void 0:u[0])||{}),{pageSize:r.defaultPageSize||(null===(t=null===(e=r.defaultParams)||void 0===e?void 0:e[0])||void 0===t?void 0:t.pageSize)||10,current:1}))})}})},G=function(t,n){(0,e.useEffect)(()=>{const e=t();if("function"==typeof e)return e;const n=e;let r=!1;return function(){i(this,void 0,void 0,function*(){if(s(n[Symbol.asyncIterator]))for(;!(yield n.next()).done&&!r;);else yield n})}(),()=>{r=!0}},n)},K=function(t=!1,n){const[r,o]=(0,e.useState)(t);return[r,(0,e.useMemo)(()=>{const e=void 0===n?!t:n;return{toggle:()=>o(n=>n===t?e:t),set:e=>o(e),setLeft:()=>o(t),setRight:()=>o(e)}},[])]};function J(t=!1){const[n,{toggle:r,set:o}]=K(!!t);return[n,(0,e.useMemo)(()=>({toggle:r,set:e=>o(!!e),setTrue:()=>o(!0),setFalse:()=>o(!1)}),[])]}function Z(e,t){if(!D)return;if(!e)return t;let n;return n=s(e)?e():"current"in e?e.current:e,n}const Q=t=>(n,r,o)=>{const i=(0,e.useRef)(!1),s=(0,e.useRef)([]),u=(0,e.useRef)([]),c=(0,e.useRef)(void 0);t(()=>{var e;const t=(Array.isArray(o)?o:[o]).map(e=>Z(e));if(!i.current)return i.current=!0,s.current=t,u.current=r,void(c.current=n());t.length===s.current.length&&v(s.current,t)&&v(u.current,r)||(null===(e=c.current)||void 0===e||e.call(c),s.current=t,u.current=r,c.current=n())}),m(()=>{var e;null===(e=c.current)||void 0===e||e.call(c),i.current=!1})},ee=Q(e.useEffect),te=(e,t,n="click")=>{const r=p(e);ee(()=>{const e=e=>{(Array.isArray(t)?t:[t]).some(t=>{const n=Z(t);return!n||n.contains(e.target)})||r.current(e)},o=(e=>{if(!e||!document.getRootNode)return document;const t=Array.isArray(e)?e:[e];return(e=>e.every(e=>{const t=Z(e);return!!t&&t.getRootNode()instanceof ShadowRoot}))(t)&&(n=Z(t[0]))?n.getRootNode():document;var n})(t),i=Array.isArray(n)?n:[n];return i.forEach(t=>{o.addEventListener(t,e)}),()=>{i.forEach(t=>{o.removeEventListener(t,e)})}},Array.isArray(n)?n:[n],t)},ne=function(t,n={}){const r=null!=t?t:{},{defaultValue:o,defaultValuePropName:i="defaultValue",valuePropName:u="value",trigger:c="onChange"}=n,l=r[u],d=Object.prototype.hasOwnProperty.call(r,u),f=(0,e.useMemo)(()=>d?l:Object.prototype.hasOwnProperty.call(r,i)?r[i]:o,[]),v=(0,e.useRef)(f);d&&(v.current=l);const h=W();return[v.current,a(function(e,...t){const n=s(e)?e(v.current):e;d||(v.current=n,h()),r[c]&&r[c](n,...t)})]};function re(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)e[r]=n[r]}return e}var oe=function e(t,n){function r(e,r,o){if("undefined"!=typeof document){"number"==typeof(o=re({},n,o)).expires&&(o.expires=new Date(Date.now()+864e5*o.expires)),o.expires&&(o.expires=o.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var i="";for(var s in o)o[s]&&(i+="; "+s,!0!==o[s]&&(i+="="+o[s].split(";")[0]));return document.cookie=e+"="+t.write(r,e)+i}}return Object.create({set:r,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],r={},o=0;o<n.length;o++){var i=n[o].split("="),s=i.slice(1).join("=");try{var u=decodeURIComponent(i[0]);if(r[u]=t.read(s,u),e===u)break}catch(e){}}return e?r[e]:r}},remove:function(e,t){r(e,"",re({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,re({},this.attributes,t))},withConverter:function(t){return e(re({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(n)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"});const ie=(t,r={})=>{const[o,i]=(0,e.useState)(()=>{const e=oe.get(t);return u(e)?e:s(r.defaultValue)?r.defaultValue():r.defaultValue}),c=a((e,u={})=>{const c=Object.assign(Object.assign({},r),u),{defaultValue:a}=c,l=n(c,["defaultValue"]),d=s(e)?e(o):e;i(d),void 0===d?oe.remove(t):oe.set(t,d,l)});return[o,c]};var se=r(300),ue=r.n(se);const ce=e=>{if(!e)return 0;const t=ue()(e).valueOf()-Date.now();return t<0?0:t},ae=(t={})=>{const{leftTime:n,targetDate:r,interval:o=1e3,onEnd:i}=t||{},s=(0,e.useMemo)(()=>c(n)&&n>0?Date.now()+n:void 0,[n]),u="leftTime"in t?s:r,[a,l]=(0,e.useState)(()=>ce(u)),d=p(i);(0,e.useEffect)(()=>{if(!u)return void l(0);l(ce(u));const e=setInterval(()=>{var t;const n=ce(u);l(n),0===n&&(clearInterval(e),null===(t=d.current)||void 0===t||t.call(d))},o);return()=>clearInterval(e)},[u,o]);const f=(0,e.useMemo)(()=>{return e=a,{days:Math.floor(e/864e5),hours:Math.floor(e/36e5)%24,minutes:Math.floor(e/6e4)%60,seconds:Math.floor(e/1e3)%60,milliseconds:Math.floor(e)%1e3};var e},[a]);return[a,f]};function le(e,t={}){const{min:n,max:r}=t;let o=e;return c(r)&&(o=Math.min(r,o)),c(n)&&(o=Math.max(n,o)),o}const de=function(t=0,n={}){const{min:r,max:o}=n,[i,s]=(0,e.useState)(()=>le(t,{min:r,max:o})),u=e=>{s(t=>le(c(e)?e:e(t),{max:o,min:r}))};return[i,{inc:a((e=1)=>{u(t=>t+e)}),dec:a((e=1)=>{u(t=>t-e)}),set:a(e=>{u(e)}),reset:a(()=>{u(t)})}]},fe=function(t,n){var r;const o=p(t),i=null!==(r=null==n?void 0:n.wait)&&void 0!==r?r:1e3,s=(0,e.useMemo)(()=>_()((...e)=>o.current(...e),i,n),[]);return m(()=>{s.cancel()}),{run:s,cancel:s.cancel,flush:s.flush}},ve=function(t,n){const[r,o]=(0,e.useState)(t),{run:i}=fe(()=>{o(t)},n);return(0,e.useEffect)(()=>{i()},[t]),r},he=function(t,n,r){const[o,i]=(0,e.useState)({}),{run:s}=fe(()=>{i({})},r);(0,e.useEffect)(()=>s(),n),l(t,[o])};var pe=r(727),me=r.n(pe);const ge=(e=[],t=[])=>me()(e,t),ye=t=>(n,r)=>{const o=(0,e.useRef)(void 0),i=(0,e.useRef)(0);void 0!==r&&ge(r,o.current)||(i.current+=1),o.current=r,t(n,[i.current])},be=ye(e.useEffect),we=ye(e.useLayoutEffect),Ee=function(e,t,n={}){const{enable:r=!0}=n,o=p(t);ee(()=>{if(!r)return;const t=Z(n.target,window);if(!(null==t?void 0:t.addEventListener))return;const i=e=>o.current(e),s=Array.isArray(e)?e:[e];return s.forEach(e=>{t.addEventListener(e,i,{capture:n.capture,once:n.once,passive:n.passive})}),()=>{s.forEach(e=>{t.removeEventListener(e,i,{capture:n.capture})})}},[e,n.capture,n.once,n.passive,r],n.target)},Se=()=>D?document.visibilityState:"visible",Oe=function(){const[t,n]=(0,e.useState)(Se);return Ee("visibilitychange",()=>{n(Se())},{target:()=>document}),t},je=(t,n,r={})=>{const o=p(r),i=p(t),s=(0,e.useRef)(void 0),{dragImage:c}=o.current;V(()=>{if(null==c?void 0:c.image){const{image:e}=c;if(u(e)){const t=new Image;t.src=e,s.current=t}else s.current=e}}),ee(()=>{const e=Z(n);if(!(null==e?void 0:e.addEventListener))return;const t=e=>{var t,n;if(null===(n=(t=o.current).onDragStart)||void 0===n||n.call(t,e),e.dataTransfer.setData("custom",JSON.stringify(i.current)),(null==c?void 0:c.image)&&s.current){const{offsetX:t=0,offsetY:n=0}=c;e.dataTransfer.setDragImage(s.current,t,n)}},r=e=>{var t,n;null===(n=(t=o.current).onDragEnd)||void 0===n||n.call(t,e)};return e.setAttribute("draggable","true"),e.addEventListener("dragstart",t),e.addEventListener("dragend",r),()=>{e.removeEventListener("dragstart",t),e.removeEventListener("dragend",r)}},[],n)},Me=(t,n={})=>{const r=p(n),o=(0,e.useRef)(void 0);ee(()=>{const e=Z(t);if(!(null==e?void 0:e.addEventListener))return;const n=(e,t)=>{const n=e.getData("text/uri-list"),o=e.getData("custom");if(o&&r.current.onDom){let e=o;try{e=JSON.parse(o)}catch(t){e=o}return void r.current.onDom(e,t)}n&&r.current.onUri?r.current.onUri(n,t):e.files&&e.files.length&&r.current.onFiles?r.current.onFiles(Array.from(e.files),t):e.items&&e.items.length&&r.current.onText&&e.items[0].getAsString(e=>{r.current.onText(e,t)})},i=e=>{var t,n;e.preventDefault(),e.stopPropagation(),o.current=e.target,null===(n=(t=r.current).onDragEnter)||void 0===n||n.call(t,e)},s=e=>{var t,n;e.preventDefault(),null===(n=(t=r.current).onDragOver)||void 0===n||n.call(t,e)},u=e=>{var t,n;e.target===o.current&&(null===(n=(t=r.current).onDragLeave)||void 0===n||n.call(t,e))},c=e=>{var t,o;e.preventDefault(),n(e.dataTransfer,e),null===(o=(t=r.current).onDrop)||void 0===o||o.call(t,e)},a=e=>{var t,o;n(e.clipboardData,e),null===(o=(t=r.current).onPaste)||void 0===o||o.call(t,e)};return e.addEventListener("dragenter",i),e.addEventListener("dragover",s),e.addEventListener("dragleave",u),e.addEventListener("drop",c),e.addEventListener("paste",a),()=>{e.removeEventListener("dragenter",i),e.removeEventListener("dragover",s),e.removeEventListener("dragleave",u),e.removeEventListener("drop",c),e.removeEventListener("paste",a)}},[],t)},_e=(t=[])=>{const n=(0,e.useRef)(-1),r=(0,e.useRef)([]),o=(0,e.useCallback)(e=>{n.current+=1,r.current.splice(e,0,n.current)},[]),[i,s]=(0,e.useState)(()=>(t.forEach((e,t)=>{o(t)}),t)),u=(0,e.useCallback)(e=>{r.current=[],s(()=>(e.forEach((e,t)=>{o(t)}),e))},[]),c=(0,e.useCallback)((e,t)=>{s(n=>{const r=[...n];return r.splice(e,0,t),o(e),r})},[]),a=(0,e.useCallback)(e=>r.current[e],[]),l=(0,e.useCallback)(e=>r.current.findIndex(t=>t===e),[]),d=(0,e.useCallback)((e,t)=>{s(n=>{const r=[...n];return t.forEach((t,n)=>{o(e+n)}),r.splice(e,0,...t),r})},[]),f=(0,e.useCallback)((e,t)=>{s(n=>{const r=[...n];return r[e]=t,r})},[]),v=(0,e.useCallback)(e=>{s(t=>{const n=[...t];n.splice(e,1);try{r.current.splice(e,1)}catch(e){console.error(e)}return n})},[]),h=(0,e.useCallback)(e=>{Array.isArray(e)&&e.length&&s(t=>{const n=[],o=t.filter((t,r)=>{const o=!e.includes(r);return o&&n.push(a(r)),o});return r.current=n,o})},[]),p=(0,e.useCallback)((e,t)=>{e!==t&&s(n=>{const o=[...n],i=o.filter((t,n)=>n!==e);i.splice(t,0,o[e]);try{const n=r.current.filter((t,n)=>n!==e);n.splice(t,0,r.current[e]),r.current=n}catch(e){console.error(e)}return i})},[]),m=(0,e.useCallback)(e=>{s(t=>(o(t.length),t.concat([e])))},[]),g=(0,e.useCallback)(()=>{try{r.current=r.current.slice(0,r.current.length-1)}catch(e){console.error(e)}s(e=>e.slice(0,e.length-1))},[]),y=(0,e.useCallback)(e=>{s(t=>(o(0),[e].concat(t)))},[]),b=(0,e.useCallback)(()=>{try{r.current=r.current.slice(1,r.current.length)}catch(e){console.error(e)}s(e=>e.slice(1,e.length))},[]),w=(0,e.useCallback)(e=>e.map((e,t)=>({key:t,item:e})).sort((e,t)=>l(e.key)-l(t.key)).filter(e=>!!e.item).map(e=>e.item),[]);return{list:i,insert:c,merge:d,replace:f,remove:v,batchRemove:h,getKey:a,getIndex:l,move:p,push:m,pop:g,unshift:y,shift:b,sortList:w,resetList:u}};class Le{constructor(){this.subscriptions=new Set,this.emit=e=>{for(const t of this.subscriptions)t(e)},this.useSubscription=t=>{const n=(0,e.useRef)(void 0);n.current=t,(0,e.useEffect)(()=>{function e(e){n.current&&n.current(e)}return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}},[])}}}const ke=()=>{const t=(0,e.useRef)(void 0);return t.current||(t.current=new Le),t.current},xe=function(t){const{initialValue:n,transformer:r}=t||{},[o,i]=(0,e.useState)(n),u=p(r),c=(0,e.useCallback)(()=>i(n),[]);return[o,{onChange:(0,e.useCallback)(e=>{const t=e.target.value;return s(u.current)?i(u.current(t)):i(t)},[]),reset:c}]},Re={},Ce=(t,n)=>{const[r,o]=(0,e.useState)(t?"loading":"unset"),i=(0,e.useRef)(void 0);return(0,e.useEffect)(()=>{if(!t)return void o("unset");const e=t.replace(/[|#].*$/,"");if("css"===(null==n?void 0:n.type)||!(null==n?void 0:n.type)&&/(^css!|\.css$)/.test(e)){const e=((e,t={})=>{const n=document.querySelector(`link[href="${e}"]`);if(!n){const n=document.createElement("link");return n.rel="stylesheet",n.href=e,Object.keys(t).forEach(e=>{n[e]=t[e]}),"hideFocus"in n&&n.relList&&(n.rel="preload",n.as="style"),n.setAttribute("data-status","loading"),document.head.appendChild(n),{ref:n,status:"loading"}}return{ref:n,status:n.getAttribute("data-status")||"ready"}})(t,null==n?void 0:n.css);i.current=e.ref,o(e.status)}else if("js"===(null==n?void 0:n.type)||!(null==n?void 0:n.type)&&/(^js!|\.js$)/.test(e)){const e=((e,t={})=>{const n=document.querySelector(`script[src="${e}"]`);if(!n){const n=document.createElement("script");return n.src=e,Object.keys(t).forEach(e=>{n[e]=t[e]}),n.setAttribute("data-status","loading"),document.body.appendChild(n),{ref:n,status:"loading"}}return{ref:n,status:n.getAttribute("data-status")||"ready"}})(t,null==n?void 0:n.js);i.current=e.ref,o(e.status)}else console.error("Cannot infer the type of external resource, and please provide a type ('js' | 'css'). Refer to the https://ahooks.js.org/hooks/dom/use-external/#options");if(!i.current)return;void 0===Re[t]?Re[t]=1:Re[t]+=1;const r=e=>{var t;const n="load"===e.type?"ready":"error";null===(t=i.current)||void 0===t||t.setAttribute("data-status",n),o(n)};return i.current.addEventListener("load",r),i.current.addEventListener("error",r),()=>{var e,o,s;null===(e=i.current)||void 0===e||e.removeEventListener("load",r),null===(o=i.current)||void 0===o||o.removeEventListener("error",r),Re[t]-=1,0!==Re[t]||(null==n?void 0:n.keepWhenUnused)||null===(s=i.current)||void 0===s||s.remove(),i.current=void 0}},[t]),r},Ae={SVG:"image/svg+xml",ICO:"image/x-icon",GIF:"image/gif",PNG:"image/png"},De=t=>{(0,e.useEffect)(()=>{if(!t)return;const e=t.split("."),n=e[e.length-1].toLocaleUpperCase(),r=document.querySelector("link[rel*='icon']")||document.createElement("link");r.type=Ae[n],r.href=t,r.rel="shortcut icon",document.getElementsByTagName("head")[0].appendChild(r)},[t])};function Te(t,n){const[r,o]=(0,e.useState)(!1),{onFocus:i,onBlur:s,onChange:u}=n||{};return Ee("focusin",e=>{r||(null==i||i(e),null==u||u(!0),o(!0))},{target:t}),Ee("focusout",e=>{var t,n;r&&!(null===(n=null===(t=e.currentTarget)||void 0===t?void 0:t.contains)||void 0===n?void 0:n.call(t,e.relatedTarget))&&(null==s||s(e),null==u||u(!1),o(!1))},{target:t}),r}var Fe=r(763),Ne=r.n(Fe);const Pe=(t,n)=>{const{onExit:r,onEnter:o,pageFullscreen:i=!1}=n||{},{className:s="ahooks-page-fullscreen",zIndex:u=999999}="boolean"!=typeof i&&i?i:{},c=p(r),l=p(o),[d,f]=(0,e.useState)(h),v=(0,e.useRef)(h());function h(){return Ne().isEnabled&&!!Ne().element&&Ne().element===Z(t)}const m=e=>{v.current!==e&&((e=>{var t,n;e?null===(t=l.current)||void 0===t||t.call(l):null===(n=c.current)||void 0===n||n.call(c)})(e),f(e),v.current=e)},g=()=>{const e=h();m(e)},y=e=>{const n=Z(t);if(!n)return;let r=document.getElementById(s);e?(n.classList.add(s),r||(r=document.createElement("style"),r.setAttribute("id",s),r.textContent=`\n          .${s} {\n            position: fixed; left: 0; top: 0; right: 0; bottom: 0;\n            width: 100% !important; height: 100% !important;\n            z-index: ${u};\n          }`,n.appendChild(r))):(n.classList.remove(s),r&&r.remove()),m(e)},b=()=>{const e=Z(t);if(e)if(i)y(!0);else if(Ne().isEnabled)try{Ne().request(e)}catch(e){console.error(e)}},w=()=>{const e=Z(t);e&&(i?y(!1):Ne().isEnabled&&Ne().element===e&&Ne().exit())};return(0,e.useEffect)(()=>{if(Ne().isEnabled&&!i)return Ne().on("change",g),()=>{Ne().off("change",g)}},[]),[d,{enterFullscreen:a(b),exitFullscreen:a(w),toggleFullscreen:a(()=>{d?w():b()}),isEnabled:Ne().isEnabled}]},$e=(e,t={})=>{var n;return(e=>{const t={dataSource:e.tableProps.dataSource,loading:e.tableProps.loading,onSort:(t,n)=>{var r;e.tableProps.onChange({current:e.pagination.current,pageSize:e.pagination.pageSize},null===(r=e.params[0])||void 0===r?void 0:r.filters,{field:t,order:n})},onFilter:t=>{var n;e.tableProps.onChange({current:e.pagination.current,pageSize:e.pagination.pageSize},t,null===(n=e.params[0])||void 0===n?void 0:n.sorter)}},n={onChange:e.pagination.changeCurrent,onPageSizeChange:e.pagination.changePageSize,current:e.pagination.current,pageSize:e.pagination.pageSize,total:e.pagination.total};return Object.assign(Object.assign({},e),{tableProps:t,paginationProps:n})})(U(e,Object.assign(Object.assign({},t),{form:t.field?(n=t.field,{getFieldInstance:e=>n.getNames().includes(e),setFieldsValue:n.setValues,getFieldsValue:n.getValues,resetFields:n.resetToDefault,validateFields:(e,t)=>{n.validate(e,t)}}):void 0})))},Ie=function(t){const[n,r]=(0,e.useState)(t),o=p(n);return[n,r,(0,e.useCallback)(()=>o.current,[])]},ze=(e,t)=>{const n=((e,t)=>{let n=e>0?e-1:t.length+e;return n>=t.length-1&&(n=t.length-1),n<0&&(n=0),n})(e,t);return{_current:t[n],_before:t.slice(0,n),_after:t.slice(n+1)}};function He(t,n=0){const[r,o]=(0,e.useState)({present:t,past:[],future:[]}),{present:i,past:s,future:u}=r,l=(0,e.useRef)(t),d=e=>{const t=c(e)?e:Number(e);if(0!==t)return t>0?((e=1)=>{if(0===u.length)return;const{_before:t,_current:n,_after:r}=ze(e,u);o({past:[...s,i,...t],present:n,future:r})})(t):void((e=-1)=>{if(0===s.length)return;const{_before:t,_current:n,_after:r}=ze(e,s);o({past:t,present:n,future:[...r,i,...u]})})(t)};return{value:i,backLength:s.length,forwardLength:u.length,setValue:a(e=>{const t=[...s,i],r=c(n)?n:Number(n);r>0&&t.length>r&&t.splice(0,1),o({present:e,future:[],past:t})}),go:a(d),back:a(()=>{d(-1)}),forward:a(()=>{d(1)}),reset:a((...e)=>{const t=e.length>0?e[0]:l.current;l.current=t,o({present:t,future:[],past:[]})})}}const Ye=(e,t)=>{const{onEnter:n,onLeave:r,onChange:o}=t||{},[i,{setTrue:s,setFalse:u}]=J(!1);return Ee("mouseenter",()=>{null==n||n(),s(),null==o||o(!0)},{target:e}),Ee("mouseleave",()=>{null==r||r(),u(),null==o||o(!1)},{target:e}),i};(Object.getOwnPropertyDescriptor(Ye,"name")||{}).writable||Object.defineProperty(Ye,"name",{value:"default",configurable:!0});const Ve=e=>e.scrollHeight||Math.max(document.documentElement.scrollHeight,document.body.scrollHeight),We=(t,n={})=>{const{target:r,isNoMore:o,threshold:s=100,direction:u="bottom",reloadDeps:c=[],manual:d,onBefore:f,onSuccess:v,onError:h,onFinally:p}=n,[m,g]=(0,e.useState)(),[y,b]=(0,e.useState)(!1),w="top"===u,E=(0,e.useRef)(void 0),S=(0,e.useRef)(0),O=(0,e.useRef)(!1),j=(0,e.useMemo)(()=>!!o&&o(m),[m]),{loading:M,error:_,run:L,runAsync:k,cancel:x}=B(e=>i(void 0,void 0,void 0,function*(){return{currentData:yield t(e),lastData:e}}),{manual:d,onFinally:(e,t,n)=>{b(!1),null==p||p(null==t?void 0:t.currentData,n)},onBefore:()=>null==f?void 0:f(),onSuccess:e=>{var t,n,o;e.lastData?g(Object.assign(Object.assign({},e.currentData),{list:w?[...e.currentData.list,...null!==(n=e.lastData.list)&&void 0!==n?n:[]]:[...null!==(o=e.lastData.list)&&void 0!==o?o:[],...e.currentData.list]})):g(Object.assign(Object.assign({},e.currentData),{list:[...null!==(t=e.currentData.list)&&void 0!==t?t:[]]})),w?setTimeout(()=>{requestAnimationFrame(()=>{let e=Z(r);if(e=e===document?document.documentElement:e,e){const t=Ve(e);e.scrollTo(0,t-S.current)}})}):O.current=!0,null==v||v(e.currentData)},onError:e=>null==h?void 0:h(e)}),R=a(()=>{j||(b(!0),L(m))}),C=e=>i(void 0,void 0,void 0,function*(){return(yield k(e)).currentData}),A=a(()=>j?Promise.reject():(b(!0),C(m))),D=()=>{const e=Z(r);if(!e)return;const t=e===document?document.documentElement:e,n=(e=>e===document||e===document.documentElement||e===document.body?Math.max(window.pageYOffset,document.documentElement.scrollTop,document.body.scrollTop):e.scrollTop)(t),o=Ve(t),i=(e=>e.clientHeight||Math.max(document.documentElement.clientHeight,document.body.clientHeight))(t);w?(void 0!==E.current&&E.current>n&&n<=s&&R(),E.current=n,S.current=o-n):o-n<=i+s&&R()};return l(()=>{O.current&&(O.current=!1,D())},[m]),Ee("scroll",()=>{M||y||D()},{target:r}),l(()=>{L()},[...c]),{data:m,loading:!y&&M,error:_,loadingMore:y,noMore:j,loadMore:R,loadMoreAsync:A,reload:a(()=>(b(!1),L())),reloadAsync:a(()=>(b(!1),C())),mutate:g,cancel:x}},qe=(t,n,r={})=>{const o=a(t),i=(0,e.useRef)(null),s=(0,e.useCallback)(()=>{i.current&&clearInterval(i.current)},[]);return(0,e.useEffect)(()=>{if(c(n)&&!(n<0))return r.immediate&&o(),i.current=setInterval(o,n),s},[n,r.immediate]),s},Be=function(t,r){const o=r||{},{callback:i}=o,s=n(o,["callback"]),[u,c]=(0,e.useState)(),[a,l]=(0,e.useState)();return ee(()=>{const e=(Array.isArray(t)?t:[t]).map(e=>Z(e)).filter(Boolean);if(!e.length)return;const n=new IntersectionObserver(e=>{for(const t of e)l(t.intersectionRatio),c(t.isIntersecting),null==i||i(t)},Object.assign(Object.assign({},s),{root:Z(null==r?void 0:r.root)}));return e.forEach(e=>n.observe(e)),()=>{n.disconnect()}},[null==r?void 0:r.rootMargin,null==r?void 0:r.threshold,i],t),[u,a]},Xe=D?e.useLayoutEffect:()=>{},Ue=(t,n,r)=>{const o=(0,e.useRef)(void 0),i=(0,e.useRef)(0);ge(n,o.current)||(i.current+=1),o.current=n,ee(t,[i.current],r)},Ge={0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,backspace:8,tab:9,enter:13,shift:16,ctrl:17,control:17,alt:18,pausebreak:19,pause:19,capslock:20,esc:27,escape:27,space:32,spacebar:32,pageup:33,pagedown:34,end:35,home:36,leftarrow:37,arrowleft:37,uparrow:38,arrowup:38,rightarrow:39,arrowright:39,downarrow:40,arrowdown:40,insert:45,delete:46,a:65,b:66,c:67,d:68,e:69,f:70,g:71,h:72,i:73,j:74,k:75,l:76,m:77,n:78,o:79,p:80,q:81,r:82,s:83,t:84,u:85,v:86,w:87,x:88,y:89,z:90,leftwindowkey:91,rightwindowkey:92,meta:/(mac|iphone|ipod|ipad)/i.test("undefined"!=typeof navigator?null===navigator||void 0===navigator?void 0:navigator.platform:"")?[91,93]:[91,92],selectkey:93,contextmenu:93,numpad0:96,numpad1:97,numpad2:98,numpad3:99,numpad4:100,numpad5:101,numpad6:102,numpad7:103,numpad8:104,numpad9:105,multiply:106,add:107,subtract:109,decimalpoint:110,divide:111,f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123,numlock:144,scrolllock:145,semicolon:186,equalsign:187,comma:188,dash:189,period:190,forwardslash:191,graveaccent:192,openbracket:219,backslash:220,closebracket:221,singlequote:222},Ke={ctrl:e=>e.ctrlKey||"keyup"===e.type&&17===e.keyCode,shift:e=>e.shiftKey||"keyup"===e.type&&16===e.keyCode,alt:e=>e.altKey||"keyup"===e.type&&18===e.keyCode,meta:e=>e.metaKey||"keyup"===e.type&&Ge.meta.includes(e.keyCode)};function Je(e){return u(e)||c(e)}function Ze(e,t,n){if(!e.key)return!1;if(c(t))return e.keyCode===t&&t;const r=t.split(".");let o=0;for(const t of r){const n=Ke[t],r=Ge[t.toLowerCase()];(n&&n(e)||r&&r===e.keyCode)&&o++}return n?o===r.length&&function(e){const t=Object.keys(Ke).reduce((t,n)=>Ke[n](e)?t+1:t,0);return[16,17,18,91,92].includes(e.keyCode)?t:t+1}(e)===r.length&&t:o===r.length&&t}const Qe=["keydown"],et=function(e,t,n){const{events:r=Qe,target:o,exactMatch:i=!1,useCapture:u=!1}=n||{},c=p(t),a=p(e);Ue(()=>{var e;const t=Z(o,window);if(!t)return;const n=e=>{var t;const n=e,r=function(e,t){return s(e)?e:Je(e)?n=>Ze(n,e,t):Array.isArray(e)?n=>e.find(e=>Ze(n,e,t)):()=>Boolean(e)}(a.current,i),o=r(n),u=Je(o)?o:n.key;if(o)return null===(t=c.current)||void 0===t?void 0:t.call(c,n,u)};for(const o of r)null===(e=null==t?void 0:t.addEventListener)||void 0===e||e.call(t,o,n,u);return()=>{var e;for(const o of r)null===(e=null==t?void 0:t.removeEventListener)||void 0===e||e.call(t,o,n,u)}},[r],o)},tt="AHOOKS_SYNC_STORAGE_EVENT_NAME",nt=t=>(n,r={})=>{let o;const{listenStorageChange:i=!1,getInitialValueInEffect:u=!1}=r,c=s(r.serializer)?r.serializer:JSON.stringify,d=s(r.deserializer)?r.deserializer:JSON.parse,f=s(r.onError)?r.onError:console.error;try{o=t()}catch(e){f(e)}const v=()=>{try{const e=null==o?void 0:o.getItem(n);if(e)return d(e)}catch(e){f(e)}return h()};function h(){return s(r.defaultValue)?r.defaultValue():r.defaultValue}const[p,m]=(0,e.useState)(()=>u?h():v());V(()=>{u&&m(v())});const g=(0,e.useRef)(p);g.current=p,l(()=>{const e=v();Object.is(e,g.current)||(g.current=e,m(e))},[n]);const y=e=>{if(e.key!==n||e.storageArea!==o)return;const t=v();Object.is(t,g.current)||(g.current=t,m(t))};return Ee("storage",y,{enable:i}),Ee(tt,e=>{y(e.detail)},{enable:i}),[p,a(e=>{const t=g.current,r=s(e)?e(t):e;if(!Object.is(r,t)){i||(g.current=r,m(r));try{let e;const t=null==o?void 0:o.getItem(n);void 0===r?(e=null,null==o||o.removeItem(n)):(e=c(r),null==o||o.setItem(n,e)),dispatchEvent(new CustomEvent(tt,{detail:{key:n,newValue:e,oldValue:t,storageArea:o}}))}catch(e){f(e)}}})]},rt=nt(()=>D?localStorage:void 0),ot=function(t){const n=(0,e.useRef)(!1);return(0,e.useCallback)((...e)=>i(this,void 0,void 0,function*(){if(!n.current){n.current=!0;try{return yield t(...e)}catch(e){throw e}finally{n.current=!1}}}),[t])},it=function(t,n,{delay:r=300,moveThreshold:o,onClick:i,onLongPressEnd:s}={}){const u=p(t),c=p(i),a=p(s),l=(0,e.useRef)(void 0),d=(0,e.useRef)(!1),f=(0,e.useRef)({x:0,y:0}),v=(0,e.useRef)(void 0),h=(0,e.useRef)(!1),m=(0,e.useRef)(!1),g=!!((null==o?void 0:o.x)&&o.x>0||(null==o?void 0:o.y)&&o.y>0);ee(()=>{const e=Z(n);if(!(null==e?void 0:e.addEventListener))return;const t="undefined"!=typeof window&&"function"==typeof window.PointerEvent;function i(e){return"TouchEvent"in window&&e instanceof TouchEvent?{clientX:e.touches[0].clientX,clientY:e.touches[0].clientY}:e instanceof MouseEvent?{clientX:e.clientX,clientY:e.clientY}:{clientX:0,clientY:0}}const s=e=>{l.current=setTimeout(()=>{u.current(e),d.current=!0},r)},p=()=>{l.current&&(clearTimeout(l.current),l.current=void 0)},y=(e,t=!0)=>{var n;p(),d.current?null===(n=a.current)||void 0===n||n.call(a,e):t&&c.current&&c.current(e),d.current=!1},b=e=>{void 0===v.current&&!1!==e.isPrimary&&(v.current=e.pointerId,g&&(f.current.x=e.clientX,f.current.y=e.clientY),s(e))},w=e=>{v.current===e.pointerId&&(v.current=void 0,y(e))},E=e=>{v.current===e.pointerId&&(v.current=void 0,y(e,!1))},S=e=>{v.current===e.pointerId&&M(e)},O=e=>{if(!m.current){if(m.current=!0,g){const{clientX:t,clientY:n}=i(e);f.current.x=t,f.current.y=n}s(e)}},j=e=>{var t;(null===(t=null==e?void 0:e.sourceCapabilities)||void 0===t?void 0:t.firesTouchEvents)||(h.current=!0,g&&(f.current.x=e.clientX,f.current.y=e.clientY),s(e))},M=e=>{l.current&&(e=>{const{clientX:t,clientY:n}=i(e),r=Math.abs(t-f.current.x),s=Math.abs(n-f.current.y);return!!((null==o?void 0:o.x)&&r>o.x||(null==o?void 0:o.y)&&s>o.y)})(e)&&p()},_=e=>{m.current&&(m.current=!1,y(e))},L=e=>{var t;(null===(t=null==e?void 0:e.sourceCapabilities)||void 0===t?void 0:t.firesTouchEvents)||h.current&&(h.current=!1,y(e))},k=e=>{h.current&&(h.current=!1,y(e,!1))};if(t)return e.addEventListener("pointerdown",b),e.addEventListener("pointerup",w),e.addEventListener("pointerleave",E),e.addEventListener("pointercancel",E),g&&e.addEventListener("pointermove",S),()=>{p(),d.current=!1,v.current=void 0,e.removeEventListener("pointerdown",b),e.removeEventListener("pointerup",w),e.removeEventListener("pointerleave",E),e.removeEventListener("pointercancel",E),g&&e.removeEventListener("pointermove",S)};const x=e=>{m.current&&(m.current=!1,y(e,!1))};return e.addEventListener("mousedown",j),e.addEventListener("mouseup",L),e.addEventListener("mouseleave",k),e.addEventListener("touchstart",O),e.addEventListener("touchend",_),e.addEventListener("touchcancel",x),g&&(e.addEventListener("mousemove",M),e.addEventListener("touchmove",M)),()=>{p(),d.current=!1,e.removeEventListener("mousedown",j),e.removeEventListener("mouseup",L),e.removeEventListener("mouseleave",k),e.removeEventListener("touchstart",O),e.removeEventListener("touchend",_),e.removeEventListener("touchcancel",x),g&&(e.removeEventListener("mousemove",M),e.removeEventListener("touchmove",M))}},[],n)},st=function(t){const n=()=>new Map(t),[r,o]=(0,e.useState)(n);return[r,{set:a((e,t)=>{o(n=>{const r=new Map(n);return r.set(e,t),r})}),setAll:a(e=>{o(new Map(e))}),remove:a(e=>{o(t=>{const n=new Map(t);return n.delete(e),n})}),reset:a(()=>o(n())),get:a(e=>r.get(e))}]},ut=function(t){const n=(0,e.useRef)(0),[r,o]=(0,e.useState)(t),i=(0,e.useCallback)(e=>{cancelAnimationFrame(n.current),n.current=requestAnimationFrame(()=>{o(e)})},[]);return m(()=>{cancelAnimationFrame(n.current)}),[r,i]},ct={screenX:NaN,screenY:NaN,clientX:NaN,clientY:NaN,pageX:NaN,pageY:NaN,elementX:NaN,elementY:NaN,elementH:NaN,elementW:NaN,elementPosX:NaN,elementPosY:NaN},at=e=>{const[t,n]=ut(ct);return Ee("mousemove",t=>{const{screenX:r,screenY:o,clientX:i,clientY:s,pageX:u,pageY:c}=t,a={screenX:r,screenY:o,clientX:i,clientY:s,pageX:u,pageY:c,elementX:NaN,elementY:NaN,elementH:NaN,elementW:NaN,elementPosX:NaN,elementPosY:NaN},l=Z(e);if(l){const{left:e,top:t,width:n,height:r}=l.getBoundingClientRect();a.elementPosX=e+window.pageXOffset,a.elementPosY=t+window.pageYOffset,a.elementX=u-a.elementPosX,a.elementY=c-a.elementPosY,a.elementW=n,a.elementH=r}n(a)},{target:()=>document}),t};var lt;function dt(){const e=navigator;return null===(t=e)||"object"!=typeof t?null:e.connection||e.mozConnection||e.webkitConnection;var t}function ft(){const e=dt();return e?{rtt:e.rtt,type:e.type,saveData:e.saveData,downlink:e.downlink,downlinkMax:e.downlinkMax,effectiveType:e.effectiveType}:{}}(Object.getOwnPropertyDescriptor(at,"name")||{}).writable||Object.defineProperty(at,"name",{value:"default",configurable:!0}),function(e){e.ONLINE="online",e.OFFLINE="offline",e.CHANGE="change"}(lt||(lt={}));const vt=function(){const[t,n]=(0,e.useState)(()=>Object.assign({since:void 0,online:null===navigator||void 0===navigator?void 0:navigator.onLine},ft()));return(0,e.useEffect)(()=>{const e=()=>{n(e=>Object.assign(Object.assign({},e),{online:!0,since:new Date}))},t=()=>{n(e=>Object.assign(Object.assign({},e),{online:!1,since:new Date}))},r=()=>{n(e=>Object.assign(Object.assign({},e),ft()))};window.addEventListener(lt.ONLINE,e),window.addEventListener(lt.OFFLINE,t);const o=dt();return null==o||o.addEventListener(lt.CHANGE,r),()=>{window.removeEventListener(lt.ONLINE,e),window.removeEventListener(lt.OFFLINE,t),null==o||o.removeEventListener(lt.CHANGE,r)}},[]),t},ht=(e,t)=>!Object.is(e,t),pt=function(t,n=ht){const r=(0,e.useRef)(void 0),o=(0,e.useRef)(void 0);return n(o.current,t)&&(r.current=o.current,o.current=t),r.current},mt=function(t,n,r){const o=null==r?void 0:r.immediate,i=p(t),s=(0,e.useRef)(void 0),u=(0,e.useCallback)(()=>{s.current&&(e=>{if(e.id,"undefined"==typeof cancelAnimationFrame)return clearInterval(e.id);cancelAnimationFrame(e.id)})(s.current)},[]);return(0,e.useEffect)(()=>{if(c(n)&&!(n<0))return o&&i.current(),s.current=((e,t=0)=>{if("undefined"==typeof requestAnimationFrame)return{id:setInterval(e,t)};let n=Date.now();const r={id:0},o=()=>{const i=Date.now();r.id=requestAnimationFrame(o),i-n>=t&&(e(),n=Date.now())};return r.id=requestAnimationFrame(o),r})(()=>{i.current()},n),u},[n]),u},gt=function(t,n){const r=p(t),o=(0,e.useRef)(void 0),i=(0,e.useCallback)(()=>{o.current&&(e=>{if(e.id,"undefined"==typeof cancelAnimationFrame)return clearTimeout(e.id);cancelAnimationFrame(e.id)})(o.current)},[]);return(0,e.useEffect)(()=>{if(c(n)&&!(n<0))return o.current=((e,t=0)=>{if("undefined"==typeof requestAnimationFrame)return{id:setTimeout(e,t)};const n={id:0},r=Date.now(),o=()=>{Date.now()-r>=t?e():n.id=requestAnimationFrame(o)};return n.id=requestAnimationFrame(o),n})(()=>{r.current()},n),i},[n]),i};var yt=r(108),bt=r.n(yt);const wt=new WeakMap,Et=new WeakMap;function St(e,t){const n=wt.get(e);if(n)return n;if(Et.has(e))return e;const r=new Proxy(e,{get(e,n,r){const o=Reflect.get(e,n,r),i=Reflect.getOwnPropertyDescriptor(e,n);return((null==i?void 0:i.configurable)||(null==i?void 0:i.writable))&&(bt()(o)||Array.isArray(o))?St(o,t):o},set(e,n,r){const o=Reflect.set(e,n,r);return t(),o},deleteProperty(e,n){const r=Reflect.deleteProperty(e,n);return t(),r}});return wt.set(e,r),Et.set(r,e),r}const Ot=function(t){const n=W(),r=(0,e.useRef)(t);return h(()=>St(r.current,()=>{n()}),[])},jt=t=>{const n=(0,e.useRef)(t),r=h(()=>s(n.current)?n.current():n.current,[]),[o,i]=(0,e.useState)(r),u=a(()=>{i(r)});return[o,i,u]},Mt=new Set;let _t,Lt={xs:0,sm:576,md:768,lg:992,xl:1200};function kt(){const e=_t;if(Rt(),e!==_t)for(const e of Mt)e()}let xt=!1;function Rt(){const e=window.innerWidth,t={};let n=!1;for(const r of Object.keys(Lt))t[r]=e>=Lt[r],t[r]!==_t[r]&&(n=!0);n&&(_t=t)}function Ct(e){Lt=e,_t&&Rt()}const At=function(){D&&!xt&&(_t={},Rt(),window.addEventListener("resize",kt),xt=!0);const[t,n]=(0,e.useState)(_t);return(0,e.useEffect)(()=>{if(!D)return;xt||window.addEventListener("resize",kt);const e=()=>{n(_t)};return Mt.add(e),()=>{Mt.delete(e),0===Mt.size&&(window.removeEventListener("resize",kt),xt=!1)}},[]),t},Dt=()=>{const t=(0,e.useRef)(!1);return(0,e.useEffect)(()=>(t.current=!1,()=>{t.current=!0}),[]),t},Tt=function(t){const n=Dt(),[r,o]=(0,e.useState)(t);return[r,(0,e.useCallback)(e=>{n.current||o(e)},[])]},Ft=function(e,t=()=>!0){const[n,r]=ut(),o=p(t);return ee(()=>{const t=Z(e,document);if(!t)return;const n=()=>{let e;e=t===document?document.scrollingElement?{left:document.scrollingElement.scrollLeft,top:document.scrollingElement.scrollTop}:{left:Math.max(window.pageXOffset,document.documentElement.scrollLeft,document.body.scrollLeft),top:Math.max(window.pageYOffset,document.documentElement.scrollTop,document.body.scrollTop)}:{left:t.scrollLeft,top:t.scrollTop},o.current(e)&&r(e)};return n(),t.addEventListener("scroll",n),()=>{t.removeEventListener("scroll",n)}},[],e),n},Nt=function(t,n){var r,o;let i,c=[];Array.isArray(n)?c=n:bt()(n)&&(c=null!==(r=null==n?void 0:n.defaultSelected)&&void 0!==r?r:c,i=null!==(o=null==n?void 0:n.itemKey)&&void 0!==o?o:i);const l=e=>s(i)?i(e):u(i)&&bt()(e)?e[i]:e,[d,f]=(0,e.useState)(c),v=(0,e.useMemo)(()=>{const e=new Map;return Array.isArray(d)?(d.forEach(t=>{e.set(l(t),t)}),e):e},[d]),h=e=>v.has(l(e)),p=e=>{v.set(l(e),e),f(Array.from(v.values()))},m=e=>{v.delete(l(e)),f(Array.from(v.values()))},g=()=>{t.forEach(e=>{v.set(l(e),e)}),f(Array.from(v.values()))},y=()=>{t.forEach(e=>{v.delete(l(e))}),f(Array.from(v.values()))},b=(0,e.useMemo)(()=>t.every(e=>!v.has(l(e))),[t,v]),w=(0,e.useMemo)(()=>t.every(e=>v.has(l(e)))&&!b,[t,v,b]),E=(0,e.useMemo)(()=>!b&&!w,[b,w]);return{selected:d,noneSelected:b,allSelected:w,partiallySelected:E,setSelected:f,isSelected:h,select:a(p),unSelect:a(m),toggle:a(e=>{h(e)?m(e):p(e)}),selectAll:a(g),unSelectAll:a(y),clearAll:a(()=>{v.clear(),f([])}),toggleAll:a(()=>w?y():g())}},Pt=nt(()=>D?sessionStorage:void 0),$t=function(t){const n=()=>new Set(t),[r,o]=(0,e.useState)(n),i=e=>{o(t=>e(new Set(t)))};return[r,{add:a(e=>{r.has(e)||i(t=>(t.add(e),t))}),remove:a(e=>{r.has(e)&&i(t=>(t.delete(e),t))}),reset:a(()=>o(n()))}]},It=function(t){const[n,r]=(0,e.useState)(null!=t?t:{});return[n,a(e=>{r(t=>{const n=s(e)?e(t):e;return n?Object.assign(Object.assign({},t),n):t})})]};var zt=function(){if("undefined"!=typeof Map)return Map;function e(e,t){var n=-1;return e.some(function(e,r){return e[0]===t&&(n=r,!0)}),n}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(t){var n=e(this.__entries__,t),r=this.__entries__[n];return r&&r[1]},t.prototype.set=function(t,n){var r=e(this.__entries__,t);~r?this.__entries__[r][1]=n:this.__entries__.push([t,n])},t.prototype.delete=function(t){var n=this.__entries__,r=e(n,t);~r&&n.splice(r,1)},t.prototype.has=function(t){return!!~e(this.__entries__,t)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(e,t){void 0===t&&(t=null);for(var n=0,r=this.__entries__;n<r.length;n++){var o=r[n];e.call(t,o[1],o[0])}},t}()}(),Ht="undefined"!=typeof window&&"undefined"!=typeof document&&window.document===document,Yt=void 0!==r.g&&r.g.Math===Math?r.g:"undefined"!=typeof self&&self.Math===Math?self:"undefined"!=typeof window&&window.Math===Math?window:Function("return this")(),Vt="function"==typeof requestAnimationFrame?requestAnimationFrame.bind(Yt):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)},Wt=["top","right","bottom","left","width","height","size","weight"],qt="undefined"!=typeof MutationObserver,Bt=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=function(e){var t=!1,n=!1,r=0;function o(){t&&(t=!1,e()),n&&s()}function i(){Vt(o)}function s(){var e=Date.now();if(t){if(e-r<2)return;n=!0}else t=!0,n=!1,setTimeout(i,20);r=e}return s}(this.refresh.bind(this))}return e.prototype.addObserver=function(e){~this.observers_.indexOf(e)||this.observers_.push(e),this.connected_||this.connect_()},e.prototype.removeObserver=function(e){var t=this.observers_,n=t.indexOf(e);~n&&t.splice(n,1),!t.length&&this.connected_&&this.disconnect_()},e.prototype.refresh=function(){this.updateObservers_()&&this.refresh()},e.prototype.updateObservers_=function(){var e=this.observers_.filter(function(e){return e.gatherActive(),e.hasActive()});return e.forEach(function(e){return e.broadcastActive()}),e.length>0},e.prototype.connect_=function(){Ht&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),qt?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){Ht&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(e){var t=e.propertyName,n=void 0===t?"":t;Wt.some(function(e){return!!~n.indexOf(e)})&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),Xt=function(e,t){for(var n=0,r=Object.keys(t);n<r.length;n++){var o=r[n];Object.defineProperty(e,o,{value:t[o],enumerable:!1,writable:!1,configurable:!0})}return e},Ut=function(e){return e&&e.ownerDocument&&e.ownerDocument.defaultView||Yt},Gt=en(0,0,0,0);function Kt(e){return parseFloat(e)||0}function Jt(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return t.reduce(function(t,n){return t+Kt(e["border-"+n+"-width"])},0)}var Zt="undefined"!=typeof SVGGraphicsElement?function(e){return e instanceof Ut(e).SVGGraphicsElement}:function(e){return e instanceof Ut(e).SVGElement&&"function"==typeof e.getBBox};function Qt(e){return Ht?Zt(e)?function(e){var t=e.getBBox();return en(0,0,t.width,t.height)}(e):function(e){var t=e.clientWidth,n=e.clientHeight;if(!t&&!n)return Gt;var r=Ut(e).getComputedStyle(e),o=function(e){for(var t={},n=0,r=["top","right","bottom","left"];n<r.length;n++){var o=r[n],i=e["padding-"+o];t[o]=Kt(i)}return t}(r),i=o.left+o.right,s=o.top+o.bottom,u=Kt(r.width),c=Kt(r.height);if("border-box"===r.boxSizing&&(Math.round(u+i)!==t&&(u-=Jt(r,"left","right")+i),Math.round(c+s)!==n&&(c-=Jt(r,"top","bottom")+s)),!function(e){return e===Ut(e).document.documentElement}(e)){var a=Math.round(u+i)-t,l=Math.round(c+s)-n;1!==Math.abs(a)&&(u-=a),1!==Math.abs(l)&&(c-=l)}return en(o.left,o.top,u,c)}(e):Gt}function en(e,t,n,r){return{x:e,y:t,width:n,height:r}}var tn=function(){function e(e){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=en(0,0,0,0),this.target=e}return e.prototype.isActive=function(){var e=Qt(this.target);return this.contentRect_=e,e.width!==this.broadcastWidth||e.height!==this.broadcastHeight},e.prototype.broadcastRect=function(){var e=this.contentRect_;return this.broadcastWidth=e.width,this.broadcastHeight=e.height,e},e}(),nn=function(e,t){var n=function(e){var t=e.x,n=e.y,r=e.width,o=e.height,i="undefined"!=typeof DOMRectReadOnly?DOMRectReadOnly:Object,s=Object.create(i.prototype);return Xt(s,{x:t,y:n,width:r,height:o,top:n,right:t+r,bottom:o+n,left:t}),s}(t);Xt(this,{target:e,contentRect:n})},rn=function(){function e(e,t,n){if(this.activeObservations_=[],this.observations_=new zt,"function"!=typeof e)throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=e,this.controller_=t,this.callbackCtx_=n}return e.prototype.observe=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(e instanceof Ut(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)||(t.set(e,new tn(e)),this.controller_.addObserver(this),this.controller_.refresh())}},e.prototype.unobserve=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(e instanceof Ut(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)&&(t.delete(e),t.size||this.controller_.removeObserver(this))}},e.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},e.prototype.gatherActive=function(){var e=this;this.clearActive(),this.observations_.forEach(function(t){t.isActive()&&e.activeObservations_.push(t)})},e.prototype.broadcastActive=function(){if(this.hasActive()){var e=this.callbackCtx_,t=this.activeObservations_.map(function(e){return new nn(e.target,e.broadcastRect())});this.callback_.call(e,t,e),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e}(),on="undefined"!=typeof WeakMap?new WeakMap:new zt,sn=function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=Bt.getInstance(),r=new rn(t,n,this);on.set(this,r)};["observe","unobserve","disconnect"].forEach(function(e){sn.prototype[e]=function(){var t;return(t=on.get(this))[e].apply(t,arguments)}});const un=void 0!==Yt.ResizeObserver?Yt.ResizeObserver:sn,cn=Q(e.useLayoutEffect),an=D?cn:ee,ln=function(e){const[t,n]=ut(()=>{const t=Z(e);return t?{width:t.clientWidth,height:t.clientHeight}:void 0});return an(()=>{const t=Z(e);if(!t)return;const r=new un(e=>{e.forEach(e=>{const{clientWidth:t,clientHeight:r}=e.target;n({width:t,height:r})})});return r.observe(t),()=>{r.disconnect()}},[],e),t},dn={top:NaN,left:NaN,bottom:NaN,right:NaN,height:NaN,width:NaN},fn=Object.assign({text:""},dn),vn=function(t){const[n,r]=(0,e.useState)(fn),o=(0,e.useRef)(n),i=(0,e.useRef)(!1);return o.current=n,ee(()=>{const e=Z(t,document);if(!e)return;const s=()=>{let e=null,t="",o=dn;window.getSelection&&(e=window.getSelection(),t=e?e.toString():"",t&&i.current&&(o=function(e){if(!e)return dn;if(e.rangeCount<1)return dn;const t=e.getRangeAt(0),{height:n,width:r,top:o,left:i,right:s,bottom:u}=t.getBoundingClientRect();return{height:n,width:r,top:o,left:i,right:s,bottom:u}}(e),r(Object.assign(Object.assign(Object.assign({},n),{text:t}),o))))},u=t=>{if(2===t.button)return;if(!window.getSelection)return;o.current.text&&r(Object.assign({},fn)),i.current=!1;const n=window.getSelection();n&&(n.removeAllRanges(),i.current=e.contains(t.target))};return e.addEventListener("mouseup",s),document.addEventListener("mousedown",u),()=>{e.removeEventListener("mouseup",s),document.removeEventListener("mousedown",u)}},[],t),n},hn=function(t,n){var r;const o=p(t),i=null!==(r=null==n?void 0:n.wait)&&void 0!==r?r:1e3,s=(0,e.useMemo)(()=>H()((...e)=>o.current(...e),i,n),[]);return m(()=>{s.cancel()}),{run:s,cancel:s.cancel,flush:s.flush}},pn=function(t,n){const[r,o]=(0,e.useState)(t),{run:i}=hn(()=>{o(t)},n);return(0,e.useEffect)(()=>{i()},[t]),r},mn=function(t,n,r){const[o,i]=(0,e.useState)({}),{run:s}=hn(()=>{i({})},r);(0,e.useEffect)(()=>s(),n),l(t,[o])},gn=(t,n)=>{const r=a(t),o=(0,e.useRef)(null),i=(0,e.useCallback)(()=>{o.current&&clearTimeout(o.current)},[]);return(0,e.useEffect)(()=>{if(c(n)&&!(n<0))return o.current=setTimeout(r,n),i},[n]),i},yn={restoreOnUnmount:!1},bn=function(t,n=yn){const r=(0,e.useRef)(D?document.title:"");(0,e.useEffect)(()=>{document.title=t},[t]),m(()=>{n.restoreOnUnmount&&(document.title=r.current)})},wn=(t,n)=>{const r=(0,e.useRef)(void 0);(0,e.useEffect)(()=>{const e=(o=r.current,i=n,o?o.map((e,t)=>Object.is(o[t],null==i?void 0:i[t])?-1:t).filter(e=>e>=0):i?i.map((e,t)=>t):[]);var o,i;const s=r.current;return r.current=n,t(e,s,n)},n)},En=t(e.useLayoutEffect),Sn=(t,n)=>{const{containerTarget:r,wrapperTarget:o,itemHeight:i,overscan:s=5}=n,u=p(i),d=ln(r),f=(0,e.useRef)(!1),[v,h]=(0,e.useState)([]),[m,g]=(0,e.useState)({}),y=e=>c(u.current)?e*u.current:t.slice(0,e).reduce((e,n,r)=>e+u.current(r,t[r]),0),b=(0,e.useMemo)(()=>c(u.current)?t.length*u.current:t.reduce((e,n,r)=>e+u.current(r,t[r]),0),[t]),w=()=>{const e=Z(r);if(e){const{scrollTop:n,clientHeight:r}=e,o=(e=>{if(c(u.current))return Math.floor(e/u.current);let n=0,r=0;for(let o=0;o<t.length;o++)if(n+=u.current(o,t[o]),n>=e){r=o;break}return r+1})(n),i=((e,n)=>{if(c(u.current))return Math.ceil(e/u.current);let r=0,o=0;for(let i=n;i<t.length&&(r+=u.current(i,t[i]),o=i,!(r>=e));i++);return o-n})(r,o),a=Math.max(0,o-s),l=Math.min(t.length,o+i+s),d=y(a);g({height:b-d+"px",marginTop:d+"px"}),h(t.slice(a,l).map((e,t)=>({data:e,index:t+a})))}};return l(()=>{const e=Z(o);e&&Object.keys(m).forEach(t=>e.style[t]=m[t])},[m]),(0,e.useEffect)(()=>{(null==d?void 0:d.width)&&(null==d?void 0:d.height)&&w()},[null==d?void 0:d.width,null==d?void 0:d.height,t]),Ee("scroll",e=>{f.current?f.current=!1:(e.preventDefault(),w())},{target:r}),[v,a(e=>{const t=Z(r);t&&(f.current=!0,t.scrollTop=y(e),w())})]};var On;!function(e){e[e.Connecting=0]="Connecting",e[e.Open=1]="Open",e[e.Closing=2]="Closing",e[e.Closed=3]="Closed"}(On||(On={}));const jn=function(t,n={}){const{reconnectLimit:r=3,reconnectInterval:o=3e3,manual:i=!1,onOpen:s,onClose:u,onMessage:c,onError:l,protocols:d}=n,[f,v]=(0,e.useState)(),[h,g]=(0,e.useState)(On.Closed),y=p(s),b=p(u),w=p(c),E=p(l),S=p(h),O=(0,e.useRef)(0),j=(0,e.useRef)(void 0),M=(0,e.useRef)(void 0),_=()=>{var e;O.current<r&&(null===(e=M.current)||void 0===e?void 0:e.readyState)!==On.Open&&(j.current&&clearTimeout(j.current),j.current=setTimeout(()=>{L(),O.current++},o))},L=()=>{j.current&&clearTimeout(j.current),M.current&&M.current.close();const e=new WebSocket(t,d);g(On.Connecting),e.onerror=t=>{var n;M.current===e&&(_(),null===(n=E.current)||void 0===n||n.call(E,t,e),g(e.readyState||On.Closed))},e.onopen=t=>{var n;M.current===e&&(null===(n=y.current)||void 0===n||n.call(y,t,e),O.current=0,g(e.readyState||On.Open))},e.onmessage=t=>{var n;M.current===e&&(null===(n=w.current)||void 0===n||n.call(w,t,e),v(t))},e.onclose=t=>{var n;null===(n=b.current)||void 0===n||n.call(b,t,e),M.current===e&&_(),M.current&&M.current!==e||g(e.readyState||On.Closed)},M.current=e},k=()=>{O.current=0,L()},x=()=>{var e;j.current&&clearTimeout(j.current),O.current=r,null===(e=M.current)||void 0===e||e.close(),M.current=void 0};return(0,e.useEffect)(()=>{!i&&t&&k()},[t,i]),m(()=>{x()}),{latestMessage:f,sendMessage:a(e=>{var t;if(S.current!==On.Open)throw new Error("WebSocket disconnected");null===(t=M.current)||void 0===t||t.send(e)}),connect:a(k),disconnect:a(x),readyState:h,webSocketIns:M.current}},Mn=function(t,n){const r=(0,e.useRef)({});(0,e.useEffect)(()=>{if(r.current){const e=Object.keys(Object.assign(Object.assign({},r.current),n)),o={};e.forEach(e=>{Object.is(r.current[e],n[e])||(o[e]={from:r.current[e],to:n[e]})}),Object.keys(o).length&&console.log("[why-did-you-update]",t,o)}r.current=n})},_n=(e,t,n={})=>{const r=p(e);Ue(()=>{const e=Z(t);if(!e)return;const o=new MutationObserver(r.current);return o.observe(e,n),()=>{null==o||o.disconnect()}},[n],t)};var Ln;!function(e){e.LIGHT="light",e.DARK="dark",e.SYSTEM="system"}(Ln||(Ln={}));const kn=()=>{const t=D?window.matchMedia("(prefers-color-scheme: dark)"):void 0,[n,r]=(0,e.useState)(()=>D&&(null==t?void 0:t.matches)?Ln.DARK:Ln.LIGHT);return(0,e.useEffect)(()=>{const e=e=>{e.matches?r(Ln.DARK):r(Ln.LIGHT)};return(null==t?void 0:t.addEventListener)?t.addEventListener("change",e):(null==t?void 0:t.addListener)&&t.addListener(e),()=>{(null==t?void 0:t.removeEventListener)?t.removeEventListener("change",e):(null==t?void 0:t.removeListener)&&t.removeListener(e)}},[]),n};function xn(t={}){const{localStorageKey:n}=t,[r,o]=(0,e.useState)(()=>(null==n?void 0:n.length)&&localStorage.getItem(n)||Ln.SYSTEM),i=kn();return{theme:r===Ln.SYSTEM?i:r,themeMode:r,setThemeMode:a(e=>{o(e),(null==n?void 0:n.length)&&localStorage.setItem(n,e)})}}})(),o})());