https://www.hazenavm.cz/wp-content/plugins/woocommerce/assets/clie…/cart.js?ver=ad551d2c148bcc31fb22
1import*as e from"@wordpress/interactivity";var t={7908:e=>{e.exports=import("@woocommerce/stores/store-notices")}},r={};function o(e){var a=r[e];if(void 0!==a)return a.exports;var n=r[e]={exports:{}};return t[e](n,n.exports,o),n.exports}o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);const a=(s={getConfig:()=>e.getConfig,store:()=>e.store},i={},o.d(i,s),i),n=({preserveCartData:e=!1})=>{((e,{bubbles:t=!1,cancelable:r=!1,element:o,detail:a={}})=>{if(!CustomEvent)return;o||(o=document.body);const n=new CustomEvent(e,{bubbles:t,cancelable:r,detail:a});o.dispatchEvent(n)})("wc-blocks_added_to_cart",{bubbles:!0,cancelable:!0,detail:{preserveCartData:e}})};var s,i;function c(e){return"name"in e}function d(e,t){return!e.ok}function l(e){return Object.assign(new Error(e.message||"Unknown error."),{code:e.code||"unknown_error"})}const y=e=>({notice:e.message,type:"error",dismissible:!0}),p=e=>({notice:e,type:"notice",dismissible:!0}),m=(e,t,r)=>{const o=e.items,a=t.items,{productsPendingAdd:n=[],cartItemsPendingQuantity:s=[],cartItemsPendingDelete:i=[]}=r,d=o.filter((e=>e.key&&c(e)&&!a.some((t=>e.key===t.key))&&!i.includes(e.key))),l=a.filter((e=>{if(!c(e))return!1;const t=o.find((t=>t.key===e.key));return t?!s.includes(e.key)&&e.quantity!==t.quantity:!n.includes(e.id)}
1));return[...d.map((e=>p('"%s" was removed from your cart.'.replace("%s",e.name)))),...l.map((e=>p('The quantity of "%1$s" was changed to %2$d.'.replace("%1$s",e.name).replace("%2$d",e.quantity.toString()))))]};let u=!1,h=3e3;function f({quantityChanges:e}){window.dispatchEvent(new CustomEvent("wc-blocks_store_sync_required",{detail:{type:"from_iAPI",quantityChanges:e}}))}const{state:v,actions:g}=(0,a.store)("woocommerce",{actions:{*removeCartItem(e){const t=JSON.stringify(v.cart);v.cart.items=v.cart.items.filter((t=>t.key!==e));try{const t=yield fetch(`${v.restUrl}wc/store/v1/cart/remove-item`,{method:"POST",cache:"no-store",headers:{Nonce:v.nonce,"Content-Type":"application/json"},body:JSON.stringify({key:e})}),r=yield t.json();if(d(t))throw l(r);const o={cartItemsPendingDelete:[e]},a=m(v.cart,r,o),n=r.errors.map(y);yield g.updateNotices([...a,...n],!0),v.cart=r,f({quantityChanges:o})}catch(e){v.cart=JSON.parse(t),g.showNoticeError(e)}},*addCartItem({id:e,key:t,quantity:r,variation:o},{showCartUpdatesNotices:s=!0}={}){let i=v.cart.items.find((r=>"variation"===r.type?!(e!==r.id||!r.variation||!o||r.variation.length!==o.length)&&((e,t)=>!(!Array.isArray(e.variation)||!Array.isArray(t))&&e.variation.length===t.length&&e.variation.every((({raw_attribute:e,value:r})=>t.some((t=>t.attribute===e&&(t.value.toLowerCase()===r.toLowerCase()||t.value&&""===r))))))(r,o):t?t===r.key:e===r.id));const p=i?"update-item":"add-item",u=JSON.stringify(v.cart),h={};let w=null;if(i){const e=c(i)&&i.sold_individually;w={...i,quantity:r},i.key&&!e&&(h.cartItemsPendingQuantity=[i.key],i.quantity=r)}else i={id:e,quantity:r,...o&&{variation:o}},h.productsPendingAdd=[e],v.cart.items.push(i),w=i;try{const e=yield fetch(`${v.restUrl}wc/store/v1/cart/${p}`,{method:"POST",cache:"no-store",headers:{Nonce:v.nonce,"Content-Type":"application/json"},body:JSON.stringify(w)}),t=yield e.json();if(d(e))throw l(t);const r=s?m(v.cart,t,h):[],o=t.errors.map(y);yield g.updateNotices([...r,...o],!0),v.cart=t,n({preserveCartData:!0});const{messages:i}=(0,a.getConfig)("woocommerce");i?.addedToCartText&&wp?.a11y?.speak(i.addedToCartText,"polite"),f({quantityChanges:h})}catch(e){v.cart=JSON.parse(u),g.showNoticeError(e)}},*batchAddCartItems(e,{showCartUpdatesNotices:t=!0}={}){const r=JSON.stringify(v.cart),o={};try{const r=e.map((e=>{const t=v.cart.items.find((({id:t})=>e.id===t));var r;return t?(t.quantity=e.quantity,t.key&&(o.cartItemsPendingQuantity=[...null!==(r=o.cartItemsPendingQuantity)&&void 0!==r?r:[],t.key]),{method:"POST",path:"/wc/store/v1/cart/update-item",cache:"no-store",headers:{Nonce:v.nonce,"Content-Type":"application/json"},body:t}):(e={id:e.id,quantity:e.quantity,...e.variation&&{variation:e.variation}},v.cart.items.push(e),o.productsPendingAdd=o.productsPendingAdd?[...o.productsPendingAdd,e.id]:[e.id],{method:"POST",path:"/wc/store/v1/cart/add-item",cache:"no-store",headers:{Nonce:v.nonce,"Content-Type":"application/json"},body:e})})),s=yield fetch(`${v.restUrl}wc/store/v1/batch`,{method:"POST",cache:"no-store",headers:{Nonce:v.nonce,"Content-Type":"application/json"},body:JSON.stringify({requests:r})}),i=yield s.json();if(d(s))throw l(i);const c=Array.isArray(i.responses)?i.responses.filter((e=>e.status<200||e.status>=300)):[],p=Array.isArray(i.responses)?i.responses.filter((e=>e.status>=200&&e.status<300)):[];if(p.length>0){const e=p[p.length-1]?.body,r=t?m(v.cart,e,o):[],s=p.flatMap((e=>{var t;return(null!==(t=e.body.errors)&&void 0!==t?t:[]).map(y)}));yield g.updateNotices([...r,...s],!0),v.cart=e,n({preserveCartData:!0});const{messages:i}=(0,a.getConfig)("woocommerce");i?.addedToCartText&&wp?.a11y?.speak(i.addedToCartText,"polite"),f({quantityChanges:o})}yield g.updateNotices(c.filter((e=>e.body&&"object"==typeof e.body)).map((({body:e})=>y(e))))}catch(e){v.cart=JSON.parse(r),g.showNoticeError(e)}},*refreshCartItems(){if(!u){u=!0;try{const e=yield fetch(`${v.restUrl}wc/store/v1/cart`,{method:"GET",cache:"no-store",headers:{"Content-Type":"application/json"}}),t=yield e.json();if(d(e))throw l(t);v.cart=t,h=3e3}catch(e){setTimeout(g.refreshCartItems,h),h*=2}finally{u=!1}}},*showNoticeError(e){yield Promise.resolve().then(o.bind(o,7908));const{actions:t}=(0,a.store)("woocommerce/store-notices",{},{lock:"I acknowledge that using a private store means my plugin will inevitably break on the next store release."}),{code:r,message:n}=e,s=v.errorMessages?.[r]||n;t.addNotice({notice:s,type:"error",dismissible:!0}),console.error(e)},*updateNotices(e=[],t=!1){yield Promise.resolve().then(o.bind(o,7908));const{state:r,actions:n}=(0,a.store)("woocommerce/store-notices",{},{lock:"I acknowledge that using a private store means my plugin will inevitably break on the next store release."}),s=e.map((e=>n.addNotice(e))),{notices:i}=r;t&&i.map((({id:e})=>e)).filter((e=>
1!s.includes(e))).forEach((e=>n.removeNotice(e)))}}},{lock:!0});window.addEventListener("wc-blocks_store_sync_required",(async e=>{"from_@wordpress/data"===e.detail.type&&g.refreshCartItems()}));
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.