@supersoniks/concorde 1.1.23 → 1.1.24

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.
@@ -104,7 +104,7 @@
104
104
  * @license
105
105
  * Copyright 2018 Google LLC
106
106
  * SPDX-License-Identifier: BSD-3-Clause
107
- */const ge=Je(class extends Qe{constructor(r){var e;if(super(r),r.type!==Me.ATTRIBUTE||r.name!=="style"||((e=r.strings)===null||e===void 0?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(r){return Object.keys(r).reduce((e,o)=>{const t=r[o];return t==null?e:e+`${o=o.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${t};`},"")}update(r,[e]){const{style:o}=r.element;if(this.ct===void 0){this.ct=new Set;for(const t in e)this.ct.add(t);return this.render(e)}this.ct.forEach(t=>{e[t]==null&&(this.ct.delete(t),t.includes("-")?o.removeProperty(t):o[t]="")});for(const t in e){const s=e[t];s!=null&&(this.ct.add(t),t.includes("-")?o.setProperty(t,s):o[t]=s)}return le}});var Ar=Object.defineProperty,Lr=Object.getOwnPropertyDescriptor,Ve=(r,e,o,t)=>{for(var s=t>1?void 0:t?Lr(e,o):e,i=r.length-1,n;i>=0;i--)(n=r[i])&&(s=(t?n(e,o,s):n(s))||s);return t&&s&&Ar(e,o,s),s};const Sr={warning:"warning-circled-outline",success:"check-circled-outline",error:"warning-circled-outline",info:"info-empty"};let fe=class extends v{constructor(){super(...arguments),this.title="",this.text="",this.status="",this.ghost=!1,this.preserve=!1,this.visible=!0}render(){return this.visible?m`<div class="sonic-toast ${this.status} ${this.ghost?"ghost":""}">${this.status&&m`<sonic-icon prefix="iconoir" name="${Sr[this.status]}" class="sonic-toast-icon" size="2xl"></sonic-icon>`} <button aria-label="Close" class="sonic-toast-close" @click="${()=>this.hide()}"><sonic-icon prefix="iconoir" name="cancel" size="lg"></sonic-icon></button><div class="sonic-toast-text">${this.title?m`<div class="sonic-toast-title">${this.title}</div>`:""} ${this.text?Fe(this.text):""}<slot></slot></div>${this.preserve?"":this.autoHide()}</div>`:L}hide(){this.closest("sonic-toast")||(this.visible=!1),this.dispatchEvent(new CustomEvent("hide",{bubbles:!0}))}show(){this.visible=!0}autoHide(){setTimeout(()=>{this.hide()},4200)}};fe.styles=[y`* { box-sizing: border-box; } :host { display: block; pointer-events: auto; --sc-toast-status-color: transparent; --sc-toast-color: var(--sc-base-content); --sc-toast-bg: var(--sc-base); --sc-toast-rounded: var(--sc-rounded-md); --sc-toast-shadow: var(--sc-shadow-lg); } .sonic-toast-area { pointer-events: none; width: calc(100% - 2.5rem); max-width: 64ch; gap: 1rem; } .fixed-area { position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 999; display: flex; flex-direction: column-reverse; } .sonic-toast { position: relative; pointer-events: auto; background: var(--sc-toast-bg); color: var(--sc-toast-color); box-shadow: var(--sc-toast-shadow); border-radius: var(--sc-toast-rounded); padding: 1em 2.5rem 1em 1em; line-height: 1.25; display: flex; gap: 0.5rem; max-height: 10rem; overflow: auto; } .sonic-toast-text { align-self: center; margin-top: auto; margin-bottom: auto; } ::slotted(a), .sonic-toast-text a { color: inherit; text-decoration: underline; text-underline-offset: 0.15rem; } /*BUTTON CLOSE*/ .sonic-toast-close { all: unset; position: absolute; pointer-events: initial; right: 0.5em; top: 0.5em; width: 1.5rem; height: 1.5rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; text-align: center; opacity: 0.5; background: rgba(0, 0, 0, 0); } .sonic-toast-close:focus, .sonic-toast-close:hover { opacity: 1; background: rgba(0, 0, 0, 0.075); } .sonic-toast-close svg { width: 1rem; height: 1rem; object-fit: contain; object-position: center center; } /*Title*/ .sonic-toast-title { font-weight: bold; font-size: 1.15rem; margin: 0.15em 0 0.25em; } /*STATUS*/ .success { --sc-toast-status-color: var(--sc-success); --sc-toast-title-color: var(--sc-toast-status-color); } .error { --sc-toast-status-color: var(--sc-danger); --sc-toast-title-color: var(--sc-toast-status-color); } .warning { --sc-toast-status-color: var(--sc-warning); --sc-toast-title-color: var(--sc-toast-status-color); } .info { --sc-toast-status-color: var(--sc-info); --sc-toast-title-color: var(--sc-toast-status-color); } .success, .error, .info, .warning { border-top: 3px solid var(--sc-toast-status-color, curentColor); } .sonic-toast:before { background-color: var(--sc-toast-status-color); content: ""; display: block; position: absolute; left: 0; top: 0; right: 0; bottom: 0; opacity: 0.05; pointer-events: none; transition: 0.2s; border-radius: var(--sc-toast-status-color); } .sonic-toast:hover:before { opacity: 0.025; } .info .sonic-toast-icon, .error .sonic-toast-icon, .success .sonic-toast-icon, .warning .sonic-toast-icon { color: var(--sc-toast-status-color, curentColor); } .ghost { opacity: 0.85; pointer-events: none; }`],Ve([a({type:String})],fe.prototype,"title",2),Ve([a({type:String})],fe.prototype,"text",2),Ve([a({type:String})],fe.prototype,"status",2),Ve([a({type:Boolean})],fe.prototype,"ghost",2),Ve([a({type:Boolean})],fe.prototype,"preserve",2),Ve([Z()],fe.prototype,"visible",2),fe=Ve([w("sonic-toast-item")],fe);var Pr=Object.defineProperty,zr=Object.getOwnPropertyDescriptor,Po=(r,e,o,t)=>{for(var s=t>1?void 0:t?zr(e,o):e,i=r.length-1,n;i>=0;i--)(n=r[i])&&(s=(t?n(e,o,s):n(s))||s);return t&&s&&Pr(e,o,s),s};let ce=class extends v{constructor(){super(...arguments),this.toasts=[]}createRenderRoot(){return this}render(){let r={pointerEvents:"none",width:"calc(100% - 2.5rem)",maxWidth:"64ch",gap:"1rem",display:"flex"};return window.parent==window&&(r=Mt(J({},r),{position:"fixed",bottom:"1.25rem",right:"1.25rem",zIndex:"999",flexDirection:"column-reverse"})),this.toasts?m`<div aria-live="polite" style="${ge(r)}">${Ee(this.toasts,e=>e.id,e=>m`<sonic-toast-item status="${e.status}" ?ghost="${e.ghost}" ?preserve="${e.preserve}" id="${e.id}" @hide="${()=>this.removeItem(e)}" ${jt({keyframeOptions:{duration:250,easing:"cubic-bezier(0.250, 0.250, 0.420, 1.225)"},in:[{transform:"translateY(0) scale(1.25)",boxShadow:"0 0 0 rgba(0,0,0,0)",opacity:0}],out:[{transform:"scale(.90) ",opacity:0,duration:3e3,easing:"ease-in-out"}],stabilizeOut:!0})}>${e.text?Fe(e.text):""}</sonic-toast-item>`)}</div>`:L}static removeAll(){let r=document.querySelector("sonic-toast");!r||(r.toasts=r.toasts.filter(e=>e.ghost))}static add(r){if(!document.querySelector("sonic-toast")){let i=document.createElement("sonic-toast");(document.querySelector("sonic-theme")||document.body).prepend(i)}let e=document.querySelector("sonic-toast");const o=new Date().valueOf(),t=new RegExp("</a>|</button>").test(r.text),s={id:o,text:r.text,title:r.title,status:r.status,preserve:t?!0:r.preserve,ghost:r.ghost};if(e.toasts.length>0){let i=J({},s),n=J({},e.toasts[e.toasts.length-1]);if(i.id=n.id=0,!s.preserve&&te.shallowEqual(i,n))return null}return e.toasts=[...e.toasts,s],s}removeItem(r){this.toasts=this.toasts.filter(e=>e!=r)}};if(Po([a({type:Array})],ce.prototype,"toasts",2),ce=Po([w("sonic-toast")],ce),typeof window<"u"){let r=window;r.SonicToast=ce}const se=class{static listen(){if(!se.listening)return;let r=document.location.href.replace(document.location.origin,"");se.prevURL&&se.prevURL!=r&&(se.prevURL=r,se.listeners.forEach(e=>{e.location=r})),window.requestAnimationFrame(se.listen)}static offChange(r){let e=se.listeners.indexOf(r);e!=-1&&(se.listeners.splice(e,1),se.listeners.length==0&&(se.listening=!1))}static onChange(r){se.listening||(se.listening=!0,se.listen()),se.listeners.push(r)}static changeFromComponent(r){if(r.goBack!==null){const n=document.location.origin;let l=r.goBack||n;if((document.referrer.indexOf("http")!=0||new URL(document.referrer).origin!=n)&&l!=document.location.href){let c=history.state||{};c.concorde=c.concorde||{},c.concorde.hasDoneHistoryBack=!0,history.pushState(c,document.title),history.back(),document.location.replace(l)}else history.back();return}let e=r.getAttribute("to");if(e||(e=r.href),!e)return;if(e.indexOf("#")==0){document.location.hash=e.substring(1);return}let o=new URL(e,document.location.href),t=o.pathname.split("/"),s=[],i="";for(let n of t)n!=i&&s.push(n),i=n;e="/"+s.join("/")+o.search+(o.hash?+o.hash:""),r.hasAttribute("pushState")?history.pushState(null,"",e):r.hasAttribute("replaceState")?history.replaceState(null,"",e):document.location.href=e}static updateComponentActiveState(r){if(r.autoActive!="disabled"&&r.href&&r.href.indexOf("http")!=0){let e=new URL(r.href,document.location.href),o=new URL(r.location,document.location.origin),t=!1;r.autoActive=="strict"?t=e.pathname==o.pathname&&e.hash==o.hash&&e.search==o.search:t=o.href.indexOf(e.href)==0,t?r.setAttribute("active","true"):r.removeAttribute("active")}}};let G=se;G.listeners=[],G.listening=!1,G.prevURL=document.location.href.replace(document.location.origin,"");var Mr=Object.defineProperty,Or=Object.getOwnPropertyDescriptor,et=(r,e,o,t)=>{for(var s=t>1?void 0:t?Or(e,o):e,i=r.length-1,n;i>=0;i--)(n=r[i])&&(s=(t?n(e,o,s):n(s))||s);return t&&s&&Mr(e,o,s),s};const Dt=new Map,tt=r=>{class e extends r{constructor(...t){super(),this.error=null,this.autofocus=null,this.disabled=null,this.required=null,this.onValueAssign=null,this.onFormValueAssign=null,this.onFormDataInValidate=null,this.formDataProvider="",this._name="",this._value="",this.onValueAssign=s=>{this.setValueFromPublisher(s)},this.onFormValueAssign=s=>{this.setFormValueFromPublisher(s)},this.onFormDataInValidate=()=>{!this.getFormPublisher().isFormValid.get()||this.validateFormElement()}}get name(){return this._name}set name(t){this._name=t}validateFormElement(){}updateDataValue(){if(this._name){let t=this.getFormPublisher();t&&(t[this._name]=this.getValueForFormPublisher(),this.setFormValueFromPublisher(t[this.name].get()))}}getFormPublisher(){return this.formDataProvider||(this.formDataProvider=this.getAncestorAttributeValue("formDataProvider")),this.formDataProvider?Y.get(this.formDataProvider):this.publisher}getValueForFormPublisher(){return this.value}setValueFromPublisher(t){this.value=t}setFormValueFromPublisher(t){this.value=t}get value(){return this._value}set value(t){te.isObject(t)&&t.hasOwnProperty("__value")&&t.value==null||t!=null&&this._value!=t&&(this._value=t,this.updateDataValue(),this.requestUpdate())}initPublisher(){this._name&&this.publisher&&this.publisher[this._name].offAssign(this.onValueAssign);let t=this.getFormPublisher();this._name&&t&&t[this._name].offAssign(this.onFormValueAssign),super.initPublisher(),this.name||(this._name=this.getAttribute("name")),this.value||(this._value=this.getAttribute("value")),this.updateDataValue(),this.publisher&&this._name&&this.publisher[this._name].onAssign(this.onValueAssign),t=this.getFormPublisher(),this._name&&t&&(t[this._name].onAssign(this.onFormValueAssign),t.onInvalidate(this.onFormDataInValidate))}handleChange(t){this.value=t.target.value;const s=new Event("change");this.dispatchEvent(s)}addKeyboardNavigation(){let t=this.getAncestorAttributeValue("data-keyboard-nav");if(!t)return;let s=t.split(" "),i=s[0];if(!i)return;for(let l of s){Dt.has(l)||Dt.set(l,[]);let c=Dt.get(l);c.indexOf(this)==-1&&c.push(this)}let n=Dt.get(i);this.addEventListener("keydown",l=>{if(!["ArrowDown","ArrowUp"].includes(l.key))return;let c="input:not([disabled]), button:not([disabled]), select:not([disabled]), textarea:not([disabled])",h=n.filter(u=>{let x=u.shadowRoot.querySelector(c);if(!x)return!1;let $=window.getComputedStyle(x);return $.display!=="none"&&$.display!==""&&$.pointerEvents!="none"&&$.visibility!=="hidden"&&x.getBoundingClientRect().width>0}),g=null;if(l.key=="ArrowDown"){let u=h.indexOf(this);u==h.length-1?g=h[0]:g=h[u+1]}else if(l.key=="ArrowUp"){let u=h.indexOf(this);u==0?g=h[h.length-1]:g=h[u-1]}let b=g.shadowRoot.querySelector(c);b&&(b.focus(),l.preventDefault())})}connectedCallback(){super.connectedCallback(),this.addKeyboardNavigation()}disconnectedCallback(){super.disconnectedCallback(),this._name&&this.publisher&&this.publisher[this._name].offAssign(this.onValueAssign);let t=this.getFormPublisher();this._name&&t&&(t[this._name].offAssign(this.onFormValueAssign),t.offInvalidate(this.onFormDataInValidate))}}return et([a({type:Boolean})],e.prototype,"error",2),et([a({type:Boolean})],e.prototype,"autofocus",2),et([a({type:Boolean})],e.prototype,"disabled",2),et([a({type:Boolean})],e.prototype,"required",2),et([a()],e.prototype,"name",1),et([a()],e.prototype,"value",1),e};var Er=Object.defineProperty,Fr=Object.getOwnPropertyDescriptor,bt=(r,e,o,t)=>{for(var s=t>1?void 0:t?Fr(e,o):e,i=r.length-1,n;i>=0;i--)(n=r[i])&&(s=(t?n(e,o,s):n(s))||s);return t&&s&&Er(e,o,s),s};const bs=r=>{class e extends r{constructor(){super(...arguments),this._value="",this._name="",this.unique=null,this.radio=null,this._checked=null}get value(){return this._value}set value(t){this.hasAttribute("value")&&(t=this.getAttribute("value")),this._value!=t&&(this._value=t,this.updateDataValue(),this.requestUpdate())}get name(){return this._name}set name(t){this.hasAttribute("name")&&(t=this.getAttribute("name")),this._name=t}get checked(){return this._checked}set checked(t){this.setCheckedValue(t)}setCheckedValue(t){this._checked!=t&&(this._checked=t,this.updateDataValue(),this.requestUpdate(),this.publisher&&!this.radio&&!this.unique&&(this.publisher.checked=this._checked))}handleChange(){this.checked=this.checked?this.radio?!0:null:!0;const t=new Event("change");this.dispatchEvent(t)}getValueForFormPublisher(){let t=this.getFormPublisher()[this.name].get();if(this.unique||this.radio)return this.checked&&this.value!=null?this.value:t;Array.isArray(t)||(t=[]),t=t.slice(0);let s=t.indexOf(this.value);return this.checked===!0&&s===-1&&t.push(this.value),this.checked===null&&s!==-1&&t.splice(s,1),t}setFormValueFromPublisher(t){if(this.unique||this.radio){this.checked=this.value==t?!0:null;return}Array.isArray(t)||(t=[]),this.checked=t.indexOf(this.value)!==-1?!0:null}initPublisher(){super.initPublisher(),!!this.hasAttribute("checked")&&(!this.publisher||this.publisher.get().checked!==!1)&&(this.checked=!0)}}return bt([a()],e.prototype,"value",1),bt([a()],e.prototype,"name",1),bt([a({type:Boolean})],e.prototype,"unique",2),bt([a({type:Boolean})],e.prototype,"radio",2),bt([a()],e.prototype,"checked",1),e};/**
107
+ */const ge=Je(class extends Qe{constructor(r){var e;if(super(r),r.type!==Me.ATTRIBUTE||r.name!=="style"||((e=r.strings)===null||e===void 0?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(r){return Object.keys(r).reduce((e,o)=>{const t=r[o];return t==null?e:e+`${o=o.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${t};`},"")}update(r,[e]){const{style:o}=r.element;if(this.ct===void 0){this.ct=new Set;for(const t in e)this.ct.add(t);return this.render(e)}this.ct.forEach(t=>{e[t]==null&&(this.ct.delete(t),t.includes("-")?o.removeProperty(t):o[t]="")});for(const t in e){const s=e[t];s!=null&&(this.ct.add(t),t.includes("-")?o.setProperty(t,s):o[t]=s)}return le}});var Ar=Object.defineProperty,Lr=Object.getOwnPropertyDescriptor,Ve=(r,e,o,t)=>{for(var s=t>1?void 0:t?Lr(e,o):e,i=r.length-1,n;i>=0;i--)(n=r[i])&&(s=(t?n(e,o,s):n(s))||s);return t&&s&&Ar(e,o,s),s};const Sr={warning:"warning-circled-outline",success:"check-circled-outline",error:"warning-circled-outline",info:"info-empty"};let fe=class extends v{constructor(){super(...arguments),this.title="",this.text="",this.status="",this.ghost=!1,this.preserve=!1,this.visible=!0}render(){return this.visible?m`<div class="sonic-toast ${this.status} ${this.ghost?"ghost":""}">${this.status&&m`<sonic-icon prefix="iconoir" name="${Sr[this.status]}" class="sonic-toast-icon" size="2xl"></sonic-icon>`} <button aria-label="Close" class="sonic-toast-close" @click="${()=>this.hide()}"><sonic-icon prefix="iconoir" name="cancel" size="lg"></sonic-icon></button><div class="sonic-toast-text">${this.title?m`<div class="sonic-toast-title">${this.title}</div>`:""} ${this.text?Fe(this.text):""}<slot></slot></div>${this.preserve?"":this.autoHide()}</div>`:L}hide(){this.closest("sonic-toast")||(this.visible=!1),this.dispatchEvent(new CustomEvent("hide",{bubbles:!0}))}show(){this.visible=!0}autoHide(){setTimeout(()=>{this.hide()},4200)}};fe.styles=[y`* { box-sizing: border-box; } :host { display: block; pointer-events: auto; --sc-toast-status-color: transparent; --sc-toast-color: var(--sc-base-content); --sc-toast-bg: var(--sc-base); --sc-toast-rounded: var(--sc-rounded-md); --sc-toast-shadow: var(--sc-shadow-lg); } .sonic-toast-area { pointer-events: none; width: calc(100% - 2.5rem); max-width: 64ch; gap: 1rem; } .fixed-area { position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 999; display: flex; flex-direction: column-reverse; } .sonic-toast { position: relative; pointer-events: auto; background: var(--sc-toast-bg); color: var(--sc-toast-color); box-shadow: var(--sc-toast-shadow); border-radius: var(--sc-toast-rounded); padding: 1em 2.5rem 1em 1em; line-height: 1.25; display: flex; gap: 0.5rem; max-height: 10rem; overflow: auto; } .sonic-toast-text { align-self: center; margin-top: auto; margin-bottom: auto; } ::slotted(a), .sonic-toast-text a { color: inherit; text-decoration: underline; text-underline-offset: 0.15rem; } /*BUTTON CLOSE*/ .sonic-toast-close { all: unset; position: absolute; pointer-events: initial; right: 0.5em; top: 0.5em; width: 1.5rem; height: 1.5rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; text-align: center; opacity: 0.5; background: rgba(0, 0, 0, 0); } .sonic-toast-close:focus, .sonic-toast-close:hover { opacity: 1; background: rgba(0, 0, 0, 0.075); } .sonic-toast-close svg { width: 1rem; height: 1rem; object-fit: contain; object-position: center center; } /*Title*/ .sonic-toast-title { font-weight: bold; font-size: 1.15rem; margin: 0.15em 0 0.25em; } /*STATUS*/ .success { --sc-toast-status-color: var(--sc-success); --sc-toast-title-color: var(--sc-toast-status-color); } .error { --sc-toast-status-color: var(--sc-danger); --sc-toast-title-color: var(--sc-toast-status-color); } .warning { --sc-toast-status-color: var(--sc-warning); --sc-toast-title-color: var(--sc-toast-status-color); } .info { --sc-toast-status-color: var(--sc-info); --sc-toast-title-color: var(--sc-toast-status-color); } .success, .error, .info, .warning { border-top: 3px solid var(--sc-toast-status-color, curentColor); } .sonic-toast:before { background-color: var(--sc-toast-status-color); content: ""; display: block; position: absolute; left: 0; top: 0; right: 0; bottom: 0; opacity: 0.05; pointer-events: none; transition: 0.2s; border-radius: var(--sc-toast-status-color); } .sonic-toast:hover:before { opacity: 0.025; } .info .sonic-toast-icon, .error .sonic-toast-icon, .success .sonic-toast-icon, .warning .sonic-toast-icon { color: var(--sc-toast-status-color, curentColor); } .ghost { opacity: 0.85; pointer-events: none; }`],Ve([a({type:String})],fe.prototype,"title",2),Ve([a({type:String})],fe.prototype,"text",2),Ve([a({type:String})],fe.prototype,"status",2),Ve([a({type:Boolean})],fe.prototype,"ghost",2),Ve([a({type:Boolean})],fe.prototype,"preserve",2),Ve([Z()],fe.prototype,"visible",2),fe=Ve([w("sonic-toast-item")],fe);var Pr=Object.defineProperty,zr=Object.getOwnPropertyDescriptor,Po=(r,e,o,t)=>{for(var s=t>1?void 0:t?zr(e,o):e,i=r.length-1,n;i>=0;i--)(n=r[i])&&(s=(t?n(e,o,s):n(s))||s);return t&&s&&Pr(e,o,s),s};let ce=class extends v{constructor(){super(...arguments),this.toasts=[]}createRenderRoot(){return this}render(){let r={pointerEvents:"none",width:"calc(100% - 2.5rem)",maxWidth:"64ch",gap:"1rem",display:"flex"};return window.parent==window&&(r=Mt(J({},r),{position:"fixed",bottom:"1.25rem",right:"1.25rem",zIndex:"999",flexDirection:"column-reverse"})),this.toasts?m`<div aria-live="polite" style="${ge(r)}">${Ee(this.toasts,e=>e.id,e=>m`<sonic-toast-item status="${e.status}" ?ghost="${e.ghost}" ?preserve="${e.preserve}" id="${e.id}" @hide="${()=>this.removeItem(e)}" ${jt({keyframeOptions:{duration:250,easing:"cubic-bezier(0.250, 0.250, 0.420, 1.225)"},in:[{transform:"translateY(0) scale(1.25)",boxShadow:"0 0 0 rgba(0,0,0,0)",opacity:0}],out:[{transform:"scale(.90) ",opacity:0,duration:3e3,easing:"ease-in-out"}],stabilizeOut:!0})}>${e.text?Fe(e.text):""}</sonic-toast-item>`)}</div>`:L}static removeAll(){let r=document.querySelector("sonic-toast");!r||(r.toasts=r.toasts.filter(e=>e.ghost))}static add(r){if(!document.querySelector("sonic-toast")){let i=document.createElement("sonic-toast");(document.querySelector("sonic-theme")||document.body).prepend(i)}let e=document.querySelector("sonic-toast");const o=new Date().valueOf(),t=new RegExp("</a>|</button>").test(r.text),s={id:o,text:r.text,title:r.title,status:r.status,preserve:t?!0:r.preserve,ghost:r.ghost};if(e.toasts.length>0){let i=J({},s),n=J({},e.toasts[e.toasts.length-1]);if(i.id=n.id=0,!s.preserve&&te.shallowEqual(i,n))return null}return e.toasts=[...e.toasts,s],s}removeItem(r){this.toasts=this.toasts.filter(e=>e!=r)}};if(Po([a({type:Array})],ce.prototype,"toasts",2),ce=Po([w("sonic-toast")],ce),typeof window<"u"){let r=window;r.SonicToast=ce}const se=class{static listen(){if(!se.listening)return;let r=document.location.href.replace(document.location.origin,"");se.prevURL&&se.prevURL!=r&&(se.prevURL=r,se.listeners.forEach(e=>{e.location=r})),window.requestAnimationFrame(se.listen)}static offChange(r){let e=se.listeners.indexOf(r);e!=-1&&(se.listeners.splice(e,1),se.listeners.length==0&&(se.listening=!1))}static onChange(r){se.listening||(se.listening=!0,se.listen()),se.listeners.push(r)}static changeFromComponent(r){if(r.goBack!==null){const n=document.location.origin;let l=r.goBack||n;if((document.referrer.indexOf("http")!=0||new URL(document.referrer).origin!=n)&&l!=document.location.href){let c=history.state||{};c.concorde=c.concorde||{},c.concorde.hasDoneHistoryBack=!0,history.pushState(c,document.title),history.back(),document.location.replace(l)}else history.back();return}let e=r.getAttribute("to");if(e||(e=r.href),!e)return;if(e.indexOf("#")==0){document.location.hash=e.substring(1);return}let o=new URL(e,document.location.href),t=o.pathname.split("/"),s=[],i="";for(let n of t)n!=i&&s.push(n),i=n;e="/"+s.join("/")+o.search+(o.hash?+o.hash:""),r.hasAttribute("pushState")?history.pushState(null,"",e):r.hasAttribute("replaceState")?history.replaceState(null,"",e):document.location.href=e}static updateComponentActiveState(r){if(r.autoActive!="disabled"&&r.href&&r.href.indexOf("http")!=0){let e=new URL(r.href,document.location.href),o=new URL(r.location,document.location.origin),t=!1;r.autoActive=="strict"?t=e.pathname==o.pathname&&e.hash==o.hash&&e.search==o.search:t=o.href.indexOf(e.href)==0,t?r.setAttribute("active","true"):r.removeAttribute("active")}}};let G=se;G.listeners=[],G.listening=!1,G.prevURL=document.location.href.replace(document.location.origin,"");var Mr=Object.defineProperty,Or=Object.getOwnPropertyDescriptor,et=(r,e,o,t)=>{for(var s=t>1?void 0:t?Or(e,o):e,i=r.length-1,n;i>=0;i--)(n=r[i])&&(s=(t?n(e,o,s):n(s))||s);return t&&s&&Mr(e,o,s),s};const Dt=new Map,tt=r=>{class e extends r{constructor(...t){super(),this.error=null,this.autofocus=null,this.disabled=null,this.required=null,this.onValueAssign=null,this.onFormValueAssign=null,this.onFormDataInValidate=null,this.formDataProvider="",this._name="",this._value="",this.onValueAssign=s=>{this.setValueFromPublisher(s)},this.onFormValueAssign=s=>{this.setFormValueFromPublisher(s)},this.onFormDataInValidate=()=>{!this.getFormPublisher().isFormValid.get()||this.validateFormElement()}}get name(){return this._name}set name(t){this._name=t}validateFormElement(){}updateDataValue(){if(this._name){let t=this.getFormPublisher();t&&(t[this._name]=this.getValueForFormPublisher(),this.setFormValueFromPublisher(t[this.name].get()))}}getFormPublisher(){return this.formDataProvider||(this.formDataProvider=this.getAncestorAttributeValue("formDataProvider")),this.formDataProvider?Y.get(this.formDataProvider):this.publisher}getValueForFormPublisher(){return this.value}setValueFromPublisher(t){this.value=t}setFormValueFromPublisher(t){this.value=t}get value(){return this._value}set value(t){te.isObject(t)&&t.hasOwnProperty("__value")&&t.value==null||t!=null&&this._value!=t&&(this._value=t,this.updateDataValue(),this.requestUpdate())}initPublisher(){this._name&&this.publisher&&this.publisher[this._name].offAssign(this.onValueAssign);let t=this.getFormPublisher();this._name&&t&&t[this._name].offAssign(this.onFormValueAssign),super.initPublisher(),this.name||(this._name=this.getAttribute("name")),this.value||(this._value=this.getAttribute("value")),this.updateDataValue(),this.publisher&&this._name&&this.publisher[this._name].onAssign(this.onValueAssign),t=this.getFormPublisher(),this._name&&t&&(t[this._name].onAssign(this.onFormValueAssign),t.onInvalidate(this.onFormDataInValidate))}handleChange(t){this.value=t.target.value;const s=new Event("change");this.dispatchEvent(s)}addKeyboardNavigation(){let t=this.getAncestorAttributeValue("data-keyboard-nav");if(!t)return;let s=t.split(" "),i=s[0];if(!i)return;for(let l of s){Dt.has(l)||Dt.set(l,[]);let c=Dt.get(l);c.indexOf(this)==-1&&c.push(this)}let n=Dt.get(i);this.addEventListener("keydown",l=>{if(!["ArrowDown","ArrowUp"].includes(l.key))return;let c="input:not([disabled]), button:not([disabled]), select:not([disabled]), textarea:not([disabled])",h=n.filter(u=>{let x=u.shadowRoot.querySelector(c);if(!x)return!1;let $=window.getComputedStyle(x);return $.display!=="none"&&$.display!==""&&$.pointerEvents!="none"&&$.visibility!=="hidden"&&x.getBoundingClientRect().width>0}),g=null;if(l.key=="ArrowDown"){let u=h.indexOf(this);u==h.length-1?g=h[0]:g=h[u+1]}else if(l.key=="ArrowUp"){let u=h.indexOf(this);u==0?g=h[h.length-1]:g=h[u-1]}let b=g.shadowRoot.querySelector(c);b&&(b.focus(),l.preventDefault())})}connectedCallback(){super.connectedCallback(),this.addKeyboardNavigation()}disconnectedCallback(){super.disconnectedCallback(),this._name&&this.publisher&&this.publisher[this._name].offAssign(this.onValueAssign);let t=this.getFormPublisher();this._name&&t&&(t[this._name].offAssign(this.onFormValueAssign),t.offInvalidate(this.onFormDataInValidate))}}return et([a({type:Boolean})],e.prototype,"error",2),et([a({type:Boolean})],e.prototype,"autofocus",2),et([a({type:Boolean})],e.prototype,"disabled",2),et([a({type:Boolean})],e.prototype,"required",2),et([a()],e.prototype,"name",1),et([a()],e.prototype,"value",1),e};var Er=Object.defineProperty,Fr=Object.getOwnPropertyDescriptor,bt=(r,e,o,t)=>{for(var s=t>1?void 0:t?Fr(e,o):e,i=r.length-1,n;i>=0;i--)(n=r[i])&&(s=(t?n(e,o,s):n(s))||s);return t&&s&&Er(e,o,s),s};const bs=r=>{class e extends r{constructor(){super(...arguments),this._value="",this._name="",this.unique=null,this.radio=null,this._checked=null}get value(){return this._value}set value(t){this.hasAttribute("value")&&(t=this.getAttribute("value")),this._value!=t&&(this._value=t,this.updateDataValue(),this.requestUpdate())}get name(){return this._name}set name(t){this.hasAttribute("name")&&(t=this.getAttribute("name")),this._name=t}get checked(){return this._checked}set checked(t){this.setCheckedValue(t)}validateFormElement(){var i;const t=(i=this.shadowRoot)==null?void 0:i.querySelector("input");if(!t||t.checkValidity())return;let s=this.getFormPublisher()[this.name].get();(this.unique||this.radio)&&s!==null&&s.toString().length>0||(this.getFormPublisher().isFormValid=!1,t.reportValidity())}setCheckedValue(t){this._checked!=t&&(this._checked=t,this.updateDataValue(),this.requestUpdate(),this.publisher&&!this.radio&&!this.unique&&(this.publisher.checked=this._checked))}handleChange(){this.checked=this.checked?this.radio?!0:null:!0;const t=new Event("change");this.dispatchEvent(t)}getValueForFormPublisher(){let t=this.getFormPublisher()[this.name].get();if(this.unique||this.radio)return this.checked&&this.value!=null?this.value:t;Array.isArray(t)||(t=[]),t=t.slice(0);let s=t.indexOf(this.value);return this.checked===!0&&s===-1&&t.push(this.value),this.checked===null&&s!==-1&&t.splice(s,1),t}setFormValueFromPublisher(t){if(this.unique||this.radio){this.checked=this.value==t?!0:null;return}Array.isArray(t)||(t=[]),this.checked=t.indexOf(this.value)!==-1?!0:null}initPublisher(){super.initPublisher(),!!this.hasAttribute("checked")&&(!this.publisher||this.publisher.get().checked!==!1)&&(this.checked=!0)}}return bt([a()],e.prototype,"value",1),bt([a()],e.prototype,"name",1),bt([a({type:Boolean})],e.prototype,"unique",2),bt([a({type:Boolean})],e.prototype,"radio",2),bt([a()],e.prototype,"checked",1),e};/**
108
108
  * @license
109
109
  * Copyright 2018 Google LLC
110
110
  * SPDX-License-Identifier: BSD-3-Clause