uni-file-picker.C74izXFa.js 163 KB

1
  1. import{_ as e}from"./uni-icons.CCSIFyQK.js";import{J as t,o as s,c as i,w as n,b as a,n as r,j as o,k as l,E as c,e as h,F as u,Z as d,R as p,i as m,d as f,t as g,h as y,S as _,f as k,_ as T,a0 as w,U as S,G as b,a1 as x,p as v,A as D,M as I,N as P,a2 as C,a3 as A,l as R,a4 as M,a5 as O,a6 as E,a7 as F,s as $,I as L,a8 as U,a9 as N,r as j,Y as V,X as q,W as B,aa as H,ab as K,ac as W,q as z,v as J,x as Y,y as Q,ad as G,ae as X,af as Z,ag as ee,C as te,ah as se,g as ie,ai as ne,L as ae}from"./index-ESTWQ1DK.js";import{r as re}from"./uni-app.es.B2O8FBxl.js";import{_ as oe}from"./_plugin-vue_export-helper.BCo6x5W8.js";function le(e){let t="";for(let s in e){t+=`${s}:${e[s]};`}return t}const ce=oe({name:"uni-easyinput",emits:["click","iconClick","update:modelValue","input","focus","blur","confirm","clear","eyes","change","keyboardheightchange"],model:{prop:"modelValue",event:"update:modelValue"},options:{virtualHost:!0},inject:{form:{from:"uniForm",default:null},formItem:{from:"uniFormItem",default:null}},props:{name:String,value:[Number,String],modelValue:[Number,String],type:{type:String,default:"text"},clearable:{type:Boolean,default:!0},autoHeight:{type:Boolean,default:!1},placeholder:{type:String,default:" "},placeholderStyle:String,focus:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},maxlength:{type:[Number,String],default:140},confirmType:{type:String,default:"done"},clearSize:{type:[Number,String],default:24},inputBorder:{type:Boolean,default:!0},prefixIcon:{type:String,default:""},suffixIcon:{type:String,default:""},trim:{type:[Boolean,String],default:!1},cursorSpacing:{type:Number,default:0},passwordIcon:{type:Boolean,default:!0},adjustPosition:{type:Boolean,default:!0},primaryColor:{type:String,default:"#2979ff"},styles:{type:Object,default:()=>({color:"#333",backgroundColor:"#fff",disableColor:"#F7F6F6",borderColor:"#e5e5e5"})},errorMessage:{type:[String,Boolean],default:""}},data:()=>({focused:!1,val:"",showMsg:"",border:!1,isFirstBorder:!1,showClearIcon:!1,showPassword:!1,focusShow:!1,localMsg:"",isEnter:!1}),computed:{isVal(){const e=this.val;return!(!e&&0!==e)},msg(){return this.localMsg||this.errorMessage},inputMaxlength(){return Number(this.maxlength)},boxStyle(){return`color:${this.inputBorder&&this.msg?"#e43d33":this.styles.color};`},inputContentClass(){return function(e){let t="";for(let s in e)e[s]&&(t+=`${s} `);return t}({"is-input-border":this.inputBorder,"is-input-error-border":this.inputBorder&&this.msg,"is-textarea":"textarea"===this.type,"is-disabled":this.disabled,"is-focused":this.focusShow})},inputContentStyle(){const e=this.focusShow?this.primaryColor:this.styles.borderColor;return le({"border-color":(this.inputBorder&&this.msg?"#dd524d":e)||"#e5e5e5","background-color":this.disabled?this.styles.disableColor:this.styles.backgroundColor})},inputStyle(){return le({"padding-right":"password"===this.type||this.clearable||this.prefixIcon?"":"10px","padding-left":this.prefixIcon?"":"10px"})}},watch:{value(e){this.val=null!==e?e:""},modelValue(e){this.val=null!==e?e:""},focus(e){this.$nextTick((()=>{this.focused=this.focus,this.focusShow=this.focus}))}},created(){this.init(),this.form&&this.formItem&&this.$watch("formItem.errMsg",(e=>{this.localMsg=e}))},mounted(){this.$nextTick((()=>{this.focused=this.focus,this.focusShow=this.focus}))},methods:{init(){this.value||0===this.value?this.val=this.value:this.modelValue||0===this.modelValue||""===this.modelValue?this.val=this.modelValue:this.val=""},onClickIcon(e){this.$emit("iconClick",e)},onEyes(){this.showPassword=!this.showPassword,this.$emit("eyes",this.showPassword)},onInput(e){let t=e.detail.value;this.trim&&("boolean"==typeof this.trim&&this.trim&&(t=this.trimStr(t)),"string"==typeof this.trim&&(t=this.trimStr(t,this.trim))),this.errMsg&&(this.errMsg=""),this.val=t,this.$emit("input",t),this.$emit("update:modelValue",t)},onFocus(){this.$nextTick((()=>{this.focused=!0})),this.$emit("focus",null)},_Focus(e){this.focusShow=!0,this.$emit("focus",e)},onBlur(){this.focused=!1,this.$emit("blur",null)},_Blur(e){if(e.detail.value,this.focusShow=!1,this.$emit("blur",e),!1===this.isEnter&&this.$emit("change",this.val),this.form&&this.formItem){const{validateTrigger:e}=this.form;"blur"===e&&this.formItem.onFieldChange()}},onConfirm(e){this.$emit("confirm",this.val),this.isEnter=!0,this.$emit("change",this.val),this.$nextTick((()=>{this.isEnter=!1}))},onClear(e){this.val="",this.$emit("input",""),this.$emit("update:modelValue",""),this.$emit("clear")},onkeyboardheightchange(e){this.$emit("keyboardheightchange",e)},trimStr:(e,t="both")=>"both"===t?e.trim():"left"===t?e.trimLeft():"right"===t?e.trimRight():"start"===t?e.trimStart():"end"===t?e.trimEnd():"all"===t?e.replace(/\s+/g,""):e}},[["render",function(f,g,y,_,k,T){const w=re(t("uni-icons"),e),S=d,b=p,x=m;return s(),i(x,{class:r(["uni-easyinput",{"uni-easyinput-error":T.msg}]),style:o(T.boxStyle)},{default:n((()=>[a(x,{class:r(["uni-easyinput__content",T.inputContentClass]),style:o(T.inputContentStyle)},{default:n((()=>[y.prefixIcon?(s(),i(w,{key:0,class:"content-clear-icon",type:y.prefixIcon,color:"#c0c4cc",onClick:g[0]||(g[0]=e=>T.onClickIcon("prefix")),size:"22"},null,8,["type"])):l("",!0),c(f.$slots,"left",{},void 0,!0),"textarea"===y.type?(s(),i(S,{key:1,class:r(["uni-easyinput__content-textarea",{"input-padding":y.inputBorder}]),name:y.name,value:k.val,placeholder:y.placeholder,placeholderStyle:y.placeholderStyle,disabled:y.disabled,"placeholder-class":"uni-easyinput__placeholder-class",maxlength:T.inputMaxlength,focus:k.focused,autoHeight:y.autoHeight,"cursor-spacing":y.cursorSpacing,"adjust-position":y.adjustPosition,onInput:T.onInput,onBlur:T._Blur,onFocus:T._Focus,onConfirm:T.onConfirm,onKeyboardheightchange:T.onkeyboardheightchange},null,8,["class","name","value","placeholder","placeholderStyle","disabled","maxlength","focus","autoHeight","cursor-spacing","adjust-position","onInput","onBlur","onFocus","onConfirm","onKeyboardheightchange"])):(s(),i(b,{key:2,type:"password"===y.type?"text":y.type,class:"uni-easyinput__content-input",style:o(T.inputStyle),name:y.name,value:k.val,password:!k.showPassword&&"password"===y.type,placeholder:y.placeholder,placeholderStyle:y.placeholderStyle,"placeholder-class":"uni-easyinput__placeholder-class",disabled:y.disabled,maxlength:T.inputMaxlength,focus:k.focused,confirmType:y.confirmType,"cursor-spacing":y.cursorSpacing,"adjust-position":y.adjustPosition,onFocus:T._Focus,onBlur:T._Blur,onInput:T.onInput,onConfirm:T.onConfirm,onKeyboardheightchange:T.onkeyboardheightchange},null,8,["type","style","name","value","password","placeholder","placeholderStyle","disabled","maxlength","focus","confirmType","cursor-spacing","adjust-position","onFocus","onBlur","onInput","onConfirm","onKeyboardheightchange"])),"password"===y.type&&y.passwordIcon?(s(),h(u,{key:3},[T.isVal?(s(),i(w,{key:0,class:r(["content-clear-icon",{"is-textarea-icon":"textarea"===y.type}]),type:k.showPassword?"eye-slash-filled":"eye-filled",size:22,color:k.focusShow?y.primaryColor:"#c0c4cc",onClick:T.onEyes},null,8,["class","type","color","onClick"])):l("",!0)],64)):l("",!0),y.suffixIcon?(s(),h(u,{key:4},[y.suffixIcon?(s(),i(w,{key:0,class:"content-clear-icon",type:y.suffixIcon,color:"#c0c4cc",onClick:g[1]||(g[1]=e=>T.onClickIcon("suffix")),size:"22"},null,8,["type"])):l("",!0)],64)):(s(),h(u,{key:5},[y.clearable&&T.isVal&&!y.disabled&&"textarea"!==y.type?(s(),i(w,{key:0,class:r(["content-clear-icon",{"is-textarea-icon":"textarea"===y.type}]),type:"clear",size:y.clearSize,color:T.msg?"#dd524d":k.focusShow?y.primaryColor:"#c0c4cc",onClick:T.onClear},null,8,["class","size","color","onClick"])):l("",!0)],64)),c(f.$slots,"right",{},void 0,!0)])),_:3},8,["class","style"])])),_:3},8,["class","style"])}],["__scopeId","data-v-b9d910bc"]]);function he(e,t){return`${ue(e)} ${de(e,t)}`}function ue(e){e=_e(e);const t=(e=new Date(e)).getFullYear(),s=e.getMonth()+1,i=e.getDate();return`${t}-${pe(s)}-${pe(i)}`}function de(e,t){e=_e(e);const s=(e=new Date(e)).getHours(),i=e.getMinutes(),n=e.getSeconds();return t?`${pe(s)}:${pe(i)}`:`${pe(s)}:${pe(i)}:${pe(n)}`}function pe(e){return e<10&&(e=`0${e}`),e}function me(e){return e?"00:00":"00:00:00"}function fe(e,t){return(e=new Date(_e(e)))<=(t=new Date(_e(t)))}function ge(e){return e.match(/((19|20)\d{2})(-|\/)\d{1,2}(-|\/)\d{1,2}/g)}const ye=/^\d{4}-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])( [0-5]?[0-9]:[0-5]?[0-9](:[0-5]?[0-9])?)?$/;function _e(e){return"string"==typeof e&&ye.test(e)&&(e=e.replace(/-/g,"/")),e}const ke=oe({props:{weeks:{type:Object,default:()=>({})},calendar:{type:Object,default:()=>({})},selected:{type:Array,default:()=>[]},checkHover:{type:Boolean,default:!1}},methods:{choiceDate(e){this.$emit("change",e)},handleMousemove(e){this.$emit("handleMouse",e)}}},[["render",function(e,t,o,c,h,u){const d=y,p=m;return s(),i(p,{class:r(["uni-calendar-item__weeks-box",{"uni-calendar-item--disable":o.weeks.disable,"uni-calendar-item--before-checked-x":o.weeks.beforeMultiple,"uni-calendar-item--multiple":o.weeks.multiple,"uni-calendar-item--after-checked-x":o.weeks.afterMultiple}]),onClick:t[0]||(t[0]=e=>u.choiceDate(o.weeks)),onMouseenter:t[1]||(t[1]=e=>u.handleMousemove(o.weeks))},{default:n((()=>[a(p,{class:r(["uni-calendar-item__weeks-box-item",{"uni-calendar-item--checked":o.calendar.fullDate===o.weeks.fullDate&&(o.calendar.userChecked||!o.checkHover),"uni-calendar-item--checked-range-text":o.checkHover,"uni-calendar-item--before-checked":o.weeks.beforeMultiple,"uni-calendar-item--multiple":o.weeks.multiple,"uni-calendar-item--after-checked":o.weeks.afterMultiple,"uni-calendar-item--disable":o.weeks.disable}])},{default:n((()=>[o.selected&&o.weeks.extraInfo?(s(),i(d,{key:0,class:"uni-calendar-item__weeks-box-circle"})):l("",!0),a(d,{class:"uni-calendar-item__weeks-box-text uni-calendar-item__weeks-box-text-disable uni-calendar-item--checked-text"},{default:n((()=>[f(g(o.weeks.date),1)])),_:1})])),_:1},8,["class"]),a(p,{class:r({"uni-calendar-item--today":o.weeks.isToday})},null,8,["class"])])),_:1},8,["class"])}],["__scopeId","data-v-33ef2289"]]),Te={en:{"uni-datetime-picker.selectDate":"select date","uni-datetime-picker.selectTime":"select time","uni-datetime-picker.selectDateTime":"select date and time","uni-datetime-picker.startDate":"start date","uni-datetime-picker.endDate":"end date","uni-datetime-picker.startTime":"start time","uni-datetime-picker.endTime":"end time","uni-datetime-picker.ok":"ok","uni-datetime-picker.clear":"clear","uni-datetime-picker.cancel":"cancel","uni-datetime-picker.year":"-","uni-datetime-picker.month":"","uni-calender.MON":"MON","uni-calender.TUE":"TUE","uni-calender.WED":"WED","uni-calender.THU":"THU","uni-calender.FRI":"FRI","uni-calender.SAT":"SAT","uni-calender.SUN":"SUN","uni-calender.confirm":"confirm"},"zh-Hans":{"uni-datetime-picker.selectDate":"选择日期","uni-datetime-picker.selectTime":"选择时间","uni-datetime-picker.selectDateTime":"选择日期时间","uni-datetime-picker.startDate":"开始日期","uni-datetime-picker.endDate":"结束日期","uni-datetime-picker.startTime":"开始时间","uni-datetime-picker.endTime":"结束时间","uni-datetime-picker.ok":"确定","uni-datetime-picker.clear":"清除","uni-datetime-picker.cancel":"取消","uni-datetime-picker.year":"年","uni-datetime-picker.month":"月","uni-calender.SUN":"日","uni-calender.MON":"一","uni-calender.TUE":"二","uni-calender.WED":"三","uni-calender.THU":"四","uni-calender.FRI":"五","uni-calender.SAT":"六","uni-calender.confirm":"确认"},"zh-Hant":{"uni-datetime-picker.selectDate":"選擇日期","uni-datetime-picker.selectTime":"選擇時間","uni-datetime-picker.selectDateTime":"選擇日期時間","uni-datetime-picker.startDate":"開始日期","uni-datetime-picker.endDate":"結束日期","uni-datetime-picker.startTime":"開始时间","uni-datetime-picker.endTime":"結束时间","uni-datetime-picker.ok":"確定","uni-datetime-picker.clear":"清除","uni-datetime-picker.cancel":"取消","uni-datetime-picker.year":"年","uni-datetime-picker.month":"月","uni-calender.SUN":"日","uni-calender.MON":"一","uni-calender.TUE":"二","uni-calender.WED":"三","uni-calender.THU":"四","uni-calender.FRI":"五","uni-calender.SAT":"六","uni-calender.confirm":"確認"}},{t:we}=_(Te),Se={name:"UniDatetimePicker",data:()=>({indicatorStyle:"height: 50px;",visible:!1,fixNvueBug:{},dateShow:!0,timeShow:!0,title:"日期和时间",time:"",year:1920,month:0,day:0,hour:0,minute:0,second:0,startYear:1920,startMonth:1,startDay:1,startHour:0,startMinute:0,startSecond:0,endYear:2120,endMonth:12,endDay:31,endHour:23,endMinute:59,endSecond:59}),options:{virtualHost:!0},props:{type:{type:String,default:"datetime"},value:{type:[String,Number],default:""},modelValue:{type:[String,Number],default:""},start:{type:[Number,String],default:""},end:{type:[Number,String],default:""},returnType:{type:String,default:"string"},disabled:{type:[Boolean,String],default:!1},border:{type:[Boolean,String],default:!0},hideSecond:{type:[Boolean,String],default:!1}},watch:{modelValue:{handler(e){e?(this.parseValue(_e(e)),this.initTime(!1)):(this.time="",this.parseValue(Date.now()))},immediate:!0},type:{handler(e){"date"===e?(this.dateShow=!0,this.timeShow=!1,this.title="日期"):"time"===e?(this.dateShow=!1,this.timeShow=!0,this.title="时间"):(this.dateShow=!0,this.timeShow=!0,this.title="日期和时间")},immediate:!0},start:{handler(e){this.parseDatetimeRange(_e(e),"start")},immediate:!0},end:{handler(e){this.parseDatetimeRange(_e(e),"end")},immediate:!0},months(e){this.checkValue("month",this.month,e)},days(e){this.checkValue("day",this.day,e)},hours(e){this.checkValue("hour",this.hour,e)},minutes(e){this.checkValue("minute",this.minute,e)},seconds(e){this.checkValue("second",this.second,e)}},computed:{years(){return this.getCurrentRange("year")},months(){return this.getCurrentRange("month")},days(){return this.getCurrentRange("day")},hours(){return this.getCurrentRange("hour")},minutes(){return this.getCurrentRange("minute")},seconds(){return this.getCurrentRange("second")},ymd(){return[this.year-this.minYear,this.month-this.minMonth,this.day-this.minDay]},hms(){return[this.hour-this.minHour,this.minute-this.minMinute,this.second-this.minSecond]},currentDateIsStart(){return this.year===this.startYear&&this.month===this.startMonth&&this.day===this.startDay},currentDateIsEnd(){return this.year===this.endYear&&this.month===this.endMonth&&this.day===this.endDay},minYear(){return this.startYear},maxYear(){return this.endYear},minMonth(){return this.year===this.startYear?this.startMonth:1},maxMonth(){return this.year===this.endYear?this.endMonth:12},minDay(){return this.year===this.startYear&&this.month===this.startMonth?this.startDay:1},maxDay(){return this.year===this.endYear&&this.month===this.endMonth?this.endDay:this.daysInMonth(this.year,this.month)},minHour(){return"datetime"===this.type?this.currentDateIsStart?this.startHour:0:"time"===this.type?this.startHour:void 0},maxHour(){return"datetime"===this.type?this.currentDateIsEnd?this.endHour:23:"time"===this.type?this.endHour:void 0},minMinute(){return"datetime"===this.type?this.currentDateIsStart&&this.hour===this.startHour?this.startMinute:0:"time"===this.type?this.hour===this.startHour?this.startMinute:0:void 0},maxMinute(){return"datetime"===this.type?this.currentDateIsEnd&&this.hour===this.endHour?this.endMinute:59:"time"===this.type?this.hour===this.endHour?this.endMinute:59:void 0},minSecond(){return"datetime"===this.type?this.currentDateIsStart&&this.hour===this.startHour&&this.minute===this.startMinute?this.startSecond:0:"time"===this.type?this.hour===this.startHour&&this.minute===this.startMinute?this.startSecond:0:void 0},maxSecond(){return"datetime"===this.type?this.currentDateIsEnd&&this.hour===this.endHour&&this.minute===this.endMinute?this.endSecond:59:"time"===this.type?this.hour===this.endHour&&this.minute===this.endMinute?this.endSecond:59:void 0},selectTimeText:()=>we("uni-datetime-picker.selectTime"),okText:()=>we("uni-datetime-picker.ok"),clearText:()=>we("uni-datetime-picker.clear"),cancelText:()=>we("uni-datetime-picker.cancel")},mounted(){},methods:{lessThanTen:e=>e<10?"0"+e:e,parseTimeType(e){if(e){let t=e.split(":");this.hour=Number(t[0]),this.minute=Number(t[1]),this.second=Number(t[2])}},initPickerValue(e){let t=null;e?t=this.compareValueWithStartAndEnd(e,this.start,this.end):(t=Date.now(),t=this.compareValueWithStartAndEnd(t,this.start,this.end)),this.parseValue(t)},compareValueWithStartAndEnd(e,t,s){let i=null;return e=this.superTimeStamp(e),t=this.superTimeStamp(t),s=this.superTimeStamp(s),i=t&&s?e<t?new Date(t):e>s?new Date(s):new Date(e):t&&!s?t<=e?new Date(e):new Date(t):!t&&s?e<=s?new Date(e):new Date(s):new Date(e),i},superTimeStamp(e){let t="";if("time"===this.type&&e&&"string"==typeof e){const e=new Date;t=e.getFullYear()+"/"+(e.getMonth()+1)+"/"+e.getDate()+" "}return Number(e)&&(e=parseInt(e),t=0),this.createTimeStamp(t+e)},parseValue(e){if(e){if("time"===this.type&&"string"==typeof e)this.parseTimeType(e);else{let t=null;t=new Date(e),"time"!==this.type&&(this.year=t.getFullYear(),this.month=t.getMonth()+1,this.day=t.getDate()),"date"!==this.type&&(this.hour=t.getHours(),this.minute=t.getMinutes(),this.second=t.getSeconds())}this.hideSecond&&(this.second=0)}},parseDatetimeRange(e,t){if(!e)return"start"===t&&(this.startYear=1920,this.startMonth=1,this.startDay=1,this.startHour=0,this.startMinute=0,this.startSecond=0),void("end"===t&&(this.endYear=2120,this.endMonth=12,this.endDay=31,this.endHour=23,this.endMinute=59,this.endSecond=59));if("time"===this.type){const s=e.split(":");this[t+"Hour"]=Number(s[0]),this[t+"Minute"]=Number(s[1]),this[t+"Second"]=Number(s[2])}else{if(!e)return void("start"===t?this.startYear=this.year-60:this.endYear=this.year+60);Number(e)&&(e=parseInt(e));const s=/[0-9]:[0-9]/;"datetime"!==this.type||"end"!==t||"string"!=typeof e||s.test(e)||(e+=" 23:59:59");const i=new Date(e);this[t+"Year"]=i.getFullYear(),this[t+"Month"]=i.getMonth()+1,this[t+"Day"]=i.getDate(),"datetime"===this.type&&(this[t+"Hour"]=i.getHours(),this[t+"Minute"]=i.getMinutes(),this[t+"Second"]=i.getSeconds())}},getCurrentRange(e){const t=[];for(let s=this["min"+this.capitalize(e)];s<=this["max"+this.capitalize(e)];s++)t.push(s);return t},capitalize:e=>e.charAt(0).toUpperCase()+e.slice(1),checkValue(e,t,s){-1===s.indexOf(t)&&(this[e]=s[0])},daysInMonth:(e,t)=>new Date(e,t,0).getDate(),createTimeStamp(e){if(e)return"number"==typeof e?e:(e=e.replace(/-/g,"/"),"date"===this.type&&(e+=" 00:00:00"),Date.parse(e))},createDomSting(){const e=this.year+"-"+this.lessThanTen(this.month)+"-"+this.lessThanTen(this.day);let t=this.lessThanTen(this.hour)+":"+this.lessThanTen(this.minute);return this.hideSecond||(t=t+":"+this.lessThanTen(this.second)),"date"===this.type?e:"time"===this.type?t:e+" "+t},initTime(e=!0){this.time=this.createDomSting(),e&&("timestamp"===this.returnType&&"time"!==this.type?(this.$emit("change",this.createTimeStamp(this.time)),this.$emit("input",this.createTimeStamp(this.time)),this.$emit("update:modelValue",this.createTimeStamp(this.time))):(this.$emit("change",this.time),this.$emit("input",this.time),this.$emit("update:modelValue",this.time)))},bindDateChange(e){const t=e.detail.value;this.year=this.years[t[0]],this.month=this.months[t[1]],this.day=this.days[t[2]]},bindTimeChange(e){const t=e.detail.value;this.hour=this.hours[t[0]],this.minute=this.minutes[t[1]],this.second=this.seconds[t[2]]},initTimePicker(){if(this.disabled)return;const e=_e(this.time);this.initPickerValue(e),this.visible=!this.visible},tiggerTimePicker(e){this.visible=!this.visible},clearTime(){this.time="",this.$emit("change",this.time),this.$emit("input",this.time),this.$emit("update:modelValue",this.time),this.tiggerTimePicker()},setTime(){this.initTime(),this.tiggerTimePicker()}}};const be=oe(Se,[["render",function(e,t,d,p,_,S){const b=y,x=m,v=T,D=w;return s(),i(x,{class:"uni-datetime-picker"},{default:n((()=>[a(x,{onClick:S.initTimePicker},{default:n((()=>[c(e.$slots,"default",{},(()=>[a(x,{class:r(["uni-datetime-picker-timebox-pointer",{"uni-datetime-picker-disabled":d.disabled,"uni-datetime-picker-timebox":d.border}])},{default:n((()=>[a(b,{class:"uni-datetime-picker-text"},{default:n((()=>[f(g(_.time),1)])),_:1}),_.time?l("",!0):(s(),i(x,{key:0,class:"uni-datetime-picker-time"},{default:n((()=>[a(b,{class:"uni-datetime-picker-text"},{default:n((()=>[f(g(S.selectTimeText),1)])),_:1})])),_:1}))])),_:1},8,["class"])]),!0)])),_:3},8,["onClick"]),_.visible?(s(),i(x,{key:0,id:"mask",class:"uni-datetime-picker-mask",onClick:S.tiggerTimePicker},null,8,["onClick"])):l("",!0),_.visible?(s(),i(x,{key:1,class:r(["uni-datetime-picker-popup",[_.dateShow&&_.timeShow?"":"fix-nvue-height"]]),style:o(_.fixNvueBug)},{default:n((()=>[a(x,{class:"uni-title"},{default:n((()=>[a(b,{class:"uni-datetime-picker-text"},{default:n((()=>[f(g(S.selectTimeText),1)])),_:1})])),_:1}),_.dateShow?(s(),i(x,{key:0,class:"uni-datetime-picker__container-box"},{default:n((()=>[a(D,{class:"uni-datetime-picker-view","indicator-style":_.indicatorStyle,value:S.ymd,onChange:S.bindDateChange},{default:n((()=>[a(v,null,{default:n((()=>[(s(!0),h(u,null,k(S.years,((e,t)=>(s(),i(x,{class:"uni-datetime-picker-item",key:t},{default:n((()=>[a(b,{class:"uni-datetime-picker-item"},{default:n((()=>[f(g(S.lessThanTen(e)),1)])),_:2},1024)])),_:2},1024)))),128))])),_:1}),a(v,null,{default:n((()=>[(s(!0),h(u,null,k(S.months,((e,t)=>(s(),i(x,{class:"uni-datetime-picker-item",key:t},{default:n((()=>[a(b,{class:"uni-datetime-picker-item"},{default:n((()=>[f(g(S.lessThanTen(e)),1)])),_:2},1024)])),_:2},1024)))),128))])),_:1}),a(v,null,{default:n((()=>[(s(!0),h(u,null,k(S.days,((e,t)=>(s(),i(x,{class:"uni-datetime-picker-item",key:t},{default:n((()=>[a(b,{class:"uni-datetime-picker-item"},{default:n((()=>[f(g(S.lessThanTen(e)),1)])),_:2},1024)])),_:2},1024)))),128))])),_:1})])),_:1},8,["indicator-style","value","onChange"]),a(b,{class:"uni-datetime-picker-sign sign-left"},{default:n((()=>[f("-")])),_:1}),a(b,{class:"uni-datetime-picker-sign sign-right"},{default:n((()=>[f("-")])),_:1})])),_:1})):l("",!0),_.timeShow?(s(),i(x,{key:1,class:"uni-datetime-picker__container-box"},{default:n((()=>[a(D,{class:r(["uni-datetime-picker-view",[d.hideSecond?"time-hide-second":""]]),"indicator-style":_.indicatorStyle,value:S.hms,onChange:S.bindTimeChange},{default:n((()=>[a(v,null,{default:n((()=>[(s(!0),h(u,null,k(S.hours,((e,t)=>(s(),i(x,{class:"uni-datetime-picker-item",key:t},{default:n((()=>[a(b,{class:"uni-datetime-picker-item"},{default:n((()=>[f(g(S.lessThanTen(e)),1)])),_:2},1024)])),_:2},1024)))),128))])),_:1}),a(v,null,{default:n((()=>[(s(!0),h(u,null,k(S.minutes,((e,t)=>(s(),i(x,{class:"uni-datetime-picker-item",key:t},{default:n((()=>[a(b,{class:"uni-datetime-picker-item"},{default:n((()=>[f(g(S.lessThanTen(e)),1)])),_:2},1024)])),_:2},1024)))),128))])),_:1}),d.hideSecond?l("",!0):(s(),i(v,{key:0},{default:n((()=>[(s(!0),h(u,null,k(S.seconds,((e,t)=>(s(),i(x,{class:"uni-datetime-picker-item",key:t},{default:n((()=>[a(b,{class:"uni-datetime-picker-item"},{default:n((()=>[f(g(S.lessThanTen(e)),1)])),_:2},1024)])),_:2},1024)))),128))])),_:1}))])),_:1},8,["class","indicator-style","value","onChange"]),a(b,{class:r(["uni-datetime-picker-sign",[d.hideSecond?"sign-center":"sign-left"]])},{default:n((()=>[f(":")])),_:1},8,["class"]),d.hideSecond?l("",!0):(s(),i(b,{key:0,class:"uni-datetime-picker-sign sign-right"},{default:n((()=>[f(":")])),_:1}))])),_:1})):l("",!0),a(x,{class:"uni-datetime-picker-btn"},{default:n((()=>[a(x,{onClick:S.clearTime},{default:n((()=>[a(b,{class:"uni-datetime-picker-btn-text"},{default:n((()=>[f(g(S.clearText),1)])),_:1})])),_:1},8,["onClick"]),a(x,{class:"uni-datetime-picker-btn-group"},{default:n((()=>[a(x,{class:"uni-datetime-picker-cancel",onClick:S.tiggerTimePicker},{default:n((()=>[a(b,{class:"uni-datetime-picker-btn-text"},{default:n((()=>[f(g(S.cancelText),1)])),_:1})])),_:1},8,["onClick"]),a(x,{onClick:S.setTime},{default:n((()=>[a(b,{class:"uni-datetime-picker-btn-text"},{default:n((()=>[f(g(S.okText),1)])),_:1})])),_:1},8,["onClick"])])),_:1})])),_:1})])),_:1},8,["class","style"])):l("",!0)])),_:3})}],["__scopeId","data-v-8e4813cb"]]),{t:xe}=_(Te),ve={components:{calendarItem:ke,timePicker:be},options:{virtualHost:!0},props:{date:{type:String,default:""},defTime:{type:[String,Object],default:""},selectableTimes:{type:[Object],default:()=>({})},selected:{type:Array,default:()=>[]},startDate:{type:String,default:""},endDate:{type:String,default:""},startPlaceholder:{type:String,default:""},endPlaceholder:{type:String,default:""},range:{type:Boolean,default:!1},hasTime:{type:Boolean,default:!1},insert:{type:Boolean,default:!0},showMonth:{type:Boolean,default:!0},clearDate:{type:Boolean,default:!0},checkHover:{type:Boolean,default:!0},hideSecond:{type:[Boolean],default:!1},pleStatus:{type:Object,default:()=>({before:"",after:"",data:[],fulldate:""})},defaultValue:{type:[String,Object,Array],default:""}},data:()=>({show:!1,weeks:[],calendar:{},nowDate:{},aniMaskShow:!1,firstEnter:!0,time:"",timeRange:{startTime:"",endTime:""},tempSingleDate:"",tempRange:{before:"",after:""}}),watch:{date:{immediate:!0,handler(e){this.range||(this.tempSingleDate=e,setTimeout((()=>{this.init(e)}),100))}},defTime:{immediate:!0,handler(e){this.range?(this.timeRange.startTime=e.start,this.timeRange.endTime=e.end):this.time=e}},startDate(e){this.cale&&(this.cale.setStartDate(e),this.cale.setDate(this.nowDate.fullDate),this.weeks=this.cale.weeks)},endDate(e){this.cale&&(this.cale.setEndDate(e),this.cale.setDate(this.nowDate.fullDate),this.weeks=this.cale.weeks)},selected(e){this.cale&&(this.cale.setSelectInfo(this.nowDate.fullDate,e),this.weeks=this.cale.weeks)},pleStatus:{immediate:!0,handler(e){const{before:t,after:s,fulldate:i,which:n}=e;this.tempRange.before=t,this.tempRange.after=s,setTimeout((()=>{if(i)if(this.cale.setHoverMultiple(i),t&&s){if(this.cale.lastHover=!0,this.rangeWithinMonth(s,t))return;this.setDate(t)}else this.cale.setMultiple(i),this.setDate(this.nowDate.fullDate),this.calendar.fullDate="",this.cale.lastHover=!1;else{if(!this.cale)return;this.cale.setDefaultMultiple(t,s),"left"===n&&t?(this.setDate(t),this.weeks=this.cale.weeks):s&&(this.setDate(s),this.weeks=this.cale.weeks),this.cale.lastHover=!0}}),16)}}},computed:{timepickerStartTime(){return(this.range?this.tempRange.before:this.calendar.fullDate)===this.startDate?this.selectableTimes.start:""},timepickerEndTime(){return(this.range?this.tempRange.after:this.calendar.fullDate)===this.endDate?this.selectableTimes.end:""},selectDateText:()=>xe("uni-datetime-picker.selectDate"),startDateText(){return this.startPlaceholder||xe("uni-datetime-picker.startDate")},endDateText(){return this.endPlaceholder||xe("uni-datetime-picker.endDate")},okText:()=>xe("uni-datetime-picker.ok"),yearText:()=>xe("uni-datetime-picker.year"),monthText:()=>xe("uni-datetime-picker.month"),MONText:()=>xe("uni-calender.MON"),TUEText:()=>xe("uni-calender.TUE"),WEDText:()=>xe("uni-calender.WED"),THUText:()=>xe("uni-calender.THU"),FRIText:()=>xe("uni-calender.FRI"),SATText:()=>xe("uni-calender.SAT"),SUNText:()=>xe("uni-calender.SUN"),confirmText:()=>xe("uni-calender.confirm")},created(){this.cale=new class{constructor({selected:e,startDate:t,endDate:s,range:i}={}){this.date=this.getDateObj(new Date),this.selected=e||[],this.startDate=t,this.endDate=s,this.range=i,this.cleanMultipleStatus(),this.weeks={},this.lastHover=!1}setDate(e){const t=this.getDateObj(e);this.getWeeks(t.fullDate)}cleanMultipleStatus(){this.multipleStatus={before:"",after:"",data:[]}}setStartDate(e){this.startDate=e}setEndDate(e){this.endDate=e}getPreMonthObj(e){e=_e(e);const t=(e=new Date(e)).getMonth();e.setMonth(t-1);const s=e.getMonth();return 0!==t&&s-t==0&&e.setMonth(s-1),this.getDateObj(e)}getNextMonthObj(e){e=_e(e);const t=(e=new Date(e)).getMonth();e.setMonth(t+1);const s=e.getMonth();return s-t>1&&e.setMonth(s-1),this.getDateObj(e)}getDateObj(e){return e=_e(e),{fullDate:ue(e=new Date(e)),year:e.getFullYear(),month:pe(e.getMonth()+1),date:pe(e.getDate()),day:e.getDay()}}getPreMonthDays(e,t){const s=[];for(let i=e-1;i>=0;i--){const e=t.month-1;s.push({date:new Date(t.year,e,-i).getDate(),month:e,disable:!0})}return s}getCurrentMonthDays(e,t){const s=[],i=this.date.fullDate;for(let n=1;n<=e;n++){const e=`${t.year}-${t.month}-${pe(n)}`,a=i===e,r=this.selected&&this.selected.find((t=>{if(this.dateEqual(e,t.date))return t}));this.startDate&&fe(this.startDate,e),this.endDate&&fe(e,this.endDate);let o=this.multipleStatus.data,l=-1;this.range&&o&&(l=o.findIndex((t=>this.dateEqual(t,e))));const c=-1!==l;s.push({fullDate:e,year:t.year,date:n,multiple:!!this.range&&c,beforeMultiple:this.isLogicBefore(e,this.multipleStatus.before,this.multipleStatus.after),afterMultiple:this.isLogicAfter(e,this.multipleStatus.before,this.multipleStatus.after),month:t.month,disable:this.startDate&&!fe(this.startDate,e)||this.endDate&&!fe(e,this.endDate),isToday:a,userChecked:!1,extraInfo:r})}return s}_getNextMonthDays(e,t){const s=[],i=t.month+1;for(let n=1;n<=e;n++)s.push({date:n,month:i,disable:!0});return s}getInfo(e){e||(e=new Date);return this.calendar.find((t=>t.fullDate===this.getDateObj(e).fullDate))||this.getDateObj(e)}dateEqual(e,t){return e=new Date(_e(e)),t=new Date(_e(t)),e.valueOf()===t.valueOf()}isLogicBefore(e,t,s){let i=t;return t&&s&&(i=fe(t,s)?t:s),this.dateEqual(i,e)}isLogicAfter(e,t,s){let i=s;return t&&s&&(i=fe(t,s)?s:t),this.dateEqual(i,e)}geDateAll(e,t){var s=[],i=e.split("-"),n=t.split("-"),a=new Date;a.setFullYear(i[0],i[1]-1,i[2]);var r=new Date;r.setFullYear(n[0],n[1]-1,n[2]);for(var o=a.getTime()-864e5,l=r.getTime()-864e5,c=o;c<=l;)c+=864e5,s.push(this.getDateObj(new Date(parseInt(c))).fullDate);return s}setMultiple(e){if(!this.range)return;let{before:t,after:s}=this.multipleStatus;if(t&&s){if(!this.lastHover)return void(this.lastHover=!0);this.multipleStatus.before=e,this.multipleStatus.after="",this.multipleStatus.data=[],this.multipleStatus.fulldate="",this.lastHover=!1}else t?(this.multipleStatus.after=e,fe(this.multipleStatus.before,this.multipleStatus.after)?this.multipleStatus.data=this.geDateAll(this.multipleStatus.before,this.multipleStatus.after):this.multipleStatus.data=this.geDateAll(this.multipleStatus.after,this.multipleStatus.before),this.lastHover=!0):(this.multipleStatus.before=e,this.multipleStatus.after=void 0,this.lastHover=!1);this.getWeeks(e)}setHoverMultiple(e){if(!this.range||this.lastHover)return;const{before:t}=this.multipleStatus;t?(this.multipleStatus.after=e,fe(this.multipleStatus.before,this.multipleStatus.after)?this.multipleStatus.data=this.geDateAll(this.multipleStatus.before,this.multipleStatus.after):this.multipleStatus.data=this.geDateAll(this.multipleStatus.after,this.multipleStatus.before)):this.multipleStatus.before=e,this.getWeeks(e)}setDefaultMultiple(e,t){this.multipleStatus.before=e,this.multipleStatus.after=t,e&&t&&(fe(e,t)?(this.multipleStatus.data=this.geDateAll(e,t),this.getWeeks(t)):(this.multipleStatus.data=this.geDateAll(t,e),this.getWeeks(e)))}getWeeks(e){const{year:t,month:s}=this.getDateObj(e),i=new Date(t,s-1,1).getDay(),n=this.getPreMonthDays(i,this.getDateObj(e)),a=new Date(t,s,0).getDate(),r=42-i-a,o=[...n,...this.getCurrentMonthDays(a,this.getDateObj(e)),...this._getNextMonthDays(r,this.getDateObj(e))],l=new Array(6);for(let c=0;c<o.length;c++){const e=Math.floor(c/7);l[e]||(l[e]=new Array(7)),l[e][c%7]=o[c]}this.calendar=o,this.weeks=l}}({selected:this.selected,startDate:this.startDate,endDate:this.endDate,range:this.range}),this.init(this.date)},methods:{leaveCale(){this.firstEnter=!0},handleMouse(e){if(e.disable)return;if(this.cale.lastHover)return;let{before:t,after:s}=this.cale.multipleStatus;t&&(this.calendar=e,this.cale.setHoverMultiple(this.calendar.fullDate),this.weeks=this.cale.weeks,this.firstEnter&&(this.$emit("firstEnterCale",this.cale.multipleStatus),this.firstEnter=!1))},rangeWithinMonth(e,t){const[s,i]=e.split("-"),[n,a]=t.split("-");return s===n&&i===a},maskClick(){this.close(),this.$emit("maskClose")},clearCalender(){this.range?(this.timeRange.startTime="",this.timeRange.endTime="",this.tempRange.before="",this.tempRange.after="",this.cale.multipleStatus.before="",this.cale.multipleStatus.after="",this.cale.multipleStatus.data=[],this.cale.lastHover=!1):(this.time="",this.tempSingleDate=""),this.calendar.fullDate="",this.setDate(new Date)},bindDateChange(e){const t=e.detail.value+"-1";this.setDate(t)},init(e){if(this.cale&&(this.cale.setDate(e||new Date),this.weeks=this.cale.weeks,this.nowDate=this.cale.getInfo(e),this.calendar={...this.nowDate},!e&&(this.calendar.fullDate="",this.defaultValue&&!this.range))){const e=new Date(this.defaultValue),t=ue(e),s=e.getFullYear(),i=e.getMonth()+1,n=e.getDate(),a=e.getDay();this.calendar={fullDate:t,year:s,month:i,date:n,day:a},this.tempSingleDate=t,this.time=de(e,this.hideSecond)}},open(){this.clearDate&&!this.insert&&(this.cale.cleanMultipleStatus(),this.init(this.date)),this.show=!0,this.$nextTick((()=>{setTimeout((()=>{this.aniMaskShow=!0}),50)}))},close(){this.aniMaskShow=!1,this.$nextTick((()=>{setTimeout((()=>{this.show=!1,this.$emit("close")}),300)}))},confirm(){this.setEmit("confirm"),this.close()},change(e){(this.insert||e)&&this.setEmit("change")},monthSwitch(){let{year:e,month:t}=this.nowDate;this.$emit("monthSwitch",{year:e,month:Number(t)})},setEmit(e){this.range||(this.calendar.fullDate||(this.calendar=this.cale.getInfo(new Date),this.tempSingleDate=this.calendar.fullDate),this.hasTime&&!this.time&&(this.time=de(new Date,this.hideSecond)));let{year:t,month:s,date:i,fullDate:n,extraInfo:a}=this.calendar;this.$emit(e,{range:this.cale.multipleStatus,year:t,month:s,date:i,time:this.time,timeRange:this.timeRange,fulldate:n,extraInfo:a||{}})},choiceDate(e){if(e.disable)return;this.calendar=e,this.calendar.userChecked=!0,this.cale.setMultiple(this.calendar.fullDate,!0),this.weeks=this.cale.weeks,this.tempSingleDate=this.calendar.fullDate;const t=new Date(this.cale.multipleStatus.before).getTime(),s=new Date(this.cale.multipleStatus.after).getTime();t>s&&s?(this.tempRange.before=this.cale.multipleStatus.after,this.tempRange.after=this.cale.multipleStatus.before):(this.tempRange.before=this.cale.multipleStatus.before,this.tempRange.after=this.cale.multipleStatus.after),this.change(!0)},changeMonth(e){let t;"pre"===e?t=this.cale.getPreMonthObj(this.nowDate.fullDate).fullDate:"next"===e&&(t=this.cale.getNextMonthObj(this.nowDate.fullDate).fullDate),this.setDate(t),this.monthSwitch()},setDate(e){this.cale.setDate(e),this.weeks=this.cale.weeks,this.nowDate=this.cale.getInfo(e)}}};const De={name:"UniDatetimePicker",options:{virtualHost:!0},components:{Calendar:oe(ve,[["render",function(o,c,d,p,_,T){const w=m,v=y,D=x,I=S("calendar-item"),P=S("time-picker"),C=re(t("uni-icons"),e);return s(),i(w,{class:"uni-calendar",onMouseleave:T.leaveCale},{default:n((()=>[!d.insert&&_.show?(s(),i(w,{key:0,class:r(["uni-calendar__mask",{"uni-calendar--mask-show":_.aniMaskShow}]),onClick:T.maskClick},null,8,["class","onClick"])):l("",!0),d.insert||_.show?(s(),i(w,{key:1,class:r(["uni-calendar__content",{"uni-calendar--fixed":!d.insert,"uni-calendar--ani-show":_.aniMaskShow,"uni-calendar__content-mobile":_.aniMaskShow}])},{default:n((()=>[a(w,{class:r(["uni-calendar__header",{"uni-calendar__header-mobile":!d.insert}])},{default:n((()=>[a(w,{class:"uni-calendar__header-btn-box",onClick:c[0]||(c[0]=b((e=>T.changeMonth("pre")),["stop"]))},{default:n((()=>[a(w,{class:"uni-calendar__header-btn uni-calendar--left"})])),_:1}),a(D,{mode:"date",value:d.date,fields:"month",onChange:T.bindDateChange},{default:n((()=>[a(v,{class:"uni-calendar__header-text"},{default:n((()=>[f(g((_.nowDate.year||"")+T.yearText+(_.nowDate.month||"")+T.monthText),1)])),_:1})])),_:1},8,["value","onChange"]),a(w,{class:"uni-calendar__header-btn-box",onClick:c[1]||(c[1]=b((e=>T.changeMonth("next")),["stop"]))},{default:n((()=>[a(w,{class:"uni-calendar__header-btn uni-calendar--right"})])),_:1}),d.insert?l("",!0):(s(),i(w,{key:0,class:"dialog-close",onClick:T.maskClick},{default:n((()=>[a(w,{class:"dialog-close-plus","data-id":"close"}),a(w,{class:"dialog-close-plus dialog-close-rotate","data-id":"close"})])),_:1},8,["onClick"]))])),_:1},8,["class"]),a(w,{class:"uni-calendar__box"},{default:n((()=>[d.showMonth?(s(),i(w,{key:0,class:"uni-calendar__box-bg"},{default:n((()=>[a(v,{class:"uni-calendar__box-bg-text"},{default:n((()=>[f(g(_.nowDate.month),1)])),_:1})])),_:1})):l("",!0),a(w,{class:"uni-calendar__weeks",style:{"padding-bottom":"7px"}},{default:n((()=>[a(w,{class:"uni-calendar__weeks-day"},{default:n((()=>[a(v,{class:"uni-calendar__weeks-day-text"},{default:n((()=>[f(g(T.SUNText),1)])),_:1})])),_:1}),a(w,{class:"uni-calendar__weeks-day"},{default:n((()=>[a(v,{class:"uni-calendar__weeks-day-text"},{default:n((()=>[f(g(T.MONText),1)])),_:1})])),_:1}),a(w,{class:"uni-calendar__weeks-day"},{default:n((()=>[a(v,{class:"uni-calendar__weeks-day-text"},{default:n((()=>[f(g(T.TUEText),1)])),_:1})])),_:1}),a(w,{class:"uni-calendar__weeks-day"},{default:n((()=>[a(v,{class:"uni-calendar__weeks-day-text"},{default:n((()=>[f(g(T.WEDText),1)])),_:1})])),_:1}),a(w,{class:"uni-calendar__weeks-day"},{default:n((()=>[a(v,{class:"uni-calendar__weeks-day-text"},{default:n((()=>[f(g(T.THUText),1)])),_:1})])),_:1}),a(w,{class:"uni-calendar__weeks-day"},{default:n((()=>[a(v,{class:"uni-calendar__weeks-day-text"},{default:n((()=>[f(g(T.FRIText),1)])),_:1})])),_:1}),a(w,{class:"uni-calendar__weeks-day"},{default:n((()=>[a(v,{class:"uni-calendar__weeks-day-text"},{default:n((()=>[f(g(T.SATText),1)])),_:1})])),_:1})])),_:1}),(s(!0),h(u,null,k(_.weeks,((e,t)=>(s(),i(w,{class:"uni-calendar__weeks",key:t},{default:n((()=>[(s(!0),h(u,null,k(e,((e,t)=>(s(),i(w,{class:"uni-calendar__weeks-item",key:t},{default:n((()=>[a(I,{class:"uni-calendar-item--hook",weeks:e,calendar:_.calendar,selected:d.selected,checkHover:d.range,onChange:T.choiceDate,onHandleMouse:T.handleMouse},null,8,["weeks","calendar","selected","checkHover","onChange","onHandleMouse"])])),_:2},1024)))),128))])),_:2},1024)))),128))])),_:1}),d.insert||d.range||!d.hasTime?l("",!0):(s(),i(w,{key:0,class:"uni-date-changed uni-calendar--fixed-top",style:{padding:"0 80px"}},{default:n((()=>[a(w,{class:"uni-date-changed--time-date"},{default:n((()=>[f(g(_.tempSingleDate?_.tempSingleDate:T.selectDateText),1)])),_:1}),a(P,{type:"time",start:T.timepickerStartTime,end:T.timepickerEndTime,modelValue:_.time,"onUpdate:modelValue":c[2]||(c[2]=e=>_.time=e),disabled:!_.tempSingleDate,border:!1,"hide-second":d.hideSecond,class:"time-picker-style"},null,8,["start","end","modelValue","disabled","hide-second"])])),_:1})),!d.insert&&d.range&&d.hasTime?(s(),i(w,{key:1,class:"uni-date-changed uni-calendar--fixed-top"},{default:n((()=>[a(w,{class:"uni-date-changed--time-start"},{default:n((()=>[a(w,{class:"uni-date-changed--time-date"},{default:n((()=>[f(g(_.tempRange.before?_.tempRange.before:T.startDateText),1)])),_:1}),a(P,{type:"time",start:T.timepickerStartTime,modelValue:_.timeRange.startTime,"onUpdate:modelValue":c[3]||(c[3]=e=>_.timeRange.startTime=e),border:!1,"hide-second":d.hideSecond,disabled:!_.tempRange.before,class:"time-picker-style"},null,8,["start","modelValue","hide-second","disabled"])])),_:1}),a(w,{style:{"line-height":"50px"}},{default:n((()=>[a(C,{type:"arrowthinright",color:"#999"})])),_:1}),a(w,{class:"uni-date-changed--time-end"},{default:n((()=>[a(w,{class:"uni-date-changed--time-date"},{default:n((()=>[f(g(_.tempRange.after?_.tempRange.after:T.endDateText),1)])),_:1}),a(P,{type:"time",end:T.timepickerEndTime,modelValue:_.timeRange.endTime,"onUpdate:modelValue":c[4]||(c[4]=e=>_.timeRange.endTime=e),border:!1,"hide-second":d.hideSecond,disabled:!_.tempRange.after,class:"time-picker-style"},null,8,["end","modelValue","hide-second","disabled"])])),_:1})])),_:1})):l("",!0),d.insert?l("",!0):(s(),i(w,{key:2,class:"uni-date-changed uni-date-btn--ok"},{default:n((()=>[a(w,{class:"uni-datetime-picker--btn",onClick:T.confirm},{default:n((()=>[f(g(T.confirmText),1)])),_:1},8,["onClick"])])),_:1}))])),_:1},8,["class"])):l("",!0)])),_:1},8,["onMouseleave"])}],["__scopeId","data-v-24c3b263"]]),TimePicker:be},data:()=>({isRange:!1,hasTime:!1,displayValue:"",inputDate:"",calendarDate:"",pickerTime:"",calendarRange:{startDate:"",startTime:"",endDate:"",endTime:""},displayRangeValue:{startDate:"",endDate:""},tempRange:{startDate:"",startTime:"",endDate:"",endTime:""},startMultipleStatus:{before:"",after:"",data:[],fulldate:""},endMultipleStatus:{before:"",after:"",data:[],fulldate:""},pickerVisible:!1,pickerPositionStyle:null,isEmitValue:!1,isPhone:!1,isFirstShow:!0,i18nT:()=>{}}),props:{type:{type:String,default:"datetime"},value:{type:[String,Number,Array,Date],default:""},modelValue:{type:[String,Number,Array,Date],default:""},start:{type:[Number,String],default:""},end:{type:[Number,String],default:""},returnType:{type:String,default:"string"},placeholder:{type:String,default:""},startPlaceholder:{type:String,default:""},endPlaceholder:{type:String,default:""},rangeSeparator:{type:String,default:"-"},border:{type:[Boolean],default:!0},disabled:{type:[Boolean],default:!1},clearIcon:{type:[Boolean],default:!0},hideSecond:{type:[Boolean],default:!1},defaultValue:{type:[String,Object,Array],default:""}},watch:{type:{immediate:!0,handler(e){this.hasTime=-1!==e.indexOf("time"),this.isRange=-1!==e.indexOf("range")}},modelValue:{immediate:!0,handler(e){this.isEmitValue?this.isEmitValue=!1:this.initPicker(e)}},start:{immediate:!0,handler(e){e&&(this.calendarRange.startDate=ue(e),this.hasTime&&(this.calendarRange.startTime=de(e)))}},end:{immediate:!0,handler(e){e&&(this.calendarRange.endDate=ue(e),this.hasTime&&(this.calendarRange.endTime=de(e,this.hideSecond)))}}},computed:{timepickerStartTime(){return(this.isRange?this.tempRange.startDate:this.inputDate)===this.calendarRange.startDate?this.calendarRange.startTime:""},timepickerEndTime(){return(this.isRange?this.tempRange.endDate:this.inputDate)===this.calendarRange.endDate?this.calendarRange.endTime:""},mobileCalendarTime(){const e={start:this.tempRange.startTime,end:this.tempRange.endTime};return this.isRange?e:this.pickerTime},mobSelectableTime(){return{start:this.calendarRange.startTime,end:this.calendarRange.endTime}},datePopupWidth(){return this.isRange?653:301},singlePlaceholderText(){return this.placeholder||("date"===this.type?this.selectDateText:this.selectDateTimeText)},startPlaceholderText(){return this.startPlaceholder||this.startDateText},endPlaceholderText(){return this.endPlaceholder||this.endDateText},selectDateText(){return this.i18nT("uni-datetime-picker.selectDate")},selectDateTimeText(){return this.i18nT("uni-datetime-picker.selectDateTime")},selectTimeText(){return this.i18nT("uni-datetime-picker.selectTime")},startDateText(){return this.startPlaceholder||this.i18nT("uni-datetime-picker.startDate")},startTimeText(){return this.i18nT("uni-datetime-picker.startTime")},endDateText(){return this.endPlaceholder||this.i18nT("uni-datetime-picker.endDate")},endTimeText(){return this.i18nT("uni-datetime-picker.endTime")},okText(){return this.i18nT("uni-datetime-picker.ok")},clearText(){return this.i18nT("uni-datetime-picker.clear")},showClearIcon(){return this.clearIcon&&!this.disabled&&(this.displayValue||this.displayRangeValue.startDate&&this.displayRangeValue.endDate)}},created(){this.initI18nT(),this.platform()},methods:{initI18nT(){const e=_(Te);this.i18nT=e.t},initPicker(e){if(!e&&!this.defaultValue||Array.isArray(e)&&!e.length)this.$nextTick((()=>{this.clear(!1)}));else if(Array.isArray(e)||this.isRange){const[t,s]=e;if(!t&&!s)return;const i=ue(t),n=de(t,this.hideSecond),a=ue(s),r=de(s,this.hideSecond),o=i,l=a;this.displayRangeValue.startDate=this.tempRange.startDate=o,this.displayRangeValue.endDate=this.tempRange.endDate=l,this.hasTime&&(this.displayRangeValue.startDate=`${i} ${n}`,this.displayRangeValue.endDate=`${a} ${r}`,this.tempRange.startTime=n,this.tempRange.endTime=r);const c={before:i,after:a};this.startMultipleStatus=Object.assign({},this.startMultipleStatus,c,{which:"right"}),this.endMultipleStatus=Object.assign({},this.endMultipleStatus,c,{which:"left"})}else e?(this.displayValue=this.inputDate=this.calendarDate=ue(e),this.hasTime&&(this.pickerTime=de(e,this.hideSecond),this.displayValue=`${this.displayValue} ${this.pickerTime}`)):this.defaultValue&&(this.inputDate=this.calendarDate=ue(this.defaultValue),this.hasTime&&(this.pickerTime=de(this.defaultValue,this.hideSecond)))},updateLeftCale(e){const t=this.$refs.left;t.cale.setHoverMultiple(e.after),t.setDate(this.$refs.left.nowDate.fullDate)},updateRightCale(e){const t=this.$refs.right;t.cale.setHoverMultiple(e.after),t.setDate(this.$refs.right.nowDate.fullDate)},platform(){if("undefined"!=typeof navigator)return void(this.isPhone=-1!==navigator.userAgent.toLowerCase().indexOf("mobile"));const{windowWidth:e}=v();this.isPhone=e<=500,this.windowWidth=e},show(){if(this.$emit("show"),this.disabled)return;if(this.platform(),this.isPhone)return void setTimeout((()=>{this.$refs.mobile.open()}),0);this.pickerPositionStyle={top:"10px"};D().in(this).select(".uni-date-editor").boundingClientRect((e=>{this.windowWidth-e.left<this.datePopupWidth&&(this.pickerPositionStyle.right=0)})).exec(),setTimeout((()=>{if(this.pickerVisible=!this.pickerVisible,!this.isPhone&&this.isRange&&this.isFirstShow){this.isFirstShow=!1;const{startDate:e,endDate:t}=this.calendarRange;e&&t?this.diffDate(e,t)<30&&this.$refs.right.changeMonth("pre"):this.isPhone&&(this.$refs.right.cale.lastHover=!1)}}),50)},close(){setTimeout((()=>{this.pickerVisible=!1,this.$emit("maskClick",this.value),this.$refs.mobile&&this.$refs.mobile.close()}),20)},setEmit(e){"timestamp"!==this.returnType&&"date"!==this.returnType||(Array.isArray(e)?(this.hasTime||(e[0]=e[0]+" 00:00:00",e[1]=e[1]+" 00:00:00"),e[0]=this.createTimestamp(e[0]),e[1]=this.createTimestamp(e[1]),"date"===this.returnType&&(e[0]=new Date(e[0]),e[1]=new Date(e[1]))):(this.hasTime||(e+=" 00:00:00"),e=this.createTimestamp(e),"date"===this.returnType&&(e=new Date(e)))),this.$emit("update:modelValue",e),this.$emit("input",e),this.$emit("change",e),this.isEmitValue=!0},createTimestamp:e=>(e=_e(e),Date.parse(new Date(e))),singleChange(e){this.calendarDate=this.inputDate=e.fulldate,this.hasTime||this.confirmSingleChange()},confirmSingleChange(){if(!ge(this.inputDate)){const e=new Date;this.calendarDate=this.inputDate=ue(e),this.pickerTime=de(e,this.hideSecond)}let e,t,s=!1;if(this.start){let i=this.start;"number"==typeof this.start&&(i=he(this.start,this.hideSecond)),[e,t]=i.split(" "),this.start&&!fe(e,this.inputDate)&&(s=!0,this.inputDate=e)}let i,n,a=!1;if(this.end){let e=this.end;"number"==typeof this.end&&(e=he(this.end,this.hideSecond)),[i,n]=e.split(" "),this.end&&!fe(this.inputDate,i)&&(a=!0,this.inputDate=i)}this.hasTime?(s&&(this.pickerTime=t||me(this.hideSecond)),a&&(this.pickerTime=n||me(this.hideSecond)),this.pickerTime||(this.pickerTime=de(Date.now(),this.hideSecond)),this.displayValue=`${this.inputDate} ${this.pickerTime}`):this.displayValue=this.inputDate,this.setEmit(this.displayValue),this.pickerVisible=!1},leftChange(e){const{before:t,after:s}=e.range;this.rangeChange(t,s);const i={before:e.range.before,after:e.range.after,data:e.range.data,fulldate:e.fulldate};this.startMultipleStatus=Object.assign({},this.startMultipleStatus,i),this.$emit("calendarClick",e)},rightChange(e){const{before:t,after:s}=e.range;this.rangeChange(t,s);const i={before:e.range.before,after:e.range.after,data:e.range.data,fulldate:e.fulldate};this.endMultipleStatus=Object.assign({},this.endMultipleStatus,i),this.$emit("calendarClick",e)},mobileChange(e){if(this.isRange){const{before:t,after:s}=e.range;if(!t)return;if(this.handleStartAndEnd(t,s,!0),this.hasTime){const{startTime:t,endTime:s}=e.timeRange;this.tempRange.startTime=t,this.tempRange.endTime=s}this.confirmRangeChange()}else this.hasTime?this.displayValue=e.fulldate+" "+e.time:this.displayValue=e.fulldate,this.setEmit(this.displayValue);this.$refs.mobile.close()},rangeChange(e,t){e&&t&&(this.handleStartAndEnd(e,t,!0),this.hasTime||this.confirmRangeChange())},confirmRangeChange(){if(!this.tempRange.startDate||!this.tempRange.endDate)return void(this.pickerVisible=!1);let e,t;ge(this.tempRange.startDate)||(this.tempRange.startDate=ue(Date.now())),ge(this.tempRange.endDate)||(this.tempRange.endDate=ue(Date.now()));let s,i,n=!1,a=!1;if(this.start){let e=this.start;"number"==typeof this.start&&(e=he(this.start,this.hideSecond)),[s,i]=e.split(" "),this.start&&!fe(this.start,`${this.tempRange.startDate} ${this.tempRange.startTime}`)&&(n=!0,this.tempRange.startDate=s),this.start&&!fe(this.start,`${this.tempRange.endDate} ${this.tempRange.endTime}`)&&(a=!0,this.tempRange.endDate=s)}let r,o,l=!1,c=!1;if(this.end){let e=this.end;"number"==typeof this.end&&(e=he(this.end,this.hideSecond)),[r,o]=e.split(" "),this.end&&!fe(`${this.tempRange.startDate} ${this.tempRange.startTime}`,this.end)&&(l=!0,this.tempRange.startDate=r),this.end&&!fe(`${this.tempRange.endDate} ${this.tempRange.endTime}`,this.end)&&(c=!0,this.tempRange.endDate=r)}this.hasTime?(n?this.tempRange.startTime=i||me(this.hideSecond):l&&(this.tempRange.startTime=o||me(this.hideSecond)),this.tempRange.startTime||(this.tempRange.startTime=de(Date.now(),this.hideSecond)),a?this.tempRange.endTime=i||me(this.hideSecond):c&&(this.tempRange.endTime=o||me(this.hideSecond)),this.tempRange.endTime||(this.tempRange.endTime=de(Date.now(),this.hideSecond)),e=this.displayRangeValue.startDate=`${this.tempRange.startDate} ${this.tempRange.startTime}`,t=this.displayRangeValue.endDate=`${this.tempRange.endDate} ${this.tempRange.endTime}`):(e=this.displayRangeValue.startDate=this.tempRange.startDate,t=this.displayRangeValue.endDate=this.tempRange.endDate),fe(e,t)||([e,t]=[t,e]),this.displayRangeValue.startDate=e,this.displayRangeValue.endDate=t;const h=[e,t];this.setEmit(h),this.pickerVisible=!1},handleStartAndEnd(e,t,s=!1){if(!e)return;t||(t=e);const i=s?"tempRange":"range",n=fe(e,t);this[i].startDate=n?e:t,this[i].endDate=n?t:e},dateCompare:(e,t)=>(e=new Date(e.replace("-","/").replace("-","/")))<=(t=new Date(t.replace("-","/").replace("-","/"))),diffDate(e,t){e=new Date(e.replace("-","/").replace("-","/"));const s=((t=new Date(t.replace("-","/").replace("-","/")))-e)/864e5;return Math.abs(s)},clear(e=!0){this.isRange?(this.displayRangeValue.startDate="",this.displayRangeValue.endDate="",this.tempRange.startDate="",this.tempRange.startTime="",this.tempRange.endDate="",this.tempRange.endTime="",this.isPhone?this.$refs.mobile&&this.$refs.mobile.clearCalender():(this.$refs.left&&this.$refs.left.clearCalender(),this.$refs.right&&this.$refs.right.clearCalender(),this.$refs.right&&this.$refs.right.changeMonth("next")),e&&(this.$emit("change",[]),this.$emit("input",[]),this.$emit("update:modelValue",[]))):(this.displayValue="",this.inputDate="",this.pickerTime="",this.isPhone?this.$refs.mobile&&this.$refs.mobile.clearCalender():this.$refs.pcSingle&&this.$refs.pcSingle.clearCalender(),e&&(this.$emit("change",""),this.$emit("input",""),this.$emit("update:modelValue","")))},calendarClick(e){this.$emit("calendarClick",e)}}};const Ie=oe(De,[["render",function(h,u,d,_,k,T){const w=re(t("uni-icons"),e),x=m,v=p,D=S("time-picker"),C=S("Calendar"),A=y;return s(),i(x,{class:"uni-date"},{default:n((()=>[a(x,{class:"uni-date-editor",onClick:T.show},{default:n((()=>[c(h.$slots,"default",{},(()=>[a(x,{class:r(["uni-date-editor--x",{"uni-date-editor--x__disabled":d.disabled,"uni-date-x--border":d.border}])},{default:n((()=>[k.isRange?(s(),i(x,{key:1,class:"uni-date-x uni-date-range"},{default:n((()=>[a(w,{class:"icon-calendar",type:"calendar",color:"#c0c4cc",size:"22"}),a(x,{class:"uni-date__x-input text-center"},{default:n((()=>[f(g(k.displayRangeValue.startDate||T.startPlaceholderText),1)])),_:1}),a(x,{class:"range-separator"},{default:n((()=>[f(g(d.rangeSeparator),1)])),_:1}),a(x,{class:"uni-date__x-input text-center"},{default:n((()=>[f(g(k.displayRangeValue.endDate||T.endPlaceholderText),1)])),_:1})])),_:1})):(s(),i(x,{key:0,class:"uni-date-x uni-date-single"},{default:n((()=>[a(w,{class:"icon-calendar",type:"calendar",color:"#c0c4cc",size:"22"}),a(x,{class:"uni-date__x-input"},{default:n((()=>[f(g(k.displayValue||T.singlePlaceholderText),1)])),_:1})])),_:1})),T.showClearIcon?(s(),i(x,{key:2,class:"uni-date__icon-clear",onClick:b(T.clear,["stop"])},{default:n((()=>[a(w,{type:"clear",color:"#c0c4cc",size:"22"})])),_:1},8,["onClick"])):l("",!0)])),_:1},8,["class"])]),!0)])),_:3},8,["onClick"]),I(a(x,{class:"uni-date-mask--pc",onClick:T.close},null,8,["onClick"]),[[P,k.pickerVisible]]),k.isPhone?l("",!0):I((s(),i(x,{key:0,ref:"datePicker",class:"uni-date-picker__container"},{default:n((()=>[k.isRange?(s(),i(x,{key:1,class:"uni-date-range--x",style:o(k.pickerPositionStyle)},{default:n((()=>[a(x,{class:"uni-popper__arrow"}),k.hasTime?(s(),i(x,{key:0,class:"popup-x-header uni-date-changed"},{default:n((()=>[a(x,{class:"popup-x-header--datetime"},{default:n((()=>[a(v,{class:"uni-date__input uni-date-range__input",type:"text",modelValue:k.tempRange.startDate,"onUpdate:modelValue":u[3]||(u[3]=e=>k.tempRange.startDate=e),placeholder:T.startDateText},null,8,["modelValue","placeholder"]),a(D,{type:"time",modelValue:k.tempRange.startTime,"onUpdate:modelValue":u[5]||(u[5]=e=>k.tempRange.startTime=e),start:T.timepickerStartTime,border:!1,disabled:!k.tempRange.startDate,hideSecond:d.hideSecond},{default:n((()=>[a(v,{class:"uni-date__input uni-date-range__input",type:"text",modelValue:k.tempRange.startTime,"onUpdate:modelValue":u[4]||(u[4]=e=>k.tempRange.startTime=e),placeholder:T.startTimeText,disabled:!k.tempRange.startDate},null,8,["modelValue","placeholder","disabled"])])),_:1},8,["modelValue","start","disabled","hideSecond"])])),_:1}),a(w,{type:"arrowthinright",color:"#999",style:{"line-height":"40px"}}),a(x,{class:"popup-x-header--datetime"},{default:n((()=>[a(v,{class:"uni-date__input uni-date-range__input",type:"text",modelValue:k.tempRange.endDate,"onUpdate:modelValue":u[6]||(u[6]=e=>k.tempRange.endDate=e),placeholder:T.endDateText},null,8,["modelValue","placeholder"]),a(D,{type:"time",modelValue:k.tempRange.endTime,"onUpdate:modelValue":u[8]||(u[8]=e=>k.tempRange.endTime=e),end:T.timepickerEndTime,border:!1,disabled:!k.tempRange.endDate,hideSecond:d.hideSecond},{default:n((()=>[a(v,{class:"uni-date__input uni-date-range__input",type:"text",modelValue:k.tempRange.endTime,"onUpdate:modelValue":u[7]||(u[7]=e=>k.tempRange.endTime=e),placeholder:T.endTimeText,disabled:!k.tempRange.endDate},null,8,["modelValue","placeholder","disabled"])])),_:1},8,["modelValue","end","disabled","hideSecond"])])),_:1})])),_:1})):l("",!0),a(x,{class:"popup-x-body"},{default:n((()=>[a(C,{ref:"left",showMonth:!1,"start-date":k.calendarRange.startDate,"end-date":k.calendarRange.endDate,range:!0,pleStatus:k.endMultipleStatus,onChange:T.leftChange,onFirstEnterCale:T.updateRightCale,style:{padding:"0 8px"}},null,8,["start-date","end-date","pleStatus","onChange","onFirstEnterCale"]),a(C,{ref:"right",showMonth:!1,"start-date":k.calendarRange.startDate,"end-date":k.calendarRange.endDate,range:!0,onChange:T.rightChange,pleStatus:k.startMultipleStatus,onFirstEnterCale:T.updateLeftCale,style:{padding:"0 8px","border-left":"1px solid #F1F1F1"}},null,8,["start-date","end-date","onChange","pleStatus","onFirstEnterCale"])])),_:1}),k.hasTime?(s(),i(x,{key:1,class:"popup-x-footer"},{default:n((()=>[a(A,{onClick:T.clear},{default:n((()=>[f(g(T.clearText),1)])),_:1},8,["onClick"]),a(A,{class:"confirm-text",onClick:T.confirmRangeChange},{default:n((()=>[f(g(T.okText),1)])),_:1},8,["onClick"])])),_:1})):l("",!0)])),_:1},8,["style"])):(s(),i(x,{key:0,class:"uni-date-single--x",style:o(k.pickerPositionStyle)},{default:n((()=>[a(x,{class:"uni-popper__arrow"}),k.hasTime?(s(),i(x,{key:0,class:"uni-date-changed popup-x-header"},{default:n((()=>[a(v,{class:"uni-date__input text-center",type:"text",modelValue:k.inputDate,"onUpdate:modelValue":u[0]||(u[0]=e=>k.inputDate=e),placeholder:T.selectDateText},null,8,["modelValue","placeholder"]),a(D,{type:"time",modelValue:k.pickerTime,"onUpdate:modelValue":u[2]||(u[2]=e=>k.pickerTime=e),border:!1,disabled:!k.inputDate,start:T.timepickerStartTime,end:T.timepickerEndTime,hideSecond:d.hideSecond,style:{width:"100%"}},{default:n((()=>[a(v,{class:"uni-date__input text-center",type:"text",modelValue:k.pickerTime,"onUpdate:modelValue":u[1]||(u[1]=e=>k.pickerTime=e),placeholder:T.selectTimeText,disabled:!k.inputDate},null,8,["modelValue","placeholder","disabled"])])),_:1},8,["modelValue","disabled","start","end","hideSecond"])])),_:1})):l("",!0),a(C,{ref:"pcSingle",showMonth:!1,"start-date":k.calendarRange.startDate,"end-date":k.calendarRange.endDate,date:k.calendarDate,onChange:T.singleChange,"default-value":d.defaultValue,style:{padding:"0 8px"}},null,8,["start-date","end-date","date","onChange","default-value"]),k.hasTime?(s(),i(x,{key:1,class:"popup-x-footer"},{default:n((()=>[a(A,{class:"confirm-text",onClick:T.confirmSingleChange},{default:n((()=>[f(g(T.okText),1)])),_:1},8,["onClick"])])),_:1})):l("",!0)])),_:1},8,["style"]))])),_:1},512)),[[P,k.pickerVisible]]),k.isPhone?(s(),i(C,{key:1,ref:"mobile",clearDate:!1,date:k.calendarDate,defTime:T.mobileCalendarTime,"start-date":k.calendarRange.startDate,"end-date":k.calendarRange.endDate,selectableTimes:T.mobSelectableTime,startPlaceholder:d.startPlaceholder,endPlaceholder:d.endPlaceholder,"default-value":d.defaultValue,pleStatus:k.endMultipleStatus,showMonth:!1,range:k.isRange,hasTime:k.hasTime,insert:!1,hideSecond:d.hideSecond,onConfirm:T.mobileChange,onMaskClose:T.close,onChange:T.calendarClick},null,8,["date","defTime","start-date","end-date","selectableTimes","startPlaceholder","endPlaceholder","default-value","pleStatus","range","hasTime","hideSecond","onConfirm","onMaskClose","onChange"])):l("",!0)])),_:3})}],["__scopeId","data-v-fee868d0"]]),Pe={pages:[{path:"pages/actManage/index",style:{navigationBarTitleText:"首页"}},{path:"pages/actManage/actDetail",style:{navigationBarTitleText:"活动详情"}},{path:"pages/actManage/rankList",style:{navigationBarTitleText:"排行榜"}},{path:"pages/actManage/track",style:{navigationBarTitleText:"场地直播"}},{path:"pages/login/login",style:{navigationBarTitleText:"登录"}},{path:"pages/login/register",style:{navigationBarTitleText:"注册"}},{path:"pages/my/index",style:{navigationBarTitleText:"我的"}},{path:"pages/my/costList",style:{navigationBarTitleText:"费用明细"}},{path:"pages/my/onlinePay",style:{navigationBarTitleText:"在线充值"}},{path:"pages/actCreate/index",style:{navigationBarTitleText:"自助开赛"}},{path:"pages/actCreate/actEdit",style:{navigationBarTitleText:"赛事修改"}}],globalStyle:{navigationStyle:"custom",navigationBarTextStyle:"black",navigationBarTitleText:"uni-app",navigationBarBackgroundColor:"#F8F8F8",backgroundColor:"#F8F8F8"},tabBar:{color:"#808080",selectedColor:"#017DC7",borderStyle:"black",backgroundColor:"#ffffff",height:"66px",fontSize:"15px",iconWidth:"24px",spacing:"3px",list:[{pagePath:"pages/actManage/index",iconPath:"static/tab/home.png",selectedIconPath:"static/tab/home_act.png",text:"首页"},{pagePath:"pages/actCreate/index",iconPath:"static/tab/create.png",selectedIconPath:"static/tab/create_act.png",text:"自助开赛"},{pagePath:"pages/my/index",iconPath:"static/tab/my.png",selectedIconPath:"static/tab/my_act.png",text:"我的"}]},uniIdRouter:{}};function Ce(e,t,s){return e(s={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&s.path)}},s.exports),s.exports}var Ae=Ce((function(e,t){var s;e.exports=(s=s||function(e,t){var s=Object.create||function(){function e(){}return function(t){var s;return e.prototype=t,s=new e,e.prototype=null,s}}(),i={},n=i.lib={},a=n.Base={extend:function(e){var t=s(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},r=n.WordArray=a.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||l).stringify(this)},concat:function(e){var t=this.words,s=e.words,i=this.sigBytes,n=e.sigBytes;if(this.clamp(),i%4)for(var a=0;a<n;a++){var r=s[a>>>2]>>>24-a%4*8&255;t[i+a>>>2]|=r<<24-(i+a)%4*8}else for(a=0;a<n;a+=4)t[i+a>>>2]=s[a>>>2];return this.sigBytes+=n,this},clamp:function(){var t=this.words,s=this.sigBytes;t[s>>>2]&=4294967295<<32-s%4*8,t.length=e.ceil(s/4)},clone:function(){var e=a.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var s,i=[],n=function(t){var s=987654321,i=4294967295;return function(){var n=((s=36969*(65535&s)+(s>>16)&i)<<16)+(t=18e3*(65535&t)+(t>>16)&i)&i;return n/=4294967296,(n+=.5)*(e.random()>.5?1:-1)}},a=0;a<t;a+=4){var o=n(4294967296*(s||e.random()));s=987654071*o(),i.push(4294967296*o()|0)}return new r.init(i,t)}}),o=i.enc={},l=o.Hex={stringify:function(e){for(var t=e.words,s=e.sigBytes,i=[],n=0;n<s;n++){var a=t[n>>>2]>>>24-n%4*8&255;i.push((a>>>4).toString(16)),i.push((15&a).toString(16))}return i.join("")},parse:function(e){for(var t=e.length,s=[],i=0;i<t;i+=2)s[i>>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new r.init(s,t/2)}},c=o.Latin1={stringify:function(e){for(var t=e.words,s=e.sigBytes,i=[],n=0;n<s;n++){var a=t[n>>>2]>>>24-n%4*8&255;i.push(String.fromCharCode(a))}return i.join("")},parse:function(e){for(var t=e.length,s=[],i=0;i<t;i++)s[i>>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new r.init(s,t)}},h=o.Utf8={stringify:function(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(e){return c.parse(unescape(encodeURIComponent(e)))}},u=n.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new r.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=h.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var s=this._data,i=s.words,n=s.sigBytes,a=this.blockSize,o=n/(4*a),l=(o=t?e.ceil(o):e.max((0|o)-this._minBufferSize,0))*a,c=e.min(4*l,n);if(l){for(var h=0;h<l;h+=a)this._doProcessBlock(i,h);var u=i.splice(0,l);s.sigBytes-=c}return new r.init(u,c)},clone:function(){var e=a.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});n.Hasher=u.extend({cfg:a.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){u.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,s){return new e.init(s).finalize(t)}},_createHmacHelper:function(e){return function(t,s){return new d.HMAC.init(e,s).finalize(t)}}});var d=i.algo={};return i}(Math),s)})),Re=Ae,Me=(Ce((function(e,t){var s;e.exports=(s=Re,function(e){var t=s,i=t.lib,n=i.WordArray,a=i.Hasher,r=t.algo,o=[];!function(){for(var t=0;t<64;t++)o[t]=4294967296*e.abs(e.sin(t+1))|0}();var l=r.MD5=a.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var s=0;s<16;s++){var i=t+s,n=e[i];e[i]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}var a=this._hash.words,r=e[t+0],l=e[t+1],p=e[t+2],m=e[t+3],f=e[t+4],g=e[t+5],y=e[t+6],_=e[t+7],k=e[t+8],T=e[t+9],w=e[t+10],S=e[t+11],b=e[t+12],x=e[t+13],v=e[t+14],D=e[t+15],I=a[0],P=a[1],C=a[2],A=a[3];I=c(I,P,C,A,r,7,o[0]),A=c(A,I,P,C,l,12,o[1]),C=c(C,A,I,P,p,17,o[2]),P=c(P,C,A,I,m,22,o[3]),I=c(I,P,C,A,f,7,o[4]),A=c(A,I,P,C,g,12,o[5]),C=c(C,A,I,P,y,17,o[6]),P=c(P,C,A,I,_,22,o[7]),I=c(I,P,C,A,k,7,o[8]),A=c(A,I,P,C,T,12,o[9]),C=c(C,A,I,P,w,17,o[10]),P=c(P,C,A,I,S,22,o[11]),I=c(I,P,C,A,b,7,o[12]),A=c(A,I,P,C,x,12,o[13]),C=c(C,A,I,P,v,17,o[14]),I=h(I,P=c(P,C,A,I,D,22,o[15]),C,A,l,5,o[16]),A=h(A,I,P,C,y,9,o[17]),C=h(C,A,I,P,S,14,o[18]),P=h(P,C,A,I,r,20,o[19]),I=h(I,P,C,A,g,5,o[20]),A=h(A,I,P,C,w,9,o[21]),C=h(C,A,I,P,D,14,o[22]),P=h(P,C,A,I,f,20,o[23]),I=h(I,P,C,A,T,5,o[24]),A=h(A,I,P,C,v,9,o[25]),C=h(C,A,I,P,m,14,o[26]),P=h(P,C,A,I,k,20,o[27]),I=h(I,P,C,A,x,5,o[28]),A=h(A,I,P,C,p,9,o[29]),C=h(C,A,I,P,_,14,o[30]),I=u(I,P=h(P,C,A,I,b,20,o[31]),C,A,g,4,o[32]),A=u(A,I,P,C,k,11,o[33]),C=u(C,A,I,P,S,16,o[34]),P=u(P,C,A,I,v,23,o[35]),I=u(I,P,C,A,l,4,o[36]),A=u(A,I,P,C,f,11,o[37]),C=u(C,A,I,P,_,16,o[38]),P=u(P,C,A,I,w,23,o[39]),I=u(I,P,C,A,x,4,o[40]),A=u(A,I,P,C,r,11,o[41]),C=u(C,A,I,P,m,16,o[42]),P=u(P,C,A,I,y,23,o[43]),I=u(I,P,C,A,T,4,o[44]),A=u(A,I,P,C,b,11,o[45]),C=u(C,A,I,P,D,16,o[46]),I=d(I,P=u(P,C,A,I,p,23,o[47]),C,A,r,6,o[48]),A=d(A,I,P,C,_,10,o[49]),C=d(C,A,I,P,v,15,o[50]),P=d(P,C,A,I,g,21,o[51]),I=d(I,P,C,A,b,6,o[52]),A=d(A,I,P,C,m,10,o[53]),C=d(C,A,I,P,w,15,o[54]),P=d(P,C,A,I,l,21,o[55]),I=d(I,P,C,A,k,6,o[56]),A=d(A,I,P,C,D,10,o[57]),C=d(C,A,I,P,y,15,o[58]),P=d(P,C,A,I,x,21,o[59]),I=d(I,P,C,A,f,6,o[60]),A=d(A,I,P,C,S,10,o[61]),C=d(C,A,I,P,p,15,o[62]),P=d(P,C,A,I,T,21,o[63]),a[0]=a[0]+I|0,a[1]=a[1]+P|0,a[2]=a[2]+C|0,a[3]=a[3]+A|0},_doFinalize:function(){var t=this._data,s=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;s[n>>>5]|=128<<24-n%32;var a=e.floor(i/4294967296),r=i;s[15+(n+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),s[14+(n+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),t.sigBytes=4*(s.length+1),this._process();for(var o=this._hash,l=o.words,c=0;c<4;c++){var h=l[c];l[c]=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8)}return o},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}});function c(e,t,s,i,n,a,r){var o=e+(t&s|~t&i)+n+r;return(o<<a|o>>>32-a)+t}function h(e,t,s,i,n,a,r){var o=e+(t&i|s&~i)+n+r;return(o<<a|o>>>32-a)+t}function u(e,t,s,i,n,a,r){var o=e+(t^s^i)+n+r;return(o<<a|o>>>32-a)+t}function d(e,t,s,i,n,a,r){var o=e+(s^(t|~i))+n+r;return(o<<a|o>>>32-a)+t}t.MD5=a._createHelper(l),t.HmacMD5=a._createHmacHelper(l)}(Math),s.MD5)})),Ce((function(e,t){var s,i,n;e.exports=(i=(s=Re).lib.Base,n=s.enc.Utf8,void(s.algo.HMAC=i.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=n.parse(t));var s=e.blockSize,i=4*s;t.sigBytes>i&&(t=e.finalize(t)),t.clamp();for(var a=this._oKey=t.clone(),r=this._iKey=t.clone(),o=a.words,l=r.words,c=0;c<s;c++)o[c]^=1549556828,l[c]^=909522486;a.sigBytes=r.sigBytes=i,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,s=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(s))}})))})),Ce((function(e,t){e.exports=Re.HmacMD5}))),Oe=Ce((function(e,t){e.exports=Re.enc.Utf8})),Ee=Ce((function(e,t){var s,i,n;e.exports=(n=(i=s=Re).lib.WordArray,i.enc.Base64={stringify:function(e){var t=e.words,s=e.sigBytes,i=this._map;e.clamp();for(var n=[],a=0;a<s;a+=3)for(var r=(t[a>>>2]>>>24-a%4*8&255)<<16|(t[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|t[a+2>>>2]>>>24-(a+2)%4*8&255,o=0;o<4&&a+.75*o<s;o++)n.push(i.charAt(r>>>6*(3-o)&63));var l=i.charAt(64);if(l)for(;n.length%4;)n.push(l);return n.join("")},parse:function(e){var t=e.length,s=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var a=0;a<s.length;a++)i[s.charCodeAt(a)]=a}var r=s.charAt(64);if(r){var o=e.indexOf(r);-1!==o&&(t=o)}return function(e,t,s){for(var i=[],a=0,r=0;r<t;r++)if(r%4){var o=s[e.charCodeAt(r-1)]<<r%4*2,l=s[e.charCodeAt(r)]>>>6-r%4*2;i[a>>>2]|=(o|l)<<24-a%4*8,a++}return n.create(i,a)}(e,t,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},s.enc.Base64)}));const Fe="uni_id_token",$e="uni_id_token_expired",Le="FUNCTION",Ue="OBJECT",Ne="CLIENT_DB",je="pending",Ve="rejected";function qe(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function Be(e){return"object"===qe(e)}function He(e){return"function"==typeof e}function Ke(e){return function(){try{return e.apply(e,arguments)}catch(t){console.error(t)}}}const We="REJECTED",ze="NOT_PENDING";class Je{constructor({createPromise:e,retryRule:t=We}={}){this.createPromise=e,this.status=null,this.promise=null,this.retryRule=t}get needRetry(){if(!this.status)return!0;switch(this.retryRule){case We:return this.status===Ve;case ze:return this.status!==je}}exec(){return this.needRetry?(this.status=je,this.promise=this.createPromise().then((e=>(this.status="fulfilled",Promise.resolve(e))),(e=>(this.status=Ve,Promise.reject(e)))),this.promise):this.promise}}function Ye(e){return e&&"string"==typeof e?JSON.parse(e):e}const Qe=Ye([]);Ye("");const Ge=Ye("[]")||[];let Xe="";try{Xe="__UNI__F804C11"}catch(Vt){}let Ze,et={};function tt(e,t={}){var s,i;return s=et,i=e,Object.prototype.hasOwnProperty.call(s,i)||(et[e]=t),et[e]}const st=["invoke","success","fail","complete"],it=tt("_globalUniCloudInterceptor");function nt(e,t){it[e]||(it[e]={}),Be(t)&&Object.keys(t).forEach((s=>{st.indexOf(s)>-1&&function(e,t,s){let i=it[e][t];i||(i=it[e][t]=[]),-1===i.indexOf(s)&&He(s)&&i.push(s)}(e,s,t[s])}))}function at(e,t){it[e]||(it[e]={}),Be(t)?Object.keys(t).forEach((s=>{st.indexOf(s)>-1&&function(e,t,s){const i=it[e][t];if(!i)return;const n=i.indexOf(s);n>-1&&i.splice(n,1)}(e,s,t[s])})):delete it[e]}function rt(e,t){return e&&0!==e.length?e.reduce(((e,s)=>e.then((()=>s(t)))),Promise.resolve()):Promise.resolve()}function ot(e,t){return it[e]&&it[e][t]||[]}function lt(e){nt("callObject",e)}const ct=tt("_globalUniCloudListener"),ht="response",ut="needLogin",dt="refreshToken",pt="clientdb",mt="cloudfunction",ft="cloudobject";function gt(e){return ct[e]||(ct[e]=[]),ct[e]}function yt(e,t){const s=gt(e);s.includes(t)||s.push(t)}function _t(e,t){const s=gt(e),i=s.indexOf(t);-1!==i&&s.splice(i,1)}function kt(e,t){const s=gt(e);for(let i=0;i<s.length;i++)(0,s[i])(t)}let Tt,wt=!1;function St(){return Tt||(Tt=new Promise((e=>{wt&&e(),function t(){if("function"==typeof R){const t=R();t&&t[0]&&(wt=!0,e())}wt||setTimeout((()=>{t()}),30)}()})),Tt)}function bt(e){const t={};for(const s in e){const i=e[s];He(i)&&(t[s]=Ke(i))}return t}class xt extends Error{constructor(e){super(e.message),this.errMsg=e.message||e.errMsg||"unknown system error",this.code=this.errCode=e.code||e.errCode||"SYSTEM_ERROR",this.errSubject=this.subject=e.subject||e.errSubject,this.cause=e.cause,this.requestId=e.requestId}toJson(e=0){if(!(e>=10))return e++,{errCode:this.errCode,errMsg:this.errMsg,errSubject:this.errSubject,cause:this.cause&&this.cause.toJson?this.cause.toJson(e):this.cause}}}var vt={request:e=>j(e),uploadFile:e=>V(e),setStorageSync:(e,t)=>q(e,t),getStorageSync:e=>B(e),removeStorageSync:e=>H(e),clearStorageSync:()=>K(),connectSocket:e=>W(e)};function Dt(e){return e&&Dt(e.__v_raw)||e}function It(){return{token:vt.getStorageSync(Fe)||vt.getStorageSync("uniIdToken"),tokenExpired:vt.getStorageSync($e)}}function Pt({token:e,tokenExpired:t}={}){e&&vt.setStorageSync(Fe,e),t&&vt.setStorageSync($e,t)}let Ct,At;function Rt(){return Ct||(Ct=v()),Ct}function Mt(){let e,t;try{if(ee){if(ee.toString().indexOf("not yet implemented")>-1)return;const{scene:s,channel:i}=ee();e=i,t=s}}catch(s){}return{channel:e,scene:t}}let Ot={};function Et(){const e=Z&&Z()||"en";if(At)return{...Ot,...At,locale:e,LOCALE:e};const t=Rt(),{deviceId:s,osName:i,uniPlatform:n,appId:a}=t,r=["appId","appLanguage","appName","appVersion","appVersionCode","appWgtVersion","browserName","browserVersion","deviceBrand","deviceId","deviceModel","deviceType","osName","osVersion","romName","romVersion","ua","hostName","hostVersion","uniPlatform","uniRuntimeVersion","uniRuntimeVersionCode","uniCompilerVersion","uniCompilerVersionCode"];for(const o in t)Object.hasOwnProperty.call(t,o)&&-1===r.indexOf(o)&&delete t[o];return At={PLATFORM:n,OS:i,APPID:a,DEVICEID:s,...Mt(),...t},{...Ot,...At,locale:e,LOCALE:e}}var Ft=function(e,t){let s="";return Object.keys(e).sort().forEach((function(t){e[t]&&(s=s+"&"+t+"="+e[t])})),s=s.slice(1),Me(s,t).toString()},$t=function(e,t){return new Promise(((s,i)=>{t(Object.assign(e,{complete(e){e||(e={});const t=e.data&&e.data.header&&e.data.header["x-serverless-request-id"]||e.header&&e.header["request-id"];if(!e.statusCode||e.statusCode>=400){const s=e.data&&e.data.error&&e.data.error.code||"SYS_ERR",n=e.data&&e.data.error&&e.data.error.message||e.errMsg||"request:fail";return i(new xt({code:s,message:n,requestId:t}))}const n=e.data;if(n.error)return i(new xt({code:n.error.code,message:n.error.message,requestId:t}));n.result=n.data,n.requestId=t,delete n.data,s(n)}}))}))},Lt=function(e){return Ee.stringify(Oe.parse(e))},Ut={init(e){const t=new class{constructor(e){["spaceId","clientSecret"].forEach((t=>{if(!Object.prototype.hasOwnProperty.call(e,t))throw new Error(`${t} required`)})),this.config=Object.assign({},{endpoint:0===e.spaceId.indexOf("mp-")?"https://api.next.bspapp.com":"https://api.bspapp.com"},e),this.config.provider="aliyun",this.config.requestUrl=this.config.endpoint+"/client",this.config.envType=this.config.envType||"public",this.config.accessTokenKey="access_token_"+this.config.spaceId,this.adapter=vt,this._getAccessTokenPromiseHub=new Je({createPromise:()=>this.requestAuth(this.setupRequest({method:"serverless.auth.user.anonymousAuthorize",params:"{}"},"auth")).then((e=>{if(!e.result||!e.result.accessToken)throw new xt({code:"AUTH_FAILED",message:"获取accessToken失败"});this.setAccessToken(e.result.accessToken)})),retryRule:ze})}get hasAccessToken(){return!!this.accessToken}setAccessToken(e){this.accessToken=e}requestWrapped(e){return $t(e,this.adapter.request)}requestAuth(e){return this.requestWrapped(e)}request(e,t){return Promise.resolve().then((()=>this.hasAccessToken?t?this.requestWrapped(e):this.requestWrapped(e).catch((t=>new Promise(((e,s)=>{!t||"GATEWAY_INVALID_TOKEN"!==t.code&&"InvalidParameter.InvalidToken"!==t.code?s(t):e()})).then((()=>this.getAccessToken())).then((()=>{const t=this.rebuildRequest(e);return this.request(t,!0)})))):this.getAccessToken().then((()=>{const t=this.rebuildRequest(e);return this.request(t,!0)}))))}rebuildRequest(e){const t=Object.assign({},e);return t.data.token=this.accessToken,t.header["x-basement-token"]=this.accessToken,t.header["x-serverless-sign"]=Ft(t.data,this.config.clientSecret),t}setupRequest(e,t){const s=Object.assign({},e,{spaceId:this.config.spaceId,timestamp:Date.now()}),i={"Content-Type":"application/json"};return"auth"!==t&&(s.token=this.accessToken,i["x-basement-token"]=this.accessToken),i["x-serverless-sign"]=Ft(s,this.config.clientSecret),{url:this.config.requestUrl,method:"POST",data:s,dataType:"json",header:i}}getAccessToken(){return this._getAccessTokenPromiseHub.exec()}async authorize(){await this.getAccessToken()}callFunction(e){const t={method:"serverless.function.runtime.invoke",params:JSON.stringify({functionTarget:e.name,functionArgs:e.data||{}})};return this.request({...this.setupRequest(t),timeout:e.timeout})}getOSSUploadOptionsFromPath(e){const t={method:"serverless.file.resource.generateProximalSign",params:JSON.stringify(e)};return this.request(this.setupRequest(t))}uploadFileToOSS({url:e,formData:t,name:s,filePath:i,fileType:n,onUploadProgress:a}){return new Promise(((r,o)=>{const l=this.adapter.uploadFile({url:e,formData:t,name:s,filePath:i,fileType:n,header:{"X-OSS-server-side-encrpytion":"AES256"},success(e){e&&e.statusCode<400?r(e):o(new xt({code:"UPLOAD_FAILED",message:"文件上传失败"}))},fail(e){o(new xt({code:e.code||"UPLOAD_FAILED",message:e.message||e.errMsg||"文件上传失败"}))}});"function"==typeof a&&l&&"function"==typeof l.onProgressUpdate&&l.onProgressUpdate((e=>{a({loaded:e.totalBytesSent,total:e.totalBytesExpectedToSend})}))}))}reportOSSUpload(e){const t={method:"serverless.file.resource.report",params:JSON.stringify(e)};return this.request(this.setupRequest(t))}async uploadFile({filePath:e,cloudPath:t,fileType:s="image",cloudPathAsRealPath:i=!1,onUploadProgress:n,config:a}){if("string"!==qe(t))throw new xt({code:"INVALID_PARAM",message:"cloudPath必须为字符串类型"});if(!(t=t.trim()))throw new xt({code:"INVALID_PARAM",message:"cloudPath不可为空"});if(/:\/\//.test(t))throw new xt({code:"INVALID_PARAM",message:"cloudPath不合法"});const r=a&&a.envType||this.config.envType;if(i&&("/"!==t[0]&&(t="/"+t),t.indexOf("\\")>-1))throw new xt({code:"INVALID_PARAM",message:"使用cloudPath作为路径时,cloudPath不可包含“\\”"});const o=(await this.getOSSUploadOptionsFromPath({env:r,filename:i?t.split("/").pop():t,fileId:i?t:void 0})).result,l="https://"+o.cdnDomain+"/"+o.ossPath,{securityToken:c,accessKeyId:h,signature:u,host:d,ossPath:p,id:m,policy:f,ossCallbackUrl:g}=o,y={"Cache-Control":"max-age=2592000","Content-Disposition":"attachment",OSSAccessKeyId:h,Signature:u,host:d,id:m,key:p,policy:f,success_action_status:200};if(c&&(y["x-oss-security-token"]=c),g){const e=JSON.stringify({callbackUrl:g,callbackBody:JSON.stringify({fileId:m,spaceId:this.config.spaceId}),callbackBodyType:"application/json"});y.callback=Lt(e)}const _={url:"https://"+o.host,formData:y,fileName:"file",name:"file",filePath:e,fileType:s};if(await this.uploadFileToOSS(Object.assign({},_,{onUploadProgress:n})),g)return{success:!0,filePath:e,fileID:l};if((await this.reportOSSUpload({id:m})).success)return{success:!0,filePath:e,fileID:l};throw new xt({code:"UPLOAD_FAILED",message:"文件上传失败"})}getTempFileURL({fileList:e}={}){return new Promise(((t,s)=>{Array.isArray(e)&&0!==e.length||s(new xt({code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"})),t({fileList:e.map((e=>({fileID:e,tempFileURL:e})))})}))}async getFileInfo({fileList:e}={}){if(!Array.isArray(e)||0===e.length)throw new xt({code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"});const t={method:"serverless.file.resource.info",params:JSON.stringify({id:e.map((e=>e.split("?")[0])).join(",")})};return{fileList:(await this.request(this.setupRequest(t))).result}}}(e),s={signInAnonymously:function(){return t.authorize()},getLoginState:function(){return Promise.resolve(!1)}};return t.auth=function(){return s},t.customAuth=t.auth,t}};const Nt="undefined"!=typeof location&&"http:"===location.protocol?"http:":"https:";var jt,Vt;(Vt=jt||(jt={})).local="local",Vt.none="none",Vt.session="session";var qt=function(){},Bt=Ce((function(e,t){var s;e.exports=(s=Re,function(e){var t=s,i=t.lib,n=i.WordArray,a=i.Hasher,r=t.algo,o=[],l=[];!function(){function t(t){for(var s=e.sqrt(t),i=2;i<=s;i++)if(!(t%i))return!1;return!0}function s(e){return 4294967296*(e-(0|e))|0}for(var i=2,n=0;n<64;)t(i)&&(n<8&&(o[n]=s(e.pow(i,.5))),l[n]=s(e.pow(i,1/3)),n++),i++}();var c=[],h=r.SHA256=a.extend({_doReset:function(){this._hash=new n.init(o.slice(0))},_doProcessBlock:function(e,t){for(var s=this._hash.words,i=s[0],n=s[1],a=s[2],r=s[3],o=s[4],h=s[5],u=s[6],d=s[7],p=0;p<64;p++){if(p<16)c[p]=0|e[t+p];else{var m=c[p-15],f=(m<<25|m>>>7)^(m<<14|m>>>18)^m>>>3,g=c[p-2],y=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;c[p]=f+c[p-7]+y+c[p-16]}var _=i&n^i&a^n&a,k=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),T=d+((o<<26|o>>>6)^(o<<21|o>>>11)^(o<<7|o>>>25))+(o&h^~o&u)+l[p]+c[p];d=u,u=h,h=o,o=r+T|0,r=a,a=n,n=i,i=T+(k+_)|0}s[0]=s[0]+i|0,s[1]=s[1]+n|0,s[2]=s[2]+a|0,s[3]=s[3]+r|0,s[4]=s[4]+o|0,s[5]=s[5]+h|0,s[6]=s[6]+u|0,s[7]=s[7]+d|0},_doFinalize:function(){var t=this._data,s=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;return s[n>>>5]|=128<<24-n%32,s[14+(n+64>>>9<<4)]=e.floor(i/4294967296),s[15+(n+64>>>9<<4)]=i,t.sigBytes=4*s.length,this._process(),this._hash},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=a._createHelper(h),t.HmacSHA256=a._createHmacHelper(h)}(Math),s.SHA256)})),Ht=Bt,Kt=Ce((function(e,t){e.exports=Re.HmacSHA256}));const Wt=()=>{let e;if(!Promise){e=()=>{},e.promise={};const t=()=>{throw new xt({message:'Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.'})};return Object.defineProperty(e.promise,"then",{get:t}),Object.defineProperty(e.promise,"catch",{get:t}),e}const t=new Promise(((t,s)=>{e=(e,i)=>e?s(e):t(i)}));return e.promise=t,e};function zt(e){return void 0===e}function Jt(e){return"[object Null]"===Object.prototype.toString.call(e)}function Yt(e=""){return e.replace(/([\s\S]+)\s+(请前往云开发AI小助手查看问题:.*)/,"$1")}function Qt(e=32){let t="";for(let s=0;s<e;s++)t+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(Math.floor(62*Math.random()));return t}var Gt;!function(e){e.WEB="web",e.WX_MP="wx_mp"}(Gt||(Gt={}));const Xt={adapter:null,runtime:void 0},Zt=["anonymousUuidKey"];class es extends qt{constructor(){super(),Xt.adapter.root.tcbObject||(Xt.adapter.root.tcbObject={})}setItem(e,t){Xt.adapter.root.tcbObject[e]=t}getItem(e){return Xt.adapter.root.tcbObject[e]}removeItem(e){delete Xt.adapter.root.tcbObject[e]}clear(){delete Xt.adapter.root.tcbObject}}function ts(e,t){switch(e){case"local":return t.localStorage||new es;case"none":return new es;default:return t.sessionStorage||new es}}class ss{constructor(e){if(!this._storage){this._persistence=Xt.adapter.primaryStorage||e.persistence,this._storage=ts(this._persistence,Xt.adapter);const t=`access_token_${e.env}`,s=`access_token_expire_${e.env}`,i=`refresh_token_${e.env}`,n=`anonymous_uuid_${e.env}`,a=`login_type_${e.env}`,r="device_id",o=`token_type_${e.env}`,l=`user_info_${e.env}`;this.keys={accessTokenKey:t,accessTokenExpireKey:s,refreshTokenKey:i,anonymousUuidKey:n,loginTypeKey:a,userInfoKey:l,deviceIdKey:r,tokenTypeKey:o}}}updatePersistence(e){if(e===this._persistence)return;const t="local"===this._persistence;this._persistence=e;const s=ts(e,Xt.adapter);for(const i in this.keys){const e=this.keys[i];if(t&&Zt.includes(i))continue;const n=this._storage.getItem(e);zt(n)||Jt(n)||(s.setItem(e,n),this._storage.removeItem(e))}this._storage=s}setStore(e,t,s){if(!this._storage)return;const i={version:s||"localCachev1",content:t},n=JSON.stringify(i);try{this._storage.setItem(e,n)}catch(a){throw a}}getStore(e,t){try{if(!this._storage)return}catch(i){return""}t=t||"localCachev1";const s=this._storage.getItem(e);return s&&s.indexOf(t)>=0?JSON.parse(s).content:""}removeStore(e){this._storage.removeItem(e)}}const is={},ns={};function as(e){return is[e]}class rs{constructor(e,t){this.data=t||null,this.name=e}}class os extends rs{constructor(e,t){super("error",{error:e,data:t}),this.error=e}}const ls=new class{constructor(){this._listeners={}}on(e,t){return s=e,i=t,(n=this._listeners)[s]=n[s]||[],n[s].push(i),this;var s,i,n}off(e,t){return function(e,t,s){if(s&&s[e]){const i=s[e].indexOf(t);-1!==i&&s[e].splice(i,1)}}(e,t,this._listeners),this}fire(e,t){if(e instanceof os)return console.error(e.error),this;const s="string"==typeof e?new rs(e,t||{}):e,i=s.name;if(this._listens(i)){s.target=this;const e=this._listeners[i]?[...this._listeners[i]]:[];for(const t of e)t.call(this,s)}return this}_listens(e){return this._listeners[e]&&this._listeners[e].length>0}};function cs(e,t){ls.on(e,t)}function hs(e,t={}){ls.fire(e,t)}function us(e,t){ls.off(e,t)}const ds="loginStateChanged",ps="loginStateExpire",ms="loginTypeChanged",fs="anonymousConverted",gs="refreshAccessToken";var ys;!function(e){e.ANONYMOUS="ANONYMOUS",e.WECHAT="WECHAT",e.WECHAT_PUBLIC="WECHAT-PUBLIC",e.WECHAT_OPEN="WECHAT-OPEN",e.CUSTOM="CUSTOM",e.EMAIL="EMAIL",e.USERNAME="USERNAME",e.NULL="NULL"}(ys||(ys={}));class _s{constructor(){this._fnPromiseMap=new Map}async run(e,t){let s=this._fnPromiseMap.get(e);return s||(s=new Promise((async(s,i)=>{try{await this._runIdlePromise();const i=t();s(await i)}catch(n){i(n)}finally{this._fnPromiseMap.delete(e)}})),this._fnPromiseMap.set(e,s)),s}_runIdlePromise(){return Promise.resolve()}}class ks{constructor(e){this._singlePromise=new _s,this._cache=as(e.env),this._baseURL=`https://${e.env}.ap-shanghai.tcb-api.tencentcloudapi.com`,this._reqClass=new Xt.adapter.reqClass({timeout:e.timeout,timeoutMsg:`请求在${e.timeout/1e3}s内未完成,已中断`,restrictedMethods:["post"]})}_getDeviceId(){if(this._deviceID)return this._deviceID;const{deviceIdKey:e}=this._cache.keys;let t=this._cache.getStore(e);return"string"==typeof t&&t.length>=16&&t.length<=48||(t=Qt(),this._cache.setStore(e,t)),this._deviceID=t,t}async _request(e,t,s={}){const i={"x-request-id":Qt(),"x-device-id":this._getDeviceId()};if(s.withAccessToken){const{tokenTypeKey:e}=this._cache.keys,t=await this.getAccessToken(),s=this._cache.getStore(e);i.authorization=`${s} ${t}`}return this._reqClass["get"===s.method?"get":"post"]({url:`${this._baseURL}${e}`,data:t,headers:i})}async _fetchAccessToken(){const{loginTypeKey:e,accessTokenKey:t,accessTokenExpireKey:s,tokenTypeKey:i}=this._cache.keys,n=this._cache.getStore(e);if(n&&n!==ys.ANONYMOUS)throw new xt({code:"INVALID_OPERATION",message:"非匿名登录不支持刷新 access token"});const a=await this._singlePromise.run("fetchAccessToken",(async()=>(await this._request("/auth/v1/signin/anonymously",{},{method:"post"})).data)),{access_token:r,expires_in:o,token_type:l}=a;return this._cache.setStore(i,l),this._cache.setStore(t,r),this._cache.setStore(s,Date.now()+1e3*o),r}isAccessTokenExpired(e,t){let s=!0;return e&&t&&(s=t<Date.now()),s}async getAccessToken(){const{accessTokenKey:e,accessTokenExpireKey:t}=this._cache.keys,s=this._cache.getStore(e),i=this._cache.getStore(t);return this.isAccessTokenExpired(s,i)?this._fetchAccessToken():s}async refreshAccessToken(){const{accessTokenKey:e,accessTokenExpireKey:t,loginTypeKey:s}=this._cache.keys;return this._cache.removeStore(e),this._cache.removeStore(t),this._cache.setStore(s,ys.ANONYMOUS),this.getAccessToken()}async getUserInfo(){return this._singlePromise.run("getUserInfo",(async()=>(await this._request("/auth/v1/user/me",{},{withAccessToken:!0,method:"get"})).data))}}const Ts=["auth.getJwt","auth.logout","auth.signInWithTicket","auth.signInAnonymously","auth.signIn","auth.fetchAccessTokenWithRefreshToken","auth.signUpWithEmailAndPassword","auth.activateEndUserMail","auth.sendPasswordResetEmail","auth.resetPasswordWithToken","auth.isUsernameRegistered"],ws={"X-SDK-Version":"1.3.5"};function Ss(e,t,s){const i=e[t];e[t]=function(t){const n={},a={};s.forEach((s=>{const{data:i,headers:r}=s.call(e,t);Object.assign(n,i),Object.assign(a,r)}));const r=t.data;return r&&(()=>{var e;if(e=r,"[object FormData]"!==Object.prototype.toString.call(e))t.data={...r,...n};else for(const t in n)r.append(t,n[t])})(),t.headers={...t.headers||{},...a},i.call(e,t)}}function bs(){const e=Math.random().toString(16).slice(2);return{data:{seqId:e},headers:{...ws,"x-seqid":e}}}class xs{constructor(e={}){var t;this.config=e,this._reqClass=new Xt.adapter.reqClass({timeout:this.config.timeout,timeoutMsg:`请求在${this.config.timeout/1e3}s内未完成,已中断`,restrictedMethods:["post"]}),this._cache=as(this.config.env),this._localCache=(t=this.config.env,ns[t]),this.oauth=new ks(this.config),Ss(this._reqClass,"post",[bs]),Ss(this._reqClass,"upload",[bs]),Ss(this._reqClass,"download",[bs])}async post(e){return await this._reqClass.post(e)}async upload(e){return await this._reqClass.upload(e)}async download(e){return await this._reqClass.download(e)}async refreshAccessToken(){let e,t;this._refreshAccessTokenPromise||(this._refreshAccessTokenPromise=this._refreshAccessToken());try{e=await this._refreshAccessTokenPromise}catch(s){t=s}if(this._refreshAccessTokenPromise=null,this._shouldRefreshAccessTokenHook=null,t)throw t;return e}async _refreshAccessToken(){const{accessTokenKey:e,accessTokenExpireKey:t,refreshTokenKey:s,loginTypeKey:i,anonymousUuidKey:n}=this._cache.keys;this._cache.removeStore(e),this._cache.removeStore(t);let a=this._cache.getStore(s);if(!a)throw new xt({message:"未登录CloudBase"});const r={refresh_token:a},o=await this.request("auth.fetchAccessTokenWithRefreshToken",r);if(o.data.code){const{code:e}=o.data;if("SIGN_PARAM_INVALID"===e||"REFRESH_TOKEN_EXPIRED"===e||"INVALID_REFRESH_TOKEN"===e){if(this._cache.getStore(i)===ys.ANONYMOUS&&"INVALID_REFRESH_TOKEN"===e){const e=this._cache.getStore(n),t=this._cache.getStore(s),i=await this.send("auth.signInAnonymously",{anonymous_uuid:e,refresh_token:t});return this.setRefreshToken(i.refresh_token),this._refreshAccessToken()}hs(ps),this._cache.removeStore(s)}throw new xt({code:o.data.code,message:`刷新access token失败:${o.data.code}`})}if(o.data.access_token)return hs(gs),this._cache.setStore(e,o.data.access_token),this._cache.setStore(t,o.data.access_token_expire+Date.now()),{accessToken:o.data.access_token,accessTokenExpire:o.data.access_token_expire};o.data.refresh_token&&(this._cache.removeStore(s),this._cache.setStore(s,o.data.refresh_token),this._refreshAccessToken())}async getAccessToken(){const{accessTokenKey:e,accessTokenExpireKey:t,refreshTokenKey:s}=this._cache.keys;if(!this._cache.getStore(s))throw new xt({message:"refresh token不存在,登录状态异常"});let i=this._cache.getStore(e),n=this._cache.getStore(t),a=!0;return this._shouldRefreshAccessTokenHook&&!(await this._shouldRefreshAccessTokenHook(i,n))&&(a=!1),(!i||!n||n<Date.now())&&a?this.refreshAccessToken():{accessToken:i,accessTokenExpire:n}}async request(e,t,s){const i=`x-tcb-trace_${this.config.env}`;let n="application/x-www-form-urlencoded";const a={action:e,env:this.config.env,dataVersion:"2019-08-16",...t};let r;if(-1===Ts.indexOf(e)&&(this._cache.keys,a.access_token=await this.oauth.getAccessToken()),"storage.uploadFile"===e){r=new FormData;for(let e in r)r.hasOwnProperty(e)&&void 0!==r[e]&&r.append(e,a[e]);n="multipart/form-data"}else{n="application/json",r={};for(let e in a)void 0!==a[e]&&(r[e]=a[e])}let o={headers:{"content-type":n}};s&&s.timeout&&(o.timeout=s.timeout),s&&s.onUploadProgress&&(o.onUploadProgress=s.onUploadProgress);const l=this._localCache.getStore(i);l&&(o.headers["X-TCB-Trace"]=l);const{parse:c,inQuery:h,search:u}=t;let d={env:this.config.env};c&&(d.parse=!0),h&&(d={...h,...d});let p=function(e,t,s={}){const i=/\?/.test(t);let n="";for(let a in s)""===n?!i&&(t+="?"):n+="&",n+=`${a}=${encodeURIComponent(s[a])}`;return/^http(s)?\:\/\//.test(t+=n)?t:`${e}${t}`}(Nt,"//tcb-api.tencentcloudapi.com/web",d);u&&(p+=u);const m=await this.post({url:p,data:r,...o}),f=m.header&&m.header["x-tcb-trace"];if(f&&this._localCache.setStore(i,f),200!==Number(m.status)&&200!==Number(m.statusCode)||!m.data)throw new xt({code:"NETWORK_ERROR",message:"network request error"});return m}async send(e,t={},s={}){const i=await this.request(e,t,{...s,onUploadProgress:t.onUploadProgress});if(("ACCESS_TOKEN_DISABLED"===i.data.code||"ACCESS_TOKEN_EXPIRED"===i.data.code)&&-1===Ts.indexOf(e)){await this.oauth.refreshAccessToken();const i=await this.request(e,t,{...s,onUploadProgress:t.onUploadProgress});if(i.data.code)throw new xt({code:i.data.code,message:Yt(i.data.message)});return i.data}if(i.data.code)throw new xt({code:i.data.code,message:Yt(i.data.message)});return i.data}setRefreshToken(e){const{accessTokenKey:t,accessTokenExpireKey:s,refreshTokenKey:i}=this._cache.keys;this._cache.removeStore(t),this._cache.removeStore(s),this._cache.setStore(i,e)}}const vs={};function Ds(e){return vs[e]}class Is{constructor(e){this.config=e,this._cache=as(e.env),this._request=Ds(e.env)}setRefreshToken(e){const{accessTokenKey:t,accessTokenExpireKey:s,refreshTokenKey:i}=this._cache.keys;this._cache.removeStore(t),this._cache.removeStore(s),this._cache.setStore(i,e)}setAccessToken(e,t){const{accessTokenKey:s,accessTokenExpireKey:i}=this._cache.keys;this._cache.setStore(s,e),this._cache.setStore(i,t)}async refreshUserInfo(){const{data:e}=await this._request.send("auth.getUserInfo",{});return this.setLocalUserInfo(e),e}setLocalUserInfo(e){const{userInfoKey:t}=this._cache.keys;this._cache.setStore(t,e)}}class Ps{constructor(e){if(!e)throw new xt({code:"PARAM_ERROR",message:"envId is not defined"});this._envId=e,this._cache=as(this._envId),this._request=Ds(this._envId),this.setUserInfo()}linkWithTicket(e){if("string"!=typeof e)throw new xt({code:"PARAM_ERROR",message:"ticket must be string"});return this._request.send("auth.linkWithTicket",{ticket:e})}linkWithRedirect(e){e.signInWithRedirect()}updatePassword(e,t){return this._request.send("auth.updatePassword",{oldPassword:t,newPassword:e})}updateEmail(e){return this._request.send("auth.updateEmail",{newEmail:e})}updateUsername(e){if("string"!=typeof e)throw new xt({code:"PARAM_ERROR",message:"username must be a string"});return this._request.send("auth.updateUsername",{username:e})}async getLinkedUidList(){const{data:e}=await this._request.send("auth.getLinkedUidList",{});let t=!1;const{users:s}=e;return s.forEach((e=>{e.wxOpenId&&e.wxPublicId&&(t=!0)})),{users:s,hasPrimaryUid:t}}setPrimaryUid(e){return this._request.send("auth.setPrimaryUid",{uid:e})}unlink(e){return this._request.send("auth.unlink",{platform:e})}async update(e){const{nickName:t,gender:s,avatarUrl:i,province:n,country:a,city:r}=e,{data:o}=await this._request.send("auth.updateUserInfo",{nickName:t,gender:s,avatarUrl:i,province:n,country:a,city:r});this.setLocalUserInfo(o)}async refresh(){const e=await this._request.oauth.getUserInfo();return this.setLocalUserInfo(e),e}setUserInfo(){const{userInfoKey:e}=this._cache.keys,t=this._cache.getStore(e);["uid","loginType","openid","wxOpenId","wxPublicId","unionId","qqMiniOpenId","email","hasPassword","customUserId","nickName","gender","avatarUrl"].forEach((e=>{this[e]=t[e]})),this.location={country:t.country,province:t.province,city:t.city}}setLocalUserInfo(e){const{userInfoKey:t}=this._cache.keys;this._cache.setStore(t,e),this.setUserInfo()}}class Cs{constructor(e){if(!e)throw new xt({code:"PARAM_ERROR",message:"envId is not defined"});this._cache=as(e);const{refreshTokenKey:t,accessTokenKey:s,accessTokenExpireKey:i}=this._cache.keys,n=this._cache.getStore(t),a=this._cache.getStore(s),r=this._cache.getStore(i);this.credential={refreshToken:n,accessToken:a,accessTokenExpire:r},this.user=new Ps(e)}get isAnonymousAuth(){return this.loginType===ys.ANONYMOUS}get isCustomAuth(){return this.loginType===ys.CUSTOM}get isWeixinAuth(){return this.loginType===ys.WECHAT||this.loginType===ys.WECHAT_OPEN||this.loginType===ys.WECHAT_PUBLIC}get loginType(){return this._cache.getStore(this._cache.keys.loginTypeKey)}}class As extends Is{async signIn(){this._cache.updatePersistence("local"),await this._request.oauth.getAccessToken(),hs(ds),hs(ms,{env:this.config.env,loginType:ys.ANONYMOUS,persistence:"local"});const e=new Cs(this.config.env);return await e.user.refresh(),e}async linkAndRetrieveDataWithTicket(e){const{anonymousUuidKey:t,refreshTokenKey:s}=this._cache.keys,i=this._cache.getStore(t),n=this._cache.getStore(s),a=await this._request.send("auth.linkAndRetrieveDataWithTicket",{anonymous_uuid:i,refresh_token:n,ticket:e});if(a.refresh_token)return this._clearAnonymousUUID(),this.setRefreshToken(a.refresh_token),await this._request.refreshAccessToken(),hs(fs,{env:this.config.env}),hs(ms,{loginType:ys.CUSTOM,persistence:"local"}),{credential:{refreshToken:a.refresh_token}};throw new xt({message:"匿名转化失败"})}_setAnonymousUUID(e){const{anonymousUuidKey:t,loginTypeKey:s}=this._cache.keys;this._cache.removeStore(t),this._cache.setStore(t,e),this._cache.setStore(s,ys.ANONYMOUS)}_clearAnonymousUUID(){this._cache.removeStore(this._cache.keys.anonymousUuidKey)}}class Rs extends Is{async signIn(e){if("string"!=typeof e)throw new xt({code:"PARAM_ERROR",message:"ticket must be a string"});const{refreshTokenKey:t}=this._cache.keys,s=await this._request.send("auth.signInWithTicket",{ticket:e,refresh_token:this._cache.getStore(t)||""});if(s.refresh_token)return this.setRefreshToken(s.refresh_token),await this._request.refreshAccessToken(),hs(ds),hs(ms,{env:this.config.env,loginType:ys.CUSTOM,persistence:this.config.persistence}),await this.refreshUserInfo(),new Cs(this.config.env);throw new xt({message:"自定义登录失败"})}}class Ms extends Is{async signIn(e,t){if("string"!=typeof e)throw new xt({code:"PARAM_ERROR",message:"email must be a string"});const{refreshTokenKey:s}=this._cache.keys,i=await this._request.send("auth.signIn",{loginType:"EMAIL",email:e,password:t,refresh_token:this._cache.getStore(s)||""}),{refresh_token:n,access_token:a,access_token_expire:r}=i;if(n)return this.setRefreshToken(n),a&&r?this.setAccessToken(a,r):await this._request.refreshAccessToken(),await this.refreshUserInfo(),hs(ds),hs(ms,{env:this.config.env,loginType:ys.EMAIL,persistence:this.config.persistence}),new Cs(this.config.env);throw i.code?new xt({code:i.code,message:`邮箱登录失败: ${i.message}`}):new xt({message:"邮箱登录失败"})}async activate(e){return this._request.send("auth.activateEndUserMail",{token:e})}async resetPasswordWithToken(e,t){return this._request.send("auth.resetPasswordWithToken",{token:e,newPassword:t})}}class Os extends Is{async signIn(e,t){if("string"!=typeof e)throw new xt({code:"PARAM_ERROR",message:"username must be a string"});"string"!=typeof t&&(t="",console.warn("password is empty"));const{refreshTokenKey:s}=this._cache.keys,i=await this._request.send("auth.signIn",{loginType:ys.USERNAME,username:e,password:t,refresh_token:this._cache.getStore(s)||""}),{refresh_token:n,access_token_expire:a,access_token:r}=i;if(n)return this.setRefreshToken(n),r&&a?this.setAccessToken(r,a):await this._request.refreshAccessToken(),await this.refreshUserInfo(),hs(ds),hs(ms,{env:this.config.env,loginType:ys.USERNAME,persistence:this.config.persistence}),new Cs(this.config.env);throw i.code?new xt({code:i.code,message:`用户名密码登录失败: ${i.message}`}):new xt({message:"用户名密码登录失败"})}}class Es{constructor(e){this.config=e,this._cache=as(e.env),this._request=Ds(e.env),this._onAnonymousConverted=this._onAnonymousConverted.bind(this),this._onLoginTypeChanged=this._onLoginTypeChanged.bind(this),cs(ms,this._onLoginTypeChanged)}get currentUser(){const e=this.hasLoginState();return e&&e.user||null}get loginType(){return this._cache.getStore(this._cache.keys.loginTypeKey)}anonymousAuthProvider(){return new As(this.config)}customAuthProvider(){return new Rs(this.config)}emailAuthProvider(){return new Ms(this.config)}usernameAuthProvider(){return new Os(this.config)}async signInAnonymously(){return new As(this.config).signIn()}async signInWithEmailAndPassword(e,t){return new Ms(this.config).signIn(e,t)}signInWithUsernameAndPassword(e,t){return new Os(this.config).signIn(e,t)}async linkAndRetrieveDataWithTicket(e){return this._anonymousAuthProvider||(this._anonymousAuthProvider=new As(this.config)),cs(fs,this._onAnonymousConverted),await this._anonymousAuthProvider.linkAndRetrieveDataWithTicket(e)}async signOut(){if(this.loginType===ys.ANONYMOUS)throw new xt({message:"匿名用户不支持登出操作"});const{refreshTokenKey:e,accessTokenKey:t,accessTokenExpireKey:s}=this._cache.keys,i=this._cache.getStore(e);if(!i)return;const n=await this._request.send("auth.logout",{refresh_token:i});return this._cache.removeStore(e),this._cache.removeStore(t),this._cache.removeStore(s),hs(ds),hs(ms,{env:this.config.env,loginType:ys.NULL,persistence:this.config.persistence}),n}async signUpWithEmailAndPassword(e,t){return this._request.send("auth.signUpWithEmailAndPassword",{email:e,password:t})}async sendPasswordResetEmail(e){return this._request.send("auth.sendPasswordResetEmail",{email:e})}onLoginStateChanged(e){cs(ds,(()=>{const t=this.hasLoginState();e.call(this,t)}));const t=this.hasLoginState();e.call(this,t)}onLoginStateExpired(e){cs(ps,e.bind(this))}onAccessTokenRefreshed(e){cs(gs,e.bind(this))}onAnonymousConverted(e){cs(fs,e.bind(this))}onLoginTypeChanged(e){cs(ms,(()=>{const t=this.hasLoginState();e.call(this,t)}))}async getAccessToken(){return{accessToken:(await this._request.getAccessToken()).accessToken,env:this.config.env}}hasLoginState(){const{accessTokenKey:e,accessTokenExpireKey:t}=this._cache.keys,s=this._cache.getStore(e),i=this._cache.getStore(t);return this._request.oauth.isAccessTokenExpired(s,i)?null:new Cs(this.config.env)}async isUsernameRegistered(e){if("string"!=typeof e)throw new xt({code:"PARAM_ERROR",message:"username must be a string"});const{data:t}=await this._request.send("auth.isUsernameRegistered",{username:e});return t&&t.isRegistered}getLoginState(){return Promise.resolve(this.hasLoginState())}async signInWithTicket(e){return new Rs(this.config).signIn(e)}shouldRefreshAccessToken(e){this._request._shouldRefreshAccessTokenHook=e.bind(this)}getUserInfo(){return this._request.send("auth.getUserInfo",{}).then((e=>e.code?e:{...e.data,requestId:e.seqId}))}getAuthHeader(){const{refreshTokenKey:e,accessTokenKey:t}=this._cache.keys,s=this._cache.getStore(e);return{"x-cloudbase-credentials":this._cache.getStore(t)+"/@@/"+s}}_onAnonymousConverted(e){const{env:t}=e.data;t===this.config.env&&this._cache.updatePersistence(this.config.persistence)}_onLoginTypeChanged(e){const{loginType:t,persistence:s,env:i}=e.data;i===this.config.env&&(this._cache.updatePersistence(s),this._cache.setStore(this._cache.keys.loginTypeKey,t))}}const Fs=function(e,t){t=t||Wt();const s=Ds(this.config.env),{cloudPath:i,filePath:n,onUploadProgress:a,fileType:r="image"}=e;return s.send("storage.getUploadMetadata",{path:i}).then((e=>{const{data:{url:o,authorization:l,token:c,fileId:h,cosFileId:u},requestId:d}=e,p={key:i,signature:l,"x-cos-meta-fileid":u,success_action_status:"201","x-cos-security-token":c};s.upload({url:o,data:p,file:n,name:i,fileType:r,onUploadProgress:a}).then((e=>{201===e.statusCode?t(null,{fileID:h,requestId:d}):t(new xt({code:"STORAGE_REQUEST_FAIL",message:`STORAGE_REQUEST_FAIL: ${e.data}`}))})).catch((e=>{t(e)}))})).catch((e=>{t(e)})),t.promise},$s=function(e,t){t=t||Wt();const s=Ds(this.config.env),{cloudPath:i}=e;return s.send("storage.getUploadMetadata",{path:i}).then((e=>{t(null,e)})).catch((e=>{t(e)})),t.promise},Ls=function({fileList:e},t){if(t=t||Wt(),!e||!Array.isArray(e))return{code:"INVALID_PARAM",message:"fileList必须是非空的数组"};for(let i of e)if(!i||"string"!=typeof i)return{code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"};const s={fileid_list:e};return Ds(this.config.env).send("storage.batchDeleteFile",s).then((e=>{e.code?t(null,e):t(null,{fileList:e.data.delete_list,requestId:e.requestId})})).catch((e=>{t(e)})),t.promise},Us=function({fileList:e},t){t=t||Wt(),e&&Array.isArray(e)||t(null,{code:"INVALID_PARAM",message:"fileList必须是非空的数组"});let s=[];for(let n of e)"object"==typeof n?(n.hasOwnProperty("fileID")&&n.hasOwnProperty("maxAge")||t(null,{code:"INVALID_PARAM",message:"fileList的元素必须是包含fileID和maxAge的对象"}),s.push({fileid:n.fileID,max_age:n.maxAge})):"string"==typeof n?s.push({fileid:n}):t(null,{code:"INVALID_PARAM",message:"fileList的元素必须是字符串"});const i={file_list:s};return Ds(this.config.env).send("storage.batchGetDownloadUrl",i).then((e=>{e.code?t(null,e):t(null,{fileList:e.data.download_list,requestId:e.requestId})})).catch((e=>{t(e)})),t.promise},Ns=async function({fileID:e},t){const s=(await Us.call(this,{fileList:[{fileID:e,maxAge:600}]})).fileList[0];if("SUCCESS"!==s.code)return t?t(s):new Promise((e=>{e(s)}));const i=Ds(this.config.env);let n=s.download_url;if(n=encodeURI(n),!t)return i.download({url:n});t(await i.download({url:n}))},js=function({name:e,data:t,query:s,parse:i,search:n,timeout:a},r){const o=r||Wt();let l;try{l=t?JSON.stringify(t):""}catch(h){return Promise.reject(h)}if(!e)return Promise.reject(new xt({code:"PARAM_ERROR",message:"函数名不能为空"}));const c={inQuery:s,parse:i,search:n,function_name:e,request_data:l};return Ds(this.config.env).send("functions.invokeFunction",c,{timeout:a}).then((e=>{if(e.code)o(null,e);else{let s=e.data.response_data;if(i)o(null,{result:s,requestId:e.requestId});else try{s=JSON.parse(e.data.response_data),o(null,{result:s,requestId:e.requestId})}catch(t){o(new xt({message:"response data must be json"}))}}return o.promise})).catch((e=>{o(e)})),o.promise},Vs={timeout:15e3,persistence:"session"},qs={};class Bs{constructor(e){this.config=e||this.config,this.authObj=void 0}init(e){switch(Xt.adapter||(this.requestClient=new Xt.adapter.reqClass({timeout:e.timeout||5e3,timeoutMsg:`请求在${(e.timeout||5e3)/1e3}s内未完成,已中断`})),this.config={...Vs,...e},!0){case this.config.timeout>6e5:console.warn("timeout大于可配置上限[10分钟],已重置为上限数值"),this.config.timeout=6e5;break;case this.config.timeout<100:console.warn("timeout小于可配置下限[100ms],已重置为下限数值"),this.config.timeout=100}return new Bs(this.config)}auth({persistence:e}={}){if(this.authObj)return this.authObj;const t=e||Xt.adapter.primaryStorage||Vs.persistence;var s;return t!==this.config.persistence&&(this.config.persistence=t),function(e){const{env:t}=e;is[t]=new ss(e),ns[t]=new ss({...e,persistence:"local"})}(this.config),s=this.config,vs[s.env]=new xs(s),this.authObj=new Es(this.config),this.authObj}on(e,t){return cs.apply(this,[e,t])}off(e,t){return us.apply(this,[e,t])}callFunction(e,t){return js.apply(this,[e,t])}deleteFile(e,t){return Ls.apply(this,[e,t])}getTempFileURL(e,t){return Us.apply(this,[e,t])}downloadFile(e,t){return Ns.apply(this,[e,t])}uploadFile(e,t){return Fs.apply(this,[e,t])}getUploadMetadata(e,t){return $s.apply(this,[e,t])}registerExtension(e){qs[e.name]=e}async invokeExtension(e,t){const s=qs[e];if(!s)throw new xt({message:`扩展${e} 必须先注册`});return await s.invoke(t,this)}useAdapters(e){const{adapter:t,runtime:s}=function(e){const t=(s=e,"[object Array]"===Object.prototype.toString.call(s)?e:[e]);var s;for(const i of t){const{isMatch:e,genAdapter:t,runtime:s}=i;if(e())return{adapter:t(),runtime:s}}}(e)||{};t&&(Xt.adapter=t),s&&(Xt.runtime=s)}}var Hs=new Bs;function Ks(e,t,s){void 0===s&&(s={});var i=/\?/.test(t),n="";for(var a in s)""===n?!i&&(t+="?"):n+="&",n+=a+"="+encodeURIComponent(s[a]);return/^http(s)?:\/\//.test(t+=n)?t:""+e+t}class Ws{get(e){const{url:t,data:s,headers:i,timeout:n}=e;return new Promise(((e,a)=>{vt.request({url:Ks("https:",t),data:s,method:"GET",header:i,timeout:n,success(t){e(t)},fail(e){a(e)}})}))}post(e){const{url:t,data:s,headers:i,timeout:n}=e;return new Promise(((e,a)=>{vt.request({url:Ks("https:",t),data:s,method:"POST",header:i,timeout:n,success(t){e(t)},fail(e){a(e)}})}))}upload(e){return new Promise(((t,s)=>{const{url:i,file:n,data:a,headers:r,fileType:o}=e,l=vt.uploadFile({url:Ks("https:",i),name:"file",formData:Object.assign({},a),filePath:n,fileType:o,header:r,success(e){const s={statusCode:e.statusCode,data:e.data||{}};200===e.statusCode&&a.success_action_status&&(s.statusCode=parseInt(a.success_action_status,10)),t(s)},fail(e){s(new Error(e.errMsg||"uploadFile:fail"))}});"function"==typeof e.onUploadProgress&&l&&"function"==typeof l.onProgressUpdate&&l.onProgressUpdate((t=>{e.onUploadProgress({loaded:t.totalBytesSent,total:t.totalBytesExpectedToSend})}))}))}}const zs={setItem(e,t){vt.setStorageSync(e,t)},getItem:e=>vt.getStorageSync(e),removeItem(e){vt.removeStorageSync(e)},clear(){vt.clearStorageSync()}};var Js={genAdapter:function(){return{root:{},reqClass:Ws,localStorage:zs,primaryStorage:"local"}},isMatch:function(){return!0},runtime:"uni_app"};Hs.useAdapters(Js);const Ys=Hs,Qs=Ys.init;Ys.init=function(e){e.env=e.spaceId;const t=Qs.call(this,e);t.config.provider="tencent",t.config.spaceId=e.spaceId;const s=t.auth;return t.auth=function(e){const t=s.call(this,e);return["linkAndRetrieveDataWithTicket","signInAnonymously","signOut","getAccessToken","getLoginState","signInWithTicket","getUserInfo"].forEach((e=>{var s;t[e]=(s=t[e],function(e){e=e||{};const{success:t,fail:i,complete:n}=bt(e);if(!(t||i||n))return s.call(this,e);s.call(this,e).then((e=>{t&&t(e),n&&n(e)}),(e=>{i&&i(e),n&&n(e)}))}).bind(t)})),t},t.customAuth=t.auth,t};var Gs=Ys;async function Xs(e,t){const s=`http://${e}:${t}/system/ping`;try{const e=await(i={url:s,timeout:500},new Promise(((e,t)=>{vt.request({...i,success(t){e(t)},fail(e){t(e)}})})));return!(!e.data||0!==e.data.code)}catch(n){return!1}var i}const Zs={"serverless.file.resource.generateProximalSign":"storage/generate-proximal-sign","serverless.file.resource.report":"storage/report","serverless.file.resource.delete":"storage/delete","serverless.file.resource.getTempFileURL":"storage/get-temp-file-url"};var ei={init(e){const t=new class{constructor(e){if(["spaceId","clientSecret"].forEach((t=>{if(!Object.prototype.hasOwnProperty.call(e,t))throw new Error(`${t} required`)})),!e.endpoint)throw new Error("集群空间未配置ApiEndpoint,配置后需要重新关联服务空间后生效");this.config=Object.assign({},e),this.config.provider="dcloud",this.config.requestUrl=this.config.endpoint+"/client",this.config.envType=this.config.envType||"public",this.adapter=vt}async request(e,t=!0){return e=this.setupRequest(e),Promise.resolve().then((()=>$t(e,this.adapter.request)))}requestLocal(e){return new Promise(((t,s)=>{this.adapter.request(Object.assign(e,{complete(e){if(e||(e={}),!e.statusCode||e.statusCode>=400){const t=e.data&&e.data.code||"SYS_ERR",i=e.data&&e.data.message||"request:fail";return s(new xt({code:t,message:i}))}t({success:!0,result:e.data})}}))}))}setupRequest(e){const t=Object.assign({},e,{spaceId:this.config.spaceId,timestamp:Date.now()}),s={"Content-Type":"application/json"};s["x-serverless-sign"]=Ft(t,this.config.clientSecret);const i=Et();s["x-client-info"]=encodeURIComponent(JSON.stringify(i));const{token:n}=It();return s["x-client-token"]=n,{url:this.config.requestUrl,method:"POST",data:t,dataType:"json",header:JSON.parse(JSON.stringify(s))}}async setupLocalRequest(e){const t=Et(),{token:s}=It(),i=Object.assign({},e,{spaceId:this.config.spaceId,timestamp:Date.now(),clientInfo:t,token:s}),{address:n,servePort:a}=this.__dev__&&this.__dev__.debugInfo||{},{address:r}=await async function(e,t){let s;for(let i=0;i<e.length;i++){const n=e[i];if(await Xs(n,t)){s=n;break}}return{address:s,port:t}}(n,a);return{url:`http://${r}:${a}/${Zs[e.method]}`,method:"POST",data:i,dataType:"json",header:JSON.parse(JSON.stringify({"Content-Type":"application/json"}))}}callFunction(e){const t={method:"serverless.function.runtime.invoke",params:JSON.stringify({functionTarget:e.name,functionArgs:e.data||{}})};return this.request(t,!1)}getUploadFileOptions(e){const t={method:"serverless.file.resource.generateProximalSign",params:JSON.stringify(e)};return this.request(t)}reportUploadFile(e){const t={method:"serverless.file.resource.report",params:JSON.stringify(e)};return this.request(t)}uploadFile({filePath:e,cloudPath:t,fileType:s="image",onUploadProgress:i}){if(!t)throw new xt({code:"CLOUDPATH_REQUIRED",message:"cloudPath不可为空"});let n;return this.getUploadFileOptions({cloudPath:t}).then((t=>{const{url:a,formData:r,name:o}=t.result;return n=t.result.fileUrl,new Promise(((t,n)=>{const l=this.adapter.uploadFile({url:a,formData:r,name:o,filePath:e,fileType:s,success(e){e&&e.statusCode<400?t(e):n(new xt({code:"UPLOAD_FAILED",message:"文件上传失败"}))},fail(e){n(new xt({code:e.code||"UPLOAD_FAILED",message:e.message||e.errMsg||"文件上传失败"}))}});"function"==typeof i&&l&&"function"==typeof l.onProgressUpdate&&l.onProgressUpdate((e=>{i({loaded:e.totalBytesSent,total:e.totalBytesExpectedToSend})}))}))})).then((()=>this.reportUploadFile({cloudPath:t}))).then((t=>new Promise(((s,i)=>{t.success?s({success:!0,filePath:e,fileID:n}):i(new xt({code:"UPLOAD_FAILED",message:"文件上传失败"}))}))))}deleteFile({fileList:e}){const t={method:"serverless.file.resource.delete",params:JSON.stringify({fileList:e})};return this.request(t).then((e=>{if(e.success)return e.result;throw new xt({code:"DELETE_FILE_FAILED",message:"删除文件失败"})}))}getTempFileURL({fileList:e,maxAge:t}={}){if(!Array.isArray(e)||0===e.length)throw new xt({code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"});const s={method:"serverless.file.resource.getTempFileURL",params:JSON.stringify({fileList:e,maxAge:t})};return this.request(s).then((e=>{if(e.success)return{fileList:e.result.fileList.map((e=>({fileID:e.fileID,tempFileURL:e.tempFileURL})))};throw new xt({code:"GET_TEMP_FILE_URL_FAILED",message:"获取临时文件链接失败"})}))}}(e),s={signInAnonymously:function(){return Promise.resolve()},getLoginState:function(){return Promise.resolve(!1)}};return t.auth=function(){return s},t.customAuth=t.auth,t}},ti=Ce((function(e,t){e.exports=Re.enc.Hex}));function si(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}function ii(e="",t={}){const{data:s,functionName:i,method:n,headers:a,signHeaderKeys:r=[],config:o}=t,l=String(Date.now()),c=si(),h=Object.assign({},a,{"x-from-app-id":o.spaceAppId,"x-from-env-id":o.spaceId,"x-to-env-id":o.spaceId,"x-from-instance-id":l,"x-from-function-name":i,"x-client-timestamp":l,"x-alipay-source":"client","x-request-id":c,"x-alipay-callid":c,"x-trace-id":c}),u=["x-from-app-id","x-from-env-id","x-to-env-id","x-from-instance-id","x-from-function-name","x-client-timestamp"].concat(r),[d="",p=""]=e.split("?")||[],m=function(e){const t="HMAC-SHA256",s=e.signedHeaders.join(";"),i=e.signedHeaders.map((t=>`${t.toLowerCase()}:${e.headers[t]}\n`)).join(""),n=Ht(e.body).toString(ti),a=`${e.method.toUpperCase()}\n${e.path}\n${e.query}\n${i}\n${s}\n${n}\n`,r=Ht(a).toString(ti),o=`${t}\n${e.timestamp}\n${r}\n`,l=Kt(o,e.secretKey).toString(ti);return`${t} Credential=${e.secretId}, SignedHeaders=${s}, Signature=${l}`}({path:d,query:p,method:n,headers:h,timestamp:l,body:JSON.stringify(s),secretId:o.accessKey,secretKey:o.secretKey,signedHeaders:u.sort()});return{url:`${o.endpoint}${e}`,headers:Object.assign({},h,{Authorization:m})}}function ni({url:e,data:t,method:s="POST",headers:i={},timeout:n}){return new Promise(((a,r)=>{vt.request({url:e,method:s,data:"object"==typeof t?JSON.stringify(t):t,header:i,dataType:"json",timeout:n,complete:(e={})=>{const t=i["x-trace-id"]||"";if(!e.statusCode||e.statusCode>=400){const{message:s,errMsg:i,trace_id:n}=e.data||{};return r(new xt({code:"SYS_ERR",message:s||i||"request:fail",requestId:n||t}))}a({status:e.statusCode,data:e.data,headers:e.header,requestId:t})}})}))}function ai(e,t){const{path:s,data:i,method:n="GET"}=e,{url:a,headers:r}=ii(s,{functionName:"",data:i,method:n,headers:{"x-alipay-cloud-mode":"oss","x-data-api-type":"oss","x-expire-timestamp":Date.now()+6e4},signHeaderKeys:["x-data-api-type","x-expire-timestamp"],config:t});return ni({url:a,data:i,method:n,headers:r}).then((e=>{const t=e.data||{};if(!t.success)throw new xt({code:e.errCode,message:e.errMsg,requestId:e.requestId});return t.data||{}})).catch((e=>{throw new xt({code:e.errCode,message:e.errMsg,requestId:e.requestId})}))}function ri(e=""){const t=e.trim().replace(/^cloud:\/\//,""),s=t.indexOf("/");if(s<=0)throw new xt({code:"INVALID_PARAM",message:"fileID不合法"});const i=t.substring(0,s),n=t.substring(s+1);return i!==this.config.spaceId&&console.warn("file ".concat(e," does not belong to env ").concat(this.config.spaceId)),n}function oi(e=""){return"cloud://".concat(this.config.spaceId,"/").concat(e.replace(/^\/+/,""))}class li{constructor(e){this.config=e}signedURL(e,t={}){const s=`/ws/function/${e}`,i=this.config.wsEndpoint.replace(/^ws(s)?:\/\//,""),n=Object.assign({},t,{accessKeyId:this.config.accessKey,signatureNonce:si(),timestamp:""+Date.now()}),a=[s,["accessKeyId","authorization","signatureNonce","timestamp"].sort().map((function(e){return n[e]?"".concat(e,"=").concat(n[e]):null})).filter(Boolean).join("&"),`host:${i}`].join("\n"),r=["HMAC-SHA256",Ht(a).toString(ti)].join("\n"),o=Kt(r,this.config.secretKey).toString(ti),l=Object.keys(n).map((e=>`${e}=${encodeURIComponent(n[e])}`)).join("&");return`${this.config.wsEndpoint}${s}?${l}&signature=${o}`}}var ci={init:e=>{e.provider="alipay";const t=new class{constructor(e){if(["spaceId","spaceAppId","accessKey","secretKey"].forEach((t=>{if(!Object.prototype.hasOwnProperty.call(e,t))throw new Error(`${t} required`)})),e.endpoint){if("string"!=typeof e.endpoint)throw new Error("endpoint must be string");if(!/^https:\/\//.test(e.endpoint))throw new Error("endpoint must start with https://");e.endpoint=e.endpoint.replace(/\/$/,"")}this.config=Object.assign({},e,{endpoint:e.endpoint||`https://${e.spaceId}.api-hz.cloudbasefunction.cn`,wsEndpoint:e.wsEndpoint||`wss://${e.spaceId}.api-hz.cloudbasefunction.cn`}),this._websocket=new li(this.config)}callFunction(e){return function(e,t){const{name:s,data:i,async:n=!1,timeout:a}=e,r="POST",o={"x-to-function-name":s};n&&(o["x-function-invoke-type"]="async");const{url:l,headers:c}=ii("/functions/invokeFunction",{functionName:s,data:i,method:r,headers:o,signHeaderKeys:["x-to-function-name"],config:t});return ni({url:l,data:i,method:r,headers:c,timeout:a}).then((e=>{let t=0;if(n){const s=e.data||{};t="200"===s.errCode?0:s.errCode,e.data=s.data||{},e.errMsg=s.errMsg}if(0!==t)throw new xt({code:t,message:e.errMsg,requestId:e.requestId});return{errCode:t,success:0===t,requestId:e.requestId,result:e.data}})).catch((e=>{throw new xt({code:e.errCode,message:e.errMsg,requestId:e.requestId})}))}(e,this.config)}uploadFileToOSS({url:e,filePath:t,fileType:s,formData:i,onUploadProgress:n}){return new Promise(((a,r)=>{const o=vt.uploadFile({url:e,filePath:t,fileType:s,formData:i,name:"file",success(e){e&&e.statusCode<400?a(e):r(new xt({code:"UPLOAD_FAILED",message:"文件上传失败"}))},fail(e){r(new xt({code:e.code||"UPLOAD_FAILED",message:e.message||e.errMsg||"文件上传失败"}))}});"function"==typeof n&&o&&"function"==typeof o.onProgressUpdate&&o.onProgressUpdate((e=>{n({loaded:e.totalBytesSent,total:e.totalBytesExpectedToSend})}))}))}async uploadFile({filePath:e,cloudPath:t="",fileType:s="image",onUploadProgress:i}){if("string"!==qe(t))throw new xt({code:"INVALID_PARAM",message:"cloudPath必须为字符串类型"});if(!(t=t.trim()))throw new xt({code:"INVALID_PARAM",message:"cloudPath不可为空"});if(/:\/\//.test(t))throw new xt({code:"INVALID_PARAM",message:"cloudPath不合法"});const n=await ai({path:"/".concat(t.replace(/^\//,""),"?post_url")},this.config),{file_id:a,upload_url:r,form_data:o}=n,l=o&&o.reduce(((e,t)=>(e[t.key]=t.value,e)),{});return this.uploadFileToOSS({url:r,filePath:e,fileType:s,formData:l,onUploadProgress:i}).then((()=>({fileID:a})))}async getTempFileURL({fileList:e}){return new Promise(((t,s)=>{(!e||e.length<0)&&t({code:"INVALID_PARAM",message:"fileList不能为空数组"}),e.length>50&&t({code:"INVALID_PARAM",message:"fileList数组长度不能超过50"});const i=[];for(const a of e){let e;"string"!==qe(a)&&t({code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"});try{e=ri.call(this,a)}catch(n){console.warn(n.errCode,n.errMsg),e=a}i.push({file_id:e,expire:600})}ai({path:"/?download_url",data:{file_list:i},method:"POST"},this.config).then((e=>{const{file_list:s=[]}=e;t({fileList:s.map((e=>({fileID:oi.call(this,e.file_id),tempFileURL:e.download_url})))})})).catch((e=>s(e)))}))}async connectWebSocket(e){const{name:t,query:s}=e;return vt.connectSocket({url:this._websocket.signedURL(t,s),complete:()=>{}})}}(e);return t.auth=function(){return{signInAnonymously:function(){return Promise.resolve()},getLoginState:function(){return Promise.resolve(!0)}}},t}};function hi({data:e}){let t;t=Et();const s=JSON.parse(JSON.stringify(e||{}));if(Object.assign(s,{clientInfo:t}),!s.uniIdToken){const{token:e}=It();e&&(s.uniIdToken=e)}return s}const ui=[{rule:/fc_function_not_found|FUNCTION_NOT_FOUND/,content:",云函数[{functionName}]在云端不存在,请检查此云函数名称是否正确以及该云函数是否已上传到服务空间",mode:"append"}];var di=/[\\^$.*+?()[\]{}|]/g,pi=RegExp(di.source);function mi(e,t,s){return e.replace(new RegExp((i=t)&&pi.test(i)?i.replace(di,"\\$&"):i,"g"),s);var i}const fi="request",gi="response",yi="both",_i="_globalUniCloudStatus",ki={code:2e4,message:"System error"},Ti={code:20101,message:"Invalid client"};function wi(e){const{errSubject:t,subject:s,errCode:i,errMsg:n,code:a,message:r,cause:o}=e||{};return new xt({subject:t||s||"uni-secure-network",code:i||a||ki.code,message:n||r,cause:o})}let Si;function bi({secretType:e}={}){return e===fi||e===gi||e===yi}function xi({functionName:e,result:t,logPvd:s}){}function vi(e){const t=e.callFunction,s=function(s){const i=s.name;s.data=hi.call(e,{data:s.data});const n={aliyun:"aliyun",tencent:"tcb",tcb:"tcb",alipay:"alipay",dcloud:"dcloud"}[this.config.provider],a=bi(s)||false;return t.call(this,s).then((e=>(e.errCode=0,!a&&xi.call(this,{functionName:i,result:e,logPvd:n}),Promise.resolve(e))),(e=>(!a&&xi.call(this,{functionName:i,result:e,logPvd:n}),e&&e.message&&(e.message=function({message:e="",extraInfo:t={},formatter:s=[]}={}){for(let i=0;i<s.length;i++){const{rule:n,content:a,mode:r}=s[i],o=e.match(n);if(!o)continue;let l=a;for(let e=1;e<o.length;e++)l=mi(l,`{$${e}}`,o[e]);for(const e in t)l=mi(l,`{${e}}`,t[e]);return"replace"===r?l:e+l}return e}({message:`[${s.name}]: ${e.message}`,formatter:ui,extraInfo:{functionName:i}})),Promise.reject(e))))};e.callFunction=function(t){const{provider:i,spaceId:n}=e.config,a=t.name;let r,o;return t.data=t.data||{},r=s,r=r.bind(e),o=bi(t)?new Si({secretType:t.secretType,uniCloudIns:e}).wrapEncryptDataCallFunction(s.bind(e))(t):function({provider:e,spaceId:t,functionName:s}={}){const{appId:i,uniPlatform:n,osName:a}=Rt();let r=n;"app"===n&&(r=a);const o=function({provider:e,spaceId:t}={}){const s=Qe;if(!s)return{};e=function(e){return"tencent"===e?"tcb":e}(e);const i=s.find((s=>s.provider===e&&s.spaceId===t));return i&&i.config}({provider:e,spaceId:t});if(!o||!o.accessControl||!o.accessControl.enable)return!1;const l=o.accessControl.function||{},c=Object.keys(l);if(0===c.length)return!0;const h=function(e,t){let s,i,n;for(let a=0;a<e.length;a++){const r=e[a];r!==t?"*"!==r?r.split(",").map((e=>e.trim())).indexOf(t)>-1&&(i=r):n=r:s=r}return s||i||n}(c,s);if(!h)return!1;if((l[h]||[]).find(((e={})=>e.appId===i&&(e.platform||"").toLowerCase()===r.toLowerCase())))return!0;throw console.error(`此应用[appId: ${i}, platform: ${r}]不在云端配置的允许访问的应用列表内,参考:https://uniapp.dcloud.net.cn/uniCloud/secure-network.html#verify-client`),wi(Ti)}({provider:i,spaceId:n,functionName:a})?new Si({secretType:t.secretType,uniCloudIns:e}).wrapVerifyClientCallFunction(s.bind(e))(t):r(t),Object.defineProperty(o,"result",{get:()=>(console.warn("当前返回结果为Promise类型,不可直接访问其result属性,详情请参考:https://uniapp.dcloud.net.cn/uniCloud/faq?id=promise"),{})}),o.then((e=>("undefined"!=typeof UTSJSONObject&&(e.result=new UTSJSONObject(e.result)),e)))}}Si=class{constructor(){throw wi({message:"Platform web is not supported by secure network"})}};const Di=Symbol("CLIENT_DB_INTERNAL");function Ii(e,t){return e.then="DoNotReturnProxyWithAFunctionNamedThen",e._internalType=Di,e.inspect=null,e.__v_raw=void 0,new Proxy(e,{get(e,s,i){if("_uniClient"===s)return null;if("symbol"==typeof s)return e[s];if(s in e||"string"!=typeof s){const t=e[s];return"function"==typeof t?t.bind(e):t}return t.get(e,s,i)}})}function Pi(e){return{on:(t,s)=>{e[t]=e[t]||[],e[t].indexOf(s)>-1||e[t].push(s)},off:(t,s)=>{e[t]=e[t]||[];const i=e[t].indexOf(s);-1!==i&&e[t].splice(i,1)}}}const Ci=["db.Geo","db.command","command.aggregate"];function Ai(e,t){return Ci.indexOf(`${e}.${t}`)>-1}function Ri(e){switch(qe(e=Dt(e))){case"array":return e.map((e=>Ri(e)));case"object":return e._internalType===Di||Object.keys(e).forEach((t=>{e[t]=Ri(e[t])})),e;case"regexp":return{$regexp:{source:e.source,flags:e.flags}};case"date":return{$date:e.toISOString()};default:return e}}function Mi(e){return e&&e.content&&e.content.$method}class Oi{constructor(e,t,s){this.content=e,this.prevStage=t||null,this.udb=null,this._database=s}toJSON(){let e=this;const t=[e.content];for(;e.prevStage;)e=e.prevStage,t.push(e.content);return{$db:t.reverse().map((e=>({$method:e.$method,$param:Ri(e.$param)})))}}toString(){return JSON.stringify(this.toJSON())}getAction(){const e=this.toJSON().$db.find((e=>"action"===e.$method));return e&&e.$param&&e.$param[0]}getCommand(){return{$db:this.toJSON().$db.filter((e=>"action"!==e.$method))}}get isAggregate(){let e=this;for(;e;){const t=Mi(e),s=Mi(e.prevStage);if("aggregate"===t&&"collection"===s||"pipeline"===t)return!0;e=e.prevStage}return!1}get isCommand(){let e=this;for(;e;){if("command"===Mi(e))return!0;e=e.prevStage}return!1}get isAggregateCommand(){let e=this;for(;e;){const t=Mi(e),s=Mi(e.prevStage);if("aggregate"===t&&"command"===s)return!0;e=e.prevStage}return!1}getNextStageFn(e){const t=this;return function(){return Ei({$method:e,$param:Ri(Array.from(arguments))},t,t._database)}}get count(){return this.isAggregate?this.getNextStageFn("count"):function(){return this._send("count",Array.from(arguments))}}get remove(){return this.isCommand?this.getNextStageFn("remove"):function(){return this._send("remove",Array.from(arguments))}}get(){return this._send("get",Array.from(arguments))}get add(){return this.isCommand?this.getNextStageFn("add"):function(){return this._send("add",Array.from(arguments))}}update(){return this._send("update",Array.from(arguments))}end(){return this._send("end",Array.from(arguments))}get set(){return this.isCommand?this.getNextStageFn("set"):function(){throw new Error("JQL禁止使用set方法")}}_send(e,t){const s=this.getAction(),i=this.getCommand();return i.$db.push({$method:e,$param:Ri(t)}),this._database._callCloudFunction({action:s,command:i})}}function Ei(e,t,s){return Ii(new Oi(e,t,s),{get(e,t){let i="db";return e&&e.content&&(i=e.content.$method),Ai(i,t)?Ei({$method:t},e,s):function(){return Ei({$method:t,$param:Ri(Array.from(arguments))},e,s)}}})}function Fi({path:e,method:t}){return class{constructor(){this.param=Array.from(arguments)}toJSON(){return{$newDb:[...e.map((e=>({$method:e}))),{$method:t,$param:this.param}]}}toString(){return JSON.stringify(this.toJSON())}}}function $i(e,t={}){return Ii(new e(t),{get:(e,t)=>Ai("db",t)?Ei({$method:t},null,e):function(){return Ei({$method:t,$param:Ri(Array.from(arguments))},null,e)}})}class Li extends class{constructor({uniClient:e={},isJQL:t=!1}={}){this._uniClient=e,this._authCallBacks={},this._dbCallBacks={},e._isDefault&&(this._dbCallBacks=tt("_globalUniCloudDatabaseCallback")),t||(this.auth=Pi(this._authCallBacks)),this._isJQL=t,Object.assign(this,Pi(this._dbCallBacks)),this.env=Ii({},{get:(e,t)=>({$env:t})}),this.Geo=Ii({},{get:(e,t)=>Fi({path:["Geo"],method:t})}),this.serverDate=Fi({path:[],method:"serverDate"}),this.RegExp=Fi({path:[],method:"RegExp"})}getCloudEnv(e){if("string"!=typeof e||!e.trim())throw new Error("getCloudEnv参数错误");return{$env:e.replace("$cloudEnv_","")}}_callback(e,t){const s=this._dbCallBacks;s[e]&&s[e].forEach((e=>{e(...t)}))}_callbackAuth(e,t){const s=this._authCallBacks;s[e]&&s[e].forEach((e=>{e(...t)}))}multiSend(){const e=Array.from(arguments),t=e.map((e=>{const t=e.getAction(),s=e.getCommand();if("getTemp"!==s.$db[s.$db.length-1].$method)throw new Error("multiSend只支持子命令内使用getTemp");return{action:t,command:s}}));return this._callCloudFunction({multiCommand:t,queryList:e})}}{_parseResult(e){return this._isJQL?e.result:e}_callCloudFunction({action:e,command:t,multiCommand:s,queryList:i}){function n(e,t){if(s&&i)for(let s=0;s<i.length;s++){const n=i[s];n.udb&&"function"==typeof n.udb.setResult&&(t?n.udb.setResult(t):n.udb.setResult(e.result.dataList[s]))}}const a=this,r=this._isJQL?"databaseForJQL":"database";function o(e){return a._callback("error",[e]),rt(ot(r,"fail"),e).then((()=>rt(ot(r,"complete"),e))).then((()=>(n(null,e),kt(ht,{type:pt,content:e}),Promise.reject(e))))}const l=rt(ot(r,"invoke")),c=this._uniClient;return l.then((()=>c.callFunction({name:"DCloud-clientDB",type:Ne,data:{action:e,command:t,multiCommand:s}}))).then((e=>{const{code:t,message:s,token:i,tokenExpired:l,systemInfo:c=[]}=e.result;if(c)for(let n=0;n<c.length;n++){const{level:e,message:t,detail:s}=c[n];let i="[System Info]"+t;s&&(i=`${i}\n详细信息:${s}`),(console[e]||console.log)(i)}if(t)return o(new xt({code:t,message:s,requestId:e.requestId}));e.result.errCode=e.result.errCode||e.result.code,e.result.errMsg=e.result.errMsg||e.result.message,i&&l&&(Pt({token:i,tokenExpired:l}),this._callbackAuth("refreshToken",[{token:i,tokenExpired:l}]),this._callback("refreshToken",[{token:i,tokenExpired:l}]),kt(dt,{token:i,tokenExpired:l}));const h=[{prop:"affectedDocs",tips:"affectedDocs不再推荐使用,请使用inserted/deleted/updated/data.length替代"},{prop:"code",tips:"code不再推荐使用,请使用errCode替代"},{prop:"message",tips:"message不再推荐使用,请使用errMsg替代"}];for(let n=0;n<h.length;n++){const{prop:t,tips:s}=h[n];if(t in e.result){const i=e.result[t];Object.defineProperty(e.result,t,{get:()=>(console.warn(s),i)})}}return u=e,rt(ot(r,"success"),u).then((()=>rt(ot(r,"complete"),u))).then((()=>{n(u,null);const e=a._parseResult(u);return kt(ht,{type:pt,content:e}),Promise.resolve(e)}));var u}),(e=>(/fc_function_not_found|FUNCTION_NOT_FOUND/g.test(e.message)&&console.warn("clientDB未初始化,请在web控制台保存一次schema以开启clientDB"),o(new xt({code:e.code||"SYSTEM_ERROR",message:e.message,requestId:e.requestId})))))}}const Ui="token无效,跳转登录页面",Ni="token过期,跳转登录页面",ji={TOKEN_INVALID_TOKEN_EXPIRED:Ni,TOKEN_INVALID_INVALID_CLIENTID:Ui,TOKEN_INVALID:Ui,TOKEN_INVALID_WRONG_TOKEN:Ui,TOKEN_INVALID_ANONYMOUS_USER:Ui},Vi={"uni-id-token-expired":Ni,"uni-id-check-token-failed":Ui,"uni-id-token-not-exist":Ui,"uni-id-check-device-feature-failed":Ui};function qi(e,t){let s="";return s=e?`${e}/${t}`:t,s.replace(/^\//,"")}function Bi(e=[],t=""){const s=[],i=[];return e.forEach((e=>{!0===e.needLogin?s.push(qi(t,e.path)):!1===e.needLogin&&i.push(qi(t,e.path))})),{needLoginPage:s,notNeedLoginPage:i}}function Hi(e){return e.split("?")[0].replace(/^\//,"")}function Ki(){return function(e){let t=e&&e.$page&&e.$page.fullPath||"";return t?("/"!==t.charAt(0)&&(t="/"+t),t):t}(function(){const e=R();return e[e.length-1]}())}function Wi(){return Hi(Ki())}function zi(e="",t={}){if(!e)return!1;if(!(t&&t.list&&t.list.length))return!1;const s=t.list,i=Hi(e);return s.some((e=>e.pagePath===i))}const Ji=!!Pe.uniIdRouter,{loginPage:Yi,routerNeedLogin:Qi,resToLogin:Gi,needLoginPage:Xi,notNeedLoginPage:Zi,loginPageInTabBar:en}=function({pages:e=[],subPackages:t=[],uniIdRouter:s={},tabBar:i={}}=Pe){const{loginPage:n,needLogin:a=[],resToLogin:r=!0}=s,{needLoginPage:o,notNeedLoginPage:l}=Bi(e),{needLoginPage:c,notNeedLoginPage:h}=function(e=[]){const t=[],s=[];return e.forEach((e=>{const{root:i,pages:n=[]}=e,{needLoginPage:a,notNeedLoginPage:r}=Bi(n,i);t.push(...a),s.push(...r)})),{needLoginPage:t,notNeedLoginPage:s}}(t);return{loginPage:n,routerNeedLogin:a,resToLogin:r,needLoginPage:[...o,...c],notNeedLoginPage:[...l,...h],loginPageInTabBar:zi(n,i)}}();if(Xi.indexOf(Yi)>-1)throw new Error(`Login page [${Yi}] should not be "needLogin", please check your pages.json`);function tn(e){const t=Wi();if("/"===e.charAt(0))return e;const[s,i]=e.split("?"),n=s.replace(/^\//,"").split("/"),a=t.split("/");a.pop();for(let r=0;r<n.length;r++){const e=n[r];".."===e?a.pop():"."!==e&&a.push(e)}return""===a[0]&&a.shift(),"/"+a.join("/")+(i?"?"+i:"")}function sn({redirect:e}){const t=Hi(e),s=Hi(Yi);return Wi()!==s&&t!==s}function nn({api:e,redirect:t}={}){if(!t||!sn({redirect:t}))return;const s=(n=t,"/"!==(i=Yi).charAt(0)&&(i="/"+i),n?i.indexOf("?")>-1?i+`&uniIdRedirectUrl=${encodeURIComponent(n)}`:i+`?uniIdRedirectUrl=${encodeURIComponent(n)}`:i);var i,n;en?"navigateTo"!==e&&"redirectTo"!==e||(e="switchTab"):"switchTab"===e&&(e="navigateTo");const a={navigateTo:z,redirectTo:J,switchTab:Y,reLaunch:Q};setTimeout((()=>{a[e]({url:s})}),0)}function an({url:e}={}){const t={abortLoginPageJump:!1,autoToLoginPage:!1},s=function(){const{token:e,tokenExpired:t}=It();let s;if(e){if(t<Date.now()){const e="uni-id-token-expired";s={errCode:e,errMsg:Vi[e]}}}else{const e="uni-id-check-token-failed";s={errCode:e,errMsg:Vi[e]}}return s}();if(function(e){const t=Hi(tn(e));return!(Zi.indexOf(t)>-1)&&(Xi.indexOf(t)>-1||Qi.some((t=>{return s=e,new RegExp(t).test(s);var s})))}(e)&&s){if(s.uniIdRedirectUrl=e,gt(ut).length>0)return setTimeout((()=>{kt(ut,s)}),0),t.abortLoginPageJump=!0,t;t.autoToLoginPage=!0}return t}function rn(){!function(){const e=Ki(),{abortLoginPageJump:t,autoToLoginPage:s}=an({url:e});t||s&&nn({api:"redirectTo",redirect:e})}();const e=["navigateTo","redirectTo","reLaunch","switchTab"];for(let t=0;t<e.length;t++){const s=e[t];M(s,{invoke(e){const{abortLoginPageJump:t,autoToLoginPage:i}=an({url:e.url});return t?e:i?(nn({api:s,redirect:tn(e.url)}),!1):e}})}}function on(){this.onResponse((e=>{const{type:t,content:s}=e;let i=!1;switch(t){case"cloudobject":i=function(e){if("object"!=typeof e)return!1;const{errCode:t}=e||{};return t in Vi}(s);break;case"clientdb":i=function(e){if("object"!=typeof e)return!1;const{errCode:t}=e||{};return t in ji}(s)}i&&function(e={}){const t=gt(ut);St().then((()=>{const s=Ki();if(s&&sn({redirect:s}))return t.length>0?kt(ut,Object.assign({uniIdRedirectUrl:s},e)):void(Yi&&nn({api:"navigateTo",redirect:s}))}))}(s)}))}function ln(e){var t;(t=e).onResponse=function(e){yt(ht,e)},t.offResponse=function(e){_t(ht,e)},function(e){e.onNeedLogin=function(e){yt(ut,e)},e.offNeedLogin=function(e){_t(ut,e)},Ji&&(tt(_i).needLoginInit||(tt(_i).needLoginInit=!0,St().then((()=>{rn.call(e)})),Gi&&on.call(e)))}(e),function(e){e.onRefreshToken=function(e){yt(dt,e)},e.offRefreshToken=function(e){_t(dt,e)}}(e)}let cn;const hn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",un=/^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;function dn(){const e=It().token||"",t=e.split(".");if(!e||3!==t.length)return{uid:null,role:[],permission:[],tokenExpired:0};let s;try{s=JSON.parse((i=t[1],decodeURIComponent(cn(i).split("").map((function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join(""))))}catch(n){throw new Error("获取当前用户信息出错,详细错误信息为:"+n.message)}var i;return s.tokenExpired=1e3*s.exp,delete s.exp,delete s.iat,s}cn="function"!=typeof atob?function(e){if(e=String(e).replace(/[\t\n\f\r ]+/g,""),!un.test(e))throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");var t;e+="==".slice(2-(3&e.length));for(var s,i,n="",a=0;a<e.length;)t=hn.indexOf(e.charAt(a++))<<18|hn.indexOf(e.charAt(a++))<<12|(s=hn.indexOf(e.charAt(a++)))<<6|(i=hn.indexOf(e.charAt(a++))),n+=64===s?String.fromCharCode(t>>16&255):64===i?String.fromCharCode(t>>16&255,t>>8&255):String.fromCharCode(t>>16&255,t>>8&255,255&t);return n}:atob;var pn=function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}(Ce((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const s="chooseAndUploadFile:ok",i="chooseAndUploadFile:fail";function n(e,t){return e.tempFiles.forEach(((e,s)=>{e.name||(e.name=e.path.substring(e.path.lastIndexOf("/")+1)),t&&(e.fileType=t),e.cloudPath=Date.now()+"_"+s+e.name.substring(e.name.lastIndexOf("."))})),e.tempFilePaths||(e.tempFilePaths=e.tempFiles.map((e=>e.path))),e}function a(e,t,{onChooseFile:i,onUploadProgress:n}){return t.then((e=>{if(i){const t=i(e);if(void 0!==t)return Promise.resolve(t).then((t=>void 0===t?e:t))}return e})).then((t=>!1===t?{errMsg:s,tempFilePaths:[],tempFiles:[]}:function(e,t,i=5,n){(t=Object.assign({},t)).errMsg=s;const a=t.tempFiles,r=a.length;let o=0;return new Promise((s=>{for(;o<i;)l();function l(){const i=o++;if(i>=r)return void(!a.find((e=>!e.url&&!e.errMsg))&&s(t));const c=a[i];e.uploadFile({provider:c.provider,filePath:c.path,cloudPath:c.cloudPath,fileType:c.fileType,cloudPathAsRealPath:c.cloudPathAsRealPath,onUploadProgress(e){e.index=i,e.tempFile=c,e.tempFilePath=c.path,n&&n(e)}}).then((e=>{c.url=e.fileID,i<r&&l()})).catch((e=>{c.errMsg=e.errMsg||e.message,i<r&&l()}))}}))}(e,t,5,n)))}t.initChooseAndUploadFile=function(e){return function(t={type:"all"}){return"image"===t.type?a(e,function(e){const{count:t,sizeType:s,sourceType:a=["album","camera"],extension:r}=e;return new Promise(((e,o)=>{C({count:t,sizeType:s,sourceType:a,extension:r,success(t){e(n(t,"image"))},fail(e){o({errMsg:e.errMsg.replace("chooseImage:fail",i)})}})}))}(t),t):"video"===t.type?a(e,function(e){const{camera:t,compressed:s,maxDuration:a,sourceType:r=["album","camera"],extension:o}=e;return new Promise(((e,l)=>{A({camera:t,compressed:s,maxDuration:a,sourceType:r,extension:o,success(t){const{tempFilePath:s,duration:i,size:a,height:r,width:o}=t;e(n({errMsg:"chooseVideo:ok",tempFilePaths:[s],tempFiles:[{name:t.tempFile&&t.tempFile.name||"",path:s,size:a,type:t.tempFile&&t.tempFile.type||"",width:o,height:r,duration:i,fileType:"video",cloudPath:""}]},"video"))},fail(e){l({errMsg:e.errMsg.replace("chooseVideo:fail",i)})}})}))}(t),t):a(e,function(e){const{count:t,extension:s}=e;return new Promise(((e,a)=>{let r=O;if("undefined"!=typeof wx&&"function"==typeof wx.chooseMessageFile&&(r=wx.chooseMessageFile),"function"!=typeof r)return a({errMsg:i+" 请指定 type 类型,该平台仅支持选择 image 或 video。"});r({type:"all",count:t,extension:s,success(t){e(n(t))},fail(e){a({errMsg:e.errMsg.replace("chooseFile:fail",i)})}})}))}(t),t)}}})));const mn="manual";function fn(e){return{props:{localdata:{type:Array,default:()=>[]},options:{type:[Object,Array],default:()=>({})},spaceInfo:{type:Object,default:()=>({})},collection:{type:[String,Array],default:""},action:{type:String,default:""},field:{type:String,default:""},orderby:{type:String,default:""},where:{type:[String,Object],default:""},pageData:{type:String,default:"add"},pageCurrent:{type:Number,default:1},pageSize:{type:Number,default:20},getcount:{type:[Boolean,String],default:!1},gettree:{type:[Boolean,String],default:!1},gettreepath:{type:[Boolean,String],default:!1},startwith:{type:String,default:""},limitlevel:{type:Number,default:10},groupby:{type:String,default:""},groupField:{type:String,default:""},distinct:{type:[Boolean,String],default:!1},foreignKey:{type:String,default:""},loadtime:{type:String,default:"auto"},manual:{type:Boolean,default:!1}},data:()=>({mixinDatacomLoading:!1,mixinDatacomHasMore:!1,mixinDatacomResData:[],mixinDatacomErrorMessage:"",mixinDatacomPage:{},mixinDatacomError:null}),created(){this.mixinDatacomPage={current:this.pageCurrent,size:this.pageSize,count:0},this.$watch((()=>{var e=[];return["pageCurrent","pageSize","localdata","collection","action","field","orderby","where","getont","getcount","gettree","groupby","groupField","distinct"].forEach((t=>{e.push(this[t])})),e}),((e,t)=>{if(this.loadtime===mn)return;let s=!1;const i=[];for(let n=2;n<e.length;n++)e[n]!==t[n]&&(i.push(e[n]),s=!0);e[0]!==t[0]&&(this.mixinDatacomPage.current=this.pageCurrent),this.mixinDatacomPage.size=this.pageSize,this.onMixinDatacomPropsChange(s,i)}))},methods:{onMixinDatacomPropsChange(e,t){},mixinDatacomEasyGet({getone:e=!1,success:t,fail:s}={}){this.mixinDatacomLoading||(this.mixinDatacomLoading=!0,this.mixinDatacomErrorMessage="",this.mixinDatacomError=null,this.mixinDatacomGet().then((s=>{this.mixinDatacomLoading=!1;const{data:i,count:n}=s.result;this.getcount&&(this.mixinDatacomPage.count=n),this.mixinDatacomHasMore=i.length<this.pageSize;const a=e?i.length?i[0]:void 0:i;this.mixinDatacomResData=a,t&&t(a)})).catch((e=>{this.mixinDatacomLoading=!1,this.mixinDatacomErrorMessage=e,this.mixinDatacomError=e,s&&s(e)})))},mixinDatacomGet(t={}){let s;t=t||{},s="undefined"!=typeof __uniX&&__uniX?e.databaseForJQL(this.spaceInfo):e.database(this.spaceInfo);const i=t.action||this.action;i&&(s=s.action(i));const n=t.collection||this.collection;s=Array.isArray(n)?s.collection(...n):s.collection(n);const a=t.where||this.where;a&&Object.keys(a).length&&(s=s.where(a));const r=t.field||this.field;r&&(s=s.field(r));const o=t.foreignKey||this.foreignKey;o&&(s=s.foreignKey(o));const l=t.groupby||this.groupby;l&&(s=s.groupBy(l));const c=t.groupField||this.groupField;c&&(s=s.groupField(c)),!0===(void 0!==t.distinct?t.distinct:this.distinct)&&(s=s.distinct());const h=t.orderby||this.orderby;h&&(s=s.orderBy(h));const u=void 0!==t.pageCurrent?t.pageCurrent:this.mixinDatacomPage.current,d=void 0!==t.pageSize?t.pageSize:this.mixinDatacomPage.size,p=void 0!==t.getcount?t.getcount:this.getcount,m=void 0!==t.gettree?t.gettree:this.gettree,f=void 0!==t.gettreepath?t.gettreepath:this.gettreepath,g={getCount:p},y={limitLevel:void 0!==t.limitlevel?t.limitlevel:this.limitlevel,startWith:void 0!==t.startwith?t.startwith:this.startwith};return m&&(g.getTree=y),f&&(g.getTreePath=y),s=s.skip(d*(u-1)).limit(d).get(g),s}}}}function gn(e){return tt("_globalUniCloudSecureNetworkCache__{spaceId}".replace("{spaceId}",e.config.spaceId))}async function yn({openid:e,callLoginByWeixin:t=!1}={}){throw gn(this),new Error("[SecureNetwork] API `initSecureNetworkByWeixin` is not supported on platform `web`")}async function _n(e){const t=gn(this);return t.initPromise||(t.initPromise=yn.call(this,e).then((e=>e)).catch((e=>{throw delete t.initPromise,e}))),t.initPromise}function kn(e){Ot=e}function Tn(e){const t={getSystemInfo:G,getPushClientId:X};return function(s){return new Promise(((i,n)=>{t[e]({...s,success(e){i(e)},fail(e){n(e)}})}))}}class wn extends class{constructor(){this._callback={}}addListener(e,t){this._callback[e]||(this._callback[e]=[]),this._callback[e].push(t)}on(e,t){return this.addListener(e,t)}removeListener(e,t){if(!t)throw new Error('The "listener" argument must be of type function. Received undefined');const s=this._callback[e];if(!s)return;const i=function(e,t){for(let s=e.length-1;s>=0;s--)if(e[s]===t)return s;return-1}(s,t);s.splice(i,1)}off(e,t){return this.removeListener(e,t)}removeAllListener(e){delete this._callback[e]}emit(e,...t){const s=this._callback[e];if(s)for(let i=0;i<s.length;i++)s[i](...t)}}{constructor(){super(),this._uniPushMessageCallback=this._receivePushMessage.bind(this),this._currentMessageId=-1,this._payloadQueue=[]}init(){return Promise.all([Tn("getSystemInfo")(),Tn("getPushClientId")()]).then((([{appId:e}={},{cid:t}={}]=[])=>{if(!e)throw new Error("Invalid appId, please check the manifest.json file");if(!t)throw new Error("Invalid push client id");this._appId=e,this._pushClientId=t,this._seqId=Date.now()+"-"+Math.floor(9e5*Math.random()+1e5),this.emit("open"),this._initMessageListener()}),(e=>{throw this.emit("error",e),this.close(),e}))}async open(){return this.init()}_isUniCloudSSE(e){if("receive"!==e.type)return!1;const t=e&&e.data&&e.data.payload;return!(!t||"UNI_CLOUD_SSE"!==t.channel||t.seqId!==this._seqId)}_receivePushMessage(e){if(!this._isUniCloudSSE(e))return;const t=e&&e.data&&e.data.payload,{action:s,messageId:i,message:n}=t;this._payloadQueue.push({action:s,messageId:i,message:n}),this._consumMessage()}_consumMessage(){for(;;){const e=this._payloadQueue.find((e=>e.messageId===this._currentMessageId+1));if(!e)break;this._currentMessageId++,this._parseMessagePayload(e)}}_parseMessagePayload(e){const{action:t,messageId:s,message:i}=e;"end"===t?this._end({messageId:s,message:i}):"message"===t&&this._appendMessage({messageId:s,message:i})}_appendMessage({messageId:e,message:t}={}){this.emit("message",t)}_end({messageId:e,message:t}={}){this.emit("end",t),this.close()}_initMessageListener(){U(this._uniPushMessageCallback)}_destroy(){N(this._uniPushMessageCallback)}toJSON(){return{appId:this._appId,pushClientId:this._pushClientId,seqId:this._seqId}}close(){this._destroy(),this.emit("close")}}const Sn={tcb:Gs,tencent:Gs,aliyun:Ut,private:ei,dcloud:ei,alipay:ci};let bn=new class{init(e){let t={};const s=Sn[e.provider];if(!s)throw new Error("未提供正确的provider参数");var i;return t=s.init(e),function(e){e._initPromiseHub||(e._initPromiseHub=new Je({createPromise:function(){let t=Promise.resolve();t=new Promise((e=>{setTimeout((()=>{e()}),1)}));const s=e.auth();return t.then((()=>s.getLoginState())).then((e=>e?Promise.resolve():s.signInAnonymously()))}}))}(t),vi(t),function(e){const t=e.uploadFile;e.uploadFile=function(e){return t.call(this,e)}}(t),(i=t).database=function(e){if(e&&Object.keys(e).length>0)return i.init(e).database();if(this._database)return this._database;const t=$i(Li,{uniClient:i});return this._database=t,t},i.databaseForJQL=function(e){if(e&&Object.keys(e).length>0)return i.init(e).databaseForJQL();if(this._databaseForJQL)return this._databaseForJQL;const t=$i(Li,{uniClient:i,isJQL:!0});return this._databaseForJQL=t,t},function(e){e.getCurrentUserInfo=dn,e.chooseAndUploadFile=pn.initChooseAndUploadFile(e),Object.assign(e,{get mixinDatacom(){return fn(e)}}),e.SSEChannel=wn,e.initSecureNetworkByWeixin=function(e){return function({openid:t,callLoginByWeixin:s=!1}={}){return _n.call(e,{openid:t,callLoginByWeixin:s})}}(e),e.setCustomClientInfo=kn,e.importObject=function(t){return function(s,i={}){i=function(e,t={}){return e.customUI=t.customUI||e.customUI,e.parseSystemError=t.parseSystemError||e.parseSystemError,Object.assign(e.loadingOptions,t.loadingOptions),Object.assign(e.errorOptions,t.errorOptions),"object"==typeof t.secretMethods&&(e.secretMethods=t.secretMethods),e}({customUI:!1,loadingOptions:{title:"加载中...",mask:!0},errorOptions:{type:"modal",retry:!1}},i);const{customUI:n,loadingOptions:a,errorOptions:r,parseSystemError:o}=i,l=!n;return new Proxy({},{get(n,c){switch(c){case"toString":return"[object UniCloudObject]";case"toJSON":return{}}return function({fn:e,interceptorName:t,getCallbackArgs:s}={}){return async function(...i){const n=s?s({params:i}):{};let a,r;try{return await rt(ot(t,"invoke"),{...n}),a=await e(...i),await rt(ot(t,"success"),{...n,result:a}),a}catch(o){throw r=o,await rt(ot(t,"fail"),{...n,error:r}),r}finally{await rt(ot(t,"complete"),r?{...n,error:r}:{...n,result:a})}}}({fn:async function n(...h){let u;l&&E({title:a.title,mask:a.mask});const d={name:s,type:Ue,data:{method:c,params:h}};"object"==typeof i.secretMethods&&function(e,t){const s=t.data.method,i=e.secretMethods||{},n=i[s]||i["*"];n&&(t.secretType=n)}(i,d);let p=!1;try{u=await t.callFunction(d)}catch(e){p=!0,u={result:new xt(e)}}const{errSubject:m,errCode:f,errMsg:g,newToken:y}=u.result||{};if(l&&F(),y&&y.token&&y.tokenExpired&&(Pt(y),kt(dt,{...y})),f){let e=g;if(p&&o&&(e=(await o({objectName:s,methodName:c,params:h,errSubject:m,errCode:f,errMsg:g})).errMsg||g),l)if("toast"===r.type)$({title:e,icon:"none"});else{if("modal"!==r.type)throw new Error(`Invalid errorOptions.type: ${r.type}`);{const{confirm:t}=await async function({title:e,content:t,showCancel:s,cancelText:i,confirmText:n}={}){return new Promise(((a,r)=>{L({title:e,content:t,showCancel:s,cancelText:i,confirmText:n,success(e){a(e)},fail(){a({confirm:!1,cancel:!0})}})}))}({title:"提示",content:e,showCancel:r.retry,cancelText:"取消",confirmText:r.retry?"重试":"确定"});if(r.retry&&t)return n(...h)}}const t=new xt({subject:m,code:f,message:g,requestId:u.requestId});throw t.detail=u.result,kt(ht,{type:ft,content:t}),t}return kt(ht,{type:ft,content:u.result}),u.result},interceptorName:"callObject",getCallbackArgs:function({params:e}={}){return{objectName:s,methodName:c,params:e}}})}})}}(e)}(t),["callFunction","uploadFile","deleteFile","getTempFileURL","downloadFile","chooseAndUploadFile"].forEach((e=>{if(!t[e])return;const s=t[e];t[e]=function(){return s.apply(t,Array.from(arguments))},t[e]=function(e,t){return function(s){let i=!1;if("callFunction"===t){const e=s&&s.type||Le;i=e!==Le}const n="callFunction"===t&&!i,a=this._initPromiseHub.exec();s=s||{};const{success:r,fail:o,complete:l}=bt(s),c=a.then((()=>i?Promise.resolve():rt(ot(t,"invoke"),s))).then((()=>e.call(this,s))).then((e=>i?Promise.resolve(e):rt(ot(t,"success"),e).then((()=>rt(ot(t,"complete"),e))).then((()=>(n&&kt(ht,{type:mt,content:e}),Promise.resolve(e))))),(e=>i?Promise.reject(e):rt(ot(t,"fail"),e).then((()=>rt(ot(t,"complete"),e))).then((()=>(kt(ht,{type:mt,content:e}),Promise.reject(e))))));if(!(r||o||l))return c;c.then((e=>{r&&r(e),l&&l(e),n&&kt(ht,{type:mt,content:e})}),(e=>{o&&o(e),l&&l(e),n&&kt(ht,{type:mt,content:e})}))}}(t[e],e).bind(t)})),t.init=this.init,t}};(()=>{const e=Ge;let t={};if(e&&1===e.length)t=e[0],bn=bn.init(t),bn._isDefault=!0;else{const t=["auth","callFunction","uploadFile","deleteFile","getTempFileURL","downloadFile","database","getCurrentUSerInfo","importObject"];let s;s=e&&e.length>0?"应用有多个服务空间,请通过uniCloud.init方法指定要使用的服务空间":"应用未关联服务空间,请在uniCloud目录右键关联服务空间",t.forEach((e=>{bn[e]=function(){return console.error(s),Promise.reject(new xt({code:"SYS_ERR",message:s}))}}))}Object.assign(bn,{get mixinDatacom(){return fn(bn)}}),ln(bn),bn.addInterceptor=nt,bn.removeInterceptor=at,bn.interceptObject=lt;{const e=Ze||(Ze=function(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;function e(){return this}return void 0!==e()?e():new Function("return this")()}(),Ze);e.uniCloud=bn,e.UniCloudError=xt}})();var xn=bn;const vn="chooseAndUploadFile:fail";function Dn(e,t){return e.tempFiles.forEach(((e,s)=>{e.name||(e.name=e.path.substring(e.path.lastIndexOf("/")+1)),t&&(e.fileType=t),e.cloudPath=Date.now()+"_"+s+e.name.substring(e.name.lastIndexOf("."))})),e.tempFilePaths||(e.tempFilePaths=e.tempFiles.map((e=>e.path))),e}function In(e,t=5,s){const i=(e=JSON.parse(JSON.stringify(e))).length;let n=0,a=this;return new Promise((r=>{for(;n<t;)o();function o(){let t=n++;if(t>=i)return void(!e.find((e=>!e.url&&!e.errMsg))&&r(e));const l=e[t],c=a.files.findIndex((e=>e.uuid===l.uuid));l.url="",delete l.errMsg,xn.uploadFile({filePath:l.path,cloudPath:l.cloudPath,fileType:l.fileType,onUploadProgress:e=>{e.index=c,s&&s(e)}}).then((e=>{l.url=e.fileID,l.index=c,t<i&&o()})).catch((e=>{l.errMsg=e.errMsg||e.message,l.index=c,t<i&&o()}))}}))}function Pn(e,{onChooseFile:t,onUploadProgress:s}){return e.then((e=>{if(t){const s=t(e);if(void 0!==s)return Promise.resolve(s).then((t=>void 0===t?e:t))}return e})).then((e=>!1===e?{errMsg:"chooseAndUploadFile:ok",tempFilePaths:[],tempFiles:[]}:e))}function Cn(e={type:"all"}){return"image"===e.type?Pn(function(e){const{count:t,sizeType:s=["original","compressed"],sourceType:i,extension:n}=e;return new Promise(((e,a)=>{C({count:t,sizeType:s,sourceType:i,extension:n,success(t){e(Dn(t,"image"))},fail(e){a({errMsg:e.errMsg.replace("chooseImage:fail",vn)})}})}))}(e),e):"video"===e.type?Pn(function(e){const{count:t,camera:s,compressed:i,maxDuration:n,sourceType:a,extension:r}=e;return new Promise(((e,t)=>{A({camera:s,compressed:i,maxDuration:n,sourceType:a,extension:r,success(t){const{tempFilePath:s,duration:i,size:n,height:a,width:r}=t;e(Dn({errMsg:"chooseVideo:ok",tempFilePaths:[s],tempFiles:[{name:t.tempFile&&t.tempFile.name||"",path:s,size:n,type:t.tempFile&&t.tempFile.type||"",width:r,height:a,duration:i,fileType:"video",cloudPath:""}]},"video"))},fail(e){t({errMsg:e.errMsg.replace("chooseVideo:fail",vn)})}})}))}(e),e):Pn(function(e){const{count:t,extension:s}=e;return new Promise(((e,i)=>{let n=O;if("undefined"!=typeof wx&&"function"==typeof wx.chooseMessageFile&&(n=wx.chooseMessageFile),"function"!=typeof n)return i({errMsg:vn+" 请指定 type 类型,该平台仅支持选择 image 或 video。"});n({type:"all",count:t,extension:s,success(t){e(Dn(t))},fail(e){i({errMsg:e.errMsg.replace("chooseFile:fail",vn)})}})}))}(e),e)}const An=e=>{const t=e.lastIndexOf("."),s=e.length;return{name:e.substring(0,t),ext:e.substring(t+1,s)}},Rn=e=>{if(Array.isArray(e))return e;return e.replace(/(\[|\])/g,"").split(",")},Mn=async(e,t="image")=>{const s=An(e.name).ext.toLowerCase();let i={name:e.name,uuid:e.uuid,extname:s||"",cloudPath:e.cloudPath,fileType:e.fileType,thumbTempFilePath:e.thumbTempFilePath,url:e.path||e.path,size:e.size,image:{},path:e.path,video:{}};if("image"===t){const t=await(n=e.path,new Promise(((e,t)=>{te({src:n,success(t){e(t)},fail(e){t(e)}})})));delete i.video,i.image.width=t.width,i.image.height=t.height,i.image.location=t.path}else delete i.image;var n;return i};const On=oe({name:"uniFilePicker",components:{uploadImage:oe({name:"uploadImage",emits:["uploadFiles","choose","delFile"],props:{filesList:{type:Array,default:()=>[]},disabled:{type:Boolean,default:!1},disablePreview:{type:Boolean,default:!1},limit:{type:[Number,String],default:9},imageStyles:{type:Object,default:()=>({width:"auto",height:"auto",border:{}})},delIcon:{type:Boolean,default:!0},readonly:{type:Boolean,default:!1}},computed:{styles(){return Object.assign({width:"auto",height:"auto",border:{}},this.imageStyles)},boxStyle(){const{width:e="auto",height:t="auto"}=this.styles;let s={};"auto"===t?"auto"!==e?(s.height=this.value2px(e),s["padding-top"]=0):s.height=0:(s.height=this.value2px(t),s["padding-top"]=0),s.width="auto"===e?"auto"!==t?this.value2px(t):"33.3%":this.value2px(e);let i="";for(let n in s)i+=`${n}:${s[n]};`;return i},borderStyle(){let{border:e}=this.styles,t={};if("boolean"==typeof e)t.border=e?"1px #eee solid":"none";else{let s=e&&e.width||1;s=this.value2px(s);let i=e&&e.radius||3;i=this.value2px(i),t={"border-width":s,"border-style":e&&e.style||"solid","border-color":e&&e.color||"#eee","border-radius":i}}let s="";for(let i in t)s+=`${i}:${t[i]};`;return s}},methods:{uploadFiles(e,t){this.$emit("uploadFiles",e)},choose(){this.$emit("choose")},delFile(e){this.$emit("delFile",e)},prviewImage(e,t){let s=[];1===Number(this.limit)&&this.disablePreview&&!this.disabled&&this.$emit("choose"),this.disablePreview||(this.filesList.forEach((e=>{s.push(e.url)})),se({urls:s,current:t}))},value2px:e=>("number"==typeof e?e+="px":-1===e.indexOf("%")&&(e=-1!==e.indexOf("px")?e:e+"px"),e)}},[["render",function(e,t,r,d,p,g){const y=ie,_=m,T=ne;return s(),i(_,{class:"uni-file-picker__container"},{default:n((()=>[(s(!0),h(u,null,k(r.filesList,((e,t)=>(s(),i(_,{class:"file-picker__box",key:t,style:o(g.boxStyle)},{default:n((()=>[a(_,{class:"file-picker__box-content",style:o(g.borderStyle)},{default:n((()=>[a(y,{class:"file-image",src:e.url,mode:"aspectFill",onClick:b((s=>g.prviewImage(e,t)),["stop"])},null,8,["src","onClick"]),r.delIcon&&!r.readonly?(s(),i(_,{key:0,class:"icon-del-box",onClick:b((e=>g.delFile(t)),["stop"])},{default:n((()=>[a(_,{class:"icon-del"}),a(_,{class:"icon-del rotate"})])),_:2},1032,["onClick"])):l("",!0),e.progress&&100!==e.progress||0===e.progress?(s(),i(_,{key:1,class:"file-picker__progress"},{default:n((()=>[a(T,{class:"file-picker__progress-item",percent:-1===e.progress?0:e.progress,"stroke-width":"4",backgroundColor:e.errMsg?"#ff5a5f":"#EBEBEB"},null,8,["percent","backgroundColor"])])),_:2},1024)):l("",!0),e.errMsg?(s(),i(_,{key:2,class:"file-picker__mask",onClick:b((s=>g.uploadFiles(e,t)),["stop"])},{default:n((()=>[f(" 点击重试 ")])),_:2},1032,["onClick"])):l("",!0)])),_:2},1032,["style"])])),_:2},1032,["style"])))),128)),r.filesList.length<r.limit&&!r.readonly?(s(),i(_,{key:0,class:"file-picker__box",style:o(g.boxStyle)},{default:n((()=>[a(_,{class:"file-picker__box-content is-add",style:o(g.borderStyle),onClick:g.choose},{default:n((()=>[c(e.$slots,"default",{},(()=>[a(_,{class:"icon-add"}),a(_,{class:"icon-add rotate"})]),!0)])),_:3},8,["style","onClick"])])),_:3},8,["style"])):l("",!0)])),_:3})}],["__scopeId","data-v-86b162f5"]]),uploadFile:oe({name:"uploadFile",emits:["uploadFiles","choose","delFile"],props:{filesList:{type:Array,default:()=>[]},delIcon:{type:Boolean,default:!0},limit:{type:[Number,String],default:9},showType:{type:String,default:""},listStyles:{type:Object,default:()=>({border:!0,dividline:!0,borderStyle:{}})},readonly:{type:Boolean,default:!1}},computed:{list(){let e=[];return this.filesList.forEach((t=>{e.push(t)})),e},styles(){return Object.assign({border:!0,dividline:!0,"border-style":{}},this.listStyles)},borderStyle(){let{borderStyle:e,border:t}=this.styles,s={};if(t){let t=e&&e.width||1;t=this.value2px(t);let i=e&&e.radius||5;i=this.value2px(i),s={"border-width":t,"border-style":e&&e.style||"solid","border-color":e&&e.color||"#eee","border-radius":i}}else s.border="none";let i="";for(let n in s)i+=`${n}:${s[n]};`;return i},borderLineStyle(){let e={},{borderStyle:t}=this.styles;if(t&&t.color&&(e["border-color"]=t.color),t&&t.width){let s=t&&t.width||1,i=t&&t.style||0;"number"==typeof s?s+="px":s=s.indexOf("px")?s:s+"px",e["border-width"]=s,"number"==typeof i?i+="px":i=i.indexOf("px")?i:i+"px",e["border-top-style"]=i}let s="";for(let i in e)s+=`${i}:${e[i]};`;return s}},methods:{uploadFiles(e,t){this.$emit("uploadFiles",{item:e,index:t})},choose(){this.$emit("choose")},delFile(e){this.$emit("delFile",e)},value2px:e=>("number"==typeof e?e+="px":e=-1!==e.indexOf("px")?e:e+"px",e)}},[["render",function(e,t,d,p,y,_){const T=m,w=ne;return s(),i(T,{class:"uni-file-picker__files"},{default:n((()=>[d.readonly?l("",!0):(s(),i(T,{key:0,class:"files-button",onClick:_.choose},{default:n((()=>[c(e.$slots,"default",{},void 0,!0)])),_:3},8,["onClick"])),_.list.length>0?(s(),i(T,{key:1,class:"uni-file-picker__lists is-text-box",style:o(_.borderStyle)},{default:n((()=>[(s(!0),h(u,null,k(_.list,((e,t)=>(s(),i(T,{class:r(["uni-file-picker__lists-box",{"files-border":0!==t&&_.styles.dividline}]),key:t,style:o(0!==t&&_.styles.dividline&&_.borderLineStyle)},{default:n((()=>[a(T,{class:"uni-file-picker__item"},{default:n((()=>[a(T,{class:"files__name"},{default:n((()=>[f(g(e.name),1)])),_:2},1024),d.delIcon&&!d.readonly?(s(),i(T,{key:0,class:"icon-del-box icon-files",onClick:e=>_.delFile(t)},{default:n((()=>[a(T,{class:"icon-del icon-files"}),a(T,{class:"icon-del rotate"})])),_:2},1032,["onClick"])):l("",!0)])),_:2},1024),e.progress&&100!==e.progress||0===e.progress?(s(),i(T,{key:0,class:"file-picker__progress"},{default:n((()=>[a(w,{class:"file-picker__progress-item",percent:-1===e.progress?0:e.progress,"stroke-width":"4",backgroundColor:e.errMsg?"#ff5a5f":"#EBEBEB"},null,8,["percent","backgroundColor"])])),_:2},1024)):l("",!0),"error"===e.status?(s(),i(T,{key:1,class:"file-picker__mask",onClick:b((s=>_.uploadFiles(e,t)),["stop"])},{default:n((()=>[f(" 点击重试 ")])),_:2},1032,["onClick"])):l("",!0)])),_:2},1032,["class","style"])))),128))])),_:1},8,["style"])):l("",!0)])),_:3})}],["__scopeId","data-v-5d376bd5"]])},options:{virtualHost:!0},emits:["select","success","fail","progress","delete","update:modelValue","input"],props:{modelValue:{type:[Array,Object],default:()=>[]},value:{type:[Array,Object],default:()=>[]},disabled:{type:Boolean,default:!1},disablePreview:{type:Boolean,default:!1},delIcon:{type:Boolean,default:!0},autoUpload:{type:Boolean,default:!0},limit:{type:[Number,String],default:9},mode:{type:String,default:"grid"},fileMediatype:{type:String,default:"image"},fileExtname:{type:[Array,String],default:()=>[]},title:{type:String,default:""},listStyles:{type:Object,default:()=>({border:!0,dividline:!0,borderStyle:{}})},imageStyles:{type:Object,default:()=>({width:"auto",height:"auto"})},readonly:{type:Boolean,default:!1},returnType:{type:String,default:"array"},sizeType:{type:Array,default:()=>["original","compressed"]},sourceType:{type:Array,default:()=>["album","camera"]},provider:{type:String,default:""}},data:()=>({files:[],localValue:[]}),watch:{value:{handler(e,t){this.setValue(e,t)},immediate:!0},modelValue:{handler(e,t){this.setValue(e,t)},immediate:!0}},computed:{filesList(){let e=[];return this.files.forEach((t=>{e.push(t)})),e},showType(){return"image"===this.fileMediatype?this.mode:"list"},limitLength(){return"object"===this.returnType?1:this.limit?this.limit>=9?9:this.limit:1}},created(){xn.config&&xn.config.provider||(this.noSpace=!0,xn.chooseAndUploadFile=Cn),this.form=this.getForm("uniForms"),this.formItem=this.getForm("uniFormsItem"),this.form&&this.formItem&&this.formItem.name&&(this.rename=this.formItem.name,this.form.inputChildrens.push(this))},methods:{clearFiles(e){0===e||e?this.files.splice(e,1):(this.files=[],this.$nextTick((()=>{this.setEmit()}))),this.$nextTick((()=>{this.setEmit()}))},upload(){let e=[];return this.files.forEach(((t,s)=>{"ready"!==t.status&&"error"!==t.status||e.push(Object.assign({},t))})),this.uploadFiles(e)},async setValue(e,t){const s=async e=>{let t="";return t=e.fileID?e.fileID:e.url,/cloud:\/\/([\w.]+\/?)\S*/.test(t)&&(e.fileID=t,e.url=await this.getTempFileURL(t)),e.url&&(e.path=e.url),e};if("object"===this.returnType)e?await s(e):e={};else{e||(e=[]);for(let t=0;t<e.length;t++){let i=e[t];await s(i)}}this.localValue=e,this.form&&this.formItem&&!this.is_reset&&(this.is_reset=!1,this.formItem.setValue(this.localValue));let i=Object.keys(e).length>0?e:[];this.files=[].concat(i)},choose(){this.disabled||(this.files.length>=Number(this.limitLength)&&"grid"!==this.showType&&"array"===this.returnType?$({title:`您最多选择 ${this.limitLength} 个文件`,icon:"none"}):this.chooseFiles())},chooseFiles(){const e=Rn(this.fileExtname);xn.chooseAndUploadFile({type:this.fileMediatype,compressed:!1,sizeType:this.sizeType,sourceType:this.sourceType,extension:e.length>0?e:void 0,count:this.limitLength-this.files.length,onChooseFile:this.chooseFileCallback,onUploadProgress:e=>{this.setProgress(e,e.index)}}).then((e=>{this.setSuccessAndError(e.tempFiles)})).catch((e=>{console.log("选择失败",e)}))},async chooseFileCallback(e){const t=Rn(this.fileExtname);(1===Number(this.limitLength)&&this.disablePreview&&!this.disabled||"object"===this.returnType)&&(this.files=[]);let{filePaths:s,files:i}=((e,t)=>{let s=[],i=[];return t&&0!==t.length?(e.tempFiles.forEach((e=>{const n=An(e.name).ext.toLowerCase();-1!==t.indexOf(n)&&(i.push(e),s.push(e.path))})),i.length!==e.tempFiles.length&&$({title:`当前选择了${e.tempFiles.length}个文件 ,${e.tempFiles.length-i.length} 个文件格式不正确`,icon:"none",duration:5e3}),{filePaths:s,files:i}):{filePaths:s,files:i}})(e,t);t&&t.length>0||(s=e.tempFilePaths,i=e.tempFiles);let n=[];for(let a=0;a<i.length&&!(this.limitLength-this.files.length<=0);a++){i[a].uuid=Date.now();let e=await Mn(i[a],this.fileMediatype);e.progress=0,e.status="ready",this.files.push(e),n.push({...e,file:i[a]})}this.$emit("select",{tempFiles:n,tempFilePaths:s}),e.tempFiles=i,this.autoUpload&&!this.noSpace||(e.tempFiles=[]),e.tempFiles.forEach(((e,t)=>{this.provider&&(e.provider=this.provider);const s=e.name.split("."),i=s.pop(),n=s.join(".").replace(/[\s\/\?<>\\:\*\|":]/g,"_");e.cloudPath=n+"_"+Date.now()+"_"+t+"."+i}))},uploadFiles(e){return e=[].concat(e),In.call(this,e,5,(e=>{this.setProgress(e,e.index,!0)})).then((e=>(this.setSuccessAndError(e),e))).catch((e=>{console.log(e)}))},async setSuccessAndError(e,t){let s=[],i=[],n=[],a=[];for(let r=0;r<e.length;r++){const t=e[r],o=t.uuid?this.files.findIndex((e=>e.uuid===t.uuid)):t.index;if(-1===o||!this.files)break;if("request:fail"===t.errMsg)this.files[o].url=t.path,this.files[o].status="error",this.files[o].errMsg=t.errMsg,i.push(this.files[o]),a.push(this.files[o].url);else{this.files[o].errMsg="",this.files[o].fileID=t.url;/cloud:\/\/([\w.]+\/?)\S*/.test(t.url)?this.files[o].url=await this.getTempFileURL(t.url):this.files[o].url=t.url,this.files[o].status="success",this.files[o].progress+=1,s.push(this.files[o]),n.push(this.files[o].fileID)}}s.length>0&&(this.setEmit(),this.$emit("success",{tempFiles:this.backObject(s),tempFilePaths:n})),i.length>0&&this.$emit("fail",{tempFiles:this.backObject(i),tempFilePaths:a})},setProgress(e,t,s){this.files.length;const i=Math.round(100*e.loaded/e.total);let n=t;s||(n=this.files.findIndex((t=>t.uuid===e.tempFile.uuid))),-1!==n&&this.files[n]&&(this.files[n].progress=i-1,this.$emit("progress",{index:n,progress:parseInt(i),tempFile:this.files[n]}))},delFile(e){this.$emit("delete",{index:e,tempFile:this.files[e],tempFilePath:this.files[e].url}),this.files.splice(e,1),this.$nextTick((()=>{this.setEmit()}))},getFileExt(e){const t=e.lastIndexOf("."),s=e.length;return{name:e.substring(0,t),ext:e.substring(t+1,s)}},setEmit(){let e=[];"object"===this.returnType?(e=this.backObject(this.files)[0],this.localValue=e||null):(e=this.backObject(this.files),this.localValue||(this.localValue=[]),this.localValue=[...e]),this.$emit("update:modelValue",this.localValue)},backObject(e){let t=[];return e.forEach((e=>{t.push({extname:e.extname,fileType:e.fileType,image:e.image,name:e.name,path:e.path,size:e.size,fileID:e.fileID,url:e.url,uuid:e.uuid,status:e.status,cloudPath:e.cloudPath})})),t},async getTempFileURL(e){e={fileList:[].concat(e)};return(await xn.getTempFileURL(e)).fileList[0].tempFileURL||""},getForm(e="uniForms"){let t=this.$parent,s=t.$options.name;for(;s!==e;){if(t=t.$parent,!t)return!1;s=t.$options.name}return t}}},[["render",function(e,t,r,o,h,u){const d=y,p=m,_=S("upload-image"),k=ae,T=S("upload-file");return s(),i(p,{class:"uni-file-picker"},{default:n((()=>[r.title?(s(),i(p,{key:0,class:"uni-file-picker__header"},{default:n((()=>[a(d,{class:"file-title"},{default:n((()=>[f(g(r.title),1)])),_:1}),a(d,{class:"file-count"},{default:n((()=>[f(g(u.filesList.length)+"/"+g(u.limitLength),1)])),_:1})])),_:1})):l("",!0),"image"===r.fileMediatype&&"grid"===u.showType?(s(),i(_,{key:1,readonly:r.readonly,"image-styles":r.imageStyles,"files-list":u.filesList,limit:u.limitLength,disablePreview:r.disablePreview,delIcon:r.delIcon,onUploadFiles:u.uploadFiles,onChoose:u.choose,onDelFile:u.delFile},{default:n((()=>[c(e.$slots,"default",{},(()=>[a(p,{class:"is-add"},{default:n((()=>[a(p,{class:"icon-add"}),a(p,{class:"icon-add rotate"})])),_:1})]),!0)])),_:3},8,["readonly","image-styles","files-list","limit","disablePreview","delIcon","onUploadFiles","onChoose","onDelFile"])):l("",!0),"image"!==r.fileMediatype||"grid"!==u.showType?(s(),i(T,{key:2,readonly:r.readonly,"list-styles":r.listStyles,"files-list":u.filesList,showType:u.showType,delIcon:r.delIcon,onUploadFiles:u.uploadFiles,onChoose:u.choose,onDelFile:u.delFile},{default:n((()=>[c(e.$slots,"default",{},(()=>[a(k,{type:"primary",size:"mini"},{default:n((()=>[f("选择文件")])),_:1})]),!0)])),_:3},8,["readonly","list-styles","files-list","showType","delIcon","onUploadFiles","onChoose","onDelFile"])):l("",!0)])),_:3})}],["__scopeId","data-v-5e9fcb2e"]]);export{ce as _,Ie as a,On as b};