@foxy.io/elements 1.14.1 → 1.14.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import"./shared-0ced76a0.js";import"./shared-ec861f31.js";import"./shared-e5cbf291.js";import"./shared-9221e6b2.js";import"./foxy-spinner.js";import"./foxy-i18n.js";import{h as e}from"./shared-63eaded9.js";import{C as t}from"./shared-593f7e2c.js";import{N as i}from"./shared-44cfc617.js";import{P as s}from"./shared-8a7bee0d.js";import{S as a,T as r,a as d}from"./shared-9a40309d.js";import{c as o}from"./shared-4e709717.js";import{i as n}from"./shared-6d45a07b.js";import{m as l}from"./shared-1761daef.js";import"./shared-df573cea.js";import"./shared-ff79f3f9.js";import"./shared-bb824ab4.js";import"./shared-46ee137f.js";import"./shared-07abcd7b.js";import"./shared-00563cb0.js";import"./shared-60126eee.js";import"./shared-7684cb05.js";import"./shared-a46edf4b.js";const m=["AF","AX","AL","DZ","AS","AD","AO","AI","AQ","AG","AR","AM","AW","AU","AT","AZ","BS","BH","BD","BB","BY","BE","BZ","BJ","BM","BT","BO","BQ","BA","BW","BV","BR","IO","BN","BG","BF","BI","KH","CM","CA","CV","CW","KY","CF","TD","CL","CN","CX","CC","CO","KM","CG","CD","CK","CR","CI","HR","CU","CY","CZ","DK","DJ","DM","DO","EC","EG","SV","SX","GQ","ER","EE","ET","FK","FO","FJ","FI","FR","GF","PF","TF","GA","GM","GE","DE","GH","GI","GR","GL","GD","GP","GU","GT","GG","GN","GW","GY","HT","HM","VA","HN","HK","HU","IS","IN","ID","IR","IQ","IE","IM","IL","IT","JM","JP","JE","JO","KZ","KE","KI","KP","KR","KW","KG","LA","LV","LB","LS","LR","LY","LI","LT","LU","MO","MK","MG","MW","MY","MV","ML","MT","MH","MQ","MR","MU","YT","MX","FM","MD","MC","MN","ME","MS","MA","MZ","MM","NA","NR","NP","NL","NC","NZ","NI","NE","NG","NU","NF","MP","NO","OM","PK","PW","PS","PA","PG","PY","PE","PH","PN","PL","PT","PR","QA","RE","RO","RU","RW","BL","SH","KN","LC","MF","PM","VC","WS","SM","SS","ST","SA","SN","RS","SC","SL","SG","SK","SI","SB","SO","ZA","GS","ES","LK","SD","SR","SJ","SZ","SE","CH","SY","TW","TJ","TZ","TH","TL","TG","TK","TO","TT","TN","TR","TM","TC","TV","UG","UA","AE","GB","US","UM","UY","UZ","VU","VE","VN","VG","VI","WF","EH","YE","ZM","ZW"],h=["AL","AK","AS","AZ","AR","AF","AA","AC","AE","AM","AP","CA","CO","CT","DE","DC","FM","FL","GA","GU","HI","ID","IL","IN","IA","KS","KY","LA","ME","MH","MD","MA","MI","MN","MS","MO","MT","NE","NV","NH","NJ","NM","NY","NC","ND","MP","OH","OK","OR","PA","PR","RI","SC","SD","TN","TX","UT","VT","VI","VA","WA","WV","WI","WY"];let c,_,f,p,u,g=e=>e;const b=a(t(r(d(i,"address-form"))));class y extends b{constructor(){super(...arguments),this.templates={},this.__getValidator=l((e=>()=>!this.errors.some((t=>t.startsWith(e))))),this.__bindField=l((e=>t=>{const i=t.target;this.edit({[e]:i.value})})),this.__maybeRenderComboBox=t=>{var i,s;const{source:a,field:r,custom:d=!1}=t,o=r.replace(/_/,"-");if(this.hiddenSelector.matches(o))return"";const l=customElements.get("foxy-i18n").i18next.getFixedT(this.lang,r);return e(c||(c=g` <div> ${0} <vaadin-combo-box class="w-full" label="${0}" value="${0}" error-message="${0}" data-testid="${0}" item-value-path="code" item-label-path="text" .checkValidity="${0}" .items="${0}" ?allow-custom-value="${0}" ?readonly="${0}" ?disabled="${0}" @change="${0}"> </vaadin-combo-box> ${0} </div> `),this.renderTemplateOrSlot(`${o}:before`),this.t(r).toString(),n(null===(s=null===(i=this.form)||void 0===i?void 0:i[r])||void 0===s?void 0:s.toString()),this.__getErrorMessage(r),o,this.__getValidator(r),a.map((e=>({text:l(e).toString(),code:e}))),d,this.readonlySelector.matches(o,!0),!this.in("idle")||this.disabledSelector.matches(o,!0),this.__bindField(r),this.renderTemplateOrSlot(`${o}:after`))},this.__maybeRenderTextField=t=>{var i,s;const{field:a,wide:r=!1,readonly:d=!1,required:l=!1}=t,m=a.replace(/_/,"-").replace("1","-one").replace("2","-two");return this.hiddenSelector.matches(m)?"":e(_||(_=g` <div class="${0}"> ${0} <vaadin-text-field class="w-full" label="${0}" value="${0}" error-message="${0}" data-testid="${0}" .checkValidity="${0}" ?disabled="${0}" ?required="${0}" ?readonly="${0}" @input="${0}" @keydown="${0}"> </vaadin-text-field> ${0} </div> `),o({"col-span-2":r}),this.renderTemplateOrSlot(`${m}:before`),this.t(a).toString(),n(null===(s=null===(i=this.form)||void 0===i?void 0:i[a])||void 0===s?void 0:s.toString()),this.__getErrorMessage(a),m,this.__getValidator(a),!this.in("idle")||this.disabledSelector.matches(m),l,d||this.readonlySelector.matches(m),this.__bindField(a),this.__handleKeyDown,this.renderTemplateOrSlot(`${m}:after`))},this.__renderTimestamps=()=>{const t=["date_modified","date_created"].map((e=>{var t;return{name:this.t(e),value:(null===(t=this.data)||void 0===t?void 0:t[e])?this.t("date",{value:new Date(this.data[e])}):""}}));return e(f||(f=g` <div> ${0} <x-property-table .items="${0}" data-testid="timestamps"></x-property-table> ${0} </div> `),this.renderTemplateOrSlot("timestamps:before"),t,this.renderTemplateOrSlot("timestamps:after"))},this.__renderAction=t=>{var i,s;const a=this.in({idle:{template:{dirty:"valid"}}}),r=this.in({idle:{snapshot:{dirty:"valid"}}}),d=!this.in("idle")||this.disabledSelector.matches(t,!0),o=!!(null===(i=this.form)||void 0===i?void 0:i.is_default_shipping),n=!!(null===(s=this.form)||void 0===s?void 0:s.is_default_billing),l=o||n,m=a||r;return e(p||(p=g` <div> ${0} <vaadin-button class="w-full" theme="${0}" data-testid="${0}" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" key="${0}" lang="${0}"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot(`${t}:before`),this.in("idle")?"primary "+(this.href?"error":"success"):"",t,this.in({idle:"template"})&&!m||d||l,this.__handleActionClick,this.ns,t,this.lang,this.renderTemplateOrSlot(`${t}:after`))}}static get scopedElements(){return{"foxy-internal-confirm-dialog":customElements.get("foxy-internal-confirm-dialog"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"vaadin-text-field":customElements.get("vaadin-text-field"),"vaadin-combo-box":customElements.get("vaadin-combo-box"),"x-property-table":s,"vaadin-button":customElements.get("vaadin-button"),"foxy-spinner":customElements.get("foxy-spinner"),"foxy-i18n":customElements.get("foxy-i18n")}}static get v8n(){return[({address_name:e})=>e&&e.length>0||"address_name_required",({address_name:e})=>!e||e.length<=100||"address_name_too_long",({first_name:e})=>!e||e.length<=50||"first_name_too_long",({last_name:e})=>!e||e.length<=50||"last_name_too_long",({region:e})=>!e||e.length<=50||"region_too_long",({city:e})=>!e||e.length<=50||"city_too_long",({phone:e})=>!e||e.length<=50||"phone_too_long",({company:e})=>!e||e.length<=50||"company_too_long",({address2:e})=>!e||e.length<=100||"address2_too_long",({address1:e})=>e&&e.length>0||"address1_required",({address1:e})=>e&&e.length<=100||"address1_too_long",({postal_code:e})=>!e||e.length<=50||"postal_code_too_long"]}connectedCallback(){super.connectedCallback(),customElements.get("foxy-i18n").i18next.loadNamespaces(["country","region"])}render(){var t,i,s,a;const{hiddenSelector:r,lang:d,ns:n}=this,l=this.href?"delete":"create",c=!!(null===(t=this.form)||void 0===t?void 0:t.is_default_shipping),_=!!(null===(i=this.form)||void 0===i?void 0:i.is_default_billing),f=c||_,p=this.in("busy"),b=this.in("fail");return e(u||(u=g` <foxy-internal-confirm-dialog message="delete_prompt" confirm="delete" cancel="cancel" header="delete" theme="primary error" lang="${0}" ns="${0}" id="confirm" data-testid="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> <div class="space-y-l font-lumo text-m leading-m text-body relative" aria-busy="${0}" aria-live="polite" data-testid="wrapper"> <div class="grid grid-cols-2 gap-m"> ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} </div> ${0} ${0} <div data-testid="spinner" class="${0}"> <foxy-spinner layout="vertical" class="m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l" state="${0}" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),d,n,this.__handleConfirmHide,this.in("busy"),this.__maybeRenderTextField({field:"address_name",wide:!0,readonly:f,required:!0}),this.__maybeRenderTextField({field:"first_name"}),this.__maybeRenderTextField({field:"last_name"}),this.__maybeRenderTextField({field:"company"}),this.__maybeRenderTextField({field:"phone"}),this.__maybeRenderTextField({field:"address1",wide:!0,required:!0}),this.__maybeRenderTextField({field:"address2",wide:!0}),this.__maybeRenderComboBox({field:"country",source:m}),this.__maybeRenderComboBox({field:"region",source:h,custom:!0}),this.__maybeRenderTextField({field:"city"}),this.__maybeRenderTextField({field:"postal_code"}),!this.data||r.matches("timestamps",!0)?"":this.__renderTimestamps(),r.matches(l,!0)?"":this.__renderAction(l),o({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":!p&&!b}),b?"error":p?"busy":"empty",d,this.ns,null!==(a=null===(s=customElements.get("foxy-spinner"))||void 0===s?void 0:s.defaultNS)&&void 0!==a?a:"")}disconnectedCallback(){var e,t;super.disconnectedCallback(),null===(t=(e=this.__getValidator.cache).clear)||void 0===t||t.call(e)}__handleKeyDown(e){"Enter"===e.key&&this.submit()}__getErrorMessage(e){const t=this.errors.find((t=>t.startsWith(e)));return t?this.t(t.replace(e,"v8n")).toString():""}__handleActionClick(e){if(this.in({idle:"snapshot"})){this.renderRoot.querySelector("#confirm").show(e.currentTarget)}else this.submit()}__handleConfirmHide(e){e.detail.cancelled||this.delete()}}customElements.define("foxy-address-form",y);export{y as AddressForm};
1
+ import"./shared-0ced76a0.js";import"./shared-ec861f31.js";import"./shared-b1fc5dc3.js";import"./shared-9221e6b2.js";import"./foxy-spinner.js";import"./foxy-i18n.js";import{h as e}from"./shared-63eaded9.js";import{C as t}from"./shared-593f7e2c.js";import{N as i}from"./shared-44cfc617.js";import{P as s}from"./shared-8a7bee0d.js";import{S as a,T as r,a as d}from"./shared-9a40309d.js";import{c as o}from"./shared-4e709717.js";import{i as n}from"./shared-6d45a07b.js";import{m as l}from"./shared-1761daef.js";import"./shared-df573cea.js";import"./shared-ff79f3f9.js";import"./shared-bb824ab4.js";import"./shared-46ee137f.js";import"./shared-07abcd7b.js";import"./shared-00563cb0.js";import"./shared-60126eee.js";import"./shared-7684cb05.js";import"./shared-a46edf4b.js";const m=["AF","AX","AL","DZ","AS","AD","AO","AI","AQ","AG","AR","AM","AW","AU","AT","AZ","BS","BH","BD","BB","BY","BE","BZ","BJ","BM","BT","BO","BQ","BA","BW","BV","BR","IO","BN","BG","BF","BI","KH","CM","CA","CV","CW","KY","CF","TD","CL","CN","CX","CC","CO","KM","CG","CD","CK","CR","CI","HR","CU","CY","CZ","DK","DJ","DM","DO","EC","EG","SV","SX","GQ","ER","EE","ET","FK","FO","FJ","FI","FR","GF","PF","TF","GA","GM","GE","DE","GH","GI","GR","GL","GD","GP","GU","GT","GG","GN","GW","GY","HT","HM","VA","HN","HK","HU","IS","IN","ID","IR","IQ","IE","IM","IL","IT","JM","JP","JE","JO","KZ","KE","KI","KP","KR","KW","KG","LA","LV","LB","LS","LR","LY","LI","LT","LU","MO","MK","MG","MW","MY","MV","ML","MT","MH","MQ","MR","MU","YT","MX","FM","MD","MC","MN","ME","MS","MA","MZ","MM","NA","NR","NP","NL","NC","NZ","NI","NE","NG","NU","NF","MP","NO","OM","PK","PW","PS","PA","PG","PY","PE","PH","PN","PL","PT","PR","QA","RE","RO","RU","RW","BL","SH","KN","LC","MF","PM","VC","WS","SM","SS","ST","SA","SN","RS","SC","SL","SG","SK","SI","SB","SO","ZA","GS","ES","LK","SD","SR","SJ","SZ","SE","CH","SY","TW","TJ","TZ","TH","TL","TG","TK","TO","TT","TN","TR","TM","TC","TV","UG","UA","AE","GB","US","UM","UY","UZ","VU","VE","VN","VG","VI","WF","EH","YE","ZM","ZW"],h=["AL","AK","AS","AZ","AR","AF","AA","AC","AE","AM","AP","CA","CO","CT","DE","DC","FM","FL","GA","GU","HI","ID","IL","IN","IA","KS","KY","LA","ME","MH","MD","MA","MI","MN","MS","MO","MT","NE","NV","NH","NJ","NM","NY","NC","ND","MP","OH","OK","OR","PA","PR","RI","SC","SD","TN","TX","UT","VT","VI","VA","WA","WV","WI","WY"];let c,_,f,p,u,g=e=>e;const b=a(t(r(d(i,"address-form"))));class y extends b{constructor(){super(...arguments),this.templates={},this.__getValidator=l((e=>()=>!this.errors.some((t=>t.startsWith(e))))),this.__bindField=l((e=>t=>{const i=t.target;this.edit({[e]:i.value})})),this.__maybeRenderComboBox=t=>{var i,s;const{source:a,field:r,custom:d=!1}=t,o=r.replace(/_/,"-");if(this.hiddenSelector.matches(o))return"";const l=customElements.get("foxy-i18n").i18next.getFixedT(this.lang,r);return e(c||(c=g` <div> ${0} <vaadin-combo-box class="w-full" label="${0}" value="${0}" error-message="${0}" data-testid="${0}" item-value-path="code" item-label-path="text" .checkValidity="${0}" .items="${0}" ?allow-custom-value="${0}" ?readonly="${0}" ?disabled="${0}" @change="${0}"> </vaadin-combo-box> ${0} </div> `),this.renderTemplateOrSlot(`${o}:before`),this.t(r).toString(),n(null===(s=null===(i=this.form)||void 0===i?void 0:i[r])||void 0===s?void 0:s.toString()),this.__getErrorMessage(r),o,this.__getValidator(r),a.map((e=>({text:l(e).toString(),code:e}))),d,this.readonlySelector.matches(o,!0),!this.in("idle")||this.disabledSelector.matches(o,!0),this.__bindField(r),this.renderTemplateOrSlot(`${o}:after`))},this.__maybeRenderTextField=t=>{var i,s;const{field:a,wide:r=!1,readonly:d=!1,required:l=!1}=t,m=a.replace(/_/,"-").replace("1","-one").replace("2","-two");return this.hiddenSelector.matches(m)?"":e(_||(_=g` <div class="${0}"> ${0} <vaadin-text-field class="w-full" label="${0}" value="${0}" error-message="${0}" data-testid="${0}" .checkValidity="${0}" ?disabled="${0}" ?required="${0}" ?readonly="${0}" @input="${0}" @keydown="${0}"> </vaadin-text-field> ${0} </div> `),o({"col-span-2":r}),this.renderTemplateOrSlot(`${m}:before`),this.t(a).toString(),n(null===(s=null===(i=this.form)||void 0===i?void 0:i[a])||void 0===s?void 0:s.toString()),this.__getErrorMessage(a),m,this.__getValidator(a),!this.in("idle")||this.disabledSelector.matches(m),l,d||this.readonlySelector.matches(m),this.__bindField(a),this.__handleKeyDown,this.renderTemplateOrSlot(`${m}:after`))},this.__renderTimestamps=()=>{const t=["date_modified","date_created"].map((e=>{var t;return{name:this.t(e),value:(null===(t=this.data)||void 0===t?void 0:t[e])?this.t("date",{value:new Date(this.data[e])}):""}}));return e(f||(f=g` <div> ${0} <x-property-table .items="${0}" data-testid="timestamps"></x-property-table> ${0} </div> `),this.renderTemplateOrSlot("timestamps:before"),t,this.renderTemplateOrSlot("timestamps:after"))},this.__renderAction=t=>{var i,s;const a=this.in({idle:{template:{dirty:"valid"}}}),r=this.in({idle:{snapshot:{dirty:"valid"}}}),d=!this.in("idle")||this.disabledSelector.matches(t,!0),o=!!(null===(i=this.form)||void 0===i?void 0:i.is_default_shipping),n=!!(null===(s=this.form)||void 0===s?void 0:s.is_default_billing),l=o||n,m=a||r;return e(p||(p=g` <div> ${0} <vaadin-button class="w-full" theme="${0}" data-testid="${0}" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" key="${0}" lang="${0}"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot(`${t}:before`),this.in("idle")?"primary "+(this.href?"error":"success"):"",t,this.in({idle:"template"})&&!m||d||l,this.__handleActionClick,this.ns,t,this.lang,this.renderTemplateOrSlot(`${t}:after`))}}static get scopedElements(){return{"foxy-internal-confirm-dialog":customElements.get("foxy-internal-confirm-dialog"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"vaadin-text-field":customElements.get("vaadin-text-field"),"vaadin-combo-box":customElements.get("vaadin-combo-box"),"x-property-table":s,"vaadin-button":customElements.get("vaadin-button"),"foxy-spinner":customElements.get("foxy-spinner"),"foxy-i18n":customElements.get("foxy-i18n")}}static get v8n(){return[({address_name:e})=>e&&e.length>0||"address_name_required",({address_name:e})=>!e||e.length<=100||"address_name_too_long",({first_name:e})=>!e||e.length<=50||"first_name_too_long",({last_name:e})=>!e||e.length<=50||"last_name_too_long",({region:e})=>!e||e.length<=50||"region_too_long",({city:e})=>!e||e.length<=50||"city_too_long",({phone:e})=>!e||e.length<=50||"phone_too_long",({company:e})=>!e||e.length<=50||"company_too_long",({address2:e})=>!e||e.length<=100||"address2_too_long",({address1:e})=>e&&e.length>0||"address1_required",({address1:e})=>e&&e.length<=100||"address1_too_long",({postal_code:e})=>!e||e.length<=50||"postal_code_too_long"]}connectedCallback(){super.connectedCallback(),customElements.get("foxy-i18n").i18next.loadNamespaces(["country","region"])}render(){var t,i,s,a;const{hiddenSelector:r,lang:d,ns:n}=this,l=this.href?"delete":"create",c=!!(null===(t=this.form)||void 0===t?void 0:t.is_default_shipping),_=!!(null===(i=this.form)||void 0===i?void 0:i.is_default_billing),f=c||_,p=this.in("busy"),b=this.in("fail");return e(u||(u=g` <foxy-internal-confirm-dialog message="delete_prompt" confirm="delete" cancel="cancel" header="delete" theme="primary error" lang="${0}" ns="${0}" id="confirm" data-testid="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> <div class="space-y-l font-lumo text-m leading-m text-body relative" aria-busy="${0}" aria-live="polite" data-testid="wrapper"> <div class="grid grid-cols-2 gap-m"> ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} </div> ${0} ${0} <div data-testid="spinner" class="${0}"> <foxy-spinner layout="vertical" class="m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l" state="${0}" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),d,n,this.__handleConfirmHide,this.in("busy"),this.__maybeRenderTextField({field:"address_name",wide:!0,readonly:f,required:!0}),this.__maybeRenderTextField({field:"first_name"}),this.__maybeRenderTextField({field:"last_name"}),this.__maybeRenderTextField({field:"company"}),this.__maybeRenderTextField({field:"phone"}),this.__maybeRenderTextField({field:"address1",wide:!0,required:!0}),this.__maybeRenderTextField({field:"address2",wide:!0}),this.__maybeRenderComboBox({field:"country",source:m}),this.__maybeRenderComboBox({field:"region",source:h,custom:!0}),this.__maybeRenderTextField({field:"city"}),this.__maybeRenderTextField({field:"postal_code"}),!this.data||r.matches("timestamps",!0)?"":this.__renderTimestamps(),r.matches(l,!0)?"":this.__renderAction(l),o({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":!p&&!b}),b?"error":p?"busy":"empty",d,this.ns,null!==(a=null===(s=customElements.get("foxy-spinner"))||void 0===s?void 0:s.defaultNS)&&void 0!==a?a:"")}disconnectedCallback(){var e,t;super.disconnectedCallback(),null===(t=(e=this.__getValidator.cache).clear)||void 0===t||t.call(e)}__handleKeyDown(e){"Enter"===e.key&&this.submit()}__getErrorMessage(e){const t=this.errors.find((t=>t.startsWith(e)));return t?this.t(t.replace(e,"v8n")).toString():""}__handleActionClick(e){if(this.in({idle:"snapshot"})){this.renderRoot.querySelector("#confirm").show(e.currentTarget)}else this.submit()}__handleConfirmHide(e){e.detail.cancelled||this.delete()}}customElements.define("foxy-address-form",y);export{y as AddressForm};
@@ -1 +1 @@
1
- import{C as e}from"./shared-d8ffb279.js";import"./shared-bb824ab4.js";import"./shared-0ced76a0.js";import"./shared-e5cbf291.js";import"./shared-9221e6b2.js";import"./foxy-spinner.js";import"./foxy-i18n.js";import"./shared-46ee137f.js";import"./shared-df573cea.js";import"./shared-f0a83bd6.js";import{h as t}from"./shared-63eaded9.js";import{a as i,T as s,S as a}from"./shared-9a40309d.js";import{c as r}from"./shared-4e709717.js";import"./shared-07abcd7b.js";import"./shared-b5147166.js";import"./shared-ec861f31.js";import{m as l}from"./shared-1761daef.js";import{G as d}from"./shared-91e768be.js";import{P as n}from"./shared-8a7bee0d.js";import{C as o}from"./shared-593f7e2c.js";import{N as h}from"./shared-44cfc617.js";import{i as m}from"./shared-6d45a07b.js";import"./shared-ff79f3f9.js";import"./shared-87ca7818.js";import"./shared-b0f0e8b5.js";import"./shared-a46edf4b.js";import"./shared-60126eee.js";import"./shared-00563cb0.js";import"./shared-7684cb05.js";let c,f,p,b,v,y,u=e=>e;const _=i(o(s(a(h))),"attribute-form");class $ extends _{constructor(){super(...arguments),this.templates={},this.__getValidator=l((e=>()=>!this.errors.some((t=>t.startsWith(e))))),this.__bindField=l((e=>t=>{const i=t.target;this.edit({[e]:i.value})})),this.__maybeRenderTextField=({field:e})=>{var i,s;const a=e.replace(/_/,"-");return this.hiddenSelector.matches(a)?"":t(c||(c=u` <div> ${0} <vaadin-text-field class="w-full" label="${0}" value="${0}" error-message="${0}" data-testid="${0}" .checkValidity="${0}" ?disabled="${0}" ?readonly="${0}" @input="${0}" @keydown="${0}"> </vaadin-text-field> ${0} </div> `),this.renderTemplateOrSlot(`${a}:before`),this.t(e).toString(),m(null===(s=null===(i=this.form)||void 0===i?void 0:i[e])||void 0===s?void 0:s.toString()),this.__getErrorMessage(e),e,this.__getValidator(e),!this.in("idle")||this.disabledSelector.matches(a),this.readonlySelector.matches(a),this.__bindField(e),this.__handleKeyDown,this.renderTemplateOrSlot(`${a}:after`))},this.__renderVisibility=()=>{var e;const{disabledSelector:i,readonlySelector:s,form:a,lang:l,ns:d}=this,n=!this.in("idle"),o=n||i.matches("visibility",!0);return t(f||(f=u` <div> ${0} <x-group frame> <foxy-i18n data-testid="visibility-label" class="${0}" lang="${0}" slot="header" key="visibility" ns="${0}"> </foxy-i18n> <x-choice data-testid="visibility" lang="${0}" ns="${0}" .items="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> <foxy-i18n slot="private-label" lang="${0}" key="visibility_private" ns="${0}"> </foxy-i18n> <foxy-i18n slot="restricted-label" lang="${0}" key="visibility_restricted" ns="${0}"> </foxy-i18n> <foxy-i18n ns="${0}" lang="${0}" slot="public-label" key="visibility_public"> </foxy-i18n> </x-choice> </x-group> ${0} </div> `),this.renderTemplateOrSlot("visibility:before"),r({"text-disabled":o}),l,d,l,$.defaultNS,$.__visibilityOptions,null!==(e=null==a?void 0:a.visibility)&&void 0!==e?e:"private",n||i.matches("visibility",!0),s.matches("visibility",!0),this.__handleChoiceChange,l,d,l,d,d,l,this.renderTemplateOrSlot("visibility:after"))},this.__renderTimestamps=()=>{const e=["date_modified","date_created"].map((e=>{var t;return{name:this.t(e),value:(null===(t=this.data)||void 0===t?void 0:t[e])?this.t("date",{value:new Date(this.data[e])}):""}}));return t(p||(p=u` <div> ${0} <x-property-table .items="${0}" data-testid="timestamps"></x-property-table> ${0} </div> `),this.renderTemplateOrSlot("timestamps:before"),e,this.renderTemplateOrSlot("timestamps:after"))},this.__renderDelete=()=>t(b||(b=u` <div> ${0} <vaadin-button class="w-full" data-testid="delete" theme="error primary" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" lang="${0}" key="delete"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("delete:before"),!this.in("idle")||this.disabledSelector.matches("delete",!0),this.__handleDeleteClick,this.ns,this.lang,this.renderTemplateOrSlot("delete:after")),this.__renderCreate=()=>{const e=this.in({idle:{template:{dirty:"valid"}}}),i=this.in({idle:{snapshot:{dirty:"valid"}}}),s=e||i;return t(v||(v=u` <div> ${0} <vaadin-button data-testid="create" class="w-full" theme="success primary" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" lang="${0}" key="create"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("create:before"),!this.in("idle")||!s||this.disabledSelector.matches("create",!0),(()=>this.submit()),this.ns,this.lang,this.renderTemplateOrSlot("create:after"))}}static get scopedElements(){return{"foxy-internal-confirm-dialog":customElements.get("foxy-internal-confirm-dialog"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"vaadin-text-field":customElements.get("vaadin-text-field"),"vaadin-text-area":customElements.get("vaadin-text-area"),"x-property-table":n,"vaadin-button":customElements.get("vaadin-button"),"x-choice":e,"x-group":d,"foxy-i18n":customElements.get("foxy-i18n"),"foxy-spinner":customElements.get("foxy-spinner")}}static get v8n(){return[({value:e})=>e&&e.length>0||"value_required",({value:e})=>e&&e.length<=1e3||"value_too_long",({name:e})=>e&&e.length>0||"name_required",({name:e})=>e&&e.length<=500||"name_too_long"]}render(){const{hiddenSelector:e,data:i,lang:s,ns:a}=this,l=this.in("busy"),d=this.in("fail");return t(y||(y=u` <foxy-internal-confirm-dialog data-testid="confirm" message="delete_prompt" confirm="delete" cancel="cancel" header="delete" theme="primary error" lang="${0}" ns="${0}" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> <div class="relative" aria-busy="${0}" aria-live="polite"> <div class="grid grid-cols-1 gap-l"> ${0} ${0} ${0} ${0} ${0} ${0} </div> <div data-testid="spinner" class="${0}"> <foxy-spinner layout="vertical" class="m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l" state="${0}" lang="${0}" ns="${0}"> </foxy-spinner> </div> </div> `),s,a,this.__handleConfirmHide,this.in("busy"),this.__maybeRenderTextField({field:"name"}),this.__maybeRenderTextField({field:"value"}),e.matches("visibility",!0)?"":this.__renderVisibility(),e.matches("timestamps",!0)||!i?"":this.__renderTimestamps(),e.matches("delete",!0)||!i?"":this.__renderDelete(),e.matches("create",!0)||i?"":this.__renderCreate(),r({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":!l&&!d}),d?"error":l?"busy":"empty",s,a)}disconnectedCallback(){var e,t,i,s;super.disconnectedCallback(),null===(t=(e=this.__bindField.cache).clear)||void 0===t||t.call(e),null===(s=(i=this.__getValidator.cache).clear)||void 0===s||s.call(i)}get __confirmDialog(){return this.renderRoot.querySelector("#confirm")}__getErrorMessage(e){const t=this.errors.find((t=>t.startsWith(e)));return t?this.t(t.replace(e,"v8n")).toString():""}__handleKeyDown(e){"Enter"===e.key&&this.submit()}__handleChoiceChange(e){this.edit({visibility:e.detail})}__handleDeleteClick(e){this.__confirmDialog.show(e.currentTarget)}__handleConfirmHide(e){e.detail.cancelled||this.delete()}}$.__visibilityOptions=["private","restricted","public"],customElements.define("foxy-attribute-form",$);export{$ as AttributeForm};
1
+ import{C as e}from"./shared-1f1734cb.js";import"./shared-bb824ab4.js";import"./shared-0ced76a0.js";import"./shared-b1fc5dc3.js";import"./shared-9221e6b2.js";import"./foxy-spinner.js";import"./foxy-i18n.js";import"./shared-46ee137f.js";import"./shared-df573cea.js";import"./shared-f0a83bd6.js";import{h as t}from"./shared-63eaded9.js";import{a as i,T as s,S as a}from"./shared-9a40309d.js";import{c as r}from"./shared-4e709717.js";import"./shared-07abcd7b.js";import"./shared-6ebe3825.js";import"./shared-ec861f31.js";import{m as l}from"./shared-1761daef.js";import{G as d}from"./shared-91e768be.js";import{P as n}from"./shared-8a7bee0d.js";import{C as o}from"./shared-593f7e2c.js";import{N as h}from"./shared-44cfc617.js";import{i as m}from"./shared-6d45a07b.js";import"./shared-ff79f3f9.js";import"./shared-87ca7818.js";import"./shared-b0f0e8b5.js";import"./shared-a46edf4b.js";import"./shared-60126eee.js";import"./shared-00563cb0.js";import"./shared-7684cb05.js";let c,f,p,b,v,y,u=e=>e;const _=i(o(s(a(h))),"attribute-form");class $ extends _{constructor(){super(...arguments),this.templates={},this.__getValidator=l((e=>()=>!this.errors.some((t=>t.startsWith(e))))),this.__bindField=l((e=>t=>{const i=t.target;this.edit({[e]:i.value})})),this.__maybeRenderTextField=({field:e})=>{var i,s;const a=e.replace(/_/,"-");return this.hiddenSelector.matches(a)?"":t(c||(c=u` <div> ${0} <vaadin-text-field class="w-full" label="${0}" value="${0}" error-message="${0}" data-testid="${0}" .checkValidity="${0}" ?disabled="${0}" ?readonly="${0}" @input="${0}" @keydown="${0}"> </vaadin-text-field> ${0} </div> `),this.renderTemplateOrSlot(`${a}:before`),this.t(e).toString(),m(null===(s=null===(i=this.form)||void 0===i?void 0:i[e])||void 0===s?void 0:s.toString()),this.__getErrorMessage(e),e,this.__getValidator(e),!this.in("idle")||this.disabledSelector.matches(a),this.readonlySelector.matches(a),this.__bindField(e),this.__handleKeyDown,this.renderTemplateOrSlot(`${a}:after`))},this.__renderVisibility=()=>{var e;const{disabledSelector:i,readonlySelector:s,form:a,lang:l,ns:d}=this,n=!this.in("idle"),o=n||i.matches("visibility",!0);return t(f||(f=u` <div> ${0} <x-group frame> <foxy-i18n data-testid="visibility-label" class="${0}" lang="${0}" slot="header" key="visibility" ns="${0}"> </foxy-i18n> <x-choice data-testid="visibility" lang="${0}" ns="${0}" .items="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> <foxy-i18n slot="private-label" lang="${0}" key="visibility_private" ns="${0}"> </foxy-i18n> <foxy-i18n slot="restricted-label" lang="${0}" key="visibility_restricted" ns="${0}"> </foxy-i18n> <foxy-i18n ns="${0}" lang="${0}" slot="public-label" key="visibility_public"> </foxy-i18n> </x-choice> </x-group> ${0} </div> `),this.renderTemplateOrSlot("visibility:before"),r({"text-disabled":o}),l,d,l,$.defaultNS,$.__visibilityOptions,null!==(e=null==a?void 0:a.visibility)&&void 0!==e?e:"private",n||i.matches("visibility",!0),s.matches("visibility",!0),this.__handleChoiceChange,l,d,l,d,d,l,this.renderTemplateOrSlot("visibility:after"))},this.__renderTimestamps=()=>{const e=["date_modified","date_created"].map((e=>{var t;return{name:this.t(e),value:(null===(t=this.data)||void 0===t?void 0:t[e])?this.t("date",{value:new Date(this.data[e])}):""}}));return t(p||(p=u` <div> ${0} <x-property-table .items="${0}" data-testid="timestamps"></x-property-table> ${0} </div> `),this.renderTemplateOrSlot("timestamps:before"),e,this.renderTemplateOrSlot("timestamps:after"))},this.__renderDelete=()=>t(b||(b=u` <div> ${0} <vaadin-button class="w-full" data-testid="delete" theme="error primary" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" lang="${0}" key="delete"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("delete:before"),!this.in("idle")||this.disabledSelector.matches("delete",!0),this.__handleDeleteClick,this.ns,this.lang,this.renderTemplateOrSlot("delete:after")),this.__renderCreate=()=>{const e=this.in({idle:{template:{dirty:"valid"}}}),i=this.in({idle:{snapshot:{dirty:"valid"}}}),s=e||i;return t(v||(v=u` <div> ${0} <vaadin-button data-testid="create" class="w-full" theme="success primary" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" lang="${0}" key="create"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("create:before"),!this.in("idle")||!s||this.disabledSelector.matches("create",!0),(()=>this.submit()),this.ns,this.lang,this.renderTemplateOrSlot("create:after"))}}static get scopedElements(){return{"foxy-internal-confirm-dialog":customElements.get("foxy-internal-confirm-dialog"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"vaadin-text-field":customElements.get("vaadin-text-field"),"vaadin-text-area":customElements.get("vaadin-text-area"),"x-property-table":n,"vaadin-button":customElements.get("vaadin-button"),"x-choice":e,"x-group":d,"foxy-i18n":customElements.get("foxy-i18n"),"foxy-spinner":customElements.get("foxy-spinner")}}static get v8n(){return[({value:e})=>e&&e.length>0||"value_required",({value:e})=>e&&e.length<=1e3||"value_too_long",({name:e})=>e&&e.length>0||"name_required",({name:e})=>e&&e.length<=500||"name_too_long"]}render(){const{hiddenSelector:e,data:i,lang:s,ns:a}=this,l=this.in("busy"),d=this.in("fail");return t(y||(y=u` <foxy-internal-confirm-dialog data-testid="confirm" message="delete_prompt" confirm="delete" cancel="cancel" header="delete" theme="primary error" lang="${0}" ns="${0}" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> <div class="relative" aria-busy="${0}" aria-live="polite"> <div class="grid grid-cols-1 gap-l"> ${0} ${0} ${0} ${0} ${0} ${0} </div> <div data-testid="spinner" class="${0}"> <foxy-spinner layout="vertical" class="m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l" state="${0}" lang="${0}" ns="${0}"> </foxy-spinner> </div> </div> `),s,a,this.__handleConfirmHide,this.in("busy"),this.__maybeRenderTextField({field:"name"}),this.__maybeRenderTextField({field:"value"}),e.matches("visibility",!0)?"":this.__renderVisibility(),e.matches("timestamps",!0)||!i?"":this.__renderTimestamps(),e.matches("delete",!0)||!i?"":this.__renderDelete(),e.matches("create",!0)||i?"":this.__renderCreate(),r({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":!l&&!d}),d?"error":l?"busy":"empty",s,a)}disconnectedCallback(){var e,t,i,s;super.disconnectedCallback(),null===(t=(e=this.__bindField.cache).clear)||void 0===t||t.call(e),null===(s=(i=this.__getValidator.cache).clear)||void 0===s||s.call(i)}get __confirmDialog(){return this.renderRoot.querySelector("#confirm")}__getErrorMessage(e){const t=this.errors.find((t=>t.startsWith(e)));return t?this.t(t.replace(e,"v8n")).toString():""}__handleKeyDown(e){"Enter"===e.key&&this.submit()}__handleChoiceChange(e){this.edit({visibility:e.detail})}__handleDeleteClick(e){this.__confirmDialog.show(e.currentTarget)}__handleConfirmHide(e){e.detail.cancelled||this.delete()}}$.__visibilityOptions=["private","restricted","public"],customElements.define("foxy-attribute-form",$);export{$ as AttributeForm};
@@ -1 +1 @@
1
- import"./shared-0ced76a0.js";import"./shared-60126eee.js";import"./shared-46ee137f.js";import{L as t,h as e}from"./shared-63eaded9.js";import{T as a,S as s,a as n}from"./shared-9a40309d.js";import{c as r}from"./shared-4e709717.js";import{p as i,W as o}from"./shared-322e60b1.js";import{s as d}from"./shared-2061be9a.js";import"./shared-9221e6b2.js";import"./foxy-spinner.js";import"./foxy-i18n.js";import"./shared-df573cea.js";import"./shared-f0a83bd6.js";import"./shared-d8ffb279.js";import"./shared-07abcd7b.js";import"./shared-b5147166.js";import"./shared-ec861f31.js";import"./shared-bb824ab4.js";import{G as l}from"./shared-91e768be.js";import{C as h}from"./shared-593f7e2c.js";import{N as c}from"./shared-44cfc617.js";import{i as m}from"./shared-6d45a07b.js";import"./shared-ff79f3f9.js";import"./shared-1761daef.js";import"./shared-87ca7818.js";import"./shared-b0f0e8b5.js";import"./shared-a46edf4b.js";import"./shared-00563cb0.js";import"./shared-7684cb05.js";let u,p,g,b,f,v=t=>t;class y extends(a(t)){constructor(){super(...arguments),this.checkAvailability=()=>!0,this.readonly=!1,this.disabled=!1,this.value="",this.start="",this.lang=""}static get properties(){return{checkAvailability:{attribute:!1},readonly:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},value:{type:String},start:{type:String},lang:{type:String}}}render(){var t,a;const s=new Date(null!==(a=null!==(t=this.__startAsDate)&&void 0!==t?t:this.__valueAsDate)&&void 0!==a?a:Date.now()),n=new Date(s),i=new Date(s),o=this.lang||navigator.language;return n.setMonth(n.getMonth()-1),i.setMonth(i.getMonth()+1),e(u||(u=v` <div class="text-m text-body font-lumo leading-m"> <div class="grid p-xs" style="grid-template:auto/max-content auto max-content"> <vaadin-button data-testid="prev" aria-label="${0}" theme="icon tertiary" class="px-xs" ?disabled="${0}" @click="${0}"> <iron-icon icon="icons:chevron-left"></iron-icon> </vaadin-button> <span data-testid="month" class="${0}"> ${0} </span> <vaadin-button data-testid="next" aria-label="${0}" theme="icon tertiary" class="px-xs" ?disabled="${0}" @click="${0}"> <iron-icon icon="icons:chevron-right"></iron-icon> </vaadin-button> </div> ${0} </div> `),n.toLocaleString(o,{year:"numeric",month:"long"}),this.disabled,this.__handlePrevButtonClick,r({"text-center self-center font-medium":!0,"text-disabled":this.disabled}),s.toLocaleDateString(o,{month:"long",year:"numeric"}),i.toLocaleString(o,{year:"numeric",month:"long"}),this.disabled,this.__handleNextButtonClick,this.__renderMonth(s.getMonth(),s.getFullYear()))}get __valueAsDate(){return i(this.value)}set __valueAsDate(t){this.value=t?d(t):""}get __startAsDate(){return i(this.start)}set __startAsDate(t){this.start=t?d(t):""}__renderMonth(t,a){var s,n,i;const o=this.lang||navigator.language,d=new Date(a,t,1,0,0,0,0),l=[];for(let t=0;t<7;++t){const a=new Date;for(;a.getDay()!==t;)a.setDate(a.getDate()+1);l.push(e(p||(p=v` <span class="${0}"> ${0} </span> `),r({"self-center text-xxs uppercase font-medium tracking-wider":!0,"text-secondary":!this.disabled,"text-disabled":this.disabled}),a.toLocaleString(o,{weekday:"short"})))}for(;d.getMonth()===t;){const r=d.getFullYear()===(null===(s=this.__valueAsDate)||void 0===s?void 0:s.getFullYear())&&d.getMonth()===(null===(n=this.__valueAsDate)||void 0===n?void 0:n.getMonth())&&d.getDate()===(null===(i=this.__valueAsDate)||void 0===i?void 0:i.getDate());l.push(e(g||(g=v` <div style="grid-column:${0}" data-testclass="day-of-month"> ${0} </div> `),d.getDay()+1,this.__renderDate(d.getDate(),t,a,r))),d.setDate(d.getDate()+1)}return e(b||(b=v` <form data-testid="grid" class="grid gap-s p-s text-center" style="grid-template:auto/repeat(7,1fr)"> ${0} </form> `),l)}__renderDate(t,a,s,n=!1){const i=this.disabled||this.readonly||!this.checkAvailability(new Date(s,a,t));return e(f||(f=v` <label class="${0}"> <input name="date" type="radio" value="${0}" class="sr-only" ?disabled="${0}" @change="${0}"> ${0} </label> `),r({"font-tnum select-none relative flex h-m items-center justify-center rounded":!0,"cursor-pointer focus-within-ring-2 focus-within-ring-primary-50":!i,"bg-contrast-5 hover-bg-contrast-10":!n&&!i,"bg-primary text-primary-contrast":n&&!i,"border border-dashed border-contrast-20 text-disabled":!n&&i,"border border-dashed border-primary text-primary":n&&i}),t,this.readonly||this.disabled||i,(()=>{this.__valueAsDate=new Date(s,a,t),this.dispatchEvent(new CustomEvent("change"))}),t)}__handlePrevButtonClick(){var t;const e=new Date(null!==(t=this.start)&&void 0!==t?t:Date.now());this.__startAsDate=new Date(e.setMonth(e.getMonth()-1))}__handleNextButtonClick(){var t;const e=new Date(null!==(t=this.start)&&void 0!==t?t:Date.now());this.__startAsDate=new Date(e.setMonth(e.getMonth()+1))}}customElements.define("foxy-internal-calendar",y);let _,x,$,D,w=t=>t;const j=s(a(h(n(c,"cancellation-form"))));class S extends j{constructor(){super(...arguments),this.templates={},this.__renderWarning=()=>{const{lang:t,ns:a}=this;return e(_||(_=w` <div> ${0} <x-warning> <foxy-i18n data-testid="warning" class="${0}" lang="${0}" key="end_subscription_explainer" ns="${0}"> </foxy-i18n> </x-warning> ${0} </div> `),this.renderTemplateOrSlot("warning:before"),r({"text-disabled":!this.in({idle:"snapshot"})}),t,a,this.renderTemplateOrSlot("warning:after"))},this.__renderEndDate=()=>{var t,a;const{constructor:s,lang:n,ns:i}=this,o=s.__tomorrow.getTime(),d=this.in({idle:"snapshot"});return e(x||(x=w` <div> ${0} <x-group frame> <foxy-i18n data-testid="end-date-label" class="${0}" slot="header" lang="${0}" key="end_date" ns="${0}"> </foxy-i18n> <foxy-internal-calendar data-testid="end-date" .checkAvailability="${0}" ?disabled="${0}" ?readonly="${0}" value="${0}" lang="${0}" @change="${0}"> </foxy-internal-calendar> </x-group> ${0} </div> `),this.renderTemplateOrSlot("end-date:before"),r({"text-disabled":!d}),n,i,(t=>t.getTime()>=o),!d||this.disabledSelector.matches("end-date",!0),!!(null===(t=this.data)||void 0===t?void 0:t.end_date)||this.readonlySelector.matches("end-date",!0),m(null!==(a=this.form.end_date)&&void 0!==a?a:void 0),n,(t=>{this.edit({end_date:t.target.value})}),this.renderTemplateOrSlot("end-date:after"))},this.__renderSubmit=()=>{const t=this.in({idle:{snapshot:{clean:"valid"}}})||this.in({idle:{snapshot:{dirty:"valid"}}});return e($||($=w` <div> ${0} <vaadin-button data-testid="submit" ?disabled="${0}" theme="primary error" class="w-full" @click="${0}"> <foxy-i18n ns="${0}" lang="${0}" key="end_subscription"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("submit:before"),!t||this.disabledSelector.matches("submit",!0),(()=>this.submit()),this.ns,this.lang,this.renderTemplateOrSlot("submit:after"))}}static get scopedElements(){return{"foxy-internal-calendar":customElements.get("foxy-internal-calendar"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"vaadin-button":customElements.get("vaadin-button"),"foxy-spinner":customElements.get("foxy-spinner"),"foxy-i18n":customElements.get("foxy-i18n"),"x-warning":o,"x-group":l}}static get v8n(){return[({end_date:t})=>!!t||"end_date_required"]}render(){var t,a;const s=this.hiddenSelector,n=this.in("busy"),i=this.in("fail");return e(D||(D=w` <div class="space-y-l font-lumo text-m text-body leading-m relative"> ${0} ${0} ${0} <div data-testid="spinner" class="${0}"> <foxy-spinner layout="vertical" class="m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l" state="${0}" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),s.matches("warning",!0)?"":this.__renderWarning(),s.matches("end-date",!0)?"":this.__renderEndDate(),s.matches("submit",!0)?"":this.__renderSubmit(),r({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":!n&&!i}),i?"error":n?"busy":"empty",this.lang,this.ns,null!==(a=null===(t=customElements.get("foxy-spinner"))||void 0===t?void 0:t.defaultNS)&&void 0!==a?a:"")}submit(){if(!this.form.end_date){const t=this.constructor;this.edit({end_date:d(t.__tomorrow)})}super.submit()}static get __tomorrow(){const t=new Date;return t.setDate(t.getDate()+1),t.setHours(0,0,0,0),t}}customElements.define("foxy-cancellation-form",S);export{S as CancellationForm};
1
+ import"./shared-0ced76a0.js";import"./shared-60126eee.js";import"./shared-46ee137f.js";import{L as t,h as e}from"./shared-63eaded9.js";import{T as a,S as s,a as n}from"./shared-9a40309d.js";import{c as r}from"./shared-4e709717.js";import{p as i,W as o}from"./shared-322e60b1.js";import{s as d}from"./shared-2061be9a.js";import"./shared-9221e6b2.js";import"./foxy-spinner.js";import"./foxy-i18n.js";import"./shared-df573cea.js";import"./shared-f0a83bd6.js";import"./shared-1f1734cb.js";import"./shared-07abcd7b.js";import"./shared-6ebe3825.js";import"./shared-ec861f31.js";import"./shared-bb824ab4.js";import{G as l}from"./shared-91e768be.js";import{C as h}from"./shared-593f7e2c.js";import{N as c}from"./shared-44cfc617.js";import{i as m}from"./shared-6d45a07b.js";import"./shared-ff79f3f9.js";import"./shared-1761daef.js";import"./shared-87ca7818.js";import"./shared-b0f0e8b5.js";import"./shared-a46edf4b.js";import"./shared-00563cb0.js";import"./shared-7684cb05.js";let u,p,g,b,f,v=t=>t;class y extends(a(t)){constructor(){super(...arguments),this.checkAvailability=()=>!0,this.readonly=!1,this.disabled=!1,this.value="",this.start="",this.lang=""}static get properties(){return{checkAvailability:{attribute:!1},readonly:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},value:{type:String},start:{type:String},lang:{type:String}}}render(){var t,a;const s=new Date(null!==(a=null!==(t=this.__startAsDate)&&void 0!==t?t:this.__valueAsDate)&&void 0!==a?a:Date.now()),n=new Date(s),i=new Date(s),o=this.lang||navigator.language;return n.setMonth(n.getMonth()-1),i.setMonth(i.getMonth()+1),e(u||(u=v` <div class="text-m text-body font-lumo leading-m"> <div class="grid p-xs" style="grid-template:auto/max-content auto max-content"> <vaadin-button data-testid="prev" aria-label="${0}" theme="icon tertiary" class="px-xs" ?disabled="${0}" @click="${0}"> <iron-icon icon="icons:chevron-left"></iron-icon> </vaadin-button> <span data-testid="month" class="${0}"> ${0} </span> <vaadin-button data-testid="next" aria-label="${0}" theme="icon tertiary" class="px-xs" ?disabled="${0}" @click="${0}"> <iron-icon icon="icons:chevron-right"></iron-icon> </vaadin-button> </div> ${0} </div> `),n.toLocaleString(o,{year:"numeric",month:"long"}),this.disabled,this.__handlePrevButtonClick,r({"text-center self-center font-medium":!0,"text-disabled":this.disabled}),s.toLocaleDateString(o,{month:"long",year:"numeric"}),i.toLocaleString(o,{year:"numeric",month:"long"}),this.disabled,this.__handleNextButtonClick,this.__renderMonth(s.getMonth(),s.getFullYear()))}get __valueAsDate(){return i(this.value)}set __valueAsDate(t){this.value=t?d(t):""}get __startAsDate(){return i(this.start)}set __startAsDate(t){this.start=t?d(t):""}__renderMonth(t,a){var s,n,i;const o=this.lang||navigator.language,d=new Date(a,t,1,0,0,0,0),l=[];for(let t=0;t<7;++t){const a=new Date;for(;a.getDay()!==t;)a.setDate(a.getDate()+1);l.push(e(p||(p=v` <span class="${0}"> ${0} </span> `),r({"self-center text-xxs uppercase font-medium tracking-wider":!0,"text-secondary":!this.disabled,"text-disabled":this.disabled}),a.toLocaleString(o,{weekday:"short"})))}for(;d.getMonth()===t;){const r=d.getFullYear()===(null===(s=this.__valueAsDate)||void 0===s?void 0:s.getFullYear())&&d.getMonth()===(null===(n=this.__valueAsDate)||void 0===n?void 0:n.getMonth())&&d.getDate()===(null===(i=this.__valueAsDate)||void 0===i?void 0:i.getDate());l.push(e(g||(g=v` <div style="grid-column:${0}" data-testclass="day-of-month"> ${0} </div> `),d.getDay()+1,this.__renderDate(d.getDate(),t,a,r))),d.setDate(d.getDate()+1)}return e(b||(b=v` <form data-testid="grid" class="grid gap-s p-s text-center" style="grid-template:auto/repeat(7,1fr)"> ${0} </form> `),l)}__renderDate(t,a,s,n=!1){const i=this.disabled||this.readonly||!this.checkAvailability(new Date(s,a,t));return e(f||(f=v` <label class="${0}"> <input name="date" type="radio" value="${0}" class="sr-only" ?disabled="${0}" @change="${0}"> ${0} </label> `),r({"font-tnum select-none relative flex h-m items-center justify-center rounded":!0,"cursor-pointer focus-within-ring-2 focus-within-ring-primary-50":!i,"bg-contrast-5 hover-bg-contrast-10":!n&&!i,"bg-primary text-primary-contrast":n&&!i,"border border-dashed border-contrast-20 text-disabled":!n&&i,"border border-dashed border-primary text-primary":n&&i}),t,this.readonly||this.disabled||i,(()=>{this.__valueAsDate=new Date(s,a,t),this.dispatchEvent(new CustomEvent("change"))}),t)}__handlePrevButtonClick(){var t;const e=new Date(null!==(t=this.start)&&void 0!==t?t:Date.now());this.__startAsDate=new Date(e.setMonth(e.getMonth()-1))}__handleNextButtonClick(){var t;const e=new Date(null!==(t=this.start)&&void 0!==t?t:Date.now());this.__startAsDate=new Date(e.setMonth(e.getMonth()+1))}}customElements.define("foxy-internal-calendar",y);let _,x,$,D,w=t=>t;const j=s(a(h(n(c,"cancellation-form"))));class S extends j{constructor(){super(...arguments),this.templates={},this.__renderWarning=()=>{const{lang:t,ns:a}=this;return e(_||(_=w` <div> ${0} <x-warning> <foxy-i18n data-testid="warning" class="${0}" lang="${0}" key="end_subscription_explainer" ns="${0}"> </foxy-i18n> </x-warning> ${0} </div> `),this.renderTemplateOrSlot("warning:before"),r({"text-disabled":!this.in({idle:"snapshot"})}),t,a,this.renderTemplateOrSlot("warning:after"))},this.__renderEndDate=()=>{var t,a;const{constructor:s,lang:n,ns:i}=this,o=s.__tomorrow.getTime(),d=this.in({idle:"snapshot"});return e(x||(x=w` <div> ${0} <x-group frame> <foxy-i18n data-testid="end-date-label" class="${0}" slot="header" lang="${0}" key="end_date" ns="${0}"> </foxy-i18n> <foxy-internal-calendar data-testid="end-date" .checkAvailability="${0}" ?disabled="${0}" ?readonly="${0}" value="${0}" lang="${0}" @change="${0}"> </foxy-internal-calendar> </x-group> ${0} </div> `),this.renderTemplateOrSlot("end-date:before"),r({"text-disabled":!d}),n,i,(t=>t.getTime()>=o),!d||this.disabledSelector.matches("end-date",!0),!!(null===(t=this.data)||void 0===t?void 0:t.end_date)||this.readonlySelector.matches("end-date",!0),m(null!==(a=this.form.end_date)&&void 0!==a?a:void 0),n,(t=>{this.edit({end_date:t.target.value})}),this.renderTemplateOrSlot("end-date:after"))},this.__renderSubmit=()=>{const t=this.in({idle:{snapshot:{clean:"valid"}}})||this.in({idle:{snapshot:{dirty:"valid"}}});return e($||($=w` <div> ${0} <vaadin-button data-testid="submit" ?disabled="${0}" theme="primary error" class="w-full" @click="${0}"> <foxy-i18n ns="${0}" lang="${0}" key="end_subscription"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("submit:before"),!t||this.disabledSelector.matches("submit",!0),(()=>this.submit()),this.ns,this.lang,this.renderTemplateOrSlot("submit:after"))}}static get scopedElements(){return{"foxy-internal-calendar":customElements.get("foxy-internal-calendar"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"vaadin-button":customElements.get("vaadin-button"),"foxy-spinner":customElements.get("foxy-spinner"),"foxy-i18n":customElements.get("foxy-i18n"),"x-warning":o,"x-group":l}}static get v8n(){return[({end_date:t})=>!!t||"end_date_required"]}render(){var t,a;const s=this.hiddenSelector,n=this.in("busy"),i=this.in("fail");return e(D||(D=w` <div class="space-y-l font-lumo text-m text-body leading-m relative"> ${0} ${0} ${0} <div data-testid="spinner" class="${0}"> <foxy-spinner layout="vertical" class="m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l" state="${0}" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),s.matches("warning",!0)?"":this.__renderWarning(),s.matches("end-date",!0)?"":this.__renderEndDate(),s.matches("submit",!0)?"":this.__renderSubmit(),r({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":!n&&!i}),i?"error":n?"busy":"empty",this.lang,this.ns,null!==(a=null===(t=customElements.get("foxy-spinner"))||void 0===t?void 0:t.defaultNS)&&void 0!==a?a:"")}submit(){if(!this.form.end_date){const t=this.constructor;this.edit({end_date:d(t.__tomorrow)})}super.submit()}static get __tomorrow(){const t=new Date;return t.setDate(t.getDate()+1),t.setHours(0,0,0,0),t}}customElements.define("foxy-cancellation-form",S);export{S as CancellationForm};
@@ -1 +1 @@
1
- import"./shared-bb824ab4.js";import"./shared-16f72e27.js";import"./shared-0ced76a0.js";import"./shared-e5cbf291.js";import"./shared-9221e6b2.js";import"./foxy-spinner.js";import"./foxy-i18n.js";import{h as e}from"./shared-63eaded9.js";import{C as t}from"./shared-593f7e2c.js";import{N as i}from"./shared-44cfc617.js";import"./shared-46ee137f.js";import"./shared-df573cea.js";import"./shared-f0a83bd6.js";import{a as s,T as r,S as a}from"./shared-9a40309d.js";import{c as d}from"./shared-4e709717.js";import"./shared-d8ffb279.js";import"./shared-07abcd7b.js";import"./shared-b5147166.js";import"./shared-ec861f31.js";import{m as n}from"./shared-1761daef.js";import{P as l}from"./shared-8a7bee0d.js";import{i as o}from"./shared-6d45a07b.js";import"./shared-ff79f3f9.js";import"./shared-60126eee.js";import"./shared-00563cb0.js";import"./shared-7684cb05.js";import"./shared-a46edf4b.js";import"./shared-87ca7818.js";import"./shared-b0f0e8b5.js";let h,m,c,f,p,b,_=e=>e;const u=s(t(r(a(i))),"custom-field-form");class v extends u{constructor(){super(...arguments),this.templates={},this.__getValidator=n((e=>()=>!this.errors.some((t=>t.startsWith(e))))),this.__bindField=n((e=>t=>{const i=t.target;this.edit({[e]:i.value})})),this.__maybeRenderTextField=({field:t})=>{var i,s;const r=t.replace(/_/,"-");return this.hiddenSelector.matches(r)?"":e(h||(h=_` <div> ${0} <vaadin-text-field class="w-full" label="${0}" value="${0}" error-message="${0}" data-testid="${0}" .checkValidity="${0}" ?disabled="${0}" ?readonly="${0}" @input="${0}" @keydown="${0}"> </vaadin-text-field> ${0} </div> `),this.renderTemplateOrSlot(`${r}:before`),this.t(t).toString(),o(null===(s=null===(i=this.form)||void 0===i?void 0:i[t])||void 0===s?void 0:s.toString()),this.__getErrorMessage(t),t,this.__getValidator(t),!this.in("idle")||this.disabledSelector.matches(r),this.readonlySelector.matches(r),this.__bindField(t),this.__handleKeyDown,this.renderTemplateOrSlot(`${r}:after`))},this.__renderVisibility=()=>{const{disabledSelector:t,form:i,lang:s,ns:r}=this,a=!this.in("idle")||t.matches("visibility",!0);return e(m||(m=_` <div data-testid="visibility"> ${0} <vaadin-checkbox ?disabled="${0}" ?checked="${0}" @change="${0}"> <foxy-i18n lang="${0}" key="show_on_receipt" ns="${0}"></foxy-i18n> </vaadin-checkbox> ${0} </div> `),this.renderTemplateOrSlot("visibility:before"),a,!i.is_hidden,(e=>{const t=e.currentTarget;this.edit({is_hidden:!t.checked})}),s,r,this.renderTemplateOrSlot("visibility:after"))},this.__renderTimestamps=()=>{const t=["date_modified","date_created"].map((e=>{var t;return{name:this.t(e),value:(null===(t=this.data)||void 0===t?void 0:t[e])?this.t("date",{value:new Date(this.data[e])}):""}}));return e(c||(c=_` <div> ${0} <x-property-table .items="${0}" data-testid="timestamps"></x-property-table> ${0} </div> `),this.renderTemplateOrSlot("timestamps:before"),t,this.renderTemplateOrSlot("timestamps:after"))},this.__renderDelete=()=>e(f||(f=_` <div> ${0} <vaadin-button class="w-full" data-testid="delete" theme="error primary" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" lang="${0}" key="delete"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("delete:before"),!this.in("idle")||this.disabledSelector.matches("delete",!0),this.__handleDeleteClick,this.ns,this.lang,this.renderTemplateOrSlot("delete:after")),this.__renderCreate=()=>{const t=this.in({idle:{template:{dirty:"valid"}}}),i=this.in({idle:{snapshot:{dirty:"valid"}}}),s=t||i;return e(p||(p=_` <div> ${0} <vaadin-button data-testid="create" class="w-full" theme="success primary" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" lang="${0}" key="create"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("create:before"),!this.in("idle")||!s||this.disabledSelector.matches("create",!0),(()=>this.submit()),this.ns,this.lang,this.renderTemplateOrSlot("create:after"))}}static get scopedElements(){return{"foxy-internal-confirm-dialog":customElements.get("foxy-internal-confirm-dialog"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"vaadin-text-field":customElements.get("vaadin-text-field"),"vaadin-checkbox":customElements.get("vaadin-checkbox"),"x-property-table":l,"vaadin-button":customElements.get("vaadin-button"),"foxy-i18n":customElements.get("foxy-i18n"),"foxy-spinner":customElements.get("foxy-spinner")}}static get v8n(){return[({value:e})=>e&&e.length>0||"value_required",({value:e})=>e&&e.length<=1e3||"value_too_long",({name:e})=>e&&e.length>0||"name_required",({name:e})=>e&&e.length<=500||"name_too_long"]}render(){const{hiddenSelector:t,data:i,lang:s,ns:r}=this,a=this.in("busy"),n=this.in("fail");return e(b||(b=_` <foxy-internal-confirm-dialog data-testid="confirm" message="delete_prompt" confirm="delete" cancel="cancel" header="delete" theme="primary error" lang="${0}" ns="${0}" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> <div class="relative" aria-busy="${0}" aria-live="polite"> <div class="grid grid-cols-1 gap-l"> ${0} ${0} ${0} ${0} ${0} ${0} </div> <div data-testid="spinner" class="${0}"> <foxy-spinner layout="vertical" class="m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l" state="${0}" lang="${0}" ns="${0}"> </foxy-spinner> </div> </div> `),s,r,this.__handleConfirmHide,this.in("busy"),this.__maybeRenderTextField({field:"name"}),this.__maybeRenderTextField({field:"value"}),t.matches("visibility",!0)?"":this.__renderVisibility(),t.matches("timestamps",!0)||!i?"":this.__renderTimestamps(),t.matches("delete",!0)||!i?"":this.__renderDelete(),t.matches("create",!0)||i?"":this.__renderCreate(),d({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":!a&&!n}),n?"error":a?"busy":"empty",s,r)}disconnectedCallback(){var e,t,i,s;super.disconnectedCallback(),null===(t=(e=this.__bindField.cache).clear)||void 0===t||t.call(e),null===(s=(i=this.__getValidator.cache).clear)||void 0===s||s.call(i)}get __confirmDialog(){return this.renderRoot.querySelector("#confirm")}__getErrorMessage(e){const t=this.errors.find((t=>t.startsWith(e)));return t?this.t(t.replace(e,"v8n")).toString():""}__handleKeyDown(e){"Enter"===e.key&&this.submit()}__handleDeleteClick(e){this.__confirmDialog.show(e.currentTarget)}__handleConfirmHide(e){e.detail.cancelled||this.delete()}}customElements.define("foxy-custom-field-form",v);export{v as CustomFieldForm};
1
+ import"./shared-bb824ab4.js";import"./shared-16f72e27.js";import"./shared-0ced76a0.js";import"./shared-b1fc5dc3.js";import"./shared-9221e6b2.js";import"./foxy-spinner.js";import"./foxy-i18n.js";import{h as e}from"./shared-63eaded9.js";import{C as t}from"./shared-593f7e2c.js";import{N as i}from"./shared-44cfc617.js";import"./shared-46ee137f.js";import"./shared-df573cea.js";import"./shared-f0a83bd6.js";import{a as s,T as r,S as a}from"./shared-9a40309d.js";import{c as d}from"./shared-4e709717.js";import"./shared-1f1734cb.js";import"./shared-07abcd7b.js";import"./shared-6ebe3825.js";import"./shared-ec861f31.js";import{m as n}from"./shared-1761daef.js";import{P as l}from"./shared-8a7bee0d.js";import{i as o}from"./shared-6d45a07b.js";import"./shared-ff79f3f9.js";import"./shared-60126eee.js";import"./shared-00563cb0.js";import"./shared-7684cb05.js";import"./shared-a46edf4b.js";import"./shared-87ca7818.js";import"./shared-b0f0e8b5.js";let h,m,c,f,p,b,_=e=>e;const u=s(t(r(a(i))),"custom-field-form");class v extends u{constructor(){super(...arguments),this.templates={},this.__getValidator=n((e=>()=>!this.errors.some((t=>t.startsWith(e))))),this.__bindField=n((e=>t=>{const i=t.target;this.edit({[e]:i.value})})),this.__maybeRenderTextField=({field:t})=>{var i,s;const r=t.replace(/_/,"-");return this.hiddenSelector.matches(r)?"":e(h||(h=_` <div> ${0} <vaadin-text-field class="w-full" label="${0}" value="${0}" error-message="${0}" data-testid="${0}" .checkValidity="${0}" ?disabled="${0}" ?readonly="${0}" @input="${0}" @keydown="${0}"> </vaadin-text-field> ${0} </div> `),this.renderTemplateOrSlot(`${r}:before`),this.t(t).toString(),o(null===(s=null===(i=this.form)||void 0===i?void 0:i[t])||void 0===s?void 0:s.toString()),this.__getErrorMessage(t),t,this.__getValidator(t),!this.in("idle")||this.disabledSelector.matches(r),this.readonlySelector.matches(r),this.__bindField(t),this.__handleKeyDown,this.renderTemplateOrSlot(`${r}:after`))},this.__renderVisibility=()=>{const{disabledSelector:t,form:i,lang:s,ns:r}=this,a=!this.in("idle")||t.matches("visibility",!0);return e(m||(m=_` <div data-testid="visibility"> ${0} <vaadin-checkbox ?disabled="${0}" ?checked="${0}" @change="${0}"> <foxy-i18n lang="${0}" key="show_on_receipt" ns="${0}"></foxy-i18n> </vaadin-checkbox> ${0} </div> `),this.renderTemplateOrSlot("visibility:before"),a,!i.is_hidden,(e=>{const t=e.currentTarget;this.edit({is_hidden:!t.checked})}),s,r,this.renderTemplateOrSlot("visibility:after"))},this.__renderTimestamps=()=>{const t=["date_modified","date_created"].map((e=>{var t;return{name:this.t(e),value:(null===(t=this.data)||void 0===t?void 0:t[e])?this.t("date",{value:new Date(this.data[e])}):""}}));return e(c||(c=_` <div> ${0} <x-property-table .items="${0}" data-testid="timestamps"></x-property-table> ${0} </div> `),this.renderTemplateOrSlot("timestamps:before"),t,this.renderTemplateOrSlot("timestamps:after"))},this.__renderDelete=()=>e(f||(f=_` <div> ${0} <vaadin-button class="w-full" data-testid="delete" theme="error primary" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" lang="${0}" key="delete"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("delete:before"),!this.in("idle")||this.disabledSelector.matches("delete",!0),this.__handleDeleteClick,this.ns,this.lang,this.renderTemplateOrSlot("delete:after")),this.__renderCreate=()=>{const t=this.in({idle:{template:{dirty:"valid"}}}),i=this.in({idle:{snapshot:{dirty:"valid"}}}),s=t||i;return e(p||(p=_` <div> ${0} <vaadin-button data-testid="create" class="w-full" theme="success primary" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" lang="${0}" key="create"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("create:before"),!this.in("idle")||!s||this.disabledSelector.matches("create",!0),(()=>this.submit()),this.ns,this.lang,this.renderTemplateOrSlot("create:after"))}}static get scopedElements(){return{"foxy-internal-confirm-dialog":customElements.get("foxy-internal-confirm-dialog"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"vaadin-text-field":customElements.get("vaadin-text-field"),"vaadin-checkbox":customElements.get("vaadin-checkbox"),"x-property-table":l,"vaadin-button":customElements.get("vaadin-button"),"foxy-i18n":customElements.get("foxy-i18n"),"foxy-spinner":customElements.get("foxy-spinner")}}static get v8n(){return[({value:e})=>e&&e.length>0||"value_required",({value:e})=>e&&e.length<=1e3||"value_too_long",({name:e})=>e&&e.length>0||"name_required",({name:e})=>e&&e.length<=500||"name_too_long"]}render(){const{hiddenSelector:t,data:i,lang:s,ns:r}=this,a=this.in("busy"),n=this.in("fail");return e(b||(b=_` <foxy-internal-confirm-dialog data-testid="confirm" message="delete_prompt" confirm="delete" cancel="cancel" header="delete" theme="primary error" lang="${0}" ns="${0}" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> <div class="relative" aria-busy="${0}" aria-live="polite"> <div class="grid grid-cols-1 gap-l"> ${0} ${0} ${0} ${0} ${0} ${0} </div> <div data-testid="spinner" class="${0}"> <foxy-spinner layout="vertical" class="m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l" state="${0}" lang="${0}" ns="${0}"> </foxy-spinner> </div> </div> `),s,r,this.__handleConfirmHide,this.in("busy"),this.__maybeRenderTextField({field:"name"}),this.__maybeRenderTextField({field:"value"}),t.matches("visibility",!0)?"":this.__renderVisibility(),t.matches("timestamps",!0)||!i?"":this.__renderTimestamps(),t.matches("delete",!0)||!i?"":this.__renderDelete(),t.matches("create",!0)||i?"":this.__renderCreate(),d({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":!a&&!n}),n?"error":a?"busy":"empty",s,r)}disconnectedCallback(){var e,t,i,s;super.disconnectedCallback(),null===(t=(e=this.__bindField.cache).clear)||void 0===t||t.call(e),null===(s=(i=this.__getValidator.cache).clear)||void 0===s||s.call(i)}get __confirmDialog(){return this.renderRoot.querySelector("#confirm")}__getErrorMessage(e){const t=this.errors.find((t=>t.startsWith(e)));return t?this.t(t.replace(e,"v8n")).toString():""}__handleKeyDown(e){"Enter"===e.key&&this.submit()}__handleDeleteClick(e){this.__confirmDialog.show(e.currentTarget)}__handleConfirmHide(e){e.detail.cancelled||this.delete()}}customElements.define("foxy-custom-field-form",v);export{v as CustomFieldForm};
@@ -1 +1 @@
1
- import"./shared-bb824ab4.js";import"./shared-0ced76a0.js";import"./shared-e5cbf291.js";import"./shared-9221e6b2.js";import"./foxy-spinner.js";import"./foxy-i18n.js";import{h as e}from"./shared-63eaded9.js";import{C as t}from"./shared-593f7e2c.js";import"./foxy-nucleon-element.js";import"./shared-46ee137f.js";import"./shared-df573cea.js";import"./shared-f0a83bd6.js";import{R as i,T as s,S as a,a as r}from"./shared-9a40309d.js";import{c as d}from"./shared-4e709717.js";import"./shared-d8ffb279.js";import"./shared-07abcd7b.js";import"./shared-b5147166.js";import"./shared-ec861f31.js";import{m as o}from"./shared-1761daef.js";import{P as n}from"./shared-8a7bee0d.js";import{i as l}from"./shared-6d45a07b.js";import{v as m}from"./shared-b738ee96.js";import{N as h}from"./shared-44cfc617.js";import"./shared-ff79f3f9.js";import"./shared-60126eee.js";import"./shared-87ca7818.js";import"./shared-b0f0e8b5.js";import"./shared-a46edf4b.js";import"./shared-00563cb0.js";import"./shared-7684cb05.js";let c,f,p,u,b=e=>e;const v=i(t(s(a(r(h,"customer-form")))));class _ extends v{constructor(){super(...arguments),this.templates={},this.__getValidator=o((e=>()=>!this.errors.some((t=>t.startsWith(e))))),this.__maybeRenderTextField=({field:t})=>{var i,s;const a=t.replace(/_/,"-"),r=this.errors.find((e=>e.startsWith(t)));return this.hiddenSelector.matches(a,!0)?"":e(c||(c=b` <div> ${0} <vaadin-text-field class="w-full" label="${0}" value="${0}" error-message="${0}" data-testid="${0}" .checkValidity="${0}" ?disabled="${0}" ?readonly="${0}" @input="${0}" @keydown="${0}"> </vaadin-text-field> ${0} </div> `),this.renderTemplateOrSlot(`${a}:before`),this.t(t).toString(),l(null===(s=null===(i=this.form)||void 0===i?void 0:i[t])||void 0===s?void 0:s.toString()),r?this.t(r.replace(t,"v8n")).toString():"",a,this.__getValidator(t),!this.in("idle")||this.disabledSelector.matches(a,!0),this.readonlySelector.matches(a,!0),(e=>this.edit({[t]:e.target.value})),(e=>"Enter"===e.key&&this.submit()),this.renderTemplateOrSlot(`${a}:after`))},this.__renderTimestamps=()=>e(f||(f=b` <div> ${0} <x-property-table data-testid="timestamps" .items="${0}"> </x-property-table> ${0} </div> `),this.renderTemplateOrSlot("timestamps:before"),["date_modified","date_created"].map((e=>{var t;return{name:this.t(e),value:(null===(t=this.data)||void 0===t?void 0:t[e])?this.t("date",{value:new Date(this.data[e])}):""}})),this.renderTemplateOrSlot("timestamps:after")),this.__renderAction=t=>{const{disabledSelector:i,href:s,lang:a,ns:r}=this,d=this.in({idle:{template:{dirty:"valid"}}}),o=this.in({idle:{snapshot:{dirty:"valid"}}}),n=!this.in("idle")||i.matches(t,!0),l=d||o;return e(p||(p=b` <div> ${0} <vaadin-button class="w-full" theme="${0}" data-testid="${0}" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" key="${0}" lang="${0}"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot(`${t}:before`),this.in("idle")?"primary "+(s?"error":"success"):"",t,this.in({idle:"template"})&&!l||n,(e=>{if("delete"===t){this.renderRoot.querySelector("#confirm").show(e.currentTarget)}else this.submit()}),r,t,a,this.renderTemplateOrSlot(`${t}:after`))}}static get scopedElements(){return{"foxy-internal-confirm-dialog":customElements.get("foxy-internal-confirm-dialog"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"vaadin-text-field":customElements.get("vaadin-text-field"),"x-property-table":n,"vaadin-button":customElements.get("vaadin-button"),"foxy-spinner":customElements.get("foxy-spinner"),"foxy-i18n":customElements.get("foxy-i18n")}}static get v8n(){return[({first_name:e})=>!e||e.length<=50||"first_name_too_long",({last_name:e})=>!e||e.length<=50||"last_name_too_long",({tax_id:e})=>!e||e.length<=50||"tax_id_too_long",({email:e})=>e&&e.length>0||"email_required",({email:e})=>e&&e.length<=100||"email_too_long",({email:e})=>e&&m(e)||"email_invalid_email"]}render(){var t,i;const{hiddenSelector:s,href:a,lang:r,ns:o}=this,n=a?"delete":"create",l=this.in("busy"),m=this.in("fail");return e(u||(u=b` <foxy-internal-confirm-dialog message="delete_prompt" confirm="delete" cancel="cancel" header="delete" theme="primary error" lang="${0}" ns="${0}" id="confirm" data-testid="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> <div data-testid="wrapper" aria-busy="${0}" aria-live="polite" class="space-y-l relative"> <div class="grid grid-cols-1 sm-grid-cols-2 gap-m"> ${0} ${0} ${0} ${0} </div> ${0} ${0} <div data-testid="spinner" class="${0}"> <foxy-spinner layout="vertical" class="m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l" state="${0}" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),r,o,(e=>{e.detail.cancelled||this.delete()}),l,this.__maybeRenderTextField({field:"first_name"}),this.__maybeRenderTextField({field:"last_name"}),this.__maybeRenderTextField({field:"email"}),this.__maybeRenderTextField({field:"tax_id"}),s.matches("timestamps",!0)||!a?"":this.__renderTimestamps(),s.matches(n)?"":this.__renderAction(n),d({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":!l&&!m}),m?"error":l?"busy":"empty",r,o,null!==(i=null===(t=customElements.get("foxy-spinner"))||void 0===t?void 0:t.defaultNS)&&void 0!==i?i:"")}disconnectedCallback(){var e,t;super.disconnectedCallback(),null===(t=(e=this.__getValidator.cache).clear)||void 0===t||t.call(e)}}customElements.define("foxy-customer-form",_);export{_ as CustomerForm};
1
+ import"./shared-bb824ab4.js";import"./shared-0ced76a0.js";import"./shared-b1fc5dc3.js";import"./shared-9221e6b2.js";import"./foxy-spinner.js";import"./foxy-i18n.js";import{h as e}from"./shared-63eaded9.js";import{C as t}from"./shared-593f7e2c.js";import"./foxy-nucleon-element.js";import"./shared-46ee137f.js";import"./shared-df573cea.js";import"./shared-f0a83bd6.js";import{R as i,T as s,S as a,a as r}from"./shared-9a40309d.js";import{c as d}from"./shared-4e709717.js";import"./shared-1f1734cb.js";import"./shared-07abcd7b.js";import"./shared-6ebe3825.js";import"./shared-ec861f31.js";import{m as o}from"./shared-1761daef.js";import{P as n}from"./shared-8a7bee0d.js";import{i as l}from"./shared-6d45a07b.js";import{v as m}from"./shared-b738ee96.js";import{N as h}from"./shared-44cfc617.js";import"./shared-ff79f3f9.js";import"./shared-60126eee.js";import"./shared-87ca7818.js";import"./shared-b0f0e8b5.js";import"./shared-a46edf4b.js";import"./shared-00563cb0.js";import"./shared-7684cb05.js";let c,f,p,u,b=e=>e;const v=i(t(s(a(r(h,"customer-form")))));class _ extends v{constructor(){super(...arguments),this.templates={},this.__getValidator=o((e=>()=>!this.errors.some((t=>t.startsWith(e))))),this.__maybeRenderTextField=({field:t})=>{var i,s;const a=t.replace(/_/,"-"),r=this.errors.find((e=>e.startsWith(t)));return this.hiddenSelector.matches(a,!0)?"":e(c||(c=b` <div> ${0} <vaadin-text-field class="w-full" label="${0}" value="${0}" error-message="${0}" data-testid="${0}" .checkValidity="${0}" ?disabled="${0}" ?readonly="${0}" @input="${0}" @keydown="${0}"> </vaadin-text-field> ${0} </div> `),this.renderTemplateOrSlot(`${a}:before`),this.t(t).toString(),l(null===(s=null===(i=this.form)||void 0===i?void 0:i[t])||void 0===s?void 0:s.toString()),r?this.t(r.replace(t,"v8n")).toString():"",a,this.__getValidator(t),!this.in("idle")||this.disabledSelector.matches(a,!0),this.readonlySelector.matches(a,!0),(e=>this.edit({[t]:e.target.value})),(e=>"Enter"===e.key&&this.submit()),this.renderTemplateOrSlot(`${a}:after`))},this.__renderTimestamps=()=>e(f||(f=b` <div> ${0} <x-property-table data-testid="timestamps" .items="${0}"> </x-property-table> ${0} </div> `),this.renderTemplateOrSlot("timestamps:before"),["date_modified","date_created"].map((e=>{var t;return{name:this.t(e),value:(null===(t=this.data)||void 0===t?void 0:t[e])?this.t("date",{value:new Date(this.data[e])}):""}})),this.renderTemplateOrSlot("timestamps:after")),this.__renderAction=t=>{const{disabledSelector:i,href:s,lang:a,ns:r}=this,d=this.in({idle:{template:{dirty:"valid"}}}),o=this.in({idle:{snapshot:{dirty:"valid"}}}),n=!this.in("idle")||i.matches(t,!0),l=d||o;return e(p||(p=b` <div> ${0} <vaadin-button class="w-full" theme="${0}" data-testid="${0}" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" key="${0}" lang="${0}"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot(`${t}:before`),this.in("idle")?"primary "+(s?"error":"success"):"",t,this.in({idle:"template"})&&!l||n,(e=>{if("delete"===t){this.renderRoot.querySelector("#confirm").show(e.currentTarget)}else this.submit()}),r,t,a,this.renderTemplateOrSlot(`${t}:after`))}}static get scopedElements(){return{"foxy-internal-confirm-dialog":customElements.get("foxy-internal-confirm-dialog"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"vaadin-text-field":customElements.get("vaadin-text-field"),"x-property-table":n,"vaadin-button":customElements.get("vaadin-button"),"foxy-spinner":customElements.get("foxy-spinner"),"foxy-i18n":customElements.get("foxy-i18n")}}static get v8n(){return[({first_name:e})=>!e||e.length<=50||"first_name_too_long",({last_name:e})=>!e||e.length<=50||"last_name_too_long",({tax_id:e})=>!e||e.length<=50||"tax_id_too_long",({email:e})=>e&&e.length>0||"email_required",({email:e})=>e&&e.length<=100||"email_too_long",({email:e})=>e&&m(e)||"email_invalid_email"]}render(){var t,i;const{hiddenSelector:s,href:a,lang:r,ns:o}=this,n=a?"delete":"create",l=this.in("busy"),m=this.in("fail");return e(u||(u=b` <foxy-internal-confirm-dialog message="delete_prompt" confirm="delete" cancel="cancel" header="delete" theme="primary error" lang="${0}" ns="${0}" id="confirm" data-testid="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> <div data-testid="wrapper" aria-busy="${0}" aria-live="polite" class="space-y-l relative"> <div class="grid grid-cols-1 sm-grid-cols-2 gap-m"> ${0} ${0} ${0} ${0} </div> ${0} ${0} <div data-testid="spinner" class="${0}"> <foxy-spinner layout="vertical" class="m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l" state="${0}" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),r,o,(e=>{e.detail.cancelled||this.delete()}),l,this.__maybeRenderTextField({field:"first_name"}),this.__maybeRenderTextField({field:"last_name"}),this.__maybeRenderTextField({field:"email"}),this.__maybeRenderTextField({field:"tax_id"}),s.matches("timestamps",!0)||!a?"":this.__renderTimestamps(),s.matches(n)?"":this.__renderAction(n),d({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":!l&&!m}),m?"error":l?"busy":"empty",r,o,null!==(i=null===(t=customElements.get("foxy-spinner"))||void 0===t?void 0:t.defaultNS)&&void 0!==i?i:"")}disconnectedCallback(){var e,t;super.disconnectedCallback(),null===(t=(e=this.__getValidator.cache).clear)||void 0===t||t.call(e)}}customElements.define("foxy-customer-form",_);export{_ as CustomerForm};
@@ -1,4 +1,4 @@
1
- import{e,r as t,S as s,n as i,L as a,_ as n,h as r,j as o}from"./shared-63eaded9.js";import{F as l,D as d,t as h,f as u,a as c}from"./shared-46ee137f.js";import{B as p}from"./shared-0ced76a0.js";import{E as _,F as m}from"./shared-5c8b531d.js";import{E as g,T as v,D as f,C as y}from"./shared-df573cea.js";import"./shared-f0a83bd6.js";import{t as b,b as x,c as w,d as $}from"./shared-9a40309d.js";import{I as k,D,a as S,C,b as E}from"./shared-d8ffb279.js";import"./shared-07abcd7b.js";import{a as I,I as A,D as M,S as T,M as j,W as O,c as V,t as F}from"./shared-b5147166.js";import{O as R,a as P,b as N,c as B,I as q}from"./shared-ec861f31.js";import{T as z}from"./shared-bb824ab4.js";import"./foxy-i18n.js";import{c as Y}from"./shared-4e709717.js";import{h as L,P as W,G as H,a as U,t as X,c as K,y as Q}from"./shared-ff79f3f9.js";import"./shared-60126eee.js";import{P as G}from"./shared-94b0ae99.js";import{a8 as J,a9 as Z,aa as ee,ab as te,ac as se,ad as ie,ae,af as ne,ag as re,ah as oe,ai as le,aj as de,ak as he,al as ue,am as ce,an as pe,ao as _e,ap as me,aq as ge,ar as ve,as as fe,at as ye,au as be}from"./shared-1761daef.js";import{G as xe}from"./shared-91e768be.js";import{p as we}from"./shared-87ca7818.js";import{j as $e}from"./shared-59e44f29.js";import{p as ke,W as De}from"./shared-322e60b1.js";import{i as Se}from"./shared-a46edf4b.js";import"./shared-b0f0e8b5.js";import"./shared-00563cb0.js";import"./shared-593f7e2c.js";import"./shared-6d45a07b.js";function Ce(e){return e?Infinity===(e=b(e))||-Infinity===e?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function Ee(e){return e}var Ie=Object.create,Ae=function(){function t(){}return function(s){if(!e(s))return{};if(Ie)return Ie(s);t.prototype=s;var i=new t;return t.prototype=void 0,i}}();var Me=function(){try{var e=J(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();function Te(e,t,s){"__proto__"==t&&Me?Me(e,t,{configurable:!0,enumerable:!0,value:s,writable:!0}):e[t]=s}var je=Object.prototype.hasOwnProperty;function Oe(e,t,s){var i=e[t];je.call(e,t)&&Z(i,s)&&(void 0!==s||t in e)||Te(e,t,s)}function Ve(e,t,s,i){var a=!s;s||(s={});for(var n=-1,r=t.length;++n<r;){var o=t[n],l=i?i(s[o],e[o],o,s,e):void 0;void 0===l&&(l=e[o]),a?Te(s,o,l):Oe(s,o,l)}return s}var Fe=Object.prototype.hasOwnProperty;function Re(t){if(!e(t))return function(e){var t=[];if(null!=e)for(var s in Object(e))t.push(s);return t}(t);var s=se(t),i=[];for(var a in t)("constructor"!=a||!s&&Fe.call(t,a))&&i.push(a);return i}function Pe(e){return ee(e)?ie(e,!0):Re(e)}var Ne=ae(Object.getPrototypeOf,Object);var Be="object"==typeof exports&&exports&&!exports.nodeType&&exports,qe=Be&&"object"==typeof module&&module&&!module.nodeType&&module,ze=qe&&qe.exports===Be?t.Buffer:void 0,Ye=ze?ze.allocUnsafe:void 0;var Le=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)le(t,re(e)),e=Ne(e);return t}:oe;function We(e){return de(e,Pe,Le)}var He=Object.prototype.hasOwnProperty;function Ue(e){var t=new e.constructor(e.byteLength);return new he(t).set(new he(e)),t}var Xe=/\w*$/;var Ke=s?s.prototype:void 0,Qe=Ke?Ke.valueOf:void 0;function Ge(e,t,s){var i,a,n,r=e.constructor;switch(t){case"[object ArrayBuffer]":return Ue(e);case"[object Boolean]":case"[object Date]":return new r(+e);case"[object DataView]":return function(e,t){var s=t?Ue(e.buffer):e.buffer;return new e.constructor(s,e.byteOffset,e.byteLength)}(e,s);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return function(e,t){var s=t?Ue(e.buffer):e.buffer;return new e.constructor(s,e.byteOffset,e.length)}(e,s);case"[object Map]":case"[object Set]":return new r;case"[object Number]":case"[object String]":return new r(e);case"[object RegExp]":return(n=new(a=e).constructor(a.source,Xe.exec(a))).lastIndex=a.lastIndex,n;case"[object Symbol]":return i=e,Qe?Object(Qe.call(i)):{}}}var Je=ce&&ce.isMap,Ze=Je?pe(Je):function(e){return i(e)&&"[object Map]"==ue(e)};var et=ce&&ce.isSet,tt=et?pe(et):function(e){return i(e)&&"[object Set]"==ue(e)},st={};function it(t,s,i,a,n,r){var o,l=1&s,d=2&s,h=4&s;if(i&&(o=n?i(t,a,n,r):i(t)),void 0!==o)return o;if(!e(t))return t;var u=_e(t);if(u){if(o=function(e){var t=e.length,s=new e.constructor(t);return t&&"string"==typeof e[0]&&He.call(e,"index")&&(s.index=e.index,s.input=e.input),s}(t),!l)return function(e,t){var s=-1,i=e.length;for(t||(t=Array(i));++s<i;)t[s]=e[s];return t}(t,o)}else{var c=ue(t),p="[object Function]"==c||"[object GeneratorFunction]"==c;if(me(t))return function(e,t){if(t)return e.slice();var s=e.length,i=Ye?Ye(s):new e.constructor(s);return e.copy(i),i}(t,l);if("[object Object]"==c||"[object Arguments]"==c||p&&!n){if(o=d||p?{}:function(e){return"function"!=typeof e.constructor||se(e)?{}:Ae(Ne(e))}(t),!l)return d?function(e,t){return Ve(e,Le(e),t)}(t,function(e,t){return e&&Ve(t,Pe(t),e)}(o,t)):function(e,t){return Ve(e,re(e),t)}(t,function(e,t){return e&&Ve(t,ne(t),e)}(o,t))}else{if(!st[c])return n?t:{};o=Ge(t,c,l)}}r||(r=new ge);var _=r.get(t);if(_)return _;r.set(t,o),tt(t)?t.forEach((function(e){o.add(it(e,s,i,e,t,r))})):Ze(t)&&t.forEach((function(e,a){o.set(a,it(e,s,i,a,t,r))}));var m=u?void 0:(h?d?We:ve:d?Pe:ne)(t);return function(e,t){for(var s=-1,i=null==e?0:e.length;++s<i&&!1!==t(e[s],s,e););}(m||t,(function(e,a){m&&(e=t[a=e]),Oe(o,a,it(e,s,i,a,t,r))})),o}st["[object Arguments]"]=st["[object Array]"]=st["[object ArrayBuffer]"]=st["[object DataView]"]=st["[object Boolean]"]=st["[object Date]"]=st["[object Float32Array]"]=st["[object Float64Array]"]=st["[object Int8Array]"]=st["[object Int16Array]"]=st["[object Int32Array]"]=st["[object Map]"]=st["[object Number]"]=st["[object Object]"]=st["[object RegExp]"]=st["[object Set]"]=st["[object String]"]=st["[object Symbol]"]=st["[object Uint8Array]"]=st["[object Uint8ClampedArray]"]=st["[object Uint16Array]"]=st["[object Uint32Array]"]=!0,st["[object Error]"]=st["[object Function]"]=st["[object WeakMap]"]=!1;var at=Math.floor,nt=Math.random;var rt=parseFloat,ot=Math.min,lt=Math.random;function dt(t,s,i){if(i&&"boolean"!=typeof i&&function(t,s,i){if(!e(i))return!1;var a=typeof s;return!!("number"==a?ee(i)&&te(s,i.length):"string"==a&&s in i)&&Z(i[s],t)}(t,s,i)&&(s=i=void 0),void 0===i&&("boolean"==typeof s?(i=s,s=void 0):"boolean"==typeof t&&(i=t,t=void 0)),void 0===t&&void 0===s?(t=0,s=1):(t=Ce(t),void 0===s?(s=t,t=0):s=Ce(s)),t>s){var a=t;t=s,s=a}if(i||t%1||s%1){var n=lt();return ot(t+n*(s-t+rt("1e-"+((n+"").length-1))),s)}return function(e,t){return e+at(nt()*(t-e+1))}(t,s)}var ht=Math.min;function ut(e,t){if(e=function(e){var t=Ce(e),s=t%1;return t==t?s?t-s:t:0}(e),e<1||e>9007199254740991)return[];var s,i=4294967295,a=ht(e,4294967295);e-=4294967295;for(var n=fe(a,t="function"==typeof(s=t)?s:Ee);++i<e;)t(i);return n}class ct extends CustomEvent{constructor(e){super("change",{detail:e})}}let pt,_t,mt=e=>e;class gt extends a{constructor(){super(...arguments),this.value=[],this.disabled=!1,this.getText=e=>e}static get properties(){return n(n({},super.properties),{},{value:{type:Array},disabled:{type:Boolean},getText:{type:Object}})}static get styles(){return x.styles}render(){return r(pt||(pt=mt` <div class="font-lumo text-m w-full"> <ul> ${0} </ul> <div class="p-m"> <slot></slot> </div> </div> `),this.value.map(((e,t)=>r(_t||(_t=mt` <li class="${0}"> <slot name="${0}">${0}</slot> <button ?disabled="${0}" class="w-l h-l rounded text-tertiary transition duration-150 hover-text-secondary disabled-text-tertiary disabled-opacity-50 disabled-cursor-default focus-outline-none focus-shadow-outline" @click="${0}"> <iron-icon icon="lumo:cross"></iron-icon> </button> </li> `),"ml-m h-l text-body flex justify-between items-center"+(t>0?" border-t border-contrast-10":""),t,this.getText(e),this.disabled,(()=>this.__remove(t))))))}__remove(e){this.value=this.value.filter(((t,s)=>s!==e)),this.dispatchEvent(new ct(this.value))}}let vt,ft,yt=e=>e;class bt extends a{static get styles(){return[x.styles,o(vt||(vt=yt`:host{position:absolute;top:0;right:0;bottom:0;left:0}.top-center{top:calc(50% - (var(--lumo-size-xl)/ 2))}@keyframes dash0{from{transform:translate(0,0)}to{transform:translate(5.681301px,3.368302px)}}@keyframes dash1{from{transform:translate(0,0)}to{transform:translate(5.677051px,3.457428px)}}@keyframes dash2{from{transform:translate(0,0)}to{transform:translate(5.686002px,3.127455px)}}@keyframes dash3{from{transform:translate(-5.6842px,-3.404556px)}to{transform:translate(0,0)}}`))]}render(){return r(ft||(ft=yt` <div class="h-full bg-base text-primary"> <svg xmlns="http://www.w3.org/2000/svg" class="fill-current w-xl h-xl mx-auto sticky top-center" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" viewBox="0 0 64 64"> <path id="ew5fy7afo2w2" fill-rule="evenodd" stroke="none" stroke-width="1" d="M41.93 49.46c0 .18-.2.3-.36.2l-1.78-1.07-22.73-13.76a1.5 1.5 0 01-.7-1.3V11.08c0-.18.2-.3.36-.2l1.75 1.04c.44.25.74.75.74 1.32v19.27c0 .08.05.16.12.2L41.22 46c.47.28.73.8.72 1.32v2.15z" clip-rule="evenodd"/> <path id="ew5fy7afo2w3" fill-rule="evenodd" stroke="none" stroke-width="1" d="M47.64 52.9c0 .2-.2.3-.36.21l-1.8-1.08c-.42-.26-.7-.74-.7-1.3v-19.3a.24.24 0 00-.12-.2L25.27 19.47a.24.24 0 00-.37.21v12.55c0 .19-.21.3-.37.2l-1.76-1.06a1.46 1.46 0 01-.71-1.28V16.7c0-.54.27-1.03.71-1.3.45-.27 1-.26 1.44 0l22.72 13.77c.44.26.7.76.7 1.3v20.27l.01 2.17z" clip-rule="evenodd"/> <g style="animation:dash0 .3s linear infinite normal forwards"> <path id="ew5fy7afo2w4" fill-rule="evenodd" stroke="none" stroke-width="1" d="M30.59 35.68c0 .2-.21.3-.37.21l-1.8-1.1c-.41-.27-.68-.74-.68-1.28V27v-2.15c0-.2.2-.3.37-.21l1.78 1.06c.42.26.7.74.7 1.3v8.68z" clip-rule="evenodd"/> </g> <g style="animation:dash1 .3s linear infinite normal forwards"> <path id="ew5fy7afo2w5" fill-rule="evenodd" stroke="none" stroke-width="1" d="M36.28 39.13c0 .2-.2.3-.37.21l-1.79-1.1c-.41-.25-.69-.73-.69-1.28v-6.51-2.16c0-.2.2-.31.37-.21l1.76 1.06c.44.26.73.75.73 1.3v8.69z" clip-rule="evenodd"/> </g> <g style="animation:dash2 .3s linear infinite normal forwards"> <path id="ew5fy7afo2w6" fill-rule="evenodd" stroke="none" stroke-width="1" d="M41.96 42.57c0 .2-.2.3-.37.21L39.8 41.7a1.52 1.52 0 01-.71-1.3v-6.51-2.17c0-.2.2-.31.37-.21l1.74 1.06c.45.25.75.75.75 1.32v8.68z" clip-rule="evenodd"/> </g> <g transform="translate(-5.68 -3.4)" style="animation:dash3 .3s linear infinite normal forwards"> <path id="ew5fy7afo2w7" fill-rule="evenodd" stroke="none" stroke-width="1" d="M30.59 35.68c0 .2-.21.3-.37.21l-1.8-1.1c-.41-.27-.68-.74-.68-1.28V27v-2.15c0-.2.2-.3.37-.21l1.78 1.06c.42.26.7.74.7 1.3v8.68z" clip-rule="evenodd"/> </g> </svg> </div> `))}}let xt,wt,$t=e=>e;class kt extends a{static get styles(){return[x.styles,o(xt||(xt=$t`::slotted(:not([slot])){margin-top:var(--lumo-space-xl)}`))]}render(){return r(wt||(wt=$t` <article class="relative antialiased font-lumo"> <header class="space-y-xs leading-s"> <h1 class="font-bold text-header text-xl border-b border-contrast-10 pb-s mb-s"> <slot name="title"></slot> </h1> <p class="text-l text-secondary"> <slot name="subtitle"></slot> </p> </header> <slot></slot> </article> `))}}let Dt,St,Ct=e=>e;class Et extends kt{static get styles(){return[super.styles,o(Dt||(Dt=Ct`::slotted(:not([slot])){margin-top:var(--lumo-space-m)}`))]}render(){return r(St||(St=Ct` <section class="leading-s antialiased font-lumo"> <header> <h2 class="text-header font-semibold text-l"> <slot name="title"></slot> </h2> <p class="text-secondary text-m"> <slot name="subtitle"></slot> </p> </header> <slot></slot> </section> `))}}let It,At=e=>e;class Mt extends CustomEvent{constructor(e){super("change",{detail:e})}}class Tt extends a{constructor(){super(...arguments),this.disabled=!1,this.checked=!1}static get properties(){return n(n({},super.properties),{},{disabled:{attribute:!1},checked:{attribute:!1}})}static get styles(){return x.styles}render(){return r(It||(It=At` <label class="${0}"> <span class="text-body text-m mr-m"> <slot></slot> </span> <span style="border-radius:var(--lumo-size-xl);width:calc((var(--lumo-space-l) * 2) + (var(--lumo-space-xs) * 2))" class="${0}"> <span style="width:var(--lumo-space-l);height:var(--lumo-space-l)" class="${0}"></span> <input type="checkbox" class="opacity-0 absolute inset-0" .checked="${0}" .disabled="${0}" @change="${0}"> </span> </label> `),Y({"transition duration-200 flex justify-between items-center group":!0,"cursor-pointer":!this.disabled}),Y({"transition duration-150 relative flex flex-shrink-0 items-center":!0,"bg-success focus-within-shadow-outline-success":!this.disabled&&this.checked,"bg-contrast-10 focus-within-shadow-outline":this.disabled||!this.checked,"bg-contrast-20":!this.disabled&&!this.checked}),Y({"bg-tint transition duration-200 transform block rounded-full m-xs":!0,"translate-x-l":this.checked,"translate-x-0":!this.checked,"shadow-xs group-hover-shadow-s group-hover-scale-110":!this.disabled}),this.checked,this.disabled,(()=>{this.checked=!this.checked,this.dispatchEvent(new Mt(this.checked))}))}}class jt extends Error{constructor(){super("Unhandled request detected. Please add a request handler to connect this component to a backend.")}}class Ot extends CustomEvent{static emit(e){return new Promise(((t,s)=>{const i=new Ot(n({resolve:t,reject:s},e));e.source.dispatchEvent(i)&&s(new jt)}))}constructor({source:e,resolve:t,reject:s,init:i}){var a;super("request",{cancelable:!0,composed:!0,bubbles:!0,detail:{source:e,handle:async function(e){a.stopImmediatePropagation(),a.preventDefault();try{t(await e(...i))}catch(e){s(e)}}}}),a=this}}const Vt=L`<dom-module id="lumo-custom-field" theme-for="vaadin-custom-field">
1
+ import{e,r as t,S as s,n as i,L as a,_ as n,h as r,j as o}from"./shared-63eaded9.js";import{F as l,D as d,t as h,f as u,a as c}from"./shared-46ee137f.js";import{B as p}from"./shared-0ced76a0.js";import{E as _,F as m}from"./shared-74b9e1d1.js";import{E as g,T as v,D as f,C as y}from"./shared-df573cea.js";import"./shared-f0a83bd6.js";import{t as b,b as x,c as w,d as $}from"./shared-9a40309d.js";import{I as k,D,a as S,C,b as E}from"./shared-1f1734cb.js";import"./shared-07abcd7b.js";import{a as I,I as A,D as M,S as T,M as j,W as O,c as V,t as F}from"./shared-6ebe3825.js";import{O as R,a as P,b as N,c as B,I as q}from"./shared-ec861f31.js";import{T as z}from"./shared-bb824ab4.js";import"./foxy-i18n.js";import{c as Y}from"./shared-4e709717.js";import{h as L,P as W,G as H,a as U,t as X,c as K,y as Q}from"./shared-ff79f3f9.js";import"./shared-60126eee.js";import{P as G}from"./shared-94b0ae99.js";import{a8 as J,a9 as Z,aa as ee,ab as te,ac as se,ad as ie,ae,af as ne,ag as re,ah as oe,ai as le,aj as de,ak as he,al as ue,am as ce,an as pe,ao as _e,ap as me,aq as ge,ar as ve,as as fe,at as ye,au as be}from"./shared-1761daef.js";import{G as xe}from"./shared-91e768be.js";import{p as we}from"./shared-87ca7818.js";import{j as $e}from"./shared-59e44f29.js";import{p as ke,W as De}from"./shared-322e60b1.js";import{i as Se}from"./shared-a46edf4b.js";import"./shared-b0f0e8b5.js";import"./shared-00563cb0.js";import"./shared-593f7e2c.js";import"./shared-6d45a07b.js";function Ce(e){return e?Infinity===(e=b(e))||-Infinity===e?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function Ee(e){return e}var Ie=Object.create,Ae=function(){function t(){}return function(s){if(!e(s))return{};if(Ie)return Ie(s);t.prototype=s;var i=new t;return t.prototype=void 0,i}}();var Me=function(){try{var e=J(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();function Te(e,t,s){"__proto__"==t&&Me?Me(e,t,{configurable:!0,enumerable:!0,value:s,writable:!0}):e[t]=s}var je=Object.prototype.hasOwnProperty;function Oe(e,t,s){var i=e[t];je.call(e,t)&&Z(i,s)&&(void 0!==s||t in e)||Te(e,t,s)}function Ve(e,t,s,i){var a=!s;s||(s={});for(var n=-1,r=t.length;++n<r;){var o=t[n],l=i?i(s[o],e[o],o,s,e):void 0;void 0===l&&(l=e[o]),a?Te(s,o,l):Oe(s,o,l)}return s}var Fe=Object.prototype.hasOwnProperty;function Re(t){if(!e(t))return function(e){var t=[];if(null!=e)for(var s in Object(e))t.push(s);return t}(t);var s=se(t),i=[];for(var a in t)("constructor"!=a||!s&&Fe.call(t,a))&&i.push(a);return i}function Pe(e){return ee(e)?ie(e,!0):Re(e)}var Ne=ae(Object.getPrototypeOf,Object);var Be="object"==typeof exports&&exports&&!exports.nodeType&&exports,qe=Be&&"object"==typeof module&&module&&!module.nodeType&&module,ze=qe&&qe.exports===Be?t.Buffer:void 0,Ye=ze?ze.allocUnsafe:void 0;var Le=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)le(t,re(e)),e=Ne(e);return t}:oe;function We(e){return de(e,Pe,Le)}var He=Object.prototype.hasOwnProperty;function Ue(e){var t=new e.constructor(e.byteLength);return new he(t).set(new he(e)),t}var Xe=/\w*$/;var Ke=s?s.prototype:void 0,Qe=Ke?Ke.valueOf:void 0;function Ge(e,t,s){var i,a,n,r=e.constructor;switch(t){case"[object ArrayBuffer]":return Ue(e);case"[object Boolean]":case"[object Date]":return new r(+e);case"[object DataView]":return function(e,t){var s=t?Ue(e.buffer):e.buffer;return new e.constructor(s,e.byteOffset,e.byteLength)}(e,s);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return function(e,t){var s=t?Ue(e.buffer):e.buffer;return new e.constructor(s,e.byteOffset,e.length)}(e,s);case"[object Map]":case"[object Set]":return new r;case"[object Number]":case"[object String]":return new r(e);case"[object RegExp]":return(n=new(a=e).constructor(a.source,Xe.exec(a))).lastIndex=a.lastIndex,n;case"[object Symbol]":return i=e,Qe?Object(Qe.call(i)):{}}}var Je=ce&&ce.isMap,Ze=Je?pe(Je):function(e){return i(e)&&"[object Map]"==ue(e)};var et=ce&&ce.isSet,tt=et?pe(et):function(e){return i(e)&&"[object Set]"==ue(e)},st={};function it(t,s,i,a,n,r){var o,l=1&s,d=2&s,h=4&s;if(i&&(o=n?i(t,a,n,r):i(t)),void 0!==o)return o;if(!e(t))return t;var u=_e(t);if(u){if(o=function(e){var t=e.length,s=new e.constructor(t);return t&&"string"==typeof e[0]&&He.call(e,"index")&&(s.index=e.index,s.input=e.input),s}(t),!l)return function(e,t){var s=-1,i=e.length;for(t||(t=Array(i));++s<i;)t[s]=e[s];return t}(t,o)}else{var c=ue(t),p="[object Function]"==c||"[object GeneratorFunction]"==c;if(me(t))return function(e,t){if(t)return e.slice();var s=e.length,i=Ye?Ye(s):new e.constructor(s);return e.copy(i),i}(t,l);if("[object Object]"==c||"[object Arguments]"==c||p&&!n){if(o=d||p?{}:function(e){return"function"!=typeof e.constructor||se(e)?{}:Ae(Ne(e))}(t),!l)return d?function(e,t){return Ve(e,Le(e),t)}(t,function(e,t){return e&&Ve(t,Pe(t),e)}(o,t)):function(e,t){return Ve(e,re(e),t)}(t,function(e,t){return e&&Ve(t,ne(t),e)}(o,t))}else{if(!st[c])return n?t:{};o=Ge(t,c,l)}}r||(r=new ge);var _=r.get(t);if(_)return _;r.set(t,o),tt(t)?t.forEach((function(e){o.add(it(e,s,i,e,t,r))})):Ze(t)&&t.forEach((function(e,a){o.set(a,it(e,s,i,a,t,r))}));var m=u?void 0:(h?d?We:ve:d?Pe:ne)(t);return function(e,t){for(var s=-1,i=null==e?0:e.length;++s<i&&!1!==t(e[s],s,e););}(m||t,(function(e,a){m&&(e=t[a=e]),Oe(o,a,it(e,s,i,a,t,r))})),o}st["[object Arguments]"]=st["[object Array]"]=st["[object ArrayBuffer]"]=st["[object DataView]"]=st["[object Boolean]"]=st["[object Date]"]=st["[object Float32Array]"]=st["[object Float64Array]"]=st["[object Int8Array]"]=st["[object Int16Array]"]=st["[object Int32Array]"]=st["[object Map]"]=st["[object Number]"]=st["[object Object]"]=st["[object RegExp]"]=st["[object Set]"]=st["[object String]"]=st["[object Symbol]"]=st["[object Uint8Array]"]=st["[object Uint8ClampedArray]"]=st["[object Uint16Array]"]=st["[object Uint32Array]"]=!0,st["[object Error]"]=st["[object Function]"]=st["[object WeakMap]"]=!1;var at=Math.floor,nt=Math.random;var rt=parseFloat,ot=Math.min,lt=Math.random;function dt(t,s,i){if(i&&"boolean"!=typeof i&&function(t,s,i){if(!e(i))return!1;var a=typeof s;return!!("number"==a?ee(i)&&te(s,i.length):"string"==a&&s in i)&&Z(i[s],t)}(t,s,i)&&(s=i=void 0),void 0===i&&("boolean"==typeof s?(i=s,s=void 0):"boolean"==typeof t&&(i=t,t=void 0)),void 0===t&&void 0===s?(t=0,s=1):(t=Ce(t),void 0===s?(s=t,t=0):s=Ce(s)),t>s){var a=t;t=s,s=a}if(i||t%1||s%1){var n=lt();return ot(t+n*(s-t+rt("1e-"+((n+"").length-1))),s)}return function(e,t){return e+at(nt()*(t-e+1))}(t,s)}var ht=Math.min;function ut(e,t){if(e=function(e){var t=Ce(e),s=t%1;return t==t?s?t-s:t:0}(e),e<1||e>9007199254740991)return[];var s,i=4294967295,a=ht(e,4294967295);e-=4294967295;for(var n=fe(a,t="function"==typeof(s=t)?s:Ee);++i<e;)t(i);return n}class ct extends CustomEvent{constructor(e){super("change",{detail:e})}}let pt,_t,mt=e=>e;class gt extends a{constructor(){super(...arguments),this.value=[],this.disabled=!1,this.getText=e=>e}static get properties(){return n(n({},super.properties),{},{value:{type:Array},disabled:{type:Boolean},getText:{type:Object}})}static get styles(){return x.styles}render(){return r(pt||(pt=mt` <div class="font-lumo text-m w-full"> <ul> ${0} </ul> <div class="p-m"> <slot></slot> </div> </div> `),this.value.map(((e,t)=>r(_t||(_t=mt` <li class="${0}"> <slot name="${0}">${0}</slot> <button ?disabled="${0}" class="w-l h-l rounded text-tertiary transition duration-150 hover-text-secondary disabled-text-tertiary disabled-opacity-50 disabled-cursor-default focus-outline-none focus-shadow-outline" @click="${0}"> <iron-icon icon="lumo:cross"></iron-icon> </button> </li> `),"ml-m h-l text-body flex justify-between items-center"+(t>0?" border-t border-contrast-10":""),t,this.getText(e),this.disabled,(()=>this.__remove(t))))))}__remove(e){this.value=this.value.filter(((t,s)=>s!==e)),this.dispatchEvent(new ct(this.value))}}let vt,ft,yt=e=>e;class bt extends a{static get styles(){return[x.styles,o(vt||(vt=yt`:host{position:absolute;top:0;right:0;bottom:0;left:0}.top-center{top:calc(50% - (var(--lumo-size-xl)/ 2))}@keyframes dash0{from{transform:translate(0,0)}to{transform:translate(5.681301px,3.368302px)}}@keyframes dash1{from{transform:translate(0,0)}to{transform:translate(5.677051px,3.457428px)}}@keyframes dash2{from{transform:translate(0,0)}to{transform:translate(5.686002px,3.127455px)}}@keyframes dash3{from{transform:translate(-5.6842px,-3.404556px)}to{transform:translate(0,0)}}`))]}render(){return r(ft||(ft=yt` <div class="h-full bg-base text-primary"> <svg xmlns="http://www.w3.org/2000/svg" class="fill-current w-xl h-xl mx-auto sticky top-center" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" viewBox="0 0 64 64"> <path id="ew5fy7afo2w2" fill-rule="evenodd" stroke="none" stroke-width="1" d="M41.93 49.46c0 .18-.2.3-.36.2l-1.78-1.07-22.73-13.76a1.5 1.5 0 01-.7-1.3V11.08c0-.18.2-.3.36-.2l1.75 1.04c.44.25.74.75.74 1.32v19.27c0 .08.05.16.12.2L41.22 46c.47.28.73.8.72 1.32v2.15z" clip-rule="evenodd"/> <path id="ew5fy7afo2w3" fill-rule="evenodd" stroke="none" stroke-width="1" d="M47.64 52.9c0 .2-.2.3-.36.21l-1.8-1.08c-.42-.26-.7-.74-.7-1.3v-19.3a.24.24 0 00-.12-.2L25.27 19.47a.24.24 0 00-.37.21v12.55c0 .19-.21.3-.37.2l-1.76-1.06a1.46 1.46 0 01-.71-1.28V16.7c0-.54.27-1.03.71-1.3.45-.27 1-.26 1.44 0l22.72 13.77c.44.26.7.76.7 1.3v20.27l.01 2.17z" clip-rule="evenodd"/> <g style="animation:dash0 .3s linear infinite normal forwards"> <path id="ew5fy7afo2w4" fill-rule="evenodd" stroke="none" stroke-width="1" d="M30.59 35.68c0 .2-.21.3-.37.21l-1.8-1.1c-.41-.27-.68-.74-.68-1.28V27v-2.15c0-.2.2-.3.37-.21l1.78 1.06c.42.26.7.74.7 1.3v8.68z" clip-rule="evenodd"/> </g> <g style="animation:dash1 .3s linear infinite normal forwards"> <path id="ew5fy7afo2w5" fill-rule="evenodd" stroke="none" stroke-width="1" d="M36.28 39.13c0 .2-.2.3-.37.21l-1.79-1.1c-.41-.25-.69-.73-.69-1.28v-6.51-2.16c0-.2.2-.31.37-.21l1.76 1.06c.44.26.73.75.73 1.3v8.69z" clip-rule="evenodd"/> </g> <g style="animation:dash2 .3s linear infinite normal forwards"> <path id="ew5fy7afo2w6" fill-rule="evenodd" stroke="none" stroke-width="1" d="M41.96 42.57c0 .2-.2.3-.37.21L39.8 41.7a1.52 1.52 0 01-.71-1.3v-6.51-2.17c0-.2.2-.31.37-.21l1.74 1.06c.45.25.75.75.75 1.32v8.68z" clip-rule="evenodd"/> </g> <g transform="translate(-5.68 -3.4)" style="animation:dash3 .3s linear infinite normal forwards"> <path id="ew5fy7afo2w7" fill-rule="evenodd" stroke="none" stroke-width="1" d="M30.59 35.68c0 .2-.21.3-.37.21l-1.8-1.1c-.41-.27-.68-.74-.68-1.28V27v-2.15c0-.2.2-.3.37-.21l1.78 1.06c.42.26.7.74.7 1.3v8.68z" clip-rule="evenodd"/> </g> </svg> </div> `))}}let xt,wt,$t=e=>e;class kt extends a{static get styles(){return[x.styles,o(xt||(xt=$t`::slotted(:not([slot])){margin-top:var(--lumo-space-xl)}`))]}render(){return r(wt||(wt=$t` <article class="relative antialiased font-lumo"> <header class="space-y-xs leading-s"> <h1 class="font-bold text-header text-xl border-b border-contrast-10 pb-s mb-s"> <slot name="title"></slot> </h1> <p class="text-l text-secondary"> <slot name="subtitle"></slot> </p> </header> <slot></slot> </article> `))}}let Dt,St,Ct=e=>e;class Et extends kt{static get styles(){return[super.styles,o(Dt||(Dt=Ct`::slotted(:not([slot])){margin-top:var(--lumo-space-m)}`))]}render(){return r(St||(St=Ct` <section class="leading-s antialiased font-lumo"> <header> <h2 class="text-header font-semibold text-l"> <slot name="title"></slot> </h2> <p class="text-secondary text-m"> <slot name="subtitle"></slot> </p> </header> <slot></slot> </section> `))}}let It,At=e=>e;class Mt extends CustomEvent{constructor(e){super("change",{detail:e})}}class Tt extends a{constructor(){super(...arguments),this.disabled=!1,this.checked=!1}static get properties(){return n(n({},super.properties),{},{disabled:{attribute:!1},checked:{attribute:!1}})}static get styles(){return x.styles}render(){return r(It||(It=At` <label class="${0}"> <span class="text-body text-m mr-m"> <slot></slot> </span> <span style="border-radius:var(--lumo-size-xl);width:calc((var(--lumo-space-l) * 2) + (var(--lumo-space-xs) * 2))" class="${0}"> <span style="width:var(--lumo-space-l);height:var(--lumo-space-l)" class="${0}"></span> <input type="checkbox" class="opacity-0 absolute inset-0" .checked="${0}" .disabled="${0}" @change="${0}"> </span> </label> `),Y({"transition duration-200 flex justify-between items-center group":!0,"cursor-pointer":!this.disabled}),Y({"transition duration-150 relative flex flex-shrink-0 items-center":!0,"bg-success focus-within-shadow-outline-success":!this.disabled&&this.checked,"bg-contrast-10 focus-within-shadow-outline":this.disabled||!this.checked,"bg-contrast-20":!this.disabled&&!this.checked}),Y({"bg-tint transition duration-200 transform block rounded-full m-xs":!0,"translate-x-l":this.checked,"translate-x-0":!this.checked,"shadow-xs group-hover-shadow-s group-hover-scale-110":!this.disabled}),this.checked,this.disabled,(()=>{this.checked=!this.checked,this.dispatchEvent(new Mt(this.checked))}))}}class jt extends Error{constructor(){super("Unhandled request detected. Please add a request handler to connect this component to a backend.")}}class Ot extends CustomEvent{static emit(e){return new Promise(((t,s)=>{const i=new Ot(n({resolve:t,reject:s},e));e.source.dispatchEvent(i)&&s(new jt)}))}constructor({source:e,resolve:t,reject:s,init:i}){var a;super("request",{cancelable:!0,composed:!0,bubbles:!0,detail:{source:e,handle:async function(e){a.stopImmediatePropagation(),a.preventDefault();try{t(await e(...i))}catch(e){s(e)}}}}),a=this}}const Vt=L`<dom-module id="lumo-custom-field" theme-for="vaadin-custom-field">
2
2
  <template>
3
3
  <style include="lumo-required-field">
4
4
  :host {
@@ -1,4 +1,4 @@
1
- import"./foxy-customer.js";import"./shared-0ced76a0.js";import"./shared-60126eee.js";import"./shared-46ee137f.js";import"./shared-9221e6b2.js";import"./foxy-access-recovery-form.js";import"./foxy-payment-method-card.js";import"./foxy-transactions-table.js";import"./foxy-subscription-card.js";import"./foxy-subscription-form.js";import"./foxy-collection-pages.js";import"./foxy-collection-page.js";import"./foxy-sign-in-form.js";import"./foxy-form-dialog.js";import"./foxy-spinner.js";import{_ as e,h as t,L as s,j as r,w as o}from"./shared-63eaded9.js";import{A as i}from"./shared-e7f8ffe9.js";import"./shared-59e44f29.js";import{C as n}from"./shared-34b2c1e2.js";import{a,T as l,R as d}from"./shared-9a40309d.js";import{A as c}from"./shared-00563cb0.js";import{c as m}from"./shared-4e709717.js";import{C as h}from"./shared-593f7e2c.js";import{N as p}from"./shared-44cfc617.js";import{i as u}from"./shared-6d45a07b.js";import"./shared-ff79f3f9.js";import"./foxy-attribute-card.js";import"./foxy-i18n.js";import"./shared-1761daef.js";import"./shared-7684cb05.js";import"./shared-a46edf4b.js";import"./foxy-attribute-form.js";import"./shared-d8ffb279.js";import"./shared-df573cea.js";import"./shared-f0a83bd6.js";import"./shared-bb824ab4.js";import"./shared-ec861f31.js";import"./shared-87ca7818.js";import"./shared-b0f0e8b5.js";import"./shared-e5cbf291.js";import"./shared-07abcd7b.js";import"./shared-b5147166.js";import"./shared-91e768be.js";import"./shared-8a7bee0d.js";import"./foxy-customer-form.js";import"./foxy-nucleon-element.js";import"./shared-b738ee96.js";import"./foxy-address-card.js";import"./foxy-address-form.js";import"./foxy-table.js";import"./shared-ce1da35d.js";import"./shared-7a42073a.js";import"./shared-6b7602c7.js";import"./shared-218ba06e.js";import"./foxy-cancellation-form.js";import"./shared-322e60b1.js";import"./shared-2061be9a.js";import"./shared-35dbd2c5.js";import"./shared-5c8b531d.js";import"./shared-5f54e916.js";import"./shared-b710881a.js";import"./shared-200f613b.js";import"./shared-94b0ae99.js";import"./shared-16f72e27.js";let g,f,$=e=>e;class y extends(a(l(n),"customer-portal")){constructor(){super(...arguments),this.group=""}static get properties(){return e(e({},super.properties),{},{group:{type:String}})}render(){return this.api.storage.getItem(i.SESSION)?t(g||(g=$` <foxy-internal-customer-portal-logged-in-view disabledcontrols="${0}" readonlycontrols="${0}" hiddencontrols="${0}" customer="${0}" group="${0}" class="h-full" lang="${0}" href="${0}" ns="${0}" .templates="${0}"> </foxy-internal-customer-portal-logged-in-view> `),this.disabledSelector.toString(),this.readonlySelector.toString(),this.hiddenSelector.toString(),this.base,this.group,this.lang,new URL("./customer_portal_settings",this.base).toString(),this.ns,this.templates):t(f||(f=$` <foxy-internal-customer-portal-logged-out-view disabledcontrols="${0}" readonlycontrols="${0}" hiddencontrols="${0}" group="${0}" class="h-full" lang="${0}" ns="${0}" .templates="${0}"> </foxy-internal-customer-portal-logged-out-view> `),this.disabledSelector.toString(),this.readonlySelector.toString(),this.hiddenSelector.toString(),this.group,this.lang,this.ns,this.templates)}}let b,v,S=e=>e;const _=d(l(a(s)));let x,j,T,w,O=e=>e;class k extends(l(s)){constructor(){super(...arguments),this.disabled=!1,this.href="",this.icon=""}static get properties(){return e(e({},super.properties),{},{disabled:{type:Boolean},href:{type:String},icon:{type:String}})}render(){const e=m({"flex-auto font-medium tracking-wide text-s rounded-s transition-colors":!0,"hover-text-primary hover-cursor-pointer":!this.disabled,"focus-outline-none focus-ring-2 ring-primary-50 ring-offset-2":!this.disabled,"text-disabled cursor-default":this.disabled}),s=t(x||(x=O` ${0} <slot></slot> `),this.icon?t(j||(j=O`<iron-icon icon="${0}" class="icon-inline"></iron-icon>`),this.icon):"");return this.disabled?t(T||(T=O`<button class="${0}" disabled="disabled">${0}</button>`),e,s):t(w||(w=O` <a class="${0}" href="${0}" rel="nofollow noopener">${0}</a> `),e,this.href,s)}}let R,z,E,A,F,I,N,H,U,q,L=e=>e;const P=l(h(a(p)));let C,D,V,J,W,B,G,K,M,Q,X=e=>e;const Y=l(h(a(s)));const Z=["html"],ee=["html"];let te,se,re,oe,ie,ne,ae,le,de,ce,me,he,pe=e=>e;const ue=a(h(l(s)));let ge,fe,$e,ye=e=>e;const be=h(l(a(s,"customer-portal")));customElements.define("foxy-internal-customer-portal-logged-in-view",class extends P{constructor(){var e;super(...arguments),e=this,this.templates={},this.customer="",this.loggingOutState="idle",this.loggingOutStateResetTimeout=null,this.__renderHeaderActionsSignOut=()=>{var s,r,o;const i="customer:header:actions:sign-out",n=this.loggingOutState,a=!!(null===(s=this.__customerElement)||void 0===s?void 0:s.in({idle:"snapshot"}));return t(R||(R=L` <div style="display:flex;margin-left:var(--lumo-space-m)"> ${0} <vaadin-button data-testid="sign-out" aria-label="${0}" style="padding:var(--lumo-space-xs);margin:0;border-radius:100%;display:flex" theme="icon" ?disabled="${0}" @click="${0}"> ${0} </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot(`${i}:before`),this.t("sign_out").toString(),this.disabledSelector.matches(i)||!a||"idle"!==n,(async function(){try{e.loggingOutState="busy",await new c(e).fetch("foxy://customer-api/session",{method:"DELETE"}),e.loggingOutState="idle"}catch(t){e.loggingOutState="fail",e.loggingOutStateResetTimeout=setTimeout((()=>{e.loggingOutState="idle",e.loggingOutStateResetTimeout=null}),1e3)}}),"idle"===n?t(z||(z=L`<iron-icon icon="icons:exit-to-app"></iron-icon>`)):t(E||(E=L` <foxy-spinner layout="no-label" state="${0}" style="margin:auto" lang="${0}" ns="${0} ${0}"> </foxy-spinner> `),"fail"===n?"error":"busy",this.lang,this.ns,null!==(o=null===(r=customElements.get("foxy-customer"))||void 0===r?void 0:r.defaultNS)&&void 0!==o?o:""),this.renderTemplateOrSlot(`${i}:after`))},this.__renderSubscriptions=(e,t)=>{const s="customer:subscriptions";return e(A||(A=L`
1
+ import"./foxy-customer.js";import"./shared-0ced76a0.js";import"./shared-60126eee.js";import"./shared-46ee137f.js";import"./shared-9221e6b2.js";import"./foxy-access-recovery-form.js";import"./foxy-payment-method-card.js";import"./foxy-transactions-table.js";import"./foxy-subscription-card.js";import"./foxy-subscription-form.js";import"./foxy-collection-pages.js";import"./foxy-collection-page.js";import"./foxy-sign-in-form.js";import"./foxy-form-dialog.js";import"./foxy-spinner.js";import{_ as e,h as t,L as s,j as r,w as o}from"./shared-63eaded9.js";import{A as i}from"./shared-e7f8ffe9.js";import"./shared-59e44f29.js";import{C as n}from"./shared-34b2c1e2.js";import{a,T as l,R as d}from"./shared-9a40309d.js";import{A as c}from"./shared-00563cb0.js";import{c as m}from"./shared-4e709717.js";import{C as h}from"./shared-593f7e2c.js";import{N as p}from"./shared-44cfc617.js";import{i as u}from"./shared-6d45a07b.js";import"./shared-ff79f3f9.js";import"./foxy-attribute-card.js";import"./foxy-i18n.js";import"./shared-1761daef.js";import"./shared-7684cb05.js";import"./shared-a46edf4b.js";import"./foxy-attribute-form.js";import"./shared-1f1734cb.js";import"./shared-df573cea.js";import"./shared-f0a83bd6.js";import"./shared-bb824ab4.js";import"./shared-ec861f31.js";import"./shared-87ca7818.js";import"./shared-b0f0e8b5.js";import"./shared-b1fc5dc3.js";import"./shared-07abcd7b.js";import"./shared-6ebe3825.js";import"./shared-91e768be.js";import"./shared-8a7bee0d.js";import"./foxy-customer-form.js";import"./foxy-nucleon-element.js";import"./shared-b738ee96.js";import"./foxy-address-card.js";import"./foxy-address-form.js";import"./foxy-table.js";import"./shared-ce1da35d.js";import"./shared-7a42073a.js";import"./shared-6b7602c7.js";import"./shared-218ba06e.js";import"./foxy-cancellation-form.js";import"./shared-322e60b1.js";import"./shared-2061be9a.js";import"./shared-9c099da6.js";import"./shared-74b9e1d1.js";import"./shared-5f54e916.js";import"./shared-b710881a.js";import"./shared-200f613b.js";import"./shared-94b0ae99.js";import"./shared-16f72e27.js";let g,f,$=e=>e;class y extends(a(l(n),"customer-portal")){constructor(){super(...arguments),this.group=""}static get properties(){return e(e({},super.properties),{},{group:{type:String}})}render(){return this.api.storage.getItem(i.SESSION)?t(g||(g=$` <foxy-internal-customer-portal-logged-in-view disabledcontrols="${0}" readonlycontrols="${0}" hiddencontrols="${0}" customer="${0}" group="${0}" class="h-full" lang="${0}" href="${0}" ns="${0}" .templates="${0}"> </foxy-internal-customer-portal-logged-in-view> `),this.disabledSelector.toString(),this.readonlySelector.toString(),this.hiddenSelector.toString(),this.base,this.group,this.lang,new URL("./customer_portal_settings",this.base).toString(),this.ns,this.templates):t(f||(f=$` <foxy-internal-customer-portal-logged-out-view disabledcontrols="${0}" readonlycontrols="${0}" hiddencontrols="${0}" group="${0}" class="h-full" lang="${0}" ns="${0}" .templates="${0}"> </foxy-internal-customer-portal-logged-out-view> `),this.disabledSelector.toString(),this.readonlySelector.toString(),this.hiddenSelector.toString(),this.group,this.lang,this.ns,this.templates)}}let b,v,S=e=>e;const _=d(l(a(s)));let x,j,T,w,O=e=>e;class k extends(l(s)){constructor(){super(...arguments),this.disabled=!1,this.href="",this.icon=""}static get properties(){return e(e({},super.properties),{},{disabled:{type:Boolean},href:{type:String},icon:{type:String}})}render(){const e=m({"flex-auto font-medium tracking-wide text-s rounded-s transition-colors":!0,"hover-text-primary hover-cursor-pointer":!this.disabled,"focus-outline-none focus-ring-2 ring-primary-50 ring-offset-2":!this.disabled,"text-disabled cursor-default":this.disabled}),s=t(x||(x=O` ${0} <slot></slot> `),this.icon?t(j||(j=O`<iron-icon icon="${0}" class="icon-inline"></iron-icon>`),this.icon):"");return this.disabled?t(T||(T=O`<button class="${0}" disabled="disabled">${0}</button>`),e,s):t(w||(w=O` <a class="${0}" href="${0}" rel="nofollow noopener">${0}</a> `),e,this.href,s)}}let R,z,E,A,F,I,N,H,U,q,L=e=>e;const P=l(h(a(p)));let C,D,V,J,W,B,G,K,M,Q,X=e=>e;const Y=l(h(a(s)));const Z=["html"],ee=["html"];let te,se,re,oe,ie,ne,ae,le,de,ce,me,he,pe=e=>e;const ue=a(h(l(s)));let ge,fe,$e,ye=e=>e;const be=h(l(a(s,"customer-portal")));customElements.define("foxy-internal-customer-portal-logged-in-view",class extends P{constructor(){var e;super(...arguments),e=this,this.templates={},this.customer="",this.loggingOutState="idle",this.loggingOutStateResetTimeout=null,this.__renderHeaderActionsSignOut=()=>{var s,r,o;const i="customer:header:actions:sign-out",n=this.loggingOutState,a=!!(null===(s=this.__customerElement)||void 0===s?void 0:s.in({idle:"snapshot"}));return t(R||(R=L` <div style="display:flex;margin-left:var(--lumo-space-m)"> ${0} <vaadin-button data-testid="sign-out" aria-label="${0}" style="padding:var(--lumo-space-xs);margin:0;border-radius:100%;display:flex" theme="icon" ?disabled="${0}" @click="${0}"> ${0} </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot(`${i}:before`),this.t("sign_out").toString(),this.disabledSelector.matches(i)||!a||"idle"!==n,(async function(){try{e.loggingOutState="busy",await new c(e).fetch("foxy://customer-api/session",{method:"DELETE"}),e.loggingOutState="idle"}catch(t){e.loggingOutState="fail",e.loggingOutStateResetTimeout=setTimeout((()=>{e.loggingOutState="idle",e.loggingOutStateResetTimeout=null}),1e3)}}),"idle"===n?t(z||(z=L`<iron-icon icon="icons:exit-to-app"></iron-icon>`)):t(E||(E=L` <foxy-spinner layout="no-label" state="${0}" style="margin:auto" lang="${0}" ns="${0} ${0}"> </foxy-spinner> `),"fail"===n?"error":"busy",this.lang,this.ns,null!==(o=null===(r=customElements.get("foxy-customer"))||void 0===r?void 0:r.defaultNS)&&void 0!==o?o:""),this.renderTemplateOrSlot(`${i}:after`))},this.__renderSubscriptions=(e,t)=>{const s="customer:subscriptions";return e(A||(A=L`
2
2
  ${0}
3
3
 
4
4
  <foxy-internal-customer-portal-subscriptions
@@ -1,4 +1,4 @@
1
- import"./shared-46ee137f.js";import"./shared-60126eee.js";import{h as t}from"./shared-ff79f3f9.js";import"./shared-0ced76a0.js";import"./shared-9221e6b2.js";import"./foxy-payment-method-card.js";import"./foxy-subscription-form.js";import"./foxy-form-dialog.js";import"./foxy-transactions-table.js";import"./foxy-collection-pages.js";import"./foxy-collection-page.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-customer-form.js";import"./foxy-address-card.js";import"./foxy-address-form.js";import"./foxy-spinner.js";import"./foxy-table.js";import"./foxy-i18n.js";import{L as e,h as s,j as r,w as a}from"./shared-63eaded9.js";import{C as o}from"./shared-593f7e2c.js";import"./shared-df573cea.js";import"./shared-f0a83bd6.js";import{b as h,S as i,T as d,a as n}from"./shared-9a40309d.js";import{c as l}from"./shared-4e709717.js";import"./shared-d8ffb279.js";import"./shared-07abcd7b.js";import{S as m}from"./shared-b5147166.js";import"./shared-ec861f31.js";import"./shared-bb824ab4.js";import{G as c}from"./shared-91e768be.js";import{N as v}from"./shared-44cfc617.js";import{S as p}from"./shared-7a42073a.js";import{i as g}from"./shared-6d45a07b.js";import"./shared-e5cbf291.js";import"./shared-218ba06e.js";import"./shared-1761daef.js";import"./foxy-nucleon-element.js";import"./foxy-cancellation-form.js";import"./shared-322e60b1.js";import"./shared-2061be9a.js";import"./shared-87ca7818.js";import"./shared-b0f0e8b5.js";import"./shared-a46edf4b.js";import"./shared-00563cb0.js";import"./shared-7684cb05.js";import"./shared-35dbd2c5.js";import"./shared-5c8b531d.js";import"./shared-e7f8ffe9.js";import"./shared-59e44f29.js";import"./shared-5f54e916.js";import"./shared-ce1da35d.js";import"./shared-6b7602c7.js";import"./shared-b710881a.js";import"./shared-8a7bee0d.js";import"./shared-b738ee96.js";let z,f,u,b=t=>t;class $ extends e{constructor(){super(...arguments),this.value=0,this.size=0}static get properties(){return{value:{type:Number},size:{type:Number}}}static get styles(){return h.styles}render(){const t=[],e=[];for(let r=0;r<this.size;++r)t.push(s(z||(z=b` <button id="tab-${0}" role="tab" class="${0}" aria-controls="panel-${0}" aria-selected="${0}" @click="${0}" @keydown="${0}"> <slot name="tab-${0}"></slot> </button> `),r,l({"text-l font-semibold px-s rounded focus-outline-none focus-shadow-outline":!0,"text-tertiary hover-text-body focus-text-body":this.value!==r}),r,this.value===r,(()=>this.value=r),this.__handleKeyDown,r)),e.push(s(f||(f=b` <slot id="panel-${0}" role="tabpanel" name="panel-${0}" class="${0}" aria-hidden="${0}" aria-labelledby="tab-${0}"> </slot> `),r,r,l({hidden:this.value!==r}),this.value!==r,r));return s(u||(u=b` <div role="tablist" aria-orientation="horizontal" class="-mx-s mb-s">${0}</div> ${0} `),t,e)}__handleKeyDown(t){if(t.key.startsWith("Arrow")){t.preventDefault();const e=t.target;let s=null;"ArrowRight"===t.key||"ArrowDown"===t.key?s=e.nextElementSibling:"ArrowLeft"!==t.key&&"ArrowUp"!==t.key||(s=e.previousElementSibling),null==s||s.click(),null==s||s.focus()}}}
1
+ import"./shared-46ee137f.js";import"./shared-60126eee.js";import{h as t}from"./shared-ff79f3f9.js";import"./shared-0ced76a0.js";import"./shared-9221e6b2.js";import"./foxy-payment-method-card.js";import"./foxy-subscription-form.js";import"./foxy-form-dialog.js";import"./foxy-transactions-table.js";import"./foxy-collection-pages.js";import"./foxy-collection-page.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-customer-form.js";import"./foxy-address-card.js";import"./foxy-address-form.js";import"./foxy-spinner.js";import"./foxy-table.js";import"./foxy-i18n.js";import{L as e,h as s,j as r,w as a}from"./shared-63eaded9.js";import{C as o}from"./shared-593f7e2c.js";import"./shared-df573cea.js";import"./shared-f0a83bd6.js";import{b as h,S as i,T as d,a as n}from"./shared-9a40309d.js";import{c as l}from"./shared-4e709717.js";import"./shared-1f1734cb.js";import"./shared-07abcd7b.js";import{S as m}from"./shared-6ebe3825.js";import"./shared-ec861f31.js";import"./shared-bb824ab4.js";import{G as c}from"./shared-91e768be.js";import{N as v}from"./shared-44cfc617.js";import{S as p}from"./shared-7a42073a.js";import{i as g}from"./shared-6d45a07b.js";import"./shared-b1fc5dc3.js";import"./shared-218ba06e.js";import"./shared-1761daef.js";import"./foxy-nucleon-element.js";import"./foxy-cancellation-form.js";import"./shared-322e60b1.js";import"./shared-2061be9a.js";import"./shared-87ca7818.js";import"./shared-b0f0e8b5.js";import"./shared-a46edf4b.js";import"./shared-00563cb0.js";import"./shared-7684cb05.js";import"./shared-9c099da6.js";import"./shared-74b9e1d1.js";import"./shared-e7f8ffe9.js";import"./shared-59e44f29.js";import"./shared-5f54e916.js";import"./shared-ce1da35d.js";import"./shared-6b7602c7.js";import"./shared-b710881a.js";import"./shared-8a7bee0d.js";import"./shared-b738ee96.js";let z,f,u,b=t=>t;class $ extends e{constructor(){super(...arguments),this.value=0,this.size=0}static get properties(){return{value:{type:Number},size:{type:Number}}}static get styles(){return h.styles}render(){const t=[],e=[];for(let r=0;r<this.size;++r)t.push(s(z||(z=b` <button id="tab-${0}" role="tab" class="${0}" aria-controls="panel-${0}" aria-selected="${0}" @click="${0}" @keydown="${0}"> <slot name="tab-${0}"></slot> </button> `),r,l({"text-l font-semibold px-s rounded focus-outline-none focus-shadow-outline":!0,"text-tertiary hover-text-body focus-text-body":this.value!==r}),r,this.value===r,(()=>this.value=r),this.__handleKeyDown,r)),e.push(s(f||(f=b` <slot id="panel-${0}" role="tabpanel" name="panel-${0}" class="${0}" aria-hidden="${0}" aria-labelledby="tab-${0}"> </slot> `),r,r,l({hidden:this.value!==r}),this.value!==r,r));return s(u||(u=b` <div role="tablist" aria-orientation="horizontal" class="-mx-s mb-s">${0}</div> ${0} `),t,e)}__handleKeyDown(t){if(t.key.startsWith("Arrow")){t.preventDefault();const e=t.target;let s=null;"ArrowRight"===t.key||"ArrowDown"===t.key?s=e.nextElementSibling:"ArrowLeft"!==t.key&&"ArrowUp"!==t.key||(s=e.previousElementSibling),null==s||s.click(),null==s||s.focus()}}}
2
2
  /**
3
3
  @license
4
4
  Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
@@ -1 +1 @@
1
- import{_ as t,h as e}from"./shared-63eaded9.js";import"./shared-0ced76a0.js";import{C as s}from"./shared-d8ffb279.js";import"./shared-bb824ab4.js";import{c as n}from"./shared-9a40309d.js";import{p as i}from"./shared-87ca7818.js";import{C as r}from"./shared-f1dc1c6c.js";import"./shared-07abcd7b.js";import{D as a,I as o}from"./shared-b5147166.js";import{E as c}from"./shared-5c8b531d.js";import"./shared-ec861f31.js";import"./foxy-i18n.js";import{G as m}from"./shared-91e768be.js";import"./shared-df573cea.js";import"./shared-46ee137f.js";import"./shared-f0a83bd6.js";import"./shared-ff79f3f9.js";import"./shared-1761daef.js";import"./shared-b0f0e8b5.js";import"./shared-a46edf4b.js";import"./shared-4e709717.js";import"./shared-00563cb0.js";import"./shared-593f7e2c.js";import"./shared-6d45a07b.js";class h extends CustomEvent{constructor(t){super("change",{detail:t})}}class u extends CustomEvent{constructor(){super("submit",{cancelable:!0})}}let d,l,p,y,g,f,$,x,_=t=>t;class b extends n{constructor(){super("donation"),this.currency=null,this.amount=null,this.store=null,this.name=null,this.custom=null,this.amounts=null,this.frequency=null,this.frequencies=null,this.designation=null,this.designations=null,this.comment=null,this.anonymity=!1,this.anonymous=!1,this.image=null,this.code=null,this.url=null,this.cart="checkout",this.target="_top"}static get scopedElements(){return{"vaadin-text-area":customElements.get("vaadin-text-area"),"x-error-screen":c,"vaadin-button":customElements.get("vaadin-button"),"x-dropdown":a,"x-checkbox":r,"x-choice":s,"x-group":m,"x-i18n":o}}static get properties(){return t(t({},super.properties),{},{currency:{type:String},custom:{type:Array},amount:{type:Number},amounts:{type:Array},frequency:{type:String},frequencies:{type:Array},designation:{type:Array},designations:{type:Array},comment:{type:String},anonymity:{reflect:!0,type:Boolean},anonymous:{reflect:!0,type:Boolean},image:{type:String},store:{type:String},name:{type:String},code:{type:String},url:{type:String},cart:{type:String},target:{type:String},empty:{type:String}})}static get events(){return{change:h,submit:u}}submit(){this.dispatchEvent(new u)&&this.__form.submit()}render(){var t,s;if(!(this.currency&&this.amount&&this.store&&this.name))return e(d||(d=_` <x-error-screen data-testid="error" type="setup_needed" class="relative"></x-error-screen> `));const n=this.store.includes(".")?this.store:`${this.store}.foxycart.com`;return e(l||(l=_` <form target="${0}" class="sr-only" method="POST" action="https://${0}/cart" data-testid="form"> ${0} </form> <section> ${0} </section> <section> ${0} </section> <section> ${0} </section> <section> ${0} <div class="flex flex-wrap -m-s"> ${0} <div class="flex-1 p-s"> <vaadin-button class="w-full" theme="primary" data-testid="submit" @click="${0}"> <x-i18n .opts="${0}" lang="${0}" key="${0}" ns="${0}"> </x-i18n> </vaadin-button> </div> </div> </section> `),this.target,n,[...this.__data.entries()].map((([t,s])=>e(p||(p=_`<input type="hidden" name="${0}" value="${0}">`),t,s))),this.amounts&&this.amounts.length>0?e(y||(y=_` <x-group frame> <x-i18n ns="${0}" lang="${0}" key="amount" slot="header"></x-i18n> <x-choice ?custom="${0}" .getText="${0}" .items="${0}" .value="${0}" type="integer" lang="${0}" min="1" ns="${0}" data-testid="amount" @change="${0}"> </x-choice> </x-group> <slot name="amount" class="block my-m"></slot> `),this.ns,this.lang,!!(null===(t=this.custom)||void 0===t?void 0:t.includes("amount")),(t=>this.__translateAmount(parseInt(t,10))),this.amounts.map(String),this.amount.toString(),this.lang,this.ns,(t=>{const e=parseInt(t.detail);this.amount=isNaN(e)?1:e})):"",this.designations&&this.designations.length>0?e(g||(g=_` <x-dropdown .label="${0}" .items="${0}" .value="${0}" data-testid="designation" @change="${0}"> </x-dropdown> <slot name="designation" class="block my-m"></slot> `),this._t("designation").toString(),this.designations,Array.isArray(this.designation)?"${this.designation[0]}: ${this.designation[1]}":this.designation,(t=>{this.designation=t.detail})):"","string"==typeof this.comment?e(f||(f=_` <vaadin-text-area placeholder="${0}" value="${0}" label="${0}" class="w-full" data-testid="comment" @input="${0}"> </vaadin-text-area> <slot name="comment" class="block my-m"></slot> `),this._t("comment_placeholder").toString(),this.comment,this._t("comment_label").toString(),(t=>{t.stopPropagation(),this.comment=t.target.value})):"",this.anonymity?e($||($=_` <x-checkbox class="my-m" data-testid="anonymity" ?checked="${0}" @change="${0}"> ${0} </x-checkbox> `),this.anonymous,(t=>this.anonymous=t.detail),this._t("anonymous")):"",this.frequencies&&this.frequencies.length>0?e(x||(x=_` <div class="flex-1 p-s"> <x-dropdown .value="${0}" .items="${0}" .getText="${0}" data-testid="frequency" @change="${0}"> </x-dropdown> </div> `),this.frequency,this.frequencies,this.__translateFrequency.bind(this),(t=>{this.frequency=t.detail})):"",(()=>this.submit()),{amount:this.__translateAmount(this.amount),frequency:this.frequency?this.__translateFrequency(this.frequency):""},this.lang,this.frequency&&!(null===(s=this.frequencies)||void 0===s?void 0:s.length)?"donate_recurrently":"donate",this.ns)}updated(){this.dispatchEvent(new h(this.__data))}get __data(){const t=new FormData;return"string"==typeof this.designation&&t.set("Designation",this.designation.trim()),"number"==typeof this.amount&&"string"==typeof this.currency&&t.set("price",`${this.amount.toFixed(2)}${this.currency}`),this.frequency&&t.set("sub_frequency",this.frequency),"string"==typeof this.comment&&t.set("Comment",this.comment.trim()),"string"==typeof this.image&&t.set("image",this.image),"string"==typeof this.code&&t.set("code",this.code),"string"==typeof this.name&&t.set("name",this.name.trim()),"string"==typeof this.url&&t.set("url",this.url),"string"==typeof this.cart&&t.set("cart",this.cart),this.empty&&t.set("empty",this.empty),this.anonymous&&t.set("Anonymous","true"),t.set("quantity","1"),t}get __form(){return this.shadowRoot.querySelector("form")}__translateFrequency(t){if(!t||t.match(/^\s*$/))return this._t("frequency_once");if(".5m"===t)return this._t("frequency_0_5m");const{count:e,units:s}=i(t);return this._t("frequency",{units:this._t(s,{count:e}),count:e})}__translateAmount(t){return t.toLocaleString(this.lang,{minimumFractionDigits:0,currency:this.currency,style:"currency"})}}customElements.define("foxy-donation",b);export{b as Donation};
1
+ import{_ as t,h as e}from"./shared-63eaded9.js";import"./shared-0ced76a0.js";import{C as s}from"./shared-1f1734cb.js";import"./shared-bb824ab4.js";import{c as n}from"./shared-9a40309d.js";import{p as i}from"./shared-87ca7818.js";import{C as r}from"./shared-f1dc1c6c.js";import"./shared-07abcd7b.js";import{D as a,I as o}from"./shared-6ebe3825.js";import{E as c}from"./shared-74b9e1d1.js";import"./shared-ec861f31.js";import"./foxy-i18n.js";import{G as m}from"./shared-91e768be.js";import"./shared-df573cea.js";import"./shared-46ee137f.js";import"./shared-f0a83bd6.js";import"./shared-ff79f3f9.js";import"./shared-1761daef.js";import"./shared-b0f0e8b5.js";import"./shared-a46edf4b.js";import"./shared-4e709717.js";import"./shared-00563cb0.js";import"./shared-593f7e2c.js";import"./shared-6d45a07b.js";class h extends CustomEvent{constructor(t){super("change",{detail:t})}}class u extends CustomEvent{constructor(){super("submit",{cancelable:!0})}}let d,l,p,y,g,f,$,x,_=t=>t;class b extends n{constructor(){super("donation"),this.currency=null,this.amount=null,this.store=null,this.name=null,this.custom=null,this.amounts=null,this.frequency=null,this.frequencies=null,this.designation=null,this.designations=null,this.comment=null,this.anonymity=!1,this.anonymous=!1,this.image=null,this.code=null,this.url=null,this.cart="checkout",this.target="_top"}static get scopedElements(){return{"vaadin-text-area":customElements.get("vaadin-text-area"),"x-error-screen":c,"vaadin-button":customElements.get("vaadin-button"),"x-dropdown":a,"x-checkbox":r,"x-choice":s,"x-group":m,"x-i18n":o}}static get properties(){return t(t({},super.properties),{},{currency:{type:String},custom:{type:Array},amount:{type:Number},amounts:{type:Array},frequency:{type:String},frequencies:{type:Array},designation:{type:Array},designations:{type:Array},comment:{type:String},anonymity:{reflect:!0,type:Boolean},anonymous:{reflect:!0,type:Boolean},image:{type:String},store:{type:String},name:{type:String},code:{type:String},url:{type:String},cart:{type:String},target:{type:String},empty:{type:String}})}static get events(){return{change:h,submit:u}}submit(){this.dispatchEvent(new u)&&this.__form.submit()}render(){var t,s;if(!(this.currency&&this.amount&&this.store&&this.name))return e(d||(d=_` <x-error-screen data-testid="error" type="setup_needed" class="relative"></x-error-screen> `));const n=this.store.includes(".")?this.store:`${this.store}.foxycart.com`;return e(l||(l=_` <form target="${0}" class="sr-only" method="POST" action="https://${0}/cart" data-testid="form"> ${0} </form> <section> ${0} </section> <section> ${0} </section> <section> ${0} </section> <section> ${0} <div class="flex flex-wrap -m-s"> ${0} <div class="flex-1 p-s"> <vaadin-button class="w-full" theme="primary" data-testid="submit" @click="${0}"> <x-i18n .opts="${0}" lang="${0}" key="${0}" ns="${0}"> </x-i18n> </vaadin-button> </div> </div> </section> `),this.target,n,[...this.__data.entries()].map((([t,s])=>e(p||(p=_`<input type="hidden" name="${0}" value="${0}">`),t,s))),this.amounts&&this.amounts.length>0?e(y||(y=_` <x-group frame> <x-i18n ns="${0}" lang="${0}" key="amount" slot="header"></x-i18n> <x-choice ?custom="${0}" .getText="${0}" .items="${0}" .value="${0}" type="integer" lang="${0}" min="1" ns="${0}" data-testid="amount" @change="${0}"> </x-choice> </x-group> <slot name="amount" class="block my-m"></slot> `),this.ns,this.lang,!!(null===(t=this.custom)||void 0===t?void 0:t.includes("amount")),(t=>this.__translateAmount(parseInt(t,10))),this.amounts.map(String),this.amount.toString(),this.lang,this.ns,(t=>{const e=parseInt(t.detail);this.amount=isNaN(e)?1:e})):"",this.designations&&this.designations.length>0?e(g||(g=_` <x-dropdown .label="${0}" .items="${0}" .value="${0}" data-testid="designation" @change="${0}"> </x-dropdown> <slot name="designation" class="block my-m"></slot> `),this._t("designation").toString(),this.designations,Array.isArray(this.designation)?"${this.designation[0]}: ${this.designation[1]}":this.designation,(t=>{this.designation=t.detail})):"","string"==typeof this.comment?e(f||(f=_` <vaadin-text-area placeholder="${0}" value="${0}" label="${0}" class="w-full" data-testid="comment" @input="${0}"> </vaadin-text-area> <slot name="comment" class="block my-m"></slot> `),this._t("comment_placeholder").toString(),this.comment,this._t("comment_label").toString(),(t=>{t.stopPropagation(),this.comment=t.target.value})):"",this.anonymity?e($||($=_` <x-checkbox class="my-m" data-testid="anonymity" ?checked="${0}" @change="${0}"> ${0} </x-checkbox> `),this.anonymous,(t=>this.anonymous=t.detail),this._t("anonymous")):"",this.frequencies&&this.frequencies.length>0?e(x||(x=_` <div class="flex-1 p-s"> <x-dropdown .value="${0}" .items="${0}" .getText="${0}" data-testid="frequency" @change="${0}"> </x-dropdown> </div> `),this.frequency,this.frequencies,this.__translateFrequency.bind(this),(t=>{this.frequency=t.detail})):"",(()=>this.submit()),{amount:this.__translateAmount(this.amount),frequency:this.frequency?this.__translateFrequency(this.frequency):""},this.lang,this.frequency&&!(null===(s=this.frequencies)||void 0===s?void 0:s.length)?"donate_recurrently":"donate",this.ns)}updated(){this.dispatchEvent(new h(this.__data))}get __data(){const t=new FormData;return"string"==typeof this.designation&&t.set("Designation",this.designation.trim()),"number"==typeof this.amount&&"string"==typeof this.currency&&t.set("price",`${this.amount.toFixed(2)}${this.currency}`),this.frequency&&t.set("sub_frequency",this.frequency),"string"==typeof this.comment&&t.set("Comment",this.comment.trim()),"string"==typeof this.image&&t.set("image",this.image),"string"==typeof this.code&&t.set("code",this.code),"string"==typeof this.name&&t.set("name",this.name.trim()),"string"==typeof this.url&&t.set("url",this.url),"string"==typeof this.cart&&t.set("cart",this.cart),this.empty&&t.set("empty",this.empty),this.anonymous&&t.set("Anonymous","true"),t.set("quantity","1"),t}get __form(){return this.shadowRoot.querySelector("form")}__translateFrequency(t){if(!t||t.match(/^\s*$/))return this._t("frequency_once");if(".5m"===t)return this._t("frequency_0_5m");const{count:e,units:s}=i(t);return this._t("frequency",{units:this._t(s,{count:e}),count:e})}__translateAmount(t){return t.toLocaleString(this.lang,{minimumFractionDigits:0,currency:this.currency,style:"currency"})}}customElements.define("foxy-donation",b);export{b as Donation};
@@ -1 +1 @@
1
- import"./shared-bb824ab4.js";import{C as e,a as t}from"./shared-d8ffb279.js";import"./shared-0ced76a0.js";import"./shared-e5cbf291.js";import"./shared-9221e6b2.js";import"./foxy-spinner.js";import"./foxy-i18n.js";import{_ as a,j as i,h as s}from"./shared-63eaded9.js";import"./shared-46ee137f.js";import"./shared-df573cea.js";import"./shared-f0a83bd6.js";import{S as r,T as n,a as d}from"./shared-9a40309d.js";import{c as o}from"./shared-4e709717.js";import"./shared-07abcd7b.js";import"./shared-b5147166.js";import"./shared-ec861f31.js";import{G as l}from"./shared-91e768be.js";import{P as c}from"./shared-8a7bee0d.js";import{C as h}from"./shared-593f7e2c.js";import{N as m}from"./shared-44cfc617.js";import{i as p}from"./shared-6d45a07b.js";import"./shared-ff79f3f9.js";import"./shared-1761daef.js";import"./shared-87ca7818.js";import"./shared-b0f0e8b5.js";import"./shared-a46edf4b.js";import"./shared-60126eee.js";import"./shared-00563cb0.js";import"./shared-7684cb05.js";let f,u,$,v,y,b,_,x,g=e=>e;const j=r(n(h(d(m,"email-template-form"))));class S extends j{constructor(){super(...arguments),this.templates={},this.__cacheState="idle",this.__contentChoice="default"}static get properties(){return a(a({},super.properties),{},{__cacheState:{attribute:!1},__contentChoice:{attribute:!1}})}static get styles(){return[...super.styles,i(f||(f=g`#cached-content::part(input-field){max-height:15em}`))]}static get scopedElements(){return{"foxy-internal-confirm-dialog":customElements.get("foxy-internal-confirm-dialog"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"foxy-spinner":customElements.get("foxy-spinner"),"foxy-i18n":customElements.get("foxy-i18n"),"vaadin-text-field":customElements.get("vaadin-text-field"),"vaadin-text-area":customElements.get("vaadin-text-area"),"vaadin-button":customElements.get("vaadin-button"),"x-property-table":c,"x-choice":e,"x-group":l}}render(){var e,t;const{hiddenSelector:a,href:i,lang:r,ns:n}=this,d=i?"delete":"create",l=this.in("busy"),c=this.in("fail");return s(u||(u=g` <div class="space-y-m"> ${0} ${0} ${0} ${0} <div data-testid="spinner" class="${0}"> <foxy-spinner layout="vertical" class="m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l" state="${0}" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),a.matches("description",!0)?"":this.__renderDescription(),a.matches("content",!0)?"":this.__renderContent(),a.matches("timestamps",!0)||!i?"":this.__renderTimestamps(),a.matches(d)?"":this.__renderAction(d),o({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":!l&&!c}),c?"error":l?"busy":"empty",r,n,null!==(t=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"")}__renderDescription(){var e,t;const a="description";return s($||($=g` <div> ${0} <vaadin-text-field data-testid="${0}" class="w-full mb-s" label="${0}" ?disabled="${0}" ?readonly="${0}" .value="${0}" @keydown="${0}" @input="${0}"> </vaadin-text-field> ${0} </div> `),this.renderTemplateOrSlot(`${a}:before`),a,this.t(a),!this.in("idle")||this.disabledSelector.matches(a),this.readonlySelector.matches(a),null!==(t=null===(e=this.form)||void 0===e?void 0:e.description)&&void 0!==t?t:"",(e=>"Enter"===e.key&&this.submit()),(e=>{this.edit({description:e.currentTarget.value})}),this.renderTemplateOrSlot(`${a}:after`))}__renderContent(){return s(v||(v=g` <div data-testid="content"> ${0} <div class="space-y-l"> ${0} ${0} </div> ${0} </div> `),this.renderTemplateOrSlot("content:before"),this.__renderContentVariant("content_text_url","content_text","text_template"),this.__renderContentVariant("content_html_url","content_html","html_template"),this.renderTemplateOrSlot("content:after"))}__renderContentVariant(e,a,i){var r;const n=!this.in("idle")||this.disabledSelector.matches("content",!0),d=this.readonlySelector.matches("content",!0),l=this.form[e]?"url":this.form[a]?"clipboard":this.__contentChoice;return s(y||(y=g` <x-group frame> <foxy-i18n class="${0}" lang="${0}" slot="header" key="${0}" ns="${0}"> </foxy-i18n> <x-choice data-testid="${0}-type" .value="${0}" .items="${0}" ?readonly="${0}" ?disabled="${0}" @change="${0}"> ${0} <div slot="url" ?hidden="${0}"> <div class="flex items-center mt-0 mb-m"> <vaadin-text-field data-testid="${0}-url" value="${0}" class="mr-s flex-grow" ?readonly="${0}" ?disabled="${0}" @keydown="${0}" @input="${0}"> </vaadin-text-field> <vaadin-button data-testid="${0}-cache" class="relative" ?disabled="${0}" ?hidden="${0}" @click="${0}"> <foxy-i18n class="${0}" lang="${0}" key="cache" ns="${0}"> </foxy-i18n> <div class="${0}"> <foxy-spinner layout="no-label" class="m-auto" state="${0}" lang="${0}" ns="${0}"> </foxy-spinner> </div> </vaadin-button> </div> </div> <div slot="clipboard" ?hidden="${0}"> <vaadin-text-area data-testid="${0}-clipboard" id="cached-content" class="w-full mb-m" ?readonly="${0}" ?disabled="${0}" .value="${0}" @input="${0}"> </vaadin-text-area> </div> </x-choice> </x-group> `),o({"transition-colors":!0,"text-disabled":n}),this.lang,i,this.ns,a.replace("_","-"),l,["default","url","clipboard"],d,n,(i=>{i instanceof t&&(this.edit({[a]:"",[e]:""}),this.__contentChoice=i.detail)}),["default","url","clipboard"].map((e=>s(b||(b=g` <div slot="${0}-label" class="py-s leading-s"> <foxy-i18n class="block" lang="${0}" key="template_${0}" ns="${0}"> </foxy-i18n> <foxy-i18n class="block text-s opacity-70" lang="${0}" key="template_${0}_explainer" ns="${0}"> </foxy-i18n> </div> `),e,this.lang,e,this.ns,this.lang,e,this.ns))),"url"!==l,a.replace("_","-"),p(this.form[e]),d,n,(e=>"Enter"===e.key&&this.submit()),(t=>{const i=t.currentTarget.value;this.edit({[a]:"",[e]:i})}),a.replace("_","-"),n||"busy"===this.__cacheState,d||this.form[e]!==(null===(r=this.data)||void 0===r?void 0:r[e]),this.__cache,o({"relative transition-opacity":!0,"opacity-0":"idle"!==this.__cacheState}),this.lang,this.ns,o({"absolute inset-0 flex transition-opacity":!0,"opacity-0":"idle"===this.__cacheState}),"fail"===this.__cacheState?"error":"busy",this.lang,this.ns,"clipboard"!==l,a.replace("_","-"),d,n,this.form[a],(t=>{const i=t.currentTarget.value;this.edit({[a]:i,[e]:""})}))}__renderTimestamps(){const e="timestamps";return s(_||(_=g` <div> ${0} <x-property-table data-testid="timestamps" .items="${0}"> </x-property-table> ${0} </div> `),this.renderTemplateOrSlot(`${e}:before`),["date_modified","date_created"].map((e=>{var t;return{name:this.t(e),value:(null===(t=this.data)||void 0===t?void 0:t[e])?this.t("date",{value:new Date(this.data[e])}):""}})),this.renderTemplateOrSlot(`${e}:after`))}__renderAction(e){const{disabledSelector:t,href:a,lang:i,ns:r}=this,n=this.in({idle:{template:{dirty:"valid"}}}),d=this.in({idle:{snapshot:{dirty:"valid"}}}),o=!this.in("idle")||t.matches(e,!0),l=n||d;return s(x||(x=g` <div> ${0} <foxy-internal-confirm-dialog message="delete_prompt" confirm="delete" cancel="cancel" header="delete" theme="primary error" lang="${0}" ns="${0}" id="confirm" data-testid="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> <vaadin-button class="w-full" theme="${0}" data-testid="${0}" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" key="${0}" lang="${0}"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot(`${e}:before`),i,r,(e=>{e.detail.cancelled||this.delete()}),this.in("idle")?"primary "+(a?"error":"success"):"",e,this.in({idle:"template"})&&!l||o,(t=>{if("delete"===e){this.renderRoot.querySelector("#confirm").show(t.currentTarget)}else this.submit()}),r,e,i,this.renderTemplateOrSlot(`${e}:after`))}async __cache(){var e,t;this.__cacheState="busy";try{const a=null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:cache"].href)&&void 0!==t?t:"",i=await new S.API(this).fetch(a,{method:"POST"});this.__cacheState=i.ok?"idle":"fail"}catch(e){this.__cacheState="fail"}}}customElements.define("foxy-email-template-form",S);export{S as EmailTemplateForm};
1
+ import"./shared-bb824ab4.js";import{C as e,a as t}from"./shared-1f1734cb.js";import"./shared-0ced76a0.js";import"./shared-b1fc5dc3.js";import"./shared-9221e6b2.js";import"./foxy-spinner.js";import"./foxy-i18n.js";import{_ as a,j as i,h as s}from"./shared-63eaded9.js";import"./shared-46ee137f.js";import"./shared-df573cea.js";import"./shared-f0a83bd6.js";import{S as r,T as n,a as d}from"./shared-9a40309d.js";import{c as o}from"./shared-4e709717.js";import"./shared-07abcd7b.js";import"./shared-6ebe3825.js";import"./shared-ec861f31.js";import{G as l}from"./shared-91e768be.js";import{P as c}from"./shared-8a7bee0d.js";import{C as h}from"./shared-593f7e2c.js";import{N as m}from"./shared-44cfc617.js";import{i as p}from"./shared-6d45a07b.js";import"./shared-ff79f3f9.js";import"./shared-1761daef.js";import"./shared-87ca7818.js";import"./shared-b0f0e8b5.js";import"./shared-a46edf4b.js";import"./shared-60126eee.js";import"./shared-00563cb0.js";import"./shared-7684cb05.js";let f,u,$,v,y,b,_,x,g=e=>e;const j=r(n(h(d(m,"email-template-form"))));class S extends j{constructor(){super(...arguments),this.templates={},this.__cacheState="idle",this.__contentChoice="default"}static get properties(){return a(a({},super.properties),{},{__cacheState:{attribute:!1},__contentChoice:{attribute:!1}})}static get styles(){return[...super.styles,i(f||(f=g`#cached-content::part(input-field){max-height:15em}`))]}static get scopedElements(){return{"foxy-internal-confirm-dialog":customElements.get("foxy-internal-confirm-dialog"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"foxy-spinner":customElements.get("foxy-spinner"),"foxy-i18n":customElements.get("foxy-i18n"),"vaadin-text-field":customElements.get("vaadin-text-field"),"vaadin-text-area":customElements.get("vaadin-text-area"),"vaadin-button":customElements.get("vaadin-button"),"x-property-table":c,"x-choice":e,"x-group":l}}render(){var e,t;const{hiddenSelector:a,href:i,lang:r,ns:n}=this,d=i?"delete":"create",l=this.in("busy"),c=this.in("fail");return s(u||(u=g` <div class="space-y-m"> ${0} ${0} ${0} ${0} <div data-testid="spinner" class="${0}"> <foxy-spinner layout="vertical" class="m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l" state="${0}" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),a.matches("description",!0)?"":this.__renderDescription(),a.matches("content",!0)?"":this.__renderContent(),a.matches("timestamps",!0)||!i?"":this.__renderTimestamps(),a.matches(d)?"":this.__renderAction(d),o({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":!l&&!c}),c?"error":l?"busy":"empty",r,n,null!==(t=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"")}__renderDescription(){var e,t;const a="description";return s($||($=g` <div> ${0} <vaadin-text-field data-testid="${0}" class="w-full mb-s" label="${0}" ?disabled="${0}" ?readonly="${0}" .value="${0}" @keydown="${0}" @input="${0}"> </vaadin-text-field> ${0} </div> `),this.renderTemplateOrSlot(`${a}:before`),a,this.t(a),!this.in("idle")||this.disabledSelector.matches(a),this.readonlySelector.matches(a),null!==(t=null===(e=this.form)||void 0===e?void 0:e.description)&&void 0!==t?t:"",(e=>"Enter"===e.key&&this.submit()),(e=>{this.edit({description:e.currentTarget.value})}),this.renderTemplateOrSlot(`${a}:after`))}__renderContent(){return s(v||(v=g` <div data-testid="content"> ${0} <div class="space-y-l"> ${0} ${0} </div> ${0} </div> `),this.renderTemplateOrSlot("content:before"),this.__renderContentVariant("content_text_url","content_text","text_template"),this.__renderContentVariant("content_html_url","content_html","html_template"),this.renderTemplateOrSlot("content:after"))}__renderContentVariant(e,a,i){var r;const n=!this.in("idle")||this.disabledSelector.matches("content",!0),d=this.readonlySelector.matches("content",!0),l=this.form[e]?"url":this.form[a]?"clipboard":this.__contentChoice;return s(y||(y=g` <x-group frame> <foxy-i18n class="${0}" lang="${0}" slot="header" key="${0}" ns="${0}"> </foxy-i18n> <x-choice data-testid="${0}-type" .value="${0}" .items="${0}" ?readonly="${0}" ?disabled="${0}" @change="${0}"> ${0} <div slot="url" ?hidden="${0}"> <div class="flex items-center mt-0 mb-m"> <vaadin-text-field data-testid="${0}-url" value="${0}" class="mr-s flex-grow" ?readonly="${0}" ?disabled="${0}" @keydown="${0}" @input="${0}"> </vaadin-text-field> <vaadin-button data-testid="${0}-cache" class="relative" ?disabled="${0}" ?hidden="${0}" @click="${0}"> <foxy-i18n class="${0}" lang="${0}" key="cache" ns="${0}"> </foxy-i18n> <div class="${0}"> <foxy-spinner layout="no-label" class="m-auto" state="${0}" lang="${0}" ns="${0}"> </foxy-spinner> </div> </vaadin-button> </div> </div> <div slot="clipboard" ?hidden="${0}"> <vaadin-text-area data-testid="${0}-clipboard" id="cached-content" class="w-full mb-m" ?readonly="${0}" ?disabled="${0}" .value="${0}" @input="${0}"> </vaadin-text-area> </div> </x-choice> </x-group> `),o({"transition-colors":!0,"text-disabled":n}),this.lang,i,this.ns,a.replace("_","-"),l,["default","url","clipboard"],d,n,(i=>{i instanceof t&&(this.edit({[a]:"",[e]:""}),this.__contentChoice=i.detail)}),["default","url","clipboard"].map((e=>s(b||(b=g` <div slot="${0}-label" class="py-s leading-s"> <foxy-i18n class="block" lang="${0}" key="template_${0}" ns="${0}"> </foxy-i18n> <foxy-i18n class="block text-s opacity-70" lang="${0}" key="template_${0}_explainer" ns="${0}"> </foxy-i18n> </div> `),e,this.lang,e,this.ns,this.lang,e,this.ns))),"url"!==l,a.replace("_","-"),p(this.form[e]),d,n,(e=>"Enter"===e.key&&this.submit()),(t=>{const i=t.currentTarget.value;this.edit({[a]:"",[e]:i})}),a.replace("_","-"),n||"busy"===this.__cacheState,d||this.form[e]!==(null===(r=this.data)||void 0===r?void 0:r[e]),this.__cache,o({"relative transition-opacity":!0,"opacity-0":"idle"!==this.__cacheState}),this.lang,this.ns,o({"absolute inset-0 flex transition-opacity":!0,"opacity-0":"idle"===this.__cacheState}),"fail"===this.__cacheState?"error":"busy",this.lang,this.ns,"clipboard"!==l,a.replace("_","-"),d,n,this.form[a],(t=>{const i=t.currentTarget.value;this.edit({[a]:i,[e]:""})}))}__renderTimestamps(){const e="timestamps";return s(_||(_=g` <div> ${0} <x-property-table data-testid="timestamps" .items="${0}"> </x-property-table> ${0} </div> `),this.renderTemplateOrSlot(`${e}:before`),["date_modified","date_created"].map((e=>{var t;return{name:this.t(e),value:(null===(t=this.data)||void 0===t?void 0:t[e])?this.t("date",{value:new Date(this.data[e])}):""}})),this.renderTemplateOrSlot(`${e}:after`))}__renderAction(e){const{disabledSelector:t,href:a,lang:i,ns:r}=this,n=this.in({idle:{template:{dirty:"valid"}}}),d=this.in({idle:{snapshot:{dirty:"valid"}}}),o=!this.in("idle")||t.matches(e,!0),l=n||d;return s(x||(x=g` <div> ${0} <foxy-internal-confirm-dialog message="delete_prompt" confirm="delete" cancel="cancel" header="delete" theme="primary error" lang="${0}" ns="${0}" id="confirm" data-testid="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> <vaadin-button class="w-full" theme="${0}" data-testid="${0}" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" key="${0}" lang="${0}"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot(`${e}:before`),i,r,(e=>{e.detail.cancelled||this.delete()}),this.in("idle")?"primary "+(a?"error":"success"):"",e,this.in({idle:"template"})&&!l||o,(t=>{if("delete"===e){this.renderRoot.querySelector("#confirm").show(t.currentTarget)}else this.submit()}),r,e,i,this.renderTemplateOrSlot(`${e}:after`))}async __cache(){var e,t;this.__cacheState="busy";try{const a=null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:cache"].href)&&void 0!==t?t:"",i=await new S.API(this).fetch(a,{method:"POST"});this.__cacheState=i.ok?"idle":"fail"}catch(e){this.__cacheState="fail"}}}customElements.define("foxy-email-template-form",S);export{S as EmailTemplateForm};
@@ -1 +1 @@
1
- import"./foxy-i18n.js";import"./shared-e5cbf291.js";import{_ as e,h as t}from"./shared-63eaded9.js";import{A as r}from"./shared-00563cb0.js";import{D as o}from"./shared-07abcd7b.js";import{F as n}from"./shared-1761daef.js";import{U as s}from"./shared-7684cb05.js";import"./shared-9a40309d.js";import"./shared-0ced76a0.js";import"./shared-df573cea.js";import"./shared-ff79f3f9.js";import"./shared-593f7e2c.js";import"./shared-6d45a07b.js";import"./shared-4e709717.js";let i,a,d=e=>e;class l extends o{constructor(){super(...arguments),this.related=[],this.parent="",this.group="",this.href="",this.__form=null,this.__renderForm=null,this.__handleFetch=e=>{e instanceof n&&(e.stopImmediatePropagation(),e.preventDefault(),e.respondWith(new r(this).fetch(e.request).then((t=>{const r=e.request.url===this.href&&"DELETE"===e.request.method,o=e.request.url===this.parent&&"POST"===e.request.method;return t.ok&&(r||o)&&(this.open=!1),t}))))},this.__handleUpdate=e=>{if(!(e instanceof s))return;const t=e.target;this.closable=!t.in("busy"),this.editable=t.in({idle:{template:{clean:"valid"}}})||t.in({idle:{template:{dirty:"valid"}}})||t.in({idle:{snapshot:{dirty:"valid"}}})}}static get properties(){return e(e({},super.properties),{},{href:{type:String},form:{type:String,noAccessor:!0},group:{type:String},parent:{type:String},related:{type:Array}})}get form(){return this.__form}set form(e){this.__form=e,this.__renderForm="string"==typeof e?new Function("options",`return options.html\`\n <${e}\n id="form"\n ns="\${options.dialog.ns} \${customElements.get('${e}')?.defaultNS ?? ''}"\n href=\${options.dialog.href}\n lang=\${options.dialog.lang}\n group=\${options.dialog.group}\n parent=\${options.dialog.parent}\n disabledcontrols=\${options.dialog.disabledControls.toString()}\n readonlycontrols=\${options.dialog.readonlyControls.toString()}\n hiddencontrols=\${options.dialog.hiddenControls.toString()}\n ?disabled=\${options.dialog.disabled}\n ?readonly=\${options.dialog.readonly}\n ?hidden=\${options.dialog.hidden}\n .templates=\${options.dialog.templates}\n .related=\${options.dialog.related}\n @fetch=\${options.handleFetch}\n @update=\${options.handleUpdate}\n >\n </${e}>\``):e,this.requestUpdate()}render(){return t(i||(i=d` <foxy-internal-confirm-dialog message="undo_message" confirm="undo_confirm" cancel="undo_cancel" header="undo_header" theme="error" lang="${0}" ns="${0}" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> ${0} `),this.lang,this.ns,(e=>!e.detail.cancelled&&super.hide(!0)),super.render((()=>{var e;return t(a||(a=d`${0}`),null===(e=this.__renderForm)||void 0===e?void 0:e.call(this,{handleUpdate:this.__handleUpdate,handleFetch:this.__handleFetch,dialog:this,html:t}))})))}async hide(e=!1){if(!e)return super.hide(e);this.renderRoot.querySelector("#confirm").show()}async save(){this.renderRoot.querySelector("#form").submit()}}customElements.define("foxy-form-dialog",l);export{l as FormDialog};
1
+ import"./foxy-i18n.js";import"./shared-b1fc5dc3.js";import{_ as e,h as t}from"./shared-63eaded9.js";import{A as r}from"./shared-00563cb0.js";import{D as o}from"./shared-07abcd7b.js";import{F as n}from"./shared-1761daef.js";import{U as s}from"./shared-7684cb05.js";import"./shared-9a40309d.js";import"./shared-0ced76a0.js";import"./shared-df573cea.js";import"./shared-ff79f3f9.js";import"./shared-593f7e2c.js";import"./shared-6d45a07b.js";import"./shared-4e709717.js";let i,d,a=e=>e;class l extends o{constructor(){super(...arguments),this.related=[],this.parent="",this.group="",this.href="",this.__form=null,this.__renderForm=null,this.__handleFetch=e=>{e instanceof n&&(e.stopImmediatePropagation(),e.preventDefault(),e.respondWith(new r(this).fetch(e.request).then((t=>{const r=e.request.url===this.href&&"DELETE"===e.request.method,o=e.request.url===this.parent&&"POST"===e.request.method;return t.ok&&(r||o)&&(this.open=!1),t}))))},this.__handleUpdate=e=>{if(!(e instanceof s))return;const t=e.target;this.closable=!t.in("busy"),this.editable=t.in({idle:{template:{clean:"valid"}}})||t.in({idle:{template:{dirty:"valid"}}})||t.in({idle:{snapshot:{dirty:"valid"}}})}}static get properties(){return e(e({},super.properties),{},{href:{type:String},form:{type:String,noAccessor:!0},group:{type:String},parent:{type:String},related:{type:Array}})}get form(){return this.__form}set form(e){this.__form=e,this.__renderForm="string"==typeof e?new Function("options",`return options.html\`\n <${e}\n id="form"\n ns="\${options.dialog.ns} \${customElements.get('${e}')?.defaultNS ?? ''}"\n href=\${options.dialog.href}\n lang=\${options.dialog.lang}\n group=\${options.dialog.group}\n parent=\${options.dialog.parent}\n disabledcontrols=\${options.dialog.disabledControls.toString()}\n readonlycontrols=\${options.dialog.readonlyControls.toString()}\n hiddencontrols=\${options.dialog.hiddenControls.toString()}\n ?disabled=\${options.dialog.disabled}\n ?readonly=\${options.dialog.readonly}\n ?hidden=\${options.dialog.hidden}\n .templates=\${options.dialog.templates}\n .related=\${options.dialog.related}\n @fetch=\${options.handleFetch}\n @update=\${options.handleUpdate}\n >\n </${e}>\``):e,this.requestUpdate()}render(){return t(i||(i=a` <foxy-internal-confirm-dialog message="undo_message" confirm="undo_confirm" cancel="undo_cancel" header="undo_header" theme="error" lang="${0}" ns="${0}" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> ${0} `),this.lang,this.ns,(e=>!e.detail.cancelled&&super.hide(!0)),super.render((()=>{var e;return t(d||(d=a`${0}`),null===(e=this.__renderForm)||void 0===e?void 0:e.call(this,{handleUpdate:this.__handleUpdate,handleFetch:this.__handleFetch,dialog:this,html:t}))})))}async hide(e=!1){if(!e)return super.hide(e);this.renderRoot.querySelector("#confirm").show()}async save(){this.renderRoot.querySelector("#form").submit()}}customElements.define("foxy-form-dialog",l);export{l as FormDialog};
@@ -1 +1 @@
1
- import{L as e,_ as t,h as r}from"./shared-63eaded9.js";import{i as n,a as s}from"./shared-9a40309d.js";import{F as a,A as o}from"./shared-1761daef.js";const i={type:"backend",init:()=>{},read:(e,t,r)=>{const n=async e=>{const t=e.ok?null:new Error(await e.text()),n=!!e.ok&&await e.json();r(t,n)},s=e=>{const t=e instanceof Error?e:new Error(String(e));r(t,!1)},i=new a("fetch",{cancelable:!0,composed:!0,bubbles:!0,request:new o.WHATWGRequest(`foxy://i18n/${t}/${e}`),resolve:n,reject:s});dispatchEvent(i),i.defaultPrevented||fetch(i.request).then(n).catch(s)},create:()=>{throw new Error("foxy-i18n does not support resource creation")}},c={percent:(e,t,r)=>{let n=null;try{"number"==typeof e&&(n=e.toLocaleString(r,{style:"percent"}))}catch(e){console.warn(`i18next formatter error: ${e.message}`)}return n||String(e)},price:(e,t,r,n)=>{var s;try{const[t,a]=e.split(" ");return parseFloat(t).toLocaleString(r,{maximumFractionDigits:2,minimumFractionDigits:2,currencyDisplay:null!==(s=null==n?void 0:n.currencyDisplay)&&void 0!==s?s:"symbol",style:"currency",currency:a})}catch(t){return e}},date:(e,t,r)=>{const n=new Date(e);return n.toLocaleDateString(r,{month:"long",year:(new Date).getFullYear()===n.getFullYear()?void 0:"numeric",day:"numeric"})},time:(e,t,r)=>new Date(e).toLocaleTimeString(r,{hour:"numeric",minute:"numeric"})};let l,u=e=>e;class d extends(s(e,"")){constructor(){super(...arguments),this.options={},this.key=""}static onTranslationChange(e){const t=["initialized","loaded"],r=["removed","added"];return t.forEach((t=>d.i18next.on(t,e))),r.forEach((t=>d.i18next.store.on(t,e))),()=>{t.forEach((t=>d.i18next.off(t,e))),r.forEach((t=>d.i18next.store.off(t,e)))}}static onResourceFetch(e){const t=t=>{if(t instanceof a&&t.request.url.startsWith("foxy://i18n/")){const[r,n]=t.request.url.split("/").reverse();t.respondWith(e(n,r))}};return addEventListener("fetch",t),()=>removeEventListener("fetch",t)}static setGateways({values:e}){for(const t in e)this.i18next.addResource("en","gateways",`gateways.${t}`,e[t].name)}static get properties(){return t(t({},super.properties),{},{options:{type:Object},key:{type:String}})}connectedCallback(){super.connectedCallback(),this.__unsubscribe=d.onTranslationChange((()=>this.requestUpdate()))}render(){return r(l||(l=u`<span>${0}</span>`),this.t(this.key,t(t({},this.options),{},{lng:this.lang})))}disconnectedCallback(){var e;super.disconnectedCallback(),null===(e=this.__unsubscribe)||void 0===e||e.call(this)}}d.FetchEvent=a,d.i18next=n.createInstance().use(i),d.i18next.init({interpolation:{format:(e,t="",r="en",n={})=>t.split(" ").filter((e=>!!e.trim())).reduce(((e,t)=>{var s,a;return null!==(a=null===(s=c[t])||void 0===s?void 0:s.call(c,e,t,r,n))&&void 0!==a?a:e}),e)},fallbackLng:"en",fallbackNS:"shared",defaultNS:"shared",ns:["shared"]}),customElements.define("foxy-i18n",d);export{d as I18n};
1
+ import{L as e,_ as t,h as r}from"./shared-63eaded9.js";import{i as n,a as s}from"./shared-9a40309d.js";import{F as a,A as o}from"./shared-1761daef.js";const i={type:"backend",init:()=>{},read:(e,t,r)=>{const n=async e=>{const t=e.ok?null:new Error(await e.text()),n=!!e.ok&&await e.json();r(t,n)},s=e=>{const t=e instanceof Error?e:new Error(String(e));r(t,!1)},i=new a("fetch",{cancelable:!0,composed:!0,bubbles:!0,request:new o.WHATWGRequest(`foxy://i18n/${t}/${e}`),resolve:n,reject:s});dispatchEvent(i),i.defaultPrevented||fetch(i.request).then(n).catch(s)},create:()=>{throw new Error("foxy-i18n does not support resource creation")}},c={percent:(e,t,r)=>{let n=null;try{"number"==typeof e&&(n=e.toLocaleString(r,{style:"percent"}))}catch(e){console.warn(`i18next formatter error: ${e.message}`)}return n||String(e)},price:(e,t,r,n)=>{var s;try{const[t,a]=e.split(" ");return parseFloat(t).toLocaleString(r,{maximumFractionDigits:2,minimumFractionDigits:2,currencyDisplay:null!==(s=null==n?void 0:n.currencyDisplay)&&void 0!==s?s:"symbol",style:"currency",currency:a})}catch(t){return e}},date:(e,t,r)=>{const n=new Date(e);return n.toLocaleDateString(r,{month:"long",year:(new Date).getFullYear()===n.getFullYear()?void 0:"numeric",day:"numeric"})},time:(e,t,r)=>new Date(e).toLocaleTimeString(r,{hour:"numeric",minute:"numeric"})};let l,u=e=>e;class d extends(s(e,"")){constructor(){super(...arguments),this.options={},this.key=""}static onTranslationChange(e){const t=["initialized","loaded"],r=["removed","added"];return t.forEach((t=>d.i18next.on(t,e))),r.forEach((t=>d.i18next.store.on(t,e))),()=>{t.forEach((t=>d.i18next.off(t,e))),r.forEach((t=>d.i18next.store.off(t,e)))}}static onResourceFetch(e){const t=t=>{if(t instanceof a&&t.request.url.startsWith("foxy://i18n/")){const[r,n]=t.request.url.split("/").reverse();t.respondWith(e(n,r))}};return addEventListener("fetch",t),()=>removeEventListener("fetch",t)}static setGateways({values:e}){for(const t in e)this.i18next.addResource("en","gateways",`gateways.${t}`,e[t].name)}static get properties(){return t(t({},super.properties),{},{options:{type:Object},key:{type:String}})}connectedCallback(){super.connectedCallback(),this.__unsubscribe=d.onTranslationChange((()=>this.requestUpdate()))}render(){return r(l||(l=u`<span>${0}</span>`),this.t(this.key,t(t({},this.options),{},{lng:this.lang})))}disconnectedCallback(){var e;super.disconnectedCallback(),null===(e=this.__unsubscribe)||void 0===e||e.call(this)}}d.FetchEvent=a,d.i18next=n.createInstance().use(i),d.i18next.init({interpolation:{format:(e,t="",r="en",n={})=>t.split(" ").filter((e=>!!e.trim())).reduce(((e,t)=>{var s,a;return null!==(a=null===(s=c[t])||void 0===s?void 0:s.call(c,e,t,r,n))&&void 0!==a?a:e}),e),escapeValue:!1},fallbackLng:"en",fallbackNS:"shared",defaultNS:"shared",ns:["shared"]}),customElements.define("foxy-i18n",d);export{d as I18n};
@@ -1 +1 @@
1
- export{a as Item,I as ItemsForm}from"./shared-35dbd2c5.js";import"./shared-63eaded9.js";import"./shared-0ced76a0.js";import"./shared-df573cea.js";import"./shared-ff79f3f9.js";import"./shared-87ca7818.js";import"./shared-46ee137f.js";import"./shared-f0a83bd6.js";import"./shared-9a40309d.js";import"./shared-d8ffb279.js";import"./shared-bb824ab4.js";import"./shared-ec861f31.js";import"./foxy-i18n.js";import"./shared-1761daef.js";import"./shared-b0f0e8b5.js";import"./shared-a46edf4b.js";import"./shared-07abcd7b.js";import"./shared-00563cb0.js";import"./shared-593f7e2c.js";import"./shared-6d45a07b.js";import"./shared-4e709717.js";import"./shared-b5147166.js";import"./shared-5c8b531d.js";import"./shared-60126eee.js";
1
+ export{a as Item,I as ItemsForm}from"./shared-9c099da6.js";import"./shared-63eaded9.js";import"./shared-0ced76a0.js";import"./shared-df573cea.js";import"./shared-ff79f3f9.js";import"./shared-87ca7818.js";import"./shared-46ee137f.js";import"./shared-f0a83bd6.js";import"./shared-9a40309d.js";import"./shared-1f1734cb.js";import"./shared-bb824ab4.js";import"./shared-ec861f31.js";import"./foxy-i18n.js";import"./shared-1761daef.js";import"./shared-b0f0e8b5.js";import"./shared-a46edf4b.js";import"./shared-07abcd7b.js";import"./shared-00563cb0.js";import"./shared-593f7e2c.js";import"./shared-6d45a07b.js";import"./shared-4e709717.js";import"./shared-6ebe3825.js";import"./shared-74b9e1d1.js";import"./shared-60126eee.js";
@@ -1 +1 @@
1
- import"./shared-46ee137f.js";import"./shared-60126eee.js";import"./shared-0ced76a0.js";import"./shared-e5cbf291.js";import"./shared-9221e6b2.js";import"./foxy-spinner.js";import"./foxy-i18n.js";import{l as e,u as t}from"./shared-218ba06e.js";import{x as s,h as i,j as a}from"./shared-63eaded9.js";import{B as r}from"./shared-1761daef.js";import{C as n}from"./shared-593f7e2c.js";import"./foxy-nucleon-element.js";import{T as o,a as d}from"./shared-9a40309d.js";import{c as l}from"./shared-4e709717.js";import{N as c}from"./shared-44cfc617.js";import"./shared-ff79f3f9.js";import"./shared-df573cea.js";import"./shared-07abcd7b.js";import"./shared-00563cb0.js";import"./shared-6d45a07b.js";import"./shared-7684cb05.js";import"./shared-a46edf4b.js";const m=s("\n repeating-radial-gradient(\n circle at -100% 500%,\n rgba(255, 255, 255, 0),\n rgba(255, 255, 255, 0.05) 4px\n )\n"),h=s(Object.entries({unknown:"#797c85",amex:"#2557d6",diners:"#0079be",discover:"#4d4d4d",jcb:"#0e4c96",maestro:"#181818",mastercard:"#16366f",unionpay:"#0dadb5",visa:"#0e4595"}).map((([e,t])=>`.bg-${e} { background: ${t} ${m} }`)).join(" "));let p,f,u,b,v,y,_,g=e=>e;const x=o(n(d(c,"payment-method-card")));class j extends x{constructor(){super(...arguments),this.templates={},this.__renderActionsDelete=()=>i(p||(p=g` <div class="flex"> ${0} <vaadin-button class="px-xs rounded" theme="icon" style="--lumo-primary-text-color:#fff;--lumo-primary-color-50pct:rgba(255, 255, 255, 0.5);--lumo-contrast-5pct:rgba(255, 255, 255, 0.05)" aria-label="${0}" data-testid="actions:delete" ?disabled="${0}" @click="${0}"> <iron-icon icon="icons:delete"></iron-icon> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("actions:delete:before"),this.t("delete").toString(),this.disabledSelector.matches("actions:delete",!0),this.__handleDelete,this.renderTemplateOrSlot("actions:delete:after")),this.__renderActions=()=>i(f||(f=g` <div class="flex" data-testid="actions"> ${0} ${0} ${0} </div> `),this.renderTemplateOrSlot("actions:before"),this.hiddenSelector.matches("actions:delete",!0)?"":this.__renderActionsDelete(),this.renderTemplateOrSlot("actions:after"))}static get styles(){return[super.styles,h,a(u||(u=g`.ratio-card{padding-top:63%;position:relative;height:0}.ratio-card>*{position:absolute;top:0;right:0;bottom:0;left:0}`))]}render(){var s,a,n,o,d,c;const{data:m,lang:h,ns:p}=this;if(this.in({idle:"template"})||!(null==m?void 0:m.save_cc)||!this.in("idle")){const e=this.in("fail")?"error":this.in("busy")?"busy":"empty";return i(b||(b=g` <div class="ratio-card" aria-live="polite" aria-busy="${0}" data-testid="wrapper"> <div class="h-full bg-contrast-5"></div> <div class="absolute inset-0 flex items-center justify-center"> <foxy-spinner data-testid="spinner" state="${0}" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),this.in("busy"),e,this.lang,p,null!==(a=null===(s=customElements.get("foxy-spinner"))||void 0===s?void 0:s.defaultNS)&&void 0!==a?a:"")}const f=null!==(o=null===(n=m.cc_type)||void 0===n?void 0:n.toLowerCase())&&void 0!==o?o:"unknown",u=null!==(d=e[f])&&void 0!==d?d:t,x=null===(c=m.cc_number_masked)||void 0===c?void 0:c.substring(m.cc_number_masked.length-4);return i(v||(v=g` <foxy-internal-confirm-dialog data-testid="confirm" message="delete_prompt" confirm="delete" cancel="cancel" header="delete" theme="primary error" lang="${0}" ns="${0}" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> <div class="ratio-card" data-testid="wrapper" aria-busy="${0}" aria-live="polite"> <div class="flex flex-col justify-between text-base text-m leading-m font-lumo p-m bg-unknown bg-${0}"> <div class="${0}"> ${0} <div class="ml-auto rounded h-m">${0}</div> </div> <div class="font-tnum leading-none flex justify-between"> <div data-testid="expiry"> ${0} </div> <div data-testid="number"> ${0} </div> </div> </div> </div> `),h,p,this.__handleConfirmHide,this.in("busy"),f,l({"flex items-start":!0,"justify-between":this.readonlyControls===r.False,"justify-end":this.readonlyControls===r.True}),this.hiddenSelector.matches("actions",!0)?"":this.__renderActions(),u,m.cc_exp_month&&m.cc_exp_year?i(y||(y=g` <span class="sr-only">${0}&nbsp;</span> <span>${0} / ${0}</span> `),this.t("expires").toString(),m.cc_exp_month,m.cc_exp_year):"",x?i(_||(_=g` <span class="sr-only">${0}&nbsp;</span> <span aria-hidden="true">••••</span> <span>${0}</span> `),this.t("last_4_digits").toString(),x):"")}async _sendDelete(){const e=JSON.stringify({save_cc:!1}),t=await this._fetch(this.href,{method:"PATCH",body:e});return c.Rumour(this.group).share({data:null,source:this.href,related:[this.parent]}),t}__handleDelete(e){this.renderRoot.querySelector("#confirm").show(e.currentTarget)}__handleConfirmHide(e){e.detail.cancelled||this.delete()}}customElements.define("foxy-payment-method-card",j);export{j as PaymentMethodCard};
1
+ import"./shared-46ee137f.js";import"./shared-60126eee.js";import"./shared-0ced76a0.js";import"./shared-b1fc5dc3.js";import"./shared-9221e6b2.js";import"./foxy-spinner.js";import"./foxy-i18n.js";import{l as e,u as t}from"./shared-218ba06e.js";import{x as s,h as i,j as a}from"./shared-63eaded9.js";import{B as r}from"./shared-1761daef.js";import{C as n}from"./shared-593f7e2c.js";import"./foxy-nucleon-element.js";import{T as o,a as d}from"./shared-9a40309d.js";import{c as l}from"./shared-4e709717.js";import{N as c}from"./shared-44cfc617.js";import"./shared-ff79f3f9.js";import"./shared-df573cea.js";import"./shared-07abcd7b.js";import"./shared-00563cb0.js";import"./shared-6d45a07b.js";import"./shared-7684cb05.js";import"./shared-a46edf4b.js";const m=s("\n repeating-radial-gradient(\n circle at -100% 500%,\n rgba(255, 255, 255, 0),\n rgba(255, 255, 255, 0.05) 4px\n )\n"),h=s(Object.entries({unknown:"#797c85",amex:"#2557d6",diners:"#0079be",discover:"#4d4d4d",jcb:"#0e4c96",maestro:"#181818",mastercard:"#16366f",unionpay:"#0dadb5",visa:"#0e4595"}).map((([e,t])=>`.bg-${e} { background: ${t} ${m} }`)).join(" "));let p,f,u,b,v,y,_,g=e=>e;const x=o(n(d(c,"payment-method-card")));class j extends x{constructor(){super(...arguments),this.templates={},this.__renderActionsDelete=()=>i(p||(p=g` <div class="flex"> ${0} <vaadin-button class="px-xs rounded" theme="icon" style="--lumo-primary-text-color:#fff;--lumo-primary-color-50pct:rgba(255, 255, 255, 0.5);--lumo-contrast-5pct:rgba(255, 255, 255, 0.05)" aria-label="${0}" data-testid="actions:delete" ?disabled="${0}" @click="${0}"> <iron-icon icon="icons:delete"></iron-icon> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("actions:delete:before"),this.t("delete").toString(),this.disabledSelector.matches("actions:delete",!0),this.__handleDelete,this.renderTemplateOrSlot("actions:delete:after")),this.__renderActions=()=>i(f||(f=g` <div class="flex" data-testid="actions"> ${0} ${0} ${0} </div> `),this.renderTemplateOrSlot("actions:before"),this.hiddenSelector.matches("actions:delete",!0)?"":this.__renderActionsDelete(),this.renderTemplateOrSlot("actions:after"))}static get styles(){return[super.styles,h,a(u||(u=g`.ratio-card{padding-top:63%;position:relative;height:0}.ratio-card>*{position:absolute;top:0;right:0;bottom:0;left:0}`))]}render(){var s,a,n,o,d,c;const{data:m,lang:h,ns:p}=this;if(this.in({idle:"template"})||!(null==m?void 0:m.save_cc)||!this.in("idle")){const e=this.in("fail")?"error":this.in("busy")?"busy":"empty";return i(b||(b=g` <div class="ratio-card" aria-live="polite" aria-busy="${0}" data-testid="wrapper"> <div class="h-full bg-contrast-5"></div> <div class="absolute inset-0 flex items-center justify-center"> <foxy-spinner data-testid="spinner" state="${0}" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),this.in("busy"),e,this.lang,p,null!==(a=null===(s=customElements.get("foxy-spinner"))||void 0===s?void 0:s.defaultNS)&&void 0!==a?a:"")}const f=null!==(o=null===(n=m.cc_type)||void 0===n?void 0:n.toLowerCase())&&void 0!==o?o:"unknown",u=null!==(d=e[f])&&void 0!==d?d:t,x=null===(c=m.cc_number_masked)||void 0===c?void 0:c.substring(m.cc_number_masked.length-4);return i(v||(v=g` <foxy-internal-confirm-dialog data-testid="confirm" message="delete_prompt" confirm="delete" cancel="cancel" header="delete" theme="primary error" lang="${0}" ns="${0}" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> <div class="ratio-card" data-testid="wrapper" aria-busy="${0}" aria-live="polite"> <div class="flex flex-col justify-between text-base text-m leading-m font-lumo p-m bg-unknown bg-${0}"> <div class="${0}"> ${0} <div class="ml-auto rounded h-m">${0}</div> </div> <div class="font-tnum leading-none flex justify-between"> <div data-testid="expiry"> ${0} </div> <div data-testid="number"> ${0} </div> </div> </div> </div> `),h,p,this.__handleConfirmHide,this.in("busy"),f,l({"flex items-start":!0,"justify-between":this.readonlyControls===r.False,"justify-end":this.readonlyControls===r.True}),this.hiddenSelector.matches("actions",!0)?"":this.__renderActions(),u,m.cc_exp_month&&m.cc_exp_year?i(y||(y=g` <span class="sr-only">${0}&nbsp;</span> <span>${0} / ${0}</span> `),this.t("expires").toString(),m.cc_exp_month,m.cc_exp_year):"",x?i(_||(_=g` <span class="sr-only">${0}&nbsp;</span> <span aria-hidden="true">••••</span> <span>${0}</span> `),this.t("last_4_digits").toString(),x):"")}async _sendDelete(){const e=JSON.stringify({save_cc:!1}),t=await this._fetch(this.href,{method:"PATCH",body:e});return c.Rumour(this.group).share({data:null,source:this.href,related:[this.parent]}),t}__handleDelete(e){this.renderRoot.querySelector("#confirm").show(e.currentTarget)}__handleConfirmHide(e){e.detail.cancelled||this.delete()}}customElements.define("foxy-payment-method-card",j);export{j as PaymentMethodCard};