@ioca/react 1.1.2 → 1.1.4

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{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import i from"classnames";import{debounce as a,uid as r,throttle as s,pick as l,title as o}from"radash";import{forwardRef as c,createElement as d,useEffect as u,useCallback as p,isValidElement as m,cloneElement as h,useState as g,useMemo as f,Children as v,useRef as b,useLayoutEffect as y,Fragment as N,createContext as k,useContext as C,useImperativeHandle as w}from"react";import{SkipPreviousRound as x,CloseRound as $,MinusRound as T,PlusRound as I,InboxTwotone as P,VisibilityRound as z,VisibilityOffRound as O,SyncAltRound as D,KeyboardArrowLeftRound as M,KeyboardArrowRightRound as S,CalendarMonthTwotone as j,PauseRound as E,PlayArrowRound as B,StopRound as L,FullscreenExitRound as Y,FullscreenRound as A,VolumeOffRound as V,VolumeDownRound as W,FeedOutlined as q,AspectRatioRound as F,OpenInNewRound as H,FileDownloadOutlined as R,RotateRightRound as X,RotateLeftRound as U,HideImageTwotone as G,MoreHorizRound as K,InfoOutlined as Z,SearchRound as _,CheckRound as J,UnfoldMoreRound as Q,KeyboardArrowDownRound as ee,ListAltRound as te,CloudUploadTwotone as ne,PlusSharp as ie}from"@ricons/material";import{useReactive as ae,useMemoizedFn as re,useClickAway as se,useCreation as le,useSize as oe}from"ahooks";import{createRoot as ce}from"react-dom/client";import de from"react-custom-scrollbars-2";import ue from"dayjs";import pe from"dayjs/plugin/customParseFormat";import{createPortal as me}from"react-dom";import he from"rc-virtual-list";import ge from"pubsub-js";const fe=500;function ve(e){const t=e.target,n=t.closest("[data-ripple]");t&&n&&function(e,t){const[n,i]=function(){const e=document.createElement("SPAN"),t=document.createElement("SPAN");return e.className="i-ripple-container",t.className="i-ripple",e.append(t),[e,t]}(),a=e.getBoundingClientRect(),r=2*Math.max(a.width,a.height);i.style.cssText=`\n left: ${t.pageX-a.left}px;\n top: ${t.pageY-a.top}px;\n width: ${r}px;\n height: ${r}px;\n transition: all 0.5s;\n `,e.insertAdjacentElement("afterbegin",n),e.offsetHeight,i.classList.add("i-ripple-active"),setTimeout((()=>{n.remove()}),fe)}(n,e)}const be=n=>{const{icon:a,text:r,size:s,absolute:l,style:o,className:c,...d}=n;return e("div",{className:i("i-loading-container",{absolute:l},c),style:{fontSize:s,...o},...d,children:[a??t("svg",{width:"24",height:"24",stroke:"#000",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"i-loading-icon",children:t("circle",{cx:"12",cy:"12",r:"9.5",fill:"none",strokeWidth:"3",strokeLinecap:"round",strokeDasharray:40,strokeDashoffset:0})}),r]})},ye=({outline:e,flat:t,loading:n,disabled:a,size:r="normal",block:s,round:l,square:o,secondary:c,className:d})=>i("i-btn",d,{"i-btn-outline":e,"i-btn-flat":t,"i-btn-block":s,"i-btn-loading":n,"i-btn-square":o,"i-btn-secondary":c,[`i-btn-${r}`]:"normal"!==r,round:l,disabled:a}),Ne=c(((e,i)=>{const{as:a="a",children:r,className:s,loading:l,flat:o,outline:c,square:p,secondary:m,size:h,round:g,href:f,ripple:v=!0,onClick:b,...y}=e;if(!r)return t(n,{});const N=[l&&t(be,{},"loading"),d("span",{key:"content",className:"i-btn-content"},r)],k={className:ye(e),"data-ripple":v,onClick:e=>{l||y.disabled?e.stopPropagation():b?.(e)}};return u((()=>{v&&(document.documentElement.dataset.useripple||(document.documentElement.dataset.useripple="enable",document.addEventListener("mousedown",ve)))}),[v]),d(a,"string"==typeof a?{ref:i,href:f,...k,...y}:{to:f||"",...k,...y},N)}));Ne.Toggle=function(e){const{active:n,activeClass:a,after:r,disabled:s,children:l,className:o,onClick:c,onToggle:d,...m}=e,h=ae({active:n,done:!0}),g=p((()=>{const e=void 0!==r,t=!h.active;Object.assign(h,{active:t,done:!e}),d?.(t),e&&setTimeout((()=>{h.done=!0}),16)}),[r]);return u((()=>{h.active!==n&&g()}),[n]),t(Ne,{className:i(o,{[a||""]:h.active},"i-btn-toggle"),...m,onClick:e=>{c?.(e),!s&&g()},children:t("div",{className:i("i-btn-toggle-content",{"i-btn-toggle-active":h.done}),children:h.active?r??l:l})})},Ne.Group=function(e){const{children:n,vertical:a,className:r,style:s}=e;return t("div",{className:i(r,a?"i-btn-group-vertical":"i-btn-group-horizonal"),style:s,children:n})};const ke=c(((e,t)=>{const{icon:n,size:a="1.425em",rotate:r,style:s,className:l,...o}=e;if(!m(n))return n;const c={ref:t,style:{transform:r?`rotate(${r}deg)`:void 0,...s,width:a,height:a},className:i("i-icon",l),...o};return h(n,c)}));function Ce(e){const{style:n,className:a,onClick:r}=e;return t(Ne,{square:!0,className:i("i-affix-totop",a),style:{...n},onClick:r,children:t(ke,{icon:t(x,{}),rotate:90})})}const we=e=>{const{position:n="fixed",left:r,top:s,right:l,bottom:o,offset:c,style:d,className:p,children:m,getContainer:b=()=>document.body}=e,[y,N]=g(!1),k=f((()=>v.map(m,(e=>{if(e.type===Ce){const{onClick:t}=e.props;return h(e,{key:e.key,...e.props,onClick:e=>{const n=b();t?.(e),n?.scrollTo({top:0,left:0,behavior:"smooth"})}})}return e}))),[m,b]);return u((()=>{const e=b();if(!c||!e)return;const t=a({delay:160},(()=>{const t=e.scrollTop;N(t<c)}));return t(),e.addEventListener("scroll",t),()=>{e.removeEventListener("scroll",t)}}),[c,b]),t("div",{className:i("i-affix",p,{"i-affix-hidden":y}),style:{...d,position:n,left:r,top:s,right:l,bottom:o},children:k})};we.ToTop=Ce;const xe=n=>{const{content:a,contentClass:r,dot:s,dotSize:l,round:o,disabled:c,style:d,className:u,children:p}=n;return e("div",{style:d,className:i("i-badge",{rounded:o},u),children:[p,t("div",{className:i("i-badge-content",r,{"i-badge-dot":s,"i-badge-hidden":c}),style:{fontSize:l},children:a})]})},$e=e=>n=>t("div",{style:n.style,className:i("i-card-"+e,n.className),children:n.children}),Te=$e("header"),Ie=$e("footer"),Pe=$e("banner"),ze=$e("tail"),Oe=n=>{const{shadow:a=!0,border:r,style:s,className:l,children:o}=n,c=f((()=>{const e={};return v.map(o,(t=>{switch(t.type){case Te:e.header=t;break;case Ie:e.footer=t;break;case Pe:e.banner=t;break;case ze:e.tailer=t;break;default:e.content=[...e.content||[],t]}})),e}),[o]),{header:d,banner:u,content:p,footer:m,tailer:h}=c;return e("div",{style:s,className:i("i-card",l,{shadow:a,"i-card-bordered":r}),children:[u,d,p&&t("div",{className:"i-card-content",children:p}),m,h]})};var De;function Me(e,t,n={}){const{refWindow:i,gap:a=0,offset:r=0,position:s="top",align:l}=n;if(!e||!t)return[0,0,{arrowX:0,arrowY:0,arrowPos:"bottom"}];const o=e.getBoundingClientRect(),c=t.getBoundingClientRect();let d=window.innerWidth,u=window.innerHeight,{left:p,top:m,right:h,bottom:g,width:f,height:v}=o;const{height:b,width:y}=c;if(!i){const t=e.offsetParent?.getBoundingClientRect();d=t?.width||d,u=t?.height||u,p=e.offsetLeft,m=e.offsetTop,h=p+o.width,g=m+o.height}let N=0,k=0,C=0,w=0,x="bottom";switch(s){case"left":case"right":N=v!==b?je({containerSize:u,targetSize:v,targetOffset:m,contentSize:b,gap:a,align:l}):m,w=N<m?m-N+v/2:v/2;const e=p-r-y,t=h+r+y;"left"===s?(k=e<0?h+r:e,C=e<0?0:y,x=e<0?"left":"right"):(k=d>t?h+r:e,C=d>t?0:y,x=d>t?"left":"right");break;case"top":case"bottom":k=f!==y?je({containerSize:d,targetOffset:p,targetSize:f,contentSize:y,gap:a,align:l}):p,C=k>p?y/2:p-k+f/2;const n=m-r-b,i=g+r+b;"top"===s?(N=n<0?g+r:n,w=n<0?0:b,x=n<0?"top":"bottom"):(N=u>i?g+r:n,w=u>i?0:b,x=u>i?"top":"bottom")}return[k,N,{arrowX:C,arrowY:w,arrowPos:x}]}function Se(e,t){const{pageX:n,pageY:i}=e,{width:a,height:r}=t.getBoundingClientRect(),{innerHeight:s,innerWidth:l}=window;return[n+a>=l&&n-a>0?n-a:n,i+r>=s&&i-r>0?i-r:i]}function je({containerSize:e,targetSize:t,targetOffset:n,contentSize:i,gap:a,align:r="center"}){const s=n+t/2;switch(r){case"start":return n+i>e?n+t:n;case"center":return t>=i?s-i/2:s+i/2+a>e?n+t-i:s-i/2-a<0?a:s-i/2;case"end":const r=n+t-i;return r>0?r:a;default:return s-i/2}}function Ee(e){return e.map((e=>["string","number"].includes(typeof e)?{label:e,value:e}:e))}function Be(e,t={}){const{precision:n,thousand:i}=t,a=e.toFixed(n);if(!i)return a;const r=a.split("."),s=r[0].replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g,`$&${i}`);return 1===r.length?s:`${s}.${r[1]}`}function Le(e,t=document.body){const n=document.createElement("div");t.append(n);const i=ce(n),a=setTimeout((()=>{i?.render(e)}),0);return()=>{n?.remove(),i?.unmount(),a&&clearTimeout(a)}}function Ye(e){return e.match(/\.([^\./\?]+)($|\?)/)?.[1]}function Ae(e,t){switch(!0){case["jpg","jpeg","png","webp","svg"].includes(e)||t?.startsWith("image/"):return De.IMAGE;case["mp4","avi"].includes(e)||t?.startsWith("video/"):return De.VIDEO;default:return De.UNKNOWN}}function Ve(e,t=2){if(!+e)return"0 Bytes";const n=t<0?0:t,i=Math.floor(Math.log(e)/Math.log(1024));return`${parseFloat((e/Math.pow(1024,i)).toFixed(n))} ${["B","KB","MB","GB","TB","PB","EB","ZB","YB"][i]}`}function We(e,t,n){return e<t?t:e>n?n:e}function qe(n){const{type:a="default",label:r,name:s,value:l=!1,className:o,status:c="normal",message:d,disabled:p,partof:m,children:h,onChange:g,...f}=n,v=ae({value:l,status:c,message:d}),b=re((e=>{const t=e.target.checked;Object.assign(v,{value:t,status:c,message:d}),g?.(t,e)}));return u((()=>{v.value=l}),[l]),e("label",{className:i("i-checkbox-item",{[`i-checkbox-${v.status}`]:"normal"!==v.status,disabled:p},o),...f,children:[t("input",{type:"checkbox",name:s,className:i("i-checkbox-input",{[`i-checkbox-${a}`]:!m,"i-checkbox-partof":m}),checked:v.value,disabled:p,onChange:b}),t("span",{className:"i-checkbox-text",children:h||r}),v.message&&e("span",{className:"i-checkbox-message",children:["*",v.message]})]})}function Fe(n){const{label:a,name:r,options:s=[],value:l="",type:o="default",optionInline:c=!0,labelInline:d,disabled:p,status:m="normal",message:h,required:g,className:v,onChange:b,...y}=n,N=ae({value:l}),k=f((()=>Ee(s)),[s]),C=re(((e,t,n)=>{const i=[...N.value],a=i.findIndex((e=>e===t.value));e&&a<0?i.push(t.value):!e&&a>-1&&i.splice(a,1),N.value=i,b?.(i,t,n)}));return u((()=>{N.value=l}),[l]),e("div",{className:i("i-checkbox i-input-label",{[`i-checkbox-${m}`]:"normal"!==m,"i-input-inline":d},v),...y,children:[a&&e("span",{className:"i-input-label-text",children:[g&&t("span",{className:"error",children:"*"}),a,h&&t("p",{className:"i-checkbox-message",children:h})]}),t("div",{className:i("i-checkbox-options",{"i-options-block":!c,"i-checkbox-options-button":"button"===o}),children:k.map((e=>t(qe,{name:r,value:N.value.includes(e.value),type:o,disabled:p||e.disabled,onChange:(t,n)=>C(t,e,n),children:e.label},e.value)))})]})}Oe.Header=Te,Oe.Footer=Ie,Oe.Banner=Pe,Oe.Tailer=ze,function(e){e.IMAGE="IMAGE",e.VIDEO="VIDEO",e.AUDIO="AUDIO",e.PDF="PDF",e.EXCEL="EXCEL",e.TXT="TXT",e.UNKNOWN="UNKNOWN"}(De||(De={})),Fe.Item=qe;const He=e=>{const{as:a="a",active:s,className:l,icon:o=t($,{}),...c}=e;return s?d(a,{className:i("i-helpericon",l),...c},[d(ke,{key:r(3),icon:o})]):t(n,{})};const Re=n=>{const{active:a,items:r,multiple:s,border:l,headerClickable:o,className:c,children:d,renderToggle:u=e=>t(e?T:I,{}),onCollapse:p,...m}=n,h=ae({active:a}),g=f((()=>r||(d&&v.map(d,((e,t)=>{const{key:n,props:i}=e,{title:a,children:r,content:s,disabled:l,...o}=i;return{...o,key:n||t,title:a,content:r||s,disabled:l}}))||[])),[d]),b=e=>{const{key:t,disabled:n}=e;if(n)return;if(!s)return h.active=h.active===t?void 0:t,void p?.(t,void 0!==h.active);Array.isArray(h.active)||(h.active=[]);const i=h.active.findIndex((e=>e===t));i>-1?h.active.splice(i,1):void 0!==t&&h.active.push(t),p?.(t,i<0)};return t("div",{className:i("i-collapse",{"i-collapse-bordered":l},c),...m,children:g.map((n=>{const{key:a,title:r,content:l,disabled:c,className:d,...p}=n,m=s?(h.active||[]).includes(a):h.active===a;return e("div",{className:i("i-collapse-item",d,{"i-collapse-active":m,"i-collapse-disabled":c}),...p,children:[e("div",{className:"i-collapse-header",onClick:()=>(e=>{o&&b(e)})(n),children:[r,t(He,{active:!0,className:"i-collapse-toggle",icon:u(m),onClick:()=>b(n)})]}),t("div",{className:"i-collapse-content",children:l})]},a)}))})};function Xe(e){const{className:n,...a}=e;return t(P,{className:i("i-empty",n),...a})}function Ue({justify:e,col:t,row:n,colSpan:i=1,rowSpan:a=1}){return{"--datagrid-justify":e,gridArea:`${n+1} / ${t+1} / ${n+1+a} / ${t+1+i}`,insetInline:`var(--datagrid-cell-inset-${t})`}}function Ge(e){const{column:n,row:a,col:r,data:s,cellEllipsis:l,onCellClick:o,onCellDoubleClick:c}=e,{id:d,fixed:u,justify:p,rowSpan:m,render:h}=n,g=Ue({justify:p,fixed:u,col:r,row:a,rowSpan:m});return t("div",{className:i("i-datagrid-cell",{[`i-datagrid-cell-fixed-${u}`]:u}),"data-col":d,style:g,onClick:e=>o?.(s,n,a,r,e),onDoubleClick:e=>c?.(s,n,a,r,e),children:h?.(s[d],s,r)??t("div",{className:i("i-datagrid-cell-content",{"i-datagrid-cell-content-ellipsis":l}),children:s[d]})})}Re.Item=function(e){return t(n,{})};const Ke=new Set,Ze=new Set;function _e(e){u((()=>(Ke.add(e),()=>{Ke.delete(e)})),[e])}function Je(e){u((()=>(Ze.add(e),()=>{Ze.delete(e)})),[e])}function Qe(e){const t=new WeakMap,n=new IntersectionObserver((e=>{e.map((e=>{const n=t.get(e.target);n?.(e.target,e.isIntersecting)}))}),e);return{observe:function(e,i){t.get(e)||(t.set(e,i),e&&n.observe(e))},unobserve:function(e){e&&n.unobserve(e),t.delete(e)},disconnect:function(){n.disconnect()}}}function et(e){const{index:n,onWidthChange:i}=e,a=ae({resizing:!1,x:0,width:0}),r=re((e=>{const t=e.target.offsetParent.offsetWidth;Object.assign(a,{x:e.pageX,resizing:!0,width:t})}));return _e(re((e=>{if(!a.resizing)return;e.preventDefault();const t=a.width+e.pageX-a.x;t<=24||i(n,t)}))),Je((()=>{a.resizing&&(a.resizing=!1)})),t("i",{className:"i-datagrid-resizor",onMouseDown:r,onClick:e=>e.stopPropagation()})}document.addEventListener("mousemove",(e=>{for(const t of Ke.values())t(e)})),document.addEventListener("mouseup",(e=>{for(const t of Ze.values())t(e)}));const tt=e=>t("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e,children:t("g",{fill:"none",children:t("path",{d:"M9 17.898c0 1.074 1.265 1.648 2.073.941l6.31-5.522a1.75 1.75 0 0 0 0-2.634l-6.31-5.522C10.265 4.454 9 5.028 9 6.102v11.796z",fill:"currentColor"})})});function nt(n){const{type:a}=n;return e("a",{className:i("i-datagrid-sorter",{[`i-datagrid-sorter-${a}`]:a}),children:[t(tt,{className:"i-datagrid-sorter-caret"}),t(tt,{className:"i-datagrid-sorter-caret"})]})}function it(e){const{row:n,data:i,columns:a,cellEllipsis:r,onRowClick:s,onCellClick:l,onCellDoubleClick:o}=e;return t("div",{className:"i-datagrid-row",onClick:()=>s?.(i,n),children:a.map(((e,a)=>t(Ge,{column:e,col:a,row:n,data:i,cellEllipsis:r,onCellClick:l,onCellDoubleClick:o},a)))})}function at(n){const{columns:a,resizable:r,cellEllipsis:s,sortBy:l,sortType:o,onWidthChange:c,onHeaderClick:d}=n;return t("div",{className:"i-datagrid-header i-datagrid-row",children:a.map(((n,a)=>{const{id:u,title:p,fixed:m,colSpan:h,sorter:g,justify:f,renderHeader:v}=n,b=Ue({justify:f,row:0,col:a,colSpan:h}),y=l===u?o:"";return e("div",{"data-col":u,className:i("i-datagrid-cell",{"i-datagrid-has-sorter":g,"i-datagrid-cell-fixed":m}),style:{...b,insetBlockStart:0},onClick:e=>d?.(n,e),children:[v?.(n,a)??t("div",{className:i("i-datagrid-cell-content",{"i-datagrid-cell-content-ellipsis":s}),children:p||u}),g&&t(nt,{type:y}),r&&t(et,{index:a,onWidthChange:c})]},a)}))})}const rt=n=>{const{data:a=[],columns:r=[],border:s,striped:l,header:o=!0,resizable:c,cellPadding:d=".5em",cellEllipsis:m,empty:h=t(Xe,{}),loading:g,height:v="unset",style:y,className:N,renderLoading:k=()=>t(be,{size:"1.5em",className:"color-3"}),onCellClick:C,onRowClick:w,onHeaderClick:x,onSort:$,onScroll:T,onResize:I}=n,P=b(null),z=b(null),O=ae({rows:a,widths:r.map((e=>e.width??"auto")),sortBy:"",sortType:""}),D=f((()=>{const{widths:e}=O,t={...y,"--grid-template-columns":e.map((e=>"number"==typeof e?`${e}px`:e)).join(" ")};if(!c)return t;const n=r.map(((t,n)=>{const{fixed:i}=t;return i?e[n]:0}));return r.map(((e,i)=>{const{fixed:a}=e;if(a)if(0===i)t["--datagrid-cell-inset-0"]=0;else if(i===n.length-1)t["--datagrid-cell-inset-"+(n.length-1)]="auto 0";else{const e="left"===a,r=(e?n.slice(0,i):n.slice(i+1)).reduce(((e,t)=>e+t))+"px",s=e?`${r} auto`:`auto ${r}`;t[`--datagrid-cell-inset-${i}`]=s}})),t}),[O.widths,c]),M=p(((e,t)=>{if(!c)return;const[...n]=O.widths;n[e]=t,O.widths=n,I?.(r[e],t)}),[c]),S=p(((e,t)=>{if(e?.sorter){const[t,n]=function(e,t,n){const i=["desc","asc"];if(e===n){const e=i.findIndex((e=>e===t))+1,a=i[e]||"";return[""===a?"":n,a]}return[n,"desc"]}(O.sortBy,O.sortType,e.id);Object.assign(O,{sortBy:t,sortType:n}),$?.(t,n)}x?.(e,t)}),[]),j=f((()=>{const{sortBy:e,sortType:t}=O;if(e&&!$){const n=r.find((t=>t.id===e))?.sorter,i="function"==typeof n?n:(t,n)=>n[e]-t[e],s=[...a].sort(i);return"desc"===t?s:s.reverse()}return a}),[a,r,O.sortBy,O.sortType]);u((()=>{if(!P.current)return;const{current:e}=P,t=e.querySelector(".i-datagrid-row")?.children;t?.length&&(O.widths=Array.from(t).map((e=>e.offsetWidth)))}),[r,c]),u((()=>{g&&z.current?.scrollTop(0)}),[g]);const E={"--cell-padding":d,...D};return e(de,{ref:z,autoHide:!0,autoHeight:!0,autoHeightMax:v,style:E,className:i("i-datagrid-container",N,{"i-datagrid-bordered":s,"i-datagrid-striped":l}),renderView:e=>t("div",{...e,className:i({"i-datagrid-loading":g})}),onScroll:T,children:[e("div",{ref:P,className:"i-datagrid",children:[o&&t(at,{columns:r,resizable:c,sortType:O.sortType,sortBy:O.sortBy,cellEllipsis:m,onWidthChange:M,onHeaderClick:S}),j.map(((e,n)=>t(it,{row:n+(o?1:0),data:e,cellEllipsis:m,columns:r,onCellClick:C,onRowClick:w},n))),j.length<1&&h]}),g&&k()]})};function st(n){const{label:a,className:r,labelInline:s,style:l,children:o,status:c,tip:d,required:u}=n;return e("label",{className:i("i-input-label",r,{"i-input-inline":s}),style:l,children:[a&&e("span",{className:"i-input-label-text",children:[u&&t("span",{className:"error",children:"*"}),a]}),o,d&&t("span",{className:i("i-input-message",{[`i-input-${c}`]:"normal"!==c}),children:d})]})}const lt=c(((n,a)=>{const{type:r="text",label:s,name:l,value:o=n.initValue??"",initValue:c="",prepend:d,append:m,labelInline:h,className:g,status:v="normal",message:b,tip:y,clear:N,hideVisible:k,border:C,required:w,onChange:x,onEnter:$,style:T,...I}=n,P=ae({value:o,type:r,visible:!1}),D=p((e=>{const t=e.target.value;P.value=t,x?.(t,e)}),[]),M=re((e=>{"Enter"===e.code&&$?.()})),S=f((()=>{if("password"===r)return P.visible?t(z,{}):t(O,{})}),[P.visible]);u((()=>{P.value=o}),[o]);const j={ref:a,type:P.type,name:l,value:P.value,className:i("i-input",`i-input-${r}`),onChange:D,onKeyDown:M,...I},E=N&&P.value,B="password"===r&&!!P.value;return t(st,{label:s,labelInline:h,className:g,style:T,tip:b??y,status:v,required:w,children:e("div",{className:i("i-input-item",{[`i-input-${v}`]:"normal"!==v,"i-input-borderless":!C}),children:[d&&t("div",{className:"i-input-prepend",children:d}),t("input",{...j}),t(He,{active:!!E||B,icon:S,onClick:()=>{if("password"===r&&!k)return void Object.assign(P,{visible:!P.visible,type:P.visible?"password":"text"});x?.("")}}),m&&t("div",{className:"i-input-append",children:m})]})})})),ot=c(((n,a)=>{const{label:r,name:s,value:l=n.initValue??"",initValue:o,labelInline:c,step:d=1,min:m=-1/0,max:h=1/0,thousand:g,precision:f,type:v,className:b,status:y="normal",append:N,border:k,prepend:C,message:w,tip:x,hideControl:$,style:P,onChange:z,onEnter:O,onInput:D,onBlur:M,...S}=n,j=ae({value:l}),E=p((e=>We(e,m,h)),[m,h]),B=p((e=>Be(e,{precision:f,thousand:g})),[f,g]),L=p((e=>e?"number"!=typeof e&&g?e.replaceAll(g,""):e:""),[g]),Y=re((e=>{const{value:t}=e.target,n=L(t.replace(/[^\d\.-]/g,""));j.value=n,z?.(+n,e)})),A=re((e=>{const t=L(j.value)??0,n=E(+t+e);j.value=B(n),z?.(n)}));u((()=>{j.value=l}),[l]);const V={ref:a,name:s,value:j.value,className:"i-input i-input-number",onChange:Y,...S};return t(st,{label:r,labelInline:c,className:b,style:P,tip:w??x,status:y,children:e("div",{className:i("i-input-item",{[`i-input-${y}`]:"normal"!==y,"i-input-borderless":!k}),children:[C&&t("div",{className:"i-input-prepend",children:C}),!$&&t(He,{active:!0,icon:t(T,{}),onClick:()=>A(-d)}),t("input",{...V}),!$&&t(He,{active:!0,icon:t(I,{}),onClick:()=>A(d)}),N&&t("div",{className:"i-input-append",children:N})]})})})),ct=c(((e,n)=>{const{label:a,name:r,value:s=e.initValue??"",initValue:l,labelInline:o,className:c,status:d="normal",message:m,tip:h,autoSize:g,border:f,style:v,onChange:y,onEnter:N,...k}=e,C=ae({value:s}),w=b(null),x=p((e=>{const t=e.target.value;C.value=t;const n=w.current?.firstChild;g&&n&&(n.style.height=`${n.scrollHeight}px`),y?.(t,e)}),[]),$=re((e=>{"Enter"===e.code&&N?.()}));u((()=>{C.value=s}),[s]);const T={ref:n,name:r,value:C.value,className:"i-input i-textarea",onChange:x,onKeyDown:$,...k};return t(st,{label:a,labelInline:o,className:c,style:v,tip:m??h,status:d,children:t("div",{ref:w,className:i("i-input-item",{[`i-input-${d}`]:"normal"!==d,"i-input-borderless":!f}),children:t("textarea",{...T})})})}));lt.Textarea=ct,lt.Number=ot,lt.Range=n=>{const{label:a,name:r,value:s=n.initValue??"",initValue:l,labelInline:o,min:c=-1/0,max:d=1/0,type:m,className:h,status:g="normal",message:f,tip:v,append:b,prepend:y,step:N=1,thousand:k,precision:C,hideControl:w,placeholder:x,border:$,onChange:P,onBlur:z,style:O,...M}=n,S=ae({value:s}),j=p((e=>We(e,c,d)),[c,d]),E=p((e=>Be(e,{precision:C,thousand:k})),[C,k]),B=p((e=>e?"number"!=typeof e&&k?e.replaceAll(k,""):e:""),[k]),L=re(((e,t)=>{const{value:n}=e.target,i=B(n.replace(/[^\d\.-]/g,"")),a=Array.isArray(S.value)?S.value:[];a[t]=+i,S.value=a,P?.(a,e)})),Y=re(((e,t,n)=>{e.preventDefault(),e.stopPropagation();const i=Array.isArray(S.value)?S.value:[],a=B(i[n])??0,r=j(+a+t);i[n]=E(r),S.value=i,P?.(i,e)})),A=re((e=>{e.preventDefault(),e.stopPropagation();const t=S.value??[],n=t[0];t[0]=t[1],t[1]=n,S.value=t,P?.(t)}));u((()=>{S.value=s}),[s]);const V={name:r,className:"i-input i-input-number",...M};return t(st,{label:a,labelInline:o,className:h,style:O,tip:f??v,status:g,children:e("div",{className:i("i-input-item",{[`i-input-${g}`]:"normal"!==g,"i-input-borderless":!$}),children:[y&&t("div",{className:"i-input-prepend",children:y}),!w&&t(He,{active:!0,icon:t(T,{}),onClick:e=>Y(e,-N,0)}),t("input",{value:S.value?.[0]||"",placeholder:x?.[0],...V,onChange:e=>L(e,0)}),!w&&t(He,{active:!0,icon:t(I,{}),onClick:e=>Y(e,N,0)}),t(He,{active:!0,icon:t(D,{}),style:{margin:0},onClick:A}),!w&&t(He,{active:!0,icon:t(T,{}),onClick:e=>Y(e,-N,1)}),t("input",{value:S.value?.[1]||"",placeholder:x?.[1],...V,onChange:e=>L(e,1)}),!w&&t(He,{active:!0,icon:t(I,{}),onClick:e=>Y(e,N,1)}),b&&t("div",{className:"i-input-append",children:b})]})})};const dt=c(((n,a)=>{const{getContainer:r=e=>e?.offsetParent??document.body,trigger:s,arrow:l,arrowProps:o={},className:c,children:d,...u}=n,p=f((()=>{let{left:e,top:t,pos:n}=o,i="";switch(n){case"left":e+=2,i="translate(-100%, -50%) rotate(180deg)";break;case"right":e-=2,i="translate(0, -50%)";break;case"top":t-=2,i="translate(-50%, -50%) rotate(-90deg)";break;case"bottom":t+=2,i="translate(-50%, -50%) rotate(90deg)"}return{left:e,top:t,transform:i}}),[o]),m=e("div",{ref:a,className:i("i-popup",c),...u,children:[l&&t("svg",{xmlns:"http://www.w3.org/2000/svg",className:"i-popup-arrow",style:p,children:t("path",{d:"M0.5 0L1.5 0C1.5 4, 3 5.5, 5 7.5S8,10 8,12S7 14.5, 5 16.5S1.5,20 1.5,24L0.5 24L0.5 0z"})}),d]});return me(m,r(s))}));function ut(i){const{visible:a=!1,content:r,trigger:s="hover",gap:l=12,offset:o=8,fixed:c,position:d="top",showDelay:p=16,hideDelay:g=12,touchable:N,arrow:k=!0,align:C,fitSize:w,watchResize:x,clickOutside:$=!0,disabled:T,referToWindow:I,style:P,className:z,getContainer:O,children:D,onVisibleChange:M}=i,S=b(null),j=b(null),E=ae({show:!1,toggling:!1,style:{position:c?"fixed":"absolute"},arrowProps:{}});se((e=>{if(!$)return;const t=e.target,n=S.current?.contains(t);E.show&&(!n||"contextmenu"===s)&&Y(!1)}),j);const B=()=>{T||E.show&&("hover"!==s||"hover"===s&&!N)||(E.show=!0,E.toggling&&clearTimeout(E.toggling),E.toggling=setTimeout((()=>{const[e,t,{arrowX:n,arrowY:i,arrowPos:a}]=Me(S.current,j.current,{position:d,gap:l,offset:o,align:C,refWindow:I});E.style={...E.style,opacity:1,transform:"none",left:e,top:t},E.arrowProps={left:n,top:i,pos:a},E.toggling&&clearTimeout(E.toggling),M?.(!0)}),p))},L=()=>{E.show&&(E.toggling=setTimeout((()=>{E.style={...E.style,opacity:0,transform:"translate(0, 2px)"},setTimeout((()=>{E.show=!1,E.toggling&&clearTimeout(E.toggling),M?.(!1)}),160)}),g))},Y=e=>{void 0===e?E.show?L():B():e?B():L()},A=le((()=>({click:{onClick:()=>Y(!0)},hover:{onMouseEnter:()=>Y(!0),onMouseLeave:()=>Y(!1)},focus:{onFocus:()=>Y(!0),onBlur:()=>Y(!1)},contextmenu:{onContextMenu:e=>{if(e.preventDefault(),e.stopPropagation(),E.show){const[t,n]=Se(e,j.current);E.style={...E.style,left:t,top:n}}else E.show=!0,E.toggling=setTimeout((()=>{const[t,n]=Se(e,j.current);E.style={...E.style,opacity:1,transform:"none",left:t,top:n},E.toggling&&clearTimeout(E.toggling),M?.(!0)}),p)}},none:{}})),[]),V=f((()=>{if(!N)return{};const e={};return"hover"===s&&(e.onMouseEnter=()=>Y(!0),e.onMouseLeave=()=>Y(!1)),e}),[N,s]),W=()=>{if(!E.show)return;const[e,t,{arrowX:n,arrowY:i,arrowPos:a}]=Me(S.current,j.current,{position:d,gap:l,offset:o,align:C,refWindow:I});Object.assign(E,{style:{...E.style,left:e,top:t},arrowProps:{left:n,top:i,pos:a}})};return u((()=>{if("contextmenu"===s)return;const{observe:e,unobserve:t,disconnect:n}=function(){const e=new WeakMap,t=new ResizeObserver((t=>{t.map((t=>{const n=e.get(t.target);n?.(t.target)}))}));return{observe:function(n,i){e.get(n)||(n&&t.observe(n),e.set(n,i))},unobserve:function(n){n&&t.unobserve(n),e.delete(n)},disconnect:function(){t.disconnect()}}}();return S.current&&e(S.current,W),x&&j.current?(e(j.current,W),()=>{x&&j.current&&(t(j.current),S.current&&t(S.current),n())}):void 0}),[x,j.current,S.current]),y((()=>{if(!w||!E.show)return;const e=["top","bottom"].includes(d),t=S.current?.[e?"offsetWidth":"offsetHeight"];E.style={...E.style,[e?"width":"height"]:t}}),[E.show,w]),y((()=>{Y(a)}),[a]),e(n,{children:[v.map(D,(e=>{if(!m(e))return;const{type:t,props:n}=e;if("function"==typeof t)return e;const{className:i,...a}=n;return h(e,{ref:S,className:i,...A[s],...a})})),E.show&&t(dt,{ref:j,arrow:k&&"contextmenu"!==s,style:{...P,...E.style},arrowProps:E.arrowProps,className:z,...V,trigger:S.current,getContainer:O,children:r})]})}const pt=a=>{const{value:r,month:s,weeks:l=["一","二","三","四","五","六","日"],renderDate:o=e=>e.date(),disabledDate:c,onDateClick:d}=a,u=ue(),p=f((()=>{const e=[],t=s.add(-1,"month").endOf("month");let{$W:n,$D:i}=t;if(0!==n){const i=Array.from({length:n}).map(((e,i)=>t.add(i+1-n,"day")));e.push(...i)}const a=s.endOf("month");return i=a.$D,n=a.$W,e.push(...Array.from({length:i}).map(((e,t)=>a.add(t+1-i,"day")))),0!==n&&e.push(...Array.from({length:7-n}).map(((e,t)=>a.add(t+1,"day")))),e}),[s]),m=re((e=>{c?.(e)||d?.(e)}));return e(n,{children:[t("div",{className:"i-datepicker-weeks",children:l.map(((e,n)=>t("span",{className:"i-datepicker-week",children:e},n)))}),t("div",{className:"i-datepicker-dates",children:p.map(((e,n)=>{const a=e.isSame(r,"day"),l=e.isSame(s,"month"),d=e.isSame(u,"day"),p=c?.(e);return t("div",{className:i("i-datepicker-item",{"i-datepicker-active":a,"i-datepicker-same-month":l,"i-datepicker-today":d,"i-datepicker-disabled":p}),onClick:()=>m(e),children:o(e)},n)}))})]})},mt=[1,2,3,4,5,6,7,8,9,10,11,12],ht=n=>{const{value:i,unitMonth:a="月",unitYear:r="年",renderYear:s,renderMonth:l,onClick:o}=n;return e("a",{className:"i-datepicker-action","data-ripple":!0,onClick:o,children:[t("span",{children:s?.(i.year())}),r,t("span",{children:l?.(i.month()+1)}),a]})},gt=n=>{const{value:a,unitYear:r,unitMonth:l,renderDate:o,renderMonth:c=e=>e,renderYear:d=e=>e,disabledDate:m,onDateClick:h}=n,g=ae({today:a,month:a||ue(),selectedYear:ue(),years:[],selectable:!1}),f=b(null),v=p((e=>{g.month=g.month[e?"add":"subtract"](1,"month")}),[]),y=s({interval:100},(e=>{const t=e.deltaY<0;g.years=g.years.map((e=>e+(t?-1:1)))}));return u((()=>{if(!g.selectable)return;g.selectedYear=g.month;const e=g.selectedYear.year(),t=Array.from({length:7}).map(((t,n)=>e-3+n));g.years=[...t]}),[g.selectable]),u((()=>{g.today=a,g.month=a||ue()}),[a]),e("div",{className:"i-datepicker",children:[e("div",{className:"i-datepicker-units",children:[t(ht,{value:g.month,unitYear:r,unitMonth:l,renderMonth:c,renderYear:d,onClick:()=>g.selectable=!0}),t("a",{className:"ml-auto i-datepicker-action","data-ripple":!0,onClick:()=>v(!1),children:t(ke,{icon:t(M,{})})}),t("a",{className:"i-datepicker-action","data-ripple":!0,onClick:()=>v(!0),children:t(ke,{icon:t(S,{})})})]}),e("div",{className:i("i-datepicker-ym",{"i-datepicker-active":g.selectable}),children:[t(He,{active:!0,className:"i-datepicker-close",onClick:()=>g.selectable=!1}),t("div",{ref:f,className:"i-datepicker-years",onWheel:y,children:g.years.map((e=>t("a",{className:i("i-datepicker-year",{"i-datepicker-active":e===g.selectedYear.year()}),onClick:()=>g.selectedYear=g.selectedYear.year(e),children:d(e)},e)))}),t("div",{className:"i-datepicker-months",children:mt.map((e=>t("a",{className:i("i-datepicker-month",{"i-datepicker-active":e===g.month.month()+1}),onClick:()=>{return t=e,g.month=g.month.year(g.selectedYear.year()).month(t-1),void(g.selectable=!1);var t},children:c(e)},e)))})]}),t(pt,{value:g.today,month:g.month,disabledDate:m,onDateClick:e=>{e.isSame(g.today,"day")||(e.isSame(g.month,"month")||(g.month=e),g.today=e,h?.(e))},renderDate:o})]})};ue.extend(pe);const ft=["YYYY-MM-DD","YYYY-M-D","YYYY/MM/DD","YYYY/M/D"],vt=e=>{const{name:n,value:i,weeks:a,format:r="YYYY-MM-DD",renderDate:s,renderMonth:l,renderYear:o,popupProps:c,disabledDate:d,onDateClick:p,onChange:m,onBlur:h,...v}=e,b=ae({value:i}),[y,N]=g(!1),k=f((()=>{if(!b.value)return null;const e=ue(b.value,r,!0);return e.isValid()?e:null}),[b.value]),C=e=>{b.value=e,m?.(e)},w=()=>{if(!b.value)return;const e=ue(b.value,ft,!0);e.isValid()?C(e.format(r)):C("")};return u((()=>{b.value=i}),[i]),t(ut,{visible:y,trigger:"click",position:"bottom",arrow:!1,align:"start",content:t(gt,{value:k,weeks:a,renderDate:s,renderMonth:l,renderYear:o,disabledDate:d,onDateClick:e=>{C(e.format(r))}}),...c,watchResize:!0,onVisibleChange:N,children:t(lt,{value:b.value,append:t(ke,{icon:t(j,{}),className:"i-datepicker-icon",size:"1em"}),onChange:C,onBlur:e=>{h?.(e),w()},onEnter:w,...v})})},bt=n=>{const{data:a,colon:r,columns:s=1,gap:l=".5em",align:o,labelWidth:c,labelAlign:d,vertical:u,equally:p,style:m,className:h}=n;return t("div",{className:i("i-description",h),style:{"--description-label-width":c,gridTemplateColumns:`repeat(${s}, ${p?"1fr":"auto"})`,gap:l,textAlign:o,...m},children:a.map(((n,a)=>{const{label:s,value:l,style:o,hidden:c,rowSpan:p=1,colSpan:m=1}=n;return c?t(N,{},a):e("div",{className:i("i-description-item",{"i-description-item-vertical":u}),style:{gridColumn:`span ${m}`,gridRow:`span ${p}`,...o},children:[s&&e("div",{className:"i-description-label",style:{textAlign:d},children:[s,r]}),t("div",{className:"i-description-value",children:l})]},a)}))})};function yt(n){const{visible:a,position:r="left",header:s,footer:l,backdropClosable:o=!0,hideCloseButton:c,className:d,children:m,onVisibleChange:h,onClose:f,...v}=n,[y,N]=g(a),[k,C]=g(a),w=b(!0);u((()=>{a?x():$()}),[a]);const x=p((()=>{w.current&&(N(!0),h?.(!0),w.current=!1,setTimeout((()=>{C(!0),w.current=!0}),24))}),[]),$=p((()=>{w.current&&(w.current=!1,C(!1),setTimeout((()=>{N(!1),h?.(!1),w.current=!0,f?.()}),240))}),[]),T=p((function(){o&&$()}),[]);return me(y&&t("div",{className:i("i-backdrop-drawer",d,{"i-active":k}),onClick:T,...v,children:e("div",{className:i("i-drawer",`i-drawer-${r}`),onClick:e=>e.stopPropagation(),children:[e("header",{className:"i-drawer-header",children:[s,t(He,{active:!c,className:"i-drawer-close",onClick:$})]}),t("div",{className:"i-drawer-content",children:m}),t("div",{className:"i-drawer-footer",children:l})]})}),document.body)}const Nt=c(((n,a)=>{const{active:r,type:s,align:l,disabled:o,label:c,style:d,className:u,children:p,...m}=n;return e("li",{ref:a,className:i("i-list-item",u,{"i-list-item-active":r,"i-list-option":"option"===s,disabled:o}),style:{alignItems:l,...d},...m,children:[void 0!==c&&t("span",{className:"i-list-item-label",children:c}),p]})})),kt=e=>{const{label:n,type:a,className:r,children:s,...l}=e;return t("ul",{className:i("i-list",r),...l,children:v.map(s,((e,t)=>{const i="function"==typeof n?n(t):n;return h(e,{label:i,...e.props,type:a})}))})};kt.Virtual=e=>{const{data:n,itemKey:i,renderItem:a,...r}=e;return t(he,{data:n,itemKey:i,...r,children:(e,t)=>a?.(e,t)})},kt.Item=Nt;const{Item:Ct}=kt,wt=e=>{const{width:n,content:i,children:a,...r}=e;return t(ut,{trigger:"click",position:"bottom",touchable:!0,content:t(kt,{className:"i-dropdown-content",style:{minWidth:n},children:i}),...r,children:a})};wt.Item=e=>{const{more:n,moreProps:i,...a}=e,r=t(Ct,{...a});return n?t(ut,{position:"right",touchable:!0,arrow:!1,align:"start",offset:10,hideDelay:240,...i,content:t(kt,{className:"i-dropdown-content",onClick:e=>e.stopPropagation(),children:n}),children:r}):r};const xt=e=>{const{as:n="div",align:a,justify:r,direction:s,wrap:l,gap:o,columns:c,className:d,style:u,...p}=e,m=f((()=>{if(c)return"number"==typeof c?`repeat(${c}, 1fr)`:c}),[c]);return t(n,{...p,style:{alignItems:a,justifyContent:r,gap:o,flexDirection:s,flexWrap:!0===l?"wrap":l,gridTemplateColumns:m,...u},className:i(d,{[c?"grid":"flex"]:!0})})},$t=k({});class Tt{id;data={};rules={};constructor(){this.id=r(8),this.data={}}get(e){return e?this.data[e]:this.data}set(e,t){const n=this.id;if(this.data)return"string"==typeof e?(this.data[e]=t,void ge.publish(`${n}:set:${e}`,t)):void Object.keys(e).map((t=>{this.data[t]=e[t],ge.publish(`${n}:set:${t}`,e[t])}))}clear(){this.data&&Object.keys(this.data).map((e=>{ge.publish(`${this.id}:set:${e}`,void 0),this.data[e]=void 0}))}async validate(e){const{id:t,rules:n,data:i}=this;if(!n)return i;if(e){const a=n[e],r={validator:e=>Array.isArray(e)?e.length>0:![void 0,null,""].includes(e),message:void 0};"function"==typeof a?r.validator=a:!0===a?r.message="required":Object.assign(r,a);const s=r.validator?.(i[e],this);return s?(ge.publish(`${t}:invalid:${name}`,{message:null,status:"normal"}),!0):(ge.publish(`${t}:invalid:${e}`,{message:r.message,status:"error"}),!1)}let a=!0;return Object.keys(i).map((e=>{const r=n[e];if(void 0===r)return;const s={validator:e=>Array.isArray(e)?e.length>0:!!e,message:void 0};"function"==typeof r?s.validator=r:!0===r?s.message="required":Object.assign(s,r);const l=s.validator?.(i[e],this);l?ge.publish(`${t}:invalid:${e}`,{message:null,status:"normal"}):(ge.publish(`${t}:invalid:${e}`,{message:s.message,status:"error"}),a=!1)})),!!a&&i}}const It=e=>{const{form:n={},rules:a={},initialValues:r={},style:s,className:l,width:o,children:c,...d}=e;return u((()=>{Object.assign(n,{data:{...r},rules:{...a}})}),[n,a]),t($t.Provider,{value:n,children:t("form",{style:{...s,width:o},className:i("i-form",l),...d,children:c})})};function Pt(i){const{title:a,footer:r,hideCloseButton:s,footerLeft:l,okButtonProps:o={children:"确定",onClick:i.onOk},cancelButtonProps:c={secondary:!0,children:"关闭",onClick:i.onClose},children:d,onClose:u}=i,p=a||!s,m=f((()=>{if(r||null===r)return r;const i=Object.assign({},o),a=Object.assign({},c);return e(n,{children:[l,t(Ne,{...i}),t(Ne,{...a})]})}),[r,o,c]);return e(n,{children:[p&&e("header",{className:"i-modal-header",children:[a&&t("b",{children:a}),t(He,{active:!s,className:"i-modal-close",onClick:u})]}),t("div",{className:"i-modal-content",children:d}),t("footer",{className:"i-modal-footer",children:m})]})}function zt(n){const{visible:a,title:r,footer:s,okButtonProps:l,cancelButtonProps:o,closable:c=!0,hideBackdrop:d,backdropClosable:m=!0,hideCloseButton:h,width:f,height:v,customized:y,fixed:N,shadow:k=!0,children:C,style:w,className:x,footerLeft:$,onVisibleChange:T,onClose:I,onOk:P,...z}=n,[O,D]=g(a),[M,S]=g(!1),[j,E]=g(!1),B=b(!0),L=p((()=>{B.current&&(D(!0),B.current=!1,setTimeout((()=>{S(!0),T?.(!0),B.current=!0}),24))}),[]),Y=p((()=>{if(B.current){if(B.current=!1,!c)return E(!0),void setTimeout((()=>{E(!1),B.current=!0}),400);S(!1),setTimeout((()=>{D(!1),B.current=!0,T?.(!1),I?.()}),240)}}),[c]),A=p((function(){m&&Y()}),[c,m]);return u((()=>{a?L():Y()}),[a]),O?me(t("div",{className:i("i-modal-container",{"i-modal-backdrop":!d,"i-modal-customized":y,"i-modal-active":M,fixed:N},x),style:w,onClick:A,children:e("div",{className:i("i-modal",{bounced:j,shadow:k}),style:{width:f,height:v},onClick:e=>e.stopPropagation(),...z,children:[y&&C,!y&&t(Pt,{title:r,hideCloseButton:h,footer:s,okButtonProps:l,cancelButtonProps:o,children:C,footerLeft:$,onOk:P,onClose:Y})]})}),document.body):null}It.useForm=function(e){const t=b();return t.current||(t.current=e??new Tt),t.current},It.Field=function(e){const{name:t,required:n,children:i}=e,a=ae({value:void 0,status:"normal",message:void 0,update:0}),r=C($t),{id:s}=r,l=p((e=>{t&&r.set(t,e)}),[t]),o=f((()=>v.map(i,(e=>{if(!m(e))return null;const{onChange:t}=e.props,{value:i,status:r,message:s}=a;return h(e,{value:i,status:r,message:s,required:n,onChange:(...e)=>{l(e[0]),t?.(...e),Object.assign(a,{status:"normal",message:void 0})}})}))),[i,a.update]);return u((()=>{if(t)return ge.subscribe(`${s}:set:${t}`,((e,t)=>{a.value=t,a.update+=1})),ge.subscribe(`${s}:invalid:${t}`,((e,t)=>{Object.assign(a,t),a.update+=1})),setTimeout((()=>{r.data[t]=r.data[t]??void 0}),0),()=>{ge.unsubscribe(`${s}:set:${t}`),ge.unsubscribe(`${s}:invalid:${t}`)}}),[t]),t?o:i};const Ot=c(((e,n)=>{const i=ae({});return w(n,(()=>({update:(e={})=>{Object.assign(i,e)}}))),t(zt,{...e,...i})})),Dt=e=>{const{as:n="span",size:a,weight:r,decoration:s,gradient:l,style:o,className:c,children:d}=e,u=f((()=>l&&Array.isArray(l)?{background:`-webkit-linear-gradient(${l.join(",")})`,backgroundClip:"text"}:{}),[l]);return t(n,{style:{fontSize:a,fontWeight:r,textDecoration:s,...u,...o},className:i(c,{"i-text-gradient":l}),children:d})};function Mt(n){const{value:i,height:a=40,size:r=8}=n;return e("div",{className:"i-progress-circle",children:[e("svg",{width:a,height:a,children:[t("circle",{cx:a/2,cy:a/2,r:a/2-r/2,fill:"none",stroke:"var(--background-opacity-2)",strokeWidth:r}),t("circle",{cx:a/2,cy:a/2,r:a/2-r/2,fill:"none",stroke:"var(--color-main)",strokeWidth:r,strokeDasharray:100,pathLength:100,className:"i-progress-circle-path",strokeLinecap:"round",style:{strokeDashoffset:`calc(100 - ${i})`}})]}),e("span",{className:"i-progress-circle-value",children:[t("span",{children:i}),t(Dt,{size:".81em",className:"color-7",children:"%"})]})]})}Dt.Number=function(e){const{count:n,to:i,decimal:a,thousand:r=",",duration:s=2400,easing:l,...o}=e,[c,d]=g(n),p=f((()=>{if(void 0===c)return;const e=c.toFixed(a);return r?Be(c,{precision:a,thousand:r}):e}),[c,r]);return u((()=>{void 0!==n&&void 0!==i&&function(e,t,n=1e3,i,a=e=>1-Math.pow(1-e,4)){const r=performance.now(),s=t-e;let l=requestAnimationFrame((function e(){l=requestAnimationFrame(e);let t=(performance.now()-r)/n;t>=1&&(t=1,cancelAnimationFrame(l));const o=s*a(t);i?.(o)}))}(n,i,s,(e=>d(n+e)),l)}),[i]),u((()=>d(n)),[n]),t(Dt,{...o,children:p})},Dt.Time=function(e){const{seconds:n,zero:i,units:a,...r}=e,s=f((()=>void 0===n?"":function(e,t){const n=[],{zero:i=!0,units:a=["",":",":"]}=t||{},r=a.length;let s=0;for(;s<r&&!(e<=0&&s>1);){const t=Math.round(e%60);e=Math.floor(e/60),n.unshift((i&&t<10?`0${t}`:t)+a[s++])}return n.join("")}(n,{zero:i,units:a})),[n]);return t(Dt,{...r,children:s})};const St=c(((e,n)=>{const{value:a,size:r,barClass:s,dragging:l,renderCursor:o,onMouseDown:c}=e;return t("div",{ref:n,className:"i-progress",style:{height:r},onMouseDown:c,children:t("div",{className:i("i-progress-bar",s,{"no-transition":l}),style:{width:`${a}%`},children:o&&t("a",{className:"i-progress-cursor",children:o(a??0)})})})})),jt=n=>{const{value:a=0,size:r=8,height:s=40,precision:l=0,style:o,draggable:c=!0,type:d="line",barClass:p,label:m,labelInline:h,className:g,renderCursor:v,onChange:y}=n,N=b(null),k=ae({value:a,dragging:!1,width:0,start:0}),C=f((()=>{let e=+k.value.toFixed(l);return e=Math.min(100,e),e=Math.max(0,e),e}),[k.value,l]),w=re((e=>{if(!N.current||!c)return;const t=N.current.getBoundingClientRect(),n=100*(e.pageX-t.left)/t.width;Object.assign(k,{value:n,width:t.width,start:t.left,dragging:!0})})),x=re((e=>{if(!k.dragging||!c)return;e.preventDefault();const{start:t,width:n}=k,i=e.pageX-t;i<0||i>n||(k.value=100*(e.pageX-t)/n)})),$=re((()=>{k.dragging&&c&&(y?.(C),k.dragging=!1)}));return _e(x),Je($),u((()=>{k.value=a>100?100:a<0?0:a}),[a]),e("div",{className:i("i-input-label",g,{"i-input-inline":h}),style:o,children:[m&&t("span",{className:"i-input-label-text",children:m}),"line"===d&&t(St,{ref:N,size:r,barClass:p,dragging:k.dragging,value:k.value,renderCursor:v,onMouseDown:w}),"circle"===d&&t(Mt,{value:k.value,height:s,size:r})]})},Et=c(((n,a)=>{const{style:r,hideControls:s,autoplay:l,muted:o,volume:c=50,height:d,width:p,useOriginControls:m,timeProgressProps:h={barClass:"bg-2"},volumeProgressProps:g={barClass:"bg-1"},className:f,onFullScreenChange:v,...y}=n,N=ae({playing:l,volume:o?0:c,volumeCache:0,muted:o,current:0,duration:0,isFullscreen:!1}),k=b(null),C=e=>{const t=e.target;t.paused||Object.assign(N,{current:t.currentTime})},x=e=>{N.playing=!e.target.paused},$=()=>{const e=k.current?.parentElement;e&&(N.isFullscreen=document.fullscreenElement===e)},T=e=>{const t=e.target;Object.assign(N,{volume:100*t.volume,muted:0===t.volume})},I=()=>{const e=k.current;e&&(e.paused?e.play():e.pause())},P=()=>{const e=k.current;e&&(e.currentTime=0,e.pause())},z=()=>{const e=k.current?.parentElement;var t;e&&(N.isFullscreen?document.exitFullscreen?.():(t=e,t.requestFullscreen?.()),v?.(!N.isFullscreen))};return w(a,(()=>({play:()=>{const e=k.current;e&&e.play()},pause:()=>{const e=k.current;e&&e.pause()},stop:P,fullscreen:z,getVideo:()=>k.current}))),u((()=>{const e=k.current;if(e)return e.addEventListener("timeupdate",C),e.addEventListener("play",x),e.addEventListener("pause",x),e.addEventListener("volumechange",T),document.addEventListener("fullscreenchange",$),()=>{e.removeEventListener("timeupdate",C),e.removeEventListener("play",x),e.removeEventListener("pause",x),e.removeEventListener("volumechange",T),document.removeEventListener("fullscreenchange",$)}}),[]),e("div",{className:i("i-video",f),style:{height:d,width:p,...r},onClick:I,onDoubleClick:()=>z(),children:[t("video",{ref:k,onCanPlay:e=>{const t=e.target;Object.assign(N,{duration:t.duration,current:t.currentTime}),t.volume=N.volume/100},...y,controls:m}),!s&&!m&&e("div",{className:"i-video-controls",onClick:e=>e.stopPropagation(),children:[e("div",{className:"i-video-control flex-1",children:[t(Ne.Toggle,{className:"i-video-btn",flat:!0,square:!0,after:t(ke,{icon:t(E,{})}),active:N.playing,onClick:I,children:t(ke,{icon:t(B,{})})}),t(Ne,{className:"i-video-btn",flat:!0,square:!0,onClick:P,children:t(ke,{icon:t(L,{})})}),e("span",{className:"i-video-times",children:[t(Dt.Time,{seconds:N.current})," /",t(Dt.Time,{seconds:N.duration})]}),t(jt,{className:"mr-8",...h,value:N.current/N.duration*100,onChange:e=>{const t=k.current;t&&(t.currentTime=N.duration*e/100)}})]}),t("div",{className:"i-video-control",children:t(Ne.Toggle,{className:"i-video-btn",flat:!0,square:!0,after:t(ke,{icon:t(Y,{})}),active:N.isFullscreen,onClick:()=>z(),children:t(ke,{icon:t(A,{})})})}),e("div",{className:"i-video-control",children:[t(Ne.Toggle,{className:"i-video-btn",flat:!0,square:!0,active:N.volume<=0,after:t(ke,{icon:t(V,{}),size:"1.2em"}),onClick:()=>{const e=k.current;if(e)return e.volume>0?(N.volumeCache=e.volume,void(e.volume=0)):void(e.volume=0===N.volumeCache?.5:N.volumeCache)},children:t(ke,{icon:t(W,{})})}),t(jt,{style:{width:100},className:"mr-8",...g,value:N.volume,onChange:e=>{const t=k.current;t&&(t.volume=e/100)}})]})]})]})}));function Bt(n){const{name:i,suffix:a,type:r}=n;switch(r){case De.IMAGE:return t("img",{src:n.src});case De.VIDEO:return t(Et,{...n});default:return e("div",{className:"i-preview-unknown",children:[t(ke,{icon:t(q,{}),size:"3em"}),t("h5",{className:"mt-4",children:i||a||"?"})]})}}function Lt(i){const{items:a=[],initial:r=0,renderFile:l=Bt,onRotate:o,onChange:c,onClose:d,onZoom:u}=i,p=ae({current:r,rotate:0,scale:1,translate:"0, 0"}),m=b(null),h=f((()=>a.map((e=>{const t={src:""};return"string"==typeof e?t.src=e:Object.assign(t,e),t.suffix=Ye(t.src)||"",t.type=Ae(t.suffix,e.type),t}))),[a]),{file:g,content:v}=f((()=>{const e=h[p.current];return{file:e,content:l(e)}}),[p.current,a]),y=g.type===De.IMAGE,N=e=>{const t=h.length,{current:n}=p;p.current=e>=t?0:e<0?t-1:e,c?.(p.current,n),p.rotate=h[p.current].rotate||0,1!==p.scale&&(p.scale=1,u?.(1)),o?.(p.rotate)},k=e=>{p.rotate+=e,o?.(p.rotate)},C=s({interval:60},(e=>{if(!y)return;let t=p.scale+(e.deltaY<0?.05:-.05);t>2&&(t=2),t<.25&&(t=.25),u?.(t),p.scale=t}));return e(n,{children:[t("div",{ref:m,className:"i-preview-content",style:{transform:`rotate(${p.rotate}deg) scale(${p.scale})`},onWheel:C,onClick:e=>e.stopPropagation(),children:v}),e("div",{className:"i-preview-controls",children:[t(Ne,{square:!0,flat:!0,onClick:d,children:t(ke,{icon:t($,{})})}),h.length>1&&e("span",{className:"px-8",children:[p.current+1," / ",h.length]}),1!==p.scale&&e(Ne,{flat:!0,onClick:()=>p.scale=1,children:[t(ke,{icon:t(F,{})}),e("span",{className:"mt-4",children:[(100*p.scale).toFixed(0),"%"]})]}),t(Ne,{square:!0,flat:!0,href:g.src,target:"_blank",children:t(ke,{icon:t(H,{})})}),t(Ne,{square:!0,flat:!0,href:g.src,download:!0,target:"_blank",children:t(ke,{icon:t(R,{})})}),t(Ne,{square:!0,flat:!0,onClick:()=>k(90),children:t(ke,{icon:t(X,{})})}),t(Ne,{square:!0,flat:!0,onClick:()=>k(-90),children:t(ke,{icon:t(U,{})})}),h.length>1&&e(n,{children:[t(Ne,{square:!0,flat:!0,onClick:()=>N(p.current-1),children:t(ke,{icon:t(M,{})})}),t(Ne,{square:!0,flat:!0,onClick:()=>N(p.current+1),children:t(ke,{icon:t(S,{})})})]})]})]})}function Yt(){const e=b(null);return n=>{const{items:i,modalProps:a,onClose:r,...s}=n,l=Le(t(Ot,{ref:e,visible:!0,className:"i-preview",customized:!0,shadow:!1,...a,children:t(Lt,{...s,items:i,onClose:()=>{e.current?.update({visible:!1})}}),fixed:!0,onClose:()=>{r?.(),l?.()}}))}}const At=a=>{const{src:r,round:s,size:l,initSize:o,lazyload:c,fallback:d=t(ke,{icon:t(G,{}),size:"2em",className:"color-5"}),fit:p,style:m,className:h,children:g,usePreview:f,onLoad:v,onError:y,onClick:N,...k}=a,C=ae({status:"loading"}),w=b(null),x=p?"100%":void 0,{observe:$,unobserve:T}=Qe(),I=Yt();u((()=>{if(r&&(C.status="loading",c&&w.current))return $(w.current,((e,t)=>{t&&(e.setAttribute("src",e.dataset.src||""),T(e))})),()=>{w.current&&T(w.current)}}),[r]),k[c?"data-src":"src"]=r;const P="loading"===C.status?o:void 0;return t("div",{style:{width:l??P,height:l??P,...m},className:i("i-image",h,{rounded:s,[`i-image-${C.status}`]:C.status}),children:"error"===C.status?d:e(n,{children:[r&&t("img",{ref:w,style:{objectFit:p,width:x,height:x},...k,onLoad:e=>{v?.(e),C.status=void 0},onError:e=>{y?.(e),C.status="error"},onClick:e=>{N?.(e),f&&r&&I({items:[{src:r,type:De.IMAGE}]})}}),r&&"loading"===C.status&&t(be,{}),g&&t("div",{className:"i-image-text",children:g})]})})};At.List=function(e){const{items:n=[],gap:i=8,columns:a,wrap:r,direction:s,usePreview:l,onClick:o,...c}=e,d=Yt(),u=f((()=>n.map((e=>{const t={src:""};return"string"==typeof e?t.src=e:Object.assign(t,e),t.suffix=Ye(t.src)||"",t.type=Ae(t.suffix,e.type),t}))),[n]);return u.length?t(xt,{className:"i-image-list",gap:i,columns:a,wrap:r,direction:s,children:u.map(((e,n)=>t(At,{src:e.src,size:60,usePreview:!1,onClick:e=>((e,t)=>{o?.(e),l&&d({items:u,initial:t})})(e,n),...c},n)))}):""};const Vt={left:"flex-start",center:"center",right:"flex-end"},Wt=12,qt={duration:3e3,closable:!0,active:!1},Ft=function(){const e=document.createElement("div");return e.dataset.id="messages",document.body.append(e),e}(),Ht={callout(e){},close(){}},Rt={left:[],center:[],right:[]},Xt={left:[],center:[],right:[]};ce(Ft).render(t((function(){const i=b(null),a=ae({items:{left:[],center:[],right:[]},tops:{left:[],center:[],right:[]}}),r={left:0,center:0,right:0};u((()=>{Object.assign(Ht,{callout:function(e){const{align:t="center",unshift:n,onShow:r}=e,s=Rt[t][n?"unshift":"push"](e);a.items[t]=[...Rt[t]],setTimeout((()=>{const e=i.current?.offsetHeight||0;Rt[t][n?0:s-1].active=!0,a.items[t]=[...Rt[t]],Xt[t][n?"unshift":"push"](e),a.tops[t]=[...Xt[t]],r?.()}),0),0!==e.duration&&setTimeout(this.close.bind(e),e.duration)},close:function(){const e=this,{align:t="center",onHide:n}=e,i=Rt[t].findIndex((t=>t.id===e.id));i<0||(Rt[t][i].active=!1,a.items[t]=[...Rt[t]],e.timer=setTimeout((()=>{const i=Rt[t].findIndex((t=>t.id===e.id));Rt[t].splice(i,1),Xt[t].splice(i,1),a.tops[t]=[...Xt[t]],a.items[t]=[...Rt[t]],e.timer&&clearTimeout(e.timer),n?.()}),240))}})}),[]);const s=(e,s)=>{if(!e)return t(n,{});const{id:l,active:o,content:c,align:d="center",className:u}=e;r[d]+=a.tops[d][s-1]||0;const p=Wt*s+r[d];return t(Ut,{ref:i,active:o,content:c,top:p,className:u,style:{alignSelf:Vt[d]},onClick:Ht.close.bind(e)},l)};return e("div",{className:"i-messages",children:[a.items.left.map(s),a.items.center.map(s),a.items.right.map(s)]})}),{}));const Ut=c((function({active:e,content:n,top:a,className:r,style:s,onClick:l},o){return t("div",{ref:o,className:i("i-message",r,{"i-message-active":e}),style:{...s,top:a},onClick:l,children:n})}));function Gt(e){return(["string","number"].includes(typeof e)||m(e))&&(e={content:e}),e=Object.assign({id:r(7)},qt,e),Ht.callout(e),Ht.close.bind(e)}zt.useModal=function(){const e=b(null);return{open:n=>{const i=Le(t(Ot,{ref:e,visible:!0,...n,onClose:()=>{n.onClose?.(),i?.()}}))},update:t=>{if(!e.current)return;const{update:n}=e.current;n(t)}}};const Kt=n=>{const{page:a,active:r,children:s,onChange:l}=n,[o,c]=g(!1);return e("a",{className:i("i-page",{"i-page-active":r,"i-page-loading":o,"i-page-disabled":!1}),"data-page":a,onClick:async()=>{r||o||(c(!0),await(l?.(a)),c(!1))},children:[o&&t(be,{}),s]})},Zt=a=>{const{page:r=1,size:s=10,total:l=0,sibling:o=2,prev:c=t(ke,{icon:t(M,{})}),next:d=t(ke,{icon:t(S,{})}),simple:p,jumper:m,className:h,renderEllipsis:v=()=>t(ke,{icon:t(K,{}),className:"color-7"}),renderPage:b=e=>e,onChange:y,...N}=a,[k,C]=g(r),[w,x]=g(!1),$=f((()=>Math.ceil(l/s)),[s,l]),[T,I,P]=f((()=>{const e=Math.max(1,k-o),t=Math.min($,k+o);return[e,t,Array.from({length:t-e+1}).map(((t,n)=>e+n))]}),[k,$,o]);if($<=k&&1===k)return t(n,{});const z=async e=>{if(y&&!w)return x(!0),new Promise((async t=>{void 0!==e&&(await y(e),C(e),x(!1),t())}))};return u((()=>C(r)),[r]),e("div",{className:i("i-pagination",h),...N,children:[c&&t(Kt,{page:k-1||1,onChange:z,children:c}),T>1&&t(Kt,{page:1,onChange:z,children:b(1)}),T>2&&v(),P.map((e=>t(Kt,{page:e,active:e===k,onChange:z,children:b(e)},e))),I<$-1&&v(),I<$&&t(Kt,{page:$,onChange:z,children:b($)}),d&&t(Kt,{page:k+1,onChange:z,children:d})]})},_t={children:"确定"},Jt={children:"取消",secondary:!0},Qt=n=>{const{trigger:i="click",visible:a,icon:r=t(ke,{icon:t(Z,{}),className:"error"}),content:s,okButtonProps:l,cancelButtonProps:o,children:c,align:d="end",position:u="top",offset:p=12,extra:m,onOk:h,onClose:g,...f}=n,v=ae({loading:!1,visible:a}),b=l?Object.assign({},_t,l):_t,y=o?Object.assign({},Jt,o):Jt,N=e("div",{className:"i-popconfirm",children:[e(xt,{gap:12,children:[r,t("div",{className:"i-popconfirm-content",children:s})]}),e(xt,{gap:12,justify:"flex-end",className:"mt-8 i-popconfirm-footer",children:[null!==o&&t(Ne,{...y,onClick:async e=>{y.onClick?.(e),await(g?.()),v.visible=!1}}),m,null!==l&&t(Ne,{loading:v.loading,...b,onClick:async e=>{v.loading=!0,b.onClick?.(e),await(h?.()),v.loading=!1,v.visible=!1}})]})]});return t(ut,{content:N,...f,trigger:i,visible:v.visible,align:d,offset:p,position:u,onVisibleChange:e=>{v.visible=e,f.onVisibleChange?.(e)},children:c})};function en(n){const{type:a="default",name:r,value:s,checked:l,disabled:o,children:c,onChange:d}=n;return e("label",{className:i("i-radio-item",{disabled:o}),children:[t("input",{type:"radio",name:r,checked:l,className:i("i-radio-input",`i-radio-${a}`),disabled:o,onChange:e=>{d?.(s,e)}}),t("span",{className:"i-radio-text",children:c})]})}function tn(n){const{label:a,name:r,options:s,value:l,type:o="default",status:c="normal",message:d,optionInline:p=!0,labelInline:m,disabled:h,required:g,className:v,onChange:b}=n,y=ae({value:l}),N=f((()=>Ee(s)),[s]),k=re(((e,t)=>{y.value=e,b?.(e,t)}));return u((()=>{y.value=l}),[l]),e("div",{className:i("i-radio i-input-label",{[`i-radio-${c}`]:"normal"!==c,"i-input-inline":m},v),children:[a&&e("span",{className:"i-input-label-text",children:[g&&t("span",{className:"error",children:"*"}),a,d&&t("p",{className:"i-radio-message",children:d})]}),t("div",{className:i("i-radio-options",{"i-options-block":!p,"i-radio-options-button":"button"===o}),children:N.map((e=>t(en,{name:r,value:e.value,checked:y.value===e.value,type:o,disabled:h||e.disabled,onChange:k,children:e.label},e.value)))})]})}tn.Item=en;const nn=n=>{const{dot:a,dotClass:r,outline:s,round:l,size:o="normal",className:c,children:d,onClose:u,onClick:p,...m}=n;return e("span",{className:i("i-tag",{"i-tag-outline":s,"i-tag-clickable":p,[`i-tag-${o}`]:"normal"!==o,round:l},c),onClick:p,...m,children:[a&&t("span",{className:i("i-tag-dot",r)}),d,u&&t(He,{active:!0,className:"i-tag-close",onClick:u})]})},an=n=>{const{value:a,options:r,filter:s,filterPlaceholder:l,multiple:o,empty:c=t(Xe,{}),onSelect:d,onFilter:u}=n;return e("div",{className:i("i-select-options",{"i-select-options-multiple":o}),children:[s&&o&&e("div",{className:"i-select-filter",children:[t(ke,{icon:t(_,{}),className:"color-8 ml-8 my-auto",size:"1.2em"}),t("input",{type:"text",className:"i-input",placeholder:l,onChange:u})]}),0===r.length&&c,r.map(((n,i)=>{const{label:r,value:s,disabled:l}=n,c=o?a?.includes(s):a===s;return e(kt.Item,{active:c,type:"option",onClick:()=>d?.(s,n),disabled:l,children:[o&&t(ke,{icon:t(J,{}),className:"i-select-option-check",size:"1em"}),r]},s||i)}))]})},rn=n=>{const{options:i,value:a,maxDisplay:r,multiple:s,onSelect:l}=n;return s?((e=[],t=[],n=3)=>{const i=e.flatMap((e=>t.includes(e.value)?[e]:[]));if(n>=i.length)return i;const a=i.length-n,r=i.slice(0,n);return r.push(a),r})(i,a,r).map(((n,i)=>{if("number"==typeof n)return e(nn,{children:["+",n]},i);const{label:a,value:r}=n;return t(nn,{onClose:e=>{e?.stopPropagation(),l?.(r,n)},children:a},r)})):i.find((e=>e.value===a))?.label},sn=c(((n,r)=>{const{type:s="text",name:l,label:o,value:c="",placeholder:d,options:m=[],multiple:h,prepend:v,append:b,labelInline:y,style:N,className:k,message:C,status:w="normal",hideClear:x,maxDisplay:$,border:T,filter:I,tip:P,filterPlaceholder:z="...",popupProps:O,onSelect:D,onChange:M,...S}=n,j=ae({inputValue:"",filterValue:"",value:c,loading:!1}),[E,B]=g(!1),L=f((()=>Ee(m)),[m]),Y=f((()=>{const{filterValue:e}=j;if(!e||!I)return L;const t="function"==typeof I?I:t=>t.value.includes(e)||t.label.includes(e);return L.filter(t)}),[L,I,j.filterValue]),A=e=>{j.value=e,M?.(e)},V=p(((e,t)=>{if(D?.(e,t),h){const t=[...j.value],n=t.findIndex((t=>t===e));return n>-1?t.splice(n,1):t.push(e),void A(t)}B(!1),A(e)}),[]),W=re(a({delay:400},(e=>{const t=e.target.value;j.filterValue=t})));u((()=>{j.value=c}),[c]);const q=h?j.value.length>0:!!j.value,F=!x&&E&&q,H=C??P;return e("label",{className:i("i-input-label",k,{"i-input-inline":y}),style:N,children:[o&&t("span",{className:"i-input-label-text",children:o}),t(ut,{position:"bottom",arrow:!1,fitSize:!0,...O,visible:E,trigger:"none",onVisibleChange:e=>{B(e),I&&(j.filterValue="")},content:t(an,{options:Y,value:j.value,multiple:h,filter:!!I,filterPlaceholder:z,onSelect:V,onFilter:W}),children:e("div",{className:i("i-input-item",{[`i-input-${w}`]:"normal"!==w,"i-input-borderless":!T,"i-input-focus":E}),onClick:()=>B(!0),children:[v,t("input",{ref:r,type:"hidden",value:j.value,...S}),h?q?t("div",{className:i("i-input i-select",{"i-select-multiple":h}),children:rn({options:L,value:j.value,multiple:h,maxDisplay:$,onSelect:V})}):t("input",{className:"i-input i-select",placeholder:d,readOnly:!0}):null,!h&&t("input",{value:E?j.filterValue:j.value,className:"i-input i-select",placeholder:j.value||d,onChange:e=>{j.filterValue=e.target.value},readOnly:!I}),t(He,{active:!0,icon:F?void 0:t(Q,{}),onClick:e=>{E&&A(h?[]:"")}}),b]})}),H&&t("span",{className:"i-input-message",children:H})]})}));function ln(){return t("i",{className:"i-step-divider"})}const on=["finished","active","pending"];function cn(e,n){return t("span",{className:"i-step-item-index",children:"finished"===n?t(J,{style:{width:"1em",height:"1.5em"}}):e+1})}function dn(a){const{index:r=0,active:s=0,renderIcon:l=cn,title:o,vertical:c,line:d=t(ln,{}),asList:u,style:p,className:m,children:h,onClick:g}=a,f=on[r===s?1:r<s?0:2];return t("div",{style:p,className:i("i-step-item",{[`i-step-item-${f}`]:!u},m),onClick:()=>{g?.(r)},children:e(n,c?{children:[e("div",{className:"i-step-item-left",children:[l?.(r,f),d]}),e("div",{className:"i-step-item-right",children:[t("div",{className:"i-step-item-title",children:o}),h&&t("div",{className:"i-step-item-content",children:h})]})]}:{children:[e("div",{className:"i-step-item-title",children:[l?.(r,f),t("span",{children:o}),d]}),h&&t("div",{className:"i-step-item-content",children:h})]})})}const un=e=>{const{active:n=0,vertical:a,renderIcon:r,line:s,style:l,asList:o,className:c,children:d,onClick:u}=e,p=f((()=>{const e=[];let t=0;return v.map(d,(i=>{if(!i||i.type!==dn)return;const{props:l}=i;e.push({...i,props:{renderIcon:r,line:s,onClick:u,...l,vertical:a,active:n,asList:o,index:t++}})})),e}),[n,d]);return t("div",{className:i("i-step",{"i-step-vertical":a},c),style:l,children:p})};function pn(e){const{index:n=0,active:a,type:r,transition:s,gap:l=0,itemHeight:o,vertical:c,style:d,className:u,children:p}=e,m=f((()=>"normal"===r?{[c?"paddingBlock":"paddingInline"]:l/2,height:o}:{transform:`translate(-${100*n}%, 0)`,transition:s}),[n,l,o,c,r]);return t("div",{style:{...d,...m},className:i("i-swiper-item",u,{"i-swiper-active":a}),"data-index":n,children:p})}un.Item=dn;const mn=c(((a,r)=>{const{type:s="normal",initial:l=0,display:o=1,scroll:c=1,loop:d=!0,vertical:m,prev:h=t(ke,{icon:t(M,{}),size:"2em"}),next:g=t(ke,{icon:t(S,{}),size:"2em"}),duration:y=600,interval:N=3e3,autoplay:k,pauseOnHover:C,arrow:x=!0,reverse:$,draggable:T,dragOffset:I=40,gap:P=0,itemHeight:z,indicator:O,style:D,className:j,children:E,renderIndicator:B,onBeforeSwipe:L,onAfterSwipe:Y}=a,A=b(null),V=b(null),W=`all ${y/1e3}s`,q=ae({current:l,swipable:!0,transition:"fade"===s?"none":W,dragStart:0,dragging:!1,initialized:!1}),F=f((()=>v.map(E,(e=>{if(e.type===pn)return e}))),[E]),[H,R,X,U,G]=f((()=>{const e="normal"===s&&d&&F.length>o?o+1:0;let t=[];if(e<=0)t=[...F];else{const n=F.slice(0,e);t=[...F.slice(-e),...F,...n]}const n=t.length/o*100+"%";return[t,e,F.length,t.length,n]}),[o,d,s,F]),K=f((()=>-100*(q.current+R)/U),[q.current,U]),Z=f((()=>{if(X<=o||"fade"===s)return;return`translate3d(${m?`0, ${K}%`:`${K}%, 0`}, 0)`}),[K,m,o,X,s]),_=f((()=>{if(m&&z)return{height:z*o}}),[m,z,o]),J=f((()=>Array.from({length:Math.ceil((X-o)/c)+1})),[d,O]),Q=()=>{clearTimeout(V.current),V.current=null},ee=p((e=>{if(!q.swipable||e===q.current)return;q.swipable=!1,L?.(q.current);let t=!1,n=e;const i=X-o;return d?e>i?(t=!0,e=X,n=0):e<0&&(t=!0,e=-o,n=i):(n=We(n,0,i),e=n),setTimeout((()=>{q.swipable=!0}),y+32),"fade"===s?(q.current=n,void Y?.(n)):(q.current=e,t?void setTimeout((()=>{q.transition="none",q.current=n,Y?.(n),k&&(V.current=setTimeout(te,N)),setTimeout((()=>{q.transition=W}),60)}),y+20):(k&&(V.current=setTimeout(te,N)),void setTimeout((()=>{Y?.(n)}),y+12)))}),[y,k]),te=()=>{ee($?q.current-c:q.current+c)},ne=()=>{ee($?q.current+c:q.current-c)},ie=p((e=>{T&&q.swipable&&"fade"!==s&&(e.stopPropagation(),Object.assign(q,{dragStart:m?e.clientY:e.clientX,dragging:!0,transition:"none"}))}),[T,m]),re=p((e=>{if(!q.dragging||!A.current)return;e.preventDefault();const t=61.8*((m?e.clientY:e.clientX)-q.dragStart)/A.current[m?"offsetHeight":"offsetWidth"]+K;A.current.style.transform=`translate3d(${m?`0, ${t}%`:`${t}%, 0`}, 0)`}),[m,A.current,K]),se=p((e=>{if(!q.dragging||!A.current)return;const t=m?e.clientY:e.clientX,n=A.current[m?"offsetHeight":"offsetWidth"]/U,i=.618*(t-q.dragStart),a=Math.abs(i);if(a>I){const e=Math.floor(a/n)+(a%n-I>0?1:0);let t=q.current+(i>0?-e:e);ee(t)}A.current.style.transform=Z||"",Object.assign(q,{dragging:!1,transition:W})}),[m,A.current,K]);return _e(re),Je(se),w(r,(()=>({swipeTo:ee,swipeNext:te,swipePrev:ne}))),u((()=>{if(k)return V.current=setTimeout(te,N),()=>{clearTimeout(V.current),V.current=null}}),[k,N]),e("div",{style:D,className:i("i-swiper",{"i-swiper-vertical":m,"i-swiper-initialized":q.initialized},j),children:[e("div",{className:"i-swiper-track",style:_,onMouseOver:()=>{C&&Q()},onMouseLeave:()=>{C&&(Q(),V.current=setTimeout(te,N))},children:[t("div",{ref:A,className:i("i-swiper-list",{"i-swiper-fade":"fade"===s}),style:{[m?"height":"width"]:G,transform:Z,transition:q.transition},onMouseDown:ie,children:H.map(((e,n)=>{const{props:i}=e;return t(pn,{index:n,active:n-R===q.current,type:s,gap:P,transition:W,itemHeight:z,vertical:m,...i},n)}))}),x&&e(n,{children:[t("a",{className:"i-swiper-arrow i-swiper-prev",onClick:ne,children:h}),t("a",{className:"i-swiper-arrow i-swiper-next",onClick:te,children:g})]})]}),O&&t("div",{className:"i-swiper-indicators",children:J.map(((e,n)=>t("a",{className:i("i-swiper-indicator",{"i-indicator-active":n===Math[d?"floor":"ceil"]((q.current+X)%X/c)}),onClick:()=>ee(n*c),children:B?.(n)},n)))})]})}));mn.Item=pn;const hn=c(((n,a)=>{const{active:r,tabs:s,type:o="default",prepend:c,append:d,children:p,className:m,vertical:h,toggable:g,bar:f=!0,hideMore:y,barClass:N,renderMore:k=()=>t(Ne,{flat:!0,square:!0,size:"small",children:t(ke,{icon:t(K,{})})}),onTabChange:C,...x}=n,$=b([]),T=b(null),I=b(null),P=ae({active:r,prevActive:void 0,barStyle:{},cachedTabs:[],overflow:!1,more:[],tabs:[]}),{observe:z,unobserve:O}=Qe(),D=oe(I);u((()=>{if(!s)return p?void(P.tabs=v.map(p,((e,t)=>{const{key:n,props:i}=e,{title:a,children:r,content:s,keepDOM:o}=i,c=r?"string"==typeof r?r:l(r,["props","type","$$typeof","ref"]):s;return{key:n||String(t),title:a,content:c,keepDOM:o}}))):void(P.tabs=[]);P.tabs=s.map(((e,t)=>["string","number"].includes(typeof e)?{key:e,title:e}:(void 0===e.key&&(e.key=t),e)))}),[p,s]);const M=e=>{const{key:t}=e,n=P.tabs.findIndex((e=>e.key===t));if(n>-1)return void j(P.tabs[n].key??n);const i=P.tabs.length,a=e.key??i;P.tabs.push({...e,key:a}),j(a)},S=e=>{const t=P.tabs.findIndex((t=>t.key===e));if(t<0)return;if(P.tabs.splice(t,1),P.active!==e)return;const n=P.tabs[t]||P.tabs[t-1];j(P.prevActive??n?.key??"")},j=e=>{if(e===P.active){if(!g)return;return C?.(void 0,e),P.active=void 0,void(P.barStyle={height:0,width:0})}P.prevActive=P.active,C?.(e,P.active),P.active=e},E=e=>{e.stopPropagation(),e.preventDefault(),h||I.current?.scrollBy({left:e.deltaY+e.deltaX})};return u((()=>{if(!D||y)return;const{scrollHeight:e,scrollWidth:t}=I.current,{width:n,height:i}=D;P.overflow=e>i||t>n,P.overflow&&$.current.map(((e,t)=>{e&&z(e,((e,n)=>{P.tabs[t]&&(P.tabs[t].intersecting=n,P.more=P.tabs.filter((e=>!e.intersecting)))}))}))}),[D,y,P.tabs.length]),u((()=>{if(!f||"pane"===o||void 0===P.active)return;const e=P.tabs.findIndex((e=>e.key===P.active));setTimeout((()=>{const t=$.current[e];if(!t)return;if(P.tabs[e].keepDOM&&P.active){P.cachedTabs.findIndex((e=>e===P.active))<0&&P.cachedTabs.unshift(P.active)}const{offsetHeight:n,offsetLeft:i,offsetTop:a,offsetWidth:r}=t,s="line"===o;P.barStyle={height:!h&&s?".25em":n,width:h&&s?".25em":r,transform:`translate(${i}px, ${a}px)`}}),16)}),[P.active,f]),u((()=>{void 0!==r&&P.active!==r&&j(r)}),[r]),u((()=>{if(!y)return()=>{$.current?.map(O)}}),[P.tabs.length]),u((()=>{if(I.current&&!h)return I.current.addEventListener("wheel",E,{passive:!1}),()=>{I.current&&I.current.removeEventListener("wheel",E)}}),[I.current]),w(a,(()=>({open:j,close:S,add:M,navs:I}))),e("div",{className:i("i-tabs",{flex:h,[`i-tabs-${o}`]:"default"!==o},m),...x,children:[e("div",{className:i("i-tab-navs-container",{"i-tab-navs-vertical":h}),children:[c,e("div",{ref:I,className:"i-tab-navs",children:[P.tabs.map(((n,a)=>{const{title:r,key:s=a,closable:l}=n;return e("a",{ref:e=>$.current[a]=e,className:i("i-tab-nav",{"i-tab-active":P.active===s}),onClick:()=>j(s),children:[r,l&&t(He,{as:"i",active:!0,className:"i-tab-nav-close",onClick:e=>{e.stopPropagation(),S(s)}})]},s)})),f&&t("span",{ref:T,className:i("i-tab-navs-bar",N),style:P.barStyle})]}),!y&&P.overflow&&P.more.length>0&&t(ut,{arrow:!1,position:h?"right":"bottom",align:"end",touchable:!0,hideDelay:500,content:t("div",{className:"i-tabs-morelist pd-4",children:P.more.map(((e,n)=>{const{key:a=n,title:r}=e,s=P.active===a;return t("a",{className:i("i-tab-nav",{"i-tab-active":s}),onClick:()=>j(a),children:r},a)}))}),children:k(P.more)}),d]}),t("div",{className:"i-tab-contents",children:P.tabs.map(((e,n)=>{const{key:a=n,content:r}=e,s=P.active===a;return(s||void 0!==a&&P.cachedTabs.includes(a))&&t("div",{className:i("i-tab-content",{"i-tab-active":s}),children:r},a)}))})]})}));function gn(e){const{data:a=[],depth:r=0,round:s,style:l,className:o,parent:c,nodeProps:d,...u}=e,p=a.map(((e,n)=>{const{type:i}=e,a=e[d.title],s=e[d.key]||(void 0!==c?.key?`${c.key}-${n}`:`${n}`);return e.key=s,e.parent=c,"title"===i?t("div",{className:"i-tree-group-title",children:a},n):i&&"item"!==i?t("div",{className:`i-tree-type-${i}`,children:a},n):t(vn,{index:n,item:e,depth:r,nodeProps:d,...u},s)}));return r>0?t(n,{children:p}):t("div",{className:i("i-tree",o,{"i-tree-round":s}),style:l,children:p})}hn.Item=e=>t(n,{});const fn=e=>{const{as:n="a",href:a,selected:r,children:s,...l}=e,o=i("i-tree-item-header",{"i-tree-item-selected":r});return t(n,"string"==typeof n?{href:a,className:o,...l,children:s}:{to:a||"",className:o,...l,children:s})},vn=n=>{const{item:a,depth:r=0,index:s,selected:l,checked:o=[],partofs:c={},checkable:d,nodeProps:u,renderExtra:p,onItemClick:m,onItemSelect:h,onItemCheck:f,...v}=n,{as:b,key:y="",href:N,icon:k,title:C,expanded:w,disabled:x}=a,$=a[u.children],[T,I]=g(w),P=re(((e,t)=>{t&&(e.preventDefault(),e.stopPropagation()),!x&&$?.length&&I((e=>!e))})),z=re((e=>{if(x)return e.preventDefault(),void e.stopPropagation();P(e),m?.(a,e),h?.(y,a)})),O=o.includes(y);return e("div",{className:i("i-tree-item",{"i-tree-expand":T}),children:[e(fn,{as:b,href:N,style:{paddingLeft:1.5*r+.5+"em"},selected:l===y,onClick:z,children:[d&&t(Fe.Item,{value:O,partof:!O&&c[y],className:"i-tree-checkbox",onChange:e=>f?.(a,e,[]),onClick:e=>e.stopPropagation()}),k&&t("span",{className:"i-tree-item-icon",children:k}),t("span",{className:"i-tree-item-title",children:C}),p?.(a),$&&t(ke,{icon:t(ee,{}),className:"i-tree-toggle",onClick:e=>P(e,!0)})]}),$?.length&&t("div",{className:"i-tree-item-content",children:t(gn,{data:$,depth:r+1,selected:l,checkable:d,parent:a,partofs:c,checked:o,nodeProps:u,renderExtra:p,onItemClick:m,onItemSelect:h,onItemCheck:f,...v})})]})},bn={key:"key",title:"title",children:"children"},yn=c(((e,n)=>{const{data:i=[],selected:a,checked:r=[],disabledRelated:s,nodeProps:l,onItemSelect:o,onItemCheck:c,...d}=e,p=ae({selected:a,checked:r,partofs:{},nodeMaps:new Map}),m=Object.assign({},bn,l),h=e=>p.checked.includes(e||""),g=re(((e,t,n)=>{const{key:i="",parent:a,children:r}=e,l={[i]:t},o={[i]:!1};if(s)return[l];if(t){if(a&&"leaf"!==n){const e=a.children?.some((e=>e.key!==i&&!h(e.key))),[t,n]=g(a,!0,"root");e||Object.assign(l,t),Object.assign(o,e?n:{},{[a.key]:!0})}return r?.length&&"root"!==n&&r.map((e=>{if(h(e.key))return;const[t]=g(e,!0,"leaf");Object.assign(l,t),o[e.key]=!1})),[l,o]}if(a&&"leaf"!==n){const[e,t]=g(a,!1,"root");Object.assign(l,e);const n=a.children?.some((e=>h(e.key)&&e.key!==i));Object.assign(o,n?{}:t,{[a.key]:n,[i]:!1})}return r?.length&&"root"!==n&&r.map((e=>{const[t]=g(e,!1,"leaf");h(e.key)&&(Object.assign(l,t),o[e.key]=!1)})),[l,o]}));return u((()=>{void 0!==a&&(p.selected=a)}),[a]),u((()=>{p.nodeMaps.clear();const{key:e,children:t}=m,n=i=>{i.map((i=>{p.nodeMaps.set(i[e],i),i[t]?.length>0&&n(i[t])}))};n(i)}),[i]),w(n,(()=>({getChecked:()=>{const e=[];return p.checked.map((t=>{const n=p.nodeMaps.get(t);e.push(n)})),[p.checked,e]},getSelected:()=>{const e=p.nodeMaps.get(p.selected);return[p.selected,e]},getPartofs:()=>{const e=[];return[Object.keys(p.partofs).filter((t=>{const n=p.partofs[t];if(n){const n=p.nodeMaps.get(t);e.push(n)}return n})),e]}}))),t(gn,{data:i,selected:p.selected,checked:p.checked,partofs:p.partofs,nodeProps:m,onItemCheck:(e,t)=>{const[n,i]=g(e,t),a=Object.keys(n);p.checked=t?Array.from(new Set([...p.checked,...a])):p.checked.filter((e=>!a.includes(e))),Object.assign(p.partofs,i),c?.(e,t,p.checked)},onItemSelect:(t,n)=>{e.selectable&&(p.selected=t,o?.(t,n))},...d})}));function Nn(i){const{mode:a,index:r,file:s,onRemove:l,onPreview:c}=i;if(!s)return"";const{name:d,size:u,url:p,src:m}=s,h=Ae(d,s.type),g=t(He,{active:!0,className:"i-upload-delete",onClick:e=>{e.stopPropagation(),e.preventDefault(),l(r)}});if("card"===a){let i=t(n,{});switch(h){case De.IMAGE:i=t(At,{lazyload:!0,src:p||m,fit:"cover",usePreview:!1});break;case De.VIDEO:i=t("video",{src:p||m,preload:"none"});break;default:i=e(n,{children:[t(ke,{icon:t(te,{})}),t("span",{className:"i-upload-file-name",children:o(d)})]})}return e("div",{title:d,className:"i-upload-item-card",onClick:()=>c?.(r),children:[i,g]})}return e("div",{className:"i-upload-item",onClick:()=>c?.(r),children:[t("span",{children:d}),t("i",{className:"i-upload-size",children:Ve(u??0)}),g]})}const kn=c(((n,a)=>{const{label:s,labelInline:l,value:o,files:c=[],placeholder:d,status:p="normal",message:m,className:h,style:g,children:v,mode:y="default",cardSize:k="4em",disabled:C,limit:x=(n.multiple?1/0:1),multiple:$,renderItem:T=Nn,shouldUpload:I=()=>!0,uploader:P,onChange:z,onFilesChange:O,onUpload:D,...M}=n,S=ae({files:c,value:o,status:p,message:m,update:0}),j=b(null),E=Yt(),B=f((()=>v||("card"===y?t(Ne,{className:"i-upload-card-btn color-5",square:!0,flat:!0,outline:!0,disabled:C,children:t(ke,{icon:t(ie,{})})}):e(Ne,{className:"i-upload-btn",disabled:C,children:[t(ke,{icon:t(ne,{})})," Upload"]}))),[y,v]),L=e=>{const[...t]=S.files,n=t.splice(e,1);URL.revokeObjectURL(n[0]?.src||""),S.files=t,O?.(t,n),z?.(t),j.current&&(j.current.value="")},Y=async e=>{P&&e.forEach((async e=>{if(!I(e))return;const t=await P(e),n=S.files.findIndex((e=>e.uid===t.uid));n>-1&&(S.files[n]=t),"completed"===t?.status&&D?.(t)}))},A=e=>{E({items:S.files,initial:e})};u((()=>{Object.assign(S,{status:p,message:m})}),[p,m]),u((()=>{S.value=o}),[o]),w(a,(()=>({getFileList:()=>S.files})),[]);const{message:V,files:W}=S;return e(st,{label:s,labelInline:l,className:i("i-input-label-file",h),style:g,children:[t("input",{...M,disabled:C,ref:j,type:"file",className:"i-input-file-hidden",multiple:$,onChange:e=>{const t=Array.from(e.target.files||[]),{files:n}=S,i=[];t.map((e=>{const{name:t,size:a,type:s}=e,l=n.find((e=>{const{name:n,size:i,type:r}=e;return n===t&&i===a&&r===s})),o=URL.createObjectURL(e);e.src=o,S.update+=1,Object.assign(e,{uid:r(7),src:e.src||e.name}),!l&&i.push(e)}));const a=[...n,...i];Object.assign(S,{files:$?a.slice(0,x):[a.at(-1)],status:p,message:m}),O?.(S.files,i,e),z?.(S.files,e),Y(i),j.current&&(j.current.value="")}}),e("div",{className:i("i-upload-inner",{[`i-upload-${y}`]:"default"!==y}),style:{"--upload-card-size":k},children:[t("div",{className:"i-upload-list",onClick:e=>{e.stopPropagation(),e.preventDefault()},children:W?.map(((e,n)=>t(N,{children:Nn({index:n,file:e,mode:y,onRemove:L,onPreview:A})},n)))}),V&&t("span",{className:"i-upload-message",children:V}),W.length<x&&B]})]})}));export{we as Affix,xe as Badge,Ne as Button,Oe as Card,Fe as Checkbox,Re as Collapse,rt as Datagrid,vt as Datepicker,bt as Description,yt as Drawer,wt as Dropdown,xt as Flex,It as Form,ke as Icon,At as Image,lt as Input,kt as List,be as Loading,Gt as Message,zt as Modal,Zt as Pagination,Qt as Popconfirm,ut as Popup,jt as Progress,tn as Radio,sn as Select,un as Step,mn as Swiper,hn as Tabs,nn as Tag,Dt as Text,yn as Tree,kn as Upload,Et as Video,Yt as usePreview};
1
+ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import i from"classnames";import{debounce as a,uid as r,throttle as s,pick as l,title as o}from"radash";import{forwardRef as c,createElement as d,useEffect as u,useCallback as p,isValidElement as m,cloneElement as h,useState as g,useMemo as f,Children as v,useRef as b,useLayoutEffect as y,Fragment as N,createContext as k,useContext as C,useImperativeHandle as w}from"react";import{SkipPreviousRound as x,CloseRound as $,MinusRound as D,PlusRound as P,InboxTwotone as T,VisibilityRound as I,VisibilityOffRound as z,SyncAltRound as O,KeyboardArrowLeftRound as M,KeyboardArrowRightRound as S,CalendarMonthTwotone as E,PauseRound as j,PlayArrowRound as B,StopRound as L,FullscreenExitRound as Y,FullscreenRound as A,VolumeOffRound as V,VolumeDownRound as W,FeedOutlined as q,AspectRatioRound as F,OpenInNewRound as H,FileDownloadOutlined as R,RotateRightRound as X,RotateLeftRound as U,HideImageTwotone as G,MoreHorizRound as K,InfoOutlined as Z,SearchRound as _,CheckRound as J,UnfoldMoreRound as Q,KeyboardArrowDownRound as ee,ListAltRound as te,CloudUploadTwotone as ne,PlusSharp as ie}from"@ricons/material";import{useReactive as ae,useMemoizedFn as re,useClickAway as se,useCreation as le,useSize as oe}from"ahooks";import{createRoot as ce}from"react-dom/client";import de from"react-custom-scrollbars-2";import ue from"dayjs";import pe from"dayjs/plugin/customParseFormat";import{createPortal as me}from"react-dom";import he from"rc-virtual-list";import ge from"pubsub-js";const fe=500;function ve(e){const t=e.target,n=t.closest("[data-ripple]");t&&n&&function(e,t){const[n,i]=function(){const e=document.createElement("SPAN"),t=document.createElement("SPAN");return e.className="i-ripple-container",t.className="i-ripple",e.append(t),[e,t]}(),a=e.getBoundingClientRect(),r=2*Math.max(a.width,a.height);i.style.cssText=`\n left: ${t.pageX-a.left}px;\n top: ${t.pageY-a.top}px;\n width: ${r}px;\n height: ${r}px;\n transition: all 0.5s;\n `,e.insertAdjacentElement("afterbegin",n),e.offsetHeight,i.classList.add("i-ripple-active"),setTimeout((()=>{n.remove()}),fe)}(n,e)}const be=n=>{const{icon:a,text:r,size:s,absolute:l,style:o,className:c,...d}=n;return e("div",{className:i("i-loading-container",{absolute:l},c),style:{fontSize:s,...o},...d,children:[a??t("svg",{width:"24",height:"24",stroke:"#000",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"i-loading-icon",children:t("circle",{cx:"12",cy:"12",r:"9.5",fill:"none",strokeWidth:"3",strokeLinecap:"round",strokeDasharray:40,strokeDashoffset:0})}),r]})},ye=({outline:e,flat:t,loading:n,disabled:a,size:r="normal",block:s,round:l,square:o,secondary:c,className:d})=>i("i-btn",d,{"i-btn-outline":e,"i-btn-flat":t,"i-btn-block":s,"i-btn-loading":n,"i-btn-square":o,"i-btn-secondary":c,[`i-btn-${r}`]:"normal"!==r,round:l,disabled:a}),Ne=c(((e,i)=>{const{as:a="a",children:r,className:s,loading:l,flat:o,outline:c,square:p,secondary:m,size:h,round:g,href:f,ripple:v=!0,onClick:b,...y}=e;if(!r)return t(n,{});const N=[l&&t(be,{},"loading"),d("span",{key:"content",className:"i-btn-content"},r)],k={className:ye(e),"data-ripple":v,onClick:e=>{l||y.disabled?e.stopPropagation():b?.(e)}};return u((()=>{v&&(document.documentElement.dataset.useripple||(document.documentElement.dataset.useripple="enable",document.addEventListener("mousedown",ve)))}),[v]),d(a,"string"==typeof a?{ref:i,href:f,...k,...y}:{to:f||"",...k,...y},N)}));Ne.Toggle=function(e){const{active:n,activeClass:a,after:r,disabled:s,children:l,className:o,onClick:c,onToggle:d,...m}=e,h=ae({active:n,done:!0}),g=p((()=>{const e=void 0!==r,t=!h.active;Object.assign(h,{active:t,done:!e}),d?.(t),e&&setTimeout((()=>{h.done=!0}),16)}),[r]);return u((()=>{h.active!==n&&g()}),[n]),t(Ne,{className:i(o,{[a||""]:h.active},"i-btn-toggle"),...m,onClick:e=>{c?.(e),!s&&g()},children:t("div",{className:i("i-btn-toggle-content",{"i-btn-toggle-active":h.done}),children:h.active?r??l:l})})},Ne.Group=function(e){const{children:n,vertical:a,className:r,style:s}=e;return t("div",{className:i(r,a?"i-btn-group-vertical":"i-btn-group-horizonal"),style:s,children:n})};const ke=c(((e,t)=>{const{icon:n,size:a="1.425em",rotate:r,style:s,className:l,...o}=e;if(!m(n))return n;const c={ref:t,style:{transform:r?`rotate(${r}deg)`:void 0,...s,width:a,height:a},className:i("i-icon",l),...o};return h(n,c)}));function Ce(e){const{style:n,className:a,onClick:r}=e;return t(Ne,{square:!0,className:i("i-affix-totop",a),style:{...n},onClick:r,children:t(ke,{icon:t(x,{}),rotate:90})})}const we=e=>{const{position:n="fixed",left:r,top:s,right:l,bottom:o,offset:c,style:d,className:p,children:m,getContainer:b=()=>document.body}=e,[y,N]=g(!1),k=f((()=>v.map(m,(e=>{if(e.type===Ce){const{onClick:t}=e.props;return h(e,{key:e.key,...e.props,onClick:e=>{const n=b();t?.(e),n?.scrollTo({top:0,left:0,behavior:"smooth"})}})}return e}))),[m,b]);return u((()=>{const e=b();if(!c||!e)return;const t=a({delay:160},(()=>{const t=e.scrollTop;N(t<c)}));return t(),e.addEventListener("scroll",t),()=>{e.removeEventListener("scroll",t)}}),[c,b]),t("div",{className:i("i-affix",p,{"i-affix-hidden":y}),style:{...d,position:n,left:r,top:s,right:l,bottom:o},children:k})};we.ToTop=Ce;const xe=n=>{const{content:a,contentClass:r,dot:s,dotSize:l,round:o,disabled:c,style:d,className:u,children:p}=n;return e("div",{style:d,className:i("i-badge",{rounded:o},u),children:[p,t("div",{className:i("i-badge-content",r,{"i-badge-dot":s,"i-badge-hidden":c}),style:{fontSize:l},children:a})]})},$e=e=>n=>t("div",{style:n.style,className:i("i-card-"+e,n.className),children:n.children}),De=$e("header"),Pe=$e("footer"),Te=$e("banner"),Ie=$e("tail"),ze=n=>{const{shadow:a=!0,border:r,style:s,className:l,children:o}=n,c=f((()=>{const e={};return v.map(o,(t=>{switch(t.type){case De:e.header=t;break;case Pe:e.footer=t;break;case Te:e.banner=t;break;case Ie:e.tailer=t;break;default:e.content=[...e.content||[],t]}})),e}),[o]),{header:d,banner:u,content:p,footer:m,tailer:h}=c;return e("div",{style:s,className:i("i-card",l,{shadow:a,"i-card-bordered":r}),children:[u,d,p&&t("div",{className:"i-card-content",children:p}),m,h]})};var Oe;function Me(e,t,n={}){const{refWindow:i,gap:a=0,offset:r=0,position:s="top",align:l}=n;if(!e||!t)return[0,0,{arrowX:0,arrowY:0,arrowPos:"bottom"}];const o=e.getBoundingClientRect(),c=t.getBoundingClientRect();let d=window.innerWidth,u=window.innerHeight,{left:p,top:m,right:h,bottom:g,width:f,height:v}=o;const{height:b,width:y}=c;if(!i){const t=e.offsetParent?.getBoundingClientRect();d=t?.width||d,u=t?.height||u,p=e.offsetLeft,m=e.offsetTop,h=p+o.width,g=m+o.height}let N=0,k=0,C=0,w=0,x="bottom";switch(s){case"left":case"right":N=v!==b?Ee({containerSize:u,targetSize:v,targetOffset:m,contentSize:b,gap:a,align:l}):m,w=N<m?m-N+v/2:v/2;const e=p-r-y,t=h+r+y;"left"===s?(k=e<0?h+r:e,C=e<0?0:y,x=e<0?"left":"right"):(k=d>t?h+r:e,C=d>t?0:y,x=d>t?"left":"right");break;case"top":case"bottom":k=f!==y?Ee({containerSize:d,targetOffset:p,targetSize:f,contentSize:y,gap:a,align:l}):p,C=k>p?y/2:p-k+f/2;const n=m-r-b,i=g+r+b;"top"===s?(N=n<0?g+r:n,w=n<0?0:b,x=n<0?"top":"bottom"):(N=u>i?g+r:n,w=u>i?0:b,x=u>i?"top":"bottom")}return[k,N,{arrowX:C,arrowY:w,arrowPos:x}]}function Se(e,t){const{pageX:n,pageY:i}=e,{width:a,height:r}=t.getBoundingClientRect(),{innerHeight:s,innerWidth:l}=window;return[n+a>=l&&n-a>0?n-a:n,i+r>=s&&i-r>0?i-r:i]}function Ee({containerSize:e,targetSize:t,targetOffset:n,contentSize:i,gap:a,align:r="center"}){const s=n+t/2;switch(r){case"start":return n+i>e?n+t:n;case"center":return t>=i?s-i/2:s+i/2+a>e?n+t-i:s-i/2-a<0?a:s-i/2;case"end":const r=n+t-i;return r>0?r:a;default:return s-i/2}}function je(e){return e.map((e=>["string","number"].includes(typeof e)?{label:e,value:e}:e))}function Be(e,t={}){const{precision:n,thousand:i}=t,a=e.toFixed(n);if(!i)return a;const r=a.split("."),s=r[0].replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g,`$&${i}`);return 1===r.length?s:`${s}.${r[1]}`}function Le(e,t=document.body){const n=document.createElement("div");t.append(n);const i=ce(n),a=setTimeout((()=>{i?.render(e)}),0);return()=>{n?.remove(),i?.unmount(),a&&clearTimeout(a)}}function Ye(e){return e.match(/\.([^\./\?]+)($|\?)/)?.[1]}function Ae(e,t){switch(!0){case["jpg","jpeg","png","webp","svg"].includes(e)||t?.startsWith("image/"):return Oe.IMAGE;case["mp4","avi"].includes(e)||t?.startsWith("video/"):return Oe.VIDEO;default:return Oe.UNKNOWN}}function Ve(e,t=2){if(!+e)return"0 Bytes";const n=t<0?0:t,i=Math.floor(Math.log(e)/Math.log(1024));return`${parseFloat((e/Math.pow(1024,i)).toFixed(n))} ${["B","KB","MB","GB","TB","PB","EB","ZB","YB"][i]}`}function We(e,t,n){return e<t?t:e>n?n:e}function qe(n){const{type:a="default",label:r,name:s,value:l=!1,className:o,status:c="normal",message:d,disabled:p,partof:m,children:h,onChange:g,...f}=n,v=ae({value:l,status:c,message:d}),b=re((e=>{const t=e.target.checked;Object.assign(v,{value:t,status:c,message:d}),g?.(t,e)}));return u((()=>{v.value=l}),[l]),e("label",{className:i("i-checkbox-item",{[`i-checkbox-${v.status}`]:"normal"!==v.status,disabled:p},o),...f,children:[t("input",{type:"checkbox",name:s,className:i("i-checkbox-input",{[`i-checkbox-${a}`]:!m,"i-checkbox-partof":m}),checked:v.value,disabled:p,onChange:b}),t("span",{className:"i-checkbox-text",children:h||r}),v.message&&e("span",{className:"i-checkbox-message",children:["*",v.message]})]})}function Fe(n){const{label:a,name:r,options:s=[],value:l="",type:o="default",optionInline:c=!0,labelInline:d,disabled:p,status:m="normal",message:h,required:g,className:v,onChange:b,...y}=n,N=ae({value:l}),k=f((()=>je(s)),[s]),C=re(((e,t,n)=>{const i=[...N.value],a=i.findIndex((e=>e===t.value));e&&a<0?i.push(t.value):!e&&a>-1&&i.splice(a,1),N.value=i,b?.(i,t,n)}));return u((()=>{N.value=l}),[l]),e("div",{className:i("i-checkbox i-input-label",{[`i-checkbox-${m}`]:"normal"!==m,"i-input-inline":d},v),...y,children:[a&&e("span",{className:"i-input-label-text",children:[g&&t("span",{className:"error",children:"*"}),a,h&&t("p",{className:"i-checkbox-message",children:h})]}),t("div",{className:i("i-checkbox-options",{"i-options-block":!c,"i-checkbox-options-button":"button"===o}),children:k.map((e=>t(qe,{name:r,value:N.value.includes(e.value),type:o,disabled:p||e.disabled,onChange:(t,n)=>C(t,e,n),children:e.label},e.value)))})]})}ze.Header=De,ze.Footer=Pe,ze.Banner=Te,ze.Tailer=Ie,function(e){e.IMAGE="IMAGE",e.VIDEO="VIDEO",e.AUDIO="AUDIO",e.PDF="PDF",e.EXCEL="EXCEL",e.TXT="TXT",e.UNKNOWN="UNKNOWN"}(Oe||(Oe={})),Fe.Item=qe;const He=e=>{const{as:a="a",active:s,className:l,icon:o=t($,{}),...c}=e;return s?d(a,{className:i("i-helpericon",l),...c},[d(ke,{key:r(3),icon:o})]):t(n,{})};const Re=n=>{const{active:a,items:r,multiple:s,border:l,headerClickable:o,className:c,children:d,renderToggle:u=e=>t(e?D:P,{}),onCollapse:p,...m}=n,h=ae({active:a}),g=f((()=>r||(d&&v.map(d,((e,t)=>{const{key:n,props:i}=e,{title:a,children:r,content:s,disabled:l,...o}=i;return{...o,key:n||t,title:a,content:r||s,disabled:l}}))||[])),[d]),b=e=>{const{key:t,disabled:n}=e;if(n)return;if(!s)return h.active=h.active===t?void 0:t,void p?.(t,void 0!==h.active);Array.isArray(h.active)||(h.active=[]);const i=h.active.findIndex((e=>e===t));i>-1?h.active.splice(i,1):void 0!==t&&h.active.push(t),p?.(t,i<0)};return t("div",{className:i("i-collapse",{"i-collapse-bordered":l},c),...m,children:g.map((n=>{const{key:a,title:r,content:l,disabled:c,className:d,...p}=n,m=s?(h.active||[]).includes(a):h.active===a;return e("div",{className:i("i-collapse-item",d,{"i-collapse-active":m,"i-collapse-disabled":c}),...p,children:[e("div",{className:"i-collapse-header",onClick:()=>(e=>{o&&b(e)})(n),children:[r,t(He,{active:!0,className:"i-collapse-toggle",icon:u(m),onClick:()=>b(n)})]}),t("div",{className:"i-collapse-content",children:l})]},a)}))})};function Xe(e){const{className:n,...a}=e;return t(T,{className:i("i-empty",n),...a})}function Ue({justify:e,col:t,row:n,colSpan:i=1,rowSpan:a=1}){return{"--datagrid-justify":e,gridArea:`${n+1} / ${t+1} / ${n+1+a} / ${t+1+i}`,insetInline:`var(--datagrid-cell-inset-${t})`}}function Ge(e){const{column:n,row:a,col:r,data:s,cellEllipsis:l,onCellClick:o,onCellDoubleClick:c}=e,{id:d,fixed:u,justify:p,rowSpan:m,render:h}=n,g=Ue({justify:p,fixed:u,col:r,row:a,rowSpan:m});return t("div",{className:i("i-datagrid-cell",{[`i-datagrid-cell-fixed-${u}`]:u}),"data-col":d,style:g,onClick:e=>o?.(s,n,a,r,e),onDoubleClick:e=>c?.(s,n,a,r,e),children:h?.(s[d],s,r)??t("div",{className:i("i-datagrid-cell-content",{"i-datagrid-cell-content-ellipsis":l}),children:s[d]})})}Re.Item=function(e){return t(n,{})};const Ke=new Set,Ze=new Set;function _e(e){u((()=>(Ke.add(e),()=>{Ke.delete(e)})),[e])}function Je(e){u((()=>(Ze.add(e),()=>{Ze.delete(e)})),[e])}function Qe(e){const t=new WeakMap,n=new IntersectionObserver((e=>{e.map((e=>{const n=t.get(e.target);n?.(e.target,e.isIntersecting)}))}),e);return{observe:function(e,i){t.get(e)||(t.set(e,i),e&&n.observe(e))},unobserve:function(e){e&&n.unobserve(e),t.delete(e)},disconnect:function(){n.disconnect()}}}function et(e){const{index:n,onWidthChange:i}=e,a=ae({resizing:!1,x:0,width:0}),r=re((e=>{const t=e.target.offsetParent.offsetWidth;Object.assign(a,{x:e.pageX,resizing:!0,width:t})}));return _e(re((e=>{if(!a.resizing)return;e.preventDefault();const t=a.width+e.pageX-a.x;t<=24||i(n,t)}))),Je((()=>{a.resizing&&(a.resizing=!1)})),t("i",{className:"i-datagrid-resizor",onMouseDown:r,onClick:e=>e.stopPropagation()})}document.addEventListener("mousemove",(e=>{for(const t of Ke.values())t(e)})),document.addEventListener("mouseup",(e=>{for(const t of Ze.values())t(e)}));const tt=e=>t("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e,children:t("g",{fill:"none",children:t("path",{d:"M9 17.898c0 1.074 1.265 1.648 2.073.941l6.31-5.522a1.75 1.75 0 0 0 0-2.634l-6.31-5.522C10.265 4.454 9 5.028 9 6.102v11.796z",fill:"currentColor"})})});function nt(n){const{type:a}=n;return e("a",{className:i("i-datagrid-sorter",{[`i-datagrid-sorter-${a}`]:a}),children:[t(tt,{className:"i-datagrid-sorter-caret"}),t(tt,{className:"i-datagrid-sorter-caret"})]})}function it(e){const{row:n,data:i,columns:a,cellEllipsis:r,onRowClick:s,onCellClick:l,onCellDoubleClick:o}=e;return t("div",{className:"i-datagrid-row",onClick:()=>s?.(i,n),children:a.map(((e,a)=>t(Ge,{column:e,col:a,row:n,data:i,cellEllipsis:r,onCellClick:l,onCellDoubleClick:o},a)))})}function at(n){const{columns:a,resizable:r,cellEllipsis:s,sortBy:l,sortType:o,onWidthChange:c,onHeaderClick:d}=n;return t("div",{className:"i-datagrid-header i-datagrid-row",children:a.map(((n,a)=>{const{id:u,title:p,fixed:m,colSpan:h,sorter:g,justify:f,renderHeader:v}=n,b=Ue({justify:f,row:0,col:a,colSpan:h}),y=l===u?o:"";return e("div",{"data-col":u,className:i("i-datagrid-cell",{"i-datagrid-has-sorter":g,"i-datagrid-cell-fixed":m}),style:{...b,insetBlockStart:0},onClick:e=>d?.(n,e),children:[v?.(n,a)??t("div",{className:i("i-datagrid-cell-content",{"i-datagrid-cell-content-ellipsis":s}),children:p||u}),g&&t(nt,{type:y}),r&&t(et,{index:a,onWidthChange:c})]},a)}))})}const rt=n=>{const{data:a=[],columns:r=[],border:s,striped:l,header:o=!0,resizable:c,cellPadding:d=".5em",cellEllipsis:m,empty:h=t(Xe,{}),loading:g,height:v="unset",style:y,className:N,renderLoading:k=()=>t(be,{size:"1.5em",className:"color-3"}),onCellClick:C,onRowClick:w,onHeaderClick:x,onSort:$,onScroll:D,onResize:P}=n,T=b(null),I=b(null),z=ae({rows:a,widths:r.map((e=>e.width??"auto")),sortBy:"",sortType:""}),O=f((()=>{const{widths:e}=z,t={...y,"--grid-template-columns":e.map((e=>"number"==typeof e?`${e}px`:e)).join(" ")};if(!c)return t;const n=r.map(((t,n)=>{const{fixed:i}=t;return i?e[n]:0}));return r.map(((e,i)=>{const{fixed:a}=e;if(a)if(0===i)t["--datagrid-cell-inset-0"]=0;else if(i===n.length-1)t["--datagrid-cell-inset-"+(n.length-1)]="auto 0";else{const e="left"===a,r=(e?n.slice(0,i):n.slice(i+1)).reduce(((e,t)=>e+t))+"px",s=e?`${r} auto`:`auto ${r}`;t[`--datagrid-cell-inset-${i}`]=s}})),t}),[z.widths,c]),M=p(((e,t)=>{if(!c)return;const[...n]=z.widths;n[e]=t,z.widths=n,P?.(r[e],t)}),[c]),S=p(((e,t)=>{if(e?.sorter){const[t,n]=function(e,t,n){const i=["desc","asc"];if(e===n){const e=i.findIndex((e=>e===t))+1,a=i[e]||"";return[""===a?"":n,a]}return[n,"desc"]}(z.sortBy,z.sortType,e.id);Object.assign(z,{sortBy:t,sortType:n}),$?.(t,n)}x?.(e,t)}),[]),E=f((()=>{const{sortBy:e,sortType:t}=z;if(e&&!$){const n=r.find((t=>t.id===e))?.sorter,i="function"==typeof n?n:(t,n)=>n[e]-t[e],s=[...a].sort(i);return"desc"===t?s:s.reverse()}return a}),[a,r,z.sortBy,z.sortType]);u((()=>{if(!T.current)return;const{current:e}=T,t=e.querySelector(".i-datagrid-row")?.children;t?.length&&(z.widths=Array.from(t).map((e=>e.offsetWidth)))}),[r,c]),u((()=>{g&&I.current?.scrollTop(0)}),[g]);const j={"--cell-padding":d,...O};return e(de,{ref:I,autoHide:!0,autoHeight:!0,autoHeightMax:v,style:j,className:i("i-datagrid-container",N,{"i-datagrid-bordered":s,"i-datagrid-striped":l}),renderView:e=>t("div",{...e,className:i({"i-datagrid-loading":g})}),onScroll:D,children:[e("div",{ref:T,className:"i-datagrid",children:[o&&t(at,{columns:r,resizable:c,sortType:z.sortType,sortBy:z.sortBy,cellEllipsis:m,onWidthChange:M,onHeaderClick:S}),E.map(((e,n)=>t(it,{row:n+(o?1:0),data:e,cellEllipsis:m,columns:r,onCellClick:C,onRowClick:w},n))),E.length<1&&h]}),g&&k()]})};function st(n){const{label:a,className:r,labelInline:s,style:l,children:o,status:c,tip:d,required:u}=n;return e("label",{className:i("i-input-label",r,{"i-input-inline":s}),style:l,children:[a&&e("span",{className:"i-input-label-text",children:[u&&t("span",{className:"error",children:"*"}),a]}),o,d&&t("span",{className:i("i-input-message",{[`i-input-${c}`]:"normal"!==c}),children:d})]})}const lt=c(((n,a)=>{const{type:r="text",label:s,name:l,value:o=n.initValue??"",initValue:c="",prepend:d,append:m,labelInline:h,className:g,status:v="normal",message:b,tip:y,clear:N,hideVisible:k,border:C,required:w,onChange:x,onEnter:$,style:D,...P}=n,T=ae({value:o,type:r,visible:!1}),O=p((e=>{const t=e.target.value;T.value=t,x?.(t,e)}),[]),M=f((()=>{if("password"===r)return T.visible?t(I,{}):t(z,{})}),[T.visible]);u((()=>{T.value=o}),[o]);const S={ref:a,type:T.type,name:l,value:T.value,className:i("i-input",`i-input-${r}`),onChange:O,onKeyDown:e=>{"Enter"===e.code&&$?.(e)},...P},E=N&&T.value,j="password"===r&&!!T.value;return t(st,{label:s,labelInline:h,className:g,style:D,tip:b??y,status:v,required:w,children:e("div",{className:i("i-input-item",{[`i-input-${v}`]:"normal"!==v,"i-input-borderless":!C}),children:[d&&t("div",{className:"i-input-prepend",children:d}),t("input",{...S}),t(He,{active:!!E||j,icon:M,onClick:()=>{if("password"===r&&!k)return void Object.assign(T,{visible:!T.visible,type:T.visible?"password":"text"});x?.("")}}),m&&t("div",{className:"i-input-append",children:m})]})})})),ot=c(((n,a)=>{const{label:r,name:s,value:l=n.initValue??"",initValue:o,labelInline:c,step:d=1,min:m=-1/0,max:h=1/0,thousand:g,precision:f,type:v,className:b,status:y="normal",append:N,border:k,prepend:C,message:w,tip:x,hideControl:$,style:T,onChange:I,onEnter:z,onInput:O,onBlur:M,...S}=n,E=ae({value:l}),j=p((e=>We(e,m,h)),[m,h]),B=p((e=>Be(e,{precision:f,thousand:g})),[f,g]),L=p((e=>e?"number"!=typeof e&&g?e.replaceAll(g,""):e:""),[g]),Y=re((e=>{const{value:t}=e.target,n=L(t.replace(/[^\d\.-]/g,""));E.value=n,I?.(+n,e)})),A=re((e=>{const t=L(E.value)??0,n=j(+t+e);E.value=B(n),I?.(n)}));u((()=>{E.value=l}),[l]);const V={ref:a,name:s,value:E.value,className:"i-input i-input-number",onChange:Y,...S};return t(st,{label:r,labelInline:c,className:b,style:T,tip:w??x,status:y,children:e("div",{className:i("i-input-item",{[`i-input-${y}`]:"normal"!==y,"i-input-borderless":!k}),children:[C&&t("div",{className:"i-input-prepend",children:C}),!$&&t(He,{active:!0,icon:t(D,{}),onClick:()=>A(-d)}),t("input",{...V}),!$&&t(He,{active:!0,icon:t(P,{}),onClick:()=>A(d)}),N&&t("div",{className:"i-input-append",children:N})]})})})),ct=c(((e,n)=>{const{label:a,name:r,value:s=e.initValue,initValue:l,labelInline:o,className:c,status:d="normal",message:m,tip:h,autoSize:g,border:f,style:v,onChange:y,onEnter:N,...k}=e,C=ae({value:s}),w=b(null),x=p((e=>{const t=e.target.value;C.value=t;const n=w.current?.firstChild;g&&n&&(n.style.height=`${n.scrollHeight}px`),y?.(t,e)}),[]);u((()=>{C.value=s}),[s]);const $={ref:n,name:r,value:C.value,className:"i-input i-textarea",onChange:x,onKeyDown:e=>{"Enter"===e.code&&(e.stopPropagation(),N?.(e))},...k};return t(st,{label:a,labelInline:o,className:c,style:v,tip:m??h,status:d,children:t("div",{ref:w,className:i("i-input-item",{[`i-input-${d}`]:"normal"!==d,"i-input-borderless":!f}),children:t("textarea",{...$})})})}));lt.Textarea=ct,lt.Number=ot,lt.Range=n=>{const{label:a,name:r,value:s=n.initValue??"",initValue:l,labelInline:o,min:c=-1/0,max:d=1/0,type:m,className:h,status:g="normal",message:f,tip:v,append:b,prepend:y,step:N=1,thousand:k,precision:C,hideControl:w,placeholder:x,border:$,onChange:T,onBlur:I,style:z,...M}=n,S=ae({value:s}),E=p((e=>We(e,c,d)),[c,d]),j=p((e=>Be(e,{precision:C,thousand:k})),[C,k]),B=p((e=>e?"number"!=typeof e&&k?e.replaceAll(k,""):e:""),[k]),L=re(((e,t)=>{const{value:n}=e.target,i=B(n.replace(/[^\d\.-]/g,"")),a=Array.isArray(S.value)?S.value:[];a[t]=+i,S.value=a,T?.(a,e)})),Y=re(((e,t,n)=>{e.preventDefault(),e.stopPropagation();const i=Array.isArray(S.value)?S.value:[],a=B(i[n])??0,r=E(+a+t);i[n]=j(r),S.value=i,T?.(i,e)})),A=re((e=>{e.preventDefault(),e.stopPropagation();const t=S.value??[],n=t[0];t[0]=t[1],t[1]=n,S.value=t,T?.(t)}));u((()=>{S.value=s}),[s]);const V={name:r,className:"i-input i-input-number",...M};return t(st,{label:a,labelInline:o,className:h,style:z,tip:f??v,status:g,children:e("div",{className:i("i-input-item",{[`i-input-${g}`]:"normal"!==g,"i-input-borderless":!$}),children:[y&&t("div",{className:"i-input-prepend",children:y}),!w&&t(He,{active:!0,icon:t(D,{}),onClick:e=>Y(e,-N,0)}),t("input",{value:S.value?.[0]||"",placeholder:x?.[0],...V,onChange:e=>L(e,0)}),!w&&t(He,{active:!0,icon:t(P,{}),onClick:e=>Y(e,N,0)}),t(He,{active:!0,icon:t(O,{}),style:{margin:0},onClick:A}),!w&&t(He,{active:!0,icon:t(D,{}),onClick:e=>Y(e,-N,1)}),t("input",{value:S.value?.[1]||"",placeholder:x?.[1],...V,onChange:e=>L(e,1)}),!w&&t(He,{active:!0,icon:t(P,{}),onClick:e=>Y(e,N,1)}),b&&t("div",{className:"i-input-append",children:b})]})})};const dt=c(((n,a)=>{const{getContainer:r=e=>e?.offsetParent??document.body,trigger:s,arrow:l,arrowProps:o={},className:c,children:d,...u}=n,p=f((()=>{let{left:e,top:t,pos:n}=o,i="";switch(n){case"left":e+=2,i="translate(-100%, -50%) rotate(180deg)";break;case"right":e-=2,i="translate(0, -50%)";break;case"top":t-=2,i="translate(-50%, -50%) rotate(-90deg)";break;case"bottom":t+=2,i="translate(-50%, -50%) rotate(90deg)"}return{left:e,top:t,transform:i}}),[o]),m=e("div",{ref:a,className:i("i-popup",c),...u,children:[l&&t("svg",{xmlns:"http://www.w3.org/2000/svg",className:"i-popup-arrow",style:p,children:t("path",{d:"M0.5 0L1.5 0C1.5 4, 3 5.5, 5 7.5S8,10 8,12S7 14.5, 5 16.5S1.5,20 1.5,24L0.5 24L0.5 0z"})}),d]});return me(m,r(s))}));function ut(i){const{visible:a=!1,content:r,trigger:s="hover",gap:l=12,offset:o=8,fixed:c,position:d="top",showDelay:p=16,hideDelay:g=12,touchable:N,arrow:k=!0,align:C,fitSize:w,watchResize:x,clickOutside:$=!0,disabled:D,referToWindow:P,style:T,className:I,getContainer:z,children:O,onVisibleChange:M}=i,S=b(null),E=b(null),j=ae({show:!1,toggling:!1,style:{position:c?"fixed":"absolute"},arrowProps:{}});se((e=>{if(!$)return;const t=e.target,n=S.current?.contains(t);j.show&&(!n||"contextmenu"===s)&&Y(!1)}),E);const B=()=>{D||j.show&&("hover"!==s||"hover"===s&&!N)||(j.show=!0,j.toggling&&clearTimeout(j.toggling),j.toggling=setTimeout((()=>{const[e,t,{arrowX:n,arrowY:i,arrowPos:a}]=Me(S.current,E.current,{position:d,gap:l,offset:o,align:C,refWindow:P});j.style={...j.style,opacity:1,transform:"none",left:e,top:t},j.arrowProps={left:n,top:i,pos:a},j.toggling&&clearTimeout(j.toggling),M?.(!0)}),p))},L=()=>{j.show&&(j.toggling=setTimeout((()=>{j.style={...j.style,opacity:0,transform:"translate(0, 2px)"},setTimeout((()=>{j.show=!1,j.toggling&&clearTimeout(j.toggling),M?.(!1)}),160)}),g))},Y=e=>{void 0===e?j.show?L():B():e?B():L()},A=le((()=>({click:{onClick:()=>Y(!0)},hover:{onMouseEnter:()=>Y(!0),onMouseLeave:()=>Y(!1)},focus:{onFocus:()=>Y(!0),onBlur:()=>Y(!1)},contextmenu:{onContextMenu:e=>{if(e.preventDefault(),e.stopPropagation(),j.show){const[t,n]=Se(e,E.current);j.style={...j.style,left:t,top:n}}else j.show=!0,j.toggling=setTimeout((()=>{const[t,n]=Se(e,E.current);j.style={...j.style,opacity:1,transform:"none",left:t,top:n},j.toggling&&clearTimeout(j.toggling),M?.(!0)}),p)}},none:{}})),[]),V=f((()=>{if(!N)return{};const e={};return"hover"===s&&(e.onMouseEnter=()=>Y(!0),e.onMouseLeave=()=>Y(!1)),e}),[N,s]),W=()=>{if(!j.show)return;const[e,t,{arrowX:n,arrowY:i,arrowPos:a}]=Me(S.current,E.current,{position:d,gap:l,offset:o,align:C,refWindow:P});Object.assign(j,{style:{...j.style,left:e,top:t},arrowProps:{left:n,top:i,pos:a}})};return u((()=>{if("contextmenu"===s)return;const{observe:e,unobserve:t,disconnect:n}=function(){const e=new WeakMap,t=new ResizeObserver((t=>{t.map((t=>{const n=e.get(t.target);n?.(t.target)}))}));return{observe:function(n,i){e.get(n)||(n&&t.observe(n),e.set(n,i))},unobserve:function(n){n&&t.unobserve(n),e.delete(n)},disconnect:function(){t.disconnect()}}}();return S.current&&e(S.current,W),x&&E.current?(e(E.current,W),()=>{x&&E.current&&(t(E.current),S.current&&t(S.current),n())}):void 0}),[x,E.current,S.current]),y((()=>{if(!w||!j.show)return;const e=["top","bottom"].includes(d),t=S.current?.[e?"offsetWidth":"offsetHeight"];j.style={...j.style,[e?"width":"height"]:t}}),[j.show,w]),y((()=>{Y(a)}),[a]),e(n,{children:[v.map(O,(e=>{if(!m(e))return;const{type:t,props:n}=e;if("function"==typeof t)return e;const{className:i,...a}=n;return h(e,{ref:S,className:i,...A[s],...a})})),j.show&&t(dt,{ref:E,arrow:k&&"contextmenu"!==s,style:{...T,...j.style},arrowProps:j.arrowProps,className:I,...V,trigger:S.current,getContainer:z,children:r})]})}const pt=a=>{const{value:r,month:s,weeks:l=["一","二","三","四","五","六","日"],renderDate:o=e=>e.date(),disabledDate:c,onDateClick:d}=a,u=ue(),p=f((()=>{const e=[],t=s.add(-1,"month").endOf("month");let{$W:n,$D:i}=t;if(0!==n){const i=Array.from({length:n}).map(((e,i)=>t.add(i+1-n,"day")));e.push(...i)}const a=s.endOf("month");return i=a.$D,n=a.$W,e.push(...Array.from({length:i}).map(((e,t)=>a.add(t+1-i,"day")))),0!==n&&e.push(...Array.from({length:7-n}).map(((e,t)=>a.add(t+1,"day")))),e}),[s]),m=re((e=>{c?.(e)||d?.(e)}));return e(n,{children:[t("div",{className:"i-datepicker-weeks",children:l.map(((e,n)=>t("span",{className:"i-datepicker-week",children:e},n)))}),t("div",{className:"i-datepicker-dates",children:p.map(((e,n)=>{const a=e.isSame(r,"day"),l=e.isSame(s,"month"),d=e.isSame(u,"day"),p=c?.(e);return t("div",{className:i("i-datepicker-item",{"i-datepicker-active":a,"i-datepicker-same-month":l,"i-datepicker-today":d,"i-datepicker-disabled":p}),onClick:()=>m(e),children:o(e)},n)}))})]})},mt=[1,2,3,4,5,6,7,8,9,10,11,12],ht=n=>{const{value:i,unitMonth:a="月",unitYear:r="年",renderYear:s,renderMonth:l,onClick:o}=n;return e("a",{className:"i-datepicker-action","data-ripple":!0,onClick:o,children:[t("span",{children:s?.(i.year())}),r,t("span",{children:l?.(i.month()+1)}),a]})},gt=n=>{const{value:a,unitYear:r,unitMonth:l,renderDate:o,renderMonth:c=e=>e,renderYear:d=e=>e,disabledDate:m,onDateClick:h}=n,g=ae({today:a,month:a||ue(),selectedYear:ue(),years:[],selectable:!1}),f=b(null),v=p((e=>{g.month=g.month[e?"add":"subtract"](1,"month")}),[]),y=s({interval:100},(e=>{const t=e.deltaY<0;g.years=g.years.map((e=>e+(t?-1:1)))}));return u((()=>{if(!g.selectable)return;g.selectedYear=g.month;const e=g.selectedYear.year(),t=Array.from({length:7}).map(((t,n)=>e-3+n));g.years=[...t]}),[g.selectable]),u((()=>{g.today=a,g.month=a||ue()}),[a]),e("div",{className:"i-datepicker",children:[e("div",{className:"i-datepicker-units",children:[t(ht,{value:g.month,unitYear:r,unitMonth:l,renderMonth:c,renderYear:d,onClick:()=>g.selectable=!0}),t("a",{className:"ml-auto i-datepicker-action","data-ripple":!0,onClick:()=>v(!1),children:t(ke,{icon:t(M,{})})}),t("a",{className:"i-datepicker-action","data-ripple":!0,onClick:()=>v(!0),children:t(ke,{icon:t(S,{})})})]}),e("div",{className:i("i-datepicker-ym",{"i-datepicker-active":g.selectable}),children:[t(He,{active:!0,className:"i-datepicker-close",onClick:()=>g.selectable=!1}),t("div",{ref:f,className:"i-datepicker-years",onWheel:y,children:g.years.map((e=>t("a",{className:i("i-datepicker-year",{"i-datepicker-active":e===g.selectedYear.year()}),onClick:()=>g.selectedYear=g.selectedYear.year(e),children:d(e)},e)))}),t("div",{className:"i-datepicker-months",children:mt.map((e=>t("a",{className:i("i-datepicker-month",{"i-datepicker-active":e===g.month.month()+1}),onClick:()=>{return t=e,g.month=g.month.year(g.selectedYear.year()).month(t-1),void(g.selectable=!1);var t},children:c(e)},e)))})]}),t(pt,{value:g.today,month:g.month,disabledDate:m,onDateClick:e=>{e.isSame(g.today,"day")||(e.isSame(g.month,"month")||(g.month=e),g.today=e,h?.(e))},renderDate:o})]})};ue.extend(pe);const ft=["YYYY-MM-DD","YYYY-M-D","YYYY/MM/DD","YYYY/M/D"],vt=e=>{const{name:n,value:i,weeks:a,format:r="YYYY-MM-DD",renderDate:s,renderMonth:l,renderYear:o,popupProps:c,disabledDate:d,onDateClick:p,onChange:m,onBlur:h,...v}=e,b=ae({value:i}),[y,N]=g(!1),k=f((()=>{if(!b.value)return null;const e=ue(b.value,r,!0);return e.isValid()?e:null}),[b.value]),C=e=>{b.value=e,m?.(e)},w=()=>{if(!b.value)return;const e=ue(b.value,ft,!0);e.isValid()?C(e.format(r)):C("")};return u((()=>{b.value=i}),[i]),t(ut,{visible:y,trigger:"click",position:"bottom",arrow:!1,align:"start",content:t(gt,{value:k,weeks:a,renderDate:s,renderMonth:l,renderYear:o,disabledDate:d,onDateClick:e=>{C(e.format(r))}}),...c,watchResize:!0,onVisibleChange:N,children:t(lt,{value:b.value,append:t(ke,{icon:t(E,{}),className:"i-datepicker-icon",size:"1em"}),onChange:C,onBlur:e=>{h?.(e),w()},onEnter:w,...v})})},bt=n=>{const{data:a,colon:r,columns:s=1,gap:l=".5em",align:o,labelWidth:c,labelAlign:d,vertical:u,equally:p,style:m,className:h}=n;return t("div",{className:i("i-description",h),style:{"--description-label-width":c,gridTemplateColumns:`repeat(${s}, ${p?"1fr":"auto"})`,gap:l,textAlign:o,...m},children:a.map(((n,a)=>{const{label:s,value:l,style:o,hidden:c,rowSpan:p=1,colSpan:m=1}=n;return c?t(N,{},a):e("div",{className:i("i-description-item",{"i-description-item-vertical":u}),style:{gridColumn:`span ${m}`,gridRow:`span ${p}`,...o},children:[s&&e("div",{className:"i-description-label",style:{textAlign:d},children:[s,r]}),t("div",{className:"i-description-value",children:l})]},a)}))})};function yt(n){const{visible:a,position:r="left",header:s,footer:l,backdropClosable:o=!0,hideCloseButton:c,className:d,children:m,onVisibleChange:h,onClose:f,...v}=n,[y,N]=g(a),[k,C]=g(a),w=b(!0);u((()=>{a?x():$()}),[a]);const x=p((()=>{w.current&&(N(!0),h?.(!0),w.current=!1,setTimeout((()=>{C(!0),w.current=!0}),24))}),[]),$=p((()=>{w.current&&(w.current=!1,C(!1),setTimeout((()=>{N(!1),h?.(!1),w.current=!0,f?.()}),240))}),[]),D=p((function(){o&&$()}),[]);return me(y&&t("div",{className:i("i-backdrop-drawer",d,{"i-active":k}),onClick:D,...v,children:e("div",{className:i("i-drawer",`i-drawer-${r}`),onClick:e=>e.stopPropagation(),children:[e("header",{className:"i-drawer-header",children:[s,t(He,{active:!c,className:"i-drawer-close",onClick:$})]}),t("div",{className:"i-drawer-content",children:m}),t("div",{className:"i-drawer-footer",children:l})]})}),document.body)}const Nt=c(((n,a)=>{const{active:r,type:s,align:l,disabled:o,label:c,style:d,className:u,children:p,...m}=n;return e("li",{ref:a,className:i("i-list-item",u,{"i-list-item-active":r,"i-list-option":"option"===s,disabled:o}),style:{alignItems:l,...d},...m,children:[void 0!==c&&t("span",{className:"i-list-item-label",children:c}),p]})})),kt=e=>{const{label:n,type:a,className:r,children:s,...l}=e;return t("ul",{className:i("i-list",r),...l,children:v.map(s,((e,t)=>{const i="function"==typeof n?n(t):n;return h(e,{label:i,...e.props,type:a})}))})};kt.Virtual=e=>{const{data:n,itemKey:i,renderItem:a,...r}=e;return t(he,{data:n,itemKey:i,...r,children:(e,t)=>a?.(e,t)})},kt.Item=Nt;const{Item:Ct}=kt,wt=e=>{const{width:n,content:i,children:a,...r}=e;return t(ut,{trigger:"click",position:"bottom",touchable:!0,content:t(kt,{className:"i-dropdown-content",style:{minWidth:n},children:i}),...r,children:a})};wt.Item=e=>{const{more:n,moreProps:i,...a}=e,r=t(Ct,{...a});return n?t(ut,{position:"right",touchable:!0,arrow:!1,align:"start",offset:10,hideDelay:240,...i,content:t(kt,{className:"i-dropdown-content",onClick:e=>e.stopPropagation(),children:n}),children:r}):r};const xt=e=>{const{as:n="div",align:a,justify:r,direction:s,wrap:l,gap:o,columns:c,className:d,style:u,...p}=e,m=f((()=>{if(c)return"number"==typeof c?`repeat(${c}, 1fr)`:c}),[c]);return t(n,{...p,style:{alignItems:a,justifyContent:r,gap:o,flexDirection:s,flexWrap:!0===l?"wrap":l,gridTemplateColumns:m,...u},className:i(d,{[c?"grid":"flex"]:!0})})},$t=k({});class Dt{id;data={};cacheData={};rules={};constructor(){this.id=r(8),this.data={}}get(e){return e?this.data[e]:this.data}set(e,t){const n=this.id;if(this.data)return"string"==typeof e?(this.data[e]=t,this.cacheData[e]=t,void ge.publish(`${n}:set:${e}`,t)):void Object.keys(e).map((t=>{this.data[t]=e[t],this.cacheData[t]=e[t],ge.publish(`${n}:set:${t}`,e[t])}))}delete(e){delete this.data[e]}clear(){this.data&&(this.cacheData={},Object.keys(this.data).map((e=>{ge.publish(`${this.id}:set:${e}`,void 0),this.data[e]=void 0})))}async validate(e){const{id:t,rules:n,data:i}=this;if(!n)return i;if(e){const a=n[e],r={validator:e=>Array.isArray(e)?e.length>0:![void 0,null,""].includes(e),message:void 0};"function"==typeof a?r.validator=a:!0===a?r.message="required":Object.assign(r,a);const s=r.validator?.(i[e],this);return s?(ge.publish(`${t}:invalid:${name}`,{message:null,status:"normal"}),!0):(ge.publish(`${t}:invalid:${e}`,{message:r.message,status:"error"}),!1)}let a=!0;return Object.keys(i).map((e=>{const r=n[e];if(void 0===r)return;const s={validator:e=>Array.isArray(e)?e.length>0:!!e,message:void 0};"function"==typeof r?s.validator=r:!0===r?s.message="required":Object.assign(s,r);const l=s.validator?.(i[e],this);l?ge.publish(`${t}:invalid:${e}`,{message:null,status:"normal"}):(ge.publish(`${t}:invalid:${e}`,{message:s.message,status:"error"}),a=!1)})),!!a&&i}}const Pt=e=>{const{form:n={},rules:a,initialValues:r,style:s,className:l,width:o,children:c,onEnter:d,...p}=e;return u((()=>{Object.assign(n,{data:{...r},rules:a})}),[n]),t($t.Provider,{value:n,children:t("form",{style:{...s,width:o},className:i("i-form",l),onKeyDown:e=>{13===e.keyCode&&d?.(n.data,n)},...p,children:c})})};function Tt(i){const{title:a,footer:r,hideCloseButton:s,footerLeft:l,okButtonProps:o={children:"确定",onClick:i.onOk},cancelButtonProps:c={secondary:!0,children:"关闭",onClick:i.onClose},children:d,onClose:u}=i,p=a||!s,m=f((()=>{if(r||null===r)return r;const i=Object.assign({},o),a=Object.assign({},c);return e(n,{children:[l,t(Ne,{...i}),t(Ne,{...a})]})}),[r,o,c]);return e(n,{children:[p&&e("header",{className:"i-modal-header",children:[a&&t("b",{children:a}),t(He,{active:!s,className:"i-modal-close",onClick:u})]}),t("div",{className:"i-modal-content",children:d}),t("footer",{className:"i-modal-footer",children:m})]})}function It(n){const{visible:a,title:r,footer:s,okButtonProps:l,cancelButtonProps:o,closable:c=!0,hideBackdrop:d,backdropClosable:m=!0,hideCloseButton:h,width:f,height:v,customized:y,fixed:N,shadow:k=!0,children:C,style:w,className:x,footerLeft:$,onVisibleChange:D,onClose:P,onOk:T,...I}=n,[z,O]=g(a),[M,S]=g(!1),[E,j]=g(!1),B=b(!0),L=p((()=>{B.current&&(O(!0),B.current=!1,setTimeout((()=>{S(!0),D?.(!0),B.current=!0}),24))}),[]),Y=p((()=>{if(B.current){if(B.current=!1,!c)return j(!0),void setTimeout((()=>{j(!1),B.current=!0}),400);S(!1),setTimeout((()=>{O(!1),B.current=!0,D?.(!1),P?.()}),240)}}),[c]),A=p((function(){m&&Y()}),[c,m]);return u((()=>{a?L():Y()}),[a]),z?me(t("div",{className:i("i-modal-container",{"i-modal-backdrop":!d,"i-modal-customized":y,"i-modal-active":M,fixed:N},x),style:w,onClick:A,children:e("div",{className:i("i-modal",{bounced:E,shadow:k}),style:{width:f,height:v},onClick:e=>e.stopPropagation(),...I,children:[y&&C,!y&&t(Tt,{title:r,hideCloseButton:h,footer:s,okButtonProps:l,cancelButtonProps:o,children:C,footerLeft:$,onOk:T,onClose:Y})]})}),document.body):null}Pt.useForm=function(e){const t=b();return t.current||(t.current=e??new Dt),t.current},Pt.Field=function(e){const{name:t,required:n,children:i}=e,a=ae({value:void 0,status:"normal",message:void 0,update:0}),r=C($t),{id:s}=r,l=f((()=>v.map(i,(e=>{if(!m(e))return null;const{onChange:i}=e.props,{value:s,status:l,message:o}=a;return h(e,{value:s,status:l,message:o,required:n,onChange:(...e)=>{var n;n=e[0],t&&r.set(t,n),i?.(...e),Object.assign(a,{status:"normal",message:void 0})}})}))),[i,a.update]);return u((()=>{if(t)return ge.subscribe(`${s}:set:${t}`,((e,t)=>{a.value=t,a.update+=1})),ge.subscribe(`${s}:invalid:${t}`,((e,t)=>{Object.assign(a,t),a.update+=1})),Promise.resolve().then((()=>{r.set(t,r.cacheData[t]??void 0)})),()=>{ge.unsubscribe(`${s}:set:${t}`),ge.unsubscribe(`${s}:invalid:${t}`),r.delete(t)}}),[t,i]),t?l:i};const zt=c(((e,n)=>{const i=ae({});return w(n,(()=>({update:(e={})=>{Object.assign(i,e)}}))),t(It,{...e,...i})})),Ot=e=>{const{as:n="span",size:a,weight:r,decoration:s,gradient:l,style:o,className:c,children:d}=e,u=f((()=>l&&Array.isArray(l)?{background:`-webkit-linear-gradient(${l.join(",")})`,backgroundClip:"text"}:{}),[l]);return t(n,{style:{fontSize:a,fontWeight:r,textDecoration:s,...u,...o},className:i(c,{"i-text-gradient":l}),children:d})};function Mt(n){const{value:i,height:a=40,size:r=8}=n;return e("div",{className:"i-progress-circle",children:[e("svg",{width:a,height:a,children:[t("circle",{cx:a/2,cy:a/2,r:a/2-r/2,fill:"none",stroke:"var(--background-opacity-2)",strokeWidth:r}),t("circle",{cx:a/2,cy:a/2,r:a/2-r/2,fill:"none",stroke:"var(--color-main)",strokeWidth:r,strokeDasharray:100,pathLength:100,className:"i-progress-circle-path",strokeLinecap:"round",style:{strokeDashoffset:`calc(100 - ${i})`}})]}),e("span",{className:"i-progress-circle-value",children:[t("span",{children:i}),t(Ot,{size:".81em",className:"color-7",children:"%"})]})]})}Ot.Number=function(e){const{count:n,to:i,decimal:a,thousand:r=",",duration:s=2400,easing:l,...o}=e,[c,d]=g(n),p=f((()=>{if(void 0===c)return;const e=c.toFixed(a);return r?Be(c,{precision:a,thousand:r}):e}),[c,r]);return u((()=>{void 0!==n&&void 0!==i&&function(e,t,n=1e3,i,a=e=>1-Math.pow(1-e,4)){const r=performance.now(),s=t-e;let l=requestAnimationFrame((function e(){l=requestAnimationFrame(e);let t=(performance.now()-r)/n;t>=1&&(t=1,cancelAnimationFrame(l));const o=s*a(t);i?.(o)}))}(n,i,s,(e=>d(n+e)),l)}),[i]),u((()=>d(n)),[n]),t(Ot,{...o,children:p})},Ot.Time=function(e){const{seconds:n,zero:i,units:a,...r}=e,s=f((()=>void 0===n?"":function(e,t){const n=[],{zero:i=!0,units:a=["",":",":"]}=t||{},r=a.length;let s=0;for(;s<r&&!(e<=0&&s>1);){const t=Math.round(e%60);e=Math.floor(e/60),n.unshift((i&&t<10?`0${t}`:t)+a[s++])}return n.join("")}(n,{zero:i,units:a})),[n]);return t(Ot,{...r,children:s})};const St=c(((e,n)=>{const{value:a,size:r,barClass:s,dragging:l,renderCursor:o,onMouseDown:c}=e;return t("div",{ref:n,className:"i-progress",style:{height:r},onMouseDown:c,children:t("div",{className:i("i-progress-bar",s,{"no-transition":l}),style:{width:`${a}%`},children:o&&t("a",{className:"i-progress-cursor",children:o(a??0)})})})})),Et=n=>{const{value:a=0,size:r=8,height:s=40,precision:l=0,style:o,draggable:c=!0,type:d="line",barClass:p,label:m,labelInline:h,className:g,renderCursor:v,onChange:y}=n,N=b(null),k=ae({value:a,dragging:!1,width:0,start:0}),C=f((()=>{let e=+k.value.toFixed(l);return e=Math.min(100,e),e=Math.max(0,e),e}),[k.value,l]),w=re((e=>{if(!N.current||!c)return;const t=N.current.getBoundingClientRect(),n=100*(e.pageX-t.left)/t.width;Object.assign(k,{value:n,width:t.width,start:t.left,dragging:!0})})),x=re((e=>{if(!k.dragging||!c)return;e.preventDefault();const{start:t,width:n}=k,i=e.pageX-t;i<0||i>n||(k.value=100*(e.pageX-t)/n)})),$=re((()=>{k.dragging&&c&&(y?.(C),k.dragging=!1)}));return _e(x),Je($),u((()=>{k.value=a>100?100:a<0?0:a}),[a]),e("div",{className:i("i-input-label",g,{"i-input-inline":h}),style:o,children:[m&&t("span",{className:"i-input-label-text",children:m}),"line"===d&&t(St,{ref:N,size:r,barClass:p,dragging:k.dragging,value:k.value,renderCursor:v,onMouseDown:w}),"circle"===d&&t(Mt,{value:k.value,height:s,size:r})]})},jt=c(((n,a)=>{const{style:r,hideControls:s,autoplay:l,muted:o,volume:c=50,height:d,width:p,useOriginControls:m,timeProgressProps:h={barClass:"bg-2"},volumeProgressProps:g={barClass:"bg-1"},className:f,onFullScreenChange:v,...y}=n,N=ae({playing:l,volume:o?0:c,volumeCache:0,muted:o,current:0,duration:0,isFullscreen:!1}),k=b(null),C=e=>{const t=e.target;t.paused||Object.assign(N,{current:t.currentTime})},x=e=>{N.playing=!e.target.paused},$=()=>{const e=k.current?.parentElement;e&&(N.isFullscreen=document.fullscreenElement===e)},D=e=>{const t=e.target;Object.assign(N,{volume:100*t.volume,muted:0===t.volume})},P=()=>{const e=k.current;e&&(e.paused?e.play():e.pause())},T=()=>{const e=k.current;e&&(e.currentTime=0,e.pause())},I=()=>{const e=k.current?.parentElement;var t;e&&(N.isFullscreen?document.exitFullscreen?.():(t=e,t.requestFullscreen?.()),v?.(!N.isFullscreen))};return w(a,(()=>({play:()=>{const e=k.current;e&&e.play()},pause:()=>{const e=k.current;e&&e.pause()},stop:T,fullscreen:I,getVideo:()=>k.current}))),u((()=>{const e=k.current;if(e)return e.addEventListener("timeupdate",C),e.addEventListener("play",x),e.addEventListener("pause",x),e.addEventListener("volumechange",D),document.addEventListener("fullscreenchange",$),()=>{e.removeEventListener("timeupdate",C),e.removeEventListener("play",x),e.removeEventListener("pause",x),e.removeEventListener("volumechange",D),document.removeEventListener("fullscreenchange",$)}}),[]),e("div",{className:i("i-video",f),style:{height:d,width:p,...r},onClick:P,onDoubleClick:()=>I(),children:[t("video",{ref:k,onCanPlay:e=>{const t=e.target;Object.assign(N,{duration:t.duration,current:t.currentTime}),t.volume=N.volume/100},...y,controls:m}),!s&&!m&&e("div",{className:"i-video-controls",onClick:e=>e.stopPropagation(),children:[e("div",{className:"i-video-control flex-1",children:[t(Ne.Toggle,{className:"i-video-btn",flat:!0,square:!0,after:t(ke,{icon:t(j,{})}),active:N.playing,onClick:P,children:t(ke,{icon:t(B,{})})}),t(Ne,{className:"i-video-btn",flat:!0,square:!0,onClick:T,children:t(ke,{icon:t(L,{})})}),e("span",{className:"i-video-times",children:[t(Ot.Time,{seconds:N.current})," /",t(Ot.Time,{seconds:N.duration})]}),t(Et,{className:"mr-8",...h,value:N.current/N.duration*100,onChange:e=>{const t=k.current;t&&(t.currentTime=N.duration*e/100)}})]}),t("div",{className:"i-video-control",children:t(Ne.Toggle,{className:"i-video-btn",flat:!0,square:!0,after:t(ke,{icon:t(Y,{})}),active:N.isFullscreen,onClick:()=>I(),children:t(ke,{icon:t(A,{})})})}),e("div",{className:"i-video-control",children:[t(Ne.Toggle,{className:"i-video-btn",flat:!0,square:!0,active:N.volume<=0,after:t(ke,{icon:t(V,{}),size:"1.2em"}),onClick:()=>{const e=k.current;if(e)return e.volume>0?(N.volumeCache=e.volume,void(e.volume=0)):void(e.volume=0===N.volumeCache?.5:N.volumeCache)},children:t(ke,{icon:t(W,{})})}),t(Et,{style:{width:100},className:"mr-8",...g,value:N.volume,onChange:e=>{const t=k.current;t&&(t.volume=e/100)}})]})]})]})}));function Bt(n){const{name:i,suffix:a,type:r}=n;switch(r){case Oe.IMAGE:return t("img",{src:n.src});case Oe.VIDEO:return t(jt,{...n});default:return e("div",{className:"i-preview-unknown",children:[t(ke,{icon:t(q,{}),size:"3em"}),t("h5",{className:"mt-4",children:i||a||"?"})]})}}function Lt(i){const{items:a=[],initial:r=0,renderFile:l=Bt,onRotate:o,onChange:c,onClose:d,onZoom:u}=i,p=ae({current:r,rotate:0,scale:1,translate:"0, 0"}),m=b(null),h=f((()=>a.map((e=>{const t={src:""};return"string"==typeof e?t.src=e:Object.assign(t,e),t.suffix=Ye(t.src)||"",t.type=Ae(t.suffix,e.type),t}))),[a]),{file:g,content:v}=f((()=>{const e=h[p.current];return{file:e,content:l(e)}}),[p.current,a]),y=g.type===Oe.IMAGE,N=e=>{const t=h.length,{current:n}=p;p.current=e>=t?0:e<0?t-1:e,c?.(p.current,n),p.rotate=h[p.current].rotate||0,1!==p.scale&&(p.scale=1,u?.(1)),o?.(p.rotate)},k=e=>{p.rotate+=e,o?.(p.rotate)},C=s({interval:60},(e=>{if(!y)return;let t=p.scale+(e.deltaY<0?.05:-.05);t>2&&(t=2),t<.25&&(t=.25),u?.(t),p.scale=t}));return e(n,{children:[t("div",{ref:m,className:"i-preview-content",style:{transform:`rotate(${p.rotate}deg) scale(${p.scale})`},onWheel:C,onClick:e=>e.stopPropagation(),children:v}),e("div",{className:"i-preview-controls",children:[t(Ne,{square:!0,flat:!0,onClick:d,children:t(ke,{icon:t($,{})})}),h.length>1&&e("span",{className:"px-8",children:[p.current+1," / ",h.length]}),1!==p.scale&&e(Ne,{flat:!0,onClick:()=>p.scale=1,children:[t(ke,{icon:t(F,{})}),e("span",{className:"mt-4",children:[(100*p.scale).toFixed(0),"%"]})]}),t(Ne,{square:!0,flat:!0,href:g.src,target:"_blank",children:t(ke,{icon:t(H,{})})}),t(Ne,{square:!0,flat:!0,href:g.src,download:!0,target:"_blank",children:t(ke,{icon:t(R,{})})}),t(Ne,{square:!0,flat:!0,onClick:()=>k(90),children:t(ke,{icon:t(X,{})})}),t(Ne,{square:!0,flat:!0,onClick:()=>k(-90),children:t(ke,{icon:t(U,{})})}),h.length>1&&e(n,{children:[t(Ne,{square:!0,flat:!0,onClick:()=>N(p.current-1),children:t(ke,{icon:t(M,{})})}),t(Ne,{square:!0,flat:!0,onClick:()=>N(p.current+1),children:t(ke,{icon:t(S,{})})})]})]})]})}function Yt(){const e=b(null);return n=>{const{items:i,modalProps:a,onClose:r,...s}=n,l=Le(t(zt,{ref:e,visible:!0,className:"i-preview",customized:!0,shadow:!1,...a,children:t(Lt,{...s,items:i,onClose:()=>{e.current?.update({visible:!1})}}),fixed:!0,onClose:()=>{r?.(),l?.()}}))}}const At=a=>{const{src:r,round:s,size:l,initSize:o,lazyload:c,fallback:d=t(ke,{icon:t(G,{}),size:"2em",className:"color-5"}),fit:p,style:m,className:h,cover:g,coverClass:f,usePreview:v,onLoad:y,onError:N,onClick:k,...C}=a,w=ae({status:"loading"}),x=b(null),$=p?"100%":void 0,{observe:D,unobserve:P}=Qe(),T=Yt(),I=e=>{k?.(e),v&&r&&T({items:[{src:r,type:Oe.IMAGE}]})};u((()=>{if(r&&(w.status="loading",c&&x.current))return D(x.current,((e,t)=>{t&&(e.setAttribute("src",e.dataset.src||""),P(e))})),()=>{x.current&&P(x.current)}}),[r]),C[c?"data-src":"src"]=r;const z="loading"===w.status?o:void 0;return t("div",{style:{width:l??z,height:l??z,...m},className:i("i-image",h,{rounded:s,[`i-image-${w.status}`]:w.status}),children:"error"===w.status?d:e(n,{children:[r&&t("img",{ref:x,style:{objectFit:p,width:$,height:$},...C,onLoad:e=>{y?.(e),w.status=void 0},onError:e=>{N?.(e),w.status="error"},onClick:I}),r&&"loading"===w.status&&t(be,{}),g&&t("div",{className:i("i-image-cover",f),onClick:I,children:g})]})})};At.List=function(e){const{items:n=[],gap:i=8,columns:a,wrap:r,direction:s,usePreview:l,onClick:o,...c}=e,d=Yt(),u=f((()=>n.map((e=>{const t={src:""};return"string"==typeof e?t.src=e:Object.assign(t,e),t.suffix=Ye(t.src)||"",t.type=Ae(t.suffix,e.type),t}))),[n]);return u.length?t(xt,{className:"i-image-list",gap:i,columns:a,wrap:r,direction:s,children:u.map(((e,n)=>t(At,{src:e.src,size:60,usePreview:!1,onClick:e=>((e,t)=>{o?.(e),l&&d({items:u,initial:t})})(e,n),...c},n)))}):""};const Vt={left:"flex-start",center:"center",right:"flex-end"},Wt=12,qt={duration:3e3,closable:!0,active:!1},Ft=function(){const e=document.createElement("div");return e.dataset.id="messages",document.body.append(e),e}(),Ht={callout(e){},close(){}},Rt={left:[],center:[],right:[]},Xt={left:[],center:[],right:[]};ce(Ft).render(t((function(){const i=b(null),a=ae({items:{left:[],center:[],right:[]},tops:{left:[],center:[],right:[]}}),r={left:0,center:0,right:0};u((()=>{Object.assign(Ht,{callout:function(e){const{align:t="center",unshift:n,onShow:r}=e,s=Rt[t][n?"unshift":"push"](e);a.items[t]=[...Rt[t]],setTimeout((()=>{const e=i.current?.offsetHeight||0;Rt[t][n?0:s-1].active=!0,a.items[t]=[...Rt[t]],Xt[t][n?"unshift":"push"](e),a.tops[t]=[...Xt[t]],r?.()}),0),0!==e.duration&&setTimeout(this.close.bind(e),e.duration)},close:function(){const e=this,{align:t="center",onHide:n}=e,i=Rt[t].findIndex((t=>t.id===e.id));i<0||(Rt[t][i].active=!1,a.items[t]=[...Rt[t]],e.timer=setTimeout((()=>{const i=Rt[t].findIndex((t=>t.id===e.id));Rt[t].splice(i,1),Xt[t].splice(i,1),a.tops[t]=[...Xt[t]],a.items[t]=[...Rt[t]],e.timer&&clearTimeout(e.timer),n?.()}),240))}})}),[]);const s=(e,s)=>{if(!e)return t(n,{});const{id:l,active:o,content:c,align:d="center",className:u}=e;r[d]+=a.tops[d][s-1]||0;const p=Wt*s+r[d];return t(Ut,{ref:i,active:o,content:c,top:p,className:u,style:{alignSelf:Vt[d]},onClick:Ht.close.bind(e)},l)};return e("div",{className:"i-messages",children:[a.items.left.map(s),a.items.center.map(s),a.items.right.map(s)]})}),{}));const Ut=c((function({active:e,content:n,top:a,className:r,style:s,onClick:l},o){return t("div",{ref:o,className:i("i-message",r,{"i-message-active":e}),style:{...s,top:a},onClick:l,children:n})}));function Gt(e){return(["string","number"].includes(typeof e)||m(e))&&(e={content:e}),e=Object.assign({id:r(7)},qt,e),Ht.callout(e),Ht.close.bind(e)}Gt.error=e=>Gt({content:e,className:"bg-error"}),Gt.success=e=>Gt({content:e,className:"bg-success"}),Gt.warning=e=>Gt({content:e,className:"bg-warning"}),It.useModal=function(){const e=b(null);return{open:n=>{const i=Le(t(zt,{ref:e,visible:!0,...n,onClose:()=>{n.onClose?.(),i?.()}}))},update:t=>{if(!e.current)return;const{update:n}=e.current;n(t)}}};const Kt=n=>{const{page:a,active:r,children:s,onChange:l}=n,[o,c]=g(!1);return e("a",{className:i("i-page",{"i-page-active":r,"i-page-loading":o,"i-page-disabled":!1}),"data-page":a,onClick:async()=>{r||o||(c(!0),await(l?.(a)),c(!1))},children:[o&&t(be,{}),s]})},Zt=a=>{const{page:r=1,size:s=10,total:l=0,sibling:o=2,prev:c=t(ke,{icon:t(M,{})}),next:d=t(ke,{icon:t(S,{})}),simple:p,jumper:m,className:h,renderEllipsis:v=()=>t(ke,{icon:t(K,{}),className:"color-7"}),renderPage:b=e=>e,onChange:y,...N}=a,[k,C]=g(r),[w,x]=g(!1),$=f((()=>Math.ceil(l/s)),[s,l]),[D,P,T]=f((()=>{const e=Math.max(1,k-o),t=Math.min($,k+o);return[e,t,Array.from({length:t-e+1}).map(((t,n)=>e+n))]}),[k,$,o]);if($<=k&&1===k)return t(n,{});const I=async e=>{if(y&&!w)return x(!0),new Promise((async t=>{void 0!==e&&(await y(e),C(e),x(!1),t())}))};return u((()=>C(r)),[r]),e("div",{className:i("i-pagination",h),...N,children:[c&&t(Kt,{page:k-1||1,onChange:I,children:c}),D>1&&t(Kt,{page:1,onChange:I,children:b(1)}),D>2&&v(),T.map((e=>t(Kt,{page:e,active:e===k,onChange:I,children:b(e)},e))),P<$-1&&v(),P<$&&t(Kt,{page:$,onChange:I,children:b($)}),d&&t(Kt,{page:k+1,onChange:I,children:d})]})},_t={children:"确定"},Jt={children:"取消",secondary:!0},Qt=n=>{const{trigger:i="click",visible:a,icon:r=t(ke,{icon:t(Z,{}),className:"error"}),content:s,okButtonProps:l,cancelButtonProps:o,children:c,align:d="end",position:u="top",offset:p=12,extra:m,onOk:h,onClose:g,...f}=n,v=ae({loading:!1,visible:a}),b=l?Object.assign({},_t,l):_t,y=o?Object.assign({},Jt,o):Jt,N=e("div",{className:"i-popconfirm",children:[e(xt,{gap:12,children:[r,t("div",{className:"i-popconfirm-content",children:s})]}),e(xt,{gap:12,justify:"flex-end",className:"mt-8 i-popconfirm-footer",children:[null!==o&&t(Ne,{...y,onClick:async e=>{y.onClick?.(e),await(g?.()),v.visible=!1}}),m,null!==l&&t(Ne,{loading:v.loading,...b,onClick:async e=>{v.loading=!0,b.onClick?.(e),await(h?.()),v.loading=!1,v.visible=!1}})]})]});return t(ut,{content:N,...f,trigger:i,visible:v.visible,align:d,offset:p,position:u,onVisibleChange:e=>{v.visible=e,f.onVisibleChange?.(e)},children:c})};function en(n){const{type:a="default",name:r,value:s,checked:l,disabled:o,children:c,onChange:d}=n;return e("label",{className:i("i-radio-item",{disabled:o}),children:[t("input",{type:"radio",name:r,checked:l,className:i("i-radio-input",`i-radio-${a}`),disabled:o,onChange:e=>{d?.(s,e)}}),t("span",{className:"i-radio-text",children:c})]})}function tn(n){const{label:a,name:r,options:s,value:l,type:o="default",status:c="normal",message:d,optionInline:p=!0,labelInline:m,disabled:h,required:g,className:v,onChange:b}=n,y=ae({value:l}),N=f((()=>je(s)),[s]),k=re(((e,t)=>{y.value=e,b?.(e,t)}));return u((()=>{y.value=l}),[l]),e("div",{className:i("i-radio i-input-label",{[`i-radio-${c}`]:"normal"!==c,"i-input-inline":m},v),children:[a&&e("span",{className:"i-input-label-text",children:[g&&t("span",{className:"error",children:"*"}),a,d&&t("p",{className:"i-radio-message",children:d})]}),t("div",{className:i("i-radio-options",{"i-options-block":!p,"i-radio-options-button":"button"===o}),children:N.map((e=>t(en,{name:r,value:e.value,checked:y.value===e.value,type:o,disabled:h||e.disabled,onChange:k,children:e.label},e.value)))})]})}tn.Item=en;const nn=n=>{const{dot:a,dotClass:r,outline:s,round:l,size:o="normal",className:c,children:d,onClose:u,onClick:p,...m}=n;return e("span",{className:i("i-tag",{"i-tag-outline":s,"i-tag-clickable":p,[`i-tag-${o}`]:"normal"!==o,round:l},c),onClick:p,...m,children:[a&&t("span",{className:i("i-tag-dot",r)}),d,u&&t(He,{active:!0,className:"i-tag-close",onClick:u})]})},an=n=>{const{value:a,options:r,filter:s,filterPlaceholder:l,multiple:o,empty:c=t(Xe,{}),onSelect:d,onFilter:u}=n;return e("div",{className:i("i-select-options",{"i-select-options-multiple":o}),children:[s&&o&&e("div",{className:"i-select-filter",children:[t(ke,{icon:t(_,{}),className:"color-8 ml-8 my-auto",size:"1.2em"}),t("input",{type:"text",className:"i-input",placeholder:l,onChange:u})]}),0===r.length&&c,r.map(((n,i)=>{const{label:r,value:s,disabled:l}=n,c=o?a?.includes(s):a===s;return e(kt.Item,{active:c,type:"option",onClick:()=>d?.(s,n),disabled:l,children:[o&&t(ke,{icon:t(J,{}),className:"i-select-option-check",size:"1em"}),r]},s||i)}))]})},rn=n=>{const{options:i,value:a,maxDisplay:r,multiple:s,onSelect:l}=n;return s?((e=[],t=[],n=3)=>{const i=e.flatMap((e=>t.includes(e.value)?[e]:[]));if(n>=i.length)return i;const a=i.length-n,r=i.slice(0,n);return r.push(a),r})(i,a,r).map(((n,i)=>{if("number"==typeof n)return e(nn,{children:["+",n]},i);const{label:a,value:r}=n;return t(nn,{onClose:e=>{e?.stopPropagation(),l?.(r,n)},children:a},r)})):i.find((e=>e.value===a))?.label},sn=c(((n,r)=>{const{type:s="text",name:l,label:o,value:c="",placeholder:d,options:m=[],multiple:h,prepend:v,append:b,labelInline:y,style:N,className:k,message:C,status:w="normal",hideClear:x,maxDisplay:$,border:D,filter:P,tip:T,filterPlaceholder:I="...",popupProps:z,onSelect:O,onChange:M,...S}=n,E=ae({inputValue:"",filterValue:"",value:c,loading:!1}),[j,B]=g(!1),L=f((()=>je(m)),[m]),Y=f((()=>{const{filterValue:e}=E;if(!e||!P)return L;const t="function"==typeof P?P:t=>t.value.includes(e)||t.label.includes(e);return L.filter(t)}),[L,P,E.filterValue]),A=e=>{E.value=e,M?.(e)},V=p(((e,t)=>{if(O?.(e,t),h){const t=[...E.value],n=t.findIndex((t=>t===e));return n>-1?t.splice(n,1):t.push(e),void A(t)}B(!1),A(e)}),[]),W=re(a({delay:400},(e=>{const t=e.target.value;E.filterValue=t})));u((()=>{E.value=c}),[c]);const q=h?E.value.length>0:!!E.value,F=!x&&j&&q,H=C??T;return e("label",{className:i("i-input-label",k,{"i-input-inline":y}),style:N,children:[o&&t("span",{className:"i-input-label-text",children:o}),t(ut,{position:"bottom",arrow:!1,fitSize:!0,...z,visible:j,trigger:"none",onVisibleChange:e=>{B(e),P&&(E.filterValue="")},content:t(an,{options:Y,value:E.value,multiple:h,filter:!!P,filterPlaceholder:I,onSelect:V,onFilter:W}),children:e("div",{className:i("i-input-item",{[`i-input-${w}`]:"normal"!==w,"i-input-borderless":!D,"i-input-focus":j}),onClick:()=>B(!0),children:[v,t("input",{ref:r,type:"hidden",value:E.value,...S}),h?q?t("div",{className:i("i-input i-select",{"i-select-multiple":h}),children:rn({options:L,value:E.value,multiple:h,maxDisplay:$,onSelect:V})}):t("input",{className:"i-input i-select",placeholder:d,readOnly:!0}):null,!h&&t("input",{value:j?E.filterValue:E.value,className:"i-input i-select",placeholder:E.value||d,onChange:e=>{E.filterValue=e.target.value},readOnly:!P}),t(He,{active:!0,icon:F?void 0:t(Q,{}),onClick:e=>{j&&A(h?[]:"")}}),b]})}),H&&t("span",{className:"i-input-message",children:H})]})}));function ln(){return t("i",{className:"i-step-divider"})}const on=["finished","active","pending"];function cn(e,n){return t("span",{className:"i-step-item-index",children:"finished"===n?t(J,{style:{width:"1em",height:"1.5em"}}):e+1})}function dn(a){const{index:r=0,active:s=0,renderIcon:l=cn,title:o,vertical:c,line:d=t(ln,{}),asList:u,style:p,className:m,children:h,onClick:g}=a,f=on[r===s?1:r<s?0:2];return t("div",{style:p,className:i("i-step-item",{[`i-step-item-${f}`]:!u},m),onClick:()=>{g?.(r)},children:e(n,c?{children:[e("div",{className:"i-step-item-left",children:[l?.(r,f),d]}),e("div",{className:"i-step-item-right",children:[t("div",{className:"i-step-item-title",children:o}),h&&t("div",{className:"i-step-item-content",children:h})]})]}:{children:[e("div",{className:"i-step-item-title",children:[l?.(r,f),t("span",{children:o}),d]}),h&&t("div",{className:"i-step-item-content",children:h})]})})}const un=e=>{const{active:n=0,vertical:a,renderIcon:r,line:s,style:l,asList:o,className:c,children:d,onClick:u}=e,p=f((()=>{const e=[];let t=0;return v.map(d,(i=>{if(!i||i.type!==dn)return;const{props:l}=i;e.push({...i,props:{renderIcon:r,line:s,onClick:u,...l,vertical:a,active:n,asList:o,index:t++}})})),e}),[n,d]);return t("div",{className:i("i-step",{"i-step-vertical":a},c),style:l,children:p})};function pn(e){const{index:n=0,active:a,type:r,transition:s,gap:l=0,itemHeight:o,vertical:c,style:d,className:u,children:p}=e,m=f((()=>"normal"===r?{[c?"paddingBlock":"paddingInline"]:l/2,height:o}:{transform:`translate(-${100*n}%, 0)`,transition:s}),[n,l,o,c,r]);return t("div",{style:{...d,...m},className:i("i-swiper-item",u,{"i-swiper-active":a}),"data-index":n,children:p})}un.Item=dn;const mn=c(((a,r)=>{const{type:s="normal",initial:l=0,display:o=1,scroll:c=1,loop:d=!0,vertical:m,prev:h=t(ke,{icon:t(M,{}),size:"2em"}),next:g=t(ke,{icon:t(S,{}),size:"2em"}),duration:y=600,interval:N=3e3,autoplay:k,pauseOnHover:C,arrow:x=!0,reverse:$,draggable:D,dragOffset:P=40,gap:T=0,itemHeight:I,indicator:z,style:O,className:E,children:j,renderIndicator:B,onBeforeSwipe:L,onAfterSwipe:Y}=a,A=b(null),V=b(null),W=`all ${y/1e3}s`,q=ae({current:l,swipable:!0,transition:"fade"===s?"none":W,dragStart:0,dragging:!1,initialized:!1}),F=f((()=>v.map(j,(e=>{if(e.type===pn)return e}))),[j]),[H,R,X,U,G]=f((()=>{const e="normal"===s&&d&&F.length>o?o+1:0;let t=[];if(e<=0)t=[...F];else{const n=F.slice(0,e);t=[...F.slice(-e),...F,...n]}const n=t.length/o*100+"%";return[t,e,F.length,t.length,n]}),[o,d,s,F]),K=f((()=>-100*(q.current+R)/U),[q.current,U]),Z=f((()=>{if(X<=o||"fade"===s)return;return`translate3d(${m?`0, ${K}%`:`${K}%, 0`}, 0)`}),[K,m,o,X,s]),_=f((()=>{if(m&&I)return{height:I*o}}),[m,I,o]),J=f((()=>Array.from({length:Math.ceil((X-o)/c)+1})),[d,z]),Q=()=>{clearTimeout(V.current),V.current=null},ee=p((e=>{if(!q.swipable||e===q.current)return;q.swipable=!1,L?.(q.current);let t=!1,n=e;const i=X-o;return d?e>i?(t=!0,e=X,n=0):e<0&&(t=!0,e=-o,n=i):(n=We(n,0,i),e=n),setTimeout((()=>{q.swipable=!0}),y+32),"fade"===s?(q.current=n,void Y?.(n)):(q.current=e,t?void setTimeout((()=>{q.transition="none",q.current=n,Y?.(n),k&&(V.current=setTimeout(te,N)),setTimeout((()=>{q.transition=W}),60)}),y+20):(k&&(V.current=setTimeout(te,N)),void setTimeout((()=>{Y?.(n)}),y+12)))}),[y,k]),te=()=>{ee($?q.current-c:q.current+c)},ne=()=>{ee($?q.current+c:q.current-c)},ie=p((e=>{D&&q.swipable&&"fade"!==s&&(e.stopPropagation(),Object.assign(q,{dragStart:m?e.clientY:e.clientX,dragging:!0,transition:"none"}))}),[D,m]),re=p((e=>{if(!q.dragging||!A.current)return;e.preventDefault();const t=61.8*((m?e.clientY:e.clientX)-q.dragStart)/A.current[m?"offsetHeight":"offsetWidth"]+K;A.current.style.transform=`translate3d(${m?`0, ${t}%`:`${t}%, 0`}, 0)`}),[m,A.current,K]),se=p((e=>{if(!q.dragging||!A.current)return;const t=m?e.clientY:e.clientX,n=A.current[m?"offsetHeight":"offsetWidth"]/U,i=.618*(t-q.dragStart),a=Math.abs(i);if(a>P){const e=Math.floor(a/n)+(a%n-P>0?1:0);let t=q.current+(i>0?-e:e);ee(t)}A.current.style.transform=Z||"",Object.assign(q,{dragging:!1,transition:W})}),[m,A.current,K]);return _e(re),Je(se),w(r,(()=>({swipeTo:ee,swipeNext:te,swipePrev:ne}))),u((()=>{if(k)return V.current=setTimeout(te,N),()=>{clearTimeout(V.current),V.current=null}}),[k,N]),e("div",{style:O,className:i("i-swiper",{"i-swiper-vertical":m,"i-swiper-initialized":q.initialized},E),children:[e("div",{className:"i-swiper-track",style:_,onMouseOver:()=>{C&&Q()},onMouseLeave:()=>{C&&(Q(),V.current=setTimeout(te,N))},children:[t("div",{ref:A,className:i("i-swiper-list",{"i-swiper-fade":"fade"===s}),style:{[m?"height":"width"]:G,transform:Z,transition:q.transition},onMouseDown:ie,children:H.map(((e,n)=>{const{props:i}=e;return t(pn,{index:n,active:n-R===q.current,type:s,gap:T,transition:W,itemHeight:I,vertical:m,...i},n)}))}),x&&e(n,{children:[t("a",{className:"i-swiper-arrow i-swiper-prev",onClick:ne,children:h}),t("a",{className:"i-swiper-arrow i-swiper-next",onClick:te,children:g})]})]}),z&&t("div",{className:"i-swiper-indicators",children:J.map(((e,n)=>t("a",{className:i("i-swiper-indicator",{"i-indicator-active":n===Math[d?"floor":"ceil"]((q.current+X)%X/c)}),onClick:()=>ee(n*c),children:B?.(n)},n)))})]})}));mn.Item=pn;const hn=c(((n,a)=>{const{active:r,tabs:s,type:o="default",prepend:c,append:d,children:p,className:m,vertical:h,toggable:g,bar:f=!0,hideMore:y,barClass:N,renderMore:k=()=>t(Ne,{flat:!0,square:!0,size:"small",children:t(ke,{icon:t(K,{})})}),onTabChange:C,...x}=n,$=b([]),D=b(null),P=b(null),T=ae({active:r,prevActive:void 0,barStyle:{},cachedTabs:[],overflow:!1,more:[],tabs:[]}),{observe:I,unobserve:z}=Qe(),O=oe(P);u((()=>{if(!s)return p?void(T.tabs=v.map(p,((e,t)=>{const{key:n,props:i}=e,{title:a,children:r,content:s,keepDOM:o}=i,c=r?"string"==typeof r?r:l(r,["props","type","$$typeof","ref"]):s;return{key:n||String(t),title:a,content:c,keepDOM:o}}))):void(T.tabs=[]);T.tabs=s.map(((e,t)=>["string","number"].includes(typeof e)?{key:e,title:e}:(void 0===e.key&&(e.key=t),e)))}),[p,s]);const M=e=>{const{key:t}=e,n=T.tabs.findIndex((e=>e.key===t));if(n>-1)return void E(T.tabs[n].key??n);const i=T.tabs.length,a=e.key??i;T.tabs.push({...e,key:a}),E(a)},S=e=>{const t=T.tabs.findIndex((t=>t.key===e));if(t<0)return;if(T.tabs.splice(t,1),T.active!==e)return;const n=T.tabs[t]||T.tabs[t-1];E(T.prevActive??n?.key??"")},E=e=>{if(e===T.active){if(!g)return;return C?.(void 0,e),T.active=void 0,void(T.barStyle={height:0,width:0})}T.prevActive=T.active,C?.(e,T.active),T.active=e},j=e=>{e.stopPropagation(),e.preventDefault(),h||P.current?.scrollBy({left:e.deltaY+e.deltaX})};return u((()=>{if(!O||y)return;const{scrollHeight:e,scrollWidth:t}=P.current,{width:n,height:i}=O;T.overflow=e>i||t>n,T.overflow&&$.current.map(((e,t)=>{e&&I(e,((e,n)=>{T.tabs[t]&&(T.tabs[t].intersecting=n,T.more=T.tabs.filter((e=>!e.intersecting)))}))}))}),[O,y,T.tabs.length]),u((()=>{if(!f||"pane"===o||void 0===T.active)return;const e=T.tabs.findIndex((e=>e.key===T.active));setTimeout((()=>{const t=$.current[e];if(!t)return;if(T.tabs[e].keepDOM&&T.active){T.cachedTabs.findIndex((e=>e===T.active))<0&&T.cachedTabs.unshift(T.active)}const{offsetHeight:n,offsetLeft:i,offsetTop:a,offsetWidth:r}=t,s="line"===o;T.barStyle={height:!h&&s?".25em":n,width:h&&s?".25em":r,transform:`translate(${i}px, ${a}px)`}}),16)}),[T.active,f]),u((()=>{void 0!==r&&T.active!==r&&E(r)}),[r]),u((()=>{if(!y)return()=>{$.current?.map(z)}}),[T.tabs.length]),u((()=>{if(P.current&&!h)return P.current.addEventListener("wheel",j,{passive:!1}),()=>{P.current&&P.current.removeEventListener("wheel",j)}}),[P.current]),w(a,(()=>({open:E,close:S,add:M,navs:P}))),e("div",{className:i("i-tabs",{flex:h,[`i-tabs-${o}`]:"default"!==o},m),...x,children:[e("div",{className:i("i-tab-navs-container",{"i-tab-navs-vertical":h}),children:[c,e("div",{ref:P,className:"i-tab-navs",children:[T.tabs.map(((n,a)=>{const{title:r,key:s=a,closable:l}=n;return e("a",{ref:e=>$.current[a]=e,className:i("i-tab-nav",{"i-tab-active":T.active===s}),onClick:()=>E(s),children:[r,l&&t(He,{as:"i",active:!0,className:"i-tab-nav-close",onClick:e=>{e.stopPropagation(),S(s)}})]},s)})),f&&t("span",{ref:D,className:i("i-tab-navs-bar",N),style:T.barStyle})]}),!y&&T.overflow&&T.more.length>0&&t(ut,{arrow:!1,position:h?"right":"bottom",align:"end",touchable:!0,hideDelay:500,content:t("div",{className:"i-tabs-morelist pd-4",children:T.more.map(((e,n)=>{const{key:a=n,title:r}=e,s=T.active===a;return t("a",{className:i("i-tab-nav",{"i-tab-active":s}),onClick:()=>E(a),children:r},a)}))}),children:k(T.more)}),d]}),t("div",{className:"i-tab-contents",children:T.tabs.map(((e,n)=>{const{key:a=n,content:r}=e,s=T.active===a;return(s||void 0!==a&&T.cachedTabs.includes(a))&&t("div",{className:i("i-tab-content",{"i-tab-active":s}),children:r},a)}))})]})}));function gn(e){const{data:a=[],depth:r=0,round:s,style:l,className:o,parent:c,nodeProps:d,...u}=e,p=a.map(((e,n)=>{const{type:i}=e,a=e[d.title],s=e[d.key]||(void 0!==c?.key?`${c.key}-${n}`:`${n}`);return e.key=s,e.parent=c,"title"===i?t("div",{className:"i-tree-group-title",children:a},n):i&&"item"!==i?t("div",{className:`i-tree-type-${i}`,children:a},n):t(vn,{index:n,item:e,depth:r,nodeProps:d,...u},s)}));return r>0?t(n,{children:p}):t("div",{className:i("i-tree",o,{"i-tree-round":s}),style:l,children:p})}hn.Item=e=>t(n,{});const fn=e=>{const{as:n="a",href:a,selected:r,children:s,...l}=e,o=i("i-tree-item-header",{"i-tree-item-selected":r});return t(n,"string"==typeof n?{href:a,className:o,...l,children:s}:{to:a||"",className:o,...l,children:s})},vn=n=>{const{item:a,depth:r=0,index:s,selected:l,checked:o=[],partofs:c={},checkable:d,nodeProps:u,renderExtra:p,onItemClick:m,onItemSelect:h,onItemCheck:f,...v}=n,{as:b,key:y="",href:N,icon:k,title:C,expanded:w,disabled:x}=a,$=a[u.children],[D,P]=g(w),T=re(((e,t)=>{t&&(e.preventDefault(),e.stopPropagation()),!x&&$?.length&&P((e=>!e))})),I=re((e=>{if(x)return e.preventDefault(),void e.stopPropagation();T(e),m?.(a,e),h?.(y,a)})),z=o.includes(y);return e("div",{className:i("i-tree-item",{"i-tree-expand":D}),children:[e(fn,{as:b,href:N,style:{paddingLeft:1.5*r+.5+"em"},selected:l===y,onClick:I,children:[d&&t(Fe.Item,{value:z,partof:!z&&c[y],className:"i-tree-checkbox",onChange:e=>f?.(a,e,[]),onClick:e=>e.stopPropagation()}),k&&t("span",{className:"i-tree-item-icon",children:k}),t("span",{className:"i-tree-item-title",children:C}),p?.(a),$&&t(ke,{icon:t(ee,{}),className:"i-tree-toggle",onClick:e=>T(e,!0)})]}),$?.length&&t("div",{className:"i-tree-item-content",children:t(gn,{data:$,depth:r+1,selected:l,checkable:d,parent:a,partofs:c,checked:o,nodeProps:u,renderExtra:p,onItemClick:m,onItemSelect:h,onItemCheck:f,...v})})]})},bn={key:"key",title:"title",children:"children"},yn=c(((e,n)=>{const{data:i=[],selected:a,checked:r=[],disabledRelated:s,nodeProps:l,onItemSelect:o,onItemCheck:c,...d}=e,p=ae({selected:a,checked:r,partofs:{},nodeMaps:new Map}),m=Object.assign({},bn,l),h=e=>p.checked.includes(e||""),g=re(((e,t,n)=>{const{key:i="",parent:a,children:r}=e,l={[i]:t},o={[i]:!1};if(s)return[l];if(t){if(a&&"leaf"!==n){const e=a.children?.some((e=>e.key!==i&&!h(e.key))),[t,n]=g(a,!0,"root");e||Object.assign(l,t),Object.assign(o,e?n:{},{[a.key]:!0})}return r?.length&&"root"!==n&&r.map((e=>{if(h(e.key))return;const[t]=g(e,!0,"leaf");Object.assign(l,t),o[e.key]=!1})),[l,o]}if(a&&"leaf"!==n){const[e,t]=g(a,!1,"root");Object.assign(l,e);const n=a.children?.some((e=>h(e.key)&&e.key!==i));Object.assign(o,n?{}:t,{[a.key]:n,[i]:!1})}return r?.length&&"root"!==n&&r.map((e=>{const[t]=g(e,!1,"leaf");h(e.key)&&(Object.assign(l,t),o[e.key]=!1)})),[l,o]}));return u((()=>{void 0!==a&&(p.selected=a)}),[a]),u((()=>{p.nodeMaps.clear();const{key:e,children:t}=m,n=i=>{i.map((i=>{p.nodeMaps.set(i[e],i),i[t]?.length>0&&n(i[t])}))};n(i)}),[i]),w(n,(()=>({getChecked:()=>{const e=[];return p.checked.map((t=>{const n=p.nodeMaps.get(t);e.push(n)})),[p.checked,e]},getSelected:()=>{const e=p.nodeMaps.get(p.selected);return[p.selected,e]},getPartofs:()=>{const e=[];return[Object.keys(p.partofs).filter((t=>{const n=p.partofs[t];if(n){const n=p.nodeMaps.get(t);e.push(n)}return n})),e]}}))),t(gn,{data:i,selected:p.selected,checked:p.checked,partofs:p.partofs,nodeProps:m,onItemCheck:(e,t)=>{const[n,i]=g(e,t),a=Object.keys(n);p.checked=t?Array.from(new Set([...p.checked,...a])):p.checked.filter((e=>!a.includes(e))),Object.assign(p.partofs,i),c?.(e,t,p.checked)},onItemSelect:(t,n)=>{e.selectable&&(p.selected=t,o?.(t,n))},...d})}));function Nn(i){const{mode:a,index:r,file:s,onRemove:l,onPreview:c}=i;if(!s)return"";const{name:d,size:u,url:p,src:m}=s,h=Ae(d,s.type),g=t(He,{active:!0,className:"i-upload-delete",onClick:e=>{e.stopPropagation(),e.preventDefault(),l(r)}});if("card"===a){let i=t(n,{});switch(h){case Oe.IMAGE:i=t(At,{lazyload:!0,src:p||m,fit:"cover",usePreview:!1});break;case Oe.VIDEO:i=t("video",{src:p||m,preload:"none"});break;default:i=e(n,{children:[t(ke,{icon:t(te,{})}),t("span",{className:"i-upload-file-name",children:o(d)})]})}return e("div",{title:d,className:"i-upload-item-card",onClick:()=>c?.(r),children:[i,g]})}return e("div",{className:"i-upload-item",onClick:()=>c?.(r),children:[t("span",{children:d}),t("i",{className:"i-upload-size",children:Ve(u??0)}),g]})}const kn=c(((n,a)=>{const{label:s,labelInline:l,value:o,files:c=[],placeholder:d,status:p="normal",message:m,className:h,style:g,children:v,mode:y="default",cardSize:k="4em",disabled:C,limit:x=(n.multiple?1/0:1),multiple:$,renderItem:D=Nn,shouldUpload:P=()=>!0,uploader:T,onChange:I,onFilesChange:z,onUpload:O,...M}=n,S=ae({files:c,value:o,status:p,message:m,update:0}),E=b(null),j=Yt(),B=f((()=>v||("card"===y?t(Ne,{className:"i-upload-card-btn color-5",square:!0,flat:!0,outline:!0,disabled:C,children:t(ke,{icon:t(ie,{})})}):e(Ne,{className:"i-upload-btn",disabled:C,children:[t(ke,{icon:t(ne,{})})," Upload"]}))),[y,v]),L=e=>{const[...t]=S.files,n=t.splice(e,1);URL.revokeObjectURL(n[0]?.src||""),S.files=t,z?.(t,n),I?.(t),E.current&&(E.current.value="")},Y=async e=>{T&&e.forEach((async e=>{if(!P(e))return;const t=await T(e),n=S.files.findIndex((e=>e.uid===t.uid));n>-1&&(S.files[n]=t),"completed"===t?.status&&O?.(t)}))},A=e=>{j({items:S.files,initial:e})};u((()=>{Object.assign(S,{status:p,message:m})}),[p,m]),u((()=>{S.value=o}),[o]),w(a,(()=>({getFileList:()=>S.files})),[]);const{message:V,files:W}=S;return e(st,{label:s,labelInline:l,className:i("i-input-label-file",h),style:g,children:[t("input",{...M,disabled:C,ref:E,type:"file",className:"i-input-file-hidden",multiple:$,onChange:e=>{const t=Array.from(e.target.files||[]),{files:n}=S,i=[];t.map((e=>{const{name:t,size:a,type:s}=e,l=n.find((e=>{const{name:n,size:i,type:r}=e;return n===t&&i===a&&r===s})),o=URL.createObjectURL(e);e.src=o,S.update+=1,Object.assign(e,{uid:r(7),src:e.src||e.name}),!l&&i.push(e)}));const a=[...n,...i];Object.assign(S,{files:$?a.slice(0,x):[a.at(-1)],status:p,message:m}),z?.(S.files,i,e),I?.(S.files,e),Y(i),E.current&&(E.current.value="")}}),e("div",{className:i("i-upload-inner",{[`i-upload-${y}`]:"default"!==y}),style:{"--upload-card-size":k},children:[t("div",{className:"i-upload-list",onClick:e=>{e.stopPropagation(),e.preventDefault()},children:W?.map(((e,n)=>t(N,{children:Nn({index:n,file:e,mode:y,onRemove:L,onPreview:A})},n)))}),V&&t("span",{className:"i-upload-message",children:V}),W.length<x&&B]})]})}));export{we as Affix,xe as Badge,Ne as Button,ze as Card,Fe as Checkbox,Re as Collapse,rt as Datagrid,vt as Datepicker,bt as Description,yt as Drawer,wt as Dropdown,xt as Flex,Pt as Form,ke as Icon,At as Image,lt as Input,kt as List,be as Loading,Gt as Message,It as Modal,Zt as Pagination,Qt as Popconfirm,ut as Popup,Et as Progress,tn as Radio,sn as Select,un as Step,mn as Swiper,hn as Tabs,nn as Tag,Ot as Text,yn as Tree,kn as Upload,jt as Video,Yt as usePreview};
2
2
  //# sourceMappingURL=index.js.map