hemfixarna-web-components 0.3.1 → 0.9.2

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.
Files changed (156) hide show
  1. package/dist/cjs/hemfixarna-address_16.cjs.entry.js +1753 -0
  2. package/dist/cjs/hemfixarna-address_16.cjs.entry.js.map +1 -0
  3. package/dist/cjs/hemfixarna-components.cjs.js +28 -0
  4. package/dist/cjs/hemfixarna-components.cjs.js.map +1 -0
  5. package/dist/cjs/index-d9e286dc.js +1652 -0
  6. package/dist/cjs/index-d9e286dc.js.map +1 -0
  7. package/dist/cjs/index.cjs.js +4 -0
  8. package/dist/cjs/index.cjs.js.map +1 -0
  9. package/dist/cjs/loader.cjs.js +24 -0
  10. package/dist/cjs/loader.cjs.js.map +1 -0
  11. package/dist/collection/assets/back.svg +3 -0
  12. package/dist/collection/assets/cart.svg +10 -0
  13. package/dist/collection/assets/checked.svg +10 -0
  14. package/dist/collection/assets/close.svg +5 -0
  15. package/dist/collection/assets/copy.png +0 -0
  16. package/dist/collection/assets/date.svg +6 -0
  17. package/dist/collection/assets/down.svg +3 -0
  18. package/dist/collection/assets/hemfixarna.svg +11 -0
  19. package/dist/collection/assets/info.svg +5 -0
  20. package/dist/collection/assets/minus.svg +4 -0
  21. package/dist/collection/assets/plus.svg +5 -0
  22. package/dist/collection/collection-manifest.json +27 -0
  23. package/dist/collection/components/hemfixarna-address/hemfixarna-address.js +67 -0
  24. package/dist/collection/components/hemfixarna-address/hemfixarna-address.js.map +1 -0
  25. package/dist/collection/components/hemfixarna-box/hemfixarna-box.js +97 -0
  26. package/dist/collection/components/hemfixarna-box/hemfixarna-box.js.map +1 -0
  27. package/dist/{hemfixarna-components/hemfixarna-breadcrumbs.entry.js → collection/components/hemfixarna-breadcrumbs/hemfixarna-breadcrumbs.js} +46 -11
  28. package/dist/collection/components/hemfixarna-breadcrumbs/hemfixarna-breadcrumbs.js.map +1 -0
  29. package/dist/collection/components/hemfixarna-byggmax/hemfixarna-byggmax.css +0 -0
  30. package/dist/collection/components/hemfixarna-byggmax/hemfixarna-byggmax.js +50 -0
  31. package/dist/collection/components/hemfixarna-byggmax/hemfixarna-byggmax.js.map +1 -0
  32. package/dist/collection/components/hemfixarna-cart/hemfixarna-cart.js +41 -0
  33. package/dist/collection/components/hemfixarna-cart/hemfixarna-cart.js.map +1 -0
  34. package/dist/collection/components/hemfixarna-category.tsx/hemfixarna-category.js +18 -0
  35. package/dist/collection/components/hemfixarna-category.tsx/hemfixarna-category.js.map +1 -0
  36. package/dist/collection/components/hemfixarna-checkout/hemfixarna-checkout.js +92 -0
  37. package/dist/collection/components/hemfixarna-checkout/hemfixarna-checkout.js.map +1 -0
  38. package/dist/collection/components/hemfixarna-component/hemfixarna-component.js +221 -0
  39. package/dist/collection/components/hemfixarna-component/hemfixarna-component.js.map +1 -0
  40. package/dist/collection/components/hemfixarna-component/hemfixarna.css +752 -0
  41. package/dist/collection/components/hemfixarna-demo/hemfixarna-demo.css +118 -0
  42. package/dist/collection/components/hemfixarna-demo/hemfixarna-demo.js +76 -0
  43. package/dist/collection/components/hemfixarna-demo/hemfixarna-demo.js.map +1 -0
  44. package/dist/collection/components/hemfixarna-getuser/hemfixarna-getuser.js +84 -0
  45. package/dist/collection/components/hemfixarna-getuser/hemfixarna-getuser.js.map +1 -0
  46. package/dist/{hemfixarna-components/hemfixarna-info.entry.js → collection/components/hemfixarna-info/hemfixarna-info.js} +27 -11
  47. package/dist/collection/components/hemfixarna-info/hemfixarna-info.js.map +1 -0
  48. package/dist/collection/components/hemfixarna-order/hemfixarna-order.js +50 -0
  49. package/dist/collection/components/hemfixarna-order/hemfixarna-order.js.map +1 -0
  50. package/dist/collection/components/hemfixarna-orderrows/hemfixarna-orderrows.js +80 -0
  51. package/dist/collection/components/hemfixarna-orderrows/hemfixarna-orderrows.js.map +1 -0
  52. package/dist/{hemfixarna-components/hemfixarna-product.entry.js → collection/components/hemfixarna-product/hemfixarna-product.js} +15 -16
  53. package/dist/collection/components/hemfixarna-product/hemfixarna-product.js.map +1 -0
  54. package/dist/collection/components/hemfixarna-service/hemfixarna-service.js +18 -0
  55. package/dist/collection/components/hemfixarna-service/hemfixarna-service.js.map +1 -0
  56. package/dist/collection/components/hemfixarna-start/hemfixarna-start.js +41 -0
  57. package/dist/collection/components/hemfixarna-start/hemfixarna-start.js.map +1 -0
  58. package/dist/collection/index.js +2 -0
  59. package/dist/collection/index.js.map +1 -0
  60. package/dist/collection/store/index.js +25 -0
  61. package/dist/collection/store/index.js.map +1 -0
  62. package/dist/{hemfixarna-components/index-2bf8566c.js → collection/types/index.js} +3 -6
  63. package/dist/collection/types/index.js.map +1 -0
  64. package/dist/collection/utils/api.js +41 -0
  65. package/dist/collection/utils/api.js.map +1 -0
  66. package/dist/{hemfixarna-components/calc-a9ece205.js → collection/utils/calc.js} +36 -6
  67. package/dist/collection/utils/calc.js.map +1 -0
  68. package/dist/collection/utils/creditSafe.js +18 -0
  69. package/dist/collection/utils/creditSafe.js.map +1 -0
  70. package/dist/collection/utils/felixFunctions.js +189 -0
  71. package/dist/collection/utils/felixFunctions.js.map +1 -0
  72. package/dist/collection/utils/form.js +7 -0
  73. package/dist/collection/utils/form.js.map +1 -0
  74. package/dist/esm/hemfixarna-address_16.entry.js +1734 -0
  75. package/dist/esm/hemfixarna-address_16.entry.js.map +1 -0
  76. package/dist/esm/hemfixarna-components.js +23 -0
  77. package/dist/esm/hemfixarna-components.js.map +1 -0
  78. package/dist/esm/index-ca1aada9.js +1621 -0
  79. package/dist/esm/index-ca1aada9.js.map +1 -0
  80. package/dist/esm/index.js +3 -0
  81. package/dist/esm/index.js.map +1 -0
  82. package/dist/esm/loader.js +20 -0
  83. package/dist/esm/loader.js.map +1 -0
  84. package/dist/esm/polyfills/core-js.js +11 -0
  85. package/dist/esm/polyfills/css-shim.js +1 -0
  86. package/dist/esm/polyfills/dom.js +79 -0
  87. package/dist/esm/polyfills/es5-html-element.js +1 -0
  88. package/dist/esm/polyfills/index.js +34 -0
  89. package/dist/esm/polyfills/system.js +6 -0
  90. package/dist/hemfixarna-components/hemfixarna-components.esm.js +1 -162
  91. package/dist/hemfixarna-components/hemfixarna-components.esm.js.map +1 -1
  92. package/dist/hemfixarna-components/index.esm.js +0 -1
  93. package/dist/hemfixarna-components/index.esm.js.map +1 -1
  94. package/dist/hemfixarna-components/p-8829e98e.js +3 -0
  95. package/dist/hemfixarna-components/p-8829e98e.js.map +1 -0
  96. package/dist/hemfixarna-components/p-c05e2af1.entry.js +2 -0
  97. package/dist/hemfixarna-components/p-c05e2af1.entry.js.map +1 -0
  98. package/dist/index.cjs.js +1 -0
  99. package/dist/index.js +1 -0
  100. package/dist/types/components/hemfixarna-address/hemfixarna-address.d.ts +1 -0
  101. package/dist/types/components/hemfixarna-cart/hemfixarna-cart.d.ts +1 -9
  102. package/dist/types/components/hemfixarna-checkout/hemfixarna-checkout.d.ts +3 -1
  103. package/dist/types/components/hemfixarna-getuser/hemfixarna-getuser.d.ts +1 -1
  104. package/dist/types/components/hemfixarna-order/hemfixarna-order.d.ts +3 -0
  105. package/dist/types/components/hemfixarna-orderrows/hemfixarna-orderrows.d.ts +8 -0
  106. package/dist/types/components.d.ts +19 -0
  107. package/dist/types/store/index.d.ts +2 -6
  108. package/dist/types/types/index.d.ts +18 -7
  109. package/dist/types/utils/api.d.ts +20 -2
  110. package/dist/types/utils/calc.d.ts +5 -1
  111. package/dist/types/utils/creditSafe.d.ts +3 -0
  112. package/dist/types/utils/form.d.ts +2 -0
  113. package/package.json +2 -1
  114. package/dist/hemfixarna-components/api-3228fe30.js +0 -28
  115. package/dist/hemfixarna-components/api-3228fe30.js.map +0 -1
  116. package/dist/hemfixarna-components/app-globals-0f993ce5.js +0 -5
  117. package/dist/hemfixarna-components/app-globals-0f993ce5.js.map +0 -1
  118. package/dist/hemfixarna-components/calc-a9ece205.js.map +0 -1
  119. package/dist/hemfixarna-components/css-shim-62d2171c.js +0 -6
  120. package/dist/hemfixarna-components/css-shim-62d2171c.js.map +0 -1
  121. package/dist/hemfixarna-components/dom-46a68c9b.js +0 -75
  122. package/dist/hemfixarna-components/dom-46a68c9b.js.map +0 -1
  123. package/dist/hemfixarna-components/hemfixarna-address.entry.js +0 -52
  124. package/dist/hemfixarna-components/hemfixarna-address.entry.js.map +0 -1
  125. package/dist/hemfixarna-components/hemfixarna-box.entry.js +0 -35
  126. package/dist/hemfixarna-components/hemfixarna-box.entry.js.map +0 -1
  127. package/dist/hemfixarna-components/hemfixarna-breadcrumbs.entry.js.map +0 -1
  128. package/dist/hemfixarna-components/hemfixarna-byggmax.entry.js +0 -20
  129. package/dist/hemfixarna-components/hemfixarna-byggmax.entry.js.map +0 -1
  130. package/dist/hemfixarna-components/hemfixarna-cart.entry.js +0 -82
  131. package/dist/hemfixarna-components/hemfixarna-cart.entry.js.map +0 -1
  132. package/dist/hemfixarna-components/hemfixarna-category.entry.js +0 -21
  133. package/dist/hemfixarna-components/hemfixarna-category.entry.js.map +0 -1
  134. package/dist/hemfixarna-components/hemfixarna-checkout.entry.js +0 -54
  135. package/dist/hemfixarna-components/hemfixarna-checkout.entry.js.map +0 -1
  136. package/dist/hemfixarna-components/hemfixarna-component.entry.js +0 -133
  137. package/dist/hemfixarna-components/hemfixarna-component.entry.js.map +0 -1
  138. package/dist/hemfixarna-components/hemfixarna-demo.entry.js +0 -65
  139. package/dist/hemfixarna-components/hemfixarna-demo.entry.js.map +0 -1
  140. package/dist/hemfixarna-components/hemfixarna-getuser.entry.js +0 -410
  141. package/dist/hemfixarna-components/hemfixarna-getuser.entry.js.map +0 -1
  142. package/dist/hemfixarna-components/hemfixarna-info.entry.js.map +0 -1
  143. package/dist/hemfixarna-components/hemfixarna-order.entry.js +0 -24
  144. package/dist/hemfixarna-components/hemfixarna-order.entry.js.map +0 -1
  145. package/dist/hemfixarna-components/hemfixarna-product.entry.js.map +0 -1
  146. package/dist/hemfixarna-components/hemfixarna-service.entry.js +0 -21
  147. package/dist/hemfixarna-components/hemfixarna-service.entry.js.map +0 -1
  148. package/dist/hemfixarna-components/hemfixarna-start.entry.js +0 -18
  149. package/dist/hemfixarna-components/hemfixarna-start.entry.js.map +0 -1
  150. package/dist/hemfixarna-components/index-2bf8566c.js.map +0 -1
  151. package/dist/hemfixarna-components/index-59ed730c.js +0 -3397
  152. package/dist/hemfixarna-components/index-59ed730c.js.map +0 -1
  153. package/dist/hemfixarna-components/index-75ed3bb8.js +0 -216
  154. package/dist/hemfixarna-components/index-75ed3bb8.js.map +0 -1
  155. package/dist/hemfixarna-components/shadow-css-05e0c1f4.js +0 -389
  156. package/dist/hemfixarna-components/shadow-css-05e0c1f4.js.map +0 -1
