(()=>{"use strict";var e,t={20:(e,t,s)=>{var i=s(609),r=Symbol.for("react.element"),n=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),a=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function o(e,t,s){var i,o={},c=null,p=null;for(i in void 0!==s&&(c=""+s),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(p=t.ref),t)n.call(t,i)&&!l.hasOwnProperty(i)&&(o[i]=t[i]);if(e&&e.defaultProps)for(i in t=e.defaultProps)void 0===o[i]&&(o[i]=t[i]);return{$$typeof:r,type:e,key:c,ref:p,props:o,_owner:a.current}}t.jsx=o,t.jsxs=o},609:e=>{e.exports=window.React},848:(e,t,s)=>{e.exports=s(20)},890:(e,t,s)=>{const i=window.wp.i18n,r=window.wp.element,n=window.wp.data,a=window.wp.plugins,l=window.wc.wcSettings,o=window.wc.priceFormat,c=window.wc.blocksCheckout;var p=s(848);const u=(0,l.getSetting)("displayCartPricesIncludingTax",!1),d=(0,l.getSetting)("collectableMethodIds",[]),_=(0,l.getSetting)("localPickupEnabled",!1),g=e=>!!_&&(Array.isArray(e.method_id)?e.method_id.some((e=>d.includes(e))):d.includes(e.method_id)),h=({extensions:e,cart:t})=>{const{future_subscriptions:s}=e.flexibleSubscriptions||{};return s&&0!==s.length?s.map((e=>{const{key:s,first_payment_date:r,billing_frequency_readable:n,expiration_readable:a,totals:l,shipping_rates:d=[]}=e,_=(0,o.getCurrencyFromPriceResponse)(l),g=(0,i.sprintf)(
// translators: %s: recurring interval string (e.g. "month" or "every 2 weeks").
// translators: %s: recurring interval string (e.g. "month" or "every 2 weeks").
(0,i.__)("Recurring total (every %s)","flexible-subscriptions"),n),h=a&&a.length>0?(0,i.sprintf)(
// translators: %s: expiration period (e.g. "for 6 months").
// translators: %s: expiration period (e.g. "for 6 months").
(0,i.__)("for %s","flexible-subscriptions"),a):"",f=(0,i.sprintf)(
// translators: %s: formatted date.
// translators: %s: formatted date.
(0,i.__)("First renewal: %s","flexible-subscriptions"),r),b=(e=>u?parseInt(e.total_shipping,10)+parseInt(e.total_shipping_tax,10):parseInt(e.total_shipping,10))(l),x=0===b?(0,p.jsx)("strong",{children:(0,i.__)("Free","flexible-subscriptions")}):b,m=(k=d,k?.flatMap((e=>e.shipping_rates||[])).find((e=>e.selected))?.name);var k;return(0,p.jsxs)("div",{className:"fsb-recurring-totals-panel",children:[(0,p.jsx)(c.TotalsItem,{className:"fsb-recurring-totals-panel__title",currency:_,label:g,value:parseInt(l.total_price,10),description:`${f} ${h}`}),(0,p.jsxs)(c.Panel,{className:"fsb-recurring-totals-panel__details",initialOpen:!1,title:(0,i.__)("Details","flexible-subscriptions"),children:[(0,p.jsx)(c.TotalsWrapper,{children:(0,p.jsx)(c.Subtotal,{currency:_,values:l})}),t.cartNeedsShipping&&t.cartHasCalculatedShipping&&(0,p.jsx)(c.TotalsWrapper,{className:"wc-block-components-totals-shipping",children:(0,p.jsx)(c.TotalsItem,{value:x,currency:_,label:(0,i.__)("Shipping","flexible-subscriptions"),description:!!m&&(0,i.sprintf)((0,i.__)("Via %s","flexible-subscriptions"),m)})}),!u&&(0,p.jsx)(c.TotalsWrapper,{children:(0,p.jsx)(c.TotalsTaxes,{currency:_,values:l})}),(0,p.jsx)(c.TotalsWrapper,{children:(0,p.jsx)(c.TotalsItem,{className:"fsb-recurring-totals-panel__details-total",currency:_,label:(0,i.__)("Total","flexible-subscriptions"),value:parseInt(l.total_price,10)})})]})]},s)})):null},f=({extensions:e,collapsible:t,collapse:s,showItems:i,noResultsMessage:n,renderOption:a,components:l,context:o})=>{const{future_subscriptions:c=[]}=e.flexibleSubscriptions||{},{ShippingRatesControlPackage:u}=l,d=(0,r.useMemo)((()=>c.map((e=>e.shipping_rates)).filter(Boolean).flat()),[c]),_=(0,r.useMemo)((()=>d.length>1||s),[d.length,s]),h=(0,r.useMemo)((()=>d.length>1||i),[d.length,i]);return d.filter((e=>!e.match_initial_rates&&e.needs_shipping)).map((({package_id:e,...s})=>(s.shipping_rates=(s.shipping_rates||[]).filter((e=>!g(e))),(0,p.jsx)(u,{packageId:e,packageData:s,collapsible:t,collapse:_,showItems:h,noResultsMessage:n,renderOption:a,highlightChecked:"woocommerce/checkout"===o},e))))},b=({packageId:e,packageData:t,showItems:s,renderPickupLocation:i,pickupLocations:a,packageCount:l,LocalPickupSelect:o})=>{var c;const{selectShippingRate:u}=(0,n.useDispatch)(window.wc.wcBlocksData.cartStore),d=null!==(c=t.shipping_rates.find((e=>e.selected))?.rate_id)&&void 0!==c?c:t.shipping_rates[0]?.rate_id,[_,g]=(0,r.useState)(d);return(0,r.useEffect)((()=>{_&&u(_,e)}),[]),(0,p.jsx)(o,{title:t.name,packageData:t,selectedOption:null!=_?_:"",showItems:s,renderPickupLocation:i,pickupLocations:a,packageCount:l,onChange:t=>{g(t),u(t,e)}})},x=({extensions:e,showItems:t,renderPickupLocation:s,components:i})=>{const{future_subscriptions:n=[]}=e.flexibleSubscriptions||{},{LocalPickupSelect:a}=i;if(!_)return null;const l=(0,r.useMemo)((()=>n.map((e=>e.shipping_rates)).filter(Boolean).flat()),[n]),o=(0,r.useMemo)((()=>l.length>1||t),[l.length,t]);return l.filter((e=>!e.match_initial_rates)).map((({package_id:e,...t})=>(t.shipping_rates=(t.shipping_rates||[]).filter((e=>g(e))),0===t.shipping_rates.length?null:(0,p.jsx)(b,{packageId:e,packageData:t,showItems:o,renderPickupLocation:s,pickupLocations:t.shipping_rates,packageCount:l.length,LocalPickupSelect:a},e))))};(0,a.registerPlugin)("flexible-subscriptions",{render:()=>(0,p.jsxs)(r.Fragment,{children:[(0,p.jsx)(c.ExperimentalOrderShippingPackages,{children:(0,p.jsx)(f,{})}),(0,p.jsx)(c.ExperimentalOrderLocalPickupPackages,{children:(0,p.jsx)(x,{})}),(0,p.jsx)(c.ExperimentalOrderMeta,{children:(0,p.jsx)(h,{})})]}),scope:"woocommerce-checkout"}),(0,c.registerCheckoutFilters)("flexible-subscriptions",{totalLabel:(e,{flexibleSubscriptions:t})=>{const{future_subscriptions:s}=t||{};return s?.length>0?(0,i.__)("Total due today","flexible-subscriptions"):e},placeOrderButtonLabel:e=>{const t=(0,l.getSetting)("flexible-subscriptions_data",{});return t?.place_order_override||e},cartItemPrice:(e,{flexibleSubscriptions:t})=>t?.signup_fee>0?(0,i.sprintf)(
// translators: %s is the subscription price to pay immediately (e.g. "$10").
// translators: %s is the subscription price to pay immediately (e.g. "$10").
(0,i.__)("%s due today","flexible-subscriptions"),e):e})}},s={};function i(e){var r=s[e];if(void 0!==r)return r.exports;var n=s[e]={exports:{}};return t[e](n,n.exports,i),n.exports}i.m=t,e=[],i.O=(t,s,r,n)=>{if(!s){var a=1/0;for(p=0;p<e.length;p++){for(var[s,r,n]=e[p],l=!0,o=0;o<s.length;o++)(!1&n||a>=n)&&Object.keys(i.O).every((e=>i.O[e](s[o])))?s.splice(o--,1):(l=!1,n<a&&(a=n));if(l){e.splice(p--,1);var c=r();void 0!==c&&(t=c)}}return t}n=n||0;for(var p=e.length;p>0&&e[p-1][2]>n;p--)e[p]=e[p-1];e[p]=[s,r,n]},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={57:0,350:0};i.O.j=t=>0===e[t];var t=(t,s)=>{var r,n,[a,l,o]=s,c=0;if(a.some((t=>0!==e[t]))){for(r in l)i.o(l,r)&&(i.m[r]=l[r]);if(o)var p=o(i)}for(t&&t(s);c<a.length;c++)n=a[c],i.o(e,n)&&e[n]&&e[n][0](),e[n]=0;return i.O(p)},s=globalThis.webpackChunkflexible_subscriptions=globalThis.webpackChunkflexible_subscriptions||[];s.forEach(t.bind(null,0)),s.push=t.bind(null,s.push.bind(s))})();var r=i.O(void 0,[350],(()=>i(890)));r=i.O(r)})();