@topthink/common 1.0.29 → 1.0.32

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.
package/lib/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{jsx as e,jsxs as n,Fragment as c}from"react/jsx-runtime";import t,{SubMenu as r,MenuItem as i}from"rc-menu";import o from"styled-components";import{useRoutes as a,useLocation as s,Link as l,BrowserRouter as d,Routes as u,Route as h,Navigate as m,useNavigate as g}from"react-router-dom";import*as p from"react";import f,{useMemo as v,useState as b,useEffect as x,useContext as y,Children as w,useCallback as _,createElement as k,forwardRef as z,useRef as C,useImperativeHandle as S,Fragment as N}from"react";import"rc-menu/assets/index.css";import j from"sweetalert2/dist/sweetalert2.js";import E from"sweetalert2-react-content";import{Spinner as A,Dropdown as D,Card as F,Alert as I,Button as O,Pagination as B,Table as L,Form as P,Modal as T,OverlayTrigger as U,Tooltip as M}from"react-bootstrap";import q from"query-string";import H from"axios";import*as K from"retry-axios";import R from"classnames";import{intersection as V,mapValues as G,debounce as W,values as Y,uniqueId as $}from"lodash";import J from"rc-steps";import"rc-steps/assets/index.css";import Q,{getRegistry as X}from"@topthink/json-form";import Z from"rc-table";import{useAsyncCallback as ee}from"react-async-hook";function ne(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}var ce;const te=o.footer(ce||(ce=ne(["\n\n"])));function re(){return e(te,{children:e("div",{className:"container"})})}const ie=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/";const c=[];for(const o of e){var t,r,i;if(null!==(t=o.meta)&&void 0!==t&&t.hideInMenu)continue;const e=null===(r=o.meta)||void 0===r?void 0:r.title;if(!e)continue;let a=o.path||"";a="".concat(n,"/").concat(a),a=a.replace(/\/+/,"/").replace(/\/$/,"");const s={title:e,path:a,children:[]};null!==(i=o.meta)&&void 0!==i&&i.hideChildrenInMenu||o.children&&o.children.length>0&&(s.children=ie(o.children,a)),c.push(s)}return c};var oe,ae,se,le,de,ue;const he=n=>n.map((n=>n.children.length>0?e(r,{title:n.title,children:he(n.children)},n.path):e(i,{children:e(l,{to:n.path,children:n.title})},n.path))),me=()=>({height:0}),ge=e=>({height:e.scrollHeight}),pe={motionName:"rc-menu-collapse",motionAppear:!0,onAppearStart:me,onAppearActive:ge,onEnterStart:me,onEnterActive:ge,onLeaveStart:ge,onLeaveActive:me};function fe(c){let{routes:t,basename:r,title:i}=c;const o=a(t),l=v((()=>function(e){return ie(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/")}(t,r)),[t,r]),{pathname:d}=s(),u=v((()=>{const e=[];return d.split("/").reduce(((n,c)=>(n.length>1&&e.push(n.join("/")),[...n,c])),[]),e.push(d),e}),[d]),[h,m]=b([]);x((()=>{m(u.slice(0,-1))}),[u]);return n(ve,{children:[n(be,{children:[e(xe,{children:i}),e(_e,{mode:"inline",motion:pe,openKeys:h,onOpenChange:e=>{const n=e[e.length-1];m(e.filter((e=>n.startsWith(e))))},selectedKeys:u,children:he(l)})]}),n(ye,{children:[e(we,{children:o}),e(re,{})]})]})}const ve=o.div(oe||(oe=ne(["\n display: flex;\n flex-wrap: nowrap;\n width: 100%;\n"]))),be=o.nav(ae||(ae=ne(["\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n z-index: 100;\n padding: 54px 0 0;\n border-right: 1px solid #e3e3e3;\n width: 230px;\n background-color: #f5f5f5;\n"]))),xe=o.div(se||(se=ne(["\n padding: 10px 0;\n height: 64px;\n line-height: 44px;\n text-indent: 24px;\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n font-size: 16px;\n"]))),ye=o.div(le||(le=ne(["\n margin-left: 230px;\n flex: 1;\n"]))),we=o.main(de||(de=ne(["\n min-height: calc(100vh - 54px);\n position: relative;\n"]))),_e=o(t)(ue||(ue=ne(["\n border: none;\n box-shadow: none;\n padding: 0;\n\n .rc-menu-item {\n display: flex;\n\n &:hover {\n background-color: #f0f0f0;\n }\n\n a {\n flex: 1;\n text-decoration: none;\n color: dimgray;\n }\n }\n\n .rc-menu-sub {\n background-color: #eee;\n border-top: 1px solid #eee;\n border-bottom: 1px solid #eee;\n\n & > li {\n &:first-child {\n margin-top: 4px;\n }\n\n &:last-child {\n margin-bottom: 4px;\n }\n }\n\n .rc-menu-item-selected {\n background-color: #eee;\n color: var(--bs-primary);\n\n & > a {\n color: var(--bs-primary);\n }\n }\n\n .rc-menu-item-active {\n background-color: #eee;\n }\n\n .rc-menu-item {\n &:hover {\n background-color: #e7e7e7;\n }\n }\n }\n\n .rc-menu-submenu {\n & > .rc-menu-submenu-title {\n &:hover {\n background-color: #e7e7e7;\n }\n }\n }\n\n .rc-menu-submenu-active > .rc-menu-submenu-title {\n background-color: #eee;\n }\n\n .rc-menu-item,\n .rc-menu-submenu > .rc-menu-submenu-title {\n padding: 0 8px 0 24px;\n font-size: 14px;\n line-height: 36px;\n cursor: pointer;\n }\n\n .rc-menu-sub > .rc-menu-item,\n .rc-menu-sub > .rc-menu-submenu > .rc-menu-submenu-title {\n padding-top: 0;\n padding-bottom: 0;\n padding-right: 0;\n }\n\n .rc-menu-submenu-arrow {\n line-height: 38px;\n }\n\n .rc-menu-item-selected {\n background-color: #f5f5f5;\n color: var(--bs-primary);\n\n & > a {\n color: var(--bs-primary);\n }\n }\n\n .rc-menu-submenu-selected {\n background-color: #eee;\n\n .rc-menu-submenu-title {\n color: var(--bs-primary);\n font-weight: 500;\n }\n }\n\n & > .rc-menu-item {\n line-height: 38px;\n }\n\n & > .rc-menu-submenu {\n &.rc-menu-submenu-selected {\n background-color: #f5f5f5;\n }\n\n & > .rc-menu-submenu-title {\n line-height: 38px;\n\n &:hover {\n background-color: #f0f0f0;\n }\n }\n\n &.rc-menu-submenu-active > .rc-menu-submenu-title {\n background-color: #f5f5f5;\n }\n\n & > .rc-menu-sub {\n border-top: 1px solid #e6e6e6;\n border-bottom: 1px solid #e6e6e6;\n\n & > li {\n &:first-child {\n margin-top: 9px;\n }\n\n &:last-child {\n margin-bottom: 9px;\n }\n }\n }\n }\n\n"]))),ke=E(j),ze={confirmButtonText:"确定",cancelButtonText:"取消"},Ce={confirm:async e=>{const{isConfirmed:n}=await ke.fire({...ze,icon:"warning",showCancelButton:!0,...e});return n},error:e=>{ke.fire({...ze,toast:!0,position:"top",icon:"error",timer:3e3,showConfirmButton:!1,...e})}};var Se,Ne,je,Ee;const Ae=o.div(Se||(Se=ne(["\n padding: 48px 32px;\n"]))),De=o.div(Ne||(Ne=ne(["\n margin-bottom: 24px;\n text-align: center;\n font-size: 72px;\n"]))),Fe=o.div(je||(je=ne(["\n color: rgba(0, 0, 0, .85);\n font-size: 24px;\n line-height: 1.8;\n text-align: center;\n"]))),Ie=o.div(Ee||(Ee=ne(["\n margin-top: 32px;\n text-align: center;\n"]))),Oe={success:e("i",{className:"bi bi-check-circle-fill text-success"}),error:e("i",{className:"bi bi-exclamation-circle-fill text-danger"}),info:e("i",{className:"bi bi-info-circle-fill text-info"}),warning:e("i",{className:"bi bi-exclamation-triangle-fill text-warning"})};function Be(c){let{status:t,title:r,icon:i,extra:o}=c;return!i&&t&&(i=Oe[t]),n(Ae,{children:[i&&e(De,{children:i}),r&&e(Fe,{children:r}),o&&e(Ie,{children:o})]})}var Le,Pe;o.div(Le||(Le=ne(["\n position: relative;\n"])));const Te=o.div(Pe||(Pe=ne(["\n display: ",";\n position: absolute;\n top: 0 !important;\n left: 0 !important;\n width: 100%;\n height: 100%;\n text-align: center;\n vertical-align: middle;\n padding: 1em;\n background-color: ",";\n opacity: ",";\n line-height: 1;\n animation-fill-mode: both;\n animation-duration: .5s;\n transition: background-color .5s linear;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n user-select: none;\n will-change: opacity;\n z-index: 990;\n"])),(e=>e.active?"flex":"none"),(e=>e.inverted?"rgba(255, 255, 255, .85)":"rgba(0, 0, 0, .85)"),(e=>e.active?1:0));var Ue;function Me(c){let{loading:t=!0,children:r,variant:i="success",animation:o="border",wrap:a,...s}=c;return t?(r&&(r=e("p",{className:"mt-3 text-secondary",children:r})),r=n(Te,{inverted:!0,active:!0,children:[e(A,{animation:o,variant:i,...s}),r]}),a?e(qe,{height:"number"==typeof a?a:150,children:r}):r):null}const qe=o.div(Ue||(Ue=ne(["\n position: relative;\n height: ",";\n"])),(e=>"".concat(e.height,"px"))),He=f.createContext([null,()=>{}]),Ke=function(n){let{children:c,user:t}=n;const[r,i]=b(t);return x((()=>{i(t)}),[t]),r?e(He.Provider,{value:[r,i],children:c}):e(Me,{})};function Re(){const[e,n]=y(He);if(!e)throw new Error("please use `useUser` in UserContext");return[e,n]}var Ve,Ge;const We=o.a(Ve||(Ve=ne(["\n cursor: pointer;\n"])));function Ye(c){let{children:t,menus:r}=c;const[i]=Re();return e($e,{className:"navbar navbar-expand-lg navbar-light bg-white border-bottom sticky-top",children:n("div",{className:"container-fluid",children:[e("a",{className:"navbar-brand",href:"https://www.topthink.com",children:e("img",{src:"data:image/svg+xml,%3csvg width='485' height='132' xmlns='http://www.w3.org/2000/svg' xml:space='preserve' style='enable-background:new 0 0 531.69 198.43%3b' version='1.1'%3e %3cstyle type='text/css'%3e.st0%7bfill:%233C60FF%3b%7d%3c/style%3e %3cg%3e %3ctitle%3ebackground%3c/title%3e %3crect fill='none' id='canvas_background' height='134' width='487' y='-1' x='-1'/%3e %3c/g%3e %3cg%3e %3ctitle%3eLayer 1%3c/title%3e %3cpath id='svg_1' d='m132.29%2c62.34c-1.19%2c-18.77 -10.34%2c-35.36 -24.11%2c-46.46c-11.15%2c-8.99 -25.34%2c-14.38 -40.79%2c-14.38c-0.55%2c0 -1.09%2c0.01 -1.63%2c0.02c-3.32%2c0.08 -6.57%2c0.41 -9.75%2c0.98c-30.49%2c5.38 -53.65%2c32 -53.65%2c64.04c0%2c1.87 0.08%2c3.73 0.24%2c5.57c2.5%2c29.51 24.7%2c53.4 53.41%2c58.47c2.38%2c0.42 4.8%2c0.72 7.26%2c0.86c0.83%2c0.05 1.66%2c0.09 2.5%2c0.11c0.54%2c0.01 1.08%2c0.02 1.63%2c0.02c34.04%2c0 61.97%2c-26.16 64.79%2c-59.46c0.16%2c-1.83 0.24%2c-3.69 0.24%2c-5.57c0%2c-1.42 -0.05%2c-2.82 -0.14%2c-4.2zm-76.27%2c32.5c-0.26%2c0.01 -0.53%2c0.01 -0.79%2c0.01c-14.56%2c0 -26.88%2c-9.57 -31.03%2c-22.76c-0.97%2c-3.08 -1.49%2c-6.35 -1.49%2c-9.75c0%2c-17.95 14.56%2c-32.52 32.51%2c-32.52c0.26%2c0 0.53%2c0 0.79%2c0.01c3.41%2c0.08 6.69%2c0.68 9.75%2c1.74c6.5%2c2.22 12.06%2c6.45 15.97%2c11.94c1.98%2c2.78 3.54%2c5.9 4.57%2c9.25c0.94%2c3.03 1.44%2c6.24 1.44%2c9.58l-9.75%2c0c0%2c-2.18 -0.31%2c-4.29 -0.88%2c-6.28c-0.92%2c-3.23 -2.55%2c-6.17 -4.69%2c-8.64c-1.86%2c-2.14 -4.12%2c-3.93 -6.65%2c-5.25c-2.93%2c-1.54 -6.24%2c-2.46 -9.75%2c-2.58c-0.26%2c-0.01 -0.52%2c-0.01 -0.79%2c-0.01c-12.57%2c0 -22.76%2c10.19 -22.76%2c22.76c0%2c3.49 0.79%2c6.8 2.19%2c9.75c3.65%2c7.69 11.49%2c13.01 20.57%2c13.01c0.27%2c0 0.53%2c-0.01 0.79%2c-0.01l0%2c9.75zm55.7%2c-17.92c-3.35%2c10.5 -13.18%2c18.09 -24.78%2c18.09c-3.13%2c0 -6.13%2c-0.55 -8.91%2c-1.57c-2.18%2c-0.8 -4.24%2c-1.88 -6.11%2c-3.21c-2.38%2c-1.68 -4.47%2c-3.76 -6.16%2c-6.13c-0.28%2c-0.39 -0.55%2c-0.79 -0.81%2c-1.2c-2.03%2c-3.2 -3.38%2c-6.87 -3.85%2c-10.82l9.87%2c0c0.33%2c1.71 0.92%2c3.32 1.74%2c4.8c1.61%2c2.91 4.09%2c5.26 7.09%2c6.72c0.57%2c0.28 1.15%2c0.53 1.76%2c0.73c1.68%2c0.6 3.49%2c0.92 5.37%2c0.92c7.92%2c0 14.52%2c-5.67 15.96%2c-13.17c0.2%2c-1 0.3%2c-2.04 0.3%2c-3.09c0%2c-2.37 -0.51%2c-4.63 -1.43%2c-6.67c-1.66%2c-3.71 -4.68%2c-6.68 -8.43%2c-8.28l3.54%2c-9.1c7.43%2c3.08 13.13%2c9.49 15.21%2c17.38c0.44%2c1.64 0.72%2c3.34 0.81%2c5.09c0.04%2c0.52 0.05%2c1.05 0.05%2c1.58c0%2c1.05 -0.07%2c2.07 -0.18%2c3.09c-0.18%2c1.68 -0.54%2c3.3 -1.04%2c4.84z' class='st0'/%3e %3cg id='svg_2'%3e %3cg id='svg_3'%3e %3crect id='svg_4' height='6.34' width='94.12' class='st0' y='20.46' x='163.29'/%3e %3c/g%3e %3cg id='svg_5'%3e %3cpath id='svg_6' d='m169.31%2c113.72l0%2c-6.34c6.49%2c0 11.77%2c-5.28 11.77%2c-11.77l0%2c-71.98l6.34%2c0l0%2c71.98c0%2c9.98 -8.12%2c18.11 -18.11%2c18.11z' class='st0'/%3e %3c/g%3e %3cg id='svg_7'%3e %3cpath id='svg_8' d='m255.49%2c91.27l-6.34%2c0l0%2c-38.2c0%2c-5.06 -4.12%2c-9.18 -9.18%2c-9.18l-19.37%2c0c-5.06%2c0 -9.18%2c4.12 -9.18%2c9.18l0%2c38.2l-6.34%2c0l0%2c-38.2c0%2c-8.55 6.96%2c-15.51 15.51%2c-15.51l19.38%2c0c8.55%2c0 15.51%2c6.96 15.51%2c15.51l0%2c38.2l0.01%2c0z' class='st0'/%3e %3c/g%3e %3cg id='svg_9'%3e %3crect id='svg_10' height='17.09' width='6.34' class='st0' y='23.63' x='227.12'/%3e %3c/g%3e %3cg id='svg_11'%3e %3cpath id='svg_12' d='m206.43%2c113.84l-3.34%2c0l0%2c-6.34l3.34%2c0c6.3%2c0 12.9%2c-3.56 15.35%2c-8.29c3.49%2c-6.71 5.33%2c-14.25 5.33%2c-21.81l0%2c-26.13l6.34%2c0l0%2c26.13c0%2c8.58 -2.09%2c17.13 -6.05%2c24.74c-3.98%2c7.68 -13.57%2c11.7 -20.97%2c11.7z' class='st0'/%3e %3c/g%3e %3cg id='svg_13'%3e %3cpath id='svg_14' d='m257.48%2c113.84l-3.34%2c0c-7.4%2c0 -16.98%2c-4.02 -20.98%2c-11.7c-3.96%2c-7.61 -6.05%2c-16.16 -6.05%2c-24.74l6.34%2c0c0%2c7.56 1.84%2c15.1 5.33%2c21.81c2.46%2c4.73 9.06%2c8.29 15.35%2c8.29l3.34%2c0l0%2c6.34l0.01%2c0z' class='st0'/%3e %3c/g%3e %3cg id='svg_15'%3e %3crect id='svg_16' height='6.34' width='42.87' class='st0' y='27.89' x='274.07'/%3e %3c/g%3e %3cg id='svg_17'%3e %3crect id='svg_18' height='61.38' width='6.34' class='st0' y='14.89' x='293.05'/%3e %3c/g%3e %3cg id='svg_19'%3e %3crect id='svg_20' height='6.34' width='33.26' class='st0' transform='matrix(0.11%2c-0.9939%2c0.9939%2c0.11%2c194.7608%2c392.0006) ' y='46.985071' x='325.728637'/%3e %3c/g%3e %3cg id='svg_21'%3e %3crect id='svg_22' height='33.26' width='6.34' class='st0' transform='matrix(0.9939%2c-0.11%2c0.11%2c0.9939%2c-7.5075%2c38.3801) ' y='37.060893' x='310.495485'/%3e %3c/g%3e %3cg id='svg_23'%3e %3cpath id='svg_24' d='m352.9%2c77.14l-15.15%2c0c-7.52%2c0 -13.64%2c-6.12 -13.64%2c-13.63l0%2c-29.61c0%2c-7.52 6.12%2c-13.64 13.64%2c-13.64l15.15%2c0c7.52%2c0 13.64%2c6.12 13.64%2c13.64l0%2c29.61c0%2c7.52 -6.12%2c13.63 -13.64%2c13.63zm-15.15%2c-50.54c-4.02%2c0 -7.3%2c3.27 -7.3%2c7.3l0%2c29.61c0%2c4.02 3.27%2c7.3 7.3%2c7.3l15.15%2c0c4.02%2c0 7.3%2c-3.27 7.3%2c-7.3l0%2c-29.61c0%2c-4.02 -3.27%2c-7.3 -7.3%2c-7.3l-15.15%2c0z' class='st0'/%3e %3c/g%3e %3cg id='svg_25'%3e %3cg id='svg_26'%3e %3crect id='svg_27' height='6.34' width='17.8' class='st0' y='37.2' x='336.43'/%3e %3c/g%3e %3cg id='svg_28'%3e %3crect id='svg_29' height='6.34' width='17.8' class='st0' y='53.87' x='336.43'/%3e %3c/g%3e %3c/g%3e %3cg id='svg_30'%3e %3cpath id='svg_31' d='m352.7%2c113.84l-37.98%2c0c-8%2c0 -14.5%2c-6.51 -14.5%2c-14.5l0%2c-16.14l6.34%2c0l0%2c16.13c0%2c4.5 3.66%2c8.17 8.17%2c8.17l37.98%2c0l0%2c6.34l-0.01%2c0z' class='st0'/%3e %3c/g%3e %3cg id='svg_32'%3e %3crect id='svg_33' height='6.34' width='23.57' class='st0' transform='matrix(0.2529%2c-0.9675%2c0.9675%2c0.2529%2c114.4986%2c402.9877) ' y='83.698593' x='326.836101'/%3e %3c/g%3e %3cg id='svg_34'%3e %3crect id='svg_35' height='6.34' width='20.52' class='st0' y='86.2' x='321.58'/%3e %3c/g%3e %3cg id='svg_36'%3e %3crect id='svg_37' height='24.75' width='6.34' class='st0' transform='matrix(0.9556%2c-0.2946%2c0.2946%2c0.9556%2c-19.7967%2c122.424) ' y='75.874073' x='369.686666'/%3e %3c/g%3e %3cg id='svg_38'%3e %3crect id='svg_39' height='6.34' width='71.83' class='st0' y='20.46' x='395.51'/%3e %3c/g%3e %3cg id='svg_40'%3e %3crect id='svg_41' height='6.34' width='90.81' class='st0' y='57.44' x='386.02'/%3e %3c/g%3e %3cg id='svg_42'%3e %3cpath id='svg_43' d='m463.12%2c113.64l-56%2c0c-4.5%2c0 -8.59%2c-2.29 -10.94%2c-6.14c-2.35%2c-3.84 -2.52%2c-8.53 -0.46%2c-12.53l17.68%2c-35.81l5.64%2c2.89l-17.68%2c35.81c-1.04%2c2.02 -0.95%2c4.39 0.23%2c6.33c1.19%2c1.94 3.25%2c3.1 5.53%2c3.1l56%2c0c1.51%2c0 2.88%2c-0.71 3.74%2c-1.95c0.81%2c-1.16 1.03%2c-2.57 0.63%2c-3.91l-7.8%2c-12.34l5.36%2c-3.39l8.18%2c12.94l0.12%2c0.31c1.24%2c3.34 0.76%2c7.08 -1.28%2c10.01c-2.04%2c2.94 -5.39%2c4.68 -8.95%2c4.68z' class='st0'/%3e %3c/g%3e %3c/g%3e %3c/g%3e%3c/svg%3e",height:"30"})}),t,n(D,{navbar:!0,children:[e(D.Toggle,{as:We,className:"nav-link",children:e("img",{className:"rounded-circle",width:"25",height:"25",src:i.avatar})}),e(D.Menu,{className:"shadow",children:r})]})]})})}const $e=o.header(Ge||(Ge=ne(["\n height: 54px;\n"])));K.attach(),H.defaults.raxConfig={retryDelay:2e3,backoffType:"static",shouldRetry:e=>{var n,c;return"GET"===(null===(n=e.config.method)||void 0===n?void 0:n.toUpperCase())&&449===(null===(c=e.response)||void 0===c?void 0:c.status)}},H.defaults.maxContentLength=1/0,H.defaults.maxBodyLength=1/0,H.defaults.baseURL="/api",H.interceptors.request.use((e=>{const n=sessionStorage.getItem("authorization");return n&&(e.headers={...e.headers,Authorization:"Bearer ".concat(n)}),e}),(e=>Promise.reject(e)));const Je=e=>e&&"object"==typeof e;H.interceptors.response.use((e=>(201===e.status&&e.data.location&&(window.location.href=e.data.location,e.data=void 0),e)),(e=>{if(H.isAxiosError(e)&&e.response){const{data:n,status:c}=e.response;if(401===c){if(Je(n)&&n.url){"/logout"!==window.location.pathname&&sessionStorage.setItem("redirect_uri",window.location.pathname+window.location.search);const e=window.location.origin+"/login";window.location.href=q.stringifyUrl({url:n.url,query:{redirect_uri:e}})}e.errors="Unauthorized"}else Je(n)?422===c?e.errors=n:"message"in n&&(e.errors=n.message):e.errors=n}return Promise.reject(e)}));const Qe=H.isAxiosError,Xe=async function(e){e="string"==typeof e?{url:e}:e;const{data:n}=await H.request({paramsSerializer:function(e){return q.stringify(e,{sort:!1,skipNull:!0,skipEmptyString:!0})},...e});return n};function Ze(){const n=s(),c=q.parse(n.hash.substr(1));sessionStorage.setItem("authorization",c.access_token);const t=sessionStorage.getItem("redirect_uri");return t&&sessionStorage.removeItem("redirect_uri"),e(m,{to:t||"/",replace:!0})}function en(){return x((()=>{Xe("/logout").catch((()=>{sessionStorage.removeItem("authorization")}))}),[]),e(Me,{})}function nn(c){let{children:t}=c;return e(d,{children:n(u,{children:[e(h,{path:"*",element:t}),e(h,{path:"login",element:e(Ze,{})}),e(h,{path:"logout",element:e(en,{})})]})})}function cn(t){let{children:r,title:i,className:o,...a}=t;return e(F,{className:R("border-0 shadow-sm mb-3",o),...a,children:n("div",{className:"card-body",children:[i&&n(c,{children:[e("h5",{children:i}),e("hr",{})]}),r]})})}function tn(n){let{errors:c}=n;return c?e(I,{variant:"danger",children:e("ul",{className:"mb-0",children:"string"==typeof c?e("li",{children:c}):Object.entries(c).map((n=>{let[c,t]=n;return e("li",{children:t},c)}))})}):null}function rn(n){let{require:t,children:r,fallback:i}=n;const[o]=Re();let a=!1;return"function"==typeof t?a=t(o):("string"==typeof t&&(t=[t]),a=V(o.roles,t).length>0),a||(r=i),e(c,{children:r})}var on,an;function sn(n){let{children:c,size:t="small"}=n;"string"==typeof t&&(t={small:8,middle:16,large:24}[t]);const r=w.map(c,(n=>{if(n)return e(dn,{children:n})}));return e(ln,{size:t,children:r})}const ln=o.div(on||(on=ne(["\n display: inline-flex;\n align-items: center;\n gap: ","px;\n"])),(e=>e.size)),dn=o.div(an||(an=ne(["\n\n"])));var un;function hn(){return hn=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var c=arguments[n];for(var t in c)Object.prototype.hasOwnProperty.call(c,t)&&(e[t]=c[t])}return e},hn.apply(this,arguments)}const mn=e=>p.createElement("svg",hn({className:"step_check_svg__icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentColor"},e),un||(un=p.createElement("path",{d:"M887.904 298.208c-12.864-12.064-33.152-11.488-45.216 1.408L415.936 753.984l-233.12-229.696c-12.608-12.416-32.864-12.288-45.28.32-12.416 12.576-12.256 32.864.352 45.248l256.48 252.672c.096.096.224.128.32.224s.128.224.224.32c2.016 1.92 4.448 3.008 6.784 4.288 1.152.672 2.144 1.664 3.36 2.144 3.776 1.472 7.776 2.24 11.744 2.24 4.192 0 8.384-.832 12.288-2.496 1.312-.544 2.336-1.664 3.552-2.368 2.4-1.408 4.896-2.592 6.944-4.672.096-.096.128-.256.224-.352.064-.096.192-.128.288-.224L889.28 343.424c12.16-12.832 11.488-33.088-1.376-45.216z"})));var gn;function pn(n){return e(fn,{icons:{finish:e(mn,{}),error:e(c,{})},...n})}pn.Step=J.Step;const fn=o(J)(gn||(gn=ne(["\n .rc-steps-item-icon {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n\n & > .rc-steps-icon {\n top: 0;\n }\n }\n\n .rc-steps-item-process {\n .rc-steps-item-icon {\n background: var(--bs-primary);\n border-color: var(--bs-primary);\n }\n }\n\n .rc-steps-item-finish {\n .rc-steps-item-icon {\n border-color: var(--bs-primary);\n\n & > .rc-steps-icon {\n color: var(--bs-primary);\n }\n }\n\n .rc-steps-item-title:after {\n background-color: var(--bs-primary);\n }\n }\n\n"])));function vn(n){let{value:t,locale:r="zh-CN",currency:i=!0}=n;const o=v((()=>{let e={};return e=i?{style:"currency",currency:"CNY",...e}:{minimumFractionDigits:2},new Intl.NumberFormat(r,e)}),[i,r]);return e(c,{children:o.format(t)})}function bn(n){let{loading:c,children:t,...r}=n;return e(O,{...r,disabled:c,children:c?"Loading…":t})}function xn(e){let{url:n,method:c,confirm:t,onSuccess:r,children:i,disabled:o,as:a=O,...s}=e;const[l,d]=b(!1),u=_((async e=>{e.preventDefault();try{if(d(!0),t&&!await Ce.confirm({text:t}))return;const e="string"==typeof n?{url:n,method:c}:{method:c,...n},i=await Xe(e);r&&r(i)}catch(e){if(!H.isAxiosError(e))throw e;{let n=e.errors;"string"!=typeof e.errors&&(n=Object.values(e.errors).join("<br />")),Ce.error({text:n})}}finally{d(!1)}}),[n,c,d]);return k(a,{...s,disabled:o||l,onClick:u},i)}function yn(n){let{to:c,replace:t,...r}=n,i=g();return e(O,{...r,onClick:e=>{e.preventDefault(),i(c,{replace:t})}})}const wn=require("ajv-i18n/localize/zh"),_n={upload:function(n){const{widgets:c}=X(),t={...n.options,async onUpload(e){if(n.options.onUpload instanceof Function)return await n.options.onUpload.call(e);if(n.options.endpoint){const c=new FormData;c.set("file",e);const{url:t}=await Xe({url:n.options.endpoint,method:"post",data:c});return t}}};return e(c.upload,{...n,options:t})}},kn=z(((n,c)=>{let{action:t,method:r="post",onSuccess:i,formData:o,onSubmit:a,onChange:s,submitText:l="提交",children:d,...u}=n;const[h,m]=b(),[g,p]=b(!1),[f,v]=b(o),x=_((async(e,n)=>{try{if(p(!0),t){const{formData:n}=e;try{const e=await Xe({url:t,method:r,data:n});m(void 0),i&&await i(e)}catch(e){throw H.isAxiosError(e)&&m((e=>{const n=e.errors;return"string"==typeof n?{__errors:[n]}:G(n,(e=>({__errors:[e]})))})(e)),e}}else a&&await a(e,n)}finally{p(!1)}}),[t,r,a]),y=_((e=>{const{formData:n}=e;v(n),s&&s(e)}),[v,s]),w=_((e=>(e=e.map((e=>({keyword:e.name,dataPath:e.property,...e}))),wn(e),e)),[]),k=e(bn,{loading:g,type:"submit",variant:"primary",children:l});return"function"==typeof d&&(d=d({submit:k,loading:g})),e(Q,{ref:c,extraErrors:h,onSubmit:x,transformErrors:w,noHtml5Validate:!0,noValidate:!0,...u,formData:f,onChange:y,widgets:_n,children:d||e("div",{className:"col-12",children:k})})}));var zn,Cn,Sn,Nn,jn;function En(c){let{title:t,children:r,extra:i}=c;return n(An,{children:[e(Dn,{children:n("div",{className:"container",children:[e(In,{children:t}),e(On,{children:i})]})}),e(Fn,{className:"container",children:r})]})}const An=o.div(zn||(zn=ne(["\n width: 100%;\n"]))),Dn=o.div(Cn||(Cn=ne(["\n background-color: #fff;\n display: flex;\n\n .container {\n padding: 0 24px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n }\n"]))),Fn=o.div(Sn||(Sn=ne(["\n margin-top: 24px;\n"]))),In=o.div(Nn||(Nn=ne(["\n font-size: 22px;\n line-height: 64px;\n height: 64px;\n"]))),On=o.div(jn||(jn=ne(["\n\n"])));function Bn(){}function Ln(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}const Pn=function(n){let{indeterminate:c=!1,...t}=n;const r=C(null);return x((()=>{r.current&&(r.current.indeterminate=c)}),[c]),e("input",{ref:r,...t,className:"form-check-input",type:"checkbox"})};var Tn,Un,Mn,qn,Hn,Kn;const Rn=o(L)(Tn||(Tn=ne(["\n .rc-table-thead {\n border-top: none;\n }\n"]))),Vn={table:n=>e(Rn,{...n,className:"align-middle table-hover"})},Gn=o((function(n){let{total:c=0,onChange:t=Bn,defaultCurrent:r=1,defaultPageSize:i=10,className:o,...a}=n;const[s,l]=b(r),[d,u]=b(i);x((()=>{Ln(a.current)&&l(a.current)}),[a.current]),x((()=>{Ln(a.pageSize)&&u(a.pageSize)}),[a.pageSize]);const h=v((()=>Math.floor((c-1)/d)+1),[c,d]),m=_((e=>()=>{e!==s&&(l(e),t(e,d))}),[t,s,d]),g=s-1>0?s-1:0,p=s+1<h?s+1:h,f=[];let y=null,w=null,k=null,z=null;if(h<=7)for(let n=1;n<=h;n+=1){const c=s===n;f.push(e(B.Item,{active:c,onClick:m(n),children:n},n))}else{z=e(B.Last,{onClick:m(h)},"last"),k=e(B.First,{onClick:m(1)},"first"),y=e(B.Prev,{onClick:m(g)},"prev"),w=e(B.Next,{onClick:m(p)},"next");let n=Math.max(1,s-2),c=Math.min(s+2,h);s-1<=2&&(c=5),h-s<=2&&(n=h-4);for(let t=n;t<=c;t+=1){const n=s===t;f.push(e(B.Item,{active:n,onClick:m(t),children:t},t))}s-1>=4&&3!==s&&f.unshift(y),h-s>=4&&s!==h-2&&f.push(w),1!==n&&f.unshift(k),c!==h&&f.push(z)}return e(B,{className:o,children:f})}))(Un||(Un=ne(["\n margin-bottom: 0;\n justify-content: flex-end;\n"])));function Wn(e){return"current_page"in e}const Yn=z(((t,r)=>{let{source:i,rowKey:o="id",paginate:a=!0,toolBarRender:s,columns:l=[],search:d,rowSelection:u,card:h=!0,...m}=t;const[g,p]=b([]),[f,y]=b(a?{total:0,current:1,pageSize:10}:null),[w,k]=b(!0),[z,N]=b(""),j=_((async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};k(!0);try{let n;if("string"==typeof i){const c={q:z};f&&(c.page=e.page||f.current),n=await Xe({url:i,params:c})}else n=await i();a&&Wn(n)&&(y({total:n.total,current:n.current_page,pageSize:n.per_page}),n=n.data),p(n)}catch(e){}finally{k(!1)}}),[i,p,f,z]);x((()=>{j()}),[z]);const E=C({reload:j});x((()=>{E.current={reload:j}}),[j]),S(r,(()=>E.current));const[A]=function(n,c,t){const[r,i]=b((()=>new Set((null==n?void 0:n.selectedRowKeys)||[]))),o=e=>"string"==typeof c?e[c]:c(e),a=e=>t.find((n=>o(n)===e)),s=_((e=>{i(e);const c=Array.from(e),t=c.map((function(e){return a(e)}));null!=n&&n.onChange&&(null==n||n.onChange(c,t))}),[a]);return[_((c=>{if(!n)return c;const i=t.map(o),a=i.every((function(e){return r.has(e)})),l=i.some((function(e){return r.has(e)}));return[{key:"selection",title:e(Pn,{checked:a,indeterminate:!a&&l,onChange:()=>{a?i.forEach((function(e){r.delete(e)})):i.forEach((function(e){r.add(e)})),s(new Set(r))}}),width:30,align:"center",render(n){let{record:c}=n;const t=o(c),i=r.has(t);return e(Pn,{checked:i,onChange:()=>{i?r.delete(t):r.add(t),s(new Set(r))}})}},...c]}),[t,n,r])]}(u,o,g),D=v((()=>A(l).map((e=>{const n={...e,render:void 0};if("render"in e&&e.render){const c=e.render;n.render=(e,n,t)=>c({value:e,record:n,index:t,action:E.current})}return n}))),[l,A,E]),F=function(e,n,c){const t=C(e),r=C(W(e,n,c));return x((()=>{t.current=e})),x((()=>{r.current=W((function(){t.current(...arguments)}),n,c)}),[n,c]),r.current}((e=>{N(e.target.value)}),500),I=n(c,{children:[e(Me,{loading:w}),!1!==s&&n($n,{children:[e(Qn,{size:12,children:s&&s(E.current)}),n(Jn,{size:12,children:[d&&e(P.Control,{onChange:F,type:"search",placeholder:"Search..."}),e(Xn,{onClick:E.current.reload,children:e("i",{className:"bi bi-arrow-repeat"})})]})]}),e(Z,{...m,rowKey:o,columns:D,components:Vn,data:g}),f&&e(Gn,{...f,onChange:e=>{j({page:e})}})]});return h?e(cn,{children:I}):I})),$n=o.div(Mn||(Mn=ne(["\n display: flex;\n justify-content: space-between;\n padding-bottom: 1rem;\n height: 48px;\n"]))),Jn=o(sn)(qn||(qn=ne(["\n\n"]))),Qn=o(sn)(Hn||(Hn=ne(["\n\n"]))),Xn=o.span(Kn||(Kn=ne(["\n cursor: pointer;\n font-size: 20px;\n line-height: 1;\n\n &:hover {\n color: var(--bs-primary);\n }\n"]))),Zn=z(((t,r)=>{let{text:i,variant:o="primary",header:a=i,footer:s=!0,onOk:l,size:d,onShow:u,children:h}=t;const[m,g]=b(!1),[p,f]=b(!1),v=()=>g(!1);S(r,(()=>({close:v})));return n(c,{children:[e(O,{variant:o,onClick:()=>g(!0),children:i}),n(T,{size:d,show:m,onHide:v,onShow:u,children:[a&&e(T.Header,{closeButton:!0,children:e(T.Title,{as:"h5",children:a})}),e(T.Body,{children:h}),s&&n(T.Footer,{children:[e(O,{variant:"secondary",onClick:v,children:"取消"}),e(bn,{loading:p,variant:"primary",onClick:async()=>{if(l){f(!0);const e=await l();if(f(!1),!1===e)return}v()},children:"确定"})]})]})]})}));function ec(n){let{text:c,header:t,schema:r,uiSchema:i,action:o,method:a,formData:s,variant:l,onSuccess:d,onChange:u,fields:h,size:m}=n;const g=C(null),p=C(null),f=_((async()=>{try{var e;return await(null===(e=g.current)||void 0===e?void 0:e.submit()),!0}catch{return!1}}),[]);return e(Zn,{ref:p,text:c,onOk:f,header:t,variant:l,size:m,children:e(kn,{ref:g,schema:r,uiSchema:i,action:o,method:a,formData:s,fields:h,onChange:u,onSuccess:d,children:e(N,{})})})}function nc(e){let{manual:n,refreshDeps:c,...t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{execute:r,currentParams:i,error:o,...a}=ee((async n=>(e="string"==typeof e?{url:e}:e,await Xe({...e,...n}))),t);x((()=>{n||c||r()}),[]),x((()=>{c&&s()}),c);const s=_((()=>{i?r(...i):r()}),[r,i]);if(o&&Qe(o)){const e=o.errors;o=new Error("string"==typeof e?e:Y(e).join(""))}return{refresh:s,execute:r,error:o,...a}}let cc=0;function tc(){let{onHide:e,onShow:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[c,t]=b(!1),[r,i]=b("visible-".concat(cc)),o=_((()=>{t(!1),e&&e()}),[t,e]),a=_((()=>{i("visible-".concat(++cc))}),[i,cc]),s=_((()=>{t(!0),n&&n()}),[t,n]),l={show:c,onHide:o,onExited:a,key:r};return{visible:c,show:s,hide:o,state:l}}function rc(n){let{tooltip:c,children:t,placement:r="bottom"}=n;return e(U,{placement:r,overlay:e(M,{id:$(),children:c}),children:t})}export{rn as Access,cn as Card,En as Content,tn as Error,re as Footer,kn as Form,Ye as Header,yn as LinkButton,Me as Loader,bn as LoadingButton,Ce as Message,Zn as ModalButton,ec as ModalForm,vn as NumberFormat,xn as RequestButton,Be as Result,nn as Root,fe as SiderLayout,sn as Space,pn as Steps,Yn as Table,rc as Tooltip,Ke as UserProvider,Qe as isRequestError,Xe as request,tc as useOverlayState,nc as useRequest,Re as useUser};
1
+ import{jsx as e,jsxs as n,Fragment as c}from"react/jsx-runtime";import t,{SubMenu as r,MenuItem as i}from"rc-menu";import o from"styled-components";import{useRoutes as a,useLocation as s,Link as l,Navigate as d,BrowserRouter as u,Routes as h,Route as m,useNavigate as g}from"react-router-dom";import*as p from"react";import f,{useMemo as v,useState as b,useEffect as x,useContext as y,Children as w,useCallback as _,createElement as k,forwardRef as z,useRef as C,useImperativeHandle as S,Fragment as N}from"react";import j from"sweetalert2/dist/sweetalert2.js";import E from"sweetalert2-react-content";import{Spinner as L,Alert as U,Dropdown as A,Card as I,Button as D,Pagination as O,Table as P,Form as B,Modal as F,OverlayTrigger as R,Tooltip as T}from"react-bootstrap";import{useAsync as q,useAsyncCallback as M}from"react-async-hook";import H from"query-string";import K from"axios";import*as V from"retry-axios";import G from"rc-notification";import*as W from"path";import Y from"classnames";import{intersection as $,mapValues as J,debounce as Q,values as X,uniqueId as Z}from"lodash";import ee from"rc-steps";import"rc-steps/assets/index.css";import ne,{getRegistry as ce}from"@topthink/json-form";import te from"rc-table";function re(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}var ie;const oe=o.footer(ie||(ie=re(["\n\n"])));function ae(){return e(oe,{children:e("div",{className:"container"})})}const se=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/";const c=[];for(const a of e){var t,r,i,o;if(null!==(t=a.meta)&&void 0!==t&&t.hideInMenu)continue;const e=null===(r=a.meta)||void 0===r?void 0:r.title;if(!e)continue;let s=a.path||"";s="".concat(n,"/").concat(s),s=s.replace(/\/+/,"/").replace(/\/$/,"");const l={title:e,icon:null===(i=a.meta)||void 0===i?void 0:i.icon,path:s,children:[]};null!==(o=a.meta)&&void 0!==o&&o.hideChildrenInMenu||a.children&&a.children.length>0&&(l.children=se(a.children,s)),c.push(l)}return c};var le,de,ue,he,me,ge;const pe=c=>c.map((c=>c.children.length>0?e(r,{title:c.title,children:pe(c.children)},c.path):e(i,{children:n(l,{to:c.path,children:[c.icon&&e("i",{className:"bi bi-".concat(c.icon)}),c.title]})},c.path))),fe=()=>({height:0}),ve=e=>({height:e.scrollHeight}),be={motionName:"rc-menu-collapse",motionAppear:!0,onAppearStart:fe,onAppearActive:ve,onEnterStart:fe,onEnterActive:ve,onLeaveStart:ve,onLeaveActive:fe};function xe(c){let{routes:t,basename:r,title:i}=c;const o=a(t),l=v((()=>function(e){return se(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/")}(t,r)),[t,r]),{pathname:d}=s(),u=v((()=>{const e=[];return d.split("/").reduce(((n,c)=>(n.length>1&&e.push(n.join("/")),[...n,c])),[]),e.push(d),e}),[d]),[h,m]=b([]);x((()=>{m(u.slice(0,-1))}),[u]);return n(ye,{children:[n(we,{children:[e(_e,{children:i}),e(Ce,{mode:"inline",motion:be,openKeys:h,onOpenChange:e=>{const n=e[e.length-1];m(e.filter((e=>n.startsWith(e))))},selectedKeys:u,children:pe(l)})]}),n(ke,{children:[e(ze,{children:o}),e(ae,{})]})]})}const ye=o.div(le||(le=re(["\n display: flex;\n flex-wrap: nowrap;\n width: 100%;\n"]))),we=o.nav(de||(de=re(["\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n z-index: 100;\n padding: 54px 0 0;\n border-right: 1px solid #e3e3e3;\n width: 230px;\n background-color: #f5f5f5;\n"]))),_e=o.div(ue||(ue=re(["\n padding: 10px 0;\n height: 64px;\n line-height: 44px;\n text-indent: 24px;\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n font-size: 16px;\n"]))),ke=o.div(he||(he=re(["\n margin-left: 230px;\n flex: 1;\n"]))),ze=o.main(me||(me=re(["\n min-height: calc(100vh - 54px);\n position: relative;\n"]))),Ce=o(t)(ge||(ge=re(["\n border: none;\n box-shadow: none;\n padding: 0;\n\n .rc-menu-item {\n display: flex;\n\n &:hover {\n background-color: #f0f0f0;\n }\n\n a {\n flex: 1;\n text-decoration: none;\n color: dimgray;\n\n .bi {\n font-size: 16px;\n line-height: 18px;\n margin-right: 9px;\n min-width: 19px;\n text-align: center;\n vertical-align: text-bottom;\n }\n }\n }\n\n .rc-menu-sub {\n background-color: #eee;\n border-top: 1px solid #eee;\n border-bottom: 1px solid #eee;\n\n & > li {\n &:first-child {\n margin-top: 4px;\n }\n\n &:last-child {\n margin-bottom: 4px;\n }\n }\n\n .rc-menu-item-selected {\n background-color: #eee;\n color: var(--bs-primary);\n\n & > a {\n color: var(--bs-primary);\n }\n }\n\n .rc-menu-item-active {\n background-color: #eee;\n }\n\n .rc-menu-item {\n &:hover {\n background-color: #e7e7e7;\n }\n }\n }\n\n .rc-menu-submenu {\n & > .rc-menu-submenu-title {\n &:hover {\n background-color: #e7e7e7;\n }\n }\n }\n\n .rc-menu-submenu-active > .rc-menu-submenu-title {\n background-color: #eee;\n }\n\n .rc-menu-item,\n .rc-menu-submenu > .rc-menu-submenu-title {\n padding: 0 8px 0 24px;\n font-size: 14px;\n line-height: 36px;\n cursor: pointer;\n }\n\n .rc-menu-sub > .rc-menu-item,\n .rc-menu-sub > .rc-menu-submenu > .rc-menu-submenu-title {\n padding-top: 0;\n padding-bottom: 0;\n padding-right: 0;\n }\n\n .rc-menu-submenu-arrow {\n line-height: 38px;\n }\n\n .rc-menu-item-selected {\n background-color: #f5f5f5;\n color: var(--bs-primary);\n\n & > a {\n color: var(--bs-primary);\n }\n }\n\n .rc-menu-submenu-selected {\n background-color: #eee;\n\n .rc-menu-submenu-title {\n color: var(--bs-primary);\n font-weight: 500;\n }\n }\n\n & > .rc-menu-item {\n line-height: 38px;\n }\n\n & > .rc-menu-submenu {\n &.rc-menu-submenu-selected {\n background-color: #f5f5f5;\n }\n\n & > .rc-menu-submenu-title {\n line-height: 38px;\n\n &:hover {\n background-color: #f0f0f0;\n }\n }\n\n &.rc-menu-submenu-active > .rc-menu-submenu-title {\n background-color: #f5f5f5;\n }\n\n & > .rc-menu-sub {\n border-top: 1px solid #e6e6e6;\n border-bottom: 1px solid #e6e6e6;\n\n & > li {\n &:first-child {\n margin-top: 9px;\n }\n\n &:last-child {\n margin-bottom: 9px;\n }\n }\n }\n }\n\n"]))),Se=E(j),Ne={confirmButtonText:"确定",cancelButtonText:"取消"},je={confirm:async e=>{const{isConfirmed:n}=await Se.fire({...Ne,icon:"warning",showCancelButton:!0,...e});return n},error:e=>{Se.fire({...Ne,toast:!0,position:"top",icon:"error",timer:3e3,showConfirmButton:!1,...e})}};var Ee,Le,Ue,Ae;const Ie=o.div(Ee||(Ee=re(["\n padding: 48px 32px;\n"]))),De=o.div(Le||(Le=re(["\n margin-bottom: 24px;\n text-align: center;\n font-size: 72px;\n"]))),Oe=o.div(Ue||(Ue=re(["\n color: rgba(0, 0, 0, .85);\n font-size: 24px;\n line-height: 1.8;\n text-align: center;\n"]))),Pe=o.div(Ae||(Ae=re(["\n margin-top: 32px;\n text-align: center;\n"]))),Be={success:e("i",{className:"bi bi-check-circle-fill text-success"}),error:e("i",{className:"bi bi-exclamation-circle-fill text-danger"}),info:e("i",{className:"bi bi-info-circle-fill text-info"}),warning:e("i",{className:"bi bi-exclamation-triangle-fill text-warning"})};function Fe(c){let{status:t,title:r,icon:i,extra:o}=c;return!i&&t&&(i=Be[t]),n(Ie,{children:[i&&e(De,{children:i}),r&&e(Oe,{children:r}),o&&e(Pe,{children:o})]})}var Re,Te;o.div(Re||(Re=re(["\n position: relative;\n"])));const qe=o.div(Te||(Te=re(["\n display: ",";\n position: absolute;\n top: 0 !important;\n left: 0 !important;\n width: 100%;\n height: 100%;\n text-align: center;\n vertical-align: middle;\n padding: 1em;\n background-color: ",";\n opacity: ",";\n line-height: 1;\n animation-fill-mode: both;\n animation-duration: .5s;\n transition: background-color .5s linear;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n user-select: none;\n will-change: opacity;\n z-index: 990;\n"])),(e=>e.active?"flex":"none"),(e=>e.inverted?"rgba(255, 255, 255, .85)":"rgba(0, 0, 0, .85)"),(e=>e.active?1:0));var Me;function He(c){let{loading:t=!0,children:r,variant:i="success",animation:o="border",wrap:a,...s}=c;return t?(r&&(r=e("p",{className:"mt-3 text-secondary",children:r})),r=n(qe,{inverted:!0,active:!0,children:[e(L,{animation:o,variant:i,...s}),r]}),a?e(Ke,{height:"number"==typeof a?a:150,children:r}):r):null}const Ke=o.div(Me||(Me=re(["\n position: relative;\n height: ",";\n"])),(e=>"".concat(e.height,"px")));function Ve(n){let{onLogin:c}=n;const{result:t}=q((async()=>{await c();const e=sessionStorage.getItem("redirect_uri");return e&&sessionStorage.removeItem("redirect_uri"),e||"/"}),[]);return t?e(d,{to:t,replace:!0}):e(He,{})}function Ge(n){let{onLogout:c}=n;return q((async()=>{await c()}),[]),e(He,{})}class We extends Error{constructor(e){var n,c,t;super("Unauthorized"),t=void 0,(c="url")in(n=this)?Object.defineProperty(n,c,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[c]=t,this.url=e}}let Ye;const $e=n=>{let{type:c,...t}=n;!function(e){if(Ye)return e(Ye);G.newInstance({prefixCls:"notification",maxCount:5,style:{top:20,right:20}},(n=>{Ye?e(Ye):(Ye=n,e(n))}))}((n=>{if("error"===c)t.content=e(U,{variant:"danger",children:t.content}),t.closable?t.duration=0:t.duration=5;n.notice(t)}))};let Je={};["error"].forEach((e=>{Je[e]=(n,c)=>{$e({...c,type:e,content:n})}})),V.attach(),K.defaults.raxConfig={retryDelay:2e3,backoffType:"static",shouldRetry:e=>{var n,c;return"GET"===(null===(n=e.config.method)||void 0===n?void 0:n.toUpperCase())&&449===(null===(c=e.response)||void 0===c?void 0:c.status)}},K.defaults.maxContentLength=1/0,K.defaults.maxBodyLength=1/0,K.defaults.baseURL="/api",K.interceptors.request.use((e=>{const n=sessionStorage.getItem("authorization");return n&&(e.headers={...e.headers,Authorization:"Bearer ".concat(n)}),e}),(e=>Promise.reject(e)));const Qe=e=>e&&"object"==typeof e;K.interceptors.response.use((e=>(201===e.status&&e.data.location&&(window.location.href=e.data.location,e.data=void 0),e)),(e=>{if(K.isAxiosError(e)&&e.response){const{data:n,status:c}=e.response;401===c?(e.errors="Unauthorized",Qe(n)&&n.url&&(e=new We(n.url)),Je.error("Unauthorized")):Qe(n)?422===c?e.errors=n:"message"in n&&(e.errors=n.message):e.errors=n}return Promise.reject(e)}));const Xe=K.isAxiosError,Ze=async function(e){e="string"==typeof e?{url:e}:e;const{data:n}=await K.request({paramsSerializer:function(e){return H.stringify(e,{sort:!1,skipNull:!0,skipEmptyString:!0})},...e});return n};Ze.defaults=K.defaults,Ze.interceptors=K.interceptors;const en=f.createContext({});function nn(c){const{basename:t="/",onLogin:r,onLogout:i,authentication:o,baseURL:a,userResolver:s}=c;a&&(Ze.defaults.baseURL=a),"token"===o&&Ze.interceptors.request.use((e=>{const n=sessionStorage.getItem("authorization");return n&&(e.headers={...e.headers,Authorization:"Bearer ".concat(n)}),e}));const l=async()=>{let e;if(r)e=await r();else{const n=H.parse(window.location.hash.substr(1));n.access_token&&(e=n.access_token)}"token"===o&&e&&sessionStorage.setItem("authorization",e)},d=async()=>{i?await i():await Ze("/logout"),"token"===o&&sessionStorage.removeItem("authorization")},g=e=>{window.location.pathname!==W.join(t,"/logout")&&sessionStorage.setItem("redirect_uri",function(e,n){return"/"===n?e:e.slice(n.length)}(window.location.pathname+window.location.search,t));const n=window.location.origin+W.join(t,"/login");window.location.href=H.stringifyUrl({url:e.url,query:{redirect_uri:n}})};return function(c){let{children:r}=c;return e(en.Provider,{value:{userResolver:s,onUnauthorized:g},children:e(u,{basename:t,children:n(h,{children:[e(m,{path:"*",element:r}),e(m,{path:"login",element:e(Ve,{onLogin:l})}),e(m,{path:"logout",element:e(Ge,{onLogout:d})})]})})})}}const cn=f.createContext(null),tn=function(n){let{children:c}=n;const[t,r]=b(null),{userResolver:i,onUnauthorized:o}=y(en);return q((async()=>{if(i)return i()}),[],{onError(e){e instanceof We&&o&&o(e)},onSuccess(e){e&&r(e)}}),t?e(cn.Provider,{value:[t,r],children:c}):e(He,{})};function rn(){const e=y(cn);if(!e)throw new Error("please use `useUser` in UserContext");return e}var on,an;const sn=o.a(on||(on=re(["\n cursor: pointer;\n"])));function ln(c){let{children:t,menus:r,className:i,logo:o=!0}=c;const[a]=rn();return e(dn,{className:Y("navbar navbar-expand-lg navbar-light bg-white border-bottom sticky-top",i),children:n("div",{className:"container-fluid",children:[o&&e("a",{className:"navbar-brand",href:"https://www.topthink.com",children:e("img",{src:"data:image/svg+xml,%3csvg width='485' height='132' xmlns='http://www.w3.org/2000/svg' xml:space='preserve' style='enable-background:new 0 0 531.69 198.43%3b' version='1.1'%3e %3cstyle type='text/css'%3e.st0%7bfill:%233C60FF%3b%7d%3c/style%3e %3cg%3e %3ctitle%3ebackground%3c/title%3e %3crect fill='none' id='canvas_background' height='134' width='487' y='-1' x='-1'/%3e %3c/g%3e %3cg%3e %3ctitle%3eLayer 1%3c/title%3e %3cpath id='svg_1' d='m132.29%2c62.34c-1.19%2c-18.77 -10.34%2c-35.36 -24.11%2c-46.46c-11.15%2c-8.99 -25.34%2c-14.38 -40.79%2c-14.38c-0.55%2c0 -1.09%2c0.01 -1.63%2c0.02c-3.32%2c0.08 -6.57%2c0.41 -9.75%2c0.98c-30.49%2c5.38 -53.65%2c32 -53.65%2c64.04c0%2c1.87 0.08%2c3.73 0.24%2c5.57c2.5%2c29.51 24.7%2c53.4 53.41%2c58.47c2.38%2c0.42 4.8%2c0.72 7.26%2c0.86c0.83%2c0.05 1.66%2c0.09 2.5%2c0.11c0.54%2c0.01 1.08%2c0.02 1.63%2c0.02c34.04%2c0 61.97%2c-26.16 64.79%2c-59.46c0.16%2c-1.83 0.24%2c-3.69 0.24%2c-5.57c0%2c-1.42 -0.05%2c-2.82 -0.14%2c-4.2zm-76.27%2c32.5c-0.26%2c0.01 -0.53%2c0.01 -0.79%2c0.01c-14.56%2c0 -26.88%2c-9.57 -31.03%2c-22.76c-0.97%2c-3.08 -1.49%2c-6.35 -1.49%2c-9.75c0%2c-17.95 14.56%2c-32.52 32.51%2c-32.52c0.26%2c0 0.53%2c0 0.79%2c0.01c3.41%2c0.08 6.69%2c0.68 9.75%2c1.74c6.5%2c2.22 12.06%2c6.45 15.97%2c11.94c1.98%2c2.78 3.54%2c5.9 4.57%2c9.25c0.94%2c3.03 1.44%2c6.24 1.44%2c9.58l-9.75%2c0c0%2c-2.18 -0.31%2c-4.29 -0.88%2c-6.28c-0.92%2c-3.23 -2.55%2c-6.17 -4.69%2c-8.64c-1.86%2c-2.14 -4.12%2c-3.93 -6.65%2c-5.25c-2.93%2c-1.54 -6.24%2c-2.46 -9.75%2c-2.58c-0.26%2c-0.01 -0.52%2c-0.01 -0.79%2c-0.01c-12.57%2c0 -22.76%2c10.19 -22.76%2c22.76c0%2c3.49 0.79%2c6.8 2.19%2c9.75c3.65%2c7.69 11.49%2c13.01 20.57%2c13.01c0.27%2c0 0.53%2c-0.01 0.79%2c-0.01l0%2c9.75zm55.7%2c-17.92c-3.35%2c10.5 -13.18%2c18.09 -24.78%2c18.09c-3.13%2c0 -6.13%2c-0.55 -8.91%2c-1.57c-2.18%2c-0.8 -4.24%2c-1.88 -6.11%2c-3.21c-2.38%2c-1.68 -4.47%2c-3.76 -6.16%2c-6.13c-0.28%2c-0.39 -0.55%2c-0.79 -0.81%2c-1.2c-2.03%2c-3.2 -3.38%2c-6.87 -3.85%2c-10.82l9.87%2c0c0.33%2c1.71 0.92%2c3.32 1.74%2c4.8c1.61%2c2.91 4.09%2c5.26 7.09%2c6.72c0.57%2c0.28 1.15%2c0.53 1.76%2c0.73c1.68%2c0.6 3.49%2c0.92 5.37%2c0.92c7.92%2c0 14.52%2c-5.67 15.96%2c-13.17c0.2%2c-1 0.3%2c-2.04 0.3%2c-3.09c0%2c-2.37 -0.51%2c-4.63 -1.43%2c-6.67c-1.66%2c-3.71 -4.68%2c-6.68 -8.43%2c-8.28l3.54%2c-9.1c7.43%2c3.08 13.13%2c9.49 15.21%2c17.38c0.44%2c1.64 0.72%2c3.34 0.81%2c5.09c0.04%2c0.52 0.05%2c1.05 0.05%2c1.58c0%2c1.05 -0.07%2c2.07 -0.18%2c3.09c-0.18%2c1.68 -0.54%2c3.3 -1.04%2c4.84z' class='st0'/%3e %3cg id='svg_2'%3e %3cg id='svg_3'%3e %3crect id='svg_4' height='6.34' width='94.12' class='st0' y='20.46' x='163.29'/%3e %3c/g%3e %3cg id='svg_5'%3e %3cpath id='svg_6' d='m169.31%2c113.72l0%2c-6.34c6.49%2c0 11.77%2c-5.28 11.77%2c-11.77l0%2c-71.98l6.34%2c0l0%2c71.98c0%2c9.98 -8.12%2c18.11 -18.11%2c18.11z' class='st0'/%3e %3c/g%3e %3cg id='svg_7'%3e %3cpath id='svg_8' d='m255.49%2c91.27l-6.34%2c0l0%2c-38.2c0%2c-5.06 -4.12%2c-9.18 -9.18%2c-9.18l-19.37%2c0c-5.06%2c0 -9.18%2c4.12 -9.18%2c9.18l0%2c38.2l-6.34%2c0l0%2c-38.2c0%2c-8.55 6.96%2c-15.51 15.51%2c-15.51l19.38%2c0c8.55%2c0 15.51%2c6.96 15.51%2c15.51l0%2c38.2l0.01%2c0z' class='st0'/%3e %3c/g%3e %3cg id='svg_9'%3e %3crect id='svg_10' height='17.09' width='6.34' class='st0' y='23.63' x='227.12'/%3e %3c/g%3e %3cg id='svg_11'%3e %3cpath id='svg_12' d='m206.43%2c113.84l-3.34%2c0l0%2c-6.34l3.34%2c0c6.3%2c0 12.9%2c-3.56 15.35%2c-8.29c3.49%2c-6.71 5.33%2c-14.25 5.33%2c-21.81l0%2c-26.13l6.34%2c0l0%2c26.13c0%2c8.58 -2.09%2c17.13 -6.05%2c24.74c-3.98%2c7.68 -13.57%2c11.7 -20.97%2c11.7z' class='st0'/%3e %3c/g%3e %3cg id='svg_13'%3e %3cpath id='svg_14' d='m257.48%2c113.84l-3.34%2c0c-7.4%2c0 -16.98%2c-4.02 -20.98%2c-11.7c-3.96%2c-7.61 -6.05%2c-16.16 -6.05%2c-24.74l6.34%2c0c0%2c7.56 1.84%2c15.1 5.33%2c21.81c2.46%2c4.73 9.06%2c8.29 15.35%2c8.29l3.34%2c0l0%2c6.34l0.01%2c0z' class='st0'/%3e %3c/g%3e %3cg id='svg_15'%3e %3crect id='svg_16' height='6.34' width='42.87' class='st0' y='27.89' x='274.07'/%3e %3c/g%3e %3cg id='svg_17'%3e %3crect id='svg_18' height='61.38' width='6.34' class='st0' y='14.89' x='293.05'/%3e %3c/g%3e %3cg id='svg_19'%3e %3crect id='svg_20' height='6.34' width='33.26' class='st0' transform='matrix(0.11%2c-0.9939%2c0.9939%2c0.11%2c194.7608%2c392.0006) ' y='46.985071' x='325.728637'/%3e %3c/g%3e %3cg id='svg_21'%3e %3crect id='svg_22' height='33.26' width='6.34' class='st0' transform='matrix(0.9939%2c-0.11%2c0.11%2c0.9939%2c-7.5075%2c38.3801) ' y='37.060893' x='310.495485'/%3e %3c/g%3e %3cg id='svg_23'%3e %3cpath id='svg_24' d='m352.9%2c77.14l-15.15%2c0c-7.52%2c0 -13.64%2c-6.12 -13.64%2c-13.63l0%2c-29.61c0%2c-7.52 6.12%2c-13.64 13.64%2c-13.64l15.15%2c0c7.52%2c0 13.64%2c6.12 13.64%2c13.64l0%2c29.61c0%2c7.52 -6.12%2c13.63 -13.64%2c13.63zm-15.15%2c-50.54c-4.02%2c0 -7.3%2c3.27 -7.3%2c7.3l0%2c29.61c0%2c4.02 3.27%2c7.3 7.3%2c7.3l15.15%2c0c4.02%2c0 7.3%2c-3.27 7.3%2c-7.3l0%2c-29.61c0%2c-4.02 -3.27%2c-7.3 -7.3%2c-7.3l-15.15%2c0z' class='st0'/%3e %3c/g%3e %3cg id='svg_25'%3e %3cg id='svg_26'%3e %3crect id='svg_27' height='6.34' width='17.8' class='st0' y='37.2' x='336.43'/%3e %3c/g%3e %3cg id='svg_28'%3e %3crect id='svg_29' height='6.34' width='17.8' class='st0' y='53.87' x='336.43'/%3e %3c/g%3e %3c/g%3e %3cg id='svg_30'%3e %3cpath id='svg_31' d='m352.7%2c113.84l-37.98%2c0c-8%2c0 -14.5%2c-6.51 -14.5%2c-14.5l0%2c-16.14l6.34%2c0l0%2c16.13c0%2c4.5 3.66%2c8.17 8.17%2c8.17l37.98%2c0l0%2c6.34l-0.01%2c0z' class='st0'/%3e %3c/g%3e %3cg id='svg_32'%3e %3crect id='svg_33' height='6.34' width='23.57' class='st0' transform='matrix(0.2529%2c-0.9675%2c0.9675%2c0.2529%2c114.4986%2c402.9877) ' y='83.698593' x='326.836101'/%3e %3c/g%3e %3cg id='svg_34'%3e %3crect id='svg_35' height='6.34' width='20.52' class='st0' y='86.2' x='321.58'/%3e %3c/g%3e %3cg id='svg_36'%3e %3crect id='svg_37' height='24.75' width='6.34' class='st0' transform='matrix(0.9556%2c-0.2946%2c0.2946%2c0.9556%2c-19.7967%2c122.424) ' y='75.874073' x='369.686666'/%3e %3c/g%3e %3cg id='svg_38'%3e %3crect id='svg_39' height='6.34' width='71.83' class='st0' y='20.46' x='395.51'/%3e %3c/g%3e %3cg id='svg_40'%3e %3crect id='svg_41' height='6.34' width='90.81' class='st0' y='57.44' x='386.02'/%3e %3c/g%3e %3cg id='svg_42'%3e %3cpath id='svg_43' d='m463.12%2c113.64l-56%2c0c-4.5%2c0 -8.59%2c-2.29 -10.94%2c-6.14c-2.35%2c-3.84 -2.52%2c-8.53 -0.46%2c-12.53l17.68%2c-35.81l5.64%2c2.89l-17.68%2c35.81c-1.04%2c2.02 -0.95%2c4.39 0.23%2c6.33c1.19%2c1.94 3.25%2c3.1 5.53%2c3.1l56%2c0c1.51%2c0 2.88%2c-0.71 3.74%2c-1.95c0.81%2c-1.16 1.03%2c-2.57 0.63%2c-3.91l-7.8%2c-12.34l5.36%2c-3.39l8.18%2c12.94l0.12%2c0.31c1.24%2c3.34 0.76%2c7.08 -1.28%2c10.01c-2.04%2c2.94 -5.39%2c4.68 -8.95%2c4.68z' class='st0'/%3e %3c/g%3e %3c/g%3e %3c/g%3e%3c/svg%3e",height:"30"})}),t,n(A,{navbar:!0,children:[e(A.Toggle,{as:sn,className:"nav-link",children:e("img",{className:"rounded-circle",width:"25",height:"25",src:a.avatar})}),e(A.Menu,{className:"shadow",children:r})]})]})})}const dn=o.header(an||(an=re(["\n height: 54px;\n"])));function un(t){let{children:r,title:i,className:o,...a}=t;return e(I,{className:Y("border-0 shadow-sm mb-3",o),...a,children:n("div",{className:"card-body",children:[i&&n(c,{children:[e("h5",{children:i}),e("hr",{})]}),r]})})}function hn(n){let{errors:c}=n;return c?e(U,{variant:"danger",children:e("ul",{className:"mb-0",children:"string"==typeof c?e("li",{children:c}):Object.entries(c).map((n=>{let[c,t]=n;return e("li",{children:t},c)}))})}):null}function mn(n){let{require:t,children:r,fallback:i}=n;const[o]=rn();let a=!1;return"function"==typeof t?a=t(o):("string"==typeof t&&(t=[t]),a=$(o.roles,t).length>0),a||(r=i),e(c,{children:r})}var gn,pn;function fn(n){let{children:c,size:t="small"}=n;"string"==typeof t&&(t={small:8,middle:16,large:24}[t]);const r=w.map(c,(n=>{if(n)return e(bn,{children:n})}));return e(vn,{size:t,children:r})}const vn=o.div(gn||(gn=re(["\n display: inline-flex;\n align-items: center;\n gap: ","px;\n"])),(e=>e.size)),bn=o.div(pn||(pn=re(["\n\n"])));var xn;function yn(){return yn=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var c=arguments[n];for(var t in c)Object.prototype.hasOwnProperty.call(c,t)&&(e[t]=c[t])}return e},yn.apply(this,arguments)}const wn=e=>p.createElement("svg",yn({className:"step_check_svg__icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentColor"},e),xn||(xn=p.createElement("path",{d:"M887.904 298.208c-12.864-12.064-33.152-11.488-45.216 1.408L415.936 753.984l-233.12-229.696c-12.608-12.416-32.864-12.288-45.28.32-12.416 12.576-12.256 32.864.352 45.248l256.48 252.672c.096.096.224.128.32.224s.128.224.224.32c2.016 1.92 4.448 3.008 6.784 4.288 1.152.672 2.144 1.664 3.36 2.144 3.776 1.472 7.776 2.24 11.744 2.24 4.192 0 8.384-.832 12.288-2.496 1.312-.544 2.336-1.664 3.552-2.368 2.4-1.408 4.896-2.592 6.944-4.672.096-.096.128-.256.224-.352.064-.096.192-.128.288-.224L889.28 343.424c12.16-12.832 11.488-33.088-1.376-45.216z"})));var _n;function kn(n){return e(zn,{icons:{finish:e(wn,{}),error:e(c,{})},...n})}kn.Step=ee.Step;const zn=o(ee)(_n||(_n=re(["\n .rc-steps-item-icon {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n\n & > .rc-steps-icon {\n top: 0;\n }\n }\n\n .rc-steps-item-process {\n .rc-steps-item-icon {\n background: var(--bs-primary);\n border-color: var(--bs-primary);\n }\n }\n\n .rc-steps-item-finish {\n .rc-steps-item-icon {\n border-color: var(--bs-primary);\n\n & > .rc-steps-icon {\n color: var(--bs-primary);\n }\n }\n\n .rc-steps-item-title:after {\n background-color: var(--bs-primary);\n }\n }\n\n"])));function Cn(n){let{value:t,locale:r="zh-CN",currency:i=!0}=n;const o=v((()=>{let e={};return e=i?{style:"currency",currency:"CNY",...e}:{minimumFractionDigits:2},new Intl.NumberFormat(r,e)}),[i,r]);return e(c,{children:o.format(t)})}function Sn(n){let{loading:c,children:t,...r}=n;return e(D,{...r,disabled:c,children:c?"Loading…":t})}function Nn(e){let{url:n,method:c,confirm:t,onSuccess:r,children:i,disabled:o,as:a=D,...s}=e;const[l,d]=b(!1),u=_((async e=>{e.preventDefault();try{if(d(!0),t&&!await je.confirm({text:t}))return;const e="string"==typeof n?{url:n,method:c}:{method:c,...n},i=await Ze(e);r&&r(i)}catch(e){if(!K.isAxiosError(e))throw e;{let n=e.errors;"string"!=typeof e.errors&&(n=Object.values(e.errors).join("<br />")),je.error({text:n})}}finally{d(!1)}}),[n,c,d]);return k(a,{...s,disabled:o||l,onClick:u},i)}function jn(n){let{to:c,replace:t,...r}=n,i=g();return e(D,{...r,onClick:e=>{e.preventDefault(),i(c,{replace:t})}})}const En=require("ajv-i18n/localize/zh"),Ln={upload:function(n){const{widgets:c}=ce(),t={...n.options,async onUpload(e){if(n.options.onUpload instanceof Function)return await n.options.onUpload.call(e);if(n.options.endpoint){const c=new FormData;c.set("file",e);const{url:t}=await Ze({url:n.options.endpoint,method:"post",data:c});return t}}};return e(c.upload,{...n,options:t})}},Un=z(((n,c)=>{let{action:t,method:r="post",onSuccess:i,formData:o,onSubmit:a,onChange:s,submitText:l="提交",children:d,...u}=n;const[h,m]=b(),[g,p]=b(!1),[f,v]=b(o),x=_((async(e,n)=>{try{if(p(!0),t){const{formData:n}=e;try{const e=await Ze({url:t,method:r,data:n});m(void 0),i&&await i(e)}catch(e){throw K.isAxiosError(e)&&m((e=>{const n=e.errors;return"string"==typeof n?{__errors:[n]}:J(n,(e=>({__errors:[e]})))})(e)),e}}else a&&await a(e,n)}finally{p(!1)}}),[t,r,a]),y=_((e=>{const{formData:n}=e;v(n),s&&s(e)}),[v,s]),w=_((e=>(e=e.map((e=>({keyword:e.name,dataPath:e.property,...e}))),En(e),e)),[]),k=e(Sn,{loading:g,type:"submit",variant:"primary",children:l});return"function"==typeof d&&(d=d({submit:k,loading:g})),e(ne,{ref:c,extraErrors:h,onSubmit:x,transformErrors:w,noHtml5Validate:!0,noValidate:!0,...u,formData:f,onChange:y,widgets:Ln,children:d||e("div",{className:"col-12",children:k})})}));var An,In,Dn,On,Pn;function Bn(c){let{title:t,children:r,extra:i}=c;return n(Fn,{children:[e(Rn,{children:n("div",{className:"container",children:[e(qn,{children:t}),e(Mn,{children:i})]})}),e(Tn,{className:"container",children:r})]})}const Fn=o.div(An||(An=re(["\n width: 100%;\n"]))),Rn=o.div(In||(In=re(["\n background-color: #fff;\n display: flex;\n\n .container {\n padding: 0 24px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n }\n"]))),Tn=o.div(Dn||(Dn=re(["\n margin-top: 24px;\n"]))),qn=o.div(On||(On=re(["\n font-size: 22px;\n line-height: 64px;\n height: 64px;\n"]))),Mn=o.div(Pn||(Pn=re(["\n\n"])));function Hn(){}function Kn(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}const Vn=function(n){let{indeterminate:c=!1,...t}=n;const r=C(null);return x((()=>{r.current&&(r.current.indeterminate=c)}),[c]),e("input",{ref:r,...t,className:"form-check-input",type:"checkbox"})};var Gn,Wn,Yn,$n,Jn,Qn;const Xn=o(P)(Gn||(Gn=re(["\n .rc-table-thead {\n border-top: none;\n }\n"]))),Zn={table:n=>e(Xn,{...n,className:"align-middle table-hover"})},ec=o((function(n){let{total:c=0,onChange:t=Hn,defaultCurrent:r=1,defaultPageSize:i=10,className:o,...a}=n;const[s,l]=b(r),[d,u]=b(i);x((()=>{Kn(a.current)&&l(a.current)}),[a.current]),x((()=>{Kn(a.pageSize)&&u(a.pageSize)}),[a.pageSize]);const h=v((()=>Math.floor((c-1)/d)+1),[c,d]),m=_((e=>()=>{e!==s&&(l(e),t(e,d))}),[t,s,d]),g=s-1>0?s-1:0,p=s+1<h?s+1:h,f=[];let y=null,w=null,k=null,z=null;if(h<=7)for(let n=1;n<=h;n+=1){const c=s===n;f.push(e(O.Item,{active:c,onClick:m(n),children:n},n))}else{z=e(O.Last,{onClick:m(h)},"last"),k=e(O.First,{onClick:m(1)},"first"),y=e(O.Prev,{onClick:m(g)},"prev"),w=e(O.Next,{onClick:m(p)},"next");let n=Math.max(1,s-2),c=Math.min(s+2,h);s-1<=2&&(c=5),h-s<=2&&(n=h-4);for(let t=n;t<=c;t+=1){const n=s===t;f.push(e(O.Item,{active:n,onClick:m(t),children:t},t))}s-1>=4&&3!==s&&f.unshift(y),h-s>=4&&s!==h-2&&f.push(w),1!==n&&f.unshift(k),c!==h&&f.push(z)}return e(O,{className:o,children:f})}))(Wn||(Wn=re(["\n margin-bottom: 0;\n justify-content: flex-end;\n"])));function nc(e){return"current_page"in e}const cc=z(((t,r)=>{let{source:i,rowKey:o="id",paginate:a=!0,toolBarRender:s,columns:l=[],search:d,rowSelection:u,card:h=!0,...m}=t;const[g,p]=b([]),[f,y]=b(a?{total:0,current:1,pageSize:10}:null),[w,k]=b(!0),[z,N]=b(""),j=_((async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};k(!0);try{let n;if("string"==typeof i){const c={q:z};f&&(c.page=e.page||f.current),n=await Ze({url:i,params:c})}else n=await i();a&&nc(n)&&(y({total:n.total,current:n.current_page,pageSize:n.per_page}),n=n.data),p(n)}catch(e){}finally{k(!1)}}),[i,p,f,z]);x((()=>{j()}),[z]);const E=C({reload:j});x((()=>{E.current={reload:j}}),[j]),S(r,(()=>E.current));const[L]=function(n,c,t){const[r,i]=b((()=>new Set((null==n?void 0:n.selectedRowKeys)||[]))),o=e=>"string"==typeof c?e[c]:c(e),a=e=>t.find((n=>o(n)===e)),s=_((e=>{i(e);const c=Array.from(e),t=c.map((function(e){return a(e)}));null!=n&&n.onChange&&(null==n||n.onChange(c,t))}),[a]);return[_((c=>{if(!n)return c;const i=t.map(o),a=i.every((function(e){return r.has(e)})),l=i.some((function(e){return r.has(e)}));return[{key:"selection",title:e(Vn,{checked:a,indeterminate:!a&&l,onChange:()=>{a?i.forEach((function(e){r.delete(e)})):i.forEach((function(e){r.add(e)})),s(new Set(r))}}),width:30,align:"center",render(n){let{record:c}=n;const t=o(c),i=r.has(t);return e(Vn,{checked:i,onChange:()=>{i?r.delete(t):r.add(t),s(new Set(r))}})}},...c]}),[t,n,r])]}(u,o,g),U=v((()=>L(l).map((e=>{const n={...e,render:void 0};if("render"in e&&e.render){const c=e.render;n.render=(e,n,t)=>c({value:e,record:n,index:t,action:E.current})}return n}))),[l,L,E]),A=function(e,n,c){const t=C(e),r=C(Q(e,n,c));return x((()=>{t.current=e})),x((()=>{r.current=Q((function(){t.current(...arguments)}),n,c)}),[n,c]),r.current}((e=>{N(e.target.value)}),500),I=n(c,{children:[e(He,{loading:w}),!1!==s&&n(tc,{children:[e(ic,{size:12,children:s&&s(E.current)}),n(rc,{size:12,children:[d&&e(B.Control,{onChange:A,type:"search",placeholder:"Search..."}),e(oc,{onClick:E.current.reload,children:e("i",{className:"bi bi-arrow-repeat"})})]})]}),e(te,{...m,rowKey:o,columns:U,components:Zn,data:g}),f&&e(ec,{...f,onChange:e=>{j({page:e})}})]});return h?e(un,{children:I}):I})),tc=o.div(Yn||(Yn=re(["\n display: flex;\n justify-content: space-between;\n padding-bottom: 1rem;\n height: 48px;\n"]))),rc=o(fn)($n||($n=re(["\n\n"]))),ic=o(fn)(Jn||(Jn=re(["\n\n"]))),oc=o.span(Qn||(Qn=re(["\n cursor: pointer;\n font-size: 20px;\n line-height: 1;\n\n &:hover {\n color: var(--bs-primary);\n }\n"]))),ac=z(((t,r)=>{let{text:i,variant:o="primary",header:a=i,footer:s=!0,onOk:l,size:d,onShow:u,children:h}=t;const[m,g]=b(!1),[p,f]=b(!1),v=()=>g(!1);S(r,(()=>({close:v})));return n(c,{children:[e(D,{variant:o,onClick:()=>g(!0),children:i}),n(F,{size:d,show:m,onHide:v,onShow:u,children:[a&&e(F.Header,{closeButton:!0,children:e(F.Title,{as:"h5",children:a})}),e(F.Body,{children:h}),s&&n(F.Footer,{children:[e(D,{variant:"secondary",onClick:v,children:"取消"}),e(Sn,{loading:p,variant:"primary",onClick:async()=>{if(l){f(!0);const e=await l();if(f(!1),!1===e)return}v()},children:"确定"})]})]})]})}));function sc(n){let{text:c,header:t,schema:r,uiSchema:i,action:o,method:a,formData:s,variant:l,onSuccess:d,onChange:u,fields:h,size:m}=n;const g=C(null),p=C(null),f=_((async()=>{try{var e;return await(null===(e=g.current)||void 0===e?void 0:e.submit()),!0}catch{return!1}}),[]);return e(ac,{ref:p,text:c,onOk:f,header:t,variant:l,size:m,children:e(Un,{ref:g,schema:r,uiSchema:i,action:o,method:a,formData:s,fields:h,onChange:u,onSuccess:d,children:e(N,{})})})}function lc(e){let{manual:n,refreshDeps:c,...t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{execute:r,currentParams:i,error:o,...a}=M((async n=>(e="string"==typeof e?{url:e}:e,await Ze({...e,...n}))),t);x((()=>{n||c||r()}),[]),x((()=>{c&&s()}),c);const s=_((()=>{i?r(...i):r()}),[r,i]);if(o&&Xe(o)){const e=o.errors;o=new Error("string"==typeof e?e:X(e).join(""))}return{refresh:s,execute:r,error:o,...a}}let dc=0;function uc(){let{onHide:e,onShow:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[c,t]=b(!1),[r,i]=b("visible-".concat(dc)),o=_((()=>{t(!1),e&&e()}),[t,e]),a=_((()=>{i("visible-".concat(++dc))}),[i,dc]),s=_((()=>{t(!0),n&&n()}),[t,n]),l={show:c,onHide:o,onExited:a,key:r};return{visible:c,show:s,hide:o,state:l}}function hc(n){let{tooltip:c,children:t,placement:r="bottom"}=n;return e(R,{placement:r,overlay:e(T,{id:Z(),children:c}),children:t})}export{mn as Access,un as Card,Bn as Content,hn as Error,ae as Footer,Un as Form,ln as Header,jn as LinkButton,He as Loader,Sn as LoadingButton,je as Message,ac as ModalButton,sc as ModalForm,Cn as NumberFormat,Nn as RequestButton,Fe as Result,xe as SiderLayout,fn as Space,kn as Steps,cc as Table,hc as Tooltip,tn as UserProvider,nn as createApplication,Xe as isRequestError,Ze as request,uc as useOverlayState,lc as useRequest,rn as useUser};
2
2
  //# sourceMappingURL=index.js.map