UNPKG

@ionic/core

Version:
1 lines • 34.8 kB
var __awaiter=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,o){function a(e){try{l(i.next(e))}catch(e){o(e)}}function s(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){e.done?r(e.value):new n(function(t){t(e.value)}).then(a,s)}l((i=i.apply(e,t||[])).next())})},__generator=this&&this.__generator||function(e,t){var n,i,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,i=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(r=(r=a.trys).length>0&&r[r.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){a.label=o[1];break}if(6===o[0]&&a.label<r[1]){a.label=r[1],r=o;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(o);break}r[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Ionic.loadBundle("ch8upsxn",["require","exports","./chunk-be8d65e3.js","./chunk-a99bd936.js","./chunk-2c5e69a8.js","./chunk-9f86f253.js"],function(e,t,n,i,r,o){var a=window.Ionic.h;function s(e,t,n,i){if(e!==D&&e!==S){if(e===Y)return void 0!==n&&void 0!==n.hour?n.hour<12?"AM":"PM":t?t.toUpperCase():"";if(e===T)return void 0!==n&&void 0!==n.hour?n.hour<12?"am":"pm":t||"";if(null==t)return"";if(e===k||e===w||e===O||e===P||e===I||e===E)return y(t);if(e===g)return b(t);if(e===x)return(i.monthNames?i.monthNames:N)[t-1];if(e===M)return(i.monthShortNames?i.monthShortNames:V)[t-1];if(e===C||e===F){if(0===t)return"12";if(t>12&&(t-=12),e===C&&t<10)return"0"+t}return t.toString()}try{return t=new Date(n.year,n.month-1,n.day).getDay(),e===D?(i.dayNames?i.dayNames:A)[t]:(i.dayShortNames?i.dayShortNames:j)[t]}catch(e){}}function l(e,t,n,i,r){return void 0===i&&(i=0),void 0===r&&(r=0),parseInt("1"+b(e)+y(t)+y(n)+y(i)+y(r),10)}function u(e){return l(e.year,e.month,e.day,e.hour,e.minute)}var c=/^(\d{4}|[+\-]\d{6})(?:-(\d{2})(?:-(\d{2}))?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/,d=/^((\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/;function h(e){var t=null;if(null!=e&&""!==e&&((t=d.exec(e))?(t.unshift(void 0,void 0),t[2]=t[3]=void 0):t=c.exec(e)),null!==t){for(var n=1;n<8;n++)t[n]=void 0!==t[n]?parseInt(t[n],10):void 0;var i=0;return t[9]&&t[10]&&(i=60*parseInt(t[10],10),t[11]&&(i+=parseInt(t[11],10)),"-"===t[9]&&(i*=-1)),{year:t[1],month:t[2],day:t[3],hour:t[4],minute:t[5],second:t[6],millisecond:t[7],tzOffset:i}}}function p(e){for(var t in _)if(_[t].f===e)return _[t].k}function m(e,t){var n;if(null!=e)return"string"==typeof e&&(e=e.replace(/\[|\]/g,"").split(",")),Array.isArray(e)&&(n=e.map(function(e){return e.toString().trim()})),void 0!==n&&0!==n.length||console.warn('Invalid "'+t+'Names". Must be an array of strings, or a comma separated string.'),n}function f(e,t){var n;return"string"==typeof e&&(e=e.replace(/\[|\]|\s/g,"").split(",")),0===(n=Array.isArray(e)?e.map(function(e){return parseInt(e,10)}).filter(isFinite):[e]).length&&console.warn('Invalid "'+t+'Values". Must be an array of numbers, or a comma separated string of numbers.'),n}function y(e){return("0"+(void 0!==e?Math.abs(e):"0")).slice(-2)}function v(e){return("00"+(void 0!==e?Math.abs(e):"0")).slice(-3)}function b(e){return("000"+(void 0!==e?Math.abs(e):"0")).slice(-4)}var g="YYYY",k="YY",x="MMMM",M="MMM",w="MM",D="DDDD",S="DDD",O="DD",P="HH",C="hh",F="h",I="mm",E="ss",Y="A",T="a",_=[{f:g,k:"year"},{f:x,k:"month"},{f:D,k:"day"},{f:M,k:"month"},{f:S,k:"day"},{f:k,k:"year"},{f:w,k:"month"},{f:O,k:"day"},{f:P,k:"hour"},{f:C,k:"hour"},{f:I,k:"minute"},{f:E,k:"second"},{f:"M",k:"month"},{f:"D",k:"day"},{f:"H",k:"hour"},{f:F,k:"hour"},{f:"m",k:"minute"},{f:"s",k:"second"},{f:Y,k:"ampm"},{f:T,k:"ampm"}],A=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],j=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],N=["January","February","March","April","May","June","July","August","September","October","November","December"],V=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],B=[C,F,I,"m",E,"s"],W=function(){function e(){var e=this;this.inputId="ion-dt-"+H++,this.locale={},this.datetimeMin={},this.datetimeMax={},this.datetimeValue={},this.isExpanded=!1,this.name=this.inputId,this.disabled=!1,this.readonly=!1,this.displayFormat="MMM D, YYYY",this.cancelText="Cancel",this.doneText="Done",this.onFocus=function(){e.ionFocus.emit()},this.onBlur=function(){e.ionBlur.emit()}}return e.prototype.disabledChanged=function(){this.emitStyle()},e.prototype.valueChanged=function(){this.updateDatetimeValue(this.value),this.emitStyle(),this.ionChange.emit({value:this.value})},e.prototype.componentWillLoad=function(){this.locale={monthNames:m(this.monthNames,"monthNames"),monthShortNames:m(this.monthShortNames,"monthShortNames"),dayNames:m(this.dayNames,"dayNames"),dayShortNames:m(this.dayShortNames,"dayShortNames")},this.updateDatetimeValue(this.value),this.emitStyle()},e.prototype.onClick=function(){this.setFocus(),this.open()},e.prototype.open=function(){return __awaiter(this,void 0,void 0,function(){var e,t,n=this;return __generator(this,function(i){switch(i.label){case 0:return this.disabled||this.isExpanded?[2]:(e=this.generatePickerOptions(),[4,this.pickerCtrl.create(e)]);case 1:return t=i.sent(),this.isExpanded=!0,t.onDidDismiss().then(function(){n.isExpanded=!1,n.setFocus()}),[4,this.validate(t)];case 2:return i.sent(),[4,t.present()];case 3:return i.sent(),[2]}})})},e.prototype.emitStyle=function(){this.ionStyle.emit({interactive:!0,datetime:!0,"has-placeholder":null!=this.placeholder,"has-value":this.hasValue(),"interactive-disabled":this.disabled})},e.prototype.updateDatetimeValue=function(e){!function(e,t){if(t&&""!==t){if("string"==typeof t){if(t=h(t))return Object.assign(e,t),!0}else if(t.year||t.hour||t.month||t.day||t.minute||t.second){t.ampm&&t.hour&&(t.hour.value="pm"===t.ampm.value?12===t.hour.value?12:t.hour.value+12:12===t.hour.value?0:t.hour.value);for(var n=0,i=Object.keys(t);n<i.length;n++){var r=i[n];e[r]=t[r].value}return!0}console.warn('Error parsing date: "'+t+'". Please provide a valid ISO 8601 datetime format: https://www.w3.org/TR/NOTE-datetime')}else for(var o in e)e.hasOwnProperty(o)&&delete e[o]}(this.datetimeValue,e)},e.prototype.generatePickerOptions=function(){var e=this,t=Object.assign({mode:this.mode},this.pickerOptions,{columns:this.generateColumns()}),n=t.buttons;return n&&0!==n.length||(t.buttons=[{text:this.cancelText,role:"cancel",handler:function(){e.ionCancel.emit()}},{text:this.doneText,handler:function(t){e.updateDatetimeValue(t),e.value=function(e){var t="";return void 0!==e.year?(t=b(e.year),void 0!==e.month&&(t+="-"+y(e.month),void 0!==e.day&&(t+="-"+y(e.day),void 0!==e.hour&&(t+="T"+y(e.hour)+":"+y(e.minute)+":"+y(e.second),e.millisecond>0&&(t+="."+v(e.millisecond)),t+=void 0===e.tzOffset?"Z":(e.tzOffset>0?"+":"-")+y(Math.floor(Math.abs(e.tzOffset/60)))+":"+y(e.tzOffset%60))))):void 0!==e.hour&&(t=y(e.hour)+":"+y(e.minute),void 0!==e.second&&(t+=":"+y(e.second),void 0!==e.millisecond&&(t+="."+v(e.millisecond)))),t}(e.datetimeValue)}}]),t},e.prototype.generateColumns=function(){var e=this,t=this.pickerFormat||this.displayFormat||q;if(0===t.length)return[];this.calcMinMax(),-1===(t=t.replace("DDDD","{~}").replace("DDD","{~}")).indexOf("D")&&(t=t.replace("{~}","D"));var n=function(e){var t=[];e=e.replace(/[^\w\s]/gi," "),_.forEach(function(t){t.f.length>1&&e.indexOf(t.f)>-1&&e.indexOf(t.f+t.f.charAt(0))<0&&(e=e.replace(t.f," "+t.f+" "))});var n=e.split(" ").filter(function(e){return e.length>0});return n.forEach(function(e,i){_.forEach(function(r){if(e===r.f){if((e===Y||e===T)&&(t.indexOf(F)<0&&t.indexOf(C)<0||-1===B.indexOf(n[i-1])))return;t.push(e)}})}),t}(t=t.replace(/{~}/g,"")).map(function(t){var n=p(t),i=(e[n+"Values"]?f(e[n+"Values"],n):function(e,t,n){var i=[];if(e===g||e===k){if(void 0===n.year||void 0===t.year)throw new Error("min and max year is undefined");for(var r=n.year;r>=t.year;r--)i.push(r)}else if(e===x||e===M||e===w||"M"===e||e===C||e===F)for(r=1;r<13;r++)i.push(r);else if(e===D||e===S||e===O||"D"===e)for(r=1;r<32;r++)i.push(r);else if(e===P||"H"===e)for(r=0;r<24;r++)i.push(r);else if(e===I||"m"===e)for(r=0;r<60;r++)i.push(r);else if(e===E||"s"===e)for(r=0;r<60;r++)i.push(r);else e!==Y&&e!==T||i.push("am","pm");return i}(t,e.datetimeMin,e.datetimeMax)).map(function(n){return{value:n,text:s(t,n,void 0,e.locale)}}),r=function(e,t){return t===Y||t===T?e.hour<12?"am":"pm":t===C||t===F?e.hour>12?e.hour-12:e.hour:e[p(t)]}(e.datetimeValue,t),o=i.findIndex(function(e){return e.value===r});return{name:n,selectedIndex:o>=0?o:0,options:i}}),i=this.datetimeMin,r=this.datetimeMax;return["month","day","hour","minute"].filter(function(e){return!n.find(function(t){return t.name===e})}).forEach(function(e){i[e]=0,r[e]=0}),function(e){for(var t,n,i=[],r=0;r<e.length;r++){t=e[r],i.push(0);for(var o=0,a=t.options;o<a.length;o++){(n=a[o].text.length)>i[r]&&(i[r]=n)}}return 2===i.length?(n=Math.max(i[0],i[1]),e[0].align="right",e[1].align="left",e[0].optionsWidth=e[1].optionsWidth=17*n+"px"):3===i.length&&(n=Math.max(i[0],i[2]),e[0].align="right",e[1].columnWidth=17*i[1]+"px",e[0].optionsWidth=e[2].optionsWidth=17*n+"px",e[2].align="left"),e}(n)},e.prototype.validate=function(e){return __awaiter(this,void 0,void 0,function(){var t,n,i,r,o,a,s,l,c,d,h;return __generator(this,function(p){switch(p.label){case 0:return t=new Date,n=u(this.datetimeMin),i=u(this.datetimeMax),[4,e.getColumn("year")];case 1:return r=p.sent(),o=t.getFullYear(),r&&(r.options.find(function(e){return e.value===t.getFullYear()})||(o=r.options[0].value),void 0!==(a=r.selectedIndex)&&(s=r.options[a])&&(o=s.value)),[4,this.validateColumn(e,"month",1,n,i,[o,0,0,0,0],[o,12,31,23,59])];case 2:return l=p.sent(),c=4===(m=l)||6===m||9===m||11===m?30:2===m?function(e){return e%4==0&&e%100!=0||e%400==0}(o)?29:28:31,[4,this.validateColumn(e,"day",2,n,i,[o,l,0,0,0],[o,l,c,23,59])];case 3:return d=p.sent(),[4,this.validateColumn(e,"hour",3,n,i,[o,l,d,0,0],[o,l,d,23,59])];case 4:return h=p.sent(),[4,this.validateColumn(e,"minute",4,n,i,[o,l,d,h,0],[o,l,d,h,59])];case 5:return p.sent(),[2]}var m})})},e.prototype.calcMinMax=function(){var e=(new Date).getFullYear();if(void 0!==this.yearValues){var t=f(this.yearValues,"year");void 0===this.min&&(this.min=Math.min.apply(Math,t).toString()),void 0===this.max&&(this.max=Math.max.apply(Math,t).toString())}else void 0===this.min&&(this.min=(e-100).toString()),void 0===this.max&&(this.max=e.toString());var n=this.datetimeMin=h(this.min),i=this.datetimeMax=h(this.max);n.year=n.year||e,i.year=i.year||e,n.month=n.month||1,i.month=i.month||12,n.day=n.day||1,i.day=i.day||31,n.hour=n.hour||0,i.hour=i.hour||23,n.minute=n.minute||0,i.minute=i.minute||59,n.second=n.second||0,i.second=i.second||59,n.year>i.year&&(console.error("min.year > max.year"),n.year=i.year-100),n.year===i.year&&(n.month>i.month?(console.error("min.month > max.month"),n.month=1):n.month===i.month&&n.day>i.day&&(console.error("min.day > max.day"),n.day=1))},e.prototype.validateColumn=function(e,t,n,i,o,a,s){return __awaiter(this,void 0,void 0,function(){var u,c,d,h,p,m,f,y,v,b,g;return __generator(this,function(k){switch(k.label){case 0:return[4,e.getColumn(t)];case 1:if(!(u=k.sent()))return[2,0];for(c=a.slice(),d=s.slice(),p=(h=u.options).length-1,m=0,f=0;f<h.length;f++)v=(y=h[f]).value,c[n]=y.value,d[n]=y.value,(y.disabled=v<a[n]||v>s[n]||l(d[0],d[1],d[2],d[3],d[4])<i||l(c[0],c[1],c[2],c[3],c[4])>o)||(p=Math.min(p,f),m=Math.max(m,f));return b=u.selectedIndex=r.clamp(p,u.selectedIndex,m),(g=u.options[b])?[2,g.value]:[2,0]}})})},e.prototype.getText=function(){return function(e,t,n){if(void 0!==t){var i=[],r=!1;if(_.forEach(function(o,a){if(e.indexOf(o.f)>-1){var l="{"+a+"}",u=s(o.f,t[o.k],t,n);r||void 0===u||null==t[o.k]||(r=!0),i.push(l,u||""),e=e.replace(o.f,l)}}),r){for(var o=0;o<i.length;o+=2)e=e.replace(i[o],i[o+1]);return e}}}(this.displayFormat||this.pickerFormat||q,this.datetimeValue,this.locale)},e.prototype.hasValue=function(){return Object.keys(this.datetimeValue).length>0},e.prototype.setFocus=function(){this.buttonEl&&this.buttonEl.focus()},e.prototype.hostData=function(){var e=this,t=e.inputId,n=e.disabled,o=e.readonly,a=e.isExpanded,s=e.el,l=e.placeholder,u=void 0===this.getText()&&null!=l,c=t+"-lbl",d=r.findItemLabel(s);return d&&(d.id=c),{role:"combobox","aria-disabled":n?"true":null,"aria-expanded":""+a,"aria-haspopup":"true","aria-labelledby":c,class:{"datetime-disabled":n,"datetime-readonly":o,"datetime-placeholder":u,"in-item":i.hostContext("ion-item",s)}}},e.prototype.render=function(){var e=this,t=this.getText();return void 0===t&&(t=null!=this.placeholder?this.placeholder:""),r.renderHiddenInput(!0,this.el,this.name,this.value,this.disabled),[a("div",{class:"datetime-text"},t),a("button",{type:"button",onFocus:this.onFocus,onBlur:this.onBlur,disabled:this.disabled,ref:function(t){return e.buttonEl=t}})]},Object.defineProperty(e,"is",{get:function(){return"ion-datetime"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"encapsulation",{get:function(){return"shadow"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"properties",{get:function(){return{cancelText:{type:String,attr:"cancel-text"},dayNames:{type:String,attr:"day-names"},dayShortNames:{type:String,attr:"day-short-names"},dayValues:{type:"Any",attr:"day-values"},disabled:{type:Boolean,attr:"disabled",watchCallbacks:["disabledChanged"]},displayFormat:{type:String,attr:"display-format"},doneText:{type:String,attr:"done-text"},el:{elementRef:!0},hourValues:{type:"Any",attr:"hour-values"},isExpanded:{state:!0},max:{type:String,attr:"max",mutable:!0},min:{type:String,attr:"min",mutable:!0},minuteValues:{type:"Any",attr:"minute-values"},mode:{type:String,attr:"mode"},monthNames:{type:String,attr:"month-names"},monthShortNames:{type:String,attr:"month-short-names"},monthValues:{type:"Any",attr:"month-values"},name:{type:String,attr:"name"},open:{method:!0},pickerCtrl:{connect:"ion-picker-controller"},pickerFormat:{type:String,attr:"picker-format"},pickerOptions:{type:"Any",attr:"picker-options"},placeholder:{type:String,attr:"placeholder"},readonly:{type:Boolean,attr:"readonly"},value:{type:String,attr:"value",mutable:!0,watchCallbacks:["valueChanged"]},yearValues:{type:"Any",attr:"year-values"}}},enumerable:!0,configurable:!0}),Object.defineProperty(e,"events",{get:function(){return[{name:"ionCancel",method:"ionCancel",bubbles:!0,cancelable:!0,composed:!0},{name:"ionChange",method:"ionChange",bubbles:!0,cancelable:!0,composed:!0},{name:"ionFocus",method:"ionFocus",bubbles:!0,cancelable:!0,composed:!0},{name:"ionBlur",method:"ionBlur",bubbles:!0,cancelable:!0,composed:!0},{name:"ionStyle",method:"ionStyle",bubbles:!0,cancelable:!0,composed:!0}]},enumerable:!0,configurable:!0}),Object.defineProperty(e,"listeners",{get:function(){return[{name:"click",method:"onClick"}]},enumerable:!0,configurable:!0}),Object.defineProperty(e,"style",{get:function(){return":host{padding-left:var(--padding-start);padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);display:-ms-flexbox;display:flex;position:relative;min-width:16px;min-height:1.2em;font-family:var(--ion-font-family,inherit);text-overflow:ellipsis;white-space:nowrap;overflow:hidden;z-index:2}\@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}:host(.in-item){position:static}:host(.datetime-placeholder){color:var(--placeholder-color)}:host(.datetime-disabled){opacity:.3;pointer-events:none}:host(.datetime-readonly){pointer-events:none}button{left:0;top:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;position:absolute;width:100%;height:100%;border:0;background:transparent;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none}:host-context([dir=rtl]) button{right:0}button::-moz-focus-inner{border:0}.datetime-text{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;-ms-flex:1;flex:1;min-height:inherit;direction:ltr;overflow:inherit}:host{--placeholder-color:var(--ion-placeholder-color,var(--ion-color-step-400,#999));--padding-top:10px;--padding-end:0;--padding-bottom:11px;--padding-start:16px}"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"styleMode",{get:function(){return"md"},enumerable:!0,configurable:!0}),e}(),H=0,q="MMM D, YYYY";function z(e,t){var n=new e,i=new e;i.addElement(t.querySelector("ion-backdrop"));var r=new e;return r.addElement(t.querySelector(".picker-wrapper")),i.fromTo("opacity",.01,.26),r.fromTo("translateY","100%","0%"),Promise.resolve(n.addElement(t).easing("cubic-bezier(.36,.66,.04,1)").duration(400).add(i).add(r))}function L(e,t){var n=new e,i=new e;i.addElement(t.querySelector("ion-backdrop"));var r=new e;return r.addElement(t.querySelector(".picker-wrapper")),i.fromTo("opacity",.26,.01),r.fromTo("translateY","0%","100%"),Promise.resolve(n.addElement(t).easing("cubic-bezier(.36,.66,.04,1)").duration(400).add(i).add(r))}var J=function(){function e(){this.presented=!1,this.keyboardClose=!0,this.buttons=[],this.columns=[],this.duration=0,this.showBackdrop=!0,this.backdropDismiss=!0,this.animated=!0}return e.prototype.onBackdropTap=function(){var e=this.buttons.find(function(e){return"cancel"===e.role});e?this.buttonClick(e):this.dismiss()},e.prototype.present=function(){return __awaiter(this,void 0,void 0,function(){var e=this;return __generator(this,function(t){switch(t.label){case 0:return[4,n.present(this,"pickerEnter",z,z,void 0)];case 1:return t.sent(),this.duration>0&&(this.durationTimeout=setTimeout(function(){return e.dismiss()},this.duration)),[2]}})})},e.prototype.dismiss=function(e,t){return this.durationTimeout&&clearTimeout(this.durationTimeout),n.dismiss(this,e,t,"pickerLeave",L,L)},e.prototype.onDidDismiss=function(){return n.eventMethod(this.el,"ionPickerDidDismiss")},e.prototype.onWillDismiss=function(){return n.eventMethod(this.el,"ionPickerWillDismiss")},e.prototype.getColumn=function(e){return Promise.resolve(this.columns.find(function(t){return t.name===e}))},e.prototype.buttonClick=function(e){var t=!0;return e.handler&&!1===e.handler(this.getSelected())&&(t=!1),t?this.dismiss():Promise.resolve(!1)},e.prototype.getSelected=function(){var e={};return this.columns.forEach(function(t,n){var i=void 0!==t.selectedIndex?t.options[t.selectedIndex]:void 0;e[t.name]={text:i?i.text:void 0,value:i?i.value:void 0,columnIndex:n}}),e},e.prototype.hostData=function(){return{"aria-modal":"true",class:Object.assign({},i.createThemedClasses(this.mode,"picker"),i.getClassMap(this.cssClass)),style:{zIndex:2e4+this.overlayIndex}}},e.prototype.render=function(){var e=this;return[a("ion-backdrop",{visible:this.showBackdrop,tappable:this.backdropDismiss}),a("div",{class:"picker-wrapper",role:"dialog"},a("div",{class:"picker-toolbar"},this.buttons.map(function(t){return a("div",{class:(n=t,i={},i["picker-toolbar-"+n.role]=void 0!==n.role,i["picker-toolbar-button"]=!0,i)},a("button",{type:"button",onClick:function(){return e.buttonClick(t)},class:R(t)},t.text));var n,i})),a("div",{class:"picker-columns"},a("div",{class:"picker-above-highlight"}),this.presented&&this.columns.map(function(e){return a("ion-picker-column",{col:e})}),a("div",{class:"picker-below-highlight"})))]},Object.defineProperty(e,"is",{get:function(){return"ion-picker"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"encapsulation",{get:function(){return"scoped"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"properties",{get:function(){return{animated:{type:Boolean,attr:"animated"},backdropDismiss:{type:Boolean,attr:"backdrop-dismiss"},buttons:{type:"Any",attr:"buttons"},columns:{type:"Any",attr:"columns"},config:{context:"config"},cssClass:{type:String,attr:"css-class"},dismiss:{method:!0},duration:{type:Number,attr:"duration"},el:{elementRef:!0},enterAnimation:{type:"Any",attr:"enter-animation"},getColumn:{method:!0},keyboardClose:{type:Boolean,attr:"keyboard-close"},leaveAnimation:{type:"Any",attr:"leave-animation"},mode:{type:String,attr:"mode"},onDidDismiss:{method:!0},onWillDismiss:{method:!0},overlayIndex:{type:Number,attr:"overlay-index"},present:{method:!0},presented:{state:!0},showBackdrop:{type:Boolean,attr:"show-backdrop"}}},enumerable:!0,configurable:!0}),Object.defineProperty(e,"events",{get:function(){return[{name:"ionPickerDidPresent",method:"didPresent",bubbles:!0,cancelable:!0,composed:!0},{name:"ionPickerWillPresent",method:"willPresent",bubbles:!0,cancelable:!0,composed:!0},{name:"ionPickerWillDismiss",method:"willDismiss",bubbles:!0,cancelable:!0,composed:!0},{name:"ionPickerDidDismiss",method:"didDismiss",bubbles:!0,cancelable:!0,composed:!0}]},enumerable:!0,configurable:!0}),Object.defineProperty(e,"listeners",{get:function(){return[{name:"ionBackdropTap",method:"onBackdropTap"}]},enumerable:!0,configurable:!0}),Object.defineProperty(e,"style",{get:function(){return".sc-ion-picker-md-h{--border-radius:0;--border-style:solid;--min-width:auto;--width:100%;--max-width:500px;--min-height:auto;--max-height:auto;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;left:0;top:0;display:block;position:absolute;width:100%;height:100%;font-family:var(--ion-font-family,inherit);contain:strict;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:1000}[dir=rtl].sc-ion-picker-md-h + b.sc-ion-picker-md{right:0}.overlay-hidden.sc-ion-picker-md-h{display:none}.picker-wrapper.sc-ion-picker-md{border-radius:var(--border-radius);left:0;right:0;bottom:0;margin-left:auto;margin-right:auto;margin-top:auto;margin-bottom:auto;-webkit-transform:translate3d(0,100%,0);transform:translate3d(0,100%,0);display:-ms-flexbox;display:flex;position:absolute;-ms-flex-direction:column;flex-direction:column;width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);contain:strict;overflow:hidden;z-index:10}\@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){.picker-wrapper.sc-ion-picker-md{margin-left:unset;margin-right:unset;-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto}}.picker-toolbar.sc-ion-picker-md{width:100%;background:transparent;contain:strict;z-index:1}.picker-button.sc-ion-picker-md{border:0;font-family:inherit}.picker-button.sc-ion-picker-md:active, .picker-button.sc-ion-picker-md:focus{outline:none}.picker-columns.sc-ion-picker-md{display:-ms-flexbox;display:flex;position:relative;-ms-flex-pack:center;justify-content:center;margin-bottom:var(--ion-safe-area-bottom,0);contain:strict;direction:ltr;overflow:hidden}.picker-above-highlight.sc-ion-picker-md, .picker-below-highlight.sc-ion-picker-md{display:none;pointer-events:none}.sc-ion-picker-md-h{--background:var(--ion-background-color,#fff);--border-width:0.55px 0 0;--border-color:var(--ion-item-border-color,var(--ion-border-color,var(--ion-color-step-150,rgba(0,0,0,0.13))));--height:260px;color:var(--ion-item-color,var(--ion-text-color,#000))}.picker-toolbar.sc-ion-picker-md{display:-ms-flexbox;display:flex;-ms-flex-pack:end;justify-content:flex-end;height:44px}.picker-button.sc-ion-picker-md, .picker-button.activated.sc-ion-picker-md{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:1.1em;padding-right:1.1em;padding-top:0;padding-bottom:0;height:44px;background:transparent;color:var(--ion-color-primary,#3880ff);font-size:14px;font-weight:500;text-transform:uppercase;-webkit-box-shadow:none;box-shadow:none}\@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){.picker-button.sc-ion-picker-md, .picker-button.activated.sc-ion-picker-md{padding-left:unset;padding-right:unset;-webkit-padding-start:1.1em;padding-inline-start:1.1em;-webkit-padding-end:1.1em;padding-inline-end:1.1em}}.picker-columns.sc-ion-picker-md{height:216px;-webkit-perspective:1800px;perspective:1800px}.picker-above-highlight.sc-ion-picker-md{left:0;top:0;-webkit-transform:translateZ(90px);transform:translateZ(90px);position:absolute;width:100%;height:81px;border-bottom:1px solid var(--ion-item-border-color,var(--ion-border-color,var(--ion-color-step-150,rgba(0,0,0,.13))));background:-webkit-gradient(linear,left top,left bottom,color-stop(20%,var(--ion-background-color,#fff)),to(rgba(var(--ion-background-color-rgb,255,255,255),.8)));background:linear-gradient(180deg,var(--ion-background-color,#fff) 20%,rgba(var(--ion-background-color-rgb,255,255,255),.8));z-index:10}[dir=rtl].sc-ion-picker-md-h .picker-above-highlight.sc-ion-picker-md, [dir=rtl] .sc-ion-picker-md-h .picker-above-highlight.sc-ion-picker-md{right:0}.picker-below-highlight.sc-ion-picker-md{left:0;top:115px;-webkit-transform:translateZ(90px);transform:translateZ(90px);position:absolute;width:100%;height:119px;border-top:1px solid var(--ion-item-border-color,var(--ion-border-color,var(--ion-color-step-150,rgba(0,0,0,.13))));background:-webkit-gradient(linear,left bottom,left top,color-stop(30%,var(--ion-background-color,#fff)),to(rgba(var(--ion-background-color-rgb,255,255,255),.8)));background:linear-gradient(0deg,var(--ion-background-color,#fff) 30%,rgba(var(--ion-background-color-rgb,255,255,255),.8));z-index:11}[dir=rtl].sc-ion-picker-md-h .picker-below-highlight.sc-ion-picker-md, [dir=rtl] .sc-ion-picker-md-h .picker-below-highlight.sc-ion-picker-md{right:0}"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"styleMode",{get:function(){return"md"},enumerable:!0,configurable:!0}),e}();function R(e){return Object.assign({"picker-button":!0,"ion-activatable":!0},i.getClassMap(e.cssClass))}var Z=function(){function t(){this.optHeight=0,this.rotateFactor=0,this.scaleFactor=1,this.velocity=0,this.y=0,this.noAnimate=!0}return t.prototype.componentWillLoad=function(){var e=0,t=.81;"ios"===this.mode&&(e=-.46,t=1),this.rotateFactor=e,this.scaleFactor=t},t.prototype.componentDidLoad=function(){return __awaiter(this,void 0,void 0,function(){var t,n,i=this;return __generator(this,function(r){switch(r.label){case 0:return(t=this.optsEl)&&(this.optHeight=t.firstElementChild?t.firstElementChild.clientHeight:0),this.refresh(),n=this,[4,new Promise(function(t,n){e(["./chunk-54ca8d01.js"],t,n)})];case 1:return n.gesture=r.sent().createGesture({el:this.el,queue:this.queue,gestureName:"picker-swipe",gesturePriority:100,threshold:0,onStart:function(e){return i.onStart(e)},onMove:function(e){return i.onMove(e)},onEnd:function(e){return i.onEnd(e)}}),this.gesture.setDisabled(!1),this.tmrId=setTimeout(function(){i.noAnimate=!1,i.refresh(!0)},250),[2]}})})},t.prototype.componentDidUnload=function(){cancelAnimationFrame(this.rafId),clearTimeout(this.tmrId),this.gesture&&(this.gesture.destroy(),this.gesture=void 0)},t.prototype.setSelected=function(e,t){var n=e>-1?-e*this.optHeight:0;this.velocity=0,cancelAnimationFrame(this.rafId),this.update(n,t,!0)},t.prototype.update=function(e,t,n){if(this.optsEl){for(var i=0,r=0,a=this.col,s=this.rotateFactor,l=a.selectedIndex=this.indexForY(-e),u=0===t?"":t+"ms",c="scale("+this.scaleFactor+")",d=this.optsEl.children,h=0;h<d.length;h++){var p=d[h],m=a.options[h],f=h*this.optHeight+e,y="";if(0!==s){var v=f*s;Math.abs(v)<=90?(i=0,r=90,y="rotateX("+v+"deg) "):i=-9999}else r=0,i=f;var b=l===h;y+="translate3d(0px,"+i+"px,"+r+"px) ",1===this.scaleFactor||b||(y+=c),this.noAnimate?(m.duration=0,p.style.transitionDuration=""):t!==m.duration&&(m.duration=t,p.style.transitionDuration=u),y!==m.transform&&(m.transform=y,p.style.transform=y),b!==m.selected&&(m.selected=b,b?p.classList.add(G):p.classList.remove(G))}this.col.prevSelected=l,n&&(this.y=e),this.lastIndex!==l&&(o.hapticSelectionChanged(),this.lastIndex=l)}},t.prototype.decelerate=function(){var e=this;if(0!==this.velocity){this.velocity*=U,this.velocity=this.velocity>0?Math.max(this.velocity,1):Math.min(this.velocity,-1);var t=this.y+this.velocity;t>this.minY?(t=this.minY,this.velocity=0):t<this.maxY&&(t=this.maxY,this.velocity=0),this.update(t,0,!0),(Math.round(t)%this.optHeight!=0||Math.abs(this.velocity)>1)&&(this.rafId=requestAnimationFrame(function(){return e.decelerate()}))}else if(this.y%this.optHeight!=0){var n=Math.abs(this.y%this.optHeight);this.velocity=n>this.optHeight/2?1:-1,this.decelerate()}},t.prototype.indexForY=function(e){return Math.min(Math.max(Math.abs(Math.round(e/this.optHeight)),0),this.col.options.length-1)},t.prototype.onStart=function(e){e.event.preventDefault(),e.event.stopPropagation(),cancelAnimationFrame(this.rafId);for(var t=this.col.options,n=t.length-1,i=0,r=0;r<t.length;r++)t[r].disabled||(n=Math.min(n,r),i=Math.max(i,r));this.minY=-n*this.optHeight,this.maxY=-i*this.optHeight},t.prototype.onMove=function(e){e.event.preventDefault(),e.event.stopPropagation();var t=this.y+e.deltaY;t>this.minY?(t=Math.pow(t,.8),this.bounceFrom=t):t<this.maxY?(t+=Math.pow(this.maxY-t,.9),this.bounceFrom=t):this.bounceFrom=0,this.update(t,0,!1)},t.prototype.onEnd=function(e){if(this.bounceFrom>0)this.update(this.minY,100,!0);else if(this.bounceFrom<0)this.update(this.maxY,100,!0);else if(this.velocity=r.clamp(-$,23*e.velocityY,$),0===this.velocity&&0===e.deltaY){var t=e.event.target.closest(".picker-opt");t&&t.hasAttribute("opt-index")&&this.setSelected(parseInt(t.getAttribute("opt-index"),10),X)}else this.y+=e.deltaY,this.decelerate()},t.prototype.refresh=function(e){for(var t=this.col.options.length-1,n=0,i=this.col.options,o=0;o<i.length;o++)i[o].disabled||(t=Math.min(t,o),n=Math.max(n,o));var a=r.clamp(t,this.col.selectedIndex||0,n);if(this.col.prevSelected!==a||e){var s=a*this.optHeight*-1;this.velocity=0,this.update(s,X,!0)}},t.prototype.hostData=function(){return{class:{"picker-col":!0,"picker-opts-left":"left"===this.col.align,"picker-opts-right":"right"===this.col.align},style:{"max-width":this.col.columnWidth}}},t.prototype.render=function(){var e=this,t=this.col;return[t.prefix&&a("div",{class:"picker-prefix",style:{width:t.prefixWidth}},t.prefix),a("div",{class:"picker-opts",style:{maxWidth:t.optionsWidth},ref:function(t){return e.optsEl=t}},t.options.map(function(e,t){return a("button",{type:"button",class:{"picker-opt":!0,"picker-opt-disabled":!!e.disabled},"opt-index":t},e.text)})),t.suffix&&a("div",{class:"picker-suffix",style:{width:t.suffixWidth}},t.suffix)]},Object.defineProperty(t,"is",{get:function(){return"ion-picker-column"},enumerable:!0,configurable:!0}),Object.defineProperty(t,"properties",{get:function(){return{col:{type:"Any",attr:"col"},el:{elementRef:!0},queue:{context:"queue"}}},enumerable:!0,configurable:!0}),Object.defineProperty(t,"style",{get:function(){return".picker-col{display:-ms-flexbox;display:flex;position:relative;-ms-flex:1;flex:1;-ms-flex-pack:center;justify-content:center;height:100%;-webkit-box-sizing:content-box;box-sizing:content-box;contain:content}.picker-opts{position:relative;-ms-flex:1;flex:1;max-width:100%}.picker-opt{left:0;top:0;display:block;position:absolute;width:100%;border:0;text-align:center;text-overflow:ellipsis;white-space:nowrap;contain:strict;overflow:hidden;will-change:transform}:host-context([dir=rtl]) .picker-opt{right:0}.picker-opt.picker-opt-disabled{pointer-events:none}.picker-opt-disabled{opacity:0}.picker-opts-left{-ms-flex-pack:start;justify-content:flex-start}.picker-opts-right,:host-context([dir=rtl]) .picker-opts-left{-ms-flex-pack:end;justify-content:flex-end}:host-context([dir=rtl]) .picker-opts-right{-ms-flex-pack:start;justify-content:flex-start}.picker-opt:active,.picker-opt:focus{outline:none}.picker-prefix{text-align:end}.picker-prefix,.picker-suffix{position:relative;-ms-flex:1;flex:1;white-space:nowrap}.picker-suffix{text-align:start}.picker-col{padding-left:8px;padding-right:8px;padding-top:0;padding-bottom:0;-webkit-transform-style:preserve-3d;transform-style:preserve-3d}\@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){.picker-col{padding-left:unset;padding-right:unset;-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px}}.picker-opts,.picker-prefix,.picker-suffix{top:77px;-webkit-transform-style:preserve-3d;transform-style:preserve-3d;color:inherit;font-size:22px;line-height:42px;pointer-events:none}.picker-opt{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;height:43px;-webkit-transition-timing-function:ease-out;transition-timing-function:ease-out;background:transparent;color:inherit;font-size:22px;line-height:42px;-webkit-backface-visibility:hidden;backface-visibility:hidden;pointer-events:auto}.picker-opt.picker-opt-selected,.picker-prefix,.picker-suffix{color:var(--ion-color-primary,#3880ff)}"},enumerable:!0,configurable:!0}),Object.defineProperty(t,"styleMode",{get:function(){return"md"},enumerable:!0,configurable:!0}),t}(),G="picker-opt-selected",U=.97,$=90,X=150,K=function(){function e(){}return e.prototype.create=function(e){return n.createOverlay(this.doc.createElement("ion-picker"),e)},e.prototype.dismiss=function(e,t,i){return n.dismissOverlay(this.doc,e,t,"ion-picker",i)},e.prototype.getTop=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(e){return[2,n.getOverlay(this.doc,"ion-picker")]})})},Object.defineProperty(e,"is",{get:function(){return"ion-picker-controller"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"properties",{get:function(){return{create:{method:!0},dismiss:{method:!0},doc:{context:"document"},getTop:{method:!0}}},enumerable:!0,configurable:!0}),e}();t.IonDatetime=W,t.IonPicker=J,t.IonPickerColumn=Z,t.IonPickerController=K,Object.defineProperty(t,"__esModule",{value:!0})});