@@ -1,163 +1,2 @@
1
- import { B as BUILD, c as consoleDevInfo, p as plt, w as win, H, d as doc, N as NAMESPACE, a as promiseResolve, b as bootstrapLazy } from './index-59ed730c.js';
2
- export { s as setNonce } from './index-59ed730c.js';
3
- import { g as globalScripts } from './app-globals-0f993ce5.js';
4
-
5
- /*
6
- Stencil Client Patch Browser v3.2.1 | MIT Licensed | https://stenciljs.com
7
- */
8
- /**
9
- * Helper method for querying a `meta` tag that contains a nonce value
10
- * out of a DOM's head.
11
- *
12
- * @param doc The DOM containing the `head` to query against
13
- * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
14
- * exists or the tag has no content.
15
- */
16
- function queryNonceMetaTagContent(doc) {
17
- var _a, _b, _c;
18
- return (_c = (_b = (_a = doc.head) === null || _a === void 0 ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) === null || _b === void 0 ? void 0 : _b.getAttribute('content')) !== null && _c !== void 0 ? _c : undefined;
19
- }
20
- // TODO(STENCIL-661): Remove code related to the dynamic import shim
21
- const getDynamicImportFunction = (namespace) => `__sc_import_${namespace.replace(/\s|-/g, '_')}`;
22
- const patchBrowser = () => {
23
- // NOTE!! This fn cannot use async/await!
24
- if (BUILD.isDev && !BUILD.isTesting) {
25
- consoleDevInfo('Running in development mode.');
26
- }
27
- // TODO(STENCIL-659): Remove code implementing the CSS variable shim
28
- if (BUILD.cssVarShim) {
29
- // shim css vars
30
- // TODO(STENCIL-659): Remove code implementing the CSS variable shim
31
- plt.$cssShim$ = win.__cssshim;
32
- }
33
- if (BUILD.cloneNodeFix) {
34
- // opted-in to polyfill cloneNode() for slot polyfilled components
35
- patchCloneNodeFix(H.prototype);
36
- }
37
- if (BUILD.profile && !performance.mark) {
38
- // not all browsers support performance.mark/measure (Safari 10)
39
- // because the mark/measure APIs are designed to write entries to a buffer in the browser that does not exist,
40
- // simply stub the implementations out.
41
- // TODO(STENCIL-323): Remove this patch when support for older browsers is removed (breaking)
42
- // @ts-ignore
43
- performance.mark = performance.measure = () => {
44
- /*noop*/
45
- };
46
- performance.getEntriesByName = () => [];
47
- }
48
- // @ts-ignore
49
- const scriptElm =
50
- // TODO(STENCIL-661): Remove code related to the dynamic import shim
51
- // TODO(STENCIL-663): Remove code related to deprecated `safari10` field.
52
- BUILD.scriptDataOpts || BUILD.safari10 || BUILD.dynamicImportShim
53
- ? Array.from(doc.querySelectorAll('script')).find((s) => new RegExp(`\/${NAMESPACE}(\\.esm)?\\.js($|\\?|#)`).test(s.src) ||
54
- s.getAttribute('data-stencil-namespace') === NAMESPACE)
55
- : null;
56
- const importMeta = import.meta.url;
57
- const opts = BUILD.scriptDataOpts ? (scriptElm || {})['data-opts'] || {} : {};
58
- // TODO(STENCIL-663): Remove code related to deprecated `safari10` field.
59
- if (BUILD.safari10 && 'onbeforeload' in scriptElm && !history.scrollRestoration /* IS_ESM_BUILD */) {
60
- // Safari < v11 support: This IF is true if it's Safari below v11.
61
- // This fn cannot use async/await since Safari didn't support it until v11,
62
- // however, Safari 10 did support modules. Safari 10 also didn't support "nomodule",
63
- // so both the ESM file and nomodule file would get downloaded. Only Safari
64
- // has 'onbeforeload' in the script, and "history.scrollRestoration" was added
65
- // to Safari in v11. Return a noop then() so the async/await ESM code doesn't continue.
66
- // IS_ESM_BUILD is replaced at build time so this check doesn't happen in systemjs builds.
67
- return {
68
- then() {
69
- /* promise noop */
70
- },
71
- };
72
- }
73
- // TODO(STENCIL-663): Remove code related to deprecated `safari10` field.
74
- if (!BUILD.safari10 && importMeta !== '') {
75
- opts.resourcesUrl = new URL('.', importMeta).href;
76
- // TODO(STENCIL-661): Remove code related to the dynamic import shim
77
- // TODO(STENCIL-663): Remove code related to deprecated `safari10` field.
78
- }
79
- else if (BUILD.dynamicImportShim || BUILD.safari10) {
80
- opts.resourcesUrl = new URL('.', new URL(scriptElm.getAttribute('data-resources-url') || scriptElm.src, win.location.href)).href;
81
- // TODO(STENCIL-661): Remove code related to the dynamic import shim
82
- if (BUILD.dynamicImportShim) {
83
- patchDynamicImport(opts.resourcesUrl, scriptElm);
84
- }
85
- // TODO(STENCIL-661): Remove code related to the dynamic import shim
86
- if (BUILD.dynamicImportShim && !win.customElements) {
87
- // module support, but no custom elements support (Old Edge)
88
- // @ts-ignore
89
- return import(/* webpackChunkName: "polyfills-dom" */ './dom-46a68c9b.js').then(() => opts);
90
- }
91
- }
92
- return promiseResolve(opts);
93
- };
94
- // TODO(STENCIL-661): Remove code related to the dynamic import shim
95
- const patchDynamicImport = (base, orgScriptElm) => {
96
- const importFunctionName = getDynamicImportFunction(NAMESPACE);
97
- try {
98
- // test if this browser supports dynamic imports
99
- // There is a caching issue in V8, that breaks using import() in Function
100
- // By generating a random string, we can workaround it
101
- // Check https://bugs.chromium.org/p/chromium/issues/detail?id=990810 for more info
102
- win[importFunctionName] = new Function('w', `return import(w);//${Math.random()}`);
103
- }
104
- catch (e) {
105
- // this shim is specifically for browsers that do support "esm" imports
106
- // however, they do NOT support "dynamic" imports
107
- // basically this code is for old Edge, v18 and below
108
- const moduleMap = new Map();
109
- win[importFunctionName] = (src) => {
110
- var _a;
111
- const url = new URL(src, base).href;
112
- let mod = moduleMap.get(url);
113
- if (!mod) {
114
- const script = doc.createElement('script');
115
- script.type = 'module';
116
- script.crossOrigin = orgScriptElm.crossOrigin;
117
- script.src = URL.createObjectURL(new Blob([`import * as m from '${url}'; window.${importFunctionName}.m = m;`], {
118
- type: 'application/javascript',
119
- }));
120
- // Apply CSP nonce to the script tag if it exists
121
- const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
122
- if (nonce != null) {
123
- script.setAttribute('nonce', nonce);
124
- }
125
- mod = new Promise((resolve) => {
126
- script.onload = () => {
127
- resolve(win[importFunctionName].m);
128
- script.remove();
129
- };
130
- });
131
- moduleMap.set(url, mod);
132
- doc.head.appendChild(script);
133
- }
134
- return mod;
135
- };
136
- }
137
- };
138
- const patchCloneNodeFix = (HTMLElementPrototype) => {
139
- const nativeCloneNodeFn = HTMLElementPrototype.cloneNode;
140
- HTMLElementPrototype.cloneNode = function (deep) {
141
- if (this.nodeName === 'TEMPLATE') {
142
- return nativeCloneNodeFn.call(this, deep);
143
- }
144
- const clonedNode = nativeCloneNodeFn.call(this, false);
145
- const srcChildNodes = this.childNodes;
146
- if (deep) {
147
- for (let i = 0; i < srcChildNodes.length; i++) {
148
- // Node.ATTRIBUTE_NODE === 2, and checking because IE11
149
- if (srcChildNodes[i].nodeType !== 2) {
150
- clonedNode.appendChild(srcChildNodes[i].cloneNode(true));
151
- }
152
- }
153
- }
154
- return clonedNode;
155
- };
156
- };
157
-
158
- patchBrowser().then(options => {
159
- globalScripts();
160
- return bootstrapLazy([["hemfixarna-cart",[[0,"hemfixarna-cart",{"tree":[16]}]]],["hemfixarna-category",[[0,"hemfixarna-category"]]],["hemfixarna-service",[[0,"hemfixarna-service"]]],["hemfixarna-start",[[0,"hemfixarna-start",{"tree":[16]}]]],["hemfixarna-product",[[0,"hemfixarna-product",{"amount":[32]}]]],["hemfixarna-breadcrumbs",[[0,"hemfixarna-breadcrumbs",{"tree":[16],"closeModal":[16]}]]],["hemfixarna-order",[[0,"hemfixarna-order"]]],["hemfixarna-address",[[0,"hemfixarna-address",{"street":[32],"streetError":[32],"zip":[32],"zipError":[32],"town":[32],"townError":[32]}]]],["hemfixarna-getuser",[[0,"hemfixarna-getuser",{"email":[32],"emailError":[32],"phone":[32],"phoneError":[32],"ssn":[32],"ssnError":[32]}]]],["hemfixarna-checkout",[[0,"hemfixarna-checkout",{"date":[32],"dateError":[32],"termsError":[32]}]]],["hemfixarna-box",[[0,"hemfixarna-box",{"post":[16],"icon":[1],"postTitle":[1,"post-title"]}]]],["hemfixarna-info",[[0,"hemfixarna-info",{"list":[16]}]]],["hemfixarna-component",[[1,"hemfixarna-component",{"slug":[1],"business":[1],"topCategory":[1,"top-category"],"modal":[32],"showModal":[32],"tree":[32],"product":[32]},[[0,"click","handleClick"]]]]],["hemfixarna-byggmax",[[1,"hemfixarna-byggmax",{"slug":[1],"tree":[32]}]]],["hemfixarna-demo",[[1,"hemfixarna-demo",{"selectedSlug":[32],"tooltipText":[32],"tree":[32]}]]]], options);
161
- });
162
-
1
+ import{p as e,b as r}from"./p-8829e98e.js";export{s as setNonce}from"./p-8829e98e.js";const a=()=>{const r=import.meta.url;const a={};if(r!==""){a.resourcesUrl=new URL(".",r).href}return e(a)};a().then((e=>r([["p-c05e2af1",[[1,"hemfixarna-demo",{selectedSlug:[32],tooltipText:[32],tree:[32]}],[1,"hemfixarna-byggmax",{slug:[1],tree:[32]}],[1,"hemfixarna-component",{slug:[1],business:[1],topCategory:[1,"top-category"],modal:[32],showModal:[32],tree:[32],product:[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]}],[0,"hemfixarna-product",{amount:[32]}],[0,"hemfixarna-breadcrumbs",{tree:[16],closeModal:[16]}],[0,"hemfixarna-checkout",{date:[32],dateError:[32],generalError:[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],icon:[1],postTitle:[1,"post-title"]}],[0,"hemfixarna-info",{list:[16]}]]]],e)));
163
2
  //# sourceMappingURL=hemfixarna-components.esm.js.map
