medicine/Medicine-Server/admin/assets/instance-71079165.js

384 lines
52 KiB
JavaScript

import{c9 as se,h as t,k as L,f as v,j as N,d as Q,n as _,N as J,bs as Be,bp as Ne,bq as _e,br as Ie,l as $e,p as pe,ca as je,ag as Ce,v as De,E as Ae,H as le,a4 as he,z as Me,a8 as Le,r as ie,a7 as He,w as We,ay as fe,cb as Ve,b_ as Ke,ab as Oe,B as X,cc as Ge,cd as Xe,bI as Je,t as U,D as Qe,ce as Ze,K as Ye,cf as ke,A as et,a2 as Te}from"./index-232e6af6.js";import{g as tt,i as ze,N as rt,d as ot,a as nt,c as ae,e as it,m as at,b as st}from"./Image-705a3996.js";import{A as lt}from"./Add-e074b4dd.js";import{f as re}from"./format-length-c9d165c6.js";import{E as dt,u as ut}from"./Eye-51fdc120.js";const ct=se("attach",t("svg",{viewBox:"0 0 16 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},t("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},t("g",{fill:"currentColor","fill-rule":"nonzero"},t("path",{d:"M3.25735931,8.70710678 L7.85355339,4.1109127 C8.82986412,3.13460197 10.4127766,3.13460197 11.3890873,4.1109127 C12.365398,5.08722343 12.365398,6.67013588 11.3890873,7.64644661 L6.08578644,12.9497475 C5.69526215,13.3402718 5.06209717,13.3402718 4.67157288,12.9497475 C4.28104858,12.5592232 4.28104858,11.9260582 4.67157288,11.5355339 L9.97487373,6.23223305 C10.1701359,6.0369709 10.1701359,5.72038841 9.97487373,5.52512627 C9.77961159,5.32986412 9.4630291,5.32986412 9.26776695,5.52512627 L3.96446609,10.8284271 C3.18341751,11.6094757 3.18341751,12.8758057 3.96446609,13.6568542 C4.74551468,14.4379028 6.01184464,14.4379028 6.79289322,13.6568542 L12.0961941,8.35355339 C13.4630291,6.98671837 13.4630291,4.77064094 12.0961941,3.40380592 C10.7293591,2.0369709 8.51328163,2.0369709 7.14644661,3.40380592 L2.55025253,8 C2.35499039,8.19526215 2.35499039,8.51184464 2.55025253,8.70710678 C2.74551468,8.90236893 3.06209717,8.90236893 3.25735931,8.70710678 Z"}))))),ft=se("trash",t("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},t("path",{d:"M432,144,403.33,419.74A32,32,0,0,1,371.55,448H140.46a32,32,0,0,1-31.78-28.26L80,144",style:"fill: none; stroke: currentcolor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 32px;"}),t("rect",{x:"32",y:"64",width:"448",height:"80",rx:"16",ry:"16",style:"fill: none; stroke: currentcolor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 32px;"}),t("line",{x1:"312",y1:"240",x2:"200",y2:"352",style:"fill: none; stroke: currentcolor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 32px;"}),t("line",{x1:"312",y1:"352",x2:"200",y2:"240",style:"fill: none; stroke: currentcolor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 32px;"}))),gt=se("download",t("svg",{viewBox:"0 0 16 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},t("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},t("g",{fill:"currentColor","fill-rule":"nonzero"},t("path",{d:"M3.5,13 L12.5,13 C12.7761424,13 13,13.2238576 13,13.5 C13,13.7454599 12.8231248,13.9496084 12.5898756,13.9919443 L12.5,14 L3.5,14 C3.22385763,14 3,13.7761424 3,13.5 C3,13.2545401 3.17687516,13.0503916 3.41012437,13.0080557 L3.5,13 L12.5,13 L3.5,13 Z M7.91012437,1.00805567 L8,1 C8.24545989,1 8.44960837,1.17687516 8.49194433,1.41012437 L8.5,1.5 L8.5,10.292 L11.1819805,7.6109127 C11.3555469,7.43734635 11.6249713,7.4180612 11.8198394,7.55305725 L11.8890873,7.6109127 C12.0626536,7.78447906 12.0819388,8.05390346 11.9469427,8.2487716 L11.8890873,8.31801948 L8.35355339,11.8535534 C8.17998704,12.0271197 7.91056264,12.0464049 7.7156945,11.9114088 L7.64644661,11.8535534 L4.1109127,8.31801948 C3.91565056,8.12275734 3.91565056,7.80617485 4.1109127,7.6109127 C4.28447906,7.43734635 4.55390346,7.4180612 4.7487716,7.55305725 L4.81801948,7.6109127 L7.5,10.292 L7.5,1.5 C7.5,1.25454011 7.67687516,1.05039163 7.91012437,1.00805567 L8,1 L7.91012437,1.00805567 Z"}))))),pt=se("cancel",t("svg",{viewBox:"0 0 16 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},t("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},t("g",{fill:"currentColor","fill-rule":"nonzero"},t("path",{d:"M2.58859116,2.7156945 L2.64644661,2.64644661 C2.82001296,2.47288026 3.08943736,2.45359511 3.2843055,2.58859116 L3.35355339,2.64644661 L8,7.293 L12.6464466,2.64644661 C12.8417088,2.45118446 13.1582912,2.45118446 13.3535534,2.64644661 C13.5488155,2.84170876 13.5488155,3.15829124 13.3535534,3.35355339 L8.707,8 L13.3535534,12.6464466 C13.5271197,12.820013 13.5464049,13.0894374 13.4114088,13.2843055 L13.3535534,13.3535534 C13.179987,13.5271197 12.9105626,13.5464049 12.7156945,13.4114088 L12.6464466,13.3535534 L8,8.707 L3.35355339,13.3535534 C3.15829124,13.5488155 2.84170876,13.5488155 2.64644661,13.3535534 C2.45118446,13.1582912 2.45118446,12.8417088 2.64644661,12.6464466 L7.293,8 L2.64644661,3.35355339 C2.47288026,3.17998704 2.45359511,2.91056264 2.58859116,2.7156945 L2.64644661,2.64644661 L2.58859116,2.7156945 Z"}))))),ht=se("retry",t("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},t("path",{d:"M320,146s24.36-12-64-12A160,160,0,1,0,416,294",style:"fill: none; stroke: currentcolor; stroke-linecap: round; stroke-miterlimit: 10; stroke-width: 32px;"}),t("polyline",{points:"256 58 336 138 256 218",style:"fill: none; stroke: currentcolor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 32px;"}))),mt=L([v("progress",{display:"inline-block"},[v("progress-icon",`
color: var(--n-icon-color);
transition: color .3s var(--n-bezier);
`),N("line",`
width: 100%;
display: block;
`,[v("progress-content",`
display: flex;
align-items: center;
`,[v("progress-graph",{flex:1})]),v("progress-custom-content",{marginLeft:"14px"}),v("progress-icon",`
width: 30px;
padding-left: 14px;
height: var(--n-icon-size-line);
line-height: var(--n-icon-size-line);
font-size: var(--n-icon-size-line);
`,[N("as-text",`
color: var(--n-text-color-line-outer);
text-align: center;
width: 40px;
font-size: var(--n-font-size);
padding-left: 4px;
transition: color .3s var(--n-bezier);
`)])]),N("circle, dashboard",{width:"120px"},[v("progress-custom-content",`
position: absolute;
left: 50%;
top: 50%;
transform: translateX(-50%) translateY(-50%);
display: flex;
align-items: center;
justify-content: center;
`),v("progress-text",`
position: absolute;
left: 50%;
top: 50%;
transform: translateX(-50%) translateY(-50%);
display: flex;
align-items: center;
color: inherit;
font-size: var(--n-font-size-circle);
color: var(--n-text-color-circle);
font-weight: var(--n-font-weight-circle);
transition: color .3s var(--n-bezier);
white-space: nowrap;
`),v("progress-icon",`
position: absolute;
left: 50%;
top: 50%;
transform: translateX(-50%) translateY(-50%);
display: flex;
align-items: center;
color: var(--n-icon-color);
font-size: var(--n-icon-size-circle);
`)]),N("multiple-circle",`
width: 200px;
color: inherit;
`,[v("progress-text",`
font-weight: var(--n-font-weight-circle);
color: var(--n-text-color-circle);
position: absolute;
left: 50%;
top: 50%;
transform: translateX(-50%) translateY(-50%);
display: flex;
align-items: center;
justify-content: center;
transition: color .3s var(--n-bezier);
`)]),v("progress-content",{position:"relative"}),v("progress-graph",{position:"relative"},[v("progress-graph-circle",[L("svg",{verticalAlign:"bottom"}),v("progress-graph-circle-fill",`
stroke: var(--n-fill-color);
transition:
opacity .3s var(--n-bezier),
stroke .3s var(--n-bezier),
stroke-dasharray .3s var(--n-bezier);
`,[N("empty",{opacity:0})]),v("progress-graph-circle-rail",`
transition: stroke .3s var(--n-bezier);
overflow: hidden;
stroke: var(--n-rail-color);
`)]),v("progress-graph-line",[N("indicator-inside",[v("progress-graph-line-rail",`
height: 16px;
line-height: 16px;
border-radius: 10px;
`,[v("progress-graph-line-fill",`
height: inherit;
border-radius: 10px;
`),v("progress-graph-line-indicator",`
background: #0000;
white-space: nowrap;
text-align: right;
margin-left: 14px;
margin-right: 14px;
height: inherit;
font-size: 12px;
color: var(--n-text-color-line-inner);
transition: color .3s var(--n-bezier);
`)])]),N("indicator-inside-label",`
height: 16px;
display: flex;
align-items: center;
`,[v("progress-graph-line-rail",`
flex: 1;
transition: background-color .3s var(--n-bezier);
`),v("progress-graph-line-indicator",`
background: var(--n-fill-color);
font-size: 12px;
transform: translateZ(0);
display: flex;
vertical-align: middle;
height: 16px;
line-height: 16px;
padding: 0 10px;
border-radius: 10px;
position: absolute;
white-space: nowrap;
color: var(--n-text-color-line-inner);
transition:
right .2s var(--n-bezier),
color .3s var(--n-bezier),
background-color .3s var(--n-bezier);
`)]),v("progress-graph-line-rail",`
position: relative;
overflow: hidden;
height: var(--n-rail-height);
border-radius: 5px;
background-color: var(--n-rail-color);
transition: background-color .3s var(--n-bezier);
`,[v("progress-graph-line-fill",`
background: var(--n-fill-color);
position: relative;
border-radius: 5px;
height: inherit;
width: 100%;
max-width: 0%;
transition:
background-color .3s var(--n-bezier),
max-width .2s var(--n-bezier);
`,[N("processing",[L("&::after",`
content: "";
background-image: var(--n-line-bg-processing);
animation: progress-processing-animation 2s var(--n-bezier) infinite;
`)])])])])])]),L("@keyframes progress-processing-animation",`
0% {
position: absolute;
left: 0;
top: 0;
bottom: 0;
right: 100%;
opacity: 1;
}
66% {
position: absolute;
left: 0;
top: 0;
bottom: 0;
right: 0;
opacity: 0;
}
100% {
position: absolute;
left: 0;
top: 0;
bottom: 0;
right: 0;
opacity: 0;
}
`)]),vt={success:t(Be,null),error:t(Ne,null),warning:t(_e,null),info:t(Ie,null)},yt=Q({name:"ProgressLine",props:{clsPrefix:{type:String,required:!0},percentage:{type:Number,default:0},railColor:String,railStyle:[String,Object],fillColor:String,status:{type:String,required:!0},indicatorPlacement:{type:String,required:!0},indicatorTextColor:String,unit:{type:String,default:"%"},processing:{type:Boolean,required:!0},showIndicator:{type:Boolean,required:!0},height:[String,Number],railBorderRadius:[String,Number],fillBorderRadius:[String,Number]},setup(e,{slots:r}){const n=_(()=>re(e.height)),o=_(()=>e.railBorderRadius!==void 0?re(e.railBorderRadius):e.height!==void 0?re(e.height,{c:.5}):""),i=_(()=>e.fillBorderRadius!==void 0?re(e.fillBorderRadius):e.railBorderRadius!==void 0?re(e.railBorderRadius):e.height!==void 0?re(e.height,{c:.5}):"");return()=>{const{indicatorPlacement:d,railColor:c,railStyle:g,percentage:f,unit:u,indicatorTextColor:a,status:s,showIndicator:C,fillColor:h,processing:E,clsPrefix:b}=e;return t("div",{class:`${b}-progress-content`,role:"none"},t("div",{class:`${b}-progress-graph`,"aria-hidden":!0},t("div",{class:[`${b}-progress-graph-line`,{[`${b}-progress-graph-line--indicator-${d}`]:!0}]},t("div",{class:`${b}-progress-graph-line-rail`,style:[{backgroundColor:c,height:n.value,borderRadius:o.value},g]},t("div",{class:[`${b}-progress-graph-line-fill`,E&&`${b}-progress-graph-line-fill--processing`],style:{maxWidth:`${e.percentage}%`,backgroundColor:h,height:n.value,lineHeight:n.value,borderRadius:i.value}},d==="inside"?t("div",{class:`${b}-progress-graph-line-indicator`,style:{color:a}},r.default?r.default():`${f}${u}`):null)))),C&&d==="outside"?t("div",null,r.default?t("div",{class:`${b}-progress-custom-content`,style:{color:a},role:"none"},r.default()):s==="default"?t("div",{role:"none",class:`${b}-progress-icon ${b}-progress-icon--as-text`,style:{color:a}},f,u):t("div",{class:`${b}-progress-icon`,"aria-hidden":!0},t(J,{clsPrefix:b},{default:()=>vt[s]}))):null)}}}),bt={success:t(Be,null),error:t(Ne,null),warning:t(_e,null),info:t(Ie,null)},xt=Q({name:"ProgressCircle",props:{clsPrefix:{type:String,required:!0},status:{type:String,required:!0},strokeWidth:{type:Number,required:!0},fillColor:String,railColor:String,railStyle:[String,Object],percentage:{type:Number,default:0},offsetDegree:{type:Number,default:0},showIndicator:{type:Boolean,required:!0},indicatorTextColor:String,unit:String,viewBoxWidth:{type:Number,required:!0},gapDegree:{type:Number,required:!0},gapOffsetDegree:{type:Number,default:0}},setup(e,{slots:r}){function n(o,i,d){const{gapDegree:c,viewBoxWidth:g,strokeWidth:f}=e,u=50,a=0,s=u,C=0,h=2*u,E=50+f/2,b=`M ${E},${E} m ${a},${s}
a ${u},${u} 0 1 1 ${C},${-h}
a ${u},${u} 0 1 1 ${-C},${h}`,R=Math.PI*2*u,k={stroke:d,strokeDasharray:`${o/100*(R-c)}px ${g*8}px`,strokeDashoffset:`-${c/2}px`,transformOrigin:i?"center":void 0,transform:i?`rotate(${i}deg)`:void 0};return{pathString:b,pathStyle:k}}return()=>{const{fillColor:o,railColor:i,strokeWidth:d,offsetDegree:c,status:g,percentage:f,showIndicator:u,indicatorTextColor:a,unit:s,gapOffsetDegree:C,clsPrefix:h}=e,{pathString:E,pathStyle:b}=n(100,0,i),{pathString:R,pathStyle:k}=n(f,c,o),l=100+d;return t("div",{class:`${h}-progress-content`,role:"none"},t("div",{class:`${h}-progress-graph`,"aria-hidden":!0},t("div",{class:`${h}-progress-graph-circle`,style:{transform:C?`rotate(${C}deg)`:void 0}},t("svg",{viewBox:`0 0 ${l} ${l}`},t("g",null,t("path",{class:`${h}-progress-graph-circle-rail`,d:E,"stroke-width":d,"stroke-linecap":"round",fill:"none",style:b})),t("g",null,t("path",{class:[`${h}-progress-graph-circle-fill`,f===0&&`${h}-progress-graph-circle-fill--empty`],d:R,"stroke-width":d,"stroke-linecap":"round",fill:"none",style:k}))))),u?t("div",null,r.default?t("div",{class:`${h}-progress-custom-content`,role:"none"},r.default()):g!=="default"?t("div",{class:`${h}-progress-icon`,"aria-hidden":!0},t(J,{clsPrefix:h},{default:()=>bt[g]})):t("div",{class:`${h}-progress-text`,style:{color:a},role:"none"},t("span",{class:`${h}-progress-text__percentage`},f),t("span",{class:`${h}-progress-text__unit`},s))):null)}}});function Se(e,r,n=100){return`m ${n/2} ${n/2-e} a ${e} ${e} 0 1 1 0 ${2*e} a ${e} ${e} 0 1 1 0 -${2*e}`}const wt=Q({name:"ProgressMultipleCircle",props:{clsPrefix:{type:String,required:!0},viewBoxWidth:{type:Number,required:!0},percentage:{type:Array,default:[0]},strokeWidth:{type:Number,required:!0},circleGap:{type:Number,required:!0},showIndicator:{type:Boolean,required:!0},fillColor:{type:Array,default:()=>[]},railColor:{type:Array,default:()=>[]},railStyle:{type:Array,default:()=>[]}},setup(e,{slots:r}){const n=_(()=>e.percentage.map((i,d)=>`${Math.PI*i/100*(e.viewBoxWidth/2-e.strokeWidth/2*(1+2*d)-e.circleGap*d)*2}, ${e.viewBoxWidth*8}`));return()=>{const{viewBoxWidth:o,strokeWidth:i,circleGap:d,showIndicator:c,fillColor:g,railColor:f,railStyle:u,percentage:a,clsPrefix:s}=e;return t("div",{class:`${s}-progress-content`,role:"none"},t("div",{class:`${s}-progress-graph`,"aria-hidden":!0},t("div",{class:`${s}-progress-graph-circle`},t("svg",{viewBox:`0 0 ${o} ${o}`},a.map((C,h)=>t("g",{key:h},t("path",{class:`${s}-progress-graph-circle-rail`,d:Se(o/2-i/2*(1+2*h)-d*h,i,o),"stroke-width":i,"stroke-linecap":"round",fill:"none",style:[{strokeDashoffset:0,stroke:f[h]},u[h]]}),t("path",{class:[`${s}-progress-graph-circle-fill`,C===0&&`${s}-progress-graph-circle-fill--empty`],d:Se(o/2-i/2*(1+2*h)-d*h,i,o),"stroke-width":i,"stroke-linecap":"round",fill:"none",style:{strokeDasharray:n.value[h],strokeDashoffset:0,stroke:g[h]}})))))),c&&r.default?t("div",null,t("div",{class:`${s}-progress-text`},r.default())):null)}}}),Rt=Object.assign(Object.assign({},pe.props),{processing:Boolean,type:{type:String,default:"line"},gapDegree:Number,gapOffsetDegree:Number,status:{type:String,default:"default"},railColor:[String,Array],railStyle:[String,Array],color:[String,Array],viewBoxWidth:{type:Number,default:100},strokeWidth:{type:Number,default:7},percentage:[Number,Array],unit:{type:String,default:"%"},showIndicator:{type:Boolean,default:!0},indicatorPosition:{type:String,default:"outside"},indicatorPlacement:{type:String,default:"outside"},indicatorTextColor:String,circleGap:{type:Number,default:1},height:Number,borderRadius:[String,Number],fillBorderRadius:[String,Number],offsetDegree:Number}),Ct=Q({name:"Progress",props:Rt,setup(e){const r=_(()=>e.indicatorPlacement||e.indicatorPosition),n=_(()=>{if(e.gapDegree||e.gapDegree===0)return e.gapDegree;if(e.type==="dashboard")return 75}),{mergedClsPrefixRef:o,inlineThemeDisabled:i}=$e(e),d=pe("Progress","-progress",mt,je,e,o),c=_(()=>{const{status:f}=e,{common:{cubicBezierEaseInOut:u},self:{fontSize:a,fontSizeCircle:s,railColor:C,railHeight:h,iconSizeCircle:E,iconSizeLine:b,textColorCircle:R,textColorLineInner:k,textColorLineOuter:l,lineBgProcessing:O,fontWeightCircle:B,[Ce("iconColor",f)]:m,[Ce("fillColor",f)]:w}}=d.value;return{"--n-bezier":u,"--n-fill-color":w,"--n-font-size":a,"--n-font-size-circle":s,"--n-font-weight-circle":B,"--n-icon-color":m,"--n-icon-size-circle":E,"--n-icon-size-line":b,"--n-line-bg-processing":O,"--n-rail-color":C,"--n-rail-height":h,"--n-text-color-circle":R,"--n-text-color-line-inner":k,"--n-text-color-line-outer":l}}),g=i?De("progress",_(()=>e.status[0]),c,e):void 0;return{mergedClsPrefix:o,mergedIndicatorPlacement:r,gapDeg:n,cssVars:i?void 0:c,themeClass:g==null?void 0:g.themeClass,onRender:g==null?void 0:g.onRender}},render(){const{type:e,cssVars:r,indicatorTextColor:n,showIndicator:o,status:i,railColor:d,railStyle:c,color:g,percentage:f,viewBoxWidth:u,strokeWidth:a,mergedIndicatorPlacement:s,unit:C,borderRadius:h,fillBorderRadius:E,height:b,processing:R,circleGap:k,mergedClsPrefix:l,gapDeg:O,gapOffsetDegree:B,themeClass:m,$slots:w,onRender:T}=this;return T==null||T(),t("div",{class:[m,`${l}-progress`,`${l}-progress--${e}`,`${l}-progress--${i}`],style:r,"aria-valuemax":100,"aria-valuemin":0,"aria-valuenow":f,role:e==="circle"||e==="line"||e==="dashboard"?"progressbar":"none"},e==="circle"||e==="dashboard"?t(xt,{clsPrefix:l,status:i,showIndicator:o,indicatorTextColor:n,railColor:d,fillColor:g,railStyle:c,offsetDegree:this.offsetDegree,percentage:f,viewBoxWidth:u,strokeWidth:a,gapDegree:O===void 0?e==="dashboard"?75:0:O,gapOffsetDegree:B,unit:C},w):e==="line"?t(yt,{clsPrefix:l,status:i,showIndicator:o,indicatorTextColor:n,railColor:d,fillColor:g,railStyle:c,percentage:f,processing:R,indicatorPlacement:s,unit:C,fillBorderRadius:E,railBorderRadius:h,height:b},w):e==="multiple-circle"?t(wt,{clsPrefix:l,strokeWidth:a,railColor:d,fillColor:g,railStyle:c,viewBoxWidth:u,percentage:f,showIndicator:o,circleGap:k},w):null)}}),oe=Ae("n-upload"),Ue="__UPLOAD_DRAGGER__",Ot=Q({name:"UploadDragger",[Ue]:!0,setup(e,{slots:r}){const n=le(oe,null);return n||he("upload-dragger","`n-upload-dragger` must be placed inside `n-upload`."),()=>{const{mergedClsPrefixRef:{value:o},mergedDisabledRef:{value:i},maxReachedRef:{value:d}}=n;return t("div",{class:[`${o}-upload-dragger`,(i||d)&&`${o}-upload-dragger--disabled`]},r)}}}),qe=Q({name:"UploadTrigger",props:{abstract:Boolean},setup(e,{slots:r}){const n=le(oe,null);n||he("upload-trigger","`n-upload-trigger` must be placed inside `n-upload`.");const{mergedClsPrefixRef:o,mergedDisabledRef:i,maxReachedRef:d,listTypeRef:c,dragOverRef:g,openOpenFileDialog:f,draggerInsideRef:u,handleFileAddition:a,mergedDirectoryDndRef:s,triggerStyleRef:C}=n,h=_(()=>c.value==="image-card");function E(){i.value||d.value||f()}function b(O){O.preventDefault(),g.value=!0}function R(O){O.preventDefault(),g.value=!0}function k(O){O.preventDefault(),g.value=!1}function l(O){var B;if(O.preventDefault(),!u.value||i.value||d.value){g.value=!1;return}const m=(B=O.dataTransfer)===null||B===void 0?void 0:B.items;m!=null&&m.length?tt(Array.from(m).map(w=>w.webkitGetAsEntry()),s.value).then(w=>{a(w)}).finally(()=>{g.value=!1}):g.value=!1}return()=>{var O;const{value:B}=o;return e.abstract?(O=r.default)===null||O===void 0?void 0:O.call(r,{handleClick:E,handleDrop:l,handleDragOver:b,handleDragEnter:R,handleDragLeave:k}):t("div",{class:[`${B}-upload-trigger`,(i.value||d.value)&&`${B}-upload-trigger--disabled`,h.value&&`${B}-upload-trigger--image-card`],style:C.value,onClick:E,onDrop:l,onDragover:b,onDragenter:R,onDragleave:k},h.value?t(Ot,null,{default:()=>Me(r.default,()=>[t(J,{clsPrefix:B},{default:()=>t(lt,null)})])}):r)}}}),kt=Q({name:"UploadProgress",props:{show:Boolean,percentage:{type:Number,required:!0},status:{type:String,required:!0}},setup(){return{mergedTheme:le(oe).mergedThemeRef}},render(){return t(Le,null,{default:()=>this.show?t(Ct,{type:"line",showIndicator:!1,percentage:this.percentage,status:this.status,height:2,theme:this.mergedTheme.peers.Progress,themeOverrides:this.mergedTheme.peerOverrides.Progress}):null})}}),Tt=t("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 28 28"},t("g",{fill:"none"},t("path",{d:"M21.75 3A3.25 3.25 0 0 1 25 6.25v15.5A3.25 3.25 0 0 1 21.75 25H6.25A3.25 3.25 0 0 1 3 21.75V6.25A3.25 3.25 0 0 1 6.25 3h15.5zm.583 20.4l-7.807-7.68a.75.75 0 0 0-.968-.07l-.084.07l-7.808 7.68c.183.065.38.1.584.1h15.5c.204 0 .4-.035.583-.1l-7.807-7.68l7.807 7.68zM21.75 4.5H6.25A1.75 1.75 0 0 0 4.5 6.25v15.5c0 .208.036.408.103.593l7.82-7.692a2.25 2.25 0 0 1 3.026-.117l.129.117l7.82 7.692c.066-.185.102-.385.102-.593V6.25a1.75 1.75 0 0 0-1.75-1.75zm-3.25 3a2.5 2.5 0 1 1 0 5a2.5 2.5 0 0 1 0-5zm0 1.5a1 1 0 1 0 0 2a1 1 0 0 0 0-2z",fill:"currentColor"}))),St=t("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 28 28"},t("g",{fill:"none"},t("path",{d:"M6.4 2A2.4 2.4 0 0 0 4 4.4v19.2A2.4 2.4 0 0 0 6.4 26h15.2a2.4 2.4 0 0 0 2.4-2.4V11.578c0-.729-.29-1.428-.805-1.944l-6.931-6.931A2.4 2.4 0 0 0 14.567 2H6.4zm-.9 2.4a.9.9 0 0 1 .9-.9H14V10a2 2 0 0 0 2 2h6.5v11.6a.9.9 0 0 1-.9.9H6.4a.9.9 0 0 1-.9-.9V4.4zm16.44 6.1H16a.5.5 0 0 1-.5-.5V4.06l6.44 6.44z",fill:"currentColor"})));var Et=globalThis&&globalThis.__awaiter||function(e,r,n,o){function i(d){return d instanceof n?d:new n(function(c){c(d)})}return new(n||(n=Promise))(function(d,c){function g(a){try{u(o.next(a))}catch(s){c(s)}}function f(a){try{u(o.throw(a))}catch(s){c(s)}}function u(a){a.done?d(a.value):i(a.value).then(g,f)}u((o=o.apply(e,r||[])).next())})};const ge={paddingMedium:"0 3px",heightMedium:"24px",iconSizeMedium:"18px"},Pt=Q({name:"UploadFile",props:{clsPrefix:{type:String,required:!0},file:{type:Object,required:!0},listType:{type:String,required:!0}},setup(e){const r=le(oe),n=ie(null),o=ie(""),i=_(()=>{const{file:m}=e;return m.status==="finished"?"success":m.status==="error"?"error":"info"}),d=_(()=>{const{file:m}=e;if(m.status==="error")return"error"}),c=_(()=>{const{file:m}=e;return m.status==="uploading"}),g=_(()=>{if(!r.showCancelButtonRef.value)return!1;const{file:m}=e;return["uploading","pending","error"].includes(m.status)}),f=_(()=>{if(!r.showRemoveButtonRef.value)return!1;const{file:m}=e;return["finished"].includes(m.status)}),u=_(()=>{if(!r.showDownloadButtonRef.value)return!1;const{file:m}=e;return["finished"].includes(m.status)}),a=_(()=>{if(!r.showRetryButtonRef.value)return!1;const{file:m}=e;return["error"].includes(m.status)}),s=He(()=>o.value||e.file.thumbnailUrl||e.file.url),C=_(()=>{if(!r.showPreviewButtonRef.value)return!1;const{file:{status:m},listType:w}=e;return["finished"].includes(m)&&s.value&&w==="image-card"});function h(){r.submit(e.file.id)}function E(m){m.preventDefault();const{file:w}=e;["finished","pending","error"].includes(w.status)?R(w):["uploading"].includes(w.status)?l(w):Ke("upload","The button clicked type is unknown.")}function b(m){m.preventDefault(),k(e.file)}function R(m){const{xhrMap:w,doChange:T,onRemoveRef:{value:Y},mergedFileListRef:{value:p}}=r;Promise.resolve(Y?Y({file:Object.assign({},m),fileList:p}):!0).then(P=>{if(P===!1)return;const $=Object.assign({},m,{status:"removed"});w.delete(m.id),T($,void 0,{remove:!0})})}function k(m){const{onDownloadRef:{value:w}}=r;Promise.resolve(w?w(Object.assign({},m)):!0).then(T=>{T!==!1&&ot(m.url,m.name)})}function l(m){const{xhrMap:w}=r,T=w.get(m.id);T==null||T.abort(),R(Object.assign({},m))}function O(){const{onPreviewRef:{value:m}}=r;if(m)m(e.file);else if(e.listType==="image-card"){const{value:w}=n;if(!w)return;w.click()}}const B=()=>Et(this,void 0,void 0,function*(){const{listType:m}=e;m!=="image"&&m!=="image-card"||r.shouldUseThumbnailUrlRef.value(e.file)&&(o.value=yield r.getFileThumbnailUrlResolver(e.file))});return We(()=>{B()}),{mergedTheme:r.mergedThemeRef,progressStatus:i,buttonType:d,showProgress:c,disabled:r.mergedDisabledRef,showCancelButton:g,showRemoveButton:f,showDownloadButton:u,showRetryButton:a,showPreviewButton:C,mergedThumbnailUrl:s,shouldUseThumbnailUrl:r.shouldUseThumbnailUrlRef,renderIcon:r.renderIconRef,imageRef:n,handleRemoveOrCancelClick:E,handleDownloadClick:b,handleRetryClick:h,handlePreviewClick:O}},render(){const{clsPrefix:e,mergedTheme:r,listType:n,file:o,renderIcon:i}=this;let d;const c=n==="image";c||n==="image-card"?d=!this.shouldUseThumbnailUrl(o)||!this.mergedThumbnailUrl?t("span",{class:`${e}-upload-file-info__thumbnail`},i?i(o):ze(o)?t(J,{clsPrefix:e},{default:()=>Tt}):t(J,{clsPrefix:e},{default:()=>St})):t("a",{rel:"noopener noreferer",target:"_blank",href:o.url||void 0,class:`${e}-upload-file-info__thumbnail`,onClick:this.handlePreviewClick},n==="image-card"?t(rt,{src:this.mergedThumbnailUrl||void 0,previewSrc:o.url||void 0,alt:o.name,ref:"imageRef"}):t("img",{src:this.mergedThumbnailUrl||void 0,alt:o.name})):d=t("span",{class:`${e}-upload-file-info__thumbnail`},i?i(o):t(J,{clsPrefix:e},{default:()=>t(ct,null)}));const f=t(kt,{show:this.showProgress,percentage:o.percentage||0,status:this.progressStatus}),u=n==="text"||n==="image";return t("div",{class:[`${e}-upload-file`,`${e}-upload-file--${this.progressStatus}-status`,o.url&&o.status!=="error"&&n!=="image-card"&&`${e}-upload-file--with-url`,`${e}-upload-file--${n}-type`]},t("div",{class:`${e}-upload-file-info`},d,t("div",{class:`${e}-upload-file-info__name`},u&&(o.url&&o.status!=="error"?t("a",{rel:"noopener noreferer",target:"_blank",href:o.url||void 0,onClick:this.handlePreviewClick},o.name):t("span",{onClick:this.handlePreviewClick},o.name)),c&&f),t("div",{class:[`${e}-upload-file-info__action`,`${e}-upload-file-info__action--${n}-type`]},this.showPreviewButton?t(fe,{key:"preview",quaternary:!0,type:this.buttonType,onClick:this.handlePreviewClick,theme:r.peers.Button,themeOverrides:r.peerOverrides.Button,builtinThemeOverrides:ge},{icon:()=>t(J,{clsPrefix:e},{default:()=>t(dt,null)})}):null,(this.showRemoveButton||this.showCancelButton)&&!this.disabled&&t(fe,{key:"cancelOrTrash",theme:r.peers.Button,themeOverrides:r.peerOverrides.Button,quaternary:!0,builtinThemeOverrides:ge,type:this.buttonType,onClick:this.handleRemoveOrCancelClick},{icon:()=>t(Ve,null,{default:()=>this.showRemoveButton?t(J,{clsPrefix:e,key:"trash"},{default:()=>t(ft,null)}):t(J,{clsPrefix:e,key:"cancel"},{default:()=>t(pt,null)})})}),this.showRetryButton&&!this.disabled&&t(fe,{key:"retry",quaternary:!0,type:this.buttonType,onClick:this.handleRetryClick,theme:r.peers.Button,themeOverrides:r.peerOverrides.Button,builtinThemeOverrides:ge},{icon:()=>t(J,{clsPrefix:e},{default:()=>t(ht,null)})}),this.showDownloadButton?t(fe,{key:"download",quaternary:!0,type:this.buttonType,onClick:this.handleDownloadClick,theme:r.peers.Button,themeOverrides:r.peerOverrides.Button,builtinThemeOverrides:ge},{icon:()=>t(J,{clsPrefix:e},{default:()=>t(gt,null)})}):null)),!c&&f)}}),Bt=Q({name:"UploadFileList",setup(e,{slots:r}){const n=le(oe,null);n||he("upload-file-list","`n-upload-file-list` must be placed inside `n-upload`.");const{abstractRef:o,mergedClsPrefixRef:i,listTypeRef:d,mergedFileListRef:c,fileListStyleRef:g,cssVarsRef:f,themeClassRef:u,maxReachedRef:a,showTriggerRef:s,imageGroupPropsRef:C}=n,h=_(()=>d.value==="image-card"),E=()=>c.value.map(R=>t(Pt,{clsPrefix:i.value,key:R.id,file:R,listType:d.value})),b=()=>h.value?t(nt,Object.assign({},C.value),{default:E}):t(Le,{group:!0},{default:E});return()=>{const{value:R}=i,{value:k}=o;return t("div",{class:[`${R}-upload-file-list`,h.value&&`${R}-upload-file-list--grid`,k?u==null?void 0:u.value:void 0],style:[k&&f?f.value:"",g.value]},b(),s.value&&!a.value&&h.value&&t(qe,null,r))}}}),Nt=L([v("upload","width: 100%;",[N("dragger-inside",[v("upload-trigger",`
display: block;
`)]),N("drag-over",[v("upload-dragger",`
border: var(--n-dragger-border-hover);
`)])]),v("upload-dragger",`
cursor: pointer;
box-sizing: border-box;
width: 100%;
text-align: center;
border-radius: var(--n-border-radius);
padding: 24px;
opacity: 1;
transition:
opacity .3s var(--n-bezier),
border-color .3s var(--n-bezier),
background-color .3s var(--n-bezier);
background-color: var(--n-dragger-color);
border: var(--n-dragger-border);
`,[L("&:hover",`
border: var(--n-dragger-border-hover);
`),N("disabled",`
cursor: not-allowed;
`)]),v("upload-trigger",`
display: inline-block;
box-sizing: border-box;
opacity: 1;
transition: opacity .3s var(--n-bezier);
`,[L("+",[v("upload-file-list","margin-top: 8px;")]),N("disabled",`
opacity: var(--n-item-disabled-opacity);
cursor: not-allowed;
`),N("image-card",`
width: 96px;
height: 96px;
`,[v("base-icon",`
font-size: 24px;
`),v("upload-dragger",`
padding: 0;
height: 100%;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
`)])]),v("upload-file-list",`
line-height: var(--n-line-height);
opacity: 1;
transition: opacity .3s var(--n-bezier);
`,[L("a, img","outline: none;"),N("disabled",`
opacity: var(--n-item-disabled-opacity);
cursor: not-allowed;
`,[v("upload-file","cursor: not-allowed;")]),N("grid",`
display: grid;
grid-template-columns: repeat(auto-fill, 96px);
grid-gap: 8px;
margin-top: 0;
`),v("upload-file",`
display: block;
box-sizing: border-box;
cursor: default;
padding: 0px 12px 0 6px;
transition: background-color .3s var(--n-bezier);
border-radius: var(--n-border-radius);
`,[Oe(),v("progress",[Oe({foldPadding:!0})]),L("&:hover",`
background-color: var(--n-item-color-hover);
`,[v("upload-file-info",[X("action",`
opacity: 1;
`)])]),N("image-type",`
border-radius: var(--n-border-radius);
text-decoration: underline;
text-decoration-color: #0000;
`,[v("upload-file-info",`
padding-top: 0px;
padding-bottom: 0px;
width: 100%;
height: 100%;
display: flex;
justify-content: space-between;
align-items: center;
padding: 6px 0;
`,[v("progress",`
padding: 2px 0;
margin-bottom: 0;
`),X("name",`
padding: 0 8px;
`),X("thumbnail",`
width: 32px;
height: 32px;
font-size: 28px;
display: flex;
justify-content: center;
align-items: center;
`,[L("img",`
width: 100%;
`)])])]),N("text-type",[v("progress",`
box-sizing: border-box;
padding-bottom: 6px;
margin-bottom: 6px;
`)]),N("image-card-type",`
position: relative;
width: 96px;
height: 96px;
border: var(--n-item-border-image-card);
border-radius: var(--n-border-radius);
padding: 0;
display: flex;
align-items: center;
justify-content: center;
transition: border-color .3s var(--n-bezier), background-color .3s var(--n-bezier);
border-radius: var(--n-border-radius);
overflow: hidden;
`,[v("progress",`
position: absolute;
left: 8px;
bottom: 8px;
right: 8px;
width: unset;
`),v("upload-file-info",`
padding: 0;
width: 100%;
height: 100%;
`,[X("thumbnail",`
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: 36px;
`,[L("img",`
width: 100%;
`)])]),L("&::before",`
position: absolute;
z-index: 1;
left: 0;
right: 0;
top: 0;
bottom: 0;
border-radius: inherit;
opacity: 0;
transition: opacity .2s var(--n-bezier);
content: "";
`),L("&:hover",[L("&::before","opacity: 1;"),v("upload-file-info",[X("thumbnail","opacity: .12;")])])]),N("error-status",[L("&:hover",`
background-color: var(--n-item-color-hover-error);
`),v("upload-file-info",[X("name","color: var(--n-item-text-color-error);"),X("thumbnail","color: var(--n-item-text-color-error);")]),N("image-card-type",`
border: var(--n-item-border-image-card-error);
`)]),N("with-url",`
cursor: pointer;
`,[v("upload-file-info",[X("name",`
color: var(--n-item-text-color-success);
text-decoration-color: var(--n-item-text-color-success);
`,[L("a",`
text-decoration: underline;
`)])])]),v("upload-file-info",`
position: relative;
padding-top: 6px;
padding-bottom: 6px;
display: flex;
flex-wrap: nowrap;
`,[X("thumbnail",`
font-size: 18px;
opacity: 1;
transition: opacity .2s var(--n-bezier);
color: var(--n-item-icon-color);
`,[v("base-icon",`
margin-right: 2px;
vertical-align: middle;
transition: color .3s var(--n-bezier);
`)]),X("action",`
padding-top: inherit;
padding-bottom: inherit;
position: absolute;
right: 0;
top: 0;
bottom: 0;
width: 80px;
display: flex;
align-items: center;
transition: opacity .2s var(--n-bezier);
justify-content: flex-end;
opacity: 0;
`,[v("button",[L("&:not(:last-child)",{marginRight:"4px"}),v("base-icon",[L("svg",[Ge()])])]),N("image-type",`
position: relative;
max-width: 80px;
width: auto;
`),N("image-card-type",`
z-index: 2;
position: absolute;
width: 100%;
height: 100%;
left: 0;
right: 0;
bottom: 0;
top: 0;
display: flex;
justify-content: center;
align-items: center;
`)]),X("name",`
color: var(--n-item-text-color);
flex: 1;
display: flex;
justify-content: center;
text-overflow: ellipsis;
overflow: hidden;
flex-direction: column;
text-decoration-color: #0000;
font-size: var(--n-font-size);
transition:
color .3s var(--n-bezier),
text-decoration-color .3s var(--n-bezier);
`,[L("a",`
color: inherit;
text-decoration: underline;
`)])])])]),v("upload-file-input",`
display: block;
width: 0;
height: 0;
opacity: 0;
`)]);var Ee=globalThis&&globalThis.__awaiter||function(e,r,n,o){function i(d){return d instanceof n?d:new n(function(c){c(d)})}return new(n||(n=Promise))(function(d,c){function g(a){try{u(o.next(a))}catch(s){c(s)}}function f(a){try{u(o.throw(a))}catch(s){c(s)}}function u(a){a.done?d(a.value):i(a.value).then(g,f)}u((o=o.apply(e,r||[])).next())})};function _t(e,r,n){const{doChange:o,xhrMap:i}=e;let d=0;function c(f){var u;let a=Object.assign({},r,{status:"error",percentage:d});i.delete(r.id),a=ae(((u=e.onError)===null||u===void 0?void 0:u.call(e,{file:a,event:f}))||a),o(a,f)}function g(f){var u;if(e.isErrorState){if(e.isErrorState(n)){c(f);return}}else if(n.status<200||n.status>=300){c(f);return}let a=Object.assign({},r,{status:"finished",percentage:d});i.delete(r.id),a=ae(((u=e.onFinish)===null||u===void 0?void 0:u.call(e,{file:a,event:f}))||a),o(a,f)}return{handleXHRLoad:g,handleXHRError:c,handleXHRAbort(f){const u=Object.assign({},r,{status:"removed",file:null,percentage:d});i.delete(r.id),o(u,f)},handleXHRProgress(f){const u=Object.assign({},r,{status:"uploading"});if(f.lengthComputable){const a=Math.ceil(f.loaded/f.total*100);u.percentage=a,d=a}o(u,f)}}}function It(e){const{inst:r,file:n,data:o,headers:i,withCredentials:d,action:c,customRequest:g}=e,{doChange:f}=e.inst;let u=0;g({file:n,data:o,headers:i,withCredentials:d,action:c,onProgress(a){const s=Object.assign({},n,{status:"uploading"}),C=a.percent;s.percentage=C,u=C,f(s)},onFinish(){var a;let s=Object.assign({},n,{status:"finished",percentage:u});s=ae(((a=r.onFinish)===null||a===void 0?void 0:a.call(r,{file:s}))||s),f(s)},onError(){var a;let s=Object.assign({},n,{status:"error",percentage:u});s=ae(((a=r.onError)===null||a===void 0?void 0:a.call(r,{file:s}))||s),f(s)}})}function $t(e,r,n){const o=_t(e,r,n);n.onabort=o.handleXHRAbort,n.onerror=o.handleXHRError,n.onload=o.handleXHRLoad,n.upload&&(n.upload.onprogress=o.handleXHRProgress)}function Fe(e,r){return typeof e=="function"?e({file:r}):e||{}}function Dt(e,r,n){const o=Fe(r,n);o&&Object.keys(o).forEach(i=>{e.setRequestHeader(i,o[i])})}function Lt(e,r,n){const o=Fe(r,n);o&&Object.keys(o).forEach(i=>{e.append(i,o[i])})}function zt(e,r,n,{method:o,action:i,withCredentials:d,responseType:c,headers:g,data:f}){const u=new XMLHttpRequest;u.responseType=c,e.xhrMap.set(n.id,u),u.withCredentials=d;const a=new FormData;if(Lt(a,f,n),a.append(r,n.file),$t(e,n,u),i!==void 0){u.open(o.toUpperCase(),i),Dt(u,g,n),u.send(a);const s=Object.assign({},n,{status:"uploading"});e.doChange(s)}}const Ut=Object.assign(Object.assign({},pe.props),{name:{type:String,default:"file"},accept:String,action:String,customRequest:Function,directory:Boolean,directoryDnd:{type:Boolean,default:void 0},method:{type:String,default:"POST"},multiple:Boolean,showFileList:{type:Boolean,default:!0},data:[Object,Function],headers:[Object,Function],withCredentials:Boolean,responseType:{type:String,default:""},disabled:{type:Boolean,default:void 0},onChange:Function,onRemove:Function,onFinish:Function,onError:Function,onBeforeUpload:Function,isErrorState:Function,onDownload:Function,defaultUpload:{type:Boolean,default:!0},fileList:Array,"onUpdate:fileList":[Function,Array],onUpdateFileList:[Function,Array],fileListStyle:[String,Object],defaultFileList:{type:Array,default:()=>[]},showCancelButton:{type:Boolean,default:!0},showRemoveButton:{type:Boolean,default:!0},showDownloadButton:Boolean,showRetryButton:{type:Boolean,default:!0},showPreviewButton:{type:Boolean,default:!0},listType:{type:String,default:"text"},onPreview:Function,shouldUseThumbnailUrl:{type:Function,default:e=>it?ze(e):!1},createThumbnailUrl:Function,abstract:Boolean,max:Number,showTrigger:{type:Boolean,default:!0},imageGroupProps:Object,inputProps:Object,triggerStyle:[String,Object],renderIcon:Function}),er=Q({name:"Upload",props:Ut,setup(e){e.abstract&&e.listType==="image-card"&&he("upload","when the list-type is image-card, abstract is not supported.");const{mergedClsPrefixRef:r,inlineThemeDisabled:n}=$e(e),o=pe("Upload","-upload",Nt,Xe,e,r),i=Je(e),d=_(()=>{const{max:p}=e;return p!==void 0?h.value.length>=p:!1}),c=ie(e.defaultFileList),g=U(e,"fileList"),f=ie(null),u={value:!1},a=ie(!1),s=new Map,C=ut(g,c),h=_(()=>C.value.map(ae));function E(){var p;(p=f.value)===null||p===void 0||p.click()}function b(p){const P=p.target;l(P.files?Array.from(P.files).map($=>({file:$,entry:null,source:"input"})):null,p),P.value=""}function R(p){const{"onUpdate:fileList":P,onUpdateFileList:$}=e;P&&Te(P,p),$&&Te($,p),c.value=p}const k=_(()=>e.multiple||e.directory);function l(p,P){if(!p||p.length===0)return;const{onBeforeUpload:$}=e;p=k.value?p:[p[0]];const{max:K,accept:q}=e;p=p.filter(({file:S,source:I})=>I==="dnd"&&(q!=null&&q.trim())?at(S.name,S.type,q):!0),K&&(p=p.slice(0,K-h.value.length));const F=ke();Promise.all(p.map(({file:S,entry:I})=>Ee(this,void 0,void 0,function*(){var D;const M={id:ke(),batchId:F,name:S.name,status:"pending",percentage:0,file:S,url:null,type:S.type,thumbnailUrl:null,fullPath:(D=I==null?void 0:I.fullPath)!==null&&D!==void 0?D:`/${S.webkitRelativePath||S.name}`};return!$||(yield $({file:M,fileList:h.value}))!==!1?M:null}))).then(S=>Ee(this,void 0,void 0,function*(){let I=Promise.resolve();S.forEach(D=>{I=I.then(et).then(()=>{D&&B(D,P,{append:!0})})}),yield I})).then(()=>{e.defaultUpload&&O()})}function O(p){const{method:P,action:$,withCredentials:K,headers:q,data:F,name:S}=e,I=p!==void 0?h.value.filter(M=>M.id===p):h.value,D=p!==void 0;I.forEach(M=>{const{status:ee}=M;(ee==="pending"||ee==="error"&&D)&&(e.customRequest?It({inst:{doChange:B,xhrMap:s,onFinish:e.onFinish,onError:e.onError},file:M,action:$,withCredentials:K,headers:q,data:F,customRequest:e.customRequest}):zt({doChange:B,xhrMap:s,onFinish:e.onFinish,onError:e.onError,isErrorState:e.isErrorState},S,M,{method:P,action:$,withCredentials:K,responseType:e.responseType,headers:q,data:F}))})}const B=(p,P,$={append:!1,remove:!1})=>{const{append:K,remove:q}=$,F=Array.from(h.value),S=F.findIndex(I=>I.id===p.id);if(K||q||~S){K?F.push(p):q?F.splice(S,1):F.splice(S,1,p);const{onChange:I}=e;I&&I({file:p,fileList:F,event:P}),R(F)}};function m(p){var P;if(p.thumbnailUrl)return p.thumbnailUrl;const{createThumbnailUrl:$}=e;return $?(P=$(p.file,p))!==null&&P!==void 0?P:p.url||"":p.url?p.url:p.file?st(p.file):""}const w=_(()=>{const{common:{cubicBezierEaseInOut:p},self:{draggerColor:P,draggerBorder:$,draggerBorderHover:K,itemColorHover:q,itemColorHoverError:F,itemTextColorError:S,itemTextColorSuccess:I,itemTextColor:D,itemIconColor:M,itemDisabledOpacity:ee,lineHeight:de,borderRadius:ne,fontSize:me,itemBorderImageCardError:te,itemBorderImageCard:ue}}=o.value;return{"--n-bezier":p,"--n-border-radius":ne,"--n-dragger-border":$,"--n-dragger-border-hover":K,"--n-dragger-color":P,"--n-font-size":me,"--n-item-color-hover":q,"--n-item-color-hover-error":F,"--n-item-disabled-opacity":ee,"--n-item-icon-color":M,"--n-item-text-color":D,"--n-item-text-color-error":S,"--n-item-text-color-success":I,"--n-line-height":de,"--n-item-border-image-card-error":te,"--n-item-border-image-card":ue}}),T=n?De("upload",void 0,w,e):void 0;Qe(oe,{mergedClsPrefixRef:r,mergedThemeRef:o,showCancelButtonRef:U(e,"showCancelButton"),showDownloadButtonRef:U(e,"showDownloadButton"),showRemoveButtonRef:U(e,"showRemoveButton"),showRetryButtonRef:U(e,"showRetryButton"),onRemoveRef:U(e,"onRemove"),onDownloadRef:U(e,"onDownload"),mergedFileListRef:h,triggerStyleRef:U(e,"triggerStyle"),shouldUseThumbnailUrlRef:U(e,"shouldUseThumbnailUrl"),renderIconRef:U(e,"renderIcon"),xhrMap:s,submit:O,doChange:B,showPreviewButtonRef:U(e,"showPreviewButton"),onPreviewRef:U(e,"onPreview"),getFileThumbnailUrlResolver:m,listTypeRef:U(e,"listType"),dragOverRef:a,openOpenFileDialog:E,draggerInsideRef:u,handleFileAddition:l,mergedDisabledRef:i.mergedDisabledRef,maxReachedRef:d,fileListStyleRef:U(e,"fileListStyle"),abstractRef:U(e,"abstract"),acceptRef:U(e,"accept"),cssVarsRef:n?void 0:w,themeClassRef:T==null?void 0:T.themeClass,onRender:T==null?void 0:T.onRender,showTriggerRef:U(e,"showTrigger"),imageGroupPropsRef:U(e,"imageGroupProps"),mergedDirectoryDndRef:_(()=>{var p;return(p=e.directoryDnd)!==null&&p!==void 0?p:e.directory})});const Y={clear:()=>{c.value=[]},submit:O,openOpenFileDialog:E};return Object.assign({mergedClsPrefix:r,draggerInsideRef:u,inputElRef:f,mergedTheme:o,dragOver:a,mergedMultiple:k,cssVars:n?void 0:w,themeClass:T==null?void 0:T.themeClass,onRender:T==null?void 0:T.onRender,handleFileInputChange:b},Y)},render(){var e,r;const{draggerInsideRef:n,mergedClsPrefix:o,$slots:i,directory:d,onRender:c}=this;if(i.default&&!this.abstract){const f=i.default()[0];!((e=f==null?void 0:f.type)===null||e===void 0)&&e[Ue]&&(n.value=!0)}const g=t("input",Object.assign({},this.inputProps,{ref:"inputElRef",type:"file",class:`${o}-upload-file-input`,accept:this.accept,multiple:this.mergedMultiple,onChange:this.handleFileInputChange,webkitdirectory:d||void 0,directory:d||void 0}));return this.abstract?t(Ye,null,(r=i.default)===null||r===void 0?void 0:r.call(i),t(Ze,{to:"body"},g)):(c==null||c(),t("div",{class:[`${o}-upload`,n.value&&`${o}-upload--dragger-inside`,this.dragOver&&`${o}-upload--drag-over`,this.themeClass],style:this.cssVars},g,this.showTrigger&&this.listType!=="image-card"&&t(qe,null,i),this.showFileList&&t(Bt,null,i)))}});function qt(e){if(!e)return{};const r={};return e.trim().split(/[\r\n]+/).forEach(function(o){const i=o.split(":"),d=(i[0]||"").trim().toLowerCase(),c=(i[1]||"").trim();r[d]=c}),r}const Ft=({url:e,method:r,headers:n,body:o,responseType:i,withCredentials:d,onDownloadProgress:c,onUploadProgress:g,onResponse:f,onNetworkError:u})=>{const a=new XMLHttpRequest;a.open(r,e),a.withCredentials=d,a.responseType=i;for(const[s,C]of Object.entries(n))a.setRequestHeader(s,C);return g&&a.upload.addEventListener("progress",s=>{g({lengthComputable:s.lengthComputable,percent:s.lengthComputable?s.loaded/s.total*100:0,loaded:s.loaded,total:s.total,detail:s,originalRequest:a})}),c&&a.addEventListener("progress",s=>{c({lengthComputable:s.lengthComputable,percent:s.lengthComputable?s.loaded/s.total*100:0,loaded:s.loaded,total:s.total,detail:s,originalRequest:a})}),a.addEventListener("loadend",s=>{f({status:a.status,headers:qt(a.getAllResponseHeaders()),body:a.response},s)}),a.addEventListener("error",s=>{u(s)}),a.send(o),{abort(){a.abort()}}};var A;(function(e){e.NETWORK="NETWORK",e.ABORTED="ABORTED",e.INVALID_JSON="INVALID_JSON",e.INVALID_CONVERSION="INVALID_CONVERSION",e.TIMEOUT="TIMEOUT",e.HTTP="HTTP",e.BAD_REQUEST="BAD_REQUEST",e.BROKEN_ON_AFTER_RESPONSE="BROKEN_ON_AFTER_RESPONSE",e.BROKEN_ON_BEFORE_REQUEST="BROKEN_ON_BEFORE_REQUEST",e.BROKEN_ON_INIT="BROKEN_ON_INIT",e.BROKEN_ON_RESPONSE_ERROR="BROKEN_ON_RESPONSE_ERROR",e.BROKEN_ON_NON_RESPONSE_ERROR="BROKEN_ON_NON_RESPONSE_ERROR"})(A||(A={}));function jt(){const e=new Error;return e.__lylaError=!0,e}function V(e,r){const n=jt();n.name=`LylaError[${e.type}]`,r&&(n.stack+=r),Object.assign(n,e);const o=()=>{const i=n;return{name:i.name,message:i.message,stack:i.stack,type:i.type,error:i.error,detail:i.detail,context:i.context,response:i.response,requestOptions:i.requestOptions,__lylaError:!0}};return n.spread=o,n}function At(e){return typeof e=="object"&&!!e&&"__lylaError"in e}function Mt(e,r){return Ht(r)?r:r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}function Ht(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Pe(e){return e&&typeof e=="object"}function ye(e,r){if(!r)return e;for(const[n,o]of Object.entries(r))o===void 0?delete e[n]:e[n.toLowerCase()]=typeof o=="string"?o:`${o}`;return e}function be(...e){let r={};for(const n of e)if(Array.isArray(n))Array.isArray(r)||(r=[]),r.push(...n);else if(Pe(n))for(let[o,i]of Object.entries(n))Pe(i)&&o in r&&(i=be(r[o],i)),r[o]=i;return r}const Wt={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Upprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway TImeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"INsufficient Storage",508:"Loop Detected",510:"Not Extended",511:"Network Authentication Required"};function Vt(e){return Wt[e]||""}function Kt(e){return 200<=e&&e<300}function Gt(e,r,...n){const o=be(r,...n);async function i(c){var g,f,u,a,s,C,h,E;const b=c.context===void 0?o.context:c.context;let R=Object.assign({},c,{context:typeof b=="object"?JSON.parse(JSON.stringify(b)):b});async function k(y){var x,z;if(!((x=l.hooks)===null||x===void 0)&&x.onNonResponseError)try{for(const j of(z=l.hooks)===null||z===void 0?void 0:z.onNonResponseError){const H=j(y);H instanceof Promise&&await H}}catch(j){S(V({type:A.BROKEN_ON_NON_RESPONSE_ERROR,error:j,message:"`onNonResponseError` hook throws error",detail:void 0,response:void 0,context:y.context,requestOptions:l},void 0));return}}try{if(!((g=o==null?void 0:o.hooks)===null||g===void 0)&&g.onInit)for(const y of o.hooks.onInit){const x=y(R);x instanceof Promise?R=await x:R=x}if(!((f=c==null?void 0:c.hooks)===null||f===void 0)&&f.onInit)for(const y of c.hooks.onInit){const x=y(R);x instanceof Promise?R=await x:R=x}}catch(y){const x=V({type:A.BROKEN_ON_INIT,message:"`onInit` hook throws error",detail:void 0,error:y,response:void 0,context:R.context,requestOptions:R},void 0);throw k(x),x}let l=be(o,R);l.method=(u=l.method)===null||u===void 0?void 0:u.toUpperCase(),l.responseType=c.responseType||"text",l.url=l.url||"",l.baseUrl&&(l.url=Mt(l.baseUrl,l.url));let O;try{O=(a=new Error().stack)===null||a===void 0?void 0:a.replace(/^Error/,"")}catch{}if(l.query){const y={};for(const j in l.query){const H=l.query[j];H!=null&&(y[j]=H.toString())}const z=new URLSearchParams(y).toString();if(l.url.includes("?")){const j=V({type:A.BAD_REQUEST,message:"`options.query` can't be set if `options.url` contains '?'",detail:void 0,error:void 0,response:void 0,context:l.context,requestOptions:l},void 0);throw k(j),j}z.length&&(l.url=l.url+"?"+z)}if(!((s=l.hooks)===null||s===void 0)&&s.onBeforeRequest)try{for(const y of(C=l.hooks)===null||C===void 0?void 0:C.onBeforeRequest){const x=y(l);x instanceof Promise?l=await x:l=x}}catch(y){const x=V({type:A.BROKEN_ON_BEFORE_REQUEST,message:"`onBeforeRequest` hook throws error",detail:void 0,error:y,response:void 0,context:R.context,requestOptions:l},void 0);throw k(x),x}if(l.json!==void 0){if(l.body!==void 0){const y=V({type:A.BAD_REQUEST,message:"`options.json` can't be used together with `options.body`. If you want to use `options.json`, you should left `options.body` as `undefined`",detail:void 0,error:void 0,response:void 0,context:l.context,requestOptions:l},void 0);throw k(y),y}l.body=JSON.stringify(l.json)}const{timeout:B,url:m="",method:w="get",body:T,responseType:Y="text",withCredentials:p=!1,signal:P,onUploadProgress:$,onDownloadProgress:K}=l;async function q(y){var x,z;if(!((x=l.hooks)===null||x===void 0)&&x.onResponseError)try{for(const j of(z=l.hooks)===null||z===void 0?void 0:z.onResponseError){const H=j(y,I);H instanceof Promise&&await H}}catch(j){const H=V({type:A.BROKEN_ON_RESPONSE_ERROR,error:j,message:"`onResponseError` hook throws error",detail:void 0,response:void 0,context:y.context,requestOptions:l},void 0);k(H),S(H);return}}let F,S,I;const D={};ye(D,o.headers),ye(D,l.headers),l.json!==void 0&&(D["content-type"]=(h=D["content-type"])!==null&&h!==void 0?h:"application/json"),D.accept=(E=D.accept)!==null&&E!==void 0?E:"*/*",l.headers=D;let M=!1,ee=!1;function de(){M=!0,ee||ne()}function ne(){ee=!0,P&&P.removeEventListener("abort",ue)}const me=new Promise((y,x)=>{F=y,S=z=>{M||(de(),x(z))},I=z=>{M||(de(),x(z))}});let te=!1;function ue(){if(te)return;te=!0;const y=V({type:A.ABORTED,message:"Request aborted",detail:void 0,error:void 0,response:void 0,context:l.context,requestOptions:l},O);q(y),S(y),we.abort()}P&&P.addEventListener("abort",ue);let xe=!1;const we=e({url:m,method:w,body:T,json:l.json,headers:D,responseType:Y,withCredentials:p,onNetworkError(y){xe=!0,ne();const x=V({type:A.NETWORK,message:"Network error",detail:y,error:void 0,response:void 0,context:l.context,requestOptions:l},O);q(x),S(x)},onDownloadProgress:K,onUploadProgress:$,async onResponse(y,x){var z;if(te||xe)return;ne();let j,H=!1,ve,ce;const Re=Vt(y.status);let G={context:l.context,requestOptions:l,status:y.status,statusText:Re,headers:ye({},y.headers),body:y.body,detail:x,set json(W){H=!0,j=W},get json(){if(H)return j;if(Y!=="text"){const W=V({type:A.INVALID_CONVERSION,message:`Can not convert ${Y} to JSON`,detail:void 0,error:void 0,response:G,context:G.context,requestOptions:l},void 0);throw k(W),W}if(ve===void 0)try{return ve=JSON.parse(y.body)}catch(W){ce=W}else return ve;if(ce){const W=V({type:A.INVALID_JSON,message:ce.message,detail:void 0,error:ce,context:G.context,response:G,requestOptions:l},void 0);throw k(W),W}}};if(!Kt(y.status)){const W=`${y.status} ${Re}`,Z=V({type:A.HTTP,message:`Request failed with ${W}`,detail:void 0,error:void 0,response:G,context:l.context,requestOptions:l},O);q(Z),S(Z);return}if(!((z=l.hooks)===null||z===void 0)&&z.onAfterResponse)try{for(const W of l.hooks.onAfterResponse){const Z=W(G,I);Z instanceof Promise?G=await Z:G=Z}}catch(W){const Z=V({type:A.BROKEN_ON_AFTER_RESPONSE,message:"`onAfterResponse` hook throws error",detail:void 0,response:G,error:W,context:G.context,requestOptions:l},void 0);k(Z),S(Z);return}F(G)}});if(B&&setTimeout(()=>{if(M)return;we.abort(),te=!0;const y=V({type:A.TIMEOUT,message:B?`Timeout of ${B}ms exceeded`:"Timeout exceeded",detail:void 0,error:void 0,response:void 0,context:l.context,requestOptions:l},O);q(y),S(y)},B),w==="GET"&&T){const y=V({type:A.BAD_REQUEST,message:"Can not send a request with body in 'GET' method.",error:void 0,response:void 0,detail:void 0,context:l.context,requestOptions:l},void 0);throw k(y),y}return me}function d(c){return(g,f)=>i(Object.assign(Object.assign({},f),{method:c,url:g}))}return{lyla:Object.assign(i,{get:d("get"),post:d("post"),put:d("put"),patch:d("patch"),head:d("head"),delete:d("delete"),options:d("options"),trace:d("trace"),connect:d("connect"),get errorType(){return{}}}),isLylaError(c){return At(c)}}}const{lyla:tr,isLylaError:rr}=Gt(Ft,{context:void 0});export{er as _,tr as l};
//# sourceMappingURL=instance-71079165.js.map