(function e(n,t,i){function r(u,e){var s,h,o;if(!t[u]){if(!n[u]){if(s=typeof require=="function"&&require,!e&&s)return s(u,!0);if(f)return f(u,!0);h=new Error("Cannot find module '"+u+"'");throw h.code="MODULE_NOT_FOUND",h;}o=t[u]={exports:{}};n[u][0].call(o.exports,function(t){var i=n[u][1][t];return r(i?i:t)},o,o.exports,e,n,t,i)}return t[u].exports}for(var f=typeof require=="function"&&require,u=0;u<i.length;u++)r(i[u]);return r})({1:[function(n){"use strict";function nt(){u=shop.bundlekitId;f=shop.bundleId;s=shop.kitId;i=shop.patternId;e=shop.uniqueId;l=$("#bundle-kit-list");w=$(".environment-image-wrap");r=$("#kit");h=r.find(".sizes-and-quantity");shop.LayoutCookie.handleLayoutCookie("remove");g.deleteCurtainCalcCookie();c();ft();et();vt();y();ct();ut();tt()}function y(){r.find(".bundle-kit-top .kit-reset a.reset-link").hClick(function(){o.deleteUpdateBundleCookie();location.reload()},{preventDefault:!0})}function tt(){w.find(".environment-image-container a.marker:not(.selected)").hoverIntent(function(){$(this).addClass("hover")},function(){$(this).removeClass("hover")})}function it(){var n={id:u,bundleId:f,kitId:s,patternId:i,uniqueId:e};return shop.request({type:"get",url:shop.url.GetKitNotInStockList,data:n}).then(function(n){$("#kitNotInStockList").html(n);rt()})}function rt(){var n=$("#NotNoStockKitListModal");n.find(".jsOpenListToEmail").hClick(function(){n.find("#listToEmail").show()},{preventDefault:!0});n.find("#jsAddProductsOnStockToBasket").hClick(function(){k(!0)})}function ut(){r.find(".jsOpenNotOnStockModal").hClick(function(){var n=$(this);hLib.modal2({ajax:{url:n.attr("href"),success:function(){it()}},modalClass:"dark jsNotOnStock"})},{preventDefault:!0})}function ft(){h.find("#ddlPattern").change(function(){ht()})}function et(){h.find("#NumberOfPattern").change(function(){o.buildUpdateBundleCookie()})}function ot(){var n=$(".kit-descriptive header h1").html();$("#size").html(n)}function st(){i=$("#ddlPattern").val();var n={id:u,bundleId:f,kitId:s,patternId:i,uniqueId:e};return shop.request({type:"post",url:shop.url.UpdateKitList,data:n}).then(function(n){shop.on("kitlistisupdated",n)})}function ht(){i=$("#ddlPattern").val();var t={id:u,bundleId:f,kitId:s,patternId:i,uniqueId:e},n={eventName:"patternhaschanged"};return $.extend(!0,n),shop.request({type:n.type,url:shop.url.KitList,data:t}).then(function(t){if(n.eventName)shop.on(n.eventName,t)})}function ct(){var t=$(".bundle-kit-top").find(".kit-media"),i=t.find("#bundleSlider"),n;a=t.find("#bundle-thumblist ul");n={fixedDimensions:!0,speed:350,onready:function(n){b(n.getIndex());n.el.addClass("slider-ready");n.sliderlist.children("[data-index=0]").addClass("selected")},onafterslide:at};i.find(".inner:first ul.sliderlist ").children().length===1&&(n.preventTouchActions=!0);i.hSlider2(n);a.children().hClick(function(){var n=$(this);lt(n)})}function lt(n){var t=$(n),i=t.index();$.fn.hSlider2.slide({id:"bundleSlider",index:i})}function at(n){n.sliderlist.children(".selected").each(function(){b(n.getIndex())})}function b(n){if(n>=0){var t=a.children();t.eq(n).addClass("selected").siblings().removeClass("selected")}}function vt(){r.find(".js-add-to-basket-list").hClick(function(){k(!1)})}function k(n){var o=$("#kit"),c=o.find("#bundle-kit-list .kit-list"),l=o.data("kitid"),t=[],s=[],r;n&&(s=$("#VariantIds").val().split(","));$.each(c.children(".kit-item"),function(r,e){var c=$(e).find(".product-item"),o,a,v;c.data("product-listid")&&(o={productid:c.data("product-listid"),quantity:c.find(".kit-quantity").data("quantity"),KitQuantity:h.find("#NumberOfPattern :selected").val()},a={Id:o.productid,Quantity:o.quantity,KitId:l,BundleId:f,BundleKitId:u,PatternId:i,KitQuantity:o.KitQuantity},n?(v=$.inArray(o.productid.toString(),s),v<0&&t.push(a)):t.push(a))});r={eventName:"baskethaschanged"};shop.request({type:"post",url:shop.url.addKitToBasket,data:{kitProducts:t,uniqueId:e}}).then(function(n){if(r.eventName)shop.on(r.eventName,n);hLib.growl(n.Message)})}function yt(){l.find(".js-change").hClick(function(){var t=$(this),n;shop.LayoutCookie.handleLayoutCookie("set");n=t.data("url");o.setSelectedProduct(t.data("productid"),n);location.href=n},{preventDefault:!0});l.find(".js-delete").hClick(function(){var n=$(this);o.deleteProduct(n.data("productid"));st()},{preventDefault:!0})}function pt(){var t=arguments.length<=0||arguments[0]===undefined?document.body:arguments[0],n=$(t).find(".hQuantity").not("[data-binded]");n.attr("data-binded",hLib.getTime());n.hQuantity({onChange:function(n){wt({Id:$(this).data("id").substr(0,$(this).data("id").indexOf("-")),multiplum:$(this).data("multiplum"),ItemId:$(this).data("id"),quantity:n,kitId:s,BundleKitId:u,BundleId:f,PatternId:i,HasFixedSalesInterval:$(this).data("hasfixedsalesinterval"),uniqueId:e})}})}function wt(){var n=arguments.length<=0||arguments[0]===undefined?{}:arguments[0];v=n.ItemId;n.Id&&bt({url:shop.url.KitProductPrice,data:n})}function bt(n){var t={eventName:"quantityhaschanged"};return $.extend(!0,t,n),o.updateProductQuantity(t.data.Id,t.data.quantity),shop.request({type:t.type,url:t.url,data:t.data}).then(function(n){if(t.eventName)shop.on(t.eventName,n)})}function c(){var n=arguments.length<=0||arguments[0]===undefined?r:arguments[0];n=$(n);pt(n);yt();ot()}function kt(n){return t({$el:$("#"+v),domEventName:"#"+v,outerHtml:n,ajax:{url:shop.url.KitProductPrice}})}function p(n){return t({$el:$("#kit-price-wrap"),domEventName:"kit-price-wrap",outerHtml:n,ajax:{url:shop.url.BundlePrice}})}function d(n){return t({$el:$("#kit-listItems"),domEventName:"bundle-listItems",outerHtml:n,ajax:{url:shop.url.BundlePrice}})}function dt(n){return t({$el:$("#kit-pattern"),domEventName:"kit-pattern",outerHtml:n,ajax:{url:shop.url.BundlePrice}})}function gt(n){return t({$el:$("#StockStatus #product-stock"),domEventName:"product-stock",outerHtml:n,ajax:{url:shop.url.UpdateKitList}})}function ni(n){return t({$el:$(".kit-reset"),domEventName:"kit-reset",outerHtml:n,ajax:{url:shop.url.KitProductPrice}})}function ti(n){return t({$el:$(".kit-reset"),domEventName:"kit-reset",outerHtml:n,ajax:{url:shop.url.UpdateKitList}})}function ii(n){return t({$el:$("#mini-basket"),domEventName:"mini-basket",outerHtml:n,ajax:{url:shop.url.miniBasket}})}var t=n("utils/updatePartialView.js"),o=n("views/shared/updateBundleCookie.js"),g=n("views/shared/curtainCalcCookie.js"),r,w,l,a,h,v,u,f,s,e,i;shop.pageLoad(nt());shop.on("quantityhaschanged",function(n){kt(n.kitProductPriceView);p(n.kitPriceView);ni(n.kitResetView);c();y()});shop.on("kitlistisupdated",function(n){d(n.kitListView);p(n.kitPriceView);gt(n.StockView);ti(n.kitResetView);c();y()});shop.on("patternhaschanged",function(n){d(n.kitListView);dt(n.PatternView);p(n.kitPriceView);c()});shop.on("baskethaschanged basketsummaryhaschanged othertabbaskethaschanged",function(n){n!=null&&n.MiniBasketView!=null&&ii(n.MiniBasketView)})},{"utils/updatePartialView.js":2,"views/shared/curtainCalcCookie.js":3,"views/shared/updateBundleCookie.js":4}],2:[function(n,t){"use strict";t.exports=function(n){function u(u){clearTimeout(r);var f=$(u);t.replaceWith(f);i.resolve(f);hLib.triggerDOMUpdated({$scope:f,name:n.domEventName})}var t=$(n.$el),i=$.Deferred(),r;return n.outerHtml?u(n.outerHtml):shop.request(n.ajax).then(u),n.outerHtml||(r=setTimeout(function(){t.hLoading()},100)),i}},{}],3:[function(n,t){"use strict";function i(){return u()?JSON.parse($.cookie("curtainCalcCookie")):!1}function r(n){$.cookie("curtainCalcCookie",JSON.stringify(n),{path:"/"})}function u(){return $.cookie("curtainCalcCookie")!=undefined?!0:!1}function f(n){var t=i(),u=t.activeProduct;u==="productid"?t.productid=n:u==="liningid"&&(t.liningid=n);r(t)}function e(){$.removeCookie("curtainCalcCookie",{path:"/"})}function o(){var n=i();return n.returnurl}t.exports={getCurtainCalcCookie:i,setCurtainCalcCookie:r,existCurtainCalcCookie:u,deleteCurtainCalcCookie:e,getReturnCurtainCalcUrl:o,updateSelectedProduct:f}},{}],4:[function(n,t){"use strict";function i(){return JSON.parse($.cookie("updateBundleCookie"))}function r(n){$.cookie("updateBundleCookie",JSON.stringify(n),{path:"/"})}function f(){$.cookie("updateBundleCookie")!=undefined&&u()}function e(){return $.cookie("updateBundleCookie")!=undefined?!0:!1}function o(){$.removeCookie("updateBundleCookie",{path:"/"})}function u(){var r=$("#bundle").data("bundleid"),n=$("#kit"),u=n.data("kitid"),f=n.data("id"),e=n.find("#kit-size"),o=n.find("#kit-quantity"),s=shop.uniqueId,t=[],h=e.find("#ddlPattern :selected").val(),c=o.find("#NumberOfPattern :selected").val(),l=$("#bundle-kit-list #kit-listItems .kit-list"),i;$.each(l.children(".kit-item"),function(n,i){var r=$(i).find(".product-item"),u;r.data("product-listid")&&(u={productid:r.data("product-listid"),quantity:r.find(".kit-quantity").data("quantity"),requireddiscount:r.data("product-requireddiscount"),allowchange:r.data("product-allowchange"),selected:0},t.push(u))});i={bundleid:r,kitid:u,id:f,size:h,quantity:c,uniqueId:s,products:t,returnurl:location.href};$.cookie("updateBundleCookie",JSON.stringify(i),{path:"/"})}function s(n,t){u();var f=i(),e=f.products;e&&e.forEach(function(t){n===t.productid&&(t.selected=1)});f.products=e;f.productlistUrl=t;r(f)}function h(n,t){u();var f=i(),e=f.products;e&&e.forEach(function(i){n===i.productid.toString()&&(i.quantity=t)});f.products=e;r(f)}function c(n){function o(t,i){n===t.productid&&(e=i)}u();var f=i(),t=f.products,e=0;t&&t.forEach(o);e>-1&&t.splice(e,1);f.products=t;r(f)}function l(n){var t=i(),u=t.products;u&&u.forEach(function(t){t.selected&&(t.productid=n,t.selected=0)});t.products=u;r(t)}function a(){var n=i();return n.returnurl}function v(){var n=i();return n.productlistUrl}t.exports={setSelectedProduct:s,deleteProduct:c,updateSelectedProduct:l,deleteUpdateBundleCookie:o,getUpdateBundleCookie:i,buildUpdateBundleCookie:f,updateProductQuantity:h,getProductListUrl:v,getReturnKitUrl:a,existUpdateBundleCookie:e}},{}]},{},[1])