@ioca/react 1.1.5 → 1.1.6

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