scb-wc 0.1.231 → 0.1.232

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 (60) hide show
  1. package/README.md +16 -19
  2. package/all.js +0 -12
  3. package/index.js +85 -97
  4. package/mvc/components/all.js +0 -7
  5. package/mvc/components/scb-accordion/scb-accordion-item.js +1 -1
  6. package/mvc/components/scb-accordion/scb-accordion.js +1 -1
  7. package/mvc/components/scb-app-bar/scb-app-bar.js +1 -1
  8. package/mvc/components/scb-button/scb-button.js +3 -3
  9. package/mvc/components/scb-calendar/scb-calendar.js +1 -1
  10. package/mvc/components/scb-calendar-card/scb-calendar-card.js +4 -4
  11. package/mvc/components/scb-card/scb-card.js +2 -2
  12. package/mvc/components/scb-cookies-consent/scb-cookies-consent.js +1 -1
  13. package/mvc/components/scb-dialog/scb-dialog.js +1 -1
  14. package/mvc/components/scb-drawer/scb-drawer.js +3 -3
  15. package/mvc/components/scb-drop-zone/scb-drop-zone.js +1 -1
  16. package/mvc/components/scb-dropdown/scb-dropdown.js +1 -1
  17. package/mvc/components/scb-fact-card/scb-fact-card.js +1 -1
  18. package/mvc/components/scb-header/scb-header.js +2 -2
  19. package/mvc/components/scb-horizontal-scroller/scb-horizontal-scroller.js +6 -6
  20. package/mvc/components/scb-icon-button/scb-icon-button.js +5 -5
  21. package/mvc/components/scb-keyfigure-card/scb-keyfigure-card.js +6 -6
  22. package/mvc/components/scb-link/scb-link.js +1 -1
  23. package/mvc/components/scb-link-button/scb-link-button.js +1 -1
  24. package/mvc/components/scb-list/scb-list-item.js +6 -6
  25. package/mvc/components/scb-menu/scb-menu-item.js +1 -1
  26. package/mvc/components/scb-nav/scb-nav.js +1 -1
  27. package/mvc/components/scb-notification-card/scb-notification-card.js +1 -1
  28. package/mvc/components/scb-options-menu/scb-options-menu-item.js +1 -1
  29. package/mvc/components/scb-options-menu/scb-options-menu.js +2 -2
  30. package/mvc/components/scb-options-menu/scb-options-sub-menu.js +1 -1
  31. package/mvc/components/scb-overlay/scb-overlay.js +3 -3
  32. package/mvc/components/scb-pagination/scb-pagination.js +1 -1
  33. package/mvc/components/scb-progress-stepper/scb-progress-step.js +1 -1
  34. package/mvc/components/scb-search/scb-search.js +3 -3
  35. package/mvc/components/scb-segmented-button/scb-segmented-item.js +1 -1
  36. package/mvc/components/scb-select/scb-select-option.js +1 -1
  37. package/mvc/components/scb-select/scb-select.js +1 -1
  38. package/mvc/components/scb-snackbar/scb-snackbar.js +1 -1
  39. package/mvc/components/scb-stepper/scb-step.js +1 -1
  40. package/mvc/components/scb-table/scb-table.js +1 -1
  41. package/mvc/components/scb-table-advanced/scb-table-advanced.js +1 -1
  42. package/mvc/components/scb-textfield/scb-textfield.js +176 -34
  43. package/mvc/components/scb-toc/scb-toc-item.js +1 -1
  44. package/mvc/components/scb-tooltip/scb-tooltip.js +1 -1
  45. package/mvc/{components/shared → vendor}/component-size-token.js +1 -1
  46. package/mvc/vendor/lazy-focus-ring.js +2 -0
  47. package/mvc/vendor/lazy-ripple.js +2 -0
  48. package/mvc/{components/shared → vendor}/manual-popover.js +1 -1
  49. package/mvc/{components/scb-chevron → vendor}/scb-chevron.js +1 -1
  50. package/mvc/vendor/scb-icon-svg.js +11 -0
  51. package/package.json +2 -2
  52. package/scb-viz/scb-viz-series-differentiation-registry.js +7 -10
  53. package/scb-viz/scb-viz.js +43 -43
  54. package/scb-wc.bundle.js +287 -287
  55. package/scb-wc.d.ts +188 -212
  56. package/shared/scb-icon-svg.js +2 -5
  57. package/mvc/components/scb-datepicker/scb-datepicker.js +0 -143
  58. package/mvc/components/shared/lazy-focus-ring.js +0 -2
  59. package/mvc/components/shared/lazy-ripple.js +0 -2
  60. package/mvc/components/shared/scb-icon-svg.js +0 -11
