ov-configurator 1.0.0

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/README.md ADDED
@@ -0,0 +1,170 @@
1
+ # ov-cart
2
+
3
+ Universal frontend shopping cart module. Exports `createCart(options)`.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install ov-cart
9
+ ```
10
+
11
+ ## CDN
12
+
13
+ No build step required — include directly via [jsDelivr](https://www.jsdelivr.com/) or [unpkg](https://unpkg.com/):
14
+
15
+ ```html
16
+ <script src="https://cdn.jsdelivr.net/npm/ov-cart/dist/ov-cart.iife.js"></script>
17
+ <script>
18
+ const cart = OvCart.createCart({ element: '#cart', currency: '$' })
19
+ </script>
20
+ ```
21
+
22
+ The IIFE bundle exposes a global `OvCart` with `createCart` and `Cart`.
23
+
24
+ ## Usage
25
+
26
+ ```ts
27
+ import { createCart } from 'ov-cart'
28
+
29
+ const cart = createCart({
30
+ element: '#my-cart',
31
+ currency: '$',
32
+ storageKey: 'shop-cart',
33
+ attr: 'mycart', // uses data-mycart-* instead of data-cart-*
34
+ classes: {
35
+ countButton: 'btn btn-sm',
36
+ },
37
+ onUpdate(state) {
38
+ // state: { products, productsCount, totalSum, count, isEmpty }
39
+ if (state.isEmpty) MicroModal.close('modal-cart')
40
+ },
41
+ })
42
+
43
+ if (window.clearCart) cart.clear()
44
+ ```
45
+
46
+ ## Multiple carts on the same page
47
+
48
+ Each `createCart()` call is an independent instance. When using multiple carts on a page, assign different `attr` values (and `storageKey` if separate storage is needed).
49
+
50
+ ```ts
51
+ const cartA = createCart({ element: '#cart-a', attr: 'cart-a', storageKey: 'cart-a' })
52
+ const cartB = createCart({ element: '#cart-b', attr: 'cart-b', storageKey: 'cart-b' })
53
+ ```
54
+
55
+ ## Options
56
+
57
+ | option | type | default | description |
58
+ |---|---|---|---|
59
+ | `element` | `string \| Element` | `'#cart'` | cart render container |
60
+ | `icon` | `string \| Element \| null` | `'#cart-icon'` | icon element with counter and total |
61
+ | `currency` | `string` | `'zł'` | currency symbol |
62
+ | `storageKey` | `string` | `'cart'` | `localStorage` key |
63
+ | `attr` | `string` | `'cart'` | data-attribute prefix (`'cart'` → `data-cart-*`) |
64
+ | `shouldAnimateIconSum` | `function(state, trigger)` | `() => true` | controls whether the icon sum animation plays |
65
+ | `renderItem` | `function(id, product, count, currency)` | built-in template | returns HTML string for a single cart item |
66
+ | `renderFooter` | `function(total, currency)` | built-in template | returns HTML string for the cart footer |
67
+ | `onUpdate` | `function(state)` | `null` | called after every cart change |
68
+ | `validateCart` | `function(products)` | `null` | called on init after loading from `localStorage`; receives and returns `CartProductEntry[]` — use to filter out stale items |
69
+ | `classes` | `object` | Tailwind classes | partial override of CSS classes (unset keys fall back to defaults) |
70
+ | `text` | `object` | see below | partial override of text strings |
71
+
72
+ ## Default CSS classes (`classes`)
73
+
74
+ | key | description |
75
+ |---|---|
76
+ | `list` | `<ul>` product list |
77
+ | `item` | `<li>` product row |
78
+ | `itemInner` | inner wrapper (flex container) |
79
+ | `itemContent` | block with title and description |
80
+ | `itemTitle` | product title |
81
+ | `itemDescription` | product description |
82
+ | `itemImage` | product image |
83
+ | `itemPriceBox` | price block |
84
+ | `itemPriceHidden` | hidden `<span>` with price (for form submission) |
85
+ | `controls` | +/− button group |
86
+ | `countButton` | +/− buttons |
87
+ | `countSpan` | `<span>` with item count |
88
+ | `removeButton` | remove item button |
89
+ | `footer` | cart total block |
90
+ | `iconHidden` | class applied to hide the cart icon |
91
+ | `iconSumVisible` | class applied to animate the icon sum |
92
+
93
+ ## Default text (`text`)
94
+
95
+ | key | default | description |
96
+ |---|---|---|
97
+ | `sumLabel` | `'Total:'` | label before the total sum |
98
+ | `orderInputName` | `'order-sum'` | `name` attribute of the hidden order sum input |
99
+ | `addButton` | `'+'` | increment button text |
100
+ | `removeButton` | `'−'` | decrement button text |
101
+ | `clearButton` | `'✕'` | remove item button text |
102
+
103
+ ### `shouldAnimateIconSum(state, trigger)`
104
+
105
+ Called before the icon sum animation. Return `false` to suppress the animation. Not called on initial render.
106
+
107
+ - `state` — current cart state `{ products, productsCount, totalSum, count, isEmpty }`
108
+ - `trigger` — the `<button>` element that triggered the change
109
+
110
+ ```ts
111
+ shouldAnimateIconSum: () => true
112
+ ```
113
+
114
+ ### `validateCart(products)`
115
+
116
+ Called once on initialization, after restoring the cart from `localStorage`. Receives and must return a `CartProductEntry[]` array (`CartProduct & { id: string }`). Use it to filter or update stale products. The result is saved back to `localStorage`.
117
+
118
+ ```ts
119
+ validateCart(products) {
120
+ const validIds = new Set(['sku-1', 'sku-3'])
121
+ return products.filter(p => validIds.has(p.id))
122
+ }
123
+ ```
124
+
125
+ ## Data attributes
126
+
127
+ By default the prefix is `data-cart-`. With `attr: 'mycart'` it becomes `data-mycart-`.
128
+
129
+ **Buttons:**
130
+ - `data-cart-action="add"` — increment item
131
+ - `data-cart-action="remove"` — decrement item
132
+ - `data-cart-action="clear"` — remove item from cart
133
+
134
+ **Item container:**
135
+ - `data-cart-item="<id>"` — product identifier
136
+
137
+ **Item parameters** (on descendants of `data-cart-item`):
138
+ - `data-cart-item-title` — name (attribute value, or `"self"` to use `textContent`)
139
+ - `data-cart-item-price` — price
140
+ - `data-cart-item-image` — image URL
141
+ - `data-cart-item-description` — description (multiline, separated by `\n`)
142
+ - `data-cart-item-params` — additional parameters
143
+
144
+ **Icon** (`icon`):
145
+ - `data-cart-icon-count` — element displaying item count
146
+ - `data-cart-icon-sum` — element displaying the total (must contain a `<span>`)
147
+
148
+ > All attributes use the prefix from the `attr` option. With `attr: 'mycart'` → `data-mycart-action`, `data-mycart-item`, `data-mycart-icon-count`, etc.
149
+
150
+
151
+ ```js
152
+ import { createCart } from '../../libs/cart/cart.js'
153
+
154
+ const cart = createCart({
155
+ element: '#my-cart',
156
+ currency: '₽',
157
+ storageKey: 'shop-cart',
158
+ attr: 'mycart', // data-mycart-* вместо data-cart-*
159
+ classes: {
160
+ countButton: 'btn btn-sm',
161
+ },
162
+ onUpdate(state) {
163
+ // state: { products, productsCount, totalSum, count, isEmpty }
164
+ if (state.isEmpty) MicroModal.close('modal-cart')
165
+ },
166
+ })
167
+
168
+ if (window.clearCart) cart.clear()
169
+ ```
170
+
@@ -0,0 +1,60 @@
1
+ import { CalculatorOptions, FieldOptions, SectionOptions } from './types';
2
+ declare const fieldTypes: {
3
+ readonly DATA_ATTRIBUTE: "data";
4
+ readonly CUSTOM: "custom";
5
+ readonly DEFAULT: "default";
6
+ };
7
+ type FieldType = (typeof fieldTypes)[keyof typeof fieldTypes];
8
+ interface GetNodeOptions {
9
+ prefix: string;
10
+ parentNode: HTMLElement;
11
+ type?: FieldType;
12
+ }
13
+ declare class Field<TData = unknown> {
14
+ selector: string;
15
+ options: Required<FieldOptions<TData>>;
16
+ node: HTMLElement | null;
17
+ animationId: number;
18
+ prevValue: unknown;
19
+ constructor(options: FieldOptions<TData>);
20
+ getNode(options: GetNodeOptions): HTMLElement | null;
21
+ changeValue(value: unknown): void;
22
+ animateBlock(value: unknown): void;
23
+ animateNumber(to: number): void;
24
+ }
25
+ export default class Calculator<TData = unknown> {
26
+ static fieldTypes: {
27
+ readonly DATA_ATTRIBUTE: "data";
28
+ readonly CUSTOM: "custom";
29
+ readonly DEFAULT: "default";
30
+ };
31
+ static animatedNodeTypes: {
32
+ readonly PARENT: "parent";
33
+ readonly SELF: "self";
34
+ readonly CLOSEST: "closest";
35
+ };
36
+ savedValues: Record<string, unknown>;
37
+ values: Record<string, string>;
38
+ node: HTMLElement | null;
39
+ options: CalculatorOptions<TData> & {
40
+ prefix: string;
41
+ stylePrefix: string;
42
+ dataAttributePrefix: string;
43
+ };
44
+ data: TData | null;
45
+ fields: Field<TData>[];
46
+ private form;
47
+ constructor(options: CalculatorOptions<TData>);
48
+ addField(field: FieldOptions<TData>): void;
49
+ addSection(section: SectionOptions): void;
50
+ init(): void;
51
+ getValues(): Record<string, string>;
52
+ changeHandler(form: HTMLFormElement): void;
53
+ saveValue(key: string, value: unknown): void;
54
+ getValue(key: string): unknown;
55
+ getHTML(): string;
56
+ getSectionHTML(options: SectionOptions): string;
57
+ renderInNode(node: HTMLElement): void;
58
+ refresh(): void;
59
+ }
60
+ export {};
@@ -0,0 +1,11 @@
1
+ import { DataSource } from './types';
2
+ export declare function getOptions(dataSource: DataSource, element: HTMLElement): {
3
+ data: unknown;
4
+ uniqId: string;
5
+ id: string;
6
+ placeNode: HTMLElement;
7
+ } | null;
8
+ export declare function queryByPath(data: unknown, path: string, values?: Record<string, string>): unknown;
9
+ export declare function initConfigurator(dataSource: DataSource, element: HTMLElement): void;
10
+ /** Alias for {@link initConfigurator} */
11
+ export declare const Configurator: typeof initConfigurator;
@@ -0,0 +1,3 @@
1
+ export { default as Calculator } from './calculator';
2
+ export { initConfigurator, getOptions, queryByPath } from './configurator';
3
+ export type * from './types';
@@ -0,0 +1,30 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});function e(e,t){this.v=e,this.k=t}function t(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function n(e){if(Array.isArray(e))return t(e)}function r(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function i(e,t,n){return t=d(t),y(e,m()?Reflect.construct(t,n||[],d(e).constructor):t.apply(e,n))}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function o(e,t,n){if(m())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var i=new(e.bind.apply(e,r));return n&&b(i,n.prototype),i}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,C(r.key),r)}}function c(e,t,n){return t&&s(e.prototype,t),n&&s(e,n),Object.defineProperty(e,`prototype`,{writable:!1}),e}function l(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=T(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||n.return==null||n.return()}finally{if(s)throw a}}}}function u(e,t,n){return(t=C(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}function f(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,`prototype`,{writable:!1}),t&&b(e,t)}function p(e){try{return Function.toString.call(e).indexOf(`[native code]`)!==-1}catch(t){return typeof e==`function`}}function m(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(m=function(){return!!e})()}function h(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function g(){throw TypeError(`Invalid attempt to spread non-iterable instance.
3
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function v(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?_(Object(n),!0).forEach(function(t){u(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function y(e,t){if(t&&(typeof t==`object`||typeof t==`function`))return t;if(t!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return r(e)}function b(e,t){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},b(e,t)}function x(e){return n(e)||h(e)||T(e)||g()}function S(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function C(e){var t=S(e,`string`);return typeof t==`symbol`?t:t+``}function w(e){"@babel/helpers - typeof";return w=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},w(e)}function T(e,n){if(e){if(typeof e==`string`)return t(e,n);var r={}.toString.call(e).slice(8,-1);return r===`Object`&&e.constructor&&(r=e.constructor.name),r===`Map`||r===`Set`?Array.from(e):r===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?t(e,n):void 0}}function E(t){var n,r;function i(n,r){try{var o=t[n](r),s=o.value,c=s instanceof e;Promise.resolve(c?s.v:s).then(function(e){if(c){var r=n===`return`&&s.k?n:`next`;if(!s.k||e.done)return i(r,e);e=t[r](e).value}a(!!o.done,e)},function(e){i(`throw`,e)})}catch(e){a(2,e)}}function a(e,t){e===2?n.reject(t):n.resolve({value:t,done:e}),(n=n.next)?i(n.key,n.arg):r=null}this._invoke=function(e,t){return new Promise(function(a,o){var s={key:e,arg:t,resolve:a,reject:o,next:null};r?r=r.next=s:(n=r=s,i(e,t))})},typeof t.return!=`function`&&(this.return=void 0)}E.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},E.prototype.next=function(e){return this._invoke(`next`,e)},E.prototype.throw=function(e){return this._invoke(`throw`,e)},E.prototype.return=function(e){return this._invoke(`return`,e)};function D(e){var t=typeof Map==`function`?new Map:void 0;return D=function(e){if(e===null||!p(e))return e;if(typeof e!=`function`)throw TypeError(`Super expression must either be null or a function`);if(t!==void 0){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return o(e,arguments,d(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),b(n,e)},D(e)}var O;(function(){var e=Number;e.isNaN||(e.isNaN=function(e){return typeof e==`number`&&isNaN(e)}),Array.prototype.find||(Array.prototype.find=function(e,t){if(this==null)throw TypeError(`Array.prototype.find called on null or undefined`);if(typeof e!=`function`)throw TypeError(`predicate must be a function`);for(var n=Object(this),r=n.length>>>0,i=0;i<r;i++){var a=n[i];if(e.call(t,a,i,n))return a}})})();var k={DATA_ATTRIBUTE:`data`,CUSTOM:`custom`,DEFAULT:`default`},A={PARENT:`parent`,SELF:`self`,CLOSEST:`closest`},j=function(){function e(t){a(this,e),this.node=null,this.animationId=0,this.prevValue=void 0;var n=t.selector;this.selector=n,this.options=v({animated:!1,duration:800,dots:0,dataKey:n,calculateFunction:function(){return null},attribute:!1,animation:[`animate__faster`,`animate__pulse`],animatedNode:A.PARENT,animatedNodeSelector:``},t)}return c(e,[{key:`getNode`,value:function(e){var t=e.prefix,n=e.parentNode,r=e.type;return(r===void 0?k.DEFAULT:r)===k.CUSTOM?this.node=n.querySelector(this.options.selector):(this.node=n.querySelector(`[data-${t}="${this.options.selector}"]`),!this.node&&this.options.attribute&&n.getAttribute(`data-${t}`)===this.options.selector&&(this.node=n)),this.node}},{key:`changeValue`,value:function(e){if(this.node){if(this.animateBlock(e),this.options.attribute){var t=this.node.dataset.calcAttribute;t&&this.node.setAttribute(t,String(e))}else{if(Number.isNaN(Number(e))){this.node.innerHTML=String(e);return}this.animateNumber(Number(e))}this.prevValue=e}}},{key:`animateBlock`,value:function(e){var t,n,r;if(e!==this.prevValue){var i=this.options,a=i.animated,o=i.animation,s=i.animatedNode,c=i.animatedNodeSelector,l=null;switch(s){case A.SELF:l=this.node;break;case A.PARENT:l=(t=this.node)==null?void 0:t.parentNode;break;case A.CLOSEST:l=(n=(r=this.node)==null?void 0:r.closest(c))==null?null:n;break}if(a&&l){var u,d=[`animate__animated`].concat(x(o)),f=function(){var e;(e=l.classList).remove.apply(e,x(d))};(u=l.classList).add.apply(u,x(d)),l.addEventListener(`webkitAnimationEnd`,f),l.addEventListener(`mozAnimationEnd`,f),l.addEventListener(`MSAnimationEnd`,f),l.addEventListener(`oanimationend`,f),l.addEventListener(`animationend`,f)}}}},{key:`animateNumber`,value:function(e){var t=this,n=this.options,r=n.duration,i=r===void 0?800:r,a=n.dots,o=a===void 0?0:a,s=this.node;window.cancelAnimationFrame(this.animationId);var c=Number(s.textContent);c=Number.isNaN(c)?0:c;var l=e-c,u=l>0,d=null,f=function(n){d===null&&(d=n);var r=n-d;s.textContent=p(r).toFixed(o),r<i?t.animationId=window.requestAnimationFrame(f):(s.textContent=e.toFixed(m(e)),window.cancelAnimationFrame(t.animationId))};function p(t){var n=c+t*l/i;if(u){if(n>e)return e}else if(n<e)return e;return n}function m(e){var t=String(e);return t.includes(`.`)?t.length-1>o?o:t.length-1:0}this.animationId=window.requestAnimationFrame(f)}}])}(),M=function(){function e(t){a(this,e),this.savedValues={},this.values={},this.node=null;var n=t.editableFields,r=n===void 0?[]:n,i=t.data,o=i===void 0?null:i;this.options=v({editableFields:[],prefix:`card`,data:null,stylePrefix:`calculator`,dataAttributePrefix:`calc`},t),this.data=o,this.fields=r.map(function(e){return new j(e)})}return c(e,[{key:`addField`,value:function(e){this.fields.push(new j(e))}},{key:`addSection`,value:function(e){var t,n=((t=this.options.sectionsOptions)==null?[]:t).concat([e]);this.options.sectionsOptions=n}},{key:`init`,value:function(){var e=this;if(this.data){var t=this.options,n=t.parentSelector,r=t.dataAttributePrefix,i=t.stylePrefix,a=document.querySelector(n);this.fields.forEach(function(e){return e.getNode({prefix:r,parentNode:a})}),this.form=a.querySelector(`.${i}`),this.form.addEventListener(`change`,function(){return e.changeHandler(e.form)}),this.changeHandler(this.form)}}},{key:`getValues`,value:function(){return this.values}},{key:`changeHandler`,value:function(e){var t=this,n=Array.from(e.querySelectorAll(`input`)).filter(function(e){return e.checked}).reduce(function(e,t){var n=t.name.split(`-`);return v(v({},e),{},u({},n[n.length-1],t.value))},{});this.fields.forEach(function(e){try{var r=e.options.calculateFunction(n,t.data);if(r===null)return;t.saveValue(e.selector,r),e.changeValue(r==null?`--`:r)}catch(e){console.warn(e)}}),this.values=n}},{key:`saveValue`,value:function(e,t){this.savedValues[e]=t}},{key:`getValue`,value:function(e){return this.savedValues[e]}},{key:`getHTML`,value:function(){var e=this;if(!this.data)return``;var t=this.options,n=t.stylePrefix,r=t.sectionsOptions;return`
4
+ <form action="/" class="${n}">
5
+ ${(r==null?[]:r).map(function(t){return e.getSectionHTML(t)}).join(``)}
6
+ </form>
7
+ `}},{key:`getSectionHTML`,value:function(e){var t,n=this.options,r=n.stylePrefix,i=n.prefix,a=n.id,o=e.title,s=o===void 0?``:o,c=e.type,l=e.inputs,u=e.className,d=u===void 0?``:u,f=e.checked,p=f===void 0?!0:f,m=e.inputType,h=m===void 0?`radio`:m;if(typeof l==`function`&&(l=l(this.data)),!l.length)return``;var g=l[0].value,_=(t=this.getValues()[c])==null?g:t;return l.find(function(e){return e.value===_})||(_=g),`
8
+ <div class="${r}__section">
9
+ ${s&&`<h4 class="${r}__section-title">${s}:</h4>`}
10
+ <div class="${r}__section-row">
11
+ ${l.map(function(e,t){var n=_===e.value?`checked`:``;return`
12
+ <div class="${r}__section-col ${d}">
13
+ <input
14
+ ${p?n:``}
15
+ name="${i}-${a}-${c}"
16
+ id="${i}-${a}-${c}-${t}"
17
+ type="${h}"
18
+ value="${e.value}"
19
+ />
20
+ <label
21
+ for="${i}-${a}-${c}-${t}"
22
+ >${e.label}</label
23
+ >
24
+ </div>
25
+ `}).join(``)}
26
+ </div>
27
+ </div>
28
+ `}},{key:`renderInNode`,value:function(e){e.innerHTML=this.getHTML(),this.node=e}},{key:`refresh`,value:function(){this.node&&(this.renderInNode(this.node),this.init())}}])}();O=M,O.fieldTypes=k,O.animatedNodeTypes=A;var N=function(){function e(){a(this,e)}return c(e,[{key:`add`,value:function(e,t,n){if(typeof arguments[0]!=`string`)for(var r in arguments[0])this.add(r,arguments[0][r],arguments[1]);else (Array.isArray(e)?e:[e]).forEach(function(e){this[e]=this[e]||[],t&&this[e][n?`unshift`:`push`](t)},this)}},{key:`run`,value:function(e,t){this[e]=this[e]||[],this[e].forEach(function(e){e.call(t&&t.context?t.context:t,t)})}}])}(),P=function(){function e(t){a(this,e),this.jsep=t,this.registered={}}return c(e,[{key:`register`,value:function(){for(var e=this,t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];n.forEach(function(t){if(w(t)!==`object`||!t.name||!t.init)throw Error(`Invalid JSEP plugin format`);e.registered[t.name]||(t.init(e.jsep),e.registered[t.name]=t)})}}])}(),F=function(){function e(t){a(this,e),this.expr=t,this.index=0}return c(e,[{key:`char`,get:function(){return this.expr.charAt(this.index)}},{key:`code`,get:function(){return this.expr.charCodeAt(this.index)}},{key:`throwError`,value:function(e){var t=Error(e+` at character `+this.index);throw t.index=this.index,t.description=e,t}},{key:`runHook`,value:function(t,n){if(e.hooks[t]){var r={context:this,node:n};return e.hooks.run(t,r),r.node}return n}},{key:`searchHook`,value:function(t){if(e.hooks[t]){var n={context:this};return e.hooks[t].find(function(e){return e.call(n.context,n),n.node}),n.node}}},{key:`gobbleSpaces`,value:function(){for(var t=this.code;t===e.SPACE_CODE||t===e.TAB_CODE||t===e.LF_CODE||t===e.CR_CODE;)t=this.expr.charCodeAt(++this.index);this.runHook(`gobble-spaces`)}},{key:`parse`,value:function(){this.runHook(`before-all`);var t=this.gobbleExpressions(),n=t.length===1?t[0]:{type:e.COMPOUND,body:t};return this.runHook(`after-all`,n)}},{key:`gobbleExpressions`,value:function(t){for(var n=[],r,i;this.index<this.expr.length;)if(r=this.code,r===e.SEMCOL_CODE||r===e.COMMA_CODE)this.index++;else if(i=this.gobbleExpression())n.push(i);else if(this.index<this.expr.length){if(r===t)break;this.throwError(`Unexpected "`+this.char+`"`)}return n}},{key:`gobbleExpression`,value:function(){var e=this.searchHook(`gobble-expression`)||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook(`after-expression`,e)}},{key:`gobbleBinaryOp`,value:function(){this.gobbleSpaces();for(var t=this.expr.substr(this.index,e.max_binop_len),n=t.length;n>0;){if(e.binary_ops.hasOwnProperty(t)&&(!e.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!e.isIdentifierPart(this.expr.charCodeAt(this.index+t.length))))return this.index+=n,t;t=t.substr(0,--n)}return!1}},{key:`gobbleBinaryExpression`,value:function(){var t,n,r,i,a,o=this.gobbleToken(),s,c,l;if(!o||(n=this.gobbleBinaryOp(),!n))return o;for(a={value:n,prec:e.binaryPrecedence(n),right_a:e.right_associative.has(n)},s=this.gobbleToken(),s||this.throwError(`Expected expression after `+n),i=[o,a,s];n=this.gobbleBinaryOp();){if(r=e.binaryPrecedence(n),r===0){this.index-=n.length;break}a={value:n,prec:r,right_a:e.right_associative.has(n)},l=n;for(var u=function(e){return a.right_a&&e.right_a?r>e.prec:r<=e.prec};i.length>2&&u(i[i.length-2]);)s=i.pop(),n=i.pop().value,o=i.pop(),t={type:e.BINARY_EXP,operator:n,left:o,right:s},i.push(t);t=this.gobbleToken(),t||this.throwError(`Expected expression after `+l),i.push(a,t)}for(c=i.length-1,t=i[c];c>1;)t={type:e.BINARY_EXP,operator:i[c-1].value,left:i[c-2],right:t},c-=2;return t}},{key:`gobbleToken`,value:function(){var t,n,r,i;if(this.gobbleSpaces(),i=this.searchHook(`gobble-token`),i)return this.runHook(`after-token`,i);if(t=this.code,e.isDecimalDigit(t)||t===e.PERIOD_CODE)return this.gobbleNumericLiteral();if(t===e.SQUOTE_CODE||t===e.DQUOTE_CODE)i=this.gobbleStringLiteral();else if(t===e.OBRACK_CODE)i=this.gobbleArray();else{for(n=this.expr.substr(this.index,e.max_unop_len),r=n.length;r>0;){if(e.unary_ops.hasOwnProperty(n)&&(!e.isIdentifierStart(this.code)||this.index+n.length<this.expr.length&&!e.isIdentifierPart(this.expr.charCodeAt(this.index+n.length)))){this.index+=r;var a=this.gobbleToken();return a||this.throwError(`missing unaryOp argument`),this.runHook(`after-token`,{type:e.UNARY_EXP,operator:n,argument:a,prefix:!0})}n=n.substr(0,--r)}e.isIdentifierStart(t)?(i=this.gobbleIdentifier(),e.literals.hasOwnProperty(i.name)?i={type:e.LITERAL,value:e.literals[i.name],raw:i.name}:i.name===e.this_str&&(i={type:e.THIS_EXP})):t===e.OPAREN_CODE&&(i=this.gobbleGroup())}return i?(i=this.gobbleTokenProperty(i),this.runHook(`after-token`,i)):this.runHook(`after-token`,!1)}},{key:`gobbleTokenProperty`,value:function(t){this.gobbleSpaces();for(var n=this.code;n===e.PERIOD_CODE||n===e.OBRACK_CODE||n===e.OPAREN_CODE||n===e.QUMARK_CODE;){var r=void 0;if(n===e.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==e.PERIOD_CODE)break;r=!0,this.index+=2,this.gobbleSpaces(),n=this.code}this.index++,n===e.OBRACK_CODE?(t={type:e.MEMBER_EXP,computed:!0,object:t,property:this.gobbleExpression()},t.property||this.throwError(`Unexpected "`+this.char+`"`),this.gobbleSpaces(),n=this.code,n!==e.CBRACK_CODE&&this.throwError(`Unclosed [`),this.index++):n===e.OPAREN_CODE?t={type:e.CALL_EXP,arguments:this.gobbleArguments(e.CPAREN_CODE),callee:t}:(n===e.PERIOD_CODE||r)&&(r&&this.index--,this.gobbleSpaces(),t={type:e.MEMBER_EXP,computed:!1,object:t,property:this.gobbleIdentifier()}),r&&(t.optional=!0),this.gobbleSpaces(),n=this.code}return t}},{key:`gobbleNumericLiteral`,value:function(){for(var t=``,n,r;e.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);if(this.code===e.PERIOD_CODE)for(t+=this.expr.charAt(this.index++);e.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);if(n=this.char,n===`e`||n===`E`){for(t+=this.expr.charAt(this.index++),n=this.char,(n===`+`||n===`-`)&&(t+=this.expr.charAt(this.index++));e.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);e.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError(`Expected exponent (`+t+this.char+`)`)}return r=this.code,e.isIdentifierStart(r)?this.throwError(`Variable names cannot start with a number (`+t+this.char+`)`):(r===e.PERIOD_CODE||t.length===1&&t.charCodeAt(0)===e.PERIOD_CODE)&&this.throwError(`Unexpected period`),{type:e.LITERAL,value:parseFloat(t),raw:t}}},{key:`gobbleStringLiteral`,value:function(){for(var t=``,n=this.index,r=this.expr.charAt(this.index++),i=!1;this.index<this.expr.length;){var a=this.expr.charAt(this.index++);if(a===r){i=!0;break}else if(a===`\\`)switch(a=this.expr.charAt(this.index++),a){case`n`:t+=`
29
+ `;break;case`r`:t+=`\r`;break;case`t`:t+=` `;break;case`b`:t+=`\b`;break;case`f`:t+=`\f`;break;case`v`:t+=`\v`;break;default:t+=a}else t+=a}return i||this.throwError(`Unclosed quote after "`+t+`"`),{type:e.LITERAL,value:t,raw:this.expr.substring(n,this.index)}}},{key:`gobbleIdentifier`,value:function(){var t=this.code,n=this.index;for(e.isIdentifierStart(t)?this.index++:this.throwError(`Unexpected `+this.char);this.index<this.expr.length&&(t=this.code,e.isIdentifierPart(t));)this.index++;return{type:e.IDENTIFIER,name:this.expr.slice(n,this.index)}}},{key:`gobbleArguments`,value:function(t){for(var n=[],r=!1,i=0;this.index<this.expr.length;){this.gobbleSpaces();var a=this.code;if(a===t){r=!0,this.index++,t===e.CPAREN_CODE&&i&&i>=n.length&&this.throwError(`Unexpected token `+String.fromCharCode(t));break}else if(a===e.COMMA_CODE){if(this.index++,i++,i!==n.length){if(t===e.CPAREN_CODE)this.throwError(`Unexpected token ,`);else if(t===e.CBRACK_CODE)for(var o=n.length;o<i;o++)n.push(null)}}else if(n.length!==i&&i!==0)this.throwError(`Expected comma`);else{var s=this.gobbleExpression();(!s||s.type===e.COMPOUND)&&this.throwError(`Expected comma`),n.push(s)}}return r||this.throwError(`Expected `+String.fromCharCode(t)),n}},{key:`gobbleGroup`,value:function(){this.index++;var t=this.gobbleExpressions(e.CPAREN_CODE);if(this.code===e.CPAREN_CODE)return this.index++,t.length===1?t[0]:t.length?{type:e.SEQUENCE_EXP,expressions:t}:!1;this.throwError(`Unclosed (`)}},{key:`gobbleArray`,value:function(){return this.index++,{type:e.ARRAY_EXP,elements:this.gobbleArguments(e.CBRACK_CODE)}}}],[{key:`version`,get:function(){return`1.4.0`}},{key:`toString`,value:function(){return`JavaScript Expression Parser (JSEP) v`+e.version}},{key:`addUnaryOp`,value:function(t){return e.max_unop_len=Math.max(t.length,e.max_unop_len),e.unary_ops[t]=1,e}},{key:`addBinaryOp`,value:function(t,n,r){return e.max_binop_len=Math.max(t.length,e.max_binop_len),e.binary_ops[t]=n,r?e.right_associative.add(t):e.right_associative.delete(t),e}},{key:`addIdentifierChar`,value:function(t){return e.additional_identifier_chars.add(t),e}},{key:`addLiteral`,value:function(t,n){return e.literals[t]=n,e}},{key:`removeUnaryOp`,value:function(t){return delete e.unary_ops[t],t.length===e.max_unop_len&&(e.max_unop_len=e.getMaxKeyLen(e.unary_ops)),e}},{key:`removeAllUnaryOps`,value:function(){return e.unary_ops={},e.max_unop_len=0,e}},{key:`removeIdentifierChar`,value:function(t){return e.additional_identifier_chars.delete(t),e}},{key:`removeBinaryOp`,value:function(t){return delete e.binary_ops[t],t.length===e.max_binop_len&&(e.max_binop_len=e.getMaxKeyLen(e.binary_ops)),e.right_associative.delete(t),e}},{key:`removeAllBinaryOps`,value:function(){return e.binary_ops={},e.max_binop_len=0,e}},{key:`removeLiteral`,value:function(t){return delete e.literals[t],e}},{key:`removeAllLiterals`,value:function(){return e.literals={},e}},{key:`parse`,value:function(t){return new e(t).parse()}},{key:`getMaxKeyLen`,value:function(e){return Math.max.apply(Math,[0].concat(x(Object.keys(e).map(function(e){return e.length}))))}},{key:`isDecimalDigit`,value:function(e){return e>=48&&e<=57}},{key:`binaryPrecedence`,value:function(t){return e.binary_ops[t]||0}},{key:`isIdentifierStart`,value:function(t){return t>=65&&t<=90||t>=97&&t<=122||t>=128&&!e.binary_ops[String.fromCharCode(t)]||e.additional_identifier_chars.has(String.fromCharCode(t))}},{key:`isIdentifierPart`,value:function(t){return e.isIdentifierStart(t)||e.isDecimalDigit(t)}}])}(),I=new N;Object.assign(F,{hooks:I,plugins:new P(F),COMPOUND:`Compound`,SEQUENCE_EXP:`SequenceExpression`,IDENTIFIER:`Identifier`,MEMBER_EXP:`MemberExpression`,LITERAL:`Literal`,THIS_EXP:`ThisExpression`,CALL_EXP:`CallExpression`,UNARY_EXP:`UnaryExpression`,BINARY_EXP:`BinaryExpression`,ARRAY_EXP:`ArrayExpression`,TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"??":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10,"**":11},right_associative:new Set([`**`]),additional_identifier_chars:new Set([`$`,`_`]),literals:{true:!0,false:!1,null:null},this_str:`this`}),F.max_unop_len=F.getMaxKeyLen(F.unary_ops),F.max_binop_len=F.getMaxKeyLen(F.binary_ops);var L=function(e){return new F(e).parse()},R=Object.getOwnPropertyNames(c(function e(){a(this,e)}));Object.getOwnPropertyNames(F).filter(function(e){return!R.includes(e)&&L[e]===void 0}).forEach(function(e){L[e]=F[e]}),L.Jsep=F;var z=`ConditionalExpression`;L.plugins.register({name:`ternary`,init:function(e){e.hooks.add(`after-expression`,function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;var n=t.node,r=this.gobbleExpression();if(r||this.throwError(`Expected expression`),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;var i=this.gobbleExpression();if(i||this.throwError(`Expected expression`),t.node={type:z,test:n,consequent:r,alternate:i},n.operator&&e.binary_ops[n.operator]<=.9){for(var a=n;a.right.operator&&e.binary_ops[a.right.operator]<=.9;)a=a.right;t.node.test=a.right,a.right=t.node,t.node=n}}else this.throwError(`Expected :`)}})}});var B=47,V=92,H={name:`regex`,init:function(e){e.hooks.add(`gobble-token`,function(t){if(this.code===B){for(var n=++this.index,r=!1;this.index<this.expr.length;){if(this.code===B&&!r){for(var i=this.expr.slice(n,this.index),a=``;++this.index<this.expr.length;){var o=this.code;if(o>=97&&o<=122||o>=65&&o<=90||o>=48&&o<=57)a+=this.char;else break}var s=void 0;try{s=new RegExp(i,a)}catch(e){this.throwError(e.message)}return t.node={type:e.LITERAL,value:s,raw:this.expr.slice(n-1,this.index)},t.node=this.gobbleTokenProperty(t.node),t.node}this.code===e.OBRACK_CODE?r=!0:r&&this.code===e.CBRACK_CODE&&(r=!1),this.index+=this.code===V?2:1}this.throwError(`Unclosed Regex`)}})}},U=43,W={name:`assignment`,assignmentOperators:new Set([`=`,`*=`,`**=`,`/=`,`%=`,`+=`,`-=`,`<<=`,`>>=`,`>>>=`,`&=`,`^=`,`|=`,`||=`,`&&=`,`??=`]),updateOperators:[U,45],assignmentPrecedence:.9,init:function(e){var t=[e.IDENTIFIER,e.MEMBER_EXP];W.assignmentOperators.forEach(function(t){return e.addBinaryOp(t,W.assignmentPrecedence,!0)}),e.hooks.add(`gobble-token`,function(e){var n=this,r=this.code;W.updateOperators.some(function(e){return e===r&&e===n.expr.charCodeAt(n.index+1)})&&(this.index+=2,e.node={type:`UpdateExpression`,operator:r===U?`++`:`--`,argument:this.gobbleTokenProperty(this.gobbleIdentifier()),prefix:!0},(!e.node.argument||!t.includes(e.node.argument.type))&&this.throwError(`Unexpected ${e.node.operator}`))}),e.hooks.add(`after-token`,function(e){var n=this;if(e.node){var r=this.code;W.updateOperators.some(function(e){return e===r&&e===n.expr.charCodeAt(n.index+1)})&&(t.includes(e.node.type)||this.throwError(`Unexpected ${e.node.operator}`),this.index+=2,e.node={type:`UpdateExpression`,operator:r===U?`++`:`--`,argument:e.node,prefix:!1})}}),e.hooks.add(`after-expression`,function(e){e.node&&n(e.node)});function n(e){W.assignmentOperators.has(e.operator)?(e.type=`AssignmentExpression`,n(e.left),n(e.right)):e.operator||Object.values(e).forEach(function(e){e&&w(e)===`object`&&n(e)})}}};L.plugins.register(H,W),L.addUnaryOp(`typeof`),L.addUnaryOp(`void`),L.addLiteral(`null`,null),L.addLiteral(`undefined`,void 0);var G=new Set([`constructor`,`__proto__`,`__defineGetter__`,`__defineSetter__`,`__lookupGetter__`,`__lookupSetter__`]),K={evalAst:function(e,t){switch(e.type){case`BinaryExpression`:case`LogicalExpression`:return K.evalBinaryExpression(e,t);case`Compound`:return K.evalCompound(e,t);case`ConditionalExpression`:return K.evalConditionalExpression(e,t);case`Identifier`:return K.evalIdentifier(e,t);case`Literal`:return K.evalLiteral(e,t);case`MemberExpression`:return K.evalMemberExpression(e,t);case`UnaryExpression`:return K.evalUnaryExpression(e,t);case`ArrayExpression`:return K.evalArrayExpression(e,t);case`CallExpression`:return K.evalCallExpression(e,t);case`AssignmentExpression`:return K.evalAssignmentExpression(e,t);default:throw SyntaxError(`Unexpected expression`,e)}},evalBinaryExpression:function(e,t){return{"||":function(e,t){return e||t()},"&&":function(e,t){return e&&t()},"|":function(e,t){return e|t()},"^":function(e,t){return e^t()},"&":function(e,t){return e&t()},"==":function(e,t){return e==t()},"!=":function(e,t){return e!=t()},"===":function(e,t){return e===t()},"!==":function(e,t){return e!==t()},"<":function(e,t){return e<t()},">":function(e,t){return e>t()},"<=":function(e,t){return e<=t()},">=":function(e,t){return e>=t()},"<<":function(e,t){return e<<t()},">>":function(e,t){return e>>t()},">>>":function(e,t){return e>>>t()},"+":function(e,t){return e+t()},"-":function(e,t){return e-t()},"*":function(e,t){return e*t()},"/":function(e,t){return e/t()},"%":function(e,t){return e%t()}}[e.operator](K.evalAst(e.left,t),function(){return K.evalAst(e.right,t)})},evalCompound:function(e,t){for(var n,r=0;r<e.body.length;r++){e.body[r].type===`Identifier`&&[`var`,`let`,`const`].includes(e.body[r].name)&&e.body[r+1]&&e.body[r+1].type===`AssignmentExpression`&&(r+=1);var i=e.body[r];n=K.evalAst(i,t)}return n},evalConditionalExpression:function(e,t){return K.evalAst(e.test,t)?K.evalAst(e.consequent,t):K.evalAst(e.alternate,t)},evalIdentifier:function(e,t){if(Object.hasOwn(t,e.name))return t[e.name];throw ReferenceError(`${e.name} is not defined`)},evalLiteral:function(e){return e.value},evalMemberExpression:function(e,t){var n=String(e.computed?K.evalAst(e.property):e.property.name),r=K.evalAst(e.object,t);if(r==null||!Object.hasOwn(r,n)&&G.has(n))throw TypeError(`Cannot read properties of ${r} (reading '${n}')`);var i=r[n];return typeof i==`function`?i.bind(r):i},evalUnaryExpression:function(e,t){return{"-":function(e){return-K.evalAst(e,t)},"!":function(e){return!K.evalAst(e,t)},"~":function(e){return~K.evalAst(e,t)},"+":function(e){return+K.evalAst(e,t)},typeof:function e(n){return e(K.evalAst(n,t))},void:function(e){K.evalAst(e,t)}}[e.operator](e.argument)},evalArrayExpression:function(e,t){return e.elements.map(function(e){return K.evalAst(e,t)})},evalCallExpression:function(e,t){var n=e.arguments.map(function(e){return K.evalAst(e,t)}),r=K.evalAst(e.callee,t);if(r===Function)throw Error(`Function constructor is disabled`);return r.apply(void 0,x(n))},evalAssignmentExpression:function(e,t){if(e.left.type!==`Identifier`)throw SyntaxError(`Invalid left-hand side in assignment`);var n=e.left.name;return t[n]=K.evalAst(e.right,t),t[n]}},q=function(){function e(t){a(this,e),this.code=t,this.ast=L(this.code)}return c(e,[{key:`runInNewContext`,value:function(e){var t=Object.assign(Object.create(null),e);return K.evalAst(this.ast,t)}}])}();function J(e,t){return e=e.slice(),e.push(t),e}function Y(e,t){return t=t.slice(),t.unshift(e),t}var X=function(e){function t(e){var n;return a(this,t),n=i(this,t,[`JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)`]),n.avoidNew=!0,n.value=e,n.name=`NewError`,n}return f(t,e),c(t)}(D(Error));function Z(e,t,n,r,i){if(!(this instanceof Z))try{return new Z(e,t,n,r,i)}catch(e){if(!e.avoidNew)throw e;return e.value}typeof e==`string`&&(i=r,r=n,n=t,t=e,e=null);var a=e&&w(e)===`object`;if(e=e||{},this.json=e.json||n,this.path=e.path||t,this.resultType=e.resultType||`value`,this.flatten=e.flatten||!1,this.wrap=Object.hasOwn(e,`wrap`)?e.wrap:!0,this.sandbox=e.sandbox||{},this.eval=e.eval===void 0?`safe`:e.eval,this.ignoreEvalErrors=e.ignoreEvalErrors===void 0?!1:e.ignoreEvalErrors,this.parent=e.parent||null,this.parentProperty=e.parentProperty||null,this.callback=e.callback||r||null,this.otherTypeCallback=e.otherTypeCallback||i||function(){throw TypeError(`You must supply an otherTypeCallback callback option with the @other() operator.`)},e.autostart!==!1){var o={path:a?e.path:t};a?`json`in e&&(o.json=e.json):o.json=n;var s=this.evaluate(o);if(!s||w(s)!==`object`)throw new X(s);return s}}Z.prototype.evaluate=function(e,t,n,r){var i=this,a=this.parent,o=this.parentProperty,s=this.flatten,c=this.wrap;if(this.currResultType=this.resultType,this.currEval=this.eval,this.currSandbox=this.sandbox,n=n||this.callback,this.currOtherTypeCallback=r||this.otherTypeCallback,t=t||this.json,e=e||this.path,e&&w(e)===`object`&&!Array.isArray(e)){if(!e.path&&e.path!==``)throw TypeError(`You must supply a "path" property when providing an object argument to JSONPath.evaluate().`);if(!Object.hasOwn(e,`json`))throw TypeError(`You must supply a "json" property when providing an object argument to JSONPath.evaluate().`);t=e.json,s=Object.hasOwn(e,`flatten`)?e.flatten:s,this.currResultType=Object.hasOwn(e,`resultType`)?e.resultType:this.currResultType,this.currSandbox=Object.hasOwn(e,`sandbox`)?e.sandbox:this.currSandbox,c=Object.hasOwn(e,`wrap`)?e.wrap:c,this.currEval=Object.hasOwn(e,`eval`)?e.eval:this.currEval,n=Object.hasOwn(e,`callback`)?e.callback:n,this.currOtherTypeCallback=Object.hasOwn(e,`otherTypeCallback`)?e.otherTypeCallback:this.currOtherTypeCallback,a=Object.hasOwn(e,`parent`)?e.parent:a,o=Object.hasOwn(e,`parentProperty`)?e.parentProperty:o,e=e.path}if(a=a||null,o=o||null,Array.isArray(e)&&(e=Z.toPathString(e)),!(!e&&e!==``||!t)){var l=Z.toPathArray(e);l[0]===`$`&&l.length>1&&l.shift(),this._hasParentSelector=null;var u=this._trace(l,t,[`$`],a,o,n).filter(function(e){return e&&!e.isParentSelector});return u.length?!c&&u.length===1&&!u[0].hasArrExpr?this._getPreferredOutput(u[0]):u.reduce(function(e,t){var n=i._getPreferredOutput(t);return s&&Array.isArray(n)?e=e.concat(n):e.push(n),e},[]):c?[]:void 0}},Z.prototype._getPreferredOutput=function(e){var t=this.currResultType;switch(t){case`all`:var n=Array.isArray(e.path)?e.path:Z.toPathArray(e.path);return e.pointer=Z.toPointer(n),e.path=typeof e.path==`string`?e.path:Z.toPathString(e.path),e;case`value`:case`parent`:case`parentProperty`:return e[t];case`path`:return Z.toPathString(e[t]);case`pointer`:return Z.toPointer(e.path);default:throw TypeError(`Unknown result type`)}},Z.prototype._handleCallback=function(e,t,n){if(t){var r=this._getPreferredOutput(e);e.path=typeof e.path==`string`?e.path:Z.toPathString(e.path),t(r,n,e)}},Z.prototype._trace=function(e,t,n,r,i,a,o,s){var c=this,u;if(!e.length)return u={path:n,value:t,parent:r,parentProperty:i,hasArrExpr:o},this._handleCallback(u,a,`value`),u;var d=e[0],f=e.slice(1),p=[];function m(e){Array.isArray(e)?e.forEach(function(e){p.push(e)}):p.push(e)}if((typeof d!=`string`||s)&&t&&Object.hasOwn(t,d))m(this._trace(f,t[d],J(n,d),t,d,a,o));else if(d===`*`)this._walk(t,function(e){m(c._trace(f,t[e],J(n,e),t,e,a,!0,!0))});else if(d===`..`)m(this._trace(f,t,n,r,i,a,o)),this._walk(t,function(r){w(t[r])===`object`&&m(c._trace(e.slice(),t[r],J(n,r),t,r,a,!0))});else if(d===`^`)return this._hasParentSelector=!0,{path:n.slice(0,-1),expr:f,isParentSelector:!0};else if(d===`~`)return u={path:J(n,d),value:i,parent:r,parentProperty:null},this._handleCallback(u,a,`property`),u;else if(d===`$`)m(this._trace(f,t,n,null,null,a,o));else if(/^(-?[0-9]*):(-?[0-9]*):?([0-9]*)$/.test(d))m(this._slice(d,f,t,n,r,i,a));else if(d.indexOf(`?(`)===0){if(this.currEval===!1)throw Error(`Eval [?(expr)] prevented in JSONPath expression.`);var h=d.replace(/^\?\(((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?)\)$/,`$1`),g=/@(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])?((?:[\0->@-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)['\[](\??\((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\))(?!(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])\)\])['\]]/g.exec(h);g?this._walk(t,function(e){var o=[g[2]],s=g[1]?t[e][g[1]]:t[e];c._trace(o,s,n,r,i,a,!0).length>0&&m(c._trace(f,t[e],J(n,e),t,e,a,!0))}):this._walk(t,function(e){c._eval(h,t[e],e,n,r,i)&&m(c._trace(f,t[e],J(n,e),t,e,a,!0))})}else if(d[0]===`(`){if(this.currEval===!1)throw Error(`Eval [(expr)] prevented in JSONPath expression.`);m(this._trace(Y(this._eval(d,t,n.at(-1),n.slice(0,-1),r,i),f),t,n,r,i,a,o))}else if(d[0]===`@`){var _=!1,v=d.slice(1,-2);switch(v){case`scalar`:(!t||![`object`,`function`].includes(w(t)))&&(_=!0);break;case`boolean`:case`string`:case`undefined`:case`function`:w(t)===v&&(_=!0);break;case`integer`:Number.isFinite(t)&&!(t%1)&&(_=!0);break;case`number`:Number.isFinite(t)&&(_=!0);break;case`nonFinite`:typeof t==`number`&&!Number.isFinite(t)&&(_=!0);break;case`object`:t&&w(t)===v&&(_=!0);break;case`array`:Array.isArray(t)&&(_=!0);break;case`other`:_=this.currOtherTypeCallback(t,n,r,i);break;case`null`:t===null&&(_=!0);break;default:throw TypeError(`Unknown value type `+v)}if(_)return u={path:n,value:t,parent:r,parentProperty:i},this._handleCallback(u,a,`value`),u}else if(d[0]==="`"&&t&&Object.hasOwn(t,d.slice(1))){var y=d.slice(1);m(this._trace(f,t[y],J(n,y),t,y,a,o,!0))}else if(d.includes(`,`)){var b=l(d.split(`,`)),x;try{for(b.s();!(x=b.n()).done;){var S=x.value;m(this._trace(Y(S,f),t,n,r,i,a,!0))}}catch(e){b.e(e)}finally{b.f()}}else !s&&t&&Object.hasOwn(t,d)&&m(this._trace(f,t[d],J(n,d),t,d,a,o,!0));if(this._hasParentSelector)for(var C=0;C<p.length;C++){var T=p[C];if(T&&T.isParentSelector){var E=this._trace(T.expr,t,T.path,r,i,a,o);if(Array.isArray(E)){p[C]=E[0];for(var D=E.length,O=1;O<D;O++)C++,p.splice(C,0,E[O])}else p[C]=E}}return p},Z.prototype._walk=function(e,t){if(Array.isArray(e))for(var n=e.length,r=0;r<n;r++)t(r);else e&&w(e)===`object`&&Object.keys(e).forEach(function(e){t(e)})},Z.prototype._slice=function(e,t,n,r,i,a,o){if(Array.isArray(n)){var s=n.length,c=e.split(`:`),l=c[2]&&Number.parseInt(c[2])||1,u=c[0]&&Number.parseInt(c[0])||0,d=c[1]&&Number.parseInt(c[1])||s;u=u<0?Math.max(0,u+s):Math.min(s,u),d=d<0?Math.max(0,d+s):Math.min(s,d);for(var f=[],p=u;p<d;p+=l)this._trace(Y(p,t),n,r,i,a,o,!0).forEach(function(e){f.push(e)});return f}},Z.prototype._eval=function(e,t,n,r,i,a){var o=this;this.currSandbox._$_parentProperty=a,this.currSandbox._$_parent=i,this.currSandbox._$_property=n,this.currSandbox._$_root=this.json,this.currSandbox._$_v=t;var s=e.includes(`@path`);s&&(this.currSandbox._$_path=Z.toPathString(r.concat([n])));var c=this.currEval+`Script:`+e;if(!Z.cache[c]){var l=e.replaceAll(`@parentProperty`,`_$_parentProperty`).replaceAll(`@parent`,`_$_parent`).replaceAll(`@property`,`_$_property`).replaceAll(`@root`,`_$_root`).replaceAll(/@([\t-\r \)\.\[\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF])/g,`_$_v$1`);if(s&&(l=l.replaceAll(`@path`,`_$_path`)),this.currEval===`safe`||this.currEval===!0||this.currEval===void 0)Z.cache[c]=new this.safeVm.Script(l);else if(this.currEval===`native`)Z.cache[c]=new this.vm.Script(l);else if(typeof this.currEval==`function`&&this.currEval.prototype&&Object.hasOwn(this.currEval.prototype,`runInNewContext`)){var u=this.currEval;Z.cache[c]=new u(l)}else if(typeof this.currEval==`function`)Z.cache[c]={runInNewContext:function(e){return o.currEval(l,e)}};else throw TypeError(`Unknown "eval" property "${this.currEval}"`)}try{return Z.cache[c].runInNewContext(this.currSandbox)}catch(t){if(this.ignoreEvalErrors)return!1;throw Error(`jsonPath: `+t.message+`: `+e)}},Z.cache={},Z.toPathString=function(e){for(var t=e,n=t.length,r=`$`,i=1;i<n;i++)/^(~|\^|@(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\(\))$/.test(t[i])||(r+=/^[\*0-9]+$/.test(t[i])?`[`+t[i]+`]`:`['`+t[i]+`']`);return r},Z.toPointer=function(e){for(var t=e,n=t.length,r=``,i=1;i<n;i++)/^(~|\^|@(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\(\))$/.test(t[i])||(r+=`/`+t[i].toString().replaceAll(`~`,`~0`).replaceAll(`/`,`~1`));return r},Z.toPathArray=function(e){var t=Z.cache;if(t[e])return t[e].concat();var n=[];return t[e]=e.replaceAll(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/g,`;$&;`).replaceAll(/['\[](\??\((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\))['\]](?!(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])\])/g,function(e,t){return`[#`+(n.push(t)-1)+`]`}).replaceAll(/\[["']((?:[\0-&\(-\\\^-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)["']\]/g,function(e,t){return`['`+t.replaceAll(`.`,`%@%`).replaceAll(`~`,`%%@@%%`)+`']`}).replaceAll(`~`,`;~;`).replaceAll(/["']?\.["']?(?!(?:[\0-Z\\-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*\])|\[["']?/g,`;`).replaceAll(`%@%`,`.`).replaceAll(`%%@@%%`,`~`).replaceAll(/(?:;)?(\^+)(?:;)?/g,function(e,t){return`;`+t.split(``).join(`;`)+`;`}).replaceAll(/;;;|;;/g,`;..;`).replaceAll(/;$|'?\]|'$/g,``).split(`;`).map(function(e){var t=e.match(/#([0-9]+)/);return!t||!t[1]?e:n[t[1]]}),t[e].concat()},Z.prototype.safeVm={Script:q};var ee=function(e,t,n){for(var r=e.length,i=0;i<r;i++){var a=e[i];n(a)&&t.push(e.splice(i--,1)[0])}},te=function(){function e(t){a(this,e),this.code=t}return c(e,[{key:`runInNewContext`,value:function(e){var t=this.code,n=Object.keys(e),r=[];ee(n,r,function(t){return typeof e[t]==`function`});var i=n.map(function(t){return e[t]});t=r.reduce(function(t,n){var r=e[n].toString();return/function/.test(r)||(r=`function `+r),`var `+n+`=`+r+`;`+t},``)+t,!/(["'])use strict\1/.test(t)&&!n.includes(`arguments`)&&(t=`var arguments = undefined;`+t),t=t.replace(/;[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*$/,``);var a=t.lastIndexOf(`;`),s=a===-1?` return `+t:t.slice(0,a+1)+` return `+t.slice(a+1);return o(Function,n.concat([s])).apply(void 0,x(i))}}])}();Z.prototype.vm={Script:te};function ne(e){if(!e)return null;try{var t,n,r=(t=(n=e.textContent)==null?void 0:n.trim())==null?``:t;return r.startsWith(`{`)||(r=`{`+r+`}`),Function(`return (${r})`)()}catch(e){return console.warn(e),null}}function Q(e,t){var n=t.getAttribute(`data-calc-id`);if(!n)return null;var r=t.querySelector(`[data-calc-place="${n}"]`);return!r||e===void 0||!e[n]?null:{data:e[n],uniqId:n+`-`+Math.random().toString(36).slice(2,7),id:n,placeNode:r}}function $(e,t){var n=v({},arguments.length>2&&arguments[2]!==void 0?arguments[2]:{});function r(t,r){var i=t.replace(/\$get:([a-zA-Z0-9_.-]+)/g,function(e,t){return String(n[t])});if(i.startsWith(`$save:`)){var a=i.replace(`$save:`,``);return n[a]=r,r}switch(i){case`$root`:return e;case`$first`:return r[0];case`$last`:var o=r;return o[o.length-1];default:return Z({path:i,json:r})}}var i=t.split(`||`).map(function(e){return e.trim()}),a=null;do{a=e;for(var o=i.shift().split(`>`).map(function(e){return e.trim()});o.length;)if(a=r(o.shift(),a),a==null||Array.isArray(a)&&!a.length){a=null;break}if(a!==null)break}while(i.length);return a}function re(e,t){var n=Q(e,t);if(n){var r=n.id,i=n.uniqId,a=n.data,o=n.placeNode,s=ne(t.querySelector(`[data-configurator-options]`));if(s){var c=s.oldPricePercent,l=s.getPrice,u=s.sections,d=s.fields;t.setAttribute(`data-calc-id`,i);var f=new M({id:i,parentSelector:`[data-calc-id="${i}"]`,data:a,editableFields:[],sectionsOptions:[]});f.addField({selector:`price`,calculateFunction:function(e,t){var n=l(e,t,r),i=f.getValues();return Object.keys(i).length!==Object.keys(e).length&&setTimeout(function(){f.refresh()}),n}}),f.addField({selector:`old-price`,calculateFunction:function(){return f.getValue(`price`)/((100-c)/100)}});var p={calculateFunction:function(e){return u.map(function(t){var n;return e[t.key]+((n=t.postfix)==null?``:n)}).join(` `)}};f.addField(v({selector:`params`},p)),f.addField(v({selector:`params-attr`,attribute:!0},p));var m={calculateFunction:function(e){return u.map(function(t){var n;return`${t.title}: ${e[t.key]}${(n=t.postfix)==null?``:n}`}).join(`
30
+ `)}};f.addField(v({selector:`params-view`},m)),f.addField(v({selector:`params-view-attr`,attribute:!0},m));var h=[`price`,`old-price`];u.forEach(function(e){f.addField({selector:e.key,calculateFunction:function(t){return t[e.key]}}),h.push(e.key),f.addField({selector:`${e.key}-view`,calculateFunction:function(t){var n=t[e.key],r=$(a,e.path,t);return typeof e.selectorDisplay==`function`?e.selectorDisplay(n,r):n}});function t(t){var n,r,i;return(r=((n=e.labelMapping)==null?{}:n)[t])==null?t+((i=e.postfix)==null?``:i):r}f.addSection({title:e.title,type:e.key,inputs:Array.isArray(e.inputs)?e.inputs:function(){var n=f.getValues(),r=$(a,e.path,n);return r?r.map(function(e){return{label:t(e),value:e}}):[]}})}),Array.isArray(d)&&d.forEach(function(e){f.addField({selector:e.selector,attribute:!!e.attribute,calculateFunction:function(t,n){return e.get(t,n,r,f)}})}),h.forEach(function(e){f.addField({selector:e,attribute:!0,calculateFunction:function(){return f.getValue(e)}})}),f.renderInNode(o),f.init()}}}exports.Calculator=M,exports.getOptions=Q,exports.initConfigurator=re,exports.queryByPath=$;
@@ -0,0 +1,30 @@
1
+ var OvConfigurator=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e,t){this.v=e,this.k=t}function n(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function r(e){if(Array.isArray(e))return n(e)}function i(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function a(e,t,n){return t=f(t),b(e,h()?Reflect.construct(t,n||[],f(e).constructor):t.apply(e,n))}function o(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function s(e,t,n){if(h())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var i=new(e.bind.apply(e,r));return n&&x(i,n.prototype),i}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,w(r.key),r)}}function l(e,t,n){return t&&c(e.prototype,t),n&&c(e,n),Object.defineProperty(e,`prototype`,{writable:!1}),e}function u(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=E(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||n.return==null||n.return()}finally{if(s)throw a}}}}function d(e,t,n){return(t=w(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}function p(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,`prototype`,{writable:!1}),t&&x(e,t)}function m(e){try{return Function.toString.call(e).indexOf(`[native code]`)!==-1}catch(t){return typeof e==`function`}}function h(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(h=function(){return!!e})()}function g(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function _(){throw TypeError(`Invalid attempt to spread non-iterable instance.
3
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function v(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function y(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?v(Object(n),!0).forEach(function(t){d(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):v(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function b(e,t){if(t&&(typeof t==`object`||typeof t==`function`))return t;if(t!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return i(e)}function x(e,t){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},x(e,t)}function S(e){return r(e)||g(e)||E(e)||_()}function C(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function w(e){var t=C(e,`string`);return typeof t==`symbol`?t:t+``}function T(e){"@babel/helpers - typeof";return T=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},T(e)}function E(e,t){if(e){if(typeof e==`string`)return n(e,t);var r={}.toString.call(e).slice(8,-1);return r===`Object`&&e.constructor&&(r=e.constructor.name),r===`Map`||r===`Set`?Array.from(e):r===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}function D(e){var n,r;function i(n,r){try{var o=e[n](r),s=o.value,c=s instanceof t;Promise.resolve(c?s.v:s).then(function(t){if(c){var r=n===`return`&&s.k?n:`next`;if(!s.k||t.done)return i(r,t);t=e[r](t).value}a(!!o.done,t)},function(e){i(`throw`,e)})}catch(e){a(2,e)}}function a(e,t){e===2?n.reject(t):n.resolve({value:t,done:e}),(n=n.next)?i(n.key,n.arg):r=null}this._invoke=function(e,t){return new Promise(function(a,o){var s={key:e,arg:t,resolve:a,reject:o,next:null};r?r=r.next=s:(n=r=s,i(e,t))})},typeof e.return!=`function`&&(this.return=void 0)}D.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},D.prototype.next=function(e){return this._invoke(`next`,e)},D.prototype.throw=function(e){return this._invoke(`throw`,e)},D.prototype.return=function(e){return this._invoke(`return`,e)};function O(e){var t=typeof Map==`function`?new Map:void 0;return O=function(e){if(e===null||!m(e))return e;if(typeof e!=`function`)throw TypeError(`Super expression must either be null or a function`);if(t!==void 0){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return s(e,arguments,f(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),x(n,e)},O(e)}var k;(function(){var e=Number;e.isNaN||(e.isNaN=function(e){return typeof e==`number`&&isNaN(e)}),Array.prototype.find||(Array.prototype.find=function(e,t){if(this==null)throw TypeError(`Array.prototype.find called on null or undefined`);if(typeof e!=`function`)throw TypeError(`predicate must be a function`);for(var n=Object(this),r=n.length>>>0,i=0;i<r;i++){var a=n[i];if(e.call(t,a,i,n))return a}})})();var A={DATA_ATTRIBUTE:`data`,CUSTOM:`custom`,DEFAULT:`default`},j={PARENT:`parent`,SELF:`self`,CLOSEST:`closest`},M=function(){function e(t){o(this,e),this.node=null,this.animationId=0,this.prevValue=void 0;var n=t.selector;this.selector=n,this.options=y({animated:!1,duration:800,dots:0,dataKey:n,calculateFunction:function(){return null},attribute:!1,animation:[`animate__faster`,`animate__pulse`],animatedNode:j.PARENT,animatedNodeSelector:``},t)}return l(e,[{key:`getNode`,value:function(e){var t=e.prefix,n=e.parentNode,r=e.type;return(r===void 0?A.DEFAULT:r)===A.CUSTOM?this.node=n.querySelector(this.options.selector):(this.node=n.querySelector(`[data-${t}="${this.options.selector}"]`),!this.node&&this.options.attribute&&n.getAttribute(`data-${t}`)===this.options.selector&&(this.node=n)),this.node}},{key:`changeValue`,value:function(e){if(this.node){if(this.animateBlock(e),this.options.attribute){var t=this.node.dataset.calcAttribute;t&&this.node.setAttribute(t,String(e))}else{if(Number.isNaN(Number(e))){this.node.innerHTML=String(e);return}this.animateNumber(Number(e))}this.prevValue=e}}},{key:`animateBlock`,value:function(e){var t,n,r;if(e!==this.prevValue){var i=this.options,a=i.animated,o=i.animation,s=i.animatedNode,c=i.animatedNodeSelector,l=null;switch(s){case j.SELF:l=this.node;break;case j.PARENT:l=(t=this.node)==null?void 0:t.parentNode;break;case j.CLOSEST:l=(n=(r=this.node)==null?void 0:r.closest(c))==null?null:n;break}if(a&&l){var u,d=[`animate__animated`].concat(S(o)),f=function(){var e;(e=l.classList).remove.apply(e,S(d))};(u=l.classList).add.apply(u,S(d)),l.addEventListener(`webkitAnimationEnd`,f),l.addEventListener(`mozAnimationEnd`,f),l.addEventListener(`MSAnimationEnd`,f),l.addEventListener(`oanimationend`,f),l.addEventListener(`animationend`,f)}}}},{key:`animateNumber`,value:function(e){var t=this,n=this.options,r=n.duration,i=r===void 0?800:r,a=n.dots,o=a===void 0?0:a,s=this.node;window.cancelAnimationFrame(this.animationId);var c=Number(s.textContent);c=Number.isNaN(c)?0:c;var l=e-c,u=l>0,d=null,f=function(n){d===null&&(d=n);var r=n-d;s.textContent=p(r).toFixed(o),r<i?t.animationId=window.requestAnimationFrame(f):(s.textContent=e.toFixed(m(e)),window.cancelAnimationFrame(t.animationId))};function p(t){var n=c+t*l/i;if(u){if(n>e)return e}else if(n<e)return e;return n}function m(e){var t=String(e);return t.includes(`.`)?t.length-1>o?o:t.length-1:0}this.animationId=window.requestAnimationFrame(f)}}])}(),N=function(){function e(t){o(this,e),this.savedValues={},this.values={},this.node=null;var n=t.editableFields,r=n===void 0?[]:n,i=t.data,a=i===void 0?null:i;this.options=y({editableFields:[],prefix:`card`,data:null,stylePrefix:`calculator`,dataAttributePrefix:`calc`},t),this.data=a,this.fields=r.map(function(e){return new M(e)})}return l(e,[{key:`addField`,value:function(e){this.fields.push(new M(e))}},{key:`addSection`,value:function(e){var t,n=((t=this.options.sectionsOptions)==null?[]:t).concat([e]);this.options.sectionsOptions=n}},{key:`init`,value:function(){var e=this;if(this.data){var t=this.options,n=t.parentSelector,r=t.dataAttributePrefix,i=t.stylePrefix,a=document.querySelector(n);this.fields.forEach(function(e){return e.getNode({prefix:r,parentNode:a})}),this.form=a.querySelector(`.${i}`),this.form.addEventListener(`change`,function(){return e.changeHandler(e.form)}),this.changeHandler(this.form)}}},{key:`getValues`,value:function(){return this.values}},{key:`changeHandler`,value:function(e){var t=this,n=Array.from(e.querySelectorAll(`input`)).filter(function(e){return e.checked}).reduce(function(e,t){var n=t.name.split(`-`);return y(y({},e),{},d({},n[n.length-1],t.value))},{});this.fields.forEach(function(e){try{var r=e.options.calculateFunction(n,t.data);if(r===null)return;t.saveValue(e.selector,r),e.changeValue(r==null?`--`:r)}catch(e){console.warn(e)}}),this.values=n}},{key:`saveValue`,value:function(e,t){this.savedValues[e]=t}},{key:`getValue`,value:function(e){return this.savedValues[e]}},{key:`getHTML`,value:function(){var e=this;if(!this.data)return``;var t=this.options,n=t.stylePrefix,r=t.sectionsOptions;return`
4
+ <form action="/" class="${n}">
5
+ ${(r==null?[]:r).map(function(t){return e.getSectionHTML(t)}).join(``)}
6
+ </form>
7
+ `}},{key:`getSectionHTML`,value:function(e){var t,n=this.options,r=n.stylePrefix,i=n.prefix,a=n.id,o=e.title,s=o===void 0?``:o,c=e.type,l=e.inputs,u=e.className,d=u===void 0?``:u,f=e.checked,p=f===void 0?!0:f,m=e.inputType,h=m===void 0?`radio`:m;if(typeof l==`function`&&(l=l(this.data)),!l.length)return``;var g=l[0].value,_=(t=this.getValues()[c])==null?g:t;return l.find(function(e){return e.value===_})||(_=g),`
8
+ <div class="${r}__section">
9
+ ${s&&`<h4 class="${r}__section-title">${s}:</h4>`}
10
+ <div class="${r}__section-row">
11
+ ${l.map(function(e,t){var n=_===e.value?`checked`:``;return`
12
+ <div class="${r}__section-col ${d}">
13
+ <input
14
+ ${p?n:``}
15
+ name="${i}-${a}-${c}"
16
+ id="${i}-${a}-${c}-${t}"
17
+ type="${h}"
18
+ value="${e.value}"
19
+ />
20
+ <label
21
+ for="${i}-${a}-${c}-${t}"
22
+ >${e.label}</label
23
+ >
24
+ </div>
25
+ `}).join(``)}
26
+ </div>
27
+ </div>
28
+ `}},{key:`renderInNode`,value:function(e){e.innerHTML=this.getHTML(),this.node=e}},{key:`refresh`,value:function(){this.node&&(this.renderInNode(this.node),this.init())}}])}();k=N,k.fieldTypes=A,k.animatedNodeTypes=j;var P=function(){function e(){o(this,e)}return l(e,[{key:`add`,value:function(e,t,n){if(typeof arguments[0]!=`string`)for(var r in arguments[0])this.add(r,arguments[0][r],arguments[1]);else (Array.isArray(e)?e:[e]).forEach(function(e){this[e]=this[e]||[],t&&this[e][n?`unshift`:`push`](t)},this)}},{key:`run`,value:function(e,t){this[e]=this[e]||[],this[e].forEach(function(e){e.call(t&&t.context?t.context:t,t)})}}])}(),ee=function(){function e(t){o(this,e),this.jsep=t,this.registered={}}return l(e,[{key:`register`,value:function(){for(var e=this,t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];n.forEach(function(t){if(T(t)!==`object`||!t.name||!t.init)throw Error(`Invalid JSEP plugin format`);e.registered[t.name]||(t.init(e.jsep),e.registered[t.name]=t)})}}])}(),F=function(){function e(t){o(this,e),this.expr=t,this.index=0}return l(e,[{key:`char`,get:function(){return this.expr.charAt(this.index)}},{key:`code`,get:function(){return this.expr.charCodeAt(this.index)}},{key:`throwError`,value:function(e){var t=Error(e+` at character `+this.index);throw t.index=this.index,t.description=e,t}},{key:`runHook`,value:function(t,n){if(e.hooks[t]){var r={context:this,node:n};return e.hooks.run(t,r),r.node}return n}},{key:`searchHook`,value:function(t){if(e.hooks[t]){var n={context:this};return e.hooks[t].find(function(e){return e.call(n.context,n),n.node}),n.node}}},{key:`gobbleSpaces`,value:function(){for(var t=this.code;t===e.SPACE_CODE||t===e.TAB_CODE||t===e.LF_CODE||t===e.CR_CODE;)t=this.expr.charCodeAt(++this.index);this.runHook(`gobble-spaces`)}},{key:`parse`,value:function(){this.runHook(`before-all`);var t=this.gobbleExpressions(),n=t.length===1?t[0]:{type:e.COMPOUND,body:t};return this.runHook(`after-all`,n)}},{key:`gobbleExpressions`,value:function(t){for(var n=[],r,i;this.index<this.expr.length;)if(r=this.code,r===e.SEMCOL_CODE||r===e.COMMA_CODE)this.index++;else if(i=this.gobbleExpression())n.push(i);else if(this.index<this.expr.length){if(r===t)break;this.throwError(`Unexpected "`+this.char+`"`)}return n}},{key:`gobbleExpression`,value:function(){var e=this.searchHook(`gobble-expression`)||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook(`after-expression`,e)}},{key:`gobbleBinaryOp`,value:function(){this.gobbleSpaces();for(var t=this.expr.substr(this.index,e.max_binop_len),n=t.length;n>0;){if(e.binary_ops.hasOwnProperty(t)&&(!e.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!e.isIdentifierPart(this.expr.charCodeAt(this.index+t.length))))return this.index+=n,t;t=t.substr(0,--n)}return!1}},{key:`gobbleBinaryExpression`,value:function(){var t,n,r,i,a,o=this.gobbleToken(),s,c,l;if(!o||(n=this.gobbleBinaryOp(),!n))return o;for(a={value:n,prec:e.binaryPrecedence(n),right_a:e.right_associative.has(n)},s=this.gobbleToken(),s||this.throwError(`Expected expression after `+n),i=[o,a,s];n=this.gobbleBinaryOp();){if(r=e.binaryPrecedence(n),r===0){this.index-=n.length;break}a={value:n,prec:r,right_a:e.right_associative.has(n)},l=n;for(var u=function(e){return a.right_a&&e.right_a?r>e.prec:r<=e.prec};i.length>2&&u(i[i.length-2]);)s=i.pop(),n=i.pop().value,o=i.pop(),t={type:e.BINARY_EXP,operator:n,left:o,right:s},i.push(t);t=this.gobbleToken(),t||this.throwError(`Expected expression after `+l),i.push(a,t)}for(c=i.length-1,t=i[c];c>1;)t={type:e.BINARY_EXP,operator:i[c-1].value,left:i[c-2],right:t},c-=2;return t}},{key:`gobbleToken`,value:function(){var t,n,r,i;if(this.gobbleSpaces(),i=this.searchHook(`gobble-token`),i)return this.runHook(`after-token`,i);if(t=this.code,e.isDecimalDigit(t)||t===e.PERIOD_CODE)return this.gobbleNumericLiteral();if(t===e.SQUOTE_CODE||t===e.DQUOTE_CODE)i=this.gobbleStringLiteral();else if(t===e.OBRACK_CODE)i=this.gobbleArray();else{for(n=this.expr.substr(this.index,e.max_unop_len),r=n.length;r>0;){if(e.unary_ops.hasOwnProperty(n)&&(!e.isIdentifierStart(this.code)||this.index+n.length<this.expr.length&&!e.isIdentifierPart(this.expr.charCodeAt(this.index+n.length)))){this.index+=r;var a=this.gobbleToken();return a||this.throwError(`missing unaryOp argument`),this.runHook(`after-token`,{type:e.UNARY_EXP,operator:n,argument:a,prefix:!0})}n=n.substr(0,--r)}e.isIdentifierStart(t)?(i=this.gobbleIdentifier(),e.literals.hasOwnProperty(i.name)?i={type:e.LITERAL,value:e.literals[i.name],raw:i.name}:i.name===e.this_str&&(i={type:e.THIS_EXP})):t===e.OPAREN_CODE&&(i=this.gobbleGroup())}return i?(i=this.gobbleTokenProperty(i),this.runHook(`after-token`,i)):this.runHook(`after-token`,!1)}},{key:`gobbleTokenProperty`,value:function(t){this.gobbleSpaces();for(var n=this.code;n===e.PERIOD_CODE||n===e.OBRACK_CODE||n===e.OPAREN_CODE||n===e.QUMARK_CODE;){var r=void 0;if(n===e.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==e.PERIOD_CODE)break;r=!0,this.index+=2,this.gobbleSpaces(),n=this.code}this.index++,n===e.OBRACK_CODE?(t={type:e.MEMBER_EXP,computed:!0,object:t,property:this.gobbleExpression()},t.property||this.throwError(`Unexpected "`+this.char+`"`),this.gobbleSpaces(),n=this.code,n!==e.CBRACK_CODE&&this.throwError(`Unclosed [`),this.index++):n===e.OPAREN_CODE?t={type:e.CALL_EXP,arguments:this.gobbleArguments(e.CPAREN_CODE),callee:t}:(n===e.PERIOD_CODE||r)&&(r&&this.index--,this.gobbleSpaces(),t={type:e.MEMBER_EXP,computed:!1,object:t,property:this.gobbleIdentifier()}),r&&(t.optional=!0),this.gobbleSpaces(),n=this.code}return t}},{key:`gobbleNumericLiteral`,value:function(){for(var t=``,n,r;e.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);if(this.code===e.PERIOD_CODE)for(t+=this.expr.charAt(this.index++);e.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);if(n=this.char,n===`e`||n===`E`){for(t+=this.expr.charAt(this.index++),n=this.char,(n===`+`||n===`-`)&&(t+=this.expr.charAt(this.index++));e.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);e.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError(`Expected exponent (`+t+this.char+`)`)}return r=this.code,e.isIdentifierStart(r)?this.throwError(`Variable names cannot start with a number (`+t+this.char+`)`):(r===e.PERIOD_CODE||t.length===1&&t.charCodeAt(0)===e.PERIOD_CODE)&&this.throwError(`Unexpected period`),{type:e.LITERAL,value:parseFloat(t),raw:t}}},{key:`gobbleStringLiteral`,value:function(){for(var t=``,n=this.index,r=this.expr.charAt(this.index++),i=!1;this.index<this.expr.length;){var a=this.expr.charAt(this.index++);if(a===r){i=!0;break}else if(a===`\\`)switch(a=this.expr.charAt(this.index++),a){case`n`:t+=`
29
+ `;break;case`r`:t+=`\r`;break;case`t`:t+=` `;break;case`b`:t+=`\b`;break;case`f`:t+=`\f`;break;case`v`:t+=`\v`;break;default:t+=a}else t+=a}return i||this.throwError(`Unclosed quote after "`+t+`"`),{type:e.LITERAL,value:t,raw:this.expr.substring(n,this.index)}}},{key:`gobbleIdentifier`,value:function(){var t=this.code,n=this.index;for(e.isIdentifierStart(t)?this.index++:this.throwError(`Unexpected `+this.char);this.index<this.expr.length&&(t=this.code,e.isIdentifierPart(t));)this.index++;return{type:e.IDENTIFIER,name:this.expr.slice(n,this.index)}}},{key:`gobbleArguments`,value:function(t){for(var n=[],r=!1,i=0;this.index<this.expr.length;){this.gobbleSpaces();var a=this.code;if(a===t){r=!0,this.index++,t===e.CPAREN_CODE&&i&&i>=n.length&&this.throwError(`Unexpected token `+String.fromCharCode(t));break}else if(a===e.COMMA_CODE){if(this.index++,i++,i!==n.length){if(t===e.CPAREN_CODE)this.throwError(`Unexpected token ,`);else if(t===e.CBRACK_CODE)for(var o=n.length;o<i;o++)n.push(null)}}else if(n.length!==i&&i!==0)this.throwError(`Expected comma`);else{var s=this.gobbleExpression();(!s||s.type===e.COMPOUND)&&this.throwError(`Expected comma`),n.push(s)}}return r||this.throwError(`Expected `+String.fromCharCode(t)),n}},{key:`gobbleGroup`,value:function(){this.index++;var t=this.gobbleExpressions(e.CPAREN_CODE);if(this.code===e.CPAREN_CODE)return this.index++,t.length===1?t[0]:t.length?{type:e.SEQUENCE_EXP,expressions:t}:!1;this.throwError(`Unclosed (`)}},{key:`gobbleArray`,value:function(){return this.index++,{type:e.ARRAY_EXP,elements:this.gobbleArguments(e.CBRACK_CODE)}}}],[{key:`version`,get:function(){return`1.4.0`}},{key:`toString`,value:function(){return`JavaScript Expression Parser (JSEP) v`+e.version}},{key:`addUnaryOp`,value:function(t){return e.max_unop_len=Math.max(t.length,e.max_unop_len),e.unary_ops[t]=1,e}},{key:`addBinaryOp`,value:function(t,n,r){return e.max_binop_len=Math.max(t.length,e.max_binop_len),e.binary_ops[t]=n,r?e.right_associative.add(t):e.right_associative.delete(t),e}},{key:`addIdentifierChar`,value:function(t){return e.additional_identifier_chars.add(t),e}},{key:`addLiteral`,value:function(t,n){return e.literals[t]=n,e}},{key:`removeUnaryOp`,value:function(t){return delete e.unary_ops[t],t.length===e.max_unop_len&&(e.max_unop_len=e.getMaxKeyLen(e.unary_ops)),e}},{key:`removeAllUnaryOps`,value:function(){return e.unary_ops={},e.max_unop_len=0,e}},{key:`removeIdentifierChar`,value:function(t){return e.additional_identifier_chars.delete(t),e}},{key:`removeBinaryOp`,value:function(t){return delete e.binary_ops[t],t.length===e.max_binop_len&&(e.max_binop_len=e.getMaxKeyLen(e.binary_ops)),e.right_associative.delete(t),e}},{key:`removeAllBinaryOps`,value:function(){return e.binary_ops={},e.max_binop_len=0,e}},{key:`removeLiteral`,value:function(t){return delete e.literals[t],e}},{key:`removeAllLiterals`,value:function(){return e.literals={},e}},{key:`parse`,value:function(t){return new e(t).parse()}},{key:`getMaxKeyLen`,value:function(e){return Math.max.apply(Math,[0].concat(S(Object.keys(e).map(function(e){return e.length}))))}},{key:`isDecimalDigit`,value:function(e){return e>=48&&e<=57}},{key:`binaryPrecedence`,value:function(t){return e.binary_ops[t]||0}},{key:`isIdentifierStart`,value:function(t){return t>=65&&t<=90||t>=97&&t<=122||t>=128&&!e.binary_ops[String.fromCharCode(t)]||e.additional_identifier_chars.has(String.fromCharCode(t))}},{key:`isIdentifierPart`,value:function(t){return e.isIdentifierStart(t)||e.isDecimalDigit(t)}}])}(),te=new P;Object.assign(F,{hooks:te,plugins:new ee(F),COMPOUND:`Compound`,SEQUENCE_EXP:`SequenceExpression`,IDENTIFIER:`Identifier`,MEMBER_EXP:`MemberExpression`,LITERAL:`Literal`,THIS_EXP:`ThisExpression`,CALL_EXP:`CallExpression`,UNARY_EXP:`UnaryExpression`,BINARY_EXP:`BinaryExpression`,ARRAY_EXP:`ArrayExpression`,TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"??":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10,"**":11},right_associative:new Set([`**`]),additional_identifier_chars:new Set([`$`,`_`]),literals:{true:!0,false:!1,null:null},this_str:`this`}),F.max_unop_len=F.getMaxKeyLen(F.unary_ops),F.max_binop_len=F.getMaxKeyLen(F.binary_ops);var I=function(e){return new F(e).parse()},L=Object.getOwnPropertyNames(l(function e(){o(this,e)}));Object.getOwnPropertyNames(F).filter(function(e){return!L.includes(e)&&I[e]===void 0}).forEach(function(e){I[e]=F[e]}),I.Jsep=F;var R=`ConditionalExpression`;I.plugins.register({name:`ternary`,init:function(e){e.hooks.add(`after-expression`,function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;var n=t.node,r=this.gobbleExpression();if(r||this.throwError(`Expected expression`),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;var i=this.gobbleExpression();if(i||this.throwError(`Expected expression`),t.node={type:R,test:n,consequent:r,alternate:i},n.operator&&e.binary_ops[n.operator]<=.9){for(var a=n;a.right.operator&&e.binary_ops[a.right.operator]<=.9;)a=a.right;t.node.test=a.right,a.right=t.node,t.node=n}}else this.throwError(`Expected :`)}})}});var z=47,B=92,V={name:`regex`,init:function(e){e.hooks.add(`gobble-token`,function(t){if(this.code===z){for(var n=++this.index,r=!1;this.index<this.expr.length;){if(this.code===z&&!r){for(var i=this.expr.slice(n,this.index),a=``;++this.index<this.expr.length;){var o=this.code;if(o>=97&&o<=122||o>=65&&o<=90||o>=48&&o<=57)a+=this.char;else break}var s=void 0;try{s=new RegExp(i,a)}catch(e){this.throwError(e.message)}return t.node={type:e.LITERAL,value:s,raw:this.expr.slice(n-1,this.index)},t.node=this.gobbleTokenProperty(t.node),t.node}this.code===e.OBRACK_CODE?r=!0:r&&this.code===e.CBRACK_CODE&&(r=!1),this.index+=this.code===B?2:1}this.throwError(`Unclosed Regex`)}})}},H=43,U={name:`assignment`,assignmentOperators:new Set([`=`,`*=`,`**=`,`/=`,`%=`,`+=`,`-=`,`<<=`,`>>=`,`>>>=`,`&=`,`^=`,`|=`,`||=`,`&&=`,`??=`]),updateOperators:[H,45],assignmentPrecedence:.9,init:function(e){var t=[e.IDENTIFIER,e.MEMBER_EXP];U.assignmentOperators.forEach(function(t){return e.addBinaryOp(t,U.assignmentPrecedence,!0)}),e.hooks.add(`gobble-token`,function(e){var n=this,r=this.code;U.updateOperators.some(function(e){return e===r&&e===n.expr.charCodeAt(n.index+1)})&&(this.index+=2,e.node={type:`UpdateExpression`,operator:r===H?`++`:`--`,argument:this.gobbleTokenProperty(this.gobbleIdentifier()),prefix:!0},(!e.node.argument||!t.includes(e.node.argument.type))&&this.throwError(`Unexpected ${e.node.operator}`))}),e.hooks.add(`after-token`,function(e){var n=this;if(e.node){var r=this.code;U.updateOperators.some(function(e){return e===r&&e===n.expr.charCodeAt(n.index+1)})&&(t.includes(e.node.type)||this.throwError(`Unexpected ${e.node.operator}`),this.index+=2,e.node={type:`UpdateExpression`,operator:r===H?`++`:`--`,argument:e.node,prefix:!1})}}),e.hooks.add(`after-expression`,function(e){e.node&&n(e.node)});function n(e){U.assignmentOperators.has(e.operator)?(e.type=`AssignmentExpression`,n(e.left),n(e.right)):e.operator||Object.values(e).forEach(function(e){e&&T(e)===`object`&&n(e)})}}};I.plugins.register(V,U),I.addUnaryOp(`typeof`),I.addUnaryOp(`void`),I.addLiteral(`null`,null),I.addLiteral(`undefined`,void 0);var W=new Set([`constructor`,`__proto__`,`__defineGetter__`,`__defineSetter__`,`__lookupGetter__`,`__lookupSetter__`]),G={evalAst:function(e,t){switch(e.type){case`BinaryExpression`:case`LogicalExpression`:return G.evalBinaryExpression(e,t);case`Compound`:return G.evalCompound(e,t);case`ConditionalExpression`:return G.evalConditionalExpression(e,t);case`Identifier`:return G.evalIdentifier(e,t);case`Literal`:return G.evalLiteral(e,t);case`MemberExpression`:return G.evalMemberExpression(e,t);case`UnaryExpression`:return G.evalUnaryExpression(e,t);case`ArrayExpression`:return G.evalArrayExpression(e,t);case`CallExpression`:return G.evalCallExpression(e,t);case`AssignmentExpression`:return G.evalAssignmentExpression(e,t);default:throw SyntaxError(`Unexpected expression`,e)}},evalBinaryExpression:function(e,t){return{"||":function(e,t){return e||t()},"&&":function(e,t){return e&&t()},"|":function(e,t){return e|t()},"^":function(e,t){return e^t()},"&":function(e,t){return e&t()},"==":function(e,t){return e==t()},"!=":function(e,t){return e!=t()},"===":function(e,t){return e===t()},"!==":function(e,t){return e!==t()},"<":function(e,t){return e<t()},">":function(e,t){return e>t()},"<=":function(e,t){return e<=t()},">=":function(e,t){return e>=t()},"<<":function(e,t){return e<<t()},">>":function(e,t){return e>>t()},">>>":function(e,t){return e>>>t()},"+":function(e,t){return e+t()},"-":function(e,t){return e-t()},"*":function(e,t){return e*t()},"/":function(e,t){return e/t()},"%":function(e,t){return e%t()}}[e.operator](G.evalAst(e.left,t),function(){return G.evalAst(e.right,t)})},evalCompound:function(e,t){for(var n,r=0;r<e.body.length;r++){e.body[r].type===`Identifier`&&[`var`,`let`,`const`].includes(e.body[r].name)&&e.body[r+1]&&e.body[r+1].type===`AssignmentExpression`&&(r+=1);var i=e.body[r];n=G.evalAst(i,t)}return n},evalConditionalExpression:function(e,t){return G.evalAst(e.test,t)?G.evalAst(e.consequent,t):G.evalAst(e.alternate,t)},evalIdentifier:function(e,t){if(Object.hasOwn(t,e.name))return t[e.name];throw ReferenceError(`${e.name} is not defined`)},evalLiteral:function(e){return e.value},evalMemberExpression:function(e,t){var n=String(e.computed?G.evalAst(e.property):e.property.name),r=G.evalAst(e.object,t);if(r==null||!Object.hasOwn(r,n)&&W.has(n))throw TypeError(`Cannot read properties of ${r} (reading '${n}')`);var i=r[n];return typeof i==`function`?i.bind(r):i},evalUnaryExpression:function(e,t){return{"-":function(e){return-G.evalAst(e,t)},"!":function(e){return!G.evalAst(e,t)},"~":function(e){return~G.evalAst(e,t)},"+":function(e){return+G.evalAst(e,t)},typeof:function e(n){return e(G.evalAst(n,t))},void:function(e){G.evalAst(e,t)}}[e.operator](e.argument)},evalArrayExpression:function(e,t){return e.elements.map(function(e){return G.evalAst(e,t)})},evalCallExpression:function(e,t){var n=e.arguments.map(function(e){return G.evalAst(e,t)}),r=G.evalAst(e.callee,t);if(r===Function)throw Error(`Function constructor is disabled`);return r.apply(void 0,S(n))},evalAssignmentExpression:function(e,t){if(e.left.type!==`Identifier`)throw SyntaxError(`Invalid left-hand side in assignment`);var n=e.left.name;return t[n]=G.evalAst(e.right,t),t[n]}},K=function(){function e(t){o(this,e),this.code=t,this.ast=I(this.code)}return l(e,[{key:`runInNewContext`,value:function(e){var t=Object.assign(Object.create(null),e);return G.evalAst(this.ast,t)}}])}();function q(e,t){return e=e.slice(),e.push(t),e}function J(e,t){return t=t.slice(),t.unshift(e),t}var Y=function(e){function t(e){var n;return o(this,t),n=a(this,t,[`JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)`]),n.avoidNew=!0,n.value=e,n.name=`NewError`,n}return p(t,e),l(t)}(O(Error));function X(e,t,n,r,i){if(!(this instanceof X))try{return new X(e,t,n,r,i)}catch(e){if(!e.avoidNew)throw e;return e.value}typeof e==`string`&&(i=r,r=n,n=t,t=e,e=null);var a=e&&T(e)===`object`;if(e=e||{},this.json=e.json||n,this.path=e.path||t,this.resultType=e.resultType||`value`,this.flatten=e.flatten||!1,this.wrap=Object.hasOwn(e,`wrap`)?e.wrap:!0,this.sandbox=e.sandbox||{},this.eval=e.eval===void 0?`safe`:e.eval,this.ignoreEvalErrors=e.ignoreEvalErrors===void 0?!1:e.ignoreEvalErrors,this.parent=e.parent||null,this.parentProperty=e.parentProperty||null,this.callback=e.callback||r||null,this.otherTypeCallback=e.otherTypeCallback||i||function(){throw TypeError(`You must supply an otherTypeCallback callback option with the @other() operator.`)},e.autostart!==!1){var o={path:a?e.path:t};a?`json`in e&&(o.json=e.json):o.json=n;var s=this.evaluate(o);if(!s||T(s)!==`object`)throw new Y(s);return s}}X.prototype.evaluate=function(e,t,n,r){var i=this,a=this.parent,o=this.parentProperty,s=this.flatten,c=this.wrap;if(this.currResultType=this.resultType,this.currEval=this.eval,this.currSandbox=this.sandbox,n=n||this.callback,this.currOtherTypeCallback=r||this.otherTypeCallback,t=t||this.json,e=e||this.path,e&&T(e)===`object`&&!Array.isArray(e)){if(!e.path&&e.path!==``)throw TypeError(`You must supply a "path" property when providing an object argument to JSONPath.evaluate().`);if(!Object.hasOwn(e,`json`))throw TypeError(`You must supply a "json" property when providing an object argument to JSONPath.evaluate().`);t=e.json,s=Object.hasOwn(e,`flatten`)?e.flatten:s,this.currResultType=Object.hasOwn(e,`resultType`)?e.resultType:this.currResultType,this.currSandbox=Object.hasOwn(e,`sandbox`)?e.sandbox:this.currSandbox,c=Object.hasOwn(e,`wrap`)?e.wrap:c,this.currEval=Object.hasOwn(e,`eval`)?e.eval:this.currEval,n=Object.hasOwn(e,`callback`)?e.callback:n,this.currOtherTypeCallback=Object.hasOwn(e,`otherTypeCallback`)?e.otherTypeCallback:this.currOtherTypeCallback,a=Object.hasOwn(e,`parent`)?e.parent:a,o=Object.hasOwn(e,`parentProperty`)?e.parentProperty:o,e=e.path}if(a=a||null,o=o||null,Array.isArray(e)&&(e=X.toPathString(e)),!(!e&&e!==``||!t)){var l=X.toPathArray(e);l[0]===`$`&&l.length>1&&l.shift(),this._hasParentSelector=null;var u=this._trace(l,t,[`$`],a,o,n).filter(function(e){return e&&!e.isParentSelector});return u.length?!c&&u.length===1&&!u[0].hasArrExpr?this._getPreferredOutput(u[0]):u.reduce(function(e,t){var n=i._getPreferredOutput(t);return s&&Array.isArray(n)?e=e.concat(n):e.push(n),e},[]):c?[]:void 0}},X.prototype._getPreferredOutput=function(e){var t=this.currResultType;switch(t){case`all`:var n=Array.isArray(e.path)?e.path:X.toPathArray(e.path);return e.pointer=X.toPointer(n),e.path=typeof e.path==`string`?e.path:X.toPathString(e.path),e;case`value`:case`parent`:case`parentProperty`:return e[t];case`path`:return X.toPathString(e[t]);case`pointer`:return X.toPointer(e.path);default:throw TypeError(`Unknown result type`)}},X.prototype._handleCallback=function(e,t,n){if(t){var r=this._getPreferredOutput(e);e.path=typeof e.path==`string`?e.path:X.toPathString(e.path),t(r,n,e)}},X.prototype._trace=function(e,t,n,r,i,a,o,s){var c=this,l;if(!e.length)return l={path:n,value:t,parent:r,parentProperty:i,hasArrExpr:o},this._handleCallback(l,a,`value`),l;var d=e[0],f=e.slice(1),p=[];function m(e){Array.isArray(e)?e.forEach(function(e){p.push(e)}):p.push(e)}if((typeof d!=`string`||s)&&t&&Object.hasOwn(t,d))m(this._trace(f,t[d],q(n,d),t,d,a,o));else if(d===`*`)this._walk(t,function(e){m(c._trace(f,t[e],q(n,e),t,e,a,!0,!0))});else if(d===`..`)m(this._trace(f,t,n,r,i,a,o)),this._walk(t,function(r){T(t[r])===`object`&&m(c._trace(e.slice(),t[r],q(n,r),t,r,a,!0))});else if(d===`^`)return this._hasParentSelector=!0,{path:n.slice(0,-1),expr:f,isParentSelector:!0};else if(d===`~`)return l={path:q(n,d),value:i,parent:r,parentProperty:null},this._handleCallback(l,a,`property`),l;else if(d===`$`)m(this._trace(f,t,n,null,null,a,o));else if(/^(-?[0-9]*):(-?[0-9]*):?([0-9]*)$/.test(d))m(this._slice(d,f,t,n,r,i,a));else if(d.indexOf(`?(`)===0){if(this.currEval===!1)throw Error(`Eval [?(expr)] prevented in JSONPath expression.`);var h=d.replace(/^\?\(((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?)\)$/,`$1`),g=/@(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])?((?:[\0->@-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)['\[](\??\((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\))(?!(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])\)\])['\]]/g.exec(h);g?this._walk(t,function(e){var o=[g[2]],s=g[1]?t[e][g[1]]:t[e];c._trace(o,s,n,r,i,a,!0).length>0&&m(c._trace(f,t[e],q(n,e),t,e,a,!0))}):this._walk(t,function(e){c._eval(h,t[e],e,n,r,i)&&m(c._trace(f,t[e],q(n,e),t,e,a,!0))})}else if(d[0]===`(`){if(this.currEval===!1)throw Error(`Eval [(expr)] prevented in JSONPath expression.`);m(this._trace(J(this._eval(d,t,n.at(-1),n.slice(0,-1),r,i),f),t,n,r,i,a,o))}else if(d[0]===`@`){var _=!1,v=d.slice(1,-2);switch(v){case`scalar`:(!t||![`object`,`function`].includes(T(t)))&&(_=!0);break;case`boolean`:case`string`:case`undefined`:case`function`:T(t)===v&&(_=!0);break;case`integer`:Number.isFinite(t)&&!(t%1)&&(_=!0);break;case`number`:Number.isFinite(t)&&(_=!0);break;case`nonFinite`:typeof t==`number`&&!Number.isFinite(t)&&(_=!0);break;case`object`:t&&T(t)===v&&(_=!0);break;case`array`:Array.isArray(t)&&(_=!0);break;case`other`:_=this.currOtherTypeCallback(t,n,r,i);break;case`null`:t===null&&(_=!0);break;default:throw TypeError(`Unknown value type `+v)}if(_)return l={path:n,value:t,parent:r,parentProperty:i},this._handleCallback(l,a,`value`),l}else if(d[0]==="`"&&t&&Object.hasOwn(t,d.slice(1))){var y=d.slice(1);m(this._trace(f,t[y],q(n,y),t,y,a,o,!0))}else if(d.includes(`,`)){var b=u(d.split(`,`)),x;try{for(b.s();!(x=b.n()).done;){var S=x.value;m(this._trace(J(S,f),t,n,r,i,a,!0))}}catch(e){b.e(e)}finally{b.f()}}else !s&&t&&Object.hasOwn(t,d)&&m(this._trace(f,t[d],q(n,d),t,d,a,o,!0));if(this._hasParentSelector)for(var C=0;C<p.length;C++){var w=p[C];if(w&&w.isParentSelector){var E=this._trace(w.expr,t,w.path,r,i,a,o);if(Array.isArray(E)){p[C]=E[0];for(var D=E.length,O=1;O<D;O++)C++,p.splice(C,0,E[O])}else p[C]=E}}return p},X.prototype._walk=function(e,t){if(Array.isArray(e))for(var n=e.length,r=0;r<n;r++)t(r);else e&&T(e)===`object`&&Object.keys(e).forEach(function(e){t(e)})},X.prototype._slice=function(e,t,n,r,i,a,o){if(Array.isArray(n)){var s=n.length,c=e.split(`:`),l=c[2]&&Number.parseInt(c[2])||1,u=c[0]&&Number.parseInt(c[0])||0,d=c[1]&&Number.parseInt(c[1])||s;u=u<0?Math.max(0,u+s):Math.min(s,u),d=d<0?Math.max(0,d+s):Math.min(s,d);for(var f=[],p=u;p<d;p+=l)this._trace(J(p,t),n,r,i,a,o,!0).forEach(function(e){f.push(e)});return f}},X.prototype._eval=function(e,t,n,r,i,a){var o=this;this.currSandbox._$_parentProperty=a,this.currSandbox._$_parent=i,this.currSandbox._$_property=n,this.currSandbox._$_root=this.json,this.currSandbox._$_v=t;var s=e.includes(`@path`);s&&(this.currSandbox._$_path=X.toPathString(r.concat([n])));var c=this.currEval+`Script:`+e;if(!X.cache[c]){var l=e.replaceAll(`@parentProperty`,`_$_parentProperty`).replaceAll(`@parent`,`_$_parent`).replaceAll(`@property`,`_$_property`).replaceAll(`@root`,`_$_root`).replaceAll(/@([\t-\r \)\.\[\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF])/g,`_$_v$1`);if(s&&(l=l.replaceAll(`@path`,`_$_path`)),this.currEval===`safe`||this.currEval===!0||this.currEval===void 0)X.cache[c]=new this.safeVm.Script(l);else if(this.currEval===`native`)X.cache[c]=new this.vm.Script(l);else if(typeof this.currEval==`function`&&this.currEval.prototype&&Object.hasOwn(this.currEval.prototype,`runInNewContext`)){var u=this.currEval;X.cache[c]=new u(l)}else if(typeof this.currEval==`function`)X.cache[c]={runInNewContext:function(e){return o.currEval(l,e)}};else throw TypeError(`Unknown "eval" property "${this.currEval}"`)}try{return X.cache[c].runInNewContext(this.currSandbox)}catch(t){if(this.ignoreEvalErrors)return!1;throw Error(`jsonPath: `+t.message+`: `+e)}},X.cache={},X.toPathString=function(e){for(var t=e,n=t.length,r=`$`,i=1;i<n;i++)/^(~|\^|@(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\(\))$/.test(t[i])||(r+=/^[\*0-9]+$/.test(t[i])?`[`+t[i]+`]`:`['`+t[i]+`']`);return r},X.toPointer=function(e){for(var t=e,n=t.length,r=``,i=1;i<n;i++)/^(~|\^|@(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\(\))$/.test(t[i])||(r+=`/`+t[i].toString().replaceAll(`~`,`~0`).replaceAll(`/`,`~1`));return r},X.toPathArray=function(e){var t=X.cache;if(t[e])return t[e].concat();var n=[];return t[e]=e.replaceAll(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/g,`;$&;`).replaceAll(/['\[](\??\((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\))['\]](?!(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])\])/g,function(e,t){return`[#`+(n.push(t)-1)+`]`}).replaceAll(/\[["']((?:[\0-&\(-\\\^-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)["']\]/g,function(e,t){return`['`+t.replaceAll(`.`,`%@%`).replaceAll(`~`,`%%@@%%`)+`']`}).replaceAll(`~`,`;~;`).replaceAll(/["']?\.["']?(?!(?:[\0-Z\\-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*\])|\[["']?/g,`;`).replaceAll(`%@%`,`.`).replaceAll(`%%@@%%`,`~`).replaceAll(/(?:;)?(\^+)(?:;)?/g,function(e,t){return`;`+t.split(``).join(`;`)+`;`}).replaceAll(/;;;|;;/g,`;..;`).replaceAll(/;$|'?\]|'$/g,``).split(`;`).map(function(e){var t=e.match(/#([0-9]+)/);return!t||!t[1]?e:n[t[1]]}),t[e].concat()},X.prototype.safeVm={Script:K};var Z=function(e,t,n){for(var r=e.length,i=0;i<r;i++){var a=e[i];n(a)&&t.push(e.splice(i--,1)[0])}},ne=function(){function e(t){o(this,e),this.code=t}return l(e,[{key:`runInNewContext`,value:function(e){var t=this.code,n=Object.keys(e),r=[];Z(n,r,function(t){return typeof e[t]==`function`});var i=n.map(function(t){return e[t]});t=r.reduce(function(t,n){var r=e[n].toString();return/function/.test(r)||(r=`function `+r),`var `+n+`=`+r+`;`+t},``)+t,!/(["'])use strict\1/.test(t)&&!n.includes(`arguments`)&&(t=`var arguments = undefined;`+t),t=t.replace(/;[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*$/,``);var a=t.lastIndexOf(`;`),o=a===-1?` return `+t:t.slice(0,a+1)+` return `+t.slice(a+1);return s(Function,n.concat([o])).apply(void 0,S(i))}}])}();X.prototype.vm={Script:ne};function re(e){if(!e)return null;try{var t,n,r=(t=(n=e.textContent)==null?void 0:n.trim())==null?``:t;return r.startsWith(`{`)||(r=`{`+r+`}`),Function(`return (${r})`)()}catch(e){return console.warn(e),null}}function Q(e,t){var n=t.getAttribute(`data-calc-id`);if(!n)return null;var r=t.querySelector(`[data-calc-place="${n}"]`);return!r||e===void 0||!e[n]?null:{data:e[n],uniqId:n+`-`+Math.random().toString(36).slice(2,7),id:n,placeNode:r}}function $(e,t){var n=y({},arguments.length>2&&arguments[2]!==void 0?arguments[2]:{});function r(t,r){var i=t.replace(/\$get:([a-zA-Z0-9_.-]+)/g,function(e,t){return String(n[t])});if(i.startsWith(`$save:`)){var a=i.replace(`$save:`,``);return n[a]=r,r}switch(i){case`$root`:return e;case`$first`:return r[0];case`$last`:var o=r;return o[o.length-1];default:return X({path:i,json:r})}}var i=t.split(`||`).map(function(e){return e.trim()}),a=null;do{a=e;for(var o=i.shift().split(`>`).map(function(e){return e.trim()});o.length;)if(a=r(o.shift(),a),a==null||Array.isArray(a)&&!a.length){a=null;break}if(a!==null)break}while(i.length);return a}function ie(e,t){var n=Q(e,t);if(n){var r=n.id,i=n.uniqId,a=n.data,o=n.placeNode,s=re(t.querySelector(`[data-configurator-options]`));if(s){var c=s.oldPricePercent,l=s.getPrice,u=s.sections,d=s.fields;t.setAttribute(`data-calc-id`,i);var f=new N({id:i,parentSelector:`[data-calc-id="${i}"]`,data:a,editableFields:[],sectionsOptions:[]});f.addField({selector:`price`,calculateFunction:function(e,t){var n=l(e,t,r),i=f.getValues();return Object.keys(i).length!==Object.keys(e).length&&setTimeout(function(){f.refresh()}),n}}),f.addField({selector:`old-price`,calculateFunction:function(){return f.getValue(`price`)/((100-c)/100)}});var p={calculateFunction:function(e){return u.map(function(t){var n;return e[t.key]+((n=t.postfix)==null?``:n)}).join(` `)}};f.addField(y({selector:`params`},p)),f.addField(y({selector:`params-attr`,attribute:!0},p));var m={calculateFunction:function(e){return u.map(function(t){var n;return`${t.title}: ${e[t.key]}${(n=t.postfix)==null?``:n}`}).join(`
30
+ `)}};f.addField(y({selector:`params-view`},m)),f.addField(y({selector:`params-view-attr`,attribute:!0},m));var h=[`price`,`old-price`];u.forEach(function(e){f.addField({selector:e.key,calculateFunction:function(t){return t[e.key]}}),h.push(e.key),f.addField({selector:`${e.key}-view`,calculateFunction:function(t){var n=t[e.key],r=$(a,e.path,t);return typeof e.selectorDisplay==`function`?e.selectorDisplay(n,r):n}});function t(t){var n,r,i;return(r=((n=e.labelMapping)==null?{}:n)[t])==null?t+((i=e.postfix)==null?``:i):r}f.addSection({title:e.title,type:e.key,inputs:Array.isArray(e.inputs)?e.inputs:function(){var n=f.getValues(),r=$(a,e.path,n);return r?r.map(function(e){return{label:t(e),value:e}}):[]}})}),Array.isArray(d)&&d.forEach(function(e){f.addField({selector:e.selector,attribute:!!e.attribute,calculateFunction:function(t,n){return e.get(t,n,r,f)}})}),h.forEach(function(e){f.addField({selector:e,attribute:!0,calculateFunction:function(){return f.getValue(e)}})}),f.renderInNode(o),f.init()}}}return e.Calculator=N,e.getOptions=Q,e.initConfigurator=ie,e.queryByPath=$,e})({});