rndefine("#RNMainGroupField",["#RNMainCore/EventManager","#RNMainFormBuilderCore/FieldBase.Options","#RNMainFormBuilderCore/FieldWithPrice.Model","lit","#RNMainFormBuilderCore/FieldContainerMixin","#RNMainFormBuilderCore/CalculatorBase","lit/decorators","#RNMainFormBuilderCore/FieldBase","#RNMainFormBuilderCore/FieldWithPrice","#RNMainLit/Lit","lit/directives/repeat.js","#RNMainCore/LitElementBase","#RNMainFormBuilderCore/CurrencyManager","#RNMainCore/StoreBase","#RNMainFormBuilderCore/FieldWithPrice.Options","#RNMainFormBuilderCore/FBRow.Options"],(function(e,t,i,s,n,r,o,a,l,d,h,u,c,p,m,v){"use strict";class _ extends r.CalculatorBase{Initialize(e){return super.Initialize(e),e.PriceManager.TotalUpdated.Subscribe(this,(()=>{this.ExecuteAndUpdate()})),this}GetQuantity(){return this.Quantity}ExecuteCalculation(e,t){return{RegularPrice:this.Field.PriceManager.GetUnitPrice(),Quantity:this.Field.PriceManager.GetQuantity()}}}class g extends(n.FieldContainerMixin(i.FieldWithPriceModel)){constructor(e,t){super(e,t),this.Options=e,this.Options.PriceType="basic";for(let t of e.Rows)this.Rows.push(this.RootFormBuilder.CreateRowModel(t,this))}InitializePriceCalculator(){this.Calculator=new _,this.Calculator.Initialize(this)}ExecuteFirstCalculation(){this.GetFields().forEach((e=>{if(e.IsFieldWithPrice){null!=e.ExecuteFirstCalculation&&e.ExecuteFirstCalculation();let t=e;t.Calculator.GetDependsOnOtherFields()||t.Calculator.ExecuteAndUpdate(),t.Calculator.GetDependsOnOtherFields()&&t.Calculator.ExecuteAndUpdate()}}))}GetStoresInformation(){return!0}get PreviousData(){return{Fields:this.GetPreviousDataProperty("Value",[])}}CreateSubRow(e){return this.FormBuilder.CreateSubRow(e)}GetValue(){let e=[];for(let t of this.GetFields(!1,!1,!1))t.GetStoresInformation()&&t.GetIsUsed()&&e.push(t.SerializeEntry());return e}InternalSerialize(e){super.InternalSerialize(e),e.Value=this.GetValue()}GetIsUsed(){return!!super.GetIsUsed()&&this.GetValue().length>0}GetPrice(){return this.PriceManager.GetGrandTotal()}render(){return s.html`<rn-group-field .model="${this}"></rn-group-field>`}InitializeStartingValues(e){}}var $,f,b;const y=globalThis,x=e=>{y.emitLitDebugLogEvents&&y.dispatchEvent(new CustomEvent("lit-debug",{detail:e}))};let C;var w;null!==(w=y.litIssuedWarnings)&&void 0!==w||(y.litIssuedWarnings=new Set),C=(e,t)=>{t+=e?` See https://lit.dev/msg/${e} for more information.`:"",y.litIssuedWarnings.has(t)||(console.warn(t),y.litIssuedWarnings.add(t))};const N=(null===($=y.ShadyDOM)||void 0===$?void 0:$.inUse)&&!0===(null===(f=y.ShadyDOM)||void 0===f?void 0:f.noPatch)?y.ShadyDOM.wrap:e=>e,S=y.trustedTypes,F=S?S.createPolicy("lit-html",{createHTML:e=>e}):void 0,T=e=>e,V=(e,t,i)=>T,M=(e,t,i)=>q(),E="$lit$",P=`lit$${String(Math.random()).slice(9)}$`,R="?"+P,G=`<${R}>`,L=document,k=()=>L.createComment(""),I=e=>null===e||"object"!=typeof e&&"function"!=typeof e,O=Array.isArray,z="[ \t\n\f\r]",B=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,A=/-->/g,D=/>/g,W=new RegExp(`>|${z}(?:([^\\s"'>=/]+)(${z}*=${z}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),H=/'/g,U=/"/g,j=/^(?:script|style|textarea|title)$/i,Q=Symbol.for("lit-noChange"),Y=Symbol.for("lit-nothing"),Z=new WeakMap,X=L.createTreeWalker(L,129);let q=V;function J(e,t){if(!Array.isArray(e)||!e.hasOwnProperty("raw")){let e="invalid template strings array";throw e=" Internal Error: expected template strings to be an array with a 'raw' field. Faking a template strings array by calling html or svg like an ordinary function is effectively the same as calling unsafeHtml and can lead to major security issues, e.g. opening your code up to XSS attacks. If you're using the html or svg tagged template functions normally and still seeing this error, please file a bug at https://github.com/lit/lit/issues/new?template=bug_report.md and include information about your build tooling, if any. ".trim().replace(/\n */g,"\n"),new Error(e)}return void 0!==F?F.createHTML(t):t}class K{constructor({strings:e,_$litType$:t},i){let s;this.parts=[];let n=0,r=0;const o=e.length-1,a=this.parts,[l,d]=((e,t)=>{const i=e.length-1,s=[];let n,r=2===t?"<svg>":"",o=B;for(let t=0;t<i;t++){const i=e[t];let l,d,h=-1,u=0;for(;u<i.length&&(o.lastIndex=u,d=o.exec(i),null!==d);)if(u=o.lastIndex,o===B){if("!--"===d[1])o=A;else if(void 0!==d[1])o=D;else if(void 0!==d[2])j.test(d[2])&&(n=new RegExp(`</${d[2]}`,"g")),o=W;else if(void 0!==d[3])throw new Error("Bindings in tag names are not supported. Please use static templates instead. See https://lit.dev/docs/templates/expressions/#static-expressions")}else if(o===W){var a;">"===d[0]?(o=null!==(a=n)&&void 0!==a?a:B,h=-1):void 0===d[1]?h=-2:(h=o.lastIndex-d[2].length,l=d[1],o=void 0===d[3]?W:'"'===d[3]?U:H)}else o===U||o===H?o=W:o===A||o===D?o=B:(o=W,n=void 0);console.assert(-1===h||o===W||o===H||o===U,"unexpected parse state B");const c=o===W&&e[t+1].startsWith("/>")?" ":"";r+=o===B?i+G:h>=0?(s.push(l),i.slice(0,h)+E+i.slice(h)+P+c):i+P+(-2===h?t:c)}return[J(e,r+(e[i]||"<?>")+(2===t?"</svg>":"")),s]})(e,t);if(this.el=K.createElement(l,i),X.currentNode=this.el.content,2===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(s=X.nextNode())&&a.length<o;){if(1===s.nodeType){{const e=s.localName;if(/^(?:textarea|template)$/i.test(e)&&s.innerHTML.includes(P)){const t=`Expressions are not supported inside \`${e}\` elements. See https://lit.dev/msg/expression-in-${e} for more information.`;if("template"===e)throw new Error(t);C("",t)}}if(s.hasAttributes())for(const e of s.getAttributeNames())if(e.endsWith(E)){const t=d[r++],i=s.getAttribute(e).split(P),o=/([.?@])?(.*)/.exec(t);a.push({type:1,index:n,name:o[2],strings:i,ctor:"."===o[1]?ne:"?"===o[1]?re:"@"===o[1]?oe:se}),s.removeAttribute(e)}else e.startsWith(P)&&(a.push({type:6,index:n}),s.removeAttribute(e));if(j.test(s.tagName)){const e=s.textContent.split(P),t=e.length-1;if(t>0){s.textContent=S?S.emptyScript:"";for(let i=0;i<t;i++)s.append(e[i],k()),X.nextNode(),a.push({type:2,index:++n});s.append(e[t],k())}}}else if(8===s.nodeType){if(s.data===R)a.push({type:2,index:n});else{let e=-1;for(;-1!==(e=s.data.indexOf(P,e+1));)a.push({type:7,index:n}),e+=P.length-1}}n++}if(d.length!==r)throw new Error('Detected duplicate attribute bindings. This occurs if your template has duplicate attributes on an element tag. For example "<input ?disabled=${true} ?disabled=${false}>" contains a duplicate "disabled" attribute. The error was detected in the following template: \n`'+e.join("${...}")+"`");x&&x({kind:"template prep",template:this,clonableTemplate:this.el,parts:this.parts,strings:e})}static createElement(e,t){const i=L.createElement("template");return i.innerHTML=e,i}}function ee(e,t,i=e,s){var n,r;if(t===Q)return t;let o=void 0!==s?null===(n=i.__directives)||void 0===n?void 0:n[s]:i.__directive;const a=I(t)?void 0:t._$litDirective$;var l,d,h;(null===(r=o)||void 0===r?void 0:r.constructor)!==a&&(null===(l=o)||void 0===l||null===(d=l._$notifyDirectiveConnectionChanged)||void 0===d||d.call(l,!1),void 0===a?o=void 0:(o=new a(e),o._$initialize(e,i,s)),void 0!==s?(null!==(h=i.__directives)&&void 0!==h?h:i.__directives=[])[s]=o:i.__directive=o);return void 0!==o&&(t=ee(e,o._$resolve(e,t.values),o,s)),t}class te{constructor(e,t){this._$parts=[],this._$disconnectableChildren=void 0,this._$template=e,this._$parent=t}get parentNode(){return this._$parent.parentNode}get _$isConnected(){return this._$parent._$isConnected}_clone(e){var t;const{el:{content:i},parts:s}=this._$template,n=(null!==(t=null==e?void 0:e.creationScope)&&void 0!==t?t:L).importNode(i,!0);X.currentNode=n;let r=X.nextNode(),o=0,a=0,l=s[0];for(;void 0!==l;){var d;if(o===l.index){let t;2===l.type?t=new ie(r,r.nextSibling,this,e):1===l.type?t=new l.ctor(r,l.name,l.strings,this,e):6===l.type&&(t=new ae(r,this,e)),this._$parts.push(t),l=s[++a]}o!==(null===(d=l)||void 0===d?void 0:d.index)&&(r=X.nextNode(),o++)}return X.currentNode=L,n}_update(e){let t=0;for(const i of this._$parts)void 0!==i&&(x&&x({kind:"set part",part:i,value:e[t],valueIndex:t,values:e,templateInstance:this}),void 0!==i.strings?(i._$setValue(e,i,t),t+=i.strings.length-2):i._$setValue(e[t])),t++}}class ie{get _$isConnected(){var e,t;return null!==(e=null===(t=this._$parent)||void 0===t?void 0:t._$isConnected)&&void 0!==e?e:this.__isConnected}constructor(e,t,i,s){var n;this.type=2,this._$committedValue=Y,this._$disconnectableChildren=void 0,this._$startNode=e,this._$endNode=t,this._$parent=i,this.options=s,this.__isConnected=null===(n=null==s?void 0:s.isConnected)||void 0===n||n,this._textSanitizer=void 0}get parentNode(){var e;let t=N(this._$startNode).parentNode;const i=this._$parent;return void 0!==i&&11===(null===(e=t)||void 0===e?void 0:e.nodeType)&&(t=i.parentNode),t}get startNode(){return this._$startNode}get endNode(){return this._$endNode}_$setValue(e,t=this){if(null===this.parentNode)throw new Error("This `ChildPart` has no `parentNode` and therefore cannot accept a value. This likely means the element containing the part was manipulated in an unsupported way outside of Lit's control such that the part's marker nodes were ejected from DOM. For example, setting the element's `innerHTML` or `textContent` can do this.");if(e=ee(this,e,t),I(e))e===Y||null==e||""===e?(this._$committedValue!==Y&&(x&&x({kind:"commit nothing to child",start:this._$startNode,end:this._$endNode,parent:this._$parent,options:this.options}),this._$clear()),this._$committedValue=Y):e!==this._$committedValue&&e!==Q&&this._commitText(e);else if(void 0!==e._$litType$)this._commitTemplateResult(e);else if(void 0!==e.nodeType){var i;if((null===(i=this.options)||void 0===i?void 0:i.host)===e)return this._commitText("[probable mistake: rendered a template's host in itself (commonly caused by writing ${this} in a template]"),void console.warn("Attempted to render the template host",e,"inside itself. This is almost always a mistake, and in dev mode ","we render some warning text. In production however, we'll ","render it, which will usually result in an error, and sometimes ","in the element disappearing from the DOM.");this._commitNode(e)}else(e=>O(e)||"function"==typeof(null==e?void 0:e[Symbol.iterator]))(e)?this._commitIterable(e):this._commitText(e)}_insert(e){return N(N(this._$startNode).parentNode).insertBefore(e,this._$endNode)}_commitNode(e){if(this._$committedValue!==e){if(this._$clear(),q!==V){var t;const e=null===(t=this._$startNode.parentNode)||void 0===t?void 0:t.nodeName;if("STYLE"===e||"SCRIPT"===e){let t="Forbidden";throw t="STYLE"===e?"Lit does not support binding inside style nodes. This is a security risk, as style injection attacks can exfiltrate data and spoof UIs. Consider instead using css`...` literals to compose styles, and make do dynamic styling with css custom properties, ::parts, <slot>s, and by mutating the DOM rather than stylesheets.":"Lit does not support binding inside script nodes. This is a security risk, as it could allow arbitrary code execution.",new Error(t)}}x&&x({kind:"commit node",start:this._$startNode,parent:this._$parent,value:e,options:this.options}),this._$committedValue=this._insert(e)}}_commitText(e){if(this._$committedValue!==Y&&I(this._$committedValue)){const t=N(this._$startNode).nextSibling;void 0===this._textSanitizer&&(this._textSanitizer=M()),e=this._textSanitizer(e),x&&x({kind:"commit text",node:t,value:e,options:this.options}),t.data=e}else{const t=L.createTextNode("");this._commitNode(t),void 0===this._textSanitizer&&(this._textSanitizer=M()),e=this._textSanitizer(e),x&&x({kind:"commit text",node:t,value:e,options:this.options}),t.data=e}this._$committedValue=e}_commitTemplateResult(e){var t;const{values:i,_$litType$:s}=e,n="number"==typeof s?this._$getTemplate(e):(void 0===s.el&&(s.el=K.createElement(J(s.h,s.h[0]),this.options)),s);if((null===(t=this._$committedValue)||void 0===t?void 0:t._$template)===n)x&&x({kind:"template updating",template:n,instance:this._$committedValue,parts:this._$committedValue._$parts,options:this.options,values:i}),this._$committedValue._update(i);else{const e=new te(n,this),t=e._clone(this.options);x&&x({kind:"template instantiated",template:n,instance:e,parts:e._$parts,options:this.options,fragment:t,values:i}),e._update(i),x&&x({kind:"template instantiated and updated",template:n,instance:e,parts:e._$parts,options:this.options,fragment:t,values:i}),this._commitNode(t),this._$committedValue=e}}_$getTemplate(e){let t=Z.get(e.strings);return void 0===t&&Z.set(e.strings,t=new K(e)),t}_commitIterable(e){O(this._$committedValue)||(this._$committedValue=[],this._$clear());const t=this._$committedValue;let i,s=0;for(const n of e)s===t.length?t.push(i=new ie(this._insert(k()),this._insert(k()),this,this.options)):i=t[s],i._$setValue(n),s++;s<t.length&&(this._$clear(i&&N(i._$endNode).nextSibling,s),t.length=s)}_$clear(e=N(this._$startNode).nextSibling,t){var i;for(null===(i=this._$notifyConnectionChanged)||void 0===i||i.call(this,!1,!0,t);e&&e!==this._$endNode;){const t=N(e).nextSibling;N(e).remove(),e=t}}setConnected(e){if(void 0!==this._$parent)throw new Error("part.setConnected() may only be called on a RootPart returned from render().");var t;this.__isConnected=e,null===(t=this._$notifyConnectionChanged)||void 0===t||t.call(this,e)}}class se{get tagName(){return this.element.tagName}get _$isConnected(){return this._$parent._$isConnected}constructor(e,t,i,s,n){this.type=1,this._$committedValue=Y,this._$disconnectableChildren=void 0,this.element=e,this.name=t,this._$parent=s,this.options=n,i.length>2||""!==i[0]||""!==i[1]?(this._$committedValue=new Array(i.length-1).fill(new String),this.strings=i):this._$committedValue=Y,this._sanitizer=void 0}_$setValue(e,t=this,i,s){const n=this.strings;let r=!1;if(void 0===n)e=ee(this,e,t,0),r=!I(e)||e!==this._$committedValue&&e!==Q,r&&(this._$committedValue=e);else{const s=e;let a,l;for(e=n[0],a=0;a<n.length-1;a++){if(l=ee(this,s[i+a],t,a),l===Q&&(l=this._$committedValue[a]),r||(r=!I(l)||l!==this._$committedValue[a]),l===Y)e=Y;else if(e!==Y){var o;e+=(null!==(o=l)&&void 0!==o?o:"")+n[a+1]}this._$committedValue[a]=l}}r&&!s&&this._commitValue(e)}_commitValue(e){var t,i;e===Y?N(this.element).removeAttribute(this.name):(void 0===this._sanitizer&&(this._sanitizer=q(this.element,this.name)),e=this._sanitizer(null!==(i=e)&&void 0!==i?i:""),x&&x({kind:"commit attribute",element:this.element,name:this.name,value:e,options:this.options}),N(this.element).setAttribute(this.name,null!==(t=e)&&void 0!==t?t:""))}}class ne extends se{constructor(){super(...arguments),this.type=3}_commitValue(e){void 0===this._sanitizer&&(this._sanitizer=q(this.element,this.name)),e=this._sanitizer(e),x&&x({kind:"commit property",element:this.element,name:this.name,value:e,options:this.options}),this.element[this.name]=e===Y?void 0:e}}class re extends se{constructor(){super(...arguments),this.type=4}_commitValue(e){x&&x({kind:"commit boolean attribute",element:this.element,name:this.name,value:!(!e||e===Y),options:this.options}),N(this.element).toggleAttribute(this.name,!!e&&e!==Y)}}class oe extends se{constructor(e,t,i,s,n){if(super(e,t,i,s,n),this.type=5,void 0!==this.strings)throw new Error(`A \`<${e.localName}>\` has a \`@${t}=...\` listener with invalid content. Event listeners in templates must have exactly one expression and no surrounding text.`)}_$setValue(e,t=this){var i;if((e=null!==(i=ee(this,e,t,0))&&void 0!==i?i:Y)===Q)return;const s=this._$committedValue,n=e===Y&&s!==Y||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,r=e!==Y&&(s===Y||n);x&&x({kind:"commit event listener",element:this.element,name:this.name,value:e,options:this.options,removeListener:n,addListener:r,oldListener:s}),n&&this.element.removeEventListener(this.name,this,s),r&&this.element.addEventListener(this.name,this,e),this._$committedValue=e}handleEvent(e){var t,i;"function"==typeof this._$committedValue?this._$committedValue.call(null!==(t=null===(i=this.options)||void 0===i?void 0:i.host)&&void 0!==t?t:this.element,e):this._$committedValue.handleEvent(e)}}class ae{constructor(e,t,i){this.element=e,this.type=6,this._$disconnectableChildren=void 0,this._$parent=t,this.options=i}get _$isConnected(){return this._$parent._$isConnected}_$setValue(e){x&&x({kind:"commit to element binding",element:this.element,value:e,options:this.options}),ee(this,e)}}const le=y.litHtmlPolyfillSupportDevMode;null==le||le(K,ie),(null!==(b=y.litHtmlVersions)&&void 0!==b?b:y.litHtmlVersions=[]).push("3.1.2"),y.litHtmlVersions.length>1&&C("multiple-versions","Multiple versions of Lit loaded. Loading multiple versions is not recommended.");const de=2;class he{constructor(e){}get _$isConnected(){return this._$parent._$isConnected}_$initialize(e,t,i){this.__part=e,this._$parent=t,this.__attributeIndex=i}_$resolve(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}class ue extends he{constructor(e){if(super(e),this._value=Y,e.type!==de)throw new Error(`${this.constructor.directiveName}() can only be used in child bindings`)}render(e){if(e===Y||null==e)return this._templateResult=void 0,this._value=e;if(e===Q)return e;if("string"!=typeof e)throw new Error(`${this.constructor.directiveName}() called with a non-string value`);if(e===this._value)return this._templateResult;this._value=e;const t=[e];return t.raw=t,this._templateResult={_$litType$:this.constructor.resultType,strings:t,values:[]}}}ue.directiveName="unsafeHTML",ue.resultType=1;const ce=(pe=ue,(...e)=>({_$litDirective$:pe,values:e}));var pe,me;o.customElement("group-field-sub-total")(class extends u.LitElementBase{render(){return 0==this.model.PriceManager.GetGrandTotal()?"":s.html` <div style="margin-top: 5px"> <label class="subTotalLabel">${this.model.Options.SubTotalLabel}</label> <span class=${"price rn-price "}> <span class="amount"> ${ce(c.CurrencyManager.FormatPrice(this.model.PriceManager.GetGrandTotal()))} </span> </span> </div> `}connectedCallback(){super.connectedCallback(),this.model.PriceManager.FieldPriceUpdated.Subscribe(this,(()=>this.forceUpdate()))}disconnectedCallback(){super.disconnectedCallback(),this.model.PriceManager.FieldPriceUpdated.Unsubscribe(this)}});let ve=o.customElement("rn-group-field")(me=class extends l.FieldWithPrice{static get properties(){return a.FieldBase.properties}BeforeSubFieldContainer(){return""}AfterSubFieldContainer(){return""}GetLabel(e="",t,i=!1){return""}SubRender(){return s.html` <div class="rednaoGroupContainer" @click="${e=>this.Click(e)}"> ${d.rnIf(!this.model.Options.HideLabel&&""!=this.model.Options.Label&&this.model.Rows.length>0&&s.html` <div style="margin-bottom: 5px"> <h3 class="rnTitle">${this.model.Options.Label}</h3> <hr style="margin: 0;padding: 0;" /> </div> `)} <div class="rnGroupFieldContainer"> ${this.BeforeSubFieldContainer()} ${h.repeat(this.model.Rows,(e=>e.Options.Id),(e=>e.render()))} ${this.AfterSubFieldContainer()} </div> ${d.rnIf(this.model.Options.ShowSubTotal&&s.html`<group-field-sub-total .model="${this.model}"></group-field-sub-total>`)} </div> `}Click(e){}})||me;var _e,ge,$e;let fe=(_e=p.StoreDataType(v.FBRowOptions),ge=class extends m.FieldWithPriceOptions{constructor(...e){super(...e),babelHelpers.initializerDefineProperty(this,"Rows",$e,this)}LoadDefaultValues(){super.LoadDefaultValues(),this.Label="List",this.PriceType="basic",this.Type=t.FieldTypeEnum.GroupPanel,this.ShowSubTotal=!1,this.SubTotalLabel="Subtotal",this.Rows=[],this.IsFieldContainer=!0}},$e=babelHelpers.applyDecoratedDescriptor(ge.prototype,"Rows",[_e],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),ge);exports.GroupFieldModel=g,exports.GroupField=ve,exports.GroupFieldOptions=fe,e.EventManager.Subscribe("GetFieldOptions",(e=>{if(e==t.FieldTypeEnum.GroupPanel)return new fe})),e.EventManager.Subscribe("GetFieldModel",(e=>{if(e.Options.Type==t.FieldTypeEnum.GroupPanel)return new g(e.Options,e.Parent)}))}));