PluginProbe
Tiered Pricing Table for WooCommerce / 8.1.0
Tiered Pricing Table for WooCommerce v8.1.0
8.1.0 8.0.2 7.1.7 7.1.5 7.1.4 7.1.1 6.5.0 6.4.0 6.1.0 trunk 1.0 1.1 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2 2.2.3 2.3.0 2.3.1 2.3.2 All 92 releases
← All changes | src/Addons/LayoutConfigurator/build/index.js +8 -3 8.0.2 → 8.1.0 View file →
@@ -1,5 +1,5 @@
1 -(()=>{"use strict";var e={674(){const e=window.wp.element,t=window.wp.i18n,i=window.wp.components,a=window.ReactJSXRuntime;function l({name:t,options:i,value:l,onChange:r,size:n="normal",disabled:o=!1}){const s=(0,e.useId)(),c=i.some(e=>e.description);return(0,a.jsx)("div",{className:["tpt-lc-chips","small"===n?"tpt-lc-chips--small":"",c?"tpt-lc-chips--described":""].join(" "),role:"radiogroup",children:i.map(e=>{const i=`${s}-${e.value}`,n=e.value===l;return(0,a.jsxs)("div",{className:"tpt-lc-chip",children:[(0,a.jsx)("input",{type:"radio",className:"tpt-lc-chip__input",id:i,name:t,value:e.value,checked:n,disabled:o,onChange:()=>r(e.value)}),(0,a.jsxs)("label",{className:"tpt-lc-chip__surface",htmlFor:i,children:[(0,a.jsx)("span",{className:"tpt-lc-chip__check","aria-hidden":"true",children:(0,a.jsx)("svg",{viewBox:"0 0 20 20",width:"16",height:"16",focusable:"false",children:(0,a.jsx)("path",{d:"M7.6 14.2 3.9 10.5l1.4-1.4 2.3 2.3 7-7 1.4 1.4z",fill:"currentColor"})})}),(0,a.jsxs)("span",{className:"tpt-lc-chip__text",children:[(0,a.jsx)("span",{className:"tpt-lc-chip__label",children:e.label}),e.description&&(0,a.jsx)("span",{className:"tpt-lc-chip__desc",children:e.description})]})]})]},e.value)})})}const r={STRONG:"strong",B:"strong",EM:"em",I:"em",DEL:"del",S:"del",STRIKE:"del"};function n(e){let t="";return e.childNodes.forEach(e=>{if(e.nodeType===Node.TEXT_NODE)return void(t+=(i=e.nodeValue,i.replace(/[&<>]/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;"}[e])).replace(/\u00a0/g," ")));var i;if(e.nodeType!==Node.ELEMENT_NODE)return;const a=r[e.nodeName];a?t+=`<${a}>${n(e)}</${a}>`:"A"===e.nodeName&&e.getAttribute("href")?t+=`<a href="${(e=>e.replace(/[&<>"]/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"}[e])))(e.getAttribute("href"))}">${n(e)}</a>`:"BR"===e.nodeName?t+=" ":t+=n(e)}),t}const o=["bold","italic","strikeThrough"];function s({value:l,placeholders:r=[],onChange:s,placeholder:c,disabled:p=!1}){const _=(0,e.useRef)(null),d=(0,e.useRef)(null),[g,u]=(0,e.useState)({}),h=[{command:"bold",icon:"editor-bold",label:(0,t.__)("Bold","tier-pricing-table")},{command:"italic",icon:"editor-italic",label:(0,t.__)("Italic","tier-pricing-table")},{command:"strikeThrough",icon:"editor-strikethrough",label:(0,t.__)("Strikethrough","tier-pricing-table")}];(0,e.useEffect)(()=>{const e=_.current,t=function(e){const t=document.createElement("template");return t.innerHTML=e||"",n(t.content)}(l);e&&n(e)!==t&&(e.innerHTML=t)},[l]);const m=(0,e.useCallback)(()=>{_.current&&s(n(_.current))},[s]),b=(0,e.useCallback)(()=>{const e={};o.forEach(t=>{try{e[t]=document.queryCommandState(t)}catch(i){e[t]=!1}}),u(e)},[]);(0,e.useEffect)(()=>{const e=()=>{const e=_.current,t=window.getSelection();e&&t&&t.rangeCount&&e.contains(t.anchorNode)&&(d.current=t.getRangeAt(0).cloneRange(),b())};return document.addEventListener("selectionchange",e),()=>document.removeEventListener("selectionchange",e)},[b]);const x=()=>{const e=_.current,t=window.getSelection();e.focus();const i=d.current;if(i&&e.contains(i.commonAncestorContainer))return t.removeAllRanges(),t.addRange(i),!0;const a=document.createRange();return a.selectNodeContents(e),a.collapse(!1),t.removeAllRanges(),t.addRange(a),!1};return(0,a.jsxs)("div",{className:"tpt-lc-editor"+(p?" tpt-lc-editor--disabled":""),children:[(0,a.jsxs)("div",{className:"tpt-lc-editor__box",children:[(0,a.jsx)("div",{className:"tpt-lc-editor__toolbar",role:"toolbar","aria-label":(0,t.__)("Formatting","tier-pricing-table"),children:h.map(({command:e,icon:t,label:l})=>(0,a.jsx)(i.Button,{size:"small",icon:t,label:l,isPressed:!!g[e],disabled:p,onMouseDown:e=>e.preventDefault(),onClick:()=>(e=>{x(),document.execCommand("styleWithCSS",!1,!1),document.execCommand(e,!1,null),m(),b()})(e)},e))}),(0,a.jsx)("div",{ref:_,className:"tpt-lc-editor__content",contentEditable:!p,suppressContentEditableWarning:!0,role:"textbox","aria-multiline":"false",spellCheck:!1,"data-placeholder":c||"",onInput:m,onBlur:m,onKeyUp:b,onMouseUp:b,onKeyDown:e=>{"Enter"===e.key&&e.preventDefault()},onPaste:e=>{e.preventDefault();const t=e.clipboardData.getData("text/plain").replace(/\s*[\r\n]+\s*/g," ");document.execCommand("insertText",!1,t),m()}})]}),r.length>0&&(0,a.jsx)("div",{className:"tpt-lc-template__placeholders",children:r.map(e=>(0,a.jsx)("button",{type:"button",className:"tpt-lc-template__placeholder",disabled:p,title:(0,t.__)("Insert","tier-pricing-table"),onMouseDown:e=>e.preventDefault(),onClick:()=>(e=>{const t=x(),i=_.current.textContent,a=t||!i||/\s$/.test(i)?"":" ";document.execCommand("insertText",!1,`${a}{${e}}`),m()})(e),children:`{${e}}`},e))})]})}function c({label:e,hint:t,children:i}){return(0,a.jsxs)("div",{className:"tpt-lc-field",children:[(0,a.jsx)("div",{className:"tpt-lc-field__label",children:e}),(0,a.jsx)("div",{className:"tpt-lc-field__control",children:i}),t&&(0,a.jsx)("div",{className:"tpt-lc-field__hint",children:t})]})}function p({id:t,title:i,note:l,noteTone:r="premium",locked:n,hidden:o=!1,keepMounted:s=!1,children:c}){const[p,_]=(0,e.useState)(()=>function(e){try{return"collapsed"===window.localStorage.getItem(`tpt-lc-card:${e}`)}catch(e){return!1}}(t)),d=`tpt-lc-card-${t}`;return(0,a.jsxs)("div",{className:`tpt-lc-card${n?" tpt-lc-card--locked":""}${p?" tpt-lc-card--collapsed":""}`,hidden:o,children:[(0,a.jsxs)("button",{type:"button",className:"tpt-lc-card__head","aria-expanded":p?"false":"true","aria-controls":d,onClick:()=>{_(!p),function(e,t){try{window.localStorage.setItem(`tpt-lc-card:${e}`,t?"collapsed":"open")}catch(e){}}(t,!p)},children:[(0,a.jsx)("span",{className:"tpt-lc-card__title",children:i}),(0,a.jsx)("span",{className:"tpt-lc-card__chevron","aria-hidden":"true",children:(0,a.jsx)("svg",{viewBox:"0 0 24 24",width:"20",height:"20",focusable:"false",children:(0,a.jsx)("path",{d:"M7.4 9.2 12 13.7l4.6-4.5 1.4 1.4-6 6-6-6z",fill:"currentColor"})})})]}),(s||!p)&&(0,a.jsxs)("div",{className:"tpt-lc-card__body",id:d,hidden:s&&p,children:[l&&(0,a.jsx)("div",{className:`tpt-lc-notice tpt-lc-notice--${r}`,role:"note",children:l}),c]})]})}function _({value:t,onChange:l,disabled:r=!1,label:n}){const[o,s]=(0,e.useState)(t);return(0,a.jsx)(i.Dropdown,{className:"tpt-lc-color",contentClassName:"tpt-lc-color__popover",popoverProps:{placement:"bottom-start"},renderToggle:({isOpen:e,onToggle:l})=>(0,a.jsxs)(i.Button,{className:"tpt-lc-color__toggle",onClick:l,"aria-expanded":e,variant:"secondary",disabled:r,children:[(0,a.jsx)(i.ColorIndicator,{colorValue:t}),(0,a.jsx)("code",{children:n||t})]}),renderContent:()=>(0,a.jsx)(i.ColorPicker,{color:o,enableAlpha:!1,onChange:e=>{s(e),l(e)}})})}function d({config:r,context:n,values:o,styleKey:d,onChange:g}){const u="catalog"===n,h=u&&"custom"!==o.layout_settings,m=u&&"yes"!==o.display,b=e=>String(e||"").split(",").map(e=>e.trim()).filter(Boolean),x=u&&r.catalog&&r.catalog.contexts||{},y=b(o.contexts).length?b(o.contexts):Object.keys(x),v=u&&"selected"===o.scope,[f,k]=(0,e.useState)(()=>({...r.catalog&&r.catalog.categoryNames||{}})),[w,j]=(0,e.useState)([]),C=(0,e.useRef)(null);(0,e.useEffect)(()=>()=>window.clearTimeout(C.current),[]);const N=b(o.categories).map(e=>f[e]).filter(Boolean),$=o.display_type,S=Object.entries(r.layouts).map(([e,t])=>({value:e,label:t})),T=u&&r.catalog&&(r.catalog.excludedStyles||{})[$]||[],M=d?Object.entries(r.styles[$]||{}).filter(([e])=>!T.includes(e)).map(([e,t])=>({value:e,label:t})):[],q=d&&T.includes(o[d])?"default":d?o[d]:null,B=Object.entries(r.positions).map(([e,t])=>({value:e,label:t})),P=Object.entries(r.quantityTypes).map(([e,t])=>({value:e,label:t.label,description:t.example})),E=Object.entries(r.tierOrders||{}).map(([e,t])=>({value:e,label:t.label,description:t.example})),H=Object.entries(r.discountFormats||{}).map(([e,t])=>({value:e,label:t.label,description:t.example})),O=e=>(r[e]||[]).includes($),R=!u&&O("compactFor"),A=((r.spacingFor||{})[$]||[]).includes(d?q:"default"),F=""===o.layout_spacing||void 0===o.layout_spacing||null===o.layout_spacing?void 0:Number(o.layout_spacing),z=((r.badgeColorStyles||{})[$]||{})[d?q:"default"],L=!!z,D=z?"active"===z.default?o.selected_quantity_color:z.default:void 0,I={tint:[(0,t.__)("Auto: the design style's own badge colours.","tier-pricing-table"),(0,t.__)("A light tint of this colour behind the badge text in this colour. Reset for the design style's own colours.","tier-pricing-table")],solid:[(0,t.__)("Auto: the badge follows the active tier colour.","tier-pricing-table"),(0,t.__)("The badge background; its text stays white. Reset for the active tier colour.","tier-pricing-table")],bar:[(0,t.__)("Auto: the savings bar follows the active tier colour.","tier-pricing-table"),(0,t.__)("The savings bar and the percentage next to it. Reset for the active tier colour.","tier-pricing-table")]},Q=z?(I[z.kind]||I.tint)[o.discount_badge_color?1:0]:"",U=((r.activeBorderStyles||{})[$]||[]).includes(d?q:"default"),K=O("cellPaddingFor"),W=""===o.cell_padding||void 0===o.cell_padding||null===o.cell_padding?void 0:Number(o.cell_padding),V=(r.discountStyles||{})[$],J=O("discountFor")&&(!V||V.includes(d?o[d]:"default")),G=(r.discountFormatStyles||{})[$],Y=O("discountFormatFor")&&(!G||G.includes(o[d]))&&!(J&&"yes"!==o.show_discount_column),X=!u&&O("tooltipFor"),Z=O("columnsFor"),ee=O("clickableFor"),te=O("plainTextFor"),ie=Object.keys(r.unitFor||{}).find(e=>r.unitFor[e].includes($))||null,ae=ie?o[ie]||{singular:"",plural:""}:null,le="tooltip"!==$,re="yes"===o.display,ne=r.optionsLayout||{},oe=(ne.templates||[]).includes($),se=(ne.original||[]).includes($),ce=(ne.defaultOpt||[]).includes($),pe=(ne.total||[]).includes($)&&(ne.totalStyles||[]).includes(o.pricing_options_style),_e=e=>!r.premium&&(r.premiumOptions||[]).includes(e),de=(0,a.jsx)("span",{className:"tpt-lc-premium",children:(0,t.__)("Available in the premium version.","tier-pricing-table")}),ge=(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("strong",{children:(0,t.__)("Available in the premium version.","tier-pricing-table")})," ",(0,t.__)("You can try it in the preview; the store shows it with premium only.","tier-pricing-table")]}),ue=r.placeholders||{},he=J||se||pe||X||ee,me=Object.entries(r.priceFormats||{}).map(([e,t])=>({value:e,label:t.label,description:t.example})),be="same_as_catalog"!==o.product_page_price_format,xe="yes"===o.update_price_on_product_page,ye="yes"===o.you_save_enabled,ve=!r.premium,fe="yes"===o.display_summary,ke=Object.entries((r.summary||{}).types||{}).map(([e,t])=>({value:e,label:t})),we=Object.entries((r.summary||{}).positions||{}).map(([e,t])=>({value:e,label:t})),je=Object.entries((r.catalogPrice||{}).types||{}).map(([e,t])=>({value:e,label:t.label,description:t.example})),Ce="yes"===o.tiered_price_at_catalog;let Ne=null;u?Ne=re?(0,t.__)("Depending on the theme, the pricing block may need small CSS adjustments to fit the grid.","tier-pricing-table"):(0,t.__)("Tiered pricing is not shown on shop and category pages.","tier-pricing-table"):re||(Ne=(0,t.__)("The layout is not inserted automatically. Place it with the [tiered-pricing-table] shortcode, the Tiered Pricing block or the widget; prices still update live.","tier-pricing-table"));const $e=(0,a.jsx)(c,{label:(0,t.__)("Position","tier-pricing-table"),children:(0,a.jsx)(i.SelectControl,{__nextHasNoMarginBottom:!0,disabled:!re,value:o.position_hook,options:B,onChange:e=>g("position_hook",e)})});if("cart"===n){const e=r.cart||{},l="yes"===o.cart_upsell_enabled;return(0,a.jsxs)("div",{className:"tpt-lc-controls",children:[e.prices&&(0,a.jsxs)(p,{id:"cart-prices",title:(0,t.__)("Cart prices","tier-pricing-table"),locked:ve,note:ve?ge:null,children:[(0,a.jsx)(c,{label:(0,t.__)("Discounted items","tier-pricing-table"),hint:(0,t.__)("How items with a tiered price appear in the cart.","tier-pricing-table"),children:(0,a.jsxs)("div",{className:"tpt-lc-toggles",children:[(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Show the original item price crossed out","tier-pricing-table"),checked:"yes"===o.show_discount_in_cart,onChange:e=>g("show_discount_in_cart",e?"yes":"no")}),(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Show the original subtotal crossed out","tier-pricing-table"),checked:"yes"===o.show_subtotal_as_discount_in_cart,onChange:e=>g("show_subtotal_as_discount_in_cart",e?"yes":"no")}),(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Cross out the regular price instead of the sale price","tier-pricing-table"),help:(0,t.__)("For products on sale.","tier-pricing-table"),checked:"yes"===o.consider_sale_price_as_discount_in_cart,onChange:e=>g("consider_sale_price_as_discount_in_cart",e?"yes":"no")})]})}),(0,a.jsx)(c,{label:(0,t.__)("Total savings","tier-pricing-table"),hint:(0,t.__)("A row before the order total, in the cart totals and in the classic checkout's order review. Not available with the Checkout block.","tier-pricing-table"),children:(0,a.jsxs)("div",{className:"tpt-lc-toggles",children:[(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Show what the tiered prices take off the cart","tier-pricing-table"),checked:"yes"===o.cart_total_savings,onChange:e=>g("cart_total_savings",e?"yes":"no")}),"yes"===o.cart_total_savings&&(0,a.jsx)(i.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,t.__)("Row label","tier-pricing-table"),value:o.cart_total_savings_label||"",onChange:e=>g("cart_total_savings_label",e)})]})})]}),e.upsells&&(0,a.jsxs)(p,{id:"cart-upsell",title:(0,t.__)("Upsell message","tier-pricing-table"),locked:ve,note:ve?ge:null,children:[(0,a.jsx)(c,{label:(0,t.__)("Next tier message","tier-pricing-table"),hint:(0,t.__)("Shown under the item name while a higher tier is within reach. Not available with the Cart block.","tier-pricing-table"),children:(0,a.jsxs)("div",{className:"tpt-lc-toggles",children:[(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Show a message about the next tier","tier-pricing-table"),checked:l,onChange:e=>g("cart_upsell_enabled",e?"yes":"no")}),l&&(0,a.jsx)(s,{value:o.cart_upsell_template,placeholders:ue.cart_upsell_template||[],onChange:e=>g("cart_upsell_template",e)})]})}),l&&(0,a.jsx)(c,{label:(0,t.__)("Next tier shortcuts","tier-pricing-table"),children:(0,a.jsxs)("div",{className:"tpt-lc-toggles",children:[(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Make the quantity a link that sets the cart to the next tier","tier-pricing-table"),help:(0,t.__)("One click moves the line to the next tier and updates the cart.","tier-pricing-table"),checked:"no"!==o.cart_upsell_link,onChange:e=>g("cart_upsell_link",e?"yes":"no")}),(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Show a progress bar to the next tier","tier-pricing-table"),checked:"yes"===o.cart_upsell_progress,onChange:e=>g("cart_upsell_progress",e?"yes":"no")})]})}),l&&(0,a.jsx)(c,{label:(0,t.__)("Message colour","tier-pricing-table"),children:(0,a.jsx)(_,{value:o.cart_upsell_color,onChange:e=>g("cart_upsell_color",e)})})]})]})}return(0,a.jsxs)("div",{className:"tpt-lc-controls",children:[(0,a.jsxs)(p,{id:`${n}-layout`,title:(0,t.__)("Layout","tier-pricing-table"),children:[(0,a.jsx)(c,{label:(0,t.__)("Visibility","tier-pricing-table"),hint:Ne,children:(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:u?(0,t.__)("Show on shop and category pages","tier-pricing-table"):(0,t.__)("Show on the product page","tier-pricing-table"),checked:re,onChange:e=>g("display",e?"yes":"no")})}),u&&(!m||"yes"===o.badge_enabled)&&(0,a.jsx)(c,{label:(0,t.__)("Where it shows","tier-pricing-table"),hint:v?null:m?(0,t.__)("The badge shows in every product list: the shop, categories, search, related products, shortcodes and blocks.","tier-pricing-table"):(0,t.__)("Every product list: the shop, categories, search, related products, shortcodes and blocks.","tier-pricing-table"),children:(0,a.jsx)(l,{name:"tpt-lc-scope",options:Object.entries(r.catalog&&r.catalog.scopes||{}).map(([e,t])=>({value:e,label:t})),value:v?"selected":"everywhere",onChange:e=>g("scope",e)})}),u&&(!m||"yes"===o.badge_enabled)&&v&&Object.keys(x).length>0&&(0,a.jsx)(c,{label:(0,t.__)("Product lists","tier-pricing-table"),hint:(0,t.__)("The product lists that show tiered pricing.","tier-pricing-table"),children:(0,a.jsx)("div",{className:"tpt-lc-checklist",children:Object.entries(x).map(([e,t])=>(0,a.jsx)(i.CheckboxControl,{__nextHasNoMarginBottom:!0,label:t,checked:y.includes(e),onChange:t=>((e,t)=>{const i=y.filter(t=>t!==e);t&&i.push(e),g("contexts",i.length===Object.keys(x).length?"":i.join(","))})(e,t)},e))})}),u&&(!m||"yes"===o.badge_enabled)&&v&&(0,a.jsx)(c,{label:(0,t.__)("Only for products in","tier-pricing-table"),hint:(0,t.__)("Type to search categories. Leave empty for every product; a category covers its child categories.","tier-pricing-table"),children:(0,a.jsx)(i.FormTokenField,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,__experimentalExpandOnFocus:!0,__experimentalShowHowTo:!1,label:"",placeholder:(0,t.__)("All categories","tier-pricing-table"),value:N,suggestions:w,onInputChange:e=>{const t=r.catalog&&r.catalog.categorySearch||null;!t||e.length<2||(window.clearTimeout(C.current),C.current=window.setTimeout(()=>{const i=`${t.url}?action=${encodeURIComponent(t.action)}&security=${encodeURIComponent(t.nonce)}&term=${encodeURIComponent(e)}`;window.fetch(i,{credentials:"same-origin"}).then(e=>e.json()).then(e=>{const t={};Object.values(e||{}).forEach(e=>{e&&e.term_id&&(t[e.term_id]=String(e.formatted_name||e.name).replace(/\s\(\d+\)$/,""))}),k(e=>({...e,...t})),j(Object.values(t))}).catch(()=>{})},250))},onChange:e=>g("categories",e.map(e=>{const t="string"==typeof e?e:e.value,i=Object.keys(f).find(e=>f[e]===t);return i?String(i):""}).filter(Boolean).join(","))})}),u&&!m&&$e,u&&!m&&(0,a.jsx)(c,{label:(0,t.__)("Grid item","tier-pricing-table"),children:(0,a.jsxs)("div",{className:"tpt-lc-toggles",children:[(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Compact layout","tier-pricing-table"),help:(0,t.__)("Minimal styling so the pricing block fits the product grid.","tier-pricing-table"),checked:"yes"===o.use_reduced_styles,onChange:e=>g("use_reduced_styles",e?"yes":"no")}),(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Dynamic price","tier-pricing-table"),help:(0,t.__)("Update the displayed price to the tier price when the customer changes the quantity in the grid. Needs a quantity field on the grid item, from this plugin, the theme or another plugin.","tier-pricing-table"),checked:"yes"===o.dynamic_price,onChange:e=>g("dynamic_price",e?"yes":"no")}),(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Quantity selector in the grid","tier-pricing-table"),help:_e("show_quantity_field")?de:(0,t.__)("Adds a quantity field to every grid item. Only for themes that do not have one.","tier-pricing-table"),checked:"yes"===o.show_quantity_field,onChange:e=>g("show_quantity_field",e?"yes":"no")}),(0,a.jsx)(i.SelectControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,t.__)("Tiers per grid item","tier-pricing-table"),help:(0,t.__)('The rest sit behind a "+N more" link to the product page.',"tier-pricing-table"),value:o.tiers_limit||"",options:[{value:"",label:(0,t.__)("All","tier-pricing-table")},...[1,2,3,4,5,6].map(e=>({value:String(e),label:String(e)}))],onChange:e=>g("tiers_limit",e)})]})}),u&&!m&&(0,a.jsx)(c,{label:(0,t.__)("Layout source","tier-pricing-table"),hint:h?(0,t.__)("Shop and category pages use the product page layout and its settings.","tier-pricing-table"):null,children:(0,a.jsx)(l,{name:"tpt-lc-layout-source",options:[{value:"default",label:(0,t.__)("Same as product page","tier-pricing-table")},{value:"custom",label:(0,t.__)("Custom","tier-pricing-table")}],value:"custom"===o.layout_settings?"custom":"default",onChange:e=>g("layout_settings",e)})}),!h&&!m&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(c,{label:(0,t.__)("Layout","tier-pricing-table"),children:(0,a.jsx)(l,{name:"tpt-lc-layout",options:S,value:$,onChange:e=>g("display_type",e)})}),d&&(0,a.jsx)(c,{label:(0,t.__)("Design style","tier-pricing-table"),children:(0,a.jsx)(l,{name:"tpt-lc-style",size:"small",options:M,value:q,onChange:e=>g(d,e)})}),R&&(0,a.jsx)(c,{label:(0,t.__)("Compact layout","tier-pricing-table"),children:(0,a.jsx)("div",{className:"tpt-lc-toggles",children:(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Enable compact layout","tier-pricing-table"),help:(0,t.__)("A space-saving version of the selected design style.","tier-pricing-table"),checked:"yes"===o.compact_layout,onChange:e=>g("compact_layout",e?"yes":"no")})})}),A&&(0,a.jsx)(c,{label:(0,t.__)("Spacing","tier-pricing-table"),hint:void 0===F?(0,t.__)("Auto: each design style keeps its own spacing.","tier-pricing-table"):(0,t.__)("Gap between the tiers. Reset for the design style's own spacing.","tier-pricing-table"),children:(0,a.jsxs)("div",{className:"tpt-lc-spacing",children:[(0,a.jsx)(i.RangeControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,value:F,initialPosition:10,min:0,max:r.spacingMax||40,step:1,allowReset:!0,resetFallbackValue:void 0,withInputField:!1,onChange:e=>g("layout_spacing",null==e?"":String(e))}),(0,a.jsx)(i.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,type:"number",min:0,max:r.spacingMax||40,className:"tpt-lc-spacing__value",placeholder:(0,t.__)("Auto","tier-pricing-table"),value:void 0===F?"":String(F),onChange:e=>g("layout_spacing",String(e).replace(/[^0-9]/g,""))})]})}),K&&(0,a.jsx)(c,{label:(0,t.__)("Cell padding","tier-pricing-table"),hint:void 0===W?(0,t.__)("Auto: each design style keeps its own cell padding.","tier-pricing-table"):(0,t.__)("Padding inside each cell; it also overrides the theme's cell padding. Reset for the design style's own padding.","tier-pricing-table"),children:(0,a.jsxs)("div",{className:"tpt-lc-spacing",children:[(0,a.jsx)(i.RangeControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,value:W,initialPosition:10,min:0,max:r.cellPaddingMax||30,step:1,allowReset:!0,resetFallbackValue:void 0,withInputField:!1,onChange:e=>g("cell_padding",null==e?"":String(e))}),(0,a.jsx)(i.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,type:"number",min:0,max:r.cellPaddingMax||30,className:"tpt-lc-spacing__value",placeholder:(0,t.__)("Auto","tier-pricing-table"),value:void 0===W?"":String(W),onChange:e=>g("cell_padding",String(e).replace(/[^0-9]/g,""))})]})}),(0,a.jsx)(c,{label:(0,t.__)("Active tier colour","tier-pricing-table"),children:(0,a.jsx)(_,{value:o.selected_quantity_color,onChange:e=>g("selected_quantity_color",e)})}),L&&(0,a.jsx)(c,{label:(0,t.__)("Discount badge colour","tier-pricing-table"),hint:Q,children:(0,a.jsxs)("div",{className:"tpt-lc-color-row",children:[(0,a.jsx)(_,{value:o.discount_badge_color||D,label:o.discount_badge_color?void 0:(0,t.__)("Auto","tier-pricing-table"),onChange:e=>g("discount_badge_color",e)}),o.discount_badge_color&&(0,a.jsx)(i.Button,{variant:"tertiary",onClick:()=>g("discount_badge_color",""),children:(0,t.__)("Reset","tier-pricing-table")})]})}),U&&(0,a.jsx)(c,{label:(0,t.__)("Active tier border","tier-pricing-table"),children:(0,a.jsx)("div",{className:"tpt-lc-toggles",children:(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Mark the active tier with a left border","tier-pricing-table"),help:(0,t.__)("A bar in the active tier colour at the left of the row.","tier-pricing-table"),checked:"no"!==o.table_active_border,onChange:e=>g("table_active_border",e?"yes":"no")})})}),le&&(0,a.jsx)(c,{label:(0,t.__)("Title","tier-pricing-table"),children:(0,a.jsx)(i.TextControl,{__nextHasNoMarginBottom:!0,value:o.table_title,placeholder:(0,t.__)("e.g. Buy more, pay less","tier-pricing-table"),onChange:e=>g("table_title",e)})}),!u&&$e,(0,a.jsx)(c,{label:(0,t.__)("Quantity format","tier-pricing-table"),children:(0,a.jsx)(l,{name:"tpt-lc-quantity",options:P,value:o.quantity_type,onChange:e=>g("quantity_type",e)})}),(0,a.jsx)(c,{label:(0,t.__)("Tier order","tier-pricing-table"),children:(0,a.jsx)(l,{name:"tpt-lc-tier-order",options:E,value:"desc"===o.tiers_order?"desc":"asc",onChange:e=>g("tiers_order",e)})}),ie&&(0,a.jsx)(c,{label:(0,t.__)("Quantity unit","tier-pricing-table"),hint:(0,t.__)("Shown next to quantities, e.g. pieces, boxes, packs. Leave empty for none.","tier-pricing-table"),children:(0,a.jsxs)("div",{className:"tpt-lc-inline",children:[(0,a.jsx)(i.TextControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Singular","tier-pricing-table"),value:ae.singular,onChange:e=>g(ie,{...ae,singular:e})}),(0,a.jsx)(i.TextControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Plural","tier-pricing-table"),value:ae.plural,onChange:e=>g(ie,{...ae,plural:e})})]})}),Z&&(0,a.jsx)(c,{label:(0,t.__)("Column headers","tier-pricing-table"),hint:(0,t.__)("Leave a header empty to hide that column.","tier-pricing-table"),children:(0,a.jsxs)("div",{className:"tpt-lc-inline tpt-lc-inline--3",children:[(0,a.jsx)(i.TextControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Quantity","tier-pricing-table"),value:o.head_quantity_text,onChange:e=>g("head_quantity_text",e)}),(0,a.jsx)(i.TextControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Price","tier-pricing-table"),value:o.head_price_text,onChange:e=>g("head_price_text",e)}),(0,a.jsx)(i.TextControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Discount","tier-pricing-table"),value:o.head_discount_text,onChange:e=>g("head_discount_text",e)})]})}),Y&&(0,a.jsx)(c,{label:(0,t.__)("Discount format","tier-pricing-table"),children:(0,a.jsx)(l,{name:"tpt-lc-discount-format",options:H,value:H.some(e=>e.value===o.discount_format)?o.discount_format:"percentage",onChange:e=>g("discount_format",e)})}),X&&(0,a.jsx)(c,{label:(0,t.__)("Tooltip icon","tier-pricing-table"),hint:(0,t.__)("Colour and size of the icon shown next to the price.","tier-pricing-table"),children:(0,a.jsxs)("div",{className:"tpt-lc-tooltip",children:[(0,a.jsx)(_,{value:o.tooltip_color,onChange:e=>g("tooltip_color",e)}),(0,a.jsx)(i.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,type:"number",min:8,max:64,className:"tpt-lc-tooltip__size",value:o.tooltip_size,suffix:"px",onChange:e=>g("tooltip_size",String(e).replace(/[^0-9]/g,""))})]})}),oe&&(0,a.jsx)(c,{label:(0,t.__)("Option text","tier-pricing-table"),hint:(0,t.__)("Text of each pricing option. Click a variable to insert it.","tier-pricing-table"),children:(0,a.jsx)(s,{value:o.options_option_text,placeholders:ue.options_option_text||[],onChange:e=>g("options_option_text",e)})}),(ce||oe)&&(0,a.jsx)(c,{label:(0,t.__)("Base price option","tier-pricing-table"),children:(0,a.jsxs)("div",{className:"tpt-lc-toggles",children:[ce&&(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Show an option for the regular price (no discount)","tier-pricing-table"),checked:"yes"===o.options_show_default_option,onChange:e=>g("options_show_default_option",e?"yes":"no")}),oe&&(!ce||"yes"===o.options_show_default_option)&&(0,a.jsx)(s,{value:o.options_default_option_text,placeholders:ue.options_default_option_text||[],onChange:e=>g("options_default_option_text",e)})]})}),te&&(0,a.jsx)(c,{label:(0,t.__)("Pricing string","tier-pricing-table"),hint:(0,t.__)("Text shown for each pricing tier. Click a variable to insert it.","tier-pricing-table"),children:(0,a.jsx)(s,{value:o.plain_text_template,placeholders:ue.plain_text_template||[],onChange:e=>g("plain_text_template",e)})}),te&&(0,a.jsx)(c,{label:(0,t.__)("First tier","tier-pricing-table"),children:(0,a.jsxs)("div",{className:"tpt-lc-toggles",children:[(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Show the regular price tier (no discount)","tier-pricing-table"),checked:"yes"===o.plain_text_show_first_tier,onChange:e=>g("plain_text_show_first_tier",e?"yes":"no")}),"yes"===o.plain_text_show_first_tier&&(0,a.jsx)(s,{value:o.plain_text_first_tier_template,placeholders:ue.plain_text_first_tier_template||[],onChange:e=>g("plain_text_first_tier_template",e)})]})}),he&&(0,a.jsx)(c,{label:(0,t.__)("Options","tier-pricing-table"),children:(0,a.jsxs)("div",{className:"tpt-lc-toggles",children:[J&&(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Show discount","tier-pricing-table"),checked:"yes"===o.show_discount_column,onChange:e=>g("show_discount_column",e?"yes":"no")}),X&&(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Tooltip border","tier-pricing-table"),checked:"yes"===o.tooltip_border,onChange:e=>g("tooltip_border",e?"yes":"no")}),se&&(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Show the original price crossed out","tier-pricing-table"),checked:"yes"===o.options_show_original_product_price,onChange:e=>g("options_show_original_product_price",e?"yes":"no")}),pe&&(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Show the total for the selected option","tier-pricing-table"),help:_e("options_show_total")?de:void 0,checked:"yes"===o.options_show_total,onChange:e=>g("options_show_total",e?"yes":"no")}),ee&&(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Make pricing tiers clickable","tier-pricing-table"),help:_e("clickable_table_rows")?de:(0,t.__)("Clicking a tier selects its quantity.","tier-pricing-table"),checked:"yes"===o.clickable_table_rows,onChange:e=>g("clickable_table_rows",e?"yes":"no")})]})})]})]}),!u&&(0,a.jsxs)(p,{id:"product-price",title:(0,t.__)("Price","tier-pricing-table"),children:[(0,a.jsx)(c,{label:(0,t.__)("Price display","tier-pricing-table"),children:(0,a.jsx)(l,{name:"tpt-lc-price-format",options:me,value:be?"custom":"same_as_catalog",onChange:e=>g("product_page_price_format",e)})}),be&&(0,a.jsx)(c,{label:(0,t.__)("Price behaviour","tier-pricing-table"),children:(0,a.jsxs)("div",{className:"tpt-lc-toggles",children:[(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Update the price on quantity change","tier-pricing-table"),help:(0,t.__)("The main price follows the quantity the customer enters.","tier-pricing-table"),checked:xe,onChange:e=>g("update_price_on_product_page",e?"yes":"no")}),xe&&(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Show the original price crossed out","tier-pricing-table"),help:(0,t.__)("Next to the discounted tier price.","tier-pricing-table"),checked:"yes"===o.show_tiered_price_as_discount,onChange:e=>g("show_tiered_price_as_discount",e?"yes":"no")}),(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Show the total price (price × quantity)","tier-pricing-table"),help:_e("show_total_price")?de:(0,t.__)("Instead of the price per item.","tier-pricing-table"),checked:"yes"===o.show_total_price,onChange:e=>g("show_total_price",e?"yes":"no")}),"yes"===o.show_total_price&&(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Also for products without tiered pricing","tier-pricing-table"),help:_e("show_total_price_non_tiered")?de:void 0,checked:"yes"===o.show_total_price_non_tiered,onChange:e=>g("show_total_price_non_tiered",e?"yes":"no")})]})})]}),!u&&r.youSave&&(0,a.jsxs)(p,{id:"product-badge",title:(0,t.__)("Savings badge","tier-pricing-table"),children:[(0,a.jsx)(c,{label:(0,t.__)("Badge","tier-pricing-table"),hint:(0,t.__)("Shown under the price when the selected quantity has a discount. Also available as the [tiered_price_you_save] shortcode.","tier-pricing-table"),children:(0,a.jsxs)("div",{className:"tpt-lc-toggles",children:[(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Show the savings badge","tier-pricing-table"),checked:ye,onChange:e=>g("you_save_enabled",e?"yes":"no")}),ye&&(0,a.jsx)(s,{value:o.you_save_template,placeholders:ue.you_save_template||[],onChange:e=>g("you_save_template",e)})]})}),ye&&(0,a.jsx)(c,{label:(0,t.__)("Badge colour","tier-pricing-table"),children:(0,a.jsx)(_,{value:o.you_save_text_color,onChange:e=>g("you_save_text_color",e)})}),ye&&(0,a.jsx)(c,{label:(0,t.__)("Badge options","tier-pricing-table"),children:(0,a.jsxs)("div",{className:"tpt-lc-toggles",children:[(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Include the WooCommerce sale discount","tier-pricing-table"),help:(0,t.__)("An existing sale discount counts towards the savings.","tier-pricing-table"),checked:"yes"===o.you_save_consider_sale_price,onChange:e=>g("you_save_consider_sale_price",e?"yes":"no")}),"yes"===o.you_save_consider_sale_price&&(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Show for products without tiered pricing","tier-pricing-table"),help:(0,t.__)("For regular sale products.","tier-pricing-table"),checked:"yes"===o.you_save_non_tiered,onChange:e=>g("you_save_non_tiered",e?"yes":"no")})]})})]}),!u&&r.summary&&(0,a.jsxs)(p,{id:"product-summary",title:(0,t.__)("Pricing summary","tier-pricing-table"),locked:ve,note:ve?ge:null,children:[(0,a.jsx)(c,{label:(0,t.__)("Summary block","tier-pricing-table"),hint:(0,t.__)("Quantity, price per item and total for the selected quantity, near the pricing layout.","tier-pricing-table"),children:(0,a.jsxs)("div",{className:"tpt-lc-toggles",children:[(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Show the pricing summary block","tier-pricing-table"),checked:fe,onChange:e=>g("display_summary",e?"yes":"no")}),fe&&(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Show for products without tiered pricing","tier-pricing-table"),checked:"yes"===o.display_summary_non_tiered,onChange:e=>g("display_summary_non_tiered",e?"yes":"no")})]})}),fe&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(c,{label:(0,t.__)("Summary layout","tier-pricing-table"),children:(0,a.jsx)(l,{name:"tpt-lc-summary-type",size:"small",options:ke,value:o.summary_type,onChange:e=>g("summary_type",e)})}),(0,a.jsx)(c,{label:(0,t.__)("Title","tier-pricing-table"),children:(0,a.jsx)(i.TextControl,{__nextHasNoMarginBottom:!0,value:o.summary_title,placeholder:(0,t.__)("e.g. Your order","tier-pricing-table"),onChange:e=>g("summary_title",e)})}),(0,a.jsx)(c,{label:(0,t.__)("Position","tier-pricing-table"),children:(0,a.jsx)(i.SelectControl,{__nextHasNoMarginBottom:!0,value:o.summary_position_hook,options:we,onChange:e=>g("summary_position_hook",e)})}),(0,a.jsx)(c,{label:(0,t.__)("Labels","tier-pricing-table"),children:(0,a.jsxs)("div",{className:"tpt-lc-inline",children:[(0,a.jsx)(i.TextControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Total","tier-pricing-table"),value:o.summary_total_label,onChange:e=>g("summary_total_label",e)}),(0,a.jsx)(i.TextControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Each","tier-pricing-table"),value:o.summary_each_label,onChange:e=>g("summary_each_label",e)})]})})]})]}),u&&(0,a.jsxs)(p,{id:"catalog-badge",title:(0,t.__)("Bulk savings badge","tier-pricing-table"),children:[(0,a.jsx)(c,{label:(0,t.__)("Badge","tier-pricing-table"),hint:(0,t.__)('A badge on the product image with the biggest discount the product\'s tiers give. Shows whether or not the pricing does, in the lists "Where it shows" allows.',"tier-pricing-table"),children:(0,a.jsxs)("div",{className:"tpt-lc-toggles",children:[(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Show a bulk savings badge","tier-pricing-table"),checked:"yes"===o.badge_enabled,onChange:e=>g("badge_enabled",e?"yes":"no")}),"yes"===o.badge_enabled&&(0,a.jsx)(s,{value:o.badge_template,placeholders:ue.badge_template||[],onChange:e=>g("badge_template",e)})]})}),"yes"===o.badge_enabled&&(0,a.jsx)(c,{label:(0,t.__)("Position","tier-pricing-table"),children:(0,a.jsx)(l,{name:"tpt-lc-badge-position",options:Object.entries(r.catalog&&r.catalog.badgePositions||{}).map(([e,t])=>({value:e,label:t})),value:"top-right"===o.badge_position?"top-right":"top-left",onChange:e=>g("badge_position",e)})}),"yes"===o.badge_enabled&&(0,a.jsx)(c,{label:(0,t.__)("Badge colour","tier-pricing-table"),hint:o.badge_color?(0,t.__)("Reset for the active tier colour.","tier-pricing-table"):(0,t.__)("Auto: the active tier colour.","tier-pricing-table"),children:(0,a.jsxs)("div",{className:"tpt-lc-color-row",children:[(0,a.jsx)(_,{value:o.badge_color||o.selected_quantity_color,label:o.badge_color?void 0:(0,t.__)("Auto","tier-pricing-table"),onChange:e=>g("badge_color",e)}),o.badge_color&&(0,a.jsx)(i.Button,{variant:"tertiary",onClick:()=>g("badge_color",""),children:(0,t.__)("Reset","tier-pricing-table")})]})})]}),u&&r.catalogPrice&&(0,a.jsxs)(p,{id:"catalog-price",title:(0,t.__)("Price","tier-pricing-table"),locked:ve,note:ve?ge:null,children:[(0,a.jsx)(c,{label:(0,t.__)("Price display","tier-pricing-table"),hint:(0,t.__)("The price shown in the product grid for products with tiered pricing.","tier-pricing-table"),children:(0,a.jsxs)("div",{className:"tpt-lc-toggles",children:[(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Replace the regular price","tier-pricing-table"),help:(0,t.__)("Show the lowest tier price or a price range instead.","tier-pricing-table"),checked:Ce,onChange:e=>g("tiered_price_at_catalog",e?"yes":"no")}),Ce&&(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Apply to variable products","tier-pricing-table"),help:(0,t.__)("Lowest and highest prices across all variations.","tier-pricing-table"),checked:"yes"===o.tiered_price_at_catalog_for_variable,onChange:e=>g("tiered_price_at_catalog_for_variable",e?"yes":"no")})]})}),Ce&&(0,a.jsx)(c,{label:(0,t.__)("Format","tier-pricing-table"),children:(0,a.jsx)(l,{name:"tpt-lc-catalog-price-type",options:je,value:o.tiered_price_at_catalog_type,onChange:e=>g("tiered_price_at_catalog_type",e)})}),Ce&&"lowest"===o.tiered_price_at_catalog_type&&(0,a.jsx)(c,{label:(0,t.__)("Prefix for the lowest price","tier-pricing-table"),children:(0,a.jsx)(i.TextControl,{__nextHasNoMarginBottom:!0,value:o.lowest_prefix,onChange:e=>g("lowest_prefix",e)})}),Ce&&"custom"===o.tiered_price_at_catalog_type&&(0,a.jsx)(c,{label:(0,t.__)("Custom template","tier-pricing-table"),hint:(0,t.__)("Click a variable to insert it.","tier-pricing-table"),children:(0,a.jsx)(s,{value:o.tiered_price_at_catalog_custom_template,placeholders:ue.tiered_price_at_catalog_custom_template||[],onChange:e=>g("tiered_price_at_catalog_custom_template",e)})})]})]})}const g=e=>String(e).replace(/[&<>"']/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"}[e])),u={woocommerce_before_single_product_summary:"before-summary",woocommerce_single_product_summary:"above-title",woocommerce_before_add_to_cart_form:"before-form",woocommerce_before_add_to_cart_button:"before-button",woocommerce_after_add_to_cart_button:"after-button",woocommerce_after_add_to_cart_form:"after-form",woocommerce_after_single_product_summary:"after-summary"},h={woocommerce_shop_loop_item_title__5:"above-title",woocommerce_shop_loop_item_title__15:"below-title",woocommerce_after_shop_loop_item__6:"above-button",woocommerce_after_shop_loop_item__15:"below-button"},m=String.raw`
1 +(()=>{"use strict";var e={656(){const e=window.wp.element,t=window.wp.i18n,i=window.wp.components,a=window.ReactJSXRuntime;function r({name:t,options:i,value:r,onChange:o,size:l="normal",disabled:n=!1}){const s=(0,e.useId)(),c=i.some(e=>e.description);return(0,a.jsx)("div",{className:["tpt-lc-chips","small"===l?"tpt-lc-chips--small":"",c?"tpt-lc-chips--described":""].join(" "),role:"radiogroup",children:i.map(e=>{const i=`${s}-${e.value}`,l=e.value===r;return(0,a.jsxs)("div",{className:"tpt-lc-chip",children:[(0,a.jsx)("input",{type:"radio",className:"tpt-lc-chip__input",id:i,name:t,value:e.value,checked:l,disabled:n,onChange:()=>o(e.value)}),(0,a.jsxs)("label",{className:"tpt-lc-chip__surface",htmlFor:i,children:[(0,a.jsx)("span",{className:"tpt-lc-chip__check","aria-hidden":"true",children:(0,a.jsx)("svg",{viewBox:"0 0 20 20",width:"16",height:"16",focusable:"false",children:(0,a.jsx)("path",{d:"M7.6 14.2 3.9 10.5l1.4-1.4 2.3 2.3 7-7 1.4 1.4z",fill:"currentColor"})})}),(0,a.jsxs)("span",{className:"tpt-lc-chip__text",children:[(0,a.jsx)("span",{className:"tpt-lc-chip__label",children:e.label}),e.description&&(0,a.jsx)("span",{className:"tpt-lc-chip__desc",children:e.description})]})]})]},e.value)})})}const o={STRONG:"strong",B:"strong",EM:"em",I:"em",DEL:"del",S:"del",STRIKE:"del"};function l(e){let t="";return e.childNodes.forEach(e=>{if(e.nodeType===Node.TEXT_NODE)return void(t+=(i=e.nodeValue,i.replace(/[&<>]/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;"}[e])).replace(/\u00a0/g," ")));var i;if(e.nodeType!==Node.ELEMENT_NODE)return;const a=o[e.nodeName];a?t+=`<${a}>${l(e)}</${a}>`:"A"===e.nodeName&&e.getAttribute("href")?t+=`<a href="${(e=>e.replace(/[&<>"]/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"}[e])))(e.getAttribute("href"))}">${l(e)}</a>`:"BR"===e.nodeName?t+=" ":t+=l(e)}),t}const n=["bold","italic","strikeThrough"];function s({value:r,placeholders:o=[],onChange:s,placeholder:c,disabled:p=!1}){const _=(0,e.useRef)(null),d=(0,e.useRef)(null),[u,g]=(0,e.useState)({}),h=[{command:"bold",icon:"editor-bold",label:(0,t.__)("Bold","tier-pricing-table")},{command:"italic",icon:"editor-italic",label:(0,t.__)("Italic","tier-pricing-table")},{command:"strikeThrough",icon:"editor-strikethrough",label:(0,t.__)("Strikethrough","tier-pricing-table")}];(0,e.useEffect)(()=>{const e=_.current,t=function(e){const t=document.createElement("template");return t.innerHTML=e||"",l(t.content)}(r);e&&l(e)!==t&&(e.innerHTML=t)},[r]);const m=(0,e.useCallback)(()=>{_.current&&s(l(_.current))},[s]),b=(0,e.useCallback)(()=>{const e={};n.forEach(t=>{try{e[t]=document.queryCommandState(t)}catch(i){e[t]=!1}}),g(e)},[]);(0,e.useEffect)(()=>{const e=()=>{const e=_.current,t=window.getSelection();e&&t&&t.rangeCount&&e.contains(t.anchorNode)&&(d.current=t.getRangeAt(0).cloneRange(),b())};return document.addEventListener("selectionchange",e),()=>document.removeEventListener("selectionchange",e)},[b]);const y=()=>{const e=_.current,t=window.getSelection();e.focus();const i=d.current;if(i&&e.contains(i.commonAncestorContainer))return t.removeAllRanges(),t.addRange(i),!0;const a=document.createRange();return a.selectNodeContents(e),a.collapse(!1),t.removeAllRanges(),t.addRange(a),!1};return(0,a.jsxs)("div",{className:"tpt-lc-editor"+(p?" tpt-lc-editor--disabled":""),children:[(0,a.jsxs)("div",{className:"tpt-lc-editor__box",children:[(0,a.jsx)("div",{className:"tpt-lc-editor__toolbar",role:"toolbar","aria-label":(0,t.__)("Formatting","tier-pricing-table"),children:h.map(({command:e,icon:t,label:r})=>(0,a.jsx)(i.Button,{size:"small",icon:t,label:r,isPressed:!!u[e],disabled:p,onMouseDown:e=>e.preventDefault(),onClick:()=>(e=>{y(),document.execCommand("styleWithCSS",!1,!1),document.execCommand(e,!1,null),m(),b()})(e)},e))}),(0,a.jsx)("div",{ref:_,className:"tpt-lc-editor__content",contentEditable:!p,suppressContentEditableWarning:!0,role:"textbox","aria-multiline":"false",spellCheck:!1,"data-placeholder":c||"",onInput:m,onBlur:m,onKeyUp:b,onMouseUp:b,onKeyDown:e=>{"Enter"===e.key&&e.preventDefault()},onPaste:e=>{e.preventDefault();const t=e.clipboardData.getData("text/plain").replace(/\s*[\r\n]+\s*/g," ");document.execCommand("insertText",!1,t),m()}})]}),o.length>0&&(0,a.jsx)("div",{className:"tpt-lc-template__placeholders",children:o.map(e=>(0,a.jsx)("button",{type:"button",className:"tpt-lc-template__placeholder",disabled:p,title:(0,t.__)("Insert","tier-pricing-table"),onMouseDown:e=>e.preventDefault(),onClick:()=>(e=>{const t=y(),i=_.current.textContent,a=t||!i||/\s$/.test(i)?"":" ";document.execCommand("insertText",!1,`${a}{${e}}`),m()})(e),children:`{${e}}`},e))})]})}function c({label:e,hint:t,children:i}){return(0,a.jsxs)("div",{className:"tpt-lc-field",children:[(0,a.jsx)("div",{className:"tpt-lc-field__label",children:e}),(0,a.jsx)("div",{className:"tpt-lc-field__control",children:i}),t&&(0,a.jsx)("div",{className:"tpt-lc-field__hint",children:t})]})}function p({id:t,title:i,note:r,noteTone:o="premium",locked:l,hidden:n=!1,keepMounted:s=!1,children:c}){const[p,_]=(0,e.useState)(()=>function(e){try{return"collapsed"===window.localStorage.getItem(`tpt-lc-card:${e}`)}catch(e){return!1}}(t)),d=`tpt-lc-card-${t}`;return(0,a.jsxs)("div",{className:`tpt-lc-card${l?" tpt-lc-card--locked":""}${p?" tpt-lc-card--collapsed":""}`,hidden:n,children:[(0,a.jsxs)("button",{type:"button",className:"tpt-lc-card__head","aria-expanded":p?"false":"true","aria-controls":d,onClick:()=>{_(!p),function(e,t){try{window.localStorage.setItem(`tpt-lc-card:${e}`,t?"collapsed":"open")}catch(e){}}(t,!p)},children:[(0,a.jsx)("span",{className:"tpt-lc-card__title",children:i}),(0,a.jsx)("span",{className:"tpt-lc-card__chevron","aria-hidden":"true",children:(0,a.jsx)("svg",{viewBox:"0 0 24 24",width:"20",height:"20",focusable:"false",children:(0,a.jsx)("path",{d:"M7.4 9.2 12 13.7l4.6-4.5 1.4 1.4-6 6-6-6z",fill:"currentColor"})})})]}),(s||!p)&&(0,a.jsxs)("div",{className:"tpt-lc-card__body",id:d,hidden:s&&p,children:[r&&(0,a.jsx)("div",{className:`tpt-lc-notice tpt-lc-notice--${o}`,role:"note",children:r}),c]})]})}function _({value:t,onChange:r,disabled:o=!1,label:l}){const[n,s]=(0,e.useState)(t);return(0,a.jsx)(i.Dropdown,{className:"tpt-lc-color",contentClassName:"tpt-lc-color__popover",popoverProps:{placement:"bottom-start"},renderToggle:({isOpen:e,onToggle:r})=>(0,a.jsxs)(i.Button,{className:"tpt-lc-color__toggle",onClick:r,"aria-expanded":e,variant:"secondary",disabled:o,children:[(0,a.jsx)(i.ColorIndicator,{colorValue:t}),(0,a.jsx)("code",{children:l||t})]}),renderContent:()=>(0,a.jsx)(i.ColorPicker,{color:n,enableAlpha:!1,onChange:e=>{s(e),r(e)}})})}function d({config:o,context:l,values:n,styleKey:d,onChange:u}){const g="catalog"===l,h=g&&"custom"!==n.layout_settings,m=g&&"yes"!==n.display,b=e=>String(e||"").split(",").map(e=>e.trim()).filter(Boolean),y=g&&o.catalog&&o.catalog.contexts||{},x=b(n.contexts).length?b(n.contexts):Object.keys(y),f=g&&"selected"===n.scope,[v,w]=(0,e.useState)(()=>({...o.catalog&&o.catalog.categoryNames||{}})),[k,j]=(0,e.useState)([]),C=(0,e.useRef)(null);(0,e.useEffect)(()=>()=>window.clearTimeout(C.current),[]);const N=b(n.categories).map(e=>v[e]).filter(Boolean),S=n.display_type,$=Object.entries(o.layouts).map(([e,t])=>({value:e,label:t})),T=g&&o.catalog&&(o.catalog.excludedStyles||{})[S]||[],M=d?Object.entries(o.styles[S]||{}).filter(([e])=>!T.includes(e)).map(([e,t])=>({value:e,label:t})):[],q=d&&T.includes(n[d])?"default":d?n[d]:null,B=Object.entries(o.positions).map(([e,t])=>({value:e,label:t})),E=Object.entries(o.quantityTypes).map(([e,t])=>({value:e,label:t.label,description:t.example})),O=Object.entries(o.tierOrders||{}).map(([e,t])=>({value:e,label:t.label,description:t.example})),P=Object.entries(o.discountFormats||{}).map(([e,t])=>({value:e,label:t.label,description:t.example})),H=e=>(o[e]||[]).includes(S),R=!g&&H("compactFor"),A=((o.spacingFor||{})[S]||[]).includes(d?q:"default"),L=""===n.layout_spacing||void 0===n.layout_spacing||null===n.layout_spacing?void 0:Number(n.layout_spacing),F=((o.badgeColorStyles||{})[S]||{})[d?q:"default"],z=!!F,D=F?"active"===F.default?n.selected_quantity_color:F.default:void 0,I={tint:[(0,t.__)("Auto: the design style's own badge colours.","tier-pricing-table"),(0,t.__)("A light tint of this colour behind the badge text in this colour. Reset for the design style's own colours.","tier-pricing-table")],solid:[(0,t.__)("Auto: the badge follows the active tier colour.","tier-pricing-table"),(0,t.__)("The badge background; its text stays white. Reset for the active tier colour.","tier-pricing-table")],bar:[(0,t.__)("Auto: the savings bar follows the active tier colour.","tier-pricing-table"),(0,t.__)("The savings bar and the percentage next to it. Reset for the active tier colour.","tier-pricing-table")]},K=F?(I[F.kind]||I.tint)[n.discount_badge_color?1:0]:"",J=((o.activeBorderStyles||{})[S]||[]).includes(d?q:"default"),Q=H("cellPaddingFor"),U=""===n.cell_padding||void 0===n.cell_padding||null===n.cell_padding?void 0:Number(n.cell_padding),V=(o.discountStyles||{})[S],W=H("discountFor")&&(!V||V.includes(d?n[d]:"default")),Y=(o.discountFormatStyles||{})[S],G=H("discountFormatFor")&&(!Y||Y.includes(n[d]))&&!(W&&"yes"!==n.show_discount_column),X=!g&&H("tooltipFor"),Z=H("columnsFor"),ee=H("clickableFor"),te=H("plainTextFor"),ie=Object.keys(o.unitFor||{}).find(e=>o.unitFor[e].includes(S))||null,ae=ie?n[ie]||{singular:"",plural:""}:null,re="tooltip"!==S,oe="yes"===n.display,le=o.optionsLayout||{},ne=(le.templates||[]).includes(S),se=(le.original||[]).includes(S),ce=(le.defaultOpt||[]).includes(S),pe=(le.total||[]).includes(S)&&(le.totalStyles||[]).includes(n.pricing_options_style),_e=e=>!o.premium&&(o.premiumOptions||[]).includes(e),de=(0,a.jsx)("span",{className:"tpt-lc-premium",children:(0,t.__)("Available in the premium version.","tier-pricing-table")}),ue=(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("strong",{children:(0,t.__)("Available in the premium version.","tier-pricing-table")})," ",(0,t.__)("You can try it in the preview; the store shows it with premium only.","tier-pricing-table")]}),ge=o.placeholders||{},he=W||se||pe||X||ee,me=Object.entries(o.priceFormats||{}).map(([e,t])=>({value:e,label:t.label,description:t.example})),be="same_as_catalog"!==n.product_page_price_format,ye="yes"===n.update_price_on_product_page,xe="yes"===n.you_save_enabled,fe=Object.entries((o.youSaveOptions||{}).styles||{}).map(([e,t])=>({value:e,label:t})),ve=Object.entries((o.youSaveOptions||{}).positions||{}).map(([e,t])=>({value:e,label:t})),we=!o.premium,ke="yes"===n.display_summary,je=Object.entries((o.summary||{}).types||{}).map(([e,t])=>({value:e,label:t})),Ce=Object.entries((o.summary||{}).positions||{}).map(([e,t])=>({value:e,label:t})),Ne=Object.entries((o.catalogPrice||{}).types||{}).map(([e,t])=>({value:e,label:t.label,description:t.example})),Se="yes"===n.tiered_price_at_catalog;let $e=null;g?$e=oe?(0,t.__)("Depending on the theme, the pricing block may need small CSS adjustments to fit the grid.","tier-pricing-table"):(0,t.__)("Tiered pricing is not shown on shop and category pages.","tier-pricing-table"):oe||($e=(0,t.__)("The layout is not inserted automatically. Place it with the [tiered-pricing-table] shortcode, the Tiered Pricing block or the widget; prices still update live.","tier-pricing-table"));const Te=(0,a.jsx)(c,{label:(0,t.__)("Position","tier-pricing-table"),children:(0,a.jsx)(i.SelectControl,{__nextHasNoMarginBottom:!0,disabled:!oe,value:n.position_hook,options:B,onChange:e=>u("position_hook",e)})});if("cart"===l){const e=o.cart||{},r="yes"===n.cart_upsell_enabled;return(0,a.jsxs)("div",{className:"tpt-lc-controls",children:[e.prices&&(0,a.jsxs)(p,{id:"cart-prices",title:(0,t.__)("Cart prices","tier-pricing-table"),locked:we,note:we?ue:null,children:[(0,a.jsx)(c,{label:(0,t.__)("Discounted items","tier-pricing-table"),hint:(0,t.__)("How items with a tiered price appear in the cart.","tier-pricing-table"),children:(0,a.jsxs)("div",{className:"tpt-lc-toggles",children:[(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Show the original item price crossed out","tier-pricing-table"),checked:"yes"===n.show_discount_in_cart,onChange:e=>u("show_discount_in_cart",e?"yes":"no")}),(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Show the original subtotal crossed out","tier-pricing-table"),checked:"yes"===n.show_subtotal_as_discount_in_cart,onChange:e=>u("show_subtotal_as_discount_in_cart",e?"yes":"no")}),(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Cross out the regular price instead of the sale price","tier-pricing-table"),help:(0,t.__)("For products on sale.","tier-pricing-table"),checked:"yes"===n.consider_sale_price_as_discount_in_cart,onChange:e=>u("consider_sale_price_as_discount_in_cart",e?"yes":"no")})]})}),(0,a.jsx)(c,{label:(0,t.__)("Total savings","tier-pricing-table"),hint:(0,t.__)("A row before the order total, in the cart totals and in the classic checkout's order review. Not available with the Checkout block.","tier-pricing-table"),children:(0,a.jsxs)("div",{className:"tpt-lc-toggles",children:[(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Show what the tiered prices take off the cart","tier-pricing-table"),checked:"yes"===n.cart_total_savings,onChange:e=>u("cart_total_savings",e?"yes":"no")}),"yes"===n.cart_total_savings&&(0,a.jsx)(i.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,t.__)("Row label","tier-pricing-table"),value:n.cart_total_savings_label||"",onChange:e=>u("cart_total_savings_label",e)})]})})]}),e.upsells&&(0,a.jsxs)(p,{id:"cart-upsell",title:(0,t.__)("Upsell message","tier-pricing-table"),locked:we,note:we?ue:null,children:[(0,a.jsx)(c,{label:(0,t.__)("Next tier message","tier-pricing-table"),hint:(0,t.__)("Shown under the item name while a higher tier is within reach. Not available with the Cart block.","tier-pricing-table"),children:(0,a.jsxs)("div",{className:"tpt-lc-toggles",children:[(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Show a message about the next tier","tier-pricing-table"),checked:r,onChange:e=>u("cart_upsell_enabled",e?"yes":"no")}),r&&(0,a.jsx)(s,{value:n.cart_upsell_template,placeholders:ge.cart_upsell_template||[],onChange:e=>u("cart_upsell_template",e)})]})}),r&&(0,a.jsx)(c,{label:(0,t.__)("Next tier shortcuts","tier-pricing-table"),children:(0,a.jsxs)("div",{className:"tpt-lc-toggles",children:[(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Make the quantity a link that sets the cart to the next tier","tier-pricing-table"),help:(0,t.__)("One click moves the line to the next tier and updates the cart.","tier-pricing-table"),checked:"no"!==n.cart_upsell_link,onChange:e=>u("cart_upsell_link",e?"yes":"no")}),(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Show a progress bar to the next tier","tier-pricing-table"),checked:"yes"===n.cart_upsell_progress,onChange:e=>u("cart_upsell_progress",e?"yes":"no")})]})}),r&&(0,a.jsx)(c,{label:(0,t.__)("Message colour","tier-pricing-table"),children:(0,a.jsx)(_,{value:n.cart_upsell_color,onChange:e=>u("cart_upsell_color",e)})})]})]})}return(0,a.jsxs)("div",{className:"tpt-lc-controls",children:[(0,a.jsxs)(p,{id:`${l}-layout`,title:(0,t.__)("Layout","tier-pricing-table"),children:[(0,a.jsx)(c,{label:(0,t.__)("Visibility","tier-pricing-table"),hint:$e,children:(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:g?(0,t.__)("Show on shop and category pages","tier-pricing-table"):(0,t.__)("Show on the product page","tier-pricing-table"),checked:oe,onChange:e=>u("display",e?"yes":"no")})}),g&&(!m||"yes"===n.badge_enabled)&&(0,a.jsx)(c,{label:(0,t.__)("Where it shows","tier-pricing-table"),hint:f?null:m?(0,t.__)("The badge shows in every product list: the shop, categories, search, related products, shortcodes and blocks.","tier-pricing-table"):(0,t.__)("Every product list: the shop, categories, search, related products, shortcodes and blocks.","tier-pricing-table"),children:(0,a.jsx)(r,{name:"tpt-lc-scope",options:Object.entries(o.catalog&&o.catalog.scopes||{}).map(([e,t])=>({value:e,label:t})),value:f?"selected":"everywhere",onChange:e=>u("scope",e)})}),g&&(!m||"yes"===n.badge_enabled)&&f&&Object.keys(y).length>0&&(0,a.jsx)(c,{label:(0,t.__)("Product lists","tier-pricing-table"),hint:(0,t.__)("The product lists that show tiered pricing.","tier-pricing-table"),children:(0,a.jsx)("div",{className:"tpt-lc-checklist",children:Object.entries(y).map(([e,t])=>(0,a.jsx)(i.CheckboxControl,{__nextHasNoMarginBottom:!0,label:t,checked:x.includes(e),onChange:t=>((e,t)=>{const i=x.filter(t=>t!==e);t&&i.push(e),u("contexts",i.length===Object.keys(y).length?"":i.join(","))})(e,t)},e))})}),g&&(!m||"yes"===n.badge_enabled)&&f&&(0,a.jsx)(c,{label:(0,t.__)("Only for products in","tier-pricing-table"),hint:(0,t.__)("Type to search categories. Leave empty for every product; a category covers its child categories.","tier-pricing-table"),children:(0,a.jsx)(i.FormTokenField,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,__experimentalExpandOnFocus:!0,__experimentalShowHowTo:!1,label:"",placeholder:(0,t.__)("All categories","tier-pricing-table"),value:N,suggestions:k,onInputChange:e=>{const t=o.catalog&&o.catalog.categorySearch||null;!t||e.length<2||(window.clearTimeout(C.current),C.current=window.setTimeout(()=>{const i=`${t.url}?action=${encodeURIComponent(t.action)}&security=${encodeURIComponent(t.nonce)}&term=${encodeURIComponent(e)}`;window.fetch(i,{credentials:"same-origin"}).then(e=>e.json()).then(e=>{const t={};Object.values(e||{}).forEach(e=>{e&&e.term_id&&(t[e.term_id]=String(e.formatted_name||e.name).replace(/\s\(\d+\)$/,""))}),w(e=>({...e,...t})),j(Object.values(t))}).catch(()=>{})},250))},onChange:e=>u("categories",e.map(e=>{const t="string"==typeof e?e:e.value,i=Object.keys(v).find(e=>v[e]===t);return i?String(i):""}).filter(Boolean).join(","))})}),g&&!m&&Te,g&&!m&&(0,a.jsx)(c,{label:(0,t.__)("Grid item","tier-pricing-table"),children:(0,a.jsxs)("div",{className:"tpt-lc-toggles",children:[(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Compact layout","tier-pricing-table"),help:(0,t.__)("Minimal styling so the pricing block fits the product grid.","tier-pricing-table"),checked:"yes"===n.use_reduced_styles,onChange:e=>u("use_reduced_styles",e?"yes":"no")}),(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Dynamic price","tier-pricing-table"),help:(0,t.__)("Update the displayed price to the tier price when the customer changes the quantity in the grid. Needs a quantity field on the grid item, from this plugin, the theme or another plugin.","tier-pricing-table"),checked:"yes"===n.dynamic_price,onChange:e=>u("dynamic_price",e?"yes":"no")}),(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Quantity selector in the grid","tier-pricing-table"),help:_e("show_quantity_field")?de:(0,t.__)("Adds a quantity field to every grid item. Only for themes that do not have one.","tier-pricing-table"),checked:"yes"===n.show_quantity_field,onChange:e=>u("show_quantity_field",e?"yes":"no")}),(0,a.jsx)(i.SelectControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,t.__)("Tiers per grid item","tier-pricing-table"),help:(0,t.__)('The rest sit behind a "+N more" link to the product page.',"tier-pricing-table"),value:n.tiers_limit||"",options:[{value:"",label:(0,t.__)("All","tier-pricing-table")},...[1,2,3,4,5,6].map(e=>({value:String(e),label:String(e)}))],onChange:e=>u("tiers_limit",e)})]})}),g&&!m&&(0,a.jsx)(c,{label:(0,t.__)("Layout source","tier-pricing-table"),hint:h?(0,t.__)("Shop and category pages use the product page layout and its settings.","tier-pricing-table"):null,children:(0,a.jsx)(r,{name:"tpt-lc-layout-source",options:[{value:"default",label:(0,t.__)("Same as product page","tier-pricing-table")},{value:"custom",label:(0,t.__)("Custom","tier-pricing-table")}],value:"custom"===n.layout_settings?"custom":"default",onChange:e=>u("layout_settings",e)})}),!h&&!m&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(c,{label:(0,t.__)("Layout","tier-pricing-table"),children:(0,a.jsx)(r,{name:"tpt-lc-layout",options:$,value:S,onChange:e=>u("display_type",e)})}),d&&(0,a.jsx)(c,{label:(0,t.__)("Design style","tier-pricing-table"),children:(0,a.jsx)(r,{name:"tpt-lc-style",size:"small",options:M,value:q,onChange:e=>u(d,e)})}),R&&(0,a.jsx)(c,{label:(0,t.__)("Compact layout","tier-pricing-table"),children:(0,a.jsx)("div",{className:"tpt-lc-toggles",children:(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Enable compact layout","tier-pricing-table"),help:(0,t.__)("A space-saving version of the selected design style.","tier-pricing-table"),checked:"yes"===n.compact_layout,onChange:e=>u("compact_layout",e?"yes":"no")})})}),A&&(0,a.jsx)(c,{label:(0,t.__)("Spacing","tier-pricing-table"),hint:void 0===L?(0,t.__)("Auto: each design style keeps its own spacing.","tier-pricing-table"):(0,t.__)("Gap between the tiers. Reset for the design style's own spacing.","tier-pricing-table"),children:(0,a.jsxs)("div",{className:"tpt-lc-spacing",children:[(0,a.jsx)(i.RangeControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,value:L,initialPosition:10,min:0,max:o.spacingMax||40,step:1,allowReset:!0,resetFallbackValue:void 0,withInputField:!1,onChange:e=>u("layout_spacing",null==e?"":String(e))}),(0,a.jsx)(i.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,type:"number",min:0,max:o.spacingMax||40,className:"tpt-lc-spacing__value",placeholder:(0,t.__)("Auto","tier-pricing-table"),value:void 0===L?"":String(L),onChange:e=>u("layout_spacing",String(e).replace(/[^0-9]/g,""))})]})}),Q&&(0,a.jsx)(c,{label:(0,t.__)("Cell padding","tier-pricing-table"),hint:void 0===U?(0,t.__)("Auto: each design style keeps its own cell padding.","tier-pricing-table"):(0,t.__)("Padding inside each cell; it also overrides the theme's cell padding. Reset for the design style's own padding.","tier-pricing-table"),children:(0,a.jsxs)("div",{className:"tpt-lc-spacing",children:[(0,a.jsx)(i.RangeControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,value:U,initialPosition:10,min:0,max:o.cellPaddingMax||30,step:1,allowReset:!0,resetFallbackValue:void 0,withInputField:!1,onChange:e=>u("cell_padding",null==e?"":String(e))}),(0,a.jsx)(i.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,type:"number",min:0,max:o.cellPaddingMax||30,className:"tpt-lc-spacing__value",placeholder:(0,t.__)("Auto","tier-pricing-table"),value:void 0===U?"":String(U),onChange:e=>u("cell_padding",String(e).replace(/[^0-9]/g,""))})]})}),(0,a.jsx)(c,{label:(0,t.__)("Active tier colour","tier-pricing-table"),children:(0,a.jsx)(_,{value:n.selected_quantity_color,onChange:e=>u("selected_quantity_color",e)})}),z&&(0,a.jsx)(c,{label:(0,t.__)("Discount badge colour","tier-pricing-table"),hint:K,children:(0,a.jsxs)("div",{className:"tpt-lc-color-row",children:[(0,a.jsx)(_,{value:n.discount_badge_color||D,label:n.discount_badge_color?void 0:(0,t.__)("Auto","tier-pricing-table"),onChange:e=>u("discount_badge_color",e)}),n.discount_badge_color&&(0,a.jsx)(i.Button,{variant:"tertiary",onClick:()=>u("discount_badge_color",""),children:(0,t.__)("Reset","tier-pricing-table")})]})}),J&&(0,a.jsx)(c,{label:(0,t.__)("Active tier border","tier-pricing-table"),children:(0,a.jsx)("div",{className:"tpt-lc-toggles",children:(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Mark the active tier with a left border","tier-pricing-table"),help:(0,t.__)("A bar in the active tier colour at the left of the row.","tier-pricing-table"),checked:"no"!==n.table_active_border,onChange:e=>u("table_active_border",e?"yes":"no")})})}),re&&(0,a.jsx)(c,{label:(0,t.__)("Title","tier-pricing-table"),children:(0,a.jsx)(i.TextControl,{__nextHasNoMarginBottom:!0,value:n.table_title,placeholder:(0,t.__)("e.g. Buy more, pay less","tier-pricing-table"),onChange:e=>u("table_title",e)})}),!g&&Te,(0,a.jsx)(c,{label:(0,t.__)("Quantity format","tier-pricing-table"),children:(0,a.jsx)(r,{name:"tpt-lc-quantity",options:E,value:n.quantity_type,onChange:e=>u("quantity_type",e)})}),(0,a.jsx)(c,{label:(0,t.__)("Tier order","tier-pricing-table"),children:(0,a.jsx)(r,{name:"tpt-lc-tier-order",options:O,value:"desc"===n.tiers_order?"desc":"asc",onChange:e=>u("tiers_order",e)})}),ie&&(0,a.jsx)(c,{label:(0,t.__)("Quantity unit","tier-pricing-table"),hint:(0,t.__)("Shown next to quantities, e.g. pieces, boxes, packs. Leave empty for none.","tier-pricing-table"),children:(0,a.jsxs)("div",{className:"tpt-lc-inline",children:[(0,a.jsx)(i.TextControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Singular","tier-pricing-table"),value:ae.singular,onChange:e=>u(ie,{...ae,singular:e})}),(0,a.jsx)(i.TextControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Plural","tier-pricing-table"),value:ae.plural,onChange:e=>u(ie,{...ae,plural:e})})]})}),Z&&(0,a.jsx)(c,{label:(0,t.__)("Column headers","tier-pricing-table"),hint:(0,t.__)("Leave a header empty to hide that column.","tier-pricing-table"),children:(0,a.jsxs)("div",{className:"tpt-lc-inline tpt-lc-inline--3",children:[(0,a.jsx)(i.TextControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Quantity","tier-pricing-table"),value:n.head_quantity_text,onChange:e=>u("head_quantity_text",e)}),(0,a.jsx)(i.TextControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Price","tier-pricing-table"),value:n.head_price_text,onChange:e=>u("head_price_text",e)}),(0,a.jsx)(i.TextControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Discount","tier-pricing-table"),value:n.head_discount_text,onChange:e=>u("head_discount_text",e)})]})}),G&&(0,a.jsx)(c,{label:(0,t.__)("Discount format","tier-pricing-table"),children:(0,a.jsx)(r,{name:"tpt-lc-discount-format",options:P,value:P.some(e=>e.value===n.discount_format)?n.discount_format:"percentage",onChange:e=>u("discount_format",e)})}),X&&(0,a.jsx)(c,{label:(0,t.__)("Tooltip icon","tier-pricing-table"),hint:(0,t.__)("Colour and size of the icon shown next to the price.","tier-pricing-table"),children:(0,a.jsxs)("div",{className:"tpt-lc-tooltip",children:[(0,a.jsx)(_,{value:n.tooltip_color,onChange:e=>u("tooltip_color",e)}),(0,a.jsx)(i.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,type:"number",min:8,max:64,className:"tpt-lc-tooltip__size",value:n.tooltip_size,suffix:"px",onChange:e=>u("tooltip_size",String(e).replace(/[^0-9]/g,""))})]})}),ne&&(0,a.jsx)(c,{label:(0,t.__)("Option text","tier-pricing-table"),hint:(0,t.__)("Text of each pricing option. Click a variable to insert it.","tier-pricing-table"),children:(0,a.jsx)(s,{value:n.options_option_text,placeholders:ge.options_option_text||[],onChange:e=>u("options_option_text",e)})}),(ce||ne)&&(0,a.jsx)(c,{label:(0,t.__)("Base price option","tier-pricing-table"),children:(0,a.jsxs)("div",{className:"tpt-lc-toggles",children:[ce&&(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Show an option for the regular price (no discount)","tier-pricing-table"),checked:"yes"===n.options_show_default_option,onChange:e=>u("options_show_default_option",e?"yes":"no")}),ne&&(!ce||"yes"===n.options_show_default_option)&&(0,a.jsx)(s,{value:n.options_default_option_text,placeholders:ge.options_default_option_text||[],onChange:e=>u("options_default_option_text",e)})]})}),te&&(0,a.jsx)(c,{label:(0,t.__)("Pricing string","tier-pricing-table"),hint:(0,t.__)("Text shown for each pricing tier. Click a variable to insert it.","tier-pricing-table"),children:(0,a.jsx)(s,{value:n.plain_text_template,placeholders:ge.plain_text_template||[],onChange:e=>u("plain_text_template",e)})}),te&&(0,a.jsx)(c,{label:(0,t.__)("First tier","tier-pricing-table"),children:(0,a.jsxs)("div",{className:"tpt-lc-toggles",children:[(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Show the regular price tier (no discount)","tier-pricing-table"),checked:"yes"===n.plain_text_show_first_tier,onChange:e=>u("plain_text_show_first_tier",e?"yes":"no")}),"yes"===n.plain_text_show_first_tier&&(0,a.jsx)(s,{value:n.plain_text_first_tier_template,placeholders:ge.plain_text_first_tier_template||[],onChange:e=>u("plain_text_first_tier_template",e)})]})}),he&&(0,a.jsx)(c,{label:(0,t.__)("Options","tier-pricing-table"),children:(0,a.jsxs)("div",{className:"tpt-lc-toggles",children:[W&&(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Show discount","tier-pricing-table"),checked:"yes"===n.show_discount_column,onChange:e=>u("show_discount_column",e?"yes":"no")}),X&&(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Tooltip border","tier-pricing-table"),checked:"yes"===n.tooltip_border,onChange:e=>u("tooltip_border",e?"yes":"no")}),se&&(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Show the original price crossed out","tier-pricing-table"),checked:"yes"===n.options_show_original_product_price,onChange:e=>u("options_show_original_product_price",e?"yes":"no")}),pe&&(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Show the total for the selected option","tier-pricing-table"),help:_e("options_show_total")?de:void 0,checked:"yes"===n.options_show_total,onChange:e=>u("options_show_total",e?"yes":"no")}),ee&&(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Make pricing tiers clickable","tier-pricing-table"),help:_e("clickable_table_rows")?de:(0,t.__)("Clicking a tier selects its quantity.","tier-pricing-table"),checked:"yes"===n.clickable_table_rows,onChange:e=>u("clickable_table_rows",e?"yes":"no")})]})})]})]}),!g&&(0,a.jsxs)(p,{id:"product-price",title:(0,t.__)("Price","tier-pricing-table"),children:[(0,a.jsx)(c,{label:(0,t.__)("Price display","tier-pricing-table"),children:(0,a.jsx)(r,{name:"tpt-lc-price-format",options:me,value:be?"custom":"same_as_catalog",onChange:e=>u("product_page_price_format",e)})}),be&&(0,a.jsx)(c,{label:(0,t.__)("Price behaviour","tier-pricing-table"),children:(0,a.jsxs)("div",{className:"tpt-lc-toggles",children:[(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Update the price on quantity change","tier-pricing-table"),help:(0,t.__)("The main price follows the quantity the customer enters.","tier-pricing-table"),checked:ye,onChange:e=>u("update_price_on_product_page",e?"yes":"no")}),ye&&(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Show the original price crossed out","tier-pricing-table"),help:(0,t.__)("Next to the discounted tier price.","tier-pricing-table"),checked:"yes"===n.show_tiered_price_as_discount,onChange:e=>u("show_tiered_price_as_discount",e?"yes":"no")}),(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Show the total price (price × quantity)","tier-pricing-table"),help:_e("show_total_price")?de:(0,t.__)("Instead of the price per item.","tier-pricing-table"),checked:"yes"===n.show_total_price,onChange:e=>u("show_total_price",e?"yes":"no")}),"yes"===n.show_total_price&&(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Also for products without tiered pricing","tier-pricing-table"),help:_e("show_total_price_non_tiered")?de:void 0,checked:"yes"===n.show_total_price_non_tiered,onChange:e=>u("show_total_price_non_tiered",e?"yes":"no")})]})})]}),!g&&o.youSave&&(0,a.jsxs)(p,{id:"product-badge",title:(0,t.__)("Savings badge","tier-pricing-table"),children:[(0,a.jsx)(c,{label:(0,t.__)("Badge","tier-pricing-table"),hint:(0,t.__)("Shown when the selected quantity has a discount. Also available as the [tiered_price_you_save] shortcode.","tier-pricing-table"),children:(0,a.jsxs)("div",{className:"tpt-lc-toggles",children:[(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Show the savings badge","tier-pricing-table"),checked:xe,onChange:e=>u("you_save_enabled",e?"yes":"no")}),xe&&(0,a.jsx)(s,{value:n.you_save_template,placeholders:ge.you_save_template||[],onChange:e=>u("you_save_template",e)})]})}),xe&&(0,a.jsx)(c,{label:(0,t.__)("Style","tier-pricing-table"),hint:(0,t.__)("Text: the colour as text colour. Pill: a filled label with white text. Outlined: a bordered label.","tier-pricing-table"),children:(0,a.jsx)(i.SelectControl,{__nextHasNoMarginBottom:!0,value:n.you_save_style||"text",options:fe,onChange:e=>u("you_save_style",e)})}),xe&&(0,a.jsx)(c,{label:(0,t.__)("Badge colour","tier-pricing-table"),hint:n.you_save_text_color?(0,t.__)("Reset for the active tier colour.","tier-pricing-table"):(0,t.__)("Auto: the badge follows the active tier colour.","tier-pricing-table"),children:(0,a.jsxs)("div",{className:"tpt-lc-color-row",children:[(0,a.jsx)(_,{value:n.you_save_text_color||n.selected_quantity_color,label:n.you_save_text_color?void 0:(0,t.__)("Auto","tier-pricing-table"),onChange:e=>u("you_save_text_color",e)}),n.you_save_text_color&&(0,a.jsx)(i.Button,{variant:"tertiary",onClick:()=>u("you_save_text_color",""),children:(0,t.__)("Reset","tier-pricing-table")})]})}),xe&&(0,a.jsx)(c,{label:(0,t.__)("Position","tier-pricing-table"),children:(0,a.jsx)(i.SelectControl,{__nextHasNoMarginBottom:!0,value:n.you_save_position||"price",options:ve,onChange:e=>u("you_save_position",e)})}),xe&&(0,a.jsx)(c,{label:(0,t.__)("Badge options","tier-pricing-table"),children:(0,a.jsxs)("div",{className:"tpt-lc-toggles",children:[(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Include the WooCommerce sale discount","tier-pricing-table"),help:(0,t.__)("An existing sale discount counts towards the savings.","tier-pricing-table"),checked:"yes"===n.you_save_consider_sale_price,onChange:e=>u("you_save_consider_sale_price",e?"yes":"no")}),"yes"===n.you_save_consider_sale_price&&(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Show for products without tiered pricing","tier-pricing-table"),help:(0,t.__)("For regular sale products.","tier-pricing-table"),checked:"yes"===n.you_save_non_tiered,onChange:e=>u("you_save_non_tiered",e?"yes":"no")})]})})]}),!g&&o.summary&&(0,a.jsxs)(p,{id:"product-summary",title:(0,t.__)("Pricing summary","tier-pricing-table"),locked:we,note:we?ue:null,children:[(0,a.jsx)(c,{label:(0,t.__)("Summary block","tier-pricing-table"),hint:(0,t.__)("Quantity, price per item and total for the selected quantity, near the pricing layout.","tier-pricing-table"),children:(0,a.jsxs)("div",{className:"tpt-lc-toggles",children:[(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Show the pricing summary block","tier-pricing-table"),checked:ke,onChange:e=>u("display_summary",e?"yes":"no")}),ke&&(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Show for products without tiered pricing","tier-pricing-table"),checked:"yes"===n.display_summary_non_tiered,onChange:e=>u("display_summary_non_tiered",e?"yes":"no")})]})}),ke&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(c,{label:(0,t.__)("Summary layout","tier-pricing-table"),children:(0,a.jsx)(r,{name:"tpt-lc-summary-type",size:"small",options:je,value:n.summary_type,onChange:e=>u("summary_type",e)})}),(0,a.jsx)(c,{label:(0,t.__)("Title","tier-pricing-table"),children:(0,a.jsx)(i.TextControl,{__nextHasNoMarginBottom:!0,value:n.summary_title,placeholder:(0,t.__)("e.g. Your order","tier-pricing-table"),onChange:e=>u("summary_title",e)})}),(0,a.jsx)(c,{label:(0,t.__)("Position","tier-pricing-table"),children:(0,a.jsx)(i.SelectControl,{__nextHasNoMarginBottom:!0,value:n.summary_position_hook,options:Ce,onChange:e=>u("summary_position_hook",e)})}),(0,a.jsx)(c,{label:(0,t.__)("Labels","tier-pricing-table"),children:(0,a.jsxs)("div",{className:"tpt-lc-inline",children:[(0,a.jsx)(i.TextControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Total","tier-pricing-table"),value:n.summary_total_label,onChange:e=>u("summary_total_label",e)}),(0,a.jsx)(i.TextControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Each","tier-pricing-table"),value:n.summary_each_label,onChange:e=>u("summary_each_label",e)})]})})]})]}),g&&(0,a.jsxs)(p,{id:"catalog-badge",title:(0,t.__)("Bulk savings badge","tier-pricing-table"),children:[(0,a.jsx)(c,{label:(0,t.__)("Badge","tier-pricing-table"),hint:(0,t.__)('A badge on the product image with the biggest discount the product\'s tiers give. Shows whether or not the pricing does, in the lists "Where it shows" allows.',"tier-pricing-table"),children:(0,a.jsxs)("div",{className:"tpt-lc-toggles",children:[(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Show a bulk savings badge","tier-pricing-table"),checked:"yes"===n.badge_enabled,onChange:e=>u("badge_enabled",e?"yes":"no")}),"yes"===n.badge_enabled&&(0,a.jsx)(s,{value:n.badge_template,placeholders:ge.badge_template||[],onChange:e=>u("badge_template",e)})]})}),"yes"===n.badge_enabled&&(0,a.jsx)(c,{label:(0,t.__)("Position","tier-pricing-table"),children:(0,a.jsx)(r,{name:"tpt-lc-badge-position",options:Object.entries(o.catalog&&o.catalog.badgePositions||{}).map(([e,t])=>({value:e,label:t})),value:"top-right"===n.badge_position?"top-right":"top-left",onChange:e=>u("badge_position",e)})}),"yes"===n.badge_enabled&&(0,a.jsx)(c,{label:(0,t.__)("Badge colour","tier-pricing-table"),hint:n.badge_color?(0,t.__)("Reset for the active tier colour.","tier-pricing-table"):(0,t.__)("Auto: the active tier colour.","tier-pricing-table"),children:(0,a.jsxs)("div",{className:"tpt-lc-color-row",children:[(0,a.jsx)(_,{value:n.badge_color||n.selected_quantity_color,label:n.badge_color?void 0:(0,t.__)("Auto","tier-pricing-table"),onChange:e=>u("badge_color",e)}),n.badge_color&&(0,a.jsx)(i.Button,{variant:"tertiary",onClick:()=>u("badge_color",""),children:(0,t.__)("Reset","tier-pricing-table")})]})})]}),g&&o.catalogPrice&&(0,a.jsxs)(p,{id:"catalog-price",title:(0,t.__)("Price","tier-pricing-table"),locked:we,note:we?ue:null,children:[(0,a.jsx)(c,{label:(0,t.__)("Price display","tier-pricing-table"),hint:(0,t.__)("The price shown in the product grid for products with tiered pricing.","tier-pricing-table"),children:(0,a.jsxs)("div",{className:"tpt-lc-toggles",children:[(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Replace the regular price","tier-pricing-table"),help:(0,t.__)("Show the lowest tier price or a price range instead.","tier-pricing-table"),checked:Se,onChange:e=>u("tiered_price_at_catalog",e?"yes":"no")}),Se&&(0,a.jsx)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Apply to variable products","tier-pricing-table"),help:(0,t.__)("Lowest and highest prices across all variations.","tier-pricing-table"),checked:"yes"===n.tiered_price_at_catalog_for_variable,onChange:e=>u("tiered_price_at_catalog_for_variable",e?"yes":"no")})]})}),Se&&(0,a.jsx)(c,{label:(0,t.__)("Format","tier-pricing-table"),children:(0,a.jsx)(r,{name:"tpt-lc-catalog-price-type",options:Ne,value:n.tiered_price_at_catalog_type,onChange:e=>u("tiered_price_at_catalog_type",e)})}),Se&&"lowest"===n.tiered_price_at_catalog_type&&(0,a.jsx)(c,{label:(0,t.__)("Prefix for the lowest price","tier-pricing-table"),children:(0,a.jsx)(i.TextControl,{__nextHasNoMarginBottom:!0,value:n.lowest_prefix,onChange:e=>u("lowest_prefix",e)})}),Se&&"custom"===n.tiered_price_at_catalog_type&&(0,a.jsx)(c,{label:(0,t.__)("Custom template","tier-pricing-table"),hint:(0,t.__)("Click a variable to insert it.","tier-pricing-table"),children:(0,a.jsx)(s,{value:n.tiered_price_at_catalog_custom_template,placeholders:ge.tiered_price_at_catalog_custom_template||[],onChange:e=>u("tiered_price_at_catalog_custom_template",e)})})]})]})}const u=e=>String(e).replace(/[&<>"']/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"}[e])),g={woocommerce_before_single_product_summary:"before-summary",woocommerce_single_product_summary:"above-title",woocommerce_before_add_to_cart_form:"before-form",woocommerce_before_add_to_cart_button:"before-button",woocommerce_after_add_to_cart_button:"after-button",woocommerce_after_add_to_cart_form:"after-form",woocommerce_after_single_product_summary:"after-summary"},h={woocommerce_shop_loop_item_title__5:"above-title",woocommerce_shop_loop_item_title__15:"below-title",woocommerce_after_shop_loop_item__6:"above-button",woocommerce_after_shop_loop_item__15:"below-button"},m=String.raw`
2 2 (function () {
3 3 var data = window.TPT_PREVIEW;
4 4 if (!data) { return; }
5 5 var qtyInput = document.querySelector('[data-preview-qty]');
@@ -27,8 +27,13 @@
27 27 var checkbox = el.querySelector('.tiered-pricing-option-checkbox');
28 28 if (checkbox) { checkbox.classList.add('tiered-pricing-option-checkbox--active'); }
29 29 }
30 30 function setText(attr, text) { each('[' + attr + ']', function (el) { el.textContent = text; }); }
31 + function badgeMarkup(badge, text) {
32 + var style = badge.style || 'text', color = esc(badge.color || '#3858e9');
33 + var css = style === 'pill' ? 'background-color:' + color + ';color:#fff' : (style === 'outline' ? 'color:' + color + ';border-color:' + color : 'color:' + color);
34 + return (badge.position === 'price' ? '<br>' : '') + '<small class="tiered-pricing-you-save tiered-pricing-you-save--' + style + '" style="' + css + '">' + text + '</small>';
35 + }
31 36 function render() {
32 37 var q = Math.max(1, parseInt(qtyInput ? qtyInput.value : data.quantity, 10) || 1);
33 38 var tier = tierFor(q), unit = tier.price, regular = data.regular, discounted = unit < regular;
34 39 if (priceEl && data.customPrice && data.updatesPrice) {
@@ -38,9 +43,9 @@
38 43 // the badge follows the quantity even while the price line itself stays put
39 44 if (badgeEl && data.badge) {
40 45 if (discounted) {
41 46 var saving = regular - unit, discount = Math.floor((saving / regular) * 100 + 1e-9);
42 - badgeEl.innerHTML = '<br><small class="tiered-pricing-you-save" style="color:' + esc(data.badge.color) + '">' + data.badge.template.replace(/\{tp_ys_price\}/g, esc(formatPrice(saving))).replace(/\{tp_ys_total_price\}/g, esc(formatPrice(saving * q))).replace(/\{tp_ys_percentage_discount\}/g, discount) + '</small>';
47 + badgeEl.innerHTML = badgeMarkup(data.badge, data.badge.template.replace(/\{tp_ys_price\}/g, esc(formatPrice(saving))).replace(/\{tp_ys_total_price\}/g, esc(formatPrice(saving * q))).replace(/\{tp_ys_percentage_discount\}/g, discount));
43 48 } else {
44 49 badgeEl.innerHTML = '';
45 50 }
46 51 }
@@ -60,5 +65,5 @@
60 65 });
61 66 }
62 67 render();
63 68 })();
64 -`,b=(e,t)=>`<p class="tpt-skel__note${t?" tpt-skel__note--top":""}">${g(e)}</p>`;function x(e,t){const i=e.stylesheets.map(e=>`<link rel="stylesheet" href="${g(e)}">`).join("");return`<!doctype html><html><head><meta charset="utf-8"><style>\nhtml, body { margin: 0; background: #fff; }\nbody { font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; color: #1d2327; }\n</style>${e.inlineStyles?`<style>${e.inlineStyles}</style>`:""}${i}<style>\nbody { padding: 20px 24px 24px; }\n.tpt-skel { max-width: 1100px; margin: 0 auto; }\n.tpt-skel__columns { display: flex; gap: 28px; align-items: flex-start; }\n.tpt-skel__gallery { flex: 0 0 26%; max-width: 240px; aspect-ratio: 4 / 5; border-radius: 8px; background: linear-gradient(135deg, #f0f0f1, #e0e0e2); position: relative; }\n.tpt-skel__gallery::after, .tpt-skel__card-image::after { content: ""; position: absolute; inset: 34% 30%; border-radius: 6px; background: rgba(255,255,255,.55); }\n.tpt-skel__gallery--image { aspect-ratio: auto; background: none; }\n.tpt-skel__gallery--image::after { content: none; }\n.tpt-skel__gallery--image img { display: block; width: 100%; height: auto; border-radius: 8px; }\n.tpt-skel__card-image--image { aspect-ratio: auto; background: none; }\n.tpt-skel__badge { position: absolute; top: 10px; left: 10px; z-index: 5; padding: 4px 10px; border-radius: 4px; color: #fff; font-size: 12px; font-weight: 700; line-height: 1.3; letter-spacing: .3px; text-transform: uppercase; white-space: nowrap; }\n.tpt-skel__badge--top-right { left: auto; right: 10px; }\n/* the "+N more" link is inert in the preview */\n.tpt-skel .tiered-pricing-more-tiers { display: inline-block; margin-top: 6px; font-size: 12px; text-decoration: underline; pointer-events: none; cursor: default; }\n.tpt-skel__card-image--image::after { content: none; }\n.tpt-skel__card-image--image img { display: block; width: 100%; height: auto; border-radius: 8px; }\n.tpt-skel__thumb--image { background: none; }\n.tpt-skel__thumb--image img { display: block; width: 56px; height: 56px; border-radius: 6px; object-fit: cover; }\n.tpt-skel__summary { flex: 1 1 auto; min-width: 0; }\n@media (max-width: 640px) { body { padding: 16px; } .tpt-skel__columns { flex-direction: column; align-items: stretch; gap: 18px; } .tpt-skel__gallery { flex: 0 0 auto; width: 100%; max-width: none; aspect-ratio: 4 / 3; } .tpt-skel__summary { float: none; width: 100% !important; } .tpt-skel__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; } }\n.tpt-skel__title { margin: 0 0 10px; font-size: 24px; font-weight: 600; line-height: 1.25; }\n.tpt-skel__price { margin: 0 0 22px; font-size: 20px; font-weight: 600; }\n.tpt-skel__price del { margin-right: 6px; color: #757575; font-weight: 400; }\n.tpt-skel__price ins { text-decoration: none; }\n.tpt-skel__price small { display: inline-block; margin-top: 6px; font-size: 13px; font-weight: 500; }\n.tpt-skel__bar { height: 10px; border-radius: 5px; background: #e6e6e8; margin: 0 0 8px; }\n.tpt-skel__bar--short { width: 62%; }\n.tpt-skel__desc { margin: 0 0 18px; }\n.tpt-skel__cart { display: flex; align-items: center; gap: 10px; margin: 14px 0; }\n.tpt-skel__qty { width: 64px; height: 38px; box-sizing: border-box; border: 1px solid #c3c4c7; border-radius: 4px; padding: 0 6px 0 10px; font: inherit; background: #fff; }\n.tpt-skel__button { height: 38px; padding: 0 18px; border: 0; border-radius: 4px; background: #1d2327; color: #fff; font: inherit; font-weight: 600; }\n.tpt-skel__tabs { display: flex; gap: 18px; margin: 28px 0 14px; padding-bottom: 8px; border-bottom: 1px solid #e6e6e8; }\n.tpt-skel__tab { width: 84px; height: 10px; border-radius: 5px; background: #e6e6e8; }\n.tpt-skel__slot { margin: 12px 0; }\n.tpt-skel__slot:empty { display: none; }\n.tpt-skel__slot--before-summary, .tpt-skel__slot--after-summary { margin: 0 0 18px; }\n.tpt-skel__slot--after-summary { margin: 18px 0 0; }\n.tpt-skel__note { margin: 0; padding: 12px 14px; border: 1px dashed #c3c4c7; border-radius: 6px; color: #646970; font-size: 13px; }\n.tpt-skel__note--top { margin: 0 0 18px; }\n.tpt-skel__tooltip-icon { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; margin-left: 6px; border-radius: 50%; background: #1d2327; color: #fff; font-size: 12px; font-weight: 700; vertical-align: middle; }\n/* product grid */\n.tpt-skel__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; }\n.tpt-skel__card { min-width: 0; }\n.tpt-skel__card-image { position: relative; aspect-ratio: 1 / 1; margin: 0 0 12px; border-radius: 8px; background: linear-gradient(135deg, #f0f0f1, #e0e0e2); }\n.tpt-skel__card-title { margin: 0 0 6px; font-size: 16px; font-weight: 600; line-height: 1.3; }\n.tpt-skel__card-price { margin: 0 0 10px; font-size: 15px; font-weight: 600; }\n.tpt-skel__card .tpt-skel__cart { margin: 10px 0; gap: 8px; }\n.tpt-skel__card .tpt-skel__qty { width: 50px; height: 34px; }\n.tpt-skel__card .tpt-skel__button { height: 34px; padding: 0 14px; font-size: 13px; }\n.tpt-skel__card .tpt-skel__slot { margin: 8px 0; }\n.tpt-skel__slot .tier-pricing-summary-table { margin-top: 12px; }\n/* cart page (the table display model is pinned: themes restyle tables on cart pages) */\n.tpt-skel--cart .tpt-skel__title { margin-bottom: 18px; }\n.tpt-skel__cart-table { display: table !important; width: 100% !important; border-collapse: collapse; margin: 0 0 24px; }\n.tpt-skel__cart-table thead { display: table-header-group !important; }\n.tpt-skel__cart-table tbody { display: table-row-group !important; }\n.tpt-skel__cart-table tr { display: table-row !important; }\n.tpt-skel__cart-table th, .tpt-skel__cart-table td { display: table-cell !important; width: auto; }\n.tpt-skel__cart-table th, .tpt-skel__cart-table td { padding: 12px 10px; border-bottom: 1px solid #e6e6e8; text-align: left; vertical-align: middle; }\n.tpt-skel__cart-table th { font-size: 13px; font-weight: 600; color: #646970; }\n.tpt-skel__cart-table td:first-child { width: 72px; }\n.tpt-skel__thumb { width: 56px; height: 56px; border-radius: 6px; background: linear-gradient(135deg, #f0f0f1, #e0e0e2); }\n.tpt-skel__cart-name { font-weight: 600; }\n.tpt-skel__upsell { margin-top: 6px; font-size: 16px; }\n.tpt-skel__upsell-link { color: inherit; font-weight: 600; text-decoration: underline; }\n.tpt-skel__upsell-progress { height: 6px; max-width: 220px; margin-top: 6px; border-radius: 3px; background: rgba(0, 0, 0, .08); }\n.tpt-skel__upsell-progress i { display: block; height: 100%; border-radius: 3px; background: currentColor; }\n.tpt-skel__cart-price { white-space: nowrap; font-weight: 600; }\n.tpt-skel__cart-price del { margin-right: 6px; color: #757575; font-weight: 400; }\n.tpt-skel__cart-price ins { text-decoration: none; }\n.tpt-skel__cart-totals { max-width: 360px; margin-left: auto; padding: 16px 18px; border: 1px solid #e6e6e8; border-radius: 8px; }\n.tpt-skel__cart-totals-title { margin: 0 0 10px; font-size: 16px; font-weight: 600; }\n.tpt-skel__cart-totals-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #f0f0f1; }\n.tpt-skel__cart-totals-row .tpt-skel__bar { margin: 0; }\n.tpt-skel__cart-totals-row--total { font-weight: 600; border-bottom: 0; }\n.tpt-skel__button--wide { width: 100%; margin-top: 12px; }\n/* compact spacing on top of the theme and WooCommerce (preview only): tight margins around the pricing\n fragment and padded table cells, whatever the theme's table and form spacing */\n.tpt-skel form.cart { margin: 0 !important; }\n.tpt-skel .summary { margin-bottom: 0 !important; }\n.tpt-skel .tiered-pricing-wrapper { margin: 0 !important; }\n.tpt-skel .tiered-pricing-wrapper > h3 { margin: 0 0 10px !important; }\n.tpt-skel .tpt__tiered-pricing table.tiered-pricing-table { margin: 0 !important; }\n.tpt-skel .tpt__tiered-pricing table.tiered-pricing-table th,\n.tpt-skel .tpt__tiered-pricing table.tiered-pricing-table td { padding: var(--tiered-pricing-cell-padding, 9px 12px) !important; }\n.tpt-skel .tpt__tiered-pricing table.tiered-pricing-table--slim th,\n.tpt-skel .tpt__tiered-pricing table.tiered-pricing-table--slim td { padding: var(--tiered-pricing-cell-padding, 5px 8px) !important; }\n.tpt-skel .tier-pricing-summary-table { margin: 12px 0 0 !important; }\n/* the sample page is always on white, whatever the theme paints behind its pages */\nhtml, body { background: #fff !important; }\n</style></head>\n<body class="${"woocommerce woocommerce-page"+(e.blockTheme?" woocommerce-uses-block-theme":"")}">${t}<script>(function(){var c=(getComputedStyle(document.body).color.match(/\\d+(\\.\\d+)?/g)||[]).map(Number);if(c.length>=3&&(0.2126*c[0]+0.7152*c[1]+0.0722*c[2])/255>0.55){document.body.style.color='#1d2327';}})();<\/script></body></html>`}function y(e,t,i){return e.catalogPrice&&"yes"===t.tiered_price_at_catalog&&i&&i.catalogPrice?i.catalogPrice:g(e.currency.price)}const v=["display","position_hook","tooltip_color","tooltip_size","show_tiered_price_as_discount","show_total_price","show_total_price_non_tiered","you_save_enabled","you_save_consider_sale_price","you_save_non_tiered","you_save_template","you_save_text_color","display_summary","display_summary_non_tiered","summary_position_hook","tiered_price_at_catalog","tiered_price_at_catalog_for_variable","show_discount_in_cart","show_subtotal_as_discount_in_cart","consider_sale_price_as_discount_in_cart","cart_upsell_enabled","cart_upsell_template","cart_upsell_color","cart_upsell_link","cart_upsell_progress","cart_total_savings","cart_total_savings_label","scope","contexts","categories","badge_enabled","badge_template","badge_position","badge_color"];function f({config:l,context:r,values:n,view:o,effectiveLayout:s}){const[c,p]=(0,e.useState)(null),[_,d]=(0,e.useState)({}),[f,k]=(0,e.useState)(!0),[w,j]=(0,e.useState)(!1),C=(0,e.useRef)(null),N=(0,e.useRef)(0),$=(0,e.useRef)(null),[S,T]=(0,e.useState)(0),[M,q]=(0,e.useState)(0);(0,e.useEffect)(()=>{const e=()=>q(e=>e+1);return window.document.addEventListener("tiered-pricing/custom-columns/saved",e),()=>window.document.removeEventListener("tiered-pricing/custom-columns/saved",e)},[]);const B=(0,e.useMemo)(()=>{const e=[...v],t=l.catalog;return t&&e.push(t.keys.display,t.keys.position_hook,t.keys.use_reduced_styles,t.keys.dynamic_price,t.keys.show_quantity_field),e},[l]),P=JSON.stringify([r,M,Object.keys(n).filter(e=>!B.includes(e)).sort().map(e=>n[e])]);(0,e.useEffect)(()=>{const e=new AbortController;if(k(!0),"cart"===r)return p(""),j(!1),T(e=>e+1),()=>{};const t=setTimeout(()=>{(function(e,t,i,a){const l=new URLSearchParams;return l.set("action",e.ajax.action),l.set("nonce",e.ajax.nonce),l.set("context","catalog"===i?"shop-loop":"product-page"),l.append("kinds[]","display_type"),Object.entries(t).forEach(([e,t])=>{t&&"object"==typeof t?Object.entries(t).forEach(([t,i])=>l.set(`values[${e}][${t}]`,i)):l.set(`values[${e}]`,t)}),fetch(e.ajax.url,{method:"POST",credentials:"same-origin",body:l,signal:a}).then(e=>e.json()).then(e=>{if(!e||!e.success||!e.data.fragments)throw new Error("preview failed");return{fragment:e.data.fragments.display_type||"",extras:e.data.extras||{}}})})(l,n,r,e.signal).then(e=>{d(e.extras),p(e.fragment),j(!1),T(e=>e+1)}).catch(e=>{"AbortError"!==e.name&&(j(!0),k(!1))})},250);return()=>{clearTimeout(t),e.abort()}},[P]);const E=JSON.stringify(o),H=(0,e.useMemo)(()=>{return null===c?null:"cart"===(e={config:l,context:r,values:o,effectiveLayout:s,fragment:c,extras:_}).context?function({config:e,values:i}){const a=e.samples||{},l=a.upsell||{},r=e.cart||{},n=r.prices&&"yes"===i.show_discount_in_cart,o=r.prices&&"yes"===i.show_subtotal_as_discount_in_cart,s=n?`<del>${g(a.price)}</del> <ins>${g(a.tierPrice)}</ins>`:g(a.tierPrice),c=o?`<del>${g(a.total)}</del> <ins>${g(a.tierTotal)}</ins>`:g(a.tierTotal);let p="";if(r.upsells&&"yes"===i.cart_upsell_enabled){const e=g(l.requiredQuantity??""),t=(i.cart_upsell_template||"").replace(/\{tp_required_quantity\}/g,"no"!==i.cart_upsell_link?`<a class="tpt-skel__upsell-link" href="#" onclick="return false">${e}</a>`:e).replace(/\{tp_next_price\}/g,g(l.nextPrice||"")).replace(/\{tp_next_discount\}/g,g(l.nextDiscount||"")).replace(/\{tp_actual_discount\}/g,g(l.actualDiscount||"")),a="yes"===i.cart_upsell_progress?`<div class="tpt-skel__upsell-progress"><i style="width:${Math.max(2,Math.min(100,parseInt(l.progress,10)||0))}%"></i></div>`:"";p=`<div class="tpt-skel__upsell" style="color:${g(i.cart_upsell_color||"#059669")}"><small>${t}</small>${a}</div>`}const _=r.prices&&"yes"===i.cart_total_savings?`<div class="tpt-skel__cart-totals-row"><span>${g(i.cart_total_savings_label||(0,t.__)("Total savings","tier-pricing-table"))}</span><span>${g(a.savingTotal)}</span></div>`:"";return x(e,`\n<div class="tpt-skel tpt-skel--cart">\n\t<h1 class="tpt-skel__title">${g((0,t.__)("Cart","tier-pricing-table"))}</h1>\n\t<table class="tpt-skel__cart-table">\n\t\t<thead>\n\t\t\t<tr>\n\t\t\t\t<th></th>\n\t\t\t\t<th>${g((0,t.__)("Product","tier-pricing-table"))}</th>\n\t\t\t\t<th>${g((0,t.__)("Price","tier-pricing-table"))}</th>\n\t\t\t\t<th>${g((0,t.__)("Quantity","tier-pricing-table"))}</th>\n\t\t\t\t<th>${g((0,t.__)("Subtotal","tier-pricing-table"))}</th>\n\t\t\t</tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td><div class="tpt-skel__thumb${e.placeholder?" tpt-skel__thumb--image":""}">${e.placeholder?`<img src="${g(e.placeholder)}" alt="">`:""}</div></td>\n\t\t\t\t<td><div class="tpt-skel__cart-name">${g(a.productName||(0,t.__)("Product name","tier-pricing-table"))}</div>${p}</td>\n\t\t\t\t<td class="tpt-skel__cart-price">${s}</td>\n\t\t\t\t<td><input class="tpt-skel__qty" type="text" value="${g(a.quantity||1)}" readonly></td>\n\t\t\t\t<td class="tpt-skel__cart-price">${c}</td>\n\t\t\t</tr>\n\t\t</tbody>\n\t</table>\n\t<div class="tpt-skel__cart-totals">\n\t\t<div class="tpt-skel__cart-totals-title">${g((0,t.__)("Cart totals","tier-pricing-table"))}</div>\n\t\t<div class="tpt-skel__cart-totals-row"><span>${g((0,t.__)("Subtotal","tier-pricing-table"))}</span><span>${g(a.tierTotal)}</span></div>\n\t\t<div class="tpt-skel__cart-totals-row"><span>${g((0,t.__)("Shipping","tier-pricing-table"))}</span><div class="tpt-skel__bar" style="width:90px"></div></div>\n\t\t${_}\n\t\t<div class="tpt-skel__cart-totals-row tpt-skel__cart-totals-row--total"><span>${g((0,t.__)("Total","tier-pricing-table"))}</span><span>${g(a.tierTotal)}</span></div>\n\t\t<button class="tpt-skel__button tpt-skel__button--wide" type="button">${g((0,t.__)("Proceed to checkout","tier-pricing-table"))}</button>\n\t</div>\n</div>`)}(e):"catalog"===e.context?function({config:e,values:i,fragment:a,extras:l}){const r=h[i.position_hook]||"above-button",n=y(e,i,l),o="yes"===i.display,s="yes"===i.use_reduced_styles,c="yes"===i.show_quantity_field,p=e.samples||{};let _="";if("yes"===i.badge_enabled){const e=(i.badge_template||"").replace(/\{tp_max_discount\}/g,g(p.maxDiscount||"")).replace(/\{tp_lowest_price\}/g,g(p.lowest||"")).replace(/\{tp_lowest_quantity\}/g,g(p.lowestQuantity??"")).replace(/\{tp_max_saving\}/g,g(p.maxSaving||""));_=`<span class="tpt-skel__badge tpt-skel__badge--${"top-right"===i.badge_position?"top-right":"top-left"}" style="background:${g(i.badge_color||i.selected_quantity_color||"#3858e9")}">${e}</span>`}let d="",u="";o?(e=>/^\s*<p class="tpt-preview-note"/.test(e))(a)?d=a.replace('class="tpt-preview-note"','class="tpt-skel__note tpt-skel__note--top"'):u=`<div class="tiered-pricing-shop-loop${s?" tiered-pricing-shop-loop--reduced":""}">${a}</div>`:d=b((0,t.__)("Tiered pricing is switched off for shop and category pages.","tier-pricing-table"),!0);const m=e=>`<div class="tpt-skel__slot tpt-skel__slot--${e}">${r===e?u:""}</div>`,v=()=>`\n\t\t<div class="tpt-skel__card product">\n\t\t\t<div class="tpt-skel__card-image${e.placeholder?" tpt-skel__card-image--image":""}">${e.placeholder?`<img src="${g(e.placeholder)}" alt="">`:""}${_}</div>\n\t\t\t${m("above-title")}\n\t\t\t<h2 class="tpt-skel__card-title">${g((0,t.__)("Product name","tier-pricing-table"))}</h2>\n\t\t\t${m("below-title")}\n\t\t\t<p class="tpt-skel__card-price price">${n}</p>\n\t\t\t${m("above-button")}\n\t\t\t<div class="tpt-skel__cart">\n\t\t\t\t${c?'<input class="tpt-skel__qty" type="text" value="1" readonly>':""}\n\t\t\t\t<button class="tpt-skel__button" type="button">${g((0,t.__)("Add to cart","tier-pricing-table"))}</button>\n\t\t\t</div>\n\t\t\t${m("below-button")}\n\t\t</div>`;return x(e,`\n<div class="tpt-skel tpt-skel--grid woocommerce archive">\n\t${d}\n\t<div class="tpt-skel__grid products">\n\t\t${v()}${v()}${v()}\n\t</div>\n</div>`)}(e):function({config:e,values:i,effectiveLayout:a,fragment:l,extras:r}){const n=u[i.position_hook]||"before-button",o=u[i.summary_position_hook]||"after-button",s=e.summary&&"yes"===i.display_summary&&r&&r.summary||"",c="tooltip"===a,p="yes"===i.display,_=Math.min(64,Math.max(8,parseInt(i.tooltip_size,10)||15));let d=l;p?c&&(d=b((0,t.__)("The tooltip layout adds an icon next to the price; the pricing table appears when the customer hovers over it.","tier-pricing-table"))):d=b((0,t.__)("Not shown automatically: the pricing layout appears where you place the shortcode, block or widget.","tier-pricing-table"));const h=e=>`<div class="tpt-skel__slot tpt-skel__slot--${e}">${n===e?d:""}${o===e?s:""}</div>`,v=e=>`<div class="tpt-skel__bar${e?" tpt-skel__bar--short":""}"></div>`,f=c&&p?`<span class="tpt-skel__tooltip-icon" style="background:${g(i.tooltip_color||"#3858e9")};width:${_}px;height:${_}px;font-size:${Math.round(.66*_)}px">i</span>`:"",k=e.samples||{},w="same_as_catalog"!==i.product_page_price_format,j=w&&"yes"===i.update_price_on_product_page,C=w&&"yes"===i.show_total_price,N=j&&"yes"===i.show_tiered_price_as_discount,$=k.quantity||1;let S=g(e.currency.price);if(w){if(j){const e=g(C?k.total:k.price),t=g(C?k.tierTotal:k.tierPrice);S=N?`<del>${e}</del> <ins>${t}</ins>`:t}}else S=y(e,i,r);const T={tiers:k.tiers||[],regular:k.regular||0,quantity:$,currency:e.currency,customPrice:w,updatesPrice:j,total:C,crossed:N,badge:e.youSave&&"yes"===i.you_save_enabled?{template:i.you_save_template||"",color:i.you_save_text_color||"#FF0000"}:null,clickable:"yes"===i.clickable_table_rows,productName:k.productName||(0,t.__)("Product name","tier-pricing-table")},M=JSON.stringify(T).replace(/</g,"\\u003c");let q="";if(e.youSave&&"yes"===i.you_save_enabled){const e=(i.you_save_template||"").replace(/\{tp_ys_price\}/g,g(k.saving||"")).replace(/\{tp_ys_total_price\}/g,g(k.savingTotal||"")).replace(/\{tp_ys_percentage_discount\}/g,g(k.discount||""));q=`<br><small class="tiered-pricing-you-save" style="color:${g(i.you_save_text_color||"#FF0000")}">${e}</small>`}return x(e,`\n<div class="tpt-skel woocommerce single-product">\n\t<div class="product">\n\t\t${h("before-summary")}\n\t\t<div class="tpt-skel__columns">\n\t\t\t<div class="tpt-skel__gallery${e.placeholder?" tpt-skel__gallery--image":""}">${e.placeholder?`<img src="${g(e.placeholder)}" alt="">`:""}</div>\n\t\t\t<div class="tpt-skel__summary summary entry-summary">\n\t\t\t\t${h("above-title")}\n\t\t\t\t<h1 class="tpt-skel__title product_title entry-title">${g((0,t.__)("Product name","tier-pricing-table"))}</h1>\n\t\t\t\t<p class="tpt-skel__price price"><span data-preview-price>${S}</span>${f}<span data-preview-badge>${q}</span></p>\n\t\t\t\t<div class="tpt-skel__desc">${v()}${v(!0)}</div>\n\t\t\t\t${h("before-form")}\n\t\t\t\t<form class="cart" action="#" onsubmit="return false;">\n\t\t\t\t\t${h("before-button")}\n\t\t\t\t\t<div class="tpt-skel__cart">\n\t\t\t\t\t\t<input class="tpt-skel__qty" type="number" min="1" step="1" value="${$}" data-preview-qty aria-label="${g((0,t.__)("Quantity","tier-pricing-table"))}">\n\t\t\t\t\t\t<button class="tpt-skel__button" type="button">${g((0,t.__)("Add to cart","tier-pricing-table"))}</button>\n\t\t\t\t\t</div>\n\t\t\t\t\t${h("after-button")}\n\t\t\t\t</form>\n\t\t\t\t${h("after-form")}\n\t\t\t</div>\n\t\t</div>\n\t\t${h("after-summary")}\n\t\t<div class="tpt-skel__tabs"><div class="tpt-skel__tab"></div><div class="tpt-skel__tab"></div><div class="tpt-skel__tab"></div></div>\n\t\t${v()}${v()}${v(!0)}\n\t</div>\n</div>\n<script>window.TPT_PREVIEW = ${M};<\/script>\n<script>${m}<\/script>`)}(e);var e},[l,r,E,s,c,_]);(0,e.useEffect)(()=>{null!==H&&(H===$.current&&k(!1),$.current=H)},[S,H]);const O="catalog"===r?(0,t.__)("Shop & category pages","tier-pricing-table"):"cart"===r?(0,t.__)("Cart & Checkout","tier-pricing-table"):(0,t.__)("Product page","tier-pricing-table");return(0,a.jsxs)("div",{className:"tpt-lc-preview","aria-busy":f?"true":"false",children:[(0,a.jsxs)("div",{className:"tpt-lc-preview__browser",children:[(0,a.jsxs)("div",{className:"tpt-lc-preview__bar","aria-hidden":"true",children:[(0,a.jsx)("i",{}),(0,a.jsx)("i",{}),(0,a.jsx)("i",{}),(0,a.jsx)("span",{className:"tpt-lc-preview__bar-label",children:O})]}),null!==H&&(0,a.jsx)("iframe",{ref:C,className:"tpt-lc-preview__frame",title:(0,t.__)("Layout preview","tier-pricing-table"),srcDoc:H,scrolling:"no",onLoad:()=>{const e=C.current;try{const t=e.contentDocument&&e.contentDocument.body;t&&(N.current=Math.max(240,Math.ceil(t.getBoundingClientRect().height)+2),e.style.height=`${N.current}px`)}catch(e){}k(!1)},style:N.current?{height:`${N.current}px`}:void 0}),null===H&&(0,a.jsx)("div",{className:"tpt-lc-preview__placeholder"}),f&&(0,a.jsx)("div",{className:"tpt-lc-preview__loading",children:(0,a.jsx)(i.Spinner,{})})]}),w&&(0,a.jsx)("p",{className:"tpt-lc-preview__note",children:(0,t.__)("The preview could not be rendered.","tier-pricing-table")}),!w&&"product"===r&&(0,a.jsx)("p",{className:"tpt-lc-preview__note",children:(0,t.__)("The real product page may look a bit different, depending on your theme.","tier-pricing-table")})]})}function k({visible:i,premium:l}){const r=(0,e.useRef)(null);(0,e.useEffect)(()=>{const e=document.querySelector("[data-tpt-lc-custom-columns]");e&&r.current&&(r.current.appendChild(e),e.hidden=!1)},[]);const n=l?null:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("strong",{children:(0,t.__)("Available in the premium version.","tier-pricing-table")})," ",(0,t.__)("You can try it here; the store shows the columns with premium only.","tier-pricing-table")]});return(0,a.jsxs)(p,{id:"product-columns",title:(0,t.__)("Custom table columns","tier-pricing-table"),note:n,hidden:!i,keepMounted:!0,children:[(0,a.jsx)("p",{className:"tpt-lc-columns__hint",children:(0,t.__)("Extra columns for every tier: total price, saving per item, price including tax or your own values. Columns are saved with their own button and show up in the preview once saved.","tier-pricing-table")}),(0,a.jsx)("div",{ref:r,className:"tpt-lc-columns__body"})]})}const w=["display","display_type","pricing_table_style","pricing_blocks_style","pricing_options_style","pricing_dropdown_style","pricing_plain_text_style","table_title","position_hook","quantity_type","tiers_order","compact_layout","layout_spacing","cell_padding","discount_badge_color","table_active_border","selected_quantity_color","show_discount_column","discount_format","table_quantity_measurement","blocks_quantity_measurement","options_option_text","options_show_default_option","options_default_option_text","options_show_original_product_price","options_show_total","tooltip_color","tooltip_size","tooltip_border","head_quantity_text","head_discount_text","head_price_text","plain_text_template","plain_text_show_first_tier","plain_text_first_tier_template","clickable_table_rows","product_page_price_format","update_price_on_product_page","show_tiered_price_as_discount","show_total_price","show_total_price_non_tiered"],j=["display_summary","display_summary_non_tiered","summary_title","summary_position_hook","summary_type","summary_total_label","summary_each_label"],C=["tiered_price_at_catalog","tiered_price_at_catalog_for_variable","tiered_price_at_catalog_type","tiered_price_at_catalog_custom_template","lowest_prefix"],N=["show_discount_in_cart","show_subtotal_as_discount_in_cart","consider_sale_price_as_discount_in_cart","cart_total_savings","cart_total_savings_label"],$=["cart_upsell_enabled","cart_upsell_template","cart_upsell_color","cart_upsell_link","cart_upsell_progress"],S=["you_save_enabled","you_save_consider_sale_price","you_save_non_tiered","you_save_template","you_save_text_color"];function T(e,t){if(t&&"object"==typeof t)return void Object.entries(t).forEach(([t,i])=>T(`${e}.${t}`,i));const i=document.querySelector(`[data-tpt-lc-option="${e}"]`);i&&i.value!==t&&(i.value=t,i.dispatchEvent(new Event("change",{bubbles:!0})))}function M({config:l}){const r=l.catalog||null,n=(0,e.useMemo)(()=>[...w,...l.youSave?S:[],...l.summary?j:[],...l.catalogPrice?C:[],...l.cart&&l.cart.prices?N:[],...l.cart&&l.cart.upsells?$:[],...r?[...Object.values(r.keys),...Object.values(r.unitKeys)]:[]],[l.youSave,l.summary,l.catalogPrice,l.cart,r]),[o,s]=(0,e.useState)(()=>{const e={};return n.forEach(t=>{const i=l.values[t];e[t]=i&&"object"==typeof i?{...i}:i??""}),e}),c=(0,e.useRef)(null);(0,e.useEffect)(()=>{const e=()=>{const e=document.getElementById("wpadminbar"),t=document.querySelector(".woocommerce-layout__header"),i=(e?e.getBoundingClientRect().height:0)+(t?t.getBoundingClientRect().height:0)+16;c.current&&c.current.style.setProperty("--tpt-lc-sticky-top",`${Math.round(i)}px`)};e(),window.addEventListener("resize",e);const t=setTimeout(e,1e3);return()=>{window.removeEventListener("resize",e),clearTimeout(t)}},[]);const[p,_]=(0,e.useState)("product"),g="catalog"===p&&!!r,u="cart"===p&&!!l.cart,h=[{name:"product",title:(0,t.__)("Product page","tier-pricing-table")}];r&&h.push({name:"catalog",title:(0,t.__)("Shop & category pages","tier-pricing-table")}),l.cart&&h.push({name:"cart",title:(0,t.__)("Cart & Checkout","tier-pricing-table")});const m=(0,e.useCallback)((e,t)=>{s(i=>("object"==typeof t&&null!==t?JSON.stringify(i[e])===JSON.stringify(t):i[e]===t)?i:{...i,[e]:t})},[]),b=(0,e.useRef)(!0);(0,e.useEffect)(()=>{b.current?b.current=!1:n.forEach(e=>T(e,o[e]))},[o,n]);const x=(0,e.useMemo)(()=>{if(!g)return o;const e={};return Object.entries(r.keys).forEach(([t,i])=>{e[t]=o[i]}),Object.entries(r.unitKeys).forEach(([t,i])=>{e[t]=o[i]}),C.forEach(t=>{e[t]=o[t]}),e},[g,r,o]),y=(0,e.useCallback)((e,t)=>{m(g&&(r.keys[e]||r.unitKeys[e])||e,t)},[g,r,m]),v=(0,e.useMemo)(()=>g?{...l,layouts:r.layouts,positions:r.positions,premiumOptions:r.premiumOptions}:l,[g,r,l]),M=g&&"custom"!==x.layout_settings,q=M?o.display_type:x.display_type,B=M?null:function(e){switch(e){case"table":return"pricing_table_style";case"blocks":return"pricing_blocks_style";case"options":return"pricing_options_style";case"dropdown":return"pricing_dropdown_style";case"plain-text":return"pricing_plain_text_style";default:return null}}(x.display_type),P=!u&&(l.columnsFor||[]).includes(q),E=g?"catalog":u?"cart":"product";return(0,a.jsxs)("div",{className:"tpt-lc",ref:c,children:[(0,a.jsxs)("div",{className:"tpt-lc__header",children:[(0,a.jsx)("h2",{className:"tpt-lc__title",children:l.title||(0,t.__)("Pricing Display","tier-pricing-table")}),h.length>1&&(0,a.jsx)(i.TabPanel,{className:"tpt-lc__tabs",initialTabName:p,onSelect:_,tabs:h,children:()=>null})]}),(0,a.jsxs)("div",{className:"tpt-lc__columns",children:[(0,a.jsxs)("div",{className:"tpt-lc__controls",children:[(0,a.jsx)(d,{config:v,context:E,values:x,styleKey:B,onChange:y}),l.customColumns&&(0,a.jsx)(k,{visible:P,premium:l.premium})]}),(0,a.jsx)("div",{className:"tpt-lc__preview",children:(0,a.jsx)(f,{config:l,context:E,values:o,view:x,effectiveLayout:q})})]})]})}const q=document.querySelector("[data-tpt-lc-root]"),B=window.tptLayoutConfigurator;q&&B&&(0,e.createRoot)(q).render((0,a.jsx)(M,{config:B}))}};const t={};function i(a){const l=t[a];if(void 0!==l)return l.exports;const r=t[a]={exports:{}};return e[a](r,r.exports,i),r.exports}i.m=e,(()=>{const e=[];i.O=(t,a,l)=>{if(!a){for(var r=0;r<e.length;r++){let[a,l]=e[r],o=!0;for(var n=0;n<a.length;n++)i.O.j(a[n])?a.splice(n--,1):o=!1;if(o){e.splice(r--,1);const i=l();void 0!==i&&(t=i)}}return t}e.push([a,l])}})(),i.o=(e,t)=>Object.hasOwn(e,t),(()=>{const e={57:0,350:0};i.O.j=t=>0===e[t];const t=(t,a)=>{let[l,r,n]=a;var o,s,c=0;if(l.some(t=>0!==e[t])){for(o in r)i.o(r,o)&&(i.m[o]=r[o]);if(n)var p=n(i)}for(t&&t(a);c<l.length;c++)s=l[c],i.o(e,s)&&e[s]&&e[s][0](),e[s]=0;return i.O(p)},a=globalThis.webpackChunktiered_pricing_layout_configurator||=[];a.forEach(t.bind(null,0)),a.push=t.bind(null,a.push.bind(a))})();let a=i.O(void 0,[350],()=>i(674));a=i.O(a)})();
69 +`,b=(e,t)=>`<p class="tpt-skel__note${t?" tpt-skel__note--top":""}">${u(e)}</p>`;function y(e,t){const i=e.stylesheets.map(e=>`<link rel="stylesheet" href="${u(e)}">`).join("");return`<!doctype html><html><head><meta charset="utf-8"><style>\nhtml, body { margin: 0; background: #fff; }\nbody { font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; color: #1d2327; }\n</style>${e.inlineStyles?`<style>${e.inlineStyles}</style>`:""}${i}<style>\nbody { padding: 20px 24px 24px; }\n.tpt-skel { max-width: 1100px; margin: 0 auto; }\n.tpt-skel__columns { display: flex; gap: 28px; align-items: flex-start; }\n.tpt-skel__gallery { flex: 0 0 26%; max-width: 240px; aspect-ratio: 4 / 5; border-radius: 8px; background: linear-gradient(135deg, #f0f0f1, #e0e0e2); position: relative; }\n.tpt-skel__gallery::after, .tpt-skel__card-image::after { content: ""; position: absolute; inset: 34% 30%; border-radius: 6px; background: rgba(255,255,255,.55); }\n.tpt-skel__gallery--image { aspect-ratio: auto; background: none; }\n.tpt-skel__gallery--image::after { content: none; }\n.tpt-skel__gallery--image img { display: block; width: 100%; height: auto; border-radius: 8px; }\n.tpt-skel__card-image--image { aspect-ratio: auto; background: none; }\n.tpt-skel__badge { position: absolute; top: 10px; left: 10px; z-index: 5; padding: 4px 10px; border-radius: 4px; color: #fff; font-size: 12px; font-weight: 700; line-height: 1.3; letter-spacing: .3px; text-transform: uppercase; white-space: nowrap; }\n.tpt-skel__badge--top-right { left: auto; right: 10px; }\n/* the "+N more" link is inert in the preview */\n.tpt-skel .tiered-pricing-more-tiers { display: inline-block; margin-top: 6px; font-size: 12px; text-decoration: underline; pointer-events: none; cursor: default; }\n.tpt-skel__card-image--image::after { content: none; }\n.tpt-skel__card-image--image img { display: block; width: 100%; height: auto; border-radius: 8px; }\n.tpt-skel__thumb--image { background: none; }\n.tpt-skel__thumb--image img { display: block; width: 56px; height: 56px; border-radius: 6px; object-fit: cover; }\n.tpt-skel__summary { flex: 1 1 auto; min-width: 0; }\n@media (max-width: 640px) { body { padding: 16px; } .tpt-skel__columns { flex-direction: column; align-items: stretch; gap: 18px; } .tpt-skel__gallery { flex: 0 0 auto; width: 100%; max-width: none; aspect-ratio: 4 / 3; } .tpt-skel__summary { float: none; width: 100% !important; } .tpt-skel__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; } }\n.tpt-skel__title { margin: 0 0 10px; font-size: 24px; font-weight: 600; line-height: 1.25; }\n.tpt-skel__price { margin: 0 0 22px; font-size: 20px; font-weight: 600; }\n.tpt-skel__price del { margin-right: 6px; color: #757575; font-weight: 400; }\n.tpt-skel__price ins { text-decoration: none; }\n.tpt-skel__price small { display: inline-block; margin-top: 6px; font-size: 13px; font-weight: 500; }\n.tpt-skel__bar { height: 10px; border-radius: 5px; background: #e6e6e8; margin: 0 0 8px; }\n.tpt-skel__bar--short { width: 62%; }\n.tpt-skel__desc { margin: 0 0 18px; }\n.tpt-skel__cart { display: flex; align-items: center; gap: 10px; margin: 14px 0; }\n.tpt-skel__qty { width: 64px; height: 38px; box-sizing: border-box; border: 1px solid #c3c4c7; border-radius: 4px; padding: 0 6px 0 10px; font: inherit; background: #fff; }\n.tpt-skel__button { height: 38px; padding: 0 18px; border: 0; border-radius: 4px; background: #1d2327; color: #fff; font: inherit; font-weight: 600; }\n.tpt-skel__tabs { display: flex; gap: 18px; margin: 28px 0 14px; padding-bottom: 8px; border-bottom: 1px solid #e6e6e8; }\n.tpt-skel__tab { width: 84px; height: 10px; border-radius: 5px; background: #e6e6e8; }\n.tpt-skel__slot { margin: 12px 0; }\n.tpt-skel__slot:empty { display: none; }\n.tpt-skel__slot--before-summary, .tpt-skel__slot--after-summary { margin: 0 0 18px; }\n.tpt-skel__slot--after-summary { margin: 18px 0 0; }\n.tpt-skel__note { margin: 0; padding: 12px 14px; border: 1px dashed #c3c4c7; border-radius: 6px; color: #646970; font-size: 13px; }\n.tpt-skel__note--top { margin: 0 0 18px; }\n.tpt-skel__tooltip-icon { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; margin-left: 6px; border-radius: 50%; background: #1d2327; color: #fff; font-size: 12px; font-weight: 700; vertical-align: middle; }\n/* product grid */\n.tpt-skel__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; }\n.tpt-skel__card { min-width: 0; }\n.tpt-skel__card-image { position: relative; aspect-ratio: 1 / 1; margin: 0 0 12px; border-radius: 8px; background: linear-gradient(135deg, #f0f0f1, #e0e0e2); }\n.tpt-skel__card-title { margin: 0 0 6px; font-size: 16px; font-weight: 600; line-height: 1.3; }\n.tpt-skel__card-price { margin: 0 0 10px; font-size: 15px; font-weight: 600; }\n.tpt-skel__card .tpt-skel__cart { margin: 10px 0; gap: 8px; }\n.tpt-skel__card .tpt-skel__qty { width: 50px; height: 34px; }\n.tpt-skel__card .tpt-skel__button { height: 34px; padding: 0 14px; font-size: 13px; }\n.tpt-skel__card .tpt-skel__slot { margin: 8px 0; }\n.tpt-skel__slot .tier-pricing-summary-table { margin-top: 12px; }\n/* cart page (the table display model is pinned: themes restyle tables on cart pages) */\n.tpt-skel--cart .tpt-skel__title { margin-bottom: 18px; }\n.tpt-skel__cart-table { display: table !important; width: 100% !important; border-collapse: collapse; margin: 0 0 24px; }\n.tpt-skel__cart-table thead { display: table-header-group !important; }\n.tpt-skel__cart-table tbody { display: table-row-group !important; }\n.tpt-skel__cart-table tr { display: table-row !important; }\n.tpt-skel__cart-table th, .tpt-skel__cart-table td { display: table-cell !important; width: auto; }\n.tpt-skel__cart-table th, .tpt-skel__cart-table td { padding: 12px 10px; border-bottom: 1px solid #e6e6e8; text-align: left; vertical-align: middle; }\n.tpt-skel__cart-table th { font-size: 13px; font-weight: 600; color: #646970; }\n.tpt-skel__cart-table td:first-child { width: 72px; }\n.tpt-skel__thumb { width: 56px; height: 56px; border-radius: 6px; background: linear-gradient(135deg, #f0f0f1, #e0e0e2); }\n.tpt-skel__cart-name { font-weight: 600; }\n.tpt-skel__upsell { margin-top: 6px; font-size: 16px; }\n.tpt-skel__upsell-link { color: inherit; font-weight: 600; text-decoration: underline; }\n.tpt-skel__upsell-progress { height: 6px; max-width: 220px; margin-top: 6px; border-radius: 3px; background: rgba(0, 0, 0, .08); }\n.tpt-skel__upsell-progress i { display: block; height: 100%; border-radius: 3px; background: currentColor; }\n.tpt-skel__cart-price { white-space: nowrap; font-weight: 600; }\n.tpt-skel__cart-price del { margin-right: 6px; color: #757575; font-weight: 400; }\n.tpt-skel__cart-price ins { text-decoration: none; }\n.tpt-skel__cart-totals { max-width: 360px; margin-left: auto; padding: 16px 18px; border: 1px solid #e6e6e8; border-radius: 8px; }\n.tpt-skel__cart-totals-title { margin: 0 0 10px; font-size: 16px; font-weight: 600; }\n.tpt-skel__cart-totals-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #f0f0f1; }\n.tpt-skel__cart-totals-row .tpt-skel__bar { margin: 0; }\n.tpt-skel__cart-totals-row--total { font-weight: 600; border-bottom: 0; }\n.tpt-skel__button--wide { width: 100%; margin-top: 12px; }\n/* compact spacing on top of the theme and WooCommerce (preview only): tight margins around the pricing\n fragment and padded table cells, whatever the theme's table and form spacing */\n.tpt-skel form.cart { margin: 0 !important; }\n.tpt-skel .summary { margin-bottom: 0 !important; }\n.tpt-skel .tiered-pricing-wrapper { margin: 0 !important; }\n.tpt-skel .tiered-pricing-wrapper > h3 { margin: 0 0 10px !important; }\n.tpt-skel .tpt__tiered-pricing table.tiered-pricing-table { margin: 0 !important; }\n.tpt-skel .tpt__tiered-pricing table.tiered-pricing-table th,\n.tpt-skel .tpt__tiered-pricing table.tiered-pricing-table td { padding: var(--tiered-pricing-cell-padding, 9px 12px) !important; }\n.tpt-skel .tpt__tiered-pricing table.tiered-pricing-table--slim th,\n.tpt-skel .tpt__tiered-pricing table.tiered-pricing-table--slim td { padding: var(--tiered-pricing-cell-padding, 5px 8px) !important; }\n.tpt-skel .tier-pricing-summary-table { margin: 12px 0 0 !important; }\n/* the sample page is always on white, whatever the theme paints behind its pages */\nhtml, body { background: #fff !important; }\n</style></head>\n<body class="${"woocommerce woocommerce-page"+(e.blockTheme?" woocommerce-uses-block-theme":"")}">${t}<script>(function(){var c=(getComputedStyle(document.body).color.match(/\\d+(\\.\\d+)?/g)||[]).map(Number);if(c.length>=3&&(0.2126*c[0]+0.7152*c[1]+0.0722*c[2])/255>0.55){document.body.style.color='#1d2327';}})();<\/script></body></html>`}function x(e,t,i){return e.catalogPrice&&"yes"===t.tiered_price_at_catalog&&i&&i.catalogPrice?i.catalogPrice:u(e.currency.price)}function f(e){return"cart"===e.context?function({config:e,values:i}){const a=e.samples||{},r=a.upsell||{},o=e.cart||{},l=o.prices&&"yes"===i.show_discount_in_cart,n=o.prices&&"yes"===i.show_subtotal_as_discount_in_cart,s=l?`<del>${u(a.price)}</del> <ins>${u(a.tierPrice)}</ins>`:u(a.tierPrice),c=n?`<del>${u(a.total)}</del> <ins>${u(a.tierTotal)}</ins>`:u(a.tierTotal);let p="";if(o.upsells&&"yes"===i.cart_upsell_enabled){const e=u(r.requiredQuantity??""),t=(i.cart_upsell_template||"").replace(/\{tp_required_quantity\}/g,"no"!==i.cart_upsell_link?`<a class="tpt-skel__upsell-link" href="#" onclick="return false">${e}</a>`:e).replace(/\{tp_next_price\}/g,u(r.nextPrice||"")).replace(/\{tp_next_discount\}/g,u(r.nextDiscount||"")).replace(/\{tp_actual_discount\}/g,u(r.actualDiscount||"")),a="yes"===i.cart_upsell_progress?`<div class="tpt-skel__upsell-progress"><i style="width:${Math.max(2,Math.min(100,parseInt(r.progress,10)||0))}%"></i></div>`:"";p=`<div class="tpt-skel__upsell" style="color:${u(i.cart_upsell_color||"#059669")}"><small>${t}</small>${a}</div>`}const _=o.prices&&"yes"===i.cart_total_savings?`<div class="tpt-skel__cart-totals-row"><span>${u(i.cart_total_savings_label||(0,t.__)("Total savings","tier-pricing-table"))}</span><span>${u(a.savingTotal)}</span></div>`:"";return y(e,`\n<div class="tpt-skel tpt-skel--cart">\n\t<h1 class="tpt-skel__title">${u((0,t.__)("Cart","tier-pricing-table"))}</h1>\n\t<table class="tpt-skel__cart-table">\n\t\t<thead>\n\t\t\t<tr>\n\t\t\t\t<th></th>\n\t\t\t\t<th>${u((0,t.__)("Product","tier-pricing-table"))}</th>\n\t\t\t\t<th>${u((0,t.__)("Price","tier-pricing-table"))}</th>\n\t\t\t\t<th>${u((0,t.__)("Quantity","tier-pricing-table"))}</th>\n\t\t\t\t<th>${u((0,t.__)("Subtotal","tier-pricing-table"))}</th>\n\t\t\t</tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td><div class="tpt-skel__thumb${e.placeholder?" tpt-skel__thumb--image":""}">${e.placeholder?`<img src="${u(e.placeholder)}" alt="">`:""}</div></td>\n\t\t\t\t<td><div class="tpt-skel__cart-name">${u(a.productName||(0,t.__)("Product name","tier-pricing-table"))}</div>${p}</td>\n\t\t\t\t<td class="tpt-skel__cart-price">${s}</td>\n\t\t\t\t<td><input class="tpt-skel__qty" type="text" value="${u(a.quantity||1)}" readonly></td>\n\t\t\t\t<td class="tpt-skel__cart-price">${c}</td>\n\t\t\t</tr>\n\t\t</tbody>\n\t</table>\n\t<div class="tpt-skel__cart-totals">\n\t\t<div class="tpt-skel__cart-totals-title">${u((0,t.__)("Cart totals","tier-pricing-table"))}</div>\n\t\t<div class="tpt-skel__cart-totals-row"><span>${u((0,t.__)("Subtotal","tier-pricing-table"))}</span><span>${u(a.tierTotal)}</span></div>\n\t\t<div class="tpt-skel__cart-totals-row"><span>${u((0,t.__)("Shipping","tier-pricing-table"))}</span>${'<div class="tpt-skel__bar" style="width:90px"></div>'}</div>\n\t\t${_}\n\t\t<div class="tpt-skel__cart-totals-row tpt-skel__cart-totals-row--total"><span>${u((0,t.__)("Total","tier-pricing-table"))}</span><span>${u(a.tierTotal)}</span></div>\n\t\t<button class="tpt-skel__button tpt-skel__button--wide" type="button">${u((0,t.__)("Proceed to checkout","tier-pricing-table"))}</button>\n\t</div>\n</div>`)}(e):"catalog"===e.context?function({config:e,values:i,fragment:a,extras:r}){const o=h[i.position_hook]||"above-button",l=x(e,i,r),n="yes"===i.display,s="yes"===i.use_reduced_styles,c="yes"===i.show_quantity_field,p=e.samples||{};let _="";if("yes"===i.badge_enabled){const e=(i.badge_template||"").replace(/\{tp_max_discount\}/g,u(p.maxDiscount||"")).replace(/\{tp_lowest_price\}/g,u(p.lowest||"")).replace(/\{tp_lowest_quantity\}/g,u(p.lowestQuantity??"")).replace(/\{tp_max_saving\}/g,u(p.maxSaving||""));_=`<span class="tpt-skel__badge tpt-skel__badge--${"top-right"===i.badge_position?"top-right":"top-left"}" style="background:${u(i.badge_color||i.selected_quantity_color||"#3858e9")}">${e}</span>`}let d="",g="";n?(e=>/^\s*<p class="tpt-preview-note"/.test(e))(a)?d=a.replace('class="tpt-preview-note"','class="tpt-skel__note tpt-skel__note--top"'):g=`<div class="tiered-pricing-shop-loop${s?" tiered-pricing-shop-loop--reduced":""}">${a}</div>`:d=b((0,t.__)("Tiered pricing is switched off for shop and category pages.","tier-pricing-table"),!0);const m=e=>`<div class="tpt-skel__slot tpt-skel__slot--${e}">${o===e?g:""}</div>`,f=()=>`\n\t\t<div class="tpt-skel__card product">\n\t\t\t<div class="tpt-skel__card-image${e.placeholder?" tpt-skel__card-image--image":""}">${e.placeholder?`<img src="${u(e.placeholder)}" alt="">`:""}${_}</div>\n\t\t\t${m("above-title")}\n\t\t\t<h2 class="tpt-skel__card-title">${u((0,t.__)("Product name","tier-pricing-table"))}</h2>\n\t\t\t${m("below-title")}\n\t\t\t<p class="tpt-skel__card-price price">${l}</p>\n\t\t\t${m("above-button")}\n\t\t\t<div class="tpt-skel__cart">\n\t\t\t\t${c?'<input class="tpt-skel__qty" type="text" value="1" readonly>':""}\n\t\t\t\t<button class="tpt-skel__button" type="button">${u((0,t.__)("Add to cart","tier-pricing-table"))}</button>\n\t\t\t</div>\n\t\t\t${m("below-button")}\n\t\t</div>`;return y(e,`\n<div class="tpt-skel tpt-skel--grid woocommerce archive">\n\t${d}\n\t<div class="tpt-skel__grid products">\n\t\t${f()}${f()}${f()}\n\t</div>\n</div>`)}(e):function({config:e,values:i,effectiveLayout:a,fragment:r,extras:o}){const l=g[i.position_hook]||"before-button",n=g[i.summary_position_hook]||"after-button",s=e.summary&&"yes"===i.display_summary&&o&&o.summary||"",c="tooltip"===a,p="yes"===i.display,_=Math.min(64,Math.max(8,parseInt(i.tooltip_size,10)||15));let d=r;p?c&&(d=b((0,t.__)("The tooltip layout adds an icon next to the price; the pricing table appears when the customer hovers over it.","tier-pricing-table"))):d=b((0,t.__)("Not shown automatically: the pricing layout appears where you place the shortcode, block or widget.","tier-pricing-table"));const h=e=>`<div class="tpt-skel__slot tpt-skel__slot--${e}">${l===e?d+H("after_table"):""}${n===e?s:""}</div>`,f=e=>`<div class="tpt-skel__bar${e?" tpt-skel__bar--short":""}"></div>`,v=c&&p?`<span class="tpt-skel__tooltip-icon" style="background:${u(i.tooltip_color||"#3858e9")};width:${_}px;height:${_}px;font-size:${Math.round(.66*_)}px">i</span>`:"",w=e.samples||{},k="same_as_catalog"!==i.product_page_price_format,j=k&&"yes"===i.update_price_on_product_page,C=i.you_save_style||"text",N=i.you_save_position||"price",S=e.youSave&&"yes"===i.you_save_enabled,$=k&&"yes"===i.show_total_price,T=j&&"yes"===i.show_tiered_price_as_discount,M=w.quantity||1;let q=u(e.currency.price);if(k){if(j){const e=u($?w.total:w.price),t=u($?w.tierTotal:w.tierPrice);q=T?`<del>${e}</del> <ins>${t}</ins>`:t}}else q=x(e,i,o);const B={tiers:w.tiers||[],regular:w.regular||0,quantity:M,currency:e.currency,customPrice:k,updatesPrice:j,total:$,crossed:T,badge:S?{template:i.you_save_template||"",color:i.you_save_text_color||i.selected_quantity_color||"#3858e9",style:C,position:N}:null,clickable:"yes"===i.clickable_table_rows,productName:w.productName||(0,t.__)("Product name","tier-pricing-table")},E=JSON.stringify(B).replace(/</g,"\\u003c");let O="";if(S){const e=(i.you_save_template||"").replace(/\{tp_ys_price\}/g,u(w.saving||"")).replace(/\{tp_ys_total_price\}/g,u(w.savingTotal||"")).replace(/\{tp_ys_percentage_discount\}/g,u(w.discount||""));O=function(e,t,i,a){const r=u(i||"#3858e9");return`${"price"===t?"<br>":""}<small class="tiered-pricing-you-save tiered-pricing-you-save--${e}" style="${"pill"===e?`background-color:${r};color:#fff`:"outline"===e?`color:${r};border-color:${r}`:`color:${r}`}">${a}</small>`}(C,N,i.you_save_text_color||i.selected_quantity_color,e)}const P="price"===N?`<span data-preview-badge>${O}</span>`:"",H=e=>N===e?`<div class="tiered-pricing-you-save-wrapper tiered-pricing-you-save-wrapper--${e}" data-preview-badge>${O}</div>`:"";return y(e,`\n<div class="tpt-skel woocommerce single-product">\n\t<div class="product">\n\t\t${h("before-summary")}\n\t\t<div class="tpt-skel__columns">\n\t\t\t<div class="tpt-skel__gallery${e.placeholder?" tpt-skel__gallery--image":""}">${e.placeholder?`<img src="${u(e.placeholder)}" alt="">`:""}</div>\n\t\t\t<div class="tpt-skel__summary summary entry-summary">\n\t\t\t\t${h("above-title")}\n\t\t\t\t<h1 class="tpt-skel__title product_title entry-title">${u((0,t.__)("Product name","tier-pricing-table"))}</h1>\n\t\t\t\t<p class="tpt-skel__price price"><span data-preview-price>${q}</span>${v}${P}</p>\n\t\t\t\t<div class="tpt-skel__desc">${f()}${f(!0)}</div>\n\t\t\t\t${h("before-form")}\n\t\t\t\t<form class="cart" action="#" onsubmit="return false;">\n\t\t\t\t\t${h("before-button")}\n\t\t\t\t\t${H("before_add_to_cart")}\n\t\t\t\t\t<div class="tpt-skel__cart">\n\t\t\t\t\t\t<input class="tpt-skel__qty" type="number" min="1" step="1" value="${M}" data-preview-qty aria-label="${u((0,t.__)("Quantity","tier-pricing-table"))}">\n\t\t\t\t\t\t<button class="tpt-skel__button" type="button">${u((0,t.__)("Add to cart","tier-pricing-table"))}</button>\n\t\t\t\t\t</div>\n\t\t\t\t\t${h("after-button")}\n\t\t\t\t</form>\n\t\t\t\t${h("after-form")}\n\t\t\t</div>\n\t\t</div>\n\t\t${h("after-summary")}\n\t\t<div class="tpt-skel__tabs"><div class="tpt-skel__tab"></div><div class="tpt-skel__tab"></div><div class="tpt-skel__tab"></div></div>\n\t\t${f()}${f()}${f(!0)}\n\t</div>\n</div>\n<script>window.TPT_PREVIEW = ${E};<\/script>\n<script>${m}<\/script>`)}(e)}const v={selected_quantity_color:"always",discount_badge_color:"both",head_quantity_text:"both",head_discount_text:"both",head_price_text:"both",table_title:"both",layout_spacing:"both",cell_padding:"both"},w=["selected_quantity_color","discount_badge_color"],k=["head_quantity_text","head_discount_text","head_price_text","table_title"],j={layout_spacing:"--tiered-pricing-gap",cell_padding:"--tiered-pricing-cell-padding"},C=e=>null!=e&&""!==String(e).trim(),N=(e,t)=>e===t||e&&t&&"object"==typeof e&&"object"==typeof t&&JSON.stringify(e)===JSON.stringify(t);function S(e){let t=String(e||"").trim().replace(/^#/,"");return 3===t.length&&(t=t.split("").map(e=>e+e).join("")),/^[0-9a-f]{6}$/i.test(t)?[0,2,4].map(e=>parseInt(t.slice(e,e+2),16)).join(","):null}const $=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),T=e=>Math.max(0,Math.min(80,parseInt(e,10)||0))+"px";function M(e,t,i){let a=function(e,t,i){const a=[];return w.forEach(e=>{const r=String(t[e]||"").trim(),o=String(i[e]||"").trim();if(!r||!o||r.toLowerCase()===o.toLowerCase())return;a.push({pattern:new RegExp($(r),"gi"),keep:()=>"",to:o});const l=S(r),n=S(o);l&&n&&a.push({pattern:new RegExp(`(rgba?\\()${$(l)}(?=[,)])`,"g"),keep:(e,t)=>t,to:n})}),a.forEach((e,t)=>{e.token=`${t}`}),a.forEach(t=>{e=e.replace(t.pattern,(...e)=>t.keep(...e)+t.token)}),a.forEach(t=>{e=e.split(t.token).join(t.to)}),e}(e,t,i);Object.entries(j).forEach(([e,r])=>{t[e]!==i[e]&&C(t[e])&&C(i[e])&&(a=a.replace(new RegExp(`${$(r)}:\\s*${$(T(t[e]))}`,"g"),`${r}: ${T(i[e])}`))});const r=k.filter(e=>t[e]!==i[e]&&C(t[e])&&C(i[e]));if(r.length&&"undefined"!=typeof DOMParser){const e=(new DOMParser).parseFromString(`<body>${a}</body>`,"text/html"),o=e.createTreeWalker(e.body,NodeFilter.SHOW_TEXT),l=[];for(;o.nextNode();)l.push(o.currentNode);r.forEach(e=>{const a=String(t[e]).trim(),r=String(i[e]).trim();l.forEach(e=>{const t=e.parentNode&&e.parentNode.nodeName;t&&"STYLE"!==t&&"SCRIPT"!==t&&e.nodeValue.trim()===a&&(e.nodeValue=e.nodeValue.replace(a,r))})}),a=e.body.innerHTML}return a}const q=["selected_quantity_color","discount_badge_color"],B=new Map,E=new Map,O=(e,t,i)=>JSON.stringify([e,t,Object.fromEntries(Object.keys(i).filter(e=>!v[e]).sort().map(e=>[e,i[e]]))]);function P(e,t){for(B.delete(e),B.set(e,t),E.set(t.structuralKey,t);B.size>80;){const e=B.keys().next().value,t=B.get(e);B.delete(e),t&&E.get(t.structuralKey)===t&&E.delete(t.structuralKey)}}const H={table_style:"table",blocks_style:"blocks",options_style:"options"},R=["display","position_hook","tooltip_color","tooltip_size","show_tiered_price_as_discount","show_total_price","show_total_price_non_tiered","you_save_enabled","you_save_consider_sale_price","you_save_non_tiered","you_save_template","you_save_text_color","you_save_style","you_save_position","display_summary","display_summary_non_tiered","summary_position_hook","tiered_price_at_catalog","tiered_price_at_catalog_for_variable","show_discount_in_cart","show_subtotal_as_discount_in_cart","consider_sale_price_as_discount_in_cart","cart_upsell_enabled","cart_upsell_template","cart_upsell_color","cart_upsell_link","cart_upsell_progress","cart_total_savings","cart_total_savings_label","scope","contexts","categories","badge_enabled","badge_template","badge_position","badge_color"];function A({config:r,context:o,values:l,view:n,effectiveLayout:s}){const{values:c,view:p}=function(t,i){const[a,r]=(0,e.useState)({values:t,view:i}),o=JSON.stringify(t),l=JSON.stringify(i);return(0,e.useEffect)(()=>{if(!q.some(e=>(t[e]||"")!==(a.values[e]||"")))return r({values:t,view:i}),()=>{};const e=setTimeout(()=>r({values:t,view:i}),100);return()=>clearTimeout(e)},[o,l]),a}(l,n),[_,d]=(0,e.useState)(null),[u,g]=(0,e.useState)({}),[h,m]=(0,e.useState)(!0),[b,y]=(0,e.useState)(!1),x=(0,e.useRef)(null),k=(0,e.useRef)(0),S=(0,e.useRef)(null),$=(0,e.useRef)(!1),[T,A]=(0,e.useState)(0),[L,F]=(0,e.useState)(0);(0,e.useEffect)(()=>{const e=()=>F(e=>e+1);return window.document.addEventListener("tiered-pricing/custom-columns/saved",e),()=>window.document.removeEventListener("tiered-pricing/custom-columns/saved",e)},[]);const z=(0,e.useMemo)(()=>{const e=[...R],t=r.catalog;return t&&e.push(t.keys.display,t.keys.position_hook,t.keys.use_reduced_styles,t.keys.dynamic_price,t.keys.show_quantity_field),e},[r]),D=Object.keys(c).filter(e=>!z.includes(e)),I=((e,t)=>Object.fromEntries(t.sort().map(t=>[t,e[t]])))(c,D),K=JSON.stringify([o,L,I]),J=O(o,L,I);(0,e.useEffect)(()=>{const e=new AbortController;if(m(!0),"cart"===o)return d(""),y(!1),A(e=>e+1),()=>{};const t=e=>{g(e.extras),d(e.fragment),y(!1),A(e=>e+1)};if(!$.current&&"product"===o&&r.initial&&r.initial.fragments){$.current=!0;const e=r.initial,t=(t,i)=>({fragment:t,extras:e.extras||{},values:i,structuralKey:O(o,L,i)});Object.entries(H).forEach(([i,a])=>{if("string"==typeof e.fragments[i]&&a!==I.display_type){const r={...I,display_type:a};P(JSON.stringify([o,L,r]),t(e.fragments[i],r))}}),"string"==typeof e.fragments.display_type&&P(K,t(e.fragments.display_type,I))}const i=B.get(K);if(i)return t(i),()=>{};const a=E.get(J);if(a&&function(e,t){const i=new Set([...Object.keys(e),...Object.keys(t)]);for(const a of i){const i=e[a],r=t[a];if(N(i,r))continue;const o=v[a];if(!o)return!1;if(!("both"!==o||C(i)&&C(r)))return!1;if(a in j&&(!isFinite(Number(i))||!isFinite(Number(r))))return!1}const[a,r]=w,o=e=>String(e||"").trim().toLowerCase();return!(o(e[a])&&o(e[a])===o(e[r]))||o(e[a])!==o(t[a])==(o(e[r])!==o(t[r]))}(a.values,I)){const e={fragment:M(a.fragment,a.values,I),extras:a.extras,values:I,structuralKey:J};return P(K,e),t(e),()=>{}}const l=setTimeout(()=>{(function(e,t,i,a){const r=new URLSearchParams;return r.set("action",e.ajax.action),r.set("nonce",e.ajax.nonce),r.set("context","catalog"===i?"shop-loop":"product-page"),r.append("kinds[]","display_type"),"catalog"!==i&&Object.keys(H).forEach(e=>r.append("kinds[]",e)),Object.entries(t).forEach(([e,t])=>{t&&"object"==typeof t?Object.entries(t).forEach(([t,i])=>r.set(`values[${e}][${t}]`,i)):r.set(`values[${e}]`,t)}),fetch(e.ajax.url,{method:"POST",credentials:"same-origin",body:r,signal:a}).then(e=>e.json()).then(e=>{if(!e||!e.success||!e.data.fragments)throw new Error("preview failed");return{fragments:e.data.fragments,extras:e.data.extras||{}}})})(r,c,o,e.signal).then(e=>{const i={fragment:e.fragments.display_type||"",extras:e.extras,values:I,structuralKey:J};P(K,i),"catalog"!==o&&Object.entries(H).forEach(([t,i])=>{if("string"==typeof e.fragments[t]&&i!==I.display_type){const a={...I,display_type:i};P(JSON.stringify([o,L,a]),{fragment:e.fragments[t],extras:e.extras,values:a,structuralKey:O(o,L,a)})}}),t(i)}).catch(e=>{"AbortError"!==e.name&&(y(!0),m(!1))})},250);return()=>{clearTimeout(l),e.abort()}},[K]);const Q=JSON.stringify(p),U=(0,e.useMemo)(()=>null===_?null:f({config:r,context:o,values:p,effectiveLayout:s,fragment:_,extras:u}),[r,o,Q,s,_,u]);(0,e.useEffect)(()=>{null!==U&&(U===S.current&&m(!1),S.current=U)},[T,U]);const V="catalog"===o?(0,t.__)("Shop & category pages","tier-pricing-table"):"cart"===o?(0,t.__)("Cart & Checkout","tier-pricing-table"):(0,t.__)("Product page","tier-pricing-table");return(0,a.jsxs)("div",{className:"tpt-lc-preview","aria-busy":h?"true":"false",children:[(0,a.jsxs)("div",{className:"tpt-lc-preview__browser",children:[(0,a.jsxs)("div",{className:"tpt-lc-preview__bar","aria-hidden":"true",children:[(0,a.jsx)("i",{}),(0,a.jsx)("i",{}),(0,a.jsx)("i",{}),(0,a.jsx)("span",{className:"tpt-lc-preview__bar-label",children:V})]}),null!==U&&(0,a.jsx)("iframe",{ref:x,className:"tpt-lc-preview__frame",title:(0,t.__)("Layout preview","tier-pricing-table"),srcDoc:U,scrolling:"no",onLoad:()=>{const e=x.current;try{const t=e.contentDocument&&e.contentDocument.body;t&&(k.current=Math.max(240,Math.ceil(t.getBoundingClientRect().height)+2),e.style.height=`${k.current}px`)}catch(e){}m(!1)},style:k.current?{height:`${k.current}px`}:void 0}),null===U&&(0,a.jsx)("div",{className:"tpt-lc-preview__placeholder"}),h&&(0,a.jsx)("div",{className:"tpt-lc-preview__loading",children:(0,a.jsx)(i.Spinner,{})})]}),b&&(0,a.jsx)("p",{className:"tpt-lc-preview__note",children:(0,t.__)("The preview could not be rendered.","tier-pricing-table")}),!b&&"product"===o&&(0,a.jsx)("p",{className:"tpt-lc-preview__note",children:(0,t.__)("The real product page may look a bit different, depending on your theme.","tier-pricing-table")})]})}function L({visible:i,premium:r}){const o=(0,e.useRef)(null);(0,e.useEffect)(()=>{const e=document.querySelector("[data-tpt-lc-custom-columns]");e&&o.current&&(o.current.appendChild(e),e.hidden=!1)},[]);const l=r?null:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("strong",{children:(0,t.__)("Available in the premium version.","tier-pricing-table")})," ",(0,t.__)("You can try it here; the store shows the columns with premium only.","tier-pricing-table")]});return(0,a.jsxs)(p,{id:"product-columns",title:(0,t.__)("Custom table columns","tier-pricing-table"),note:l,hidden:!i,keepMounted:!0,children:[(0,a.jsx)("p",{className:"tpt-lc-columns__hint",children:(0,t.__)("Extra columns for every tier: total price, saving per item, price including tax or your own values. Columns are saved with their own button and show up in the preview once saved.","tier-pricing-table")}),(0,a.jsx)("div",{ref:o,className:"tpt-lc-columns__body"})]})}const F=["display","display_type","pricing_table_style","pricing_blocks_style","pricing_options_style","pricing_dropdown_style","pricing_plain_text_style","table_title","position_hook","quantity_type","tiers_order","compact_layout","layout_spacing","cell_padding","discount_badge_color","table_active_border","selected_quantity_color","show_discount_column","discount_format","table_quantity_measurement","blocks_quantity_measurement","options_option_text","options_show_default_option","options_default_option_text","options_show_original_product_price","options_show_total","tooltip_color","tooltip_size","tooltip_border","head_quantity_text","head_discount_text","head_price_text","plain_text_template","plain_text_show_first_tier","plain_text_first_tier_template","clickable_table_rows","product_page_price_format","update_price_on_product_page","show_tiered_price_as_discount","show_total_price","show_total_price_non_tiered"],z=["display_summary","display_summary_non_tiered","summary_title","summary_position_hook","summary_type","summary_total_label","summary_each_label"],D=["tiered_price_at_catalog","tiered_price_at_catalog_for_variable","tiered_price_at_catalog_type","tiered_price_at_catalog_custom_template","lowest_prefix"],I=["show_discount_in_cart","show_subtotal_as_discount_in_cart","consider_sale_price_as_discount_in_cart","cart_total_savings","cart_total_savings_label"],K=["cart_upsell_enabled","cart_upsell_template","cart_upsell_color","cart_upsell_link","cart_upsell_progress"],J=["you_save_enabled","you_save_consider_sale_price","you_save_non_tiered","you_save_template","you_save_text_color","you_save_style","you_save_position"];function Q(e,t){if(t&&"object"==typeof t)return void Object.entries(t).forEach(([t,i])=>Q(`${e}.${t}`,i));const i=document.querySelector(`[data-tpt-lc-option="${e}"]`);i&&i.value!==t&&(i.value=t,i.dispatchEvent(new Event("change",{bubbles:!0})))}function U({config:r}){const o=r.catalog||null,l=(0,e.useMemo)(()=>[...F,...r.youSave?J:[],...r.summary?z:[],...r.catalogPrice?D:[],...r.cart&&r.cart.prices?I:[],...r.cart&&r.cart.upsells?K:[],...o?[...Object.values(o.keys),...Object.values(o.unitKeys)]:[]],[r.youSave,r.summary,r.catalogPrice,r.cart,o]),[n,s]=(0,e.useState)(()=>{const e={};return l.forEach(t=>{const i=r.values[t];e[t]=i&&"object"==typeof i?{...i}:i??""}),e}),c=(0,e.useRef)(null);(0,e.useEffect)(()=>{const e=()=>{const e=document.getElementById("wpadminbar"),t=document.querySelector(".woocommerce-layout__header"),i=(e?e.getBoundingClientRect().height:0)+(t?t.getBoundingClientRect().height:0)+16;c.current&&c.current.style.setProperty("--tpt-lc-sticky-top",`${Math.round(i)}px`)};e(),window.addEventListener("resize",e);const t=setTimeout(e,1e3);return()=>{window.removeEventListener("resize",e),clearTimeout(t)}},[]);const[p,_]=(0,e.useState)("product"),u="catalog"===p&&!!o,g="cart"===p&&!!r.cart,h=[{name:"product",title:(0,t.__)("Product page","tier-pricing-table")}];o&&h.push({name:"catalog",title:(0,t.__)("Shop & category pages","tier-pricing-table")}),r.cart&&h.push({name:"cart",title:(0,t.__)("Cart & Checkout","tier-pricing-table")});const m=(0,e.useCallback)((e,t)=>{s(i=>("object"==typeof t&&null!==t?JSON.stringify(i[e])===JSON.stringify(t):i[e]===t)?i:{...i,[e]:t})},[]),b=(0,e.useRef)(!0);(0,e.useEffect)(()=>{b.current?b.current=!1:l.forEach(e=>Q(e,n[e]))},[n,l]);const y=(0,e.useMemo)(()=>{if(!u)return n;const e={};return Object.entries(o.keys).forEach(([t,i])=>{e[t]=n[i]}),Object.entries(o.unitKeys).forEach(([t,i])=>{e[t]=n[i]}),D.forEach(t=>{e[t]=n[t]}),e},[u,o,n]),x=(0,e.useCallback)((e,t)=>{m(u&&(o.keys[e]||o.unitKeys[e])||e,t)},[u,o,m]),f=(0,e.useMemo)(()=>u?{...r,layouts:o.layouts,positions:o.positions,premiumOptions:o.premiumOptions}:r,[u,o,r]),v=u&&"custom"!==y.layout_settings,w=v?n.display_type:y.display_type,k=v?null:function(e){switch(e){case"table":return"pricing_table_style";case"blocks":return"pricing_blocks_style";case"options":return"pricing_options_style";case"dropdown":return"pricing_dropdown_style";case"plain-text":return"pricing_plain_text_style";default:return null}}(y.display_type),j=!g&&(r.columnsFor||[]).includes(w),C=u?"catalog":g?"cart":"product";return(0,a.jsxs)("div",{className:"tpt-lc",ref:c,children:[(0,a.jsxs)("div",{className:"tpt-lc__header",children:[(0,a.jsx)("h2",{className:"tpt-lc__title",children:r.title||(0,t.__)("Pricing Display","tier-pricing-table")}),h.length>1&&(0,a.jsx)(i.TabPanel,{className:"tpt-lc__tabs",initialTabName:p,onSelect:_,tabs:h,children:()=>null})]}),(0,a.jsxs)("div",{className:"tpt-lc__columns",children:[(0,a.jsxs)("div",{className:"tpt-lc__controls",children:[(0,a.jsx)(d,{config:f,context:C,values:y,styleKey:k,onChange:x}),r.customColumns&&(0,a.jsx)(L,{visible:j,premium:r.premium})]}),(0,a.jsx)("div",{className:"tpt-lc__preview",children:(0,a.jsx)(A,{config:r,context:C,values:n,view:y,effectiveLayout:w})})]})]})}const V=document.querySelector("[data-tpt-lc-root]"),W=window.tptLayoutConfigurator;V&&W&&(0,e.createRoot)(V).render((0,a.jsx)(U,{config:W}))}};const t={};function i(a){const r=t[a];if(void 0!==r)return r.exports;const o=t[a]={exports:{}};return e[a](o,o.exports,i),o.exports}i.m=e,(()=>{const e=[];i.O=(t,a,r)=>{if(!a){for(var o=0;o<e.length;o++){let[a,r]=e[o],n=!0;for(var l=0;l<a.length;l++)i.O.j(a[l])?a.splice(l--,1):n=!1;if(n){e.splice(o--,1);const i=r();void 0!==i&&(t=i)}}return t}e.push([a,r])}})(),i.o=(e,t)=>Object.hasOwn(e,t),(()=>{const e={57:0,350:0};i.O.j=t=>0===e[t];const t=(t,a)=>{let[r,o,l]=a;var n,s,c=0;if(r.some(t=>0!==e[t])){for(n in o)i.o(o,n)&&(i.m[n]=o[n]);if(l)var p=l(i)}for(t&&t(a);c<r.length;c++)s=r[c],i.o(e,s)&&e[s]&&e[s][0](),e[s]=0;return i.O(p)},a=globalThis.webpackChunktiered_pricing_layout_configurator||=[];a.forEach(t.bind(null,0)),a.push=t.bind(null,a.push.bind(a))})();let a=i.O(void 0,[350],()=>i(656));a=i.O(a)})();