import{d as s}from"./dayjs.min-BZ3vM70Q.js";import{g as l}from"./app-BiexncSX.js";var i={exports:{}},_=i.exports,u;function x(){return u||(u=1,(function(r,t){(function(e,a){r.exports=a()})(_,(function(){return function(e,a){a.prototype.isSameOrAfter=function(o,n){return this.isSame(o,n)||this.isAfter(o,n)}}}))})(i)),i.exports}var m=x();const O=l(m);var f={exports:{}},S=f.exports,c;function h(){return c||(c=1,(function(r,t){(function(e,a){r.exports=a()})(S,(function(){return function(e,a){a.prototype.isSameOrBefore=function(o,n){return this.isSame(o,n)||this.isBefore(o,n)}}}))})(f)),f.exports}var v=h();const A=l(v);s.extend(O);s.extend(A);function R(r){return r.reduce((t,e)=>t+e.adults,0)}function j(r){return r.reduce((t,e)=>t+e.children,0)}function B(r,t,e){if(!r)return 0;let a=r.price;return r.is_variant_selected&&r.variant&&(a=r.variant.price),r.is_entire_stay?a*t*e:a*r.selected_days.length*e}function y(r){return r.reduce((t,e)=>t+e.price,0)}function T(r,t){const e=B(r.meal_package,t,r.adults+r.children);return y(r.room_daily_prices)+e}function $(r){return r.rooms.reduce((e,a)=>e+T(a,r.nights),0)}function g(r,t){if(t===0)return 0;let e=0;return r.value_type==="fixed"?e=Number(r.value):e=t*Number(r.value)/100,r.direction==="add"?e:-e}function C(r,t=0,e=0,a=0){const o=s();return r.filter(n=>{if(!n.is_active)return!1;const d=!n.start_date||s(n.start_date).isSameOrBefore(o,"day"),p=!n.end_date||s(n.end_date).isSameOrAfter(o,"day");return!(!d||!p||t>0&&(n.min_rooms&&n.min_rooms>t||n.max_rooms&&n.max_rooms<t)||e>0&&(n.min_nights&&n.min_nights>e||n.max_nights&&n.max_nights<e)||a>0&&(n.min_total&&n.min_total>a||n.max_total&&n.max_total<a))})}function q(r){const t=$(r);if(t===0)return 0;let e=t;return r.price_data.forEach(a=>{e+=g(a,t)}),e}function N(r){return{...r,total_price:q(r)}}export{B as a,T as b,y as c,$ as d,q as e,C as f,g,R as h,j as i,N as j};
