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