@@ -1,4 +1,4 @@
1
- import{f as p,g as b,h as y,m as _,p as o,v as d,y as z}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{componentSizeToken as m}from"../shared/component-size-token.js";import{t as s}from"../../vendor/decorate.js";import"../scb-button/scb-button.js";(function(){try{var h=typeof globalThis<"u"?globalThis:window;if(!h.__scb_ce_guard_installed__){h.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(i,r,a){try{customElements.get(i)||e(i,r,a)}catch(l){var n=String(l||"");if(n.indexOf("already been used")===-1&&n.indexOf("NotSupportedError")===-1)throw l}}}}catch{}})();var g,t=(g=class extends y{constructor(){super(),this._internals=null,this.type="default",this.name="",this.multiple=!1,this.label="",this.supportingText="",this.metaText="",this.buttonLabel="",this.replaceButtonLabel="",this.removeButtonLabel="",this.removeSelectedFileLabel="",this.selectedImagesLabel="",this.selectedFilesLabel="",this.imagePreviewLabel="",this.filePreviewLabel="",this.selectedImagesPreviewText="",this.existingFileLabel="",this.selectedFileLabel="",this.previewEyebrow="",this.emptyPreviewTitle="",this.emptyPreviewMeta="",this.accept="",this.hidePreview=!1,this.showExistingPreview=!1,this.disabled=!1,this.required=!1,this.error=!1,this.errorText="",this.previewSrc="",this.previewAlt="",this.previewTitle="",this.previewMeta="",this.existingValue="",this.existingValueName="",this.removeValueName="",this._isDragOver=!1,this._selectedPreviewKind="empty",this._selectedPreviewSrc="",this._selectedPreviewAlt="",this._selectedPreviewTitle="",this._selectedPreviewMeta="",this._selectedPreviewItems=[],this._markedForRemoval=!1,this._dragDepth=0,this._previewSource="external",this._form=null,this._formDataHandler=null,this._formSubmitHandler=null,this._customValidationMessage="",this._validationMessage="",this._hasValidationBeenReported=!1,this._supportingTextId=`scb-drop-zone-supporting-${Math.random().toString(36).slice(2)}`,this._metaTextId=`scb-drop-zone-meta-${Math.random().toString(36).slice(2)}`,this._errorTextId=`scb-drop-zone-error-${Math.random().toString(36).slice(2)}`,"attachInternals"in this&&(this._internals=this.attachInternals())}get _resolvedAccept(){return this.accept.trim()||(this.type==="image"?"image/*,.png,.jpg,.jpeg,.webp,.svg,.gif,.bmp,.avif":"")}get _hasExistingPreview(){return this.multiple||this._markedForRemoval||!(this.existingValue.trim()||this.previewSrc.trim()||this.previewTitle.trim()||this.previewMeta.trim())?!1:this.showExistingPreview||!!this.previewSrc.trim()}get _resolvedPreviewKind(){return this._previewSource==="external"&&this._hasExistingPreview?this.previewSrc.trim()?"image":"file":this._selectedPreviewKind}get _hasPreview(){return this._resolvedPreviewKind!=="empty"}get _hasFormFileValue(){return this._selectedPreviewItems.length?!0:!this.multiple&&!!this.existingValue.trim()&&!this._markedForRemoval}get _resolvedValidationMessage(){return this._customValidationMessage?this._customValidationMessage:!this.disabled&&this.required&&!this._hasFormFileValue?this.errorText||"Välj en fil.":""}get _visibleErrorText(){return this.error?this._validationMessage||this.errorText||"Välj en fil.":""}get _resolvedLabel(){return this.label||(this.type==="image"?"Ladda upp bild":"Ladda upp fil")}get _resolvedSupportingText(){return this.multiple?this.supportingText||(this.type==="image"?"Dra och släpp en eller flera bilder här, eller välj bilder från din dator.":"Dra och släpp en eller flera filer här, eller välj filer från din dator."):this.supportingText||(this.type==="image"?"Dra och släpp en bild här, eller välj en bild från din dator.":"Dra och släpp en fil här, eller välj en fil från din dator.")}get _resolvedMetaText(){return this.metaText?this.metaText:this.type==="image"?"PNG, JPG, SVG, GIF, BMP, AVIF och WebP stöds.":"Alla filtyper stöds."}get _resolvedButtonLabel(){return this.buttonLabel||(this.type==="image"?"Välj bild":"Välj fil")}get _resolvedReplaceButtonLabel(){return this.replaceButtonLabel?this.replaceButtonLabel:this.multiple||this._resolvedPreviewKind==="multi"?"Lägg till fler filer":this._previewSource==="external"&&this._hasExistingPreview?this._resolvedPreviewKind==="image"?"Ersätt bild":"Ersätt fil":this._resolvedPreviewKind==="image"?"Byt bild":"Byt fil"}get _resolvedRemoveButtonLabel(){return this.removeButtonLabel?this.removeButtonLabel:this._resolvedPreviewKind==="multi"?"Ta bort filer":this._previewSource==="external"&&this._hasExistingPreview?this._resolvedPreviewKind==="image"?"Ta bort befintlig bild":"Ta bort befintlig fil":this._resolvedPreviewKind==="image"?"Ta bort bild":"Ta bort fil"}get _resolvedRemoveSelectedFileLabel(){return this.removeSelectedFileLabel||"Ta bort"}get _resolvedSelectedImagesLabel(){return this.selectedImagesLabel||"Valda bilder"}get _resolvedSelectedFilesLabel(){return this.selectedFilesLabel||"Valda filer"}get _resolvedImagePreviewLabel(){return this.imagePreviewLabel||"Bild"}get _resolvedFilePreviewLabel(){return this.filePreviewLabel||"Fil"}get _resolvedSelectedImagesPreviewText(){return this.selectedImagesPreviewText||"Valda bilder visas under uppladdningsytan."}get _resolvedExistingFileLabel(){return this.existingFileLabel||"Befintlig fil"}get _resolvedSelectedFileLabel(){return this.selectedFileLabel||"Vald fil"}get _resolvedPreviewEyebrow(){return this.previewEyebrow?this.previewEyebrow:this._hasPreview?this._resolvedPreviewKind==="multi"?"Uppladdade filer":this._previewSource==="external"&&this._hasExistingPreview?this._resolvedPreviewKind==="image"?"Befintlig bild":"Befintlig fil":this._resolvedPreviewKind==="image"?"Uppladdad bild":"Uppladdad fil":"Förhandsvisning"}get _resolvedEmptyPreviewTitle(){return this.emptyPreviewTitle?this.emptyPreviewTitle:this.multiple?this.type==="image"?"Inga bilder uppladdade":"Inga filer uppladdade":this.type==="image"?"Ingen bild uppladdad":"Ingen fil uppladdad"}get _resolvedEmptyPreviewMeta(){return this.emptyPreviewMeta?this.emptyPreviewMeta:this.multiple?this.type==="image"?"Förhandsvisningen visas här när du har laddat upp bilder.":"Förhandsvisningen visas här när du har laddat upp filer.":this.type==="image"?"Förhandsvisningen visas här när du har laddat upp en bild.":"Förhandsvisningen visas här när du har laddat upp en fil."}get _resolvedPreviewSrc(){return this._previewSource==="external"&&this._hasExistingPreview?this.previewSrc.trim():this._selectedPreviewSrc}get _resolvedPreviewAlt(){return this._previewSource==="external"&&this._hasExistingPreview?this.previewAlt:this._selectedPreviewAlt}get _resolvedPreviewTitle(){return this._previewSource==="external"&&this._hasExistingPreview?this.previewTitle||(this._resolvedPreviewKind==="image"?"Befintlig bild":"Befintlig fil"):this._selectedPreviewTitle}get _resolvedPreviewMeta(){return this._previewSource==="external"&&this._hasExistingPreview?this.previewMeta:this._selectedPreviewMeta}connectedCallback(){super.connectedCallback(),this._syncFormValue(),this._form=this.closest("form"),this._form&&(this._formDataHandler=e=>{const i=e.formData;i&&this._appendToFormData(i)},this._form.addEventListener("formdata",this._formDataHandler),this._formSubmitHandler=e=>{this.reportValidity()||(e.preventDefault(),e.stopPropagation())},this._form.addEventListener("submit",this._formSubmitHandler))}disconnectedCallback(){this._form&&this._formDataHandler&&this._form.removeEventListener("formdata",this._formDataHandler),this._form&&this._formSubmitHandler&&this._form.removeEventListener("submit",this._formSubmitHandler),this._formDataHandler=null,this._formSubmitHandler=null,this._form=null,this._revokeObjectUrl(),super.disconnectedCallback()}updated(e){e.has("type")&&this.type==="image"&&this._selectedPreviewKind==="file"&&this._clearSelectedFileState(),(e.has("disabled")||e.has("name")||e.has("multiple")||e.has("existingValueName")||e.has("removeValueName")||e.has("existingValue"))&&this._syncFormValue(),(e.has("required")||e.has("errorText"))&&this._syncValidity()}formDisabledCallback(e){this.disabled=e,e&&(this._hasValidationBeenReported=!1),this._syncFormValue()}formResetCallback(){this._clearSelectedFileState(),this._markedForRemoval=!1,this._previewSource="external",this._hasValidationBeenReported=!1,this.error=!1,this._clearNativeInputValue(),this._syncFormValue()}_syncFormValue(){if(!this._internals){this._syncValidity();return}const e=this.name.trim(),i=this.existingValueName.trim(),r=this.removeValueName.trim(),a=new FormData;if(!this.disabled&&e&&this._selectedPreviewItems.length&&this._selectedPreviewItems.forEach(n=>{a.append(e,n.file,n.file.name)}),!this.disabled&&!this.multiple&&i&&this.existingValue.trim()&&a.append(i,this.existingValue),!this.disabled&&!this.multiple&&r&&a.append(r,this._markedForRemoval?"true":"false"),[...a.keys()].length===0){this._internals.setFormValue(null),this._syncValidity();return}this._internals.setFormValue(a),this._syncValidity()}_syncValidity(){const e=this._resolvedValidationMessage,i=this.error,r=this._validationMessage,a=this.renderRoot?.querySelector('[data-role="zone"]')??void 0;if(this._internals)if(e){const n=this._customValidationMessage?{customError:!0}:{valueMissing:!0};this._internals.setValidity(n,e,a)}else this._internals.setValidity({});this._validationMessage=e,this.error=this.disabled?!1:e?this._hasValidationBeenReported||i:i&&!this._hasValidationBeenReported&&!r,this._internals&&!e&&this._internals.setValidity({}),(i!==this.error||r!==this._validationMessage)&&this.requestUpdate()}checkValidity(){return this._syncValidity(),this._internals?this._internals.checkValidity():!this._resolvedValidationMessage}reportValidity(){return this._hasValidationBeenReported=!0,this._syncValidity(),this._internals?this._internals.reportValidity():this.checkValidity()}setCustomValidity(e){this._customValidationMessage=e,e||(this._hasValidationBeenReported=!1,this.error=!1),this._syncValidity()}get form(){return this._internals?.form??this._form}get validity(){return this._internals?.validity??{valid:this.checkValidity()}}get validationMessage(){return this._internals?.validationMessage??this._resolvedValidationMessage}get willValidate(){return this._internals?.willValidate??!this.disabled}get labels(){return this._internals?.labels??document.createDocumentFragment().childNodes}_appendToFormData(e){if(this.disabled)return;const i=this.name.trim();if(i&&this._selectedPreviewItems.length&&(e.getAll(i).some(r=>r instanceof File&&this._selectedPreviewItems.some(a=>a.file===r))||this._selectedPreviewItems.forEach(r=>{e.append(i,r.file,r.file.name)})),!this.multiple){const r=this.existingValueName.trim();r&&this.existingValue.trim()&&!e.has(r)&&e.append(r,this.existingValue);const a=this.removeValueName.trim();a&&!e.has(a)&&e.append(a,this._markedForRemoval?"true":"false")}}openPicker(){if(this.disabled)return;const e=this.renderRoot.querySelector('[data-role="native-input"]');if(e){try{e.value=""}catch{}e.click()}}setPreviewState(e){this.previewSrc=e?.src??"",this.previewAlt=e?.alt??"",this.previewTitle=e?.title??"",this.previewMeta=e?.meta??"",this._markedForRemoval=!1,this._previewSource=this._selectedPreviewItems.length?"internal":"external",this._syncFormValue()}setExistingFileState(e){if(this.multiple){this.existingValue="",this.previewSrc="",this.previewAlt="",this.previewTitle="",this.previewMeta="",this._markedForRemoval=!1,this._syncFormValue();return}this.existingValue=e?.value??"",this.previewSrc=e?.src??"",this.previewAlt=e?.alt??"",this.previewTitle=e?.title??"",this.previewMeta=e?.meta??"",this._markedForRemoval=!1,this._previewSource=this._selectedPreviewItems.length?"internal":"external",this._syncFormValue()}clearPreviewState(){this.previewSrc="",this.previewAlt="",this.previewTitle="",this.previewMeta="",this._markedForRemoval=!1,this._previewSource="external",this._clearSelectedFileState(),this._clearNativeInputValue(),this._syncFormValue()}clearExistingFileState(){this.existingValue="",this.previewSrc="",this.previewAlt="",this.previewTitle="",this.previewMeta="",this._markedForRemoval=!1,this._selectedPreviewItems.length||(this._previewSource="external"),this._syncFormValue()}_dispatch(e,i={},r=!1){const a=new CustomEvent(e,{detail:i,bubbles:!0,composed:!0,cancelable:r});return this.dispatchEvent(a),a}_handleFiles(e){const i=Array.from(e??[]).filter(n=>this._isAcceptedFile(n));if(!i.length)return;const r=this.multiple?i:[i[0]];this._setSelectedFilesState(r,this.multiple);const a=this._selectedPreviewItems.map(n=>n.file);this._dispatch("file-selected",{file:a[0],files:a,addedFiles:r,existingValue:this.existingValue,markedForRemoval:this._markedForRemoval}),this._dispatch("change",{file:a[0],files:a,addedFiles:r,existingValue:this.existingValue,markedForRemoval:this._markedForRemoval})}_onZoneClick(e){this.disabled||e.composedPath().some(i=>i instanceof HTMLElement&&i.getAttribute("data-role")==="choose-button")||this.openPicker()}_onZoneKeydown(e){this.disabled||(e.key==="Enter"||e.key===" "||e.key==="Spacebar")&&(e.preventDefault(),this.openPicker())}_preventDefaultDrag(e){e.preventDefault(),e.stopPropagation()}_onDragEnter(e){this.disabled||(this._preventDefaultDrag(e),this._dragDepth+=1,this._isDragOver=!0)}_onDragOver(e){this.disabled||(this._preventDefaultDrag(e),this._isDragOver=!0)}_onDragLeave(e){this.disabled||(this._preventDefaultDrag(e),this._dragDepth=Math.max(0,this._dragDepth-1),this._dragDepth||(this._isDragOver=!1))}_onDrop(e){this.disabled||(this._preventDefaultDrag(e),this._dragDepth=0,this._isDragOver=!1,this._handleFiles(e.dataTransfer?.files??null))}_onNativeInputChange(e){const i=e.currentTarget;this._handleFiles(i?.files??null)}_onChooseButtonClick(e){e.preventDefault(),e.stopPropagation(),this.openPicker()}_onReplaceButtonClick(e){e.preventDefault(),e.stopPropagation(),this.openPicker()}_onRemoveButtonClick(e){if(e.preventDefault(),e.stopPropagation(),!this._dispatch("clear-request",{file:this._selectedPreviewItems[0]?.file??null,files:this._selectedPreviewItems.map(i=>i.file),existingValue:this.existingValue,markedForRemoval:this._markedForRemoval},!0).defaultPrevented){if(this._selectedPreviewItems.length){this._clearSelectedFileState(),this._clearNativeInputValue(),this._previewSource=this._hasExistingPreview?"external":"internal",this._dispatch("change",{file:null,files:[],existingValue:this.existingValue,markedForRemoval:this._markedForRemoval});return}if(this._hasExistingPreview){this._markedForRemoval=!0,this._previewSource="external",this._syncFormValue(),this.requestUpdate(),this._dispatch("change",{file:null,files:[],existingValue:this.existingValue,markedForRemoval:!0});return}this.clearPreviewState()}}_onRemoveSelectedItemClick(e){if(e.preventDefault(),e.stopPropagation(),this.disabled)return;const i=e.currentTarget?.getAttribute("data-index")||"",r=Number.parseInt(i,10);Number.isInteger(r)&&this._removeSelectedItemAt(r)}_isAcceptedFile(e){const i=this._resolvedAccept.trim();if(!i)return!0;const r=e.name.toLowerCase(),a=(e.type||"").toLowerCase(),n=i.split(",").map(l=>l.trim().toLowerCase()).filter(Boolean);return n.length?n.some(l=>l==="*/*"?!0:l.endsWith("/*")?a.startsWith(l.slice(0,-1)):l.startsWith(".")?r.endsWith(l):a===l):!0}_setSelectedFilesState(e,i){const r=e.filter(Boolean);if(!r.length)return;const a=i?this._selectedPreviewItems:[],n=r.map(c=>{const v=this._getPreviewKindForFile(c),u=this._getFileTypeLabel(c),w=this._formatFileSize(c.size);return{file:c,kind:v,src:v==="image"?URL.createObjectURL(c):"",alt:v==="image"?c.name||"Uppladdad bild":"",title:c.name||(v==="image"?"Uppladdad bild":"Uppladdad fil"),meta:[u,w].filter(Boolean).join(" • ")}});i||this._revokeObjectUrl();const l=this.multiple?[...a,...n]:[n[0]];!this.multiple&&a.length&&this._revokeObjectUrlsForItems(a),this._markedForRemoval=!1,this._applySelectedPreviewItems(l)}_clearSelectedFileState(){this._revokeObjectUrl(),this._applySelectedPreviewItems([])}_applySelectedPreviewItems(e){this._selectedPreviewItems=e;const i=e[0];if(!i){this._selectedPreviewKind="empty",this._selectedPreviewTitle="",this._selectedPreviewMeta="",this._selectedPreviewAlt="",this._selectedPreviewSrc="",this._previewSource="internal",this._syncFormValue();return}if(e.length>1){const r=e.reduce((a,n)=>a+(Number.isFinite(n.file.size)?n.file.size:0),0);this._selectedPreviewKind="multi",this._selectedPreviewTitle=`${e.length} filer valda`,this._selectedPreviewMeta=`Totalt ${this._formatFileSize(r)}`,this._selectedPreviewAlt="",this._selectedPreviewSrc=""}else this._selectedPreviewKind=i.kind,this._selectedPreviewTitle=i.title,this._selectedPreviewMeta=i.meta,this._selectedPreviewAlt=i.alt,this._selectedPreviewSrc=i.src;this._previewSource="internal",this._syncFormValue()}_removeSelectedItemAt(e){if(e<0||e>=this._selectedPreviewItems.length)return;const i=this._selectedPreviewItems[e];i.src&&URL.revokeObjectURL(i.src);const r=this._selectedPreviewItems.filter((a,n)=>n!==e);this._applySelectedPreviewItems(r),this._dispatch("file-removed",{file:i.file,files:r.map(a=>a.file),index:e,existingValue:this.existingValue,markedForRemoval:this._markedForRemoval}),this._dispatch("change",{file:r[0]?.file??null,files:r.map(a=>a.file),removedFile:i.file,removedIndex:e,existingValue:this.existingValue,markedForRemoval:this._markedForRemoval})}_renderSelectedImageCards(){return!this.multiple||this.type!=="image"||this.hidePreview||!this._selectedPreviewItems.some(e=>e.kind==="image"&&e.src)?null:d`
1
+ import{f as p,g as b,h as y,m as _,p as o,v as d,y as z}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as m}from"../../vendor/component-size-token.js";import{t as s}from"../../vendor/decorate.js";import"../scb-button/scb-button.js";(function(){try{var h=typeof globalThis<"u"?globalThis:window;if(!h.__scb_ce_guard_installed__){h.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(i,r,a){try{customElements.get(i)||e(i,r,a)}catch(l){var n=String(l||"");if(n.indexOf("already been used")===-1&&n.indexOf("NotSupportedError")===-1)throw l}}}}catch{}})();var g,t=(g=class extends y{constructor(){super(),this._internals=null,this.type="default",this.name="",this.multiple=!1,this.label="",this.supportingText="",this.metaText="",this.buttonLabel="",this.replaceButtonLabel="",this.removeButtonLabel="",this.removeSelectedFileLabel="",this.selectedImagesLabel="",this.selectedFilesLabel="",this.imagePreviewLabel="",this.filePreviewLabel="",this.selectedImagesPreviewText="",this.existingFileLabel="",this.selectedFileLabel="",this.previewEyebrow="",this.emptyPreviewTitle="",this.emptyPreviewMeta="",this.accept="",this.hidePreview=!1,this.showExistingPreview=!1,this.disabled=!1,this.required=!1,this.error=!1,this.errorText="",this.previewSrc="",this.previewAlt="",this.previewTitle="",this.previewMeta="",this.existingValue="",this.existingValueName="",this.removeValueName="",this._isDragOver=!1,this._selectedPreviewKind="empty",this._selectedPreviewSrc="",this._selectedPreviewAlt="",this._selectedPreviewTitle="",this._selectedPreviewMeta="",this._selectedPreviewItems=[],this._markedForRemoval=!1,this._dragDepth=0,this._previewSource="external",this._form=null,this._formDataHandler=null,this._formSubmitHandler=null,this._customValidationMessage="",this._validationMessage="",this._hasValidationBeenReported=!1,this._supportingTextId=`scb-drop-zone-supporting-${Math.random().toString(36).slice(2)}`,this._metaTextId=`scb-drop-zone-meta-${Math.random().toString(36).slice(2)}`,this._errorTextId=`scb-drop-zone-error-${Math.random().toString(36).slice(2)}`,"attachInternals"in this&&(this._internals=this.attachInternals())}get _resolvedAccept(){return this.accept.trim()||(this.type==="image"?"image/*,.png,.jpg,.jpeg,.webp,.svg,.gif,.bmp,.avif":"")}get _hasExistingPreview(){return this.multiple||this._markedForRemoval||!(this.existingValue.trim()||this.previewSrc.trim()||this.previewTitle.trim()||this.previewMeta.trim())?!1:this.showExistingPreview||!!this.previewSrc.trim()}get _resolvedPreviewKind(){return this._previewSource==="external"&&this._hasExistingPreview?this.previewSrc.trim()?"image":"file":this._selectedPreviewKind}get _hasPreview(){return this._resolvedPreviewKind!=="empty"}get _hasFormFileValue(){return this._selectedPreviewItems.length?!0:!this.multiple&&!!this.existingValue.trim()&&!this._markedForRemoval}get _resolvedValidationMessage(){return this._customValidationMessage?this._customValidationMessage:!this.disabled&&this.required&&!this._hasFormFileValue?this.errorText||"Välj en fil.":""}get _visibleErrorText(){return this.error?this._validationMessage||this.errorText||"Välj en fil.":""}get _resolvedLabel(){return this.label||(this.type==="image"?"Ladda upp bild":"Ladda upp fil")}get _resolvedSupportingText(){return this.multiple?this.supportingText||(this.type==="image"?"Dra och släpp en eller flera bilder här, eller välj bilder från din dator.":"Dra och släpp en eller flera filer här, eller välj filer från din dator."):this.supportingText||(this.type==="image"?"Dra och släpp en bild här, eller välj en bild från din dator.":"Dra och släpp en fil här, eller välj en fil från din dator.")}get _resolvedMetaText(){return this.metaText?this.metaText:this.type==="image"?"PNG, JPG, SVG, GIF, BMP, AVIF och WebP stöds.":"Alla filtyper stöds."}get _resolvedButtonLabel(){return this.buttonLabel||(this.type==="image"?"Välj bild":"Välj fil")}get _resolvedReplaceButtonLabel(){return this.replaceButtonLabel?this.replaceButtonLabel:this.multiple||this._resolvedPreviewKind==="multi"?"Lägg till fler filer":this._previewSource==="external"&&this._hasExistingPreview?this._resolvedPreviewKind==="image"?"Ersätt bild":"Ersätt fil":this._resolvedPreviewKind==="image"?"Byt bild":"Byt fil"}get _resolvedRemoveButtonLabel(){return this.removeButtonLabel?this.removeButtonLabel:this._resolvedPreviewKind==="multi"?"Ta bort filer":this._previewSource==="external"&&this._hasExistingPreview?this._resolvedPreviewKind==="image"?"Ta bort befintlig bild":"Ta bort befintlig fil":this._resolvedPreviewKind==="image"?"Ta bort bild":"Ta bort fil"}get _resolvedRemoveSelectedFileLabel(){return this.removeSelectedFileLabel||"Ta bort"}get _resolvedSelectedImagesLabel(){return this.selectedImagesLabel||"Valda bilder"}get _resolvedSelectedFilesLabel(){return this.selectedFilesLabel||"Valda filer"}get _resolvedImagePreviewLabel(){return this.imagePreviewLabel||"Bild"}get _resolvedFilePreviewLabel(){return this.filePreviewLabel||"Fil"}get _resolvedSelectedImagesPreviewText(){return this.selectedImagesPreviewText||"Valda bilder visas under uppladdningsytan."}get _resolvedExistingFileLabel(){return this.existingFileLabel||"Befintlig fil"}get _resolvedSelectedFileLabel(){return this.selectedFileLabel||"Vald fil"}get _resolvedPreviewEyebrow(){return this.previewEyebrow?this.previewEyebrow:this._hasPreview?this._resolvedPreviewKind==="multi"?"Uppladdade filer":this._previewSource==="external"&&this._hasExistingPreview?this._resolvedPreviewKind==="image"?"Befintlig bild":"Befintlig fil":this._resolvedPreviewKind==="image"?"Uppladdad bild":"Uppladdad fil":"Förhandsvisning"}get _resolvedEmptyPreviewTitle(){return this.emptyPreviewTitle?this.emptyPreviewTitle:this.multiple?this.type==="image"?"Inga bilder uppladdade":"Inga filer uppladdade":this.type==="image"?"Ingen bild uppladdad":"Ingen fil uppladdad"}get _resolvedEmptyPreviewMeta(){return this.emptyPreviewMeta?this.emptyPreviewMeta:this.multiple?this.type==="image"?"Förhandsvisningen visas här när du har laddat upp bilder.":"Förhandsvisningen visas här när du har laddat upp filer.":this.type==="image"?"Förhandsvisningen visas här när du har laddat upp en bild.":"Förhandsvisningen visas här när du har laddat upp en fil."}get _resolvedPreviewSrc(){return this._previewSource==="external"&&this._hasExistingPreview?this.previewSrc.trim():this._selectedPreviewSrc}get _resolvedPreviewAlt(){return this._previewSource==="external"&&this._hasExistingPreview?this.previewAlt:this._selectedPreviewAlt}get _resolvedPreviewTitle(){return this._previewSource==="external"&&this._hasExistingPreview?this.previewTitle||(this._resolvedPreviewKind==="image"?"Befintlig bild":"Befintlig fil"):this._selectedPreviewTitle}get _resolvedPreviewMeta(){return this._previewSource==="external"&&this._hasExistingPreview?this.previewMeta:this._selectedPreviewMeta}connectedCallback(){super.connectedCallback(),this._syncFormValue(),this._form=this.closest("form"),this._form&&(this._formDataHandler=e=>{const i=e.formData;i&&this._appendToFormData(i)},this._form.addEventListener("formdata",this._formDataHandler),this._formSubmitHandler=e=>{this.reportValidity()||(e.preventDefault(),e.stopPropagation())},this._form.addEventListener("submit",this._formSubmitHandler))}disconnectedCallback(){this._form&&this._formDataHandler&&this._form.removeEventListener("formdata",this._formDataHandler),this._form&&this._formSubmitHandler&&this._form.removeEventListener("submit",this._formSubmitHandler),this._formDataHandler=null,this._formSubmitHandler=null,this._form=null,this._revokeObjectUrl(),super.disconnectedCallback()}updated(e){e.has("type")&&this.type==="image"&&this._selectedPreviewKind==="file"&&this._clearSelectedFileState(),(e.has("disabled")||e.has("name")||e.has("multiple")||e.has("existingValueName")||e.has("removeValueName")||e.has("existingValue"))&&this._syncFormValue(),(e.has("required")||e.has("errorText"))&&this._syncValidity()}formDisabledCallback(e){this.disabled=e,e&&(this._hasValidationBeenReported=!1),this._syncFormValue()}formResetCallback(){this._clearSelectedFileState(),this._markedForRemoval=!1,this._previewSource="external",this._hasValidationBeenReported=!1,this.error=!1,this._clearNativeInputValue(),this._syncFormValue()}_syncFormValue(){if(!this._internals){this._syncValidity();return}const e=this.name.trim(),i=this.existingValueName.trim(),r=this.removeValueName.trim(),a=new FormData;if(!this.disabled&&e&&this._selectedPreviewItems.length&&this._selectedPreviewItems.forEach(n=>{a.append(e,n.file,n.file.name)}),!this.disabled&&!this.multiple&&i&&this.existingValue.trim()&&a.append(i,this.existingValue),!this.disabled&&!this.multiple&&r&&a.append(r,this._markedForRemoval?"true":"false"),[...a.keys()].length===0){this._internals.setFormValue(null),this._syncValidity();return}this._internals.setFormValue(a),this._syncValidity()}_syncValidity(){const e=this._resolvedValidationMessage,i=this.error,r=this._validationMessage,a=this.renderRoot?.querySelector('[data-role="zone"]')??void 0;if(this._internals)if(e){const n=this._customValidationMessage?{customError:!0}:{valueMissing:!0};this._internals.setValidity(n,e,a)}else this._internals.setValidity({});this._validationMessage=e,this.error=this.disabled?!1:e?this._hasValidationBeenReported||i:i&&!this._hasValidationBeenReported&&!r,this._internals&&!e&&this._internals.setValidity({}),(i!==this.error||r!==this._validationMessage)&&this.requestUpdate()}checkValidity(){return this._syncValidity(),this._internals?this._internals.checkValidity():!this._resolvedValidationMessage}reportValidity(){return this._hasValidationBeenReported=!0,this._syncValidity(),this._internals?this._internals.reportValidity():this.checkValidity()}setCustomValidity(e){this._customValidationMessage=e,e||(this._hasValidationBeenReported=!1,this.error=!1),this._syncValidity()}get form(){return this._internals?.form??this._form}get validity(){return this._internals?.validity??{valid:this.checkValidity()}}get validationMessage(){return this._internals?.validationMessage??this._resolvedValidationMessage}get willValidate(){return this._internals?.willValidate??!this.disabled}get labels(){return this._internals?.labels??document.createDocumentFragment().childNodes}_appendToFormData(e){if(this.disabled)return;const i=this.name.trim();if(i&&this._selectedPreviewItems.length&&(e.getAll(i).some(r=>r instanceof File&&this._selectedPreviewItems.some(a=>a.file===r))||this._selectedPreviewItems.forEach(r=>{e.append(i,r.file,r.file.name)})),!this.multiple){const r=this.existingValueName.trim();r&&this.existingValue.trim()&&!e.has(r)&&e.append(r,this.existingValue);const a=this.removeValueName.trim();a&&!e.has(a)&&e.append(a,this._markedForRemoval?"true":"false")}}openPicker(){if(this.disabled)return;const e=this.renderRoot.querySelector('[data-role="native-input"]');if(e){try{e.value=""}catch{}e.click()}}setPreviewState(e){this.previewSrc=e?.src??"",this.previewAlt=e?.alt??"",this.previewTitle=e?.title??"",this.previewMeta=e?.meta??"",this._markedForRemoval=!1,this._previewSource=this._selectedPreviewItems.length?"internal":"external",this._syncFormValue()}setExistingFileState(e){if(this.multiple){this.existingValue="",this.previewSrc="",this.previewAlt="",this.previewTitle="",this.previewMeta="",this._markedForRemoval=!1,this._syncFormValue();return}this.existingValue=e?.value??"",this.previewSrc=e?.src??"",this.previewAlt=e?.alt??"",this.previewTitle=e?.title??"",this.previewMeta=e?.meta??"",this._markedForRemoval=!1,this._previewSource=this._selectedPreviewItems.length?"internal":"external",this._syncFormValue()}clearPreviewState(){this.previewSrc="",this.previewAlt="",this.previewTitle="",this.previewMeta="",this._markedForRemoval=!1,this._previewSource="external",this._clearSelectedFileState(),this._clearNativeInputValue(),this._syncFormValue()}clearExistingFileState(){this.existingValue="",this.previewSrc="",this.previewAlt="",this.previewTitle="",this.previewMeta="",this._markedForRemoval=!1,this._selectedPreviewItems.length||(this._previewSource="external"),this._syncFormValue()}_dispatch(e,i={},r=!1){const a=new CustomEvent(e,{detail:i,bubbles:!0,composed:!0,cancelable:r});return this.dispatchEvent(a),a}_handleFiles(e){const i=Array.from(e??[]).filter(n=>this._isAcceptedFile(n));if(!i.length)return;const r=this.multiple?i:[i[0]];this._setSelectedFilesState(r,this.multiple);const a=this._selectedPreviewItems.map(n=>n.file);this._dispatch("file-selected",{file:a[0],files:a,addedFiles:r,existingValue:this.existingValue,markedForRemoval:this._markedForRemoval}),this._dispatch("change",{file:a[0],files:a,addedFiles:r,existingValue:this.existingValue,markedForRemoval:this._markedForRemoval})}_onZoneClick(e){this.disabled||e.composedPath().some(i=>i instanceof HTMLElement&&i.getAttribute("data-role")==="choose-button")||this.openPicker()}_onZoneKeydown(e){this.disabled||(e.key==="Enter"||e.key===" "||e.key==="Spacebar")&&(e.preventDefault(),this.openPicker())}_preventDefaultDrag(e){e.preventDefault(),e.stopPropagation()}_onDragEnter(e){this.disabled||(this._preventDefaultDrag(e),this._dragDepth+=1,this._isDragOver=!0)}_onDragOver(e){this.disabled||(this._preventDefaultDrag(e),this._isDragOver=!0)}_onDragLeave(e){this.disabled||(this._preventDefaultDrag(e),this._dragDepth=Math.max(0,this._dragDepth-1),this._dragDepth||(this._isDragOver=!1))}_onDrop(e){this.disabled||(this._preventDefaultDrag(e),this._dragDepth=0,this._isDragOver=!1,this._handleFiles(e.dataTransfer?.files??null))}_onNativeInputChange(e){const i=e.currentTarget;this._handleFiles(i?.files??null)}_onChooseButtonClick(e){e.preventDefault(),e.stopPropagation(),this.openPicker()}_onReplaceButtonClick(e){e.preventDefault(),e.stopPropagation(),this.openPicker()}_onRemoveButtonClick(e){if(e.preventDefault(),e.stopPropagation(),!this._dispatch("clear-request",{file:this._selectedPreviewItems[0]?.file??null,files:this._selectedPreviewItems.map(i=>i.file),existingValue:this.existingValue,markedForRemoval:this._markedForRemoval},!0).defaultPrevented){if(this._selectedPreviewItems.length){this._clearSelectedFileState(),this._clearNativeInputValue(),this._previewSource=this._hasExistingPreview?"external":"internal",this._dispatch("change",{file:null,files:[],existingValue:this.existingValue,markedForRemoval:this._markedForRemoval});return}if(this._hasExistingPreview){this._markedForRemoval=!0,this._previewSource="external",this._syncFormValue(),this.requestUpdate(),this._dispatch("change",{file:null,files:[],existingValue:this.existingValue,markedForRemoval:!0});return}this.clearPreviewState()}}_onRemoveSelectedItemClick(e){if(e.preventDefault(),e.stopPropagation(),this.disabled)return;const i=e.currentTarget?.getAttribute("data-index")||"",r=Number.parseInt(i,10);Number.isInteger(r)&&this._removeSelectedItemAt(r)}_isAcceptedFile(e){const i=this._resolvedAccept.trim();if(!i)return!0;const r=e.name.toLowerCase(),a=(e.type||"").toLowerCase(),n=i.split(",").map(l=>l.trim().toLowerCase()).filter(Boolean);return n.length?n.some(l=>l==="*/*"?!0:l.endsWith("/*")?a.startsWith(l.slice(0,-1)):l.startsWith(".")?r.endsWith(l):a===l):!0}_setSelectedFilesState(e,i){const r=e.filter(Boolean);if(!r.length)return;const a=i?this._selectedPreviewItems:[],n=r.map(c=>{const v=this._getPreviewKindForFile(c),u=this._getFileTypeLabel(c),w=this._formatFileSize(c.size);return{file:c,kind:v,src:v==="image"?URL.createObjectURL(c):"",alt:v==="image"?c.name||"Uppladdad bild":"",title:c.name||(v==="image"?"Uppladdad bild":"Uppladdad fil"),meta:[u,w].filter(Boolean).join(" • ")}});i||this._revokeObjectUrl();const l=this.multiple?[...a,...n]:[n[0]];!this.multiple&&a.length&&this._revokeObjectUrlsForItems(a),this._markedForRemoval=!1,this._applySelectedPreviewItems(l)}_clearSelectedFileState(){this._revokeObjectUrl(),this._applySelectedPreviewItems([])}_applySelectedPreviewItems(e){this._selectedPreviewItems=e;const i=e[0];if(!i){this._selectedPreviewKind="empty",this._selectedPreviewTitle="",this._selectedPreviewMeta="",this._selectedPreviewAlt="",this._selectedPreviewSrc="",this._previewSource="internal",this._syncFormValue();return}if(e.length>1){const r=e.reduce((a,n)=>a+(Number.isFinite(n.file.size)?n.file.size:0),0);this._selectedPreviewKind="multi",this._selectedPreviewTitle=`${e.length} filer valda`,this._selectedPreviewMeta=`Totalt ${this._formatFileSize(r)}`,this._selectedPreviewAlt="",this._selectedPreviewSrc=""}else this._selectedPreviewKind=i.kind,this._selectedPreviewTitle=i.title,this._selectedPreviewMeta=i.meta,this._selectedPreviewAlt=i.alt,this._selectedPreviewSrc=i.src;this._previewSource="internal",this._syncFormValue()}_removeSelectedItemAt(e){if(e<0||e>=this._selectedPreviewItems.length)return;const i=this._selectedPreviewItems[e];i.src&&URL.revokeObjectURL(i.src);const r=this._selectedPreviewItems.filter((a,n)=>n!==e);this._applySelectedPreviewItems(r),this._dispatch("file-removed",{file:i.file,files:r.map(a=>a.file),index:e,existingValue:this.existingValue,markedForRemoval:this._markedForRemoval}),this._dispatch("change",{file:r[0]?.file??null,files:r.map(a=>a.file),removedFile:i.file,removedIndex:e,existingValue:this.existingValue,markedForRemoval:this._markedForRemoval})}_renderSelectedImageCards(){return!this.multiple||this.type!=="image"||this.hidePreview||!this._selectedPreviewItems.some(e=>e.kind==="image"&&e.src)?null:d`
2
2
  <div class="scb-drop-zone__selected-images" aria-label=${this._resolvedSelectedImagesLabel}>
3
3
  ${this._selectedPreviewItems.map((e,i)=>e.kind!=="image"||!e.src?null:d`
4
4
  <article class="scb-drop-zone__selected-image-card" aria-label=${`${e.title}, ${e.meta}`}>
@@ -1,4 +1,4 @@
1
- import{d as g,g as S,h as I,m as A,p as d,v,y as W}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/icon.js";import{ensureFocusRingOnFocusVisible as $}from"../shared/lazy-focus-ring.js";import{t as B}from"../../vendor/component-defaults.js";import{t as r}from"../../vendor/decorate.js";import"../scb-chevron/scb-chevron.js";import"../scb-button/scb-button.js";import{closeManualPopover as z,closeManualPopoverAfterAnimations as H,isManualPopoverOpen as M,openManualPopover as L}from"../shared/manual-popover.js";import"../scb-options-menu/scb-options-menu.js";(function(){try{var h=typeof globalThis<"u"?globalThis:window;if(!h.__scb_ce_guard_installed__){h.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(t,i,n){try{customElements.get(t)||e(t,i,n)}catch(l){var s=String(l||"");if(s.indexOf("already been used")===-1&&s.indexOf("NotSupportedError")===-1)throw l}}}}catch{}})();var w,a=(w=class extends I{constructor(...e){super(...e),this.label="Dropdown",this.variant="filled",this.size=B["scb-dropdown"].size,this.open=!1,this.disabled=!1,this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this.menuGap="3",this.width=null,this.minWidth=null,this.maxWidth=null,this.dataIndex=null,this.ariaCurrent=null,this._slottedMenuEl=null,this._openSettledTimer=null,this._menuCloseTimer=null,this._panelResizeObserver=null,this._panelHeightSyncRaf=null,this._panelPlacementRaf=null,this._onViewportChange=()=>{this.open&&this._schedulePanelPlacement()},this._onDocumentClickBound=t=>{if(!this.open)return;const i=t.composedPath(),n=i.find(s=>s instanceof HTMLElement&&s.tagName.toLowerCase()==="scb-dropdown");if(n&&n!==this){this.open=!1;return}i.includes(this)||(this.open=!1)},this._onDocumentKeydownBound=t=>{this.open&&t.key==="Escape"&&(t.preventDefault(),t.stopPropagation(),this.open=!1,this.updateComplete.then(()=>this.focus({preventScroll:!0})))},this._onSlottedMenuOpen=()=>{this.open||(this.open=!0)},this._onSlottedMenuClose=()=>{this.open&&(this.open=!1)},this._onSlotChange=()=>{this._syncSlottedMenu(),this._applyPanelSizing(),this._applyInertByOpen(),this.requestUpdate()},this._onTriggerClick=t=>{this.hasAttribute("as-tab")||t.stopPropagation(),!this.disabled&&(this.open=!this.open)}}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._onDocumentClickBound,!0),document.addEventListener("keydown",this._onDocumentKeydownBound),window.addEventListener("resize",this._onViewportChange,{passive:!0}),window.addEventListener("scroll",this._onViewportChange,{passive:!0,capture:!0})}disconnectedCallback(){document.removeEventListener("click",this._onDocumentClickBound,!0),document.removeEventListener("keydown",this._onDocumentKeydownBound),window.removeEventListener("resize",this._onViewportChange),window.removeEventListener("scroll",this._onViewportChange,!0),this._detachSlottedMenuListeners(),z(this.renderRoot.querySelector(".panel")),this._panelResizeObserver&&(this._panelResizeObserver.disconnect(),this._panelResizeObserver=null),this._panelHeightSyncRaf!==null&&(window.cancelAnimationFrame(this._panelHeightSyncRaf),this._panelHeightSyncRaf=null),this._panelPlacementRaf!==null&&(window.cancelAnimationFrame(this._panelPlacementRaf),this._panelPlacementRaf=null),this._openSettledTimer!==null&&(window.clearTimeout(this._openSettledTimer),this._openSettledTimer=null),this._menuCloseTimer!==null&&(window.clearTimeout(this._menuCloseTimer),this._menuCloseTimer=null),super.disconnectedCallback()}firstUpdated(e){super.firstUpdated(e),this._syncSlottedMenu(),this._applyPanelVars(),this._applyPanelSizing(),this._applyChevronState(),this._applyInertByOpen(),this._setupPanelResizeObserver(),this._syncPanelMaxHeightByOpen(),this._syncOverflowVisibilityByOpen(),this._syncPanelPopover()}updated(e){super.updated(e),e.has("menuGap")&&this._applyPanelVars(),(e.has("width")||e.has("minWidth")||e.has("maxWidth"))&&this._applyPanelSizing(),(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom")||e.has("spacingLeft")||e.has("spacingRight"))&&this._applySpacing(),e.has("open")&&(this.open||this._closeAllSubMenus(),this._syncSlottedMenuOpen(),this._applyChevronState(),this._applyInertByOpen(),this._syncPanelMaxHeightByOpen(),this._syncOverflowVisibilityByOpen(),this._syncPanelPopover(),this.dispatchEvent(new CustomEvent("openchange",{bubbles:!0,composed:!0,detail:{open:this.open}})))}_applyPanelVars(){if(this.menuGap==null||String(this.menuGap).trim()===""){this.style.removeProperty("--scb-dropdown-panel-gap");return}this.style.setProperty("--scb-dropdown-panel-gap",this._mapSpacingToken(this.menuGap))}_applyPanelSizing(){const e=this.renderRoot.querySelector(".panel-surface");e&&(this.width&&String(this.width).trim()!==""?e.style.inlineSize=this.width:e.style.removeProperty("inline-size"),this.minWidth&&String(this.minWidth).trim()!==""?e.style.minInlineSize=this.minWidth:e.style.removeProperty("min-inline-size"),this.maxWidth&&String(this.maxWidth).trim()!==""?e.style.maxInlineSize=this.maxWidth:e.style.removeProperty("max-inline-size")),this._slottedMenuEl&&(this.width&&String(this.width).trim()!==""?this._slottedMenuEl.style.inlineSize=this.width:this._slottedMenuEl.style.removeProperty("inline-size"),this.minWidth&&String(this.minWidth).trim()!==""?this._slottedMenuEl.style.minInlineSize=this.minWidth:this._slottedMenuEl.style.removeProperty("min-inline-size"),this.maxWidth&&String(this.maxWidth).trim()!==""?this._slottedMenuEl.style.maxInlineSize=this.maxWidth:this._slottedMenuEl.style.removeProperty("max-inline-size")),this._schedulePanelHeightSync()}_setupPanelResizeObserver(){if(this._panelResizeObserver||typeof ResizeObserver>"u")return;const e=this._panelInnerEl;e&&(this._panelResizeObserver=new ResizeObserver(()=>{this._schedulePanelHeightSync()}),this._panelResizeObserver.observe(e))}_schedulePanelHeightSync(){this._panelHeightSyncRaf===null&&(this._panelHeightSyncRaf=window.requestAnimationFrame(()=>{this._panelHeightSyncRaf=null,this._syncPanelMaxHeightByOpen()}))}_schedulePanelPlacement(){this._panelPlacementRaf===null&&(this._panelPlacementRaf=window.requestAnimationFrame(()=>{this._panelPlacementRaf=null,this._positionPanelInViewport()}))}_syncPanelPopover(){const e=this.renderRoot.querySelector(".panel");if(!e)return;if(this.open){L(e)&&this._schedulePanelPlacement();return}const t=()=>{this._panelSurfaceEl?.style.removeProperty("--scb-dropdown-panel-viewport-max-height"),e.style.removeProperty("position"),e.style.removeProperty("left"),e.style.removeProperty("right"),e.style.removeProperty("top"),e.style.removeProperty("bottom"),e.style.removeProperty("width")};M(e)?H(e,t,this._panelSurfaceEl??e):(z(e),t())}_positionPanelInViewport(){const e=this.renderRoot.querySelector(".panel"),t=this._triggerEl;if(!e||!t||!M(e))return;const i=this._panelSurfaceEl,n=t.getBoundingClientRect(),s=i?.getBoundingClientRect(),l=8,c=Number.parseFloat(getComputedStyle(this).getPropertyValue("--scb-dropdown-panel-gap")),o=Number.isFinite(c)?c:8,p=Math.max(0,window.innerWidth-l*2),b=i?getComputedStyle(i):null,E=b?[b.paddingInlineStart,b.paddingInlineEnd].map(u=>Number.parseFloat(u)).filter(Number.isFinite).reduce((u,O)=>u+O,0):0,x=(this._panelInnerEl?.scrollWidth||0)+E,y=Number.parseFloat(b?.maxWidth??""),P=this.width?0:Math.min(x,Number.isFinite(y)?y:x),T=Math.max(s?.width||0,i?.scrollWidth||0,P,n.width),f=Math.min(Math.max(n.width,T),p),C=Math.min(Math.max(n.left,l),window.innerWidth-l-f);e.style.position="fixed",e.style.left=`${Math.round(C)}px`,e.style.right="auto",e.style.width=`${Math.round(f)}px`;const m=window.innerHeight-n.bottom-o-l,_=n.top-o-l,k=(i?.scrollHeight||s?.height||0)>m&&_>m,R=Math.max(0,k?_:m);i?.style.setProperty("--scb-dropdown-panel-viewport-max-height",`${Math.floor(R)}px`),k?(e.style.top="auto",e.style.bottom=`${Math.round(window.innerHeight-n.top+o)}px`):(e.style.top=`${Math.round(n.bottom+o)}px`,e.style.bottom="auto")}_syncPanelMaxHeightByOpen(){const e=this._panelSurfaceEl;if(!e)return;if(this._slottedMenuEl){e.style.removeProperty("--scb-dropdown-panel-current-max-height");return}if(!this.open){e.style.setProperty("--scb-dropdown-panel-current-max-height","0px");return}const t=this._panelInnerEl;if(!t)return;const i=getComputedStyle(e),n=(Number.parseFloat(i.paddingTop)||0)+(Number.parseFloat(i.paddingBottom)||0),s=`${Math.ceil(t.scrollHeight+n)}px`;e.style.getPropertyValue("--scb-dropdown-panel-current-max-height").trim()!==s&&(e.style.setProperty("--scb-dropdown-panel-current-max-height",s),this._schedulePanelPlacement())}_mapSpacingToken(e){const t=String(e).trim();return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}_mapHostSpacingToken(e){if(!e)return;const t=String(e).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}_applySpacing(){const e=this._mapHostSpacingToken(this.spacing),t=this._mapHostSpacingToken(this.spacingTop)??e,i=this._mapHostSpacingToken(this.spacingBottom)??e,n=this._mapHostSpacingToken(this.spacingLeft),s=this._mapHostSpacingToken(this.spacingRight);t?this.style.setProperty("--scb-dropdown-spacing-block-start",t):this.style.removeProperty("--scb-dropdown-spacing-block-start"),i?this.style.setProperty("--scb-dropdown-spacing-block-end",i):this.style.removeProperty("--scb-dropdown-spacing-block-end"),n?this.style.setProperty("--scb-dropdown-spacing-inline-start",n):this.style.removeProperty("--scb-dropdown-spacing-inline-start"),s?this.style.setProperty("--scb-dropdown-spacing-inline-end",s):this.style.removeProperty("--scb-dropdown-spacing-inline-end")}_syncSlottedMenu(){const e=(this._slotEl?.assignedElements({flatten:!0})??[]).find(t=>t.tagName.toLowerCase()==="scb-options-menu");if(e===this._slottedMenuEl){this._syncSlottedMenuOpen();return}this._detachSlottedMenuListeners(),this._slottedMenuEl=e??null,this._slottedMenuEl&&(this._slottedMenuEl.addEventListener("open",this._onSlottedMenuOpen),this._slottedMenuEl.addEventListener("close",this._onSlottedMenuClose),this._syncSlottedMenuOpen())}_detachSlottedMenuListeners(){this._slottedMenuEl&&(this._slottedMenuEl.removeEventListener("open",this._onSlottedMenuOpen),this._slottedMenuEl.removeEventListener("close",this._onSlottedMenuClose))}_syncSlottedMenuOpen(){if(!this._slottedMenuEl)return;if(this._menuCloseTimer!==null&&(window.clearTimeout(this._menuCloseTimer),this._menuCloseTimer=null),this.open){this._slottedMenuEl.open=!0;return}const e=this._getPanelTransitionMs();if(e<=0){this._slottedMenuEl.open=!1;return}this._menuCloseTimer=window.setTimeout(()=>{this._menuCloseTimer=null,!this.open&&this._slottedMenuEl&&(this._slottedMenuEl.open=!1)},e)}_syncOverflowVisibilityByOpen(){if(this._openSettledTimer!==null&&(window.clearTimeout(this._openSettledTimer),this._openSettledTimer=null),this.removeAttribute("data-open-settled"),!this.open)return;const e=this.renderRoot.querySelector(".panel-surface");if(!e){this.setAttribute("data-open-settled","");return}const t=this._getTransitionMs(e);if(t<=0){this.setAttribute("data-open-settled","");return}this._openSettledTimer=window.setTimeout(()=>{this._openSettledTimer=null,this.open&&this.setAttribute("data-open-settled","")},t)}_getPanelTransitionMs(){const e=this.renderRoot.querySelector(".panel-surface");return e?this._getTransitionMs(e):0}_getTransitionMs(e){const t=getComputedStyle(e),i=t.transitionDuration.split(",").map(o=>o.trim()),n=t.transitionDelay.split(",").map(o=>o.trim()),s=o=>{const p=parseFloat(o);return Number.isFinite(p)?o.endsWith("ms")?p:o.endsWith("s")?p*1e3:p:0},l=Math.max(i.length,n.length);let c=0;for(let o=0;o<l;o+=1){const p=s(i[o]??i[i.length-1]??"0s"),b=s(n[o]??n[n.length-1]??"0s");c=Math.max(c,p+b)}return Math.ceil(c)}_applyInertByOpen(){const e=this.renderRoot.querySelector(".panel");e&&(this.open?(e.removeAttribute("inert"),e.setAttribute("aria-hidden","false"),this._restoreTabIndexesIfNeeded()):(e.setAttribute("inert",""),e.setAttribute("aria-hidden","true"),this._removeTabIndexesIfNeeded()))}_supportsInert(){return"inert"in HTMLElement.prototype}_collectFocusableFromSlot(){const e=this._slotEl;if(!e)return[];const t=e.assignedElements({flatten:!0}),i=[],n=s=>{s instanceof HTMLElement&&s.matches("a,button,input,select,textarea,[tabindex]")&&i.push(s)};return t.forEach(s=>{n(s),s.querySelectorAll?.("a,button,input,select,textarea,[tabindex]").forEach(l=>n(l))}),i}_removeTabIndexesIfNeeded(){this._supportsInert()||this._collectFocusableFromSlot().forEach(e=>{const t=e.getAttribute("tabindex");t!==null&&e.setAttribute("data-scb-prev-tabindex",t),e.setAttribute("tabindex","-1")})}_restoreTabIndexesIfNeeded(){this._supportsInert()||this._collectFocusableFromSlot().forEach(e=>{const t=e.getAttribute("data-scb-prev-tabindex");t!==null?(e.setAttribute("tabindex",t),e.removeAttribute("data-scb-prev-tabindex")):e.removeAttribute("tabindex")})}_closeAllSubMenus(){const e=this.querySelectorAll("scb-options-sub-menu");for(const t of e)t.removeAttribute("open")}focus(e){const t=this._triggerEl;if(t?.focus){t.focus(e);return}super.focus(e)}_applyChevronState(){if(this.hasAttribute("as-tab"))return;const e=this._ensureTriggerChevronEl();e&&(e.open=this.open)}_ensureTriggerChevronEl(){const e=this._triggerEl;if(e?.tagName?.toLowerCase?.()!=="scb-button")return null;const t=e?.shadowRoot;if(!t)return null;const i=t.querySelector('scb-chevron[slot="icon"]');if(i)return i;const n=t.querySelector('md-icon[slot="icon"]')??t.querySelector("md-icon");if(!n)return null;const s=document.createElement("scb-chevron");s.setAttribute("slot","icon"),s.setAttribute("aria-hidden","true"),s.classList.add("chevron");const l=getComputedStyle(n).fontSize;return l&&s.style.setProperty("--scb-chevron-size",l),n.replaceWith(s),s}render(){const e=!!this._slottedMenuEl,t=this.hasAttribute("as-tab"),i=this.dataIndex,n=this.ariaCurrent==="page"?"page":S;return v`
1
+ import{d as g,g as S,h as I,m as A,p as d,v,y as W}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/icon.js";import{n as $}from"../../vendor/lazy-focus-ring.js";import{t as B}from"../../vendor/component-defaults.js";import{t as r}from"../../vendor/decorate.js";import"../../vendor/scb-chevron.js";import"../scb-button/scb-button.js";import{a as H,i as z,n as L,t as M}from"../../vendor/manual-popover.js";import"../scb-options-menu/scb-options-menu.js";(function(){try{var h=typeof globalThis<"u"?globalThis:window;if(!h.__scb_ce_guard_installed__){h.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(t,i,n){try{customElements.get(t)||e(t,i,n)}catch(l){var s=String(l||"");if(s.indexOf("already been used")===-1&&s.indexOf("NotSupportedError")===-1)throw l}}}}catch{}})();var w,a=(w=class extends I{constructor(...e){super(...e),this.label="Dropdown",this.variant="filled",this.size=B["scb-dropdown"].size,this.open=!1,this.disabled=!1,this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this.menuGap="3",this.width=null,this.minWidth=null,this.maxWidth=null,this.dataIndex=null,this.ariaCurrent=null,this._slottedMenuEl=null,this._openSettledTimer=null,this._menuCloseTimer=null,this._panelResizeObserver=null,this._panelHeightSyncRaf=null,this._panelPlacementRaf=null,this._onViewportChange=()=>{this.open&&this._schedulePanelPlacement()},this._onDocumentClickBound=t=>{if(!this.open)return;const i=t.composedPath(),n=i.find(s=>s instanceof HTMLElement&&s.tagName.toLowerCase()==="scb-dropdown");if(n&&n!==this){this.open=!1;return}i.includes(this)||(this.open=!1)},this._onDocumentKeydownBound=t=>{this.open&&t.key==="Escape"&&(t.preventDefault(),t.stopPropagation(),this.open=!1,this.updateComplete.then(()=>this.focus({preventScroll:!0})))},this._onSlottedMenuOpen=()=>{this.open||(this.open=!0)},this._onSlottedMenuClose=()=>{this.open&&(this.open=!1)},this._onSlotChange=()=>{this._syncSlottedMenu(),this._applyPanelSizing(),this._applyInertByOpen(),this.requestUpdate()},this._onTriggerClick=t=>{this.hasAttribute("as-tab")||t.stopPropagation(),!this.disabled&&(this.open=!this.open)}}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._onDocumentClickBound,!0),document.addEventListener("keydown",this._onDocumentKeydownBound),window.addEventListener("resize",this._onViewportChange,{passive:!0}),window.addEventListener("scroll",this._onViewportChange,{passive:!0,capture:!0})}disconnectedCallback(){document.removeEventListener("click",this._onDocumentClickBound,!0),document.removeEventListener("keydown",this._onDocumentKeydownBound),window.removeEventListener("resize",this._onViewportChange),window.removeEventListener("scroll",this._onViewportChange,!0),this._detachSlottedMenuListeners(),M(this.renderRoot.querySelector(".panel")),this._panelResizeObserver&&(this._panelResizeObserver.disconnect(),this._panelResizeObserver=null),this._panelHeightSyncRaf!==null&&(window.cancelAnimationFrame(this._panelHeightSyncRaf),this._panelHeightSyncRaf=null),this._panelPlacementRaf!==null&&(window.cancelAnimationFrame(this._panelPlacementRaf),this._panelPlacementRaf=null),this._openSettledTimer!==null&&(window.clearTimeout(this._openSettledTimer),this._openSettledTimer=null),this._menuCloseTimer!==null&&(window.clearTimeout(this._menuCloseTimer),this._menuCloseTimer=null),super.disconnectedCallback()}firstUpdated(e){super.firstUpdated(e),this._syncSlottedMenu(),this._applyPanelVars(),this._applyPanelSizing(),this._applyChevronState(),this._applyInertByOpen(),this._setupPanelResizeObserver(),this._syncPanelMaxHeightByOpen(),this._syncOverflowVisibilityByOpen(),this._syncPanelPopover()}updated(e){super.updated(e),e.has("menuGap")&&this._applyPanelVars(),(e.has("width")||e.has("minWidth")||e.has("maxWidth"))&&this._applyPanelSizing(),(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom")||e.has("spacingLeft")||e.has("spacingRight"))&&this._applySpacing(),e.has("open")&&(this.open||this._closeAllSubMenus(),this._syncSlottedMenuOpen(),this._applyChevronState(),this._applyInertByOpen(),this._syncPanelMaxHeightByOpen(),this._syncOverflowVisibilityByOpen(),this._syncPanelPopover(),this.dispatchEvent(new CustomEvent("openchange",{bubbles:!0,composed:!0,detail:{open:this.open}})))}_applyPanelVars(){if(this.menuGap==null||String(this.menuGap).trim()===""){this.style.removeProperty("--scb-dropdown-panel-gap");return}this.style.setProperty("--scb-dropdown-panel-gap",this._mapSpacingToken(this.menuGap))}_applyPanelSizing(){const e=this.renderRoot.querySelector(".panel-surface");e&&(this.width&&String(this.width).trim()!==""?e.style.inlineSize=this.width:e.style.removeProperty("inline-size"),this.minWidth&&String(this.minWidth).trim()!==""?e.style.minInlineSize=this.minWidth:e.style.removeProperty("min-inline-size"),this.maxWidth&&String(this.maxWidth).trim()!==""?e.style.maxInlineSize=this.maxWidth:e.style.removeProperty("max-inline-size")),this._slottedMenuEl&&(this.width&&String(this.width).trim()!==""?this._slottedMenuEl.style.inlineSize=this.width:this._slottedMenuEl.style.removeProperty("inline-size"),this.minWidth&&String(this.minWidth).trim()!==""?this._slottedMenuEl.style.minInlineSize=this.minWidth:this._slottedMenuEl.style.removeProperty("min-inline-size"),this.maxWidth&&String(this.maxWidth).trim()!==""?this._slottedMenuEl.style.maxInlineSize=this.maxWidth:this._slottedMenuEl.style.removeProperty("max-inline-size")),this._schedulePanelHeightSync()}_setupPanelResizeObserver(){if(this._panelResizeObserver||typeof ResizeObserver>"u")return;const e=this._panelInnerEl;e&&(this._panelResizeObserver=new ResizeObserver(()=>{this._schedulePanelHeightSync()}),this._panelResizeObserver.observe(e))}_schedulePanelHeightSync(){this._panelHeightSyncRaf===null&&(this._panelHeightSyncRaf=window.requestAnimationFrame(()=>{this._panelHeightSyncRaf=null,this._syncPanelMaxHeightByOpen()}))}_schedulePanelPlacement(){this._panelPlacementRaf===null&&(this._panelPlacementRaf=window.requestAnimationFrame(()=>{this._panelPlacementRaf=null,this._positionPanelInViewport()}))}_syncPanelPopover(){const e=this.renderRoot.querySelector(".panel");if(!e)return;if(this.open){H(e)&&this._schedulePanelPlacement();return}const t=()=>{this._panelSurfaceEl?.style.removeProperty("--scb-dropdown-panel-viewport-max-height"),e.style.removeProperty("position"),e.style.removeProperty("left"),e.style.removeProperty("right"),e.style.removeProperty("top"),e.style.removeProperty("bottom"),e.style.removeProperty("width")};z(e)?L(e,t,this._panelSurfaceEl??e):(M(e),t())}_positionPanelInViewport(){const e=this.renderRoot.querySelector(".panel"),t=this._triggerEl;if(!e||!t||!z(e))return;const i=this._panelSurfaceEl,n=t.getBoundingClientRect(),s=i?.getBoundingClientRect(),l=8,c=Number.parseFloat(getComputedStyle(this).getPropertyValue("--scb-dropdown-panel-gap")),o=Number.isFinite(c)?c:8,p=Math.max(0,window.innerWidth-l*2),b=i?getComputedStyle(i):null,E=b?[b.paddingInlineStart,b.paddingInlineEnd].map(u=>Number.parseFloat(u)).filter(Number.isFinite).reduce((u,O)=>u+O,0):0,x=(this._panelInnerEl?.scrollWidth||0)+E,y=Number.parseFloat(b?.maxWidth??""),P=this.width?0:Math.min(x,Number.isFinite(y)?y:x),T=Math.max(s?.width||0,i?.scrollWidth||0,P,n.width),f=Math.min(Math.max(n.width,T),p),C=Math.min(Math.max(n.left,l),window.innerWidth-l-f);e.style.position="fixed",e.style.left=`${Math.round(C)}px`,e.style.right="auto",e.style.width=`${Math.round(f)}px`;const m=window.innerHeight-n.bottom-o-l,_=n.top-o-l,k=(i?.scrollHeight||s?.height||0)>m&&_>m,R=Math.max(0,k?_:m);i?.style.setProperty("--scb-dropdown-panel-viewport-max-height",`${Math.floor(R)}px`),k?(e.style.top="auto",e.style.bottom=`${Math.round(window.innerHeight-n.top+o)}px`):(e.style.top=`${Math.round(n.bottom+o)}px`,e.style.bottom="auto")}_syncPanelMaxHeightByOpen(){const e=this._panelSurfaceEl;if(!e)return;if(this._slottedMenuEl){e.style.removeProperty("--scb-dropdown-panel-current-max-height");return}if(!this.open){e.style.setProperty("--scb-dropdown-panel-current-max-height","0px");return}const t=this._panelInnerEl;if(!t)return;const i=getComputedStyle(e),n=(Number.parseFloat(i.paddingTop)||0)+(Number.parseFloat(i.paddingBottom)||0),s=`${Math.ceil(t.scrollHeight+n)}px`;e.style.getPropertyValue("--scb-dropdown-panel-current-max-height").trim()!==s&&(e.style.setProperty("--scb-dropdown-panel-current-max-height",s),this._schedulePanelPlacement())}_mapSpacingToken(e){const t=String(e).trim();return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}_mapHostSpacingToken(e){if(!e)return;const t=String(e).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}_applySpacing(){const e=this._mapHostSpacingToken(this.spacing),t=this._mapHostSpacingToken(this.spacingTop)??e,i=this._mapHostSpacingToken(this.spacingBottom)??e,n=this._mapHostSpacingToken(this.spacingLeft),s=this._mapHostSpacingToken(this.spacingRight);t?this.style.setProperty("--scb-dropdown-spacing-block-start",t):this.style.removeProperty("--scb-dropdown-spacing-block-start"),i?this.style.setProperty("--scb-dropdown-spacing-block-end",i):this.style.removeProperty("--scb-dropdown-spacing-block-end"),n?this.style.setProperty("--scb-dropdown-spacing-inline-start",n):this.style.removeProperty("--scb-dropdown-spacing-inline-start"),s?this.style.setProperty("--scb-dropdown-spacing-inline-end",s):this.style.removeProperty("--scb-dropdown-spacing-inline-end")}_syncSlottedMenu(){const e=(this._slotEl?.assignedElements({flatten:!0})??[]).find(t=>t.tagName.toLowerCase()==="scb-options-menu");if(e===this._slottedMenuEl){this._syncSlottedMenuOpen();return}this._detachSlottedMenuListeners(),this._slottedMenuEl=e??null,this._slottedMenuEl&&(this._slottedMenuEl.addEventListener("open",this._onSlottedMenuOpen),this._slottedMenuEl.addEventListener("close",this._onSlottedMenuClose),this._syncSlottedMenuOpen())}_detachSlottedMenuListeners(){this._slottedMenuEl&&(this._slottedMenuEl.removeEventListener("open",this._onSlottedMenuOpen),this._slottedMenuEl.removeEventListener("close",this._onSlottedMenuClose))}_syncSlottedMenuOpen(){if(!this._slottedMenuEl)return;if(this._menuCloseTimer!==null&&(window.clearTimeout(this._menuCloseTimer),this._menuCloseTimer=null),this.open){this._slottedMenuEl.open=!0;return}const e=this._getPanelTransitionMs();if(e<=0){this._slottedMenuEl.open=!1;return}this._menuCloseTimer=window.setTimeout(()=>{this._menuCloseTimer=null,!this.open&&this._slottedMenuEl&&(this._slottedMenuEl.open=!1)},e)}_syncOverflowVisibilityByOpen(){if(this._openSettledTimer!==null&&(window.clearTimeout(this._openSettledTimer),this._openSettledTimer=null),this.removeAttribute("data-open-settled"),!this.open)return;const e=this.renderRoot.querySelector(".panel-surface");if(!e){this.setAttribute("data-open-settled","");return}const t=this._getTransitionMs(e);if(t<=0){this.setAttribute("data-open-settled","");return}this._openSettledTimer=window.setTimeout(()=>{this._openSettledTimer=null,this.open&&this.setAttribute("data-open-settled","")},t)}_getPanelTransitionMs(){const e=this.renderRoot.querySelector(".panel-surface");return e?this._getTransitionMs(e):0}_getTransitionMs(e){const t=getComputedStyle(e),i=t.transitionDuration.split(",").map(o=>o.trim()),n=t.transitionDelay.split(",").map(o=>o.trim()),s=o=>{const p=parseFloat(o);return Number.isFinite(p)?o.endsWith("ms")?p:o.endsWith("s")?p*1e3:p:0},l=Math.max(i.length,n.length);let c=0;for(let o=0;o<l;o+=1){const p=s(i[o]??i[i.length-1]??"0s"),b=s(n[o]??n[n.length-1]??"0s");c=Math.max(c,p+b)}return Math.ceil(c)}_applyInertByOpen(){const e=this.renderRoot.querySelector(".panel");e&&(this.open?(e.removeAttribute("inert"),e.setAttribute("aria-hidden","false"),this._restoreTabIndexesIfNeeded()):(e.setAttribute("inert",""),e.setAttribute("aria-hidden","true"),this._removeTabIndexesIfNeeded()))}_supportsInert(){return"inert"in HTMLElement.prototype}_collectFocusableFromSlot(){const e=this._slotEl;if(!e)return[];const t=e.assignedElements({flatten:!0}),i=[],n=s=>{s instanceof HTMLElement&&s.matches("a,button,input,select,textarea,[tabindex]")&&i.push(s)};return t.forEach(s=>{n(s),s.querySelectorAll?.("a,button,input,select,textarea,[tabindex]").forEach(l=>n(l))}),i}_removeTabIndexesIfNeeded(){this._supportsInert()||this._collectFocusableFromSlot().forEach(e=>{const t=e.getAttribute("tabindex");t!==null&&e.setAttribute("data-scb-prev-tabindex",t),e.setAttribute("tabindex","-1")})}_restoreTabIndexesIfNeeded(){this._supportsInert()||this._collectFocusableFromSlot().forEach(e=>{const t=e.getAttribute("data-scb-prev-tabindex");t!==null?(e.setAttribute("tabindex",t),e.removeAttribute("data-scb-prev-tabindex")):e.removeAttribute("tabindex")})}_closeAllSubMenus(){const e=this.querySelectorAll("scb-options-sub-menu");for(const t of e)t.removeAttribute("open")}focus(e){const t=this._triggerEl;if(t?.focus){t.focus(e);return}super.focus(e)}_applyChevronState(){if(this.hasAttribute("as-tab"))return;const e=this._ensureTriggerChevronEl();e&&(e.open=this.open)}_ensureTriggerChevronEl(){const e=this._triggerEl;if(e?.tagName?.toLowerCase?.()!=="scb-button")return null;const t=e?.shadowRoot;if(!t)return null;const i=t.querySelector('scb-chevron[slot="icon"]');if(i)return i;const n=t.querySelector('md-icon[slot="icon"]')??t.querySelector("md-icon");if(!n)return null;const s=document.createElement("scb-chevron");s.setAttribute("slot","icon"),s.setAttribute("aria-hidden","true"),s.classList.add("chevron");const l=getComputedStyle(n).fontSize;return l&&s.style.setProperty("--scb-chevron-size",l),n.replaceWith(s),s}render(){const e=!!this._slottedMenuEl,t=this.hasAttribute("as-tab"),i=this.dataIndex,n=this.ariaCurrent==="page"?"page":S;return v`
2
2
  ${t?v`
3
3
  <div class="tab-wrap">
4
4
  <button
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../../vendor/icon.js","../../vendor/rolldown-runtime.js","../../vendor/vendor.js","../../vendor/vendor-lit.js"])))=>i.map(i=>d[i]);
2
- import{f,h as v,m,p as s,v as p,y}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as _}from"../../vendor/preload-helper.js";import{componentSizeToken as k}from"../shared/component-size-token.js";import{t as r}from"../../vendor/decorate.js";import{t as h}from"../../vendor/assertClassBrand.js";import{t as w}from"../../vendor/classPrivateMethodInitSpec.js";import"../scb-icon-button/scb-icon-button.js";import"../scb-link/scb-link.js";import"./scb-fact-card-content.js";(function(){try{var c=typeof globalThis<"u"?globalThis:window;if(!c.__scb_ce_guard_installed__){c.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(e,n,d){try{customElements.get(e)||t(e,n,d)}catch(g){var o=String(g||"");if(o.indexOf("already been used")===-1&&o.indexOf("NotSupportedError")===-1)throw g}}}}catch{}})();var b,l,i,x={fromAttribute:c=>c??"",toAttribute:c=>typeof c!="string"||c.trim()===""?null:c},a=(b=new WeakSet,l=class extends v{constructor(...t){super(...t),w(this,b),this.__onCloseClick=e=>{e.stopPropagation(),this.__setOpen(!1)},this.variant="filled",this.title="",this.subtitle="",this.supportingText="",this.icon="",this.showCloseButton=!1,this.closeLabel="Stäng faktakort",this.__hasIconSlot=!1,this.open=!0,this.__lastTriggerEl=null,this.sizing="",this.width="",this.maxWidth="",this.height="",this.maxHeight="",this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this.__onIconSlotChange=()=>{const e=this.renderRoot.querySelector('slot[name="icon"]');this.__hasIconSlot=!!e?.assignedNodes({flatten:!0}).some(n=>n.nodeType===Node.TEXT_NODE?!!n.textContent?.trim():!0)}}static __handleDocClick(t){const e=t.composedPath();for(const n of e){if(!(n instanceof Element))continue;const d=n.getAttribute("data-fact-card-toggle")||n.getAttribute("aria-controls");if(!d)continue;const o=i.__instances.get(d);if(!o){i.__instances.delete(d);continue}o.__lastTriggerEl=n,o.__setOpen(!o.open);break}}static __ensureDocListener(){i.__docListenerAttached||(document.addEventListener("click",i.__handleDocClick,!0),i.__docListenerAttached=!0)}static __maybeRemoveDocListener(){i.__docListenerAttached&&i.__instances.size===0&&(document.removeEventListener("click",i.__handleDocClick,!0),i.__docListenerAttached=!1)}connectedCallback(){super.connectedCallback(),this.id&&i.__instances.set(this.id,this),i.__ensureDocListener()}disconnectedCallback(){this.id&&i.__instances.delete(this.id),i.__maybeRemoveDocListener(),super.disconnectedCallback()}updated(t){t.has("open")&&this.__updateTriggersExpanded(),t.has("width")&&(this.width?this.style.inlineSize=this.width:this.style.removeProperty("inline-size")),t.has("maxWidth")&&(this.maxWidth?this.style.maxInlineSize=this.maxWidth:this.style.removeProperty("max-inline-size")),t.has("height")&&(this.height?this.style.blockSize=this.height:this.style.removeProperty("block-size")),t.has("maxHeight")&&(this.maxHeight?this.style.maxBlockSize=this.maxHeight:this.style.removeProperty("max-block-size")),(t.has("spacing")||t.has("spacingTop")||t.has("spacingBottom")||t.has("spacingLeft")||t.has("spacingRight"))&&h(b,this,u).call(this)}__updateTriggersExpanded(){this.id&&document.querySelectorAll(`[aria-controls="${this.id}"], [data-fact-card-toggle="${this.id}"]`).forEach(t=>{t.hasAttribute("aria-controls")&&t.setAttribute("aria-expanded",String(this.open))})}__setOpen(t){const e=this.open;e!==t&&(this.open=t,this.dispatchEvent(new CustomEvent("openchange",{bubbles:!0,composed:!0,detail:{open:this.open}})),t&&!e?this.dispatchEvent(new CustomEvent("open",{bubbles:!0,composed:!0})):!t&&e&&this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0})))}render(){if(!this.open)return p``;const t=this.variant==="outlined"?"outlined":"filled",e=!!this.icon||this.__hasIconSlot||this.__hasLightDomSlot("icon");return p`
2
+ import{f,h as v,m,p as s,v as p,y}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as _}from"../../vendor/preload-helper.js";import{t as k}from"../../vendor/component-size-token.js";import{t as r}from"../../vendor/decorate.js";import{t as h}from"../../vendor/assertClassBrand.js";import{t as w}from"../../vendor/classPrivateMethodInitSpec.js";import"../scb-icon-button/scb-icon-button.js";import"../scb-link/scb-link.js";import"./scb-fact-card-content.js";(function(){try{var c=typeof globalThis<"u"?globalThis:window;if(!c.__scb_ce_guard_installed__){c.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(e,n,d){try{customElements.get(e)||t(e,n,d)}catch(g){var o=String(g||"");if(o.indexOf("already been used")===-1&&o.indexOf("NotSupportedError")===-1)throw g}}}}catch{}})();var b,l,i,x={fromAttribute:c=>c??"",toAttribute:c=>typeof c!="string"||c.trim()===""?null:c},a=(b=new WeakSet,l=class extends v{constructor(...t){super(...t),w(this,b),this.__onCloseClick=e=>{e.stopPropagation(),this.__setOpen(!1)},this.variant="filled",this.title="",this.subtitle="",this.supportingText="",this.icon="",this.showCloseButton=!1,this.closeLabel="Stäng faktakort",this.__hasIconSlot=!1,this.open=!0,this.__lastTriggerEl=null,this.sizing="",this.width="",this.maxWidth="",this.height="",this.maxHeight="",this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this.__onIconSlotChange=()=>{const e=this.renderRoot.querySelector('slot[name="icon"]');this.__hasIconSlot=!!e?.assignedNodes({flatten:!0}).some(n=>n.nodeType===Node.TEXT_NODE?!!n.textContent?.trim():!0)}}static __handleDocClick(t){const e=t.composedPath();for(const n of e){if(!(n instanceof Element))continue;const d=n.getAttribute("data-fact-card-toggle")||n.getAttribute("aria-controls");if(!d)continue;const o=i.__instances.get(d);if(!o){i.__instances.delete(d);continue}o.__lastTriggerEl=n,o.__setOpen(!o.open);break}}static __ensureDocListener(){i.__docListenerAttached||(document.addEventListener("click",i.__handleDocClick,!0),i.__docListenerAttached=!0)}static __maybeRemoveDocListener(){i.__docListenerAttached&&i.__instances.size===0&&(document.removeEventListener("click",i.__handleDocClick,!0),i.__docListenerAttached=!1)}connectedCallback(){super.connectedCallback(),this.id&&i.__instances.set(this.id,this),i.__ensureDocListener()}disconnectedCallback(){this.id&&i.__instances.delete(this.id),i.__maybeRemoveDocListener(),super.disconnectedCallback()}updated(t){t.has("open")&&this.__updateTriggersExpanded(),t.has("width")&&(this.width?this.style.inlineSize=this.width:this.style.removeProperty("inline-size")),t.has("maxWidth")&&(this.maxWidth?this.style.maxInlineSize=this.maxWidth:this.style.removeProperty("max-inline-size")),t.has("height")&&(this.height?this.style.blockSize=this.height:this.style.removeProperty("block-size")),t.has("maxHeight")&&(this.maxHeight?this.style.maxBlockSize=this.maxHeight:this.style.removeProperty("max-block-size")),(t.has("spacing")||t.has("spacingTop")||t.has("spacingBottom")||t.has("spacingLeft")||t.has("spacingRight"))&&h(b,this,u).call(this)}__updateTriggersExpanded(){this.id&&document.querySelectorAll(`[aria-controls="${this.id}"], [data-fact-card-toggle="${this.id}"]`).forEach(t=>{t.hasAttribute("aria-controls")&&t.setAttribute("aria-expanded",String(this.open))})}__setOpen(t){const e=this.open;e!==t&&(this.open=t,this.dispatchEvent(new CustomEvent("openchange",{bubbles:!0,composed:!0,detail:{open:this.open}})),t&&!e?this.dispatchEvent(new CustomEvent("open",{bubbles:!0,composed:!0})):!t&&e&&this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0})))}render(){if(!this.open)return p``;const t=this.variant==="outlined"?"outlined":"filled",e=!!this.icon||this.__hasIconSlot||this.__hasLightDomSlot("icon");return p`
3
3
  <div class="outer ${e?"has-icon":""}">
4
4
  <div class="icon-wrapper ${t}" ?hidden=${!e}>
5
5
  <slot name="icon" @slotchange=${this.__onIconSlotChange}>
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../shared/lazy-focus-ring.js","../../vendor/preload-helper.js","../scb-drawer/scb-drawer.js","../../vendor/vendor.js","../../vendor/vendor-lit.js","../../vendor/decorate.js","../shared/manual-popover.js","../scb-divider/scb-divider.js","../../vendor/assertClassBrand.js","../../vendor/classPrivateMethodInitSpec.js","../scb-menu/scb-menu.js","../scb-menu/scb-menu-item.js","../scb-chevron/scb-chevron.js","../scb-menu/scb-menu-section.js","../scb-menu/scb-sub-menu.js","../scb-search/scb-search.js","../../vendor/icon.js","../../vendor/rolldown-runtime.js","../../vendor/ripple.js","../../vendor/attachable-controller.js","../shared/component-size-token.js","../../vendor/component-defaults.js","../../vendor/scb-header-drawer.internal.js","../scb-button/scb-button.js","../scb-icon-button/scb-icon-button.js","../scb-skeleton/scb-skeleton.js","../scb-grid/scb-grid.js","../scb-grid/scb-grid-item.js","../scb-grid/scb-stack.js","../scb-dropdown/scb-dropdown.js","../scb-options-menu/scb-options-menu.js","../scb-options-menu/scb-options-menu-item.js","../scb-options-menu/scb-options-sub-menu.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../../vendor/lazy-focus-ring.js","../../vendor/rolldown-runtime.js","../../vendor/preload-helper.js","../scb-drawer/scb-drawer.js","../../vendor/vendor.js","../../vendor/vendor-lit.js","../../vendor/decorate.js","../../vendor/manual-popover.js","../scb-divider/scb-divider.js","../../vendor/assertClassBrand.js","../../vendor/classPrivateMethodInitSpec.js","../scb-menu/scb-menu.js","../scb-menu/scb-menu-item.js","../../vendor/scb-chevron.js","../scb-menu/scb-menu-section.js","../scb-menu/scb-sub-menu.js","../scb-search/scb-search.js","../../vendor/icon.js","../../vendor/ripple.js","../../vendor/attachable-controller.js","../../vendor/component-size-token.js","../../vendor/component-defaults.js","../../vendor/scb-header-drawer.internal.js","../scb-button/scb-button.js","../scb-icon-button/scb-icon-button.js","../scb-skeleton/scb-skeleton.js","../scb-grid/scb-grid.js","../scb-grid/scb-grid-item.js","../scb-grid/scb-stack.js","../scb-dropdown/scb-dropdown.js","../scb-options-menu/scb-options-menu.js","../scb-options-menu/scb-options-menu-item.js","../scb-options-menu/scb-options-sub-menu.js"])))=>i.map(i=>d[i]);
2
2
  import{f as _,g as w,h as R,m as N,p as l,v,y as O}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as S}from"../../vendor/preload-helper.js";import{t as B}from"../../vendor/component-defaults.js";import{t as c}from"../../vendor/decorate.js";(function(){try{var u=typeof globalThis<"u"?globalThis:window;if(!u.__scb_ce_guard_installed__){u.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(t,a,r){try{customElements.get(t)||e(t,a,r)}catch(o){var s=String(o||"");if(s.indexOf("already been used")===-1&&s.indexOf("NotSupportedError")===-1)throw o}}}}catch{}})();var C,T,H=0,I=[0,2,4,8,12,16,20,24,32,40,48,64,80,96,120],W=()=>{if(typeof window>"u"||typeof document>"u"||!("customElements"in window)||document.head.querySelector("style[data-scb-header-pre-upgrade]"))return;const u=document.createElement("style");u.setAttribute("data-scb-header-pre-upgrade",""),u.textContent=`
3
3
  scb-header:not(:defined),
4
4
  scb-header[data-upgrading] {
@@ -52,7 +52,7 @@ import{f as _,g as w,h as R,m as N,p as l,v,y as O}from"../../vendor/vendor.js";
52
52
  );
53
53
  }
54
54
  }
55
- `,document.head.appendChild(u);const e=n=>{const g=String(n??"").trim();if(g){if(/^\d+$/.test(g)){const b=Math.max(0,Math.min(14,parseInt(g,10)));return`var(--spacing-${b}, ${I[b]}px)`}return g}},t=n=>{const g=String(n??"").trim();if(!g)return!1;try{const b=JSON.parse(g);return Array.isArray(b)&&b.length>0}catch{return!1}},a=n=>n!=null&&!/^(false|0|off|no)$/i.test(n.trim()),r=n=>{for(const g of Array.from(n.children)){const b=g.tagName.toLowerCase();if(b==="scb-header-tab"||b==="scb-dropdown")return!0}return!1},s=n=>{r(n)||t(n.getAttribute("tabs"))||a(n.getAttribute("reserve-tabs"))||a(n.getAttribute("layout-pending"))?n.setAttribute("data-pre-has-tabs",""):n.removeAttribute("data-pre-has-tabs");const g=e(n.getAttribute("spacing")),b=e(n.getAttribute("spacing-top"))??g,y=e(n.getAttribute("spacing-bottom"))??g,x=e(n.getAttribute("padding-inline")),k=e(n.getAttribute("padding-inline-expanded"))??x;b?n.style.setProperty("--scb-header-spacing-block-start",b):n.style.removeProperty("--scb-header-spacing-block-start"),y?n.style.setProperty("--scb-header-spacing-block-end",y):n.style.removeProperty("--scb-header-spacing-block-end"),x?n.style.setProperty("--scb-header-padding-inline",x):n.style.removeProperty("--scb-header-padding-inline"),k?n.style.setProperty("--scb-header-padding-inline-expanded",k):n.style.removeProperty("--scb-header-padding-inline-expanded");const d=(n.getAttribute("logo-width")??"").trim();d?n.style.setProperty("--scb-header-pre-logo-w",d):n.style.removeProperty("--scb-header-pre-logo-w");const f=(n.getAttribute("logo-height")??"").trim();f?n.style.setProperty("--scb-header-pre-logo-img-h",f):n.style.removeProperty("--scb-header-pre-logo-img-h");const m=(n.getAttribute("search-height")??"").trim();m?n.style.setProperty("--scb-header-pre-control-size",m):n.style.removeProperty("--scb-header-pre-control-size")};document.querySelectorAll("scb-header").forEach(s);const h=new MutationObserver(n=>{for(const g of n){if(g.type==="attributes"){const b=g.target;b instanceof HTMLElement&&b.tagName.toLowerCase()==="scb-header"&&s(b);continue}if(g.type==="childList"){const b=[...Array.from(g.addedNodes),...Array.from(g.removedNodes)];for(const y of b){if(!(y instanceof HTMLElement))continue;if(y.tagName.toLowerCase()==="scb-header"){s(y);continue}const x=y.closest?.("scb-header");x&&s(x)}}}});h.observe(document.documentElement,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["tabs","spacing","spacing-top","spacing-bottom","padding-inline","padding-inline-expanded","logo-width","logo-height","logo-aspect-ratio","logo-alt","logotype-text","search-height","reserve-tabs","layout-pending"]}),customElements.whenDefined("scb-header").then(()=>{h.disconnect()})};W();var P={fromAttribute:u=>u==null?!0:!/^(false|0|off|no)$/i.test(u),toAttribute:u=>String(!!u)},L={fromAttribute:u=>u==null?!1:!/^(false|0|off|no)$/i.test(u),toAttribute:u=>u?"":null},F={fromAttribute:u=>u==="small"||u==="medium"||u==="large"?u:"medium",toAttribute:u=>{const e=String(u??"");return e==="small"||e==="medium"||e==="large"?e:null}},i=(C=class extends R{constructor(){super(),this.maxWidth="1440px",this.size=B["scb-header"].size,this.logoText="",this.logotypeText="",this.logoAlt="",this.logoHref="/",this.logoSrc="",this.logoWidth="",this.logoHeight="",this.logoAspectRatio="",this.logoInvertDm=!1,this.banner=!1,this.tabs=[],this.activeTab=null,this.reserveTabs=!1,this.layoutPending=!1,this.utilityItems=[],this.searchButtonLabel="Sök",this.searchClearLabel="Rensa sökfält",this.searchCloseLabel="Stäng sök",this.menuButtonLabel="Meny",this.menuOpenLabel="Öppna meny",this.utilityNavigationLabel="Funktionslänkar",this.mainNavigationLabel="Huvudnavigering",this.deferDrawer=!1,this.showDrawer=!0,this.alwaysShowMenuButton=!1,this.showSearch=!0,this.includeUtilityInMenu=!1,this.drawerOverlay=!0,this.searchText="",this._drawerId="main-drawer",this._menuExpanded=!1,this._searchId="header-search",this._drawerReady=!1,this._mobileSearchOpen=!1,this._initialUpgradeComplete=!1,this._slotNavItems=[],this._slotUtils=[],this._slotMenu=[],this._observedLayout=[],this._measureScheduled=!1,this._scheduleMeasure=()=>{this.layoutPending||this._measureScheduled||(this._measureScheduled=!0,requestAnimationFrame(()=>{this._measureScheduled=!1,this._measure()}))},this._onWindowResize=()=>{window.innerWidth>=this.BP_SM&&this._mobileSearchOpen&&this._setMobileSearchOpen(!1),this._scheduleMeasure()},this._onMenuSelect=t=>{t.stopPropagation();const a=t.detail;this.dispatchEvent(new CustomEvent("scb-menu-select",{detail:a,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("scbmenuselect",{detail:a,bubbles:!0,composed:!0}));const r=a?.item,s=typeof a?.href=="string"?a.href:typeof a?.itemHref=="string"?a.itemHref:typeof a?.item_href=="string"?a.item_href:"",o=r?r.getAttribute("item-href")??r.getAttribute("href")??"":"";String(s||o||"").trim()&&this._closeDrawerNow()},this._onMenuSelectAlias=t=>{t.stopPropagation()},this._collapsed=!1,this._unlockAtWidth=0,this._tabsCollapsed=!1,this._desktop=typeof window<"u"&&window.innerWidth>=T.BP_MD_DEFAULT,this._hideLogoText=!1,this._slotWatchers=[],this._harvestPending=!1,this._harvest=(t={})=>{const a=Array.from(this.children),r=[],s=[],o=[];let h=-1,n=!1;const g=d=>({label:d.getAttribute("label")??"",href:d.getAttribute("href")??void 0,icon:d.getAttribute("icon")??void 0}),b=d=>{d.hasAttribute("role")&&d.removeAttribute("role"),d.hasAttribute("hidden")||d.setAttribute("hidden",""),d.getAttribute("aria-hidden")!=="true"&&d.setAttribute("aria-hidden","true")};for(const d of a){const f=d.tagName.toLowerCase();if(this._isDrawerCloseNode(d)){this._syncDrawerCloseNode(d);continue}if(f==="scb-header-tab"){b(d);const m=d.getAttribute("label")??"",p=d.getAttribute("href"),A=p&&p.trim()!==""?p:void 0;(d.hasAttribute("selected")||d.getAttribute("selected")==="true"||d.getAttribute("active")==="true"||d.getAttribute("aria-current")==="page")&&h===-1&&(h=r.length),r.push({kind:"tab",label:m,href:A});continue}if(f==="scb-badge"){const m=d.querySelector("scb-dropdown");if(m){n=!0;const p=m.getAttribute("label")??"";(m.hasAttribute("selected")||m.getAttribute("selected")==="true"||m.getAttribute("active")==="true"||m.getAttribute("aria-current")==="page")&&h===-1&&(h=r.length);const A=`scb-header-tab-${r.length}`;d.getAttribute("slot")!==A&&d.setAttribute("slot",A),m.hasAttribute("slot")&&m.removeAttribute("slot"),m.hasAttribute("as-tab")||m.setAttribute("as-tab",""),r.push({kind:"dropdown",slotName:A,label:p});continue}}if(f==="scb-dropdown"){n=!0;const m=d.getAttribute("label")??"";(d.hasAttribute("selected")||d.getAttribute("selected")==="true"||d.getAttribute("active")==="true"||d.getAttribute("aria-current")==="page")&&h===-1&&(h=r.length);const p=`scb-header-tab-${r.length}`;d.getAttribute("slot")!==p&&d.setAttribute("slot",p),d.hasAttribute("as-tab")||d.setAttribute("as-tab",""),r.push({kind:"dropdown",slotName:p,label:m});continue}if(f==="scb-header-utility"){b(d),s.push({label:d.getAttribute("label")??"",href:d.getAttribute("href")??"#",target:d.getAttribute("target")??void 0});continue}if(f==="scb-header-menu-group"){b(d);const m={label:d.getAttribute("label")??"",icon:d.getAttribute("icon")??void 0,children:[]};d.querySelectorAll("scb-header-menu-item").forEach(p=>m.children.push(g(p))),o.push(m);continue}if(f==="scb-header-menu-item"){b(d),o.push(g(d));continue}d.hasAttribute("slot")||b(d)}const y=!this._sameNavItems(this._slotNavItems,r),x=!this._sameUtilityItems(this._slotUtils,s),k=!this._sameMenuNodes(this._slotMenu,o);y&&(this._slotNavItems=r),x&&(this._slotUtils=s),k&&(this._slotMenu=o),n&&this._ensureDropdownReady(),!this.hasAttribute("active-tab")&&h>=0&&this.activeTab!==h&&(this.activeTab=h),(t.scheduleMeasure??!0)&&queueMicrotask(()=>{this.updateComplete.then(()=>{this._scheduleMeasure()})})},this._measure=()=>{if(this.layoutPending)return;const t=this._top,a=this._logoGroup;if(!t||!a)return;const r=window.innerWidth;this._desktop=r>=this.BP_MD;const s=t.clientWidth,o=this._overflows(this._util),h=!this._desktop||o;this._collapsed?!h&&s>=this._unlockAtWidth&&this._setCollapsed(!1):h&&(this._unlockAtWidth=s+this._HYST,this._setCollapsed(!0)),this._setTabsCollapsed(this._tabsOverflows());let n=!1;if(this.showSearch&&r>=this.BP_SM&&r<this.BP_MD&&this._searchWrap){const x=getComputedStyle(this._searchWrap),k=Math.max(this._num(x.minWidth,this._tokenPx("--scb-header-search-min",250)),this._tokenPx("--scb-header-search-min",250)),d=this._num(getComputedStyle(t).gap,this._tokenPx("--spacing-7",24)),f=this.showDrawer&&(this.alwaysShowMenuButton||r<this.BP_MD||this._collapsed)?this._menuBtn?.getBoundingClientRect().width||this._tokenPx("--icon-size-extra-extra-large",48):0;n=a.getBoundingClientRect().width+d+k+d+f+8>s+.5}this._setHideSearch(n);let g=!1;const b=this.renderRoot.querySelector(".actions"),y=Array.from(b?.querySelectorAll(".header-icon-button")??[]).filter(x=>this._visible(x));if(y.length>0&&!this._visible(this._util)&&!this._visible(this._searchWrap)){const x=this._num(getComputedStyle(t).gap,this._tokenPx("--spacing-7",24)),k=b?this._num(getComputedStyle(b).columnGap,0):0,d=y.reduce((m,p)=>m+p.getBoundingClientRect().width,0)+k*Math.max(0,y.length-1);this._hideLogoText&&this.removeAttribute("data-hide-logo-text");const f=a.getBoundingClientRect().width;this._hideLogoText&&this.setAttribute("data-hide-logo-text",""),g=f+x+d+(this._hideLogoText?this._HYST:0)>s+.5}this._setHideLogoText(g)},this._onGlobalFocusRingKeydown=t=>{t.key==="Tab"&&(this.toggleAttribute("data-keyboard-focus",!0),this._ensureFocusRingReady())},this._onGlobalFocusRingPointerDown=()=>{this.removeAttribute("data-keyboard-focus")},this._onLocalFocusIn=t=>{const a=t.composedPath()[0];a instanceof HTMLElement&&a.matches(":focus-visible")&&this._ensureFocusRingReady()},this._onDrawerOpened=()=>{this._menuExpanded=!0,this._syncMenuBtnAria(),this.dispatchEvent(new CustomEvent("drawer-open",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("draweropen",{bubbles:!0,composed:!0}))},this._onDrawerClosed=()=>{this._menuExpanded=!1,this._syncMenuBtnAria(),this.dispatchEvent(new CustomEvent("drawer-close",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("drawerclose",{bubbles:!0,composed:!0}))},this._onMenuClick=async t=>{this.showDrawer&&(this._setMobileSearchOpen(!1),this.dispatchEvent(new CustomEvent("menu-click",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("menuclick",{bubbles:!0,composed:!0})),!this._drawerReady&&(t.stopPropagation(),await this._ensureDrawerReady(),await this.updateComplete,this._openDrawerNow()))},this._onMobileSearchToggle=()=>{const t=!this._mobileSearchOpen;this._setMobileSearchOpen(t),t&&this.updateComplete.then(()=>{this.renderRoot.querySelector(".mobile-search-panel .header-search-input")?.focus?.()})},this._onTabClick=t=>{const a=t.currentTarget;if(!a)return;const r=a.tagName.toLowerCase()==="a";if(r&&(t.defaultPrevented||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey))return;const s=a.getAttribute("data-index"),o=s!=null?Number(s):0,h=this._getNavItems()[o];if(h?.kind==="dropdown")return;this.activeTab=o;const n=h?.kind==="tab"?h.href??"":"",g=new CustomEvent("tab-change",{detail:{index:o,href:n},bubbles:!0,composed:!0,cancelable:!0}),b=new CustomEvent("tabchange",{detail:{index:o,href:n},bubbles:!0,composed:!0,cancelable:!0});!(this.dispatchEvent(g)&&this.dispatchEvent(b))&&r&&t.preventDefault()},this._onDropdownTabActivate=t=>{const a=t.detail?.dataIndex,r=typeof a=="number"?a:typeof a=="string"?Number(a):this._readTabIndexFromEvent(t);if(r==null||!Number.isFinite(r))return;const s=this._getNavItems();r<0||r>=s.length||s[r]?.kind==="dropdown"&&(this.activeTab=r,this.dispatchEvent(new CustomEvent("tab-change",{detail:{index:r,href:""},bubbles:!0,composed:!0,cancelable:!0})),this.dispatchEvent(new CustomEvent("tabchange",{detail:{index:r,href:""},bubbles:!0,composed:!0,cancelable:!0})))},this._onTabsKeydown=t=>{const a=t.key;if(a!=="ArrowLeft"&&a!=="ArrowRight"&&a!=="Home"&&a!=="End")return;const r=this._getNavItems();if(!r.length)return;const s=this._readTabIndexFromEvent(t);if(s==null)return;let o=Math.max(0,Math.min(r.length-1,s));a==="ArrowRight"?o=(o+1)%r.length:a==="ArrowLeft"?o=(o-1+r.length)%r.length:a==="Home"?o=0:a==="End"&&(o=r.length-1),t.preventDefault(),this._focusTabAtIndex(o)},this._onNativeSearchInput=t=>{const a=t.currentTarget;this._emitSearchInput(a?.value??"")},this._onNativeSearchSubmit=t=>{t.preventDefault();const a=t.currentTarget?.querySelector(".header-search-input");this._emitSearchChange(a?.value??"")},this._onSearchClear=()=>{this.searchText="",this.dispatchEvent(new CustomEvent("search-text-change",{detail:{value:""},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("searchtextchange",{detail:{value:""},bubbles:!0,composed:!0}))},this._onNativeSearchClear=t=>{t.preventDefault(),this._onSearchClear(),this.updateComplete.then(()=>{const a=t.currentTarget?.closest("form")?.querySelector(".header-search-input");a&&(a.value=""),a?.focus()})};const e=++H;this._drawerId=`scb-header-drawer-${e}`,this._searchId=`scb-header-search-${e}`}requestLayout(){this.layoutPending||(this.setAttribute("data-layout-settling",""),this.updateComplete.then(()=>{this.isConnected&&(this._measure(),this.removeAttribute("data-layout-settling"))}))}get _HYST(){return this._tokenPx("--spacing-11",64)}get BP_SM(){return this._tokenPx("--bp-sm",T.BP_SM_DEFAULT)}get BP_MD(){return this._tokenPx("--bp-md",T.BP_MD_DEFAULT)}_scheduleHarvest(){this._harvestPending||(this._harvestPending=!0,queueMicrotask(()=>{this._harvestPending=!1,this._harvest()}))}get _top(){return this.renderRoot.querySelector(".top-row")}get _util(){return this.renderRoot.querySelector(".utility")}get _logoGroup(){return this.renderRoot.querySelector(".logo-wrap")||this.renderRoot.querySelector(".logo-group")}get _searchWrap(){return this.renderRoot.querySelector(".search")}get _menuBtn(){return this.renderRoot.querySelector(".menu-trigger")}get _tabsNav(){return this.renderRoot.querySelector(".tabs-nav")}_attachSlotObservers(){this._slotMo?.disconnect(),this._slotWatchers.forEach(s=>s.disconnect()),this._slotWatchers=[];const e=["label","href","icon","target","selected","aria-current","active","role"],t=s=>{const o=new MutationObserver(h=>{this._scheduleHarvest()});this._slotWatchers.push(o),o.observe(s,{attributes:!0,attributeFilter:e})},a=()=>{this._slotWatchers.forEach(o=>o.disconnect()),this._slotWatchers=[];const s=Array.from(this.children);for(const o of s){const h=o.tagName.toLowerCase();if((h==="scb-header-tab"||h==="scb-dropdown"||h==="scb-header-utility"||h==="scb-header-menu-item"||h==="scb-header-menu-group"||h==="scb-badge")&&t(o),h==="scb-badge"){const n=o,g=new MutationObserver(y=>{a(),this._scheduleHarvest()});this._slotWatchers.push(g),g.observe(n,{childList:!0});const b=n.querySelector("scb-dropdown");b&&t(b);continue}if(h==="scb-header-menu-group"){const n=o,g=new MutationObserver(b=>{a(),this._scheduleHarvest()});this._slotWatchers.push(g),g.observe(n,{childList:!0,subtree:!0}),n.querySelectorAll("scb-header-menu-item").forEach(b=>t(b))}}},r=new MutationObserver(s=>{let o=!1;for(const h of s)if(h.type==="childList"){o=!0;break}o&&a(),this._scheduleHarvest()});this._slotMo=r,r.observe(this,{childList:!0}),a()}_sameNavItems(e,t){if(e.length!==t.length)return!1;for(let a=0;a<e.length;a+=1){const r=e[a],s=t[a];if(!r||!s||r.kind!==s.kind||r.label!==s.label)return!1;if(r.kind==="tab"&&s.kind==="tab"){if((r.href??"")!==(s.href??""))return!1}else if(r.kind==="dropdown"&&s.kind==="dropdown"&&r.slotName!==s.slotName)return!1}return!0}_sameUtilityItems(e,t){if(e.length!==t.length)return!1;for(let a=0;a<e.length;a+=1){const r=e[a],s=t[a];if(!r||!s||r.label!==s.label||r.href!==s.href||(r.target??"")!==(s.target??""))return!1}return!0}_sameMenuNodes(e,t){if(e.length!==t.length)return!1;for(let a=0;a<e.length;a+=1){const r=e[a],s=t[a];if(!r||!s||r.label!==s.label||(r.href??"")!==(s.href??"")||(r.icon??"")!==(s.icon??"")||!this._sameMenuNodes(r.children??[],s.children??[]))return!1}return!0}_isDrawerCloseNode(e){const t=e.tagName.toLowerCase(),a=e.getAttribute("slot");if(a==="drawer-close")return!0;if(a||t!=="scb-icon-button")return!1;const r=(e.getAttribute("icon")??"").trim().toLowerCase(),s=(e.getAttribute("aria-label")??"").trim().toLowerCase();return r==="close"||s.includes("stäng")||s.includes("close")}_syncDrawerCloseNode(e){e.getAttribute("slot")!=="drawer-close"&&e.setAttribute("slot","drawer-close"),e.setAttribute("data-drawer-close",this._drawerId),e.setAttribute("aria-controls",this._drawerId),this._drawerReady?(e.removeAttribute("hidden"),e.removeAttribute("aria-hidden")):(e.hasAttribute("hidden")||e.setAttribute("hidden",""),e.getAttribute("aria-hidden")!=="true"&&e.setAttribute("aria-hidden","true"))}_syncDrawerCloseNodes(){for(const e of Array.from(this.children))this._isDrawerCloseNode(e)&&this._syncDrawerCloseNode(e)}_setCollapsed(e){this._collapsed!==e&&(this._collapsed=e,e?this.setAttribute("data-collapsed",""):this.removeAttribute("data-collapsed"))}_setHideSearch(e){e?this.setAttribute("data-hide-search",""):this.removeAttribute("data-hide-search")}_setHideLogoText(e){this._hideLogoText!==e&&(this._hideLogoText=e,e?this.setAttribute("data-hide-logo-text",""):this.removeAttribute("data-hide-logo-text"))}_setMobileSearchOpen(e){this._mobileSearchOpen!==e&&(this._mobileSearchOpen=e,this.toggleAttribute("data-mobile-search-open",e))}_num(e,t){const a=Number.parseFloat(String(e??"").trim());return Number.isFinite(a)?a:t}_tokenPx(e,t){const a=getComputedStyle(this);return this._num(a.getPropertyValue(e),t)}_visible(e){return e?getComputedStyle(e).display!=="none":!1}_overflows(e){return!e||!this._visible(e)?!1:e.scrollWidth>e.clientWidth+1}_tabsOverflows(){const e=this._tabsNav,t=e?.closest(".tabs-row");if(!e||!t||!this._desktop||!this.showDrawer)return!1;const a=t.querySelector(".menu-trigger--tabs-right"),r=a&&(this.alwaysShowMenuButton||this._collapsed),s=r?a.getBoundingClientRect().width:0,o=r?this._num(getComputedStyle(t).columnGap,0):0,h=t.getBoundingClientRect().width-s-o;return e.getBoundingClientRect().width>h+.5}_setTabsCollapsed(e){if(this._tabsCollapsed===e)return;const t=this._tabsNav;let a=e&&!!t?.contains(this.shadowRoot?.activeElement??null);if(e)for(const r of this._getNavItems()){if(r.kind!=="dropdown")continue;const s=this._getDropdownForSlot(r.slotName);a||(a=s===document.activeElement),s?.removeAttribute("open")}this._tabsCollapsed=e,this.toggleAttribute("data-tabs-collapsed",e),a&&this.updateComplete.then(()=>this._menuBtn?.focus())}_observeLayout(){const e=[this._top,this._tabsNav,this._tabsNav?.closest(".tabs-row"),this._menuBtn].filter(t=>!!t);if(!(e.length===this._observedLayout.length&&e.every((t,a)=>t===this._observedLayout[a]))){this._ro?.disconnect(),this._observedLayout=e;for(const t of e)this._ro?.observe(t,{box:"border-box"})}}connectedCallback(){super.connectedCallback(),window.addEventListener("keydown",this._onGlobalFocusRingKeydown,!0),window.addEventListener("pointerdown",this._onGlobalFocusRingPointerDown,!0),this._initialUpgradeComplete||this.setAttribute("data-upgrading",""),this._harvest({scheduleMeasure:!1}),this._attachSlotObservers()}_finishInitialUpgrade(){this._initialUpgradeComplete||(this._initialUpgradeComplete=!0,requestAnimationFrame(()=>{this.isConnected&&(this._measure(),this.removeAttribute("data-upgrading"))}))}firstUpdated(){this._syncLandmarkAttributes(),this.renderRoot.addEventListener("focusin",this._onLocalFocusIn),this.showDrawer&&!this.deferDrawer&&this._ensureDrawerReady(),this.updateComplete.then(()=>{this._harvest({scheduleMeasure:!1}),this._attachSlotObservers(),this._syncDropdownTabs(),this._finishInitialUpgrade()}),this._ro=new ResizeObserver(()=>this._scheduleMeasure()),this._observeLayout(),window.addEventListener("resize",this._onWindowResize,{passive:!0})}updated(e){e.has("searchMax")&&this.style.setProperty("--scb-header-search-max",this.searchMax??"380px"),e.has("searchMin")&&this.style.setProperty("--scb-header-search-min",this.searchMin??"250px"),e.has("searchHeight")&&(this.searchHeight&&this.searchHeight.trim()?this.style.setProperty("--scb-search-height",this.searchHeight.trim()):this.style.removeProperty("--scb-search-height")),(e.has("logoWidth")||e.has("logoHeight")||e.has("logoAspectRatio"))&&this._applyLogoSizing(),(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom"))&&this._applySpacing(),(e.has("paddingInline")||e.has("paddingInlineExpanded"))&&this._applyPaddingInline(),(e.has("banner")||e.has("bannerLabel"))&&this._syncLandmarkAttributes(),(e.has("utilityItems")||e.has("_collapsed")||e.has("_tabsCollapsed")||e.has("_desktop")||e.has("_mobileSearchOpen")||e.has("tabs")||e.has("logoText")||e.has("logotypeText")||e.has("logoSrc")||e.has("logoWidth")||e.has("logoHeight")||e.has("logoAspectRatio")||e.has("activeTab")||e.has("_slotNavItems")||e.has("_slotUtils")||e.has("_slotMenu")||e.has("showDrawer")||e.has("alwaysShowMenuButton")||e.has("showSearch")||e.has("layoutPending")||e.has("searchMax")||e.has("searchMin")||e.has("paddingInline")||e.has("paddingInlineExpanded")||e.has("size"))&&this.updateComplete.then(()=>{this._observeLayout(),this._scheduleMeasure()}),(e.has("showDrawer")||e.has("deferDrawer"))&&this.showDrawer&&!this.deferDrawer&&this._ensureDrawerReady(),e.has("showSearch")&&!this.showSearch&&this._setMobileSearchOpen(!1),e.has("layoutPending")&&!this.layoutPending&&this.requestLayout(),(e.has("activeTab")||e.has("_slotNavItems")||e.has("tabs")||e.has("size"))&&this.updateComplete.then(()=>{this._syncDropdownTabs()})}disconnectedCallback(){this._ro?.disconnect(),this._observedLayout=[],this._slotMo?.disconnect(),this._slotWatchers.forEach(e=>e.disconnect()),this._slotWatchers=[],this.renderRoot.removeEventListener("focusin",this._onLocalFocusIn),window.removeEventListener("keydown",this._onGlobalFocusRingKeydown,!0),window.removeEventListener("pointerdown",this._onGlobalFocusRingPointerDown,!0),window.removeEventListener("resize",this._onWindowResize),super.disconnectedCallback()}_mapSpacingToken(e){if(!e)return;const t=String(e).trim();if(t){if(/^\d+$/.test(t)){const a=Math.max(0,Math.min(14,parseInt(t,10)));return`var(--spacing-${a}, ${I[a]}px)`}return t}}_applySpacing(){const e=this._mapSpacingToken(this.spacing),t=this._mapSpacingToken(this.spacingTop)??e,a=this._mapSpacingToken(this.spacingBottom)??e;t?this.style.setProperty("--scb-header-spacing-block-start",t):this.style.removeProperty("--scb-header-spacing-block-start"),a?this.style.setProperty("--scb-header-spacing-block-end",a):this.style.removeProperty("--scb-header-spacing-block-end")}_applyPaddingInline(){const e=this._mapSpacingToken(this.paddingInline),t=this._mapSpacingToken(this.paddingInlineExpanded)??e;e?this.style.setProperty("--scb-header-padding-inline",e):this.style.removeProperty("--scb-header-padding-inline"),t?this.style.setProperty("--scb-header-padding-inline-expanded",t):this.style.removeProperty("--scb-header-padding-inline-expanded")}_syncLandmarkAttributes(){const e=this.renderRoot.querySelector(".header-landmark");if(!e)return;if(!this.banner){e.removeAttribute("role"),e.removeAttribute("aria-label");return}e.setAttribute("role","banner");const t=(this.bannerLabel??"").trim();t?e.setAttribute("aria-label",t):e.removeAttribute("aria-label")}_applyLogoSizing(){const e=(this.logoWidth??"").trim(),t=(this.logoHeight??"").trim(),a=(this.logoAspectRatio??"").trim();e?this.style.setProperty("--scb-header-logo-img-w",e):this.style.removeProperty("--scb-header-logo-img-w"),t?this.style.setProperty("--scb-header-logo-img-h",t):e?this.style.setProperty("--scb-header-logo-img-h","auto"):this.style.removeProperty("--scb-header-logo-img-h"),a?this.style.setProperty("--scb-header-logo-img-aspect-ratio",a):this.style.removeProperty("--scb-header-logo-img-aspect-ratio")}_closeDrawerNow(){const e=this.renderRoot.querySelector(`#${this._drawerId}`);e&&(e.open=!1)}_openDrawerNow(){const e=this.renderRoot.querySelector(`#${this._drawerId}`);e&&(e.open=!0)}_ensureFocusRingReady(){customElements.get("md-focus-ring")||(this._focusRingImportPromise??(this._focusRingImportPromise=S(()=>import("../shared/lazy-focus-ring.js"),__vite__mapDeps([0,1]),import.meta.url)),this._focusRingImportPromise.then(({ensureFocusRingReady:e})=>{e()}))}async _ensureDrawerReady(){this._drawerReady||(this._drawerImportPromise??(this._drawerImportPromise=Promise.all([S(()=>import("../scb-drawer/scb-drawer.js"),__vite__mapDeps([2,3,4,5,6,7,8,9]),import.meta.url),S(()=>import("../scb-menu/scb-menu.js"),__vite__mapDeps([10,3,4,5,8,9,7,11,1,12,13,14]),import.meta.url),S(()=>import("../scb-search/scb-search.js"),__vite__mapDeps([15,3,4,16,17,18,19,1,0,20,21,5,6]),import.meta.url),S(()=>import("../../vendor/scb-header-drawer.internal.js").then(e=>{this._drawerRenderer=e}),__vite__mapDeps([22,3,4]),import.meta.url),this._ensureDrawerSlotComponentsReady()]).then(()=>{})),await this._drawerImportPromise,this._drawerReady=!0,this._syncDrawerCloseNodes())}_drawerSlotContains(e){return[...this.querySelectorAll('[slot="drawer-menu"], [slot="drawer-close"]')].some(t=>t.matches(e)||!!t.querySelector(e))}async _ensureDrawerSlotComponentsReady(){this.querySelector('[slot="drawer-menu"], [slot="drawer-close"]')&&await Promise.all([this._drawerSlotContains("scb-button")?S(()=>import("../scb-button/scb-button.js"),__vite__mapDeps([23,3,4,1,21,5,8,9]),import.meta.url):Promise.resolve(),this._drawerSlotContains("scb-icon-button")?S(()=>import("../scb-icon-button/scb-icon-button.js"),__vite__mapDeps([24,3,4,1,21,5,8,9]),import.meta.url):Promise.resolve(),this._drawerSlotContains("scb-skeleton")?S(()=>import("../scb-skeleton/scb-skeleton.js"),__vite__mapDeps([25,3,4,5]),import.meta.url):Promise.resolve(),this._drawerSlotContains("scb-grid")?S(()=>import("../scb-grid/scb-grid.js"),__vite__mapDeps([26,3,4,5,8,9,27,28]),import.meta.url):Promise.resolve(),this._drawerSlotContains("scb-grid-item")?S(()=>import("../scb-grid/scb-grid-item.js"),__vite__mapDeps([27,3,4,5,8,9]),import.meta.url):Promise.resolve()])}async _ensureDropdownReady(){customElements.get("scb-dropdown")||(this._dropdownImportPromise??(this._dropdownImportPromise=S(()=>import("../scb-dropdown/scb-dropdown.js").then(()=>{}),__vite__mapDeps([29,3,4,16,17,0,1,21,5,12,23,8,9,6,30,31,18,19,7,32]),import.meta.url)),await this._dropdownImportPromise)}_syncMenuBtnAria(){this.renderRoot.querySelectorAll(".menu-trigger").forEach(e=>{e.setAttribute("aria-expanded",String(this._menuExpanded))})}_getNavItems(){return this._slotNavItems.length?this._slotNavItems:(this.tabs??[]).map(e=>({kind:"tab",...e}))}_getDropdownForSlot(e){const t=this.querySelector(`[slot="${e}"]`);return t?t.tagName.toLowerCase()==="scb-dropdown"?t:t.querySelector("scb-dropdown"):null}_syncDropdownTabs(){this._getNavItems().forEach((e,t)=>{if(e.kind!=="dropdown")return;const a=this._getDropdownForSlot(e.slotName);if(!a)return;const r=String(t);a.getAttribute("data-index")!==r&&a.setAttribute("data-index",r),a.hasAttribute("as-tab")||a.setAttribute("as-tab","");const s=this.size,o=a;o?.size!==s&&(o.size=s),t===this.activeTab?a.getAttribute("aria-current")!=="page"&&a.setAttribute("aria-current","page"):a.hasAttribute("aria-current")&&a.removeAttribute("aria-current")})}_readTabIndexFromEvent(e){const t=e.composedPath?e.composedPath():[];for(const a of t){if(!(a instanceof HTMLElement))continue;const r=a.getAttribute("data-index");if(r==null)continue;const s=Number(r);if(Number.isFinite(s))return s}return null}_focusTabAtIndex(e){const t=this._getNavItems()[e];if(t){if(t.kind==="dropdown"){this._getDropdownForSlot(t.slotName)?.focus?.();return}this.renderRoot.querySelector(`.tab-link[data-index="${e}"]`)?.focus?.()}}_syncFlags(e,t){this.toggleAttribute("data-no-utility",e),this.toggleAttribute("data-no-search",t)}_emitSearchInput(e){this.searchText=e,this.dispatchEvent(new CustomEvent("search-input",{detail:{value:this.searchText},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("searchinput",{detail:{value:this.searchText},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("search-text-change",{detail:{value:this.searchText},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("searchtextchange",{detail:{value:this.searchText},bubbles:!0,composed:!0}))}_emitSearchChange(e,t){this.searchText=e,this.dispatchEvent(new CustomEvent("search-change",{detail:{value:this.searchText,active:t},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("searchchange",{detail:{value:this.searchText,active:t},bubbles:!0,composed:!0}))}_renderMenuButton(e="",t=!1){const a=e?`menu-trigger ${e}`:"menu-trigger",r=(this.menuButtonLabel??"").trim(),s=(this.menuOpenLabel??"").trim()||r,o=this._menuExpanded?"true":"false";return t?v`
55
+ `,document.head.appendChild(u);const e=n=>{const g=String(n??"").trim();if(g){if(/^\d+$/.test(g)){const b=Math.max(0,Math.min(14,parseInt(g,10)));return`var(--spacing-${b}, ${I[b]}px)`}return g}},t=n=>{const g=String(n??"").trim();if(!g)return!1;try{const b=JSON.parse(g);return Array.isArray(b)&&b.length>0}catch{return!1}},a=n=>n!=null&&!/^(false|0|off|no)$/i.test(n.trim()),r=n=>{for(const g of Array.from(n.children)){const b=g.tagName.toLowerCase();if(b==="scb-header-tab"||b==="scb-dropdown")return!0}return!1},s=n=>{r(n)||t(n.getAttribute("tabs"))||a(n.getAttribute("reserve-tabs"))||a(n.getAttribute("layout-pending"))?n.setAttribute("data-pre-has-tabs",""):n.removeAttribute("data-pre-has-tabs");const g=e(n.getAttribute("spacing")),b=e(n.getAttribute("spacing-top"))??g,y=e(n.getAttribute("spacing-bottom"))??g,x=e(n.getAttribute("padding-inline")),k=e(n.getAttribute("padding-inline-expanded"))??x;b?n.style.setProperty("--scb-header-spacing-block-start",b):n.style.removeProperty("--scb-header-spacing-block-start"),y?n.style.setProperty("--scb-header-spacing-block-end",y):n.style.removeProperty("--scb-header-spacing-block-end"),x?n.style.setProperty("--scb-header-padding-inline",x):n.style.removeProperty("--scb-header-padding-inline"),k?n.style.setProperty("--scb-header-padding-inline-expanded",k):n.style.removeProperty("--scb-header-padding-inline-expanded");const d=(n.getAttribute("logo-width")??"").trim();d?n.style.setProperty("--scb-header-pre-logo-w",d):n.style.removeProperty("--scb-header-pre-logo-w");const f=(n.getAttribute("logo-height")??"").trim();f?n.style.setProperty("--scb-header-pre-logo-img-h",f):n.style.removeProperty("--scb-header-pre-logo-img-h");const m=(n.getAttribute("search-height")??"").trim();m?n.style.setProperty("--scb-header-pre-control-size",m):n.style.removeProperty("--scb-header-pre-control-size")};document.querySelectorAll("scb-header").forEach(s);const h=new MutationObserver(n=>{for(const g of n){if(g.type==="attributes"){const b=g.target;b instanceof HTMLElement&&b.tagName.toLowerCase()==="scb-header"&&s(b);continue}if(g.type==="childList"){const b=[...Array.from(g.addedNodes),...Array.from(g.removedNodes)];for(const y of b){if(!(y instanceof HTMLElement))continue;if(y.tagName.toLowerCase()==="scb-header"){s(y);continue}const x=y.closest?.("scb-header");x&&s(x)}}}});h.observe(document.documentElement,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["tabs","spacing","spacing-top","spacing-bottom","padding-inline","padding-inline-expanded","logo-width","logo-height","logo-aspect-ratio","logo-alt","logotype-text","search-height","reserve-tabs","layout-pending"]}),customElements.whenDefined("scb-header").then(()=>{h.disconnect()})};W();var P={fromAttribute:u=>u==null?!0:!/^(false|0|off|no)$/i.test(u),toAttribute:u=>String(!!u)},L={fromAttribute:u=>u==null?!1:!/^(false|0|off|no)$/i.test(u),toAttribute:u=>u?"":null},F={fromAttribute:u=>u==="small"||u==="medium"||u==="large"?u:"medium",toAttribute:u=>{const e=String(u??"");return e==="small"||e==="medium"||e==="large"?e:null}},i=(C=class extends R{constructor(){super(),this.maxWidth="1440px",this.size=B["scb-header"].size,this.logoText="",this.logotypeText="",this.logoAlt="",this.logoHref="/",this.logoSrc="",this.logoWidth="",this.logoHeight="",this.logoAspectRatio="",this.logoInvertDm=!1,this.banner=!1,this.tabs=[],this.activeTab=null,this.reserveTabs=!1,this.layoutPending=!1,this.utilityItems=[],this.searchButtonLabel="Sök",this.searchClearLabel="Rensa sökfält",this.searchCloseLabel="Stäng sök",this.menuButtonLabel="Meny",this.menuOpenLabel="Öppna meny",this.utilityNavigationLabel="Funktionslänkar",this.mainNavigationLabel="Huvudnavigering",this.deferDrawer=!1,this.showDrawer=!0,this.alwaysShowMenuButton=!1,this.showSearch=!0,this.includeUtilityInMenu=!1,this.drawerOverlay=!0,this.searchText="",this._drawerId="main-drawer",this._menuExpanded=!1,this._searchId="header-search",this._drawerReady=!1,this._mobileSearchOpen=!1,this._initialUpgradeComplete=!1,this._slotNavItems=[],this._slotUtils=[],this._slotMenu=[],this._observedLayout=[],this._measureScheduled=!1,this._scheduleMeasure=()=>{this.layoutPending||this._measureScheduled||(this._measureScheduled=!0,requestAnimationFrame(()=>{this._measureScheduled=!1,this._measure()}))},this._onWindowResize=()=>{window.innerWidth>=this.BP_SM&&this._mobileSearchOpen&&this._setMobileSearchOpen(!1),this._scheduleMeasure()},this._onMenuSelect=t=>{t.stopPropagation();const a=t.detail;this.dispatchEvent(new CustomEvent("scb-menu-select",{detail:a,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("scbmenuselect",{detail:a,bubbles:!0,composed:!0}));const r=a?.item,s=typeof a?.href=="string"?a.href:typeof a?.itemHref=="string"?a.itemHref:typeof a?.item_href=="string"?a.item_href:"",o=r?r.getAttribute("item-href")??r.getAttribute("href")??"":"";String(s||o||"").trim()&&this._closeDrawerNow()},this._onMenuSelectAlias=t=>{t.stopPropagation()},this._collapsed=!1,this._unlockAtWidth=0,this._tabsCollapsed=!1,this._desktop=typeof window<"u"&&window.innerWidth>=T.BP_MD_DEFAULT,this._hideLogoText=!1,this._slotWatchers=[],this._harvestPending=!1,this._harvest=(t={})=>{const a=Array.from(this.children),r=[],s=[],o=[];let h=-1,n=!1;const g=d=>({label:d.getAttribute("label")??"",href:d.getAttribute("href")??void 0,icon:d.getAttribute("icon")??void 0}),b=d=>{d.hasAttribute("role")&&d.removeAttribute("role"),d.hasAttribute("hidden")||d.setAttribute("hidden",""),d.getAttribute("aria-hidden")!=="true"&&d.setAttribute("aria-hidden","true")};for(const d of a){const f=d.tagName.toLowerCase();if(this._isDrawerCloseNode(d)){this._syncDrawerCloseNode(d);continue}if(f==="scb-header-tab"){b(d);const m=d.getAttribute("label")??"",p=d.getAttribute("href"),A=p&&p.trim()!==""?p:void 0;(d.hasAttribute("selected")||d.getAttribute("selected")==="true"||d.getAttribute("active")==="true"||d.getAttribute("aria-current")==="page")&&h===-1&&(h=r.length),r.push({kind:"tab",label:m,href:A});continue}if(f==="scb-badge"){const m=d.querySelector("scb-dropdown");if(m){n=!0;const p=m.getAttribute("label")??"";(m.hasAttribute("selected")||m.getAttribute("selected")==="true"||m.getAttribute("active")==="true"||m.getAttribute("aria-current")==="page")&&h===-1&&(h=r.length);const A=`scb-header-tab-${r.length}`;d.getAttribute("slot")!==A&&d.setAttribute("slot",A),m.hasAttribute("slot")&&m.removeAttribute("slot"),m.hasAttribute("as-tab")||m.setAttribute("as-tab",""),r.push({kind:"dropdown",slotName:A,label:p});continue}}if(f==="scb-dropdown"){n=!0;const m=d.getAttribute("label")??"";(d.hasAttribute("selected")||d.getAttribute("selected")==="true"||d.getAttribute("active")==="true"||d.getAttribute("aria-current")==="page")&&h===-1&&(h=r.length);const p=`scb-header-tab-${r.length}`;d.getAttribute("slot")!==p&&d.setAttribute("slot",p),d.hasAttribute("as-tab")||d.setAttribute("as-tab",""),r.push({kind:"dropdown",slotName:p,label:m});continue}if(f==="scb-header-utility"){b(d),s.push({label:d.getAttribute("label")??"",href:d.getAttribute("href")??"#",target:d.getAttribute("target")??void 0});continue}if(f==="scb-header-menu-group"){b(d);const m={label:d.getAttribute("label")??"",icon:d.getAttribute("icon")??void 0,children:[]};d.querySelectorAll("scb-header-menu-item").forEach(p=>m.children.push(g(p))),o.push(m);continue}if(f==="scb-header-menu-item"){b(d),o.push(g(d));continue}d.hasAttribute("slot")||b(d)}const y=!this._sameNavItems(this._slotNavItems,r),x=!this._sameUtilityItems(this._slotUtils,s),k=!this._sameMenuNodes(this._slotMenu,o);y&&(this._slotNavItems=r),x&&(this._slotUtils=s),k&&(this._slotMenu=o),n&&this._ensureDropdownReady(),!this.hasAttribute("active-tab")&&h>=0&&this.activeTab!==h&&(this.activeTab=h),(t.scheduleMeasure??!0)&&queueMicrotask(()=>{this.updateComplete.then(()=>{this._scheduleMeasure()})})},this._measure=()=>{if(this.layoutPending)return;const t=this._top,a=this._logoGroup;if(!t||!a)return;const r=window.innerWidth;this._desktop=r>=this.BP_MD;const s=t.clientWidth,o=this._overflows(this._util),h=!this._desktop||o;this._collapsed?!h&&s>=this._unlockAtWidth&&this._setCollapsed(!1):h&&(this._unlockAtWidth=s+this._HYST,this._setCollapsed(!0)),this._setTabsCollapsed(this._tabsOverflows());let n=!1;if(this.showSearch&&r>=this.BP_SM&&r<this.BP_MD&&this._searchWrap){const x=getComputedStyle(this._searchWrap),k=Math.max(this._num(x.minWidth,this._tokenPx("--scb-header-search-min",250)),this._tokenPx("--scb-header-search-min",250)),d=this._num(getComputedStyle(t).gap,this._tokenPx("--spacing-7",24)),f=this.showDrawer&&(this.alwaysShowMenuButton||r<this.BP_MD||this._collapsed)?this._menuBtn?.getBoundingClientRect().width||this._tokenPx("--icon-size-extra-extra-large",48):0;n=a.getBoundingClientRect().width+d+k+d+f+8>s+.5}this._setHideSearch(n);let g=!1;const b=this.renderRoot.querySelector(".actions"),y=Array.from(b?.querySelectorAll(".header-icon-button")??[]).filter(x=>this._visible(x));if(y.length>0&&!this._visible(this._util)&&!this._visible(this._searchWrap)){const x=this._num(getComputedStyle(t).gap,this._tokenPx("--spacing-7",24)),k=b?this._num(getComputedStyle(b).columnGap,0):0,d=y.reduce((m,p)=>m+p.getBoundingClientRect().width,0)+k*Math.max(0,y.length-1);this._hideLogoText&&this.removeAttribute("data-hide-logo-text");const f=a.getBoundingClientRect().width;this._hideLogoText&&this.setAttribute("data-hide-logo-text",""),g=f+x+d+(this._hideLogoText?this._HYST:0)>s+.5}this._setHideLogoText(g)},this._onGlobalFocusRingKeydown=t=>{t.key==="Tab"&&(this.toggleAttribute("data-keyboard-focus",!0),this._ensureFocusRingReady())},this._onGlobalFocusRingPointerDown=()=>{this.removeAttribute("data-keyboard-focus")},this._onLocalFocusIn=t=>{const a=t.composedPath()[0];a instanceof HTMLElement&&a.matches(":focus-visible")&&this._ensureFocusRingReady()},this._onDrawerOpened=()=>{this._menuExpanded=!0,this._syncMenuBtnAria(),this.dispatchEvent(new CustomEvent("drawer-open",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("draweropen",{bubbles:!0,composed:!0}))},this._onDrawerClosed=()=>{this._menuExpanded=!1,this._syncMenuBtnAria(),this.dispatchEvent(new CustomEvent("drawer-close",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("drawerclose",{bubbles:!0,composed:!0}))},this._onMenuClick=async t=>{this.showDrawer&&(this._setMobileSearchOpen(!1),this.dispatchEvent(new CustomEvent("menu-click",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("menuclick",{bubbles:!0,composed:!0})),!this._drawerReady&&(t.stopPropagation(),await this._ensureDrawerReady(),await this.updateComplete,this._openDrawerNow()))},this._onMobileSearchToggle=()=>{const t=!this._mobileSearchOpen;this._setMobileSearchOpen(t),t&&this.updateComplete.then(()=>{this.renderRoot.querySelector(".mobile-search-panel .header-search-input")?.focus?.()})},this._onTabClick=t=>{const a=t.currentTarget;if(!a)return;const r=a.tagName.toLowerCase()==="a";if(r&&(t.defaultPrevented||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey))return;const s=a.getAttribute("data-index"),o=s!=null?Number(s):0,h=this._getNavItems()[o];if(h?.kind==="dropdown")return;this.activeTab=o;const n=h?.kind==="tab"?h.href??"":"",g=new CustomEvent("tab-change",{detail:{index:o,href:n},bubbles:!0,composed:!0,cancelable:!0}),b=new CustomEvent("tabchange",{detail:{index:o,href:n},bubbles:!0,composed:!0,cancelable:!0});!(this.dispatchEvent(g)&&this.dispatchEvent(b))&&r&&t.preventDefault()},this._onDropdownTabActivate=t=>{const a=t.detail?.dataIndex,r=typeof a=="number"?a:typeof a=="string"?Number(a):this._readTabIndexFromEvent(t);if(r==null||!Number.isFinite(r))return;const s=this._getNavItems();r<0||r>=s.length||s[r]?.kind==="dropdown"&&(this.activeTab=r,this.dispatchEvent(new CustomEvent("tab-change",{detail:{index:r,href:""},bubbles:!0,composed:!0,cancelable:!0})),this.dispatchEvent(new CustomEvent("tabchange",{detail:{index:r,href:""},bubbles:!0,composed:!0,cancelable:!0})))},this._onTabsKeydown=t=>{const a=t.key;if(a!=="ArrowLeft"&&a!=="ArrowRight"&&a!=="Home"&&a!=="End")return;const r=this._getNavItems();if(!r.length)return;const s=this._readTabIndexFromEvent(t);if(s==null)return;let o=Math.max(0,Math.min(r.length-1,s));a==="ArrowRight"?o=(o+1)%r.length:a==="ArrowLeft"?o=(o-1+r.length)%r.length:a==="Home"?o=0:a==="End"&&(o=r.length-1),t.preventDefault(),this._focusTabAtIndex(o)},this._onNativeSearchInput=t=>{const a=t.currentTarget;this._emitSearchInput(a?.value??"")},this._onNativeSearchSubmit=t=>{t.preventDefault();const a=t.currentTarget?.querySelector(".header-search-input");this._emitSearchChange(a?.value??"")},this._onSearchClear=()=>{this.searchText="",this.dispatchEvent(new CustomEvent("search-text-change",{detail:{value:""},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("searchtextchange",{detail:{value:""},bubbles:!0,composed:!0}))},this._onNativeSearchClear=t=>{t.preventDefault(),this._onSearchClear(),this.updateComplete.then(()=>{const a=t.currentTarget?.closest("form")?.querySelector(".header-search-input");a&&(a.value=""),a?.focus()})};const e=++H;this._drawerId=`scb-header-drawer-${e}`,this._searchId=`scb-header-search-${e}`}requestLayout(){this.layoutPending||(this.setAttribute("data-layout-settling",""),this.updateComplete.then(()=>{this.isConnected&&(this._measure(),this.removeAttribute("data-layout-settling"))}))}get _HYST(){return this._tokenPx("--spacing-11",64)}get BP_SM(){return this._tokenPx("--bp-sm",T.BP_SM_DEFAULT)}get BP_MD(){return this._tokenPx("--bp-md",T.BP_MD_DEFAULT)}_scheduleHarvest(){this._harvestPending||(this._harvestPending=!0,queueMicrotask(()=>{this._harvestPending=!1,this._harvest()}))}get _top(){return this.renderRoot.querySelector(".top-row")}get _util(){return this.renderRoot.querySelector(".utility")}get _logoGroup(){return this.renderRoot.querySelector(".logo-wrap")||this.renderRoot.querySelector(".logo-group")}get _searchWrap(){return this.renderRoot.querySelector(".search")}get _menuBtn(){return this.renderRoot.querySelector(".menu-trigger")}get _tabsNav(){return this.renderRoot.querySelector(".tabs-nav")}_attachSlotObservers(){this._slotMo?.disconnect(),this._slotWatchers.forEach(s=>s.disconnect()),this._slotWatchers=[];const e=["label","href","icon","target","selected","aria-current","active","role"],t=s=>{const o=new MutationObserver(h=>{this._scheduleHarvest()});this._slotWatchers.push(o),o.observe(s,{attributes:!0,attributeFilter:e})},a=()=>{this._slotWatchers.forEach(o=>o.disconnect()),this._slotWatchers=[];const s=Array.from(this.children);for(const o of s){const h=o.tagName.toLowerCase();if((h==="scb-header-tab"||h==="scb-dropdown"||h==="scb-header-utility"||h==="scb-header-menu-item"||h==="scb-header-menu-group"||h==="scb-badge")&&t(o),h==="scb-badge"){const n=o,g=new MutationObserver(y=>{a(),this._scheduleHarvest()});this._slotWatchers.push(g),g.observe(n,{childList:!0});const b=n.querySelector("scb-dropdown");b&&t(b);continue}if(h==="scb-header-menu-group"){const n=o,g=new MutationObserver(b=>{a(),this._scheduleHarvest()});this._slotWatchers.push(g),g.observe(n,{childList:!0,subtree:!0}),n.querySelectorAll("scb-header-menu-item").forEach(b=>t(b))}}},r=new MutationObserver(s=>{let o=!1;for(const h of s)if(h.type==="childList"){o=!0;break}o&&a(),this._scheduleHarvest()});this._slotMo=r,r.observe(this,{childList:!0}),a()}_sameNavItems(e,t){if(e.length!==t.length)return!1;for(let a=0;a<e.length;a+=1){const r=e[a],s=t[a];if(!r||!s||r.kind!==s.kind||r.label!==s.label)return!1;if(r.kind==="tab"&&s.kind==="tab"){if((r.href??"")!==(s.href??""))return!1}else if(r.kind==="dropdown"&&s.kind==="dropdown"&&r.slotName!==s.slotName)return!1}return!0}_sameUtilityItems(e,t){if(e.length!==t.length)return!1;for(let a=0;a<e.length;a+=1){const r=e[a],s=t[a];if(!r||!s||r.label!==s.label||r.href!==s.href||(r.target??"")!==(s.target??""))return!1}return!0}_sameMenuNodes(e,t){if(e.length!==t.length)return!1;for(let a=0;a<e.length;a+=1){const r=e[a],s=t[a];if(!r||!s||r.label!==s.label||(r.href??"")!==(s.href??"")||(r.icon??"")!==(s.icon??"")||!this._sameMenuNodes(r.children??[],s.children??[]))return!1}return!0}_isDrawerCloseNode(e){const t=e.tagName.toLowerCase(),a=e.getAttribute("slot");if(a==="drawer-close")return!0;if(a||t!=="scb-icon-button")return!1;const r=(e.getAttribute("icon")??"").trim().toLowerCase(),s=(e.getAttribute("aria-label")??"").trim().toLowerCase();return r==="close"||s.includes("stäng")||s.includes("close")}_syncDrawerCloseNode(e){e.getAttribute("slot")!=="drawer-close"&&e.setAttribute("slot","drawer-close"),e.setAttribute("data-drawer-close",this._drawerId),e.setAttribute("aria-controls",this._drawerId),this._drawerReady?(e.removeAttribute("hidden"),e.removeAttribute("aria-hidden")):(e.hasAttribute("hidden")||e.setAttribute("hidden",""),e.getAttribute("aria-hidden")!=="true"&&e.setAttribute("aria-hidden","true"))}_syncDrawerCloseNodes(){for(const e of Array.from(this.children))this._isDrawerCloseNode(e)&&this._syncDrawerCloseNode(e)}_setCollapsed(e){this._collapsed!==e&&(this._collapsed=e,e?this.setAttribute("data-collapsed",""):this.removeAttribute("data-collapsed"))}_setHideSearch(e){e?this.setAttribute("data-hide-search",""):this.removeAttribute("data-hide-search")}_setHideLogoText(e){this._hideLogoText!==e&&(this._hideLogoText=e,e?this.setAttribute("data-hide-logo-text",""):this.removeAttribute("data-hide-logo-text"))}_setMobileSearchOpen(e){this._mobileSearchOpen!==e&&(this._mobileSearchOpen=e,this.toggleAttribute("data-mobile-search-open",e))}_num(e,t){const a=Number.parseFloat(String(e??"").trim());return Number.isFinite(a)?a:t}_tokenPx(e,t){const a=getComputedStyle(this);return this._num(a.getPropertyValue(e),t)}_visible(e){return e?getComputedStyle(e).display!=="none":!1}_overflows(e){return!e||!this._visible(e)?!1:e.scrollWidth>e.clientWidth+1}_tabsOverflows(){const e=this._tabsNav,t=e?.closest(".tabs-row");if(!e||!t||!this._desktop||!this.showDrawer)return!1;const a=t.querySelector(".menu-trigger--tabs-right"),r=a&&(this.alwaysShowMenuButton||this._collapsed),s=r?a.getBoundingClientRect().width:0,o=r?this._num(getComputedStyle(t).columnGap,0):0,h=t.getBoundingClientRect().width-s-o;return e.getBoundingClientRect().width>h+.5}_setTabsCollapsed(e){if(this._tabsCollapsed===e)return;const t=this._tabsNav;let a=e&&!!t?.contains(this.shadowRoot?.activeElement??null);if(e)for(const r of this._getNavItems()){if(r.kind!=="dropdown")continue;const s=this._getDropdownForSlot(r.slotName);a||(a=s===document.activeElement),s?.removeAttribute("open")}this._tabsCollapsed=e,this.toggleAttribute("data-tabs-collapsed",e),a&&this.updateComplete.then(()=>this._menuBtn?.focus())}_observeLayout(){const e=[this._top,this._tabsNav,this._tabsNav?.closest(".tabs-row"),this._menuBtn].filter(t=>!!t);if(!(e.length===this._observedLayout.length&&e.every((t,a)=>t===this._observedLayout[a]))){this._ro?.disconnect(),this._observedLayout=e;for(const t of e)this._ro?.observe(t,{box:"border-box"})}}connectedCallback(){super.connectedCallback(),window.addEventListener("keydown",this._onGlobalFocusRingKeydown,!0),window.addEventListener("pointerdown",this._onGlobalFocusRingPointerDown,!0),this._initialUpgradeComplete||this.setAttribute("data-upgrading",""),this._harvest({scheduleMeasure:!1}),this._attachSlotObservers()}_finishInitialUpgrade(){this._initialUpgradeComplete||(this._initialUpgradeComplete=!0,requestAnimationFrame(()=>{this.isConnected&&(this._measure(),this.removeAttribute("data-upgrading"))}))}firstUpdated(){this._syncLandmarkAttributes(),this.renderRoot.addEventListener("focusin",this._onLocalFocusIn),this.showDrawer&&!this.deferDrawer&&this._ensureDrawerReady(),this.updateComplete.then(()=>{this._harvest({scheduleMeasure:!1}),this._attachSlotObservers(),this._syncDropdownTabs(),this._finishInitialUpgrade()}),this._ro=new ResizeObserver(()=>this._scheduleMeasure()),this._observeLayout(),window.addEventListener("resize",this._onWindowResize,{passive:!0})}updated(e){e.has("searchMax")&&this.style.setProperty("--scb-header-search-max",this.searchMax??"380px"),e.has("searchMin")&&this.style.setProperty("--scb-header-search-min",this.searchMin??"250px"),e.has("searchHeight")&&(this.searchHeight&&this.searchHeight.trim()?this.style.setProperty("--scb-search-height",this.searchHeight.trim()):this.style.removeProperty("--scb-search-height")),(e.has("logoWidth")||e.has("logoHeight")||e.has("logoAspectRatio"))&&this._applyLogoSizing(),(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom"))&&this._applySpacing(),(e.has("paddingInline")||e.has("paddingInlineExpanded"))&&this._applyPaddingInline(),(e.has("banner")||e.has("bannerLabel"))&&this._syncLandmarkAttributes(),(e.has("utilityItems")||e.has("_collapsed")||e.has("_tabsCollapsed")||e.has("_desktop")||e.has("_mobileSearchOpen")||e.has("tabs")||e.has("logoText")||e.has("logotypeText")||e.has("logoSrc")||e.has("logoWidth")||e.has("logoHeight")||e.has("logoAspectRatio")||e.has("activeTab")||e.has("_slotNavItems")||e.has("_slotUtils")||e.has("_slotMenu")||e.has("showDrawer")||e.has("alwaysShowMenuButton")||e.has("showSearch")||e.has("layoutPending")||e.has("searchMax")||e.has("searchMin")||e.has("paddingInline")||e.has("paddingInlineExpanded")||e.has("size"))&&this.updateComplete.then(()=>{this._observeLayout(),this._scheduleMeasure()}),(e.has("showDrawer")||e.has("deferDrawer"))&&this.showDrawer&&!this.deferDrawer&&this._ensureDrawerReady(),e.has("showSearch")&&!this.showSearch&&this._setMobileSearchOpen(!1),e.has("layoutPending")&&!this.layoutPending&&this.requestLayout(),(e.has("activeTab")||e.has("_slotNavItems")||e.has("tabs")||e.has("size"))&&this.updateComplete.then(()=>{this._syncDropdownTabs()})}disconnectedCallback(){this._ro?.disconnect(),this._observedLayout=[],this._slotMo?.disconnect(),this._slotWatchers.forEach(e=>e.disconnect()),this._slotWatchers=[],this.renderRoot.removeEventListener("focusin",this._onLocalFocusIn),window.removeEventListener("keydown",this._onGlobalFocusRingKeydown,!0),window.removeEventListener("pointerdown",this._onGlobalFocusRingPointerDown,!0),window.removeEventListener("resize",this._onWindowResize),super.disconnectedCallback()}_mapSpacingToken(e){if(!e)return;const t=String(e).trim();if(t){if(/^\d+$/.test(t)){const a=Math.max(0,Math.min(14,parseInt(t,10)));return`var(--spacing-${a}, ${I[a]}px)`}return t}}_applySpacing(){const e=this._mapSpacingToken(this.spacing),t=this._mapSpacingToken(this.spacingTop)??e,a=this._mapSpacingToken(this.spacingBottom)??e;t?this.style.setProperty("--scb-header-spacing-block-start",t):this.style.removeProperty("--scb-header-spacing-block-start"),a?this.style.setProperty("--scb-header-spacing-block-end",a):this.style.removeProperty("--scb-header-spacing-block-end")}_applyPaddingInline(){const e=this._mapSpacingToken(this.paddingInline),t=this._mapSpacingToken(this.paddingInlineExpanded)??e;e?this.style.setProperty("--scb-header-padding-inline",e):this.style.removeProperty("--scb-header-padding-inline"),t?this.style.setProperty("--scb-header-padding-inline-expanded",t):this.style.removeProperty("--scb-header-padding-inline-expanded")}_syncLandmarkAttributes(){const e=this.renderRoot.querySelector(".header-landmark");if(!e)return;if(!this.banner){e.removeAttribute("role"),e.removeAttribute("aria-label");return}e.setAttribute("role","banner");const t=(this.bannerLabel??"").trim();t?e.setAttribute("aria-label",t):e.removeAttribute("aria-label")}_applyLogoSizing(){const e=(this.logoWidth??"").trim(),t=(this.logoHeight??"").trim(),a=(this.logoAspectRatio??"").trim();e?this.style.setProperty("--scb-header-logo-img-w",e):this.style.removeProperty("--scb-header-logo-img-w"),t?this.style.setProperty("--scb-header-logo-img-h",t):e?this.style.setProperty("--scb-header-logo-img-h","auto"):this.style.removeProperty("--scb-header-logo-img-h"),a?this.style.setProperty("--scb-header-logo-img-aspect-ratio",a):this.style.removeProperty("--scb-header-logo-img-aspect-ratio")}_closeDrawerNow(){const e=this.renderRoot.querySelector(`#${this._drawerId}`);e&&(e.open=!1)}_openDrawerNow(){const e=this.renderRoot.querySelector(`#${this._drawerId}`);e&&(e.open=!0)}_ensureFocusRingReady(){customElements.get("md-focus-ring")||(this._focusRingImportPromise??(this._focusRingImportPromise=S(()=>import("../../vendor/lazy-focus-ring.js").then(e=>e.i),__vite__mapDeps([0,1,2]),import.meta.url)),this._focusRingImportPromise.then(({ensureFocusRingReady:e})=>{e()}))}async _ensureDrawerReady(){this._drawerReady||(this._drawerImportPromise??(this._drawerImportPromise=Promise.all([S(()=>import("../scb-drawer/scb-drawer.js"),__vite__mapDeps([3,4,5,6,7,8,9,10]),import.meta.url),S(()=>import("../scb-menu/scb-menu.js"),__vite__mapDeps([11,4,5,6,9,10,8,12,2,13,14,15]),import.meta.url),S(()=>import("../scb-search/scb-search.js"),__vite__mapDeps([16,4,5,17,1,18,19,2,0,20,21,6,7]),import.meta.url),S(()=>import("../../vendor/scb-header-drawer.internal.js").then(e=>{this._drawerRenderer=e}),__vite__mapDeps([22,4,5]),import.meta.url),this._ensureDrawerSlotComponentsReady()]).then(()=>{})),await this._drawerImportPromise,this._drawerReady=!0,this._syncDrawerCloseNodes())}_drawerSlotContains(e){return[...this.querySelectorAll('[slot="drawer-menu"], [slot="drawer-close"]')].some(t=>t.matches(e)||!!t.querySelector(e))}async _ensureDrawerSlotComponentsReady(){this.querySelector('[slot="drawer-menu"], [slot="drawer-close"]')&&await Promise.all([this._drawerSlotContains("scb-button")?S(()=>import("../scb-button/scb-button.js"),__vite__mapDeps([23,4,5,2,21,6,9,10]),import.meta.url):Promise.resolve(),this._drawerSlotContains("scb-icon-button")?S(()=>import("../scb-icon-button/scb-icon-button.js"),__vite__mapDeps([24,4,5,2,21,6,9,10]),import.meta.url):Promise.resolve(),this._drawerSlotContains("scb-skeleton")?S(()=>import("../scb-skeleton/scb-skeleton.js"),__vite__mapDeps([25,4,5,6]),import.meta.url):Promise.resolve(),this._drawerSlotContains("scb-grid")?S(()=>import("../scb-grid/scb-grid.js"),__vite__mapDeps([26,4,5,6,9,10,27,28]),import.meta.url):Promise.resolve(),this._drawerSlotContains("scb-grid-item")?S(()=>import("../scb-grid/scb-grid-item.js"),__vite__mapDeps([27,4,5,6,9,10]),import.meta.url):Promise.resolve()])}async _ensureDropdownReady(){customElements.get("scb-dropdown")||(this._dropdownImportPromise??(this._dropdownImportPromise=S(()=>import("../scb-dropdown/scb-dropdown.js").then(()=>{}),__vite__mapDeps([29,4,5,17,1,0,2,21,6,13,23,9,10,7,30,31,18,19,8,32]),import.meta.url)),await this._dropdownImportPromise)}_syncMenuBtnAria(){this.renderRoot.querySelectorAll(".menu-trigger").forEach(e=>{e.setAttribute("aria-expanded",String(this._menuExpanded))})}_getNavItems(){return this._slotNavItems.length?this._slotNavItems:(this.tabs??[]).map(e=>({kind:"tab",...e}))}_getDropdownForSlot(e){const t=this.querySelector(`[slot="${e}"]`);return t?t.tagName.toLowerCase()==="scb-dropdown"?t:t.querySelector("scb-dropdown"):null}_syncDropdownTabs(){this._getNavItems().forEach((e,t)=>{if(e.kind!=="dropdown")return;const a=this._getDropdownForSlot(e.slotName);if(!a)return;const r=String(t);a.getAttribute("data-index")!==r&&a.setAttribute("data-index",r),a.hasAttribute("as-tab")||a.setAttribute("as-tab","");const s=this.size,o=a;o?.size!==s&&(o.size=s),t===this.activeTab?a.getAttribute("aria-current")!=="page"&&a.setAttribute("aria-current","page"):a.hasAttribute("aria-current")&&a.removeAttribute("aria-current")})}_readTabIndexFromEvent(e){const t=e.composedPath?e.composedPath():[];for(const a of t){if(!(a instanceof HTMLElement))continue;const r=a.getAttribute("data-index");if(r==null)continue;const s=Number(r);if(Number.isFinite(s))return s}return null}_focusTabAtIndex(e){const t=this._getNavItems()[e];if(t){if(t.kind==="dropdown"){this._getDropdownForSlot(t.slotName)?.focus?.();return}this.renderRoot.querySelector(`.tab-link[data-index="${e}"]`)?.focus?.()}}_syncFlags(e,t){this.toggleAttribute("data-no-utility",e),this.toggleAttribute("data-no-search",t)}_emitSearchInput(e){this.searchText=e,this.dispatchEvent(new CustomEvent("search-input",{detail:{value:this.searchText},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("searchinput",{detail:{value:this.searchText},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("search-text-change",{detail:{value:this.searchText},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("searchtextchange",{detail:{value:this.searchText},bubbles:!0,composed:!0}))}_emitSearchChange(e,t){this.searchText=e,this.dispatchEvent(new CustomEvent("search-change",{detail:{value:this.searchText,active:t},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("searchchange",{detail:{value:this.searchText,active:t},bubbles:!0,composed:!0}))}_renderMenuButton(e="",t=!1){const a=e?`menu-trigger ${e}`:"menu-trigger",r=(this.menuButtonLabel??"").trim(),s=(this.menuOpenLabel??"").trim()||r,o=this._menuExpanded?"true":"false";return t?v`
56
56
  <button
57
57
  type="button"
58
58
  class=${`${a} header-icon-button`}
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../shared/lazy-focus-ring.js","../../vendor/preload-helper.js"])))=>i.map(i=>d[i]);
2
- import{f,h as m,m as v,p as e,v as c,y}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as z}from"../../vendor/preload-helper.js";import{t as s}from"../../vendor/decorate.js";import{renderScbIcon as h}from"../shared/scb-icon-svg.js";(function(){try{var d=typeof globalThis<"u"?globalThis:window;if(!d.__scb_ce_guard_installed__){d.__scb_ce_guard_installed__=!0;var o=customElements.define.bind(customElements);customElements.define=function(t,l,i){try{customElements.get(t)||o(t,l,i)}catch(a){var n=String(a||"");if(n.indexOf("already been used")===-1&&n.indexOf("NotSupportedError")===-1)throw a}}}}catch{}})();var p,b;function u(){return b??(b=z(()=>import("../shared/lazy-focus-ring.js"),__vite__mapDeps([0,1]),import.meta.url)),b}var r=(p=class extends m{constructor(...o){super(...o),this.variant="standard",this.width="100%",this.showScrollbar=!1,this.rightScrollButtonLabel="Scrolla höger",this.leftScrollButtonLabel="Scrolla vänster",this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this.contentFlex=!1,this.internalGap="",this.snap=!1,this._canScrollLeft=!1,this._canScrollRight=!1,this.__scrollLeft=()=>{this.doScrollBy(-this.getScrollStep())},this.__scrollRight=()=>{this.doScrollBy(this.getScrollStep())},this.updateScrollButtons=()=>{const t=this.scrollerEl||this.shadowRoot?.querySelector(".scb-horizontal-scroller");if(!t){this._canScrollLeft=!1,this._canScrollRight=!1,this.toggleAttribute("data-scroll-left",!1),this.toggleAttribute("data-scroll-right",!1);return}const l=t.scrollLeft>0,i=t.scrollLeft+t.clientWidth<t.scrollWidth-1;this._canScrollLeft=l,this._canScrollRight=i,this.toggleAttribute("data-scroll-left",l),this.toggleAttribute("data-scroll-right",i)},this.lastScrollLeft=0,this.isScrolling=!1,this.scrollEndTimeout=null,this.scrollerEl=null,this.slotEl=null,this.sizeObserver=null,this.resizeRaf=null,this.__onFocusIn=()=>{u().then(({ensureFocusRingReady:t})=>t())},this.__onLazyFocusRingKeydown=t=>{!(t instanceof KeyboardEvent)||t.key!=="Tab"||u().then(({ensureFocusRingOnTab:l})=>l(t))},this.handleScroll=()=>{const t=this.scrollerEl;t&&(this.updateScrollButtons(),this.dispatchCustomEventWithAlias("scb-scroll",{scrollLeft:t.scrollLeft}),this.isScrolling||(this.isScrolling=!0,this.dispatchCustomEventWithAlias("scb-scroll-start",{scrollLeft:t.scrollLeft})),clearTimeout(this.scrollEndTimeout),this.scrollEndTimeout=setTimeout(()=>{this.isScrolling=!1,this.dispatchCustomEventWithAlias("scb-scroll-end",{scrollLeft:t.scrollLeft})},120),t.scrollLeft>this.lastScrollLeft?this.dispatchCustomEventWithAlias("scb-scroll-right",{scrollLeft:t.scrollLeft}):t.scrollLeft<this.lastScrollLeft&&this.dispatchCustomEventWithAlias("scb-scroll-left",{scrollLeft:t.scrollLeft}),this.lastScrollLeft=t.scrollLeft)},this.handleWheel=t=>{const l=this.scrollerEl||this.shadowRoot?.querySelector(".scb-horizontal-scroller");if(!l||t.deltaY===0)return;const i=l.scrollLeft,n=i>0,a=i+l.clientWidth<l.scrollWidth-1;!n&&!a||(l.scrollLeft+=t.deltaY,l.scrollLeft!==i&&t.preventDefault())}}getScrollStep(){const o=this.scrollerEl||this.shadowRoot?.querySelector(".scb-horizontal-scroller");return o?Math.max(Math.round(o.clientWidth*.8),120):200}doScrollBy(o){this.scrollerEl?.scrollBy({left:o,behavior:"smooth"})}connectedCallback(){super.connectedCallback(),this.addEventListener("focusin",this.__onFocusIn),this.addEventListener("keydown",this.__onLazyFocusRingKeydown),this.style.setProperty("--scb-horizontal-scroller-width",this.width)}disconnectedCallback(){this.removeEventListener("focusin",this.__onFocusIn),this.removeEventListener("keydown",this.__onLazyFocusRingKeydown),this.renderRoot.removeEventListener("focusin",this.__onFocusIn),this.renderRoot.removeEventListener("keydown",this.__onLazyFocusRingKeydown),super.disconnectedCallback(),this.scrollerEl&&(this.scrollerEl.removeEventListener("scroll",this.handleScroll),this.scrollerEl.removeEventListener("wheel",this.handleWheel)),this.sizeObserver&&(this.sizeObserver.disconnect(),this.sizeObserver=null),this.resizeRaf!==null&&(cancelAnimationFrame(this.resizeRaf),this.resizeRaf=null),this.scrollEndTimeout&&(clearTimeout(this.scrollEndTimeout),this.scrollEndTimeout=null),this.scrollerEl=null,this.slotEl=null}dispatchCustomEvent(o,t={}){this.dispatchEvent(new CustomEvent(o,{detail:t,bubbles:!0,composed:!0}))}dispatchCustomEventWithAlias(o,t={}){if(this.dispatchCustomEvent(o,t),o.includes("-")){const l=o.replace(/-/g,"");this.dispatchCustomEvent(l,t)}}firstUpdated(){this.renderRoot.addEventListener("focusin",this.__onFocusIn),this.renderRoot.addEventListener("keydown",this.__onLazyFocusRingKeydown),this.scrollerEl=this.shadowRoot?.querySelector(".scb-horizontal-scroller"),this.slotEl=this.shadowRoot?.querySelector("slot"),this.scrollerEl&&(this.scrollerEl.addEventListener("scroll",this.handleScroll),this.scrollerEl.addEventListener("wheel",this.handleWheel,{passive:!1}));const o=()=>{this.resizeRaf===null&&(this.resizeRaf=requestAnimationFrame(()=>{this.resizeRaf=null,this.updateScrollButtons()}))};requestAnimationFrame(()=>{this.updateScrollButtons()}),this.slotEl&&this.slotEl.addEventListener("slotchange",()=>{o()}),this.sizeObserver=new ResizeObserver(()=>{o()}),this.scrollerEl&&this.sizeObserver.observe(this.scrollerEl),this.slotEl&&this.sizeObserver.observe(this.slotEl),this.__applySpacing(),this.__applyInternalGap()}updated(o){o.has("width")&&this.style.setProperty("--scb-horizontal-scroller-width",this.width),(o.has("spacing")||o.has("spacingTop")||o.has("spacingBottom")||o.has("spacingLeft")||o.has("spacingRight"))&&this.__applySpacing(),(o.has("internalGap")||o.has("contentFlex"))&&this.__applyInternalGap()}mapSpacingToken(o){if(!o)return;const t=String(o).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}__applySpacing(){const o=this.mapSpacingToken(this.spacing),t=this.mapSpacingToken(this.spacingTop),l=this.mapSpacingToken(this.spacingBottom),i=this.mapSpacingToken(this.spacingLeft),n=this.mapSpacingToken(this.spacingRight),a=t??o,g=l??o;a?this.style.setProperty("--scb-horizontal-scroller-spacing-block-start",a):this.style.removeProperty("--scb-horizontal-scroller-spacing-block-start"),g?this.style.setProperty("--scb-horizontal-scroller-spacing-block-end",g):this.style.removeProperty("--scb-horizontal-scroller-spacing-block-end"),i?this.style.setProperty("--scb-horizontal-scroller-spacing-inline-start",i):this.style.removeProperty("--scb-horizontal-scroller-spacing-inline-start"),n?this.style.setProperty("--scb-horizontal-scroller-spacing-inline-end",n):this.style.removeProperty("--scb-horizontal-scroller-spacing-inline-end")}__applyInternalGap(){const o=this.mapSpacingToken(this.internalGap);this.contentFlex&&o?this.style.setProperty("--scb-horizontal-scroller-internal-gap",o):this.style.removeProperty("--scb-horizontal-scroller-internal-gap")}render(){const o=this.variant,t=this._canScrollLeft||this._canScrollRight;return o==="inline"?c`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../../vendor/lazy-focus-ring.js","../../vendor/rolldown-runtime.js","../../vendor/preload-helper.js"])))=>i.map(i=>d[i]);
2
+ import{f,h as m,m as v,p as e,v as c,y}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as z}from"../../vendor/preload-helper.js";import{t as s}from"../../vendor/decorate.js";import{t as d}from"../../vendor/scb-icon-svg.js";(function(){try{var h=typeof globalThis<"u"?globalThis:window;if(!h.__scb_ce_guard_installed__){h.__scb_ce_guard_installed__=!0;var o=customElements.define.bind(customElements);customElements.define=function(t,l,i){try{customElements.get(t)||o(t,l,i)}catch(a){var n=String(a||"");if(n.indexOf("already been used")===-1&&n.indexOf("NotSupportedError")===-1)throw a}}}}catch{}})();var p,b;function u(){return b??(b=z(()=>import("../../vendor/lazy-focus-ring.js").then(h=>h.i),__vite__mapDeps([0,1,2]),import.meta.url)),b}var r=(p=class extends m{constructor(...o){super(...o),this.variant="standard",this.width="100%",this.showScrollbar=!1,this.rightScrollButtonLabel="Scrolla höger",this.leftScrollButtonLabel="Scrolla vänster",this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this.contentFlex=!1,this.internalGap="",this.snap=!1,this._canScrollLeft=!1,this._canScrollRight=!1,this.__scrollLeft=()=>{this.doScrollBy(-this.getScrollStep())},this.__scrollRight=()=>{this.doScrollBy(this.getScrollStep())},this.updateScrollButtons=()=>{const t=this.scrollerEl||this.shadowRoot?.querySelector(".scb-horizontal-scroller");if(!t){this._canScrollLeft=!1,this._canScrollRight=!1,this.toggleAttribute("data-scroll-left",!1),this.toggleAttribute("data-scroll-right",!1);return}const l=t.scrollLeft>0,i=t.scrollLeft+t.clientWidth<t.scrollWidth-1;this._canScrollLeft=l,this._canScrollRight=i,this.toggleAttribute("data-scroll-left",l),this.toggleAttribute("data-scroll-right",i)},this.lastScrollLeft=0,this.isScrolling=!1,this.scrollEndTimeout=null,this.scrollerEl=null,this.slotEl=null,this.sizeObserver=null,this.resizeRaf=null,this.__onFocusIn=()=>{u().then(({ensureFocusRingReady:t})=>t())},this.__onLazyFocusRingKeydown=t=>{!(t instanceof KeyboardEvent)||t.key!=="Tab"||u().then(({ensureFocusRingOnTab:l})=>l(t))},this.handleScroll=()=>{const t=this.scrollerEl;t&&(this.updateScrollButtons(),this.dispatchCustomEventWithAlias("scb-scroll",{scrollLeft:t.scrollLeft}),this.isScrolling||(this.isScrolling=!0,this.dispatchCustomEventWithAlias("scb-scroll-start",{scrollLeft:t.scrollLeft})),clearTimeout(this.scrollEndTimeout),this.scrollEndTimeout=setTimeout(()=>{this.isScrolling=!1,this.dispatchCustomEventWithAlias("scb-scroll-end",{scrollLeft:t.scrollLeft})},120),t.scrollLeft>this.lastScrollLeft?this.dispatchCustomEventWithAlias("scb-scroll-right",{scrollLeft:t.scrollLeft}):t.scrollLeft<this.lastScrollLeft&&this.dispatchCustomEventWithAlias("scb-scroll-left",{scrollLeft:t.scrollLeft}),this.lastScrollLeft=t.scrollLeft)},this.handleWheel=t=>{const l=this.scrollerEl||this.shadowRoot?.querySelector(".scb-horizontal-scroller");if(!l||t.deltaY===0)return;const i=l.scrollLeft,n=i>0,a=i+l.clientWidth<l.scrollWidth-1;!n&&!a||(l.scrollLeft+=t.deltaY,l.scrollLeft!==i&&t.preventDefault())}}getScrollStep(){const o=this.scrollerEl||this.shadowRoot?.querySelector(".scb-horizontal-scroller");return o?Math.max(Math.round(o.clientWidth*.8),120):200}doScrollBy(o){this.scrollerEl?.scrollBy({left:o,behavior:"smooth"})}connectedCallback(){super.connectedCallback(),this.addEventListener("focusin",this.__onFocusIn),this.addEventListener("keydown",this.__onLazyFocusRingKeydown),this.style.setProperty("--scb-horizontal-scroller-width",this.width)}disconnectedCallback(){this.removeEventListener("focusin",this.__onFocusIn),this.removeEventListener("keydown",this.__onLazyFocusRingKeydown),this.renderRoot.removeEventListener("focusin",this.__onFocusIn),this.renderRoot.removeEventListener("keydown",this.__onLazyFocusRingKeydown),super.disconnectedCallback(),this.scrollerEl&&(this.scrollerEl.removeEventListener("scroll",this.handleScroll),this.scrollerEl.removeEventListener("wheel",this.handleWheel)),this.sizeObserver&&(this.sizeObserver.disconnect(),this.sizeObserver=null),this.resizeRaf!==null&&(cancelAnimationFrame(this.resizeRaf),this.resizeRaf=null),this.scrollEndTimeout&&(clearTimeout(this.scrollEndTimeout),this.scrollEndTimeout=null),this.scrollerEl=null,this.slotEl=null}dispatchCustomEvent(o,t={}){this.dispatchEvent(new CustomEvent(o,{detail:t,bubbles:!0,composed:!0}))}dispatchCustomEventWithAlias(o,t={}){if(this.dispatchCustomEvent(o,t),o.includes("-")){const l=o.replace(/-/g,"");this.dispatchCustomEvent(l,t)}}firstUpdated(){this.renderRoot.addEventListener("focusin",this.__onFocusIn),this.renderRoot.addEventListener("keydown",this.__onLazyFocusRingKeydown),this.scrollerEl=this.shadowRoot?.querySelector(".scb-horizontal-scroller"),this.slotEl=this.shadowRoot?.querySelector("slot"),this.scrollerEl&&(this.scrollerEl.addEventListener("scroll",this.handleScroll),this.scrollerEl.addEventListener("wheel",this.handleWheel,{passive:!1}));const o=()=>{this.resizeRaf===null&&(this.resizeRaf=requestAnimationFrame(()=>{this.resizeRaf=null,this.updateScrollButtons()}))};requestAnimationFrame(()=>{this.updateScrollButtons()}),this.slotEl&&this.slotEl.addEventListener("slotchange",()=>{o()}),this.sizeObserver=new ResizeObserver(()=>{o()}),this.scrollerEl&&this.sizeObserver.observe(this.scrollerEl),this.slotEl&&this.sizeObserver.observe(this.slotEl),this.__applySpacing(),this.__applyInternalGap()}updated(o){o.has("width")&&this.style.setProperty("--scb-horizontal-scroller-width",this.width),(o.has("spacing")||o.has("spacingTop")||o.has("spacingBottom")||o.has("spacingLeft")||o.has("spacingRight"))&&this.__applySpacing(),(o.has("internalGap")||o.has("contentFlex"))&&this.__applyInternalGap()}mapSpacingToken(o){if(!o)return;const t=String(o).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}__applySpacing(){const o=this.mapSpacingToken(this.spacing),t=this.mapSpacingToken(this.spacingTop),l=this.mapSpacingToken(this.spacingBottom),i=this.mapSpacingToken(this.spacingLeft),n=this.mapSpacingToken(this.spacingRight),a=t??o,g=l??o;a?this.style.setProperty("--scb-horizontal-scroller-spacing-block-start",a):this.style.removeProperty("--scb-horizontal-scroller-spacing-block-start"),g?this.style.setProperty("--scb-horizontal-scroller-spacing-block-end",g):this.style.removeProperty("--scb-horizontal-scroller-spacing-block-end"),i?this.style.setProperty("--scb-horizontal-scroller-spacing-inline-start",i):this.style.removeProperty("--scb-horizontal-scroller-spacing-inline-start"),n?this.style.setProperty("--scb-horizontal-scroller-spacing-inline-end",n):this.style.removeProperty("--scb-horizontal-scroller-spacing-inline-end")}__applyInternalGap(){const o=this.mapSpacingToken(this.internalGap);this.contentFlex&&o?this.style.setProperty("--scb-horizontal-scroller-internal-gap",o):this.style.removeProperty("--scb-horizontal-scroller-internal-gap")}render(){const o=this.variant,t=this._canScrollLeft||this._canScrollRight;return o==="inline"?c`
3
3
  <div class="scb-horizontal-scroller ${t?"canScroll":""}" tabindex="0">
4
4
  <slot></slot>
5
5
  <md-focus-ring inward></md-focus-ring>
@@ -13,7 +13,7 @@ import{f,h as m,m as v,p as e,v as c,y}from"../../vendor/vendor.js";import"../..
13
13
  aria-label=${this.leftScrollButtonLabel}
14
14
  @click=${this.__scrollLeft}
15
15
  >
16
- ${h("chevron_left","scroll-control-icon")}
16
+ ${d("chevron_left","scroll-control-icon")}
17
17
  <span>${this.leftScrollButtonLabel}</span>
18
18
  </button>
19
19
  `:""}
@@ -26,7 +26,7 @@ import{f,h as m,m as v,p as e,v as c,y}from"../../vendor/vendor.js";import"../..
26
26
  @click=${this.__scrollRight}
27
27
  >
28
28
  <span>${this.rightScrollButtonLabel}</span>
29
- ${h("chevron_right","scroll-control-icon")}
29
+ ${d("chevron_right","scroll-control-icon")}
30
30
  </button>
31
31
  `:""}
32
32
  </div>
@@ -39,7 +39,7 @@ import{f,h as m,m as v,p as e,v as c,y}from"../../vendor/vendor.js";import"../..
39
39
  aria-label=${this.leftScrollButtonLabel}
40
40
  @click=${this.__scrollLeft}
41
41
  >
42
- ${h("chevron_left","scroll-control-icon")}
42
+ ${d("chevron_left","scroll-control-icon")}
43
43
  </button>
44
44
  `:""}
45
45
  <div class="scroll-shadow-left"></div>
@@ -55,7 +55,7 @@ import{f,h as m,m as v,p as e,v as c,y}from"../../vendor/vendor.js";import"../..
55
55
  aria-label=${this.rightScrollButtonLabel}
56
56
  @click=${this.__scrollRight}
57
57
  >
58
- ${h("chevron_right","scroll-control-icon")}
58
+ ${d("chevron_right","scroll-control-icon")}
59
59
  </button>
60
60
  `:""}
61
61
  `}},p.styles=y`:host{display:flex;position:relative;align-items:center;gap:var(--scb-horizontal-scroller-design-scroller-host-gap-medium);padding:0;overflow:hidden;margin-block-start:var(--scb-horizontal-scroller-spacing-block-start, 0);margin-block-end:var(--scb-horizontal-scroller-spacing-block-end, 0);margin-inline-start:var(--scb-horizontal-scroller-spacing-inline-start, 0);margin-inline-end:var(--scb-horizontal-scroller-spacing-inline-end, 0)}.scb-horizontal-scroller{overflow-x:auto;-ms-overflow-style:none;scrollbar-width:none;width:100%;--scb-effect-mask-edge-fade-size:var(--scb-horizontal-scroller-design-scroller-edge-fade-size-medium)}:host([snap]) .scb-horizontal-scroller{scroll-snap-type:x mandatory}:host([data-scroll-left]:not([variant='inline'])) .scb-horizontal-scroller{-webkit-mask-image:var(--scb-effect-mask-horizontal-start);mask-image:var(--scb-effect-mask-horizontal-start)}:host([data-scroll-right]:not([variant='inline'])) .scb-horizontal-scroller{-webkit-mask-image:var(--scb-effect-mask-horizontal-end);mask-image:var(--scb-effect-mask-horizontal-end)}:host([data-scroll-left][data-scroll-right]:not([variant='inline'])) .scb-horizontal-scroller{-webkit-mask-image:var(--scb-effect-mask-horizontal-both);mask-image:var(--scb-effect-mask-horizontal-both)}:host([show-scrollbar]) .scb-horizontal-scroller{scrollbar-width:auto}:host([content-flex]) .scb-horizontal-scroller{display:flex;flex-direction:row;flex:1 1 auto}.scb-horizontal-scroller::-webkit-scrollbar{border-radius:var(--md-sys-shape-corner-large);height:var(--scb-horizontal-scroller-design-scroller-scrollbar-height-medium);width:var(--scb-horizontal-scroller-design-scroller-scrollbar-width-medium)}.scb-horizontal-scroller::-webkit-scrollbar-thumb{background:var(--scb-horizontal-scroller-scrollbar-thumb-color, var(--md-sys-color-on-surface));border-radius:var(--md-sys-shape-corner-large);cursor:pointer}.scb-horizontal-scroller::-webkit-scrollbar-track{background:var(--scb-horizontal-scroller-scrollbar-track-color, var(--md-sys-color-secondary-container));border-radius:var(--md-sys-shape-corner-large)}.scb-horizontal-scroller:focus,.scroll-control:focus,.scroll-text-button:focus{outline:0}md-focus-ring{border-radius:var(--scb-card-focus-ring-radius, var(--md-sys-shape-corner-large))}:host([show-scrollbar]) .scb-horizontal-scroller.canScroll{padding-bottom:var(--scb-horizontal-scroller-design-scroller-scrollbar-padding-block-end-medium)}slot{display:block;box-sizing:border-box;padding-block:var(--scb-horizontal-scroller-design-scroller-slot-padding-block-medium);padding-inline:var(--scb-horizontal-scroller-design-scroller-slot-padding-inline-medium);min-width:var(--scb-horizontal-scroller-width, auto)}:host([content-flex]) .scb-horizontal-scroller slot{display:flex;gap:var(--scb-horizontal-scroller-internal-gap)}:host([snap]) slot::slotted(*){scroll-snap-align:start;scroll-snap-stop:always}.scroll-button-left{left:0;position:absolute;z-index:3}.scroll-button-right{right:2px;position:absolute;z-index:3}.scroll-control,.scroll-text-button{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;border:0;font-family:var(--brand-font, var(--brand, "Inter"), sans-serif);font-weight:var(--weight-semibold, 600);cursor:pointer;appearance:none;-webkit-appearance:none;-webkit-tap-highlight-color:transparent;touch-action:manipulation;border-radius:var(--radius-full, 1000px)}.scroll-control{inline-size:var(--scb-horizontal-scroller-design-scroller-control-size-medium);block-size:var(--scb-horizontal-scroller-design-scroller-control-size-medium);padding:0;overflow:hidden;background:var(--scb-horizontal-scroller-control-container-color, var(--md-sys-color-secondary-container, var(--p-90)));color:var(--scb-horizontal-scroller-control-content-color, var(--md-sys-color-on-secondary-container, var(--p-30)))}.scroll-text-button{position:relative;min-block-size:calc(var(--scb-typography-label-small-line-height, var(--md-sys-typescale-label-small-line-height, 20px)) + var(--scb-horizontal-scroller-design-scroller-text-padding-block-medium) + var(--scb-horizontal-scroller-design-scroller-text-padding-block-medium));gap:var(--scb-horizontal-scroller-design-scroller-text-gap-medium);padding-block:var(--scb-horizontal-scroller-design-scroller-text-padding-block-medium);padding-inline:var(--scb-horizontal-scroller-design-scroller-text-padding-inline-medium);background:0 0;color:var(--scb-horizontal-scroller-text-content-color, var(--md-sys-color-primary, var(--p-40)));font-size:var(--scb-typography-label-small-size, var(--md-sys-typescale-label-small-size, 16px));line-height:var(--scb-typography-label-small-line-height, var(--md-sys-typescale-label-small-line-height, 20px));letter-spacing:var(--scb-typography-label-small-tracking, var(--md-sys-typescale-label-small-tracking, 0))}.scroll-control::before,.scroll-text-button::before{content:"";position:absolute;inset:0;border-radius:inherit;background:currentColor;opacity:0;pointer-events:none;transition:opacity var(--motion-duration-short, 150ms) var(--motion-easing-standard, ease)}.scroll-control:hover::before,.scroll-text-button:hover::before{opacity:var(--md-sys-state-hover-state-layer-opacity, 0.08)}.scroll-control:active::before,.scroll-text-button:active::before{opacity:var(--md-sys-state-pressed-state-layer-opacity, 0.12)}.scroll-control:focus-visible,.scroll-text-button:focus-visible{outline:var(--stroke-border-m, 2px) solid var(--md-focus-ring-color, var(--md-sys-color-primary, var(--p-40)));outline-offset:var(--spacing-1, 2px)}.scroll-control-icon{position:relative;display:inline-block;inline-size:var(--scb-horizontal-scroller-design-scroller-control-icon-size-medium);block-size:var(--scb-horizontal-scroller-design-scroller-control-icon-size-medium);overflow:hidden;font-family:"Material Symbols Outlined";font-size:var(--scb-horizontal-scroller-design-scroller-control-icon-size-medium);line-height:1;text-align:center;white-space:nowrap;text-transform:none;word-wrap:normal;direction:ltr;font-feature-settings:"liga"1;font-variation-settings:"FILL"0,"wght"400,"GRAD"0,"opsz"24;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.scroll-control-icon.scb-svg-icon{fill:currentColor;font:inherit}.scroll-shadow-left,.scroll-shadow-right{position:absolute;top:0;width:5px;bottom:0;pointer-events:none;background:0 0;box-shadow:none;transition:box-shadow .2s;z-index:2}.scroll-shadow-left{left:0}.scroll-shadow-right{right:0}:host([data-scroll-left]) .scroll-shadow-left{background:0 0;box-shadow:12px 0 30px color-mix(in srgb,currentColor 18%,transparent),4px 0 12px color-mix(in srgb,currentColor 12%,transparent)}:host([data-scroll-left]) .scroll-shadow-left::after,:host([data-scroll-right]) .scroll-shadow-right::after{content:"";position:absolute;inset-block:0}:host([data-scroll-right]) .scroll-shadow-right{background:0 0;box-shadow:-12px 0 30px color-mix(in srgb,currentColor 18%,transparent),-4px 0 12px color-mix(in srgb,currentColor 12%,transparent)}:host([variant='inline']){flex-direction:column;align-items:unset;padding:0}:host([variant='inline'][show-scrollbar]){gap:var(--spacing-5)}:host{--scb-horizontal-scroller-design-scroller-host-gap-medium:var(--scb-horizontal-scroller-host-gap, var(--spacing-3, 8px));--scb-horizontal-scroller-design-scroller-edge-fade-size-medium:var(--scb-horizontal-scroller-edge-fade-size, var(--scale-12, 56px));--scb-horizontal-scroller-design-scroller-slot-padding-block-medium:var(--scb-horizontal-scroller-slot-padding-block, var(--spacing-3, 8px));--scb-horizontal-scroller-design-scroller-slot-padding-inline-medium:var(--scb-horizontal-scroller-slot-padding-inline, var(--spacing-1, 2px));--scb-horizontal-scroller-design-scroller-control-size-medium:var(--scb-horizontal-scroller-control-size, var(--scb-control-size-medium, var(--scale-10, 40px)));--scb-horizontal-scroller-design-scroller-control-icon-size-medium:var(--scb-horizontal-scroller-control-icon-size, var(--icon-size-medium, 24px));--scb-horizontal-scroller-design-scroller-text-gap-medium:var(--scb-horizontal-scroller-text-gap, var(--spacing-3, 8px));--scb-horizontal-scroller-design-scroller-text-padding-block-medium:var(--scb-horizontal-scroller-text-padding-block, calc(var(--spacing-4, 12px) - var(--spacing-1, 2px)));--scb-horizontal-scroller-design-scroller-text-padding-inline-medium:var(--scb-horizontal-scroller-text-padding-inline, var(--spacing-5, 16px));--scb-horizontal-scroller-design-scroller-scrollbar-height-medium:var(--scb-horizontal-scroller-scrollbar-height, var(--spacing-2, 4px));--scb-horizontal-scroller-design-scroller-scrollbar-width-medium:var(--scb-horizontal-scroller-scrollbar-width, var(--spacing-3, 8px));--scb-horizontal-scroller-design-scroller-scrollbar-padding-block-end-medium:var(--scb-horizontal-scroller-scrollbar-padding-block-end, var(--spacing-5, 16px))}`,p);s([e({type:String,reflect:!0})],r.prototype,"variant",void 0);s([e({type:String,reflect:!0})],r.prototype,"width",void 0);s([e({type:Boolean,reflect:!0,attribute:"show-scrollbar"})],r.prototype,"showScrollbar",void 0);s([e({type:String,reflect:!0,attribute:"right-scroll-button-label"})],r.prototype,"rightScrollButtonLabel",void 0);s([e({type:String,reflect:!0,attribute:"left-scroll-button-label"})],r.prototype,"leftScrollButtonLabel",void 0);s([e({type:String,reflect:!0})],r.prototype,"spacing",void 0);s([e({type:String,reflect:!0,attribute:"spacing-top"})],r.prototype,"spacingTop",void 0);s([e({type:String,reflect:!0,attribute:"spacing-bottom"})],r.prototype,"spacingBottom",void 0);s([e({type:String,reflect:!0,attribute:"spacing-left"})],r.prototype,"spacingLeft",void 0);s([e({type:String,reflect:!0,attribute:"spacing-right"})],r.prototype,"spacingRight",void 0);s([e({type:Boolean,reflect:!0,attribute:"content-flex"})],r.prototype,"contentFlex",void 0);s([e({type:String,reflect:!0,attribute:"internal-gap"})],r.prototype,"internalGap",void 0);s([e({type:Boolean,reflect:!0})],r.prototype,"snap",void 0);s([f()],r.prototype,"_canScrollLeft",void 0);s([f()],r.prototype,"_canScrollRight",void 0);r=s([v("scb-horizontal-scroller")],r);
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../shared/lazy-focus-ring.js","../../vendor/preload-helper.js","../shared/lazy-ripple.js"])))=>i.map(i=>d[i]);
2
- import{g as s,h as y,m as x,p as r,v as d,y as z}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as _}from"../../vendor/preload-helper.js";import{t as R}from"../../vendor/component-defaults.js";import{t as e}from"../../vendor/decorate.js";import{t as g}from"../../vendor/assertClassBrand.js";import{t as k}from"../../vendor/classPrivateMethodInitSpec.js";(function(){try{var l=typeof globalThis<"u"?globalThis:window;if(!l.__scb_ce_guard_installed__){l.__scb_ce_guard_installed__=!0;var o=customElements.define.bind(customElements);customElements.define=function(t,i,a){try{customElements.get(t)||o(t,i,a)}catch(u){var c=String(u||"");if(c.indexOf("already been used")===-1&&c.indexOf("NotSupportedError")===-1)throw u}}}}catch{}})();var b,p,v,h;function S(){return v??(v=_(()=>import("../shared/lazy-focus-ring.js"),__vite__mapDeps([0,1]),import.meta.url)),v}function m(){return h??(h=_(()=>import("../shared/lazy-ripple.js"),__vite__mapDeps([2,1]),import.meta.url)),h}var n=(b=new WeakSet,p=class extends y{constructor(...o){super(...o),k(this,b),this.icon="home",this.ariaLabel="",this.variant="standard",this.size=R["scb-icon-button"].size,this.toggle=!1,this.selected=!1,this.toggleofficon="add",this.toggleonicon="remove",this.disabled=!1,this.href="",this.target="",this.rel="",this.__filledValue=!1,this.__focusRingReady=!1,this.__focusRingImportRequested=!1,this.__rippleReady=!1,this.__pendingRippleClick=!1,this.__ensureFocusRing=()=>{this.__focusRingReady||this.__focusRingImportRequested||(this.__focusRingImportRequested=!0,S().then(({ensureFocusRingReady:t})=>(t(),customElements.whenDefined("md-focus-ring"))).then(()=>{this.__focusRingReady=!0,this.toggleAttribute("data-native-focus-ring-ready",!0),this.requestUpdate(),this.updateComplete.then(()=>this.__syncInteractiveState())}))},this.__onFocusIn=t=>{const i=t.composedPath()[0];i instanceof HTMLElement&&i.matches(":focus-visible")&&this.__ensureFocusRing()},this.__ensureRipple=(t,i=!1)=>{this.__rippleReady||this.disabled||(t&&(this.__pendingRippleEvent=t),i&&(this.__pendingRippleClick=!0),m().then(({ensureRippleReady:a})=>a()).then(()=>{this.disabled||(this.__rippleReady=!0,this.toggleAttribute("data-native-ripple-ready",!0),this.requestUpdate(),this.updateComplete.then(()=>this.__replayRippleState()))}))},this.__onPointerInteraction=t=>{this.__ensureRipple(t)},this.__onClick=t=>{if(this.disabled){t.preventDefault(),t.stopPropagation();return}this.toggle&&(this.selected=!this.selected,this.dispatchEvent(new CustomEvent("change",{detail:{selected:this.selected},bubbles:!0,composed:!0}))),this.__ensureRipple(void 0,!0)}}get filled(){return this.__filledValue}set filled(o){const t=!!o,i=this.__filledValue;i!==t&&(this.__filledValue=t,this.requestUpdate("filled",i),this.requestUpdate("iconFilled",i))}get iconFilled(){return this.__filledValue}set iconFilled(o){const t=!!o,i=this.__filledValue;i!==t&&(this.__filledValue=t,this.requestUpdate("iconFilled",i),this.requestUpdate("filled",i))}firstUpdated(){g(b,this,f).call(this),this.__syncInteractiveState()}updated(o){super.updated(o),(o.has("spacing")||o.has("spacingTop")||o.has("spacingBottom")||o.has("spacingLeft")||o.has("spacingRight"))&&g(b,this,f).call(this),(this.__focusRingReady||this.__rippleReady)&&this.updateComplete.then(()=>this.__syncInteractiveState())}focus(o){const t=this.__getNativeControl();if(t){t.focus(o);return}super.focus(o)}__getNativeControl(){return this.renderRoot.querySelector(".native-icon-button")}__syncInteractiveState(){const o=this.__getNativeControl(),t=this.renderRoot.querySelector("md-focus-ring");t&&o&&(t.control=o,t.visible=o.matches(":focus-visible"));const i=this.renderRoot.querySelector("md-ripple");i&&o&&(i.control=o)}async __replayRippleState(){const o=this.renderRoot.querySelector("md-ripple"),t=this.__getNativeControl(),i=this.__pendingRippleEvent,a=this.__pendingRippleClick;this.__pendingRippleEvent=void 0,this.__pendingRippleClick=!1;const{syncRippleToControl:c}=await m();await c(o,t,i,a),this.__syncInteractiveState()}__effectiveLabel(){return(this.ariaLabel||this.getAttribute("aria-label")||"").trim()||this.__currentIcon()||s}__currentIcon(){return this.toggle?this.selected?this.toggleonicon:this.toggleofficon:this.icon}mapSpacingToken(o){if(!o)return;const t=String(o).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}__renderControl(o){const t=this.__effectiveLabel(),i=this.getAttribute("aria-controls")??s,a=this.getAttribute("aria-expanded")??s,c=this.toggle?String(this.selected):s,u=this.getAttribute("title")??s;return this.href?d`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../../vendor/lazy-focus-ring.js","../../vendor/rolldown-runtime.js","../../vendor/preload-helper.js","../../vendor/lazy-ripple.js"])))=>i.map(i=>d[i]);
2
+ import{g as s,h as y,m as x,p as r,v as d,y as z}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as _}from"../../vendor/preload-helper.js";import{t as R}from"../../vendor/component-defaults.js";import{t as e}from"../../vendor/decorate.js";import{t as g}from"../../vendor/assertClassBrand.js";import{t as k}from"../../vendor/classPrivateMethodInitSpec.js";(function(){try{var c=typeof globalThis<"u"?globalThis:window;if(!c.__scb_ce_guard_installed__){c.__scb_ce_guard_installed__=!0;var o=customElements.define.bind(customElements);customElements.define=function(t,i,a){try{customElements.get(t)||o(t,i,a)}catch(u){var l=String(u||"");if(l.indexOf("already been used")===-1&&l.indexOf("NotSupportedError")===-1)throw u}}}}catch{}})();var b,p,v,h;function S(){return v??(v=_(()=>import("../../vendor/lazy-focus-ring.js").then(c=>c.i),__vite__mapDeps([0,1,2]),import.meta.url)),v}function m(){return h??(h=_(()=>import("../../vendor/lazy-ripple.js"),__vite__mapDeps([3,2]),import.meta.url)),h}var n=(b=new WeakSet,p=class extends y{constructor(...o){super(...o),k(this,b),this.icon="home",this.ariaLabel="",this.variant="standard",this.size=R["scb-icon-button"].size,this.toggle=!1,this.selected=!1,this.toggleofficon="add",this.toggleonicon="remove",this.disabled=!1,this.href="",this.target="",this.rel="",this.__filledValue=!1,this.__focusRingReady=!1,this.__focusRingImportRequested=!1,this.__rippleReady=!1,this.__pendingRippleClick=!1,this.__ensureFocusRing=()=>{this.__focusRingReady||this.__focusRingImportRequested||(this.__focusRingImportRequested=!0,S().then(({ensureFocusRingReady:t})=>(t(),customElements.whenDefined("md-focus-ring"))).then(()=>{this.__focusRingReady=!0,this.toggleAttribute("data-native-focus-ring-ready",!0),this.requestUpdate(),this.updateComplete.then(()=>this.__syncInteractiveState())}))},this.__onFocusIn=t=>{const i=t.composedPath()[0];i instanceof HTMLElement&&i.matches(":focus-visible")&&this.__ensureFocusRing()},this.__ensureRipple=(t,i=!1)=>{this.__rippleReady||this.disabled||(t&&(this.__pendingRippleEvent=t),i&&(this.__pendingRippleClick=!0),m().then(({ensureRippleReady:a})=>a()).then(()=>{this.disabled||(this.__rippleReady=!0,this.toggleAttribute("data-native-ripple-ready",!0),this.requestUpdate(),this.updateComplete.then(()=>this.__replayRippleState()))}))},this.__onPointerInteraction=t=>{this.__ensureRipple(t)},this.__onClick=t=>{if(this.disabled){t.preventDefault(),t.stopPropagation();return}this.toggle&&(this.selected=!this.selected,this.dispatchEvent(new CustomEvent("change",{detail:{selected:this.selected},bubbles:!0,composed:!0}))),this.__ensureRipple(void 0,!0)}}get filled(){return this.__filledValue}set filled(o){const t=!!o,i=this.__filledValue;i!==t&&(this.__filledValue=t,this.requestUpdate("filled",i),this.requestUpdate("iconFilled",i))}get iconFilled(){return this.__filledValue}set iconFilled(o){const t=!!o,i=this.__filledValue;i!==t&&(this.__filledValue=t,this.requestUpdate("iconFilled",i),this.requestUpdate("filled",i))}firstUpdated(){g(b,this,f).call(this),this.__syncInteractiveState()}updated(o){super.updated(o),(o.has("spacing")||o.has("spacingTop")||o.has("spacingBottom")||o.has("spacingLeft")||o.has("spacingRight"))&&g(b,this,f).call(this),(this.__focusRingReady||this.__rippleReady)&&this.updateComplete.then(()=>this.__syncInteractiveState())}focus(o){const t=this.__getNativeControl();if(t){t.focus(o);return}super.focus(o)}__getNativeControl(){return this.renderRoot.querySelector(".native-icon-button")}__syncInteractiveState(){const o=this.__getNativeControl(),t=this.renderRoot.querySelector("md-focus-ring");t&&o&&(t.control=o,t.visible=o.matches(":focus-visible"));const i=this.renderRoot.querySelector("md-ripple");i&&o&&(i.control=o)}async __replayRippleState(){const o=this.renderRoot.querySelector("md-ripple"),t=this.__getNativeControl(),i=this.__pendingRippleEvent,a=this.__pendingRippleClick;this.__pendingRippleEvent=void 0,this.__pendingRippleClick=!1;const{syncRippleToControl:l}=await m();await l(o,t,i,a),this.__syncInteractiveState()}__effectiveLabel(){return(this.ariaLabel||this.getAttribute("aria-label")||"").trim()||this.__currentIcon()||s}__currentIcon(){return this.toggle?this.selected?this.toggleonicon:this.toggleofficon:this.icon}mapSpacingToken(o){if(!o)return;const t=String(o).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}__renderControl(o){const t=this.__effectiveLabel(),i=this.getAttribute("aria-controls")??s,a=this.getAttribute("aria-expanded")??s,l=this.toggle?String(this.selected):s,u=this.getAttribute("title")??s;return this.href?d`
3
3
  <a
4
4
  class="native-icon-button"
5
5
  part="button"
@@ -10,7 +10,7 @@ import{g as s,h as y,m as x,p as r,v as d,y as z}from"../../vendor/vendor.js";im
10
10
  aria-label=${t}
11
11
  aria-controls=${i}
12
12
  aria-expanded=${a}
13
- aria-pressed=${c}
13
+ aria-pressed=${l}
14
14
  aria-disabled=${this.disabled?"true":s}
15
15
  tabindex=${this.disabled?"-1":s}
16
16
  @click=${this.__onClick}
@@ -30,7 +30,7 @@ import{g as s,h as y,m as x,p as r,v as d,y as z}from"../../vendor/vendor.js";im
30
30
  aria-label=${t}
31
31
  aria-controls=${i}
32
32
  aria-expanded=${a}
33
- aria-pressed=${c}
33
+ aria-pressed=${l}
34
34
  @click=${this.__onClick}
35
35
  @focusin=${this.__onFocusIn}
36
36
  @pointerenter=${this.__onPointerInteraction}
@@ -56,4 +56,4 @@ import{g as s,h as y,m as x,p as r,v as d,y as z}from"../../vendor/vendor.js";im
56
56
  var(--scb-icon-button-tonal-selected-container-color, var(--md-sys-color-secondary-container, var(--p-90)))
57
57
  );color:var(--md-filled-tonal-icon-button-selected-icon-color,
58
58
  var(--scb-icon-button-tonal-selected-content-color, var(--md-sys-color-on-secondary-container, var(--p-30)))
59
- )}:host([variant='outlined'][toggle][selected]) .native-icon-button{color:var(--md-outlined-icon-button-selected-icon-color, var(--scb-icon-button-outlined-selected-content-color, var(--md-sys-color-primary, var(--p-40))));box-shadow:inset 0 0 0 var(--stroke-border, 1px) var(--md-outlined-icon-button-selected-outline-color, var(--scb-icon-button-outlined-selected-outline-color, var(--md-sys-color-outline, var(--p-20))))}.native-icon-button:disabled,.native-icon-button[aria-disabled=true]{color:var(--md-icon-button-disabled-icon-color, var(--_disabled-content-color, var(--scb-color-compat-disabled-content)));cursor:default;pointer-events:none}:host([variant='filled']) .native-icon-button:disabled,:host([variant='filled']) .native-icon-button[aria-disabled=true],:host([variant='filled-tonal']) .native-icon-button:disabled,:host([variant='filled-tonal']) .native-icon-button[aria-disabled=true]{background:var(--md-filled-icon-button-disabled-container-color, var(--_disabled-container-color, var(--scb-color-compat-disabled-container)));color:var(--md-filled-icon-button-disabled-icon-color, var(--_disabled-content-color, var(--scb-color-compat-disabled-content)))}:host([variant='outlined']) .native-icon-button:disabled,:host([variant='outlined']) .native-icon-button[aria-disabled=true]{color:var(--md-outlined-icon-button-disabled-icon-color, var(--_disabled-content-color, var(--scb-color-compat-disabled-content)));box-shadow:inset 0 0 0 var(--stroke-border, 1px) var(--md-outlined-icon-button-disabled-outline-color, var(--_disabled-outline-color, var(--scb-color-compat-disabled-container)))}.native-icon-button-wrap md-ripple{position:absolute;inset:0;--md-ripple-hover-color:var(--scb-icon-button-state-layer-color, currentColor);--md-ripple-pressed-color:var(--scb-icon-button-state-layer-color, currentColor)}.native-icon-button-wrap md-focus-ring,.native-icon-button-wrap md-ripple{pointer-events:none;border-radius:inherit}:host{--scb-icon-button-design-height-tiny:var(--scb-buttons-control-size-tiny, var(--scb-control-size-tiny, var(--scale-06, 24px)));--scb-icon-button-design-height-extra-small:var(--scb-buttons-control-size-extra-small, var(--scale-07, 28px));--scb-icon-button-design-height-small:var(--scb-buttons-control-size-small, var(--scb-control-size-small, var(--scale-08, 32px)));--scb-icon-button-design-height-medium:var(--scb-buttons-control-size-medium, var(--scb-control-size-medium, var(--scale-10, 40px)));--scb-icon-button-design-height-large:var(--scb-buttons-control-size-large, var(--scb-control-size-large, var(--scale-12, 56px)));--scb-icon-button-design-icon-tiny:var(--scb-buttons-icon-size-tiny, var(--icon-size-tiny, 12px));--scb-icon-button-design-icon-extra-small:var(--scb-buttons-icon-size-extra-small, var(--icon-size-small, 20px));--scb-icon-button-design-icon-small:var(--scb-buttons-icon-size-small, var(--icon-size-small, 20px));--scb-icon-button-design-icon-medium:var(--scb-icon-button-icon-size-medium, var(--icon-size-medium, 24px));--scb-icon-button-design-icon-large:var(--scb-icon-button-icon-size-large, var(--icon-size-large, 32px));--scb-icon-button-design-icon-button-round-radius-tiny:var(--scb-buttons-shape-radius-tiny, var(--radius-full, 1000px));--scb-icon-button-design-icon-button-round-radius-extra-small:var(--scb-buttons-shape-radius-extra-small, var(--radius-full, 1000px));--scb-icon-button-design-icon-button-round-radius-small:var(--scb-buttons-shape-radius-small, var(--radius-full, 1000px));--scb-icon-button-design-icon-button-round-radius-medium:var(--scb-buttons-shape-radius-medium, var(--radius-full, 1000px));--scb-icon-button-design-icon-button-round-radius-large:var(--scb-buttons-shape-radius-large, var(--radius-full, 1000px))}`,p);function f(){const l=this.mapSpacingToken(this.spacing),o=this.mapSpacingToken(this.spacingTop)??l,t=this.mapSpacingToken(this.spacingBottom)??l,i=this.mapSpacingToken(this.spacingLeft),a=this.mapSpacingToken(this.spacingRight);o?this.style.setProperty("--scb-icon-button-spacing-block-start",o):this.style.removeProperty("--scb-icon-button-spacing-block-start"),t?this.style.setProperty("--scb-icon-button-spacing-block-end",t):this.style.removeProperty("--scb-icon-button-spacing-block-end"),i?this.style.setProperty("--scb-icon-button-spacing-inline-start",i):this.style.removeProperty("--scb-icon-button-spacing-inline-start"),a?this.style.setProperty("--scb-icon-button-spacing-inline-end",a):this.style.removeProperty("--scb-icon-button-spacing-inline-end")}e([r({type:String})],n.prototype,"icon",void 0);e([r({type:Boolean,reflect:!0})],n.prototype,"filled",null);e([r({type:Boolean,attribute:"icon-filled",reflect:!0})],n.prototype,"iconFilled",null);e([r({type:String,attribute:"aria-label"})],n.prototype,"ariaLabel",void 0);e([r({type:String,reflect:!0})],n.prototype,"variant",void 0);e([r({type:String,reflect:!0})],n.prototype,"size",void 0);e([r({type:Boolean,reflect:!0})],n.prototype,"toggle",void 0);e([r({type:Boolean,reflect:!0})],n.prototype,"selected",void 0);e([r({type:String})],n.prototype,"toggleofficon",void 0);e([r({type:String})],n.prototype,"toggleonicon",void 0);e([r({type:Boolean,reflect:!0})],n.prototype,"disabled",void 0);e([r({type:String,reflect:!0})],n.prototype,"spacing",void 0);e([r({type:String,attribute:"spacing-top",reflect:!0})],n.prototype,"spacingTop",void 0);e([r({type:String,attribute:"spacing-bottom",reflect:!0})],n.prototype,"spacingBottom",void 0);e([r({type:String,attribute:"spacing-left",reflect:!0})],n.prototype,"spacingLeft",void 0);e([r({type:String,attribute:"spacing-right",reflect:!0})],n.prototype,"spacingRight",void 0);e([r({type:String})],n.prototype,"href",void 0);e([r({type:String})],n.prototype,"target",void 0);e([r({type:String})],n.prototype,"rel",void 0);n=e([x("scb-icon-button")],n);export{n as ScbIconButton};
59
+ )}:host([variant='outlined'][toggle][selected]) .native-icon-button{color:var(--md-outlined-icon-button-selected-icon-color, var(--scb-icon-button-outlined-selected-content-color, var(--md-sys-color-primary, var(--p-40))));box-shadow:inset 0 0 0 var(--stroke-border, 1px) var(--md-outlined-icon-button-selected-outline-color, var(--scb-icon-button-outlined-selected-outline-color, var(--md-sys-color-outline, var(--p-20))))}.native-icon-button:disabled,.native-icon-button[aria-disabled=true]{color:var(--md-icon-button-disabled-icon-color, var(--_disabled-content-color, var(--scb-color-compat-disabled-content)));cursor:default;pointer-events:none}:host([variant='filled']) .native-icon-button:disabled,:host([variant='filled']) .native-icon-button[aria-disabled=true],:host([variant='filled-tonal']) .native-icon-button:disabled,:host([variant='filled-tonal']) .native-icon-button[aria-disabled=true]{background:var(--md-filled-icon-button-disabled-container-color, var(--_disabled-container-color, var(--scb-color-compat-disabled-container)));color:var(--md-filled-icon-button-disabled-icon-color, var(--_disabled-content-color, var(--scb-color-compat-disabled-content)))}:host([variant='outlined']) .native-icon-button:disabled,:host([variant='outlined']) .native-icon-button[aria-disabled=true]{color:var(--md-outlined-icon-button-disabled-icon-color, var(--_disabled-content-color, var(--scb-color-compat-disabled-content)));box-shadow:inset 0 0 0 var(--stroke-border, 1px) var(--md-outlined-icon-button-disabled-outline-color, var(--_disabled-outline-color, var(--scb-color-compat-disabled-container)))}.native-icon-button-wrap md-ripple{position:absolute;inset:0;--md-ripple-hover-color:var(--scb-icon-button-state-layer-color, currentColor);--md-ripple-pressed-color:var(--scb-icon-button-state-layer-color, currentColor)}.native-icon-button-wrap md-focus-ring,.native-icon-button-wrap md-ripple{pointer-events:none;border-radius:inherit}:host{--scb-icon-button-design-height-tiny:var(--scb-buttons-control-size-tiny, var(--scb-control-size-tiny, var(--scale-06, 24px)));--scb-icon-button-design-height-extra-small:var(--scb-buttons-control-size-extra-small, var(--scale-07, 28px));--scb-icon-button-design-height-small:var(--scb-buttons-control-size-small, var(--scb-control-size-small, var(--scale-08, 32px)));--scb-icon-button-design-height-medium:var(--scb-buttons-control-size-medium, var(--scb-control-size-medium, var(--scale-10, 40px)));--scb-icon-button-design-height-large:var(--scb-buttons-control-size-large, var(--scb-control-size-large, var(--scale-12, 56px)));--scb-icon-button-design-icon-tiny:var(--scb-buttons-icon-size-tiny, var(--icon-size-tiny, 12px));--scb-icon-button-design-icon-extra-small:var(--scb-buttons-icon-size-extra-small, var(--icon-size-small, 20px));--scb-icon-button-design-icon-small:var(--scb-buttons-icon-size-small, var(--icon-size-small, 20px));--scb-icon-button-design-icon-medium:var(--scb-icon-button-icon-size-medium, var(--icon-size-medium, 24px));--scb-icon-button-design-icon-large:var(--scb-icon-button-icon-size-large, var(--icon-size-large, 32px));--scb-icon-button-design-icon-button-round-radius-tiny:var(--scb-buttons-shape-radius-tiny, var(--radius-full, 1000px));--scb-icon-button-design-icon-button-round-radius-extra-small:var(--scb-buttons-shape-radius-extra-small, var(--radius-full, 1000px));--scb-icon-button-design-icon-button-round-radius-small:var(--scb-buttons-shape-radius-small, var(--radius-full, 1000px));--scb-icon-button-design-icon-button-round-radius-medium:var(--scb-buttons-shape-radius-medium, var(--radius-full, 1000px));--scb-icon-button-design-icon-button-round-radius-large:var(--scb-buttons-shape-radius-large, var(--radius-full, 1000px))}`,p);function f(){const c=this.mapSpacingToken(this.spacing),o=this.mapSpacingToken(this.spacingTop)??c,t=this.mapSpacingToken(this.spacingBottom)??c,i=this.mapSpacingToken(this.spacingLeft),a=this.mapSpacingToken(this.spacingRight);o?this.style.setProperty("--scb-icon-button-spacing-block-start",o):this.style.removeProperty("--scb-icon-button-spacing-block-start"),t?this.style.setProperty("--scb-icon-button-spacing-block-end",t):this.style.removeProperty("--scb-icon-button-spacing-block-end"),i?this.style.setProperty("--scb-icon-button-spacing-inline-start",i):this.style.removeProperty("--scb-icon-button-spacing-inline-start"),a?this.style.setProperty("--scb-icon-button-spacing-inline-end",a):this.style.removeProperty("--scb-icon-button-spacing-inline-end")}e([r({type:String})],n.prototype,"icon",void 0);e([r({type:Boolean,reflect:!0})],n.prototype,"filled",null);e([r({type:Boolean,attribute:"icon-filled",reflect:!0})],n.prototype,"iconFilled",null);e([r({type:String,attribute:"aria-label"})],n.prototype,"ariaLabel",void 0);e([r({type:String,reflect:!0})],n.prototype,"variant",void 0);e([r({type:String,reflect:!0})],n.prototype,"size",void 0);e([r({type:Boolean,reflect:!0})],n.prototype,"toggle",void 0);e([r({type:Boolean,reflect:!0})],n.prototype,"selected",void 0);e([r({type:String})],n.prototype,"toggleofficon",void 0);e([r({type:String})],n.prototype,"toggleonicon",void 0);e([r({type:Boolean,reflect:!0})],n.prototype,"disabled",void 0);e([r({type:String,reflect:!0})],n.prototype,"spacing",void 0);e([r({type:String,attribute:"spacing-top",reflect:!0})],n.prototype,"spacingTop",void 0);e([r({type:String,attribute:"spacing-bottom",reflect:!0})],n.prototype,"spacingBottom",void 0);e([r({type:String,attribute:"spacing-left",reflect:!0})],n.prototype,"spacingLeft",void 0);e([r({type:String,attribute:"spacing-right",reflect:!0})],n.prototype,"spacingRight",void 0);e([r({type:String})],n.prototype,"href",void 0);e([r({type:String})],n.prototype,"target",void 0);e([r({type:String})],n.prototype,"rel",void 0);n=e([x("scb-icon-button")],n);export{n as ScbIconButton};