@foxy.io/elements 1.20.1 → 1.20.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.
Files changed (103) hide show
  1. package/dist/cdn/foxy-access-recovery-form.js +1 -1
  2. package/dist/cdn/foxy-address-card.js +1 -1
  3. package/dist/cdn/foxy-address-form.js +1 -1
  4. package/dist/cdn/foxy-api-browser.js +1 -1
  5. package/dist/cdn/foxy-applied-tax-card.js +1 -1
  6. package/dist/cdn/foxy-attribute-card.js +1 -1
  7. package/dist/cdn/foxy-attribute-form.js +1 -1
  8. package/dist/cdn/foxy-cancellation-form.js +1 -1
  9. package/dist/cdn/foxy-collection-page.js +1 -1
  10. package/dist/cdn/foxy-collection-pages.js +1 -1
  11. package/dist/cdn/foxy-copy-to-clipboard.js +1 -1
  12. package/dist/cdn/foxy-coupon-card.js +1 -1
  13. package/dist/cdn/foxy-coupon-code-form.js +1 -1
  14. package/dist/cdn/foxy-coupon-codes-form.js +1 -1
  15. package/dist/cdn/foxy-coupon-detail-card.js +1 -1
  16. package/dist/cdn/foxy-coupon-form.js +1 -1
  17. package/dist/cdn/foxy-custom-field-card.js +1 -1
  18. package/dist/cdn/foxy-custom-field-form.js +1 -1
  19. package/dist/cdn/foxy-customer-api.js +1 -1
  20. package/dist/cdn/foxy-customer-card.js +1 -1
  21. package/dist/cdn/foxy-customer-form.js +1 -1
  22. package/dist/cdn/foxy-customer-portal-settings.js +1 -1
  23. package/dist/cdn/foxy-customer-portal.js +2 -2
  24. package/dist/cdn/foxy-customer.js +1 -1
  25. package/dist/cdn/foxy-customers-table.js +1 -1
  26. package/dist/cdn/foxy-discount-builder.js +1 -1
  27. package/dist/cdn/foxy-discount-card.js +1 -1
  28. package/dist/cdn/foxy-discount-detail-card.js +1 -1
  29. package/dist/cdn/foxy-donation.js +1 -1
  30. package/dist/cdn/foxy-email-template-form.js +1 -1
  31. package/dist/cdn/foxy-error-entry-card.js +1 -1
  32. package/dist/cdn/foxy-form-dialog.js +1 -1
  33. package/dist/cdn/foxy-generate-codes-form.js +1 -1
  34. package/dist/cdn/foxy-gift-card-card.js +1 -1
  35. package/dist/cdn/foxy-gift-card-code-form.js +1 -1
  36. package/dist/cdn/foxy-gift-card-codes-form.js +1 -1
  37. package/dist/cdn/foxy-gift-card-form.js +1 -1
  38. package/dist/cdn/foxy-i18n.js +1 -1
  39. package/dist/cdn/foxy-item-card.js +1 -1
  40. package/dist/cdn/foxy-item-form.js +1 -1
  41. package/dist/cdn/foxy-item-option-card.js +1 -1
  42. package/dist/cdn/foxy-item-option-form.js +1 -1
  43. package/dist/cdn/foxy-items-form.js +1 -1
  44. package/dist/cdn/foxy-nucleon-element.js +1 -1
  45. package/dist/cdn/foxy-pagination.js +1 -1
  46. package/dist/cdn/foxy-payment-card.js +1 -1
  47. package/dist/cdn/foxy-payment-method-card.js +1 -1
  48. package/dist/cdn/foxy-report-form.js +1 -1
  49. package/dist/cdn/foxy-reports-table.js +6 -6
  50. package/dist/cdn/foxy-shipment-card.js +1 -1
  51. package/dist/cdn/foxy-sign-in-form.js +1 -1
  52. package/dist/cdn/foxy-spinner.js +1 -1
  53. package/dist/cdn/foxy-subscription-card.js +1 -1
  54. package/dist/cdn/foxy-subscription-form.js +3 -3
  55. package/dist/cdn/foxy-subscriptions-table.js +1 -1
  56. package/dist/cdn/foxy-table.js +1 -1
  57. package/dist/cdn/foxy-tax-card.js +1 -1
  58. package/dist/cdn/foxy-tax-form.js +1 -1
  59. package/dist/cdn/foxy-template-config-form.js +1 -1
  60. package/dist/cdn/foxy-template-form.js +1 -1
  61. package/dist/cdn/foxy-transaction-card.js +1 -1
  62. package/dist/cdn/foxy-transaction.js +1 -1
  63. package/dist/cdn/foxy-transactions-table.js +1 -1
  64. package/dist/cdn/foxy-user-form.js +1 -1
  65. package/dist/cdn/foxy-users-table.js +1 -1
  66. package/dist/cdn/foxy-webhook-card.js +1 -1
  67. package/dist/cdn/foxy-webhook-form.js +1 -1
  68. package/dist/cdn/foxy-webhook-log-card.js +1 -1
  69. package/dist/cdn/foxy-webhook-status-card.js +1 -1
  70. package/dist/cdn/{shared-bb686fc6.js → shared-0b65fb12.js} +1 -1
  71. package/dist/cdn/{shared-5c3a88d2.js → shared-1992ba56.js} +1 -1
  72. package/dist/cdn/{shared-7c8bb60c.js → shared-1ba08bcc.js} +1 -1
  73. package/dist/cdn/{shared-7474af47.js → shared-321572bc.js} +1 -1
  74. package/dist/cdn/{shared-c309e0ef.js → shared-47e4ea34.js} +1 -1
  75. package/dist/cdn/{shared-b3df4f38.js → shared-631dd765.js} +1 -1
  76. package/dist/cdn/{shared-dda2a74d.js → shared-68454b95.js} +1 -1
  77. package/dist/cdn/{shared-baf79b0b.js → shared-68871f75.js} +1 -1
  78. package/dist/cdn/{shared-a0836fa5.js → shared-6cc99375.js} +1 -1
  79. package/dist/cdn/{shared-bf6fb415.js → shared-86d93838.js} +1 -1
  80. package/dist/cdn/{shared-39f2c345.js → shared-89d9d88a.js} +1 -1
  81. package/dist/cdn/shared-8a980fae.js +1 -0
  82. package/dist/cdn/{shared-98497473.js → shared-92a6c959.js} +1 -1
  83. package/dist/cdn/{shared-8d4fef94.js → shared-a65bca62.js} +1 -1
  84. package/dist/cdn/{shared-c8677ba3.js → shared-ab008382.js} +1 -1
  85. package/dist/cdn/{shared-322e7efb.js → shared-b791079c.js} +5 -5
  86. package/dist/cdn/{shared-ac44429d.js → shared-ba59c811.js} +1 -1
  87. package/dist/cdn/shared-c87447a4.js +15 -0
  88. package/dist/cdn/{shared-26ce8d23.js → shared-ca05dcb3.js} +1 -1
  89. package/dist/cdn/{shared-2bdd4f74.js → shared-ce24fef8.js} +1 -1
  90. package/dist/cdn/shared-dd29b736.js +1 -0
  91. package/dist/cdn/{shared-f84686a8.js → shared-e575ce6f.js} +1 -1
  92. package/dist/cdn/{shared-dc3ffd38.js → shared-e8564a0b.js} +1 -1
  93. package/dist/cdn/{shared-63685d2e.js → shared-ed9d70f7.js} +1 -1
  94. package/dist/cdn/{shared-e9a4a204.js → shared-f7231d6a.js} +1 -1
  95. package/dist/cdn/{shared-7c612495.js → shared-ff649616.js} +1 -1
  96. package/dist/cdn/translations/country/{zh-cn.json → zh-CN.json} +0 -0
  97. package/dist/cdn/translations/country/{zh-hk.json → zh-HK.json} +0 -0
  98. package/dist/elements/public/ShipmentCard/types.d.ts +2 -16
  99. package/dist/elements/public/ShipmentCard/types.js.map +1 -1
  100. package/package.json +2 -3
  101. package/dist/cdn/shared-45feee83.js +0 -1
  102. package/dist/cdn/shared-92327224.js +0 -15
  103. package/dist/cdn/shared-dc1c6edd.js +0 -1
