var _____WB$wombat$assign$function_____=function(name){return (globalThis._wb_wombat && globalThis._wb_wombat.local_init && globalThis._wb_wombat.local_init(name))||globalThis[name];};if(!globalThis.__WB_pmw){globalThis.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}var window = _____WB$wombat$assign$function_____("window");
var self = _____WB$wombat$assign$function_____("self");
var document = _____WB$wombat$assign$function_____("document");
var location = _____WB$wombat$assign$function_____("location");
var top = _____WB$wombat$assign$function_____("top");
var parent = _____WB$wombat$assign$function_____("parent");
var frames = _____WB$wombat$assign$function_____("frames");
var opener = _____WB$wombat$assign$function_____("opener");
import{K as k,bx as B,al as E,a7 as O,i as D,by as M,a0 as P,bz as R,bA as x,bm as V,bl as W,bk as H,e as Y,a as n,bB as w,bC as z,bD as b,bE as F,bF as G,aC as h,E as J,U as K,W as j,bG as q}from"./app.ZXowmuNl.js";function Q(){const[e,o]=k(!1),l=B(),s=E(0);O(()=>{Date.now()<s.current||o(!1)},[l.lastNegotiation.value]);function _(){s.current=Date.now()+1e3,o(!0)}return{cartUpdated:e,setCartUpdated:_}}function Z(){const e=D(),{violations:o}=M(b),{merchandiseLines:l,shippingAddress:s}=P(),{countryName:_,loading:v}=R(s.value),{value:u}=x(),p=V(),y=W(),d=H(),{negotiate:f}=Y(),{cartUpdated:g,setCartUpdated:C}=Q();if(!u||u.lines.length===0||v)return null;if(g)return n(w,{heading:e("merchandise_unavailable_in_buyer_location.cart_updated","Your cart has been updated."),tone:"info"});if(o.size===0)return null;const t=z(Array.from(o),u,Array.from(b)),A=t?.map(({stableId:a})=>a),m=l.value.filter(({stableId:a})=>!A?.includes(a)),i=m.length===0;function U(){t!=null&&(l.value=m,f({onComplete:C}))}function I(){q(p,y,d.hasStorefront)}if(t==null)return null;const c=Array.from(o).some(({code:a})=>a==="MERCHANDISE_PRODUCT_NOT_PUBLISHED_IN_BUYER_LOCATION")?_??e("merchandise_unavailable_in_buyer_location.missing_country_fallback","your country"):e("merchandise_unavailable_in_buyer_location.indeterminate_location_fallback","your location");let r=null;i&&t.length===1?r=e("merchandise_unavailable_in_buyer_location.banner_title.all_products_one",{location_name:c},"The product in your cart is not available for delivery to %{location_name}."):i?r=e("merchandise_unavailable_in_buyer_location.banner_title.all_products_other",{location_name:c},"The products in your cart are not available for delivery to %{location_name}."):t.length===1?r=e("merchandise_unavailable_in_buyer_location.banner_title.some_products_one",{location_name:c},"This product is not available for delivery to %{location_name}."):r=e("merchandise_unavailable_in_buyer_location.banner_title.some_products_other",{location_name:c},"These products are not available for delivery to %{location_name}.");const L=i?null:n(G,{children:t.map(a=>n(F,{children:a.subtitle?e("merchandise_unavailable_in_buyer_location.unavailable_line_item",{product_name:a.title,variant_label:a.subtitle},"%{product_name} / %{variant_label}"):a.title},a.stableId))}),T=t.length===1?e("merchandise_unavailable_in_buyer_location.remove_items_action.one","remove unavailable item"):e("merchandise_unavailable_in_buyer_location.remove_items_action.other","remove unavailable items"),N=e("merchandise_unavailable_in_buyer_location.empty_cart_action","empty cart and return to store"),S=n(J,{children:!i||i&&d.hasStorefront?e("merchandise_unavailable_in_buyer_location.change_address_or_remove",{remove_action:i?n(h,{onClick:I,children:N}):n(h,{onClick:U,children:T})},"Change delivery address or %{remove_action}."):e("merchandise_unavailable_in_buyer_location.change_address_only","Change delivery address to continue.")});return n(j,{heading:r,tone:"critical",children:n(K,{children:[L,S]})})}export{Z as U};