function ProductModel(e){this.ProductCode=e.ProductCode,this.ProductName=e.ProductName,this.ProductDiscount=e.ProductDiscount,this.ProductPrice=e.ProductPrice,this.ProductShip=e.ProductShip,this.Qty=e.Qty||1,this.images=e.images,this.videos=e.videos,this.Material=this.extractMaterialFromName(this.ProductName),this.Size=this.extractDimensionFromName(this.ProductName)}function ProductMultipleModel(e,t,r){this.name=e,this.list=[];for(const e of r){let r=transformedData.find((e=>e.name==t)).products.find((t=>t.ProductCode==e.ProductCode));r.Qty=e.Qty,this.list.push(new ProductModel(r))}this.calcCosts=()=>{let e=0,t=0;return this.list.forEach((function(r){if(r.ProductPrice){var a=r.ProductPrice,o=r.Qty,n=r.ProductDiscount,i=getFinalPrice(a,n)*o;e+=i,t+=a*o-i}})),t=Number(parseFloat(t).toFixed(2)),{totalCost:e,totalSaving:t}}}function transformInputToProductModels(){var e=[];return window.__input.forEach((function(t){var r={};r.name=t.name,r.products=t.data.map((function(e){return new ProductModel(e)})),e.push(r)})),e}ProductModel.prototype.extractMaterialFromName=function(e){for(var t=["PE","PVC"],r=0;r{if(e&&e.marquee_details_fragmentHTML){const t=document.getElementById("marquee_details_fragmentHTML");if(t){t.innerHTML=e.marquee_details_fragmentHTML;try{observeAnimations()}catch(e){}try{pjslider_init()}catch(e){}}else console.error('Element with ID "marquee_details_fragmentHTML" not found.');if(e.featuredVideo){const t=document.getElementById("featuredVideo");if(t&&"IFRAME"===t.tagName){const r=`https://www.youtube.com/embed/${e.featuredVideo}`;t.src!==r&&(t.src=r)}else console.error('Element with ID "featuredVideo" not found or is not an iframe.')}e.meta&&(document.title=e.meta.title||document.title,document.querySelector('meta[name="description"]').content=e.meta.description||"",document.querySelector('meta[name="keywords"]').content=e.meta.keywords||"")}else console.error("Invalid data or marquee_details_fragmentHTML not found.")};var Marquee,MarqueeModel=function(){this.Standing=ko.observable(),this.Seated=ko.observable(),this.Packing=ko.observableArray(),this.getPackingTotalWeight=()=>{let e=0;return this.Packing().forEach((t=>{let r=0,a=1,o=t.Value.match(/WT\s*([\d\.]+)\s*kg/);if(o||(o=t.Value.match(/Weight:\s*([\d\.]+)\s*kg\s*(each)?/)),o&&(r=parseFloat(o[1]),o[2])){const e=t.Value.match(/(\d+)\s*x/);a=e?parseInt(e[1]):1}e+=r*a})),parseFloat(e).toFixed(2)},this.Dimensions=ko.observableArray(),this.formattedProductShip=ko.observable(),this.InstructionVideo=ko.observable(),this.imageOne=()=>{switch(this.Canopy.Product().ProductCode){case"06073":case"00700":case"06205":case"00702":case"07161":case"07162":case"07827":case"00701":case"00703":case"00704":case"00705":case"00706":case"00707":case"00708":case"00709":case"10080":case"10081":case"10082":case"10083":case"10084":case"10085":return"https://cdn.galatent.co.uk/cdn/galatent_co_uk/images/marquee-land/3m-wide-pe-marquee--GB.png";case"09080":case"09073":case"09081":case"09082":case"09083":case"09084":case"09085":return"https://cdn.galatent.co.uk/cdn/galatent_co_uk/images/marquee-land/3m-wide-pvc-marquess---GB.jpg";case"09086":case"09087":case"09088":case"09089":case"09090":return"https://cdn.galatent.co.uk/cdn/galatent_co_uk/images/marquee-land/4m-wide-pvc-marquess---GB.jpg";default:return"https://cdn.galatent.co.uk/cdn/galatent_co_uk/images/marquee-land/6m-wide-pvc-marquess---GB.jpg"}},this.Qty=ko.observable(1);var e=window.__marquee.material,t=window.__marquee.size;this.SizeDims=ko.observableArray(t.split(" x ")),this.H1=function(){let e=Marquee.Canopy.Material(),t=Marquee.Frame.Size();if("PE"===e)switch(t){case"3m x 2m":return"Buy 3m x 2m Gala Tent Classic Marquee - Ideal Garden Marquee for Outdoor Events";case"3m x 3m":return"Buy 3m x 3m Gala Tent Classic Marquee - Ideal Garden Marquee for Outdoor Events";case"3m x 4m":return"Buy 3m x 4m Gala Tent Classic Marquee - Ideal Garden Marquee for Outdoor Event";case"3m x 6m":return"Buy 3m x 6m Gala Tent Classic Marquee - Ideal Garden Marquee for Outdoor Event";case"3m x 8m":return"Buy 3m x 8m Gala Tent Classic Marquee - Ideal Garden Marquee for Outdoor Event";case"3m x 10m":return"Buy 3m x 10m Gala Tent Classic Marquee - Ideal Garden Marquee for Outdoor Event";case"3m x 12m":return"Buy 3m x 12m Gala Tent Classic Marquee - Ideal Garden Marquee for Outdoor Event";case"4m x 4m":return"Buy 4m x 4m Gala Tent Classic Marquee - Ideal Garden Marquee for Outdoor Event";case"4m x 6m":return"Buy 4m x 6m Gala Tent Classic Marquee - Ideal Garden Marquee for Outdoor Event";case"4m x 8m":return"Buy 4m x 8m Gala Tent Classic Marquee - Ideal Garden Marquee for Outdoor Event";case"4m x 10m":return"Buy 4m x 10m Gala Tent Classic Marquee - Ideal Garden Marquee for Outdoor Event";case"4m x 12m":return"Buy 4m x 12m Gala Tent Classic Marquee - Ideal Garden Marquee for Outdoor Event";case"6m x 6m":return"Buy 6m x 6m Gala Tent Classic Marquee - Ideal Garden Marquee for Outdoor Event";case"6m x 8m":return"Buy 6m x 8m Gala Tent Classic Marquee - Ideal Garden Marquee for Outdoor Event";case"6m x 10m":return"Buy 6m x 10m Gala Tent Classic Marquee - Ideal Garden Marquee for Outdoor Event";case"6m x 12m":return"Buy 6m x 12m Gala Tent Classic Marquee - Ideal Garden Marquee for Outdoor Event";case"6m x 14m":return"Buy 6m x 14m Gala Tent Classic Marquee - Ideal Garden Marquee for Outdoor Event";case"6m x 16m":return"Buy 6m x 16m Gala Tent Classic Marquee - Ideal Garden Marquee for Outdoor Event";case"6m x 18m":return"Buy 6m x 18m Gala Tent Classic Marquee - Ideal Garden Marquee for Outdoor Event";case"6m x 20m":return"Buy 6m x 20m Gala Tent Classic Marquee - Ideal Garden Marquee for Outdoor Event";case"6m x 22m":return"Buy 6m x 22m Gala Tent Classic Marquee - Ideal Garden Marquee for Outdoor Event";case"6m x 24m":return"Buy 6m x 24m Gala Tent Classic Marquee - Ideal Garden Marquee for Outdoor Event";default:return"Gala Tent Classic PE Marquees: Versatile Event Solutions for Every Occasion"}else{if("PVC"!==e)return"Marquees Gala Tent";switch(t){case"3m x 2m":return"Buy 3m x 2m Gala Tent Elite Marquee PVC - Compact Event Tents for Small Gatherings";case"3m x 3m":return"Buy 3m x 3m Gala Tent Elite Marquee PVC - Versatile Heavy-Duty PVC Marquees for Events";case"3m x 4m":return"Buy 3m x 4m Gala Tent Elite Marquee PVC - Durable Commercial Marquees for Outdoor Events";case"3m x 6m":return"Buy 3m x 6m Gala Tent Elite Marquee PVC - Large Event Marquees for Weddings and Parties";case"3m x 8m":return"Buy 3m x 8m Gala Tent Elite Marquee PVC - Extra-Large PVC Marquees for Corporate Events";case"3m x 10m":return"Buy 3m x 10m Gala Tent Elite Marquee PVC - Premium Commercial PVC Marquee for Any Event";case"3m x 12m":return"Buy 3m x 12m Gala Tent Elite Marquee PVC - Ideal for Large Family Gatherings & Celebrations";case"4m x 4m":return"Buy 4m x 4m Gala Tent Elite Marquee PVC - Compact and Durable Marquee for Small Events";case"4m x 6m":return"Buy 4m x 6m Gala Tent Elite Marquee PVC - Perfect for Medium-Sized Garden Parties";case"4m x 8m":return"Buy 4m x 8m Gala Tent Elite Marquee PVC - Ideal for Outdoor Weddings and Receptions";case"4m x 10m":return"Buy 4m x 10m Gala Tent Elite Marquee PVC - Premium Marquee for Corporate Events";case"4m x 12m":return"Buy 4m x 12m Gala Tent Elite Marquee PVC - Premium Commercial PVC Marquee for Any Event";case"6m x 6m":return"Buy 6m x 6m Gala Tent Elite Marquee PVC - Suitable for Exhibitions and Trade Shows";case"6m x 8m":return"Buy 6m x 8m Gala Tent Elite Marquee PVC - Premium Commercial PVC Marquee for Any Event";case"6m x 10m":return"Buy 6m x 10m Gala Tent Elite Marquee PVC - Premium Commercial PVC Marquee for Any Event";case"6m x 12m":return"Buy 6m x 12m Gala Tent Elite Marquee PVC - Large Marquee for Festivals and Public Events";case"6m x 14m":return"Buy 6m x 14m Gala Tent Elite Marquee PVC - Premium Commercial PVC Marquee for Any Event";case"6m x 16m":return"Buy 6m x 16m Gala Tent Elite Marquee PVC - Premium Commercial PVC Marquee for Any Event";case"6m x 18m":return"Buy 6m x 18m Gala Tent Elite Marquee PVC - Premium Commercial PVC Marquee for Any Event";case"6m x 20m":return"Buy 6m x 20m Gala Tent Elite Marquee PVC - Premium Commercial PVC Marquee for Any Event";case"6m x 22m":return"Buy 6m x 22m Gala Tent Elite Marquee PVC - Premium Commercial PVC Marquee for Any Event";case"6m x 24m":return"Buy 6m x 24m Gala Tent Elite Marquee PVC - Extra-Large Marquee for Major Outdoor Functions";default:return"Gala Tent Elite PVC Marquees: High-Durability Event Tents for All Occasions"}}},this.Packages={lastPackage:ko.observable("Select"),togglePlus:function(){"Plus"==Marquee.Packages.lastPackage()?(Marquee.Groundbars.Option("Select"),Marquee.Polebag.Option("Select"),Marquee.Canopybag.Option("Select"),Marquee.Packages.lastPackage("Select")):(Marquee.Heaters.Qty(0),Marquee.Groundbars.Option("Yes"),Marquee.Polebag.Option("Yes"),Marquee.Canopybag.Option("Yes"),Marquee.Packages.lastPackage("Plus"))},toggleSuper:function(){"Super"==Marquee.Packages.lastPackage()?(Marquee.Heaters.Qty(0),Marquee.Groundbars.Option("Select"),Marquee.Polebag.Option("Select"),Marquee.Canopybag.Option("Select"),Marquee.Packages.lastPackage("Select")):(Marquee.Heaters.Qty(Marquee.Heaters.recommendedQty()),Marquee.Groundbars.Option("Yes"),Marquee.Polebag.Option("Yes"),Marquee.Canopybag.Option("Yes"),Marquee.Packages.lastPackage("Super"))}},this.Frame={Size:ko.observable(t),Frame:ko.observable(),Product:ko.observable()},this.Canopy={Material:ko.observable(e),Product:ko.observable()},this.Groundbars={Option:ko.observable(),Product:ko.observable(),toggle:function(){setTimeout((function(){Marquee.Groundbars.Option("Select"===Marquee.Groundbars.Option()?"Yes":"Select")}),0)},previewOption:function(){return transformedData.find((e=>"Groundbars"==e.name)).products.find((e=>-1!==e.ProductName.indexOf(Marquee.Frame.Size())))},buyitwith:ko.observable(!0),buyitwithToggle:function(){setTimeout((function(){Marquee.Groundbars.buyitwith(!Marquee.Groundbars.buyitwith())}),0)}},this.Anchorage={ConcreteWeights:{Option:ko.observable(),previewOption:ko.observable(),generateOptions:function(){const[e,t]=Marquee.SizeDims();let r=2+parseInt(t.replace("m")),a=[],o=r;const n=Math.floor(o/10);o-=10*n;const i=Math.floor(o/8);o-=8*i;const u=Math.floor(o/6);o-=6*u;const s=Math.floor(o/4);o-=4*s,o>0?42===r?a=[{ProductCode:"12598",Qty:3},{ProductCode:"12597",Qty:1},{ProductCode:"12595",Qty:1}]:32===r?a=[{ProductCode:"12598",Qty:2},{ProductCode:"12597",Qty:1},{ProductCode:"12595",Qty:1}]:22===r?a=[{ProductCode:"12598",Qty:1},{ProductCode:"12597",Qty:1},{ProductCode:"12595",Qty:1}]:12===r?a=[{ProductCode:"12597",Qty:1},{ProductCode:"12595",Qty:1}]:console.warn(`Unaccounted quantity: ${o}`):(n>0&&a.push({ProductCode:"12598",Qty:n}),i>0&&a.push({ProductCode:"12597",Qty:i}),u>0&&a.push({ProductCode:"12596",Qty:u}),s>0&&a.push({ProductCode:"12595",Qty:s}));const c=extractDimensions(Marquee.Frame.Size());3==c.width&&3==c.height&&(r=4,a=[{ProductCode:"12595",Qty:1}]);const d=new ProductMultipleModel(`x${r} Concrete Weights 40kg`,"Anchorage",a);this.previewOption(d)},toggle:function(){this.Option("Yes"===this.Option()?"No":"Yes")}},WaterBagWeights:{Option:ko.observable(),previewOption:ko.observable(),generateOptions:function(){const[e,t]=Marquee.SizeDims();let r=2+parseInt(t.replace("m"));const a=extractDimensions(Marquee.Frame.Size());3==a.width&&3==a.height&&(r=4);let o=new ProductMultipleModel(`x${r} Water Bag Weights 50kg`,"Anchorage",[{ProductCode:"11087",Qty:r}]);this.previewOption(o)},toggle:function(){this.Option("Yes"===this.Option()?"No":"Yes")}},TieDownKit:{Option:ko.observable(),previewOption:ko.observable(),generateOptions:function(){const[e,t]=Marquee.SizeDims();let r=2+parseInt(t.replace("m"));const a=extractDimensions(Marquee.Frame.Size());3==a.width&&3==a.height&&(r=4),r/=2;let o=new ProductMultipleModel(`x${2*r} Ratchet Storm Tie Down Kit`,"Anchorage",[{ProductCode:"01003",Qty:r}]);this.previewOption(o)},toggle:function(){this.Option("Yes"===this.Option()?"No":"Yes")}}},this.Anchors={Empty:new ProductModel({ProductCode:"Select",ProductName:"Select"}),Option:ko.observable(),Product:ko.observable(),Options:ko.observableArray(),toggle:function(){setTimeout((function(){Marquee.Anchors.Option(Marquee.Anchors.Option()===Marquee.Anchors.Empty?Marquee.Anchors.tiedownkit():Marquee.Anchors.Empty)}),0)},generateOptions:function(){var e=function(e,t){var r=new ProductModel(e=transformedData.find((e=>"Anchorage"==e.name)).products.find((t=>t.ProductCode==e)));return t>1&&(r.Qty=t,r.ProductName="(x"+r.Qty+") "+r.ProductName+" +"+localizeCost(r.ProductPrice*r.Qty)),r},t=[];t.push(this.Empty);const r=extractDimensions(Marquee.Frame.Size());r?6==r.width?t.push(e("01003",r.height)):4==r.width?12==r.height?t.push(e("01003",8)):10==r.height?t.push(e("01003",6)):8==r.height||6==r.height?t.push(e("01003",4)):t.push(e("01003",3)):3==r.width&&(12==r.height?t.push(e("01003",8)):10==r.height?t.push(e("01003",5)):8==r.height?t.push(e("01003",4)):6==r.height?t.push(e("01003",3)):t.push(e("01003",2))):t.push(e("01003",2)),this.Options(t)},previewOption:function(){return transformedData.find((e=>"Anchorage"==e.name)).products.find((e=>"01003"===e.ProductCode))}},this.Extras={Option:ko.observable()},this.Heaters={Product:ko.observable(),Qty:ko.observable(0),qty_increase:function(){qty_increase(Marquee.Heaters.Qty)},qty_decrease:function(){qty_decrease(Marquee.Heaters.Qty)},generateOptions:function(){var e=transformedData.find((e=>"Heaters"==e.name)).products[0];e.Qty=0,this.Product(e),Marquee.Heaters.recommendedQty(function(){switch(Marquee.Frame.Size()){case"3m x 2m":case"3m x 3m":return 1;case"3m x 4m":case"3m x 6m":case"4m x 4m":case"4m x 6m":return 2;case"3m x 8m":case"3m x 10m":case"4m x 8m":case"6m x 6m":return 3;case"3m x 12m":case"4m x 10m":case"6m x 8m":return 4;case"6m x 10m":return 5;case"6m x 12m":return 6;case"6m x 14m":return 7;case"6m x 16m":return 8;case"6m x 18m":return 9;case"6m x 20m":return 10;case"6m x 22m":return 11;case"6m x 24m":return 12}return 1}())},recommendedQty:ko.observable()},this.Lighting={Product:ko.observable(),Qty:ko.observable(0),qty_increase:function(){qty_increase(Marquee.Lighting.Qty)},qty_decrease:function(){qty_decrease(Marquee.Lighting.Qty)},generateOptions:function(){var e=transformedData.find((e=>"Lighting"==e.name)).products[0];e.Qty=0,this.Product(e)}},this.Lining={Option:ko.observable(),Product:ko.observable(),toggle:function(){setTimeout((function(){Marquee.Lining.Option("Select"===Marquee.Lining.Option()?"Yes":"Select")}),0)},previewOption:function(){return transformedData.find((e=>"Lining"==e.name)).products.find((e=>-1!==e.ProductName.indexOf(Marquee.Frame.Size())))}},this.Polebag={Option:ko.observable(),Product:ko.observable(),toggle:function(){setTimeout((function(){Marquee.Polebag.Option("Select"===Marquee.Polebag.Option()?"Yes":"Select")}),0)},generateOptions:function(){var e=transformedData.find((e=>"Polebag"==e.name)).products[0],t=window.__input.find((e=>"Polebag"==e.name)).relatedProd.find((e=>e.ProdMaster==Marquee.Canopy.Product().ProductCode)).recQty;return e.Qty=t,e},previewOption:function(){return transformedData.find((e=>"Polebag"==e.name)).products[0]}},this.Canopybag={Option:ko.observable(),Product:ko.observable(),toggle:function(){setTimeout((function(){Marquee.Canopybag.Option("Select"===Marquee.Canopybag.Option()?"Yes":"Select")}),0)},generateOptions:function(){var e=transformedData.find((e=>"Canopybag"==e.name)).products[0],t=window.__input.find((e=>"Canopybag"==e.name)).relatedProd.find((e=>e.ProdMaster==Marquee.Canopy.Product().ProductCode)).recQty;return e.Qty=t,e},previewOption:function(){return transformedData.find((e=>"Canopybag"==e.name)).products[0]}},this.calculateMarquee=function(){var e=transformedData.find((e=>"Marquees"==e.name)).products.find((e=>(e.Material||"").toUpperCase()==this.Canopy.Material()&&(e.Size||"")==this.Frame.Size()));this.Canopy.Product(e)},this.calculateMarqueeProducts=function(){try{if("Yes"==this.Groundbars.Option()?this.Groundbars.Product(Marquee.Groundbars.previewOption()):this.Groundbars.Product(void 0),"Yes"==this.Lining.Option()){var e=transformedData.find((e=>"Lining"==e.name)).products.find((e=>-1!==e.ProductName.indexOf(this.Frame.Size())));e?this.Lining.Product(e):(showAlert("icon-cancel-circled","Error","Lining option not available for this size!","#FFFFFF",!1),this.Lining.Option("Select"))}else this.Lining.Product(void 0);"Yes"==this.Polebag.Option()?this.Polebag.Product(Marquee.Polebag.previewOption()):this.Polebag.Product(void 0),"Yes"==this.Canopybag.Option()?this.Canopybag.Product(Marquee.Canopybag.previewOption()):this.Canopybag.Product(void 0)}catch(e){console.log(e)}},this.calcCosts=()=>{let e=0,t=0;return[this.Frame,this.Canopy,this.Groundbars,this.Anchors,this.Heaters,this.Lighting,this.Lining,this.Polebag,this.Canopybag,this.Anchorage.ConcreteWeights,this.Anchorage.WaterBagWeights,this.Anchorage.TieDownKit].forEach((function(r){if(void 0!==r.Product&&r.Product()&&r.Product().ProductPrice){var a=r.Product().ProductPrice,o=r.Product().Qty,n=r.Product().ProductDiscount,i=getFinalPrice(a,n)*o;e+=i,t+=a*o-i}else if(void 0!==r.Option&&"Yes"===r.Option()){const a=r.previewOption().calcCosts();e+=a.totalCost,t+=a.totalSaving}})),t=Number(parseFloat(t).toFixed(2)),e*=this.Qty(),t*=this.Qty(),{totalCost:e,totalSaving:t}},this.calcBundleCosts=()=>{let e=0,t=0;[this.Frame,this.Canopy].forEach((function(r){if(void 0!==r.Product&&r.Product()&&r.Product().ProductPrice){var a=r.Product().ProductPrice,o=r.Product().Qty,n=r.Product().ProductDiscount,i=getFinalPrice(a,n)*o;e+=i,t+=a*o-i}}));return[this.Groundbars].forEach((function(r){if(void 0!==r.Product&&r.buyitwith()&&r.previewOption()&&r.previewOption().ProductPrice){var a=r.previewOption().ProductPrice,o=r.previewOption().Qty,n=r.previewOption().ProductDiscount,i=getFinalPrice(a,n)*o;e+=i,t+=a*o-i}})),t=Number(parseFloat(t).toFixed(2)),e*=this.Qty(),t*=this.Qty(),{totalCost:e,totalSaving:t}},this.calculateGazeboCost=function(){const{totalCost:e}=this.calcCosts();return e},this.getSaving=function(){const{totalSaving:e}=this.calcCosts();return e},this.getBundleProducts=()=>{const e=[];var t=1;[this.Frame,this.Canopy].forEach((function(r){if(void 0!==r.Product&&r.Product()&&r.Product().ProductPrice){let a={sku:r.Product().ProductCode,qty:r.Product().Qty};r.Product().ProductShip>t&&(t=r.Product().ProductShip),a.qty>0&&e.push(a)}}));return[this.Groundbars].forEach((function(r){if(void 0!==r.Product&&r.buyitwith()&&r.previewOption()&&r.previewOption().ProductPrice){let a={sku:r.previewOption().ProductCode,qty:r.previewOption().Qty*this.Qty()};r.previewOption().ProductShip>t&&(t=r.previewOption().ProductShip),a.qty>0&&e.push(a)}})),{skusToAdd:e,productShipping:t}},this.click_addbuilderproducts_bundle=function(){const e=this.getBundleProducts();this.add(e)},this.getShipping=function(){const e=Marquee.getBuilderProducts(),{productShipping:t}=e;return parseInt(t)},this.getBreakDown=function(){let e=[];return[this.Frame,this.Canopy,this.Groundbars,this.Anchors,this.Heaters,this.Lighting,this.Lining,this.Polebag,this.Canopybag,this.Anchorage.ConcreteWeights,this.Anchorage.WaterBagWeights,this.Anchorage.TieDownKit].forEach((function(t){if(void 0!==t.Product&&t.Product()&&t.Product().ProductPrice)t.Product().Qty>0&&e.push(t.Product());else if(void 0!==t.Option&&"Yes"===t.Option())for(const r of t.previewOption().list)e.push(r)})),e},this.getBuilderProducts=function(){const e=[];var t=1;return[this.Frame,this.Canopy,this.Groundbars,this.Anchors,this.Heaters,this.Lighting,this.Lining,this.Polebag,this.Canopybag,this.Anchorage.ConcreteWeights,this.Anchorage.WaterBagWeights,this.Anchorage.TieDownKit].forEach((function(r){if(void 0!==r.Product&&r.Product()&&r.Product().ProductPrice){let a={sku:r.Product().ProductCode,qty:r.Product().Qty*Marquee.Qty()};r.Product().ProductShip>t&&(t=r.Product().ProductShip),a.qty>0&&e.push(a)}else if(void 0!==r.Option&&"Yes"===r.Option())for(const a of r.previewOption().list){let r={sku:a.ProductCode,qty:a.Qty*Marquee.Qty()};a.ProductShip>t&&(t=a.ProductShip),r.qty>0&&e.push(r)}})),{skusToAdd:e,productShipping:t}},this.click_addbuilderproducts=function(){const e=this.getBuilderProducts();this.add(e)},this.add=e=>{const{skusToAdd:t,productShipping:r}=e;r>1&&modalOpen(document.getElementById("help-oos")),fetch("/gala-tent-marquee/add",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:t})}).then((e=>e.json())).then((e=>{setBasket({Qty:e.totalQty,Cost:e.totalPrice}),showAlert("icon-ok-circled",CONST_PRODUCT_ADD_TITLE,CONST_PRODUCT_ADDED+" "+CONST_PRODUCT_ADDED_APPEND,"#FFFFFF",!1)})).catch((e=>{console.error("Error:",e)}))},this.click_includeall=function(){Marquee.Groundbars.Option("Yes"),showAlert("icon-ok-circled",CONST_PRODUCT_INCLUDE_ALL_TITLE,CONST_PRODUCT_INCLUDE_ALL_MSG,"#FFFFFF",!1)},this.displaySnippet=function(){try{switch(this.Canopy.Material()){case"PE":return"Low cost and functional";case"PVC":return"Commercial Quality Marquee";default:return""}}catch(e){return""}},this.Frame.Size.subscribe((function(e){Marquee.calculateMarquee(),Marquee.calculateMarqueeProducts(),Marquee.Anchors.generateOptions(),Marquee.Polebag.generateOptions(),Marquee.Canopybag.generateOptions(),Marquee.Heaters.generateOptions();const t=e.split(" x ");Marquee.SizeDims(t),Marquee.Anchorage.ConcreteWeights.generateOptions(),Marquee.Anchorage.WaterBagWeights.generateOptions(),Marquee.Anchorage.TieDownKit.generateOptions()})),this.Canopy.Material.subscribe((function(e){Marquee.calculateMarquee()})),this.Canopy.Product.subscribe((function(e){e&&e.images&&setTimeout((function(){var t=[],r=e.images;for(var a in r)t.push(new galleryModel(r[a]));var o=e.videos;for(var a in o)t.push(new galleryModel(o[a]));gallery=t,"undefined"!=typeof createGallery&&createGallery()}),0),fetch("/gala-tent-marquee/fragment?code="+Marquee.Canopy.Product().ProductCode).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{setDetailsFragmentHTML(e),Marquee.formattedProductShip(e.formattedProductShip),updateUrlAndReload(`/marquees${e.URL}`)})).catch((e=>{console.error("Fetch error:",e)}))})),this.Groundbars.Option.subscribe((function(e){Marquee.calculateMarqueeProducts()})),this.Anchors.Option.subscribe((function(e){Marquee.Anchors.Product(e),Marquee.calculateMarqueeProducts()})),this.Heaters.Qty.subscribe((function(e){Marquee.Heaters.Product({...Marquee.Heaters.Product(),Qty:e})})),this.Lighting.Qty.subscribe((function(e){Marquee.Lighting.Product({...Marquee.Lighting.Product(),Qty:e})})),this.Lining.Option.subscribe((function(e){Marquee.calculateMarqueeProducts()})),this.Polebag.Option.subscribe((function(e){Marquee.calculateMarqueeProducts()})),this.Canopybag.Option.subscribe((function(e){Marquee.calculateMarqueeProducts()}))};function qty_increase(e){var t=e();t=isNaN(t)?0:t,e(qty_check(++t))}function qty_decrease(e){var t=e();t=isNaN(t)?0:t,e(qty_check(--t))}function qty_check(e){var t=isNaN(e)?0:e;return t>999?t=999:t<0&&(t=0),t}function extractDimensions(e){const t=e.match(/(\d+)m\s*x\s*(\d+)m/);if(t&&t.length>=3){return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}return null}function updateUrlAndReload(e){try{e.startsWith("/")&&(e=e.substring(1));const t=window.location.origin,r=new URL(e,t),a=t+r.pathname+r.search;window.history.pushState({path:a},"",a);document.querySelector('link[rel="canonical"]').href=a}catch(e){console.error("Error updating URL:",e)}}document.addEventListener("DOMContentLoaded",(function(){(Marquee=new MarqueeModel).calculateMarquee(),Marquee.Anchors.generateOptions(),Marquee.Anchorage.ConcreteWeights.generateOptions(),Marquee.Anchorage.WaterBagWeights.generateOptions(),Marquee.Anchorage.TieDownKit.generateOptions(),Marquee.Heaters.generateOptions(),Marquee.Lighting.generateOptions(),Marquee.Polebag.generateOptions(),Marquee.Canopybag.generateOptions(),ko.applyBindings(Marquee,document.getElementById("content"))})),window.addEventListener("popstate",(function(e){window.location.reload(!1)}));