@@ -1 +1 @@
1
- import"./shared-e1c1e8e2.js";import"./foxy-spinner.js";import"./shared-c309e0ef.js";import{h as t}from"./shared-dc73b9a5.js";import{C as e}from"./shared-98497473.js";import{N as s}from"./shared-ac44429d.js";import{T as i,a as r}from"./shared-62169210.js";import{c as a}from"./shared-4e709717.js";import"./shared-2188d5f7.js";import"./shared-ae415a98.js";import"./shared-8e9a3bbb.js";import"./shared-fadcb2e1.js";import"./shared-92327224.js";import"./shared-9803aa7c.js";import"./shared-45feee83.js";import"./shared-7684cb05.js";import"./shared-7c8bb60c.js";let o,n,d,c,l,m,h,p,u,f,v,y,_=t=>t;const $=i(e(r(s,"transaction-card")));class x extends ${constructor(){super(...arguments),this.templates={},this.__currencyDisplay=""}render(){var e,s;const i=this.hiddenSelector,r=!i.matches("total",!0),d=!i.matches("status",!0);return t(o||(o=_` <div aria-busy="${0}" aria-live="polite" class="relative leading-m font-lumo text-m"> <div class="${0}"> ${0} ${0} ${0} </div> <div class="${0}"> <foxy-spinner data-testid="spinner" state="${0}" class="m-auto" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),this.in("busy"),a({"transition-opacity":!0,"opacity-0":!this.data}),r||d?t(n||(n=_` <div class="flex items-center justify-between"> ${0} ${0} </div> `),r?this.__renderTotal():"",d?this.__renderStatus():""):"",i.matches("description",!0)?"":this.__renderDescription(),i.matches("customer",!0)?"":this.__renderCustomer(),a({"pointer-events-none absolute inset-0 flex transition-opacity":!0,"opacity-0":!!this.data}),this.in("fail")?"error":this.in({idle:"template"})?"empty":"busy",this.lang,this.ns,null!==(s=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==s?s:"")}async _sendGet(){const t=await super._sendGet(),e=await super._fetch(t._links["fx:store"].href);return this.__currencyDisplay=e.use_international_currency_symbol?"code":"symbol",t}__renderTotal(){const e=this.data;let s;if(e){const i=`${e.total_order} ${e.currency_code}`,r=this.__currencyDisplay;s=t(d||(d=_` <foxy-i18n options="${0}" lang="${0}" key="price" ns="${0}"> </foxy-i18n> `),JSON.stringify({amount:i,currencyDisplay:r}),this.lang,this.ns)}else s=t(c||(c=_`&ZeroWidthSpace;`));return t(l||(l=_` <div data-testid="total"> ${0} <div class="font-semibold truncate">${0}</div> ${0} </div> `),this.renderTemplateOrSlot("total:before"),s,this.renderTemplateOrSlot("total:after"))}__renderStatus(){var e,s,i,r;const a=(null===(e=this.data)||void 0===e?void 0:e.status)||"completed";return t(m||(m=_` <div data-testid="status"> ${0} <div class="text-tertiary text-s flex items-center space-x-s"> <foxy-i18n options="${0}" lang="${0}" key="time" ns="${0}"> </foxy-i18n> <iron-icon data-testid="status-icon" class="icon-inline text-l ${0}" title="${0}" icon="${0}"> </iron-icon> </div> ${0} </div> `),this.renderTemplateOrSlot("status:before"),JSON.stringify({value:null===(s=this.data)||void 0===s?void 0:s.transaction_date}),this.lang,this.ns,null!==(i={completed:"text-success",rejected:"text-error",declined:"text-error"}[a])&&void 0!==i?i:"text-tertiary",this.t(`transaction_${a}`),null!==(r={completed:"icons:done-all",refunded:"icons:restore",rejected:"icons:highlight-off",declined:"icons:highlight-off",voided:"icons:remove-circle-outline"}[a])&&void 0!==r?r:"icons:schedule",this.renderTemplateOrSlot("status:after"))}__renderDescription(){var e,s;const i=null===(s=null===(e=this.data)||void 0===e?void 0:e._embedded)||void 0===s?void 0:s["fx:items"];let r;if(i){const e={most_expensive_item:[...i].sort(((t,e)=>t.price-e.price))[0],count:i.length};r=t(h||(h=_` <foxy-i18n options="${0}" lang="${0}" key="transaction_summary" ns="${0}"> </foxy-i18n> `),JSON.stringify(e),this.lang,this.ns)}else r=t(p||(p=_`&ZeroWidthSpace;`));return t(u||(u=_` <div data-testid="description"> ${0} <div class="text-s text-secondary truncate">${0}</div> ${0} </div> `),this.renderTemplateOrSlot("description:before"),r,this.renderTemplateOrSlot("description:after"))}__renderCustomer(){const e=this.data,s=e?t(f||(f=_`${0} ${0} (${0})`),e.customer_first_name,e.customer_last_name,e.customer_email):t(v||(v=_`&ZeroWidthSpace;`));return t(y||(y=_` <div data-testid="customer"> ${0} <div class="text-tertiary truncate text-s">${0}</div> ${0} </div> `),this.renderTemplateOrSlot("customer:before"),s,this.renderTemplateOrSlot("customer:after"))}}customElements.define("foxy-transaction-card",x);export{x as TransactionCard};
1
+ import"./shared-e1c1e8e2.js";import"./foxy-spinner.js";import"./shared-47e4ea34.js";import{h as t}from"./shared-dc73b9a5.js";import{C as e}from"./shared-92a6c959.js";import{N as s}from"./shared-ba59c811.js";import{T as i,a as r}from"./shared-62169210.js";import{c as a}from"./shared-4e709717.js";import"./shared-2188d5f7.js";import"./shared-ae415a98.js";import"./shared-8e9a3bbb.js";import"./shared-fadcb2e1.js";import"./shared-c87447a4.js";import"./shared-9803aa7c.js";import"./shared-dd29b736.js";import"./shared-7684cb05.js";import"./shared-1ba08bcc.js";let o,n,d,c,l,m,h,p,u,f,v,y,_=t=>t;const $=i(e(r(s,"transaction-card")));class x extends ${constructor(){super(...arguments),this.templates={},this.__currencyDisplay=""}render(){var e,s;const i=this.hiddenSelector,r=!i.matches("total",!0),d=!i.matches("status",!0);return t(o||(o=_` <div aria-busy="${0}" aria-live="polite" class="relative leading-m font-lumo text-m"> <div class="${0}"> ${0} ${0} ${0} </div> <div class="${0}"> <foxy-spinner data-testid="spinner" state="${0}" class="m-auto" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),this.in("busy"),a({"transition-opacity":!0,"opacity-0":!this.data}),r||d?t(n||(n=_` <div class="flex items-center justify-between"> ${0} ${0} </div> `),r?this.__renderTotal():"",d?this.__renderStatus():""):"",i.matches("description",!0)?"":this.__renderDescription(),i.matches("customer",!0)?"":this.__renderCustomer(),a({"pointer-events-none absolute inset-0 flex transition-opacity":!0,"opacity-0":!!this.data}),this.in("fail")?"error":this.in({idle:"template"})?"empty":"busy",this.lang,this.ns,null!==(s=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==s?s:"")}async _sendGet(){const t=await super._sendGet(),e=await super._fetch(t._links["fx:store"].href);return this.__currencyDisplay=e.use_international_currency_symbol?"code":"symbol",t}__renderTotal(){const e=this.data;let s;if(e){const i=`${e.total_order} ${e.currency_code}`,r=this.__currencyDisplay;s=t(d||(d=_` <foxy-i18n options="${0}" lang="${0}" key="price" ns="${0}"> </foxy-i18n> `),JSON.stringify({amount:i,currencyDisplay:r}),this.lang,this.ns)}else s=t(c||(c=_`&ZeroWidthSpace;`));return t(l||(l=_` <div data-testid="total"> ${0} <div class="font-semibold truncate">${0}</div> ${0} </div> `),this.renderTemplateOrSlot("total:before"),s,this.renderTemplateOrSlot("total:after"))}__renderStatus(){var e,s,i,r;const a=(null===(e=this.data)||void 0===e?void 0:e.status)||"completed";return t(m||(m=_` <div data-testid="status"> ${0} <div class="text-tertiary text-s flex items-center space-x-s"> <foxy-i18n options="${0}" lang="${0}" key="time" ns="${0}"> </foxy-i18n> <iron-icon data-testid="status-icon" class="icon-inline text-l ${0}" title="${0}" icon="${0}"> </iron-icon> </div> ${0} </div> `),this.renderTemplateOrSlot("status:before"),JSON.stringify({value:null===(s=this.data)||void 0===s?void 0:s.transaction_date}),this.lang,this.ns,null!==(i={completed:"text-success",rejected:"text-error",declined:"text-error"}[a])&&void 0!==i?i:"text-tertiary",this.t(`transaction_${a}`),null!==(r={completed:"icons:done-all",refunded:"icons:restore",rejected:"icons:highlight-off",declined:"icons:highlight-off",voided:"icons:remove-circle-outline"}[a])&&void 0!==r?r:"icons:schedule",this.renderTemplateOrSlot("status:after"))}__renderDescription(){var e,s;const i=null===(s=null===(e=this.data)||void 0===e?void 0:e._embedded)||void 0===s?void 0:s["fx:items"];let r;if(i){const e={most_expensive_item:[...i].sort(((t,e)=>t.price-e.price))[0],count:i.length};r=t(h||(h=_` <foxy-i18n options="${0}" lang="${0}" key="transaction_summary" ns="${0}"> </foxy-i18n> `),JSON.stringify(e),this.lang,this.ns)}else r=t(p||(p=_`&ZeroWidthSpace;`));return t(u||(u=_` <div data-testid="description"> ${0} <div class="text-s text-secondary truncate">${0}</div> ${0} </div> `),this.renderTemplateOrSlot("description:before"),r,this.renderTemplateOrSlot("description:after"))}__renderCustomer(){const e=this.data,s=e?t(f||(f=_`${0} ${0} (${0})`),e.customer_first_name,e.customer_last_name,e.customer_email):t(v||(v=_`&ZeroWidthSpace;`));return t(y||(y=_` <div data-testid="customer"> ${0} <div class="text-tertiary truncate text-s">${0}</div> ${0} </div> `),this.renderTemplateOrSlot("customer:before"),s,this.renderTemplateOrSlot("customer:after"))}}customElements.define("foxy-transaction-card",x);export{x as TransactionCard};
@@ -1 +1 @@
1
- import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-custom-field-form.js";import"./foxy-custom-field-card.js";import"./foxy-applied-tax-card.js";import"./foxy-discount-card.js";import"./foxy-shipment-card.js";import"./foxy-payment-card.js";import"./foxy-item-form.js";import"./shared-c309e0ef.js";import"./shared-b3df4f38.js";import{a as t,I as o}from"./shared-8d4fef94.js";import"./foxy-customer-card.js";import"./foxy-form-dialog.js";import"./foxy-customer.js";import{h as r,c as e}from"./shared-dc73b9a5.js";import{i}from"./shared-9803aa7c.js";import"./shared-c5c60417.js";import"./shared-bb686fc6.js";import{_ as s}from"./shared-fadcb2e1.js";import{N as n}from"./shared-ac44429d.js";import{a}from"./shared-62169210.js";import{B as d}from"./shared-92327224.js";import"./shared-8e9a3bbb.js";import"./shared-2188d5f7.js";import"./shared-ae415a98.js";import"./shared-e1c1e8e2.js";import"./foxy-spinner.js";import"./shared-98497473.js";import"./shared-4e709717.js";import"./shared-45feee83.js";import"./shared-7684cb05.js";import"./shared-7c8bb60c.js";import"./shared-63685d2e.js";import"./shared-195fd5af.js";import"./shared-31c43743.js";import"./shared-4e201e09.js";import"./shared-d28ac9dc.js";import"./shared-dc23b751.js";import"./shared-a052131e.js";import"./shared-99940888.js";import"./shared-c8677ba3.js";import"./shared-2bdd4f74.js";import"./shared-6d104622.js";import"./shared-dd6d3c18.js";import"./shared-d699348f.js";import"./shared-baf79b0b.js";import"./foxy-address-card.js";import"./foxy-item-card.js";import"./shared-5c3a88d2.js";import"./shared-dc3ffd38.js";import"./foxy-item-option-form.js";import"./foxy-discount-detail-card.js";import"./foxy-coupon-detail-card.js";import"./foxy-item-option-card.js";import"./foxy-coupon-card.js";import"./foxy-discount-builder.js";import"./shared-a0c6a159.js";import"./shared-f9f9ed5b.js";import"./shared-bf6fb415.js";import"./shared-2061be9a.js";import"./shared-c89ba319.js";import"./foxy-subscription-card.js";import"./shared-dc1c6edd.js";import"./foxy-subscription-form.js";import"./foxy-cancellation-form.js";import"./foxy-collection-pages.js";import"./foxy-collection-page.js";import"./shared-39f2c345.js";import"./shared-a0836fa5.js";import"./foxy-table.js";import"./shared-7474af47.js";import"./foxy-nucleon-element.js";import"./shared-26ce8d23.js";import"./shared-1bbd9b73.js";import"./shared-f84686a8.js";import"./foxy-pagination.js";import"./shared-0eb966c5.js";import"./foxy-payment-method-card.js";import"./foxy-transactions-table.js";import"./foxy-customer-form.js";import"./shared-b738ee96.js";import"./foxy-address-form.js";import"./shared-322e7efb.js";let l,c=t=>t;customElements.define("foxy-internal-transaction-customer-control",class extends t{renderControl(){var t,o,e,s;return r(l||(l=c` <foxy-internal-details summary="customer" infer="" open> <foxy-form-dialog header="header" infer="dialog" form="foxy-customer" href="${0}" id="dialog"> </foxy-form-dialog> <button class="w-full text-left block rounded-b-l transition-colors hover-bg-contrast-5 focus-outline-none focus-ring-2 focus-ring-primary-50" @click="${0}"> <foxy-customer-card infer="card" class="p-m" href="${0}"> </foxy-customer-card> </button> </foxy-internal-details> `),i(null===(o=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===o?void 0:o._links["fx:customer"].href),(t=>{this.renderRoot.querySelector("#dialog").show(t.currentTarget)}),i(null===(s=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===s?void 0:s._links["fx:customer"].href))}});let f,m=t=>t;customElements.define("foxy-internal-transaction-post-action-control",class extends t{constructor(){super(...arguments),this.theme=null,this.href=null,this.__state="idle"}static get properties(){return s(s({},super.properties),{},{__state:{type:String},theme:{type:String},href:{type:String}})}renderControl(){const t=this.__state,o="fail"===t?"error":"idle"===t?this.theme:"";return r(f||(f=m` <foxy-internal-confirm-dialog header="header" infer="confirm" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> <vaadin-button class="w-full" theme="${0} tertiary" ?disabled="${0}" @click="${0}"> <foxy-i18n key="${0}" infer=""></foxy-i18n> </vaadin-button> `),(t=>!t.detail.cancelled&&this.__submit()),o,"busy"===t||this.disabled,(t=>{this.renderRoot.querySelector("#confirm").show(t.currentTarget)}),t)}async __submit(){var t;if("busy"!==this.__state)try{this.__state="busy";const o=new n.API(this),r=await o.fetch(null!==(t=this.href)&&void 0!==t?t:"",{method:"POST"});this.__state=r.ok?"idle":"fail",r.ok&&this.dispatchEvent(new CustomEvent("done"))}catch(t){this.__state="fail"}}});let u,p,h,y,x,v=t=>t;customElements.define("foxy-internal-transaction-actions-control",class extends t{renderControl(){var t,o,e,i,s,n,a,d;return r(u||(u=v` <div class="divide-y divide-contrast-10"> ${0} ${0} ${0} ${0} </div> `),(null===(o=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===o?void 0:o._links["fx:capture"])?this.__renderCaptureAction():"",(null===(i=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===i?void 0:i._links["fx:void"])?this.__renderVoidAction():"",(null===(n=null===(s=this.nucleon)||void 0===s?void 0:s.data)||void 0===n?void 0:n._links["fx:refund"])?this.__renderRefundAction():"",(null===(d=null===(a=this.nucleon)||void 0===a?void 0:a.data)||void 0===d?void 0:d._links["fx:send_emails"])?this.__renderSendEmailsAction():"")}__renderSendEmailsAction(){var t,o;return r(p||(p=v` <foxy-internal-transaction-post-action-control infer="send-emails" theme="contrast" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),i(null===(o=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===o?void 0:o._links["fx:send_emails"].href),(()=>{var t;return null===(t=this.nucleon)||void 0===t?void 0:t.refresh()}))}__renderCaptureAction(){var t,o;return r(h||(h=v` <foxy-internal-transaction-post-action-control theme="success" infer="capture" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),i(null===(o=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===o?void 0:o._links["fx:capture"].href),(()=>{var t;return null===(t=this.nucleon)||void 0===t?void 0:t.refresh()}))}__renderVoidAction(){var t,o,e;return r(y||(y=v` <foxy-internal-transaction-post-action-control theme="error" infer="void" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),i(null===(e=null===(o=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===o?void 0:o._links["fx:void"])||void 0===e?void 0:e.href),(()=>{var t;return null===(t=this.nucleon)||void 0===t?void 0:t.refresh()}))}__renderRefundAction(){var t,o,e;return r(x||(x=v` <foxy-internal-transaction-post-action-control theme="contrast" infer="refund" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),i(null===(e=null===(o=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===o?void 0:o._links["fx:refund"])||void 0===e?void 0:e.href),(()=>{var t;return null===(t=this.nucleon)||void 0===t?void 0:t.refresh()}))}});let j,_,b,$,g,k,S,w=t=>t;customElements.define("foxy-internal-transaction-summary-control",class extends t{renderControl(){var t;return r(j||(j=w` <div class="border-t border-transparent"> <div class="h-m flex items-center justify-between"> <div class="text-xl font-bold">${0}</div> <div>${0}</div> </div> <div class="border-t border-contrast-10 mb-s"></div> ${0} </div> `),this.__renderPrice(),(null===(t=this.nucleon)||void 0===t?void 0:t.data)?this.__renderStatus():"",this.__renderTotals())}__renderStatus(){var t,o;const e={authorized:"bg-success text-success-contrast",completed:"bg-success text-success-contrast",declined:"bg-error text-error-contrast",rejected:"bg-error text-error-contrast"},i=(null===(o=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===o?void 0:o.status)||"completed";return r(_||(_=w` <foxy-i18n class="flex items-center h-xs px-s text-s font-semibold rounded ${0}" infer="" key="transaction_${0}"> </foxy-i18n> `),i in e?e[i]:"bg-contrast-5 text-contrast",i)}__renderPrice(){var t;const o=null===(t=this.nucleon)||void 0===t?void 0:t.data,e=null==o?void 0:o.currency_code;if(!o)return r(b||(b=w`--`));const i={amount:`${o.total_order} ${e}`};return r($||($=w`<foxy-i18n infer="" key="price" .options="${0}"></foxy-i18n>`),i)}__renderTotals(){var t;const o=null===(t=this.nucleon)||void 0===t?void 0:t.data,e=null==o?void 0:o.currency_code;return["total_item_price","total_shipping","total_tax"].map((t=>{const i={amount:`${null==o?void 0:o[t]} ${e}`};return r(g||(g=w` <div class="flex justify-between text-m text-secondary"> <foxy-i18n key="${0}" infer=""></foxy-i18n> ${0} </div> `),t,o?r(k||(k=w`<foxy-i18n infer="" key="price" .options="${0}"></foxy-i18n>`),i):r(S||(S=w`<span>--</span>`)))}))}});let A,E,C=t=>t;class T extends(a(o,"transaction")){static get styles(){return[...super.styles,e(A||(A=C`#body{display:grid;grid-template-columns:repeat(auto-fill,minmax(calc(18.75 * var(--lumo-space-m)),1fr))}#body>:first-child{grid-column-start:1;grid-column-end:-2}`))]}get readonlySelector(){var t,o,r;return Boolean(null!==(o=null===(t=this.data)||void 0===t?void 0:t._links["fx:void"])&&void 0!==o?o:null===(r=this.data)||void 0===r?void 0:r._links["fx:refund"])?super.readonlySelector:new d(`${super.readonlySelector} attributes custom-fields`)}renderBody(){var t,o,e,s,n,a;return r(E||(E=C` <div id="body" class="gap-m"> <foxy-internal-async-details-control infer="shipments" first="${0}" item="foxy-shipment-card" open> </foxy-internal-async-details-control> <div class="grid gap-m self-start"> <foxy-internal-transaction-summary-control infer="summary"> </foxy-internal-transaction-summary-control> <foxy-internal-transaction-customer-control infer="customer"> </foxy-internal-transaction-customer-control> <foxy-internal-async-details-control infer="payments" class="max-w-full overflow-hidden" first="${0}" limit="1" item="foxy-payment-card" open> </foxy-internal-async-details-control> <foxy-internal-async-details-control infer="discounts" first="${0}" limit="5" item="foxy-discount-card"> </foxy-internal-async-details-control> <foxy-internal-async-details-control infer="applied-taxes" first="${0}" limit="5" item="foxy-applied-tax-card"> </foxy-internal-async-details-control> <foxy-internal-async-details-control infer="custom-fields" first="${0}" limit="5" form="foxy-custom-field-form" item="foxy-custom-field-card" .related="${0}"> </foxy-internal-async-details-control> <foxy-internal-async-details-control infer="attributes" first="${0}" limit="5" form="foxy-attribute-form" item="foxy-attribute-card" .related="${0}"> </foxy-internal-async-details-control> <foxy-internal-transaction-actions-control infer="actions"> </foxy-internal-transaction-actions-control> </div> </div> `),i(null===(t=this.data)||void 0===t?void 0:t._links["fx:shipments"].href),i(null===(o=this.data)||void 0===o?void 0:o._links["fx:payments"].href),i(null===(e=this.data)||void 0===e?void 0:e._links["fx:discounts"].href),i(null===(s=this.data)||void 0===s?void 0:s._links["fx:applied_taxes"].href),i(null===(n=this.data)||void 0===n?void 0:n._links["fx:custom_fields"].href),[this.href],i(null===(a=this.data)||void 0===a?void 0:a._links["fx:attributes"].href),[this.href])}}customElements.define("foxy-transaction",T);export{T as Transaction};
1
+ import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-custom-field-form.js";import"./foxy-custom-field-card.js";import"./foxy-applied-tax-card.js";import"./foxy-discount-card.js";import"./foxy-shipment-card.js";import"./foxy-payment-card.js";import"./foxy-item-form.js";import"./shared-47e4ea34.js";import"./shared-631dd765.js";import{a as t,I as o}from"./shared-a65bca62.js";import"./foxy-customer-card.js";import"./foxy-form-dialog.js";import"./foxy-customer.js";import{h as r,c as e}from"./shared-dc73b9a5.js";import{i}from"./shared-9803aa7c.js";import"./shared-c5c60417.js";import"./shared-0b65fb12.js";import{_ as s}from"./shared-fadcb2e1.js";import{N as n}from"./shared-ba59c811.js";import{a}from"./shared-62169210.js";import{B as d}from"./shared-c87447a4.js";import"./shared-8e9a3bbb.js";import"./shared-2188d5f7.js";import"./shared-ae415a98.js";import"./shared-e1c1e8e2.js";import"./foxy-spinner.js";import"./shared-92a6c959.js";import"./shared-4e709717.js";import"./shared-dd29b736.js";import"./shared-7684cb05.js";import"./shared-1ba08bcc.js";import"./shared-ed9d70f7.js";import"./shared-195fd5af.js";import"./shared-31c43743.js";import"./shared-4e201e09.js";import"./shared-d28ac9dc.js";import"./shared-dc23b751.js";import"./shared-a052131e.js";import"./shared-99940888.js";import"./shared-ab008382.js";import"./shared-ce24fef8.js";import"./shared-6d104622.js";import"./shared-dd6d3c18.js";import"./shared-d699348f.js";import"./shared-68871f75.js";import"./foxy-address-card.js";import"./foxy-item-card.js";import"./shared-1992ba56.js";import"./shared-e8564a0b.js";import"./foxy-item-option-form.js";import"./foxy-discount-detail-card.js";import"./foxy-coupon-detail-card.js";import"./foxy-item-option-card.js";import"./foxy-coupon-card.js";import"./foxy-discount-builder.js";import"./shared-a0c6a159.js";import"./shared-f9f9ed5b.js";import"./shared-86d93838.js";import"./shared-2061be9a.js";import"./shared-c89ba319.js";import"./foxy-subscription-card.js";import"./shared-8a980fae.js";import"./foxy-subscription-form.js";import"./foxy-cancellation-form.js";import"./foxy-collection-pages.js";import"./foxy-collection-page.js";import"./shared-89d9d88a.js";import"./shared-6cc99375.js";import"./foxy-table.js";import"./shared-321572bc.js";import"./foxy-nucleon-element.js";import"./shared-ca05dcb3.js";import"./shared-1bbd9b73.js";import"./shared-e575ce6f.js";import"./foxy-pagination.js";import"./shared-0eb966c5.js";import"./foxy-payment-method-card.js";import"./foxy-transactions-table.js";import"./foxy-customer-form.js";import"./shared-b738ee96.js";import"./foxy-address-form.js";import"./shared-b791079c.js";let l,c=t=>t;customElements.define("foxy-internal-transaction-customer-control",class extends t{renderControl(){var t,o,e,s;return r(l||(l=c` <foxy-internal-details summary="customer" infer="" open> <foxy-form-dialog header="header" infer="dialog" form="foxy-customer" href="${0}" id="dialog"> </foxy-form-dialog> <button class="w-full text-left block rounded-b-l transition-colors hover-bg-contrast-5 focus-outline-none focus-ring-2 focus-ring-primary-50" @click="${0}"> <foxy-customer-card infer="card" class="p-m" href="${0}"> </foxy-customer-card> </button> </foxy-internal-details> `),i(null===(o=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===o?void 0:o._links["fx:customer"].href),(t=>{this.renderRoot.querySelector("#dialog").show(t.currentTarget)}),i(null===(s=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===s?void 0:s._links["fx:customer"].href))}});let f,m=t=>t;customElements.define("foxy-internal-transaction-post-action-control",class extends t{constructor(){super(...arguments),this.theme=null,this.href=null,this.__state="idle"}static get properties(){return s(s({},super.properties),{},{__state:{type:String},theme:{type:String},href:{type:String}})}renderControl(){const t=this.__state,o="fail"===t?"error":"idle"===t?this.theme:"";return r(f||(f=m` <foxy-internal-confirm-dialog header="header" infer="confirm" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> <vaadin-button class="w-full" theme="${0} tertiary" ?disabled="${0}" @click="${0}"> <foxy-i18n key="${0}" infer=""></foxy-i18n> </vaadin-button> `),(t=>!t.detail.cancelled&&this.__submit()),o,"busy"===t||this.disabled,(t=>{this.renderRoot.querySelector("#confirm").show(t.currentTarget)}),t)}async __submit(){var t;if("busy"!==this.__state)try{this.__state="busy";const o=new n.API(this),r=await o.fetch(null!==(t=this.href)&&void 0!==t?t:"",{method:"POST"});this.__state=r.ok?"idle":"fail",r.ok&&this.dispatchEvent(new CustomEvent("done"))}catch(t){this.__state="fail"}}});let u,p,h,y,x,v=t=>t;customElements.define("foxy-internal-transaction-actions-control",class extends t{renderControl(){var t,o,e,i,s,n,a,d;return r(u||(u=v` <div class="divide-y divide-contrast-10"> ${0} ${0} ${0} ${0} </div> `),(null===(o=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===o?void 0:o._links["fx:capture"])?this.__renderCaptureAction():"",(null===(i=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===i?void 0:i._links["fx:void"])?this.__renderVoidAction():"",(null===(n=null===(s=this.nucleon)||void 0===s?void 0:s.data)||void 0===n?void 0:n._links["fx:refund"])?this.__renderRefundAction():"",(null===(d=null===(a=this.nucleon)||void 0===a?void 0:a.data)||void 0===d?void 0:d._links["fx:send_emails"])?this.__renderSendEmailsAction():"")}__renderSendEmailsAction(){var t,o;return r(p||(p=v` <foxy-internal-transaction-post-action-control infer="send-emails" theme="contrast" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),i(null===(o=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===o?void 0:o._links["fx:send_emails"].href),(()=>{var t;return null===(t=this.nucleon)||void 0===t?void 0:t.refresh()}))}__renderCaptureAction(){var t,o;return r(h||(h=v` <foxy-internal-transaction-post-action-control theme="success" infer="capture" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),i(null===(o=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===o?void 0:o._links["fx:capture"].href),(()=>{var t;return null===(t=this.nucleon)||void 0===t?void 0:t.refresh()}))}__renderVoidAction(){var t,o,e;return r(y||(y=v` <foxy-internal-transaction-post-action-control theme="error" infer="void" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),i(null===(e=null===(o=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===o?void 0:o._links["fx:void"])||void 0===e?void 0:e.href),(()=>{var t;return null===(t=this.nucleon)||void 0===t?void 0:t.refresh()}))}__renderRefundAction(){var t,o,e;return r(x||(x=v` <foxy-internal-transaction-post-action-control theme="contrast" infer="refund" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),i(null===(e=null===(o=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===o?void 0:o._links["fx:refund"])||void 0===e?void 0:e.href),(()=>{var t;return null===(t=this.nucleon)||void 0===t?void 0:t.refresh()}))}});let j,_,b,$,g,k,S,w=t=>t;customElements.define("foxy-internal-transaction-summary-control",class extends t{renderControl(){var t;return r(j||(j=w` <div class="border-t border-transparent"> <div class="h-m flex items-center justify-between"> <div class="text-xl font-bold">${0}</div> <div>${0}</div> </div> <div class="border-t border-contrast-10 mb-s"></div> ${0} </div> `),this.__renderPrice(),(null===(t=this.nucleon)||void 0===t?void 0:t.data)?this.__renderStatus():"",this.__renderTotals())}__renderStatus(){var t,o;const e={authorized:"bg-success text-success-contrast",completed:"bg-success text-success-contrast",declined:"bg-error text-error-contrast",rejected:"bg-error text-error-contrast"},i=(null===(o=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===o?void 0:o.status)||"completed";return r(_||(_=w` <foxy-i18n class="flex items-center h-xs px-s text-s font-semibold rounded ${0}" infer="" key="transaction_${0}"> </foxy-i18n> `),i in e?e[i]:"bg-contrast-5 text-contrast",i)}__renderPrice(){var t;const o=null===(t=this.nucleon)||void 0===t?void 0:t.data,e=null==o?void 0:o.currency_code;if(!o)return r(b||(b=w`--`));const i={amount:`${o.total_order} ${e}`};return r($||($=w`<foxy-i18n infer="" key="price" .options="${0}"></foxy-i18n>`),i)}__renderTotals(){var t;const o=null===(t=this.nucleon)||void 0===t?void 0:t.data,e=null==o?void 0:o.currency_code;return["total_item_price","total_shipping","total_tax"].map((t=>{const i={amount:`${null==o?void 0:o[t]} ${e}`};return r(g||(g=w` <div class="flex justify-between text-m text-secondary"> <foxy-i18n key="${0}" infer=""></foxy-i18n> ${0} </div> `),t,o?r(k||(k=w`<foxy-i18n infer="" key="price" .options="${0}"></foxy-i18n>`),i):r(S||(S=w`<span>--</span>`)))}))}});let A,E,C=t=>t;class T extends(a(o,"transaction")){static get styles(){return[...super.styles,e(A||(A=C`#body{display:grid;grid-template-columns:repeat(auto-fill,minmax(calc(18.75 * var(--lumo-space-m)),1fr))}#body>:first-child{grid-column-start:1;grid-column-end:-2}`))]}get readonlySelector(){var t,o,r;return Boolean(null!==(o=null===(t=this.data)||void 0===t?void 0:t._links["fx:void"])&&void 0!==o?o:null===(r=this.data)||void 0===r?void 0:r._links["fx:refund"])?super.readonlySelector:new d(`${super.readonlySelector} attributes custom-fields`)}renderBody(){var t,o,e,s,n,a;return r(E||(E=C` <div id="body" class="gap-m"> <foxy-internal-async-details-control infer="shipments" first="${0}" item="foxy-shipment-card" open> </foxy-internal-async-details-control> <div class="grid gap-m self-start"> <foxy-internal-transaction-summary-control infer="summary"> </foxy-internal-transaction-summary-control> <foxy-internal-transaction-customer-control infer="customer"> </foxy-internal-transaction-customer-control> <foxy-internal-async-details-control infer="payments" class="max-w-full overflow-hidden" first="${0}" limit="1" item="foxy-payment-card" open> </foxy-internal-async-details-control> <foxy-internal-async-details-control infer="discounts" first="${0}" limit="5" item="foxy-discount-card"> </foxy-internal-async-details-control> <foxy-internal-async-details-control infer="applied-taxes" first="${0}" limit="5" item="foxy-applied-tax-card"> </foxy-internal-async-details-control> <foxy-internal-async-details-control infer="custom-fields" first="${0}" limit="5" form="foxy-custom-field-form" item="foxy-custom-field-card" .related="${0}"> </foxy-internal-async-details-control> <foxy-internal-async-details-control infer="attributes" first="${0}" limit="5" form="foxy-attribute-form" item="foxy-attribute-card" .related="${0}"> </foxy-internal-async-details-control> <foxy-internal-transaction-actions-control infer="actions"> </foxy-internal-transaction-actions-control> </div> </div> `),i(null===(t=this.data)||void 0===t?void 0:t._links["fx:shipments"].href),i(null===(o=this.data)||void 0===o?void 0:o._links["fx:payments"].href),i(null===(e=this.data)||void 0===e?void 0:e._links["fx:discounts"].href),i(null===(s=this.data)||void 0===s?void 0:s._links["fx:applied_taxes"].href),i(null===(n=this.data)||void 0===n?void 0:n._links["fx:custom_fields"].href),[this.href],i(null===(a=this.data)||void 0===a?void 0:a._links["fx:attributes"].href),[this.href])}}customElements.define("foxy-transaction",T);export{T as Transaction};
@@ -1 +1 @@
1
- import"./shared-8e9a3bbb.js";import"./shared-2188d5f7.js";import"./foxy-spinner.js";import"./shared-c309e0ef.js";import{T as s}from"./shared-f84686a8.js";export{T as TransactionsTable}from"./shared-f84686a8.js";import"./shared-ae415a98.js";import"./shared-62169210.js";import"./shared-fadcb2e1.js";import"./shared-dc73b9a5.js";import"./shared-92327224.js";import"./shared-7474af47.js";import"./shared-98497473.js";import"./shared-9803aa7c.js";import"./foxy-nucleon-element.js";import"./shared-ac44429d.js";import"./shared-45feee83.js";import"./shared-7684cb05.js";import"./shared-7c8bb60c.js";import"./shared-4e709717.js";customElements.define("foxy-transactions-table",s);
1
+ import"./shared-8e9a3bbb.js";import"./shared-2188d5f7.js";import"./foxy-spinner.js";import"./shared-47e4ea34.js";import{T as s}from"./shared-e575ce6f.js";export{T as TransactionsTable}from"./shared-e575ce6f.js";import"./shared-ae415a98.js";import"./shared-62169210.js";import"./shared-fadcb2e1.js";import"./shared-dc73b9a5.js";import"./shared-c87447a4.js";import"./shared-321572bc.js";import"./shared-92a6c959.js";import"./shared-9803aa7c.js";import"./foxy-nucleon-element.js";import"./shared-ba59c811.js";import"./shared-dd29b736.js";import"./shared-7684cb05.js";import"./shared-1ba08bcc.js";import"./shared-4e709717.js";customElements.define("foxy-transactions-table",s);
@@ -1 +1 @@
1
- import"./shared-d28ac9dc.js";import"./shared-c5c60417.js";import"./shared-bb686fc6.js";import"./foxy-spinner.js";import"./shared-c309e0ef.js";export{U as UserForm}from"./shared-7c612495.js";import"./shared-195fd5af.js";import"./shared-ae415a98.js";import"./shared-62169210.js";import"./shared-fadcb2e1.js";import"./shared-dc73b9a5.js";import"./shared-c8677ba3.js";import"./shared-45feee83.js";import"./shared-92327224.js";import"./shared-98497473.js";import"./shared-9803aa7c.js";import"./shared-4e709717.js";import"./shared-2188d5f7.js";import"./shared-8e9a3bbb.js";import"./shared-f1317609.js";import"./shared-31c43743.js";import"./shared-63685d2e.js";import"./shared-4e201e09.js";import"./shared-dc23b751.js";import"./shared-a052131e.js";import"./shared-99940888.js";import"./shared-7c8bb60c.js";import"./shared-2bdd4f74.js";import"./shared-6d104622.js";import"./shared-ac44429d.js";import"./shared-7684cb05.js";import"./shared-b738ee96.js";
1
+ import"./shared-d28ac9dc.js";import"./shared-c5c60417.js";import"./shared-0b65fb12.js";import"./foxy-spinner.js";import"./shared-47e4ea34.js";export{U as UserForm}from"./shared-ff649616.js";import"./shared-195fd5af.js";import"./shared-ae415a98.js";import"./shared-62169210.js";import"./shared-fadcb2e1.js";import"./shared-dc73b9a5.js";import"./shared-ab008382.js";import"./shared-dd29b736.js";import"./shared-c87447a4.js";import"./shared-92a6c959.js";import"./shared-9803aa7c.js";import"./shared-4e709717.js";import"./shared-2188d5f7.js";import"./shared-8e9a3bbb.js";import"./shared-f1317609.js";import"./shared-31c43743.js";import"./shared-ed9d70f7.js";import"./shared-4e201e09.js";import"./shared-dc23b751.js";import"./shared-a052131e.js";import"./shared-99940888.js";import"./shared-1ba08bcc.js";import"./shared-ce24fef8.js";import"./shared-6d104622.js";import"./shared-ba59c811.js";import"./shared-7684cb05.js";import"./shared-b738ee96.js";
@@ -1 +1 @@
1
- import"./shared-c5c60417.js";import"./foxy-form-dialog.js";import{r as s}from"./shared-7c612495.js";import"./foxy-spinner.js";import"./shared-c309e0ef.js";import{h as e}from"./shared-dc73b9a5.js";import{T as a}from"./shared-7474af47.js";import{a as t}from"./shared-62169210.js";import"./shared-195fd5af.js";import"./shared-ae415a98.js";import"./shared-bb686fc6.js";import"./shared-fadcb2e1.js";import"./shared-c8677ba3.js";import"./shared-45feee83.js";import"./shared-92327224.js";import"./shared-98497473.js";import"./shared-9803aa7c.js";import"./shared-4e709717.js";import"./shared-7684cb05.js";import"./shared-d28ac9dc.js";import"./shared-f1317609.js";import"./shared-2188d5f7.js";import"./shared-31c43743.js";import"./shared-63685d2e.js";import"./shared-4e201e09.js";import"./shared-dc23b751.js";import"./shared-a052131e.js";import"./shared-99940888.js";import"./shared-7c8bb60c.js";import"./shared-2bdd4f74.js";import"./shared-6d104622.js";import"./shared-ac44429d.js";import"./shared-b738ee96.js";import"./shared-8e9a3bbb.js";import"./foxy-nucleon-element.js";let r,o,d,i,m,n,l,p=s=>s;class c extends(t(a,"users-table")){constructor(){super(...arguments),this.columns=[c.nameColumn,c.emailColumn,c.rolesColumn,c.lastUpdatedColumn,c.actionsColumn]}render(){return e(r||(r=p` <foxy-form-dialog parent="${0}" form="foxy-user-form" lang="${0}" ns="${0}" id="form"> </foxy-form-dialog> ${0} `),this.href,this.lang,this.ns,super.render())}}c.nameColumn={cell:s=>e(o||(o=p` <span data-testclass="name" class="text-m font-medium"> ${0} ${0} </span> `),s.data.first_name,s.data.last_name)},c.emailColumn={hideBelow:"md",cell:s=>e(d||(d=p` <span data-testclass="email" class="text-m text-secondary">${0}</span> `),s.data.email)},c.rolesColumn={cell:a=>e(i||(i=p` <div data-testclass="roles" class="flex space-x-s"> ${0} </div> `),["is_merchant","is_programmer","is_front_end_developer","is_designer"].map((t=>e(m||(m=p` <div class="${0}" style="width:1rem;height:1rem"> ${0} </div> `),a.data[t]?"":"text-disabled",s.find((s=>s.property===t)).icon))))},c.lastUpdatedColumn={hideBelow:"lg",cell:s=>e(n||(n=p` <span data-testclass="lastUpdated" class="text-m text-secondary font-tnum"> <foxy-i18n options="${0}" lang="${0}" key="date" ns="${0}"> </foxy-i18n> <foxy-i18n options="${0}" lang="${0}" key="time" ns="${0}"> </foxy-i18n> </span> `),JSON.stringify({value:s.data.date_modified}),s.lang,s.ns,JSON.stringify({value:s.data.date_modified}),s.lang,s.ns)},c.actionsColumn={cell:s=>e(l||(l=p` <vaadin-button data-testclass="actions" theme="tertiary small" @click="${0}"> <foxy-i18n lang="${0}" key="update" ns="${0}"></foxy-i18n> </vaadin-button> `),(e=>{const a=e.target,t=a.getRootNode().querySelector("#form");t.href=s.data._links.self.href,t.show(a)}),s.lang,s.ns)},customElements.define("foxy-users-table",c);export{c as UsersTable};
1
+ import"./shared-c5c60417.js";import"./foxy-form-dialog.js";import{r as s}from"./shared-ff649616.js";import"./foxy-spinner.js";import"./shared-47e4ea34.js";import{h as e}from"./shared-dc73b9a5.js";import{T as a}from"./shared-321572bc.js";import{a as t}from"./shared-62169210.js";import"./shared-195fd5af.js";import"./shared-ae415a98.js";import"./shared-0b65fb12.js";import"./shared-fadcb2e1.js";import"./shared-ab008382.js";import"./shared-dd29b736.js";import"./shared-c87447a4.js";import"./shared-92a6c959.js";import"./shared-9803aa7c.js";import"./shared-4e709717.js";import"./shared-7684cb05.js";import"./shared-d28ac9dc.js";import"./shared-f1317609.js";import"./shared-2188d5f7.js";import"./shared-31c43743.js";import"./shared-ed9d70f7.js";import"./shared-4e201e09.js";import"./shared-dc23b751.js";import"./shared-a052131e.js";import"./shared-99940888.js";import"./shared-1ba08bcc.js";import"./shared-ce24fef8.js";import"./shared-6d104622.js";import"./shared-ba59c811.js";import"./shared-b738ee96.js";import"./shared-8e9a3bbb.js";import"./foxy-nucleon-element.js";let r,o,d,i,m,n,l,p=s=>s;class c extends(t(a,"users-table")){constructor(){super(...arguments),this.columns=[c.nameColumn,c.emailColumn,c.rolesColumn,c.lastUpdatedColumn,c.actionsColumn]}render(){return e(r||(r=p` <foxy-form-dialog parent="${0}" form="foxy-user-form" lang="${0}" ns="${0}" id="form"> </foxy-form-dialog> ${0} `),this.href,this.lang,this.ns,super.render())}}c.nameColumn={cell:s=>e(o||(o=p` <span data-testclass="name" class="text-m font-medium"> ${0} ${0} </span> `),s.data.first_name,s.data.last_name)},c.emailColumn={hideBelow:"md",cell:s=>e(d||(d=p` <span data-testclass="email" class="text-m text-secondary">${0}</span> `),s.data.email)},c.rolesColumn={cell:a=>e(i||(i=p` <div data-testclass="roles" class="flex space-x-s"> ${0} </div> `),["is_merchant","is_programmer","is_front_end_developer","is_designer"].map((t=>e(m||(m=p` <div class="${0}" style="width:1rem;height:1rem"> ${0} </div> `),a.data[t]?"":"text-disabled",s.find((s=>s.property===t)).icon))))},c.lastUpdatedColumn={hideBelow:"lg",cell:s=>e(n||(n=p` <span data-testclass="lastUpdated" class="text-m text-secondary font-tnum"> <foxy-i18n options="${0}" lang="${0}" key="date" ns="${0}"> </foxy-i18n> <foxy-i18n options="${0}" lang="${0}" key="time" ns="${0}"> </foxy-i18n> </span> `),JSON.stringify({value:s.data.date_modified}),s.lang,s.ns,JSON.stringify({value:s.data.date_modified}),s.lang,s.ns)},c.actionsColumn={cell:s=>e(l||(l=p` <vaadin-button data-testclass="actions" theme="tertiary small" @click="${0}"> <foxy-i18n lang="${0}" key="update" ns="${0}"></foxy-i18n> </vaadin-button> `),(e=>{const a=e.target,t=a.getRootNode().querySelector("#form");t.href=s.data._links.self.href,t.show(a)}),s.lang,s.ns)},customElements.define("foxy-users-table",c);export{c as UsersTable};
@@ -1 +1 @@
1
- import"./shared-8e9a3bbb.js";import"./shared-2188d5f7.js";import{I as s}from"./shared-5c3a88d2.js";import{h as e}from"./shared-dc73b9a5.js";import{a}from"./shared-62169210.js";import"./shared-ae415a98.js";import"./foxy-spinner.js";import"./shared-c309e0ef.js";import"./shared-fadcb2e1.js";import"./shared-92327224.js";import"./shared-ac44429d.js";import"./shared-45feee83.js";import"./shared-7684cb05.js";import"./shared-7c8bb60c.js";import"./shared-4e709717.js";let i,r=s=>s;class o extends(a(s,"webhook-card")){renderBody(){var s,a,o,t;return e(i||(i=r` <div class="grid grid-cols-1 gap-s leading-none"> <p class="flex justify-between items-center font-semibold"> <span class="truncate">${0}&ZeroWidthSpace;</span> <span class="uppercase inline-block text-xs bg-contrast-5 rounded p-xs flex-shrink-0"> ${0}&ZeroWidthSpace; </span> </p> <div class="flex items-center gap-s text-secondary"> <iron-icon class="icon-inline flex-shrink-0" icon="icons:language"></iron-icon> <p class="truncate">${0}&ZeroWidthSpace;</p> </div> <div class="flex items-center gap-s text-secondary"> <iron-icon class="icon-inline flex-shrink-0" icon="icons:settings-input-antenna"> </iron-icon> <p class="truncate">${0}&ZeroWidthSpace;</p> </div> </div> `),null===(s=this.data)||void 0===s?void 0:s.name,null===(a=this.data)||void 0===a?void 0:a.format,null===(o=this.data)||void 0===o?void 0:o.url,null===(t=this.data)||void 0===t?void 0:t.event_resource)}}customElements.define("foxy-webhook-card",o);export{o as WebhookCard};
1
+ import"./shared-8e9a3bbb.js";import"./shared-2188d5f7.js";import{I as s}from"./shared-1992ba56.js";import{h as e}from"./shared-dc73b9a5.js";import{a}from"./shared-62169210.js";import"./shared-ae415a98.js";import"./foxy-spinner.js";import"./shared-47e4ea34.js";import"./shared-fadcb2e1.js";import"./shared-c87447a4.js";import"./shared-ba59c811.js";import"./shared-dd29b736.js";import"./shared-7684cb05.js";import"./shared-1ba08bcc.js";import"./shared-4e709717.js";let i,r=s=>s;class o extends(a(s,"webhook-card")){renderBody(){var s,a,o,t;return e(i||(i=r` <div class="grid grid-cols-1 gap-s leading-none"> <p class="flex justify-between items-center font-semibold"> <span class="truncate">${0}&ZeroWidthSpace;</span> <span class="uppercase inline-block text-xs bg-contrast-5 rounded p-xs flex-shrink-0"> ${0}&ZeroWidthSpace; </span> </p> <div class="flex items-center gap-s text-secondary"> <iron-icon class="icon-inline flex-shrink-0" icon="icons:language"></iron-icon> <p class="truncate">${0}&ZeroWidthSpace;</p> </div> <div class="flex items-center gap-s text-secondary"> <iron-icon class="icon-inline flex-shrink-0" icon="icons:settings-input-antenna"> </iron-icon> <p class="truncate">${0}&ZeroWidthSpace;</p> </div> </div> `),null===(s=this.data)||void 0===s?void 0:s.name,null===(a=this.data)||void 0===a?void 0:a.format,null===(o=this.data)||void 0===o?void 0:o.url,null===(t=this.data)||void 0===t?void 0:t.event_resource)}}customElements.define("foxy-webhook-card",o);export{o as WebhookCard};
@@ -1,4 +1,4 @@
1
- import"./shared-b3df4f38.js";import{E as e,C as t,T as r,D as o}from"./shared-195fd5af.js";import{h as i,G as s,P as a}from"./shared-ae415a98.js";import"./shared-d28ac9dc.js";import{F as n}from"./shared-2188d5f7.js";import{I as l}from"./shared-dc3ffd38.js";import"./shared-c309e0ef.js";import{_ as d}from"./shared-fadcb2e1.js";import{i as h}from"./shared-9803aa7c.js";import{h as c}from"./shared-dc73b9a5.js";import{I as u}from"./shared-8d4fef94.js";import"./foxy-webhook-status-card.js";import"./foxy-webhook-log-card.js";import{a as p}from"./shared-62169210.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-8e9a3bbb.js";import"./shared-92327224.js";import"./shared-98497473.js";import"./shared-ac44429d.js";import"./shared-45feee83.js";import"./shared-7684cb05.js";import"./shared-7c8bb60c.js";import"./shared-a0c6a159.js";import"./shared-99940888.js";import"./foxy-form-dialog.js";import"./shared-bb686fc6.js";import"./shared-c5c60417.js";import"./shared-c8677ba3.js";import"./shared-4e709717.js";import"./foxy-pagination.js";import"./shared-e1c1e8e2.js";import"./shared-5c3a88d2.js";const m=i`<dom-module id="lumo-radio-button" theme-for="vaadin-radio-button">
1
+ import"./shared-631dd765.js";import{E as e,C as t,T as r,D as o}from"./shared-195fd5af.js";import{h as i,G as s,P as a}from"./shared-ae415a98.js";import"./shared-d28ac9dc.js";import{F as n}from"./shared-2188d5f7.js";import{I as l}from"./shared-e8564a0b.js";import"./shared-47e4ea34.js";import{_ as d}from"./shared-fadcb2e1.js";import{i as h}from"./shared-9803aa7c.js";import{h as c}from"./shared-dc73b9a5.js";import{I as u}from"./shared-a65bca62.js";import"./foxy-webhook-status-card.js";import"./foxy-webhook-log-card.js";import{a as p}from"./shared-62169210.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-8e9a3bbb.js";import"./shared-c87447a4.js";import"./shared-92a6c959.js";import"./shared-ba59c811.js";import"./shared-dd29b736.js";import"./shared-7684cb05.js";import"./shared-1ba08bcc.js";import"./shared-a0c6a159.js";import"./shared-99940888.js";import"./foxy-form-dialog.js";import"./shared-0b65fb12.js";import"./shared-c5c60417.js";import"./shared-ab008382.js";import"./shared-4e709717.js";import"./foxy-pagination.js";import"./shared-e1c1e8e2.js";import"./shared-1992ba56.js";const m=i`<dom-module id="lumo-radio-button" theme-for="vaadin-radio-button">
2
2
  <template>
3
3
  <style>
4
4
  :host {
@@ -1 +1 @@
1
- import"./shared-c309e0ef.js";import{I as e}from"./shared-5c3a88d2.js";import{a as s}from"./shared-62169210.js";import{h as r}from"./shared-dc73b9a5.js";import"./shared-fadcb2e1.js";import"./shared-92327224.js";import"./foxy-spinner.js";import"./shared-2188d5f7.js";import"./shared-ae415a98.js";import"./shared-8e9a3bbb.js";import"./shared-ac44429d.js";import"./shared-45feee83.js";import"./shared-7684cb05.js";import"./shared-7c8bb60c.js";import"./shared-4e709717.js";let a,o=e=>e;class t extends(s(e,"webhook-log-card")){renderBody(){var e;const{date_created:s,response_code:t,response_body:d}=null!==(e=this.data)&&void 0!==e?e:{};return r(a||(a=o` <div class="leading-none space-y-xs"> <p class="flex justify-between items-center font-semibold"> <foxy-i18n .options="${0}" infer="" key="date"></foxy-i18n> <span class="inline-block text-xs bg-contrast-5 text-secondary rounded p-xs"> ${0}&ZeroWidthSpace; </span> </p> <p class="text-tertiary">${0}&ZeroWidthSpace;</p> </div> `),{value:s},t,d)}}customElements.define("foxy-webhook-log-card",t);export{t as WebhookLogCard};
1
+ import"./shared-47e4ea34.js";import{I as e}from"./shared-1992ba56.js";import{a as s}from"./shared-62169210.js";import{h as r}from"./shared-dc73b9a5.js";import"./shared-fadcb2e1.js";import"./shared-c87447a4.js";import"./foxy-spinner.js";import"./shared-2188d5f7.js";import"./shared-ae415a98.js";import"./shared-8e9a3bbb.js";import"./shared-ba59c811.js";import"./shared-dd29b736.js";import"./shared-7684cb05.js";import"./shared-1ba08bcc.js";import"./shared-4e709717.js";let a,o=e=>e;class t extends(s(e,"webhook-log-card")){renderBody(){var e;const{date_created:s,response_code:t,response_body:d}=null!==(e=this.data)&&void 0!==e?e:{};return r(a||(a=o` <div class="leading-none space-y-xs"> <p class="flex justify-between items-center font-semibold"> <foxy-i18n .options="${0}" infer="" key="date"></foxy-i18n> <span class="inline-block text-xs bg-contrast-5 text-secondary rounded p-xs"> ${0}&ZeroWidthSpace; </span> </p> <p class="text-tertiary">${0}&ZeroWidthSpace;</p> </div> `),{value:s},t,d)}}customElements.define("foxy-webhook-log-card",t);export{t as WebhookLogCard};
@@ -1 +1 @@
1
- import"./shared-c309e0ef.js";import{I as s}from"./shared-5c3a88d2.js";import{a as e}from"./shared-62169210.js";import{h as t}from"./shared-dc73b9a5.js";import{c as r}from"./shared-4e709717.js";import"./shared-fadcb2e1.js";import"./shared-92327224.js";import"./foxy-spinner.js";import"./shared-2188d5f7.js";import"./shared-ae415a98.js";import"./shared-8e9a3bbb.js";import"./shared-ac44429d.js";import"./shared-45feee83.js";import"./shared-7684cb05.js";import"./shared-7c8bb60c.js";let a,o=s=>s;const d=e(s,"webhook-status-card");class i extends d{renderBody(){var s,e;const d=null===(s=this.data)||void 0===s?void 0:s.status;return t(a||(a=o` <p class="flex justify-between items-center leading-none"> <foxy-i18n .options="${0}" class="font-semibold" infer="" key="date"> </foxy-i18n> <foxy-i18n class="${0}" infer="" key="status_${0}"> </foxy-i18n> </p> `),{value:null===(e=this.data)||void 0===e?void 0:e.date_created},r({"text-error":"failed"===d,"text-tertiary":"pending"===d,"text-success":"successful"===d}),d)}}customElements.define("foxy-webhook-status-card",i);export{i as WebhookStatusCard};
1
+ import"./shared-47e4ea34.js";import{I as s}from"./shared-1992ba56.js";import{a as e}from"./shared-62169210.js";import{h as t}from"./shared-dc73b9a5.js";import{c as a}from"./shared-4e709717.js";import"./shared-fadcb2e1.js";import"./shared-c87447a4.js";import"./foxy-spinner.js";import"./shared-2188d5f7.js";import"./shared-ae415a98.js";import"./shared-8e9a3bbb.js";import"./shared-ba59c811.js";import"./shared-dd29b736.js";import"./shared-7684cb05.js";import"./shared-1ba08bcc.js";let r,o=s=>s;const d=e(s,"webhook-status-card");class i extends d{renderBody(){var s,e;const d=null===(s=this.data)||void 0===s?void 0:s.status;return t(r||(r=o` <p class="flex justify-between items-center leading-none"> <foxy-i18n .options="${0}" class="font-semibold" infer="" key="date"> </foxy-i18n> <foxy-i18n class="${0}" infer="" key="status_${0}"> </foxy-i18n> </p> `),{value:null===(e=this.data)||void 0===e?void 0:e.date_created},a({"text-error":"failed"===d,"text-tertiary":"pending"===d,"text-success":"successful"===d}),d)}}customElements.define("foxy-webhook-status-card",i);export{i as WebhookStatusCard};
@@ -1 +1 @@
1
- import"./shared-c5c60417.js";import"./shared-c309e0ef.js";import{_ as t}from"./shared-fadcb2e1.js";import{h as e}from"./shared-dc73b9a5.js";import{D as s}from"./shared-c8677ba3.js";let i,n=t=>t;customElements.define("foxy-internal-confirm-dialog",class extends s{constructor(){super(...arguments),this.closable=!1,this.editable=!1,this.alert=!0,this.confirm="confirm",this.message="message",this.cancel="cancel",this.theme="primary"}static get properties(){return t(t({},super.properties),{},{confirm:{type:String},message:{type:String},cancel:{type:String},theme:{type:String}})}render(){return super.render((()=>e(i||(i=n` <foxy-i18n class="block font-lumo text-m text-body text-center mb-m" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> <div class="grid grid-cols-2 gap-m"> <vaadin-button data-testid="cancelButton" @click="${0}"> <foxy-i18n ns="${0}" lang="${0}" key="${0}"></foxy-i18n> </vaadin-button> <vaadin-button theme="${0}" data-testid="confirmButton" @click="${0}"> <foxy-i18n ns="${0}" lang="${0}" key="${0}"></foxy-i18n> </vaadin-button> </div> `),this.lang,this.message,this.ns,this.__handleCancel,this.ns,this.lang,this.cancel,this.theme,this.__handleConfirm,this.ns,this.lang,this.confirm)))}async __handleCancel(){await this.hide(!0)}async __handleConfirm(){await this.hide()}});
1
+ import"./shared-c5c60417.js";import"./shared-47e4ea34.js";import{_ as t}from"./shared-fadcb2e1.js";import{h as e}from"./shared-dc73b9a5.js";import{D as s}from"./shared-ab008382.js";let i,n=t=>t;customElements.define("foxy-internal-confirm-dialog",class extends s{constructor(){super(...arguments),this.closable=!1,this.editable=!1,this.alert=!0,this.confirm="confirm",this.message="message",this.cancel="cancel",this.theme="primary"}static get properties(){return t(t({},super.properties),{},{confirm:{type:String},message:{type:String},cancel:{type:String},theme:{type:String}})}render(){return super.render((()=>e(i||(i=n` <foxy-i18n class="block font-lumo text-m text-body text-center mb-m" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> <div class="grid grid-cols-2 gap-m"> <vaadin-button data-testid="cancelButton" @click="${0}"> <foxy-i18n ns="${0}" lang="${0}" key="${0}"></foxy-i18n> </vaadin-button> <vaadin-button theme="${0}" data-testid="confirmButton" @click="${0}"> <foxy-i18n ns="${0}" lang="${0}" key="${0}"></foxy-i18n> </vaadin-button> </div> `),this.lang,this.message,this.ns,this.__handleCancel,this.ns,this.lang,this.cancel,this.theme,this.__handleConfirm,this.ns,this.lang,this.confirm)))}async __handleCancel(){await this.hide(!0)}async __handleConfirm(){await this.hide()}});
@@ -1 +1 @@
1
- import"./foxy-spinner.js";import{T as e}from"./shared-62169210.js";import{N as i}from"./shared-ac44429d.js";import{c as s}from"./shared-4e709717.js";import{h as t}from"./shared-dc73b9a5.js";let n,r,a=e=>e;class o extends(e(i)){renderBody(){return t(n||(n=a``))}render(){return t(r||(r=a` <div aria-busy="${0}" aria-live="polite" class="relative leading-m text-body text-m font-lumo"> <div class="${0}"> ${0} </div> <div class="${0}"> <foxy-spinner layout="${0}" state="${0}" class="m-auto" infer="spinner"> </foxy-spinner> </div> </div> `),this.in("busy"),s({"transition duration-500 ease-in-out":!0,"opacity-0 pointer-events-none":!this.in({idle:"snapshot"})}),this.renderBody(),s({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":this.in({idle:"snapshot"})}),this.in("busy")?"no-label":"horizontal",this.in("fail")?"error":this.in({idle:"template"})?"empty":"busy")}}customElements.define("foxy-internal-card",o);export{o as I};
1
+ import"./foxy-spinner.js";import{T as e}from"./shared-62169210.js";import{N as i}from"./shared-ba59c811.js";import{c as s}from"./shared-4e709717.js";import{h as t}from"./shared-dc73b9a5.js";let n,r,a=e=>e;class o extends(e(i)){renderBody(){return t(n||(n=a``))}render(){return t(r||(r=a` <div aria-busy="${0}" aria-live="polite" class="relative leading-m text-body text-m font-lumo"> <div class="${0}"> ${0} </div> <div class="${0}"> <foxy-spinner layout="${0}" state="${0}" class="m-auto" infer="spinner"> </foxy-spinner> </div> </div> `),this.in("busy"),s({"transition duration-500 ease-in-out":!0,"opacity-0 pointer-events-none":!this.in({idle:"snapshot"})}),this.renderBody(),s({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":this.in({idle:"snapshot"})}),this.in("busy")?"no-label":"horizontal",this.in("fail")?"error":this.in({idle:"template"})?"empty":"busy")}}customElements.define("foxy-internal-card",o);export{o as I};
@@ -1 +1 @@
1
- import{_ as t,c as e,i as n,d as i,e as r,p as s,f as o,S as a,g as h,h as c,k as u,j as d,l,n as f,o as p,s as v,q as y,r as w,u as x,v as b,w as m,x as g,y as E,z as S,C as T,D as L,E as _,G as O,H as k,I as C,J as N,K as M,L as z,M as D,N as P,O as I,P as R}from"./shared-92327224.js";var q={deferEvents:!1},J=function(){function e(e){this.processingEvent=!1,this.queue=[],this.initialized=!1,this.options=t(t({},q),e)}return e.prototype.initialize=function(t){if(this.initialized=!0,t){if(!this.options.deferEvents)return void this.schedule(t);this.process(t)}this.flushEvents()},e.prototype.schedule=function(t){if(this.initialized&&!this.processingEvent){if(0!==this.queue.length)throw new Error("Event queue should be empty when it is not processing events");this.process(t),this.flushEvents()}else this.queue.push(t)},e.prototype.clear=function(){this.queue=[]},e.prototype.flushEvents=function(){for(var t=this.queue.shift();t;)this.process(t),t=this.queue.shift()},e.prototype.process=function(t){this.processingEvent=!0;try{t()}catch(t){throw this.clear(),t}finally{this.processingEvent=!1}},e}(),j=new Map,F=0,U=function(){return"x:"+F++},A=function(t,e){return j.set(t,e),t},X=function(t){return j.get(t)},V=function(t){j.delete(t)};function G(){return"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:void 0}var H,K={sync:!1,autoForward:!1};!function(t){t[t.NotStarted=0]="NotStarted",t[t.Running=1]="Running",t[t.Stopped=2]="Stopped"}(H||(H={}));var B=function(){function q(e,n){var i=this;void 0===n&&(n=q.defaultOptions),this.machine=e,this.scheduler=new J,this.delayedEventsMap={},this.listeners=new Set,this.contextListeners=new Set,this.stopListeners=new Set,this.doneListeners=new Set,this.eventListeners=new Set,this.sendListeners=new Set,this.initialized=!1,this.status=H.NotStarted,this.children=new Map,this.forwardTo=new Set,this.init=this.start,this.send=function(t,e){if(k(t))return i.batch(t),i.state;var n=d(C(t,e));if(i.status===H.Stopped)return i.state;if(i.status!==H.Running&&!i.options.deferEvents)throw new Error('Event "'+n.name+'" was sent to uninitialized service "'+i.machine.id+'". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.\nEvent: '+JSON.stringify(n.data));return i.scheduler.schedule((function(){i.forward(n);var t=i.nextState(n);i.update(t,n)})),i._state},this.sendTo=function(e,n){var r=i.parent&&(n===N.Parent||i.parent.id===n),s=r?i.parent:M(n)?i.children.get(n)||X(n):z(n)?n:void 0;if(s)"machine"in s?s.send(t(t({},e),{name:e.name===D?""+_(i.id):e.name,origin:i.sessionId})):s.send(e.data);else if(!r)throw new Error("Unable to send event to child '"+n+"' from service '"+i.id+"'.")};var r=t(t({},q.defaultOptions),n),s=r.clock,o=r.logger,a=r.parent,h=r.id,c=void 0!==h?h:e.id;this.id=c,this.logger=o,this.clock=s,this.parent=a,this.options=r,this.scheduler=new J({deferEvents:this.options.deferEvents}),this.sessionId=U()}return Object.defineProperty(q.prototype,"initialState",{get:function(){var t=this;return this._initialState?this._initialState:s(this,(function(){return t._initialState=t.machine.initialState,t._initialState}))},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),q.prototype.execute=function(t,n){var i,r;try{for(var s=e(t.actions),o=s.next();!o.done;o=s.next()){var a=o.value;this.exec(a,t,n)}}catch(t){i={error:t}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(i)throw i.error}}},q.prototype.update=function(t,s){var o,a,h,c,u,d,l,f,p=this;if(t._sessionid=this.sessionId,this._state=t,this.options.execute&&this.execute(this.state),this.children.forEach((function(t){p.state.children[t.id]=t})),this.devTools&&this.devTools.send(s.data,t),t.event)try{for(var v=e(this.eventListeners),y=v.next();!y.done;y=v.next()){(0,y.value)(t.event)}}catch(t){o={error:t}}finally{try{y&&!y.done&&(a=v.return)&&a.call(v)}finally{if(o)throw o.error}}try{for(var w=e(this.listeners),x=w.next();!x.done;x=w.next()){(0,x.value)(t,t.event)}}catch(t){h={error:t}}finally{try{x&&!x.done&&(c=w.return)&&c.call(w)}finally{if(h)throw h.error}}try{for(var b=e(this.contextListeners),m=b.next();!m.done;m=b.next()){(0,m.value)(this.state.context,this.state.history?this.state.history.context:void 0)}}catch(t){u={error:t}}finally{try{m&&!m.done&&(d=b.return)&&d.call(b)}finally{if(u)throw u.error}}var g=n(t.configuration||[],this.machine);if(this.state.configuration&&g){var E=t.configuration.find((function(t){return"final"===t.type&&t.parent===p.machine})),S=E&&E.doneData?i(E.doneData,t.context,s):void 0;try{for(var T=e(this.doneListeners),L=T.next();!L.done;L=T.next()){(0,L.value)(r(this.id,S))}}catch(t){l={error:t}}finally{try{L&&!L.done&&(f=T.return)&&f.call(T)}finally{if(l)throw l.error}}this.stop()}},q.prototype.onTransition=function(t){return this.listeners.add(t),this.status===H.Running&&t(this.state,this.state.event),this},q.prototype.subscribe=function(t,e,n){var i,r=this;if(!t)return{unsubscribe:function(){}};var s=n;return"function"==typeof t?i=t:(i=t.next.bind(t),s=t.complete.bind(t)),this.listeners.add(i),this.status===H.Running&&i(this.state),s&&this.onDone(s),{unsubscribe:function(){i&&r.listeners.delete(i),s&&r.doneListeners.delete(s)}}},q.prototype.onEvent=function(t){return this.eventListeners.add(t),this},q.prototype.onSend=function(t){return this.sendListeners.add(t),this},q.prototype.onChange=function(t){return this.contextListeners.add(t),this},q.prototype.onStop=function(t){return this.stopListeners.add(t),this},q.prototype.onDone=function(t){return this.doneListeners.add(t),this},q.prototype.off=function(t){return this.listeners.delete(t),this.eventListeners.delete(t),this.sendListeners.delete(t),this.stopListeners.delete(t),this.doneListeners.delete(t),this.contextListeners.delete(t),this},q.prototype.start=function(t){var e=this;if(this.status===H.Running)return this;A(this.sessionId,this),this.initialized=!0,this.status=H.Running;var n=void 0===t?this.initialState:s(this,(function(){return o(t)?e.machine.resolveState(t):e.machine.resolveState(a.from(t,e.machine.context))}));return this.options.devTools&&this.attachDev(),this.scheduler.initialize((function(){e.update(n,h)})),this},q.prototype.stop=function(){var t,n,i,r,s,o,a,h,d,l,f=this;try{for(var p=e(this.listeners),v=p.next();!v.done;v=p.next()){var y=v.value;this.listeners.delete(y)}}catch(e){t={error:e}}finally{try{v&&!v.done&&(n=p.return)&&n.call(p)}finally{if(t)throw t.error}}try{for(var w=e(this.stopListeners),x=w.next();!x.done;x=w.next()){(y=x.value)(),this.stopListeners.delete(y)}}catch(t){i={error:t}}finally{try{x&&!x.done&&(r=w.return)&&r.call(w)}finally{if(i)throw i.error}}try{for(var b=e(this.contextListeners),m=b.next();!m.done;m=b.next()){y=m.value;this.contextListeners.delete(y)}}catch(t){s={error:t}}finally{try{m&&!m.done&&(o=b.return)&&o.call(b)}finally{if(s)throw s.error}}try{for(var g=e(this.doneListeners),E=g.next();!E.done;E=g.next()){y=E.value;this.doneListeners.delete(y)}}catch(t){a={error:t}}finally{try{E&&!E.done&&(h=g.return)&&h.call(g)}finally{if(a)throw a.error}}this.state.configuration.forEach((function(t){var n,i;try{for(var r=e(t.definition.exit),s=r.next();!s.done;s=r.next()){var o=s.value;f.exec(o,f.state)}}catch(t){n={error:t}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}})),this.children.forEach((function(t){c(t.stop)&&t.stop()}));try{for(var S=e(u(this.delayedEventsMap)),T=S.next();!T.done;T=S.next()){var L=T.value;this.clock.clearTimeout(this.delayedEventsMap[L])}}catch(t){d={error:t}}finally{try{T&&!T.done&&(l=S.return)&&l.call(S)}finally{if(d)throw d.error}}return this.scheduler.clear(),this.initialized=!1,this.status=H.Stopped,V(this.sessionId),this},q.prototype.batch=function(t){var n=this;if(this.status===H.NotStarted&&this.options.deferEvents);else if(this.status!==H.Running)throw new Error(t.length+' event(s) were sent to uninitialized service "'+this.machine.id+'". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.');this.scheduler.schedule((function(){var i,r,o=n.state,a=!1,h=[],c=function(t){var e=d(t);n.forward(e),o=s(n,(function(){return n.machine.transition(o,e)})),h.push.apply(h,P(o.actions.map((function(t){return I(t,o)})))),a=a||!!o.changed};try{for(var u=e(t),l=u.next();!l.done;l=u.next()){c(l.value)}}catch(t){i={error:t}}finally{try{l&&!l.done&&(r=u.return)&&r.call(u)}finally{if(i)throw i.error}}o.changed=a,o.actions=h,n.update(o,d(t[t.length-1]))}))},q.prototype.sender=function(t){return this.send.bind(this,t)},q.prototype.nextState=function(t){var e=this,n=d(t);if(0===n.name.indexOf(l)&&!this.state.nextEvents.some((function(t){return 0===t.indexOf(l)})))throw n.data.data;return s(this,(function(){return e.machine.transition(e.state,n)}))},q.prototype.forward=function(t){var n,i;try{for(var r=e(this.forwardTo),s=r.next();!s.done;s=r.next()){var o=s.value,a=this.children.get(o);if(!a)throw new Error("Unable to forward event '"+t+"' from interpreter '"+this.id+"' to nonexistant child '"+o+"'.");a.send(t)}}catch(t){n={error:t}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}},q.prototype.defer=function(t){var e=this;this.delayedEventsMap[t.id]=this.clock.setTimeout((function(){t.to?e.sendTo(t._event,t.to):e.send(t._event)}),t.delay)},q.prototype.cancel=function(t){this.clock.clearTimeout(this.delayedEventsMap[t]),delete this.delayedEventsMap[t]},q.prototype.exec=function(t,e,n){void 0===n&&(n=this.machine.options.actions);var r=e.context,s=e._event,o=t.exec||f(t.type,n),a=c(o)?o:o?o.exec:t.exec;if(a)try{return a(r,s.data,{action:t,state:this.state,_event:s})}catch(t){throw this.parent&&this.parent.send({type:"xstate.error",data:t}),t}switch(t.type){case S:var h=t;if("number"==typeof h.delay)return void this.defer(h);h.to?this.sendTo(h._event,h.to):this.send(h._event);break;case E:this.cancel(t.sendId);break;case y:var u=t.activity;if(!this.state.activities[u.id||u.type])break;if(u.type===w.Invoke){var d=x(u.src),l=this.machine.options.services?this.machine.options.services[d.type]:void 0,T=u.id,L=u.data,_="autoForward"in u?u.autoForward:!!u.forward;if(!l)return;var O=L?i(L,r,s):void 0,k=c(l)?l(r,s.data,{data:O,src:d}):l;b(k)?this.spawnPromise(Promise.resolve(k),T):c(k)?this.spawnCallback(k,T):m(k)?this.spawnObservable(k,T):g(k)&&this.spawnMachine(O?k.withContext(O):k,{id:T,autoForward:_})}else this.spawnActivity(u);break;case v:this.stopChild(t.activity.id);break;case p:var C=t.label,N=t.value;C?this.logger(C,N):this.logger(N)}},q.prototype.removeChild=function(t){this.children.delete(t),this.forwardTo.delete(t),delete this.state.children[t]},q.prototype.stopChild=function(t){var e=this.children.get(t);e&&(this.removeChild(t),c(e.stop)&&e.stop())},q.prototype.spawn=function(e,n,i){if(b(e))return this.spawnPromise(Promise.resolve(e),n);if(c(e))return this.spawnCallback(e,n);if(T(e))return this.spawnActor(e);if(m(e))return this.spawnObservable(e,n);if(g(e))return this.spawnMachine(e,t(t({},i),{id:n}));throw new Error('Unable to spawn entity "'+n+'" of type "'+typeof e+'".')},q.prototype.spawnMachine=function(e,n){var i=this;void 0===n&&(n={});var r=new q(e,t(t({},this.options),{parent:this,id:n.id||e.id})),s=t(t({},K),n);s.sync&&r.onTransition((function(t){i.send(L,{state:t,id:r.id})}));var o=r;return this.children.set(r.id,o),s.autoForward&&this.forwardTo.add(r.id),r.onDone((function(t){i.removeChild(r.id),i.send(d(t,{origin:r.id}))})).start(),o},q.prototype.spawnPromise=function(t,e){var n=this,i=!1;t.then((function(t){i||(n.removeChild(e),n.send(d(r(e,t),{origin:e})))}),(function(t){if(!i){n.removeChild(e);var r=_(e,t);try{n.send(d(r,{origin:e}))}catch(t){n.devTools&&n.devTools.send(r,n.state),n.machine.strict&&n.stop()}}}));var s={id:e,send:function(){},subscribe:function(e,n,i){var r=R(e,n,i),s=!1;return t.then((function(t){s||(r.next(t),s||r.complete())}),(function(t){s||r.error(t)})),{unsubscribe:function(){return s=!0}}},stop:function(){i=!0},toJSON:function(){return{id:e}}};return this.children.set(e,s),s},q.prototype.spawnCallback=function(t,e){var n,i=this,r=!1,s=new Set,o=new Set;try{n=t((function(t){o.forEach((function(e){return e(t)})),r||i.send(d(t,{origin:e}))}),(function(t){s.add(t)}))}catch(t){this.send(_(e,t))}if(b(n))return this.spawnPromise(n,e);var a={id:e,send:function(t){return s.forEach((function(e){return e(t)}))},subscribe:function(t){return o.add(t),{unsubscribe:function(){o.delete(t)}}},stop:function(){r=!0,c(n)&&n()},toJSON:function(){return{id:e}}};return this.children.set(e,a),a},q.prototype.spawnObservable=function(t,e){var n=this,i=t.subscribe((function(t){n.send(d(t,{origin:e}))}),(function(t){n.removeChild(e),n.send(d(_(e,t),{origin:e}))}),(function(){n.removeChild(e),n.send(d(r(e),{origin:e}))})),s={id:e,send:function(){},subscribe:function(e,n,i){return t.subscribe(e,n,i)},stop:function(){return i.unsubscribe()},toJSON:function(){return{id:e}}};return this.children.set(e,s),s},q.prototype.spawnActor=function(t){return this.children.set(t.id,t),t},q.prototype.spawnActivity=function(t){var e=this.machine.options&&this.machine.options.activities?this.machine.options.activities[t.type]:void 0;if(e){var n=e(this.state.context,t);this.spawnEffect(t.id,n)}},q.prototype.spawnEffect=function(t,e){this.children.set(t,{id:t,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},stop:e||void 0,toJSON:function(){return{id:t}}})},q.prototype.attachDev=function(){var e=G();if(this.options.devTools&&e&&e.__REDUX_DEVTOOLS_EXTENSION__){var n="object"==typeof this.options.devTools?this.options.devTools:void 0;this.devTools=e.__REDUX_DEVTOOLS_EXTENSION__.connect(t(t({name:this.id,autoPause:!0,stateSanitizer:function(t){return{value:t.value,context:t.context,actions:t.actions}}},n),{features:t({jump:!1,skip:!1},n?n.features:void 0)}),this.machine),this.devTools.init(this.state)}},q.prototype.toJSON=function(){return{id:this.id}},q.prototype[O]=function(){return this},q.defaultOptions=function(t){return{execute:!0,deferEvents:!0,clock:{setTimeout:function(t,e){return setTimeout(t,e)},clearTimeout:function(t){return clearTimeout(t)}},logger:t.console.log.bind(console),devTools:!1}}("undefined"!=typeof self?self:global),q.interpret=Q,q}();function Q(t,e){return new B(t,e)}export{Q as i};
1
+ import{_ as t,c as e,i as n,d as i,e as r,p as s,f as o,S as a,g as h,h as c,k as u,j as d,l,n as f,o as p,s as v,q as y,r as w,u as x,v as b,w as m,x as g,y as E,z as S,C as T,D as L,E as _,G as O,H as k,I as C,J as N,K as M,L as z,M as D,N as P,O as I,P as R}from"./shared-c87447a4.js";var q={deferEvents:!1},J=function(){function e(e){this.processingEvent=!1,this.queue=[],this.initialized=!1,this.options=t(t({},q),e)}return e.prototype.initialize=function(t){if(this.initialized=!0,t){if(!this.options.deferEvents)return void this.schedule(t);this.process(t)}this.flushEvents()},e.prototype.schedule=function(t){if(this.initialized&&!this.processingEvent){if(0!==this.queue.length)throw new Error("Event queue should be empty when it is not processing events");this.process(t),this.flushEvents()}else this.queue.push(t)},e.prototype.clear=function(){this.queue=[]},e.prototype.flushEvents=function(){for(var t=this.queue.shift();t;)this.process(t),t=this.queue.shift()},e.prototype.process=function(t){this.processingEvent=!0;try{t()}catch(t){throw this.clear(),t}finally{this.processingEvent=!1}},e}(),j=new Map,F=0,U=function(){return"x:"+F++},A=function(t,e){return j.set(t,e),t},X=function(t){return j.get(t)},V=function(t){j.delete(t)};function G(){return"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:void 0}var H,K={sync:!1,autoForward:!1};!function(t){t[t.NotStarted=0]="NotStarted",t[t.Running=1]="Running",t[t.Stopped=2]="Stopped"}(H||(H={}));var B=function(){function q(e,n){var i=this;void 0===n&&(n=q.defaultOptions),this.machine=e,this.scheduler=new J,this.delayedEventsMap={},this.listeners=new Set,this.contextListeners=new Set,this.stopListeners=new Set,this.doneListeners=new Set,this.eventListeners=new Set,this.sendListeners=new Set,this.initialized=!1,this.status=H.NotStarted,this.children=new Map,this.forwardTo=new Set,this.init=this.start,this.send=function(t,e){if(k(t))return i.batch(t),i.state;var n=d(C(t,e));if(i.status===H.Stopped)return i.state;if(i.status!==H.Running&&!i.options.deferEvents)throw new Error('Event "'+n.name+'" was sent to uninitialized service "'+i.machine.id+'". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.\nEvent: '+JSON.stringify(n.data));return i.scheduler.schedule((function(){i.forward(n);var t=i.nextState(n);i.update(t,n)})),i._state},this.sendTo=function(e,n){var r=i.parent&&(n===N.Parent||i.parent.id===n),s=r?i.parent:M(n)?i.children.get(n)||X(n):z(n)?n:void 0;if(s)"machine"in s?s.send(t(t({},e),{name:e.name===D?""+_(i.id):e.name,origin:i.sessionId})):s.send(e.data);else if(!r)throw new Error("Unable to send event to child '"+n+"' from service '"+i.id+"'.")};var r=t(t({},q.defaultOptions),n),s=r.clock,o=r.logger,a=r.parent,h=r.id,c=void 0!==h?h:e.id;this.id=c,this.logger=o,this.clock=s,this.parent=a,this.options=r,this.scheduler=new J({deferEvents:this.options.deferEvents}),this.sessionId=U()}return Object.defineProperty(q.prototype,"initialState",{get:function(){var t=this;return this._initialState?this._initialState:s(this,(function(){return t._initialState=t.machine.initialState,t._initialState}))},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),q.prototype.execute=function(t,n){var i,r;try{for(var s=e(t.actions),o=s.next();!o.done;o=s.next()){var a=o.value;this.exec(a,t,n)}}catch(t){i={error:t}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(i)throw i.error}}},q.prototype.update=function(t,s){var o,a,h,c,u,d,l,f,p=this;if(t._sessionid=this.sessionId,this._state=t,this.options.execute&&this.execute(this.state),this.children.forEach((function(t){p.state.children[t.id]=t})),this.devTools&&this.devTools.send(s.data,t),t.event)try{for(var v=e(this.eventListeners),y=v.next();!y.done;y=v.next()){(0,y.value)(t.event)}}catch(t){o={error:t}}finally{try{y&&!y.done&&(a=v.return)&&a.call(v)}finally{if(o)throw o.error}}try{for(var w=e(this.listeners),x=w.next();!x.done;x=w.next()){(0,x.value)(t,t.event)}}catch(t){h={error:t}}finally{try{x&&!x.done&&(c=w.return)&&c.call(w)}finally{if(h)throw h.error}}try{for(var b=e(this.contextListeners),m=b.next();!m.done;m=b.next()){(0,m.value)(this.state.context,this.state.history?this.state.history.context:void 0)}}catch(t){u={error:t}}finally{try{m&&!m.done&&(d=b.return)&&d.call(b)}finally{if(u)throw u.error}}var g=n(t.configuration||[],this.machine);if(this.state.configuration&&g){var E=t.configuration.find((function(t){return"final"===t.type&&t.parent===p.machine})),S=E&&E.doneData?i(E.doneData,t.context,s):void 0;try{for(var T=e(this.doneListeners),L=T.next();!L.done;L=T.next()){(0,L.value)(r(this.id,S))}}catch(t){l={error:t}}finally{try{L&&!L.done&&(f=T.return)&&f.call(T)}finally{if(l)throw l.error}}this.stop()}},q.prototype.onTransition=function(t){return this.listeners.add(t),this.status===H.Running&&t(this.state,this.state.event),this},q.prototype.subscribe=function(t,e,n){var i,r=this;if(!t)return{unsubscribe:function(){}};var s=n;return"function"==typeof t?i=t:(i=t.next.bind(t),s=t.complete.bind(t)),this.listeners.add(i),this.status===H.Running&&i(this.state),s&&this.onDone(s),{unsubscribe:function(){i&&r.listeners.delete(i),s&&r.doneListeners.delete(s)}}},q.prototype.onEvent=function(t){return this.eventListeners.add(t),this},q.prototype.onSend=function(t){return this.sendListeners.add(t),this},q.prototype.onChange=function(t){return this.contextListeners.add(t),this},q.prototype.onStop=function(t){return this.stopListeners.add(t),this},q.prototype.onDone=function(t){return this.doneListeners.add(t),this},q.prototype.off=function(t){return this.listeners.delete(t),this.eventListeners.delete(t),this.sendListeners.delete(t),this.stopListeners.delete(t),this.doneListeners.delete(t),this.contextListeners.delete(t),this},q.prototype.start=function(t){var e=this;if(this.status===H.Running)return this;A(this.sessionId,this),this.initialized=!0,this.status=H.Running;var n=void 0===t?this.initialState:s(this,(function(){return o(t)?e.machine.resolveState(t):e.machine.resolveState(a.from(t,e.machine.context))}));return this.options.devTools&&this.attachDev(),this.scheduler.initialize((function(){e.update(n,h)})),this},q.prototype.stop=function(){var t,n,i,r,s,o,a,h,d,l,f=this;try{for(var p=e(this.listeners),v=p.next();!v.done;v=p.next()){var y=v.value;this.listeners.delete(y)}}catch(e){t={error:e}}finally{try{v&&!v.done&&(n=p.return)&&n.call(p)}finally{if(t)throw t.error}}try{for(var w=e(this.stopListeners),x=w.next();!x.done;x=w.next()){(y=x.value)(),this.stopListeners.delete(y)}}catch(t){i={error:t}}finally{try{x&&!x.done&&(r=w.return)&&r.call(w)}finally{if(i)throw i.error}}try{for(var b=e(this.contextListeners),m=b.next();!m.done;m=b.next()){y=m.value;this.contextListeners.delete(y)}}catch(t){s={error:t}}finally{try{m&&!m.done&&(o=b.return)&&o.call(b)}finally{if(s)throw s.error}}try{for(var g=e(this.doneListeners),E=g.next();!E.done;E=g.next()){y=E.value;this.doneListeners.delete(y)}}catch(t){a={error:t}}finally{try{E&&!E.done&&(h=g.return)&&h.call(g)}finally{if(a)throw a.error}}this.state.configuration.forEach((function(t){var n,i;try{for(var r=e(t.definition.exit),s=r.next();!s.done;s=r.next()){var o=s.value;f.exec(o,f.state)}}catch(t){n={error:t}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}})),this.children.forEach((function(t){c(t.stop)&&t.stop()}));try{for(var S=e(u(this.delayedEventsMap)),T=S.next();!T.done;T=S.next()){var L=T.value;this.clock.clearTimeout(this.delayedEventsMap[L])}}catch(t){d={error:t}}finally{try{T&&!T.done&&(l=S.return)&&l.call(S)}finally{if(d)throw d.error}}return this.scheduler.clear(),this.initialized=!1,this.status=H.Stopped,V(this.sessionId),this},q.prototype.batch=function(t){var n=this;if(this.status===H.NotStarted&&this.options.deferEvents);else if(this.status!==H.Running)throw new Error(t.length+' event(s) were sent to uninitialized service "'+this.machine.id+'". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.');this.scheduler.schedule((function(){var i,r,o=n.state,a=!1,h=[],c=function(t){var e=d(t);n.forward(e),o=s(n,(function(){return n.machine.transition(o,e)})),h.push.apply(h,P(o.actions.map((function(t){return I(t,o)})))),a=a||!!o.changed};try{for(var u=e(t),l=u.next();!l.done;l=u.next()){c(l.value)}}catch(t){i={error:t}}finally{try{l&&!l.done&&(r=u.return)&&r.call(u)}finally{if(i)throw i.error}}o.changed=a,o.actions=h,n.update(o,d(t[t.length-1]))}))},q.prototype.sender=function(t){return this.send.bind(this,t)},q.prototype.nextState=function(t){var e=this,n=d(t);if(0===n.name.indexOf(l)&&!this.state.nextEvents.some((function(t){return 0===t.indexOf(l)})))throw n.data.data;return s(this,(function(){return e.machine.transition(e.state,n)}))},q.prototype.forward=function(t){var n,i;try{for(var r=e(this.forwardTo),s=r.next();!s.done;s=r.next()){var o=s.value,a=this.children.get(o);if(!a)throw new Error("Unable to forward event '"+t+"' from interpreter '"+this.id+"' to nonexistant child '"+o+"'.");a.send(t)}}catch(t){n={error:t}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}},q.prototype.defer=function(t){var e=this;this.delayedEventsMap[t.id]=this.clock.setTimeout((function(){t.to?e.sendTo(t._event,t.to):e.send(t._event)}),t.delay)},q.prototype.cancel=function(t){this.clock.clearTimeout(this.delayedEventsMap[t]),delete this.delayedEventsMap[t]},q.prototype.exec=function(t,e,n){void 0===n&&(n=this.machine.options.actions);var r=e.context,s=e._event,o=t.exec||f(t.type,n),a=c(o)?o:o?o.exec:t.exec;if(a)try{return a(r,s.data,{action:t,state:this.state,_event:s})}catch(t){throw this.parent&&this.parent.send({type:"xstate.error",data:t}),t}switch(t.type){case S:var h=t;if("number"==typeof h.delay)return void this.defer(h);h.to?this.sendTo(h._event,h.to):this.send(h._event);break;case E:this.cancel(t.sendId);break;case y:var u=t.activity;if(!this.state.activities[u.id||u.type])break;if(u.type===w.Invoke){var d=x(u.src),l=this.machine.options.services?this.machine.options.services[d.type]:void 0,T=u.id,L=u.data,_="autoForward"in u?u.autoForward:!!u.forward;if(!l)return;var O=L?i(L,r,s):void 0,k=c(l)?l(r,s.data,{data:O,src:d}):l;b(k)?this.spawnPromise(Promise.resolve(k),T):c(k)?this.spawnCallback(k,T):m(k)?this.spawnObservable(k,T):g(k)&&this.spawnMachine(O?k.withContext(O):k,{id:T,autoForward:_})}else this.spawnActivity(u);break;case v:this.stopChild(t.activity.id);break;case p:var C=t.label,N=t.value;C?this.logger(C,N):this.logger(N)}},q.prototype.removeChild=function(t){this.children.delete(t),this.forwardTo.delete(t),delete this.state.children[t]},q.prototype.stopChild=function(t){var e=this.children.get(t);e&&(this.removeChild(t),c(e.stop)&&e.stop())},q.prototype.spawn=function(e,n,i){if(b(e))return this.spawnPromise(Promise.resolve(e),n);if(c(e))return this.spawnCallback(e,n);if(T(e))return this.spawnActor(e);if(m(e))return this.spawnObservable(e,n);if(g(e))return this.spawnMachine(e,t(t({},i),{id:n}));throw new Error('Unable to spawn entity "'+n+'" of type "'+typeof e+'".')},q.prototype.spawnMachine=function(e,n){var i=this;void 0===n&&(n={});var r=new q(e,t(t({},this.options),{parent:this,id:n.id||e.id})),s=t(t({},K),n);s.sync&&r.onTransition((function(t){i.send(L,{state:t,id:r.id})}));var o=r;return this.children.set(r.id,o),s.autoForward&&this.forwardTo.add(r.id),r.onDone((function(t){i.removeChild(r.id),i.send(d(t,{origin:r.id}))})).start(),o},q.prototype.spawnPromise=function(t,e){var n=this,i=!1;t.then((function(t){i||(n.removeChild(e),n.send(d(r(e,t),{origin:e})))}),(function(t){if(!i){n.removeChild(e);var r=_(e,t);try{n.send(d(r,{origin:e}))}catch(t){n.devTools&&n.devTools.send(r,n.state),n.machine.strict&&n.stop()}}}));var s={id:e,send:function(){},subscribe:function(e,n,i){var r=R(e,n,i),s=!1;return t.then((function(t){s||(r.next(t),s||r.complete())}),(function(t){s||r.error(t)})),{unsubscribe:function(){return s=!0}}},stop:function(){i=!0},toJSON:function(){return{id:e}}};return this.children.set(e,s),s},q.prototype.spawnCallback=function(t,e){var n,i=this,r=!1,s=new Set,o=new Set;try{n=t((function(t){o.forEach((function(e){return e(t)})),r||i.send(d(t,{origin:e}))}),(function(t){s.add(t)}))}catch(t){this.send(_(e,t))}if(b(n))return this.spawnPromise(n,e);var a={id:e,send:function(t){return s.forEach((function(e){return e(t)}))},subscribe:function(t){return o.add(t),{unsubscribe:function(){o.delete(t)}}},stop:function(){r=!0,c(n)&&n()},toJSON:function(){return{id:e}}};return this.children.set(e,a),a},q.prototype.spawnObservable=function(t,e){var n=this,i=t.subscribe((function(t){n.send(d(t,{origin:e}))}),(function(t){n.removeChild(e),n.send(d(_(e,t),{origin:e}))}),(function(){n.removeChild(e),n.send(d(r(e),{origin:e}))})),s={id:e,send:function(){},subscribe:function(e,n,i){return t.subscribe(e,n,i)},stop:function(){return i.unsubscribe()},toJSON:function(){return{id:e}}};return this.children.set(e,s),s},q.prototype.spawnActor=function(t){return this.children.set(t.id,t),t},q.prototype.spawnActivity=function(t){var e=this.machine.options&&this.machine.options.activities?this.machine.options.activities[t.type]:void 0;if(e){var n=e(this.state.context,t);this.spawnEffect(t.id,n)}},q.prototype.spawnEffect=function(t,e){this.children.set(t,{id:t,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},stop:e||void 0,toJSON:function(){return{id:t}}})},q.prototype.attachDev=function(){var e=G();if(this.options.devTools&&e&&e.__REDUX_DEVTOOLS_EXTENSION__){var n="object"==typeof this.options.devTools?this.options.devTools:void 0;this.devTools=e.__REDUX_DEVTOOLS_EXTENSION__.connect(t(t({name:this.id,autoPause:!0,stateSanitizer:function(t){return{value:t.value,context:t.context,actions:t.actions}}},n),{features:t({jump:!1,skip:!1},n?n.features:void 0)}),this.machine),this.devTools.init(this.state)}},q.prototype.toJSON=function(){return{id:this.id}},q.prototype[O]=function(){return this},q.defaultOptions=function(t){return{execute:!0,deferEvents:!0,clock:{setTimeout:function(t,e){return setTimeout(t,e)},clearTimeout:function(t){return clearTimeout(t)}},logger:t.console.log.bind(console),devTools:!1}}("undefined"!=typeof self?self:global),q.interpret=Q,q}();function Q(t,e){return new B(t,e)}export{Q as i};
@@ -1 +1 @@
1
- import{_ as e}from"./shared-fadcb2e1.js";import{h as t}from"./shared-dc73b9a5.js";import{C as l}from"./shared-98497473.js";import"./foxy-nucleon-element.js";import{R as s,T as a,a as i}from"./shared-62169210.js";import{c as r}from"./shared-4e709717.js";import{N as d}from"./shared-ac44429d.js";let n,o,h,c,m,u=e=>e;const b=l(s(a(i(d))));class p extends b{constructor(){super(...arguments),this.templates={},this.columns=[]}static get properties(){return e(e({},super.properties),{},{columns:{attribute:!1}})}render(){var e,l;const s=this.columns.some((e=>!!e.header));return t(n||(n=u` <div data-testid="wrapper" aria-busy="${0}" aria-live="polite" class="relative font-lumo text-m"> <table class="table-fixed w-full" data-testid="table"> <thead class="${0}"> <tr> ${0} </tr> </thead> <tbody class="divide-y divide-contrast-10"> ${0} </tbody> </table> ${0} </div> ${0} `),this.in("busy"),s?"border-b border-contrast-10":"sr-only",this.columns.map(((e,l)=>{var s;return t(o||(o=u` <th class="${0}"> ${0} </th> `),r({"truncate h-l text-tertiary text-m text-left font-medium":!0,"text-right":l===this.columns.length-1,"hidden sm-table-cell":"sm"===e.hideBelow,"hidden md-table-cell":"md"===e.hideBelow,"hidden lg-table-cell":"lg"===e.hideBelow,"hidden xl-table-cell":"xl"===e.hideBelow}),null===(s=e.header)||void 0===s?void 0:s.call(e,{html:t,lang:this.lang,data:this.data,ns:this.ns}))})),this.__rows.map((e=>{var l;return t(h||(h=u` <tr class="h-l"> ${0} </tr> `),null===(l=this.columns)||void 0===l?void 0:l.map(((l,s)=>{var a;return t(c||(c=u` <td class="${0}"> ${0} </td> `),r({"text-right":s===this.columns.length-1,"hidden sm-table-cell":"sm"===l.hideBelow,"hidden md-table-cell":"md"===l.hideBelow,"hidden lg-table-cell":"lg"===l.hideBelow,"hidden xl-table-cell":"xl"===l.hideBelow,"truncate h-l text-body":!0}),e?null===(a=l.cell)||void 0===a?void 0:a.call(l,{html:t,lang:this.lang,data:e,ns:this.ns}):"")})))})),this.in({idle:"snapshot"})?"":t(m||(m=u` <div class="absolute inset-0 flex items-center justify-center"> <foxy-spinner data-testid="spinner" layout="vertical" state="${0}" class="p-m bg-base shadow-xs rounded-t-l rounded-b-l" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> `),this.in("busy")?"busy":this.in("idle")?"empty":"error",this.lang,this.ns,null!==(l=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==l?l:""),this.renderTemplateOrSlot())}get __rows(){var e,t,l;const s=Object.values(null!==(t=null===(e=this.data)||void 0===e?void 0:e._embedded)&&void 0!==t?t:{}).reduce(((e,t)=>[...e,...t]),[]);let a;if(0===s.length)try{const e=new URL(null!==(l=this.href)&&void 0!==l?l:"").searchParams.get("limit"),t=parseInt(null!=e?e:"");a=isNaN(t)?20:t}catch(e){a=20}else a=s.length;return new Array(a).fill(null).map(((e,t)=>{var l;return null!==(l=s[t])&&void 0!==l?l:e}))}}export{p as T};
1
+ import{_ as e}from"./shared-fadcb2e1.js";import{h as t}from"./shared-dc73b9a5.js";import{C as l}from"./shared-92a6c959.js";import"./foxy-nucleon-element.js";import{R as s,T as a,a as i}from"./shared-62169210.js";import{c as r}from"./shared-4e709717.js";import{N as d}from"./shared-ba59c811.js";let n,o,h,c,m,u=e=>e;const b=l(s(a(i(d))));class p extends b{constructor(){super(...arguments),this.templates={},this.columns=[]}static get properties(){return e(e({},super.properties),{},{columns:{attribute:!1}})}render(){var e,l;const s=this.columns.some((e=>!!e.header));return t(n||(n=u` <div data-testid="wrapper" aria-busy="${0}" aria-live="polite" class="relative font-lumo text-m"> <table class="table-fixed w-full" data-testid="table"> <thead class="${0}"> <tr> ${0} </tr> </thead> <tbody class="divide-y divide-contrast-10"> ${0} </tbody> </table> ${0} </div> ${0} `),this.in("busy"),s?"border-b border-contrast-10":"sr-only",this.columns.map(((e,l)=>{var s;return t(o||(o=u` <th class="${0}"> ${0} </th> `),r({"truncate h-l text-tertiary text-m text-left font-medium":!0,"text-right":l===this.columns.length-1,"hidden sm-table-cell":"sm"===e.hideBelow,"hidden md-table-cell":"md"===e.hideBelow,"hidden lg-table-cell":"lg"===e.hideBelow,"hidden xl-table-cell":"xl"===e.hideBelow}),null===(s=e.header)||void 0===s?void 0:s.call(e,{html:t,lang:this.lang,data:this.data,ns:this.ns}))})),this.__rows.map((e=>{var l;return t(h||(h=u` <tr class="h-l"> ${0} </tr> `),null===(l=this.columns)||void 0===l?void 0:l.map(((l,s)=>{var a;return t(c||(c=u` <td class="${0}"> ${0} </td> `),r({"text-right":s===this.columns.length-1,"hidden sm-table-cell":"sm"===l.hideBelow,"hidden md-table-cell":"md"===l.hideBelow,"hidden lg-table-cell":"lg"===l.hideBelow,"hidden xl-table-cell":"xl"===l.hideBelow,"truncate h-l text-body":!0}),e?null===(a=l.cell)||void 0===a?void 0:a.call(l,{html:t,lang:this.lang,data:e,ns:this.ns}):"")})))})),this.in({idle:"snapshot"})?"":t(m||(m=u` <div class="absolute inset-0 flex items-center justify-center"> <foxy-spinner data-testid="spinner" layout="vertical" state="${0}" class="p-m bg-base shadow-xs rounded-t-l rounded-b-l" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> `),this.in("busy")?"busy":this.in("idle")?"empty":"error",this.lang,this.ns,null!==(l=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==l?l:""),this.renderTemplateOrSlot())}get __rows(){var e,t,l;const s=Object.values(null!==(t=null===(e=this.data)||void 0===e?void 0:e._embedded)&&void 0!==t?t:{}).reduce(((e,t)=>[...e,...t]),[]);let a;if(0===s.length)try{const e=new URL(null!==(l=this.href)&&void 0!==l?l:"").searchParams.get("limit"),t=parseInt(null!=e?e:"");a=isNaN(t)?20:t}catch(e){a=20}else a=s.length;return new Array(a).fill(null).map(((e,t)=>{var l;return null!==(l=s[t])&&void 0!==l?l:e}))}}export{p as T};
@@ -1 +1 @@
1
- import{I as e,_ as t}from"./shared-fadcb2e1.js";import{h as n,L as r}from"./shared-dc73b9a5.js";import{i as s,a}from"./shared-62169210.js";import{F as i,A as o}from"./shared-92327224.js";const c={type:"backend",init:()=>{},read:(e,t,n)=>{const r=async e=>{const t=e.ok?null:new Error(await e.text()),r=!!e.ok&&await e.json();n(t,r)},s=e=>{const t=e instanceof Error?e:new Error(String(e));n(t,!1)},a=new i("fetch",{cancelable:!0,composed:!0,bubbles:!0,request:new o.WHATWGRequest(`foxy://i18n/${t}/${e}`),resolve:r,reject:s});dispatchEvent(a),a.defaultPrevented||fetch(a.request).then(r).catch(s)},create:()=>{throw new Error("foxy-i18n does not support resource creation")}};function l(e,t=!1){var n;const r=e.replace(/(y|m|w|d)/,""),s=e.replace(/\.?\d+/,"");return{count:".5"===r?.5:parseInt(r),units:t&&null!==(n={y:"year",m:"month",w:"week",d:"day"}[s])&&void 0!==n?n:s}}const u={discount:({ns:e,type:t,details:n},r,s)=>{const a=t.endsWith("_percentage")?.01:1,i=n.split("|"),o=`${["allunits","incremental","repeat","single"].includes(i[0])?i.shift():"single"}_${t}_discount_summary`;return i.map((t=>{var n,r;const s=null!==(r=null===(n=/[-+]/.exec(t))||void 0===n?void 0:n.index)&&void 0!==r?r:-1,i=parseFloat(t.substring(s))*a,c=parseFloat(t.substring(0,s));return`$t(${o}, ${JSON.stringify({adjustment:i,from:c,ns:e})})`})).join("; ")},relative:(e,t,n)=>{const r=new Intl.RelativeTimeFormat(n);let{count:s,units:a}=l(e,!0);return.5===s&&"month"===a&&(s=2,a="week"),r.format(s,a)},percent:(e,t,n)=>{let r=null;try{"number"==typeof e&&(r=e.toLocaleString(n,{style:"percent"}))}catch(e){console.warn(`i18next formatter error: ${e.message}`)}return r||String(e)},ordinal:(e,t,n)=>`${e}$t(ordinal_${new Intl.PluralRules(n,{type:"ordinal"}).select(e)})`,price:(e,t,n,r)=>{var s;try{const[t,a]=e.split(" ");return parseFloat(t).toLocaleString(n,{maximumFractionDigits:2,minimumFractionDigits:2,currencyDisplay:null!==(s=null==r?void 0:r.currencyDisplay)&&void 0!==s?s:"symbol",style:"currency",currency:a})}catch(t){return e}},date:(e,t,n)=>{if(!e)return"$t(unknown)";const r=new Date(e),s=(new Date).getFullYear()===r.getFullYear()?void 0:"numeric";return r.toLocaleDateString(n,{month:"long",year:s,day:"numeric"})},time:(e,t,n)=>new Date(e).toLocaleTimeString(n,{hour:"numeric",minute:"numeric"})};let d,p=e=>e;class m extends(a(e(r),"")){constructor(){super(...arguments),this.options={},this.key=""}static onTranslationChange(e){const t=["initialized","loaded"],n=["removed","added"];return t.forEach((t=>m.i18next.on(t,e))),n.forEach((t=>m.i18next.store.on(t,e))),()=>{t.forEach((t=>m.i18next.off(t,e))),n.forEach((t=>m.i18next.store.off(t,e)))}}static onResourceFetch(e){const t=t=>{if(t instanceof i&&t.request.url.startsWith("foxy://i18n/")){const[n,r]=t.request.url.split("/").reverse();t.respondWith(e(r,n))}};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=m.onTranslationChange((()=>this.requestUpdate()))}render(){return n(d||(d=p`<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)}}m.FetchEvent=i,m.i18next=s.createInstance().use(c),m.i18next.init({interpolation:{format:(e,t="",n="en",r={})=>t.split(" ").filter((e=>!!e.trim())).reduce(((e,t)=>{var s,a;return null!==(a=null===(s=u[t])||void 0===s?void 0:s.call(u,e,t,n,r))&&void 0!==a?a:e}),e),escapeValue:!1},fallbackLng:"en",fallbackNS:"shared",defaultNS:"shared",ns:["shared"]}),customElements.define("foxy-i18n",m);export{m as I,l as p};
1
+ import{I as e,_ as t}from"./shared-fadcb2e1.js";import{h as n,L as r}from"./shared-dc73b9a5.js";import{i as s,a}from"./shared-62169210.js";import{F as i,A as o}from"./shared-c87447a4.js";const c={type:"backend",init:()=>{},read:(e,t,n)=>{const r=async e=>{const t=e.ok?null:new Error(await e.text()),r=!!e.ok&&await e.json();n(t,r)},s=e=>{const t=e instanceof Error?e:new Error(String(e));n(t,!1)},a=new i("fetch",{cancelable:!0,composed:!0,bubbles:!0,request:new o.WHATWGRequest(`foxy://i18n/${t}/${e}`),resolve:r,reject:s});dispatchEvent(a),a.defaultPrevented||fetch(a.request).then(r).catch(s)},create:()=>{throw new Error("foxy-i18n does not support resource creation")}};function l(e,t=!1){var n;const r=e.replace(/(y|m|w|d)/,""),s=e.replace(/\.?\d+/,"");return{count:".5"===r?.5:parseInt(r),units:t&&null!==(n={y:"year",m:"month",w:"week",d:"day"}[s])&&void 0!==n?n:s}}const u={discount:({ns:e,type:t,details:n},r,s)=>{const a=t.endsWith("_percentage")?.01:1,i=n.split("|"),o=`${["allunits","incremental","repeat","single"].includes(i[0])?i.shift():"single"}_${t}_discount_summary`;return i.map((t=>{var n,r;const s=null!==(r=null===(n=/[-+]/.exec(t))||void 0===n?void 0:n.index)&&void 0!==r?r:-1,i=parseFloat(t.substring(s))*a,c=parseFloat(t.substring(0,s));return`$t(${o}, ${JSON.stringify({adjustment:i,from:c,ns:e})})`})).join("; ")},relative:(e,t,n)=>{const r=new Intl.RelativeTimeFormat(n);let{count:s,units:a}=l(e,!0);return.5===s&&"month"===a&&(s=2,a="week"),r.format(s,a)},percent:(e,t,n)=>{let r=null;try{"number"==typeof e&&(r=e.toLocaleString(n,{style:"percent"}))}catch(e){console.warn(`i18next formatter error: ${e.message}`)}return r||String(e)},ordinal:(e,t,n)=>`${e}$t(ordinal_${new Intl.PluralRules(n,{type:"ordinal"}).select(e)})`,price:(e,t,n,r)=>{var s;try{const[t,a]=e.split(" ");return parseFloat(t).toLocaleString(n,{maximumFractionDigits:2,minimumFractionDigits:2,currencyDisplay:null!==(s=null==r?void 0:r.currencyDisplay)&&void 0!==s?s:"symbol",style:"currency",currency:a})}catch(t){return e}},date:(e,t,n)=>{if(!e)return"$t(unknown)";const r=new Date(e),s=(new Date).getFullYear()===r.getFullYear()?void 0:"numeric";return r.toLocaleDateString(n,{month:"long",year:s,day:"numeric"})},time:(e,t,n)=>new Date(e).toLocaleTimeString(n,{hour:"numeric",minute:"numeric"})};let d,p=e=>e;class m extends(a(e(r),"")){constructor(){super(...arguments),this.options={},this.key=""}static onTranslationChange(e){const t=["initialized","loaded"],n=["removed","added"];return t.forEach((t=>m.i18next.on(t,e))),n.forEach((t=>m.i18next.store.on(t,e))),()=>{t.forEach((t=>m.i18next.off(t,e))),n.forEach((t=>m.i18next.store.off(t,e)))}}static onResourceFetch(e){const t=t=>{if(t instanceof i&&t.request.url.startsWith("foxy://i18n/")){const[n,r]=t.request.url.split("/").reverse();t.respondWith(e(r,n))}};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=m.onTranslationChange((()=>this.requestUpdate()))}render(){return n(d||(d=p`<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)}}m.FetchEvent=i,m.i18next=s.createInstance().use(c),m.i18next.init({interpolation:{format:(e,t="",n="en",r={})=>t.split(" ").filter((e=>!!e.trim())).reduce(((e,t)=>{var s,a;return null!==(a=null===(s=u[t])||void 0===s?void 0:s.call(u,e,t,n,r))&&void 0!==a?a:e}),e),escapeValue:!1},fallbackLng:"en",fallbackNS:"shared",defaultNS:"shared",ns:["shared"]}),customElements.define("foxy-i18n",m);export{m as I,l as p};
@@ -1 +1 @@
1
- import"./foxy-collection-page.js";import"./foxy-form-dialog.js";import"./foxy-pagination.js";import"./shared-c309e0ef.js";import{a as e}from"./shared-8d4fef94.js";import"./shared-8e9a3bbb.js";import"./shared-2188d5f7.js";import{I as t,_ as r}from"./shared-fadcb2e1.js";import{L as i,h as s}from"./shared-dc73b9a5.js";import{T as o}from"./shared-62169210.js";import{c as n}from"./shared-4e709717.js";let a,l=e=>e;class c extends(o(t(i))){constructor(){super(...arguments),this.summary=null,this.open=!1}static get properties(){return r(r({},super.properties),{},{summary:{type:String},open:{type:Boolean}})}render(){var e;return s(a||(a=l` <details class="w-full border border-contrast-10 rounded-t-l rounded-b-l" ?open="${0}" @toggle="${0}"> <summary class="${0}"> <div class="flex items-center h-m pl-m pr-s"> <div class="flex items-center flex-1"> <foxy-i18n class="flex items-center text-xs tracking-wide uppercase font-bold text-body" infer="" key="${0}"> </foxy-i18n> <slot name="actions"></slot> </div> <iron-icon class="icon-inline text-xl text-body" icon="icons:expand-${0}"> </iron-icon> </div> </summary> <div class="border-t border-contrast-10"> <slot></slot> </div> </details> `),this.open,(e=>{this.open=e.currentTarget.open}),n({"focus-outline-none focus-ring-2 focus-ring-inset focus-ring-primary-50":!0,"transition-colors cursor-pointer hover-bg-contrast-5":!0,"rounded-t-l":!0,"rounded-b-l":!this.open}),null!==(e=this.summary)&&void 0!==e?e:"",this.open?"less":"more")}}customElements.define("foxy-internal-details",c);let d,f,m,h,p=e=>e;customElements.define("foxy-internal-async-details-control",class extends e{constructor(){super(...arguments),this.related=[],this.limit=20,this.first="",this.form="",this.item="",this.open=!1,this.__cachedCardRenderer=null,this.__itemRenderer=e=>{if(!this.form||!e.data)return this.__cardRenderer(e);const t=this.disabledSelector.matches("card",!0);return s(d||(d=p` <button ?disabled="${0}" class="${0}" @click="${0}"> ${0} </button> `),t,n({"focus-outline-none focus-ring-2 focus-ring-inset focus-ring-primary-50":!0,"text-left w-full block transition-colors":!0,"hover-bg-contrast-5":!t}),(t=>{const r=t.currentTarget,i=this.__dialog;i.header="header_update",i.href=e.href,i.show(r)}),this.__cardRenderer(e))}}static get properties(){return r(r({},super.properties),{},{related:{type:Array},first:{type:String},limit:{type:Number},form:{type:String},item:{type:String},open:{type:Boolean}})}renderControl(){let e;try{const t=new URL(this.first);t.searchParams.set("limit",String(this.limit)),e=t.toString()}catch(t){e=this.first}return s(f||(f=p` <foxy-internal-details summary="title" infer="" ?open="${0}" @toggle="${0}"> ${0} <foxy-pagination class="px-m pb-s" first="${0}" infer="pagination"> <foxy-collection-page class="-mx-m block divide-y divide-contrast-10 mb-s" infer="card" .related="${0}" .item="${0}"> </foxy-collection-page> </foxy-pagination> </foxy-internal-details> `),this.open,(e=>this.open=e.currentTarget.open),this.form?s(m||(m=p` <foxy-form-dialog parent="${0}" infer="dialog" id="form" .related="${0}" .form="${0}"> </foxy-form-dialog> ${0} `),e,this.related,this.form,this.readonly?"":s(h||(h=p` <button class="h-xs w-xs rounded-full text-success flex items-center justify-center text-l focus-outline-none focus-ring-2 focus-ring-primary-50" slot="actions" ?disabled="${0}" @click="${0}"> <iron-icon class="icon-inline" icon="icons:add"></iron-icon> </button> `),this.disabled,(e=>{e.preventDefault(),e.stopPropagation();const t=this.__dialog,r=e.currentTarget;t.header="header_create",t.href="",t.show(r)}))):"",e,this.related,this.__itemRenderer)}get __dialog(){return this.renderRoot.querySelector("#form")}get __cardRenderer(){var e;return(null===(e=this.__cachedCardRenderer)||void 0===e?void 0:e.item)!==this.item&&(this.__cachedCardRenderer={item:this.item,render:new Function("ctx",`return ctx.html\`<${this.item} related=\${JSON.stringify(ctx.related)} parent=\${ctx.parent} class="p-m" infer href=\${ctx.href}></${this.item}>\``)}),this.__cachedCardRenderer.render}});
1
+ import"./foxy-collection-page.js";import"./foxy-form-dialog.js";import"./foxy-pagination.js";import"./shared-47e4ea34.js";import{a as e}from"./shared-a65bca62.js";import"./shared-8e9a3bbb.js";import"./shared-2188d5f7.js";import{I as t,_ as r}from"./shared-fadcb2e1.js";import{L as i,h as s}from"./shared-dc73b9a5.js";import{T as o}from"./shared-62169210.js";import{c as n}from"./shared-4e709717.js";let a,l=e=>e;class c extends(o(t(i))){constructor(){super(...arguments),this.summary=null,this.open=!1}static get properties(){return r(r({},super.properties),{},{summary:{type:String},open:{type:Boolean}})}render(){var e;return s(a||(a=l` <details class="w-full border border-contrast-10 rounded-t-l rounded-b-l" ?open="${0}" @toggle="${0}"> <summary class="${0}"> <div class="flex items-center h-m pl-m pr-s"> <div class="flex items-center flex-1"> <foxy-i18n class="flex items-center text-xs tracking-wide uppercase font-bold text-body" infer="" key="${0}"> </foxy-i18n> <slot name="actions"></slot> </div> <iron-icon class="icon-inline text-xl text-body" icon="icons:expand-${0}"> </iron-icon> </div> </summary> <div class="border-t border-contrast-10"> <slot></slot> </div> </details> `),this.open,(e=>{this.open=e.currentTarget.open}),n({"focus-outline-none focus-ring-2 focus-ring-inset focus-ring-primary-50":!0,"transition-colors cursor-pointer hover-bg-contrast-5":!0,"rounded-t-l":!0,"rounded-b-l":!this.open}),null!==(e=this.summary)&&void 0!==e?e:"",this.open?"less":"more")}}customElements.define("foxy-internal-details",c);let d,m,f,h,p=e=>e;customElements.define("foxy-internal-async-details-control",class extends e{constructor(){super(...arguments),this.related=[],this.limit=20,this.first="",this.form="",this.item="",this.open=!1,this.__cachedCardRenderer=null,this.__itemRenderer=e=>{if(!this.form||!e.data)return this.__cardRenderer(e);const t=this.disabledSelector.matches("card",!0);return s(d||(d=p` <button ?disabled="${0}" class="${0}" @click="${0}"> ${0} </button> `),t,n({"focus-outline-none focus-ring-2 focus-ring-inset focus-ring-primary-50":!0,"text-left w-full block transition-colors":!0,"hover-bg-contrast-5":!t}),(t=>{const r=t.currentTarget,i=this.__dialog;i.header="header_update",i.href=e.href,i.show(r)}),this.__cardRenderer(e))}}static get properties(){return r(r({},super.properties),{},{related:{type:Array},first:{type:String},limit:{type:Number},form:{type:String},item:{type:String},open:{type:Boolean}})}renderControl(){let e;try{const t=new URL(this.first);t.searchParams.set("limit",String(this.limit)),e=t.toString()}catch(t){e=this.first}return s(m||(m=p` <foxy-internal-details summary="title" infer="" ?open="${0}" @toggle="${0}"> ${0} <foxy-pagination class="px-m pb-s" first="${0}" infer="pagination"> <foxy-collection-page class="-mx-m block divide-y divide-contrast-10 mb-s" infer="card" .related="${0}" .item="${0}"> </foxy-collection-page> </foxy-pagination> </foxy-internal-details> `),this.open,(e=>this.open=e.currentTarget.open),this.form?s(f||(f=p` <foxy-form-dialog parent="${0}" infer="dialog" id="form" .related="${0}" .form="${0}"> </foxy-form-dialog> ${0} `),e,this.related,this.form,this.readonly?"":s(h||(h=p` <button class="h-xs w-xs rounded-full text-success flex items-center justify-center text-l focus-outline-none focus-ring-2 focus-ring-primary-50" slot="actions" ?disabled="${0}" @click="${0}"> <iron-icon class="icon-inline" icon="icons:add"></iron-icon> </button> `),this.disabled,(e=>{e.preventDefault(),e.stopPropagation();const t=this.__dialog,r=e.currentTarget;t.header="header_create",t.href="",t.show(r)}))):"",e,this.related,this.__itemRenderer)}get __dialog(){return this.renderRoot.querySelector("#form")}get __cardRenderer(){var e;return(null===(e=this.__cachedCardRenderer)||void 0===e?void 0:e.item)!==this.item&&(this.__cachedCardRenderer={item:this.item,render:new Function("ctx",`return ctx.html\`<${this.item} related=\${JSON.stringify(ctx.related)} parent=\${ctx.parent} class="p-m" infer href=\${ctx.href}></${this.item}>\``)}),this.__cachedCardRenderer.render}});
@@ -1 +1 @@
1
- import{_ as t,I as e}from"./shared-fadcb2e1.js";import{h as s,L as i}from"./shared-dc73b9a5.js";import{C as r}from"./shared-98497473.js";import{a as n,T as o}from"./shared-62169210.js";import{c as a}from"./shared-4e709717.js";import{l}from"./shared-22ba9566.js";import{r as c}from"./shared-a0c6a159.js";let d,h,u,m=t=>t;const p=n(r(o(e(i))));class b extends p{constructor(){super(...arguments),this.options=[],this.items=[],this.__newItem=""}static get properties(){return t(t({},super.properties),{},{options:{type:Array},items:{type:Array},__newItem:{attribute:!1}})}render(){const t=a({"w-xs h-xs mr-xs rounded-full transition-colors flex-shrink-0":!0,"focus-outline-none focus-ring-2 ring-inset ring-error-50":!0,"text-tertiary hover-bg-error-10 hover-text-error":!this.disabled,"cursor-default text-disabled":this.disabled,"flex items-center justify-center":!this.readonly,hidden:this.readonly}),e=a({"transition-colors h-l ml-m flex items-center":!0,"text-secondary":this.readonly,"text-disabled":this.disabled}),i=this.disabled||!this.__newItem,r=()=>{this.__newItem&&(this.items.push({value:this.__newItem}),this.requestUpdate("items"),this.dispatchEvent(new CustomEvent("change")),this.__newItem="")};return s(d||(d=m` <slot></slot> <ol class="divide-y divide-contrast-10"> ${0} </ol> <div class="${0}"> <input placeholder="${0}" class="w-full bg-transparent appearance-none h-m focus-outline-none" list="list" .value="${0}" ?disabled="${0}" ?readonly="${0}" @keydown="${0}" @change="${0}" @input="${0}"> <datalist id="list"> ${0} </datalist> <div class="transition-opacity ${0}"> <button aria-label="${0}" class="${0}" ?disabled="${0}" @click="${0}"> <iron-icon icon="lumo:plus" class="icon-inline text-l"></iron-icon> </button> </div> </div> `),c(this.items,(t=>t.value),((i,r)=>{var n;return s(h||(h=m` <li class="${0}"> <div class="flex-1 mr-s">${0}</div> <button aria-label="${0}" class="${0}" ?disabled="${0}" @click="${0}"> <iron-icon icon="lumo:cross" class="icon-inline text-xl"></iron-icon> </button> </li> `),e,null!==(n=i.label)&&void 0!==n?n:i.value,this.t("delete"),t,this.disabled,(()=>{this.items.splice(r,1),this.requestUpdate("items"),this.dispatchEvent(new CustomEvent("change"))}))})),a({"ml-m h-l flex items-center":!0,"border-t border-contrast-10":this.items.length>0,flex:!this.readonly,hidden:this.readonly}),this.t("type_here"),l(this.__newItem),this.disabled,this.readonly,(t=>"Enter"===t.key&&r()),(t=>t.stopPropagation()),(t=>{this.__newItem=t.currentTarget.value.trim()}),this.options.map((({label:t,value:e})=>{if(!this.items.some((t=>t.value===e)))return s(u||(u=m`<option value="${0}">${0}</option>`),e,null!=t?t:e)})),this.__newItem?"opacity-100":"opacity-0",this.t("submit"),a({"w-xs h-xs mr-xs flex-shrink-0 ring-inset ring-success-50 focus-outline-none":!0,"flex items-center justify-center rounded-full transition-colors":!0,"bg-contrast-5 text-disabled cursor-default":i,"bg-success-10 text-success cursor-pointer":!i,"hover-bg-success hover-text-success-contrast":!i,"focus-ring-2":!i}),i,r)}}export{b as E};
1
+ import{_ as t,I as e}from"./shared-fadcb2e1.js";import{h as s,L as i}from"./shared-dc73b9a5.js";import{C as r}from"./shared-92a6c959.js";import{a as n,T as o}from"./shared-62169210.js";import{c as a}from"./shared-4e709717.js";import{l}from"./shared-22ba9566.js";import{r as c}from"./shared-a0c6a159.js";let d,h,u,m=t=>t;const p=n(r(o(e(i))));class b extends p{constructor(){super(...arguments),this.options=[],this.items=[],this.__newItem=""}static get properties(){return t(t({},super.properties),{},{options:{type:Array},items:{type:Array},__newItem:{attribute:!1}})}render(){const t=a({"w-xs h-xs mr-xs rounded-full transition-colors flex-shrink-0":!0,"focus-outline-none focus-ring-2 ring-inset ring-error-50":!0,"text-tertiary hover-bg-error-10 hover-text-error":!this.disabled,"cursor-default text-disabled":this.disabled,"flex items-center justify-center":!this.readonly,hidden:this.readonly}),e=a({"transition-colors h-l ml-m flex items-center":!0,"text-secondary":this.readonly,"text-disabled":this.disabled}),i=this.disabled||!this.__newItem,r=()=>{this.__newItem&&(this.items.push({value:this.__newItem}),this.requestUpdate("items"),this.dispatchEvent(new CustomEvent("change")),this.__newItem="")};return s(d||(d=m` <slot></slot> <ol class="divide-y divide-contrast-10"> ${0} </ol> <div class="${0}"> <input placeholder="${0}" class="w-full bg-transparent appearance-none h-m focus-outline-none" list="list" .value="${0}" ?disabled="${0}" ?readonly="${0}" @keydown="${0}" @change="${0}" @input="${0}"> <datalist id="list"> ${0} </datalist> <div class="transition-opacity ${0}"> <button aria-label="${0}" class="${0}" ?disabled="${0}" @click="${0}"> <iron-icon icon="lumo:plus" class="icon-inline text-l"></iron-icon> </button> </div> </div> `),c(this.items,(t=>t.value),((i,r)=>{var n;return s(h||(h=m` <li class="${0}"> <div class="flex-1 mr-s">${0}</div> <button aria-label="${0}" class="${0}" ?disabled="${0}" @click="${0}"> <iron-icon icon="lumo:cross" class="icon-inline text-xl"></iron-icon> </button> </li> `),e,null!==(n=i.label)&&void 0!==n?n:i.value,this.t("delete"),t,this.disabled,(()=>{this.items.splice(r,1),this.requestUpdate("items"),this.dispatchEvent(new CustomEvent("change"))}))})),a({"ml-m h-l flex items-center":!0,"border-t border-contrast-10":this.items.length>0,flex:!this.readonly,hidden:this.readonly}),this.t("type_here"),l(this.__newItem),this.disabled,this.readonly,(t=>"Enter"===t.key&&r()),(t=>t.stopPropagation()),(t=>{this.__newItem=t.currentTarget.value.trim()}),this.options.map((({label:t,value:e})=>{if(!this.items.some((t=>t.value===e)))return s(u||(u=m`<option value="${0}">${0}</option>`),e,null!=t?t:e)})),this.__newItem?"opacity-100":"opacity-0",this.t("submit"),a({"w-xs h-xs mr-xs flex-shrink-0 ring-inset ring-success-50 focus-outline-none":!0,"flex items-center justify-center rounded-full transition-colors":!0,"bg-contrast-5 text-disabled cursor-default":i,"bg-success-10 text-success cursor-pointer":!i,"hover-bg-success hover-text-success-contrast":!i,"focus-ring-2":!i}),i,r)}}export{b as E};
@@ -1 +1 @@
1
- import{_ as t}from"./shared-fadcb2e1.js";import{C as e}from"./shared-98497473.js";import{h as i}from"./shared-dc73b9a5.js";import{N as s}from"./shared-ac44429d.js";import{T as r}from"./shared-62169210.js";import{c as a}from"./shared-4e709717.js";let d,l,n,o=t=>t;const h=e(r(s));class p extends h{constructor(){super(...arguments),this.templates={},this.lang="",this.ns="",this.__renderTitle=t=>i(d||(d=o` <div data-testid="title"> ${0} <div class="text-secondary truncate"> ${0}&ZeroWidthSpace; </div> ${0} </div> `),this.renderTemplateOrSlot("title:before"),this.data?null==t?void 0:t(this.data):"",this.renderTemplateOrSlot("title:after")),this.__renderSubtitle=t=>i(l||(l=o` <div data-testid="subtitle"> ${0} <div class="font-semibold truncate"> ${0}&ZeroWidthSpace; </div> ${0} </div> `),this.renderTemplateOrSlot("subtitle:before"),this.data?null==t?void 0:t(this.data):"",this.renderTemplateOrSlot("subtitle:after"))}static get properties(){return t(t({},super.properties),{},{lang:{type:String},ns:{type:String}})}render(t){var e,s;const r=this.hiddenSelector;return i(n||(n=o` <div aria-live="polite" aria-busy="${0}" class="relative text-body text-m font-lumo leading-m"> ${0} ${0} <div class="${0}"> <foxy-spinner data-testid="spinner" class="m-auto" state="${0}" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),!this.data&&this.in("busy"),r.matches("title",!0)?"":this.__renderTitle(null==t?void 0:t.title),r.matches("subtitle",!0)?"":this.__renderSubtitle(null==t?void 0:t.subtitle),a({"transition duration-250 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":!!this.data}),this.in("fail")?"error":this.in({idle:"template"})?"empty":"busy",this.lang,this.ns,null!==(s=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==s?s:"")}}export{p as T};
1
+ import{_ as t}from"./shared-fadcb2e1.js";import{C as e}from"./shared-92a6c959.js";import{h as i}from"./shared-dc73b9a5.js";import{N as s}from"./shared-ba59c811.js";import{T as r}from"./shared-62169210.js";import{c as a}from"./shared-4e709717.js";let d,l,n,o=t=>t;const h=e(r(s));class p extends h{constructor(){super(...arguments),this.templates={},this.lang="",this.ns="",this.__renderTitle=t=>i(d||(d=o` <div data-testid="title"> ${0} <div class="text-secondary truncate"> ${0}&ZeroWidthSpace; </div> ${0} </div> `),this.renderTemplateOrSlot("title:before"),this.data?null==t?void 0:t(this.data):"",this.renderTemplateOrSlot("title:after")),this.__renderSubtitle=t=>i(l||(l=o` <div data-testid="subtitle"> ${0} <div class="font-semibold truncate"> ${0}&ZeroWidthSpace; </div> ${0} </div> `),this.renderTemplateOrSlot("subtitle:before"),this.data?null==t?void 0:t(this.data):"",this.renderTemplateOrSlot("subtitle:after"))}static get properties(){return t(t({},super.properties),{},{lang:{type:String},ns:{type:String}})}render(t){var e,s;const r=this.hiddenSelector;return i(n||(n=o` <div aria-live="polite" aria-busy="${0}" class="relative text-body text-m font-lumo leading-m"> ${0} ${0} <div class="${0}"> <foxy-spinner data-testid="spinner" class="m-auto" state="${0}" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),!this.data&&this.in("busy"),r.matches("title",!0)?"":this.__renderTitle(null==t?void 0:t.title),r.matches("subtitle",!0)?"":this.__renderSubtitle(null==t?void 0:t.subtitle),a({"transition duration-250 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":!!this.data}),this.in("fail")?"error":this.in({idle:"template"})?"empty":"busy",this.lang,this.ns,null!==(s=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==s?s:"")}}export{p as T};
@@ -1 +1 @@
1
- import{_ as e}from"./shared-fadcb2e1.js";import{B as t}from"./shared-c5c60417.js";import{c as r,h as s}from"./shared-dc73b9a5.js";import{y as n}from"./shared-62169210.js";import{I as o}from"./shared-2bdd4f74.js";let i,a,l,c=e=>e;class d{constructor(e="unknown"){this.type=e}}class h extends CustomEvent{constructor(){super("reload")}}class p extends n{constructor(){super(...arguments),this.type="unknown",this.reload=!1}static get scopedElements(){return{"vaadin-button":t,"iron-icon":customElements.get("iron-icon"),"x-i18n":o}}static get styles(){return[super.styles,r(i||(i=c`:host{position:absolute;top:0;right:0;bottom:0;left:0}.container-narrow{max-width:400px}`))]}static get properties(){return e(e({},super.properties),{},{reload:{type:Boolean,reflect:!0},type:{type:String}})}render(){return s(a||(a=c` <article class="bg-base font-lumo text-center leading-m p-m h-full flex flex-col items-center justify-center"> <iron-icon icon="lumo:error" class="text-error w-l h-l mb-m"></iron-icon> <header class="text-xl text-header container-narrow font-medium"> <x-i18n ns="${0}" lang="${0}" key="errors.${0}.title"></x-i18n> </header> <p class="text-m text-secondary container-narrow mb-l"> <x-i18n ns="${0}" lang="${0}" key="errors.${0}.message"></x-i18n> </p> <div class="flex space-x-s"> <a rel="nofollow noreferrer noopener" href="${0}" target="_blank" class="px-m py-xs text-primary font-medium tracking-wide border border-contrast-10 rounded transition-colors duration-200 hover-bg-primary-10 hover-border-primary-10 focus-outline-none focus-shadow-outline" router-ignore> <x-i18n ns="${0}" lang="${0}" key="errors.${0}.action"></x-i18n> </a> ${0} </div> </article> `),this.ns,this.lang,this.type,this.ns,this.lang,this.type,this._i18n.t(`errors.${this.type}.href`).toString(),this.ns,this.lang,this.type,this.reload?s(l||(l=c` <vaadin-button data-testid="reload" theme="primary" @click="${0}"> <x-i18n ns="${0}" lang="${0}" key="reload"></x-i18n> <iron-icon icon="icons:refresh" slot="suffix"></iron-icon> </vaadin-button> `),(()=>this.dispatchEvent(new h)),this.ns,this.lang):"")}}export{p as E,d as F};
1
+ import{_ as e}from"./shared-fadcb2e1.js";import{B as t}from"./shared-c5c60417.js";import{c as r,h as s}from"./shared-dc73b9a5.js";import{y as n}from"./shared-62169210.js";import{I as o}from"./shared-ce24fef8.js";let i,a,l,c=e=>e;class d{constructor(e="unknown"){this.type=e}}class h extends CustomEvent{constructor(){super("reload")}}class p extends n{constructor(){super(...arguments),this.type="unknown",this.reload=!1}static get scopedElements(){return{"vaadin-button":t,"iron-icon":customElements.get("iron-icon"),"x-i18n":o}}static get styles(){return[super.styles,r(i||(i=c`:host{position:absolute;top:0;right:0;bottom:0;left:0}.container-narrow{max-width:400px}`))]}static get properties(){return e(e({},super.properties),{},{reload:{type:Boolean,reflect:!0},type:{type:String}})}render(){return s(a||(a=c` <article class="bg-base font-lumo text-center leading-m p-m h-full flex flex-col items-center justify-center"> <iron-icon icon="lumo:error" class="text-error w-l h-l mb-m"></iron-icon> <header class="text-xl text-header container-narrow font-medium"> <x-i18n ns="${0}" lang="${0}" key="errors.${0}.title"></x-i18n> </header> <p class="text-m text-secondary container-narrow mb-l"> <x-i18n ns="${0}" lang="${0}" key="errors.${0}.message"></x-i18n> </p> <div class="flex space-x-s"> <a rel="nofollow noreferrer noopener" href="${0}" target="_blank" class="px-m py-xs text-primary font-medium tracking-wide border border-contrast-10 rounded transition-colors duration-200 hover-bg-primary-10 hover-border-primary-10 focus-outline-none focus-shadow-outline" router-ignore> <x-i18n ns="${0}" lang="${0}" key="errors.${0}.action"></x-i18n> </a> ${0} </div> </article> `),this.ns,this.lang,this.type,this.ns,this.lang,this.type,this._i18n.t(`errors.${this.type}.href`).toString(),this.ns,this.lang,this.type,this.reload?s(l||(l=c` <vaadin-button data-testid="reload" theme="primary" @click="${0}"> <x-i18n ns="${0}" lang="${0}" key="reload"></x-i18n> <iron-icon icon="icons:refresh" slot="suffix"></iron-icon> </vaadin-button> `),(()=>this.dispatchEvent(new h)),this.ns,this.lang):"")}}export{p as E,d as F};
@@ -1,4 +1,4 @@
1
- import{T as e,D as t,E as a,C as i}from"./shared-195fd5af.js";import{O as s,a as o,b as r,c as n,I as l}from"./shared-a052131e.js";import{h as d,G as h,P as u,D as c,t as p,b as m,s as _}from"./shared-ae415a98.js";import"./shared-c5c60417.js";import{T as f}from"./shared-d28ac9dc.js";import"./shared-2bdd4f74.js";import{D as v,t as g,f as y,a as b}from"./shared-2188d5f7.js";const D=d`<dom-module id="lumo-date-picker-overlay" theme-for="vaadin-date-picker-overlay">
1
+ import{T as e,D as t,E as a,C as i}from"./shared-195fd5af.js";import{O as s,a as o,b as r,c as n,I as l}from"./shared-a052131e.js";import{h as d,G as h,P as u,D as c,t as p,b as m,s as _}from"./shared-ae415a98.js";import"./shared-c5c60417.js";import{T as f}from"./shared-d28ac9dc.js";import"./shared-ce24fef8.js";import{D as v,t as g,f as y,a as b}from"./shared-2188d5f7.js";const D=d`<dom-module id="lumo-date-picker-overlay" theme-for="vaadin-date-picker-overlay">
2
2
  <template>
3
3
  <style include="lumo-menu-overlay">
4
4
  [part="overlay"] {
@@ -1 +1 @@
1
- import{_ as t}from"./shared-fadcb2e1.js";import"./shared-c5c60417.js";import{L as e,c as i,h as s}from"./shared-dc73b9a5.js";import{p as r}from"./shared-c309e0ef.js";import"./shared-2188d5f7.js";import"./shared-195fd5af.js";import"./shared-31c43743.js";import{w as a,S as n,y as o}from"./shared-62169210.js";import"./shared-63685d2e.js";import"./shared-c8677ba3.js";import{I as l,D as c}from"./shared-2bdd4f74.js";import{E as h}from"./shared-a0836fa5.js";import"./shared-4e201e09.js";import"./shared-d28ac9dc.js";import"./shared-dc23b751.js";import"./shared-a052131e.js";import"./shared-8e9a3bbb.js";import{s as d}from"./shared-99940888.js";class u extends CustomEvent{constructor(t){super("change",{detail:t})}}class m extends CustomEvent{constructor(t){super("submit",{detail:t,cancelable:!0})}}let _,p,g=t=>t;var y;!function(t){t[t.Excluded=0]="Excluded",t[t.BeforeEnter=1]="BeforeEnter",t[t.Default=2]="Default",t[t.Previous=3]="Previous",t[t.BeforeExit=4]="BeforeExit"}(y||(y={}));class f extends e{constructor(){super(...arguments),this.quantity=0,this.image=""}static get properties(){return t(t({},super.properties),{},{quantity:{attribute:!1},image:{attribute:!1}})}static get styles(){return[a.styles,i(_||(_=g`.ease-out-back{transition-timing-function:cubic-bezier(.34,1.56,.64,1)}.blur-1{filter:blur(1px)}.blur-2{filter:blur(2px)}.grayscale{filter:grayscale()}.rotate-12{--tw-rotate:12deg}.-rotate-12{--tw-rotate:-12deg}.-rotate-24{--tw-rotate:-24deg}.translate-y-half{--tw-translate-y:50%}`))]}set empty(t){this.updateComplete.then((()=>{if(t){const[,...t]=this.__stack;t.forEach((t=>t.remove()))}else this.quantity>1&&this.__stack.length<2&&this.__insertImage(y.Previous,this.__stack[0])}))}set data({quantity:t,image:e}){this.quantity=t,this.image=e}render(){return s(p||(p=g`<div id="image" class="w-full h-full relative"></div>`))}firstUpdated(){const t=this.__insertImage(y.Default);this.quantity>1&&this.__insertImage(y.Previous,t)}updated(t){if(t.has("quantity")){const e=t.get("quantity");void 0!==e&&(this.quantity>e?this.__add():this.__remove())}t.has("image")&&this.__stack.forEach((t=>t.src=this.image))}get __container(){return this.shadowRoot.getElementById("image")}get __stack(){var t,e;return[...null!==(e=null===(t=this.__container)||void 0===t?void 0:t.querySelectorAll(":not(.opacity-0)"))&&void 0!==e?e:[]].reverse()}__add(){const[t,e]=this.__stack;this.quantity>1?(t&&this.__setImageState(t,y.Previous),e&&(this.__setImageState(e,y.BeforeExit),e.ontransitionend=()=>e.remove()),this.__setImageState(this.__insertImage(y.BeforeEnter),y.Default)):t&&this.__setImageState(t,y.Default)}__remove(){const[t,e]=this.__stack;let i;if(this.quantity>0?(e&&this.__setImageState(e,y.Default),i=t):(t&&this.__setImageState(t,y.Excluded),i=e),i&&(this.__setImageState(i,y.BeforeEnter),i.ontransitionend=()=>i.remove()),this.quantity>1){const t=this.__insertImage(y.BeforeExit,this.__container.firstElementChild);this.__setImageState(t,y.Previous)}}__insertImage(t,e=null){const i=new Image;return i.src=this.image,i.setAttribute("part","picture"),i.addEventListener("error",(()=>i.src=f.placeholder)),this.__setImageState(i,t),this.__container.insertBefore(i,e),i}__setImageState(t,e){t.offsetHeight,t.className=["absolute inset-0 w-full h-full object-cover rounded transform transition duration-700 ease-out-back",["grayscale","shadow-m translate-y-half scale-110 rotate-12 opacity-0","shadow-m","blur-1 -rotate-12 opacity-25","blur-2 -rotate-24 opacity-0"][e]].join(" ")}}f.placeholder='data:image/svg+xml,%3Csvg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg"%3E%3Crect width="40" height="40" fill="%23E8E8E8"/%3E%3Cpath d="M31.5143 0H24.5476L0 24.5476V31.5143L11.7046 19.8097L11.9841 17.0782C12.0983 15.9624 13.0131 15.1154 14.1038 15.1154H15.7373V12.1923C15.7373 10.9815 16.6915 10 17.8687 10H21.5143L31.5143 0Z" fill="white"/%3E%3Cpath d="M11.5434 21.3852L0 32.9285V39.8953L11.5822 28.3131C11.172 27.8663 10.9438 27.2444 11.012 26.5782L11.5434 21.3852Z" fill="white"/%3E%3Cpath d="M12.4305 28.879L1.30951 40H8.27631L19.2763 29H13.1316C12.8853 29 12.6495 28.9573 12.4305 28.879Z" fill="white"/%3E%3Cpath d="M28.3113 19.965L28.0159 17.0782C27.9116 16.0591 27.1395 15.2642 26.1754 15.1341L40 1.3095V8.27627L28.3113 19.965Z" fill="white"/%3E%3Cpath d="M20.6905 29L9.69049 40H16.6572L27.9755 28.6817C27.6541 28.8832 27.2756 29 26.8684 29H20.6905Z" fill="white"/%3E%3Cpath d="M28.6572 28C28.9128 27.5952 29.0415 27.1003 28.988 26.5782L28.4426 21.2479L40 9.69053V16.6572L28.6572 28Z" fill="white"/%3E%3Cpath d="M25.0381 40H18.0715L40 18.0715V25.0381L25.0381 40Z" fill="white"/%3E%3Cpath d="M26.4524 40H33.4191L40 33.4191V26.4524L26.4524 40Z" fill="white"/%3E%3Cpath d="M40 40H34.8333L40 34.8333V40Z" fill="white"/%3E%3Cpath d="M16.1666 0H23.1334L0 23.1334V16.1666L16.1666 0Z" fill="white"/%3E%3Cpath d="M14.7524 0H7.78571L0 7.78573V14.7524L14.7524 0Z" fill="white"/%3E%3Cpath d="M0 0H6.37152L0 6.37151V0Z" fill="white"/%3E%3Cpath d="M21.467 11.4615H17.8687C17.4763 11.4615 17.1582 11.7887 17.1582 12.1923V15.1154H22.8418V12.1923C22.8418 11.7887 22.5237 11.4615 22.1313 11.4615H21.467Z" fill="white"/%3E%3Cpath d="M24.7798 15.1154H24.2627V12.1923C24.2627 11.227 23.6562 10.4075 22.8138 10.1148L32.9286 0H39.89L24.7798 15.1154Z" fill="white"/%3E%3C/svg%3E';let v,b,w,x,q,I,E,$,C=t=>t;class S extends(n(e)){constructor(){super(...arguments),this.empty=!1,this.data=[]}static get properties(){return t(t({},super.properties),{},{empty:{attribute:!1},data:{attribute:!1}})}static get styles(){return[a.styles,i(v||(v=C`.w-preview{width:5.5rem}.h-preview{height:5.5rem}.ease-out-back{transition-timing-function:cubic-bezier(.34,1.56,.64,1)}.grayscale{filter:grayscale()}.grid-2>:nth-child(1),.grid-3>:nth-child(1),.grid-4-plus>:nth-child(1),.grid-4>:nth-child(1){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-1>:nth-child(2){opacity:0;--tw-translate-x:100%;--tw-translate-y:var(--tw-translate-x)}.grid-2>:nth-child(2),.grid-3>:nth-child(2),.grid-4-plus>:nth-child(2),.grid-4>:nth-child(2){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-3>:nth-child(2),.grid-4-plus>:nth-child(2),.grid-4>:nth-child(2){transform-origin:top right}.grid-1>:nth-child(3),.grid-2>:nth-child(3),.grid-3>:nth-child(3),.grid-4-plus>:nth-child(3),.grid-4>:nth-child(3){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-1>:nth-child(3),.grid-2>:nth-child(3){opacity:0;--tw-translate-y:100%}.grid-3>:nth-child(3){transform-origin:bottom right}.grid-4-plus>:nth-child(3),.grid-4>:nth-child(3){transform-origin:bottom left}.grid-1>:nth-child(4),.grid-2>:nth-child(4),.grid-3>:nth-child(4),.grid-4-plus>:nth-child(4),.grid-4>:nth-child(4){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-1>:nth-child(4),.grid-2>:nth-child(4),.grid-3>:nth-child(4){opacity:0;transform-origin:bottom left;--tw-translate-x:100%}.grid-1>:nth-child(4)>:first-child,.grid-2>:nth-child(4)>:first-child,.grid-3>:nth-child(4)>:first-child,.grid-4>:nth-child(4)>:first-child{transform:perspective(250px) rotateX(-90deg)}.grid-4-plus>:nth-child(4)>:first-child,.grid-4>:nth-child(4)>:last-child{transition-delay:.15s;transition-timing-function:ease-out}.grid-4-plus>:nth-child(4)>:last-child,.grid-4>:nth-child(4)>:first-child{transition-timing-function:ease-in}.grid-4-plus>:nth-child(4)>:last-child{transform:perspective(250px) rotateX(90deg)}.grid-1>:nth-child(5),.grid-3>:nth-child(5),.grid-4-plus>:nth-child(5),.grid-4>:nth-child(5){opacity:0}.grid-1>:nth-child(5){--tw-translate-x:100%}.grid-2>:nth-child(5),.grid-3>:nth-child(5),.grid-4-plus>:nth-child(5),.grid-4>:nth-child(5){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-3>:nth-child(5),.grid-4-plus>:nth-child(5),.grid-4>:nth-child(5){--tw-translate-y:-100%}.grid-1>:nth-child(6),.grid-4-plus>:nth-child(6),.grid-4>:nth-child(6){opacity:0}.grid-1>:nth-child(6){--tw-translate-y:100%}.grid-2>:nth-child(6),.grid-3>:nth-child(6),.grid-4-plus>:nth-child(6),.grid-4>:nth-child(6){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-4-plus>:nth-child(6),.grid-4>:nth-child(6){--tw-translate-x:-100%}`))]}render(){const t=this.data.length,e="rounded bg-contrast-10",i="transition-all duration-700 ease-out-back transform absolute inset-0",r=this.empty?"grayscale":"",a=t>4?"grid-4-plus":`grid-${Math.max(1,t)}`,n=d({exportparts:"picture",class:"w-full h-full",".empty":this.empty}),[o,l,c,h]=this.data;return s(b||(b=C` <div class="${0} w-preview h-preview relative font-lumo"> <div class="${0} ${0} origin-top-left"> ${0} </div> <div class="${0} ${0} origin-bottom-right"> ${0} </div> <div class="${0} ${0} origin-top-right"> ${0} </div> <div class="${0} ${0} origin-bottom-right"> <div class="${0} flex text-body transition duration-150 absolute inset-0"> ${0} </div> <div class="transition duration-150 absolute inset-0"> ${0} </div> </div> <div class="${0} ${0} origin-top-right"></div> <div class="${0} ${0} origin-bottom-left"></div> </div> `),a,i,r,o?s(w||(w=C`<x-pic ...="${0}" .data="${0}"></x-pic>`),n,o):"",i,r,l?s(x||(x=C`<x-pic ...="${0}" .data="${0}"></x-pic>`),n,l):"",i,r,c?s(q||(q=C`<x-pic ...="${0}" .data="${0}"></x-pic>`),n,c):"",i,r,e,t>102?s(I||(I=C`<iron-icon icon="icons:more-horiz" class="m-auto w-xl h-xl"></iron-icon>`)):s(E||(E=C`<div class="m-auto text-xxxl">+${0}</div>`),t-3),h?s($||($=C`<x-pic ...="${0}" .data="${0}"></x-pic>`),n,h):"",i,e,i,e)}}let D,k,L=t=>t;class A extends S{static get scopedElements(){return{"x-pic":f}}}class N extends S{static get scopedElements(){return{"x-pic":A}}}class P extends(n(e)){constructor(){super(...arguments),this.quantity=0,this.items=[]}static get scopedElements(){return{"x-picture":f,"x-bundle-grid":N}}static get properties(){return{quantity:{attribute:!1},image:{attribute:!1},items:{attribute:!1}}}static get styles(){return a.styles}render(){const{quantity:t,image:e=""}=this,i=0===t,r=d({class:"w-full h-full",exportparts:"picture"});if(0===this.items.length)return s(D||(D=L`<x-picture ...="${0}" .data="${0}"></x-picture>`),r,{quantity:t,image:e});{const e=new Array(Math.max(1,t)).fill(this.items);return s(k||(k=L`<x-bundle-grid ...="${0}" .empty="${0}" .data="${0}"></x-bundle-grid>`),r,i,e)}}}class j extends o{static get properties(){return t(t({},super.properties),{},{open:{type:Object},signatures:{type:Object,converter:t=>{const e=JSON.parse(t);for(const t of Object.keys(e))64!=e[t].length&&console.error("There is something wrong with the signature. It should have 64 characters.");return e}}})}signedName(t){return this.signatures&&this.signatures[t]?`${t}||${this.signatures[t]}${this.isOpen(t)?"||open":""}`:t}isOpen(t){return!(!this.open||!this.open[t])}}let F,T,O,V,M,H,B,Z=t=>t;class R extends j{constructor(){super("items-form"),this.rel="product_item",this.readonly=!1,this.quantity=0,this.total=this.__computeTotalPrice(),this.currency="",this.isItem=!0,this.isChildItem=!1,this.pid=R.__newId(),this.__modified=!1,this.__childPrices=[],this.__images=[],this.__childrenCount=0,this.__itemDescription="",this.__handleQuantity={handleEvent:t=>{const e=Number(t.target.value);this.quantity=e,this.__modified=!0,this.__images=[this.getImageDescription()].concat(this.__images.slice(1,this.__images.length))}},this.__childItemsObserver=new MutationObserver(this.__observeItems.bind(this)),this.__childItemsObserver.observe(this,{childList:!0,attributes:!1,subtree:!0}),this.updateComplete.then((()=>{this.__setCode(),this.__acknowledgeChildItems(),this.__changedChildItem(),this.__isValid()||console.error("Invalid item",this.value)}))}static get styles(){return[super.styles,i(F||(F=Z`:host{--quantity-width:6.5rem;--preview-size:5.5rem;--threshold:20rem}.min-w-description::before{content:'';width:var(--threshold);display:block;overflow:hidden}.ml-description{--min-width:calc(var(--threshold) + var(--preview-size) + var(--lumo-space-l));--free-space:calc(100% - var(--min-width));--max-margin-left:calc(var(--preview-size) + var(--lumo-space-l));--final-margin-left:clamp(0rem, var(--free-space) * 999999999, var(--max-margin-left));margin-left:var(--final-margin-left)}.mr-quantity{--min-width:var(--threshold);--free-space:calc(100% - var(--min-width));--max-margin-right:calc(var(--quantity-width) + var(--lumo-space-l));--final-margin-right:clamp(0rem, var(--free-space) * 999999999, var(--max-margin-right));margin-right:var(--final-margin-right)}:host([data-bundled]:not(:last-of-type)) .separator::after{content:' ';display:block;position:absolute;width:100vw;border-bottom:solid thin var(--lumo-shade-10pct);left:0;bottom:0}.w-quantity{width:var(--quantity-width)}.w-preview{width:var(--preview-size)}.h-preview{height:var(--preview-size)}`))]}static get scopedElements(){return{"vaadin-integer-field":customElements.get("vaadin-integer-field"),"x-error-screen":h,"x-preview":P,"x-i18n":l}}static get properties(){return t(t({},super.properties),{},{__modified:{},readonly:{type:Boolean,reflect:!0},currency:{type:String},category:{type:String},code:{type:String,reflect:!0},expires:{type:String},height:{type:Number},image:{type:String},length:{type:Number},name:{type:String},parent_code:{type:String},price:{type:Number},quantity:{type:Number,reflect:!0},quantity_max:{type:Number},quantity_min:{type:String},shipto:{type:String},total:{type:Number,reflect:!0,attribute:"total"},url:{type:String},value:{type:Object},weight:{type:Number},width:{type:Number},__childPrices:{},__childrenCount:{},__images:{},alt:{type:String},isChildItem:{type:Boolean,reflect:!0,attribute:"data-bundled"},isItem:{type:Boolean,reflect:!0,attribute:"data-item"},open:{type:Object},pid:{type:Number,reflect:!0},items:{type:Array}})}get items(){const t=[];return this.__onEachChildItem([e=>t.push(e.value)]),t}set items(t){this.__createItems(t)}get value(){const t={};for(let e=0;e<this.attributes.length;e++)t[this.attributes[e].name]=this.attributes[e].value;return t.items=this.items,t}set value(t){this.__itemDescription="";for(const e in t){let i="";if("description"!=e){if("object"==typeof t[e])i=JSON.stringify(t[e]);else{const s=e;(t[s]&&"undefined"!==t[s]||0===t[s])&&(i=t[e].toString())}this.setAttribute(e,t[e]?i:"")}else this.__itemDescription=t[e]}}updated(t){t.forEach(((t,e)=>{"__itemDescription"!=e&&"isChildItem"!=e||this.__updateDescriptionEl()})),this.__setTotalPrice(),this.dispatchEvent(new Event("change"))}render(){var t;if(!this.__isValid())return s(T||(T=Z`<x-error-screen type="setup_needed" class="relative"></x-error-screen>`));const e=`font-lumo text-body text-s leading-m transition duration-100 ${this.quantity?"":"removed opacity-50"}`;if(this.isChildItem)return s(O||(O=Z` <article part="item" class="py-s w-full relative separator item-summary flex justify-between ${0}"> <div class="description flex-1"> <h1 class="text-header font-medium">${0}</h1> <section class="description text-secondary"> <slot></slot> </section> </div> ${0} </article> `),e,this.name,this.quantity<2?"":s(V||(V=Z` <section class="quantity font-medium text-tertiary whitespace-nowrap"> ${0} </section> `),this._t("item.items",{quantity:this.quantity})));{const i=(null!==(t=this.price)&&void 0!==t?t:0)+this.__childPrices.reduce(((t,e)=>t+e),0),r=this.__translateAmount(i*this.quantity),a=this.__translateAmount(i);return s(M||(M=Z` <article part="item" class="p-l relative item ${0} ${0}"> <x-preview class="preview float-left w-preview h-preview mr-l mb-l" exportparts="picture" .image="${0}" .quantity="${0}" .items="${0}"> </x-preview> <section class="description min-w-description ml-description"> <h1 class="text-header font-medium text-l leading-none mr-quantity mb-s"> ${0} </h1> <div class="item-description text-secondary mr-quantity mb-s"> <slot></slot> </div> <div class="child-items mb-s"> <slot name="items"></slot> </div> ${0} </section> <section class="quantity w-quantity absolute top-0 right-0 m-l"> <vaadin-integer-field class="w-full p-0" name="quantity" @change="${0}" value="${0}" min="0" has-controls ?readonly="${0}"> </vaadin-integer-field> ${0} </section> </article> `),e,this.__modified?"modified":"",this.image,this.quantity,[...this.querySelectorAll("[data-bundled]")].map((t=>{var e;return{quantity:t.quantity,image:null!==(e=t.image)&&void 0!==e?e:""}})),this.name,a?s(H||(H=Z`<div class="font-medium price text-l">${0}</div>`),a):"",this.__handleQuantity,this.quantity,this.readonly,this.quantity>1?s(B||(B=Z` <x-i18n .ns="${0}" .lang="${0}" .opts="${0}" class="price-total text-secondary text-xs text-center block mt-xs" key="price.total"> </x-i18n> `),this.ns,this.lang,{amount:r}):"")}}getImageDescription(){return{src:this.image,alt:this.alt,quantity:this.quantity}}signedName(t){const e=super.signedName(t);return`${this.pid.toString()}:${e}`}static __newId(){const t=R.__existingIds.reduce(((t,e)=>e>t?e:t),0)+1;return R.__existingIds.push(t),t}__updateDescriptionEl(){if(this.__itemDescription){let t=this.shadowRoot.querySelector("data-item-description");t||(t=document.createElement("p"),t.dataset.itemDescription="true",this.__addSlottedEl(t)),t.innerText=this.__itemDescription}else{const t=this.shadowRoot.querySelector("data-item-description");t&&t.remove()}}__addSlottedEl(t){const e=this.shadowRoot.querySelector("article");e&&e.appendChild(t)}__setCode(){this.code||(this.code=`RAND${Math.random()}`)}__createItems(t){t.forEach((t=>{const e=document.createElement(this.tagName);e.value=t,e.currency=this.currency,e.__computeTotalPrice(),this.__acknowledgeItem(e),this.appendChild(e)}))}__setTotalPrice(){this.total=this.__computeTotalPrice()}__computeTotalPrice(){if(!this.__childPrices)return this.price?this.price*this.quantity:0;let t=0;return this.__childPrices.forEach((e=>{t+=e})),t+=this.price,t*=this.quantity,t}__isValid(){const t=[];return this.name&&this.name.length||t.push("The name attribute of an item is required."),this.price||0===this.price||t.push("The price attribute of an item is required."),this.price&&this.price<0&&t.push("Item added with negative price."),this.quantity_min&&this.quantity&&this.quantity<this.quantity_min&&t.push("Quantity amount is less than minimum quantity."),this.quantity_max&&this.quantity&&this.quantity>this.quantity_max&&t.push("Quantity amount is more than maximum quantity."),console.error(...t),!t.length}__translateAmount(t){return this.currency?t.toLocaleString(this.lang,{minimumFractionDigits:2,currency:this.currency,style:"currency"}):""}__observeItems(t){t.forEach((t=>{"childList"==t.type&&t.addedNodes.forEach((t=>{t.nodeType===Node.DOCUMENT_NODE&&this.__acknowledgeItem(t)}))})),this.__setTotalPrice()}__acknowledgeChildItems(){var t;null===(t=this.shadowRoot)||void 0===t||t.querySelectorAll("[data-item]").forEach((t=>this.__acknowledgeItem(t))),this.querySelectorAll("[data-item]").forEach((t=>this.__acknowledgeItem(t)))}__acknowledgeItem(t){t.addEventListener("change",this.__changedChildItem.bind(this)),t.currency=this.currency,t.isItem=!1,t.isChildItem=!0,this.code&&(t.parent_code=this.code)}__changedChildItem(){const t=[],e=[];let i=0;this.__onEachChildItem([e=>{void 0!==e.total&&t.push(e.total)},t=>{e.push(t.getImageDescription())},()=>i+=1]),this.image&&0===e.length&&e.push(this.getImageDescription()),this.__childPrices=t,this.__images=e,this.__childrenCount=i,this.__setTotalPrice()}__onEachChildItem(t){const e=this.querySelectorAll("[data-bundled]");for(const i of e)for(const e of t)e(i)}}R.__existingIds=[];let z,Q,W,J,U,X,G=t=>t;class K extends j{constructor(){super("items-form"),this.readonly=!1,this.target="_top",this.cart="checkout",this.sub_modify="replace",this.sub_restart="auto",this.frequencies=[],this.handleSubmit={handleEvent:()=>{null!==this.__data&&this.dispatchEvent(new m(this.__data))&&this.shadowRoot.querySelector("form").submit()}},this.__hasValidItems=!1,this.__total=0,this.__handleFrequency={handleEvent:t=>{const e=t.detail.replace(/([wydm])\w*/,"$1").replace(/ /g,"").replace(/^0/,"");K.__validFrequency(e)?this.sub_frequency=e:this.sub_frequency="",this.__updateData()}},this.__data=new FormData,this.__childItemsObserver=new MutationObserver(this.__observeChildren.bind(this)),this.__childItemsObserver.observe(this,{childList:!0,attributes:!1,subtree:!0}),this.updateComplete.then((()=>{this.__acknowledgeItemElements(),this.__computeTotalPrice(),this.__updateData()}))}static get scopedElements(){return{"x-error-screen":h,"vaadin-button":customElements.get("vaadin-button"),"x-dropdown":c,"x-item":R}}static get properties(){return t(t({},super.properties),{},{currency:{type:String},readonly:{type:Boolean},cart:{type:String,converter:t=>t&&!["checkout","add"].includes(t)?null:t},target:{type:String},store:{type:String,attribute:"store"},sub_frequency:{type:String},sub_startdate:{type:String,converter:t=>K.__validDate(t)?t:(console.error("Invalid start date",t),"")},sub_enddate:{type:String,converter:t=>K.__validDateFuture(t)?t:(console.error("Invalid end date",t),"")},sub_token:{type:String},sub_modify:{type:String,converter:t=>""===t||"append"===t?"":"replace"},sub_restart:{type:String,converter:t=>"true"===t?t:"auto"},frequencies:{converter:t=>{if(!t)return[];const e=JSON.parse(t);if(!Array.isArray(e))return console.error("Invalid frequency","Frequency options must be an array."),[];for(const t of e)if(!K.__validFrequency(t))return console.error("Invalid frequency","Invalid frequency option.\n Please, check https://wiki.foxycart.com/v/2.0/products#subscription_product_options for possible values.\n Each frequency must be a in the format:\n - 1d (a number followed by d, for day)\n - 1w (a number followed by w, for week)\n - 1m (a number followed by m, for month)\n - 1y (a number followed by y, for year)\n or .5m (no other decimals are allowed, and this is only for months)\n ",t),[];return e.filter(K.__validFrequency)}},items:{type:Array},__hasValidItems:{attribute:!1},__total:{attribute:!1},__data:{attribute:!1}})}get items(){const t=[];return this.__itemElements.forEach((e=>{const i=new Proxy(e,{set:function(t,e,i){const s=Object.keys(t.value);return!("string"!=typeof e||!s.includes(e))&&(t[e]=i,!0)},get:function(t,e){return t.value[e]}});t.push(i)})),t}set items(t){this.__removeItems(),this.__createItemsFromItemArray(t)}get total(){return this.__total}render(){var t;return this.store&&this.currency?s(Q||(Q=G` <div> <form class="overflow-hidden" method="POST" target="${0}" action="https://${0}/cart" data-testid="form" class="hidden" hidden> ${0} </form> <section class="items"> <slot></slot> </section> ${0} </div> `),this.target,this.store,this.__data?s(W||(W=G` ${0}`),[...this.__data.entries()].map((([t,e])=>s(J||(J=G`<input type="hidden" name="${0}" value="${0}">`),t,e)))):"",this.readonly?"":s(U||(U=G` <section class="actions flex flex-wrap justify-end m-m"> ${0} <vaadin-button class="m-s w-full sm-w-auto" theme="primary" data-testid="submit" ?disabled="${0}" @click="${0}"> <span class="total"> ${0} </span> </vaadin-button> </section> `),this.frequencies&&this.frequencies.length?s(X||(X=G` <x-dropdown type="text" name="frequency" class="subscription m-s w-full sm-w-auto" lang="${0}" .value="${0}" .items="${0}" .getText="${0}" @change="${0}"> </x-dropdown> `),this.lang,null!==(t=this.sub_frequency)&&void 0!==t?t:"0",this.frequencies.concat(["0"]),this.__translateFrequency.bind(this),this.__handleFrequency):"",!this.__hasValidItems,this.handleSubmit,this.__submitBtnText(this.__translateAmount(this.total)))):s(z||(z=G`<x-error-screen type="setup_needed" class="relative"></x-error-screen>`))}addItems(t){for(const e of t){const t=this.createItem(e);this.appendChild(t),this.__acknowledgeItemElement(t)}}removeItems(t){this.__removeItems((e=>t.includes(e.pid)))}updated(){this.dispatchEvent(new u(this.__data))}createItem(t){const e=this.constructor.getScopedTagName("x-item"),i=document.createElement(e);return i.value=t,i.currency=this.currency,i.readonly=this.readonly,i}__submitBtnText(t){if(this.sub_frequency&&"0"!=this.sub_frequency){const e=r(this.sub_frequency);return 1===e.count?this._t("checkout.subscribe_single_unit",{value:t,period:this._t(e.units).toLowerCase()}):this._t("checkout.subscribe_muiltiple_units",{value:t,period:this.__translateFrequency(this.sub_frequency).toLowerCase()})}return this._t("checkout.buy",{value:t})}get __itemElements(){return this.querySelectorAll("[data-item]")}__createItemsFromItemArray(t){this.addItems(t)}__removeItems(t=(()=>!0)){this.__itemElements.forEach((e=>{t(e)&&e.remove()}))}__addSignature(t,e,i){return`${t}||${e}${i?"||open":""}`}__formDataFill(t){let e=0;return this.__itemElements.forEach((i=>{e+=this.__formDataAddItem(t,i)})),this.__formDataAddCartWideSubscriptionFields(t),e}__formDataCustomInputs(t){this.querySelectorAll("[name]").forEach((e=>{const i=e;"INPUT"==i.tagName&&["checkbox","radio"].includes(i.type)&&!i.checked||"OPTION"!=i.tagName&&i.value&&["number","string"].includes(typeof i.value)&&t.set(i.name,i.value)}))}__isAttributeReserved(t){return["alt","currency","description","isChildren","isItem","items","open","pid","signatures","slot","total"].includes(t)}__formDataAddItem(t,e,i=null){let s=0;if(this.__validItem(e)){if(!e.value.pid)throw new Error("Attempt to convert a item without a propper ID");i&&i.getAttribute("code")&&e.setAttribute("parent_code",i.getAttribute("code"));for(let s=0;s<e.attributes.length;s++){const r=e.attributes[s];if(!this.__isAttributeReserved(r.name)&&!r.name.startsWith("data-")){let s=e[r.name];e.code&&["string","number"].includes(typeof s)&&(i&&"quantity"==r.name&&(s=Number(r.value)*i.quantity),t.set(e.signedName(r.name),s.toString()))}}s+=1,this.__formDataAddSubscriptionFields(t,e)}const r=e.querySelectorAll("[data-bundled]");if(r&&e.quantity>0)for(const i of r)s+=this.__formDataAddItem(t,i,e);return s}__formDataAddSubscriptionFields(t,e){if(this.sub_frequency)for(const i of["sub_frequency","sub_startdate","sub_enddate"])this[i]&&t.set(e.signedName(i),this[i])}__formDataAddCartWideSubscriptionFields(t){this.sub_frequency&&(this.sub_token&&t.set(this.signedName("sub_token"),this.sub_token),t.set(this.signedName("sub_modify"),this.sub_modify),t.set(this.signedName("sub_restart"),this.sub_restart))}__formDataAddCartFields(t){this.cart?t.set("cart",this.cart):t.delete("cart")}static __validDate(t){return null!=t&&(t.match(/^(\d{1,2}|\d{8})$/)?!(t.match(/^\d{2}$/)&&Number(t)>31):!(t.match(/^\.5m/)||!K.__validFrequency(t)))}static __validDateFuture(t){let e=!1;if(K.__validDate(t))if(t.match(/^\d{8}/)){e=(new Date).toISOString().replace(/(-|T.*)/g,"")<=t}else e=!0;return e}static __validFrequency(t){return!!t&&!!t.match(/^(\.5m|\d+[dwmy])$/)}__observeChildren(t){t.forEach((t=>{"childList"==t.type&&t.addedNodes.forEach((t=>{t.addEventListener("change",this.__itemChange.bind(this))}))})),this.__acknowledgeItemElements(),this.__computeTotalPrice(),this.__updateData()}__itemChange(){this.__computeTotalPrice(),this.__updateData()}__computeTotalPrice(){let t=0;this.__itemElements.forEach((e=>{const i=e;i.total&&(t+=Number(i.total))})),this.__total=Number(t.toFixed(2))}__acknowledgeItemElements(){this.__itemElements.forEach((t=>{const e=t;this.__acknowledgeItemElement(e)}))}__acknowledgeItemElement(t){t.addEventListener("change",this.__itemChange.bind(this)),t.currency=this.currency}__validItem(t){const e=t.getAttribute("pid"),i=Number(t.getAttribute("quantity")),s=Number(t.getAttribute("price"));return!!(e&&i>0&&s>=0)}__translateFrequency(t){if(t.startsWith("0"))return this._t("frequency_once");if(".5m"===t)return this._t("frequency_0_5m");const{count:e,units:i}=r(t);return this._t("frequency",{units:this._t(i,{count:e}),count:e})}__translateAmount(t){return t.toLocaleString(this.lang,{minimumFractionDigits:2,currency:this.currency,style:"currency"})}__updateData(){this.__data=null;if(!this.shadowRoot.querySelector("form"))return;const t=new FormData,e=this.__formDataFill(t);this.__hasValidItems=!!e,this.__formDataAddCartFields(t),this.__formDataCustomInputs(t),this.__data=t}}customElements.define("foxy-items-form",K),customElements.define("foxy-item",R);export{K as I,P,R as a};
1
+ import{_ as t}from"./shared-fadcb2e1.js";import"./shared-c5c60417.js";import{L as e,c as i,h as s}from"./shared-dc73b9a5.js";import{p as r}from"./shared-47e4ea34.js";import"./shared-2188d5f7.js";import"./shared-195fd5af.js";import"./shared-31c43743.js";import{w as a,S as n,y as o}from"./shared-62169210.js";import"./shared-ed9d70f7.js";import"./shared-ab008382.js";import{I as l,D as c}from"./shared-ce24fef8.js";import{E as h}from"./shared-6cc99375.js";import"./shared-4e201e09.js";import"./shared-d28ac9dc.js";import"./shared-dc23b751.js";import"./shared-a052131e.js";import"./shared-8e9a3bbb.js";import{s as d}from"./shared-99940888.js";class u extends CustomEvent{constructor(t){super("change",{detail:t})}}class m extends CustomEvent{constructor(t){super("submit",{detail:t,cancelable:!0})}}let _,p,g=t=>t;var y;!function(t){t[t.Excluded=0]="Excluded",t[t.BeforeEnter=1]="BeforeEnter",t[t.Default=2]="Default",t[t.Previous=3]="Previous",t[t.BeforeExit=4]="BeforeExit"}(y||(y={}));class f extends e{constructor(){super(...arguments),this.quantity=0,this.image=""}static get properties(){return t(t({},super.properties),{},{quantity:{attribute:!1},image:{attribute:!1}})}static get styles(){return[a.styles,i(_||(_=g`.ease-out-back{transition-timing-function:cubic-bezier(.34,1.56,.64,1)}.blur-1{filter:blur(1px)}.blur-2{filter:blur(2px)}.grayscale{filter:grayscale()}.rotate-12{--tw-rotate:12deg}.-rotate-12{--tw-rotate:-12deg}.-rotate-24{--tw-rotate:-24deg}.translate-y-half{--tw-translate-y:50%}`))]}set empty(t){this.updateComplete.then((()=>{if(t){const[,...t]=this.__stack;t.forEach((t=>t.remove()))}else this.quantity>1&&this.__stack.length<2&&this.__insertImage(y.Previous,this.__stack[0])}))}set data({quantity:t,image:e}){this.quantity=t,this.image=e}render(){return s(p||(p=g`<div id="image" class="w-full h-full relative"></div>`))}firstUpdated(){const t=this.__insertImage(y.Default);this.quantity>1&&this.__insertImage(y.Previous,t)}updated(t){if(t.has("quantity")){const e=t.get("quantity");void 0!==e&&(this.quantity>e?this.__add():this.__remove())}t.has("image")&&this.__stack.forEach((t=>t.src=this.image))}get __container(){return this.shadowRoot.getElementById("image")}get __stack(){var t,e;return[...null!==(e=null===(t=this.__container)||void 0===t?void 0:t.querySelectorAll(":not(.opacity-0)"))&&void 0!==e?e:[]].reverse()}__add(){const[t,e]=this.__stack;this.quantity>1?(t&&this.__setImageState(t,y.Previous),e&&(this.__setImageState(e,y.BeforeExit),e.ontransitionend=()=>e.remove()),this.__setImageState(this.__insertImage(y.BeforeEnter),y.Default)):t&&this.__setImageState(t,y.Default)}__remove(){const[t,e]=this.__stack;let i;if(this.quantity>0?(e&&this.__setImageState(e,y.Default),i=t):(t&&this.__setImageState(t,y.Excluded),i=e),i&&(this.__setImageState(i,y.BeforeEnter),i.ontransitionend=()=>i.remove()),this.quantity>1){const t=this.__insertImage(y.BeforeExit,this.__container.firstElementChild);this.__setImageState(t,y.Previous)}}__insertImage(t,e=null){const i=new Image;return i.src=this.image,i.setAttribute("part","picture"),i.addEventListener("error",(()=>i.src=f.placeholder)),this.__setImageState(i,t),this.__container.insertBefore(i,e),i}__setImageState(t,e){t.offsetHeight,t.className=["absolute inset-0 w-full h-full object-cover rounded transform transition duration-700 ease-out-back",["grayscale","shadow-m translate-y-half scale-110 rotate-12 opacity-0","shadow-m","blur-1 -rotate-12 opacity-25","blur-2 -rotate-24 opacity-0"][e]].join(" ")}}f.placeholder='data:image/svg+xml,%3Csvg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg"%3E%3Crect width="40" height="40" fill="%23E8E8E8"/%3E%3Cpath d="M31.5143 0H24.5476L0 24.5476V31.5143L11.7046 19.8097L11.9841 17.0782C12.0983 15.9624 13.0131 15.1154 14.1038 15.1154H15.7373V12.1923C15.7373 10.9815 16.6915 10 17.8687 10H21.5143L31.5143 0Z" fill="white"/%3E%3Cpath d="M11.5434 21.3852L0 32.9285V39.8953L11.5822 28.3131C11.172 27.8663 10.9438 27.2444 11.012 26.5782L11.5434 21.3852Z" fill="white"/%3E%3Cpath d="M12.4305 28.879L1.30951 40H8.27631L19.2763 29H13.1316C12.8853 29 12.6495 28.9573 12.4305 28.879Z" fill="white"/%3E%3Cpath d="M28.3113 19.965L28.0159 17.0782C27.9116 16.0591 27.1395 15.2642 26.1754 15.1341L40 1.3095V8.27627L28.3113 19.965Z" fill="white"/%3E%3Cpath d="M20.6905 29L9.69049 40H16.6572L27.9755 28.6817C27.6541 28.8832 27.2756 29 26.8684 29H20.6905Z" fill="white"/%3E%3Cpath d="M28.6572 28C28.9128 27.5952 29.0415 27.1003 28.988 26.5782L28.4426 21.2479L40 9.69053V16.6572L28.6572 28Z" fill="white"/%3E%3Cpath d="M25.0381 40H18.0715L40 18.0715V25.0381L25.0381 40Z" fill="white"/%3E%3Cpath d="M26.4524 40H33.4191L40 33.4191V26.4524L26.4524 40Z" fill="white"/%3E%3Cpath d="M40 40H34.8333L40 34.8333V40Z" fill="white"/%3E%3Cpath d="M16.1666 0H23.1334L0 23.1334V16.1666L16.1666 0Z" fill="white"/%3E%3Cpath d="M14.7524 0H7.78571L0 7.78573V14.7524L14.7524 0Z" fill="white"/%3E%3Cpath d="M0 0H6.37152L0 6.37151V0Z" fill="white"/%3E%3Cpath d="M21.467 11.4615H17.8687C17.4763 11.4615 17.1582 11.7887 17.1582 12.1923V15.1154H22.8418V12.1923C22.8418 11.7887 22.5237 11.4615 22.1313 11.4615H21.467Z" fill="white"/%3E%3Cpath d="M24.7798 15.1154H24.2627V12.1923C24.2627 11.227 23.6562 10.4075 22.8138 10.1148L32.9286 0H39.89L24.7798 15.1154Z" fill="white"/%3E%3C/svg%3E';let v,b,w,x,q,I,E,$,C=t=>t;class S extends(n(e)){constructor(){super(...arguments),this.empty=!1,this.data=[]}static get properties(){return t(t({},super.properties),{},{empty:{attribute:!1},data:{attribute:!1}})}static get styles(){return[a.styles,i(v||(v=C`.w-preview{width:5.5rem}.h-preview{height:5.5rem}.ease-out-back{transition-timing-function:cubic-bezier(.34,1.56,.64,1)}.grayscale{filter:grayscale()}.grid-2>:nth-child(1),.grid-3>:nth-child(1),.grid-4-plus>:nth-child(1),.grid-4>:nth-child(1){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-1>:nth-child(2){opacity:0;--tw-translate-x:100%;--tw-translate-y:var(--tw-translate-x)}.grid-2>:nth-child(2),.grid-3>:nth-child(2),.grid-4-plus>:nth-child(2),.grid-4>:nth-child(2){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-3>:nth-child(2),.grid-4-plus>:nth-child(2),.grid-4>:nth-child(2){transform-origin:top right}.grid-1>:nth-child(3),.grid-2>:nth-child(3),.grid-3>:nth-child(3),.grid-4-plus>:nth-child(3),.grid-4>:nth-child(3){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-1>:nth-child(3),.grid-2>:nth-child(3){opacity:0;--tw-translate-y:100%}.grid-3>:nth-child(3){transform-origin:bottom right}.grid-4-plus>:nth-child(3),.grid-4>:nth-child(3){transform-origin:bottom left}.grid-1>:nth-child(4),.grid-2>:nth-child(4),.grid-3>:nth-child(4),.grid-4-plus>:nth-child(4),.grid-4>:nth-child(4){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-1>:nth-child(4),.grid-2>:nth-child(4),.grid-3>:nth-child(4){opacity:0;transform-origin:bottom left;--tw-translate-x:100%}.grid-1>:nth-child(4)>:first-child,.grid-2>:nth-child(4)>:first-child,.grid-3>:nth-child(4)>:first-child,.grid-4>:nth-child(4)>:first-child{transform:perspective(250px) rotateX(-90deg)}.grid-4-plus>:nth-child(4)>:first-child,.grid-4>:nth-child(4)>:last-child{transition-delay:.15s;transition-timing-function:ease-out}.grid-4-plus>:nth-child(4)>:last-child,.grid-4>:nth-child(4)>:first-child{transition-timing-function:ease-in}.grid-4-plus>:nth-child(4)>:last-child{transform:perspective(250px) rotateX(90deg)}.grid-1>:nth-child(5),.grid-3>:nth-child(5),.grid-4-plus>:nth-child(5),.grid-4>:nth-child(5){opacity:0}.grid-1>:nth-child(5){--tw-translate-x:100%}.grid-2>:nth-child(5),.grid-3>:nth-child(5),.grid-4-plus>:nth-child(5),.grid-4>:nth-child(5){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-3>:nth-child(5),.grid-4-plus>:nth-child(5),.grid-4>:nth-child(5){--tw-translate-y:-100%}.grid-1>:nth-child(6),.grid-4-plus>:nth-child(6),.grid-4>:nth-child(6){opacity:0}.grid-1>:nth-child(6){--tw-translate-y:100%}.grid-2>:nth-child(6),.grid-3>:nth-child(6),.grid-4-plus>:nth-child(6),.grid-4>:nth-child(6){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-4-plus>:nth-child(6),.grid-4>:nth-child(6){--tw-translate-x:-100%}`))]}render(){const t=this.data.length,e="rounded bg-contrast-10",i="transition-all duration-700 ease-out-back transform absolute inset-0",r=this.empty?"grayscale":"",a=t>4?"grid-4-plus":`grid-${Math.max(1,t)}`,n=d({exportparts:"picture",class:"w-full h-full",".empty":this.empty}),[o,l,c,h]=this.data;return s(b||(b=C` <div class="${0} w-preview h-preview relative font-lumo"> <div class="${0} ${0} origin-top-left"> ${0} </div> <div class="${0} ${0} origin-bottom-right"> ${0} </div> <div class="${0} ${0} origin-top-right"> ${0} </div> <div class="${0} ${0} origin-bottom-right"> <div class="${0} flex text-body transition duration-150 absolute inset-0"> ${0} </div> <div class="transition duration-150 absolute inset-0"> ${0} </div> </div> <div class="${0} ${0} origin-top-right"></div> <div class="${0} ${0} origin-bottom-left"></div> </div> `),a,i,r,o?s(w||(w=C`<x-pic ...="${0}" .data="${0}"></x-pic>`),n,o):"",i,r,l?s(x||(x=C`<x-pic ...="${0}" .data="${0}"></x-pic>`),n,l):"",i,r,c?s(q||(q=C`<x-pic ...="${0}" .data="${0}"></x-pic>`),n,c):"",i,r,e,t>102?s(I||(I=C`<iron-icon icon="icons:more-horiz" class="m-auto w-xl h-xl"></iron-icon>`)):s(E||(E=C`<div class="m-auto text-xxxl">+${0}</div>`),t-3),h?s($||($=C`<x-pic ...="${0}" .data="${0}"></x-pic>`),n,h):"",i,e,i,e)}}let D,k,L=t=>t;class A extends S{static get scopedElements(){return{"x-pic":f}}}class N extends S{static get scopedElements(){return{"x-pic":A}}}class P extends(n(e)){constructor(){super(...arguments),this.quantity=0,this.items=[]}static get scopedElements(){return{"x-picture":f,"x-bundle-grid":N}}static get properties(){return{quantity:{attribute:!1},image:{attribute:!1},items:{attribute:!1}}}static get styles(){return a.styles}render(){const{quantity:t,image:e=""}=this,i=0===t,r=d({class:"w-full h-full",exportparts:"picture"});if(0===this.items.length)return s(D||(D=L`<x-picture ...="${0}" .data="${0}"></x-picture>`),r,{quantity:t,image:e});{const e=new Array(Math.max(1,t)).fill(this.items);return s(k||(k=L`<x-bundle-grid ...="${0}" .empty="${0}" .data="${0}"></x-bundle-grid>`),r,i,e)}}}class j extends o{static get properties(){return t(t({},super.properties),{},{open:{type:Object},signatures:{type:Object,converter:t=>{const e=JSON.parse(t);for(const t of Object.keys(e))64!=e[t].length&&console.error("There is something wrong with the signature. It should have 64 characters.");return e}}})}signedName(t){return this.signatures&&this.signatures[t]?`${t}||${this.signatures[t]}${this.isOpen(t)?"||open":""}`:t}isOpen(t){return!(!this.open||!this.open[t])}}let F,T,O,V,M,H,B,Z=t=>t;class R extends j{constructor(){super("items-form"),this.rel="product_item",this.readonly=!1,this.quantity=0,this.total=this.__computeTotalPrice(),this.currency="",this.isItem=!0,this.isChildItem=!1,this.pid=R.__newId(),this.__modified=!1,this.__childPrices=[],this.__images=[],this.__childrenCount=0,this.__itemDescription="",this.__handleQuantity={handleEvent:t=>{const e=Number(t.target.value);this.quantity=e,this.__modified=!0,this.__images=[this.getImageDescription()].concat(this.__images.slice(1,this.__images.length))}},this.__childItemsObserver=new MutationObserver(this.__observeItems.bind(this)),this.__childItemsObserver.observe(this,{childList:!0,attributes:!1,subtree:!0}),this.updateComplete.then((()=>{this.__setCode(),this.__acknowledgeChildItems(),this.__changedChildItem(),this.__isValid()||console.error("Invalid item",this.value)}))}static get styles(){return[super.styles,i(F||(F=Z`:host{--quantity-width:6.5rem;--preview-size:5.5rem;--threshold:20rem}.min-w-description::before{content:'';width:var(--threshold);display:block;overflow:hidden}.ml-description{--min-width:calc(var(--threshold) + var(--preview-size) + var(--lumo-space-l));--free-space:calc(100% - var(--min-width));--max-margin-left:calc(var(--preview-size) + var(--lumo-space-l));--final-margin-left:clamp(0rem, var(--free-space) * 999999999, var(--max-margin-left));margin-left:var(--final-margin-left)}.mr-quantity{--min-width:var(--threshold);--free-space:calc(100% - var(--min-width));--max-margin-right:calc(var(--quantity-width) + var(--lumo-space-l));--final-margin-right:clamp(0rem, var(--free-space) * 999999999, var(--max-margin-right));margin-right:var(--final-margin-right)}:host([data-bundled]:not(:last-of-type)) .separator::after{content:' ';display:block;position:absolute;width:100vw;border-bottom:solid thin var(--lumo-shade-10pct);left:0;bottom:0}.w-quantity{width:var(--quantity-width)}.w-preview{width:var(--preview-size)}.h-preview{height:var(--preview-size)}`))]}static get scopedElements(){return{"vaadin-integer-field":customElements.get("vaadin-integer-field"),"x-error-screen":h,"x-preview":P,"x-i18n":l}}static get properties(){return t(t({},super.properties),{},{__modified:{},readonly:{type:Boolean,reflect:!0},currency:{type:String},category:{type:String},code:{type:String,reflect:!0},expires:{type:String},height:{type:Number},image:{type:String},length:{type:Number},name:{type:String},parent_code:{type:String},price:{type:Number},quantity:{type:Number,reflect:!0},quantity_max:{type:Number},quantity_min:{type:String},shipto:{type:String},total:{type:Number,reflect:!0,attribute:"total"},url:{type:String},value:{type:Object},weight:{type:Number},width:{type:Number},__childPrices:{},__childrenCount:{},__images:{},alt:{type:String},isChildItem:{type:Boolean,reflect:!0,attribute:"data-bundled"},isItem:{type:Boolean,reflect:!0,attribute:"data-item"},open:{type:Object},pid:{type:Number,reflect:!0},items:{type:Array}})}get items(){const t=[];return this.__onEachChildItem([e=>t.push(e.value)]),t}set items(t){this.__createItems(t)}get value(){const t={};for(let e=0;e<this.attributes.length;e++)t[this.attributes[e].name]=this.attributes[e].value;return t.items=this.items,t}set value(t){this.__itemDescription="";for(const e in t){let i="";if("description"!=e){if("object"==typeof t[e])i=JSON.stringify(t[e]);else{const s=e;(t[s]&&"undefined"!==t[s]||0===t[s])&&(i=t[e].toString())}this.setAttribute(e,t[e]?i:"")}else this.__itemDescription=t[e]}}updated(t){t.forEach(((t,e)=>{"__itemDescription"!=e&&"isChildItem"!=e||this.__updateDescriptionEl()})),this.__setTotalPrice(),this.dispatchEvent(new Event("change"))}render(){var t;if(!this.__isValid())return s(T||(T=Z`<x-error-screen type="setup_needed" class="relative"></x-error-screen>`));const e=`font-lumo text-body text-s leading-m transition duration-100 ${this.quantity?"":"removed opacity-50"}`;if(this.isChildItem)return s(O||(O=Z` <article part="item" class="py-s w-full relative separator item-summary flex justify-between ${0}"> <div class="description flex-1"> <h1 class="text-header font-medium">${0}</h1> <section class="description text-secondary"> <slot></slot> </section> </div> ${0} </article> `),e,this.name,this.quantity<2?"":s(V||(V=Z` <section class="quantity font-medium text-tertiary whitespace-nowrap"> ${0} </section> `),this._t("item.items",{quantity:this.quantity})));{const i=(null!==(t=this.price)&&void 0!==t?t:0)+this.__childPrices.reduce(((t,e)=>t+e),0),r=this.__translateAmount(i*this.quantity),a=this.__translateAmount(i);return s(M||(M=Z` <article part="item" class="p-l relative item ${0} ${0}"> <x-preview class="preview float-left w-preview h-preview mr-l mb-l" exportparts="picture" .image="${0}" .quantity="${0}" .items="${0}"> </x-preview> <section class="description min-w-description ml-description"> <h1 class="text-header font-medium text-l leading-none mr-quantity mb-s"> ${0} </h1> <div class="item-description text-secondary mr-quantity mb-s"> <slot></slot> </div> <div class="child-items mb-s"> <slot name="items"></slot> </div> ${0} </section> <section class="quantity w-quantity absolute top-0 right-0 m-l"> <vaadin-integer-field class="w-full p-0" name="quantity" @change="${0}" value="${0}" min="0" has-controls ?readonly="${0}"> </vaadin-integer-field> ${0} </section> </article> `),e,this.__modified?"modified":"",this.image,this.quantity,[...this.querySelectorAll("[data-bundled]")].map((t=>{var e;return{quantity:t.quantity,image:null!==(e=t.image)&&void 0!==e?e:""}})),this.name,a?s(H||(H=Z`<div class="font-medium price text-l">${0}</div>`),a):"",this.__handleQuantity,this.quantity,this.readonly,this.quantity>1?s(B||(B=Z` <x-i18n .ns="${0}" .lang="${0}" .opts="${0}" class="price-total text-secondary text-xs text-center block mt-xs" key="price.total"> </x-i18n> `),this.ns,this.lang,{amount:r}):"")}}getImageDescription(){return{src:this.image,alt:this.alt,quantity:this.quantity}}signedName(t){const e=super.signedName(t);return`${this.pid.toString()}:${e}`}static __newId(){const t=R.__existingIds.reduce(((t,e)=>e>t?e:t),0)+1;return R.__existingIds.push(t),t}__updateDescriptionEl(){if(this.__itemDescription){let t=this.shadowRoot.querySelector("data-item-description");t||(t=document.createElement("p"),t.dataset.itemDescription="true",this.__addSlottedEl(t)),t.innerText=this.__itemDescription}else{const t=this.shadowRoot.querySelector("data-item-description");t&&t.remove()}}__addSlottedEl(t){const e=this.shadowRoot.querySelector("article");e&&e.appendChild(t)}__setCode(){this.code||(this.code=`RAND${Math.random()}`)}__createItems(t){t.forEach((t=>{const e=document.createElement(this.tagName);e.value=t,e.currency=this.currency,e.__computeTotalPrice(),this.__acknowledgeItem(e),this.appendChild(e)}))}__setTotalPrice(){this.total=this.__computeTotalPrice()}__computeTotalPrice(){if(!this.__childPrices)return this.price?this.price*this.quantity:0;let t=0;return this.__childPrices.forEach((e=>{t+=e})),t+=this.price,t*=this.quantity,t}__isValid(){const t=[];return this.name&&this.name.length||t.push("The name attribute of an item is required."),this.price||0===this.price||t.push("The price attribute of an item is required."),this.price&&this.price<0&&t.push("Item added with negative price."),this.quantity_min&&this.quantity&&this.quantity<this.quantity_min&&t.push("Quantity amount is less than minimum quantity."),this.quantity_max&&this.quantity&&this.quantity>this.quantity_max&&t.push("Quantity amount is more than maximum quantity."),console.error(...t),!t.length}__translateAmount(t){return this.currency?t.toLocaleString(this.lang,{minimumFractionDigits:2,currency:this.currency,style:"currency"}):""}__observeItems(t){t.forEach((t=>{"childList"==t.type&&t.addedNodes.forEach((t=>{t.nodeType===Node.DOCUMENT_NODE&&this.__acknowledgeItem(t)}))})),this.__setTotalPrice()}__acknowledgeChildItems(){var t;null===(t=this.shadowRoot)||void 0===t||t.querySelectorAll("[data-item]").forEach((t=>this.__acknowledgeItem(t))),this.querySelectorAll("[data-item]").forEach((t=>this.__acknowledgeItem(t)))}__acknowledgeItem(t){t.addEventListener("change",this.__changedChildItem.bind(this)),t.currency=this.currency,t.isItem=!1,t.isChildItem=!0,this.code&&(t.parent_code=this.code)}__changedChildItem(){const t=[],e=[];let i=0;this.__onEachChildItem([e=>{void 0!==e.total&&t.push(e.total)},t=>{e.push(t.getImageDescription())},()=>i+=1]),this.image&&0===e.length&&e.push(this.getImageDescription()),this.__childPrices=t,this.__images=e,this.__childrenCount=i,this.__setTotalPrice()}__onEachChildItem(t){const e=this.querySelectorAll("[data-bundled]");for(const i of e)for(const e of t)e(i)}}R.__existingIds=[];let z,Q,W,J,U,X,G=t=>t;class K extends j{constructor(){super("items-form"),this.readonly=!1,this.target="_top",this.cart="checkout",this.sub_modify="replace",this.sub_restart="auto",this.frequencies=[],this.handleSubmit={handleEvent:()=>{null!==this.__data&&this.dispatchEvent(new m(this.__data))&&this.shadowRoot.querySelector("form").submit()}},this.__hasValidItems=!1,this.__total=0,this.__handleFrequency={handleEvent:t=>{const e=t.detail.replace(/([wydm])\w*/,"$1").replace(/ /g,"").replace(/^0/,"");K.__validFrequency(e)?this.sub_frequency=e:this.sub_frequency="",this.__updateData()}},this.__data=new FormData,this.__childItemsObserver=new MutationObserver(this.__observeChildren.bind(this)),this.__childItemsObserver.observe(this,{childList:!0,attributes:!1,subtree:!0}),this.updateComplete.then((()=>{this.__acknowledgeItemElements(),this.__computeTotalPrice(),this.__updateData()}))}static get scopedElements(){return{"x-error-screen":h,"vaadin-button":customElements.get("vaadin-button"),"x-dropdown":c,"x-item":R}}static get properties(){return t(t({},super.properties),{},{currency:{type:String},readonly:{type:Boolean},cart:{type:String,converter:t=>t&&!["checkout","add"].includes(t)?null:t},target:{type:String},store:{type:String,attribute:"store"},sub_frequency:{type:String},sub_startdate:{type:String,converter:t=>K.__validDate(t)?t:(console.error("Invalid start date",t),"")},sub_enddate:{type:String,converter:t=>K.__validDateFuture(t)?t:(console.error("Invalid end date",t),"")},sub_token:{type:String},sub_modify:{type:String,converter:t=>""===t||"append"===t?"":"replace"},sub_restart:{type:String,converter:t=>"true"===t?t:"auto"},frequencies:{converter:t=>{if(!t)return[];const e=JSON.parse(t);if(!Array.isArray(e))return console.error("Invalid frequency","Frequency options must be an array."),[];for(const t of e)if(!K.__validFrequency(t))return console.error("Invalid frequency","Invalid frequency option.\n Please, check https://wiki.foxycart.com/v/2.0/products#subscription_product_options for possible values.\n Each frequency must be a in the format:\n - 1d (a number followed by d, for day)\n - 1w (a number followed by w, for week)\n - 1m (a number followed by m, for month)\n - 1y (a number followed by y, for year)\n or .5m (no other decimals are allowed, and this is only for months)\n ",t),[];return e.filter(K.__validFrequency)}},items:{type:Array},__hasValidItems:{attribute:!1},__total:{attribute:!1},__data:{attribute:!1}})}get items(){const t=[];return this.__itemElements.forEach((e=>{const i=new Proxy(e,{set:function(t,e,i){const s=Object.keys(t.value);return!("string"!=typeof e||!s.includes(e))&&(t[e]=i,!0)},get:function(t,e){return t.value[e]}});t.push(i)})),t}set items(t){this.__removeItems(),this.__createItemsFromItemArray(t)}get total(){return this.__total}render(){var t;return this.store&&this.currency?s(Q||(Q=G` <div> <form class="overflow-hidden" method="POST" target="${0}" action="https://${0}/cart" data-testid="form" class="hidden" hidden> ${0} </form> <section class="items"> <slot></slot> </section> ${0} </div> `),this.target,this.store,this.__data?s(W||(W=G` ${0}`),[...this.__data.entries()].map((([t,e])=>s(J||(J=G`<input type="hidden" name="${0}" value="${0}">`),t,e)))):"",this.readonly?"":s(U||(U=G` <section class="actions flex flex-wrap justify-end m-m"> ${0} <vaadin-button class="m-s w-full sm-w-auto" theme="primary" data-testid="submit" ?disabled="${0}" @click="${0}"> <span class="total"> ${0} </span> </vaadin-button> </section> `),this.frequencies&&this.frequencies.length?s(X||(X=G` <x-dropdown type="text" name="frequency" class="subscription m-s w-full sm-w-auto" lang="${0}" .value="${0}" .items="${0}" .getText="${0}" @change="${0}"> </x-dropdown> `),this.lang,null!==(t=this.sub_frequency)&&void 0!==t?t:"0",this.frequencies.concat(["0"]),this.__translateFrequency.bind(this),this.__handleFrequency):"",!this.__hasValidItems,this.handleSubmit,this.__submitBtnText(this.__translateAmount(this.total)))):s(z||(z=G`<x-error-screen type="setup_needed" class="relative"></x-error-screen>`))}addItems(t){for(const e of t){const t=this.createItem(e);this.appendChild(t),this.__acknowledgeItemElement(t)}}removeItems(t){this.__removeItems((e=>t.includes(e.pid)))}updated(){this.dispatchEvent(new u(this.__data))}createItem(t){const e=this.constructor.getScopedTagName("x-item"),i=document.createElement(e);return i.value=t,i.currency=this.currency,i.readonly=this.readonly,i}__submitBtnText(t){if(this.sub_frequency&&"0"!=this.sub_frequency){const e=r(this.sub_frequency);return 1===e.count?this._t("checkout.subscribe_single_unit",{value:t,period:this._t(e.units).toLowerCase()}):this._t("checkout.subscribe_muiltiple_units",{value:t,period:this.__translateFrequency(this.sub_frequency).toLowerCase()})}return this._t("checkout.buy",{value:t})}get __itemElements(){return this.querySelectorAll("[data-item]")}__createItemsFromItemArray(t){this.addItems(t)}__removeItems(t=(()=>!0)){this.__itemElements.forEach((e=>{t(e)&&e.remove()}))}__addSignature(t,e,i){return`${t}||${e}${i?"||open":""}`}__formDataFill(t){let e=0;return this.__itemElements.forEach((i=>{e+=this.__formDataAddItem(t,i)})),this.__formDataAddCartWideSubscriptionFields(t),e}__formDataCustomInputs(t){this.querySelectorAll("[name]").forEach((e=>{const i=e;"INPUT"==i.tagName&&["checkbox","radio"].includes(i.type)&&!i.checked||"OPTION"!=i.tagName&&i.value&&["number","string"].includes(typeof i.value)&&t.set(i.name,i.value)}))}__isAttributeReserved(t){return["alt","currency","description","isChildren","isItem","items","open","pid","signatures","slot","total"].includes(t)}__formDataAddItem(t,e,i=null){let s=0;if(this.__validItem(e)){if(!e.value.pid)throw new Error("Attempt to convert a item without a propper ID");i&&i.getAttribute("code")&&e.setAttribute("parent_code",i.getAttribute("code"));for(let s=0;s<e.attributes.length;s++){const r=e.attributes[s];if(!this.__isAttributeReserved(r.name)&&!r.name.startsWith("data-")){let s=e[r.name];e.code&&["string","number"].includes(typeof s)&&(i&&"quantity"==r.name&&(s=Number(r.value)*i.quantity),t.set(e.signedName(r.name),s.toString()))}}s+=1,this.__formDataAddSubscriptionFields(t,e)}const r=e.querySelectorAll("[data-bundled]");if(r&&e.quantity>0)for(const i of r)s+=this.__formDataAddItem(t,i,e);return s}__formDataAddSubscriptionFields(t,e){if(this.sub_frequency)for(const i of["sub_frequency","sub_startdate","sub_enddate"])this[i]&&t.set(e.signedName(i),this[i])}__formDataAddCartWideSubscriptionFields(t){this.sub_frequency&&(this.sub_token&&t.set(this.signedName("sub_token"),this.sub_token),t.set(this.signedName("sub_modify"),this.sub_modify),t.set(this.signedName("sub_restart"),this.sub_restart))}__formDataAddCartFields(t){this.cart?t.set("cart",this.cart):t.delete("cart")}static __validDate(t){return null!=t&&(t.match(/^(\d{1,2}|\d{8})$/)?!(t.match(/^\d{2}$/)&&Number(t)>31):!(t.match(/^\.5m/)||!K.__validFrequency(t)))}static __validDateFuture(t){let e=!1;if(K.__validDate(t))if(t.match(/^\d{8}/)){e=(new Date).toISOString().replace(/(-|T.*)/g,"")<=t}else e=!0;return e}static __validFrequency(t){return!!t&&!!t.match(/^(\.5m|\d+[dwmy])$/)}__observeChildren(t){t.forEach((t=>{"childList"==t.type&&t.addedNodes.forEach((t=>{t.addEventListener("change",this.__itemChange.bind(this))}))})),this.__acknowledgeItemElements(),this.__computeTotalPrice(),this.__updateData()}__itemChange(){this.__computeTotalPrice(),this.__updateData()}__computeTotalPrice(){let t=0;this.__itemElements.forEach((e=>{const i=e;i.total&&(t+=Number(i.total))})),this.__total=Number(t.toFixed(2))}__acknowledgeItemElements(){this.__itemElements.forEach((t=>{const e=t;this.__acknowledgeItemElement(e)}))}__acknowledgeItemElement(t){t.addEventListener("change",this.__itemChange.bind(this)),t.currency=this.currency}__validItem(t){const e=t.getAttribute("pid"),i=Number(t.getAttribute("quantity")),s=Number(t.getAttribute("price"));return!!(e&&i>0&&s>=0)}__translateFrequency(t){if(t.startsWith("0"))return this._t("frequency_once");if(".5m"===t)return this._t("frequency_0_5m");const{count:e,units:i}=r(t);return this._t("frequency",{units:this._t(i,{count:e}),count:e})}__translateAmount(t){return t.toLocaleString(this.lang,{minimumFractionDigits:2,currency:this.currency,style:"currency"})}__updateData(){this.__data=null;if(!this.shadowRoot.querySelector("form"))return;const t=new FormData,e=this.__formDataFill(t);this.__hasValidItems=!!e,this.__formDataAddCartFields(t),this.__formDataCustomInputs(t),this.__data=t}}customElements.define("foxy-items-form",K),customElements.define("foxy-item",R);export{K as I,P,R as a};
@@ -0,0 +1 @@
1
+ import{_ as r}from"./shared-fadcb2e1.js";import{p as s}from"./shared-47e4ea34.js";function a(a){var e;const t=s(a),n=null!==(e={y:"yearly",m:"monthly",w:"weekly",d:"daily"}[t.units])&&void 0!==e?e:t.units;return r(r({},t),{},{units:n})}export{a as p};