@postnord/pn-marketweb-components 1.0.4 → 1.0.8
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/cjs/convert-57b3dd5e.js +1730 -0
- package/cjs/{index-0f43b450.js → index-b58d2618.js} +82 -0
- package/cjs/index-f472d191.js +181 -0
- package/cjs/loader.cjs.js +2 -2
- package/cjs/pn-choice-button_2.cjs.entry.js +78 -0
- package/cjs/pn-find-service-and-price-store-56d8b760.js +23 -0
- package/cjs/pn-find-service-and-price.cjs.entry.js +263 -0
- package/cjs/pn-language-selector_9.cjs.entry.js +646 -0
- package/cjs/pn-mainnav-link.cjs.entry.js +45 -0
- package/cjs/pn-mainnav-store-dda9827f.js +18 -0
- package/cjs/pn-market-web-components.cjs.js +2 -2
- package/cjs/pn-marketweb-sitefooter.cjs.entry.js +145 -0
- package/cjs/{pn-siteheader.cjs.entry.js → pn-marketweb-siteheader.cjs.entry.js} +8 -8
- package/cjs/pn-product-pricelist-result.cjs.entry.js +45 -0
- package/cjs/pn-product-pricelist-store-e4f8503b.js +20 -0
- package/cjs/pn-product-pricelist.cjs.entry.js +219 -0
- package/cjs/pn-product-tile_3.cjs.entry.js +49 -0
- package/cjs/pn-site-footer_2.cjs.entry.js +36 -0
- package/collection/collection-manifest.json +22 -3
- package/collection/components/input/pn-choice-button/choice-button.stories.js +34 -0
- package/collection/components/input/pn-choice-button/pn-choice-button.css +66 -0
- package/collection/components/input/pn-choice-button/pn-choice-button.js +170 -0
- package/collection/components/layout-components/pn-marketweb-sitefooter/pn-marketweb-sitefooter-types.js +10 -0
- package/collection/components/layout-components/pn-marketweb-sitefooter/pn-marketweb-sitefooter.css +0 -0
- package/collection/components/layout-components/pn-marketweb-sitefooter/pn-marketweb-sitefooter.js +166 -0
- package/collection/components/layout-components/pn-marketweb-sitefooter/pn-marketweb-sitefooter.stories.js +54 -0
- package/collection/components/layout-components/{pn-siteheader → pn-marketweb-sitefooter}/translations.js +0 -0
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-login.css +34 -0
- package/collection/components/layout-components/{pn-siteheader/pn-siteheader-login.js → pn-marketweb-siteheader/pn-marketweb-siteheader-login.js} +6 -6
- package/collection/components/layout-components/{pn-siteheader/pn-siteheader-loginmanager.js → pn-marketweb-siteheader/pn-marketweb-siteheader-loginmanager.js} +0 -0
- package/collection/components/layout-components/{pn-siteheader/pn-siteheader-search.css → pn-marketweb-siteheader/pn-marketweb-siteheader-search.css} +0 -0
- package/collection/components/layout-components/{pn-siteheader/pn-siteheader-search.js → pn-marketweb-siteheader/pn-marketweb-siteheader-search.js} +5 -6
- package/collection/components/layout-components/{pn-siteheader/pn-siteheader-types.js → pn-marketweb-siteheader/pn-marketweb-siteheader-types.js} +0 -0
- package/collection/components/layout-components/{pn-siteheader/pn-siteheader.css → pn-marketweb-siteheader/pn-marketweb-siteheader.css} +21 -21
- package/collection/components/layout-components/{pn-siteheader/pn-siteheader.js → pn-marketweb-siteheader/pn-marketweb-siteheader.js} +7 -7
- package/collection/components/layout-components/{pn-siteheader/pn-siteheader.stories.js → pn-marketweb-siteheader/pn-marketweb-siteheader.stories.js} +2 -2
- package/collection/components/layout-components/pn-marketweb-siteheader/translations.js +47 -0
- package/collection/components/navigation/pn-language-selector/language-selector.stories.js +43 -0
- package/collection/components/navigation/pn-language-selector/pn-language-selector-option.css +74 -0
- package/collection/components/navigation/pn-language-selector/pn-language-selector-option.js +148 -0
- package/collection/components/navigation/pn-language-selector/pn-language-selector-types.js +1 -0
- package/collection/components/navigation/pn-language-selector/pn-language-selector.css +32 -0
- package/collection/components/navigation/pn-language-selector/pn-language-selector.js +92 -0
- package/collection/components/navigation/pn-language-selector/translations.js +17 -0
- package/collection/components/navigation/pn-mainnav/main-nav.stories.js +92 -0
- package/collection/components/navigation/pn-mainnav/pn-main-nav-mockdata.js +5851 -0
- package/collection/components/navigation/pn-mainnav/pn-mainnav-level.css +139 -0
- package/collection/components/navigation/pn-mainnav/pn-mainnav-level.js +93 -0
- package/collection/components/navigation/pn-mainnav/pn-mainnav-link.css +221 -0
- package/collection/components/navigation/pn-mainnav/pn-mainnav-link.js +126 -0
- package/collection/components/navigation/pn-mainnav/pn-mainnav-list.css +51 -0
- package/collection/components/navigation/pn-mainnav/pn-mainnav-list.js +46 -0
- package/collection/components/navigation/pn-mainnav/pn-mainnav-store.js +14 -0
- package/collection/components/navigation/pn-mainnav/pn-mainnav.css +100 -0
- package/collection/components/navigation/pn-mainnav/pn-mainnav.js +200 -0
- package/collection/components/navigation/pn-mainnav/translations.js +32 -0
- package/collection/components/navigation/pn-mainnav/types.js +1 -0
- package/collection/components/navigation/pn-site-footer/pn-site-footer-col.css +20 -0
- package/collection/components/navigation/pn-site-footer/pn-site-footer-col.js +14 -0
- package/collection/components/navigation/pn-site-footer/pn-site-footer.css +72 -0
- package/collection/components/navigation/pn-site-footer/pn-site-footer.js +50 -0
- package/collection/components/navigation/pn-site-footer/site-footer.stories.js +87 -0
- package/collection/components/navigation/pn-site-selector/pn-site-selector-i18n.js +18 -0
- package/collection/components/navigation/pn-site-selector/pn-site-selector-item.css +62 -0
- package/collection/components/navigation/pn-site-selector/pn-site-selector-item.js +103 -0
- package/collection/components/navigation/pn-site-selector/pn-site-selector-types.js +1 -0
- package/collection/components/navigation/pn-site-selector/pn-site-selector.css +29 -0
- package/collection/components/navigation/pn-site-selector/pn-site-selector.js +96 -0
- package/collection/components/navigation/pn-site-selector/site-selector.stories.js +35 -0
- package/collection/components/widgets/pn-find-service-and-price/data.js +53 -0
- package/collection/components/widgets/pn-find-service-and-price/find-service-and-price.stories.js +27 -0
- package/collection/components/widgets/pn-find-service-and-price/libs/convertnode.js +58 -0
- package/collection/components/widgets/pn-find-service-and-price/pn-find-service-and-price-result.css +0 -0
- package/collection/components/widgets/pn-find-service-and-price/pn-find-service-and-price-result.js +101 -0
- package/collection/components/widgets/pn-find-service-and-price/pn-find-service-and-price-store.js +20 -0
- package/collection/components/widgets/pn-find-service-and-price/pn-find-service-and-price-translations.js +71 -0
- package/collection/components/widgets/pn-find-service-and-price/pn-find-service-and-price-types.js +1 -0
- package/collection/components/widgets/pn-find-service-and-price/pn-find-service-and-price.css +56 -0
- package/collection/components/widgets/pn-find-service-and-price/pn-find-service-and-price.js +236 -0
- package/collection/components/widgets/pn-find-service-and-price/runconvert.js +2 -0
- package/collection/components/widgets/pn-product-pricelist/data.js +53 -0
- package/collection/components/widgets/pn-product-pricelist/libs/convert.js +43 -0
- package/collection/components/widgets/pn-product-pricelist/libs/convertnode.js +58 -0
- package/collection/components/widgets/pn-product-pricelist/pn-product-pricelist-result.css +0 -0
- package/collection/components/widgets/pn-product-pricelist/pn-product-pricelist-result.js +101 -0
- package/collection/components/widgets/pn-product-pricelist/pn-product-pricelist-store.js +17 -0
- package/collection/components/widgets/pn-product-pricelist/pn-product-pricelist-translations.js +56 -0
- package/collection/components/widgets/pn-product-pricelist/pn-product-pricelist-types.js +1 -0
- package/collection/components/widgets/pn-product-pricelist/pn-product-pricelist.css +55 -0
- package/collection/components/widgets/pn-product-pricelist/pn-product-pricelist.js +231 -0
- package/collection/components/widgets/pn-product-pricelist/pn-product-pricelist.stories.js +35 -0
- package/collection/components/widgets/pn-product-pricelist/runconvert.js +2 -0
- package/collection/components/widgets/pn-product-tile/pn-product-tile-info.css +3 -0
- package/collection/components/widgets/pn-product-tile/pn-product-tile-info.js +70 -0
- package/collection/components/widgets/pn-product-tile/pn-product-tile-price.css +23 -0
- package/collection/components/widgets/pn-product-tile/pn-product-tile-price.js +94 -0
- package/collection/components/widgets/pn-product-tile/pn-product-tile.css +48 -0
- package/collection/components/widgets/pn-product-tile/pn-product-tile.js +21 -0
- package/collection/components/widgets/pn-product-tile/product-tile.stories.js +50 -0
- package/collection/globals/shared/productprice/convert.js +43 -0
- package/collection/globals/shared/productprice/product-price-types.js +1 -0
- package/custom-elements/index.d.ts +126 -12
- package/custom-elements/index.js +3179 -24
- package/esm/convert-b49a0857.js +1728 -0
- package/esm/{index-1e3839a0.js → index-52dc19ca.js} +79 -1
- package/esm/index-7c277874.js +179 -0
- package/esm/loader.js +2 -2
- package/esm/pn-choice-button_2.entry.js +73 -0
- package/esm/pn-find-service-and-price-store-d02cbfe1.js +21 -0
- package/esm/pn-find-service-and-price.entry.js +259 -0
- package/esm/pn-language-selector_9.entry.js +634 -0
- package/esm/pn-mainnav-link.entry.js +41 -0
- package/esm/pn-mainnav-store-a0726338.js +15 -0
- package/esm/pn-market-web-components.js +2 -2
- package/esm/pn-marketweb-sitefooter.entry.js +141 -0
- package/esm/{pn-siteheader.entry.js → pn-marketweb-siteheader.entry.js} +8 -8
- package/esm/pn-product-pricelist-result.entry.js +41 -0
- package/esm/pn-product-pricelist-store-6259b354.js +18 -0
- package/esm/pn-product-pricelist.entry.js +215 -0
- package/esm/pn-product-tile_3.entry.js +43 -0
- package/esm/pn-site-footer_2.entry.js +31 -0
- package/esm-es5/convert-b49a0857.js +13 -0
- package/esm-es5/index-52dc19ca.js +1 -0
- package/esm-es5/index-7c277874.js +1 -0
- package/esm-es5/loader.js +1 -1
- package/esm-es5/pn-choice-button_2.entry.js +1 -0
- package/esm-es5/pn-find-service-and-price-store-d02cbfe1.js +1 -0
- package/esm-es5/pn-find-service-and-price.entry.js +1 -0
- package/esm-es5/pn-language-selector_9.entry.js +1 -0
- package/esm-es5/pn-mainnav-link.entry.js +1 -0
- package/esm-es5/pn-mainnav-store-a0726338.js +1 -0
- package/esm-es5/pn-market-web-components.js +1 -1
- package/esm-es5/pn-marketweb-sitefooter.entry.js +1 -0
- package/esm-es5/pn-marketweb-siteheader.entry.js +1 -0
- package/esm-es5/pn-product-pricelist-result.entry.js +1 -0
- package/esm-es5/pn-product-pricelist-store-6259b354.js +1 -0
- package/esm-es5/pn-product-pricelist.entry.js +1 -0
- package/esm-es5/pn-product-tile_3.entry.js +1 -0
- package/esm-es5/pn-site-footer_2.entry.js +1 -0
- package/package.json +6 -3
- package/pn-market-web-components/p-05d06f7f.system.js +1 -0
- package/pn-market-web-components/p-0a756d7d.system.entry.js +1 -0
- package/pn-market-web-components/p-21e0e386.js +13 -0
- package/pn-market-web-components/p-27502f43.system.entry.js +1 -0
- package/pn-market-web-components/p-3ae134bf.system.entry.js +1 -0
- package/pn-market-web-components/p-3ae74105.system.entry.js +1 -0
- package/pn-market-web-components/p-43bb8707.system.js +1 -0
- package/pn-market-web-components/p-46018354.system.js +1 -0
- package/pn-market-web-components/p-4b4ee8d5.system.entry.js +1 -0
- package/pn-market-web-components/p-4bf9a9ff.js +1 -0
- package/pn-market-web-components/p-57a1db89.system.entry.js +1 -0
- package/pn-market-web-components/p-5f1ad0b7.entry.js +1 -0
- package/pn-market-web-components/p-62700d6e.system.js +1 -0
- package/pn-market-web-components/p-7331d3bb.system.js +1 -0
- package/pn-market-web-components/p-80fd4dd9.system.entry.js +1 -0
- package/pn-market-web-components/p-91624bd5.system.js +13 -0
- package/pn-market-web-components/p-926fc962.js +1 -0
- package/pn-market-web-components/p-986d3894.entry.js +1 -0
- package/pn-market-web-components/p-a04d0ba4.entry.js +1 -0
- package/pn-market-web-components/p-a5179982.system.entry.js +1 -0
- package/pn-market-web-components/p-af861bb5.js +1 -0
- package/pn-market-web-components/p-b129cc27.system.js +1 -0
- package/pn-market-web-components/p-b4904bdb.system.entry.js +1 -0
- package/pn-market-web-components/p-ba704cbf.entry.js +1 -0
- package/pn-market-web-components/p-ba8e9dfe.entry.js +1 -0
- package/pn-market-web-components/p-be245b29.entry.js +1 -0
- package/pn-market-web-components/p-bfc523fc.js +1 -0
- package/pn-market-web-components/p-ce136600.js +1 -0
- package/pn-market-web-components/p-d3590589.entry.js +1 -0
- package/pn-market-web-components/p-e367b055.system.entry.js +1 -0
- package/pn-market-web-components/p-e377410f.entry.js +1 -0
- package/pn-market-web-components/p-ec95bda3.entry.js +1 -0
- package/pn-market-web-components/p-fee1d1c9.entry.js +1 -0
- package/pn-market-web-components/pn-market-web-components.esm.js +1 -1
- package/pn-market-web-components/pn-market-web-components.js +1 -1
- package/types/components/input/pn-choice-button/pn-choice-button.d.ts +20 -0
- package/types/components/layout-components/pn-marketweb-sitefooter/pn-marketweb-sitefooter-types.d.ts +21 -0
- package/types/components/layout-components/pn-marketweb-sitefooter/pn-marketweb-sitefooter.d.ts +23 -0
- package/types/components/layout-components/{pn-siteheader → pn-marketweb-sitefooter}/translations.d.ts +0 -0
- package/types/components/layout-components/{pn-siteheader/pn-siteheader-login.d.ts → pn-marketweb-siteheader/pn-marketweb-siteheader-login.d.ts} +3 -3
- package/types/components/layout-components/{pn-siteheader/pn-siteheader-loginmanager.d.ts → pn-marketweb-siteheader/pn-marketweb-siteheader-loginmanager.d.ts} +0 -0
- package/types/components/layout-components/{pn-siteheader/pn-siteheader-search.d.ts → pn-marketweb-siteheader/pn-marketweb-siteheader-search.d.ts} +2 -2
- package/types/components/layout-components/{pn-siteheader/pn-siteheader-types.d.ts → pn-marketweb-siteheader/pn-marketweb-siteheader-types.d.ts} +0 -0
- package/types/components/layout-components/{pn-siteheader/pn-siteheader.d.ts → pn-marketweb-siteheader/pn-marketweb-siteheader.d.ts} +2 -2
- package/types/components/layout-components/pn-marketweb-siteheader/translations.d.ts +47 -0
- package/types/components/navigation/pn-language-selector/pn-language-selector-option.d.ts +12 -0
- package/types/components/navigation/pn-language-selector/pn-language-selector-types.d.ts +9 -0
- package/types/components/navigation/pn-language-selector/pn-language-selector.d.ts +15 -0
- package/types/components/navigation/pn-language-selector/translations.d.ts +17 -0
- package/types/components/navigation/pn-mainnav/pn-mainnav-level.d.ts +15 -0
- package/types/components/navigation/pn-mainnav/pn-mainnav-link.d.ts +19 -0
- package/types/components/navigation/pn-mainnav/pn-mainnav-list.d.ts +7 -0
- package/types/components/navigation/pn-mainnav/pn-mainnav-store.d.ts +21 -0
- package/types/components/navigation/pn-mainnav/pn-mainnav.d.ts +24 -0
- package/types/components/navigation/pn-mainnav/translations.d.ts +32 -0
- package/types/components/navigation/pn-mainnav/types.d.ts +6 -0
- package/types/components/navigation/pn-site-footer/pn-site-footer-col.d.ts +3 -0
- package/types/components/navigation/pn-site-footer/pn-site-footer.d.ts +6 -0
- package/types/components/navigation/pn-site-selector/pn-site-selector-item.d.ts +7 -0
- package/types/components/navigation/pn-site-selector/pn-site-selector-types.d.ts +3 -0
- package/types/components/navigation/pn-site-selector/pn-site-selector.d.ts +12 -0
- package/types/components/widgets/pn-find-service-and-price/pn-find-service-and-price-result.d.ts +9 -0
- package/types/components/widgets/pn-find-service-and-price/pn-find-service-and-price-store.d.ts +33 -0
- package/types/components/widgets/pn-find-service-and-price/pn-find-service-and-price-translations.d.ts +71 -0
- package/types/components/widgets/pn-find-service-and-price/pn-find-service-and-price-types.d.ts +29 -0
- package/types/components/widgets/pn-find-service-and-price/pn-find-service-and-price.d.ts +18 -0
- package/types/components/widgets/pn-product-pricelist/pn-product-pricelist-result.d.ts +9 -0
- package/types/components/widgets/pn-product-pricelist/pn-product-pricelist-store.d.ts +27 -0
- package/types/components/widgets/pn-product-pricelist/pn-product-pricelist-translations.d.ts +56 -0
- package/types/components/widgets/pn-product-pricelist/pn-product-pricelist-types.d.ts +16 -0
- package/types/components/widgets/pn-product-pricelist/pn-product-pricelist.d.ts +20 -0
- package/types/components/widgets/pn-product-tile/pn-product-tile-info.d.ts +6 -0
- package/types/components/widgets/pn-product-tile/pn-product-tile-price.d.ts +7 -0
- package/types/components/widgets/pn-product-tile/pn-product-tile.d.ts +3 -0
- package/types/components.d.ts +486 -28
- package/types/globals/shared/productprice/product-price-types.d.ts +19 -0
- package/cjs/pn-siteheader-login_2.cjs.entry.js +0 -295
- package/collection/components/layout-components/pn-siteheader/pn-siteheader-login.css +0 -34
- package/esm/pn-siteheader-login_2.entry.js +0 -290
- package/esm-es5/index-1e3839a0.js +0 -1
- package/esm-es5/pn-siteheader-login_2.entry.js +0 -1
- package/esm-es5/pn-siteheader.entry.js +0 -1
- package/pn-market-web-components/p-0e743863.system.js +0 -1
- package/pn-market-web-components/p-1e159db8.js +0 -1
- package/pn-market-web-components/p-2e901469.system.entry.js +0 -1
- package/pn-market-web-components/p-4d08fcb9.entry.js +0 -1
- package/pn-market-web-components/p-530b52d0.system.js +0 -1
- package/pn-market-web-components/p-9a654a14.system.entry.js +0 -1
- package/pn-market-web-components/p-a1045531.entry.js +0 -1
package/custom-elements/index.js
CHANGED
|
@@ -1,7 +1,2722 @@
|
|
|
1
|
-
import { h, proxyCustomElement } from '@stencil/core/internal/client';
|
|
1
|
+
import { h, Host, getRenderingRef, forceUpdate, createEvent, proxyCustomElement } from '@stencil/core/internal/client';
|
|
2
2
|
export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';
|
|
3
3
|
|
|
4
|
-
const
|
|
4
|
+
const pnChoiceButtonCss = "pn-choice-button{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border:none;display:inline-block;background:#fff;position:relative;margin:0.2em 0.4em}pn-choice-button input{opacity:0;position:absolute;top:0;left:0;pointer-events:none;margin:0;width:100%;height:100%}pn-choice-button label{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;padding:0.4rem 0.8rem;border:0.1rem solid #D3CECB;color:#005D92;font-weight:500;border-radius:0.8rem;text-align:center;cursor:pointer;-webkit-transition:background 0.2s, -webkit-box-shadow 0.1s;transition:background 0.2s, -webkit-box-shadow 0.1s;transition:box-shadow 0.1s, background 0.2s;transition:box-shadow 0.1s, background 0.2s, -webkit-box-shadow 0.1s}pn-choice-button label pn-illustration{display:inline-block;width:3rem;height:3rem;margin-right:0.9rem}pn-choice-button>input:checked+label.pn-choice-button{background:#E0F8FF;color:#005D92;border-color:#005D92;-webkit-box-shadow:0px 0.6px 1.8px rgba(0, 0, 0, 0.1), 0px 3.2px 7.2px rgba(0, 0, 0, 0.13);box-shadow:0px 0.6px 1.8px rgba(0, 0, 0, 0.1), 0px 3.2px 7.2px rgba(0, 0, 0, 0.13)}pn-choice-button>input:indeterminate+label.pn-choice-button{background:#FFFFFF;color:#005D92}pn-choice-button>input:hover+label.pn-choice-button{background:#E0F8FF}pn-choice-button>input:focus+label.pn-choice-button,pn-choice-button>input:active+label.pn-choice-button{-webkit-box-shadow:0 0 0 0.2rem #fff, 0 0 0 0.4rem #005D92;box-shadow:0 0 0 0.2rem #fff, 0 0 0 0.4rem #005D92}pn-choice-button>input:active+label.pn-choice-button{background:#8EDDF9}pn-choice-button>input:disabled+label.pn-choice-button{background-color:#D3CECB}pn-choice-button>input:checked+label.pn-choice-button:hover{background:#8EDDF9}pn-choice-button>input:checked+label.pn-choice-button:active{background:#8EDDF9;border:0.1rem solid #00A0D6}";
|
|
5
|
+
|
|
6
|
+
const PnChoiceButton$1 = class extends HTMLElement {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this.__registerHost();
|
|
10
|
+
this.type = "checkbox";
|
|
11
|
+
this.disabled = false;
|
|
12
|
+
this.checked = false;
|
|
13
|
+
this.indeterminate = false;
|
|
14
|
+
}
|
|
15
|
+
handlechange() {
|
|
16
|
+
this.indeterminate = false;
|
|
17
|
+
}
|
|
18
|
+
componentDidLoad() {
|
|
19
|
+
this.checkAndSetIndeterminateState();
|
|
20
|
+
}
|
|
21
|
+
componentDidUpdate() {
|
|
22
|
+
this.checkAndSetIndeterminateState();
|
|
23
|
+
}
|
|
24
|
+
checkAndSetIndeterminateState() {
|
|
25
|
+
let checkbox = this.hostElement.querySelector(`#${this.choiceid}`);
|
|
26
|
+
if (checkbox) {
|
|
27
|
+
checkbox.indeterminate = this.indeterminate;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
render() {
|
|
31
|
+
return (h(Host, null, h("input", { type: this.type, id: this.choiceid, value: this.value, name: this.name || this.choiceid, disabled: this.disabled, checked: this.checked }), h("label", { htmlFor: this.choiceid, class: "pn-choice-button" }, h("slot", null))));
|
|
32
|
+
}
|
|
33
|
+
get hostElement() { return this; }
|
|
34
|
+
static get style() { return pnChoiceButtonCss; }
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const translations$5 = {
|
|
38
|
+
'sv': {
|
|
39
|
+
'componentheading': 'Vad vill du skicka?',
|
|
40
|
+
'deliveryscopeheading': 'Hit eller dit?',
|
|
41
|
+
'sizeheading': 'Hur mycket väger det?',
|
|
42
|
+
'resultlistheading': 'Några utvalda val',
|
|
43
|
+
'weightlabel': 'Vikt',
|
|
44
|
+
'maxweightlabel': 'Maxvikt',
|
|
45
|
+
'maxmeasurementlabel': 'Maxvolym',
|
|
46
|
+
'senddirectcta': 'Köp frakt via Skicka Direkt',
|
|
47
|
+
'stampshopcta': 'Köp frimärken via vår webshop',
|
|
48
|
+
},
|
|
49
|
+
'en': {
|
|
50
|
+
'componentheading': 'What do you want to send?',
|
|
51
|
+
'deliveryscopeheading': 'Here or there?',
|
|
52
|
+
'sizeheading': 'How much does it weigh?',
|
|
53
|
+
'resultlistheading': 'Some suitable options for you',
|
|
54
|
+
'weightlabel': 'Weight',
|
|
55
|
+
'maxweightlabel': 'Max weight',
|
|
56
|
+
'maxmeasurementlabel': 'Maximum measurement',
|
|
57
|
+
'senddirectcta': 'Buy shipping in Send Direct',
|
|
58
|
+
'stampshopcta': 'Order home stamps from the webshop',
|
|
59
|
+
},
|
|
60
|
+
'da': {
|
|
61
|
+
'componentheading': 'Vad vill du skicka?',
|
|
62
|
+
'deliveryscopeheading': 'Here or there?',
|
|
63
|
+
'sizeheading': 'How much does it weigh?',
|
|
64
|
+
'resultlistheading': 'Some suitable options for you',
|
|
65
|
+
'weightlabel': 'Vægt',
|
|
66
|
+
'maxweightlabel': 'Max vægt',
|
|
67
|
+
'maxmeasurementlabel': 'Maks. Volumen',
|
|
68
|
+
'senddirectcta': 'Buy shipping in Send Direct',
|
|
69
|
+
'stampshopcta': 'Order home stamps from the webshop',
|
|
70
|
+
},
|
|
71
|
+
'no': {
|
|
72
|
+
'componentheading': 'Vad vill du skicka?',
|
|
73
|
+
'deliveryscopeheading': 'Here or there?',
|
|
74
|
+
'sizeheading': 'How much does it weigh?',
|
|
75
|
+
'resultlistheading': 'Some suitable options for you',
|
|
76
|
+
'weightlabel': 'Vekt',
|
|
77
|
+
'maxweightlabel': 'Maks vekt',
|
|
78
|
+
'maxmeasurementlabel': 'Maks volum',
|
|
79
|
+
'senddirectcta': 'Buy shipping in Send Direct',
|
|
80
|
+
'stampshopcta': 'Order home stamps from the webshop',
|
|
81
|
+
},
|
|
82
|
+
'fi': {
|
|
83
|
+
'componentheading': 'Vad vill du skicka?',
|
|
84
|
+
'deliveryscopeheading': 'Here or there?',
|
|
85
|
+
'sizeheading': 'How much does it weigh?',
|
|
86
|
+
'resultlistheading': 'Some suitable options for you',
|
|
87
|
+
'weightlabel': 'Paino',
|
|
88
|
+
'maxweightlabel': 'Max paino',
|
|
89
|
+
'maxmeasurementlabel': 'Max äänenvoimakkuus',
|
|
90
|
+
'senddirectcta': 'Buy shipping in Send Direct',
|
|
91
|
+
'stampshopcta': 'Order home stamps from the webshop',
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
const markets$1 = {
|
|
95
|
+
'se': {
|
|
96
|
+
"currency": "kr",
|
|
97
|
+
},
|
|
98
|
+
'dk': {
|
|
99
|
+
"currency": "dk",
|
|
100
|
+
},
|
|
101
|
+
'fi': {
|
|
102
|
+
"currency": " €",
|
|
103
|
+
},
|
|
104
|
+
'no': {
|
|
105
|
+
"currency": "kr",
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const postagetypes = [
|
|
110
|
+
{ name: "Brev", value: "letter", illustration: "letterbox-reply-letter-plants" },
|
|
111
|
+
{ name: "Paket", value: "parcel", illustration: "tracking" }
|
|
112
|
+
];
|
|
113
|
+
|
|
114
|
+
const deliveryscopes = {
|
|
115
|
+
"letter": [
|
|
116
|
+
{ name: "Sweden", value: "sweden", illustration: "letterboxes" },
|
|
117
|
+
{ name: "Abroad", value: "abroad", illustration: "character-box-letters-globe" },
|
|
118
|
+
|
|
119
|
+
],
|
|
120
|
+
"parcel": [
|
|
121
|
+
{ name: "Sweden", value: "sweden", illustration: "letterboxes" },
|
|
122
|
+
{ name: "Within Europe", value:"withineurope", illustration: "character-box-letters-globe" },
|
|
123
|
+
{ name: "Outside Europe", value:"outsideeurope", illustration: "discover" },
|
|
124
|
+
]
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const weights$1 = {
|
|
128
|
+
"letter": [
|
|
129
|
+
{ name: "50g", abbreviation: 'g', value: 50 },
|
|
130
|
+
{ name: "100g", abbreviation: 'g', value: 100 },
|
|
131
|
+
{ name: "250g", abbreviation: 'g', value: 250 },
|
|
132
|
+
{ name: "500g", abbreviation: 'g', value: 500 },
|
|
133
|
+
{ name: "1kg", abbreviation: 'kg', value: 1 },
|
|
134
|
+
{ name: "2kg", abbreviation: 'kg', value: 2 },
|
|
135
|
+
],
|
|
136
|
+
"parcel": [
|
|
137
|
+
{ name: "1kg", abbreviation: 'kg', value: 1 },
|
|
138
|
+
{ name: "2kg", abbreviation: 'kg', value: 2 },
|
|
139
|
+
{ name: "3kg", abbreviation: 'kg', value: 3 },
|
|
140
|
+
{ name: "4kg", abbreviation: 'kg', value: 4 },
|
|
141
|
+
{ name: "5kg", abbreviation: 'kg', value: 5 },
|
|
142
|
+
{ name: "6kg", abbreviation: 'kg', value: 6 },
|
|
143
|
+
{ name: "7Kg", abbreviation: 'kg', value: 7 },
|
|
144
|
+
{ name: "8kg", abbreviation: 'kg', value: 8 },
|
|
145
|
+
{ name: "9kg", abbreviation: 'kg', value: 9 },
|
|
146
|
+
{ name: "10kg", abbreviation: 'kg', value: 10 },
|
|
147
|
+
{ name: "11kg", abbreviation: 'kg', value: 11 },
|
|
148
|
+
{ name: "12kg", abbreviation: 'kg', value: 12 },
|
|
149
|
+
{ name: "13kg", abbreviation: 'kg', value: 13 },
|
|
150
|
+
{ name: "14kg", abbreviation: 'kg', value: 14 },
|
|
151
|
+
{ name: "15kg", abbreviation: 'kg', value: 15 },
|
|
152
|
+
{ name: "16kg", abbreviation: 'kg', value: 16 },
|
|
153
|
+
{ name: "17kg", abbreviation: 'kg', value: 17 },
|
|
154
|
+
{ name: "18kg", abbreviation: 'kg', value: 18 },
|
|
155
|
+
{ name: "20kg", abbreviation: 'kg', value: 20 },
|
|
156
|
+
]
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
const xml = {
|
|
160
|
+
createDocument: function createDocument(content) {
|
|
161
|
+
// A weird bug: it won't parse XML unless it's trimmed.
|
|
162
|
+
// https://github.com/catamphetamine/read-excel-file/issues/21
|
|
163
|
+
return new DOMParser().parseFromString(content.trim(), 'text/xml');
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
168
|
+
|
|
169
|
+
function createCommonjsModule(fn, basedir, module) {
|
|
170
|
+
return module = {
|
|
171
|
+
path: basedir,
|
|
172
|
+
exports: {},
|
|
173
|
+
require: function (path, base) {
|
|
174
|
+
return commonjsRequire();
|
|
175
|
+
}
|
|
176
|
+
}, fn(module, module.exports), module.exports;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function commonjsRequire () {
|
|
180
|
+
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
var jszip_min = createCommonjsModule(function (module, exports) {
|
|
184
|
+
/*!
|
|
185
|
+
|
|
186
|
+
JSZip v3.7.1 - A JavaScript class for generating and reading zip files
|
|
187
|
+
<http://stuartk.com/jszip>
|
|
188
|
+
|
|
189
|
+
(c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
|
|
190
|
+
Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/master/LICENSE.markdown.
|
|
191
|
+
|
|
192
|
+
JSZip uses the library pako released under the MIT license :
|
|
193
|
+
https://github.com/nodeca/pako/blob/master/LICENSE
|
|
194
|
+
*/
|
|
195
|
+
|
|
196
|
+
!function(t){module.exports=t();}(function(){return function s(a,o,h){function u(r,t){if(!o[r]){if(!a[r]){var e="function"==typeof commonjsRequire&&commonjsRequire;if(!t&&e)return e(r,!0);if(l)return l(r,!0);var i=new Error("Cannot find module '"+r+"'");throw i.code="MODULE_NOT_FOUND",i}var n=o[r]={exports:{}};a[r][0].call(n.exports,function(t){var e=a[r][1][t];return u(e||t)},n,n.exports,s,a,o,h);}return o[r].exports}for(var l="function"==typeof commonjsRequire&&commonjsRequire,t=0;t<h.length;t++)u(h[t]);return u}({1:[function(t,e,r){var c=t("./utils"),d=t("./support"),p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.encode=function(t){for(var e,r,i,n,s,a,o,h=[],u=0,l=t.length,f=l,d="string"!==c.getTypeOf(t);u<t.length;)f=l-u,i=d?(e=t[u++],r=u<l?t[u++]:0,u<l?t[u++]:0):(e=t.charCodeAt(u++),r=u<l?t.charCodeAt(u++):0,u<l?t.charCodeAt(u++):0),n=e>>2,s=(3&e)<<4|r>>4,a=1<f?(15&r)<<2|i>>6:64,o=2<f?63&i:64,h.push(p.charAt(n)+p.charAt(s)+p.charAt(a)+p.charAt(o));return h.join("")},r.decode=function(t){var e,r,i,n,s,a,o=0,h=0,u="data:";if(t.substr(0,u.length)===u)throw new Error("Invalid base64 input, it looks like a data url.");var l,f=3*(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"")).length/4;if(t.charAt(t.length-1)===p.charAt(64)&&f--,t.charAt(t.length-2)===p.charAt(64)&&f--,f%1!=0)throw new Error("Invalid base64 input, bad content length.");for(l=d.uint8array?new Uint8Array(0|f):new Array(0|f);o<t.length;)e=p.indexOf(t.charAt(o++))<<2|(n=p.indexOf(t.charAt(o++)))>>4,r=(15&n)<<4|(s=p.indexOf(t.charAt(o++)))>>2,i=(3&s)<<6|(a=p.indexOf(t.charAt(o++))),l[h++]=e,64!==s&&(l[h++]=r),64!==a&&(l[h++]=i);return l};},{"./support":30,"./utils":32}],2:[function(t,e,r){var i=t("./external"),n=t("./stream/DataWorker"),s=t("./stream/Crc32Probe"),a=t("./stream/DataLengthProbe");function o(t,e,r,i,n){this.compressedSize=t,this.uncompressedSize=e,this.crc32=r,this.compression=i,this.compressedContent=n;}o.prototype={getContentWorker:function(){var t=new n(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new a("data_length")),e=this;return t.on("end",function(){if(this.streamInfo.data_length!==e.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),t},getCompressedWorker:function(){return new n(i.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},o.createWorkerFrom=function(t,e,r){return t.pipe(new s).pipe(new a("uncompressedSize")).pipe(e.compressWorker(r)).pipe(new a("compressedSize")).withStreamInfo("compression",e)},e.exports=o;},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,e,r){var i=t("./stream/GenericWorker");r.STORE={magic:"\0\0",compressWorker:function(t){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},r.DEFLATE=t("./flate");},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,e,r){var i=t("./utils");var o=function(){for(var t,e=[],r=0;r<256;r++){t=r;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[r]=t;}return e}();e.exports=function(t,e){return void 0!==t&&t.length?"string"!==i.getTypeOf(t)?function(t,e,r,i){var n=o,s=i+r;t^=-1;for(var a=i;a<s;a++)t=t>>>8^n[255&(t^e[a])];return -1^t}(0|e,t,t.length,0):function(t,e,r,i){var n=o,s=i+r;t^=-1;for(var a=i;a<s;a++)t=t>>>8^n[255&(t^e.charCodeAt(a))];return -1^t}(0|e,t,t.length,0):0};},{"./utils":32}],5:[function(t,e,r){r.base64=!1,r.binary=!1,r.dir=!1,r.createFolders=!0,r.date=null,r.compression=null,r.compressionOptions=null,r.comment=null,r.unixPermissions=null,r.dosPermissions=null;},{}],6:[function(t,e,r){var i=null;i="undefined"!=typeof Promise?Promise:t("lie"),e.exports={Promise:i};},{lie:37}],7:[function(t,e,r){var i="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,n=t("pako"),s=t("./utils"),a=t("./stream/GenericWorker"),o=i?"uint8array":"array";function h(t,e){a.call(this,"FlateWorker/"+t),this._pako=null,this._pakoAction=t,this._pakoOptions=e,this.meta={};}r.magic="\b\0",s.inherits(h,a),h.prototype.processChunk=function(t){this.meta=t.meta,null===this._pako&&this._createPako(),this._pako.push(s.transformTo(o,t.data),!1);},h.prototype.flush=function(){a.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0);},h.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this._pako=null;},h.prototype._createPako=function(){this._pako=new n[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta});};},r.compressWorker=function(t){return new h("Deflate",t)},r.uncompressWorker=function(){return new h("Inflate",{})};},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,e,r){function A(t,e){var r,i="";for(r=0;r<e;r++)i+=String.fromCharCode(255&t),t>>>=8;return i}function i(t,e,r,i,n,s){var a,o,h=t.file,u=t.compression,l=s!==O.utf8encode,f=I.transformTo("string",s(h.name)),d=I.transformTo("string",O.utf8encode(h.name)),c=h.comment,p=I.transformTo("string",s(c)),m=I.transformTo("string",O.utf8encode(c)),_=d.length!==h.name.length,g=m.length!==c.length,b="",v="",y="",w=h.dir,k=h.date,x={crc32:0,compressedSize:0,uncompressedSize:0};e&&!r||(x.crc32=t.crc32,x.compressedSize=t.compressedSize,x.uncompressedSize=t.uncompressedSize);var S=0;e&&(S|=8),l||!_&&!g||(S|=2048);var z=0,C=0;w&&(z|=16),"UNIX"===n?(C=798,z|=function(t,e){var r=t;return t||(r=e?16893:33204),(65535&r)<<16}(h.unixPermissions,w)):(C=20,z|=function(t){return 63&(t||0)}(h.dosPermissions)),a=k.getUTCHours(),a<<=6,a|=k.getUTCMinutes(),a<<=5,a|=k.getUTCSeconds()/2,o=k.getUTCFullYear()-1980,o<<=4,o|=k.getUTCMonth()+1,o<<=5,o|=k.getUTCDate(),_&&(v=A(1,1)+A(B(f),4)+d,b+="up"+A(v.length,2)+v),g&&(y=A(1,1)+A(B(p),4)+m,b+="uc"+A(y.length,2)+y);var E="";return E+="\n\0",E+=A(S,2),E+=u.magic,E+=A(a,2),E+=A(o,2),E+=A(x.crc32,4),E+=A(x.compressedSize,4),E+=A(x.uncompressedSize,4),E+=A(f.length,2),E+=A(b.length,2),{fileRecord:R.LOCAL_FILE_HEADER+E+f+b,dirRecord:R.CENTRAL_FILE_HEADER+A(C,2)+E+A(p.length,2)+"\0\0\0\0"+A(z,4)+A(i,4)+f+b+p}}var I=t("../utils"),n=t("../stream/GenericWorker"),O=t("../utf8"),B=t("../crc32"),R=t("../signature");function s(t,e,r,i){n.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=e,this.zipPlatform=r,this.encodeFileName=i,this.streamFiles=t,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[];}I.inherits(s,n),s.prototype.push=function(t){var e=t.meta.percent||0,r=this.entriesCount,i=this._sources.length;this.accumulate?this.contentBuffer.push(t):(this.bytesWritten+=t.data.length,n.prototype.push.call(this,{data:t.data,meta:{currentFile:this.currentFile,percent:r?(e+100*(r-i-1))/r:100}}));},s.prototype.openedSource=function(t){this.currentSourceOffset=this.bytesWritten,this.currentFile=t.file.name;var e=this.streamFiles&&!t.file.dir;if(e){var r=i(t,e,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:r.fileRecord,meta:{percent:0}});}else this.accumulate=!0;},s.prototype.closedSource=function(t){this.accumulate=!1;var e=this.streamFiles&&!t.file.dir,r=i(t,e,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(r.dirRecord),e)this.push({data:function(t){return R.DATA_DESCRIPTOR+A(t.crc32,4)+A(t.compressedSize,4)+A(t.uncompressedSize,4)}(t),meta:{percent:100}});else for(this.push({data:r.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null;},s.prototype.flush=function(){for(var t=this.bytesWritten,e=0;e<this.dirRecords.length;e++)this.push({data:this.dirRecords[e],meta:{percent:100}});var r=this.bytesWritten-t,i=function(t,e,r,i,n){var s=I.transformTo("string",n(i));return R.CENTRAL_DIRECTORY_END+"\0\0\0\0"+A(t,2)+A(t,2)+A(e,4)+A(r,4)+A(s.length,2)+s}(this.dirRecords.length,r,t,this.zipComment,this.encodeFileName);this.push({data:i,meta:{percent:100}});},s.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume();},s.prototype.registerPrevious=function(t){this._sources.push(t);var e=this;return t.on("data",function(t){e.processChunk(t);}),t.on("end",function(){e.closedSource(e.previous.streamInfo),e._sources.length?e.prepareNextSource():e.end();}),t.on("error",function(t){e.error(t);}),this},s.prototype.resume=function(){return !!n.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},s.prototype.error=function(t){var e=this._sources;if(!n.prototype.error.call(this,t))return !1;for(var r=0;r<e.length;r++)try{e[r].error(t);}catch(t){}return !0},s.prototype.lock=function(){n.prototype.lock.call(this);for(var t=this._sources,e=0;e<t.length;e++)t[e].lock();},e.exports=s;},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(t,e,r){var u=t("../compressions"),i=t("./ZipFileWorker");r.generateWorker=function(t,a,e){var o=new i(a.streamFiles,e,a.platform,a.encodeFileName),h=0;try{t.forEach(function(t,e){h++;var r=function(t,e){var r=t||e,i=u[r];if(!i)throw new Error(r+" is not a valid compression method !");return i}(e.options.compression,a.compression),i=e.options.compressionOptions||a.compressionOptions||{},n=e.dir,s=e.date;e._compressWorker(r,i).withStreamInfo("file",{name:t,dir:n,date:s,comment:e.comment||"",unixPermissions:e.unixPermissions,dosPermissions:e.dosPermissions}).pipe(o);}),o.entriesCount=h;}catch(t){o.error(t);}return o};},{"../compressions":3,"./ZipFileWorker":8}],10:[function(t,e,r){function i(){if(!(this instanceof i))return new i;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var t=new i;for(var e in this)"function"!=typeof this[e]&&(t[e]=this[e]);return t};}(i.prototype=t("./object")).loadAsync=t("./load"),i.support=t("./support"),i.defaults=t("./defaults"),i.version="3.7.1",i.loadAsync=function(t,e){return (new i).loadAsync(t,e)},i.external=t("./external"),e.exports=i;},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(t,e,r){var i=t("./utils"),n=t("./external"),o=t("./utf8"),h=t("./zipEntries"),s=t("./stream/Crc32Probe"),u=t("./nodejsUtils");function l(i){return new n.Promise(function(t,e){var r=i.decompressed.getContentWorker().pipe(new s);r.on("error",function(t){e(t);}).on("end",function(){r.streamInfo.crc32!==i.decompressed.crc32?e(new Error("Corrupted zip : CRC32 mismatch")):t();}).resume();})}e.exports=function(t,s){var a=this;return s=i.extend(s||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:o.utf8decode}),u.isNode&&u.isStream(t)?n.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip file",t,!0,s.optimizedBinaryString,s.base64).then(function(t){var e=new h(s);return e.load(t),e}).then(function(t){var e=[n.Promise.resolve(t)],r=t.files;if(s.checkCRC32)for(var i=0;i<r.length;i++)e.push(l(r[i]));return n.Promise.all(e)}).then(function(t){for(var e=t.shift(),r=e.files,i=0;i<r.length;i++){var n=r[i];a.file(n.fileNameStr,n.decompressed,{binary:!0,optimizedBinaryString:!0,date:n.date,dir:n.dir,comment:n.fileCommentStr.length?n.fileCommentStr:null,unixPermissions:n.unixPermissions,dosPermissions:n.dosPermissions,createFolders:s.createFolders});}return e.zipComment.length&&(a.comment=e.zipComment),a})};},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(t,e,r){var i=t("../utils"),n=t("../stream/GenericWorker");function s(t,e){n.call(this,"Nodejs stream input adapter for "+t),this._upstreamEnded=!1,this._bindStream(e);}i.inherits(s,n),s.prototype._bindStream=function(t){var e=this;(this._stream=t).pause(),t.on("data",function(t){e.push({data:t,meta:{percent:0}});}).on("error",function(t){e.isPaused?this.generatedError=t:e.error(t);}).on("end",function(){e.isPaused?e._upstreamEnded=!0:e.end();});},s.prototype.pause=function(){return !!n.prototype.pause.call(this)&&(this._stream.pause(),!0)},s.prototype.resume=function(){return !!n.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},e.exports=s;},{"../stream/GenericWorker":28,"../utils":32}],13:[function(t,e,r){var n=t("readable-stream").Readable;function i(t,e,r){n.call(this,e),this._helper=t;var i=this;t.on("data",function(t,e){i.push(t)||i._helper.pause(),r&&r(e);}).on("error",function(t){i.emit("error",t);}).on("end",function(){i.push(null);});}t("../utils").inherits(i,n),i.prototype._read=function(){this._helper.resume();},e.exports=i;},{"../utils":32,"readable-stream":16}],14:[function(t,e,r){e.exports={isNode:"undefined"!=typeof Buffer,newBufferFrom:function(t,e){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(t,e);if("number"==typeof t)throw new Error('The "data" argument must not be a number');return new Buffer(t,e)},allocBuffer:function(t){if(Buffer.alloc)return Buffer.alloc(t);var e=new Buffer(t);return e.fill(0),e},isBuffer:function(t){return Buffer.isBuffer(t)},isStream:function(t){return t&&"function"==typeof t.on&&"function"==typeof t.pause&&"function"==typeof t.resume}};},{}],15:[function(t,e,r){function s(t,e,r){var i,n=u.getTypeOf(e),s=u.extend(r||{},f);s.date=s.date||new Date,null!==s.compression&&(s.compression=s.compression.toUpperCase()),"string"==typeof s.unixPermissions&&(s.unixPermissions=parseInt(s.unixPermissions,8)),s.unixPermissions&&16384&s.unixPermissions&&(s.dir=!0),s.dosPermissions&&16&s.dosPermissions&&(s.dir=!0),s.dir&&(t=g(t)),s.createFolders&&(i=_(t))&&b.call(this,i,!0);var a="string"===n&&!1===s.binary&&!1===s.base64;r&&void 0!==r.binary||(s.binary=!a),(e instanceof d&&0===e.uncompressedSize||s.dir||!e||0===e.length)&&(s.base64=!1,s.binary=!0,e="",s.compression="STORE",n="string");var o=null;o=e instanceof d||e instanceof l?e:p.isNode&&p.isStream(e)?new m(t,e):u.prepareContent(t,e,s.binary,s.optimizedBinaryString,s.base64);var h=new c(t,o,s);this.files[t]=h;}var n=t("./utf8"),u=t("./utils"),l=t("./stream/GenericWorker"),a=t("./stream/StreamHelper"),f=t("./defaults"),d=t("./compressedObject"),c=t("./zipObject"),o=t("./generate"),p=t("./nodejsUtils"),m=t("./nodejs/NodejsStreamInputAdapter"),_=function(t){"/"===t.slice(-1)&&(t=t.substring(0,t.length-1));var e=t.lastIndexOf("/");return 0<e?t.substring(0,e):""},g=function(t){return "/"!==t.slice(-1)&&(t+="/"),t},b=function(t,e){return e=void 0!==e?e:f.createFolders,t=g(t),this.files[t]||s.call(this,t,null,{dir:!0,createFolders:e}),this.files[t]};function h(t){return "[object RegExp]"===Object.prototype.toString.call(t)}var i={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(t){var e,r,i;for(e in this.files)i=this.files[e],(r=e.slice(this.root.length,e.length))&&e.slice(0,this.root.length)===this.root&&t(r,i);},filter:function(r){var i=[];return this.forEach(function(t,e){r(t,e)&&i.push(e);}),i},file:function(t,e,r){if(1!==arguments.length)return t=this.root+t,s.call(this,t,e,r),this;if(h(t)){var i=t;return this.filter(function(t,e){return !e.dir&&i.test(t)})}var n=this.files[this.root+t];return n&&!n.dir?n:null},folder:function(r){if(!r)return this;if(h(r))return this.filter(function(t,e){return e.dir&&r.test(t)});var t=this.root+r,e=b.call(this,t),i=this.clone();return i.root=e.name,i},remove:function(r){r=this.root+r;var t=this.files[r];if(t||("/"!==r.slice(-1)&&(r+="/"),t=this.files[r]),t&&!t.dir)delete this.files[r];else for(var e=this.filter(function(t,e){return e.name.slice(0,r.length)===r}),i=0;i<e.length;i++)delete this.files[e[i].name];return this},generate:function(t){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(t){var e,r={};try{if((r=u.extend(t||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:n.utf8encode})).type=r.type.toLowerCase(),r.compression=r.compression.toUpperCase(),"binarystring"===r.type&&(r.type="string"),!r.type)throw new Error("No output type specified.");u.checkSupport(r.type),"darwin"!==r.platform&&"freebsd"!==r.platform&&"linux"!==r.platform&&"sunos"!==r.platform||(r.platform="UNIX"),"win32"===r.platform&&(r.platform="DOS");var i=r.comment||this.comment||"";e=o.generateWorker(this,r,i);}catch(t){(e=new l("error")).error(t);}return new a(e,r.type||"string",r.mimeType)},generateAsync:function(t,e){return this.generateInternalStream(t).accumulate(e)},generateNodeStream:function(t,e){return (t=t||{}).type||(t.type="nodebuffer"),this.generateInternalStream(t).toNodejsStream(e)}};e.exports=i;},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(t,e,r){e.exports=t("stream");},{stream:void 0}],17:[function(t,e,r){var i=t("./DataReader");function n(t){i.call(this,t);for(var e=0;e<this.data.length;e++)t[e]=255&t[e];}t("../utils").inherits(n,i),n.prototype.byteAt=function(t){return this.data[this.zero+t]},n.prototype.lastIndexOfSignature=function(t){for(var e=t.charCodeAt(0),r=t.charCodeAt(1),i=t.charCodeAt(2),n=t.charCodeAt(3),s=this.length-4;0<=s;--s)if(this.data[s]===e&&this.data[s+1]===r&&this.data[s+2]===i&&this.data[s+3]===n)return s-this.zero;return -1},n.prototype.readAndCheckSignature=function(t){var e=t.charCodeAt(0),r=t.charCodeAt(1),i=t.charCodeAt(2),n=t.charCodeAt(3),s=this.readData(4);return e===s[0]&&r===s[1]&&i===s[2]&&n===s[3]},n.prototype.readData=function(t){if(this.checkOffset(t),0===t)return [];var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=n;},{"../utils":32,"./DataReader":18}],18:[function(t,e,r){var i=t("../utils");function n(t){this.data=t,this.length=t.length,this.index=0,this.zero=0;}n.prototype={checkOffset:function(t){this.checkIndex(this.index+t);},checkIndex:function(t){if(this.length<this.zero+t||t<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+t+"). Corrupted zip ?")},setIndex:function(t){this.checkIndex(t),this.index=t;},skip:function(t){this.setIndex(this.index+t);},byteAt:function(t){},readInt:function(t){var e,r=0;for(this.checkOffset(t),e=this.index+t-1;e>=this.index;e--)r=(r<<8)+this.byteAt(e);return this.index+=t,r},readString:function(t){return i.transformTo("string",this.readData(t))},readData:function(t){},lastIndexOfSignature:function(t){},readAndCheckSignature:function(t){},readDate:function(){var t=this.readInt(4);return new Date(Date.UTC(1980+(t>>25&127),(t>>21&15)-1,t>>16&31,t>>11&31,t>>5&63,(31&t)<<1))}},e.exports=n;},{"../utils":32}],19:[function(t,e,r){var i=t("./Uint8ArrayReader");function n(t){i.call(this,t);}t("../utils").inherits(n,i),n.prototype.readData=function(t){this.checkOffset(t);var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=n;},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,e,r){var i=t("./DataReader");function n(t){i.call(this,t);}t("../utils").inherits(n,i),n.prototype.byteAt=function(t){return this.data.charCodeAt(this.zero+t)},n.prototype.lastIndexOfSignature=function(t){return this.data.lastIndexOf(t)-this.zero},n.prototype.readAndCheckSignature=function(t){return t===this.readData(4)},n.prototype.readData=function(t){this.checkOffset(t);var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=n;},{"../utils":32,"./DataReader":18}],21:[function(t,e,r){var i=t("./ArrayReader");function n(t){i.call(this,t);}t("../utils").inherits(n,i),n.prototype.readData=function(t){if(this.checkOffset(t),0===t)return new Uint8Array(0);var e=this.data.subarray(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=n;},{"../utils":32,"./ArrayReader":17}],22:[function(t,e,r){var i=t("../utils"),n=t("../support"),s=t("./ArrayReader"),a=t("./StringReader"),o=t("./NodeBufferReader"),h=t("./Uint8ArrayReader");e.exports=function(t){var e=i.getTypeOf(t);return i.checkSupport(e),"string"!==e||n.uint8array?"nodebuffer"===e?new o(t):n.uint8array?new h(i.transformTo("uint8array",t)):new s(i.transformTo("array",t)):new a(t)};},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,e,r){r.LOCAL_FILE_HEADER="PK",r.CENTRAL_FILE_HEADER="PK",r.CENTRAL_DIRECTORY_END="PK",r.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",r.ZIP64_CENTRAL_DIRECTORY_END="PK",r.DATA_DESCRIPTOR="PK\b";},{}],24:[function(t,e,r){var i=t("./GenericWorker"),n=t("../utils");function s(t){i.call(this,"ConvertWorker to "+t),this.destType=t;}n.inherits(s,i),s.prototype.processChunk=function(t){this.push({data:n.transformTo(this.destType,t.data),meta:t.meta});},e.exports=s;},{"../utils":32,"./GenericWorker":28}],25:[function(t,e,r){var i=t("./GenericWorker"),n=t("../crc32");function s(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0);}t("../utils").inherits(s,i),s.prototype.processChunk=function(t){this.streamInfo.crc32=n(t.data,this.streamInfo.crc32||0),this.push(t);},e.exports=s;},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,e,r){var i=t("../utils"),n=t("./GenericWorker");function s(t){n.call(this,"DataLengthProbe for "+t),this.propName=t,this.withStreamInfo(t,0);}i.inherits(s,n),s.prototype.processChunk=function(t){if(t){var e=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=e+t.data.length;}n.prototype.processChunk.call(this,t);},e.exports=s;},{"../utils":32,"./GenericWorker":28}],27:[function(t,e,r){var i=t("../utils"),n=t("./GenericWorker");function s(t){n.call(this,"DataWorker");var e=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,t.then(function(t){e.dataIsReady=!0,e.data=t,e.max=t&&t.length||0,e.type=i.getTypeOf(t),e.isPaused||e._tickAndRepeat();},function(t){e.error(t);});}i.inherits(s,n),s.prototype.cleanUp=function(){n.prototype.cleanUp.call(this),this.data=null;},s.prototype.resume=function(){return !!n.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,i.delay(this._tickAndRepeat,[],this)),!0)},s.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0));},s.prototype._tick=function(){if(this.isPaused||this.isFinished)return !1;var t=null,e=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":t=this.data.substring(this.index,e);break;case"uint8array":t=this.data.subarray(this.index,e);break;case"array":case"nodebuffer":t=this.data.slice(this.index,e);}return this.index=e,this.push({data:t,meta:{percent:this.max?this.index/this.max*100:0}})},e.exports=s;},{"../utils":32,"./GenericWorker":28}],28:[function(t,e,r){function i(t){this.name=t||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null;}i.prototype={push:function(t){this.emit("data",t);},end:function(){if(this.isFinished)return !1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0;}catch(t){this.emit("error",t);}return !0},error:function(t){return !this.isFinished&&(this.isPaused?this.generatedError=t:(this.isFinished=!0,this.emit("error",t),this.previous&&this.previous.error(t),this.cleanUp()),!0)},on:function(t,e){return this._listeners[t].push(e),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[];},emit:function(t,e){if(this._listeners[t])for(var r=0;r<this._listeners[t].length;r++)this._listeners[t][r].call(this,e);},pipe:function(t){return t.registerPrevious(this)},registerPrevious:function(t){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=t.streamInfo,this.mergeStreamInfo(),this.previous=t;var e=this;return t.on("data",function(t){e.processChunk(t);}),t.on("end",function(){e.end();}),t.on("error",function(t){e.error(t);}),this},pause:function(){return !this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return !1;var t=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),t=!0),this.previous&&this.previous.resume(),!t},flush:function(){},processChunk:function(t){this.push(t);},withStreamInfo:function(t,e){return this.extraStreamInfo[t]=e,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var t in this.extraStreamInfo)this.extraStreamInfo.hasOwnProperty(t)&&(this.streamInfo[t]=this.extraStreamInfo[t]);},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock();},toString:function(){var t="Worker "+this.name;return this.previous?this.previous+" -> "+t:t}},e.exports=i;},{}],29:[function(t,e,r){var h=t("../utils"),n=t("./ConvertWorker"),s=t("./GenericWorker"),u=t("../base64"),i=t("../support"),a=t("../external"),o=null;if(i.nodestream)try{o=t("../nodejs/NodejsStreamOutputAdapter");}catch(t){}function l(t,o){return new a.Promise(function(e,r){var i=[],n=t._internalType,s=t._outputType,a=t._mimeType;t.on("data",function(t,e){i.push(t),o&&o(e);}).on("error",function(t){i=[],r(t);}).on("end",function(){try{var t=function(t,e,r){switch(t){case"blob":return h.newBlob(h.transformTo("arraybuffer",e),r);case"base64":return u.encode(e);default:return h.transformTo(t,e)}}(s,function(t,e){var r,i=0,n=null,s=0;for(r=0;r<e.length;r++)s+=e[r].length;switch(t){case"string":return e.join("");case"array":return Array.prototype.concat.apply([],e);case"uint8array":for(n=new Uint8Array(s),r=0;r<e.length;r++)n.set(e[r],i),i+=e[r].length;return n;case"nodebuffer":return Buffer.concat(e);default:throw new Error("concat : unsupported type '"+t+"'")}}(n,i),a);e(t);}catch(t){r(t);}i=[];}).resume();})}function f(t,e,r){var i=e;switch(e){case"blob":case"arraybuffer":i="uint8array";break;case"base64":i="string";}try{this._internalType=i,this._outputType=e,this._mimeType=r,h.checkSupport(i),this._worker=t.pipe(new n(i)),t.lock();}catch(t){this._worker=new s("error"),this._worker.error(t);}}f.prototype={accumulate:function(t){return l(this,t)},on:function(t,e){var r=this;return "data"===t?this._worker.on(t,function(t){e.call(r,t.data,t.meta);}):this._worker.on(t,function(){h.delay(e,arguments,r);}),this},resume:function(){return h.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(t){if(h.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw new Error(this._outputType+" is not supported by this method");return new o(this,{objectMode:"nodebuffer"!==this._outputType},t)}},e.exports=f;},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(t,e,r){if(r.base64=!0,r.array=!0,r.string=!0,r.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,r.nodebuffer="undefined"!=typeof Buffer,r.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)r.blob=!1;else {var i=new ArrayBuffer(0);try{r.blob=0===new Blob([i],{type:"application/zip"}).size;}catch(t){try{var n=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);n.append(i),r.blob=0===n.getBlob("application/zip").size;}catch(t){r.blob=!1;}}}try{r.nodestream=!!t("readable-stream").Readable;}catch(t){r.nodestream=!1;}},{"readable-stream":16}],31:[function(t,e,s){for(var o=t("./utils"),h=t("./support"),r=t("./nodejsUtils"),i=t("./stream/GenericWorker"),u=new Array(256),n=0;n<256;n++)u[n]=252<=n?6:248<=n?5:240<=n?4:224<=n?3:192<=n?2:1;u[254]=u[254]=1;function a(){i.call(this,"utf-8 decode"),this.leftOver=null;}function l(){i.call(this,"utf-8 encode");}s.utf8encode=function(t){return h.nodebuffer?r.newBufferFrom(t,"utf-8"):function(t){var e,r,i,n,s,a=t.length,o=0;for(n=0;n<a;n++)55296==(64512&(r=t.charCodeAt(n)))&&n+1<a&&56320==(64512&(i=t.charCodeAt(n+1)))&&(r=65536+(r-55296<<10)+(i-56320),n++),o+=r<128?1:r<2048?2:r<65536?3:4;for(e=h.uint8array?new Uint8Array(o):new Array(o),n=s=0;s<o;n++)55296==(64512&(r=t.charCodeAt(n)))&&n+1<a&&56320==(64512&(i=t.charCodeAt(n+1)))&&(r=65536+(r-55296<<10)+(i-56320),n++),r<128?e[s++]=r:(r<2048?e[s++]=192|r>>>6:(r<65536?e[s++]=224|r>>>12:(e[s++]=240|r>>>18,e[s++]=128|r>>>12&63),e[s++]=128|r>>>6&63),e[s++]=128|63&r);return e}(t)},s.utf8decode=function(t){return h.nodebuffer?o.transformTo("nodebuffer",t).toString("utf-8"):function(t){var e,r,i,n,s=t.length,a=new Array(2*s);for(e=r=0;e<s;)if((i=t[e++])<128)a[r++]=i;else if(4<(n=u[i]))a[r++]=65533,e+=n-1;else {for(i&=2===n?31:3===n?15:7;1<n&&e<s;)i=i<<6|63&t[e++],n--;1<n?a[r++]=65533:i<65536?a[r++]=i:(i-=65536,a[r++]=55296|i>>10&1023,a[r++]=56320|1023&i);}return a.length!==r&&(a.subarray?a=a.subarray(0,r):a.length=r),o.applyFromCharCode(a)}(t=o.transformTo(h.uint8array?"uint8array":"array",t))},o.inherits(a,i),a.prototype.processChunk=function(t){var e=o.transformTo(h.uint8array?"uint8array":"array",t.data);if(this.leftOver&&this.leftOver.length){if(h.uint8array){var r=e;(e=new Uint8Array(r.length+this.leftOver.length)).set(this.leftOver,0),e.set(r,this.leftOver.length);}else e=this.leftOver.concat(e);this.leftOver=null;}var i=function(t,e){var r;for((e=e||t.length)>t.length&&(e=t.length),r=e-1;0<=r&&128==(192&t[r]);)r--;return r<0?e:0===r?e:r+u[t[r]]>e?r:e}(e),n=e;i!==e.length&&(h.uint8array?(n=e.subarray(0,i),this.leftOver=e.subarray(i,e.length)):(n=e.slice(0,i),this.leftOver=e.slice(i,e.length))),this.push({data:s.utf8decode(n),meta:t.meta});},a.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null);},s.Utf8DecodeWorker=a,o.inherits(l,i),l.prototype.processChunk=function(t){this.push({data:s.utf8encode(t.data),meta:t.meta});},s.Utf8EncodeWorker=l;},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,e,a){var o=t("./support"),h=t("./base64"),r=t("./nodejsUtils"),i=t("set-immediate-shim"),u=t("./external");function n(t){return t}function l(t,e){for(var r=0;r<t.length;++r)e[r]=255&t.charCodeAt(r);return e}a.newBlob=function(e,r){a.checkSupport("blob");try{return new Blob([e],{type:r})}catch(t){try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return i.append(e),i.getBlob(r)}catch(t){throw new Error("Bug : can't construct the Blob.")}}};var s={stringifyByChunk:function(t,e,r){var i=[],n=0,s=t.length;if(s<=r)return String.fromCharCode.apply(null,t);for(;n<s;)"array"===e||"nodebuffer"===e?i.push(String.fromCharCode.apply(null,t.slice(n,Math.min(n+r,s)))):i.push(String.fromCharCode.apply(null,t.subarray(n,Math.min(n+r,s)))),n+=r;return i.join("")},stringifyByChar:function(t){for(var e="",r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},applyCanBeUsed:{uint8array:function(){try{return o.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(t){return !1}}(),nodebuffer:function(){try{return o.nodebuffer&&1===String.fromCharCode.apply(null,r.allocBuffer(1)).length}catch(t){return !1}}()}};function f(t){var e=65536,r=a.getTypeOf(t),i=!0;if("uint8array"===r?i=s.applyCanBeUsed.uint8array:"nodebuffer"===r&&(i=s.applyCanBeUsed.nodebuffer),i)for(;1<e;)try{return s.stringifyByChunk(t,r,e)}catch(t){e=Math.floor(e/2);}return s.stringifyByChar(t)}function d(t,e){for(var r=0;r<t.length;r++)e[r]=t[r];return e}a.applyFromCharCode=f;var c={};c.string={string:n,array:function(t){return l(t,new Array(t.length))},arraybuffer:function(t){return c.string.uint8array(t).buffer},uint8array:function(t){return l(t,new Uint8Array(t.length))},nodebuffer:function(t){return l(t,r.allocBuffer(t.length))}},c.array={string:f,array:n,arraybuffer:function(t){return new Uint8Array(t).buffer},uint8array:function(t){return new Uint8Array(t)},nodebuffer:function(t){return r.newBufferFrom(t)}},c.arraybuffer={string:function(t){return f(new Uint8Array(t))},array:function(t){return d(new Uint8Array(t),new Array(t.byteLength))},arraybuffer:n,uint8array:function(t){return new Uint8Array(t)},nodebuffer:function(t){return r.newBufferFrom(new Uint8Array(t))}},c.uint8array={string:f,array:function(t){return d(t,new Array(t.length))},arraybuffer:function(t){return t.buffer},uint8array:n,nodebuffer:function(t){return r.newBufferFrom(t)}},c.nodebuffer={string:f,array:function(t){return d(t,new Array(t.length))},arraybuffer:function(t){return c.nodebuffer.uint8array(t).buffer},uint8array:function(t){return d(t,new Uint8Array(t.length))},nodebuffer:n},a.transformTo=function(t,e){if(e=e||"",!t)return e;a.checkSupport(t);var r=a.getTypeOf(e);return c[r][t](e)},a.getTypeOf=function(t){return "string"==typeof t?"string":"[object Array]"===Object.prototype.toString.call(t)?"array":o.nodebuffer&&r.isBuffer(t)?"nodebuffer":o.uint8array&&t instanceof Uint8Array?"uint8array":o.arraybuffer&&t instanceof ArrayBuffer?"arraybuffer":void 0},a.checkSupport=function(t){if(!o[t.toLowerCase()])throw new Error(t+" is not supported by this platform")},a.MAX_VALUE_16BITS=65535,a.MAX_VALUE_32BITS=-1,a.pretty=function(t){var e,r,i="";for(r=0;r<(t||"").length;r++)i+="\\x"+((e=t.charCodeAt(r))<16?"0":"")+e.toString(16).toUpperCase();return i},a.delay=function(t,e,r){i(function(){t.apply(r||null,e||[]);});},a.inherits=function(t,e){function r(){}r.prototype=e.prototype,t.prototype=new r;},a.extend=function(){var t,e,r={};for(t=0;t<arguments.length;t++)for(e in arguments[t])arguments[t].hasOwnProperty(e)&&void 0===r[e]&&(r[e]=arguments[t][e]);return r},a.prepareContent=function(r,t,i,n,s){return u.Promise.resolve(t).then(function(i){return o.blob&&(i instanceof Blob||-1!==["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(i)))&&"undefined"!=typeof FileReader?new u.Promise(function(e,r){var t=new FileReader;t.onload=function(t){e(t.target.result);},t.onerror=function(t){r(t.target.error);},t.readAsArrayBuffer(i);}):i}).then(function(t){var e=a.getTypeOf(t);return e?("arraybuffer"===e?t=a.transformTo("uint8array",t):"string"===e&&(s?t=h.decode(t):i&&!0!==n&&(t=function(t){return l(t,o.uint8array?new Uint8Array(t.length):new Array(t.length))}(t))),t):u.Promise.reject(new Error("Can't read the data of '"+r+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})};},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,"set-immediate-shim":54}],33:[function(t,e,r){var i=t("./reader/readerFor"),n=t("./utils"),s=t("./signature"),a=t("./zipEntry"),o=(t("./utf8"),t("./support"));function h(t){this.files=[],this.loadOptions=t;}h.prototype={checkSignature:function(t){if(!this.reader.readAndCheckSignature(t)){this.reader.index-=4;var e=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+n.pretty(e)+", expected "+n.pretty(t)+")")}},isSignature:function(t,e){var r=this.reader.index;this.reader.setIndex(t);var i=this.reader.readString(4)===e;return this.reader.setIndex(r),i},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var t=this.reader.readData(this.zipCommentLength),e=o.uint8array?"uint8array":"array",r=n.transformTo(e,t);this.zipComment=this.loadOptions.decodeFileName(r);},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var t,e,r,i=this.zip64EndOfCentralSize-44;0<i;)t=this.reader.readInt(2),e=this.reader.readInt(4),r=this.reader.readData(e),this.zip64ExtensibleData[t]={id:t,length:e,value:r};},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var t,e;for(t=0;t<this.files.length;t++)e=this.files[t],this.reader.setIndex(e.localHeaderOffset),this.checkSignature(s.LOCAL_FILE_HEADER),e.readLocalPart(this.reader),e.handleUTF8(),e.processAttributes();},readCentralDir:function(){var t;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(s.CENTRAL_FILE_HEADER);)(t=new a({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(t);if(this.centralDirRecords!==this.files.length&&0!==this.centralDirRecords&&0===this.files.length)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var t=this.reader.lastIndexOfSignature(s.CENTRAL_DIRECTORY_END);if(t<0)throw !this.isSignature(0,s.LOCAL_FILE_HEADER)?new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html"):new Error("Corrupted zip: can't find end of central directory");this.reader.setIndex(t);var e=t;if(this.checkSignature(s.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===n.MAX_VALUE_16BITS||this.diskWithCentralDirStart===n.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===n.MAX_VALUE_16BITS||this.centralDirRecords===n.MAX_VALUE_16BITS||this.centralDirSize===n.MAX_VALUE_32BITS||this.centralDirOffset===n.MAX_VALUE_32BITS){if(this.zip64=!0,(t=this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(t),this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,s.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral();}var r=this.centralDirOffset+this.centralDirSize;this.zip64&&(r+=20,r+=12+this.zip64EndOfCentralSize);var i=e-r;if(0<i)this.isSignature(e,s.CENTRAL_FILE_HEADER)||(this.reader.zero=i);else if(i<0)throw new Error("Corrupted zip: missing "+Math.abs(i)+" bytes.")},prepareReader:function(t){this.reader=i(t);},load:function(t){this.prepareReader(t),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles();}},e.exports=h;},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utf8":31,"./utils":32,"./zipEntry":34}],34:[function(t,e,r){var i=t("./reader/readerFor"),s=t("./utils"),n=t("./compressedObject"),a=t("./crc32"),o=t("./utf8"),h=t("./compressions"),u=t("./support");function l(t,e){this.options=t,this.loadOptions=e;}l.prototype={isEncrypted:function(){return 1==(1&this.bitFlag)},useUTF8:function(){return 2048==(2048&this.bitFlag)},readLocalPart:function(t){var e,r;if(t.skip(22),this.fileNameLength=t.readInt(2),r=t.readInt(2),this.fileName=t.readData(this.fileNameLength),t.skip(r),-1===this.compressedSize||-1===this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(null===(e=function(t){for(var e in h)if(h.hasOwnProperty(e)&&h[e].magic===t)return h[e];return null}(this.compressionMethod)))throw new Error("Corrupted zip : compression "+s.pretty(this.compressionMethod)+" unknown (inner file : "+s.transformTo("string",this.fileName)+")");this.decompressed=new n(this.compressedSize,this.uncompressedSize,this.crc32,e,t.readData(this.compressedSize));},readCentralPart:function(t){this.versionMadeBy=t.readInt(2),t.skip(2),this.bitFlag=t.readInt(2),this.compressionMethod=t.readString(2),this.date=t.readDate(),this.crc32=t.readInt(4),this.compressedSize=t.readInt(4),this.uncompressedSize=t.readInt(4);var e=t.readInt(2);if(this.extraFieldsLength=t.readInt(2),this.fileCommentLength=t.readInt(2),this.diskNumberStart=t.readInt(2),this.internalFileAttributes=t.readInt(2),this.externalFileAttributes=t.readInt(4),this.localHeaderOffset=t.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");t.skip(e),this.readExtraFields(t),this.parseZIP64ExtraField(t),this.fileComment=t.readData(this.fileCommentLength);},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var t=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0==t&&(this.dosPermissions=63&this.externalFileAttributes),3==t&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0);},parseZIP64ExtraField:function(t){if(this.extraFields[1]){var e=i(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4));}},readExtraFields:function(t){var e,r,i,n=t.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});t.index+4<n;)e=t.readInt(2),r=t.readInt(2),i=t.readData(r),this.extraFields[e]={id:e,length:r,value:i};t.setIndex(n);},handleUTF8:function(){var t=u.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=o.utf8decode(this.fileName),this.fileCommentStr=o.utf8decode(this.fileComment);else {var e=this.findExtraFieldUnicodePath();if(null!==e)this.fileNameStr=e;else {var r=s.transformTo(t,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(r);}var i=this.findExtraFieldUnicodeComment();if(null!==i)this.fileCommentStr=i;else {var n=s.transformTo(t,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(n);}}},findExtraFieldUnicodePath:function(){var t=this.extraFields[28789];if(t){var e=i(t.value);return 1!==e.readInt(1)?null:a(this.fileName)!==e.readInt(4)?null:o.utf8decode(e.readData(t.length-5))}return null},findExtraFieldUnicodeComment:function(){var t=this.extraFields[25461];if(t){var e=i(t.value);return 1!==e.readInt(1)?null:a(this.fileComment)!==e.readInt(4)?null:o.utf8decode(e.readData(t.length-5))}return null}},e.exports=l;},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(t,e,r){function i(t,e,r){this.name=t,this.dir=r.dir,this.date=r.date,this.comment=r.comment,this.unixPermissions=r.unixPermissions,this.dosPermissions=r.dosPermissions,this._data=e,this._dataBinary=r.binary,this.options={compression:r.compression,compressionOptions:r.compressionOptions};}var s=t("./stream/StreamHelper"),n=t("./stream/DataWorker"),a=t("./utf8"),o=t("./compressedObject"),h=t("./stream/GenericWorker");i.prototype={internalStream:function(t){var e=null,r="string";try{if(!t)throw new Error("No output type specified.");var i="string"===(r=t.toLowerCase())||"text"===r;"binarystring"!==r&&"text"!==r||(r="string"),e=this._decompressWorker();var n=!this._dataBinary;n&&!i&&(e=e.pipe(new a.Utf8EncodeWorker)),!n&&i&&(e=e.pipe(new a.Utf8DecodeWorker));}catch(t){(e=new h("error")).error(t);}return new s(e,r,"")},async:function(t,e){return this.internalStream(t).accumulate(e)},nodeStream:function(t,e){return this.internalStream(t||"nodebuffer").toNodejsStream(e)},_compressWorker:function(t,e){if(this._data instanceof o&&this._data.compression.magic===t.magic)return this._data.getCompressedWorker();var r=this._decompressWorker();return this._dataBinary||(r=r.pipe(new a.Utf8EncodeWorker)),o.createWorkerFrom(r,t,e)},_decompressWorker:function(){return this._data instanceof o?this._data.getContentWorker():this._data instanceof h?this._data:new n(this._data)}};for(var u=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],l=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},f=0;f<u.length;f++)i.prototype[u[f]]=l;e.exports=i;},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(t,l,e){(function(e){var r,i,t=e.MutationObserver||e.WebKitMutationObserver;if(t){var n=0,s=new t(u),a=e.document.createTextNode("");s.observe(a,{characterData:!0}),r=function(){a.data=n=++n%2;};}else if(e.setImmediate||void 0===e.MessageChannel)r="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){u(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null;},e.document.documentElement.appendChild(t);}:function(){setTimeout(u,0);};else {var o=new e.MessageChannel;o.port1.onmessage=u,r=function(){o.port2.postMessage(0);};}var h=[];function u(){var t,e;i=!0;for(var r=h.length;r;){for(e=h,h=[],t=-1;++t<r;)e[t]();r=h.length;}i=!1;}l.exports=function(t){1!==h.push(t)||i||r();};}).call(this,"undefined"!=typeof commonjsGlobal?commonjsGlobal:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});},{}],37:[function(t,e,r){var n=t("immediate");function u(){}var l={},s=["REJECTED"],a=["FULFILLED"],i=["PENDING"];function o(t){if("function"!=typeof t)throw new TypeError("resolver must be a function");this.state=i,this.queue=[],this.outcome=void 0,t!==u&&c(this,t);}function h(t,e,r){this.promise=t,"function"==typeof e&&(this.onFulfilled=e,this.callFulfilled=this.otherCallFulfilled),"function"==typeof r&&(this.onRejected=r,this.callRejected=this.otherCallRejected);}function f(e,r,i){n(function(){var t;try{t=r(i);}catch(t){return l.reject(e,t)}t===e?l.reject(e,new TypeError("Cannot resolve promise with itself")):l.resolve(e,t);});}function d(t){var e=t&&t.then;if(t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof e)return function(){e.apply(t,arguments);}}function c(e,t){var r=!1;function i(t){r||(r=!0,l.reject(e,t));}function n(t){r||(r=!0,l.resolve(e,t));}var s=p(function(){t(n,i);});"error"===s.status&&i(s.value);}function p(t,e){var r={};try{r.value=t(e),r.status="success";}catch(t){r.status="error",r.value=t;}return r}(e.exports=o).prototype.finally=function(e){if("function"!=typeof e)return this;var r=this.constructor;return this.then(function(t){return r.resolve(e()).then(function(){return t})},function(t){return r.resolve(e()).then(function(){throw t})})},o.prototype.catch=function(t){return this.then(null,t)},o.prototype.then=function(t,e){if("function"!=typeof t&&this.state===a||"function"!=typeof e&&this.state===s)return this;var r=new this.constructor(u);this.state!==i?f(r,this.state===a?t:e,this.outcome):this.queue.push(new h(r,t,e));return r},h.prototype.callFulfilled=function(t){l.resolve(this.promise,t);},h.prototype.otherCallFulfilled=function(t){f(this.promise,this.onFulfilled,t);},h.prototype.callRejected=function(t){l.reject(this.promise,t);},h.prototype.otherCallRejected=function(t){f(this.promise,this.onRejected,t);},l.resolve=function(t,e){var r=p(d,e);if("error"===r.status)return l.reject(t,r.value);var i=r.value;if(i)c(t,i);else {t.state=a,t.outcome=e;for(var n=-1,s=t.queue.length;++n<s;)t.queue[n].callFulfilled(e);}return t},l.reject=function(t,e){t.state=s,t.outcome=e;for(var r=-1,i=t.queue.length;++r<i;)t.queue[r].callRejected(e);return t},o.resolve=function(t){if(t instanceof this)return t;return l.resolve(new this(u),t)},o.reject=function(t){var e=new this(u);return l.reject(e,t)},o.all=function(t){var r=this;if("[object Array]"!==Object.prototype.toString.call(t))return this.reject(new TypeError("must be an array"));var i=t.length,n=!1;if(!i)return this.resolve([]);var s=new Array(i),a=0,e=-1,o=new this(u);for(;++e<i;)h(t[e],e);return o;function h(t,e){r.resolve(t).then(function(t){s[e]=t,++a!==i||n||(n=!0,l.resolve(o,s));},function(t){n||(n=!0,l.reject(o,t));});}},o.race=function(t){var e=this;if("[object Array]"!==Object.prototype.toString.call(t))return this.reject(new TypeError("must be an array"));var r=t.length,i=!1;if(!r)return this.resolve([]);var n=-1,s=new this(u);for(;++n<r;)a=t[n],e.resolve(a).then(function(t){i||(i=!0,l.resolve(s,t));},function(t){i||(i=!0,l.reject(s,t));});var a;return s};},{immediate:36}],38:[function(t,e,r){var i={};(0, t("./lib/utils/common").assign)(i,t("./lib/deflate"),t("./lib/inflate"),t("./lib/zlib/constants")),e.exports=i;},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(t,e,r){var a=t("./zlib/deflate"),o=t("./utils/common"),h=t("./utils/strings"),n=t("./zlib/messages"),s=t("./zlib/zstream"),u=Object.prototype.toString,l=0,f=-1,d=0,c=8;function p(t){if(!(this instanceof p))return new p(t);this.options=o.assign({level:f,method:c,chunkSize:16384,windowBits:15,memLevel:8,strategy:d,to:""},t||{});var e=this.options;e.raw&&0<e.windowBits?e.windowBits=-e.windowBits:e.gzip&&0<e.windowBits&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new s,this.strm.avail_out=0;var r=a.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(r!==l)throw new Error(n[r]);if(e.header&&a.deflateSetHeader(this.strm,e.header),e.dictionary){var i;if(i="string"==typeof e.dictionary?h.string2buf(e.dictionary):"[object ArrayBuffer]"===u.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,(r=a.deflateSetDictionary(this.strm,i))!==l)throw new Error(n[r]);this._dict_set=!0;}}function i(t,e){var r=new p(e);if(r.push(t,!0),r.err)throw r.msg||n[r.err];return r.result}p.prototype.push=function(t,e){var r,i,n=this.strm,s=this.options.chunkSize;if(this.ended)return !1;i=e===~~e?e:!0===e?4:0,"string"==typeof t?n.input=h.string2buf(t):"[object ArrayBuffer]"===u.call(t)?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;do{if(0===n.avail_out&&(n.output=new o.Buf8(s),n.next_out=0,n.avail_out=s),1!==(r=a.deflate(n,i))&&r!==l)return this.onEnd(r),!(this.ended=!0);0!==n.avail_out&&(0!==n.avail_in||4!==i&&2!==i)||("string"===this.options.to?this.onData(h.buf2binstring(o.shrinkBuf(n.output,n.next_out))):this.onData(o.shrinkBuf(n.output,n.next_out)));}while((0<n.avail_in||0===n.avail_out)&&1!==r);return 4===i?(r=a.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===l):2!==i||(this.onEnd(l),!(n.avail_out=0))},p.prototype.onData=function(t){this.chunks.push(t);},p.prototype.onEnd=function(t){t===l&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg;},r.Deflate=p,r.deflate=i,r.deflateRaw=function(t,e){return (e=e||{}).raw=!0,i(t,e)},r.gzip=function(t,e){return (e=e||{}).gzip=!0,i(t,e)};},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(t,e,r){var d=t("./zlib/inflate"),c=t("./utils/common"),p=t("./utils/strings"),m=t("./zlib/constants"),i=t("./zlib/messages"),n=t("./zlib/zstream"),s=t("./zlib/gzheader"),_=Object.prototype.toString;function a(t){if(!(this instanceof a))return new a(t);this.options=c.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&0<=e.windowBits&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(0<=e.windowBits&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),15<e.windowBits&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new n,this.strm.avail_out=0;var r=d.inflateInit2(this.strm,e.windowBits);if(r!==m.Z_OK)throw new Error(i[r]);this.header=new s,d.inflateGetHeader(this.strm,this.header);}function o(t,e){var r=new a(e);if(r.push(t,!0),r.err)throw r.msg||i[r.err];return r.result}a.prototype.push=function(t,e){var r,i,n,s,a,o,h=this.strm,u=this.options.chunkSize,l=this.options.dictionary,f=!1;if(this.ended)return !1;i=e===~~e?e:!0===e?m.Z_FINISH:m.Z_NO_FLUSH,"string"==typeof t?h.input=p.binstring2buf(t):"[object ArrayBuffer]"===_.call(t)?h.input=new Uint8Array(t):h.input=t,h.next_in=0,h.avail_in=h.input.length;do{if(0===h.avail_out&&(h.output=new c.Buf8(u),h.next_out=0,h.avail_out=u),(r=d.inflate(h,m.Z_NO_FLUSH))===m.Z_NEED_DICT&&l&&(o="string"==typeof l?p.string2buf(l):"[object ArrayBuffer]"===_.call(l)?new Uint8Array(l):l,r=d.inflateSetDictionary(this.strm,o)),r===m.Z_BUF_ERROR&&!0===f&&(r=m.Z_OK,f=!1),r!==m.Z_STREAM_END&&r!==m.Z_OK)return this.onEnd(r),!(this.ended=!0);h.next_out&&(0!==h.avail_out&&r!==m.Z_STREAM_END&&(0!==h.avail_in||i!==m.Z_FINISH&&i!==m.Z_SYNC_FLUSH)||("string"===this.options.to?(n=p.utf8border(h.output,h.next_out),s=h.next_out-n,a=p.buf2string(h.output,n),h.next_out=s,h.avail_out=u-s,s&&c.arraySet(h.output,h.output,n,s,0),this.onData(a)):this.onData(c.shrinkBuf(h.output,h.next_out)))),0===h.avail_in&&0===h.avail_out&&(f=!0);}while((0<h.avail_in||0===h.avail_out)&&r!==m.Z_STREAM_END);return r===m.Z_STREAM_END&&(i=m.Z_FINISH),i===m.Z_FINISH?(r=d.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===m.Z_OK):i!==m.Z_SYNC_FLUSH||(this.onEnd(m.Z_OK),!(h.avail_out=0))},a.prototype.onData=function(t){this.chunks.push(t);},a.prototype.onEnd=function(t){t===m.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=c.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg;},r.Inflate=a,r.inflate=o,r.inflateRaw=function(t,e){return (e=e||{}).raw=!0,o(t,e)},r.ungzip=o;},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(t,e,r){var i="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;r.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var r=e.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(var i in r)r.hasOwnProperty(i)&&(t[i]=r[i]);}}return t},r.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var n={arraySet:function(t,e,r,i,n){if(e.subarray&&t.subarray)t.set(e.subarray(r,r+i),n);else for(var s=0;s<i;s++)t[n+s]=e[r+s];},flattenChunks:function(t){var e,r,i,n,s,a;for(e=i=0,r=t.length;e<r;e++)i+=t[e].length;for(a=new Uint8Array(i),e=n=0,r=t.length;e<r;e++)s=t[e],a.set(s,n),n+=s.length;return a}},s={arraySet:function(t,e,r,i,n){for(var s=0;s<i;s++)t[n+s]=e[r+s];},flattenChunks:function(t){return [].concat.apply([],t)}};r.setTyped=function(t){t?(r.Buf8=Uint8Array,r.Buf16=Uint16Array,r.Buf32=Int32Array,r.assign(r,n)):(r.Buf8=Array,r.Buf16=Array,r.Buf32=Array,r.assign(r,s));},r.setTyped(i);},{}],42:[function(t,e,r){var h=t("./common"),n=!0,s=!0;try{String.fromCharCode.apply(null,[0]);}catch(t){n=!1;}try{String.fromCharCode.apply(null,new Uint8Array(1));}catch(t){s=!1;}for(var u=new h.Buf8(256),i=0;i<256;i++)u[i]=252<=i?6:248<=i?5:240<=i?4:224<=i?3:192<=i?2:1;function l(t,e){if(e<65537&&(t.subarray&&s||!t.subarray&&n))return String.fromCharCode.apply(null,h.shrinkBuf(t,e));for(var r="",i=0;i<e;i++)r+=String.fromCharCode(t[i]);return r}u[254]=u[254]=1,r.string2buf=function(t){var e,r,i,n,s,a=t.length,o=0;for(n=0;n<a;n++)55296==(64512&(r=t.charCodeAt(n)))&&n+1<a&&56320==(64512&(i=t.charCodeAt(n+1)))&&(r=65536+(r-55296<<10)+(i-56320),n++),o+=r<128?1:r<2048?2:r<65536?3:4;for(e=new h.Buf8(o),n=s=0;s<o;n++)55296==(64512&(r=t.charCodeAt(n)))&&n+1<a&&56320==(64512&(i=t.charCodeAt(n+1)))&&(r=65536+(r-55296<<10)+(i-56320),n++),r<128?e[s++]=r:(r<2048?e[s++]=192|r>>>6:(r<65536?e[s++]=224|r>>>12:(e[s++]=240|r>>>18,e[s++]=128|r>>>12&63),e[s++]=128|r>>>6&63),e[s++]=128|63&r);return e},r.buf2binstring=function(t){return l(t,t.length)},r.binstring2buf=function(t){for(var e=new h.Buf8(t.length),r=0,i=e.length;r<i;r++)e[r]=t.charCodeAt(r);return e},r.buf2string=function(t,e){var r,i,n,s,a=e||t.length,o=new Array(2*a);for(r=i=0;r<a;)if((n=t[r++])<128)o[i++]=n;else if(4<(s=u[n]))o[i++]=65533,r+=s-1;else {for(n&=2===s?31:3===s?15:7;1<s&&r<a;)n=n<<6|63&t[r++],s--;1<s?o[i++]=65533:n<65536?o[i++]=n:(n-=65536,o[i++]=55296|n>>10&1023,o[i++]=56320|1023&n);}return l(o,i)},r.utf8border=function(t,e){var r;for((e=e||t.length)>t.length&&(e=t.length),r=e-1;0<=r&&128==(192&t[r]);)r--;return r<0?e:0===r?e:r+u[t[r]]>e?r:e};},{"./common":41}],43:[function(t,e,r){e.exports=function(t,e,r,i){for(var n=65535&t|0,s=t>>>16&65535|0,a=0;0!==r;){for(r-=a=2e3<r?2e3:r;s=s+(n=n+e[i++]|0)|0,--a;);n%=65521,s%=65521;}return n|s<<16|0};},{}],44:[function(t,e,r){e.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};},{}],45:[function(t,e,r){var o=function(){for(var t,e=[],r=0;r<256;r++){t=r;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[r]=t;}return e}();e.exports=function(t,e,r,i){var n=o,s=i+r;t^=-1;for(var a=i;a<s;a++)t=t>>>8^n[255&(t^e[a])];return -1^t};},{}],46:[function(t,e,r){var h,d=t("../utils/common"),u=t("./trees"),c=t("./adler32"),p=t("./crc32"),i=t("./messages"),l=0,f=4,m=0,_=-2,g=-1,b=4,n=2,v=8,y=9,s=286,a=30,o=19,w=2*s+1,k=15,x=3,S=258,z=S+x+1,C=42,E=113,A=1,I=2,O=3,B=4;function R(t,e){return t.msg=i[e],e}function T(t){return (t<<1)-(4<t?9:0)}function D(t){for(var e=t.length;0<=--e;)t[e]=0;}function F(t){var e=t.state,r=e.pending;r>t.avail_out&&(r=t.avail_out),0!==r&&(d.arraySet(t.output,e.pending_buf,e.pending_out,r,t.next_out),t.next_out+=r,e.pending_out+=r,t.total_out+=r,t.avail_out-=r,e.pending-=r,0===e.pending&&(e.pending_out=0));}function N(t,e){u._tr_flush_block(t,0<=t.block_start?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,F(t.strm);}function U(t,e){t.pending_buf[t.pending++]=e;}function P(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e;}function L(t,e){var r,i,n=t.max_chain_length,s=t.strstart,a=t.prev_length,o=t.nice_match,h=t.strstart>t.w_size-z?t.strstart-(t.w_size-z):0,u=t.window,l=t.w_mask,f=t.prev,d=t.strstart+S,c=u[s+a-1],p=u[s+a];t.prev_length>=t.good_match&&(n>>=2),o>t.lookahead&&(o=t.lookahead);do{if(u[(r=e)+a]===p&&u[r+a-1]===c&&u[r]===u[s]&&u[++r]===u[s+1]){s+=2,r++;do{}while(u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&s<d);if(i=S-(d-s),s=d-S,a<i){if(t.match_start=e,o<=(a=i))break;c=u[s+a-1],p=u[s+a];}}}while((e=f[e&l])>h&&0!=--n);return a<=t.lookahead?a:t.lookahead}function j(t){var e,r,i,n,s,a,o,h,u,l,f=t.w_size;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=f+(f-z)){for(d.arraySet(t.window,t.window,f,f,0),t.match_start-=f,t.strstart-=f,t.block_start-=f,e=r=t.hash_size;i=t.head[--e],t.head[e]=f<=i?i-f:0,--r;);for(e=r=f;i=t.prev[--e],t.prev[e]=f<=i?i-f:0,--r;);n+=f;}if(0===t.strm.avail_in)break;if(a=t.strm,o=t.window,h=t.strstart+t.lookahead,u=n,l=void 0,l=a.avail_in,u<l&&(l=u),r=0===l?0:(a.avail_in-=l,d.arraySet(o,a.input,a.next_in,l,h),1===a.state.wrap?a.adler=c(a.adler,o,l,h):2===a.state.wrap&&(a.adler=p(a.adler,o,l,h)),a.next_in+=l,a.total_in+=l,l),t.lookahead+=r,t.lookahead+t.insert>=x)for(s=t.strstart-t.insert,t.ins_h=t.window[s],t.ins_h=(t.ins_h<<t.hash_shift^t.window[s+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[s+x-1])&t.hash_mask,t.prev[s&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=s,s++,t.insert--,!(t.lookahead+t.insert<x)););}while(t.lookahead<z&&0!==t.strm.avail_in)}function Z(t,e){for(var r,i;;){if(t.lookahead<z){if(j(t),t.lookahead<z&&e===l)return A;if(0===t.lookahead)break}if(r=0,t.lookahead>=x&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+x-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==r&&t.strstart-r<=t.w_size-z&&(t.match_length=L(t,r)),t.match_length>=x)if(i=u._tr_tally(t,t.strstart-t.match_start,t.match_length-x),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=x){for(t.match_length--;t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+x-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart,0!=--t.match_length;);t.strstart++;}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+1])&t.hash_mask;else i=u._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(i&&(N(t,!1),0===t.strm.avail_out))return A}return t.insert=t.strstart<x-1?t.strstart:x-1,e===f?(N(t,!0),0===t.strm.avail_out?O:B):t.last_lit&&(N(t,!1),0===t.strm.avail_out)?A:I}function W(t,e){for(var r,i,n;;){if(t.lookahead<z){if(j(t),t.lookahead<z&&e===l)return A;if(0===t.lookahead)break}if(r=0,t.lookahead>=x&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+x-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=x-1,0!==r&&t.prev_length<t.max_lazy_match&&t.strstart-r<=t.w_size-z&&(t.match_length=L(t,r),t.match_length<=5&&(1===t.strategy||t.match_length===x&&4096<t.strstart-t.match_start)&&(t.match_length=x-1)),t.prev_length>=x&&t.match_length<=t.prev_length){for(n=t.strstart+t.lookahead-x,i=u._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-x),t.lookahead-=t.prev_length-1,t.prev_length-=2;++t.strstart<=n&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+x-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!=--t.prev_length;);if(t.match_available=0,t.match_length=x-1,t.strstart++,i&&(N(t,!1),0===t.strm.avail_out))return A}else if(t.match_available){if((i=u._tr_tally(t,0,t.window[t.strstart-1]))&&N(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return A}else t.match_available=1,t.strstart++,t.lookahead--;}return t.match_available&&(i=u._tr_tally(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<x-1?t.strstart:x-1,e===f?(N(t,!0),0===t.strm.avail_out?O:B):t.last_lit&&(N(t,!1),0===t.strm.avail_out)?A:I}function M(t,e,r,i,n){this.good_length=t,this.max_lazy=e,this.nice_length=r,this.max_chain=i,this.func=n;}function H(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=v,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new d.Buf16(2*w),this.dyn_dtree=new d.Buf16(2*(2*a+1)),this.bl_tree=new d.Buf16(2*(2*o+1)),D(this.dyn_ltree),D(this.dyn_dtree),D(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new d.Buf16(k+1),this.heap=new d.Buf16(2*s+1),D(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new d.Buf16(2*s+1),D(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0;}function G(t){var e;return t&&t.state?(t.total_in=t.total_out=0,t.data_type=n,(e=t.state).pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?C:E,t.adler=2===e.wrap?0:1,e.last_flush=l,u._tr_init(e),m):R(t,_)}function K(t){var e=G(t);return e===m&&function(t){t.window_size=2*t.w_size,D(t.head),t.max_lazy_match=h[t.level].max_lazy,t.good_match=h[t.level].good_length,t.nice_match=h[t.level].nice_length,t.max_chain_length=h[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=x-1,t.match_available=0,t.ins_h=0;}(t.state),e}function Y(t,e,r,i,n,s){if(!t)return _;var a=1;if(e===g&&(e=6),i<0?(a=0,i=-i):15<i&&(a=2,i-=16),n<1||y<n||r!==v||i<8||15<i||e<0||9<e||s<0||b<s)return R(t,_);8===i&&(i=9);var o=new H;return (t.state=o).strm=t,o.wrap=a,o.gzhead=null,o.w_bits=i,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=n+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+x-1)/x),o.window=new d.Buf8(2*o.w_size),o.head=new d.Buf16(o.hash_size),o.prev=new d.Buf16(o.w_size),o.lit_bufsize=1<<n+6,o.pending_buf_size=4*o.lit_bufsize,o.pending_buf=new d.Buf8(o.pending_buf_size),o.d_buf=1*o.lit_bufsize,o.l_buf=3*o.lit_bufsize,o.level=e,o.strategy=s,o.method=r,K(t)}h=[new M(0,0,0,0,function(t,e){var r=65535;for(r>t.pending_buf_size-5&&(r=t.pending_buf_size-5);;){if(t.lookahead<=1){if(j(t),0===t.lookahead&&e===l)return A;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var i=t.block_start+r;if((0===t.strstart||t.strstart>=i)&&(t.lookahead=t.strstart-i,t.strstart=i,N(t,!1),0===t.strm.avail_out))return A;if(t.strstart-t.block_start>=t.w_size-z&&(N(t,!1),0===t.strm.avail_out))return A}return t.insert=0,e===f?(N(t,!0),0===t.strm.avail_out?O:B):(t.strstart>t.block_start&&(N(t,!1),t.strm.avail_out),A)}),new M(4,4,8,4,Z),new M(4,5,16,8,Z),new M(4,6,32,32,Z),new M(4,4,16,16,W),new M(8,16,32,32,W),new M(8,16,128,128,W),new M(8,32,128,256,W),new M(32,128,258,1024,W),new M(32,258,258,4096,W)],r.deflateInit=function(t,e){return Y(t,e,v,15,8,0)},r.deflateInit2=Y,r.deflateReset=K,r.deflateResetKeep=G,r.deflateSetHeader=function(t,e){return t&&t.state?2!==t.state.wrap?_:(t.state.gzhead=e,m):_},r.deflate=function(t,e){var r,i,n,s;if(!t||!t.state||5<e||e<0)return t?R(t,_):_;if(i=t.state,!t.output||!t.input&&0!==t.avail_in||666===i.status&&e!==f)return R(t,0===t.avail_out?-5:_);if(i.strm=t,r=i.last_flush,i.last_flush=e,i.status===C)if(2===i.wrap)t.adler=0,U(i,31),U(i,139),U(i,8),i.gzhead?(U(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),U(i,255&i.gzhead.time),U(i,i.gzhead.time>>8&255),U(i,i.gzhead.time>>16&255),U(i,i.gzhead.time>>24&255),U(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),U(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(U(i,255&i.gzhead.extra.length),U(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=p(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(U(i,0),U(i,0),U(i,0),U(i,0),U(i,0),U(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),U(i,3),i.status=E);else {var a=v+(i.w_bits-8<<4)<<8;a|=(2<=i.strategy||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(a|=32),a+=31-a%31,i.status=E,P(i,a),0!==i.strstart&&(P(i,t.adler>>>16),P(i,65535&t.adler)),t.adler=1;}if(69===i.status)if(i.gzhead.extra){for(n=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>n&&(t.adler=p(t.adler,i.pending_buf,i.pending-n,n)),F(t),n=i.pending,i.pending!==i.pending_buf_size));)U(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>n&&(t.adler=p(t.adler,i.pending_buf,i.pending-n,n)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73);}else i.status=73;if(73===i.status)if(i.gzhead.name){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(t.adler=p(t.adler,i.pending_buf,i.pending-n,n)),F(t),n=i.pending,i.pending===i.pending_buf_size)){s=1;break}s=i.gzindex<i.gzhead.name.length?255&i.gzhead.name.charCodeAt(i.gzindex++):0,U(i,s);}while(0!==s);i.gzhead.hcrc&&i.pending>n&&(t.adler=p(t.adler,i.pending_buf,i.pending-n,n)),0===s&&(i.gzindex=0,i.status=91);}else i.status=91;if(91===i.status)if(i.gzhead.comment){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(t.adler=p(t.adler,i.pending_buf,i.pending-n,n)),F(t),n=i.pending,i.pending===i.pending_buf_size)){s=1;break}s=i.gzindex<i.gzhead.comment.length?255&i.gzhead.comment.charCodeAt(i.gzindex++):0,U(i,s);}while(0!==s);i.gzhead.hcrc&&i.pending>n&&(t.adler=p(t.adler,i.pending_buf,i.pending-n,n)),0===s&&(i.status=103);}else i.status=103;if(103===i.status&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&F(t),i.pending+2<=i.pending_buf_size&&(U(i,255&t.adler),U(i,t.adler>>8&255),t.adler=0,i.status=E)):i.status=E),0!==i.pending){if(F(t),0===t.avail_out)return i.last_flush=-1,m}else if(0===t.avail_in&&T(e)<=T(r)&&e!==f)return R(t,-5);if(666===i.status&&0!==t.avail_in)return R(t,-5);if(0!==t.avail_in||0!==i.lookahead||e!==l&&666!==i.status){var o=2===i.strategy?function(t,e){for(var r;;){if(0===t.lookahead&&(j(t),0===t.lookahead)){if(e===l)return A;break}if(t.match_length=0,r=u._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(N(t,!1),0===t.strm.avail_out))return A}return t.insert=0,e===f?(N(t,!0),0===t.strm.avail_out?O:B):t.last_lit&&(N(t,!1),0===t.strm.avail_out)?A:I}(i,e):3===i.strategy?function(t,e){for(var r,i,n,s,a=t.window;;){if(t.lookahead<=S){if(j(t),t.lookahead<=S&&e===l)return A;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=x&&0<t.strstart&&(i=a[n=t.strstart-1])===a[++n]&&i===a[++n]&&i===a[++n]){s=t.strstart+S;do{}while(i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&n<s);t.match_length=S-(s-n),t.match_length>t.lookahead&&(t.match_length=t.lookahead);}if(t.match_length>=x?(r=u._tr_tally(t,1,t.match_length-x),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=u._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(N(t,!1),0===t.strm.avail_out))return A}return t.insert=0,e===f?(N(t,!0),0===t.strm.avail_out?O:B):t.last_lit&&(N(t,!1),0===t.strm.avail_out)?A:I}(i,e):h[i.level].func(i,e);if(o!==O&&o!==B||(i.status=666),o===A||o===O)return 0===t.avail_out&&(i.last_flush=-1),m;if(o===I&&(1===e?u._tr_align(i):5!==e&&(u._tr_stored_block(i,0,0,!1),3===e&&(D(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),F(t),0===t.avail_out))return i.last_flush=-1,m}return e!==f?m:i.wrap<=0?1:(2===i.wrap?(U(i,255&t.adler),U(i,t.adler>>8&255),U(i,t.adler>>16&255),U(i,t.adler>>24&255),U(i,255&t.total_in),U(i,t.total_in>>8&255),U(i,t.total_in>>16&255),U(i,t.total_in>>24&255)):(P(i,t.adler>>>16),P(i,65535&t.adler)),F(t),0<i.wrap&&(i.wrap=-i.wrap),0!==i.pending?m:1)},r.deflateEnd=function(t){var e;return t&&t.state?(e=t.state.status)!==C&&69!==e&&73!==e&&91!==e&&103!==e&&e!==E&&666!==e?R(t,_):(t.state=null,e===E?R(t,-3):m):_},r.deflateSetDictionary=function(t,e){var r,i,n,s,a,o,h,u,l=e.length;if(!t||!t.state)return _;if(2===(s=(r=t.state).wrap)||1===s&&r.status!==C||r.lookahead)return _;for(1===s&&(t.adler=c(t.adler,e,l,0)),r.wrap=0,l>=r.w_size&&(0===s&&(D(r.head),r.strstart=0,r.block_start=0,r.insert=0),u=new d.Buf8(r.w_size),d.arraySet(u,e,l-r.w_size,r.w_size,0),e=u,l=r.w_size),a=t.avail_in,o=t.next_in,h=t.input,t.avail_in=l,t.next_in=0,t.input=e,j(r);r.lookahead>=x;){for(i=r.strstart,n=r.lookahead-(x-1);r.ins_h=(r.ins_h<<r.hash_shift^r.window[i+x-1])&r.hash_mask,r.prev[i&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=i,i++,--n;);r.strstart=i,r.lookahead=x-1,j(r);}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=x-1,r.match_available=0,t.next_in=o,t.input=h,t.avail_in=a,r.wrap=s,m},r.deflateInfo="pako deflate (from Nodeca project)";},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(t,e,r){e.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1;};},{}],48:[function(t,e,r){e.exports=function(t,e){var r,i,n,s,a,o,h,u,l,f,d,c,p,m,_,g,b,v,y,w,k,x,S,z,C;r=t.state,i=t.next_in,z=t.input,n=i+(t.avail_in-5),s=t.next_out,C=t.output,a=s-(e-t.avail_out),o=s+(t.avail_out-257),h=r.dmax,u=r.wsize,l=r.whave,f=r.wnext,d=r.window,c=r.hold,p=r.bits,m=r.lencode,_=r.distcode,g=(1<<r.lenbits)-1,b=(1<<r.distbits)-1;t:do{p<15&&(c+=z[i++]<<p,p+=8,c+=z[i++]<<p,p+=8),v=m[c&g];e:for(;;){if(c>>>=y=v>>>24,p-=y,0===(y=v>>>16&255))C[s++]=65535&v;else {if(!(16&y)){if(0==(64&y)){v=m[(65535&v)+(c&(1<<y)-1)];continue e}if(32&y){r.mode=12;break t}t.msg="invalid literal/length code",r.mode=30;break t}w=65535&v,(y&=15)&&(p<y&&(c+=z[i++]<<p,p+=8),w+=c&(1<<y)-1,c>>>=y,p-=y),p<15&&(c+=z[i++]<<p,p+=8,c+=z[i++]<<p,p+=8),v=_[c&b];r:for(;;){if(c>>>=y=v>>>24,p-=y,!(16&(y=v>>>16&255))){if(0==(64&y)){v=_[(65535&v)+(c&(1<<y)-1)];continue r}t.msg="invalid distance code",r.mode=30;break t}if(k=65535&v,p<(y&=15)&&(c+=z[i++]<<p,(p+=8)<y&&(c+=z[i++]<<p,p+=8)),h<(k+=c&(1<<y)-1)){t.msg="invalid distance too far back",r.mode=30;break t}if(c>>>=y,p-=y,(y=s-a)<k){if(l<(y=k-y)&&r.sane){t.msg="invalid distance too far back",r.mode=30;break t}if(S=d,(x=0)===f){if(x+=u-y,y<w){for(w-=y;C[s++]=d[x++],--y;);x=s-k,S=C;}}else if(f<y){if(x+=u+f-y,(y-=f)<w){for(w-=y;C[s++]=d[x++],--y;);if(x=0,f<w){for(w-=y=f;C[s++]=d[x++],--y;);x=s-k,S=C;}}}else if(x+=f-y,y<w){for(w-=y;C[s++]=d[x++],--y;);x=s-k,S=C;}for(;2<w;)C[s++]=S[x++],C[s++]=S[x++],C[s++]=S[x++],w-=3;w&&(C[s++]=S[x++],1<w&&(C[s++]=S[x++]));}else {for(x=s-k;C[s++]=C[x++],C[s++]=C[x++],C[s++]=C[x++],2<(w-=3););w&&(C[s++]=C[x++],1<w&&(C[s++]=C[x++]));}break}}break}}while(i<n&&s<o);i-=w=p>>3,c&=(1<<(p-=w<<3))-1,t.next_in=i,t.next_out=s,t.avail_in=i<n?n-i+5:5-(i-n),t.avail_out=s<o?o-s+257:257-(s-o),r.hold=c,r.bits=p;};},{}],49:[function(t,e,r){var I=t("../utils/common"),O=t("./adler32"),B=t("./crc32"),R=t("./inffast"),T=t("./inftrees"),D=1,F=2,N=0,U=-2,P=1,i=852,n=592;function L(t){return (t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function s(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new I.Buf16(320),this.work=new I.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0;}function a(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=P,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new I.Buf32(i),e.distcode=e.distdyn=new I.Buf32(n),e.sane=1,e.back=-1,N):U}function o(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,a(t)):U}function h(t,e){var r,i;return t&&t.state?(i=t.state,e<0?(r=0,e=-e):(r=1+(e>>4),e<48&&(e&=15)),e&&(e<8||15<e)?U:(null!==i.window&&i.wbits!==e&&(i.window=null),i.wrap=r,i.wbits=e,o(t))):U}function u(t,e){var r,i;return t?(i=new s,(t.state=i).window=null,(r=h(t,e))!==N&&(t.state=null),r):U}var l,f,d=!0;function j(t){if(d){var e;for(l=new I.Buf32(512),f=new I.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(T(D,t.lens,0,288,l,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;T(F,t.lens,0,32,f,0,t.work,{bits:5}),d=!1;}t.lencode=l,t.lenbits=9,t.distcode=f,t.distbits=5;}function Z(t,e,r,i){var n,s=t.state;return null===s.window&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new I.Buf8(s.wsize)),i>=s.wsize?(I.arraySet(s.window,e,r-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):(i<(n=s.wsize-s.wnext)&&(n=i),I.arraySet(s.window,e,r-i,n,s.wnext),(i-=n)?(I.arraySet(s.window,e,r-i,i,0),s.wnext=i,s.whave=s.wsize):(s.wnext+=n,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=n))),0}r.inflateReset=o,r.inflateReset2=h,r.inflateResetKeep=a,r.inflateInit=function(t){return u(t,15)},r.inflateInit2=u,r.inflate=function(t,e){var r,i,n,s,a,o,h,u,l,f,d,c,p,m,_,g,b,v,y,w,k,x,S,z,C=0,E=new I.Buf8(4),A=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return U;12===(r=t.state).mode&&(r.mode=13),a=t.next_out,n=t.output,h=t.avail_out,s=t.next_in,i=t.input,o=t.avail_in,u=r.hold,l=r.bits,f=o,d=h,x=N;t:for(;;)switch(r.mode){case P:if(0===r.wrap){r.mode=13;break}for(;l<16;){if(0===o)break t;o--,u+=i[s++]<<l,l+=8;}if(2&r.wrap&&35615===u){E[r.check=0]=255&u,E[1]=u>>>8&255,r.check=B(r.check,E,2,0),l=u=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){t.msg="incorrect header check",r.mode=30;break}if(8!=(15&u)){t.msg="unknown compression method",r.mode=30;break}if(l-=4,k=8+(15&(u>>>=4)),0===r.wbits)r.wbits=k;else if(k>r.wbits){t.msg="invalid window size",r.mode=30;break}r.dmax=1<<k,t.adler=r.check=1,r.mode=512&u?10:12,l=u=0;break;case 2:for(;l<16;){if(0===o)break t;o--,u+=i[s++]<<l,l+=8;}if(r.flags=u,8!=(255&r.flags)){t.msg="unknown compression method",r.mode=30;break}if(57344&r.flags){t.msg="unknown header flags set",r.mode=30;break}r.head&&(r.head.text=u>>8&1),512&r.flags&&(E[0]=255&u,E[1]=u>>>8&255,r.check=B(r.check,E,2,0)),l=u=0,r.mode=3;case 3:for(;l<32;){if(0===o)break t;o--,u+=i[s++]<<l,l+=8;}r.head&&(r.head.time=u),512&r.flags&&(E[0]=255&u,E[1]=u>>>8&255,E[2]=u>>>16&255,E[3]=u>>>24&255,r.check=B(r.check,E,4,0)),l=u=0,r.mode=4;case 4:for(;l<16;){if(0===o)break t;o--,u+=i[s++]<<l,l+=8;}r.head&&(r.head.xflags=255&u,r.head.os=u>>8),512&r.flags&&(E[0]=255&u,E[1]=u>>>8&255,r.check=B(r.check,E,2,0)),l=u=0,r.mode=5;case 5:if(1024&r.flags){for(;l<16;){if(0===o)break t;o--,u+=i[s++]<<l,l+=8;}r.length=u,r.head&&(r.head.extra_len=u),512&r.flags&&(E[0]=255&u,E[1]=u>>>8&255,r.check=B(r.check,E,2,0)),l=u=0;}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&(o<(c=r.length)&&(c=o),c&&(r.head&&(k=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),I.arraySet(r.head.extra,i,s,c,k)),512&r.flags&&(r.check=B(r.check,i,c,s)),o-=c,s+=c,r.length-=c),r.length))break t;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===o)break t;for(c=0;k=i[s+c++],r.head&&k&&r.length<65536&&(r.head.name+=String.fromCharCode(k)),k&&c<o;);if(512&r.flags&&(r.check=B(r.check,i,c,s)),o-=c,s+=c,k)break t}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&r.flags){if(0===o)break t;for(c=0;k=i[s+c++],r.head&&k&&r.length<65536&&(r.head.comment+=String.fromCharCode(k)),k&&c<o;);if(512&r.flags&&(r.check=B(r.check,i,c,s)),o-=c,s+=c,k)break t}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&r.flags){for(;l<16;){if(0===o)break t;o--,u+=i[s++]<<l,l+=8;}if(u!==(65535&r.check)){t.msg="header crc mismatch",r.mode=30;break}l=u=0;}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=12;break;case 10:for(;l<32;){if(0===o)break t;o--,u+=i[s++]<<l,l+=8;}t.adler=r.check=L(u),l=u=0,r.mode=11;case 11:if(0===r.havedict)return t.next_out=a,t.avail_out=h,t.next_in=s,t.avail_in=o,r.hold=u,r.bits=l,2;t.adler=r.check=1,r.mode=12;case 12:if(5===e||6===e)break t;case 13:if(r.last){u>>>=7&l,l-=7&l,r.mode=27;break}for(;l<3;){if(0===o)break t;o--,u+=i[s++]<<l,l+=8;}switch(r.last=1&u,l-=1,3&(u>>>=1)){case 0:r.mode=14;break;case 1:if(j(r),r.mode=20,6!==e)break;u>>>=2,l-=2;break t;case 2:r.mode=17;break;case 3:t.msg="invalid block type",r.mode=30;}u>>>=2,l-=2;break;case 14:for(u>>>=7&l,l-=7&l;l<32;){if(0===o)break t;o--,u+=i[s++]<<l,l+=8;}if((65535&u)!=(u>>>16^65535)){t.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&u,l=u=0,r.mode=15,6===e)break t;case 15:r.mode=16;case 16:if(c=r.length){if(o<c&&(c=o),h<c&&(c=h),0===c)break t;I.arraySet(n,i,s,c,a),o-=c,s+=c,h-=c,a+=c,r.length-=c;break}r.mode=12;break;case 17:for(;l<14;){if(0===o)break t;o--,u+=i[s++]<<l,l+=8;}if(r.nlen=257+(31&u),u>>>=5,l-=5,r.ndist=1+(31&u),u>>>=5,l-=5,r.ncode=4+(15&u),u>>>=4,l-=4,286<r.nlen||30<r.ndist){t.msg="too many length or distance symbols",r.mode=30;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;l<3;){if(0===o)break t;o--,u+=i[s++]<<l,l+=8;}r.lens[A[r.have++]]=7&u,u>>>=3,l-=3;}for(;r.have<19;)r.lens[A[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,S={bits:r.lenbits},x=T(0,r.lens,0,19,r.lencode,0,r.work,S),r.lenbits=S.bits,x){t.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;g=(C=r.lencode[u&(1<<r.lenbits)-1])>>>16&255,b=65535&C,!((_=C>>>24)<=l);){if(0===o)break t;o--,u+=i[s++]<<l,l+=8;}if(b<16)u>>>=_,l-=_,r.lens[r.have++]=b;else {if(16===b){for(z=_+2;l<z;){if(0===o)break t;o--,u+=i[s++]<<l,l+=8;}if(u>>>=_,l-=_,0===r.have){t.msg="invalid bit length repeat",r.mode=30;break}k=r.lens[r.have-1],c=3+(3&u),u>>>=2,l-=2;}else if(17===b){for(z=_+3;l<z;){if(0===o)break t;o--,u+=i[s++]<<l,l+=8;}l-=_,k=0,c=3+(7&(u>>>=_)),u>>>=3,l-=3;}else {for(z=_+7;l<z;){if(0===o)break t;o--,u+=i[s++]<<l,l+=8;}l-=_,k=0,c=11+(127&(u>>>=_)),u>>>=7,l-=7;}if(r.have+c>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=30;break}for(;c--;)r.lens[r.have++]=k;}}if(30===r.mode)break;if(0===r.lens[256]){t.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,S={bits:r.lenbits},x=T(D,r.lens,0,r.nlen,r.lencode,0,r.work,S),r.lenbits=S.bits,x){t.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,S={bits:r.distbits},x=T(F,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,S),r.distbits=S.bits,x){t.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===e)break t;case 20:r.mode=21;case 21:if(6<=o&&258<=h){t.next_out=a,t.avail_out=h,t.next_in=s,t.avail_in=o,r.hold=u,r.bits=l,R(t,d),a=t.next_out,n=t.output,h=t.avail_out,s=t.next_in,i=t.input,o=t.avail_in,u=r.hold,l=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;g=(C=r.lencode[u&(1<<r.lenbits)-1])>>>16&255,b=65535&C,!((_=C>>>24)<=l);){if(0===o)break t;o--,u+=i[s++]<<l,l+=8;}if(g&&0==(240&g)){for(v=_,y=g,w=b;g=(C=r.lencode[w+((u&(1<<v+y)-1)>>v)])>>>16&255,b=65535&C,!(v+(_=C>>>24)<=l);){if(0===o)break t;o--,u+=i[s++]<<l,l+=8;}u>>>=v,l-=v,r.back+=v;}if(u>>>=_,l-=_,r.back+=_,r.length=b,0===g){r.mode=26;break}if(32&g){r.back=-1,r.mode=12;break}if(64&g){t.msg="invalid literal/length code",r.mode=30;break}r.extra=15&g,r.mode=22;case 22:if(r.extra){for(z=r.extra;l<z;){if(0===o)break t;o--,u+=i[s++]<<l,l+=8;}r.length+=u&(1<<r.extra)-1,u>>>=r.extra,l-=r.extra,r.back+=r.extra;}r.was=r.length,r.mode=23;case 23:for(;g=(C=r.distcode[u&(1<<r.distbits)-1])>>>16&255,b=65535&C,!((_=C>>>24)<=l);){if(0===o)break t;o--,u+=i[s++]<<l,l+=8;}if(0==(240&g)){for(v=_,y=g,w=b;g=(C=r.distcode[w+((u&(1<<v+y)-1)>>v)])>>>16&255,b=65535&C,!(v+(_=C>>>24)<=l);){if(0===o)break t;o--,u+=i[s++]<<l,l+=8;}u>>>=v,l-=v,r.back+=v;}if(u>>>=_,l-=_,r.back+=_,64&g){t.msg="invalid distance code",r.mode=30;break}r.offset=b,r.extra=15&g,r.mode=24;case 24:if(r.extra){for(z=r.extra;l<z;){if(0===o)break t;o--,u+=i[s++]<<l,l+=8;}r.offset+=u&(1<<r.extra)-1,u>>>=r.extra,l-=r.extra,r.back+=r.extra;}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===h)break t;if(c=d-h,r.offset>c){if((c=r.offset-c)>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=30;break}p=c>r.wnext?(c-=r.wnext,r.wsize-c):r.wnext-c,c>r.length&&(c=r.length),m=r.window;}else m=n,p=a-r.offset,c=r.length;for(h<c&&(c=h),h-=c,r.length-=c;n[a++]=m[p++],--c;);0===r.length&&(r.mode=21);break;case 26:if(0===h)break t;n[a++]=r.length,h--,r.mode=21;break;case 27:if(r.wrap){for(;l<32;){if(0===o)break t;o--,u|=i[s++]<<l,l+=8;}if(d-=h,t.total_out+=d,r.total+=d,d&&(t.adler=r.check=r.flags?B(r.check,n,d,a-d):O(r.check,n,d,a-d)),d=h,(r.flags?u:L(u))!==r.check){t.msg="incorrect data check",r.mode=30;break}l=u=0;}r.mode=28;case 28:if(r.wrap&&r.flags){for(;l<32;){if(0===o)break t;o--,u+=i[s++]<<l,l+=8;}if(u!==(4294967295&r.total)){t.msg="incorrect length check",r.mode=30;break}l=u=0;}r.mode=29;case 29:x=1;break t;case 30:x=-3;break t;case 31:return -4;case 32:default:return U}return t.next_out=a,t.avail_out=h,t.next_in=s,t.avail_in=o,r.hold=u,r.bits=l,(r.wsize||d!==t.avail_out&&r.mode<30&&(r.mode<27||4!==e))&&Z(t,t.output,t.next_out,d-t.avail_out)?(r.mode=31,-4):(f-=t.avail_in,d-=t.avail_out,t.total_in+=f,t.total_out+=d,r.total+=d,r.wrap&&d&&(t.adler=r.check=r.flags?B(r.check,n,d,t.next_out-d):O(r.check,n,d,t.next_out-d)),t.data_type=r.bits+(r.last?64:0)+(12===r.mode?128:0)+(20===r.mode||15===r.mode?256:0),(0==f&&0===d||4===e)&&x===N&&(x=-5),x)},r.inflateEnd=function(t){if(!t||!t.state)return U;var e=t.state;return e.window&&(e.window=null),t.state=null,N},r.inflateGetHeader=function(t,e){var r;return t&&t.state?0==(2&(r=t.state).wrap)?U:((r.head=e).done=!1,N):U},r.inflateSetDictionary=function(t,e){var r,i=e.length;return t&&t.state?0!==(r=t.state).wrap&&11!==r.mode?U:11===r.mode&&O(1,e,i,0)!==r.check?-3:Z(t,e,i,i)?(r.mode=31,-4):(r.havedict=1,N):U},r.inflateInfo="pako inflate (from Nodeca project)";},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(t,e,r){var D=t("../utils/common"),F=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],N=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],U=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],P=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];e.exports=function(t,e,r,i,n,s,a,o){var h,u,l,f,d,c,p,m,_,g=o.bits,b=0,v=0,y=0,w=0,k=0,x=0,S=0,z=0,C=0,E=0,A=null,I=0,O=new D.Buf16(16),B=new D.Buf16(16),R=null,T=0;for(b=0;b<=15;b++)O[b]=0;for(v=0;v<i;v++)O[e[r+v]]++;for(k=g,w=15;1<=w&&0===O[w];w--);if(w<k&&(k=w),0===w)return n[s++]=20971520,n[s++]=20971520,o.bits=1,0;for(y=1;y<w&&0===O[y];y++);for(k<y&&(k=y),b=z=1;b<=15;b++)if(z<<=1,(z-=O[b])<0)return -1;if(0<z&&(0===t||1!==w))return -1;for(B[1]=0,b=1;b<15;b++)B[b+1]=B[b]+O[b];for(v=0;v<i;v++)0!==e[r+v]&&(a[B[e[r+v]]++]=v);if(c=0===t?(A=R=a,19):1===t?(A=F,I-=257,R=N,T-=257,256):(A=U,R=P,-1),b=y,d=s,S=v=E=0,l=-1,f=(C=1<<(x=k))-1,1===t&&852<C||2===t&&592<C)return 1;for(;;){for(p=b-S,_=a[v]<c?(m=0,a[v]):a[v]>c?(m=R[T+a[v]],A[I+a[v]]):(m=96,0),h=1<<b-S,y=u=1<<x;n[d+(E>>S)+(u-=h)]=p<<24|m<<16|_|0,0!==u;);for(h=1<<b-1;E&h;)h>>=1;if(0!==h?(E&=h-1,E+=h):E=0,v++,0==--O[b]){if(b===w)break;b=e[r+a[v]];}if(k<b&&(E&f)!==l){for(0===S&&(S=k),d+=y,z=1<<(x=b-S);x+S<w&&!((z-=O[x+S])<=0);)x++,z<<=1;if(C+=1<<x,1===t&&852<C||2===t&&592<C)return 1;n[l=E&f]=k<<24|x<<16|d-s|0;}}return 0!==E&&(n[d+E]=b-S<<24|64<<16|0),o.bits=k,0};},{"../utils/common":41}],51:[function(t,e,r){e.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"};},{}],52:[function(t,e,r){var n=t("../utils/common"),o=0,h=1;function i(t){for(var e=t.length;0<=--e;)t[e]=0;}var s=0,a=29,u=256,l=u+1+a,f=30,d=19,_=2*l+1,g=15,c=16,p=7,m=256,b=16,v=17,y=18,w=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],k=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],x=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],S=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],z=new Array(2*(l+2));i(z);var C=new Array(2*f);i(C);var E=new Array(512);i(E);var A=new Array(256);i(A);var I=new Array(a);i(I);var O,B,R,T=new Array(f);function D(t,e,r,i,n){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=i,this.max_length=n,this.has_stree=t&&t.length;}function F(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e;}function N(t){return t<256?E[t]:E[256+(t>>>7)]}function U(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255;}function P(t,e,r){t.bi_valid>c-r?(t.bi_buf|=e<<t.bi_valid&65535,U(t,t.bi_buf),t.bi_buf=e>>c-t.bi_valid,t.bi_valid+=r-c):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=r);}function L(t,e,r){P(t,r[2*e],r[2*e+1]);}function j(t,e){for(var r=0;r|=1&t,t>>>=1,r<<=1,0<--e;);return r>>>1}function Z(t,e,r){var i,n,s=new Array(g+1),a=0;for(i=1;i<=g;i++)s[i]=a=a+r[i-1]<<1;for(n=0;n<=e;n++){var o=t[2*n+1];0!==o&&(t[2*n]=j(s[o]++,o));}}function W(t){var e;for(e=0;e<l;e++)t.dyn_ltree[2*e]=0;for(e=0;e<f;e++)t.dyn_dtree[2*e]=0;for(e=0;e<d;e++)t.bl_tree[2*e]=0;t.dyn_ltree[2*m]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0;}function M(t){8<t.bi_valid?U(t,t.bi_buf):0<t.bi_valid&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0;}function H(t,e,r,i){var n=2*e,s=2*r;return t[n]<t[s]||t[n]===t[s]&&i[e]<=i[r]}function G(t,e,r){for(var i=t.heap[r],n=r<<1;n<=t.heap_len&&(n<t.heap_len&&H(e,t.heap[n+1],t.heap[n],t.depth)&&n++,!H(e,i,t.heap[n],t.depth));)t.heap[r]=t.heap[n],r=n,n<<=1;t.heap[r]=i;}function K(t,e,r){var i,n,s,a,o=0;if(0!==t.last_lit)for(;i=t.pending_buf[t.d_buf+2*o]<<8|t.pending_buf[t.d_buf+2*o+1],n=t.pending_buf[t.l_buf+o],o++,0===i?L(t,n,e):(L(t,(s=A[n])+u+1,e),0!==(a=w[s])&&P(t,n-=I[s],a),L(t,s=N(--i),r),0!==(a=k[s])&&P(t,i-=T[s],a)),o<t.last_lit;);L(t,m,e);}function Y(t,e){var r,i,n,s=e.dyn_tree,a=e.stat_desc.static_tree,o=e.stat_desc.has_stree,h=e.stat_desc.elems,u=-1;for(t.heap_len=0,t.heap_max=_,r=0;r<h;r++)0!==s[2*r]?(t.heap[++t.heap_len]=u=r,t.depth[r]=0):s[2*r+1]=0;for(;t.heap_len<2;)s[2*(n=t.heap[++t.heap_len]=u<2?++u:0)]=1,t.depth[n]=0,t.opt_len--,o&&(t.static_len-=a[2*n+1]);for(e.max_code=u,r=t.heap_len>>1;1<=r;r--)G(t,s,r);for(n=h;r=t.heap[1],t.heap[1]=t.heap[t.heap_len--],G(t,s,1),i=t.heap[1],t.heap[--t.heap_max]=r,t.heap[--t.heap_max]=i,s[2*n]=s[2*r]+s[2*i],t.depth[n]=(t.depth[r]>=t.depth[i]?t.depth[r]:t.depth[i])+1,s[2*r+1]=s[2*i+1]=n,t.heap[1]=n++,G(t,s,1),2<=t.heap_len;);t.heap[--t.heap_max]=t.heap[1],function(t,e){var r,i,n,s,a,o,h=e.dyn_tree,u=e.max_code,l=e.stat_desc.static_tree,f=e.stat_desc.has_stree,d=e.stat_desc.extra_bits,c=e.stat_desc.extra_base,p=e.stat_desc.max_length,m=0;for(s=0;s<=g;s++)t.bl_count[s]=0;for(h[2*t.heap[t.heap_max]+1]=0,r=t.heap_max+1;r<_;r++)p<(s=h[2*h[2*(i=t.heap[r])+1]+1]+1)&&(s=p,m++),h[2*i+1]=s,u<i||(t.bl_count[s]++,a=0,c<=i&&(a=d[i-c]),o=h[2*i],t.opt_len+=o*(s+a),f&&(t.static_len+=o*(l[2*i+1]+a)));if(0!==m){do{for(s=p-1;0===t.bl_count[s];)s--;t.bl_count[s]--,t.bl_count[s+1]+=2,t.bl_count[p]--,m-=2;}while(0<m);for(s=p;0!==s;s--)for(i=t.bl_count[s];0!==i;)u<(n=t.heap[--r])||(h[2*n+1]!==s&&(t.opt_len+=(s-h[2*n+1])*h[2*n],h[2*n+1]=s),i--);}}(t,e),Z(s,u,t.bl_count);}function X(t,e,r){var i,n,s=-1,a=e[1],o=0,h=7,u=4;for(0===a&&(h=138,u=3),e[2*(r+1)+1]=65535,i=0;i<=r;i++)n=a,a=e[2*(i+1)+1],++o<h&&n===a||(o<u?t.bl_tree[2*n]+=o:0!==n?(n!==s&&t.bl_tree[2*n]++,t.bl_tree[2*b]++):o<=10?t.bl_tree[2*v]++:t.bl_tree[2*y]++,s=n,u=(o=0)===a?(h=138,3):n===a?(h=6,3):(h=7,4));}function V(t,e,r){var i,n,s=-1,a=e[1],o=0,h=7,u=4;for(0===a&&(h=138,u=3),i=0;i<=r;i++)if(n=a,a=e[2*(i+1)+1],!(++o<h&&n===a)){if(o<u)for(;L(t,n,t.bl_tree),0!=--o;);else 0!==n?(n!==s&&(L(t,n,t.bl_tree),o--),L(t,b,t.bl_tree),P(t,o-3,2)):o<=10?(L(t,v,t.bl_tree),P(t,o-3,3)):(L(t,y,t.bl_tree),P(t,o-11,7));s=n,u=(o=0)===a?(h=138,3):n===a?(h=6,3):(h=7,4);}}i(T);var q=!1;function J(t,e,r,i){P(t,(s<<1)+(i?1:0),3),function(t,e,r,i){M(t),i&&(U(t,r),U(t,~r)),n.arraySet(t.pending_buf,t.window,e,r,t.pending),t.pending+=r;}(t,e,r,!0);}r._tr_init=function(t){q||(function(){var t,e,r,i,n,s=new Array(g+1);for(i=r=0;i<a-1;i++)for(I[i]=r,t=0;t<1<<w[i];t++)A[r++]=i;for(A[r-1]=i,i=n=0;i<16;i++)for(T[i]=n,t=0;t<1<<k[i];t++)E[n++]=i;for(n>>=7;i<f;i++)for(T[i]=n<<7,t=0;t<1<<k[i]-7;t++)E[256+n++]=i;for(e=0;e<=g;e++)s[e]=0;for(t=0;t<=143;)z[2*t+1]=8,t++,s[8]++;for(;t<=255;)z[2*t+1]=9,t++,s[9]++;for(;t<=279;)z[2*t+1]=7,t++,s[7]++;for(;t<=287;)z[2*t+1]=8,t++,s[8]++;for(Z(z,l+1,s),t=0;t<f;t++)C[2*t+1]=5,C[2*t]=j(t,5);O=new D(z,w,u+1,l,g),B=new D(C,k,0,f,g),R=new D(new Array(0),x,0,d,p);}(),q=!0),t.l_desc=new F(t.dyn_ltree,O),t.d_desc=new F(t.dyn_dtree,B),t.bl_desc=new F(t.bl_tree,R),t.bi_buf=0,t.bi_valid=0,W(t);},r._tr_stored_block=J,r._tr_flush_block=function(t,e,r,i){var n,s,a=0;0<t.level?(2===t.strm.data_type&&(t.strm.data_type=function(t){var e,r=4093624447;for(e=0;e<=31;e++,r>>>=1)if(1&r&&0!==t.dyn_ltree[2*e])return o;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return h;for(e=32;e<u;e++)if(0!==t.dyn_ltree[2*e])return h;return o}(t)),Y(t,t.l_desc),Y(t,t.d_desc),a=function(t){var e;for(X(t,t.dyn_ltree,t.l_desc.max_code),X(t,t.dyn_dtree,t.d_desc.max_code),Y(t,t.bl_desc),e=d-1;3<=e&&0===t.bl_tree[2*S[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),n=t.opt_len+3+7>>>3,(s=t.static_len+3+7>>>3)<=n&&(n=s)):n=s=r+5,r+4<=n&&-1!==e?J(t,e,r,i):4===t.strategy||s===n?(P(t,2+(i?1:0),3),K(t,z,C)):(P(t,4+(i?1:0),3),function(t,e,r,i){var n;for(P(t,e-257,5),P(t,r-1,5),P(t,i-4,4),n=0;n<i;n++)P(t,t.bl_tree[2*S[n]+1],3);V(t,t.dyn_ltree,e-1),V(t,t.dyn_dtree,r-1);}(t,t.l_desc.max_code+1,t.d_desc.max_code+1,a+1),K(t,t.dyn_ltree,t.dyn_dtree)),W(t),i&&M(t);},r._tr_tally=function(t,e,r){return t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&r,t.last_lit++,0===e?t.dyn_ltree[2*r]++:(t.matches++,e--,t.dyn_ltree[2*(A[r]+u+1)]++,t.dyn_dtree[2*N(e)]++),t.last_lit===t.lit_bufsize-1},r._tr_align=function(t){P(t,2,3),L(t,m,z),function(t){16===t.bi_valid?(U(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):8<=t.bi_valid&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8);}(t);};},{"../utils/common":41}],53:[function(t,e,r){e.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0;};},{}],54:[function(t,e,r){e.exports="function"==typeof setImmediate?setImmediate:function(){var t=[].slice.apply(arguments);t.splice(1,0,0),setTimeout.apply(null,t);};},{}]},{},[10])(10)});
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Reads XLSX file in a browser.
|
|
201
|
+
* @param {file} file - A file being uploaded in the browser.
|
|
202
|
+
* @return {Promise} Resolves to an object holding XLSX file entries.
|
|
203
|
+
*/
|
|
204
|
+
|
|
205
|
+
function unpackXlsxFile(file) {
|
|
206
|
+
return jszip_min.loadAsync(file).then(function (zip) {
|
|
207
|
+
var files = [];
|
|
208
|
+
zip.forEach(function (relativePath, zipEntry) {
|
|
209
|
+
if (!zipEntry.dir) {
|
|
210
|
+
files.push(zipEntry.name);
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
var entries = {};
|
|
214
|
+
return Promise.all(files.map(function (file) {
|
|
215
|
+
return zip.file(file).async('string').then(function (content) {
|
|
216
|
+
return entries[file] = content;
|
|
217
|
+
});
|
|
218
|
+
})).then(function () {
|
|
219
|
+
return entries;
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
function findChild(node, tagName) {
|
|
225
|
+
var i = 0;
|
|
226
|
+
|
|
227
|
+
while (i < node.childNodes.length) {
|
|
228
|
+
var childNode = node.childNodes[i]; // `nodeType: 1` means "Element".
|
|
229
|
+
// https://www.w3schools.com/xml/prop_element_nodetype.asp
|
|
230
|
+
|
|
231
|
+
if (childNode.nodeType === 1 && getTagName(childNode) === tagName) {
|
|
232
|
+
return childNode;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
i++;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
function findChildren(node, tagName) {
|
|
239
|
+
var results = [];
|
|
240
|
+
var i = 0;
|
|
241
|
+
|
|
242
|
+
while (i < node.childNodes.length) {
|
|
243
|
+
var childNode = node.childNodes[i]; // `nodeType: 1` means "Element".
|
|
244
|
+
// https://www.w3schools.com/xml/prop_element_nodetype.asp
|
|
245
|
+
|
|
246
|
+
if (childNode.nodeType === 1 && getTagName(childNode) === tagName) {
|
|
247
|
+
results.push(childNode);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
i++;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
return results;
|
|
254
|
+
}
|
|
255
|
+
function forEach(node, tagName, func) {
|
|
256
|
+
// if (typeof tagName === 'function') {
|
|
257
|
+
// func = tagName
|
|
258
|
+
// tagName = undefined
|
|
259
|
+
// }
|
|
260
|
+
var i = 0;
|
|
261
|
+
|
|
262
|
+
while (i < node.childNodes.length) {
|
|
263
|
+
var childNode = node.childNodes[i];
|
|
264
|
+
|
|
265
|
+
if (tagName) {
|
|
266
|
+
// `nodeType: 1` means "Element".
|
|
267
|
+
// https://www.w3schools.com/xml/prop_element_nodetype.asp
|
|
268
|
+
if (childNode.nodeType === 1 && getTagName(childNode) === tagName) {
|
|
269
|
+
func(childNode, i);
|
|
270
|
+
}
|
|
271
|
+
} else {
|
|
272
|
+
func(childNode, i);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
i++;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
function map(node, tagName, func) {
|
|
279
|
+
var results = [];
|
|
280
|
+
forEach(node, tagName, function (node, i) {
|
|
281
|
+
results.push(func(node, i));
|
|
282
|
+
});
|
|
283
|
+
return results;
|
|
284
|
+
}
|
|
285
|
+
var NAMESPACE_REG_EXP = /.+\:/;
|
|
286
|
+
function getTagName(element) {
|
|
287
|
+
// For some weird reason, if an element is declared as,
|
|
288
|
+
// for example, `<x:sheets/>`, then its `.tagName` will be
|
|
289
|
+
// "x:sheets" instead of just "sheets".
|
|
290
|
+
// https://gitlab.com/catamphetamine/read-excel-file/-/issues/25
|
|
291
|
+
// Its not clear how to tell it to ignore any namespaces
|
|
292
|
+
// when getting `.tagName`, so just replacing anything
|
|
293
|
+
// before a colon, if any.
|
|
294
|
+
return element.tagName.replace(NAMESPACE_REG_EXP, '');
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
function getCells(document) {
|
|
298
|
+
var worksheet = document.documentElement;
|
|
299
|
+
var sheetData = findChild(worksheet, 'sheetData');
|
|
300
|
+
var cells = [];
|
|
301
|
+
forEach(sheetData, 'row', function (row) {
|
|
302
|
+
forEach(row, 'c', function (cell) {
|
|
303
|
+
cells.push(cell);
|
|
304
|
+
});
|
|
305
|
+
});
|
|
306
|
+
return cells;
|
|
307
|
+
}
|
|
308
|
+
function getCellValue$1(document, node) {
|
|
309
|
+
return findChild(node, 'v');
|
|
310
|
+
}
|
|
311
|
+
function getCellInlineStringValue(document, node) {
|
|
312
|
+
if (node.firstChild && getTagName(node.firstChild) === 'is' && node.firstChild.firstChild && getTagName(node.firstChild.firstChild) === 't') {
|
|
313
|
+
return node.firstChild.firstChild.textContent;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
function getDimensions(document) {
|
|
317
|
+
var worksheet = document.documentElement;
|
|
318
|
+
var dimensions = findChild(worksheet, 'dimension');
|
|
319
|
+
|
|
320
|
+
if (dimensions) {
|
|
321
|
+
return dimensions.getAttribute('ref');
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
function getBaseStyles(document) {
|
|
325
|
+
var styleSheet = document.documentElement;
|
|
326
|
+
var cellStyleXfs = findChild(styleSheet, 'cellStyleXfs');
|
|
327
|
+
|
|
328
|
+
if (cellStyleXfs) {
|
|
329
|
+
return findChildren(cellStyleXfs, 'xf');
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
return [];
|
|
333
|
+
}
|
|
334
|
+
function getCellStyles(document) {
|
|
335
|
+
var styleSheet = document.documentElement;
|
|
336
|
+
var cellXfs = findChild(styleSheet, 'cellXfs');
|
|
337
|
+
|
|
338
|
+
if (!cellXfs) {
|
|
339
|
+
return [];
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
return findChildren(cellXfs, 'xf');
|
|
343
|
+
}
|
|
344
|
+
function getNumberFormats(document) {
|
|
345
|
+
var styleSheet = document.documentElement;
|
|
346
|
+
var numFmts = findChild(styleSheet, 'numFmts');
|
|
347
|
+
|
|
348
|
+
if (numFmts) {
|
|
349
|
+
return findChildren(numFmts, 'numFmt');
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
return [];
|
|
353
|
+
}
|
|
354
|
+
function getSharedStrings(document) {
|
|
355
|
+
// An `<si/>` element can contain a `<t/>` (simplest case) or a set of `<r/>` ("rich formatting") elements having `<t/>`.
|
|
356
|
+
// https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.sharedstringitem?redirectedfrom=MSDN&view=openxml-2.8.1
|
|
357
|
+
// http://www.datypic.com/sc/ooxml/e-ssml_si-1.html
|
|
358
|
+
var sst = document.documentElement;
|
|
359
|
+
return map(sst, 'si', function (string) {
|
|
360
|
+
var t = findChild(string, 't');
|
|
361
|
+
|
|
362
|
+
if (t) {
|
|
363
|
+
return t.textContent;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
var value = '';
|
|
367
|
+
forEach(string, 'r', function (r) {
|
|
368
|
+
value += findChild(r, 't').textContent;
|
|
369
|
+
});
|
|
370
|
+
return value;
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
function getWorkbookProperties(document) {
|
|
374
|
+
var workbook = document.documentElement;
|
|
375
|
+
return findChild(workbook, 'workbookPr');
|
|
376
|
+
}
|
|
377
|
+
function getRelationships(document) {
|
|
378
|
+
var relationships = document.documentElement;
|
|
379
|
+
return findChildren(relationships, 'Relationship');
|
|
380
|
+
}
|
|
381
|
+
function getSheets(document) {
|
|
382
|
+
var workbook = document.documentElement;
|
|
383
|
+
var sheets = findChild(workbook, 'sheets');
|
|
384
|
+
return findChildren(sheets, 'sheet');
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
function parseProperties(content, xml) {
|
|
388
|
+
var book = xml.createDocument(content);
|
|
389
|
+
var properties = {}; // Read `<workbookPr/>` element to detect whether dates are 1900-based or 1904-based.
|
|
390
|
+
// https://support.microsoft.com/en-gb/help/214330/differences-between-the-1900-and-the-1904-date-system-in-excel
|
|
391
|
+
// http://webapp.docx4java.org/OnlineDemo/ecma376/SpreadsheetML/workbookPr.html
|
|
392
|
+
|
|
393
|
+
var workbookProperties = getWorkbookProperties(book);
|
|
394
|
+
|
|
395
|
+
if (workbookProperties && workbookProperties.getAttribute('date1904') === '1') {
|
|
396
|
+
properties.epoch1904 = true;
|
|
397
|
+
} // Get sheets info (indexes, names, if they're available).
|
|
398
|
+
// Example:
|
|
399
|
+
// <sheets>
|
|
400
|
+
// <sheet
|
|
401
|
+
// xmlns:ns="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
|
|
402
|
+
// name="Sheet1"
|
|
403
|
+
// sheetId="1"
|
|
404
|
+
// ns:id="rId3"/>
|
|
405
|
+
// </sheets>
|
|
406
|
+
// http://www.datypic.com/sc/ooxml/e-ssml_sheet-1.html
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
properties.sheets = [];
|
|
410
|
+
|
|
411
|
+
var addSheetInfo = function addSheetInfo(sheet) {
|
|
412
|
+
if (sheet.getAttribute('name')) {
|
|
413
|
+
properties.sheets.push({
|
|
414
|
+
id: sheet.getAttribute('sheetId'),
|
|
415
|
+
name: sheet.getAttribute('name'),
|
|
416
|
+
relationId: sheet.getAttribute('r:id')
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
};
|
|
420
|
+
|
|
421
|
+
getSheets(book).forEach(addSheetInfo);
|
|
422
|
+
return properties;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* Returns sheet file paths.
|
|
427
|
+
* Seems that the correct place to look for the `sheetId` -> `filename` mapping
|
|
428
|
+
* is `xl/_rels/workbook.xml.rels` file.
|
|
429
|
+
* https://github.com/tidyverse/readxl/issues/104
|
|
430
|
+
* @param {string} content — `xl/_rels/workbook.xml.rels` file contents.
|
|
431
|
+
* @param {object} xml
|
|
432
|
+
* @return {object}
|
|
433
|
+
*/
|
|
434
|
+
|
|
435
|
+
function parseFilePaths(content, xml) {
|
|
436
|
+
// Example:
|
|
437
|
+
// <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
438
|
+
// ...
|
|
439
|
+
// <Relationship
|
|
440
|
+
// Id="rId3"
|
|
441
|
+
// Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet"
|
|
442
|
+
// Target="worksheets/sheet1.xml"/>
|
|
443
|
+
// </Relationships>
|
|
444
|
+
var document = xml.createDocument(content);
|
|
445
|
+
var filePaths = {
|
|
446
|
+
sheets: {},
|
|
447
|
+
sharedStrings: undefined,
|
|
448
|
+
styles: undefined
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
var addFilePathInfo = function addFilePathInfo(relationship) {
|
|
452
|
+
var filePath = relationship.getAttribute('Target');
|
|
453
|
+
var fileType = relationship.getAttribute('Type');
|
|
454
|
+
|
|
455
|
+
switch (fileType) {
|
|
456
|
+
case 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles':
|
|
457
|
+
filePaths.styles = getFilePath(filePath);
|
|
458
|
+
break;
|
|
459
|
+
|
|
460
|
+
case 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings':
|
|
461
|
+
filePaths.sharedStrings = getFilePath(filePath);
|
|
462
|
+
break;
|
|
463
|
+
|
|
464
|
+
case 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet':
|
|
465
|
+
filePaths.sheets[relationship.getAttribute('Id')] = getFilePath(filePath);
|
|
466
|
+
break;
|
|
467
|
+
}
|
|
468
|
+
};
|
|
469
|
+
|
|
470
|
+
getRelationships(document).forEach(addFilePathInfo); // Seems like "sharedStrings.xml" is not required to exist.
|
|
471
|
+
// For example, when the spreadsheet doesn't contain any strings.
|
|
472
|
+
// https://github.com/catamphetamine/read-excel-file/issues/85
|
|
473
|
+
// if (!filePaths.sharedStrings) {
|
|
474
|
+
// throw new Error('"sharedStrings.xml" file not found in the *.xlsx file')
|
|
475
|
+
// }
|
|
476
|
+
|
|
477
|
+
return filePaths;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
function getFilePath(path) {
|
|
481
|
+
// Normally, `path` is a relative path inside the ZIP archive,
|
|
482
|
+
// like "worksheets/sheet1.xml", or "sharedStrings.xml", or "styles.xml".
|
|
483
|
+
// There has been one weird case when file path was an absolute path,
|
|
484
|
+
// like "/xl/worksheets/sheet1.xml" (specifically for sheets):
|
|
485
|
+
// https://github.com/catamphetamine/read-excel-file/pull/95
|
|
486
|
+
// Other libraries (like `xlsx`) and software (like Google Docs)
|
|
487
|
+
// seem to support such absolute file paths, so this library does too.
|
|
488
|
+
if (path[0] === '/') {
|
|
489
|
+
return path.slice('/'.length);
|
|
490
|
+
} // // Seems like a path could also be a URL.
|
|
491
|
+
// // http://officeopenxml.com/anatomyofOOXML-xlsx.php
|
|
492
|
+
// if (/^[a-z]+\:\/\//.test(path)) {
|
|
493
|
+
// return path
|
|
494
|
+
// }
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
return 'xl/' + path;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
501
|
+
|
|
502
|
+
function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$3(Object(source), true).forEach(function (key) { _defineProperty$3(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
503
|
+
|
|
504
|
+
function _defineProperty$3(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
505
|
+
// Returns an array of cell styles.
|
|
506
|
+
// A cell style index is its ID.
|
|
507
|
+
|
|
508
|
+
function parseStyles(content, xml) {
|
|
509
|
+
if (!content) {
|
|
510
|
+
return {};
|
|
511
|
+
} // https://social.msdn.microsoft.com/Forums/sqlserver/en-US/708978af-b598-45c4-a598-d3518a5a09f0/howwhen-is-cellstylexfs-vs-cellxfs-applied-to-a-cell?forum=os_binaryfile
|
|
512
|
+
// https://www.office-forums.com/threads/cellxfs-cellstylexfs.2163519/
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
var doc = xml.createDocument(content);
|
|
516
|
+
var baseStyles = getBaseStyles(doc).map(parseCellStyle);
|
|
517
|
+
var numberFormats = getNumberFormats(doc).map(parseNumberFormatStyle).reduce(function (formats, format) {
|
|
518
|
+
// Format ID is a numeric index.
|
|
519
|
+
// There're some standard "built-in" formats (in Excel) up to about `100`.
|
|
520
|
+
formats[format.id] = format;
|
|
521
|
+
return formats;
|
|
522
|
+
}, []);
|
|
523
|
+
|
|
524
|
+
var getCellStyle = function getCellStyle(xf) {
|
|
525
|
+
if (xf.hasAttribute('xfId')) {
|
|
526
|
+
return _objectSpread$3(_objectSpread$3({}, baseStyles[xf.xfId]), parseCellStyle(xf, numberFormats));
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
return parseCellStyle(xf, numberFormats);
|
|
530
|
+
};
|
|
531
|
+
|
|
532
|
+
return getCellStyles(doc).map(getCellStyle);
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
function parseNumberFormatStyle(numFmt) {
|
|
536
|
+
return {
|
|
537
|
+
id: numFmt.getAttribute('numFmtId'),
|
|
538
|
+
template: numFmt.getAttribute('formatCode')
|
|
539
|
+
};
|
|
540
|
+
} // http://www.datypic.com/sc/ooxml/e-ssml_xf-2.html
|
|
541
|
+
|
|
542
|
+
|
|
543
|
+
function parseCellStyle(xf, numFmts) {
|
|
544
|
+
var style = {};
|
|
545
|
+
|
|
546
|
+
if (xf.hasAttribute('numFmtId')) {
|
|
547
|
+
var numberFormatId = xf.getAttribute('numFmtId'); // Built-in number formats don't have a `<numFmt/>` element in `styles.xml`.
|
|
548
|
+
// https://hexdocs.pm/xlsxir/number_styles.html
|
|
549
|
+
|
|
550
|
+
if (numFmts[numberFormatId]) {
|
|
551
|
+
style.numberFormat = numFmts[numberFormatId];
|
|
552
|
+
} else {
|
|
553
|
+
style.numberFormat = {
|
|
554
|
+
id: numberFormatId
|
|
555
|
+
};
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
return style;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
function parseSharedStrings(content, xml) {
|
|
563
|
+
if (!content) {
|
|
564
|
+
return [];
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
return getSharedStrings(xml.createDocument(content));
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
// Parses an Excel Date ("serial") into a
|
|
571
|
+
// corresponding javascript Date in UTC+0 timezone.
|
|
572
|
+
// (with time equal to 00:00)
|
|
573
|
+
//
|
|
574
|
+
// Doesn't account for leap seconds.
|
|
575
|
+
// Therefore is not 100% correct.
|
|
576
|
+
// But will do, I guess, since we're
|
|
577
|
+
// not doing rocket science here.
|
|
578
|
+
//
|
|
579
|
+
// https://www.pcworld.com/article/3063622/software/mastering-excel-date-time-serial-numbers-networkdays-datevalue-and-more.html
|
|
580
|
+
// "If you need to calculate dates in your spreadsheets,
|
|
581
|
+
// Excel uses its own unique system, which it calls Serial Numbers".
|
|
582
|
+
//
|
|
583
|
+
function parseExcelDate(excelSerialDate, options) {
|
|
584
|
+
// https://support.microsoft.com/en-gb/help/214330/differences-between-the-1900-and-the-1904-date-system-in-excel
|
|
585
|
+
if (options && options.epoch1904) {
|
|
586
|
+
excelSerialDate += 1462;
|
|
587
|
+
} // "Excel serial date" is just
|
|
588
|
+
// the count of days since `01/01/1900`
|
|
589
|
+
// (seems that it may be even fractional).
|
|
590
|
+
//
|
|
591
|
+
// The count of days elapsed
|
|
592
|
+
// since `01/01/1900` (Excel epoch)
|
|
593
|
+
// till `01/01/1970` (Unix epoch).
|
|
594
|
+
// Accounts for leap years
|
|
595
|
+
// (19 of them, yielding 19 extra days).
|
|
596
|
+
|
|
597
|
+
|
|
598
|
+
var daysBeforeUnixEpoch = 70 * 365 + 19; // An hour, approximately, because a minute
|
|
599
|
+
// may be longer than 60 seconds, see "leap seconds".
|
|
600
|
+
|
|
601
|
+
var hour = 60 * 60 * 1000;
|
|
602
|
+
return new Date(Math.round((excelSerialDate - daysBeforeUnixEpoch) * 24 * hour));
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
function _createForOfIteratorHelperLoose$5(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray$6(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
606
|
+
|
|
607
|
+
function _unsupportedIterableToArray$6(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$6(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$6(o, minLen); }
|
|
608
|
+
|
|
609
|
+
function _arrayLikeToArray$6(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
610
|
+
|
|
611
|
+
var BUILT_IN_DATE_NUMBER_FORMAT_IDS = [14, 15, 16, 17, 18, 19, 20, 21, 22, 27, 30, 36, 45, 46, 47, 50, 57];
|
|
612
|
+
function getCellValue(value, type, _ref) {
|
|
613
|
+
var getInlineStringValue = _ref.getInlineStringValue,
|
|
614
|
+
getStyleId = _ref.getStyleId,
|
|
615
|
+
styles = _ref.styles,
|
|
616
|
+
values = _ref.values,
|
|
617
|
+
properties = _ref.properties,
|
|
618
|
+
options = _ref.options;
|
|
619
|
+
|
|
620
|
+
if (!type) {
|
|
621
|
+
// Default cell type is "n" (numeric).
|
|
622
|
+
// http://www.datypic.com/sc/ooxml/t-ssml_CT_Cell.html
|
|
623
|
+
type = 'n';
|
|
624
|
+
} // Available Excel cell types:
|
|
625
|
+
// https://github.com/SheetJS/sheetjs/blob/19620da30be2a7d7b9801938a0b9b1fd3c4c4b00/docbits/52_datatype.md
|
|
626
|
+
//
|
|
627
|
+
// Some other document (seems to be old):
|
|
628
|
+
// http://webapp.docx4java.org/OnlineDemo/ecma376/SpreadsheetML/ST_CellType.html
|
|
629
|
+
//
|
|
630
|
+
|
|
631
|
+
|
|
632
|
+
switch (type) {
|
|
633
|
+
// If the cell contains formula string.
|
|
634
|
+
case 'str':
|
|
635
|
+
value = value.trim();
|
|
636
|
+
|
|
637
|
+
if (value === '') {
|
|
638
|
+
value = undefined;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
break;
|
|
642
|
+
// If the cell contains an "inline" (not "shared") string.
|
|
643
|
+
|
|
644
|
+
case 'inlineStr':
|
|
645
|
+
value = getInlineStringValue();
|
|
646
|
+
|
|
647
|
+
if (value === undefined) {
|
|
648
|
+
throw new Error("Unsupported \"inline string\" cell value structure"); // : ${cellNode.textContent}`)
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
value = value.trim();
|
|
652
|
+
|
|
653
|
+
if (value === '') {
|
|
654
|
+
value = undefined;
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
break;
|
|
658
|
+
// If the cell contains a "shared" string.
|
|
659
|
+
// "Shared" strings is a way for an Excel editor to reduce
|
|
660
|
+
// the file size by storing "commonly used" strings in a dictionary
|
|
661
|
+
// and then referring to such strings by their index in that dictionary.
|
|
662
|
+
|
|
663
|
+
case 's':
|
|
664
|
+
// If a cell has no value then there's no `<c/>` element for it.
|
|
665
|
+
// If a `<c/>` element exists then it's not empty.
|
|
666
|
+
// The `<v/>`alue is a key in the "shared strings" dictionary of the
|
|
667
|
+
// XLSX file, so look it up in the `values` dictionary by the numeric key.
|
|
668
|
+
value = values[parseInt(value)];
|
|
669
|
+
value = value.trim();
|
|
670
|
+
|
|
671
|
+
if (value === '') {
|
|
672
|
+
value = undefined;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
break;
|
|
676
|
+
|
|
677
|
+
case 'b':
|
|
678
|
+
value = value === '1' ? true : false;
|
|
679
|
+
break;
|
|
680
|
+
// Stub: blank stub cell that is ignored by data processing utilities.
|
|
681
|
+
|
|
682
|
+
case 'z':
|
|
683
|
+
value = undefined;
|
|
684
|
+
break;
|
|
685
|
+
// Error: `value` is a numeric code.
|
|
686
|
+
// They also wrote: "and `w` property stores its common name".
|
|
687
|
+
// It's unclear what they meant by that.
|
|
688
|
+
|
|
689
|
+
case 'e':
|
|
690
|
+
value = decodeError(value);
|
|
691
|
+
break;
|
|
692
|
+
// Date: a string to be parsed as a date.
|
|
693
|
+
// (usually a string in "ISO 8601" format)
|
|
694
|
+
|
|
695
|
+
case 'd':
|
|
696
|
+
if (value === undefined) {
|
|
697
|
+
break;
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
value = new Date(value);
|
|
701
|
+
break;
|
|
702
|
+
|
|
703
|
+
case 'n':
|
|
704
|
+
if (value === undefined) {
|
|
705
|
+
break;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
value = parseFloat(value); // XLSX does have "d" type for dates, but it's not commonly used.
|
|
709
|
+
// specific format for dates.
|
|
710
|
+
// Sometimes a date can be heuristically detected.
|
|
711
|
+
// https://github.com/catamphetamine/read-excel-file/issues/3#issuecomment-395770777
|
|
712
|
+
//
|
|
713
|
+
// Format IDs:
|
|
714
|
+
// https://xlsxwriter.readthedocs.io/format.html#format-set-num-format
|
|
715
|
+
//
|
|
716
|
+
|
|
717
|
+
var styleId = getStyleId();
|
|
718
|
+
|
|
719
|
+
if (styleId) {
|
|
720
|
+
// styleId = parseInt(styleId)
|
|
721
|
+
var style = styles[styleId];
|
|
722
|
+
|
|
723
|
+
if (!style) {
|
|
724
|
+
throw new Error("Cell style not found: ".concat(styleId));
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
if (BUILT_IN_DATE_NUMBER_FORMAT_IDS.indexOf(parseInt(style.numberFormat.id)) >= 0 || options.dateFormat && style.numberFormat.template === options.dateFormat || options.smartDateParser !== false && style.numberFormat.template && isDateTemplate(style.numberFormat.template)) {
|
|
728
|
+
value = parseExcelDate(value, properties);
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
break;
|
|
733
|
+
|
|
734
|
+
default:
|
|
735
|
+
throw new TypeError("Cell type not supported: ".concat(type));
|
|
736
|
+
} // Convert empty values to `null`.
|
|
737
|
+
|
|
738
|
+
|
|
739
|
+
if (value === undefined) {
|
|
740
|
+
value = null;
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
return value;
|
|
744
|
+
} // Decodes numeric error code to a string code.
|
|
745
|
+
// https://github.com/SheetJS/sheetjs/blob/19620da30be2a7d7b9801938a0b9b1fd3c4c4b00/docbits/52_datatype.md
|
|
746
|
+
|
|
747
|
+
function decodeError(errorCode) {
|
|
748
|
+
// While the error values are determined by the application,
|
|
749
|
+
// the following are some example error values that could be used:
|
|
750
|
+
switch (errorCode) {
|
|
751
|
+
case 0x00:
|
|
752
|
+
return '#NULL!';
|
|
753
|
+
|
|
754
|
+
case 0x07:
|
|
755
|
+
return '#DIV/0!';
|
|
756
|
+
|
|
757
|
+
case 0x0F:
|
|
758
|
+
return '#VALUE!';
|
|
759
|
+
|
|
760
|
+
case 0x17:
|
|
761
|
+
return '#REF!';
|
|
762
|
+
|
|
763
|
+
case 0x1D:
|
|
764
|
+
return '#NAME?';
|
|
765
|
+
|
|
766
|
+
case 0x24:
|
|
767
|
+
return '#NUM!';
|
|
768
|
+
|
|
769
|
+
case 0x2A:
|
|
770
|
+
return '#N/A';
|
|
771
|
+
|
|
772
|
+
case 0x2B:
|
|
773
|
+
return '#GETTING_DATA';
|
|
774
|
+
|
|
775
|
+
default:
|
|
776
|
+
// Such error code doesn't exist. I made it up.
|
|
777
|
+
return "#ERROR_".concat(errorCode);
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
function isDateTemplate(template) {
|
|
782
|
+
var tokens = template.split(/\W+/);
|
|
783
|
+
|
|
784
|
+
for (var _iterator = _createForOfIteratorHelperLoose$5(tokens), _step; !(_step = _iterator()).done;) {
|
|
785
|
+
var token = _step.value;
|
|
786
|
+
|
|
787
|
+
if (['MM', 'DD', 'YY', 'YYYY'].indexOf(token) < 0) {
|
|
788
|
+
return false;
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
return true;
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
// Maps "A1"-like coordinates to `{ row, column }` numeric coordinates.
|
|
796
|
+
var LETTERS = ["", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"];
|
|
797
|
+
function calculateDimensions(cells) {
|
|
798
|
+
var comparator = function comparator(a, b) {
|
|
799
|
+
return a - b;
|
|
800
|
+
};
|
|
801
|
+
|
|
802
|
+
var allRows = cells.map(function (cell) {
|
|
803
|
+
return cell.row;
|
|
804
|
+
}).sort(comparator);
|
|
805
|
+
var allCols = cells.map(function (cell) {
|
|
806
|
+
return cell.column;
|
|
807
|
+
}).sort(comparator);
|
|
808
|
+
var minRow = allRows[0];
|
|
809
|
+
var maxRow = allRows[allRows.length - 1];
|
|
810
|
+
var minCol = allCols[0];
|
|
811
|
+
var maxCol = allCols[allCols.length - 1];
|
|
812
|
+
return [{
|
|
813
|
+
row: minRow,
|
|
814
|
+
column: minCol
|
|
815
|
+
}, {
|
|
816
|
+
row: maxRow,
|
|
817
|
+
column: maxCol
|
|
818
|
+
}];
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
function columnLettersToNumber(columnLetters) {
|
|
822
|
+
// `for ... of ...` would require Babel polyfill for iterating a string.
|
|
823
|
+
var n = 0;
|
|
824
|
+
var i = 0;
|
|
825
|
+
|
|
826
|
+
while (i < columnLetters.length) {
|
|
827
|
+
n *= 26;
|
|
828
|
+
n += LETTERS.indexOf(columnLetters[i]);
|
|
829
|
+
i++;
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
return n;
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
function parseCellCoordinates(coords) {
|
|
836
|
+
// Examples: "AA2091", "R988", "B1"
|
|
837
|
+
coords = coords.split(/(\d+)/);
|
|
838
|
+
return [// Row.
|
|
839
|
+
parseInt(coords[1]), // Column.
|
|
840
|
+
columnLettersToNumber(coords[0].trim())];
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
//
|
|
844
|
+
// <c>
|
|
845
|
+
// <f>string</f> — formula.
|
|
846
|
+
// <v>string</v> — formula pre-computed value.
|
|
847
|
+
// <is>
|
|
848
|
+
// <t>string</t> — an `inlineStr` string (rather than a "common string" from a dictionary).
|
|
849
|
+
// <r>
|
|
850
|
+
// <rPr>
|
|
851
|
+
// ...
|
|
852
|
+
// </rPr>
|
|
853
|
+
// <t>string</t>
|
|
854
|
+
// </r>
|
|
855
|
+
// <rPh sb="1" eb="1">
|
|
856
|
+
// <t>string</t>
|
|
857
|
+
// </rPh>
|
|
858
|
+
// <phoneticPr fontId="1"/>
|
|
859
|
+
// </is>
|
|
860
|
+
// <extLst>
|
|
861
|
+
// <ext>
|
|
862
|
+
// <!--any element-->
|
|
863
|
+
// </ext>
|
|
864
|
+
// </extLst>
|
|
865
|
+
// </c>
|
|
866
|
+
//
|
|
867
|
+
|
|
868
|
+
function parseCell(node, sheet, xml, values, styles, properties, options) {
|
|
869
|
+
var coords = parseCellCoordinates(node.getAttribute('r'));
|
|
870
|
+
var valueElement = getCellValue$1(sheet, node); // For `xpath`, `value` can be `undefined` while for native `DOMParser` it's `null`.
|
|
871
|
+
// So using `value && ...` instead of `if (value !== undefined) { ... }` here
|
|
872
|
+
// for uniform compatibility with both `xpath` and native `DOMParser`.
|
|
873
|
+
|
|
874
|
+
var value = valueElement && valueElement.textContent;
|
|
875
|
+
var type;
|
|
876
|
+
|
|
877
|
+
if (node.hasAttribute('t')) {
|
|
878
|
+
type = node.getAttribute('t');
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
return {
|
|
882
|
+
row: coords[0],
|
|
883
|
+
column: coords[1],
|
|
884
|
+
value: getCellValue(value, type, {
|
|
885
|
+
getInlineStringValue: function getInlineStringValue() {
|
|
886
|
+
return getCellInlineStringValue(sheet, node);
|
|
887
|
+
},
|
|
888
|
+
getStyleId: function getStyleId() {
|
|
889
|
+
return node.getAttribute('s');
|
|
890
|
+
},
|
|
891
|
+
styles: styles,
|
|
892
|
+
values: values,
|
|
893
|
+
properties: properties,
|
|
894
|
+
options: options
|
|
895
|
+
})
|
|
896
|
+
};
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
function parseCells(sheet, xml, values, styles, properties, options) {
|
|
900
|
+
var cells = getCells(sheet);
|
|
901
|
+
|
|
902
|
+
if (cells.length === 0) {
|
|
903
|
+
return [];
|
|
904
|
+
} // const mergedCells = getMergedCells(sheet)
|
|
905
|
+
// for (const mergedCell of mergedCells) {
|
|
906
|
+
// const [from, to] = mergedCell.split(':').map(parseCellCoordinates)
|
|
907
|
+
// console.log('Merged Cell.', 'From:', from, 'To:', to)
|
|
908
|
+
// }
|
|
909
|
+
|
|
910
|
+
|
|
911
|
+
return cells.map(function (node) {
|
|
912
|
+
return parseCell(node, sheet, xml, values, styles, properties, options);
|
|
913
|
+
});
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
function _slicedToArray$2(arr, i) { return _arrayWithHoles$2(arr) || _iterableToArrayLimit$2(arr, i) || _unsupportedIterableToArray$5(arr, i) || _nonIterableRest$2(); }
|
|
917
|
+
|
|
918
|
+
function _nonIterableRest$2() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
919
|
+
|
|
920
|
+
function _unsupportedIterableToArray$5(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$5(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$5(o, minLen); }
|
|
921
|
+
|
|
922
|
+
function _arrayLikeToArray$5(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
923
|
+
|
|
924
|
+
function _iterableToArrayLimit$2(arr, i) { var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]); if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
925
|
+
|
|
926
|
+
function _arrayWithHoles$2(arr) { if (Array.isArray(arr)) return arr; }
|
|
927
|
+
function parseDimensions(sheet) {
|
|
928
|
+
var dimensions = getDimensions(sheet);
|
|
929
|
+
|
|
930
|
+
if (dimensions) {
|
|
931
|
+
dimensions = dimensions.split(':').map(parseCellCoordinates).map(function (_ref) {
|
|
932
|
+
var _ref2 = _slicedToArray$2(_ref, 2),
|
|
933
|
+
row = _ref2[0],
|
|
934
|
+
column = _ref2[1];
|
|
935
|
+
|
|
936
|
+
return {
|
|
937
|
+
row: row,
|
|
938
|
+
column: column
|
|
939
|
+
};
|
|
940
|
+
}); // When there's only a single cell on a sheet
|
|
941
|
+
// there can sometimes be just "A1" for the dimensions string.
|
|
942
|
+
|
|
943
|
+
if (dimensions.length === 1) {
|
|
944
|
+
dimensions = [dimensions[0], dimensions[0]];
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
return dimensions;
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
function parseSheet(content, xml, values, styles, properties, options) {
|
|
952
|
+
var sheet = xml.createDocument(content);
|
|
953
|
+
var cells = parseCells(sheet, xml, values, styles, properties, options);
|
|
954
|
+
var dimensions = parseDimensions(sheet) || calculateDimensions(cells);
|
|
955
|
+
return {
|
|
956
|
+
cells: cells,
|
|
957
|
+
dimensions: dimensions
|
|
958
|
+
};
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
function _createForOfIteratorHelperLoose$4(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray$4(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
962
|
+
|
|
963
|
+
function _unsupportedIterableToArray$4(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$4(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$4(o, minLen); }
|
|
964
|
+
|
|
965
|
+
function _arrayLikeToArray$4(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
966
|
+
|
|
967
|
+
function dropEmptyRows(data) {
|
|
968
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
969
|
+
rowMap = _ref.rowMap,
|
|
970
|
+
_ref$accessor = _ref.accessor,
|
|
971
|
+
accessor = _ref$accessor === void 0 ? function (_) {
|
|
972
|
+
return _;
|
|
973
|
+
} : _ref$accessor,
|
|
974
|
+
onlyTrimAtTheEnd = _ref.onlyTrimAtTheEnd;
|
|
975
|
+
|
|
976
|
+
// Drop empty rows.
|
|
977
|
+
var i = data.length - 1;
|
|
978
|
+
|
|
979
|
+
while (i >= 0) {
|
|
980
|
+
// Check if the row is empty.
|
|
981
|
+
var empty = true;
|
|
982
|
+
|
|
983
|
+
for (var _iterator = _createForOfIteratorHelperLoose$4(data[i]), _step; !(_step = _iterator()).done;) {
|
|
984
|
+
var cell = _step.value;
|
|
985
|
+
|
|
986
|
+
if (accessor(cell) !== null) {
|
|
987
|
+
empty = false;
|
|
988
|
+
break;
|
|
989
|
+
}
|
|
990
|
+
} // Remove the empty row.
|
|
991
|
+
|
|
992
|
+
|
|
993
|
+
if (empty) {
|
|
994
|
+
data.splice(i, 1);
|
|
995
|
+
|
|
996
|
+
if (rowMap) {
|
|
997
|
+
rowMap.splice(i, 1);
|
|
998
|
+
}
|
|
999
|
+
} else if (onlyTrimAtTheEnd) {
|
|
1000
|
+
break;
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
i--;
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
return data;
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
function _createForOfIteratorHelperLoose$3(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray$3(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
1010
|
+
|
|
1011
|
+
function _unsupportedIterableToArray$3(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$3(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$3(o, minLen); }
|
|
1012
|
+
|
|
1013
|
+
function _arrayLikeToArray$3(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
1014
|
+
|
|
1015
|
+
function dropEmptyColumns(data) {
|
|
1016
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
1017
|
+
_ref$accessor = _ref.accessor,
|
|
1018
|
+
accessor = _ref$accessor === void 0 ? function (_) {
|
|
1019
|
+
return _;
|
|
1020
|
+
} : _ref$accessor,
|
|
1021
|
+
onlyTrimAtTheEnd = _ref.onlyTrimAtTheEnd;
|
|
1022
|
+
|
|
1023
|
+
var i = data[0].length - 1;
|
|
1024
|
+
|
|
1025
|
+
while (i >= 0) {
|
|
1026
|
+
var empty = true;
|
|
1027
|
+
|
|
1028
|
+
for (var _iterator = _createForOfIteratorHelperLoose$3(data), _step; !(_step = _iterator()).done;) {
|
|
1029
|
+
var row = _step.value;
|
|
1030
|
+
|
|
1031
|
+
if (accessor(row[i]) !== null) {
|
|
1032
|
+
empty = false;
|
|
1033
|
+
break;
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
if (empty) {
|
|
1038
|
+
var j = 0;
|
|
1039
|
+
|
|
1040
|
+
while (j < data.length) {
|
|
1041
|
+
data[j].splice(i, 1);
|
|
1042
|
+
j++;
|
|
1043
|
+
}
|
|
1044
|
+
} else if (onlyTrimAtTheEnd) {
|
|
1045
|
+
break;
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
i--;
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
return data;
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
function _createForOfIteratorHelperLoose$2(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray$2(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
1055
|
+
|
|
1056
|
+
function _slicedToArray$1(arr, i) { return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _unsupportedIterableToArray$2(arr, i) || _nonIterableRest$1(); }
|
|
1057
|
+
|
|
1058
|
+
function _nonIterableRest$1() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
1059
|
+
|
|
1060
|
+
function _unsupportedIterableToArray$2(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$2(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen); }
|
|
1061
|
+
|
|
1062
|
+
function _arrayLikeToArray$2(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
1063
|
+
|
|
1064
|
+
function _iterableToArrayLimit$1(arr, i) { var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]); if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
1065
|
+
|
|
1066
|
+
function _arrayWithHoles$1(arr) { if (Array.isArray(arr)) return arr; }
|
|
1067
|
+
function getData(sheet, options) {
|
|
1068
|
+
var dimensions = sheet.dimensions,
|
|
1069
|
+
cells = sheet.cells; // If the sheet is empty.
|
|
1070
|
+
|
|
1071
|
+
if (cells.length === 0) {
|
|
1072
|
+
return [];
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
var _dimensions = _slicedToArray$1(dimensions, 2),
|
|
1076
|
+
leftTop = _dimensions[0],
|
|
1077
|
+
rightBottom = _dimensions[1];
|
|
1078
|
+
|
|
1079
|
+
var colsCount = rightBottom.column - leftTop.column + 1;
|
|
1080
|
+
var rowsCount = rightBottom.row - leftTop.row + 1; // Initialize spreadsheet data structure.
|
|
1081
|
+
|
|
1082
|
+
var data = new Array(rowsCount);
|
|
1083
|
+
var i = 0;
|
|
1084
|
+
|
|
1085
|
+
while (i < rowsCount) {
|
|
1086
|
+
data[i] = new Array(colsCount);
|
|
1087
|
+
var j = 0;
|
|
1088
|
+
|
|
1089
|
+
while (j < colsCount) {
|
|
1090
|
+
data[i][j] = null;
|
|
1091
|
+
j++;
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
i++;
|
|
1095
|
+
} // Fill in spreadsheet data structure.
|
|
1096
|
+
// (this code implies that `cells` aren't necessarily sorted by row and column:
|
|
1097
|
+
// maybe that's not correct, this piece code was initially copy-pasted
|
|
1098
|
+
// from some other library that used `XPath`)
|
|
1099
|
+
|
|
1100
|
+
|
|
1101
|
+
for (var _iterator = _createForOfIteratorHelperLoose$2(cells), _step; !(_step = _iterator()).done;) {
|
|
1102
|
+
var cell = _step.value;
|
|
1103
|
+
var row = cell.row - leftTop.row;
|
|
1104
|
+
var column = cell.column - leftTop.column;
|
|
1105
|
+
data[row][column] = cell.value;
|
|
1106
|
+
} // Fill in the row map.
|
|
1107
|
+
|
|
1108
|
+
|
|
1109
|
+
var rowMap = options.rowMap;
|
|
1110
|
+
|
|
1111
|
+
if (rowMap) {
|
|
1112
|
+
var _i2 = 0;
|
|
1113
|
+
|
|
1114
|
+
while (_i2 < data.length) {
|
|
1115
|
+
rowMap[_i2] = _i2;
|
|
1116
|
+
_i2++;
|
|
1117
|
+
}
|
|
1118
|
+
} // Drop empty columns or rows.
|
|
1119
|
+
|
|
1120
|
+
|
|
1121
|
+
data = dropEmptyRows(dropEmptyColumns(data, {
|
|
1122
|
+
onlyTrimAtTheEnd: true
|
|
1123
|
+
}), {
|
|
1124
|
+
onlyTrimAtTheEnd: true,
|
|
1125
|
+
rowMap: rowMap
|
|
1126
|
+
}); // Optionally transform data before applying `schema`.
|
|
1127
|
+
|
|
1128
|
+
if (options.transformData) {
|
|
1129
|
+
data = options.transformData(data); // data = options.transformData(data, {
|
|
1130
|
+
// dropEmptyRowsAndColumns(data) {
|
|
1131
|
+
// return dropEmptyRows(dropEmptyColumns(data), { rowMap })
|
|
1132
|
+
// }
|
|
1133
|
+
// })
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
return data;
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
function _createForOfIteratorHelperLoose$1(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
1140
|
+
|
|
1141
|
+
function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
|
|
1142
|
+
|
|
1143
|
+
function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
1144
|
+
|
|
1145
|
+
function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
1146
|
+
|
|
1147
|
+
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$2(Object(source), true).forEach(function (key) { _defineProperty$2(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
1148
|
+
|
|
1149
|
+
function _defineProperty$2(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
1150
|
+
// https://www.brendanlong.com/the-minimum-viable-xlsx-reader.html
|
|
1151
|
+
|
|
1152
|
+
/**
|
|
1153
|
+
* Reads an (unzipped) XLSX file structure into a 2D array of cells.
|
|
1154
|
+
* @param {object} contents - A list of XML files inside XLSX file (which is a zipped directory).
|
|
1155
|
+
* @param {number?} options.sheet - Workbook sheet id (`1` by default).
|
|
1156
|
+
* @param {string?} options.dateFormat - Date format, e.g. "mm/dd/yyyy". Values having this format template set will be parsed as dates.
|
|
1157
|
+
* @param {object} contents - A list of XML files inside XLSX file (which is a zipped directory).
|
|
1158
|
+
* @return {object} An object of shape `{ data, cells, properties }`. `data: string[][]` is an array of rows, each row being an array of cell values. `cells: string[][]` is an array of rows, each row being an array of cells. `properties: object` is the spreadsheet properties (e.g. whether date epoch is 1904 instead of 1900).
|
|
1159
|
+
*/
|
|
1160
|
+
|
|
1161
|
+
function readXlsx(contents, xml) {
|
|
1162
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1163
|
+
|
|
1164
|
+
if (!options.sheet) {
|
|
1165
|
+
options = _objectSpread$2({
|
|
1166
|
+
sheet: 1
|
|
1167
|
+
}, options);
|
|
1168
|
+
} // Some Excel editors don't want to use standard naming scheme for sheet files.
|
|
1169
|
+
// https://github.com/tidyverse/readxl/issues/104
|
|
1170
|
+
|
|
1171
|
+
|
|
1172
|
+
var filePaths = parseFilePaths(contents['xl/_rels/workbook.xml.rels'], xml); // Default file path for "shared strings": "xl/sharedStrings.xml".
|
|
1173
|
+
|
|
1174
|
+
var values = filePaths.sharedStrings ? parseSharedStrings(contents[filePaths.sharedStrings], xml) : []; // Default file path for "styles": "xl/styles.xml".
|
|
1175
|
+
|
|
1176
|
+
var styles = filePaths.styles ? parseStyles(contents[filePaths.styles], xml) : {};
|
|
1177
|
+
var properties = parseProperties(contents['xl/workbook.xml'], xml); // A feature for getting the list of sheets in an Excel file.
|
|
1178
|
+
// https://github.com/catamphetamine/read-excel-file/issues/14
|
|
1179
|
+
|
|
1180
|
+
if (options.getSheets) {
|
|
1181
|
+
return properties.sheets.map(function (_ref) {
|
|
1182
|
+
var name = _ref.name;
|
|
1183
|
+
return {
|
|
1184
|
+
name: name
|
|
1185
|
+
};
|
|
1186
|
+
});
|
|
1187
|
+
} // Find the sheet by name, or take the first one.
|
|
1188
|
+
|
|
1189
|
+
|
|
1190
|
+
var sheetId = getSheetId(options.sheet, properties.sheets); // If the sheet wasn't found then throw an error.
|
|
1191
|
+
// Example: "xl/worksheets/sheet1.xml".
|
|
1192
|
+
|
|
1193
|
+
if (!sheetId || !filePaths.sheets[sheetId]) {
|
|
1194
|
+
throw createSheetNotFoundError(options.sheet, properties.sheets);
|
|
1195
|
+
} // Parse sheet data.
|
|
1196
|
+
|
|
1197
|
+
|
|
1198
|
+
var sheet = parseSheet(contents[filePaths.sheets[sheetId]], xml, values, styles, properties, options); // Get spreadsheet data.
|
|
1199
|
+
|
|
1200
|
+
var data = getData(sheet, options); // Can return properties, if required.
|
|
1201
|
+
|
|
1202
|
+
if (options.properties) {
|
|
1203
|
+
return {
|
|
1204
|
+
data: data,
|
|
1205
|
+
properties: properties
|
|
1206
|
+
};
|
|
1207
|
+
} // Return spreadsheet data.
|
|
1208
|
+
|
|
1209
|
+
|
|
1210
|
+
return data;
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
function getSheetId(sheet, sheets) {
|
|
1214
|
+
if (typeof sheet === 'number') {
|
|
1215
|
+
var _sheet = sheets[sheet - 1];
|
|
1216
|
+
return _sheet && _sheet.relationId;
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
for (var _iterator = _createForOfIteratorHelperLoose$1(sheets), _step; !(_step = _iterator()).done;) {
|
|
1220
|
+
var _sheet2 = _step.value;
|
|
1221
|
+
|
|
1222
|
+
if (_sheet2.name === sheet) {
|
|
1223
|
+
return _sheet2.relationId;
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
function createSheetNotFoundError(sheet, sheets) {
|
|
1229
|
+
var sheetsList = sheets && sheets.map(function (sheet, i) {
|
|
1230
|
+
return "\"".concat(sheet.name, "\" (#").concat(i + 1, ")");
|
|
1231
|
+
}).join(', ');
|
|
1232
|
+
return new Error("Sheet ".concat(typeof sheet === 'number' ? '#' + sheet : '"' + sheet + '"', " not found in the *.xlsx file.").concat(sheets ? ' Available sheets: ' + sheetsList + '.' : ''));
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
function Integer() {}
|
|
1236
|
+
function isInteger(x) {
|
|
1237
|
+
// https://stackoverflow.com/questions/14636536/how-to-check-if-a-variable-is-an-integer-in-javascript
|
|
1238
|
+
return (x | 0) === x;
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
function URL() {} // URL regexp explanation:
|
|
1242
|
+
//
|
|
1243
|
+
// /^
|
|
1244
|
+
//
|
|
1245
|
+
// (?:
|
|
1246
|
+
// // Matches optional "http(s):" or "ftp:":
|
|
1247
|
+
// (?:
|
|
1248
|
+
// (?:https?|ftp):
|
|
1249
|
+
// )?
|
|
1250
|
+
//
|
|
1251
|
+
// // Matches "//" (required):
|
|
1252
|
+
// \/\/
|
|
1253
|
+
// )
|
|
1254
|
+
//
|
|
1255
|
+
// // Matches a valid non-local IP address:
|
|
1256
|
+
// (?:
|
|
1257
|
+
// (?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])
|
|
1258
|
+
// (?:
|
|
1259
|
+
// \.
|
|
1260
|
+
// (?:1?\d{1,2}|2[0-4]\d|25[0-5])
|
|
1261
|
+
// ){2}
|
|
1262
|
+
// (?:
|
|
1263
|
+
// \.
|
|
1264
|
+
// (?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4])
|
|
1265
|
+
// )
|
|
1266
|
+
//
|
|
1267
|
+
// // Or,
|
|
1268
|
+
// |
|
|
1269
|
+
//
|
|
1270
|
+
// // Matches an alpha-numeric domain name.
|
|
1271
|
+
// (?:
|
|
1272
|
+
// (?:
|
|
1273
|
+
// [a-z0-9\u00a1-\uffff]
|
|
1274
|
+
// [a-z0-9\u00a1-\uffff_-]{0,62}
|
|
1275
|
+
// )?
|
|
1276
|
+
// [a-z0-9\u00a1-\uffff]
|
|
1277
|
+
// \.
|
|
1278
|
+
// )*
|
|
1279
|
+
// (?:
|
|
1280
|
+
// // Domain zone: "com", "net", etc (required):
|
|
1281
|
+
// [a-z\u00a1-\uffff]{2,}
|
|
1282
|
+
// )
|
|
1283
|
+
// )
|
|
1284
|
+
//
|
|
1285
|
+
// // Matches a colon and a port number:
|
|
1286
|
+
// (?::\d{2,5})?
|
|
1287
|
+
//
|
|
1288
|
+
// // Matches everything after the "origin":
|
|
1289
|
+
// // * pathname
|
|
1290
|
+
// // * query
|
|
1291
|
+
// // * hash
|
|
1292
|
+
// (?:[/?#]\S*)?
|
|
1293
|
+
//
|
|
1294
|
+
// $/i
|
|
1295
|
+
|
|
1296
|
+
var regexp$1 = /^(?:(?:(?:https?|ftp):)?\/\/)(?:(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)*(?:[a-z\u00a1-\uffff]{2,}))(?::\d{2,5})?(?:[/?#]\S*)?$/i; // https://stackoverflow.com/questions/8667070/javascript-regular-expression-to-validate-url
|
|
1297
|
+
|
|
1298
|
+
function isURL(value) {
|
|
1299
|
+
return regexp$1.test(value);
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1302
|
+
function Email() {}
|
|
1303
|
+
var regexp = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i;
|
|
1304
|
+
function isEmail(value) {
|
|
1305
|
+
return regexp.test(value);
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
1309
|
+
|
|
1310
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
1311
|
+
|
|
1312
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]); if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
1313
|
+
|
|
1314
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
1315
|
+
|
|
1316
|
+
function _typeof$1(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof$1 = function _typeof(obj) { return typeof obj; }; } else { _typeof$1 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof$1(obj); }
|
|
1317
|
+
|
|
1318
|
+
function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
1319
|
+
|
|
1320
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
1321
|
+
|
|
1322
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
1323
|
+
|
|
1324
|
+
function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
1325
|
+
|
|
1326
|
+
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty$1(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
1327
|
+
|
|
1328
|
+
function _defineProperty$1(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
1329
|
+
var DEFAULT_OPTIONS = {
|
|
1330
|
+
isColumnOriented: false
|
|
1331
|
+
};
|
|
1332
|
+
/**
|
|
1333
|
+
* Convert 2D array to nested objects.
|
|
1334
|
+
* If row oriented data, row 0 is dotted key names.
|
|
1335
|
+
* Column oriented data is transposed.
|
|
1336
|
+
* @param {any[][]} data - An array of rows, each row being an array of cells.
|
|
1337
|
+
* @param {object} schema
|
|
1338
|
+
* @return {object[]}
|
|
1339
|
+
*/
|
|
1340
|
+
|
|
1341
|
+
function convertToJson (data, schema, options) {
|
|
1342
|
+
if (options) {
|
|
1343
|
+
options = _objectSpread$1(_objectSpread$1({}, DEFAULT_OPTIONS), options);
|
|
1344
|
+
} else {
|
|
1345
|
+
options = DEFAULT_OPTIONS;
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1348
|
+
var _options = options,
|
|
1349
|
+
isColumnOriented = _options.isColumnOriented,
|
|
1350
|
+
rowMap = _options.rowMap;
|
|
1351
|
+
validateSchema(schema);
|
|
1352
|
+
|
|
1353
|
+
if (isColumnOriented) {
|
|
1354
|
+
data = transpose(data);
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
var columns = data[0];
|
|
1358
|
+
var results = [];
|
|
1359
|
+
var errors = [];
|
|
1360
|
+
|
|
1361
|
+
for (var i = 1; i < data.length; i++) {
|
|
1362
|
+
var result = read(schema, data[i], i - 1, columns, errors, options);
|
|
1363
|
+
|
|
1364
|
+
if (result) {
|
|
1365
|
+
results.push(result);
|
|
1366
|
+
}
|
|
1367
|
+
} // Correct error rows.
|
|
1368
|
+
|
|
1369
|
+
|
|
1370
|
+
if (rowMap) {
|
|
1371
|
+
for (var _iterator = _createForOfIteratorHelperLoose(errors), _step; !(_step = _iterator()).done;) {
|
|
1372
|
+
var error = _step.value;
|
|
1373
|
+
// Convert the `row` index in `data` to the
|
|
1374
|
+
// actual `row` index in the spreadsheet.
|
|
1375
|
+
// The `1` compensates for the header row.
|
|
1376
|
+
error.row = rowMap[error.row] + 1;
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1380
|
+
return {
|
|
1381
|
+
rows: results,
|
|
1382
|
+
errors: errors
|
|
1383
|
+
};
|
|
1384
|
+
}
|
|
1385
|
+
|
|
1386
|
+
function read(schema, row, rowIndex, columns, errors, options) {
|
|
1387
|
+
var object = {};
|
|
1388
|
+
|
|
1389
|
+
var _loop = function _loop() {
|
|
1390
|
+
var key = _Object$keys[_i];
|
|
1391
|
+
var schemaEntry = schema[key];
|
|
1392
|
+
var isNestedSchema = _typeof$1(schemaEntry.type) === 'object' && !Array.isArray(schemaEntry.type);
|
|
1393
|
+
var rawValue = row[columns.indexOf(key)];
|
|
1394
|
+
|
|
1395
|
+
if (rawValue === undefined) {
|
|
1396
|
+
rawValue = null;
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
var value = void 0;
|
|
1400
|
+
var error = void 0;
|
|
1401
|
+
|
|
1402
|
+
if (isNestedSchema) {
|
|
1403
|
+
value = read(schemaEntry.type, row, rowIndex, columns, errors, options);
|
|
1404
|
+
} else {
|
|
1405
|
+
if (rawValue === null) {
|
|
1406
|
+
value = null;
|
|
1407
|
+
} else if (Array.isArray(schemaEntry.type)) {
|
|
1408
|
+
var notEmpty = false;
|
|
1409
|
+
var array = parseArray(rawValue).map(function (_value) {
|
|
1410
|
+
var result = parseValue(_value, schemaEntry, options);
|
|
1411
|
+
|
|
1412
|
+
if (result.error) {
|
|
1413
|
+
value = _value;
|
|
1414
|
+
error = result.error;
|
|
1415
|
+
}
|
|
1416
|
+
|
|
1417
|
+
if (result.value !== null) {
|
|
1418
|
+
notEmpty = true;
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1421
|
+
return result.value;
|
|
1422
|
+
});
|
|
1423
|
+
|
|
1424
|
+
if (!error) {
|
|
1425
|
+
value = notEmpty ? array : null;
|
|
1426
|
+
}
|
|
1427
|
+
} else {
|
|
1428
|
+
var result = parseValue(rawValue, schemaEntry, options);
|
|
1429
|
+
error = result.error;
|
|
1430
|
+
value = error ? rawValue : result.value;
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
|
|
1434
|
+
if (!error && value === null && schemaEntry.required) {
|
|
1435
|
+
error = 'required';
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1438
|
+
if (error) {
|
|
1439
|
+
error = {
|
|
1440
|
+
error: error,
|
|
1441
|
+
row: rowIndex + 1,
|
|
1442
|
+
column: key,
|
|
1443
|
+
value: value
|
|
1444
|
+
};
|
|
1445
|
+
|
|
1446
|
+
if (schemaEntry.type) {
|
|
1447
|
+
error.type = schemaEntry.type;
|
|
1448
|
+
}
|
|
1449
|
+
|
|
1450
|
+
errors.push(error);
|
|
1451
|
+
} else if (value !== null) {
|
|
1452
|
+
object[schemaEntry.prop] = value;
|
|
1453
|
+
}
|
|
1454
|
+
};
|
|
1455
|
+
|
|
1456
|
+
for (var _i = 0, _Object$keys = Object.keys(schema); _i < _Object$keys.length; _i++) {
|
|
1457
|
+
_loop();
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
if (Object.keys(object).length > 0) {
|
|
1461
|
+
return object;
|
|
1462
|
+
}
|
|
1463
|
+
|
|
1464
|
+
return null;
|
|
1465
|
+
}
|
|
1466
|
+
/**
|
|
1467
|
+
* Converts textual value to a javascript typed value.
|
|
1468
|
+
* @param {any} value
|
|
1469
|
+
* @param {object} schemaEntry
|
|
1470
|
+
* @return {{ value: any, error: string }}
|
|
1471
|
+
*/
|
|
1472
|
+
|
|
1473
|
+
|
|
1474
|
+
function parseValue(value, schemaEntry, options) {
|
|
1475
|
+
if (value === null) {
|
|
1476
|
+
return {
|
|
1477
|
+
value: null
|
|
1478
|
+
};
|
|
1479
|
+
}
|
|
1480
|
+
|
|
1481
|
+
var result;
|
|
1482
|
+
|
|
1483
|
+
if (schemaEntry.parse) {
|
|
1484
|
+
result = parseCustomValue(value, schemaEntry.parse);
|
|
1485
|
+
} else if (schemaEntry.type) {
|
|
1486
|
+
result = parseValueOfType(value, // Supports parsing array types.
|
|
1487
|
+
// See `parseArray()` function for more details.
|
|
1488
|
+
// Example `type`: String[]
|
|
1489
|
+
// Input: 'Barack Obama, "String, with, colons", Donald Trump'
|
|
1490
|
+
// Output: ['Barack Obama', 'String, with, colons', 'Donald Trump']
|
|
1491
|
+
Array.isArray(schemaEntry.type) ? schemaEntry.type[0] : schemaEntry.type, options);
|
|
1492
|
+
} else {
|
|
1493
|
+
result = {
|
|
1494
|
+
value: value
|
|
1495
|
+
}; // throw new Error('Invalid schema entry: no .type and no .parse():\n\n' + JSON.stringify(schemaEntry, null, 2))
|
|
1496
|
+
} // If errored then return the error.
|
|
1497
|
+
|
|
1498
|
+
|
|
1499
|
+
if (result.error) {
|
|
1500
|
+
return result;
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1503
|
+
if (result.value !== null) {
|
|
1504
|
+
if (schemaEntry.oneOf && schemaEntry.oneOf.indexOf(result.value) < 0) {
|
|
1505
|
+
return {
|
|
1506
|
+
error: 'invalid'
|
|
1507
|
+
};
|
|
1508
|
+
}
|
|
1509
|
+
|
|
1510
|
+
if (schemaEntry.validate) {
|
|
1511
|
+
try {
|
|
1512
|
+
schemaEntry.validate(result.value);
|
|
1513
|
+
} catch (error) {
|
|
1514
|
+
return {
|
|
1515
|
+
error: error.message
|
|
1516
|
+
};
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1521
|
+
return result;
|
|
1522
|
+
}
|
|
1523
|
+
/**
|
|
1524
|
+
* Converts textual value to a custom value using supplied `.parse()`.
|
|
1525
|
+
* @param {any} value
|
|
1526
|
+
* @param {function} parse
|
|
1527
|
+
* @return {{ value: any, error: string }}
|
|
1528
|
+
*/
|
|
1529
|
+
|
|
1530
|
+
function parseCustomValue(value, parse) {
|
|
1531
|
+
try {
|
|
1532
|
+
value = parse(value);
|
|
1533
|
+
|
|
1534
|
+
if (value === undefined) {
|
|
1535
|
+
return {
|
|
1536
|
+
value: null
|
|
1537
|
+
};
|
|
1538
|
+
}
|
|
1539
|
+
|
|
1540
|
+
return {
|
|
1541
|
+
value: value
|
|
1542
|
+
};
|
|
1543
|
+
} catch (error) {
|
|
1544
|
+
return {
|
|
1545
|
+
error: error.message
|
|
1546
|
+
};
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
/**
|
|
1550
|
+
* Converts textual value to a javascript typed value.
|
|
1551
|
+
* @param {any} value
|
|
1552
|
+
* @param {} type
|
|
1553
|
+
* @return {{ value: (string|number|Date|boolean), error: string }}
|
|
1554
|
+
*/
|
|
1555
|
+
|
|
1556
|
+
|
|
1557
|
+
function parseValueOfType(value, type, options) {
|
|
1558
|
+
switch (type) {
|
|
1559
|
+
case String:
|
|
1560
|
+
if (typeof value === 'string') {
|
|
1561
|
+
return {
|
|
1562
|
+
value: value
|
|
1563
|
+
};
|
|
1564
|
+
} // The global `isFinite()` function filters out:
|
|
1565
|
+
// * NaN
|
|
1566
|
+
// * -Infinity
|
|
1567
|
+
// * Infinity
|
|
1568
|
+
// All other values pass (including non-numbers).
|
|
1569
|
+
|
|
1570
|
+
|
|
1571
|
+
if (typeof value === 'number') {
|
|
1572
|
+
if (isFinite(value)) {
|
|
1573
|
+
return {
|
|
1574
|
+
value: String(value)
|
|
1575
|
+
};
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
|
|
1579
|
+
return {
|
|
1580
|
+
error: 'invalid'
|
|
1581
|
+
};
|
|
1582
|
+
|
|
1583
|
+
case Number:
|
|
1584
|
+
case Integer:
|
|
1585
|
+
// Convert strings to numbers.
|
|
1586
|
+
// Just an additional feature.
|
|
1587
|
+
// Won't happen when called from `readXlsx()`.
|
|
1588
|
+
if (typeof value === 'string') {
|
|
1589
|
+
var stringifiedValue = value;
|
|
1590
|
+
value = parseFloat(value);
|
|
1591
|
+
|
|
1592
|
+
if (String(value) !== stringifiedValue) {
|
|
1593
|
+
return {
|
|
1594
|
+
error: 'invalid'
|
|
1595
|
+
};
|
|
1596
|
+
}
|
|
1597
|
+
} else if (typeof value !== 'number') {
|
|
1598
|
+
return {
|
|
1599
|
+
error: 'invalid'
|
|
1600
|
+
};
|
|
1601
|
+
} // The global `isFinite()` function filters out:
|
|
1602
|
+
// * NaN
|
|
1603
|
+
// * -Infinity
|
|
1604
|
+
// * Infinity
|
|
1605
|
+
// All other values pass (including non-numbers).
|
|
1606
|
+
// At this point, `value` can only be a number.
|
|
1607
|
+
|
|
1608
|
+
|
|
1609
|
+
if (!isFinite(value)) {
|
|
1610
|
+
return {
|
|
1611
|
+
error: 'invalid'
|
|
1612
|
+
};
|
|
1613
|
+
}
|
|
1614
|
+
|
|
1615
|
+
if (type === Integer && !isInteger(value)) {
|
|
1616
|
+
return {
|
|
1617
|
+
error: 'invalid'
|
|
1618
|
+
};
|
|
1619
|
+
}
|
|
1620
|
+
|
|
1621
|
+
return {
|
|
1622
|
+
value: value
|
|
1623
|
+
};
|
|
1624
|
+
|
|
1625
|
+
case URL:
|
|
1626
|
+
if (typeof value === 'string') {
|
|
1627
|
+
if (isURL(value)) {
|
|
1628
|
+
return {
|
|
1629
|
+
value: value
|
|
1630
|
+
};
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
|
|
1634
|
+
return {
|
|
1635
|
+
error: 'invalid'
|
|
1636
|
+
};
|
|
1637
|
+
|
|
1638
|
+
case Email:
|
|
1639
|
+
if (typeof value === 'string') {
|
|
1640
|
+
if (isEmail(value)) {
|
|
1641
|
+
return {
|
|
1642
|
+
value: value
|
|
1643
|
+
};
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
|
|
1647
|
+
return {
|
|
1648
|
+
error: 'invalid'
|
|
1649
|
+
};
|
|
1650
|
+
|
|
1651
|
+
case Date:
|
|
1652
|
+
// XLSX has no specific format for dates.
|
|
1653
|
+
// Sometimes a date can be heuristically detected.
|
|
1654
|
+
// https://github.com/catamphetamine/read-excel-file/issues/3#issuecomment-395770777
|
|
1655
|
+
if (value instanceof Date) {
|
|
1656
|
+
return {
|
|
1657
|
+
value: value
|
|
1658
|
+
};
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
if (typeof value === 'number') {
|
|
1662
|
+
if (!isFinite(value)) {
|
|
1663
|
+
return {
|
|
1664
|
+
error: 'invalid'
|
|
1665
|
+
};
|
|
1666
|
+
}
|
|
1667
|
+
|
|
1668
|
+
value = parseInt(value);
|
|
1669
|
+
var date = parseExcelDate(value, options.properties);
|
|
1670
|
+
|
|
1671
|
+
if (!date) {
|
|
1672
|
+
return {
|
|
1673
|
+
error: 'invalid'
|
|
1674
|
+
};
|
|
1675
|
+
}
|
|
1676
|
+
|
|
1677
|
+
return {
|
|
1678
|
+
value: date
|
|
1679
|
+
};
|
|
1680
|
+
}
|
|
1681
|
+
|
|
1682
|
+
return {
|
|
1683
|
+
error: 'invalid'
|
|
1684
|
+
};
|
|
1685
|
+
|
|
1686
|
+
case Boolean:
|
|
1687
|
+
if (typeof value === 'boolean') {
|
|
1688
|
+
return {
|
|
1689
|
+
value: value
|
|
1690
|
+
};
|
|
1691
|
+
}
|
|
1692
|
+
|
|
1693
|
+
return {
|
|
1694
|
+
error: 'invalid'
|
|
1695
|
+
};
|
|
1696
|
+
|
|
1697
|
+
default:
|
|
1698
|
+
if (typeof type === 'function') {
|
|
1699
|
+
return parseCustomValue(value, type);
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1702
|
+
throw new Error("Unknown schema type: ".concat(type && type.name || type));
|
|
1703
|
+
}
|
|
1704
|
+
}
|
|
1705
|
+
|
|
1706
|
+
function getBlock(string, endCharacter, startIndex) {
|
|
1707
|
+
var i = 0;
|
|
1708
|
+
var substring = '';
|
|
1709
|
+
|
|
1710
|
+
while (startIndex + i < string.length) {
|
|
1711
|
+
var _character = string[startIndex + i];
|
|
1712
|
+
|
|
1713
|
+
if (_character === endCharacter) {
|
|
1714
|
+
return [substring, i];
|
|
1715
|
+
} else if (_character === '"') {
|
|
1716
|
+
var block = getBlock(string, '"', startIndex + i + 1);
|
|
1717
|
+
substring += block[0];
|
|
1718
|
+
i += '"'.length + block[1] + '"'.length;
|
|
1719
|
+
} else {
|
|
1720
|
+
substring += _character;
|
|
1721
|
+
i++;
|
|
1722
|
+
}
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1725
|
+
return [substring, i];
|
|
1726
|
+
}
|
|
1727
|
+
/**
|
|
1728
|
+
* Parses a string of comma-separated substrings into an array of substrings.
|
|
1729
|
+
* (the `export` is just for tests)
|
|
1730
|
+
* @param {string} string — A string of comma-separated substrings.
|
|
1731
|
+
* @return {string[]} An array of substrings.
|
|
1732
|
+
*/
|
|
1733
|
+
|
|
1734
|
+
function parseArray(string) {
|
|
1735
|
+
var blocks = [];
|
|
1736
|
+
var index = 0;
|
|
1737
|
+
|
|
1738
|
+
while (index < string.length) {
|
|
1739
|
+
var _getBlock = getBlock(string, ',', index),
|
|
1740
|
+
_getBlock2 = _slicedToArray(_getBlock, 2),
|
|
1741
|
+
substring = _getBlock2[0],
|
|
1742
|
+
length = _getBlock2[1];
|
|
1743
|
+
|
|
1744
|
+
index += length + ','.length;
|
|
1745
|
+
blocks.push(substring.trim());
|
|
1746
|
+
}
|
|
1747
|
+
|
|
1748
|
+
return blocks;
|
|
1749
|
+
} // Transpose a 2D array.
|
|
1750
|
+
// https://stackoverflow.com/questions/17428587/transposing-a-2d-array-in-javascript
|
|
1751
|
+
|
|
1752
|
+
var transpose = function transpose(array) {
|
|
1753
|
+
return array[0].map(function (_, i) {
|
|
1754
|
+
return array.map(function (row) {
|
|
1755
|
+
return row[i];
|
|
1756
|
+
});
|
|
1757
|
+
});
|
|
1758
|
+
};
|
|
1759
|
+
|
|
1760
|
+
function validateSchema(schema) {
|
|
1761
|
+
for (var _i2 = 0, _Object$keys2 = Object.keys(schema); _i2 < _Object$keys2.length; _i2++) {
|
|
1762
|
+
var key = _Object$keys2[_i2];
|
|
1763
|
+
var entry = schema[key];
|
|
1764
|
+
|
|
1765
|
+
if (!entry.prop) {
|
|
1766
|
+
throw new Error("\"prop\" not defined for schema entry \"".concat(key, "\"."));
|
|
1767
|
+
}
|
|
1768
|
+
}
|
|
1769
|
+
}
|
|
1770
|
+
|
|
1771
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
1772
|
+
|
|
1773
|
+
function convertMapToSchema(map) {
|
|
1774
|
+
var schema = {};
|
|
1775
|
+
|
|
1776
|
+
for (var _i = 0, _Object$keys = Object.keys(map); _i < _Object$keys.length; _i++) {
|
|
1777
|
+
var key = _Object$keys[_i];
|
|
1778
|
+
var prop = map[key];
|
|
1779
|
+
var type = void 0;
|
|
1780
|
+
|
|
1781
|
+
if (_typeof(prop) === 'object') {
|
|
1782
|
+
prop = Object.keys(map[key])[0];
|
|
1783
|
+
type = convertMapToSchema(map[key][prop]);
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1786
|
+
schema[key] = {
|
|
1787
|
+
prop: prop
|
|
1788
|
+
};
|
|
1789
|
+
|
|
1790
|
+
if (type) {
|
|
1791
|
+
schema[key].type = type;
|
|
1792
|
+
}
|
|
1793
|
+
}
|
|
1794
|
+
|
|
1795
|
+
return schema;
|
|
1796
|
+
}
|
|
1797
|
+
|
|
1798
|
+
var _excluded = ["schema", "map"];
|
|
1799
|
+
|
|
1800
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
1801
|
+
|
|
1802
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
1803
|
+
|
|
1804
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
1805
|
+
|
|
1806
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
1807
|
+
|
|
1808
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
1809
|
+
function readXlsxFileContents(entries, xml, _ref) {
|
|
1810
|
+
var schema = _ref.schema,
|
|
1811
|
+
map = _ref.map,
|
|
1812
|
+
options = _objectWithoutProperties(_ref, _excluded);
|
|
1813
|
+
|
|
1814
|
+
if (!schema && map) {
|
|
1815
|
+
schema = convertMapToSchema(map);
|
|
1816
|
+
}
|
|
1817
|
+
|
|
1818
|
+
var result = readXlsx(entries, xml, _objectSpread(_objectSpread({}, options), {}, {
|
|
1819
|
+
properties: schema || options.properties
|
|
1820
|
+
}));
|
|
1821
|
+
|
|
1822
|
+
if (schema) {
|
|
1823
|
+
return convertToJson(result.data, schema, _objectSpread(_objectSpread({}, options), {}, {
|
|
1824
|
+
properties: result.properties
|
|
1825
|
+
}));
|
|
1826
|
+
}
|
|
1827
|
+
|
|
1828
|
+
return result;
|
|
1829
|
+
}
|
|
1830
|
+
|
|
1831
|
+
/**
|
|
1832
|
+
* Reads XLSX file into a 2D array of cells in a browser.
|
|
1833
|
+
* @param {file} file - A file being uploaded in the browser.
|
|
1834
|
+
* @param {object?} options
|
|
1835
|
+
* @param {(number|string)?} options.sheet - Excel document sheet to read. Defaults to `1`. Will only read this sheet and skip others.
|
|
1836
|
+
* @return {Promise} Resolves to a 2D array of cells: an array of rows, each row being an array of cells.
|
|
1837
|
+
*/
|
|
1838
|
+
|
|
1839
|
+
function readXlsxFile(file) {
|
|
1840
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1841
|
+
return unpackXlsxFile(file).then(function (entries) {
|
|
1842
|
+
return readXlsxFileContents(entries, xml, options);
|
|
1843
|
+
});
|
|
1844
|
+
}
|
|
1845
|
+
|
|
1846
|
+
async function convertFileFromStream(stream, filterColumnNames = ["what", "deliveryscope"]) {
|
|
1847
|
+
const toFilterValue = (x) => x.toLowerCase().replace(/\s+/g, '');
|
|
1848
|
+
const sheets = await readXlsxFile(stream, { getSheets: true });
|
|
1849
|
+
let dataRows = [];
|
|
1850
|
+
let sheetsData = await Promise.all(sheets.map(async (sheet) => { return await readXlsxFile(stream, { sheet: sheet.name }) }));
|
|
1851
|
+
|
|
1852
|
+
let types = {};
|
|
1853
|
+
sheetsData.forEach(sheetData => {
|
|
1854
|
+
const firstRow = sheetData.shift().map(x => toFilterValue(x));
|
|
1855
|
+
// Set up column for adding options
|
|
1856
|
+
firstRow.forEach((col, i) => {
|
|
1857
|
+
if (typeof types[col] === "undefined" && filterColumnNames.includes(col)) {
|
|
1858
|
+
types[col] = [];
|
|
1859
|
+
}
|
|
1860
|
+
});
|
|
1861
|
+
sheetData.forEach((row, rowindex) => {
|
|
1862
|
+
const dataRow = {};
|
|
1863
|
+
firstRow.forEach(async (col, i) => {
|
|
1864
|
+
const rowVal = row[i];
|
|
1865
|
+
dataRow[col] = rowVal;
|
|
1866
|
+
// Add to types options
|
|
1867
|
+
if (filterColumnNames.includes(col)) {
|
|
1868
|
+
const filterVal = toFilterValue(rowVal);
|
|
1869
|
+
dataRow[col] = filterVal;
|
|
1870
|
+
if (!types[col].includes(filterVal)) {
|
|
1871
|
+
types[col].push(filterVal);
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1874
|
+
});
|
|
1875
|
+
dataRows.push(dataRow);
|
|
1876
|
+
});
|
|
1877
|
+
});
|
|
1878
|
+
|
|
1879
|
+
const fileData = {
|
|
1880
|
+
"types": types,
|
|
1881
|
+
"data": dataRows
|
|
1882
|
+
};
|
|
1883
|
+
return fileData;
|
|
1884
|
+
}
|
|
1885
|
+
|
|
1886
|
+
const appendToMap = (map, propName, value) => {
|
|
1887
|
+
const items = map.get(propName);
|
|
1888
|
+
if (!items) {
|
|
1889
|
+
map.set(propName, [value]);
|
|
1890
|
+
}
|
|
1891
|
+
else if (!items.includes(value)) {
|
|
1892
|
+
items.push(value);
|
|
1893
|
+
}
|
|
1894
|
+
};
|
|
1895
|
+
const debounce = (fn, ms) => {
|
|
1896
|
+
let timeoutId;
|
|
1897
|
+
return (...args) => {
|
|
1898
|
+
if (timeoutId) {
|
|
1899
|
+
clearTimeout(timeoutId);
|
|
1900
|
+
}
|
|
1901
|
+
timeoutId = setTimeout(() => {
|
|
1902
|
+
timeoutId = 0;
|
|
1903
|
+
fn(...args);
|
|
1904
|
+
}, ms);
|
|
1905
|
+
};
|
|
1906
|
+
};
|
|
1907
|
+
|
|
1908
|
+
/**
|
|
1909
|
+
* Check if a possible element isConnected.
|
|
1910
|
+
* The property might not be there, so we check for it.
|
|
1911
|
+
*
|
|
1912
|
+
* We want it to return true if isConnected is not a property,
|
|
1913
|
+
* otherwise we would remove these elements and would not update.
|
|
1914
|
+
*
|
|
1915
|
+
* Better leak in Edge than to be useless.
|
|
1916
|
+
*/
|
|
1917
|
+
const isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
|
|
1918
|
+
const cleanupElements = debounce((map) => {
|
|
1919
|
+
for (let key of map.keys()) {
|
|
1920
|
+
map.set(key, map.get(key).filter(isConnected));
|
|
1921
|
+
}
|
|
1922
|
+
}, 2000);
|
|
1923
|
+
const stencilSubscription = ({ on }) => {
|
|
1924
|
+
const elmsToUpdate = new Map();
|
|
1925
|
+
if (typeof getRenderingRef === 'function') {
|
|
1926
|
+
// If we are not in a stencil project, we do nothing.
|
|
1927
|
+
// This function is not really exported by @stencil/core.
|
|
1928
|
+
on('dispose', () => {
|
|
1929
|
+
elmsToUpdate.clear();
|
|
1930
|
+
});
|
|
1931
|
+
on('get', (propName) => {
|
|
1932
|
+
const elm = getRenderingRef();
|
|
1933
|
+
if (elm) {
|
|
1934
|
+
appendToMap(elmsToUpdate, propName, elm);
|
|
1935
|
+
}
|
|
1936
|
+
});
|
|
1937
|
+
on('set', (propName) => {
|
|
1938
|
+
const elements = elmsToUpdate.get(propName);
|
|
1939
|
+
if (elements) {
|
|
1940
|
+
elmsToUpdate.set(propName, elements.filter(forceUpdate));
|
|
1941
|
+
}
|
|
1942
|
+
cleanupElements(elmsToUpdate);
|
|
1943
|
+
});
|
|
1944
|
+
on('reset', () => {
|
|
1945
|
+
elmsToUpdate.forEach((elms) => elms.forEach(forceUpdate));
|
|
1946
|
+
cleanupElements(elmsToUpdate);
|
|
1947
|
+
});
|
|
1948
|
+
}
|
|
1949
|
+
};
|
|
1950
|
+
|
|
1951
|
+
const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {
|
|
1952
|
+
let states = new Map(Object.entries(defaultState !== null && defaultState !== void 0 ? defaultState : {}));
|
|
1953
|
+
const handlers = {
|
|
1954
|
+
dispose: [],
|
|
1955
|
+
get: [],
|
|
1956
|
+
set: [],
|
|
1957
|
+
reset: [],
|
|
1958
|
+
};
|
|
1959
|
+
const reset = () => {
|
|
1960
|
+
states = new Map(Object.entries(defaultState !== null && defaultState !== void 0 ? defaultState : {}));
|
|
1961
|
+
handlers.reset.forEach((cb) => cb());
|
|
1962
|
+
};
|
|
1963
|
+
const dispose = () => {
|
|
1964
|
+
// Call first dispose as resetting the state would
|
|
1965
|
+
// cause less updates ;)
|
|
1966
|
+
handlers.dispose.forEach((cb) => cb());
|
|
1967
|
+
reset();
|
|
1968
|
+
};
|
|
1969
|
+
const get = (propName) => {
|
|
1970
|
+
handlers.get.forEach((cb) => cb(propName));
|
|
1971
|
+
return states.get(propName);
|
|
1972
|
+
};
|
|
1973
|
+
const set = (propName, value) => {
|
|
1974
|
+
const oldValue = states.get(propName);
|
|
1975
|
+
if (shouldUpdate(value, oldValue, propName)) {
|
|
1976
|
+
states.set(propName, value);
|
|
1977
|
+
handlers.set.forEach((cb) => cb(propName, value, oldValue));
|
|
1978
|
+
}
|
|
1979
|
+
};
|
|
1980
|
+
const state = (typeof Proxy === 'undefined'
|
|
1981
|
+
? {}
|
|
1982
|
+
: new Proxy(defaultState, {
|
|
1983
|
+
get(_, propName) {
|
|
1984
|
+
return get(propName);
|
|
1985
|
+
},
|
|
1986
|
+
ownKeys(_) {
|
|
1987
|
+
return Array.from(states.keys());
|
|
1988
|
+
},
|
|
1989
|
+
getOwnPropertyDescriptor() {
|
|
1990
|
+
return {
|
|
1991
|
+
enumerable: true,
|
|
1992
|
+
configurable: true,
|
|
1993
|
+
};
|
|
1994
|
+
},
|
|
1995
|
+
has(_, propName) {
|
|
1996
|
+
return states.has(propName);
|
|
1997
|
+
},
|
|
1998
|
+
set(_, propName, value) {
|
|
1999
|
+
set(propName, value);
|
|
2000
|
+
return true;
|
|
2001
|
+
},
|
|
2002
|
+
}));
|
|
2003
|
+
const on = (eventName, callback) => {
|
|
2004
|
+
handlers[eventName].push(callback);
|
|
2005
|
+
return () => {
|
|
2006
|
+
removeFromArray(handlers[eventName], callback);
|
|
2007
|
+
};
|
|
2008
|
+
};
|
|
2009
|
+
const onChange = (propName, cb) => {
|
|
2010
|
+
const unSet = on('set', (key, newValue) => {
|
|
2011
|
+
if (key === propName) {
|
|
2012
|
+
cb(newValue);
|
|
2013
|
+
}
|
|
2014
|
+
});
|
|
2015
|
+
const unReset = on('reset', () => cb(defaultState[propName]));
|
|
2016
|
+
return () => {
|
|
2017
|
+
unSet();
|
|
2018
|
+
unReset();
|
|
2019
|
+
};
|
|
2020
|
+
};
|
|
2021
|
+
const use = (...subscriptions) => subscriptions.forEach((subscription) => {
|
|
2022
|
+
if (subscription.set) {
|
|
2023
|
+
on('set', subscription.set);
|
|
2024
|
+
}
|
|
2025
|
+
if (subscription.get) {
|
|
2026
|
+
on('get', subscription.get);
|
|
2027
|
+
}
|
|
2028
|
+
if (subscription.reset) {
|
|
2029
|
+
on('reset', subscription.reset);
|
|
2030
|
+
}
|
|
2031
|
+
});
|
|
2032
|
+
const forceUpdate = (key) => {
|
|
2033
|
+
const oldValue = states.get(key);
|
|
2034
|
+
handlers.set.forEach((cb) => cb(key, oldValue, oldValue));
|
|
2035
|
+
};
|
|
2036
|
+
return {
|
|
2037
|
+
state,
|
|
2038
|
+
get,
|
|
2039
|
+
set,
|
|
2040
|
+
on,
|
|
2041
|
+
onChange,
|
|
2042
|
+
use,
|
|
2043
|
+
dispose,
|
|
2044
|
+
reset,
|
|
2045
|
+
forceUpdate,
|
|
2046
|
+
};
|
|
2047
|
+
};
|
|
2048
|
+
const removeFromArray = (array, item) => {
|
|
2049
|
+
const index = array.indexOf(item);
|
|
2050
|
+
if (index >= 0) {
|
|
2051
|
+
array[index] = array[array.length - 1];
|
|
2052
|
+
array.length--;
|
|
2053
|
+
}
|
|
2054
|
+
};
|
|
2055
|
+
|
|
2056
|
+
const createStore = (defaultState, shouldUpdate) => {
|
|
2057
|
+
const map = createObservableMap(defaultState, shouldUpdate);
|
|
2058
|
+
stencilSubscription(map);
|
|
2059
|
+
return map;
|
|
2060
|
+
};
|
|
2061
|
+
|
|
2062
|
+
// Read more about how stencil stores work here: https://stenciljs.com/docs/stencil-store
|
|
2063
|
+
const { state: state$2, onChange: onChange$2 } = createStore({
|
|
2064
|
+
i18n: {
|
|
2065
|
+
componentheading: '',
|
|
2066
|
+
deliveryscopeheading: '',
|
|
2067
|
+
sizeheading: '',
|
|
2068
|
+
resultlistheading: '',
|
|
2069
|
+
weightlabel: '',
|
|
2070
|
+
maxweightlabel: '',
|
|
2071
|
+
maxmeasurementlabel: '',
|
|
2072
|
+
senddirectcta: '',
|
|
2073
|
+
stampshopcta: '',
|
|
2074
|
+
},
|
|
2075
|
+
market: {
|
|
2076
|
+
currency: ""
|
|
2077
|
+
}
|
|
2078
|
+
});
|
|
2079
|
+
|
|
2080
|
+
const pnFindServiceAndPriceCss = "pn-find-service-and-price .findprice-form{max-width:50em;margin:0 auto}pn-find-service-and-price h2,pn-find-service-and-price .heading{text-align:center;font-size:1.5em;line-height:1.1;font-weight:bold;margin-bottom:1rem}pn-find-service-and-price .postagetypes,pn-find-service-and-price .deliveryscope{text-align:center;margin-bottom:3rem}pn-find-service-and-price .weightoption{display:-ms-flexbox;display:flex;gap:1em}pn-find-service-and-price .weightoption-input{width:5em;position:relative}pn-find-service-and-price .weightoption-input input::-webkit-outer-spin-button,pn-find-service-and-price .weightoption-input input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}pn-find-service-and-price .weightoption-input-abbreviation{position:absolute;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);right:1.2em;margin-top:1.55rem;font-weight:500}pn-find-service-and-price .weightoption-range{-ms-flex-positive:1;flex-grow:1;-ms-flex-item-align:end;align-self:flex-end;position:relative;top:0.5em}pn-find-service-and-price .weightoption-range input{width:calc(100% - 1.5em)}pn-find-service-and-price .weightoption-range datalist{width:100%;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;font-size:0.75em}pn-find-service-and-price .resultlist{margin:3em 0}";
|
|
2081
|
+
|
|
2082
|
+
const PnfindServiceAndPrice = class extends HTMLElement {
|
|
2083
|
+
constructor() {
|
|
2084
|
+
super();
|
|
2085
|
+
this.__registerHost();
|
|
2086
|
+
this.source = "https://com-integration.postnord.com/globalassets/global/prices/sv-se-findprice.xlsx";
|
|
2087
|
+
this.language = "sv";
|
|
2088
|
+
this.market = "se";
|
|
2089
|
+
this.filteredItems = [];
|
|
2090
|
+
this.postagetype = { value: "", name: "", icon: "" };
|
|
2091
|
+
this.weight = { value: 0, name: "" };
|
|
2092
|
+
this.weightvalue = 0;
|
|
2093
|
+
this.deliveryscope = { value: "", name: "", icon: "" };
|
|
2094
|
+
this.sourceData = { types: [], data: [] };
|
|
2095
|
+
}
|
|
2096
|
+
componentWillLoad() {
|
|
2097
|
+
this.setState();
|
|
2098
|
+
this.getDataSource();
|
|
2099
|
+
// window.setTimeout(() => {
|
|
2100
|
+
// this.postagetype = postagetypes[0];
|
|
2101
|
+
// this.deliveryscope = deliveryscopes[this.postagetype.value][0];
|
|
2102
|
+
// this.weight = weights[this.postagetype.value][0];
|
|
2103
|
+
// this.weightvalue = this.weight.value;
|
|
2104
|
+
// }, 500)
|
|
2105
|
+
}
|
|
2106
|
+
async getDataSource() {
|
|
2107
|
+
const cacheBusting = `?cache=${Math.floor(Math.random() * (10000 - 1) + 1)}`;
|
|
2108
|
+
const req = await fetch(this.source + cacheBusting);
|
|
2109
|
+
const reqbody = await req.blob();
|
|
2110
|
+
try {
|
|
2111
|
+
const convertedData = await convertFileFromStream(reqbody);
|
|
2112
|
+
this.sourceData = convertedData;
|
|
2113
|
+
this.filterItems();
|
|
2114
|
+
}
|
|
2115
|
+
catch (e) {
|
|
2116
|
+
console.log('Unable to parse data');
|
|
2117
|
+
}
|
|
2118
|
+
}
|
|
2119
|
+
setState() {
|
|
2120
|
+
if (this.market) {
|
|
2121
|
+
state$2.market = markets$1[this.market];
|
|
2122
|
+
}
|
|
2123
|
+
if (this.language && translations$5[this.language]) {
|
|
2124
|
+
state$2.i18n = translations$5[this.language];
|
|
2125
|
+
}
|
|
2126
|
+
}
|
|
2127
|
+
filterItems() {
|
|
2128
|
+
var _a;
|
|
2129
|
+
// this.debug = `Postagetype: ${this.postagetype.value}. <br/>Weight: ${ this.weight.value }`;
|
|
2130
|
+
if (!((_a = this.sourceData) === null || _a === void 0 ? void 0 : _a.data)) {
|
|
2131
|
+
console.log('Data has not yet been loaded');
|
|
2132
|
+
return;
|
|
2133
|
+
}
|
|
2134
|
+
if (!this.postagetype) {
|
|
2135
|
+
return;
|
|
2136
|
+
}
|
|
2137
|
+
const typeData = this.sourceData.data.filter((x) => x.what === this.postagetype.value);
|
|
2138
|
+
if (!this.deliveryscope) {
|
|
2139
|
+
return;
|
|
2140
|
+
}
|
|
2141
|
+
const deliveryScopeData = typeData.filter((x) => x.deliveryscope === this.deliveryscope.value);
|
|
2142
|
+
if (!this.weight || !this.weight.value) {
|
|
2143
|
+
return;
|
|
2144
|
+
}
|
|
2145
|
+
// For letters we use grams. Otherwise we use KG
|
|
2146
|
+
const comparisonWeight = (this.weight.abbreviation.toLocaleLowerCase() === "kg" && this.postagetype.value === 'letter') ? this.weight.value * 1000 : this.weight.value;
|
|
2147
|
+
let weightFilteredData = deliveryScopeData.filter(x => x.maxweight === comparisonWeight);
|
|
2148
|
+
// In parcels the maxwidths don't necessarily start at 1kg so we fetch any type below the user selected value
|
|
2149
|
+
if (weightFilteredData.length === 0) {
|
|
2150
|
+
weightFilteredData = deliveryScopeData.filter(x => x.maxweight >= comparisonWeight);
|
|
2151
|
+
if (weightFilteredData.length > 0) {
|
|
2152
|
+
// We reverse the result array since the map will take the last unique item instead of the first
|
|
2153
|
+
const uniqueWeightOptions = [...new Map(weightFilteredData.reverse().map(item => [item["id"], item])).values()];
|
|
2154
|
+
if (uniqueWeightOptions.length > 0) {
|
|
2155
|
+
weightFilteredData = uniqueWeightOptions;
|
|
2156
|
+
}
|
|
2157
|
+
}
|
|
2158
|
+
}
|
|
2159
|
+
console.log('weightFilteredData', weightFilteredData);
|
|
2160
|
+
this.filteredItems = weightFilteredData;
|
|
2161
|
+
}
|
|
2162
|
+
render() {
|
|
2163
|
+
return (h("div", null, h("div", { class: "findprice-form" }, (state$2.i18n.componentheading) ? (h("h2", null, state$2.i18n.componentheading)) : null, h("div", { class: "postagetypes" }, postagetypes.map((postagetype) => (h("pn-choice-button", { choiceid: postagetype.value, value: postagetype.value, name: "postagetype", type: "radio", checked: postagetype.value === this.postagetype.value, onChange: () => {
|
|
2164
|
+
this.postagetype = postagetypes.filter(x => x.value === postagetype.value)[0];
|
|
2165
|
+
this.deliveryscope = { value: "", name: "", icon: "" };
|
|
2166
|
+
this.weight = { value: 0, name: "" };
|
|
2167
|
+
this.weightvalue = this.weight.value;
|
|
2168
|
+
} }, h("pn-illustration", { illustration: postagetype.illustration }), " ", postagetype.name)))), this.postagetype.value && deliveryscopes[this.postagetype.value] ? (h("div", null, (state$2.i18n.deliveryscopeheading) ? (h("div", { class: "heading" }, state$2.i18n.deliveryscopeheading)) : null, h("div", { class: "deliveryscope" }, deliveryscopes[this.postagetype.value].map((deliveryscope) => (h("pn-choice-button", { choiceid: this.postagetype.value + deliveryscope.value, value: deliveryscope.value, name: "deliveryscope", type: "radio", checked: deliveryscope.value === this.deliveryscope.value, onChange: () => {
|
|
2169
|
+
this.deliveryscope = deliveryscopes[this.postagetype.value].filter(x => x.value === deliveryscope.value)[0];
|
|
2170
|
+
if (this.weight.value === 0) {
|
|
2171
|
+
this.weight = weights$1[this.postagetype.value][0];
|
|
2172
|
+
this.weightvalue = this.weight.value;
|
|
2173
|
+
}
|
|
2174
|
+
} }, h("pn-illustration", { illustration: deliveryscope.illustration }), " ", deliveryscope.name)))))) : null, (this.postagetype.value && weights$1[this.postagetype.value] && this.deliveryscope.value) ? (h("div", null, (state$2.i18n.sizeheading) ? (h("div", { class: "heading" }, state$2.i18n.sizeheading)) : null, h("div", { class: "weightoption" }, h("div", { class: "weightoption-input" }, h("pn-input", { inputid: "weightvalue", name: "weightvalue", type: "number", label: state$2.i18n.weightlabel, value: this.weightvalue, onChange: (e) => {
|
|
2175
|
+
if (e && e.target && e.target.value) {
|
|
2176
|
+
const weightNum = parseInt(e.target.value, 10);
|
|
2177
|
+
if (!isNaN(weightNum)) {
|
|
2178
|
+
let matchingWeights = weights$1[this.postagetype.value].filter((x) => {
|
|
2179
|
+
let weightInGrams = (x.abbreviation === "kg") ? x.value * 1000 : x.value;
|
|
2180
|
+
return weightInGrams >= weightNum;
|
|
2181
|
+
});
|
|
2182
|
+
if (matchingWeights && matchingWeights.length > 0) {
|
|
2183
|
+
this.weight = matchingWeights[0];
|
|
2184
|
+
this.weightvalue = this.weight.value;
|
|
2185
|
+
}
|
|
2186
|
+
}
|
|
2187
|
+
}
|
|
2188
|
+
} }), h("span", { class: "weightoption-input-abbreviation" }, this.weight.abbreviation)), h("div", { class: "weightoption-range" }, h("input", { type: "range", id: "weightrange", name: "weightrange", list: "weightlist", value: (!this.weight.value) ? 0 : weights$1[this.postagetype.value].findIndex((x) => x.value === this.weightvalue), onChange: (e) => {
|
|
2189
|
+
const value = e.target.value;
|
|
2190
|
+
this.weight = weights$1[this.postagetype.value][value];
|
|
2191
|
+
this.weightvalue = this.weight.value;
|
|
2192
|
+
}, min: "0",
|
|
2193
|
+
// max={ weights[this.postagetype.value][weights[this.postagetype.value].length - 1].value }
|
|
2194
|
+
max: weights$1[this.postagetype.value].length - 1 }), h("datalist", { id: "weightlist" }, weights$1[this.postagetype.value].map((weight, weightindex) => {
|
|
2195
|
+
let labelText = weight.name;
|
|
2196
|
+
if (weights$1[this.postagetype.value].length > 6) {
|
|
2197
|
+
labelText = (weightindex % 5 === 0 || weightindex === 0 || weightindex === weights$1[this.postagetype.value].length - 1) ? weight.name : '';
|
|
2198
|
+
}
|
|
2199
|
+
return (h("option", Object.assign({ value: weightindex }, (labelText ? { label: labelText } : {}))));
|
|
2200
|
+
})))))) : null), (this.filteredItems && this.filteredItems.length > 0) ? (h("div", { class: "resultlist" }, (state$2.i18n.resultlistheading) ? (h("div", { class: "heading" }, state$2.i18n.resultlistheading)) : null, this.filteredItems.map((item) => (h("div", null, h("pn-find-service-and-price-result", { item: item })))))) : null));
|
|
2201
|
+
}
|
|
2202
|
+
static get watchers() { return {
|
|
2203
|
+
"market": ["setState"],
|
|
2204
|
+
"language": ["setState"],
|
|
2205
|
+
"postagetype": ["filterItems"],
|
|
2206
|
+
"deliveryscope": ["filterItems"],
|
|
2207
|
+
"weightvalue": ["filterItems"]
|
|
2208
|
+
}; }
|
|
2209
|
+
static get style() { return pnFindServiceAndPriceCss; }
|
|
2210
|
+
};
|
|
2211
|
+
|
|
2212
|
+
const pnFindServiceAndPriceResultCss = "";
|
|
2213
|
+
|
|
2214
|
+
const PnfindServiceAndPriceResult = class extends HTMLElement {
|
|
2215
|
+
constructor() {
|
|
2216
|
+
super();
|
|
2217
|
+
this.__registerHost();
|
|
2218
|
+
this.item = null;
|
|
2219
|
+
this.shownitems = [];
|
|
2220
|
+
this.weightText = "";
|
|
2221
|
+
}
|
|
2222
|
+
componentWillLoad() {
|
|
2223
|
+
this.composeItems();
|
|
2224
|
+
}
|
|
2225
|
+
composeItems() {
|
|
2226
|
+
this.shownitems = [];
|
|
2227
|
+
if (this.item.pricestamps) {
|
|
2228
|
+
this.shownitems.push(Object.assign(Object.assign({}, this.item), { priceagent: null, pricesenddirect: null }));
|
|
2229
|
+
}
|
|
2230
|
+
if (this.item.priceagent) {
|
|
2231
|
+
this.shownitems.push(Object.assign(Object.assign({}, this.item), { pricestamps: null, pricesenddirect: null }));
|
|
2232
|
+
}
|
|
2233
|
+
if (this.item.pricesenddirect) {
|
|
2234
|
+
this.shownitems.push(Object.assign(Object.assign({}, this.item), { pricestamps: null, priceagent: null }));
|
|
2235
|
+
}
|
|
2236
|
+
// Parcels are always in KG. Letter KG must be converted from grams
|
|
2237
|
+
this.weightText = (this.item.what === "parcel") ? this.item.maxweight + 'kg' :
|
|
2238
|
+
(this.item.what === "letter" && this.item.maxweight > 999) ? Math.round(this.item.maxweight / 1000) + " kg" : this.item.maxweight + " g";
|
|
2239
|
+
}
|
|
2240
|
+
render() {
|
|
2241
|
+
return (h(Host, null, this.shownitems.map((item) => (h("pn-product-tile", null, h("pn-illustration", { slot: "illustration", illustration: item.illustration }), h("div", { slot: "content" }, h("div", { class: "content" }, h("h3", null, item.name), (item.description) ? (h("div", { class: "description" }, item.description)) : null, (item.info) ? (h("div", { class: "description" }, item.info)) : null)), item.maxweight ? (h("pn-product-tile-info", { label: state$2.i18n.maxweightlabel, text: this.weightText })) : null, item.maximummeasurements ? (h("pn-product-tile-info", { label: state$2.i18n.maxmeasurementlabel, text: item.maximummeasurements })) : null, item.pricestamps ? (h("pn-product-tile-price", { slot: "price", label: state$2.i18n.stampshopcta, amount: item.pricestamps + '', currency: state$2.market.currency })) : null, item.priceagent ? (h("pn-product-tile-price", { slot: "price", label: "", amount: item.priceagent + '', currency: state$2.market.currency, url: "https://shop.postnord.se/ebutik/default.aspx" })) : null, item.pricesenddirect ? (h("pn-product-tile-price", { slot: "price", label: state$2.i18n.senddirectcta, amount: item.pricesenddirect + '', currency: state$2.market.currency, url: "https://portal.postnord.com/skickadirekt/" })) : null, item.note ? (h("small", { slot: "note" }, h("p", null, item.note))) : null)))));
|
|
2242
|
+
}
|
|
2243
|
+
static get watchers() { return {
|
|
2244
|
+
"item": ["composeItems"]
|
|
2245
|
+
}; }
|
|
2246
|
+
static get style() { return pnFindServiceAndPriceResultCss; }
|
|
2247
|
+
};
|
|
2248
|
+
|
|
2249
|
+
const translations$4 = {
|
|
2250
|
+
'sv': {
|
|
2251
|
+
"heading": "Språk",
|
|
2252
|
+
},
|
|
2253
|
+
'en': {
|
|
2254
|
+
"heading": "Language"
|
|
2255
|
+
},
|
|
2256
|
+
'da': {
|
|
2257
|
+
"heading": "Sprog"
|
|
2258
|
+
},
|
|
2259
|
+
'no': {
|
|
2260
|
+
"heading": "Språk"
|
|
2261
|
+
},
|
|
2262
|
+
'fi': {
|
|
2263
|
+
"heading": "Kieli"
|
|
2264
|
+
}
|
|
2265
|
+
};
|
|
2266
|
+
|
|
2267
|
+
const pnLanguageSelectorCss = ".languageselector{position:relative}.languageselector-togglebtn{cursor:pointer;border:0;padding:0.64rem 0;background-color:#FFFFFF;color:#005D92;font-size:1.6rem}.languageselector-togglebtn:hover,.languageselector-togglebtn:focus,.languageselector-togglebtn:active{color:#0D234B;text-decoration:underline}.languageselector-togglebtn svg{width:1.9rem;height:1.9rem}.languageselector-title{padding:0.8rem 1.6rem;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.languageselector-list{margin:0;padding:0;list-style:none}";
|
|
2268
|
+
|
|
2269
|
+
const PnlanguageSelector = class extends HTMLElement {
|
|
2270
|
+
constructor() {
|
|
2271
|
+
super();
|
|
2272
|
+
this.__registerHost();
|
|
2273
|
+
/* Current language code */
|
|
2274
|
+
this.value = "";
|
|
2275
|
+
this.selectedLanguageName = "";
|
|
2276
|
+
this.options = [];
|
|
2277
|
+
}
|
|
2278
|
+
componentWillLoad() {
|
|
2279
|
+
this.setTranslations();
|
|
2280
|
+
}
|
|
2281
|
+
componentDidLoad() {
|
|
2282
|
+
this.initialize();
|
|
2283
|
+
}
|
|
2284
|
+
initialize() {
|
|
2285
|
+
const options = [].slice.apply(this.hostElement.querySelectorAll("pn-language-selector-option"));
|
|
2286
|
+
options.map((option) => {
|
|
2287
|
+
// Set current label of language selector
|
|
2288
|
+
if (option.getAttribute("code") == this.value || option.getAttribute("selected") == "true") {
|
|
2289
|
+
this.selectedLanguageName = option.getAttribute("name");
|
|
2290
|
+
}
|
|
2291
|
+
// Bind event listener for when a user change language
|
|
2292
|
+
option.addEventListener("setCurrentLanguage", (event) => {
|
|
2293
|
+
this.onSetCurrentLanguage(event.detail);
|
|
2294
|
+
});
|
|
2295
|
+
});
|
|
2296
|
+
}
|
|
2297
|
+
onSetCurrentLanguage(option) {
|
|
2298
|
+
this.value = option.code;
|
|
2299
|
+
this.selectedLanguageName = option.name;
|
|
2300
|
+
}
|
|
2301
|
+
setTranslations() {
|
|
2302
|
+
if (translations$4[this.value]) {
|
|
2303
|
+
this.i18n = translations$4[this.value];
|
|
2304
|
+
}
|
|
2305
|
+
}
|
|
2306
|
+
onValueChange() {
|
|
2307
|
+
var _a;
|
|
2308
|
+
const components = (_a = this.hostElement.querySelectorAll("pn-language-selector-option")) !== null && _a !== void 0 ? _a : [];
|
|
2309
|
+
components.forEach((component) => {
|
|
2310
|
+
// Pass values as props into slotted components
|
|
2311
|
+
// component.setAttribute("current-language", this.value);
|
|
2312
|
+
component.setAttribute("selected", (component.getAttribute("code") === this.value) + '');
|
|
2313
|
+
});
|
|
2314
|
+
}
|
|
2315
|
+
render() {
|
|
2316
|
+
return (h(Host, null, h("pn-nav-dropdown", { label: this.selectedLanguageName, icon: "globe" }, h("nav", { class: "languageselector-nav", "aria-label": this.i18n.heading }, h("strong", { class: "languageselector-title" }, this.i18n.heading), h("div", { class: "languageselector-list", role: "list" }, h("slot", null))))));
|
|
2317
|
+
}
|
|
2318
|
+
get hostElement() { return this; }
|
|
2319
|
+
static get watchers() { return {
|
|
2320
|
+
"value": ["onValueChange"]
|
|
2321
|
+
}; }
|
|
2322
|
+
static get style() { return pnLanguageSelectorCss; }
|
|
2323
|
+
};
|
|
2324
|
+
|
|
2325
|
+
const pnLanguageSelectorOptionCss = "pn-language-selector-option{margin:0;padding:0;list-style:none}.languageselector-button,.languageselector-link{width:100%;padding:1.1rem 1.6rem 1.1rem 1.4rem;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;position:relative;text-decoration:none;border:0;cursor:pointer;background-color:#FFFFFF;color:#005D92;font-size:1.6rem;font-weight:bold;border-radius:0}.languageselector-button:hover,.languageselector-button:focus,.languageselector-button:active,.languageselector-link:hover,.languageselector-link:focus,.languageselector-link:active{color:#0D234B;text-decoration:underline;-webkit-box-shadow:none;box-shadow:none;background-color:#F3F2F2;color:#005D92;outline:none}.languageselector-itemtext{display:inline-block;margin-left:1rem}.languageselector-radio-outer{background:#fff;border:0.1em solid #D3CECB;border-radius:50%;height:1.5em;width:1.5em;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;-webkit-transition:border 0.2s ease-in-out, background-color 0.2s ease-in-out, -webkit-box-shadow 0.1s;transition:border 0.2s ease-in-out, background-color 0.2s ease-in-out, -webkit-box-shadow 0.1s;transition:border 0.2s ease-in-out, background-color 0.2s ease-in-out, box-shadow 0.1s;transition:border 0.2s ease-in-out, background-color 0.2s ease-in-out, box-shadow 0.1s, -webkit-box-shadow 0.1s;cursor:pointer}.languageselector-radio-outer:focus>.languageselector-radio-outer,.languageselector-radio-outer:active>.languageselector-radio-outer{-webkit-box-shadow:0 0 0 0.1rem white, 0 0 0 0.3rem #005D92;box-shadow:0 0 0 0.1rem white, 0 0 0 0.3rem #005D92}.languageselector-radio-outer:hover>.languageselector-radio-outer{border:0.1rem solid #005D92;background:#E0F8FF}[selected=true] .languageselector-radio-outer{border:0.1rem solid #005D92}.languageselector-radio-inner{-webkit-transform:scale(0);transform:scale(0);height:1em;width:1em;background-color:#005D92;border-radius:50%;-webkit-transform-origin:center center;transform-origin:center center;-webkit-transition:-webkit-transform 0.1s cubic-bezier(0.64, 0.01, 0.67, 0.92);transition:-webkit-transform 0.1s cubic-bezier(0.64, 0.01, 0.67, 0.92);transition:transform 0.1s cubic-bezier(0.64, 0.01, 0.67, 0.92);transition:transform 0.1s cubic-bezier(0.64, 0.01, 0.67, 0.92), -webkit-transform 0.1s cubic-bezier(0.64, 0.01, 0.67, 0.92)}[selected=true] .languageselector-radio-inner{-webkit-transform:scale(1);transform:scale(1)}";
|
|
2326
|
+
|
|
2327
|
+
const PnlanguageSelectorOption = class extends HTMLElement {
|
|
2328
|
+
constructor() {
|
|
2329
|
+
super();
|
|
2330
|
+
this.__registerHost();
|
|
2331
|
+
this.setCurrentLanguage = createEvent(this, "setCurrentLanguage", 7);
|
|
2332
|
+
/** What you write in the comment block above each prop is what ends up in the description fields in the prop table in the documentation */
|
|
2333
|
+
this.name = "";
|
|
2334
|
+
this.code = "";
|
|
2335
|
+
this.url = "";
|
|
2336
|
+
this.selected = false;
|
|
2337
|
+
}
|
|
2338
|
+
onOptionClick() {
|
|
2339
|
+
const currentlanguage = {
|
|
2340
|
+
name: this.name,
|
|
2341
|
+
code: this.code,
|
|
2342
|
+
url: this.url,
|
|
2343
|
+
current: true
|
|
2344
|
+
};
|
|
2345
|
+
this.setCurrentLanguage.emit(currentlanguage);
|
|
2346
|
+
}
|
|
2347
|
+
render() {
|
|
2348
|
+
return (h(Host, { role: "listitem", selected: (this.selected) + '', code: this.code, name: this.name }, !this.url ? (h("button", { class: "languageselector-button", "data-langcode": this.code, onClick: this.onOptionClick.bind(this) }, h("span", { class: "languageselector-radio-outer" }, h("span", { class: "languageselector-radio-inner" })), h("span", { class: "languageselector-itemtext" }, this.name, " - ", this.code))) : (h("a", { href: this.url, target: "_self", class: "languageselector-link", "data-langcode": this.code }, h("span", { class: "languageselector-radio-outer" }, h("span", { class: "languageselector-radio-inner" })), h("span", { class: "languageselector-itemtext" }, this.name, " - ", this.code)))));
|
|
2349
|
+
}
|
|
2350
|
+
static get style() { return pnLanguageSelectorOptionCss; }
|
|
2351
|
+
};
|
|
2352
|
+
|
|
2353
|
+
const translations$3 = {
|
|
2354
|
+
'sv': {
|
|
2355
|
+
"menuHomeButton": "Hem",
|
|
2356
|
+
"menuGoBackButton": "Gå tillbaka",
|
|
2357
|
+
"mainMenuButton": "Meny",
|
|
2358
|
+
"menuStartButton": "Start"
|
|
2359
|
+
},
|
|
2360
|
+
'en': {
|
|
2361
|
+
"menuHomeButton": "Home",
|
|
2362
|
+
"menuGoBackButton": "Go back",
|
|
2363
|
+
"mainMenuButton": "Menu",
|
|
2364
|
+
"menuStartButton": "Start"
|
|
2365
|
+
},
|
|
2366
|
+
'da': {
|
|
2367
|
+
"menuHomeButton": "Hjem",
|
|
2368
|
+
"menuGoBackButton": "Gå tilbage",
|
|
2369
|
+
"mainMenuButton": "Menu",
|
|
2370
|
+
"menuStartButton": "Start"
|
|
2371
|
+
},
|
|
2372
|
+
'no': {
|
|
2373
|
+
"menuHomeButton": "Hjem",
|
|
2374
|
+
"menuGoBackButton": "Gå tilbake",
|
|
2375
|
+
"mainMenuButton": "Meny",
|
|
2376
|
+
"menuStartButton": "Start"
|
|
2377
|
+
},
|
|
2378
|
+
'fi': {
|
|
2379
|
+
"menuHomeButton": "Koti",
|
|
2380
|
+
"menuGoBackButton": "Mene takaisin",
|
|
2381
|
+
"mainMenuButton": "Valikko",
|
|
2382
|
+
"menuStartButton": "Alkaa"
|
|
2383
|
+
}
|
|
2384
|
+
};
|
|
2385
|
+
|
|
2386
|
+
// Read more about how stencil stores work here: https://stenciljs.com/docs/stencil-store
|
|
2387
|
+
const { state: state$1, onChange: onChange$1 } = createStore({
|
|
2388
|
+
openLevel: '',
|
|
2389
|
+
openMenu: false,
|
|
2390
|
+
i18n: {
|
|
2391
|
+
menuHomeButton: '',
|
|
2392
|
+
menuGoBackButton: '',
|
|
2393
|
+
mainMenuButton: '',
|
|
2394
|
+
menuStartButton: ''
|
|
2395
|
+
}
|
|
2396
|
+
});
|
|
2397
|
+
|
|
2398
|
+
const pnMainnavCss = "pn-mainnav{display:-ms-flexbox;display:flex;-ms-flex-flow:row-reverse;flex-flow:row-reverse;position:relative;width:100%;min-height:5.1rem}@media screen and (min-width: 48em){pn-mainnav{-ms-flex-flow:row;flex-flow:row}}@media screen and (min-width: 64em){pn-mainnav{-ms-flex-flow:column;flex-flow:column}}@media screen and (min-width: 64em){pn-mainnav [slot=footer]{display:none}}pn-mainnav>nav{height:auto;width:100vw;background-color:#FFFFFF;z-index:2;-webkit-transform:translateX(100vw);transform:translateX(100vw);-webkit-transition:-webkit-transform 0.2s 0s;transition:-webkit-transform 0.2s 0s;transition:transform 0.2s 0s;transition:transform 0.2s 0s, -webkit-transform 0.2s 0s;-webkit-transition-property:visibility, -webkit-transform;transition-property:visibility, -webkit-transform;transition-property:transform, visibility;transition-property:transform, visibility, -webkit-transform;display:-ms-flexbox;display:flex;-ms-flex-flow:column;flex-flow:column;visibility:hidden;position:fixed;top:3em;bottom:0;left:0}@media screen and (min-width: 48em){pn-mainnav>nav{top:6.3em}}pn-mainnav>nav[data-menu-open=true]{visibility:visible;-webkit-transform:translateX(0);transform:translateX(0)}@media screen and (min-width: 64em){pn-mainnav>nav{-ms-flex-flow:row-reverse;flex-flow:row-reverse;top:0;position:static;height:auto;width:100%;-ms-flex-pack:justify;justify-content:space-between;visibility:visible;-webkit-transform:translateX(0);transform:translateX(0)}}pn-mainnav>nav a{text-decoration:none}pn-mainnav>nav button{cursor:pointer}.mainnav-toggle{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-item-align:center;align-self:center}@media screen and (min-width: 64em){.mainnav-toggle{display:none}}.mainnav-toggle>button{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;background-color:#005D92;color:#FFFFFF;border-radius:2.4rem;border:none;padding:0.6rem 1.6rem;cursor:pointer;font-size:1.6rem}.mainnav-toggle>button:focus{outline:0}.mainnav-toggle>button pn-icon{margin-left:0.8rem;display:block}.mainnav-toggle>button svg{display:block;margin:-0.2rem -0.5rem -0.2rem 0;height:1.9rem;width:1.9rem}";
|
|
2399
|
+
|
|
2400
|
+
const PnMainnav$1 = class extends HTMLElement {
|
|
2401
|
+
constructor() {
|
|
2402
|
+
super();
|
|
2403
|
+
this.__registerHost();
|
|
2404
|
+
this.menuLanguageChange = createEvent(this, "menuLanguageChange", 7);
|
|
2405
|
+
this.marketChange = createEvent(this, "marketChange", 7);
|
|
2406
|
+
/** Specifies which market we want to fetch navigation for (se,dk,fi,no,com) */
|
|
2407
|
+
this.market = "se";
|
|
2408
|
+
/** Specifies which language we want to show navigation in (sv,da,fi,no,en) */
|
|
2409
|
+
this.language = "sv";
|
|
2410
|
+
/** Specifies which endpoint we should read information from */
|
|
2411
|
+
this.navigationId = "mainnav";
|
|
2412
|
+
/** Specifies which endpoint we should read information from */
|
|
2413
|
+
this.openMenu = false;
|
|
2414
|
+
}
|
|
2415
|
+
componentWillLoad() {
|
|
2416
|
+
this.init();
|
|
2417
|
+
document.removeEventListener("mousedown", this._onClickOutside.bind(this));
|
|
2418
|
+
document.addEventListener("mousedown", this._onClickOutside.bind(this));
|
|
2419
|
+
}
|
|
2420
|
+
async init() {
|
|
2421
|
+
this.setLanguage();
|
|
2422
|
+
this.setMarket();
|
|
2423
|
+
}
|
|
2424
|
+
_onClickOutside(event) {
|
|
2425
|
+
const clickedOutside = !this.hostElement.contains(event.target);
|
|
2426
|
+
if (clickedOutside) {
|
|
2427
|
+
state$1.openLevel = "";
|
|
2428
|
+
}
|
|
2429
|
+
}
|
|
2430
|
+
setLanguage() {
|
|
2431
|
+
this.menuLanguageChange.emit(this.language);
|
|
2432
|
+
}
|
|
2433
|
+
setMarket() {
|
|
2434
|
+
this.marketChange.emit(this.market);
|
|
2435
|
+
}
|
|
2436
|
+
onLanguageChange(event) {
|
|
2437
|
+
if (translations$3[event.detail]) {
|
|
2438
|
+
state$1.i18n = translations$3[event.detail];
|
|
2439
|
+
}
|
|
2440
|
+
}
|
|
2441
|
+
setOpenMenu() {
|
|
2442
|
+
state$1.openMenu = (!state$1.openMenu);
|
|
2443
|
+
}
|
|
2444
|
+
onOpenMenuLevelChange(event) {
|
|
2445
|
+
state$1.openLevel = event.detail;
|
|
2446
|
+
}
|
|
2447
|
+
render() {
|
|
2448
|
+
return (h(Host, null, h("div", { class: "mainnav-toggle" }, h("button", { "aria-controls": this.navigationId, "aria-expanded": state$1.openMenu + '', onClick: this.setOpenMenu.bind(this) }, state$1.i18n.mainMenuButton, h("pn-icon", { symbol: state$1.openMenu ? "close" : "bars", color: "white" }))), h("nav", { class: "mainnav", role: "navigation", "data-menu-open": state$1.openMenu + '', id: this.navigationId }, h("slot", null))));
|
|
2449
|
+
}
|
|
2450
|
+
get hostElement() { return this; }
|
|
2451
|
+
static get style() { return pnMainnavCss; }
|
|
2452
|
+
};
|
|
2453
|
+
|
|
2454
|
+
const pnMainnavLevelCss = "pn-mainnav-level{display:block}pn-mainnav-level[data-level=\"1\"]{width:100%;right:0;overflow-y:scroll;overflow-x:hidden;-ms-flex:1;flex:1}@media screen and (min-width: 64em){pn-mainnav-level[data-level=\"1\"]{width:auto;overflow:initial}pn-mainnav-level[data-level=\"1\"]::-webkit-scrollbar{display:none}}pn-mainnav-level[data-level=\"2\"]{position:absolute;top:0;bottom:0;left:0;width:100vw;padding:0;background-color:#FFFFFF;z-index:1;-webkit-transform:translateX(100vw);transform:translateX(100vw);-webkit-transition:-webkit-transform 0.2s 0s;transition:-webkit-transform 0.2s 0s;transition:transform 0.2s 0s;transition:transform 0.2s 0s, -webkit-transform 0.2s 0s;-webkit-transition-property:visibility, -webkit-transform;transition-property:visibility, -webkit-transform;transition-property:transform, visibility;transition-property:transform, visibility, -webkit-transform;overflow:scroll;visibility:hidden}@media screen and (min-width: 64em){pn-mainnav-level[data-level=\"2\"]{left:0;top:calc(100% + 1rem);bottom:auto;border-radius:1.6rem;width:auto;padding:1.6rem 1.6rem 0 1.6rem;-webkit-box-shadow:0 0.06rem 0.18rem rgba(0, 0, 0, 0.1), 0 0.32rem 0.72rem rgba(0, 0, 0, 0.13);-moz-box-shadow:0 0.06rem 0.18rem rgba(0, 0, 0, 0.1), 0 0.32rem 0.72rem rgba(0, 0, 0, 0.13);box-shadow:0 0.06rem 0.18rem rgba(0, 0, 0, 0.1), 0 0.32rem 0.72rem rgba(0, 0, 0, 0.13);height:auto;z-index:3;display:none}pn-mainnav-level[data-level=\"2\"][data-menuitem-rightaligned=true]{right:0;left:unset}}@media screen and (max-height: 33.125em){pn-mainnav-level[data-level=\"2\"]{-ms-overflow-style:none;scrollbar-width:none}pn-mainnav-level[data-level=\"2\"]::-webkit-scrollbar{display:none}}pn-mainnav-level[data-level=\"2\"][aria-hidden=false]{-webkit-transform:translateX(0);transform:translateX(0);visibility:visible}@media screen and (min-width: 64em){pn-mainnav-level[data-level=\"2\"][aria-hidden=false]{display:block;overflow:visible}pn-mainnav-level[data-level=\"2\"][aria-hidden=false]:not([data-level-listcount=\"1\"]){display:grid;grid-template-columns:minmax(12em, 20em) 1fr;grid-template-rows:auto auto;gap:0px 1.6rem;grid-template-areas:\"top top\" \"left right\"}}@media screen and (min-width: 64em){pn-mainnav-level[data-level=\"2\"][data-level-alignment=left]{right:0;left:unset}}@media screen and (min-width: 64em){pn-mainnav-level[data-level=\"2\"][data-level-alignment=center]{left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%)}}pn-mainnav-level[data-level=\"2\"] a{color:#005D92;text-decoration:none}.mainnav-level-header{grid-area:top}.mainnav-level-header>label{position:absolute;width:0.1rem;height:0.1rem;padding:0;margin:-0.1rem;overflow:hidden;clip:rect(0, 0, 0, 0);border:0;white-space:nowrap}.mainnav-level-header>button{display:block;position:relative;border:none;background-color:transparent;color:#005D92;padding:2.4rem 0 2.4rem 6.2rem;width:100%;text-align:left}@media screen and (min-width: 64em){.mainnav-level-header>button{display:none;speak:none}}.mainnav-level-header>button>pn-icon{speak:none;position:absolute;height:2.4rem;width:2.4rem;left:3rem;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%)}[data-level=\"2\"] .mainnav-level-header>pn-mainnav-link>a{font-size:2.4rem}";
|
|
2455
|
+
|
|
2456
|
+
const PnMainnavLevel$1 = class extends HTMLElement {
|
|
2457
|
+
constructor() {
|
|
2458
|
+
super();
|
|
2459
|
+
this.__registerHost();
|
|
2460
|
+
this.level = 1;
|
|
2461
|
+
this.levelId = "";
|
|
2462
|
+
this.isOpen = false;
|
|
2463
|
+
this.parentName = "";
|
|
2464
|
+
this.parentHref = "";
|
|
2465
|
+
this.parentLinkId = "";
|
|
2466
|
+
this.listCount = 0;
|
|
2467
|
+
this.alignment = "right";
|
|
2468
|
+
}
|
|
2469
|
+
async componentWillLoad() {
|
|
2470
|
+
this.listCount = this.hostElement.querySelectorAll(":scope > pn-mainnav-list").length;
|
|
2471
|
+
if (this.hostElement.parentElement.tagName.toLowerCase() !== 'nav') {
|
|
2472
|
+
this.level = 2;
|
|
2473
|
+
}
|
|
2474
|
+
if (this.hostElement.parentElement.tagName.toLowerCase() === 'pn-mainnav-link') {
|
|
2475
|
+
this.parentName = this.hostElement.parentElement.getAttribute('name') + '';
|
|
2476
|
+
this.parentHref = this.hostElement.parentElement.getAttribute('href') + '';
|
|
2477
|
+
this.parentLinkId = this.hostElement.parentElement.getAttribute('linkid') + '';
|
|
2478
|
+
const parentLinkName = this.parentName.toLowerCase().replace(/\W/gi, '_');
|
|
2479
|
+
this.levelId = `mainnav-lvl${this.level}-${parentLinkName}`;
|
|
2480
|
+
}
|
|
2481
|
+
onChange$1("openLevel", () => {
|
|
2482
|
+
this.onChangeOpenLevel();
|
|
2483
|
+
});
|
|
2484
|
+
}
|
|
2485
|
+
onOpen() {
|
|
2486
|
+
if (this.level === 2) {
|
|
2487
|
+
requestAnimationFrame(() => {
|
|
2488
|
+
const levelClientRect = this.hostElement.getClientRects()[0];
|
|
2489
|
+
if (!levelClientRect) {
|
|
2490
|
+
return;
|
|
2491
|
+
}
|
|
2492
|
+
const navElm = this.hostElement.parentElement.parentElement.parentElement.parentElement;
|
|
2493
|
+
if (navElm && navElm.tagName.toLowerCase() === "nav") {
|
|
2494
|
+
const navClientRect = navElm.getClientRects()[0];
|
|
2495
|
+
if (!navClientRect) {
|
|
2496
|
+
return;
|
|
2497
|
+
}
|
|
2498
|
+
if (levelClientRect.right > navClientRect.width) {
|
|
2499
|
+
const levelParentRect = this.hostElement.parentElement.getClientRects()[0];
|
|
2500
|
+
if ((levelParentRect.left - levelClientRect.width) < 0) {
|
|
2501
|
+
this.alignment = "center";
|
|
2502
|
+
}
|
|
2503
|
+
else {
|
|
2504
|
+
this.alignment = "left";
|
|
2505
|
+
}
|
|
2506
|
+
}
|
|
2507
|
+
}
|
|
2508
|
+
});
|
|
2509
|
+
}
|
|
2510
|
+
}
|
|
2511
|
+
onChangeOpenLevel() {
|
|
2512
|
+
this.isOpen = state$1.openLevel === this.levelId;
|
|
2513
|
+
}
|
|
2514
|
+
render() {
|
|
2515
|
+
return (h(Host, Object.assign({ role: "navigation" }, ((this.level > 1 && this.levelId) ? { 'aria-hidden': (!this.isOpen) + '' } : {}), { "data-level-listcount": this.listCount + '', "data-level-alignment": this.alignment, "data-level": this.level + '' }, (this.levelId ? { id: this.levelId } : {})), (this.level > 1) ? (h("div", { class: "mainnav-level-header" }, h("label", { htmlFor: this.levelId }, state$1.i18n.menuGoBackButton), h("button", { class: "secondlevel-backbtn", onClick: () => state$1.openLevel = '', "aria-expanded": (state$1.openLevel === this.levelId) + '' }, h("pn-icon", { symbol: "arrow-left", color: "blue700" }), state$1.i18n.menuStartButton), (this.parentHref && this.parentName) ? h("pn-mainnav-link", { href: this.parentHref, name: this.parentName, linkid: this.parentLinkId }) : null)) : null, h("slot", null), h("slot", { name: "additional" }), h("slot", { name: "footer" })));
|
|
2516
|
+
}
|
|
2517
|
+
get hostElement() { return this; }
|
|
2518
|
+
static get watchers() { return {
|
|
2519
|
+
"isOpen": ["onOpen"]
|
|
2520
|
+
}; }
|
|
2521
|
+
static get style() { return pnMainnavLevelCss; }
|
|
2522
|
+
};
|
|
2523
|
+
|
|
2524
|
+
const pnMainnavLinkCss = "pn-mainnav-link{display:block}pn-mainnav-link button,pn-mainnav-link a{font-weight:normal;position:relative;border:0 none;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;background-color:transparent;color:#005D92}pn-mainnav-link button:hover,pn-mainnav-link button:focus,pn-mainnav-link a:hover,pn-mainnav-link a:focus{background-color:#FFFFFF;color:#005D92;outline:0;-webkit-box-shadow:none;box-shadow:none}pn-mainnav-link button:active,pn-mainnav-link a:active{background-color:#F3F2F2;color:#00A0D6;-webkit-box-shadow:none;box-shadow:none}@media screen and (min-width: 64em){[data-level=\"1\"] pn-mainnav-link{height:100%;padding-left:0;position:relative;scroll-snap-align:center}}[data-level=\"1\"] pn-mainnav-link:first-child{border-top:0.1rem solid #F3F2F2}@media screen and (min-width: 64em){[data-level=\"1\"] pn-mainnav-link:first-child{border:0}}[data-level=\"1\"] pn-mainnav-link>button,[data-level=\"1\"] pn-mainnav-link>a{font-size:2rem;width:100%;border-bottom:0.1rem solid #F3F2F2;height:auto;padding:1.9rem 0 1.9rem 3rem}@media screen and (min-width: 64em){[data-level=\"1\"] pn-mainnav-link>button,[data-level=\"1\"] pn-mainnav-link>a{height:100%;border:0;font-size:1.6rem;font-weight:normal;position:relative;outline:0;overflow:hidden;padding:1.6rem 1.6rem;white-space:nowrap}[data-level=\"1\"] pn-mainnav-link>button::before,[data-level=\"1\"] pn-mainnav-link>a::before{content:\"\";background-color:#00A0D6;position:absolute;bottom:0;left:0;width:100%;height:0.5em;border-radius:0.5em 0.5em 0 0;-webkit-transform:translateY(100%);transform:translateY(100%);-webkit-transition:-webkit-transform 0.1s cubic-bezier(0.64, 0.01, 0.67, 0.92);transition:-webkit-transform 0.1s cubic-bezier(0.64, 0.01, 0.67, 0.92);transition:transform 0.1s cubic-bezier(0.64, 0.01, 0.67, 0.92);transition:transform 0.1s cubic-bezier(0.64, 0.01, 0.67, 0.92), -webkit-transform 0.1s cubic-bezier(0.64, 0.01, 0.67, 0.92)}[data-level=\"1\"] pn-mainnav-link>button:hover::before,[data-level=\"1\"] pn-mainnav-link>button:focus::before,[data-level=\"1\"] pn-mainnav-link>a:hover::before,[data-level=\"1\"] pn-mainnav-link>a:focus::before{-webkit-transform:translateY(0);transform:translateY(0)}[data-level=\"1\"] pn-mainnav-link>button:active,[data-level=\"1\"] pn-mainnav-link>a:active{outline:0;-webkit-box-shadow:none;box-shadow:none;color:#005D92}[data-level=\"1\"] pn-mainnav-link>button:active::before,[data-level=\"1\"] pn-mainnav-link>a:active::before{background-color:#8EDDF9;-webkit-transform:translateY(0);transform:translateY(0)}}@media screen and (min-width: 64em){[data-level=\"1\"] pn-mainnav-link>button:hover,[data-level=\"1\"] pn-mainnav-link>button:focus,[data-level=\"1\"] pn-mainnav-link>a:hover,[data-level=\"1\"] pn-mainnav-link>a:focus{text-decoration:none}}@media screen and (min-width: 64em){[data-level=\"1\"] pn-mainnav-link>button[aria-expanded=true]::before,[data-level=\"1\"] pn-mainnav-link>a[aria-expanded=true]::before{content:\"\";background-color:#00A0D6;position:absolute;bottom:0;left:0;width:100%;height:0.5em;border-radius:0.5em 0.5em 0 0;-webkit-transform:translateY(0);transform:translateY(0);-webkit-transition:-webkit-transform 0.1s cubic-bezier(0.64, 0.01, 0.67, 0.92);transition:-webkit-transform 0.1s cubic-bezier(0.64, 0.01, 0.67, 0.92);transition:transform 0.1s cubic-bezier(0.64, 0.01, 0.67, 0.92);transition:transform 0.1s cubic-bezier(0.64, 0.01, 0.67, 0.92), -webkit-transform 0.1s cubic-bezier(0.64, 0.01, 0.67, 0.92)}}[data-level=\"1\"] pn-mainnav-link [aria-expanded=true] .first-level_icon{-webkit-transform:rotateX(180deg);transform:rotateX(180deg)}[data-level=\"1\"] pn-mainnav-link pn-icon.first-level_icon{-webkit-transition:0.25s linear transform;transition:0.25s linear transform;width:1.92rem;height:1.92rem;display:none}@media screen and (min-width: 64em){[data-level=\"1\"] pn-mainnav-link pn-icon.first-level_icon{display:block}}[data-level=\"1\"] pn-mainnav-link pn-icon.first-level_arrow{display:block;position:absolute;height:2.4rem;width:2.4rem;right:2.4rem;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%)}@media screen and (min-width: 64em){[data-level=\"1\"] pn-mainnav-link pn-icon.first-level_arrow{display:none}}[data-level=\"1\"] pn-mainnav-link pn-icon svg{pointer-events:none;speak:none;width:100%;height:100%}@media screen and (min-width: 64em){pn-mainnav-level[data-level=\"2\"]:not([data-level-listcount=\"1\"]) pn-mainnav-list:last-child pn-mainnav-link>a{min-width:unset}}[data-level=\"2\"] pn-mainnav-link{position:static;display:inline-block;width:100%;height:auto}@media screen and (min-width: 64em){[data-level=\"2\"] pn-mainnav-link{padding-left:0;margin-bottom:1.6rem}}[data-level=\"2\"] pn-mainnav-link>a{font-size:1.6rem;border-bottom:0.1rem solid #F3F2F2;padding:2.2rem 0 2.2rem 3rem;white-space:normal}@media screen and (min-width: 64em){[data-level=\"2\"] pn-mainnav-link>a{min-width:16em;border:0;border-radius:1rem;padding:1.4rem 1.6rem}}[data-level=\"2\"] pn-mainnav-link>a:hover{background-color:#FFFFFF;color:#005D92}[data-level=\"2\"] pn-mainnav-link>a:hover,[data-level=\"2\"] pn-mainnav-link>a:focus{-webkit-box-shadow:none;box-shadow:none}@media screen and (min-width: 64em){[data-level=\"2\"] pn-mainnav-link>a:hover,[data-level=\"2\"] pn-mainnav-link>a:focus{background-color:#F3F2F2;color:#005D92;text-decoration:underline;outline:0}}[data-level=\"2\"] pn-mainnav-link>a:hover::before,[data-level=\"2\"] pn-mainnav-link>a:focus::before{content:none}[data-level=\"2\"] pn-mainnav-link>a:active{-webkit-box-shadow:none;box-shadow:none}@media screen and (min-width: 64em){[data-level=\"2\"] pn-mainnav-link>a:active{background-color:#F3F2F2;color:#00A0D6;outline:0}}[data-level=\"2\"] pn-mainnav-link>a:active::before{content:none}[data-level=\"2\"] pn-mainnav-link pn-icon{display:inline-block;margin-left:0.2em;min-width:1.5rem;width:1.5rem;height:1.5rem}";
|
|
2525
|
+
|
|
2526
|
+
const PnMainnavLink$1 = class extends HTMLElement {
|
|
2527
|
+
constructor() {
|
|
2528
|
+
super();
|
|
2529
|
+
this.__registerHost();
|
|
2530
|
+
/** Name */
|
|
2531
|
+
this.name = "";
|
|
2532
|
+
/** Href */
|
|
2533
|
+
this.href = "";
|
|
2534
|
+
/** Target */
|
|
2535
|
+
this.target = "";
|
|
2536
|
+
/** Link id */
|
|
2537
|
+
this.linkid = "";
|
|
2538
|
+
/** Level ID that we control toggle on */
|
|
2539
|
+
this.levelId = "";
|
|
2540
|
+
/** Menu item is open */
|
|
2541
|
+
this.open = false;
|
|
2542
|
+
this.hasChildren = false;
|
|
2543
|
+
}
|
|
2544
|
+
componentWillLoad() {
|
|
2545
|
+
this.hasChildren = this.hostElement.querySelectorAll("pn-mainnav-level").length > 0;
|
|
2546
|
+
if (this.hasChildren && this.name) {
|
|
2547
|
+
const safeLevelName = this.name.toLowerCase().replace(/\W/gi, '_');
|
|
2548
|
+
this.levelId = `mainnav-lvl${2}-${safeLevelName}`;
|
|
2549
|
+
}
|
|
2550
|
+
}
|
|
2551
|
+
setOpenMenuLevel() {
|
|
2552
|
+
state$1.openLevel = (state$1.openLevel + "" === this.levelId + "") ? '' : this.levelId;
|
|
2553
|
+
}
|
|
2554
|
+
render() {
|
|
2555
|
+
return (h(Host, { role: "listitem", name: this.name, href: this.href, linkid: this.linkid }, this.hasChildren ? (h("button", { onClick: this.setOpenMenuLevel.bind(this), "aria-controls": this.levelId, "aria-pressed": "", "aria-expanded": ((state$1.openLevel + "" === this.levelId + "")) + '' }, this.name, h("pn-icon", { class: "first-level_icon", symbol: "angle-small-down", color: "blue700" }), h("pn-icon", { class: "first-level_arrow", symbol: "arrow-right", color: "blue700" }))) : (h("a", Object.assign({ href: this.href }, (this.target ? { target: this.target } : {}), (this.linkid ? { id: this.linkid } : {})), this.name, this.target === "_blank" ? (h("pn-icon", { symbol: "open-in-new", color: "blue700" })) : null)), h("slot", null)));
|
|
2556
|
+
}
|
|
2557
|
+
get hostElement() { return this; }
|
|
2558
|
+
static get style() { return pnMainnavLinkCss; }
|
|
2559
|
+
};
|
|
2560
|
+
|
|
2561
|
+
const pnMainnavListCss = "pn-mainnav-list{display:block;overflow:visible;list-style:none;margin:0;padding:0;grid-area:right}@media screen and (min-width: 64em){pn-mainnav-list+pn-mainnav-list{grid-area:left;border-right:0.1rem solid #D3CECB;margin-bottom:1.6rem;margin-right:-0.7rem;padding-right:0.7rem}}[data-level=\"1\"]>pn-mainnav-list{overflow:scroll;-webkit-overflow-scrolling:touch}@media screen and (min-width: 64em){[data-level=\"1\"]>pn-mainnav-list{height:100%;display:-ms-flexbox;display:flex;-ms-flex-flow:row;flex-flow:row;overflow:visible;padding:0}}@media screen and (min-width: 64em){[data-level=\"2\"]>pn-mainnav-list[data-navlist-showcolumns=true]{-webkit-column-count:2;-moz-column-count:2;column-count:2;-webkit-column-gap:1.6rem;-moz-column-gap:1.6rem;column-gap:1.6rem;padding-bottom:1.6rem}}.mainnav-list-heading{display:none;font-weight:bold;-webkit-column-span:all;-moz-column-span:all;column-span:all;font-size:1.8rem;padding:1.4rem 1.4rem 1.4rem 4.8rem}@media screen and (min-width: 64em){.mainnav-list-heading{display:block;padding:0 1.4rem 1.4rem 1.4rem}}";
|
|
2562
|
+
|
|
2563
|
+
const PnMainnavList$1 = class extends HTMLElement {
|
|
2564
|
+
constructor() {
|
|
2565
|
+
super();
|
|
2566
|
+
this.__registerHost();
|
|
2567
|
+
this.heading = "";
|
|
2568
|
+
this.linkCount = 0;
|
|
2569
|
+
}
|
|
2570
|
+
componentWillLoad() {
|
|
2571
|
+
this.linkCount = this.hostElement.querySelectorAll(":scope > pn-mainnav-link").length;
|
|
2572
|
+
}
|
|
2573
|
+
render() {
|
|
2574
|
+
return (h(Host, { class: "mainnav-list", role: "list", "data-navlist-itemcount": this.linkCount + '', "data-navlist-showcolumns": (this.linkCount >= 8) + '' }, (this.heading) ? h("div", { class: "mainnav-list-heading" }, this.heading) : null, h("slot", null)));
|
|
2575
|
+
}
|
|
2576
|
+
get hostElement() { return this; }
|
|
2577
|
+
static get style() { return pnMainnavListCss; }
|
|
2578
|
+
};
|
|
2579
|
+
|
|
2580
|
+
const translations$2 = {
|
|
2581
|
+
'sv': {
|
|
2582
|
+
"searchlabel": "Sök",
|
|
2583
|
+
"searchplaceholder": "Vad letar du efter?",
|
|
2584
|
+
"searchbuttontext": "Sök",
|
|
2585
|
+
"menuHomeButton": "Hem",
|
|
2586
|
+
"menuGoBackButton": "Gå tillbaka",
|
|
2587
|
+
"mainMenuButton": "Meny",
|
|
2588
|
+
"menuStartButton": "Start"
|
|
2589
|
+
},
|
|
2590
|
+
'en': {
|
|
2591
|
+
"searchlabel": "Search",
|
|
2592
|
+
"searchplaceholder": "Search",
|
|
2593
|
+
"searchbuttontext": "Search",
|
|
2594
|
+
"menuHomeButton": "Home",
|
|
2595
|
+
"menuGoBackButton": "Go back",
|
|
2596
|
+
"mainMenuButton": "Menu",
|
|
2597
|
+
"menuStartButton": "Start"
|
|
2598
|
+
},
|
|
2599
|
+
'da': {
|
|
2600
|
+
"searchlabel": "Søg",
|
|
2601
|
+
"searchplaceholder": "Søg",
|
|
2602
|
+
"searchbuttontext": "Søg",
|
|
2603
|
+
"menuHomeButton": "Hjem",
|
|
2604
|
+
"menuGoBackButton": "Gå tilbage",
|
|
2605
|
+
"mainMenuButton": "Menu",
|
|
2606
|
+
"menuStartButton": "Start"
|
|
2607
|
+
},
|
|
2608
|
+
'no': {
|
|
2609
|
+
"searchlabel": "Søk",
|
|
2610
|
+
"searchplaceholder": "Søk",
|
|
2611
|
+
"searchbuttontext": "Søk",
|
|
2612
|
+
"menuHomeButton": "Hjem",
|
|
2613
|
+
"menuGoBackButton": "Gå tilbake",
|
|
2614
|
+
"mainMenuButton": "Meny",
|
|
2615
|
+
"menuStartButton": "Start"
|
|
2616
|
+
},
|
|
2617
|
+
'fi': {
|
|
2618
|
+
"searchlabel": "Hae",
|
|
2619
|
+
"searchplaceholder": "Hae",
|
|
2620
|
+
"searchbuttontext": "Hae",
|
|
2621
|
+
"menuHomeButton": "Koti",
|
|
2622
|
+
"menuGoBackButton": "Mene takaisin",
|
|
2623
|
+
"mainMenuButton": "Valikko",
|
|
2624
|
+
"menuStartButton": "Alkaa"
|
|
2625
|
+
}
|
|
2626
|
+
};
|
|
2627
|
+
|
|
2628
|
+
const pnMarketwebSitefooterCss = "";
|
|
2629
|
+
|
|
2630
|
+
const PnMarketwebSiteheader$2 = class extends HTMLElement {
|
|
2631
|
+
constructor() {
|
|
2632
|
+
super();
|
|
2633
|
+
this.__registerHost();
|
|
2634
|
+
this.endpointPath = "/api/footer/footer";
|
|
2635
|
+
/** Specifies which market we want to show (se,dk,fi,no,com) */
|
|
2636
|
+
this.market = "se";
|
|
2637
|
+
/** Specifies which language we want to show (sv,da,fi,no,en) */
|
|
2638
|
+
this.language = "sv";
|
|
2639
|
+
/** Specifies which endpoint domain we should load from */
|
|
2640
|
+
this.endpoint = "";
|
|
2641
|
+
this.gotData = false;
|
|
2642
|
+
this.fetchingData = false;
|
|
2643
|
+
}
|
|
2644
|
+
componentWillLoad() {
|
|
2645
|
+
this.setTranslations();
|
|
2646
|
+
this.init();
|
|
2647
|
+
}
|
|
2648
|
+
async init() {
|
|
2649
|
+
await this.fetchData();
|
|
2650
|
+
}
|
|
2651
|
+
setTranslations() {
|
|
2652
|
+
if (translations$2[this.language]) {
|
|
2653
|
+
this.i18n = translations$2[this.language];
|
|
2654
|
+
}
|
|
2655
|
+
}
|
|
2656
|
+
async fetchData() {
|
|
2657
|
+
this.fetchingData = true;
|
|
2658
|
+
const endpointBase = (this.endpoint.lastIndexOf("/") === this.endpoint.length - 1) ? this.endpoint.substring(0, this.endpoint.length - 1) : this.endpoint;
|
|
2659
|
+
const response = await fetch(`${endpointBase}${this.endpointPath}?market=${this.market}&language=${this.language}`);
|
|
2660
|
+
const data = await response.json();
|
|
2661
|
+
this.setStateFromData(data);
|
|
2662
|
+
}
|
|
2663
|
+
getLinkContentByType(linkType = "") {
|
|
2664
|
+
switch (linkType) {
|
|
2665
|
+
case "facebook":
|
|
2666
|
+
return `<svg width="56" height="56" viewBox="0 0 56 56" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2667
|
+
<circle cx="28" cy="28" r="28" fill="#005D92" />
|
|
2668
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M38.6754 16H17.3246C16.593 16 16 16.5929 16 17.3246V38.6754C16 39.407 16.593 40 17.3246 40H28.8191V30.706H25.6915V27.0839H28.8191V24.4127C28.8191 21.3128 30.7124 19.6248 33.4778 19.6248C34.8023 19.6248 35.9409 19.7235 36.2726 19.7675V23.0071L34.3547 23.008C32.8507 23.008 32.5596 23.7226 32.5596 24.7713V27.0839H36.1463L35.6793 30.706H32.5596V40H38.6754C39.407 40 40 39.407 40 38.6754V17.3246C40 16.5929 39.407 16 38.6754 16Z" fill="white" />
|
|
2669
|
+
</svg>`;
|
|
2670
|
+
case "twitter":
|
|
2671
|
+
return `<svg width="56" height="56" viewBox="0 0 56 56" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2672
|
+
<circle cx="28" cy="28" r="28" fill="#005D92" />
|
|
2673
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M41.3337 19.8587C40.3525 20.2871 39.2981 20.5766 38.1914 20.7068C39.321 20.0402 40.1884 18.9847 40.5969 17.7272C39.5399 18.3443 38.369 18.7925 37.1228 19.0341C36.1248 17.9874 34.7029 17.3333 33.1294 17.3333C30.1079 17.3333 27.6583 19.7446 27.6583 22.7188C27.6583 23.1409 27.7067 23.552 27.8 23.9461C23.253 23.7216 19.2218 21.5775 16.5234 18.3191C16.0525 19.1146 15.7827 20.0397 15.7827 21.0267C15.7827 22.8951 16.7486 24.5436 18.2166 25.5093C17.3197 25.4814 16.4762 25.2391 15.7385 24.8358C15.7381 24.8582 15.7381 24.8808 15.7381 24.9035C15.7381 27.5129 17.6239 29.6896 20.1267 30.1843C19.6676 30.3074 19.1843 30.3732 18.6853 30.3732C18.3328 30.3732 17.99 30.3395 17.656 30.2766C18.3522 32.4163 20.3726 33.9733 22.7667 34.0168C20.8943 35.4612 18.5353 36.3222 15.9721 36.3222C15.5305 36.3222 15.095 36.2968 14.667 36.2471C17.0881 37.7751 19.9639 38.6666 23.0535 38.6666C33.1166 38.6666 38.6195 30.4602 38.6195 23.3433C38.6195 23.1098 38.6142 22.8776 38.6037 22.6466C39.6725 21.8873 40.6002 20.9387 41.3337 19.8587Z" fill="white" />
|
|
2674
|
+
</svg>`;
|
|
2675
|
+
case "linkedin":
|
|
2676
|
+
return `<svg width="56" height="56" viewBox="0 0 56 56" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2677
|
+
<circle cx="28" cy="28" r="28" fill="#005D92" />
|
|
2678
|
+
<path d="M37.5809 16H18.4191C17.0832 16 16 17.0747 16 18.399V37.601C16 38.9267 17.0832 40 18.4191 40H37.5809C38.9182 40 40 38.9253 40 37.601V18.399C40 17.0747 38.9182 16 37.5809 16ZM23.7013 34.9895H20.4725V24.7229H23.7013V34.9895ZM22.0653 23.4634C21.0462 23.4634 20.3874 22.7487 20.3874 21.8672C20.3874 20.965 21.0672 20.2711 22.1085 20.2711C23.1499 20.2711 23.7864 20.9636 23.8074 21.8672C23.8074 22.7501 23.1485 23.4634 22.0653 23.4634ZM35.4912 34.9895H32.2624V29.3002C32.2624 27.9772 31.7948 27.075 30.6264 27.075C29.7344 27.075 29.204 27.6834 28.9695 28.2711C28.8843 28.4808 28.8634 28.7746 28.8634 29.0685V34.9881H25.6332V27.9979C25.6332 26.7177 25.5913 25.6472 25.5481 24.7229H28.3525L28.5018 26.1507H28.566C28.9904 25.4789 30.0318 24.4925 31.7739 24.4925C33.8984 24.4925 35.4912 25.8996 35.4912 28.9222V34.9895Z" fill="white" />
|
|
2679
|
+
</svg>`;
|
|
2680
|
+
case "instagram":
|
|
2681
|
+
return `<svg width="56" height="56" viewBox="0 0 56 56" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2682
|
+
<circle cx="28" cy="28" r="28" fill="#005D92" />
|
|
2683
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M27.9995 18.1621C31.2037 18.1621 31.5829 18.1745 32.8485 18.2321C34.0183 18.2854 34.6538 18.4807 35.0767 18.6451C35.6369 18.8628 36.0365 19.1228 36.4566 19.5425C36.8768 19.9626 37.1368 20.3623 37.354 20.9224C37.5184 21.3454 37.7137 21.9808 37.767 23.1507C37.8246 24.4158 37.837 24.7955 37.837 27.9998C37.837 31.204 37.8246 31.5832 37.767 32.8488C37.7137 34.0187 37.5184 34.6541 37.354 35.0771C37.1363 35.6373 36.8763 36.0369 36.4566 36.457C36.0365 36.8772 35.6369 37.1372 35.0767 37.3545C34.6538 37.5188 34.0183 37.7141 32.8485 37.7674C31.5834 37.8251 31.2037 37.8375 27.9995 37.8375C24.7953 37.8375 24.4157 37.8251 23.1506 37.7674C21.9807 37.7141 21.3453 37.5188 20.9223 37.3545C20.3622 37.1368 19.9625 36.8767 19.5424 36.457C19.1223 36.0369 18.8622 35.6373 18.645 35.0771C18.4807 34.6541 18.2854 34.0187 18.232 32.8488C18.1744 31.5837 18.162 31.204 18.162 27.9998C18.162 24.7955 18.1744 24.4163 18.232 23.1507C18.2854 21.9808 18.4807 21.3454 18.645 20.9224C18.8627 20.3623 19.1228 19.9626 19.5424 19.5425C19.9625 19.1224 20.3622 18.8623 20.9223 18.6451C21.3453 18.4807 21.9807 18.2854 23.1506 18.2321C24.4161 18.1745 24.7953 18.1621 27.9995 18.1621ZM27.9995 16C24.7405 16 24.3318 16.0138 23.052 16.0724C21.7749 16.1305 20.9028 16.3334 20.1392 16.6302C19.35 16.9369 18.6807 17.3471 18.0139 18.0144C17.347 18.6813 16.9365 19.3505 16.6302 20.1393C16.3334 20.9029 16.1305 21.7751 16.0724 23.0521C16.0138 24.332 16 24.7407 16 27.9998C16 31.2588 16.0138 31.6675 16.0724 32.9474C16.1305 34.2245 16.3334 35.0966 16.6302 35.8602C16.9369 36.6495 17.347 37.3187 18.0144 37.9856C18.6817 38.6529 19.3505 39.0631 20.1397 39.3698C20.9028 39.6666 21.7754 39.8695 23.0524 39.9276C24.3323 39.9862 24.741 40 28 40C31.259 40 31.6677 39.9862 32.9476 39.9276C34.2246 39.8695 35.0972 39.6666 35.8603 39.3698C36.6495 39.0631 37.3188 38.6529 37.9856 37.9856C38.653 37.3182 39.0631 36.6495 39.3698 35.8602C39.6666 35.0971 39.8695 34.2245 39.9276 32.9474C39.9862 31.6675 40 31.2588 40 27.9998C40 24.7407 39.9862 24.332 39.9276 23.0521C39.8695 21.7751 39.6666 20.9024 39.3698 20.1393C39.0631 19.35 38.653 18.6808 37.9856 18.0139C37.3183 17.3466 36.6495 16.9365 35.8603 16.6297C35.0963 16.3334 34.2241 16.1305 32.9471 16.0724C31.6672 16.0138 31.2585 16 27.9995 16ZM27.9996 21.8379C24.5963 21.8379 21.8379 24.5969 21.8379 27.9998C21.8379 31.4027 24.5968 34.1616 27.9996 34.1616C31.4025 34.1616 34.1613 31.4027 34.1613 27.9998C34.1613 24.5969 31.4029 21.8379 27.9996 21.8379ZM27.9996 31.9995C25.7904 31.9995 23.9999 30.2085 23.9999 27.9998C23.9999 25.7905 25.7909 24 27.9996 24C30.2083 24 31.9993 25.791 31.9993 27.9998C31.9993 30.209 30.2088 31.9995 27.9996 31.9995ZM35.845 21.594C35.845 22.3892 35.2003 23.0339 34.4051 23.0339C33.6098 23.0339 32.9651 22.3892 32.9651 21.594C32.9651 20.7987 33.6098 20.154 34.4051 20.154C35.2003 20.154 35.845 20.7987 35.845 21.594Z" fill="white" />
|
|
2684
|
+
</svg>`;
|
|
2685
|
+
default:
|
|
2686
|
+
return "";
|
|
2687
|
+
}
|
|
2688
|
+
}
|
|
2689
|
+
setStateFromData(data) {
|
|
2690
|
+
if (typeof data !== "object") {
|
|
2691
|
+
console.warn('Data was not valid', data);
|
|
2692
|
+
}
|
|
2693
|
+
// Set site definition
|
|
2694
|
+
this.siteDefinition = data.sitedefinition;
|
|
2695
|
+
// Set footer content
|
|
2696
|
+
this.footerContent = data.footer;
|
|
2697
|
+
this.gotData = true;
|
|
2698
|
+
this.fetchingData = true;
|
|
2699
|
+
}
|
|
2700
|
+
render() {
|
|
2701
|
+
var _a, _b, _c, _d, _e;
|
|
2702
|
+
return (h(Host, null, h("pn-site-footer", { url: (_b = (_a = this.siteDefinition) === null || _a === void 0 ? void 0 : _a.url) !== null && _b !== void 0 ? _b : "" }, (this.gotData && ((_c = this.footerContent) === null || _c === void 0 ? void 0 : _c.columns)) ? this.footerContent.columns.map((column) => (h("pn-site-footer-col", null, h("h3", null, column.heading), column.links ? (h("ul", Object.assign({}, ((column.links && column.links[0] && column.links[0].linkType) && { 'class': 'social-media' })), column.links.map((link) => {
|
|
2703
|
+
var linkText = link.linkText;
|
|
2704
|
+
if (link.linkType) {
|
|
2705
|
+
linkText = this.getLinkContentByType(link.linkType);
|
|
2706
|
+
}
|
|
2707
|
+
return (h("li", null, h("a", Object.assign({ href: link.linkHref }, (link.openInNewWindow && { target: '_blank' }), { title: link.linkText, innerHTML: linkText }))));
|
|
2708
|
+
}))) : null, column.body ? (h("div", { innerHTML: column.body })) : null))) : null, h("div", { slot: "bottom" }, (this.gotData && ((_d = this.footerContent) === null || _d === void 0 ? void 0 : _d.copyrightText)) ? (h("span", null, this.footerContent.copyrightText)) : null, (this.gotData && ((_e = this.footerContent) === null || _e === void 0 ? void 0 : _e.bottomLinks)) ? (h("span", null, this.footerContent.bottomLinks.map((link) => {
|
|
2709
|
+
if (!link.linkHref) {
|
|
2710
|
+
return (h("span", null, link.linkText));
|
|
2711
|
+
}
|
|
2712
|
+
return (h("a", Object.assign({ href: link.linkHref }, (link.openInNewWindow && { target: '_blank' }), { title: link.linkText }), link.linkText));
|
|
2713
|
+
}))) : null))));
|
|
2714
|
+
}
|
|
2715
|
+
get hostElement() { return this; }
|
|
2716
|
+
static get style() { return pnMarketwebSitefooterCss; }
|
|
2717
|
+
};
|
|
2718
|
+
|
|
2719
|
+
const translations$1 = {
|
|
5
2720
|
'sv': {
|
|
6
2721
|
"searchlabel": "Sök",
|
|
7
2722
|
"searchplaceholder": "Vad letar du efter?",
|
|
@@ -49,9 +2764,9 @@ const translations = {
|
|
|
49
2764
|
}
|
|
50
2765
|
};
|
|
51
2766
|
|
|
52
|
-
const
|
|
2767
|
+
const pnMarketwebSiteheaderCss = "pn-marketweb-siteheader{display:block}pn-marketweb-siteheader header{position:relative;z-index:1000;display:-ms-flexbox;display:flex;-ms-flex-flow:column;flex-flow:column;-webkit-box-shadow:0 0.06rem 0.18rem rgba(0, 0, 0, 0.1), 0 0.32rem 0.72rem rgba(0, 0, 0, 0.13);box-shadow:0 0.06rem 0.18rem rgba(0, 0, 0, 0.1), 0 0.32rem 0.72rem rgba(0, 0, 0, 0.13);-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:justify;justify-content:space-between}@media screen and (min-width: 48em){pn-marketweb-siteheader header{-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:initial;justify-content:initial}}pn-marketweb-siteheader .siteheader-row{display:-ms-flexbox;display:flex;-ms-flex-flow:row;flex-flow:row;-ms-flex-align:center;align-items:center;width:100%;padding:0 1.6rem;background:#FFFFFF;min-height:2em}pn-marketweb-siteheader .siteheader-row:not(:last-child){border-bottom:0.1rem solid #F3F2F2}@media screen and (min-width: 48em){pn-marketweb-siteheader .siteheader-row{-ms-flex-pack:justify;justify-content:space-between;min-height:3.2em}}pn-marketweb-siteheader .siteheader-topright{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row}pn-marketweb-siteheader .siteheader-logocontainer{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;position:relative;min-height:3em}@media screen and (min-width: 48em){pn-marketweb-siteheader .siteheader-logocontainer{position:absolute;left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%)}}pn-marketweb-siteheader .siteheader-logolink{height:100%;max-height:6.4rem;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}pn-marketweb-siteheader .siteheader-logolink:hover,pn-marketweb-siteheader .siteheader-logolink:focus,pn-marketweb-siteheader .siteheader-logolink:active{-webkit-box-shadow:none;box-shadow:none}pn-marketweb-siteheader .siteheader-logo{height:2.4rem}pn-marketweb-siteheader .siteheader-row>pn-marketweb-siteheader-search{display:none}@media screen and (min-width: 48em){pn-marketweb-siteheader .siteheader-row>pn-marketweb-siteheader-search{display:block}}pn-marketweb-siteheader pn-spinner{display:none}pn-marketweb-siteheader pn-nav-dropdown:not(.hydrated) .nav-dropdown-content-container{display:none}.siteheader-topleft pn-site-selector{padding:1rem 0;display:none}@media screen and (min-width: 48em){.siteheader-topleft pn-site-selector{display:block}}@media screen and (min-width: 60em){.siteheader-topleft pn-site-selector{margin-left:1.3rem}}.siteheader-topright pn-language-selector{padding:1rem 0;display:none}@media screen and (min-width: 48em){.siteheader-topright pn-language-selector{display:block}}@media screen and (min-width: 60em){.siteheader-topright pn-language-selector{margin-right:1.6rem}}.siteheader-topright pn-marketweb-siteheader-login{display:none}@media screen and (min-width: 48em){.siteheader-topright pn-marketweb-siteheader-login{display:block}}.siteheader-topright pn-marketweb-siteheader-login .pn-nav-dropdown-label{font-size:0}.siteheader-topright pn-marketweb-siteheader-login .pn-nav-dropdown-label pn-icon{font-size:initial}@media screen and (min-width: 60em){.siteheader-topright pn-marketweb-siteheader-login .pn-nav-dropdown-label{font-size:initial}}.siteheader-menu{max-width:100%;width:100%;overflow:visible;overflow-x:clip}@media screen and (min-width: 60em){.siteheader-menu{margin-top:auto}}.siteheader-menu pn-mainnav-link a[target]::after{content:none}.siteheader-menu-footer{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center}.siteheader-menu-footer>*{margin:1.6rem}";
|
|
53
2768
|
|
|
54
|
-
const
|
|
2769
|
+
const PnMarketwebSiteheader$1 = class extends HTMLElement {
|
|
55
2770
|
constructor() {
|
|
56
2771
|
super();
|
|
57
2772
|
this.__registerHost();
|
|
@@ -93,8 +2808,8 @@ const PnSiteheader$1 = class extends HTMLElement {
|
|
|
93
2808
|
window.setTimeout(() => { this.checkMenuOverflow(); }, 50);
|
|
94
2809
|
}
|
|
95
2810
|
setTranslations() {
|
|
96
|
-
if (translations[this.language]) {
|
|
97
|
-
this.i18n = translations[this.language];
|
|
2811
|
+
if (translations$1[this.language]) {
|
|
2812
|
+
this.i18n = translations$1[this.language];
|
|
98
2813
|
}
|
|
99
2814
|
}
|
|
100
2815
|
async fetchData() {
|
|
@@ -172,7 +2887,7 @@ const PnSiteheader$1 = class extends HTMLElement {
|
|
|
172
2887
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
173
2888
|
return (h("header", null, h("div", { class: "siteheader-row" }, h("div", { class: "siteheader-topleft" }, h("slot", { name: "topleft" }), !this.hideSiteSelector &&
|
|
174
2889
|
h("pn-site-selector", { language: this.language }, (this.gotData && ((_a = this.siteSelector) === null || _a === void 0 ? void 0 : _a.currentSiteTitle)) &&
|
|
175
|
-
h("pn-site-selector-item", { heading: this.siteSelector.currentSiteTitle, description: this.siteSelector.currentSiteDescription }), (this.gotData && ((_b = this.siteSelector) === null || _b === void 0 ? void 0 : _b.siteSelections)) && this.siteSelector.siteSelections.map((site) => h("pn-site-selector-item", { heading: site.linkText, description: site.linkDescription, url: site.href, newwindow: site.openInNewWindow })))), h("div", { class: "siteheader-logocontainer" }, h("a", { href: (_d = (_c = this.siteDefinition) === null || _c === void 0 ? void 0 : _c.url) !== null && _d !== void 0 ? _d : document.location.hostname, title: "Home", class: "siteheader-logolink" }, h("svg", { class: "siteheader-logo", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 141.73 26.65" }, h("path", { d: "M108.84,13.35c0,6.34-5.17,9-10,9S89,19.76,89,13.63c0-6.28,5.08-9,10-9S108.84,7.25,108.84,13.35Zm-6.56.18a3.4,3.4,0,1,0-6.8,0,3.29,3.29,0,0,0,3.42,3.41A3.24,3.24,0,0,0,102.28,13.54Zm-83,0c0,4.83-3.32,8.82-8.49,8.82a6.54,6.54,0,0,1-4.65-1.57v5.86H0V5.16H6.17V6.8a6.43,6.43,0,0,1,5.11-2.18C16.41,4.62,19.31,8.58,19.31,13.54Zm-6.53,0A3.27,3.27,0,0,0,9.4,10,3.28,3.28,0,0,0,6,13.54,3.29,3.29,0,0,0,9.4,16.95,3.24,3.24,0,0,0,12.78,13.54Zm103.69,0.27c0-2.54,1.54-3.32,3.6-3.32a6.56,6.56,0,0,1,2.08.3L122.3,5.1a3.92,3.92,0,0,0-1.45-.18c-3.45,0-4.38,2.18-4.38,2.18V5.16H110.3V21.84h6.17v-8ZM141.73,0V21.84h-6.16V20.21a6.43,6.43,0,0,1-5.11,2.18c-5.14,0-8-4-8-8.91s3.32-8.82,8.49-8.82a6.54,6.54,0,0,1,4.65,1.57v-5Zm-6,13.48a3.28,3.28,0,0,0-3.41-3.41A3.24,3.24,0,0,0,129,13.47,3.4,3.4,0,1,0,135.75,13.47ZM81.35,4.62c-3.6,0-4.9,2.18-4.9,2.18V5.16H70.29V21.84h6.16V13.29c0-2.11.79-3.08,2.69-3.08s2.18,1.57,2.18,3.57v8.07h6.22V11.6C87.55,7,85.34,4.62,81.35,4.62ZM64.07,1.42H57.9V21.84h6.16V10.36H67l2.81-5.2H64.07V1.42ZM50.26,11.21c-2-.3-2.87-0.3-2.87-1.09s0.81-.94,2.42-0.94a16.15,16.15,0,0,1,5.11.91L56,5.41a24.56,24.56,0,0,0-6.13-.75c-5.89,0-9,2.27-9,5.89,0,2.81,1.66,4.47,6.53,5.11,2.06,0.27,2.81.39,2.81,1.15s-0.82,1-2.24,1a16.67,16.67,0,0,1-6-1.3L40.77,21.3a22.14,22.14,0,0,0,6.68,1c6.35,0,9.28-2.24,9.28-5.89C56.72,13.54,55.15,12,50.26,11.21ZM40.19,13.35c0,6.34-5.17,9-10,9s-9.82-2.6-9.82-8.73c0-6.28,5.08-9,10-9S40.19,7.25,40.19,13.35Zm-6.56.18a3.4,3.4,0,1,0-6.8,0,3.28,3.28,0,0,0,3.41,3.41A3.24,3.24,0,0,0,33.63,13.54Z", fill: "#00A0D6", transform: "translate(0 0)" })))), h("div", { class: "siteheader-topright" }, h("slot", { name: "toprightstart" }), (this.gotData && this.loginDialog && !this.hideLogin) && (h("pn-siteheader-login", { loginDialog: this.loginDialog, endpoint: this.endpoint, i18n: this.i18n })), (this.gotData && ((_e = this.languageSelector) === null || _e === void 0 ? void 0 : _e.languages)) && !this.hideLanguageSelector &&
|
|
2890
|
+
h("pn-site-selector-item", { heading: this.siteSelector.currentSiteTitle, description: this.siteSelector.currentSiteDescription }), (this.gotData && ((_b = this.siteSelector) === null || _b === void 0 ? void 0 : _b.siteSelections)) && this.siteSelector.siteSelections.map((site) => h("pn-site-selector-item", { heading: site.linkText, description: site.linkDescription, url: site.href, newwindow: site.openInNewWindow })))), h("div", { class: "siteheader-logocontainer" }, h("a", { href: (_d = (_c = this.siteDefinition) === null || _c === void 0 ? void 0 : _c.url) !== null && _d !== void 0 ? _d : document.location.hostname, title: "Home", class: "siteheader-logolink" }, h("svg", { class: "siteheader-logo", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 141.73 26.65" }, h("path", { d: "M108.84,13.35c0,6.34-5.17,9-10,9S89,19.76,89,13.63c0-6.28,5.08-9,10-9S108.84,7.25,108.84,13.35Zm-6.56.18a3.4,3.4,0,1,0-6.8,0,3.29,3.29,0,0,0,3.42,3.41A3.24,3.24,0,0,0,102.28,13.54Zm-83,0c0,4.83-3.32,8.82-8.49,8.82a6.54,6.54,0,0,1-4.65-1.57v5.86H0V5.16H6.17V6.8a6.43,6.43,0,0,1,5.11-2.18C16.41,4.62,19.31,8.58,19.31,13.54Zm-6.53,0A3.27,3.27,0,0,0,9.4,10,3.28,3.28,0,0,0,6,13.54,3.29,3.29,0,0,0,9.4,16.95,3.24,3.24,0,0,0,12.78,13.54Zm103.69,0.27c0-2.54,1.54-3.32,3.6-3.32a6.56,6.56,0,0,1,2.08.3L122.3,5.1a3.92,3.92,0,0,0-1.45-.18c-3.45,0-4.38,2.18-4.38,2.18V5.16H110.3V21.84h6.17v-8ZM141.73,0V21.84h-6.16V20.21a6.43,6.43,0,0,1-5.11,2.18c-5.14,0-8-4-8-8.91s3.32-8.82,8.49-8.82a6.54,6.54,0,0,1,4.65,1.57v-5Zm-6,13.48a3.28,3.28,0,0,0-3.41-3.41A3.24,3.24,0,0,0,129,13.47,3.4,3.4,0,1,0,135.75,13.47ZM81.35,4.62c-3.6,0-4.9,2.18-4.9,2.18V5.16H70.29V21.84h6.16V13.29c0-2.11.79-3.08,2.69-3.08s2.18,1.57,2.18,3.57v8.07h6.22V11.6C87.55,7,85.34,4.62,81.35,4.62ZM64.07,1.42H57.9V21.84h6.16V10.36H67l2.81-5.2H64.07V1.42ZM50.26,11.21c-2-.3-2.87-0.3-2.87-1.09s0.81-.94,2.42-0.94a16.15,16.15,0,0,1,5.11.91L56,5.41a24.56,24.56,0,0,0-6.13-.75c-5.89,0-9,2.27-9,5.89,0,2.81,1.66,4.47,6.53,5.11,2.06,0.27,2.81.39,2.81,1.15s-0.82,1-2.24,1a16.67,16.67,0,0,1-6-1.3L40.77,21.3a22.14,22.14,0,0,0,6.68,1c6.35,0,9.28-2.24,9.28-5.89C56.72,13.54,55.15,12,50.26,11.21ZM40.19,13.35c0,6.34-5.17,9-10,9s-9.82-2.6-9.82-8.73c0-6.28,5.08-9,10-9S40.19,7.25,40.19,13.35Zm-6.56.18a3.4,3.4,0,1,0-6.8,0,3.28,3.28,0,0,0,3.41,3.41A3.24,3.24,0,0,0,33.63,13.54Z", fill: "#00A0D6", transform: "translate(0 0)" })))), h("div", { class: "siteheader-topright" }, h("slot", { name: "toprightstart" }), (this.gotData && this.loginDialog && !this.hideLogin) && (h("pn-marketweb-siteheader-login", { loginDialog: this.loginDialog, endpoint: this.endpoint, i18n: this.i18n })), (this.gotData && ((_e = this.languageSelector) === null || _e === void 0 ? void 0 : _e.languages)) && !this.hideLanguageSelector &&
|
|
176
2891
|
h("pn-language-selector", { value: this.language }, this.languageSelector.languages.map(language => h("pn-language-selector-option", { name: language.nativeName, code: language.twoLetterISOLanguageName, selected: language.isCurrent, url: this.getLanguageVersionUrl(language) }))), h("slot", { name: "toprightend" }))), h("div", { class: "siteheader-row" }, h("div", { class: "siteheader-menu" }, h("pn-mainnav", { market: this.market, language: this.language }, h("pn-mainnav-level", null, h("pn-mainnav-list", null, this.menuItems.map((item) => {
|
|
177
2892
|
var _a, _b;
|
|
178
2893
|
return (h("pn-mainnav-link", { name: item.name, href: item.href, itemid: item.id, target: (_a = item.linkTarget) !== null && _a !== void 0 ? _a : "_self", linkid: item.trackingId }, ((item.promotedMenuItems && item.promotedMenuItems.length > 0) || (item.children && item.children.length > 0)) &&
|
|
@@ -182,13 +2897,13 @@ const PnSiteheader$1 = class extends HTMLElement {
|
|
|
182
2897
|
return (h("pn-mainnav-link", { name: childitem.name, href: childitem.href, target: (_a = childitem.linkTarget) !== null && _a !== void 0 ? _a : "_self", linkid: childitem.trackingId }));
|
|
183
2898
|
})), (item.promotedMenuItems && item.promotedMenuItems.length > 0) &&
|
|
184
2899
|
h("pn-mainnav-list", { heading: item.promotedMenuItemsHeader }, item.promotedMenuItems.map((childitem) => (h("pn-mainnav-link", { href: childitem.href, name: childitem.linkText, target: childitem.openInNewWindow ? "_blank" : "_self", linkid: this.promotedItemId(childitem) })))))));
|
|
185
|
-
})), h("div", { slot: "footer", class: "siteheader-menu-footer" }, (this.gotData && this.loginDialog && !this.hideLogin) && (h("pn-siteheader-login", { loginDialog: this.loginDialog, endpoint: this.endpoint, i18n: this.i18n })), (this.gotData && ((_f = this.languageSelector) === null || _f === void 0 ? void 0 : _f.languages)) && !this.hideLanguageSelector &&
|
|
2900
|
+
})), h("div", { slot: "footer", class: "siteheader-menu-footer" }, (this.gotData && this.loginDialog && !this.hideLogin) && (h("pn-marketweb-siteheader-login", { loginDialog: this.loginDialog, endpoint: this.endpoint, i18n: this.i18n })), (this.gotData && ((_f = this.languageSelector) === null || _f === void 0 ? void 0 : _f.languages)) && !this.hideLanguageSelector &&
|
|
186
2901
|
h("pn-language-selector", { value: this.language }, this.languageSelector.languages.map(language => h("pn-language-selector-option", { name: language.nativeName, code: language.twoLetterISOLanguageName, selected: language.isCurrent, url: this.getLanguageVersionUrl(language) }))), !this.hideSiteSelector &&
|
|
187
2902
|
h("pn-site-selector", { language: this.language }, (this.gotData && ((_g = this.siteSelector) === null || _g === void 0 ? void 0 : _g.currentSiteTitle)) &&
|
|
188
|
-
h("pn-site-selector-item", { heading: this.siteSelector.currentSiteTitle, description: this.siteSelector.currentSiteDescription }), (this.gotData && ((_h = this.siteSelector) === null || _h === void 0 ? void 0 : _h.siteSelections)) && this.siteSelector.siteSelections.map((site) => h("pn-site-selector-item", { heading: site.linkText, description: site.linkDescription, url: site.pageLink, newwindow: site.openInNewWindow }))))))), h("pn-siteheader-search", { search: this.search, "hide-search": this.hideSearch, "show-only-link": this.minimizeSearch, i18n: this.i18n }))));
|
|
2903
|
+
h("pn-site-selector-item", { heading: this.siteSelector.currentSiteTitle, description: this.siteSelector.currentSiteDescription }), (this.gotData && ((_h = this.siteSelector) === null || _h === void 0 ? void 0 : _h.siteSelections)) && this.siteSelector.siteSelections.map((site) => h("pn-site-selector-item", { heading: site.linkText, description: site.linkDescription, url: site.pageLink, newwindow: site.openInNewWindow }))))))), h("pn-marketweb-siteheader-search", { search: this.search, "hide-search": this.hideSearch, "show-only-link": this.minimizeSearch, i18n: this.i18n }))));
|
|
189
2904
|
}
|
|
190
2905
|
get hostElement() { return this; }
|
|
191
|
-
static get style() { return
|
|
2906
|
+
static get style() { return pnMarketwebSiteheaderCss; }
|
|
192
2907
|
};
|
|
193
2908
|
|
|
194
2909
|
class PNLoginManager {
|
|
@@ -376,9 +3091,9 @@ class PNLoginManager {
|
|
|
376
3091
|
}
|
|
377
3092
|
}
|
|
378
3093
|
|
|
379
|
-
const
|
|
3094
|
+
const pnMarketwebSiteheaderLoginCss = "pn-marketweb-siteheader-login{padding:1rem 0;margin-right:1.6rem}pn-marketweb-siteheader-login strong{padding:0.8rem 1.6rem;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}pn-marketweb-siteheader-login ul,pn-marketweb-siteheader-login li{list-style:none;margin:0;padding:0}pn-marketweb-siteheader-login li{padding:0.8rem 1.6rem}pn-marketweb-siteheader-login li a{display:block;width:100%}pn-marketweb-siteheader-login li a[tabindex],pn-marketweb-siteheader-login li a[style]{text-decoration:none}pn-marketweb-siteheader-login li pn-button{display:block;width:100%}pn-marketweb-siteheader-login pn-nav-dropdown{display:none}pn-marketweb-siteheader-login.hydrated pn-nav-dropdown{display:block}";
|
|
380
3095
|
|
|
381
|
-
const
|
|
3096
|
+
const PnMarketwebSiteheaderLogin$1 = class extends HTMLElement {
|
|
382
3097
|
constructor() {
|
|
383
3098
|
super();
|
|
384
3099
|
this.__registerHost();
|
|
@@ -445,12 +3160,12 @@ const PnSiteheaderLogin$1 = class extends HTMLElement {
|
|
|
445
3160
|
h("div", null, h("ul", null, (_c = this.loginDialog.loginMenuLinks) === null || _c === void 0 ? void 0 : _c.map(link => h("li", null, h("a", { href: link.href, target: link.openInNewWindow ? "_blank" : "_self", class: "btn btn-link" }, link.linkText)))))));
|
|
446
3161
|
}
|
|
447
3162
|
get hostElement() { return this; }
|
|
448
|
-
static get style() { return
|
|
3163
|
+
static get style() { return pnMarketwebSiteheaderLoginCss; }
|
|
449
3164
|
};
|
|
450
3165
|
|
|
451
|
-
const
|
|
3166
|
+
const pnMarketwebSiteheaderSearchCss = ".siteheader-search a{display:none}@media screen and (min-width: 48em){.siteheader-search a{display:block}}.siteheader-search pn-search-field.button-icon pn-button,.siteheader-search pn-button{display:-ms-inline-flexbox;display:inline-flex}.siteheader-search pn-search-field.button-icon pn-button button,.siteheader-search pn-button button{-ms-flex-item-align:center;align-self:center;padding:0;height:2.3em;width:2.3em;line-height:0;min-height:unset;min-width:unset}.siteheader-search pn-search-field.button-icon pn-button pn-icon,.siteheader-search pn-button pn-icon{margin-left:0}.siteheader-search form{-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;width:auto;-ms-flex:none;flex:none;display:-ms-flexbox;display:flex;padding:0;margin:0 0 0 0.4rem;position:relative}@media screen and (min-width: 60em){.siteheader-search form{margin-right:1.6rem}}.siteheader-search form pn-search-field{min-width:13.5em}.siteheader-search form pn-search-field .input-container{-ms-flex-item-align:center;align-self:center}.siteheader-search form pn-search-field input{height:auto;min-height:1em;padding:0.6em 0.75em}";
|
|
452
3167
|
|
|
453
|
-
const
|
|
3168
|
+
const PnMarketwebSiteheaderSearch$1 = class extends HTMLElement {
|
|
454
3169
|
constructor() {
|
|
455
3170
|
super();
|
|
456
3171
|
this.__registerHost();
|
|
@@ -470,25 +3185,465 @@ const PnSiteheaderSearch$1 = class extends HTMLElement {
|
|
|
470
3185
|
return (h("div", { class: "siteheader-search" }, (this.showOnlyLink) ? (h("a", { href: this.search.formActionUrl, title: this.i18n.searchlabel }, h("pn-button", { appearance: "light", icon: "search" }))) :
|
|
471
3186
|
(h("form", { method: "get", action: this.search.formActionUrl, role: "search" }, h("pn-search-field", { label: this.i18n.searchlabel, name: "q", button: "icon", onSearch: () => {
|
|
472
3187
|
const form = this.hostElement.querySelector('form');
|
|
473
|
-
console.log('form', form);
|
|
474
3188
|
if (form) {
|
|
475
3189
|
form.submit();
|
|
476
3190
|
}
|
|
477
3191
|
}, placeholder: this.i18n.searchplaceholder })))));
|
|
478
3192
|
}
|
|
479
3193
|
get hostElement() { return this; }
|
|
480
|
-
static get style() { return
|
|
3194
|
+
static get style() { return pnMarketwebSiteheaderSearchCss; }
|
|
3195
|
+
};
|
|
3196
|
+
|
|
3197
|
+
const translations = {
|
|
3198
|
+
'sv': {
|
|
3199
|
+
'maxweightlabel': 'Maxvikt',
|
|
3200
|
+
'weightlabel': 'Vikt',
|
|
3201
|
+
'maxmeasurementlabel': 'Maxvolym',
|
|
3202
|
+
'sizeheading': 'Hur mycket väger det?',
|
|
3203
|
+
'senddirectcta': 'Köp frakt via Skicka Direkt',
|
|
3204
|
+
'stampshopcta': 'Köp frimärken via vår webshop',
|
|
3205
|
+
},
|
|
3206
|
+
'en': {
|
|
3207
|
+
'maxweightlabel': 'Max weight',
|
|
3208
|
+
'weightlabel': 'Weight',
|
|
3209
|
+
'maxmeasurementlabel': 'Maximum measurement',
|
|
3210
|
+
'sizeheading': 'How much does it weigh?',
|
|
3211
|
+
'senddirectcta': 'Buy shipping in Send Direct',
|
|
3212
|
+
'stampshopcta': 'Order home stamps from the webshop',
|
|
3213
|
+
},
|
|
3214
|
+
'da': {
|
|
3215
|
+
'maxweightlabel': 'Max vægt',
|
|
3216
|
+
'weightlabel': 'Vægt',
|
|
3217
|
+
'maxmeasurementlabel': 'Maks. Volumen',
|
|
3218
|
+
'sizeheading': 'How much does it weigh?',
|
|
3219
|
+
'senddirectcta': 'Buy shipping in Send Direct',
|
|
3220
|
+
'stampshopcta': 'Order home stamps from the webshop',
|
|
3221
|
+
},
|
|
3222
|
+
'no': {
|
|
3223
|
+
'maxweightlabel': 'Maks vekt',
|
|
3224
|
+
'weightlabel': 'Vekt',
|
|
3225
|
+
'maxmeasurementlabel': 'Maks volum',
|
|
3226
|
+
'sizeheading': 'How much does it weigh?',
|
|
3227
|
+
'senddirectcta': 'Buy shipping in Send Direct',
|
|
3228
|
+
'stampshopcta': 'Order home stamps from the webshop',
|
|
3229
|
+
},
|
|
3230
|
+
'fi': {
|
|
3231
|
+
'maxweightlabel': 'Max paino',
|
|
3232
|
+
'weightlabel': 'Piano',
|
|
3233
|
+
'maxmeasurementlabel': 'Max äänenvoimakkuus',
|
|
3234
|
+
'sizeheading': 'How much does it weigh?',
|
|
3235
|
+
'senddirectcta': 'Buy shipping in Send Direct',
|
|
3236
|
+
'stampshopcta': 'Order home stamps from the webshop',
|
|
3237
|
+
}
|
|
3238
|
+
};
|
|
3239
|
+
const markets = {
|
|
3240
|
+
'se': {
|
|
3241
|
+
"currency": "kr",
|
|
3242
|
+
},
|
|
3243
|
+
'dk': {
|
|
3244
|
+
"currency": "dk",
|
|
3245
|
+
},
|
|
3246
|
+
'fi': {
|
|
3247
|
+
"currency": " €",
|
|
3248
|
+
},
|
|
3249
|
+
'no': {
|
|
3250
|
+
"currency": "kr",
|
|
3251
|
+
}
|
|
3252
|
+
};
|
|
3253
|
+
|
|
3254
|
+
const weights = {
|
|
3255
|
+
"letter": [
|
|
3256
|
+
{ name: "50g", abbreviation: 'g', value: 50 },
|
|
3257
|
+
{ name: "100g", abbreviation: 'g', value: 100 },
|
|
3258
|
+
{ name: "250g", abbreviation: 'g', value: 250 },
|
|
3259
|
+
{ name: "500g", abbreviation: 'g', value: 500 },
|
|
3260
|
+
{ name: "1kg", abbreviation: 'kg', value: 1 },
|
|
3261
|
+
{ name: "2kg", abbreviation: 'kg', value: 2 },
|
|
3262
|
+
],
|
|
3263
|
+
"parcel": [
|
|
3264
|
+
{ name: "1kg", abbreviation: 'kg', value: 1 },
|
|
3265
|
+
{ name: "2kg", abbreviation: 'kg', value: 2 },
|
|
3266
|
+
{ name: "3kg", abbreviation: 'kg', value: 3 },
|
|
3267
|
+
{ name: "4kg", abbreviation: 'kg', value: 4 },
|
|
3268
|
+
{ name: "5kg", abbreviation: 'kg', value: 5 },
|
|
3269
|
+
{ name: "6kg", abbreviation: 'kg', value: 6 },
|
|
3270
|
+
{ name: "7Kg", abbreviation: 'kg', value: 7 },
|
|
3271
|
+
{ name: "8kg", abbreviation: 'kg', value: 8 },
|
|
3272
|
+
{ name: "9kg", abbreviation: 'kg', value: 9 },
|
|
3273
|
+
{ name: "10kg", abbreviation: 'kg', value: 10 },
|
|
3274
|
+
{ name: "11kg", abbreviation: 'kg', value: 11 },
|
|
3275
|
+
{ name: "12kg", abbreviation: 'kg', value: 12 },
|
|
3276
|
+
{ name: "13kg", abbreviation: 'kg', value: 13 },
|
|
3277
|
+
{ name: "14kg", abbreviation: 'kg', value: 14 },
|
|
3278
|
+
{ name: "15kg", abbreviation: 'kg', value: 15 },
|
|
3279
|
+
{ name: "16kg", abbreviation: 'kg', value: 16 },
|
|
3280
|
+
{ name: "17kg", abbreviation: 'kg', value: 17 },
|
|
3281
|
+
{ name: "18kg", abbreviation: 'kg', value: 18 },
|
|
3282
|
+
{ name: "20kg", abbreviation: 'kg', value: 20 },
|
|
3283
|
+
]
|
|
3284
|
+
};
|
|
3285
|
+
|
|
3286
|
+
// Read more about how stencil stores work here: https://stenciljs.com/docs/stencil-store
|
|
3287
|
+
const { state, onChange } = createStore({
|
|
3288
|
+
i18n: {
|
|
3289
|
+
maxweightlabel: '',
|
|
3290
|
+
weightlabel: '',
|
|
3291
|
+
maxmeasurementlabel: '',
|
|
3292
|
+
sizeheading: '',
|
|
3293
|
+
senddirectcta: '',
|
|
3294
|
+
stampshopcta: '',
|
|
3295
|
+
},
|
|
3296
|
+
market: {
|
|
3297
|
+
currency: ""
|
|
3298
|
+
}
|
|
3299
|
+
});
|
|
3300
|
+
|
|
3301
|
+
const pnProductPricelistCss = "pn-product-pricelist pn-spinner{margin:1em auto}pn-product-pricelist h2,pn-product-pricelist .heading{text-align:center;font-size:1.5em;line-height:1.1;font-weight:bold;margin-bottom:1rem}pn-product-pricelist .content,pn-product-pricelist .weightselection{max-width:50em;margin:0 auto 1em}pn-product-pricelist .weightoption{display:-ms-flexbox;display:flex;gap:1em}pn-product-pricelist .weightoption-input{width:5em;position:relative}pn-product-pricelist .weightoption-input input::-webkit-outer-spin-button,pn-product-pricelist .weightoption-input input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}pn-product-pricelist .weightoption-input-abbreviation{position:absolute;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);right:1.2em;margin-top:1.55rem;font-weight:500}pn-product-pricelist .weightoption-range{-ms-flex-positive:1;flex-grow:1;-ms-flex-item-align:end;align-self:flex-end;position:relative;top:0.5em}pn-product-pricelist .weightoption-range input{width:calc(100% - 1.5em)}pn-product-pricelist .weightoption-range datalist{width:100%;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;font-size:0.75em}pn-product-pricelist .resultlist:not([data-list-count=\"0\"]){margin-top:2em}";
|
|
3302
|
+
|
|
3303
|
+
const PnFindProductPricelist = class extends HTMLElement {
|
|
3304
|
+
constructor() {
|
|
3305
|
+
super();
|
|
3306
|
+
this.__registerHost();
|
|
3307
|
+
this.source = "https://com-integration.postnord.com/globalassets/global/prices/sv-se-findprice.xlsx";
|
|
3308
|
+
this.language = "sv";
|
|
3309
|
+
this.market = "se";
|
|
3310
|
+
this.productid = "";
|
|
3311
|
+
this.filteredItems = [];
|
|
3312
|
+
this.sourceData = { types: [], data: [] };
|
|
3313
|
+
this.gotData = false;
|
|
3314
|
+
this.loading = false;
|
|
3315
|
+
this.postagetype = { value: "" };
|
|
3316
|
+
this.weight = { value: 0, name: "" };
|
|
3317
|
+
this.weightvalue = 0;
|
|
3318
|
+
}
|
|
3319
|
+
componentWillLoad() {
|
|
3320
|
+
this.setState();
|
|
3321
|
+
this.getDataSource().then(() => { });
|
|
3322
|
+
}
|
|
3323
|
+
setState() {
|
|
3324
|
+
if (this.market) {
|
|
3325
|
+
state.market = markets[this.market];
|
|
3326
|
+
}
|
|
3327
|
+
if (this.language && translations[this.language]) {
|
|
3328
|
+
state.i18n = translations[this.language];
|
|
3329
|
+
}
|
|
3330
|
+
}
|
|
3331
|
+
async getDataSource() {
|
|
3332
|
+
if (!this.productid) {
|
|
3333
|
+
return;
|
|
3334
|
+
}
|
|
3335
|
+
this.loading = true;
|
|
3336
|
+
const req = await fetch(this.source);
|
|
3337
|
+
const reqbody = await req.blob();
|
|
3338
|
+
try {
|
|
3339
|
+
const convertedData = await convertFileFromStream(reqbody);
|
|
3340
|
+
this.sourceData = convertedData;
|
|
3341
|
+
this.filterItems();
|
|
3342
|
+
}
|
|
3343
|
+
catch (e) {
|
|
3344
|
+
this.loading = false;
|
|
3345
|
+
console.warn('Unable to parse data');
|
|
3346
|
+
}
|
|
3347
|
+
}
|
|
3348
|
+
filterItems() {
|
|
3349
|
+
var _a;
|
|
3350
|
+
if (!((_a = this.sourceData) === null || _a === void 0 ? void 0 : _a.data)) {
|
|
3351
|
+
console.info('Data has not yet been loaded');
|
|
3352
|
+
return;
|
|
3353
|
+
}
|
|
3354
|
+
this.loading = false;
|
|
3355
|
+
const productIdItems = this.sourceData.data.filter(x => x.id === this.productid);
|
|
3356
|
+
if (productIdItems.length === 0) {
|
|
3357
|
+
return;
|
|
3358
|
+
}
|
|
3359
|
+
this.postagetype.value = productIdItems[0].what;
|
|
3360
|
+
if (!weights[this.postagetype.value] || weights[this.postagetype.value].length === 0) {
|
|
3361
|
+
return;
|
|
3362
|
+
}
|
|
3363
|
+
if (this.weightvalue === 0) {
|
|
3364
|
+
this.weight = weights[this.postagetype.value][0];
|
|
3365
|
+
this.weightvalue = this.weight.value;
|
|
3366
|
+
}
|
|
3367
|
+
// For letters we use grams. Otherwise we use KG
|
|
3368
|
+
const comparisonWeight = (this.weight.abbreviation.toLocaleLowerCase() === "kg" && this.postagetype.value === 'letter') ? this.weight.value * 1000 : this.weight.value;
|
|
3369
|
+
let weightFilteredData = productIdItems.filter(x => x.maxweight === comparisonWeight);
|
|
3370
|
+
// In parcels the maxwidths don't necessarily start at 1kg so we fetch any type below the user selected value
|
|
3371
|
+
if (weightFilteredData.length === 0) {
|
|
3372
|
+
weightFilteredData = productIdItems.filter(x => x.maxweight >= comparisonWeight);
|
|
3373
|
+
if (weightFilteredData.length > 0) {
|
|
3374
|
+
// We reverse the result array since the map will take the last unique item instead of the first
|
|
3375
|
+
const uniqueWeightOptions = [...new Map(weightFilteredData.reverse().map(item => [item["id"], item])).values()];
|
|
3376
|
+
if (uniqueWeightOptions.length > 0) {
|
|
3377
|
+
weightFilteredData = uniqueWeightOptions;
|
|
3378
|
+
}
|
|
3379
|
+
}
|
|
3380
|
+
}
|
|
3381
|
+
this.filteredItems = weightFilteredData;
|
|
3382
|
+
this.gotData = this.filteredItems.length > 0;
|
|
3383
|
+
}
|
|
3384
|
+
render() {
|
|
3385
|
+
return (h(Host, null, h("div", { class: "content" }, h("slot", null)), this.loading ? (h("pn-spinner", null)) : null, (this.postagetype.value && weights[this.postagetype.value]) ? (h("div", { class: "weightselection" }, (state.i18n.sizeheading) ? (h("div", { class: "heading" }, state.i18n.sizeheading)) : null, h("div", { class: "weightoption" }, h("div", { class: "weightoption-input" }, h("pn-input", { inputid: "weightvalue", name: "weightvalue", type: "number", label: state.i18n.weightlabel, value: this.weightvalue, onChange: (e) => {
|
|
3386
|
+
if (e && e.target && e.target.value) {
|
|
3387
|
+
const weightNum = parseInt(e.target.value, 10);
|
|
3388
|
+
if (!isNaN(weightNum)) {
|
|
3389
|
+
let matchingWeights = weights[this.postagetype.value].filter((x) => {
|
|
3390
|
+
let weightInGrams = (x.abbreviation === "kg") ? x.value * 1000 : x.value;
|
|
3391
|
+
return weightInGrams >= weightNum;
|
|
3392
|
+
});
|
|
3393
|
+
if (matchingWeights && matchingWeights.length > 0) {
|
|
3394
|
+
this.weight = matchingWeights[0];
|
|
3395
|
+
this.weightvalue = this.weight.value;
|
|
3396
|
+
}
|
|
3397
|
+
}
|
|
3398
|
+
}
|
|
3399
|
+
} }), h("span", { class: "weightoption-input-abbreviation" }, this.weight.abbreviation)), h("div", { class: "weightoption-range" }, h("input", { type: "range", id: "weightrange", name: "weightrange", list: "weightlist", value: (!this.weight.value) ? 0 : weights[this.postagetype.value].findIndex((x) => x.value === this.weightvalue), onChange: (e) => {
|
|
3400
|
+
const value = e.target.value;
|
|
3401
|
+
this.weight = weights[this.postagetype.value][value];
|
|
3402
|
+
this.weightvalue = this.weight.value;
|
|
3403
|
+
}, min: "0",
|
|
3404
|
+
// max={ weights[this.postagetype.value][weights[this.postagetype.value].length - 1].value }
|
|
3405
|
+
max: weights[this.postagetype.value].length - 1 }), h("datalist", { id: "weightlist" }, weights[this.postagetype.value].map((weight, weightindex) => {
|
|
3406
|
+
let labelText = weight.name;
|
|
3407
|
+
if (weights[this.postagetype.value].length > 6) {
|
|
3408
|
+
labelText = (weightindex % 5 === 0 || weightindex === 0 || weightindex === weights[this.postagetype.value].length - 1) ? weight.name : '';
|
|
3409
|
+
}
|
|
3410
|
+
return (h("option", Object.assign({ value: weightindex }, (labelText ? { label: labelText } : {}))));
|
|
3411
|
+
})))))) : null, h("div", { class: "resultlist", "data-list-count": this.filteredItems.length }, this.filteredItems.map((item) => (h("div", null, h("pn-product-pricelist-result", { item: item })))))));
|
|
3412
|
+
}
|
|
3413
|
+
static get watchers() { return {
|
|
3414
|
+
"market": ["setState"],
|
|
3415
|
+
"language": ["setState"],
|
|
3416
|
+
"postagetype": ["filterItems"],
|
|
3417
|
+
"weightvalue": ["filterItems"]
|
|
3418
|
+
}; }
|
|
3419
|
+
static get style() { return pnProductPricelistCss; }
|
|
3420
|
+
};
|
|
3421
|
+
|
|
3422
|
+
const pnProductPricelistResultCss = "";
|
|
3423
|
+
|
|
3424
|
+
const PnFindProductPricelistResult = class extends HTMLElement {
|
|
3425
|
+
constructor() {
|
|
3426
|
+
super();
|
|
3427
|
+
this.__registerHost();
|
|
3428
|
+
this.item = null;
|
|
3429
|
+
this.shownitems = [];
|
|
3430
|
+
this.weightText = "";
|
|
3431
|
+
}
|
|
3432
|
+
componentWillLoad() {
|
|
3433
|
+
this.composeItems();
|
|
3434
|
+
}
|
|
3435
|
+
composeItems() {
|
|
3436
|
+
this.shownitems = [];
|
|
3437
|
+
if (this.item.pricestamps) {
|
|
3438
|
+
this.shownitems.push(Object.assign(Object.assign({}, this.item), { priceagent: null, pricesenddirect: null }));
|
|
3439
|
+
}
|
|
3440
|
+
if (this.item.priceagent) {
|
|
3441
|
+
this.shownitems.push(Object.assign(Object.assign({}, this.item), { pricestamps: null, pricesenddirect: null }));
|
|
3442
|
+
}
|
|
3443
|
+
if (this.item.pricesenddirect) {
|
|
3444
|
+
this.shownitems.push(Object.assign(Object.assign({}, this.item), { pricestamps: null, priceagent: null }));
|
|
3445
|
+
}
|
|
3446
|
+
// Parcels are always in KG. Letter KG must be converted from grams
|
|
3447
|
+
this.weightText = (this.item.what === "parcel") ? this.item.maxweight + 'kg' :
|
|
3448
|
+
(this.item.what === "letter" && this.item.maxweight > 999) ? Math.round(this.item.maxweight / 1000) + " kg" : this.item.maxweight + " g";
|
|
3449
|
+
}
|
|
3450
|
+
render() {
|
|
3451
|
+
return (h(Host, null, this.shownitems.map((item) => (h("pn-product-tile", null, h("pn-illustration", { slot: "illustration", illustration: item.illustration }), h("div", { slot: "content" }, h("div", { class: "content" }, h("h3", null, item.name), (item.description) ? (h("div", { class: "description" }, item.description)) : null, (item.info) ? (h("div", { class: "description" }, item.info)) : null)), item.maxweight ? (h("pn-product-tile-info", { label: state.i18n.maxweightlabel, text: this.weightText })) : null, item.maximummeasurements ? (h("pn-product-tile-info", { label: state.i18n.maxmeasurementlabel, text: item.maximummeasurements })) : null, item.pricestamps ? (h("pn-product-tile-price", { slot: "price", label: state.i18n.stampshopcta, amount: item.pricestamps + '', currency: state.market.currency })) : null, item.priceagent ? (h("pn-product-tile-price", { slot: "price", label: "", amount: item.priceagent + '', currency: state.market.currency, url: "https://shop.postnord.se/ebutik/default.aspx" })) : null, item.pricesenddirect ? (h("pn-product-tile-price", { slot: "price", label: state.i18n.senddirectcta, amount: item.pricesenddirect + '', currency: state.market.currency, url: "https://portal.postnord.com/skickadirekt/" })) : null, item.note ? (h("small", { slot: "note" }, h("p", null, item.note))) : null)))));
|
|
3452
|
+
}
|
|
3453
|
+
static get watchers() { return {
|
|
3454
|
+
"item": ["composeItems"]
|
|
3455
|
+
}; }
|
|
3456
|
+
static get style() { return pnProductPricelistResultCss; }
|
|
3457
|
+
};
|
|
3458
|
+
|
|
3459
|
+
const pnProductTileCss = "pn-product-tile{margin-bottom:1em;border:0.1rem solid #D3CECB;outline:none;background:white;-webkit-box-shadow:0px 0.6px 1.8px rgba(0, 0, 0, 0.1), 0px 3.2px 7.2px rgba(0, 0, 0, 0.13);box-shadow:0px 0.6px 1.8px rgba(0, 0, 0, 0.1), 0px 3.2px 7.2px rgba(0, 0, 0, 0.13);display:-ms-flexbox;display:flex;padding:1.5em;word-break:break-word;text-decoration:none;border-radius:0.8rem}pn-product-tile [slot=content] h3{display:-ms-flexbox;display:flex;width:100%;-ms-flex-pack:justify;justify-content:space-between;margin-bottom:0.5em}pn-product-tile>pn-illustration{min-width:8rem;width:8rem;height:8rem;margin-right:3rem;-ms-flex-item-align:center;align-self:center}pn-product-tile .tilecontent{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:center;justify-content:center;-ms-flex-positive:1;flex-grow:1}pn-product-tile .details{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:justify;justify-content:space-between;width:100%}pn-product-tile .info{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-positive:1;flex-grow:1;max-width:calc((100% / 3) * 2);-ms-flex-flow:wrap;flex-flow:wrap}pn-product-tile .info>*{min-width:6em;margin:0.2em 1em 0.2em 0}";
|
|
3460
|
+
|
|
3461
|
+
const PnProductTile$1 = class extends HTMLElement {
|
|
3462
|
+
constructor() {
|
|
3463
|
+
super();
|
|
3464
|
+
this.__registerHost();
|
|
3465
|
+
}
|
|
3466
|
+
render() {
|
|
3467
|
+
return (h(Host, null, h("slot", { name: "illustration" }), h("div", { class: "tilecontent" }, h("div", { class: "details" }, h("slot", { name: "content" }), h("div", { class: "info" }, h("slot", null)), h("slot", { name: "note" })), h("slot", { name: "price" }))));
|
|
3468
|
+
}
|
|
3469
|
+
static get style() { return pnProductTileCss; }
|
|
3470
|
+
};
|
|
3471
|
+
|
|
3472
|
+
const pnProductTileInfoCss = "pn-product-tile-info{-ms-flex-item-align:center;align-self:center}";
|
|
3473
|
+
|
|
3474
|
+
const PnProductTileInfo$1 = class extends HTMLElement {
|
|
3475
|
+
constructor() {
|
|
3476
|
+
super();
|
|
3477
|
+
this.__registerHost();
|
|
3478
|
+
}
|
|
3479
|
+
render() {
|
|
3480
|
+
return (h(Host, null, (this.label) ? (h("p", null, h("small", null, this.label))) : null, (this.text) ? (h("h3", null, this.text)) : null));
|
|
3481
|
+
}
|
|
3482
|
+
static get style() { return pnProductTileInfoCss; }
|
|
3483
|
+
};
|
|
3484
|
+
h("pn-icon", { symbol: "align-center", small: "false", color: "black" });
|
|
3485
|
+
|
|
3486
|
+
const pnProductTilePriceCss = "pn-product-tile-price{margin-top:1em;white-space:nowrap;text-align:right}pn-product-tile-price span:last-child{display:inline-block;margin-left:0.2em}pn-product-tile-price+pn-product-tile-price{margin-left:1.5em}pn-product-tile-price pn-icon{display:inline-block;-ms-flex-item-align:center;align-self:center}pn-product-tile-price a{text-decoration:none;color:#005D92}pn-product-tile-price a h3{text-decoration:underline}";
|
|
3487
|
+
|
|
3488
|
+
const PnProductTilePrice$1 = class extends HTMLElement {
|
|
3489
|
+
constructor() {
|
|
3490
|
+
super();
|
|
3491
|
+
this.__registerHost();
|
|
3492
|
+
}
|
|
3493
|
+
render() {
|
|
3494
|
+
if (!this.amount) {
|
|
3495
|
+
return;
|
|
3496
|
+
}
|
|
3497
|
+
return (this.url) ? (h(Host, null, h("h3", null, (this.amount) ? (h("span", { class: "pn-2xl" }, this.amount)) : null, (this.currency) ? (h("span", { class: "pn-2xl" }, this.currency)) : null), (this.label) ? (h("a", { href: this.url }, h("pn-button", { small: "true", icon: "arrow-right" }, this.label))) : null)) : (h(Host, null, h("h3", null, (this.amount) ? (h("span", { class: "pn-2xl" }, this.amount)) : null, (this.currency) ? (h("span", { class: "pn-2xl" }, this.currency)) : null)));
|
|
3498
|
+
}
|
|
3499
|
+
static get style() { return pnProductTilePriceCss; }
|
|
3500
|
+
};
|
|
3501
|
+
|
|
3502
|
+
const pnSiteFooterCss = "pn-site-footer{display:block;line-height:1.5}pn-site-footer a{color:#005D92}pn-site-footer a:hover{color:#0D234B;text-decoration:underline}pn-site-footer h3{font-size:2.4rem;margin-bottom:0.5rem;line-height:1.2}pn-site-footer p{font-size:1.6rem}pn-site-footer ul.social-media{display:-ms-flexbox;display:flex;-ms-flex-flow:row;flex-flow:row}pn-site-footer ul.social-media li{margin-right:1.6rem}pn-site-footer>svg{display:block}pn-site-footer>div{background:#F3F2F2}.pn-sitefooter-cols{display:-ms-flexbox;display:flex;-ms-flex-flow:row wrap;flex-flow:row wrap;margin:0 auto;max-width:90em}.pn-sitefooter-bottom [slot=bottom]{max-width:90em;margin:0 auto;padding:1.6rem 0;display:-ms-flexbox;display:flex;-ms-flex-flow:row;flex-flow:row;-ms-flex-pack:center;justify-content:center;-ms-flex-wrap:wrap;flex-wrap:wrap;border-top:1px solid #D3CECB;border-bottom:1px solid #D3CECB}.pn-sitefooter-bottom [slot=bottom] span,.pn-sitefooter-bottom [slot=bottom] a{line-height:2;margin:0 1.6rem;text-decoration:none}.pn-sitefooter-bottom [slot=bottom] li{line-height:2em;margin:0 1.6rem}.pn-sitefooter-logo{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-pack:center;justify-content:center;padding:3rem}.pn-sitefooter-logo svg{display:block;width:13.3rem;height:2.6rem}";
|
|
3503
|
+
|
|
3504
|
+
const PnSiteFooter$1 = class extends HTMLElement {
|
|
3505
|
+
constructor() {
|
|
3506
|
+
super();
|
|
3507
|
+
this.__registerHost();
|
|
3508
|
+
/** What you write in the comment block above each prop is what ends up in the description fields in the prop table in the documentation */
|
|
3509
|
+
this.url = "";
|
|
3510
|
+
}
|
|
3511
|
+
componentWillLoad() {
|
|
3512
|
+
}
|
|
3513
|
+
render() {
|
|
3514
|
+
return (h(Host, null, h("svg", { fill: "none", viewBox: "0 0 1680 126", role: "presentation" }, h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M0 124.425C265.751 43.517 547.794 0 840 0c292.21 0 574.25 43.517 840 124.425V126H0v-1.575z", fill: "#F3F2F2" })), h("div", { class: "pn-sitefooter-top" }, h("div", { class: "pn-sitefooter-cols" }, h("slot", null))), h("div", { class: "pn-sitefooter-bottom" }, h("slot", { name: "bottom" })), h("div", { class: "pn-sitefooter-logo" }, (this.url) ? (h("a", { href: this.url }, h("svg", { viewBox: "0 0 133 26", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M132.749 0.333618V20.9198H126.976V19.3809C126.976 19.3809 125.475 21.4316 122.191 21.4316C117.381 21.4316 114.662 17.7015 114.662 13.0327C114.662 8.47612 117.776 4.7187 122.617 4.7187C125.589 4.7187 126.976 6.19924 126.976 6.19924V1.47206L132.749 0.333618ZM54.2322 1.67091H60.0055V5.20216H65.3564L62.7235 10.0999H60.0055V20.9198H54.2322V1.67091ZM28.2484 21.4023C32.8051 21.4023 37.6446 18.8974 37.6446 12.9187C37.6446 7.16616 32.9746 4.69042 28.4461 4.69042C23.8042 4.69042 19.049 7.25192 19.049 13.175C19.049 18.9549 23.7199 21.4023 28.2484 21.4023ZM28.3327 9.78608C30.2294 9.78608 31.5032 11.1243 31.5032 13.0902C31.5032 14.9392 30.2575 16.3076 28.3327 16.3076C26.437 16.3076 25.1351 14.9392 25.1351 13.0902C25.1351 11.1243 26.4089 9.78608 28.3327 9.78608ZM47.0708 10.8963C46.8158 10.8574 46.5804 10.8239 46.3639 10.7931C44.9938 10.5979 44.3827 10.5108 44.3827 9.87279C44.3827 9.24608 45.146 8.9888 46.6465 8.9888C49.1941 8.9888 51.4298 9.84357 51.4298 9.84357L52.4488 5.43022C52.4488 5.43022 49.9865 4.71869 46.7027 4.71869C41.1841 4.71869 38.2965 6.85422 38.2965 10.2705C38.2965 12.9187 39.8532 14.485 44.4108 15.0825C46.3355 15.3388 47.0427 15.4519 47.0427 16.1644C47.0427 16.8486 46.2784 17.0757 44.9484 17.0757C42.0608 17.0757 39.3437 15.8515 39.3437 15.8515L38.1832 20.4081C38.1832 20.4081 40.9003 21.375 44.4389 21.375C50.3826 21.375 53.1279 19.2668 53.1279 15.8223C53.1279 13.0902 51.6555 11.6087 47.0708 10.8963ZM76.1968 4.69042C72.8287 4.69042 71.6111 6.74018 71.6111 6.74018V5.20216H65.8369V20.9198H71.6111V12.8612C71.6111 10.8689 72.3483 9.95666 74.1297 9.95666C75.913 9.95666 76.1687 11.4381 76.1687 13.3173V20.9198H81.9982V11.2666C81.9982 6.93903 79.9339 4.69042 76.1968 4.69042ZM123.948 9.8153C125.843 9.8153 127.144 11.1818 127.144 13.0327C127.144 14.9958 125.87 16.335 123.948 16.335C122.051 16.335 120.778 14.9958 120.778 13.0327C120.778 11.1818 122.024 9.8153 123.948 9.8153ZM112.456 10.213C110.53 10.213 109.088 10.9537 109.088 13.3456V20.9198H103.313V5.20216H109.088V7.02479C109.088 7.02479 109.965 4.97409 113.191 4.97409C114.181 4.97409 114.55 5.14467 114.55 5.14467L114.408 10.4976C114.408 10.4976 113.643 10.213 112.456 10.213ZM11.9728 13.0902C11.9728 11.1243 10.699 9.78608 8.80235 9.78608C6.87853 9.78608 5.6038 11.1243 5.6038 13.0902C5.6038 14.9392 6.9057 16.3076 8.80235 16.3076C10.728 16.3076 11.9728 14.9392 11.9728 13.0902ZM10.1333 21.4023C14.9728 21.4023 18.0871 17.6468 18.0871 13.0902C18.0871 8.41958 15.3699 4.69042 10.5576 4.69042C7.27472 4.69042 5.77426 6.74018 5.77426 6.74018V5.20216H0V25.4453H5.77426V19.9227C5.77426 19.9227 7.16139 21.4023 10.1333 21.4023ZM95.7984 13.0902C95.7984 11.1243 94.5246 9.78608 92.6279 9.78608C90.7032 9.78608 89.4284 11.1243 89.4284 13.0902C89.4284 14.9392 90.7322 16.3076 92.6279 16.3076C94.5536 16.3076 95.7984 14.9392 95.7984 13.0902ZM92.5427 21.4023C97.0994 21.4023 101.94 18.8974 101.94 12.9187C101.94 7.16616 97.2698 4.69042 92.7413 4.69042C88.0984 4.69042 83.3442 7.25192 83.3442 13.175C83.3442 18.9549 88.0142 21.4023 92.5427 21.4023Z", fill: "black" })))) : (h("svg", { viewBox: "0 0 133 26", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M132.749 0.333618V20.9198H126.976V19.3809C126.976 19.3809 125.475 21.4316 122.191 21.4316C117.381 21.4316 114.662 17.7015 114.662 13.0327C114.662 8.47612 117.776 4.7187 122.617 4.7187C125.589 4.7187 126.976 6.19924 126.976 6.19924V1.47206L132.749 0.333618ZM54.2322 1.67091H60.0055V5.20216H65.3564L62.7235 10.0999H60.0055V20.9198H54.2322V1.67091ZM28.2484 21.4023C32.8051 21.4023 37.6446 18.8974 37.6446 12.9187C37.6446 7.16616 32.9746 4.69042 28.4461 4.69042C23.8042 4.69042 19.049 7.25192 19.049 13.175C19.049 18.9549 23.7199 21.4023 28.2484 21.4023ZM28.3327 9.78608C30.2294 9.78608 31.5032 11.1243 31.5032 13.0902C31.5032 14.9392 30.2575 16.3076 28.3327 16.3076C26.437 16.3076 25.1351 14.9392 25.1351 13.0902C25.1351 11.1243 26.4089 9.78608 28.3327 9.78608ZM47.0708 10.8963C46.8158 10.8574 46.5804 10.8239 46.3639 10.7931C44.9938 10.5979 44.3827 10.5108 44.3827 9.87279C44.3827 9.24608 45.146 8.9888 46.6465 8.9888C49.1941 8.9888 51.4298 9.84357 51.4298 9.84357L52.4488 5.43022C52.4488 5.43022 49.9865 4.71869 46.7027 4.71869C41.1841 4.71869 38.2965 6.85422 38.2965 10.2705C38.2965 12.9187 39.8532 14.485 44.4108 15.0825C46.3355 15.3388 47.0427 15.4519 47.0427 16.1644C47.0427 16.8486 46.2784 17.0757 44.9484 17.0757C42.0608 17.0757 39.3437 15.8515 39.3437 15.8515L38.1832 20.4081C38.1832 20.4081 40.9003 21.375 44.4389 21.375C50.3826 21.375 53.1279 19.2668 53.1279 15.8223C53.1279 13.0902 51.6555 11.6087 47.0708 10.8963ZM76.1968 4.69042C72.8287 4.69042 71.6111 6.74018 71.6111 6.74018V5.20216H65.8369V20.9198H71.6111V12.8612C71.6111 10.8689 72.3483 9.95666 74.1297 9.95666C75.913 9.95666 76.1687 11.4381 76.1687 13.3173V20.9198H81.9982V11.2666C81.9982 6.93903 79.9339 4.69042 76.1968 4.69042ZM123.948 9.8153C125.843 9.8153 127.144 11.1818 127.144 13.0327C127.144 14.9958 125.87 16.335 123.948 16.335C122.051 16.335 120.778 14.9958 120.778 13.0327C120.778 11.1818 122.024 9.8153 123.948 9.8153ZM112.456 10.213C110.53 10.213 109.088 10.9537 109.088 13.3456V20.9198H103.313V5.20216H109.088V7.02479C109.088 7.02479 109.965 4.97409 113.191 4.97409C114.181 4.97409 114.55 5.14467 114.55 5.14467L114.408 10.4976C114.408 10.4976 113.643 10.213 112.456 10.213ZM11.9728 13.0902C11.9728 11.1243 10.699 9.78608 8.80235 9.78608C6.87853 9.78608 5.6038 11.1243 5.6038 13.0902C5.6038 14.9392 6.9057 16.3076 8.80235 16.3076C10.728 16.3076 11.9728 14.9392 11.9728 13.0902ZM10.1333 21.4023C14.9728 21.4023 18.0871 17.6468 18.0871 13.0902C18.0871 8.41958 15.3699 4.69042 10.5576 4.69042C7.27472 4.69042 5.77426 6.74018 5.77426 6.74018V5.20216H0V25.4453H5.77426V19.9227C5.77426 19.9227 7.16139 21.4023 10.1333 21.4023ZM95.7984 13.0902C95.7984 11.1243 94.5246 9.78608 92.6279 9.78608C90.7032 9.78608 89.4284 11.1243 89.4284 13.0902C89.4284 14.9392 90.7322 16.3076 92.6279 16.3076C94.5536 16.3076 95.7984 14.9392 95.7984 13.0902ZM92.5427 21.4023C97.0994 21.4023 101.94 18.8974 101.94 12.9187C101.94 7.16616 97.2698 4.69042 92.7413 4.69042C88.0984 4.69042 83.3442 7.25192 83.3442 13.175C83.3442 18.9549 88.0142 21.4023 92.5427 21.4023Z", fill: "black" }))))));
|
|
3515
|
+
}
|
|
3516
|
+
static get style() { return pnSiteFooterCss; }
|
|
3517
|
+
};
|
|
3518
|
+
|
|
3519
|
+
const pnSiteFooterColCss = "pn-site-footer-col{min-width:25%;padding:2.5em 1.5rem 0}pn-site-footer-col ul{list-style-type:none;padding:0;margin:0}pn-site-footer-col li{margin-bottom:1.6rem}pn-site-footer-col a{text-decoration:none;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}pn-site-footer-col p{margin-top:0;margin-bottom:1rem}";
|
|
3520
|
+
|
|
3521
|
+
const PnSiteFooterCol$1 = class extends HTMLElement {
|
|
3522
|
+
constructor() {
|
|
3523
|
+
super();
|
|
3524
|
+
this.__registerHost();
|
|
3525
|
+
}
|
|
3526
|
+
render() {
|
|
3527
|
+
return (h(Host, null, h("slot", null)));
|
|
3528
|
+
}
|
|
3529
|
+
static get style() { return pnSiteFooterColCss; }
|
|
3530
|
+
};
|
|
3531
|
+
|
|
3532
|
+
const languageData = {
|
|
3533
|
+
'sv': {
|
|
3534
|
+
"navlabel": "Webbplatsväljare",
|
|
3535
|
+
},
|
|
3536
|
+
'en': {
|
|
3537
|
+
"navlabel": "Website selector",
|
|
3538
|
+
},
|
|
3539
|
+
'da': {
|
|
3540
|
+
"navlabel": "Webstedsvælger",
|
|
3541
|
+
},
|
|
3542
|
+
'no': {
|
|
3543
|
+
"navlabel": "Nettstedsvelger",
|
|
3544
|
+
},
|
|
3545
|
+
'fi': {
|
|
3546
|
+
"navlabel": "Verkkosivun valitsin",
|
|
3547
|
+
}
|
|
3548
|
+
};
|
|
3549
|
+
|
|
3550
|
+
const pnSiteSelectorCss = "pn-site-selector{display:-ms-flexbox;display:flex;position:relative;-ms-flex-pack:center;justify-content:center}@media screen and (min-width: 75em){pn-site-selector{display:block}}.siteselector-heading{display:block;padding:0;margin-bottom:1.6rem}@media screen and (min-width: 75em){.siteselector-heading{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;margin-top:0.8rem}}.siteselector-list{list-style:none;margin:0;padding:0}";
|
|
3551
|
+
|
|
3552
|
+
const PnSiteSelector$1 = class extends HTMLElement {
|
|
3553
|
+
constructor() {
|
|
3554
|
+
super();
|
|
3555
|
+
this.__registerHost();
|
|
3556
|
+
/* Site selector Button text */
|
|
3557
|
+
this.buttontext = "postnord.se";
|
|
3558
|
+
/* Site selector flyout title */
|
|
3559
|
+
this.heading = "PostNord";
|
|
3560
|
+
/** Specifies which language we want to show navigation in (sv,da,fi,no,en) */
|
|
3561
|
+
this.language = "sv";
|
|
3562
|
+
this.i18n = { navlabel: "Site selector" };
|
|
3563
|
+
}
|
|
3564
|
+
componentWillLoad() {
|
|
3565
|
+
this.setLanguage();
|
|
3566
|
+
}
|
|
3567
|
+
setLanguage() {
|
|
3568
|
+
if (languageData[this.language]) {
|
|
3569
|
+
this.i18n = languageData[this.language];
|
|
3570
|
+
}
|
|
3571
|
+
}
|
|
3572
|
+
render() {
|
|
3573
|
+
return (h(Host, null, h("pn-nav-dropdown", { label: this.buttontext, icon: "angle-small-down" }, h("nav", { class: "siteselector-nav", "aria-label": this.i18n.navlabel }, this.heading ? (h("strong", { class: "siteselector-heading" }, this.heading)) : null, h("ul", { class: "siteselector-list" }, h("slot", null))))));
|
|
3574
|
+
}
|
|
3575
|
+
get hostElement() { return this; }
|
|
3576
|
+
static get style() { return pnSiteSelectorCss; }
|
|
3577
|
+
};
|
|
3578
|
+
|
|
3579
|
+
const pnSiteSelectorItemCss = "pn-site-selector-item{display:block}pn-site-selector-item>div,pn-site-selector-item>a{padding:0.8rem 0;display:-ms-flexbox;display:flex;-ms-flex-flow:column;flex-flow:column;position:relative}.siteselector-item-link{border-radius:0;text-decoration:none;color:#005D92;-ms-flex-direction:row;flex-direction:row}.siteselector-item-link:hover,.siteselector-item-link:focus{background-color:#F3F2F2;color:#005D92;text-decoration:underline;outline:none;-webkit-box-shadow:none;box-shadow:none}.siteselector-item-link:active{background-color:#F3F2F2;color:#00A0D6;outline:none}.siteselector-item-link>span{-ms-flex-positive:1;flex-grow:1}.siteselector-item-link pn-icon{right:3.2rem;height:1.9rem;width:1.9rem;-ms-flex-item-align:center;align-self:center}.siteselector-item-link pn-icon svg{width:100%;height:auto}.siteselector-item-title{display:block}.siteselector-item-description{color:#2D2013;font-size:1.28rem}a:hover>.siteselector-item-description,a:focus>.siteselector-item-description{background-color:#F3F2F2;color:#005D92;text-decoration:underline;outline:none}a:active>.siteselector-item-description{background-color:#F3F2F2;color:#00A0D6;outline:none}";
|
|
3580
|
+
|
|
3581
|
+
const PnSiteSelectorItem$1 = class extends HTMLElement {
|
|
3582
|
+
constructor() {
|
|
3583
|
+
super();
|
|
3584
|
+
this.__registerHost();
|
|
3585
|
+
/* Link URL */
|
|
3586
|
+
this.url = "";
|
|
3587
|
+
/* Link title */
|
|
3588
|
+
this.heading = "";
|
|
3589
|
+
/* Link description */
|
|
3590
|
+
this.description = "";
|
|
3591
|
+
/* Open link in new window */
|
|
3592
|
+
this.newwindow = false;
|
|
3593
|
+
}
|
|
3594
|
+
render() {
|
|
3595
|
+
return (h(Host, { role: "listitem" }, this.url ? (h("a", { class: "siteselector-item-link", href: this.url, target: this.newwindow ? "_blank" : "self", rel: this.newwindow ? "nofollow noopener" : "" }, h("span", null, this.heading && (h("span", { class: "siteselector-item-title" }, this.heading)), this.description && (h("small", { class: "siteselector-item-description" }, this.description))), h("pn-icon", { symbol: "angle-small-right", color: "blue700" }))) : (h("div", null, this.heading && (h("span", { class: "siteselector-item-title" }, this.heading)), this.description && (h("small", { class: "siteselector-item-description" }, this.description))))));
|
|
3596
|
+
}
|
|
3597
|
+
static get style() { return pnSiteSelectorItemCss; }
|
|
481
3598
|
};
|
|
482
3599
|
|
|
483
|
-
const
|
|
484
|
-
const
|
|
485
|
-
const
|
|
3600
|
+
const PnChoiceButton = /*@__PURE__*/proxyCustomElement(PnChoiceButton$1, [4,"pn-choice-button",{"value":[520],"name":[1],"choiceid":[1],"type":[1],"disabled":[4],"checked":[4],"indeterminate":[1028]},[[0,"change","handlechange"]]]);
|
|
3601
|
+
const PnFindServiceAndPrice = /*@__PURE__*/proxyCustomElement(PnfindServiceAndPrice, [0,"pn-find-service-and-price",{"source":[1],"language":[1025],"market":[1025],"filteredItems":[32],"postagetype":[32],"weight":[32],"weightvalue":[32],"deliveryscope":[32],"sourceData":[32]}]);
|
|
3602
|
+
const PnFindServiceAndPriceResult = /*@__PURE__*/proxyCustomElement(PnfindServiceAndPriceResult, [0,"pn-find-service-and-price-result",{"item":[1040],"shownitems":[16],"weightText":[32]}]);
|
|
3603
|
+
const PnLanguageSelector = /*@__PURE__*/proxyCustomElement(PnlanguageSelector, [4,"pn-language-selector",{"value":[1537],"selectedLanguageName":[32],"options":[32],"i18n":[32]}]);
|
|
3604
|
+
const PnLanguageSelectorOption = /*@__PURE__*/proxyCustomElement(PnlanguageSelectorOption, [0,"pn-language-selector-option",{"name":[1],"code":[1],"url":[1],"selected":[4],"currentLanguage":[1,"current-language"]}]);
|
|
3605
|
+
const PnMainnav = /*@__PURE__*/proxyCustomElement(PnMainnav$1, [4,"pn-mainnav",{"market":[1],"language":[1],"navigationId":[1,"navigation-id"],"openMenu":[1028,"open-menu"]},[[0,"language","setLanguage"],[0,"market","setMarket"],[0,"menuLanguageChange","onLanguageChange"],[0,"setmenuopen","setOpenMenu"],[0,"openMenuLevelChange","onOpenMenuLevelChange"]]]);
|
|
3606
|
+
const PnMainnavLevel = /*@__PURE__*/proxyCustomElement(PnMainnavLevel$1, [4,"pn-mainnav-level",{"level":[32],"levelId":[32],"isOpen":[32],"parentName":[32],"parentHref":[32],"parentLinkId":[32],"listCount":[32],"alignment":[32]}]);
|
|
3607
|
+
const PnMainnavLink = /*@__PURE__*/proxyCustomElement(PnMainnavLink$1, [4,"pn-mainnav-link",{"name":[1],"href":[1],"target":[1],"linkid":[1],"levelId":[32],"open":[32],"hasChildren":[32]}]);
|
|
3608
|
+
const PnMainnavList = /*@__PURE__*/proxyCustomElement(PnMainnavList$1, [4,"pn-mainnav-list",{"heading":[1],"linkCount":[32]}]);
|
|
3609
|
+
const PnMarketwebSitefooter = /*@__PURE__*/proxyCustomElement(PnMarketwebSiteheader$2, [0,"pn-marketweb-sitefooter",{"market":[1],"language":[1],"endpoint":[1],"siteDefinition":[32],"footerContent":[32],"i18n":[32],"gotData":[32],"fetchingData":[32]}]);
|
|
3610
|
+
const PnMarketwebSiteheader = /*@__PURE__*/proxyCustomElement(PnMarketwebSiteheader$1, [4,"pn-marketweb-siteheader",{"market":[1],"language":[1],"endpoint":[1],"hideSiteSelector":[1028,"hide-site-selector"],"hideLanguageSelector":[1028,"hide-language-selector"],"hideSearch":[1028,"hide-search"],"hideLogin":[1028,"hide-login"],"i18n":[32],"gotData":[32],"fetchingData":[32],"menuItems":[32],"siteDefinition":[32],"search":[32],"siteSelector":[32],"languageSelector":[32],"loginDialog":[32],"minimizeSearch":[32]},[[9,"resize","handleResize"]]]);
|
|
3611
|
+
const PnMarketwebSiteheaderLogin = /*@__PURE__*/proxyCustomElement(PnMarketwebSiteheaderLogin$1, [0,"pn-marketweb-siteheader-login",{"endpoint":[1],"i18n":[8,"i-1-8n"],"loginDialog":[1040],"loginManager":[32],"loggedIn":[32],"toggleButtonText":[32]}]);
|
|
3612
|
+
const PnMarketwebSiteheaderSearch = /*@__PURE__*/proxyCustomElement(PnMarketwebSiteheaderSearch$1, [0,"pn-marketweb-siteheader-search",{"i18n":[8,"i-1-8n"],"showOnlyLink":[1028,"show-only-link"],"hideSearch":[1028,"hide-search"],"search":[1040]}]);
|
|
3613
|
+
const PnProductPricelist = /*@__PURE__*/proxyCustomElement(PnFindProductPricelist, [4,"pn-product-pricelist",{"source":[1],"language":[1025],"market":[1025],"productid":[1],"filteredItems":[32],"sourceData":[32],"gotData":[32],"loading":[32],"postagetype":[32],"weight":[32],"weightvalue":[32]}]);
|
|
3614
|
+
const PnProductPricelistResult = /*@__PURE__*/proxyCustomElement(PnFindProductPricelistResult, [0,"pn-product-pricelist-result",{"item":[1040],"shownitems":[16],"weightText":[32]}]);
|
|
3615
|
+
const PnProductTile = /*@__PURE__*/proxyCustomElement(PnProductTile$1, [4,"pn-product-tile"]);
|
|
3616
|
+
const PnProductTileInfo = /*@__PURE__*/proxyCustomElement(PnProductTileInfo$1, [0,"pn-product-tile-info",{"label":[1],"text":[1],"icon":[1]}]);
|
|
3617
|
+
const PnProductTilePrice = /*@__PURE__*/proxyCustomElement(PnProductTilePrice$1, [0,"pn-product-tile-price",{"label":[1],"amount":[1],"currency":[1],"url":[1]}]);
|
|
3618
|
+
const PnSiteFooter = /*@__PURE__*/proxyCustomElement(PnSiteFooter$1, [4,"pn-site-footer",{"url":[1]}]);
|
|
3619
|
+
const PnSiteFooterCol = /*@__PURE__*/proxyCustomElement(PnSiteFooterCol$1, [4,"pn-site-footer-col"]);
|
|
3620
|
+
const PnSiteSelector = /*@__PURE__*/proxyCustomElement(PnSiteSelector$1, [4,"pn-site-selector",{"buttontext":[1],"heading":[1],"language":[1],"i18n":[32]}]);
|
|
3621
|
+
const PnSiteSelectorItem = /*@__PURE__*/proxyCustomElement(PnSiteSelectorItem$1, [0,"pn-site-selector-item",{"url":[1],"heading":[1],"description":[1],"newwindow":[4]}]);
|
|
486
3622
|
const defineCustomElements = (opts) => {
|
|
487
3623
|
if (typeof customElements !== 'undefined') {
|
|
488
3624
|
[
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
3625
|
+
PnChoiceButton,
|
|
3626
|
+
PnFindServiceAndPrice,
|
|
3627
|
+
PnFindServiceAndPriceResult,
|
|
3628
|
+
PnLanguageSelector,
|
|
3629
|
+
PnLanguageSelectorOption,
|
|
3630
|
+
PnMainnav,
|
|
3631
|
+
PnMainnavLevel,
|
|
3632
|
+
PnMainnavLink,
|
|
3633
|
+
PnMainnavList,
|
|
3634
|
+
PnMarketwebSitefooter,
|
|
3635
|
+
PnMarketwebSiteheader,
|
|
3636
|
+
PnMarketwebSiteheaderLogin,
|
|
3637
|
+
PnMarketwebSiteheaderSearch,
|
|
3638
|
+
PnProductPricelist,
|
|
3639
|
+
PnProductPricelistResult,
|
|
3640
|
+
PnProductTile,
|
|
3641
|
+
PnProductTileInfo,
|
|
3642
|
+
PnProductTilePrice,
|
|
3643
|
+
PnSiteFooter,
|
|
3644
|
+
PnSiteFooterCol,
|
|
3645
|
+
PnSiteSelector,
|
|
3646
|
+
PnSiteSelectorItem
|
|
492
3647
|
].forEach(cmp => {
|
|
493
3648
|
if (!customElements.get(cmp.is)) {
|
|
494
3649
|
customElements.define(cmp.is, cmp, opts);
|
|
@@ -497,4 +3652,4 @@ const defineCustomElements = (opts) => {
|
|
|
497
3652
|
}
|
|
498
3653
|
};
|
|
499
3654
|
|
|
500
|
-
export {
|
|
3655
|
+
export { PnChoiceButton, PnFindServiceAndPrice, PnFindServiceAndPriceResult, PnLanguageSelector, PnLanguageSelectorOption, PnMainnav, PnMainnavLevel, PnMainnavLink, PnMainnavList, PnMarketwebSitefooter, PnMarketwebSiteheader, PnMarketwebSiteheaderLogin, PnMarketwebSiteheaderSearch, PnProductPricelist, PnProductPricelistResult, PnProductTile, PnProductTileInfo, PnProductTilePrice, PnSiteFooter, PnSiteFooterCol, PnSiteSelector, PnSiteSelectorItem, defineCustomElements };
|