1"use strict";(()=>{var F=12,l={};(function(){"use strict";function j(s){if(!s||!s.length)return"";var w=s.find(".picker:eq(0)");if(!w.length||!w.attr("data-timezone_conversion"))return"";var y=s.find('select#wc_appointments_field_timezone, select[name="wc_appointments_field_timezone"]');if(y.length&&y.val())return y.val();if(typeof wca_get_cookie=="function"){var k=wca_get_cookie("appointments_time_zone");if(k)return decodeURIComponent(k)}return""}function M(s){var w=s.getFullYear(),y=String(s.getMonth()+1).padStart(2,"0"),k=String(s.getDate()).padStart(2,"0");return w+"-"+y+"-"+k}function C(s){var w,y,k={},T={is_autoselect:function(a){return String(a.attr("data-is_autoselect"))==="1"},init:function(){s("body").on("change","#wc_appointments_field_staff",this.staff_calendar),s("body").on("click",".wc-appointments-date-picker legend small.wc-appointments-date-picker-choose-date",this.toggle_calendar),s("body").on("click",".appointment_date_year, .appointment_date_month, .appointment_date_day",this.open_calendar),s("body").on("input",".appointment_date_year, .appointment_date_month, .appointment_date_day",this.input_date_trigger),s("body").on("change",".appointment_to_date_year, .appointment_to_date_month, .appointment_to_date_day",this.input_date_trigger),s("body").on("click",".wc-appointments-selection-clear-date",function(){var a=s(this).closest("form");typeof wca_clear_date_selection=="function"&&wca_clear_date_selection(a)}),s(".wc-appointments-date-picker legend small.wc-appointments-date-picker-choose-date").show(),s(".wc-appointments-date-picker").each(function(){var a=s(this).closest("form"),t=a.find(".picker:eq(0)"),e=s(this).closest("fieldset"),i=t.attr("data-duration_unit");a.on("timezone-selected",function(){l.rrule_cache={},l.date_picker_init(t)}),s.inArray(i,["minute","hour"])===-1&&a.on("addon-duration-changed",function(o,r){var _=parseInt(t.attr("data-appointment_duration"),10),p=parseInt(r,10),u=parseInt(_+p,10);t.data("combined_duration",u),t.data("addon_duration",r),l.highlight_days(a)});var n=a.find("select#wc_appointments_field_staff");n.length>0&&wca_get_querystring("staff")!==null&&n.val()!=wca_get_querystring("staff")||(n.length>0&&wca_get_querystring("staff")!==null&&n.val()==wca_get_querystring("staff")&&(l.ignore_initial_staff_change=!0,setTimeout(function(){l.ignore_initial_staff_change=!1},200)),l.date_picker_init(t)),s(".wc-appointments-date-picker-date-fields",e).hide(),s(".wc-appointments-date-picker-choose-date",e).hide()})},highlight_days:function(a){var t=a.find(".picker"),e=t.find("td.ui-datepicker-current-day").not(".ui-state-disabled"),i=t.attr("data-appointment_duration"),n=t.data("combined_duration")?t.data("combined_duration"):i,o=(1>n?1:n)-1;t.find("td").removeClass("appointable-range"),0<o&&e.nextAll("td").add(e.closest("tr").nextAll().find("td")).slice(0,o).addClass("appointable-range")},staff_calendar:function(){if(!l.ignore_initial_staff_change){var a=s(this).closest("form"),t=a.find(".picker:eq(0)");l.is_autoselect(t)&&typeof wca_clear_date_selection=="function"&&(wca_clear_date_selection(a),t.removeData("wca_navigated_month_first")),l.date_picker_init(t)}},toggle_calendar:function(){var a=s(this).closest("fieldset").find(".picker:eq(0)");l.date_picker_init(a),a.slideToggle()},open_calendar:function(){var a=s(this).closest("fieldset").find(".picker:eq(0)");l.date_picker_init(a),a.slideDown()},input_date_trigger:function(){var a=s(this).closest("fieldset"),t=a.find(".picker:eq(0)"),e=parseInt(a.find("input.appointment_date_year").val(),10),i=parseInt(a.find("input.appointment_date_month").val(),10),n=parseInt(a.find("input.appointment_date_day").val(),10);if(e&&i&&n){var o=new Date(e,i-1,n);t.datepicker("setDate",o)}},select_date_trigger:function(a){var t=s(this).closest("fieldset"),e=t.closest("form"),i=e.find(".picker:eq(0)"),n=a.split("-"),o=parseInt(n[0],10),r=parseInt(n[1],10),_=parseInt(n[2],10),p=i.attr("data-duration_unit"),u=i.attr("data-appointment_duration"),f=i.data("combined_duration")?i.data("combined_duration"):u;if(s.inArray(p,["minute","hour"])===-1){var m=1>f?1:f;w=new Date(o,r-1,_),y=new Date(o,r-1,_+(parseInt(m,10)-1)),l.highlight_days(e)}t.find("input.appointment_to_date_year").val(""),t.find("input.appointment_to_date_month").val(""),t.find("input.appointment_to_date_day").val(""),t.find("input.appointment_date_year").val(n[0]),t.find("input.appointment_date_month").val(n[1]),t.find("input.appointment_date_day").val(n[2]).trigger("change"),e.find(".wc-appointments-appointment-form-button").prop("disabled",!0),typeof wca_update_selection_info=="function"&&wca_update_selection_info(e,a,null);var d=t.closest(".wc-appointments-appointment-form");e.triggerHandler("date-selected",a),d.length&&d.triggerHandler("date-selected",a)},date_picker_init:function(a){var t=new g(a),e=t.customPicker;e.data("wc_appointments_date_picker_instance",t);var i=e.data("wca_navigated_month_first"),n;wca_get_querystring("date")!==null&&wca_is_valid_date(wca_get_querystring("date"))?n=wca_get_querystring("date"):i&&i instanceof Date&&!isNaN(i.getTime())?n=i:n=t.get_data_attr("default_date"),t.set_default_params({onSelect:l.select_date_trigger,minDate:t.get_data_attr("min_date"),maxDate:t.get_data_attr("max_date"),defaultDate:n,changeMonth:t.get_custom_data("changeMonth"),changeYear:t.get_custom_data("changeYear"),showWeek:t.get_custom_data("showWeek"),showOn:t.get_custom_data("showOn"),numberOfMonths:parseInt(t.get_custom_data("numberOfMonths")),showButtonPanel:t.get_custom_data("showButtonPanel"),showOtherMonths:t.get_custom_data("showOtherMonths"),selectOtherMonths:t.get_custom_data("selectOtherMonths"),gotoCurrent:t.get_custom_data("gotoCurrent"),closeText:t.get_custom_data("closeText"),currentText:t.get_custom_data("currentText"),prevText:t.get_custom_data("prevText"),nextText:t.get_custom_data("nextText"),monthNames:t.get_custom_data("monthNames"),monthNamesShort:t.get_custom_data("monthNamesShort"),dayNames:t.get_custom_data("dayNames"),dayNamesMin:t.get_custom_data("dayNamesShort"),firstDay:t.get_custom_data("firstDay"),isRTL:t.get_custom_data("isRTL"),beforeShowDay:t.maybe_load_from_cache.bind(t),onChangeMonthYear:function(o,r){this.cache.attributes={},this._dataLoading=!0,this.get_data(o,r).done(function(){this._dataLoading=!1,a.datepicker("refresh")}.bind(this)),a.data("wca_navigated_month_first",new Date(o,r-1,1)),typeof wca_update_querystring=="function"&&wca_update_querystring("date",null),l.clear_selection_on_month_change(this.customForm),this.customForm.triggerHandler("month-year-changed",o,r)}.bind(t)}),t.create(),l.get_day_attributes=t.maybe_load_from_cache.bind(t)},refresh_datepicker:function(a){var t=a&&a.length?a:s(".wc-appointments-date-picker .picker.hasDatepicker");t.each(function(){s(this).hasClass("hasDatepicker")&&s(this).datepicker("refresh")})},clear_selection_on_month_change:function(a){var t=a.find("fieldset"),e=a.find(".slot-picker");t.find("input.appointment_date_year").val(""),t.find("input.appointment_date_month").val(""),t.find("input.appointment_date_day").val(""),typeof wca_update_querystring=="function"&&wca_update_querystring("time",null),a.find(".wc-appointments-appointment-form-button").prop("disabled",!0),a.find(".wc-appointments-appointment-hook-after, .wc-appointments-recurring-hook").hide(),a.find(".wc-appointments-appointment-cost").hide(),e.length&&(e.find("li").removeClass("selected"),e.parent("div").find("input").val("").removeAttr("data-value").removeAttr("data-slot-timestamp"),a.find(".slot-timestamp-field").val(""),e.hide()),typeof wca_update_selection_info=="function"&&wca_update_selection_info(a,null)},get_number_of_days:function(a,t,e){var i=a,n=e.attr("data-duration_unit"),o=e.attr("data-appointment_duration"),r=e.data("combined_duration")?e.data("combined_duration"):o,_=e.attr("data-availability_span");return s.inArray(n,["minute","hour"])===-1&&(i=1>r?1:r),(1>i||_==="start")&&(i=1),i},rrule_cache:{},get_format_date:function(a){var t=a.getFullYear(),e=(10>a.getMonth()+1?"0":"")+(a.getMonth()+1),i=(10>a.getDate()?"0":"")+a.getDate();return t+"-"+e+"-"+i},get_relative_date:function(a){for(var t=new Date,e=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,i=e.exec(a);i;){switch(i[2]||"d"){case"d":case"D":t.setDate(t.getDate()+parseInt(i[1],10));break;case"w":case"W":t.setDate((t.getDate()+parseInt(i[1],10))*7);break;case"m":case"M":t.setMonth(t.getMonth()+parseInt(i[1],10));break;case"y":case"Y":t.setYear(t.getFullYear()+parseInt(i[1],10));break}i=e.exec(a)}return t}},g=function(t){this.customPicker=s(t),this.customForm=this.customPicker.closest("form, .cart"),this.customData={},this.opts={cache:!1},this.cache={data:{},attributes:{}},this._dataLoading=!1,s.each(wc_appointment_form_params,function(e,i){this.customData[e]=i}.bind(this)),this.customData.cache_ajax_requests&&(this.customData.cache_ajax_requests.toLowerCase()==="true"||this.customData.cache_ajax_requests.toLowerCase()==="false")&&(this.opts.cache=this.customData.cache_ajax_requests.toLowerCase()==="true"),this.opts.cache=!1};g.prototype.create=function(){var t=parseInt(this.customForm.find("input.appointment_date_year").val(),10),e=parseInt(this.customForm.find("input.appointment_date_month").val(),10),i=parseInt(this.customForm.find("input.appointment_date_day").val(),10);this.customPicker.empty().removeClass("hasDatepicker").datepicker(this.get_default_params()),t&&e&&i?this.customPicker.datepicker("setDate",new Date(t,e-1,i)):this.defaultParams.defaultDate&&this.customPicker.datepicker("setDate",this.defaultParams.defaultDate);var n=this.customPicker.datepicker("getDate").getFullYear(),o=this.customPicker.datepicker("getDate").getMonth()+1;this._dataLoading=!0,this.get_data(n,o).done(function(){this._dataLoading=!1,l.refresh_datepicker(this.customPicker)}.bind(this)).done(function(){var r,_,p,u,f,m;if(u=l.is_autoselect(this.customPicker),r=wca_get_querystring("date"),_=r!==null&&wca_is_valid_date(r),p=!_&&u,_){this.customPicker.datepicker("refresh");var d=r.split("-"),v=new Date(parseInt(d[0],10),parseInt(d[1],10)-1,parseInt(d[2],10));this.customPicker.datepicker("setDate",v),l.select_date_trigger.call(this.customPicker[0],r)}else if(p){var f=this.customPicker.datepicker("getDate"),m=f?new Date(f.getFullYear(),f.getMonth(),f.getDate()).getTime():Date.now();this.autoselect_first_available_day(m,0)}else this.customPicker.find(".ui-datepicker-current-day").removeClass("ui-datepicker-current-day")})},g.prototype.maybe_load_from_cache=function(t){var e=t.getTime(),i=this.customData.default_availability==="1"?"appointable":"not_appointable",n=[!1,i,""],o=this.customData.disable_slots_cache?void 0:this.cache.attributes[e];if(this._dataLoading)return[!1,"not_appointable",""];if(o)o=[o.selectable,o.class.join(" "),o.title];else if(this.appointmentsData){var r=new Date(t);r.setHours(F);var _=this.getDateElementAttributes(r);n=[_.selectable,_.class.join(" "),_.title]}return o||n},g.prototype.get_selected_staff_id=function(){var t=parseInt(this.customForm.find("select#wc_appointments_field_staff").val(),10);return t>0?t:0},g.prototype.get_effective_day_entry=function(t,e){return t?e&&t.per_staff&&t.per_staff[e]?t.per_staff[e]:!e&&t.per_staff&&t.per_staff[0]?t.per_staff[0]:t:null},g.prototype.autoselect_first_available_day=function(t,e){var i=this.get_selected_staff_id(),n=this.appointmentsData&&this.appointmentsData.day_data,o,r=null,_,p,u;if(e=e||0,!(12<e)){if(n&&s.each(n,function(f,m){var d=String(f).split("-"),v,h,c;d.length===3&&(v=new Date(parseInt(d[0],10),parseInt(d[1],10)-1,parseInt(d[2],10)),h=v.getTime(),!(h<t)&&(c=this.get_effective_day_entry(m,i),c&&c.selectable&&(r===null||h<r)&&(r=h,o=v)))}.bind(this)),o){u=o.getFullYear()+"-"+(o.getMonth()+1)+"-"+o.getDate(),this.customPicker.datepicker("setDate",o).datepicker("refresh"),l.select_date_trigger.call(this.customPicker[0],u);return}_=this.customPicker.datepicker("getDate"),p=new Date(_.getFullYear(),_.getMonth()+1,
11),this.customPicker.datepicker("setDate",p),this._dataLoading=!0,this.get_data(p.getFullYear(),p.getMonth()+1).done(function(){this._dataLoading=!1,this.customPicker.datepicker("refresh"),this.autoselect_first_available_day(t,e+1)}.bind(this))}},g.prototype.renderVisibleDayPrices=function(){if(!(!this.customPicker.length||!this.appointmentsData||!this.appointmentsData.day_data)){var t=this.get_selected_staff_id();this.customPicker.find(".ui-datepicker-calendar td").each(function(e,i){var n=s(i),o=n.children("a.ui-state-default, span.ui-state-default").first();if(n.removeClass("has-slot-price discounted_day"),n.find(".wca-day-price").remove(),!!o.length){var r=parseInt(n.attr("data-year"),10),_=parseInt(n.attr("data-month"),10),p=parseInt(o.text(),10);if(!(isNaN(r)||isNaN(_)||isNaN(p))){var u=this.appointmentsData.day_data[r+"-"+(_+1)+"-"+p],f=this.get_effective_day_entry(u,t),m=f&&f.price?f.price:null;!m||!m.show||n.addClass("has-slot-price discounted_day")}}}.bind(this))}},g.prototype.get_default_params=function(){return this.defaultParams||{}},g.prototype.set_default_params=function(t){var e={showWeek:!1,showOn:!1,numberOfMonths:1,showButtonPanel:!1,showOtherMonths:!0,selectOtherMonths:!0,gotoCurrent:!0,dateFormat:s.datepicker.ISO_8601};if(typeof t!="object")throw new Error("Cannot set params with typeof "+typeof t);this.defaultParams=s.extend(e,t)||{}},g.prototype.get_data=function(t,e){var i={background:"#fff",opacity:.6},n=function(v){v||(v=new Date([t,e,"01"].join("/")));var h=this.get_number_of_days_in_month(e);return this.get_padded_date_range(v,h)}.bind(this),o=s.Deferred(),r=n(),_=0<this.customForm.find("select#wc_appointments_field_staff").val()?this.customForm.find("select#wc_appointments_field_staff").val():0,p=j(this.customForm)||"site",u=r.startDate.getTime()+"-"+r.endDate.getTime()+"-"+(_||"0")+"-"+p;if(k=r,this.opts.cache&&this.cache.data[u])o.resolveWith(this,[r,this.cache.data[u]]);else{var f=this.customPicker.attr("data-product_id");if(!f)return this.appointmentsData=this.appointmentsData||{},this.appointmentsData.fully_scheduled_days||(this.appointmentsData.fully_scheduled_days={}),o.resolveWith(this,[r,{}]),o;var m={"wc-ajax":"wc_appointments_find_scheduled_day_slots",product_id:f,security:this.get_custom_data("nonce_find_day_slots")};this.customForm.find(".wca-loading-bar").not(".wc-appointments-slots-container .wca-loading-bar").addClass("is-active"),m.min_date=M(r.startDate),m.max_date=M(r.endDate),_&&_!==0&&(m.set_staff_id=_),p!=="site"&&(m.display_timezone=p),s.ajax({context:this,url:wc_appointments_date_picker_args.ajax_url,method:"POST",data:m,dataType:"json"}).done(function(d){this.appointmentsData=this.appointmentsData||{};var v=function(h){var c=h,b;for(b=0;b<2&&typeof c=="string";b++)try{c=JSON.parse(c)}catch{return{}}return!c||typeof c!="object"||Array.isArray(c)?{}:c};d=v(d),d.fully_scheduled_days||(d.fully_scheduled_days={}),d.unavailable_days||(d.unavailable_days={}),d.partially_scheduled_days||(d.partially_scheduled_days={}),d.remaining_scheduled_days||(d.remaining_scheduled_days={}),d.meta&&d.meta.engine!=null&&this.customPicker.attr("data-engine",d.meta.engine),s.each(d,function(h,c){if(Array.isArray(c)||typeof c=="object"){var b=Array.isArray(c)?[]:{};this.appointmentsData[h]=this.appointmentsData[h]||b,s.extend(this.appointmentsData[h],c)}else this.appointmentsData[h]=c}.bind(this)),T.appointmentsData=this.appointmentsData,this.customData.disable_slots_cache||(this.cache.data[u]=d),!t&&!e&&this.appointmentsData.min_date&&(r=n(this.get_default_date(this.appointmentsData.min_date))),o.resolveWith(this,[r,d]),this.customForm.find(".wca-loading-bar").not(".wc-appointments-slots-container .wca-loading-bar").removeClass("is-active"),this.customForm.triggerHandler("calendar-data-loaded",[this.appointmentsData,r])}.bind(this)).fail(function(){this._dataLoading=!1,this.customForm.find(".wca-loading-bar").not(".wc-appointments-slots-container .wca-loading-bar").removeClass("is-active"),o.resolveWith(this,[r,{}])}.bind(this))}return o},g.prototype.get_default_date=function(t){var e,i=this.customPicker.data("default_date").split("-");i[2]="31";var n=1;if(e=i.length!==3?new Date:new Date(i),t){switch(t.unit){case"month":n=30;break;case"week":n=7;break}n=n*t.value,e.setDate(e.getDate()+n)}return e},g.prototype.get_number_of_days_in_month=function(t){var e=this.get_default_date();return t=t||e.getMonth()+1,new Date(e.getFullYear(),t,0).getDate()},g.prototype.get_custom_data=function(t){if(t)return t in this.customData?this.customData[t]:null},g.prototype.get_data_attr=function(t){if(t)return this.customPicker.data(t)}
1,g.prototype.get_padded_date_range=function(t,e,i){t=t||this.get_default_date(),e=e||30,i=i||7;var n=new Date,o=t<n,r=new Date(t.setDate(o?n.getDate():"01")),_=new Date(r.getTime());return r.setDate(r.getDate()-(o?0:i)),_.setDate(_.getDate()+(e+i)),r<n&&(r=n),{startDate:r,endDate:_}},g.prototype.getDateElementAttributes=function(t){var e={class:[],title:"",selectable:!0},i=this.get_selected_staff_id(),n=t.getFullYear(),o=t.getMonth()+1,r=t.getDate(),_=t.getDay(),p=new Date(t),u=new Date,f=u.getFullYear(),m=u.getMonth()+1,d=u.getDate(),v=n+"-"+o+"-"+r;if(e.class.push("weekday-"+_),typeof w<"u"&&typeof y<"u"&&(w.setHours(F),y.setHours(F)),t>=w&&t<=y&&e.class.push("appointable-range"),new Date(n,o,r)<new Date(f,m,d)&&e.class.push("past_day"),this.appointmentsData.day_data){var h=this.appointmentsData.day_data[v];if(!h||h.padding||h.restricted)return e.title=wc_appointment_form_params.i18n_date_unavailable,e.selectable=!1,e.class.push("not_appointable"),e;var c=this.get_effective_day_entry(h,i),b=l.get_number_of_days(this.appointmentsData.appointment_duration,this.customForm,this.customPicker),O=this.appointmentsData.duration_unit||"";if(b>1&&s.inArray(O,["minute","hour"])!==-1)for(var x=1;x<b;x++){var D=new Date(t);D.setDate(D.getDate()+x);var Y=D.getFullYear()+"-"+(D.getMonth()+1)+"-"+D.getDate(),P=this.appointmentsData.day_data[Y];if(!P||!P.selectable||i&&P.per_staff&&P.per_staff[i]&&!P.per_staff[i].selectable)return e.title=wc_appointment_form_params.i18n_date_unavailable,e.selectable=!1,e.class.push("not_appointable"),e}e.selectable=c.selectable,e.class.push(c.css_class);var N=c.occupancy_pct&&c.occupancy_pct>0||c.booked_slots&&c.booked_slots>0||c.slots_with_bookings&&c.slots_with_bookings>0;if(N&&c.selectable&&(e.class.indexOf("partial_scheduled")===-1&&e.class.push("partial_scheduled"),c.remaining_bucket&&c.remaining_bucket>0&&e.class.push("remaining_scheduled_"+c.remaining_bucket)),c.selectable?-1<e.class.indexOf("partial_scheduled")?e.title=wc_appointment_form_params.i18n_date_partially_scheduled:-1<e.class.indexOf("past_day")?(e.title=wc_appointment_form_params.i18n_date_unavailable,e.selectable=!1):e.title=wc_appointment_form_params.i18n_date_available:c.css_class==="fully_scheduled"?e.title=wc_appointment_form_params.i18n_date_fully_scheduled:e.title=wc_appointment_form_params.i18n_date_unavailable,e.selectable){var q=e.class.indexOf("not_appointable");q>-1&&e.class.splice(q,1),e.class.indexOf("appointable")===-1&&e.class.push("appointable")}return c.price&&c.price.show&&(e.class.push("has-slot-price"),e.class.push("discounted_day")),e}return e.title=wc_appointment_form_params.i18n_date_unavailable,e.selectable=!1,e.class.push("not_appointable"),e},l=T,l.init()}function A(s){try{C(s)}catch(w){console.error("WC Appointments: Error initializing date picker:",w),setTimeout(function(){try{C(s)}catch(y){console.error("WC Appointments: Failed to initialize date picker after retry:",y)}},500)}}var I=!1;wcaShared.whenDepsReady(function(){return typeof jQuery<"u"&&jQuery.fn&&typeof jQuery.fn.datepicker=="function"&&typeof wc_appointment_form_params<"u"},function(){I||(I=!0,A(jQuery))},"date-picker")})();})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.