@@ -1 +1 @@
1
- {"file":"hemfixarna-components.esm.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
1
+ {"version":3,"names":[],"sources":[],"mappings":""}
@@ -1,3 +1,2 @@
1
1
 
2
-
3
2
  //# sourceMappingURL=index.esm.js.map
@@ -1 +1 @@
1
- {"file":"index.esm.js","mappings":"","names":[],"sources":[],"sourcesContent":[],"version":3}
1
+ {"version":3,"names":[],"sources":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ const t="hemfixarna-components";let n;let e;let s=false;let o=null;let l=false;const c=t=>{const n=new URL(t,St.t);return n.origin!==wt.location.origin?n.href:n.pathname};const i=(t,n="")=>{{return()=>{}}};const f=(t,n)=>{{return()=>{}}};const r="{visibility:hidden}.hydrated{visibility:inherit}";const u={};const a=t=>t!=null;const d=t=>{t=typeof t;return t==="object"||t==="function"};function h(t){var n,e,s;return(s=(e=(n=t.head)===null||n===void 0?void 0:n.querySelector('meta[name="csp-nonce"]'))===null||e===void 0?void 0:e.getAttribute("content"))!==null&&s!==void 0?s:undefined}const y=(t,n,...e)=>{let s=null;let o=null;let l=false;let c=false;const i=[];const f=n=>{for(let e=0;e<n.length;e++){s=n[e];if(Array.isArray(s)){f(s)}else if(s!=null&&typeof s!=="boolean"){if(l=typeof t!=="function"&&!d(s)){s=String(s)}if(l&&c){i[i.length-1].o+=s}else{i.push(l?p(null,s):s)}c=l}}};f(e);if(n){if(n.key){o=n.key}{const t=n.className||n.class;if(t){n.class=typeof t!=="object"?t:Object.keys(t).filter((n=>t[n])).join(" ")}}}if(typeof t==="function"){return t(n===null?{}:n,i,b)}const r=p(t,null);r.l=n;if(i.length>0){r.i=i}{r.u=o}return r};const p=(t,n)=>{const e={h:0,p:t,o:n,m:null,i:null};{e.l=null}{e.u=null}return e};const m={};const $=t=>t&&t.p===m;const b={forEach:(t,n)=>t.map(w).forEach(n),map:(t,n)=>t.map(w).map(n).map(v)};const w=t=>({vattrs:t.l,vchildren:t.i,vkey:t.u,vname:t.$,vtag:t.p,vtext:t.o});const v=t=>{if(typeof t.vtag==="function"){const n=Object.assign({},t.vattrs);if(t.vkey){n.key=t.vkey}if(t.vname){n.name=t.vname}return y(t.vtag,n,...t.vchildren||[])}const n=p(t.vtag,t.vtext);n.l=t.vattrs;n.i=t.vchildren;n.u=t.vkey;n.$=t.vname;return n};const S=(t,n)=>{if(t!=null&&!d(t)){if(n&4){return t==="false"?false:t===""||!!t}if(n&1){return String(t)}return t}return t};const g=t=>at(t).v;const k=(t,n,e)=>{const s=St.ce(n,e);t.dispatchEvent(s);return s};const j=new WeakMap;const C=(t,n,e)=>{let s=bt.get(t);if(kt&&e){s=s||new CSSStyleSheet;if(typeof s==="string"){s=n}else{s.replaceSync(n)}}else{s=n}bt.set(t,s)};const M=(t,n,e,s)=>{var o;let l=x(n);const c=bt.get(l);t=t.nodeType===11?t:vt;if(c){if(typeof c==="string"){t=t.head||t;let n=j.get(t);let e;if(!n){j.set(t,n=new Set)}if(!n.has(l)){{{e=vt.createElement("style");e.innerHTML=c}const n=(o=St.S)!==null&&o!==void 0?o:h(vt);if(n!=null){e.setAttribute("nonce",n)}t.insertBefore(e,t.querySelector("link"))}if(n){n.add(l)}}}else if(!t.adoptedStyleSheets.includes(c)){t.adoptedStyleSheets=[...t.adoptedStyleSheets,c]}}return l};const O=t=>{const n=t.g;const e=t.v;const s=n.h;const o=i("attachStyles",n.k);const l=M(e.shadowRoot?e.shadowRoot:e.getRootNode(),n);if(s&10){e["s-sc"]=l;e.classList.add(l+"-h")}o()};const x=(t,n)=>"sc-"+t.k;const U=(t,n,e,s,o,l)=>{if(e!==s){let c=yt(t,n);let i=n.toLowerCase();if(n==="class"){const n=t.classList;const o=L(e);const l=L(s);n.remove(...o.filter((t=>t&&!l.includes(t))));n.add(...l.filter((t=>t&&!o.includes(t))))}else if(n==="style"){{for(const n in e){if(!s||s[n]==null){if(n.includes("-")){t.style.removeProperty(n)}else{t.style[n]=""}}}}for(const n in s){if(!e||s[n]!==e[n]){if(n.includes("-")){t.style.setProperty(n,s[n])}else{t.style[n]=s[n]}}}}else if(n==="key");else if(!c&&n[0]==="o"&&n[1]==="n"){if(n[2]==="-"){n=n.slice(3)}else if(yt(wt,i)){n=i.slice(2)}else{n=i[2]+n.slice(3)}if(e){St.rel(t,n,e,false)}if(s){St.ael(t,n,s,false)}}else{const i=d(s);if((c||i&&s!==null)&&!o){try{if(!t.tagName.includes("-")){const o=s==null?"":s;if(n==="list"){c=false}else if(e==null||t[n]!=o){t[n]=o}}else{t[n]=s}}catch(t){}}if(s==null||s===false){if(s!==false||t.getAttribute(n)===""){{t.removeAttribute(n)}}}else if((!c||l&4||o)&&!i){s=s===true?"":s;{t.setAttribute(n,s)}}}}};const E=/\s/;const L=t=>!t?[]:t.split(E);const P=(t,n,e,s)=>{const o=n.m.nodeType===11&&n.m.host?n.m.host:n.m;const l=t&&t.l||u;const c=n.l||u;{for(s in l){if(!(s in c)){U(o,s,l[s],undefined,e,n.h)}}}for(s in c){U(o,s,l[s],c[s],e,n.h)}};const N=(t,e,o,l)=>{const c=e.i[o];let i=0;let f;let r;if(c.o!==null){f=c.m=vt.createTextNode(c.o)}else{f=c.m=vt.createElement(c.p);{P(null,c,s)}if(a(n)&&f["s-si"]!==n){f.classList.add(f["s-si"]=n)}if(c.i){for(i=0;i<c.i.length;++i){r=N(t,c,i);if(r){f.appendChild(r)}}}}return f};const R=(t,n,s,o,l,c)=>{let i=t;let f;if(i.shadowRoot&&i.tagName===e){i=i.shadowRoot}for(;l<=c;++l){if(o[l]){f=N(null,s,l);if(f){o[l].m=f;i.insertBefore(f,n)}}}};const T=(t,n,e,s,o)=>{for(;n<=e;++n){if(s=t[n]){o=s.m;o.remove()}}};const W=(t,n,e,s)=>{let o=0;let l=0;let c=0;let i=0;let f=n.length-1;let r=n[0];let u=n[f];let a=s.length-1;let d=s[0];let h=s[a];let y;let p;while(o<=f&&l<=a){if(r==null){r=n[++o]}else if(u==null){u=n[--f]}else if(d==null){d=s[++l]}else if(h==null){h=s[--a]}else if(A(r,d)){F(r,d);r=n[++o];d=s[++l]}else if(A(u,h)){F(u,h);u=n[--f];h=s[--a]}else if(A(r,h)){F(r,h);t.insertBefore(r.m,u.m.nextSibling);r=n[++o];h=s[--a]}else if(A(u,d)){F(u,d);t.insertBefore(u.m,r.m);u=n[--f];d=s[++l]}else{c=-1;{for(i=o;i<=f;++i){if(n[i]&&n[i].u!==null&&n[i].u===d.u){c=i;break}}}if(c>=0){p=n[c];if(p.p!==d.p){y=N(n&&n[l],e,c)}else{F(p,d);n[c]=undefined;y=p.m}d=s[++l]}else{y=N(n&&n[l],e,l);d=s[++l]}if(y){{r.m.parentNode.insertBefore(y,r.m)}}}}if(o>f){R(t,s[a+1]==null?null:s[a+1].m,e,s,l,a)}else if(l>a){T(n,o,f)}};const A=(t,n)=>{if(t.p===n.p){{return t.u===n.u}}return false};const F=(t,n)=>{const e=n.m=t.m;const o=t.i;const l=n.i;const c=n.o;if(c===null){{{P(t,n,s)}}if(o!==null&&l!==null){W(e,o,n,l)}else if(l!==null){if(t.o!==null){e.textContent=""}R(e,null,n,l,0,l.length-1)}else if(o!==null){T(o,0,o.length-1)}}else if(t.o!==c){e.data=c}};const q=(t,s)=>{const o=t.v;const l=t.j||p(null,null);const c=$(s)?s:y(null,null,s);e=o.tagName;c.p=null;c.h|=4;t.j=c;c.m=l.m=o.shadowRoot||o;{n=o["s-sc"]}F(l,c)};const H=(t,n)=>{if(n&&!t.C&&n["s-p"]){n["s-p"].push(new Promise((n=>t.C=n)))}};const I=(t,n)=>{{t.h|=16}if(t.h&4){t.h|=512;return}H(t,t.M);const e=()=>V(t,n);return Et(e)};const V=(t,n)=>{const e=i("scheduleUpdate",t.g.k);const s=t.O;let o;if(n){{t.h|=256;if(t.U){t.U.map((([t,n])=>K(s,t,n)));t.U=null}}{o=K(s,"componentWillLoad")}}e();return Q(o,(()=>_(t,s,n)))};const _=async(t,n,e)=>{const s=t.v;const o=i("update",t.g.k);const l=s["s-rc"];if(e){O(t)}const c=i("render",t.g.k);{z(t,n)}if(l){l.map((t=>t()));s["s-rc"]=undefined}c();o();{const n=s["s-p"];const e=()=>D(t);if(n.length===0){e()}else{Promise.all(n).then(e);t.h|=4;n.length=0}}};const z=(t,n,e)=>{try{o=n;n=n.render&&n.render();{t.h&=~16}{t.h|=2}{{{q(t,n)}}}}catch(n){pt(n,t.v)}o=null;return null};const B=()=>o;const D=t=>{const n=t.g.k;const e=t.v;const s=i("postUpdate",n);const o=t.M;if(!(t.h&64)){t.h|=64;{X(e)}s();{t.L(e);if(!o){J()}}}else{s()}{if(t.C){t.C();t.C=undefined}if(t.h&512){Ut((()=>I(t,false)))}t.h&=~(4|512)}};const G=t=>{{const n=at(t);const e=n.v.isConnected;if(e&&(n.h&(2|16))===2){I(n,false)}return e}};const J=n=>{{X(vt.documentElement)}Ut((()=>k(wt,"appload",{detail:{namespace:t}})))};const K=(t,n,e)=>{if(t&&t[n]){try{return t[n](e)}catch(t){pt(t)}}return undefined};const Q=(t,n)=>t&&t.then?t.then(n):n();const X=t=>t.classList.add("hydrated");const Y=(t,n)=>at(t).P.get(n);const Z=(t,n,e,s)=>{const o=at(t);const l=o.v;const c=o.P.get(n);const i=o.h;const f=o.O;e=S(e,s.N[n][0]);const r=Number.isNaN(c)&&Number.isNaN(e);const u=e!==c&&!r;if((!(i&8)||c===undefined)&&u){o.P.set(n,e);if(f){if(s.R&&i&128){const t=s.R[n];if(t){t.map((t=>{try{f[t](e,c,n)}catch(t){pt(t,l)}}))}}if((i&(2|16))===2){I(o,false)}}}};const tt=(t,n,e)=>{if(n.N){if(t.watchers){n.R=t.watchers}const s=Object.entries(n.N);const o=t.prototype;s.map((([t,[s]])=>{if(s&31||e&2&&s&32){Object.defineProperty(o,t,{get(){return Y(this,t)},set(e){Z(this,t,e,n)},configurable:true,enumerable:true})}}));if(e&1){const n=new Map;o.attributeChangedCallback=function(t,e,s){St.jmp((()=>{const e=n.get(t);if(this.hasOwnProperty(e)){s=this[e];delete this[e]}else if(o.hasOwnProperty(e)&&typeof this[e]==="number"&&this[e]==s){return}this[e]=s===null&&typeof this[e]==="boolean"?false:s}))};t.observedAttributes=s.filter((([t,n])=>n[0]&15)).map((([t,e])=>{const s=e[1]||t;n.set(s,t);return s}))}}return t};const nt=async(t,n,e,s,o)=>{if((n.h&32)===0){{n.h|=32;o=$t(e);if(o.then){const t=f();o=await o;t()}if(!o.isProxied){{e.R=o.watchers}tt(o,e,2);o.isProxied=true}const t=i("createInstance",e.k);{n.h|=8}try{new o(n)}catch(t){pt(t)}{n.h&=~8}{n.h|=128}t()}if(o.style){let t=o.style;const n=x(e);if(!bt.has(n)){const s=i("registerStyles",e.k);C(n,t,!!(e.h&1));s()}}}const l=n.M;const c=()=>I(n,true);if(l&&l["s-rc"]){l["s-rc"].push(c)}else{c()}};const et=t=>{if((St.h&1)===0){const n=at(t);const e=n.g;const s=i("connectedCallback",e.k);if(!(n.h&1)){n.h|=1;{let e=t;while(e=e.parentNode||e.host){if(e["s-p"]){H(n,n.M=e);break}}}if(e.N){Object.entries(e.N).map((([n,[e]])=>{if(e&31&&t.hasOwnProperty(n)){const e=t[n];delete t[n];t[n]=e}}))}{nt(t,n,e)}}else{ct(t,n,e.T)}s()}};const st=t=>{if((St.h&1)===0){const n=at(t);const e=n.O;{if(n.W){n.W.map((t=>t()));n.W=undefined}}{K(e,"disconnectedCallback")}}};const ot=(t,n={})=>{var e;const s=i();const o=[];const l=n.exclude||[];const c=wt.customElements;const f=vt.head;const u=f.querySelector("meta[charset]");const a=vt.createElement("style");const d=[];let y;let p=true;Object.assign(St,n);St.t=new URL(n.resourcesUrl||"./",vt.baseURI).href;t.map((t=>{t[1].map((n=>{const e={h:n[0],k:n[1],N:n[2],T:n[3]};{e.N=n[2]}{e.T=n[3]}{e.R={}}const s=e.k;const i=class extends HTMLElement{constructor(t){super(t);t=this;ht(t,e);if(e.h&1){{{t.attachShadow({mode:"open"})}}}}connectedCallback(){if(y){clearTimeout(y);y=null}if(p){d.push(this)}else{St.jmp((()=>et(this)))}}disconnectedCallback(){St.jmp((()=>st(this)))}componentOnReady(){return at(this).A}};e.F=t[0];if(!l.includes(s)&&!c.get(s)){o.push(s);c.define(s,tt(i,e,1))}}))}));{a.innerHTML=o+r;a.setAttribute("data-styles","");const t=(e=St.S)!==null&&e!==void 0?e:h(vt);if(t!=null){a.setAttribute("nonce",t)}f.insertBefore(a,u?u.nextSibling:f.firstChild)}p=false;if(d.length){d.map((t=>t.connectedCallback()))}else{{St.jmp((()=>y=setTimeout(J,30)))}}s()};const lt=(t,n)=>n;const ct=(t,n,e,s)=>{if(e){e.map((([e,s,o])=>{const l=t;const c=it(n,o);const i=ft(e);St.ael(l,s,c,i);(n.W=n.W||[]).push((()=>St.rel(l,s,c,i)))}))}};const it=(t,n)=>e=>{try{{if(t.h&256){t.O[n](e)}else{(t.U=t.U||[]).push([n,e])}}}catch(t){pt(t)}};const ft=t=>(t&2)!==0;const rt=t=>St.S=t;const ut=new WeakMap;const at=t=>ut.get(t);const dt=(t,n)=>ut.set(n.O=t,n);const ht=(t,n)=>{const e={h:0,v:t,g:n,P:new Map};{e.A=new Promise((t=>e.L=t));t["s-p"]=[];t["s-rc"]=[]}ct(t,e,n.T);return ut.set(t,e)};const yt=(t,n)=>n in t;const pt=(t,n)=>(0,console.error)(t,n);const mt=new Map;const $t=(t,n,e)=>{const s=t.k.replace(/-/g,"_");const o=t.F;const l=mt.get(o);if(l){return l[s]}
2
+ /*!__STENCIL_STATIC_IMPORT_SWITCH__*/return import(`./${o}.entry.js${""}`).then((t=>{{mt.set(o,t)}return t[s]}),pt)};const bt=new Map;const wt=typeof window!=="undefined"?window:{};const vt=wt.document||{head:{}};const St={h:0,t:"",jmp:t=>t(),raf:t=>requestAnimationFrame(t),ael:(t,n,e,s)=>t.addEventListener(n,e,s),rel:(t,n,e,s)=>t.removeEventListener(n,e,s),ce:(t,n)=>new CustomEvent(t,n)};const gt=t=>Promise.resolve(t);const kt=(()=>{try{new CSSStyleSheet;return typeof(new CSSStyleSheet).replaceSync==="function"}catch(t){}return false})();const jt=[];const Ct=[];const Mt=(t,n)=>e=>{t.push(e);if(!l){l=true;if(n&&St.h&4){Ut(xt)}else{St.raf(xt)}}};const Ot=t=>{for(let n=0;n<t.length;n++){try{t[n](performance.now())}catch(t){pt(t)}}t.length=0};const xt=()=>{Ot(jt);{Ot(Ct);if(l=jt.length>0){St.raf(xt)}}};const Ut=t=>gt().then(t);const Et=Mt(Ct,true);export{lt as F,c as a,ot as b,g as c,G as f,B as g,y as h,gt as p,dt as r,rt as s};
3
+ //# sourceMappingURL=p-8829e98e.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import{g as t,f as e,r as i,h as r,a as n,F as s,c as a}from"./p-8829e98e.js";const o=(t,e,i)=>{const r=t.get(e);if(!r){t.set(e,[i])}else if(!r.includes(i)){r.push(i)}};const l=(t,e)=>{let i;return(...r)=>{if(i){clearTimeout(i)}i=setTimeout((()=>{i=0;t(...r)}),e)}};const h=t=>!("isConnected"in t)||t.isConnected;const c=l((t=>{for(let e of t.keys()){t.set(e,t.get(e).filter(h))}}),2e3);const u=()=>{if(typeof t!=="function"){return{}}const i=new Map;return{dispose:()=>i.clear(),get:e=>{const r=t();if(r){o(i,e,r)}},set:t=>{const r=i.get(t);if(r){i.set(t,r.filter(e))}c(i)},reset:()=>{i.forEach((t=>t.forEach(e)));c(i)}}};const d=t=>typeof t==="function"?t():t;const m=(t,e=((t,e)=>t!==e))=>{const i=d(t);let r=new Map(Object.entries(i!==null&&i!==void 0?i:{}));const n={dispose:[],get:[],set:[],reset:[]};const s=()=>{var e;r=new Map(Object.entries((e=d(t))!==null&&e!==void 0?e:{}));n.reset.forEach((t=>t()))};const a=()=>{n.dispose.forEach((t=>t()));s()};const o=t=>{n.get.forEach((e=>e(t)));return r.get(t)};const l=(t,i)=>{const s=r.get(t);if(e(i,s,t)){r.set(t,i);n.set.forEach((e=>e(t,i,s)))}};const h=typeof Proxy==="undefined"?{}:new Proxy(i,{get(t,e){return o(e)},ownKeys(t){return Array.from(r.keys())},getOwnPropertyDescriptor(){return{enumerable:true,configurable:true}},has(t,e){return r.has(e)},set(t,e,i){l(e,i);return true}});const c=(t,e)=>{n[t].push(e);return()=>{f(n[t],e)}};const u=(e,i)=>{const r=c("set",((t,r)=>{if(t===e){i(r)}}));const n=c("reset",(()=>i(d(t)[e])));return()=>{r();n()}};const m=(...t)=>{const e=t.reduce(((t,e)=>{if(e.set){t.push(c("set",e.set))}if(e.get){t.push(c("get",e.get))}if(e.reset){t.push(c("reset",e.reset))}if(e.dispose){t.push(c("dispose",e.dispose))}return t}),[]);return()=>e.forEach((t=>t()))};const p=t=>{const e=r.get(t);n.set.forEach((i=>i(t,e,e)))};return{state:h,get:o,set:l,on:c,onChange:u,use:m,dispose:a,reset:s,forceUpdate:p}};const f=(t,e)=>{const i=t.indexOf(e);if(i>=0){t[i]=t[t.length-1];t.length--}};const p=(t,e)=>{const i=m(t,e);i.use(u());return i};const{state:x,onChange:g}=p({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});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))}));const b=t=>t.split(" ").reduce(((t,e)=>e.length<2?e:t+e.slice(0,1)+"*".repeat(e.length-2)+e.slice(e.length-1,e.length)+" "),"");const v=class{constructor(t){i(this,t);this.handleSubmit=t=>{t.preventDefault();const e=this.street.length>0;if(!e){this.streetError="Ange en gatuadress"}const i=this.zip.length>0;if(!i){this.zipError="Ange ett postnummer"}const r=this.town.length>0;if(!r){this.townError="Ange en ort"}if(e&&i&&r){x.user=Object.assign(Object.assign({},x.user),{street:this.street,zip:this.zip,town:this.town});x.checkoutStep=2;x.checkoutEdit=false}};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=()=>r("form",{class:"hemfixarna_address",onSubmit:t=>this.handleSubmit(t)},r("div",null,r("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}),r("label",{htmlFor:"street"},"Gatuaddress ")),this.streetError&&r("span",null,this.streetError),r("div",null,r("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}),r("label",{htmlFor:"zip"},"Postnummer ")),this.zipError&&r("span",null,this.zipError),r("div",null,r("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}),r("label",{htmlFor:"town"},"Ort ")),this.townError&&r("span",null,this.townError),r("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}}};const _=t=>Math.ceil(t/2);const k=t=>Math.ceil(t*.7);const w=(t,e,i=1)=>{if(t.rot&&x.rot){return k((e||t.price)*i)}else if(t.rut&&x.rut){return _((e||t.price)*i)}else{return(e||t.price)*i}};const y=t=>{if(t.rot){return k(t.price)}else if(t.rut&&x.rut){return _(t.price)}else{return t.price}};const $=(t,e,i=1)=>{if(e.rot&&x.rot){return k(t.price*i)}else if(e.rut&&x.rut){return _(t.price*i)}else{return t.price*i}};const C=()=>{if(!x.cart)return{rut:0,rot:0};const t=x.cart.some((t=>t.rut&&t.start_fee));const e=x.cart.some((t=>t.rot&&t.start_fee));const i=x.rut?_(x.options.start_fee):x.options.start_fee*1;const r=x.rot?k(x.options.start_fee):x.options.start_fee*1;if(t&&e){return{rut:i,rot:r,length:2}}else if(t){return{rut:i,rot:0,length:1}}else if(e){return{rut:0,rot:r,length:1}}else{return{rut:0,rot:0,length:0}}};const T=t=>{const e=t.parts.reduce(((t,e)=>t+e.price*e.amount),0);return w(t,t.price*t.amount+e)};const z=()=>{const t=x.cart.reduce(((t,e)=>e.rot?t+T(e):t),0)+C().rot;const e=x.cart.reduce(((t,e)=>{const i=e.parts.reduce(((t,e)=>t+e.price*e.amount),0);return e.rot?t+e.price*e.amount+i:t}),0)+Number(x.options.start_fee);return e-t};const S=()=>{const t=x.cart.reduce(((t,e)=>e.rut?t+T(e):t),0)+C().rut;const e=x.cart.reduce(((t,e)=>{const i=e.parts.reduce(((t,e)=>t+e.price*e.amount),0);return e.rut?t+e.price*e.amount+i:t}),0)+Number(x.options.start_fee);return e-t};const j=()=>x.cart.reduce(((t,e)=>t+T(e)),0)+C().rot+C().rut;const O=class{constructor(t){i(this,t);this.post=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}}}render(){return r("li",{onClick:()=>this.setTaxonomy(this.post)},this.post.icon&&r("img",{class:"hemfixarna_logo",height:82,src:this.icon,alt:this.postTitle}),r("div",null,r("p",null,this.postTitle),x.step===3&&r("p",{class:"price"},"Från ",w(this.post),"kr")))}};const M=class{constructor(t){i(this,t);this.tree=undefined;this.closeModal=undefined}getCartLength(){return x.cart.reduce(((t,e)=>t+e.amount),0)}handleCartClick(){var t;if((t=x.cart)===null||t===void 0?void 0:t.length){x.step=5}}handleHomePageClick(){x.step=1;setTimeout((()=>{x.selectedCategory=null;x.selectedProduct=null;x.selectedService=null}),200)}render(){const t=n(`./assets/hemfixarna.svg`);const e=n(`./assets/close.svg`);const i=n(`./assets/cart.svg`);const s=n(`./assets/back.svg`);return r("div",null,r("div",{class:"hemfixarna_crumbs"},r("div",{class:"hemfixarna_crumbs--links"},r("img",{onClick:()=>this.handleHomePageClick(),src:t,width:110}),r("img",{onClick:()=>this.closeModal(),class:"close",src:e,width:32}),r("div",null,r("button",{onClick:()=>this.handleHomePageClick()},"Alla tjänster"))),r("div",{onClick:()=>this.handleCartClick(),class:`cart ${this.getCartLength()>0?"cart_active":""}`},r("img",{src:i,width:24}),r("span",null,this.getCartLength()))),[3,4].includes(x.step)&&r("button",{class:"hemfixarna_crumbs--back",onClick:()=>{x.step=x.step===4?3:2}},r("img",{width:24,src:s,alt:"back arrow"}),r("span",null,"Se allt ",x.step===4?x.selectedService.post_title:x.selectedCategory.name)))}};var N;(function(t){t["byggmax"]="byggmax"})(N||(N={}));var I;(function(t){t["byggmax"]="category/bygg"})(I||(I={}));const A="";const L=class{constructor(t){i(this,t);this.tree=null;this.slug=undefined}render(){return r("hemfixarna-component",{slug:this.slug,business:N.byggmax,topCategory:I.byggmax})}};L.style=A;const P=class{constructor(t){i(this,t);this.tree=undefined}render(){const t=n(`./assets/back.svg`);return r("div",{class:"hemfixarna_cart"},r("div",{class:"hemfixarna_cart--left"},r("h2",null,x.checkoutStep===2&&!x.checkoutEdit&&r("button",{onClick:()=>{x.checkoutStep=1}},r("img",{width:24,src:t,alt:"back arrow"})),"Din bokning"),r("hemfixarna-orderrows",{tree:this.tree})),r("div",{class:"hemfixarna_cart--right"},r("h2",null,x.checkoutStep===2&&!x.checkoutEdit&&r("button",{onClick:()=>{x.checkoutStep=1}},r("img",{width:24,src:t,alt:"back arrow"})),"Dina uppgifter"),r("hemfixarna-checkout",null),r("hemfixarna-info",null)))}};const R=class{constructor(t){i(this,t)}setSelectedService(t){x.selectedService=t;x.step=3}render(){return r("div",null,r("h2",null,x.selectedCategory.name),r("div",{class:"hemfixarna_categories--wrapper"},r("div",null,r("ul",{class:"hemfixarna_categories"},x.selectedCategory.services.sort(((t,e)=>t.post_title<e.post_title?-1:1)).map((t=>{var e;return r("hemfixarna-box",{post:t,icon:(e=t.icon.url)!==null&&e!==void 0?e:t.icon,postTitle:t.post_title})})))),r("hemfixarna-info",{list:x.options.trust})))}};const D=`${"http://hemfixare.se.test"}/wp-json/headless`;const F=async t=>{if(!t){return}const e=t.split("/")[0];const i=t.split("/")[1];try{const t=await fetch(`${D}/${e}/${i}`);return await t.json()}catch(t){console.log(t)}};const K=async()=>{try{const t=await fetch(`${D}/webcoptions`);return await t.json()}catch(t){console.log(t)}};const J=async t=>{try{const e=await fetch(`${D}/weborder`,{method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json"}});return await e.json()}catch(t){console.log(t)}};const E=class{constructor(t){i(this,t);this.handleChangeDate=t=>{this.dateError=null;this.date=t.target.value};this.handleChangeTerms=()=>{this.generalError=null};this.sendOrder=async()=>{const t={name:x.user.firstName+" "+x.user.lastName,customer:x.business,phone:x.user.phone,social_security_number:x.user.ssn,email:x.user.email,address:`${x.user.street} | ${x.user.zip} | ${x.user.town}`,earliest_visit_date:this.date,order_items:JSON.stringify(x.cart.map((t=>`${t.amount}st ${t.name} ${w(t,t.price,t.amount)}kr ${t.parts.length?`| ${t.parts.map((e=>`${e.amount}st ${e.name} ${$(e,t,e.amount)}kr`)).join(" | ")} `:""} ${t.rot&&x.rot?"(med rot)":x.rut&&t.rut?"(med rut)":"(utan rut/rot)"}`))),start_fee:`${C().rut>0?`Rut: ${C().rut}kr`:"Rut: 0"} `+`${C().rot>0?`Rot: ${C().rot}kr`:"Rot: 0"}`,total:j()};try{const{data:e,status:i}=await J(t);if(e&&i&&i===200){x.step=6}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.handleSubmit=t=>{t.preventDefault();this.generalError=null;const e=this.date.length>0;if(!e){this.dateError="Ange ett giltigt datum"}const i=Array.from(this.el.querySelectorAll('input[type="checkbox"]'));const r=i.find((t=>!t.checked));if(r){this.generalError="Du måste godkänna villkoren"}if(e&&!r){this.sendOrder()}};this.render=()=>{const t=n(`./assets/date.svg`);const e=n(`./assets/down.svg`);if(x.checkoutEdit){return r("hemfixarna-address",null)}else if(x.checkoutStep===1){return r("hemfixarna-getuser",null)}else if(x.checkoutStep===2){return r("div",{class:"mb-2"},r("div",{class:"hemfixarna_addressinfo"},r("div",null,r("p",null,b(x.user.firstName)),r("p",null,b(x.user.lastName)),r("p",null,x.user.email),r("p",null,x.user.phone)),r("div",null,r("p",null,b(x.user.street)),r("p",null,b(x.user.zip)),r("p",null,b(x.user.town))),r("button",{onClick:()=>x.checkoutEdit=true},"Behöver du ändra adressen?")),r("form",{onSubmit:t=>this.handleSubmit(t)},r("div",null,r("img",{src:t,width:24}),r("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}),r("label",{htmlFor:"date"},"Tidigaste datum för hembesök"),r("img",{src:e,width:24})),this.dateError&&r("span",null,this.dateError),r("label",{class:"hemfixarna_checkbox"},r("input",{onChange:()=>this.handleChangeTerms(),type:"checkbox"}),r("span",{innerHTML:x.options.terms})),x.cart.filter((t=>t.terms_checkout&&t.terms_show_checkbox)).map((t=>r(s,null,r("label",{class:"hemfixarna_checkbox"},r("input",{onChange:()=>this.handleChangeTerms(),type:"checkbox"}),r("span",null,t.terms_checkout))))),this.generalError&&r("span",null,this.generalError),r("input",{type:"submit",value:"Slutför Bokning"})))}};this.date="";this.dateError=null;this.generalError=null}componentWillLoad(){if(Boolean(x.user&&x.user.street)){x.checkoutStep=2}}get el(){return a(this)}};const U='@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:2rem}:host form{display:flex;flex-direction:column;gap:1rem}:host form img{position:absolute;top:50%;transform:translateY(-50%);pointer-events:none}:host form img:first-of-type{left:1rem}:host form img:last-of-type{right:1rem}:host form span{margin-top:-0.5rem;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:1rem;top:50%;transform:translateY(-50%);background:#fff;padding:0.25rem;transition:0.2s all cubic-bezier(0.465, 0.183, 0.153, 0.946)}:host form div input{padding:1rem;width:100%;font-size:1rem;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 0.5rem}:host h2{margin:0 0 1.5rem;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 .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:2.5rem 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:1.5rem;padding:2rem;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);border-radius:0.25rem;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:2rem;z-index:99;border-radius:0.25rem;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);display:flex;flex-direction:column;gap:1rem}:host .hemfixarna_infomodal button{background:#ec6632;color:#fff;border-radius:60px;font-size:16px;padding:0.5rem 1rem}:host .hemfixarna_addressinfo{padding:1rem 1rem 4rem;border:1px solid #fcd9c9;position:relative;margin-bottom:2rem;display:grid;grid-template-columns:1fr 1fr;gap:0.5rem}:host .hemfixarna_addressinfo button{position:absolute;bottom:1rem;right:1rem;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:1rem;grid-template-columns:auto 75px}:host .hemfixarna_counter{display:flex;align-items:center}:host .hemfixarna_counter span{padding:0 0.5rem}: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_terms{font-size:14px}:host .hemfixarna_terms a{color:inherit}:host .hemfixarna_logo{height:4rem}:host .hemfixarna_box{padding:1rem;display:flex;align-items:center;justify-content:space-between;background:#fffaf2;border:1px solid #fcd9c9;width:100%;box-sizing:border-box;border-radius:0.25rem;gap:1rem 0.5rem}:host .hemfixarna_box>div{display:grid;gap:0.5rem}: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_btn{font-size:14px;background:#c84e18;color:#fff;padding:1rem 2rem;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:-0.5rem;right:-0.75rem}: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:1rem 1.5rem}:host .hemfixarna .disabled{opacity:0.5;cursor:default}:host .hemfixarna_modal{position:fixed;background:#fffaf2;border:1px solid #fcd9c9;border-radius:0.25rem;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:0.5rem}: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:3rem 2rem 4rem}@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:2rem;display:flex;flex-direction:column;max-height:100%;overflow:auto}:host .hemfixarna_order img{cursor:pointer}:host .hemfixarna_order button{margin:1rem 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:2rem}@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:0.2rem}@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:1rem;align-items:center}:host .hemfixarna_cart--additional{display:flex;flex-direction:column;gap:1rem;padding:1rem;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:-1.5rem}:host .hemfixarna_cart--price{border-top:1px solid #fcd9c9;padding:1rem;display:flex;justify-content:space-between}:host .hemfixarna_cart--price h3{margin:0}:host .hemfixarna_cart--item{display:flex;flex-direction:column;gap:0.5rem;padding:1rem 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:1rem}:host .hemfixarna_cart--item>div button{color:#ec6632}:host .hemfixarna_categories{display:grid;gap:1.5rem}:host .hemfixarna_categories--wrapper{gap:2rem;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:0.25rem;min-height:132px;padding:1.5rem;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);display:flex;align-items:center;gap:1.5rem;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 2rem 4rem}:host .hemfixarna_content--5{padding-top:1rem}:host .hemfixarna_crumbs{position:relative;padding:1rem 1.5rem;border-bottom:1px solid #fcd9c9;display:flex;justify-content:space-between}:host .hemfixarna_crumbs--back{padding:1rem 1.5rem 0.5rem;display:flex;align-items:center;gap:0.5rem;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:-1rem;top:-1rem;z-index:9}:host .hemfixarna_crumbs .cart{padding-left:1rem;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:-0.5rem;right:-0.75rem}: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:1rem;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:4rem;padding:0.75rem 1rem;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:0.75rem !important}:host .hemfixarna_features li{display:flex;gap:1rem;align-items:center}:host .hemfixarna_address{margin-bottom:1rem}:host .hemfixarna_product{display:grid;gap:1rem}:host .hemfixarna_product--link{font-weight:700;color:#474444;text-underline-offset:0.25rem}:host .hemfixarna_product--left{gap:2rem}:host .hemfixarna_product--right{gap:2rem}:host .hemfixarna_product--price{margin-top:0.25rem;font-weight:700}:host .hemfixarna_product--total{text-align:center;margin:-1rem 0;font-size:21px;line-height:28px}:host .hemfixarna_product--item{background:#fff;padding:1rem;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:2rem}@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:0.5rem}:host .hemfixarna_product p{margin:0}:host .hemfixarna_product--top{display:flex;gap:2rem}: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:0.5rem}:host h5,:host p{margin:0}:host input[type=submit]{cursor:pointer}:host input[type=date]~label{left:3.5rem}:host input[type=date]{border:1px solid #fcd9c9;padding-left:4rem}:host input[type=checkbox]{height:1.125rem;width:1.125rem;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 W=class{constructor(t){i(this,t);this.modal=false;this.showModal=false;this.tree=null;this.product=null;this.slug=undefined;this.business=undefined;this.topCategory=undefined}async fetchNewTaxonomy(t){x.selectedCategory=null;x.selectedProduct=null;x.selectedService=null;const e=await F(t);if((e===null||e===void 0?void 0:e.code)==="not_found"||(e===null||e===void 0?void 0:e.code)==="rest_no_route"){console.log("taxonomy not found")}else if(e){this.setTaxonomy(e);if((e===null||e===void 0?void 0:e.post_type)==="ikea_product"){this.product=e}}}async componentWillLoad(){x.business=this.business;const t=window.sessionStorage.getItem(`hemfixarna-${this.business}-cart`);if(t){x.cart=JSON.parse(t)}const e=window.sessionStorage.getItem(`hemfixarna-${this.business}-user`);if(e){x.user=JSON.parse(e)}const i=await F(this.topCategory);if((i===null||i===void 0?void 0:i.code)==="not_found"){console.warn("tree not found")}else if(i){this.tree=i}if(this.slug){const t=await F(this.slug);if((t===null||t===void 0?void 0:t.code)==="not_found"){console.log("taxonomy not found")}else if(t){this.setTaxonomy(t)}}const r=await K();x.options=r}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((e=>e.services.find((e=>e.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}}}openModal(){this.modal=true;setTimeout((()=>{this.showModal=true}),50)}closeModal(){this.showModal=false;setTimeout((()=>{this.modal=false}),200)}handleClick(t){const e=this.el.shadowRoot.querySelector(".hemfixarna_modal");if(e){const i=e.contains(t.composedPath()[0]);if(!i){this.closeModal()}}const i=this.el.shadowRoot.querySelector(".hemfixarna_infomodal");if(i){const e=i.contains(t.composedPath()[0]);if(!e){x.modal=null}}}getCartLength(){return x.cart.reduce(((t,e)=>t+e.amount),0)}render(){var t,e;const i=n(`./assets/hemfixarna.svg`);return r("div",{class:"hemfixarna"},r("div",{class:"hemfixarna_box"},r("div",null,r("div",null,r("p",null,((t=this.product)===null||t===void 0?void 0:t.post_title)||r("span",null,"Montering/Installation på plats - ",r("strong",null,"se priser här")),this.product&&((e=this.slug)===null||e===void 0?void 0:e.includes("product"))?r("span",null," från"," ",r("strong",null,y(this.product),"kr")):null)),r("img",{src:i,width:104})),r("button",{onClick:()=>this.openModal(),class:"hemfixarna_btn"},"Till montering",this.getCartLength()>0&&r("span",null,this.getCartLength()))),this.modal&&r("div",null,r("div",{class:`hemfixarna_modal ${this.showModal?"hemfixarna_modal--open":""}`},x.modal&&r("div",{class:"hemfixarna_infomodal"},r("h2",null,x.modal.title),x.modal.text.map((t=>r("p",null,t))),r("div",null,r("button",{onClick:()=>x.modal=null},"Stäng"))),this.tree&&r("hemfixarna-breadcrumbs",{closeModal:()=>this.closeModal(),tree:this.tree}),r("div",{class:`hemfixarna_content hemfixarna_content--${x.step}`},x.step===1&&this.tree&&r("hemfixarna-start",{tree:this.tree}),x.step===2&&x.selectedCategory&&r("hemfixarna-category",null),x.step===3&&x.selectedService&&r("hemfixarna-service",null),x.step===4&&x.selectedProduct&&r("hemfixarna-product",null),x.step===5&&r("hemfixarna-cart",{tree:this.tree}),x.step===6&&r("hemfixarna-order",{tree:this.tree}))),r("div",{class:`hemfixarna_backdrop ${this.showModal?"hemfixarna_backdrop--open":""}`})))}static get assetsDirs(){return["assets"]}get el(){return a(this)}static get watchers(){return{slug:["fetchNewTaxonomy"]}}};W.style=U;const B='@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap"); :host{font-family:"Inter", sans-serif}:host .hemfixarna_example{margin-bottom:1rem;background:#000;padding:1rem;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:-3rem;font-size:16px;left:40%;color:white;padding:0.5rem;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:0.5rem;margin-top:1rem}:host .hemfixarna_categories{max-height:100%;overflow:auto;position:relative}:host .hemfixarna_categories--label{display:flex;align-items:center;justify-content:space-between;padding:0.5rem}:host .hemfixarna_categories--label button{background:#3f3a92;border:none;font-weight:600;padding:0.2rem 0.6rem;border-radius:10px;margin-right:0.5rem;color:#ece8e8}:host .hemfixarna_categories--label button:active{transform:scale(0.95)}:host .hemfixarna_categories--label--big{font-weight:600;background:#9f9da9}:host p{margin:0}:host span{color:darkolivegreen;font-size:10px}:host button{cursor:pointer}:host>div{display:grid;gap:2rem;width:100%;grid-template-columns:1fr 1fr;height:100vh;place-items:center;overflow:hidden;padding:1rem 2rem;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{background:#000;gap:1px;display:grid}:host>div ul li{padding-left:1rem;background:#fff}';const V=class{constructor(t){i(this,t);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.tooltipText="Kopiera till urklipp";this.tree=null}getTopLevelCategory(){switch("byggmax"){case N.byggmax:return I.byggmax;default:return""}}async componentWillLoad(){const t=await F(this.getTopLevelCategory());if((t===null||t===void 0?void 0:t.code)==="not_found"){console.warn("tree not found")}else if(t){this.tree=t}}getExample(){return`<hemfixarna-${"byggmax"}${this.selectedSlug?` slug="${this.selectedSlug}" `:""}></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=n(`./assets/copy.png`);return r("div",null,r("div",null,r("div",{onClick:()=>this.copyExample(),class:"hemfixarna_example"},r("p",null,this.getExample()),r("img",{src:t,height:20}),r("span",{class:"hemfixarna_example--tooltip"},this.tooltipText)),"byggmax"===N.byggmax&&r("hemfixarna-byggmax",{slug:this.selectedSlug}),r("div",{class:"hemfixarna_install"},r("div",null,r("a",{target:"_blank",href:"https://www.npmjs.com/package/hemfixarna-web-components"},"Install with npm")),r("div",{onClick:()=>this.copyNpmInstall(),class:"hemfixarna_example"},r("p",null,"npm i hemfixarna-web-components"),r("span",{class:"hemfixarna_example--tooltip"},this.tooltipText),r("img",{src:t,height:20})),r("p",null,"Or use cdn"),r("div",{onClick:()=>this.copyCdn(),class:"hemfixarna_example"},r("p",null,this.cdnLink),r("span",{class:"hemfixarna_example--tooltip"},this.tooltipText),r("img",{src:t,height:20})))),r("ul",{class:"hemfixarna_categories"},this.tree.sub_cats.map((t=>r("li",null,r("div",{class:"hemfixarna_categories--label hemfixarna_categories--label--big"},r("div",null,r("p",null,t.name),r("span",null,`category/${t.slug}`)),r("div",null,r("button",{onClick:()=>navigator.clipboard.writeText(`category/${t.slug}`)},"Kopiera slug"),r("button",{onClick:()=>this.selectedSlug=`category/${t.slug}`},"Ladda kategori"))),r("ul",null,t.services.map((t=>r("li",null,r("div",{class:"hemfixarna_categories--label"},r("div",null,r("p",null,t.post_title),r("span",null,`service/${t.post_name}`)),r("div",null,r("button",{onClick:()=>navigator.clipboard.writeText(`service/${t.post_name}`)},"Kopiera slug"),r("button",{onClick:()=>this.selectedSlug=`service/${t.post_name}`},"Ladda kategori"))),r("ul",null,t.products.map((t=>r("li",null,r("div",{class:"hemfixarna_categories--label"},r("div",null,r("p",null,t.post_title),r("span",null,`product/${t.post_name}`)),r("div",null,r("button",{onClick:()=>navigator.clipboard.writeText(`product/${t.post_name}`)},"Kopiera slug"),r("button",{onClick:()=>this.selectedSlug=`product/${t.post_name}`},"Ladda kategori"))))))))))))))))}};V.style=B;var H=class extends Error{constructor(){super("Invalid swedish personal identity number")}};var X=(t,e)=>{const i=t.getTime()-e.getTime();return i<0?-1:i>0?1:i};var Y=(t,e)=>{const i=X(t,e);const r=Math.abs(t.getFullYear()-e.getFullYear());t.setFullYear(t.getFullYear()-i*r);const n=X(t,e)===-i;const s=i*(r-+n);return s===0?0:s};var q=t=>{let e=0;t+="";for(let i=0,r=t.length;i<r;i++){let r=parseInt(t[i]);r*=2-i%2;if(r>9){r-=9}e+=r}return Math.ceil(e/10)*10-e};var G=(t,e,i)=>{e-=1;const r=new Date(t,e,i);return!(r.getFullYear()!==t||r.getMonth()!==e||r.getDate()!==i)};var Z=class{constructor(t,e){this._century="";this._fullYear="";this._year="";this._month="";this._day="";this._sep="";this._num="";this._check="";this.parse(t,{allowCoordinationNumber:true,allowInterimNumber:false,...e})}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,e){return new Z(t,e)}static valid(t,e){try{Z.parse(t,e);return true}catch(t){return false}}parse(t,e){if(t.length<10||t.length>13){throw new H}const i=/^(\d{2}){0,1}(\d{2})(\d{2})(\d{2})([+-]?)((?!000)\d{3}|[TRSUWXJKLMN]\d{2})(\d)$/;const r=i.exec(t);if(!r){throw new H}const n=r[1];const s=r[2];const a=r[3];const o=r[4];const l=r[5];const h=r[6];const c=r[7];if(typeof n==="undefined"||!n.length){const t=new Date;let e=0;if(l==="+"){this._sep="+";e=t.getFullYear()-100}else{this._sep="-";e=t.getFullYear()}this._century=(""+(e-(e-parseInt(s))%100)).substr(0,2)}else{this._century=n;if((new Date).getFullYear()-parseInt(n+s,10)<100){this._sep="-"}else{this._sep="+"}}this._year=s;this._fullYear=this._century+s;this._month=a;this._day=o;this._num=h;this._check=c;if(!this.valid()){throw new H}if(!(e==null?void 0:e.allowCoordinationNumber)&&this.isCoordinationNumber()){throw new H}if(!(e==null?void 0:e.allowInterimNumber)&&this.isInterimNumber()){throw new H}}valid(){const t=q(this.year+this.month+this.day+this.num.replace(/[TRSUWXJKLMN]/,"1"))===+this.check&&!!this.check;if(t&&G(parseInt(this.century+this.year),+this.month,+this.day)){return t}return t&&G(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 Y(new Date(Date.now()),t)}getDate(){let t=+this.day;if(this.isCoordinationNumber()){t-=60}const e=this.century+this.year+"-"+this.month+"-"+(t<10?"0"+t:t);return new Date(e)}isInterimNumber(){return/[TRSUWXJKLMN]/.test(this.num[0])}isCoordinationNumber(){return G(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 Q=Z;function tt(t,e,i){return i={path:e,exports:{},require:function(t,e){return et()}},t(i,i.exports),i.exports}function et(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var it=tt((function(t,e){Object.defineProperty(e,"__esModule",{value:true});e.utf8=void 0;e.utf8={encode:i,decode:r};function i(t){t=t.replace(/\r\n/g,"\n");var e="";for(var i=0;i<t.length;i++){var r=t.charCodeAt(i);if(r<128){e+=String.fromCharCode(r)}else if(r>127&&r<2048){e+=String.fromCharCode(r>>6|192);e+=String.fromCharCode(r&63|128)}else{e+=String.fromCharCode(r>>12|224);e+=String.fromCharCode(r>>6&63|128);e+=String.fromCharCode(r&63|128)}}return e}function r(t){var e="";var i=0;var r=0;var n=0;var s=0;while(i<t.length){r=t.charCodeAt(i);if(r<128){e+=String.fromCharCode(r);i++}else if(r>191&&r<224){n=t.charCodeAt(i+1);e+=String.fromCharCode((r&31)<<6|n&63);i+=2}else{n=t.charCodeAt(i+1);s=t.charCodeAt(i+2);e+=String.fromCharCode((r&15)<<12|(n&63)<<6|s&63);i+=3}}return e}}));var rt=tt((function(t,e){Object.defineProperty(e,"__esModule",{value:true});e.generate=void 0;function i(t){var e=[];var i;var r;var s;var a;var o;var l;var p;var x;var g;var b=7;var v=12;var _=17;var k=22;var w=5;var y=9;var $=14;var C=20;var T=4;var z=11;var S=16;var j=23;var O=6;var M=10;var N=15;var I=21;var A=it.utf8.encode(t);e=m(A);l=1732584193;p=4023233417;x=2562383102;g=271733878;for(i=0;i<e.length;i+=16){r=l;s=p;a=x;o=g;l=h(l,p,x,g,e[i+0],b,3614090360);g=h(g,l,p,x,e[i+1],v,3905402710);x=h(x,g,l,p,e[i+2],_,606105819);p=h(p,x,g,l,e[i+3],k,3250441966);l=h(l,p,x,g,e[i+4],b,4118548399);g=h(g,l,p,x,e[i+5],v,1200080426);x=h(x,g,l,p,e[i+6],_,2821735955);p=h(p,x,g,l,e[i+7],k,4249261313);l=h(l,p,x,g,e[i+8],b,1770035416);g=h(g,l,p,x,e[i+9],v,2336552879);x=h(x,g,l,p,e[i+10],_,4294925233);p=h(p,x,g,l,e[i+11],k,2304563134);l=h(l,p,x,g,e[i+12],b,1804603682);g=h(g,l,p,x,e[i+13],v,4254626195);x=h(x,g,l,p,e[i+14],_,2792965006);p=h(p,x,g,l,e[i+15],k,1236535329);l=c(l,p,x,g,e[i+1],w,4129170786);g=c(g,l,p,x,e[i+6],y,3225465664);x=c(x,g,l,p,e[i+11],$,643717713);p=c(p,x,g,l,e[i+0],C,3921069994);l=c(l,p,x,g,e[i+5],w,3593408605);g=c(g,l,p,x,e[i+10],y,38016083);x=c(x,g,l,p,e[i+15],$,3634488961);p=c(p,x,g,l,e[i+4],C,3889429448);l=c(l,p,x,g,e[i+9],w,568446438);g=c(g,l,p,x,e[i+14],y,3275163606);x=c(x,g,l,p,e[i+3],$,4107603335);p=c(p,x,g,l,e[i+8],C,1163531501);l=c(l,p,x,g,e[i+13],w,2850285829);g=c(g,l,p,x,e[i+2],y,4243563512);x=c(x,g,l,p,e[i+7],$,1735328473);p=c(p,x,g,l,e[i+12],C,2368359562);l=u(l,p,x,g,e[i+5],T,4294588738);g=u(g,l,p,x,e[i+8],z,2272392833);x=u(x,g,l,p,e[i+11],S,1839030562);p=u(p,x,g,l,e[i+14],j,4259657740);l=u(l,p,x,g,e[i+1],T,2763975236);g=u(g,l,p,x,e[i+4],z,1272893353);x=u(x,g,l,p,e[i+7],S,4139469664);p=u(p,x,g,l,e[i+10],j,3200236656);l=u(l,p,x,g,e[i+13],T,681279174);g=u(g,l,p,x,e[i+0],z,3936430074);x=u(x,g,l,p,e[i+3],S,3572445317);p=u(p,x,g,l,e[i+6],j,76029189);l=u(l,p,x,g,e[i+9],T,3654602809);g=u(g,l,p,x,e[i+12],z,3873151461);x=u(x,g,l,p,e[i+15],S,530742520);p=u(p,x,g,l,e[i+2],j,3299628645);l=d(l,p,x,g,e[i+0],O,4096336452);g=d(g,l,p,x,e[i+7],M,1126891415);x=d(x,g,l,p,e[i+14],N,2878612391);p=d(p,x,g,l,e[i+5],I,4237533241);l=d(l,p,x,g,e[i+12],O,1700485571);g=d(g,l,p,x,e[i+3],M,2399980690);x=d(x,g,l,p,e[i+10],N,4293915773);p=d(p,x,g,l,e[i+1],I,2240044497);l=d(l,p,x,g,e[i+8],O,1873313359);g=d(g,l,p,x,e[i+15],M,4264355552);x=d(x,g,l,p,e[i+6],N,2734768916);p=d(p,x,g,l,e[i+13],I,1309151649);l=d(l,p,x,g,e[i+4],O,4149444226);g=d(g,l,p,x,e[i+11],M,3174756917);x=d(x,g,l,p,e[i+2],N,718787259);p=d(p,x,g,l,e[i+9],I,3951481745);l=n(l,r);p=n(p,s);x=n(x,a);g=n(g,o)}return f(l)+f(p)+f(x)+f(g)}e.generate=i;function r(t,e){return t<<e|t>>>32-e}function n(t,e){var i;var r;var n;var s;var a;n=t&2147483648;s=e&2147483648;i=t&1073741824;r=e&1073741824;a=(t&1073741823)+(e&1073741823);if(i&r){return a^2147483648^n^s}if(i|r){if(a&1073741824){return a^3221225472^n^s}else{return a^1073741824^n^s}}else{return a^n^s}}function s(t,e,i){return t&e|~t&i}function a(t,e,i){return t&i|e&~i}function o(t,e,i){return t^e^i}function l(t,e,i){return e^(t|~i)}function h(t,e,i,a,o,l,h){t=n(t,n(n(s(e,i,a),o),h));return n(r(t,l),e)}function c(t,e,i,s,o,l,h){t=n(t,n(n(a(e,i,s),o),h));return n(r(t,l),e)}function u(t,e,i,s,a,l,h){t=n(t,n(n(o(e,i,s),a),h));return n(r(t,l),e)}function d(t,e,i,s,a,o,h){t=n(t,n(n(l(e,i,s),a),h));return n(r(t,o),e)}function m(t){var e;var i=t.length;var r=i+8;var n=(r-r%64)/64;var s=(n+1)*16;var a=Array(s-1);var o=0;var l=0;while(l<i){e=(l-l%4)/4;o=l%4*8;a[e]=a[e]|t.charCodeAt(l)<<o;l++}e=(l-l%4)/4;o=l%4*8;a[e]=a[e]|128<<o;a[s-2]=i<<3;a[s-1]=i>>>29;return a}function f(t){var e="";var i="";var r;var n;for(n=0;n<=3;n++){r=t>>>n*8&255;i="0"+r.toString(16);e=e+i.substr(i.length-2,2)}return e}}));var nt=tt((function(t,e){Object.defineProperty(e,"__esModule",{value:true});e.MD5=e.generate=void 0;var i=rt;Object.defineProperty(e,"generate",{enumerable:true,get:function(){return i.generate}});e.MD5={generate:rt.generate}}));const st=async t=>{var e;const i=await fetch((e="https://hemfixare-lookup-dev.vercel.app/api")!==null&&e!==void 0?e:"https://hemfixare-lookup.vercel.app/api",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:t,hash:nt.MD5.generate(String.fromCharCode(83,101,67,82,101,116)+t)})});const r=await i.json();return r};const at=class{constructor(t){i(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 e=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 i=e.test(this.email);if(!i){this.emailError="Ange en giltig e-postadress"}const r=this.phone.length>6;if(!r){this.phoneError="Ange ett giltigt telefonnummer"}const n=Q.valid(this.ssn);if(!n){this.ssnError="Ange ett giltigt personnummer"}else if(n){const t=Q.parse(this.ssn).format(true);this.ssn=[t.slice(0,8),"-",t.slice(8)].join("")}if(i&&r&&n){try{const t=await st(this.ssn);if(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)}}};this.render=()=>r("form",{class:"mb-2",onSubmit:t=>this.handleSubmit(t)},r("div",null,r("input",{class:`${this.email.length?"input_active":""}`,onChange:t=>this.handleChangeEmail(t),type:"email",name:"email",value:this.email}),r("label",{htmlFor:"email"},"E-post ")),this.emailError&&r("span",null,this.emailError),r("div",null,r("input",{class:`${this.phone.length?"input_active":""}`,onChange:t=>this.handleChangePhone(t),type:"tel",name:"phone",value:this.phone}),r("label",{htmlFor:"phone"},"Mobiltelefon ")),this.phoneError&&r("span",null,this.phoneError),r("div",null,r("input",{class:`${this.ssn.length?"input_active":""}`,onChange:t=>this.handleChangessn(t),type:"tel",name:"ssn",value:this.ssn}),r("label",{htmlFor:"phone"},"Personnummer*")),this.ssnError&&r("span",null,this.ssnError),r("input",{type:"submit",value:"Fortsätt och Boka*"}),r("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}}};const ot=class{constructor(t){i(this,t);this.logo=n(`./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=n(`./assets/checked.svg`);return r("div",{class:"hemfixarna_info"},x.step<5?r(s,null,r("h2",null,"Vilka är Hemfixarna?"),r("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.")):r("h2",null,"Vad händer nu?"),r("ul",{class:"hemfixarna_features"},this.getList().map((e=>r("li",{key:e.trust_badge},r("img",{src:t,alt:"checked"}),r("p",null,e.trust_badge))))),r("img",{src:this.logo,width:200,alt:"hemfixarna"}),r("a",{class:"hemfixarna_product--link",target:"_blank",href:x.options.link.url},x.options.link.title))}};const lt=class{constructor(t){i(this,t);this.render=()=>r("div",{style:{background:`url(${x.options.thank_you_image})`},class:"hemfixarna_order"},r("div",null),r("div",null,r("h2",null,"Tack för din bokning"),r("hemfixarna-orderrows",{tree:this.tree,cart:false}),r("span",{onClick:()=>this.resetShop()},r("button",null,"Gör en ny bokning")),r("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 ht=class{constructor(t){i(this,t);this.cart=true;this.tree=undefined}goToProduct(t){const e=this.tree.sub_cats.map((t=>t.services)).flat();const i=e.map((t=>t.products)).flat();const r=i.find((e=>e.ID===t));const n=e.find((e=>e.products.find((e=>e.ID===t))));const s=this.tree.sub_cats.find((e=>e.services.find((e=>e.products.find((e=>e.ID===t))))));x.selectedCategory=s;x.selectedService=n;x.selectedProduct=r;x.step=4}openMontering(){x.modal={title:"Monteringsavgift",text:["Monteringsavgiften är en fast avgift som läggs på din beställning. Avgiften täcker kostnader för att montera produkterna du beställer.","Monteringsavgiften debiteras per påbörjat nytt uppdrag. Om du bokar ett uppdrag som både innehåller RUT- och ROT-avdrag så kommer uppdraget att delas upp och således kommer två monteringsavgifter att debiteras och två fakturor att utställas."]}}render(){const t=n(`./assets/info.svg`);return r(s,null,r("ul",{class:"hemfixarna_cart--items"},x.cart.map((t=>{var e;return r("li",{class:"hemfixarna_cart--item"},r("div",null,r("div",null,t.icon&&r("img",{width:30,src:(e=t.icon.url)!==null&&e!==void 0?e:t.icon,alt:t.name}),r("p",null,r("strong",null,t.amount,"x "),t.name)),this.cart&&r("button",{onClick:()=>this.goToProduct(t.id)},"Ändra")),r("p",null,r("strong",null,w(t,t.price,t.amount),"kr")),t.parts.length>0&&r("ul",null,t.parts.map((e=>r("li",null,r("p",null,r("strong",null,e.amount,"x "),e.name),r("p",null,r("strong",null,$(e,t,e.amount),"kr")))))))}))),r("div",{class:"hemfixarna_cart--additional"},C().length>0&&r("div",{class:"hemfixarna_cart--startfee"},r("p",null,C().length,"x"," ",r("strong",{onClick:()=>this.openMontering()},"Monteringsavgift",r("img",{height:16,src:t,alt:"info monteringsavgift"}))),r("p",null,C().rot+C().rut,"kr")),x.cart.find((t=>t.rot))&&r("div",{class:"hemfixarna_cart--rutrot"},r("div",null,this.cart&&r("label",{class:"switch"},r("input",{checked:x.rot,onChange:()=>x.rot=!x.rot,type:"checkbox"}),r("span",{class:"slider"})),r("p",null,"ROT-avdrag")),r("p",null,"(-",x.rot?z():0,"kr)")),x.cart.find((t=>t.rut))&&r("div",{class:"hemfixarna_cart--rutrot"},r("div",null,r("label",{class:"switch"},r("input",{onChange:()=>x.rut=!x.rut,checked:x.rut,type:"checkbox"}),r("span",{class:"slider"})),r("p",null,"RUT-avdrag")),r("p",null,"(-",x.rut?S():0,"kr)"))),r("div",{class:"hemfixarna_cart--price"},r("h2",null,"Totalbelopp: "),r("h2",null,j(),"kr")))}};const ct=class{constructor(t){i(this,t);this.amount=0}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.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){const e=x.cart.find((t=>t.id===x.selectedProduct.ID));if(e){const i=e.parts.find((e=>e.id===t.ID));if(i){i.amount++;e.parts=[...e.parts]}else{e.parts=[...e.parts,{id:t.ID,amount:1,price:t.price,name:t.post_title}]}x.cart=[...x.cart.filter((t=>t.id!==e.id)),e]}}removePart(t){const e=x.cart.find((t=>t.id===x.selectedProduct.ID));if(e){const i=e.parts.find((e=>e.id===t.ID));if(i&&i.amount>1){i.amount--;e.parts=[...e.parts]}else{e.parts=e.parts.filter((e=>e.id!==t.ID))}x.cart=[...x.cart.filter((t=>t.id!==e.id)),e]}}goToCart(){const t=x.cart.find((t=>t.id===x.selectedProduct.ID));if(t){x.step=5}}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 e;const i=x.cart.find((t=>t.id===x.selectedProduct.ID));return((e=i===null||i===void 0?void 0:i.parts.find((e=>e.id===t)))===null||e===void 0?void 0:e.amount)||0}getTotalPrice(){let t=0;const e=x.cart.find((t=>t.id===x.selectedProduct.ID));if(e){const i=e.parts.reduce(((t,e)=>{const i=x.selectedProduct.parts.find((t=>t.ID===e.id));if(i){return t+i.price*e.amount}return t}),0);t=x.selectedProduct.price*e.amount+i}else{t=x.selectedProduct.price}return w(x.selectedProduct,t)}render(){var t,e,i;const s=n(`./assets/checked.svg`);const a=n(`./assets/plus.svg`);const o=n(`./assets/minus.svg`);return r("div",{class:"hemfixarna_product"},r("div",{class:"hemfixarna_product--top"},x.selectedProduct.icon&&r("img",{width:80,src:(t=x.selectedProduct.icon.url)!==null&&t!==void 0?t:x.selectedProduct.icon,alt:x.selectedProduct.post_title}),r("div",null,r("h1",null,x.selectedProduct.post_title),r("h2",null,"Från: ",w(x.selectedProduct)," kr"))),r("div",{class:"hemfixarna_product--grid"},r("div",{class:"hemfixarna_product--left"},((e=x.selectedProduct.list)===null||e===void 0?void 0:e.length)&&r("ul",{class:"hemfixarna_features"},x.selectedProduct.list.map((t=>r("li",{key:t.bullet},r("img",{src:s,alt:"checked"}),r("p",null,t.bullet))))),r("p",{class:"hemfixarna_terms"},r("strong",null,"OBS! "),r("span",{innerHTML:x.selectedProduct.terms}))),r("div",{class:"hemfixarna_product--right"},r("ul",null,r("li",{class:"hemfixarna_product--item"},r("div",null,r("p",null,"Antal ",x.selectedProduct.post_title),r("p",{class:"hemfixarna_product--price"},w(x.selectedProduct),"kr/st")),r("div",{class:"hemfixarna_counter"},r("img",{class:`${this.getAmount()===0?"disabled":""}`,src:o,onClick:()=>this.removeProduct()}),r("span",null,this.getAmount()),r("img",{src:a,onClick:()=>this.addProduct()}))),((i=x.selectedProduct.parts)===null||i===void 0?void 0:i.length)&&x.selectedProduct.parts.map((t=>r("li",{class:"hemfixarna_part"},r("div",null,r("p",null,t.post_title),r("p",{class:"hemfixarna_product--price"},$(t,x.selectedProduct),"kr/st")),r("div",{class:"hemfixarna_counter"},r("img",{class:`${this.getPartAmount(t.ID)===0?"disabled":""}`,src:o,onClick:()=>this.removePart(t)}),r("span",null,this.getPartAmount(t.ID)),r("img",{class:`${this.getAmount()===0?"disabled":""}`,src:a,onClick:()=>this.addPart(t)})))))),r("h4",{class:"hemfixarna_product--total"},"Totalt ",this.getTotalPrice()," kr"),r("button",{onClick:()=>this.goToCart(),class:`hemfixarna_buy ${this.getAmount()===0?"disabled":""}`},"Boka"),x.options&&r("hemfixarna-info",{list:x.options.trust}))))}};const ut=class{constructor(t){i(this,t)}setSelectedProduct(t){x.selectedProduct=t;x.step=4}render(){return r("div",null,r("h2",null,x.selectedService.post_title),r("div",{class:"hemfixarna_categories--wrapper"},r("div",null,r("ul",{class:"hemfixarna_categories"},x.selectedService.products.sort(((t,e)=>t.post_title<e.post_title?-1:1)).map((t=>{var e;return r("hemfixarna-box",{post:t,icon:(e=t.icon.url)!==null&&e!==void 0?e:t.icon,postTitle:t.post_title})})))),r("hemfixarna-info",{list:x.options.trust})))}};const dt=class{constructor(t){i(this,t);this.tree=undefined}render(){return r("div",null,r("h2",null,"Alla tjänster"),r("div",{class:"hemfixarna_categories--wrapper"},r("ul",{class:"hemfixarna_categories"},this.tree.sub_cats.sort(((t,e)=>t.name<e.name?-1:1)).map((t=>{var e;return r("hemfixarna-box",{post:t,icon:(e=t.icon.url)!==null&&e!==void 0?e:t.icon,postTitle:t.name})}))),r("hemfixarna-info",{list:x.options.trust})))}};export{v as hemfixarna_address,O as hemfixarna_box,M as hemfixarna_breadcrumbs,L as hemfixarna_byggmax,P as hemfixarna_cart,R as hemfixarna_category,E as hemfixarna_checkout,W as hemfixarna_component,V as hemfixarna_demo,at as hemfixarna_getuser,ot as hemfixarna_info,lt as hemfixarna_order,ht as hemfixarna_orderrows,ct as hemfixarna_product,ut as hemfixarna_service,dt as hemfixarna_start};
2
+ //# sourceMappingURL=p-c05e2af1.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":[],"mappings":""}
@@ -0,0 +1 @@
1
+ module.exports = require('./cjs/index.cjs.js');
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from './esm/index.js';
@@ -5,6 +5,7 @@ export declare class HemfixarnaAddress {
5
5
  zipError: string | null;
6
6
  town: string;
7
7
  townError: string | null;
8
+ componentWillLoad(): void;
8
9
  handleSubmit: (e: Event) => void;
9
10
  handleChangeStreet: (e: Event) => void;
10
11
  handleChangeZip: (e: Event) => void;
@@ -1,13 +1,5 @@
1
- import { CartItem, Category } from '../../types';
1
+ import { Category } from '../../types';
2
2
  export declare class HemfixarnaCart {
3
3
  tree: Category;
4
- getItemPrice(item: CartItem): number;
5
- getTotalPrice(): number;
6
- goToProduct(id: number): void;
7
- toggleRot(): void;
8
- toggleRut(): void;
9
- calculateRot(): number;
10
- calculateRut(): number;
11
- openMontering(): void;
12
4
  render(): any;
13
5
  }
@@ -1,10 +1,12 @@
1
1
  export declare class HemfixarnaCheckout {
2
2
  date: string;
3
3
  dateError: string | null;
4
- termsError: string | null;
4
+ generalError: string | null;
5
5
  private el;
6
6
  handleChangeDate: (e: Event) => void;
7
7
  handleChangeTerms: () => void;
8
+ sendOrder: () => Promise<void>;
8
9
  handleSubmit: (e: Event) => void;
10
+ componentWillLoad(): void;
9
11
  render: () => any;
10
12
  }
@@ -9,6 +9,6 @@ export declare class HemfixarnaGetuser {
9
9
  handleChangeEmail: (e: Event) => void;
10
10
  handleChangePhone: (e: Event) => void;
11
11
  handleChangessn: (e: Event) => void;
12
- handleSubmit: (e: Event) => void;
12
+ handleSubmit: (e: Event) => Promise<void>;
13
13
  render: () => any;
14
14
  }
@@ -1,4 +1,7 @@
1
+ import { Category } from '../../types';
1
2
  export declare class HemfixarnaOrder {
3
+ tree: Category;
2
4
  resetShop(): void;
5
+ disconnectedCallback(): void;
3
6
  render: () => any;
4
7
  }
@@ -0,0 +1,8 @@
1
+ import { Category } from '../../types';
2
+ export declare class HemfixarnaOrderrows {
3
+ cart: boolean;
4
+ tree: Category;
5
+ goToProduct(id: number): void;
6
+ openMontering(): void;
7
+ render(): any;
8
+ }
@@ -42,6 +42,11 @@ export namespace Components {
42
42
  "list"?: { trust_badge: string }[];
43
43
  }
44
44
  interface HemfixarnaOrder {
45
+ "tree": Category;
46
+ }
47
+ interface HemfixarnaOrderrows {
48
+ "cart": boolean;
49
+ "tree": Category;
45
50
  }
46
51
  interface HemfixarnaProduct {
47
52
  }
@@ -124,6 +129,12 @@ declare global {
124
129
  prototype: HTMLHemfixarnaOrderElement;
125
130
  new (): HTMLHemfixarnaOrderElement;
126
131
  };
132
+ interface HTMLHemfixarnaOrderrowsElement extends Components.HemfixarnaOrderrows, HTMLStencilElement {
133
+ }
134
+ var HTMLHemfixarnaOrderrowsElement: {
135
+ prototype: HTMLHemfixarnaOrderrowsElement;
136
+ new (): HTMLHemfixarnaOrderrowsElement;
137
+ };
127
138
  interface HTMLHemfixarnaProductElement extends Components.HemfixarnaProduct, HTMLStencilElement {
128
139
  }
129
140
  var HTMLHemfixarnaProductElement: {
@@ -155,6 +166,7 @@ declare global {
155
166
  "hemfixarna-getuser": HTMLHemfixarnaGetuserElement;
156
167
  "hemfixarna-info": HTMLHemfixarnaInfoElement;
157
168
  "hemfixarna-order": HTMLHemfixarnaOrderElement;
169
+ "hemfixarna-orderrows": HTMLHemfixarnaOrderrowsElement;
158
170
  "hemfixarna-product": HTMLHemfixarnaProductElement;
159
171
  "hemfixarna-service": HTMLHemfixarnaServiceElement;
160
172
  "hemfixarna-start": HTMLHemfixarnaStartElement;
@@ -195,6 +207,11 @@ declare namespace LocalJSX {
195
207
  "list"?: { trust_badge: string }[];
196
208
  }
197
209
  interface HemfixarnaOrder {
210
+ "tree"?: Category;
211
+ }
212
+ interface HemfixarnaOrderrows {
213
+ "cart"?: boolean;
214
+ "tree"?: Category;
198
215
  }
199
216
  interface HemfixarnaProduct {
200
217
  }
@@ -216,6 +233,7 @@ declare namespace LocalJSX {
216
233
  "hemfixarna-getuser": HemfixarnaGetuser;
217
234
  "hemfixarna-info": HemfixarnaInfo;
218
235
  "hemfixarna-order": HemfixarnaOrder;
236
+ "hemfixarna-orderrows": HemfixarnaOrderrows;
219
237
  "hemfixarna-product": HemfixarnaProduct;
220
238
  "hemfixarna-service": HemfixarnaService;
221
239
  "hemfixarna-start": HemfixarnaStart;
@@ -237,6 +255,7 @@ declare module "@stencil/core" {
237
255
  "hemfixarna-getuser": LocalJSX.HemfixarnaGetuser & JSXBase.HTMLAttributes<HTMLHemfixarnaGetuserElement>;
238
256
  "hemfixarna-info": LocalJSX.HemfixarnaInfo & JSXBase.HTMLAttributes<HTMLHemfixarnaInfoElement>;
239
257
  "hemfixarna-order": LocalJSX.HemfixarnaOrder & JSXBase.HTMLAttributes<HTMLHemfixarnaOrderElement>;
258
+ "hemfixarna-orderrows": LocalJSX.HemfixarnaOrderrows & JSXBase.HTMLAttributes<HTMLHemfixarnaOrderrowsElement>;
240
259
  "hemfixarna-product": LocalJSX.HemfixarnaProduct & JSXBase.HTMLAttributes<HTMLHemfixarnaProductElement>;
241
260
  "hemfixarna-service": LocalJSX.HemfixarnaService & JSXBase.HTMLAttributes<HTMLHemfixarnaServiceElement>;
242
261
  "hemfixarna-start": LocalJSX.HemfixarnaStart & JSXBase.HTMLAttributes<HTMLHemfixarnaStartElement>;
@@ -1,4 +1,4 @@
1
- import { Business, CartItem, Category, Product, Service, WpOptions } from '../types';
1
+ import { Business, CartItem, Category, Product, Service, User, WpOptions } from '../types';
2
2
  type StateType = {
3
3
  step: number;
4
4
  selectedCategory: Category | null;
@@ -12,11 +12,7 @@ type StateType = {
12
12
  token: string | null;
13
13
  checkoutStep: number;
14
14
  checkoutEdit: boolean;
15
- user: {
16
- email: string;
17
- phone: string;
18
- ssn: string;
19
- } | null;
15
+ user: User | null;
20
16
  modal: {
21
17
  title: string;
22
18
  text: string[];
@@ -1,3 +1,6 @@
1
+ type Icon = {
2
+ url: string;
3
+ };
1
4
  interface Part {
2
5
  ID: number;
3
6
  post_author: number;
@@ -51,7 +54,7 @@ interface Product {
51
54
  comment_count: 0;
52
55
  filter: string;
53
56
  price: number;
54
- icon?: string;
57
+ icon?: Icon | string;
55
58
  parts?: Array<Part>;
56
59
  list: Array<{
57
60
  bullet: string;
@@ -65,9 +68,7 @@ interface Product {
65
68
  }
66
69
  interface Service {
67
70
  ID: 41857;
68
- icon?: {
69
- url: string;
70
- };
71
+ icon?: Icon | string;
71
72
  post_author: 34419;
72
73
  post_date: Date;
73
74
  post_date_gmt: Date;
@@ -97,7 +98,7 @@ interface Category {
97
98
  count: number;
98
99
  description: string;
99
100
  name: string;
100
- icon?: string;
101
+ icon?: Icon | string;
101
102
  parent: 0 | 1;
102
103
  slug: string;
103
104
  taxonomy: 'service_cat';
@@ -137,7 +138,7 @@ interface CartItem {
137
138
  start_fee: boolean;
138
139
  terms_checkout: string;
139
140
  terms_show_checkbox: boolean;
140
- icon?: string;
141
+ icon?: Icon | string;
141
142
  }
142
143
  export declare enum Business {
143
144
  byggmax = "byggmax"
@@ -145,4 +146,14 @@ export declare enum Business {
145
146
  export declare enum TopCategory {
146
147
  byggmax = "category/bygg"
147
148
  }
148
- export type { Category, Product, Service, Part, WpOptions, CartItem, CartPart };
149
+ interface User {
150
+ email: string;
151
+ phone: string;
152
+ ssn: string;
153
+ firstName?: string;
154
+ lastName?: string;
155
+ street?: string;
156
+ zip?: string;
157
+ town?: string;
158
+ }
159
+ export type { User, Category, Product, Service, Part, WpOptions, CartItem, CartPart, Icon };
@@ -1,4 +1,22 @@
1
- import { WpOptions } from '../types';
1
+ import { Business, WpOptions } from '../types';
2
2
  declare const getTaxonomy: (endpoint: string) => Promise<any>;
3
3
  declare const getOptions: () => Promise<WpOptions>;
4
- export { getTaxonomy, getOptions };
4
+ export interface PostOrderData {
5
+ name: string;
6
+ customer: Business;
7
+ phone: string;
8
+ social_security_number: string;
9
+ email: string;
10
+ address: string;
11
+ earliest_visit_date: string;
12
+ order_items: string;
13
+ start_fee: string;
14
+ total: number;
15
+ }
16
+ declare const postOrder: (data: PostOrderData) => Promise<{
17
+ message: string;
18
+ post_id: number;
19
+ data: PostOrderData;
20
+ status?: number;
21
+ }>;
22
+ export { getTaxonomy, getOptions, postOrder };
@@ -15,4 +15,8 @@ declare const getStartFee: () => {
15
15
  rot: number;
16
16
  length: number;
17
17
  };
18
- export { getProductPriceWithRotAndRut, getProductPrice, getRotPrice, getRutPrice, getRotStartFee, getRutStartFee, getPartPrice, getStartFee };
18
+ declare const getItemPrice: (item: CartItem) => number;
19
+ declare const calculateRot: () => number;
20
+ declare const calculateRut: () => number;
21
+ declare const getTotalPrice: () => number;
22
+ export { getProductPriceWithRotAndRut, getProductPrice, getRotPrice, getRutPrice, getRotStartFee, getRutStartFee, getPartPrice, getStartFee, calculateRot, calculateRut, getItemPrice, getTotalPrice, };
@@ -0,0 +1,3 @@
1
+ import { User } from '../types';
2
+ declare const apiSearch: (query: string) => Promise<Partial<User>>;
3
+ export default apiSearch;
@@ -0,0 +1,2 @@
1
+ declare const hideField: (field: string) => string;
2
+ export { hideField };