index-3243e535.js 22 KB

1
  1. import{b as e,f as t,I as o,m as a,n,T as l,U as i,V as s,Q as r,q as c,B as u,R as d,t as p,W as m,O as v,K as g,v as f,j as h,X as b,d as y,x as S,y as x,e as w,N as k,Y as C,Z as I,_ as B,D as T,$ as V,a0 as H,a1 as M,a2 as z,J as O,a3 as P,a4 as E,a5 as L,a6 as j,a7 as _,A as q,a8 as D,i as A,a9 as N,aa as $,S as F}from"./index-c7142a7c.js";import{L as W,r as R,s as K}from"./utils-7bd65cc6.js";import{d as U,c as Y,r as J,g as Q,j as X,w as Z,q as G,n as ee,f as te,p as oe,h as ae,a as ne,t as le,e as ie,k as se,y as re}from"./index-d37e444c.js";import{u as ce}from"./use-id-9dd215ee.js";const[ue,de]=e("button"),pe=c(U({name:ue,props:t({},o,{tag:a("button"),text:String,icon:String,type:a("default"),size:a("normal"),color:String,block:Boolean,plain:Boolean,round:Boolean,square:Boolean,loading:Boolean,hairline:Boolean,disabled:Boolean,iconPrefix:String,nativeType:a("button"),loadingSize:n,loadingText:String,loadingType:String,iconPosition:a("left")}),emits:["click"],setup(e,{emit:t,slots:o}){const a=l(),n=()=>e.loading?o.loading?o.loading():Y(W,{size:e.loadingSize,type:e.loadingType,"class":de("loading")},null):o.icon?Y("div",{"class":de("icon")},[o.icon()]):e.icon?Y(s,{name:e.icon,"class":de("icon"),classPrefix:e.iconPrefix},null):void 0,c=()=>{let t;if(t=e.loading?e.loadingText:o["default"]?o["default"]():e.text,t)return Y("span",{"class":de("text")},[t])},u=()=>{const{color:t,plain:o}=e;if(t){const e={color:o?t:"white"};return o||(e.background=t),t.includes("gradient")?e.border=0:e.borderColor=t,e}},d=o=>{e.loading?r(o):e.disabled||(t("click",o),a())};return()=>{const{tag:t,type:o,size:a,block:l,round:s,plain:r,square:p,loading:m,disabled:v,hairline:g,nativeType:f,iconPosition:h}=e,b=[de([o,a,{plain:r,block:l,round:s,square:p,loading:m,disabled:v,hairline:g}]),{[i]:g}];return Y(t,{type:f,"class":b,style:u(),disabled:v,onClick:d},{"default":()=>[Y("div",{"class":de("content")},["left"===h&&n(),c(),"right"===h&&n()])]})}}})),[me,ve,ge]=e("picker"),fe=e=>e.find((e=>!e.disabled))||e[0];function he(e,t){for(let o=t=d(t,0,e.length);o<e.length;o++)if(!e[o].disabled)return o;for(let o=t-1;o>=0;o--)if(!e[o].disabled)return o;return 0}const be=(e,t,o)=>void 0!==t&&!!e.find((e=>e[o.value]===t));function ye(e,t,o){const a=e.findIndex((e=>e[o.value]===t));return e[he(e,a)]}const[Se,xe]=e("picker-column"),we=Symbol(Se);var ke=U({name:Se,props:{value:n,fields:p(Object),options:m(),readonly:Boolean,allowHtml:Boolean,optionHeight:p(Number),swipeDuration:p(n),visibleOptionNum:p(n)},emits:["change","clickOption","scrollInto"],setup(e,{emit:t,slots:o}){let a,n,l,i,s;const c=J(),u=J(),p=J(0),m=J(0),b=v(),y=()=>e.options.length,S=()=>e.optionHeight*(+e.visibleOptionNum-1)/2,x=o=>{let n=he(e.options,o);const l=-n*e.optionHeight,i=()=>{n>y()-1&&(n=he(e.options,o));const a=e.options[n][e.fields.value];a!==e.value&&t("change",a)};a&&l!==p.value?s=i:i(),p.value=l},w=()=>e.readonly||!e.options.length,k=t=>d(Math.round(-t/e.optionHeight),0,y()-1),C=Q((()=>k(p.value))),I=()=>{a=!1,m.value=0,s&&(s(),s=null)},B=e=>{if(!w()){if(b.start(e),a){const e=function(e){const{transform:t}=window.getComputedStyle(e),o=t.slice(7,t.length-1).split(", ")[5];return Number(o)}(u.value);p.value=Math.min(0,e-S())}m.value=0,n=p.value,l=Date.now(),i=n,s=null}},T=()=>{if(w())return;const t=p.value-i,o=Date.now()-l;if(o<300&&Math.abs(t)>15)return void((t,o)=>{const a=Math.abs(t/o);t=p.value+a/.003*(t<0?-1:1);const n=k(t);m.value=+e.swipeDuration,x(n)})(t,o);const n=k(p.value);m.value=200,x(n),setTimeout((()=>{a=!1}),0)},V=()=>{const n={height:"".concat(e.optionHeight,"px")};return e.options.map(((l,i)=>{const r=l[e.fields.text],{disabled:c}=l,u=l[e.fields.value],d={role:"button",style:n,tabindex:c?-1:0,"class":[xe("item",{disabled:c,selected:u===e.value}),l.className],onClick:()=>{return o=i,void(a||w()||(s=null,m.value=200,x(o),t("clickOption",e.options[o])));var o}},p={"class":"van-ellipsis",[e.allowHtml?"innerHTML":"textContent"]:r};return Y("li",d,[o.option?o.option(l,i):Y("div",p,null)])}))};return g(we),f({stopMomentum:I}),X((()=>{const t=a?Math.floor(-p.value/e.optionHeight):e.options.findIndex((t=>t[e.fields.value]===e.value)),o=he(e.options,t),n=-o*e.optionHeight;a&&o<t&&I(),p.value=n})),h("touchmove",(o=>{if(w())return;b.move(o),b.isVertical()&&(a=!0,r(o,!0));const s=d(n+b.deltaY.value,-y()*e.optionHeight,e.optionHeight),c=k(s);c!==C.value&&t("scrollInto",e.options[c]),p.value=s;const u=Date.now();u-l>300&&(l=u,i=s)}),{target:c}),()=>Y("div",{ref:c,"class":xe(),onTouchstartPassive:B,onTouchend:T,onTouchcancel:T},[Y("ul",{ref:u,style:{transform:"translate3d(0, ".concat(p.value+S(),"px, 0)"),transitionDuration:"".concat(m.value,"ms"),transitionProperty:m.value?"all":"none"},"class":xe("wrapper"),onTransitionend:I},[V()])])}});const[Ce]=e("picker-toolbar"),Ie={title:String,cancelButtonText:String,confirmButtonText:String},Be=["cancel","confirm","title","toolbar"],Te=Object.keys(Ie);var Ve=U({name:Ce,props:Ie,emits:["confirm","cancel"],setup(e,{emit:t,slots:o}){const a=()=>t("cancel"),n=()=>t("confirm"),l=()=>{const t=e.cancelButtonText||ge("cancel");return Y("button",{type:"button","class":[ve("cancel"),b],onClick:a},[o.cancel?o.cancel():t])},i=()=>{const t=e.confirmButtonText||ge("confirm");return Y("button",{type:"button","class":[ve("confirm"),b],onClick:n},[o.confirm?o.confirm():t])};return()=>Y("div",{"class":ve("toolbar")},[o.toolbar?o.toolbar():[l(),o.title?o.title():e.title?Y("div",{"class":[ve("title"),"van-ellipsis"]},[e.title]):void 0,i()]])}});const[He,Me]=e("picker-group"),ze=Symbol(He);t({tabs:m(),activeTab:y(0),nextStepText:String},Ie);const Oe=t({loading:Boolean,readonly:Boolean,allowHtml:Boolean,optionHeight:y(44),showToolbar:S,swipeDuration:y(1e3),visibleOptionNum:y(6)},Ie),Pe=c(U({name:me,props:t({},Oe,{columns:m(),modelValue:m(),toolbarPosition:a("top"),columnsFieldNames:Object}),emits:["confirm","cancel","change","scrollInto","clickOption","update:modelValue"],setup(e,{emit:o,slots:a}){const n=J(),l=J(e.modelValue.slice(0)),{parent:i}=g(ze),{children:s,linkChildren:c}=x(we);c();const d=Q((()=>{return o=e.columnsFieldNames,t({text:"text",value:"value",children:"children"},o);var o})),p=Q((()=>w(e.optionHeight))),m=Q((()=>function(e,t){const o=e[0];if(o){if(Array.isArray(o))return"multiple";if(t.children in o)return"cascade"}return"default"}(e.columns,d.value))),v=Q((()=>{const{columns:t}=e;switch(m.value){case"multiple":return t;case"cascade":return function(e,t,o){const a=[];let n={[t.children]:e},l=0;for(;n&&n[t.children];){const e=n[t.children],i=o.value[l];n=u(i)?ye(e,i,t):void 0,!n&&e.length&&(n=ye(e,fe(e)[t.value],t)),l++,a.push(e)}return a}(t,d.value,l);default:return[t]}})),b=Q((()=>v.value.some((e=>e.length)))),y=Q((()=>v.value.map(((e,t)=>ye(e,l.value[t],d.value))))),S=Q((()=>v.value.map(((e,t)=>e.findIndex((e=>e[d.value.value]===l.value[t])))))),B=(e,t)=>{if(l.value[e]!==t){const o=l.value.slice(0);o[e]=t,l.value=o}},T=()=>({selectedValues:l.value.slice(0),selectedOptions:y.value,selectedIndexes:S.value}),V=()=>{s.forEach((e=>e.stopMomentum()));const e=T();return ee((()=>{o("confirm",e)})),e},H=()=>o("cancel",T()),M=e=>{if(b.value){const t={height:"".concat(p.value,"px")},o={backgroundSize:"100% ".concat((e-p.value)/2,"px")};return[Y("div",{"class":ve("mask"),style:o},null),Y("div",{"class":[I,ve("frame")],style:t},null)]}},z=()=>{const i=p.value*+e.visibleOptionNum,s={height:"".concat(i,"px")};return Y("div",{ref:n,"class":ve("columns"),style:s},[v.value.map(((n,i)=>Y(ke,{value:l.value[i],fields:d.value,options:n,readonly:e.readonly,allowHtml:e.allowHtml,optionHeight:p.value,swipeDuration:e.swipeDuration,visibleOptionNum:e.visibleOptionNum,onChange:e=>{return B(a=i,e),"cascade"===m.value&&l.value.forEach(((e,t)=>{const o=v.value[t];be(o,e,d.value)||B(t,o.length?o[0][d.value.value]:void 0)})),void ee((()=>{o("change",t({columnIndex:a},T()))}));var a},onClickOption:e=>((e,a)=>{const n={columnIndex:a,currentOption:e};o("clickOption",t(T(),n)),o("scrollInto",n)})(e,i),onScrollInto:e=>{o("scrollInto",{currentOption:e,columnIndex:i})}},{option:a.option}))),M(i)])},O=()=>{if(e.showToolbar&&!i)return Y(Ve,G(k(e,Te),{onConfirm:V,onCancel:H}),k(a,Be))};let P;return Z(v,(e=>{e.forEach(((e,t)=>{e.length&&!be(e,l.value[t],d.value)&&B(t,fe(e)[d.value.value])}))}),{immediate:!0}),Z((()=>e.modelValue),(e=>{C(e,l.value)||C(e,P)||(l.value=e.slice(0),P=e.slice(0))}),{deep:!0}),Z(l,(t=>{C(t,e.modelValue)||(P=t.slice(0),o("update:modelValue",P))}),{immediate:!0}),h("touchmove",r,{target:n}),f({confirm:V,getSelectedOptions:()=>y.value}),()=>{var t,o;return Y("div",{"class":ve()},["top"===e.toolbarPosition?O():null,e.loading?Y(W,{"class":ve("loading")},null):null,null==(t=a["columns-top"])?void 0:t.call(a),z(),null==(o=a["columns-bottom"])?void 0:o.call(a),"bottom"===e.toolbarPosition?O():null])}}}));function Ee(e){return Array.isArray(e)?!e.length:0!==e&&!e}function Le(e,t){const{message:o}=t;return M(o)?o(e,t):o||""}function je({target:e}){e.composing=!0}function _e({target:e}){e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}function qe(e){return[...e].length}function De(e,t){return[...e].slice(0,t).join("")}const[Ae,Ne]=e("field"),$e={id:String,name:String,leftIcon:String,rightIcon:String,autofocus:Boolean,clearable:Boolean,maxlength:n,formatter:Function,clearIcon:a("clear"),modelValue:y(""),inputAlign:String,placeholder:String,autocomplete:String,autocapitalize:String,autocorrect:String,errorMessage:String,enterkeyhint:String,clearTrigger:a("focus"),formatTrigger:a("onChange"),spellcheck:{type:Boolean,"default":null},error:{type:Boolean,"default":null},disabled:{type:Boolean,"default":null},readonly:{type:Boolean,"default":null}},Fe=c(U({name:Ae,props:t({},z,$e,{rows:n,type:a("text"),rules:Array,autosize:[Boolean,Object],labelWidth:n,labelClass:O,labelAlign:String,showWordLimit:Boolean,errorMessageAlign:String,colon:{type:Boolean,"default":null}}),emits:["blur","focus","clear","keypress","clickInput","endValidate","startValidate","clickLeftIcon","clickRightIcon","update:modelValue"],setup(e,{emit:t,slots:o}){const a=ce(),n=te({status:"unvalidated",focused:!1,validateMessage:""}),l=J(),i=J(),c=J(),{parent:d}=g(L),p=()=>{var t;return String(null!=(t=e.modelValue)?t:"")},m=t=>u(e[t])?e[t]:d&&u(d.props[t])?d.props[t]:void 0,v=Q((()=>{const t=m("readonly");if(e.clearable&&!t){const t=""!==p(),o="always"===e.clearTrigger||"focus"===e.clearTrigger&&n.focused;return t&&o}return!1})),b=Q((()=>c.value&&o.input?c.value():e.modelValue)),y=Q((()=>{var t;const o=m("required");return"auto"===o?null==(t=e.rules)?void 0:t.some((e=>e.required)):o})),S=()=>{n.status="unvalidated",n.validateMessage=""},x=()=>t("endValidate",{status:n.status,message:n.validateMessage}),w=(o=e.rules)=>new Promise((a=>{var l;S(),o?(t("startValidate"),(l=o,l.reduce(((e,t)=>e.then((()=>{if("failed"===n.status)return;let{value:e}=b;if(t.formatter&&(e=t.formatter(e,t)),!function(e,t){if(Ee(e)){if(t.required)return!1;if(!1===t.validateEmpty)return!0}return!(t.pattern&&!t.pattern.test(String(e)))}(e,t))return n.status="failed",void(n.validateMessage=Le(e,t));if(t.validator){if(Ee(e)&&!1===t.validateEmpty)return;return(o=e,a=t,new Promise((e=>{const t=a.validator(o,a);H(t)?t.then(e):e(t)}))).then((o=>{o&&"string"==typeof o?(n.status="failed",n.validateMessage=o):!1===o&&(n.status="failed",n.validateMessage=Le(e,t))}))}var o,a}))),Promise.resolve())).then((()=>{"failed"===n.status?(a({name:e.name,message:n.validateMessage}),x()):(n.status="passed",a(),x())}))):a()})),k=t=>{if(d&&e.rules){const{validateTrigger:o}=d.props,a=j(o).includes(t),n=e.rules.filter((e=>e.trigger?j(e.trigger).includes(t):a));n.length&&w(n)}},C=(o,a="onChange")=>{const i=o;o=(t=>{var o;const{maxlength:a}=e;if(u(a)&&qe(t)>+a){const e=p();if(e&&qe(e)===+a)return e;const i=null==(o=l.value)?void 0:o.selectionEnd;if(n.focused&&i){const e=[...t],o=e.length-+a;return e.splice(i-o,o),e.join("")}return De(t,+a)}return t})(o);const s=qe(i)-qe(o);if("number"===e.type||"digit"===e.type){const t="number"===e.type;o=_(o,t,t)}let r=0;if(e.formatter&&a===e.formatTrigger){const{formatter:t,maxlength:a}=e;if(o=t(o),u(a)&&qe(o)>+a&&(o=De(o,+a)),l.value&&n.focused){const{selectionEnd:e}=l.value,o=De(i,e);r=qe(t(o))-qe(o)}}if(l.value&&l.value.value!==o)if(n.focused){let{selectionStart:e,selectionEnd:t}=l.value;if(l.value.value=o,u(e)&&u(t)){const a=qe(o);s?(e-=s,t-=s):r&&(e+=r,t+=r),l.value.setSelectionRange(Math.min(e,a),Math.min(t,a))}}else l.value.value=o;o!==e.modelValue&&t("update:modelValue",o)},I=e=>{e.target.composing||C(e.target.value)},M=()=>{var e;return null==(e=l.value)?void 0:e.blur()},z=()=>{var e;return null==(e=l.value)?void 0:e.focus()},O=()=>{const t=l.value;"textarea"===e.type&&e.autosize&&t&&function(e,t){const o=B();e.style.height="auto";let a=e.scrollHeight;if(V(t)){const{maxHeight:e,minHeight:o}=t;void 0!==e&&(a=Math.min(a,e)),void 0!==o&&(a=Math.max(a,o))}a&&(e.style.height="".concat(a,"px"),T(o))}(t,e.autosize)},A=e=>{n.focused=!0,t("focus",e),ee(O),m("readonly")&&M()},N=e=>{n.focused=!1,C(p(),"onBlur"),t("blur",e),m("readonly")||(k("onBlur"),ee(O),D())},$=e=>t("clickInput",e),F=e=>t("clickLeftIcon",e),W=e=>t("clickRightIcon",e),R=Q((()=>"boolean"==typeof e.error?e.error:!(!d||!d.props.showError||"failed"!==n.status)||void 0)),K=Q((()=>{const e=m("labelWidth"),t=m("labelAlign");if(e&&"top"!==t)return{width:q(e)}})),U=o=>{13===o.keyCode&&(d&&d.props.submitOnEnter||"textarea"===e.type||r(o),"search"===e.type&&M()),t("keypress",o)},X=()=>e.id||"".concat(a,"-input"),le=()=>{const t=Ne("control",[m("inputAlign"),{error:R.value,custom:!!o.input,"min-height":"textarea"===e.type&&!e.autosize}]);if(o.input)return Y("div",{"class":t,onClick:$},[o.input()]);const n={id:X(),ref:l,name:e.name,rows:void 0!==e.rows?+e.rows:void 0,"class":t,disabled:m("disabled"),readonly:m("readonly"),autofocus:e.autofocus,placeholder:e.placeholder,autocomplete:e.autocomplete,autocapitalize:e.autocapitalize,autocorrect:e.autocorrect,enterkeyhint:e.enterkeyhint,spellcheck:e.spellcheck,"aria-labelledby":e.label?"".concat(a,"-label"):void 0,onBlur:N,onFocus:A,onInput:I,onClick:$,onChange:_e,onKeypress:U,onCompositionend:_e,onCompositionstart:je};return"textarea"===e.type?Y("textarea",n,null):Y("input",G("number"===(i=e.type)?{type:"text",inputmode:"decimal"}:"digit"===i?{type:"tel",inputmode:"numeric"}:{type:i},n),null);var i},ie=()=>{const t=o["right-icon"];if(e.rightIcon||t)return Y("div",{"class":Ne("right-icon"),onClick:W},[t?t():Y(s,{name:e.rightIcon,classPrefix:e.iconPrefix},null)])},se=()=>{if(e.showWordLimit&&e.maxlength){const t=qe(p());return Y("div",{"class":Ne("word-limit")},[Y("span",{"class":Ne("word-num")},[t]),ne("/"),e.maxlength])}},re=()=>{if(d&&!1===d.props.showErrorMessage)return;const t=e.errorMessage||n.validateMessage;if(t){const e=o["error-message"],a=m("errorMessageAlign");return Y("div",{"class":Ne("error-message",a)},[e?e({message:t}):t])}},ue=()=>[Y("div",{"class":Ne("body")},[le(),v.value&&Y(s,{ref:i,name:e.clearIcon,"class":Ne("clear")},null),ie(),o.button&&Y("div",{"class":Ne("button")},[o.button()])]),se(),re()];return f({blur:M,focus:z,validate:w,formValue:b,resetValidation:S,getValidationStatus:()=>n.status}),oe(P,{customValue:c,resetValidation:S,validateWithTrigger:k}),Z((()=>e.modelValue),(()=>{C(p()),S(),k("onChange"),ee(O)})),ae((()=>{C(p(),e.formatTrigger),ee(O)})),h("touchstart",(e=>{r(e),t("update:modelValue",""),t("clear",e)}),{target:Q((()=>{var e;return null==(e=i.value)?void 0:e.$el}))}),()=>{const t=m("disabled"),n=m("labelAlign"),l=(()=>{const t=o["left-icon"];if(e.leftIcon||t)return Y("div",{"class":Ne("left-icon"),onClick:F},[t?t():Y(s,{name:e.leftIcon,classPrefix:e.iconPrefix},null)])})();return Y(E,{size:e.size,"class":Ne({error:R.value,disabled:t,["label-".concat(n)]:n}),center:e.center,border:e.border,isLink:e.isLink,clickable:e.clickable,titleStyle:K.value,valueClass:Ne("value"),titleClass:[Ne("label",[n,{required:y.value}]),e.labelClass],arrowDirection:e.arrowDirection},{icon:l&&"top"!==n?()=>l:null,title:()=>{const t=(()=>{const t=m("labelWidth"),n=m("labelAlign"),l=m("colon")?":":"";return o.label?[o.label(),l]:e.label?Y("label",{id:"".concat(a,"-label"),"for":o.input?void 0:X(),onClick:e=>{r(e),z()},style:"top"===n&&t?{width:q(t)}:void 0},[e.label+l]):void 0})();return"top"===n?[l,t].filter(Boolean):t||[]},value:ue,extra:o.extra})}}})),[We,Re]=e("image"),Ke=c(U({name:We,props:{src:String,alt:String,fit:String,position:String,round:Boolean,block:Boolean,width:n,height:n,radius:n,lazyLoad:Boolean,iconSize:n,showError:S,errorIcon:a("photo-fail"),iconPrefix:String,showLoading:S,loadingIcon:a("photo")},emits:["load","error"],setup(e,{emit:t,slots:o}){const a=J(!1),n=J(!0),l=J(),{$Lazyload:i}=le().proxy,r=Q((()=>{const t={width:q(e.width),height:q(e.height)};return u(e.radius)&&(t.overflow="hidden",t.borderRadius=q(e.radius)),t}));Z((()=>e.src),(()=>{a.value=!1,n.value=!0}));const c=e=>{n.value&&(n.value=!1,t("load",e))},d=()=>{const e=new Event("load");Object.defineProperty(e,"target",{value:l.value,enumerable:!0}),c(e)},p=e=>{a.value=!0,n.value=!1,t("error",e)},m=(t,o,a)=>a?a():Y(s,{name:t,size:e.iconSize,"class":o,classPrefix:e.iconPrefix},null),v=()=>{if(a.value||!e.src)return;const t={alt:e.alt,"class":Re("img"),style:{objectFit:e.fit,objectPosition:e.position}};return e.lazyLoad?se(Y("img",G({ref:l},t),null),[[re("lazy"),e.src]]):Y("img",G({ref:l,src:e.src,onLoad:c,onError:p},t),null)},g=({el:e})=>{const t=()=>{e===l.value&&n.value&&d()};l.value?t():ee(t)},f=({el:e})=>{e!==l.value||a.value||p()};return i&&A&&(i.$on("loaded",g),i.$on("error",f),ie((()=>{i.$off("loaded",g),i.$off("error",f)}))),ae((()=>{ee((()=>{var t;(null==(t=l.value)?void 0:t.complete)&&!e.lazyLoad&&d()}))})),()=>{var t;return Y("div",{"class":Re({round:e.round,block:e.block}),style:r.value},[v(),n.value&&e.showLoading?Y("div",{"class":Re("loading")},[m(e.loadingIcon,Re("loading-icon"),o.loading)]):a.value&&e.showError?Y("div",{"class":Re("error")},[m(e.errorIcon,Re("error-icon"),o.error)]):void 0,null==(t=o["default"])?void 0:t.call(o)])}}})),[Ue,Ye]=e("row"),Je=Symbol(Ue);var Qe=U({name:Ue,props:{tag:a("div"),wrap:S,align:String,gutter:y(0),justify:String},setup(e,{slots:t}){const{children:o,linkChildren:a}=x(Je),n=Q((()=>{const e=[[]];let t=0;return o.forEach(((o,a)=>{t+=Number(o.span),t>24?(e.push([a]),t-=24):e[e.length-1].push(a)})),e}));return a({spaces:Q((()=>{const t=Number(e.gutter),o=[];return t?(n.value.forEach((e=>{const a=t*(e.length-1)/e.length;e.forEach(((e,n)=>{if(0===n)o.push({right:a});else{const n=t-o[e-1].right,l=a-n;o.push({left:n,right:l})}}))})),o):o}))}),()=>{const{tag:o,wrap:a,align:n,justify:l}=e;return Y(o,{"class":Ye({["align-".concat(n)]:n,["justify-".concat(l)]:l,nowrap:!a})},{"default":()=>{var e;return[null==(e=t["default"])?void 0:e.call(t)]}})}}});const[Xe,Ze]=e("col"),Ge=c(U({name:Xe,props:{tag:a("div"),span:y(0),offset:n},setup(e,{slots:t}){const{parent:o,index:a}=g(Je),n=Q((()=>{if(!o)return;const{spaces:e}=o;if(e&&e.value&&e.value[a.value]){const{left:t,right:o}=e.value[a.value];return{paddingLeft:t?"".concat(t,"px"):null,paddingRight:o?"".concat(o,"px"):null}}}));return()=>{const{tag:o,span:a,offset:l}=e;return Y(o,{style:n.value,"class":Ze({[a]:a,["offset-".concat(l)]:l})},{"default":()=>{var e;return[null==(e=t["default"])?void 0:e.call(t)]}})}}})),[et,tt]=e("count-down"),ot=c(U({name:et,props:{time:y(0),format:a("HH:mm:ss"),autoStart:S,millisecond:Boolean},emits:["change","finish"],setup(e,{emit:t,slots:o}){const{start:a,pause:n,reset:l,current:i}=$({time:+e.time,millisecond:e.millisecond,onChange:e=>t("change",e),onFinish:()=>t("finish")}),s=Q((()=>function(e,t){const{days:o}=t;let{hours:a,minutes:n,seconds:l,milliseconds:i}=t;if(e.includes("DD")?e=e.replace("DD",N(o)):a+=24*o,e.includes("HH")?e=e.replace("HH",N(a)):n+=60*a,e.includes("mm")?e=e.replace("mm",N(n)):l+=60*n,e.includes("ss")?e=e.replace("ss",N(l)):i+=1e3*l,e.includes("S")){const t=N(i,3);e=e.includes("SSS")?e.replace("SSS",t):e.includes("SS")?e.replace("SS",t.slice(0,2)):e.replace("S",t.charAt(0))}return e}(e.format,i.value))),r=()=>{l(+e.time),e.autoStart&&a()};return Z((()=>e.time),r,{immediate:!0}),f({start:a,pause:n,reset:r}),()=>Y("div",{role:"timer","class":tt()},[o["default"]?o["default"](i.value):s.value])}})),at=c(Qe),nt=U({name:"o-img-code",props:{value:Boolean,phone:[String,Number],type:{type:String,"default":""},clientId:{type:String,"default":"cooleshow-student"}},emits:["close","sendCode"],data(){return{isSuffix:"/api-website",showStatus:!1,identifyingCode:"/api-website/code/getImageCode?phone="+this.phone,code:""}},mounted(){this.showStatus=this.value},watch:{value(e){this.showStatus=e},code(e){e.length>=4&&this.checkVerifyLoginImage()}},methods:{async updateIdentifyingCode(){const e=window.location.origin;this.identifyingCode="".concat(e).concat(this.isSuffix,"/code/getImageCode?phone=").concat(this.phone,"&token=").concat(Math.random())},async checkVerifyLoginImage(){try{if(this.code.length<4)return;await R.post(this.isSuffix+"/code/verifyImageCode",{requestType:"form",hideLoading:!0,data:{phone:this.phone,code:this.code}}),await R.post("/api-website/code/sendSmsCode",{requestType:"form",hideLoading:!0,data:{mobile:this.phone,type:this.type}}),setTimeout((()=>{K("验证码已发送")}),100),this.$emit("close"),this.$emit("sendCode")}catch(e){this.code="",setTimeout((()=>{this.updateIdentifyingCode()}),500)}}},render(){return Y(F,{show:this.showStatus,"class":"_imgCodePopup_mq980_27",closeOnClickOverlay:!1,onClose:()=>{this.$emit("close")},closeable:!0,closeIcon:"close"},{"default":()=>[Y("div",{"class":"_imgCode_mq980_1"},[Y("p",{"class":"_codeTitle_mq980_4"},[ne("输入图形验证码")]),Y(at,null,{"default":()=>[Y(Ge,{span:"14"},{"default":()=>[Y(Fe,{placeholder:"请输入验证码",modelValue:this.code,"onUpdate:modelValue":e=>this.code=e,"class":"_field_mq980_23",autocomplete:"off"},null)]}),Y(Ge,{span:"10","class":"_img_mq980_1"},{"default":()=>[Y(Ke,{src:this.identifyingCode,onClick:()=>this.updateIdentifyingCode()},{loading:()=>Y(W,{type:"spinner",size:"20"},null)})]})]}),Y(at,{style:{display:"flex",justifyContent:"flex-end"}},{"default":()=>[Y(Ge,{span:"10"},{"default":()=>[Y("span",{"class":"_imgChange_mq980_16",onClick:()=>this.updateIdentifyingCode()},[ne("看不清?换一换")])]})]})])]})}});export{pe as B,ot as C,Fe as F,nt as M,Pe as P};