@wral/studio.mods.auth 0.3.7 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +39 -47
  2. package/bitbucket-pipelines.yml +25 -1
  3. package/dist/auth.cjs.js +326 -1467
  4. package/dist/auth.es.js +1081 -3093
  5. package/dist/lib.cjs.js +1 -1
  6. package/dist/lib.es.js +13 -7
  7. package/eslint.config.mjs +41 -34
  8. package/index.html +83 -18
  9. package/jest.config.mjs +24 -0
  10. package/jest.setup.mjs +5 -0
  11. package/package.json +15 -28
  12. package/src/auth.mjs +204 -69
  13. package/src/auth.test.mjs +97 -0
  14. package/src/components/auth-app.mjs +26 -0
  15. package/src/components/forgot-password-form.mjs +217 -0
  16. package/src/components/login-form.mjs +288 -0
  17. package/src/config.mjs +27 -0
  18. package/src/helper.mjs +31 -0
  19. package/src/helper.test.mjs +44 -0
  20. package/src/index.mjs +17 -0
  21. package/src/login-layout.mjs +32 -0
  22. package/src/login.mjs +20 -0
  23. package/src/routes/change-password.mjs +158 -0
  24. package/src/routes/dashboard.mjs +17 -0
  25. package/src/routes/index.mjs +15 -0
  26. package/src/state.mjs +61 -0
  27. package/src/state.test.mjs +58 -0
  28. package/src/styles.mjs +9 -0
  29. package/src/token.mjs +40 -0
  30. package/src/utils.mjs +3 -0
  31. package/vellum-fixture.mjs +86 -0
  32. package/vite.config.mjs +12 -0
  33. package/components.html +0 -43
  34. package/development.md +0 -41
  35. package/src/components/mod-auth-login-form.mjs +0 -133
  36. package/src/components/studio-change-password.mjs +0 -84
  37. package/src/components/studio-login.mjs +0 -94
  38. package/src/components/studio-profile-view.mjs +0 -56
  39. package/src/components/studio-reset-password.mjs +0 -110
  40. package/src/lib.mjs +0 -16
  41. package/src/tool-dummy.mjs +0 -84
  42. package/src/util.mjs +0 -194
  43. package/src/util.test.mjs +0 -171
  44. package/vite.config.js +0 -12
  45. package/web-test-runner.config.mjs +0 -28
