System.register(["./index-legacy-26bc1086.js"],(function(e,t){"use strict";var l,n,o,i,a,s,u,c,r,v,p,d,m,f,h,b,g,x,y,w,H,O,k,T,I,C,S,N,D,B,M;return{setters:[e=>{l=e.c,n=e.W,o=e.ab,i=e._,a=e.d,s=e.n,u=e.b3,c=e.aa,r=e.r,v=e.u,p=e.e,d=e.ac,m=e.X,f=e.aC,h=e.Y,b=e.a,g=e.p,x=e.H,y=e.b,w=e.t,H=e.m,O=e.a9,k=e.bC,T=e.w,I=e.bD,C=e.L,S=e.ad,N=e.h,D=e.z,B=e.bE,M=e.k}],execute:function(){const[t,V,P]=l("picker"),$=e=>e.find((e=>!e.disabled))||e[0];function j(e,t){for(let l=t=i(t,0,e.length);l=0;l--)if(!e[l].disabled)return l;return 0}const E=(e,t,l)=>void 0!==t&&!!e.find((e=>e[l.value]===t));function z(e,t,l){const n=e.findIndex((e=>e[l.value]===t));return e[j(e,n)]}const[A,F]=l("picker-column"),L=Symbol(A);var Y=a({name:A,props:{value:s,fields:u(Object),options:c(),readonly:Boolean,allowHtml:Boolean,optionHeight:u(Number),swipeDuration:u(s),visibleOptionNum:u(s)},emits:["change","clickOption","scrollInto"],setup(e,{emit:t,slots:l}){let n,o,a,s,u;const c=r(),x=r(),y=r(0),w=r(0),H=v(),O=()=>e.options.length,k=()=>e.optionHeight*(+e.visibleOptionNum-1)/2,T=l=>{let o=j(e.options,l);const i=-o*e.optionHeight,a=()=>{o>O()-1&&(o=j(e.options,l));const n=e.options[o][e.fields.value];n!==e.value&&t("change",n)};n&&i!==y.value?u=a:a(),y.value=i},I=()=>e.readonly||!e.options.length,C=t=>i(Math.round(-t/e.optionHeight),0,O()-1),S=p((()=>C(y.value))),N=()=>{n=!1,w.value=0,u&&(u(),u=null)},D=e=>{if(!I()){if(H.start(e),n){const e=function(e){const{transform:t}=window.getComputedStyle(e),l=t.slice(7,t.length-1).split(", ")[5];return Number(l)}(x.value);y.value=Math.min(0,e-k())}w.value=0,o=y.value,a=Date.now(),s=o,u=null}},B=()=>{if(I())return;const t=y.value-s,l=Date.now()-a;if(l<300&&Math.abs(t)>15)return void((t,l)=>{const n=Math.abs(t/l);t=y.value+n/.003*(t<0?-1:1);const o=C(t);w.value=+e.swipeDuration,T(o)})(t,l);const o=C(y.value);w.value=200,T(o),setTimeout((()=>{n=!1}),0)},M=()=>{const o={height:`${e.optionHeight}px`};return e.options.map(((i,a)=>{const s=i[e.fields.text],{disabled:c}=i,r=i[e.fields.value],v={role:"button",style:o,tabindex:c?-1:0,class:[F("item",{disabled:c,selected:r===e.value}),i.className],onClick:()=>(l=>{n||I()||(u=null,w.value=200,T(l),t("clickOption",e.options[l]))})(a)},p={class:"van-ellipsis",[e.allowHtml?"innerHTML":"textContent"]:s};return b("li",v,[l.option?l.option(i,a):b("div",p,null)])}))};return d(L),m({stopMomentum:N}),f((()=>{const t=n?Math.floor(-y.value/e.optionHeight):e.options.findIndex((t=>t[e.fields.value]===e.value)),l=j(e.options,t),o=-l*e.optionHeight;n&&l{if(I())return;H.move(l),H.isVertical()&&(n=!0,g(l,!0));const u=i(o+H.deltaY.value,-O()*e.optionHeight,e.optionHeight),c=C(u);c!==S.value&&t("scrollInto",e.options[c]),y.value=u;const r=Date.now();r-a>300&&(a=r,s=u)}),{target:c}),()=>b("div",{ref:c,class:F(),onTouchstartPassive:D,onTouchend:B,onTouchcancel:B},[b("ul",{ref:x,style:{transform:`translate3d(0, ${y.value+k()}px, 0)`,transitionDuration:`${w.value}ms`,transitionProperty:w.value?"all":"none"},class:F("wrapper"),onTransitionend:N},[M()])])}});const[W]=l("picker-toolbar"),X={title:String,cancelButtonText:String,confirmButtonText:String},_=["cancel","confirm","title","toolbar"],q=Object.keys(X);var G=a({name:W,props:X,emits:["confirm","cancel"],setup(e,{emit:t,slots:l}){const n=()=>t("cancel"),o=()=>t("confirm"),i=()=>{const t=e.cancelButtonText||P("cancel");return b("button",{type:"button",class:[V("cancel"),x],onClick:n},[l.cancel?l.cancel():t])},a=()=>{const t=e.confirmButtonText||P("confirm");return b("button",{type:"button",class:[V("confirm"),x],onClick:o},[l.confirm?l.confirm():t])};return()=>b("div",{class:V("toolbar")},[l.toolbar?l.toolbar():[i(),l.title?l.title():e.title?b("div",{class:[V("title"),"van-ellipsis"]},[e.title]):void 0,a()]])}});const[J,K]=l("picker-group"),Q=Symbol(J);o({tabs:c(),activeTab:y(0),nextStepText:String},X);const R=e("p",o({loading:Boolean,readonly:Boolean,allowHtml:Boolean,optionHeight:y(44),showToolbar:w,swipeDuration:y(1e3),visibleOptionNum:y(6)},X)),U=o({},R,{columns:c(),modelValue:c(),toolbarPosition:H("top"),columnsFieldNames:Object});var Z=a({name:t,props:U,emits:["confirm","cancel","change","scrollInto","clickOption","update:modelValue"],setup(e,{emit:t,slots:l}){const i=r(),a=r(e.modelValue.slice(0)),{parent:s}=d(Q),{children:u,linkChildren:c}=O(L);c();const v=p((()=>function(e){return o({text:"text",value:"value",children:"children"},e)}(e.columnsFieldNames))),f=p((()=>k(e.optionHeight))),x=p((()=>function(e,t){const l=e[0];if(l){if(Array.isArray(l))return"multiple";if(t.children in l)return"cascade"}return"default"}(e.columns,v.value))),y=p((()=>{const{columns:t}=e;switch(x.value){case"multiple":return t;case"cascade":return function(e,t,l){const o=[];let i={[t.children]:e},a=0;for(;i&&i[t.children];){const e=i[t.children],s=l.value[a];i=n(s)?z(e,s,t):void 0,!i&&e.length&&(i=z(e,$(e)[t.value],t)),a++,o.push(e)}return o}(t,v.value,a);default:return[t]}})),w=p((()=>y.value.some((e=>e.length)))),H=p((()=>y.value.map(((e,t)=>z(e,a.value[t],v.value))))),M=p((()=>y.value.map(((e,t)=>e.findIndex((e=>e[v.value.value]===a.value[t])))))),P=(e,t)=>{if(a.value[e]!==t){const l=a.value.slice(0);l[e]=t,a.value=l}},j=()=>({selectedValues:a.value.slice(0),selectedOptions:H.value,selectedIndexes:M.value}),A=()=>{u.forEach((e=>e.stopMomentum()));const e=j();return D((()=>{t("confirm",e)})),e},F=()=>t("cancel",j()),W=()=>y.value.map(((n,i)=>b(Y,{value:a.value[i],fields:v.value,options:n,readonly:e.readonly,allowHtml:e.allowHtml,optionHeight:f.value,swipeDuration:e.swipeDuration,visibleOptionNum:e.visibleOptionNum,onChange:e=>((e,l)=>{P(l,e),"cascade"===x.value&&a.value.forEach(((e,t)=>{const l=y.value[t];E(l,e,v.value)||P(t,l.length?l[0][v.value.value]:void 0)})),D((()=>{t("change",o({columnIndex:l},j()))}))})(e,i),onClickOption:e=>((e,l)=>{const n={columnIndex:l,currentOption:e};t("clickOption",o(j(),n)),t("scrollInto",n)})(e,i),onScrollInto:e=>{t("scrollInto",{currentOption:e,columnIndex:i})}},{option:l.option}))),X=e=>{if(w.value){const t={height:`${f.value}px`},l={backgroundSize:`100% ${(e-f.value)/2}px`};return[b("div",{class:V("mask"),style:l},null),b("div",{class:[B,V("frame")],style:t},null)]}},J=()=>{const t=f.value*+e.visibleOptionNum,l={height:`${t}px`};return b("div",{ref:i,class:V("columns"),style:l},[W(),X(t)])},K=()=>{if(e.showToolbar&&!s)return b(G,N(S(e,q),{onConfirm:A,onCancel:F}),S(l,_))};let R;return T(y,(e=>{e.forEach(((e,t)=>{e.length&&!E(e,a.value[t],v.value)&&P(t,$(e)[v.value.value])}))}),{immediate:!0}),T((()=>e.modelValue),(e=>{I(e,a.value)||I(e,R)||(a.value=e.slice(0),R=e.slice(0))}),{deep:!0}),T(a,(l=>{I(l,e.modelValue)||(R=l.slice(0),t("update:modelValue",R))}),{immediate:!0}),h("touchmove",g,{target:i}),m({confirm:A,getSelectedOptions:()=>H.value}),()=>{var t,n;return b("div",{class:V()},["top"===e.toolbarPosition?K():null,e.loading?b(C,{class:V("loading")},null):null,null==(t=l["columns-top"])?void 0:t.call(l),J(),null==(n=l["columns-bottom"])?void 0:n.call(l),"bottom"===e.toolbarPosition?K():null])}}});e("P",M(Z))}}}));