UNPKG

502 kBJavaScriptView Raw
1import { unref, ref, reactive, inject, watch, onMounted, nextTick, createVNode, defineComponent, getCurrentInstance, computed, onActivated, onDeactivated, onBeforeUnmount, provide, watchEffect, mergeProps, Transition, Teleport, withDirectives, vShow, Fragment, onBeforeUpdate, Comment, createTextVNode, onUnmounted, createApp, resolveDirective, withKeys, onUpdated, Text, h } from "vue";
2import { useWindowSize, useRect, useChildren, useParent, onMountedOrActivated, getScrollParent, useEventListener, cancelRaf, raf, useScrollParent, usePageVisibility, doubleRaf, CUSTOM_FIELD_INJECTION_KEY, useCustomFieldValue, inBrowser as inBrowser$1, useToggle, useCountDown, useClickAway } from "@vant/use";
3import { normalizeClass, stringifyStyle, normalizeStyle } from "@vue/shared";
4import { offsetModifier, createPopper } from "@vant/popperjs";
5function noop() {
6}
7const extend = Object.assign;
8const inBrowser = typeof window !== "undefined";
9const isObject = (val) => val !== null && typeof val === "object";
10const isDef = (val) => val !== void 0 && val !== null;
11const isFunction = (val) => typeof val === "function";
12const isPromise = (val) => isObject(val) && isFunction(val.then) && isFunction(val.catch);
13const isDate = (val) => Object.prototype.toString.call(val) === "[object Date]" && !Number.isNaN(val.getTime());
14function isMobile(value) {
15 value = value.replace(/[^-|\d]/g, "");
16 return /^((\+86)|(86))?(1)\d{10}$/.test(value) || /^0[0-9-]{10,13}$/.test(value);
17}
18const isNumeric = (val) => typeof val === "number" || /^\d+(\.\d+)?$/.test(val);
19const isIOS$1 = () => inBrowser ? /ios|iphone|ipad|ipod/.test(navigator.userAgent.toLowerCase()) : false;
20function get(object, path) {
21 const keys = path.split(".");
22 let result = object;
23 keys.forEach((key) => {
24 var _a;
25 result = isObject(result) ? (_a = result[key]) != null ? _a : "" : "";
26 });
27 return result;
28}
29function pick(obj, keys, ignoreUndefined) {
30 return keys.reduce(
31 (ret, key) => {
32 if (!ignoreUndefined || obj[key] !== void 0) {
33 ret[key] = obj[key];
34 }
35 return ret;
36 },
37 {}
38 );
39}
40const isSameValue = (newValue, oldValue) => JSON.stringify(newValue) === JSON.stringify(oldValue);
41const toArray = (item) => Array.isArray(item) ? item : [item];
42const flat = (arr) => arr.reduce((acc, val) => acc.concat(val), []);
43const unknownProp = null;
44const numericProp = [Number, String];
45const truthProp = {
46 type: Boolean,
47 default: true
48};
49const makeRequiredProp = (type) => ({
50 type,
51 required: true
52});
53const makeArrayProp = () => ({
54 type: Array,
55 default: () => []
56});
57const makeNumberProp = (defaultVal) => ({
58 type: Number,
59 default: defaultVal
60});
61const makeNumericProp = (defaultVal) => ({
62 type: numericProp,
63 default: defaultVal
64});
65const makeStringProp = (defaultVal) => ({
66 type: String,
67 default: defaultVal
68});
69function getScrollTop(el) {
70 const top = "scrollTop" in el ? el.scrollTop : el.pageYOffset;
71 return Math.max(top, 0);
72}
73function setScrollTop(el, value) {
74 if ("scrollTop" in el) {
75 el.scrollTop = value;
76 } else {
77 el.scrollTo(el.scrollX, value);
78 }
79}
80function getRootScrollTop() {
81 return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
82}
83function setRootScrollTop(value) {
84 setScrollTop(window, value);
85 setScrollTop(document.body, value);
86}
87function getElementTop(el, scroller) {
88 if (el === window) {
89 return 0;
90 }
91 const scrollTop = scroller ? getScrollTop(scroller) : getRootScrollTop();
92 return useRect(el).top + scrollTop;
93}
94const isIOS = isIOS$1();
95function resetScroll() {
96 if (isIOS) {
97 setRootScrollTop(getRootScrollTop());
98 }
99}
100const stopPropagation = (event) => event.stopPropagation();
101function preventDefault(event, isStopPropagation) {
102 if (typeof event.cancelable !== "boolean" || event.cancelable) {
103 event.preventDefault();
104 }
105 if (isStopPropagation) {
106 stopPropagation(event);
107 }
108}
109function isHidden(elementRef) {
110 const el = unref(elementRef);
111 if (!el) {
112 return false;
113 }
114 const style = window.getComputedStyle(el);
115 const hidden = style.display === "none";
116 const parentHidden = el.offsetParent === null && style.position !== "fixed";
117 return hidden || parentHidden;
118}
119const { width: windowWidth, height: windowHeight } = useWindowSize();
120function isContainingBlock(el) {
121 const css = window.getComputedStyle(el);
122 return css.transform !== "none" || css.perspective !== "none" || ["transform", "perspective", "filter"].some(
123 (value) => (css.willChange || "").includes(value)
124 );
125}
126function getContainingBlock(el) {
127 let node = el.parentElement;
128 while (node) {
129 if (node && node.tagName !== "HTML" && node.tagName !== "BODY" && isContainingBlock(node)) {
130 return node;
131 }
132 node = node.parentElement;
133 }
134 return null;
135}
136function addUnit(value) {
137 if (isDef(value)) {
138 return isNumeric(value) ? `${value}px` : String(value);
139 }
140 return void 0;
141}
142function getSizeStyle(originSize) {
143 if (isDef(originSize)) {
144 if (Array.isArray(originSize)) {
145 return {
146 width: addUnit(originSize[0]),
147 height: addUnit(originSize[1])
148 };
149 }
150 const size = addUnit(originSize);
151 return {
152 width: size,
153 height: size
154 };
155 }
156}
157function getZIndexStyle(zIndex) {
158 const style = {};
159 if (zIndex !== void 0) {
160 style.zIndex = +zIndex;
161 }
162 return style;
163}
164let rootFontSize;
165function getRootFontSize() {
166 if (!rootFontSize) {
167 const doc = document.documentElement;
168 const fontSize = doc.style.fontSize || window.getComputedStyle(doc).fontSize;
169 rootFontSize = parseFloat(fontSize);
170 }
171 return rootFontSize;
172}
173function convertRem(value) {
174 value = value.replace(/rem/g, "");
175 return +value * getRootFontSize();
176}
177function convertVw(value) {
178 value = value.replace(/vw/g, "");
179 return +value * windowWidth.value / 100;
180}
181function convertVh(value) {
182 value = value.replace(/vh/g, "");
183 return +value * windowHeight.value / 100;
184}
185function unitToPx(value) {
186 if (typeof value === "number") {
187 return value;
188 }
189 if (inBrowser) {
190 if (value.includes("rem")) {
191 return convertRem(value);
192 }
193 if (value.includes("vw")) {
194 return convertVw(value);
195 }
196 if (value.includes("vh")) {
197 return convertVh(value);
198 }
199 }
200 return parseFloat(value);
201}
202const camelizeRE = /-(\w)/g;
203const camelize = (str) => str.replace(camelizeRE, (_, c) => c.toUpperCase());
204const kebabCase = (str) => str.replace(/([A-Z])/g, "-$1").toLowerCase().replace(/^-/, "");
205function padZero(num, targetLength = 2) {
206 let str = num + "";
207 while (str.length < targetLength) {
208 str = "0" + str;
209 }
210 return str;
211}
212const clamp = (num, min, max) => Math.min(Math.max(num, min), max);
213function trimExtraChar(value, char, regExp) {
214 const index = value.indexOf(char);
215 if (index === -1) {
216 return value;
217 }
218 if (char === "-" && index !== 0) {
219 return value.slice(0, index);
220 }
221 return value.slice(0, index + 1) + value.slice(index).replace(regExp, "");
222}
223function formatNumber(value, allowDot = true, allowMinus = true) {
224 if (allowDot) {
225 value = trimExtraChar(value, ".", /\./g);
226 } else {
227 value = value.split(".")[0];
228 }
229 if (allowMinus) {
230 value = trimExtraChar(value, "-", /-/g);
231 } else {
232 value = value.replace(/-/, "");
233 }
234 const regExp = allowDot ? /[^-0-9.]/g : /[^-0-9]/g;
235 return value.replace(regExp, "");
236}
237function addNumber(num1, num2) {
238 const cardinal = 10 ** 10;
239 return Math.round((num1 + num2) * cardinal) / cardinal;
240}
241const { hasOwnProperty } = Object.prototype;
242function assignKey(to, from, key) {
243 const val = from[key];
244 if (!isDef(val)) {
245 return;
246 }
247 if (!hasOwnProperty.call(to, key) || !isObject(val)) {
248 to[key] = val;
249 } else {
250 to[key] = deepAssign(Object(to[key]), val);
251 }
252}
253function deepAssign(to, from) {
254 Object.keys(from).forEach((key) => {
255 assignKey(to, from, key);
256 });
257 return to;
258}
259var stdin_default$1W = {
260 name: "姓名",
261 tel: "电话",
262 save: "保存",
263 clear: "清空",
264 cancel: "取消",
265 confirm: "确认",
266 delete: "删除",
267 loading: "加载中...",
268 noCoupon: "暂无优惠券",
269 nameEmpty: "请填写姓名",
270 addContact: "添加联系人",
271 telInvalid: "请填写正确的电话",
272 vanCalendar: {
273 end: "结束",
274 start: "开始",
275 title: "日期选择",
276 weekdays: ["日", "一", "二", "三", "四", "五", "六"],
277 monthTitle: (year, month) => `${year}${month}月`,
278 rangePrompt: (maxRange) => `最多选择 ${maxRange} 天`
279 },
280 vanCascader: {
281 select: "请选择"
282 },
283 vanPagination: {
284 prev: "上一页",
285 next: "下一页"
286 },
287 vanPullRefresh: {
288 pulling: "下拉即可刷新...",
289 loosing: "释放即可刷新..."
290 },
291 vanSubmitBar: {
292 label: "合计:"
293 },
294 vanCoupon: {
295 unlimited: "无门槛",
296 discount: (discount) => `${discount}折`,
297 condition: (condition) => `满${condition}元可用`
298 },
299 vanCouponCell: {
300 title: "优惠券",
301 count: (count) => `${count}张可用`
302 },
303 vanCouponList: {
304 exchange: "兑换",
305 close: "不使用",
306 enable: "可用",
307 disabled: "不可用",
308 placeholder: "输入优惠码"
309 },
310 vanAddressEdit: {
311 area: "地区",
312 areaEmpty: "请选择地区",
313 addressEmpty: "请填写详细地址",
314 addressDetail: "详细地址",
315 defaultAddress: "设为默认收货地址"
316 },
317 vanAddressList: {
318 add: "新增地址"
319 }
320};
321const lang = ref("zh-CN");
322const messages = reactive({
323 "zh-CN": stdin_default$1W
324});
325const Locale = {
326 messages() {
327 return messages[lang.value];
328 },
329 use(newLang, newMessages) {
330 lang.value = newLang;
331 this.add({ [newLang]: newMessages });
332 },
333 add(newMessages = {}) {
334 deepAssign(messages, newMessages);
335 }
336};
337const useCurrentLang = () => lang;
338var stdin_default$1V = Locale;
339function createTranslate(name2) {
340 const prefix = camelize(name2) + ".";
341 return (path, ...args) => {
342 const messages2 = stdin_default$1V.messages();
343 const message = get(messages2, prefix + path) || get(messages2, path);
344 return isFunction(message) ? message(...args) : message;
345 };
346}
347function genBem(name2, mods) {
348 if (!mods) {
349 return "";
350 }
351 if (typeof mods === "string") {
352 return ` ${name2}--${mods}`;
353 }
354 if (Array.isArray(mods)) {
355 return mods.reduce(
356 (ret, item) => ret + genBem(name2, item),
357 ""
358 );
359 }
360 return Object.keys(mods).reduce(
361 (ret, key) => ret + (mods[key] ? genBem(name2, key) : ""),
362 ""
363 );
364}
365function createBEM(name2) {
366 return (el, mods) => {
367 if (el && typeof el !== "string") {
368 mods = el;
369 el = "";
370 }
371 el = el ? `${name2}__${el}` : name2;
372 return `${el}${genBem(el, mods)}`;
373 };
374}
375function createNamespace(name2) {
376 const prefixedName = `van-${name2}`;
377 return [
378 prefixedName,
379 createBEM(prefixedName),
380 createTranslate(prefixedName)
381 ];
382}
383const BORDER = "van-hairline";
384const BORDER_TOP = `${BORDER}--top`;
385const BORDER_LEFT = `${BORDER}--left`;
386const BORDER_RIGHT = `${BORDER}--right`;
387const BORDER_BOTTOM = `${BORDER}--bottom`;
388const BORDER_SURROUND = `${BORDER}--surround`;
389const BORDER_TOP_BOTTOM = `${BORDER}--top-bottom`;
390const BORDER_UNSET_TOP_BOTTOM = `${BORDER}-unset--top-bottom`;
391const HAPTICS_FEEDBACK = "van-haptics-feedback";
392const FORM_KEY = Symbol("van-form");
393const LONG_PRESS_START_TIME = 500;
394const TAP_OFFSET = 5;
395function callInterceptor(interceptor, {
396 args = [],
397 done,
398 canceled,
399 error
400}) {
401 if (interceptor) {
402 const returnVal = interceptor.apply(null, args);
403 if (isPromise(returnVal)) {
404 returnVal.then((value) => {
405 if (value) {
406 done();
407 } else if (canceled) {
408 canceled();
409 }
410 }).catch(error || noop);
411 } else if (returnVal) {
412 done();
413 } else if (canceled) {
414 canceled();
415 }
416 } else {
417 done();
418 }
419}
420function withInstall(options) {
421 options.install = (app) => {
422 const { name: name2 } = options;
423 if (name2) {
424 app.component(name2, options);
425 app.component(camelize(`-${name2}`), options);
426 }
427 };
428 return options;
429}
430function closest(arr, target) {
431 return arr.reduce(
432 (pre, cur) => Math.abs(pre - target) < Math.abs(cur - target) ? pre : cur
433 );
434}
435const POPUP_TOGGLE_KEY = Symbol();
436function onPopupReopen(callback) {
437 const popupToggleStatus = inject(POPUP_TOGGLE_KEY, null);
438 if (popupToggleStatus) {
439 watch(popupToggleStatus, (show) => {
440 if (show) {
441 callback();
442 }
443 });
444 }
445}
446const useHeight = (element, withSafeArea) => {
447 const height = ref();
448 const setHeight = () => {
449 height.value = useRect(element).height;
450 };
451 onMounted(() => {
452 nextTick(setHeight);
453 if (withSafeArea) {
454 for (let i = 1; i <= 3; i++) {
455 setTimeout(setHeight, 100 * i);
456 }
457 }
458 });
459 onPopupReopen(() => nextTick(setHeight));
460 watch([windowWidth, windowHeight], setHeight);
461 return height;
462};
463function usePlaceholder(contentRef, bem2) {
464 const height = useHeight(contentRef, true);
465 return (renderContent) => createVNode("div", {
466 "class": bem2("placeholder"),
467 "style": {
468 height: height.value ? `${height.value}px` : void 0
469 }
470 }, [renderContent()]);
471}
472const [name$1K, bem$1F] = createNamespace("action-bar");
473const ACTION_BAR_KEY = Symbol(name$1K);
474const actionBarProps = {
475 placeholder: Boolean,
476 safeAreaInsetBottom: truthProp
477};
478var stdin_default$1U = defineComponent({
479 name: name$1K,
480 props: actionBarProps,
481 setup(props2, {
482 slots
483 }) {
484 const root = ref();
485 const renderPlaceholder = usePlaceholder(root, bem$1F);
486 const {
487 linkChildren
488 } = useChildren(ACTION_BAR_KEY);
489 linkChildren();
490 const renderActionBar = () => {
491 var _a;
492 return createVNode("div", {
493 "ref": root,
494 "class": [bem$1F(), {
495 "van-safe-area-bottom": props2.safeAreaInsetBottom
496 }]
497 }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
498 };
499 return () => {
500 if (props2.placeholder) {
501 return renderPlaceholder(renderActionBar);
502 }
503 return renderActionBar();
504 };
505 }
506});
507const ActionBar = withInstall(stdin_default$1U);
508function useExpose(apis) {
509 const instance2 = getCurrentInstance();
510 if (instance2) {
511 extend(instance2.proxy, apis);
512 }
513}
514const routeProps = {
515 to: [String, Object],
516 url: String,
517 replace: Boolean
518};
519function route({
520 to,
521 url,
522 replace,
523 $router: router
524}) {
525 if (to && router) {
526 router[replace ? "replace" : "push"](to);
527 } else if (url) {
528 replace ? location.replace(url) : location.href = url;
529 }
530}
531function useRoute() {
532 const vm = getCurrentInstance().proxy;
533 return () => route(vm);
534}
535const [name$1J, bem$1E] = createNamespace("badge");
536const badgeProps = {
537 dot: Boolean,
538 max: numericProp,
539 tag: makeStringProp("div"),
540 color: String,
541 offset: Array,
542 content: numericProp,
543 showZero: truthProp,
544 position: makeStringProp("top-right")
545};
546var stdin_default$1T = defineComponent({
547 name: name$1J,
548 props: badgeProps,
549 setup(props2, {
550 slots
551 }) {
552 const hasContent = () => {
553 if (slots.content) {
554 return true;
555 }
556 const {
557 content,
558 showZero
559 } = props2;
560 return isDef(content) && content !== "" && (showZero || content !== 0 && content !== "0");
561 };
562 const renderContent = () => {
563 const {
564 dot,
565 max,
566 content
567 } = props2;
568 if (!dot && hasContent()) {
569 if (slots.content) {
570 return slots.content();
571 }
572 if (isDef(max) && isNumeric(content) && +content > +max) {
573 return `${max}+`;
574 }
575 return content;
576 }
577 };
578 const getOffsetWithMinusString = (val) => val.startsWith("-") ? val.replace("-", "") : `-${val}`;
579 const style = computed(() => {
580 const style2 = {
581 background: props2.color
582 };
583 if (props2.offset) {
584 const [x, y] = props2.offset;
585 const {
586 position
587 } = props2;
588 const [offsetY, offsetX] = position.split("-");
589 if (slots.default) {
590 if (typeof y === "number") {
591 style2[offsetY] = addUnit(offsetY === "top" ? y : -y);
592 } else {
593 style2[offsetY] = offsetY === "top" ? addUnit(y) : getOffsetWithMinusString(y);
594 }
595 if (typeof x === "number") {
596 style2[offsetX] = addUnit(offsetX === "left" ? x : -x);
597 } else {
598 style2[offsetX] = offsetX === "left" ? addUnit(x) : getOffsetWithMinusString(x);
599 }
600 } else {
601 style2.marginTop = addUnit(y);
602 style2.marginLeft = addUnit(x);
603 }
604 }
605 return style2;
606 });
607 const renderBadge = () => {
608 if (hasContent() || props2.dot) {
609 return createVNode("div", {
610 "class": bem$1E([props2.position, {
611 dot: props2.dot,
612 fixed: !!slots.default
613 }]),
614 "style": style.value
615 }, [renderContent()]);
616 }
617 };
618 return () => {
619 if (slots.default) {
620 const {
621 tag
622 } = props2;
623 return createVNode(tag, {
624 "class": bem$1E("wrapper")
625 }, {
626 default: () => [slots.default(), renderBadge()]
627 });
628 }
629 return renderBadge();
630 };
631 }
632});
633const Badge = withInstall(stdin_default$1T);
634let globalZIndex = 2e3;
635const useGlobalZIndex = () => ++globalZIndex;
636const setGlobalZIndex = (val) => {
637 globalZIndex = val;
638};
639const [name$1I, bem$1D] = createNamespace("config-provider");
640const CONFIG_PROVIDER_KEY = Symbol(name$1I);
641const configProviderProps = {
642 tag: makeStringProp("div"),
643 theme: makeStringProp("light"),
644 zIndex: Number,
645 themeVars: Object,
646 themeVarsDark: Object,
647 themeVarsLight: Object,
648 themeVarsScope: makeStringProp("local"),
649 iconPrefix: String
650};
651function insertDash(str) {
652 return str.replace(/([a-zA-Z])(\d)/g, "$1-$2");
653}
654function mapThemeVarsToCSSVars(themeVars) {
655 const cssVars = {};
656 Object.keys(themeVars).forEach((key) => {
657 const formattedKey = insertDash(kebabCase(key));
658 cssVars[`--van-${formattedKey}`] = themeVars[key];
659 });
660 return cssVars;
661}
662function syncThemeVarsOnRoot(newStyle = {}, oldStyle = {}) {
663 Object.keys(newStyle).forEach((key) => {
664 if (newStyle[key] !== oldStyle[key]) {
665 document.documentElement.style.setProperty(key, newStyle[key]);
666 }
667 });
668 Object.keys(oldStyle).forEach((key) => {
669 if (!newStyle[key]) {
670 document.documentElement.style.removeProperty(key);
671 }
672 });
673}
674var stdin_default$1S = defineComponent({
675 name: name$1I,
676 props: configProviderProps,
677 setup(props2, {
678 slots
679 }) {
680 const style = computed(() => mapThemeVarsToCSSVars(extend({}, props2.themeVars, props2.theme === "dark" ? props2.themeVarsDark : props2.themeVarsLight)));
681 if (inBrowser) {
682 const addTheme = () => {
683 document.documentElement.classList.add(`van-theme-${props2.theme}`);
684 };
685 const removeTheme = (theme = props2.theme) => {
686 document.documentElement.classList.remove(`van-theme-${theme}`);
687 };
688 watch(() => props2.theme, (newVal, oldVal) => {
689 if (oldVal) {
690 removeTheme(oldVal);
691 }
692 addTheme();
693 }, {
694 immediate: true
695 });
696 onActivated(addTheme);
697 onDeactivated(removeTheme);
698 onBeforeUnmount(removeTheme);
699 watch(style, (newStyle, oldStyle) => {
700 if (props2.themeVarsScope === "global") {
701 syncThemeVarsOnRoot(newStyle, oldStyle);
702 }
703 });
704 watch(() => props2.themeVarsScope, (newScope, oldScope) => {
705 if (oldScope === "global") {
706 syncThemeVarsOnRoot({}, style.value);
707 }
708 if (newScope === "global") {
709 syncThemeVarsOnRoot(style.value, {});
710 }
711 });
712 if (props2.themeVarsScope === "global") {
713 syncThemeVarsOnRoot(style.value, {});
714 }
715 }
716 provide(CONFIG_PROVIDER_KEY, props2);
717 watchEffect(() => {
718 if (props2.zIndex !== void 0) {
719 setGlobalZIndex(props2.zIndex);
720 }
721 });
722 return () => createVNode(props2.tag, {
723 "class": bem$1D(),
724 "style": props2.themeVarsScope === "local" ? style.value : void 0
725 }, {
726 default: () => {
727 var _a;
728 return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
729 }
730 });
731 }
732});
733const [name$1H, bem$1C] = createNamespace("icon");
734const isImage$1 = (name2) => name2 == null ? void 0 : name2.includes("/");
735const iconProps = {
736 dot: Boolean,
737 tag: makeStringProp("i"),
738 name: String,
739 size: numericProp,
740 badge: numericProp,
741 color: String,
742 badgeProps: Object,
743 classPrefix: String
744};
745var stdin_default$1R = defineComponent({
746 name: name$1H,
747 props: iconProps,
748 setup(props2, {
749 slots
750 }) {
751 const config = inject(CONFIG_PROVIDER_KEY, null);
752 const classPrefix = computed(() => props2.classPrefix || (config == null ? void 0 : config.iconPrefix) || bem$1C());
753 return () => {
754 const {
755 tag,
756 dot,
757 name: name2,
758 size,
759 badge,
760 color
761 } = props2;
762 const isImageIcon = isImage$1(name2);
763 return createVNode(Badge, mergeProps({
764 "dot": dot,
765 "tag": tag,
766 "class": [classPrefix.value, isImageIcon ? "" : `${classPrefix.value}-${name2}`],
767 "style": {
768 color,
769 fontSize: addUnit(size)
770 },
771 "content": badge
772 }, props2.badgeProps), {
773 default: () => {
774 var _a;
775 return [(_a = slots.default) == null ? void 0 : _a.call(slots), isImageIcon && createVNode("img", {
776 "class": bem$1C("image"),
777 "src": name2
778 }, null)];
779 }
780 });
781 };
782 }
783});
784const Icon = withInstall(stdin_default$1R);
785var stdin_default$1Q = Icon;
786const [name$1G, bem$1B] = createNamespace("loading");
787const SpinIcon = Array(12).fill(null).map((_, index) => createVNode("i", {
788 "class": bem$1B("line", String(index + 1))
789}, null));
790const CircularIcon = createVNode("svg", {
791 "class": bem$1B("circular"),
792 "viewBox": "25 25 50 50"
793}, [createVNode("circle", {
794 "cx": "50",
795 "cy": "50",
796 "r": "20",
797 "fill": "none"
798}, null)]);
799const loadingProps = {
800 size: numericProp,
801 type: makeStringProp("circular"),
802 color: String,
803 vertical: Boolean,
804 textSize: numericProp,
805 textColor: String
806};
807var stdin_default$1P = defineComponent({
808 name: name$1G,
809 props: loadingProps,
810 setup(props2, {
811 slots
812 }) {
813 const spinnerStyle = computed(() => extend({
814 color: props2.color
815 }, getSizeStyle(props2.size)));
816 const renderIcon = () => {
817 const DefaultIcon = props2.type === "spinner" ? SpinIcon : CircularIcon;
818 return createVNode("span", {
819 "class": bem$1B("spinner", props2.type),
820 "style": spinnerStyle.value
821 }, [slots.icon ? slots.icon() : DefaultIcon]);
822 };
823 const renderText = () => {
824 var _a;
825 if (slots.default) {
826 return createVNode("span", {
827 "class": bem$1B("text"),
828 "style": {
829 fontSize: addUnit(props2.textSize),
830 color: (_a = props2.textColor) != null ? _a : props2.color
831 }
832 }, [slots.default()]);
833 }
834 };
835 return () => {
836 const {
837 type,
838 vertical
839 } = props2;
840 return createVNode("div", {
841 "class": bem$1B([type, {
842 vertical
843 }]),
844 "aria-live": "polite",
845 "aria-busy": true
846 }, [renderIcon(), renderText()]);
847 };
848 }
849});
850const Loading = withInstall(stdin_default$1P);
851const [name$1F, bem$1A] = createNamespace("button");
852const buttonProps = extend({}, routeProps, {
853 tag: makeStringProp("button"),
854 text: String,
855 icon: String,
856 type: makeStringProp("default"),
857 size: makeStringProp("normal"),
858 color: String,
859 block: Boolean,
860 plain: Boolean,
861 round: Boolean,
862 square: Boolean,
863 loading: Boolean,
864 hairline: Boolean,
865 disabled: Boolean,
866 iconPrefix: String,
867 nativeType: makeStringProp("button"),
868 loadingSize: numericProp,
869 loadingText: String,
870 loadingType: String,
871 iconPosition: makeStringProp("left")
872});
873var stdin_default$1O = defineComponent({
874 name: name$1F,
875 props: buttonProps,
876 emits: ["click"],
877 setup(props2, {
878 emit,
879 slots
880 }) {
881 const route2 = useRoute();
882 const renderLoadingIcon = () => {
883 if (slots.loading) {
884 return slots.loading();
885 }
886 return createVNode(Loading, {
887 "size": props2.loadingSize,
888 "type": props2.loadingType,
889 "class": bem$1A("loading")
890 }, null);
891 };
892 const renderIcon = () => {
893 if (props2.loading) {
894 return renderLoadingIcon();
895 }
896 if (slots.icon) {
897 return createVNode("div", {
898 "class": bem$1A("icon")
899 }, [slots.icon()]);
900 }
901 if (props2.icon) {
902 return createVNode(Icon, {
903 "name": props2.icon,
904 "class": bem$1A("icon"),
905 "classPrefix": props2.iconPrefix
906 }, null);
907 }
908 };
909 const renderText = () => {
910 let text;
911 if (props2.loading) {
912 text = props2.loadingText;
913 } else {
914 text = slots.default ? slots.default() : props2.text;
915 }
916 if (text) {
917 return createVNode("span", {
918 "class": bem$1A("text")
919 }, [text]);
920 }
921 };
922 const getStyle = () => {
923 const {
924 color,
925 plain
926 } = props2;
927 if (color) {
928 const style = {
929 color: plain ? color : "white"
930 };
931 if (!plain) {
932 style.background = color;
933 }
934 if (color.includes("gradient")) {
935 style.border = 0;
936 } else {
937 style.borderColor = color;
938 }
939 return style;
940 }
941 };
942 const onClick = (event) => {
943 if (props2.loading) {
944 preventDefault(event);
945 } else if (!props2.disabled) {
946 emit("click", event);
947 route2();
948 }
949 };
950 return () => {
951 const {
952 tag,
953 type,
954 size,
955 block,
956 round,
957 plain,
958 square,
959 loading,
960 disabled,
961 hairline,
962 nativeType,
963 iconPosition
964 } = props2;
965 const classes = [bem$1A([type, size, {
966 plain,
967 block,
968 round,
969 square,
970 loading,
971 disabled,
972 hairline
973 }]), {
974 [BORDER_SURROUND]: hairline
975 }];
976 return createVNode(tag, {
977 "type": nativeType,
978 "class": classes,
979 "style": getStyle(),
980 "disabled": disabled,
981 "onClick": onClick
982 }, {
983 default: () => [createVNode("div", {
984 "class": bem$1A("content")
985 }, [iconPosition === "left" && renderIcon(), renderText(), iconPosition === "right" && renderIcon()])]
986 });
987 };
988 }
989});
990const Button = withInstall(stdin_default$1O);
991const [name$1E, bem$1z] = createNamespace("action-bar-button");
992const actionBarButtonProps = extend({}, routeProps, {
993 type: String,
994 text: String,
995 icon: String,
996 color: String,
997 loading: Boolean,
998 disabled: Boolean
999});
1000var stdin_default$1N = defineComponent({
1001 name: name$1E,
1002 props: actionBarButtonProps,
1003 setup(props2, {
1004 slots
1005 }) {
1006 const route2 = useRoute();
1007 const {
1008 parent,
1009 index
1010 } = useParent(ACTION_BAR_KEY);
1011 const isFirst = computed(() => {
1012 if (parent) {
1013 const prev = parent.children[index.value - 1];
1014 return !(prev && "isButton" in prev);
1015 }
1016 });
1017 const isLast = computed(() => {
1018 if (parent) {
1019 const next = parent.children[index.value + 1];
1020 return !(next && "isButton" in next);
1021 }
1022 });
1023 useExpose({
1024 isButton: true
1025 });
1026 return () => {
1027 const {
1028 type,
1029 icon,
1030 text,
1031 color,
1032 loading,
1033 disabled
1034 } = props2;
1035 return createVNode(Button, {
1036 "class": bem$1z([type, {
1037 last: isLast.value,
1038 first: isFirst.value
1039 }]),
1040 "size": "large",
1041 "type": type,
1042 "icon": icon,
1043 "color": color,
1044 "loading": loading,
1045 "disabled": disabled,
1046 "onClick": route2
1047 }, {
1048 default: () => [slots.default ? slots.default() : text]
1049 });
1050 };
1051 }
1052});
1053const ActionBarButton = withInstall(stdin_default$1N);
1054const [name$1D, bem$1y] = createNamespace("action-bar-icon");
1055const actionBarIconProps = extend({}, routeProps, {
1056 dot: Boolean,
1057 text: String,
1058 icon: String,
1059 color: String,
1060 badge: numericProp,
1061 iconClass: unknownProp,
1062 badgeProps: Object,
1063 iconPrefix: String
1064});
1065var stdin_default$1M = defineComponent({
1066 name: name$1D,
1067 props: actionBarIconProps,
1068 setup(props2, {
1069 slots
1070 }) {
1071 const route2 = useRoute();
1072 useParent(ACTION_BAR_KEY);
1073 const renderIcon = () => {
1074 const {
1075 dot,
1076 badge,
1077 icon,
1078 color,
1079 iconClass,
1080 badgeProps: badgeProps2,
1081 iconPrefix
1082 } = props2;
1083 if (slots.icon) {
1084 return createVNode(Badge, mergeProps({
1085 "dot": dot,
1086 "class": bem$1y("icon"),
1087 "content": badge
1088 }, badgeProps2), {
1089 default: slots.icon
1090 });
1091 }
1092 return createVNode(Icon, {
1093 "tag": "div",
1094 "dot": dot,
1095 "name": icon,
1096 "badge": badge,
1097 "color": color,
1098 "class": [bem$1y("icon"), iconClass],
1099 "badgeProps": badgeProps2,
1100 "classPrefix": iconPrefix
1101 }, null);
1102 };
1103 return () => createVNode("div", {
1104 "role": "button",
1105 "class": bem$1y(),
1106 "tabindex": 0,
1107 "onClick": route2
1108 }, [renderIcon(), slots.default ? slots.default() : props2.text]);
1109 }
1110});
1111const ActionBarIcon = withInstall(stdin_default$1M);
1112const popupSharedProps = {
1113 // whether to show popup
1114 show: Boolean,
1115 // z-index
1116 zIndex: numericProp,
1117 // whether to show overlay
1118 overlay: truthProp,
1119 // transition duration
1120 duration: numericProp,
1121 // teleport
1122 teleport: [String, Object],
1123 // prevent body scroll
1124 lockScroll: truthProp,
1125 // whether to lazy render
1126 lazyRender: truthProp,
1127 // callback function before close
1128 beforeClose: Function,
1129 // overlay custom style
1130 overlayStyle: Object,
1131 // overlay custom class name
1132 overlayClass: unknownProp,
1133 // Initial rendering animation
1134 transitionAppear: Boolean,
1135 // whether to close popup when overlay is clicked
1136 closeOnClickOverlay: truthProp
1137};
1138const popupSharedPropKeys = Object.keys(
1139 popupSharedProps
1140);
1141function getDirection(x, y) {
1142 if (x > y) {
1143 return "horizontal";
1144 }
1145 if (y > x) {
1146 return "vertical";
1147 }
1148 return "";
1149}
1150function useTouch() {
1151 const startX = ref(0);
1152 const startY = ref(0);
1153 const deltaX = ref(0);
1154 const deltaY = ref(0);
1155 const offsetX = ref(0);
1156 const offsetY = ref(0);
1157 const direction = ref("");
1158 const isTap = ref(true);
1159 const isVertical = () => direction.value === "vertical";
1160 const isHorizontal = () => direction.value === "horizontal";
1161 const reset = () => {
1162 deltaX.value = 0;
1163 deltaY.value = 0;
1164 offsetX.value = 0;
1165 offsetY.value = 0;
1166 direction.value = "";
1167 isTap.value = true;
1168 };
1169 const start = (event) => {
1170 reset();
1171 startX.value = event.touches[0].clientX;
1172 startY.value = event.touches[0].clientY;
1173 };
1174 const move = (event) => {
1175 const touch = event.touches[0];
1176 deltaX.value = (touch.clientX < 0 ? 0 : touch.clientX) - startX.value;
1177 deltaY.value = touch.clientY - startY.value;
1178 offsetX.value = Math.abs(deltaX.value);
1179 offsetY.value = Math.abs(deltaY.value);
1180 const LOCK_DIRECTION_DISTANCE = 10;
1181 if (!direction.value || offsetX.value < LOCK_DIRECTION_DISTANCE && offsetY.value < LOCK_DIRECTION_DISTANCE) {
1182 direction.value = getDirection(offsetX.value, offsetY.value);
1183 }
1184 if (isTap.value && (offsetX.value > TAP_OFFSET || offsetY.value > TAP_OFFSET)) {
1185 isTap.value = false;
1186 }
1187 };
1188 return {
1189 move,
1190 start,
1191 reset,
1192 startX,
1193 startY,
1194 deltaX,
1195 deltaY,
1196 offsetX,
1197 offsetY,
1198 direction,
1199 isVertical,
1200 isHorizontal,
1201 isTap
1202 };
1203}
1204let totalLockCount = 0;
1205const BODY_LOCK_CLASS = "van-overflow-hidden";
1206function useLockScroll(rootRef, shouldLock) {
1207 const touch = useTouch();
1208 const DIRECTION_UP = "01";
1209 const DIRECTION_DOWN = "10";
1210 const onTouchMove = (event) => {
1211 touch.move(event);
1212 const direction = touch.deltaY.value > 0 ? DIRECTION_DOWN : DIRECTION_UP;
1213 const el = getScrollParent(
1214 event.target,
1215 rootRef.value
1216 );
1217 const { scrollHeight, offsetHeight, scrollTop } = el;
1218 let status = "11";
1219 if (scrollTop === 0) {
1220 status = offsetHeight >= scrollHeight ? "00" : "01";
1221 } else if (scrollTop + offsetHeight >= scrollHeight) {
1222 status = "10";
1223 }
1224 if (status !== "11" && touch.isVertical() && !(parseInt(status, 2) & parseInt(direction, 2))) {
1225 preventDefault(event, true);
1226 }
1227 };
1228 const lock = () => {
1229 document.addEventListener("touchstart", touch.start);
1230 document.addEventListener("touchmove", onTouchMove, { passive: false });
1231 if (!totalLockCount) {
1232 document.body.classList.add(BODY_LOCK_CLASS);
1233 }
1234 totalLockCount++;
1235 };
1236 const unlock = () => {
1237 if (totalLockCount) {
1238 document.removeEventListener("touchstart", touch.start);
1239 document.removeEventListener("touchmove", onTouchMove);
1240 totalLockCount--;
1241 if (!totalLockCount) {
1242 document.body.classList.remove(BODY_LOCK_CLASS);
1243 }
1244 }
1245 };
1246 const init = () => shouldLock() && lock();
1247 const destroy = () => shouldLock() && unlock();
1248 onMountedOrActivated(init);
1249 onDeactivated(destroy);
1250 onBeforeUnmount(destroy);
1251 watch(shouldLock, (value) => {
1252 value ? lock() : unlock();
1253 });
1254}
1255function useLazyRender(show) {
1256 const inited = ref(false);
1257 watch(
1258 show,
1259 (value) => {
1260 if (value) {
1261 inited.value = value;
1262 }
1263 },
1264 { immediate: true }
1265 );
1266 return (render) => () => inited.value ? render() : null;
1267}
1268const useScopeId = () => {
1269 var _a;
1270 const { scopeId } = ((_a = getCurrentInstance()) == null ? void 0 : _a.vnode) || {};
1271 return scopeId ? { [scopeId]: "" } : null;
1272};
1273const [name$1C, bem$1x] = createNamespace("overlay");
1274const overlayProps = {
1275 show: Boolean,
1276 zIndex: numericProp,
1277 duration: numericProp,
1278 className: unknownProp,
1279 lockScroll: truthProp,
1280 lazyRender: truthProp,
1281 customStyle: Object,
1282 teleport: [String, Object]
1283};
1284var stdin_default$1L = defineComponent({
1285 name: name$1C,
1286 props: overlayProps,
1287 setup(props2, {
1288 slots
1289 }) {
1290 const root = ref();
1291 const lazyRender = useLazyRender(() => props2.show || !props2.lazyRender);
1292 const onTouchMove = (event) => {
1293 if (props2.lockScroll) {
1294 preventDefault(event, true);
1295 }
1296 };
1297 const renderOverlay = lazyRender(() => {
1298 var _a;
1299 const style = extend(getZIndexStyle(props2.zIndex), props2.customStyle);
1300 if (isDef(props2.duration)) {
1301 style.animationDuration = `${props2.duration}s`;
1302 }
1303 return withDirectives(createVNode("div", {
1304 "ref": root,
1305 "style": style,
1306 "class": [bem$1x(), props2.className]
1307 }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]), [[vShow, props2.show]]);
1308 });
1309 useEventListener("touchmove", onTouchMove, {
1310 target: root
1311 });
1312 return () => {
1313 const Content = createVNode(Transition, {
1314 "name": "van-fade",
1315 "appear": true
1316 }, {
1317 default: renderOverlay
1318 });
1319 if (props2.teleport) {
1320 return createVNode(Teleport, {
1321 "to": props2.teleport
1322 }, {
1323 default: () => [Content]
1324 });
1325 }
1326 return Content;
1327 };
1328 }
1329});
1330const Overlay = withInstall(stdin_default$1L);
1331const popupProps$2 = extend({}, popupSharedProps, {
1332 round: Boolean,
1333 position: makeStringProp("center"),
1334 closeIcon: makeStringProp("cross"),
1335 closeable: Boolean,
1336 transition: String,
1337 iconPrefix: String,
1338 closeOnPopstate: Boolean,
1339 closeIconPosition: makeStringProp("top-right"),
1340 safeAreaInsetTop: Boolean,
1341 safeAreaInsetBottom: Boolean
1342});
1343const [name$1B, bem$1w] = createNamespace("popup");
1344var stdin_default$1K = defineComponent({
1345 name: name$1B,
1346 inheritAttrs: false,
1347 props: popupProps$2,
1348 emits: ["open", "close", "opened", "closed", "keydown", "update:show", "clickOverlay", "clickCloseIcon"],
1349 setup(props2, {
1350 emit,
1351 attrs,
1352 slots
1353 }) {
1354 let opened;
1355 let shouldReopen;
1356 const zIndex = ref();
1357 const popupRef = ref();
1358 const lazyRender = useLazyRender(() => props2.show || !props2.lazyRender);
1359 const style = computed(() => {
1360 const style2 = {
1361 zIndex: zIndex.value
1362 };
1363 if (isDef(props2.duration)) {
1364 const key = props2.position === "center" ? "animationDuration" : "transitionDuration";
1365 style2[key] = `${props2.duration}s`;
1366 }
1367 return style2;
1368 });
1369 const open = () => {
1370 if (!opened) {
1371 opened = true;
1372 zIndex.value = props2.zIndex !== void 0 ? +props2.zIndex : useGlobalZIndex();
1373 emit("open");
1374 }
1375 };
1376 const close = () => {
1377 if (opened) {
1378 callInterceptor(props2.beforeClose, {
1379 done() {
1380 opened = false;
1381 emit("close");
1382 emit("update:show", false);
1383 }
1384 });
1385 }
1386 };
1387 const onClickOverlay = (event) => {
1388 emit("clickOverlay", event);
1389 if (props2.closeOnClickOverlay) {
1390 close();
1391 }
1392 };
1393 const renderOverlay = () => {
1394 if (props2.overlay) {
1395 return createVNode(Overlay, mergeProps({
1396 "show": props2.show,
1397 "class": props2.overlayClass,
1398 "zIndex": zIndex.value,
1399 "duration": props2.duration,
1400 "customStyle": props2.overlayStyle,
1401 "role": props2.closeOnClickOverlay ? "button" : void 0,
1402 "tabindex": props2.closeOnClickOverlay ? 0 : void 0
1403 }, useScopeId(), {
1404 "onClick": onClickOverlay
1405 }), {
1406 default: slots["overlay-content"]
1407 });
1408 }
1409 };
1410 const onClickCloseIcon = (event) => {
1411 emit("clickCloseIcon", event);
1412 close();
1413 };
1414 const renderCloseIcon = () => {
1415 if (props2.closeable) {
1416 return createVNode(Icon, {
1417 "role": "button",
1418 "tabindex": 0,
1419 "name": props2.closeIcon,
1420 "class": [bem$1w("close-icon", props2.closeIconPosition), HAPTICS_FEEDBACK],
1421 "classPrefix": props2.iconPrefix,
1422 "onClick": onClickCloseIcon
1423 }, null);
1424 }
1425 };
1426 let timer2;
1427 const onOpened = () => {
1428 if (timer2) clearTimeout(timer2);
1429 timer2 = setTimeout(() => {
1430 emit("opened");
1431 });
1432 };
1433 const onClosed = () => emit("closed");
1434 const onKeydown = (event) => emit("keydown", event);
1435 const renderPopup = lazyRender(() => {
1436 var _a;
1437 const {
1438 round,
1439 position,
1440 safeAreaInsetTop,
1441 safeAreaInsetBottom
1442 } = props2;
1443 return withDirectives(createVNode("div", mergeProps({
1444 "ref": popupRef,
1445 "style": style.value,
1446 "role": "dialog",
1447 "tabindex": 0,
1448 "class": [bem$1w({
1449 round,
1450 [position]: position
1451 }), {
1452 "van-safe-area-top": safeAreaInsetTop,
1453 "van-safe-area-bottom": safeAreaInsetBottom
1454 }],
1455 "onKeydown": onKeydown
1456 }, attrs, useScopeId()), [(_a = slots.default) == null ? void 0 : _a.call(slots), renderCloseIcon()]), [[vShow, props2.show]]);
1457 });
1458 const renderTransition = () => {
1459 const {
1460 position,
1461 transition,
1462 transitionAppear
1463 } = props2;
1464 const name2 = position === "center" ? "van-fade" : `van-popup-slide-${position}`;
1465 return createVNode(Transition, {
1466 "name": transition || name2,
1467 "appear": transitionAppear,
1468 "onAfterEnter": onOpened,
1469 "onAfterLeave": onClosed
1470 }, {
1471 default: renderPopup
1472 });
1473 };
1474 watch(() => props2.show, (show) => {
1475 if (show && !opened) {
1476 open();
1477 if (attrs.tabindex === 0) {
1478 nextTick(() => {
1479 var _a;
1480 (_a = popupRef.value) == null ? void 0 : _a.focus();
1481 });
1482 }
1483 }
1484 if (!show && opened) {
1485 opened = false;
1486 emit("close");
1487 }
1488 });
1489 useExpose({
1490 popupRef
1491 });
1492 useLockScroll(popupRef, () => props2.show && props2.lockScroll);
1493 useEventListener("popstate", () => {
1494 if (props2.closeOnPopstate) {
1495 close();
1496 shouldReopen = false;
1497 }
1498 });
1499 onMounted(() => {
1500 if (props2.show) {
1501 open();
1502 }
1503 });
1504 onActivated(() => {
1505 if (shouldReopen) {
1506 emit("update:show", true);
1507 shouldReopen = false;
1508 }
1509 });
1510 onDeactivated(() => {
1511 if (props2.show && props2.teleport) {
1512 close();
1513 shouldReopen = true;
1514 }
1515 });
1516 provide(POPUP_TOGGLE_KEY, () => props2.show);
1517 return () => {
1518 if (props2.teleport) {
1519 return createVNode(Teleport, {
1520 "to": props2.teleport
1521 }, {
1522 default: () => [renderOverlay(), renderTransition()]
1523 });
1524 }
1525 return createVNode(Fragment, null, [renderOverlay(), renderTransition()]);
1526 };
1527 }
1528});
1529const Popup = withInstall(stdin_default$1K);
1530const [name$1A, bem$1v] = createNamespace("action-sheet");
1531const actionSheetProps = extend({}, popupSharedProps, {
1532 title: String,
1533 round: truthProp,
1534 actions: makeArrayProp(),
1535 closeIcon: makeStringProp("cross"),
1536 closeable: truthProp,
1537 cancelText: String,
1538 description: String,
1539 closeOnPopstate: truthProp,
1540 closeOnClickAction: Boolean,
1541 safeAreaInsetBottom: truthProp
1542});
1543const popupInheritKeys$2 = [...popupSharedPropKeys, "round", "closeOnPopstate", "safeAreaInsetBottom"];
1544var stdin_default$1J = defineComponent({
1545 name: name$1A,
1546 props: actionSheetProps,
1547 emits: ["select", "cancel", "update:show"],
1548 setup(props2, {
1549 slots,
1550 emit
1551 }) {
1552 const updateShow = (show) => emit("update:show", show);
1553 const onCancel = () => {
1554 updateShow(false);
1555 emit("cancel");
1556 };
1557 const renderHeader = () => {
1558 if (props2.title) {
1559 return createVNode("div", {
1560 "class": bem$1v("header")
1561 }, [props2.title, props2.closeable && createVNode(Icon, {
1562 "name": props2.closeIcon,
1563 "class": [bem$1v("close"), HAPTICS_FEEDBACK],
1564 "onClick": onCancel
1565 }, null)]);
1566 }
1567 };
1568 const renderCancel = () => {
1569 if (slots.cancel || props2.cancelText) {
1570 return [createVNode("div", {
1571 "class": bem$1v("gap")
1572 }, null), createVNode("button", {
1573 "type": "button",
1574 "class": bem$1v("cancel"),
1575 "onClick": onCancel
1576 }, [slots.cancel ? slots.cancel() : props2.cancelText])];
1577 }
1578 };
1579 const renderIcon = (action) => {
1580 if (action.icon) {
1581 return createVNode(Icon, {
1582 "class": bem$1v("item-icon"),
1583 "name": action.icon
1584 }, null);
1585 }
1586 };
1587 const renderActionContent = (action, index) => {
1588 if (action.loading) {
1589 return createVNode(Loading, {
1590 "class": bem$1v("loading-icon")
1591 }, null);
1592 }
1593 if (slots.action) {
1594 return slots.action({
1595 action,
1596 index
1597 });
1598 }
1599 return [createVNode("span", {
1600 "class": bem$1v("name")
1601 }, [action.name]), action.subname && createVNode("div", {
1602 "class": bem$1v("subname")
1603 }, [action.subname])];
1604 };
1605 const renderAction = (action, index) => {
1606 const {
1607 color,
1608 loading,
1609 callback,
1610 disabled,
1611 className
1612 } = action;
1613 const onClick = () => {
1614 if (disabled || loading) {
1615 return;
1616 }
1617 if (callback) {
1618 callback(action);
1619 }
1620 if (props2.closeOnClickAction) {
1621 updateShow(false);
1622 }
1623 nextTick(() => emit("select", action, index));
1624 };
1625 return createVNode("button", {
1626 "type": "button",
1627 "style": {
1628 color
1629 },
1630 "class": [bem$1v("item", {
1631 loading,
1632 disabled
1633 }), className],
1634 "onClick": onClick
1635 }, [renderIcon(action), renderActionContent(action, index)]);
1636 };
1637 const renderDescription = () => {
1638 if (props2.description || slots.description) {
1639 const content = slots.description ? slots.description() : props2.description;
1640 return createVNode("div", {
1641 "class": bem$1v("description")
1642 }, [content]);
1643 }
1644 };
1645 return () => createVNode(Popup, mergeProps({
1646 "class": bem$1v(),
1647 "position": "bottom",
1648 "onUpdate:show": updateShow
1649 }, pick(props2, popupInheritKeys$2)), {
1650 default: () => {
1651 var _a;
1652 return [renderHeader(), renderDescription(), createVNode("div", {
1653 "class": bem$1v("content")
1654 }, [props2.actions.map(renderAction), (_a = slots.default) == null ? void 0 : _a.call(slots)]), renderCancel()];
1655 }
1656 });
1657 }
1658});
1659const ActionSheet = withInstall(stdin_default$1J);
1660const [name$1z, bem$1u, t$k] = createNamespace("picker");
1661const getFirstEnabledOption = (options) => options.find((option) => !option.disabled) || options[0];
1662function getColumnsType(columns, fields) {
1663 const firstColumn = columns[0];
1664 if (firstColumn) {
1665 if (Array.isArray(firstColumn)) {
1666 return "multiple";
1667 }
1668 if (fields.children in firstColumn) {
1669 return "cascade";
1670 }
1671 }
1672 return "default";
1673}
1674function findIndexOfEnabledOption(options, index) {
1675 index = clamp(index, 0, options.length);
1676 for (let i = index; i < options.length; i++) {
1677 if (!options[i].disabled) return i;
1678 }
1679 for (let i = index - 1; i >= 0; i--) {
1680 if (!options[i].disabled) return i;
1681 }
1682 return 0;
1683}
1684const isOptionExist = (options, value, fields) => value !== void 0 && !!options.find((option) => option[fields.value] === value);
1685function findOptionByValue(options, value, fields) {
1686 const index = options.findIndex((option) => option[fields.value] === value);
1687 const enabledIndex = findIndexOfEnabledOption(options, index);
1688 return options[enabledIndex];
1689}
1690function formatCascadeColumns(columns, fields, selectedValues) {
1691 const formatted = [];
1692 let cursor = {
1693 [fields.children]: columns
1694 };
1695 let columnIndex = 0;
1696 while (cursor && cursor[fields.children]) {
1697 const options = cursor[fields.children];
1698 const value = selectedValues.value[columnIndex];
1699 cursor = isDef(value) ? findOptionByValue(options, value, fields) : void 0;
1700 if (!cursor && options.length) {
1701 const firstValue = getFirstEnabledOption(options)[fields.value];
1702 cursor = findOptionByValue(options, firstValue, fields);
1703 }
1704 columnIndex++;
1705 formatted.push(options);
1706 }
1707 return formatted;
1708}
1709function getElementTranslateY(element) {
1710 const { transform } = window.getComputedStyle(element);
1711 const translateY = transform.slice(7, transform.length - 1).split(", ")[5];
1712 return Number(translateY);
1713}
1714function assignDefaultFields(fields) {
1715 return extend(
1716 {
1717 text: "text",
1718 value: "value",
1719 children: "children"
1720 },
1721 fields
1722 );
1723}
1724const DEFAULT_DURATION = 200;
1725const MOMENTUM_TIME = 300;
1726const MOMENTUM_DISTANCE = 15;
1727const [name$1y, bem$1t] = createNamespace("picker-column");
1728const PICKER_KEY = Symbol(name$1y);
1729var stdin_default$1I = defineComponent({
1730 name: name$1y,
1731 props: {
1732 value: numericProp,
1733 fields: makeRequiredProp(Object),
1734 options: makeArrayProp(),
1735 readonly: Boolean,
1736 allowHtml: Boolean,
1737 optionHeight: makeRequiredProp(Number),
1738 swipeDuration: makeRequiredProp(numericProp),
1739 visibleOptionNum: makeRequiredProp(numericProp)
1740 },
1741 emits: ["change", "clickOption", "scrollInto"],
1742 setup(props2, {
1743 emit,
1744 slots
1745 }) {
1746 let moving;
1747 let startOffset;
1748 let touchStartTime;
1749 let momentumOffset;
1750 let transitionEndTrigger;
1751 const root = ref();
1752 const wrapper = ref();
1753 const currentOffset = ref(0);
1754 const currentDuration = ref(0);
1755 const touch = useTouch();
1756 const count = () => props2.options.length;
1757 const baseOffset = () => props2.optionHeight * (+props2.visibleOptionNum - 1) / 2;
1758 const updateValueByIndex = (index) => {
1759 let enabledIndex = findIndexOfEnabledOption(props2.options, index);
1760 const offset = -enabledIndex * props2.optionHeight;
1761 const trigger = () => {
1762 if (enabledIndex > count() - 1) {
1763 enabledIndex = findIndexOfEnabledOption(props2.options, index);
1764 }
1765 const value = props2.options[enabledIndex][props2.fields.value];
1766 if (value !== props2.value) {
1767 emit("change", value);
1768 }
1769 };
1770 if (moving && offset !== currentOffset.value) {
1771 transitionEndTrigger = trigger;
1772 } else {
1773 trigger();
1774 }
1775 currentOffset.value = offset;
1776 };
1777 const isReadonly = () => props2.readonly || !props2.options.length;
1778 const onClickOption = (index) => {
1779 if (moving || isReadonly()) {
1780 return;
1781 }
1782 transitionEndTrigger = null;
1783 currentDuration.value = DEFAULT_DURATION;
1784 updateValueByIndex(index);
1785 emit("clickOption", props2.options[index]);
1786 };
1787 const getIndexByOffset = (offset) => clamp(Math.round(-offset / props2.optionHeight), 0, count() - 1);
1788 const currentIndex = computed(() => getIndexByOffset(currentOffset.value));
1789 const momentum = (distance, duration) => {
1790 const speed = Math.abs(distance / duration);
1791 distance = currentOffset.value + speed / 3e-3 * (distance < 0 ? -1 : 1);
1792 const index = getIndexByOffset(distance);
1793 currentDuration.value = +props2.swipeDuration;
1794 updateValueByIndex(index);
1795 };
1796 const stopMomentum = () => {
1797 moving = false;
1798 currentDuration.value = 0;
1799 if (transitionEndTrigger) {
1800 transitionEndTrigger();
1801 transitionEndTrigger = null;
1802 }
1803 };
1804 const onTouchStart = (event) => {
1805 if (isReadonly()) {
1806 return;
1807 }
1808 touch.start(event);
1809 if (moving) {
1810 const translateY = getElementTranslateY(wrapper.value);
1811 currentOffset.value = Math.min(0, translateY - baseOffset());
1812 }
1813 currentDuration.value = 0;
1814 startOffset = currentOffset.value;
1815 touchStartTime = Date.now();
1816 momentumOffset = startOffset;
1817 transitionEndTrigger = null;
1818 };
1819 const onTouchMove = (event) => {
1820 if (isReadonly()) {
1821 return;
1822 }
1823 touch.move(event);
1824 if (touch.isVertical()) {
1825 moving = true;
1826 preventDefault(event, true);
1827 }
1828 const newOffset = clamp(startOffset + touch.deltaY.value, -(count() * props2.optionHeight), props2.optionHeight);
1829 const newIndex = getIndexByOffset(newOffset);
1830 if (newIndex !== currentIndex.value) {
1831 emit("scrollInto", props2.options[newIndex]);
1832 }
1833 currentOffset.value = newOffset;
1834 const now = Date.now();
1835 if (now - touchStartTime > MOMENTUM_TIME) {
1836 touchStartTime = now;
1837 momentumOffset = newOffset;
1838 }
1839 };
1840 const onTouchEnd = () => {
1841 if (isReadonly()) {
1842 return;
1843 }
1844 const distance = currentOffset.value - momentumOffset;
1845 const duration = Date.now() - touchStartTime;
1846 const startMomentum = duration < MOMENTUM_TIME && Math.abs(distance) > MOMENTUM_DISTANCE;
1847 if (startMomentum) {
1848 momentum(distance, duration);
1849 return;
1850 }
1851 const index = getIndexByOffset(currentOffset.value);
1852 currentDuration.value = DEFAULT_DURATION;
1853 updateValueByIndex(index);
1854 setTimeout(() => {
1855 moving = false;
1856 }, 0);
1857 };
1858 const renderOptions = () => {
1859 const optionStyle = {
1860 height: `${props2.optionHeight}px`
1861 };
1862 return props2.options.map((option, index) => {
1863 const text = option[props2.fields.text];
1864 const {
1865 disabled
1866 } = option;
1867 const value = option[props2.fields.value];
1868 const data = {
1869 role: "button",
1870 style: optionStyle,
1871 tabindex: disabled ? -1 : 0,
1872 class: [bem$1t("item", {
1873 disabled,
1874 selected: value === props2.value
1875 }), option.className],
1876 onClick: () => onClickOption(index)
1877 };
1878 const childData = {
1879 class: "van-ellipsis",
1880 [props2.allowHtml ? "innerHTML" : "textContent"]: text
1881 };
1882 return createVNode("li", data, [slots.option ? slots.option(option, index) : createVNode("div", childData, null)]);
1883 });
1884 };
1885 useParent(PICKER_KEY);
1886 useExpose({
1887 stopMomentum
1888 });
1889 watchEffect(() => {
1890 const index = moving ? Math.floor(-currentOffset.value / props2.optionHeight) : props2.options.findIndex((option) => option[props2.fields.value] === props2.value);
1891 const enabledIndex = findIndexOfEnabledOption(props2.options, index);
1892 const offset = -enabledIndex * props2.optionHeight;
1893 if (moving && enabledIndex < index) stopMomentum();
1894 currentOffset.value = offset;
1895 });
1896 useEventListener("touchmove", onTouchMove, {
1897 target: root
1898 });
1899 return () => createVNode("div", {
1900 "ref": root,
1901 "class": bem$1t(),
1902 "onTouchstartPassive": onTouchStart,
1903 "onTouchend": onTouchEnd,
1904 "onTouchcancel": onTouchEnd
1905 }, [createVNode("ul", {
1906 "ref": wrapper,
1907 "style": {
1908 transform: `translate3d(0, ${currentOffset.value + baseOffset()}px, 0)`,
1909 transitionDuration: `${currentDuration.value}ms`,
1910 transitionProperty: currentDuration.value ? "all" : "none"
1911 },
1912 "class": bem$1t("wrapper"),
1913 "onTransitionend": stopMomentum
1914 }, [renderOptions()])]);
1915 }
1916});
1917const [name$1x] = createNamespace("picker-toolbar");
1918const pickerToolbarProps = {
1919 title: String,
1920 cancelButtonText: String,
1921 confirmButtonText: String
1922};
1923const pickerToolbarSlots = ["cancel", "confirm", "title", "toolbar"];
1924const pickerToolbarPropKeys = Object.keys(pickerToolbarProps);
1925var stdin_default$1H = defineComponent({
1926 name: name$1x,
1927 props: pickerToolbarProps,
1928 emits: ["confirm", "cancel"],
1929 setup(props2, {
1930 emit,
1931 slots
1932 }) {
1933 const renderTitle = () => {
1934 if (slots.title) {
1935 return slots.title();
1936 }
1937 if (props2.title) {
1938 return createVNode("div", {
1939 "class": [bem$1u("title"), "van-ellipsis"]
1940 }, [props2.title]);
1941 }
1942 };
1943 const onCancel = () => emit("cancel");
1944 const onConfirm = () => emit("confirm");
1945 const renderCancel = () => {
1946 var _a;
1947 const text = (_a = props2.cancelButtonText) != null ? _a : t$k("cancel");
1948 if (!slots.cancel && !text) {
1949 return;
1950 }
1951 return createVNode("button", {
1952 "type": "button",
1953 "class": [bem$1u("cancel"), HAPTICS_FEEDBACK],
1954 "onClick": onCancel
1955 }, [slots.cancel ? slots.cancel() : text]);
1956 };
1957 const renderConfirm = () => {
1958 var _a;
1959 const text = (_a = props2.confirmButtonText) != null ? _a : t$k("confirm");
1960 if (!slots.confirm && !text) {
1961 return;
1962 }
1963 return createVNode("button", {
1964 "type": "button",
1965 "class": [bem$1u("confirm"), HAPTICS_FEEDBACK],
1966 "onClick": onConfirm
1967 }, [slots.confirm ? slots.confirm() : text]);
1968 };
1969 return () => createVNode("div", {
1970 "class": bem$1u("toolbar")
1971 }, [slots.toolbar ? slots.toolbar() : [renderCancel(), renderTitle(), renderConfirm()]]);
1972 }
1973});
1974const useSyncPropRef = (getProp, setProp) => {
1975 const propRef = ref(getProp());
1976 watch(getProp, (value) => {
1977 if (value !== propRef.value) {
1978 propRef.value = value;
1979 }
1980 });
1981 watch(propRef, (value) => {
1982 if (value !== getProp()) {
1983 setProp(value);
1984 }
1985 });
1986 return propRef;
1987};
1988function scrollLeftTo(scroller, to, duration) {
1989 let rafId;
1990 let count = 0;
1991 const from = scroller.scrollLeft;
1992 const frames = duration === 0 ? 1 : Math.round(duration * 1e3 / 16);
1993 let scrollLeft = from;
1994 function cancel() {
1995 cancelRaf(rafId);
1996 }
1997 function animate() {
1998 scrollLeft += (to - from) / frames;
1999 scroller.scrollLeft = scrollLeft;
2000 if (++count < frames) {
2001 rafId = raf(animate);
2002 }
2003 }
2004 animate();
2005 return cancel;
2006}
2007function scrollTopTo(scroller, to, duration, callback) {
2008 let rafId;
2009 let current2 = getScrollTop(scroller);
2010 const isDown = current2 < to;
2011 const frames = duration === 0 ? 1 : Math.round(duration * 1e3 / 16);
2012 const step = (to - current2) / frames;
2013 function cancel() {
2014 cancelRaf(rafId);
2015 }
2016 function animate() {
2017 current2 += step;
2018 if (isDown && current2 > to || !isDown && current2 < to) {
2019 current2 = to;
2020 }
2021 setScrollTop(scroller, current2);
2022 if (isDown && current2 < to || !isDown && current2 > to) {
2023 rafId = raf(animate);
2024 } else if (callback) {
2025 rafId = raf(callback);
2026 }
2027 }
2028 animate();
2029 return cancel;
2030}
2031let current = 0;
2032function useId() {
2033 const vm = getCurrentInstance();
2034 const { name: name2 = "unknown" } = (vm == null ? void 0 : vm.type) || {};
2035 if (process.env.NODE_ENV === "test") {
2036 return name2;
2037 }
2038 return `${name2}-${++current}`;
2039}
2040function useRefs() {
2041 const refs = ref([]);
2042 const cache = [];
2043 onBeforeUpdate(() => {
2044 refs.value = [];
2045 });
2046 const setRefs = (index) => {
2047 if (!cache[index]) {
2048 cache[index] = (el) => {
2049 refs.value[index] = el;
2050 };
2051 }
2052 return cache[index];
2053 };
2054 return [refs, setRefs];
2055}
2056function useVisibilityChange(target, onChange) {
2057 if (!inBrowser || !window.IntersectionObserver) {
2058 return;
2059 }
2060 const observer = new IntersectionObserver(
2061 (entries) => {
2062 onChange(entries[0].intersectionRatio > 0);
2063 },
2064 { root: document.body }
2065 );
2066 const observe = () => {
2067 if (target.value) {
2068 observer.observe(target.value);
2069 }
2070 };
2071 const unobserve = () => {
2072 if (target.value) {
2073 observer.unobserve(target.value);
2074 }
2075 };
2076 onDeactivated(unobserve);
2077 onBeforeUnmount(unobserve);
2078 onMountedOrActivated(observe);
2079}
2080const [name$1w, bem$1s] = createNamespace("sticky");
2081const stickyProps = {
2082 zIndex: numericProp,
2083 position: makeStringProp("top"),
2084 container: Object,
2085 offsetTop: makeNumericProp(0),
2086 offsetBottom: makeNumericProp(0)
2087};
2088var stdin_default$1G = defineComponent({
2089 name: name$1w,
2090 props: stickyProps,
2091 emits: ["scroll", "change"],
2092 setup(props2, {
2093 emit,
2094 slots
2095 }) {
2096 const root = ref();
2097 const scrollParent = useScrollParent(root);
2098 const state = reactive({
2099 fixed: false,
2100 width: 0,
2101 // root width
2102 height: 0,
2103 // root height
2104 transform: 0
2105 });
2106 const isReset = ref(false);
2107 const offset = computed(() => unitToPx(props2.position === "top" ? props2.offsetTop : props2.offsetBottom));
2108 const rootStyle = computed(() => {
2109 if (isReset.value) {
2110 return;
2111 }
2112 const {
2113 fixed,
2114 height,
2115 width
2116 } = state;
2117 if (fixed) {
2118 return {
2119 width: `${width}px`,
2120 height: `${height}px`
2121 };
2122 }
2123 });
2124 const stickyStyle = computed(() => {
2125 if (!state.fixed || isReset.value) {
2126 return;
2127 }
2128 const style = extend(getZIndexStyle(props2.zIndex), {
2129 width: `${state.width}px`,
2130 height: `${state.height}px`,
2131 [props2.position]: `${offset.value}px`
2132 });
2133 if (state.transform) {
2134 style.transform = `translate3d(0, ${state.transform}px, 0)`;
2135 }
2136 return style;
2137 });
2138 const emitScroll = (scrollTop) => emit("scroll", {
2139 scrollTop,
2140 isFixed: state.fixed
2141 });
2142 const onScroll = () => {
2143 if (!root.value || isHidden(root)) {
2144 return;
2145 }
2146 const {
2147 container,
2148 position
2149 } = props2;
2150 const rootRect = useRect(root);
2151 const scrollTop = getScrollTop(window);
2152 state.width = rootRect.width;
2153 state.height = rootRect.height;
2154 if (position === "top") {
2155 if (container) {
2156 const containerRect = useRect(container);
2157 const difference = containerRect.bottom - offset.value - state.height;
2158 state.fixed = offset.value > rootRect.top && containerRect.bottom > 0;
2159 state.transform = difference < 0 ? difference : 0;
2160 } else {
2161 state.fixed = offset.value > rootRect.top;
2162 }
2163 } else {
2164 const {
2165 clientHeight
2166 } = document.documentElement;
2167 if (container) {
2168 const containerRect = useRect(container);
2169 const difference = clientHeight - containerRect.top - offset.value - state.height;
2170 state.fixed = clientHeight - offset.value < rootRect.bottom && clientHeight > containerRect.top;
2171 state.transform = difference < 0 ? -difference : 0;
2172 } else {
2173 state.fixed = clientHeight - offset.value < rootRect.bottom;
2174 }
2175 }
2176 emitScroll(scrollTop);
2177 };
2178 watch(() => state.fixed, (value) => emit("change", value));
2179 useEventListener("scroll", onScroll, {
2180 target: scrollParent,
2181 passive: true
2182 });
2183 useVisibilityChange(root, onScroll);
2184 watch([windowWidth, windowHeight], () => {
2185 if (!root.value || isHidden(root) || !state.fixed) {
2186 return;
2187 }
2188 isReset.value = true;
2189 nextTick(() => {
2190 const rootRect = useRect(root);
2191 state.width = rootRect.width;
2192 state.height = rootRect.height;
2193 isReset.value = false;
2194 });
2195 });
2196 return () => {
2197 var _a;
2198 return createVNode("div", {
2199 "ref": root,
2200 "style": rootStyle.value
2201 }, [createVNode("div", {
2202 "class": bem$1s({
2203 fixed: state.fixed && !isReset.value
2204 }),
2205 "style": stickyStyle.value
2206 }, [(_a = slots.default) == null ? void 0 : _a.call(slots)])]);
2207 };
2208 }
2209});
2210const Sticky = withInstall(stdin_default$1G);
2211const [name$1v, bem$1r] = createNamespace("swipe");
2212const swipeProps = {
2213 loop: truthProp,
2214 width: numericProp,
2215 height: numericProp,
2216 vertical: Boolean,
2217 autoplay: makeNumericProp(0),
2218 duration: makeNumericProp(500),
2219 touchable: truthProp,
2220 lazyRender: Boolean,
2221 initialSwipe: makeNumericProp(0),
2222 indicatorColor: String,
2223 showIndicators: truthProp,
2224 stopPropagation: truthProp
2225};
2226const SWIPE_KEY = Symbol(name$1v);
2227var stdin_default$1F = defineComponent({
2228 name: name$1v,
2229 props: swipeProps,
2230 emits: ["change", "dragStart", "dragEnd"],
2231 setup(props2, {
2232 emit,
2233 slots
2234 }) {
2235 const root = ref();
2236 const track = ref();
2237 const state = reactive({
2238 rect: null,
2239 width: 0,
2240 height: 0,
2241 offset: 0,
2242 active: 0,
2243 swiping: false
2244 });
2245 let dragging = false;
2246 const touch = useTouch();
2247 const {
2248 children,
2249 linkChildren
2250 } = useChildren(SWIPE_KEY);
2251 const count = computed(() => children.length);
2252 const size = computed(() => state[props2.vertical ? "height" : "width"]);
2253 const delta = computed(() => props2.vertical ? touch.deltaY.value : touch.deltaX.value);
2254 const minOffset = computed(() => {
2255 if (state.rect) {
2256 const base = props2.vertical ? state.rect.height : state.rect.width;
2257 return base - size.value * count.value;
2258 }
2259 return 0;
2260 });
2261 const maxCount = computed(() => size.value ? Math.ceil(Math.abs(minOffset.value) / size.value) : count.value);
2262 const trackSize = computed(() => count.value * size.value);
2263 const activeIndicator = computed(() => (state.active + count.value) % count.value);
2264 const isCorrectDirection = computed(() => {
2265 const expect = props2.vertical ? "vertical" : "horizontal";
2266 return touch.direction.value === expect;
2267 });
2268 const trackStyle = computed(() => {
2269 const style = {
2270 transitionDuration: `${state.swiping ? 0 : props2.duration}ms`,
2271 transform: `translate${props2.vertical ? "Y" : "X"}(${+state.offset.toFixed(2)}px)`
2272 };
2273 if (size.value) {
2274 const mainAxis = props2.vertical ? "height" : "width";
2275 const crossAxis = props2.vertical ? "width" : "height";
2276 style[mainAxis] = `${trackSize.value}px`;
2277 style[crossAxis] = props2[crossAxis] ? `${props2[crossAxis]}px` : "";
2278 }
2279 return style;
2280 });
2281 const getTargetActive = (pace) => {
2282 const {
2283 active
2284 } = state;
2285 if (pace) {
2286 if (props2.loop) {
2287 return clamp(active + pace, -1, count.value);
2288 }
2289 return clamp(active + pace, 0, maxCount.value);
2290 }
2291 return active;
2292 };
2293 const getTargetOffset = (targetActive, offset = 0) => {
2294 let currentPosition = targetActive * size.value;
2295 if (!props2.loop) {
2296 currentPosition = Math.min(currentPosition, -minOffset.value);
2297 }
2298 let targetOffset = offset - currentPosition;
2299 if (!props2.loop) {
2300 targetOffset = clamp(targetOffset, minOffset.value, 0);
2301 }
2302 return targetOffset;
2303 };
2304 const move = ({
2305 pace = 0,
2306 offset = 0,
2307 emitChange
2308 }) => {
2309 if (count.value <= 1) {
2310 return;
2311 }
2312 const {
2313 active
2314 } = state;
2315 const targetActive = getTargetActive(pace);
2316 const targetOffset = getTargetOffset(targetActive, offset);
2317 if (props2.loop) {
2318 if (children[0] && targetOffset !== minOffset.value) {
2319 const outRightBound = targetOffset < minOffset.value;
2320 children[0].setOffset(outRightBound ? trackSize.value : 0);
2321 }
2322 if (children[count.value - 1] && targetOffset !== 0) {
2323 const outLeftBound = targetOffset > 0;
2324 children[count.value - 1].setOffset(outLeftBound ? -trackSize.value : 0);
2325 }
2326 }
2327 state.active = targetActive;
2328 state.offset = targetOffset;
2329 if (emitChange && targetActive !== active) {
2330 emit("change", activeIndicator.value);
2331 }
2332 };
2333 const correctPosition = () => {
2334 state.swiping = true;
2335 if (state.active <= -1) {
2336 move({
2337 pace: count.value
2338 });
2339 } else if (state.active >= count.value) {
2340 move({
2341 pace: -count.value
2342 });
2343 }
2344 };
2345 const prev = () => {
2346 correctPosition();
2347 touch.reset();
2348 doubleRaf(() => {
2349 state.swiping = false;
2350 move({
2351 pace: -1,
2352 emitChange: true
2353 });
2354 });
2355 };
2356 const next = () => {
2357 correctPosition();
2358 touch.reset();
2359 doubleRaf(() => {
2360 state.swiping = false;
2361 move({
2362 pace: 1,
2363 emitChange: true
2364 });
2365 });
2366 };
2367 let autoplayTimer;
2368 const stopAutoplay = () => clearTimeout(autoplayTimer);
2369 const autoplay = () => {
2370 stopAutoplay();
2371 if (+props2.autoplay > 0 && count.value > 1) {
2372 autoplayTimer = setTimeout(() => {
2373 next();
2374 autoplay();
2375 }, +props2.autoplay);
2376 }
2377 };
2378 const initialize = (active = +props2.initialSwipe) => {
2379 if (!root.value) {
2380 return;
2381 }
2382 const cb = () => {
2383 var _a, _b;
2384 if (!isHidden(root)) {
2385 const rect = {
2386 width: root.value.offsetWidth,
2387 height: root.value.offsetHeight
2388 };
2389 state.rect = rect;
2390 state.width = +((_a = props2.width) != null ? _a : rect.width);
2391 state.height = +((_b = props2.height) != null ? _b : rect.height);
2392 }
2393 if (count.value) {
2394 active = Math.min(count.value - 1, active);
2395 if (active === -1) {
2396 active = count.value - 1;
2397 }
2398 }
2399 state.active = active;
2400 state.swiping = true;
2401 state.offset = getTargetOffset(active);
2402 children.forEach((swipe) => {
2403 swipe.setOffset(0);
2404 });
2405 autoplay();
2406 };
2407 if (isHidden(root)) {
2408 nextTick().then(cb);
2409 } else {
2410 cb();
2411 }
2412 };
2413 const resize = () => initialize(state.active);
2414 let touchStartTime;
2415 const onTouchStart = (event) => {
2416 if (!props2.touchable || // avoid resetting position on multi-finger touch
2417 event.touches.length > 1) return;
2418 touch.start(event);
2419 dragging = false;
2420 touchStartTime = Date.now();
2421 stopAutoplay();
2422 correctPosition();
2423 };
2424 const onTouchMove = (event) => {
2425 if (props2.touchable && state.swiping) {
2426 touch.move(event);
2427 if (isCorrectDirection.value) {
2428 const isEdgeTouch = !props2.loop && (state.active === 0 && delta.value > 0 || state.active === count.value - 1 && delta.value < 0);
2429 if (!isEdgeTouch) {
2430 preventDefault(event, props2.stopPropagation);
2431 move({
2432 offset: delta.value
2433 });
2434 if (!dragging) {
2435 emit("dragStart", {
2436 index: activeIndicator.value
2437 });
2438 dragging = true;
2439 }
2440 }
2441 }
2442 }
2443 };
2444 const onTouchEnd = () => {
2445 if (!props2.touchable || !state.swiping) {
2446 return;
2447 }
2448 const duration = Date.now() - touchStartTime;
2449 const speed = delta.value / duration;
2450 const shouldSwipe = Math.abs(speed) > 0.25 || Math.abs(delta.value) > size.value / 2;
2451 if (shouldSwipe && isCorrectDirection.value) {
2452 const offset = props2.vertical ? touch.offsetY.value : touch.offsetX.value;
2453 let pace = 0;
2454 if (props2.loop) {
2455 pace = offset > 0 ? delta.value > 0 ? -1 : 1 : 0;
2456 } else {
2457 pace = -Math[delta.value > 0 ? "ceil" : "floor"](delta.value / size.value);
2458 }
2459 move({
2460 pace,
2461 emitChange: true
2462 });
2463 } else if (delta.value) {
2464 move({
2465 pace: 0
2466 });
2467 }
2468 dragging = false;
2469 state.swiping = false;
2470 emit("dragEnd", {
2471 index: activeIndicator.value
2472 });
2473 autoplay();
2474 };
2475 const swipeTo = (index, options = {}) => {
2476 correctPosition();
2477 touch.reset();
2478 doubleRaf(() => {
2479 let targetIndex;
2480 if (props2.loop && index === count.value) {
2481 targetIndex = state.active === 0 ? 0 : index;
2482 } else {
2483 targetIndex = index % count.value;
2484 }
2485 if (options.immediate) {
2486 doubleRaf(() => {
2487 state.swiping = false;
2488 });
2489 } else {
2490 state.swiping = false;
2491 }
2492 move({
2493 pace: targetIndex - state.active,
2494 emitChange: true
2495 });
2496 });
2497 };
2498 const renderDot = (_, index) => {
2499 const active = index === activeIndicator.value;
2500 const style = active ? {
2501 backgroundColor: props2.indicatorColor
2502 } : void 0;
2503 return createVNode("i", {
2504 "style": style,
2505 "class": bem$1r("indicator", {
2506 active
2507 })
2508 }, null);
2509 };
2510 const renderIndicator = () => {
2511 if (slots.indicator) {
2512 return slots.indicator({
2513 active: activeIndicator.value,
2514 total: count.value
2515 });
2516 }
2517 if (props2.showIndicators && count.value > 1) {
2518 return createVNode("div", {
2519 "class": bem$1r("indicators", {
2520 vertical: props2.vertical
2521 })
2522 }, [Array(count.value).fill("").map(renderDot)]);
2523 }
2524 };
2525 useExpose({
2526 prev,
2527 next,
2528 state,
2529 resize,
2530 swipeTo
2531 });
2532 linkChildren({
2533 size,
2534 props: props2,
2535 count,
2536 activeIndicator
2537 });
2538 watch(() => props2.initialSwipe, (value) => initialize(+value));
2539 watch(count, () => initialize(state.active));
2540 watch(() => props2.autoplay, autoplay);
2541 watch([windowWidth, windowHeight, () => props2.width, () => props2.height], resize);
2542 watch(usePageVisibility(), (visible) => {
2543 if (visible === "visible") {
2544 autoplay();
2545 } else {
2546 stopAutoplay();
2547 }
2548 });
2549 onMounted(initialize);
2550 onActivated(() => initialize(state.active));
2551 onPopupReopen(() => initialize(state.active));
2552 onDeactivated(stopAutoplay);
2553 onBeforeUnmount(stopAutoplay);
2554 useEventListener("touchmove", onTouchMove, {
2555 target: track
2556 });
2557 return () => {
2558 var _a;
2559 return createVNode("div", {
2560 "ref": root,
2561 "class": bem$1r()
2562 }, [createVNode("div", {
2563 "ref": track,
2564 "style": trackStyle.value,
2565 "class": bem$1r("track", {
2566 vertical: props2.vertical
2567 }),
2568 "onTouchstartPassive": onTouchStart,
2569 "onTouchend": onTouchEnd,
2570 "onTouchcancel": onTouchEnd
2571 }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]), renderIndicator()]);
2572 };
2573 }
2574});
2575const Swipe = withInstall(stdin_default$1F);
2576const [name$1u, bem$1q] = createNamespace("tabs");
2577var stdin_default$1E = defineComponent({
2578 name: name$1u,
2579 props: {
2580 count: makeRequiredProp(Number),
2581 inited: Boolean,
2582 animated: Boolean,
2583 duration: makeRequiredProp(numericProp),
2584 swipeable: Boolean,
2585 lazyRender: Boolean,
2586 currentIndex: makeRequiredProp(Number)
2587 },
2588 emits: ["change"],
2589 setup(props2, {
2590 emit,
2591 slots
2592 }) {
2593 const swipeRef = ref();
2594 const onChange = (index) => emit("change", index);
2595 const renderChildren = () => {
2596 var _a;
2597 const Content = (_a = slots.default) == null ? void 0 : _a.call(slots);
2598 if (props2.animated || props2.swipeable) {
2599 return createVNode(Swipe, {
2600 "ref": swipeRef,
2601 "loop": false,
2602 "class": bem$1q("track"),
2603 "duration": +props2.duration * 1e3,
2604 "touchable": props2.swipeable,
2605 "lazyRender": props2.lazyRender,
2606 "showIndicators": false,
2607 "onChange": onChange
2608 }, {
2609 default: () => [Content]
2610 });
2611 }
2612 return Content;
2613 };
2614 const swipeToCurrentTab = (index) => {
2615 const swipe = swipeRef.value;
2616 if (swipe && swipe.state.active !== index) {
2617 swipe.swipeTo(index, {
2618 immediate: !props2.inited
2619 });
2620 }
2621 };
2622 watch(() => props2.currentIndex, swipeToCurrentTab);
2623 onMounted(() => {
2624 swipeToCurrentTab(props2.currentIndex);
2625 });
2626 useExpose({
2627 swipeRef
2628 });
2629 return () => createVNode("div", {
2630 "class": bem$1q("content", {
2631 animated: props2.animated || props2.swipeable
2632 })
2633 }, [renderChildren()]);
2634 }
2635});
2636const [name$1t, bem$1p] = createNamespace("tabs");
2637const tabsProps = {
2638 type: makeStringProp("line"),
2639 color: String,
2640 border: Boolean,
2641 sticky: Boolean,
2642 shrink: Boolean,
2643 active: makeNumericProp(0),
2644 duration: makeNumericProp(0.3),
2645 animated: Boolean,
2646 ellipsis: truthProp,
2647 swipeable: Boolean,
2648 scrollspy: Boolean,
2649 offsetTop: makeNumericProp(0),
2650 background: String,
2651 lazyRender: truthProp,
2652 showHeader: truthProp,
2653 lineWidth: numericProp,
2654 lineHeight: numericProp,
2655 beforeChange: Function,
2656 swipeThreshold: makeNumericProp(5),
2657 titleActiveColor: String,
2658 titleInactiveColor: String
2659};
2660const TABS_KEY = Symbol(name$1t);
2661var stdin_default$1D = defineComponent({
2662 name: name$1t,
2663 props: tabsProps,
2664 emits: ["change", "scroll", "rendered", "clickTab", "update:active"],
2665 setup(props2, {
2666 emit,
2667 slots
2668 }) {
2669 let tabHeight;
2670 let lockScroll;
2671 let stickyFixed;
2672 let cancelScrollLeftToRaf;
2673 let cancelScrollTopToRaf;
2674 const root = ref();
2675 const navRef = ref();
2676 const wrapRef = ref();
2677 const contentRef = ref();
2678 const id = useId();
2679 const scroller = useScrollParent(root);
2680 const [titleRefs, setTitleRefs] = useRefs();
2681 const {
2682 children,
2683 linkChildren
2684 } = useChildren(TABS_KEY);
2685 const state = reactive({
2686 inited: false,
2687 position: "",
2688 lineStyle: {},
2689 currentIndex: -1
2690 });
2691 const scrollable = computed(() => children.length > +props2.swipeThreshold || !props2.ellipsis || props2.shrink);
2692 const navStyle = computed(() => ({
2693 borderColor: props2.color,
2694 background: props2.background
2695 }));
2696 const getTabName = (tab, index) => {
2697 var _a;
2698 return (_a = tab.name) != null ? _a : index;
2699 };
2700 const currentName = computed(() => {
2701 const activeTab = children[state.currentIndex];
2702 if (activeTab) {
2703 return getTabName(activeTab, state.currentIndex);
2704 }
2705 });
2706 const offsetTopPx = computed(() => unitToPx(props2.offsetTop));
2707 const scrollOffset = computed(() => {
2708 if (props2.sticky) {
2709 return offsetTopPx.value + tabHeight;
2710 }
2711 return 0;
2712 });
2713 const scrollIntoView = (immediate) => {
2714 const nav = navRef.value;
2715 const titles = titleRefs.value;
2716 if (!scrollable.value || !nav || !titles || !titles[state.currentIndex]) {
2717 return;
2718 }
2719 const title = titles[state.currentIndex].$el;
2720 const to = title.offsetLeft - (nav.offsetWidth - title.offsetWidth) / 2;
2721 if (cancelScrollLeftToRaf) cancelScrollLeftToRaf();
2722 cancelScrollLeftToRaf = scrollLeftTo(nav, to, immediate ? 0 : +props2.duration);
2723 };
2724 const setLine = () => {
2725 const shouldAnimate = state.inited;
2726 nextTick(() => {
2727 const titles = titleRefs.value;
2728 if (!titles || !titles[state.currentIndex] || props2.type !== "line" || isHidden(root.value)) {
2729 return;
2730 }
2731 const title = titles[state.currentIndex].$el;
2732 const {
2733 lineWidth,
2734 lineHeight
2735 } = props2;
2736 const left = title.offsetLeft + title.offsetWidth / 2;
2737 const lineStyle = {
2738 width: addUnit(lineWidth),
2739 backgroundColor: props2.color,
2740 transform: `translateX(${left}px) translateX(-50%)`
2741 };
2742 if (shouldAnimate) {
2743 lineStyle.transitionDuration = `${props2.duration}s`;
2744 }
2745 if (isDef(lineHeight)) {
2746 const height = addUnit(lineHeight);
2747 lineStyle.height = height;
2748 lineStyle.borderRadius = height;
2749 }
2750 state.lineStyle = lineStyle;
2751 });
2752 };
2753 const findAvailableTab = (index) => {
2754 const diff = index < state.currentIndex ? -1 : 1;
2755 while (index >= 0 && index < children.length) {
2756 if (!children[index].disabled) {
2757 return index;
2758 }
2759 index += diff;
2760 }
2761 };
2762 const setCurrentIndex = (currentIndex, skipScrollIntoView) => {
2763 const newIndex = findAvailableTab(currentIndex);
2764 if (!isDef(newIndex)) {
2765 return;
2766 }
2767 const newTab = children[newIndex];
2768 const newName = getTabName(newTab, newIndex);
2769 const shouldEmitChange = state.currentIndex !== null;
2770 if (state.currentIndex !== newIndex) {
2771 state.currentIndex = newIndex;
2772 if (!skipScrollIntoView) {
2773 scrollIntoView();
2774 }
2775 setLine();
2776 }
2777 if (newName !== props2.active) {
2778 emit("update:active", newName);
2779 if (shouldEmitChange) {
2780 emit("change", newName, newTab.title);
2781 }
2782 }
2783 if (stickyFixed && !props2.scrollspy) {
2784 setRootScrollTop(Math.ceil(getElementTop(root.value) - offsetTopPx.value));
2785 }
2786 };
2787 const setCurrentIndexByName = (name2, skipScrollIntoView) => {
2788 const matched = children.find((tab, index2) => getTabName(tab, index2) === name2);
2789 const index = matched ? children.indexOf(matched) : 0;
2790 setCurrentIndex(index, skipScrollIntoView);
2791 };
2792 const scrollToCurrentContent = (immediate = false) => {
2793 if (props2.scrollspy) {
2794 const target = children[state.currentIndex].$el;
2795 if (target && scroller.value) {
2796 const to = getElementTop(target, scroller.value) - scrollOffset.value;
2797 lockScroll = true;
2798 if (cancelScrollTopToRaf) cancelScrollTopToRaf();
2799 cancelScrollTopToRaf = scrollTopTo(scroller.value, to, immediate ? 0 : +props2.duration, () => {
2800 lockScroll = false;
2801 });
2802 }
2803 }
2804 };
2805 const onClickTab = (item, index, event) => {
2806 const {
2807 title,
2808 disabled
2809 } = children[index];
2810 const name2 = getTabName(children[index], index);
2811 if (!disabled) {
2812 callInterceptor(props2.beforeChange, {
2813 args: [name2],
2814 done: () => {
2815 setCurrentIndex(index);
2816 scrollToCurrentContent();
2817 }
2818 });
2819 route(item);
2820 }
2821 emit("clickTab", {
2822 name: name2,
2823 title,
2824 event,
2825 disabled
2826 });
2827 };
2828 const onStickyScroll = (params) => {
2829 stickyFixed = params.isFixed;
2830 emit("scroll", params);
2831 };
2832 const scrollTo = (name2) => {
2833 nextTick(() => {
2834 setCurrentIndexByName(name2);
2835 scrollToCurrentContent(true);
2836 });
2837 };
2838 const getCurrentIndexOnScroll = () => {
2839 for (let index = 0; index < children.length; index++) {
2840 const {
2841 top
2842 } = useRect(children[index].$el);
2843 if (top > scrollOffset.value) {
2844 return index === 0 ? 0 : index - 1;
2845 }
2846 }
2847 return children.length - 1;
2848 };
2849 const onScroll = () => {
2850 if (props2.scrollspy && !lockScroll) {
2851 const index = getCurrentIndexOnScroll();
2852 setCurrentIndex(index);
2853 }
2854 };
2855 const renderLine = () => {
2856 if (props2.type === "line" && children.length) {
2857 return createVNode("div", {
2858 "class": bem$1p("line"),
2859 "style": state.lineStyle
2860 }, null);
2861 }
2862 };
2863 const renderHeader = () => {
2864 var _a, _b, _c;
2865 const {
2866 type,
2867 border,
2868 sticky
2869 } = props2;
2870 const Header = [createVNode("div", {
2871 "ref": sticky ? void 0 : wrapRef,
2872 "class": [bem$1p("wrap"), {
2873 [BORDER_TOP_BOTTOM]: type === "line" && border
2874 }]
2875 }, [createVNode("div", {
2876 "ref": navRef,
2877 "role": "tablist",
2878 "class": bem$1p("nav", [type, {
2879 shrink: props2.shrink,
2880 complete: scrollable.value
2881 }]),
2882 "style": navStyle.value,
2883 "aria-orientation": "horizontal"
2884 }, [(_a = slots["nav-left"]) == null ? void 0 : _a.call(slots), children.map((item) => item.renderTitle(onClickTab)), renderLine(), (_b = slots["nav-right"]) == null ? void 0 : _b.call(slots)])]), (_c = slots["nav-bottom"]) == null ? void 0 : _c.call(slots)];
2885 if (sticky) {
2886 return createVNode("div", {
2887 "ref": wrapRef
2888 }, [Header]);
2889 }
2890 return Header;
2891 };
2892 const resize = () => {
2893 setLine();
2894 nextTick(() => {
2895 var _a, _b;
2896 scrollIntoView(true);
2897 (_b = (_a = contentRef.value) == null ? void 0 : _a.swipeRef.value) == null ? void 0 : _b.resize();
2898 });
2899 };
2900 watch(() => [props2.color, props2.duration, props2.lineWidth, props2.lineHeight], setLine);
2901 watch(windowWidth, resize);
2902 watch(() => props2.active, (value) => {
2903 if (value !== currentName.value) {
2904 setCurrentIndexByName(value);
2905 }
2906 });
2907 watch(() => children.length, () => {
2908 if (state.inited) {
2909 setCurrentIndexByName(props2.active);
2910 setLine();
2911 nextTick(() => {
2912 scrollIntoView(true);
2913 });
2914 }
2915 });
2916 const init = () => {
2917 setCurrentIndexByName(props2.active, true);
2918 nextTick(() => {
2919 state.inited = true;
2920 if (wrapRef.value) {
2921 tabHeight = useRect(wrapRef.value).height;
2922 }
2923 scrollIntoView(true);
2924 });
2925 };
2926 const onRendered = (name2, title) => emit("rendered", name2, title);
2927 useExpose({
2928 resize,
2929 scrollTo
2930 });
2931 onActivated(setLine);
2932 onPopupReopen(setLine);
2933 onMountedOrActivated(init);
2934 useVisibilityChange(root, setLine);
2935 useEventListener("scroll", onScroll, {
2936 target: scroller,
2937 passive: true
2938 });
2939 linkChildren({
2940 id,
2941 props: props2,
2942 setLine,
2943 scrollable,
2944 onRendered,
2945 currentName,
2946 setTitleRefs,
2947 scrollIntoView
2948 });
2949 return () => createVNode("div", {
2950 "ref": root,
2951 "class": bem$1p([props2.type])
2952 }, [props2.showHeader ? props2.sticky ? createVNode(Sticky, {
2953 "container": root.value,
2954 "offsetTop": offsetTopPx.value,
2955 "onScroll": onStickyScroll
2956 }, {
2957 default: () => [renderHeader()]
2958 }) : renderHeader() : null, createVNode(stdin_default$1E, {
2959 "ref": contentRef,
2960 "count": children.length,
2961 "inited": state.inited,
2962 "animated": props2.animated,
2963 "duration": props2.duration,
2964 "swipeable": props2.swipeable,
2965 "lazyRender": props2.lazyRender,
2966 "currentIndex": state.currentIndex,
2967 "onChange": setCurrentIndex
2968 }, {
2969 default: () => {
2970 var _a;
2971 return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
2972 }
2973 })]);
2974 }
2975});
2976const TAB_STATUS_KEY = Symbol();
2977const useTabStatus = () => inject(TAB_STATUS_KEY, null);
2978const [name$1s, bem$1o] = createNamespace("tab");
2979const TabTitle = defineComponent({
2980 name: name$1s,
2981 props: {
2982 id: String,
2983 dot: Boolean,
2984 type: String,
2985 color: String,
2986 title: String,
2987 badge: numericProp,
2988 shrink: Boolean,
2989 isActive: Boolean,
2990 disabled: Boolean,
2991 controls: String,
2992 scrollable: Boolean,
2993 activeColor: String,
2994 inactiveColor: String,
2995 showZeroBadge: truthProp
2996 },
2997 setup(props2, {
2998 slots
2999 }) {
3000 const style = computed(() => {
3001 const style2 = {};
3002 const {
3003 type,
3004 color,
3005 disabled,
3006 isActive,
3007 activeColor,
3008 inactiveColor
3009 } = props2;
3010 const isCard = type === "card";
3011 if (color && isCard) {
3012 style2.borderColor = color;
3013 if (!disabled) {
3014 if (isActive) {
3015 style2.backgroundColor = color;
3016 } else {
3017 style2.color = color;
3018 }
3019 }
3020 }
3021 const titleColor = isActive ? activeColor : inactiveColor;
3022 if (titleColor) {
3023 style2.color = titleColor;
3024 }
3025 return style2;
3026 });
3027 const renderText = () => {
3028 const Text2 = createVNode("span", {
3029 "class": bem$1o("text", {
3030 ellipsis: !props2.scrollable
3031 })
3032 }, [slots.title ? slots.title() : props2.title]);
3033 if (props2.dot || isDef(props2.badge) && props2.badge !== "") {
3034 return createVNode(Badge, {
3035 "dot": props2.dot,
3036 "content": props2.badge,
3037 "showZero": props2.showZeroBadge
3038 }, {
3039 default: () => [Text2]
3040 });
3041 }
3042 return Text2;
3043 };
3044 return () => createVNode("div", {
3045 "id": props2.id,
3046 "role": "tab",
3047 "class": [bem$1o([props2.type, {
3048 grow: props2.scrollable && !props2.shrink,
3049 shrink: props2.shrink,
3050 active: props2.isActive,
3051 disabled: props2.disabled
3052 }])],
3053 "style": style.value,
3054 "tabindex": props2.disabled ? void 0 : props2.isActive ? 0 : -1,
3055 "aria-selected": props2.isActive,
3056 "aria-disabled": props2.disabled || void 0,
3057 "aria-controls": props2.controls,
3058 "data-allow-mismatch": "attribute"
3059 }, [renderText()]);
3060 }
3061});
3062const [name$1r, bem$1n] = createNamespace("swipe-item");
3063var stdin_default$1C = defineComponent({
3064 name: name$1r,
3065 setup(props2, {
3066 slots
3067 }) {
3068 let rendered;
3069 const state = reactive({
3070 offset: 0,
3071 inited: false,
3072 mounted: false
3073 });
3074 const {
3075 parent,
3076 index
3077 } = useParent(SWIPE_KEY);
3078 if (!parent) {
3079 if (process.env.NODE_ENV !== "production") {
3080 console.error("[Vant] <SwipeItem> must be a child component of <Swipe>.");
3081 }
3082 return;
3083 }
3084 const style = computed(() => {
3085 const style2 = {};
3086 const {
3087 vertical
3088 } = parent.props;
3089 if (parent.size.value) {
3090 style2[vertical ? "height" : "width"] = `${parent.size.value}px`;
3091 }
3092 if (state.offset) {
3093 style2.transform = `translate${vertical ? "Y" : "X"}(${state.offset}px)`;
3094 }
3095 return style2;
3096 });
3097 const shouldRender = computed(() => {
3098 const {
3099 loop,
3100 lazyRender
3101 } = parent.props;
3102 if (!lazyRender || rendered) {
3103 return true;
3104 }
3105 if (!state.mounted) {
3106 return false;
3107 }
3108 const active = parent.activeIndicator.value;
3109 const maxActive = parent.count.value - 1;
3110 const prevActive = active === 0 && loop ? maxActive : active - 1;
3111 const nextActive = active === maxActive && loop ? 0 : active + 1;
3112 rendered = index.value === active || index.value === prevActive || index.value === nextActive;
3113 return rendered;
3114 });
3115 const setOffset = (offset) => {
3116 state.offset = offset;
3117 };
3118 onMounted(() => {
3119 nextTick(() => {
3120 state.mounted = true;
3121 });
3122 });
3123 useExpose({
3124 setOffset
3125 });
3126 return () => {
3127 var _a;
3128 return createVNode("div", {
3129 "class": bem$1n(),
3130 "style": style.value
3131 }, [shouldRender.value ? (_a = slots.default) == null ? void 0 : _a.call(slots) : null]);
3132 };
3133 }
3134});
3135const SwipeItem = withInstall(stdin_default$1C);
3136const [name$1q, bem$1m] = createNamespace("tab");
3137const tabProps = extend({}, routeProps, {
3138 dot: Boolean,
3139 name: numericProp,
3140 badge: numericProp,
3141 title: String,
3142 disabled: Boolean,
3143 titleClass: unknownProp,
3144 titleStyle: [String, Object],
3145 showZeroBadge: truthProp
3146});
3147var stdin_default$1B = defineComponent({
3148 name: name$1q,
3149 props: tabProps,
3150 setup(props2, {
3151 slots
3152 }) {
3153 const id = useId();
3154 const inited = ref(false);
3155 const instance2 = getCurrentInstance();
3156 const {
3157 parent,
3158 index
3159 } = useParent(TABS_KEY);
3160 if (!parent) {
3161 if (process.env.NODE_ENV !== "production") {
3162 console.error("[Vant] <Tab> must be a child component of <Tabs>.");
3163 }
3164 return;
3165 }
3166 const getName = () => {
3167 var _a;
3168 return (_a = props2.name) != null ? _a : index.value;
3169 };
3170 const init = () => {
3171 inited.value = true;
3172 if (parent.props.lazyRender) {
3173 nextTick(() => {
3174 parent.onRendered(getName(), props2.title);
3175 });
3176 }
3177 };
3178 const active = computed(() => {
3179 const isActive = getName() === parent.currentName.value;
3180 if (isActive && !inited.value) {
3181 init();
3182 }
3183 return isActive;
3184 });
3185 const parsedClass = ref("");
3186 const parsedStyle = ref("");
3187 watchEffect(() => {
3188 const {
3189 titleClass,
3190 titleStyle
3191 } = props2;
3192 parsedClass.value = titleClass ? normalizeClass(titleClass) : "";
3193 parsedStyle.value = titleStyle && typeof titleStyle !== "string" ? stringifyStyle(normalizeStyle(titleStyle)) : titleStyle;
3194 });
3195 const renderTitle = (onClickTab) => createVNode(TabTitle, mergeProps({
3196 "key": id,
3197 "id": `${parent.id}-${index.value}`,
3198 "ref": parent.setTitleRefs(index.value),
3199 "style": parsedStyle.value,
3200 "class": parsedClass.value,
3201 "isActive": active.value,
3202 "controls": id,
3203 "scrollable": parent.scrollable.value,
3204 "activeColor": parent.props.titleActiveColor,
3205 "inactiveColor": parent.props.titleInactiveColor,
3206 "onClick": (event) => onClickTab(instance2.proxy, index.value, event)
3207 }, pick(parent.props, ["type", "color", "shrink"]), pick(props2, ["dot", "badge", "title", "disabled", "showZeroBadge"])), {
3208 title: slots.title
3209 });
3210 const hasInactiveClass = ref(!active.value);
3211 watch(active, (val) => {
3212 if (val) {
3213 hasInactiveClass.value = false;
3214 } else {
3215 doubleRaf(() => {
3216 hasInactiveClass.value = true;
3217 });
3218 }
3219 });
3220 watch(() => props2.title, () => {
3221 parent.setLine();
3222 parent.scrollIntoView();
3223 });
3224 provide(TAB_STATUS_KEY, active);
3225 useExpose({
3226 id,
3227 renderTitle
3228 });
3229 return () => {
3230 var _a;
3231 const label = `${parent.id}-${index.value}`;
3232 const {
3233 animated,
3234 swipeable,
3235 scrollspy,
3236 lazyRender
3237 } = parent.props;
3238 if (!slots.default && !animated) {
3239 return;
3240 }
3241 const show = scrollspy || active.value;
3242 if (animated || swipeable) {
3243 return createVNode(SwipeItem, {
3244 "id": id,
3245 "role": "tabpanel",
3246 "class": bem$1m("panel-wrapper", {
3247 inactive: hasInactiveClass.value
3248 }),
3249 "tabindex": active.value ? 0 : -1,
3250 "aria-hidden": !active.value,
3251 "aria-labelledby": label,
3252 "data-allow-mismatch": "attribute"
3253 }, {
3254 default: () => {
3255 var _a2;
3256 return [createVNode("div", {
3257 "class": bem$1m("panel")
3258 }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)])];
3259 }
3260 });
3261 }
3262 const shouldRender = inited.value || scrollspy || !lazyRender;
3263 const Content = shouldRender ? (_a = slots.default) == null ? void 0 : _a.call(slots) : null;
3264 return withDirectives(createVNode("div", {
3265 "id": id,
3266 "role": "tabpanel",
3267 "class": bem$1m("panel"),
3268 "tabindex": show ? 0 : -1,
3269 "aria-labelledby": label,
3270 "data-allow-mismatch": "attribute"
3271 }, [Content]), [[vShow, show]]);
3272 };
3273 }
3274});
3275const Tab = withInstall(stdin_default$1B);
3276const Tabs = withInstall(stdin_default$1D);
3277const [name$1p, bem$1l] = createNamespace("picker-group");
3278const PICKER_GROUP_KEY = Symbol(name$1p);
3279const pickerGroupProps = extend({
3280 tabs: makeArrayProp(),
3281 activeTab: makeNumericProp(0),
3282 nextStepText: String,
3283 showToolbar: truthProp
3284}, pickerToolbarProps);
3285var stdin_default$1A = defineComponent({
3286 name: name$1p,
3287 props: pickerGroupProps,
3288 emits: ["confirm", "cancel", "update:activeTab"],
3289 setup(props2, {
3290 emit,
3291 slots
3292 }) {
3293 const activeTab = useSyncPropRef(() => props2.activeTab, (value) => emit("update:activeTab", value));
3294 const {
3295 children,
3296 linkChildren
3297 } = useChildren(PICKER_GROUP_KEY);
3298 linkChildren();
3299 const showNextButton = () => +activeTab.value < props2.tabs.length - 1 && props2.nextStepText;
3300 const onConfirm = () => {
3301 if (showNextButton()) {
3302 activeTab.value = +activeTab.value + 1;
3303 } else {
3304 emit("confirm", children.map((item) => item.confirm()));
3305 }
3306 };
3307 const onCancel = () => emit("cancel");
3308 return () => {
3309 var _a, _b;
3310 let childNodes = (_b = (_a = slots.default) == null ? void 0 : _a.call(slots)) == null ? void 0 : _b.filter((node) => node.type !== Comment).map((node) => {
3311 if (node.type === Fragment) {
3312 return node.children;
3313 }
3314 return node;
3315 });
3316 if (childNodes) {
3317 childNodes = flat(childNodes);
3318 }
3319 const confirmButtonText = showNextButton() ? props2.nextStepText : props2.confirmButtonText;
3320 return createVNode("div", {
3321 "class": bem$1l()
3322 }, [props2.showToolbar ? createVNode(stdin_default$1H, {
3323 "title": props2.title,
3324 "cancelButtonText": props2.cancelButtonText,
3325 "confirmButtonText": confirmButtonText,
3326 "onConfirm": onConfirm,
3327 "onCancel": onCancel
3328 }, pick(slots, pickerToolbarSlots)) : null, createVNode(Tabs, {
3329 "active": activeTab.value,
3330 "onUpdate:active": ($event) => activeTab.value = $event,
3331 "class": bem$1l("tabs"),
3332 "shrink": true,
3333 "animated": true,
3334 "lazyRender": false
3335 }, {
3336 default: () => [props2.tabs.map((title, index) => createVNode(Tab, {
3337 "title": title,
3338 "titleClass": bem$1l("tab-title")
3339 }, {
3340 default: () => [childNodes == null ? void 0 : childNodes[index]]
3341 }))]
3342 })]);
3343 };
3344 }
3345});
3346const pickerSharedProps = extend({
3347 loading: Boolean,
3348 readonly: Boolean,
3349 allowHtml: Boolean,
3350 optionHeight: makeNumericProp(44),
3351 showToolbar: truthProp,
3352 swipeDuration: makeNumericProp(1e3),
3353 visibleOptionNum: makeNumericProp(6)
3354}, pickerToolbarProps);
3355const pickerProps = extend({}, pickerSharedProps, {
3356 columns: makeArrayProp(),
3357 modelValue: makeArrayProp(),
3358 toolbarPosition: makeStringProp("top"),
3359 columnsFieldNames: Object
3360});
3361var stdin_default$1z = defineComponent({
3362 name: name$1z,
3363 props: pickerProps,
3364 emits: ["confirm", "cancel", "change", "scrollInto", "clickOption", "update:modelValue"],
3365 setup(props2, {
3366 emit,
3367 slots
3368 }) {
3369 const columnsRef = ref();
3370 const selectedValues = ref(props2.modelValue.slice(0));
3371 const {
3372 parent
3373 } = useParent(PICKER_GROUP_KEY);
3374 const {
3375 children,
3376 linkChildren
3377 } = useChildren(PICKER_KEY);
3378 linkChildren();
3379 const fields = computed(() => assignDefaultFields(props2.columnsFieldNames));
3380 const optionHeight = computed(() => unitToPx(props2.optionHeight));
3381 const columnsType = computed(() => getColumnsType(props2.columns, fields.value));
3382 const currentColumns = computed(() => {
3383 const {
3384 columns
3385 } = props2;
3386 switch (columnsType.value) {
3387 case "multiple":
3388 return columns;
3389 case "cascade":
3390 return formatCascadeColumns(columns, fields.value, selectedValues);
3391 default:
3392 return [columns];
3393 }
3394 });
3395 const hasOptions = computed(() => currentColumns.value.some((options) => options.length));
3396 const selectedOptions = computed(() => currentColumns.value.map((options, index) => findOptionByValue(options, selectedValues.value[index], fields.value)));
3397 const selectedIndexes = computed(() => currentColumns.value.map((options, index) => options.findIndex((option) => option[fields.value.value] === selectedValues.value[index])));
3398 const setValue = (index, value) => {
3399 if (selectedValues.value[index] !== value) {
3400 const newValues = selectedValues.value.slice(0);
3401 newValues[index] = value;
3402 selectedValues.value = newValues;
3403 }
3404 };
3405 const getEventParams = () => ({
3406 selectedValues: selectedValues.value.slice(0),
3407 selectedOptions: selectedOptions.value,
3408 selectedIndexes: selectedIndexes.value
3409 });
3410 const onChange = (value, columnIndex) => {
3411 setValue(columnIndex, value);
3412 if (columnsType.value === "cascade") {
3413 selectedValues.value.forEach((value2, index) => {
3414 const options = currentColumns.value[index];
3415 if (!isOptionExist(options, value2, fields.value)) {
3416 setValue(index, options.length ? options[0][fields.value.value] : void 0);
3417 }
3418 });
3419 }
3420 nextTick(() => {
3421 emit("change", extend({
3422 columnIndex
3423 }, getEventParams()));
3424 });
3425 };
3426 const onClickOption = (currentOption, columnIndex) => {
3427 const params = {
3428 columnIndex,
3429 currentOption
3430 };
3431 emit("clickOption", extend(getEventParams(), params));
3432 emit("scrollInto", params);
3433 };
3434 const confirm = () => {
3435 children.forEach((child) => child.stopMomentum());
3436 const params = getEventParams();
3437 nextTick(() => {
3438 emit("confirm", params);
3439 });
3440 return params;
3441 };
3442 const cancel = () => emit("cancel", getEventParams());
3443 const renderColumnItems = () => currentColumns.value.map((options, columnIndex) => createVNode(stdin_default$1I, {
3444 "value": selectedValues.value[columnIndex],
3445 "fields": fields.value,
3446 "options": options,
3447 "readonly": props2.readonly,
3448 "allowHtml": props2.allowHtml,
3449 "optionHeight": optionHeight.value,
3450 "swipeDuration": props2.swipeDuration,
3451 "visibleOptionNum": props2.visibleOptionNum,
3452 "onChange": (value) => onChange(value, columnIndex),
3453 "onClickOption": (option) => onClickOption(option, columnIndex),
3454 "onScrollInto": (option) => {
3455 emit("scrollInto", {
3456 currentOption: option,
3457 columnIndex
3458 });
3459 }
3460 }, {
3461 option: slots.option
3462 }));
3463 const renderMask = (wrapHeight) => {
3464 if (hasOptions.value) {
3465 const frameStyle = {
3466 height: `${optionHeight.value}px`
3467 };
3468 const maskStyle = {
3469 backgroundSize: `100% ${(wrapHeight - optionHeight.value) / 2}px`
3470 };
3471 return [createVNode("div", {
3472 "class": bem$1u("mask"),
3473 "style": maskStyle
3474 }, null), createVNode("div", {
3475 "class": [BORDER_UNSET_TOP_BOTTOM, bem$1u("frame")],
3476 "style": frameStyle
3477 }, null)];
3478 }
3479 };
3480 const renderColumns = () => {
3481 const wrapHeight = optionHeight.value * +props2.visibleOptionNum;
3482 const columnsStyle = {
3483 height: `${wrapHeight}px`
3484 };
3485 return createVNode("div", {
3486 "ref": columnsRef,
3487 "class": bem$1u("columns"),
3488 "style": columnsStyle
3489 }, [renderColumnItems(), renderMask(wrapHeight)]);
3490 };
3491 const renderToolbar = () => {
3492 if (props2.showToolbar && !parent) {
3493 return createVNode(stdin_default$1H, mergeProps(pick(props2, pickerToolbarPropKeys), {
3494 "onConfirm": confirm,
3495 "onCancel": cancel
3496 }), pick(slots, pickerToolbarSlots));
3497 }
3498 };
3499 watch(currentColumns, (columns) => {
3500 columns.forEach((options, index) => {
3501 if (options.length && !isOptionExist(options, selectedValues.value[index], fields.value)) {
3502 setValue(index, getFirstEnabledOption(options)[fields.value.value]);
3503 }
3504 });
3505 }, {
3506 immediate: true
3507 });
3508 let lastEmittedModelValue;
3509 watch(() => props2.modelValue, (newValues) => {
3510 if (!isSameValue(newValues, selectedValues.value) && !isSameValue(newValues, lastEmittedModelValue)) {
3511 selectedValues.value = newValues.slice(0);
3512 lastEmittedModelValue = newValues.slice(0);
3513 }
3514 }, {
3515 deep: true
3516 });
3517 watch(selectedValues, (newValues) => {
3518 if (!isSameValue(newValues, props2.modelValue)) {
3519 lastEmittedModelValue = newValues.slice(0);
3520 emit("update:modelValue", lastEmittedModelValue);
3521 }
3522 }, {
3523 immediate: true
3524 });
3525 useEventListener("touchmove", preventDefault, {
3526 target: columnsRef
3527 });
3528 const getSelectedOptions = () => selectedOptions.value;
3529 useExpose({
3530 confirm,
3531 getSelectedOptions
3532 });
3533 return () => {
3534 var _a, _b;
3535 return createVNode("div", {
3536 "class": bem$1u()
3537 }, [props2.toolbarPosition === "top" ? renderToolbar() : null, props2.loading ? createVNode(Loading, {
3538 "class": bem$1u("loading")
3539 }, null) : null, (_a = slots["columns-top"]) == null ? void 0 : _a.call(slots), renderColumns(), (_b = slots["columns-bottom"]) == null ? void 0 : _b.call(slots), props2.toolbarPosition === "bottom" ? renderToolbar() : null]);
3540 };
3541 }
3542});
3543const AREA_EMPTY_CODE = "000000";
3544const INHERIT_SLOTS = [
3545 "title",
3546 "cancel",
3547 "confirm",
3548 "toolbar",
3549 "columns-top",
3550 "columns-bottom"
3551];
3552const INHERIT_PROPS = [
3553 "title",
3554 "loading",
3555 "readonly",
3556 "optionHeight",
3557 "swipeDuration",
3558 "visibleOptionNum",
3559 "cancelButtonText",
3560 "confirmButtonText"
3561];
3562const makeOption = (text = "", value = AREA_EMPTY_CODE, children = void 0) => ({
3563 text,
3564 value,
3565 children
3566});
3567function formatDataForCascade({
3568 areaList,
3569 columnsNum,
3570 columnsPlaceholder: placeholder
3571}) {
3572 const {
3573 city_list: city = {},
3574 county_list: county = {},
3575 province_list: province = {}
3576 } = areaList;
3577 const showCity = +columnsNum > 1;
3578 const showCounty = +columnsNum > 2;
3579 const getProvinceChildren = () => {
3580 if (showCity) {
3581 return placeholder.length > 1 ? [
3582 makeOption(
3583 placeholder[1],
3584 AREA_EMPTY_CODE,
3585 showCounty ? [] : void 0
3586 )
3587 ] : [];
3588 }
3589 };
3590 const provinceMap = /* @__PURE__ */ new Map();
3591 Object.keys(province).forEach((code) => {
3592 provinceMap.set(
3593 code.slice(0, 2),
3594 makeOption(province[code], code, getProvinceChildren())
3595 );
3596 });
3597 const cityMap = /* @__PURE__ */ new Map();
3598 if (showCity) {
3599 const getCityChildren = () => {
3600 if (showCounty) {
3601 return placeholder.length > 2 ? [makeOption(placeholder[2])] : [];
3602 }
3603 };
3604 Object.keys(city).forEach((code) => {
3605 const option = makeOption(city[code], code, getCityChildren());
3606 cityMap.set(code.slice(0, 4), option);
3607 const province2 = provinceMap.get(code.slice(0, 2));
3608 if (province2) {
3609 province2.children.push(option);
3610 }
3611 });
3612 }
3613 if (showCounty) {
3614 Object.keys(county).forEach((code) => {
3615 const city2 = cityMap.get(code.slice(0, 4));
3616 if (city2) {
3617 city2.children.push(makeOption(county[code], code));
3618 }
3619 });
3620 }
3621 const options = Array.from(provinceMap.values());
3622 if (placeholder.length) {
3623 const county2 = showCounty ? [makeOption(placeholder[2])] : void 0;
3624 const city2 = showCity ? [makeOption(placeholder[1], AREA_EMPTY_CODE, county2)] : void 0;
3625 options.unshift(makeOption(placeholder[0], AREA_EMPTY_CODE, city2));
3626 }
3627 return options;
3628}
3629const Picker = withInstall(stdin_default$1z);
3630const [name$1o, bem$1k] = createNamespace("area");
3631const areaProps = extend({}, pick(pickerSharedProps, INHERIT_PROPS), {
3632 modelValue: String,
3633 columnsNum: makeNumericProp(3),
3634 columnsPlaceholder: makeArrayProp(),
3635 areaList: {
3636 type: Object,
3637 default: () => ({})
3638 }
3639});
3640var stdin_default$1y = defineComponent({
3641 name: name$1o,
3642 props: areaProps,
3643 emits: ["change", "confirm", "cancel", "update:modelValue"],
3644 setup(props2, {
3645 emit,
3646 slots
3647 }) {
3648 const codes = ref([]);
3649 const picker = ref();
3650 const columns = computed(() => formatDataForCascade(props2));
3651 const onChange = (...args) => emit("change", ...args);
3652 const onCancel = (...args) => emit("cancel", ...args);
3653 const onConfirm = (...args) => emit("confirm", ...args);
3654 watch(codes, (newCodes) => {
3655 const lastCode = newCodes.length ? newCodes[newCodes.length - 1] : "";
3656 if (lastCode && lastCode !== props2.modelValue) {
3657 emit("update:modelValue", lastCode);
3658 }
3659 }, {
3660 deep: true
3661 });
3662 watch(() => props2.modelValue, (newCode) => {
3663 if (newCode) {
3664 const lastCode = codes.value.length ? codes.value[codes.value.length - 1] : "";
3665 if (newCode !== lastCode) {
3666 codes.value = [`${newCode.slice(0, 2)}0000`, `${newCode.slice(0, 4)}00`, newCode].slice(0, +props2.columnsNum);
3667 }
3668 } else {
3669 codes.value = [];
3670 }
3671 }, {
3672 immediate: true
3673 });
3674 useExpose({
3675 confirm: () => {
3676 var _a;
3677 return (_a = picker.value) == null ? void 0 : _a.confirm();
3678 },
3679 getSelectedOptions: () => {
3680 var _a;
3681 return ((_a = picker.value) == null ? void 0 : _a.getSelectedOptions()) || [];
3682 }
3683 });
3684 return () => createVNode(Picker, mergeProps({
3685 "ref": picker,
3686 "modelValue": codes.value,
3687 "onUpdate:modelValue": ($event) => codes.value = $event,
3688 "class": bem$1k(),
3689 "columns": columns.value,
3690 "onChange": onChange,
3691 "onCancel": onCancel,
3692 "onConfirm": onConfirm
3693 }, pick(props2, INHERIT_PROPS)), pick(slots, INHERIT_SLOTS));
3694 }
3695});
3696const Area = withInstall(stdin_default$1y);
3697const [name$1n, bem$1j] = createNamespace("cell");
3698const cellSharedProps = {
3699 tag: makeStringProp("div"),
3700 icon: String,
3701 size: String,
3702 title: numericProp,
3703 value: numericProp,
3704 label: numericProp,
3705 center: Boolean,
3706 isLink: Boolean,
3707 border: truthProp,
3708 iconPrefix: String,
3709 valueClass: unknownProp,
3710 labelClass: unknownProp,
3711 titleClass: unknownProp,
3712 titleStyle: null,
3713 arrowDirection: String,
3714 required: {
3715 type: [Boolean, String],
3716 default: null
3717 },
3718 clickable: {
3719 type: Boolean,
3720 default: null
3721 }
3722};
3723const cellProps = extend({}, cellSharedProps, routeProps);
3724var stdin_default$1x = defineComponent({
3725 name: name$1n,
3726 props: cellProps,
3727 setup(props2, {
3728 slots
3729 }) {
3730 const route2 = useRoute();
3731 const renderLabel = () => {
3732 const showLabel = slots.label || isDef(props2.label);
3733 if (showLabel) {
3734 return createVNode("div", {
3735 "class": [bem$1j("label"), props2.labelClass]
3736 }, [slots.label ? slots.label() : props2.label]);
3737 }
3738 };
3739 const renderTitle = () => {
3740 var _a;
3741 if (slots.title || isDef(props2.title)) {
3742 const titleSlot = (_a = slots.title) == null ? void 0 : _a.call(slots);
3743 if (Array.isArray(titleSlot) && titleSlot.length === 0) {
3744 return;
3745 }
3746 return createVNode("div", {
3747 "class": [bem$1j("title"), props2.titleClass],
3748 "style": props2.titleStyle
3749 }, [titleSlot || createVNode("span", null, [props2.title]), renderLabel()]);
3750 }
3751 };
3752 const renderValue = () => {
3753 const slot = slots.value || slots.default;
3754 const hasValue = slot || isDef(props2.value);
3755 if (hasValue) {
3756 return createVNode("div", {
3757 "class": [bem$1j("value"), props2.valueClass]
3758 }, [slot ? slot() : createVNode("span", null, [props2.value])]);
3759 }
3760 };
3761 const renderLeftIcon = () => {
3762 if (slots.icon) {
3763 return slots.icon();
3764 }
3765 if (props2.icon) {
3766 return createVNode(Icon, {
3767 "name": props2.icon,
3768 "class": bem$1j("left-icon"),
3769 "classPrefix": props2.iconPrefix
3770 }, null);
3771 }
3772 };
3773 const renderRightIcon = () => {
3774 if (slots["right-icon"]) {
3775 return slots["right-icon"]();
3776 }
3777 if (props2.isLink) {
3778 const name2 = props2.arrowDirection && props2.arrowDirection !== "right" ? `arrow-${props2.arrowDirection}` : "arrow";
3779 return createVNode(Icon, {
3780 "name": name2,
3781 "class": bem$1j("right-icon")
3782 }, null);
3783 }
3784 };
3785 return () => {
3786 var _a;
3787 const {
3788 tag,
3789 size,
3790 center,
3791 border,
3792 isLink,
3793 required
3794 } = props2;
3795 const clickable = (_a = props2.clickable) != null ? _a : isLink;
3796 const classes = {
3797 center,
3798 required: !!required,
3799 clickable,
3800 borderless: !border
3801 };
3802 if (size) {
3803 classes[size] = !!size;
3804 }
3805 return createVNode(tag, {
3806 "class": bem$1j(classes),
3807 "role": clickable ? "button" : void 0,
3808 "tabindex": clickable ? 0 : void 0,
3809 "onClick": route2
3810 }, {
3811 default: () => {
3812 var _a2;
3813 return [renderLeftIcon(), renderTitle(), renderValue(), renderRightIcon(), (_a2 = slots.extra) == null ? void 0 : _a2.call(slots)];
3814 }
3815 });
3816 };
3817 }
3818});
3819const Cell = withInstall(stdin_default$1x);
3820const [name$1m, bem$1i] = createNamespace("form");
3821const formProps = {
3822 colon: Boolean,
3823 disabled: Boolean,
3824 readonly: Boolean,
3825 required: [Boolean, String],
3826 showError: Boolean,
3827 labelWidth: numericProp,
3828 labelAlign: String,
3829 inputAlign: String,
3830 scrollToError: Boolean,
3831 scrollToErrorPosition: String,
3832 validateFirst: Boolean,
3833 submitOnEnter: truthProp,
3834 showErrorMessage: truthProp,
3835 errorMessageAlign: String,
3836 validateTrigger: {
3837 type: [String, Array],
3838 default: "onBlur"
3839 }
3840};
3841var stdin_default$1w = defineComponent({
3842 name: name$1m,
3843 props: formProps,
3844 emits: ["submit", "failed"],
3845 setup(props2, {
3846 emit,
3847 slots
3848 }) {
3849 const {
3850 children,
3851 linkChildren
3852 } = useChildren(FORM_KEY);
3853 const getFieldsByNames = (names) => {
3854 if (names) {
3855 return children.filter((field) => names.includes(field.name));
3856 }
3857 return children;
3858 };
3859 const validateSeq = (names) => new Promise((resolve, reject) => {
3860 const errors = [];
3861 const fields = getFieldsByNames(names);
3862 fields.reduce((promise, field) => promise.then(() => {
3863 if (!errors.length) {
3864 return field.validate().then((error) => {
3865 if (error) {
3866 errors.push(error);
3867 }
3868 });
3869 }
3870 }), Promise.resolve()).then(() => {
3871 if (errors.length) {
3872 reject(errors);
3873 } else {
3874 resolve();
3875 }
3876 });
3877 });
3878 const validateAll = (names) => new Promise((resolve, reject) => {
3879 const fields = getFieldsByNames(names);
3880 Promise.all(fields.map((item) => item.validate())).then((errors) => {
3881 errors = errors.filter(Boolean);
3882 if (errors.length) {
3883 reject(errors);
3884 } else {
3885 resolve();
3886 }
3887 });
3888 });
3889 const validateField = (name2) => {
3890 const matched = children.find((item) => item.name === name2);
3891 if (matched) {
3892 return new Promise((resolve, reject) => {
3893 matched.validate().then((error) => {
3894 if (error) {
3895 reject(error);
3896 } else {
3897 resolve();
3898 }
3899 });
3900 });
3901 }
3902 return Promise.reject();
3903 };
3904 const validate = (name2) => {
3905 if (typeof name2 === "string") {
3906 return validateField(name2);
3907 }
3908 return props2.validateFirst ? validateSeq(name2) : validateAll(name2);
3909 };
3910 const resetValidation = (name2) => {
3911 if (typeof name2 === "string") {
3912 name2 = [name2];
3913 }
3914 const fields = getFieldsByNames(name2);
3915 fields.forEach((item) => {
3916 item.resetValidation();
3917 });
3918 };
3919 const getValidationStatus = () => children.reduce((form, field) => {
3920 form[field.name] = field.getValidationStatus();
3921 return form;
3922 }, {});
3923 const scrollToField = (name2, options) => {
3924 children.some((item) => {
3925 if (item.name === name2) {
3926 item.$el.scrollIntoView(options);
3927 return true;
3928 }
3929 return false;
3930 });
3931 };
3932 const getValues = () => children.reduce((form, field) => {
3933 if (field.name !== void 0) {
3934 form[field.name] = field.formValue.value;
3935 }
3936 return form;
3937 }, {});
3938 const submit = () => {
3939 const values = getValues();
3940 validate().then(() => emit("submit", values)).catch((errors) => {
3941 emit("failed", {
3942 values,
3943 errors
3944 });
3945 const {
3946 scrollToError,
3947 scrollToErrorPosition
3948 } = props2;
3949 if (scrollToError && errors[0].name) {
3950 scrollToField(errors[0].name, scrollToErrorPosition ? {
3951 block: scrollToErrorPosition
3952 } : void 0);
3953 }
3954 });
3955 };
3956 const onSubmit = (event) => {
3957 preventDefault(event);
3958 submit();
3959 };
3960 linkChildren({
3961 props: props2
3962 });
3963 useExpose({
3964 submit,
3965 validate,
3966 getValues,
3967 scrollToField,
3968 resetValidation,
3969 getValidationStatus
3970 });
3971 return () => {
3972 var _a;
3973 return createVNode("form", {
3974 "class": bem$1i(),
3975 "onSubmit": onSubmit
3976 }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
3977 };
3978 }
3979});
3980const Form = withInstall(stdin_default$1w);
3981function isEmptyValue(value) {
3982 if (Array.isArray(value)) {
3983 return !value.length;
3984 }
3985 if (value === 0) {
3986 return false;
3987 }
3988 return !value;
3989}
3990function runSyncRule(value, rule) {
3991 if (isEmptyValue(value)) {
3992 if (rule.required) {
3993 return false;
3994 }
3995 if (rule.validateEmpty === false) {
3996 return true;
3997 }
3998 }
3999 if (rule.pattern && !rule.pattern.test(String(value))) {
4000 return false;
4001 }
4002 return true;
4003}
4004function runRuleValidator(value, rule) {
4005 return new Promise((resolve) => {
4006 const returnVal = rule.validator(value, rule);
4007 if (isPromise(returnVal)) {
4008 returnVal.then(resolve);
4009 return;
4010 }
4011 resolve(returnVal);
4012 });
4013}
4014function getRuleMessage(value, rule) {
4015 const { message } = rule;
4016 if (isFunction(message)) {
4017 return message(value, rule);
4018 }
4019 return message || "";
4020}
4021function startComposing({ target }) {
4022 target.composing = true;
4023}
4024function endComposing({ target }) {
4025 if (target.composing) {
4026 target.composing = false;
4027 target.dispatchEvent(new Event("input"));
4028 }
4029}
4030function resizeTextarea(input, autosize) {
4031 const scrollTop = getRootScrollTop();
4032 input.style.height = "auto";
4033 let height = input.scrollHeight;
4034 if (isObject(autosize)) {
4035 const { maxHeight, minHeight } = autosize;
4036 if (maxHeight !== void 0) {
4037 height = Math.min(height, maxHeight);
4038 }
4039 if (minHeight !== void 0) {
4040 height = Math.max(height, minHeight);
4041 }
4042 }
4043 if (height) {
4044 input.style.height = `${height}px`;
4045 setRootScrollTop(scrollTop);
4046 }
4047}
4048function mapInputType(type) {
4049 if (type === "number") {
4050 return {
4051 type: "text",
4052 inputmode: "decimal"
4053 };
4054 }
4055 if (type === "digit") {
4056 return {
4057 type: "tel",
4058 inputmode: "numeric"
4059 };
4060 }
4061 return { type };
4062}
4063function getStringLength(str) {
4064 return [...str].length;
4065}
4066function cutString(str, maxlength) {
4067 return [...str].slice(0, maxlength).join("");
4068}
4069const [name$1l, bem$1h] = createNamespace("field");
4070const fieldSharedProps = {
4071 id: String,
4072 name: String,
4073 leftIcon: String,
4074 rightIcon: String,
4075 autofocus: Boolean,
4076 clearable: Boolean,
4077 maxlength: numericProp,
4078 max: Number,
4079 min: Number,
4080 formatter: Function,
4081 clearIcon: makeStringProp("clear"),
4082 modelValue: makeNumericProp(""),
4083 inputAlign: String,
4084 placeholder: String,
4085 autocomplete: String,
4086 autocapitalize: String,
4087 autocorrect: String,
4088 errorMessage: String,
4089 enterkeyhint: String,
4090 clearTrigger: makeStringProp("focus"),
4091 formatTrigger: makeStringProp("onChange"),
4092 spellcheck: {
4093 type: Boolean,
4094 default: null
4095 },
4096 error: {
4097 type: Boolean,
4098 default: null
4099 },
4100 disabled: {
4101 type: Boolean,
4102 default: null
4103 },
4104 readonly: {
4105 type: Boolean,
4106 default: null
4107 }
4108};
4109const fieldProps = extend({}, cellSharedProps, fieldSharedProps, {
4110 rows: numericProp,
4111 type: makeStringProp("text"),
4112 rules: Array,
4113 autosize: [Boolean, Object],
4114 labelWidth: numericProp,
4115 labelClass: unknownProp,
4116 labelAlign: String,
4117 showWordLimit: Boolean,
4118 errorMessageAlign: String,
4119 colon: {
4120 type: Boolean,
4121 default: null
4122 }
4123});
4124var stdin_default$1v = defineComponent({
4125 name: name$1l,
4126 props: fieldProps,
4127 emits: ["blur", "focus", "clear", "keypress", "clickInput", "endValidate", "startValidate", "clickLeftIcon", "clickRightIcon", "update:modelValue"],
4128 setup(props2, {
4129 emit,
4130 slots
4131 }) {
4132 const id = useId();
4133 const state = reactive({
4134 status: "unvalidated",
4135 focused: false,
4136 validateMessage: ""
4137 });
4138 const inputRef = ref();
4139 const clearIconRef = ref();
4140 const customValue = ref();
4141 const {
4142 parent: form
4143 } = useParent(FORM_KEY);
4144 const getModelValue = () => {
4145 var _a;
4146 return String((_a = props2.modelValue) != null ? _a : "");
4147 };
4148 const getProp = (key) => {
4149 if (isDef(props2[key])) {
4150 return props2[key];
4151 }
4152 if (form && isDef(form.props[key])) {
4153 return form.props[key];
4154 }
4155 };
4156 const showClear = computed(() => {
4157 const readonly = getProp("readonly");
4158 if (props2.clearable && !readonly) {
4159 const hasValue = getModelValue() !== "";
4160 const trigger = props2.clearTrigger === "always" || props2.clearTrigger === "focus" && state.focused;
4161 return hasValue && trigger;
4162 }
4163 return false;
4164 });
4165 const formValue = computed(() => {
4166 if (customValue.value && slots.input) {
4167 return customValue.value();
4168 }
4169 return props2.modelValue;
4170 });
4171 const showRequiredMark = computed(() => {
4172 var _a;
4173 const required = getProp("required");
4174 if (required === "auto") {
4175 return (_a = props2.rules) == null ? void 0 : _a.some((rule) => rule.required);
4176 }
4177 return required;
4178 });
4179 const runRules = (rules) => rules.reduce((promise, rule) => promise.then(() => {
4180 if (state.status === "failed") {
4181 return;
4182 }
4183 let {
4184 value
4185 } = formValue;
4186 if (rule.formatter) {
4187 value = rule.formatter(value, rule);
4188 }
4189 if (!runSyncRule(value, rule)) {
4190 state.status = "failed";
4191 state.validateMessage = getRuleMessage(value, rule);
4192 return;
4193 }
4194 if (rule.validator) {
4195 if (isEmptyValue(value) && rule.validateEmpty === false) {
4196 return;
4197 }
4198 return runRuleValidator(value, rule).then((result) => {
4199 if (result && typeof result === "string") {
4200 state.status = "failed";
4201 state.validateMessage = result;
4202 } else if (result === false) {
4203 state.status = "failed";
4204 state.validateMessage = getRuleMessage(value, rule);
4205 }
4206 });
4207 }
4208 }), Promise.resolve());
4209 const resetValidation = () => {
4210 state.status = "unvalidated";
4211 state.validateMessage = "";
4212 };
4213 const endValidate = () => emit("endValidate", {
4214 status: state.status,
4215 message: state.validateMessage
4216 });
4217 const validate = (rules = props2.rules) => new Promise((resolve) => {
4218 resetValidation();
4219 if (rules) {
4220 emit("startValidate");
4221 runRules(rules).then(() => {
4222 if (state.status === "failed") {
4223 resolve({
4224 name: props2.name,
4225 message: state.validateMessage
4226 });
4227 endValidate();
4228 } else {
4229 state.status = "passed";
4230 resolve();
4231 endValidate();
4232 }
4233 });
4234 } else {
4235 resolve();
4236 }
4237 });
4238 const validateWithTrigger = (trigger) => {
4239 if (form && props2.rules) {
4240 const {
4241 validateTrigger
4242 } = form.props;
4243 const defaultTrigger = toArray(validateTrigger).includes(trigger);
4244 const rules = props2.rules.filter((rule) => {
4245 if (rule.trigger) {
4246 return toArray(rule.trigger).includes(trigger);
4247 }
4248 return defaultTrigger;
4249 });
4250 if (rules.length) {
4251 validate(rules);
4252 }
4253 }
4254 };
4255 const limitValueLength = (value) => {
4256 var _a;
4257 const {
4258 maxlength
4259 } = props2;
4260 if (isDef(maxlength) && getStringLength(value) > +maxlength) {
4261 const modelValue = getModelValue();
4262 if (modelValue && getStringLength(modelValue) === +maxlength) {
4263 return modelValue;
4264 }
4265 const selectionEnd = (_a = inputRef.value) == null ? void 0 : _a.selectionEnd;
4266 if (state.focused && selectionEnd) {
4267 const valueArr = [...value];
4268 const exceededLength = valueArr.length - +maxlength;
4269 valueArr.splice(selectionEnd - exceededLength, exceededLength);
4270 return valueArr.join("");
4271 }
4272 return cutString(value, +maxlength);
4273 }
4274 return value;
4275 };
4276 const updateValue = (value, trigger = "onChange") => {
4277 var _a, _b;
4278 const originalValue = value;
4279 value = limitValueLength(value);
4280 const limitDiffLen = getStringLength(originalValue) - getStringLength(value);
4281 if (props2.type === "number" || props2.type === "digit") {
4282 const isNumber = props2.type === "number";
4283 value = formatNumber(value, isNumber, isNumber);
4284 if (trigger === "onBlur" && value !== "" && (props2.min !== void 0 || props2.max !== void 0)) {
4285 const adjustedValue = clamp(+value, (_a = props2.min) != null ? _a : -Infinity, (_b = props2.max) != null ? _b : Infinity);
4286 value = adjustedValue.toString();
4287 }
4288 }
4289 let formatterDiffLen = 0;
4290 if (props2.formatter && trigger === props2.formatTrigger) {
4291 const {
4292 formatter,
4293 maxlength
4294 } = props2;
4295 value = formatter(value);
4296 if (isDef(maxlength) && getStringLength(value) > +maxlength) {
4297 value = cutString(value, +maxlength);
4298 }
4299 if (inputRef.value && state.focused) {
4300 const {
4301 selectionEnd
4302 } = inputRef.value;
4303 const bcoVal = cutString(originalValue, selectionEnd);
4304 formatterDiffLen = getStringLength(formatter(bcoVal)) - getStringLength(bcoVal);
4305 }
4306 }
4307 if (inputRef.value && inputRef.value.value !== value) {
4308 if (state.focused) {
4309 let {
4310 selectionStart,
4311 selectionEnd
4312 } = inputRef.value;
4313 inputRef.value.value = value;
4314 if (isDef(selectionStart) && isDef(selectionEnd)) {
4315 const valueLen = getStringLength(value);
4316 if (limitDiffLen) {
4317 selectionStart -= limitDiffLen;
4318 selectionEnd -= limitDiffLen;
4319 } else if (formatterDiffLen) {
4320 selectionStart += formatterDiffLen;
4321 selectionEnd += formatterDiffLen;
4322 }
4323 inputRef.value.setSelectionRange(Math.min(selectionStart, valueLen), Math.min(selectionEnd, valueLen));
4324 }
4325 } else {
4326 inputRef.value.value = value;
4327 }
4328 }
4329 if (value !== props2.modelValue) {
4330 emit("update:modelValue", value);
4331 }
4332 };
4333 const onInput = (event) => {
4334 if (!event.target.composing) {
4335 updateValue(event.target.value);
4336 }
4337 };
4338 const blur = () => {
4339 var _a;
4340 return (_a = inputRef.value) == null ? void 0 : _a.blur();
4341 };
4342 const focus = () => {
4343 var _a;
4344 return (_a = inputRef.value) == null ? void 0 : _a.focus();
4345 };
4346 const adjustTextareaSize = () => {
4347 const input = inputRef.value;
4348 if (props2.type === "textarea" && props2.autosize && input) {
4349 resizeTextarea(input, props2.autosize);
4350 }
4351 };
4352 const onFocus = (event) => {
4353 state.focused = true;
4354 emit("focus", event);
4355 nextTick(adjustTextareaSize);
4356 if (getProp("readonly")) {
4357 blur();
4358 }
4359 };
4360 const onBlur = (event) => {
4361 state.focused = false;
4362 updateValue(getModelValue(), "onBlur");
4363 emit("blur", event);
4364 if (getProp("readonly")) {
4365 return;
4366 }
4367 validateWithTrigger("onBlur");
4368 nextTick(adjustTextareaSize);
4369 resetScroll();
4370 };
4371 const onClickInput = (event) => emit("clickInput", event);
4372 const onClickLeftIcon = (event) => emit("clickLeftIcon", event);
4373 const onClickRightIcon = (event) => emit("clickRightIcon", event);
4374 const onClear = (event) => {
4375 preventDefault(event);
4376 emit("update:modelValue", "");
4377 emit("clear", event);
4378 };
4379 const showError = computed(() => {
4380 if (typeof props2.error === "boolean") {
4381 return props2.error;
4382 }
4383 if (form && form.props.showError && state.status === "failed") {
4384 return true;
4385 }
4386 });
4387 const labelStyle = computed(() => {
4388 const labelWidth = getProp("labelWidth");
4389 const labelAlign = getProp("labelAlign");
4390 if (labelWidth && labelAlign !== "top") {
4391 return {
4392 width: addUnit(labelWidth)
4393 };
4394 }
4395 });
4396 const onKeypress = (event) => {
4397 const ENTER_CODE = 13;
4398 if (event.keyCode === ENTER_CODE) {
4399 const submitOnEnter = form && form.props.submitOnEnter;
4400 if (!submitOnEnter && props2.type !== "textarea") {
4401 preventDefault(event);
4402 }
4403 if (props2.type === "search") {
4404 blur();
4405 }
4406 }
4407 emit("keypress", event);
4408 };
4409 const getInputId = () => props2.id || `${id}-input`;
4410 const getValidationStatus = () => state.status;
4411 const renderInput = () => {
4412 const controlClass = bem$1h("control", [getProp("inputAlign"), {
4413 error: showError.value,
4414 custom: !!slots.input,
4415 "min-height": props2.type === "textarea" && !props2.autosize
4416 }]);
4417 if (slots.input) {
4418 return createVNode("div", {
4419 "class": controlClass,
4420 "onClick": onClickInput
4421 }, [slots.input()]);
4422 }
4423 const inputAttrs = {
4424 id: getInputId(),
4425 ref: inputRef,
4426 name: props2.name,
4427 rows: props2.rows !== void 0 ? +props2.rows : void 0,
4428 class: controlClass,
4429 disabled: getProp("disabled"),
4430 readonly: getProp("readonly"),
4431 autofocus: props2.autofocus,
4432 placeholder: props2.placeholder,
4433 autocomplete: props2.autocomplete,
4434 autocapitalize: props2.autocapitalize,
4435 autocorrect: props2.autocorrect,
4436 enterkeyhint: props2.enterkeyhint,
4437 spellcheck: props2.spellcheck,
4438 "aria-labelledby": props2.label ? `${id}-label` : void 0,
4439 "data-allow-mismatch": "attribute",
4440 onBlur,
4441 onFocus,
4442 onInput,
4443 onClick: onClickInput,
4444 onChange: endComposing,
4445 onKeypress,
4446 onCompositionend: endComposing,
4447 onCompositionstart: startComposing
4448 };
4449 if (props2.type === "textarea") {
4450 return createVNode("textarea", inputAttrs, null);
4451 }
4452 return createVNode("input", mergeProps(mapInputType(props2.type), inputAttrs), null);
4453 };
4454 const renderLeftIcon = () => {
4455 const leftIconSlot = slots["left-icon"];
4456 if (props2.leftIcon || leftIconSlot) {
4457 return createVNode("div", {
4458 "class": bem$1h("left-icon"),
4459 "onClick": onClickLeftIcon
4460 }, [leftIconSlot ? leftIconSlot() : createVNode(Icon, {
4461 "name": props2.leftIcon,
4462 "classPrefix": props2.iconPrefix
4463 }, null)]);
4464 }
4465 };
4466 const renderRightIcon = () => {
4467 const rightIconSlot = slots["right-icon"];
4468 if (props2.rightIcon || rightIconSlot) {
4469 return createVNode("div", {
4470 "class": bem$1h("right-icon"),
4471 "onClick": onClickRightIcon
4472 }, [rightIconSlot ? rightIconSlot() : createVNode(Icon, {
4473 "name": props2.rightIcon,
4474 "classPrefix": props2.iconPrefix
4475 }, null)]);
4476 }
4477 };
4478 const renderWordLimit = () => {
4479 if (props2.showWordLimit && props2.maxlength) {
4480 const count = getStringLength(getModelValue());
4481 return createVNode("div", {
4482 "class": bem$1h("word-limit")
4483 }, [createVNode("span", {
4484 "class": bem$1h("word-num")
4485 }, [count]), createTextVNode("/"), props2.maxlength]);
4486 }
4487 };
4488 const renderMessage = () => {
4489 if (form && form.props.showErrorMessage === false) {
4490 return;
4491 }
4492 const message = props2.errorMessage || state.validateMessage;
4493 if (message) {
4494 const slot = slots["error-message"];
4495 const errorMessageAlign = getProp("errorMessageAlign");
4496 return createVNode("div", {
4497 "class": bem$1h("error-message", errorMessageAlign)
4498 }, [slot ? slot({
4499 message
4500 }) : message]);
4501 }
4502 };
4503 const renderLabel = () => {
4504 const labelWidth = getProp("labelWidth");
4505 const labelAlign = getProp("labelAlign");
4506 const colon = getProp("colon") ? ":" : "";
4507 if (slots.label) {
4508 return [slots.label(), colon];
4509 }
4510 if (props2.label) {
4511 return createVNode("label", {
4512 "id": `${id}-label`,
4513 "for": slots.input ? void 0 : getInputId(),
4514 "data-allow-mismatch": "attribute",
4515 "onClick": (event) => {
4516 preventDefault(event);
4517 focus();
4518 },
4519 "style": labelAlign === "top" && labelWidth ? {
4520 width: addUnit(labelWidth)
4521 } : void 0
4522 }, [props2.label + colon]);
4523 }
4524 };
4525 const renderFieldBody = () => [createVNode("div", {
4526 "class": bem$1h("body")
4527 }, [renderInput(), showClear.value && createVNode(Icon, {
4528 "ref": clearIconRef,
4529 "name": props2.clearIcon,
4530 "class": bem$1h("clear")
4531 }, null), renderRightIcon(), slots.button && createVNode("div", {
4532 "class": bem$1h("button")
4533 }, [slots.button()])]), renderWordLimit(), renderMessage()];
4534 useExpose({
4535 blur,
4536 focus,
4537 validate,
4538 formValue,
4539 resetValidation,
4540 getValidationStatus
4541 });
4542 provide(CUSTOM_FIELD_INJECTION_KEY, {
4543 customValue,
4544 resetValidation,
4545 validateWithTrigger
4546 });
4547 watch(() => props2.modelValue, () => {
4548 updateValue(getModelValue());
4549 resetValidation();
4550 validateWithTrigger("onChange");
4551 nextTick(adjustTextareaSize);
4552 });
4553 onMounted(() => {
4554 updateValue(getModelValue(), props2.formatTrigger);
4555 nextTick(adjustTextareaSize);
4556 });
4557 useEventListener("touchstart", onClear, {
4558 target: computed(() => {
4559 var _a;
4560 return (_a = clearIconRef.value) == null ? void 0 : _a.$el;
4561 })
4562 });
4563 return () => {
4564 const disabled = getProp("disabled");
4565 const labelAlign = getProp("labelAlign");
4566 const LeftIcon = renderLeftIcon();
4567 const renderTitle = () => {
4568 const Label = renderLabel();
4569 if (labelAlign === "top") {
4570 return [LeftIcon, Label].filter(Boolean);
4571 }
4572 return Label || [];
4573 };
4574 return createVNode(Cell, {
4575 "size": props2.size,
4576 "class": bem$1h({
4577 error: showError.value,
4578 disabled,
4579 [`label-${labelAlign}`]: labelAlign
4580 }),
4581 "center": props2.center,
4582 "border": props2.border,
4583 "isLink": props2.isLink,
4584 "clickable": props2.clickable,
4585 "titleStyle": labelStyle.value,
4586 "valueClass": bem$1h("value"),
4587 "titleClass": [bem$1h("label", [labelAlign, {
4588 required: showRequiredMark.value
4589 }]), props2.labelClass],
4590 "arrowDirection": props2.arrowDirection
4591 }, {
4592 icon: LeftIcon && labelAlign !== "top" ? () => LeftIcon : null,
4593 title: renderTitle,
4594 value: renderFieldBody,
4595 extra: slots.extra
4596 });
4597 };
4598 }
4599});
4600const Field = withInstall(stdin_default$1v);
4601let lockCount = 0;
4602function lockClick(lock) {
4603 if (lock) {
4604 if (!lockCount) {
4605 document.body.classList.add("van-toast--unclickable");
4606 }
4607 lockCount++;
4608 } else if (lockCount) {
4609 lockCount--;
4610 if (!lockCount) {
4611 document.body.classList.remove("van-toast--unclickable");
4612 }
4613 }
4614}
4615const [name$1k, bem$1g] = createNamespace("toast");
4616const popupInheritProps$1 = ["show", "overlay", "teleport", "transition", "overlayClass", "overlayStyle", "closeOnClickOverlay", "zIndex"];
4617const toastProps = {
4618 icon: String,
4619 show: Boolean,
4620 type: makeStringProp("text"),
4621 overlay: Boolean,
4622 message: numericProp,
4623 iconSize: numericProp,
4624 duration: makeNumberProp(2e3),
4625 position: makeStringProp("middle"),
4626 teleport: [String, Object],
4627 wordBreak: String,
4628 className: unknownProp,
4629 iconPrefix: String,
4630 transition: makeStringProp("van-fade"),
4631 loadingType: String,
4632 forbidClick: Boolean,
4633 overlayClass: unknownProp,
4634 overlayStyle: Object,
4635 closeOnClick: Boolean,
4636 closeOnClickOverlay: Boolean,
4637 zIndex: numericProp
4638};
4639var stdin_default$1u = defineComponent({
4640 name: name$1k,
4641 props: toastProps,
4642 emits: ["update:show"],
4643 setup(props2, {
4644 emit,
4645 slots
4646 }) {
4647 let timer2;
4648 let clickable = false;
4649 const toggleClickable = () => {
4650 const newValue = props2.show && props2.forbidClick;
4651 if (clickable !== newValue) {
4652 clickable = newValue;
4653 lockClick(clickable);
4654 }
4655 };
4656 const updateShow = (show) => emit("update:show", show);
4657 const onClick = () => {
4658 if (props2.closeOnClick) {
4659 updateShow(false);
4660 }
4661 };
4662 const clearTimer = () => clearTimeout(timer2);
4663 const renderIcon = () => {
4664 const {
4665 icon,
4666 type,
4667 iconSize,
4668 iconPrefix,
4669 loadingType
4670 } = props2;
4671 const hasIcon = icon || type === "success" || type === "fail";
4672 if (hasIcon) {
4673 return createVNode(Icon, {
4674 "name": icon || type,
4675 "size": iconSize,
4676 "class": bem$1g("icon"),
4677 "classPrefix": iconPrefix
4678 }, null);
4679 }
4680 if (type === "loading") {
4681 return createVNode(Loading, {
4682 "class": bem$1g("loading"),
4683 "size": iconSize,
4684 "type": loadingType
4685 }, null);
4686 }
4687 };
4688 const renderMessage = () => {
4689 const {
4690 type,
4691 message
4692 } = props2;
4693 if (slots.message) {
4694 return createVNode("div", {
4695 "class": bem$1g("text")
4696 }, [slots.message()]);
4697 }
4698 if (isDef(message) && message !== "") {
4699 return type === "html" ? createVNode("div", {
4700 "key": 0,
4701 "class": bem$1g("text"),
4702 "innerHTML": String(message)
4703 }, null) : createVNode("div", {
4704 "class": bem$1g("text")
4705 }, [message]);
4706 }
4707 };
4708 watch(() => [props2.show, props2.forbidClick], toggleClickable);
4709 watch(() => [props2.show, props2.type, props2.message, props2.duration], () => {
4710 clearTimer();
4711 if (props2.show && props2.duration > 0) {
4712 timer2 = setTimeout(() => {
4713 updateShow(false);
4714 }, props2.duration);
4715 }
4716 });
4717 onMounted(toggleClickable);
4718 onUnmounted(toggleClickable);
4719 return () => createVNode(Popup, mergeProps({
4720 "class": [bem$1g([props2.position, props2.wordBreak === "normal" ? "break-normal" : props2.wordBreak, {
4721 [props2.type]: !props2.icon
4722 }]), props2.className],
4723 "lockScroll": false,
4724 "onClick": onClick,
4725 "onClosed": clearTimer,
4726 "onUpdate:show": updateShow
4727 }, pick(props2, popupInheritProps$1)), {
4728 default: () => [renderIcon(), renderMessage()]
4729 });
4730 }
4731});
4732function usePopupState() {
4733 const state = reactive({
4734 show: false
4735 });
4736 const toggle = (show) => {
4737 state.show = show;
4738 };
4739 const open = (props2) => {
4740 extend(state, props2, { transitionAppear: true });
4741 toggle(true);
4742 };
4743 const close = () => toggle(false);
4744 useExpose({ open, close, toggle });
4745 return {
4746 open,
4747 close,
4748 state,
4749 toggle
4750 };
4751}
4752function mountComponent(RootComponent) {
4753 const app = createApp(RootComponent);
4754 const root = document.createElement("div");
4755 document.body.appendChild(root);
4756 return {
4757 instance: app.mount(root),
4758 unmount() {
4759 app.unmount();
4760 document.body.removeChild(root);
4761 }
4762 };
4763}
4764const defaultOptions$1 = {
4765 icon: "",
4766 type: "text",
4767 message: "",
4768 className: "",
4769 overlay: false,
4770 onClose: void 0,
4771 onOpened: void 0,
4772 duration: 2e3,
4773 teleport: "body",
4774 iconSize: void 0,
4775 iconPrefix: void 0,
4776 position: "middle",
4777 transition: "van-fade",
4778 forbidClick: false,
4779 loadingType: void 0,
4780 overlayClass: "",
4781 overlayStyle: void 0,
4782 closeOnClick: false,
4783 closeOnClickOverlay: false
4784};
4785let queue = [];
4786let allowMultiple = false;
4787let currentOptions$2 = extend({}, defaultOptions$1);
4788const defaultOptionsMap = /* @__PURE__ */ new Map();
4789function parseOptions$1(message) {
4790 if (isObject(message)) {
4791 return message;
4792 }
4793 return {
4794 message
4795 };
4796}
4797function createInstance() {
4798 const {
4799 instance: instance2,
4800 unmount
4801 } = mountComponent({
4802 setup() {
4803 const message = ref("");
4804 const {
4805 open,
4806 state,
4807 close,
4808 toggle
4809 } = usePopupState();
4810 const onClosed = () => {
4811 if (allowMultiple) {
4812 queue = queue.filter((item) => item !== instance2);
4813 unmount();
4814 }
4815 };
4816 const render = () => {
4817 const attrs = {
4818 onClosed,
4819 "onUpdate:show": toggle
4820 };
4821 return createVNode(stdin_default$1u, mergeProps(state, attrs), null);
4822 };
4823 watch(message, (val) => {
4824 state.message = val;
4825 });
4826 getCurrentInstance().render = render;
4827 return {
4828 open,
4829 close,
4830 message
4831 };
4832 }
4833 });
4834 return instance2;
4835}
4836function getInstance() {
4837 if (!queue.length || allowMultiple) {
4838 const instance2 = createInstance();
4839 queue.push(instance2);
4840 }
4841 return queue[queue.length - 1];
4842}
4843function showToast(options = {}) {
4844 if (!inBrowser) {
4845 return {};
4846 }
4847 const toast = getInstance();
4848 const parsedOptions = parseOptions$1(options);
4849 toast.open(extend({}, currentOptions$2, defaultOptionsMap.get(parsedOptions.type || currentOptions$2.type), parsedOptions));
4850 return toast;
4851}
4852const createMethod = (type) => (options) => showToast(extend({
4853 type
4854}, parseOptions$1(options)));
4855const showLoadingToast = createMethod("loading");
4856const showSuccessToast = createMethod("success");
4857const showFailToast = createMethod("fail");
4858const closeToast = (all) => {
4859 var _a;
4860 if (queue.length) {
4861 if (all) {
4862 queue.forEach((toast) => {
4863 toast.close();
4864 });
4865 queue = [];
4866 } else if (!allowMultiple) {
4867 queue[0].close();
4868 } else {
4869 (_a = queue.shift()) == null ? void 0 : _a.close();
4870 }
4871 }
4872};
4873function setToastDefaultOptions(type, options) {
4874 if (typeof type === "string") {
4875 defaultOptionsMap.set(type, options);
4876 } else {
4877 extend(currentOptions$2, type);
4878 }
4879}
4880const resetToastDefaultOptions = (type) => {
4881 if (typeof type === "string") {
4882 defaultOptionsMap.delete(type);
4883 } else {
4884 currentOptions$2 = extend({}, defaultOptions$1);
4885 defaultOptionsMap.clear();
4886 }
4887};
4888const allowMultipleToast = (value = true) => {
4889 allowMultiple = value;
4890};
4891const Toast = withInstall(stdin_default$1u);
4892const [name$1j, bem$1f] = createNamespace("switch");
4893const switchProps = {
4894 size: numericProp,
4895 loading: Boolean,
4896 disabled: Boolean,
4897 modelValue: unknownProp,
4898 activeColor: String,
4899 inactiveColor: String,
4900 activeValue: {
4901 type: unknownProp,
4902 default: true
4903 },
4904 inactiveValue: {
4905 type: unknownProp,
4906 default: false
4907 }
4908};
4909var stdin_default$1t = defineComponent({
4910 name: name$1j,
4911 props: switchProps,
4912 emits: ["change", "update:modelValue"],
4913 setup(props2, {
4914 emit,
4915 slots
4916 }) {
4917 const isChecked = () => props2.modelValue === props2.activeValue;
4918 const onClick = () => {
4919 if (!props2.disabled && !props2.loading) {
4920 const newValue = isChecked() ? props2.inactiveValue : props2.activeValue;
4921 emit("update:modelValue", newValue);
4922 emit("change", newValue);
4923 }
4924 };
4925 const renderLoading = () => {
4926 if (props2.loading) {
4927 const color = isChecked() ? props2.activeColor : props2.inactiveColor;
4928 return createVNode(Loading, {
4929 "class": bem$1f("loading"),
4930 "color": color
4931 }, null);
4932 }
4933 if (slots.node) {
4934 return slots.node();
4935 }
4936 };
4937 useCustomFieldValue(() => props2.modelValue);
4938 return () => {
4939 var _a;
4940 const {
4941 size,
4942 loading,
4943 disabled,
4944 activeColor,
4945 inactiveColor
4946 } = props2;
4947 const checked = isChecked();
4948 const style = {
4949 fontSize: addUnit(size),
4950 backgroundColor: checked ? activeColor : inactiveColor
4951 };
4952 return createVNode("div", {
4953 "role": "switch",
4954 "class": bem$1f({
4955 on: checked,
4956 loading,
4957 disabled
4958 }),
4959 "style": style,
4960 "tabindex": disabled ? void 0 : 0,
4961 "aria-checked": checked,
4962 "onClick": onClick
4963 }, [createVNode("div", {
4964 "class": bem$1f("node")
4965 }, [renderLoading()]), (_a = slots.background) == null ? void 0 : _a.call(slots)]);
4966 };
4967 }
4968});
4969const Switch = withInstall(stdin_default$1t);
4970const [name$1i, bem$1e] = createNamespace("address-edit-detail");
4971const t$j = createNamespace("address-edit")[2];
4972var stdin_default$1s = defineComponent({
4973 name: name$1i,
4974 props: {
4975 show: Boolean,
4976 rows: numericProp,
4977 value: String,
4978 rules: Array,
4979 focused: Boolean,
4980 maxlength: numericProp,
4981 searchResult: Array,
4982 showSearchResult: Boolean
4983 },
4984 emits: ["blur", "focus", "input", "selectSearch"],
4985 setup(props2, {
4986 emit
4987 }) {
4988 const field = ref();
4989 const showSearchResult = () => props2.focused && props2.searchResult && props2.showSearchResult;
4990 const onSelect = (express) => {
4991 emit("selectSearch", express);
4992 emit("input", `${express.address || ""} ${express.name || ""}`.trim());
4993 };
4994 const renderSearchResult = () => {
4995 if (!showSearchResult()) {
4996 return;
4997 }
4998 const {
4999 searchResult
5000 } = props2;
5001 return searchResult.map((express) => createVNode(Cell, {
5002 "clickable": true,
5003 "key": (express.name || "") + (express.address || ""),
5004 "icon": "location-o",
5005 "title": express.name,
5006 "label": express.address,
5007 "class": bem$1e("search-item"),
5008 "border": false,
5009 "onClick": () => onSelect(express)
5010 }, null));
5011 };
5012 const onBlur = (event) => emit("blur", event);
5013 const onFocus = (event) => emit("focus", event);
5014 const onInput = (value) => emit("input", value);
5015 return () => {
5016 if (props2.show) {
5017 return createVNode(Fragment, null, [createVNode(Field, {
5018 "autosize": true,
5019 "clearable": true,
5020 "ref": field,
5021 "class": bem$1e(),
5022 "rows": props2.rows,
5023 "type": "textarea",
5024 "rules": props2.rules,
5025 "label": t$j("addressDetail"),
5026 "border": !showSearchResult(),
5027 "maxlength": props2.maxlength,
5028 "modelValue": props2.value,
5029 "placeholder": t$j("addressDetail"),
5030 "onBlur": onBlur,
5031 "onFocus": onFocus,
5032 "onUpdate:modelValue": onInput
5033 }, null), renderSearchResult()]);
5034 }
5035 };
5036 }
5037});
5038const [name$1h, bem$1d, t$i] = createNamespace("address-edit");
5039const DEFAULT_DATA = {
5040 name: "",
5041 tel: "",
5042 city: "",
5043 county: "",
5044 country: "",
5045 province: "",
5046 areaCode: "",
5047 isDefault: false,
5048 addressDetail: ""
5049};
5050const addressEditProps = {
5051 areaList: Object,
5052 isSaving: Boolean,
5053 isDeleting: Boolean,
5054 validator: Function,
5055 showArea: truthProp,
5056 showDetail: truthProp,
5057 showDelete: Boolean,
5058 disableArea: Boolean,
5059 searchResult: Array,
5060 telMaxlength: numericProp,
5061 showSetDefault: Boolean,
5062 saveButtonText: String,
5063 areaPlaceholder: String,
5064 deleteButtonText: String,
5065 showSearchResult: Boolean,
5066 detailRows: makeNumericProp(1),
5067 detailMaxlength: makeNumericProp(200),
5068 areaColumnsPlaceholder: makeArrayProp(),
5069 addressInfo: {
5070 type: Object,
5071 default: () => extend({}, DEFAULT_DATA)
5072 },
5073 telValidator: {
5074 type: Function,
5075 default: isMobile
5076 }
5077};
5078var stdin_default$1r = defineComponent({
5079 name: name$1h,
5080 props: addressEditProps,
5081 emits: ["save", "focus", "change", "delete", "clickArea", "changeArea", "changeDetail", "selectSearch", "changeDefault"],
5082 setup(props2, {
5083 emit,
5084 slots
5085 }) {
5086 const areaRef = ref();
5087 const data = reactive({});
5088 const showAreaPopup = ref(false);
5089 const detailFocused = ref(false);
5090 const areaListLoaded = computed(() => isObject(props2.areaList) && Object.keys(props2.areaList).length);
5091 const areaText = computed(() => {
5092 const {
5093 province,
5094 city,
5095 county,
5096 areaCode
5097 } = data;
5098 if (areaCode) {
5099 const arr = [province, city, county];
5100 if (province && province === city) {
5101 arr.splice(1, 1);
5102 }
5103 return arr.filter(Boolean).join("/");
5104 }
5105 return "";
5106 });
5107 const hideBottomFields = computed(() => {
5108 var _a;
5109 return ((_a = props2.searchResult) == null ? void 0 : _a.length) && detailFocused.value;
5110 });
5111 const onFocus = (key) => {
5112 detailFocused.value = key === "addressDetail";
5113 emit("focus", key);
5114 };
5115 const onChange = (key, value) => {
5116 emit("change", {
5117 key,
5118 value
5119 });
5120 };
5121 const rules = computed(() => {
5122 const {
5123 validator,
5124 telValidator
5125 } = props2;
5126 const makeRule = (name2, emptyMessage) => ({
5127 validator: (value) => {
5128 if (validator) {
5129 const message = validator(name2, value);
5130 if (message) {
5131 return message;
5132 }
5133 }
5134 if (!value) {
5135 return emptyMessage;
5136 }
5137 return true;
5138 }
5139 });
5140 return {
5141 name: [makeRule("name", t$i("nameEmpty"))],
5142 tel: [makeRule("tel", t$i("telInvalid")), {
5143 validator: telValidator,
5144 message: t$i("telInvalid")
5145 }],
5146 areaCode: [makeRule("areaCode", t$i("areaEmpty"))],
5147 addressDetail: [makeRule("addressDetail", t$i("addressEmpty"))]
5148 };
5149 });
5150 const onSave = () => emit("save", data);
5151 const onChangeDetail = (val) => {
5152 data.addressDetail = val;
5153 emit("changeDetail", val);
5154 };
5155 const assignAreaText = (options) => {
5156 data.province = options[0].text;
5157 data.city = options[1].text;
5158 data.county = options[2].text;
5159 };
5160 const onAreaConfirm = ({
5161 selectedValues,
5162 selectedOptions
5163 }) => {
5164 if (selectedValues.some((value) => value === AREA_EMPTY_CODE)) {
5165 showToast(t$i("areaEmpty"));
5166 } else {
5167 showAreaPopup.value = false;
5168 assignAreaText(selectedOptions);
5169 emit("changeArea", selectedOptions);
5170 }
5171 };
5172 const onDelete = () => emit("delete", data);
5173 const setAreaCode = (code) => {
5174 data.areaCode = code || "";
5175 };
5176 const onDetailBlur = () => {
5177 setTimeout(() => {
5178 detailFocused.value = false;
5179 });
5180 };
5181 const setAddressDetail = (value) => {
5182 data.addressDetail = value;
5183 };
5184 const renderSetDefaultCell = () => {
5185 if (props2.showSetDefault) {
5186 const slots2 = {
5187 "right-icon": () => createVNode(Switch, {
5188 "modelValue": data.isDefault,
5189 "onUpdate:modelValue": ($event) => data.isDefault = $event,
5190 "onChange": (event) => emit("changeDefault", event)
5191 }, null)
5192 };
5193 return withDirectives(createVNode(Cell, {
5194 "center": true,
5195 "border": false,
5196 "title": t$i("defaultAddress"),
5197 "class": bem$1d("default")
5198 }, slots2), [[vShow, !hideBottomFields.value]]);
5199 }
5200 };
5201 useExpose({
5202 setAreaCode,
5203 setAddressDetail
5204 });
5205 watch(() => props2.addressInfo, (value) => {
5206 extend(data, DEFAULT_DATA, value);
5207 nextTick(() => {
5208 var _a;
5209 const options = (_a = areaRef.value) == null ? void 0 : _a.getSelectedOptions();
5210 if (options && options.every((option) => option && option.value !== AREA_EMPTY_CODE)) {
5211 assignAreaText(options);
5212 }
5213 });
5214 }, {
5215 deep: true,
5216 immediate: true
5217 });
5218 return () => {
5219 const {
5220 disableArea
5221 } = props2;
5222 return createVNode(Form, {
5223 "class": bem$1d(),
5224 "onSubmit": onSave
5225 }, {
5226 default: () => {
5227 var _a;
5228 return [createVNode("div", {
5229 "class": bem$1d("fields")
5230 }, [createVNode(Field, {
5231 "modelValue": data.name,
5232 "onUpdate:modelValue": [($event) => data.name = $event, (val) => onChange("name", val)],
5233 "clearable": true,
5234 "label": t$i("name"),
5235 "rules": rules.value.name,
5236 "placeholder": t$i("name"),
5237 "onFocus": () => onFocus("name")
5238 }, null), createVNode(Field, {
5239 "modelValue": data.tel,
5240 "onUpdate:modelValue": [($event) => data.tel = $event, (val) => onChange("tel", val)],
5241 "clearable": true,
5242 "type": "tel",
5243 "label": t$i("tel"),
5244 "rules": rules.value.tel,
5245 "maxlength": props2.telMaxlength,
5246 "placeholder": t$i("tel"),
5247 "onFocus": () => onFocus("tel")
5248 }, null), withDirectives(createVNode(Field, {
5249 "readonly": true,
5250 "label": t$i("area"),
5251 "is-link": !disableArea,
5252 "modelValue": areaText.value,
5253 "rules": props2.showArea ? rules.value.areaCode : void 0,
5254 "placeholder": props2.areaPlaceholder || t$i("area"),
5255 "onFocus": () => onFocus("areaCode"),
5256 "onClick": () => {
5257 emit("clickArea");
5258 showAreaPopup.value = !disableArea;
5259 }
5260 }, null), [[vShow, props2.showArea]]), createVNode(stdin_default$1s, {
5261 "show": props2.showDetail,
5262 "rows": props2.detailRows,
5263 "rules": rules.value.addressDetail,
5264 "value": data.addressDetail,
5265 "focused": detailFocused.value,
5266 "maxlength": props2.detailMaxlength,
5267 "searchResult": props2.searchResult,
5268 "showSearchResult": props2.showSearchResult,
5269 "onBlur": onDetailBlur,
5270 "onFocus": () => onFocus("addressDetail"),
5271 "onInput": onChangeDetail,
5272 "onSelectSearch": (event) => emit("selectSearch", event)
5273 }, null), (_a = slots.default) == null ? void 0 : _a.call(slots)]), renderSetDefaultCell(), withDirectives(createVNode("div", {
5274 "class": bem$1d("buttons")
5275 }, [createVNode(Button, {
5276 "block": true,
5277 "round": true,
5278 "type": "primary",
5279 "text": props2.saveButtonText || t$i("save"),
5280 "class": bem$1d("button"),
5281 "loading": props2.isSaving,
5282 "nativeType": "submit"
5283 }, null), props2.showDelete && createVNode(Button, {
5284 "block": true,
5285 "round": true,
5286 "class": bem$1d("button"),
5287 "loading": props2.isDeleting,
5288 "text": props2.deleteButtonText || t$i("delete"),
5289 "onClick": onDelete
5290 }, null)]), [[vShow, !hideBottomFields.value]]), createVNode(Popup, {
5291 "show": showAreaPopup.value,
5292 "onUpdate:show": ($event) => showAreaPopup.value = $event,
5293 "round": true,
5294 "teleport": "body",
5295 "position": "bottom",
5296 "lazyRender": false
5297 }, {
5298 default: () => [createVNode(Area, {
5299 "modelValue": data.areaCode,
5300 "onUpdate:modelValue": ($event) => data.areaCode = $event,
5301 "ref": areaRef,
5302 "loading": !areaListLoaded.value,
5303 "areaList": props2.areaList,
5304 "columnsPlaceholder": props2.areaColumnsPlaceholder,
5305 "onConfirm": onAreaConfirm,
5306 "onCancel": () => {
5307 showAreaPopup.value = false;
5308 }
5309 }, null)]
5310 })];
5311 }
5312 });
5313 };
5314 }
5315});
5316const AddressEdit = withInstall(stdin_default$1r);
5317const [name$1g, bem$1c] = createNamespace("radio-group");
5318const radioGroupProps = {
5319 shape: String,
5320 disabled: Boolean,
5321 iconSize: numericProp,
5322 direction: String,
5323 modelValue: unknownProp,
5324 checkedColor: String
5325};
5326const RADIO_KEY = Symbol(name$1g);
5327var stdin_default$1q = defineComponent({
5328 name: name$1g,
5329 props: radioGroupProps,
5330 emits: ["change", "update:modelValue"],
5331 setup(props2, {
5332 emit,
5333 slots
5334 }) {
5335 const {
5336 linkChildren
5337 } = useChildren(RADIO_KEY);
5338 const updateValue = (value) => emit("update:modelValue", value);
5339 watch(() => props2.modelValue, (value) => emit("change", value));
5340 linkChildren({
5341 props: props2,
5342 updateValue
5343 });
5344 useCustomFieldValue(() => props2.modelValue);
5345 return () => {
5346 var _a;
5347 return createVNode("div", {
5348 "class": bem$1c([props2.direction]),
5349 "role": "radiogroup"
5350 }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
5351 };
5352 }
5353});
5354const RadioGroup = withInstall(stdin_default$1q);
5355const [name$1f, bem$1b] = createNamespace("checkbox-group");
5356const checkboxGroupProps = {
5357 max: numericProp,
5358 shape: makeStringProp("round"),
5359 disabled: Boolean,
5360 iconSize: numericProp,
5361 direction: String,
5362 modelValue: makeArrayProp(),
5363 checkedColor: String
5364};
5365const CHECKBOX_GROUP_KEY = Symbol(name$1f);
5366var stdin_default$1p = defineComponent({
5367 name: name$1f,
5368 props: checkboxGroupProps,
5369 emits: ["change", "update:modelValue"],
5370 setup(props2, {
5371 emit,
5372 slots
5373 }) {
5374 const {
5375 children,
5376 linkChildren
5377 } = useChildren(CHECKBOX_GROUP_KEY);
5378 const updateValue = (value) => emit("update:modelValue", value);
5379 const toggleAll = (options = {}) => {
5380 if (typeof options === "boolean") {
5381 options = {
5382 checked: options
5383 };
5384 }
5385 const {
5386 checked,
5387 skipDisabled
5388 } = options;
5389 const checkedChildren = children.filter((item) => {
5390 if (!item.props.bindGroup) {
5391 return false;
5392 }
5393 if (item.props.disabled && skipDisabled) {
5394 return item.checked.value;
5395 }
5396 return checked != null ? checked : !item.checked.value;
5397 });
5398 const names = checkedChildren.map((item) => item.name);
5399 updateValue(names);
5400 };
5401 watch(() => props2.modelValue, (value) => emit("change", value));
5402 useExpose({
5403 toggleAll
5404 });
5405 useCustomFieldValue(() => props2.modelValue);
5406 linkChildren({
5407 props: props2,
5408 updateValue
5409 });
5410 return () => {
5411 var _a;
5412 return createVNode("div", {
5413 "class": bem$1b([props2.direction])
5414 }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
5415 };
5416 }
5417});
5418const CheckboxGroup = withInstall(stdin_default$1p);
5419const [name$1e, bem$1a] = createNamespace("tag");
5420const tagProps = {
5421 size: String,
5422 mark: Boolean,
5423 show: truthProp,
5424 type: makeStringProp("default"),
5425 color: String,
5426 plain: Boolean,
5427 round: Boolean,
5428 textColor: String,
5429 closeable: Boolean
5430};
5431var stdin_default$1o = defineComponent({
5432 name: name$1e,
5433 props: tagProps,
5434 emits: ["close"],
5435 setup(props2, {
5436 slots,
5437 emit
5438 }) {
5439 const onClose = (event) => {
5440 event.stopPropagation();
5441 emit("close", event);
5442 };
5443 const getStyle = () => {
5444 if (props2.plain) {
5445 return {
5446 color: props2.textColor || props2.color,
5447 borderColor: props2.color
5448 };
5449 }
5450 return {
5451 color: props2.textColor,
5452 background: props2.color
5453 };
5454 };
5455 const renderTag = () => {
5456 var _a;
5457 const {
5458 type,
5459 mark,
5460 plain,
5461 round,
5462 size,
5463 closeable
5464 } = props2;
5465 const classes = {
5466 mark,
5467 plain,
5468 round
5469 };
5470 if (size) {
5471 classes[size] = size;
5472 }
5473 const CloseIcon = closeable && createVNode(Icon, {
5474 "name": "cross",
5475 "class": [bem$1a("close"), HAPTICS_FEEDBACK],
5476 "onClick": onClose
5477 }, null);
5478 return createVNode("span", {
5479 "style": getStyle(),
5480 "class": bem$1a([classes, type])
5481 }, [(_a = slots.default) == null ? void 0 : _a.call(slots), CloseIcon]);
5482 };
5483 return () => createVNode(Transition, {
5484 "name": props2.closeable ? "van-fade" : void 0
5485 }, {
5486 default: () => [props2.show ? renderTag() : null]
5487 });
5488 }
5489});
5490const Tag = withInstall(stdin_default$1o);
5491const checkerProps = {
5492 name: unknownProp,
5493 disabled: Boolean,
5494 iconSize: numericProp,
5495 modelValue: unknownProp,
5496 checkedColor: String,
5497 labelPosition: String,
5498 labelDisabled: Boolean
5499};
5500var stdin_default$1n = defineComponent({
5501 props: extend({}, checkerProps, {
5502 bem: makeRequiredProp(Function),
5503 role: String,
5504 shape: String,
5505 parent: Object,
5506 checked: Boolean,
5507 bindGroup: truthProp,
5508 indeterminate: {
5509 type: Boolean,
5510 default: null
5511 }
5512 }),
5513 emits: ["click", "toggle"],
5514 setup(props2, {
5515 emit,
5516 slots
5517 }) {
5518 const iconRef = ref();
5519 const getParentProp = (name2) => {
5520 if (props2.parent && props2.bindGroup) {
5521 return props2.parent.props[name2];
5522 }
5523 };
5524 const disabled = computed(() => {
5525 if (props2.parent && props2.bindGroup) {
5526 const disabled2 = getParentProp("disabled") || props2.disabled;
5527 if (props2.role === "checkbox") {
5528 const checkedCount = getParentProp("modelValue").length;
5529 const max = getParentProp("max");
5530 const overlimit = max && checkedCount >= +max;
5531 return disabled2 || overlimit && !props2.checked;
5532 }
5533 return disabled2;
5534 }
5535 return props2.disabled;
5536 });
5537 const direction = computed(() => getParentProp("direction"));
5538 const iconStyle = computed(() => {
5539 const checkedColor = props2.checkedColor || getParentProp("checkedColor");
5540 if (checkedColor && props2.checked && !disabled.value) {
5541 return {
5542 borderColor: checkedColor,
5543 backgroundColor: checkedColor
5544 };
5545 }
5546 });
5547 const shape = computed(() => {
5548 return props2.shape || getParentProp("shape") || "round";
5549 });
5550 const onClick = (event) => {
5551 const {
5552 target
5553 } = event;
5554 const icon = iconRef.value;
5555 const iconClicked = icon === target || (icon == null ? void 0 : icon.contains(target));
5556 if (!disabled.value && (iconClicked || !props2.labelDisabled)) {
5557 emit("toggle");
5558 }
5559 emit("click", event);
5560 };
5561 const renderIcon = () => {
5562 var _a, _b;
5563 const {
5564 bem: bem2,
5565 checked,
5566 indeterminate
5567 } = props2;
5568 const iconSize = props2.iconSize || getParentProp("iconSize");
5569 return createVNode("div", {
5570 "ref": iconRef,
5571 "class": bem2("icon", [shape.value, {
5572 disabled: disabled.value,
5573 checked,
5574 indeterminate
5575 }]),
5576 "style": shape.value !== "dot" ? {
5577 fontSize: addUnit(iconSize)
5578 } : {
5579 width: addUnit(iconSize),
5580 height: addUnit(iconSize),
5581 borderColor: (_a = iconStyle.value) == null ? void 0 : _a.borderColor
5582 }
5583 }, [slots.icon ? slots.icon({
5584 checked,
5585 disabled: disabled.value
5586 }) : shape.value !== "dot" ? createVNode(Icon, {
5587 "name": indeterminate ? "minus" : "success",
5588 "style": iconStyle.value
5589 }, null) : createVNode("div", {
5590 "class": bem2("icon--dot__icon"),
5591 "style": {
5592 backgroundColor: (_b = iconStyle.value) == null ? void 0 : _b.backgroundColor
5593 }
5594 }, null)]);
5595 };
5596 const renderLabel = () => {
5597 const {
5598 checked
5599 } = props2;
5600 if (slots.default) {
5601 return createVNode("span", {
5602 "class": props2.bem("label", [props2.labelPosition, {
5603 disabled: disabled.value
5604 }])
5605 }, [slots.default({
5606 checked,
5607 disabled: disabled.value
5608 })]);
5609 }
5610 };
5611 return () => {
5612 const nodes = props2.labelPosition === "left" ? [renderLabel(), renderIcon()] : [renderIcon(), renderLabel()];
5613 return createVNode("div", {
5614 "role": props2.role,
5615 "class": props2.bem([{
5616 disabled: disabled.value,
5617 "label-disabled": props2.labelDisabled
5618 }, direction.value]),
5619 "tabindex": disabled.value ? void 0 : 0,
5620 "aria-checked": props2.checked,
5621 "onClick": onClick
5622 }, [nodes]);
5623 };
5624 }
5625});
5626const radioProps = extend({}, checkerProps, {
5627 shape: String
5628});
5629const [name$1d, bem$19] = createNamespace("radio");
5630var stdin_default$1m = defineComponent({
5631 name: name$1d,
5632 props: radioProps,
5633 emits: ["update:modelValue"],
5634 setup(props2, {
5635 emit,
5636 slots
5637 }) {
5638 const {
5639 parent
5640 } = useParent(RADIO_KEY);
5641 const checked = () => {
5642 const value = parent ? parent.props.modelValue : props2.modelValue;
5643 return value === props2.name;
5644 };
5645 const toggle = () => {
5646 if (parent) {
5647 parent.updateValue(props2.name);
5648 } else {
5649 emit("update:modelValue", props2.name);
5650 }
5651 };
5652 return () => createVNode(stdin_default$1n, mergeProps({
5653 "bem": bem$19,
5654 "role": "radio",
5655 "parent": parent,
5656 "checked": checked(),
5657 "onToggle": toggle
5658 }, props2), pick(slots, ["default", "icon"]));
5659 }
5660});
5661const Radio = withInstall(stdin_default$1m);
5662const [name$1c, bem$18] = createNamespace("checkbox");
5663const checkboxProps = extend({}, checkerProps, {
5664 shape: String,
5665 bindGroup: truthProp,
5666 indeterminate: {
5667 type: Boolean,
5668 default: null
5669 }
5670});
5671var stdin_default$1l = defineComponent({
5672 name: name$1c,
5673 props: checkboxProps,
5674 emits: ["change", "update:modelValue"],
5675 setup(props2, {
5676 emit,
5677 slots
5678 }) {
5679 const {
5680 parent
5681 } = useParent(CHECKBOX_GROUP_KEY);
5682 const setParentValue = (checked2) => {
5683 const {
5684 name: name2
5685 } = props2;
5686 const {
5687 max,
5688 modelValue
5689 } = parent.props;
5690 const value = modelValue.slice();
5691 if (checked2) {
5692 const overlimit = max && value.length >= +max;
5693 if (!overlimit && !value.includes(name2)) {
5694 value.push(name2);
5695 if (props2.bindGroup) {
5696 parent.updateValue(value);
5697 }
5698 }
5699 } else {
5700 const index = value.indexOf(name2);
5701 if (index !== -1) {
5702 value.splice(index, 1);
5703 if (props2.bindGroup) {
5704 parent.updateValue(value);
5705 }
5706 }
5707 }
5708 };
5709 const checked = computed(() => {
5710 if (parent && props2.bindGroup) {
5711 return parent.props.modelValue.indexOf(props2.name) !== -1;
5712 }
5713 return !!props2.modelValue;
5714 });
5715 const toggle = (newValue = !checked.value) => {
5716 if (parent && props2.bindGroup) {
5717 setParentValue(newValue);
5718 } else {
5719 emit("update:modelValue", newValue);
5720 }
5721 if (props2.indeterminate !== null) emit("change", newValue);
5722 };
5723 watch(() => props2.modelValue, (value) => {
5724 if (props2.indeterminate === null) emit("change", value);
5725 });
5726 useExpose({
5727 toggle,
5728 props: props2,
5729 checked
5730 });
5731 useCustomFieldValue(() => props2.modelValue);
5732 return () => createVNode(stdin_default$1n, mergeProps({
5733 "bem": bem$18,
5734 "role": "checkbox",
5735 "parent": parent,
5736 "checked": checked.value,
5737 "onToggle": toggle
5738 }, props2), pick(slots, ["default", "icon"]));
5739 }
5740});
5741const Checkbox = withInstall(stdin_default$1l);
5742const [name$1b, bem$17] = createNamespace("address-item");
5743var stdin_default$1k = defineComponent({
5744 name: name$1b,
5745 props: {
5746 address: makeRequiredProp(Object),
5747 disabled: Boolean,
5748 switchable: Boolean,
5749 singleChoice: Boolean,
5750 defaultTagText: String,
5751 rightIcon: makeStringProp("edit")
5752 },
5753 emits: ["edit", "click", "select"],
5754 setup(props2, {
5755 slots,
5756 emit
5757 }) {
5758 const onClick = (event) => {
5759 if (props2.switchable) {
5760 emit("select");
5761 }
5762 emit("click", event);
5763 };
5764 const renderRightIcon = () => createVNode(Icon, {
5765 "name": props2.rightIcon,
5766 "class": bem$17("edit"),
5767 "onClick": (event) => {
5768 event.stopPropagation();
5769 emit("edit");
5770 emit("click", event);
5771 }
5772 }, null);
5773 const renderTag = () => {
5774 if (slots.tag) {
5775 return slots.tag(props2.address);
5776 }
5777 if (props2.address.isDefault && props2.defaultTagText) {
5778 return createVNode(Tag, {
5779 "type": "primary",
5780 "round": true,
5781 "class": bem$17("tag")
5782 }, {
5783 default: () => [props2.defaultTagText]
5784 });
5785 }
5786 };
5787 const renderContent = () => {
5788 const {
5789 address,
5790 disabled,
5791 switchable,
5792 singleChoice
5793 } = props2;
5794 const Info = [createVNode("div", {
5795 "class": bem$17("name")
5796 }, [`${address.name} ${address.tel}`, renderTag()]), createVNode("div", {
5797 "class": bem$17("address")
5798 }, [address.address])];
5799 if (switchable && !disabled) {
5800 if (singleChoice) {
5801 return createVNode(Radio, {
5802 "name": address.id,
5803 "iconSize": 18
5804 }, {
5805 default: () => [Info]
5806 });
5807 } else {
5808 return createVNode(Checkbox, {
5809 "name": address.id,
5810 "iconSize": 18
5811 }, {
5812 default: () => [Info]
5813 });
5814 }
5815 }
5816 return Info;
5817 };
5818 return () => {
5819 var _a;
5820 const {
5821 disabled
5822 } = props2;
5823 return createVNode("div", {
5824 "class": bem$17({
5825 disabled
5826 }),
5827 "onClick": onClick
5828 }, [createVNode(Cell, {
5829 "border": false,
5830 "titleClass": bem$17("title")
5831 }, {
5832 title: renderContent,
5833 "right-icon": renderRightIcon
5834 }), (_a = slots.bottom) == null ? void 0 : _a.call(slots, extend({}, props2.address, {
5835 disabled
5836 }))]);
5837 };
5838 }
5839});
5840const [name$1a, bem$16, t$h] = createNamespace("address-list");
5841const addressListProps = {
5842 list: makeArrayProp(),
5843 modelValue: [...numericProp, Array],
5844 switchable: truthProp,
5845 disabledText: String,
5846 disabledList: makeArrayProp(),
5847 showAddButton: truthProp,
5848 addButtonText: String,
5849 defaultTagText: String,
5850 rightIcon: makeStringProp("edit")
5851};
5852var stdin_default$1j = defineComponent({
5853 name: name$1a,
5854 props: addressListProps,
5855 emits: ["add", "edit", "select", "clickItem", "editDisabled", "selectDisabled", "update:modelValue"],
5856 setup(props2, {
5857 slots,
5858 emit
5859 }) {
5860 const singleChoice = computed(() => !Array.isArray(props2.modelValue));
5861 const renderItem = (item, index, disabled) => {
5862 const onEdit = () => emit(disabled ? "editDisabled" : "edit", item, index);
5863 const onClick = (event) => emit("clickItem", item, index, {
5864 event
5865 });
5866 const onSelect = () => {
5867 emit(disabled ? "selectDisabled" : "select", item, index);
5868 if (!disabled) {
5869 if (singleChoice.value) {
5870 emit("update:modelValue", item.id);
5871 } else {
5872 const value = props2.modelValue;
5873 if (value.includes(item.id)) {
5874 emit("update:modelValue", value.filter((id) => id !== item.id));
5875 } else {
5876 emit("update:modelValue", [...value, item.id]);
5877 }
5878 }
5879 }
5880 };
5881 return createVNode(stdin_default$1k, {
5882 "key": item.id,
5883 "address": item,
5884 "disabled": disabled,
5885 "switchable": props2.switchable,
5886 "singleChoice": singleChoice.value,
5887 "defaultTagText": props2.defaultTagText,
5888 "rightIcon": props2.rightIcon,
5889 "onEdit": onEdit,
5890 "onClick": onClick,
5891 "onSelect": onSelect
5892 }, {
5893 bottom: slots["item-bottom"],
5894 tag: slots.tag
5895 });
5896 };
5897 const renderList = (list, disabled) => {
5898 if (list) {
5899 return list.map((item, index) => renderItem(item, index, disabled));
5900 }
5901 };
5902 const renderBottom = () => props2.showAddButton ? createVNode("div", {
5903 "class": [bem$16("bottom"), "van-safe-area-bottom"]
5904 }, [createVNode(Button, {
5905 "round": true,
5906 "block": true,
5907 "type": "primary",
5908 "text": props2.addButtonText || t$h("add"),
5909 "class": bem$16("add"),
5910 "onClick": () => emit("add")
5911 }, null)]) : void 0;
5912 return () => {
5913 var _a, _b;
5914 const List2 = renderList(props2.list);
5915 const DisabledList = renderList(props2.disabledList, true);
5916 const DisabledText = props2.disabledText && createVNode("div", {
5917 "class": bem$16("disabled-text")
5918 }, [props2.disabledText]);
5919 return createVNode("div", {
5920 "class": bem$16()
5921 }, [(_a = slots.top) == null ? void 0 : _a.call(slots), !singleChoice.value && Array.isArray(props2.modelValue) ? createVNode(CheckboxGroup, {
5922 "modelValue": props2.modelValue
5923 }, {
5924 default: () => [List2]
5925 }) : createVNode(RadioGroup, {
5926 "modelValue": props2.modelValue
5927 }, {
5928 default: () => [List2]
5929 }), DisabledText, DisabledList, (_b = slots.default) == null ? void 0 : _b.call(slots), renderBottom()]);
5930 };
5931 }
5932});
5933const AddressList = withInstall(stdin_default$1j);
5934const hasIntersectionObserver = inBrowser$1 && "IntersectionObserver" in window && "IntersectionObserverEntry" in window && "intersectionRatio" in window.IntersectionObserverEntry.prototype;
5935const modeType = {
5936 event: "event",
5937 observer: "observer"
5938};
5939function remove(arr, item) {
5940 if (!arr.length) return;
5941 const index = arr.indexOf(item);
5942 if (index > -1) return arr.splice(index, 1);
5943}
5944function getBestSelectionFromSrcset(el, scale) {
5945 if (el.tagName !== "IMG" || !el.getAttribute("data-srcset")) return;
5946 let options = el.getAttribute("data-srcset");
5947 const container = el.parentNode;
5948 const containerWidth = container.offsetWidth * scale;
5949 let spaceIndex;
5950 let tmpSrc;
5951 let tmpWidth;
5952 options = options.trim().split(",");
5953 const result = options.map((item) => {
5954 item = item.trim();
5955 spaceIndex = item.lastIndexOf(" ");
5956 if (spaceIndex === -1) {
5957 tmpSrc = item;
5958 tmpWidth = 999998;
5959 } else {
5960 tmpSrc = item.substr(0, spaceIndex);
5961 tmpWidth = parseInt(
5962 item.substr(spaceIndex + 1, item.length - spaceIndex - 2),
5963 10
5964 );
5965 }
5966 return [tmpWidth, tmpSrc];
5967 });
5968 result.sort((a, b) => {
5969 if (a[0] < b[0]) {
5970 return 1;
5971 }
5972 if (a[0] > b[0]) {
5973 return -1;
5974 }
5975 if (a[0] === b[0]) {
5976 if (b[1].indexOf(".webp", b[1].length - 5) !== -1) {
5977 return 1;
5978 }
5979 if (a[1].indexOf(".webp", a[1].length - 5) !== -1) {
5980 return -1;
5981 }
5982 }
5983 return 0;
5984 });
5985 let bestSelectedSrc = "";
5986 let tmpOption;
5987 for (let i = 0; i < result.length; i++) {
5988 tmpOption = result[i];
5989 bestSelectedSrc = tmpOption[1];
5990 const next = result[i + 1];
5991 if (next && next[0] < containerWidth) {
5992 bestSelectedSrc = tmpOption[1];
5993 break;
5994 } else if (!next) {
5995 bestSelectedSrc = tmpOption[1];
5996 break;
5997 }
5998 }
5999 return bestSelectedSrc;
6000}
6001const getDPR = (scale = 1) => inBrowser$1 ? window.devicePixelRatio || scale : scale;
6002function supportWebp() {
6003 if (!inBrowser$1) return false;
6004 let support = true;
6005 try {
6006 const elem = document.createElement("canvas");
6007 if (elem.getContext && elem.getContext("2d")) {
6008 support = elem.toDataURL("image/webp").indexOf("data:image/webp") === 0;
6009 }
6010 } catch (err) {
6011 support = false;
6012 }
6013 return support;
6014}
6015function throttle(action, delay) {
6016 let timeout = null;
6017 let lastRun = 0;
6018 return function(...args) {
6019 if (timeout) {
6020 return;
6021 }
6022 const elapsed = Date.now() - lastRun;
6023 const runCallback = () => {
6024 lastRun = Date.now();
6025 timeout = false;
6026 action.apply(this, args);
6027 };
6028 if (elapsed >= delay) {
6029 runCallback();
6030 } else {
6031 timeout = setTimeout(runCallback, delay);
6032 }
6033 };
6034}
6035function on(el, type, func) {
6036 el.addEventListener(type, func, {
6037 capture: false,
6038 passive: true
6039 });
6040}
6041function off(el, type, func) {
6042 el.removeEventListener(type, func, false);
6043}
6044const loadImageAsync = (item, resolve, reject) => {
6045 const image = new Image();
6046 if (!item || !item.src) {
6047 return reject(new Error("image src is required"));
6048 }
6049 image.src = item.src;
6050 if (item.cors) {
6051 image.crossOrigin = item.cors;
6052 }
6053 image.onload = () => resolve({
6054 naturalHeight: image.naturalHeight,
6055 naturalWidth: image.naturalWidth,
6056 src: image.src
6057 });
6058 image.onerror = (e) => reject(e);
6059};
6060class ImageCache {
6061 constructor({ max }) {
6062 this.options = {
6063 max: max || 100
6064 };
6065 this.caches = [];
6066 }
6067 has(key) {
6068 return this.caches.indexOf(key) > -1;
6069 }
6070 add(key) {
6071 if (this.has(key)) return;
6072 this.caches.push(key);
6073 if (this.caches.length > this.options.max) {
6074 this.free();
6075 }
6076 }
6077 free() {
6078 this.caches.shift();
6079 }
6080}
6081const [name$19, bem$15] = createNamespace("back-top");
6082const backTopProps = {
6083 right: numericProp,
6084 bottom: numericProp,
6085 zIndex: numericProp,
6086 target: [String, Object],
6087 offset: makeNumericProp(200),
6088 immediate: Boolean,
6089 teleport: {
6090 type: [String, Object],
6091 default: "body"
6092 }
6093};
6094var stdin_default$1i = defineComponent({
6095 name: name$19,
6096 inheritAttrs: false,
6097 props: backTopProps,
6098 emits: ["click"],
6099 setup(props2, {
6100 emit,
6101 slots,
6102 attrs
6103 }) {
6104 let shouldReshow = false;
6105 const show = ref(false);
6106 const root = ref();
6107 const scrollParent = ref();
6108 const style = computed(() => extend(getZIndexStyle(props2.zIndex), {
6109 right: addUnit(props2.right),
6110 bottom: addUnit(props2.bottom)
6111 }));
6112 const onClick = (event) => {
6113 var _a;
6114 emit("click", event);
6115 (_a = scrollParent.value) == null ? void 0 : _a.scrollTo({
6116 top: 0,
6117 behavior: props2.immediate ? "auto" : "smooth"
6118 });
6119 };
6120 const scroll = () => {
6121 show.value = scrollParent.value ? getScrollTop(scrollParent.value) >= +props2.offset : false;
6122 };
6123 const getTarget = () => {
6124 const {
6125 target
6126 } = props2;
6127 if (typeof target === "string") {
6128 const el = document.querySelector(target);
6129 if (el) {
6130 return el;
6131 }
6132 if (process.env.NODE_ENV !== "production") {
6133 console.error(`[Vant] BackTop: target element "${target}" was not found, the BackTop component will not be rendered.`);
6134 }
6135 } else {
6136 return target;
6137 }
6138 };
6139 const updateTarget = () => {
6140 if (inBrowser) {
6141 nextTick(() => {
6142 scrollParent.value = props2.target ? getTarget() : getScrollParent(root.value);
6143 scroll();
6144 });
6145 }
6146 };
6147 useEventListener("scroll", throttle(scroll, 100), {
6148 target: scrollParent
6149 });
6150 onMounted(updateTarget);
6151 onActivated(() => {
6152 if (shouldReshow) {
6153 show.value = true;
6154 shouldReshow = false;
6155 }
6156 });
6157 onDeactivated(() => {
6158 if (show.value && props2.teleport) {
6159 show.value = false;
6160 shouldReshow = true;
6161 }
6162 });
6163 watch(() => props2.target, updateTarget);
6164 return () => {
6165 const Content = createVNode("div", mergeProps({
6166 "ref": !props2.teleport ? root : void 0,
6167 "class": bem$15({
6168 active: show.value
6169 }),
6170 "style": style.value,
6171 "onClick": onClick
6172 }, attrs), [slots.default ? slots.default() : createVNode(Icon, {
6173 "name": "back-top",
6174 "class": bem$15("icon")
6175 }, null)]);
6176 if (props2.teleport) {
6177 return [createVNode("div", {
6178 "ref": root,
6179 "class": bem$15("placeholder")
6180 }, null), createVNode(Teleport, {
6181 "to": props2.teleport
6182 }, {
6183 default: () => [Content]
6184 })];
6185 }
6186 return Content;
6187 };
6188 }
6189});
6190const BackTop = withInstall(stdin_default$1i);
6191var __async = (__this, __arguments, generator) => {
6192 return new Promise((resolve, reject) => {
6193 var fulfilled = (value) => {
6194 try {
6195 step(generator.next(value));
6196 } catch (e) {
6197 reject(e);
6198 }
6199 };
6200 var rejected = (value) => {
6201 try {
6202 step(generator.throw(value));
6203 } catch (e) {
6204 reject(e);
6205 }
6206 };
6207 var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
6208 step((generator = generator.apply(__this, __arguments)).next());
6209 });
6210};
6211const barrageProps = {
6212 top: makeNumericProp(10),
6213 rows: makeNumericProp(4),
6214 duration: makeNumericProp(4e3),
6215 autoPlay: truthProp,
6216 delay: makeNumberProp(300),
6217 modelValue: makeArrayProp()
6218};
6219const [name$18, bem$14] = createNamespace("barrage");
6220var stdin_default$1h = defineComponent({
6221 name: name$18,
6222 props: barrageProps,
6223 emits: ["update:modelValue"],
6224 setup(props2, {
6225 emit,
6226 slots
6227 }) {
6228 const barrageWrapper = ref();
6229 const className = bem$14("item");
6230 const total = ref(0);
6231 const barrageItems = [];
6232 const createBarrageItem = (text, delay = props2.delay) => {
6233 const item = document.createElement("span");
6234 item.className = className;
6235 item.innerText = String(text);
6236 item.style.animationDuration = `${props2.duration}ms`;
6237 item.style.animationDelay = `${delay}ms`;
6238 item.style.animationName = "van-barrage";
6239 item.style.animationTimingFunction = "linear";
6240 return item;
6241 };
6242 const isInitBarrage = ref(true);
6243 const isPlay = ref(props2.autoPlay);
6244 const appendBarrageItem = ({
6245 id,
6246 text
6247 }, i) => {
6248 var _a;
6249 const item = createBarrageItem(text, isInitBarrage.value ? i * props2.delay : void 0);
6250 if (!props2.autoPlay && isPlay.value === false) {
6251 item.style.animationPlayState = "paused";
6252 }
6253 (_a = barrageWrapper.value) == null ? void 0 : _a.append(item);
6254 total.value++;
6255 const top = (total.value - 1) % +props2.rows * item.offsetHeight + +props2.top;
6256 item.style.top = `${top}px`;
6257 item.dataset.id = String(id);
6258 barrageItems.push(item);
6259 item.addEventListener("animationend", () => {
6260 emit("update:modelValue", [...props2.modelValue].filter((v) => String(v.id) !== item.dataset.id));
6261 });
6262 };
6263 const updateBarrages = (newValue, oldValue) => {
6264 const map = new Map(oldValue.map((item) => [item.id, item]));
6265 newValue.forEach((item, i) => {
6266 if (map.has(item.id)) {
6267 map.delete(item.id);
6268 } else {
6269 appendBarrageItem(item, i);
6270 }
6271 });
6272 map.forEach((item) => {
6273 const index = barrageItems.findIndex((span) => span.dataset.id === String(item.id));
6274 if (index > -1) {
6275 barrageItems[index].remove();
6276 barrageItems.splice(index, 1);
6277 }
6278 });
6279 isInitBarrage.value = false;
6280 };
6281 watch(() => props2.modelValue.slice(), (newValue, oldValue) => updateBarrages(newValue != null ? newValue : [], oldValue != null ? oldValue : []), {
6282 deep: true
6283 });
6284 const rootStyle = ref({});
6285 onMounted(() => __async(this, null, function* () {
6286 var _a;
6287 rootStyle.value["--move-distance"] = `-${(_a = barrageWrapper.value) == null ? void 0 : _a.offsetWidth}px`;
6288 yield nextTick();
6289 updateBarrages(props2.modelValue, []);
6290 }));
6291 const play = () => {
6292 isPlay.value = true;
6293 barrageItems.forEach((item) => {
6294 item.style.animationPlayState = "running";
6295 });
6296 };
6297 const pause = () => {
6298 isPlay.value = false;
6299 barrageItems.forEach((item) => {
6300 item.style.animationPlayState = "paused";
6301 });
6302 };
6303 useExpose({
6304 play,
6305 pause
6306 });
6307 return () => {
6308 var _a;
6309 return createVNode("div", {
6310 "class": bem$14(),
6311 "ref": barrageWrapper,
6312 "style": rootStyle.value
6313 }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
6314 };
6315 }
6316});
6317const Barrage = withInstall(stdin_default$1h);
6318const [name$17, bem$13, t$g] = createNamespace("calendar");
6319const formatMonthTitle = (date) => t$g("monthTitle", date.getFullYear(), date.getMonth() + 1);
6320function compareMonth(date1, date2) {
6321 const year1 = date1.getFullYear();
6322 const year2 = date2.getFullYear();
6323 if (year1 === year2) {
6324 const month1 = date1.getMonth();
6325 const month2 = date2.getMonth();
6326 return month1 === month2 ? 0 : month1 > month2 ? 1 : -1;
6327 }
6328 return year1 > year2 ? 1 : -1;
6329}
6330function compareDay(day1, day2) {
6331 const compareMonthResult = compareMonth(day1, day2);
6332 if (compareMonthResult === 0) {
6333 const date1 = day1.getDate();
6334 const date2 = day2.getDate();
6335 return date1 === date2 ? 0 : date1 > date2 ? 1 : -1;
6336 }
6337 return compareMonthResult;
6338}
6339const cloneDate = (date) => new Date(date);
6340const cloneDates = (dates) => Array.isArray(dates) ? dates.map(cloneDate) : cloneDate(dates);
6341function getDayByOffset(date, offset) {
6342 const cloned = cloneDate(date);
6343 cloned.setDate(cloned.getDate() + offset);
6344 return cloned;
6345}
6346function getMonthByOffset(date, offset) {
6347 const cloned = cloneDate(date);
6348 cloned.setMonth(cloned.getMonth() + offset);
6349 if (cloned.getDate() !== date.getDate()) {
6350 cloned.setDate(0);
6351 }
6352 return cloned;
6353}
6354function getYearByOffset(date, offset) {
6355 const cloned = cloneDate(date);
6356 cloned.setFullYear(cloned.getFullYear() + offset);
6357 if (cloned.getDate() !== date.getDate()) {
6358 cloned.setDate(0);
6359 }
6360 return cloned;
6361}
6362const getPrevDay = (date) => getDayByOffset(date, -1);
6363const getNextDay = (date) => getDayByOffset(date, 1);
6364const getPrevMonth = (date) => getMonthByOffset(date, -1);
6365const getNextMonth = (date) => getMonthByOffset(date, 1);
6366const getPrevYear = (date) => getYearByOffset(date, -1);
6367const getNextYear = (date) => getYearByOffset(date, 1);
6368const getToday = () => {
6369 const today = /* @__PURE__ */ new Date();
6370 today.setHours(0, 0, 0, 0);
6371 return today;
6372};
6373function calcDateNum(date) {
6374 const day1 = date[0].getTime();
6375 const day2 = date[1].getTime();
6376 return (day2 - day1) / (1e3 * 60 * 60 * 24) + 1;
6377}
6378const sharedProps = extend({}, pickerSharedProps, {
6379 modelValue: makeArrayProp(),
6380 filter: Function,
6381 formatter: {
6382 type: Function,
6383 default: (type, option) => option
6384 }
6385});
6386const pickerInheritKeys = Object.keys(pickerSharedProps);
6387function times(n, iteratee) {
6388 if (n < 0) {
6389 return [];
6390 }
6391 const result = Array(n);
6392 let index = -1;
6393 while (++index < n) {
6394 result[index] = iteratee(index);
6395 }
6396 return result;
6397}
6398const getMonthEndDay = (year, month) => 32 - new Date(year, month - 1, 32).getDate();
6399const genOptions = (min, max, type, formatter, filter, values) => {
6400 const options = times(max - min + 1, (index) => {
6401 const value = padZero(min + index);
6402 return formatter(type, {
6403 text: value,
6404 value
6405 });
6406 });
6407 return filter ? filter(type, options, values) : options;
6408};
6409const formatValueRange = (values, columns) => values.map((value, index) => {
6410 const column = columns[index];
6411 if (column.length) {
6412 const minValue = +column[0].value;
6413 const maxValue = +column[column.length - 1].value;
6414 return padZero(clamp(+value, minValue, maxValue));
6415 }
6416 return value;
6417});
6418const [name$16] = createNamespace("calendar-day");
6419var stdin_default$1g = defineComponent({
6420 name: name$16,
6421 props: {
6422 item: makeRequiredProp(Object),
6423 color: String,
6424 index: Number,
6425 offset: makeNumberProp(0),
6426 rowHeight: String
6427 },
6428 emits: ["click", "clickDisabledDate"],
6429 setup(props2, {
6430 emit,
6431 slots
6432 }) {
6433 const style = computed(() => {
6434 var _a;
6435 const {
6436 item,
6437 index,
6438 color,
6439 offset,
6440 rowHeight
6441 } = props2;
6442 const style2 = {
6443 height: rowHeight
6444 };
6445 if (item.type === "placeholder") {
6446 style2.width = "100%";
6447 return style2;
6448 }
6449 if (index === 0) {
6450 style2.marginLeft = `${100 * offset / 7}%`;
6451 }
6452 if (color) {
6453 switch (item.type) {
6454 case "end":
6455 case "start":
6456 case "start-end":
6457 case "multiple-middle":
6458 case "multiple-selected":
6459 style2.background = color;
6460 break;
6461 case "middle":
6462 style2.color = color;
6463 break;
6464 }
6465 }
6466 if (offset + (((_a = item.date) == null ? void 0 : _a.getDate()) || 1) > 28) {
6467 style2.marginBottom = 0;
6468 }
6469 return style2;
6470 });
6471 const onClick = () => {
6472 if (props2.item.type !== "disabled") {
6473 emit("click", props2.item);
6474 } else {
6475 emit("clickDisabledDate", props2.item);
6476 }
6477 };
6478 const renderTopInfo = () => {
6479 const {
6480 topInfo
6481 } = props2.item;
6482 if (topInfo || slots["top-info"]) {
6483 return createVNode("div", {
6484 "class": bem$13("top-info")
6485 }, [slots["top-info"] ? slots["top-info"](props2.item) : topInfo]);
6486 }
6487 };
6488 const renderBottomInfo = () => {
6489 const {
6490 bottomInfo
6491 } = props2.item;
6492 if (bottomInfo || slots["bottom-info"]) {
6493 return createVNode("div", {
6494 "class": bem$13("bottom-info")
6495 }, [slots["bottom-info"] ? slots["bottom-info"](props2.item) : bottomInfo]);
6496 }
6497 };
6498 const renderText = () => {
6499 return slots.text ? slots.text(props2.item) : props2.item.text;
6500 };
6501 const renderContent = () => {
6502 const {
6503 item,
6504 color,
6505 rowHeight
6506 } = props2;
6507 const {
6508 type
6509 } = item;
6510 const Nodes = [renderTopInfo(), renderText(), renderBottomInfo()];
6511 if (type === "selected") {
6512 return createVNode("div", {
6513 "class": bem$13("selected-day"),
6514 "style": {
6515 width: rowHeight,
6516 height: rowHeight,
6517 background: color
6518 }
6519 }, [Nodes]);
6520 }
6521 return Nodes;
6522 };
6523 return () => {
6524 const {
6525 type,
6526 className
6527 } = props2.item;
6528 if (type === "placeholder") {
6529 return createVNode("div", {
6530 "class": bem$13("day"),
6531 "style": style.value
6532 }, null);
6533 }
6534 return createVNode("div", {
6535 "role": "gridcell",
6536 "style": style.value,
6537 "class": [bem$13("day", type), className],
6538 "tabindex": type === "disabled" ? void 0 : -1,
6539 "onClick": onClick
6540 }, [renderContent()]);
6541 };
6542 }
6543});
6544const [name$15] = createNamespace("calendar-month");
6545const calendarMonthProps = {
6546 date: makeRequiredProp(Date),
6547 type: String,
6548 color: String,
6549 minDate: Date,
6550 maxDate: Date,
6551 showMark: Boolean,
6552 rowHeight: numericProp,
6553 formatter: Function,
6554 lazyRender: Boolean,
6555 currentDate: [Date, Array],
6556 allowSameDay: Boolean,
6557 showSubtitle: Boolean,
6558 showMonthTitle: Boolean,
6559 firstDayOfWeek: Number
6560};
6561var stdin_default$1f = defineComponent({
6562 name: name$15,
6563 props: calendarMonthProps,
6564 emits: ["click", "clickDisabledDate"],
6565 setup(props2, {
6566 emit,
6567 slots
6568 }) {
6569 const [visible, setVisible] = useToggle();
6570 const daysRef = ref();
6571 const monthRef = ref();
6572 const height = useHeight(monthRef);
6573 const title = computed(() => formatMonthTitle(props2.date));
6574 const rowHeight = computed(() => addUnit(props2.rowHeight));
6575 const offset = computed(() => {
6576 const date = props2.date.getDate();
6577 const day = props2.date.getDay();
6578 const realDay = (day - date % 7 + 8) % 7;
6579 if (props2.firstDayOfWeek) {
6580 return (realDay + 7 - props2.firstDayOfWeek) % 7;
6581 }
6582 return realDay;
6583 });
6584 const totalDay = computed(() => getMonthEndDay(props2.date.getFullYear(), props2.date.getMonth() + 1));
6585 const shouldRender = computed(() => visible.value || !props2.lazyRender);
6586 const getTitle = () => title.value;
6587 const getMultipleDayType = (day) => {
6588 const isSelected = (date) => props2.currentDate.some((item) => compareDay(item, date) === 0);
6589 if (isSelected(day)) {
6590 const prevDay = getPrevDay(day);
6591 const nextDay = getNextDay(day);
6592 const prevSelected = isSelected(prevDay);
6593 const nextSelected = isSelected(nextDay);
6594 if (prevSelected && nextSelected) {
6595 return "multiple-middle";
6596 }
6597 if (prevSelected) {
6598 return "end";
6599 }
6600 if (nextSelected) {
6601 return "start";
6602 }
6603 return "multiple-selected";
6604 }
6605 return "";
6606 };
6607 const getRangeDayType = (day) => {
6608 const [startDay, endDay] = props2.currentDate;
6609 if (!startDay) {
6610 return "";
6611 }
6612 const compareToStart = compareDay(day, startDay);
6613 if (!endDay) {
6614 return compareToStart === 0 ? "start" : "";
6615 }
6616 const compareToEnd = compareDay(day, endDay);
6617 if (props2.allowSameDay && compareToStart === 0 && compareToEnd === 0) {
6618 return "start-end";
6619 }
6620 if (compareToStart === 0) {
6621 return "start";
6622 }
6623 if (compareToEnd === 0) {
6624 return "end";
6625 }
6626 if (compareToStart > 0 && compareToEnd < 0) {
6627 return "middle";
6628 }
6629 return "";
6630 };
6631 const getDayType = (day) => {
6632 const {
6633 type,
6634 minDate,
6635 maxDate,
6636 currentDate
6637 } = props2;
6638 if (minDate && compareDay(day, minDate) < 0 || maxDate && compareDay(day, maxDate) > 0) {
6639 return "disabled";
6640 }
6641 if (currentDate === null) {
6642 return "";
6643 }
6644 if (Array.isArray(currentDate)) {
6645 if (type === "multiple") {
6646 return getMultipleDayType(day);
6647 }
6648 if (type === "range") {
6649 return getRangeDayType(day);
6650 }
6651 } else if (type === "single") {
6652 return compareDay(day, currentDate) === 0 ? "selected" : "";
6653 }
6654 return "";
6655 };
6656 const getBottomInfo = (dayType) => {
6657 if (props2.type === "range") {
6658 if (dayType === "start" || dayType === "end") {
6659 return t$g(dayType);
6660 }
6661 if (dayType === "start-end") {
6662 return `${t$g("start")}/${t$g("end")}`;
6663 }
6664 }
6665 };
6666 const renderTitle = () => {
6667 if (props2.showMonthTitle) {
6668 return createVNode("div", {
6669 "class": bem$13("month-title")
6670 }, [slots["month-title"] ? slots["month-title"]({
6671 date: props2.date,
6672 text: title.value
6673 }) : title.value]);
6674 }
6675 };
6676 const renderMark = () => {
6677 if (props2.showMark && shouldRender.value) {
6678 return createVNode("div", {
6679 "class": bem$13("month-mark")
6680 }, [props2.date.getMonth() + 1]);
6681 }
6682 };
6683 const placeholders = computed(() => {
6684 const count = Math.ceil((totalDay.value + offset.value) / 7);
6685 return Array(count).fill({
6686 type: "placeholder"
6687 });
6688 });
6689 const days = computed(() => {
6690 const days2 = [];
6691 const year = props2.date.getFullYear();
6692 const month = props2.date.getMonth();
6693 for (let day = 1; day <= totalDay.value; day++) {
6694 const date = new Date(year, month, day);
6695 const type = getDayType(date);
6696 let config = {
6697 date,
6698 type,
6699 text: day,
6700 bottomInfo: getBottomInfo(type)
6701 };
6702 if (props2.formatter) {
6703 config = props2.formatter(config);
6704 }
6705 days2.push(config);
6706 }
6707 return days2;
6708 });
6709 const disabledDays = computed(() => days.value.filter((day) => day.type === "disabled"));
6710 const scrollToDate = (body, targetDate) => {
6711 if (daysRef.value) {
6712 const daysRect = useRect(daysRef.value);
6713 const totalRows = placeholders.value.length;
6714 const currentRow = Math.ceil((targetDate.getDate() + offset.value) / 7);
6715 const rowOffset = (currentRow - 1) * daysRect.height / totalRows;
6716 setScrollTop(body, daysRect.top + rowOffset + body.scrollTop - useRect(body).top);
6717 }
6718 };
6719 const renderDay = (item, index) => createVNode(stdin_default$1g, {
6720 "item": item,
6721 "index": index,
6722 "color": props2.color,
6723 "offset": offset.value,
6724 "rowHeight": rowHeight.value,
6725 "onClick": (item2) => emit("click", item2),
6726 "onClickDisabledDate": (item2) => emit("clickDisabledDate", item2)
6727 }, pick(slots, ["top-info", "bottom-info", "text"]));
6728 const renderDays = () => createVNode("div", {
6729 "ref": daysRef,
6730 "role": "grid",
6731 "class": bem$13("days")
6732 }, [renderMark(), (shouldRender.value ? days : placeholders).value.map(renderDay)]);
6733 useExpose({
6734 getTitle,
6735 getHeight: () => height.value,
6736 setVisible,
6737 scrollToDate,
6738 disabledDays
6739 });
6740 return () => createVNode("div", {
6741 "class": bem$13("month"),
6742 "ref": monthRef
6743 }, [renderTitle(), renderDays()]);
6744 }
6745});
6746const [name$14] = createNamespace("calendar-header");
6747var stdin_default$1e = defineComponent({
6748 name: name$14,
6749 props: {
6750 date: Date,
6751 minDate: Date,
6752 maxDate: Date,
6753 title: String,
6754 subtitle: String,
6755 showTitle: Boolean,
6756 showSubtitle: Boolean,
6757 firstDayOfWeek: Number,
6758 switchMode: makeStringProp("none")
6759 },
6760 emits: ["clickSubtitle", "panelChange"],
6761 setup(props2, {
6762 slots,
6763 emit
6764 }) {
6765 const prevMonthDisabled = computed(() => props2.date && props2.minDate && compareMonth(getPrevMonth(props2.date), props2.minDate) < 0);
6766 const prevYearDisabled = computed(() => props2.date && props2.minDate && compareMonth(getPrevYear(props2.date), props2.minDate) < 0);
6767 const nextMonthDisabled = computed(() => props2.date && props2.maxDate && compareMonth(getNextMonth(props2.date), props2.maxDate) > 0);
6768 const nextYearDisabled = computed(() => props2.date && props2.maxDate && compareMonth(getNextYear(props2.date), props2.maxDate) > 0);
6769 const renderTitle = () => {
6770 if (props2.showTitle) {
6771 const text = props2.title || t$g("title");
6772 const title = slots.title ? slots.title() : text;
6773 return createVNode("div", {
6774 "class": bem$13("header-title")
6775 }, [title]);
6776 }
6777 };
6778 const onClickSubtitle = (event) => emit("clickSubtitle", event);
6779 const onPanelChange = (date) => emit("panelChange", date);
6780 const renderAction = (isNext) => {
6781 const showYearAction = props2.switchMode === "year-month";
6782 const monthSlot = slots[isNext ? "next-month" : "prev-month"];
6783 const yearSlot = slots[isNext ? "next-year" : "prev-year"];
6784 const monthDisabled = isNext ? nextMonthDisabled.value : prevMonthDisabled.value;
6785 const yearDisabled = isNext ? nextYearDisabled.value : prevYearDisabled.value;
6786 const monthIconName = isNext ? "arrow" : "arrow-left";
6787 const yearIconName = isNext ? "arrow-double-right" : "arrow-double-left";
6788 const onMonthChange = () => onPanelChange((isNext ? getNextMonth : getPrevMonth)(props2.date));
6789 const onYearChange = () => onPanelChange((isNext ? getNextYear : getPrevYear)(props2.date));
6790 const MonthAction = createVNode("view", {
6791 "class": bem$13("header-action", {
6792 disabled: monthDisabled
6793 }),
6794 "onClick": monthDisabled ? void 0 : onMonthChange
6795 }, [monthSlot ? monthSlot({
6796 disabled: monthDisabled
6797 }) : createVNode(Icon, {
6798 "class": {
6799 [HAPTICS_FEEDBACK]: !monthDisabled
6800 },
6801 "name": monthIconName
6802 }, null)]);
6803 const YearAction = showYearAction && createVNode("view", {
6804 "class": bem$13("header-action", {
6805 disabled: yearDisabled
6806 }),
6807 "onClick": yearDisabled ? void 0 : onYearChange
6808 }, [yearSlot ? yearSlot({
6809 disabled: yearDisabled
6810 }) : createVNode(Icon, {
6811 "class": {
6812 [HAPTICS_FEEDBACK]: !yearDisabled
6813 },
6814 "name": yearIconName
6815 }, null)]);
6816 return isNext ? [MonthAction, YearAction] : [YearAction, MonthAction];
6817 };
6818 const renderSubtitle = () => {
6819 if (props2.showSubtitle) {
6820 const title = slots.subtitle ? slots.subtitle({
6821 date: props2.date,
6822 text: props2.subtitle
6823 }) : props2.subtitle;
6824 const canSwitch = props2.switchMode !== "none";
6825 return createVNode("div", {
6826 "class": bem$13("header-subtitle", {
6827 "with-swicth": canSwitch
6828 }),
6829 "onClick": onClickSubtitle
6830 }, [canSwitch ? [renderAction(), createVNode("div", {
6831 "class": bem$13("header-subtitle-text")
6832 }, [title]), renderAction(true)] : title]);
6833 }
6834 };
6835 const renderWeekDays = () => {
6836 const {
6837 firstDayOfWeek
6838 } = props2;
6839 const weekdays = t$g("weekdays");
6840 const renderWeekDays2 = [...weekdays.slice(firstDayOfWeek, 7), ...weekdays.slice(0, firstDayOfWeek)];
6841 return createVNode("div", {
6842 "class": bem$13("weekdays")
6843 }, [renderWeekDays2.map((text) => createVNode("span", {
6844 "class": bem$13("weekday")
6845 }, [text]))]);
6846 };
6847 return () => createVNode("div", {
6848 "class": bem$13("header")
6849 }, [renderTitle(), renderSubtitle(), renderWeekDays()]);
6850 }
6851});
6852const calendarProps = {
6853 show: Boolean,
6854 type: makeStringProp("single"),
6855 switchMode: makeStringProp("none"),
6856 title: String,
6857 color: String,
6858 round: truthProp,
6859 readonly: Boolean,
6860 poppable: truthProp,
6861 maxRange: makeNumericProp(null),
6862 position: makeStringProp("bottom"),
6863 teleport: [String, Object],
6864 showMark: truthProp,
6865 showTitle: truthProp,
6866 formatter: Function,
6867 rowHeight: numericProp,
6868 confirmText: String,
6869 rangePrompt: String,
6870 lazyRender: truthProp,
6871 showConfirm: truthProp,
6872 defaultDate: [Date, Array],
6873 allowSameDay: Boolean,
6874 showSubtitle: truthProp,
6875 closeOnPopstate: truthProp,
6876 showRangePrompt: truthProp,
6877 confirmDisabledText: String,
6878 closeOnClickOverlay: truthProp,
6879 safeAreaInsetTop: Boolean,
6880 safeAreaInsetBottom: truthProp,
6881 minDate: {
6882 type: Date,
6883 validator: isDate
6884 },
6885 maxDate: {
6886 type: Date,
6887 validator: isDate
6888 },
6889 firstDayOfWeek: {
6890 type: numericProp,
6891 default: 0,
6892 validator: (val) => val >= 0 && val <= 6
6893 }
6894};
6895var stdin_default$1d = defineComponent({
6896 name: name$17,
6897 props: calendarProps,
6898 emits: ["select", "confirm", "unselect", "monthShow", "overRange", "update:show", "clickSubtitle", "clickDisabledDate", "panelChange"],
6899 setup(props2, {
6900 emit,
6901 slots
6902 }) {
6903 const canSwitch = computed(() => props2.switchMode !== "none");
6904 const minDate = computed(() => {
6905 if (!props2.minDate && !canSwitch.value) {
6906 return getToday();
6907 }
6908 return props2.minDate;
6909 });
6910 const maxDate = computed(() => {
6911 if (!props2.maxDate && !canSwitch.value) {
6912 return getMonthByOffset(getToday(), 6);
6913 }
6914 return props2.maxDate;
6915 });
6916 const limitDateRange = (date, min = minDate.value, max = maxDate.value) => {
6917 if (min && compareDay(date, min) === -1) {
6918 return min;
6919 }
6920 if (max && compareDay(date, max) === 1) {
6921 return max;
6922 }
6923 return date;
6924 };
6925 const getInitialDate = (defaultDate = props2.defaultDate) => {
6926 const {
6927 type,
6928 allowSameDay
6929 } = props2;
6930 if (defaultDate === null) {
6931 return defaultDate;
6932 }
6933 const now = getToday();
6934 if (type === "range") {
6935 if (!Array.isArray(defaultDate)) {
6936 defaultDate = [];
6937 }
6938 if (defaultDate.length === 1 && compareDay(defaultDate[0], now) === 1) {
6939 defaultDate = [];
6940 }
6941 const min = minDate.value;
6942 const max = maxDate.value;
6943 const start = limitDateRange(defaultDate[0] || now, min, max ? allowSameDay ? max : getPrevDay(max) : void 0);
6944 const end = limitDateRange(defaultDate[1] || (allowSameDay ? now : getNextDay(now)), min ? allowSameDay ? min : getNextDay(min) : void 0);
6945 return [start, end];
6946 }
6947 if (type === "multiple") {
6948 if (Array.isArray(defaultDate)) {
6949 return defaultDate.map((date) => limitDateRange(date));
6950 }
6951 return [limitDateRange(now)];
6952 }
6953 if (!defaultDate || Array.isArray(defaultDate)) {
6954 defaultDate = now;
6955 }
6956 return limitDateRange(defaultDate);
6957 };
6958 const getInitialPanelDate = () => {
6959 const date = Array.isArray(currentDate.value) ? currentDate.value[0] : currentDate.value;
6960 return date ? date : limitDateRange(getToday());
6961 };
6962 let bodyHeight;
6963 const bodyRef = ref();
6964 const currentDate = ref(getInitialDate());
6965 const currentPanelDate = ref(getInitialPanelDate());
6966 const currentMonthRef = ref();
6967 const [monthRefs, setMonthRefs] = useRefs();
6968 const dayOffset = computed(() => props2.firstDayOfWeek ? +props2.firstDayOfWeek % 7 : 0);
6969 const months = computed(() => {
6970 const months2 = [];
6971 if (!minDate.value || !maxDate.value) {
6972 return months2;
6973 }
6974 const cursor = new Date(minDate.value);
6975 cursor.setDate(1);
6976 do {
6977 months2.push(new Date(cursor));
6978 cursor.setMonth(cursor.getMonth() + 1);
6979 } while (compareMonth(cursor, maxDate.value) !== 1);
6980 return months2;
6981 });
6982 const buttonDisabled = computed(() => {
6983 if (currentDate.value) {
6984 if (props2.type === "range") {
6985 return !currentDate.value[0] || !currentDate.value[1];
6986 }
6987 if (props2.type === "multiple") {
6988 return !currentDate.value.length;
6989 }
6990 }
6991 return !currentDate.value;
6992 });
6993 const getSelectedDate = () => currentDate.value;
6994 const onScroll = () => {
6995 const top = getScrollTop(bodyRef.value);
6996 const bottom = top + bodyHeight;
6997 const heights = months.value.map((item, index) => monthRefs.value[index].getHeight());
6998 const heightSum = heights.reduce((a, b) => a + b, 0);
6999 if (bottom > heightSum && top > 0) {
7000 return;
7001 }
7002 let height = 0;
7003 let currentMonth;
7004 const visibleRange = [-1, -1];
7005 for (let i = 0; i < months.value.length; i++) {
7006 const month = monthRefs.value[i];
7007 const visible = height <= bottom && height + heights[i] >= top;
7008 if (visible) {
7009 visibleRange[1] = i;
7010 if (!currentMonth) {
7011 currentMonth = month;
7012 visibleRange[0] = i;
7013 }
7014 if (!monthRefs.value[i].showed) {
7015 monthRefs.value[i].showed = true;
7016 emit("monthShow", {
7017 date: month.date,
7018 title: month.getTitle()
7019 });
7020 }
7021 }
7022 height += heights[i];
7023 }
7024 months.value.forEach((month, index) => {
7025 const visible = index >= visibleRange[0] - 1 && index <= visibleRange[1] + 1;
7026 monthRefs.value[index].setVisible(visible);
7027 });
7028 if (currentMonth) {
7029 currentMonthRef.value = currentMonth;
7030 }
7031 };
7032 const scrollToDate = (targetDate) => {
7033 if (canSwitch.value) {
7034 currentPanelDate.value = targetDate;
7035 } else {
7036 raf(() => {
7037 months.value.some((month, index) => {
7038 if (compareMonth(month, targetDate) === 0) {
7039 if (bodyRef.value) {
7040 monthRefs.value[index].scrollToDate(bodyRef.value, targetDate);
7041 }
7042 return true;
7043 }
7044 return false;
7045 });
7046 onScroll();
7047 });
7048 }
7049 };
7050 const scrollToCurrentDate = () => {
7051 if (props2.poppable && !props2.show) {
7052 return;
7053 }
7054 if (currentDate.value) {
7055 const targetDate = props2.type === "single" ? currentDate.value : currentDate.value[0];
7056 if (isDate(targetDate)) {
7057 scrollToDate(targetDate);
7058 }
7059 } else if (!canSwitch.value) {
7060 raf(onScroll);
7061 }
7062 };
7063 const init = () => {
7064 if (props2.poppable && !props2.show) {
7065 return;
7066 }
7067 if (!canSwitch.value) {
7068 raf(() => {
7069 bodyHeight = Math.floor(useRect(bodyRef).height);
7070 });
7071 }
7072 scrollToCurrentDate();
7073 };
7074 const reset = (date = getInitialDate()) => {
7075 currentDate.value = date;
7076 scrollToCurrentDate();
7077 };
7078 const checkRange = (date) => {
7079 const {
7080 maxRange,
7081 rangePrompt,
7082 showRangePrompt
7083 } = props2;
7084 if (maxRange && calcDateNum(date) > +maxRange) {
7085 if (showRangePrompt) {
7086 showToast(rangePrompt || t$g("rangePrompt", maxRange));
7087 }
7088 emit("overRange");
7089 return false;
7090 }
7091 return true;
7092 };
7093 const onPanelChange = (date) => {
7094 currentPanelDate.value = date;
7095 emit("panelChange", {
7096 date
7097 });
7098 };
7099 const onConfirm = () => {
7100 var _a;
7101 return emit("confirm", (_a = currentDate.value) != null ? _a : cloneDates(currentDate.value));
7102 };
7103 const select = (date, complete) => {
7104 const setCurrentDate = (date2) => {
7105 currentDate.value = date2;
7106 emit("select", cloneDates(date2));
7107 };
7108 if (complete && props2.type === "range") {
7109 const valid = checkRange(date);
7110 if (!valid) {
7111 setCurrentDate([date[0], getDayByOffset(date[0], +props2.maxRange - 1)]);
7112 return;
7113 }
7114 }
7115 setCurrentDate(date);
7116 if (complete && !props2.showConfirm) {
7117 onConfirm();
7118 }
7119 };
7120 const getDisabledDate = (disabledDays2, startDay, date) => {
7121 var _a;
7122 return (_a = disabledDays2.find((day) => compareDay(startDay, day.date) === -1 && compareDay(day.date, date) === -1)) == null ? void 0 : _a.date;
7123 };
7124 const disabledDays = computed(() => monthRefs.value.reduce((arr, ref2) => {
7125 var _a, _b;
7126 arr.push(...(_b = (_a = ref2.disabledDays) == null ? void 0 : _a.value) != null ? _b : []);
7127 return arr;
7128 }, []));
7129 const onClickDay = (item) => {
7130 if (props2.readonly || !item.date) {
7131 return;
7132 }
7133 const {
7134 date
7135 } = item;
7136 const {
7137 type
7138 } = props2;
7139 if (type === "range") {
7140 if (!currentDate.value) {
7141 select([date]);
7142 return;
7143 }
7144 const [startDay, endDay] = currentDate.value;
7145 if (startDay && !endDay) {
7146 const compareToStart = compareDay(date, startDay);
7147 if (compareToStart === 1) {
7148 const disabledDay = getDisabledDate(disabledDays.value, startDay, date);
7149 if (disabledDay) {
7150 const endDay2 = getPrevDay(disabledDay);
7151 if (compareDay(startDay, endDay2) === -1) {
7152 select([startDay, endDay2]);
7153 } else {
7154 select([date]);
7155 }
7156 } else {
7157 select([startDay, date], true);
7158 }
7159 } else if (compareToStart === -1) {
7160 select([date]);
7161 } else if (props2.allowSameDay) {
7162 select([date, date], true);
7163 }
7164 } else {
7165 select([date]);
7166 }
7167 } else if (type === "multiple") {
7168 if (!currentDate.value) {
7169 select([date]);
7170 return;
7171 }
7172 const dates = currentDate.value;
7173 const selectedIndex = dates.findIndex((dateItem) => compareDay(dateItem, date) === 0);
7174 if (selectedIndex !== -1) {
7175 const [unselectedDate] = dates.splice(selectedIndex, 1);
7176 emit("unselect", cloneDate(unselectedDate));
7177 } else if (props2.maxRange && dates.length >= +props2.maxRange) {
7178 showToast(props2.rangePrompt || t$g("rangePrompt", props2.maxRange));
7179 } else {
7180 select([...dates, date]);
7181 }
7182 } else {
7183 select(date, true);
7184 }
7185 };
7186 const updateShow = (value) => emit("update:show", value);
7187 const renderMonth = (date, index) => {
7188 const showMonthTitle = index !== 0 || !props2.showSubtitle;
7189 return createVNode(stdin_default$1f, mergeProps({
7190 "ref": canSwitch.value ? currentMonthRef : setMonthRefs(index),
7191 "date": date,
7192 "currentDate": currentDate.value,
7193 "showMonthTitle": showMonthTitle,
7194 "firstDayOfWeek": dayOffset.value,
7195 "lazyRender": canSwitch.value ? false : props2.lazyRender,
7196 "maxDate": maxDate.value,
7197 "minDate": minDate.value
7198 }, pick(props2, ["type", "color", "showMark", "formatter", "rowHeight", "showSubtitle", "allowSameDay"]), {
7199 "onClick": onClickDay,
7200 "onClickDisabledDate": (item) => emit("clickDisabledDate", item)
7201 }), pick(slots, ["top-info", "bottom-info", "month-title", "text"]));
7202 };
7203 const renderFooterButton = () => {
7204 if (slots.footer) {
7205 return slots.footer();
7206 }
7207 if (props2.showConfirm) {
7208 const slot = slots["confirm-text"];
7209 const disabled = buttonDisabled.value;
7210 const text = disabled ? props2.confirmDisabledText : props2.confirmText;
7211 return createVNode(Button, {
7212 "round": true,
7213 "block": true,
7214 "type": "primary",
7215 "color": props2.color,
7216 "class": bem$13("confirm"),
7217 "disabled": disabled,
7218 "nativeType": "button",
7219 "onClick": onConfirm
7220 }, {
7221 default: () => [slot ? slot({
7222 disabled
7223 }) : text || t$g("confirm")]
7224 });
7225 }
7226 };
7227 const renderFooter = () => createVNode("div", {
7228 "class": [bem$13("footer"), {
7229 "van-safe-area-bottom": props2.safeAreaInsetBottom
7230 }]
7231 }, [renderFooterButton()]);
7232 const renderCalendar = () => {
7233 var _a, _b;
7234 return createVNode("div", {
7235 "class": bem$13()
7236 }, [createVNode(stdin_default$1e, {
7237 "date": (_a = currentMonthRef.value) == null ? void 0 : _a.date,
7238 "maxDate": maxDate.value,
7239 "minDate": minDate.value,
7240 "title": props2.title,
7241 "subtitle": (_b = currentMonthRef.value) == null ? void 0 : _b.getTitle(),
7242 "showTitle": props2.showTitle,
7243 "showSubtitle": props2.showSubtitle,
7244 "switchMode": props2.switchMode,
7245 "firstDayOfWeek": dayOffset.value,
7246 "onClickSubtitle": (event) => emit("clickSubtitle", event),
7247 "onPanelChange": onPanelChange
7248 }, pick(slots, ["title", "subtitle", "prev-month", "prev-year", "next-month", "next-year"])), createVNode("div", {
7249 "ref": bodyRef,
7250 "class": bem$13("body"),
7251 "onScroll": canSwitch.value ? void 0 : onScroll
7252 }, [canSwitch.value ? renderMonth(currentPanelDate.value, 0) : months.value.map(renderMonth)]), renderFooter()]);
7253 };
7254 watch(() => props2.show, init);
7255 watch(() => [props2.type, props2.minDate, props2.maxDate, props2.switchMode], () => reset(getInitialDate(currentDate.value)));
7256 watch(() => props2.defaultDate, (value) => {
7257 reset(value);
7258 });
7259 useExpose({
7260 reset,
7261 scrollToDate,
7262 getSelectedDate
7263 });
7264 onMountedOrActivated(init);
7265 return () => {
7266 if (props2.poppable) {
7267 return createVNode(Popup, {
7268 "show": props2.show,
7269 "class": bem$13("popup"),
7270 "round": props2.round,
7271 "position": props2.position,
7272 "closeable": props2.showTitle || props2.showSubtitle,
7273 "teleport": props2.teleport,
7274 "closeOnPopstate": props2.closeOnPopstate,
7275 "safeAreaInsetTop": props2.safeAreaInsetTop,
7276 "closeOnClickOverlay": props2.closeOnClickOverlay,
7277 "onUpdate:show": updateShow
7278 }, {
7279 default: renderCalendar
7280 });
7281 }
7282 return renderCalendar();
7283 };
7284 }
7285});
7286const Calendar = withInstall(stdin_default$1d);
7287const [name$13, bem$12] = createNamespace("image");
7288const imageProps = {
7289 src: String,
7290 alt: String,
7291 fit: String,
7292 position: String,
7293 round: Boolean,
7294 block: Boolean,
7295 width: numericProp,
7296 height: numericProp,
7297 radius: numericProp,
7298 lazyLoad: Boolean,
7299 iconSize: numericProp,
7300 showError: truthProp,
7301 errorIcon: makeStringProp("photo-fail"),
7302 iconPrefix: String,
7303 showLoading: truthProp,
7304 loadingIcon: makeStringProp("photo"),
7305 crossorigin: String,
7306 referrerpolicy: String
7307};
7308var stdin_default$1c = defineComponent({
7309 name: name$13,
7310 props: imageProps,
7311 emits: ["load", "error"],
7312 setup(props2, {
7313 emit,
7314 slots
7315 }) {
7316 const error = ref(false);
7317 const loading = ref(true);
7318 const imageRef = ref();
7319 const {
7320 $Lazyload
7321 } = getCurrentInstance().proxy;
7322 const style = computed(() => {
7323 const style2 = {
7324 width: addUnit(props2.width),
7325 height: addUnit(props2.height)
7326 };
7327 if (isDef(props2.radius)) {
7328 style2.overflow = "hidden";
7329 style2.borderRadius = addUnit(props2.radius);
7330 }
7331 return style2;
7332 });
7333 watch(() => props2.src, () => {
7334 error.value = false;
7335 loading.value = true;
7336 });
7337 const onLoad = (event) => {
7338 if (loading.value) {
7339 loading.value = false;
7340 emit("load", event);
7341 }
7342 };
7343 const triggerLoad = () => {
7344 const loadEvent = new Event("load");
7345 Object.defineProperty(loadEvent, "target", {
7346 value: imageRef.value,
7347 enumerable: true
7348 });
7349 onLoad(loadEvent);
7350 };
7351 const onError = (event) => {
7352 error.value = true;
7353 loading.value = false;
7354 emit("error", event);
7355 };
7356 const renderIcon = (name2, className, slot) => {
7357 if (slot) {
7358 return slot();
7359 }
7360 return createVNode(Icon, {
7361 "name": name2,
7362 "size": props2.iconSize,
7363 "class": className,
7364 "classPrefix": props2.iconPrefix
7365 }, null);
7366 };
7367 const renderPlaceholder = () => {
7368 if (loading.value && props2.showLoading) {
7369 return createVNode("div", {
7370 "class": bem$12("loading")
7371 }, [renderIcon(props2.loadingIcon, bem$12("loading-icon"), slots.loading)]);
7372 }
7373 if (error.value && props2.showError) {
7374 return createVNode("div", {
7375 "class": bem$12("error")
7376 }, [renderIcon(props2.errorIcon, bem$12("error-icon"), slots.error)]);
7377 }
7378 };
7379 const renderImage = () => {
7380 if (error.value || !props2.src) {
7381 return;
7382 }
7383 const attrs = {
7384 alt: props2.alt,
7385 class: bem$12("img"),
7386 style: {
7387 objectFit: props2.fit,
7388 objectPosition: props2.position
7389 },
7390 crossorigin: props2.crossorigin,
7391 referrerpolicy: props2.referrerpolicy
7392 };
7393 if (props2.lazyLoad) {
7394 return withDirectives(createVNode("img", mergeProps({
7395 "ref": imageRef
7396 }, attrs), null), [[resolveDirective("lazy"), props2.src]]);
7397 }
7398 return createVNode("img", mergeProps({
7399 "ref": imageRef,
7400 "src": props2.src,
7401 "onLoad": onLoad,
7402 "onError": onError
7403 }, attrs), null);
7404 };
7405 const onLazyLoaded = ({
7406 el
7407 }) => {
7408 const check = () => {
7409 if (el === imageRef.value && loading.value) {
7410 triggerLoad();
7411 }
7412 };
7413 if (imageRef.value) {
7414 check();
7415 } else {
7416 nextTick(check);
7417 }
7418 };
7419 const onLazyLoadError = ({
7420 el
7421 }) => {
7422 if (el === imageRef.value && !error.value) {
7423 onError();
7424 }
7425 };
7426 if ($Lazyload && inBrowser) {
7427 $Lazyload.$on("loaded", onLazyLoaded);
7428 $Lazyload.$on("error", onLazyLoadError);
7429 onBeforeUnmount(() => {
7430 $Lazyload.$off("loaded", onLazyLoaded);
7431 $Lazyload.$off("error", onLazyLoadError);
7432 });
7433 }
7434 onMounted(() => {
7435 nextTick(() => {
7436 var _a;
7437 if (((_a = imageRef.value) == null ? void 0 : _a.complete) && !props2.lazyLoad) {
7438 triggerLoad();
7439 }
7440 });
7441 });
7442 return () => {
7443 var _a;
7444 return createVNode("div", {
7445 "class": bem$12({
7446 round: props2.round,
7447 block: props2.block
7448 }),
7449 "style": style.value
7450 }, [renderImage(), renderPlaceholder(), (_a = slots.default) == null ? void 0 : _a.call(slots)]);
7451 };
7452 }
7453});
7454const Image$1 = withInstall(stdin_default$1c);
7455const [name$12, bem$11] = createNamespace("card");
7456const cardProps = {
7457 tag: String,
7458 num: numericProp,
7459 desc: String,
7460 thumb: String,
7461 title: String,
7462 price: numericProp,
7463 centered: Boolean,
7464 lazyLoad: Boolean,
7465 currency: makeStringProp("¥"),
7466 thumbLink: String,
7467 originPrice: numericProp
7468};
7469var stdin_default$1b = defineComponent({
7470 name: name$12,
7471 props: cardProps,
7472 emits: ["clickThumb"],
7473 setup(props2, {
7474 slots,
7475 emit
7476 }) {
7477 const renderTitle = () => {
7478 if (slots.title) {
7479 return slots.title();
7480 }
7481 if (props2.title) {
7482 return createVNode("div", {
7483 "class": [bem$11("title"), "van-multi-ellipsis--l2"]
7484 }, [props2.title]);
7485 }
7486 };
7487 const renderThumbTag = () => {
7488 if (slots.tag || props2.tag) {
7489 return createVNode("div", {
7490 "class": bem$11("tag")
7491 }, [slots.tag ? slots.tag() : createVNode(Tag, {
7492 "mark": true,
7493 "type": "primary"
7494 }, {
7495 default: () => [props2.tag]
7496 })]);
7497 }
7498 };
7499 const renderThumbImage = () => {
7500 if (slots.thumb) {
7501 return slots.thumb();
7502 }
7503 return createVNode(Image$1, {
7504 "src": props2.thumb,
7505 "fit": "cover",
7506 "width": "100%",
7507 "height": "100%",
7508 "lazyLoad": props2.lazyLoad
7509 }, null);
7510 };
7511 const renderThumb = () => {
7512 if (slots.thumb || props2.thumb) {
7513 return createVNode("a", {
7514 "href": props2.thumbLink,
7515 "class": bem$11("thumb"),
7516 "onClick": (event) => emit("clickThumb", event)
7517 }, [renderThumbImage(), renderThumbTag()]);
7518 }
7519 };
7520 const renderDesc = () => {
7521 if (slots.desc) {
7522 return slots.desc();
7523 }
7524 if (props2.desc) {
7525 return createVNode("div", {
7526 "class": [bem$11("desc"), "van-ellipsis"]
7527 }, [props2.desc]);
7528 }
7529 };
7530 const renderPriceText = () => {
7531 const priceArr = props2.price.toString().split(".");
7532 return createVNode("div", null, [createVNode("span", {
7533 "class": bem$11("price-currency")
7534 }, [props2.currency]), createVNode("span", {
7535 "class": bem$11("price-integer")
7536 }, [priceArr[0]]), priceArr.length > 1 && createVNode(Fragment, null, [createTextVNode("."), createVNode("span", {
7537 "class": bem$11("price-decimal")
7538 }, [priceArr[1]])])]);
7539 };
7540 return () => {
7541 var _a, _b, _c;
7542 const showNum = slots.num || isDef(props2.num);
7543 const showPrice = slots.price || isDef(props2.price);
7544 const showOriginPrice = slots["origin-price"] || isDef(props2.originPrice);
7545 const showBottom = showNum || showPrice || showOriginPrice || slots.bottom;
7546 const Price = showPrice && createVNode("div", {
7547 "class": bem$11("price")
7548 }, [slots.price ? slots.price() : renderPriceText()]);
7549 const OriginPrice = showOriginPrice && createVNode("div", {
7550 "class": bem$11("origin-price")
7551 }, [slots["origin-price"] ? slots["origin-price"]() : `${props2.currency} ${props2.originPrice}`]);
7552 const Num = showNum && createVNode("div", {
7553 "class": bem$11("num")
7554 }, [slots.num ? slots.num() : `x${props2.num}`]);
7555 const Footer = slots.footer && createVNode("div", {
7556 "class": bem$11("footer")
7557 }, [slots.footer()]);
7558 const Bottom = showBottom && createVNode("div", {
7559 "class": bem$11("bottom")
7560 }, [(_a = slots["price-top"]) == null ? void 0 : _a.call(slots), Price, OriginPrice, Num, (_b = slots.bottom) == null ? void 0 : _b.call(slots)]);
7561 return createVNode("div", {
7562 "class": bem$11()
7563 }, [createVNode("div", {
7564 "class": bem$11("header")
7565 }, [renderThumb(), createVNode("div", {
7566 "class": bem$11("content", {
7567 centered: props2.centered
7568 })
7569 }, [createVNode("div", null, [renderTitle(), renderDesc(), (_c = slots.tags) == null ? void 0 : _c.call(slots)]), Bottom])]), Footer]);
7570 };
7571 }
7572});
7573const Card = withInstall(stdin_default$1b);
7574const [name$11, bem$10, t$f] = createNamespace("cascader");
7575const cascaderProps = {
7576 title: String,
7577 options: makeArrayProp(),
7578 closeable: truthProp,
7579 swipeable: truthProp,
7580 closeIcon: makeStringProp("cross"),
7581 showHeader: truthProp,
7582 modelValue: numericProp,
7583 fieldNames: Object,
7584 placeholder: String,
7585 activeColor: String
7586};
7587var stdin_default$1a = defineComponent({
7588 name: name$11,
7589 props: cascaderProps,
7590 emits: ["close", "change", "finish", "clickTab", "update:modelValue"],
7591 setup(props2, {
7592 slots,
7593 emit
7594 }) {
7595 const tabs = ref([]);
7596 const activeTab = ref(0);
7597 const [selectedElementRefs, setSelectedElementRefs] = useRefs();
7598 const {
7599 text: textKey,
7600 value: valueKey,
7601 children: childrenKey
7602 } = extend({
7603 text: "text",
7604 value: "value",
7605 children: "children"
7606 }, props2.fieldNames);
7607 const getSelectedOptionsByValue = (options, value) => {
7608 for (const option of options) {
7609 if (option[valueKey] === value) {
7610 return [option];
7611 }
7612 if (option[childrenKey]) {
7613 const selectedOptions = getSelectedOptionsByValue(option[childrenKey], value);
7614 if (selectedOptions) {
7615 return [option, ...selectedOptions];
7616 }
7617 }
7618 }
7619 };
7620 const updateTabs = () => {
7621 const {
7622 options,
7623 modelValue
7624 } = props2;
7625 if (modelValue !== void 0) {
7626 const selectedOptions = getSelectedOptionsByValue(options, modelValue);
7627 if (selectedOptions) {
7628 let optionsCursor = options;
7629 tabs.value = selectedOptions.map((option) => {
7630 const tab = {
7631 options: optionsCursor,
7632 selected: option
7633 };
7634 const next = optionsCursor.find((item) => item[valueKey] === option[valueKey]);
7635 if (next) {
7636 optionsCursor = next[childrenKey];
7637 }
7638 return tab;
7639 });
7640 if (optionsCursor) {
7641 tabs.value.push({
7642 options: optionsCursor,
7643 selected: null
7644 });
7645 }
7646 nextTick(() => {
7647 activeTab.value = tabs.value.length - 1;
7648 });
7649 return;
7650 }
7651 }
7652 tabs.value = [{
7653 options,
7654 selected: null
7655 }];
7656 };
7657 const onSelect = (option, tabIndex) => {
7658 if (option.disabled) {
7659 return;
7660 }
7661 tabs.value[tabIndex].selected = option;
7662 if (tabs.value.length > tabIndex + 1) {
7663 tabs.value = tabs.value.slice(0, tabIndex + 1);
7664 }
7665 if (option[childrenKey]) {
7666 const nextTab = {
7667 options: option[childrenKey],
7668 selected: null
7669 };
7670 if (tabs.value[tabIndex + 1]) {
7671 tabs.value[tabIndex + 1] = nextTab;
7672 } else {
7673 tabs.value.push(nextTab);
7674 }
7675 nextTick(() => {
7676 activeTab.value++;
7677 });
7678 }
7679 const selectedOptions = tabs.value.map((tab) => tab.selected).filter(Boolean);
7680 emit("update:modelValue", option[valueKey]);
7681 const params = {
7682 value: option[valueKey],
7683 tabIndex,
7684 selectedOptions
7685 };
7686 emit("change", params);
7687 if (!option[childrenKey]) {
7688 emit("finish", params);
7689 }
7690 };
7691 const onClose = () => emit("close");
7692 const onClickTab = ({
7693 name: name2,
7694 title
7695 }) => emit("clickTab", name2, title);
7696 const renderHeader = () => props2.showHeader ? createVNode("div", {
7697 "class": bem$10("header")
7698 }, [createVNode("h2", {
7699 "class": bem$10("title")
7700 }, [slots.title ? slots.title() : props2.title]), props2.closeable ? createVNode(Icon, {
7701 "name": props2.closeIcon,
7702 "class": [bem$10("close-icon"), HAPTICS_FEEDBACK],
7703 "onClick": onClose
7704 }, null) : null]) : null;
7705 const renderOption = (option, selectedOption, tabIndex) => {
7706 const {
7707 disabled
7708 } = option;
7709 const selected = !!(selectedOption && option[valueKey] === selectedOption[valueKey]);
7710 const color = option.color || (selected ? props2.activeColor : void 0);
7711 const Text2 = slots.option ? slots.option({
7712 option,
7713 selected
7714 }) : createVNode("span", null, [option[textKey]]);
7715 return createVNode("li", {
7716 "ref": selected ? setSelectedElementRefs(tabIndex) : void 0,
7717 "role": "menuitemradio",
7718 "class": [bem$10("option", {
7719 selected,
7720 disabled
7721 }), option.className],
7722 "style": {
7723 color
7724 },
7725 "tabindex": disabled ? void 0 : selected ? 0 : -1,
7726 "aria-checked": selected,
7727 "aria-disabled": disabled || void 0,
7728 "onClick": () => onSelect(option, tabIndex)
7729 }, [Text2, selected ? createVNode(Icon, {
7730 "name": "success",
7731 "class": bem$10("selected-icon")
7732 }, null) : null]);
7733 };
7734 const renderOptions = (options, selectedOption, tabIndex) => createVNode("ul", {
7735 "role": "menu",
7736 "class": bem$10("options")
7737 }, [options.map((option) => renderOption(option, selectedOption, tabIndex))]);
7738 const renderTab = (tab, tabIndex) => {
7739 const {
7740 options,
7741 selected
7742 } = tab;
7743 const placeholder = props2.placeholder || t$f("select");
7744 const title = selected ? selected[textKey] : placeholder;
7745 return createVNode(Tab, {
7746 "title": title,
7747 "titleClass": bem$10("tab", {
7748 unselected: !selected
7749 })
7750 }, {
7751 default: () => {
7752 var _a, _b;
7753 return [(_a = slots["options-top"]) == null ? void 0 : _a.call(slots, {
7754 tabIndex
7755 }), renderOptions(options, selected, tabIndex), (_b = slots["options-bottom"]) == null ? void 0 : _b.call(slots, {
7756 tabIndex
7757 })];
7758 }
7759 });
7760 };
7761 const renderTabs = () => createVNode(Tabs, {
7762 "active": activeTab.value,
7763 "onUpdate:active": ($event) => activeTab.value = $event,
7764 "shrink": true,
7765 "animated": true,
7766 "class": bem$10("tabs"),
7767 "color": props2.activeColor,
7768 "swipeable": props2.swipeable,
7769 "onClickTab": onClickTab
7770 }, {
7771 default: () => [tabs.value.map(renderTab)]
7772 });
7773 const scrollIntoView = (el) => {
7774 const scrollParent = el.parentElement;
7775 if (scrollParent) {
7776 scrollParent.scrollTop = el.offsetTop - (scrollParent.offsetHeight - el.offsetHeight) / 2;
7777 }
7778 };
7779 updateTabs();
7780 watch(activeTab, (value) => {
7781 const el = selectedElementRefs.value[value];
7782 if (el) scrollIntoView(el);
7783 });
7784 watch(() => props2.options, updateTabs, {
7785 deep: true
7786 });
7787 watch(() => props2.modelValue, (value) => {
7788 if (value !== void 0) {
7789 const values = tabs.value.map((tab) => {
7790 var _a;
7791 return (_a = tab.selected) == null ? void 0 : _a[valueKey];
7792 });
7793 if (values.includes(value)) {
7794 return;
7795 }
7796 }
7797 updateTabs();
7798 });
7799 return () => createVNode("div", {
7800 "class": bem$10()
7801 }, [renderHeader(), renderTabs()]);
7802 }
7803});
7804const Cascader = withInstall(stdin_default$1a);
7805const [name$10, bem$$] = createNamespace("cell-group");
7806const cellGroupProps = {
7807 title: String,
7808 inset: Boolean,
7809 border: truthProp
7810};
7811var stdin_default$19 = defineComponent({
7812 name: name$10,
7813 inheritAttrs: false,
7814 props: cellGroupProps,
7815 setup(props2, {
7816 slots,
7817 attrs
7818 }) {
7819 const renderGroup = () => {
7820 var _a;
7821 return createVNode("div", mergeProps({
7822 "class": [bem$$({
7823 inset: props2.inset
7824 }), {
7825 [BORDER_TOP_BOTTOM]: props2.border && !props2.inset
7826 }]
7827 }, attrs, useScopeId()), [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
7828 };
7829 const renderTitle = () => createVNode("div", {
7830 "class": bem$$("title", {
7831 inset: props2.inset
7832 })
7833 }, [slots.title ? slots.title() : props2.title]);
7834 return () => {
7835 if (props2.title || slots.title) {
7836 return createVNode(Fragment, null, [renderTitle(), renderGroup()]);
7837 }
7838 return renderGroup();
7839 };
7840 }
7841});
7842const CellGroup = withInstall(stdin_default$19);
7843const [name$$, bem$_] = createNamespace("circle");
7844let uid = 0;
7845const format = (rate) => Math.min(Math.max(+rate, 0), 100);
7846function getPath(clockwise, viewBoxSize) {
7847 const sweepFlag = clockwise ? 1 : 0;
7848 return `M ${viewBoxSize / 2} ${viewBoxSize / 2} m 0, -500 a 500, 500 0 1, ${sweepFlag} 0, 1000 a 500, 500 0 1, ${sweepFlag} 0, -1000`;
7849}
7850const circleProps = {
7851 text: String,
7852 size: numericProp,
7853 fill: makeStringProp("none"),
7854 rate: makeNumericProp(100),
7855 speed: makeNumericProp(0),
7856 color: [String, Object],
7857 clockwise: truthProp,
7858 layerColor: String,
7859 currentRate: makeNumberProp(0),
7860 strokeWidth: makeNumericProp(40),
7861 strokeLinecap: String,
7862 startPosition: makeStringProp("top")
7863};
7864var stdin_default$18 = defineComponent({
7865 name: name$$,
7866 props: circleProps,
7867 emits: ["update:currentRate"],
7868 setup(props2, {
7869 emit,
7870 slots
7871 }) {
7872 const id = `van-circle-${uid++}`;
7873 const viewBoxSize = computed(() => +props2.strokeWidth + 1e3);
7874 const path = computed(() => getPath(props2.clockwise, viewBoxSize.value));
7875 const svgStyle = computed(() => {
7876 const ROTATE_ANGLE_MAP = {
7877 top: 0,
7878 right: 90,
7879 bottom: 180,
7880 left: 270
7881 };
7882 const angleValue = ROTATE_ANGLE_MAP[props2.startPosition];
7883 if (angleValue) {
7884 return {
7885 transform: `rotate(${angleValue}deg)`
7886 };
7887 }
7888 });
7889 watch(() => props2.rate, (rate) => {
7890 let rafId;
7891 const startTime = Date.now();
7892 const startRate = props2.currentRate;
7893 const endRate = format(rate);
7894 const duration = Math.abs((startRate - endRate) * 1e3 / +props2.speed);
7895 const animate = () => {
7896 const now = Date.now();
7897 const progress = Math.min((now - startTime) / duration, 1);
7898 const rate2 = progress * (endRate - startRate) + startRate;
7899 emit("update:currentRate", format(parseFloat(rate2.toFixed(1))));
7900 if (endRate > startRate ? rate2 < endRate : rate2 > endRate) {
7901 rafId = raf(animate);
7902 }
7903 };
7904 if (props2.speed) {
7905 if (rafId) {
7906 cancelRaf(rafId);
7907 }
7908 rafId = raf(animate);
7909 } else {
7910 emit("update:currentRate", endRate);
7911 }
7912 }, {
7913 immediate: true
7914 });
7915 const renderHover = () => {
7916 const PERIMETER = 3140;
7917 const {
7918 strokeWidth,
7919 currentRate,
7920 strokeLinecap
7921 } = props2;
7922 const offset = PERIMETER * currentRate / 100;
7923 const color = isObject(props2.color) ? `url(#${id})` : props2.color;
7924 const style = {
7925 stroke: color,
7926 strokeWidth: `${+strokeWidth + 1}px`,
7927 strokeLinecap,
7928 strokeDasharray: `${offset}px ${PERIMETER}px`
7929 };
7930 return createVNode("path", {
7931 "d": path.value,
7932 "style": style,
7933 "class": bem$_("hover"),
7934 "stroke": color
7935 }, null);
7936 };
7937 const renderLayer = () => {
7938 const style = {
7939 fill: props2.fill,
7940 stroke: props2.layerColor,
7941 strokeWidth: `${props2.strokeWidth}px`
7942 };
7943 return createVNode("path", {
7944 "class": bem$_("layer"),
7945 "style": style,
7946 "d": path.value
7947 }, null);
7948 };
7949 const renderGradient = () => {
7950 const {
7951 color
7952 } = props2;
7953 if (!isObject(color)) {
7954 return;
7955 }
7956 const Stops = Object.keys(color).sort((a, b) => parseFloat(a) - parseFloat(b)).map((key, index) => createVNode("stop", {
7957 "key": index,
7958 "offset": key,
7959 "stop-color": color[key]
7960 }, null));
7961 return createVNode("defs", null, [createVNode("linearGradient", {
7962 "id": id,
7963 "x1": "100%",
7964 "y1": "0%",
7965 "x2": "0%",
7966 "y2": "0%"
7967 }, [Stops])]);
7968 };
7969 const renderText = () => {
7970 if (slots.default) {
7971 return slots.default();
7972 }
7973 if (props2.text) {
7974 return createVNode("div", {
7975 "class": bem$_("text")
7976 }, [props2.text]);
7977 }
7978 };
7979 return () => createVNode("div", {
7980 "class": bem$_(),
7981 "style": getSizeStyle(props2.size)
7982 }, [createVNode("svg", {
7983 "viewBox": `0 0 ${viewBoxSize.value} ${viewBoxSize.value}`,
7984 "style": svgStyle.value
7985 }, [renderGradient(), renderLayer(), renderHover()]), renderText()]);
7986 }
7987});
7988const Circle = withInstall(stdin_default$18);
7989const [name$_, bem$Z] = createNamespace("row");
7990const ROW_KEY = Symbol(name$_);
7991const rowProps = {
7992 tag: makeStringProp("div"),
7993 wrap: truthProp,
7994 align: String,
7995 gutter: {
7996 type: [String, Number, Array],
7997 default: 0
7998 },
7999 justify: String
8000};
8001var stdin_default$17 = defineComponent({
8002 name: name$_,
8003 props: rowProps,
8004 setup(props2, {
8005 slots
8006 }) {
8007 const {
8008 children,
8009 linkChildren
8010 } = useChildren(ROW_KEY);
8011 const groups = computed(() => {
8012 const groups2 = [[]];
8013 let totalSpan = 0;
8014 children.forEach((child, index) => {
8015 totalSpan += Number(child.span);
8016 if (totalSpan > 24) {
8017 groups2.push([index]);
8018 totalSpan -= 24;
8019 } else {
8020 groups2[groups2.length - 1].push(index);
8021 }
8022 });
8023 return groups2;
8024 });
8025 const spaces = computed(() => {
8026 let gutter = 0;
8027 if (Array.isArray(props2.gutter)) {
8028 gutter = Number(props2.gutter[0]) || 0;
8029 } else {
8030 gutter = Number(props2.gutter);
8031 }
8032 const spaces2 = [];
8033 if (!gutter) {
8034 return spaces2;
8035 }
8036 groups.value.forEach((group) => {
8037 const averagePadding = gutter * (group.length - 1) / group.length;
8038 group.forEach((item, index) => {
8039 if (index === 0) {
8040 spaces2.push({
8041 right: averagePadding
8042 });
8043 } else {
8044 const left = gutter - spaces2[item - 1].right;
8045 const right = averagePadding - left;
8046 spaces2.push({
8047 left,
8048 right
8049 });
8050 }
8051 });
8052 });
8053 return spaces2;
8054 });
8055 const verticalSpaces = computed(() => {
8056 const {
8057 gutter
8058 } = props2;
8059 const spaces2 = [];
8060 if (Array.isArray(gutter) && gutter.length > 1) {
8061 const bottom = Number(gutter[1]) || 0;
8062 if (bottom <= 0) {
8063 return spaces2;
8064 }
8065 groups.value.forEach((group, index) => {
8066 if (index === groups.value.length - 1) return;
8067 group.forEach(() => {
8068 spaces2.push({
8069 bottom
8070 });
8071 });
8072 });
8073 }
8074 return spaces2;
8075 });
8076 linkChildren({
8077 spaces,
8078 verticalSpaces
8079 });
8080 return () => {
8081 const {
8082 tag,
8083 wrap,
8084 align,
8085 justify
8086 } = props2;
8087 return createVNode(tag, {
8088 "class": bem$Z({
8089 [`align-${align}`]: align,
8090 [`justify-${justify}`]: justify,
8091 nowrap: !wrap
8092 })
8093 }, {
8094 default: () => {
8095 var _a;
8096 return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
8097 }
8098 });
8099 };
8100 }
8101});
8102const [name$Z, bem$Y] = createNamespace("col");
8103const colProps = {
8104 tag: makeStringProp("div"),
8105 span: makeNumericProp(0),
8106 offset: numericProp
8107};
8108var stdin_default$16 = defineComponent({
8109 name: name$Z,
8110 props: colProps,
8111 setup(props2, {
8112 slots
8113 }) {
8114 const {
8115 parent,
8116 index
8117 } = useParent(ROW_KEY);
8118 const style = computed(() => {
8119 if (!parent) {
8120 return;
8121 }
8122 const {
8123 spaces,
8124 verticalSpaces
8125 } = parent;
8126 let styles = {};
8127 if (spaces && spaces.value && spaces.value[index.value]) {
8128 const {
8129 left,
8130 right
8131 } = spaces.value[index.value];
8132 styles = {
8133 paddingLeft: left ? `${left}px` : null,
8134 paddingRight: right ? `${right}px` : null
8135 };
8136 }
8137 const {
8138 bottom
8139 } = verticalSpaces.value[index.value] || {};
8140 return extend(styles, {
8141 marginBottom: bottom ? `${bottom}px` : null
8142 });
8143 });
8144 return () => {
8145 const {
8146 tag,
8147 span,
8148 offset
8149 } = props2;
8150 return createVNode(tag, {
8151 "style": style.value,
8152 "class": bem$Y({
8153 [span]: span,
8154 [`offset-${offset}`]: offset
8155 })
8156 }, {
8157 default: () => {
8158 var _a;
8159 return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
8160 }
8161 });
8162 };
8163 }
8164});
8165const Col = withInstall(stdin_default$16);
8166const [name$Y, bem$X] = createNamespace("collapse");
8167const COLLAPSE_KEY = Symbol(name$Y);
8168const collapseProps = {
8169 border: truthProp,
8170 accordion: Boolean,
8171 modelValue: {
8172 type: [String, Number, Array],
8173 default: ""
8174 }
8175};
8176function validateModelValue(modelValue, accordion) {
8177 if (accordion && Array.isArray(modelValue)) {
8178 console.error('[Vant] Collapse: "v-model" should not be Array in accordion mode');
8179 return false;
8180 }
8181 if (!accordion && !Array.isArray(modelValue)) {
8182 console.error('[Vant] Collapse: "v-model" should be Array in non-accordion mode');
8183 return false;
8184 }
8185 return true;
8186}
8187var stdin_default$15 = defineComponent({
8188 name: name$Y,
8189 props: collapseProps,
8190 emits: ["change", "update:modelValue"],
8191 setup(props2, {
8192 emit,
8193 slots
8194 }) {
8195 const {
8196 linkChildren,
8197 children
8198 } = useChildren(COLLAPSE_KEY);
8199 const updateName = (name2) => {
8200 emit("change", name2);
8201 emit("update:modelValue", name2);
8202 };
8203 const toggle = (name2, expanded) => {
8204 const {
8205 accordion,
8206 modelValue
8207 } = props2;
8208 if (accordion) {
8209 updateName(name2 === modelValue ? "" : name2);
8210 } else if (expanded) {
8211 updateName(modelValue.concat(name2));
8212 } else {
8213 updateName(modelValue.filter((activeName) => activeName !== name2));
8214 }
8215 };
8216 const toggleAll = (options = {}) => {
8217 if (props2.accordion) {
8218 return;
8219 }
8220 if (typeof options === "boolean") {
8221 options = {
8222 expanded: options
8223 };
8224 }
8225 const {
8226 expanded,
8227 skipDisabled
8228 } = options;
8229 const expandedChildren = children.filter((item) => {
8230 if (item.disabled && skipDisabled) {
8231 return item.expanded.value;
8232 }
8233 return expanded != null ? expanded : !item.expanded.value;
8234 });
8235 const names = expandedChildren.map((item) => item.itemName.value);
8236 updateName(names);
8237 };
8238 const isExpanded = (name2) => {
8239 const {
8240 accordion,
8241 modelValue
8242 } = props2;
8243 if (process.env.NODE_ENV !== "production" && !validateModelValue(modelValue, accordion)) {
8244 return false;
8245 }
8246 return accordion ? modelValue === name2 : modelValue.includes(name2);
8247 };
8248 useExpose({
8249 toggleAll
8250 });
8251 linkChildren({
8252 toggle,
8253 isExpanded
8254 });
8255 return () => {
8256 var _a;
8257 return createVNode("div", {
8258 "class": [bem$X(), {
8259 [BORDER_TOP_BOTTOM]: props2.border
8260 }]
8261 }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
8262 };
8263 }
8264});
8265const Collapse = withInstall(stdin_default$15);
8266const [name$X, bem$W] = createNamespace("collapse-item");
8267const CELL_SLOTS = ["icon", "title", "value", "label", "right-icon"];
8268const collapseItemProps = extend({}, cellSharedProps, {
8269 name: numericProp,
8270 isLink: truthProp,
8271 disabled: Boolean,
8272 readonly: Boolean,
8273 lazyRender: truthProp
8274});
8275var stdin_default$14 = defineComponent({
8276 name: name$X,
8277 props: collapseItemProps,
8278 setup(props2, {
8279 slots
8280 }) {
8281 const wrapperRef = ref();
8282 const contentRef = ref();
8283 const {
8284 parent,
8285 index
8286 } = useParent(COLLAPSE_KEY);
8287 if (!parent) {
8288 if (process.env.NODE_ENV !== "production") {
8289 console.error("[Vant] <CollapseItem> must be a child component of <Collapse>.");
8290 }
8291 return;
8292 }
8293 const name2 = computed(() => {
8294 var _a;
8295 return (_a = props2.name) != null ? _a : index.value;
8296 });
8297 const expanded = computed(() => parent.isExpanded(name2.value));
8298 const show = ref(expanded.value);
8299 const lazyRender = useLazyRender(() => show.value || !props2.lazyRender);
8300 const onTransitionEnd = () => {
8301 if (!expanded.value) {
8302 show.value = false;
8303 } else if (wrapperRef.value) {
8304 wrapperRef.value.style.height = "";
8305 }
8306 };
8307 watch(expanded, (value, oldValue) => {
8308 if (oldValue === null) {
8309 return;
8310 }
8311 if (value) {
8312 show.value = true;
8313 }
8314 const tick = value ? nextTick : raf;
8315 tick(() => {
8316 if (!contentRef.value || !wrapperRef.value) {
8317 return;
8318 }
8319 const {
8320 offsetHeight
8321 } = contentRef.value;
8322 if (offsetHeight) {
8323 const contentHeight = `${offsetHeight}px`;
8324 wrapperRef.value.style.height = value ? "0" : contentHeight;
8325 doubleRaf(() => {
8326 if (wrapperRef.value) {
8327 wrapperRef.value.style.height = value ? contentHeight : "0";
8328 }
8329 });
8330 } else {
8331 onTransitionEnd();
8332 }
8333 });
8334 });
8335 const toggle = (newValue = !expanded.value) => {
8336 parent.toggle(name2.value, newValue);
8337 };
8338 const onClickTitle = () => {
8339 if (!props2.disabled && !props2.readonly) {
8340 toggle();
8341 }
8342 };
8343 const renderTitle = () => {
8344 const {
8345 border,
8346 disabled,
8347 readonly
8348 } = props2;
8349 const attrs = pick(props2, Object.keys(cellSharedProps));
8350 if (readonly) {
8351 attrs.isLink = false;
8352 }
8353 if (disabled || readonly) {
8354 attrs.clickable = false;
8355 }
8356 return createVNode(Cell, mergeProps({
8357 "role": "button",
8358 "class": bem$W("title", {
8359 disabled,
8360 expanded: expanded.value,
8361 borderless: !border
8362 }),
8363 "aria-expanded": String(expanded.value),
8364 "onClick": onClickTitle
8365 }, attrs), pick(slots, CELL_SLOTS));
8366 };
8367 const renderContent = lazyRender(() => {
8368 var _a;
8369 return withDirectives(createVNode("div", {
8370 "ref": wrapperRef,
8371 "class": bem$W("wrapper"),
8372 "onTransitionend": onTransitionEnd
8373 }, [createVNode("div", {
8374 "ref": contentRef,
8375 "class": bem$W("content")
8376 }, [(_a = slots.default) == null ? void 0 : _a.call(slots)])]), [[vShow, show.value]]);
8377 });
8378 useExpose({
8379 toggle,
8380 expanded,
8381 itemName: name2
8382 });
8383 return () => createVNode("div", {
8384 "class": [bem$W({
8385 border: index.value && props2.border
8386 })]
8387 }, [renderTitle(), renderContent()]);
8388 }
8389});
8390const CollapseItem = withInstall(stdin_default$14);
8391const ConfigProvider = withInstall(stdin_default$1S);
8392const [name$W, bem$V, t$e] = createNamespace("contact-card");
8393const contactCardProps = {
8394 tel: String,
8395 name: String,
8396 type: makeStringProp("add"),
8397 addText: String,
8398 editable: truthProp
8399};
8400var stdin_default$13 = defineComponent({
8401 name: name$W,
8402 props: contactCardProps,
8403 emits: ["click"],
8404 setup(props2, {
8405 emit
8406 }) {
8407 const onClick = (event) => {
8408 if (props2.editable) {
8409 emit("click", event);
8410 }
8411 };
8412 const renderContent = () => {
8413 if (props2.type === "add") {
8414 return props2.addText || t$e("addContact");
8415 }
8416 return [createVNode("div", null, [`${t$e("name")}${props2.name}`]), createVNode("div", null, [`${t$e("tel")}${props2.tel}`])];
8417 };
8418 return () => createVNode(Cell, {
8419 "center": true,
8420 "icon": props2.type === "edit" ? "contact" : "add-square",
8421 "class": bem$V([props2.type]),
8422 "border": false,
8423 "isLink": props2.editable,
8424 "titleClass": bem$V("title"),
8425 "onClick": onClick
8426 }, {
8427 title: renderContent
8428 });
8429 }
8430});
8431const ContactCard = withInstall(stdin_default$13);
8432const [name$V, bem$U, t$d] = createNamespace("contact-edit");
8433const DEFAULT_CONTACT = {
8434 tel: "",
8435 name: ""
8436};
8437const contactEditProps = {
8438 isEdit: Boolean,
8439 isSaving: Boolean,
8440 isDeleting: Boolean,
8441 showSetDefault: Boolean,
8442 setDefaultLabel: String,
8443 contactInfo: {
8444 type: Object,
8445 default: () => extend({}, DEFAULT_CONTACT)
8446 },
8447 telValidator: {
8448 type: Function,
8449 default: isMobile
8450 }
8451};
8452var stdin_default$12 = defineComponent({
8453 name: name$V,
8454 props: contactEditProps,
8455 emits: ["save", "delete", "changeDefault"],
8456 setup(props2, {
8457 emit
8458 }) {
8459 const contact = reactive(extend({}, DEFAULT_CONTACT, props2.contactInfo));
8460 const onSave = () => {
8461 if (!props2.isSaving) {
8462 emit("save", contact);
8463 }
8464 };
8465 const onDelete = () => emit("delete", contact);
8466 const renderButtons = () => createVNode("div", {
8467 "class": bem$U("buttons")
8468 }, [createVNode(Button, {
8469 "block": true,
8470 "round": true,
8471 "type": "primary",
8472 "text": t$d("save"),
8473 "class": bem$U("button"),
8474 "loading": props2.isSaving,
8475 "nativeType": "submit"
8476 }, null), props2.isEdit && createVNode(Button, {
8477 "block": true,
8478 "round": true,
8479 "text": t$d("delete"),
8480 "class": bem$U("button"),
8481 "loading": props2.isDeleting,
8482 "onClick": onDelete
8483 }, null)]);
8484 const renderSwitch = () => createVNode(Switch, {
8485 "modelValue": contact.isDefault,
8486 "onUpdate:modelValue": ($event) => contact.isDefault = $event,
8487 "onChange": (checked) => emit("changeDefault", checked)
8488 }, null);
8489 const renderSetDefault = () => {
8490 if (props2.showSetDefault) {
8491 return createVNode(Cell, {
8492 "title": props2.setDefaultLabel,
8493 "class": bem$U("switch-cell"),
8494 "border": false
8495 }, {
8496 "right-icon": renderSwitch
8497 });
8498 }
8499 };
8500 watch(() => props2.contactInfo, (value) => extend(contact, DEFAULT_CONTACT, value));
8501 return () => createVNode(Form, {
8502 "class": bem$U(),
8503 "onSubmit": onSave
8504 }, {
8505 default: () => [createVNode("div", {
8506 "class": bem$U("fields")
8507 }, [createVNode(Field, {
8508 "modelValue": contact.name,
8509 "onUpdate:modelValue": ($event) => contact.name = $event,
8510 "clearable": true,
8511 "label": t$d("name"),
8512 "rules": [{
8513 required: true,
8514 message: t$d("nameEmpty")
8515 }],
8516 "maxlength": "30",
8517 "placeholder": t$d("name")
8518 }, null), createVNode(Field, {
8519 "modelValue": contact.tel,
8520 "onUpdate:modelValue": ($event) => contact.tel = $event,
8521 "clearable": true,
8522 "type": "tel",
8523 "label": t$d("tel"),
8524 "rules": [{
8525 validator: props2.telValidator,
8526 message: t$d("telInvalid")
8527 }],
8528 "placeholder": t$d("tel")
8529 }, null)]), renderSetDefault(), renderButtons()]
8530 });
8531 }
8532});
8533const ContactEdit = withInstall(stdin_default$12);
8534const [name$U, bem$T, t$c] = createNamespace("contact-list");
8535const contactListProps = {
8536 list: Array,
8537 addText: String,
8538 modelValue: unknownProp,
8539 defaultTagText: String
8540};
8541var stdin_default$11 = defineComponent({
8542 name: name$U,
8543 props: contactListProps,
8544 emits: ["add", "edit", "select", "update:modelValue"],
8545 setup(props2, {
8546 emit
8547 }) {
8548 const renderItem = (item, index) => {
8549 const onClick = () => {
8550 emit("update:modelValue", item.id);
8551 emit("select", item, index);
8552 };
8553 const renderRightIcon = () => createVNode(Radio, {
8554 "class": bem$T("radio"),
8555 "name": item.id,
8556 "iconSize": 18
8557 }, null);
8558 const renderEditIcon = () => createVNode(Icon, {
8559 "name": "edit",
8560 "class": bem$T("edit"),
8561 "onClick": (event) => {
8562 event.stopPropagation();
8563 emit("edit", item, index);
8564 }
8565 }, null);
8566 const renderContent = () => {
8567 const nodes = [`${item.name}${item.tel}`];
8568 if (item.isDefault && props2.defaultTagText) {
8569 nodes.push(createVNode(Tag, {
8570 "type": "primary",
8571 "round": true,
8572 "class": bem$T("item-tag")
8573 }, {
8574 default: () => [props2.defaultTagText]
8575 }));
8576 }
8577 return nodes;
8578 };
8579 return createVNode(Cell, {
8580 "key": item.id,
8581 "isLink": true,
8582 "center": true,
8583 "class": bem$T("item"),
8584 "titleClass": bem$T("item-title"),
8585 "onClick": onClick
8586 }, {
8587 icon: renderEditIcon,
8588 title: renderContent,
8589 "right-icon": renderRightIcon
8590 });
8591 };
8592 return () => createVNode("div", {
8593 "class": bem$T()
8594 }, [createVNode(RadioGroup, {
8595 "modelValue": props2.modelValue,
8596 "class": bem$T("group")
8597 }, {
8598 default: () => [props2.list && props2.list.map(renderItem)]
8599 }), createVNode("div", {
8600 "class": [bem$T("bottom"), "van-safe-area-bottom"]
8601 }, [createVNode(Button, {
8602 "round": true,
8603 "block": true,
8604 "type": "primary",
8605 "class": bem$T("add"),
8606 "text": props2.addText || t$c("addContact"),
8607 "onClick": () => emit("add")
8608 }, null)])]);
8609 }
8610});
8611const ContactList = withInstall(stdin_default$11);
8612function parseFormat(format2, currentTime) {
8613 const { days } = currentTime;
8614 let { hours, minutes, seconds, milliseconds } = currentTime;
8615 if (format2.includes("DD")) {
8616 format2 = format2.replace("DD", padZero(days));
8617 } else {
8618 hours += days * 24;
8619 }
8620 if (format2.includes("HH")) {
8621 format2 = format2.replace("HH", padZero(hours));
8622 } else {
8623 minutes += hours * 60;
8624 }
8625 if (format2.includes("mm")) {
8626 format2 = format2.replace("mm", padZero(minutes));
8627 } else {
8628 seconds += minutes * 60;
8629 }
8630 if (format2.includes("ss")) {
8631 format2 = format2.replace("ss", padZero(seconds));
8632 } else {
8633 milliseconds += seconds * 1e3;
8634 }
8635 if (format2.includes("S")) {
8636 const ms = padZero(milliseconds, 3);
8637 if (format2.includes("SSS")) {
8638 format2 = format2.replace("SSS", ms);
8639 } else if (format2.includes("SS")) {
8640 format2 = format2.replace("SS", ms.slice(0, 2));
8641 } else {
8642 format2 = format2.replace("S", ms.charAt(0));
8643 }
8644 }
8645 return format2;
8646}
8647const [name$T, bem$S] = createNamespace("count-down");
8648const countDownProps = {
8649 time: makeNumericProp(0),
8650 format: makeStringProp("HH:mm:ss"),
8651 autoStart: truthProp,
8652 millisecond: Boolean
8653};
8654var stdin_default$10 = defineComponent({
8655 name: name$T,
8656 props: countDownProps,
8657 emits: ["change", "finish"],
8658 setup(props2, {
8659 emit,
8660 slots
8661 }) {
8662 const {
8663 start,
8664 pause,
8665 reset,
8666 current: current2
8667 } = useCountDown({
8668 time: +props2.time,
8669 millisecond: props2.millisecond,
8670 onChange: (current22) => emit("change", current22),
8671 onFinish: () => emit("finish")
8672 });
8673 const timeText = computed(() => parseFormat(props2.format, current2.value));
8674 const resetTime = () => {
8675 reset(+props2.time);
8676 if (props2.autoStart) {
8677 start();
8678 }
8679 };
8680 watch(() => props2.time, resetTime, {
8681 immediate: true
8682 });
8683 useExpose({
8684 start,
8685 pause,
8686 reset: resetTime
8687 });
8688 return () => createVNode("div", {
8689 "role": "timer",
8690 "class": bem$S()
8691 }, [slots.default ? slots.default(current2.value) : timeText.value]);
8692 }
8693});
8694const CountDown = withInstall(stdin_default$10);
8695function getDate(timeStamp) {
8696 const date = new Date(timeStamp * 1e3);
8697 return `${date.getFullYear()}.${padZero(date.getMonth() + 1)}.${padZero(
8698 date.getDate()
8699 )}`;
8700}
8701const formatDiscount = (discount) => (discount / 10).toFixed(discount % 10 === 0 ? 0 : 1);
8702const formatAmount = (amount) => (amount / 100).toFixed(amount % 100 === 0 ? 0 : amount % 10 === 0 ? 1 : 2);
8703const [name$S, bem$R, t$b] = createNamespace("coupon");
8704var stdin_default$$ = defineComponent({
8705 name: name$S,
8706 props: {
8707 chosen: Boolean,
8708 coupon: makeRequiredProp(Object),
8709 disabled: Boolean,
8710 currency: makeStringProp("¥")
8711 },
8712 setup(props2) {
8713 const validPeriod = computed(() => {
8714 const {
8715 startAt,
8716 endAt
8717 } = props2.coupon;
8718 return `${getDate(startAt)} - ${getDate(endAt)}`;
8719 });
8720 const faceAmount = computed(() => {
8721 const {
8722 coupon,
8723 currency
8724 } = props2;
8725 if (coupon.valueDesc) {
8726 return [coupon.valueDesc, createVNode("span", null, [coupon.unitDesc || ""])];
8727 }
8728 if (coupon.denominations) {
8729 const denominations = formatAmount(coupon.denominations);
8730 return [createVNode("span", null, [currency]), ` ${denominations}`];
8731 }
8732 if (coupon.discount) {
8733 return t$b("discount", formatDiscount(coupon.discount));
8734 }
8735 return "";
8736 });
8737 const conditionMessage = computed(() => {
8738 const condition = formatAmount(props2.coupon.originCondition || 0);
8739 return condition === "0" ? t$b("unlimited") : t$b("condition", condition);
8740 });
8741 return () => {
8742 const {
8743 chosen,
8744 coupon,
8745 disabled
8746 } = props2;
8747 const description = disabled && coupon.reason || coupon.description;
8748 return createVNode("div", {
8749 "class": bem$R({
8750 disabled
8751 })
8752 }, [createVNode("div", {
8753 "class": bem$R("content")
8754 }, [createVNode("div", {
8755 "class": bem$R("head")
8756 }, [createVNode("h2", {
8757 "class": bem$R("amount")
8758 }, [faceAmount.value]), createVNode("p", {
8759 "class": bem$R("condition")
8760 }, [coupon.condition || conditionMessage.value])]), createVNode("div", {
8761 "class": bem$R("body")
8762 }, [createVNode("p", {
8763 "class": bem$R("name")
8764 }, [coupon.name]), createVNode("p", {
8765 "class": bem$R("valid")
8766 }, [validPeriod.value]), !disabled && createVNode(Checkbox, {
8767 "class": bem$R("corner"),
8768 "modelValue": chosen
8769 }, null)])]), description && createVNode("p", {
8770 "class": bem$R("description")
8771 }, [description])]);
8772 };
8773 }
8774});
8775const Coupon = withInstall(stdin_default$$);
8776const [name$R, bem$Q, t$a] = createNamespace("coupon-cell");
8777const couponCellProps = {
8778 title: String,
8779 border: truthProp,
8780 editable: truthProp,
8781 coupons: makeArrayProp(),
8782 currency: makeStringProp("¥"),
8783 chosenCoupon: {
8784 type: [Number, Array],
8785 default: -1
8786 }
8787};
8788const getValue = (coupon) => {
8789 const {
8790 value,
8791 denominations
8792 } = coupon;
8793 if (isDef(value)) {
8794 return value;
8795 }
8796 if (isDef(denominations)) {
8797 return denominations;
8798 }
8799 return 0;
8800};
8801function formatValue({
8802 coupons,
8803 chosenCoupon,
8804 currency
8805}) {
8806 let value = 0;
8807 let isExist = false;
8808 (Array.isArray(chosenCoupon) ? chosenCoupon : [chosenCoupon]).forEach((i) => {
8809 const coupon = coupons[+i];
8810 if (coupon) {
8811 isExist = true;
8812 value += getValue(coupon);
8813 }
8814 });
8815 if (isExist) {
8816 return `-${currency} ${(value / 100).toFixed(2)}`;
8817 }
8818 return coupons.length === 0 ? t$a("noCoupon") : t$a("count", coupons.length);
8819}
8820var stdin_default$_ = defineComponent({
8821 name: name$R,
8822 props: couponCellProps,
8823 setup(props2) {
8824 return () => {
8825 const selected = Array.isArray(props2.chosenCoupon) ? props2.chosenCoupon.length : props2.coupons[+props2.chosenCoupon];
8826 return createVNode(Cell, {
8827 "class": bem$Q(),
8828 "value": formatValue(props2),
8829 "title": props2.title || t$a("title"),
8830 "border": props2.border,
8831 "isLink": props2.editable,
8832 "valueClass": bem$Q("value", {
8833 selected
8834 })
8835 }, null);
8836 };
8837 }
8838});
8839const CouponCell = withInstall(stdin_default$_);
8840const [name$Q, bem$P] = createNamespace("empty");
8841const emptyProps = {
8842 image: makeStringProp("default"),
8843 imageSize: [Number, String, Array],
8844 description: String
8845};
8846var stdin_default$Z = defineComponent({
8847 name: name$Q,
8848 props: emptyProps,
8849 setup(props2, {
8850 slots
8851 }) {
8852 const renderDescription = () => {
8853 const description = slots.description ? slots.description() : props2.description;
8854 if (description) {
8855 return createVNode("p", {
8856 "class": bem$P("description")
8857 }, [description]);
8858 }
8859 };
8860 const renderBottom = () => {
8861 if (slots.default) {
8862 return createVNode("div", {
8863 "class": bem$P("bottom")
8864 }, [slots.default()]);
8865 }
8866 };
8867 const baseId = useId();
8868 const getId = (num) => `${baseId}-${num}`;
8869 const getUrlById = (num) => `url(#${getId(num)})`;
8870 const renderStop = (color, offset, opacity) => createVNode("stop", {
8871 "stop-color": color,
8872 "offset": `${offset}%`,
8873 "stop-opacity": opacity
8874 }, null);
8875 const renderStops = (fromColor, toColor) => [renderStop(fromColor, 0), renderStop(toColor, 100)];
8876 const renderShadow = (id) => [createVNode("defs", null, [createVNode("radialGradient", {
8877 "id": getId(id),
8878 "cx": "50%",
8879 "cy": "54%",
8880 "fx": "50%",
8881 "fy": "54%",
8882 "r": "297%",
8883 "gradientTransform": "matrix(-.16 0 0 -.33 .58 .72)",
8884 "data-allow-mismatch": "attribute"
8885 }, [renderStop("#EBEDF0", 0), renderStop("#F2F3F5", 100, 0.3)])]), createVNode("ellipse", {
8886 "fill": getUrlById(id),
8887 "opacity": ".8",
8888 "cx": "80",
8889 "cy": "140",
8890 "rx": "46",
8891 "ry": "8",
8892 "data-allow-mismatch": "attribute"
8893 }, null)];
8894 const renderBuilding = () => [createVNode("defs", null, [createVNode("linearGradient", {
8895 "id": getId("a"),
8896 "x1": "64%",
8897 "y1": "100%",
8898 "x2": "64%",
8899 "data-allow-mismatch": "attribute"
8900 }, [renderStop("#FFF", 0, 0.5), renderStop("#F2F3F5", 100)])]), createVNode("g", {
8901 "opacity": ".8",
8902 "data-allow-mismatch": "children"
8903 }, [createVNode("path", {
8904 "d": "M36 131V53H16v20H2v58h34z",
8905 "fill": getUrlById("a")
8906 }, null), createVNode("path", {
8907 "d": "M123 15h22v14h9v77h-31V15z",
8908 "fill": getUrlById("a")
8909 }, null)])];
8910 const renderCloud = () => [createVNode("defs", null, [createVNode("linearGradient", {
8911 "id": getId("b"),
8912 "x1": "64%",
8913 "y1": "97%",
8914 "x2": "64%",
8915 "y2": "0%",
8916 "data-allow-mismatch": "attribute"
8917 }, [renderStop("#F2F3F5", 0, 0.3), renderStop("#F2F3F5", 100)])]), createVNode("g", {
8918 "opacity": ".8",
8919 "data-allow-mismatch": "children"
8920 }, [createVNode("path", {
8921 "d": "M87 6c3 0 7 3 8 6a8 8 0 1 1-1 16H80a7 7 0 0 1-8-6c0-4 3-7 6-7 0-5 4-9 9-9Z",
8922 "fill": getUrlById("b")
8923 }, null), createVNode("path", {
8924 "d": "M19 23c2 0 3 1 4 3 2 0 4 2 4 4a4 4 0 0 1-4 3v1h-7v-1l-1 1c-2 0-3-2-3-4 0-1 1-3 3-3 0-2 2-4 4-4Z",
8925 "fill": getUrlById("b")
8926 }, null)])];
8927 const renderNetwork = () => createVNode("svg", {
8928 "viewBox": "0 0 160 160"
8929 }, [createVNode("defs", {
8930 "data-allow-mismatch": "children"
8931 }, [createVNode("linearGradient", {
8932 "id": getId(1),
8933 "x1": "64%",
8934 "y1": "100%",
8935 "x2": "64%"
8936 }, [renderStop("#FFF", 0, 0.5), renderStop("#F2F3F5", 100)]), createVNode("linearGradient", {
8937 "id": getId(2),
8938 "x1": "50%",
8939 "x2": "50%",
8940 "y2": "84%"
8941 }, [renderStop("#EBEDF0", 0), renderStop("#DCDEE0", 100, 0)]), createVNode("linearGradient", {
8942 "id": getId(3),
8943 "x1": "100%",
8944 "x2": "100%",
8945 "y2": "100%"
8946 }, [renderStops("#EAEDF0", "#DCDEE0")]), createVNode("radialGradient", {
8947 "id": getId(4),
8948 "cx": "50%",
8949 "cy": "0%",
8950 "fx": "50%",
8951 "fy": "0%",
8952 "r": "100%",
8953 "gradientTransform": "matrix(0 1 -.54 0 .5 -.5)"
8954 }, [renderStop("#EBEDF0", 0), renderStop("#FFF", 100, 0)])]), createVNode("g", {
8955 "fill": "none"
8956 }, [renderBuilding(), createVNode("path", {
8957 "fill": getUrlById(4),
8958 "d": "M0 139h160v21H0z",
8959 "data-allow-mismatch": "attribute"
8960 }, null), createVNode("path", {
8961 "d": "M80 54a7 7 0 0 1 3 13v27l-2 2h-2a2 2 0 0 1-2-2V67a7 7 0 0 1 3-13z",
8962 "fill": getUrlById(2),
8963 "data-allow-mismatch": "attribute"
8964 }, null), createVNode("g", {
8965 "opacity": ".6",
8966 "stroke-linecap": "round",
8967 "stroke-width": "7",
8968 "data-allow-mismatch": "children"
8969 }, [createVNode("path", {
8970 "d": "M64 47a19 19 0 0 0-5 13c0 5 2 10 5 13",
8971 "stroke": getUrlById(3)
8972 }, null), createVNode("path", {
8973 "d": "M53 36a34 34 0 0 0 0 48",
8974 "stroke": getUrlById(3)
8975 }, null), createVNode("path", {
8976 "d": "M95 73a19 19 0 0 0 6-13c0-5-2-9-6-13",
8977 "stroke": getUrlById(3)
8978 }, null), createVNode("path", {
8979 "d": "M106 84a34 34 0 0 0 0-48",
8980 "stroke": getUrlById(3)
8981 }, null)]), createVNode("g", {
8982 "transform": "translate(31 105)"
8983 }, [createVNode("rect", {
8984 "fill": "#EBEDF0",
8985 "width": "98",
8986 "height": "34",
8987 "rx": "2"
8988 }, null), createVNode("rect", {
8989 "fill": "#FFF",
8990 "x": "9",
8991 "y": "8",
8992 "width": "80",
8993 "height": "18",
8994 "rx": "1.1"
8995 }, null), createVNode("rect", {
8996 "fill": "#EBEDF0",
8997 "x": "15",
8998 "y": "12",
8999 "width": "18",
9000 "height": "6",
9001 "rx": "1.1"
9002 }, null)])])]);
9003 const renderMaterial = () => createVNode("svg", {
9004 "viewBox": "0 0 160 160"
9005 }, [createVNode("defs", {
9006 "data-allow-mismatch": "children"
9007 }, [createVNode("linearGradient", {
9008 "x1": "50%",
9009 "x2": "50%",
9010 "y2": "100%",
9011 "id": getId(5)
9012 }, [renderStops("#F2F3F5", "#DCDEE0")]), createVNode("linearGradient", {
9013 "x1": "95%",
9014 "y1": "48%",
9015 "x2": "5.5%",
9016 "y2": "51%",
9017 "id": getId(6)
9018 }, [renderStops("#EAEDF1", "#DCDEE0")]), createVNode("linearGradient", {
9019 "y1": "45%",
9020 "x2": "100%",
9021 "y2": "54%",
9022 "id": getId(7)
9023 }, [renderStops("#EAEDF1", "#DCDEE0")])]), renderBuilding(), renderCloud(), createVNode("g", {
9024 "transform": "translate(36 50)",
9025 "fill": "none"
9026 }, [createVNode("g", {
9027 "transform": "translate(8)"
9028 }, [createVNode("rect", {
9029 "fill": "#EBEDF0",
9030 "opacity": ".6",
9031 "x": "38",
9032 "y": "13",
9033 "width": "36",
9034 "height": "53",
9035 "rx": "2"
9036 }, null), createVNode("rect", {
9037 "fill": getUrlById(5),
9038 "width": "64",
9039 "height": "66",
9040 "rx": "2",
9041 "data-allow-mismatch": "attribute"
9042 }, null), createVNode("rect", {
9043 "fill": "#FFF",
9044 "x": "6",
9045 "y": "6",
9046 "width": "52",
9047 "height": "55",
9048 "rx": "1"
9049 }, null), createVNode("g", {
9050 "transform": "translate(15 17)",
9051 "fill": getUrlById(6),
9052 "data-allow-mismatch": "attribute"
9053 }, [createVNode("rect", {
9054 "width": "34",
9055 "height": "6",
9056 "rx": "1"
9057 }, null), createVNode("path", {
9058 "d": "M0 14h34v6H0z"
9059 }, null), createVNode("rect", {
9060 "y": "28",
9061 "width": "34",
9062 "height": "6",
9063 "rx": "1"
9064 }, null)])]), createVNode("rect", {
9065 "fill": getUrlById(7),
9066 "y": "61",
9067 "width": "88",
9068 "height": "28",
9069 "rx": "1",
9070 "data-allow-mismatch": "attribute"
9071 }, null), createVNode("rect", {
9072 "fill": "#F7F8FA",
9073 "x": "29",
9074 "y": "72",
9075 "width": "30",
9076 "height": "6",
9077 "rx": "1"
9078 }, null)])]);
9079 const renderError = () => createVNode("svg", {
9080 "viewBox": "0 0 160 160"
9081 }, [createVNode("defs", null, [createVNode("linearGradient", {
9082 "x1": "50%",
9083 "x2": "50%",
9084 "y2": "100%",
9085 "id": getId(8),
9086 "data-allow-mismatch": "attribute"
9087 }, [renderStops("#EAEDF1", "#DCDEE0")])]), renderBuilding(), renderCloud(), renderShadow("c"), createVNode("path", {
9088 "d": "m59 60 21 21 21-21h3l9 9v3L92 93l21 21v3l-9 9h-3l-21-21-21 21h-3l-9-9v-3l21-21-21-21v-3l9-9h3Z",
9089 "fill": getUrlById(8),
9090 "data-allow-mismatch": "attribute"
9091 }, null)]);
9092 const renderSearch = () => createVNode("svg", {
9093 "viewBox": "0 0 160 160"
9094 }, [createVNode("defs", {
9095 "data-allow-mismatch": "children"
9096 }, [createVNode("linearGradient", {
9097 "x1": "50%",
9098 "y1": "100%",
9099 "x2": "50%",
9100 "id": getId(9)
9101 }, [renderStops("#EEE", "#D8D8D8")]), createVNode("linearGradient", {
9102 "x1": "100%",
9103 "y1": "50%",
9104 "y2": "50%",
9105 "id": getId(10)
9106 }, [renderStops("#F2F3F5", "#DCDEE0")]), createVNode("linearGradient", {
9107 "x1": "50%",
9108 "x2": "50%",
9109 "y2": "100%",
9110 "id": getId(11)
9111 }, [renderStops("#F2F3F5", "#DCDEE0")]), createVNode("linearGradient", {
9112 "x1": "50%",
9113 "x2": "50%",
9114 "y2": "100%",
9115 "id": getId(12)
9116 }, [renderStops("#FFF", "#F7F8FA")])]), renderBuilding(), renderCloud(), renderShadow("d"), createVNode("g", {
9117 "transform": "rotate(-45 113 -4)",
9118 "fill": "none",
9119 "data-allow-mismatch": "children"
9120 }, [createVNode("rect", {
9121 "fill": getUrlById(9),
9122 "x": "24",
9123 "y": "52.8",
9124 "width": "5.8",
9125 "height": "19",
9126 "rx": "1"
9127 }, null), createVNode("rect", {
9128 "fill": getUrlById(10),
9129 "x": "22.1",
9130 "y": "67.3",
9131 "width": "9.9",
9132 "height": "28",
9133 "rx": "1"
9134 }, null), createVNode("circle", {
9135 "stroke": getUrlById(11),
9136 "stroke-width": "8",
9137 "cx": "27",
9138 "cy": "27",
9139 "r": "27"
9140 }, null), createVNode("circle", {
9141 "fill": getUrlById(12),
9142 "cx": "27",
9143 "cy": "27",
9144 "r": "16"
9145 }, null), createVNode("path", {
9146 "d": "M37 7c-8 0-15 5-16 12",
9147 "stroke": getUrlById(11),
9148 "stroke-width": "3",
9149 "opacity": ".5",
9150 "stroke-linecap": "round",
9151 "transform": "rotate(45 29 13)"
9152 }, null)])]);
9153 const renderImage = () => {
9154 var _a;
9155 if (slots.image) {
9156 return slots.image();
9157 }
9158 const PRESET_IMAGES = {
9159 error: renderError,
9160 search: renderSearch,
9161 network: renderNetwork,
9162 default: renderMaterial
9163 };
9164 return ((_a = PRESET_IMAGES[props2.image]) == null ? void 0 : _a.call(PRESET_IMAGES)) || createVNode("img", {
9165 "src": props2.image
9166 }, null);
9167 };
9168 return () => createVNode("div", {
9169 "class": bem$P()
9170 }, [createVNode("div", {
9171 "class": bem$P("image"),
9172 "style": getSizeStyle(props2.imageSize)
9173 }, [renderImage()]), renderDescription(), renderBottom()]);
9174 }
9175});
9176const Empty = withInstall(stdin_default$Z);
9177const [name$P, bem$O, t$9] = createNamespace("coupon-list");
9178const couponListProps = {
9179 code: makeStringProp(""),
9180 coupons: makeArrayProp(),
9181 currency: makeStringProp("¥"),
9182 showCount: truthProp,
9183 emptyImage: String,
9184 enabledTitle: String,
9185 disabledTitle: String,
9186 disabledCoupons: makeArrayProp(),
9187 showExchangeBar: truthProp,
9188 showCloseButton: truthProp,
9189 closeButtonText: String,
9190 inputPlaceholder: String,
9191 exchangeMinLength: makeNumberProp(1),
9192 exchangeButtonText: String,
9193 displayedCouponIndex: makeNumberProp(-1),
9194 exchangeButtonLoading: Boolean,
9195 exchangeButtonDisabled: Boolean,
9196 chosenCoupon: {
9197 type: [Number, Array],
9198 default: -1
9199 }
9200};
9201var stdin_default$Y = defineComponent({
9202 name: name$P,
9203 props: couponListProps,
9204 emits: ["change", "exchange", "update:code"],
9205 setup(props2, {
9206 emit,
9207 slots
9208 }) {
9209 const [couponRefs, setCouponRefs] = useRefs();
9210 const root = ref();
9211 const barRef = ref();
9212 const activeTab = ref(0);
9213 const listHeight = ref(0);
9214 const currentCode = ref(props2.code);
9215 const buttonDisabled = computed(() => !props2.exchangeButtonLoading && (props2.exchangeButtonDisabled || !currentCode.value || currentCode.value.length < props2.exchangeMinLength));
9216 const updateListHeight = () => {
9217 const TABS_HEIGHT = 44;
9218 const rootHeight = useRect(root).height;
9219 const headerHeight = useRect(barRef).height + TABS_HEIGHT;
9220 listHeight.value = (rootHeight > headerHeight ? rootHeight : windowHeight.value) - headerHeight;
9221 };
9222 const onExchange = () => {
9223 emit("exchange", currentCode.value);
9224 if (!props2.code) {
9225 currentCode.value = "";
9226 }
9227 };
9228 const scrollToCoupon = (index) => {
9229 nextTick(() => {
9230 var _a;
9231 return (_a = couponRefs.value[index]) == null ? void 0 : _a.scrollIntoView();
9232 });
9233 };
9234 const renderEmpty = () => createVNode(Empty, {
9235 "image": props2.emptyImage
9236 }, {
9237 default: () => [createVNode("p", {
9238 "class": bem$O("empty-tip")
9239 }, [t$9("noCoupon")])]
9240 });
9241 const renderExchangeBar = () => {
9242 if (props2.showExchangeBar) {
9243 return createVNode("div", {
9244 "ref": barRef,
9245 "class": bem$O("exchange-bar")
9246 }, [createVNode(Field, {
9247 "modelValue": currentCode.value,
9248 "onUpdate:modelValue": ($event) => currentCode.value = $event,
9249 "clearable": true,
9250 "border": false,
9251 "class": bem$O("field"),
9252 "placeholder": props2.inputPlaceholder || t$9("placeholder"),
9253 "maxlength": "20"
9254 }, null), createVNode(Button, {
9255 "plain": true,
9256 "type": "primary",
9257 "class": bem$O("exchange"),
9258 "text": props2.exchangeButtonText || t$9("exchange"),
9259 "loading": props2.exchangeButtonLoading,
9260 "disabled": buttonDisabled.value,
9261 "onClick": onExchange
9262 }, null)]);
9263 }
9264 };
9265 const renderCouponTab = () => {
9266 const {
9267 coupons,
9268 chosenCoupon
9269 } = props2;
9270 const count = props2.showCount ? ` (${coupons.length})` : "";
9271 const title = (props2.enabledTitle || t$9("enable")) + count;
9272 const updateChosenCoupon = (currentValues = [], value = 0) => {
9273 if (currentValues.includes(value)) {
9274 return currentValues.filter((item) => item !== value);
9275 }
9276 return [...currentValues, value];
9277 };
9278 return createVNode(Tab, {
9279 "title": title
9280 }, {
9281 default: () => {
9282 var _a;
9283 return [createVNode("div", {
9284 "class": bem$O("list", {
9285 "with-bottom": props2.showCloseButton
9286 }),
9287 "style": {
9288 height: `${listHeight.value}px`
9289 }
9290 }, [coupons.map((coupon, index) => createVNode(Coupon, {
9291 "key": coupon.id,
9292 "ref": setCouponRefs(index),
9293 "coupon": coupon,
9294 "chosen": Array.isArray(chosenCoupon) ? chosenCoupon.includes(index) : index === chosenCoupon,
9295 "currency": props2.currency,
9296 "onClick": () => emit("change", Array.isArray(chosenCoupon) ? updateChosenCoupon(chosenCoupon, index) : index)
9297 }, null)), !coupons.length && renderEmpty(), (_a = slots["list-footer"]) == null ? void 0 : _a.call(slots)])];
9298 }
9299 });
9300 };
9301 const renderDisabledTab = () => {
9302 const {
9303 disabledCoupons
9304 } = props2;
9305 const count = props2.showCount ? ` (${disabledCoupons.length})` : "";
9306 const title = (props2.disabledTitle || t$9("disabled")) + count;
9307 return createVNode(Tab, {
9308 "title": title
9309 }, {
9310 default: () => {
9311 var _a;
9312 return [createVNode("div", {
9313 "class": bem$O("list", {
9314 "with-bottom": props2.showCloseButton
9315 }),
9316 "style": {
9317 height: `${listHeight.value}px`
9318 }
9319 }, [disabledCoupons.map((coupon) => createVNode(Coupon, {
9320 "disabled": true,
9321 "key": coupon.id,
9322 "coupon": coupon,
9323 "currency": props2.currency
9324 }, null)), !disabledCoupons.length && renderEmpty(), (_a = slots["disabled-list-footer"]) == null ? void 0 : _a.call(slots)])];
9325 }
9326 });
9327 };
9328 watch(() => props2.code, (value) => {
9329 currentCode.value = value;
9330 });
9331 watch(windowHeight, updateListHeight);
9332 watch(currentCode, (value) => emit("update:code", value));
9333 watch(() => props2.displayedCouponIndex, scrollToCoupon);
9334 onMounted(() => {
9335 updateListHeight();
9336 scrollToCoupon(props2.displayedCouponIndex);
9337 });
9338 return () => createVNode("div", {
9339 "ref": root,
9340 "class": bem$O()
9341 }, [renderExchangeBar(), createVNode(Tabs, {
9342 "active": activeTab.value,
9343 "onUpdate:active": ($event) => activeTab.value = $event,
9344 "class": bem$O("tab")
9345 }, {
9346 default: () => [renderCouponTab(), renderDisabledTab()]
9347 }), createVNode("div", {
9348 "class": bem$O("bottom")
9349 }, [slots["list-button"] ? slots["list-button"]() : withDirectives(createVNode(Button, {
9350 "round": true,
9351 "block": true,
9352 "type": "primary",
9353 "class": bem$O("close"),
9354 "text": props2.closeButtonText || t$9("close"),
9355 "onClick": () => emit("change", Array.isArray(props2.chosenCoupon) ? [] : -1)
9356 }, null), [[vShow, props2.showCloseButton]])])]);
9357 }
9358});
9359const CouponList = withInstall(stdin_default$Y);
9360const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
9361const [name$O] = createNamespace("date-picker");
9362const datePickerProps = extend({}, sharedProps, {
9363 columnsType: {
9364 type: Array,
9365 default: () => ["year", "month", "day"]
9366 },
9367 minDate: {
9368 type: Date,
9369 default: () => new Date(currentYear - 10, 0, 1),
9370 validator: isDate
9371 },
9372 maxDate: {
9373 type: Date,
9374 default: () => new Date(currentYear + 10, 11, 31),
9375 validator: isDate
9376 }
9377});
9378var stdin_default$X = defineComponent({
9379 name: name$O,
9380 props: datePickerProps,
9381 emits: ["confirm", "cancel", "change", "update:modelValue"],
9382 setup(props2, {
9383 emit,
9384 slots
9385 }) {
9386 const currentValues = ref(props2.modelValue);
9387 const updatedByExternalSources = ref(false);
9388 const pickerRef = ref();
9389 const computedValues = computed(() => updatedByExternalSources.value ? props2.modelValue : currentValues.value);
9390 const isMinYear = (year) => year === props2.minDate.getFullYear();
9391 const isMaxYear = (year) => year === props2.maxDate.getFullYear();
9392 const isMinMonth = (month) => month === props2.minDate.getMonth() + 1;
9393 const isMaxMonth = (month) => month === props2.maxDate.getMonth() + 1;
9394 const getValue2 = (type) => {
9395 const {
9396 minDate,
9397 columnsType
9398 } = props2;
9399 const index = columnsType.indexOf(type);
9400 const value = computedValues.value[index];
9401 if (value) {
9402 return +value;
9403 }
9404 switch (type) {
9405 case "year":
9406 return minDate.getFullYear();
9407 case "month":
9408 return minDate.getMonth() + 1;
9409 case "day":
9410 return minDate.getDate();
9411 }
9412 };
9413 const genYearOptions = () => {
9414 const minYear = props2.minDate.getFullYear();
9415 const maxYear = props2.maxDate.getFullYear();
9416 return genOptions(minYear, maxYear, "year", props2.formatter, props2.filter, computedValues.value);
9417 };
9418 const genMonthOptions = () => {
9419 const year = getValue2("year");
9420 const minMonth = isMinYear(year) ? props2.minDate.getMonth() + 1 : 1;
9421 const maxMonth = isMaxYear(year) ? props2.maxDate.getMonth() + 1 : 12;
9422 return genOptions(minMonth, maxMonth, "month", props2.formatter, props2.filter, computedValues.value);
9423 };
9424 const genDayOptions = () => {
9425 const year = getValue2("year");
9426 const month = getValue2("month");
9427 const minDate = isMinYear(year) && isMinMonth(month) ? props2.minDate.getDate() : 1;
9428 const maxDate = isMaxYear(year) && isMaxMonth(month) ? props2.maxDate.getDate() : getMonthEndDay(year, month);
9429 return genOptions(minDate, maxDate, "day", props2.formatter, props2.filter, computedValues.value);
9430 };
9431 const confirm = () => {
9432 var _a;
9433 return (_a = pickerRef.value) == null ? void 0 : _a.confirm();
9434 };
9435 const getSelectedDate = () => currentValues.value;
9436 const columns = computed(() => props2.columnsType.map((type) => {
9437 switch (type) {
9438 case "year":
9439 return genYearOptions();
9440 case "month":
9441 return genMonthOptions();
9442 case "day":
9443 return genDayOptions();
9444 default:
9445 if (process.env.NODE_ENV !== "production") {
9446 throw new Error(`[Vant] DatePicker: unsupported columns type: ${type}`);
9447 }
9448 return [];
9449 }
9450 }));
9451 watch(currentValues, (newValues) => {
9452 if (!isSameValue(newValues, props2.modelValue)) {
9453 emit("update:modelValue", newValues);
9454 }
9455 });
9456 watch(() => props2.modelValue, (newValues, oldValues) => {
9457 updatedByExternalSources.value = isSameValue(oldValues, currentValues.value);
9458 newValues = formatValueRange(newValues, columns.value);
9459 if (!isSameValue(newValues, currentValues.value)) {
9460 currentValues.value = newValues;
9461 }
9462 updatedByExternalSources.value = false;
9463 }, {
9464 immediate: true
9465 });
9466 const onChange = (...args) => emit("change", ...args);
9467 const onCancel = (...args) => emit("cancel", ...args);
9468 const onConfirm = (...args) => emit("confirm", ...args);
9469 useExpose({
9470 confirm,
9471 getSelectedDate
9472 });
9473 return () => createVNode(Picker, mergeProps({
9474 "ref": pickerRef,
9475 "modelValue": currentValues.value,
9476 "onUpdate:modelValue": ($event) => currentValues.value = $event,
9477 "columns": columns.value,
9478 "onChange": onChange,
9479 "onCancel": onCancel,
9480 "onConfirm": onConfirm
9481 }, pick(props2, pickerInheritKeys)), slots);
9482 }
9483});
9484const DatePicker = withInstall(stdin_default$X);
9485const [name$N, bem$N, t$8] = createNamespace("dialog");
9486const dialogProps = extend({}, popupSharedProps, {
9487 title: String,
9488 theme: String,
9489 width: numericProp,
9490 message: [String, Function],
9491 callback: Function,
9492 allowHtml: Boolean,
9493 className: unknownProp,
9494 transition: makeStringProp("van-dialog-bounce"),
9495 messageAlign: String,
9496 closeOnPopstate: truthProp,
9497 showCancelButton: Boolean,
9498 cancelButtonText: String,
9499 cancelButtonColor: String,
9500 cancelButtonDisabled: Boolean,
9501 confirmButtonText: String,
9502 confirmButtonColor: String,
9503 confirmButtonDisabled: Boolean,
9504 showConfirmButton: truthProp,
9505 closeOnClickOverlay: Boolean
9506});
9507const popupInheritKeys$1 = [...popupSharedPropKeys, "transition", "closeOnPopstate"];
9508var stdin_default$W = defineComponent({
9509 name: name$N,
9510 props: dialogProps,
9511 emits: ["confirm", "cancel", "keydown", "update:show"],
9512 setup(props2, {
9513 emit,
9514 slots
9515 }) {
9516 const root = ref();
9517 const loading = reactive({
9518 confirm: false,
9519 cancel: false
9520 });
9521 const updateShow = (value) => emit("update:show", value);
9522 const close = (action) => {
9523 var _a;
9524 updateShow(false);
9525 (_a = props2.callback) == null ? void 0 : _a.call(props2, action);
9526 };
9527 const getActionHandler = (action) => () => {
9528 if (!props2.show) {
9529 return;
9530 }
9531 emit(action);
9532 if (props2.beforeClose) {
9533 loading[action] = true;
9534 callInterceptor(props2.beforeClose, {
9535 args: [action],
9536 done() {
9537 close(action);
9538 loading[action] = false;
9539 },
9540 canceled() {
9541 loading[action] = false;
9542 }
9543 });
9544 } else {
9545 close(action);
9546 }
9547 };
9548 const onCancel = getActionHandler("cancel");
9549 const onConfirm = getActionHandler("confirm");
9550 const onKeydown = withKeys((event) => {
9551 var _a, _b;
9552 if (event.target !== ((_b = (_a = root.value) == null ? void 0 : _a.popupRef) == null ? void 0 : _b.value)) {
9553 return;
9554 }
9555 const onEventType = {
9556 Enter: props2.showConfirmButton ? onConfirm : noop,
9557 Escape: props2.showCancelButton ? onCancel : noop
9558 };
9559 onEventType[event.key]();
9560 emit("keydown", event);
9561 }, ["enter", "esc"]);
9562 const renderTitle = () => {
9563 const title = slots.title ? slots.title() : props2.title;
9564 if (title) {
9565 return createVNode("div", {
9566 "class": bem$N("header", {
9567 isolated: !props2.message && !slots.default
9568 })
9569 }, [title]);
9570 }
9571 };
9572 const renderMessage = (hasTitle) => {
9573 const {
9574 message,
9575 allowHtml,
9576 messageAlign
9577 } = props2;
9578 const classNames = bem$N("message", {
9579 "has-title": hasTitle,
9580 [messageAlign]: messageAlign
9581 });
9582 const content = isFunction(message) ? message() : message;
9583 if (allowHtml && typeof content === "string") {
9584 return createVNode("div", {
9585 "class": classNames,
9586 "innerHTML": content
9587 }, null);
9588 }
9589 return createVNode("div", {
9590 "class": classNames
9591 }, [content]);
9592 };
9593 const renderContent = () => {
9594 if (slots.default) {
9595 return createVNode("div", {
9596 "class": bem$N("content")
9597 }, [slots.default()]);
9598 }
9599 const {
9600 title,
9601 message,
9602 allowHtml
9603 } = props2;
9604 if (message) {
9605 const hasTitle = !!(title || slots.title);
9606 return createVNode("div", {
9607 "key": allowHtml ? 1 : 0,
9608 "class": bem$N("content", {
9609 isolated: !hasTitle
9610 })
9611 }, [renderMessage(hasTitle)]);
9612 }
9613 };
9614 const renderButtons = () => createVNode("div", {
9615 "class": [BORDER_TOP, bem$N("footer")]
9616 }, [props2.showCancelButton && createVNode(Button, {
9617 "size": "large",
9618 "text": props2.cancelButtonText || t$8("cancel"),
9619 "class": bem$N("cancel"),
9620 "style": {
9621 color: props2.cancelButtonColor
9622 },
9623 "loading": loading.cancel,
9624 "disabled": props2.cancelButtonDisabled,
9625 "onClick": onCancel
9626 }, null), props2.showConfirmButton && createVNode(Button, {
9627 "size": "large",
9628 "text": props2.confirmButtonText || t$8("confirm"),
9629 "class": [bem$N("confirm"), {
9630 [BORDER_LEFT]: props2.showCancelButton
9631 }],
9632 "style": {
9633 color: props2.confirmButtonColor
9634 },
9635 "loading": loading.confirm,
9636 "disabled": props2.confirmButtonDisabled,
9637 "onClick": onConfirm
9638 }, null)]);
9639 const renderRoundButtons = () => createVNode(ActionBar, {
9640 "class": bem$N("footer")
9641 }, {
9642 default: () => [props2.showCancelButton && createVNode(ActionBarButton, {
9643 "type": "warning",
9644 "text": props2.cancelButtonText || t$8("cancel"),
9645 "class": bem$N("cancel"),
9646 "color": props2.cancelButtonColor,
9647 "loading": loading.cancel,
9648 "disabled": props2.cancelButtonDisabled,
9649 "onClick": onCancel
9650 }, null), props2.showConfirmButton && createVNode(ActionBarButton, {
9651 "type": "danger",
9652 "text": props2.confirmButtonText || t$8("confirm"),
9653 "class": bem$N("confirm"),
9654 "color": props2.confirmButtonColor,
9655 "loading": loading.confirm,
9656 "disabled": props2.confirmButtonDisabled,
9657 "onClick": onConfirm
9658 }, null)]
9659 });
9660 const renderFooter = () => {
9661 if (slots.footer) {
9662 return slots.footer();
9663 }
9664 return props2.theme === "round-button" ? renderRoundButtons() : renderButtons();
9665 };
9666 return () => {
9667 const {
9668 width,
9669 title,
9670 theme,
9671 message,
9672 className
9673 } = props2;
9674 return createVNode(Popup, mergeProps({
9675 "ref": root,
9676 "role": "dialog",
9677 "class": [bem$N([theme]), className],
9678 "style": {
9679 width: addUnit(width)
9680 },
9681 "tabindex": 0,
9682 "aria-labelledby": title || message,
9683 "onKeydown": onKeydown,
9684 "onUpdate:show": updateShow
9685 }, pick(props2, popupInheritKeys$1)), {
9686 default: () => [renderTitle(), renderContent(), renderFooter()]
9687 });
9688 };
9689 }
9690});
9691let instance$2;
9692const DEFAULT_OPTIONS = {
9693 title: "",
9694 width: "",
9695 theme: null,
9696 message: "",
9697 overlay: true,
9698 callback: null,
9699 teleport: "body",
9700 className: "",
9701 allowHtml: false,
9702 lockScroll: true,
9703 transition: void 0,
9704 beforeClose: null,
9705 overlayClass: "",
9706 overlayStyle: void 0,
9707 messageAlign: "",
9708 cancelButtonText: "",
9709 cancelButtonColor: null,
9710 cancelButtonDisabled: false,
9711 confirmButtonText: "",
9712 confirmButtonColor: null,
9713 confirmButtonDisabled: false,
9714 showConfirmButton: true,
9715 showCancelButton: false,
9716 closeOnPopstate: true,
9717 closeOnClickOverlay: false
9718};
9719let currentOptions$1 = extend({}, DEFAULT_OPTIONS);
9720function initInstance$2() {
9721 const Wrapper = {
9722 setup() {
9723 const {
9724 state,
9725 toggle
9726 } = usePopupState();
9727 return () => createVNode(stdin_default$W, mergeProps(state, {
9728 "onUpdate:show": toggle
9729 }), null);
9730 }
9731 };
9732 ({
9733 instance: instance$2
9734 } = mountComponent(Wrapper));
9735}
9736function showDialog(options) {
9737 if (!inBrowser) {
9738 return Promise.resolve(void 0);
9739 }
9740 return new Promise((resolve, reject) => {
9741 if (!instance$2) {
9742 initInstance$2();
9743 }
9744 instance$2.open(extend({}, currentOptions$1, options, {
9745 callback: (action) => {
9746 (action === "confirm" ? resolve : reject)(action);
9747 }
9748 }));
9749 });
9750}
9751const setDialogDefaultOptions = (options) => {
9752 extend(currentOptions$1, options);
9753};
9754const resetDialogDefaultOptions = () => {
9755 currentOptions$1 = extend({}, DEFAULT_OPTIONS);
9756};
9757const showConfirmDialog = (options) => showDialog(extend({
9758 showCancelButton: true
9759}, options));
9760const closeDialog = () => {
9761 if (instance$2) {
9762 instance$2.toggle(false);
9763 }
9764};
9765const Dialog = withInstall(stdin_default$W);
9766const [name$M, bem$M] = createNamespace("divider");
9767const dividerProps = {
9768 dashed: Boolean,
9769 hairline: truthProp,
9770 vertical: Boolean,
9771 contentPosition: makeStringProp("center")
9772};
9773var stdin_default$V = defineComponent({
9774 name: name$M,
9775 props: dividerProps,
9776 setup(props2, {
9777 slots
9778 }) {
9779 return () => {
9780 var _a;
9781 return createVNode("div", {
9782 "role": "separator",
9783 "class": bem$M({
9784 dashed: props2.dashed,
9785 hairline: props2.hairline,
9786 vertical: props2.vertical,
9787 [`content-${props2.contentPosition}`]: !!slots.default && !props2.vertical
9788 })
9789 }, [!props2.vertical && ((_a = slots.default) == null ? void 0 : _a.call(slots))]);
9790 };
9791 }
9792});
9793const Divider = withInstall(stdin_default$V);
9794const [name$L, bem$L] = createNamespace("dropdown-menu");
9795const dropdownMenuProps = {
9796 overlay: truthProp,
9797 zIndex: numericProp,
9798 duration: makeNumericProp(0.2),
9799 direction: makeStringProp("down"),
9800 activeColor: String,
9801 autoLocate: Boolean,
9802 closeOnClickOutside: truthProp,
9803 closeOnClickOverlay: truthProp,
9804 swipeThreshold: numericProp
9805};
9806const DROPDOWN_KEY = Symbol(name$L);
9807var stdin_default$U = defineComponent({
9808 name: name$L,
9809 props: dropdownMenuProps,
9810 setup(props2, {
9811 slots
9812 }) {
9813 const id = useId();
9814 const root = ref();
9815 const barRef = ref();
9816 const offset = ref(0);
9817 const {
9818 children,
9819 linkChildren
9820 } = useChildren(DROPDOWN_KEY);
9821 const scrollParent = useScrollParent(root);
9822 const opened = computed(() => children.some((item) => item.state.showWrapper));
9823 const scrollable = computed(() => props2.swipeThreshold && children.length > +props2.swipeThreshold);
9824 const barStyle = computed(() => {
9825 if (opened.value && isDef(props2.zIndex)) {
9826 return {
9827 zIndex: +props2.zIndex + 1
9828 };
9829 }
9830 });
9831 const close = () => {
9832 children.forEach((item) => {
9833 item.toggle(false);
9834 });
9835 };
9836 const onClickAway = () => {
9837 if (props2.closeOnClickOutside) {
9838 close();
9839 }
9840 };
9841 const updateOffset = () => {
9842 if (barRef.value) {
9843 const rect = useRect(barRef);
9844 if (props2.direction === "down") {
9845 offset.value = rect.bottom;
9846 } else {
9847 offset.value = windowHeight.value - rect.top;
9848 }
9849 }
9850 };
9851 const onScroll = () => {
9852 if (opened.value) {
9853 updateOffset();
9854 }
9855 };
9856 const toggleItem = (active) => {
9857 children.forEach((item, index) => {
9858 if (index === active) {
9859 item.toggle();
9860 } else if (item.state.showPopup) {
9861 item.toggle(false, {
9862 immediate: true
9863 });
9864 }
9865 });
9866 };
9867 const renderTitle = (item, index) => {
9868 const {
9869 showPopup
9870 } = item.state;
9871 const {
9872 disabled,
9873 titleClass
9874 } = item;
9875 return createVNode("div", {
9876 "id": `${id}-${index}`,
9877 "role": "button",
9878 "tabindex": disabled ? void 0 : 0,
9879 "data-allow-mismatch": "attribute",
9880 "class": [bem$L("item", {
9881 disabled,
9882 grow: scrollable.value
9883 }), {
9884 [HAPTICS_FEEDBACK]: !disabled
9885 }],
9886 "onClick": () => {
9887 if (!disabled) {
9888 toggleItem(index);
9889 }
9890 }
9891 }, [createVNode("span", {
9892 "class": [bem$L("title", {
9893 down: showPopup === (props2.direction === "down"),
9894 active: showPopup
9895 }), titleClass],
9896 "style": {
9897 color: showPopup ? props2.activeColor : ""
9898 }
9899 }, [createVNode("div", {
9900 "class": "van-ellipsis"
9901 }, [item.renderTitle()])])]);
9902 };
9903 useExpose({
9904 close
9905 });
9906 linkChildren({
9907 id,
9908 props: props2,
9909 offset,
9910 updateOffset
9911 });
9912 useClickAway(root, onClickAway);
9913 useEventListener("scroll", onScroll, {
9914 target: scrollParent,
9915 passive: true
9916 });
9917 return () => {
9918 var _a;
9919 return createVNode("div", {
9920 "ref": root,
9921 "class": bem$L()
9922 }, [createVNode("div", {
9923 "ref": barRef,
9924 "style": barStyle.value,
9925 "class": bem$L("bar", {
9926 opened: opened.value,
9927 scrollable: scrollable.value
9928 })
9929 }, [children.map(renderTitle)]), (_a = slots.default) == null ? void 0 : _a.call(slots)]);
9930 };
9931 }
9932});
9933const [name$K, bem$K] = createNamespace("dropdown-item");
9934const dropdownItemProps = {
9935 title: String,
9936 options: makeArrayProp(),
9937 disabled: Boolean,
9938 teleport: [String, Object],
9939 lazyRender: truthProp,
9940 modelValue: unknownProp,
9941 titleClass: unknownProp
9942};
9943var stdin_default$T = defineComponent({
9944 name: name$K,
9945 inheritAttrs: false,
9946 props: dropdownItemProps,
9947 emits: ["open", "opened", "close", "closed", "change", "update:modelValue"],
9948 setup(props2, {
9949 emit,
9950 slots,
9951 attrs
9952 }) {
9953 const state = reactive({
9954 showPopup: false,
9955 transition: true,
9956 showWrapper: false
9957 });
9958 const wrapperRef = ref();
9959 const {
9960 parent,
9961 index
9962 } = useParent(DROPDOWN_KEY);
9963 if (!parent) {
9964 if (process.env.NODE_ENV !== "production") {
9965 console.error("[Vant] <DropdownItem> must be a child component of <DropdownMenu>.");
9966 }
9967 return;
9968 }
9969 const getEmitter = (name2) => () => emit(name2);
9970 const onOpen = getEmitter("open");
9971 const onClose = getEmitter("close");
9972 const onOpened = getEmitter("opened");
9973 const onClosed = () => {
9974 state.showWrapper = false;
9975 emit("closed");
9976 };
9977 const onClickWrapper = (event) => {
9978 if (props2.teleport) {
9979 event.stopPropagation();
9980 }
9981 };
9982 const toggle = (show = !state.showPopup, options = {}) => {
9983 if (show === state.showPopup) {
9984 return;
9985 }
9986 state.showPopup = show;
9987 state.transition = !options.immediate;
9988 if (show) {
9989 parent.updateOffset();
9990 state.showWrapper = true;
9991 }
9992 };
9993 const renderTitle = () => {
9994 if (slots.title) {
9995 return slots.title();
9996 }
9997 if (props2.title) {
9998 return props2.title;
9999 }
10000 const match = props2.options.find((option) => option.value === props2.modelValue);
10001 return match ? match.text : "";
10002 };
10003 const renderOption = (option) => {
10004 const {
10005 activeColor
10006 } = parent.props;
10007 const {
10008 disabled
10009 } = option;
10010 const active = option.value === props2.modelValue;
10011 const onClick = () => {
10012 if (disabled) {
10013 return;
10014 }
10015 state.showPopup = false;
10016 if (option.value !== props2.modelValue) {
10017 emit("update:modelValue", option.value);
10018 emit("change", option.value);
10019 }
10020 };
10021 const renderIcon = () => {
10022 if (active) {
10023 return createVNode(Icon, {
10024 "class": bem$K("icon"),
10025 "color": disabled ? void 0 : activeColor,
10026 "name": "success"
10027 }, null);
10028 }
10029 };
10030 return createVNode(Cell, {
10031 "role": "menuitem",
10032 "key": String(option.value),
10033 "icon": option.icon,
10034 "title": option.text,
10035 "class": bem$K("option", {
10036 active,
10037 disabled
10038 }),
10039 "style": {
10040 color: active ? activeColor : ""
10041 },
10042 "tabindex": active ? 0 : -1,
10043 "clickable": !disabled,
10044 "onClick": onClick
10045 }, {
10046 value: renderIcon
10047 });
10048 };
10049 const renderContent = () => {
10050 const {
10051 offset
10052 } = parent;
10053 const {
10054 autoLocate,
10055 zIndex,
10056 overlay,
10057 duration,
10058 direction,
10059 closeOnClickOverlay
10060 } = parent.props;
10061 const style = getZIndexStyle(zIndex);
10062 let offsetValue = offset.value;
10063 if (autoLocate && wrapperRef.value) {
10064 const offsetParent = getContainingBlock(wrapperRef.value);
10065 if (offsetParent) {
10066 offsetValue -= useRect(offsetParent).top;
10067 }
10068 }
10069 if (direction === "down") {
10070 style.top = `${offsetValue}px`;
10071 } else {
10072 style.bottom = `${offsetValue}px`;
10073 }
10074 return withDirectives(createVNode("div", mergeProps({
10075 "ref": wrapperRef,
10076 "style": style,
10077 "class": bem$K([direction]),
10078 "onClick": onClickWrapper
10079 }, attrs), [createVNode(Popup, {
10080 "show": state.showPopup,
10081 "onUpdate:show": ($event) => state.showPopup = $event,
10082 "role": "menu",
10083 "class": bem$K("content"),
10084 "overlay": overlay,
10085 "position": direction === "down" ? "top" : "bottom",
10086 "duration": state.transition ? duration : 0,
10087 "lazyRender": props2.lazyRender,
10088 "overlayStyle": {
10089 position: "absolute"
10090 },
10091 "aria-labelledby": `${parent.id}-${index.value}`,
10092 "data-allow-mismatch": "attribute",
10093 "closeOnClickOverlay": closeOnClickOverlay,
10094 "onOpen": onOpen,
10095 "onClose": onClose,
10096 "onOpened": onOpened,
10097 "onClosed": onClosed
10098 }, {
10099 default: () => {
10100 var _a;
10101 return [props2.options.map(renderOption), (_a = slots.default) == null ? void 0 : _a.call(slots)];
10102 }
10103 })]), [[vShow, state.showWrapper]]);
10104 };
10105 useExpose({
10106 state,
10107 toggle,
10108 renderTitle
10109 });
10110 return () => {
10111 if (props2.teleport) {
10112 return createVNode(Teleport, {
10113 "to": props2.teleport
10114 }, {
10115 default: () => [renderContent()]
10116 });
10117 }
10118 return renderContent();
10119 };
10120 }
10121});
10122const DropdownItem = withInstall(stdin_default$T);
10123const DropdownMenu = withInstall(stdin_default$U);
10124const floatingBubbleProps = {
10125 gap: makeNumberProp(24),
10126 icon: String,
10127 axis: makeStringProp("y"),
10128 magnetic: String,
10129 offset: {
10130 type: Object,
10131 default: () => ({
10132 x: -1,
10133 y: -1
10134 })
10135 },
10136 teleport: {
10137 type: [String, Object],
10138 default: "body"
10139 }
10140};
10141const [name$J, bem$J] = createNamespace("floating-bubble");
10142var stdin_default$S = defineComponent({
10143 name: name$J,
10144 inheritAttrs: false,
10145 props: floatingBubbleProps,
10146 emits: ["click", "update:offset", "offsetChange"],
10147 setup(props2, {
10148 slots,
10149 emit,
10150 attrs
10151 }) {
10152 const rootRef = ref();
10153 const state = ref({
10154 x: 0,
10155 y: 0,
10156 width: 0,
10157 height: 0
10158 });
10159 const boundary = computed(() => ({
10160 top: props2.gap,
10161 right: windowWidth.value - state.value.width - props2.gap,
10162 bottom: windowHeight.value - state.value.height - props2.gap,
10163 left: props2.gap
10164 }));
10165 const dragging = ref(false);
10166 let initialized = false;
10167 const rootStyle = computed(() => {
10168 const style = {};
10169 const x = addUnit(state.value.x);
10170 const y = addUnit(state.value.y);
10171 style.transform = `translate3d(${x}, ${y}, 0)`;
10172 if (dragging.value || !initialized) {
10173 style.transition = "none";
10174 }
10175 return style;
10176 });
10177 const updateState = () => {
10178 if (!show.value) return;
10179 const {
10180 width,
10181 height
10182 } = useRect(rootRef.value);
10183 const {
10184 offset
10185 } = props2;
10186 state.value = {
10187 x: offset.x > -1 ? offset.x : windowWidth.value - width - props2.gap,
10188 y: offset.y > -1 ? offset.y : windowHeight.value - height - props2.gap,
10189 width,
10190 height
10191 };
10192 };
10193 const touch = useTouch();
10194 let prevX = 0;
10195 let prevY = 0;
10196 const onTouchStart = (e) => {
10197 touch.start(e);
10198 dragging.value = true;
10199 prevX = state.value.x;
10200 prevY = state.value.y;
10201 };
10202 const onTouchMove = (e) => {
10203 e.preventDefault();
10204 touch.move(e);
10205 if (props2.axis === "lock") return;
10206 if (!touch.isTap.value) {
10207 if (props2.axis === "x" || props2.axis === "xy") {
10208 let nextX = prevX + touch.deltaX.value;
10209 if (nextX < boundary.value.left) nextX = boundary.value.left;
10210 if (nextX > boundary.value.right) nextX = boundary.value.right;
10211 state.value.x = nextX;
10212 }
10213 if (props2.axis === "y" || props2.axis === "xy") {
10214 let nextY = prevY + touch.deltaY.value;
10215 if (nextY < boundary.value.top) nextY = boundary.value.top;
10216 if (nextY > boundary.value.bottom) nextY = boundary.value.bottom;
10217 state.value.y = nextY;
10218 }
10219 const offset = pick(state.value, ["x", "y"]);
10220 emit("update:offset", offset);
10221 }
10222 };
10223 useEventListener("touchmove", onTouchMove, {
10224 target: rootRef
10225 });
10226 const onTouchEnd = () => {
10227 dragging.value = false;
10228 nextTick(() => {
10229 if (props2.magnetic === "x") {
10230 const nextX = closest([boundary.value.left, boundary.value.right], state.value.x);
10231 state.value.x = nextX;
10232 }
10233 if (props2.magnetic === "y") {
10234 const nextY = closest([boundary.value.top, boundary.value.bottom], state.value.y);
10235 state.value.y = nextY;
10236 }
10237 if (!touch.isTap.value) {
10238 const offset = pick(state.value, ["x", "y"]);
10239 emit("update:offset", offset);
10240 if (prevX !== offset.x || prevY !== offset.y) {
10241 emit("offsetChange", offset);
10242 }
10243 }
10244 });
10245 };
10246 const onClick = (e) => {
10247 if (touch.isTap.value) emit("click", e);
10248 else e.stopPropagation();
10249 };
10250 onMounted(() => {
10251 updateState();
10252 nextTick(() => {
10253 initialized = true;
10254 });
10255 });
10256 watch([windowWidth, windowHeight, () => props2.gap, () => props2.offset], updateState, {
10257 deep: true
10258 });
10259 const show = ref(true);
10260 onActivated(() => {
10261 show.value = true;
10262 });
10263 onDeactivated(() => {
10264 if (props2.teleport) {
10265 show.value = false;
10266 }
10267 });
10268 return () => {
10269 const Content = withDirectives(createVNode("div", mergeProps({
10270 "class": bem$J(),
10271 "ref": rootRef,
10272 "onTouchstartPassive": onTouchStart,
10273 "onTouchend": onTouchEnd,
10274 "onTouchcancel": onTouchEnd,
10275 "onClickCapture": onClick,
10276 "style": rootStyle.value
10277 }, attrs), [slots.default ? slots.default() : createVNode(stdin_default$1Q, {
10278 "name": props2.icon,
10279 "class": bem$J("icon")
10280 }, null)]), [[vShow, show.value]]);
10281 return props2.teleport ? createVNode(Teleport, {
10282 "to": props2.teleport
10283 }, {
10284 default: () => [Content]
10285 }) : Content;
10286 };
10287 }
10288});
10289const FloatingBubble = withInstall(stdin_default$S);
10290const floatingPanelProps = {
10291 height: makeNumericProp(0),
10292 anchors: makeArrayProp(),
10293 duration: makeNumericProp(0.3),
10294 contentDraggable: truthProp,
10295 lockScroll: Boolean,
10296 safeAreaInsetBottom: truthProp
10297};
10298const [name$I, bem$I] = createNamespace("floating-panel");
10299var stdin_default$R = defineComponent({
10300 name: name$I,
10301 props: floatingPanelProps,
10302 emits: ["heightChange", "update:height"],
10303 setup(props2, {
10304 emit,
10305 slots
10306 }) {
10307 const DAMP = 0.2;
10308 const rootRef = ref();
10309 const contentRef = ref();
10310 const height = useSyncPropRef(() => +props2.height, (value) => emit("update:height", value));
10311 const boundary = computed(() => {
10312 var _a, _b;
10313 return {
10314 min: (_a = props2.anchors[0]) != null ? _a : 100,
10315 max: (_b = props2.anchors[props2.anchors.length - 1]) != null ? _b : Math.round(windowHeight.value * 0.6)
10316 };
10317 });
10318 const anchors = computed(() => props2.anchors.length >= 2 ? props2.anchors : [boundary.value.min, boundary.value.max]);
10319 const dragging = ref(false);
10320 const rootStyle = computed(() => ({
10321 height: addUnit(boundary.value.max),
10322 transform: `translateY(calc(100% + ${addUnit(-height.value)}))`,
10323 transition: !dragging.value ? `transform ${props2.duration}s cubic-bezier(0.18, 0.89, 0.32, 1.28)` : "none"
10324 }));
10325 const ease = (moveY) => {
10326 const absDistance = Math.abs(moveY);
10327 const {
10328 min,
10329 max
10330 } = boundary.value;
10331 if (absDistance > max) {
10332 return -(max + (absDistance - max) * DAMP);
10333 }
10334 if (absDistance < min) {
10335 return -(min - (min - absDistance) * DAMP);
10336 }
10337 return moveY;
10338 };
10339 let startY;
10340 let maxScroll = -1;
10341 const touch = useTouch();
10342 const onTouchstart = (e) => {
10343 touch.start(e);
10344 dragging.value = true;
10345 startY = -height.value;
10346 maxScroll = -1;
10347 };
10348 const onTouchmove = (e) => {
10349 var _a;
10350 touch.move(e);
10351 const target = e.target;
10352 if (contentRef.value === target || ((_a = contentRef.value) == null ? void 0 : _a.contains(target))) {
10353 const {
10354 scrollTop
10355 } = contentRef.value;
10356 maxScroll = Math.max(maxScroll, scrollTop);
10357 if (!props2.contentDraggable) return;
10358 if (-startY < boundary.value.max) {
10359 preventDefault(e, true);
10360 } else if (!(scrollTop <= 0 && touch.deltaY.value > 0) || maxScroll > 0) {
10361 return;
10362 }
10363 }
10364 const moveY = touch.deltaY.value + startY;
10365 height.value = -ease(moveY);
10366 };
10367 const onTouchend = () => {
10368 maxScroll = -1;
10369 dragging.value = false;
10370 height.value = closest(anchors.value, height.value);
10371 if (height.value !== -startY) {
10372 emit("heightChange", {
10373 height: height.value
10374 });
10375 }
10376 };
10377 watch(boundary, () => {
10378 height.value = closest(anchors.value, height.value);
10379 }, {
10380 immediate: true
10381 });
10382 useLockScroll(rootRef, () => props2.lockScroll || dragging.value);
10383 useEventListener("touchmove", onTouchmove, {
10384 target: rootRef
10385 });
10386 const renderHeader = () => {
10387 if (slots.header) {
10388 return slots.header();
10389 }
10390 return createVNode("div", {
10391 "class": bem$I("header")
10392 }, [createVNode("div", {
10393 "class": bem$I("header-bar")
10394 }, null)]);
10395 };
10396 return () => {
10397 var _a;
10398 return createVNode("div", {
10399 "class": [bem$I(), {
10400 "van-safe-area-bottom": props2.safeAreaInsetBottom
10401 }],
10402 "ref": rootRef,
10403 "style": rootStyle.value,
10404 "onTouchstartPassive": onTouchstart,
10405 "onTouchend": onTouchend,
10406 "onTouchcancel": onTouchend
10407 }, [renderHeader(), createVNode("div", {
10408 "class": bem$I("content"),
10409 "ref": contentRef
10410 }, [(_a = slots.default) == null ? void 0 : _a.call(slots)])]);
10411 };
10412 }
10413});
10414const FloatingPanel = withInstall(stdin_default$R);
10415const [name$H, bem$H] = createNamespace("grid");
10416const gridProps = {
10417 square: Boolean,
10418 center: truthProp,
10419 border: truthProp,
10420 gutter: numericProp,
10421 reverse: Boolean,
10422 iconSize: numericProp,
10423 direction: String,
10424 clickable: Boolean,
10425 columnNum: makeNumericProp(4)
10426};
10427const GRID_KEY = Symbol(name$H);
10428var stdin_default$Q = defineComponent({
10429 name: name$H,
10430 props: gridProps,
10431 setup(props2, {
10432 slots
10433 }) {
10434 const {
10435 linkChildren
10436 } = useChildren(GRID_KEY);
10437 linkChildren({
10438 props: props2
10439 });
10440 return () => {
10441 var _a;
10442 return createVNode("div", {
10443 "style": {
10444 paddingLeft: addUnit(props2.gutter)
10445 },
10446 "class": [bem$H(), {
10447 [BORDER_TOP]: props2.border && !props2.gutter
10448 }]
10449 }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
10450 };
10451 }
10452});
10453const Grid = withInstall(stdin_default$Q);
10454const [name$G, bem$G] = createNamespace("grid-item");
10455const gridItemProps = extend({}, routeProps, {
10456 dot: Boolean,
10457 text: String,
10458 icon: String,
10459 badge: numericProp,
10460 iconColor: String,
10461 iconPrefix: String,
10462 badgeProps: Object
10463});
10464var stdin_default$P = defineComponent({
10465 name: name$G,
10466 props: gridItemProps,
10467 setup(props2, {
10468 slots
10469 }) {
10470 const {
10471 parent,
10472 index
10473 } = useParent(GRID_KEY);
10474 const route2 = useRoute();
10475 if (!parent) {
10476 if (process.env.NODE_ENV !== "production") {
10477 console.error("[Vant] <GridItem> must be a child component of <Grid>.");
10478 }
10479 return;
10480 }
10481 const rootStyle = computed(() => {
10482 const {
10483 square,
10484 gutter,
10485 columnNum
10486 } = parent.props;
10487 const percent = `${100 / +columnNum}%`;
10488 const style = {
10489 flexBasis: percent
10490 };
10491 if (square) {
10492 style.paddingTop = percent;
10493 } else if (gutter) {
10494 const gutterValue = addUnit(gutter);
10495 style.paddingRight = gutterValue;
10496 if (index.value >= +columnNum) {
10497 style.marginTop = gutterValue;
10498 }
10499 }
10500 return style;
10501 });
10502 const contentStyle = computed(() => {
10503 const {
10504 square,
10505 gutter
10506 } = parent.props;
10507 if (square && gutter) {
10508 const gutterValue = addUnit(gutter);
10509 return {
10510 right: gutterValue,
10511 bottom: gutterValue,
10512 height: "auto"
10513 };
10514 }
10515 });
10516 const renderIcon = () => {
10517 if (slots.icon) {
10518 return createVNode(Badge, mergeProps({
10519 "dot": props2.dot,
10520 "content": props2.badge
10521 }, props2.badgeProps), {
10522 default: slots.icon
10523 });
10524 }
10525 if (props2.icon) {
10526 return createVNode(Icon, {
10527 "dot": props2.dot,
10528 "name": props2.icon,
10529 "size": parent.props.iconSize,
10530 "badge": props2.badge,
10531 "class": bem$G("icon"),
10532 "color": props2.iconColor,
10533 "badgeProps": props2.badgeProps,
10534 "classPrefix": props2.iconPrefix
10535 }, null);
10536 }
10537 };
10538 const renderText = () => {
10539 if (slots.text) {
10540 return slots.text();
10541 }
10542 if (props2.text) {
10543 return createVNode("span", {
10544 "class": bem$G("text")
10545 }, [props2.text]);
10546 }
10547 };
10548 const renderContent = () => {
10549 if (slots.default) {
10550 return slots.default();
10551 }
10552 return [renderIcon(), renderText()];
10553 };
10554 return () => {
10555 const {
10556 center,
10557 border,
10558 square,
10559 gutter,
10560 reverse,
10561 direction,
10562 clickable
10563 } = parent.props;
10564 const classes = [bem$G("content", [direction, {
10565 center,
10566 square,
10567 reverse,
10568 clickable,
10569 surround: border && gutter
10570 }]), {
10571 [BORDER]: border
10572 }];
10573 return createVNode("div", {
10574 "class": [bem$G({
10575 square
10576 })],
10577 "style": rootStyle.value
10578 }, [createVNode("div", {
10579 "role": clickable ? "button" : void 0,
10580 "class": classes,
10581 "style": contentStyle.value,
10582 "tabindex": clickable ? 0 : void 0,
10583 "onClick": route2
10584 }, [renderContent()])]);
10585 };
10586 }
10587});
10588const GridItem = withInstall(stdin_default$P);
10589const [name$F, bem$F] = createNamespace("highlight");
10590const highlightProps = {
10591 autoEscape: truthProp,
10592 caseSensitive: Boolean,
10593 highlightClass: String,
10594 highlightTag: makeStringProp("span"),
10595 keywords: makeRequiredProp([String, Array]),
10596 sourceString: makeStringProp(""),
10597 tag: makeStringProp("div"),
10598 unhighlightClass: String,
10599 unhighlightTag: makeStringProp("span")
10600};
10601var stdin_default$O = defineComponent({
10602 name: name$F,
10603 props: highlightProps,
10604 setup(props2) {
10605 const highlightChunks = computed(() => {
10606 const {
10607 autoEscape,
10608 caseSensitive,
10609 keywords,
10610 sourceString
10611 } = props2;
10612 const flags = caseSensitive ? "g" : "gi";
10613 const _keywords = Array.isArray(keywords) ? keywords : [keywords];
10614 let chunks = _keywords.filter((keyword) => keyword).reduce((chunks2, keyword) => {
10615 if (autoEscape) {
10616 keyword = keyword.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
10617 }
10618 const regex = new RegExp(keyword, flags);
10619 let match;
10620 while (match = regex.exec(sourceString)) {
10621 const start = match.index;
10622 const end = regex.lastIndex;
10623 if (start >= end) {
10624 regex.lastIndex++;
10625 continue;
10626 }
10627 chunks2.push({
10628 start,
10629 end,
10630 highlight: true
10631 });
10632 }
10633 return chunks2;
10634 }, []);
10635 chunks = chunks.sort((a, b) => a.start - b.start).reduce((chunks2, currentChunk) => {
10636 const prevChunk = chunks2[chunks2.length - 1];
10637 if (!prevChunk || currentChunk.start > prevChunk.end) {
10638 const unhighlightStart = prevChunk ? prevChunk.end : 0;
10639 const unhighlightEnd = currentChunk.start;
10640 if (unhighlightStart !== unhighlightEnd) {
10641 chunks2.push({
10642 start: unhighlightStart,
10643 end: unhighlightEnd,
10644 highlight: false
10645 });
10646 }
10647 chunks2.push(currentChunk);
10648 } else {
10649 prevChunk.end = Math.max(prevChunk.end, currentChunk.end);
10650 }
10651 return chunks2;
10652 }, []);
10653 const lastChunk = chunks[chunks.length - 1];
10654 if (!lastChunk) {
10655 chunks.push({
10656 start: 0,
10657 end: sourceString.length,
10658 highlight: false
10659 });
10660 }
10661 if (lastChunk && lastChunk.end < sourceString.length) {
10662 chunks.push({
10663 start: lastChunk.end,
10664 end: sourceString.length,
10665 highlight: false
10666 });
10667 }
10668 return chunks;
10669 });
10670 const renderContent = () => {
10671 const {
10672 sourceString,
10673 highlightClass,
10674 unhighlightClass,
10675 highlightTag,
10676 unhighlightTag
10677 } = props2;
10678 return highlightChunks.value.map((chunk) => {
10679 const {
10680 start,
10681 end,
10682 highlight
10683 } = chunk;
10684 const text = sourceString.slice(start, end);
10685 if (highlight) {
10686 return createVNode(highlightTag, {
10687 "class": [bem$F("tag"), highlightClass]
10688 }, {
10689 default: () => [text]
10690 });
10691 }
10692 return createVNode(unhighlightTag, {
10693 "class": unhighlightClass
10694 }, {
10695 default: () => [text]
10696 });
10697 });
10698 };
10699 return () => {
10700 const {
10701 tag
10702 } = props2;
10703 return createVNode(tag, {
10704 "class": bem$F()
10705 }, {
10706 default: () => [renderContent()]
10707 });
10708 };
10709 }
10710});
10711const Highlight = withInstall(stdin_default$O);
10712const getDistance = (touches) => Math.sqrt((touches[0].clientX - touches[1].clientX) ** 2 + (touches[0].clientY - touches[1].clientY) ** 2);
10713const getCenter = (touches) => ({
10714 x: (touches[0].clientX + touches[1].clientX) / 2,
10715 y: (touches[0].clientY + touches[1].clientY) / 2
10716});
10717const bem$E = createNamespace("image-preview")[1];
10718const longImageRatio = 2.6;
10719const imagePreviewItemProps = {
10720 src: String,
10721 show: Boolean,
10722 active: Number,
10723 minZoom: makeRequiredProp(numericProp),
10724 maxZoom: makeRequiredProp(numericProp),
10725 rootWidth: makeRequiredProp(Number),
10726 rootHeight: makeRequiredProp(Number),
10727 disableZoom: Boolean,
10728 doubleScale: Boolean,
10729 closeOnClickImage: Boolean,
10730 closeOnClickOverlay: Boolean,
10731 vertical: Boolean
10732};
10733var stdin_default$N = defineComponent({
10734 props: imagePreviewItemProps,
10735 emits: ["scale", "close", "longPress"],
10736 setup(props2, {
10737 emit,
10738 slots
10739 }) {
10740 const state = reactive({
10741 scale: 1,
10742 moveX: 0,
10743 moveY: 0,
10744 moving: false,
10745 zooming: false,
10746 initializing: false,
10747 imageRatio: 0
10748 });
10749 const touch = useTouch();
10750 const imageRef = ref();
10751 const swipeItem = ref();
10752 const vertical = ref(false);
10753 const isLongImage = ref(false);
10754 let initialMoveY = 0;
10755 const imageStyle = computed(() => {
10756 const {
10757 scale,
10758 moveX,
10759 moveY,
10760 moving,
10761 zooming,
10762 initializing
10763 } = state;
10764 const style = {
10765 transitionDuration: zooming || moving || initializing ? "0s" : ".3s"
10766 };
10767 if (scale !== 1 || isLongImage.value) {
10768 style.transform = `matrix(${scale}, 0, 0, ${scale}, ${moveX}, ${moveY})`;
10769 }
10770 return style;
10771 });
10772 const maxMoveX = computed(() => {
10773 if (state.imageRatio) {
10774 const {
10775 rootWidth,
10776 rootHeight
10777 } = props2;
10778 const displayWidth = vertical.value ? rootHeight / state.imageRatio : rootWidth;
10779 return Math.max(0, (state.scale * displayWidth - rootWidth) / 2);
10780 }
10781 return 0;
10782 });
10783 const maxMoveY = computed(() => {
10784 if (state.imageRatio) {
10785 const {
10786 rootWidth,
10787 rootHeight
10788 } = props2;
10789 const displayHeight = vertical.value ? rootHeight : rootWidth * state.imageRatio;
10790 return Math.max(0, (state.scale * displayHeight - rootHeight) / 2);
10791 }
10792 return 0;
10793 });
10794 const setScale = (scale, center) => {
10795 var _a;
10796 scale = clamp(scale, +props2.minZoom, +props2.maxZoom + 1);
10797 if (scale !== state.scale) {
10798 const ratio = scale / state.scale;
10799 state.scale = scale;
10800 if (center) {
10801 const imageRect = useRect((_a = imageRef.value) == null ? void 0 : _a.$el);
10802 const origin = {
10803 x: imageRect.width * 0.5,
10804 y: imageRect.height * 0.5
10805 };
10806 const moveX = state.moveX - (center.x - imageRect.left - origin.x) * (ratio - 1);
10807 const moveY = state.moveY - (center.y - imageRect.top - origin.y) * (ratio - 1);
10808 state.moveX = clamp(moveX, -maxMoveX.value, maxMoveX.value);
10809 state.moveY = clamp(moveY, -maxMoveY.value, maxMoveY.value);
10810 } else {
10811 state.moveX = 0;
10812 state.moveY = isLongImage.value ? initialMoveY : 0;
10813 }
10814 emit("scale", {
10815 scale,
10816 index: props2.active
10817 });
10818 }
10819 };
10820 const resetScale = () => {
10821 setScale(1);
10822 };
10823 const toggleScale = () => {
10824 const scale = state.scale > 1 ? 1 : 2;
10825 setScale(scale, scale === 2 || isLongImage.value ? {
10826 x: touch.startX.value,
10827 y: touch.startY.value
10828 } : void 0);
10829 };
10830 let fingerNum;
10831 let startMoveX;
10832 let startMoveY;
10833 let startScale;
10834 let startDistance;
10835 let lastCenter;
10836 let doubleTapTimer;
10837 let touchStartTime;
10838 let isImageMoved = false;
10839 const onTouchStart = (event) => {
10840 const {
10841 touches
10842 } = event;
10843 fingerNum = touches.length;
10844 if (fingerNum === 2 && props2.disableZoom) {
10845 return;
10846 }
10847 const {
10848 offsetX
10849 } = touch;
10850 touch.start(event);
10851 startMoveX = state.moveX;
10852 startMoveY = state.moveY;
10853 touchStartTime = Date.now();
10854 isImageMoved = false;
10855 state.moving = fingerNum === 1 && (state.scale !== 1 || isLongImage.value);
10856 state.zooming = fingerNum === 2 && !offsetX.value;
10857 if (state.zooming) {
10858 startScale = state.scale;
10859 startDistance = getDistance(touches);
10860 }
10861 };
10862 const onTouchMove = (event) => {
10863 const {
10864 touches
10865 } = event;
10866 touch.move(event);
10867 if (state.moving) {
10868 const {
10869 deltaX,
10870 deltaY
10871 } = touch;
10872 const moveX = deltaX.value + startMoveX;
10873 const moveY = deltaY.value + startMoveY;
10874 if ((props2.vertical ? touch.isVertical() && Math.abs(moveY) > maxMoveY.value : touch.isHorizontal() && Math.abs(moveX) > maxMoveX.value) && !isImageMoved) {
10875 state.moving = false;
10876 return;
10877 }
10878 isImageMoved = true;
10879 preventDefault(event, true);
10880 state.moveX = clamp(moveX, -maxMoveX.value, maxMoveX.value);
10881 state.moveY = clamp(moveY, -maxMoveY.value, maxMoveY.value);
10882 }
10883 if (state.zooming) {
10884 preventDefault(event, true);
10885 if (touches.length === 2) {
10886 const distance = getDistance(touches);
10887 const scale = startScale * distance / startDistance;
10888 lastCenter = getCenter(touches);
10889 setScale(scale, lastCenter);
10890 }
10891 }
10892 };
10893 const checkClose = (event) => {
10894 var _a;
10895 const swipeItemEl = (_a = swipeItem.value) == null ? void 0 : _a.$el;
10896 if (!swipeItemEl) return;
10897 const imageEl = swipeItemEl.firstElementChild;
10898 const isClickOverlay = event.target === swipeItemEl;
10899 const isClickImage = imageEl == null ? void 0 : imageEl.contains(event.target);
10900 if (!props2.closeOnClickImage && isClickImage) return;
10901 if (!props2.closeOnClickOverlay && isClickOverlay) return;
10902 emit("close");
10903 };
10904 const checkTap = (event) => {
10905 if (fingerNum > 1) {
10906 return;
10907 }
10908 const deltaTime = Date.now() - touchStartTime;
10909 const TAP_TIME = 250;
10910 if (touch.isTap.value) {
10911 if (deltaTime < TAP_TIME) {
10912 if (props2.doubleScale) {
10913 if (doubleTapTimer) {
10914 clearTimeout(doubleTapTimer);
10915 doubleTapTimer = null;
10916 toggleScale();
10917 } else {
10918 doubleTapTimer = setTimeout(() => {
10919 checkClose(event);
10920 doubleTapTimer = null;
10921 }, TAP_TIME);
10922 }
10923 } else {
10924 checkClose(event);
10925 }
10926 } else if (deltaTime > LONG_PRESS_START_TIME) {
10927 emit("longPress");
10928 }
10929 }
10930 };
10931 const onTouchEnd = (event) => {
10932 let stopPropagation2 = false;
10933 if (state.moving || state.zooming) {
10934 stopPropagation2 = true;
10935 if (state.moving && startMoveX === state.moveX && startMoveY === state.moveY) {
10936 stopPropagation2 = false;
10937 }
10938 if (!event.touches.length) {
10939 if (state.zooming) {
10940 state.moveX = clamp(state.moveX, -maxMoveX.value, maxMoveX.value);
10941 state.moveY = clamp(state.moveY, -maxMoveY.value, maxMoveY.value);
10942 state.zooming = false;
10943 }
10944 state.moving = false;
10945 startMoveX = 0;
10946 startMoveY = 0;
10947 startScale = 1;
10948 if (state.scale < 1) {
10949 resetScale();
10950 }
10951 const maxZoom = +props2.maxZoom;
10952 if (state.scale > maxZoom) {
10953 setScale(maxZoom, lastCenter);
10954 }
10955 }
10956 }
10957 preventDefault(event, stopPropagation2);
10958 checkTap(event);
10959 touch.reset();
10960 };
10961 const resize = () => {
10962 const {
10963 rootWidth,
10964 rootHeight
10965 } = props2;
10966 const rootRatio = rootHeight / rootWidth;
10967 const {
10968 imageRatio
10969 } = state;
10970 vertical.value = state.imageRatio > rootRatio && imageRatio < longImageRatio;
10971 isLongImage.value = state.imageRatio > rootRatio && imageRatio >= longImageRatio;
10972 if (isLongImage.value) {
10973 initialMoveY = (imageRatio * rootWidth - rootHeight) / 2;
10974 state.moveY = initialMoveY;
10975 state.initializing = true;
10976 raf(() => {
10977 state.initializing = false;
10978 });
10979 }
10980 resetScale();
10981 };
10982 const onLoad = (event) => {
10983 const {
10984 naturalWidth,
10985 naturalHeight
10986 } = event.target;
10987 state.imageRatio = naturalHeight / naturalWidth;
10988 resize();
10989 };
10990 watch(() => props2.active, resetScale);
10991 watch(() => props2.show, (value) => {
10992 if (!value) {
10993 resetScale();
10994 }
10995 });
10996 watch(() => [props2.rootWidth, props2.rootHeight], resize);
10997 useEventListener("touchmove", onTouchMove, {
10998 target: computed(() => {
10999 var _a;
11000 return (_a = swipeItem.value) == null ? void 0 : _a.$el;
11001 })
11002 });
11003 useExpose({
11004 resetScale
11005 });
11006 return () => {
11007 const imageSlots = {
11008 loading: () => createVNode(Loading, {
11009 "type": "spinner"
11010 }, null)
11011 };
11012 return createVNode(SwipeItem, {
11013 "ref": swipeItem,
11014 "class": bem$E("swipe-item"),
11015 "onTouchstartPassive": onTouchStart,
11016 "onTouchend": onTouchEnd,
11017 "onTouchcancel": onTouchEnd
11018 }, {
11019 default: () => [slots.image ? createVNode("div", {
11020 "class": bem$E("image-wrap")
11021 }, [slots.image({
11022 src: props2.src,
11023 onLoad,
11024 style: imageStyle.value
11025 })]) : createVNode(Image$1, {
11026 "ref": imageRef,
11027 "src": props2.src,
11028 "fit": "contain",
11029 "class": bem$E("image", {
11030 vertical: vertical.value
11031 }),
11032 "style": imageStyle.value,
11033 "onLoad": onLoad
11034 }, imageSlots)]
11035 });
11036 };
11037 }
11038});
11039const [name$E, bem$D] = createNamespace("image-preview");
11040const popupProps$1 = ["show", "teleport", "transition", "overlayStyle", "closeOnPopstate"];
11041const imagePreviewProps = {
11042 show: Boolean,
11043 loop: truthProp,
11044 images: makeArrayProp(),
11045 minZoom: makeNumericProp(1 / 3),
11046 maxZoom: makeNumericProp(3),
11047 overlay: truthProp,
11048 vertical: Boolean,
11049 closeable: Boolean,
11050 showIndex: truthProp,
11051 className: unknownProp,
11052 closeIcon: makeStringProp("clear"),
11053 transition: String,
11054 beforeClose: Function,
11055 doubleScale: truthProp,
11056 overlayClass: unknownProp,
11057 overlayStyle: Object,
11058 swipeDuration: makeNumericProp(300),
11059 startPosition: makeNumericProp(0),
11060 showIndicators: Boolean,
11061 closeOnPopstate: truthProp,
11062 closeOnClickImage: truthProp,
11063 closeOnClickOverlay: truthProp,
11064 closeIconPosition: makeStringProp("top-right"),
11065 teleport: [String, Object]
11066};
11067var stdin_default$M = defineComponent({
11068 name: name$E,
11069 props: imagePreviewProps,
11070 emits: ["scale", "close", "closed", "change", "longPress", "update:show"],
11071 setup(props2, {
11072 emit,
11073 slots
11074 }) {
11075 const swipeRef = ref();
11076 const activedPreviewItemRef = ref();
11077 const state = reactive({
11078 active: 0,
11079 rootWidth: 0,
11080 rootHeight: 0,
11081 disableZoom: false
11082 });
11083 const resize = () => {
11084 if (swipeRef.value) {
11085 const rect = useRect(swipeRef.value.$el);
11086 state.rootWidth = rect.width;
11087 state.rootHeight = rect.height;
11088 swipeRef.value.resize();
11089 }
11090 };
11091 const emitScale = (args) => emit("scale", args);
11092 const updateShow = (show) => emit("update:show", show);
11093 const emitClose = () => {
11094 callInterceptor(props2.beforeClose, {
11095 args: [state.active],
11096 done: () => updateShow(false)
11097 });
11098 };
11099 const setActive = (active) => {
11100 if (active !== state.active) {
11101 state.active = active;
11102 emit("change", active);
11103 }
11104 };
11105 const renderIndex = () => {
11106 if (props2.showIndex) {
11107 return createVNode("div", {
11108 "class": bem$D("index")
11109 }, [slots.index ? slots.index({
11110 index: state.active
11111 }) : `${state.active + 1} / ${props2.images.length}`]);
11112 }
11113 };
11114 const renderCover = () => {
11115 if (slots.cover) {
11116 return createVNode("div", {
11117 "class": bem$D("cover")
11118 }, [slots.cover()]);
11119 }
11120 };
11121 const onDragStart = () => {
11122 state.disableZoom = true;
11123 };
11124 const onDragEnd = () => {
11125 state.disableZoom = false;
11126 };
11127 const renderImages = () => createVNode(Swipe, {
11128 "ref": swipeRef,
11129 "lazyRender": true,
11130 "loop": props2.loop,
11131 "class": bem$D("swipe"),
11132 "vertical": props2.vertical,
11133 "duration": props2.swipeDuration,
11134 "initialSwipe": props2.startPosition,
11135 "showIndicators": props2.showIndicators,
11136 "indicatorColor": "white",
11137 "onChange": setActive,
11138 "onDragEnd": onDragEnd,
11139 "onDragStart": onDragStart
11140 }, {
11141 default: () => [props2.images.map((image, index) => createVNode(stdin_default$N, {
11142 "ref": (item) => {
11143 if (index === state.active) {
11144 activedPreviewItemRef.value = item;
11145 }
11146 },
11147 "src": image,
11148 "show": props2.show,
11149 "active": state.active,
11150 "maxZoom": props2.maxZoom,
11151 "minZoom": props2.minZoom,
11152 "rootWidth": state.rootWidth,
11153 "rootHeight": state.rootHeight,
11154 "disableZoom": state.disableZoom,
11155 "doubleScale": props2.doubleScale,
11156 "closeOnClickImage": props2.closeOnClickImage,
11157 "closeOnClickOverlay": props2.closeOnClickOverlay,
11158 "vertical": props2.vertical,
11159 "onScale": emitScale,
11160 "onClose": emitClose,
11161 "onLongPress": () => emit("longPress", {
11162 index
11163 })
11164 }, {
11165 image: slots.image
11166 }))]
11167 });
11168 const renderClose = () => {
11169 if (props2.closeable) {
11170 return createVNode(Icon, {
11171 "role": "button",
11172 "name": props2.closeIcon,
11173 "class": [bem$D("close-icon", props2.closeIconPosition), HAPTICS_FEEDBACK],
11174 "onClick": emitClose
11175 }, null);
11176 }
11177 };
11178 const onClosed = () => emit("closed");
11179 const swipeTo = (index, options) => {
11180 var _a;
11181 return (_a = swipeRef.value) == null ? void 0 : _a.swipeTo(index, options);
11182 };
11183 useExpose({
11184 resetScale: () => {
11185 var _a;
11186 (_a = activedPreviewItemRef.value) == null ? void 0 : _a.resetScale();
11187 },
11188 swipeTo
11189 });
11190 onMounted(resize);
11191 watch([windowWidth, windowHeight], resize);
11192 watch(() => props2.startPosition, (value) => setActive(+value));
11193 watch(() => props2.show, (value) => {
11194 const {
11195 images,
11196 startPosition
11197 } = props2;
11198 if (value) {
11199 setActive(+startPosition);
11200 nextTick(() => {
11201 resize();
11202 swipeTo(+startPosition, {
11203 immediate: true
11204 });
11205 });
11206 } else {
11207 emit("close", {
11208 index: state.active,
11209 url: images[state.active]
11210 });
11211 }
11212 });
11213 return () => createVNode(Popup, mergeProps({
11214 "class": [bem$D(), props2.className],
11215 "overlayClass": [bem$D("overlay"), props2.overlayClass],
11216 "onClosed": onClosed,
11217 "onUpdate:show": updateShow
11218 }, pick(props2, popupProps$1)), {
11219 default: () => [renderClose(), renderImages(), renderIndex(), renderCover()]
11220 });
11221 }
11222});
11223let instance$1;
11224const defaultConfig = {
11225 loop: true,
11226 images: [],
11227 maxZoom: 3,
11228 minZoom: 1 / 3,
11229 onScale: void 0,
11230 onClose: void 0,
11231 onChange: void 0,
11232 vertical: false,
11233 teleport: "body",
11234 className: "",
11235 showIndex: true,
11236 closeable: false,
11237 closeIcon: "clear",
11238 transition: void 0,
11239 beforeClose: void 0,
11240 doubleScale: true,
11241 overlayStyle: void 0,
11242 overlayClass: void 0,
11243 startPosition: 0,
11244 swipeDuration: 300,
11245 showIndicators: false,
11246 closeOnPopstate: true,
11247 closeOnClickOverlay: true,
11248 closeIconPosition: "top-right"
11249};
11250function initInstance$1() {
11251 ({
11252 instance: instance$1
11253 } = mountComponent({
11254 setup() {
11255 const {
11256 state,
11257 toggle
11258 } = usePopupState();
11259 const onClosed = () => {
11260 state.images = [];
11261 };
11262 return () => createVNode(stdin_default$M, mergeProps(state, {
11263 "onClosed": onClosed,
11264 "onUpdate:show": toggle
11265 }), null);
11266 }
11267 }));
11268}
11269const showImagePreview = (options, startPosition = 0) => {
11270 if (!inBrowser) {
11271 return;
11272 }
11273 if (!instance$1) {
11274 initInstance$1();
11275 }
11276 options = Array.isArray(options) ? {
11277 images: options,
11278 startPosition
11279 } : options;
11280 instance$1.open(extend({}, defaultConfig, options));
11281 return instance$1;
11282};
11283const ImagePreview = withInstall(stdin_default$M);
11284function genAlphabet() {
11285 const charCodeOfA = "A".charCodeAt(0);
11286 const indexList = Array(26).fill("").map((_, i) => String.fromCharCode(charCodeOfA + i));
11287 return indexList;
11288}
11289const [name$D, bem$C] = createNamespace("index-bar");
11290const indexBarProps = {
11291 sticky: truthProp,
11292 zIndex: numericProp,
11293 teleport: [String, Object],
11294 highlightColor: String,
11295 stickyOffsetTop: makeNumberProp(0),
11296 indexList: {
11297 type: Array,
11298 default: genAlphabet
11299 }
11300};
11301const INDEX_BAR_KEY = Symbol(name$D);
11302var stdin_default$L = defineComponent({
11303 name: name$D,
11304 props: indexBarProps,
11305 emits: ["select", "change"],
11306 setup(props2, {
11307 emit,
11308 slots
11309 }) {
11310 const root = ref();
11311 const sidebar = ref();
11312 const activeAnchor = ref("");
11313 const touch = useTouch();
11314 const scrollParent = useScrollParent(root);
11315 const {
11316 children,
11317 linkChildren
11318 } = useChildren(INDEX_BAR_KEY);
11319 let selectActiveIndex;
11320 linkChildren({
11321 props: props2
11322 });
11323 const sidebarStyle = computed(() => {
11324 if (isDef(props2.zIndex)) {
11325 return {
11326 zIndex: +props2.zIndex + 1
11327 };
11328 }
11329 });
11330 const highlightStyle = computed(() => {
11331 if (props2.highlightColor) {
11332 return {
11333 color: props2.highlightColor
11334 };
11335 }
11336 });
11337 const getActiveAnchor = (scrollTop, rects) => {
11338 for (let i = children.length - 1; i >= 0; i--) {
11339 const prevHeight = i > 0 ? rects[i - 1].height : 0;
11340 const reachTop = props2.sticky ? prevHeight + props2.stickyOffsetTop : 0;
11341 if (scrollTop + reachTop >= rects[i].top) {
11342 return i;
11343 }
11344 }
11345 return -1;
11346 };
11347 const getMatchAnchor = (index) => children.find((item) => String(item.index) === index);
11348 const onScroll = () => {
11349 if (isHidden(root)) {
11350 return;
11351 }
11352 const {
11353 sticky,
11354 indexList
11355 } = props2;
11356 const scrollTop = getScrollTop(scrollParent.value);
11357 const scrollParentRect = useRect(scrollParent);
11358 const rects = children.map((item) => item.getRect(scrollParent.value, scrollParentRect));
11359 let active = -1;
11360 if (selectActiveIndex) {
11361 const match = getMatchAnchor(selectActiveIndex);
11362 if (match) {
11363 const rect = match.getRect(scrollParent.value, scrollParentRect);
11364 if (props2.sticky && props2.stickyOffsetTop) {
11365 active = getActiveAnchor(rect.top - props2.stickyOffsetTop, rects);
11366 } else {
11367 active = getActiveAnchor(rect.top, rects);
11368 }
11369 }
11370 } else {
11371 active = getActiveAnchor(scrollTop, rects);
11372 }
11373 activeAnchor.value = indexList[active];
11374 if (sticky) {
11375 children.forEach((item, index) => {
11376 const {
11377 state,
11378 $el
11379 } = item;
11380 if (index === active || index === active - 1) {
11381 const rect = $el.getBoundingClientRect();
11382 state.left = rect.left;
11383 state.width = rect.width;
11384 } else {
11385 state.left = null;
11386 state.width = null;
11387 }
11388 if (index === active) {
11389 state.active = true;
11390 state.top = Math.max(props2.stickyOffsetTop, rects[index].top - scrollTop) + scrollParentRect.top;
11391 } else if (index === active - 1 && selectActiveIndex === "") {
11392 const activeItemTop = rects[active].top - scrollTop;
11393 state.active = activeItemTop > 0;
11394 state.top = activeItemTop + scrollParentRect.top - rects[index].height;
11395 } else {
11396 state.active = false;
11397 }
11398 });
11399 }
11400 selectActiveIndex = "";
11401 };
11402 const init = () => {
11403 nextTick(onScroll);
11404 };
11405 useEventListener("scroll", onScroll, {
11406 target: scrollParent,
11407 passive: true
11408 });
11409 onMounted(init);
11410 watch(() => props2.indexList, init);
11411 watch(activeAnchor, (value) => {
11412 if (value) {
11413 emit("change", value);
11414 }
11415 });
11416 const renderIndexes = () => props2.indexList.map((index) => {
11417 const active = index === activeAnchor.value;
11418 return createVNode("span", {
11419 "class": bem$C("index", {
11420 active
11421 }),
11422 "style": active ? highlightStyle.value : void 0,
11423 "data-index": index
11424 }, [index]);
11425 });
11426 const scrollTo = (index) => {
11427 selectActiveIndex = String(index);
11428 const match = getMatchAnchor(selectActiveIndex);
11429 if (match) {
11430 const scrollTop = getScrollTop(scrollParent.value);
11431 const scrollParentRect = useRect(scrollParent);
11432 const {
11433 offsetHeight
11434 } = document.documentElement;
11435 match.$el.scrollIntoView();
11436 if (scrollTop === offsetHeight - scrollParentRect.height) {
11437 onScroll();
11438 return;
11439 }
11440 if (props2.sticky && props2.stickyOffsetTop) {
11441 if (getRootScrollTop() === offsetHeight - scrollParentRect.height) {
11442 setRootScrollTop(getRootScrollTop());
11443 } else {
11444 setRootScrollTop(getRootScrollTop() - props2.stickyOffsetTop);
11445 }
11446 }
11447 emit("select", match.index);
11448 }
11449 };
11450 const scrollToElement = (element) => {
11451 const {
11452 index
11453 } = element.dataset;
11454 if (index) {
11455 scrollTo(index);
11456 }
11457 };
11458 const onClickSidebar = (event) => {
11459 scrollToElement(event.target);
11460 };
11461 let touchActiveIndex;
11462 const onTouchMove = (event) => {
11463 touch.move(event);
11464 if (touch.isVertical()) {
11465 preventDefault(event);
11466 const {
11467 clientX,
11468 clientY
11469 } = event.touches[0];
11470 const target = document.elementFromPoint(clientX, clientY);
11471 if (target) {
11472 const {
11473 index
11474 } = target.dataset;
11475 if (index && touchActiveIndex !== index) {
11476 touchActiveIndex = index;
11477 scrollToElement(target);
11478 }
11479 }
11480 }
11481 };
11482 const renderSidebar = () => createVNode("div", {
11483 "ref": sidebar,
11484 "class": bem$C("sidebar"),
11485 "style": sidebarStyle.value,
11486 "onClick": onClickSidebar,
11487 "onTouchstartPassive": touch.start
11488 }, [renderIndexes()]);
11489 useExpose({
11490 scrollTo
11491 });
11492 useEventListener("touchmove", onTouchMove, {
11493 target: sidebar
11494 });
11495 return () => {
11496 var _a;
11497 return createVNode("div", {
11498 "ref": root,
11499 "class": bem$C()
11500 }, [props2.teleport ? createVNode(Teleport, {
11501 "to": props2.teleport
11502 }, {
11503 default: () => [renderSidebar()]
11504 }) : renderSidebar(), (_a = slots.default) == null ? void 0 : _a.call(slots)]);
11505 };
11506 }
11507});
11508const [name$C, bem$B] = createNamespace("index-anchor");
11509const indexAnchorProps = {
11510 index: numericProp
11511};
11512var stdin_default$K = defineComponent({
11513 name: name$C,
11514 props: indexAnchorProps,
11515 setup(props2, {
11516 slots
11517 }) {
11518 const state = reactive({
11519 top: 0,
11520 left: null,
11521 rect: {
11522 top: 0,
11523 height: 0
11524 },
11525 width: null,
11526 active: false
11527 });
11528 const root = ref();
11529 const {
11530 parent
11531 } = useParent(INDEX_BAR_KEY);
11532 if (!parent) {
11533 if (process.env.NODE_ENV !== "production") {
11534 console.error("[Vant] <IndexAnchor> must be a child component of <IndexBar>.");
11535 }
11536 return;
11537 }
11538 const isSticky = () => state.active && parent.props.sticky;
11539 const anchorStyle = computed(() => {
11540 const {
11541 zIndex,
11542 highlightColor
11543 } = parent.props;
11544 if (isSticky()) {
11545 return extend(getZIndexStyle(zIndex), {
11546 left: state.left ? `${state.left}px` : void 0,
11547 width: state.width ? `${state.width}px` : void 0,
11548 transform: state.top ? `translate3d(0, ${state.top}px, 0)` : void 0,
11549 color: highlightColor
11550 });
11551 }
11552 });
11553 const getRect = (scrollParent, scrollParentRect) => {
11554 const rootRect = useRect(root);
11555 state.rect.height = rootRect.height;
11556 if (scrollParent === window || scrollParent === document.body) {
11557 state.rect.top = rootRect.top + getRootScrollTop();
11558 } else {
11559 state.rect.top = rootRect.top + getScrollTop(scrollParent) - scrollParentRect.top;
11560 }
11561 return state.rect;
11562 };
11563 useExpose({
11564 state,
11565 getRect
11566 });
11567 return () => {
11568 const sticky = isSticky();
11569 return createVNode("div", {
11570 "ref": root,
11571 "style": {
11572 height: sticky ? `${state.rect.height}px` : void 0
11573 }
11574 }, [createVNode("div", {
11575 "style": anchorStyle.value,
11576 "class": [bem$B({
11577 sticky
11578 }), {
11579 [BORDER_BOTTOM]: sticky
11580 }]
11581 }, [slots.default ? slots.default() : props2.index])]);
11582 };
11583 }
11584});
11585const IndexAnchor = withInstall(stdin_default$K);
11586const IndexBar = withInstall(stdin_default$L);
11587const [name$B, bem$A, t$7] = createNamespace("list");
11588const listProps = {
11589 error: Boolean,
11590 offset: makeNumericProp(300),
11591 loading: Boolean,
11592 disabled: Boolean,
11593 finished: Boolean,
11594 scroller: Object,
11595 errorText: String,
11596 direction: makeStringProp("down"),
11597 loadingText: String,
11598 finishedText: String,
11599 immediateCheck: truthProp
11600};
11601var stdin_default$J = defineComponent({
11602 name: name$B,
11603 props: listProps,
11604 emits: ["load", "update:error", "update:loading"],
11605 setup(props2, {
11606 emit,
11607 slots
11608 }) {
11609 const loading = ref(props2.loading);
11610 const root = ref();
11611 const placeholder = ref();
11612 const tabStatus = useTabStatus();
11613 const scrollParent = useScrollParent(root);
11614 const scroller = computed(() => props2.scroller || scrollParent.value);
11615 const check = () => {
11616 nextTick(() => {
11617 if (loading.value || props2.finished || props2.disabled || props2.error || // skip check when inside an inactive tab
11618 (tabStatus == null ? void 0 : tabStatus.value) === false) {
11619 return;
11620 }
11621 const {
11622 direction
11623 } = props2;
11624 const offset = +props2.offset;
11625 const scrollParentRect = useRect(scroller);
11626 if (!scrollParentRect.height || isHidden(root)) {
11627 return;
11628 }
11629 let isReachEdge = false;
11630 const placeholderRect = useRect(placeholder);
11631 if (direction === "up") {
11632 isReachEdge = scrollParentRect.top - placeholderRect.top <= offset;
11633 } else {
11634 isReachEdge = placeholderRect.bottom - scrollParentRect.bottom <= offset;
11635 }
11636 if (isReachEdge) {
11637 loading.value = true;
11638 emit("update:loading", true);
11639 emit("load");
11640 }
11641 });
11642 };
11643 const renderFinishedText = () => {
11644 if (props2.finished) {
11645 const text = slots.finished ? slots.finished() : props2.finishedText;
11646 if (text) {
11647 return createVNode("div", {
11648 "class": bem$A("finished-text")
11649 }, [text]);
11650 }
11651 }
11652 };
11653 const clickErrorText = () => {
11654 emit("update:error", false);
11655 check();
11656 };
11657 const renderErrorText = () => {
11658 if (props2.error) {
11659 const text = slots.error ? slots.error() : props2.errorText;
11660 if (text) {
11661 return createVNode("div", {
11662 "role": "button",
11663 "class": bem$A("error-text"),
11664 "tabindex": 0,
11665 "onClick": clickErrorText
11666 }, [text]);
11667 }
11668 }
11669 };
11670 const renderLoading = () => {
11671 if (loading.value && !props2.finished && !props2.disabled) {
11672 return createVNode("div", {
11673 "class": bem$A("loading")
11674 }, [slots.loading ? slots.loading() : createVNode(Loading, {
11675 "class": bem$A("loading-icon")
11676 }, {
11677 default: () => [props2.loadingText || t$7("loading")]
11678 })]);
11679 }
11680 };
11681 watch(() => [props2.loading, props2.finished, props2.error], check);
11682 if (tabStatus) {
11683 watch(tabStatus, (tabActive) => {
11684 if (tabActive) {
11685 check();
11686 }
11687 });
11688 }
11689 onUpdated(() => {
11690 loading.value = props2.loading;
11691 });
11692 onMounted(() => {
11693 if (props2.immediateCheck) {
11694 check();
11695 }
11696 });
11697 useExpose({
11698 check
11699 });
11700 useEventListener("scroll", check, {
11701 target: scroller,
11702 passive: true
11703 });
11704 return () => {
11705 var _a;
11706 const Content = (_a = slots.default) == null ? void 0 : _a.call(slots);
11707 const Placeholder = createVNode("div", {
11708 "ref": placeholder,
11709 "class": bem$A("placeholder")
11710 }, null);
11711 return createVNode("div", {
11712 "ref": root,
11713 "role": "feed",
11714 "class": bem$A(),
11715 "aria-busy": loading.value
11716 }, [props2.direction === "down" ? Content : Placeholder, renderLoading(), renderFinishedText(), renderErrorText(), props2.direction === "up" ? Content : Placeholder]);
11717 };
11718 }
11719});
11720const List = withInstall(stdin_default$J);
11721const [name$A, bem$z] = createNamespace("nav-bar");
11722const navBarProps = {
11723 title: String,
11724 fixed: Boolean,
11725 zIndex: numericProp,
11726 border: truthProp,
11727 leftText: String,
11728 rightText: String,
11729 leftDisabled: Boolean,
11730 rightDisabled: Boolean,
11731 leftArrow: Boolean,
11732 placeholder: Boolean,
11733 safeAreaInsetTop: Boolean,
11734 clickable: truthProp
11735};
11736var stdin_default$I = defineComponent({
11737 name: name$A,
11738 props: navBarProps,
11739 emits: ["clickLeft", "clickRight"],
11740 setup(props2, {
11741 emit,
11742 slots
11743 }) {
11744 const navBarRef = ref();
11745 const renderPlaceholder = usePlaceholder(navBarRef, bem$z);
11746 const onClickLeft = (event) => {
11747 if (!props2.leftDisabled) {
11748 emit("clickLeft", event);
11749 }
11750 };
11751 const onClickRight = (event) => {
11752 if (!props2.rightDisabled) {
11753 emit("clickRight", event);
11754 }
11755 };
11756 const renderLeft = () => {
11757 if (slots.left) {
11758 return slots.left();
11759 }
11760 return [props2.leftArrow && createVNode(Icon, {
11761 "class": bem$z("arrow"),
11762 "name": "arrow-left"
11763 }, null), props2.leftText && createVNode("span", {
11764 "class": bem$z("text")
11765 }, [props2.leftText])];
11766 };
11767 const renderRight = () => {
11768 if (slots.right) {
11769 return slots.right();
11770 }
11771 return createVNode("span", {
11772 "class": bem$z("text")
11773 }, [props2.rightText]);
11774 };
11775 const renderNavBar = () => {
11776 const {
11777 title,
11778 fixed,
11779 border,
11780 zIndex
11781 } = props2;
11782 const style = getZIndexStyle(zIndex);
11783 const hasLeft = props2.leftArrow || props2.leftText || slots.left;
11784 const hasRight = props2.rightText || slots.right;
11785 return createVNode("div", {
11786 "ref": navBarRef,
11787 "style": style,
11788 "class": [bem$z({
11789 fixed
11790 }), {
11791 [BORDER_BOTTOM]: border,
11792 "van-safe-area-top": props2.safeAreaInsetTop
11793 }]
11794 }, [createVNode("div", {
11795 "class": bem$z("content")
11796 }, [hasLeft && createVNode("div", {
11797 "class": [bem$z("left", {
11798 disabled: props2.leftDisabled
11799 }), props2.clickable && !props2.leftDisabled ? HAPTICS_FEEDBACK : ""],
11800 "onClick": onClickLeft
11801 }, [renderLeft()]), createVNode("div", {
11802 "class": [bem$z("title"), "van-ellipsis"]
11803 }, [slots.title ? slots.title() : title]), hasRight && createVNode("div", {
11804 "class": [bem$z("right", {
11805 disabled: props2.rightDisabled
11806 }), props2.clickable && !props2.rightDisabled ? HAPTICS_FEEDBACK : ""],
11807 "onClick": onClickRight
11808 }, [renderRight()])])]);
11809 };
11810 return () => {
11811 if (props2.fixed && props2.placeholder) {
11812 return renderPlaceholder(renderNavBar);
11813 }
11814 return renderNavBar();
11815 };
11816 }
11817});
11818const NavBar = withInstall(stdin_default$I);
11819const [name$z, bem$y] = createNamespace("notice-bar");
11820const noticeBarProps = {
11821 text: String,
11822 mode: String,
11823 color: String,
11824 delay: makeNumericProp(1),
11825 speed: makeNumericProp(60),
11826 leftIcon: String,
11827 wrapable: Boolean,
11828 background: String,
11829 scrollable: {
11830 type: Boolean,
11831 default: null
11832 }
11833};
11834var stdin_default$H = defineComponent({
11835 name: name$z,
11836 props: noticeBarProps,
11837 emits: ["close", "replay"],
11838 setup(props2, {
11839 emit,
11840 slots
11841 }) {
11842 let wrapWidth = 0;
11843 let contentWidth = 0;
11844 let startTimer;
11845 const wrapRef = ref();
11846 const contentRef = ref();
11847 const state = reactive({
11848 show: true,
11849 offset: 0,
11850 duration: 0
11851 });
11852 const renderLeftIcon = () => {
11853 if (slots["left-icon"]) {
11854 return slots["left-icon"]();
11855 }
11856 if (props2.leftIcon) {
11857 return createVNode(Icon, {
11858 "class": bem$y("left-icon"),
11859 "name": props2.leftIcon
11860 }, null);
11861 }
11862 };
11863 const getRightIconName = () => {
11864 if (props2.mode === "closeable") {
11865 return "cross";
11866 }
11867 if (props2.mode === "link") {
11868 return "arrow";
11869 }
11870 };
11871 const onClickRightIcon = (event) => {
11872 if (props2.mode === "closeable") {
11873 state.show = false;
11874 emit("close", event);
11875 }
11876 };
11877 const renderRightIcon = () => {
11878 if (slots["right-icon"]) {
11879 return slots["right-icon"]();
11880 }
11881 const name2 = getRightIconName();
11882 if (name2) {
11883 return createVNode(Icon, {
11884 "name": name2,
11885 "class": bem$y("right-icon"),
11886 "onClick": onClickRightIcon
11887 }, null);
11888 }
11889 };
11890 const onTransitionEnd = () => {
11891 state.offset = wrapWidth;
11892 state.duration = 0;
11893 raf(() => {
11894 doubleRaf(() => {
11895 state.offset = -contentWidth;
11896 state.duration = (contentWidth + wrapWidth) / +props2.speed;
11897 emit("replay");
11898 });
11899 });
11900 };
11901 const renderMarquee = () => {
11902 const ellipsis = props2.scrollable === false && !props2.wrapable;
11903 const style = {
11904 transform: state.offset ? `translateX(${state.offset}px)` : "",
11905 transitionDuration: `${state.duration}s`
11906 };
11907 return createVNode("div", {
11908 "ref": wrapRef,
11909 "role": "marquee",
11910 "class": bem$y("wrap")
11911 }, [createVNode("div", {
11912 "ref": contentRef,
11913 "style": style,
11914 "class": [bem$y("content"), {
11915 "van-ellipsis": ellipsis
11916 }],
11917 "onTransitionend": onTransitionEnd
11918 }, [slots.default ? slots.default() : props2.text])]);
11919 };
11920 const reset = () => {
11921 const {
11922 delay,
11923 speed,
11924 scrollable
11925 } = props2;
11926 const ms = isDef(delay) ? +delay * 1e3 : 0;
11927 wrapWidth = 0;
11928 contentWidth = 0;
11929 state.offset = 0;
11930 state.duration = 0;
11931 clearTimeout(startTimer);
11932 startTimer = setTimeout(() => {
11933 if (!wrapRef.value || !contentRef.value || scrollable === false) {
11934 return;
11935 }
11936 const wrapRefWidth = useRect(wrapRef).width;
11937 const contentRefWidth = useRect(contentRef).width;
11938 if (scrollable || contentRefWidth > wrapRefWidth) {
11939 doubleRaf(() => {
11940 wrapWidth = wrapRefWidth;
11941 contentWidth = contentRefWidth;
11942 state.offset = -contentWidth;
11943 state.duration = contentWidth / +speed;
11944 });
11945 }
11946 }, ms);
11947 };
11948 onPopupReopen(reset);
11949 onMountedOrActivated(reset);
11950 useEventListener("pageshow", reset);
11951 useExpose({
11952 reset
11953 });
11954 watch(() => [props2.text, props2.scrollable], reset);
11955 return () => {
11956 const {
11957 color,
11958 wrapable,
11959 background
11960 } = props2;
11961 return withDirectives(createVNode("div", {
11962 "role": "alert",
11963 "class": bem$y({
11964 wrapable
11965 }),
11966 "style": {
11967 color,
11968 background
11969 }
11970 }, [renderLeftIcon(), renderMarquee(), renderRightIcon()]), [[vShow, state.show]]);
11971 };
11972 }
11973});
11974const NoticeBar = withInstall(stdin_default$H);
11975const [name$y, bem$x] = createNamespace("notify");
11976const popupInheritProps = ["lockScroll", "position", "show", "teleport", "zIndex"];
11977const notifyProps = extend({}, popupSharedProps, {
11978 type: makeStringProp("danger"),
11979 color: String,
11980 message: numericProp,
11981 position: makeStringProp("top"),
11982 className: unknownProp,
11983 background: String,
11984 lockScroll: Boolean
11985});
11986var stdin_default$G = defineComponent({
11987 name: name$y,
11988 props: notifyProps,
11989 emits: ["update:show"],
11990 setup(props2, {
11991 emit,
11992 slots
11993 }) {
11994 const updateShow = (show) => emit("update:show", show);
11995 return () => createVNode(Popup, mergeProps({
11996 "class": [bem$x([props2.type]), props2.className],
11997 "style": {
11998 color: props2.color,
11999 background: props2.background
12000 },
12001 "overlay": false,
12002 "duration": 0.2,
12003 "onUpdate:show": updateShow
12004 }, pick(props2, popupInheritProps)), {
12005 default: () => [slots.default ? slots.default() : props2.message]
12006 });
12007 }
12008});
12009let timer;
12010let instance;
12011const parseOptions = (message) => isObject(message) ? message : {
12012 message
12013};
12014function initInstance() {
12015 ({
12016 instance
12017 } = mountComponent({
12018 setup() {
12019 const {
12020 state,
12021 toggle
12022 } = usePopupState();
12023 return () => createVNode(stdin_default$G, mergeProps(state, {
12024 "onUpdate:show": toggle
12025 }), null);
12026 }
12027 }));
12028}
12029const getDefaultOptions = () => ({
12030 type: "danger",
12031 color: void 0,
12032 message: "",
12033 onClose: void 0,
12034 onClick: void 0,
12035 onOpened: void 0,
12036 duration: 3e3,
12037 position: void 0,
12038 className: "",
12039 lockScroll: false,
12040 background: void 0
12041});
12042let currentOptions = getDefaultOptions();
12043const closeNotify = () => {
12044 if (instance) {
12045 instance.toggle(false);
12046 }
12047};
12048function showNotify(options) {
12049 if (!inBrowser) {
12050 return;
12051 }
12052 if (!instance) {
12053 initInstance();
12054 }
12055 options = extend({}, currentOptions, parseOptions(options));
12056 instance.open(options);
12057 clearTimeout(timer);
12058 if (options.duration > 0) {
12059 timer = setTimeout(closeNotify, options.duration);
12060 }
12061 return instance;
12062}
12063const setNotifyDefaultOptions = (options) => extend(currentOptions, options);
12064const resetNotifyDefaultOptions = () => {
12065 currentOptions = getDefaultOptions();
12066};
12067const Notify = withInstall(stdin_default$G);
12068const [name$x, bem$w] = createNamespace("key");
12069const CollapseIcon = createVNode("svg", {
12070 "class": bem$w("collapse-icon"),
12071 "viewBox": "0 0 30 24"
12072}, [createVNode("path", {
12073 "d": "M26 13h-2v2h2v-2zm-8-3h2V8h-2v2zm2-4h2V4h-2v2zm2 4h4V4h-2v4h-2v2zm-7 14 3-3h-6l3 3zM6 13H4v2h2v-2zm16 0H8v2h14v-2zm-12-3h2V8h-2v2zM28 0l1 1 1 1v15l-1 2H1l-1-2V2l1-1 1-1zm0 2H2v15h26V2zM6 4v2H4V4zm10 2h2V4h-2v2zM8 9v1H4V8zm8 0v1h-2V8zm-6-5v2H8V4zm4 0v2h-2V4z",
12074 "fill": "currentColor"
12075}, null)]);
12076const DeleteIcon = createVNode("svg", {
12077 "class": bem$w("delete-icon"),
12078 "viewBox": "0 0 32 22"
12079}, [createVNode("path", {
12080 "d": "M28 0a4 4 0 0 1 4 4v14a4 4 0 0 1-4 4H10.4a2 2 0 0 1-1.4-.6L1 13.1c-.6-.5-.9-1.3-.9-2 0-1 .3-1.7.9-2.2L9 .6a2 2 0 0 1 1.4-.6zm0 2H10.4l-8.2 8.3a1 1 0 0 0-.3.7c0 .3.1.5.3.7l8.2 8.4H28a2 2 0 0 0 2-2V4c0-1.1-.9-2-2-2zm-5 4a1 1 0 0 1 .7.3 1 1 0 0 1 0 1.4L20.4 11l3.3 3.3c.2.2.3.5.3.7 0 .3-.1.5-.3.7a1 1 0 0 1-.7.3 1 1 0 0 1-.7-.3L19 12.4l-3.4 3.3a1 1 0 0 1-.6.3 1 1 0 0 1-.7-.3 1 1 0 0 1-.3-.7c0-.2.1-.5.3-.7l3.3-3.3-3.3-3.3A1 1 0 0 1 14 7c0-.3.1-.5.3-.7A1 1 0 0 1 15 6a1 1 0 0 1 .6.3L19 9.6l3.3-3.3A1 1 0 0 1 23 6z",
12081 "fill": "currentColor"
12082}, null)]);
12083var stdin_default$F = defineComponent({
12084 name: name$x,
12085 props: {
12086 type: String,
12087 text: numericProp,
12088 color: String,
12089 wider: Boolean,
12090 large: Boolean,
12091 loading: Boolean
12092 },
12093 emits: ["press"],
12094 setup(props2, {
12095 emit,
12096 slots
12097 }) {
12098 const active = ref(false);
12099 const touch = useTouch();
12100 const onTouchStart = (event) => {
12101 touch.start(event);
12102 active.value = true;
12103 };
12104 const onTouchMove = (event) => {
12105 touch.move(event);
12106 if (touch.direction.value) {
12107 active.value = false;
12108 }
12109 };
12110 const onTouchEnd = (event) => {
12111 if (active.value) {
12112 if (!slots.default) {
12113 preventDefault(event);
12114 }
12115 active.value = false;
12116 emit("press", props2.text, props2.type);
12117 }
12118 };
12119 const renderContent = () => {
12120 if (props2.loading) {
12121 return createVNode(Loading, {
12122 "class": bem$w("loading-icon")
12123 }, null);
12124 }
12125 const text = slots.default ? slots.default() : props2.text;
12126 switch (props2.type) {
12127 case "delete":
12128 return text || DeleteIcon;
12129 case "extra":
12130 return text || CollapseIcon;
12131 default:
12132 return text;
12133 }
12134 };
12135 return () => createVNode("div", {
12136 "class": bem$w("wrapper", {
12137 wider: props2.wider
12138 }),
12139 "onTouchstartPassive": onTouchStart,
12140 "onTouchmovePassive": onTouchMove,
12141 "onTouchend": onTouchEnd,
12142 "onTouchcancel": onTouchEnd
12143 }, [createVNode("div", {
12144 "role": "button",
12145 "tabindex": 0,
12146 "class": bem$w([props2.color, {
12147 large: props2.large,
12148 active: active.value,
12149 delete: props2.type === "delete"
12150 }])
12151 }, [renderContent()])]);
12152 }
12153});
12154const [name$w, bem$v] = createNamespace("number-keyboard");
12155const numberKeyboardProps = {
12156 show: Boolean,
12157 title: String,
12158 theme: makeStringProp("default"),
12159 zIndex: numericProp,
12160 teleport: [String, Object],
12161 maxlength: makeNumericProp(Infinity),
12162 modelValue: makeStringProp(""),
12163 transition: truthProp,
12164 blurOnClose: truthProp,
12165 showDeleteKey: truthProp,
12166 randomKeyOrder: Boolean,
12167 closeButtonText: String,
12168 deleteButtonText: String,
12169 closeButtonLoading: Boolean,
12170 hideOnClickOutside: truthProp,
12171 safeAreaInsetBottom: truthProp,
12172 extraKey: {
12173 type: [String, Array],
12174 default: ""
12175 }
12176};
12177function shuffle(array) {
12178 for (let i = array.length - 1; i > 0; i--) {
12179 const j = Math.floor(Math.random() * (i + 1));
12180 const temp = array[i];
12181 array[i] = array[j];
12182 array[j] = temp;
12183 }
12184 return array;
12185}
12186var stdin_default$E = defineComponent({
12187 name: name$w,
12188 inheritAttrs: false,
12189 props: numberKeyboardProps,
12190 emits: ["show", "hide", "blur", "input", "close", "delete", "update:modelValue"],
12191 setup(props2, {
12192 emit,
12193 slots,
12194 attrs
12195 }) {
12196 const root = ref();
12197 const genBasicKeys = () => {
12198 const keys2 = Array(9).fill("").map((_, i) => ({
12199 text: i + 1
12200 }));
12201 if (props2.randomKeyOrder) {
12202 shuffle(keys2);
12203 }
12204 return keys2;
12205 };
12206 const genDefaultKeys = () => [...genBasicKeys(), {
12207 text: props2.extraKey,
12208 type: "extra"
12209 }, {
12210 text: 0
12211 }, {
12212 text: props2.showDeleteKey ? props2.deleteButtonText : "",
12213 type: props2.showDeleteKey ? "delete" : ""
12214 }];
12215 const genCustomKeys = () => {
12216 const keys2 = genBasicKeys();
12217 const {
12218 extraKey
12219 } = props2;
12220 const extraKeys = Array.isArray(extraKey) ? extraKey : [extraKey];
12221 if (extraKeys.length === 0) {
12222 keys2.push({
12223 text: 0,
12224 wider: true
12225 });
12226 } else if (extraKeys.length === 1) {
12227 keys2.push({
12228 text: 0,
12229 wider: true
12230 }, {
12231 text: extraKeys[0],
12232 type: "extra"
12233 });
12234 } else if (extraKeys.length === 2) {
12235 keys2.push({
12236 text: extraKeys[0],
12237 type: "extra"
12238 }, {
12239 text: 0
12240 }, {
12241 text: extraKeys[1],
12242 type: "extra"
12243 });
12244 }
12245 return keys2;
12246 };
12247 const keys = computed(() => props2.theme === "custom" ? genCustomKeys() : genDefaultKeys());
12248 const onBlur = () => {
12249 if (props2.show) {
12250 emit("blur");
12251 }
12252 };
12253 const onClose = () => {
12254 emit("close");
12255 if (props2.blurOnClose) {
12256 onBlur();
12257 }
12258 };
12259 const onAnimationEnd = () => emit(props2.show ? "show" : "hide");
12260 const onPress = (text, type) => {
12261 if (text === "") {
12262 if (type === "extra") {
12263 onBlur();
12264 }
12265 return;
12266 }
12267 const value = props2.modelValue;
12268 if (type === "delete") {
12269 emit("delete");
12270 emit("update:modelValue", value.slice(0, value.length - 1));
12271 } else if (type === "close") {
12272 onClose();
12273 } else if (value.length < +props2.maxlength) {
12274 emit("input", text);
12275 emit("update:modelValue", value + text);
12276 }
12277 };
12278 const renderTitle = () => {
12279 const {
12280 title,
12281 theme,
12282 closeButtonText
12283 } = props2;
12284 const leftSlot = slots["title-left"];
12285 const showClose = closeButtonText && theme === "default";
12286 const showTitle = title || showClose || leftSlot;
12287 if (!showTitle) {
12288 return;
12289 }
12290 return createVNode("div", {
12291 "class": bem$v("header")
12292 }, [leftSlot && createVNode("span", {
12293 "class": bem$v("title-left")
12294 }, [leftSlot()]), title && createVNode("h2", {
12295 "class": bem$v("title")
12296 }, [title]), showClose && createVNode("button", {
12297 "type": "button",
12298 "class": [bem$v("close"), HAPTICS_FEEDBACK],
12299 "onClick": onClose
12300 }, [closeButtonText])]);
12301 };
12302 const renderKeys = () => keys.value.map((key) => {
12303 const keySlots = {};
12304 if (key.type === "delete") {
12305 keySlots.default = slots.delete;
12306 }
12307 if (key.type === "extra") {
12308 keySlots.default = slots["extra-key"];
12309 }
12310 return createVNode(stdin_default$F, {
12311 "key": key.text,
12312 "text": key.text,
12313 "type": key.type,
12314 "wider": key.wider,
12315 "color": key.color,
12316 "onPress": onPress
12317 }, keySlots);
12318 });
12319 const renderSidebar = () => {
12320 if (props2.theme === "custom") {
12321 return createVNode("div", {
12322 "class": bem$v("sidebar")
12323 }, [props2.showDeleteKey && createVNode(stdin_default$F, {
12324 "large": true,
12325 "text": props2.deleteButtonText,
12326 "type": "delete",
12327 "onPress": onPress
12328 }, {
12329 default: slots.delete
12330 }), createVNode(stdin_default$F, {
12331 "large": true,
12332 "text": props2.closeButtonText,
12333 "type": "close",
12334 "color": "blue",
12335 "loading": props2.closeButtonLoading,
12336 "onPress": onPress
12337 }, null)]);
12338 }
12339 };
12340 watch(() => props2.show, (value) => {
12341 if (!props2.transition) {
12342 emit(value ? "show" : "hide");
12343 }
12344 });
12345 if (props2.hideOnClickOutside) {
12346 useClickAway(root, onBlur, {
12347 eventName: "touchstart"
12348 });
12349 }
12350 return () => {
12351 const Title = renderTitle();
12352 const Content = createVNode(Transition, {
12353 "name": props2.transition ? "van-slide-up" : ""
12354 }, {
12355 default: () => [withDirectives(createVNode("div", mergeProps({
12356 "ref": root,
12357 "style": getZIndexStyle(props2.zIndex),
12358 "class": bem$v({
12359 unfit: !props2.safeAreaInsetBottom,
12360 "with-title": !!Title
12361 }),
12362 "onAnimationend": onAnimationEnd,
12363 "onTouchstartPassive": stopPropagation
12364 }, attrs), [Title, createVNode("div", {
12365 "class": bem$v("body")
12366 }, [createVNode("div", {
12367 "class": bem$v("keys")
12368 }, [renderKeys()]), renderSidebar()])]), [[vShow, props2.show]])]
12369 });
12370 if (props2.teleport) {
12371 return createVNode(Teleport, {
12372 "to": props2.teleport
12373 }, {
12374 default: () => [Content]
12375 });
12376 }
12377 return Content;
12378 };
12379 }
12380});
12381const NumberKeyboard = withInstall(stdin_default$E);
12382const [name$v, bem$u, t$6] = createNamespace("pagination");
12383const makePage = (number, text, active) => ({
12384 number,
12385 text,
12386 active
12387});
12388const paginationProps = {
12389 mode: makeStringProp("multi"),
12390 prevText: String,
12391 nextText: String,
12392 pageCount: makeNumericProp(0),
12393 modelValue: makeNumberProp(0),
12394 totalItems: makeNumericProp(0),
12395 showPageSize: makeNumericProp(5),
12396 itemsPerPage: makeNumericProp(10),
12397 forceEllipses: Boolean,
12398 showPrevButton: truthProp,
12399 showNextButton: truthProp
12400};
12401var stdin_default$D = defineComponent({
12402 name: name$v,
12403 props: paginationProps,
12404 emits: ["change", "update:modelValue"],
12405 setup(props2, {
12406 emit,
12407 slots
12408 }) {
12409 const count = computed(() => {
12410 const {
12411 pageCount,
12412 totalItems,
12413 itemsPerPage
12414 } = props2;
12415 const count2 = +pageCount || Math.ceil(+totalItems / +itemsPerPage);
12416 return Math.max(1, count2);
12417 });
12418 const pages = computed(() => {
12419 const items = [];
12420 const pageCount = count.value;
12421 const showPageSize = +props2.showPageSize;
12422 const {
12423 modelValue,
12424 forceEllipses
12425 } = props2;
12426 let startPage = 1;
12427 let endPage = pageCount;
12428 const isMaxSized = showPageSize < pageCount;
12429 if (isMaxSized) {
12430 startPage = Math.max(modelValue - Math.floor(showPageSize / 2), 1);
12431 endPage = startPage + showPageSize - 1;
12432 if (endPage > pageCount) {
12433 endPage = pageCount;
12434 startPage = endPage - showPageSize + 1;
12435 }
12436 }
12437 for (let number = startPage; number <= endPage; number++) {
12438 const page = makePage(number, number, number === modelValue);
12439 items.push(page);
12440 }
12441 if (isMaxSized && showPageSize > 0 && forceEllipses) {
12442 if (startPage > 1) {
12443 const prevPages = makePage(startPage - 1, "...");
12444 items.unshift(prevPages);
12445 }
12446 if (endPage < pageCount) {
12447 const nextPages = makePage(endPage + 1, "...");
12448 items.push(nextPages);
12449 }
12450 }
12451 return items;
12452 });
12453 const updateModelValue = (value, emitChange) => {
12454 value = clamp(value, 1, count.value);
12455 if (props2.modelValue !== value) {
12456 emit("update:modelValue", value);
12457 if (emitChange) {
12458 emit("change", value);
12459 }
12460 }
12461 };
12462 watchEffect(() => updateModelValue(props2.modelValue));
12463 const renderDesc = () => createVNode("li", {
12464 "class": bem$u("page-desc")
12465 }, [slots.pageDesc ? slots.pageDesc() : `${props2.modelValue}/${count.value}`]);
12466 const renderPrevButton = () => {
12467 const {
12468 mode,
12469 modelValue,
12470 showPrevButton
12471 } = props2;
12472 if (!showPrevButton) {
12473 return;
12474 }
12475 const slot = slots["prev-text"];
12476 const disabled = modelValue === 1;
12477 return createVNode("li", {
12478 "class": [bem$u("item", {
12479 disabled,
12480 border: mode === "simple",
12481 prev: true
12482 }), BORDER_SURROUND]
12483 }, [createVNode("button", {
12484 "type": "button",
12485 "disabled": disabled,
12486 "onClick": () => updateModelValue(modelValue - 1, true)
12487 }, [slot ? slot() : props2.prevText || t$6("prev")])]);
12488 };
12489 const renderNextButton = () => {
12490 const {
12491 mode,
12492 modelValue,
12493 showNextButton
12494 } = props2;
12495 if (!showNextButton) {
12496 return;
12497 }
12498 const slot = slots["next-text"];
12499 const disabled = modelValue === count.value;
12500 return createVNode("li", {
12501 "class": [bem$u("item", {
12502 disabled,
12503 border: mode === "simple",
12504 next: true
12505 }), BORDER_SURROUND]
12506 }, [createVNode("button", {
12507 "type": "button",
12508 "disabled": disabled,
12509 "onClick": () => updateModelValue(modelValue + 1, true)
12510 }, [slot ? slot() : props2.nextText || t$6("next")])]);
12511 };
12512 const renderPages = () => pages.value.map((page) => createVNode("li", {
12513 "class": [bem$u("item", {
12514 active: page.active,
12515 page: true
12516 }), BORDER_SURROUND]
12517 }, [createVNode("button", {
12518 "type": "button",
12519 "aria-current": page.active || void 0,
12520 "onClick": () => updateModelValue(page.number, true)
12521 }, [slots.page ? slots.page(page) : page.text])]));
12522 return () => createVNode("nav", {
12523 "role": "navigation",
12524 "class": bem$u()
12525 }, [createVNode("ul", {
12526 "class": bem$u("items")
12527 }, [renderPrevButton(), props2.mode === "simple" ? renderDesc() : renderPages(), renderNextButton()])]);
12528 }
12529});
12530const Pagination = withInstall(stdin_default$D);
12531const [name$u, bem$t] = createNamespace("password-input");
12532const passwordInputProps = {
12533 info: String,
12534 mask: truthProp,
12535 value: makeStringProp(""),
12536 gutter: numericProp,
12537 length: makeNumericProp(6),
12538 focused: Boolean,
12539 errorInfo: String
12540};
12541var stdin_default$C = defineComponent({
12542 name: name$u,
12543 props: passwordInputProps,
12544 emits: ["focus"],
12545 setup(props2, {
12546 emit
12547 }) {
12548 const onTouchStart = (event) => {
12549 event.stopPropagation();
12550 emit("focus", event);
12551 };
12552 const renderPoints = () => {
12553 const Points = [];
12554 const {
12555 mask,
12556 value,
12557 gutter,
12558 focused
12559 } = props2;
12560 const length = +props2.length;
12561 for (let i = 0; i < length; i++) {
12562 const char = value[i];
12563 const showBorder = i !== 0 && !gutter;
12564 const showCursor = focused && i === value.length;
12565 let style;
12566 if (i !== 0 && gutter) {
12567 style = {
12568 marginLeft: addUnit(gutter)
12569 };
12570 }
12571 Points.push(createVNode("li", {
12572 "class": [{
12573 [BORDER_LEFT]: showBorder
12574 }, bem$t("item", {
12575 focus: showCursor
12576 })],
12577 "style": style
12578 }, [mask ? createVNode("i", {
12579 "style": {
12580 visibility: char ? "visible" : "hidden"
12581 }
12582 }, null) : char, showCursor && createVNode("div", {
12583 "class": bem$t("cursor")
12584 }, null)]));
12585 }
12586 return Points;
12587 };
12588 return () => {
12589 const info = props2.errorInfo || props2.info;
12590 return createVNode("div", {
12591 "class": bem$t()
12592 }, [createVNode("ul", {
12593 "class": [bem$t("security"), {
12594 [BORDER_SURROUND]: !props2.gutter
12595 }],
12596 "onTouchstartPassive": onTouchStart
12597 }, [renderPoints()]), info && createVNode("div", {
12598 "class": bem$t(props2.errorInfo ? "error-info" : "info")
12599 }, [info])]);
12600 };
12601 }
12602});
12603const PasswordInput = withInstall(stdin_default$C);
12604const PickerGroup = withInstall(stdin_default$1A);
12605const [name$t, bem$s] = createNamespace("popover");
12606const popupProps = ["overlay", "duration", "teleport", "overlayStyle", "overlayClass", "closeOnClickOverlay"];
12607const popoverProps = {
12608 show: Boolean,
12609 theme: makeStringProp("light"),
12610 overlay: Boolean,
12611 actions: makeArrayProp(),
12612 actionsDirection: makeStringProp("vertical"),
12613 trigger: makeStringProp("click"),
12614 duration: numericProp,
12615 showArrow: truthProp,
12616 placement: makeStringProp("bottom"),
12617 iconPrefix: String,
12618 overlayClass: unknownProp,
12619 overlayStyle: Object,
12620 closeOnClickAction: truthProp,
12621 closeOnClickOverlay: truthProp,
12622 closeOnClickOutside: truthProp,
12623 offset: {
12624 type: Array,
12625 default: () => [0, 8]
12626 },
12627 teleport: {
12628 type: [String, Object],
12629 default: "body"
12630 }
12631};
12632var stdin_default$B = defineComponent({
12633 name: name$t,
12634 props: popoverProps,
12635 emits: ["select", "touchstart", "update:show"],
12636 setup(props2, {
12637 emit,
12638 slots,
12639 attrs
12640 }) {
12641 let popper;
12642 const popupRef = ref();
12643 const wrapperRef = ref();
12644 const popoverRef = ref();
12645 const show = useSyncPropRef(() => props2.show, (value) => emit("update:show", value));
12646 const getPopoverOptions = () => ({
12647 placement: props2.placement,
12648 modifiers: [{
12649 name: "computeStyles",
12650 options: {
12651 adaptive: false,
12652 gpuAcceleration: false
12653 }
12654 }, extend({}, offsetModifier, {
12655 options: {
12656 offset: props2.offset
12657 }
12658 })]
12659 });
12660 const createPopperInstance = () => {
12661 if (wrapperRef.value && popoverRef.value) {
12662 return createPopper(wrapperRef.value, popoverRef.value.popupRef.value, getPopoverOptions());
12663 }
12664 return null;
12665 };
12666 const updateLocation = () => {
12667 nextTick(() => {
12668 if (!show.value) {
12669 return;
12670 }
12671 if (!popper) {
12672 popper = createPopperInstance();
12673 if (inBrowser) {
12674 window.addEventListener("animationend", updateLocation);
12675 window.addEventListener("transitionend", updateLocation);
12676 }
12677 } else {
12678 popper.setOptions(getPopoverOptions());
12679 }
12680 });
12681 };
12682 const updateShow = (value) => {
12683 show.value = value;
12684 };
12685 const onClickWrapper = () => {
12686 if (props2.trigger === "click") {
12687 show.value = !show.value;
12688 }
12689 };
12690 const onClickAction = (action, index) => {
12691 if (action.disabled) {
12692 return;
12693 }
12694 emit("select", action, index);
12695 if (props2.closeOnClickAction) {
12696 show.value = false;
12697 }
12698 };
12699 const onClickAway = () => {
12700 if (show.value && props2.closeOnClickOutside && (!props2.overlay || props2.closeOnClickOverlay)) {
12701 show.value = false;
12702 }
12703 };
12704 const renderActionContent = (action, index) => {
12705 if (slots.action) {
12706 return slots.action({
12707 action,
12708 index
12709 });
12710 }
12711 return [action.icon && createVNode(Icon, {
12712 "name": action.icon,
12713 "classPrefix": props2.iconPrefix,
12714 "class": bem$s("action-icon")
12715 }, null), createVNode("div", {
12716 "class": [bem$s("action-text"), {
12717 [BORDER_BOTTOM]: props2.actionsDirection === "vertical"
12718 }]
12719 }, [action.text])];
12720 };
12721 const renderAction = (action, index) => {
12722 const {
12723 icon,
12724 color,
12725 disabled,
12726 className
12727 } = action;
12728 return createVNode("div", {
12729 "role": "menuitem",
12730 "class": [bem$s("action", {
12731 disabled,
12732 "with-icon": icon
12733 }), {
12734 [BORDER_RIGHT]: props2.actionsDirection === "horizontal"
12735 }, className],
12736 "style": {
12737 color
12738 },
12739 "tabindex": disabled ? void 0 : 0,
12740 "aria-disabled": disabled || void 0,
12741 "onClick": () => onClickAction(action, index)
12742 }, [renderActionContent(action, index)]);
12743 };
12744 onMounted(() => {
12745 updateLocation();
12746 watchEffect(() => {
12747 var _a;
12748 popupRef.value = (_a = popoverRef.value) == null ? void 0 : _a.popupRef.value;
12749 });
12750 });
12751 onBeforeUnmount(() => {
12752 if (popper) {
12753 if (inBrowser) {
12754 window.removeEventListener("animationend", updateLocation);
12755 window.removeEventListener("transitionend", updateLocation);
12756 }
12757 popper.destroy();
12758 popper = null;
12759 }
12760 });
12761 watch(() => [show.value, props2.offset, props2.placement], updateLocation);
12762 useClickAway([wrapperRef, popupRef], onClickAway, {
12763 eventName: "touchstart"
12764 });
12765 return () => {
12766 var _a;
12767 return createVNode(Fragment, null, [createVNode("span", {
12768 "ref": wrapperRef,
12769 "class": bem$s("wrapper"),
12770 "onClick": onClickWrapper
12771 }, [(_a = slots.reference) == null ? void 0 : _a.call(slots)]), createVNode(Popup, mergeProps({
12772 "ref": popoverRef,
12773 "show": show.value,
12774 "class": bem$s([props2.theme]),
12775 "position": "",
12776 "transition": "van-popover-zoom",
12777 "lockScroll": false,
12778 "onUpdate:show": updateShow
12779 }, attrs, useScopeId(), pick(props2, popupProps)), {
12780 default: () => [props2.showArrow && createVNode("div", {
12781 "class": bem$s("arrow")
12782 }, null), createVNode("div", {
12783 "role": "menu",
12784 "class": bem$s("content", props2.actionsDirection)
12785 }, [slots.default ? slots.default() : props2.actions.map(renderAction)])]
12786 })]);
12787 };
12788 }
12789});
12790const Popover = withInstall(stdin_default$B);
12791const [name$s, bem$r] = createNamespace("progress");
12792const progressProps = {
12793 color: String,
12794 inactive: Boolean,
12795 pivotText: String,
12796 textColor: String,
12797 showPivot: truthProp,
12798 pivotColor: String,
12799 trackColor: String,
12800 strokeWidth: numericProp,
12801 percentage: {
12802 type: numericProp,
12803 default: 0,
12804 validator: (value) => +value >= 0 && +value <= 100
12805 }
12806};
12807var stdin_default$A = defineComponent({
12808 name: name$s,
12809 props: progressProps,
12810 setup(props2) {
12811 const background = computed(() => props2.inactive ? void 0 : props2.color);
12812 const renderPivot = () => {
12813 const {
12814 textColor,
12815 pivotText,
12816 pivotColor,
12817 percentage
12818 } = props2;
12819 const text = pivotText != null ? pivotText : `${percentage}%`;
12820 if (props2.showPivot && text) {
12821 const style = {
12822 color: textColor,
12823 left: `${+percentage}%`,
12824 transform: `translate(-${+percentage}%,-50%)`,
12825 background: pivotColor || background.value
12826 };
12827 return createVNode("span", {
12828 "style": style,
12829 "class": bem$r("pivot", {
12830 inactive: props2.inactive
12831 })
12832 }, [text]);
12833 }
12834 };
12835 return () => {
12836 const {
12837 trackColor,
12838 percentage,
12839 strokeWidth
12840 } = props2;
12841 const rootStyle = {
12842 background: trackColor,
12843 height: addUnit(strokeWidth)
12844 };
12845 const portionStyle = {
12846 width: `${percentage}%`,
12847 background: background.value
12848 };
12849 return createVNode("div", {
12850 "class": bem$r(),
12851 "style": rootStyle
12852 }, [createVNode("span", {
12853 "class": bem$r("portion", {
12854 inactive: props2.inactive
12855 }),
12856 "style": portionStyle
12857 }, null), renderPivot()]);
12858 };
12859 }
12860});
12861const Progress = withInstall(stdin_default$A);
12862const [name$r, bem$q, t$5] = createNamespace("pull-refresh");
12863const DEFAULT_HEAD_HEIGHT = 50;
12864const TEXT_STATUS = ["pulling", "loosing", "success"];
12865const pullRefreshProps = {
12866 disabled: Boolean,
12867 modelValue: Boolean,
12868 headHeight: makeNumericProp(DEFAULT_HEAD_HEIGHT),
12869 successText: String,
12870 pullingText: String,
12871 loosingText: String,
12872 loadingText: String,
12873 pullDistance: numericProp,
12874 successDuration: makeNumericProp(500),
12875 animationDuration: makeNumericProp(300)
12876};
12877var stdin_default$z = defineComponent({
12878 name: name$r,
12879 props: pullRefreshProps,
12880 emits: ["change", "refresh", "update:modelValue"],
12881 setup(props2, {
12882 emit,
12883 slots
12884 }) {
12885 let reachTop;
12886 const root = ref();
12887 const track = ref();
12888 const scrollParent = useScrollParent(root);
12889 const state = reactive({
12890 status: "normal",
12891 distance: 0,
12892 duration: 0
12893 });
12894 const touch = useTouch();
12895 const getHeadStyle = () => {
12896 if (props2.headHeight !== DEFAULT_HEAD_HEIGHT) {
12897 return {
12898 height: `${props2.headHeight}px`
12899 };
12900 }
12901 };
12902 const isTouchable = () => state.status !== "loading" && state.status !== "success" && !props2.disabled;
12903 const ease = (distance) => {
12904 const pullDistance = +(props2.pullDistance || props2.headHeight);
12905 if (distance > pullDistance) {
12906 if (distance < pullDistance * 2) {
12907 distance = pullDistance + (distance - pullDistance) / 2;
12908 } else {
12909 distance = pullDistance * 1.5 + (distance - pullDistance * 2) / 4;
12910 }
12911 }
12912 return Math.round(distance);
12913 };
12914 const setStatus = (distance, isLoading) => {
12915 const pullDistance = +(props2.pullDistance || props2.headHeight);
12916 state.distance = distance;
12917 if (isLoading) {
12918 state.status = "loading";
12919 } else if (distance === 0) {
12920 state.status = "normal";
12921 } else if (distance < pullDistance) {
12922 state.status = "pulling";
12923 } else {
12924 state.status = "loosing";
12925 }
12926 emit("change", {
12927 status: state.status,
12928 distance
12929 });
12930 };
12931 const getStatusText = () => {
12932 const {
12933 status
12934 } = state;
12935 if (status === "normal") {
12936 return "";
12937 }
12938 return props2[`${status}Text`] || t$5(status);
12939 };
12940 const renderStatus = () => {
12941 const {
12942 status,
12943 distance
12944 } = state;
12945 if (slots[status]) {
12946 return slots[status]({
12947 distance
12948 });
12949 }
12950 const nodes = [];
12951 if (TEXT_STATUS.includes(status)) {
12952 nodes.push(createVNode("div", {
12953 "class": bem$q("text")
12954 }, [getStatusText()]));
12955 }
12956 if (status === "loading") {
12957 nodes.push(createVNode(Loading, {
12958 "class": bem$q("loading")
12959 }, {
12960 default: getStatusText
12961 }));
12962 }
12963 return nodes;
12964 };
12965 const showSuccessTip = () => {
12966 state.status = "success";
12967 setTimeout(() => {
12968 setStatus(0);
12969 }, +props2.successDuration);
12970 };
12971 const checkPosition = (event) => {
12972 reachTop = getScrollTop(scrollParent.value) === 0;
12973 if (reachTop) {
12974 state.duration = 0;
12975 touch.start(event);
12976 }
12977 };
12978 const onTouchStart = (event) => {
12979 if (isTouchable()) {
12980 checkPosition(event);
12981 }
12982 };
12983 const onTouchMove = (event) => {
12984 if (isTouchable()) {
12985 if (!reachTop) {
12986 checkPosition(event);
12987 }
12988 const {
12989 deltaY
12990 } = touch;
12991 touch.move(event);
12992 if (reachTop && deltaY.value >= 0 && touch.isVertical()) {
12993 preventDefault(event);
12994 setStatus(ease(deltaY.value));
12995 }
12996 }
12997 };
12998 const onTouchEnd = () => {
12999 if (reachTop && touch.deltaY.value && isTouchable()) {
13000 state.duration = +props2.animationDuration;
13001 if (state.status === "loosing") {
13002 setStatus(+props2.headHeight, true);
13003 emit("update:modelValue", true);
13004 nextTick(() => emit("refresh"));
13005 } else {
13006 setStatus(0);
13007 }
13008 }
13009 };
13010 watch(() => props2.modelValue, (value) => {
13011 state.duration = +props2.animationDuration;
13012 if (value) {
13013 setStatus(+props2.headHeight, true);
13014 } else if (slots.success || props2.successText) {
13015 showSuccessTip();
13016 } else {
13017 setStatus(0, false);
13018 }
13019 });
13020 useEventListener("touchmove", onTouchMove, {
13021 target: track
13022 });
13023 return () => {
13024 var _a;
13025 const trackStyle = {
13026 transitionDuration: `${state.duration}ms`,
13027 transform: state.distance ? `translate3d(0,${state.distance}px, 0)` : ""
13028 };
13029 return createVNode("div", {
13030 "ref": root,
13031 "class": bem$q()
13032 }, [createVNode("div", {
13033 "ref": track,
13034 "class": bem$q("track"),
13035 "style": trackStyle,
13036 "onTouchstartPassive": onTouchStart,
13037 "onTouchend": onTouchEnd,
13038 "onTouchcancel": onTouchEnd
13039 }, [createVNode("div", {
13040 "class": bem$q("head"),
13041 "style": getHeadStyle()
13042 }, [renderStatus()]), (_a = slots.default) == null ? void 0 : _a.call(slots)])]);
13043 };
13044 }
13045});
13046const PullRefresh = withInstall(stdin_default$z);
13047const [name$q, bem$p] = createNamespace("rate");
13048function getRateStatus(value, index, allowHalf, readonly) {
13049 if (value >= index) {
13050 return {
13051 status: "full",
13052 value: 1
13053 };
13054 }
13055 if (value + 0.5 >= index && allowHalf && !readonly) {
13056 return {
13057 status: "half",
13058 value: 0.5
13059 };
13060 }
13061 if (value + 1 >= index && allowHalf && readonly) {
13062 const cardinal = 10 ** 10;
13063 return {
13064 status: "half",
13065 value: Math.round((value - index + 1) * cardinal) / cardinal
13066 };
13067 }
13068 return {
13069 status: "void",
13070 value: 0
13071 };
13072}
13073const rateProps = {
13074 size: numericProp,
13075 icon: makeStringProp("star"),
13076 color: String,
13077 count: makeNumericProp(5),
13078 gutter: numericProp,
13079 clearable: Boolean,
13080 readonly: Boolean,
13081 disabled: Boolean,
13082 voidIcon: makeStringProp("star-o"),
13083 allowHalf: Boolean,
13084 voidColor: String,
13085 touchable: truthProp,
13086 iconPrefix: String,
13087 modelValue: makeNumberProp(0),
13088 disabledColor: String
13089};
13090var stdin_default$y = defineComponent({
13091 name: name$q,
13092 props: rateProps,
13093 emits: ["change", "update:modelValue"],
13094 setup(props2, {
13095 emit
13096 }) {
13097 const touch = useTouch();
13098 const [itemRefs, setItemRefs] = useRefs();
13099 const groupRef = ref();
13100 const unselectable = computed(() => props2.readonly || props2.disabled);
13101 const untouchable = computed(() => unselectable.value || !props2.touchable);
13102 const list = computed(() => Array(+props2.count).fill("").map((_, i) => getRateStatus(props2.modelValue, i + 1, props2.allowHalf, props2.readonly)));
13103 let ranges;
13104 let groupRefRect;
13105 let minRectTop = Number.MAX_SAFE_INTEGER;
13106 let maxRectTop = Number.MIN_SAFE_INTEGER;
13107 const updateRanges = () => {
13108 groupRefRect = useRect(groupRef);
13109 const rects = itemRefs.value.map(useRect);
13110 ranges = [];
13111 rects.forEach((rect, index) => {
13112 minRectTop = Math.min(rect.top, minRectTop);
13113 maxRectTop = Math.max(rect.top, maxRectTop);
13114 if (props2.allowHalf) {
13115 ranges.push({
13116 score: index + 0.5,
13117 left: rect.left,
13118 top: rect.top,
13119 height: rect.height
13120 }, {
13121 score: index + 1,
13122 left: rect.left + rect.width / 2,
13123 top: rect.top,
13124 height: rect.height
13125 });
13126 } else {
13127 ranges.push({
13128 score: index + 1,
13129 left: rect.left,
13130 top: rect.top,
13131 height: rect.height
13132 });
13133 }
13134 });
13135 };
13136 const getScoreByPosition = (x, y) => {
13137 for (let i = ranges.length - 1; i > 0; i--) {
13138 if (y >= groupRefRect.top && y <= groupRefRect.bottom) {
13139 if (x > ranges[i].left && y >= ranges[i].top && y <= ranges[i].top + ranges[i].height) {
13140 return ranges[i].score;
13141 }
13142 } else {
13143 const curTop = y < groupRefRect.top ? minRectTop : maxRectTop;
13144 if (x > ranges[i].left && ranges[i].top === curTop) {
13145 return ranges[i].score;
13146 }
13147 }
13148 }
13149 return props2.allowHalf ? 0.5 : 1;
13150 };
13151 const select = (value) => {
13152 if (unselectable.value || value === props2.modelValue) return;
13153 emit("update:modelValue", value);
13154 emit("change", value);
13155 };
13156 const onTouchStart = (event) => {
13157 if (untouchable.value) {
13158 return;
13159 }
13160 touch.start(event);
13161 updateRanges();
13162 };
13163 const onTouchMove = (event) => {
13164 if (untouchable.value) {
13165 return;
13166 }
13167 touch.move(event);
13168 if (touch.isHorizontal() && !touch.isTap.value) {
13169 const {
13170 clientX,
13171 clientY
13172 } = event.touches[0];
13173 preventDefault(event);
13174 select(getScoreByPosition(clientX, clientY));
13175 }
13176 };
13177 const renderStar = (item, index) => {
13178 const {
13179 icon,
13180 size,
13181 color,
13182 count,
13183 gutter,
13184 voidIcon,
13185 disabled,
13186 voidColor,
13187 allowHalf,
13188 iconPrefix,
13189 disabledColor
13190 } = props2;
13191 const score = index + 1;
13192 const isFull = item.status === "full";
13193 const isVoid = item.status === "void";
13194 const renderHalf = allowHalf && item.value > 0 && item.value < 1;
13195 let style;
13196 if (gutter && score !== +count) {
13197 style = {
13198 paddingRight: addUnit(gutter)
13199 };
13200 }
13201 const onClickItem = (event) => {
13202 updateRanges();
13203 let value = allowHalf ? getScoreByPosition(event.clientX, event.clientY) : score;
13204 if (props2.clearable && touch.isTap.value && value === props2.modelValue) {
13205 value = 0;
13206 }
13207 select(value);
13208 };
13209 return createVNode("div", {
13210 "key": index,
13211 "ref": setItemRefs(index),
13212 "role": "radio",
13213 "style": style,
13214 "class": bem$p("item"),
13215 "tabindex": disabled ? void 0 : 0,
13216 "aria-setsize": count,
13217 "aria-posinset": score,
13218 "aria-checked": !isVoid,
13219 "onClick": onClickItem
13220 }, [createVNode(Icon, {
13221 "size": size,
13222 "name": isFull ? icon : voidIcon,
13223 "class": bem$p("icon", {
13224 disabled,
13225 full: isFull
13226 }),
13227 "color": disabled ? disabledColor : isFull ? color : voidColor,
13228 "classPrefix": iconPrefix
13229 }, null), renderHalf && createVNode(Icon, {
13230 "size": size,
13231 "style": {
13232 width: item.value + "em"
13233 },
13234 "name": isVoid ? voidIcon : icon,
13235 "class": bem$p("icon", ["half", {
13236 disabled,
13237 full: !isVoid
13238 }]),
13239 "color": disabled ? disabledColor : isVoid ? voidColor : color,
13240 "classPrefix": iconPrefix
13241 }, null)]);
13242 };
13243 useCustomFieldValue(() => props2.modelValue);
13244 useEventListener("touchmove", onTouchMove, {
13245 target: groupRef
13246 });
13247 return () => createVNode("div", {
13248 "ref": groupRef,
13249 "role": "radiogroup",
13250 "class": bem$p({
13251 readonly: props2.readonly,
13252 disabled: props2.disabled
13253 }),
13254 "tabindex": props2.disabled ? void 0 : 0,
13255 "aria-disabled": props2.disabled,
13256 "aria-readonly": props2.readonly,
13257 "onTouchstartPassive": onTouchStart
13258 }, [list.value.map(renderStar)]);
13259 }
13260});
13261const Rate = withInstall(stdin_default$y);
13262const props = {
13263 figureArr: makeArrayProp(),
13264 delay: Number,
13265 duration: makeNumberProp(2),
13266 isStart: Boolean,
13267 direction: makeStringProp("down"),
13268 height: makeNumberProp(40)
13269};
13270const [name$p, bem$o] = createNamespace("rolling-text-item");
13271var stdin_default$x = defineComponent({
13272 name: name$p,
13273 props,
13274 setup(props2) {
13275 const newFigureArr = computed(() => props2.direction === "down" ? props2.figureArr.slice().reverse() : props2.figureArr);
13276 const translatePx = computed(() => {
13277 const totalHeight = props2.height * (props2.figureArr.length - 1);
13278 return `-${totalHeight}px`;
13279 });
13280 const itemStyle = computed(() => ({
13281 lineHeight: addUnit(props2.height)
13282 }));
13283 const rootStyle = computed(() => ({
13284 height: addUnit(props2.height),
13285 "--van-translate": translatePx.value,
13286 "--van-duration": props2.duration + "s",
13287 "--van-delay": props2.delay + "s"
13288 }));
13289 return () => createVNode("div", {
13290 "class": bem$o([props2.direction]),
13291 "style": rootStyle.value
13292 }, [createVNode("div", {
13293 "class": bem$o("box", {
13294 animate: props2.isStart
13295 })
13296 }, [Array.isArray(newFigureArr.value) && newFigureArr.value.map((figure) => createVNode("div", {
13297 "class": bem$o("item"),
13298 "style": itemStyle.value
13299 }, [figure]))])]);
13300 }
13301});
13302const [name$o, bem$n] = createNamespace("rolling-text");
13303const rollingTextProps = {
13304 startNum: makeNumberProp(0),
13305 targetNum: Number,
13306 textList: makeArrayProp(),
13307 duration: makeNumberProp(2),
13308 autoStart: truthProp,
13309 direction: makeStringProp("down"),
13310 stopOrder: makeStringProp("ltr"),
13311 height: makeNumberProp(40)
13312};
13313const CIRCLE_NUM = 2;
13314var stdin_default$w = defineComponent({
13315 name: name$o,
13316 props: rollingTextProps,
13317 setup(props2) {
13318 const isCustomType = computed(() => Array.isArray(props2.textList) && props2.textList.length);
13319 const itemLength = computed(() => {
13320 if (isCustomType.value) return props2.textList[0].length;
13321 return `${Math.max(props2.startNum, props2.targetNum)}`.length;
13322 });
13323 const getTextArrByIdx = (idx) => {
13324 const result = [];
13325 for (let i = 0; i < props2.textList.length; i++) {
13326 result.push(props2.textList[i][idx]);
13327 }
13328 return result;
13329 };
13330 const targetNumArr = computed(() => {
13331 if (isCustomType.value) return new Array(itemLength.value).fill("");
13332 return padZero(props2.targetNum, itemLength.value).split("");
13333 });
13334 const startNumArr = computed(() => padZero(props2.startNum, itemLength.value).split(""));
13335 const getFigureArr = (i) => {
13336 const start2 = +startNumArr.value[i];
13337 const target = +targetNumArr.value[i];
13338 const result = [];
13339 for (let i2 = start2; i2 <= 9; i2++) {
13340 result.push(i2);
13341 }
13342 for (let i2 = 0; i2 <= CIRCLE_NUM; i2++) {
13343 for (let j = 0; j <= 9; j++) {
13344 result.push(j);
13345 }
13346 }
13347 for (let i2 = 0; i2 <= target; i2++) {
13348 result.push(i2);
13349 }
13350 return result;
13351 };
13352 const getDelay = (i, len) => {
13353 if (props2.stopOrder === "ltr") return 0.2 * i;
13354 return 0.2 * (len - 1 - i);
13355 };
13356 const rolling = ref(props2.autoStart);
13357 const start = () => {
13358 rolling.value = true;
13359 };
13360 const reset = () => {
13361 rolling.value = false;
13362 if (props2.autoStart) {
13363 raf(() => start());
13364 }
13365 };
13366 watch(() => props2.autoStart, (value) => {
13367 if (value) {
13368 start();
13369 }
13370 });
13371 useExpose({
13372 start,
13373 reset
13374 });
13375 return () => createVNode("div", {
13376 "class": bem$n()
13377 }, [targetNumArr.value.map((_, i) => createVNode(stdin_default$x, {
13378 "figureArr": isCustomType.value ? getTextArrByIdx(i) : getFigureArr(i),
13379 "duration": props2.duration,
13380 "direction": props2.direction,
13381 "isStart": rolling.value,
13382 "height": props2.height,
13383 "delay": getDelay(i, itemLength.value)
13384 }, null))]);
13385 }
13386});
13387const RollingText = withInstall(stdin_default$w);
13388const Row = withInstall(stdin_default$17);
13389const [name$n, bem$m, t$4] = createNamespace("search");
13390const searchProps = extend({}, fieldSharedProps, {
13391 label: String,
13392 shape: makeStringProp("square"),
13393 leftIcon: makeStringProp("search"),
13394 clearable: truthProp,
13395 actionText: String,
13396 background: String,
13397 showAction: Boolean
13398});
13399var stdin_default$v = defineComponent({
13400 name: name$n,
13401 props: searchProps,
13402 emits: ["blur", "focus", "clear", "search", "cancel", "clickInput", "clickLeftIcon", "clickRightIcon", "update:modelValue"],
13403 setup(props2, {
13404 emit,
13405 slots,
13406 attrs
13407 }) {
13408 const id = useId();
13409 const fieldRef = ref();
13410 const onCancel = () => {
13411 if (!slots.action) {
13412 emit("update:modelValue", "");
13413 emit("cancel");
13414 }
13415 };
13416 const onKeypress = (event) => {
13417 const ENTER_CODE = 13;
13418 if (event.keyCode === ENTER_CODE) {
13419 preventDefault(event);
13420 emit("search", props2.modelValue);
13421 }
13422 };
13423 const getInputId = () => props2.id || `${id}-input`;
13424 const renderLabel = () => {
13425 if (slots.label || props2.label) {
13426 return createVNode("label", {
13427 "class": bem$m("label"),
13428 "for": getInputId(),
13429 "data-allow-mismatch": "attribute"
13430 }, [slots.label ? slots.label() : props2.label]);
13431 }
13432 };
13433 const renderAction = () => {
13434 if (props2.showAction) {
13435 const text = props2.actionText || t$4("cancel");
13436 return createVNode("div", {
13437 "class": bem$m("action"),
13438 "role": "button",
13439 "tabindex": 0,
13440 "onClick": onCancel
13441 }, [slots.action ? slots.action() : text]);
13442 }
13443 };
13444 const blur = () => {
13445 var _a;
13446 return (_a = fieldRef.value) == null ? void 0 : _a.blur();
13447 };
13448 const focus = () => {
13449 var _a;
13450 return (_a = fieldRef.value) == null ? void 0 : _a.focus();
13451 };
13452 const onBlur = (event) => emit("blur", event);
13453 const onFocus = (event) => emit("focus", event);
13454 const onClear = (event) => emit("clear", event);
13455 const onClickInput = (event) => emit("clickInput", event);
13456 const onClickLeftIcon = (event) => emit("clickLeftIcon", event);
13457 const onClickRightIcon = (event) => emit("clickRightIcon", event);
13458 const fieldPropNames = Object.keys(fieldSharedProps);
13459 const renderField = () => {
13460 const fieldAttrs = extend({}, attrs, pick(props2, fieldPropNames), {
13461 id: getInputId()
13462 });
13463 const onInput = (value) => emit("update:modelValue", value);
13464 return createVNode(Field, mergeProps({
13465 "ref": fieldRef,
13466 "type": "search",
13467 "class": bem$m("field", {
13468 "with-message": fieldAttrs.errorMessage
13469 }),
13470 "border": false,
13471 "onBlur": onBlur,
13472 "onFocus": onFocus,
13473 "onClear": onClear,
13474 "onKeypress": onKeypress,
13475 "onClickInput": onClickInput,
13476 "onClickLeftIcon": onClickLeftIcon,
13477 "onClickRightIcon": onClickRightIcon,
13478 "onUpdate:modelValue": onInput
13479 }, fieldAttrs), pick(slots, ["left-icon", "right-icon"]));
13480 };
13481 useExpose({
13482 focus,
13483 blur
13484 });
13485 return () => {
13486 var _a;
13487 return createVNode("div", {
13488 "class": bem$m({
13489 "show-action": props2.showAction
13490 }),
13491 "style": {
13492 background: props2.background
13493 }
13494 }, [(_a = slots.left) == null ? void 0 : _a.call(slots), createVNode("div", {
13495 "class": bem$m("content", props2.shape)
13496 }, [renderLabel(), renderField()]), renderAction()]);
13497 };
13498 }
13499});
13500const Search = withInstall(stdin_default$v);
13501const isImage = (name2) => name2 == null ? void 0 : name2.includes("/");
13502const popupInheritKeys = [...popupSharedPropKeys, "round", "closeOnPopstate", "safeAreaInsetBottom"];
13503const iconMap = {
13504 qq: "qq",
13505 link: "link-o",
13506 weibo: "weibo",
13507 qrcode: "qr",
13508 poster: "photo-o",
13509 wechat: "wechat",
13510 "weapp-qrcode": "miniprogram-o",
13511 "wechat-moments": "wechat-moments"
13512};
13513const [name$m, bem$l, t$3] = createNamespace("share-sheet");
13514const shareSheetProps = extend({}, popupSharedProps, {
13515 title: String,
13516 round: truthProp,
13517 options: makeArrayProp(),
13518 cancelText: String,
13519 description: String,
13520 closeOnPopstate: truthProp,
13521 safeAreaInsetBottom: truthProp
13522});
13523var stdin_default$u = defineComponent({
13524 name: name$m,
13525 props: shareSheetProps,
13526 emits: ["cancel", "select", "update:show"],
13527 setup(props2, {
13528 emit,
13529 slots
13530 }) {
13531 const updateShow = (value) => emit("update:show", value);
13532 const onCancel = () => {
13533 updateShow(false);
13534 emit("cancel");
13535 };
13536 const onSelect = (option, index) => emit("select", option, index);
13537 const renderHeader = () => {
13538 const title = slots.title ? slots.title() : props2.title;
13539 const description = slots.description ? slots.description() : props2.description;
13540 if (title || description) {
13541 return createVNode("div", {
13542 "class": bem$l("header")
13543 }, [title && createVNode("h2", {
13544 "class": bem$l("title")
13545 }, [title]), description && createVNode("span", {
13546 "class": bem$l("description")
13547 }, [description])]);
13548 }
13549 };
13550 const renderIcon = (icon) => {
13551 if (isImage(icon)) {
13552 return createVNode("img", {
13553 "src": icon,
13554 "class": bem$l("image-icon")
13555 }, null);
13556 }
13557 return createVNode("div", {
13558 "class": bem$l("icon", [icon])
13559 }, [createVNode(Icon, {
13560 "name": iconMap[icon] || icon
13561 }, null)]);
13562 };
13563 const renderOption = (option, index) => {
13564 const {
13565 name: name2,
13566 icon,
13567 className,
13568 description
13569 } = option;
13570 return createVNode("div", {
13571 "role": "button",
13572 "tabindex": 0,
13573 "class": [bem$l("option"), className, HAPTICS_FEEDBACK],
13574 "onClick": () => onSelect(option, index)
13575 }, [renderIcon(icon), name2 && createVNode("span", {
13576 "class": bem$l("name")
13577 }, [name2]), description && createVNode("span", {
13578 "class": bem$l("option-description")
13579 }, [description])]);
13580 };
13581 const renderOptions = (options, border) => createVNode("div", {
13582 "class": bem$l("options", {
13583 border
13584 })
13585 }, [options.map(renderOption)]);
13586 const renderRows = () => {
13587 const {
13588 options
13589 } = props2;
13590 if (Array.isArray(options[0])) {
13591 return options.map((item, index) => renderOptions(item, index !== 0));
13592 }
13593 return renderOptions(options);
13594 };
13595 const renderCancelButton = () => {
13596 var _a;
13597 const cancelText = (_a = props2.cancelText) != null ? _a : t$3("cancel");
13598 if (slots.cancel || cancelText) {
13599 return createVNode("button", {
13600 "type": "button",
13601 "class": bem$l("cancel"),
13602 "onClick": onCancel
13603 }, [slots.cancel ? slots.cancel() : cancelText]);
13604 }
13605 };
13606 return () => createVNode(Popup, mergeProps({
13607 "class": bem$l(),
13608 "position": "bottom",
13609 "onUpdate:show": updateShow
13610 }, pick(props2, popupInheritKeys)), {
13611 default: () => [renderHeader(), renderRows(), renderCancelButton()]
13612 });
13613 }
13614});
13615const ShareSheet = withInstall(stdin_default$u);
13616const [name$l, bem$k] = createNamespace("sidebar");
13617const SIDEBAR_KEY = Symbol(name$l);
13618const sidebarProps = {
13619 modelValue: makeNumericProp(0)
13620};
13621var stdin_default$t = defineComponent({
13622 name: name$l,
13623 props: sidebarProps,
13624 emits: ["change", "update:modelValue"],
13625 setup(props2, {
13626 emit,
13627 slots
13628 }) {
13629 const {
13630 linkChildren
13631 } = useChildren(SIDEBAR_KEY);
13632 const getActive = () => +props2.modelValue;
13633 const setActive = (value) => {
13634 if (value !== getActive()) {
13635 emit("update:modelValue", value);
13636 emit("change", value);
13637 }
13638 };
13639 linkChildren({
13640 getActive,
13641 setActive
13642 });
13643 return () => {
13644 var _a;
13645 return createVNode("div", {
13646 "role": "tablist",
13647 "class": bem$k()
13648 }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
13649 };
13650 }
13651});
13652const Sidebar = withInstall(stdin_default$t);
13653const [name$k, bem$j] = createNamespace("sidebar-item");
13654const sidebarItemProps = extend({}, routeProps, {
13655 dot: Boolean,
13656 title: String,
13657 badge: numericProp,
13658 disabled: Boolean,
13659 badgeProps: Object
13660});
13661var stdin_default$s = defineComponent({
13662 name: name$k,
13663 props: sidebarItemProps,
13664 emits: ["click"],
13665 setup(props2, {
13666 emit,
13667 slots
13668 }) {
13669 const route2 = useRoute();
13670 const {
13671 parent,
13672 index
13673 } = useParent(SIDEBAR_KEY);
13674 if (!parent) {
13675 if (process.env.NODE_ENV !== "production") {
13676 console.error("[Vant] <SidebarItem> must be a child component of <Sidebar>.");
13677 }
13678 return;
13679 }
13680 const onClick = () => {
13681 if (props2.disabled) {
13682 return;
13683 }
13684 emit("click", index.value);
13685 parent.setActive(index.value);
13686 route2();
13687 };
13688 return () => {
13689 const {
13690 dot,
13691 badge,
13692 title,
13693 disabled
13694 } = props2;
13695 const selected = index.value === parent.getActive();
13696 return createVNode("div", {
13697 "role": "tab",
13698 "class": bem$j({
13699 select: selected,
13700 disabled
13701 }),
13702 "tabindex": disabled ? void 0 : 0,
13703 "aria-selected": selected,
13704 "onClick": onClick
13705 }, [createVNode(Badge, mergeProps({
13706 "dot": dot,
13707 "class": bem$j("text"),
13708 "content": badge
13709 }, props2.badgeProps), {
13710 default: () => [slots.title ? slots.title() : title]
13711 })]);
13712 };
13713 }
13714});
13715const SidebarItem = withInstall(stdin_default$s);
13716const [name$j, bem$i, t$2] = createNamespace("signature");
13717const signatureProps = {
13718 tips: String,
13719 type: makeStringProp("png"),
13720 penColor: makeStringProp("#000"),
13721 lineWidth: makeNumberProp(3),
13722 clearButtonText: String,
13723 backgroundColor: makeStringProp(""),
13724 confirmButtonText: String
13725};
13726const hasCanvasSupport = () => {
13727 var _a;
13728 const canvas = document.createElement("canvas");
13729 return !!((_a = canvas.getContext) == null ? void 0 : _a.call(canvas, "2d"));
13730};
13731var stdin_default$r = defineComponent({
13732 name: name$j,
13733 props: signatureProps,
13734 emits: ["submit", "clear", "start", "end", "signing"],
13735 setup(props2, {
13736 emit
13737 }) {
13738 const canvasRef = ref();
13739 const wrapRef = ref();
13740 const ctx = computed(() => {
13741 if (!canvasRef.value) return null;
13742 return canvasRef.value.getContext("2d");
13743 });
13744 const isRenderCanvas = inBrowser ? hasCanvasSupport() : true;
13745 let canvasWidth = 0;
13746 let canvasHeight = 0;
13747 let canvasRect;
13748 const touchStart = () => {
13749 if (!ctx.value) {
13750 return false;
13751 }
13752 ctx.value.beginPath();
13753 ctx.value.lineWidth = props2.lineWidth;
13754 ctx.value.strokeStyle = props2.penColor;
13755 canvasRect = useRect(canvasRef);
13756 emit("start");
13757 };
13758 const touchMove = (event) => {
13759 if (!ctx.value) {
13760 return false;
13761 }
13762 preventDefault(event);
13763 const touch = event.touches[0];
13764 const mouseX = touch.clientX - ((canvasRect == null ? void 0 : canvasRect.left) || 0);
13765 const mouseY = touch.clientY - ((canvasRect == null ? void 0 : canvasRect.top) || 0);
13766 ctx.value.lineCap = "round";
13767 ctx.value.lineJoin = "round";
13768 ctx.value.lineTo(mouseX, mouseY);
13769 ctx.value.stroke();
13770 emit("signing", event);
13771 };
13772 const touchEnd = (event) => {
13773 preventDefault(event);
13774 emit("end");
13775 };
13776 const isCanvasEmpty = (canvas) => {
13777 const empty = document.createElement("canvas");
13778 empty.width = canvas.width;
13779 empty.height = canvas.height;
13780 if (props2.backgroundColor) {
13781 const emptyCtx = empty.getContext("2d");
13782 setCanvasBgColor(emptyCtx);
13783 }
13784 return canvas.toDataURL() === empty.toDataURL();
13785 };
13786 const setCanvasBgColor = (ctx2) => {
13787 if (ctx2 && props2.backgroundColor) {
13788 ctx2.fillStyle = props2.backgroundColor;
13789 ctx2.fillRect(0, 0, canvasWidth, canvasHeight);
13790 }
13791 };
13792 const submit = () => {
13793 var _a, _b;
13794 const canvas = canvasRef.value;
13795 if (!canvas) {
13796 return;
13797 }
13798 const isEmpty = isCanvasEmpty(canvas);
13799 const image = isEmpty ? "" : ((_b = (_a = {
13800 jpg: () => canvas.toDataURL("image/jpeg", 0.8),
13801 jpeg: () => canvas.toDataURL("image/jpeg", 0.8)
13802 })[props2.type]) == null ? void 0 : _b.call(_a)) || canvas.toDataURL(`image/${props2.type}`);
13803 emit("submit", {
13804 image,
13805 canvas
13806 });
13807 };
13808 const clear = () => {
13809 if (ctx.value) {
13810 ctx.value.clearRect(0, 0, canvasWidth, canvasHeight);
13811 ctx.value.closePath();
13812 setCanvasBgColor(ctx.value);
13813 }
13814 emit("clear");
13815 };
13816 const initialize = () => {
13817 var _a, _b, _c;
13818 if (isRenderCanvas && canvasRef.value) {
13819 const canvas = canvasRef.value;
13820 const dpr = inBrowser ? window.devicePixelRatio : 1;
13821 canvasWidth = canvas.width = (((_a = wrapRef.value) == null ? void 0 : _a.offsetWidth) || 0) * dpr;
13822 canvasHeight = canvas.height = (((_b = wrapRef.value) == null ? void 0 : _b.offsetHeight) || 0) * dpr;
13823 (_c = ctx.value) == null ? void 0 : _c.scale(dpr, dpr);
13824 setCanvasBgColor(ctx.value);
13825 }
13826 };
13827 const resize = () => {
13828 if (ctx.value) {
13829 const data = ctx.value.getImageData(0, 0, canvasWidth, canvasHeight);
13830 initialize();
13831 ctx.value.putImageData(data, 0, 0);
13832 }
13833 };
13834 watch(windowWidth, resize);
13835 onMounted(initialize);
13836 useExpose({
13837 resize,
13838 clear,
13839 submit
13840 });
13841 return () => createVNode("div", {
13842 "class": bem$i()
13843 }, [createVNode("div", {
13844 "class": bem$i("content"),
13845 "ref": wrapRef
13846 }, [isRenderCanvas ? createVNode("canvas", {
13847 "ref": canvasRef,
13848 "onTouchstartPassive": touchStart,
13849 "onTouchmove": touchMove,
13850 "onTouchend": touchEnd
13851 }, null) : createVNode("p", null, [props2.tips])]), createVNode("div", {
13852 "class": bem$i("footer")
13853 }, [createVNode(Button, {
13854 "size": "small",
13855 "onClick": clear
13856 }, {
13857 default: () => [props2.clearButtonText || t$2("clear")]
13858 }), createVNode(Button, {
13859 "type": "primary",
13860 "size": "small",
13861 "onClick": submit
13862 }, {
13863 default: () => [props2.confirmButtonText || t$2("confirm")]
13864 })])]);
13865 }
13866});
13867const Signature = withInstall(stdin_default$r);
13868const [name$i, bem$h] = createNamespace("skeleton-title");
13869const skeletonTitleProps = {
13870 round: Boolean,
13871 titleWidth: numericProp
13872};
13873var stdin_default$q = defineComponent({
13874 name: name$i,
13875 props: skeletonTitleProps,
13876 setup(props2) {
13877 return () => createVNode("h3", {
13878 "class": bem$h([{
13879 round: props2.round
13880 }]),
13881 "style": {
13882 width: addUnit(props2.titleWidth)
13883 }
13884 }, null);
13885 }
13886});
13887const SkeletonTitle = withInstall(stdin_default$q);
13888var stdin_default$p = SkeletonTitle;
13889const [name$h, bem$g] = createNamespace("skeleton-avatar");
13890const skeletonAvatarProps = {
13891 avatarSize: numericProp,
13892 avatarShape: makeStringProp("round")
13893};
13894var stdin_default$o = defineComponent({
13895 name: name$h,
13896 props: skeletonAvatarProps,
13897 setup(props2) {
13898 return () => createVNode("div", {
13899 "class": bem$g([props2.avatarShape]),
13900 "style": getSizeStyle(props2.avatarSize)
13901 }, null);
13902 }
13903});
13904const SkeletonAvatar = withInstall(stdin_default$o);
13905var stdin_default$n = SkeletonAvatar;
13906const DEFAULT_ROW_WIDTH = "100%";
13907const skeletonParagraphProps = {
13908 round: Boolean,
13909 rowWidth: {
13910 type: numericProp,
13911 default: DEFAULT_ROW_WIDTH
13912 }
13913};
13914const [name$g, bem$f] = createNamespace("skeleton-paragraph");
13915var stdin_default$m = defineComponent({
13916 name: name$g,
13917 props: skeletonParagraphProps,
13918 setup(props2) {
13919 return () => createVNode("div", {
13920 "class": bem$f([{
13921 round: props2.round
13922 }]),
13923 "style": {
13924 width: props2.rowWidth
13925 }
13926 }, null);
13927 }
13928});
13929const SkeletonParagraph = withInstall(stdin_default$m);
13930var stdin_default$l = SkeletonParagraph;
13931const [name$f, bem$e] = createNamespace("skeleton");
13932const DEFAULT_LAST_ROW_WIDTH = "60%";
13933const skeletonProps = {
13934 row: makeNumericProp(0),
13935 round: Boolean,
13936 title: Boolean,
13937 titleWidth: numericProp,
13938 avatar: Boolean,
13939 avatarSize: numericProp,
13940 avatarShape: makeStringProp("round"),
13941 loading: truthProp,
13942 animate: truthProp,
13943 rowWidth: {
13944 type: [Number, String, Array],
13945 default: DEFAULT_ROW_WIDTH
13946 }
13947};
13948var stdin_default$k = defineComponent({
13949 name: name$f,
13950 inheritAttrs: false,
13951 props: skeletonProps,
13952 setup(props2, {
13953 slots,
13954 attrs
13955 }) {
13956 const renderAvatar = () => {
13957 if (props2.avatar) {
13958 return createVNode(stdin_default$n, {
13959 "avatarShape": props2.avatarShape,
13960 "avatarSize": props2.avatarSize
13961 }, null);
13962 }
13963 };
13964 const renderTitle = () => {
13965 if (props2.title) {
13966 return createVNode(stdin_default$p, {
13967 "round": props2.round,
13968 "titleWidth": props2.titleWidth
13969 }, null);
13970 }
13971 };
13972 const getRowWidth = (index) => {
13973 const {
13974 rowWidth
13975 } = props2;
13976 if (rowWidth === DEFAULT_ROW_WIDTH && index === +props2.row - 1) {
13977 return DEFAULT_LAST_ROW_WIDTH;
13978 }
13979 if (Array.isArray(rowWidth)) {
13980 return rowWidth[index];
13981 }
13982 return rowWidth;
13983 };
13984 const renderRows = () => Array(+props2.row).fill("").map((_, i) => createVNode(stdin_default$l, {
13985 "key": i,
13986 "round": props2.round,
13987 "rowWidth": addUnit(getRowWidth(i))
13988 }, null));
13989 const renderContents = () => {
13990 if (slots.template) {
13991 return slots.template();
13992 }
13993 return createVNode(Fragment, null, [renderAvatar(), createVNode("div", {
13994 "class": bem$e("content")
13995 }, [renderTitle(), renderRows()])]);
13996 };
13997 return () => {
13998 var _a;
13999 if (!props2.loading) {
14000 return (_a = slots.default) == null ? void 0 : _a.call(slots);
14001 }
14002 return createVNode("div", mergeProps({
14003 "class": bem$e({
14004 animate: props2.animate,
14005 round: props2.round
14006 })
14007 }, attrs), [renderContents()]);
14008 };
14009 }
14010});
14011const Skeleton = withInstall(stdin_default$k);
14012const [name$e, bem$d] = createNamespace("skeleton-image");
14013const skeletonImageProps = {
14014 imageSize: numericProp,
14015 imageShape: makeStringProp("square")
14016};
14017var stdin_default$j = defineComponent({
14018 name: name$e,
14019 props: skeletonImageProps,
14020 setup(props2) {
14021 return () => createVNode("div", {
14022 "class": bem$d([props2.imageShape]),
14023 "style": getSizeStyle(props2.imageSize)
14024 }, [createVNode(Icon, {
14025 "name": "photo",
14026 "class": bem$d("icon")
14027 }, null)]);
14028 }
14029});
14030const SkeletonImage = withInstall(stdin_default$j);
14031const [name$d, bem$c] = createNamespace("slider");
14032const sliderProps = {
14033 min: makeNumericProp(0),
14034 max: makeNumericProp(100),
14035 step: makeNumericProp(1),
14036 range: Boolean,
14037 reverse: Boolean,
14038 disabled: Boolean,
14039 readonly: Boolean,
14040 vertical: Boolean,
14041 barHeight: numericProp,
14042 buttonSize: numericProp,
14043 activeColor: String,
14044 inactiveColor: String,
14045 modelValue: {
14046 type: [Number, Array],
14047 default: 0
14048 }
14049};
14050var stdin_default$i = defineComponent({
14051 name: name$d,
14052 props: sliderProps,
14053 emits: ["change", "dragEnd", "dragStart", "update:modelValue"],
14054 setup(props2, {
14055 emit,
14056 slots
14057 }) {
14058 let buttonIndex;
14059 let current2;
14060 let startValue;
14061 const root = ref();
14062 const slider = [ref(), ref()];
14063 const dragStatus = ref();
14064 const touch = useTouch();
14065 const scope = computed(() => Number(props2.max) - Number(props2.min));
14066 const wrapperStyle = computed(() => {
14067 const crossAxis = props2.vertical ? "width" : "height";
14068 return {
14069 background: props2.inactiveColor,
14070 [crossAxis]: addUnit(props2.barHeight)
14071 };
14072 });
14073 const isRange = (val) => props2.range && Array.isArray(val);
14074 const calcMainAxis = () => {
14075 const {
14076 modelValue,
14077 min
14078 } = props2;
14079 if (isRange(modelValue)) {
14080 return `${(modelValue[1] - modelValue[0]) * 100 / scope.value}%`;
14081 }
14082 return `${(modelValue - Number(min)) * 100 / scope.value}%`;
14083 };
14084 const calcOffset = () => {
14085 const {
14086 modelValue,
14087 min
14088 } = props2;
14089 if (isRange(modelValue)) {
14090 return `${(modelValue[0] - Number(min)) * 100 / scope.value}%`;
14091 }
14092 return "0%";
14093 };
14094 const barStyle = computed(() => {
14095 const mainAxis = props2.vertical ? "height" : "width";
14096 const style = {
14097 [mainAxis]: calcMainAxis(),
14098 background: props2.activeColor
14099 };
14100 if (dragStatus.value) {
14101 style.transition = "none";
14102 }
14103 const getPositionKey = () => {
14104 if (props2.vertical) {
14105 return props2.reverse ? "bottom" : "top";
14106 }
14107 return props2.reverse ? "right" : "left";
14108 };
14109 style[getPositionKey()] = calcOffset();
14110 return style;
14111 });
14112 const format2 = (value) => {
14113 const min = +props2.min;
14114 const max = +props2.max;
14115 const step = +props2.step;
14116 value = clamp(value, min, max);
14117 const diff = Math.round((value - min) / step) * step;
14118 return addNumber(min, diff);
14119 };
14120 const updateStartValue = () => {
14121 const current22 = props2.modelValue;
14122 if (isRange(current22)) {
14123 startValue = current22.map(format2);
14124 } else {
14125 startValue = format2(current22);
14126 }
14127 };
14128 const handleRangeValue = (value) => {
14129 var _a, _b;
14130 const left = (_a = value[0]) != null ? _a : Number(props2.min);
14131 const right = (_b = value[1]) != null ? _b : Number(props2.max);
14132 return left > right ? [right, left] : [left, right];
14133 };
14134 const updateValue = (value, end) => {
14135 if (isRange(value)) {
14136 value = handleRangeValue(value).map(format2);
14137 } else {
14138 value = format2(value);
14139 }
14140 if (!isSameValue(value, props2.modelValue)) {
14141 emit("update:modelValue", value);
14142 }
14143 if (end && !isSameValue(value, startValue)) {
14144 emit("change", value);
14145 }
14146 };
14147 const onClick = (event) => {
14148 event.stopPropagation();
14149 if (props2.disabled || props2.readonly) {
14150 return;
14151 }
14152 updateStartValue();
14153 const {
14154 min,
14155 reverse,
14156 vertical,
14157 modelValue
14158 } = props2;
14159 const rect = useRect(root);
14160 const getDelta = () => {
14161 if (vertical) {
14162 if (reverse) {
14163 return rect.bottom - event.clientY;
14164 }
14165 return event.clientY - rect.top;
14166 }
14167 if (reverse) {
14168 return rect.right - event.clientX;
14169 }
14170 return event.clientX - rect.left;
14171 };
14172 const total = vertical ? rect.height : rect.width;
14173 const value = Number(min) + getDelta() / total * scope.value;
14174 if (isRange(modelValue)) {
14175 const [left, right] = modelValue;
14176 const middle = (left + right) / 2;
14177 if (value <= middle) {
14178 updateValue([value, right], true);
14179 } else {
14180 updateValue([left, value], true);
14181 }
14182 } else {
14183 updateValue(value, true);
14184 }
14185 };
14186 const onTouchStart = (event) => {
14187 if (props2.disabled || props2.readonly) {
14188 return;
14189 }
14190 touch.start(event);
14191 current2 = props2.modelValue;
14192 updateStartValue();
14193 dragStatus.value = "start";
14194 };
14195 const onTouchMove = (event) => {
14196 if (props2.disabled || props2.readonly) {
14197 return;
14198 }
14199 if (dragStatus.value === "start") {
14200 emit("dragStart", event);
14201 }
14202 preventDefault(event, true);
14203 touch.move(event);
14204 dragStatus.value = "dragging";
14205 const rect = useRect(root);
14206 const delta = props2.vertical ? touch.deltaY.value : touch.deltaX.value;
14207 const total = props2.vertical ? rect.height : rect.width;
14208 let diff = delta / total * scope.value;
14209 if (props2.reverse) {
14210 diff = -diff;
14211 }
14212 if (isRange(startValue)) {
14213 const index = props2.reverse ? 1 - buttonIndex : buttonIndex;
14214 current2[index] = startValue[index] + diff;
14215 } else {
14216 current2 = startValue + diff;
14217 }
14218 updateValue(current2);
14219 };
14220 const onTouchEnd = (event) => {
14221 if (props2.disabled || props2.readonly) {
14222 return;
14223 }
14224 if (dragStatus.value === "dragging") {
14225 updateValue(current2, true);
14226 emit("dragEnd", event);
14227 }
14228 dragStatus.value = "";
14229 };
14230 const getButtonClassName = (index) => {
14231 if (typeof index === "number") {
14232 const position = ["left", "right"];
14233 return bem$c(`button-wrapper`, position[index]);
14234 }
14235 return bem$c("button-wrapper", props2.reverse ? "left" : "right");
14236 };
14237 const renderButtonContent = (value, index) => {
14238 const dragging = dragStatus.value === "dragging";
14239 if (typeof index === "number") {
14240 const slot = slots[index === 0 ? "left-button" : "right-button"];
14241 let dragIndex;
14242 if (dragging && Array.isArray(current2)) {
14243 dragIndex = current2[0] > current2[1] ? buttonIndex ^ 1 : buttonIndex;
14244 }
14245 if (slot) {
14246 return slot({
14247 value,
14248 dragging,
14249 dragIndex
14250 });
14251 }
14252 }
14253 if (slots.button) {
14254 return slots.button({
14255 value,
14256 dragging
14257 });
14258 }
14259 return createVNode("div", {
14260 "class": bem$c("button"),
14261 "style": getSizeStyle(props2.buttonSize)
14262 }, null);
14263 };
14264 const renderButton = (index) => {
14265 const current22 = typeof index === "number" ? props2.modelValue[index] : props2.modelValue;
14266 return createVNode("div", {
14267 "ref": slider[index != null ? index : 0],
14268 "role": "slider",
14269 "class": getButtonClassName(index),
14270 "tabindex": props2.disabled ? void 0 : 0,
14271 "aria-valuemin": props2.min,
14272 "aria-valuenow": current22,
14273 "aria-valuemax": props2.max,
14274 "aria-disabled": props2.disabled || void 0,
14275 "aria-readonly": props2.readonly || void 0,
14276 "aria-orientation": props2.vertical ? "vertical" : "horizontal",
14277 "onTouchstartPassive": (event) => {
14278 if (typeof index === "number") {
14279 buttonIndex = index;
14280 }
14281 onTouchStart(event);
14282 },
14283 "onTouchend": onTouchEnd,
14284 "onTouchcancel": onTouchEnd,
14285 "onClick": stopPropagation
14286 }, [renderButtonContent(current22, index)]);
14287 };
14288 updateValue(props2.modelValue);
14289 useCustomFieldValue(() => props2.modelValue);
14290 slider.forEach((item) => {
14291 useEventListener("touchmove", onTouchMove, {
14292 target: item
14293 });
14294 });
14295 return () => createVNode("div", {
14296 "ref": root,
14297 "style": wrapperStyle.value,
14298 "class": bem$c({
14299 vertical: props2.vertical,
14300 disabled: props2.disabled
14301 }),
14302 "onClick": onClick
14303 }, [createVNode("div", {
14304 "class": bem$c("bar"),
14305 "style": barStyle.value
14306 }, [props2.range ? [renderButton(0), renderButton(1)] : renderButton()])]);
14307 }
14308});
14309const Slider = withInstall(stdin_default$i);
14310const [name$c, bem$b] = createNamespace("space");
14311const spaceProps = {
14312 align: String,
14313 direction: {
14314 type: String,
14315 default: "horizontal"
14316 },
14317 size: {
14318 type: [Number, String, Array],
14319 default: 8
14320 },
14321 wrap: Boolean,
14322 fill: Boolean
14323};
14324function filterEmpty(children = []) {
14325 const nodes = [];
14326 children.forEach((child) => {
14327 if (Array.isArray(child)) {
14328 nodes.push(...child);
14329 } else if (child.type === Fragment) {
14330 nodes.push(...filterEmpty(child.children));
14331 } else {
14332 nodes.push(child);
14333 }
14334 });
14335 return nodes.filter((c) => {
14336 var _a;
14337 return !(c && (c.type === Comment || c.type === Fragment && ((_a = c.children) == null ? void 0 : _a.length) === 0 || c.type === Text && c.children.trim() === ""));
14338 });
14339}
14340var stdin_default$h = defineComponent({
14341 name: name$c,
14342 props: spaceProps,
14343 setup(props2, {
14344 slots
14345 }) {
14346 const mergedAlign = computed(() => {
14347 var _a;
14348 return (_a = props2.align) != null ? _a : props2.direction === "horizontal" ? "center" : "";
14349 });
14350 const getMargin = (size) => {
14351 if (typeof size === "number") {
14352 return size + "px";
14353 }
14354 return size;
14355 };
14356 const getMarginStyle = (isLast) => {
14357 const style = {};
14358 const marginRight = `${getMargin(Array.isArray(props2.size) ? props2.size[0] : props2.size)}`;
14359 const marginBottom = `${getMargin(Array.isArray(props2.size) ? props2.size[1] : props2.size)}`;
14360 if (isLast) {
14361 return props2.wrap ? {
14362 marginBottom
14363 } : {};
14364 }
14365 if (props2.direction === "horizontal") {
14366 style.marginRight = marginRight;
14367 }
14368 if (props2.direction === "vertical" || props2.wrap) {
14369 style.marginBottom = marginBottom;
14370 }
14371 return style;
14372 };
14373 return () => {
14374 var _a;
14375 const children = filterEmpty((_a = slots.default) == null ? void 0 : _a.call(slots));
14376 return createVNode("div", {
14377 "class": [bem$b({
14378 [props2.direction]: props2.direction,
14379 [`align-${mergedAlign.value}`]: mergedAlign.value,
14380 wrap: props2.wrap,
14381 fill: props2.fill
14382 })]
14383 }, [children.map((c, i) => createVNode("div", {
14384 "key": `item-${i}`,
14385 "class": `${name$c}-item`,
14386 "style": getMarginStyle(i === children.length - 1)
14387 }, [c]))]);
14388 };
14389 }
14390});
14391const Space = withInstall(stdin_default$h);
14392const [name$b, bem$a] = createNamespace("steps");
14393const stepsProps = {
14394 active: makeNumericProp(0),
14395 direction: makeStringProp("horizontal"),
14396 activeIcon: makeStringProp("checked"),
14397 iconPrefix: String,
14398 finishIcon: String,
14399 activeColor: String,
14400 inactiveIcon: String,
14401 inactiveColor: String
14402};
14403const STEPS_KEY = Symbol(name$b);
14404var stdin_default$g = defineComponent({
14405 name: name$b,
14406 props: stepsProps,
14407 emits: ["clickStep"],
14408 setup(props2, {
14409 emit,
14410 slots
14411 }) {
14412 const {
14413 linkChildren
14414 } = useChildren(STEPS_KEY);
14415 const onClickStep = (index) => emit("clickStep", index);
14416 linkChildren({
14417 props: props2,
14418 onClickStep
14419 });
14420 return () => {
14421 var _a;
14422 return createVNode("div", {
14423 "class": bem$a([props2.direction])
14424 }, [createVNode("div", {
14425 "class": bem$a("items")
14426 }, [(_a = slots.default) == null ? void 0 : _a.call(slots)])]);
14427 };
14428 }
14429});
14430const [name$a, bem$9] = createNamespace("step");
14431var stdin_default$f = defineComponent({
14432 name: name$a,
14433 setup(props2, {
14434 slots
14435 }) {
14436 const {
14437 parent,
14438 index
14439 } = useParent(STEPS_KEY);
14440 if (!parent) {
14441 if (process.env.NODE_ENV !== "production") {
14442 console.error("[Vant] <Step> must be a child component of <Steps>.");
14443 }
14444 return;
14445 }
14446 const parentProps = parent.props;
14447 const getStatus = () => {
14448 const active = +parentProps.active;
14449 if (index.value < active) {
14450 return "finish";
14451 }
14452 return index.value === active ? "process" : "waiting";
14453 };
14454 const isActive = () => getStatus() === "process";
14455 const lineStyle = computed(() => ({
14456 background: getStatus() === "finish" ? parentProps.activeColor : parentProps.inactiveColor
14457 }));
14458 const titleStyle = computed(() => {
14459 if (isActive()) {
14460 return {
14461 color: parentProps.activeColor
14462 };
14463 }
14464 if (getStatus() === "waiting") {
14465 return {
14466 color: parentProps.inactiveColor
14467 };
14468 }
14469 });
14470 const onClickStep = () => parent.onClickStep(index.value);
14471 const renderCircle = () => {
14472 const {
14473 iconPrefix,
14474 finishIcon,
14475 activeIcon,
14476 activeColor,
14477 inactiveIcon
14478 } = parentProps;
14479 if (isActive()) {
14480 if (slots["active-icon"]) {
14481 return slots["active-icon"]();
14482 }
14483 return createVNode(Icon, {
14484 "class": bem$9("icon", "active"),
14485 "name": activeIcon,
14486 "color": activeColor,
14487 "classPrefix": iconPrefix
14488 }, null);
14489 }
14490 if (getStatus() === "finish" && (finishIcon || slots["finish-icon"])) {
14491 if (slots["finish-icon"]) {
14492 return slots["finish-icon"]();
14493 }
14494 return createVNode(Icon, {
14495 "class": bem$9("icon", "finish"),
14496 "name": finishIcon,
14497 "color": activeColor,
14498 "classPrefix": iconPrefix
14499 }, null);
14500 }
14501 if (slots["inactive-icon"]) {
14502 return slots["inactive-icon"]();
14503 }
14504 if (inactiveIcon) {
14505 return createVNode(Icon, {
14506 "class": bem$9("icon"),
14507 "name": inactiveIcon,
14508 "classPrefix": iconPrefix
14509 }, null);
14510 }
14511 return createVNode("i", {
14512 "class": bem$9("circle"),
14513 "style": lineStyle.value
14514 }, null);
14515 };
14516 return () => {
14517 var _a;
14518 const status = getStatus();
14519 return createVNode("div", {
14520 "class": [BORDER, bem$9([parentProps.direction, {
14521 [status]: status
14522 }])]
14523 }, [createVNode("div", {
14524 "class": bem$9("title", {
14525 active: isActive()
14526 }),
14527 "style": titleStyle.value,
14528 "onClick": onClickStep
14529 }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]), createVNode("div", {
14530 "class": bem$9("circle-container"),
14531 "onClick": onClickStep
14532 }, [renderCircle()]), createVNode("div", {
14533 "class": bem$9("line"),
14534 "style": lineStyle.value
14535 }, null)]);
14536 };
14537 }
14538});
14539const Step = withInstall(stdin_default$f);
14540const [name$9, bem$8] = createNamespace("stepper");
14541const LONG_PRESS_INTERVAL = 200;
14542const isEqual = (value1, value2) => String(value1) === String(value2);
14543const stepperProps = {
14544 min: makeNumericProp(1),
14545 max: makeNumericProp(Infinity),
14546 name: makeNumericProp(""),
14547 step: makeNumericProp(1),
14548 theme: String,
14549 integer: Boolean,
14550 disabled: Boolean,
14551 showPlus: truthProp,
14552 showMinus: truthProp,
14553 showInput: truthProp,
14554 longPress: truthProp,
14555 autoFixed: truthProp,
14556 allowEmpty: Boolean,
14557 modelValue: numericProp,
14558 inputWidth: numericProp,
14559 buttonSize: numericProp,
14560 placeholder: String,
14561 disablePlus: Boolean,
14562 disableMinus: Boolean,
14563 disableInput: Boolean,
14564 beforeChange: Function,
14565 defaultValue: makeNumericProp(1),
14566 decimalLength: numericProp
14567};
14568var stdin_default$e = defineComponent({
14569 name: name$9,
14570 props: stepperProps,
14571 emits: ["plus", "blur", "minus", "focus", "change", "overlimit", "update:modelValue"],
14572 setup(props2, {
14573 emit
14574 }) {
14575 const format2 = (value, autoFixed = true) => {
14576 const {
14577 min,
14578 max,
14579 allowEmpty,
14580 decimalLength
14581 } = props2;
14582 if (allowEmpty && value === "") {
14583 return value;
14584 }
14585 value = formatNumber(String(value), !props2.integer);
14586 value = value === "" ? 0 : +value;
14587 value = Number.isNaN(value) ? +min : value;
14588 value = autoFixed ? Math.max(Math.min(+max, value), +min) : value;
14589 if (isDef(decimalLength)) {
14590 value = value.toFixed(+decimalLength);
14591 }
14592 return value;
14593 };
14594 const getInitialValue = () => {
14595 var _a;
14596 const defaultValue = (_a = props2.modelValue) != null ? _a : props2.defaultValue;
14597 const value = format2(defaultValue);
14598 if (!isEqual(value, props2.modelValue)) {
14599 emit("update:modelValue", value);
14600 }
14601 return value;
14602 };
14603 let actionType;
14604 const inputRef = ref();
14605 const current2 = ref(getInitialValue());
14606 const minusDisabled = computed(() => props2.disabled || props2.disableMinus || +current2.value <= +props2.min);
14607 const plusDisabled = computed(() => props2.disabled || props2.disablePlus || +current2.value >= +props2.max);
14608 const inputStyle = computed(() => ({
14609 width: addUnit(props2.inputWidth),
14610 height: addUnit(props2.buttonSize)
14611 }));
14612 const buttonStyle = computed(() => getSizeStyle(props2.buttonSize));
14613 const check = () => {
14614 const value = format2(current2.value);
14615 if (!isEqual(value, current2.value)) {
14616 current2.value = value;
14617 }
14618 };
14619 const setValue = (value) => {
14620 if (props2.beforeChange) {
14621 callInterceptor(props2.beforeChange, {
14622 args: [value],
14623 done() {
14624 current2.value = value;
14625 }
14626 });
14627 } else {
14628 current2.value = value;
14629 }
14630 };
14631 const onChange = () => {
14632 if (actionType === "plus" && plusDisabled.value || actionType === "minus" && minusDisabled.value) {
14633 emit("overlimit", actionType);
14634 return;
14635 }
14636 const diff = actionType === "minus" ? -props2.step : +props2.step;
14637 const value = format2(addNumber(+current2.value, diff));
14638 setValue(value);
14639 emit(actionType);
14640 };
14641 const onInput = (event) => {
14642 const input = event.target;
14643 const {
14644 value
14645 } = input;
14646 const {
14647 decimalLength
14648 } = props2;
14649 let formatted = formatNumber(String(value), !props2.integer);
14650 if (isDef(decimalLength) && formatted.includes(".")) {
14651 const pair = formatted.split(".");
14652 formatted = `${pair[0]}.${pair[1].slice(0, +decimalLength)}`;
14653 }
14654 if (props2.beforeChange) {
14655 input.value = String(current2.value);
14656 } else if (!isEqual(value, formatted)) {
14657 input.value = formatted;
14658 }
14659 const isNumeric2 = formatted === String(+formatted);
14660 setValue(isNumeric2 ? +formatted : formatted);
14661 };
14662 const onFocus = (event) => {
14663 var _a;
14664 if (props2.disableInput) {
14665 (_a = inputRef.value) == null ? void 0 : _a.blur();
14666 } else {
14667 emit("focus", event);
14668 }
14669 };
14670 const onBlur = (event) => {
14671 const input = event.target;
14672 const value = format2(input.value, props2.autoFixed);
14673 input.value = String(value);
14674 current2.value = value;
14675 nextTick(() => {
14676 emit("blur", event);
14677 resetScroll();
14678 });
14679 };
14680 let isLongPress;
14681 let longPressTimer;
14682 const longPressStep = () => {
14683 longPressTimer = setTimeout(() => {
14684 onChange();
14685 longPressStep();
14686 }, LONG_PRESS_INTERVAL);
14687 };
14688 const onTouchStart = () => {
14689 if (props2.longPress) {
14690 isLongPress = false;
14691 clearTimeout(longPressTimer);
14692 longPressTimer = setTimeout(() => {
14693 isLongPress = true;
14694 onChange();
14695 longPressStep();
14696 }, LONG_PRESS_START_TIME);
14697 }
14698 };
14699 const onTouchEnd = (event) => {
14700 if (props2.longPress) {
14701 clearTimeout(longPressTimer);
14702 if (isLongPress) {
14703 preventDefault(event);
14704 }
14705 }
14706 };
14707 const onMousedown = (event) => {
14708 if (props2.disableInput) {
14709 preventDefault(event);
14710 }
14711 };
14712 const createListeners = (type) => ({
14713 onClick: (event) => {
14714 preventDefault(event);
14715 actionType = type;
14716 onChange();
14717 },
14718 onTouchstartPassive: () => {
14719 actionType = type;
14720 onTouchStart();
14721 },
14722 onTouchend: onTouchEnd,
14723 onTouchcancel: onTouchEnd
14724 });
14725 watch(() => [props2.max, props2.min, props2.integer, props2.decimalLength], check);
14726 watch(() => props2.modelValue, (value) => {
14727 if (!isEqual(value, current2.value)) {
14728 current2.value = format2(value);
14729 }
14730 });
14731 watch(current2, (value) => {
14732 emit("update:modelValue", value);
14733 emit("change", value, {
14734 name: props2.name
14735 });
14736 });
14737 useCustomFieldValue(() => props2.modelValue);
14738 return () => createVNode("div", {
14739 "role": "group",
14740 "class": bem$8([props2.theme])
14741 }, [withDirectives(createVNode("button", mergeProps({
14742 "type": "button",
14743 "style": buttonStyle.value,
14744 "class": [bem$8("minus", {
14745 disabled: minusDisabled.value
14746 }), {
14747 [HAPTICS_FEEDBACK]: !minusDisabled.value
14748 }],
14749 "aria-disabled": minusDisabled.value || void 0
14750 }, createListeners("minus")), null), [[vShow, props2.showMinus]]), withDirectives(createVNode("input", {
14751 "ref": inputRef,
14752 "type": props2.integer ? "tel" : "text",
14753 "role": "spinbutton",
14754 "class": bem$8("input"),
14755 "value": current2.value,
14756 "style": inputStyle.value,
14757 "disabled": props2.disabled,
14758 "readonly": props2.disableInput,
14759 "inputmode": props2.integer ? "numeric" : "decimal",
14760 "placeholder": props2.placeholder,
14761 "autocomplete": "off",
14762 "aria-valuemax": props2.max,
14763 "aria-valuemin": props2.min,
14764 "aria-valuenow": current2.value,
14765 "onBlur": onBlur,
14766 "onInput": onInput,
14767 "onFocus": onFocus,
14768 "onMousedown": onMousedown
14769 }, null), [[vShow, props2.showInput]]), withDirectives(createVNode("button", mergeProps({
14770 "type": "button",
14771 "style": buttonStyle.value,
14772 "class": [bem$8("plus", {
14773 disabled: plusDisabled.value
14774 }), {
14775 [HAPTICS_FEEDBACK]: !plusDisabled.value
14776 }],
14777 "aria-disabled": plusDisabled.value || void 0
14778 }, createListeners("plus")), null), [[vShow, props2.showPlus]])]);
14779 }
14780});
14781const Stepper = withInstall(stdin_default$e);
14782const Steps = withInstall(stdin_default$g);
14783const [name$8, bem$7, t$1] = createNamespace("submit-bar");
14784const submitBarProps = {
14785 tip: String,
14786 label: String,
14787 price: Number,
14788 tipIcon: String,
14789 loading: Boolean,
14790 currency: makeStringProp("¥"),
14791 disabled: Boolean,
14792 textAlign: String,
14793 buttonText: String,
14794 buttonType: makeStringProp("danger"),
14795 buttonColor: String,
14796 suffixLabel: String,
14797 placeholder: Boolean,
14798 decimalLength: makeNumericProp(2),
14799 safeAreaInsetBottom: truthProp
14800};
14801var stdin_default$d = defineComponent({
14802 name: name$8,
14803 props: submitBarProps,
14804 emits: ["submit"],
14805 setup(props2, {
14806 emit,
14807 slots
14808 }) {
14809 const root = ref();
14810 const renderPlaceholder = usePlaceholder(root, bem$7);
14811 const renderText = () => {
14812 const {
14813 price,
14814 label,
14815 currency,
14816 textAlign,
14817 suffixLabel,
14818 decimalLength
14819 } = props2;
14820 if (typeof price === "number") {
14821 const pricePair = (price / 100).toFixed(+decimalLength).split(".");
14822 const decimal = decimalLength ? `.${pricePair[1]}` : "";
14823 return createVNode("div", {
14824 "class": bem$7("text"),
14825 "style": {
14826 textAlign
14827 }
14828 }, [createVNode("span", null, [label || t$1("label")]), createVNode("span", {
14829 "class": bem$7("price")
14830 }, [currency, createVNode("span", {
14831 "class": bem$7("price-integer")
14832 }, [pricePair[0]]), decimal]), suffixLabel && createVNode("span", {
14833 "class": bem$7("suffix-label")
14834 }, [suffixLabel])]);
14835 }
14836 };
14837 const renderTip = () => {
14838 var _a;
14839 const {
14840 tip,
14841 tipIcon
14842 } = props2;
14843 if (slots.tip || tip) {
14844 return createVNode("div", {
14845 "class": bem$7("tip")
14846 }, [tipIcon && createVNode(Icon, {
14847 "class": bem$7("tip-icon"),
14848 "name": tipIcon
14849 }, null), tip && createVNode("span", {
14850 "class": bem$7("tip-text")
14851 }, [tip]), (_a = slots.tip) == null ? void 0 : _a.call(slots)]);
14852 }
14853 };
14854 const onClickButton = () => emit("submit");
14855 const renderButton = () => {
14856 if (slots.button) {
14857 return slots.button();
14858 }
14859 return createVNode(Button, {
14860 "round": true,
14861 "type": props2.buttonType,
14862 "text": props2.buttonText,
14863 "class": bem$7("button", props2.buttonType),
14864 "color": props2.buttonColor,
14865 "loading": props2.loading,
14866 "disabled": props2.disabled,
14867 "onClick": onClickButton
14868 }, null);
14869 };
14870 const renderSubmitBar = () => {
14871 var _a, _b;
14872 return createVNode("div", {
14873 "ref": root,
14874 "class": [bem$7(), {
14875 "van-safe-area-bottom": props2.safeAreaInsetBottom
14876 }]
14877 }, [(_a = slots.top) == null ? void 0 : _a.call(slots), renderTip(), createVNode("div", {
14878 "class": bem$7("bar")
14879 }, [(_b = slots.default) == null ? void 0 : _b.call(slots), renderText(), renderButton()])]);
14880 };
14881 return () => {
14882 if (props2.placeholder) {
14883 return renderPlaceholder(renderSubmitBar);
14884 }
14885 return renderSubmitBar();
14886 };
14887 }
14888});
14889const SubmitBar = withInstall(stdin_default$d);
14890const [name$7, bem$6] = createNamespace("swipe-cell");
14891const swipeCellProps = {
14892 name: makeNumericProp(""),
14893 disabled: Boolean,
14894 leftWidth: numericProp,
14895 rightWidth: numericProp,
14896 beforeClose: Function,
14897 stopPropagation: Boolean
14898};
14899var stdin_default$c = defineComponent({
14900 name: name$7,
14901 props: swipeCellProps,
14902 emits: ["open", "close", "click"],
14903 setup(props2, {
14904 emit,
14905 slots
14906 }) {
14907 let opened;
14908 let lockClick2;
14909 let startOffset;
14910 let isInBeforeClosing;
14911 const root = ref();
14912 const leftRef = ref();
14913 const rightRef = ref();
14914 const state = reactive({
14915 offset: 0,
14916 dragging: false
14917 });
14918 const touch = useTouch();
14919 const getWidthByRef = (ref2) => ref2.value ? useRect(ref2).width : 0;
14920 const leftWidth = computed(() => isDef(props2.leftWidth) ? +props2.leftWidth : getWidthByRef(leftRef));
14921 const rightWidth = computed(() => isDef(props2.rightWidth) ? +props2.rightWidth : getWidthByRef(rightRef));
14922 const open = (side) => {
14923 state.offset = side === "left" ? leftWidth.value : -rightWidth.value;
14924 if (!opened) {
14925 opened = true;
14926 emit("open", {
14927 name: props2.name,
14928 position: side
14929 });
14930 }
14931 };
14932 const close = (position) => {
14933 state.offset = 0;
14934 if (opened) {
14935 opened = false;
14936 emit("close", {
14937 name: props2.name,
14938 position
14939 });
14940 }
14941 };
14942 const toggle = (side) => {
14943 const offset = Math.abs(state.offset);
14944 const THRESHOLD = 0.15;
14945 const threshold = opened ? 1 - THRESHOLD : THRESHOLD;
14946 const width = side === "left" ? leftWidth.value : rightWidth.value;
14947 if (width && offset > width * threshold) {
14948 open(side);
14949 } else {
14950 close(side);
14951 }
14952 };
14953 const onTouchStart = (event) => {
14954 if (!props2.disabled) {
14955 startOffset = state.offset;
14956 touch.start(event);
14957 }
14958 };
14959 const onTouchMove = (event) => {
14960 if (props2.disabled) {
14961 return;
14962 }
14963 const {
14964 deltaX
14965 } = touch;
14966 touch.move(event);
14967 if (touch.isHorizontal()) {
14968 lockClick2 = true;
14969 state.dragging = true;
14970 const isEdge = !opened || deltaX.value * startOffset < 0;
14971 if (isEdge) {
14972 preventDefault(event, props2.stopPropagation);
14973 }
14974 state.offset = clamp(deltaX.value + startOffset, -rightWidth.value, leftWidth.value);
14975 }
14976 };
14977 const onTouchEnd = () => {
14978 if (state.dragging) {
14979 state.dragging = false;
14980 toggle(state.offset > 0 ? "left" : "right");
14981 setTimeout(() => {
14982 lockClick2 = false;
14983 }, 0);
14984 }
14985 };
14986 const onClick = (position = "outside", event) => {
14987 if (isInBeforeClosing) return;
14988 emit("click", position);
14989 if (opened && !lockClick2) {
14990 isInBeforeClosing = true;
14991 callInterceptor(props2.beforeClose, {
14992 args: [{
14993 event,
14994 name: props2.name,
14995 position
14996 }],
14997 done: () => {
14998 isInBeforeClosing = false;
14999 close(position);
15000 },
15001 canceled: () => isInBeforeClosing = false,
15002 error: () => isInBeforeClosing = false
15003 });
15004 }
15005 };
15006 const getClickHandler = (position, stop) => (event) => {
15007 if (stop) {
15008 event.stopPropagation();
15009 }
15010 if (lockClick2) {
15011 return;
15012 }
15013 onClick(position, event);
15014 };
15015 const renderSideContent = (side, ref2) => {
15016 const contentSlot = slots[side];
15017 if (contentSlot) {
15018 return createVNode("div", {
15019 "ref": ref2,
15020 "class": bem$6(side),
15021 "onClick": getClickHandler(side, true)
15022 }, [contentSlot()]);
15023 }
15024 };
15025 useExpose({
15026 open,
15027 close
15028 });
15029 useClickAway(root, (event) => onClick("outside", event), {
15030 eventName: "touchstart"
15031 });
15032 useEventListener("touchmove", onTouchMove, {
15033 target: root
15034 });
15035 return () => {
15036 var _a;
15037 const wrapperStyle = {
15038 transform: `translate3d(${state.offset}px, 0, 0)`,
15039 transitionDuration: state.dragging ? "0s" : ".6s"
15040 };
15041 return createVNode("div", {
15042 "ref": root,
15043 "class": bem$6(),
15044 "onClick": getClickHandler("cell", lockClick2),
15045 "onTouchstartPassive": onTouchStart,
15046 "onTouchend": onTouchEnd,
15047 "onTouchcancel": onTouchEnd
15048 }, [createVNode("div", {
15049 "class": bem$6("wrapper"),
15050 "style": wrapperStyle
15051 }, [renderSideContent("left", leftRef), (_a = slots.default) == null ? void 0 : _a.call(slots), renderSideContent("right", rightRef)])]);
15052 };
15053 }
15054});
15055const SwipeCell = withInstall(stdin_default$c);
15056const [name$6, bem$5] = createNamespace("tabbar");
15057const tabbarProps = {
15058 route: Boolean,
15059 fixed: truthProp,
15060 border: truthProp,
15061 zIndex: numericProp,
15062 placeholder: Boolean,
15063 activeColor: String,
15064 beforeChange: Function,
15065 inactiveColor: String,
15066 modelValue: makeNumericProp(0),
15067 safeAreaInsetBottom: {
15068 type: Boolean,
15069 default: null
15070 }
15071};
15072const TABBAR_KEY = Symbol(name$6);
15073var stdin_default$b = defineComponent({
15074 name: name$6,
15075 props: tabbarProps,
15076 emits: ["change", "update:modelValue"],
15077 setup(props2, {
15078 emit,
15079 slots
15080 }) {
15081 const root = ref();
15082 const {
15083 linkChildren
15084 } = useChildren(TABBAR_KEY);
15085 const renderPlaceholder = usePlaceholder(root, bem$5);
15086 const enableSafeArea = () => {
15087 var _a;
15088 return (_a = props2.safeAreaInsetBottom) != null ? _a : props2.fixed;
15089 };
15090 const renderTabbar = () => {
15091 var _a;
15092 const {
15093 fixed,
15094 zIndex,
15095 border
15096 } = props2;
15097 return createVNode("div", {
15098 "ref": root,
15099 "role": "tablist",
15100 "style": getZIndexStyle(zIndex),
15101 "class": [bem$5({
15102 fixed
15103 }), {
15104 [BORDER_TOP_BOTTOM]: border,
15105 "van-safe-area-bottom": enableSafeArea()
15106 }]
15107 }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
15108 };
15109 const setActive = (active, afterChange) => {
15110 callInterceptor(props2.beforeChange, {
15111 args: [active],
15112 done() {
15113 emit("update:modelValue", active);
15114 emit("change", active);
15115 afterChange();
15116 }
15117 });
15118 };
15119 linkChildren({
15120 props: props2,
15121 setActive
15122 });
15123 return () => {
15124 if (props2.fixed && props2.placeholder) {
15125 return renderPlaceholder(renderTabbar);
15126 }
15127 return renderTabbar();
15128 };
15129 }
15130});
15131const Tabbar = withInstall(stdin_default$b);
15132const [name$5, bem$4] = createNamespace("tabbar-item");
15133const tabbarItemProps = extend({}, routeProps, {
15134 dot: Boolean,
15135 icon: String,
15136 name: numericProp,
15137 badge: numericProp,
15138 badgeProps: Object,
15139 iconPrefix: String
15140});
15141var stdin_default$a = defineComponent({
15142 name: name$5,
15143 props: tabbarItemProps,
15144 emits: ["click"],
15145 setup(props2, {
15146 emit,
15147 slots
15148 }) {
15149 const route2 = useRoute();
15150 const vm = getCurrentInstance().proxy;
15151 const {
15152 parent,
15153 index
15154 } = useParent(TABBAR_KEY);
15155 if (!parent) {
15156 if (process.env.NODE_ENV !== "production") {
15157 console.error("[Vant] <TabbarItem> must be a child component of <Tabbar>.");
15158 }
15159 return;
15160 }
15161 const active = computed(() => {
15162 var _a;
15163 const {
15164 route: route22,
15165 modelValue
15166 } = parent.props;
15167 if (route22 && "$route" in vm) {
15168 const {
15169 $route
15170 } = vm;
15171 const {
15172 to
15173 } = props2;
15174 const config = isObject(to) ? to : {
15175 path: to
15176 };
15177 return !!$route.matched.find((val) => {
15178 const pathMatched = "path" in config && config.path === val.path;
15179 const nameMatched = "name" in config && config.name === val.name;
15180 return pathMatched || nameMatched;
15181 });
15182 }
15183 return ((_a = props2.name) != null ? _a : index.value) === modelValue;
15184 });
15185 const onClick = (event) => {
15186 var _a;
15187 if (!active.value) {
15188 parent.setActive((_a = props2.name) != null ? _a : index.value, route2);
15189 }
15190 emit("click", event);
15191 };
15192 const renderIcon = () => {
15193 if (slots.icon) {
15194 return slots.icon({
15195 active: active.value
15196 });
15197 }
15198 if (props2.icon) {
15199 return createVNode(Icon, {
15200 "name": props2.icon,
15201 "classPrefix": props2.iconPrefix
15202 }, null);
15203 }
15204 };
15205 return () => {
15206 var _a;
15207 const {
15208 dot,
15209 badge
15210 } = props2;
15211 const {
15212 activeColor,
15213 inactiveColor
15214 } = parent.props;
15215 const color = active.value ? activeColor : inactiveColor;
15216 return createVNode("div", {
15217 "role": "tab",
15218 "class": bem$4({
15219 active: active.value
15220 }),
15221 "style": {
15222 color
15223 },
15224 "tabindex": 0,
15225 "aria-selected": active.value,
15226 "onClick": onClick
15227 }, [createVNode(Badge, mergeProps({
15228 "dot": dot,
15229 "class": bem$4("icon"),
15230 "content": badge
15231 }, props2.badgeProps), {
15232 default: renderIcon
15233 }), createVNode("div", {
15234 "class": bem$4("text")
15235 }, [(_a = slots.default) == null ? void 0 : _a.call(slots, {
15236 active: active.value
15237 })])]);
15238 };
15239 }
15240});
15241const TabbarItem = withInstall(stdin_default$a);
15242const [name$4, bem$3] = createNamespace("text-ellipsis");
15243const textEllipsisProps = {
15244 rows: makeNumericProp(1),
15245 dots: makeStringProp("..."),
15246 content: makeStringProp(""),
15247 expandText: makeStringProp(""),
15248 collapseText: makeStringProp(""),
15249 position: makeStringProp("end")
15250};
15251var stdin_default$9 = defineComponent({
15252 name: name$4,
15253 props: textEllipsisProps,
15254 emits: ["clickAction"],
15255 setup(props2, {
15256 emit,
15257 slots
15258 }) {
15259 const text = ref(props2.content);
15260 const expanded = ref(false);
15261 const hasAction = ref(false);
15262 const root = ref();
15263 const actionRef = ref();
15264 let needRecalculate = false;
15265 const actionText = computed(() => expanded.value ? props2.collapseText : props2.expandText);
15266 const pxToNum = (value) => {
15267 if (!value) return 0;
15268 const match = value.match(/^\d*(\.\d*)?/);
15269 return match ? Number(match[0]) : 0;
15270 };
15271 const cloneContainer = () => {
15272 if (!root.value || !root.value.isConnected) return;
15273 const originStyle = window.getComputedStyle(root.value);
15274 const container = document.createElement("div");
15275 const styleNames = Array.prototype.slice.apply(originStyle);
15276 styleNames.forEach((name2) => {
15277 container.style.setProperty(name2, originStyle.getPropertyValue(name2));
15278 });
15279 container.style.position = "fixed";
15280 container.style.zIndex = "-9999";
15281 container.style.top = "-9999px";
15282 container.style.height = "auto";
15283 container.style.minHeight = "auto";
15284 container.style.maxHeight = "auto";
15285 container.innerText = props2.content;
15286 document.body.appendChild(container);
15287 return container;
15288 };
15289 const calcEllipsisText = (container, maxHeight) => {
15290 var _a, _b;
15291 const {
15292 content,
15293 position,
15294 dots
15295 } = props2;
15296 const end = content.length;
15297 const middle = 0 + end >> 1;
15298 const actionHTML = slots.action ? (_b = (_a = actionRef.value) == null ? void 0 : _a.outerHTML) != null ? _b : "" : props2.expandText;
15299 const calcEllipse = () => {
15300 const tail = (left, right) => {
15301 if (right - left <= 1) {
15302 if (position === "end") {
15303 return content.slice(0, left) + dots;
15304 }
15305 return dots + content.slice(right, end);
15306 }
15307 const middle2 = Math.round((left + right) / 2);
15308 if (position === "end") {
15309 container.innerText = content.slice(0, middle2) + dots;
15310 } else {
15311 container.innerText = dots + content.slice(middle2, end);
15312 }
15313 container.innerHTML += actionHTML;
15314 if (container.offsetHeight > maxHeight) {
15315 if (position === "end") {
15316 return tail(left, middle2);
15317 }
15318 return tail(middle2, right);
15319 }
15320 if (position === "end") {
15321 return tail(middle2, right);
15322 }
15323 return tail(left, middle2);
15324 };
15325 return tail(0, end);
15326 };
15327 const middleTail = (leftPart, rightPart) => {
15328 if (leftPart[1] - leftPart[0] <= 1 && rightPart[1] - rightPart[0] <= 1) {
15329 return content.slice(0, leftPart[0]) + dots + content.slice(rightPart[1], end);
15330 }
15331 const leftMiddle = Math.floor((leftPart[0] + leftPart[1]) / 2);
15332 const rightMiddle = Math.ceil((rightPart[0] + rightPart[1]) / 2);
15333 container.innerText = props2.content.slice(0, leftMiddle) + props2.dots + props2.content.slice(rightMiddle, end);
15334 container.innerHTML += actionHTML;
15335 if (container.offsetHeight >= maxHeight) {
15336 return middleTail([leftPart[0], leftMiddle], [rightMiddle, rightPart[1]]);
15337 }
15338 return middleTail([leftMiddle, leftPart[1]], [rightPart[0], rightMiddle]);
15339 };
15340 return props2.position === "middle" ? middleTail([0, middle], [middle, end]) : calcEllipse();
15341 };
15342 const calcEllipsised = () => {
15343 const container = cloneContainer();
15344 if (!container) {
15345 needRecalculate = true;
15346 return;
15347 }
15348 const {
15349 paddingBottom,
15350 paddingTop,
15351 lineHeight
15352 } = container.style;
15353 const maxHeight = Math.ceil((Number(props2.rows) + 0.5) * pxToNum(lineHeight) + pxToNum(paddingTop) + pxToNum(paddingBottom));
15354 if (maxHeight < container.offsetHeight) {
15355 hasAction.value = true;
15356 text.value = calcEllipsisText(container, maxHeight);
15357 } else {
15358 hasAction.value = false;
15359 text.value = props2.content;
15360 }
15361 document.body.removeChild(container);
15362 };
15363 const toggle = (isExpanded = !expanded.value) => {
15364 expanded.value = isExpanded;
15365 };
15366 const onClickAction = (event) => {
15367 toggle();
15368 emit("clickAction", event);
15369 };
15370 const renderAction = () => {
15371 const action = slots.action ? slots.action({
15372 expanded: expanded.value
15373 }) : actionText.value;
15374 return createVNode("span", {
15375 "ref": actionRef,
15376 "class": bem$3("action"),
15377 "onClick": onClickAction
15378 }, [action]);
15379 };
15380 onMounted(() => {
15381 calcEllipsised();
15382 if (slots.action) {
15383 nextTick(calcEllipsised);
15384 }
15385 });
15386 onActivated(() => {
15387 if (needRecalculate) {
15388 needRecalculate = false;
15389 calcEllipsised();
15390 }
15391 });
15392 watch([windowWidth, () => [props2.content, props2.rows, props2.position]], calcEllipsised);
15393 useExpose({
15394 toggle
15395 });
15396 return () => createVNode("div", {
15397 "ref": root,
15398 "class": bem$3()
15399 }, [expanded.value ? props2.content : text.value, hasAction.value ? renderAction() : null]);
15400 }
15401});
15402const TextEllipsis = withInstall(stdin_default$9);
15403const [name$3] = createNamespace("time-picker");
15404const validateTime = (val) => /^([01]\d|2[0-3]):([0-5]\d):([0-5]\d)$/.test(val);
15405const fullColumns = ["hour", "minute", "second"];
15406const timePickerProps = extend({}, sharedProps, {
15407 minHour: makeNumericProp(0),
15408 maxHour: makeNumericProp(23),
15409 minMinute: makeNumericProp(0),
15410 maxMinute: makeNumericProp(59),
15411 minSecond: makeNumericProp(0),
15412 maxSecond: makeNumericProp(59),
15413 minTime: {
15414 type: String,
15415 validator: validateTime
15416 },
15417 maxTime: {
15418 type: String,
15419 validator: validateTime
15420 },
15421 columnsType: {
15422 type: Array,
15423 default: () => ["hour", "minute"]
15424 }
15425});
15426var stdin_default$8 = defineComponent({
15427 name: name$3,
15428 props: timePickerProps,
15429 emits: ["confirm", "cancel", "change", "update:modelValue"],
15430 setup(props2, {
15431 emit,
15432 slots
15433 }) {
15434 const currentValues = ref(props2.modelValue);
15435 const pickerRef = ref();
15436 const getValidTime = (time) => {
15437 const timeLimitArr = time.split(":");
15438 return fullColumns.map((col, i) => props2.columnsType.includes(col) ? timeLimitArr[i] : "00");
15439 };
15440 const confirm = () => {
15441 var _a;
15442 return (_a = pickerRef.value) == null ? void 0 : _a.confirm();
15443 };
15444 const getSelectedTime = () => currentValues.value;
15445 const columns = computed(() => {
15446 let {
15447 minHour,
15448 maxHour,
15449 minMinute,
15450 maxMinute,
15451 minSecond,
15452 maxSecond
15453 } = props2;
15454 if (props2.minTime || props2.maxTime) {
15455 const fullTime = {
15456 hour: 0,
15457 minute: 0,
15458 second: 0
15459 };
15460 props2.columnsType.forEach((col, i) => {
15461 var _a;
15462 fullTime[col] = (_a = currentValues.value[i]) != null ? _a : 0;
15463 });
15464 const {
15465 hour,
15466 minute
15467 } = fullTime;
15468 if (props2.minTime) {
15469 const [minH, minM, minS] = getValidTime(props2.minTime);
15470 minHour = minH;
15471 minMinute = +hour <= +minHour ? minM : "00";
15472 minSecond = +hour <= +minHour && +minute <= +minMinute ? minS : "00";
15473 }
15474 if (props2.maxTime) {
15475 const [maxH, maxM, maxS] = getValidTime(props2.maxTime);
15476 maxHour = maxH;
15477 maxMinute = +hour >= +maxHour ? maxM : "59";
15478 maxSecond = +hour >= +maxHour && +minute >= +maxMinute ? maxS : "59";
15479 }
15480 }
15481 return props2.columnsType.map((type) => {
15482 const {
15483 filter,
15484 formatter
15485 } = props2;
15486 switch (type) {
15487 case "hour":
15488 return genOptions(+minHour, +maxHour, type, formatter, filter, currentValues.value);
15489 case "minute":
15490 return genOptions(+minMinute, +maxMinute, type, formatter, filter, currentValues.value);
15491 case "second":
15492 return genOptions(+minSecond, +maxSecond, type, formatter, filter, currentValues.value);
15493 default:
15494 if (process.env.NODE_ENV !== "production") {
15495 throw new Error(`[Vant] DatePicker: unsupported columns type: ${type}`);
15496 }
15497 return [];
15498 }
15499 });
15500 });
15501 watch(currentValues, (newValues) => {
15502 if (!isSameValue(newValues, props2.modelValue)) {
15503 emit("update:modelValue", newValues);
15504 }
15505 });
15506 watch(() => props2.modelValue, (newValues) => {
15507 newValues = formatValueRange(newValues, columns.value);
15508 if (!isSameValue(newValues, currentValues.value)) {
15509 currentValues.value = newValues;
15510 }
15511 }, {
15512 immediate: true
15513 });
15514 const onChange = (...args) => emit("change", ...args);
15515 const onCancel = (...args) => emit("cancel", ...args);
15516 const onConfirm = (...args) => emit("confirm", ...args);
15517 useExpose({
15518 confirm,
15519 getSelectedTime
15520 });
15521 return () => createVNode(Picker, mergeProps({
15522 "ref": pickerRef,
15523 "modelValue": currentValues.value,
15524 "onUpdate:modelValue": ($event) => currentValues.value = $event,
15525 "columns": columns.value,
15526 "onChange": onChange,
15527 "onCancel": onCancel,
15528 "onConfirm": onConfirm
15529 }, pick(props2, pickerInheritKeys)), slots);
15530 }
15531});
15532const TimePicker = withInstall(stdin_default$8);
15533const [name$2, bem$2] = createNamespace("tree-select");
15534const treeSelectProps = {
15535 max: makeNumericProp(Infinity),
15536 items: makeArrayProp(),
15537 height: makeNumericProp(300),
15538 selectedIcon: makeStringProp("success"),
15539 mainActiveIndex: makeNumericProp(0),
15540 activeId: {
15541 type: [Number, String, Array],
15542 default: 0
15543 }
15544};
15545var stdin_default$7 = defineComponent({
15546 name: name$2,
15547 props: treeSelectProps,
15548 emits: ["clickNav", "clickItem", "update:activeId", "update:mainActiveIndex"],
15549 setup(props2, {
15550 emit,
15551 slots
15552 }) {
15553 const isActiveItem = (id) => Array.isArray(props2.activeId) ? props2.activeId.includes(id) : props2.activeId === id;
15554 const renderSubItem = (item) => {
15555 const onClick = () => {
15556 if (item.disabled) {
15557 return;
15558 }
15559 let activeId;
15560 if (Array.isArray(props2.activeId)) {
15561 activeId = props2.activeId.slice();
15562 const index = activeId.indexOf(item.id);
15563 if (index !== -1) {
15564 activeId.splice(index, 1);
15565 } else if (activeId.length < +props2.max) {
15566 activeId.push(item.id);
15567 }
15568 } else {
15569 activeId = item.id;
15570 }
15571 emit("update:activeId", activeId);
15572 emit("clickItem", item);
15573 };
15574 return createVNode("div", {
15575 "key": item.id,
15576 "class": ["van-ellipsis", bem$2("item", {
15577 active: isActiveItem(item.id),
15578 disabled: item.disabled
15579 })],
15580 "onClick": onClick
15581 }, [item.text, isActiveItem(item.id) && createVNode(Icon, {
15582 "name": props2.selectedIcon,
15583 "class": bem$2("selected")
15584 }, null)]);
15585 };
15586 const onSidebarChange = (index) => {
15587 emit("update:mainActiveIndex", index);
15588 };
15589 const onClickSidebarItem = (index) => emit("clickNav", index);
15590 const renderSidebar = () => {
15591 const Items = props2.items.map((item) => createVNode(SidebarItem, {
15592 "dot": item.dot,
15593 "badge": item.badge,
15594 "class": [bem$2("nav-item"), item.className],
15595 "disabled": item.disabled,
15596 "onClick": onClickSidebarItem
15597 }, {
15598 title: () => slots["nav-text"] ? slots["nav-text"](item) : item.text
15599 }));
15600 return createVNode(Sidebar, {
15601 "class": bem$2("nav"),
15602 "modelValue": props2.mainActiveIndex,
15603 "onChange": onSidebarChange
15604 }, {
15605 default: () => [Items]
15606 });
15607 };
15608 const renderContent = () => {
15609 if (slots.content) {
15610 return slots.content();
15611 }
15612 const selected = props2.items[+props2.mainActiveIndex] || {};
15613 if (selected.children) {
15614 return selected.children.map(renderSubItem);
15615 }
15616 };
15617 return () => createVNode("div", {
15618 "class": bem$2(),
15619 "style": {
15620 height: addUnit(props2.height)
15621 }
15622 }, [renderSidebar(), createVNode("div", {
15623 "class": bem$2("content")
15624 }, [renderContent()])]);
15625 }
15626});
15627const TreeSelect = withInstall(stdin_default$7);
15628const [name$1, bem$1, t] = createNamespace("uploader");
15629function readFileContent(file, resultType) {
15630 return new Promise((resolve) => {
15631 if (resultType === "file") {
15632 resolve();
15633 return;
15634 }
15635 const reader = new FileReader();
15636 reader.onload = (event) => {
15637 resolve(event.target.result);
15638 };
15639 if (resultType === "dataUrl") {
15640 reader.readAsDataURL(file);
15641 } else if (resultType === "text") {
15642 reader.readAsText(file);
15643 }
15644 });
15645}
15646function isOversize(items, maxSize) {
15647 return toArray(items).some((item) => {
15648 if (item.file) {
15649 if (isFunction(maxSize)) {
15650 return maxSize(item.file);
15651 }
15652 return item.file.size > +maxSize;
15653 }
15654 return false;
15655 });
15656}
15657function filterFiles(items, maxSize) {
15658 const valid = [];
15659 const invalid = [];
15660 items.forEach((item) => {
15661 if (isOversize(item, maxSize)) {
15662 invalid.push(item);
15663 } else {
15664 valid.push(item);
15665 }
15666 });
15667 return { valid, invalid };
15668}
15669const IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg|avif)/i;
15670const isImageUrl = (url) => IMAGE_REGEXP.test(url);
15671function isImageFile(item) {
15672 if (item.isImage) {
15673 return true;
15674 }
15675 if (item.file && item.file.type) {
15676 return item.file.type.indexOf("image") === 0;
15677 }
15678 if (item.url) {
15679 return isImageUrl(item.url);
15680 }
15681 if (typeof item.content === "string") {
15682 return item.content.indexOf("data:image") === 0;
15683 }
15684 return false;
15685}
15686var stdin_default$6 = defineComponent({
15687 props: {
15688 name: numericProp,
15689 item: makeRequiredProp(Object),
15690 index: Number,
15691 imageFit: String,
15692 lazyLoad: Boolean,
15693 deletable: Boolean,
15694 reupload: Boolean,
15695 previewSize: [Number, String, Array],
15696 beforeDelete: Function
15697 },
15698 emits: ["delete", "preview", "reupload"],
15699 setup(props2, {
15700 emit,
15701 slots
15702 }) {
15703 const renderMask = () => {
15704 const {
15705 status,
15706 message
15707 } = props2.item;
15708 if (status === "uploading" || status === "failed") {
15709 const MaskIcon = status === "failed" ? createVNode(Icon, {
15710 "name": "close",
15711 "class": bem$1("mask-icon")
15712 }, null) : createVNode(Loading, {
15713 "class": bem$1("loading")
15714 }, null);
15715 const showMessage = isDef(message) && message !== "";
15716 return createVNode("div", {
15717 "class": bem$1("mask")
15718 }, [MaskIcon, showMessage && createVNode("div", {
15719 "class": bem$1("mask-message")
15720 }, [message])]);
15721 }
15722 };
15723 const onDelete = (event) => {
15724 const {
15725 name: name2,
15726 item,
15727 index,
15728 beforeDelete
15729 } = props2;
15730 event.stopPropagation();
15731 callInterceptor(beforeDelete, {
15732 args: [item, {
15733 name: name2,
15734 index
15735 }],
15736 done: () => emit("delete")
15737 });
15738 };
15739 const onPreview = () => emit("preview");
15740 const onReupload = () => emit("reupload");
15741 const renderDeleteIcon = () => {
15742 if (props2.deletable && props2.item.status !== "uploading") {
15743 const slot = slots["preview-delete"];
15744 return createVNode("div", {
15745 "role": "button",
15746 "class": bem$1("preview-delete", {
15747 shadow: !slot
15748 }),
15749 "tabindex": 0,
15750 "aria-label": t("delete"),
15751 "onClick": onDelete
15752 }, [slot ? slot() : createVNode(Icon, {
15753 "name": "cross",
15754 "class": bem$1("preview-delete-icon")
15755 }, null)]);
15756 }
15757 };
15758 const renderCover = () => {
15759 if (slots["preview-cover"]) {
15760 const {
15761 index,
15762 item
15763 } = props2;
15764 return createVNode("div", {
15765 "class": bem$1("preview-cover")
15766 }, [slots["preview-cover"](extend({
15767 index
15768 }, item))]);
15769 }
15770 };
15771 const renderPreview = () => {
15772 const {
15773 item,
15774 lazyLoad,
15775 imageFit,
15776 previewSize,
15777 reupload
15778 } = props2;
15779 if (isImageFile(item)) {
15780 return createVNode(Image$1, {
15781 "fit": imageFit,
15782 "src": item.objectUrl || item.content || item.url,
15783 "class": bem$1("preview-image"),
15784 "width": Array.isArray(previewSize) ? previewSize[0] : previewSize,
15785 "height": Array.isArray(previewSize) ? previewSize[1] : previewSize,
15786 "lazyLoad": lazyLoad,
15787 "onClick": reupload ? onReupload : onPreview
15788 }, {
15789 default: renderCover
15790 });
15791 }
15792 return createVNode("div", {
15793 "class": bem$1("file"),
15794 "style": getSizeStyle(props2.previewSize)
15795 }, [createVNode(Icon, {
15796 "class": bem$1("file-icon"),
15797 "name": "description"
15798 }, null), createVNode("div", {
15799 "class": [bem$1("file-name"), "van-ellipsis"]
15800 }, [item.file ? item.file.name : item.url]), renderCover()]);
15801 };
15802 return () => createVNode("div", {
15803 "class": bem$1("preview")
15804 }, [renderPreview(), renderMask(), renderDeleteIcon()]);
15805 }
15806});
15807const uploaderProps = {
15808 name: makeNumericProp(""),
15809 accept: makeStringProp("image/*"),
15810 capture: String,
15811 multiple: Boolean,
15812 disabled: Boolean,
15813 readonly: Boolean,
15814 lazyLoad: Boolean,
15815 maxCount: makeNumericProp(Infinity),
15816 imageFit: makeStringProp("cover"),
15817 resultType: makeStringProp("dataUrl"),
15818 uploadIcon: makeStringProp("photograph"),
15819 uploadText: String,
15820 deletable: truthProp,
15821 reupload: Boolean,
15822 afterRead: Function,
15823 showUpload: truthProp,
15824 modelValue: makeArrayProp(),
15825 beforeRead: Function,
15826 beforeDelete: Function,
15827 previewSize: [Number, String, Array],
15828 previewImage: truthProp,
15829 previewOptions: Object,
15830 previewFullImage: truthProp,
15831 maxSize: {
15832 type: [Number, String, Function],
15833 default: Infinity
15834 }
15835};
15836var stdin_default$5 = defineComponent({
15837 name: name$1,
15838 props: uploaderProps,
15839 emits: ["delete", "oversize", "clickUpload", "closePreview", "clickPreview", "clickReupload", "update:modelValue"],
15840 setup(props2, {
15841 emit,
15842 slots
15843 }) {
15844 const inputRef = ref();
15845 const urls = [];
15846 const reuploadIndex = ref(-1);
15847 const isReuploading = ref(false);
15848 const getDetail = (index = props2.modelValue.length) => ({
15849 name: props2.name,
15850 index
15851 });
15852 const resetInput = () => {
15853 if (inputRef.value) {
15854 inputRef.value.value = "";
15855 }
15856 };
15857 const onAfterRead = (items) => {
15858 resetInput();
15859 if (isOversize(items, props2.maxSize)) {
15860 if (Array.isArray(items)) {
15861 const result = filterFiles(items, props2.maxSize);
15862 items = result.valid;
15863 emit("oversize", result.invalid, getDetail());
15864 if (!items.length) {
15865 return;
15866 }
15867 } else {
15868 emit("oversize", items, getDetail());
15869 return;
15870 }
15871 }
15872 items = reactive(items);
15873 if (reuploadIndex.value > -1) {
15874 const arr = [...props2.modelValue];
15875 arr.splice(reuploadIndex.value, 1, items);
15876 emit("update:modelValue", arr);
15877 reuploadIndex.value = -1;
15878 } else {
15879 emit("update:modelValue", [...props2.modelValue, ...toArray(items)]);
15880 }
15881 if (props2.afterRead) {
15882 props2.afterRead(items, getDetail());
15883 }
15884 };
15885 const readFile = (files) => {
15886 const {
15887 maxCount,
15888 modelValue,
15889 resultType
15890 } = props2;
15891 if (Array.isArray(files)) {
15892 const remainCount = +maxCount - modelValue.length;
15893 if (files.length > remainCount) {
15894 files = files.slice(0, remainCount);
15895 }
15896 Promise.all(files.map((file) => readFileContent(file, resultType))).then((contents) => {
15897 const fileList = files.map((file, index) => {
15898 const result = {
15899 file,
15900 status: "",
15901 message: "",
15902 objectUrl: URL.createObjectURL(file)
15903 };
15904 if (contents[index]) {
15905 result.content = contents[index];
15906 }
15907 return result;
15908 });
15909 onAfterRead(fileList);
15910 });
15911 } else {
15912 readFileContent(files, resultType).then((content) => {
15913 const result = {
15914 file: files,
15915 status: "",
15916 message: "",
15917 objectUrl: URL.createObjectURL(files)
15918 };
15919 if (content) {
15920 result.content = content;
15921 }
15922 onAfterRead(result);
15923 });
15924 }
15925 };
15926 const onChange = (event) => {
15927 const {
15928 files
15929 } = event.target;
15930 if (props2.disabled || !files || !files.length) {
15931 return;
15932 }
15933 const file = files.length === 1 ? files[0] : [].slice.call(files);
15934 if (props2.beforeRead) {
15935 const response = props2.beforeRead(file, getDetail());
15936 if (!response) {
15937 resetInput();
15938 return;
15939 }
15940 if (isPromise(response)) {
15941 response.then((data) => {
15942 if (data) {
15943 readFile(data);
15944 } else {
15945 readFile(file);
15946 }
15947 }).catch(resetInput);
15948 return;
15949 }
15950 }
15951 readFile(file);
15952 };
15953 let imagePreview;
15954 const onClosePreview = () => emit("closePreview");
15955 const previewImage = (item) => {
15956 if (props2.previewFullImage) {
15957 const imageFiles = props2.modelValue.filter(isImageFile);
15958 const images = imageFiles.map((item2) => {
15959 if (item2.objectUrl && !item2.url && item2.status !== "failed") {
15960 item2.url = item2.objectUrl;
15961 urls.push(item2.url);
15962 }
15963 return item2.url;
15964 }).filter(Boolean);
15965 imagePreview = showImagePreview(extend({
15966 images,
15967 startPosition: imageFiles.indexOf(item),
15968 onClose: onClosePreview
15969 }, props2.previewOptions));
15970 }
15971 };
15972 const closeImagePreview = () => {
15973 if (imagePreview) {
15974 imagePreview.close();
15975 }
15976 };
15977 const deleteFile = (item, index) => {
15978 const fileList = props2.modelValue.slice(0);
15979 fileList.splice(index, 1);
15980 emit("update:modelValue", fileList);
15981 emit("delete", item, getDetail(index));
15982 };
15983 const reuploadFile = (index) => {
15984 isReuploading.value = true;
15985 reuploadIndex.value = index;
15986 nextTick(() => chooseFile());
15987 };
15988 const onInputClick = () => {
15989 if (!isReuploading.value) {
15990 reuploadIndex.value = -1;
15991 }
15992 isReuploading.value = false;
15993 };
15994 const renderPreviewItem = (item, index) => {
15995 const needPickData = ["imageFit", "deletable", "reupload", "previewSize", "beforeDelete"];
15996 const previewData = extend(pick(props2, needPickData), pick(item, needPickData, true));
15997 return createVNode(stdin_default$6, mergeProps({
15998 "item": item,
15999 "index": index,
16000 "onClick": () => emit(props2.reupload ? "clickReupload" : "clickPreview", item, getDetail(index)),
16001 "onDelete": () => deleteFile(item, index),
16002 "onPreview": () => previewImage(item),
16003 "onReupload": () => reuploadFile(index)
16004 }, pick(props2, ["name", "lazyLoad"]), previewData), pick(slots, ["preview-cover", "preview-delete"]));
16005 };
16006 const renderPreviewList = () => {
16007 if (props2.previewImage) {
16008 return props2.modelValue.map(renderPreviewItem);
16009 }
16010 };
16011 const onClickUpload = (event) => emit("clickUpload", event);
16012 const renderUpload = () => {
16013 const lessThanMax = props2.modelValue.length < +props2.maxCount;
16014 const Input = props2.readonly ? null : createVNode("input", {
16015 "ref": inputRef,
16016 "type": "file",
16017 "class": bem$1("input"),
16018 "accept": props2.accept,
16019 "capture": props2.capture,
16020 "multiple": props2.multiple && reuploadIndex.value === -1,
16021 "disabled": props2.disabled,
16022 "onChange": onChange,
16023 "onClick": onInputClick
16024 }, null);
16025 if (slots.default) {
16026 return withDirectives(createVNode("div", {
16027 "class": bem$1("input-wrapper"),
16028 "onClick": onClickUpload
16029 }, [slots.default(), Input]), [[vShow, lessThanMax]]);
16030 }
16031 return withDirectives(createVNode("div", {
16032 "class": bem$1("upload", {
16033 readonly: props2.readonly
16034 }),
16035 "style": getSizeStyle(props2.previewSize),
16036 "onClick": onClickUpload
16037 }, [createVNode(Icon, {
16038 "name": props2.uploadIcon,
16039 "class": bem$1("upload-icon")
16040 }, null), props2.uploadText && createVNode("span", {
16041 "class": bem$1("upload-text")
16042 }, [props2.uploadText]), Input]), [[vShow, props2.showUpload && lessThanMax]]);
16043 };
16044 const chooseFile = () => {
16045 if (inputRef.value && !props2.disabled) {
16046 inputRef.value.click();
16047 }
16048 };
16049 onBeforeUnmount(() => {
16050 urls.forEach((url) => URL.revokeObjectURL(url));
16051 });
16052 useExpose({
16053 chooseFile,
16054 reuploadFile,
16055 closeImagePreview
16056 });
16057 useCustomFieldValue(() => props2.modelValue);
16058 return () => createVNode("div", {
16059 "class": bem$1()
16060 }, [createVNode("div", {
16061 "class": bem$1("wrapper", {
16062 disabled: props2.disabled
16063 })
16064 }, [renderPreviewList(), renderUpload()])]);
16065 }
16066});
16067const Uploader = withInstall(stdin_default$5);
16068const [name, bem] = createNamespace("watermark");
16069const watermarkProps = {
16070 gapX: makeNumberProp(0),
16071 gapY: makeNumberProp(0),
16072 image: String,
16073 width: makeNumberProp(100),
16074 height: makeNumberProp(100),
16075 rotate: makeNumericProp(-22),
16076 zIndex: numericProp,
16077 content: String,
16078 opacity: numericProp,
16079 fullPage: truthProp,
16080 textColor: makeStringProp("#dcdee0")
16081};
16082var stdin_default$4 = defineComponent({
16083 name,
16084 props: watermarkProps,
16085 setup(props2, {
16086 slots
16087 }) {
16088 const svgElRef = ref();
16089 const watermarkUrl = ref("");
16090 const imageBase64 = ref("");
16091 const renderWatermark = () => {
16092 const rotateStyle = {
16093 transformOrigin: "center",
16094 transform: `rotate(${props2.rotate}deg)`
16095 };
16096 const svgInner = () => {
16097 if (props2.image && !slots.content) {
16098 return createVNode("image", {
16099 "href": imageBase64.value,
16100 "xlink:href": imageBase64.value,
16101 "x": "0",
16102 "y": "0",
16103 "width": props2.width,
16104 "height": props2.height,
16105 "style": rotateStyle
16106 }, null);
16107 }
16108 return createVNode("foreignObject", {
16109 "x": "0",
16110 "y": "0",
16111 "width": props2.width,
16112 "height": props2.height
16113 }, [createVNode("div", {
16114 "xmlns": "http://www.w3.org/1999/xhtml",
16115 "style": rotateStyle
16116 }, [slots.content ? slots.content() : createVNode("span", {
16117 "style": {
16118 color: props2.textColor
16119 }
16120 }, [props2.content])])]);
16121 };
16122 const svgWidth = props2.width + props2.gapX;
16123 const svgHeight = props2.height + props2.gapY;
16124 return createVNode("svg", {
16125 "viewBox": `0 0 ${svgWidth} ${svgHeight}`,
16126 "width": svgWidth,
16127 "height": svgHeight,
16128 "xmlns": "http://www.w3.org/2000/svg",
16129 "xmlns:xlink": "http://www.w3.org/1999/xlink",
16130 "style": {
16131 padding: `0 ${props2.gapX}px ${props2.gapY}px 0`,
16132 opacity: props2.opacity
16133 }
16134 }, [svgInner()]);
16135 };
16136 const makeImageToBase64 = (url) => {
16137 const canvas = document.createElement("canvas");
16138 const image = new Image();
16139 image.crossOrigin = "anonymous";
16140 image.referrerPolicy = "no-referrer";
16141 image.onload = () => {
16142 canvas.width = image.naturalWidth;
16143 canvas.height = image.naturalHeight;
16144 const ctx = canvas.getContext("2d");
16145 ctx == null ? void 0 : ctx.drawImage(image, 0, 0);
16146 imageBase64.value = canvas.toDataURL();
16147 };
16148 image.src = url;
16149 };
16150 const makeSvgToBlobUrl = (svgStr) => {
16151 const svgBlob = new Blob([svgStr], {
16152 type: "image/svg+xml"
16153 });
16154 return URL.createObjectURL(svgBlob);
16155 };
16156 watchEffect(() => {
16157 if (props2.image) {
16158 makeImageToBase64(props2.image);
16159 }
16160 });
16161 watch(() => [imageBase64.value, props2.content, props2.textColor, props2.height, props2.width, props2.rotate, props2.gapX, props2.gapY], () => {
16162 nextTick(() => {
16163 if (svgElRef.value) {
16164 if (watermarkUrl.value) {
16165 URL.revokeObjectURL(watermarkUrl.value);
16166 }
16167 watermarkUrl.value = makeSvgToBlobUrl(svgElRef.value.innerHTML);
16168 }
16169 });
16170 }, {
16171 immediate: true
16172 });
16173 onUnmounted(() => {
16174 if (watermarkUrl.value) {
16175 URL.revokeObjectURL(watermarkUrl.value);
16176 }
16177 });
16178 return () => {
16179 const style = extend({
16180 backgroundImage: `url(${watermarkUrl.value})`
16181 }, getZIndexStyle(props2.zIndex));
16182 return createVNode("div", {
16183 "class": bem({
16184 full: props2.fullPage
16185 }),
16186 "style": style
16187 }, [createVNode("div", {
16188 "class": bem("wrapper"),
16189 "ref": svgElRef
16190 }, [renderWatermark()])]);
16191 };
16192 }
16193});
16194const Watermark = withInstall(stdin_default$4);
16195class ReactiveListener {
16196 constructor({
16197 el,
16198 src,
16199 error,
16200 loading,
16201 bindType,
16202 $parent,
16203 options,
16204 cors,
16205 elRenderer,
16206 imageCache
16207 }) {
16208 this.el = el;
16209 this.src = src;
16210 this.error = error;
16211 this.loading = loading;
16212 this.bindType = bindType;
16213 this.attempt = 0;
16214 this.cors = cors;
16215 this.naturalHeight = 0;
16216 this.naturalWidth = 0;
16217 this.options = options;
16218 this.$parent = $parent;
16219 this.elRenderer = elRenderer;
16220 this.imageCache = imageCache;
16221 this.performanceData = {
16222 loadStart: 0,
16223 loadEnd: 0
16224 };
16225 this.filter();
16226 this.initState();
16227 this.render("loading", false);
16228 }
16229 /*
16230 * init listener state
16231 * @return
16232 */
16233 initState() {
16234 if ("dataset" in this.el) {
16235 this.el.dataset.src = this.src;
16236 } else {
16237 this.el.setAttribute("data-src", this.src);
16238 }
16239 this.state = {
16240 loading: false,
16241 error: false,
16242 loaded: false,
16243 rendered: false
16244 };
16245 }
16246 /*
16247 * record performance
16248 * @return
16249 */
16250 record(event) {
16251 this.performanceData[event] = Date.now();
16252 }
16253 /*
16254 * update image listener data
16255 * @param {String} image uri
16256 * @param {String} loading image uri
16257 * @param {String} error image uri
16258 * @return
16259 */
16260 update({ src, loading, error }) {
16261 const oldSrc = this.src;
16262 this.src = src;
16263 this.loading = loading;
16264 this.error = error;
16265 this.filter();
16266 if (oldSrc !== this.src) {
16267 this.attempt = 0;
16268 this.initState();
16269 }
16270 }
16271 /*
16272 * check el is in view
16273 * @return {Boolean} el is in view
16274 */
16275 checkInView() {
16276 const rect = useRect(this.el);
16277 return rect.top < window.innerHeight * this.options.preLoad && rect.bottom > this.options.preLoadTop && rect.left < window.innerWidth * this.options.preLoad && rect.right > 0;
16278 }
16279 /*
16280 * listener filter
16281 */
16282 filter() {
16283 Object.keys(this.options.filter).forEach((key) => {
16284 this.options.filter[key](this, this.options);
16285 });
16286 }
16287 /*
16288 * render loading first
16289 * @params cb:Function
16290 * @return
16291 */
16292 renderLoading(cb) {
16293 this.state.loading = true;
16294 loadImageAsync(
16295 {
16296 src: this.loading,
16297 cors: this.cors
16298 },
16299 () => {
16300 this.render("loading", false);
16301 this.state.loading = false;
16302 cb();
16303 },
16304 () => {
16305 cb();
16306 this.state.loading = false;
16307 if (process.env.NODE_ENV !== "production" && !this.options.silent)
16308 console.warn(
16309 `[@vant/lazyload] load failed with loading image(${this.loading})`
16310 );
16311 }
16312 );
16313 }
16314 /*
16315 * try load image and render it
16316 * @return
16317 */
16318 load(onFinish = noop) {
16319 if (this.attempt > this.options.attempt - 1 && this.state.error) {
16320 if (process.env.NODE_ENV !== "production" && !this.options.silent) {
16321 console.log(
16322 `[@vant/lazyload] ${this.src} tried too more than ${this.options.attempt} times`
16323 );
16324 }
16325 onFinish();
16326 return;
16327 }
16328 if (this.state.rendered && this.state.loaded) return;
16329 if (this.imageCache.has(this.src)) {
16330 this.state.loaded = true;
16331 this.render("loaded", true);
16332 this.state.rendered = true;
16333 return onFinish();
16334 }
16335 this.renderLoading(() => {
16336 var _a, _b;
16337 this.attempt++;
16338 (_b = (_a = this.options.adapter).beforeLoad) == null ? void 0 : _b.call(_a, this, this.options);
16339 this.record("loadStart");
16340 loadImageAsync(
16341 {
16342 src: this.src,
16343 cors: this.cors
16344 },
16345 (data) => {
16346 this.naturalHeight = data.naturalHeight;
16347 this.naturalWidth = data.naturalWidth;
16348 this.state.loaded = true;
16349 this.state.error = false;
16350 this.record("loadEnd");
16351 this.render("loaded", false);
16352 this.state.rendered = true;
16353 this.imageCache.add(this.src);
16354 onFinish();
16355 },
16356 (err) => {
16357 !this.options.silent && console.error(err);
16358 this.state.error = true;
16359 this.state.loaded = false;
16360 this.render("error", false);
16361 }
16362 );
16363 });
16364 }
16365 /*
16366 * render image
16367 * @param {String} state to render // ['loading', 'src', 'error']
16368 * @param {String} is form cache
16369 * @return
16370 */
16371 render(state, cache) {
16372 this.elRenderer(this, state, cache);
16373 }
16374 /*
16375 * output performance data
16376 * @return {Object} performance data
16377 */
16378 performance() {
16379 let state = "loading";
16380 let time = 0;
16381 if (this.state.loaded) {
16382 state = "loaded";
16383 time = (this.performanceData.loadEnd - this.performanceData.loadStart) / 1e3;
16384 }
16385 if (this.state.error) state = "error";
16386 return {
16387 src: this.src,
16388 state,
16389 time
16390 };
16391 }
16392 /*
16393 * $destroy
16394 * @return
16395 */
16396 $destroy() {
16397 this.el = null;
16398 this.src = null;
16399 this.error = null;
16400 this.loading = null;
16401 this.bindType = null;
16402 this.attempt = 0;
16403 }
16404}
16405const DEFAULT_URL = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
16406const DEFAULT_EVENTS = [
16407 "scroll",
16408 "wheel",
16409 "mousewheel",
16410 "resize",
16411 "animationend",
16412 "transitionend",
16413 "touchmove"
16414];
16415const DEFAULT_OBSERVER_OPTIONS = {
16416 rootMargin: "0px",
16417 threshold: 0
16418};
16419function stdin_default$3() {
16420 return class Lazy {
16421 constructor({
16422 preLoad,
16423 error,
16424 throttleWait,
16425 preLoadTop,
16426 dispatchEvent,
16427 loading,
16428 attempt,
16429 silent = true,
16430 scale,
16431 listenEvents,
16432 filter,
16433 adapter,
16434 observer,
16435 observerOptions
16436 }) {
16437 this.mode = modeType.event;
16438 this.listeners = [];
16439 this.targetIndex = 0;
16440 this.targets = [];
16441 this.options = {
16442 silent,
16443 dispatchEvent: !!dispatchEvent,
16444 throttleWait: throttleWait || 200,
16445 preLoad: preLoad || 1.3,
16446 preLoadTop: preLoadTop || 0,
16447 error: error || DEFAULT_URL,
16448 loading: loading || DEFAULT_URL,
16449 attempt: attempt || 3,
16450 scale: scale || getDPR(scale),
16451 ListenEvents: listenEvents || DEFAULT_EVENTS,
16452 supportWebp: supportWebp(),
16453 filter: filter || {},
16454 adapter: adapter || {},
16455 observer: !!observer,
16456 observerOptions: observerOptions || DEFAULT_OBSERVER_OPTIONS
16457 };
16458 this.initEvent();
16459 this.imageCache = new ImageCache({ max: 200 });
16460 this.lazyLoadHandler = throttle(
16461 this.lazyLoadHandler.bind(this),
16462 this.options.throttleWait
16463 );
16464 this.setMode(this.options.observer ? modeType.observer : modeType.event);
16465 }
16466 /**
16467 * update config
16468 * @param {Object} config params
16469 * @return
16470 */
16471 config(options = {}) {
16472 Object.assign(this.options, options);
16473 }
16474 /**
16475 * output listener's load performance
16476 * @return {Array}
16477 */
16478 performance() {
16479 return this.listeners.map((item) => item.performance());
16480 }
16481 /*
16482 * add lazy component to queue
16483 * @param {Vue} vm lazy component instance
16484 * @return
16485 */
16486 addLazyBox(vm) {
16487 this.listeners.push(vm);
16488 if (inBrowser$1) {
16489 this.addListenerTarget(window);
16490 this.observer && this.observer.observe(vm.el);
16491 if (vm.$el && vm.$el.parentNode) {
16492 this.addListenerTarget(vm.$el.parentNode);
16493 }
16494 }
16495 }
16496 /*
16497 * add image listener to queue
16498 * @param {DOM} el
16499 * @param {object} binding vue directive binding
16500 * @param {vnode} vnode vue directive vnode
16501 * @return
16502 */
16503 add(el, binding, vnode) {
16504 if (this.listeners.some((item) => item.el === el)) {
16505 this.update(el, binding);
16506 return nextTick(this.lazyLoadHandler);
16507 }
16508 const value = this.valueFormatter(binding.value);
16509 let { src } = value;
16510 nextTick(() => {
16511 src = getBestSelectionFromSrcset(el, this.options.scale) || src;
16512 this.observer && this.observer.observe(el);
16513 const container = Object.keys(binding.modifiers)[0];
16514 let $parent;
16515 if (container) {
16516 $parent = vnode.context.$refs[container];
16517 $parent = $parent ? $parent.$el || $parent : document.getElementById(container);
16518 }
16519 if (!$parent) {
16520 $parent = getScrollParent(el);
16521 }
16522 const newListener = new ReactiveListener({
16523 bindType: binding.arg,
16524 $parent,
16525 el,
16526 src,
16527 loading: value.loading,
16528 error: value.error,
16529 cors: value.cors,
16530 elRenderer: this.elRenderer.bind(this),
16531 options: this.options,
16532 imageCache: this.imageCache
16533 });
16534 this.listeners.push(newListener);
16535 if (inBrowser$1) {
16536 this.addListenerTarget(window);
16537 this.addListenerTarget($parent);
16538 }
16539 this.lazyLoadHandler();
16540 nextTick(() => this.lazyLoadHandler());
16541 });
16542 }
16543 /**
16544 * update image src
16545 * @param {DOM} el
16546 * @param {object} vue directive binding
16547 * @return
16548 */
16549 update(el, binding, vnode) {
16550 const value = this.valueFormatter(binding.value);
16551 let { src } = value;
16552 src = getBestSelectionFromSrcset(el, this.options.scale) || src;
16553 const exist = this.listeners.find((item) => item.el === el);
16554 if (!exist) {
16555 this.add(el, binding, vnode);
16556 } else {
16557 exist.update({
16558 src,
16559 error: value.error,
16560 loading: value.loading
16561 });
16562 }
16563 if (this.observer) {
16564 this.observer.unobserve(el);
16565 this.observer.observe(el);
16566 }
16567 this.lazyLoadHandler();
16568 nextTick(() => this.lazyLoadHandler());
16569 }
16570 /**
16571 * remove listener form list
16572 * @param {DOM} el
16573 * @return
16574 */
16575 remove(el) {
16576 if (!el) return;
16577 this.observer && this.observer.unobserve(el);
16578 const existItem = this.listeners.find((item) => item.el === el);
16579 if (existItem) {
16580 this.removeListenerTarget(existItem.$parent);
16581 this.removeListenerTarget(window);
16582 remove(this.listeners, existItem);
16583 existItem.$destroy();
16584 }
16585 }
16586 /*
16587 * remove lazy components form list
16588 * @param {Vue} vm Vue instance
16589 * @return
16590 */
16591 removeComponent(vm) {
16592 if (!vm) return;
16593 remove(this.listeners, vm);
16594 this.observer && this.observer.unobserve(vm.el);
16595 if (vm.$parent && vm.$el.parentNode) {
16596 this.removeListenerTarget(vm.$el.parentNode);
16597 }
16598 this.removeListenerTarget(window);
16599 }
16600 setMode(mode) {
16601 if (!hasIntersectionObserver && mode === modeType.observer) {
16602 mode = modeType.event;
16603 }
16604 this.mode = mode;
16605 if (mode === modeType.event) {
16606 if (this.observer) {
16607 this.listeners.forEach((listener) => {
16608 this.observer.unobserve(listener.el);
16609 });
16610 this.observer = null;
16611 }
16612 this.targets.forEach((target) => {
16613 this.initListen(target.el, true);
16614 });
16615 } else {
16616 this.targets.forEach((target) => {
16617 this.initListen(target.el, false);
16618 });
16619 this.initIntersectionObserver();
16620 }
16621 }
16622 /*
16623 *** Private functions ***
16624 */
16625 /*
16626 * add listener target
16627 * @param {DOM} el listener target
16628 * @return
16629 */
16630 addListenerTarget(el) {
16631 if (!el) return;
16632 let target = this.targets.find((target2) => target2.el === el);
16633 if (!target) {
16634 target = {
16635 el,
16636 id: ++this.targetIndex,
16637 childrenCount: 1,
16638 listened: true
16639 };
16640 this.mode === modeType.event && this.initListen(target.el, true);
16641 this.targets.push(target);
16642 } else {
16643 target.childrenCount++;
16644 }
16645 return this.targetIndex;
16646 }
16647 /*
16648 * remove listener target or reduce target childrenCount
16649 * @param {DOM} el or window
16650 * @return
16651 */
16652 removeListenerTarget(el) {
16653 this.targets.forEach((target, index) => {
16654 if (target.el === el) {
16655 target.childrenCount--;
16656 if (!target.childrenCount) {
16657 this.initListen(target.el, false);
16658 this.targets.splice(index, 1);
16659 target = null;
16660 }
16661 }
16662 });
16663 }
16664 /*
16665 * add or remove eventlistener
16666 * @param {DOM} el DOM or Window
16667 * @param {boolean} start flag
16668 * @return
16669 */
16670 initListen(el, start) {
16671 this.options.ListenEvents.forEach(
16672 (evt) => (start ? on : off)(el, evt, this.lazyLoadHandler)
16673 );
16674 }
16675 initEvent() {
16676 this.Event = {
16677 listeners: {
16678 loading: [],
16679 loaded: [],
16680 error: []
16681 }
16682 };
16683 this.$on = (event, func) => {
16684 if (!this.Event.listeners[event]) this.Event.listeners[event] = [];
16685 this.Event.listeners[event].push(func);
16686 };
16687 this.$once = (event, func) => {
16688 const on2 = (...args) => {
16689 this.$off(event, on2);
16690 func.apply(this, args);
16691 };
16692 this.$on(event, on2);
16693 };
16694 this.$off = (event, func) => {
16695 if (!func) {
16696 if (!this.Event.listeners[event]) return;
16697 this.Event.listeners[event].length = 0;
16698 return;
16699 }
16700 remove(this.Event.listeners[event], func);
16701 };
16702 this.$emit = (event, context, inCache) => {
16703 if (!this.Event.listeners[event]) return;
16704 this.Event.listeners[event].forEach((func) => func(context, inCache));
16705 };
16706 }
16707 /**
16708 * find nodes which in viewport and trigger load
16709 * @return
16710 */
16711 lazyLoadHandler() {
16712 const freeList = [];
16713 this.listeners.forEach((listener) => {
16714 if (!listener.el || !listener.el.parentNode) {
16715 freeList.push(listener);
16716 }
16717 const catIn = listener.checkInView();
16718 if (!catIn) return;
16719 listener.load();
16720 });
16721 freeList.forEach((item) => {
16722 remove(this.listeners, item);
16723 item.$destroy();
16724 });
16725 }
16726 /**
16727 * init IntersectionObserver
16728 * set mode to observer
16729 * @return
16730 */
16731 initIntersectionObserver() {
16732 if (!hasIntersectionObserver) {
16733 return;
16734 }
16735 this.observer = new IntersectionObserver(
16736 this.observerHandler.bind(this),
16737 this.options.observerOptions
16738 );
16739 if (this.listeners.length) {
16740 this.listeners.forEach((listener) => {
16741 this.observer.observe(listener.el);
16742 });
16743 }
16744 }
16745 /**
16746 * init IntersectionObserver
16747 * @return
16748 */
16749 observerHandler(entries) {
16750 entries.forEach((entry) => {
16751 if (entry.isIntersecting) {
16752 this.listeners.forEach((listener) => {
16753 if (listener.el === entry.target) {
16754 if (listener.state.loaded)
16755 return this.observer.unobserve(listener.el);
16756 listener.load();
16757 }
16758 });
16759 }
16760 });
16761 }
16762 /**
16763 * set element attribute with image'url and state
16764 * @param {object} lazyload listener object
16765 * @param {string} state will be rendered
16766 * @param {bool} inCache is rendered from cache
16767 * @return
16768 */
16769 elRenderer(listener, state, cache) {
16770 if (!listener.el) return;
16771 const { el, bindType } = listener;
16772 let src;
16773 switch (state) {
16774 case "loading":
16775 src = listener.loading;
16776 break;
16777 case "error":
16778 src = listener.error;
16779 break;
16780 default:
16781 ({ src } = listener);
16782 break;
16783 }
16784 if (bindType) {
16785 el.style[bindType] = 'url("' + src + '")';
16786 } else if (el.getAttribute("src") !== src) {
16787 el.setAttribute("src", src);
16788 }
16789 el.setAttribute("lazy", state);
16790 this.$emit(state, listener, cache);
16791 this.options.adapter[state] && this.options.adapter[state](listener, this.options);
16792 if (this.options.dispatchEvent) {
16793 const event = new CustomEvent(state, {
16794 detail: listener
16795 });
16796 el.dispatchEvent(event);
16797 }
16798 }
16799 /**
16800 * generate loading loaded error image url
16801 * @param {string} image's src
16802 * @return {object} image's loading, loaded, error url
16803 */
16804 valueFormatter(value) {
16805 let src = value;
16806 let { loading, error } = this.options;
16807 if (isObject(value)) {
16808 if (process.env.NODE_ENV !== "production" && !value.src && !this.options.silent) {
16809 console.error("[@vant/lazyload] miss src with " + value);
16810 }
16811 ({ src } = value);
16812 loading = value.loading || this.options.loading;
16813 error = value.error || this.options.error;
16814 }
16815 return {
16816 src,
16817 loading,
16818 error
16819 };
16820 }
16821 };
16822}
16823var stdin_default$2 = (lazy) => ({
16824 props: {
16825 tag: {
16826 type: String,
16827 default: "div"
16828 }
16829 },
16830 emits: ["show"],
16831 render() {
16832 return h(
16833 this.tag,
16834 this.show && this.$slots.default ? this.$slots.default() : null
16835 );
16836 },
16837 data() {
16838 return {
16839 el: null,
16840 state: {
16841 loaded: false
16842 },
16843 show: false
16844 };
16845 },
16846 mounted() {
16847 this.el = this.$el;
16848 lazy.addLazyBox(this);
16849 lazy.lazyLoadHandler();
16850 },
16851 beforeUnmount() {
16852 lazy.removeComponent(this);
16853 },
16854 methods: {
16855 checkInView() {
16856 const rect = useRect(this.$el);
16857 return inBrowser$1 && rect.top < window.innerHeight * lazy.options.preLoad && rect.bottom > 0 && rect.left < window.innerWidth * lazy.options.preLoad && rect.right > 0;
16858 },
16859 load() {
16860 this.show = true;
16861 this.state.loaded = true;
16862 this.$emit("show", this);
16863 },
16864 destroy() {
16865 return this.$destroy;
16866 }
16867 }
16868});
16869const defaultOptions = {
16870 selector: "img"
16871};
16872class LazyContainer {
16873 constructor({ el, binding, vnode, lazy }) {
16874 this.el = null;
16875 this.vnode = vnode;
16876 this.binding = binding;
16877 this.options = {};
16878 this.lazy = lazy;
16879 this.queue = [];
16880 this.update({ el, binding });
16881 }
16882 update({ el, binding }) {
16883 this.el = el;
16884 this.options = Object.assign({}, defaultOptions, binding.value);
16885 const imgs = this.getImgs();
16886 imgs.forEach((el2) => {
16887 this.lazy.add(
16888 el2,
16889 Object.assign({}, this.binding, {
16890 value: {
16891 src: "dataset" in el2 ? el2.dataset.src : el2.getAttribute("data-src"),
16892 error: ("dataset" in el2 ? el2.dataset.error : el2.getAttribute("data-error")) || this.options.error,
16893 loading: ("dataset" in el2 ? el2.dataset.loading : el2.getAttribute("data-loading")) || this.options.loading
16894 }
16895 }),
16896 this.vnode
16897 );
16898 });
16899 }
16900 getImgs() {
16901 return Array.from(this.el.querySelectorAll(this.options.selector));
16902 }
16903 clear() {
16904 const imgs = this.getImgs();
16905 imgs.forEach((el) => this.lazy.remove(el));
16906 this.vnode = null;
16907 this.binding = null;
16908 this.lazy = null;
16909 }
16910}
16911class LazyContainerManager {
16912 constructor({ lazy }) {
16913 this.lazy = lazy;
16914 this.queue = [];
16915 }
16916 bind(el, binding, vnode) {
16917 const container = new LazyContainer({
16918 el,
16919 binding,
16920 vnode,
16921 lazy: this.lazy
16922 });
16923 this.queue.push(container);
16924 }
16925 update(el, binding, vnode) {
16926 const container = this.queue.find((item) => item.el === el);
16927 if (!container) return;
16928 container.update({ el, binding, vnode });
16929 }
16930 unbind(el) {
16931 const container = this.queue.find((item) => item.el === el);
16932 if (!container) return;
16933 container.clear();
16934 remove(this.queue, container);
16935 }
16936}
16937var stdin_default$1 = (lazyManager) => ({
16938 props: {
16939 src: [String, Object],
16940 tag: {
16941 type: String,
16942 default: "img"
16943 }
16944 },
16945 render() {
16946 var _a, _b;
16947 return h(
16948 this.tag,
16949 {
16950 src: this.renderSrc
16951 },
16952 (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)
16953 );
16954 },
16955 data() {
16956 return {
16957 el: null,
16958 options: {
16959 src: "",
16960 error: "",
16961 loading: "",
16962 attempt: lazyManager.options.attempt
16963 },
16964 state: {
16965 loaded: false,
16966 error: false,
16967 attempt: 0
16968 },
16969 renderSrc: ""
16970 };
16971 },
16972 watch: {
16973 src() {
16974 this.init();
16975 lazyManager.addLazyBox(this);
16976 lazyManager.lazyLoadHandler();
16977 }
16978 },
16979 created() {
16980 this.init();
16981 },
16982 mounted() {
16983 this.el = this.$el;
16984 lazyManager.addLazyBox(this);
16985 lazyManager.lazyLoadHandler();
16986 },
16987 beforeUnmount() {
16988 lazyManager.removeComponent(this);
16989 },
16990 methods: {
16991 init() {
16992 const { src, loading, error } = lazyManager.valueFormatter(this.src);
16993 this.state.loaded = false;
16994 this.options.src = src;
16995 this.options.error = error;
16996 this.options.loading = loading;
16997 this.renderSrc = this.options.loading;
16998 },
16999 checkInView() {
17000 const rect = useRect(this.$el);
17001 return rect.top < window.innerHeight * lazyManager.options.preLoad && rect.bottom > 0 && rect.left < window.innerWidth * lazyManager.options.preLoad && rect.right > 0;
17002 },
17003 load(onFinish = noop) {
17004 if (this.state.attempt > this.options.attempt - 1 && this.state.error) {
17005 if (process.env.NODE_ENV !== "production" && !lazyManager.options.silent) {
17006 console.log(
17007 `[@vant/lazyload] ${this.options.src} tried too more than ${this.options.attempt} times`
17008 );
17009 }
17010 onFinish();
17011 return;
17012 }
17013 const { src } = this.options;
17014 loadImageAsync(
17015 { src },
17016 ({ src: src2 }) => {
17017 this.renderSrc = src2;
17018 this.state.loaded = true;
17019 },
17020 () => {
17021 this.state.attempt++;
17022 this.renderSrc = this.options.error;
17023 this.state.error = true;
17024 }
17025 );
17026 }
17027 }
17028});
17029const Lazyload = {
17030 /*
17031 * install function
17032 * @param {App} app
17033 * @param {object} options lazyload options
17034 */
17035 install(app, options = {}) {
17036 const LazyClass = stdin_default$3();
17037 const lazy = new LazyClass(options);
17038 const lazyContainer = new LazyContainerManager({ lazy });
17039 app.config.globalProperties.$Lazyload = lazy;
17040 if (options.lazyComponent) {
17041 app.component("LazyComponent", stdin_default$2(lazy));
17042 }
17043 if (options.lazyImage) {
17044 app.component("LazyImage", stdin_default$1(lazy));
17045 }
17046 app.directive("lazy", {
17047 beforeMount: lazy.add.bind(lazy),
17048 updated: lazy.update.bind(lazy),
17049 unmounted: lazy.remove.bind(lazy)
17050 });
17051 app.directive("lazy-container", {
17052 beforeMount: lazyContainer.bind.bind(lazyContainer),
17053 updated: lazyContainer.update.bind(lazyContainer),
17054 unmounted: lazyContainer.unbind.bind(lazyContainer)
17055 });
17056 }
17057};
17058const version = "4.9.8";
17059function install(app) {
17060 const components = [
17061 ActionBar,
17062 ActionBarButton,
17063 ActionBarIcon,
17064 ActionSheet,
17065 AddressEdit,
17066 AddressList,
17067 Area,
17068 BackTop,
17069 Badge,
17070 Barrage,
17071 Button,
17072 Calendar,
17073 Card,
17074 Cascader,
17075 Cell,
17076 CellGroup,
17077 Checkbox,
17078 CheckboxGroup,
17079 Circle,
17080 Col,
17081 Collapse,
17082 CollapseItem,
17083 ConfigProvider,
17084 ContactCard,
17085 ContactEdit,
17086 ContactList,
17087 CountDown,
17088 Coupon,
17089 CouponCell,
17090 CouponList,
17091 DatePicker,
17092 Dialog,
17093 Divider,
17094 DropdownItem,
17095 DropdownMenu,
17096 Empty,
17097 Field,
17098 FloatingBubble,
17099 FloatingPanel,
17100 Form,
17101 Grid,
17102 GridItem,
17103 Highlight,
17104 Icon,
17105 Image$1,
17106 ImagePreview,
17107 IndexAnchor,
17108 IndexBar,
17109 List,
17110 Loading,
17111 Locale,
17112 NavBar,
17113 NoticeBar,
17114 Notify,
17115 NumberKeyboard,
17116 Overlay,
17117 Pagination,
17118 PasswordInput,
17119 Picker,
17120 PickerGroup,
17121 Popover,
17122 Popup,
17123 Progress,
17124 PullRefresh,
17125 Radio,
17126 RadioGroup,
17127 Rate,
17128 RollingText,
17129 Row,
17130 Search,
17131 ShareSheet,
17132 Sidebar,
17133 SidebarItem,
17134 Signature,
17135 Skeleton,
17136 SkeletonAvatar,
17137 SkeletonImage,
17138 SkeletonParagraph,
17139 SkeletonTitle,
17140 Slider,
17141 Space,
17142 Step,
17143 Stepper,
17144 Steps,
17145 Sticky,
17146 SubmitBar,
17147 Swipe,
17148 SwipeCell,
17149 SwipeItem,
17150 Switch,
17151 Tab,
17152 Tabbar,
17153 TabbarItem,
17154 Tabs,
17155 Tag,
17156 TextEllipsis,
17157 TimePicker,
17158 Toast,
17159 TreeSelect,
17160 Uploader,
17161 Watermark
17162 ];
17163 components.forEach((item) => {
17164 if (item.install) {
17165 app.use(item);
17166 } else if (item.name) {
17167 app.component(item.name, item);
17168 }
17169 });
17170}
17171var stdin_default = {
17172 install,
17173 version
17174};
17175export {
17176 ActionBar,
17177 ActionBarButton,
17178 ActionBarIcon,
17179 ActionSheet,
17180 AddressEdit,
17181 AddressList,
17182 Area,
17183 BackTop,
17184 Badge,
17185 Barrage,
17186 Button,
17187 Calendar,
17188 Card,
17189 Cascader,
17190 Cell,
17191 CellGroup,
17192 Checkbox,
17193 CheckboxGroup,
17194 Circle,
17195 Col,
17196 Collapse,
17197 CollapseItem,
17198 ConfigProvider,
17199 ContactCard,
17200 ContactEdit,
17201 ContactList,
17202 CountDown,
17203 Coupon,
17204 CouponCell,
17205 CouponList,
17206 DEFAULT_ROW_WIDTH,
17207 DatePicker,
17208 Dialog,
17209 Divider,
17210 DropdownItem,
17211 DropdownMenu,
17212 Empty,
17213 Field,
17214 FloatingBubble,
17215 FloatingPanel,
17216 Form,
17217 Grid,
17218 GridItem,
17219 Highlight,
17220 Icon,
17221 Image$1 as Image,
17222 ImagePreview,
17223 IndexAnchor,
17224 IndexBar,
17225 Lazyload,
17226 List,
17227 Loading,
17228 Locale,
17229 NavBar,
17230 NoticeBar,
17231 Notify,
17232 NumberKeyboard,
17233 Overlay,
17234 Pagination,
17235 PasswordInput,
17236 Picker,
17237 PickerGroup,
17238 Popover,
17239 Popup,
17240 Progress,
17241 PullRefresh,
17242 Radio,
17243 RadioGroup,
17244 Rate,
17245 RollingText,
17246 Row,
17247 Search,
17248 ShareSheet,
17249 Sidebar,
17250 SidebarItem,
17251 Signature,
17252 Skeleton,
17253 SkeletonAvatar,
17254 SkeletonImage,
17255 SkeletonParagraph,
17256 SkeletonTitle,
17257 Slider,
17258 Space,
17259 Step,
17260 Stepper,
17261 Steps,
17262 Sticky,
17263 SubmitBar,
17264 Swipe,
17265 SwipeCell,
17266 SwipeItem,
17267 Switch,
17268 Tab,
17269 Tabbar,
17270 TabbarItem,
17271 Tabs,
17272 Tag,
17273 TextEllipsis,
17274 TimePicker,
17275 Toast,
17276 TreeSelect,
17277 Uploader,
17278 Watermark,
17279 actionBarButtonProps,
17280 actionBarIconProps,
17281 actionBarProps,
17282 actionSheetProps,
17283 addressEditProps,
17284 addressListProps,
17285 allowMultipleToast,
17286 areaProps,
17287 backTopProps,
17288 badgeProps,
17289 barrageProps,
17290 buttonProps,
17291 calendarProps,
17292 cardProps,
17293 cascaderProps,
17294 cellGroupProps,
17295 cellProps,
17296 checkboxGroupProps,
17297 checkboxProps,
17298 circleProps,
17299 closeDialog,
17300 closeNotify,
17301 closeToast,
17302 colProps,
17303 collapseItemProps,
17304 collapseProps,
17305 configProviderProps,
17306 contactCardProps,
17307 contactEditProps,
17308 contactListProps,
17309 countDownProps,
17310 couponCellProps,
17311 couponListProps,
17312 datePickerProps,
17313 stdin_default as default,
17314 dialogProps,
17315 dividerProps,
17316 dropdownItemProps,
17317 dropdownMenuProps,
17318 emptyProps,
17319 fieldProps,
17320 floatingBubbleProps,
17321 floatingPanelProps,
17322 formProps,
17323 gridItemProps,
17324 gridProps,
17325 highlightProps,
17326 iconProps,
17327 imagePreviewProps,
17328 imageProps,
17329 indexAnchorProps,
17330 indexBarProps,
17331 install,
17332 listProps,
17333 loadingProps,
17334 navBarProps,
17335 noticeBarProps,
17336 notifyProps,
17337 numberKeyboardProps,
17338 overlayProps,
17339 paginationProps,
17340 passwordInputProps,
17341 pickerGroupProps,
17342 pickerProps,
17343 popoverProps,
17344 popupProps$2 as popupProps,
17345 progressProps,
17346 pullRefreshProps,
17347 radioGroupProps,
17348 radioProps,
17349 rateProps,
17350 resetDialogDefaultOptions,
17351 resetNotifyDefaultOptions,
17352 resetToastDefaultOptions,
17353 rollingTextProps,
17354 rowProps,
17355 searchProps,
17356 setDialogDefaultOptions,
17357 setNotifyDefaultOptions,
17358 setToastDefaultOptions,
17359 shareSheetProps,
17360 showConfirmDialog,
17361 showDialog,
17362 showFailToast,
17363 showImagePreview,
17364 showLoadingToast,
17365 showNotify,
17366 showSuccessToast,
17367 showToast,
17368 sidebarItemProps,
17369 sidebarProps,
17370 skeletonAvatarProps,
17371 skeletonImageProps,
17372 skeletonParagraphProps,
17373 skeletonProps,
17374 skeletonTitleProps,
17375 sliderProps,
17376 spaceProps,
17377 stepperProps,
17378 stepsProps,
17379 stickyProps,
17380 submitBarProps,
17381 swipeCellProps,
17382 swipeProps,
17383 switchProps,
17384 tabProps,
17385 tabbarItemProps,
17386 tabbarProps,
17387 tabsProps,
17388 tagProps,
17389 textEllipsisProps,
17390 timePickerProps,
17391 toastProps,
17392 treeSelectProps,
17393 uploaderProps,
17394 useCurrentLang,
17395 version,
17396 watermarkProps
17397};