hemfixarna-web-components 1.3.2 → 1.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -312,7 +312,7 @@ const HemfixarnaAddress = class {
312
312
  this.town = this.town === state.user.town ? '' : e.target.value;
313
313
  };
314
314
  this.render = () => {
315
- return (index.h("form", { class: "hemfixarna_address", onSubmit: e => this.handleSubmit(e) }, index.h("div", null, index.h("input", { class: `${this.street.length ? 'input_active' : ''}`, onInput: this.handleChangeStreet, type: "text", name: "street", value: this.street === state.user.street ? hideField(this.street) : this.street }), index.h("label", { htmlFor: "street" }, "Gatuaddress ")), this.streetError && index.h("span", null, this.streetError), index.h("div", null, index.h("input", { class: `${this.zip.length ? 'input_active' : ''}`, onInput: this.handleChangeZip, type: "tel", name: "zip", value: this.zip === state.user.zip ? hideField(this.zip) : this.zip }), index.h("label", { htmlFor: "zip" }, "Postnummer ")), this.zipError && index.h("span", null, this.zipError), index.h("div", null, index.h("input", { class: `${this.town.length ? 'input_active' : ''}`, onInput: this.handleChangeTown, type: "text", name: "town", value: this.town === state.user.town ? hideField(this.town) : this.town }), index.h("label", { htmlFor: "town" }, "Ort ")), this.townError && index.h("span", null, this.townError), index.h("input", { type: "submit", value: "Forts\u00E4tt och Boka" })));
315
+ return (index.h("form", { class: "hemfixarna_address", onSubmit: e => this.handleSubmit(e) }, index.h("div", null, index.h("input", { class: `${this.street.length ? 'input_active' : ''}`, onInput: this.handleChangeStreet, type: "text", name: "street", value: this.street === state.user.street ? hideField(this.street) : this.street }), index.h("label", { htmlFor: "street" }, "Gatuaddress ")), this.streetError && index.h("span", null, this.streetError), index.h("div", null, index.h("input", { class: `${this.zip.length ? 'input_active' : ''}`, onInput: this.handleChangeZip, type: "tel", name: "zip", value: this.zip === state.user.zip ? hideField(this.zip) : this.zip }), index.h("label", { htmlFor: "zip" }, "Postnummer ")), this.zipError && index.h("span", null, this.zipError), index.h("div", null, index.h("input", { class: `${this.town.length ? 'input_active' : ''}`, onInput: this.handleChangeTown, type: "text", name: "town", value: this.town === state.user.town ? hideField(this.town) : this.town }), index.h("label", { htmlFor: "town" }, "Ort ")), this.townError && index.h("span", null, this.townError), index.h("input", { type: "submit", value: "Forts\u00E4tt" })));
316
316
  };
317
317
  this.street = '';
318
318
  this.streetError = null;
@@ -792,8 +792,8 @@ const HemfixarnaCheckout = class {
792
792
  }
793
793
  else if (state.checkoutStep === 2) {
794
794
  return (index.h("div", { class: "mb-2" }, index.h("div", { class: "hemfixarna_addressinfo" }, index.h("div", null, index.h("p", null, hideField(state.user.firstName)), index.h("p", null, hideField(state.user.lastName)), index.h("p", null, state.user.email), index.h("p", null, state.user.phone)), index.h("div", null, index.h("p", null, hideField(state.user.street)), index.h("p", null, hideField(state.user.zip)), index.h("p", null, hideField(state.user.town))), index.h("button", { onClick: () => (state.checkoutEdit = true) }, "Beh\u00F6ver du \u00E4ndra adressen?")), index.h("form", { onSubmit: e => this.handleSubmit(e) }, index.h("div", null, index.h("img", { src: dateLogo, width: 24 }), index.h("input", { class: `${this.date.length ? 'input_active' : ''}`, min: new Date().toISOString().split('T')[0], onChange: e => this.handleChangeDate(e), type: "date", name: "date", value: this.date }), index.h("label", { htmlFor: "date" }, "Tidigaste datum f\u00F6r hembes\u00F6k"), index.h("img", { src: down, width: 24 })), this.dateError && index.h("span", null, this.dateError), index.h("label", { class: "hemfixarna_checkbox" }, index.h("input", { onChange: () => this.handleChangeTerms(), type: "checkbox" }), index.h("span", { innerHTML: state.options.terms })), state.cart
795
- .filter(i => i.terms_checkout && i.terms_show_checkbox)
796
- .map(item => (index.h(index.Fragment, null, index.h("label", { class: "hemfixarna_checkbox" }, index.h("input", { onChange: () => this.handleChangeTerms(), type: "checkbox" }), index.h("span", null, item.terms_checkout))))), this.generalError && index.h("span", null, this.generalError), index.h("div", { class: this.loading ? 'loading' : '' }, index.h("input", { type: "submit", value: this.loading ? '' : 'Slutför Bokning' }), index.h("img", { width: 20, height: 20, src: loading, alt: "spinner" })))));
795
+ .filter(i => { var _a; return (_a = i.terms_checkout) === null || _a === void 0 ? void 0 : _a.length; })
796
+ .map(item => (index.h(index.Fragment, null, index.h("label", { class: "hemfixarna_checkbox" }, index.h("input", { onChange: () => this.handleChangeTerms(), type: "checkbox" }), index.h("span", null, item.terms_checkout))))), this.generalError && index.h("span", null, this.generalError), index.h("div", { class: this.loading ? 'loading' : '' }, index.h("input", { type: "submit", value: this.loading ? '' : 'Skicka bokning' }), index.h("img", { width: 20, height: 20, src: loading, alt: "spinner" })))));
797
797
  }
798
798
  };
799
799
  this.date = '';
@@ -809,7 +809,7 @@ const HemfixarnaCheckout = class {
809
809
  get el() { return index.getElement(this); }
810
810
  };
811
811
 
812
- const hemfixarnaCss = "@import url(\"https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap\"); *{box-sizing:border-box}:host{font-family:\"Inter\", sans-serif}:host .mb-2{margin-bottom:32px}:host button{color:#474444}:host form{display:flex;flex-direction:column;gap:16px}:host form img{position:absolute;top:50%;transform:translateY(-50%);pointer-events:none}:host form img:first-of-type{left:16px}:host form img:last-of-type{right:16px}:host form span{margin-top:-8px;color:#ec6632}:host form p{text-align:center}:host form p{margin:0}:host form div{position:relative}:host form div label{pointer-events:none;position:absolute;left:16px;top:50%;transform:translateY(-50%);background:#fff;padding:4px;transition:0.2s all cubic-bezier(0.465, 0.183, 0.153, 0.946)}:host form div input{padding:16px;width:100%;font-size:16px;border:1px solid #fcd9c9}:host form div input:focus~label,:host form div .input_active~label{top:0;transform:translateY(-50%);background:linear-gradient(180deg, #fffaf2 50%, #fff 50%)}:host h1{font-size:24px;font-weight:400;line-height:32px;letter-spacing:-3%;text-align:left;margin:0 0 8px}:host h2{margin:0 0 24px;font-weight:700;font-size:20px;line-height:28px;letter-spacing:-3%}:host p{font-size:16px;font-weight:400;line-height:24px;letter-spacing:-3%}:host .hemfixarna{width:100%;}:host .hemfixarna_nav{position:absolute;top:0;width:100dvw;left:0;height:80px;z-index:9999}:host .hemfixarna_nav--links{display:none !important}@media (min-width: 769px){:host .hemfixarna_nav--links{display:flex !important}}:host .hemfixarna_nav--links a{color:#ec6632;text-decoration:none;border:1px solid rgba(255, 255, 255, 0.3);border-radius:56px;padding:8px 32px;text-transform:capitalize}:host .hemfixarna_nav>div{position:relative;overflow:hidden;width:100%;height:100%;display:flex;justify-content:space-between;align-items:center;padding:0 16px}@media (min-width: 769px){:host .hemfixarna_nav>div{padding:0 32px}}:host .hemfixarna_nav>div>div{display:flex;gap:32px;justify-content:space-between}:host .hemfixarna_nav>div>img{position:absolute;width:100%;height:100%;top:0;left:0;z-index:-1}:host .hemfixarna_nav p{color:#fff}:host .hemfixarna_standalone .hemfixarna_backdrop{background:#fffaf2;opacity:1}:host .hemfixarna_standalone .hemfixarna_modal{top:80px;transform:translateX(-50%);border:none;height:calc(100dvh - 80px);opacity:0}:host .hemfixarna_standalone .hemfixarna_modal--open{opacity:1}:host .hemfixarna .switch{position:relative;display:inline-block;width:40px;height:20px}:host .hemfixarna .switch input{opacity:0;width:0;height:0}:host .hemfixarna .slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:#ccc;-webkit-transition:0.4s;transition:0.4s;border-radius:34px}:host .hemfixarna .slider:before{position:absolute;content:\"\";height:18px;width:18px;left:2px;bottom:1px;background-color:white;-webkit-transition:0.4s;transition:0.4s;border-radius:50%}:host .hemfixarna input:checked+.slider{background-color:#fcd9c9}:host .hemfixarna input:focus+.slider{box-shadow:0 0 1px #fcd9c9}:host .hemfixarna input:checked+.slider:before{-webkit-transform:translateX(18px);-ms-transform:translateX(18px);transform:translateX(18px);background:#ec6632}:host .hemfixarna_checkbox{display:grid;grid-template-columns:40px auto;font-size:16px;font-weight:400;line-height:24px;letter-spacing:-3%}:host .hemfixarna_checkbox>span{transform:translateY(6px)}:host .hemfixarna_checkbox span,:host .hemfixarna_checkbox span p{color:#474444;font-size:14px}:host .hemfixarna_checkbox p{text-align:left}:host .hemfixarna_info{display:flex;flex-direction:column;gap:24px;padding:32px;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);border-radius:4px;border:1px solid #fcd9c9}:host .hemfixarna_info h2{margin:0}@media (min-width: 769px){:host .hemfixarna_info{position:sticky;top:0}}:host .hemfixarna_infomodal{position:absolute;top:40%;left:50%;transform:translate(-50%, -50%);width:100%;max-width:80%;background:#fffaf2;border:1px solid #fcd9c9;padding:32px;z-index:99;border-radius:4px;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);display:flex;flex-direction:column;gap:16px}:host .hemfixarna_infomodal p,:host .hemfixarna_infomodal h4{margin:0}:host .hemfixarna_infomodal button{background:#ec6632;color:#fff;border-radius:60px;font-size:16px;padding:8px 16px}:host .hemfixarna_addressinfo{padding:16px 16px 64px;border:1px solid #fcd9c9;position:relative;margin-bottom:32px;display:grid;grid-template-columns:1fr;gap:8px}@media (min-width: 769px){:host .hemfixarna_addressinfo{grid-template-columns:1fr 1fr}}:host .hemfixarna_addressinfo button{position:absolute;bottom:16px;right:16px;font-weight:500;text-underline-offset:2px;text-decoration:underline}:host .hemfixarna_part{background:#fff;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);display:grid;padding:16px;grid-template-columns:auto 75px}:host .hemfixarna_counter{display:flex;align-items:center}:host .hemfixarna_counter span{padding:0 8px}:host .hemfixarna_counter img{cursor:pointer}:host .hemfixarna_counter img:not(.disabled):hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_description{display:grid;gap:16px}:host .hemfixarna_description ul{list-style:disc;padding-right:12px;transform:translateX(12px)}:host .hemfixarna_description--hidden{max-height:140px;overflow:hidden;position:relative;cursor:pointer}:host .hemfixarna_description--hidden::after{content:\"\";position:absolute;bottom:0;left:0;right:0;height:128px;background:linear-gradient(180deg, rgba(255, 253, 250, 0), rgba(255, 253, 250, 0.46) 50%, #fffaf2)}:host .hemfixarna_terms{font-size:14px}:host .hemfixarna_terms a{color:inherit}:host .hemfixarna_logo{height:64px}:host .hemfixarna_box{padding:16px;display:flex;align-items:center;width:100%;box-sizing:border-box;border-radius:4px;gap:16px 8px;border-radius:4px;gap:16px 8px}:host .hemfixarna_box p,:host .hemfixarna_box span{font-size:15px}:host .hemfixarna_box .underline{text-decoration:underline;text-underline-offset:2px}:host .hemfixarna_box .pointer{cursor:pointer}:host .hemfixarna_box .p-s{font-size:12px}:host .hemfixarna_box>div{display:grid;gap:8px}:host .hemfixarna_box--standard{background:#fffaf2;border:1px solid #fcd9c9}:host .hemfixarna_box--alternative,:host .hemfixarna_box--alternative_2,:host .hemfixarna_box--alternative_3{background:transparent;border:1px solid #e3e3e3}:host .hemfixarna_box--alternative_2,:host .hemfixarna_box--alternative_3{box-shadow:0px 2px 16px 0px rgba(0, 0, 0, 0.0784313725)}:host .hemfixarna_box--alternative_3{justify-content:center}:host .hemfixarna_altbtn{display:flex !important;flex-direction:column;gap:8px;align-items:center;margin-left:auto}:host .hemfixarna_btn{margin-left:auto}:host .hemfixarna_btn,:host .hemfixarna_buy,:host .hemfixarna input[type=submit]{border:none;border-radius:60px;font-weight:600;letter-spacing:0.5px;line-height:20px;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_btn:not(.disabled):hover,:host .hemfixarna_buy:not(.disabled):hover,:host .hemfixarna input[type=submit]:not(.disabled):hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna div:has(>input[type=submit]){position:relative}:host .hemfixarna div:has(>input[type=submit]) input{cursor:initial}:host .hemfixarna div:has(>input[type=submit]) img{display:none}:host .hemfixarna .loading{cursor:default;opacity:0.6}:host .hemfixarna .loading>img{display:initial !important;position:absolute;top:50%;left:50%;transform:translate(-50%, -50%)}:host .hemfixarna_btn{font-size:14px;background:#c84e18;color:#fff;padding:16px 24px;white-space:nowrap;position:relative}:host .hemfixarna_btn span{position:absolute;background:#fff;border-radius:100%;width:24px;height:24px;display:flex;justify-content:center;align-items:center;font-weight:600;font-size:13px;line-height:11px;top:-8px;right:-12px}:host .hemfixarna_btn span{background:#25a710;color:#fff;right:0 !important}:host .hemfixarna_buy,:host .hemfixarna input[type=submit]{font-size:21px;background:#25a710;color:#fff;padding:16px 24px}:host .hemfixarna .disabled{opacity:0.5;cursor:default}:host .hemfixarna_modal{position:fixed;background:#fffaf2;border:1px solid #fcd9c9;border-radius:4px;top:50%;left:50%;z-index:1000;transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);transform:translate(-50%, -50%) scale(0.7);opacity:0;height:92%;width:92%;max-width:920px;display:flex;flex-direction:column;gap:8px}:host .hemfixarna_modal--open{opacity:1;transform:translate(-50%, -50%) scale(1)}:host .hemfixarna_backdrop{z-index:999;position:fixed;background:#474444;top:0;left:0;bottom:0;right:0;opacity:0;transition:transform 0.1s cubic-bezier(0.465, 0.183, 0.153, 0.946), opacity 0.1s cubic-bezier(0.465, 0.183, 0.153, 0.946)}:host .hemfixarna_backdrop--open{opacity:0.3}:host .hemfixarna_order{position:absolute;top:-1px;left:-1px;right:-1px;bottom:-1px;background-repeat:no-repeat !important;background-size:cover !important;background-position:center !important;display:grid;grid-template-columns:1fr 1fr;padding:48px 32px 64px}@media (max-width: 768px){:host .hemfixarna_order{grid-template-columns:1fr;grid-template-rows:0 auto}}:host .hemfixarna_order>div:last-of-type{background:#fffaf2;padding:32px;display:flex;flex-direction:column;max-height:100%;overflow:auto}:host .hemfixarna_order img{cursor:pointer}:host .hemfixarna_order button{margin:16px 0;padding:0;text-decoration:underline;text-underline-offset:2px;font-size:14px;font-weight:600}:host .hemfixarna_cart{display:grid;grid-template-columns:1fr 1fr;gap:32px}@media (max-width: 768px){:host .hemfixarna_cart{grid-template-columns:1fr;gap:0}}:host .hemfixarna_cart--right h2,:host .hemfixarna_cart--left h2{display:flex;align-items:center}:host .hemfixarna_cart--right h2 img,:host .hemfixarna_cart--left h2 img{margin-top:3.2px}@media (min-width: 769px){:host .hemfixarna_cart--left h2 button{display:none}}@media (max-width: 768px){:host .hemfixarna_cart--right h2 button{display:none}}:host .hemfixarna_cart--startfee{display:flex;justify-content:space-between}:host .hemfixarna_cart--rutrot{display:flex;justify-content:space-between}:host .hemfixarna_cart--rutrot div{display:flex;gap:16px;align-items:center}:host .hemfixarna_cart--additional{display:flex;flex-direction:column;gap:16px;padding:16px;border-top:1px solid #fcd9c9}:host .hemfixarna_cart--additional p{font-size:14px}:host .hemfixarna_cart--additional strong{text-decoration:underline;text-underline-offset:2px;cursor:pointer;position:relative}:host .hemfixarna_cart--additional strong img{position:absolute;top:50%;transform:translateY(-50%);right:-24px}:host .hemfixarna_cart--price{border-top:1px solid #fcd9c9;padding:16px;display:flex;justify-content:space-between}:host .hemfixarna_cart--price h3{margin:0}:host .hemfixarna_cart--item{display:flex;flex-direction:column;gap:8px;padding:16px 0;border-top:1px solid #fcd9c9}:host .hemfixarna_cart--item>div{display:flex;justify-content:space-between}:host .hemfixarna_cart--item>div>div{display:flex;align-items:center;gap:16px}:host .hemfixarna_cart--item>div button{color:#ec6632}:host .hemfixarna_categories{display:grid;gap:24px}:host .hemfixarna_categories--wrapper{gap:32px;display:grid;grid-template-columns:1fr 1fr}@media (max-width: 768px){:host .hemfixarna_categories--wrapper{grid-template-columns:1fr}}:host .hemfixarna_categories li{position:relative;background:#fff;border-radius:4px;min-height:132px;padding:24px;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);display:flex;align-items:center;gap:24px;cursor:pointer}:host .hemfixarna_categories li:hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_categories li>button{height:100%;width:100%}:host .hemfixarna_categories li .price{font-weight:700}:host .hemfixarna_content{height:100%;overflow:auto;padding:0 32px 64px}:host .hemfixarna_content--5{padding-top:16px}:host .hemfixarna_crumbs{position:relative;padding:16px 24px;border-bottom:1px solid #fcd9c9;display:flex;justify-content:space-between}:host .hemfixarna_crumbs--back{padding:16px 24px 8px;display:flex;align-items:center;gap:8px;box-shadow:none !important}:host .hemfixarna_crumbs--back:hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_crumbs img{cursor:pointer}:host .hemfixarna_crumbs .close{position:absolute;right:-16px;top:-16px;z-index:9}:host .hemfixarna_crumbs .cart{padding-left:16px;position:relative}:host .hemfixarna_crumbs .cart img{cursor:inherit}:host .hemfixarna_crumbs .cart span{position:absolute;background:#fff;border-radius:100%;width:24px;height:24px;display:flex;justify-content:center;align-items:center;font-weight:600;font-size:13px;line-height:11px;top:-8px;right:-12px}:host .hemfixarna_crumbs .cart_active{cursor:pointer}:host .hemfixarna_crumbs .cart_active span{background:#25a710;color:#fff}:host .hemfixarna_crumbs--links{display:flex;align-items:center;gap:16px;overflow:auto}@media (min-width: 769px){:host .hemfixarna_crumbs--links{-ms-overflow-style:none}:host .hemfixarna_crumbs--links::-webkit-scrollbar{display:none}:host .hemfixarna_crumbs--links::-webkit-scrollbar-button{display:none}}:host .hemfixarna_crumbs button{white-space:nowrap;background:#f1ded6;border-radius:64px;padding:12px 16px;font-size:12px;font-weight:600;letter-spacing:0.3px;box-shadow:none !important}:host .hemfixarna_crumbs button:not(.active):hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_crumbs .active{background:#fffaf2;cursor:default}:host .hemfixarna_features{gap:12px !important}:host .hemfixarna_features li{display:flex;gap:16px;align-items:center}:host .hemfixarna_address{margin-bottom:16px}:host .hemfixarna_product{display:grid;gap:16px}:host .hemfixarna_product--link{font-weight:700;color:#474444;text-underline-offset:4px}:host .hemfixarna_product--left{gap:32px}:host .hemfixarna_product--right{gap:32px}:host .hemfixarna_product--price{margin-top:4px;font-weight:700}:host .hemfixarna_product--total{text-align:center;margin:-16px 0;font-size:21px;line-height:28px}:host .hemfixarna_product--item{background:#fff;padding:16px;display:grid;grid-template-columns:auto 75px;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_product--grid{display:grid;grid-template-columns:1fr 1fr;gap:32px}@media (max-width: 768px){:host .hemfixarna_product--grid{grid-template-columns:1fr}}:host .hemfixarna_product--grid>div{display:flex;flex-direction:column}:host .hemfixarna_product--grid ul{display:flex;flex-direction:column;gap:4px}:host .hemfixarna_product p{margin:0}:host .hemfixarna_product--top{display:flex;gap:32px}:host .hemfixarna_product--top>div{width:100%}:host .hemfixarna_product--top>div h1{max-width:80%}@media (max-width: 768px){:host .hemfixarna_product--top>div h1{max-width:100%}}:host .hemfixarna_product--top h4{margin-bottom:8px}:host h5,:host p{margin:0}:host input[type=submit]{cursor:pointer}:host input[type=date]~label{left:56px}:host input[type=date]{border:1px solid #fcd9c9;padding-left:64px}:host input[type=checkbox]{height:18px;width:18px;border:1px solid #fcd9c9}:host input[type=checkbox]:checked{background:red}:host input[type=date]::-webkit-calendar-picker-indicator{background:transparent;bottom:0;color:transparent;cursor:pointer;height:auto;left:0;position:absolute;right:0;top:0;width:auto}:host button,:host a{cursor:pointer;background:none;border:none}:host ul{list-style:none;margin:0;padding:0}";
812
+ const hemfixarnaCss = "@import url(\"https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap\"); *{box-sizing:border-box}:host{font-family:\"Inter\", sans-serif}:host .mb-2{margin-bottom:32px}:host button{color:#474444}:host form{display:flex;flex-direction:column;gap:16px}:host form img{position:absolute;top:50%;transform:translateY(-50%);pointer-events:none}:host form img:first-of-type{left:16px}:host form img:last-of-type{right:16px}:host form span{margin-top:-8px;color:#ec6632}:host form p{text-align:center}:host form p{margin:0}:host form div{position:relative}:host form div label{pointer-events:none;position:absolute;left:16px;top:50%;transform:translateY(-50%);background:#fff;padding:4px;transition:0.2s all cubic-bezier(0.465, 0.183, 0.153, 0.946)}:host form div input{padding:16px;width:100%;font-size:16px;border:1px solid #fcd9c9}:host form div input:focus~label,:host form div .input_active~label{top:0;transform:translateY(-50%);background:linear-gradient(180deg, #fffaf2 50%, #fff 50%)}:host h1{font-size:24px;font-weight:400;line-height:32px;letter-spacing:-3%;text-align:left;margin:0 0 8px}:host h2{margin:0 0 24px;font-weight:700;font-size:20px;line-height:28px;letter-spacing:-3%}:host p{font-size:16px;font-weight:400;line-height:24px;letter-spacing:-3%}:host .hemfixarna{width:100%;}:host .hemfixarna_nav{position:absolute;top:0;width:100dvw;left:0;height:80px;z-index:9999}:host .hemfixarna_nav--links{display:none !important}@media (min-width: 769px){:host .hemfixarna_nav--links{display:flex !important}}:host .hemfixarna_nav--links a{color:#ec6632;text-decoration:none;border:1px solid rgba(255, 255, 255, 0.3);border-radius:56px;padding:8px 32px;text-transform:capitalize}:host .hemfixarna_nav>div{position:relative;overflow:hidden;width:100%;height:100%;display:flex;justify-content:space-between;align-items:center;padding:0 16px}@media (min-width: 769px){:host .hemfixarna_nav>div{padding:0 32px}}:host .hemfixarna_nav>div>div{display:flex;gap:32px;justify-content:space-between}:host .hemfixarna_nav>div>img{position:absolute;width:100%;height:100%;top:0;left:0;z-index:-1}:host .hemfixarna_nav p{color:#fff}:host .hemfixarna_standalone .hemfixarna_backdrop{background:#fffaf2;opacity:1}:host .hemfixarna_standalone .hemfixarna_modal{top:80px;transform:translateX(-50%);border:none;height:calc(100dvh - 80px);opacity:0}:host .hemfixarna_standalone .hemfixarna_modal--open{opacity:1}:host .hemfixarna .switch{position:relative;display:inline-block;width:40px;height:20px}:host .hemfixarna .switch input{opacity:0;width:0;height:0}:host .hemfixarna .slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:#ccc;-webkit-transition:0.4s;transition:0.4s;border-radius:34px}:host .hemfixarna .slider:before{position:absolute;content:\"\";height:18px;width:18px;left:2px;bottom:1px;background-color:white;-webkit-transition:0.4s;transition:0.4s;border-radius:50%}:host .hemfixarna input:checked+.slider{background-color:#fcd9c9}:host .hemfixarna input:focus+.slider{box-shadow:0 0 1px #fcd9c9}:host .hemfixarna input:checked+.slider:before{-webkit-transform:translateX(18px);-ms-transform:translateX(18px);transform:translateX(18px);background:#ec6632}:host .hemfixarna_checkbox{display:grid;grid-template-columns:40px auto;font-size:16px;font-weight:400;line-height:24px;letter-spacing:-3%}:host .hemfixarna_checkbox>span{transform:translateY(6px)}:host .hemfixarna_checkbox span,:host .hemfixarna_checkbox span p{color:#474444;font-size:14px}:host .hemfixarna_checkbox p{text-align:left}:host .hemfixarna_info{display:flex;flex-direction:column;gap:24px;padding:32px;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);border-radius:4px;border:1px solid #fcd9c9}:host .hemfixarna_info h2{margin:0}@media (min-width: 769px){:host .hemfixarna_info{position:sticky;top:0}}:host .hemfixarna_infomodal{position:absolute;top:40%;left:50%;transform:translate(-50%, -50%);width:100%;max-width:80%;background:#fffaf2;border:1px solid #fcd9c9;padding:32px;z-index:99;border-radius:4px;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);display:flex;flex-direction:column;gap:16px}:host .hemfixarna_infomodal p,:host .hemfixarna_infomodal h4{margin:0}:host .hemfixarna_infomodal button{background:#ec6632;color:#fff;border-radius:60px;font-size:16px;padding:8px 16px}:host .hemfixarna_addressinfo{padding:16px 16px 64px;border:1px solid #fcd9c9;position:relative;margin-bottom:32px;display:grid;grid-template-columns:1fr;gap:8px}@media (min-width: 769px){:host .hemfixarna_addressinfo{grid-template-columns:1fr 1fr}}:host .hemfixarna_addressinfo button{position:absolute;bottom:16px;right:16px;font-weight:500;text-underline-offset:2px;text-decoration:underline}:host .hemfixarna_part{background:#fff;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);display:grid;padding:16px;grid-template-columns:auto 75px}:host .hemfixarna_counter{display:flex;align-items:center}:host .hemfixarna_counter span{padding:0 8px}:host .hemfixarna_counter img{cursor:pointer}:host .hemfixarna_counter img:not(.disabled):hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_description{display:grid;gap:16px}:host .hemfixarna_description ul{list-style:disc;padding-right:12px;transform:translateX(12px)}:host .hemfixarna_description--hidden{max-height:140px;overflow:hidden;position:relative;cursor:pointer}:host .hemfixarna_description--hidden::after{content:\"\";position:absolute;bottom:0;left:0;right:0;height:128px;background:linear-gradient(180deg, rgba(255, 253, 250, 0), rgba(255, 253, 250, 0.46) 50%, #fffaf2)}:host .hemfixarna_terms{font-size:14px}:host .hemfixarna_terms a{color:inherit}:host .hemfixarna_logo{height:64px}:host .hemfixarna_box{padding:16px;display:flex;align-items:center;width:100%;box-sizing:border-box;border-radius:4px;gap:16px 8px;border-radius:4px;gap:16px 8px}:host .hemfixarna_box p,:host .hemfixarna_box span{font-size:15px}:host .hemfixarna_box .underline{text-decoration:underline;text-underline-offset:2px}:host .hemfixarna_box .pointer{cursor:pointer}:host .hemfixarna_box .p-s{font-size:12px}:host .hemfixarna_box>div{display:grid;gap:8px}:host .hemfixarna_box--standard{background:#fffaf2;border:1px solid #fcd9c9}:host .hemfixarna_box--alternative,:host .hemfixarna_box--alternative_2,:host .hemfixarna_box--alternative_3{background:transparent;border:1px solid #e3e3e3}:host .hemfixarna_box--alternative_2,:host .hemfixarna_box--alternative_3{box-shadow:0px 2px 16px 0px rgba(0, 0, 0, 0.0784313725)}:host .hemfixarna_box--alternative_3{justify-content:center}:host .hemfixarna_altbtn{display:flex !important;flex-direction:column;gap:8px;align-items:center;margin-left:auto}:host .hemfixarna_btn{margin-left:auto}:host .hemfixarna_btn,:host .hemfixarna_buy,:host .hemfixarna input[type=submit]{border:none;border-radius:60px;font-weight:600;letter-spacing:0.5px;line-height:20px;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_btn:not(.disabled):hover,:host .hemfixarna_buy:not(.disabled):hover,:host .hemfixarna input[type=submit]:not(.disabled):hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna div:has(>input[type=submit]){position:relative}:host .hemfixarna div:has(>input[type=submit]) input{cursor:pointer}:host .hemfixarna div:has(>input[type=submit]) img{display:none}:host .hemfixarna .loading{cursor:default;opacity:0.6}:host .hemfixarna .loading>img{display:initial !important;position:absolute;top:50%;left:50%;transform:translate(-50%, -50%)}:host .hemfixarna_btn{font-size:14px;background:#c84e18;color:#fff;padding:16px 24px;white-space:nowrap;position:relative}:host .hemfixarna_btn span{position:absolute;background:#fff;border-radius:100%;width:24px;height:24px;display:flex;justify-content:center;align-items:center;font-weight:600;font-size:13px;line-height:11px;top:-8px;right:-12px}:host .hemfixarna_btn span{background:#25a710;color:#fff;right:0 !important}:host .hemfixarna_buy,:host .hemfixarna input[type=submit]{font-size:21px;background:#25a710;color:#fff;padding:16px 24px}:host .hemfixarna .disabled{opacity:0.5;cursor:default}:host .hemfixarna_modal{position:fixed;background:#fffaf2;border:1px solid #fcd9c9;border-radius:4px;top:50%;left:50%;z-index:1000;transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);transform:translate(-50%, -50%) scale(0.7);opacity:0;height:92%;width:92%;max-width:920px;display:flex;flex-direction:column;gap:8px}:host .hemfixarna_modal--open{opacity:1;transform:translate(-50%, -50%) scale(1)}:host .hemfixarna_backdrop{z-index:999;position:fixed;background:#474444;top:0;left:0;bottom:0;right:0;opacity:0;transition:transform 0.1s cubic-bezier(0.465, 0.183, 0.153, 0.946), opacity 0.1s cubic-bezier(0.465, 0.183, 0.153, 0.946)}:host .hemfixarna_backdrop--open{opacity:0.3}:host .hemfixarna_order{position:absolute;top:-1px;left:-1px;right:-1px;bottom:-1px;background-repeat:no-repeat !important;background-size:cover !important;background-position:center !important;display:grid;grid-template-columns:1fr 1fr;padding:48px 32px 64px}@media (max-width: 768px){:host .hemfixarna_order{grid-template-columns:1fr;grid-template-rows:0 auto}}:host .hemfixarna_order>div:last-of-type{background:#fffaf2;padding:32px;display:flex;flex-direction:column;max-height:100%;overflow:auto}:host .hemfixarna_order img{cursor:pointer}:host .hemfixarna_order button{margin:16px 0;padding:0;text-decoration:underline;text-underline-offset:2px;font-size:14px;font-weight:600}:host .hemfixarna_cart{display:grid;grid-template-columns:1fr 1fr;gap:32px}@media (max-width: 768px){:host .hemfixarna_cart{grid-template-columns:1fr;gap:0}}:host .hemfixarna_cart--right h2,:host .hemfixarna_cart--left h2{display:flex;align-items:center}:host .hemfixarna_cart--right h2 img,:host .hemfixarna_cart--left h2 img{margin-top:3.2px}@media (min-width: 769px){:host .hemfixarna_cart--left h2 button{display:none}}@media (max-width: 768px){:host .hemfixarna_cart--right h2 button{display:none}}:host .hemfixarna_cart--startfee{display:flex;justify-content:space-between}:host .hemfixarna_cart--rutrot{display:flex;justify-content:space-between}:host .hemfixarna_cart--rutrot div{display:flex;gap:16px;align-items:center}:host .hemfixarna_cart--additional{display:flex;flex-direction:column;gap:16px;padding:16px;border-top:1px solid #fcd9c9}:host .hemfixarna_cart--additional p{font-size:14px}:host .hemfixarna_cart--additional strong{text-decoration:underline;text-underline-offset:2px;cursor:pointer;position:relative}:host .hemfixarna_cart--additional strong img{position:absolute;top:50%;transform:translateY(-50%);right:-24px}:host .hemfixarna_cart--price{border-top:1px solid #fcd9c9;padding:16px;display:flex;justify-content:space-between}:host .hemfixarna_cart--price h3{margin:0}:host .hemfixarna_cart--item{display:flex;flex-direction:column;gap:8px;padding:16px 0;border-top:1px solid #fcd9c9}:host .hemfixarna_cart--item>div{display:flex;justify-content:space-between}:host .hemfixarna_cart--item>div>div{display:flex;align-items:center;gap:16px}:host .hemfixarna_cart--item>div button{color:#ec6632}:host .hemfixarna_categories{display:grid;gap:24px}:host .hemfixarna_categories--wrapper{gap:32px;display:grid;grid-template-columns:1fr 1fr}@media (max-width: 768px){:host .hemfixarna_categories--wrapper{grid-template-columns:1fr}}:host .hemfixarna_categories li{position:relative;background:#fff;border-radius:4px;min-height:132px;padding:24px;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);display:flex;align-items:center;gap:24px;cursor:pointer}:host .hemfixarna_categories li:hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_categories li>button{height:100%;width:100%}:host .hemfixarna_categories li .price{font-weight:700}:host .hemfixarna_content{height:100%;overflow:auto;padding:0 32px 64px}:host .hemfixarna_content--5{padding-top:16px}:host .hemfixarna_crumbs{position:relative;padding:16px 24px;border-bottom:1px solid #fcd9c9;display:flex;justify-content:space-between}:host .hemfixarna_crumbs--back{padding:16px 24px 8px;display:flex;align-items:center;gap:8px;box-shadow:none !important}:host .hemfixarna_crumbs--back:hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_crumbs img{cursor:pointer}:host .hemfixarna_crumbs .close{position:absolute;right:-16px;top:-16px;z-index:9}:host .hemfixarna_crumbs .cart{padding-left:16px;position:relative}:host .hemfixarna_crumbs .cart img{cursor:inherit}:host .hemfixarna_crumbs .cart span{position:absolute;background:#fff;border-radius:100%;width:24px;height:24px;display:flex;justify-content:center;align-items:center;font-weight:600;font-size:13px;line-height:11px;top:-8px;right:-12px}:host .hemfixarna_crumbs .cart_active{cursor:pointer}:host .hemfixarna_crumbs .cart_active span{background:#25a710;color:#fff}:host .hemfixarna_crumbs--links{display:flex;align-items:center;gap:16px;overflow:auto}@media (min-width: 769px){:host .hemfixarna_crumbs--links{-ms-overflow-style:none}:host .hemfixarna_crumbs--links::-webkit-scrollbar{display:none}:host .hemfixarna_crumbs--links::-webkit-scrollbar-button{display:none}}:host .hemfixarna_crumbs button{white-space:nowrap;background:#f1ded6;border-radius:64px;padding:12px 16px;font-size:12px;font-weight:600;letter-spacing:0.3px;box-shadow:none !important}:host .hemfixarna_crumbs button:not(.active):hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_crumbs .active{background:#fffaf2;cursor:default}:host .hemfixarna_features{gap:12px !important}:host .hemfixarna_features li{display:flex;gap:16px;align-items:center}:host .hemfixarna_address{margin-bottom:16px}:host .hemfixarna_product{display:grid;gap:16px}:host .hemfixarna_product--link{font-weight:700;color:#474444;text-underline-offset:4px}:host .hemfixarna_product--left{gap:32px}:host .hemfixarna_product--right{gap:32px}:host .hemfixarna_product--price{margin-top:4px;font-weight:700}:host .hemfixarna_product--total{text-align:center;margin:-16px 0;font-size:21px;line-height:28px}:host .hemfixarna_product--item{background:#fff;padding:16px;display:grid;grid-template-columns:auto 75px;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_product--grid{display:grid;grid-template-columns:1fr 1fr;gap:32px}@media (max-width: 768px){:host .hemfixarna_product--grid{grid-template-columns:1fr}}:host .hemfixarna_product--grid>div{display:flex;flex-direction:column}:host .hemfixarna_product--grid ul{display:flex;flex-direction:column;gap:4px}:host .hemfixarna_product p{margin:0}:host .hemfixarna_product--top{display:flex;gap:32px}:host .hemfixarna_product--top>div{width:100%}:host .hemfixarna_product--top>div h1{max-width:80%}@media (max-width: 768px){:host .hemfixarna_product--top>div h1{max-width:100%}}:host .hemfixarna_product--top h4{margin-bottom:8px}:host h5,:host p{margin:0}:host input[type=submit]{cursor:pointer}:host input[type=date]~label{left:56px}:host input[type=date]{border:1px solid #fcd9c9;padding-left:64px}:host input[type=checkbox]{height:18px;width:18px;border:1px solid #fcd9c9}:host input[type=checkbox]:checked{background:red}:host input[type=date]::-webkit-calendar-picker-indicator{background:transparent;bottom:0;color:transparent;cursor:pointer;height:auto;left:0;position:absolute;right:0;top:0;width:auto}:host button,:host a{cursor:pointer;background:none;border:none}:host ul{list-style:none;margin:0;padding:0}";
813
813
 
814
814
  const HemfixarnaComponent = class {
815
815
  constructor(hostRef) {
@@ -1858,7 +1858,7 @@ const HemfixarnaGetuser = class {
1858
1858
  }
1859
1859
  };
1860
1860
  this.render = () => {
1861
- return (index.h("form", { class: "mb-2", onSubmit: e => this.handleSubmit(e) }, index.h("div", null, index.h("input", { class: `${this.email.length ? 'input_active' : ''}`, onChange: e => this.handleChangeEmail(e), type: "email", name: "email", value: this.email }), index.h("label", { htmlFor: "email" }, "E-post ")), this.emailError && index.h("span", null, this.emailError), index.h("div", null, index.h("input", { class: `${this.phone.length ? 'input_active' : ''}`, onChange: e => this.handleChangePhone(e), type: "tel", name: "phone", value: this.phone }), index.h("label", { htmlFor: "phone" }, "Mobiltelefon ")), this.phoneError && index.h("span", null, this.phoneError), index.h("div", null, index.h("input", { class: `${this.ssn.length ? 'input_active' : ''}`, onChange: e => this.handleChangessn(e), type: "tel", name: "ssn", value: this.ssn }), index.h("label", { htmlFor: "phone" }, "Personnummer*")), this.ssnError && index.h("span", null, this.ssnError), index.h("input", { type: "submit", value: "Forts\u00E4tt och Boka*" }), index.h("p", null, "*Vi h\u00E4mtar din adress")));
1861
+ return (index.h("form", { class: "mb-2", onSubmit: e => this.handleSubmit(e) }, index.h("div", null, index.h("input", { class: `${this.email.length ? 'input_active' : ''}`, onChange: e => this.handleChangeEmail(e), type: "email", name: "email", value: this.email }), index.h("label", { htmlFor: "email" }, "E-post ")), this.emailError && index.h("span", null, this.emailError), index.h("div", null, index.h("input", { class: `${this.phone.length ? 'input_active' : ''}`, onChange: e => this.handleChangePhone(e), type: "tel", name: "phone", value: this.phone }), index.h("label", { htmlFor: "phone" }, "Mobiltelefon ")), this.phoneError && index.h("span", null, this.phoneError), index.h("div", null, index.h("input", { class: `${this.ssn.length ? 'input_active' : ''}`, onChange: e => this.handleChangessn(e), type: "tel", name: "ssn", value: this.ssn }), index.h("label", { htmlFor: "phone" }, "Personnummer*")), this.ssnError && index.h("span", null, this.ssnError), index.h("input", { type: "submit", value: "Forts\u00E4tt*" }), index.h("p", null, "*Vi h\u00E4mtar din adress")));
1862
1862
  };
1863
1863
  this.email = '';
1864
1864
  this.emailError = null;
@@ -2028,7 +2028,6 @@ const HemfixarnaProduct = class {
2028
2028
  name: state.selectedProduct.post_title,
2029
2029
  start_fee: !state.selectedProduct.hide_start_fee,
2030
2030
  terms_checkout: state.selectedProduct.terms_checkout,
2031
- terms_show_checkbox: state.selectedProduct.terms_show_checkbox,
2032
2031
  icon: state.selectedProduct.icon,
2033
2032
  },
2034
2033
  ];
@@ -2118,7 +2117,7 @@ const HemfixarnaProduct = class {
2118
2117
  state.selectedProduct.parts.map(p => {
2119
2118
  var _a;
2120
2119
  return (index.h("li", { class: "hemfixarna_part" }, index.h("div", null, index.h("p", null, (_a = p.title) !== null && _a !== void 0 ? _a : p.post_title), index.h("p", { class: "hemfixarna_product--price" }, getPartPrice(p, state.selectedProduct), "kr/st")), index.h("div", { class: "hemfixarna_counter" }, index.h("img", { class: `${this.getPartAmount(p.ID) === 0 ? 'disabled' : ''}`, src: minus, onClick: () => this.removePart(p) }), index.h("span", null, this.getPartAmount(p.ID)), index.h("img", { class: `${this.getAmount() === 0 ? 'disabled' : ''}`, src: plus, onClick: () => this.addPart(p) }))));
2121
- })), index.h("h4", { class: "hemfixarna_product--total" }, "Totalt ", this.getTotalPrice(), " kr"), index.h("button", { onClick: () => this.goToCart(), class: `hemfixarna_buy ${this.getAmount() === 0 ? 'disabled' : ''}` }, "Boka"), !state.selectedProduct.hide_start_fee && (state.selectedProduct.rot || state.selectedProduct.rut) && state.rutOptions && state.rotOptions && (index.h("p", { class: "hemfixarna_terms" }, index.h("strong", null, state.selectedProduct.rot ? state.rotOptions.rot_start_fee_heading : state.rutOptions.rut_start_fee_heading), index.h("br", null), index.h("span", { innerHTML: state.selectedProduct.rot ? state.rotOptions.rot_start_fee_text : state.rutOptions.rut_start_fee_text }))), state.options && index.h("hemfixarna-info", { list: state.options.trust })))));
2120
+ })), index.h("h4", { class: "hemfixarna_product--total" }, "Totalt ", this.getTotalPrice(), " kr"), index.h("button", { onClick: () => this.goToCart(), class: `hemfixarna_buy ${this.getAmount() === 0 ? 'disabled' : ''}` }, "Forts\u00E4tt"), !state.selectedProduct.hide_start_fee && (state.selectedProduct.rot || state.selectedProduct.rut) && state.rutOptions && state.rotOptions && (index.h("p", { class: "hemfixarna_terms" }, index.h("strong", null, state.selectedProduct.rot ? state.rotOptions.rot_start_fee_heading : state.rutOptions.rut_start_fee_heading), index.h("br", null), index.h("span", { innerHTML: state.selectedProduct.rot ? state.rotOptions.rot_start_fee_text : state.rutOptions.rut_start_fee_text }))), state.options && index.h("hemfixarna-info", { list: state.options.trust })))));
2122
2121
  }
2123
2122
  get el() { return index.getElement(this); }
2124
2123
  };
@@ -1 +1 @@
1
- {"file":"hemfixarna-address.hemfixarna-box.hemfixarna-breadcrumbs.hemfixarna-byggmax.hemfixarna-cart.hemfixarna-category.hemfixarna-checkout.hemfixarna-component.hemfixarna-demo.hemfixarna-getuser.hemfixarna-hornbach.hemfixarna-info.hemfixarna-kund.hemfixarna-order.hemfixarna-orderrows.hemfixarna-product.hemfixarna-service.hemfixarna-skanska.hemfixarna-start.hemfixarna-string-furniture.entry.cjs.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
1
+ {"file":"hemfixarna-address.hemfixarna-box.hemfixarna-breadcrumbs.hemfixarna-byggmax.hemfixarna-cart.hemfixarna-category.hemfixarna-checkout.hemfixarna-component.hemfixarna-demo.hemfixarna-getuser.hemfixarna-hornbach.hemfixarna-info.hemfixarna-kund.hemfixarna-order.hemfixarna-orderrows.hemfixarna-product.hemfixarna-service.hemfixarna-skanska.hemfixarna-start.hemfixarna-string-furniture.entry.cjs.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
@@ -43,7 +43,7 @@ export class HemfixarnaAddress {
43
43
  this.town = this.town === state.user.town ? '' : e.target.value;
44
44
  };
45
45
  this.render = () => {
46
- return (h("form", { class: "hemfixarna_address", onSubmit: e => this.handleSubmit(e) }, h("div", null, h("input", { class: `${this.street.length ? 'input_active' : ''}`, onInput: this.handleChangeStreet, type: "text", name: "street", value: this.street === state.user.street ? hideField(this.street) : this.street }), h("label", { htmlFor: "street" }, "Gatuaddress ")), this.streetError && h("span", null, this.streetError), h("div", null, h("input", { class: `${this.zip.length ? 'input_active' : ''}`, onInput: this.handleChangeZip, type: "tel", name: "zip", value: this.zip === state.user.zip ? hideField(this.zip) : this.zip }), h("label", { htmlFor: "zip" }, "Postnummer ")), this.zipError && h("span", null, this.zipError), h("div", null, h("input", { class: `${this.town.length ? 'input_active' : ''}`, onInput: this.handleChangeTown, type: "text", name: "town", value: this.town === state.user.town ? hideField(this.town) : this.town }), h("label", { htmlFor: "town" }, "Ort ")), this.townError && h("span", null, this.townError), h("input", { type: "submit", value: "Forts\u00E4tt och Boka" })));
46
+ return (h("form", { class: "hemfixarna_address", onSubmit: e => this.handleSubmit(e) }, h("div", null, h("input", { class: `${this.street.length ? 'input_active' : ''}`, onInput: this.handleChangeStreet, type: "text", name: "street", value: this.street === state.user.street ? hideField(this.street) : this.street }), h("label", { htmlFor: "street" }, "Gatuaddress ")), this.streetError && h("span", null, this.streetError), h("div", null, h("input", { class: `${this.zip.length ? 'input_active' : ''}`, onInput: this.handleChangeZip, type: "tel", name: "zip", value: this.zip === state.user.zip ? hideField(this.zip) : this.zip }), h("label", { htmlFor: "zip" }, "Postnummer ")), this.zipError && h("span", null, this.zipError), h("div", null, h("input", { class: `${this.town.length ? 'input_active' : ''}`, onInput: this.handleChangeTown, type: "text", name: "town", value: this.town === state.user.town ? hideField(this.town) : this.town }), h("label", { htmlFor: "town" }, "Ort ")), this.townError && h("span", null, this.townError), h("input", { type: "submit", value: "Forts\u00E4tt" })));
47
47
  };
48
48
  this.street = '';
49
49
  this.streetError = null;
@@ -1 +1 @@
1
- {"version":3,"file":"hemfixarna-address.js","sourceRoot":"","sources":["../../../src/components/hemfixarna-address/hemfixarna-address.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,KAAK,MAAM,aAAa,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAMjD,MAAM,OAAO,iBAAiB;;IAiB5B,iBAAY,GAAG,CAAC,CAAQ,EAAE,EAAE;MAC1B,CAAC,CAAC,cAAc,EAAE,CAAC;MACnB,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;MAC3C,IAAI,CAAC,WAAW,EAAE;QAChB,IAAI,CAAC,WAAW,GAAG,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CAAC;MAC1B,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;KAC7B;EACH,CAAC;;;;;;;;;;;CAoFF","sourcesContent":["import { Component, Element, State, h } from '@stencil/core';\nimport state from '../../store';\nimport { hideField } from '../../utils/form';\nimport { scrollToTop } from '../../utils/scroll';\n\n@Component({\n tag: 'hemfixarna-address',\n shadow: false,\n})\nexport class HemfixarnaAddress {\n @State() street: string = '';\n @State() streetError: string | null = null;\n @State() zip: string = '';\n @State() zipError: string | null = null;\n @State() town: string = '';\n @State() townError: string | null = null;\n @Element() private el: HTMLElement;\n\n componentWillLoad() {\n if (state.user) {\n this.street = state.user.street;\n this.zip = state.user.zip;\n this.town = state.user.town;\n }\n }\n\n handleSubmit = (e: Event) => {\n e.preventDefault();\n const streetValid = this.street.length > 0;\n if (!streetValid) {\n this.streetError = 'Ange en gatuadress';\n }\n const zipValid = this.zip.length > 0;\n const zipIsNumber = /^\\s*\\d[\\d\\s]*$/.test(this.zip);\n if (!zipIsNumber) {\n this.zipError = 'Postnummer får endast innehålla siffror';\n }\n if (!zipValid) {\n this.zipError = 'Ange ett postnummer';\n }\n const townValid = /^[^\\d\\s]{2,}$/.test(this.town);\n if (!townValid) {\n this.townError = 'Ange en ort';\n }\n if (streetValid && zipValid && townValid && zipIsNumber) {\n state.user = { ...state.user, street: this.street, zip: this.zip, town: this.town };\n state.checkoutStep = 2;\n state.checkoutEdit = false;\n const el = this.el.closest('.hemfixarna_content');\n scrollToTop(el);\n }\n };\n\n handleChangeStreet = (e: Event) => {\n this.streetError = null;\n this.street = this.street === state.user.street ? '' : (e.target as HTMLInputElement).value;\n };\n\n handleChangeZip = (e: Event) => {\n this.zipError = null;\n this.zip = this.zip === state.user.zip ? '' : (e.target as HTMLInputElement).value;\n };\n\n handleChangeTown = (e: Event) => {\n this.townError = null;\n this.town = this.town === state.user.town ? '' : (e.target as HTMLInputElement).value;\n };\n\n render = () => {\n return (\n <form class=\"hemfixarna_address\" onSubmit={e => this.handleSubmit(e)}>\n <div>\n <input\n class={`${this.street.length ? 'input_active' : ''}`}\n onInput={this.handleChangeStreet}\n type=\"text\"\n name=\"street\"\n value={this.street === state.user.street ? hideField(this.street) : this.street}\n />\n <label htmlFor=\"street\">Gatuaddress </label>\n </div>\n {this.streetError && <span>{this.streetError}</span>}\n <div>\n <input\n class={`${this.zip.length ? 'input_active' : ''}`}\n onInput={this.handleChangeZip}\n type=\"tel\"\n name=\"zip\"\n value={this.zip === state.user.zip ? hideField(this.zip) : this.zip}\n />\n <label htmlFor=\"zip\">Postnummer </label>\n </div>\n {this.zipError && <span>{this.zipError}</span>}\n <div>\n <input\n class={`${this.town.length ? 'input_active' : ''}`}\n onInput={this.handleChangeTown}\n type=\"text\"\n name=\"town\"\n value={this.town === state.user.town ? hideField(this.town) : this.town}\n />\n <label htmlFor=\"town\">Ort </label>\n </div>\n {this.townError && <span>{this.townError}</span>}\n <input type=\"submit\" value=\"Fortsätt och Boka\" />\n </form>\n );\n };\n}\n"]}
1
+ {"version":3,"file":"hemfixarna-address.js","sourceRoot":"","sources":["../../../src/components/hemfixarna-address/hemfixarna-address.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,KAAK,MAAM,aAAa,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAMjD,MAAM,OAAO,iBAAiB;;IAiB5B,iBAAY,GAAG,CAAC,CAAQ,EAAE,EAAE;MAC1B,CAAC,CAAC,cAAc,EAAE,CAAC;MACnB,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;MAC3C,IAAI,CAAC,WAAW,EAAE;QAChB,IAAI,CAAC,WAAW,GAAG,oBAAoB,CAAC;OACzC;MACD,MAAM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AG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;KAC7B;EACH,CAAC;;;;;;;;;;;CAoFF","sourcesContent":["import { Component, Element, State, h } from '@stencil/core';\nimport state from '../../store';\nimport { hideField } from '../../utils/form';\nimport { scrollToTop } from '../../utils/scroll';\n\n@Component({\n tag: 'hemfixarna-address',\n shadow: false,\n})\nexport class HemfixarnaAddress {\n @State() street: string = '';\n @State() streetError: string | null = null;\n @State() zip: string = '';\n @State() zipError: string | null = null;\n @State() town: string = '';\n @State() townError: string | null = null;\n @Element() private el: HTMLElement;\n\n componentWillLoad() {\n if (state.user) {\n this.street = state.user.street;\n this.zip = state.user.zip;\n this.town = state.user.town;\n }\n }\n\n handleSubmit = (e: Event) => {\n e.preventDefault();\n const streetValid = this.street.length > 0;\n if (!streetValid) {\n this.streetError = 'Ange en gatuadress';\n }\n const zipValid = this.zip.length > 0;\n const zipIsNumber = /^\\s*\\d[\\d\\s]*$/.test(this.zip);\n if (!zipIsNumber) {\n this.zipError = 'Postnummer får endast innehålla siffror';\n }\n if (!zipValid) {\n this.zipError = 'Ange ett postnummer';\n }\n const townValid = /^[^\\d\\s]{2,}$/.test(this.town);\n if (!townValid) {\n this.townError = 'Ange en ort';\n }\n if (streetValid && zipValid && townValid && zipIsNumber) {\n state.user = { ...state.user, street: this.street, zip: this.zip, town: this.town };\n state.checkoutStep = 2;\n state.checkoutEdit = false;\n const el = this.el.closest('.hemfixarna_content');\n scrollToTop(el);\n }\n };\n\n handleChangeStreet = (e: Event) => {\n this.streetError = null;\n this.street = this.street === state.user.street ? '' : (e.target as HTMLInputElement).value;\n };\n\n handleChangeZip = (e: Event) => {\n this.zipError = null;\n this.zip = this.zip === state.user.zip ? '' : (e.target as HTMLInputElement).value;\n };\n\n handleChangeTown = (e: Event) => {\n this.townError = null;\n this.town = this.town === state.user.town ? '' : (e.target as HTMLInputElement).value;\n };\n\n render = () => {\n return (\n <form class=\"hemfixarna_address\" onSubmit={e => this.handleSubmit(e)}>\n <div>\n <input\n class={`${this.street.length ? 'input_active' : ''}`}\n onInput={this.handleChangeStreet}\n type=\"text\"\n name=\"street\"\n value={this.street === state.user.street ? hideField(this.street) : this.street}\n />\n <label htmlFor=\"street\">Gatuaddress </label>\n </div>\n {this.streetError && <span>{this.streetError}</span>}\n <div>\n <input\n class={`${this.zip.length ? 'input_active' : ''}`}\n onInput={this.handleChangeZip}\n type=\"tel\"\n name=\"zip\"\n value={this.zip === state.user.zip ? hideField(this.zip) : this.zip}\n />\n <label htmlFor=\"zip\">Postnummer </label>\n </div>\n {this.zipError && <span>{this.zipError}</span>}\n <div>\n <input\n class={`${this.town.length ? 'input_active' : ''}`}\n onInput={this.handleChangeTown}\n type=\"text\"\n name=\"town\"\n value={this.town === state.user.town ? hideField(this.town) : this.town}\n />\n <label htmlFor=\"town\">Ort </label>\n </div>\n {this.townError && <span>{this.townError}</span>}\n <input type=\"submit\" value=\"Fortsätt\" />\n </form>\n );\n };\n}\n"]}
@@ -105,8 +105,8 @@ export class HemfixarnaCheckout {
105
105
  }
106
106
  else if (state.checkoutStep === 2) {
107
107
  return (h("div", { class: "mb-2" }, h("div", { class: "hemfixarna_addressinfo" }, h("div", null, h("p", null, hideField(state.user.firstName)), h("p", null, hideField(state.user.lastName)), h("p", null, state.user.email), h("p", null, state.user.phone)), h("div", null, h("p", null, hideField(state.user.street)), h("p", null, hideField(state.user.zip)), h("p", null, hideField(state.user.town))), h("button", { onClick: () => (state.checkoutEdit = true) }, "Beh\u00F6ver du \u00E4ndra adressen?")), h("form", { onSubmit: e => this.handleSubmit(e) }, h("div", null, h("img", { src: dateLogo, width: 24 }), h("input", { class: `${this.date.length ? 'input_active' : ''}`, min: new Date().toISOString().split('T')[0], onChange: e => this.handleChangeDate(e), type: "date", name: "date", value: this.date }), h("label", { htmlFor: "date" }, "Tidigaste datum f\u00F6r hembes\u00F6k"), h("img", { src: down, width: 24 })), this.dateError && h("span", null, this.dateError), h("label", { class: "hemfixarna_checkbox" }, h("input", { onChange: () => this.handleChangeTerms(), type: "checkbox" }), h("span", { innerHTML: state.options.terms })), state.cart
108
- .filter(i => i.terms_checkout && i.terms_show_checkbox)
109
- .map(item => (h(Fragment, null, h("label", { class: "hemfixarna_checkbox" }, h("input", { onChange: () => this.handleChangeTerms(), type: "checkbox" }), h("span", null, item.terms_checkout))))), this.generalError && h("span", null, this.generalError), h("div", { class: this.loading ? 'loading' : '' }, h("input", { type: "submit", value: this.loading ? '' : 'Slutför Bokning' }), h("img", { width: 20, height: 20, src: loading, alt: "spinner" })))));
108
+ .filter(i => { var _a; return (_a = i.terms_checkout) === null || _a === void 0 ? void 0 : _a.length; })
109
+ .map(item => (h(Fragment, null, h("label", { class: "hemfixarna_checkbox" }, h("input", { onChange: () => this.handleChangeTerms(), type: "checkbox" }), h("span", null, item.terms_checkout))))), this.generalError && h("span", null, this.generalError), h("div", { class: this.loading ? 'loading' : '' }, h("input", { type: "submit", value: this.loading ? '' : 'Skicka bokning' }), h("img", { width: 20, height: 20, src: loading, alt: "spinner" })))));
110
110
  }
111
111
  };
112
112
  this.date = '';
@@ -1 +1 @@
1
- {"version":3,"file":"hemfixarna-checkout.js","sourceRoot":"","sources":["../../../src/components/hemfixarna-checkout/hemfixarna-checkout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AACrF,OAAO,KAAK,MAAM,aAAa,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAc,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAMjD,MAAM,OAAO,kBAAkB;;IAO7B,qBAAgB,GAAG,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KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;MAC5C,KAAK,CAAC,YAAY,GAAG,CAAC,CAAC;KACxB;EACH,CAAC;;;;;;;;;CAmEF","sourcesContent":["import { Component, Element, Fragment, State, getAssetPath, h } from '@stencil/core';\nimport state from '../../store';\nimport { Business } from '../../types';\nimport { postOrder } from '../../utils/api';\nimport { FelixOrder, postPerson } from '../../utils/felixApi';\nimport { hideField } from '../../utils/form';\nimport { scrollToTop } from '../../utils/scroll';\n\n@Component({\n tag: 'hemfixarna-checkout',\n shadow: false,\n})\nexport class HemfixarnaCheckout {\n @State() date: string = '';\n @State() dateError: string | null = null;\n @State() generalError: string | null = null;\n @State() loading = false;\n @Element() private el: HTMLElement;\n\n handleChangeDate = (e: Event) => {\n this.dateError = null;\n this.date = (e.target as HTMLInputElement).value;\n };\n\n handleChangeTerms = () => {\n this.generalError = null;\n };\n\n sendOrder = async () => {\n if (this.loading) return;\n this.loading = true;\n let order: FelixOrder = {\n firstName: state.creditSafeUser.firstName,\n lastName: state.creditSafeUser.lastName,\n street: state.user.street,\n zip: state.user.zip,\n town: state.user.town,\n ssn: state.user.ssn,\n email: state.user.email,\n phone: state.user.phone,\n url: `${state.business === Business.string ? 'string' : state.business}-webk`,\n date: this.date,\n products: [\n ...state.cart.map(item => {\n const parts = item.parts.map(part => ({\n id: String(part.id),\n name: part.name,\n quantity: part.amount,\n rut: 0,\n rot: 0,\n }));\n return [\n {\n id: String(item.id),\n name: item.name,\n quantity: item.amount,\n rot: item.rot ? 1 : 0,\n rut: item.rut ? 1 : 0,\n },\n ...parts,\n ];\n }),\n ].flat(),\n creditSafe: state.creditSafeUser,\n customer: state.business,\n };\n\n const felixOrder = await postPerson(order);\n if (!felixOrder || !felixOrder.response?.scriptResult?.includes('OK')) {\n order = { ...order, felixStatus: 'error' };\n } else {\n order = { ...order, felixStatus: 'success' };\n }\n\n try {\n const { data: orderConfirm, status } = await postOrder(order);\n if (orderConfirm && status && status === 200) {\n state.step = 6;\n const el = this.el.closest('.hemfixarna_content');\n scrollToTop(el);\n } else {\n this.generalError = 'Något gick fel, försök igen senare';\n }\n } catch (error) {\n this.generalError = 'Något gick fel, försök igen senare';\n }\n this.loading = false;\n };\n\n handleSubmit = (e: Event) => {\n e.preventDefault();\n this.generalError = null;\n const validDate = this.date.length > 0;\n if (!validDate) {\n this.dateError = 'Ange ett giltigt datum';\n }\n const checkBoxes = Array.from(this.el.querySelectorAll('input[type=\"checkbox\"]'));\n const notValidTerms = checkBoxes.find(i => !(i as HTMLInputElement).checked);\n if (notValidTerms) {\n this.generalError = 'Du måste godkänna villkoren';\n }\n if (validDate && !notValidTerms) {\n this.sendOrder();\n }\n };\n\n componentWillLoad() {\n if (Boolean(state.user && state.user.street)) {\n state.checkoutStep = 2;\n }\n }\n\n render = () => {\n const dateLogo = getAssetPath(`./assets/date.svg`);\n const down = getAssetPath(`./assets/down.svg`);\n const loading = getAssetPath(`./assets/spinner.gif`);\n\n if (state.checkoutEdit) {\n return <hemfixarna-address />;\n } else if (state.checkoutStep === 1) {\n return <hemfixarna-getuser />;\n } else if (state.checkoutStep === 2) {\n return (\n <div class=\"mb-2\">\n <div class=\"hemfixarna_addressinfo\">\n <div>\n <p>{hideField(state.user.firstName)}</p>\n <p>{hideField(state.user.lastName)}</p>\n <p>{state.user.email}</p>\n <p>{state.user.phone}</p>\n </div>\n <div>\n <p>{hideField(state.user.street)}</p>\n <p>{hideField(state.user.zip)}</p>\n <p>{hideField(state.user.town)}</p>\n </div>\n <button onClick={() => (state.checkoutEdit = true)}>Behöver du ändra adressen?</button>\n </div>\n <form onSubmit={e => this.handleSubmit(e)}>\n <div>\n <img src={dateLogo} width={24} />\n <input\n class={`${this.date.length ? 'input_active' : ''}`}\n min={new Date().toISOString().split('T')[0]}\n onChange={e => this.handleChangeDate(e)}\n type=\"date\"\n name=\"date\"\n value={this.date}\n />\n <label htmlFor=\"date\">Tidigaste datum för hembesök</label>\n <img src={down} width={24} />\n </div>\n {this.dateError && <span>{this.dateError}</span>}\n <label class=\"hemfixarna_checkbox\">\n <input onChange={() => this.handleChangeTerms()} type=\"checkbox\" />\n <span innerHTML={state.options.terms} />\n </label>\n {state.cart\n .filter(i => i.terms_checkout && i.terms_show_checkbox)\n .map(item => (\n <Fragment>\n <label class=\"hemfixarna_checkbox\">\n <input onChange={() => this.handleChangeTerms()} type=\"checkbox\" />\n <span>{item.terms_checkout}</span>\n </label>\n </Fragment>\n ))}\n {this.generalError && <span>{this.generalError}</span>}\n <div class={this.loading ? 'loading' : ''}>\n <input type=\"submit\" value={this.loading ? '' : 'Slutför Bokning'} />\n <img width={20} height={20} src={loading} alt=\"spinner\" />\n </div>\n </form>\n </div>\n );\n }\n };\n}\n"]}
1
+ {"version":3,"file":"hemfixarna-checkout.js","sourceRoot":"","sources":["../../../src/components/hemfixarna-checkout/hemfixarna-checkout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AACrF,OAAO,KAAK,MAAM,aAAa,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAc,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAMjD,MAAM,OAAO,kBAAkB;;IAO7B,qBAAgB,GAAG,CAAC,CAAQ,EAAE,EAAE;MAC9B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;MACtB,IAAI,CAAC,IAAI,GAAI,CAAC,CAAC,MAA2B,CAAC,KAAK,CAAC;IACnD,CAAC,CAAC;IAEF,sBAAiB,GAAG,GAAG,EAAE;MACvB,IAAI,CAA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';\nimport state from '../../store';\nimport { Business } from '../../types';\nimport { postOrder } from '../../utils/api';\nimport { FelixOrder, postPerson } from '../../utils/felixApi';\nimport { hideField } from '../../utils/form';\nimport { scrollToTop } from '../../utils/scroll';\n\n@Component({\n tag: 'hemfixarna-checkout',\n shadow: false,\n})\nexport class HemfixarnaCheckout {\n @State() date: string = '';\n @State() dateError: string | null = null;\n @State() generalError: string | null = null;\n @State() loading = false;\n @Element() private el: HTMLElement;\n\n handleChangeDate = (e: Event) => {\n this.dateError = null;\n this.date = (e.target as HTMLInputElement).value;\n };\n\n handleChangeTerms = () => {\n this.generalError = null;\n };\n\n sendOrder = async () => {\n if (this.loading) return;\n this.loading = true;\n let order: FelixOrder = {\n firstName: state.creditSafeUser.firstName,\n lastName: state.creditSafeUser.lastName,\n street: state.user.street,\n zip: state.user.zip,\n town: state.user.town,\n ssn: state.user.ssn,\n email: state.user.email,\n phone: state.user.phone,\n url: `${state.business === Business.string ? 'string' : state.business}-webk`,\n date: this.date,\n products: [\n ...state.cart.map(item => {\n const parts = item.parts.map(part => ({\n id: String(part.id),\n name: part.name,\n quantity: part.amount,\n rut: 0,\n rot: 0,\n }));\n return [\n {\n id: String(item.id),\n name: item.name,\n quantity: item.amount,\n rot: item.rot ? 1 : 0,\n rut: item.rut ? 1 : 0,\n },\n ...parts,\n ];\n }),\n ].flat(),\n creditSafe: state.creditSafeUser,\n customer: state.business,\n };\n\n const felixOrder = await postPerson(order);\n if (!felixOrder || !felixOrder.response?.scriptResult?.includes('OK')) {\n order = { ...order, felixStatus: 'error' };\n } else {\n order = { ...order, felixStatus: 'success' };\n }\n\n try {\n const { data: orderConfirm, status } = await postOrder(order);\n if (orderConfirm && status && status === 200) {\n state.step = 6;\n const el = this.el.closest('.hemfixarna_content');\n scrollToTop(el);\n } else {\n this.generalError = 'Något gick fel, försök igen senare';\n }\n } catch (error) {\n this.generalError = 'Något gick fel, försök igen senare';\n }\n this.loading = false;\n };\n\n handleSubmit = (e: Event) => {\n e.preventDefault();\n this.generalError = null;\n const validDate = this.date.length > 0;\n if (!validDate) {\n this.dateError = 'Ange ett giltigt datum';\n }\n const checkBoxes = Array.from(this.el.querySelectorAll('input[type=\"checkbox\"]'));\n const notValidTerms = checkBoxes.find(i => !(i as HTMLInputElement).checked);\n if (notValidTerms) {\n this.generalError = 'Du måste godkänna villkoren';\n }\n if (validDate && !notValidTerms) {\n this.sendOrder();\n }\n };\n\n componentWillLoad() {\n if (Boolean(state.user && state.user.street)) {\n state.checkoutStep = 2;\n }\n }\n\n render = () => {\n const dateLogo = getAssetPath(`./assets/date.svg`);\n const down = getAssetPath(`./assets/down.svg`);\n const loading = getAssetPath(`./assets/spinner.gif`);\n\n if (state.checkoutEdit) {\n return <hemfixarna-address />;\n } else if (state.checkoutStep === 1) {\n return <hemfixarna-getuser />;\n } else if (state.checkoutStep === 2) {\n return (\n <div class=\"mb-2\">\n <div class=\"hemfixarna_addressinfo\">\n <div>\n <p>{hideField(state.user.firstName)}</p>\n <p>{hideField(state.user.lastName)}</p>\n <p>{state.user.email}</p>\n <p>{state.user.phone}</p>\n </div>\n <div>\n <p>{hideField(state.user.street)}</p>\n <p>{hideField(state.user.zip)}</p>\n <p>{hideField(state.user.town)}</p>\n </div>\n <button onClick={() => (state.checkoutEdit = true)}>Behöver du ändra adressen?</button>\n </div>\n <form onSubmit={e => this.handleSubmit(e)}>\n <div>\n <img src={dateLogo} width={24} />\n <input\n class={`${this.date.length ? 'input_active' : ''}`}\n min={new Date().toISOString().split('T')[0]}\n onChange={e => this.handleChangeDate(e)}\n type=\"date\"\n name=\"date\"\n value={this.date}\n />\n <label htmlFor=\"date\">Tidigaste datum för hembesök</label>\n <img src={down} width={24} />\n </div>\n {this.dateError && <span>{this.dateError}</span>}\n <label class=\"hemfixarna_checkbox\">\n <input onChange={() => this.handleChangeTerms()} type=\"checkbox\" />\n <span innerHTML={state.options.terms} />\n </label>\n {state.cart\n .filter(i => i.terms_checkout?.length)\n .map(item => (\n <Fragment>\n <label class=\"hemfixarna_checkbox\">\n <input onChange={() => this.handleChangeTerms()} type=\"checkbox\" />\n <span>{item.terms_checkout}</span>\n </label>\n </Fragment>\n ))}\n {this.generalError && <span>{this.generalError}</span>}\n <div class={this.loading ? 'loading' : ''}>\n <input type=\"submit\" value={this.loading ? '' : 'Skicka bokning'} />\n <img width={20} height={20} src={loading} alt=\"spinner\" />\n </div>\n </form>\n </div>\n );\n }\n };\n}\n"]}
@@ -422,7 +422,7 @@
422
422
  position: relative;
423
423
  }
424
424
  :host .hemfixarna div:has(> input[type=submit]) input {
425
- cursor: initial;
425
+ cursor: pointer;
426
426
  }
427
427
  :host .hemfixarna div:has(> input[type=submit]) img {
428
428
  display: none;
@@ -59,7 +59,7 @@ export class HemfixarnaGetuser {
59
59
  }
60
60
  };
61
61
  this.render = () => {
62
- return (h("form", { class: "mb-2", onSubmit: e => this.handleSubmit(e) }, h("div", null, h("input", { class: `${this.email.length ? 'input_active' : ''}`, onChange: e => this.handleChangeEmail(e), type: "email", name: "email", value: this.email }), h("label", { htmlFor: "email" }, "E-post ")), this.emailError && h("span", null, this.emailError), h("div", null, h("input", { class: `${this.phone.length ? 'input_active' : ''}`, onChange: e => this.handleChangePhone(e), type: "tel", name: "phone", value: this.phone }), h("label", { htmlFor: "phone" }, "Mobiltelefon ")), this.phoneError && h("span", null, this.phoneError), h("div", null, h("input", { class: `${this.ssn.length ? 'input_active' : ''}`, onChange: e => this.handleChangessn(e), type: "tel", name: "ssn", value: this.ssn }), h("label", { htmlFor: "phone" }, "Personnummer*")), this.ssnError && h("span", null, this.ssnError), h("input", { type: "submit", value: "Forts\u00E4tt och Boka*" }), h("p", null, "*Vi h\u00E4mtar din adress")));
62
+ return (h("form", { class: "mb-2", onSubmit: e => this.handleSubmit(e) }, h("div", null, h("input", { class: `${this.email.length ? 'input_active' : ''}`, onChange: e => this.handleChangeEmail(e), type: "email", name: "email", value: this.email }), h("label", { htmlFor: "email" }, "E-post ")), this.emailError && h("span", null, this.emailError), h("div", null, h("input", { class: `${this.phone.length ? 'input_active' : ''}`, onChange: e => this.handleChangePhone(e), type: "tel", name: "phone", value: this.phone }), h("label", { htmlFor: "phone" }, "Mobiltelefon ")), this.phoneError && h("span", null, this.phoneError), h("div", null, h("input", { class: `${this.ssn.length ? 'input_active' : ''}`, onChange: e => this.handleChangessn(e), type: "tel", name: "ssn", value: this.ssn }), h("label", { htmlFor: "phone" }, "Personnummer*")), this.ssnError && h("span", null, this.ssnError), h("input", { type: "submit", value: "Forts\u00E4tt*" }), h("p", null, "*Vi h\u00E4mtar din adress")));
63
63
  };
64
64
  this.email = '';
65
65
  this.emailError = null;
@@ -1 +1 @@
1
- {"version":3,"file":"hemfixarna-getuser.js","sourceRoot":"","sources":["../../../src/components/hemfixarna-getuser/hemfixarna-getuser.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,YAAY,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,MAAM,aAAa,CAAC;AAChC,OAAO,SAAS,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAMjD,MAAM,OAAO,iBAAiB;;IAiB5B,sBAAiB,GAAG,CAAC,CAAQ,EAAE,EAAE;MAC/B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;MACvB,IAAI,CAAC,KAAK,GAAI,CAAC,CAAC,MAA2B,CAAC,KAAK,CAAC;IACpD,CAAC,CAAC;IAEF,sBAAiB,GAAG,CAAC,CAAQ,EAAE,EAAE;MAC/B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;MACvB,IAAI,CAAC,KAAK,GAAI,CAAC,CAAC,MAA2B,CAAC,KAAK,CAAC;IACpD,CAAC,CAAC;IAEF,oBAAe,GAAG,CAAC,CAAQ,EAAE,EAAE;MAC7B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;MACrB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AAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,IAAI,EAAC,KAAK,EAAC,IAAI,EAAC,OAAO,EAAC,KAAK,EAAE,IAAI,CAAC,KAAK,GAAI;UACnJ,aAAO,OAAO,EAAC,OAAO,oBAAsB,CACxC;QACL,IAAI,CAAC,UAAU,IAAI,gBAAO,IAAI,CAAC,UAAU,CAAQ;QAClD;UACE,aAAO,KAAK,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,IAAI,EAAC,KAAK,EAAC,IAAI,EAAC,KAAK,EAAC,KAAK,EAAE,IAAI,CAAC,GAAG,GAAI;UAC3I,aAAO,OAAO,EAAC,OAAO,oBAAsB,CACxC;QACL,IAAI,CAAC,QAAQ,IAAI,gBAAO,IAAI,CAAC,QAAQ,CAAQ;QAC9C,aAAO,IAAI,EAAC,QAAQ,EAAC,KAAK,EAAC,yBAAoB,GAAG;QAClD,0CAA4B,CACvB,CACR,CAAC;IACJ,CAAC,CAAC;iBAlGuB,EAAE;sBACU,IAAI;iBAChB,EAAE;sBACU,IAAI;eAClB,EAAE;oBACU,IAAI;;EAGvC,iBAAiB;IACf,IAAI,KAAK,CAAC,IAAI,EAAE;MACd,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;MAC9B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;MAC9B,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC;KAC3B;EACH,CAAC;;;;;;;;;;;CAqFF","sourcesContent":["import { Component, Element, State, h } from '@stencil/core';\nimport Personnummer from 'personnummer';\nimport state from '../../store';\nimport apiSearch from '../../utils/creditSafe';\nimport { scrollToTop } from '../../utils/scroll';\n\n@Component({\n tag: 'hemfixarna-getuser',\n shadow: false,\n})\nexport class HemfixarnaGetuser {\n @State() email: string = '';\n @State() emailError: string | null = null;\n @State() phone: string = '';\n @State() phoneError: string | null = null;\n @State() ssn: string = '';\n @State() ssnError: string | null = null;\n @Element() private el: HTMLElement;\n\n componentWillLoad() {\n if (state.user) {\n this.email = state.user.email;\n this.phone = state.user.phone;\n this.ssn = state.user.ssn;\n }\n }\n\n handleChangeEmail = (e: Event) => {\n this.emailError = null;\n this.email = (e.target as HTMLInputElement).value;\n };\n\n handleChangePhone = (e: Event) => {\n this.phoneError = null;\n this.phone = (e.target as HTMLInputElement).value;\n };\n\n handleChangessn = (e: Event) => {\n this.ssnError = null;\n this.ssn = (e.target as HTMLInputElement).value;\n };\n\n handleSubmit = async (e: Event) => {\n e.preventDefault();\n const emailRegex = new RegExp(\n /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/,\n );\n const validEmail = emailRegex.test(this.email);\n if (!validEmail) {\n this.emailError = 'Ange en giltig e-postadress';\n }\n const validPhone = /^[\\d\\s()+-]{6,}$/.test(this.phone);\n if (!validPhone) {\n this.phoneError = 'Ange ett giltigt telefonnummer';\n }\n const validssn = Personnummer.valid(this.ssn);\n if (!validssn) {\n this.ssnError = 'Ange ett giltigt personnummer';\n } else if (validssn) {\n const pn = Personnummer.parse(this.ssn).format(true);\n this.ssn = [pn.slice(0, 8), '-', pn.slice(8)].join('');\n }\n if (validEmail && validPhone && validssn) {\n try {\n const creditSafeData = await apiSearch(this.ssn);\n if (creditSafeData) {\n state.creditSafeUser = creditSafeData;\n state.checkoutStep = 2;\n state.user = {\n ...creditSafeData,\n email: this.email,\n phone: this.phone,\n ssn: this.ssn,\n };\n } else {\n this.ssnError = 'Vi kunde tyvärr inte hitta en address med ditt angivna personnummer';\n }\n } catch (e) {\n this.ssnError = 'Vi kunde tyvärr inte hitta en address med ditt angivna personnummer';\n console.log(e);\n } finally {\n const el = this.el.closest('.hemfixarna_content');\n scrollToTop(el);\n }\n }\n };\n\n render = () => {\n return (\n <form class=\"mb-2\" onSubmit={e => this.handleSubmit(e)}>\n <div>\n <input class={`${this.email.length ? 'input_active' : ''}`} onChange={e => this.handleChangeEmail(e)} type=\"email\" name=\"email\" value={this.email} />\n <label htmlFor=\"email\">E-post </label>\n </div>\n {this.emailError && <span>{this.emailError}</span>}\n <div>\n <input class={`${this.phone.length ? 'input_active' : ''}`} onChange={e => this.handleChangePhone(e)} type=\"tel\" name=\"phone\" value={this.phone} />\n <label htmlFor=\"phone\">Mobiltelefon </label>\n </div>\n {this.phoneError && <span>{this.phoneError}</span>}\n <div>\n <input class={`${this.ssn.length ? 'input_active' : ''}`} onChange={e => this.handleChangessn(e)} type=\"tel\" name=\"ssn\" value={this.ssn} />\n <label htmlFor=\"phone\">Personnummer*</label>\n </div>\n {this.ssnError && <span>{this.ssnError}</span>}\n <input type=\"submit\" value=\"Fortsätt och Boka*\" />\n <p>*Vi hämtar din adress</p>\n </form>\n );\n };\n}\n"]}
1
+ {"version":3,"file":"hemfixarna-getuser.js","sourceRoot":"","sources":["../../../src/components/hemfixarna-getuser/hemfixarna-getuser.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,YAAY,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,MAAM,aAAa,CAAC;AAChC,OAAO,SAAS,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAMjD,MAAM,OAAO,iBAAiB;;IAiB5B,sBAAiB,GAAG,CAAC,CAAQ,EAAE,EAAE;MAC/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vC,iBAAiB;IACf,IAAI,KAAK,CAAC,IAAI,EAAE;MACd,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;MAC9B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;MAC9B,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC;KAC3B;EACH,CAAC;;;;;;;;;;;CAqFF","sourcesContent":["import { Component, Element, State, h } from '@stencil/core';\nimport Personnummer from 'personnummer';\nimport state from '../../store';\nimport apiSearch from '../../utils/creditSafe';\nimport { scrollToTop } from '../../utils/scroll';\n\n@Component({\n tag: 'hemfixarna-getuser',\n shadow: false,\n})\nexport class HemfixarnaGetuser {\n @State() email: string = '';\n @State() emailError: string | null = null;\n @State() phone: string = '';\n @State() phoneError: string | null = null;\n @State() ssn: string = '';\n @State() ssnError: string | null = null;\n @Element() private el: HTMLElement;\n\n componentWillLoad() {\n if (state.user) {\n this.email = state.user.email;\n this.phone = state.user.phone;\n this.ssn = state.user.ssn;\n }\n }\n\n handleChangeEmail = (e: Event) => {\n this.emailError = null;\n this.email = (e.target as HTMLInputElement).value;\n };\n\n handleChangePhone = (e: Event) => {\n this.phoneError = null;\n this.phone = (e.target as HTMLInputElement).value;\n };\n\n handleChangessn = (e: Event) => {\n this.ssnError = null;\n this.ssn = (e.target as HTMLInputElement).value;\n };\n\n handleSubmit = async (e: Event) => {\n e.preventDefault();\n const emailRegex = new RegExp(\n /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/,\n );\n const validEmail = emailRegex.test(this.email);\n if (!validEmail) {\n this.emailError = 'Ange en giltig e-postadress';\n }\n const validPhone = /^[\\d\\s()+-]{6,}$/.test(this.phone);\n if (!validPhone) {\n this.phoneError = 'Ange ett giltigt telefonnummer';\n }\n const validssn = Personnummer.valid(this.ssn);\n if (!validssn) {\n this.ssnError = 'Ange ett giltigt personnummer';\n } else if (validssn) {\n const pn = Personnummer.parse(this.ssn).format(true);\n this.ssn = [pn.slice(0, 8), '-', pn.slice(8)].join('');\n }\n if (validEmail && validPhone && validssn) {\n try {\n const creditSafeData = await apiSearch(this.ssn);\n if (creditSafeData) {\n state.creditSafeUser = creditSafeData;\n state.checkoutStep = 2;\n state.user = {\n ...creditSafeData,\n email: this.email,\n phone: this.phone,\n ssn: this.ssn,\n };\n } else {\n this.ssnError = 'Vi kunde tyvärr inte hitta en address med ditt angivna personnummer';\n }\n } catch (e) {\n this.ssnError = 'Vi kunde tyvärr inte hitta en address med ditt angivna personnummer';\n console.log(e);\n } finally {\n const el = this.el.closest('.hemfixarna_content');\n scrollToTop(el);\n }\n }\n };\n\n render = () => {\n return (\n <form class=\"mb-2\" onSubmit={e => this.handleSubmit(e)}>\n <div>\n <input class={`${this.email.length ? 'input_active' : ''}`} onChange={e => this.handleChangeEmail(e)} type=\"email\" name=\"email\" value={this.email} />\n <label htmlFor=\"email\">E-post </label>\n </div>\n {this.emailError && <span>{this.emailError}</span>}\n <div>\n <input class={`${this.phone.length ? 'input_active' : ''}`} onChange={e => this.handleChangePhone(e)} type=\"tel\" name=\"phone\" value={this.phone} />\n <label htmlFor=\"phone\">Mobiltelefon </label>\n </div>\n {this.phoneError && <span>{this.phoneError}</span>}\n <div>\n <input class={`${this.ssn.length ? 'input_active' : ''}`} onChange={e => this.handleChangessn(e)} type=\"tel\" name=\"ssn\" value={this.ssn} />\n <label htmlFor=\"phone\">Personnummer*</label>\n </div>\n {this.ssnError && <span>{this.ssnError}</span>}\n <input type=\"submit\" value=\"Fortsätt*\" />\n <p>*Vi hämtar din adress</p>\n </form>\n );\n };\n}\n"]}
@@ -26,7 +26,6 @@ export class HemfixarnaProduct {
26
26
  name: state.selectedProduct.post_title,
27
27
  start_fee: !state.selectedProduct.hide_start_fee,
28
28
  terms_checkout: state.selectedProduct.terms_checkout,
29
- terms_show_checkbox: state.selectedProduct.terms_show_checkbox,
30
29
  icon: state.selectedProduct.icon,
31
30
  },
32
31
  ];
@@ -116,7 +115,7 @@ export class HemfixarnaProduct {
116
115
  state.selectedProduct.parts.map(p => {
117
116
  var _a;
118
117
  return (h("li", { class: "hemfixarna_part" }, h("div", null, h("p", null, (_a = p.title) !== null && _a !== void 0 ? _a : p.post_title), h("p", { class: "hemfixarna_product--price" }, getPartPrice(p, state.selectedProduct), "kr/st")), h("div", { class: "hemfixarna_counter" }, h("img", { class: `${this.getPartAmount(p.ID) === 0 ? 'disabled' : ''}`, src: minus, onClick: () => this.removePart(p) }), h("span", null, this.getPartAmount(p.ID)), h("img", { class: `${this.getAmount() === 0 ? 'disabled' : ''}`, src: plus, onClick: () => this.addPart(p) }))));
119
- })), h("h4", { class: "hemfixarna_product--total" }, "Totalt ", this.getTotalPrice(), " kr"), h("button", { onClick: () => this.goToCart(), class: `hemfixarna_buy ${this.getAmount() === 0 ? 'disabled' : ''}` }, "Boka"), !state.selectedProduct.hide_start_fee && (state.selectedProduct.rot || state.selectedProduct.rut) && state.rutOptions && state.rotOptions && (h("p", { class: "hemfixarna_terms" }, h("strong", null, state.selectedProduct.rot ? state.rotOptions.rot_start_fee_heading : state.rutOptions.rut_start_fee_heading), h("br", null), h("span", { innerHTML: state.selectedProduct.rot ? state.rotOptions.rot_start_fee_text : state.rutOptions.rut_start_fee_text }))), state.options && h("hemfixarna-info", { list: state.options.trust })))));
118
+ })), h("h4", { class: "hemfixarna_product--total" }, "Totalt ", this.getTotalPrice(), " kr"), h("button", { onClick: () => this.goToCart(), class: `hemfixarna_buy ${this.getAmount() === 0 ? 'disabled' : ''}` }, "Forts\u00E4tt"), !state.selectedProduct.hide_start_fee && (state.selectedProduct.rot || state.selectedProduct.rut) && state.rutOptions && state.rotOptions && (h("p", { class: "hemfixarna_terms" }, h("strong", null, state.selectedProduct.rot ? state.rotOptions.rot_start_fee_heading : state.rutOptions.rut_start_fee_heading), h("br", null), h("span", { innerHTML: state.selectedProduct.rot ? state.rotOptions.rot_start_fee_text : state.rutOptions.rut_start_fee_text }))), state.options && h("hemfixarna-info", { list: state.options.trust })))));
120
119
  }
121
120
  static get is() { return "hemfixarna-product"; }
122
121
  static get states() {
@@ -1 +1 @@
1
- {"version":3,"file":"hemfixarna-product.js","sourceRoot":"","sources":["../../../src/components/hemfixarna-product/hemfixarna-product.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,KAAK,MAAM,aAAa,CAAC;AAEhC,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAMjD,MAAM,OAAO,iBAAiB;;kBACF,CAAC;2BACS,IAAI;;EAGxC,UAAU;IACR,MAAM,aAAa,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;IAC9E,IAAI,aAAa,EAAE;MACjB,aAAa,CAAC,MAAM,EAAE,CAAC;MACvB,KAAK,CAAC,IAAI,GAAG,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;KAC9B;SAAM;MACL,KAAK,CAAC,IAAI,GAAG;QACX,GAAG,KAAK,CAAC,IAAI;QACb;UACE,EAAE,EAAE,KAAK,CAAC,eAAe,CAAC,EAAE;UAC5B,GAAG,EAAE,KAAK,CAAC,eAAe,CAAC,GAAG;UAC9B,GAAG,EAAE,KAAK,CAAC,eAAe,CAAC,GAAG;UAC9B,MAAM,EAAE,CAAC;UACT,KAAK,EAAE,EAAE;UACT,KAAK,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kBAAS;UAC3E,cAAQ,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,kBAAkB,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,EAAE,WAElG;UACR,CAAC,KAAK,CAAC,eAAe,CAAC,cAAc,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,GAAG,IAAI,KAAK,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU,IAAI,CAC5I,SAAG,KAAK,EAAC,kBAAkB;YACzB,kBAAS,KAAK,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,qBAAqB,CAAU;YAC9H,aAAM;YACN,YAAM,SAAS,EAAE,KAAK,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,kBAAkB,GAAS,CAC7H,CACL;UACA,KAAK,CAAC,OAAO,IAAI,uBAAiB,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,GAAI,CAC5D,CACF,CACF,CACP,CAAC;EACJ,CAAC;;;;;;;CACF","sourcesContent":["import { Component, Element, State, getAssetPath, h } from '@stencil/core';\nimport state from '../../store';\nimport { Icon, Part } from '../../types';\nimport { getPartPrice, getProductPrice } from '../../utils/calc';\nimport { scrollToTop } from '../../utils/scroll';\n\n@Component({\n tag: 'hemfixarna-product',\n shadow: false,\n})\nexport class HemfixarnaProduct {\n @State() amount: number = 0;\n @State() hideDescription: boolean = true;\n @Element() private el: HTMLElement;\n\n addProduct() {\n const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);\n if (productInCart) {\n productInCart.amount++;\n state.cart = [...state.cart];\n } else {\n state.cart = [\n ...state.cart,\n {\n id: state.selectedProduct.ID,\n rut: state.selectedProduct.rut,\n rot: state.selectedProduct.rot,\n amount: 1,\n parts: [],\n price: state.selectedProduct.price,\n name: state.selectedProduct.post_title,\n start_fee: !state.selectedProduct.hide_start_fee,\n terms_checkout: state.selectedProduct.terms_checkout,\n terms_show_checkbox: state.selectedProduct.terms_show_checkbox,\n icon: state.selectedProduct.icon,\n },\n ];\n }\n }\n\n removeProduct() {\n const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);\n if (productInCart && productInCart.amount > 1) {\n productInCart.amount--;\n state.cart = [...state.cart];\n } else {\n state.cart = state.cart.filter(p => p.id !== state.selectedProduct.ID);\n }\n }\n\n //Handle cart and parts\n addPart(part: Part) {\n const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);\n if (productInCart) {\n const partInCart = productInCart.parts.find(sp => sp.id === part.ID);\n if (partInCart) {\n partInCart.amount++;\n productInCart.parts = [...productInCart.parts];\n } else {\n productInCart.parts = [...productInCart.parts, { id: part.ID, amount: 1, price: part.price, name: part.title ?? part.post_title }];\n }\n state.cart = [...state.cart.filter(p => p.id !== productInCart.id), productInCart];\n }\n }\n\n removePart(part: Part) {\n const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);\n if (productInCart) {\n const partInCart = productInCart.parts.find(sp => sp.id === part.ID);\n if (partInCart && partInCart.amount > 1) {\n partInCart.amount--;\n productInCart.parts = [...productInCart.parts];\n } else {\n productInCart.parts = productInCart.parts.filter(sp => sp.id !== part.ID);\n }\n state.cart = [...state.cart.filter(p => p.id !== productInCart.id), productInCart];\n }\n }\n\n goToCart() {\n const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);\n if (productInCart) {\n state.step = 5;\n const el = this.el.closest('.hemfixarna_content');\n scrollToTop(el);\n }\n }\n\n getAmount() {\n return state.cart.find(p => p.id === state.selectedProduct.ID)?.amount || 0;\n }\n\n getPartAmount(partId: number) {\n const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);\n return productInCart?.parts.find(sp => sp.id === partId)?.amount || 0;\n }\n\n getTotalPrice() {\n let price = 0;\n const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);\n if (productInCart) {\n const partsPrice = productInCart.parts.reduce((acc, curr) => {\n const part = state.selectedProduct.parts.find(p => p.ID === curr.id);\n if (part) {\n return acc + part.price * curr.amount;\n }\n return acc;\n }, 0);\n price = state.selectedProduct.price * productInCart.amount + partsPrice;\n } else {\n price = state.selectedProduct.price;\n }\n return getProductPrice(state.selectedProduct, price);\n }\n\n render() {\n const checked = getAssetPath(`./assets/checked.svg`);\n const plus = getAssetPath(`./assets/plus.svg`);\n const minus = getAssetPath(`./assets/minus.svg`);\n\n return (\n <div class=\"hemfixarna_product\">\n <div class=\"hemfixarna_product--top\">\n {state.selectedProduct.icon && (\n <img width={80} src={(state.selectedProduct.icon as Icon).url ?? (state.selectedProduct.icon as string)} alt={state.selectedProduct.post_title} />\n )}\n <div>\n <h1>{state.selectedProduct.post_title}</h1>\n <h2>Från: {getProductPrice(state.selectedProduct)} kr</h2>\n </div>\n </div>\n\n <div class=\"hemfixarna_product--grid\">\n <div class=\"hemfixarna_product--left\">\n {state.selectedProduct.list?.length && (\n <ul class=\"hemfixarna_features\">\n {state.selectedProduct.list.map(l => (\n <li key={l.bullet}>\n <img src={checked} alt=\"checked\" />\n <p>{l.bullet}</p>\n </li>\n ))}\n </ul>\n )}\n {state.selectedProduct.description && (\n <p\n onClick={() => (this.hideDescription = false)}\n class={`hemfixarna_description ${this.hideDescription ? 'hemfixarna_description--hidden' : ''}`}\n innerHTML={state.selectedProduct.description}\n ></p>\n )}\n </div>\n <div class=\"hemfixarna_product--right\">\n <ul>\n <li class=\"hemfixarna_product--item\">\n <div>\n <p>Antal {state.selectedProduct.post_title}</p>\n <p class=\"hemfixarna_product--price\">{getProductPrice(state.selectedProduct)}kr/st</p>\n </div>\n <div class=\"hemfixarna_counter\">\n <img class={`${this.getAmount() === 0 ? 'disabled' : ''}`} src={minus} onClick={() => this.removeProduct()} />\n <span>{this.getAmount()}</span>\n <img src={plus} onClick={() => this.addProduct()} />\n </div>\n </li>\n {state.selectedProduct.parts?.length &&\n state.selectedProduct.parts.map(p => (\n <li class=\"hemfixarna_part\">\n <div>\n <p>{p.title ?? p.post_title}</p>\n <p class=\"hemfixarna_product--price\">{getPartPrice(p, state.selectedProduct)}kr/st</p>\n </div>\n <div class=\"hemfixarna_counter\">\n <img class={`${this.getPartAmount(p.ID) === 0 ? 'disabled' : ''}`} src={minus} onClick={() => this.removePart(p)} />\n <span>{this.getPartAmount(p.ID)}</span>\n <img class={`${this.getAmount() === 0 ? 'disabled' : ''}`} src={plus} onClick={() => this.addPart(p)} />\n </div>\n </li>\n ))}\n </ul>\n <h4 class=\"hemfixarna_product--total\">Totalt {this.getTotalPrice()} kr</h4>\n <button onClick={() => this.goToCart()} class={`hemfixarna_buy ${this.getAmount() === 0 ? 'disabled' : ''}`}>\n Boka\n </button>\n {!state.selectedProduct.hide_start_fee && (state.selectedProduct.rot || state.selectedProduct.rut) && state.rutOptions && state.rotOptions && (\n <p class=\"hemfixarna_terms\">\n <strong>{state.selectedProduct.rot ? state.rotOptions.rot_start_fee_heading : state.rutOptions.rut_start_fee_heading}</strong>\n <br />\n <span innerHTML={state.selectedProduct.rot ? state.rotOptions.rot_start_fee_text : state.rutOptions.rut_start_fee_text}></span>\n </p>\n )}\n {state.options && <hemfixarna-info list={state.options.trust} />}\n </div>\n </div>\n </div>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"hemfixarna-product.js","sourceRoot":"","sources":["../../../src/components/hemfixarna-product/hemfixarna-product.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,KAAK,MAAM,aAAa,CAAC;AAEhC,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAk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AE,KAAK,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,kBAAkB,GAAS,CAC7H,CACL;UACA,KAAK,CAAC,OAAO,IAAI,uBAAiB,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,GAAI,CAC5D,CACF,CACF,CACP,CAAC;EACJ,CAAC;;;;;;;CACF","sourcesContent":["import { Component, Element, State, getAssetPath, h } from '@stencil/core';\nimport state from '../../store';\nimport { Icon, Part } from '../../types';\nimport { getPartPrice, getProductPrice } from '../../utils/calc';\nimport { scrollToTop } from '../../utils/scroll';\n\n@Component({\n tag: 'hemfixarna-product',\n shadow: false,\n})\nexport class HemfixarnaProduct {\n @State() amount: number = 0;\n @State() hideDescription: boolean = true;\n @Element() private el: HTMLElement;\n\n addProduct() {\n const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);\n if (productInCart) {\n productInCart.amount++;\n state.cart = [...state.cart];\n } else {\n state.cart = [\n ...state.cart,\n {\n id: state.selectedProduct.ID,\n rut: state.selectedProduct.rut,\n rot: state.selectedProduct.rot,\n amount: 1,\n parts: [],\n price: state.selectedProduct.price,\n name: state.selectedProduct.post_title,\n start_fee: !state.selectedProduct.hide_start_fee,\n terms_checkout: state.selectedProduct.terms_checkout,\n icon: state.selectedProduct.icon,\n },\n ];\n }\n }\n\n removeProduct() {\n const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);\n if (productInCart && productInCart.amount > 1) {\n productInCart.amount--;\n state.cart = [...state.cart];\n } else {\n state.cart = state.cart.filter(p => p.id !== state.selectedProduct.ID);\n }\n }\n\n //Handle cart and parts\n addPart(part: Part) {\n const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);\n if (productInCart) {\n const partInCart = productInCart.parts.find(sp => sp.id === part.ID);\n if (partInCart) {\n partInCart.amount++;\n productInCart.parts = [...productInCart.parts];\n } else {\n productInCart.parts = [...productInCart.parts, { id: part.ID, amount: 1, price: part.price, name: part.title ?? part.post_title }];\n }\n state.cart = [...state.cart.filter(p => p.id !== productInCart.id), productInCart];\n }\n }\n\n removePart(part: Part) {\n const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);\n if (productInCart) {\n const partInCart = productInCart.parts.find(sp => sp.id === part.ID);\n if (partInCart && partInCart.amount > 1) {\n partInCart.amount--;\n productInCart.parts = [...productInCart.parts];\n } else {\n productInCart.parts = productInCart.parts.filter(sp => sp.id !== part.ID);\n }\n state.cart = [...state.cart.filter(p => p.id !== productInCart.id), productInCart];\n }\n }\n\n goToCart() {\n const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);\n if (productInCart) {\n state.step = 5;\n const el = this.el.closest('.hemfixarna_content');\n scrollToTop(el);\n }\n }\n\n getAmount() {\n return state.cart.find(p => p.id === state.selectedProduct.ID)?.amount || 0;\n }\n\n getPartAmount(partId: number) {\n const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);\n return productInCart?.parts.find(sp => sp.id === partId)?.amount || 0;\n }\n\n getTotalPrice() {\n let price = 0;\n const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);\n if (productInCart) {\n const partsPrice = productInCart.parts.reduce((acc, curr) => {\n const part = state.selectedProduct.parts.find(p => p.ID === curr.id);\n if (part) {\n return acc + part.price * curr.amount;\n }\n return acc;\n }, 0);\n price = state.selectedProduct.price * productInCart.amount + partsPrice;\n } else {\n price = state.selectedProduct.price;\n }\n return getProductPrice(state.selectedProduct, price);\n }\n\n render() {\n const checked = getAssetPath(`./assets/checked.svg`);\n const plus = getAssetPath(`./assets/plus.svg`);\n const minus = getAssetPath(`./assets/minus.svg`);\n\n return (\n <div class=\"hemfixarna_product\">\n <div class=\"hemfixarna_product--top\">\n {state.selectedProduct.icon && (\n <img width={80} src={(state.selectedProduct.icon as Icon).url ?? (state.selectedProduct.icon as string)} alt={state.selectedProduct.post_title} />\n )}\n <div>\n <h1>{state.selectedProduct.post_title}</h1>\n <h2>Från: {getProductPrice(state.selectedProduct)} kr</h2>\n </div>\n </div>\n\n <div class=\"hemfixarna_product--grid\">\n <div class=\"hemfixarna_product--left\">\n {state.selectedProduct.list?.length && (\n <ul class=\"hemfixarna_features\">\n {state.selectedProduct.list.map(l => (\n <li key={l.bullet}>\n <img src={checked} alt=\"checked\" />\n <p>{l.bullet}</p>\n </li>\n ))}\n </ul>\n )}\n {state.selectedProduct.description && (\n <p\n onClick={() => (this.hideDescription = false)}\n class={`hemfixarna_description ${this.hideDescription ? 'hemfixarna_description--hidden' : ''}`}\n innerHTML={state.selectedProduct.description}\n ></p>\n )}\n </div>\n <div class=\"hemfixarna_product--right\">\n <ul>\n <li class=\"hemfixarna_product--item\">\n <div>\n <p>Antal {state.selectedProduct.post_title}</p>\n <p class=\"hemfixarna_product--price\">{getProductPrice(state.selectedProduct)}kr/st</p>\n </div>\n <div class=\"hemfixarna_counter\">\n <img class={`${this.getAmount() === 0 ? 'disabled' : ''}`} src={minus} onClick={() => this.removeProduct()} />\n <span>{this.getAmount()}</span>\n <img src={plus} onClick={() => this.addProduct()} />\n </div>\n </li>\n {state.selectedProduct.parts?.length &&\n state.selectedProduct.parts.map(p => (\n <li class=\"hemfixarna_part\">\n <div>\n <p>{p.title ?? p.post_title}</p>\n <p class=\"hemfixarna_product--price\">{getPartPrice(p, state.selectedProduct)}kr/st</p>\n </div>\n <div class=\"hemfixarna_counter\">\n <img class={`${this.getPartAmount(p.ID) === 0 ? 'disabled' : ''}`} src={minus} onClick={() => this.removePart(p)} />\n <span>{this.getPartAmount(p.ID)}</span>\n <img class={`${this.getAmount() === 0 ? 'disabled' : ''}`} src={plus} onClick={() => this.addPart(p)} />\n </div>\n </li>\n ))}\n </ul>\n <h4 class=\"hemfixarna_product--total\">Totalt {this.getTotalPrice()} kr</h4>\n <button onClick={() => this.goToCart()} class={`hemfixarna_buy ${this.getAmount() === 0 ? 'disabled' : ''}`}>\n Fortsätt\n </button>\n {!state.selectedProduct.hide_start_fee && (state.selectedProduct.rot || state.selectedProduct.rut) && state.rutOptions && state.rotOptions && (\n <p class=\"hemfixarna_terms\">\n <strong>{state.selectedProduct.rot ? state.rotOptions.rot_start_fee_heading : state.rutOptions.rut_start_fee_heading}</strong>\n <br />\n <span innerHTML={state.selectedProduct.rot ? state.rotOptions.rot_start_fee_text : state.rutOptions.rut_start_fee_text}></span>\n </p>\n )}\n {state.options && <hemfixarna-info list={state.options.trust} />}\n </div>\n </div>\n </div>\n );\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AA2KA,MAAM,CAAN,IAAY,QAMX;AAND,WAAY,QAAQ;EAClB,yBAAa,CAAA;EACb,+BAAmB,CAAA;EACnB,+BAAmB,CAAA;EACnB,uCAA2B,CAAA;EAC3B,iCAAqB,CAAA;AACvB,CAAC,EANW,QAAQ,KAAR,QAAQ,QAMnB;AAED,MAAM,CAAN,IAAY,WAKX;AALD,WAAY,WAAW;EACrB,oCAAqB,CAAA;EACrB,0CAA2B,CAAA;EAC3B,8CAA+B,CAAA;EAC/B,8CAA+B,CAAA;AACjC,CAAC,EALW,WAAW,KAAX,WAAW,QAKtB;AAED,MAAM,CAAN,IAAY,WAEX;AAFD,WAAY,WAAW;EACrB,wCAAyB,CAAA;AAC3B,CAAC,EAFW,WAAW,KAAX,WAAW,QAEtB","sourcesContent":["type Icon = {\n url: string;\n};\n\ninterface Customer {\n ID: number;\n post_title: 'Byggmax';\n post_name: 'byggmax';\n post_type: 'customer';\n filter: 'raw';\n categories: CustomerCategory[];\n}\n\ninterface CustomerCategory {\n id: string;\n name: string;\n icon: string;\n show_products: boolean;\n products: { fields: Product }[] | false;\n sub_categories: CustomerSubCategory[] | false;\n}\n\ninterface CustomerSubCategory {\n id: string;\n name: string;\n icon: string;\n products: { fields: Product }[];\n parent: string;\n}\n\ninterface Part {\n ID: number;\n post_author: number;\n post_date: Date;\n post_date_gmt: Date;\n post_content: string;\n post_title: string;\n post_excerpt: string;\n post_status: string;\n comment_status: string;\n ping_status: string;\n post_password: string;\n post_name: string;\n to_ping: string;\n pinged: string;\n post_modified: Date;\n post_modified_gmt: Date;\n post_content_filtered: string;\n post_parent: 0 | 1;\n guid: string;\n menu_order: 0;\n post_type: string;\n post_mime_type: string;\n comment_count: number;\n filter: string;\n price: number;\n title: string;\n}\n\ninterface Product {\n ID: number;\n post_author: string;\n post_date: Date;\n post_date_gmt: Date;\n post_content: string;\n post_title: string;\n post_excerpt: string;\n post_status: string;\n comment_status: string;\n ping_status: string;\n post_password: string;\n post_name: string;\n to_ping: string;\n pinged: string;\n post_modified: Date;\n post_modified_gmt: Date;\n post_content_filtered: string;\n post_parent: 0;\n guid: string;\n menu_order: 0;\n post_type: string;\n post_mime_type: string;\n comment_count: 0;\n filter: string;\n price: number;\n icon?: Icon | string;\n parts?: Array<Part>;\n list: Array<{ bullet: string }>;\n terms: string;\n terms_checkout: string;\n terms_show_checkbox: boolean;\n rut: boolean;\n rot: boolean;\n hide_start_fee: boolean;\n description: string;\n category: string;\n}\n\ninterface Service {\n ID: 41857;\n icon?: Icon | string;\n post_author: 34419;\n post_date: Date;\n post_date_gmt: Date;\n post_content: string;\n post_title: string;\n post_excerpt: string;\n post_status: string;\n comment_status: string;\n ping_status: string;\n post_password: string;\n post_name: string;\n to_ping: string;\n pinged: string;\n post_modified: Date;\n post_modified_gmt: Date;\n post_content_filtered: string;\n post_parent: 0;\n guid: string;\n menu_order: 0;\n post_type: 'service';\n post_mime_type: string;\n comment_count: 0;\n filter: string;\n products: Array<Product>;\n}\n\ninterface Category {\n count: number;\n description: string;\n name: string;\n icon?: Icon | string;\n parent: 0 | 1;\n slug: string;\n taxonomy: 'service_cat';\n term_group: 0 | 1;\n term_id: number;\n term_order: string;\n term_taxonomy_id: number;\n sub_cats?: Array<Category>;\n services?: Array<Service>;\n}\n\ninterface WpOptions {\n link: { title: string; url: string };\n trust: { trust_badge: string }[];\n thank_you_image: string;\n start_fee: number;\n terms: string;\n}\ninterface CartPart {\n id: number;\n amount: number;\n price: number;\n name: string;\n}\n\ninterface CartItem {\n id: number;\n price: number;\n name: string;\n amount: number;\n parts: CartPart[];\n rut: boolean;\n rot: boolean;\n start_fee: boolean;\n terms_checkout: string;\n terms_show_checkbox: boolean;\n icon?: Icon | string;\n}\n\nexport enum Business {\n kund = 'kund',\n byggmax = 'byggmax',\n skanska = 'skanska',\n string = 'string-furniture',\n hornbach = 'hornbach',\n}\n\nexport enum WidgetStyle {\n standard = 'standard',\n alternative = 'alternative',\n alternative_2 = 'alternative_2',\n alternative_3 = 'alternative_3',\n}\n\nexport enum TopCategory {\n byggmax = 'category/bygg',\n}\n\ninterface User {\n email: string;\n phone: string;\n ssn: string;\n firstName: string;\n lastName: string;\n street: string;\n zip: string;\n town: string;\n}\n\ninterface RutOptions {\n rut_start_fee_heading: string;\n rut_start_fee_text: string;\n rut_start_fee_text_secondary: string;\n}\n\ninterface RotOptions {\n rot_start_fee_heading: string;\n rot_start_fee_text: string;\n rot_start_fee_text_secondary: string;\n}\n\nexport type { CartItem, CartPart, Category, Customer, CustomerCategory, CustomerSubCategory, Icon, Part, Product, RotOptions, RutOptions, Service, User, WpOptions };\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AA0KA,MAAM,CAAN,IAAY,QAMX;AAND,WAAY,QAAQ;EAClB,yBAAa,CAAA;EACb,+BAAmB,CAAA;EACnB,+BAAmB,CAAA;EACnB,uCAA2B,CAAA;EAC3B,iCAAqB,CAAA;AACvB,CAAC,EANW,QAAQ,KAAR,QAAQ,QAMnB;AAED,MAAM,CAAN,IAAY,WAKX;AALD,WAAY,WAAW;EACrB,oCAAqB,CAAA;EACrB,0CAA2B,CAAA;EAC3B,8CAA+B,CAAA;EAC/B,8CAA+B,CAAA;AACjC,CAAC,EALW,WAAW,KAAX,WAAW,QAKtB;AAED,MAAM,CAAN,IAAY,WAEX;AAFD,WAAY,WAAW;EACrB,wCAAyB,CAAA;AAC3B,CAAC,EAFW,WAAW,KAAX,WAAW,QAEtB","sourcesContent":["type Icon = {\n url: string;\n};\n\ninterface Customer {\n ID: number;\n post_title: 'Byggmax';\n post_name: 'byggmax';\n post_type: 'customer';\n filter: 'raw';\n categories: CustomerCategory[];\n}\n\ninterface CustomerCategory {\n id: string;\n name: string;\n icon: string;\n show_products: boolean;\n products: { fields: Product }[] | false;\n sub_categories: CustomerSubCategory[] | false;\n}\n\ninterface CustomerSubCategory {\n id: string;\n name: string;\n icon: string;\n products: { fields: Product }[];\n parent: string;\n}\n\ninterface Part {\n ID: number;\n post_author: number;\n post_date: Date;\n post_date_gmt: Date;\n post_content: string;\n post_title: string;\n post_excerpt: string;\n post_status: string;\n comment_status: string;\n ping_status: string;\n post_password: string;\n post_name: string;\n to_ping: string;\n pinged: string;\n post_modified: Date;\n post_modified_gmt: Date;\n post_content_filtered: string;\n post_parent: 0 | 1;\n guid: string;\n menu_order: 0;\n post_type: string;\n post_mime_type: string;\n comment_count: number;\n filter: string;\n price: number;\n title: string;\n}\n\ninterface Product {\n ID: number;\n post_author: string;\n post_date: Date;\n post_date_gmt: Date;\n post_content: string;\n post_title: string;\n post_excerpt: string;\n post_status: string;\n comment_status: string;\n ping_status: string;\n post_password: string;\n post_name: string;\n to_ping: string;\n pinged: string;\n post_modified: Date;\n post_modified_gmt: Date;\n post_content_filtered: string;\n post_parent: 0;\n guid: string;\n menu_order: 0;\n post_type: string;\n post_mime_type: string;\n comment_count: 0;\n filter: string;\n price: number;\n icon?: Icon | string;\n parts?: Array<Part>;\n list: Array<{ bullet: string }>;\n terms: string;\n terms_checkout: string;\n terms_show_checkbox: boolean;\n rut: boolean;\n rot: boolean;\n hide_start_fee: boolean;\n description: string;\n category: string;\n}\n\ninterface Service {\n ID: 41857;\n icon?: Icon | string;\n post_author: 34419;\n post_date: Date;\n post_date_gmt: Date;\n post_content: string;\n post_title: string;\n post_excerpt: string;\n post_status: string;\n comment_status: string;\n ping_status: string;\n post_password: string;\n post_name: string;\n to_ping: string;\n pinged: string;\n post_modified: Date;\n post_modified_gmt: Date;\n post_content_filtered: string;\n post_parent: 0;\n guid: string;\n menu_order: 0;\n post_type: 'service';\n post_mime_type: string;\n comment_count: 0;\n filter: string;\n products: Array<Product>;\n}\n\ninterface Category {\n count: number;\n description: string;\n name: string;\n icon?: Icon | string;\n parent: 0 | 1;\n slug: string;\n taxonomy: 'service_cat';\n term_group: 0 | 1;\n term_id: number;\n term_order: string;\n term_taxonomy_id: number;\n sub_cats?: Array<Category>;\n services?: Array<Service>;\n}\n\ninterface WpOptions {\n link: { title: string; url: string };\n trust: { trust_badge: string }[];\n thank_you_image: string;\n start_fee: number;\n terms: string;\n}\ninterface CartPart {\n id: number;\n amount: number;\n price: number;\n name: string;\n}\n\ninterface CartItem {\n id: number;\n price: number;\n name: string;\n amount: number;\n parts: CartPart[];\n rut: boolean;\n rot: boolean;\n start_fee: boolean;\n terms_checkout: string;\n icon?: Icon | string;\n}\n\nexport enum Business {\n kund = 'kund',\n byggmax = 'byggmax',\n skanska = 'skanska',\n string = 'string-furniture',\n hornbach = 'hornbach',\n}\n\nexport enum WidgetStyle {\n standard = 'standard',\n alternative = 'alternative',\n alternative_2 = 'alternative_2',\n alternative_3 = 'alternative_3',\n}\n\nexport enum TopCategory {\n byggmax = 'category/bygg',\n}\n\ninterface User {\n email: string;\n phone: string;\n ssn: string;\n firstName: string;\n lastName: string;\n street: string;\n zip: string;\n town: string;\n}\n\ninterface RutOptions {\n rut_start_fee_heading: string;\n rut_start_fee_text: string;\n rut_start_fee_text_secondary: string;\n}\n\ninterface RotOptions {\n rot_start_fee_heading: string;\n rot_start_fee_text: string;\n rot_start_fee_text_secondary: string;\n}\n\nexport type { CartItem, CartPart, Category, Customer, CustomerCategory, CustomerSubCategory, Icon, Part, Product, RotOptions, RutOptions, Service, User, WpOptions };\n"]}
@@ -308,7 +308,7 @@ const HemfixarnaAddress = class {
308
308
  this.town = this.town === state.user.town ? '' : e.target.value;
309
309
  };
310
310
  this.render = () => {
311
- return (h("form", { class: "hemfixarna_address", onSubmit: e => this.handleSubmit(e) }, h("div", null, h("input", { class: `${this.street.length ? 'input_active' : ''}`, onInput: this.handleChangeStreet, type: "text", name: "street", value: this.street === state.user.street ? hideField(this.street) : this.street }), h("label", { htmlFor: "street" }, "Gatuaddress ")), this.streetError && h("span", null, this.streetError), h("div", null, h("input", { class: `${this.zip.length ? 'input_active' : ''}`, onInput: this.handleChangeZip, type: "tel", name: "zip", value: this.zip === state.user.zip ? hideField(this.zip) : this.zip }), h("label", { htmlFor: "zip" }, "Postnummer ")), this.zipError && h("span", null, this.zipError), h("div", null, h("input", { class: `${this.town.length ? 'input_active' : ''}`, onInput: this.handleChangeTown, type: "text", name: "town", value: this.town === state.user.town ? hideField(this.town) : this.town }), h("label", { htmlFor: "town" }, "Ort ")), this.townError && h("span", null, this.townError), h("input", { type: "submit", value: "Forts\u00E4tt och Boka" })));
311
+ return (h("form", { class: "hemfixarna_address", onSubmit: e => this.handleSubmit(e) }, h("div", null, h("input", { class: `${this.street.length ? 'input_active' : ''}`, onInput: this.handleChangeStreet, type: "text", name: "street", value: this.street === state.user.street ? hideField(this.street) : this.street }), h("label", { htmlFor: "street" }, "Gatuaddress ")), this.streetError && h("span", null, this.streetError), h("div", null, h("input", { class: `${this.zip.length ? 'input_active' : ''}`, onInput: this.handleChangeZip, type: "tel", name: "zip", value: this.zip === state.user.zip ? hideField(this.zip) : this.zip }), h("label", { htmlFor: "zip" }, "Postnummer ")), this.zipError && h("span", null, this.zipError), h("div", null, h("input", { class: `${this.town.length ? 'input_active' : ''}`, onInput: this.handleChangeTown, type: "text", name: "town", value: this.town === state.user.town ? hideField(this.town) : this.town }), h("label", { htmlFor: "town" }, "Ort ")), this.townError && h("span", null, this.townError), h("input", { type: "submit", value: "Forts\u00E4tt" })));
312
312
  };
313
313
  this.street = '';
314
314
  this.streetError = null;
@@ -788,8 +788,8 @@ const HemfixarnaCheckout = class {
788
788
  }
789
789
  else if (state.checkoutStep === 2) {
790
790
  return (h("div", { class: "mb-2" }, h("div", { class: "hemfixarna_addressinfo" }, h("div", null, h("p", null, hideField(state.user.firstName)), h("p", null, hideField(state.user.lastName)), h("p", null, state.user.email), h("p", null, state.user.phone)), h("div", null, h("p", null, hideField(state.user.street)), h("p", null, hideField(state.user.zip)), h("p", null, hideField(state.user.town))), h("button", { onClick: () => (state.checkoutEdit = true) }, "Beh\u00F6ver du \u00E4ndra adressen?")), h("form", { onSubmit: e => this.handleSubmit(e) }, h("div", null, h("img", { src: dateLogo, width: 24 }), h("input", { class: `${this.date.length ? 'input_active' : ''}`, min: new Date().toISOString().split('T')[0], onChange: e => this.handleChangeDate(e), type: "date", name: "date", value: this.date }), h("label", { htmlFor: "date" }, "Tidigaste datum f\u00F6r hembes\u00F6k"), h("img", { src: down, width: 24 })), this.dateError && h("span", null, this.dateError), h("label", { class: "hemfixarna_checkbox" }, h("input", { onChange: () => this.handleChangeTerms(), type: "checkbox" }), h("span", { innerHTML: state.options.terms })), state.cart
791
- .filter(i => i.terms_checkout && i.terms_show_checkbox)
792
- .map(item => (h(Fragment, null, h("label", { class: "hemfixarna_checkbox" }, h("input", { onChange: () => this.handleChangeTerms(), type: "checkbox" }), h("span", null, item.terms_checkout))))), this.generalError && h("span", null, this.generalError), h("div", { class: this.loading ? 'loading' : '' }, h("input", { type: "submit", value: this.loading ? '' : 'Slutför Bokning' }), h("img", { width: 20, height: 20, src: loading, alt: "spinner" })))));
791
+ .filter(i => { var _a; return (_a = i.terms_checkout) === null || _a === void 0 ? void 0 : _a.length; })
792
+ .map(item => (h(Fragment, null, h("label", { class: "hemfixarna_checkbox" }, h("input", { onChange: () => this.handleChangeTerms(), type: "checkbox" }), h("span", null, item.terms_checkout))))), this.generalError && h("span", null, this.generalError), h("div", { class: this.loading ? 'loading' : '' }, h("input", { type: "submit", value: this.loading ? '' : 'Skicka bokning' }), h("img", { width: 20, height: 20, src: loading, alt: "spinner" })))));
793
793
  }
794
794
  };
795
795
  this.date = '';
@@ -805,7 +805,7 @@ const HemfixarnaCheckout = class {
805
805
  get el() { return getElement(this); }
806
806
  };
807
807
 
808
- const hemfixarnaCss = "@import url(\"https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap\"); *{box-sizing:border-box}:host{font-family:\"Inter\", sans-serif}:host .mb-2{margin-bottom:32px}:host button{color:#474444}:host form{display:flex;flex-direction:column;gap:16px}:host form img{position:absolute;top:50%;transform:translateY(-50%);pointer-events:none}:host form img:first-of-type{left:16px}:host form img:last-of-type{right:16px}:host form span{margin-top:-8px;color:#ec6632}:host form p{text-align:center}:host form p{margin:0}:host form div{position:relative}:host form div label{pointer-events:none;position:absolute;left:16px;top:50%;transform:translateY(-50%);background:#fff;padding:4px;transition:0.2s all cubic-bezier(0.465, 0.183, 0.153, 0.946)}:host form div input{padding:16px;width:100%;font-size:16px;border:1px solid #fcd9c9}:host form div input:focus~label,:host form div .input_active~label{top:0;transform:translateY(-50%);background:linear-gradient(180deg, #fffaf2 50%, #fff 50%)}:host h1{font-size:24px;font-weight:400;line-height:32px;letter-spacing:-3%;text-align:left;margin:0 0 8px}:host h2{margin:0 0 24px;font-weight:700;font-size:20px;line-height:28px;letter-spacing:-3%}:host p{font-size:16px;font-weight:400;line-height:24px;letter-spacing:-3%}:host .hemfixarna{width:100%;}:host .hemfixarna_nav{position:absolute;top:0;width:100dvw;left:0;height:80px;z-index:9999}:host .hemfixarna_nav--links{display:none !important}@media (min-width: 769px){:host .hemfixarna_nav--links{display:flex !important}}:host .hemfixarna_nav--links a{color:#ec6632;text-decoration:none;border:1px solid rgba(255, 255, 255, 0.3);border-radius:56px;padding:8px 32px;text-transform:capitalize}:host .hemfixarna_nav>div{position:relative;overflow:hidden;width:100%;height:100%;display:flex;justify-content:space-between;align-items:center;padding:0 16px}@media (min-width: 769px){:host .hemfixarna_nav>div{padding:0 32px}}:host .hemfixarna_nav>div>div{display:flex;gap:32px;justify-content:space-between}:host .hemfixarna_nav>div>img{position:absolute;width:100%;height:100%;top:0;left:0;z-index:-1}:host .hemfixarna_nav p{color:#fff}:host .hemfixarna_standalone .hemfixarna_backdrop{background:#fffaf2;opacity:1}:host .hemfixarna_standalone .hemfixarna_modal{top:80px;transform:translateX(-50%);border:none;height:calc(100dvh - 80px);opacity:0}:host .hemfixarna_standalone .hemfixarna_modal--open{opacity:1}:host .hemfixarna .switch{position:relative;display:inline-block;width:40px;height:20px}:host .hemfixarna .switch input{opacity:0;width:0;height:0}:host .hemfixarna .slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:#ccc;-webkit-transition:0.4s;transition:0.4s;border-radius:34px}:host .hemfixarna .slider:before{position:absolute;content:\"\";height:18px;width:18px;left:2px;bottom:1px;background-color:white;-webkit-transition:0.4s;transition:0.4s;border-radius:50%}:host .hemfixarna input:checked+.slider{background-color:#fcd9c9}:host .hemfixarna input:focus+.slider{box-shadow:0 0 1px #fcd9c9}:host .hemfixarna input:checked+.slider:before{-webkit-transform:translateX(18px);-ms-transform:translateX(18px);transform:translateX(18px);background:#ec6632}:host .hemfixarna_checkbox{display:grid;grid-template-columns:40px auto;font-size:16px;font-weight:400;line-height:24px;letter-spacing:-3%}:host .hemfixarna_checkbox>span{transform:translateY(6px)}:host .hemfixarna_checkbox span,:host .hemfixarna_checkbox span p{color:#474444;font-size:14px}:host .hemfixarna_checkbox p{text-align:left}:host .hemfixarna_info{display:flex;flex-direction:column;gap:24px;padding:32px;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);border-radius:4px;border:1px solid #fcd9c9}:host .hemfixarna_info h2{margin:0}@media (min-width: 769px){:host .hemfixarna_info{position:sticky;top:0}}:host .hemfixarna_infomodal{position:absolute;top:40%;left:50%;transform:translate(-50%, -50%);width:100%;max-width:80%;background:#fffaf2;border:1px solid #fcd9c9;padding:32px;z-index:99;border-radius:4px;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);display:flex;flex-direction:column;gap:16px}:host .hemfixarna_infomodal p,:host .hemfixarna_infomodal h4{margin:0}:host .hemfixarna_infomodal button{background:#ec6632;color:#fff;border-radius:60px;font-size:16px;padding:8px 16px}:host .hemfixarna_addressinfo{padding:16px 16px 64px;border:1px solid #fcd9c9;position:relative;margin-bottom:32px;display:grid;grid-template-columns:1fr;gap:8px}@media (min-width: 769px){:host .hemfixarna_addressinfo{grid-template-columns:1fr 1fr}}:host .hemfixarna_addressinfo button{position:absolute;bottom:16px;right:16px;font-weight:500;text-underline-offset:2px;text-decoration:underline}:host .hemfixarna_part{background:#fff;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);display:grid;padding:16px;grid-template-columns:auto 75px}:host .hemfixarna_counter{display:flex;align-items:center}:host .hemfixarna_counter span{padding:0 8px}:host .hemfixarna_counter img{cursor:pointer}:host .hemfixarna_counter img:not(.disabled):hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_description{display:grid;gap:16px}:host .hemfixarna_description ul{list-style:disc;padding-right:12px;transform:translateX(12px)}:host .hemfixarna_description--hidden{max-height:140px;overflow:hidden;position:relative;cursor:pointer}:host .hemfixarna_description--hidden::after{content:\"\";position:absolute;bottom:0;left:0;right:0;height:128px;background:linear-gradient(180deg, rgba(255, 253, 250, 0), rgba(255, 253, 250, 0.46) 50%, #fffaf2)}:host .hemfixarna_terms{font-size:14px}:host .hemfixarna_terms a{color:inherit}:host .hemfixarna_logo{height:64px}:host .hemfixarna_box{padding:16px;display:flex;align-items:center;width:100%;box-sizing:border-box;border-radius:4px;gap:16px 8px;border-radius:4px;gap:16px 8px}:host .hemfixarna_box p,:host .hemfixarna_box span{font-size:15px}:host .hemfixarna_box .underline{text-decoration:underline;text-underline-offset:2px}:host .hemfixarna_box .pointer{cursor:pointer}:host .hemfixarna_box .p-s{font-size:12px}:host .hemfixarna_box>div{display:grid;gap:8px}:host .hemfixarna_box--standard{background:#fffaf2;border:1px solid #fcd9c9}:host .hemfixarna_box--alternative,:host .hemfixarna_box--alternative_2,:host .hemfixarna_box--alternative_3{background:transparent;border:1px solid #e3e3e3}:host .hemfixarna_box--alternative_2,:host .hemfixarna_box--alternative_3{box-shadow:0px 2px 16px 0px rgba(0, 0, 0, 0.0784313725)}:host .hemfixarna_box--alternative_3{justify-content:center}:host .hemfixarna_altbtn{display:flex !important;flex-direction:column;gap:8px;align-items:center;margin-left:auto}:host .hemfixarna_btn{margin-left:auto}:host .hemfixarna_btn,:host .hemfixarna_buy,:host .hemfixarna input[type=submit]{border:none;border-radius:60px;font-weight:600;letter-spacing:0.5px;line-height:20px;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_btn:not(.disabled):hover,:host .hemfixarna_buy:not(.disabled):hover,:host .hemfixarna input[type=submit]:not(.disabled):hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna div:has(>input[type=submit]){position:relative}:host .hemfixarna div:has(>input[type=submit]) input{cursor:initial}:host .hemfixarna div:has(>input[type=submit]) img{display:none}:host .hemfixarna .loading{cursor:default;opacity:0.6}:host .hemfixarna .loading>img{display:initial !important;position:absolute;top:50%;left:50%;transform:translate(-50%, -50%)}:host .hemfixarna_btn{font-size:14px;background:#c84e18;color:#fff;padding:16px 24px;white-space:nowrap;position:relative}:host .hemfixarna_btn span{position:absolute;background:#fff;border-radius:100%;width:24px;height:24px;display:flex;justify-content:center;align-items:center;font-weight:600;font-size:13px;line-height:11px;top:-8px;right:-12px}:host .hemfixarna_btn span{background:#25a710;color:#fff;right:0 !important}:host .hemfixarna_buy,:host .hemfixarna input[type=submit]{font-size:21px;background:#25a710;color:#fff;padding:16px 24px}:host .hemfixarna .disabled{opacity:0.5;cursor:default}:host .hemfixarna_modal{position:fixed;background:#fffaf2;border:1px solid #fcd9c9;border-radius:4px;top:50%;left:50%;z-index:1000;transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);transform:translate(-50%, -50%) scale(0.7);opacity:0;height:92%;width:92%;max-width:920px;display:flex;flex-direction:column;gap:8px}:host .hemfixarna_modal--open{opacity:1;transform:translate(-50%, -50%) scale(1)}:host .hemfixarna_backdrop{z-index:999;position:fixed;background:#474444;top:0;left:0;bottom:0;right:0;opacity:0;transition:transform 0.1s cubic-bezier(0.465, 0.183, 0.153, 0.946), opacity 0.1s cubic-bezier(0.465, 0.183, 0.153, 0.946)}:host .hemfixarna_backdrop--open{opacity:0.3}:host .hemfixarna_order{position:absolute;top:-1px;left:-1px;right:-1px;bottom:-1px;background-repeat:no-repeat !important;background-size:cover !important;background-position:center !important;display:grid;grid-template-columns:1fr 1fr;padding:48px 32px 64px}@media (max-width: 768px){:host .hemfixarna_order{grid-template-columns:1fr;grid-template-rows:0 auto}}:host .hemfixarna_order>div:last-of-type{background:#fffaf2;padding:32px;display:flex;flex-direction:column;max-height:100%;overflow:auto}:host .hemfixarna_order img{cursor:pointer}:host .hemfixarna_order button{margin:16px 0;padding:0;text-decoration:underline;text-underline-offset:2px;font-size:14px;font-weight:600}:host .hemfixarna_cart{display:grid;grid-template-columns:1fr 1fr;gap:32px}@media (max-width: 768px){:host .hemfixarna_cart{grid-template-columns:1fr;gap:0}}:host .hemfixarna_cart--right h2,:host .hemfixarna_cart--left h2{display:flex;align-items:center}:host .hemfixarna_cart--right h2 img,:host .hemfixarna_cart--left h2 img{margin-top:3.2px}@media (min-width: 769px){:host .hemfixarna_cart--left h2 button{display:none}}@media (max-width: 768px){:host .hemfixarna_cart--right h2 button{display:none}}:host .hemfixarna_cart--startfee{display:flex;justify-content:space-between}:host .hemfixarna_cart--rutrot{display:flex;justify-content:space-between}:host .hemfixarna_cart--rutrot div{display:flex;gap:16px;align-items:center}:host .hemfixarna_cart--additional{display:flex;flex-direction:column;gap:16px;padding:16px;border-top:1px solid #fcd9c9}:host .hemfixarna_cart--additional p{font-size:14px}:host .hemfixarna_cart--additional strong{text-decoration:underline;text-underline-offset:2px;cursor:pointer;position:relative}:host .hemfixarna_cart--additional strong img{position:absolute;top:50%;transform:translateY(-50%);right:-24px}:host .hemfixarna_cart--price{border-top:1px solid #fcd9c9;padding:16px;display:flex;justify-content:space-between}:host .hemfixarna_cart--price h3{margin:0}:host .hemfixarna_cart--item{display:flex;flex-direction:column;gap:8px;padding:16px 0;border-top:1px solid #fcd9c9}:host .hemfixarna_cart--item>div{display:flex;justify-content:space-between}:host .hemfixarna_cart--item>div>div{display:flex;align-items:center;gap:16px}:host .hemfixarna_cart--item>div button{color:#ec6632}:host .hemfixarna_categories{display:grid;gap:24px}:host .hemfixarna_categories--wrapper{gap:32px;display:grid;grid-template-columns:1fr 1fr}@media (max-width: 768px){:host .hemfixarna_categories--wrapper{grid-template-columns:1fr}}:host .hemfixarna_categories li{position:relative;background:#fff;border-radius:4px;min-height:132px;padding:24px;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);display:flex;align-items:center;gap:24px;cursor:pointer}:host .hemfixarna_categories li:hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_categories li>button{height:100%;width:100%}:host .hemfixarna_categories li .price{font-weight:700}:host .hemfixarna_content{height:100%;overflow:auto;padding:0 32px 64px}:host .hemfixarna_content--5{padding-top:16px}:host .hemfixarna_crumbs{position:relative;padding:16px 24px;border-bottom:1px solid #fcd9c9;display:flex;justify-content:space-between}:host .hemfixarna_crumbs--back{padding:16px 24px 8px;display:flex;align-items:center;gap:8px;box-shadow:none !important}:host .hemfixarna_crumbs--back:hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_crumbs img{cursor:pointer}:host .hemfixarna_crumbs .close{position:absolute;right:-16px;top:-16px;z-index:9}:host .hemfixarna_crumbs .cart{padding-left:16px;position:relative}:host .hemfixarna_crumbs .cart img{cursor:inherit}:host .hemfixarna_crumbs .cart span{position:absolute;background:#fff;border-radius:100%;width:24px;height:24px;display:flex;justify-content:center;align-items:center;font-weight:600;font-size:13px;line-height:11px;top:-8px;right:-12px}:host .hemfixarna_crumbs .cart_active{cursor:pointer}:host .hemfixarna_crumbs .cart_active span{background:#25a710;color:#fff}:host .hemfixarna_crumbs--links{display:flex;align-items:center;gap:16px;overflow:auto}@media (min-width: 769px){:host .hemfixarna_crumbs--links{-ms-overflow-style:none}:host .hemfixarna_crumbs--links::-webkit-scrollbar{display:none}:host .hemfixarna_crumbs--links::-webkit-scrollbar-button{display:none}}:host .hemfixarna_crumbs button{white-space:nowrap;background:#f1ded6;border-radius:64px;padding:12px 16px;font-size:12px;font-weight:600;letter-spacing:0.3px;box-shadow:none !important}:host .hemfixarna_crumbs button:not(.active):hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_crumbs .active{background:#fffaf2;cursor:default}:host .hemfixarna_features{gap:12px !important}:host .hemfixarna_features li{display:flex;gap:16px;align-items:center}:host .hemfixarna_address{margin-bottom:16px}:host .hemfixarna_product{display:grid;gap:16px}:host .hemfixarna_product--link{font-weight:700;color:#474444;text-underline-offset:4px}:host .hemfixarna_product--left{gap:32px}:host .hemfixarna_product--right{gap:32px}:host .hemfixarna_product--price{margin-top:4px;font-weight:700}:host .hemfixarna_product--total{text-align:center;margin:-16px 0;font-size:21px;line-height:28px}:host .hemfixarna_product--item{background:#fff;padding:16px;display:grid;grid-template-columns:auto 75px;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_product--grid{display:grid;grid-template-columns:1fr 1fr;gap:32px}@media (max-width: 768px){:host .hemfixarna_product--grid{grid-template-columns:1fr}}:host .hemfixarna_product--grid>div{display:flex;flex-direction:column}:host .hemfixarna_product--grid ul{display:flex;flex-direction:column;gap:4px}:host .hemfixarna_product p{margin:0}:host .hemfixarna_product--top{display:flex;gap:32px}:host .hemfixarna_product--top>div{width:100%}:host .hemfixarna_product--top>div h1{max-width:80%}@media (max-width: 768px){:host .hemfixarna_product--top>div h1{max-width:100%}}:host .hemfixarna_product--top h4{margin-bottom:8px}:host h5,:host p{margin:0}:host input[type=submit]{cursor:pointer}:host input[type=date]~label{left:56px}:host input[type=date]{border:1px solid #fcd9c9;padding-left:64px}:host input[type=checkbox]{height:18px;width:18px;border:1px solid #fcd9c9}:host input[type=checkbox]:checked{background:red}:host input[type=date]::-webkit-calendar-picker-indicator{background:transparent;bottom:0;color:transparent;cursor:pointer;height:auto;left:0;position:absolute;right:0;top:0;width:auto}:host button,:host a{cursor:pointer;background:none;border:none}:host ul{list-style:none;margin:0;padding:0}";
808
+ const hemfixarnaCss = "@import url(\"https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap\"); *{box-sizing:border-box}:host{font-family:\"Inter\", sans-serif}:host .mb-2{margin-bottom:32px}:host button{color:#474444}:host form{display:flex;flex-direction:column;gap:16px}:host form img{position:absolute;top:50%;transform:translateY(-50%);pointer-events:none}:host form img:first-of-type{left:16px}:host form img:last-of-type{right:16px}:host form span{margin-top:-8px;color:#ec6632}:host form p{text-align:center}:host form p{margin:0}:host form div{position:relative}:host form div label{pointer-events:none;position:absolute;left:16px;top:50%;transform:translateY(-50%);background:#fff;padding:4px;transition:0.2s all cubic-bezier(0.465, 0.183, 0.153, 0.946)}:host form div input{padding:16px;width:100%;font-size:16px;border:1px solid #fcd9c9}:host form div input:focus~label,:host form div .input_active~label{top:0;transform:translateY(-50%);background:linear-gradient(180deg, #fffaf2 50%, #fff 50%)}:host h1{font-size:24px;font-weight:400;line-height:32px;letter-spacing:-3%;text-align:left;margin:0 0 8px}:host h2{margin:0 0 24px;font-weight:700;font-size:20px;line-height:28px;letter-spacing:-3%}:host p{font-size:16px;font-weight:400;line-height:24px;letter-spacing:-3%}:host .hemfixarna{width:100%;}:host .hemfixarna_nav{position:absolute;top:0;width:100dvw;left:0;height:80px;z-index:9999}:host .hemfixarna_nav--links{display:none !important}@media (min-width: 769px){:host .hemfixarna_nav--links{display:flex !important}}:host .hemfixarna_nav--links a{color:#ec6632;text-decoration:none;border:1px solid rgba(255, 255, 255, 0.3);border-radius:56px;padding:8px 32px;text-transform:capitalize}:host .hemfixarna_nav>div{position:relative;overflow:hidden;width:100%;height:100%;display:flex;justify-content:space-between;align-items:center;padding:0 16px}@media (min-width: 769px){:host .hemfixarna_nav>div{padding:0 32px}}:host .hemfixarna_nav>div>div{display:flex;gap:32px;justify-content:space-between}:host .hemfixarna_nav>div>img{position:absolute;width:100%;height:100%;top:0;left:0;z-index:-1}:host .hemfixarna_nav p{color:#fff}:host .hemfixarna_standalone .hemfixarna_backdrop{background:#fffaf2;opacity:1}:host .hemfixarna_standalone .hemfixarna_modal{top:80px;transform:translateX(-50%);border:none;height:calc(100dvh - 80px);opacity:0}:host .hemfixarna_standalone .hemfixarna_modal--open{opacity:1}:host .hemfixarna .switch{position:relative;display:inline-block;width:40px;height:20px}:host .hemfixarna .switch input{opacity:0;width:0;height:0}:host .hemfixarna .slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:#ccc;-webkit-transition:0.4s;transition:0.4s;border-radius:34px}:host .hemfixarna .slider:before{position:absolute;content:\"\";height:18px;width:18px;left:2px;bottom:1px;background-color:white;-webkit-transition:0.4s;transition:0.4s;border-radius:50%}:host .hemfixarna input:checked+.slider{background-color:#fcd9c9}:host .hemfixarna input:focus+.slider{box-shadow:0 0 1px #fcd9c9}:host .hemfixarna input:checked+.slider:before{-webkit-transform:translateX(18px);-ms-transform:translateX(18px);transform:translateX(18px);background:#ec6632}:host .hemfixarna_checkbox{display:grid;grid-template-columns:40px auto;font-size:16px;font-weight:400;line-height:24px;letter-spacing:-3%}:host .hemfixarna_checkbox>span{transform:translateY(6px)}:host .hemfixarna_checkbox span,:host .hemfixarna_checkbox span p{color:#474444;font-size:14px}:host .hemfixarna_checkbox p{text-align:left}:host .hemfixarna_info{display:flex;flex-direction:column;gap:24px;padding:32px;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);border-radius:4px;border:1px solid #fcd9c9}:host .hemfixarna_info h2{margin:0}@media (min-width: 769px){:host .hemfixarna_info{position:sticky;top:0}}:host .hemfixarna_infomodal{position:absolute;top:40%;left:50%;transform:translate(-50%, -50%);width:100%;max-width:80%;background:#fffaf2;border:1px solid #fcd9c9;padding:32px;z-index:99;border-radius:4px;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);display:flex;flex-direction:column;gap:16px}:host .hemfixarna_infomodal p,:host .hemfixarna_infomodal h4{margin:0}:host .hemfixarna_infomodal button{background:#ec6632;color:#fff;border-radius:60px;font-size:16px;padding:8px 16px}:host .hemfixarna_addressinfo{padding:16px 16px 64px;border:1px solid #fcd9c9;position:relative;margin-bottom:32px;display:grid;grid-template-columns:1fr;gap:8px}@media (min-width: 769px){:host .hemfixarna_addressinfo{grid-template-columns:1fr 1fr}}:host .hemfixarna_addressinfo button{position:absolute;bottom:16px;right:16px;font-weight:500;text-underline-offset:2px;text-decoration:underline}:host .hemfixarna_part{background:#fff;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);display:grid;padding:16px;grid-template-columns:auto 75px}:host .hemfixarna_counter{display:flex;align-items:center}:host .hemfixarna_counter span{padding:0 8px}:host .hemfixarna_counter img{cursor:pointer}:host .hemfixarna_counter img:not(.disabled):hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_description{display:grid;gap:16px}:host .hemfixarna_description ul{list-style:disc;padding-right:12px;transform:translateX(12px)}:host .hemfixarna_description--hidden{max-height:140px;overflow:hidden;position:relative;cursor:pointer}:host .hemfixarna_description--hidden::after{content:\"\";position:absolute;bottom:0;left:0;right:0;height:128px;background:linear-gradient(180deg, rgba(255, 253, 250, 0), rgba(255, 253, 250, 0.46) 50%, #fffaf2)}:host .hemfixarna_terms{font-size:14px}:host .hemfixarna_terms a{color:inherit}:host .hemfixarna_logo{height:64px}:host .hemfixarna_box{padding:16px;display:flex;align-items:center;width:100%;box-sizing:border-box;border-radius:4px;gap:16px 8px;border-radius:4px;gap:16px 8px}:host .hemfixarna_box p,:host .hemfixarna_box span{font-size:15px}:host .hemfixarna_box .underline{text-decoration:underline;text-underline-offset:2px}:host .hemfixarna_box .pointer{cursor:pointer}:host .hemfixarna_box .p-s{font-size:12px}:host .hemfixarna_box>div{display:grid;gap:8px}:host .hemfixarna_box--standard{background:#fffaf2;border:1px solid #fcd9c9}:host .hemfixarna_box--alternative,:host .hemfixarna_box--alternative_2,:host .hemfixarna_box--alternative_3{background:transparent;border:1px solid #e3e3e3}:host .hemfixarna_box--alternative_2,:host .hemfixarna_box--alternative_3{box-shadow:0px 2px 16px 0px rgba(0, 0, 0, 0.0784313725)}:host .hemfixarna_box--alternative_3{justify-content:center}:host .hemfixarna_altbtn{display:flex !important;flex-direction:column;gap:8px;align-items:center;margin-left:auto}:host .hemfixarna_btn{margin-left:auto}:host .hemfixarna_btn,:host .hemfixarna_buy,:host .hemfixarna input[type=submit]{border:none;border-radius:60px;font-weight:600;letter-spacing:0.5px;line-height:20px;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_btn:not(.disabled):hover,:host .hemfixarna_buy:not(.disabled):hover,:host .hemfixarna input[type=submit]:not(.disabled):hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna div:has(>input[type=submit]){position:relative}:host .hemfixarna div:has(>input[type=submit]) input{cursor:pointer}:host .hemfixarna div:has(>input[type=submit]) img{display:none}:host .hemfixarna .loading{cursor:default;opacity:0.6}:host .hemfixarna .loading>img{display:initial !important;position:absolute;top:50%;left:50%;transform:translate(-50%, -50%)}:host .hemfixarna_btn{font-size:14px;background:#c84e18;color:#fff;padding:16px 24px;white-space:nowrap;position:relative}:host .hemfixarna_btn span{position:absolute;background:#fff;border-radius:100%;width:24px;height:24px;display:flex;justify-content:center;align-items:center;font-weight:600;font-size:13px;line-height:11px;top:-8px;right:-12px}:host .hemfixarna_btn span{background:#25a710;color:#fff;right:0 !important}:host .hemfixarna_buy,:host .hemfixarna input[type=submit]{font-size:21px;background:#25a710;color:#fff;padding:16px 24px}:host .hemfixarna .disabled{opacity:0.5;cursor:default}:host .hemfixarna_modal{position:fixed;background:#fffaf2;border:1px solid #fcd9c9;border-radius:4px;top:50%;left:50%;z-index:1000;transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);transform:translate(-50%, -50%) scale(0.7);opacity:0;height:92%;width:92%;max-width:920px;display:flex;flex-direction:column;gap:8px}:host .hemfixarna_modal--open{opacity:1;transform:translate(-50%, -50%) scale(1)}:host .hemfixarna_backdrop{z-index:999;position:fixed;background:#474444;top:0;left:0;bottom:0;right:0;opacity:0;transition:transform 0.1s cubic-bezier(0.465, 0.183, 0.153, 0.946), opacity 0.1s cubic-bezier(0.465, 0.183, 0.153, 0.946)}:host .hemfixarna_backdrop--open{opacity:0.3}:host .hemfixarna_order{position:absolute;top:-1px;left:-1px;right:-1px;bottom:-1px;background-repeat:no-repeat !important;background-size:cover !important;background-position:center !important;display:grid;grid-template-columns:1fr 1fr;padding:48px 32px 64px}@media (max-width: 768px){:host .hemfixarna_order{grid-template-columns:1fr;grid-template-rows:0 auto}}:host .hemfixarna_order>div:last-of-type{background:#fffaf2;padding:32px;display:flex;flex-direction:column;max-height:100%;overflow:auto}:host .hemfixarna_order img{cursor:pointer}:host .hemfixarna_order button{margin:16px 0;padding:0;text-decoration:underline;text-underline-offset:2px;font-size:14px;font-weight:600}:host .hemfixarna_cart{display:grid;grid-template-columns:1fr 1fr;gap:32px}@media (max-width: 768px){:host .hemfixarna_cart{grid-template-columns:1fr;gap:0}}:host .hemfixarna_cart--right h2,:host .hemfixarna_cart--left h2{display:flex;align-items:center}:host .hemfixarna_cart--right h2 img,:host .hemfixarna_cart--left h2 img{margin-top:3.2px}@media (min-width: 769px){:host .hemfixarna_cart--left h2 button{display:none}}@media (max-width: 768px){:host .hemfixarna_cart--right h2 button{display:none}}:host .hemfixarna_cart--startfee{display:flex;justify-content:space-between}:host .hemfixarna_cart--rutrot{display:flex;justify-content:space-between}:host .hemfixarna_cart--rutrot div{display:flex;gap:16px;align-items:center}:host .hemfixarna_cart--additional{display:flex;flex-direction:column;gap:16px;padding:16px;border-top:1px solid #fcd9c9}:host .hemfixarna_cart--additional p{font-size:14px}:host .hemfixarna_cart--additional strong{text-decoration:underline;text-underline-offset:2px;cursor:pointer;position:relative}:host .hemfixarna_cart--additional strong img{position:absolute;top:50%;transform:translateY(-50%);right:-24px}:host .hemfixarna_cart--price{border-top:1px solid #fcd9c9;padding:16px;display:flex;justify-content:space-between}:host .hemfixarna_cart--price h3{margin:0}:host .hemfixarna_cart--item{display:flex;flex-direction:column;gap:8px;padding:16px 0;border-top:1px solid #fcd9c9}:host .hemfixarna_cart--item>div{display:flex;justify-content:space-between}:host .hemfixarna_cart--item>div>div{display:flex;align-items:center;gap:16px}:host .hemfixarna_cart--item>div button{color:#ec6632}:host .hemfixarna_categories{display:grid;gap:24px}:host .hemfixarna_categories--wrapper{gap:32px;display:grid;grid-template-columns:1fr 1fr}@media (max-width: 768px){:host .hemfixarna_categories--wrapper{grid-template-columns:1fr}}:host .hemfixarna_categories li{position:relative;background:#fff;border-radius:4px;min-height:132px;padding:24px;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);display:flex;align-items:center;gap:24px;cursor:pointer}:host .hemfixarna_categories li:hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_categories li>button{height:100%;width:100%}:host .hemfixarna_categories li .price{font-weight:700}:host .hemfixarna_content{height:100%;overflow:auto;padding:0 32px 64px}:host .hemfixarna_content--5{padding-top:16px}:host .hemfixarna_crumbs{position:relative;padding:16px 24px;border-bottom:1px solid #fcd9c9;display:flex;justify-content:space-between}:host .hemfixarna_crumbs--back{padding:16px 24px 8px;display:flex;align-items:center;gap:8px;box-shadow:none !important}:host .hemfixarna_crumbs--back:hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_crumbs img{cursor:pointer}:host .hemfixarna_crumbs .close{position:absolute;right:-16px;top:-16px;z-index:9}:host .hemfixarna_crumbs .cart{padding-left:16px;position:relative}:host .hemfixarna_crumbs .cart img{cursor:inherit}:host .hemfixarna_crumbs .cart span{position:absolute;background:#fff;border-radius:100%;width:24px;height:24px;display:flex;justify-content:center;align-items:center;font-weight:600;font-size:13px;line-height:11px;top:-8px;right:-12px}:host .hemfixarna_crumbs .cart_active{cursor:pointer}:host .hemfixarna_crumbs .cart_active span{background:#25a710;color:#fff}:host .hemfixarna_crumbs--links{display:flex;align-items:center;gap:16px;overflow:auto}@media (min-width: 769px){:host .hemfixarna_crumbs--links{-ms-overflow-style:none}:host .hemfixarna_crumbs--links::-webkit-scrollbar{display:none}:host .hemfixarna_crumbs--links::-webkit-scrollbar-button{display:none}}:host .hemfixarna_crumbs button{white-space:nowrap;background:#f1ded6;border-radius:64px;padding:12px 16px;font-size:12px;font-weight:600;letter-spacing:0.3px;box-shadow:none !important}:host .hemfixarna_crumbs button:not(.active):hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_crumbs .active{background:#fffaf2;cursor:default}:host .hemfixarna_features{gap:12px !important}:host .hemfixarna_features li{display:flex;gap:16px;align-items:center}:host .hemfixarna_address{margin-bottom:16px}:host .hemfixarna_product{display:grid;gap:16px}:host .hemfixarna_product--link{font-weight:700;color:#474444;text-underline-offset:4px}:host .hemfixarna_product--left{gap:32px}:host .hemfixarna_product--right{gap:32px}:host .hemfixarna_product--price{margin-top:4px;font-weight:700}:host .hemfixarna_product--total{text-align:center;margin:-16px 0;font-size:21px;line-height:28px}:host .hemfixarna_product--item{background:#fff;padding:16px;display:grid;grid-template-columns:auto 75px;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_product--grid{display:grid;grid-template-columns:1fr 1fr;gap:32px}@media (max-width: 768px){:host .hemfixarna_product--grid{grid-template-columns:1fr}}:host .hemfixarna_product--grid>div{display:flex;flex-direction:column}:host .hemfixarna_product--grid ul{display:flex;flex-direction:column;gap:4px}:host .hemfixarna_product p{margin:0}:host .hemfixarna_product--top{display:flex;gap:32px}:host .hemfixarna_product--top>div{width:100%}:host .hemfixarna_product--top>div h1{max-width:80%}@media (max-width: 768px){:host .hemfixarna_product--top>div h1{max-width:100%}}:host .hemfixarna_product--top h4{margin-bottom:8px}:host h5,:host p{margin:0}:host input[type=submit]{cursor:pointer}:host input[type=date]~label{left:56px}:host input[type=date]{border:1px solid #fcd9c9;padding-left:64px}:host input[type=checkbox]{height:18px;width:18px;border:1px solid #fcd9c9}:host input[type=checkbox]:checked{background:red}:host input[type=date]::-webkit-calendar-picker-indicator{background:transparent;bottom:0;color:transparent;cursor:pointer;height:auto;left:0;position:absolute;right:0;top:0;width:auto}:host button,:host a{cursor:pointer;background:none;border:none}:host ul{list-style:none;margin:0;padding:0}";
809
809
 
810
810
  const HemfixarnaComponent = class {
811
811
  constructor(hostRef) {
@@ -1854,7 +1854,7 @@ const HemfixarnaGetuser = class {
1854
1854
  }
1855
1855
  };
1856
1856
  this.render = () => {
1857
- return (h("form", { class: "mb-2", onSubmit: e => this.handleSubmit(e) }, h("div", null, h("input", { class: `${this.email.length ? 'input_active' : ''}`, onChange: e => this.handleChangeEmail(e), type: "email", name: "email", value: this.email }), h("label", { htmlFor: "email" }, "E-post ")), this.emailError && h("span", null, this.emailError), h("div", null, h("input", { class: `${this.phone.length ? 'input_active' : ''}`, onChange: e => this.handleChangePhone(e), type: "tel", name: "phone", value: this.phone }), h("label", { htmlFor: "phone" }, "Mobiltelefon ")), this.phoneError && h("span", null, this.phoneError), h("div", null, h("input", { class: `${this.ssn.length ? 'input_active' : ''}`, onChange: e => this.handleChangessn(e), type: "tel", name: "ssn", value: this.ssn }), h("label", { htmlFor: "phone" }, "Personnummer*")), this.ssnError && h("span", null, this.ssnError), h("input", { type: "submit", value: "Forts\u00E4tt och Boka*" }), h("p", null, "*Vi h\u00E4mtar din adress")));
1857
+ return (h("form", { class: "mb-2", onSubmit: e => this.handleSubmit(e) }, h("div", null, h("input", { class: `${this.email.length ? 'input_active' : ''}`, onChange: e => this.handleChangeEmail(e), type: "email", name: "email", value: this.email }), h("label", { htmlFor: "email" }, "E-post ")), this.emailError && h("span", null, this.emailError), h("div", null, h("input", { class: `${this.phone.length ? 'input_active' : ''}`, onChange: e => this.handleChangePhone(e), type: "tel", name: "phone", value: this.phone }), h("label", { htmlFor: "phone" }, "Mobiltelefon ")), this.phoneError && h("span", null, this.phoneError), h("div", null, h("input", { class: `${this.ssn.length ? 'input_active' : ''}`, onChange: e => this.handleChangessn(e), type: "tel", name: "ssn", value: this.ssn }), h("label", { htmlFor: "phone" }, "Personnummer*")), this.ssnError && h("span", null, this.ssnError), h("input", { type: "submit", value: "Forts\u00E4tt*" }), h("p", null, "*Vi h\u00E4mtar din adress")));
1858
1858
  };
1859
1859
  this.email = '';
1860
1860
  this.emailError = null;
@@ -2024,7 +2024,6 @@ const HemfixarnaProduct = class {
2024
2024
  name: state.selectedProduct.post_title,
2025
2025
  start_fee: !state.selectedProduct.hide_start_fee,
2026
2026
  terms_checkout: state.selectedProduct.terms_checkout,
2027
- terms_show_checkbox: state.selectedProduct.terms_show_checkbox,
2028
2027
  icon: state.selectedProduct.icon,
2029
2028
  },
2030
2029
  ];
@@ -2114,7 +2113,7 @@ const HemfixarnaProduct = class {
2114
2113
  state.selectedProduct.parts.map(p => {
2115
2114
  var _a;
2116
2115
  return (h("li", { class: "hemfixarna_part" }, h("div", null, h("p", null, (_a = p.title) !== null && _a !== void 0 ? _a : p.post_title), h("p", { class: "hemfixarna_product--price" }, getPartPrice(p, state.selectedProduct), "kr/st")), h("div", { class: "hemfixarna_counter" }, h("img", { class: `${this.getPartAmount(p.ID) === 0 ? 'disabled' : ''}`, src: minus, onClick: () => this.removePart(p) }), h("span", null, this.getPartAmount(p.ID)), h("img", { class: `${this.getAmount() === 0 ? 'disabled' : ''}`, src: plus, onClick: () => this.addPart(p) }))));
2117
- })), h("h4", { class: "hemfixarna_product--total" }, "Totalt ", this.getTotalPrice(), " kr"), h("button", { onClick: () => this.goToCart(), class: `hemfixarna_buy ${this.getAmount() === 0 ? 'disabled' : ''}` }, "Boka"), !state.selectedProduct.hide_start_fee && (state.selectedProduct.rot || state.selectedProduct.rut) && state.rutOptions && state.rotOptions && (h("p", { class: "hemfixarna_terms" }, h("strong", null, state.selectedProduct.rot ? state.rotOptions.rot_start_fee_heading : state.rutOptions.rut_start_fee_heading), h("br", null), h("span", { innerHTML: state.selectedProduct.rot ? state.rotOptions.rot_start_fee_text : state.rutOptions.rut_start_fee_text }))), state.options && h("hemfixarna-info", { list: state.options.trust })))));
2116
+ })), h("h4", { class: "hemfixarna_product--total" }, "Totalt ", this.getTotalPrice(), " kr"), h("button", { onClick: () => this.goToCart(), class: `hemfixarna_buy ${this.getAmount() === 0 ? 'disabled' : ''}` }, "Forts\u00E4tt"), !state.selectedProduct.hide_start_fee && (state.selectedProduct.rot || state.selectedProduct.rut) && state.rutOptions && state.rotOptions && (h("p", { class: "hemfixarna_terms" }, h("strong", null, state.selectedProduct.rot ? state.rotOptions.rot_start_fee_heading : state.rutOptions.rut_start_fee_heading), h("br", null), h("span", { innerHTML: state.selectedProduct.rot ? state.rotOptions.rot_start_fee_text : state.rutOptions.rut_start_fee_text }))), state.options && h("hemfixarna-info", { list: state.options.trust })))));
2118
2117
  }
2119
2118
  get el() { return getElement(this); }
2120
2119
  };
@@ -1 +1 @@
1
- {"file":"hemfixarna-address.hemfixarna-box.hemfixarna-breadcrumbs.hemfixarna-byggmax.hemfixarna-cart.hemfixarna-category.hemfixarna-checkout.hemfixarna-component.hemfixarna-demo.hemfixarna-getuser.hemfixarna-hornbach.hemfixarna-info.hemfixarna-kund.hemfixarna-order.hemfixarna-orderrows.hemfixarna-product.hemfixarna-service.hemfixarna-skanska.hemfixarna-start.hemfixarna-string-furniture.entry.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
1
+ {"file":"hemfixarna-address.hemfixarna-box.hemfixarna-breadcrumbs.hemfixarna-byggmax.hemfixarna-cart.hemfixarna-category.hemfixarna-checkout.hemfixarna-component.hemfixarna-demo.hemfixarna-getuser.hemfixarna-hornbach.hemfixarna-info.hemfixarna-kund.hemfixarna-order.hemfixarna-orderrows.hemfixarna-product.hemfixarna-service.hemfixarna-skanska.hemfixarna-start.hemfixarna-string-furniture.entry.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
@@ -1,2 +1,2 @@
1
- import{p as o,b as e}from"./p-62a7c1a2.js";export{s as setNonce}from"./p-62a7c1a2.js";const r=()=>{const e=import.meta.url;const r={};if(e!==""){r.resourcesUrl=new URL(".",e).href}return o(r)};r().then((o=>e([["p-33a71663",[[1,"hemfixarna-demo",{selectedSlug:[32],selectedID:[32],tooltipText:[32],tree:[32],customer:[32],widgetStyle:[32],buttonBg:[32],buttonColor:[32],colorAccessibility:[32]}],[1,"hemfixarna-byggmax",{slug:[1],id:[1],forceOldTree:[4,"force-old-tree"],loadFromQuery:[4,"load-from-query"],customer:[1],widgetStyle:[1,"widget-style"],buttonColor:[1,"button-color"],buttonBg:[1,"button-bg"],tree:[32]}],[1,"hemfixarna-hornbach",{id:[1],loadFromQuery:[4,"load-from-query"],isDemo:[4,"is-demo"],widgetStyle:[1,"widget-style"],buttonColor:[1,"button-color"],buttonBg:[1,"button-bg"]}],[1,"hemfixarna-kund",{id:[1],loadFromQuery:[4,"load-from-query"],widgetStyle:[1,"widget-style"],buttonColor:[1,"button-color"],buttonBg:[1,"button-bg"]}],[1,"hemfixarna-skanska",{id:[1],customer:[1],loadFromQuery:[4,"load-from-query"],widgetStyle:[1,"widget-style"],buttonColor:[1,"button-color"],buttonBg:[1,"button-bg"]}],[1,"hemfixarna-string-furniture",{id:[1],loadFromQuery:[4,"load-from-query"],widgetStyle:[1,"widget-style"],buttonColor:[1,"button-color"],buttonBg:[1,"button-bg"]}],[1,"hemfixarna-component",{slug:[1],id:[1],business:[1],topCategory:[1,"top-category"],forceOldTree:[4,"force-old-tree"],loadFromQuery:[4,"load-from-query"],isDemo:[4,"is-demo"],widgetStyle:[1,"widget-style"],nav:[16],buttonColor:[1,"button-color"],buttonBg:[1,"button-bg"],modal:[32],showModal:[32],tree:[32],product:[32],proppedProduct:[32]},[[0,"click","handleClick"]]],[0,"hemfixarna-cart",{tree:[16]}],[0,"hemfixarna-category"],[0,"hemfixarna-order",{tree:[16]}],[0,"hemfixarna-service"],[0,"hemfixarna-start",{tree:[16],slug:[1]}],[0,"hemfixarna-product",{amount:[32],hideDescription:[32]}],[0,"hemfixarna-breadcrumbs",{tree:[16],closeModal:[16],loadFromQuery:[4,"load-from-query"],isDemo:[4,"is-demo"]}],[0,"hemfixarna-checkout",{date:[32],dateError:[32],generalError:[32],loading:[32]}],[0,"hemfixarna-address",{street:[32],streetError:[32],zip:[32],zipError:[32],town:[32],townError:[32]}],[0,"hemfixarna-getuser",{email:[32],emailError:[32],phone:[32],phoneError:[32],ssn:[32],ssnError:[32]}],[0,"hemfixarna-orderrows",{cart:[4],tree:[16]}],[0,"hemfixarna-box",{post:[16],category:[16],icon:[1],postTitle:[1,"post-title"]}],[0,"hemfixarna-info",{list:[16]}]]]],o)));
1
+ import{p as o,b as e}from"./p-62a7c1a2.js";export{s as setNonce}from"./p-62a7c1a2.js";const r=()=>{const e=import.meta.url;const r={};if(e!==""){r.resourcesUrl=new URL(".",e).href}return o(r)};r().then((o=>e([["p-96c4d08c",[[1,"hemfixarna-demo",{selectedSlug:[32],selectedID:[32],tooltipText:[32],tree:[32],customer:[32],widgetStyle:[32],buttonBg:[32],buttonColor:[32],colorAccessibility:[32]}],[1,"hemfixarna-byggmax",{slug:[1],id:[1],forceOldTree:[4,"force-old-tree"],loadFromQuery:[4,"load-from-query"],customer:[1],widgetStyle:[1,"widget-style"],buttonColor:[1,"button-color"],buttonBg:[1,"button-bg"],tree:[32]}],[1,"hemfixarna-hornbach",{id:[1],loadFromQuery:[4,"load-from-query"],isDemo:[4,"is-demo"],widgetStyle:[1,"widget-style"],buttonColor:[1,"button-color"],buttonBg:[1,"button-bg"]}],[1,"hemfixarna-kund",{id:[1],loadFromQuery:[4,"load-from-query"],widgetStyle:[1,"widget-style"],buttonColor:[1,"button-color"],buttonBg:[1,"button-bg"]}],[1,"hemfixarna-skanska",{id:[1],customer:[1],loadFromQuery:[4,"load-from-query"],widgetStyle:[1,"widget-style"],buttonColor:[1,"button-color"],buttonBg:[1,"button-bg"]}],[1,"hemfixarna-string-furniture",{id:[1],loadFromQuery:[4,"load-from-query"],widgetStyle:[1,"widget-style"],buttonColor:[1,"button-color"],buttonBg:[1,"button-bg"]}],[1,"hemfixarna-component",{slug:[1],id:[1],business:[1],topCategory:[1,"top-category"],forceOldTree:[4,"force-old-tree"],loadFromQuery:[4,"load-from-query"],isDemo:[4,"is-demo"],widgetStyle:[1,"widget-style"],nav:[16],buttonColor:[1,"button-color"],buttonBg:[1,"button-bg"],modal:[32],showModal:[32],tree:[32],product:[32],proppedProduct:[32]},[[0,"click","handleClick"]]],[0,"hemfixarna-cart",{tree:[16]}],[0,"hemfixarna-category"],[0,"hemfixarna-order",{tree:[16]}],[0,"hemfixarna-service"],[0,"hemfixarna-start",{tree:[16],slug:[1]}],[0,"hemfixarna-product",{amount:[32],hideDescription:[32]}],[0,"hemfixarna-breadcrumbs",{tree:[16],closeModal:[16],loadFromQuery:[4,"load-from-query"],isDemo:[4,"is-demo"]}],[0,"hemfixarna-checkout",{date:[32],dateError:[32],generalError:[32],loading:[32]}],[0,"hemfixarna-address",{street:[32],streetError:[32],zip:[32],zipError:[32],town:[32],townError:[32]}],[0,"hemfixarna-getuser",{email:[32],emailError:[32],phone:[32],phoneError:[32],ssn:[32],ssnError:[32]}],[0,"hemfixarna-orderrows",{cart:[4],tree:[16]}],[0,"hemfixarna-box",{post:[16],category:[16],icon:[1],postTitle:[1,"post-title"]}],[0,"hemfixarna-info",{list:[16]}]]]],o)));
2
2
  //# sourceMappingURL=hemfixarna-components.esm.js.map
@@ -0,0 +1,2 @@
1
+ import{g as t,f as i,r as e,h as n,a as s,F as a,c as r}from"./p-62a7c1a2.js";const o=(t,i,e)=>{const n=t.get(i);if(!n){t.set(i,[e])}else if(!n.includes(e)){n.push(e)}};const l=(t,i)=>{let e;return(...n)=>{if(e){clearTimeout(e)}e=setTimeout((()=>{e=0;t(...n)}),i)}};const h=t=>!("isConnected"in t)||t.isConnected;const c=l((t=>{for(let i of t.keys()){t.set(i,t.get(i).filter(h))}}),2e3);const u=()=>{if(typeof t!=="function"){return{}}const e=new Map;return{dispose:()=>e.clear(),get:i=>{const n=t();if(n){o(e,i,n)}},set:t=>{const n=e.get(t);if(n){e.set(t,n.filter(i))}c(e)},reset:()=>{e.forEach((t=>t.forEach(i)));c(e)}}};const d=t=>typeof t==="function"?t():t;const p=(t,i=((t,i)=>t!==i))=>{const e=d(t);let n=new Map(Object.entries(e!==null&&e!==void 0?e:{}));const s={dispose:[],get:[],set:[],reset:[]};const a=()=>{var i;n=new Map(Object.entries((i=d(t))!==null&&i!==void 0?i:{}));s.reset.forEach((t=>t()))};const r=()=>{s.dispose.forEach((t=>t()));a()};const o=t=>{s.get.forEach((i=>i(t)));return n.get(t)};const l=(t,e)=>{const a=n.get(t);if(i(e,a,t)){n.set(t,e);s.set.forEach((i=>i(t,e,a)))}};const h=typeof Proxy==="undefined"?{}:new Proxy(e,{get(t,i){return o(i)},ownKeys(t){return Array.from(n.keys())},getOwnPropertyDescriptor(){return{enumerable:true,configurable:true}},has(t,i){return n.has(i)},set(t,i,e){l(i,e);return true}});const c=(t,i)=>{s[t].push(i);return()=>{f(s[t],i)}};const u=(i,e)=>{const n=c("set",((t,n)=>{if(t===i){e(n)}}));const s=c("reset",(()=>e(d(t)[i])));return()=>{n();s()}};const p=(...t)=>{const i=t.reduce(((t,i)=>{if(i.set){t.push(c("set",i.set))}if(i.get){t.push(c("get",i.get))}if(i.reset){t.push(c("reset",i.reset))}if(i.dispose){t.push(c("dispose",i.dispose))}return t}),[]);return()=>i.forEach((t=>t()))};const m=t=>{const i=n.get(t);s.set.forEach((e=>e(t,i,i)))};return{state:h,get:o,set:l,on:c,onChange:u,use:p,dispose:r,reset:a,forceUpdate:m}};const f=(t,i)=>{const e=t.indexOf(i);if(e>=0){t[e]=t[t.length-1];t.length--}};const m=(t,i)=>{const e=p(t,i);e.use(u());return e};const{state:x,onChange:g}=m({step:1,checkoutStep:1,checkoutEdit:false,selectedCategory:null,selectedService:null,selectedProduct:null,cart:[],business:"undefined",options:null,rut:true,rot:true,token:null,user:null,modal:null,rutOptions:null,rotOptions:null,customer:null,selectedCustomerCategory:null,parentCategory:null,creditSafeUser:null});g("cart",(t=>{window.sessionStorage.setItem(`hemfixarna-${x.business}-cart`,JSON.stringify(t))}));g("user",(t=>{window.sessionStorage.setItem(`hemfixarna-${x.business}-user`,JSON.stringify(t))}));g("creditSafeUser",(t=>{window.sessionStorage.setItem(`hemfixarna-${x.business}-creditSafeUser`,JSON.stringify(t))}));g("selectedProduct",(t=>{if(!x.customer||!t)return;const i=[...x.customer.categories,...x.customer.categories.map((t=>{var i;return(i=t.sub_categories)!==null&&i!==void 0?i:[]}))].flat();const e=i.find((i=>i&&i.id===t.category));if(e){x.parentCategory=e;return}x.parentCategory=null}));g("selectedCustomerCategory",(t=>{if(!x.customer||!t)return;if(t.parent){const i=x.customer.categories.find((i=>i.id===t.parent));if(i){x.parentCategory=i;return}}x.parentCategory=null}));const b=t=>t.split(" ").reduce(((t,i)=>{if(i.length<=2){return t+i.slice(0,1)+"* "}else{return t+i.slice(0,1)+"*".repeat(i.length-2)+i.slice(-1)+" "}}),"");const v=t=>{if(!t)return;t.scrollTo({top:0,behavior:"smooth"})};const _=class{constructor(t){e(this,t);this.handleSubmit=t=>{t.preventDefault();const i=this.street.length>0;if(!i){this.streetError="Ange en gatuadress"}const e=this.zip.length>0;const n=/^\s*\d[\d\s]*$/.test(this.zip);if(!n){this.zipError="Postnummer får endast innehålla siffror"}if(!e){this.zipError="Ange ett postnummer"}const s=/^[^\d\s]{2,}$/.test(this.town);if(!s){this.townError="Ange en ort"}if(i&&e&&s&&n){x.user=Object.assign(Object.assign({},x.user),{street:this.street,zip:this.zip,town:this.town});x.checkoutStep=2;x.checkoutEdit=false;const t=this.el.closest(".hemfixarna_content");v(t)}};this.handleChangeStreet=t=>{this.streetError=null;this.street=this.street===x.user.street?"":t.target.value};this.handleChangeZip=t=>{this.zipError=null;this.zip=this.zip===x.user.zip?"":t.target.value};this.handleChangeTown=t=>{this.townError=null;this.town=this.town===x.user.town?"":t.target.value};this.render=()=>n("form",{class:"hemfixarna_address",onSubmit:t=>this.handleSubmit(t)},n("div",null,n("input",{class:`${this.street.length?"input_active":""}`,onInput:this.handleChangeStreet,type:"text",name:"street",value:this.street===x.user.street?b(this.street):this.street}),n("label",{htmlFor:"street"},"Gatuaddress ")),this.streetError&&n("span",null,this.streetError),n("div",null,n("input",{class:`${this.zip.length?"input_active":""}`,onInput:this.handleChangeZip,type:"tel",name:"zip",value:this.zip===x.user.zip?b(this.zip):this.zip}),n("label",{htmlFor:"zip"},"Postnummer ")),this.zipError&&n("span",null,this.zipError),n("div",null,n("input",{class:`${this.town.length?"input_active":""}`,onInput:this.handleChangeTown,type:"text",name:"town",value:this.town===x.user.town?b(this.town):this.town}),n("label",{htmlFor:"town"},"Ort ")),this.townError&&n("span",null,this.townError),n("input",{type:"submit",value:"Fortsätt"}));this.street="";this.streetError=null;this.zip="";this.zipError=null;this.town="";this.townError=null}componentWillLoad(){if(x.user){this.street=x.user.street;this.zip=x.user.zip;this.town=x.user.town}}get el(){return s(this)}};const y=t=>Math.ceil(t/2);const w=t=>Math.ceil(t*.7);const k=(t,i,e=1)=>{if(t.rot&&x.rot){return w((i||t.price)*e)}else if(t.rut&&x.rut){return y((i||t.price)*e)}else{return(i||t.price)*e}};const C=t=>{if(t.rot){return w(t.price)}else if(t.rut&&x.rut){return y(t.price)}else{return t.price}};const $=(t,i,e=1)=>{if(i.rot&&x.rot){return w(t.price*e)}else if(i.rut&&x.rut){return y(t.price*e)}else{return t.price*e}};const S=()=>{if(!x.cart)return{rut:0,rot:0};const t=x.cart.some((t=>t.rut&&t.start_fee));const i=x.cart.some((t=>t.rot&&t.start_fee));const e=x.rut?y(x.options.start_fee):x.options.start_fee*1;const n=x.rot?w(x.options.start_fee):x.options.start_fee*1;if(t&&i){return{rut:e,rot:n,length:2}}else if(t){return{rut:e,rot:0,length:1}}else if(i){return{rut:0,rot:n,length:1}}else{return{rut:0,rot:0,length:0}}};const T=t=>{const i=t.parts.reduce(((t,i)=>t+i.price*i.amount),0);return k(t,t.price*t.amount+i)};const z=()=>{const t=x.cart.reduce(((t,i)=>i.rot?t+T(i):t),0)+S().rot;const i=x.cart.reduce(((t,i)=>{const e=i.parts.reduce(((t,i)=>t+i.price*i.amount),0);return i.rot?t+i.price*i.amount+e:t}),0)+Number(x.options.start_fee);return i-t};const j=()=>{const t=x.cart.reduce(((t,i)=>i.rut?t+T(i):t),0)+S().rut;const i=x.cart.reduce(((t,i)=>{const e=i.parts.reduce(((t,i)=>t+i.price*i.amount),0);return i.rut?t+i.price*i.amount+e:t}),0)+Number(x.options.start_fee);return i-t};const O=()=>x.cart.reduce(((t,i)=>t+T(i)),0)+S().rot+S().rut;const I=t=>t.post_name!==undefined;const N=class{constructor(t){e(this,t);this.post=undefined;this.category=undefined;this.icon=undefined;this.postTitle=undefined}setTaxonomy(t){if(t){if((t===null||t===void 0?void 0:t.taxonomy)==="service_cat"){x.selectedCategory=t;x.step=2}else if((t===null||t===void 0?void 0:t.post_type)==="service"){x.selectedService=t;x.step=3}else if((t===null||t===void 0?void 0:t.post_type)==="ikea_product"){x.selectedProduct=t;x.step=4}const i=this.el.closest(".hemfixarna_content");v(i)}}setProduct(){x.selectedProduct=this.category;x.step=4;x.selectedCustomerCategory=null;const t=this.el.closest(".hemfixarna_content");v(t)}render(){return this.category?n(a,null,I(this.category)?n("li",{onClick:()=>this.setProduct()},n("img",{class:"hemfixarna_logo",height:82,src:this.category.icon,alt:this.category.post_name}),n("div",null,n("p",null,this.category.post_title),n("p",{class:"price"},"Från ",k(this.category),"kr"))):n("li",{onClick:()=>x.selectedCustomerCategory=this.category},n("img",{class:"hemfixarna_logo",height:82,src:this.category.icon,alt:this.category.name}),n("div",null,n("p",null,this.category.name)))):n("li",{onClick:()=>this.setTaxonomy(this.post)},this.post.icon&&n("img",{class:"hemfixarna_logo",height:82,src:this.icon,alt:this.postTitle}),n("div",null,n("p",null,this.postTitle),x.step===3&&n("p",{class:"price"},"Från ",k(this.post),"kr")))}get el(){return s(this)}};const A=class{constructor(t){e(this,t);this.triggerScrollTotop=()=>{const t=this.el.nextSibling;v(t)};this.tree=undefined;this.closeModal=undefined;this.loadFromQuery=false;this.isDemo=false}getCartLength(){return x.cart.reduce(((t,i)=>t+i.amount),0)}handleCartClick(){var t;if((t=x.cart)===null||t===void 0?void 0:t.length){x.step=5;this.triggerScrollTotop()}}handleHomePageClick(){x.step=1;x.parentCategory=null;x.selectedCustomerCategory=null;this.triggerScrollTotop();setTimeout((()=>{x.selectedCategory=null;x.selectedProduct=null;x.selectedService=null}),200)}render(){const t=r(`./assets/hemfixarna.svg`);const i=r(`./assets/close.svg`);const e=r(`./assets/cart.svg`);const s=r(`./assets/back.svg`);return n("div",null,n("div",{class:"hemfixarna_crumbs"},n("div",{class:"hemfixarna_crumbs--links"},n("img",{onClick:()=>this.handleHomePageClick(),src:t,width:110}),!this.loadFromQuery||this.isDemo?n("img",{onClick:()=>this.closeModal(),class:"close",src:i,width:32}):null,n("div",null,n("button",{onClick:()=>this.handleHomePageClick()},"Alla tjänster"))),n("div",{onClick:()=>this.handleCartClick(),class:`cart ${this.getCartLength()>0?"cart_active":""}`},n("img",{src:e,width:24}),n("span",null,this.getCartLength()))),[3,4].includes(x.step)&&!x.customer&&n("button",{class:"hemfixarna_crumbs--back",onClick:()=>{x.step=x.step===4?3:2}},n("img",{width:24,src:s,alt:"back arrow"}),n("span",null,"Se allt ",x.step===4?x.selectedService.post_title:x.selectedCategory.name)),x.parentCategory&&x.step<5&&n("button",{class:"hemfixarna_crumbs--back",onClick:()=>{x.step=1;x.selectedCustomerCategory=x.parentCategory;x.selectedProduct=null}},n("img",{width:24,src:s,alt:"back arrow"}),n("span",null,"Se allt ",x.parentCategory.name)))}get el(){return s(this)}};var F;(function(t){t["kund"]="kund";t["byggmax"]="byggmax";t["skanska"]="skanska";t["string"]="string-furniture";t["hornbach"]="hornbach"})(F||(F={}));var L;(function(t){t["standard"]="standard";t["alternative"]="alternative";t["alternative_2"]="alternative_2";t["alternative_3"]="alternative_3"})(L||(L={}));var M;(function(t){t["byggmax"]="category/bygg"})(M||(M={}));const P="";const D=class{constructor(t){e(this,t);this.tree=null;this.slug=undefined;this.id=undefined;this.forceOldTree=false;this.loadFromQuery=false;this.customer=undefined;this.widgetStyle=L.standard;this.buttonColor=undefined;this.buttonBg=undefined}render(){return n("hemfixarna-component",{forceOldTree:this.forceOldTree,id:this.id,slug:this.slug,business:F.byggmax,topCategory:M.byggmax,loadFromQuery:this.loadFromQuery,widgetStyle:this.widgetStyle,buttonBg:this.buttonBg,buttonColor:this.buttonColor})}};D.style=P;const B=class{constructor(t){e(this,t);this.tree=undefined}render(){const t=r(`./assets/back.svg`);return n("div",{class:"hemfixarna_cart"},n("div",{class:"hemfixarna_cart--left"},n("h2",null,x.checkoutStep===2&&!x.checkoutEdit&&n("button",{onClick:()=>{x.checkoutStep=1}},n("img",{width:24,src:t,alt:"back arrow"})),"Din bokning"),n("hemfixarna-orderrows",{tree:this.tree})),n("div",{class:"hemfixarna_cart--right"},n("h2",null,x.checkoutStep===2&&!x.checkoutEdit&&n("button",{onClick:()=>{x.checkoutStep=1}},n("img",{width:24,src:t,alt:"back arrow"})),"Dina uppgifter"),n("hemfixarna-checkout",null),n("hemfixarna-info",null)))}};const K=class{constructor(t){e(this,t)}setSelectedService(t){x.selectedService=t;x.step=3}render(){return n("div",null,n("h2",null,x.selectedCategory.name),n("div",{class:"hemfixarna_categories--wrapper"},n("div",null,n("ul",{class:"hemfixarna_categories"},x.selectedCategory.services.sort(((t,i)=>t.post_title<i.post_title?-1:1)).map((t=>{var i;return n("hemfixarna-box",{post:t,icon:(i=t.icon.url)!==null&&i!==void 0?i:t.icon,postTitle:t.post_title})})))),n("hemfixarna-info",{list:x.options.trust})))}};const U=`${"https://hemfixarna.se"}/wp-json/headless`;async function J(t,i){const e=await fetch(t,i);const n=await e.json();return n}const R=async t=>{if(!t){return}const i=t.split("/")[0];const e=t.split("/")[1];try{const t=await fetch(`${U}/${i}/${e}`);return await t.json()}catch(t){console.log(t)}};const H=async t=>{try{const i=await fetch(`${U}/customer/${t}`);return await i.json()}catch(t){console.log(t)}};const W=async()=>{try{const t=await fetch(`${U}/webcoptions`);return await t.json()}catch(t){console.log(t)}};const E=async()=>{try{const t=await J(`${U}/rut`);return t}catch(t){console.log(t)}};const X=async()=>{try{const t=await fetch(`${U}/rot`);return await t.json()}catch(t){console.log(t)}};const V=async t=>{try{const i=await fetch(`${U}/weborder`,{method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json"}});return await i.json()}catch(t){console.log(t)}};const Q=`${"https://hemfixarna.se"}/wp-json/felix`;const Y=async t=>{try{return await J(`${Q}/createperson`,{method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json"}})}catch(t){console.log(t)}};const q=class{constructor(t){e(this,t);this.handleChangeDate=t=>{this.dateError=null;this.date=t.target.value};this.handleChangeTerms=()=>{this.generalError=null};this.sendOrder=async()=>{var t,i;if(this.loading)return;this.loading=true;let e={firstName:x.creditSafeUser.firstName,lastName:x.creditSafeUser.lastName,street:x.user.street,zip:x.user.zip,town:x.user.town,ssn:x.user.ssn,email:x.user.email,phone:x.user.phone,url:`${x.business===F.string?"string":x.business}-webk`,date:this.date,products:[...x.cart.map((t=>{const i=t.parts.map((t=>({id:String(t.id),name:t.name,quantity:t.amount,rut:0,rot:0})));return[{id:String(t.id),name:t.name,quantity:t.amount,rot:t.rot?1:0,rut:t.rut?1:0},...i]}))].flat(),creditSafe:x.creditSafeUser,customer:x.business};const n=await Y(e);if(!n||!((i=(t=n.response)===null||t===void 0?void 0:t.scriptResult)===null||i===void 0?void 0:i.includes("OK"))){e=Object.assign(Object.assign({},e),{felixStatus:"error"})}else{e=Object.assign(Object.assign({},e),{felixStatus:"success"})}try{const{data:t,status:i}=await V(e);if(t&&i&&i===200){x.step=6;const t=this.el.closest(".hemfixarna_content");v(t)}else{this.generalError="Något gick fel, försök igen senare"}}catch(t){this.generalError="Något gick fel, försök igen senare"}this.loading=false};this.handleSubmit=t=>{t.preventDefault();this.generalError=null;const i=this.date.length>0;if(!i){this.dateError="Ange ett giltigt datum"}const e=Array.from(this.el.querySelectorAll('input[type="checkbox"]'));const n=e.find((t=>!t.checked));if(n){this.generalError="Du måste godkänna villkoren"}if(i&&!n){this.sendOrder()}};this.render=()=>{const t=r(`./assets/date.svg`);const i=r(`./assets/down.svg`);const e=r(`./assets/spinner.gif`);if(x.checkoutEdit){return n("hemfixarna-address",null)}else if(x.checkoutStep===1){return n("hemfixarna-getuser",null)}else if(x.checkoutStep===2){return n("div",{class:"mb-2"},n("div",{class:"hemfixarna_addressinfo"},n("div",null,n("p",null,b(x.user.firstName)),n("p",null,b(x.user.lastName)),n("p",null,x.user.email),n("p",null,x.user.phone)),n("div",null,n("p",null,b(x.user.street)),n("p",null,b(x.user.zip)),n("p",null,b(x.user.town))),n("button",{onClick:()=>x.checkoutEdit=true},"Behöver du ändra adressen?")),n("form",{onSubmit:t=>this.handleSubmit(t)},n("div",null,n("img",{src:t,width:24}),n("input",{class:`${this.date.length?"input_active":""}`,min:(new Date).toISOString().split("T")[0],onChange:t=>this.handleChangeDate(t),type:"date",name:"date",value:this.date}),n("label",{htmlFor:"date"},"Tidigaste datum för hembesök"),n("img",{src:i,width:24})),this.dateError&&n("span",null,this.dateError),n("label",{class:"hemfixarna_checkbox"},n("input",{onChange:()=>this.handleChangeTerms(),type:"checkbox"}),n("span",{innerHTML:x.options.terms})),x.cart.filter((t=>{var i;return(i=t.terms_checkout)===null||i===void 0?void 0:i.length})).map((t=>n(a,null,n("label",{class:"hemfixarna_checkbox"},n("input",{onChange:()=>this.handleChangeTerms(),type:"checkbox"}),n("span",null,t.terms_checkout))))),this.generalError&&n("span",null,this.generalError),n("div",{class:this.loading?"loading":""},n("input",{type:"submit",value:this.loading?"":"Skicka bokning"}),n("img",{width:20,height:20,src:e,alt:"spinner"}))))}};this.date="";this.dateError=null;this.generalError=null;this.loading=false}componentWillLoad(){if(Boolean(x.user&&x.user.street)){x.checkoutStep=2}}get el(){return s(this)}};const G='@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap"); *{box-sizing:border-box}:host{font-family:"Inter", sans-serif}:host .mb-2{margin-bottom:32px}:host button{color:#474444}:host form{display:flex;flex-direction:column;gap:16px}:host form img{position:absolute;top:50%;transform:translateY(-50%);pointer-events:none}:host form img:first-of-type{left:16px}:host form img:last-of-type{right:16px}:host form span{margin-top:-8px;color:#ec6632}:host form p{text-align:center}:host form p{margin:0}:host form div{position:relative}:host form div label{pointer-events:none;position:absolute;left:16px;top:50%;transform:translateY(-50%);background:#fff;padding:4px;transition:0.2s all cubic-bezier(0.465, 0.183, 0.153, 0.946)}:host form div input{padding:16px;width:100%;font-size:16px;border:1px solid #fcd9c9}:host form div input:focus~label,:host form div .input_active~label{top:0;transform:translateY(-50%);background:linear-gradient(180deg, #fffaf2 50%, #fff 50%)}:host h1{font-size:24px;font-weight:400;line-height:32px;letter-spacing:-3%;text-align:left;margin:0 0 8px}:host h2{margin:0 0 24px;font-weight:700;font-size:20px;line-height:28px;letter-spacing:-3%}:host p{font-size:16px;font-weight:400;line-height:24px;letter-spacing:-3%}:host .hemfixarna{width:100%;}:host .hemfixarna_nav{position:absolute;top:0;width:100dvw;left:0;height:80px;z-index:9999}:host .hemfixarna_nav--links{display:none !important}@media (min-width: 769px){:host .hemfixarna_nav--links{display:flex !important}}:host .hemfixarna_nav--links a{color:#ec6632;text-decoration:none;border:1px solid rgba(255, 255, 255, 0.3);border-radius:56px;padding:8px 32px;text-transform:capitalize}:host .hemfixarna_nav>div{position:relative;overflow:hidden;width:100%;height:100%;display:flex;justify-content:space-between;align-items:center;padding:0 16px}@media (min-width: 769px){:host .hemfixarna_nav>div{padding:0 32px}}:host .hemfixarna_nav>div>div{display:flex;gap:32px;justify-content:space-between}:host .hemfixarna_nav>div>img{position:absolute;width:100%;height:100%;top:0;left:0;z-index:-1}:host .hemfixarna_nav p{color:#fff}:host .hemfixarna_standalone .hemfixarna_backdrop{background:#fffaf2;opacity:1}:host .hemfixarna_standalone .hemfixarna_modal{top:80px;transform:translateX(-50%);border:none;height:calc(100dvh - 80px);opacity:0}:host .hemfixarna_standalone .hemfixarna_modal--open{opacity:1}:host .hemfixarna .switch{position:relative;display:inline-block;width:40px;height:20px}:host .hemfixarna .switch input{opacity:0;width:0;height:0}:host .hemfixarna .slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:#ccc;-webkit-transition:0.4s;transition:0.4s;border-radius:34px}:host .hemfixarna .slider:before{position:absolute;content:"";height:18px;width:18px;left:2px;bottom:1px;background-color:white;-webkit-transition:0.4s;transition:0.4s;border-radius:50%}:host .hemfixarna input:checked+.slider{background-color:#fcd9c9}:host .hemfixarna input:focus+.slider{box-shadow:0 0 1px #fcd9c9}:host .hemfixarna input:checked+.slider:before{-webkit-transform:translateX(18px);-ms-transform:translateX(18px);transform:translateX(18px);background:#ec6632}:host .hemfixarna_checkbox{display:grid;grid-template-columns:40px auto;font-size:16px;font-weight:400;line-height:24px;letter-spacing:-3%}:host .hemfixarna_checkbox>span{transform:translateY(6px)}:host .hemfixarna_checkbox span,:host .hemfixarna_checkbox span p{color:#474444;font-size:14px}:host .hemfixarna_checkbox p{text-align:left}:host .hemfixarna_info{display:flex;flex-direction:column;gap:24px;padding:32px;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);border-radius:4px;border:1px solid #fcd9c9}:host .hemfixarna_info h2{margin:0}@media (min-width: 769px){:host .hemfixarna_info{position:sticky;top:0}}:host .hemfixarna_infomodal{position:absolute;top:40%;left:50%;transform:translate(-50%, -50%);width:100%;max-width:80%;background:#fffaf2;border:1px solid #fcd9c9;padding:32px;z-index:99;border-radius:4px;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);display:flex;flex-direction:column;gap:16px}:host .hemfixarna_infomodal p,:host .hemfixarna_infomodal h4{margin:0}:host .hemfixarna_infomodal button{background:#ec6632;color:#fff;border-radius:60px;font-size:16px;padding:8px 16px}:host .hemfixarna_addressinfo{padding:16px 16px 64px;border:1px solid #fcd9c9;position:relative;margin-bottom:32px;display:grid;grid-template-columns:1fr;gap:8px}@media (min-width: 769px){:host .hemfixarna_addressinfo{grid-template-columns:1fr 1fr}}:host .hemfixarna_addressinfo button{position:absolute;bottom:16px;right:16px;font-weight:500;text-underline-offset:2px;text-decoration:underline}:host .hemfixarna_part{background:#fff;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);display:grid;padding:16px;grid-template-columns:auto 75px}:host .hemfixarna_counter{display:flex;align-items:center}:host .hemfixarna_counter span{padding:0 8px}:host .hemfixarna_counter img{cursor:pointer}:host .hemfixarna_counter img:not(.disabled):hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_description{display:grid;gap:16px}:host .hemfixarna_description ul{list-style:disc;padding-right:12px;transform:translateX(12px)}:host .hemfixarna_description--hidden{max-height:140px;overflow:hidden;position:relative;cursor:pointer}:host .hemfixarna_description--hidden::after{content:"";position:absolute;bottom:0;left:0;right:0;height:128px;background:linear-gradient(180deg, rgba(255, 253, 250, 0), rgba(255, 253, 250, 0.46) 50%, #fffaf2)}:host .hemfixarna_terms{font-size:14px}:host .hemfixarna_terms a{color:inherit}:host .hemfixarna_logo{height:64px}:host .hemfixarna_box{padding:16px;display:flex;align-items:center;width:100%;box-sizing:border-box;border-radius:4px;gap:16px 8px;border-radius:4px;gap:16px 8px}:host .hemfixarna_box p,:host .hemfixarna_box span{font-size:15px}:host .hemfixarna_box .underline{text-decoration:underline;text-underline-offset:2px}:host .hemfixarna_box .pointer{cursor:pointer}:host .hemfixarna_box .p-s{font-size:12px}:host .hemfixarna_box>div{display:grid;gap:8px}:host .hemfixarna_box--standard{background:#fffaf2;border:1px solid #fcd9c9}:host .hemfixarna_box--alternative,:host .hemfixarna_box--alternative_2,:host .hemfixarna_box--alternative_3{background:transparent;border:1px solid #e3e3e3}:host .hemfixarna_box--alternative_2,:host .hemfixarna_box--alternative_3{box-shadow:0px 2px 16px 0px rgba(0, 0, 0, 0.0784313725)}:host .hemfixarna_box--alternative_3{justify-content:center}:host .hemfixarna_altbtn{display:flex !important;flex-direction:column;gap:8px;align-items:center;margin-left:auto}:host .hemfixarna_btn{margin-left:auto}:host .hemfixarna_btn,:host .hemfixarna_buy,:host .hemfixarna input[type=submit]{border:none;border-radius:60px;font-weight:600;letter-spacing:0.5px;line-height:20px;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_btn:not(.disabled):hover,:host .hemfixarna_buy:not(.disabled):hover,:host .hemfixarna input[type=submit]:not(.disabled):hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna div:has(>input[type=submit]){position:relative}:host .hemfixarna div:has(>input[type=submit]) input{cursor:pointer}:host .hemfixarna div:has(>input[type=submit]) img{display:none}:host .hemfixarna .loading{cursor:default;opacity:0.6}:host .hemfixarna .loading>img{display:initial !important;position:absolute;top:50%;left:50%;transform:translate(-50%, -50%)}:host .hemfixarna_btn{font-size:14px;background:#c84e18;color:#fff;padding:16px 24px;white-space:nowrap;position:relative}:host .hemfixarna_btn span{position:absolute;background:#fff;border-radius:100%;width:24px;height:24px;display:flex;justify-content:center;align-items:center;font-weight:600;font-size:13px;line-height:11px;top:-8px;right:-12px}:host .hemfixarna_btn span{background:#25a710;color:#fff;right:0 !important}:host .hemfixarna_buy,:host .hemfixarna input[type=submit]{font-size:21px;background:#25a710;color:#fff;padding:16px 24px}:host .hemfixarna .disabled{opacity:0.5;cursor:default}:host .hemfixarna_modal{position:fixed;background:#fffaf2;border:1px solid #fcd9c9;border-radius:4px;top:50%;left:50%;z-index:1000;transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);transform:translate(-50%, -50%) scale(0.7);opacity:0;height:92%;width:92%;max-width:920px;display:flex;flex-direction:column;gap:8px}:host .hemfixarna_modal--open{opacity:1;transform:translate(-50%, -50%) scale(1)}:host .hemfixarna_backdrop{z-index:999;position:fixed;background:#474444;top:0;left:0;bottom:0;right:0;opacity:0;transition:transform 0.1s cubic-bezier(0.465, 0.183, 0.153, 0.946), opacity 0.1s cubic-bezier(0.465, 0.183, 0.153, 0.946)}:host .hemfixarna_backdrop--open{opacity:0.3}:host .hemfixarna_order{position:absolute;top:-1px;left:-1px;right:-1px;bottom:-1px;background-repeat:no-repeat !important;background-size:cover !important;background-position:center !important;display:grid;grid-template-columns:1fr 1fr;padding:48px 32px 64px}@media (max-width: 768px){:host .hemfixarna_order{grid-template-columns:1fr;grid-template-rows:0 auto}}:host .hemfixarna_order>div:last-of-type{background:#fffaf2;padding:32px;display:flex;flex-direction:column;max-height:100%;overflow:auto}:host .hemfixarna_order img{cursor:pointer}:host .hemfixarna_order button{margin:16px 0;padding:0;text-decoration:underline;text-underline-offset:2px;font-size:14px;font-weight:600}:host .hemfixarna_cart{display:grid;grid-template-columns:1fr 1fr;gap:32px}@media (max-width: 768px){:host .hemfixarna_cart{grid-template-columns:1fr;gap:0}}:host .hemfixarna_cart--right h2,:host .hemfixarna_cart--left h2{display:flex;align-items:center}:host .hemfixarna_cart--right h2 img,:host .hemfixarna_cart--left h2 img{margin-top:3.2px}@media (min-width: 769px){:host .hemfixarna_cart--left h2 button{display:none}}@media (max-width: 768px){:host .hemfixarna_cart--right h2 button{display:none}}:host .hemfixarna_cart--startfee{display:flex;justify-content:space-between}:host .hemfixarna_cart--rutrot{display:flex;justify-content:space-between}:host .hemfixarna_cart--rutrot div{display:flex;gap:16px;align-items:center}:host .hemfixarna_cart--additional{display:flex;flex-direction:column;gap:16px;padding:16px;border-top:1px solid #fcd9c9}:host .hemfixarna_cart--additional p{font-size:14px}:host .hemfixarna_cart--additional strong{text-decoration:underline;text-underline-offset:2px;cursor:pointer;position:relative}:host .hemfixarna_cart--additional strong img{position:absolute;top:50%;transform:translateY(-50%);right:-24px}:host .hemfixarna_cart--price{border-top:1px solid #fcd9c9;padding:16px;display:flex;justify-content:space-between}:host .hemfixarna_cart--price h3{margin:0}:host .hemfixarna_cart--item{display:flex;flex-direction:column;gap:8px;padding:16px 0;border-top:1px solid #fcd9c9}:host .hemfixarna_cart--item>div{display:flex;justify-content:space-between}:host .hemfixarna_cart--item>div>div{display:flex;align-items:center;gap:16px}:host .hemfixarna_cart--item>div button{color:#ec6632}:host .hemfixarna_categories{display:grid;gap:24px}:host .hemfixarna_categories--wrapper{gap:32px;display:grid;grid-template-columns:1fr 1fr}@media (max-width: 768px){:host .hemfixarna_categories--wrapper{grid-template-columns:1fr}}:host .hemfixarna_categories li{position:relative;background:#fff;border-radius:4px;min-height:132px;padding:24px;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);display:flex;align-items:center;gap:24px;cursor:pointer}:host .hemfixarna_categories li:hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_categories li>button{height:100%;width:100%}:host .hemfixarna_categories li .price{font-weight:700}:host .hemfixarna_content{height:100%;overflow:auto;padding:0 32px 64px}:host .hemfixarna_content--5{padding-top:16px}:host .hemfixarna_crumbs{position:relative;padding:16px 24px;border-bottom:1px solid #fcd9c9;display:flex;justify-content:space-between}:host .hemfixarna_crumbs--back{padding:16px 24px 8px;display:flex;align-items:center;gap:8px;box-shadow:none !important}:host .hemfixarna_crumbs--back:hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_crumbs img{cursor:pointer}:host .hemfixarna_crumbs .close{position:absolute;right:-16px;top:-16px;z-index:9}:host .hemfixarna_crumbs .cart{padding-left:16px;position:relative}:host .hemfixarna_crumbs .cart img{cursor:inherit}:host .hemfixarna_crumbs .cart span{position:absolute;background:#fff;border-radius:100%;width:24px;height:24px;display:flex;justify-content:center;align-items:center;font-weight:600;font-size:13px;line-height:11px;top:-8px;right:-12px}:host .hemfixarna_crumbs .cart_active{cursor:pointer}:host .hemfixarna_crumbs .cart_active span{background:#25a710;color:#fff}:host .hemfixarna_crumbs--links{display:flex;align-items:center;gap:16px;overflow:auto}@media (min-width: 769px){:host .hemfixarna_crumbs--links{-ms-overflow-style:none}:host .hemfixarna_crumbs--links::-webkit-scrollbar{display:none}:host .hemfixarna_crumbs--links::-webkit-scrollbar-button{display:none}}:host .hemfixarna_crumbs button{white-space:nowrap;background:#f1ded6;border-radius:64px;padding:12px 16px;font-size:12px;font-weight:600;letter-spacing:0.3px;box-shadow:none !important}:host .hemfixarna_crumbs button:not(.active):hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_crumbs .active{background:#fffaf2;cursor:default}:host .hemfixarna_features{gap:12px !important}:host .hemfixarna_features li{display:flex;gap:16px;align-items:center}:host .hemfixarna_address{margin-bottom:16px}:host .hemfixarna_product{display:grid;gap:16px}:host .hemfixarna_product--link{font-weight:700;color:#474444;text-underline-offset:4px}:host .hemfixarna_product--left{gap:32px}:host .hemfixarna_product--right{gap:32px}:host .hemfixarna_product--price{margin-top:4px;font-weight:700}:host .hemfixarna_product--total{text-align:center;margin:-16px 0;font-size:21px;line-height:28px}:host .hemfixarna_product--item{background:#fff;padding:16px;display:grid;grid-template-columns:auto 75px;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_product--grid{display:grid;grid-template-columns:1fr 1fr;gap:32px}@media (max-width: 768px){:host .hemfixarna_product--grid{grid-template-columns:1fr}}:host .hemfixarna_product--grid>div{display:flex;flex-direction:column}:host .hemfixarna_product--grid ul{display:flex;flex-direction:column;gap:4px}:host .hemfixarna_product p{margin:0}:host .hemfixarna_product--top{display:flex;gap:32px}:host .hemfixarna_product--top>div{width:100%}:host .hemfixarna_product--top>div h1{max-width:80%}@media (max-width: 768px){:host .hemfixarna_product--top>div h1{max-width:100%}}:host .hemfixarna_product--top h4{margin-bottom:8px}:host h5,:host p{margin:0}:host input[type=submit]{cursor:pointer}:host input[type=date]~label{left:56px}:host input[type=date]{border:1px solid #fcd9c9;padding-left:64px}:host input[type=checkbox]{height:18px;width:18px;border:1px solid #fcd9c9}:host input[type=checkbox]:checked{background:red}:host input[type=date]::-webkit-calendar-picker-indicator{background:transparent;bottom:0;color:transparent;cursor:pointer;height:auto;left:0;position:absolute;right:0;top:0;width:auto}:host button,:host a{cursor:pointer;background:none;border:none}:host ul{list-style:none;margin:0;padding:0}';const Z=class{constructor(t){e(this,t);this.slugIsOldFormat=t=>{if(!t)return false;return["product","service","category"].some((i=>t.includes(i)))};this.triggerScrollTotop=()=>{const t=this.el.shadowRoot.querySelector(".hemfixarna_content");v(t)};this.modal=false;this.showModal=false;this.tree=null;this.product=null;this.proppedProduct=null;this.slug=undefined;this.id=undefined;this.business=undefined;this.topCategory=undefined;this.forceOldTree=false;this.loadFromQuery=false;this.isDemo=false;this.widgetStyle=undefined;this.nav=undefined;this.buttonColor=undefined;this.buttonBg=undefined}loadCategoryOrProduct(t){this.proppedProduct=null;if(t.startsWith("c-")){const i=[...x.customer.categories,...x.customer.categories.map((t=>{var i;return(i=t.sub_categories)!==null&&i!==void 0?i:[]}))].flat();const e=i.find((i=>i&&i.id===t.replace("c-","")));if(e){x.selectedCustomerCategory=e;x.step=2}}else{const i=x.customer.categories.map((t=>t.show_products?t.products:t.sub_categories?t.sub_categories.map((t=>t.products)):[])).flat().flat();const e=i.find((i=>i&&i.fields.ID===parseInt(t)));if(e){x.selectedProduct=e.fields;x.step=4;this.proppedProduct=e.fields}}}async watchSlugChange(t){if(this.slugIsOldFormat(t)){this.fetchNewTaxonomy(t)}else if(x.customer&&t){this.loadCategoryOrProduct(t)}}async watchIdChange(t){if(t&&x.customer){this.loadCategoryOrProduct(t)}}async fetchNewTaxonomy(t){x.selectedCategory=null;x.selectedProduct=null;x.selectedService=null;const i=await R(t);if((i===null||i===void 0?void 0:i.code)==="not_found"||(i===null||i===void 0?void 0:i.code)==="rest_no_route"){console.log("taxonomy not found")}else if(i){this.setTaxonomy(i);if((i===null||i===void 0?void 0:i.post_type)==="ikea_product"){this.product=i}}}async componentWillLoad(){x.business=this.business;const t=window.sessionStorage.getItem(`hemfixarna-${this.business}-cart`);if(t){x.cart=JSON.parse(t)}const i=window.sessionStorage.getItem(`hemfixarna-${this.business}-user`);if(i){x.user=JSON.parse(i)}const e=window.sessionStorage.getItem(`hemfixarna-${this.business}-creditSafeUser`);if(e){x.creditSafeUser=JSON.parse(e)}const[n,s,a,r,o]=await Promise.all([this.topCategory?R(this.topCategory):null,this.slug?R(this.slug):Promise.resolve(null),W(),E(),X()]);if((!this.slug||!this.slugIsOldFormat(this.slug))&&!this.forceOldTree){try{const t=await H(this.business);if((t===null||t===void 0?void 0:t.code)==="not_found"){console.warn("customer not found")}else if(t){x.customer=t;if(this.id){this.loadCategoryOrProduct(this.id)}else if(this.slug&&!this.slugIsOldFormat(this.slug)){this.loadCategoryOrProduct(this.slug)}}}catch(t){console.warn("customer not found")}}if((n===null||n===void 0?void 0:n.code)==="not_found");else if(n){this.tree=n}if((s===null||s===void 0?void 0:s.code)==="not_found"){console.log("taxonomy not found")}else if(s){this.setTaxonomy(s);if((s===null||s===void 0?void 0:s.post_type)==="ikea_product"){this.product=s}}if(this.loadFromQuery){const t=new URL(document.location.toString()).searchParams;this.id=t.get("id");if(!this.isDemo){this.openModal()}}x.rotOptions=o;x.rutOptions=r;x.options=a}setTaxonomy(t){if(t){if((t===null||t===void 0?void 0:t.taxonomy)==="service_cat"){x.selectedCategory=t;x.step=2}else if((t===null||t===void 0?void 0:t.post_type)==="service"){x.selectedService=t;x.selectedCategory=this.tree.sub_cats.find((i=>i.services.find((i=>i.ID===t.ID))));x.step=3}else if((t===null||t===void 0?void 0:t.post_type)==="ikea_product"){x.selectedProduct=t;x.selectedService=this.tree.sub_cats.map((t=>t.services)).flat().find((t=>t.products.find((t=>t.ID===x.selectedProduct.ID))));x.selectedCategory=this.tree.sub_cats.find((t=>t.services.find((t=>t.ID===x.selectedService.ID))));x.step=4}this.triggerScrollTotop()}}openModal(){this.modal=true;setTimeout((()=>{this.showModal=true}),50)}closeModal(){this.showModal=false;setTimeout((()=>{this.modal=false}),200)}handleClick(t){if(this.loadFromQuery&&!this.isDemo)return;const i=this.el.shadowRoot.querySelector(".hemfixarna_modal");if(i){const e=i.contains(t.composedPath()[0]);if(!e){this.closeModal()}}const e=this.el.shadowRoot.querySelector(".hemfixarna_infomodal");if(e){const i=e.contains(t.composedPath()[0]);if(!i){x.modal=null}}}getCartLength(){return x.cart.reduce(((t,i)=>t+i.amount),0)}render(){var t,i,e,s,a,o,l,h,c,u,d;const p=r(`./assets/hemfixarna.svg`);const f=r(`./assets/montering.svg`);const m=((t=this.nav)===null||t===void 0?void 0:t.background)?r(this.nav.background):"";const g=((i=this.nav)===null||i===void 0?void 0:i.logo)?r(this.nav.logo):"";return n("div",{class:`hemfixarna ${this.loadFromQuery?"hemfixarna_standalone":""}`},this.loadFromQuery&&!this.isDemo&&this.nav?n("nav",{class:"hemfixarna_nav"},n("div",null,n("div",{class:"hemfixarna_nav--logos"},n("a",{href:this.nav.url,target:"_blank"},n("img",{src:g,alt:`${this.business} logo`})),n("a",{href:"https://hemfixarna.se/",target:"_blank"},n("p",null,"I samarbete med:"),n("img",{src:p,alt:"hemfixarna_logo",width:104}))),n("div",{class:"hemfixarna_nav--links"},n("a",{href:this.nav.url,target:"_blank"},"Till ",this.business),n("a",{href:"https://www.hemfixarna.se/",target:"_blank"},"Till Hemfixarna")),n("img",{src:m,alt:"nav_background"}))):null,!this.loadFromQuery||this.isDemo?n("div",{class:`hemfixarna_box hemfixarna_box--${this.widgetStyle}`},[L.alternative_2,L.alternative_3].includes(this.widgetStyle)?n("img",{src:f,alt:"montering logo",width:32,height:32}):null,n("div",null,n("div",null,n("p",{onClick:()=>this.openModal(),class:`pointer ${[L.alternative_2,L.alternative_3].includes(this.widgetStyle)&&x.selectedProduct?"underline":""}`},((e=this.product)===null||e===void 0?void 0:e.post_title)||((s=this.proppedProduct)===null||s===void 0?void 0:s.post_title)||n("span",null,"Montering",n("wbr",null),"/Installation ",(o=(a=x.selectedCustomerCategory)===null||a===void 0?void 0:a.name)!==null&&o!==void 0?o:"på plats"," - ",n("strong",{class:"underline"},"se priser här")),this.product&&((l=this.slug)===null||l===void 0?void 0:l.includes("product"))||this.proppedProduct?n("span",null," från"," ",n("strong",null,C(this.proppedProduct||this.product),"kr")):null)),this.widgetStyle===L.standard?n("img",{src:p,width:104}):null,this.widgetStyle===L.alternative?n("span",{class:"p-s"},"Utförs av ",n("strong",null,"Hemfixarna")):null),[L.standard,L.alternative].includes(this.widgetStyle)?n("button",{onClick:()=>this.openModal(),class:"hemfixarna_btn",style:{color:((h=this.buttonColor)===null||h===void 0?void 0:h.startsWith("#"))||!((c=this.buttonColor)===null||c===void 0?void 0:c.length)?this.buttonColor:`#${this.buttonColor}`,backgroundColor:((u=this.buttonBg)===null||u===void 0?void 0:u.startsWith("#"))||!((d=this.buttonBg)===null||d===void 0?void 0:d.length)?this.buttonBg:`#${this.buttonBg}`}},"Beställ här",this.getCartLength()>0&&n("span",null,this.getCartLength())):null,L.alternative_2===this.widgetStyle?n("div",{class:"hemfixarna_altbtn"},n("strong",{class:"p-s"},"Utförs av"),n("img",{src:p,alt:"hemfixarna logo",width:98})):null):null,this.modal&&n("div",null,n("div",{class:`hemfixarna_modal ${this.showModal?"hemfixarna_modal--open":""}`},x.modal&&n("div",{class:"hemfixarna_infomodal"},x.modal.title&&n("h2",null,x.modal.title),x.modal.text.map((t=>n("p",{innerHTML:t}))),n("div",null,n("button",{onClick:()=>x.modal=null},"Stäng"))),(this.tree||x.customer)&&n("hemfixarna-breadcrumbs",{isDemo:this.isDemo,loadFromQuery:this.loadFromQuery,closeModal:()=>this.closeModal(),tree:this.tree}),!x.customer||this.slugIsOldFormat(this.slug)?n("div",{class:`hemfixarna_content hemfixarna_content--${x.step}`},x.step===1&&this.tree&&n("hemfixarna-start",{tree:this.tree}),x.step===2&&x.selectedCategory&&n("hemfixarna-category",null),x.step===3&&x.selectedService&&n("hemfixarna-service",null),x.step===4&&x.selectedProduct&&n("hemfixarna-product",null),x.step===5&&n("hemfixarna-cart",{tree:this.tree}),x.step===6&&n("hemfixarna-order",{tree:this.tree})):n("div",{class:`hemfixarna_content hemfixarna_content--${x.step}`},x.step<4&&n("hemfixarna-start",null),x.step===4&&x.selectedProduct&&n("hemfixarna-product",null),x.step===5&&n("hemfixarna-cart",{tree:this.tree}),x.step===6&&n("hemfixarna-order",{tree:this.tree}))),!this.isDemo?n("div",{class:`hemfixarna_backdrop ${this.showModal?"hemfixarna_backdrop--open":""}`}):null))}static get assetsDirs(){return["assets"]}get el(){return s(this)}static get watchers(){return{slug:["watchSlugChange"],id:["watchIdChange"]}}};Z.style=G;const tt='@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap"); :host{font-family:"Inter", sans-serif}:host .hemfixarna_widgetstyles label{cursor:pointer}:host .hemfixarna_widgetstyles>div{display:flex;gap:1rem}:host .hemfixarna_widgetstyles h5{margin:1rem 0}:host .hemfixarna_example{margin-bottom:16px;background:#000;padding:16px;color:#fff;display:flex;justify-content:space-between;cursor:pointer;max-width:500px;box-sizing:border-box;position:relative}:host .hemfixarna_example--tooltip{background:#000;top:-48px;font-size:16px;left:40%;color:white;padding:8px;position:absolute;opacity:0}:host .hemfixarna_example--tooltip::after{content:"";position:absolute;top:100%;left:50%;margin-left:-5px;border-width:5px;border-style:solid;border-color:#000 transparent transparent transparent}:host .hemfixarna_example:hover .hemfixarna_example--tooltip{opacity:1}:host .hemfixarna_example p{font-size:14px}:host .hemfixarna_example img{filter:invert(1)}:host .hemfixarna_install{display:grid;gap:8px;margin-top:16px}:host .hemfixarna_product--label{background:#e1e0f5}:host .hemfixarna_categories{max-height:100%;overflow:auto;position:relative}:host .hemfixarna_categories--label{display:flex;align-items:center;justify-content:space-between;padding:8px}:host .hemfixarna_categories--label button{background:#3f3a92;border:none;font-weight:600;padding:3.2px 9.6px;border-radius:10px;margin-right:8px;color:#ece8e8}:host .hemfixarna_categories--label button:active{transform:scale(0.95)}:host .hemfixarna_categories--label--big{font-weight:600;border-bottom:1px solid black}:host p{margin:0}:host span{color:darkolivegreen;font-size:10px}:host button{cursor:pointer}:host>div{display:grid;gap:32px;width:100%;grid-template-columns:1fr 1fr;height:100vh;place-items:center;overflow:hidden;padding:16px 32px;box-sizing:border-box}:host>div>*{width:100%}:host>div>div{max-width:500px}:host>div ul{margin:0;padding:0;list-style:none}:host>div ul ul{gap:1px;display:grid}:host>div ul li{padding-left:16px;background:#fff}';const it=class{constructor(t){e(this,t);this.debounce=null;this.cdnLink='<script type="module" src="https://cdn.jsdelivr.net/npm//hemfixarna-web-components@latest/dist/hemfixarna-components/hemfixarna-components.esm.js"><\/script>';this.selectedSlug=undefined;this.selectedID=undefined;this.tooltipText="Kopiera till urklipp";this.tree=null;this.customer=null;this.widgetStyle=L.standard;this.buttonBg="";this.buttonColor="";this.colorAccessibility=undefined}debouncedFunction(){if(this.debounce!==null){clearTimeout(this.debounce);this.debounce=null}this.debounce=window.setTimeout((()=>{this.checkColorAccessibility();this.debounce=null}),1500)}async checkColorAccessibility(){const t="#fff";const i="#c84e18";const e=this.buttonBg.length?this.buttonBg.startsWith("#")?this.buttonBg:`#${this.buttonBg}`:i;const n=this.buttonColor.length?this.buttonColor.startsWith("#")?this.buttonColor:`#${this.buttonColor}`:t;fetch("https://www.aremycolorsaccessible.com/api/are-they",{mode:"cors",method:"POST",body:JSON.stringify({colors:[e,n]})}).then((t=>t.json())).then((t=>{console.log(t);if(t&&t){this.colorAccessibility=t}}))}getTopLevelCategory(){switch("byggmax"){case F.byggmax:return M.byggmax;default:return""}}getColor(t){switch(t){case"AAA":return"green";case"AA":return"orange";case"A":return"yellow";case"Fail":return"red";default:return"black"}}async componentWillLoad(){if(process.env.FORCE_OLD_TREE){const t=await R(this.getTopLevelCategory());if((t===null||t===void 0?void 0:t.code)==="not_found");else if(t){this.tree=t}}else{const t=await H("byggmax");if(t.code!=="not_found"&&t){this.customer=t}}}getExample(){return`<hemfixarna-${"byggmax"}${this.selectedSlug?` slug="${this.selectedSlug}" `:""}${this.selectedID?` id="${this.selectedID}" `:""} ${this.widgetStyle===L.standard?"":`widgetStyle="${this.widgetStyle}"`} ${this.buttonColor.length?`buttonColor="${this.buttonColor}"`:""} ${this.buttonBg.length?`buttonBg="${this.buttonBg}"`:""}></hemfixarna-${"byggmax"}>`}copyExample(){navigator.clipboard.writeText(this.getExample());this.tooltipText="Snippet kopierad";setTimeout((()=>{this.tooltipText="Kopiera till urklipp"}),2e3)}copyCdn(){navigator.clipboard.writeText(this.cdnLink);this.tooltipText="Text kopierad";setTimeout((()=>{this.tooltipText="Kopiera till urklipp"}),2e3)}copyNpmInstall(){navigator.clipboard.writeText("npm i hemfixarna-web-components");this.tooltipText="Text kopierad";setTimeout((()=>{this.tooltipText="Kopiera till urklipp"}),2e3)}render(){const t=r(`./assets/copy.png`);return n("div",null,n("div",null,n("div",{onClick:()=>this.copyExample(),class:"hemfixarna_example"},n("p",null,this.getExample()),n("img",{src:t,height:20}),n("span",{class:"hemfixarna_example--tooltip"},this.tooltipText)),"byggmax"===F.byggmax&&n("hemfixarna-byggmax",{buttonColor:this.buttonColor,buttonBg:this.buttonBg,widgetStyle:this.widgetStyle,forceOldTree:Boolean(process.env.FORCE_OLD_TREE),slug:this.selectedSlug,id:this.selectedID}),"byggmax"===F.skanska&&n("hemfixarna-skanska",{buttonColor:this.buttonColor,buttonBg:this.buttonBg,widgetStyle:this.widgetStyle,id:this.selectedID}),"byggmax"===F.string&&n("hemfixarna-string-furniture",{buttonColor:this.buttonColor,buttonBg:this.buttonBg,widgetStyle:this.widgetStyle,id:this.selectedID}),"byggmax"===F.hornbach&&n("hemfixarna-hornbach",{buttonColor:this.buttonColor,buttonBg:this.buttonBg,widgetStyle:this.widgetStyle,isDemo:true,id:this.selectedID}),"byggmax"===F.kund&&n("hemfixarna-kund",{buttonColor:this.buttonColor,buttonBg:this.buttonBg,widgetStyle:this.widgetStyle,id:this.selectedID}),n("div",{class:"hemfixarna_install"},n("div",{onClick:()=>this.copyCdn(),class:"hemfixarna_example"},n("p",null,this.cdnLink),n("span",{class:"hemfixarna_example--tooltip"},this.tooltipText),n("img",{src:t,height:20}))),n("div",{class:"hemfixarna_widgetstyles"},n("h5",null,"Widget styles"),n("div",null,Object.values(L).map((t=>n("label",{key:t},n("input",{type:"radio",value:t,checked:this.widgetStyle===t,onChange:()=>this.widgetStyle=t}),t)))),n("div",null,n("div",null,n("h5",null,"Button background color"),n("input",{type:"text",value:this.buttonBg,onInput:t=>this.buttonBg=t.target.value})),n("div",null,n("h5",null,"Button text color"),n("input",{type:"text",value:this.buttonColor,onInput:t=>this.buttonColor=t.target.value})))),n("span",null,"Write an hexa code no # needed"),this.colorAccessibility?n("div",null,n("h5",null,"Tillgänglighetsrapport"),n("div",null,n("strong",null,"Liten text:"),n("span",{style:{color:this.getColor(this.colorAccessibility.small)}},this.colorAccessibility.small),n("br",null),n("strong",null,"Fet text:"),n("span",{style:{color:this.getColor(this.colorAccessibility.bold)}},this.colorAccessibility.bold),n("br",null),n("strong",null,"Stor text:"),n("span",{style:{color:this.getColor(this.colorAccessibility.large)}},this.colorAccessibility.large),n("br",null),n("strong",null,"Kontrastförhållande:")," ",this.colorAccessibility.contrast)):null),n("ul",{class:"hemfixarna_categories"},this.customer?n("div",null,this.customer.categories.map((t=>n("li",null,n("div",{class:"hemfixarna_categories--label hemfixarna_categories--label--big"},n("div",null,n("p",null,t.name),n("span",null,`c-${t.id}`)),n("div",null,n("button",{onClick:()=>navigator.clipboard.writeText(`c-${t.id}`)},"Kopiera ID"),n("button",{onClick:()=>this.selectedID=`c-${t.id}`},"Ladda kategori"))),t.show_products&&t.products?n("ul",null,t.products.map((t=>n("li",null,n("div",{class:"hemfixarna_categories--label hemfixarna_product--label"},n("div",null,n("p",null,t.fields.post_title),n("span",null,t.fields.ID)),n("div",null,n("button",{onClick:()=>navigator.clipboard.writeText(String(t.fields.ID))},"Kopiera ID"),n("button",{onClick:()=>this.selectedID=String(t.fields.ID)},"Ladda produkt"))))))):n("ul",null,t.sub_categories&&t.sub_categories.map((t=>n("li",null,n("div",{class:"hemfixarna_categories--label"},n("div",null,n("p",null,t.name),n("span",null,`c-${t.id}`)),n("div",null,n("button",{onClick:()=>navigator.clipboard.writeText(`c-${t.id}`)},"Kopiera ID"),n("button",{onClick:()=>this.selectedID=`c-${t.id}`},"Ladda kategori"))),n("ul",null,t.products.map((t=>n("li",null,n("div",{class:"hemfixarna_categories--label hemfixarna_product--label"},n("div",null,n("p",null,t.fields.post_title),n("span",null,t.fields.ID)),n("div",null,n("button",{onClick:()=>navigator.clipboard.writeText(String(t.fields.ID))},"Kopiera ID"),n("button",{onClick:()=>this.selectedID=String(t.fields.ID)},"Ladda produkt"))))))))))))))):this.tree?n("div",null,this.tree.sub_cats.map((t=>n("li",null,n("div",{class:"hemfixarna_categories--label hemfixarna_categories--label--big"},n("div",null,n("p",null,t.name),n("span",null,`category/${t.slug}`)),n("div",null,n("button",{onClick:()=>navigator.clipboard.writeText(`category/${t.slug}`)},"Kopiera slug"),n("button",{onClick:()=>this.selectedSlug=`category/${t.slug}`},"Ladda kategori"))),n("ul",null,t.services.map((t=>n("li",null,n("div",{class:"hemfixarna_categories--label"},n("div",null,n("p",null,t.post_title),n("span",null,`service/${t.post_name}`)),n("div",null,n("button",{onClick:()=>navigator.clipboard.writeText(`service/${t.post_name}`)},"Kopiera slug"),n("button",{onClick:()=>this.selectedSlug=`service/${t.post_name}`},"Ladda kategori"))),n("ul",null,t.products.map((t=>n("li",null,n("div",{class:"hemfixarna_categories--label"},n("div",null,n("p",null,t.post_title),n("span",null,`product/${t.post_name}`)),n("div",null,n("button",{onClick:()=>navigator.clipboard.writeText(`product/${t.post_name}`)},"Kopiera slug"),n("button",{onClick:()=>this.selectedSlug=`product/${t.post_name}`},"Ladda kategori"))))))))))))))):null))}static get watchers(){return{buttonBg:["debouncedFunction"],buttonColor:["debouncedFunction"]}}};it.style=tt;var et=class extends Error{constructor(){super("Invalid swedish personal identity number")}};var nt=(t,i)=>{const e=t.getTime()-i.getTime();return e<0?-1:e>0?1:e};var st=(t,i)=>{const e=nt(t,i);const n=Math.abs(t.getFullYear()-i.getFullYear());t.setFullYear(t.getFullYear()-e*n);const s=nt(t,i)===-e;const a=e*(n-+s);return a===0?0:a};var at=t=>{let i=0;t+="";for(let e=0,n=t.length;e<n;e++){let n=parseInt(t[e]);n*=2-e%2;if(n>9){n-=9}i+=n}return Math.ceil(i/10)*10-i};var rt=(t,i,e)=>{i-=1;const n=new Date(t,i,e);return!(n.getFullYear()!==t||n.getMonth()!==i||n.getDate()!==e)};var ot=class{constructor(t,i){this._century="";this._fullYear="";this._year="";this._month="";this._day="";this._sep="";this._num="";this._check="";this.parse(t,{allowCoordinationNumber:true,allowInterimNumber:false,...i})}get century(){return this._century}get fullYear(){return this._fullYear}get year(){return this._year}get month(){return this._month}get day(){return this._day}get sep(){return this._sep}get num(){return this._num}get check(){return this._check}static parse(t,i){return new ot(t,i)}static valid(t,i){try{ot.parse(t,i);return true}catch(t){return false}}parse(t,i){if(t.length<10||t.length>13){throw new et}const e=/^(\d{2}){0,1}(\d{2})(\d{2})(\d{2})([+-]?)((?!000)\d{3}|[TRSUWXJKLMN]\d{2})(\d)$/;const n=e.exec(t);if(!n){throw new et}const s=n[1];const a=n[2];const r=n[3];const o=n[4];const l=n[5];const h=n[6];const c=n[7];if(typeof s==="undefined"||!s.length){const t=new Date;let i=0;if(l==="+"){this._sep="+";i=t.getFullYear()-100}else{this._sep="-";i=t.getFullYear()}this._century=(""+(i-(i-parseInt(a))%100)).substr(0,2)}else{this._century=s;if((new Date).getFullYear()-parseInt(s+a,10)<100){this._sep="-"}else{this._sep="+"}}this._year=a;this._fullYear=this._century+a;this._month=r;this._day=o;this._num=h;this._check=c;if(!this.valid()){throw new et}if(!(i==null?void 0:i.allowCoordinationNumber)&&this.isCoordinationNumber()){throw new et}if(!(i==null?void 0:i.allowInterimNumber)&&this.isInterimNumber()){throw new et}}valid(){const t=at(this.year+this.month+this.day+this.num.replace(/[TRSUWXJKLMN]/,"1"))===+this.check&&!!this.check;if(t&&rt(parseInt(this.century+this.year),+this.month,+this.day)){return t}return t&&rt(parseInt(this.century+this.year),+this.month,+this.day-60)}format(t=false){if(t){return`${this.century}${this.year}${this.month}${this.day}${this.num}${this.check}`}return`${this.year}${this.month}${this.day}${this.sep}${this.num}${this.check}`}getAge(){const t=this.getDate();return st(new Date(Date.now()),t)}getDate(){let t=+this.day;if(this.isCoordinationNumber()){t-=60}const i=this.century+this.year+"-"+this.month+"-"+(t<10?"0"+t:t);return new Date(i)}isInterimNumber(){return/[TRSUWXJKLMN]/.test(this.num[0])}isCoordinationNumber(){return rt(parseInt(this.century+this.year),+this.month,+this.day-60)}isFemale(){return!this.isMale()}isMale(){const t=parseInt(this.num.substr(-1));return t%2===1}};var lt=ot;function ht(t,i,e){return e={path:i,exports:{},require:function(t,i){return ct()}},t(e,e.exports),e.exports}function ct(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var ut=ht((function(t,i){Object.defineProperty(i,"__esModule",{value:true});i.utf8=void 0;i.utf8={encode:e,decode:n};function e(t){t=t.replace(/\r\n/g,"\n");var i="";for(var e=0;e<t.length;e++){var n=t.charCodeAt(e);if(n<128){i+=String.fromCharCode(n)}else if(n>127&&n<2048){i+=String.fromCharCode(n>>6|192);i+=String.fromCharCode(n&63|128)}else{i+=String.fromCharCode(n>>12|224);i+=String.fromCharCode(n>>6&63|128);i+=String.fromCharCode(n&63|128)}}return i}function n(t){var i="";var e=0;var n=0;var s=0;var a=0;while(e<t.length){n=t.charCodeAt(e);if(n<128){i+=String.fromCharCode(n);e++}else if(n>191&&n<224){s=t.charCodeAt(e+1);i+=String.fromCharCode((n&31)<<6|s&63);e+=2}else{s=t.charCodeAt(e+1);a=t.charCodeAt(e+2);i+=String.fromCharCode((n&15)<<12|(s&63)<<6|a&63);e+=3}}return i}}));var dt=ht((function(t,i){Object.defineProperty(i,"__esModule",{value:true});i.generate=void 0;function e(t){var i=[];var e;var n;var a;var r;var o;var l;var m;var x;var g;var b=7;var v=12;var _=17;var y=22;var w=5;var k=9;var C=14;var $=20;var S=4;var T=11;var z=16;var j=23;var O=6;var I=10;var N=15;var A=21;var F=ut.utf8.encode(t);i=p(F);l=1732584193;m=4023233417;x=2562383102;g=271733878;for(e=0;e<i.length;e+=16){n=l;a=m;r=x;o=g;l=h(l,m,x,g,i[e+0],b,3614090360);g=h(g,l,m,x,i[e+1],v,3905402710);x=h(x,g,l,m,i[e+2],_,606105819);m=h(m,x,g,l,i[e+3],y,3250441966);l=h(l,m,x,g,i[e+4],b,4118548399);g=h(g,l,m,x,i[e+5],v,1200080426);x=h(x,g,l,m,i[e+6],_,2821735955);m=h(m,x,g,l,i[e+7],y,4249261313);l=h(l,m,x,g,i[e+8],b,1770035416);g=h(g,l,m,x,i[e+9],v,2336552879);x=h(x,g,l,m,i[e+10],_,4294925233);m=h(m,x,g,l,i[e+11],y,2304563134);l=h(l,m,x,g,i[e+12],b,1804603682);g=h(g,l,m,x,i[e+13],v,4254626195);x=h(x,g,l,m,i[e+14],_,2792965006);m=h(m,x,g,l,i[e+15],y,1236535329);l=c(l,m,x,g,i[e+1],w,4129170786);g=c(g,l,m,x,i[e+6],k,3225465664);x=c(x,g,l,m,i[e+11],C,643717713);m=c(m,x,g,l,i[e+0],$,3921069994);l=c(l,m,x,g,i[e+5],w,3593408605);g=c(g,l,m,x,i[e+10],k,38016083);x=c(x,g,l,m,i[e+15],C,3634488961);m=c(m,x,g,l,i[e+4],$,3889429448);l=c(l,m,x,g,i[e+9],w,568446438);g=c(g,l,m,x,i[e+14],k,3275163606);x=c(x,g,l,m,i[e+3],C,4107603335);m=c(m,x,g,l,i[e+8],$,1163531501);l=c(l,m,x,g,i[e+13],w,2850285829);g=c(g,l,m,x,i[e+2],k,4243563512);x=c(x,g,l,m,i[e+7],C,1735328473);m=c(m,x,g,l,i[e+12],$,2368359562);l=u(l,m,x,g,i[e+5],S,4294588738);g=u(g,l,m,x,i[e+8],T,2272392833);x=u(x,g,l,m,i[e+11],z,1839030562);m=u(m,x,g,l,i[e+14],j,4259657740);l=u(l,m,x,g,i[e+1],S,2763975236);g=u(g,l,m,x,i[e+4],T,1272893353);x=u(x,g,l,m,i[e+7],z,4139469664);m=u(m,x,g,l,i[e+10],j,3200236656);l=u(l,m,x,g,i[e+13],S,681279174);g=u(g,l,m,x,i[e+0],T,3936430074);x=u(x,g,l,m,i[e+3],z,3572445317);m=u(m,x,g,l,i[e+6],j,76029189);l=u(l,m,x,g,i[e+9],S,3654602809);g=u(g,l,m,x,i[e+12],T,3873151461);x=u(x,g,l,m,i[e+15],z,530742520);m=u(m,x,g,l,i[e+2],j,3299628645);l=d(l,m,x,g,i[e+0],O,4096336452);g=d(g,l,m,x,i[e+7],I,1126891415);x=d(x,g,l,m,i[e+14],N,2878612391);m=d(m,x,g,l,i[e+5],A,4237533241);l=d(l,m,x,g,i[e+12],O,1700485571);g=d(g,l,m,x,i[e+3],I,2399980690);x=d(x,g,l,m,i[e+10],N,4293915773);m=d(m,x,g,l,i[e+1],A,2240044497);l=d(l,m,x,g,i[e+8],O,1873313359);g=d(g,l,m,x,i[e+15],I,4264355552);x=d(x,g,l,m,i[e+6],N,2734768916);m=d(m,x,g,l,i[e+13],A,1309151649);l=d(l,m,x,g,i[e+4],O,4149444226);g=d(g,l,m,x,i[e+11],I,3174756917);x=d(x,g,l,m,i[e+2],N,718787259);m=d(m,x,g,l,i[e+9],A,3951481745);l=s(l,n);m=s(m,a);x=s(x,r);g=s(g,o)}return f(l)+f(m)+f(x)+f(g)}i.generate=e;function n(t,i){return t<<i|t>>>32-i}function s(t,i){var e;var n;var s;var a;var r;s=t&2147483648;a=i&2147483648;e=t&1073741824;n=i&1073741824;r=(t&1073741823)+(i&1073741823);if(e&n){return r^2147483648^s^a}if(e|n){if(r&1073741824){return r^3221225472^s^a}else{return r^1073741824^s^a}}else{return r^s^a}}function a(t,i,e){return t&i|~t&e}function r(t,i,e){return t&e|i&~e}function o(t,i,e){return t^i^e}function l(t,i,e){return i^(t|~e)}function h(t,i,e,r,o,l,h){t=s(t,s(s(a(i,e,r),o),h));return s(n(t,l),i)}function c(t,i,e,a,o,l,h){t=s(t,s(s(r(i,e,a),o),h));return s(n(t,l),i)}function u(t,i,e,a,r,l,h){t=s(t,s(s(o(i,e,a),r),h));return s(n(t,l),i)}function d(t,i,e,a,r,o,h){t=s(t,s(s(l(i,e,a),r),h));return s(n(t,o),i)}function p(t){var i;var e=t.length;var n=e+8;var s=(n-n%64)/64;var a=(s+1)*16;var r=Array(a-1);var o=0;var l=0;while(l<e){i=(l-l%4)/4;o=l%4*8;r[i]=r[i]|t.charCodeAt(l)<<o;l++}i=(l-l%4)/4;o=l%4*8;r[i]=r[i]|128<<o;r[a-2]=e<<3;r[a-1]=e>>>29;return r}function f(t){var i="";var e="";var n;var s;for(s=0;s<=3;s++){n=t>>>s*8&255;e="0"+n.toString(16);i=i+e.substr(e.length-2,2)}return i}}));var pt=ht((function(t,i){Object.defineProperty(i,"__esModule",{value:true});i.MD5=i.generate=void 0;var e=dt;Object.defineProperty(i,"generate",{enumerable:true,get:function(){return e.generate}});i.MD5={generate:dt.generate}}));const ft=async t=>{var i;const e=await fetch((i="https://hemfixare-lookup.vercel.app/api")!==null&&i!==void 0?i:"https://hemfixare-lookup.vercel.app/api",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:t,hash:pt.MD5.generate(String.fromCharCode(83,101,67,82,101,116)+t)})});const n=await e.json();return n};const mt=class{constructor(t){e(this,t);this.handleChangeEmail=t=>{this.emailError=null;this.email=t.target.value};this.handleChangePhone=t=>{this.phoneError=null;this.phone=t.target.value};this.handleChangessn=t=>{this.ssnError=null;this.ssn=t.target.value};this.handleSubmit=async t=>{t.preventDefault();const i=new RegExp(/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/);const e=i.test(this.email);if(!e){this.emailError="Ange en giltig e-postadress"}const n=/^[\d\s()+-]{6,}$/.test(this.phone);if(!n){this.phoneError="Ange ett giltigt telefonnummer"}const s=lt.valid(this.ssn);if(!s){this.ssnError="Ange ett giltigt personnummer"}else if(s){const t=lt.parse(this.ssn).format(true);this.ssn=[t.slice(0,8),"-",t.slice(8)].join("")}if(e&&n&&s){try{const t=await ft(this.ssn);if(t){x.creditSafeUser=t;x.checkoutStep=2;x.user=Object.assign(Object.assign({},t),{email:this.email,phone:this.phone,ssn:this.ssn})}else{this.ssnError="Vi kunde tyvärr inte hitta en address med ditt angivna personnummer"}}catch(t){this.ssnError="Vi kunde tyvärr inte hitta en address med ditt angivna personnummer";console.log(t)}finally{const t=this.el.closest(".hemfixarna_content");v(t)}}};this.render=()=>n("form",{class:"mb-2",onSubmit:t=>this.handleSubmit(t)},n("div",null,n("input",{class:`${this.email.length?"input_active":""}`,onChange:t=>this.handleChangeEmail(t),type:"email",name:"email",value:this.email}),n("label",{htmlFor:"email"},"E-post ")),this.emailError&&n("span",null,this.emailError),n("div",null,n("input",{class:`${this.phone.length?"input_active":""}`,onChange:t=>this.handleChangePhone(t),type:"tel",name:"phone",value:this.phone}),n("label",{htmlFor:"phone"},"Mobiltelefon ")),this.phoneError&&n("span",null,this.phoneError),n("div",null,n("input",{class:`${this.ssn.length?"input_active":""}`,onChange:t=>this.handleChangessn(t),type:"tel",name:"ssn",value:this.ssn}),n("label",{htmlFor:"phone"},"Personnummer*")),this.ssnError&&n("span",null,this.ssnError),n("input",{type:"submit",value:"Fortsätt*"}),n("p",null,"*Vi hämtar din adress"));this.email="";this.emailError=null;this.phone="";this.phoneError=null;this.ssn="";this.ssnError=null}componentWillLoad(){if(x.user){this.email=x.user.email;this.phone=x.user.phone;this.ssn=x.user.ssn}}get el(){return s(this)}};const xt="";const gt=class{constructor(t){e(this,t);this.id=undefined;this.loadFromQuery=true;this.isDemo=false;this.widgetStyle=L.standard;this.buttonColor=undefined;this.buttonBg=undefined}render(){return n("hemfixarna-component",{widgetStyle:this.widgetStyle,buttonBg:this.buttonBg,buttonColor:this.buttonColor,nav:{url:"https://www.hornbach.se/",logo:"assets/hornbach/logo.svg",background:"./assets/hornbach/nav.jpg"},isDemo:this.isDemo,loadFromQuery:this.loadFromQuery,id:this.id,business:F.hornbach})}};gt.style=xt;const bt=class{constructor(t){e(this,t);this.logo=r(`./assets/hemfixarna.svg`);this.checkoutList=[{trust_badge:"Efter att du fyllt i formuläret blir du kontaktad av en Hemfixare för bokning av tid."},{trust_badge:"När jobbet är klart kommer du få en faktura med RUT/ROT-avdrag."}];this.list=null}getList(){return this.list?this.list:this.checkoutList}render(){const t=r(`./assets/checked.svg`);return n("div",{class:"hemfixarna_info"},x.step<5?n(a,null,n("h2",null,"Vilka är Hemfixarna?"),n("p",null,"Vi fixar allt från krångliga datorer till montering av möbler. Vi finns i hela Sverige och är alltid redo att rycka ut.")):n("h2",null,"Vad händer nu?"),n("ul",{class:"hemfixarna_features"},this.getList().map((i=>n("li",{key:i.trust_badge},n("img",{src:t,alt:"checked"}),n("p",null,i.trust_badge))))),n("img",{src:this.logo,width:200,alt:"hemfixarna"}),n("a",{class:"hemfixarna_product--link",target:"_blank",href:x.options.link.url},x.options.link.title))}};const vt=class{constructor(t){e(this,t);this.id=undefined;this.loadFromQuery=false;this.widgetStyle=L.standard;this.buttonColor=undefined;this.buttonBg=undefined}render(){return n("hemfixarna-component",{widgetStyle:this.widgetStyle,buttonBg:this.buttonBg,buttonColor:this.buttonColor,loadFromQuery:this.loadFromQuery,id:this.id,business:F.kund})}};const _t=class{constructor(t){e(this,t);this.render=()=>n("div",{style:{background:`url(${x.options.thank_you_image})`},class:"hemfixarna_order"},n("div",null),n("div",null,n("h2",null,"Tack för din bokning"),n("hemfixarna-orderrows",{tree:this.tree,cart:false}),n("span",{onClick:()=>this.resetShop()},n("button",null,"Gör en ny bokning")),n("hemfixarna-info",{list:[{trust_badge:"Du kommer bli kontaktad av en Hemfixare för bokning av tid."},{trust_badge:"När jobbet är klart kommer du få en faktura med RUT/ROT-avdrag."}]})));this.tree=undefined}resetShop(){x.step=1;x.cart=[];x.selectedCategory=null;x.selectedService=null;x.selectedProduct=null;x.checkoutStep=1}disconnectedCallback(){this.resetShop()}};const yt=class{constructor(t){e(this,t);this.cart=true;this.tree=undefined}goToProduct(t){if(x.customer){const i=x.customer.categories.map((t=>t.show_products?t.products:t.sub_categories?t.sub_categories.map((t=>t.products)):[])).flat().flat();const e=i.find((i=>i&&i.fields.ID===t));if(e){x.selectedProduct=e.fields;x.step=4}}else{const i=this.tree.sub_cats.map((t=>t.services)).flat();const e=i.map((t=>t.products)).flat();const n=e.find((i=>i.ID===t));const s=i.find((i=>i.products.find((i=>i.ID===t))));const a=this.tree.sub_cats.find((i=>i.services.find((i=>i.products.find((i=>i.ID===t))))));x.selectedCategory=a;x.selectedService=s;x.selectedProduct=n;x.step=4}}openRot(){x.modal={title:x.rotOptions.rot_start_fee_heading,text:[x.rotOptions.rot_start_fee_text,x.rotOptions.rot_start_fee_text_secondary]}}openRut(){x.modal={title:x.rutOptions.rut_start_fee_heading,text:[x.rutOptions.rut_start_fee_text,x.rutOptions.rut_start_fee_text_secondary]}}render(){const t=r(`./assets/info.svg`);return n(a,null,n("ul",{class:"hemfixarna_cart--items"},x.cart.map((t=>{var i;return n("li",{class:"hemfixarna_cart--item"},n("div",null,n("div",null,t.icon&&n("img",{width:30,src:(i=t.icon.url)!==null&&i!==void 0?i:t.icon,alt:t.name}),n("p",null,n("strong",null,t.amount,"x "),t.name)),this.cart&&n("button",{onClick:()=>this.goToProduct(t.id)},"Ändra")),n("p",null,n("strong",null,k(t,t.price,t.amount),"kr")),t.parts.length>0&&n("ul",null,t.parts.map((i=>n("li",null,n("p",null,n("strong",null,i.amount,"x "),i.name),n("p",null,n("strong",null,$(i,t,i.amount),"kr")))))))}))),n("div",{class:"hemfixarna_cart--additional"},S().rot>0&&n("div",{class:"hemfixarna_cart--startfee"},n("p",null,n("strong",{onClick:()=>this.openRot()},x.rotOptions.rot_start_fee_heading,n("img",{height:16,src:t,alt:"info monteringsavgift"}))),n("p",null,S().rot,"kr")),S().rut>0&&n("div",{class:"hemfixarna_cart--startfee"},n("p",null,n("strong",{onClick:()=>this.openRut()},x.rutOptions.rut_start_fee_heading,n("img",{height:16,src:t,alt:"info monteringsavgift"}))),n("p",null,S().rut,"kr")),x.cart.find((t=>t.rot))&&n("div",{class:"hemfixarna_cart--rutrot"},n("div",null,this.cart&&n("label",{class:"switch"},n("input",{checked:x.rot,onChange:()=>x.rot=!x.rot,type:"checkbox"}),n("span",{class:"slider"})),n("p",null,"ROT-avdrag")),n("p",null,"(-",x.rot?z():0,"kr)")),x.cart.find((t=>t.rut))&&n("div",{class:"hemfixarna_cart--rutrot"},n("div",null,n("label",{class:"switch"},n("input",{onChange:()=>x.rut=!x.rut,checked:x.rut,type:"checkbox"}),n("span",{class:"slider"})),n("p",null,"RUT-avdrag")),n("p",null,"(-",x.rut?j():0,"kr)"))),n("div",{class:"hemfixarna_cart--price"},n("h2",null,"Totalbelopp: "),n("h2",null,O(),"kr")))}};const wt=class{constructor(t){e(this,t);this.amount=0;this.hideDescription=true}addProduct(){const t=x.cart.find((t=>t.id===x.selectedProduct.ID));if(t){t.amount++;x.cart=[...x.cart]}else{x.cart=[...x.cart,{id:x.selectedProduct.ID,rut:x.selectedProduct.rut,rot:x.selectedProduct.rot,amount:1,parts:[],price:x.selectedProduct.price,name:x.selectedProduct.post_title,start_fee:!x.selectedProduct.hide_start_fee,terms_checkout:x.selectedProduct.terms_checkout,icon:x.selectedProduct.icon}]}}removeProduct(){const t=x.cart.find((t=>t.id===x.selectedProduct.ID));if(t&&t.amount>1){t.amount--;x.cart=[...x.cart]}else{x.cart=x.cart.filter((t=>t.id!==x.selectedProduct.ID))}}addPart(t){var i;const e=x.cart.find((t=>t.id===x.selectedProduct.ID));if(e){const n=e.parts.find((i=>i.id===t.ID));if(n){n.amount++;e.parts=[...e.parts]}else{e.parts=[...e.parts,{id:t.ID,amount:1,price:t.price,name:(i=t.title)!==null&&i!==void 0?i:t.post_title}]}x.cart=[...x.cart.filter((t=>t.id!==e.id)),e]}}removePart(t){const i=x.cart.find((t=>t.id===x.selectedProduct.ID));if(i){const e=i.parts.find((i=>i.id===t.ID));if(e&&e.amount>1){e.amount--;i.parts=[...i.parts]}else{i.parts=i.parts.filter((i=>i.id!==t.ID))}x.cart=[...x.cart.filter((t=>t.id!==i.id)),i]}}goToCart(){const t=x.cart.find((t=>t.id===x.selectedProduct.ID));if(t){x.step=5;const t=this.el.closest(".hemfixarna_content");v(t)}}getAmount(){var t;return((t=x.cart.find((t=>t.id===x.selectedProduct.ID)))===null||t===void 0?void 0:t.amount)||0}getPartAmount(t){var i;const e=x.cart.find((t=>t.id===x.selectedProduct.ID));return((i=e===null||e===void 0?void 0:e.parts.find((i=>i.id===t)))===null||i===void 0?void 0:i.amount)||0}getTotalPrice(){let t=0;const i=x.cart.find((t=>t.id===x.selectedProduct.ID));if(i){const e=i.parts.reduce(((t,i)=>{const e=x.selectedProduct.parts.find((t=>t.ID===i.id));if(e){return t+e.price*i.amount}return t}),0);t=x.selectedProduct.price*i.amount+e}else{t=x.selectedProduct.price}return k(x.selectedProduct,t)}render(){var t,i,e;const s=r(`./assets/checked.svg`);const a=r(`./assets/plus.svg`);const o=r(`./assets/minus.svg`);return n("div",{class:"hemfixarna_product"},n("div",{class:"hemfixarna_product--top"},x.selectedProduct.icon&&n("img",{width:80,src:(t=x.selectedProduct.icon.url)!==null&&t!==void 0?t:x.selectedProduct.icon,alt:x.selectedProduct.post_title}),n("div",null,n("h1",null,x.selectedProduct.post_title),n("h2",null,"Från: ",k(x.selectedProduct)," kr"))),n("div",{class:"hemfixarna_product--grid"},n("div",{class:"hemfixarna_product--left"},((i=x.selectedProduct.list)===null||i===void 0?void 0:i.length)&&n("ul",{class:"hemfixarna_features"},x.selectedProduct.list.map((t=>n("li",{key:t.bullet},n("img",{src:s,alt:"checked"}),n("p",null,t.bullet))))),x.selectedProduct.description&&n("p",{onClick:()=>this.hideDescription=false,class:`hemfixarna_description ${this.hideDescription?"hemfixarna_description--hidden":""}`,innerHTML:x.selectedProduct.description})),n("div",{class:"hemfixarna_product--right"},n("ul",null,n("li",{class:"hemfixarna_product--item"},n("div",null,n("p",null,"Antal ",x.selectedProduct.post_title),n("p",{class:"hemfixarna_product--price"},k(x.selectedProduct),"kr/st")),n("div",{class:"hemfixarna_counter"},n("img",{class:`${this.getAmount()===0?"disabled":""}`,src:o,onClick:()=>this.removeProduct()}),n("span",null,this.getAmount()),n("img",{src:a,onClick:()=>this.addProduct()}))),((e=x.selectedProduct.parts)===null||e===void 0?void 0:e.length)&&x.selectedProduct.parts.map((t=>{var i;return n("li",{class:"hemfixarna_part"},n("div",null,n("p",null,(i=t.title)!==null&&i!==void 0?i:t.post_title),n("p",{class:"hemfixarna_product--price"},$(t,x.selectedProduct),"kr/st")),n("div",{class:"hemfixarna_counter"},n("img",{class:`${this.getPartAmount(t.ID)===0?"disabled":""}`,src:o,onClick:()=>this.removePart(t)}),n("span",null,this.getPartAmount(t.ID)),n("img",{class:`${this.getAmount()===0?"disabled":""}`,src:a,onClick:()=>this.addPart(t)})))}))),n("h4",{class:"hemfixarna_product--total"},"Totalt ",this.getTotalPrice()," kr"),n("button",{onClick:()=>this.goToCart(),class:`hemfixarna_buy ${this.getAmount()===0?"disabled":""}`},"Fortsätt"),!x.selectedProduct.hide_start_fee&&(x.selectedProduct.rot||x.selectedProduct.rut)&&x.rutOptions&&x.rotOptions&&n("p",{class:"hemfixarna_terms"},n("strong",null,x.selectedProduct.rot?x.rotOptions.rot_start_fee_heading:x.rutOptions.rut_start_fee_heading),n("br",null),n("span",{innerHTML:x.selectedProduct.rot?x.rotOptions.rot_start_fee_text:x.rutOptions.rut_start_fee_text})),x.options&&n("hemfixarna-info",{list:x.options.trust}))))}get el(){return s(this)}};const kt=class{constructor(t){e(this,t)}render(){return n("div",null,n("h2",null,x.selectedService.post_title),n("div",{class:"hemfixarna_categories--wrapper"},n("div",null,n("ul",{class:"hemfixarna_categories"},x.selectedService.products.sort(((t,i)=>t.post_title<i.post_title?-1:1)).map((t=>{var i;return n("hemfixarna-box",{post:t,icon:(i=t.icon.url)!==null&&i!==void 0?i:t.icon,postTitle:t.post_title})})))),n("hemfixarna-info",{list:x.options.trust})))}};const Ct="";const $t=class{constructor(t){e(this,t);this.id=undefined;this.customer=undefined;this.loadFromQuery=false;this.widgetStyle=L.standard;this.buttonColor=undefined;this.buttonBg=undefined}render(){return n("hemfixarna-component",{widgetStyle:this.widgetStyle,buttonBg:this.buttonBg,buttonColor:this.buttonColor,loadFromQuery:this.loadFromQuery,id:this.id,business:F.skanska})}};$t.style=Ct;const St=class{constructor(t){e(this,t);this.tree=undefined;this.slug=undefined}isMainCategory(t){return t.show_products!==undefined}render(){return x.customer?n("div",null,n("h2",null,x.selectedCustomerCategory?x.selectedCustomerCategory.name:"Alla tjänster"),n("div",{class:"hemfixarna_categories--wrapper"},n("ul",{class:"hemfixarna_categories"},x.selectedCustomerCategory?this.isMainCategory(x.selectedCustomerCategory)&&x.selectedCustomerCategory.sub_categories&&!x.selectedCustomerCategory.show_products?x.selectedCustomerCategory.sub_categories.map((t=>n("hemfixarna-box",{category:t}))):x.selectedCustomerCategory.products?x.selectedCustomerCategory.products.map((t=>n("hemfixarna-box",{category:t.fields}))):null:x.customer.categories.map((t=>n("hemfixarna-box",{category:t})))),n("hemfixarna-info",{list:x.options.trust}))):n("div",null,n("h2",null,"Alla tjänster"),n("div",{class:"hemfixarna_categories--wrapper"},n("ul",{class:"hemfixarna_categories"},this.tree.sub_cats.sort(((t,i)=>t.name<i.name?-1:1)).map((t=>{var i;return n("hemfixarna-box",{post:t,icon:(i=t.icon.url)!==null&&i!==void 0?i:t.icon,postTitle:t.name})}))),n("hemfixarna-info",{list:x.options.trust})))}};const Tt="";const zt=class{constructor(t){e(this,t);this.id=undefined;this.loadFromQuery=false;this.widgetStyle=L.standard;this.buttonColor=undefined;this.buttonBg=undefined}render(){return n("hemfixarna-component",{widgetStyle:this.widgetStyle,buttonBg:this.buttonBg,buttonColor:this.buttonColor,loadFromQuery:this.loadFromQuery,id:this.id,business:F.string})}};zt.style=Tt;export{_ as hemfixarna_address,N as hemfixarna_box,A as hemfixarna_breadcrumbs,D as hemfixarna_byggmax,B as hemfixarna_cart,K as hemfixarna_category,q as hemfixarna_checkout,Z as hemfixarna_component,it as hemfixarna_demo,mt as hemfixarna_getuser,gt as hemfixarna_hornbach,bt as hemfixarna_info,vt as hemfixarna_kund,_t as hemfixarna_order,yt as hemfixarna_orderrows,wt as hemfixarna_product,kt as hemfixarna_service,$t as hemfixarna_skanska,St as hemfixarna_start,zt as hemfixarna_string_furniture};
2
+ //# sourceMappingURL=p-96c4d08c.entry.js.map
@@ -167,7 +167,6 @@ interface CartItem {
167
167
  rot: boolean;
168
168
  start_fee: boolean;
169
169
  terms_checkout: string;
170
- terms_show_checkbox: boolean;
171
170
  icon?: Icon | string;
172
171
  }
173
172
  export declare enum Business {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hemfixarna-web-components",
3
- "version": "1.3.2",
3
+ "version": "1.3.3",
4
4
  "author": "Afonso <info@afonso.se> (http://afonso.se)",
5
5
  "description": "Web components to integrate with hemfixarna api",
6
6
  "main": "dist/index.cjs.js",
@@ -1,2 +0,0 @@
1
- import{g as t,f as i,r as e,h as n,a as s,F as a,c as r}from"./p-62a7c1a2.js";const o=(t,i,e)=>{const n=t.get(i);if(!n){t.set(i,[e])}else if(!n.includes(e)){n.push(e)}};const l=(t,i)=>{let e;return(...n)=>{if(e){clearTimeout(e)}e=setTimeout((()=>{e=0;t(...n)}),i)}};const h=t=>!("isConnected"in t)||t.isConnected;const c=l((t=>{for(let i of t.keys()){t.set(i,t.get(i).filter(h))}}),2e3);const u=()=>{if(typeof t!=="function"){return{}}const e=new Map;return{dispose:()=>e.clear(),get:i=>{const n=t();if(n){o(e,i,n)}},set:t=>{const n=e.get(t);if(n){e.set(t,n.filter(i))}c(e)},reset:()=>{e.forEach((t=>t.forEach(i)));c(e)}}};const d=t=>typeof t==="function"?t():t;const p=(t,i=((t,i)=>t!==i))=>{const e=d(t);let n=new Map(Object.entries(e!==null&&e!==void 0?e:{}));const s={dispose:[],get:[],set:[],reset:[]};const a=()=>{var i;n=new Map(Object.entries((i=d(t))!==null&&i!==void 0?i:{}));s.reset.forEach((t=>t()))};const r=()=>{s.dispose.forEach((t=>t()));a()};const o=t=>{s.get.forEach((i=>i(t)));return n.get(t)};const l=(t,e)=>{const a=n.get(t);if(i(e,a,t)){n.set(t,e);s.set.forEach((i=>i(t,e,a)))}};const h=typeof Proxy==="undefined"?{}:new Proxy(e,{get(t,i){return o(i)},ownKeys(t){return Array.from(n.keys())},getOwnPropertyDescriptor(){return{enumerable:true,configurable:true}},has(t,i){return n.has(i)},set(t,i,e){l(i,e);return true}});const c=(t,i)=>{s[t].push(i);return()=>{f(s[t],i)}};const u=(i,e)=>{const n=c("set",((t,n)=>{if(t===i){e(n)}}));const s=c("reset",(()=>e(d(t)[i])));return()=>{n();s()}};const p=(...t)=>{const i=t.reduce(((t,i)=>{if(i.set){t.push(c("set",i.set))}if(i.get){t.push(c("get",i.get))}if(i.reset){t.push(c("reset",i.reset))}if(i.dispose){t.push(c("dispose",i.dispose))}return t}),[]);return()=>i.forEach((t=>t()))};const m=t=>{const i=n.get(t);s.set.forEach((e=>e(t,i,i)))};return{state:h,get:o,set:l,on:c,onChange:u,use:p,dispose:r,reset:a,forceUpdate:m}};const f=(t,i)=>{const e=t.indexOf(i);if(e>=0){t[e]=t[t.length-1];t.length--}};const m=(t,i)=>{const e=p(t,i);e.use(u());return e};const{state:x,onChange:g}=m({step:1,checkoutStep:1,checkoutEdit:false,selectedCategory:null,selectedService:null,selectedProduct:null,cart:[],business:"undefined",options:null,rut:true,rot:true,token:null,user:null,modal:null,rutOptions:null,rotOptions:null,customer:null,selectedCustomerCategory:null,parentCategory:null,creditSafeUser:null});g("cart",(t=>{window.sessionStorage.setItem(`hemfixarna-${x.business}-cart`,JSON.stringify(t))}));g("user",(t=>{window.sessionStorage.setItem(`hemfixarna-${x.business}-user`,JSON.stringify(t))}));g("creditSafeUser",(t=>{window.sessionStorage.setItem(`hemfixarna-${x.business}-creditSafeUser`,JSON.stringify(t))}));g("selectedProduct",(t=>{if(!x.customer||!t)return;const i=[...x.customer.categories,...x.customer.categories.map((t=>{var i;return(i=t.sub_categories)!==null&&i!==void 0?i:[]}))].flat();const e=i.find((i=>i&&i.id===t.category));if(e){x.parentCategory=e;return}x.parentCategory=null}));g("selectedCustomerCategory",(t=>{if(!x.customer||!t)return;if(t.parent){const i=x.customer.categories.find((i=>i.id===t.parent));if(i){x.parentCategory=i;return}}x.parentCategory=null}));const b=t=>t.split(" ").reduce(((t,i)=>{if(i.length<=2){return t+i.slice(0,1)+"* "}else{return t+i.slice(0,1)+"*".repeat(i.length-2)+i.slice(-1)+" "}}),"");const v=t=>{if(!t)return;t.scrollTo({top:0,behavior:"smooth"})};const _=class{constructor(t){e(this,t);this.handleSubmit=t=>{t.preventDefault();const i=this.street.length>0;if(!i){this.streetError="Ange en gatuadress"}const e=this.zip.length>0;const n=/^\s*\d[\d\s]*$/.test(this.zip);if(!n){this.zipError="Postnummer får endast innehålla siffror"}if(!e){this.zipError="Ange ett postnummer"}const s=/^[^\d\s]{2,}$/.test(this.town);if(!s){this.townError="Ange en ort"}if(i&&e&&s&&n){x.user=Object.assign(Object.assign({},x.user),{street:this.street,zip:this.zip,town:this.town});x.checkoutStep=2;x.checkoutEdit=false;const t=this.el.closest(".hemfixarna_content");v(t)}};this.handleChangeStreet=t=>{this.streetError=null;this.street=this.street===x.user.street?"":t.target.value};this.handleChangeZip=t=>{this.zipError=null;this.zip=this.zip===x.user.zip?"":t.target.value};this.handleChangeTown=t=>{this.townError=null;this.town=this.town===x.user.town?"":t.target.value};this.render=()=>n("form",{class:"hemfixarna_address",onSubmit:t=>this.handleSubmit(t)},n("div",null,n("input",{class:`${this.street.length?"input_active":""}`,onInput:this.handleChangeStreet,type:"text",name:"street",value:this.street===x.user.street?b(this.street):this.street}),n("label",{htmlFor:"street"},"Gatuaddress ")),this.streetError&&n("span",null,this.streetError),n("div",null,n("input",{class:`${this.zip.length?"input_active":""}`,onInput:this.handleChangeZip,type:"tel",name:"zip",value:this.zip===x.user.zip?b(this.zip):this.zip}),n("label",{htmlFor:"zip"},"Postnummer ")),this.zipError&&n("span",null,this.zipError),n("div",null,n("input",{class:`${this.town.length?"input_active":""}`,onInput:this.handleChangeTown,type:"text",name:"town",value:this.town===x.user.town?b(this.town):this.town}),n("label",{htmlFor:"town"},"Ort ")),this.townError&&n("span",null,this.townError),n("input",{type:"submit",value:"Fortsätt och Boka"}));this.street="";this.streetError=null;this.zip="";this.zipError=null;this.town="";this.townError=null}componentWillLoad(){if(x.user){this.street=x.user.street;this.zip=x.user.zip;this.town=x.user.town}}get el(){return s(this)}};const y=t=>Math.ceil(t/2);const w=t=>Math.ceil(t*.7);const k=(t,i,e=1)=>{if(t.rot&&x.rot){return w((i||t.price)*e)}else if(t.rut&&x.rut){return y((i||t.price)*e)}else{return(i||t.price)*e}};const C=t=>{if(t.rot){return w(t.price)}else if(t.rut&&x.rut){return y(t.price)}else{return t.price}};const $=(t,i,e=1)=>{if(i.rot&&x.rot){return w(t.price*e)}else if(i.rut&&x.rut){return y(t.price*e)}else{return t.price*e}};const S=()=>{if(!x.cart)return{rut:0,rot:0};const t=x.cart.some((t=>t.rut&&t.start_fee));const i=x.cart.some((t=>t.rot&&t.start_fee));const e=x.rut?y(x.options.start_fee):x.options.start_fee*1;const n=x.rot?w(x.options.start_fee):x.options.start_fee*1;if(t&&i){return{rut:e,rot:n,length:2}}else if(t){return{rut:e,rot:0,length:1}}else if(i){return{rut:0,rot:n,length:1}}else{return{rut:0,rot:0,length:0}}};const T=t=>{const i=t.parts.reduce(((t,i)=>t+i.price*i.amount),0);return k(t,t.price*t.amount+i)};const z=()=>{const t=x.cart.reduce(((t,i)=>i.rot?t+T(i):t),0)+S().rot;const i=x.cart.reduce(((t,i)=>{const e=i.parts.reduce(((t,i)=>t+i.price*i.amount),0);return i.rot?t+i.price*i.amount+e:t}),0)+Number(x.options.start_fee);return i-t};const j=()=>{const t=x.cart.reduce(((t,i)=>i.rut?t+T(i):t),0)+S().rut;const i=x.cart.reduce(((t,i)=>{const e=i.parts.reduce(((t,i)=>t+i.price*i.amount),0);return i.rut?t+i.price*i.amount+e:t}),0)+Number(x.options.start_fee);return i-t};const O=()=>x.cart.reduce(((t,i)=>t+T(i)),0)+S().rot+S().rut;const I=t=>t.post_name!==undefined;const N=class{constructor(t){e(this,t);this.post=undefined;this.category=undefined;this.icon=undefined;this.postTitle=undefined}setTaxonomy(t){if(t){if((t===null||t===void 0?void 0:t.taxonomy)==="service_cat"){x.selectedCategory=t;x.step=2}else if((t===null||t===void 0?void 0:t.post_type)==="service"){x.selectedService=t;x.step=3}else if((t===null||t===void 0?void 0:t.post_type)==="ikea_product"){x.selectedProduct=t;x.step=4}const i=this.el.closest(".hemfixarna_content");v(i)}}setProduct(){x.selectedProduct=this.category;x.step=4;x.selectedCustomerCategory=null;const t=this.el.closest(".hemfixarna_content");v(t)}render(){return this.category?n(a,null,I(this.category)?n("li",{onClick:()=>this.setProduct()},n("img",{class:"hemfixarna_logo",height:82,src:this.category.icon,alt:this.category.post_name}),n("div",null,n("p",null,this.category.post_title),n("p",{class:"price"},"Från ",k(this.category),"kr"))):n("li",{onClick:()=>x.selectedCustomerCategory=this.category},n("img",{class:"hemfixarna_logo",height:82,src:this.category.icon,alt:this.category.name}),n("div",null,n("p",null,this.category.name)))):n("li",{onClick:()=>this.setTaxonomy(this.post)},this.post.icon&&n("img",{class:"hemfixarna_logo",height:82,src:this.icon,alt:this.postTitle}),n("div",null,n("p",null,this.postTitle),x.step===3&&n("p",{class:"price"},"Från ",k(this.post),"kr")))}get el(){return s(this)}};const A=class{constructor(t){e(this,t);this.triggerScrollTotop=()=>{const t=this.el.nextSibling;v(t)};this.tree=undefined;this.closeModal=undefined;this.loadFromQuery=false;this.isDemo=false}getCartLength(){return x.cart.reduce(((t,i)=>t+i.amount),0)}handleCartClick(){var t;if((t=x.cart)===null||t===void 0?void 0:t.length){x.step=5;this.triggerScrollTotop()}}handleHomePageClick(){x.step=1;x.parentCategory=null;x.selectedCustomerCategory=null;this.triggerScrollTotop();setTimeout((()=>{x.selectedCategory=null;x.selectedProduct=null;x.selectedService=null}),200)}render(){const t=r(`./assets/hemfixarna.svg`);const i=r(`./assets/close.svg`);const e=r(`./assets/cart.svg`);const s=r(`./assets/back.svg`);return n("div",null,n("div",{class:"hemfixarna_crumbs"},n("div",{class:"hemfixarna_crumbs--links"},n("img",{onClick:()=>this.handleHomePageClick(),src:t,width:110}),!this.loadFromQuery||this.isDemo?n("img",{onClick:()=>this.closeModal(),class:"close",src:i,width:32}):null,n("div",null,n("button",{onClick:()=>this.handleHomePageClick()},"Alla tjänster"))),n("div",{onClick:()=>this.handleCartClick(),class:`cart ${this.getCartLength()>0?"cart_active":""}`},n("img",{src:e,width:24}),n("span",null,this.getCartLength()))),[3,4].includes(x.step)&&!x.customer&&n("button",{class:"hemfixarna_crumbs--back",onClick:()=>{x.step=x.step===4?3:2}},n("img",{width:24,src:s,alt:"back arrow"}),n("span",null,"Se allt ",x.step===4?x.selectedService.post_title:x.selectedCategory.name)),x.parentCategory&&x.step<5&&n("button",{class:"hemfixarna_crumbs--back",onClick:()=>{x.step=1;x.selectedCustomerCategory=x.parentCategory;x.selectedProduct=null}},n("img",{width:24,src:s,alt:"back arrow"}),n("span",null,"Se allt ",x.parentCategory.name)))}get el(){return s(this)}};var F;(function(t){t["kund"]="kund";t["byggmax"]="byggmax";t["skanska"]="skanska";t["string"]="string-furniture";t["hornbach"]="hornbach"})(F||(F={}));var L;(function(t){t["standard"]="standard";t["alternative"]="alternative";t["alternative_2"]="alternative_2";t["alternative_3"]="alternative_3"})(L||(L={}));var M;(function(t){t["byggmax"]="category/bygg"})(M||(M={}));const P="";const B=class{constructor(t){e(this,t);this.tree=null;this.slug=undefined;this.id=undefined;this.forceOldTree=false;this.loadFromQuery=false;this.customer=undefined;this.widgetStyle=L.standard;this.buttonColor=undefined;this.buttonBg=undefined}render(){return n("hemfixarna-component",{forceOldTree:this.forceOldTree,id:this.id,slug:this.slug,business:F.byggmax,topCategory:M.byggmax,loadFromQuery:this.loadFromQuery,widgetStyle:this.widgetStyle,buttonBg:this.buttonBg,buttonColor:this.buttonColor})}};B.style=P;const D=class{constructor(t){e(this,t);this.tree=undefined}render(){const t=r(`./assets/back.svg`);return n("div",{class:"hemfixarna_cart"},n("div",{class:"hemfixarna_cart--left"},n("h2",null,x.checkoutStep===2&&!x.checkoutEdit&&n("button",{onClick:()=>{x.checkoutStep=1}},n("img",{width:24,src:t,alt:"back arrow"})),"Din bokning"),n("hemfixarna-orderrows",{tree:this.tree})),n("div",{class:"hemfixarna_cart--right"},n("h2",null,x.checkoutStep===2&&!x.checkoutEdit&&n("button",{onClick:()=>{x.checkoutStep=1}},n("img",{width:24,src:t,alt:"back arrow"})),"Dina uppgifter"),n("hemfixarna-checkout",null),n("hemfixarna-info",null)))}};const K=class{constructor(t){e(this,t)}setSelectedService(t){x.selectedService=t;x.step=3}render(){return n("div",null,n("h2",null,x.selectedCategory.name),n("div",{class:"hemfixarna_categories--wrapper"},n("div",null,n("ul",{class:"hemfixarna_categories"},x.selectedCategory.services.sort(((t,i)=>t.post_title<i.post_title?-1:1)).map((t=>{var i;return n("hemfixarna-box",{post:t,icon:(i=t.icon.url)!==null&&i!==void 0?i:t.icon,postTitle:t.post_title})})))),n("hemfixarna-info",{list:x.options.trust})))}};const U=`${"https://hemfixarna.se"}/wp-json/headless`;async function J(t,i){const e=await fetch(t,i);const n=await e.json();return n}const R=async t=>{if(!t){return}const i=t.split("/")[0];const e=t.split("/")[1];try{const t=await fetch(`${U}/${i}/${e}`);return await t.json()}catch(t){console.log(t)}};const H=async t=>{try{const i=await fetch(`${U}/customer/${t}`);return await i.json()}catch(t){console.log(t)}};const W=async()=>{try{const t=await fetch(`${U}/webcoptions`);return await t.json()}catch(t){console.log(t)}};const E=async()=>{try{const t=await J(`${U}/rut`);return t}catch(t){console.log(t)}};const X=async()=>{try{const t=await fetch(`${U}/rot`);return await t.json()}catch(t){console.log(t)}};const V=async t=>{try{const i=await fetch(`${U}/weborder`,{method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json"}});return await i.json()}catch(t){console.log(t)}};const Q=`${"https://hemfixarna.se"}/wp-json/felix`;const Y=async t=>{try{return await J(`${Q}/createperson`,{method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json"}})}catch(t){console.log(t)}};const q=class{constructor(t){e(this,t);this.handleChangeDate=t=>{this.dateError=null;this.date=t.target.value};this.handleChangeTerms=()=>{this.generalError=null};this.sendOrder=async()=>{var t,i;if(this.loading)return;this.loading=true;let e={firstName:x.creditSafeUser.firstName,lastName:x.creditSafeUser.lastName,street:x.user.street,zip:x.user.zip,town:x.user.town,ssn:x.user.ssn,email:x.user.email,phone:x.user.phone,url:`${x.business===F.string?"string":x.business}-webk`,date:this.date,products:[...x.cart.map((t=>{const i=t.parts.map((t=>({id:String(t.id),name:t.name,quantity:t.amount,rut:0,rot:0})));return[{id:String(t.id),name:t.name,quantity:t.amount,rot:t.rot?1:0,rut:t.rut?1:0},...i]}))].flat(),creditSafe:x.creditSafeUser,customer:x.business};const n=await Y(e);if(!n||!((i=(t=n.response)===null||t===void 0?void 0:t.scriptResult)===null||i===void 0?void 0:i.includes("OK"))){e=Object.assign(Object.assign({},e),{felixStatus:"error"})}else{e=Object.assign(Object.assign({},e),{felixStatus:"success"})}try{const{data:t,status:i}=await V(e);if(t&&i&&i===200){x.step=6;const t=this.el.closest(".hemfixarna_content");v(t)}else{this.generalError="Något gick fel, försök igen senare"}}catch(t){this.generalError="Något gick fel, försök igen senare"}this.loading=false};this.handleSubmit=t=>{t.preventDefault();this.generalError=null;const i=this.date.length>0;if(!i){this.dateError="Ange ett giltigt datum"}const e=Array.from(this.el.querySelectorAll('input[type="checkbox"]'));const n=e.find((t=>!t.checked));if(n){this.generalError="Du måste godkänna villkoren"}if(i&&!n){this.sendOrder()}};this.render=()=>{const t=r(`./assets/date.svg`);const i=r(`./assets/down.svg`);const e=r(`./assets/spinner.gif`);if(x.checkoutEdit){return n("hemfixarna-address",null)}else if(x.checkoutStep===1){return n("hemfixarna-getuser",null)}else if(x.checkoutStep===2){return n("div",{class:"mb-2"},n("div",{class:"hemfixarna_addressinfo"},n("div",null,n("p",null,b(x.user.firstName)),n("p",null,b(x.user.lastName)),n("p",null,x.user.email),n("p",null,x.user.phone)),n("div",null,n("p",null,b(x.user.street)),n("p",null,b(x.user.zip)),n("p",null,b(x.user.town))),n("button",{onClick:()=>x.checkoutEdit=true},"Behöver du ändra adressen?")),n("form",{onSubmit:t=>this.handleSubmit(t)},n("div",null,n("img",{src:t,width:24}),n("input",{class:`${this.date.length?"input_active":""}`,min:(new Date).toISOString().split("T")[0],onChange:t=>this.handleChangeDate(t),type:"date",name:"date",value:this.date}),n("label",{htmlFor:"date"},"Tidigaste datum för hembesök"),n("img",{src:i,width:24})),this.dateError&&n("span",null,this.dateError),n("label",{class:"hemfixarna_checkbox"},n("input",{onChange:()=>this.handleChangeTerms(),type:"checkbox"}),n("span",{innerHTML:x.options.terms})),x.cart.filter((t=>t.terms_checkout&&t.terms_show_checkbox)).map((t=>n(a,null,n("label",{class:"hemfixarna_checkbox"},n("input",{onChange:()=>this.handleChangeTerms(),type:"checkbox"}),n("span",null,t.terms_checkout))))),this.generalError&&n("span",null,this.generalError),n("div",{class:this.loading?"loading":""},n("input",{type:"submit",value:this.loading?"":"Slutför Bokning"}),n("img",{width:20,height:20,src:e,alt:"spinner"}))))}};this.date="";this.dateError=null;this.generalError=null;this.loading=false}componentWillLoad(){if(Boolean(x.user&&x.user.street)){x.checkoutStep=2}}get el(){return s(this)}};const G='@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap"); *{box-sizing:border-box}:host{font-family:"Inter", sans-serif}:host .mb-2{margin-bottom:32px}:host button{color:#474444}:host form{display:flex;flex-direction:column;gap:16px}:host form img{position:absolute;top:50%;transform:translateY(-50%);pointer-events:none}:host form img:first-of-type{left:16px}:host form img:last-of-type{right:16px}:host form span{margin-top:-8px;color:#ec6632}:host form p{text-align:center}:host form p{margin:0}:host form div{position:relative}:host form div label{pointer-events:none;position:absolute;left:16px;top:50%;transform:translateY(-50%);background:#fff;padding:4px;transition:0.2s all cubic-bezier(0.465, 0.183, 0.153, 0.946)}:host form div input{padding:16px;width:100%;font-size:16px;border:1px solid #fcd9c9}:host form div input:focus~label,:host form div .input_active~label{top:0;transform:translateY(-50%);background:linear-gradient(180deg, #fffaf2 50%, #fff 50%)}:host h1{font-size:24px;font-weight:400;line-height:32px;letter-spacing:-3%;text-align:left;margin:0 0 8px}:host h2{margin:0 0 24px;font-weight:700;font-size:20px;line-height:28px;letter-spacing:-3%}:host p{font-size:16px;font-weight:400;line-height:24px;letter-spacing:-3%}:host .hemfixarna{width:100%;}:host .hemfixarna_nav{position:absolute;top:0;width:100dvw;left:0;height:80px;z-index:9999}:host .hemfixarna_nav--links{display:none !important}@media (min-width: 769px){:host .hemfixarna_nav--links{display:flex !important}}:host .hemfixarna_nav--links a{color:#ec6632;text-decoration:none;border:1px solid rgba(255, 255, 255, 0.3);border-radius:56px;padding:8px 32px;text-transform:capitalize}:host .hemfixarna_nav>div{position:relative;overflow:hidden;width:100%;height:100%;display:flex;justify-content:space-between;align-items:center;padding:0 16px}@media (min-width: 769px){:host .hemfixarna_nav>div{padding:0 32px}}:host .hemfixarna_nav>div>div{display:flex;gap:32px;justify-content:space-between}:host .hemfixarna_nav>div>img{position:absolute;width:100%;height:100%;top:0;left:0;z-index:-1}:host .hemfixarna_nav p{color:#fff}:host .hemfixarna_standalone .hemfixarna_backdrop{background:#fffaf2;opacity:1}:host .hemfixarna_standalone .hemfixarna_modal{top:80px;transform:translateX(-50%);border:none;height:calc(100dvh - 80px);opacity:0}:host .hemfixarna_standalone .hemfixarna_modal--open{opacity:1}:host .hemfixarna .switch{position:relative;display:inline-block;width:40px;height:20px}:host .hemfixarna .switch input{opacity:0;width:0;height:0}:host .hemfixarna .slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:#ccc;-webkit-transition:0.4s;transition:0.4s;border-radius:34px}:host .hemfixarna .slider:before{position:absolute;content:"";height:18px;width:18px;left:2px;bottom:1px;background-color:white;-webkit-transition:0.4s;transition:0.4s;border-radius:50%}:host .hemfixarna input:checked+.slider{background-color:#fcd9c9}:host .hemfixarna input:focus+.slider{box-shadow:0 0 1px #fcd9c9}:host .hemfixarna input:checked+.slider:before{-webkit-transform:translateX(18px);-ms-transform:translateX(18px);transform:translateX(18px);background:#ec6632}:host .hemfixarna_checkbox{display:grid;grid-template-columns:40px auto;font-size:16px;font-weight:400;line-height:24px;letter-spacing:-3%}:host .hemfixarna_checkbox>span{transform:translateY(6px)}:host .hemfixarna_checkbox span,:host .hemfixarna_checkbox span p{color:#474444;font-size:14px}:host .hemfixarna_checkbox p{text-align:left}:host .hemfixarna_info{display:flex;flex-direction:column;gap:24px;padding:32px;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);border-radius:4px;border:1px solid #fcd9c9}:host .hemfixarna_info h2{margin:0}@media (min-width: 769px){:host .hemfixarna_info{position:sticky;top:0}}:host .hemfixarna_infomodal{position:absolute;top:40%;left:50%;transform:translate(-50%, -50%);width:100%;max-width:80%;background:#fffaf2;border:1px solid #fcd9c9;padding:32px;z-index:99;border-radius:4px;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);display:flex;flex-direction:column;gap:16px}:host .hemfixarna_infomodal p,:host .hemfixarna_infomodal h4{margin:0}:host .hemfixarna_infomodal button{background:#ec6632;color:#fff;border-radius:60px;font-size:16px;padding:8px 16px}:host .hemfixarna_addressinfo{padding:16px 16px 64px;border:1px solid #fcd9c9;position:relative;margin-bottom:32px;display:grid;grid-template-columns:1fr;gap:8px}@media (min-width: 769px){:host .hemfixarna_addressinfo{grid-template-columns:1fr 1fr}}:host .hemfixarna_addressinfo button{position:absolute;bottom:16px;right:16px;font-weight:500;text-underline-offset:2px;text-decoration:underline}:host .hemfixarna_part{background:#fff;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);display:grid;padding:16px;grid-template-columns:auto 75px}:host .hemfixarna_counter{display:flex;align-items:center}:host .hemfixarna_counter span{padding:0 8px}:host .hemfixarna_counter img{cursor:pointer}:host .hemfixarna_counter img:not(.disabled):hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_description{display:grid;gap:16px}:host .hemfixarna_description ul{list-style:disc;padding-right:12px;transform:translateX(12px)}:host .hemfixarna_description--hidden{max-height:140px;overflow:hidden;position:relative;cursor:pointer}:host .hemfixarna_description--hidden::after{content:"";position:absolute;bottom:0;left:0;right:0;height:128px;background:linear-gradient(180deg, rgba(255, 253, 250, 0), rgba(255, 253, 250, 0.46) 50%, #fffaf2)}:host .hemfixarna_terms{font-size:14px}:host .hemfixarna_terms a{color:inherit}:host .hemfixarna_logo{height:64px}:host .hemfixarna_box{padding:16px;display:flex;align-items:center;width:100%;box-sizing:border-box;border-radius:4px;gap:16px 8px;border-radius:4px;gap:16px 8px}:host .hemfixarna_box p,:host .hemfixarna_box span{font-size:15px}:host .hemfixarna_box .underline{text-decoration:underline;text-underline-offset:2px}:host .hemfixarna_box .pointer{cursor:pointer}:host .hemfixarna_box .p-s{font-size:12px}:host .hemfixarna_box>div{display:grid;gap:8px}:host .hemfixarna_box--standard{background:#fffaf2;border:1px solid #fcd9c9}:host .hemfixarna_box--alternative,:host .hemfixarna_box--alternative_2,:host .hemfixarna_box--alternative_3{background:transparent;border:1px solid #e3e3e3}:host .hemfixarna_box--alternative_2,:host .hemfixarna_box--alternative_3{box-shadow:0px 2px 16px 0px rgba(0, 0, 0, 0.0784313725)}:host .hemfixarna_box--alternative_3{justify-content:center}:host .hemfixarna_altbtn{display:flex !important;flex-direction:column;gap:8px;align-items:center;margin-left:auto}:host .hemfixarna_btn{margin-left:auto}:host .hemfixarna_btn,:host .hemfixarna_buy,:host .hemfixarna input[type=submit]{border:none;border-radius:60px;font-weight:600;letter-spacing:0.5px;line-height:20px;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_btn:not(.disabled):hover,:host .hemfixarna_buy:not(.disabled):hover,:host .hemfixarna input[type=submit]:not(.disabled):hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna div:has(>input[type=submit]){position:relative}:host .hemfixarna div:has(>input[type=submit]) input{cursor:initial}:host .hemfixarna div:has(>input[type=submit]) img{display:none}:host .hemfixarna .loading{cursor:default;opacity:0.6}:host .hemfixarna .loading>img{display:initial !important;position:absolute;top:50%;left:50%;transform:translate(-50%, -50%)}:host .hemfixarna_btn{font-size:14px;background:#c84e18;color:#fff;padding:16px 24px;white-space:nowrap;position:relative}:host .hemfixarna_btn span{position:absolute;background:#fff;border-radius:100%;width:24px;height:24px;display:flex;justify-content:center;align-items:center;font-weight:600;font-size:13px;line-height:11px;top:-8px;right:-12px}:host .hemfixarna_btn span{background:#25a710;color:#fff;right:0 !important}:host .hemfixarna_buy,:host .hemfixarna input[type=submit]{font-size:21px;background:#25a710;color:#fff;padding:16px 24px}:host .hemfixarna .disabled{opacity:0.5;cursor:default}:host .hemfixarna_modal{position:fixed;background:#fffaf2;border:1px solid #fcd9c9;border-radius:4px;top:50%;left:50%;z-index:1000;transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);transform:translate(-50%, -50%) scale(0.7);opacity:0;height:92%;width:92%;max-width:920px;display:flex;flex-direction:column;gap:8px}:host .hemfixarna_modal--open{opacity:1;transform:translate(-50%, -50%) scale(1)}:host .hemfixarna_backdrop{z-index:999;position:fixed;background:#474444;top:0;left:0;bottom:0;right:0;opacity:0;transition:transform 0.1s cubic-bezier(0.465, 0.183, 0.153, 0.946), opacity 0.1s cubic-bezier(0.465, 0.183, 0.153, 0.946)}:host .hemfixarna_backdrop--open{opacity:0.3}:host .hemfixarna_order{position:absolute;top:-1px;left:-1px;right:-1px;bottom:-1px;background-repeat:no-repeat !important;background-size:cover !important;background-position:center !important;display:grid;grid-template-columns:1fr 1fr;padding:48px 32px 64px}@media (max-width: 768px){:host .hemfixarna_order{grid-template-columns:1fr;grid-template-rows:0 auto}}:host .hemfixarna_order>div:last-of-type{background:#fffaf2;padding:32px;display:flex;flex-direction:column;max-height:100%;overflow:auto}:host .hemfixarna_order img{cursor:pointer}:host .hemfixarna_order button{margin:16px 0;padding:0;text-decoration:underline;text-underline-offset:2px;font-size:14px;font-weight:600}:host .hemfixarna_cart{display:grid;grid-template-columns:1fr 1fr;gap:32px}@media (max-width: 768px){:host .hemfixarna_cart{grid-template-columns:1fr;gap:0}}:host .hemfixarna_cart--right h2,:host .hemfixarna_cart--left h2{display:flex;align-items:center}:host .hemfixarna_cart--right h2 img,:host .hemfixarna_cart--left h2 img{margin-top:3.2px}@media (min-width: 769px){:host .hemfixarna_cart--left h2 button{display:none}}@media (max-width: 768px){:host .hemfixarna_cart--right h2 button{display:none}}:host .hemfixarna_cart--startfee{display:flex;justify-content:space-between}:host .hemfixarna_cart--rutrot{display:flex;justify-content:space-between}:host .hemfixarna_cart--rutrot div{display:flex;gap:16px;align-items:center}:host .hemfixarna_cart--additional{display:flex;flex-direction:column;gap:16px;padding:16px;border-top:1px solid #fcd9c9}:host .hemfixarna_cart--additional p{font-size:14px}:host .hemfixarna_cart--additional strong{text-decoration:underline;text-underline-offset:2px;cursor:pointer;position:relative}:host .hemfixarna_cart--additional strong img{position:absolute;top:50%;transform:translateY(-50%);right:-24px}:host .hemfixarna_cart--price{border-top:1px solid #fcd9c9;padding:16px;display:flex;justify-content:space-between}:host .hemfixarna_cart--price h3{margin:0}:host .hemfixarna_cart--item{display:flex;flex-direction:column;gap:8px;padding:16px 0;border-top:1px solid #fcd9c9}:host .hemfixarna_cart--item>div{display:flex;justify-content:space-between}:host .hemfixarna_cart--item>div>div{display:flex;align-items:center;gap:16px}:host .hemfixarna_cart--item>div button{color:#ec6632}:host .hemfixarna_categories{display:grid;gap:24px}:host .hemfixarna_categories--wrapper{gap:32px;display:grid;grid-template-columns:1fr 1fr}@media (max-width: 768px){:host .hemfixarna_categories--wrapper{grid-template-columns:1fr}}:host .hemfixarna_categories li{position:relative;background:#fff;border-radius:4px;min-height:132px;padding:24px;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);display:flex;align-items:center;gap:24px;cursor:pointer}:host .hemfixarna_categories li:hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_categories li>button{height:100%;width:100%}:host .hemfixarna_categories li .price{font-weight:700}:host .hemfixarna_content{height:100%;overflow:auto;padding:0 32px 64px}:host .hemfixarna_content--5{padding-top:16px}:host .hemfixarna_crumbs{position:relative;padding:16px 24px;border-bottom:1px solid #fcd9c9;display:flex;justify-content:space-between}:host .hemfixarna_crumbs--back{padding:16px 24px 8px;display:flex;align-items:center;gap:8px;box-shadow:none !important}:host .hemfixarna_crumbs--back:hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_crumbs img{cursor:pointer}:host .hemfixarna_crumbs .close{position:absolute;right:-16px;top:-16px;z-index:9}:host .hemfixarna_crumbs .cart{padding-left:16px;position:relative}:host .hemfixarna_crumbs .cart img{cursor:inherit}:host .hemfixarna_crumbs .cart span{position:absolute;background:#fff;border-radius:100%;width:24px;height:24px;display:flex;justify-content:center;align-items:center;font-weight:600;font-size:13px;line-height:11px;top:-8px;right:-12px}:host .hemfixarna_crumbs .cart_active{cursor:pointer}:host .hemfixarna_crumbs .cart_active span{background:#25a710;color:#fff}:host .hemfixarna_crumbs--links{display:flex;align-items:center;gap:16px;overflow:auto}@media (min-width: 769px){:host .hemfixarna_crumbs--links{-ms-overflow-style:none}:host .hemfixarna_crumbs--links::-webkit-scrollbar{display:none}:host .hemfixarna_crumbs--links::-webkit-scrollbar-button{display:none}}:host .hemfixarna_crumbs button{white-space:nowrap;background:#f1ded6;border-radius:64px;padding:12px 16px;font-size:12px;font-weight:600;letter-spacing:0.3px;box-shadow:none !important}:host .hemfixarna_crumbs button:not(.active):hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_crumbs .active{background:#fffaf2;cursor:default}:host .hemfixarna_features{gap:12px !important}:host .hemfixarna_features li{display:flex;gap:16px;align-items:center}:host .hemfixarna_address{margin-bottom:16px}:host .hemfixarna_product{display:grid;gap:16px}:host .hemfixarna_product--link{font-weight:700;color:#474444;text-underline-offset:4px}:host .hemfixarna_product--left{gap:32px}:host .hemfixarna_product--right{gap:32px}:host .hemfixarna_product--price{margin-top:4px;font-weight:700}:host .hemfixarna_product--total{text-align:center;margin:-16px 0;font-size:21px;line-height:28px}:host .hemfixarna_product--item{background:#fff;padding:16px;display:grid;grid-template-columns:auto 75px;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_product--grid{display:grid;grid-template-columns:1fr 1fr;gap:32px}@media (max-width: 768px){:host .hemfixarna_product--grid{grid-template-columns:1fr}}:host .hemfixarna_product--grid>div{display:flex;flex-direction:column}:host .hemfixarna_product--grid ul{display:flex;flex-direction:column;gap:4px}:host .hemfixarna_product p{margin:0}:host .hemfixarna_product--top{display:flex;gap:32px}:host .hemfixarna_product--top>div{width:100%}:host .hemfixarna_product--top>div h1{max-width:80%}@media (max-width: 768px){:host .hemfixarna_product--top>div h1{max-width:100%}}:host .hemfixarna_product--top h4{margin-bottom:8px}:host h5,:host p{margin:0}:host input[type=submit]{cursor:pointer}:host input[type=date]~label{left:56px}:host input[type=date]{border:1px solid #fcd9c9;padding-left:64px}:host input[type=checkbox]{height:18px;width:18px;border:1px solid #fcd9c9}:host input[type=checkbox]:checked{background:red}:host input[type=date]::-webkit-calendar-picker-indicator{background:transparent;bottom:0;color:transparent;cursor:pointer;height:auto;left:0;position:absolute;right:0;top:0;width:auto}:host button,:host a{cursor:pointer;background:none;border:none}:host ul{list-style:none;margin:0;padding:0}';const Z=class{constructor(t){e(this,t);this.slugIsOldFormat=t=>{if(!t)return false;return["product","service","category"].some((i=>t.includes(i)))};this.triggerScrollTotop=()=>{const t=this.el.shadowRoot.querySelector(".hemfixarna_content");v(t)};this.modal=false;this.showModal=false;this.tree=null;this.product=null;this.proppedProduct=null;this.slug=undefined;this.id=undefined;this.business=undefined;this.topCategory=undefined;this.forceOldTree=false;this.loadFromQuery=false;this.isDemo=false;this.widgetStyle=undefined;this.nav=undefined;this.buttonColor=undefined;this.buttonBg=undefined}loadCategoryOrProduct(t){this.proppedProduct=null;if(t.startsWith("c-")){const i=[...x.customer.categories,...x.customer.categories.map((t=>{var i;return(i=t.sub_categories)!==null&&i!==void 0?i:[]}))].flat();const e=i.find((i=>i&&i.id===t.replace("c-","")));if(e){x.selectedCustomerCategory=e;x.step=2}}else{const i=x.customer.categories.map((t=>t.show_products?t.products:t.sub_categories?t.sub_categories.map((t=>t.products)):[])).flat().flat();const e=i.find((i=>i&&i.fields.ID===parseInt(t)));if(e){x.selectedProduct=e.fields;x.step=4;this.proppedProduct=e.fields}}}async watchSlugChange(t){if(this.slugIsOldFormat(t)){this.fetchNewTaxonomy(t)}else if(x.customer&&t){this.loadCategoryOrProduct(t)}}async watchIdChange(t){if(t&&x.customer){this.loadCategoryOrProduct(t)}}async fetchNewTaxonomy(t){x.selectedCategory=null;x.selectedProduct=null;x.selectedService=null;const i=await R(t);if((i===null||i===void 0?void 0:i.code)==="not_found"||(i===null||i===void 0?void 0:i.code)==="rest_no_route"){console.log("taxonomy not found")}else if(i){this.setTaxonomy(i);if((i===null||i===void 0?void 0:i.post_type)==="ikea_product"){this.product=i}}}async componentWillLoad(){x.business=this.business;const t=window.sessionStorage.getItem(`hemfixarna-${this.business}-cart`);if(t){x.cart=JSON.parse(t)}const i=window.sessionStorage.getItem(`hemfixarna-${this.business}-user`);if(i){x.user=JSON.parse(i)}const e=window.sessionStorage.getItem(`hemfixarna-${this.business}-creditSafeUser`);if(e){x.creditSafeUser=JSON.parse(e)}const[n,s,a,r,o]=await Promise.all([this.topCategory?R(this.topCategory):null,this.slug?R(this.slug):Promise.resolve(null),W(),E(),X()]);if((!this.slug||!this.slugIsOldFormat(this.slug))&&!this.forceOldTree){try{const t=await H(this.business);if((t===null||t===void 0?void 0:t.code)==="not_found"){console.warn("customer not found")}else if(t){x.customer=t;if(this.id){this.loadCategoryOrProduct(this.id)}else if(this.slug&&!this.slugIsOldFormat(this.slug)){this.loadCategoryOrProduct(this.slug)}}}catch(t){console.warn("customer not found")}}if((n===null||n===void 0?void 0:n.code)==="not_found");else if(n){this.tree=n}if((s===null||s===void 0?void 0:s.code)==="not_found"){console.log("taxonomy not found")}else if(s){this.setTaxonomy(s);if((s===null||s===void 0?void 0:s.post_type)==="ikea_product"){this.product=s}}if(this.loadFromQuery){const t=new URL(document.location.toString()).searchParams;this.id=t.get("id");if(!this.isDemo){this.openModal()}}x.rotOptions=o;x.rutOptions=r;x.options=a}setTaxonomy(t){if(t){if((t===null||t===void 0?void 0:t.taxonomy)==="service_cat"){x.selectedCategory=t;x.step=2}else if((t===null||t===void 0?void 0:t.post_type)==="service"){x.selectedService=t;x.selectedCategory=this.tree.sub_cats.find((i=>i.services.find((i=>i.ID===t.ID))));x.step=3}else if((t===null||t===void 0?void 0:t.post_type)==="ikea_product"){x.selectedProduct=t;x.selectedService=this.tree.sub_cats.map((t=>t.services)).flat().find((t=>t.products.find((t=>t.ID===x.selectedProduct.ID))));x.selectedCategory=this.tree.sub_cats.find((t=>t.services.find((t=>t.ID===x.selectedService.ID))));x.step=4}this.triggerScrollTotop()}}openModal(){this.modal=true;setTimeout((()=>{this.showModal=true}),50)}closeModal(){this.showModal=false;setTimeout((()=>{this.modal=false}),200)}handleClick(t){if(this.loadFromQuery&&!this.isDemo)return;const i=this.el.shadowRoot.querySelector(".hemfixarna_modal");if(i){const e=i.contains(t.composedPath()[0]);if(!e){this.closeModal()}}const e=this.el.shadowRoot.querySelector(".hemfixarna_infomodal");if(e){const i=e.contains(t.composedPath()[0]);if(!i){x.modal=null}}}getCartLength(){return x.cart.reduce(((t,i)=>t+i.amount),0)}render(){var t,i,e,s,a,o,l,h,c,u,d;const p=r(`./assets/hemfixarna.svg`);const f=r(`./assets/montering.svg`);const m=((t=this.nav)===null||t===void 0?void 0:t.background)?r(this.nav.background):"";const g=((i=this.nav)===null||i===void 0?void 0:i.logo)?r(this.nav.logo):"";return n("div",{class:`hemfixarna ${this.loadFromQuery?"hemfixarna_standalone":""}`},this.loadFromQuery&&!this.isDemo&&this.nav?n("nav",{class:"hemfixarna_nav"},n("div",null,n("div",{class:"hemfixarna_nav--logos"},n("a",{href:this.nav.url,target:"_blank"},n("img",{src:g,alt:`${this.business} logo`})),n("a",{href:"https://hemfixarna.se/",target:"_blank"},n("p",null,"I samarbete med:"),n("img",{src:p,alt:"hemfixarna_logo",width:104}))),n("div",{class:"hemfixarna_nav--links"},n("a",{href:this.nav.url,target:"_blank"},"Till ",this.business),n("a",{href:"https://www.hemfixarna.se/",target:"_blank"},"Till Hemfixarna")),n("img",{src:m,alt:"nav_background"}))):null,!this.loadFromQuery||this.isDemo?n("div",{class:`hemfixarna_box hemfixarna_box--${this.widgetStyle}`},[L.alternative_2,L.alternative_3].includes(this.widgetStyle)?n("img",{src:f,alt:"montering logo",width:32,height:32}):null,n("div",null,n("div",null,n("p",{onClick:()=>this.openModal(),class:`pointer ${[L.alternative_2,L.alternative_3].includes(this.widgetStyle)&&x.selectedProduct?"underline":""}`},((e=this.product)===null||e===void 0?void 0:e.post_title)||((s=this.proppedProduct)===null||s===void 0?void 0:s.post_title)||n("span",null,"Montering",n("wbr",null),"/Installation ",(o=(a=x.selectedCustomerCategory)===null||a===void 0?void 0:a.name)!==null&&o!==void 0?o:"på plats"," - ",n("strong",{class:"underline"},"se priser här")),this.product&&((l=this.slug)===null||l===void 0?void 0:l.includes("product"))||this.proppedProduct?n("span",null," från"," ",n("strong",null,C(this.proppedProduct||this.product),"kr")):null)),this.widgetStyle===L.standard?n("img",{src:p,width:104}):null,this.widgetStyle===L.alternative?n("span",{class:"p-s"},"Utförs av ",n("strong",null,"Hemfixarna")):null),[L.standard,L.alternative].includes(this.widgetStyle)?n("button",{onClick:()=>this.openModal(),class:"hemfixarna_btn",style:{color:((h=this.buttonColor)===null||h===void 0?void 0:h.startsWith("#"))||!((c=this.buttonColor)===null||c===void 0?void 0:c.length)?this.buttonColor:`#${this.buttonColor}`,backgroundColor:((u=this.buttonBg)===null||u===void 0?void 0:u.startsWith("#"))||!((d=this.buttonBg)===null||d===void 0?void 0:d.length)?this.buttonBg:`#${this.buttonBg}`}},"Beställ här",this.getCartLength()>0&&n("span",null,this.getCartLength())):null,L.alternative_2===this.widgetStyle?n("div",{class:"hemfixarna_altbtn"},n("strong",{class:"p-s"},"Utförs av"),n("img",{src:p,alt:"hemfixarna logo",width:98})):null):null,this.modal&&n("div",null,n("div",{class:`hemfixarna_modal ${this.showModal?"hemfixarna_modal--open":""}`},x.modal&&n("div",{class:"hemfixarna_infomodal"},x.modal.title&&n("h2",null,x.modal.title),x.modal.text.map((t=>n("p",{innerHTML:t}))),n("div",null,n("button",{onClick:()=>x.modal=null},"Stäng"))),(this.tree||x.customer)&&n("hemfixarna-breadcrumbs",{isDemo:this.isDemo,loadFromQuery:this.loadFromQuery,closeModal:()=>this.closeModal(),tree:this.tree}),!x.customer||this.slugIsOldFormat(this.slug)?n("div",{class:`hemfixarna_content hemfixarna_content--${x.step}`},x.step===1&&this.tree&&n("hemfixarna-start",{tree:this.tree}),x.step===2&&x.selectedCategory&&n("hemfixarna-category",null),x.step===3&&x.selectedService&&n("hemfixarna-service",null),x.step===4&&x.selectedProduct&&n("hemfixarna-product",null),x.step===5&&n("hemfixarna-cart",{tree:this.tree}),x.step===6&&n("hemfixarna-order",{tree:this.tree})):n("div",{class:`hemfixarna_content hemfixarna_content--${x.step}`},x.step<4&&n("hemfixarna-start",null),x.step===4&&x.selectedProduct&&n("hemfixarna-product",null),x.step===5&&n("hemfixarna-cart",{tree:this.tree}),x.step===6&&n("hemfixarna-order",{tree:this.tree}))),!this.isDemo?n("div",{class:`hemfixarna_backdrop ${this.showModal?"hemfixarna_backdrop--open":""}`}):null))}static get assetsDirs(){return["assets"]}get el(){return s(this)}static get watchers(){return{slug:["watchSlugChange"],id:["watchIdChange"]}}};Z.style=G;const tt='@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap"); :host{font-family:"Inter", sans-serif}:host .hemfixarna_widgetstyles label{cursor:pointer}:host .hemfixarna_widgetstyles>div{display:flex;gap:1rem}:host .hemfixarna_widgetstyles h5{margin:1rem 0}:host .hemfixarna_example{margin-bottom:16px;background:#000;padding:16px;color:#fff;display:flex;justify-content:space-between;cursor:pointer;max-width:500px;box-sizing:border-box;position:relative}:host .hemfixarna_example--tooltip{background:#000;top:-48px;font-size:16px;left:40%;color:white;padding:8px;position:absolute;opacity:0}:host .hemfixarna_example--tooltip::after{content:"";position:absolute;top:100%;left:50%;margin-left:-5px;border-width:5px;border-style:solid;border-color:#000 transparent transparent transparent}:host .hemfixarna_example:hover .hemfixarna_example--tooltip{opacity:1}:host .hemfixarna_example p{font-size:14px}:host .hemfixarna_example img{filter:invert(1)}:host .hemfixarna_install{display:grid;gap:8px;margin-top:16px}:host .hemfixarna_product--label{background:#e1e0f5}:host .hemfixarna_categories{max-height:100%;overflow:auto;position:relative}:host .hemfixarna_categories--label{display:flex;align-items:center;justify-content:space-between;padding:8px}:host .hemfixarna_categories--label button{background:#3f3a92;border:none;font-weight:600;padding:3.2px 9.6px;border-radius:10px;margin-right:8px;color:#ece8e8}:host .hemfixarna_categories--label button:active{transform:scale(0.95)}:host .hemfixarna_categories--label--big{font-weight:600;border-bottom:1px solid black}:host p{margin:0}:host span{color:darkolivegreen;font-size:10px}:host button{cursor:pointer}:host>div{display:grid;gap:32px;width:100%;grid-template-columns:1fr 1fr;height:100vh;place-items:center;overflow:hidden;padding:16px 32px;box-sizing:border-box}:host>div>*{width:100%}:host>div>div{max-width:500px}:host>div ul{margin:0;padding:0;list-style:none}:host>div ul ul{gap:1px;display:grid}:host>div ul li{padding-left:16px;background:#fff}';const it=class{constructor(t){e(this,t);this.debounce=null;this.cdnLink='<script type="module" src="https://cdn.jsdelivr.net/npm//hemfixarna-web-components@latest/dist/hemfixarna-components/hemfixarna-components.esm.js"><\/script>';this.selectedSlug=undefined;this.selectedID=undefined;this.tooltipText="Kopiera till urklipp";this.tree=null;this.customer=null;this.widgetStyle=L.standard;this.buttonBg="";this.buttonColor="";this.colorAccessibility=undefined}debouncedFunction(){if(this.debounce!==null){clearTimeout(this.debounce);this.debounce=null}this.debounce=window.setTimeout((()=>{this.checkColorAccessibility();this.debounce=null}),1500)}async checkColorAccessibility(){const t="#fff";const i="#c84e18";const e=this.buttonBg.length?this.buttonBg.startsWith("#")?this.buttonBg:`#${this.buttonBg}`:i;const n=this.buttonColor.length?this.buttonColor.startsWith("#")?this.buttonColor:`#${this.buttonColor}`:t;fetch("https://www.aremycolorsaccessible.com/api/are-they",{mode:"cors",method:"POST",body:JSON.stringify({colors:[e,n]})}).then((t=>t.json())).then((t=>{console.log(t);if(t&&t){this.colorAccessibility=t}}))}getTopLevelCategory(){switch("byggmax"){case F.byggmax:return M.byggmax;default:return""}}getColor(t){switch(t){case"AAA":return"green";case"AA":return"orange";case"A":return"yellow";case"Fail":return"red";default:return"black"}}async componentWillLoad(){if(process.env.FORCE_OLD_TREE){const t=await R(this.getTopLevelCategory());if((t===null||t===void 0?void 0:t.code)==="not_found");else if(t){this.tree=t}}else{const t=await H("byggmax");if(t.code!=="not_found"&&t){this.customer=t}}}getExample(){return`<hemfixarna-${"byggmax"}${this.selectedSlug?` slug="${this.selectedSlug}" `:""}${this.selectedID?` id="${this.selectedID}" `:""} ${this.widgetStyle===L.standard?"":`widgetStyle="${this.widgetStyle}"`} ${this.buttonColor.length?`buttonColor="${this.buttonColor}"`:""} ${this.buttonBg.length?`buttonBg="${this.buttonBg}"`:""}></hemfixarna-${"byggmax"}>`}copyExample(){navigator.clipboard.writeText(this.getExample());this.tooltipText="Snippet kopierad";setTimeout((()=>{this.tooltipText="Kopiera till urklipp"}),2e3)}copyCdn(){navigator.clipboard.writeText(this.cdnLink);this.tooltipText="Text kopierad";setTimeout((()=>{this.tooltipText="Kopiera till urklipp"}),2e3)}copyNpmInstall(){navigator.clipboard.writeText("npm i hemfixarna-web-components");this.tooltipText="Text kopierad";setTimeout((()=>{this.tooltipText="Kopiera till urklipp"}),2e3)}render(){const t=r(`./assets/copy.png`);return n("div",null,n("div",null,n("div",{onClick:()=>this.copyExample(),class:"hemfixarna_example"},n("p",null,this.getExample()),n("img",{src:t,height:20}),n("span",{class:"hemfixarna_example--tooltip"},this.tooltipText)),"byggmax"===F.byggmax&&n("hemfixarna-byggmax",{buttonColor:this.buttonColor,buttonBg:this.buttonBg,widgetStyle:this.widgetStyle,forceOldTree:Boolean(process.env.FORCE_OLD_TREE),slug:this.selectedSlug,id:this.selectedID}),"byggmax"===F.skanska&&n("hemfixarna-skanska",{buttonColor:this.buttonColor,buttonBg:this.buttonBg,widgetStyle:this.widgetStyle,id:this.selectedID}),"byggmax"===F.string&&n("hemfixarna-string-furniture",{buttonColor:this.buttonColor,buttonBg:this.buttonBg,widgetStyle:this.widgetStyle,id:this.selectedID}),"byggmax"===F.hornbach&&n("hemfixarna-hornbach",{buttonColor:this.buttonColor,buttonBg:this.buttonBg,widgetStyle:this.widgetStyle,isDemo:true,id:this.selectedID}),"byggmax"===F.kund&&n("hemfixarna-kund",{buttonColor:this.buttonColor,buttonBg:this.buttonBg,widgetStyle:this.widgetStyle,id:this.selectedID}),n("div",{class:"hemfixarna_install"},n("div",{onClick:()=>this.copyCdn(),class:"hemfixarna_example"},n("p",null,this.cdnLink),n("span",{class:"hemfixarna_example--tooltip"},this.tooltipText),n("img",{src:t,height:20}))),n("div",{class:"hemfixarna_widgetstyles"},n("h5",null,"Widget styles"),n("div",null,Object.values(L).map((t=>n("label",{key:t},n("input",{type:"radio",value:t,checked:this.widgetStyle===t,onChange:()=>this.widgetStyle=t}),t)))),n("div",null,n("div",null,n("h5",null,"Button background color"),n("input",{type:"text",value:this.buttonBg,onInput:t=>this.buttonBg=t.target.value})),n("div",null,n("h5",null,"Button text color"),n("input",{type:"text",value:this.buttonColor,onInput:t=>this.buttonColor=t.target.value})))),n("span",null,"Write an hexa code no # needed"),this.colorAccessibility?n("div",null,n("h5",null,"Tillgänglighetsrapport"),n("div",null,n("strong",null,"Liten text:"),n("span",{style:{color:this.getColor(this.colorAccessibility.small)}},this.colorAccessibility.small),n("br",null),n("strong",null,"Fet text:"),n("span",{style:{color:this.getColor(this.colorAccessibility.bold)}},this.colorAccessibility.bold),n("br",null),n("strong",null,"Stor text:"),n("span",{style:{color:this.getColor(this.colorAccessibility.large)}},this.colorAccessibility.large),n("br",null),n("strong",null,"Kontrastförhållande:")," ",this.colorAccessibility.contrast)):null),n("ul",{class:"hemfixarna_categories"},this.customer?n("div",null,this.customer.categories.map((t=>n("li",null,n("div",{class:"hemfixarna_categories--label hemfixarna_categories--label--big"},n("div",null,n("p",null,t.name),n("span",null,`c-${t.id}`)),n("div",null,n("button",{onClick:()=>navigator.clipboard.writeText(`c-${t.id}`)},"Kopiera ID"),n("button",{onClick:()=>this.selectedID=`c-${t.id}`},"Ladda kategori"))),t.show_products&&t.products?n("ul",null,t.products.map((t=>n("li",null,n("div",{class:"hemfixarna_categories--label hemfixarna_product--label"},n("div",null,n("p",null,t.fields.post_title),n("span",null,t.fields.ID)),n("div",null,n("button",{onClick:()=>navigator.clipboard.writeText(String(t.fields.ID))},"Kopiera ID"),n("button",{onClick:()=>this.selectedID=String(t.fields.ID)},"Ladda produkt"))))))):n("ul",null,t.sub_categories&&t.sub_categories.map((t=>n("li",null,n("div",{class:"hemfixarna_categories--label"},n("div",null,n("p",null,t.name),n("span",null,`c-${t.id}`)),n("div",null,n("button",{onClick:()=>navigator.clipboard.writeText(`c-${t.id}`)},"Kopiera ID"),n("button",{onClick:()=>this.selectedID=`c-${t.id}`},"Ladda kategori"))),n("ul",null,t.products.map((t=>n("li",null,n("div",{class:"hemfixarna_categories--label hemfixarna_product--label"},n("div",null,n("p",null,t.fields.post_title),n("span",null,t.fields.ID)),n("div",null,n("button",{onClick:()=>navigator.clipboard.writeText(String(t.fields.ID))},"Kopiera ID"),n("button",{onClick:()=>this.selectedID=String(t.fields.ID)},"Ladda produkt"))))))))))))))):this.tree?n("div",null,this.tree.sub_cats.map((t=>n("li",null,n("div",{class:"hemfixarna_categories--label hemfixarna_categories--label--big"},n("div",null,n("p",null,t.name),n("span",null,`category/${t.slug}`)),n("div",null,n("button",{onClick:()=>navigator.clipboard.writeText(`category/${t.slug}`)},"Kopiera slug"),n("button",{onClick:()=>this.selectedSlug=`category/${t.slug}`},"Ladda kategori"))),n("ul",null,t.services.map((t=>n("li",null,n("div",{class:"hemfixarna_categories--label"},n("div",null,n("p",null,t.post_title),n("span",null,`service/${t.post_name}`)),n("div",null,n("button",{onClick:()=>navigator.clipboard.writeText(`service/${t.post_name}`)},"Kopiera slug"),n("button",{onClick:()=>this.selectedSlug=`service/${t.post_name}`},"Ladda kategori"))),n("ul",null,t.products.map((t=>n("li",null,n("div",{class:"hemfixarna_categories--label"},n("div",null,n("p",null,t.post_title),n("span",null,`product/${t.post_name}`)),n("div",null,n("button",{onClick:()=>navigator.clipboard.writeText(`product/${t.post_name}`)},"Kopiera slug"),n("button",{onClick:()=>this.selectedSlug=`product/${t.post_name}`},"Ladda kategori"))))))))))))))):null))}static get watchers(){return{buttonBg:["debouncedFunction"],buttonColor:["debouncedFunction"]}}};it.style=tt;var et=class extends Error{constructor(){super("Invalid swedish personal identity number")}};var nt=(t,i)=>{const e=t.getTime()-i.getTime();return e<0?-1:e>0?1:e};var st=(t,i)=>{const e=nt(t,i);const n=Math.abs(t.getFullYear()-i.getFullYear());t.setFullYear(t.getFullYear()-e*n);const s=nt(t,i)===-e;const a=e*(n-+s);return a===0?0:a};var at=t=>{let i=0;t+="";for(let e=0,n=t.length;e<n;e++){let n=parseInt(t[e]);n*=2-e%2;if(n>9){n-=9}i+=n}return Math.ceil(i/10)*10-i};var rt=(t,i,e)=>{i-=1;const n=new Date(t,i,e);return!(n.getFullYear()!==t||n.getMonth()!==i||n.getDate()!==e)};var ot=class{constructor(t,i){this._century="";this._fullYear="";this._year="";this._month="";this._day="";this._sep="";this._num="";this._check="";this.parse(t,{allowCoordinationNumber:true,allowInterimNumber:false,...i})}get century(){return this._century}get fullYear(){return this._fullYear}get year(){return this._year}get month(){return this._month}get day(){return this._day}get sep(){return this._sep}get num(){return this._num}get check(){return this._check}static parse(t,i){return new ot(t,i)}static valid(t,i){try{ot.parse(t,i);return true}catch(t){return false}}parse(t,i){if(t.length<10||t.length>13){throw new et}const e=/^(\d{2}){0,1}(\d{2})(\d{2})(\d{2})([+-]?)((?!000)\d{3}|[TRSUWXJKLMN]\d{2})(\d)$/;const n=e.exec(t);if(!n){throw new et}const s=n[1];const a=n[2];const r=n[3];const o=n[4];const l=n[5];const h=n[6];const c=n[7];if(typeof s==="undefined"||!s.length){const t=new Date;let i=0;if(l==="+"){this._sep="+";i=t.getFullYear()-100}else{this._sep="-";i=t.getFullYear()}this._century=(""+(i-(i-parseInt(a))%100)).substr(0,2)}else{this._century=s;if((new Date).getFullYear()-parseInt(s+a,10)<100){this._sep="-"}else{this._sep="+"}}this._year=a;this._fullYear=this._century+a;this._month=r;this._day=o;this._num=h;this._check=c;if(!this.valid()){throw new et}if(!(i==null?void 0:i.allowCoordinationNumber)&&this.isCoordinationNumber()){throw new et}if(!(i==null?void 0:i.allowInterimNumber)&&this.isInterimNumber()){throw new et}}valid(){const t=at(this.year+this.month+this.day+this.num.replace(/[TRSUWXJKLMN]/,"1"))===+this.check&&!!this.check;if(t&&rt(parseInt(this.century+this.year),+this.month,+this.day)){return t}return t&&rt(parseInt(this.century+this.year),+this.month,+this.day-60)}format(t=false){if(t){return`${this.century}${this.year}${this.month}${this.day}${this.num}${this.check}`}return`${this.year}${this.month}${this.day}${this.sep}${this.num}${this.check}`}getAge(){const t=this.getDate();return st(new Date(Date.now()),t)}getDate(){let t=+this.day;if(this.isCoordinationNumber()){t-=60}const i=this.century+this.year+"-"+this.month+"-"+(t<10?"0"+t:t);return new Date(i)}isInterimNumber(){return/[TRSUWXJKLMN]/.test(this.num[0])}isCoordinationNumber(){return rt(parseInt(this.century+this.year),+this.month,+this.day-60)}isFemale(){return!this.isMale()}isMale(){const t=parseInt(this.num.substr(-1));return t%2===1}};var lt=ot;function ht(t,i,e){return e={path:i,exports:{},require:function(t,i){return ct()}},t(e,e.exports),e.exports}function ct(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var ut=ht((function(t,i){Object.defineProperty(i,"__esModule",{value:true});i.utf8=void 0;i.utf8={encode:e,decode:n};function e(t){t=t.replace(/\r\n/g,"\n");var i="";for(var e=0;e<t.length;e++){var n=t.charCodeAt(e);if(n<128){i+=String.fromCharCode(n)}else if(n>127&&n<2048){i+=String.fromCharCode(n>>6|192);i+=String.fromCharCode(n&63|128)}else{i+=String.fromCharCode(n>>12|224);i+=String.fromCharCode(n>>6&63|128);i+=String.fromCharCode(n&63|128)}}return i}function n(t){var i="";var e=0;var n=0;var s=0;var a=0;while(e<t.length){n=t.charCodeAt(e);if(n<128){i+=String.fromCharCode(n);e++}else if(n>191&&n<224){s=t.charCodeAt(e+1);i+=String.fromCharCode((n&31)<<6|s&63);e+=2}else{s=t.charCodeAt(e+1);a=t.charCodeAt(e+2);i+=String.fromCharCode((n&15)<<12|(s&63)<<6|a&63);e+=3}}return i}}));var dt=ht((function(t,i){Object.defineProperty(i,"__esModule",{value:true});i.generate=void 0;function e(t){var i=[];var e;var n;var a;var r;var o;var l;var m;var x;var g;var b=7;var v=12;var _=17;var y=22;var w=5;var k=9;var C=14;var $=20;var S=4;var T=11;var z=16;var j=23;var O=6;var I=10;var N=15;var A=21;var F=ut.utf8.encode(t);i=p(F);l=1732584193;m=4023233417;x=2562383102;g=271733878;for(e=0;e<i.length;e+=16){n=l;a=m;r=x;o=g;l=h(l,m,x,g,i[e+0],b,3614090360);g=h(g,l,m,x,i[e+1],v,3905402710);x=h(x,g,l,m,i[e+2],_,606105819);m=h(m,x,g,l,i[e+3],y,3250441966);l=h(l,m,x,g,i[e+4],b,4118548399);g=h(g,l,m,x,i[e+5],v,1200080426);x=h(x,g,l,m,i[e+6],_,2821735955);m=h(m,x,g,l,i[e+7],y,4249261313);l=h(l,m,x,g,i[e+8],b,1770035416);g=h(g,l,m,x,i[e+9],v,2336552879);x=h(x,g,l,m,i[e+10],_,4294925233);m=h(m,x,g,l,i[e+11],y,2304563134);l=h(l,m,x,g,i[e+12],b,1804603682);g=h(g,l,m,x,i[e+13],v,4254626195);x=h(x,g,l,m,i[e+14],_,2792965006);m=h(m,x,g,l,i[e+15],y,1236535329);l=c(l,m,x,g,i[e+1],w,4129170786);g=c(g,l,m,x,i[e+6],k,3225465664);x=c(x,g,l,m,i[e+11],C,643717713);m=c(m,x,g,l,i[e+0],$,3921069994);l=c(l,m,x,g,i[e+5],w,3593408605);g=c(g,l,m,x,i[e+10],k,38016083);x=c(x,g,l,m,i[e+15],C,3634488961);m=c(m,x,g,l,i[e+4],$,3889429448);l=c(l,m,x,g,i[e+9],w,568446438);g=c(g,l,m,x,i[e+14],k,3275163606);x=c(x,g,l,m,i[e+3],C,4107603335);m=c(m,x,g,l,i[e+8],$,1163531501);l=c(l,m,x,g,i[e+13],w,2850285829);g=c(g,l,m,x,i[e+2],k,4243563512);x=c(x,g,l,m,i[e+7],C,1735328473);m=c(m,x,g,l,i[e+12],$,2368359562);l=u(l,m,x,g,i[e+5],S,4294588738);g=u(g,l,m,x,i[e+8],T,2272392833);x=u(x,g,l,m,i[e+11],z,1839030562);m=u(m,x,g,l,i[e+14],j,4259657740);l=u(l,m,x,g,i[e+1],S,2763975236);g=u(g,l,m,x,i[e+4],T,1272893353);x=u(x,g,l,m,i[e+7],z,4139469664);m=u(m,x,g,l,i[e+10],j,3200236656);l=u(l,m,x,g,i[e+13],S,681279174);g=u(g,l,m,x,i[e+0],T,3936430074);x=u(x,g,l,m,i[e+3],z,3572445317);m=u(m,x,g,l,i[e+6],j,76029189);l=u(l,m,x,g,i[e+9],S,3654602809);g=u(g,l,m,x,i[e+12],T,3873151461);x=u(x,g,l,m,i[e+15],z,530742520);m=u(m,x,g,l,i[e+2],j,3299628645);l=d(l,m,x,g,i[e+0],O,4096336452);g=d(g,l,m,x,i[e+7],I,1126891415);x=d(x,g,l,m,i[e+14],N,2878612391);m=d(m,x,g,l,i[e+5],A,4237533241);l=d(l,m,x,g,i[e+12],O,1700485571);g=d(g,l,m,x,i[e+3],I,2399980690);x=d(x,g,l,m,i[e+10],N,4293915773);m=d(m,x,g,l,i[e+1],A,2240044497);l=d(l,m,x,g,i[e+8],O,1873313359);g=d(g,l,m,x,i[e+15],I,4264355552);x=d(x,g,l,m,i[e+6],N,2734768916);m=d(m,x,g,l,i[e+13],A,1309151649);l=d(l,m,x,g,i[e+4],O,4149444226);g=d(g,l,m,x,i[e+11],I,3174756917);x=d(x,g,l,m,i[e+2],N,718787259);m=d(m,x,g,l,i[e+9],A,3951481745);l=s(l,n);m=s(m,a);x=s(x,r);g=s(g,o)}return f(l)+f(m)+f(x)+f(g)}i.generate=e;function n(t,i){return t<<i|t>>>32-i}function s(t,i){var e;var n;var s;var a;var r;s=t&2147483648;a=i&2147483648;e=t&1073741824;n=i&1073741824;r=(t&1073741823)+(i&1073741823);if(e&n){return r^2147483648^s^a}if(e|n){if(r&1073741824){return r^3221225472^s^a}else{return r^1073741824^s^a}}else{return r^s^a}}function a(t,i,e){return t&i|~t&e}function r(t,i,e){return t&e|i&~e}function o(t,i,e){return t^i^e}function l(t,i,e){return i^(t|~e)}function h(t,i,e,r,o,l,h){t=s(t,s(s(a(i,e,r),o),h));return s(n(t,l),i)}function c(t,i,e,a,o,l,h){t=s(t,s(s(r(i,e,a),o),h));return s(n(t,l),i)}function u(t,i,e,a,r,l,h){t=s(t,s(s(o(i,e,a),r),h));return s(n(t,l),i)}function d(t,i,e,a,r,o,h){t=s(t,s(s(l(i,e,a),r),h));return s(n(t,o),i)}function p(t){var i;var e=t.length;var n=e+8;var s=(n-n%64)/64;var a=(s+1)*16;var r=Array(a-1);var o=0;var l=0;while(l<e){i=(l-l%4)/4;o=l%4*8;r[i]=r[i]|t.charCodeAt(l)<<o;l++}i=(l-l%4)/4;o=l%4*8;r[i]=r[i]|128<<o;r[a-2]=e<<3;r[a-1]=e>>>29;return r}function f(t){var i="";var e="";var n;var s;for(s=0;s<=3;s++){n=t>>>s*8&255;e="0"+n.toString(16);i=i+e.substr(e.length-2,2)}return i}}));var pt=ht((function(t,i){Object.defineProperty(i,"__esModule",{value:true});i.MD5=i.generate=void 0;var e=dt;Object.defineProperty(i,"generate",{enumerable:true,get:function(){return e.generate}});i.MD5={generate:dt.generate}}));const ft=async t=>{var i;const e=await fetch((i="https://hemfixare-lookup.vercel.app/api")!==null&&i!==void 0?i:"https://hemfixare-lookup.vercel.app/api",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:t,hash:pt.MD5.generate(String.fromCharCode(83,101,67,82,101,116)+t)})});const n=await e.json();return n};const mt=class{constructor(t){e(this,t);this.handleChangeEmail=t=>{this.emailError=null;this.email=t.target.value};this.handleChangePhone=t=>{this.phoneError=null;this.phone=t.target.value};this.handleChangessn=t=>{this.ssnError=null;this.ssn=t.target.value};this.handleSubmit=async t=>{t.preventDefault();const i=new RegExp(/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/);const e=i.test(this.email);if(!e){this.emailError="Ange en giltig e-postadress"}const n=/^[\d\s()+-]{6,}$/.test(this.phone);if(!n){this.phoneError="Ange ett giltigt telefonnummer"}const s=lt.valid(this.ssn);if(!s){this.ssnError="Ange ett giltigt personnummer"}else if(s){const t=lt.parse(this.ssn).format(true);this.ssn=[t.slice(0,8),"-",t.slice(8)].join("")}if(e&&n&&s){try{const t=await ft(this.ssn);if(t){x.creditSafeUser=t;x.checkoutStep=2;x.user=Object.assign(Object.assign({},t),{email:this.email,phone:this.phone,ssn:this.ssn})}else{this.ssnError="Vi kunde tyvärr inte hitta en address med ditt angivna personnummer"}}catch(t){this.ssnError="Vi kunde tyvärr inte hitta en address med ditt angivna personnummer";console.log(t)}finally{const t=this.el.closest(".hemfixarna_content");v(t)}}};this.render=()=>n("form",{class:"mb-2",onSubmit:t=>this.handleSubmit(t)},n("div",null,n("input",{class:`${this.email.length?"input_active":""}`,onChange:t=>this.handleChangeEmail(t),type:"email",name:"email",value:this.email}),n("label",{htmlFor:"email"},"E-post ")),this.emailError&&n("span",null,this.emailError),n("div",null,n("input",{class:`${this.phone.length?"input_active":""}`,onChange:t=>this.handleChangePhone(t),type:"tel",name:"phone",value:this.phone}),n("label",{htmlFor:"phone"},"Mobiltelefon ")),this.phoneError&&n("span",null,this.phoneError),n("div",null,n("input",{class:`${this.ssn.length?"input_active":""}`,onChange:t=>this.handleChangessn(t),type:"tel",name:"ssn",value:this.ssn}),n("label",{htmlFor:"phone"},"Personnummer*")),this.ssnError&&n("span",null,this.ssnError),n("input",{type:"submit",value:"Fortsätt och Boka*"}),n("p",null,"*Vi hämtar din adress"));this.email="";this.emailError=null;this.phone="";this.phoneError=null;this.ssn="";this.ssnError=null}componentWillLoad(){if(x.user){this.email=x.user.email;this.phone=x.user.phone;this.ssn=x.user.ssn}}get el(){return s(this)}};const xt="";const gt=class{constructor(t){e(this,t);this.id=undefined;this.loadFromQuery=true;this.isDemo=false;this.widgetStyle=L.standard;this.buttonColor=undefined;this.buttonBg=undefined}render(){return n("hemfixarna-component",{widgetStyle:this.widgetStyle,buttonBg:this.buttonBg,buttonColor:this.buttonColor,nav:{url:"https://www.hornbach.se/",logo:"assets/hornbach/logo.svg",background:"./assets/hornbach/nav.jpg"},isDemo:this.isDemo,loadFromQuery:this.loadFromQuery,id:this.id,business:F.hornbach})}};gt.style=xt;const bt=class{constructor(t){e(this,t);this.logo=r(`./assets/hemfixarna.svg`);this.checkoutList=[{trust_badge:"Efter att du fyllt i formuläret blir du kontaktad av en Hemfixare för bokning av tid."},{trust_badge:"När jobbet är klart kommer du få en faktura med RUT/ROT-avdrag."}];this.list=null}getList(){return this.list?this.list:this.checkoutList}render(){const t=r(`./assets/checked.svg`);return n("div",{class:"hemfixarna_info"},x.step<5?n(a,null,n("h2",null,"Vilka är Hemfixarna?"),n("p",null,"Vi fixar allt från krångliga datorer till montering av möbler. Vi finns i hela Sverige och är alltid redo att rycka ut.")):n("h2",null,"Vad händer nu?"),n("ul",{class:"hemfixarna_features"},this.getList().map((i=>n("li",{key:i.trust_badge},n("img",{src:t,alt:"checked"}),n("p",null,i.trust_badge))))),n("img",{src:this.logo,width:200,alt:"hemfixarna"}),n("a",{class:"hemfixarna_product--link",target:"_blank",href:x.options.link.url},x.options.link.title))}};const vt=class{constructor(t){e(this,t);this.id=undefined;this.loadFromQuery=false;this.widgetStyle=L.standard;this.buttonColor=undefined;this.buttonBg=undefined}render(){return n("hemfixarna-component",{widgetStyle:this.widgetStyle,buttonBg:this.buttonBg,buttonColor:this.buttonColor,loadFromQuery:this.loadFromQuery,id:this.id,business:F.kund})}};const _t=class{constructor(t){e(this,t);this.render=()=>n("div",{style:{background:`url(${x.options.thank_you_image})`},class:"hemfixarna_order"},n("div",null),n("div",null,n("h2",null,"Tack för din bokning"),n("hemfixarna-orderrows",{tree:this.tree,cart:false}),n("span",{onClick:()=>this.resetShop()},n("button",null,"Gör en ny bokning")),n("hemfixarna-info",{list:[{trust_badge:"Du kommer bli kontaktad av en Hemfixare för bokning av tid."},{trust_badge:"När jobbet är klart kommer du få en faktura med RUT/ROT-avdrag."}]})));this.tree=undefined}resetShop(){x.step=1;x.cart=[];x.selectedCategory=null;x.selectedService=null;x.selectedProduct=null;x.checkoutStep=1}disconnectedCallback(){this.resetShop()}};const yt=class{constructor(t){e(this,t);this.cart=true;this.tree=undefined}goToProduct(t){if(x.customer){const i=x.customer.categories.map((t=>t.show_products?t.products:t.sub_categories?t.sub_categories.map((t=>t.products)):[])).flat().flat();const e=i.find((i=>i&&i.fields.ID===t));if(e){x.selectedProduct=e.fields;x.step=4}}else{const i=this.tree.sub_cats.map((t=>t.services)).flat();const e=i.map((t=>t.products)).flat();const n=e.find((i=>i.ID===t));const s=i.find((i=>i.products.find((i=>i.ID===t))));const a=this.tree.sub_cats.find((i=>i.services.find((i=>i.products.find((i=>i.ID===t))))));x.selectedCategory=a;x.selectedService=s;x.selectedProduct=n;x.step=4}}openRot(){x.modal={title:x.rotOptions.rot_start_fee_heading,text:[x.rotOptions.rot_start_fee_text,x.rotOptions.rot_start_fee_text_secondary]}}openRut(){x.modal={title:x.rutOptions.rut_start_fee_heading,text:[x.rutOptions.rut_start_fee_text,x.rutOptions.rut_start_fee_text_secondary]}}render(){const t=r(`./assets/info.svg`);return n(a,null,n("ul",{class:"hemfixarna_cart--items"},x.cart.map((t=>{var i;return n("li",{class:"hemfixarna_cart--item"},n("div",null,n("div",null,t.icon&&n("img",{width:30,src:(i=t.icon.url)!==null&&i!==void 0?i:t.icon,alt:t.name}),n("p",null,n("strong",null,t.amount,"x "),t.name)),this.cart&&n("button",{onClick:()=>this.goToProduct(t.id)},"Ändra")),n("p",null,n("strong",null,k(t,t.price,t.amount),"kr")),t.parts.length>0&&n("ul",null,t.parts.map((i=>n("li",null,n("p",null,n("strong",null,i.amount,"x "),i.name),n("p",null,n("strong",null,$(i,t,i.amount),"kr")))))))}))),n("div",{class:"hemfixarna_cart--additional"},S().rot>0&&n("div",{class:"hemfixarna_cart--startfee"},n("p",null,n("strong",{onClick:()=>this.openRot()},x.rotOptions.rot_start_fee_heading,n("img",{height:16,src:t,alt:"info monteringsavgift"}))),n("p",null,S().rot,"kr")),S().rut>0&&n("div",{class:"hemfixarna_cart--startfee"},n("p",null,n("strong",{onClick:()=>this.openRut()},x.rutOptions.rut_start_fee_heading,n("img",{height:16,src:t,alt:"info monteringsavgift"}))),n("p",null,S().rut,"kr")),x.cart.find((t=>t.rot))&&n("div",{class:"hemfixarna_cart--rutrot"},n("div",null,this.cart&&n("label",{class:"switch"},n("input",{checked:x.rot,onChange:()=>x.rot=!x.rot,type:"checkbox"}),n("span",{class:"slider"})),n("p",null,"ROT-avdrag")),n("p",null,"(-",x.rot?z():0,"kr)")),x.cart.find((t=>t.rut))&&n("div",{class:"hemfixarna_cart--rutrot"},n("div",null,n("label",{class:"switch"},n("input",{onChange:()=>x.rut=!x.rut,checked:x.rut,type:"checkbox"}),n("span",{class:"slider"})),n("p",null,"RUT-avdrag")),n("p",null,"(-",x.rut?j():0,"kr)"))),n("div",{class:"hemfixarna_cart--price"},n("h2",null,"Totalbelopp: "),n("h2",null,O(),"kr")))}};const wt=class{constructor(t){e(this,t);this.amount=0;this.hideDescription=true}addProduct(){const t=x.cart.find((t=>t.id===x.selectedProduct.ID));if(t){t.amount++;x.cart=[...x.cart]}else{x.cart=[...x.cart,{id:x.selectedProduct.ID,rut:x.selectedProduct.rut,rot:x.selectedProduct.rot,amount:1,parts:[],price:x.selectedProduct.price,name:x.selectedProduct.post_title,start_fee:!x.selectedProduct.hide_start_fee,terms_checkout:x.selectedProduct.terms_checkout,terms_show_checkbox:x.selectedProduct.terms_show_checkbox,icon:x.selectedProduct.icon}]}}removeProduct(){const t=x.cart.find((t=>t.id===x.selectedProduct.ID));if(t&&t.amount>1){t.amount--;x.cart=[...x.cart]}else{x.cart=x.cart.filter((t=>t.id!==x.selectedProduct.ID))}}addPart(t){var i;const e=x.cart.find((t=>t.id===x.selectedProduct.ID));if(e){const n=e.parts.find((i=>i.id===t.ID));if(n){n.amount++;e.parts=[...e.parts]}else{e.parts=[...e.parts,{id:t.ID,amount:1,price:t.price,name:(i=t.title)!==null&&i!==void 0?i:t.post_title}]}x.cart=[...x.cart.filter((t=>t.id!==e.id)),e]}}removePart(t){const i=x.cart.find((t=>t.id===x.selectedProduct.ID));if(i){const e=i.parts.find((i=>i.id===t.ID));if(e&&e.amount>1){e.amount--;i.parts=[...i.parts]}else{i.parts=i.parts.filter((i=>i.id!==t.ID))}x.cart=[...x.cart.filter((t=>t.id!==i.id)),i]}}goToCart(){const t=x.cart.find((t=>t.id===x.selectedProduct.ID));if(t){x.step=5;const t=this.el.closest(".hemfixarna_content");v(t)}}getAmount(){var t;return((t=x.cart.find((t=>t.id===x.selectedProduct.ID)))===null||t===void 0?void 0:t.amount)||0}getPartAmount(t){var i;const e=x.cart.find((t=>t.id===x.selectedProduct.ID));return((i=e===null||e===void 0?void 0:e.parts.find((i=>i.id===t)))===null||i===void 0?void 0:i.amount)||0}getTotalPrice(){let t=0;const i=x.cart.find((t=>t.id===x.selectedProduct.ID));if(i){const e=i.parts.reduce(((t,i)=>{const e=x.selectedProduct.parts.find((t=>t.ID===i.id));if(e){return t+e.price*i.amount}return t}),0);t=x.selectedProduct.price*i.amount+e}else{t=x.selectedProduct.price}return k(x.selectedProduct,t)}render(){var t,i,e;const s=r(`./assets/checked.svg`);const a=r(`./assets/plus.svg`);const o=r(`./assets/minus.svg`);return n("div",{class:"hemfixarna_product"},n("div",{class:"hemfixarna_product--top"},x.selectedProduct.icon&&n("img",{width:80,src:(t=x.selectedProduct.icon.url)!==null&&t!==void 0?t:x.selectedProduct.icon,alt:x.selectedProduct.post_title}),n("div",null,n("h1",null,x.selectedProduct.post_title),n("h2",null,"Från: ",k(x.selectedProduct)," kr"))),n("div",{class:"hemfixarna_product--grid"},n("div",{class:"hemfixarna_product--left"},((i=x.selectedProduct.list)===null||i===void 0?void 0:i.length)&&n("ul",{class:"hemfixarna_features"},x.selectedProduct.list.map((t=>n("li",{key:t.bullet},n("img",{src:s,alt:"checked"}),n("p",null,t.bullet))))),x.selectedProduct.description&&n("p",{onClick:()=>this.hideDescription=false,class:`hemfixarna_description ${this.hideDescription?"hemfixarna_description--hidden":""}`,innerHTML:x.selectedProduct.description})),n("div",{class:"hemfixarna_product--right"},n("ul",null,n("li",{class:"hemfixarna_product--item"},n("div",null,n("p",null,"Antal ",x.selectedProduct.post_title),n("p",{class:"hemfixarna_product--price"},k(x.selectedProduct),"kr/st")),n("div",{class:"hemfixarna_counter"},n("img",{class:`${this.getAmount()===0?"disabled":""}`,src:o,onClick:()=>this.removeProduct()}),n("span",null,this.getAmount()),n("img",{src:a,onClick:()=>this.addProduct()}))),((e=x.selectedProduct.parts)===null||e===void 0?void 0:e.length)&&x.selectedProduct.parts.map((t=>{var i;return n("li",{class:"hemfixarna_part"},n("div",null,n("p",null,(i=t.title)!==null&&i!==void 0?i:t.post_title),n("p",{class:"hemfixarna_product--price"},$(t,x.selectedProduct),"kr/st")),n("div",{class:"hemfixarna_counter"},n("img",{class:`${this.getPartAmount(t.ID)===0?"disabled":""}`,src:o,onClick:()=>this.removePart(t)}),n("span",null,this.getPartAmount(t.ID)),n("img",{class:`${this.getAmount()===0?"disabled":""}`,src:a,onClick:()=>this.addPart(t)})))}))),n("h4",{class:"hemfixarna_product--total"},"Totalt ",this.getTotalPrice()," kr"),n("button",{onClick:()=>this.goToCart(),class:`hemfixarna_buy ${this.getAmount()===0?"disabled":""}`},"Boka"),!x.selectedProduct.hide_start_fee&&(x.selectedProduct.rot||x.selectedProduct.rut)&&x.rutOptions&&x.rotOptions&&n("p",{class:"hemfixarna_terms"},n("strong",null,x.selectedProduct.rot?x.rotOptions.rot_start_fee_heading:x.rutOptions.rut_start_fee_heading),n("br",null),n("span",{innerHTML:x.selectedProduct.rot?x.rotOptions.rot_start_fee_text:x.rutOptions.rut_start_fee_text})),x.options&&n("hemfixarna-info",{list:x.options.trust}))))}get el(){return s(this)}};const kt=class{constructor(t){e(this,t)}render(){return n("div",null,n("h2",null,x.selectedService.post_title),n("div",{class:"hemfixarna_categories--wrapper"},n("div",null,n("ul",{class:"hemfixarna_categories"},x.selectedService.products.sort(((t,i)=>t.post_title<i.post_title?-1:1)).map((t=>{var i;return n("hemfixarna-box",{post:t,icon:(i=t.icon.url)!==null&&i!==void 0?i:t.icon,postTitle:t.post_title})})))),n("hemfixarna-info",{list:x.options.trust})))}};const Ct="";const $t=class{constructor(t){e(this,t);this.id=undefined;this.customer=undefined;this.loadFromQuery=false;this.widgetStyle=L.standard;this.buttonColor=undefined;this.buttonBg=undefined}render(){return n("hemfixarna-component",{widgetStyle:this.widgetStyle,buttonBg:this.buttonBg,buttonColor:this.buttonColor,loadFromQuery:this.loadFromQuery,id:this.id,business:F.skanska})}};$t.style=Ct;const St=class{constructor(t){e(this,t);this.tree=undefined;this.slug=undefined}isMainCategory(t){return t.show_products!==undefined}render(){return x.customer?n("div",null,n("h2",null,x.selectedCustomerCategory?x.selectedCustomerCategory.name:"Alla tjänster"),n("div",{class:"hemfixarna_categories--wrapper"},n("ul",{class:"hemfixarna_categories"},x.selectedCustomerCategory?this.isMainCategory(x.selectedCustomerCategory)&&x.selectedCustomerCategory.sub_categories&&!x.selectedCustomerCategory.show_products?x.selectedCustomerCategory.sub_categories.map((t=>n("hemfixarna-box",{category:t}))):x.selectedCustomerCategory.products?x.selectedCustomerCategory.products.map((t=>n("hemfixarna-box",{category:t.fields}))):null:x.customer.categories.map((t=>n("hemfixarna-box",{category:t})))),n("hemfixarna-info",{list:x.options.trust}))):n("div",null,n("h2",null,"Alla tjänster"),n("div",{class:"hemfixarna_categories--wrapper"},n("ul",{class:"hemfixarna_categories"},this.tree.sub_cats.sort(((t,i)=>t.name<i.name?-1:1)).map((t=>{var i;return n("hemfixarna-box",{post:t,icon:(i=t.icon.url)!==null&&i!==void 0?i:t.icon,postTitle:t.name})}))),n("hemfixarna-info",{list:x.options.trust})))}};const Tt="";const zt=class{constructor(t){e(this,t);this.id=undefined;this.loadFromQuery=false;this.widgetStyle=L.standard;this.buttonColor=undefined;this.buttonBg=undefined}render(){return n("hemfixarna-component",{widgetStyle:this.widgetStyle,buttonBg:this.buttonBg,buttonColor:this.buttonColor,loadFromQuery:this.loadFromQuery,id:this.id,business:F.string})}};zt.style=Tt;export{_ as hemfixarna_address,N as hemfixarna_box,A as hemfixarna_breadcrumbs,B as hemfixarna_byggmax,D as hemfixarna_cart,K as hemfixarna_category,q as hemfixarna_checkout,Z as hemfixarna_component,it as hemfixarna_demo,mt as hemfixarna_getuser,gt as hemfixarna_hornbach,bt as hemfixarna_info,vt as hemfixarna_kund,_t as hemfixarna_order,yt as hemfixarna_orderrows,wt as hemfixarna_product,kt as hemfixarna_service,$t as hemfixarna_skanska,St as hemfixarna_start,zt as hemfixarna_string_furniture};
2
- //# sourceMappingURL=p-33a71663.entry.js.map