package/dist/auth.cjs.js CHANGED
@@ -1,1479 +1,338 @@
1
- "use strict";var fe=Object.defineProperty;var me=(o,t,e)=>t in o?fe(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e;var E=(o,t,e)=>me(o,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function mt(o){return{api:(t,e)=>O(o,t,e),mintToken:({username:t,password:e})=>ge({config:o,username:t,password:e}),refreshToken:({token:t})=>ve({config:o,token:t}),pubkey:()=>ye({config:o}),updatePassword:({token:t,currentPassword:e,newPassword:r})=>we({config:o,token:t,currentPassword:e,newPassword:r}),triggerResetPassword:({username:t})=>_e({config:o,username:t}),confirmResetPassword:({username:t,newPassword:e,confirmationCode:r})=>$e({config:o,username:t,newPassword:e,confirmationCode:r})}}function ge({config:o,username:t,password:e}){return O(o,"/v1/user/login",{method:"POST",body:{username:t,password:e}})}function ve({config:o,token:t}){return O(o,"/v1/refresh",{method:"POST",body:{token:t}})}function ye({config:o}){return O(o,"/v1/pubkey",{method:"GET"})}function we({config:o,token:t,currentPassword:e,newPassword:r}){return O(o,"/v1/user/password",{method:"PUT",body:{currentPassword:e,newPassword:r},headers:{Authorization:`Bearer ${t}`}})}function _e({config:o,username:t}){return O(o,"/v1/user/password/reset",{method:"POST",body:{username:t}})}function $e({config:o,username:t,newPassword:e,confirmationCode:r}){return O(o,"/v1/user/password/reset/confirm",{method:"POST",body:{username:t,newPassword:e,confirmationCode:r}})}async function O(o,t,e){var c;const r=o.baseUrl.endsWith("/")?o.baseUrl:`${o.baseUrl}/`,s=t.startsWith("/")?t.substring(1):t,i=new URL(s,r),d=Object.assign({},e,{headers:Object.assign({},{"Content-Type":"application/json"},e==null?void 0:e.headers),body:e!=null&&e.body?JSON.stringify(e.body):void 0}),l=await fetch(i.toString(),d);if(!l.ok){const b=new Error("API request failed.");if(b.status=l.status,b.statusText=l.statusText,b.url=i.toString(),b.headers=l.headers,b.bodyUsed=l.bodyUsed,(c=l.headers.get("Content-Type"))!=null&&c.includes("application/json"))try{b.body=await l.json()}catch{b.body="Failed to parse response body."}throw b}if(l.status!==204)return await l.json()}/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const X=require("./lib.cjs.js");function k(r,...e){return(...t)=>r(...e,...t)}/**
2
2
  * @license
3
3
  * Copyright 2019 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
5
- */const rt=globalThis,xt=rt.ShadowRoot&&(rt.ShadyCSS===void 0||rt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,kt=Symbol(),Ut=new WeakMap;let Jt=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==kt)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(xt&&t===void 0){const r=e!==void 0&&e.length===1;r&&(t=Ut.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&Ut.set(e,t))}return t}toString(){return this.cssText}};const xe=o=>new Jt(typeof o=="string"?o:o+"",void 0,kt),$=(o,...t)=>{const e=o.length===1?o[0]:t.reduce((r,s,i)=>r+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+o[i+1],o[0]);return new Jt(e,o,kt)},ke=(o,t)=>{if(xt)o.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const e of t){const r=document.createElement("style"),s=rt.litNonce;s!==void 0&&r.setAttribute("nonce",s),r.textContent=e.cssText,o.appendChild(r)}},Lt=xt?o=>o:o=>o instanceof CSSStyleSheet?(t=>{let e="";for(const r of t.cssRules)e+=r.cssText;return xe(e)})(o):o;/**
5
+ */const L=globalThis,K=L.ShadowRoot&&(L.ShadyCSS===void 0||L.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Q=Symbol(),ee=new WeakMap;let he=class{constructor(e,t,s){if(this._$cssResult$=!0,s!==Q)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(K&&e===void 0){const s=t!==void 0&&t.length===1;s&&(e=ee.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),s&&ee.set(t,e))}return e}toString(){return this.cssText}};const Ce=r=>new he(typeof r=="string"?r:r+"",void 0,Q),q=(r,...e)=>{const t=r.length===1?r[0]:e.reduce((s,o,i)=>s+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(o)+r[i+1],r[0]);return new he(t,r,Q)},xe=(r,e)=>{if(K)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const s=document.createElement("style"),o=L.litNonce;o!==void 0&&s.setAttribute("nonce",o),s.textContent=t.cssText,r.appendChild(s)}},te=K?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(const s of e.cssRules)t+=s.cssText;return Ce(t)})(r):r;/**
6
6
  * @license
7
7
  * Copyright 2017 Google LLC
8
8
  * SPDX-License-Identifier: BSD-3-Clause
9
- */const{is:Ce,defineProperty:Ae,getOwnPropertyDescriptor:Se,getOwnPropertyNames:Ee,getOwnPropertySymbols:Pe,getPrototypeOf:Te}=Object,A=globalThis,Ot=A.trustedTypes,ze=Ot?Ot.emptyScript:"",lt=A.reactiveElementPolyfillSupport,q=(o,t)=>o,R={toAttribute(o,t){switch(t){case Boolean:o=o?ze:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o)}return o},fromAttribute(o,t){let e=o;switch(t){case Boolean:e=o!==null;break;case Number:e=o===null?null:Number(o);break;case Object:case Array:try{e=JSON.parse(o)}catch{e=null}}return e}},Ct=(o,t)=>!Ce(o,t),It={attribute:!0,type:String,converter:R,reflect:!1,hasChanged:Ct};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),A.litPropertyMetadata??(A.litPropertyMetadata=new WeakMap);class I extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=It){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const r=Symbol(),s=this.getPropertyDescriptor(t,r,e);s!==void 0&&Ae(this.prototype,t,s)}}static getPropertyDescriptor(t,e,r){const{get:s,set:i}=Se(this.prototype,t)??{get(){return this[e]},set(n){this[e]=n}};return{get(){return s==null?void 0:s.call(this)},set(n){const d=s==null?void 0:s.call(this);i.call(this,n),this.requestUpdate(t,d,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??It}static _$Ei(){if(this.hasOwnProperty(q("elementProperties")))return;const t=Te(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(q("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(q("properties"))){const e=this.properties,r=[...Ee(e),...Pe(e)];for(const s of r)this.createProperty(s,e[s])}const t=this[Symbol.metadata];if(t!==null){const e=litPropertyMetadata.get(t);if(e!==void 0)for(const[r,s]of e)this.elementProperties.set(r,s)}this._$Eh=new Map;for(const[e,r]of this.elementProperties){const s=this._$Eu(e,r);s!==void 0&&this._$Eh.set(s,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const r=new Set(t.flat(1/0).reverse());for(const s of r)e.unshift(Lt(s))}else t!==void 0&&e.push(Lt(t));return e}static _$Eu(t,e){const r=e.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var t;this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(e=>e(this))}addController(t){var e;(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&((e=t.hostConnected)==null||e.call(t))}removeController(t){var e;(e=this._$EO)==null||e.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ke(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$EO)==null||t.forEach(e=>{var r;return(r=e.hostConnected)==null?void 0:r.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$EO)==null||t.forEach(e=>{var r;return(r=e.hostDisconnected)==null?void 0:r.call(e)})}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$EC(t,e){var i;const r=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,r);if(s!==void 0&&r.reflect===!0){const n=(((i=r.converter)==null?void 0:i.toAttribute)!==void 0?r.converter:R).toAttribute(e,r.type);this._$Em=t,n==null?this.removeAttribute(s):this.setAttribute(s,n),this._$Em=null}}_$AK(t,e){var i;const r=this.constructor,s=r._$Eh.get(t);if(s!==void 0&&this._$Em!==s){const n=r.getPropertyOptions(s),d=typeof n.converter=="function"?{fromAttribute:n.converter}:((i=n.converter)==null?void 0:i.fromAttribute)!==void 0?n.converter:R;this._$Em=s,this[s]=d.fromAttribute(e,n.type),this._$Em=null}}requestUpdate(t,e,r){if(t!==void 0){if(r??(r=this.constructor.getPropertyOptions(t)),!(r.hasChanged??Ct)(this[t],e))return;this.P(t,e,r)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(t,e,r){this._$AL.has(t)||this._$AL.set(t,e),r.reflect===!0&&this._$Em!==t&&(this._$Ej??(this._$Ej=new Set)).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var r;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[i,n]of this._$Ep)this[i]=n;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[i,n]of s)n.wrapped!==!0||this._$AL.has(i)||this[i]===void 0||this.P(i,this[i],n)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(r=this._$EO)==null||r.forEach(s=>{var i;return(i=s.hostUpdate)==null?void 0:i.call(s)}),this.update(e)):this._$EU()}catch(s){throw t=!1,this._$EU(),s}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$EO)==null||e.forEach(r=>{var s;return(s=r.hostUpdated)==null?void 0:s.call(r)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EC(e,this[e]))),this._$EU()}updated(t){}firstUpdated(t){}}I.elementStyles=[],I.shadowRootOptions={mode:"open"},I[q("elementProperties")]=new Map,I[q("finalized")]=new Map,lt==null||lt({ReactiveElement:I}),(A.reactiveElementVersions??(A.reactiveElementVersions=[])).push("2.0.4");/**
9
+ */const{is:ke,defineProperty:Te,getOwnPropertyDescriptor:Ue,getOwnPropertyNames:Re,getOwnPropertySymbols:Oe,getPrototypeOf:Ne}=Object,$=globalThis,re=$.trustedTypes,He=re?re.emptyScript:"",j=$.reactiveElementPolyfillSupport,U=(r,e)=>r,V={toAttribute(r,e){switch(e){case Boolean:r=r?He:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},ue=(r,e)=>!ke(r,e),se={attribute:!0,type:String,converter:V,reflect:!1,hasChanged:ue};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),$.litPropertyMetadata??($.litPropertyMetadata=new WeakMap);class E extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=se){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){const s=Symbol(),o=this.getPropertyDescriptor(e,s,t);o!==void 0&&Te(this.prototype,e,o)}}static getPropertyDescriptor(e,t,s){const{get:o,set:i}=Ue(this.prototype,e)??{get(){return this[t]},set(n){this[t]=n}};return{get(){return o==null?void 0:o.call(this)},set(n){const l=o==null?void 0:o.call(this);i.call(this,n),this.requestUpdate(e,l,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??se}static _$Ei(){if(this.hasOwnProperty(U("elementProperties")))return;const e=Ne(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(U("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(U("properties"))){const t=this.properties,s=[...Re(t),...Oe(t)];for(const o of s)this.createProperty(o,t[o])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[s,o]of t)this.elementProperties.set(s,o)}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const o=this._$Eu(t,s);o!==void 0&&this._$Eh.set(o,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const s=new Set(e.flat(1/0).reverse());for(const o of s)t.unshift(te(o))}else e!==void 0&&t.push(te(e));return t}static _$Eu(e,t){const s=t.attribute;return s===!1?void 0:typeof s=="string"?s:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach(t=>t(this))}addController(e){var t;(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&((t=e.hostConnected)==null||t.call(e))}removeController(e){var t;(t=this._$EO)==null||t.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const s of t.keys())this.hasOwnProperty(s)&&(e.set(s,this[s]),delete this[s]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return xe(e,this.constructor.elementStyles),e}connectedCallback(){var e;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$EO)==null||e.forEach(t=>{var s;return(s=t.hostConnected)==null?void 0:s.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$EO)==null||e.forEach(t=>{var s;return(s=t.hostDisconnected)==null?void 0:s.call(t)})}attributeChangedCallback(e,t,s){this._$AK(e,s)}_$EC(e,t){var i;const s=this.constructor.elementProperties.get(e),o=this.constructor._$Eu(e,s);if(o!==void 0&&s.reflect===!0){const n=(((i=s.converter)==null?void 0:i.toAttribute)!==void 0?s.converter:V).toAttribute(t,s.type);this._$Em=e,n==null?this.removeAttribute(o):this.setAttribute(o,n),this._$Em=null}}_$AK(e,t){var i;const s=this.constructor,o=s._$Eh.get(e);if(o!==void 0&&this._$Em!==o){const n=s.getPropertyOptions(o),l=typeof n.converter=="function"?{fromAttribute:n.converter}:((i=n.converter)==null?void 0:i.fromAttribute)!==void 0?n.converter:V;this._$Em=o,this[o]=l.fromAttribute(t,n.type),this._$Em=null}}requestUpdate(e,t,s){if(e!==void 0){if(s??(s=this.constructor.getPropertyOptions(e)),!(s.hasChanged??ue)(this[e],t))return;this.P(e,t,s)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(e,t,s){this._$AL.has(e)||this._$AL.set(e,t),s.reflect===!0&&this._$Em!==e&&(this._$Ej??(this._$Ej=new Set)).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var s;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[i,n]of this._$Ep)this[i]=n;this._$Ep=void 0}const o=this.constructor.elementProperties;if(o.size>0)for(const[i,n]of o)n.wrapped!==!0||this._$AL.has(i)||this[i]===void 0||this.P(i,this[i],n)}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),(s=this._$EO)==null||s.forEach(o=>{var i;return(i=o.hostUpdate)==null?void 0:i.call(o)}),this.update(t)):this._$EU()}catch(o){throw e=!1,this._$EU(),o}e&&this._$AE(t)}willUpdate(e){}_$AE(e){var t;(t=this._$EO)==null||t.forEach(s=>{var o;return(o=s.hostUpdated)==null?void 0:o.call(s)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&(this._$Ej=this._$Ej.forEach(t=>this._$EC(t,this[t]))),this._$EU()}updated(e){}firstUpdated(e){}}E.elementStyles=[],E.shadowRootOptions={mode:"open"},E[U("elementProperties")]=new Map,E[U("finalized")]=new Map,j==null||j({ReactiveElement:E}),($.reactiveElementVersions??($.reactiveElementVersions=[])).push("2.0.4");/**
10
10
  * @license
11
11
  * Copyright 2017 Google LLC
12
12
  * SPDX-License-Identifier: BSD-3-Clause
13
- */const W=globalThis,st=W.trustedTypes,Vt=st?st.createPolicy("lit-html",{createHTML:o=>o}):void 0,Gt="$lit$",C=`lit$${Math.random().toFixed(9).slice(2)}$`,Qt="?"+C,Ue=`<${Qt}>`,L=document,Z=()=>L.createComment(""),Y=o=>o===null||typeof o!="object"&&typeof o!="function",At=Array.isArray,Le=o=>At(o)||typeof(o==null?void 0:o[Symbol.iterator])=="function",ut=`[
14
- \f\r]`,N=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Rt=/-->/g,Bt=/>/g,P=RegExp(`>|${ut}(?:([^\\s"'>=/]+)(${ut}*=${ut}*(?:[^
15
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Mt=/'/g,Nt=/"/g,Xt=/^(?:script|style|textarea|title)$/i,Oe=o=>(t,...e)=>({_$litType$:o,strings:t,values:e}),v=Oe(1),w=Symbol.for("lit-noChange"),g=Symbol.for("lit-nothing"),Dt=new WeakMap,U=L.createTreeWalker(L,129);function te(o,t){if(!At(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return Vt!==void 0?Vt.createHTML(t):t}const Ie=(o,t)=>{const e=o.length-1,r=[];let s,i=t===2?"<svg>":t===3?"<math>":"",n=N;for(let d=0;d<e;d++){const l=o[d];let c,b,p=-1,_=0;for(;_<l.length&&(n.lastIndex=_,b=n.exec(l),b!==null);)_=n.lastIndex,n===N?b[1]==="!--"?n=Rt:b[1]!==void 0?n=Bt:b[2]!==void 0?(Xt.test(b[2])&&(s=RegExp("</"+b[2],"g")),n=P):b[3]!==void 0&&(n=P):n===P?b[0]===">"?(n=s??N,p=-1):b[1]===void 0?p=-2:(p=n.lastIndex-b[2].length,c=b[1],n=b[3]===void 0?P:b[3]==='"'?Nt:Mt):n===Nt||n===Mt?n=P:n===Rt||n===Bt?n=N:(n=P,s=void 0);const y=n===P&&o[d+1].startsWith("/>")?" ":"";i+=n===N?l+Ue:p>=0?(r.push(c),l.slice(0,p)+Gt+l.slice(p)+C+y):l+C+(p===-2?d:y)}return[te(o,i+(o[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]};class J{constructor({strings:t,_$litType$:e},r){let s;this.parts=[];let i=0,n=0;const d=t.length-1,l=this.parts,[c,b]=Ie(t,e);if(this.el=J.createElement(c,r),U.currentNode=this.el.content,e===2||e===3){const p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(s=U.nextNode())!==null&&l.length<d;){if(s.nodeType===1){if(s.hasAttributes())for(const p of s.getAttributeNames())if(p.endsWith(Gt)){const _=b[n++],y=s.getAttribute(p).split(C),tt=/([.?@])?(.*)/.exec(_);l.push({type:1,index:i,name:tt[2],strings:y,ctor:tt[1]==="."?Re:tt[1]==="?"?Be:tt[1]==="@"?Me:nt}),s.removeAttribute(p)}else p.startsWith(C)&&(l.push({type:6,index:i}),s.removeAttribute(p));if(Xt.test(s.tagName)){const p=s.textContent.split(C),_=p.length-1;if(_>0){s.textContent=st?st.emptyScript:"";for(let y=0;y<_;y++)s.append(p[y],Z()),U.nextNode(),l.push({type:2,index:++i});s.append(p[_],Z())}}}else if(s.nodeType===8)if(s.data===Qt)l.push({type:2,index:i});else{let p=-1;for(;(p=s.data.indexOf(C,p+1))!==-1;)l.push({type:7,index:i}),p+=C.length-1}i++}}static createElement(t,e){const r=L.createElement("template");return r.innerHTML=t,r}}function B(o,t,e=o,r){var n,d;if(t===w)return t;let s=r!==void 0?(n=e.o)==null?void 0:n[r]:e.l;const i=Y(t)?void 0:t._$litDirective$;return(s==null?void 0:s.constructor)!==i&&((d=s==null?void 0:s._$AO)==null||d.call(s,!1),i===void 0?s=void 0:(s=new i(o),s._$AT(o,e,r)),r!==void 0?(e.o??(e.o=[]))[r]=s:e.l=s),s!==void 0&&(t=B(o,s._$AS(o,t.values),s,r)),t}class Ve{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:r}=this._$AD,s=((t==null?void 0:t.creationScope)??L).importNode(e,!0);U.currentNode=s;let i=U.nextNode(),n=0,d=0,l=r[0];for(;l!==void 0;){if(n===l.index){let c;l.type===2?c=new G(i,i.nextSibling,this,t):l.type===1?c=new l.ctor(i,l.name,l.strings,this,t):l.type===6&&(c=new Ne(i,this,t)),this._$AV.push(c),l=r[++d]}n!==(l==null?void 0:l.index)&&(i=U.nextNode(),n++)}return U.currentNode=L,s}p(t){let e=0;for(const r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}}class G{get _$AU(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this.v}constructor(t,e,r,s){this.type=2,this._$AH=g,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=s,this.v=(s==null?void 0:s.isConnected)??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=B(this,t,e),Y(t)?t===g||t==null||t===""?(this._$AH!==g&&this._$AR(),this._$AH=g):t!==this._$AH&&t!==w&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Le(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==g&&Y(this._$AH)?this._$AA.nextSibling.data=t:this.T(L.createTextNode(t)),this._$AH=t}$(t){var i;const{values:e,_$litType$:r}=t,s=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=J.createElement(te(r.h,r.h[0]),this.options)),r);if(((i=this._$AH)==null?void 0:i._$AD)===s)this._$AH.p(e);else{const n=new Ve(s,this),d=n.u(this.options);n.p(e),this.T(d),this._$AH=n}}_$AC(t){let e=Dt.get(t.strings);return e===void 0&&Dt.set(t.strings,e=new J(t)),e}k(t){At(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let r,s=0;for(const i of t)s===e.length?e.push(r=new G(this.O(Z()),this.O(Z()),this,this.options)):r=e[s],r._$AI(i),s++;s<e.length&&(this._$AR(r&&r._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){var r;for((r=this._$AP)==null?void 0:r.call(this,!1,!0,e);t&&t!==this._$AB;){const s=t.nextSibling;t.remove(),t=s}}setConnected(t){var e;this._$AM===void 0&&(this.v=t,(e=this._$AP)==null||e.call(this,t))}}class nt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,s,i){this.type=1,this._$AH=g,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=i,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=g}_$AI(t,e=this,r,s){const i=this.strings;let n=!1;if(i===void 0)t=B(this,t,e,0),n=!Y(t)||t!==this._$AH&&t!==w,n&&(this._$AH=t);else{const d=t;let l,c;for(t=i[0],l=0;l<i.length-1;l++)c=B(this,d[r+l],e,l),c===w&&(c=this._$AH[l]),n||(n=!Y(c)||c!==this._$AH[l]),c===g?t=g:t!==g&&(t+=(c??"")+i[l+1]),this._$AH[l]=c}n&&!s&&this.j(t)}j(t){t===g?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class Re extends nt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===g?void 0:t}}class Be extends nt{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==g)}}class Me extends nt{constructor(t,e,r,s,i){super(t,e,r,s,i),this.type=5}_$AI(t,e=this){if((t=B(this,t,e,0)??g)===w)return;const r=this._$AH,s=t===g&&r!==g||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,i=t!==g&&(r===g||s);s&&this.element.removeEventListener(this.name,this,r),i&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e;typeof this._$AH=="function"?this._$AH.call(((e=this.options)==null?void 0:e.host)??this.element,t):this._$AH.handleEvent(t)}}class Ne{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){B(this,t)}}const dt=W.litHtmlPolyfillSupport;dt==null||dt(J,G),(W.litHtmlVersions??(W.litHtmlVersions=[])).push("3.2.0");const De=(o,t,e)=>{const r=(e==null?void 0:e.renderBefore)??t;let s=r._$litPart$;if(s===void 0){const i=(e==null?void 0:e.renderBefore)??null;r._$litPart$=s=new G(t.insertBefore(Z(),i),i,void 0,e??{})}return s._$AI(o),s};/**
13
+ */const R=globalThis,M=R.trustedTypes,oe=M?M.createPolicy("lit-html",{createHTML:r=>r}):void 0,pe="$lit$",w=`lit$${Math.random().toFixed(9).slice(2)}$`,me="?"+w,qe=`<${me}>`,A=document,O=()=>A.createComment(""),N=r=>r===null||typeof r!="object"&&typeof r!="function",J=Array.isArray,De=r=>J(r)||typeof(r==null?void 0:r[Symbol.iterator])=="function",W=`[
14
+ \f\r]`,T=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ie=/-->/g,ne=/>/g,v=RegExp(`>|${W}(?:([^\\s"'>=/]+)(${W}*=${W}*(?:[^
15
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),ae=/'/g,le=/"/g,fe=/^(?:script|style|textarea|title)$/i,Fe=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),c=Fe(1),S=Symbol.for("lit-noChange"),p=Symbol.for("lit-nothing"),ce=new WeakMap,_=A.createTreeWalker(A,129);function ge(r,e){if(!J(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return oe!==void 0?oe.createHTML(e):e}const Le=(r,e)=>{const t=r.length-1,s=[];let o,i=e===2?"<svg>":e===3?"<math>":"",n=T;for(let l=0;l<t;l++){const a=r[l];let u,d,h=-1,m=0;for(;m<a.length&&(n.lastIndex=m,d=n.exec(a),d!==null);)m=n.lastIndex,n===T?d[1]==="!--"?n=ie:d[1]!==void 0?n=ne:d[2]!==void 0?(fe.test(d[2])&&(o=RegExp("</"+d[2],"g")),n=v):d[3]!==void 0&&(n=v):n===v?d[0]===">"?(n=o??T,h=-1):d[1]===void 0?h=-2:(h=n.lastIndex-d[2].length,u=d[1],n=d[3]===void 0?v:d[3]==='"'?le:ae):n===le||n===ae?n=v:n===ie||n===ne?n=T:(n=v,o=void 0);const f=n===v&&r[l+1].startsWith("/>")?" ":"";i+=n===T?a+qe:h>=0?(s.push(u),a.slice(0,h)+pe+a.slice(h)+w+f):a+w+(h===-2?l:f)}return[ge(r,i+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),s]};class H{constructor({strings:e,_$litType$:t},s){let o;this.parts=[];let i=0,n=0;const l=e.length-1,a=this.parts,[u,d]=Le(e,t);if(this.el=H.createElement(u,s),_.currentNode=this.el.content,t===2||t===3){const h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(o=_.nextNode())!==null&&a.length<l;){if(o.nodeType===1){if(o.hasAttributes())for(const h of o.getAttributeNames())if(h.endsWith(pe)){const m=d[n++],f=o.getAttribute(h).split(w),F=/([.?@])?(.*)/.exec(m);a.push({type:1,index:i,name:F[2],strings:f,ctor:F[1]==="."?Ie:F[1]==="?"?ze:F[1]==="@"?je:I}),o.removeAttribute(h)}else h.startsWith(w)&&(a.push({type:6,index:i}),o.removeAttribute(h));if(fe.test(o.tagName)){const h=o.textContent.split(w),m=h.length-1;if(m>0){o.textContent=M?M.emptyScript:"";for(let f=0;f<m;f++)o.append(h[f],O()),_.nextNode(),a.push({type:2,index:++i});o.append(h[m],O())}}}else if(o.nodeType===8)if(o.data===me)a.push({type:2,index:i});else{let h=-1;for(;(h=o.data.indexOf(w,h+1))!==-1;)a.push({type:7,index:i}),h+=w.length-1}i++}}static createElement(e,t){const s=A.createElement("template");return s.innerHTML=e,s}}function C(r,e,t=r,s){var n,l;if(e===S)return e;let o=s!==void 0?(n=t._$Co)==null?void 0:n[s]:t._$Cl;const i=N(e)?void 0:e._$litDirective$;return(o==null?void 0:o.constructor)!==i&&((l=o==null?void 0:o._$AO)==null||l.call(o,!1),i===void 0?o=void 0:(o=new i(r),o._$AT(r,t,s)),s!==void 0?(t._$Co??(t._$Co=[]))[s]=o:t._$Cl=o),o!==void 0&&(e=C(r,o._$AS(r,e.values),o,s)),e}class Me{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:s}=this._$AD,o=((e==null?void 0:e.creationScope)??A).importNode(t,!0);_.currentNode=o;let i=_.nextNode(),n=0,l=0,a=s[0];for(;a!==void 0;){if(n===a.index){let u;a.type===2?u=new D(i,i.nextSibling,this,e):a.type===1?u=new a.ctor(i,a.name,a.strings,this,e):a.type===6&&(u=new We(i,this,e)),this._$AV.push(u),a=s[++l]}n!==(a==null?void 0:a.index)&&(i=_.nextNode(),n++)}return _.currentNode=A,o}p(e){let t=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(e,s,t),t+=s.strings.length-2):s._$AI(e[t])),t++}}class D{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,t,s,o){this.type=2,this._$AH=p,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=s,this.options=o,this._$Cv=(o==null?void 0:o.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=C(this,e,t),N(e)?e===p||e==null||e===""?(this._$AH!==p&&this._$AR(),this._$AH=p):e!==this._$AH&&e!==S&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):De(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==p&&N(this._$AH)?this._$AA.nextSibling.data=e:this.T(A.createTextNode(e)),this._$AH=e}$(e){var i;const{values:t,_$litType$:s}=e,o=typeof s=="number"?this._$AC(e):(s.el===void 0&&(s.el=H.createElement(ge(s.h,s.h[0]),this.options)),s);if(((i=this._$AH)==null?void 0:i._$AD)===o)this._$AH.p(t);else{const n=new Me(o,this),l=n.u(this.options);n.p(t),this.T(l),this._$AH=n}}_$AC(e){let t=ce.get(e.strings);return t===void 0&&ce.set(e.strings,t=new H(e)),t}k(e){J(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let s,o=0;for(const i of e)o===t.length?t.push(s=new D(this.O(O()),this.O(O()),this,this.options)):s=t[o],s._$AI(i),o++;o<t.length&&(this._$AR(s&&s._$AB.nextSibling,o),t.length=o)}_$AR(e=this._$AA.nextSibling,t){var s;for((s=this._$AP)==null?void 0:s.call(this,!1,!0,t);e&&e!==this._$AB;){const o=e.nextSibling;e.remove(),e=o}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}}class I{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,s,o,i){this.type=1,this._$AH=p,this._$AN=void 0,this.element=e,this.name=t,this._$AM=o,this.options=i,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=p}_$AI(e,t=this,s,o){const i=this.strings;let n=!1;if(i===void 0)e=C(this,e,t,0),n=!N(e)||e!==this._$AH&&e!==S,n&&(this._$AH=e);else{const l=e;let a,u;for(e=i[0],a=0;a<i.length-1;a++)u=C(this,l[s+a],t,a),u===S&&(u=this._$AH[a]),n||(n=!N(u)||u!==this._$AH[a]),u===p?e=p:e!==p&&(e+=(u??"")+i[a+1]),this._$AH[a]=u}n&&!o&&this.j(e)}j(e){e===p?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class Ie extends I{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===p?void 0:e}}class ze extends I{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==p)}}class je extends I{constructor(e,t,s,o,i){super(e,t,s,o,i),this.type=5}_$AI(e,t=this){if((e=C(this,e,t,0)??p)===S)return;const s=this._$AH,o=e===p&&s!==p||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,i=e!==p&&(s===p||o);o&&this.element.removeEventListener(this.name,this,s),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t;typeof this._$AH=="function"?this._$AH.call(((t=this.options)==null?void 0:t.host)??this.element,e):this._$AH.handleEvent(e)}}class We{constructor(e,t,s){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(e){C(this,e)}}const B=R.litHtmlPolyfillSupport;B==null||B(H,D),(R.litHtmlVersions??(R.litHtmlVersions=[])).push("3.2.1");const Be=(r,e,t)=>{const s=(t==null?void 0:t.renderBefore)??e;let o=s._$litPart$;if(o===void 0){const i=(t==null?void 0:t.renderBefore)??null;s._$litPart$=o=new D(e.insertBefore(O(),i),i,void 0,t??{})}return o._$AI(r),o};/**
16
16
  * @license
17
17
  * Copyright 2017 Google LLC
18
18
  * SPDX-License-Identifier: BSD-3-Clause
19
- */class S extends I{constructor(){super(...arguments),this.renderOptions={host:this},this.o=void 0}createRenderRoot(){var e;const t=super.createRenderRoot();return(e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this.o=De(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this.o)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this.o)==null||t.setConnected(!1)}render(){return w}}var Yt;S._$litElement$=!0,S.finalized=!0,(Yt=globalThis.litElementHydrateSupport)==null||Yt.call(globalThis,{LitElement:S});const ct=globalThis.litElementPolyfillSupport;ct==null||ct({LitElement:S});(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.1.0");var Fe=$`
20
- :host {
21
- --border-color: var(--sl-color-neutral-200);
22
- --border-radius: var(--sl-border-radius-medium);
23
- --border-width: 1px;
24
- --padding: var(--sl-spacing-large);
25
-
26
- display: inline-block;
27
- }
28
-
29
- .card {
30
- display: flex;
31
- flex-direction: column;
32
- background-color: var(--sl-panel-background-color);
33
- box-shadow: var(--sl-shadow-x-small);
34
- border: solid var(--border-width) var(--border-color);
35
- border-radius: var(--border-radius);
36
- }
37
-
38
- .card__image {
39
- display: flex;
40
- border-top-left-radius: var(--border-radius);
41
- border-top-right-radius: var(--border-radius);
42
- margin: calc(-1 * var(--border-width));
43
- overflow: hidden;
44
- }
45
-
46
- .card__image::slotted(img) {
47
- display: block;
48
- width: 100%;
49
- }
50
-
51
- .card:not(.card--has-image) .card__image {
52
- display: none;
53
- }
54
-
55
- .card__header {
56
- display: block;
57
- border-bottom: solid var(--border-width) var(--border-color);
58
- padding: calc(var(--padding) / 2) var(--padding);
59
- }
60
-
61
- .card:not(.card--has-header) .card__header {
62
- display: none;
63
- }
64
-
65
- .card:not(.card--has-image) .card__header {
66
- border-top-left-radius: var(--border-radius);
67
- border-top-right-radius: var(--border-radius);
68
- }
69
-
70
- .card__body {
71
- display: block;
72
- padding: var(--padding);
73
- }
74
-
75
- .card--has-footer .card__footer {
76
- display: block;
77
- border-top: solid var(--border-width) var(--border-color);
78
- padding: var(--padding);
79
- }
80
-
81
- .card:not(.card--has-footer) .card__footer {
82
- display: none;
83
- }
84
- `,St=class{constructor(o,...t){this.slotNames=[],this.handleSlotChange=e=>{const r=e.target;(this.slotNames.includes("[default]")&&!r.name||r.name&&this.slotNames.includes(r.name))&&this.host.requestUpdate()},(this.host=o).addController(this),this.slotNames=t}hasDefaultSlot(){return[...this.host.childNodes].some(o=>{if(o.nodeType===o.TEXT_NODE&&o.textContent.trim()!=="")return!0;if(o.nodeType===o.ELEMENT_NODE){const t=o;if(t.tagName.toLowerCase()==="sl-visually-hidden")return!1;if(!t.hasAttribute("slot"))return!0}return!1})}hasNamedSlot(o){return this.host.querySelector(`:scope > [slot="${o}"]`)!==null}test(o){return o==="[default]"?this.hasDefaultSlot():this.hasNamedSlot(o)}hostConnected(){this.host.shadowRoot.addEventListener("slotchange",this.handleSlotChange)}hostDisconnected(){this.host.shadowRoot.removeEventListener("slotchange",this.handleSlotChange)}},Q=$`
85
- :host {
86
- box-sizing: border-box;
87
- }
88
-
89
- :host *,
90
- :host *::before,
91
- :host *::after {
92
- box-sizing: inherit;
93
- }
94
-
95
- [hidden] {
96
- display: none !important;
97
- }
98
- `,ee=Object.defineProperty,He=Object.defineProperties,je=Object.getOwnPropertyDescriptor,qe=Object.getOwnPropertyDescriptors,Ft=Object.getOwnPropertySymbols,We=Object.prototype.hasOwnProperty,Ke=Object.prototype.propertyIsEnumerable,Ht=(o,t,e)=>t in o?ee(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e,X=(o,t)=>{for(var e in t||(t={}))We.call(t,e)&&Ht(o,e,t[e]);if(Ft)for(var e of Ft(t))Ke.call(t,e)&&Ht(o,e,t[e]);return o},oe=(o,t)=>He(o,qe(t)),a=(o,t,e,r)=>{for(var s=r>1?void 0:r?je(t,e):t,i=o.length-1,n;i>=0;i--)(n=o[i])&&(s=(r?n(t,e,s):n(s))||s);return r&&s&&ee(t,e,s),s};/**
99
- * @license
100
- * Copyright 2017 Google LLC
101
- * SPDX-License-Identifier: BSD-3-Clause
102
- */const Ze={attribute:!0,type:String,converter:R,reflect:!1,hasChanged:Ct},Ye=(o=Ze,t,e)=>{const{kind:r,metadata:s}=e;let i=globalThis.litPropertyMetadata.get(s);if(i===void 0&&globalThis.litPropertyMetadata.set(s,i=new Map),i.set(e.name,o),r==="accessor"){const{name:n}=e;return{set(d){const l=t.get.call(this);t.set.call(this,d),this.requestUpdate(n,l,o)},init(d){return d!==void 0&&this.P(n,void 0,o),d}}}if(r==="setter"){const{name:n}=e;return function(d){const l=this[n];t.call(this,d),this.requestUpdate(n,l,o)}}throw Error("Unsupported decorator location: "+r)};function u(o){return(t,e)=>typeof e=="object"?Ye(o,t,e):((r,s,i)=>{const n=s.hasOwnProperty(i);return s.constructor.createProperty(i,n?{...r,wrapped:!0}:r),n?Object.getOwnPropertyDescriptor(s,i):void 0})(o,t,e)}/**
103
- * @license
104
- * Copyright 2017 Google LLC
105
- * SPDX-License-Identifier: BSD-3-Clause
106
- */function at(o){return u({...o,state:!0,attribute:!1})}/**
107
- * @license
108
- * Copyright 2017 Google LLC
109
- * SPDX-License-Identifier: BSD-3-Clause
110
- */const Je=(o,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(o,t,e),e);/**
111
- * @license
112
- * Copyright 2017 Google LLC
113
- * SPDX-License-Identifier: BSD-3-Clause
114
- */function re(o,t){return(e,r,s)=>{const i=n=>{var d;return((d=n.renderRoot)==null?void 0:d.querySelector(o))??null};return Je(e,r,{get(){return i(this)}})}}var k=class extends S{constructor(){super(),Object.entries(this.constructor.dependencies).forEach(([o,t])=>{this.constructor.define(o,t)})}emit(o,t){const e=new CustomEvent(o,X({bubbles:!0,cancelable:!1,composed:!0,detail:{}},t));return this.dispatchEvent(e),e}static define(o,t=this,e={}){const r=customElements.get(o);if(!r){try{customElements.define(o,t,e)}catch{customElements.define(o,class extends t{},e)}return}let s=" (unknown version)",i=s;"version"in t&&t.version&&(s=" v"+t.version),"version"in r&&r.version&&(i=" v"+r.version),!(s&&i&&s===i)&&console.warn(`Attempted to register <${o}>${s}, but <${o}>${i} has already been registered.`)}};k.version="2.16.0";k.dependencies={};a([u()],k.prototype,"dir",2);a([u()],k.prototype,"lang",2);/**
115
- * @license
116
- * Copyright 2017 Google LLC
117
- * SPDX-License-Identifier: BSD-3-Clause
118
- */const T={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},se=o=>(...t)=>({_$litDirective$:o,values:t});class ie{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,r){this.t=t,this._$AM=e,this.i=r}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}/**
119
- * @license
120
- * Copyright 2018 Google LLC
121
- * SPDX-License-Identifier: BSD-3-Clause
122
- */const it=se(class extends ie{constructor(o){var t;if(super(o),o.type!==T.ATTRIBUTE||o.name!=="class"||((t=o.strings)==null?void 0:t.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(o){return" "+Object.keys(o).filter(t=>o[t]).join(" ")+" "}update(o,[t]){var r,s;if(this.st===void 0){this.st=new Set,o.strings!==void 0&&(this.nt=new Set(o.strings.join(" ").split(/\s/).filter(i=>i!=="")));for(const i in t)t[i]&&!((r=this.nt)!=null&&r.has(i))&&this.st.add(i);return this.render(t)}const e=o.element.classList;for(const i of this.st)i in t||(e.remove(i),this.st.delete(i));for(const i in t){const n=!!t[i];n===this.st.has(i)||(s=this.nt)!=null&&s.has(i)||(n?(e.add(i),this.st.add(i)):(e.remove(i),this.st.delete(i)))}return w}});var ne=class extends k{constructor(){super(...arguments),this.hasSlotController=new St(this,"footer","header","image")}render(){return v`
123
- <div
124
- part="base"
125
- class=${it({card:!0,"card--has-footer":this.hasSlotController.test("footer"),"card--has-image":this.hasSlotController.test("image"),"card--has-header":this.hasSlotController.test("header")})}
126
- >
127
- <slot name="image" part="image" class="card__image"></slot>
128
- <slot name="header" part="header" class="card__header"></slot>
129
- <slot part="body" class="card__body"></slot>
130
- <slot name="footer" part="footer" class="card__footer"></slot>
131
- </div>
132
- `}};ne.styles=[Q,Fe];ne.define("sl-card");var Ge=$`
133
- :host {
134
- display: block;
135
- }
136
-
137
- .input {
138
- flex: 1 1 auto;
139
- display: inline-flex;
140
- align-items: stretch;
141
- justify-content: start;
142
- position: relative;
143
- width: 100%;
144
- font-family: var(--sl-input-font-family);
145
- font-weight: var(--sl-input-font-weight);
146
- letter-spacing: var(--sl-input-letter-spacing);
147
- vertical-align: middle;
148
- overflow: hidden;
149
- cursor: text;
150
- transition:
151
- var(--sl-transition-fast) color,
152
- var(--sl-transition-fast) border,
153
- var(--sl-transition-fast) box-shadow,
154
- var(--sl-transition-fast) background-color;
155
- }
156
-
157
- /* Standard inputs */
158
- .input--standard {
159
- background-color: var(--sl-input-background-color);
160
- border: solid var(--sl-input-border-width) var(--sl-input-border-color);
161
- }
162
-
163
- .input--standard:hover:not(.input--disabled) {
164
- background-color: var(--sl-input-background-color-hover);
165
- border-color: var(--sl-input-border-color-hover);
166
- }
167
-
168
- .input--standard.input--focused:not(.input--disabled) {
169
- background-color: var(--sl-input-background-color-focus);
170
- border-color: var(--sl-input-border-color-focus);
171
- box-shadow: 0 0 0 var(--sl-focus-ring-width) var(--sl-input-focus-ring-color);
172
- }
173
-
174
- .input--standard.input--focused:not(.input--disabled) .input__control {
175
- color: var(--sl-input-color-focus);
176
- }
177
-
178
- .input--standard.input--disabled {
179
- background-color: var(--sl-input-background-color-disabled);
180
- border-color: var(--sl-input-border-color-disabled);
181
- opacity: 0.5;
182
- cursor: not-allowed;
183
- }
184
-
185
- .input--standard.input--disabled .input__control {
186
- color: var(--sl-input-color-disabled);
187
- }
188
-
189
- .input--standard.input--disabled .input__control::placeholder {
190
- color: var(--sl-input-placeholder-color-disabled);
191
- }
192
-
193
- /* Filled inputs */
194
- .input--filled {
195
- border: none;
196
- background-color: var(--sl-input-filled-background-color);
197
- color: var(--sl-input-color);
198
- }
199
-
200
- .input--filled:hover:not(.input--disabled) {
201
- background-color: var(--sl-input-filled-background-color-hover);
202
- }
203
-
204
- .input--filled.input--focused:not(.input--disabled) {
205
- background-color: var(--sl-input-filled-background-color-focus);
206
- outline: var(--sl-focus-ring);
207
- outline-offset: var(--sl-focus-ring-offset);
208
- }
209
-
210
- .input--filled.input--disabled {
211
- background-color: var(--sl-input-filled-background-color-disabled);
212
- opacity: 0.5;
213
- cursor: not-allowed;
214
- }
215
-
216
- .input__control {
217
- flex: 1 1 auto;
218
- font-family: inherit;
219
- font-size: inherit;
220
- font-weight: inherit;
221
- min-width: 0;
222
- height: 100%;
223
- color: var(--sl-input-color);
224
- border: none;
225
- background: inherit;
226
- box-shadow: none;
227
- padding: 0;
228
- margin: 0;
229
- cursor: inherit;
230
- -webkit-appearance: none;
231
- }
232
-
233
- .input__control::-webkit-search-decoration,
234
- .input__control::-webkit-search-cancel-button,
235
- .input__control::-webkit-search-results-button,
236
- .input__control::-webkit-search-results-decoration {
237
- -webkit-appearance: none;
238
- }
239
-
240
- .input__control:-webkit-autofill,
241
- .input__control:-webkit-autofill:hover,
242
- .input__control:-webkit-autofill:focus,
243
- .input__control:-webkit-autofill:active {
244
- box-shadow: 0 0 0 var(--sl-input-height-large) var(--sl-input-background-color-hover) inset !important;
245
- -webkit-text-fill-color: var(--sl-color-primary-500);
246
- caret-color: var(--sl-input-color);
247
- }
248
-
249
- .input--filled .input__control:-webkit-autofill,
250
- .input--filled .input__control:-webkit-autofill:hover,
251
- .input--filled .input__control:-webkit-autofill:focus,
252
- .input--filled .input__control:-webkit-autofill:active {
253
- box-shadow: 0 0 0 var(--sl-input-height-large) var(--sl-input-filled-background-color) inset !important;
254
- }
255
-
256
- .input__control::placeholder {
257
- color: var(--sl-input-placeholder-color);
258
- user-select: none;
259
- -webkit-user-select: none;
260
- }
261
-
262
- .input:hover:not(.input--disabled) .input__control {
263
- color: var(--sl-input-color-hover);
264
- }
265
-
266
- .input__control:focus {
267
- outline: none;
268
- }
269
-
270
- .input__prefix,
271
- .input__suffix {
272
- display: inline-flex;
273
- flex: 0 0 auto;
274
- align-items: center;
275
- cursor: default;
276
- }
277
-
278
- .input__prefix ::slotted(sl-icon),
279
- .input__suffix ::slotted(sl-icon) {
280
- color: var(--sl-input-icon-color);
281
- }
282
-
283
- /*
284
- * Size modifiers
285
- */
286
-
287
- .input--small {
288
- border-radius: var(--sl-input-border-radius-small);
289
- font-size: var(--sl-input-font-size-small);
290
- height: var(--sl-input-height-small);
291
- }
292
-
293
- .input--small .input__control {
294
- height: calc(var(--sl-input-height-small) - var(--sl-input-border-width) * 2);
295
- padding: 0 var(--sl-input-spacing-small);
296
- }
297
-
298
- .input--small .input__clear,
299
- .input--small .input__password-toggle {
300
- width: calc(1em + var(--sl-input-spacing-small) * 2);
301
- }
302
-
303
- .input--small .input__prefix ::slotted(*) {
304
- margin-inline-start: var(--sl-input-spacing-small);
305
- }
306
-
307
- .input--small .input__suffix ::slotted(*) {
308
- margin-inline-end: var(--sl-input-spacing-small);
309
- }
310
-
311
- .input--medium {
312
- border-radius: var(--sl-input-border-radius-medium);
313
- font-size: var(--sl-input-font-size-medium);
314
- height: var(--sl-input-height-medium);
315
- }
316
-
317
- .input--medium .input__control {
318
- height: calc(var(--sl-input-height-medium) - var(--sl-input-border-width) * 2);
319
- padding: 0 var(--sl-input-spacing-medium);
320
- }
321
-
322
- .input--medium .input__clear,
323
- .input--medium .input__password-toggle {
324
- width: calc(1em + var(--sl-input-spacing-medium) * 2);
325
- }
326
-
327
- .input--medium .input__prefix ::slotted(*) {
328
- margin-inline-start: var(--sl-input-spacing-medium);
329
- }
330
-
331
- .input--medium .input__suffix ::slotted(*) {
332
- margin-inline-end: var(--sl-input-spacing-medium);
333
- }
334
-
335
- .input--large {
336
- border-radius: var(--sl-input-border-radius-large);
337
- font-size: var(--sl-input-font-size-large);
338
- height: var(--sl-input-height-large);
339
- }
340
-
341
- .input--large .input__control {
342
- height: calc(var(--sl-input-height-large) - var(--sl-input-border-width) * 2);
343
- padding: 0 var(--sl-input-spacing-large);
344
- }
345
-
346
- .input--large .input__clear,
347
- .input--large .input__password-toggle {
348
- width: calc(1em + var(--sl-input-spacing-large) * 2);
349
- }
350
-
351
- .input--large .input__prefix ::slotted(*) {
352
- margin-inline-start: var(--sl-input-spacing-large);
353
- }
354
-
355
- .input--large .input__suffix ::slotted(*) {
356
- margin-inline-end: var(--sl-input-spacing-large);
357
- }
358
-
359
- /*
360
- * Pill modifier
361
- */
362
-
363
- .input--pill.input--small {
364
- border-radius: var(--sl-input-height-small);
365
- }
366
-
367
- .input--pill.input--medium {
368
- border-radius: var(--sl-input-height-medium);
369
- }
370
-
371
- .input--pill.input--large {
372
- border-radius: var(--sl-input-height-large);
373
- }
374
-
375
- /*
376
- * Clearable + Password Toggle
377
- */
378
-
379
- .input__clear,
380
- .input__password-toggle {
381
- display: inline-flex;
382
- align-items: center;
383
- justify-content: center;
384
- font-size: inherit;
385
- color: var(--sl-input-icon-color);
386
- border: none;
387
- background: none;
388
- padding: 0;
389
- transition: var(--sl-transition-fast) color;
390
- cursor: pointer;
391
- }
392
-
393
- .input__clear:hover,
394
- .input__password-toggle:hover {
395
- color: var(--sl-input-icon-color-hover);
396
- }
397
-
398
- .input__clear:focus,
399
- .input__password-toggle:focus {
400
- outline: none;
401
- }
402
-
403
- /* Don't show the browser's password toggle in Edge */
404
- ::-ms-reveal {
405
- display: none;
406
- }
407
-
408
- /* Hide the built-in number spinner */
409
- .input--no-spin-buttons input[type='number']::-webkit-outer-spin-button,
410
- .input--no-spin-buttons input[type='number']::-webkit-inner-spin-button {
411
- -webkit-appearance: none;
412
- display: none;
413
- }
414
-
415
- .input--no-spin-buttons input[type='number'] {
416
- -moz-appearance: textfield;
417
- }
418
- `,Qe=(o="value")=>(t,e)=>{const r=t.constructor,s=r.prototype.attributeChangedCallback;r.prototype.attributeChangedCallback=function(i,n,d){var l;const c=r.getPropertyOptions(o),b=typeof c.attribute=="string"?c.attribute:o;if(i===b){const p=c.converter||R,y=(typeof p=="function"?p:(l=p==null?void 0:p.fromAttribute)!=null?l:R.fromAttribute)(d,c.type);this[o]!==y&&(this[e]=y)}s.call(this,i,n,d)}},Xe=$`
419
- .form-control .form-control__label {
420
- display: none;
421
- }
422
-
423
- .form-control .form-control__help-text {
424
- display: none;
425
- }
426
-
427
- /* Label */
428
- .form-control--has-label .form-control__label {
429
- display: inline-block;
430
- color: var(--sl-input-label-color);
431
- margin-bottom: var(--sl-spacing-3x-small);
432
- }
433
-
434
- .form-control--has-label.form-control--small .form-control__label {
435
- font-size: var(--sl-input-label-font-size-small);
436
- }
437
-
438
- .form-control--has-label.form-control--medium .form-control__label {
439
- font-size: var(--sl-input-label-font-size-medium);
440
- }
441
-
442
- .form-control--has-label.form-control--large .form-control__label {
443
- font-size: var(--sl-input-label-font-size-large);
444
- }
445
-
446
- :host([required]) .form-control--has-label .form-control__label::after {
447
- content: var(--sl-input-required-content);
448
- margin-inline-start: var(--sl-input-required-content-offset);
449
- color: var(--sl-input-required-content-color);
450
- }
451
-
452
- /* Help text */
453
- .form-control--has-help-text .form-control__help-text {
454
- display: block;
455
- color: var(--sl-input-help-text-color);
456
- margin-top: var(--sl-spacing-3x-small);
457
- }
458
-
459
- .form-control--has-help-text.form-control--small .form-control__help-text {
460
- font-size: var(--sl-input-help-text-font-size-small);
461
- }
462
-
463
- .form-control--has-help-text.form-control--medium .form-control__help-text {
464
- font-size: var(--sl-input-help-text-font-size-medium);
465
- }
466
-
467
- .form-control--has-help-text.form-control--large .form-control__help-text {
468
- font-size: var(--sl-input-help-text-font-size-large);
469
- }
470
-
471
- .form-control--has-help-text.form-control--radio-group .form-control__help-text {
472
- margin-top: var(--sl-spacing-2x-small);
473
- }
474
- `,D=new WeakMap,F=new WeakMap,H=new WeakMap,ht=new WeakSet,et=new WeakMap,ae=class{constructor(o,t){this.handleFormData=e=>{const r=this.options.disabled(this.host),s=this.options.name(this.host),i=this.options.value(this.host),n=this.host.tagName.toLowerCase()==="sl-button";this.host.isConnected&&!r&&!n&&typeof s=="string"&&s.length>0&&typeof i<"u"&&(Array.isArray(i)?i.forEach(d=>{e.formData.append(s,d.toString())}):e.formData.append(s,i.toString()))},this.handleFormSubmit=e=>{var r;const s=this.options.disabled(this.host),i=this.options.reportValidity;this.form&&!this.form.noValidate&&((r=D.get(this.form))==null||r.forEach(n=>{this.setUserInteracted(n,!0)})),this.form&&!this.form.noValidate&&!s&&!i(this.host)&&(e.preventDefault(),e.stopImmediatePropagation())},this.handleFormReset=()=>{this.options.setValue(this.host,this.options.defaultValue(this.host)),this.setUserInteracted(this.host,!1),et.set(this.host,[])},this.handleInteraction=e=>{const r=et.get(this.host);r.includes(e.type)||r.push(e.type),r.length===this.options.assumeInteractionOn.length&&this.setUserInteracted(this.host,!0)},this.checkFormValidity=()=>{if(this.form&&!this.form.noValidate){const e=this.form.querySelectorAll("*");for(const r of e)if(typeof r.checkValidity=="function"&&!r.checkValidity())return!1}return!0},this.reportFormValidity=()=>{if(this.form&&!this.form.noValidate){const e=this.form.querySelectorAll("*");for(const r of e)if(typeof r.reportValidity=="function"&&!r.reportValidity())return!1}return!0},(this.host=o).addController(this),this.options=X({form:e=>{const r=e.form;if(r){const i=e.getRootNode().querySelector(`#${r}`);if(i)return i}return e.closest("form")},name:e=>e.name,value:e=>e.value,defaultValue:e=>e.defaultValue,disabled:e=>{var r;return(r=e.disabled)!=null?r:!1},reportValidity:e=>typeof e.reportValidity=="function"?e.reportValidity():!0,checkValidity:e=>typeof e.checkValidity=="function"?e.checkValidity():!0,setValue:(e,r)=>e.value=r,assumeInteractionOn:["sl-input"]},t)}hostConnected(){const o=this.options.form(this.host);o&&this.attachForm(o),et.set(this.host,[]),this.options.assumeInteractionOn.forEach(t=>{this.host.addEventListener(t,this.handleInteraction)})}hostDisconnected(){this.detachForm(),et.delete(this.host),this.options.assumeInteractionOn.forEach(o=>{this.host.removeEventListener(o,this.handleInteraction)})}hostUpdated(){const o=this.options.form(this.host);o||this.detachForm(),o&&this.form!==o&&(this.detachForm(),this.attachForm(o)),this.host.hasUpdated&&this.setValidity(this.host.validity.valid)}attachForm(o){o?(this.form=o,D.has(this.form)?D.get(this.form).add(this.host):D.set(this.form,new Set([this.host])),this.form.addEventListener("formdata",this.handleFormData),this.form.addEventListener("submit",this.handleFormSubmit),this.form.addEventListener("reset",this.handleFormReset),F.has(this.form)||(F.set(this.form,this.form.reportValidity),this.form.reportValidity=()=>this.reportFormValidity()),H.has(this.form)||(H.set(this.form,this.form.checkValidity),this.form.checkValidity=()=>this.checkFormValidity())):this.form=void 0}detachForm(){if(!this.form)return;const o=D.get(this.form);o&&(o.delete(this.host),o.size<=0&&(this.form.removeEventListener("formdata",this.handleFormData),this.form.removeEventListener("submit",this.handleFormSubmit),this.form.removeEventListener("reset",this.handleFormReset),F.has(this.form)&&(this.form.reportValidity=F.get(this.form),F.delete(this.form)),H.has(this.form)&&(this.form.checkValidity=H.get(this.form),H.delete(this.form)),this.form=void 0))}setUserInteracted(o,t){t?ht.add(o):ht.delete(o),o.requestUpdate()}doAction(o,t){if(this.form){const e=document.createElement("button");e.type=o,e.style.position="absolute",e.style.width="0",e.style.height="0",e.style.clipPath="inset(50%)",e.style.overflow="hidden",e.style.whiteSpace="nowrap",t&&(e.name=t.name,e.value=t.value,["formaction","formenctype","formmethod","formnovalidate","formtarget"].forEach(r=>{t.hasAttribute(r)&&e.setAttribute(r,t.getAttribute(r))})),this.form.append(e),e.click(),e.remove()}}getForm(){var o;return(o=this.form)!=null?o:null}reset(o){this.doAction("reset",o)}submit(o){this.doAction("submit",o)}setValidity(o){const t=this.host,e=!!ht.has(t),r=!!t.required;t.toggleAttribute("data-required",r),t.toggleAttribute("data-optional",!r),t.toggleAttribute("data-invalid",!o),t.toggleAttribute("data-valid",o),t.toggleAttribute("data-user-invalid",!o&&e),t.toggleAttribute("data-user-valid",o&&e)}updateValidity(){const o=this.host;this.setValidity(o.validity.valid)}emitInvalidEvent(o){const t=new CustomEvent("sl-invalid",{bubbles:!1,composed:!1,cancelable:!0,detail:{}});o||t.preventDefault(),this.host.dispatchEvent(t)||o==null||o.preventDefault()}},Et=Object.freeze({badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:!0,valueMissing:!1});Object.freeze(oe(X({},Et),{valid:!1,valueMissing:!0}));Object.freeze(oe(X({},Et),{valid:!1,customError:!0}));const gt=new Set,V=new Map;let z,Pt="ltr",Tt="en";const le=typeof MutationObserver<"u"&&typeof document<"u"&&typeof document.documentElement<"u";if(le){const o=new MutationObserver(de);Pt=document.documentElement.dir||"ltr",Tt=document.documentElement.lang||navigator.language,o.observe(document.documentElement,{attributes:!0,attributeFilter:["dir","lang"]})}function ue(...o){o.map(t=>{const e=t.$code.toLowerCase();V.has(e)?V.set(e,Object.assign(Object.assign({},V.get(e)),t)):V.set(e,t),z||(z=t)}),de()}function de(){le&&(Pt=document.documentElement.dir||"ltr",Tt=document.documentElement.lang||navigator.language),[...gt.keys()].map(o=>{typeof o.requestUpdate=="function"&&o.requestUpdate()})}let to=class{constructor(t){this.host=t,this.host.addController(this)}hostConnected(){gt.add(this.host)}hostDisconnected(){gt.delete(this.host)}dir(){return`${this.host.dir||Pt}`.toLowerCase()}lang(){return`${this.host.lang||Tt}`.toLowerCase()}getTranslationData(t){var e,r;const s=new Intl.Locale(t.replace(/_/g,"-")),i=s==null?void 0:s.language.toLowerCase(),n=(r=(e=s==null?void 0:s.region)===null||e===void 0?void 0:e.toLowerCase())!==null&&r!==void 0?r:"",d=V.get(`${i}-${n}`),l=V.get(i);return{locale:s,language:i,region:n,primary:d,secondary:l}}exists(t,e){var r;const{primary:s,secondary:i}=this.getTranslationData((r=e.lang)!==null&&r!==void 0?r:this.lang());return e=Object.assign({includeFallback:!1},e),!!(s&&s[t]||i&&i[t]||e.includeFallback&&z&&z[t])}term(t,...e){const{primary:r,secondary:s}=this.getTranslationData(this.lang());let i;if(r&&r[t])i=r[t];else if(s&&s[t])i=s[t];else if(z&&z[t])i=z[t];else return console.error(`No translation found for: ${String(t)}`),String(t);return typeof i=="function"?i(...e):i}date(t,e){return t=new Date(t),new Intl.DateTimeFormat(this.lang(),e).format(t)}number(t,e){return t=Number(t),isNaN(t)?"":new Intl.NumberFormat(this.lang(),e).format(t)}relativeTime(t,e,r){return new Intl.RelativeTimeFormat(this.lang(),r).format(t,e)}};var ce={$code:"en",$name:"English",$dir:"ltr",carousel:"Carousel",clearEntry:"Clear entry",close:"Close",copied:"Copied",copy:"Copy",currentValue:"Current value",error:"Error",goToSlide:(o,t)=>`Go to slide ${o} of ${t}`,hidePassword:"Hide password",loading:"Loading",nextSlide:"Next slide",numOptionsSelected:o=>o===0?"No options selected":o===1?"1 option selected":`${o} options selected`,previousSlide:"Previous slide",progress:"Progress",remove:"Remove",resize:"Resize",scrollToEnd:"Scroll to end",scrollToStart:"Scroll to start",selectAColorFromTheScreen:"Select a color from the screen",showPassword:"Show password",slideNum:o=>`Slide ${o}`,toggleColorFormat:"Toggle color format"};ue(ce);var eo=ce,zt=class extends to{};ue(eo);var vt="";function jt(o){vt=o}function oo(o=""){if(!vt){const t=[...document.getElementsByTagName("script")],e=t.find(r=>r.hasAttribute("data-shoelace"));if(e)jt(e.getAttribute("data-shoelace"));else{const r=t.find(i=>/shoelace(\.min)?\.js($|\?)/.test(i.src)||/shoelace-autoloader(\.min)?\.js($|\?)/.test(i.src));let s="";r&&(s=r.getAttribute("src")),jt(s.split("/").slice(0,-1).join("/"))}}return vt.replace(/\/$/,"")+(o?`/${o.replace(/^\//,"")}`:"")}var ro={name:"default",resolver:o=>oo(`assets/icons/${o}.svg`)},so=ro,qt={caret:`
475
- <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
476
- <polyline points="6 9 12 15 18 9"></polyline>
477
- </svg>
478
- `,check:`
479
- <svg part="checked-icon" class="checkbox__icon" viewBox="0 0 16 16">
480
- <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round">
481
- <g stroke="currentColor">
482
- <g transform="translate(3.428571, 3.428571)">
483
- <path d="M0,5.71428571 L3.42857143,9.14285714"></path>
484
- <path d="M9.14285714,0 L3.42857143,9.14285714"></path>
485
- </g>
486
- </g>
487
- </g>
488
- </svg>
489
- `,"chevron-down":`
490
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-chevron-down" viewBox="0 0 16 16">
491
- <path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z"/>
492
- </svg>
493
- `,"chevron-left":`
494
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-chevron-left" viewBox="0 0 16 16">
495
- <path fill-rule="evenodd" d="M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z"/>
496
- </svg>
497
- `,"chevron-right":`
498
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-chevron-right" viewBox="0 0 16 16">
499
- <path fill-rule="evenodd" d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z"/>
500
- </svg>
501
- `,copy:`
502
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-copy" viewBox="0 0 16 16">
503
- <path fill-rule="evenodd" d="M4 2a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V2Zm2-1a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H6ZM2 5a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1v-1h1v1a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h1v1H2Z"/>
504
- </svg>
505
- `,eye:`
506
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-eye" viewBox="0 0 16 16">
507
- <path d="M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8zM1.173 8a13.133 13.133 0 0 1 1.66-2.043C4.12 4.668 5.88 3.5 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13.133 13.133 0 0 1 14.828 8c-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755C11.879 11.332 10.119 12.5 8 12.5c-2.12 0-3.879-1.168-5.168-2.457A13.134 13.134 0 0 1 1.172 8z"/>
508
- <path d="M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5zM4.5 8a3.5 3.5 0 1 1 7 0 3.5 3.5 0 0 1-7 0z"/>
509
- </svg>
510
- `,"eye-slash":`
511
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-eye-slash" viewBox="0 0 16 16">
512
- <path d="M13.359 11.238C15.06 9.72 16 8 16 8s-3-5.5-8-5.5a7.028 7.028 0 0 0-2.79.588l.77.771A5.944 5.944 0 0 1 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13.134 13.134 0 0 1 14.828 8c-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755-.165.165-.337.328-.517.486l.708.709z"/>
513
- <path d="M11.297 9.176a3.5 3.5 0 0 0-4.474-4.474l.823.823a2.5 2.5 0 0 1 2.829 2.829l.822.822zm-2.943 1.299.822.822a3.5 3.5 0 0 1-4.474-4.474l.823.823a2.5 2.5 0 0 0 2.829 2.829z"/>
514
- <path d="M3.35 5.47c-.18.16-.353.322-.518.487A13.134 13.134 0 0 0 1.172 8l.195.288c.335.48.83 1.12 1.465 1.755C4.121 11.332 5.881 12.5 8 12.5c.716 0 1.39-.133 2.02-.36l.77.772A7.029 7.029 0 0 1 8 13.5C3 13.5 0 8 0 8s.939-1.721 2.641-3.238l.708.709zm10.296 8.884-12-12 .708-.708 12 12-.708.708z"/>
515
- </svg>
516
- `,eyedropper:`
517
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-eyedropper" viewBox="0 0 16 16">
518
- <path d="M13.354.646a1.207 1.207 0 0 0-1.708 0L8.5 3.793l-.646-.647a.5.5 0 1 0-.708.708L8.293 5l-7.147 7.146A.5.5 0 0 0 1 12.5v1.793l-.854.853a.5.5 0 1 0 .708.707L1.707 15H3.5a.5.5 0 0 0 .354-.146L11 7.707l1.146 1.147a.5.5 0 0 0 .708-.708l-.647-.646 3.147-3.146a1.207 1.207 0 0 0 0-1.708l-2-2zM2 12.707l7-7L10.293 7l-7 7H2v-1.293z"></path>
519
- </svg>
520
- `,"grip-vertical":`
521
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-grip-vertical" viewBox="0 0 16 16">
522
- <path d="M7 2a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm3 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0zM7 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm3 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0zM7 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm3 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm-3 3a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm3 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm-3 3a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm3 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"></path>
523
- </svg>
524
- `,indeterminate:`
525
- <svg part="indeterminate-icon" class="checkbox__icon" viewBox="0 0 16 16">
526
- <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round">
527
- <g stroke="currentColor" stroke-width="2">
528
- <g transform="translate(2.285714, 6.857143)">
529
- <path d="M10.2857143,1.14285714 L1.14285714,1.14285714"></path>
530
- </g>
531
- </g>
532
- </g>
533
- </svg>
534
- `,"person-fill":`
535
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-person-fill" viewBox="0 0 16 16">
536
- <path d="M3 14s-1 0-1-1 1-4 6-4 6 3 6 4-1 1-1 1H3zm5-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6z"/>
537
- </svg>
538
- `,"play-fill":`
539
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-play-fill" viewBox="0 0 16 16">
540
- <path d="m11.596 8.697-6.363 3.692c-.54.313-1.233-.066-1.233-.697V4.308c0-.63.692-1.01 1.233-.696l6.363 3.692a.802.802 0 0 1 0 1.393z"></path>
541
- </svg>
542
- `,"pause-fill":`
543
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-pause-fill" viewBox="0 0 16 16">
544
- <path d="M5.5 3.5A1.5 1.5 0 0 1 7 5v6a1.5 1.5 0 0 1-3 0V5a1.5 1.5 0 0 1 1.5-1.5zm5 0A1.5 1.5 0 0 1 12 5v6a1.5 1.5 0 0 1-3 0V5a1.5 1.5 0 0 1 1.5-1.5z"></path>
545
- </svg>
546
- `,radio:`
547
- <svg part="checked-icon" class="radio__icon" viewBox="0 0 16 16">
548
- <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
549
- <g fill="currentColor">
550
- <circle cx="8" cy="8" r="3.42857143"></circle>
551
- </g>
552
- </g>
553
- </svg>
554
- `,"star-fill":`
555
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-star-fill" viewBox="0 0 16 16">
556
- <path d="M3.612 15.443c-.386.198-.824-.149-.746-.592l.83-4.73L.173 6.765c-.329-.314-.158-.888.283-.95l4.898-.696L7.538.792c.197-.39.73-.39.927 0l2.184 4.327 4.898.696c.441.062.612.636.282.95l-3.522 3.356.83 4.73c.078.443-.36.79-.746.592L8 13.187l-4.389 2.256z"/>
557
- </svg>
558
- `,"x-lg":`
559
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x-lg" viewBox="0 0 16 16">
560
- <path d="M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8 2.146 2.854Z"/>
561
- </svg>
562
- `,"x-circle-fill":`
563
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x-circle-fill" viewBox="0 0 16 16">
564
- <path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM5.354 4.646a.5.5 0 1 0-.708.708L7.293 8l-2.647 2.646a.5.5 0 0 0 .708.708L8 8.707l2.646 2.647a.5.5 0 0 0 .708-.708L8.707 8l2.647-2.646a.5.5 0 0 0-.708-.708L8 7.293 5.354 4.646z"></path>
565
- </svg>
566
- `},io={name:"system",resolver:o=>o in qt?`data:image/svg+xml,${encodeURIComponent(qt[o])}`:""},no=io,ao=[so,no],yt=[];function lo(o){yt.push(o)}function uo(o){yt=yt.filter(t=>t!==o)}function Wt(o){return ao.find(t=>t.name===o)}var co=$`
567
- :host {
568
- display: inline-block;
569
- width: 1em;
570
- height: 1em;
571
- box-sizing: content-box !important;
572
- }
573
-
574
- svg {
575
- display: block;
576
- height: 100%;
577
- width: 100%;
578
- }
579
- `;function M(o,t){const e=X({waitUntilFirstUpdate:!1},t);return(r,s)=>{const{update:i}=r,n=Array.isArray(o)?o:[o];r.update=function(d){n.forEach(l=>{const c=l;if(d.has(c)){const b=d.get(c),p=this[c];b!==p&&(!e.waitUntilFirstUpdate||this.hasUpdated)&&this[s](b,p)}}),i.call(this,d)}}}/**
580
- * @license
581
- * Copyright 2020 Google LLC
582
- * SPDX-License-Identifier: BSD-3-Clause
583
- */const ho=(o,t)=>(o==null?void 0:o._$litType$)!==void 0,po=o=>o.strings===void 0,bo={},fo=(o,t=bo)=>o._$AH=t;var j=Symbol(),ot=Symbol(),pt,bt=new Map,x=class extends k{constructor(){super(...arguments),this.initialRender=!1,this.svg=null,this.label="",this.library="default"}async resolveIcon(o,t){var e;let r;if(t!=null&&t.spriteSheet){this.svg=v`<svg part="svg">
584
- <use part="use" href="${o}"></use>
585
- </svg>`,await this.updateComplete;const s=this.shadowRoot.querySelector("[part='svg']");return typeof t.mutator=="function"&&t.mutator(s),this.svg}try{if(r=await fetch(o,{mode:"cors"}),!r.ok)return r.status===410?j:ot}catch{return ot}try{const s=document.createElement("div");s.innerHTML=await r.text();const i=s.firstElementChild;if(((e=i==null?void 0:i.tagName)==null?void 0:e.toLowerCase())!=="svg")return j;pt||(pt=new DOMParser);const d=pt.parseFromString(i.outerHTML,"text/html").body.querySelector("svg");return d?(d.part.add("svg"),document.adoptNode(d)):j}catch{return j}}connectedCallback(){super.connectedCallback(),lo(this)}firstUpdated(){this.initialRender=!0,this.setIcon()}disconnectedCallback(){super.disconnectedCallback(),uo(this)}getIconSource(){const o=Wt(this.library);return this.name&&o?{url:o.resolver(this.name),fromLibrary:!0}:{url:this.src,fromLibrary:!1}}handleLabelChange(){typeof this.label=="string"&&this.label.length>0?(this.setAttribute("role","img"),this.setAttribute("aria-label",this.label),this.removeAttribute("aria-hidden")):(this.removeAttribute("role"),this.removeAttribute("aria-label"),this.setAttribute("aria-hidden","true"))}async setIcon(){var o;const{url:t,fromLibrary:e}=this.getIconSource(),r=e?Wt(this.library):void 0;if(!t){this.svg=null;return}let s=bt.get(t);if(s||(s=this.resolveIcon(t,r),bt.set(t,s)),!this.initialRender)return;const i=await s;if(i===ot&&bt.delete(t),t===this.getIconSource().url){if(ho(i)){this.svg=i;return}switch(i){case ot:case j:this.svg=null,this.emit("sl-error");break;default:this.svg=i.cloneNode(!0),(o=r==null?void 0:r.mutator)==null||o.call(r,this.svg),this.emit("sl-load")}}}render(){return this.svg}};x.styles=[Q,co];a([at()],x.prototype,"svg",2);a([u({reflect:!0})],x.prototype,"name",2);a([u()],x.prototype,"src",2);a([u()],x.prototype,"label",2);a([u({reflect:!0})],x.prototype,"library",2);a([M("label")],x.prototype,"handleLabelChange",1);a([M(["name","src","library"])],x.prototype,"setIcon",1);/**
586
- * @license
587
- * Copyright 2018 Google LLC
588
- * SPDX-License-Identifier: BSD-3-Clause
589
- */const m=o=>o??g;/**
590
- * @license
591
- * Copyright 2020 Google LLC
592
- * SPDX-License-Identifier: BSD-3-Clause
593
- */const mo=se(class extends ie{constructor(o){if(super(o),o.type!==T.PROPERTY&&o.type!==T.ATTRIBUTE&&o.type!==T.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!po(o))throw Error("`live` bindings can only contain a single expression")}render(o){return o}update(o,[t]){if(t===w||t===g)return t;const e=o.element,r=o.name;if(o.type===T.PROPERTY){if(t===e[r])return w}else if(o.type===T.BOOLEAN_ATTRIBUTE){if(!!t===e.hasAttribute(r))return w}else if(o.type===T.ATTRIBUTE&&e.getAttribute(r)===t+"")return w;return fo(o),t}});var h=class extends k{constructor(){super(...arguments),this.formControlController=new ae(this,{assumeInteractionOn:["sl-blur","sl-input"]}),this.hasSlotController=new St(this,"help-text","label"),this.localize=new zt(this),this.hasFocus=!1,this.title="",this.__numberInput=Object.assign(document.createElement("input"),{type:"number"}),this.__dateInput=Object.assign(document.createElement("input"),{type:"date"}),this.type="text",this.name="",this.value="",this.defaultValue="",this.size="medium",this.filled=!1,this.pill=!1,this.label="",this.helpText="",this.clearable=!1,this.disabled=!1,this.placeholder="",this.readonly=!1,this.passwordToggle=!1,this.passwordVisible=!1,this.noSpinButtons=!1,this.form="",this.required=!1,this.spellcheck=!0}get valueAsDate(){var o;return this.__dateInput.type=this.type,this.__dateInput.value=this.value,((o=this.input)==null?void 0:o.valueAsDate)||this.__dateInput.valueAsDate}set valueAsDate(o){this.__dateInput.type=this.type,this.__dateInput.valueAsDate=o,this.value=this.__dateInput.value}get valueAsNumber(){var o;return this.__numberInput.value=this.value,((o=this.input)==null?void 0:o.valueAsNumber)||this.__numberInput.valueAsNumber}set valueAsNumber(o){this.__numberInput.valueAsNumber=o,this.value=this.__numberInput.value}get validity(){return this.input.validity}get validationMessage(){return this.input.validationMessage}firstUpdated(){this.formControlController.updateValidity()}handleBlur(){this.hasFocus=!1,this.emit("sl-blur")}handleChange(){this.value=this.input.value,this.emit("sl-change")}handleClearClick(o){o.preventDefault(),this.value!==""&&(this.value="",this.emit("sl-clear"),this.emit("sl-input"),this.emit("sl-change")),this.input.focus()}handleFocus(){this.hasFocus=!0,this.emit("sl-focus")}handleInput(){this.value=this.input.value,this.formControlController.updateValidity(),this.emit("sl-input")}handleInvalid(o){this.formControlController.setValidity(!1),this.formControlController.emitInvalidEvent(o)}handleKeyDown(o){const t=o.metaKey||o.ctrlKey||o.shiftKey||o.altKey;o.key==="Enter"&&!t&&setTimeout(()=>{!o.defaultPrevented&&!o.isComposing&&this.formControlController.submit()})}handlePasswordToggle(){this.passwordVisible=!this.passwordVisible}handleDisabledChange(){this.formControlController.setValidity(this.disabled)}handleStepChange(){this.input.step=String(this.step),this.formControlController.updateValidity()}async handleValueChange(){await this.updateComplete,this.formControlController.updateValidity()}focus(o){this.input.focus(o)}blur(){this.input.blur()}select(){this.input.select()}setSelectionRange(o,t,e="none"){this.input.setSelectionRange(o,t,e)}setRangeText(o,t,e,r="preserve"){const s=t??this.input.selectionStart,i=e??this.input.selectionEnd;this.input.setRangeText(o,s,i,r),this.value!==this.input.value&&(this.value=this.input.value)}showPicker(){"showPicker"in HTMLInputElement.prototype&&this.input.showPicker()}stepUp(){this.input.stepUp(),this.value!==this.input.value&&(this.value=this.input.value)}stepDown(){this.input.stepDown(),this.value!==this.input.value&&(this.value=this.input.value)}checkValidity(){return this.input.checkValidity()}getForm(){return this.formControlController.getForm()}reportValidity(){return this.input.reportValidity()}setCustomValidity(o){this.input.setCustomValidity(o),this.formControlController.updateValidity()}render(){const o=this.hasSlotController.test("label"),t=this.hasSlotController.test("help-text"),e=this.label?!0:!!o,r=this.helpText?!0:!!t,i=this.clearable&&!this.disabled&&!this.readonly&&(typeof this.value=="number"||this.value.length>0);return v`
594
- <div
595
- part="form-control"
596
- class=${it({"form-control":!0,"form-control--small":this.size==="small","form-control--medium":this.size==="medium","form-control--large":this.size==="large","form-control--has-label":e,"form-control--has-help-text":r})}
597
- >
598
- <label
599
- part="form-control-label"
600
- class="form-control__label"
601
- for="input"
602
- aria-hidden=${e?"false":"true"}
603
- >
604
- <slot name="label">${this.label}</slot>
605
- </label>
606
-
607
- <div part="form-control-input" class="form-control-input">
608
- <div
609
- part="base"
610
- class=${it({input:!0,"input--small":this.size==="small","input--medium":this.size==="medium","input--large":this.size==="large","input--pill":this.pill,"input--standard":!this.filled,"input--filled":this.filled,"input--disabled":this.disabled,"input--focused":this.hasFocus,"input--empty":!this.value,"input--no-spin-buttons":this.noSpinButtons})}
611
- >
612
- <span part="prefix" class="input__prefix">
613
- <slot name="prefix"></slot>
614
- </span>
615
-
616
- <input
617
- part="input"
618
- id="input"
619
- class="input__control"
620
- type=${this.type==="password"&&this.passwordVisible?"text":this.type}
621
- title=${this.title}
622
- name=${m(this.name)}
623
- ?disabled=${this.disabled}
624
- ?readonly=${this.readonly}
625
- ?required=${this.required}
626
- placeholder=${m(this.placeholder)}
627
- minlength=${m(this.minlength)}
628
- maxlength=${m(this.maxlength)}
629
- min=${m(this.min)}
630
- max=${m(this.max)}
631
- step=${m(this.step)}
632
- .value=${mo(this.value)}
633
- autocapitalize=${m(this.autocapitalize)}
634
- autocomplete=${m(this.autocomplete)}
635
- autocorrect=${m(this.autocorrect)}
636
- ?autofocus=${this.autofocus}
637
- spellcheck=${this.spellcheck}
638
- pattern=${m(this.pattern)}
639
- enterkeyhint=${m(this.enterkeyhint)}
640
- inputmode=${m(this.inputmode)}
641
- aria-describedby="help-text"
642
- @change=${this.handleChange}
643
- @input=${this.handleInput}
644
- @invalid=${this.handleInvalid}
645
- @keydown=${this.handleKeyDown}
646
- @focus=${this.handleFocus}
647
- @blur=${this.handleBlur}
648
- />
649
-
650
- ${i?v`
651
- <button
652
- part="clear-button"
653
- class="input__clear"
654
- type="button"
655
- aria-label=${this.localize.term("clearEntry")}
656
- @click=${this.handleClearClick}
657
- tabindex="-1"
658
- >
659
- <slot name="clear-icon">
660
- <sl-icon name="x-circle-fill" library="system"></sl-icon>
661
- </slot>
662
- </button>
663
- `:""}
664
- ${this.passwordToggle&&!this.disabled?v`
665
- <button
666
- part="password-toggle-button"
667
- class="input__password-toggle"
668
- type="button"
669
- aria-label=${this.localize.term(this.passwordVisible?"hidePassword":"showPassword")}
670
- @click=${this.handlePasswordToggle}
671
- tabindex="-1"
672
- >
673
- ${this.passwordVisible?v`
674
- <slot name="show-password-icon">
675
- <sl-icon name="eye-slash" library="system"></sl-icon>
676
- </slot>
677
- `:v`
678
- <slot name="hide-password-icon">
679
- <sl-icon name="eye" library="system"></sl-icon>
680
- </slot>
681
- `}
682
- </button>
683
- `:""}
684
-
685
- <span part="suffix" class="input__suffix">
686
- <slot name="suffix"></slot>
687
- </span>
688
- </div>
689
- </div>
690
-
691
- <div
692
- part="form-control-help-text"
693
- id="help-text"
694
- class="form-control__help-text"
695
- aria-hidden=${r?"false":"true"}
696
- >
697
- <slot name="help-text">${this.helpText}</slot>
698
- </div>
699
- </div>
700
- `}};h.styles=[Q,Xe,Ge];h.dependencies={"sl-icon":x};a([re(".input__control")],h.prototype,"input",2);a([at()],h.prototype,"hasFocus",2);a([u()],h.prototype,"title",2);a([u({reflect:!0})],h.prototype,"type",2);a([u()],h.prototype,"name",2);a([u()],h.prototype,"value",2);a([Qe()],h.prototype,"defaultValue",2);a([u({reflect:!0})],h.prototype,"size",2);a([u({type:Boolean,reflect:!0})],h.prototype,"filled",2);a([u({type:Boolean,reflect:!0})],h.prototype,"pill",2);a([u()],h.prototype,"label",2);a([u({attribute:"help-text"})],h.prototype,"helpText",2);a([u({type:Boolean})],h.prototype,"clearable",2);a([u({type:Boolean,reflect:!0})],h.prototype,"disabled",2);a([u()],h.prototype,"placeholder",2);a([u({type:Boolean,reflect:!0})],h.prototype,"readonly",2);a([u({attribute:"password-toggle",type:Boolean})],h.prototype,"passwordToggle",2);a([u({attribute:"password-visible",type:Boolean})],h.prototype,"passwordVisible",2);a([u({attribute:"no-spin-buttons",type:Boolean})],h.prototype,"noSpinButtons",2);a([u({reflect:!0})],h.prototype,"form",2);a([u({type:Boolean,reflect:!0})],h.prototype,"required",2);a([u()],h.prototype,"pattern",2);a([u({type:Number})],h.prototype,"minlength",2);a([u({type:Number})],h.prototype,"maxlength",2);a([u()],h.prototype,"min",2);a([u()],h.prototype,"max",2);a([u()],h.prototype,"step",2);a([u()],h.prototype,"autocapitalize",2);a([u()],h.prototype,"autocorrect",2);a([u()],h.prototype,"autocomplete",2);a([u({type:Boolean})],h.prototype,"autofocus",2);a([u()],h.prototype,"enterkeyhint",2);a([u({type:Boolean,converter:{fromAttribute:o=>!(!o||o==="false"),toAttribute:o=>o?"true":"false"}})],h.prototype,"spellcheck",2);a([u()],h.prototype,"inputmode",2);a([M("disabled",{waitUntilFirstUpdate:!0})],h.prototype,"handleDisabledChange",1);a([M("step",{waitUntilFirstUpdate:!0})],h.prototype,"handleStepChange",1);a([M("value",{waitUntilFirstUpdate:!0})],h.prototype,"handleValueChange",1);h.define("sl-input");var go=$`
701
- :host {
702
- --track-width: 2px;
703
- --track-color: rgb(128 128 128 / 25%);
704
- --indicator-color: var(--sl-color-primary-600);
705
- --speed: 2s;
706
-
707
- display: inline-flex;
708
- width: 1em;
709
- height: 1em;
710
- flex: none;
711
- }
712
-
713
- .spinner {
714
- flex: 1 1 auto;
715
- height: 100%;
716
- width: 100%;
717
- }
718
-
719
- .spinner__track,
720
- .spinner__indicator {
721
- fill: none;
722
- stroke-width: var(--track-width);
723
- r: calc(0.5em - var(--track-width) / 2);
724
- cx: 0.5em;
725
- cy: 0.5em;
726
- transform-origin: 50% 50%;
727
- }
728
-
729
- .spinner__track {
730
- stroke: var(--track-color);
731
- transform-origin: 0% 0%;
732
- }
733
-
734
- .spinner__indicator {
735
- stroke: var(--indicator-color);
736
- stroke-linecap: round;
737
- stroke-dasharray: 150% 75%;
738
- animation: spin var(--speed) linear infinite;
739
- }
740
-
741
- @keyframes spin {
742
- 0% {
743
- transform: rotate(0deg);
744
- stroke-dasharray: 0.05em, 3em;
745
- }
746
-
747
- 50% {
748
- transform: rotate(450deg);
749
- stroke-dasharray: 1.375em, 1.375em;
750
- }
751
-
752
- 100% {
753
- transform: rotate(1080deg);
754
- stroke-dasharray: 0.05em, 3em;
755
- }
756
- }
757
- `,he=class extends k{constructor(){super(...arguments),this.localize=new zt(this)}render(){return v`
758
- <svg part="base" class="spinner" role="progressbar" aria-label=${this.localize.term("loading")}>
759
- <circle class="spinner__track"></circle>
760
- <circle class="spinner__indicator"></circle>
761
- </svg>
762
- `}};he.styles=[Q,go];var vo=$`
763
- :host {
764
- display: inline-block;
765
- position: relative;
766
- width: auto;
767
- cursor: pointer;
768
- }
769
-
770
- .button {
771
- display: inline-flex;
772
- align-items: stretch;
773
- justify-content: center;
774
- width: 100%;
775
- border-style: solid;
776
- border-width: var(--sl-input-border-width);
777
- font-family: var(--sl-input-font-family);
778
- font-weight: var(--sl-font-weight-semibold);
779
- text-decoration: none;
780
- user-select: none;
781
- -webkit-user-select: none;
782
- white-space: nowrap;
783
- vertical-align: middle;
784
- padding: 0;
785
- transition:
786
- var(--sl-transition-x-fast) background-color,
787
- var(--sl-transition-x-fast) color,
788
- var(--sl-transition-x-fast) border,
789
- var(--sl-transition-x-fast) box-shadow;
790
- cursor: inherit;
791
- }
792
-
793
- .button::-moz-focus-inner {
794
- border: 0;
795
- }
796
-
797
- .button:focus {
798
- outline: none;
799
- }
800
-
801
- .button:focus-visible {
802
- outline: var(--sl-focus-ring);
803
- outline-offset: var(--sl-focus-ring-offset);
804
- }
805
-
806
- .button--disabled {
807
- opacity: 0.5;
808
- cursor: not-allowed;
809
- }
810
-
811
- /* When disabled, prevent mouse events from bubbling up from children */
812
- .button--disabled * {
813
- pointer-events: none;
814
- }
815
-
816
- .button__prefix,
817
- .button__suffix {
818
- flex: 0 0 auto;
819
- display: flex;
820
- align-items: center;
821
- pointer-events: none;
822
- }
823
-
824
- .button__label {
825
- display: inline-block;
826
- }
827
-
828
- .button__label::slotted(sl-icon) {
829
- vertical-align: -2px;
830
- }
831
-
832
- /*
833
- * Standard buttons
834
- */
835
-
836
- /* Default */
837
- .button--standard.button--default {
838
- background-color: var(--sl-color-neutral-0);
839
- border-color: var(--sl-input-border-color);
840
- color: var(--sl-color-neutral-700);
841
- }
842
-
843
- .button--standard.button--default:hover:not(.button--disabled) {
844
- background-color: var(--sl-color-primary-50);
845
- border-color: var(--sl-color-primary-300);
846
- color: var(--sl-color-primary-700);
847
- }
848
-
849
- .button--standard.button--default:active:not(.button--disabled) {
850
- background-color: var(--sl-color-primary-100);
851
- border-color: var(--sl-color-primary-400);
852
- color: var(--sl-color-primary-700);
853
- }
854
-
855
- /* Primary */
856
- .button--standard.button--primary {
857
- background-color: var(--sl-color-primary-600);
858
- border-color: var(--sl-color-primary-600);
859
- color: var(--sl-color-neutral-0);
860
- }
861
-
862
- .button--standard.button--primary:hover:not(.button--disabled) {
863
- background-color: var(--sl-color-primary-500);
864
- border-color: var(--sl-color-primary-500);
865
- color: var(--sl-color-neutral-0);
866
- }
867
-
868
- .button--standard.button--primary:active:not(.button--disabled) {
869
- background-color: var(--sl-color-primary-600);
870
- border-color: var(--sl-color-primary-600);
871
- color: var(--sl-color-neutral-0);
872
- }
873
-
874
- /* Success */
875
- .button--standard.button--success {
876
- background-color: var(--sl-color-success-600);
877
- border-color: var(--sl-color-success-600);
878
- color: var(--sl-color-neutral-0);
879
- }
880
-
881
- .button--standard.button--success:hover:not(.button--disabled) {
882
- background-color: var(--sl-color-success-500);
883
- border-color: var(--sl-color-success-500);
884
- color: var(--sl-color-neutral-0);
885
- }
886
-
887
- .button--standard.button--success:active:not(.button--disabled) {
888
- background-color: var(--sl-color-success-600);
889
- border-color: var(--sl-color-success-600);
890
- color: var(--sl-color-neutral-0);
891
- }
892
-
893
- /* Neutral */
894
- .button--standard.button--neutral {
895
- background-color: var(--sl-color-neutral-600);
896
- border-color: var(--sl-color-neutral-600);
897
- color: var(--sl-color-neutral-0);
898
- }
899
-
900
- .button--standard.button--neutral:hover:not(.button--disabled) {
901
- background-color: var(--sl-color-neutral-500);
902
- border-color: var(--sl-color-neutral-500);
903
- color: var(--sl-color-neutral-0);
904
- }
905
-
906
- .button--standard.button--neutral:active:not(.button--disabled) {
907
- background-color: var(--sl-color-neutral-600);
908
- border-color: var(--sl-color-neutral-600);
909
- color: var(--sl-color-neutral-0);
910
- }
911
-
912
- /* Warning */
913
- .button--standard.button--warning {
914
- background-color: var(--sl-color-warning-600);
915
- border-color: var(--sl-color-warning-600);
916
- color: var(--sl-color-neutral-0);
917
- }
918
- .button--standard.button--warning:hover:not(.button--disabled) {
919
- background-color: var(--sl-color-warning-500);
920
- border-color: var(--sl-color-warning-500);
921
- color: var(--sl-color-neutral-0);
922
- }
923
-
924
- .button--standard.button--warning:active:not(.button--disabled) {
925
- background-color: var(--sl-color-warning-600);
926
- border-color: var(--sl-color-warning-600);
927
- color: var(--sl-color-neutral-0);
928
- }
929
-
930
- /* Danger */
931
- .button--standard.button--danger {
932
- background-color: var(--sl-color-danger-600);
933
- border-color: var(--sl-color-danger-600);
934
- color: var(--sl-color-neutral-0);
935
- }
936
-
937
- .button--standard.button--danger:hover:not(.button--disabled) {
938
- background-color: var(--sl-color-danger-500);
939
- border-color: var(--sl-color-danger-500);
940
- color: var(--sl-color-neutral-0);
941
- }
942
-
943
- .button--standard.button--danger:active:not(.button--disabled) {
944
- background-color: var(--sl-color-danger-600);
945
- border-color: var(--sl-color-danger-600);
946
- color: var(--sl-color-neutral-0);
947
- }
948
-
949
- /*
950
- * Outline buttons
951
- */
952
-
953
- .button--outline {
954
- background: none;
955
- border: solid 1px;
956
- }
957
-
958
- /* Default */
959
- .button--outline.button--default {
960
- border-color: var(--sl-input-border-color);
961
- color: var(--sl-color-neutral-700);
962
- }
963
-
964
- .button--outline.button--default:hover:not(.button--disabled),
965
- .button--outline.button--default.button--checked:not(.button--disabled) {
966
- border-color: var(--sl-color-primary-600);
967
- background-color: var(--sl-color-primary-600);
968
- color: var(--sl-color-neutral-0);
969
- }
970
-
971
- .button--outline.button--default:active:not(.button--disabled) {
972
- border-color: var(--sl-color-primary-700);
973
- background-color: var(--sl-color-primary-700);
974
- color: var(--sl-color-neutral-0);
975
- }
976
-
977
- /* Primary */
978
- .button--outline.button--primary {
979
- border-color: var(--sl-color-primary-600);
980
- color: var(--sl-color-primary-600);
981
- }
982
-
983
- .button--outline.button--primary:hover:not(.button--disabled),
984
- .button--outline.button--primary.button--checked:not(.button--disabled) {
985
- background-color: var(--sl-color-primary-600);
986
- color: var(--sl-color-neutral-0);
987
- }
988
-
989
- .button--outline.button--primary:active:not(.button--disabled) {
990
- border-color: var(--sl-color-primary-700);
991
- background-color: var(--sl-color-primary-700);
992
- color: var(--sl-color-neutral-0);
993
- }
994
-
995
- /* Success */
996
- .button--outline.button--success {
997
- border-color: var(--sl-color-success-600);
998
- color: var(--sl-color-success-600);
999
- }
1000
-
1001
- .button--outline.button--success:hover:not(.button--disabled),
1002
- .button--outline.button--success.button--checked:not(.button--disabled) {
1003
- background-color: var(--sl-color-success-600);
1004
- color: var(--sl-color-neutral-0);
1005
- }
1006
-
1007
- .button--outline.button--success:active:not(.button--disabled) {
1008
- border-color: var(--sl-color-success-700);
1009
- background-color: var(--sl-color-success-700);
1010
- color: var(--sl-color-neutral-0);
1011
- }
1012
-
1013
- /* Neutral */
1014
- .button--outline.button--neutral {
1015
- border-color: var(--sl-color-neutral-600);
1016
- color: var(--sl-color-neutral-600);
1017
- }
1018
-
1019
- .button--outline.button--neutral:hover:not(.button--disabled),
1020
- .button--outline.button--neutral.button--checked:not(.button--disabled) {
1021
- background-color: var(--sl-color-neutral-600);
1022
- color: var(--sl-color-neutral-0);
1023
- }
1024
-
1025
- .button--outline.button--neutral:active:not(.button--disabled) {
1026
- border-color: var(--sl-color-neutral-700);
1027
- background-color: var(--sl-color-neutral-700);
1028
- color: var(--sl-color-neutral-0);
1029
- }
1030
-
1031
- /* Warning */
1032
- .button--outline.button--warning {
1033
- border-color: var(--sl-color-warning-600);
1034
- color: var(--sl-color-warning-600);
1035
- }
1036
-
1037
- .button--outline.button--warning:hover:not(.button--disabled),
1038
- .button--outline.button--warning.button--checked:not(.button--disabled) {
1039
- background-color: var(--sl-color-warning-600);
1040
- color: var(--sl-color-neutral-0);
1041
- }
1042
-
1043
- .button--outline.button--warning:active:not(.button--disabled) {
1044
- border-color: var(--sl-color-warning-700);
1045
- background-color: var(--sl-color-warning-700);
1046
- color: var(--sl-color-neutral-0);
1047
- }
1048
-
1049
- /* Danger */
1050
- .button--outline.button--danger {
1051
- border-color: var(--sl-color-danger-600);
1052
- color: var(--sl-color-danger-600);
1053
- }
1054
-
1055
- .button--outline.button--danger:hover:not(.button--disabled),
1056
- .button--outline.button--danger.button--checked:not(.button--disabled) {
1057
- background-color: var(--sl-color-danger-600);
1058
- color: var(--sl-color-neutral-0);
1059
- }
1060
-
1061
- .button--outline.button--danger:active:not(.button--disabled) {
1062
- border-color: var(--sl-color-danger-700);
1063
- background-color: var(--sl-color-danger-700);
1064
- color: var(--sl-color-neutral-0);
1065
- }
1066
-
1067
- @media (forced-colors: active) {
1068
- .button.button--outline.button--checked:not(.button--disabled) {
1069
- outline: solid 2px transparent;
1070
- }
1071
- }
1072
-
1073
- /*
1074
- * Text buttons
1075
- */
1076
-
1077
- .button--text {
1078
- background-color: transparent;
1079
- border-color: transparent;
1080
- color: var(--sl-color-primary-600);
1081
- }
1082
-
1083
- .button--text:hover:not(.button--disabled) {
1084
- background-color: transparent;
1085
- border-color: transparent;
1086
- color: var(--sl-color-primary-500);
1087
- }
1088
-
1089
- .button--text:focus-visible:not(.button--disabled) {
1090
- background-color: transparent;
1091
- border-color: transparent;
1092
- color: var(--sl-color-primary-500);
1093
- }
1094
-
1095
- .button--text:active:not(.button--disabled) {
1096
- background-color: transparent;
1097
- border-color: transparent;
1098
- color: var(--sl-color-primary-700);
1099
- }
1100
-
1101
- /*
1102
- * Size modifiers
1103
- */
1104
-
1105
- .button--small {
1106
- height: auto;
1107
- min-height: var(--sl-input-height-small);
1108
- font-size: var(--sl-button-font-size-small);
1109
- line-height: calc(var(--sl-input-height-small) - var(--sl-input-border-width) * 2);
1110
- border-radius: var(--sl-input-border-radius-small);
1111
- }
1112
-
1113
- .button--medium {
1114
- height: auto;
1115
- min-height: var(--sl-input-height-medium);
1116
- font-size: var(--sl-button-font-size-medium);
1117
- line-height: calc(var(--sl-input-height-medium) - var(--sl-input-border-width) * 2);
1118
- border-radius: var(--sl-input-border-radius-medium);
1119
- }
1120
-
1121
- .button--large {
1122
- height: auto;
1123
- min-height: var(--sl-input-height-large);
1124
- font-size: var(--sl-button-font-size-large);
1125
- line-height: calc(var(--sl-input-height-large) - var(--sl-input-border-width) * 2);
1126
- border-radius: var(--sl-input-border-radius-large);
1127
- }
1128
-
1129
- /*
1130
- * Pill modifier
1131
- */
1132
-
1133
- .button--pill.button--small {
1134
- border-radius: var(--sl-input-height-small);
1135
- }
1136
-
1137
- .button--pill.button--medium {
1138
- border-radius: var(--sl-input-height-medium);
1139
- }
1140
-
1141
- .button--pill.button--large {
1142
- border-radius: var(--sl-input-height-large);
1143
- }
1144
-
1145
- /*
1146
- * Circle modifier
1147
- */
1148
-
1149
- .button--circle {
1150
- padding-left: 0;
1151
- padding-right: 0;
1152
- }
1153
-
1154
- .button--circle.button--small {
1155
- width: var(--sl-input-height-small);
1156
- border-radius: 50%;
1157
- }
1158
-
1159
- .button--circle.button--medium {
1160
- width: var(--sl-input-height-medium);
1161
- border-radius: 50%;
1162
- }
1163
-
1164
- .button--circle.button--large {
1165
- width: var(--sl-input-height-large);
1166
- border-radius: 50%;
1167
- }
1168
-
1169
- .button--circle .button__prefix,
1170
- .button--circle .button__suffix,
1171
- .button--circle .button__caret {
1172
- display: none;
1173
- }
1174
-
1175
- /*
1176
- * Caret modifier
1177
- */
1178
-
1179
- .button--caret .button__suffix {
1180
- display: none;
1181
- }
1182
-
1183
- .button--caret .button__caret {
1184
- height: auto;
1185
- }
1186
-
1187
- /*
1188
- * Loading modifier
1189
- */
1190
-
1191
- .button--loading {
1192
- position: relative;
1193
- cursor: wait;
1194
- }
1195
-
1196
- .button--loading .button__prefix,
1197
- .button--loading .button__label,
1198
- .button--loading .button__suffix,
1199
- .button--loading .button__caret {
1200
- visibility: hidden;
1201
- }
1202
-
1203
- .button--loading sl-spinner {
1204
- --indicator-color: currentColor;
1205
- position: absolute;
1206
- font-size: 1em;
1207
- height: 1em;
1208
- width: 1em;
1209
- top: calc(50% - 0.5em);
1210
- left: calc(50% - 0.5em);
1211
- }
1212
-
1213
- /*
1214
- * Badges
1215
- */
1216
-
1217
- .button ::slotted(sl-badge) {
1218
- position: absolute;
1219
- top: 0;
1220
- right: 0;
1221
- translate: 50% -50%;
1222
- pointer-events: none;
1223
- }
1224
-
1225
- .button--rtl ::slotted(sl-badge) {
1226
- right: auto;
1227
- left: 0;
1228
- translate: -50% -50%;
1229
- }
1230
-
1231
- /*
1232
- * Button spacing
1233
- */
1234
-
1235
- .button--has-label.button--small .button__label {
1236
- padding: 0 var(--sl-spacing-small);
1237
- }
1238
-
1239
- .button--has-label.button--medium .button__label {
1240
- padding: 0 var(--sl-spacing-medium);
1241
- }
1242
-
1243
- .button--has-label.button--large .button__label {
1244
- padding: 0 var(--sl-spacing-large);
1245
- }
1246
-
1247
- .button--has-prefix.button--small {
1248
- padding-inline-start: var(--sl-spacing-x-small);
1249
- }
1250
-
1251
- .button--has-prefix.button--small .button__label {
1252
- padding-inline-start: var(--sl-spacing-x-small);
1253
- }
1254
-
1255
- .button--has-prefix.button--medium {
1256
- padding-inline-start: var(--sl-spacing-small);
1257
- }
1258
-
1259
- .button--has-prefix.button--medium .button__label {
1260
- padding-inline-start: var(--sl-spacing-small);
1261
- }
1262
-
1263
- .button--has-prefix.button--large {
1264
- padding-inline-start: var(--sl-spacing-small);
1265
- }
1266
-
1267
- .button--has-prefix.button--large .button__label {
1268
- padding-inline-start: var(--sl-spacing-small);
1269
- }
1270
-
1271
- .button--has-suffix.button--small,
1272
- .button--caret.button--small {
1273
- padding-inline-end: var(--sl-spacing-x-small);
1274
- }
1275
-
1276
- .button--has-suffix.button--small .button__label,
1277
- .button--caret.button--small .button__label {
1278
- padding-inline-end: var(--sl-spacing-x-small);
1279
- }
1280
-
1281
- .button--has-suffix.button--medium,
1282
- .button--caret.button--medium {
1283
- padding-inline-end: var(--sl-spacing-small);
1284
- }
1285
-
1286
- .button--has-suffix.button--medium .button__label,
1287
- .button--caret.button--medium .button__label {
1288
- padding-inline-end: var(--sl-spacing-small);
1289
- }
1290
-
1291
- .button--has-suffix.button--large,
1292
- .button--caret.button--large {
1293
- padding-inline-end: var(--sl-spacing-small);
1294
- }
1295
-
1296
- .button--has-suffix.button--large .button__label,
1297
- .button--caret.button--large .button__label {
1298
- padding-inline-end: var(--sl-spacing-small);
1299
- }
1300
-
1301
- /*
1302
- * Button groups support a variety of button types (e.g. buttons with tooltips, buttons as dropdown triggers, etc.).
1303
- * This means buttons aren't always direct descendants of the button group, thus we can't target them with the
1304
- * ::slotted selector. To work around this, the button group component does some magic to add these special classes to
1305
- * buttons and we style them here instead.
1306
- */
1307
-
1308
- :host([data-sl-button-group__button--first]:not([data-sl-button-group__button--last])) .button {
1309
- border-start-end-radius: 0;
1310
- border-end-end-radius: 0;
1311
- }
1312
-
1313
- :host([data-sl-button-group__button--inner]) .button {
1314
- border-radius: 0;
1315
- }
1316
-
1317
- :host([data-sl-button-group__button--last]:not([data-sl-button-group__button--first])) .button {
1318
- border-start-start-radius: 0;
1319
- border-end-start-radius: 0;
1320
- }
1321
-
1322
- /* All except the first */
1323
- :host([data-sl-button-group__button]:not([data-sl-button-group__button--first])) {
1324
- margin-inline-start: calc(-1 * var(--sl-input-border-width));
1325
- }
1326
-
1327
- /* Add a visual separator between solid buttons */
1328
- :host(
1329
- [data-sl-button-group__button]:not(
1330
- [data-sl-button-group__button--first],
1331
- [data-sl-button-group__button--radio],
1332
- [variant='default']
1333
- ):not(:hover)
1334
- )
1335
- .button:after {
1336
- content: '';
1337
- position: absolute;
1338
- top: 0;
1339
- inset-inline-start: 0;
1340
- bottom: 0;
1341
- border-left: solid 1px rgb(128 128 128 / 33%);
1342
- mix-blend-mode: multiply;
1343
- }
1344
-
1345
- /* Bump hovered, focused, and checked buttons up so their focus ring isn't clipped */
1346
- :host([data-sl-button-group__button--hover]) {
1347
- z-index: 1;
1348
- }
1349
-
1350
- /* Focus and checked are always on top */
1351
- :host([data-sl-button-group__button--focus]),
1352
- :host([data-sl-button-group__button][checked]) {
1353
- z-index: 2;
1354
- }
1355
- `;/**
1356
- * @license
1357
- * Copyright 2020 Google LLC
1358
- * SPDX-License-Identifier: BSD-3-Clause
1359
- */const pe=Symbol.for(""),yo=o=>{if((o==null?void 0:o.r)===pe)return o==null?void 0:o._$litStatic$},Kt=(o,...t)=>({_$litStatic$:t.reduce((e,r,s)=>e+(i=>{if(i._$litStatic$!==void 0)return i._$litStatic$;throw Error(`Value passed to 'literal' function must be a 'literal' result: ${i}. Use 'unsafeStatic' to pass non-literal values, but
1360
- take care to ensure page security.`)})(r)+o[s+1],o[0]),r:pe}),Zt=new Map,wo=o=>(t,...e)=>{const r=e.length;let s,i;const n=[],d=[];let l,c=0,b=!1;for(;c<r;){for(l=t[c];c<r&&(i=e[c],(s=yo(i))!==void 0);)l+=s+t[++c],b=!0;c!==r&&d.push(i),n.push(l),c++}if(c===r&&n.push(t[r]),b){const p=n.join("$$lit$$");(t=Zt.get(p))===void 0&&(n.raw=n,Zt.set(p,t=n)),e=d}return o(t,...e)},ft=wo(v);var f=class extends k{constructor(){super(...arguments),this.formControlController=new ae(this,{assumeInteractionOn:["click"]}),this.hasSlotController=new St(this,"[default]","prefix","suffix"),this.localize=new zt(this),this.hasFocus=!1,this.invalid=!1,this.title="",this.variant="default",this.size="medium",this.caret=!1,this.disabled=!1,this.loading=!1,this.outline=!1,this.pill=!1,this.circle=!1,this.type="button",this.name="",this.value="",this.href="",this.rel="noreferrer noopener"}get validity(){return this.isButton()?this.button.validity:Et}get validationMessage(){return this.isButton()?this.button.validationMessage:""}firstUpdated(){this.isButton()&&this.formControlController.updateValidity()}handleBlur(){this.hasFocus=!1,this.emit("sl-blur")}handleFocus(){this.hasFocus=!0,this.emit("sl-focus")}handleClick(){this.type==="submit"&&this.formControlController.submit(this),this.type==="reset"&&this.formControlController.reset(this)}handleInvalid(o){this.formControlController.setValidity(!1),this.formControlController.emitInvalidEvent(o)}isButton(){return!this.href}isLink(){return!!this.href}handleDisabledChange(){this.isButton()&&this.formControlController.setValidity(this.disabled)}click(){this.button.click()}focus(o){this.button.focus(o)}blur(){this.button.blur()}checkValidity(){return this.isButton()?this.button.checkValidity():!0}getForm(){return this.formControlController.getForm()}reportValidity(){return this.isButton()?this.button.reportValidity():!0}setCustomValidity(o){this.isButton()&&(this.button.setCustomValidity(o),this.formControlController.updateValidity())}render(){const o=this.isLink(),t=o?Kt`a`:Kt`button`;return ft`
1361
- <${t}
1362
- part="base"
1363
- class=${it({button:!0,"button--default":this.variant==="default","button--primary":this.variant==="primary","button--success":this.variant==="success","button--neutral":this.variant==="neutral","button--warning":this.variant==="warning","button--danger":this.variant==="danger","button--text":this.variant==="text","button--small":this.size==="small","button--medium":this.size==="medium","button--large":this.size==="large","button--caret":this.caret,"button--circle":this.circle,"button--disabled":this.disabled,"button--focused":this.hasFocus,"button--loading":this.loading,"button--standard":!this.outline,"button--outline":this.outline,"button--pill":this.pill,"button--rtl":this.localize.dir()==="rtl","button--has-label":this.hasSlotController.test("[default]"),"button--has-prefix":this.hasSlotController.test("prefix"),"button--has-suffix":this.hasSlotController.test("suffix")})}
1364
- ?disabled=${m(o?void 0:this.disabled)}
1365
- type=${m(o?void 0:this.type)}
1366
- title=${this.title}
1367
- name=${m(o?void 0:this.name)}
1368
- value=${m(o?void 0:this.value)}
1369
- href=${m(o?this.href:void 0)}
1370
- target=${m(o?this.target:void 0)}
1371
- download=${m(o?this.download:void 0)}
1372
- rel=${m(o?this.rel:void 0)}
1373
- role=${m(o?void 0:"button")}
1374
- aria-disabled=${this.disabled?"true":"false"}
1375
- tabindex=${this.disabled?"-1":"0"}
1376
- @blur=${this.handleBlur}
1377
- @focus=${this.handleFocus}
1378
- @invalid=${this.isButton()?this.handleInvalid:null}
1379
- @click=${this.handleClick}
1380
- >
1381
- <slot name="prefix" part="prefix" class="button__prefix"></slot>
1382
- <slot part="label" class="button__label"></slot>
1383
- <slot name="suffix" part="suffix" class="button__suffix"></slot>
1384
- ${this.caret?ft` <sl-icon part="caret" class="button__caret" library="system" name="caret"></sl-icon> `:""}
1385
- ${this.loading?ft`<sl-spinner part="spinner"></sl-spinner>`:""}
1386
- </${t}>
1387
- `}};f.styles=[Q,vo];f.dependencies={"sl-icon":x,"sl-spinner":he};a([re(".button")],f.prototype,"button",2);a([at()],f.prototype,"hasFocus",2);a([at()],f.prototype,"invalid",2);a([u()],f.prototype,"title",2);a([u({reflect:!0})],f.prototype,"variant",2);a([u({reflect:!0})],f.prototype,"size",2);a([u({type:Boolean,reflect:!0})],f.prototype,"caret",2);a([u({type:Boolean,reflect:!0})],f.prototype,"disabled",2);a([u({type:Boolean,reflect:!0})],f.prototype,"loading",2);a([u({type:Boolean,reflect:!0})],f.prototype,"outline",2);a([u({type:Boolean,reflect:!0})],f.prototype,"pill",2);a([u({type:Boolean,reflect:!0})],f.prototype,"circle",2);a([u()],f.prototype,"type",2);a([u()],f.prototype,"name",2);a([u()],f.prototype,"value",2);a([u()],f.prototype,"href",2);a([u()],f.prototype,"target",2);a([u()],f.prototype,"rel",2);a([u()],f.prototype,"download",2);a([u()],f.prototype,"form",2);a([u({attribute:"formaction"})],f.prototype,"formAction",2);a([u({attribute:"formenctype"})],f.prototype,"formEnctype",2);a([u({attribute:"formmethod"})],f.prototype,"formMethod",2);a([u({attribute:"formnovalidate",type:Boolean})],f.prototype,"formNoValidate",2);a([u({attribute:"formtarget"})],f.prototype,"formTarget",2);a([M("disabled",{waitUntilFirstUpdate:!0})],f.prototype,"handleDisabledChange",1);f.define("sl-button");class wt extends S{constructor(){super(),this.username="",this.password="",this.disabled=!1}handleSubmit(t){t.preventDefault(),this.dispatchEvent(new CustomEvent("login-attempt",{detail:{username:this.username,password:this.password},bubbles:!0,composed:!0}))}handleInputChange(t){const{name:e,value:r}=t.target;this[e]=r}render(){return v`
1388
- <sl-card>
1389
- <form @submit="${this.handleSubmit}">
1390
- <sl-input
1391
- name="username"
1392
- placeholder="Username or Email"
1393
- .value="${this.username}"
1394
- autocomplete="username"
1395
- @sl-change="${this.handleInputChange}">
1396
- </sl-input>
1397
- <sl-input
1398
- type="password"
1399
- name="password"
1400
- placeholder="Password"
1401
- .value="${this.password}"
1402
- autocomplete="current-password"
1403
- @sl-change="${this.handleInputChange}">
1404
- </sl-input>
1405
- <sl-button type="submit" ?disabled="${this.disabled}">Login</sl-button>
1406
- </form>
1407
- </sl-card>
1408
- `}}E(wt,"styles",$`
1409
- :host {
1410
- display: flex;
1411
- justify-content: center;
1412
- align-items: center;
1413
- height: 100vh;
1414
- box-sizing: border-box;
1415
- }
1416
- sl-card {
1417
- width: 300px;
1418
- --padding: var(--sl-card-padding);
1419
- --background-color: var(--sl-card-background-color);
1420
- --border-radius: var(--sl-card-border-radius);
1421
- --box-shadow: var(--sl-card-shadow);
1422
- }
1423
- sl-input, sl-button {
1424
- width: 100%;
1425
- margin-bottom: 10px;
1426
- }
1427
- `),E(wt,"properties",{username:{type:String},password:{type:String},disabled:{type:Boolean,reflect:!0}});customElements.define("studio-login",wt);class _t extends S{constructor(){super(),this.currentPassword="",this.newPassword="",this.confirmPassword=""}render(){return v`
1428
- <form @submit="${this.handleSubmit}">
1429
- <input type="password" name="currentPassword"
1430
- autocomplete="current-password"
1431
- placeholder="Current Password"
1432
- .value="${this.currentPassword}"
1433
- @input="${this.updateProperty("currentPassword")}"
1434
- >
1435
- <input type="password" name="newPassword"
1436
- placeholder="New Password"
1437
- .value="${this.newPassword}"
1438
- @input="${this.updateProperty("newPassword")}"
1439
- >
1440
- <input type="password" name="confirmPassword"
1441
- placeholder="Confirm New Password"
1442
- .value="${this.confirmPassword}"
1443
- @input="${this.updateProperty("confirmPassword")}"
1444
- >
1445
- <button type="submit">Change Password</button>
1446
- </form>
1447
- `}updateProperty(t){return e=>{this[t]=e.target.value}}handleSubmit(t){t.preventDefault(),this.newPassword===this.confirmPassword?this.dispatchEvent(new CustomEvent("change-password",{detail:{currentPassword:this.currentPassword,newPassword:this.newPassword}})):alert("The new passwords do not match.")}}E(_t,"styles",$`
1448
- :host {
1449
- display: block;
1450
- box-sizing: border-box;
1451
- }
1452
- input, button {
1453
- width: 100%;
1454
- margin-bottom: 10px;
1455
- padding: 8px;
1456
- box-sizing: border-box;
1457
- }
1458
- `),E(_t,"properties",{currentPassword:{type:String},newPassword:{type:String},confirmPassword:{type:String}});customElements.define("studio-change-password",_t);class $t extends S{constructor(){super(),this.apibaseurl="",this.error="",this.isAwaiting=!1,this.lastResult=void 0,this.forceChangePassword=!1,this.handleLogin=this.handleLogin.bind(this),this.handleLoginResult=this.handleLoginResult.bind(this),this.handleLoginError=this.handleLoginError.bind(this),this.renderPasswordChangeForm=this.renderPasswordChangeForm.bind(this)}handleLogin(t){this.isAwaiting=!0;const{username:e,password:r}=t.detail,s=mt({baseUrl:this.apibaseurl});this.requestUpdate(),s.mintToken({username:e,password:r}).then(this.handleLoginResult).catch(this.handleLoginError)}handleLoginResult(t){var e;this.error="",this.isAwaiting=!1,this.lastResult=t,((e=t.challenge)==null?void 0:e.name)==="NEW_PASSWORD_REQUIRED"?(this.forceChangePassword=!0,this.error="You must set a new password to continue."):this.dispatchEvent(new CustomEvent("login-success",{detail:t})),this.requestUpdate()}handleLoginError(t){var e,r;console.error("Error logging in:",t),this.error=((r=(e=t==null?void 0:t.body)==null?void 0:e.error)==null?void 0:r.message)||"Invalid username or password",this.isAwaiting=!1,this.requestUpdate()}handleChangePassword(t){const{currentPassword:e,newPassword:r}=t.detail,{token:s}=this.lastResult,i=mt({baseUrl:this.apibaseurl});this.requestUpdate(),i.updatePassword({token:s,currentPassword:e,newPassword:r}).then(()=>{this.forceChangePassword=!1,this.error="Login with your new password.",this.isAwaiting=!1,this.requestUpdate()}).catch(n=>{var d,l;this.error=((l=(d=n==null?void 0:n.body)==null?void 0:d.error)==null?void 0:l.message)||n.message,this.isAwaiting=!1,this.requestUpdate()})}renderPasswordChangeForm(){return v`
1459
- <div>
1460
- ${this.error?v`<div class="error">${this.error}</div>`:null}
1461
- <studio-change-password @change-password=${this.handleChangePassword}>
1462
- </studio-change-password>
1463
- </div>
1464
- `}renderLoginForm(){return v`
1465
- ${this.error?v`<div class="error">${this.error}</div>`:null}
1466
- <studio-login
1467
- @login-attempt=${this.handleLogin}
1468
- ?disabled=${this.isAwaiting}
1469
- ></studio-login>
1470
- `}render(){return this.forceChangePassword?this.renderPasswordChangeForm():this.renderLoginForm()}}E($t,"properties",{apibaseurl:{type:String},error:{type:String}}),E($t,"styles",$`
1471
- :host {
1472
- display: block;
1473
- max-width: 400px;
1474
- margin: 0 auto;
1475
- }
1476
- `);window.customElements.define("mod-auth-login-form",$t);function be({studio:o,config:t}){return new Promise((e,r)=>{let s=window.sessionStorage.getItem(K());if(s){ko(s)?_o({studio:o,config:t,token:s}).then(e).catch(l=>{console.error("Failed to refresh token:",l),window.sessionStorage.removeItem(K()),be({studio:o,config:t}).then(e).catch(r)}):e(s);return}const i=l=>(window.sessionStorage.setItem(K(),l),l);let n;const d=l=>{const{token:c}=l.detail;i(c),e(c),o.pub("system::workspace","dismiss",n)};n=v`<mod-auth-login-form
1477
- id="login"
1478
- apibaseurl=${t.apibaseurl}
1479
- @login-success=${d}></mod-auth-login-form>`,o.pub("system::workspace","present",n)})}async function _o({studio:o,config:t,token:e}){const r=t.apibaseurl,s=mt({baseUrl:r}),{token:i}=await s.refreshToken({token:e});return window.sessionStorage.setItem(K(),i),i}function $o({studio:o}){window.sessionStorage.removeItem(K())}function xo(o){return JSON.parse(window.atob(o.split(".")[1].replace(/-/g,"+").replace(/_/g,"/")))}function ko(o,t=300,e=Date.now()){return xo(o).exp*1e3-t<e}function K(){return"studio.wral::auth_token"}function Co(o,t){o.sub("studio.wral::mod-auth","token-request",({state:e})=>{const{callback:r}=e.value;r?be({studio:o,config:t}).then(s=>r(s)).catch(s=>r(null,s)):console.warn("No token callback defined")}),o.sub("studio.wral::mod-auth","logout",()=>{$o({studio:o})})}exports.init=Co;
19
+ */class b extends E{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;const e=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=e.firstChild),e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Be(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)==null||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)==null||e.setConnected(!1)}render(){return S}}var de;b._$litElement$=!0,b.finalized=!0,(de=globalThis.litElementHydrateSupport)==null||de.call(globalThis,{LitElement:b});const G=globalThis.litElementPolyfillSupport;G==null||G({LitElement:b});(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.1.1");function x(r){return{api:(e,t)=>P(r,e,t),mintToken:({username:e,password:t})=>Ge({config:r,username:e,password:t}),refreshToken:({token:e})=>Ve({config:r,token:e}),pubkey:()=>Ke({config:r}),updatePassword:({token:e,currentPassword:t,newPassword:s})=>Qe({config:r,token:e,currentPassword:t,newPassword:s}),triggerResetPassword:({username:e})=>Je({config:r,username:e}),confirmResetPassword:({username:e,newPassword:t,confirmationCode:s})=>Ye({config:r,username:e,newPassword:t,confirmationCode:s})}}function Ge({config:r,username:e,password:t}){return P(r,"/v1/user/login",{method:"POST",body:{username:e,password:t}})}function Ve({config:r,token:e}){return P(r,"/v1/refresh",{method:"POST",body:{token:e}})}function Ke({config:r}){return P(r,"/v1/pubkey",{method:"GET"})}function Qe({config:r,token:e,currentPassword:t,newPassword:s}){return P(r,"/v1/user/password",{method:"PUT",body:{currentPassword:t,newPassword:s},headers:{Authorization:`Bearer ${e}`}})}function Je({config:r,username:e}){return P(r,"/v1/user/password/reset",{method:"POST",body:{username:e}})}function Ye({config:r,username:e,newPassword:t,confirmationCode:s}){return P(r,"/v1/user/password/reset/confirm",{method:"POST",body:{username:e,newPassword:t,confirmationCode:s}})}async function P(r,e,t){var u;const s=r.baseUrl.endsWith("/")?r.baseUrl:`${r.baseUrl}/`,o=e.startsWith("/")?e.substring(1):e,i=new URL(o,s),l=Object.assign({},t,{headers:Object.assign({},{"Content-Type":"application/json"},t==null?void 0:t.headers),body:t!=null&&t.body?JSON.stringify(t.body):void 0}),a=await fetch(i.toString(),l);if(!a.ok){const d=new Error("API request failed.");if(d.status=a.status,d.statusText=a.statusText,d.url=i.toString(),d.headers=a.headers,d.bodyUsed=a.bodyUsed,(u=a.headers.get("Content-Type"))!=null&&u.includes("application/json"))try{d.body=await a.json()}catch{d.body="Failed to parse response body."}throw d}if(a.status!==204)return await a.json()}function ye({api:r},e){const t=x({baseUrl:r});return console.log("sending credentials to API",r),t.mintToken(e)}const g=Object.freeze({REQUEST:"request",CONFIRM:"confirm",FINISHED:"finished"});class Ze extends b{static get properties(){return{api:{type:String,attribute:"api"},confirmation:{type:"String",attribute:"confirmation"}}}static get styles(){return q`
20
+ :host {
21
+ display: block;
22
+ font-family: Arial, sans-serif;
23
+ }
24
+ form input[type="text"],
25
+ form input[type="password"] {
26
+ width: 100%;
27
+ margin: 5px 0 15px 0;
28
+ padding: var(--spacing-sm, 0.5rem) var(--spacing-md, 1rem);
29
+ box-sizing: border-box;
30
+ border: 1px solid var(--color-gray-300, #ccc);
31
+ border-radius: var(--radius-sm, 5px);
32
+ color: var(--color-gray-9, #333);
33
+ background-color: var(--color-gray-0, transparent);
34
+ }
35
+ form input[type="submit"] {
36
+ background-color:var(--color-primary, inherit);
37
+ color: var(--color-gray-0, #fff);
38
+ border: none;
39
+ padding: var(--spacing-sm, 0.5rem) var(--spacing-md, 1rem);
40
+ border-radius: var(--radius-dynamic, 5px);
41
+ width: 200px;
42
+ display: block;
43
+ margin: var(--spacing-md, 1rem) auto;
44
+ cursor: pointer;
45
+ }
46
+ form label {
47
+ font-size: 14px;
48
+ color: var(--color-gray-9, #333);
49
+ font-weight: bold;
50
+ margin-bottom: var(--spacing-sm, 0.5rem);
51
+ }
52
+ .error {
53
+ color: var(--color-danger, red);
54
+ font-size: 12px;
55
+ }
56
+ `}constructor(){super(),this.errors={},this.stage=g.REQUEST}connectedCallback(){console.log("[auth]","[forgot-password]",{confirmation:this.confirmation}),super.connectedCallback(),this.confirmation&&this.stage!==g.FINISHED&&(this.stage=g.CONFIRM),this.requestUpdate()}handleSubmitRequest(e){e.preventDefault();const t=e.target.username.value;this.username=t,x({baseUrl:this.api}).triggerResetPassword({username:t}).then(()=>{console.log("[auth]","triggered reset password for ",t),this.stage=g.CONFIRM}).catch(o=>{console.error("[auth] error triggering reset password",o),this.errors.general=o.message||"Unable to send password reset request. Please try again later."}).finally(()=>{this.requestUpdate()})}handleSubmitConfirm(e){e.preventDefault();const t=e.target.password.value,s=e.target["confirm-password"].value;if(t!==s){this.errors["confirm-password"]="Passwords do not match.",this.requestUpdate();return}const o=this.confirmation||e.target.confirmation.value;if(!o){this.errors.general="Confirmation code is required.",this.requestUpdate();return}x({baseUrl:this.api}).confirmResetPassword({username:this.username,newPassword:t,confirmationCode:o}).then(()=>ye(this,{username:this.username,password:t}).then(({token:n})=>{this.dispatchEvent(new CustomEvent("login-success",{detail:{token:n},composed:!0,bubbles:!0}))})).catch(n=>{console.error("[auth][forgot-password-form]",n),this.errors.general="Unable to reset password. Please try again later."}).finally(()=>{this.requestUpdate()})}render(){switch(this.stage){case g.CONFIRM:return this.renderConfirmForm();case g.FINISHED:return c`<p>Your password has been reset.</p>`;case g.REQUEST_SENT:return c`<p>A email has been sent with instructions to finish
57
+ resetting your password.</p>`;case g.REQUEST:default:return this.renderRequestForm()}}renderRequestForm(){return c`<form @submit=${this.handleSubmitRequest}>
58
+ <label for="username">Username/Email</label>
59
+ <input
60
+ type="text"
61
+ name="username"
62
+ placeholder="Email or Username"
63
+ required
64
+ />
65
+ <p class="error">${this.errors.general}</p>
66
+ <input type="submit" value="Request password reset" />
67
+ </form>`}renderConfirmForm(){return c`<form @submit=${this.handleSubmitConfirm}>
68
+ <p>You should have received a confirmation code to reset your password</p>
69
+
70
+ ${this.confirmation?"":c`<label for="confirmation">Confirmation Code</label>
71
+ <input
72
+ type="text"
73
+ name="confirmation"
74
+ placeholder="Confirmation Code"
75
+ required
76
+ />`}
77
+
78
+ <label for="password">New Password</label>
79
+ <input
80
+ type="password"
81
+ name="password"
82
+ placeholder="Password"
83
+ required
84
+ />
85
+ ${this.errors.password?c`<p class="error">${this.errors.password}</p>`:""}
86
+
87
+ <label for="confirm-password">Confirm Password</label>
88
+ <input
89
+ type="password"
90
+ name="confirm-password"
91
+ placeholder="Confirm Password"
92
+ required
93
+ />
94
+ ${this.errors["confirm-password"]?c`<p class="error">${this.errors["confirm-password"]}</p>`:""}
95
+
96
+ ${this.errors.general?c`<p class="error">${this.errors.general}</p>`:""}
97
+ <input type="submit" value="Reset Password" />
98
+ </form>`}}class y extends b{static get properties(){return{api:{type:String,attribute:"api"}}}static get styles(){return q`
99
+ :host {
100
+ display: block;
101
+ font-family: Arial, sans-serif;
102
+ }
103
+ .login-form {
104
+ background-color: var(--color-gray-0, #fff);
105
+ padding: var(--spacing-xl, 3rem);
106
+ border-radius: var(--radius-md, 5px);
107
+ box-shadow: var(--drop-shadow-md, none);
108
+ }
109
+ form input[type="text"],
110
+ form input[type="password"] {
111
+ width: 100%;
112
+ margin: 5px 0 15px 0;
113
+ padding: var(--spacing-sm, 0.5rem) var(--spacing-md, 1rem);
114
+ box-sizing: border-box;
115
+ border: 1px solid var(--color-gray-300, #ccc);
116
+ border-radius: var(--radius-sm, 5px);
117
+ color: var(--color-gray-9, #333);
118
+ background-color: var(--color-gray-0, transparent);
119
+ }
120
+ form input[type="submit"] {
121
+ background-color: var(--color-primary, inherit);
122
+ color: var(--color-gray-0, #fff);
123
+ border: none;
124
+ padding: var(--spacing-sm, 0.5rem) var(--spacing-md, 1rem);
125
+ border-radius: var(--radius-dynamic, 5px);
126
+ width: 200px;
127
+ display: block;
128
+ margin: var(--spacing-md, 1rem) auto;
129
+ cursor: pointer;
130
+ }
131
+ form label {
132
+ font-size: 14px;
133
+ color: var(--color-gray-9, #333);
134
+ font-weight: bold;
135
+ margin-bottom: var(--spacing-sm, 0.5rem);
136
+ }
137
+ a.forgot {
138
+ color: var(--color-primary, inherit);
139
+ text-decoration: none;
140
+ font-size: 12px;
141
+ font-weight: bold;
142
+ }
143
+ .error {
144
+ color: var(--color-error, red);
145
+ font-size: 12px;
146
+ margin-top: var(--spacing-sm, 0.5rem);
147
+ }
148
+ .header {
149
+ display: flex;
150
+ flex-direction: column;
151
+ align-items: center;
152
+ }
153
+ .header .intro {
154
+ width: 200px;
155
+ margin-bottom: 0;
156
+ color: var(--color-gray-3);
157
+ }
158
+ .header .brand {
159
+ font-size: 32px;
160
+ min-width: 200px;
161
+ margin-bottom: var(--spacing-lg, 2rem);
162
+ }
163
+ .header .brand em {
164
+ text-transform: uppercase;
165
+ font-weight: bold;
166
+ font-style: normal;
167
+ }
168
+ `}static get states(){return{DEFAULT:"DEFAULT",FORGOT:"FORGOT",CHALLENGE_CHANGE_PW:"CHALLENGE_CHANGE_PW"}}constructor(){super(),this.formState=y.states.DEFAULT,this.username="",this.password="",this.token=void 0,this.errors=[]}onSubmit(e){e.preventDefault();const t=e.explicitOriginalTarget.parentElement;console.log(t);const s=new FormData(t).entries().reduce((o,[i,n])=>(o[i]=n,o),{});ye(this,s).then(({token:o,challenge:i})=>{if(i&&i.name==="NEW_PASSWORD_REQUIRED"){this.token=o,this.username=s.username,this.password=s.password,this.setState(y.states.CHALLENGE_CHANGE_PW);return}this.dispatchEvent(new CustomEvent("login-success",{detail:{token:o}}))}).catch(o=>{console.log(o),this.errors=[o.message],this.requestUpdate()})}onSubmitChangePasswordChallenge(e){e.preventDefault();const t=e.explicitOriginalTarget,s=new FormData(t).entries().reduce((l,[a,u])=>(l[a]=u,l),{}),o=s.password,i=s["confirm-password"];if(o!==i){this.errors=["Passwords do not match."],this.requestUpdate();return}x({baseUrl:this.api}).updatePassword({token:this.token,currentPassword:this.password,newPassword:o}).then(()=>{this.dispatchEvent(new CustomEvent("login-success",{detail:{token:this.token}}))}).catch(l=>{console.log(l),this.errors=[l.message],this.requestUpdate()})}setState(e){e!==this.formState&&(this.formState=e,this.errors=[],this.requestUpdate())}render(){return c`<div class="login-form">
169
+ ${this.renderHeader()}
170
+ ${this.formState===y.states.FORGOT?this.renderForgotPasswordForm():""}
171
+ ${this.formState===y.states.CHALLENGE_CHANGE_PW?this.renderChangePasswordForm():""}
172
+ ${this.formState===y.states.DEFAULT?this.renderLoginForm():""}
173
+ </div>`}renderHeader(){return c`<div class="header">
174
+ <div class="intro">
175
+ Welcome to
176
+ </div>
177
+ <div class="brand">
178
+ <em>WRAL</em>.studio
179
+ </div>
180
+ </div>`}renderLoginForm(){return c`
181
+ <form>
182
+ <label for="username">User</label>
183
+ <input
184
+ type="text"
185
+ name="username"
186
+ placeholder="Email or Username"
187
+ required
188
+ />
189
+
190
+ <label for="password">Password</label>
191
+ <input
192
+ type="password"
193
+ name="password"
194
+ placeholder="Password"
195
+ required
196
+ />
197
+ <div>
198
+ <a href="#" class="forgot"
199
+ @click=${()=>{this.setState(y.states.FORGOT)}}
200
+ >Forgot password</a>
201
+ </div>
202
+
203
+ ${this.errors?this.errors.map(e=>c`<p class="error">${e}</p>`):""}
204
+ <input type="submit" value="Log in" @click=${this.onSubmit} />
205
+
206
+ </form>`}renderForgotPasswordForm(){return c`
207
+ <auth-forgot-password-form
208
+ api=${this.api}>
209
+ </auth-forgot-password-form>
210
+ `}renderChangePasswordForm(){return c`
211
+ <p>You have logged in successfully, but you must change your password.</p>
212
+ <form @submit=${this.onSubmitChangePasswordChallenge}>
213
+ <input type="hidden" name="username" value="${this.username}" />
214
+ <label for="password">New Password</label>
215
+ <input
216
+ type="password"
217
+ name="password"
218
+ placeholder="Password"
219
+ required
220
+ />
221
+ <label for="confirm-password">Confirm Password</label>
222
+ <input
223
+ type="password"
224
+ name="confirm-password"
225
+ placeholder="Confirm Password"
226
+ required
227
+ />
228
+ ${this.errors?this.errors.map(e=>c`<p class="error">${e}</p>`):""}
229
+ <input type="submit" value="Change Password" />
230
+ </form>
231
+ `}}customElements.define("auth-login-form",y);customElements.define("auth-forgot-password-form",Ze);function Xe(){return function(r){const e=q`
232
+ .login-layout {
233
+ display: flex;
234
+ flex-direction: column;
235
+ gap: 1rem;
236
+ justify-content: center;
237
+ align-items: center;
238
+ min-height: 100vh;
239
+ background-color: var(--color-gray-100, #f5f5f5);
240
+ }
241
+ .login-layout > * {
242
+ max-width: 400px;
243
+ }
244
+ `;return c`
245
+ <style>${e}</style>
246
+ <div class="login-layout">
247
+ ${r.main}
248
+ </div>
249
+ `}}function et(r){return JSON.parse(window.atob(r.split(".")[1].replace(/-/g,"+").replace(/_/g,"/")))}function tt(r,e=300,t=Date.now()){return et(r).exp*1e3-e<t}function we(r){return(r.startsWith("/")?r:`/${r}`).replace(/\/{2,}/g,"/").replace(new RegExp("(?<=.)\\/$"),"")}function $e(r,e,t){const s=st(r,t);e.pushState(t,t.title,s),r.requestRender(t)}function rt(r,e){const{mount:t}=r.config,{history:s}=r.config.toolkit.element.ownerDocument.defaultView;return e.startsWith(t)?{path:we(e.slice(t.length)),push:o=>$e(r,s,o)}:null}function st(r,e){const{mount:t}=r.config;return we(`${t}/${e.path}`)}function ot(r,e){const{history:t}=e.config.toolkit.element.ownerDocument.defaultView;return c`
250
+ <h1>Auth Dashboard</h1>
251
+ <ul>
252
+ <li><a href="#" @click=${((o,i)=>()=>{$e(e,t,{path:o,title:i})})("/change-password")}>Change Password</a></li>
253
+ <li><a href="#" @click=${e.handleDestroyAuth}>Logout</a></li>
254
+ </ul>
255
+ `}function it(r,e){return c`
256
+ <auth-change-password-form .auth=${e}></auth-change-password-form>
257
+ `}class nt extends b{static get styles(){return q`
258
+ :host {
259
+ color: var(--color-text);
260
+ display: block;
261
+ font-family: var(--font-body);
262
+ }
263
+ h1,h2,h3,h4,h5,h6,label { font-family: var(--font-heading) }
264
+ label {
265
+ display: block;
266
+ font-size: var(--font-size-base);
267
+ margin-top: var(--spacing-md, 0.5rem);
268
+ }
269
+ input[type="text"],
270
+ input[type="password"] {
271
+ width: 100%;
272
+ margin: 5px 0 15px 0;
273
+ padding: var(--spacing-sm, 0.5rem) var(--spacing-md, 1rem);
274
+ box-sizing: border-box;
275
+ border: 1px solid var(--color-gray-300, #ccc);
276
+ border-radius: var(--radius-sm, 5px);
277
+ color: var(--color-gray-9, #333);
278
+ background-color: var(--color-gray-0, transparent);
279
+ }
280
+ input[type="submit"] {
281
+ background-color: var(--color-primary, inherit);
282
+ color: var(--color-gray-0, #fff);
283
+ border: none;
284
+ padding: var(--spacing-sm, 0.5rem) var(--spacing-md, 1rem);
285
+ border-radius: var(--radius-dynamic, 5px);
286
+ width: 200px;
287
+ cursor: pointer;
288
+ }
289
+ .error {
290
+ color: var(--color-error);
291
+ }
292
+ `}static get properties(){return{auth:{type:Object}}}constructor(){super(),this.errors={},this.success=null}connectedCallback(){super.connectedCallback(),X.getToken(this)}async onSubmit(e){if(e.preventDefault(),e.target.newPassword.value!==e.target.confirmPassword.value){this.errors.confirmPassword="Passwords do not match",this.requestUpdate();return}if(e.target.newPassword.value===e.target.currentPassword.value){this.errors.newPassword="The new password is the same as your current password.",this.requestUpdate();return}await X.getToken(this),await x({baseUrl:this.auth.config.api}).updatePassword({currentPassword:e.target.currentPassword.value,newPassword:e.target.newPassword.value}).then(()=>{this.errors={},this.success="Password changed.",this.requestUpdate()}).catch(s=>{this.errors.submit=s.message,this.requestUpdate()})}render(){return c`
293
+ <h1>Change your password</h1>
294
+ <p>Enter your current password and choose a new password.</p>
295
+ <form @submit=${this.onSubmit}>
296
+ <div class="field">
297
+ <label for="currentPassword">Current Password</label>
298
+ <input
299
+ type="password"
300
+ name="currentPassword"
301
+ placeholder="Current Password"
302
+ required
303
+ />
304
+ ${this.errors.currentPassword?c`<p class="error">${this.errors.currentPassword}</p>`:""}
305
+ </div>
306
+ <div class="field">
307
+ <label for="newPassword">New Password</label>
308
+ <input
309
+ type="password"
310
+ name="newPassword"
311
+ placeholder="New Password"
312
+ required
313
+ />
314
+ ${this.errors.newPassword?c`<p class="error">${this.errors.newPassword}</p>`:""}
315
+ </div>
316
+ <div class="field">
317
+ <label for="confirmPassword">Confirm Password</label>
318
+ <input
319
+ type="password"
320
+ name="confirmPassword"
321
+ placeholder="Confirm Password"
322
+ required
323
+ />
324
+ ${this.errors.confirmPassword?c`<p class="error">${this.errors.confirmPassword}</p>`:""}
325
+ </div>
326
+ <input type="submit" value="Change Password" />
327
+ ${this.errors.submit?c`<p class="error">${this.errors.submit}</p>`:""}
328
+ ${this.success?c`<p class="success">${this.success}</p>`:""}
329
+ </form>
330
+ `}}customElements.get("auth-change-password-form")||customElements.define("auth-change-password-form",nt);const at=[{path:"/",render:ot},{path:"/change-password",render:it}];function lt(r,e){const{path:t}=r,s=at.find(o=>o.path===t);if(s)return s.render(r,e)}const ct=q`
331
+ :host {
332
+
333
+ }
334
+ `;class dt extends b{static get styles(){return[ct]}static get properties(){return{state:{type:Object},auth:{type:Object}}}render(){const{state:e,auth:t}=this;return lt(e,t)}}customElements.get("auth-app")||customElements.define("auth-app",dt);function ht(r){const e={config:r,log:(...t)=>console.log("[auth]",...t)};return e.mount=k(be,e),e.handleTokenRequest=_e(e),e.handleDestroyAuth=Ae(e),e.presentLoginForm=k(Pe,e),e.getToken=k(Z,e),e.saveToken=k(Ee,e),e.getFreshToken=k(Se,e),e.requestRender=t=>Y(e,t),e}function be(r){const e=r.config.toolkit.element.ownerDocument.defaultView;[{type:"action:register",detail:{actionType:"auth:requestToken",handler:r.handleTokenRequest,modName:"auth"}},{type:"action:register",detail:{actionType:"auth:destroy",handler:r.handleDestroyAuth,modName:"auth"}},{type:"layout:register",detail:{name:"auth:login",slots:["main"],templateFn:Xe()}}].forEach(t=>r.config.toolkit.dispatchAction(t)),e.addEventListener("popstate",ve(r))}function Y(r,e){const t=r.config.toolkit.element.ownerDocument.defaultView;let s=e;s||(s=rt(r,t.location.pathname)),s&&r.config.toolkit.dispatchAction({type:"layout:slot:replace",detail:{layout:"menu-main-task-layout",slot:"main",content:c`<auth-app .state=${s} .auth=${r}></auth-app>`}})}function ve(r){return e=>{r.log("onpopstate",e),Y(r)}}function _e(r){let e=[],t=!1;const s=o=>{e.forEach(i=>{i(o)}),e=[]};return async({callback:o})=>{let i;try{i=await r.getFreshToken(),o(i)}catch(n){e.push(o),t||(r.presentLoginForm({onLogin:s}),t=!0),r.log(n)}}}function Ae(r){return()=>{const e=z(r);window.localStorage.removeItem(e),r.config.toolkit.dispatchAction({type:"layout:pop"})}}function Pe(r,{onLogin:e}){const{toolkit:t}=r.config,o=new URLSearchParams(t.element.ownerDocument.defaultView.location.search).get("password_reset_confirmation"),i=n=>{r.log("login success",{event:n});const{token:l}=n.detail;r.log("Login form dismissed",{args:[l]}),t.dispatchAction({type:"layout:pop"}),r.saveToken({token:l}),e({token:l})};t.dispatchAction({type:"layout:push",detail:{layout:"auth:login"}}),t.dispatchAction({type:"layout:slot:push",detail:{layout:"auth:login",slot:"main",content:c`<auth-login-form
335
+ api=${r.config.api}
336
+ confirmation="${o}"
337
+ @login-success=${i}>
338
+ </auth-login-form>`}})}function Ee(r,{token:e}){r.log("saving token",{args:[e]});const t=z(r);window.localStorage.setItem(t,e)}function Z(r){const e=z(r);return window.localStorage.getItem(e)}async function Se(r){const e=Z(r);if(!e||e.length<1)throw new Error("No token found");return tt(e)?(r.log("refreshing token",{args:[e]}),await x({baseUrl:r.config.api}).refreshToken({token:e}).then(({token:s})=>s)):e}function z({storageKey:r="token"}){return r}exports.getFreshToken=Se;exports.getToken=Z;exports.getTokenStorageKey=z;exports.historyStateHandler=ve;exports.loginDestroyHandler=Ae;exports.makeAuth=ht;exports.mount=be;exports.presentLoginForm=Pe;exports.renderApp=Y;exports.saveToken=Ee;exports.tokenRequestHandler=_e;