hemfixarna-web-components 1.7.3 → 1.8.1
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.
- package/dist/cjs/hemfixarna-address_15.cjs.entry.js +118 -53
- package/dist/cjs/hemfixarna-address_15.cjs.entry.js.map +1 -1
- package/dist/cjs/hemfixarna-byggmax.cjs.entry.js +2 -2
- package/dist/cjs/hemfixarna-category.cjs.entry.js +2 -2
- package/dist/cjs/hemfixarna-components.cjs.js +2 -2
- package/dist/cjs/hemfixarna-components.cjs.js.map +1 -1
- package/dist/cjs/hemfixarna-doro.cjs.entry.js +2 -2
- package/dist/cjs/hemfixarna-elfa.cjs.entry.js +2 -2
- package/dist/cjs/hemfixarna-fargvaruhuset.cjs.entry.js +2 -2
- package/dist/cjs/hemfixarna-flyttsmart.cjs.entry.js +2 -2
- package/dist/cjs/hemfixarna-forebygg.cjs.entry.js +2 -2
- package/dist/cjs/hemfixarna-hornbach.cjs.entry.js +2 -2
- package/dist/cjs/hemfixarna-kbygg.cjs.entry.js +2 -2
- package/dist/cjs/hemfixarna-klint.cjs.entry.js +2 -2
- package/dist/cjs/hemfixarna-kund.cjs.entry.js +2 -2
- package/dist/cjs/hemfixarna-norrgavel.cjs.entry.js +2 -2
- package/dist/cjs/hemfixarna-power.cjs.entry.js +2 -2
- package/dist/cjs/hemfixarna-service.cjs.entry.js +2 -2
- package/dist/cjs/hemfixarna-skanska.cjs.entry.js +2 -2
- package/dist/cjs/hemfixarna-sparfonster.cjs.entry.js +2 -2
- package/dist/cjs/hemfixarna-string-furniture.cjs.entry.js +2 -2
- package/dist/cjs/hemfixarna-superfront.cjs.entry.js +2 -2
- package/dist/cjs/hemfixarna-tesla.cjs.entry.js +2 -2
- package/dist/cjs/hemfixarna-traningspartner.cjs.entry.js +2 -2
- package/dist/cjs/hemfixarna-zaptec.cjs.entry.js +2 -2
- package/dist/cjs/{index-6af772cf.js → index-3e8dcb29.js} +2 -2
- package/dist/cjs/{index-6af772cf.js.map → index-3e8dcb29.js.map} +1 -1
- package/dist/cjs/{index-8054ce93.js → index-739bf321.js} +3 -1
- package/dist/cjs/index-739bf321.js.map +1 -0
- package/dist/cjs/{index-b83343b9.js → index-e6926623.js} +74 -20
- package/dist/cjs/index-e6926623.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/loader.cjs.js.map +1 -1
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/hemfixarna-checkout/hemfixarna-checkout.js +19 -3
- package/dist/collection/components/hemfixarna-checkout/hemfixarna-checkout.js.map +1 -1
- package/dist/collection/components/hemfixarna-component/hemfixarna-component.js +11 -1
- package/dist/collection/components/hemfixarna-component/hemfixarna-component.js.map +1 -1
- package/dist/collection/components/hemfixarna-component/hemfixarna.css +17 -7
- package/dist/collection/components/hemfixarna-invoice/hemfixarna-invoice.js +2 -1
- package/dist/collection/components/hemfixarna-invoice/hemfixarna-invoice.js.map +1 -1
- package/dist/collection/components/hemfixarna-orderrows/hemfixarna-orderrows.js +30 -20
- package/dist/collection/components/hemfixarna-orderrows/hemfixarna-orderrows.js.map +1 -1
- package/dist/collection/components/hemfixarna-product/hemfixarna-product.js +3 -2
- package/dist/collection/components/hemfixarna-product/hemfixarna-product.js.map +1 -1
- package/dist/collection/store/index.js.map +1 -1
- package/dist/collection/types/index.js +2 -0
- package/dist/collection/types/index.js.map +1 -1
- package/dist/collection/utils/calc.js +52 -5
- package/dist/collection/utils/calc.js.map +1 -1
- package/dist/collection/utils/felixApi.js.map +1 -1
- package/dist/esm/hemfixarna-address_15.entry.js +118 -53
- package/dist/esm/hemfixarna-address_15.entry.js.map +1 -1
- package/dist/esm/hemfixarna-byggmax.entry.js +2 -2
- package/dist/esm/hemfixarna-category.entry.js +2 -2
- package/dist/esm/hemfixarna-components.js +3 -3
- package/dist/esm/hemfixarna-components.js.map +1 -1
- package/dist/esm/hemfixarna-doro.entry.js +2 -2
- package/dist/esm/hemfixarna-elfa.entry.js +2 -2
- package/dist/esm/hemfixarna-fargvaruhuset.entry.js +2 -2
- package/dist/esm/hemfixarna-flyttsmart.entry.js +2 -2
- package/dist/esm/hemfixarna-forebygg.entry.js +2 -2
- package/dist/esm/hemfixarna-hornbach.entry.js +2 -2
- package/dist/esm/hemfixarna-kbygg.entry.js +2 -2
- package/dist/esm/hemfixarna-klint.entry.js +2 -2
- package/dist/esm/hemfixarna-kund.entry.js +2 -2
- package/dist/esm/hemfixarna-norrgavel.entry.js +2 -2
- package/dist/esm/hemfixarna-power.entry.js +2 -2
- package/dist/esm/hemfixarna-service.entry.js +2 -2
- package/dist/esm/hemfixarna-skanska.entry.js +2 -2
- package/dist/esm/hemfixarna-sparfonster.entry.js +2 -2
- package/dist/esm/hemfixarna-string-furniture.entry.js +2 -2
- package/dist/esm/hemfixarna-superfront.entry.js +2 -2
- package/dist/esm/hemfixarna-tesla.entry.js +2 -2
- package/dist/esm/hemfixarna-traningspartner.entry.js +2 -2
- package/dist/esm/hemfixarna-zaptec.entry.js +2 -2
- package/dist/esm/{index-8282f88e.js → index-aa51ad9d.js} +2 -2
- package/dist/esm/{index-8282f88e.js.map → index-aa51ad9d.js.map} +1 -1
- package/dist/esm/{index-1fbc7a74.js → index-c8aebf0d.js} +3 -1
- package/dist/esm/index-c8aebf0d.js.map +1 -0
- package/dist/esm/{index-04bcf90e.js → index-ea1d222e.js} +74 -20
- package/dist/esm/index-ea1d222e.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/loader.js.map +1 -1
- package/dist/hemfixarna-components/hemfixarna-components.esm.js +1 -1
- package/dist/hemfixarna-components/hemfixarna-components.esm.js.map +1 -1
- package/dist/hemfixarna-components/{p-cb1634e8.entry.js → p-3a05b24c.entry.js} +2 -2
- package/dist/hemfixarna-components/{p-3acd1346.entry.js → p-3b6bf910.entry.js} +2 -2
- package/dist/hemfixarna-components/{p-b397b966.js → p-642db21e.js} +2 -2
- package/dist/hemfixarna-components/{p-b397b966.js.map → p-642db21e.js.map} +1 -1
- package/dist/hemfixarna-components/p-6aed6e88.entry.js +2 -0
- package/dist/hemfixarna-components/p-6aed6e88.entry.js.map +1 -0
- package/dist/hemfixarna-components/{p-1b80999e.entry.js → p-6d17838c.entry.js} +2 -2
- package/dist/hemfixarna-components/{p-8d509bf1.entry.js → p-76cec215.entry.js} +2 -2
- package/dist/hemfixarna-components/{p-1f875c7a.entry.js → p-7bdc4485.entry.js} +2 -2
- package/dist/hemfixarna-components/{p-6f6601b8.entry.js → p-7f5b7e4d.entry.js} +2 -2
- package/dist/hemfixarna-components/p-85caa0b1.entry.js +2 -0
- package/dist/hemfixarna-components/p-89e35a2b.entry.js +2 -0
- package/dist/hemfixarna-components/{p-61b4597f.entry.js → p-a64997e6.entry.js} +2 -2
- package/dist/hemfixarna-components/{p-8cc96dd9.entry.js → p-a66f910f.entry.js} +2 -2
- package/dist/hemfixarna-components/{p-e0aad0ff.entry.js → p-ae532b1e.entry.js} +2 -2
- package/dist/hemfixarna-components/p-b250a909.entry.js +2 -0
- package/dist/hemfixarna-components/p-c707b937.js +3 -0
- package/dist/hemfixarna-components/p-c707b937.js.map +1 -0
- package/dist/hemfixarna-components/{p-8356796a.entry.js → p-c7a68aec.entry.js} +2 -2
- package/dist/hemfixarna-components/{p-edac9f21.entry.js → p-d26af1b1.entry.js} +2 -2
- package/dist/hemfixarna-components/{p-cfdc93e9.js → p-d297cb30.js} +2 -2
- package/dist/hemfixarna-components/p-d297cb30.js.map +1 -0
- package/dist/hemfixarna-components/{p-a63a6a56.entry.js → p-d96ab852.entry.js} +2 -2
- package/dist/hemfixarna-components/{p-dabad8a7.entry.js → p-e0c54744.entry.js} +2 -2
- package/dist/hemfixarna-components/p-e2c0ddb1.entry.js +2 -0
- package/dist/hemfixarna-components/{p-e8800c3b.entry.js → p-e2cd711c.entry.js} +2 -2
- package/dist/hemfixarna-components/p-e63f00b7.entry.js +2 -0
- package/dist/hemfixarna-components/{p-6c1d21dd.entry.js → p-eabbb263.entry.js} +2 -2
- package/dist/hemfixarna-components/p-fcb4a599.entry.js +2 -0
- package/dist/types/components/hemfixarna-orderrows/hemfixarna-orderrows.d.ts +2 -3
- package/dist/types/stencil-public-runtime.d.ts +3 -0
- package/dist/types/store/index.d.ts +1 -1
- package/dist/types/types/index.d.ts +15 -3
- package/dist/types/utils/calc.d.ts +9 -1
- package/dist/types/utils/felixApi.d.ts +7 -0
- package/package.json +1 -1
- package/dist/cjs/index-8054ce93.js.map +0 -1
- package/dist/cjs/index-b83343b9.js.map +0 -1
- package/dist/esm/index-04bcf90e.js.map +0 -1
- package/dist/esm/index-1fbc7a74.js.map +0 -1
- package/dist/hemfixarna-components/p-32a8152b.js +0 -3
- package/dist/hemfixarna-components/p-32a8152b.js.map +0 -1
- package/dist/hemfixarna-components/p-53afbc10.entry.js +0 -2
- package/dist/hemfixarna-components/p-53f0abfa.entry.js +0 -2
- package/dist/hemfixarna-components/p-8f0a688c.entry.js +0 -2
- package/dist/hemfixarna-components/p-ae3fc85c.entry.js +0 -2
- package/dist/hemfixarna-components/p-b6bc1537.entry.js +0 -2
- package/dist/hemfixarna-components/p-cfdc93e9.js.map +0 -1
- package/dist/hemfixarna-components/p-dfcefa54.entry.js +0 -2
- package/dist/hemfixarna-components/p-fb43b148.entry.js +0 -2
- package/dist/hemfixarna-components/p-fb43b148.entry.js.map +0 -1
- /package/dist/hemfixarna-components/{p-cb1634e8.entry.js.map → p-3a05b24c.entry.js.map} +0 -0
- /package/dist/hemfixarna-components/{p-3acd1346.entry.js.map → p-3b6bf910.entry.js.map} +0 -0
- /package/dist/hemfixarna-components/{p-1b80999e.entry.js.map → p-6d17838c.entry.js.map} +0 -0
- /package/dist/hemfixarna-components/{p-8d509bf1.entry.js.map → p-76cec215.entry.js.map} +0 -0
- /package/dist/hemfixarna-components/{p-1f875c7a.entry.js.map → p-7bdc4485.entry.js.map} +0 -0
- /package/dist/hemfixarna-components/{p-6f6601b8.entry.js.map → p-7f5b7e4d.entry.js.map} +0 -0
- /package/dist/hemfixarna-components/{p-8f0a688c.entry.js.map → p-85caa0b1.entry.js.map} +0 -0
- /package/dist/hemfixarna-components/{p-dfcefa54.entry.js.map → p-89e35a2b.entry.js.map} +0 -0
- /package/dist/hemfixarna-components/{p-61b4597f.entry.js.map → p-a64997e6.entry.js.map} +0 -0
- /package/dist/hemfixarna-components/{p-8cc96dd9.entry.js.map → p-a66f910f.entry.js.map} +0 -0
- /package/dist/hemfixarna-components/{p-e0aad0ff.entry.js.map → p-ae532b1e.entry.js.map} +0 -0
- /package/dist/hemfixarna-components/{p-b6bc1537.entry.js.map → p-b250a909.entry.js.map} +0 -0
- /package/dist/hemfixarna-components/{p-8356796a.entry.js.map → p-c7a68aec.entry.js.map} +0 -0
- /package/dist/hemfixarna-components/{p-edac9f21.entry.js.map → p-d26af1b1.entry.js.map} +0 -0
- /package/dist/hemfixarna-components/{p-a63a6a56.entry.js.map → p-d96ab852.entry.js.map} +0 -0
- /package/dist/hemfixarna-components/{p-dabad8a7.entry.js.map → p-e0c54744.entry.js.map} +0 -0
- /package/dist/hemfixarna-components/{p-53afbc10.entry.js.map → p-e2c0ddb1.entry.js.map} +0 -0
- /package/dist/hemfixarna-components/{p-e8800c3b.entry.js.map → p-e2cd711c.entry.js.map} +0 -0
- /package/dist/hemfixarna-components/{p-ae3fc85c.entry.js.map → p-e63f00b7.entry.js.map} +0 -0
- /package/dist/hemfixarna-components/{p-6c1d21dd.entry.js.map → p-eabbb263.entry.js.map} +0 -0
- /package/dist/hemfixarna-components/{p-53f0abfa.entry.js.map → p-fcb4a599.entry.js.map} +0 -0
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["patchBrowser","importMeta","url","opts","resourcesUrl","URL","href","promiseResolve","then","options","bootstrapLazy","selectedSlug","selectedID","tooltipText","tree","customer","widgetStyle","buttonBg","buttonColor","partner","colorAccessibility","loggedIn","loginError","id","slug","business","modal","showModal","product","proppedProduct","loginSourceError","amount","hideDescription","closeModal","date","dateError","generalError","loading","enteredPin","selectedSubSource","partnerOrderId","sellerID","RefferalID","vertical","formError","displayImages","formImages","formState","street","streetError","zip","zipError","town","townError","email","emailError","phone","phoneError","ssn","ssnError","cart","post","category","icon","postTitle","loadFromQuery"],"sources":["./node_modules/@stencil/core/internal/client/patch-browser.js","@lazy-browser-entrypoint?app-data=conditional"],"sourcesContent":["/*\n Stencil Client Patch Browser v3.2.1 | MIT Licensed | https://stenciljs.com\n */\nimport { BUILD, NAMESPACE } from '@stencil/core/internal/app-data';\nimport { consoleDevInfo, plt, win, doc, promiseResolve, H } from '@stencil/core';\n/**\n * Helper method for querying a `meta` tag that contains a nonce value\n * out of a DOM's head.\n *\n * @param doc The DOM containing the `head` to query against\n * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag\n * exists or the tag has no content.\n */\nfunction queryNonceMetaTagContent(doc) {\n var _a, _b, _c;\n 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;\n}\n// TODO(STENCIL-661): Remove code related to the dynamic import shim\nconst getDynamicImportFunction = (namespace) => `__sc_import_${namespace.replace(/\\s|-/g, '_')}`;\nconst patchBrowser = () => {\n // NOTE!! This fn cannot use async/await!\n if (BUILD.isDev && !BUILD.isTesting) {\n consoleDevInfo('Running in development mode.');\n }\n // TODO(STENCIL-659): Remove code implementing the CSS variable shim\n if (BUILD.cssVarShim) {\n // shim css vars\n // TODO(STENCIL-659): Remove code implementing the CSS variable shim\n plt.$cssShim$ = win.__cssshim;\n }\n if (BUILD.cloneNodeFix) {\n // opted-in to polyfill cloneNode() for slot polyfilled components\n patchCloneNodeFix(H.prototype);\n }\n if (BUILD.profile && !performance.mark) {\n // not all browsers support performance.mark/measure (Safari 10)\n // because the mark/measure APIs are designed to write entries to a buffer in the browser that does not exist,\n // simply stub the implementations out.\n // TODO(STENCIL-323): Remove this patch when support for older browsers is removed (breaking)\n // @ts-ignore\n performance.mark = performance.measure = () => {\n /*noop*/\n };\n performance.getEntriesByName = () => [];\n }\n // @ts-ignore\n const scriptElm = \n // TODO(STENCIL-661): Remove code related to the dynamic import shim\n // TODO(STENCIL-663): Remove code related to deprecated `safari10` field.\n BUILD.scriptDataOpts || BUILD.safari10 || BUILD.dynamicImportShim\n ? Array.from(doc.querySelectorAll('script')).find((s) => new RegExp(`\\/${NAMESPACE}(\\\\.esm)?\\\\.js($|\\\\?|#)`).test(s.src) ||\n s.getAttribute('data-stencil-namespace') === NAMESPACE)\n : null;\n const importMeta = import.meta.url;\n const opts = BUILD.scriptDataOpts ? (scriptElm || {})['data-opts'] || {} : {};\n // TODO(STENCIL-663): Remove code related to deprecated `safari10` field.\n if (BUILD.safari10 && 'onbeforeload' in scriptElm && !history.scrollRestoration /* IS_ESM_BUILD */) {\n // Safari < v11 support: This IF is true if it's Safari below v11.\n // This fn cannot use async/await since Safari didn't support it until v11,\n // however, Safari 10 did support modules. Safari 10 also didn't support \"nomodule\",\n // so both the ESM file and nomodule file would get downloaded. Only Safari\n // has 'onbeforeload' in the script, and \"history.scrollRestoration\" was added\n // to Safari in v11. Return a noop then() so the async/await ESM code doesn't continue.\n // IS_ESM_BUILD is replaced at build time so this check doesn't happen in systemjs builds.\n return {\n then() {\n /* promise noop */\n },\n };\n }\n // TODO(STENCIL-663): Remove code related to deprecated `safari10` field.\n if (!BUILD.safari10 && importMeta !== '') {\n opts.resourcesUrl = new URL('.', importMeta).href;\n // TODO(STENCIL-661): Remove code related to the dynamic import shim\n // TODO(STENCIL-663): Remove code related to deprecated `safari10` field.\n }\n else if (BUILD.dynamicImportShim || BUILD.safari10) {\n opts.resourcesUrl = new URL('.', new URL(scriptElm.getAttribute('data-resources-url') || scriptElm.src, win.location.href)).href;\n // TODO(STENCIL-661): Remove code related to the dynamic import shim\n if (BUILD.dynamicImportShim) {\n patchDynamicImport(opts.resourcesUrl, scriptElm);\n }\n // TODO(STENCIL-661): Remove code related to the dynamic import shim\n if (BUILD.dynamicImportShim && !win.customElements) {\n // module support, but no custom elements support (Old Edge)\n // @ts-ignore\n return import(/* webpackChunkName: \"polyfills-dom\" */ './dom.js').then(() => opts);\n }\n }\n return promiseResolve(opts);\n};\n// TODO(STENCIL-661): Remove code related to the dynamic import shim\nconst patchDynamicImport = (base, orgScriptElm) => {\n const importFunctionName = getDynamicImportFunction(NAMESPACE);\n try {\n // test if this browser supports dynamic imports\n // There is a caching issue in V8, that breaks using import() in Function\n // By generating a random string, we can workaround it\n // Check https://bugs.chromium.org/p/chromium/issues/detail?id=990810 for more info\n win[importFunctionName] = new Function('w', `return import(w);//${Math.random()}`);\n }\n catch (e) {\n // this shim is specifically for browsers that do support \"esm\" imports\n // however, they do NOT support \"dynamic\" imports\n // basically this code is for old Edge, v18 and below\n const moduleMap = new Map();\n win[importFunctionName] = (src) => {\n var _a;\n const url = new URL(src, base).href;\n let mod = moduleMap.get(url);\n if (!mod) {\n const script = doc.createElement('script');\n script.type = 'module';\n script.crossOrigin = orgScriptElm.crossOrigin;\n script.src = URL.createObjectURL(new Blob([`import * as m from '${url}'; window.${importFunctionName}.m = m;`], {\n type: 'application/javascript',\n }));\n // Apply CSP nonce to the script tag if it exists\n const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);\n if (nonce != null) {\n script.setAttribute('nonce', nonce);\n }\n mod = new Promise((resolve) => {\n script.onload = () => {\n resolve(win[importFunctionName].m);\n script.remove();\n };\n });\n moduleMap.set(url, mod);\n doc.head.appendChild(script);\n }\n return mod;\n };\n }\n};\nconst patchCloneNodeFix = (HTMLElementPrototype) => {\n const nativeCloneNodeFn = HTMLElementPrototype.cloneNode;\n HTMLElementPrototype.cloneNode = function (deep) {\n if (this.nodeName === 'TEMPLATE') {\n return nativeCloneNodeFn.call(this, deep);\n }\n const clonedNode = nativeCloneNodeFn.call(this, false);\n const srcChildNodes = this.childNodes;\n if (deep) {\n for (let i = 0; i < srcChildNodes.length; i++) {\n // Node.ATTRIBUTE_NODE === 2, and checking because IE11\n if (srcChildNodes[i].nodeType !== 2) {\n clonedNode.appendChild(srcChildNodes[i].cloneNode(true));\n }\n }\n }\n return clonedNode;\n };\n};\nexport { patchBrowser };\n","export { setNonce } from '@stencil/core';\nimport { bootstrapLazy } from '@stencil/core';\nimport { patchBrowser } from '@stencil/core/internal/client/patch-browser';\nimport { globalScripts } from '@stencil/core/internal/app-globals';\npatchBrowser().then(options => {\n globalScripts();\n return bootstrapLazy([/*!__STENCIL_LAZY_DATA__*/], options);\n});\n"],"mappings":"sFAmBA,MAAMA,EAAe,KAkCjB,MAAMC,cAAyBC,IAC/B,MAAMC,EAAqE,GAiB3E,GAAuBF,IAAe,GAAI,CACtCE,EAAKC,aAAe,IAAIC,IAAI,IAAKJ,GAAYK,IAGrD,CAcI,OAAOC,EAAeJ,EAAK,ECrF/BH,IAAeQ,MAAKC,GAEXC,EAAc,qCAAqC,CAACC,aAAC,KAAAC,WAAA,KAAAC,YAAA,KAAAC,KAAA,KAAAC,SAAA,KAAAC,YAAA,KAAAC,SAAA,KAAAC,YAAA,KAAAC,QAAA,KAAAC,mBAAA,KAAAC,SAAA,KAAAC,WAAA,kCAAAC,GAAA,IAAAC,KAAA,IAAAC,SAAA,IAAAT,YAAA,mBAAAE,YAAA,mBAAAD,SAAA,gBAAAS,MAAA,KAAAC,UAAA,KAAAC,QAAA,KAAAC,eAAA,KAAAC,iBAAA,yGAAAC,OAAA,KAAAC,gBAAA,8BAAAlB,KAAA,KAAAU,KAAA,mCAAAS,WAAA,iCAAAC,KAAA,KAAAC,UAAA,KAAAC,aAAA,KAAAC,QAAA,KAAAC,WAAA,KAAAC,kBAAA,KAAAC,eAAA,KAAAC,SAAA,KAAAC,WAAA,gCAAAC,SAAA,+BAAAC,UAAA,KAAAC,cAAA,KAAAC,WAAA,KAAAC,UAAA,gCAAAC,OAAA,KAAAC,YAAA,KAAAC,IAAA,KAAAC,SAAA,KAAAC,KAAA,KAAA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AA,mBAAAE,YAAA,mBAAAD,SAAA,0GAAAR"}
|
1
|
+
{"version":3,"names":["patchBrowser","importMeta","url","opts","resourcesUrl","URL","href","promiseResolve","then","options","bootstrapLazy","selectedSlug","selectedID","tooltipText","tree","customer","widgetStyle","buttonBg","buttonColor","partner","colorAccessibility","loggedIn","loginError","id","slug","business","modal","showModal","product","proppedProduct","loginSourceError","amount","hideDescription","closeModal","date","dateError","generalError","loading","enteredPin","selectedSubSource","partnerOrderId","sellerID","RefferalID","vertical","formError","displayImages","formImages","formState","street","streetError","zip","zipError","town","townError","email","emailError","phone","phoneError","ssn","ssnError","cart","post","category","icon","postTitle","loadFromQuery"],"sources":["./node_modules/@stencil/core/internal/client/patch-browser.js","@lazy-browser-entrypoint?app-data=conditional"],"sourcesContent":["/*\n Stencil Client Patch Browser v3.4.2 | MIT Licensed | https://stenciljs.com\n */\nimport { BUILD, NAMESPACE } from '@stencil/core/internal/app-data';\nimport { consoleDevInfo, plt, win, doc, promiseResolve, H } from '@stencil/core';\n/**\n * Helper method for querying a `meta` tag that contains a nonce value\n * out of a DOM's head.\n *\n * @param doc The DOM containing the `head` to query against\n * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag\n * exists or the tag has no content.\n */\nfunction queryNonceMetaTagContent(doc) {\n var _a, _b, _c;\n 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;\n}\n// TODO(STENCIL-661): Remove code related to the dynamic import shim\nconst getDynamicImportFunction = (namespace) => `__sc_import_${namespace.replace(/\\s|-/g, '_')}`;\nconst patchBrowser = () => {\n // NOTE!! This fn cannot use async/await!\n if (BUILD.isDev && !BUILD.isTesting) {\n consoleDevInfo('Running in development mode.');\n }\n // TODO(STENCIL-659): Remove code implementing the CSS variable shim\n if (BUILD.cssVarShim) {\n // shim css vars\n // TODO(STENCIL-659): Remove code implementing the CSS variable shim\n plt.$cssShim$ = win.__cssshim;\n }\n if (BUILD.cloneNodeFix) {\n // opted-in to polyfill cloneNode() for slot polyfilled components\n patchCloneNodeFix(H.prototype);\n }\n if (BUILD.profile && !performance.mark) {\n // not all browsers support performance.mark/measure (Safari 10)\n // because the mark/measure APIs are designed to write entries to a buffer in the browser that does not exist,\n // simply stub the implementations out.\n // TODO(STENCIL-323): Remove this patch when support for older browsers is removed (breaking)\n // @ts-ignore\n performance.mark = performance.measure = () => {\n /*noop*/\n };\n performance.getEntriesByName = () => [];\n }\n // @ts-ignore\n const scriptElm = \n // TODO(STENCIL-661): Remove code related to the dynamic import shim\n // TODO(STENCIL-663): Remove code related to deprecated `safari10` field.\n BUILD.scriptDataOpts || BUILD.safari10 || BUILD.dynamicImportShim\n ? Array.from(doc.querySelectorAll('script')).find((s) => new RegExp(`\\/${NAMESPACE}(\\\\.esm)?\\\\.js($|\\\\?|#)`).test(s.src) ||\n s.getAttribute('data-stencil-namespace') === NAMESPACE)\n : null;\n const importMeta = import.meta.url;\n const opts = BUILD.scriptDataOpts ? (scriptElm || {})['data-opts'] || {} : {};\n // TODO(STENCIL-663): Remove code related to deprecated `safari10` field.\n if (BUILD.safari10 && 'onbeforeload' in scriptElm && !history.scrollRestoration /* IS_ESM_BUILD */) {\n // Safari < v11 support: This IF is true if it's Safari below v11.\n // This fn cannot use async/await since Safari didn't support it until v11,\n // however, Safari 10 did support modules. Safari 10 also didn't support \"nomodule\",\n // so both the ESM file and nomodule file would get downloaded. Only Safari\n // has 'onbeforeload' in the script, and \"history.scrollRestoration\" was added\n // to Safari in v11. Return a noop then() so the async/await ESM code doesn't continue.\n // IS_ESM_BUILD is replaced at build time so this check doesn't happen in systemjs builds.\n return {\n then() {\n /* promise noop */\n },\n };\n }\n // TODO(STENCIL-663): Remove code related to deprecated `safari10` field.\n if (!BUILD.safari10 && importMeta !== '') {\n opts.resourcesUrl = new URL('.', importMeta).href;\n // TODO(STENCIL-661): Remove code related to the dynamic import shim\n // TODO(STENCIL-663): Remove code related to deprecated `safari10` field.\n }\n else if (BUILD.dynamicImportShim || BUILD.safari10) {\n opts.resourcesUrl = new URL('.', new URL(scriptElm.getAttribute('data-resources-url') || scriptElm.src, win.location.href)).href;\n // TODO(STENCIL-661): Remove code related to the dynamic import shim\n if (BUILD.dynamicImportShim) {\n patchDynamicImport(opts.resourcesUrl, scriptElm);\n }\n // TODO(STENCIL-661): Remove code related to the dynamic import shim\n if (BUILD.dynamicImportShim && !win.customElements) {\n // module support, but no custom elements support (Old Edge)\n // @ts-ignore\n return import(/* webpackChunkName: \"polyfills-dom\" */ './dom.js').then(() => opts);\n }\n }\n return promiseResolve(opts);\n};\n// TODO(STENCIL-661): Remove code related to the dynamic import shim\nconst patchDynamicImport = (base, orgScriptElm) => {\n const importFunctionName = getDynamicImportFunction(NAMESPACE);\n try {\n // test if this browser supports dynamic imports\n // There is a caching issue in V8, that breaks using import() in Function\n // By generating a random string, we can workaround it\n // Check https://bugs.chromium.org/p/chromium/issues/detail?id=990810 for more info\n win[importFunctionName] = new Function('w', `return import(w);//${Math.random()}`);\n }\n catch (e) {\n // this shim is specifically for browsers that do support \"esm\" imports\n // however, they do NOT support \"dynamic\" imports\n // basically this code is for old Edge, v18 and below\n const moduleMap = new Map();\n win[importFunctionName] = (src) => {\n var _a;\n const url = new URL(src, base).href;\n let mod = moduleMap.get(url);\n if (!mod) {\n const script = doc.createElement('script');\n script.type = 'module';\n script.crossOrigin = orgScriptElm.crossOrigin;\n script.src = URL.createObjectURL(new Blob([`import * as m from '${url}'; window.${importFunctionName}.m = m;`], {\n type: 'application/javascript',\n }));\n // Apply CSP nonce to the script tag if it exists\n const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);\n if (nonce != null) {\n script.setAttribute('nonce', nonce);\n }\n mod = new Promise((resolve) => {\n script.onload = () => {\n resolve(win[importFunctionName].m);\n script.remove();\n };\n });\n moduleMap.set(url, mod);\n doc.head.appendChild(script);\n }\n return mod;\n };\n }\n};\nconst patchCloneNodeFix = (HTMLElementPrototype) => {\n const nativeCloneNodeFn = HTMLElementPrototype.cloneNode;\n HTMLElementPrototype.cloneNode = function (deep) {\n if (this.nodeName === 'TEMPLATE') {\n return nativeCloneNodeFn.call(this, deep);\n }\n const clonedNode = nativeCloneNodeFn.call(this, false);\n const srcChildNodes = this.childNodes;\n if (deep) {\n for (let i = 0; i < srcChildNodes.length; i++) {\n // Node.ATTRIBUTE_NODE === 2, and checking because IE11\n if (srcChildNodes[i].nodeType !== 2) {\n clonedNode.appendChild(srcChildNodes[i].cloneNode(true));\n }\n }\n }\n return clonedNode;\n };\n};\nexport { patchBrowser };\n","export { setNonce } from '@stencil/core';\nimport { bootstrapLazy } from '@stencil/core';\nimport { patchBrowser } from '@stencil/core/internal/client/patch-browser';\nimport { globalScripts } from '@stencil/core/internal/app-globals';\npatchBrowser().then(options => {\n globalScripts();\n return bootstrapLazy([/*!__STENCIL_LAZY_DATA__*/], options);\n});\n"],"mappings":"sFAmBA,MAAMA,EAAe,KAkCjB,MAAMC,cAAyBC,IAC/B,MAAMC,EAAqE,GAiB3E,GAAuBF,IAAe,GAAI,CACtCE,EAAKC,aAAe,IAAIC,IAAI,IAAKJ,GAAYK,IAGrD,CAcI,OAAOC,EAAeJ,EAAK,ECrF/BH,IAAeQ,MAAKC,GAEXC,EAAc,qCAAqC,CAACC,aAAC,KAAAC,WAAA,KAAAC,YAAA,KAAAC,KAAA,KAAAC,SAAA,KAAAC,YAAA,KAAAC,SAAA,KAAAC,YAAA,KAAAC,QAAA,KAAAC,mBAAA,KAAAC,SAAA,KAAAC,WAAA,kCAAAC,GAAA,IAAAC,KAAA,IAAAC,SAAA,IAAAT,YAAA,mBAAAE,YAAA,mBAAAD,SAAA,gBAAAS,MAAA,KAAAC,UAAA,KAAAC,QAAA,KAAAC,eAAA,KAAAC,iBAAA,yGAAAC,OAAA,KAAAC,gBAAA,8BAAAlB,KAAA,KAAAU,KAAA,m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D,SAAA,qEAAAM,GAAA,IAAAP,YAAA,mBAAAE,YAAA,mBAAAD,SAAA,+DAAAM,GAAA,IAAA0C,cAAA,sBAAAjD,YAAA,mBAAAE,YAAA,mBAAAD,SAAA,0DAAAM,GAAA,IAAAP,YAAA,mBAAAE,YAAA,mBAAAD,SAAA,oEAAAM,GAAA,IAAAP,YAAA,mBAAAE,YAAA,mBAAAD,SAAA,2DAAAM,GAAA,IAAAP,YAAA,mBAAAE,YAAA,mBAAAD,SAAA,0GAAAR"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{r as t,h as s}from"./p-
|
2
|
-
//# sourceMappingURL=p-
|
1
|
+
import{r as t,h as s}from"./p-c707b937.js";import{W as i,B as e}from"./p-d297cb30.js";const n=class{constructor(s){t(this,s);this.id=undefined;this.widgetStyle=i.standard;this.buttonColor=undefined;this.buttonBg=undefined}render(){return s("hemfixarna-component",{widgetStyle:this.widgetStyle,buttonBg:this.buttonBg,buttonColor:this.buttonColor,id:this.id,business:e.fargvaruhuset})}};export{n as hemfixarna_fargvaruhuset};
|
2
|
+
//# sourceMappingURL=p-3a05b24c.entry.js.map
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{r as t,h as s}from"./p-
|
2
|
-
//# sourceMappingURL=p-
|
1
|
+
import{r as t,h as s}from"./p-c707b937.js";import{W as i,B as n}from"./p-d297cb30.js";const r="";const e=class{constructor(s){t(this,s);this.id=undefined;this.widgetStyle=i.standard;this.buttonColor=undefined;this.buttonBg=undefined}render(){return s("hemfixarna-component",{widgetStyle:this.widgetStyle,buttonBg:this.buttonBg,buttonColor:this.buttonColor,id:this.id,business:n.string})}};e.style=r;export{e as hemfixarna_string_furniture};
|
2
|
+
//# sourceMappingURL=p-3b6bf910.entry.js.map
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{c as e,f as t}from"./p-
|
2
|
-
//# sourceMappingURL=p-
|
1
|
+
import{c as e,f as t}from"./p-c707b937.js";const n=(e,t,n)=>{const r=e.get(t);if(!r){e.set(t,[n])}else if(!r.includes(n)){r.push(n)}};const r=(e,t)=>{let n;return(...r)=>{if(n){clearTimeout(n)}n=setTimeout((()=>{n=0;e(...r)}),t)}};const s=e=>!("isConnected"in e)||e.isConnected;const o=r((e=>{for(let t of e.keys()){e.set(t,e.get(t).filter(s))}}),2e3);const c=()=>{if(typeof e!=="function"){return{}}const r=new Map;return{dispose:()=>r.clear(),get:t=>{const s=e();if(s){n(r,t,s)}},set:e=>{const n=r.get(e);if(n){r.set(e,n.filter(t))}o(r)},reset:()=>{r.forEach((e=>e.forEach(t)));o(r)}}};const u=e=>typeof e==="function"?e():e;const l=(e,t=((e,t)=>e!==t))=>{const n=u(e);let r=new Map(Object.entries(n!==null&&n!==void 0?n:{}));const s={dispose:[],get:[],set:[],reset:[]};const o=()=>{var t;r=new Map(Object.entries((t=u(e))!==null&&t!==void 0?t:{}));s.reset.forEach((e=>e()))};const c=()=>{s.dispose.forEach((e=>e()));o()};const l=e=>{s.get.forEach((t=>t(e)));return r.get(e)};const a=(e,n)=>{const o=r.get(e);if(t(n,o,e)){r.set(e,n);s.set.forEach((t=>t(e,n,o)))}};const f=typeof Proxy==="undefined"?{}:new Proxy(n,{get(e,t){return l(t)},ownKeys(e){return Array.from(r.keys())},getOwnPropertyDescriptor(){return{enumerable:true,configurable:true}},has(e,t){return r.has(t)},set(e,t,n){a(t,n);return true}});const d=(e,t)=>{s[e].push(t);return()=>{i(s[e],t)}};const p=(t,n)=>{const r=d("set",((e,r)=>{if(e===t){n(r)}}));const s=d("reset",(()=>n(u(e)[t])));return()=>{r();s()}};const g=(...e)=>{const t=e.reduce(((e,t)=>{if(t.set){e.push(d("set",t.set))}if(t.get){e.push(d("get",t.get))}if(t.reset){e.push(d("reset",t.reset))}if(t.dispose){e.push(d("dispose",t.dispose))}return e}),[]);return()=>t.forEach((e=>e()))};const m=e=>{const t=r.get(e);s.set.forEach((n=>n(e,t,t)))};return{state:f,get:l,set:a,on:d,onChange:p,use:g,dispose:c,reset:o,forceUpdate:m}};const i=(e,t)=>{const n=e.indexOf(t);if(n>=0){e[n]=e[e.length-1];e.length--}};const a=(e,t)=>{const n=l(e,t);n.use(c());return n};const{state:f,onChange:d}=a({step:1,checkoutStep:1,checkoutEdit:false,selectedCategory:null,selectedService:null,selectedProduct:null,cart:[],business:"undefined",options:null,rut:true,rot:true,green:true,token:null,user:null,modal:null,rutOptions:null,rotOptions:null,greenOptions:null,customer:null,selectedCustomerCategory:null,parentCategory:null,creditSafeUser:null,checkoutInvoice:false,maleri:false,sources:null,selectSource:false,showSourcePasswordPrompt:false});d("cart",(e=>{window.sessionStorage.setItem(`hemfixarna-${f.business}-cart`,JSON.stringify(e))}));d("user",(e=>{window.sessionStorage.setItem(`hemfixarna-${f.business}-user`,JSON.stringify(e))}));d("creditSafeUser",(e=>{window.sessionStorage.setItem(`hemfixarna-${f.business}-creditSafeUser`,JSON.stringify(e))}));d("selectSource",(e=>{if(e){localStorage.setItem("select_source","true")}}));d("selectedProduct",(e=>{if(!f.customer||!e)return;const t=[...f.customer.categories,...f.customer.categories.map((e=>{var t;return(t=e.sub_categories)!==null&&t!==void 0?t:[]}))].flat();const n=t.find((t=>t&&t.id===e.category));if(n){f.parentCategory=n;return}f.parentCategory=null}));d("selectedCustomerCategory",(e=>{if(!f.customer||!e)return;if(e.parent){const t=f.customer.categories.find((t=>t.id===e.parent));if(t){f.parentCategory=t;return}}f.parentCategory=null}));export{f as s};
|
2
|
+
//# sourceMappingURL=p-642db21e.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["appendToMap","map","propName","value","items","get","set","includes","push","debounce","fn","ms","timeoutId","args","clearTimeout","setTimeout","isConnected","maybeElement","cleanupElements","key","keys","filter","stencilSubscription","getRenderingRef","elmsToUpdate","Map","dispose","clear","elm","elements","forceUpdate","reset","forEach","elms","unwrap","val","createObservableMap","defaultState","shouldUpdate","a","b","unwrappedState","states","Object","entries","handlers","_a","cb","oldValue","state","Proxy","_","ownKeys","Array","from","getOwnPropertyDescriptor","enumerable","configurable","has","on","eventName","callback","removeFromArray","onChange","unSet","newValue","unReset","use","subscriptions","unsubs","reduce","subscription","unsub","array","item","index","indexOf","length","createStore","step","checkoutStep","checkoutEdit","selectedCategory","selectedService","selectedProduct","cart","business","options","rut","rot","green","token","user","modal","rutOptions","rotOptions","greenOptions","customer","selectedCustomerCategory","parentCategory","creditSafeUser","checkoutInvoice","maleri","sources","selectSource","showSourcePasswordPrompt","window","sessionStorage","setItem","JSON","stringify","localStorage","product","categories","c","sub_categories","flat","category","find","id","parent"],"sources":["./node_modules/@stencil/store/dist/index.mjs","./src/store/index.ts"],"sourcesContent":["import { getRenderingRef, forceUpdate } from '@stencil/core';\n\nconst appendToMap = (map, propName, value) => {\n const items = map.get(propName);\n if (!items) {\n map.set(propName, [value]);\n }\n else if (!items.includes(value)) {\n items.push(value);\n }\n};\nconst debounce = (fn, ms) => {\n let timeoutId;\n return (...args) => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n timeoutId = setTimeout(() => {\n timeoutId = 0;\n fn(...args);\n }, ms);\n };\n};\n\n/**\n * Check if a possible element isConnected.\n * The property might not be there, so we check for it.\n *\n * We want it to return true if isConnected is not a property,\n * otherwise we would remove these elements and would not update.\n *\n * Better leak in Edge than to be useless.\n */\nconst isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;\nconst cleanupElements = debounce((map) => {\n for (let key of map.keys()) {\n map.set(key, map.get(key).filter(isConnected));\n }\n}, 2000);\nconst stencilSubscription = () => {\n if (typeof getRenderingRef !== 'function') {\n // If we are not in a stencil project, we do nothing.\n // This function is not really exported by @stencil/core.\n return {};\n }\n const elmsToUpdate = new Map();\n return {\n dispose: () => elmsToUpdate.clear(),\n get: (propName) => {\n const elm = getRenderingRef();\n if (elm) {\n appendToMap(elmsToUpdate, propName, elm);\n }\n },\n set: (propName) => {\n const elements = elmsToUpdate.get(propName);\n if (elements) {\n elmsToUpdate.set(propName, elements.filter(forceUpdate));\n }\n cleanupElements(elmsToUpdate);\n },\n reset: () => {\n elmsToUpdate.forEach((elms) => elms.forEach(forceUpdate));\n cleanupElements(elmsToUpdate);\n },\n };\n};\n\nconst unwrap = (val) => (typeof val === 'function' ? val() : val);\nconst createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {\n const unwrappedState = unwrap(defaultState);\n let states = new Map(Object.entries(unwrappedState !== null && unwrappedState !== void 0 ? unwrappedState : {}));\n const handlers = {\n dispose: [],\n get: [],\n set: [],\n reset: [],\n };\n const reset = () => {\n var _a;\n // When resetting the state, the default state may be a function - unwrap it to invoke it.\n // otherwise, the state won't be properly reset\n states = new Map(Object.entries((_a = unwrap(defaultState)) !== null && _a !== void 0 ? _a : {}));\n handlers.reset.forEach((cb) => cb());\n };\n const dispose = () => {\n // Call first dispose as resetting the state would\n // cause less updates ;)\n handlers.dispose.forEach((cb) => cb());\n reset();\n };\n const get = (propName) => {\n handlers.get.forEach((cb) => cb(propName));\n return states.get(propName);\n };\n const set = (propName, value) => {\n const oldValue = states.get(propName);\n if (shouldUpdate(value, oldValue, propName)) {\n states.set(propName, value);\n handlers.set.forEach((cb) => cb(propName, value, oldValue));\n }\n };\n const state = (typeof Proxy === 'undefined'\n ? {}\n : new Proxy(unwrappedState, {\n get(_, propName) {\n return get(propName);\n },\n ownKeys(_) {\n return Array.from(states.keys());\n },\n getOwnPropertyDescriptor() {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n has(_, propName) {\n return states.has(propName);\n },\n set(_, propName, value) {\n set(propName, value);\n return true;\n },\n }));\n const on = (eventName, callback) => {\n handlers[eventName].push(callback);\n return () => {\n removeFromArray(handlers[eventName], callback);\n };\n };\n const onChange = (propName, cb) => {\n const unSet = on('set', (key, newValue) => {\n if (key === propName) {\n cb(newValue);\n }\n });\n // We need to unwrap the defaultState because it might be a function.\n // Otherwise we might not be sending the right reset value.\n const unReset = on('reset', () => cb(unwrap(defaultState)[propName]));\n return () => {\n unSet();\n unReset();\n };\n };\n const use = (...subscriptions) => {\n const unsubs = subscriptions.reduce((unsubs, subscription) => {\n if (subscription.set) {\n unsubs.push(on('set', subscription.set));\n }\n if (subscription.get) {\n unsubs.push(on('get', subscription.get));\n }\n if (subscription.reset) {\n unsubs.push(on('reset', subscription.reset));\n }\n if (subscription.dispose) {\n unsubs.push(on('dispose', subscription.dispose));\n }\n return unsubs;\n }, []);\n return () => unsubs.forEach((unsub) => unsub());\n };\n const forceUpdate = (key) => {\n const oldValue = states.get(key);\n handlers.set.forEach((cb) => cb(key, oldValue, oldValue));\n };\n return {\n state,\n get,\n set,\n on,\n onChange,\n use,\n dispose,\n reset,\n forceUpdate,\n };\n};\nconst removeFromArray = (array, item) => {\n const index = array.indexOf(item);\n if (index >= 0) {\n array[index] = array[array.length - 1];\n array.length--;\n }\n};\n\nconst createStore = (defaultState, shouldUpdate) => {\n const map = createObservableMap(defaultState, shouldUpdate);\n map.use(stencilSubscription());\n return map;\n};\n\nexport { createObservableMap, createStore };\n","import { createStore } from '@stencil/store';\nimport { OnChangeHandler } from '@stencil/store/dist/types';\nimport { Business, CartItem, Category, Customer, CustomerCategory, CustomerSubCategory, GreenOptions, Product, RotOptions, RutOptions, Service, User, WpOptions } from '../types';\nimport { CreditSafeUser } from '../types/felixtypes';\n\ntype StateType = {\n step: number;\n selectedCategory: Category | null;\n selectedService: Service | null;\n selectedProduct: Product | null;\n cart: Array<CartItem>;\n business: Business | 'undefined';\n options: WpOptions | null;\n rut: boolean;\n rot: boolean;\n green: boolean;\n token: string | null;\n checkoutStep: number;\n checkoutEdit: boolean;\n user: User | null;\n creditSafeUser: CreditSafeUser | null;\n modal: {\n title?: string;\n text: string[];\n } | null;\n rutOptions: RutOptions | null;\n rotOptions: RotOptions | null;\n greenOptions: GreenOptions | null;\n customer: Customer | null;\n selectedCustomerCategory: CustomerCategory | CustomerSubCategory | null;\n parentCategory: CustomerCategory | CustomerSubCategory;\n checkoutInvoice: boolean;\n maleri: boolean;\n selectSource: boolean;\n showSourcePasswordPrompt: boolean;\n};\n\nconst {\n state,\n onChange,\n}: {\n state: StateType;\n onChange: OnChangeHandler<StateType>;\n} = createStore({\n step: 1,\n checkoutStep: 1,\n checkoutEdit: false,\n selectedCategory: null,\n selectedService: null,\n selectedProduct: null,\n cart: [],\n business: 'undefined',\n options: null,\n rut: true,\n rot: true,\n green: true,\n token: null,\n user: null,\n modal: null,\n rutOptions: null,\n rotOptions: null,\n greenOptions: null,\n customer: null,\n selectedCustomerCategory: null,\n parentCategory: null,\n creditSafeUser: null,\n checkoutInvoice: false,\n maleri: false,\n sources: null,\n selectSource: false,\n showSourcePasswordPrompt: false,\n});\n\nonChange('cart', cart => {\n window.sessionStorage.setItem(`hemfixarna-${state.business}-cart`, JSON.stringify(cart));\n});\n\nonChange('user', user => {\n window.sessionStorage.setItem(`hemfixarna-${state.business}-user`, JSON.stringify(user));\n});\n\nonChange('creditSafeUser', user => {\n window.sessionStorage.setItem(`hemfixarna-${state.business}-creditSafeUser`, JSON.stringify(user));\n});\n\nonChange('selectSource', selectSource => {\n if (selectSource) {\n localStorage.setItem('select_source', 'true');\n }\n});\n\nonChange('selectedProduct', product => {\n if (!state.customer || !product) return;\n const categories = [...state.customer.categories, ...state.customer.categories.map(c => c.sub_categories ?? [])].flat();\n const category = categories.find(c => c && c.id === product.category);\n if (category) {\n state.parentCategory = category;\n return;\n }\n state.parentCategory = null;\n});\n\nonChange('selectedCustomerCategory', category => {\n if (!state.customer || !category) return;\n if ((category as CustomerSubCategory).parent) {\n const parent = state.customer.categories.find(c => c.id === (category as CustomerSubCategory).parent);\n if (parent) {\n state.parentCategory = parent;\n return;\n }\n }\n state.parentCategory = null;\n});\n\nexport default state;\n"],"mappings":"2CAEA,MAAMA,EAAc,CAACC,EAAKC,EAAUC,KAChC,MAAMC,EAAQH,EAAII,IAAIH,GACtB,IAAKE,EAAO,CACRH,EAAIK,IAAIJ,EAAU,CAACC,GAC3B,MACS,IAAKC,EAAMG,SAASJ,GAAQ,CAC7BC,EA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OAAQ,MACRC,QAAS,KACTC,aAAc,MACdC,yBAA0B,QAG5B1C,EAAS,QAAQsB,IACfqB,OAAOC,eAAeC,QAAQ,cAAc3D,EAAMqC,gBAAiBuB,KAAKC,UAAUzB,GAAM,IAG1FtB,EAAS,QAAQ6B,IACfc,OAAOC,eAAeC,QAAQ,cAAc3D,EAAMqC,gBAAiBuB,KAAKC,UAAUlB,GAAM,IAG1F7B,EAAS,kBAAkB6B,IACzBc,OAAOC,eAAeC,QAAQ,cAAc3D,EAAMqC,0BAA2BuB,KAAKC,UAAUlB,GAAM,IAGpG7B,EAAS,gBAAgByC,IACvB,GAAIA,EAAc,CAChBO,aAAaH,QAAQ,gBAAiB,O,KAI1C7C,EAAS,mBAAmBiD,IAC1B,IAAK/D,EAAMgD,WAAae,EAAS,OACjC,MAAMC,EAAa,IAAIhE,EAAMgD,SAASgB,cAAehE,EAAMgD,SAASgB,WAAWhH,KAAIiH,IAAC,IAAApE,EAAI,OAAAA,EAAAoE,EAAEC,kBAAc,MAAArE,SAAA,EAAAA,EAAI,EAAE,KAAGsE,OACjH,MAAMC,EAAWJ,EAAWK,MAAKJ,GAAKA,GAAKA,EAAEK,KAAOP,EAAQK,WAC5D,GAAIA,EAAU,CACZpE,EAAMkD,eAAiBkB,EACvB,M,CAEFpE,EAAMkD,eAAiB,IAAI,IAG7BpC,EAAS,4BAA4BsD,IACnC,IAAKpE,EAAMgD,WAAaoB,EAAU,OAClC,GAAKA,EAAiCG,OAAQ,CAC5C,MAAMA,EAASvE,EAAMgD,SAASgB,WAAWK,MAAKJ,GAAKA,EAAEK,KAAQF,EAAiCG,SAC9F,GAAIA,EAAQ,CACVvE,EAAMkD,eAAiBqB,EACvB,M,EAGJvE,EAAMkD,eAAiB,IAAI,W"}
|
1
|
+
{"version":3,"names":["appendToMap","map","propName","value","items","get","set","includes","push","debounce","fn","ms","timeoutId","args","clearTimeout","setTimeout","isConnected","maybeElement","cleanupElements","key","keys","filter","stencilSubscription","getRenderingRef","elmsToUpdate","Map","dispose","clear","elm","elements","forceUpdate","reset","forEach","elms","unwrap","val","createObservableMap","defaultState","shouldUpdate","a","b","unwrappedState","states","Object","entries","handlers","_a","cb","oldValue","state","Proxy","_","ownKeys","Array","from","getOwnPropertyDescriptor","enumerable","configurable","has","on","eventName","callback","removeFromArray","onChange","unSet","newValue","unReset","use","subscriptions","unsubs","reduce","subscription","unsub","array","item","index","indexOf","length","createStore","step","checkoutStep","checkoutEdit","selectedCategory","selectedService","selectedProduct","cart","business","options","rut","rot","green","token","user","modal","rutOptions","rotOptions","greenOptions","customer","selectedCustomerCategory","parentCategory","creditSafeUser","checkoutInvoice","maleri","sources","selectSource","showSourcePasswordPrompt","window","sessionStorage","setItem","JSON","stringify","localStorage","product","categories","c","sub_categories","flat","category","find","id","parent"],"sources":["./node_modules/@stencil/store/dist/index.mjs","./src/store/index.ts"],"sourcesContent":["import { getRenderingRef, forceUpdate } from '@stencil/core';\n\nconst appendToMap = (map, propName, value) => {\n const items = map.get(propName);\n if (!items) {\n map.set(propName, [value]);\n }\n else if (!items.includes(value)) {\n items.push(value);\n }\n};\nconst debounce = (fn, ms) => {\n let timeoutId;\n return (...args) => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n timeoutId = setTimeout(() => {\n timeoutId = 0;\n fn(...args);\n }, ms);\n };\n};\n\n/**\n * Check if a possible element isConnected.\n * The property might not be there, so we check for it.\n *\n * We want it to return true if isConnected is not a property,\n * otherwise we would remove these elements and would not update.\n *\n * Better leak in Edge than to be useless.\n */\nconst isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;\nconst cleanupElements = debounce((map) => {\n for (let key of map.keys()) {\n map.set(key, map.get(key).filter(isConnected));\n }\n}, 2000);\nconst stencilSubscription = () => {\n if (typeof getRenderingRef !== 'function') {\n // If we are not in a stencil project, we do nothing.\n // This function is not really exported by @stencil/core.\n return {};\n }\n const elmsToUpdate = new Map();\n return {\n dispose: () => elmsToUpdate.clear(),\n get: (propName) => {\n const elm = getRenderingRef();\n if (elm) {\n appendToMap(elmsToUpdate, propName, elm);\n }\n },\n set: (propName) => {\n const elements = elmsToUpdate.get(propName);\n if (elements) {\n elmsToUpdate.set(propName, elements.filter(forceUpdate));\n }\n cleanupElements(elmsToUpdate);\n },\n reset: () => {\n elmsToUpdate.forEach((elms) => elms.forEach(forceUpdate));\n cleanupElements(elmsToUpdate);\n },\n };\n};\n\nconst unwrap = (val) => (typeof val === 'function' ? val() : val);\nconst createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {\n const unwrappedState = unwrap(defaultState);\n let states = new Map(Object.entries(unwrappedState !== null && unwrappedState !== void 0 ? unwrappedState : {}));\n const handlers = {\n dispose: [],\n get: [],\n set: [],\n reset: [],\n };\n const reset = () => {\n var _a;\n // When resetting the state, the default state may be a function - unwrap it to invoke it.\n // otherwise, the state won't be properly reset\n states = new Map(Object.entries((_a = unwrap(defaultState)) !== null && _a !== void 0 ? _a : {}));\n handlers.reset.forEach((cb) => cb());\n };\n const dispose = () => {\n // Call first dispose as resetting the state would\n // cause less updates ;)\n handlers.dispose.forEach((cb) => cb());\n reset();\n };\n const get = (propName) => {\n handlers.get.forEach((cb) => cb(propName));\n return states.get(propName);\n };\n const set = (propName, value) => {\n const oldValue = states.get(propName);\n if (shouldUpdate(value, oldValue, propName)) {\n states.set(propName, value);\n handlers.set.forEach((cb) => cb(propName, value, oldValue));\n }\n };\n const state = (typeof Proxy === 'undefined'\n ? {}\n : new Proxy(unwrappedState, {\n get(_, propName) {\n return get(propName);\n },\n ownKeys(_) {\n return Array.from(states.keys());\n },\n getOwnPropertyDescriptor() {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n has(_, propName) {\n return states.has(propName);\n },\n set(_, propName, value) {\n set(propName, value);\n return true;\n },\n }));\n const on = (eventName, callback) => {\n handlers[eventName].push(callback);\n return () => {\n removeFromArray(handlers[eventName], callback);\n };\n };\n const onChange = (propName, cb) => {\n const unSet = on('set', (key, newValue) => {\n if (key === propName) {\n cb(newValue);\n }\n });\n // We need to unwrap the defaultState because it might be a function.\n // Otherwise we might not be sending the right reset value.\n const unReset = on('reset', () => cb(unwrap(defaultState)[propName]));\n return () => {\n unSet();\n unReset();\n };\n };\n const use = (...subscriptions) => {\n const unsubs = subscriptions.reduce((unsubs, subscription) => {\n if (subscription.set) {\n unsubs.push(on('set', subscription.set));\n }\n if (subscription.get) {\n unsubs.push(on('get', subscription.get));\n }\n if (subscription.reset) {\n unsubs.push(on('reset', subscription.reset));\n }\n if (subscription.dispose) {\n unsubs.push(on('dispose', subscription.dispose));\n }\n return unsubs;\n }, []);\n return () => unsubs.forEach((unsub) => unsub());\n };\n const forceUpdate = (key) => {\n const oldValue = states.get(key);\n handlers.set.forEach((cb) => cb(key, oldValue, oldValue));\n };\n return {\n state,\n get,\n set,\n on,\n onChange,\n use,\n dispose,\n reset,\n forceUpdate,\n };\n};\nconst removeFromArray = (array, item) => {\n const index = array.indexOf(item);\n if (index >= 0) {\n array[index] = array[array.length - 1];\n array.length--;\n }\n};\n\nconst createStore = (defaultState, shouldUpdate) => {\n const map = createObservableMap(defaultState, shouldUpdate);\n map.use(stencilSubscription());\n return map;\n};\n\nexport { createObservableMap, createStore };\n","import { createStore } from '@stencil/store';\nimport { OnChangeHandler } from '@stencil/store/dist/types';\nimport { Business, CartItem, Category, Customer, CustomerCategory, CustomerSubCategory, GreenOptions, Product, RotOptions, RutOptions, Service, User, WpOptions } from '../types';\nimport { CreditSafeUser } from '../types/felixtypes';\n\ntype StateType = {\n step: number;\n selectedCategory: Category | null;\n selectedService: Service | null;\n selectedProduct: Product | null;\n cart: Array<CartItem>;\n business: Business | 'undefined';\n options: WpOptions | null;\n rut: boolean;\n rot: boolean;\n green: boolean;\n token: string | null;\n checkoutStep: number;\n checkoutEdit: boolean;\n user: User | null;\n creditSafeUser: CreditSafeUser | null;\n modal: {\n title?: string;\n text: string;\n } | null;\n rutOptions: RutOptions | null;\n rotOptions: RotOptions | null;\n greenOptions: GreenOptions | null;\n customer: Customer | null;\n selectedCustomerCategory: CustomerCategory | CustomerSubCategory | null;\n parentCategory: CustomerCategory | CustomerSubCategory;\n checkoutInvoice: boolean;\n maleri: boolean;\n selectSource: boolean;\n showSourcePasswordPrompt: boolean;\n};\n\nconst {\n state,\n onChange,\n}: {\n state: StateType;\n onChange: OnChangeHandler<StateType>;\n} = createStore({\n step: 1,\n checkoutStep: 1,\n checkoutEdit: false,\n selectedCategory: null,\n selectedService: null,\n selectedProduct: null,\n cart: [],\n business: 'undefined',\n options: null,\n rut: true,\n rot: true,\n green: true,\n token: null,\n user: null,\n modal: null,\n rutOptions: null,\n rotOptions: null,\n greenOptions: null,\n customer: null,\n selectedCustomerCategory: null,\n parentCategory: null,\n creditSafeUser: null,\n checkoutInvoice: false,\n maleri: false,\n sources: null,\n selectSource: false,\n showSourcePasswordPrompt: false,\n});\n\nonChange('cart', cart => {\n window.sessionStorage.setItem(`hemfixarna-${state.business}-cart`, JSON.stringify(cart));\n});\n\nonChange('user', user => {\n window.sessionStorage.setItem(`hemfixarna-${state.business}-user`, JSON.stringify(user));\n});\n\nonChange('creditSafeUser', user => {\n window.sessionStorage.setItem(`hemfixarna-${state.business}-creditSafeUser`, JSON.stringify(user));\n});\n\nonChange('selectSource', selectSource => {\n if (selectSource) {\n localStorage.setItem('select_source', 'true');\n }\n});\n\nonChange('selectedProduct', product => {\n if (!state.customer || !product) return;\n const categories = [...state.customer.categories, ...state.customer.categories.map(c => c.sub_categories ?? [])].flat();\n const category = categories.find(c => c && c.id === product.category);\n if (category) {\n state.parentCategory = category;\n return;\n }\n state.parentCategory = null;\n});\n\nonChange('selectedCustomerCategory', category => {\n if (!state.customer || !category) return;\n if ((category as CustomerSubCategory).parent) {\n const parent = state.customer.categories.find(c => c.id === (category as CustomerSubCategory).parent);\n if (parent) {\n state.parentCategory = parent;\n return;\n }\n }\n state.parentCategory = null;\n});\n\nexport default state;\n"],"mappings":"2CAEA,MAAMA,EAAc,CAACC,EAAKC,E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"}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import{r as n,h as t,g as i,F as e,a}from"./p-c707b937.js";import{s}from"./p-642db21e.js";import{B as r,W as o}from"./p-d297cb30.js";const l=n=>n.split(" ").reduce(((n,t)=>{if(t.length<=2){return n+t.slice(0,1)+"* "}else{return n+t.slice(0,1)+"*".repeat(t.length-2)+t.slice(-1)+" "}}),"");const h=n=>{if(!n)return;n.scrollTo({top:0,behavior:"smooth"})};const c=class{constructor(i){n(this,i);this.handleSubmit=n=>{n.preventDefault();const t=this.street.length>0;if(!t){this.streetError="Ange en gatuadress"}const i=this.zip.length>0;const e=/^\s*\d[\d\s]*$/.test(this.zip);if(!e){this.zipError="Postnummer får endast innehålla siffror"}if(!i){this.zipError="Ange ett postnummer"}const a=/^[^\d\s]{2,}$/.test(this.town);if(!a){this.townError="Ange en ort"}if(t&&i&&a&&e){s.user=Object.assign(Object.assign({},s.user),{street:this.street,zip:this.zip,town:this.town});s.checkoutStep=2;s.checkoutEdit=false;const n=this.el.closest(".hemfixarna_content");h(n)}};this.handleChangeStreet=n=>{this.streetError=null;this.street=this.street===s.user.street?"":n.target.value};this.handleChangeZip=n=>{this.zipError=null;this.zip=this.zip===s.user.zip?"":n.target.value};this.handleChangeTown=n=>{this.townError=null;this.town=this.town===s.user.town?"":n.target.value};this.render=()=>t("form",{class:"hemfixarna_address",onSubmit:n=>this.handleSubmit(n)},t("div",null,t("input",{class:`${this.street.length?"input_active":""}`,onInput:this.handleChangeStreet,type:"text",name:"street",value:this.street===s.user.street?l(this.street):this.street}),t("label",{htmlFor:"street"},"Gatuaddress ")),this.streetError&&t("span",null,this.streetError),t("div",null,t("input",{class:`${this.zip.length?"input_active":""}`,onInput:this.handleChangeZip,type:"tel",name:"zip",value:this.zip===s.user.zip?l(this.zip):this.zip}),t("label",{htmlFor:"zip"},"Postnummer ")),this.zipError&&t("span",null,this.zipError),t("div",null,t("input",{class:`${this.town.length?"input_active":""}`,onInput:this.handleChangeTown,type:"text",name:"town",value:this.town===s.user.town?l(this.town):this.town}),t("label",{htmlFor:"town"},"Ort ")),this.townError&&t("span",null,this.townError),t("input",{type:"submit",value:"Fortsätt"}));this.street="";this.streetError=null;this.zip="";this.zipError=null;this.town="";this.townError=null}componentWillLoad(){if(s.user){this.street=s.user.street;this.zip=s.user.zip;this.town=s.user.town}}get el(){return i(this)}};const p=n=>Math.ceil(n/2);const d=n=>Math.ceil(n*.7);const u=n=>Math.ceil(n*.5);const f=(n,t,i=1)=>{if(n.rot&&s.rot){return d((t||n.price)*i)}else if(n.rut&&s.rut){return p((t||n.price)*i)}else if(n.green&&s.green){return u((t||n.price)*i)}else{return(t||n.price)*i}};const m=n=>{if(n.rot){return d(n.price)}else if(n.rut&&s.rut){return p(n.price)}else{return n.price}};const x=(n,t,i=1)=>{if(t.rot&&s.rot){return d(n.price*i)}else if(t.rut&&s.rut){return p(n.price*i)}else if(t.green&&s.green){return u(n.price*i)}else{return n.price*i}};const g=n=>n.reduce(((n,t)=>{var i;const e=((i=t.start_fee_obj)===null||i===void 0?void 0:i.ID)||null;if(!n[e]){n[e]=[]}n[e].push(t);return n}),{});const v=(n=s.cart)=>{const t=new Set;let i=0;let e=0;let a=0;let r=0;n.forEach((n=>{const o=n.start_fee_obj;if(o&&!t.has(o.ID)){t.add(o.ID);if(n.rut){i+=s.rut?p(o.price):o.price}if(n.rot){e+=s.rot?d(o.price):o.price}if(n.green){a+=s.green?u(o.price):o.price}if(!n.rut&&!n.rot&&!n.green){r+=o.price}}}));const o=[i>0,e>0,a>0];return{rut:i,rot:e,green:a,default:r,length:o.filter(Boolean).length}};const b=n=>{const t=n.parts.reduce(((n,t)=>n+t.price*t.amount),0);return f(n,n.price*n.amount+t)};const _=()=>{const n=s.cart.reduce(((n,t)=>t.rot?n+b(t):n),0)+v().rot;const t=s.cart.reduce(((n,t)=>{const i=t.parts.reduce(((n,t)=>n+t.price*t.amount),0);return t.rot?n+t.price*t.amount+i:n}),0)+Number(s.options.start_fee);return t-n};const w=()=>{const n=s.cart.reduce(((n,t)=>t.rut?n+b(t):n),0)+v().rut;const t=s.cart.reduce(((n,t)=>{const i=t.parts.reduce(((n,t)=>n+t.price*t.amount),0);return t.rut?n+t.price*t.amount+i:n}),0)+Number(s.options.start_fee);return t-n};const y=()=>{const n=s.cart.reduce(((n,t)=>t.green?n+b(t):n),0)+v().green;const t=s.cart.reduce(((n,t)=>{const i=t.parts.reduce(((n,t)=>n+t.price*t.amount),0);return t.green?n+t.price*t.amount+i:n}),0)+Number(s.options.start_fee);return t-n};const k=()=>s.cart.reduce(((n,t)=>n+b(t)),0)+v().rot+v().rut+v().green+v().default;const C=n=>n.post_name!==undefined;const $=n=>Object.values(r).includes(n);const z=class{constructor(t){n(this,t);this.post=undefined;this.category=undefined;this.icon=undefined;this.postTitle=undefined}setTaxonomy(n){if(n){if((n===null||n===void 0?void 0:n.taxonomy)==="service_cat"){s.selectedCategory=n;s.step=2}else if((n===null||n===void 0?void 0:n.post_type)==="service"){s.selectedService=n;s.step=3}else if((n===null||n===void 0?void 0:n.post_type)==="ikea_product"){s.selectedProduct=n;s.step=4}const t=this.el.closest(".hemfixarna_content");h(t)}}setProduct(){s.selectedProduct=this.category;s.step=4;s.selectedCustomerCategory=null;const n=this.el.closest(".hemfixarna_content");h(n)}render(){return this.category?t(e,null,C(this.category)?t("li",{onClick:()=>this.setProduct()},t("img",{class:"hemfixarna_logo",height:82,src:this.category.icon,alt:this.category.post_name}),t("div",null,t("p",null,this.category.title),!this.category.invoice?t("p",{class:"price"},"Från ",f(this.category),"kr"):null)):t("li",{onClick:()=>s.selectedCustomerCategory=this.category},t("img",{class:"hemfixarna_logo",height:82,src:this.category.icon,alt:this.category.name}),t("div",null,t("p",null,this.category.name)))):t("li",{onClick:()=>this.setTaxonomy(this.post)},this.post.icon&&t("img",{class:"hemfixarna_logo",height:82,src:this.icon,alt:this.postTitle}),t("div",null,t("p",null,this.postTitle),s.step===3&&t("p",{class:"price"},"Från ",f(this.post),"kr")))}get el(){return i(this)}};const j=class{constructor(t){n(this,t);this.triggerScrollTotop=()=>{const n=this.el.nextSibling;h(n)};this.closeModal=undefined}getCartLength(){return s.cart.reduce(((n,t)=>n+t.amount),0)}handleCartClick(){var n;if((n=s.cart)===null||n===void 0?void 0:n.length){s.step=5;this.triggerScrollTotop()}}handleHomePageClick(){s.step=1;s.parentCategory=null;s.selectedCustomerCategory=null;this.triggerScrollTotop();setTimeout((()=>{s.selectedCategory=null;s.selectedProduct=null;s.maleri=null;s.selectedService=null}),200)}render(){const n=a(`./assets/hemfixarna.svg`);const i=a(`./assets/close.svg`);const e=a(`./assets/cart.svg`);const r=a(`./assets/back.svg`);return t("div",null,t("div",{class:"hemfixarna_crumbs"},t("div",{class:"hemfixarna_crumbs--links"},t("img",{onClick:()=>this.handleHomePageClick(),src:n,width:110}),t("img",{onClick:()=>this.closeModal(),class:"close",src:i,width:32}),t("div",null,t("button",{onClick:()=>this.handleHomePageClick()},"Alla tjänster"))),t("div",{class:"hemfixarna_crumbs--right"},t("hemfixarna-contact",null),t("div",{onClick:()=>this.handleCartClick(),class:`cart ${this.getCartLength()>0?"cart_active":""}`},t("img",{src:e,width:24}),t("span",null,this.getCartLength())))),[3,4].includes(s.step)&&!s.customer&&t("button",{class:"hemfixarna_crumbs--back",onClick:()=>{s.step=s.step===4?3:2}},t("img",{width:24,src:r,alt:"back arrow"}),t("span",null,"Se allt ",s.step===4?s.selectedService.post_title:s.selectedCategory.name)),!s.parentCategory&&s.step&&s.selectedCustomerCategory&&t("button",{class:"hemfixarna_crumbs--back",onClick:()=>{s.step=1;s.selectedCustomerCategory=null;s.selectedProduct=null;s.maleri=null}},t("img",{width:24,src:r,alt:"back arrow"}),t("span",null,"Se alla tjänster")),s.parentCategory&&s.step<5&&t("button",{class:"hemfixarna_crumbs--back",onClick:()=>{s.step=1;s.selectedCustomerCategory=s.parentCategory;s.selectedProduct=null;s.maleri=null}},t("img",{width:24,src:r,alt:"back arrow"}),t("span",null,"Se allt ",s.parentCategory.name)))}get el(){return i(this)}};const S=class{constructor(t){n(this,t)}render(){const n=a(`./assets/back.svg`);return t("div",{class:"hemfixarna_cart"},t("div",{class:"hemfixarna_cart--left"},t("h2",null,s.checkoutStep===2&&!s.checkoutEdit&&t("button",{onClick:()=>{s.checkoutStep=1}},t("img",{width:24,src:n,alt:"back arrow"})),"Din bokning"),t("hemfixarna-orderrows",null)),t("div",{class:"hemfixarna_cart--right"},t("h2",null,s.checkoutStep===2&&!s.checkoutEdit&&t("button",{onClick:()=>{s.checkoutStep=1}},t("img",{width:24,src:n,alt:"back arrow"})),"Dina uppgifter"),t("hemfixarna-checkout",null),t("hemfixarna-info",null)))}};const I="hemfixarna-partner.vercel.app";const T=()=>{if(window.location.href.includes("vercel.app")&&!window.location.href.includes(I)){return"https://hemfixare.dev.afonso.se"}else{return"https://hemfixarna.se"}};const M=()=>{if(typeof process!=="undefined"&&process.env&&"http://hemfixare.test"){return"http://hemfixare.test"}return T()};const O=()=>{if(window.location.href.includes("vercel.app")){return"https://hemfixare-lookup-dev.vercel.app/api"}else{return"https://hemfixare-lookup.vercel.app/api"}};const L=()=>{if(typeof process!=="undefined"&&process.env&&"https://hemfixare-lookup-dev.vercel.app/api"){return"https://hemfixare-lookup-dev.vercel.app/api"}return O()};const D=`${M()}/wp-json/headless`;async function F(n,t){const i=await fetch(n,t);const e=await i.json();return e}const V=async n=>{try{const t=await fetch(`${D}/customer/${n}`);return await t.json()}catch(n){console.log(n)}};const A=async({id:n,password:t})=>{try{const i=await fetch(`${D}/customer/login`,{method:"POST",body:JSON.stringify({id:n,password:t}),headers:{"Content-Type":"application/json"}});return i.status}catch(n){console.log(n)}};const N=async()=>{try{const n=await fetch(`${D}/webcoptions`);return await n.json()}catch(n){console.log(n)}};const P=async()=>{try{const n=await F(`${D}/rut`);return n}catch(n){console.log(n)}};const K=async()=>{try{const n=await fetch(`${D}/rot`);return await n.json()}catch(n){console.log(n)}};const R=async()=>{try{const n=await fetch(`${D}/green-discount`);return await n.json()}catch(n){console.log(n)}};const H=async n=>{try{const t=await fetch(`${D}/weborder`,{method:"POST",body:JSON.stringify(n),headers:{"Content-Type":"application/json"}});return await t.json()}catch(n){console.log(n)}};const B=`${M()}/wp-json/felix`;const E=async n=>{try{return await F(`${B}/createperson`,{method:"POST",body:JSON.stringify(n),headers:{"Content-Type":"application/json"}})}catch(n){console.log(n)}};const U=class{constructor(i){n(this,i);this.handleChangeDate=n=>{this.dateError=null;this.date=n.target.value};this.handleChangeTerms=()=>{this.generalError=null};this.sendOrder=async()=>{var n,t,i,e;if(this.loading)return;this.loading=true;const a=s.cart.filter((n=>n.start_fee_obj)).map((n=>{var t,i,e;return{ID:(t=n.start_fee_obj)===null||t===void 0?void 0:t.ID,title:(i=n.start_fee_obj)===null||i===void 0?void 0:i.title,price:(e=n.start_fee_obj)===null||e===void 0?void 0:e.price,rut:n.rut?1:0,rot:n.rot?1:0,green:n.green?1:0}}));let o={firstName:s.creditSafeUser.firstName,lastName:s.creditSafeUser.lastName,street:s.user.street,zip:s.user.zip,town:s.user.town,ssn:s.user.ssn,email:s.user.email,phone:s.user.phone,url:`${s.business===r.string?"string":s.business}-webk`,date:this.date,products:[...s.cart.map((n=>{const t=n.parts.map((t=>({id:String(t.id),name:t.name,quantity:t.amount,rut:0,rot:0,start_fee_id:n.start_fee_obj.ID})));return[{id:String(n.id),name:n.name,quantity:n.amount,rot:n.rot?1:0,rut:n.rut?1:0,start_fee_id:n.start_fee_obj.ID},...t]}))].flat(),start_fees:a,creditSafe:s.creditSafeUser,customer:s.business,id_source:s.customer.source?s.customer.source.fieldData.So01_Name:"",id_sub_source:this.selectedSubSource?this.selectedSubSource:"",seller_id:(n=this.sellerID)!==null&&n!==void 0?n:"",referral_id:(t=this.RefferalID)!==null&&t!==void 0?t:""};const l=await E(o);if(!l||!((e=(i=l.response)===null||i===void 0?void 0:i.scriptResult)===null||e===void 0?void 0:e.includes("OK"))){o=Object.assign(Object.assign({},o),{felixStatus:"error"})}else{o=Object.assign(Object.assign({},o),{felixStatus:"success"})}try{const{data:n,status:t}=await H(o);if(n&&t&&t===200){s.step=6;const n=this.el.closest(".hemfixarna_content");h(n)}else{this.generalError="Något gick fel, försök igen senare"}}catch(n){this.generalError="Något gick fel, försök igen senare"}this.loading=false};this.handleSubmit=n=>{var t;n.preventDefault();this.generalError=null;const i=this.date.length>0;if(!i){this.dateError="Ange ett giltigt datum"}const e=Array.from(this.el.querySelectorAll('input[type="checkbox"]'));const a=e.find((n=>!n.checked));if(a){this.generalError="Du måste godkänna villkoren"}if(s.customer.source&&s.selectSource){if(!this.sellerID){this.generalError="Ange säljare";return}if(((t=s.customer.source.sub_sources)===null||t===void 0?void 0:t.length)&&!this.selectedSubSource){this.generalError="Välj underkälla";return}}if(i&&!a){this.sendOrder()}};this.render=()=>{var n;const i=a(`./assets/date.svg`);const r=a(`./assets/down.svg`);const o=a(`./assets/spinner.gif`);if(s.checkoutEdit){return t("hemfixarna-address",null)}else if(s.checkoutStep===1){return t("hemfixarna-getuser",null)}else if(s.checkoutStep===2){return t("div",{class:"mb-2"},t("div",{class:"hemfixarna_addressinfo"},t("div",null,t("p",null,l(s.user.firstName)),t("p",null,l(s.user.lastName)),t("p",null,s.user.email),t("p",null,s.user.phone)),t("div",null,t("p",null,l(s.user.street)),t("p",null,l(s.user.zip)),t("p",null,l(s.user.town))),t("button",{onClick:()=>s.checkoutEdit=true},"Behöver du ändra adressen?")),t("form",{onSubmit:n=>this.handleSubmit(n)},t("div",null,t("img",{src:i,width:24}),t("input",{class:`${this.date.length?"input_active":""}`,min:(new Date).toISOString().split("T")[0],onChange:n=>this.handleChangeDate(n),type:"date",name:"date",value:this.date}),t("label",{htmlFor:"date"},"Tidigaste datum för hembesök"),t("img",{src:r,width:24})),this.dateError&&t("span",null,this.dateError),s.customer.source&&s.selectSource?t(e,null,t("p",null,"Inloggad som:",t("strong",null," ",s.customer.source.fieldData.So01_Name)),t("label",null,"Säljare (SäljarId)",t("input",{type:"text",value:this.sellerID,onChange:n=>this.sellerID=n.target.value})),t("label",null,"PartnerOrderID (RefferalID)",t("input",{type:"text",value:this.RefferalID,onChange:n=>this.RefferalID=n.target.value})),((n=s.customer.source.sub_sources)===null||n===void 0?void 0:n.length)?t("div",null,t("select",{onChange:n=>this.selectedSubSource=n.target.value},t("option",{disabled:true,selected:true,value:"null"},"Välj underkälla"),s.customer.source.sub_sources.map((n=>t("option",{value:n["So_SubSource::Sus01_Name"]},n["So_SubSource::Sus01_Name"]))))):t("p",null,"Det finns inga underkällor att välja")):null,t("label",{class:"hemfixarna_checkbox"},t("input",{onChange:()=>this.handleChangeTerms(),type:"checkbox"}),t("span",{innerHTML:s.options.terms})),s.cart.filter((n=>{var t;return(t=n.terms_checkout)===null||t===void 0?void 0:t.length})).map((n=>t(e,null,t("label",{class:"hemfixarna_checkbox"},t("input",{onChange:()=>this.handleChangeTerms(),type:"checkbox"}),t("span",null,n.terms_checkout))))),this.generalError&&t("span",null,this.generalError),t("div",{class:this.loading?"loading":""},t("input",{type:"submit",value:this.loading?"":"Skicka bokning"}),t("img",{width:20,height:20,src:o,alt:"spinner"}))))}};this.date="";this.dateError=null;this.generalError=null;this.loading=false;this.enteredPin="";this.selectedSubSource=null;this.partnerOrderId=null;this.sellerID=null;this.RefferalID=null}componentWillLoad(){if(Boolean(s.user&&s.user.street)){s.checkoutStep=2}}get el(){return i(this)}};const W='@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap");\n@keyframes fadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n* {\n box-sizing: border-box;\n}\n\n:host {\n font-family: "Inter", sans-serif;\n}\n:host input[type=text] {\n padding: 16px;\n width: 100%;\n font-size: 16px;\n border: 1px solid #fcd9c9;\n}\n:host .mb-2 {\n margin-bottom: 32px;\n}\n:host button {\n color: #474444;\n}\n:host form {\n display: flex;\n flex-direction: column;\n gap: 16px;\n position: relative;\n}\n:host form button {\n position: absolute;\n right: 0;\n top: -1rem;\n}\n:host form img {\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n pointer-events: none;\n}\n:host form img:first-of-type {\n left: 16px;\n}\n:host form img:last-of-type {\n right: 16px;\n}\n:host form span {\n margin-top: -8px;\n color: #ec6632;\n}\n:host form p {\n text-align: center;\n}\n:host form p {\n margin: 0;\n}\n:host form div {\n position: relative;\n}\n:host form div label {\n pointer-events: none;\n position: absolute;\n left: 16px;\n top: 50%;\n transform: translateY(-50%);\n background: #fff;\n padding: 4px;\n transition: 0.2s all cubic-bezier(0.465, 0.183, 0.153, 0.946);\n}\n:host form div input {\n padding: 16px;\n width: 100%;\n font-size: 16px;\n border: 1px solid #fcd9c9;\n}\n:host form div input:focus ~ label,\n:host form div .input_active ~ label {\n top: 0;\n transform: translateY(-50%);\n background: linear-gradient(180deg, #faf1e8 50%, #fff 50%);\n}\n:host form select {\n padding: 0.75rem 1rem;\n width: 100%;\n}\n:host h1 {\n font-size: 24px;\n font-weight: 400;\n line-height: 32px;\n letter-spacing: -3%;\n text-align: left;\n margin: 0 0 8px;\n}\n:host h2 {\n margin: 0 0 24px;\n font-weight: 700;\n font-size: 20px;\n line-height: 28px;\n letter-spacing: -3%;\n}\n:host p {\n font-size: 16px;\n font-weight: 400;\n line-height: 24px;\n letter-spacing: -3%;\n}\n:host .hemfixarna {\n width: 100%;\n /* Hide default HTML checkbox */\n /* The slider */\n}\n:host .hemfixarna_source {\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n}\n:host .hemfixarna_source img {\n width: 20px;\n}\n:host .hemfixarna_source--pw {\n max-width: 300px !important;\n}\n:host .hemfixarna_source--pw input[type=password] {\n padding: 0.5rem;\n}\n:host .hemfixarna_source--pw form {\n display: flex;\n flex-direction: column;\n gap: 1rem;\n}\n:host .hemfixarna_contact {\n display: flex;\n gap: 16px;\n}\n:host .hemfixarna_contact a {\n display: flex;\n align-items: center;\n gap: 8px;\n color: #474444;\n text-decoration: none;\n font-weight: 600;\n font-size: 13px;\n}\n:host .hemfixarna_contact a:hover {\n text-decoration: underline;\n}\n:host .hemfixarna_contact--horizontal span {\n display: none;\n}\n@media (min-width: 769px) {\n :host .hemfixarna_contact--horizontal span {\n display: initial;\n }\n}\n:host .hemfixarna_painting {\n opacity: 0;\n padding: 0 1rem;\n animation: fadeIn 0.5s forwards 0.3s;\n}\n:host .hemfixarna_painting > h2,\n:host .hemfixarna_painting p {\n text-align: center;\n padding: 0 16px;\n}\n:host .hemfixarna_painting > h2 {\n margin: 0 0 8px;\n}\n:host .hemfixarna_partnerlogo {\n max-height: 50px;\n min-height: 45px;\n object-fit: contain;\n max-width: 150px;\n}\n@media (min-width: 769px) {\n :host .hemfixarna_partnerlogo {\n max-width: 200px;\n }\n}\n:host .hemfixarna_nav {\n position: absolute;\n top: 0;\n width: 100dvw;\n left: 0;\n height: 80px;\n z-index: 9999;\n}\n:host .hemfixarna_nav--links {\n display: none !important;\n}\n@media (min-width: 769px) {\n :host .hemfixarna_nav--links {\n display: flex !important;\n }\n}\n:host .hemfixarna_nav--links a {\n color: #ec6632;\n text-decoration: none;\n border: 1px solid rgba(255, 255, 255, 0.3);\n border-radius: 56px;\n padding: 8px 32px;\n text-transform: capitalize;\n}\n:host .hemfixarna_nav > div {\n position: relative;\n overflow: hidden;\n width: 100%;\n height: 100%;\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 0 16px;\n}\n@media (min-width: 769px) {\n :host .hemfixarna_nav > div {\n padding: 0 32px;\n }\n}\n:host .hemfixarna_nav > div > div {\n display: flex;\n gap: 32px;\n justify-content: space-between;\n}\n:host .hemfixarna_nav > div > img {\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n z-index: -1;\n}\n:host .hemfixarna_nav a {\n text-decoration: none;\n}\n:host .hemfixarna_nav p {\n color: #474444;\n}\n:host .hemfixarna_nav p.with-bg {\n color: #fff;\n}\n:host .hemfixarna_standalone .hemfixarna_backdrop {\n background: #fffaf2;\n opacity: 1;\n}\n:host .hemfixarna_standalone .hemfixarna_modal {\n top: 80px;\n transform: translateX(-50%);\n border: none;\n height: calc(100dvh - 80px);\n opacity: 0;\n}\n:host .hemfixarna_standalone .hemfixarna_modal--open {\n opacity: 1;\n}\n:host .hemfixarna .switch {\n position: relative;\n display: inline-block;\n width: 40px;\n height: 20px;\n}\n:host .hemfixarna .switch input {\n opacity: 0;\n width: 0;\n height: 0;\n}\n:host .hemfixarna .slider {\n position: absolute;\n cursor: pointer;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background-color: #ccc;\n -webkit-transition: 0.4s;\n transition: 0.4s;\n border-radius: 34px;\n}\n:host .hemfixarna .slider:before {\n position: absolute;\n content: "";\n height: 18px;\n width: 18px;\n left: 2px;\n bottom: 1px;\n background-color: white;\n -webkit-transition: 0.4s;\n transition: 0.4s;\n border-radius: 50%;\n}\n:host .hemfixarna input:checked + .slider {\n background-color: #fcd9c9;\n}\n:host .hemfixarna input:focus + .slider {\n box-shadow: 0 0 1px #fcd9c9;\n}\n:host .hemfixarna input:checked + .slider:before {\n -webkit-transform: translateX(18px);\n -ms-transform: translateX(18px);\n transform: translateX(18px);\n background: #ec6632;\n}\n:host .hemfixarna_maleribox {\n background: #fff;\n box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);\n width: 100%;\n min-height: 132px;\n padding: 24px;\n display: flex;\n align-items: center;\n gap: 24px;\n text-align: left;\n}\n:host .hemfixarna_maleribox:hover {\n transition: 0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);\n filter: brightness(1.02);\n transform: scale(1.01);\n box-shadow: 0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863);\n}\n:host .hemfixarna_checkbox {\n display: grid;\n grid-template-columns: 40px auto;\n font-size: 16px;\n font-weight: 400;\n line-height: 24px;\n letter-spacing: -3%;\n}\n:host .hemfixarna_checkbox > span {\n transform: translateY(6px);\n}\n:host .hemfixarna_checkbox span,\n:host .hemfixarna_checkbox span p {\n color: #474444;\n font-size: 14px;\n}\n:host .hemfixarna_checkbox p {\n text-align: left;\n}\n:host .hemfixarna_info {\n display: flex;\n flex-direction: column;\n gap: 24px;\n padding: 32px;\n box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);\n border-radius: 4px;\n border: 1px solid #fcd9c9;\n}\n:host .hemfixarna_info h2 {\n margin: 0;\n}\n@media (min-width: 769px) {\n :host .hemfixarna_info {\n position: sticky;\n top: 0;\n }\n}\n:host .hemfixarna_infomodal {\n position: absolute;\n top: 40%;\n left: 50%;\n transform: translate(-50%, -50%);\n width: 100%;\n max-width: 80%;\n background: #fffaf2;\n border: 1px solid #fcd9c9;\n padding: 32px;\n z-index: 99;\n border-radius: 4px;\n box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);\n display: flex;\n flex-direction: column;\n gap: 16px;\n}\n:host .hemfixarna_infomodal p,\n:host .hemfixarna_infomodal h4 {\n margin: 0;\n}\n:host .hemfixarna_infomodal button {\n background: #ec6632;\n color: #fff;\n border-radius: 60px;\n font-size: 16px;\n padding: 8px 16px;\n}\n:host .hemfixarna_addressinfo {\n padding: 16px 16px 64px;\n border: 1px solid #fcd9c9;\n position: relative;\n margin-bottom: 32px;\n display: grid;\n grid-template-columns: 1fr;\n gap: 8px;\n}\n@media (min-width: 769px) {\n :host .hemfixarna_addressinfo {\n grid-template-columns: 1fr 1fr;\n }\n}\n:host .hemfixarna_addressinfo button {\n position: absolute;\n bottom: 16px;\n right: 16px;\n font-weight: 500;\n text-underline-offset: 2px;\n text-decoration: underline;\n}\n:host .hemfixarna_part {\n background: #fff;\n box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);\n display: grid;\n padding: 16px;\n grid-template-columns: auto 75px;\n}\n:host .hemfixarna_counter {\n display: flex;\n align-items: center;\n}\n:host .hemfixarna_counter span {\n padding: 0 8px;\n}\n:host .hemfixarna_counter img {\n cursor: pointer;\n}\n:host .hemfixarna_counter img:not(.disabled):hover {\n transition: 0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);\n filter: brightness(1.02);\n transform: scale(1.01);\n box-shadow: 0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863);\n}\n:host .hemfixarna_description {\n display: grid;\n gap: 16px;\n}\n:host .hemfixarna_description ul {\n list-style: disc;\n padding-right: 12px;\n transform: translateX(12px);\n}\n:host .hemfixarna_description--hidden {\n max-height: 140px;\n overflow: hidden;\n position: relative;\n cursor: pointer;\n}\n:host .hemfixarna_description--hidden::after {\n content: "";\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n height: 128px;\n background: linear-gradient(180deg, rgba(255, 253, 250, 0), rgba(255, 253, 250, 0.46) 50%, #faf1e8);\n}\n:host .hemfixarna_terms {\n font-size: 14px;\n}\n:host .hemfixarna_terms a {\n color: inherit;\n}\n:host .hemfixarna_logo {\n height: 64px;\n}\n:host .hemfixarna_box {\n padding: 16px;\n display: flex;\n align-items: center;\n width: 100%;\n box-sizing: border-box;\n border-radius: 4px;\n gap: 16px 8px;\n border-radius: 4px;\n gap: 16px 8px;\n}\n:host .hemfixarna_box p,\n:host .hemfixarna_box span {\n font-size: 15px;\n}\n:host .hemfixarna_box .underline {\n text-decoration: underline;\n text-underline-offset: 2px;\n}\n:host .hemfixarna_box .pointer {\n cursor: pointer;\n}\n:host .hemfixarna_box .p-s {\n font-size: 12px;\n}\n:host .hemfixarna_box > div {\n display: grid;\n gap: 8px;\n}\n:host .hemfixarna_box--standard {\n background: #fffaf2;\n border: 1px solid #fcd9c9;\n}\n:host .hemfixarna_box--alternative, :host .hemfixarna_box--alternative_2, :host .hemfixarna_box--alternative_3 {\n background: transparent;\n border: 1px solid #e3e3e3;\n}\n:host .hemfixarna_box--alternative_2, :host .hemfixarna_box--alternative_3 {\n box-shadow: 0px 2px 16px 0px rgba(0, 0, 0, 0.0784313725);\n}\n:host .hemfixarna_box--alternative_3 {\n justify-content: center;\n}\n:host .hemfixarna_altbtn {\n display: flex !important;\n flex-direction: column;\n gap: 8px;\n align-items: center;\n margin-left: auto;\n}\n:host .hemfixarna_btn {\n margin-left: auto;\n}\n:host .hemfixarna_btn, :host .hemfixarna_buy,\n:host .hemfixarna input[type=submit] {\n border: none;\n border-radius: 60px;\n font-weight: 600;\n letter-spacing: 0.5px;\n line-height: 20px;\n box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);\n}\n:host .hemfixarna_btn:not(.disabled):hover, :host .hemfixarna_buy:not(.disabled):hover,\n:host .hemfixarna input[type=submit]:not(.disabled):hover {\n transition: 0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);\n filter: brightness(1.02);\n transform: scale(1.01);\n box-shadow: 0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863);\n}\n:host .hemfixarna div:has(> input[type=submit]) {\n position: relative;\n}\n:host .hemfixarna div:has(> input[type=submit]) input {\n cursor: pointer;\n}\n:host .hemfixarna div:has(> input[type=submit]) img {\n display: none;\n}\n:host .hemfixarna .loading {\n cursor: default;\n opacity: 0.6;\n}\n:host .hemfixarna .loading > img {\n display: initial !important;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n:host .hemfixarna_btn {\n font-size: 14px;\n background: #c84e18;\n color: #fff;\n padding: 16px 24px;\n white-space: nowrap;\n position: relative;\n}\n:host .hemfixarna_btn span {\n position: absolute;\n background: #fff;\n border-radius: 100%;\n width: 24px;\n height: 24px;\n display: flex;\n justify-content: center;\n align-items: center;\n font-weight: 600;\n font-size: 13px;\n line-height: 11px;\n top: -6px;\n right: -12px;\n}\n:host .hemfixarna_btn span {\n background: #25a710;\n color: #fff;\n right: 0 !important;\n}\n:host .hemfixarna_buy,\n:host .hemfixarna input[type=submit] {\n font-size: 21px;\n background: #25a710;\n color: #fff;\n padding: 16px 24px;\n}\n:host .hemfixarna .disabled {\n opacity: 0.5;\n cursor: default;\n}\n:host .hemfixarna_modal {\n position: fixed;\n background: #faf1e8;\n border: 1px solid #fcd9c9;\n border-radius: 4px;\n top: 50%;\n left: 50%;\n z-index: 1000;\n transition: 0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);\n transform: translate(-50%, -50%) scale(0.7);\n opacity: 0;\n height: 92%;\n width: 92%;\n max-width: 920px;\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n:host .hemfixarna_modal--open {\n opacity: 1;\n transform: translate(-50%, -50%) scale(1);\n}\n:host .hemfixarna_backdrop {\n z-index: 999;\n position: fixed;\n background: #474444;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n opacity: 0;\n 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);\n}\n:host .hemfixarna_backdrop--open {\n opacity: 0.3;\n}\n:host .hemfixarna_order {\n position: absolute;\n top: -1px;\n left: -1px;\n right: -1px;\n bottom: -1px;\n background-repeat: no-repeat !important;\n background-size: cover !important;\n background-position: center !important;\n display: grid;\n grid-template-columns: 1fr 1fr;\n padding: 48px 32px 64px;\n}\n@media (max-width: 768px) {\n :host .hemfixarna_order {\n grid-template-columns: 1fr;\n grid-template-rows: 0 auto;\n }\n}\n:host .hemfixarna_order > div:last-of-type {\n background: #fffaf2;\n padding: 32px;\n display: flex;\n flex-direction: column;\n max-height: 100%;\n overflow: auto;\n}\n:host .hemfixarna_order img {\n cursor: pointer;\n}\n:host .hemfixarna_order button {\n margin: 16px 0;\n padding: 0;\n text-decoration: underline;\n text-underline-offset: 2px;\n font-size: 14px;\n font-weight: 600;\n}\n:host .hemfixarna_cart {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 32px;\n}\n@media (max-width: 768px) {\n :host .hemfixarna_cart {\n grid-template-columns: 1fr;\n gap: 0;\n }\n}\n:host .hemfixarna_cart--right h2, :host .hemfixarna_cart--left h2 {\n display: flex;\n align-items: center;\n}\n:host .hemfixarna_cart--right h2 img, :host .hemfixarna_cart--left h2 img {\n margin-top: 3.2px;\n}\n@media (min-width: 769px) {\n :host .hemfixarna_cart--left h2 button {\n display: none;\n }\n}\n@media (max-width: 768px) {\n :host .hemfixarna_cart--right h2 button {\n display: none;\n }\n}\n:host .hemfixarna_cart--startfee {\n display: flex;\n justify-content: space-between;\n}\n:host .hemfixarna_cart--rutrot {\n display: flex;\n justify-content: space-between;\n}\n:host .hemfixarna_cart--rutrot div {\n display: flex;\n gap: 16px;\n align-items: center;\n}\n:host .hemfixarna_cart--additional {\n display: flex;\n flex-direction: column;\n gap: 16px;\n padding: 16px;\n border-top: 1px solid #fcd9c9;\n}\n:host .hemfixarna_cart--additional p {\n font-size: 14px;\n position: relative;\n}\n:host .hemfixarna_cart--additional p strong {\n text-decoration: underline;\n text-underline-offset: 2px;\n cursor: pointer;\n}\n:host .hemfixarna_cart--additional p img {\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n right: -20px;\n cursor: pointer;\n}\n:host .hemfixarna_cart--price {\n border-top: 1px solid #fcd9c9;\n padding: 16px;\n display: flex;\n justify-content: space-between;\n}\n:host .hemfixarna_cart--price h3 {\n margin: 0;\n}\n:host .hemfixarna_cart--item {\n display: flex;\n flex-direction: column;\n gap: 8px;\n padding: 16px 0;\n border-top: 1px solid #fcd9c9;\n}\n:host .hemfixarna_cart--item span {\n font-size: 12px;\n}\n:host .hemfixarna_cart--item > div {\n display: flex;\n justify-content: space-between;\n}\n:host .hemfixarna_cart--item > div > div {\n display: flex;\n align-items: center;\n gap: 16px;\n}\n:host .hemfixarna_cart--item > div button {\n color: #ec6632;\n}\n:host .hemfixarna_cart--group {\n border-radius: 16px;\n background: #fefaf6;\n margin-bottom: 16px;\n padding: 10px 20px;\n}\n:host .hemfixarna_cart--group ul li:first-of-type {\n border-top: 0;\n}\n:host .hemfixarna_categories {\n display: flex;\n flex-direction: column;\n gap: 24px;\n}\n:host .hemfixarna_categories--wrapper {\n gap: 32px;\n display: grid;\n grid-template-columns: 1fr 1fr;\n}\n@media (max-width: 768px) {\n :host .hemfixarna_categories--wrapper {\n grid-template-columns: 1fr;\n }\n}\n:host .hemfixarna_categories li {\n position: relative;\n background: #fff;\n border-radius: 4px;\n min-height: 132px;\n padding: 24px;\n box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);\n display: flex;\n align-items: center;\n gap: 24px;\n cursor: pointer;\n}\n:host .hemfixarna_categories li:hover {\n transition: 0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);\n filter: brightness(1.02);\n transform: scale(1.01);\n box-shadow: 0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863);\n}\n:host .hemfixarna_categories li > button {\n height: 100%;\n width: 100%;\n}\n:host .hemfixarna_categories li .price {\n font-weight: 700;\n}\n:host .hemfixarna_content {\n height: 100%;\n overflow: auto;\n padding: 0 32px 64px;\n}\n:host .hemfixarna_content--5 {\n padding-top: 16px;\n}\n:host .hemfixarna_content--painting {\n padding: 0;\n overflow: initial;\n}\n:host .hemfixarna_crumbs {\n position: relative;\n padding: 16px 24px;\n border-bottom: 1px solid #fcd9c9;\n display: flex;\n justify-content: space-between;\n}\n:host .hemfixarna_crumbs--back {\n padding: 16px 24px 8px;\n display: flex;\n align-items: center;\n gap: 8px;\n box-shadow: none !important;\n}\n:host .hemfixarna_crumbs--back:hover {\n transition: 0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);\n filter: brightness(1.02);\n transform: scale(1.01);\n box-shadow: 0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863);\n}\n:host .hemfixarna_crumbs img {\n cursor: pointer;\n}\n:host .hemfixarna_crumbs .close {\n position: absolute;\n right: -16px;\n top: -16px;\n z-index: 9;\n -webkit-transform: translate3d(0, 0, 0);\n}\n:host .hemfixarna_crumbs .cart {\n display: flex;\n padding-left: 16px;\n position: relative;\n}\n:host .hemfixarna_crumbs .cart img {\n cursor: inherit;\n}\n:host .hemfixarna_crumbs .cart span {\n position: absolute;\n background: #fff;\n border-radius: 100%;\n width: 24px;\n height: 24px;\n display: flex;\n justify-content: center;\n align-items: center;\n font-weight: 600;\n font-size: 13px;\n line-height: 11px;\n top: -6px;\n right: -12px;\n}\n:host .hemfixarna_crumbs .cart_active {\n cursor: pointer;\n}\n:host .hemfixarna_crumbs .cart_active span {\n background: #25a710;\n color: #fff;\n}\n:host .hemfixarna_crumbs--links {\n display: flex;\n align-items: center;\n gap: 16px;\n overflow: auto;\n}\n@media (min-width: 769px) {\n :host .hemfixarna_crumbs--links {\n -ms-overflow-style: none;\n }\n :host .hemfixarna_crumbs--links::-webkit-scrollbar {\n display: none;\n }\n :host .hemfixarna_crumbs--links::-webkit-scrollbar-button {\n display: none;\n }\n}\n:host .hemfixarna_crumbs--right {\n display: flex;\n align-items: center;\n}\n:host .hemfixarna_crumbs button {\n white-space: nowrap;\n background: #f1ded6;\n border-radius: 64px;\n padding: 12px 16px;\n font-size: 12px;\n font-weight: 600;\n letter-spacing: 0.3px;\n box-shadow: none !important;\n}\n:host .hemfixarna_crumbs button:not(.active):hover {\n transition: 0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);\n filter: brightness(1.02);\n transform: scale(1.01);\n box-shadow: 0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863);\n}\n@media (max-width: 768px) {\n :host .hemfixarna_crumbs button {\n display: none;\n }\n}\n:host .hemfixarna_crumbs .active {\n background: #fffaf2;\n cursor: default;\n}\n:host .hemfixarna_features {\n gap: 12px !important;\n}\n:host .hemfixarna_features li {\n display: flex;\n gap: 16px;\n align-items: center;\n}\n:host .hemfixarna_address {\n margin-bottom: 16px;\n}\n:host .hemfixarna_product {\n display: grid;\n gap: 16px;\n}\n:host .hemfixarna_product--link {\n font-weight: 700;\n color: #474444;\n text-underline-offset: 4px;\n}\n:host .hemfixarna_product--left {\n gap: 32px;\n}\n:host .hemfixarna_product--right {\n gap: 32px;\n}\n:host .hemfixarna_product--price {\n margin-top: 4px;\n font-weight: 700;\n}\n:host .hemfixarna_product--total {\n text-align: center;\n margin: -16px 0;\n font-size: 21px;\n line-height: 28px;\n}\n:host .hemfixarna_product--item {\n background: #fff;\n padding: 16px;\n display: grid;\n grid-template-columns: auto 75px;\n box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);\n}\n:host .hemfixarna_product--grid {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 32px;\n}\n@media (max-width: 768px) {\n :host .hemfixarna_product--grid {\n grid-template-columns: 1fr;\n }\n}\n:host .hemfixarna_product--grid > div {\n display: flex;\n flex-direction: column;\n}\n:host .hemfixarna_product--grid ul {\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n:host .hemfixarna_product p {\n margin: 0;\n}\n:host .hemfixarna_product--top {\n display: flex;\n gap: 32px;\n}\n:host .hemfixarna_product--top img {\n object-fit: contain;\n}\n:host .hemfixarna_product--top > div {\n width: 100%;\n}\n:host .hemfixarna_product--top > div h1 {\n max-width: 80%;\n}\n@media (max-width: 768px) {\n :host .hemfixarna_product--top > div h1 {\n max-width: 100%;\n }\n}\n:host .hemfixarna_product--top h4 {\n margin-bottom: 8px;\n}\n:host h5,\n:host p {\n margin: 0;\n}\n:host input[type=submit] {\n cursor: pointer;\n}\n:host input[type=date] ~ label {\n left: 56px;\n}\n:host input[type=date] {\n border: 1px solid #fcd9c9;\n padding-left: 64px;\n}\n:host input[type=checkbox] {\n height: 18px;\n width: 18px;\n border: 1px solid #fcd9c9;\n}\n:host input[type=checkbox]:checked {\n background: red;\n}\n:host input[type=date]::-webkit-calendar-picker-indicator {\n background: transparent;\n bottom: 0;\n color: transparent;\n cursor: pointer;\n height: auto;\n left: 0;\n position: absolute;\n right: 0;\n top: 0;\n width: auto;\n}\n:host button,\n:host a {\n cursor: pointer;\n background: none;\n border: none;\n}\n:host ul {\n list-style: none;\n margin: 0;\n padding: 0;\n}';const J=class{constructor(t){n(this,t);this.triggerScrollTotop=()=>{const n=this.el.shadowRoot.querySelector(".hemfixarna_content");h(n)};this.modal=false;this.showModal=false;this.product=null;this.id=undefined;this.slug=undefined;this.business=undefined;this.widgetStyle=o.standard;this.buttonColor=undefined;this.buttonBg=undefined;this.proppedProduct=null;this.loginSourceError=null}loadCategoryOrProduct(n){this.proppedProduct=null;if(n.startsWith("c-")){const t=[...s.customer.categories,...s.customer.categories.map((n=>{var t;return(t=n.sub_categories)!==null&&t!==void 0?t:[]}))].flat();const i=t.find((t=>t&&t.id===n.replace("c-","")));if(i){s.selectedCustomerCategory=i;s.step=2}}else{const t=s.customer.categories.map((n=>n.show_products?n.products:n.sub_categories?n.sub_categories.map((n=>n.products)):[])).flat().flat();const i=t.find((t=>t&&t.fields.ID===parseInt(n)));if(i){s.selectedProduct=i.fields;s.step=4;this.proppedProduct=i.fields}}}async watchIdChange(n){if(n&&s.customer){if(n==="maleri"){s.maleri=true;s.step=4}else{this.loadCategoryOrProduct(n)}}}async componentWillLoad(){s.business=this.business;const n=window.sessionStorage.getItem(`hemfixarna-${this.business}-cart`);if(n){s.cart=JSON.parse(n)}const t=window.sessionStorage.getItem(`hemfixarna-${this.business}-user`);if(t){s.user=JSON.parse(t)}const i=window.sessionStorage.getItem(`hemfixarna-${this.business}-creditSafeUser`);if(i){s.creditSafeUser=JSON.parse(i)}const[e,a,r,o]=await Promise.all([N(),P(),K(),R()]);try{const n=await V(this.business);if((n===null||n===void 0?void 0:n.code)==="not_found"){console.warn("customer not found")}else if(n){s.customer=n;const t=this.id||this.slug;if(t){if(t==="maleri"){s.maleri=true;s.step=4}else{this.loadCategoryOrProduct(t)}}}}catch(n){console.warn("customer not found")}s.rotOptions=r;s.rutOptions=a;s.greenOptions=o;s.options=e;if(localStorage.getItem("select_source")){s.selectSource=true}}openModal(){if(this.id){if(this.id==="maleri"){s.maleri=true;s.step=4}else{s.maleri=false;this.loadCategoryOrProduct(this.id)}}this.modal=true;setTimeout((()=>{this.showModal=true}),50)}closeModal(){this.showModal=false;setTimeout((()=>{this.modal=false}),200)}handleClick(n){if((n===null||n===void 0?void 0:n.composedPath()[0]).classList.contains("hemfixarna_backdrop")){this.closeModal()}const t=this.el.shadowRoot.querySelector(".hemfixarna_infomodal");if(t){const i=t.contains(n.composedPath()[0]);if(!i){s.modal=null}}}async handleLogin(){this.loginSourceError=null;const n=this.el.shadowRoot.querySelector('input[type="password"]');const t=n.value;try{const n=await A({id:s.customer.ID,password:t});if(n===200){s.showSourcePasswordPrompt=false;s.selectSource=true}else{this.loginSourceError="Fel lösenord"}}catch(n){console.log(n);this.loginSourceError="Fel lösenord"}}getCartLength(){return s.cart.reduce(((n,t)=>n+t.amount),0)}render(){var n,i,r,l,h,c,p,d,u,f,x,g;const v=a(`./assets/hemfixarna.svg`);const b=a(`./assets/pensel.svg`);const _=a(`./assets/montering.svg`);return t("div",{class:`hemfixarna hemfixarna-${this.business}`},t("div",{class:`hemfixarna_box hemfixarna_box--${this.widgetStyle}`},[o.alternative_2,o.alternative_3].includes(this.widgetStyle)?t("img",{src:this.id==="maleri"?b:_,alt:"montering logo",width:32,height:32}):null,t("div",null,t("div",null,t("p",{onClick:()=>this.openModal(),class:`pointer ${[o.alternative_2,o.alternative_3].includes(this.widgetStyle)&&s.selectedProduct?"underline":""}`},this.id==="maleri"?t("span",null,"Beräkna fast pris på måleri & tapetsering här"):t(e,null,!s.selectedCustomerCategory&&!this.product&&!this.proppedProduct?t(e,null,((n=s.customer)===null||n===void 0?void 0:n.widget_title)?t("span",null,s.customer.widget_title):t("span",null,"Montering/Installation - ",t("strong",{class:"underline"},"se priser här"))):t(e,null,((i=this.product)===null||i===void 0?void 0:i.title)||((r=this.proppedProduct)===null||r===void 0?void 0:r.title)||((l=s.selectedCustomerCategory)===null||l===void 0?void 0:l.widget_title)||t("span",null,"Montering",t("wbr",null),"/Installation ",(c=(h=s.selectedCustomerCategory)===null||h===void 0?void 0:h.name)!==null&&c!==void 0?c:"på plats"," - ",t("strong",{class:"underline"},"se priser här")),this.proppedProduct&&!((p=this.product)===null||p===void 0?void 0:p.invoice)&&!((d=this.proppedProduct)===null||d===void 0?void 0:d.invoice)?t("span",null," från"," ",t("strong",null,m(this.proppedProduct||this.product),"kr")):null)))),this.widgetStyle===o.standard?t("img",{src:v,width:104}):null,this.widgetStyle===o.alternative?t("span",{class:"p-s"},"Utförs av ",t("strong",null,"Hemfixarna")):null),[o.standard,o.alternative].includes(this.widgetStyle)?t("button",{onClick:()=>this.openModal(),class:"hemfixarna_btn",style:{color:((u=this.buttonColor)===null||u===void 0?void 0:u.startsWith("#"))||!((f=this.buttonColor)===null||f===void 0?void 0:f.length)?this.buttonColor:`#${this.buttonColor}`,backgroundColor:((x=this.buttonBg)===null||x===void 0?void 0:x.startsWith("#"))||!((g=this.buttonBg)===null||g===void 0?void 0:g.length)?this.buttonBg:`#${this.buttonBg}`}},"Beställ här",this.getCartLength()>0&&t("span",null,this.getCartLength())):null,o.alternative_2===this.widgetStyle?t("div",{class:"hemfixarna_altbtn"},t("strong",{class:"p-s"},"Utförs av"),t("img",{src:v,alt:"hemfixarna logo",width:98})):null),this.modal&&t("div",null,t("div",{class:`hemfixarna_modal ${this.showModal?"hemfixarna_modal--open":""}`},s.modal&&t("div",{class:"hemfixarna_infomodal"},s.modal.title&&t("h2",null,s.modal.title),t("p",{innerHTML:s.modal.text}),t("div",null,t("button",{onClick:()=>s.modal=null},"Stäng"))),s.showSourcePasswordPrompt?t("div",{class:"hemfixarna_source--pw hemfixarna_infomodal"},t("form",{onSubmit:n=>{n.preventDefault();this.handleLogin()}},t("input",{type:"password",placeholder:"Lösenord"}),t("input",{type:"submit",value:"Logga in"}),this.loginSourceError&&t("span",null,"Fel lösenord"))):null,s.customer&&t("hemfixarna-breadcrumbs",{closeModal:()=>this.closeModal()}),t("div",{class:`hemfixarna_content hemfixarna_content--${s.step} ${s.step===4&&s.maleri?"hemfixarna_content--painting":""}`},s.step<4&&t("hemfixarna-start",null),s.step===4&&t("hemfixarna-product",null),s.step===5&&t("hemfixarna-cart",null),s.step===6&&t("hemfixarna-order",null))),t("div",{class:`hemfixarna_backdrop ${this.showModal?"hemfixarna_backdrop--open":""}`})))}static get assetsDirs(){return["assets"]}get el(){return i(this)}static get watchers(){return{id:["watchIdChange"]}}};J.style=W;const Z=class{constructor(t){n(this,t);this.vertical=false}render(){return t("div",{class:`hemfixarna_contact ${this.vertical?"hemfixarna_contact--vertical":"hemfixarna_contact--horizontal"}`},s.customer.source?t("div",{onClick:()=>{if(!s.selectSource){s.showSourcePasswordPrompt=true}},class:"hemfixarna_source"},s.selectSource?t("svg",{viewBox:"0 0 1024 1024",fill:"#C84E18",height:"1em",width:"1em"},t("path",{d:"M832 464H332V240c0-30.9 25.1-56 56-56h248c30.9 0 56 25.1 56 56v68c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-68c0-70.7-57.3-128-128-128H388c-70.7 0-128 57.3-128 128v224h-68c-17.7 0-32 14.3-32 32v384c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V496c0-17.7-14.3-32-32-32zM540 701v53c0 4.4-3.6 8-8 8h-40c-4.4 0-8-3.6-8-8v-53a48.01 48.01 0 1156 0z"})):t("svg",{viewBox:"0 0 1024 1024",fill:"#C84E18",height:"1em",width:"1em"},t("path",{d:"M832 464h-68V240c0-70.7-57.3-128-128-128H388c-70.7 0-128 57.3-128 128v224h-68c-17.7 0-32 14.3-32 32v384c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V496c0-17.7-14.3-32-32-32zM540 701v53c0 4.4-3.6 8-8 8h-40c-4.4 0-8-3.6-8-8v-53a48.01 48.01 0 1156 0zm152-237H332V240c0-30.9 25.1-56 56-56h248c30.9 0 56 25.1 56 56v224z"}))):null,t("a",{href:"tel:0770-220 720"},t("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t("path",{d:"M7 4V20H17V4H7ZM6 2H18C18.5523 2 19 2.44772 19 3V21C19 21.5523 18.5523 22 18 22H6C5.44772 22 5 21.5523 5 21V3C5 2.44772 5.44772 2 6 2ZM12 17C12.5523 17 13 17.4477 13 18C13 18.5523 12.5523 19 12 19C11.4477 19 11 18.5523 11 18C11 17.4477 11.4477 17 12 17Z",fill:"#C84E18"})),t("span",null,"0770-220 720")),t("a",{href:"https://hemfixarna.se/kundservice/",target:"_blank"},t("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t("g",{"clip-path":"url(#clip0_1001_894)"},t("path",{d:"M21 12.22C21 6.73 16.74 3 12 3C7.31 3 3 6.65 3 12.28C2.4 12.62 2 13.26 2 14V16C2 17.1 2.9 18 4 18H5V11.9C5 8.03 8.13 4.9 12 4.9C15.87 4.9 19 8.03 19 11.9V19H11V21H19C20.1 21 21 20.1 21 19V17.78C21.59 17.47 22 16.86 22 16.14V13.84C22 13.14 21.59 12.53 21 12.22Z",fill:"#C84E18"}),t("path",{d:"M9 14C9.55228 14 10 13.5523 10 13C10 12.4477 9.55228 12 9 12C8.44772 12 8 12.4477 8 13C8 13.5523 8.44772 14 9 14Z",fill:"#C84E18"}),t("path",{d:"M15 14C15.5523 14 16 13.5523 16 13C16 12.4477 15.5523 12 15 12C14.4477 12 14 12.4477 14 13C14 13.5523 14.4477 14 15 14Z",fill:"#C84E18"}),t("path",{d:"M18 11.03C17.52 8.18 15.04 6 12.05 6C9.01997 6 5.75997 8.51 6.01997 12.45C8.48997 11.44 10.35 9.24 10.88 6.56C12.19 9.19 14.88 11 18 11.03Z",fill:"#C84E18"})),t("defs",null,t("clipPath",{id:"clip0_1001_894"},t("rect",{width:"24",height:"24",fill:"white"})))),t("span",null,"Kundservice")))}};const X='@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap"); :host{font-family:"Inter", sans-serif}:host .hemfixarna_widgetstyles label{cursor:pointer}:host .hemfixarna_widgetstyles>div{display:flex;gap:1rem}:host .hemfixarna_widgetstyles h5{margin:1rem 0}:host .hemfixarna_example{margin-bottom:16px;background:#000;padding:16px;color:#fff;display:flex;justify-content:space-between;cursor:pointer;max-width:500px;box-sizing:border-box;position:relative}:host .hemfixarna_example--tooltip{background:#000;top:-48px;font-size:16px;left:40%;color:white;padding:8px;position:absolute;opacity:0}:host .hemfixarna_example--tooltip::after{content:"";position:absolute;top:100%;left:50%;margin-left:-5px;border-width:5px;border-style:solid;border-color:#000 transparent transparent transparent}:host .hemfixarna_example:hover .hemfixarna_example--tooltip{opacity:1}:host .hemfixarna_example p{font-size:14px}:host .hemfixarna_example img{filter:invert(1)}:host .hemfixarna_install{display:grid;gap:8px;margin-top:16px}:host .hemfixarna_product--label{background:#e1e0f5}:host .hemfixarna_categories{max-height:100%;overflow:auto;position:relative}:host .hemfixarna_categories--label{display:flex;align-items:center;justify-content:space-between;padding:8px}:host .hemfixarna_categories--label button{background:#3f3a92;border:none;font-weight:600;padding:3.2px 9.6px;border-radius:10px;margin-right:8px;color:#ece8e8}:host .hemfixarna_categories--label button:active{transform:scale(0.95)}:host .hemfixarna_categories--label--big{font-weight:600;border-bottom:1px solid black}:host p{margin:0}:host span{color:darkolivegreen;font-size:10px}:host button{cursor:pointer}:host>div:not(.hemfixarna_hosted){grid-template-columns:1fr 1fr}:host .hemfixarna_hosted .hemfixarna_scripts{display:none}:host>div{display:grid;gap:32px;width:100%;height:100vh;place-items:center;overflow:hidden;padding:16px 32px;box-sizing:border-box}:host>div>*{width:100%}:host>div>div{max-width:500px}:host>div ul{margin:0;padding:0;list-style:none}:host>div ul ul{gap:1px;display:grid}:host>div ul li{padding-left:16px;background:#fff}';const Y=class{constructor(t){n(this,t);this.debounce=null;this.cdnLink='<script type="module" src="https://cdn.jsdelivr.net/npm//hemfixarna-web-components@latest/dist/hemfixarna-components/hemfixarna-components.esm.js"><\/script>';this.selectedSlug=undefined;this.selectedID=undefined;this.tooltipText="Kopiera till urklipp";this.tree=null;this.customer=null;this.widgetStyle=o.standard;this.buttonBg="";this.buttonColor="";this.partner=undefined;this.colorAccessibility=undefined;this.loggedIn=false;this.loginError=false}debouncedFunction(){if(this.debounce!==null){clearTimeout(this.debounce);this.debounce=null}this.debounce=window.setTimeout((()=>{this.checkColorAccessibility();this.debounce=null}),1500)}async checkColorAccessibility(){const n="#fff";const t="#c84e18";const i=this.buttonBg.length?this.buttonBg.startsWith("#")?this.buttonBg:`#${this.buttonBg}`:t;const e=this.buttonColor.length?this.buttonColor.startsWith("#")?this.buttonColor:`#${this.buttonColor}`:n;try{const n=await fetch("https://www.aremycolorsaccessible.com/api/are-they",{mode:"cors",method:"POST",body:JSON.stringify({colors:[i,e]})});if(!n){throw new Error("Network response was not ok")}const t=await n.json();if(t&&t){this.colorAccessibility=t}}catch(n){console.warn("Error fetching color accessibility:",n)}}getColor(n){switch(n){case"AAA":return"green";case"AA":return"orange";case"A":return"yellow";case"Fail":return"red";default:return"black"}}async componentWillLoad(){const n=window.location.pathname.replace("/","");if(!$(n)&&n)return;this.partner=n?n:r.kund;const t=await V(this.partner);if(t.code!=="not_found"&&t){this.customer=t;if(!this.customer.password_protected||window.localStorage.getItem(`${this.customer.ID}-loggedin`)){this.loggedIn=true}}}getExample(){return`<hemfixarna-component business="${this.partner}"${this.selectedSlug?` slug="${this.selectedSlug}" `:""}${this.selectedID?` id="${this.selectedID}" `:""} ${this.widgetStyle===o.standard?"":`widget-style="${this.widgetStyle}"`} ${this.buttonColor.length?`button-color="${this.buttonColor}"`:""} ${this.buttonBg.length?`button-bg="${this.buttonBg}"`:""}></hemfixarna-component>`}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)}showMaleri(){var n;const t=(n=this.customer)===null||n===void 0?void 0:n.categories.map((n=>n.sub_categories?n.sub_categories:n)).flat();return t===null||t===void 0?void 0:t.some((n=>n.add_painting))}async handleLogin(){const n=document.querySelector("hemfixarna-demo");const t=n.shadowRoot;const i=t.querySelector('input[type="password"]');const e=i.value;this.loginError=false;try{const n=await A({id:this.customer.ID,password:e});if(n===200){this.loggedIn=true;window.localStorage.setItem(`${this.customer.ID}-loggedin`,"true")}else{this.loginError=true}}catch(n){console.log(n);this.loginError=true}}render(){var n;const i=a(`./assets/copy.png`);return this.customer?t(e,null,this.loggedIn?t("div",{class:((n=this.customer)===null||n===void 0?void 0:n.at_hemfixarna)?"hemfixarna_hosted":""},t("div",{class:"hemfixarna_scripts"},t("div",{onClick:()=>this.copyExample(),class:"hemfixarna_example"},t("p",null,this.getExample()),t("img",{src:i,height:20}),t("span",{class:"hemfixarna_example--tooltip"},this.tooltipText)),t("hemfixarna-component",{business:this.partner,buttonBg:this.buttonBg,buttonColor:this.buttonColor,widgetStyle:this.widgetStyle,id:this.selectedID}),t("div",{class:"hemfixarna_install"},t("div",{onClick:()=>this.copyCdn(),class:"hemfixarna_example"},t("p",null,this.cdnLink),t("span",{class:"hemfixarna_example--tooltip"},this.tooltipText),t("img",{src:i,height:20}))),t("div",{class:"hemfixarna_widgetstyles"},t("h5",null,"Widget styles"),t("div",null,Object.values(o).map((n=>t("label",{key:n},t("input",{type:"radio",value:n,checked:this.widgetStyle===n,onChange:()=>this.widgetStyle=n}),n)))),t("div",null,t("div",null,t("h5",null,"Button background color"),t("input",{type:"text",value:this.buttonBg,onInput:n=>this.buttonBg=n.target.value})),t("div",null,t("h5",null,"Button text color"),t("input",{type:"text",value:this.buttonColor,onInput:n=>this.buttonColor=n.target.value})))),t("span",null,"Write an hexa code no # needed"),this.colorAccessibility?t("div",null,t("h5",null,"Tillgänglighetsrapport"),t("div",null,t("strong",null,"Liten text:"),t("span",{style:{color:this.getColor(this.colorAccessibility.small)}},this.colorAccessibility.small),t("br",null),t("strong",null,"Fet text:"),t("span",{style:{color:this.getColor(this.colorAccessibility.bold)}},this.colorAccessibility.bold),t("br",null),t("strong",null,"Stor text:"),t("span",{style:{color:this.getColor(this.colorAccessibility.large)}},this.colorAccessibility.large),t("br",null),t("strong",null,"Kontrastförhållande:")," ",this.colorAccessibility.contrast)):null),t("ul",{class:"hemfixarna_categories"},t("div",null,this.customer.logo?t("div",{style:{width:"100%",display:"flex",justifyContent:"center"}},t("img",{style:{maxWidth:"250px",height:"auto",margin:"0 auto 2rem"},src:this.customer.logo.url,alt:this.customer.post_title})):null,this.showMaleri()?t("li",null,t("div",{class:"hemfixarna_categories--label hemfixarna_categories--label--big"},t("div",null,t("p",null,"Måleriverktyget"),t("span",null,"maleri")),t("div",null,t("button",{onClick:()=>navigator.clipboard.writeText("maleri")},"Kopiera ID"),this.customer.at_hemfixarna?t("button",{onClick:()=>navigator.clipboard.writeText(`${M()}/partner/${this.customer.post_name}?id=maleri`)},"Kopiera URL"):t("button",{onClick:()=>this.selectedID="maleri"},"Ladda måleri")))):null,this.customer.categories.map((n=>t("li",null,t("div",{class:"hemfixarna_categories--label hemfixarna_categories--label--big"},t("div",null,t("p",null,n.name),t("span",null,`c-${n.id}`)),t("div",null,t("button",{onClick:()=>navigator.clipboard.writeText(`c-${n.id}`)},"Kopiera ID"),this.customer.at_hemfixarna?t("button",{onClick:()=>navigator.clipboard.writeText(`${M()}/partner/${this.customer.post_name}?id=c-${n.id}`)},"Kopiera URL"):t("button",{onClick:()=>this.selectedID=`c-${n.id}`},"Ladda kategori"))),n.show_products&&n.products?t("ul",null,n.products.map((n=>t("li",null,t("div",{class:"hemfixarna_categories--label hemfixarna_product--label"},t("div",null,t("p",null,n.fields.title),t("span",null,n.fields.ID)),t("div",null,t("button",{onClick:()=>navigator.clipboard.writeText(String(n.fields.ID))},"Kopiera ID"),this.customer.at_hemfixarna?t("button",{onClick:()=>navigator.clipboard.writeText(`${M()}/partner/${this.customer.post_name}?id=${n.fields.ID}`)},"Kopiera URL"):t("button",{onClick:()=>this.selectedID=String(n.fields.ID)},"Ladda produkt"))))))):t("ul",null,n.sub_categories&&n.sub_categories.map((i=>t("li",null,t("div",{class:"hemfixarna_categories--label"},t("div",null,t("p",null,i.name),t("span",null,`c-${i.id}`)),t("div",null,t("button",{onClick:()=>navigator.clipboard.writeText(`c-${i.id}`)},"Kopiera ID"),this.customer.at_hemfixarna?t("button",{onClick:()=>navigator.clipboard.writeText(`${M()}/partner/${this.customer.post_name}?id=c-${n.id}`)},"Kopiera URL"):t("button",{onClick:()=>this.selectedID=`c-${i.id}`},"Ladda kategori"))),t("ul",null,i.products.map((n=>t("li",null,t("div",{class:"hemfixarna_categories--label hemfixarna_product--label"},t("div",null,t("p",null,n.fields.title),t("span",null,n.fields.ID)),t("div",null,t("button",{onClick:()=>navigator.clipboard.writeText(String(n.fields.ID))},"Kopiera ID"),this.customer.at_hemfixarna?t("button",{onClick:()=>navigator.clipboard.writeText(`${M()}/partner/${this.customer.post_name}?id=${n.fields.ID}`)},"Kopiera URL"):t("button",{onClick:()=>this.selectedID=String(n.fields.ID)},"Ladda produkt"))))))))))))))))):t("div",null,t("form",{onSubmit:n=>{n.preventDefault();this.handleLogin()},style:{display:"flex",flexDirection:"column",gap:"1rem",maxWidth:"300px",margin:"auto",padding:"20px",border:"1px solid #ccc",borderRadius:"5px",gridColumn:"span 2"}},t("input",{type:"password",placeholder:"Lösenord"}),t("button",{type:"submit"},"Logga in"),this.loginError&&t("span",null,"Fel lösenord")))):t("h1",{style:{textAlign:"center",margin:"auto",padding:"20px",fontSize:"24px",fontWeight:"bold",color:"red"}},"No customer found")}static get watchers(){return{buttonBg:["debouncedFunction"],buttonColor:["debouncedFunction"]}}};Y.style=X;var q=class extends Error{constructor(){super("Invalid swedish personal identity number")}};var G=(n,t)=>{const i=n.getTime()-t.getTime();return i<0?-1:i>0?1:i};var Q=(n,t)=>{const i=G(n,t);const e=Math.abs(n.getFullYear()-t.getFullYear());n.setFullYear(n.getFullYear()-i*e);const a=G(n,t)===-i;const s=i*(e-+a);return s===0?0:s};var nn=n=>{let t=0;n+="";for(let i=0,e=n.length;i<e;i++){let e=parseInt(n[i]);e*=2-i%2;if(e>9){e-=9}t+=e}return Math.ceil(t/10)*10-t};var tn=(n,t,i)=>{t-=1;const e=new Date(n,t,i);return!(e.getFullYear()!==n||e.getMonth()!==t||e.getDate()!==i)};var en=class{constructor(n,t){this._century="";this._fullYear="";this._year="";this._month="";this._day="";this._sep="";this._num="";this._check="";this.parse(n,{allowCoordinationNumber:true,allowInterimNumber:false,...t})}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(n,t){return new en(n,t)}static valid(n,t){try{en.parse(n,t);return true}catch(n){return false}}parse(n,t){if(n.length<10||n.length>13){throw new q}const i=/^(\d{2}){0,1}(\d{2})(\d{2})(\d{2})([+-]?)((?!000)\d{3}|[TRSUWXJKLMN]\d{2})(\d)$/;const e=i.exec(n);if(!e){throw new q}const a=e[1];const s=e[2];const r=e[3];const o=e[4];const l=e[5];const h=e[6];const c=e[7];if(typeof a==="undefined"||!a.length){const n=new Date;let t=0;if(l==="+"){this._sep="+";t=n.getFullYear()-100}else{this._sep="-";t=n.getFullYear()}this._century=(""+(t-(t-parseInt(s))%100)).substr(0,2)}else{this._century=a;if((new Date).getFullYear()-parseInt(a+s,10)<100){this._sep="-"}else{this._sep="+"}}this._year=s;this._fullYear=this._century+s;this._month=r;this._day=o;this._num=h;this._check=c;if(!this.valid()){throw new q}if(!(t==null?void 0:t.allowCoordinationNumber)&&this.isCoordinationNumber()){throw new q}if(!(t==null?void 0:t.allowInterimNumber)&&this.isInterimNumber()){throw new q}}valid(){const n=nn(this.year+this.month+this.day+this.num.replace(/[TRSUWXJKLMN]/,"1"))===+this.check&&!!this.check;if(n&&tn(parseInt(this.century+this.year),+this.month,+this.day)){return n}return n&&tn(parseInt(this.century+this.year),+this.month,+this.day-60)}format(n=false){if(n){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 n=this.getDate();return Q(new Date(Date.now()),n)}getDate(){let n=+this.day;if(this.isCoordinationNumber()){n-=60}const t=this.century+this.year+"-"+this.month+"-"+(n<10?"0"+n:n);return new Date(t)}isInterimNumber(){return/[TRSUWXJKLMN]/.test(this.num[0])}isCoordinationNumber(){return tn(parseInt(this.century+this.year),+this.month,+this.day-60)}isFemale(){return!this.isMale()}isMale(){const n=parseInt(this.num.substr(-1));return n%2===1}};var an=en;function sn(n,t,i){return i={path:t,exports:{},require:function(n,t){return rn()}},n(i,i.exports),i.exports}function rn(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var on=sn((function(n,t){Object.defineProperty(t,"__esModule",{value:true});t.utf8=void 0;t.utf8={encode:i,decode:e};function i(n){n=n.replace(/\r\n/g,"\n");var t="";for(var i=0;i<n.length;i++){var e=n.charCodeAt(i);if(e<128){t+=String.fromCharCode(e)}else if(e>127&&e<2048){t+=String.fromCharCode(e>>6|192);t+=String.fromCharCode(e&63|128)}else{t+=String.fromCharCode(e>>12|224);t+=String.fromCharCode(e>>6&63|128);t+=String.fromCharCode(e&63|128)}}return t}function e(n){var t="";var i=0;var e=0;var a=0;var s=0;while(i<n.length){e=n.charCodeAt(i);if(e<128){t+=String.fromCharCode(e);i++}else if(e>191&&e<224){a=n.charCodeAt(i+1);t+=String.fromCharCode((e&31)<<6|a&63);i+=2}else{a=n.charCodeAt(i+1);s=n.charCodeAt(i+2);t+=String.fromCharCode((e&15)<<12|(a&63)<<6|s&63);i+=3}}return t}}));var ln=sn((function(n,t){Object.defineProperty(t,"__esModule",{value:true});t.generate=void 0;function i(n){var t=[];var i;var e;var s;var r;var o;var l;var m;var x;var g;var v=7;var b=12;var _=17;var w=22;var y=5;var k=9;var C=14;var $=20;var z=4;var j=11;var S=16;var I=23;var T=6;var M=10;var O=15;var L=21;var D=on.utf8.encode(n);t=u(D);l=1732584193;m=4023233417;x=2562383102;g=271733878;for(i=0;i<t.length;i+=16){e=l;s=m;r=x;o=g;l=h(l,m,x,g,t[i+0],v,3614090360);g=h(g,l,m,x,t[i+1],b,3905402710);x=h(x,g,l,m,t[i+2],_,606105819);m=h(m,x,g,l,t[i+3],w,3250441966);l=h(l,m,x,g,t[i+4],v,4118548399);g=h(g,l,m,x,t[i+5],b,1200080426);x=h(x,g,l,m,t[i+6],_,2821735955);m=h(m,x,g,l,t[i+7],w,4249261313);l=h(l,m,x,g,t[i+8],v,1770035416);g=h(g,l,m,x,t[i+9],b,2336552879);x=h(x,g,l,m,t[i+10],_,4294925233);m=h(m,x,g,l,t[i+11],w,2304563134);l=h(l,m,x,g,t[i+12],v,1804603682);g=h(g,l,m,x,t[i+13],b,4254626195);x=h(x,g,l,m,t[i+14],_,2792965006);m=h(m,x,g,l,t[i+15],w,1236535329);l=c(l,m,x,g,t[i+1],y,4129170786);g=c(g,l,m,x,t[i+6],k,3225465664);x=c(x,g,l,m,t[i+11],C,643717713);m=c(m,x,g,l,t[i+0],$,3921069994);l=c(l,m,x,g,t[i+5],y,3593408605);g=c(g,l,m,x,t[i+10],k,38016083);x=c(x,g,l,m,t[i+15],C,3634488961);m=c(m,x,g,l,t[i+4],$,3889429448);l=c(l,m,x,g,t[i+9],y,568446438);g=c(g,l,m,x,t[i+14],k,3275163606);x=c(x,g,l,m,t[i+3],C,4107603335);m=c(m,x,g,l,t[i+8],$,1163531501);l=c(l,m,x,g,t[i+13],y,2850285829);g=c(g,l,m,x,t[i+2],k,4243563512);x=c(x,g,l,m,t[i+7],C,1735328473);m=c(m,x,g,l,t[i+12],$,2368359562);l=p(l,m,x,g,t[i+5],z,4294588738);g=p(g,l,m,x,t[i+8],j,2272392833);x=p(x,g,l,m,t[i+11],S,1839030562);m=p(m,x,g,l,t[i+14],I,4259657740);l=p(l,m,x,g,t[i+1],z,2763975236);g=p(g,l,m,x,t[i+4],j,1272893353);x=p(x,g,l,m,t[i+7],S,4139469664);m=p(m,x,g,l,t[i+10],I,3200236656);l=p(l,m,x,g,t[i+13],z,681279174);g=p(g,l,m,x,t[i+0],j,3936430074);x=p(x,g,l,m,t[i+3],S,3572445317);m=p(m,x,g,l,t[i+6],I,76029189);l=p(l,m,x,g,t[i+9],z,3654602809);g=p(g,l,m,x,t[i+12],j,3873151461);x=p(x,g,l,m,t[i+15],S,530742520);m=p(m,x,g,l,t[i+2],I,3299628645);l=d(l,m,x,g,t[i+0],T,4096336452);g=d(g,l,m,x,t[i+7],M,1126891415);x=d(x,g,l,m,t[i+14],O,2878612391);m=d(m,x,g,l,t[i+5],L,4237533241);l=d(l,m,x,g,t[i+12],T,1700485571);g=d(g,l,m,x,t[i+3],M,2399980690);x=d(x,g,l,m,t[i+10],O,4293915773);m=d(m,x,g,l,t[i+1],L,2240044497);l=d(l,m,x,g,t[i+8],T,1873313359);g=d(g,l,m,x,t[i+15],M,4264355552);x=d(x,g,l,m,t[i+6],O,2734768916);m=d(m,x,g,l,t[i+13],L,1309151649);l=d(l,m,x,g,t[i+4],T,4149444226);g=d(g,l,m,x,t[i+11],M,3174756917);x=d(x,g,l,m,t[i+2],O,718787259);m=d(m,x,g,l,t[i+9],L,3951481745);l=a(l,e);m=a(m,s);x=a(x,r);g=a(g,o)}return f(l)+f(m)+f(x)+f(g)}t.generate=i;function e(n,t){return n<<t|n>>>32-t}function a(n,t){var i;var e;var a;var s;var r;a=n&2147483648;s=t&2147483648;i=n&1073741824;e=t&1073741824;r=(n&1073741823)+(t&1073741823);if(i&e){return r^2147483648^a^s}if(i|e){if(r&1073741824){return r^3221225472^a^s}else{return r^1073741824^a^s}}else{return r^a^s}}function s(n,t,i){return n&t|~n&i}function r(n,t,i){return n&i|t&~i}function o(n,t,i){return n^t^i}function l(n,t,i){return t^(n|~i)}function h(n,t,i,r,o,l,h){n=a(n,a(a(s(t,i,r),o),h));return a(e(n,l),t)}function c(n,t,i,s,o,l,h){n=a(n,a(a(r(t,i,s),o),h));return a(e(n,l),t)}function p(n,t,i,s,r,l,h){n=a(n,a(a(o(t,i,s),r),h));return a(e(n,l),t)}function d(n,t,i,s,r,o,h){n=a(n,a(a(l(t,i,s),r),h));return a(e(n,o),t)}function u(n){var t;var i=n.length;var e=i+8;var a=(e-e%64)/64;var s=(a+1)*16;var r=Array(s-1);var o=0;var l=0;while(l<i){t=(l-l%4)/4;o=l%4*8;r[t]=r[t]|n.charCodeAt(l)<<o;l++}t=(l-l%4)/4;o=l%4*8;r[t]=r[t]|128<<o;r[s-2]=i<<3;r[s-1]=i>>>29;return r}function f(n){var t="";var i="";var e;var a;for(a=0;a<=3;a++){e=n>>>a*8&255;i="0"+e.toString(16);t=t+i.substr(i.length-2,2)}return t}}));var hn=sn((function(n,t){Object.defineProperty(t,"__esModule",{value:true});t.MD5=t.generate=void 0;var i=ln;Object.defineProperty(t,"generate",{enumerable:true,get:function(){return i.generate}});t.MD5={generate:ln.generate}}));const cn=async n=>{const t=await fetch(L(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:n,hash:hn.MD5.generate(String.fromCharCode(83,101,67,82,101,116)+n)})});const i=await t.json();return i};const pn=class{constructor(i){n(this,i);this.handleChangeEmail=n=>{this.emailError=null;this.email=n.target.value};this.handleChangePhone=n=>{this.phoneError=null;this.phone=n.target.value};this.handleChangessn=n=>{this.ssnError=null;this.ssn=n.target.value};this.handleSubmit=async n=>{n.preventDefault();const t=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=t.test(this.email);if(!i){this.emailError="Ange en giltig e-postadress"}const e=/^[\d\s()+-]{6,}$/.test(this.phone);if(!e){this.phoneError="Ange ett giltigt telefonnummer"}const a=an.valid(this.ssn);if(!a){this.ssnError="Ange ett giltigt personnummer"}else if(a){const n=an.parse(this.ssn).format(true);this.ssn=[n.slice(0,8),"-",n.slice(8)].join("")}if(i&&e&&a){try{const n=await cn(this.ssn);if(n){s.creditSafeUser=n;s.checkoutStep=2;s.user=Object.assign(Object.assign({},n),{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(n){this.ssnError="Vi kunde tyvärr inte hitta en address med ditt angivna personnummer";console.log(n)}finally{const n=this.el.closest(".hemfixarna_content");h(n)}}};this.render=()=>t("form",{class:"mb-2",onSubmit:n=>this.handleSubmit(n)},t("div",null,t("input",{class:`${this.email.length?"input_active":""}`,onChange:n=>this.handleChangeEmail(n),type:"email",name:"email",value:this.email}),t("label",{htmlFor:"email"},"E-post ")),this.emailError&&t("span",null,this.emailError),t("div",null,t("input",{class:`${this.phone.length?"input_active":""}`,onChange:n=>this.handleChangePhone(n),type:"tel",name:"phone",value:this.phone}),t("label",{htmlFor:"phone"},"Mobiltelefon ")),this.phoneError&&t("span",null,this.phoneError),t("div",null,t("input",{class:`${this.ssn.length?"input_active":""}`,onChange:n=>this.handleChangessn(n),type:"tel",name:"ssn",value:this.ssn}),t("label",{htmlFor:"phone"},"Personnummer*")),this.ssnError&&t("span",null,this.ssnError),t("input",{type:"submit",value:"Fortsätt*"}),t("p",null,"*Vi hämtar din adress"));this.email="";this.emailError=null;this.phone="";this.phoneError=null;this.ssn="";this.ssnError=null}componentWillLoad(){if(s.user){this.email=s.user.email;this.phone=s.user.phone;this.ssn=s.user.ssn}}get el(){return i(this)}};const dn=class{constructor(t){n(this,t);this.logo=a(`./assets/hemfixarna.svg`)}render(){var n,i;const r=a(`./assets/checked.svg`);return t("div",{class:"hemfixarna_info"},s.step<5?t(e,null,t("h2",null,s.customer.info_title),t("p",null,s.customer.info_text)):t("h2",null,s.customer.checkout_title),t("ul",{class:"hemfixarna_features"},s.step<5?t(e,null,((n=s.customer.trust_badges)===null||n===void 0?void 0:n.length)?t(e,null,s.customer.trust_badges.map((n=>t("li",{key:n.text},t("img",{src:r,alt:"checked"}),t("p",null,n.text))))):t(e,null,s.options.trust.map((n=>t("li",{key:n.trust_badge},t("img",{src:r,alt:"checked"}),t("p",null,n.trust_badge)))))):t(e,null,(i=s.customer.checkout_trust_badges)===null||i===void 0?void 0:i.map((n=>t("li",{key:n.text},t("img",{src:r,alt:"checked"}),t("p",null,n.text)))))),t("img",{src:this.logo,width:200,alt:"hemfixarna"}),t("a",{class:"hemfixarna_product--link",target:"_blank",href:s.options.link.url},s.options.link.title))}};const un=':host .invoice{gap:16px;display:grid}:host .invoice form>span{text-align:center;padding:16px 0}:host .invoice img{right:unset;left:unset;position:initial;transform:none}:host .invoice label{cursor:pointer;font-size:14px;display:flex;align-items:flex-start;padding:16px 0}:host .invoice label input{margin:0 5px 0 0;accent-color:#ea662c}:host .invoice-preview{display:flex;gap:4px}:host .invoice-preview div{position:relative}:host .invoice-preview div button{position:absolute;top:0;right:0;padding:0}:host .invoice-preview div button img{width:24px;height:24px}:host .invoice-preview div>img{width:100px;height:80px;object-fit:cover}:host .invoice input[type=email],:host .invoice input[type=tel],:host .invoice textarea{padding:16px;border:1px solid #fcd9c9;font-size:16px}:host .invoice textarea{resize:none;height:200px;font-family:"Inter", sans-serif}:host .invoice div:has(>input[type=file]){display:flex;align-items:center;justify-content:center;cursor:pointer;background:#fff;border:1px solid #fcd9c9;padding:32px 16px;gap:16px}:host .invoice div:has(>input[type=file]) span{color:#000;font-size:12px}:host .invoice input[type=file]{display:none}';const fn=`${M()}/wp-json/headless`;const mn=class{constructor(t){n(this,t);this.formError=null;this.displayImages=[];this.formImages=[];this.formState="initial"}isValidEmail(n){const t=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return t.test(n)}componentDidRender(){const n=this.el.querySelector("form");if(n){n.addEventListener("input",(()=>{this.formError=null}))}}disconnectedCallback(){const n=this.el.querySelector("form");if(n){n.removeEventListener("input",(()=>{this.formError=null}))}}async submit(n){var t;n.preventDefault();this.formState="loading";this.formError=null;const i=n.currentTarget.elements;const e={description:i.descriptionInput.value.length?i.descriptionInput.value:null,email:i.emailInput.value.length?i.emailInput.value:null,tel:i.telInput.value.length?i.telInput.value:null,terms:(t=i.termsInput)===null||t===void 0?void 0:t.checked};if(!e.description){this.formError="Vänligen fyll i formulärtexten";this.formState="initial";return}if(!e.email||!this.isValidEmail(e.email)){this.formError="Vänligen ange en giltig e-postadress";this.formState="initial";return}if(!e.tel){this.formError="Vänligen ange ditt telefonnummer";this.formState="initial";return}if(s.selectedProduct.terms_show_checkbox&&!e.terms){this.formError="Vänligen acceptera villkoren";this.formState="initial";return}const a=new FormData;a.append("text",e.description);a.append("email",e.email);a.append("phone",e.tel);a.append("customer",s.business);this.formImages.forEach((n=>{a.append("images[]",n)}));a.append("product",JSON.stringify({title:s.selectedProduct.title,amount:1,has_rut:s.selectedProduct.rut,has_rot:s.selectedProduct.rot,has_green:s.selectedProduct.green,ID:s.selectedProduct.ID,parts:[]}));try{const n=await fetch(`${fn}/saveinvoiceproduct`,{method:"POST",body:a});const{response:t}=await n.json();if(t.code===200){s.checkoutInvoice=true;s.step=6}else{this.formError="Vi kan inte ta emot din beställning just nu";this.formState="initial"}}catch(n){this.formError="Vi kan inte ta emot din beställning just nu";this.formState="initial"}}handleImageDrop(n){n.preventDefault();const t=n.dataTransfer.files;for(let n=0;n<t.length;n++){const i=t[n];if(i.type.startsWith("image/")){const n=new FileReader;n.onload=()=>{this.displayImages=[...this.displayImages,n.result];this.formImages=[...this.formImages,i]};n.readAsDataURL(i)}}}handleFileInputChange(n){n.preventDefault();const t=n.target.files;for(let n=0;n<t.length;n++){const i=t[n];if(i.type.startsWith("image/")){const n=new FileReader;n.onload=()=>{this.displayImages=[...this.displayImages,n.result];this.formImages=[...this.formImages,i]};n.readAsDataURL(i)}}}handleImageClick(){this.el.querySelector(".hemfixarna-file-upload").click()}preventDragOver(n){n.preventDefault()}removeImage(n){this.displayImages=this.displayImages.filter(((t,i)=>i!==n));this.formImages=this.formImages.filter(((t,i)=>i!==n))}render(){var n;const i=a(`./assets/drag-drop.svg`);return t("div",{class:"invoice"},((n=s.selectedProduct)===null||n===void 0?void 0:n.invoice_description)?t("p",null,s.selectedProduct.invoice_description):null,t("form",{onSubmit:n=>this.submit(n)},t("textarea",{name:"descriptionInput",placeholder:"Beskriv ditt ärende"}),t("div",{role:"button","aria-label":"upload image",onDragOver:n=>this.preventDragOver(n),onDrop:n=>this.handleImageDrop(n),onClick:()=>this.handleImageClick()},t("img",{src:i,alt:"hemfixarna_logo",width:24}),t("div",null,t("p",null,"Bifoga ev bilder"),t("span",null,"(dra bilder hit)")),t("input",{onChange:n=>this.handleFileInputChange(n),class:"hemfixarna-file-upload",accept:"image/*",type:"file",multiple:true,name:"fileInput"})),t("div",{class:"invoice-preview"},this.displayImages.map(((n,i)=>t("div",{key:i},t("img",{src:n,alt:"uploaded image"}),t("button",{onClick:()=>this.removeImage(i)},t("img",{src:a(`./assets/close.svg`),alt:"close"})))))),t("input",{placeholder:"E-post",type:"email",name:"emailInput"}),t("input",{placeholder:"Telefonnummer",type:"tel",name:"telInput"}),s.selectedProduct.terms_show_checkbox?t("label",null,t("input",{type:"checkbox",name:"termsInput"}),s.selectedProduct.terms):null,this.formError?t("span",null,this.formError):null,t("input",{type:"submit",value:this.formState==="loading"?"Skickar":"Kontakta mig"})))}get el(){return i(this)}};mn.style=un;const xn=class{constructor(i){n(this,i);this.render=()=>t("div",{style:{background:`url(${s.options.thank_you_image})`},class:"hemfixarna_order"},t("div",null),t("div",null,t("h2",null,s.checkoutInvoice?"Tack för din förfrågan":"Tack för din bokning"),s.checkoutInvoice?t("p",null,"Vi återkommer inom kort till dig på angivet telefonnummer eller epost"):null,s.checkoutInvoice?t("div",null):t("hemfixarna-orderrows",{cart:false}),t("span",{onClick:()=>this.resetShop()},t("button",null,"Gör en ny bokning")),t("hemfixarna-info",null)))}resetShop(){s.step=1;s.cart=[];s.selectedCategory=null;s.selectedService=null;s.selectedProduct=null;s.maleri=null;s.checkoutStep=1}disconnectedCallback(){this.resetShop()}};const gn=class{constructor(t){n(this,t);this.cart=true}goToProduct(n){const t=s.customer.categories.map((n=>n.show_products?n.products:n.sub_categories?n.sub_categories.map((n=>n.products)):[])).flat().flat();const i=t.find((t=>t&&t.fields.ID===n));if(i){s.selectedProduct=i.fields;s.step=4}}openModal(n,t){s.modal={title:n,text:t}}getDiscountedInfo(n){if(n.rut&&s.rut){return" (efter RUT-avdrag)"}else if(n.rot&&s.rot){return" (efter ROT-avdrag)"}else if(n.green&&s.green){return" (efter Grön teknik avdrag)"}else{return""}}renderStartFees(){const n=new Set;const i=[];s.cart.forEach((t=>{const e=t.start_fee_obj;if(e&&!n.has(e.ID)){n.add(e.ID);const a=t.rot?v().rot:0;const s=t.rut?v().rut:0;const r=t.green?v().green:0;i.push({id:e.ID,name:e.title,price:e.price,text:e.pop_up,rot:a,rut:s,green:r})}}));return i.map((n=>t("div",{key:n.id,class:"hemfixarna_cart--startfee"},t("p",{onClick:()=>this.openModal(n.name,n.text)},t("strong",null,n.name),t("img",{height:16,src:a("./assets/info.svg"),alt:"info monteringsavgift"})),t("p",null,!n.rut&&!n.rot&&!n.green&&t("span",null,n.price,"kr"),n.rut>0&&t("span",null,n.rut,"kr (RUT)"),n.rot>0&&t("span",null,n.rot,"kr (ROT)"),n.green>0&&t("span",null,n.green,"kr (Grön teknik)")))))}render(){return t(e,null,t("ul",{class:"hemfixarna_cart--items"},Object.entries(g(s.cart)).map((([n,i])=>t("li",{key:n,class:"hemfixarna_cart--group"},t("ul",null,i.map((n=>{var i;return t("li",{class:"hemfixarna_cart--item",key:n.id},t("div",null,t("div",null,n.icon&&t("img",{width:30,src:(i=n.icon.url)!==null&&i!==void 0?i:n.icon,alt:n.name}),t("p",null,t("strong",null,n.amount,"x "),n.name)),this.cart&&t("button",{onClick:()=>this.goToProduct(n.id)},"Ändra")),t("p",null,t("strong",null,f(n,n.price,n.amount),"kr"),t("span",null,this.getDiscountedInfo(n))),n.parts.length>0&&t("ul",null,n.parts.map((i=>t("li",{key:i.name},t("p",null,t("strong",null,i.amount,"x "),i.name),t("p",null,t("strong",null,x(i,n,i.amount),"kr")))))))}))))))),t("div",{class:"hemfixarna_cart--additional"},this.renderStartFees(),this.cart&&s.cart.find((n=>n.rot))&&t("div",{class:"hemfixarna_cart--rutrot"},t("div",null,t("label",{class:"switch"},t("input",{checked:s.rot,onChange:()=>s.rot=!s.rot,type:"checkbox"}),t("span",{class:"slider"})),t("p",null,"ROT-avdrag")),t("p",null,"(-",s.rot?_():0,"kr)")),this.cart&&s.cart.find((n=>n.rut))&&t("div",{class:"hemfixarna_cart--rutrot"},t("div",null,t("label",{class:"switch"},t("input",{onChange:()=>s.rut=!s.rut,checked:s.rut,type:"checkbox"}),t("span",{class:"slider"})),t("p",null,"RUT-avdrag")),t("p",null,"(-",s.rut?w():0,"kr)")),this.cart&&s.cart.find((n=>n.green))&&t("div",{class:"hemfixarna_cart--rutrot"},t("div",null,t("label",{class:"switch"},t("input",{onChange:()=>s.green=!s.green,checked:s.green,type:"checkbox"}),t("span",{class:"slider"})),t("p",null,"Grön teknik avdrag")),t("p",null,"(-",s.green?y():0,"kr)"))),t("div",{class:"hemfixarna_cart--price"},t("h2",null,"Totalbelopp: "),t("h2",null,k(),"kr")))}};const vn="";const bn=class{constructor(t){n(this,t);this.amount=0;this.hideDescription=true}addProduct(){const n=s.cart.find((n=>n.id===s.selectedProduct.ID));if(n){n.amount++;s.cart=[...s.cart]}else{s.cart=[...s.cart,{id:s.selectedProduct.ID,rut:s.selectedProduct.rut,rot:s.selectedProduct.rot,green:s.selectedProduct.green,amount:1,parts:[],price:s.selectedProduct.price,name:s.selectedProduct.title,start_fee:!s.selectedProduct.hide_start_fee,terms_checkout:s.selectedProduct.terms_checkout,icon:s.selectedProduct.icon,start_fee_obj:s.selectedProduct.start_fee_obj}]}}removeProduct(){const n=s.cart.find((n=>n.id===s.selectedProduct.ID));if(n&&n.amount>1){n.amount--;s.cart=[...s.cart]}else{s.cart=s.cart.filter((n=>n.id!==s.selectedProduct.ID))}}addPart(n){var t;const i=s.cart.find((n=>n.id===s.selectedProduct.ID));if(i){const e=i.parts.find((t=>t.id===n.ID));if(e){e.amount++;i.parts=[...i.parts]}else{i.parts=[...i.parts,{id:n.ID,amount:1,price:n.price,name:(t=n.title)!==null&&t!==void 0?t:n.title}]}s.cart=[...s.cart.filter((n=>n.id!==i.id)),i]}}removePart(n){const t=s.cart.find((n=>n.id===s.selectedProduct.ID));if(t){const i=t.parts.find((t=>t.id===n.ID));if(i&&i.amount>1){i.amount--;t.parts=[...t.parts]}else{t.parts=t.parts.filter((t=>t.id!==n.ID))}s.cart=[...s.cart.filter((n=>n.id!==t.id)),t]}}goToCart(){const n=s.cart.find((n=>n.id===s.selectedProduct.ID));if(n){s.step=5;const n=this.el.closest(".hemfixarna_content");h(n)}}getAmount(){var n;return((n=s.cart.find((n=>n.id===s.selectedProduct.ID)))===null||n===void 0?void 0:n.amount)||0}getPartAmount(n){var t;const i=s.cart.find((n=>n.id===s.selectedProduct.ID));return((t=i===null||i===void 0?void 0:i.parts.find((t=>t.id===n)))===null||t===void 0?void 0:t.amount)||0}getTotalPrice(){let n=0;const t=s.cart.find((n=>n.id===s.selectedProduct.ID));if(t){const i=t.parts.reduce(((n,t)=>{const i=s.selectedProduct.parts.find((n=>n.ID===t.id));if(i){return n+i.price*t.amount}return n}),0);n=s.selectedProduct.price*t.amount+i}else{n=s.selectedProduct.price}return f(s.selectedProduct,n)}componentDidRender(){const n=document.createElement("link");n.setAttribute("rel","stylesheet");n.setAttribute("href","https://painting-frontend.vercel.app/static/css/main.css");const t=document.createElement("link");t.setAttribute("rel","stylesheet");t.setAttribute("href","https://painting-frontend.vercel.app/fonts.css");const i=()=>{const e=this.el.getElementsByTagName("hemfixare-calculator");if(e.length>0&&e[0].shadowRoot!==null){e[0].shadowRoot.appendChild(n);e[0].shadowRoot.appendChild(t)}else{setTimeout(i,1)}};i()}render(){var n,i,o,l;const h=a(`./assets/checked.svg`);const c=a(`./assets/plus.svg`);const p=a(`./assets/minus.svg`);if(s.maleri){return t("div",{class:"hemfixarna_painting"},t("script",{type:"text/javascript",src:["localhost","vercel"].some((n=>window.location.href.includes(n)))?"https://painting-dev.vercel.app/static/js/main.js":"https://painting-frontend.vercel.app/static/js/main.js",defer:true,async:true}),t("hemfixare-calculator",{title:s.options.maleri_title,subtitle:s.options.maleri_text,modal:"true",customer:s.business===r.string?"string":s.business}))}return s.selectedProduct?t("div",{class:"hemfixarna_product"},t("div",{class:"hemfixarna_product--top"},s.selectedProduct.icon&&t("img",{width:80,src:(n=s.selectedProduct.icon.url)!==null&&n!==void 0?n:s.selectedProduct.icon,alt:s.selectedProduct.title}),t("div",null,t("h1",null,s.selectedProduct.title),!s.selectedProduct.invoice?t("h2",null,f(s.selectedProduct)," kr/st"):t("h2",null,s.selectedProduct.invoice_price))),t("div",{class:"hemfixarna_product--grid"},t("div",{class:"hemfixarna_product--left"},((i=s.selectedProduct.list)===null||i===void 0?void 0:i.length)&&t("ul",{class:"hemfixarna_features"},s.selectedProduct.list.map((n=>t("li",{key:n.bullet},t("img",{src:h,alt:"checked"}),t("p",null,n.bullet))))),s.selectedProduct.description&&t("p",{onClick:()=>this.hideDescription=false,class:`hemfixarna_description ${this.hideDescription?"hemfixarna_description--hidden":""}`,innerHTML:s.selectedProduct.description})),t("div",{class:"hemfixarna_product--right"},s.selectedProduct.invoice?t("hemfixarna-invoice",null):t(e,null,t("ul",null,t("li",{class:"hemfixarna_product--item"},t("div",null,t("p",null,s.selectedProduct.title),t("p",{class:"hemfixarna_product--price"},f(s.selectedProduct),"kr/st")),t("div",{class:"hemfixarna_counter"},t("img",{class:`${this.getAmount()===0?"disabled":""}`,src:p,onClick:()=>this.removeProduct()}),t("span",null,this.getAmount()),t("img",{src:c,onClick:()=>this.addProduct()}))),((o=s.selectedProduct.parts)===null||o===void 0?void 0:o.length)&&s.selectedProduct.parts.map((n=>{var i;return t("li",{class:"hemfixarna_part"},t("div",null,t("p",null,(i=n.title)!==null&&i!==void 0?i:n.title),t("p",{class:"hemfixarna_product--price"},x(n,s.selectedProduct),"kr/st")),t("div",{class:"hemfixarna_counter"},t("img",{class:`${this.getPartAmount(n.ID)===0?"disabled":""}`,src:p,onClick:()=>this.removePart(n)}),t("span",null,this.getPartAmount(n.ID)),t("img",{class:`${this.getAmount()===0?"disabled":""}`,src:c,onClick:()=>this.addPart(n)})))}))),t("h4",{class:"hemfixarna_product--total"},"Totalt ",this.getTotalPrice()," kr"),t("button",{onClick:()=>this.goToCart(),class:`hemfixarna_buy ${this.getAmount()===0?"disabled":""}`},"Fortsätt")),!s.selectedProduct.hide_start_fee&&((l=s.selectedProduct.start_fee_obj)===null||l===void 0?void 0:l.title)&&t("p",{class:"hemfixarna_terms"},t("strong",null,s.selectedProduct.start_fee_obj.title),t("br",null),t("span",{innerHTML:s.selectedProduct.start_fee_obj.description})),s.options&&t("hemfixarna-info",null)))):null}get el(){return i(this)}};bn.style=vn;const _n=class{constructor(t){n(this,t);this.tree=undefined;this.slug=undefined}isMainCategory(n){return n.show_products!==undefined}handleMaleriClick(){s.step=4;s.maleri=true}render(){var n;const i=a("./assets/gubbe-pensel.svg");return s.customer?t("div",null,t("h2",null,s.selectedCustomerCategory?s.selectedCustomerCategory.name:"Alla tjänster"),t("div",{class:"hemfixarna_categories--wrapper"},t("ul",{class:"hemfixarna_categories"},((n=s.selectedCustomerCategory)===null||n===void 0?void 0:n.add_painting)?t("button",{onClick:()=>this.handleMaleriClick(),class:"hemfixarna_maleribox"},t("img",{height:64,src:i,alt:"Måleri Logotyp"}),t("p",null,"Beräkna fast pris på måleri & tapetsering här")):null,s.selectedCustomerCategory?this.isMainCategory(s.selectedCustomerCategory)&&s.selectedCustomerCategory.sub_categories&&!s.selectedCustomerCategory.show_products?s.selectedCustomerCategory.sub_categories.map((n=>t("hemfixarna-box",{category:n}))):s.selectedCustomerCategory.products?s.selectedCustomerCategory.products.map((n=>t("hemfixarna-box",{category:n.fields}))):null:s.customer.categories.map((n=>t("hemfixarna-box",{category:n})))),t("hemfixarna-info",null))):t("div",null,t("h2",null,"Alla tjänster"),t("div",{class:"hemfixarna_categories--wrapper"},t("ul",{class:"hemfixarna_categories"},this.tree.sub_cats.sort(((n,t)=>n.name<t.name?-1:1)).map((n=>{var i;return t("hemfixarna-box",{post:n,icon:(i=n.icon.url)!==null&&i!==void 0?i:n.icon,postTitle:n.name})}))),t("hemfixarna-info",null)))}};export{c as hemfixarna_address,z as hemfixarna_box,j as hemfixarna_breadcrumbs,S as hemfixarna_cart,U as hemfixarna_checkout,J as hemfixarna_component,Z as hemfixarna_contact,Y as hemfixarna_demo,pn as hemfixarna_getuser,dn as hemfixarna_info,mn as hemfixarna_invoice,xn as hemfixarna_order,gn as hemfixarna_orderrows,bn as hemfixarna_product,_n as hemfixarna_start};
|
2
|
+
//# sourceMappingURL=p-6aed6e88.entry.js.map
|