1import{x as e,m as t,a0 as a,O as n,z as r,t as l,l as i,u as o,v as s,T as c,C as u,w as d,f as h}from"./2c1ab0fe.GMbxnz74.js";import{cV as m,H as p,P as v,L as b,c as f,B as g,a3 as y,F as _,o as w,W as x,I as k,c0 as T,i as S,e as I,a2 as A,J as V,cW as j,b as q,ap as E,am as z,an as P,ao as N,aj as C,ag as D,ak as R,cX as $}from"./164ad2e3.B4L1MRYB.js";import{S as L}from"./79974aab.DPBsbYrf.js";import{T as U,S as M,J as W,bF as H,bE as B}from"./4c290a1e.DMQ9xOwP.js";import{u as F}from"./5fda1420.BLaDhoyL.js";import{u as G,S as O}from"./ca5e9c49.DIuWAPOX.js";import{S as J}from"./app.DGSHpWaV.js";import{d as Q}from"./b8733b27.05ur1szn.js";import"./9f047e05.DwjCPgK0.js";import"./0a7dffce.BcNpdEJk.js";import"./60a453ce.Cg9T1Gj2.js";import"./21cc90a2.Ccyorzx_.js";import"./bb728e1c.CHt2JlPY.js";function X(){const[a,n]=e("undefined"==typeof document?"visible":document.visibilityState);return t(()=>{const e=()=>n(document.visibilityState);return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}},[]),a}function Z(e){return!1===e.available}const K={id:"186ea50e2b37f36013ff760cddcee64b27d2785edc79d3078d8bb95e4186410b",type:"query",name:"ThrottlePoll",source:"query ThrottlePoll($token:String!,$variantIdsV2:[Int!]){poll(token:$token,variantIdsV2:$variantIdsV2){...on PollContinue{token pollAfter queueEtaSeconds productVariantAvailabilityV2{available id __typename}__typename}...on PollComplete{token __typename}__typename}}"};class Y extends J{constructor(){super(...arguments),this.name="ThrottleError",this.defaultGroupingHash="ThrottleError::Exiting::Status"}}class ee extends J{constructor(){super(...arguments),this.name="UnactionableThrottleError",this.unactionable=!0}}function te(e){return parseInt(W(e),10)}function ae({inventoryStatus:e}){const{i18n:t,shop:{hasStorefront:a},url:n,checkout:{configuration:r}}=M(),l="empty"===e?t.translate("stock.empty_cart_label"):t.translate("throttle.inventory.sold_out.heading"),i="empty"===e?t.translate("stock.return_to_store_label"):t.translate("throttle.inventory.sold_out.link");return o(f,{gap:"small-200",alignItems:"center",padding:"large-300",children:[o(p,{level:1,children:l}),a&&"unavailable"===e&&o(v,{size:"large",textAlign:"center",children:t.translate("throttle.inventory.sold_out.storefront_body")}),a&&r.allowRedirectToStorefront&&o(v,{textAlign:"center",children:o(b,{href:n.storefront(),children:i})}),!a&&"unavailable"===e&&o(v,{size:"large",textAlign:"center",children:t.translate("throttle.inventory.sold_out.no_storefront_body")})]})}function ne({heading:e,details:t,children:a}){return o(y,{borderRadius:"base",border:"base",children:[o(g,{padding:"large-200",accessibilityRole:"header",children:o(f,{direction:"inline",gap:"small-200",alignItems:"baseline",children:[o(p,{level:2,children:e}),t?o(v,{color:"subdued",type:"small",children:t}):null]})}),o(g,{borderWidth:"base none none none",padding:"large-200",children:a})]})}function re(){const{i18n:e}=M();return o(x,{tone:"warning",errorType:_.InventoryError,children:o(v,{type:"small",children:o(w,{type:"strong",children:e.translate("throttle.inventory.partial_inventory_banner")})})})}function le({barCount:e=7}){const t={"--ProgressBar-width":13*e+"px"},a=[];for(let n=0;n<e;n++)a.push(o("div",{className:s("zetxR")},n));return o("div",{className:"NMORO",style:t,children:a})}function ie(){const{checkout:e,i18n:t}=M(),a=e.negotiator.throttleState.value,n="queued"===a.status?a.queueEtaSeconds:0,r=c(()=>null==n?t.translate("throttle.estimated_wait_time.calculating"):n<60?t.translate("throttle.estimated_wait_time.less_than_one"):t.translate("throttle.estimated_wait_time",{count:Math.round(n/60)}),[n,t]);return o(f,{alignItems:"center",gap:"large-200",padding:"large-200",children:[o(le,{}),o(f,{gap:"small-200",alignItems:"center",children:[o(p,{level:1,textAlign:"center",children:t.translate("throttle.line_to_check_out")}),o(v,{size:"base",children:r})]})]})}function oe(){const{i18n:e}=M(),t=e.translate("throttle.merchandise.available").trim();return 0===t.length?null:o(v,{children:o(f,{direction:"inline",gap:"small-400",alignItems:"center",children:[o(k,{size:"small-200",tone:"success",type:"check"}),o(w,{type:"strong",tone:"success",size:"small",children:o("span",{className:"broxv",children:t})})]})})}function se(){const{i18n:e}=M(),t=e.translate("throttle.merchandise.sold_out").trim();return 0===t.length?null:o(T,{children:o(f,{direction:"inline",gap:"small-400",alignItems:"center",children:[o(k,{size:"small-200",tone:"critical",type:"disabled"}),o(w,{size:"small",children:o("span",{className:"hG8Tu",children:t})})]})})}function ce(){const{progress:s}=S(),c=r(function(){const[r,l]=e(null),o=m(),s=a(),[c,u]=e(),{value:d}=U().merchandiseLines,{checkout:{negotiator:h},graphql:{throttleGraphql:p},observability:v}=M(),b=h.throttleState.value;if(t(()=>{l(e=>e??new Date)},[]),function(e,a){const n=i(e);
1n.current=e;const r=X();t(()=>{if(!a)return;const e=Math.max(a-Date.now(),0);if(0!==e){const t=setTimeout(n.current,e);return()=>clearTimeout(t)}n.current()},[a,r])}(async()=>{if("queued"===b.status)try{const e=d?d.lines.filter(e=>e.variantId).map(e=>te(e.variantId)):[],{data:t,error:a}=await p.staticQuery(K,{cache:!1,variables:{token:b.token,variantIdsV2:e}});if(!o.current)return;if(a)throw a;if(!t)throw new Y("Throttle poll did not return data",{groupingHash:"ThrottleError::PollMissingReturnData"});const n=function({poll:e},t){if("PollContinue"===e.__typename)return{status:"queued",pollAfter:new Date(e.pollAfter).getTime(),token:e.token,queueEtaSeconds:e.queueEtaSeconds??void 0,productVariantAvailabilityV2:e.productVariantAvailabilityV2,pollUrl:t.pollUrl};if("PollComplete"===e.__typename)return{status:"complete",token:e.token,productVariantAvailabilityV2:t.productVariantAvailabilityV2};throw new Y("unable to handle Throttle type",{groupingHash:"ThrottleError::ThrottleType"})}(t,b);"queued"===n.status&&b?.pollAfter===n.pollAfter&&(n.pollAfter=Date.now()+1e3),h.setThrottle(n),l(new Date),s.reset()}catch(e){const t=s.next(),a=t.done,r=Q(e),l=e instanceof n?e.response.status:void 0;if(a)return u(new(r.actionable?Y:ee)("Throttle exited on maximum retries",{cause:e})),void v.counter({name:"throttle_exited_on_maximum_retries",value:1});if(l&&l<500)return void u(new(r.actionable?Y:ee)(`Throttle exiting on ${l} status`,{cause:e}));h.setThrottle({...b,pollAfter:Date.now()+t.value})}},"queued"===b.status?b.pollAfter:void 0),c)throw c;return{throttle:b,lastUpdated:r}}()),{i18n:p,shop:b,url:_,observability:x,embed:k,router:T}=M(),W=X(),J=function(){const e=M().checkout.negotiator.throttleState.value,t=r(e),a=U().merchandiseLines;return l(()=>{const e=t.value;if("inactive"===e.status||"loading"===e.status||!a.value)return[];const n=new Map(e.productVariantAvailabilityV2.map(({id:e,available:t})=>[e,t]));return a.value.lines.filter(e=>e.variantId).map(e=>({...e,available:n.get(te(e.variantId))}))})}(),le=l(()=>J.value.length>0?J.value:null),oe=m(),se=l(()=>c.value.throttle.status),ce=l(()=>"inactive"!==se.value);u(()=>{if(!ce.value||!B(k?.embedder))return;const e=h(()=>k?.presentation?.acquire());return()=>h(()=>e?.())});const de=l(()=>c.value.lastUpdated),he=l(()=>"complete"===se.value||"queued"===se.value?function(e){return 0===e.length?"empty":e.every(Z)?"unavailable":e.some(Z)?"partially_available":"available"}(J.value):null),me=i(s),{currentPage:pe}=I().value;me.current=s;const ve=i(!1);u(()=>{if(ve.current)return;const e=he.value;if(!e)return;const t=J.value;x.counter({name:"throttle_rendered",value:1,attributes:{throttle_status:se.value,inventory_status:e,merchandise_available:t.filter(({available:e})=>e).length,merchandise_unavailable:t.filter(({available:e})=>!e).length,has_storefront:b.hasStorefront}}),ve.current=!0});const be=i(!1);t(()=>{be.current||(be.current=!0,H(k,"throttle"))},[k]),F("complete"===se.value&&"hidden"===W?p.translate("throttle.time_to_checkout_title",{shopName:b.name}):"loading"===se.value?p.translate("general.loading_title",{shopName:b.name}):p.translate("general.full_title",{pageTitle:p.translate("throttle.title"),shopName:b.name}));const fe=pe?.route,ge=i(!1);t(()=>{!function e(){me.current("throttle-run",t=>{"throttled"===t.status&&oe.current?(ge.current=!1,e()):function(e){return"fetch_failed"===e.status&&e.reason.endsWith("status: 429")&&!ge.current&&oe.current}(t)?(ge.current=!0,e()):"error"!==t.status&&"fetch_failed"!==t.status||(fe?T.navigate(fe,{replace:!0}):window.location.assign(_.cart()))})}()},[me,oe,_,fe,T]),G({stage:O.Usable,id:"Throttle"});const{header:{logo:ye}}=A();return"inactive"===se.value?null:o(V,{placeItems:"center",minBlockSize:"100vh",background:"base",children:o(g,{maxInlineSize:"450px",padding:"base",children:o(L,{target:"card",children:o(y,{accessibilityLabel:p.translate("throttle.title"),children:o(f,{gap:"base",children:[ye&&o(V,{gridAutoFlow:"column",gridTemplateColumns:"minmax(0, 1fr)",gridTemplateRows:"minmax(0, 1fr)",justifyContent:"center",justifyItems:"center",children:o(j,{width:ye.maxWidth})}),o(d,{when:()=>"empty"===he.value,fallback:o(d,{when:()=>"unavailable"===he.value,fallback:o(ie,{}),children:o(ae,{inventoryStatus:"unavailable"})}),children:o(ae,{inventoryStatus:"empty"})}),o(d,{when:le,children:e=>o(ne,{heading:p.translate("throttle.cart_summary_heading"),details:de.value?p.translate("throttle.last_checked",{time:p.formatDate(de.value,{hour:"numeric",minute:"numeric",timeZoneName:"short"})}):void 0,children:[o(d,{when:()=>"partially_available"===he.value,children:[o(re,{}),o(q,{blockSize:"large-200"})]}),o(E,{children:[o(z,{hidden:!0,children:[o(P,{hidden:!0,children:p.translate("order_summary.product_image_label")}),o(P,{hidden:!0,children:p.translate("order_summary.description_label")})]}),o(N,{children:e.map(({digest:e,image:t,available:a,title:n,subtitle:r,quantity:l,properties:i})=>o(C,{children:[o(D,{children:o(R,{src:t?.one,srcSet:t?`${t.one} 1x, ${t.two} 2x, ${t.four} 4x`:void 0,alt:t?.altText,totalItems:l})}),o(D,{primary:!0,children:[o(v,{children:o(w,{type:"strong",children:n})}),r?o(v,{color:"subdued",children:r}):null,i?o($,{properties:i}):null,null==a?null:o(ue,{available:a})]})]},e))})]})]})}),o(d,{when:()=>"empty"!==he.value&&"unavailable"!==he.value,children:o(g,{padding:"large-200 none",children:o(f,{alignItems:"center",gap:"small-200",accessibilityRole:"footer",children:[o(v,{color:"subdued",textAlign:"center",children:p.translate("throttle.footer.heading")}),o(v,{color:"subdued",textAlign:"center",children:p.translate("throttle.footer.body")})]})})})]})})})})})}function ue({available:e}){return o(e?oe:se,{})}export{ce as default};
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.