index-41fe9b4a.js 9.5 KB

1
  1. import{Y as S,J as z,a as P,r as g,D as B,S as G,Z as X,w as j,o as V,y,g as Y,P as Q,A as ee,s as te,$ as ne,d as W,c as w,m as re}from"./index-2e65d505.js";function Je(){}const Ue=Object.assign,H=typeof window<"u",F=e=>e!==null&&typeof e=="object",m=e=>e!=null,x=e=>typeof e=="function",Ze=e=>F(e)&&x(e.then)&&x(e.catch),Ke=e=>Object.prototype.toString.call(e)==="[object Date]"&&!Number.isNaN(e.getTime()),J=e=>typeof e=="number"||/^\d+(\.\d+)?$/.test(e),oe=()=>H?/ios|iphone|ipad|ipod/.test(navigator.userAgent.toLowerCase()):!1;function O(e,t){const n=t.split(".");let r=e;return n.forEach(u=>{var s;r=F(r)&&(s=r[u])!=null?s:""}),r}function qe(e,t,n){return t.reduce((r,u)=>((!n||e[u]!==void 0)&&(r[u]=e[u]),r),{})}const Ge=(e,t)=>JSON.stringify(e)===JSON.stringify(t),Xe=e=>Array.isArray(e)?e:[e],Qe=null,E=[Number,String],ue={type:Boolean,default:!0},et=e=>({type:e,required:!0}),tt=()=>({type:Array,default:()=>[]}),nt=e=>({type:Number,default:e}),rt=e=>({type:E,default:e}),A=e=>({type:String,default:e});var v=typeof window<"u",se=e=>e===window,T=(e,t)=>({top:0,left:0,right:e,bottom:t,width:e,height:t}),ot=e=>{const t=y(e);if(se(t)){const n=t.innerWidth,r=t.innerHeight;return T(n,r)}return t!=null&&t.getBoundingClientRect?t.getBoundingClientRect():T(0,0)};function ut(e){const t=S(e,null);if(t){const n=Y(),{link:r,unlink:u,internalChildren:s}=t;r(n),z(()=>u(n));const c=P(()=>s.indexOf(n));return{parent:t,index:c}}return{parent:null,index:g(-1)}}function ie(e){const t=[],n=r=>{Array.isArray(r)&&r.forEach(u=>{var s;ne(u)&&(t.push(u),(s=u.component)!=null&&s.subTree&&(t.push(u.component.subTree),n(u.component.subTree.children)),u.children&&n(u.children))})};return n(e),t}var $=(e,t)=>{const n=e.indexOf(t);return n===-1?e.findIndex(r=>t.key!==void 0&&t.key!==null&&r.type===t.type&&r.key===t.key):n};function ae(e,t,n){const r=ie(e.subTree.children);n.sort((s,c)=>$(r,s.vnode)-$(r,c.vnode));const u=n.map(s=>s.proxy);t.sort((s,c)=>{const o=u.indexOf(s),i=u.indexOf(c);return o-i})}function st(e){const t=B([]),n=B([]),r=Y();return{children:t,linkChildren:s=>{Q(e,Object.assign({link:i=>{i.proxy&&(n.push(i),t.push(i.proxy),ae(r,t,n))},unlink:i=>{const a=n.indexOf(i);t.splice(a,1),n.splice(a,1)},children:t,internalChildren:n},s))}}}function ce(e){let t;V(()=>{e(),ee(()=>{t=!0})}),te(()=>{t&&e()})}function le(e,t,n={}){if(!v)return;const{target:r=window,passive:u=!1,capture:s=!1}=n;let c=!1,o;const i=l=>{if(c)return;const d=y(l);d&&!o&&(d.addEventListener(e,t,{capture:s,passive:u}),o=!0)},a=l=>{if(c)return;const d=y(l);d&&o&&(d.removeEventListener(e,t,s),o=!1)};z(()=>a(r)),G(()=>a(r)),ce(()=>i(r));let p;return X(r)&&(p=j(r,(l,d)=>{a(d),i(l)})),()=>{p==null||p(),a(r),c=!0}}function it(e,t,n={}){if(!v)return;const{eventName:r="click"}=n;le(r,s=>{(Array.isArray(e)?e:[e]).every(i=>{const a=y(i);return a&&!a.contains(s.target)})&&t(s)},{target:document})}var h,C;function de(){if(!h&&(h=g(0),C=g(0),v)){const e=()=>{h.value=window.innerWidth,C.value=window.innerHeight};e(),window.addEventListener("resize",e,{passive:!0}),window.addEventListener("orientationchange",e,{passive:!0})}return{width:h,height:C}}var fe=/scroll|auto|overlay/i,U=v?window:void 0;function pe(e){return e.tagName!=="HTML"&&e.tagName!=="BODY"&&e.nodeType===1}function ge(e,t=U){let n=e;for(;n&&n!==t&&pe(n);){const{overflowY:r}=window.getComputedStyle(n);if(fe.test(r))return n;n=n.parentNode}return t}function at(e,t=U){const n=g();return V(()=>{e.value&&(n.value=ge(e.value,t))}),n}var me=Symbol("van-field");function ct(e){const t=S(me,null);t&&!t.customValue.value&&(t.customValue.value=e,j(e,()=>{t.resetValidation(),t.validateWithTrigger("onChange")}))}function lt(e){const t="scrollTop"in e?e.scrollTop:e.pageYOffset;return Math.max(t,0)}function k(e,t){"scrollTop"in e?e.scrollTop=t:e.scrollTo(e.scrollX,t)}function Ee(){return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0}function he(e){k(window,e),k(document.body,e)}const ye=oe();function dt(){ye&&he(Ee())}const we=e=>e.stopPropagation();function ft(e,t){(typeof e.cancelable!="boolean"||e.cancelable)&&e.preventDefault(),t&&we(e)}const{width:ve,height:Ce}=de();function be(e){const t=window.getComputedStyle(e);return t.transform!=="none"||t.perspective!=="none"||["transform","perspective","filter"].some(n=>(t.willChange||"").includes(n))}function pt(e){let t=e.parentElement;for(;t;){if(t&&t.tagName!=="HTML"&&t.tagName!=="BODY"&&be(t))return t;t=t.parentElement}return null}function f(e){if(m(e))return J(e)?`${e}px`:String(e)}function gt(e){if(m(e)){if(Array.isArray(e))return{width:f(e[0]),height:f(e[1])};const t=f(e);return{width:t,height:t}}}function mt(e){const t={};return e!==void 0&&(t.zIndex=+e),t}let b;function Be(){if(!b){const e=document.documentElement,t=e.style.fontSize||window.getComputedStyle(e).fontSize;b=parseFloat(t)}return b}function xe(e){return e=e.replace(/rem/g,""),+e*Be()}function Ae(e){return e=e.replace(/vw/g,""),+e*ve.value/100}function De(e){return e=e.replace(/vh/g,""),+e*Ce.value/100}function Et(e){if(typeof e=="number")return e;if(H){if(e.includes("rem"))return xe(e);if(e.includes("vw"))return Ae(e);if(e.includes("vh"))return De(e)}return parseFloat(e)}const Se=/-(\w)/g,Z=e=>e.replace(Se,(t,n)=>n.toUpperCase());function ht(e,t=2){let n=e+"";for(;n.length<t;)n="0"+n;return n}const yt=(e,t,n)=>Math.min(Math.max(e,t),n);function _(e,t,n){const r=e.indexOf(t);return r===-1?e:t==="-"&&r!==0?e.slice(0,r):e.slice(0,r+1)+e.slice(r).replace(n,"")}function wt(e,t=!0,n=!0){t?e=_(e,".",/\./g):e=e.split(".")[0],n?e=_(e,"-",/-/g):e=e.replace(/-/,"");const r=t?/[^-0-9.]/g:/[^-0-9]/g;return e.replace(r,"")}function vt(e,t){return Math.round((e+t)*1e10)/1e10}const{hasOwnProperty:Pe}=Object.prototype;function Fe(e,t,n){const r=t[n];m(r)&&(!Pe.call(e,n)||!F(r)?e[n]=r:e[n]=K(Object(e[n]),r))}function K(e,t){return Object.keys(t).forEach(n=>{Fe(e,t,n)}),e}var Ne={name:"姓名",tel:"电话",save:"保存",clear:"清空",cancel:"取消",confirm:"确认",delete:"删除",loading:"加载中...",noCoupon:"暂无优惠券",nameEmpty:"请填写姓名",addContact:"添加联系人",telInvalid:"请填写正确的电话",vanCalendar:{end:"结束",start:"开始",title:"日期选择",weekdays:["日","一","二","三","四","五","六"],monthTitle:(e,t)=>`${e}年${t}月`,rangePrompt:e=>`最多选择 ${e} 天`},vanCascader:{select:"请选择"},vanPagination:{prev:"上一页",next:"下一页"},vanPullRefresh:{pulling:"下拉即可刷新...",loosing:"释放即可刷新..."},vanSubmitBar:{label:"合计:"},vanCoupon:{unlimited:"无门槛",discount:e=>`${e}折`,condition:e=>`满${e}元可用`},vanCouponCell:{title:"优惠券",count:e=>`${e}张可用`},vanCouponList:{exchange:"兑换",close:"不使用",enable:"可用",disabled:"不可用",placeholder:"输入优惠码"},vanAddressEdit:{area:"地区",areaEmpty:"请选择地区",addressEmpty:"请填写详细地址",addressDetail:"详细地址",defaultAddress:"设为默认收货地址"},vanAddressList:{add:"新增地址"}};const I=g("zh-CN"),R=B({"zh-CN":Ne}),Oe={messages(){return R[I.value]},use(e,t){I.value=e,this.add({[e]:t})},add(e={}){K(R,e)}};var Te=Oe;function $e(e){const t=Z(e)+".";return(n,...r)=>{const u=Te.messages(),s=O(u,t+n)||O(u,n);return x(s)?s(...r):s}}function D(e,t){return t?typeof t=="string"?` ${e}--${t}`:Array.isArray(t)?t.reduce((n,r)=>n+D(e,r),""):Object.keys(t).reduce((n,r)=>n+(t[r]?D(e,r):""),""):""}function ke(e){return(t,n)=>(t&&typeof t!="string"&&(n=t,t=""),t=t?`${e}__${t}`:e,`${t}${D(t,n)}`)}function N(e){const t=`van-${e}`;return[t,ke(t),$e(t)]}function q(e){return e.install=t=>{const{name:n}=e;n&&(t.component(n,e),t.component(Z(`-${n}`),e))},e}const[_e,L]=N("badge"),Ie={dot:Boolean,max:E,tag:A("div"),color:String,offset:Array,content:E,showZero:ue,position:A("top-right")};var Re=W({name:_e,props:Ie,setup(e,{slots:t}){const n=()=>{if(t.content)return!0;const{content:o,showZero:i}=e;return m(o)&&o!==""&&(i||o!==0&&o!=="0")},r=()=>{const{dot:o,max:i,content:a}=e;if(!o&&n())return t.content?t.content():m(i)&&J(a)&&+a>+i?`${i}+`:a},u=o=>o.startsWith("-")?o.replace("-",""):`-${o}`,s=P(()=>{const o={background:e.color};if(e.offset){const[i,a]=e.offset,{position:p}=e,[l,d]=p.split("-");t.default?(typeof a=="number"?o[l]=f(l==="top"?a:-a):o[l]=l==="top"?f(a):u(a),typeof i=="number"?o[d]=f(d==="left"?i:-i):o[d]=d==="left"?f(i):u(i)):(o.marginTop=f(a),o.marginLeft=f(i))}return o}),c=()=>{if(n()||e.dot)return w("div",{class:L([e.position,{dot:e.dot,fixed:!!t.default}]),style:s.value},[r()])};return()=>{if(t.default){const{tag:o}=e;return w(o,{class:L("wrapper")},{default:()=>[t.default(),c()]})}return c()}}});const Le=q(Re),[Me,Ct]=N("config-provider"),ze=Symbol(Me),[je,M]=N("icon"),Ve=e=>e==null?void 0:e.includes("/"),Ye={dot:Boolean,tag:A("i"),name:String,size:E,badge:E,color:String,badgeProps:Object,classPrefix:String};var We=W({name:je,props:Ye,setup(e,{slots:t}){const n=S(ze,null),r=P(()=>e.classPrefix||(n==null?void 0:n.iconPrefix)||M());return()=>{const{tag:u,dot:s,name:c,size:o,badge:i,color:a}=e,p=Ve(c);return w(Le,re({dot:s,tag:u,class:[r.value,p?"":`${r.value}-${c}`],style:{color:a,fontSize:f(o)},content:i},e.badgeProps),{default:()=>{var l;return[(l=t.default)==null?void 0:l.call(t),p&&w("img",{class:M("image"),src:c},null)]}})}}});const bt=q(We);export{tt as A,Le as B,le as C,Et as D,Ge as E,ht as F,Ke as G,at as H,bt as I,it as J,ot as K,Ce as L,pt as M,ve as N,Ee as O,he as P,Ze as Q,me as R,Xe as S,ge as T,lt as U,nt as V,ce as W,ut as a,Qe as b,N as c,A as d,Ue as e,f,mt as g,Je as h,F as i,x as j,H as k,gt as l,rt as m,E as n,ct as o,qe as p,wt as q,m as r,dt as s,ue as t,st as u,ft as v,q as w,vt as x,yt as y,et as z};