1import{H as O,a as k,b as L}from"./chunk-backdrop.BW8XJ0t.js";import{_ as o,a as n}from"./chunk-vendor-di.Bh23gdA.js";import{P as d,b as E,U as S,d as f,$ as w,e as m,t as T}from"./chunk-vendor-lit.NvY0u02.js";import{p as c}from"./chunk-phoenix_custom_element.-3oJuZO.js";import{a as $,P as A}from"./chunk-portal_constants.uZUnw1k.js";import{B as F}from"./chunk-backdrop_constants.5bk4eBT.js";import{B as P}from"./chunk-backdrop_controller.BQhgTTX.js";import{S as p,a as h,F as H,b}from"./chunk-sheet_constants.BGkaDhX.js";import"./chunk-v4.FWzwXvE.js";import"./chunk-transition_controller.B1AYL9W.js";import"./chunk-vendor-lodash.CWHFt7Z.js";let _=class extends d{constructor(){super(),this.tabIndex=0,this.setAttribute("role","button")}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._dispatchSheetCloseEvent),this.addEventListener("keydown",this._dispatchSheetCloseOnEnterEvent)}disconnectedCallback(){this.removeEventListener("click",this._dispatchSheetCloseEvent),this.removeEventListener("keydown",this._dispatchSheetCloseOnEnterEvent)}_dispatchSheetCloseEvent(){this.emitCustomEvent(p.close)}_dispatchSheetCloseOnEnterEvent(e){(e.code==="Enter"||e.code==="Space")&&this._dispatchSheetCloseEvent()}};_=o([c("h-sheet-close"),n("design:paramtypes",[])],_);var r;let a=r=class extends d{constructor(){super(),this.opened=!1,this.class="",this.transition="scale",this.sheetLabel="",this._firstFocusableElement=void 0,this._focusableElements=null,this._lastFocusableElement=void 0,this._focusedToggler=null,this._contentRef=E(),this._focusSentinelStart=E(),this._focusSentinelEnd=E(),this._propsChangeStrategies={[h]:{true:()=>{const e=window.scrollY;r.openSheets=[...r.openSheets,this],document.addEventListener("keydown",this._bindCloseOnEsc),document.addEventListener(F.clicked,this.close),this._dispatchSheetOpenedEvent(),setTimeout(()=>{var t;(t=this._firstFocusableElement)===null||t===void 0||t.focus(),window.scrollTo(0,e)},0)},false:()=>{r.openSheets=r.openSheets.filter(e=>e!==this),document.removeEventListener("keydown",this._bindCloseOnEsc),document.removeEventListener(F.clicked,this.close)}}},this._backdropController=new P,this._keepFocusWithinSheet=e=>{var t;if(e.code==="Tab"&&this._contentRef.value)if(e.shiftKey){if(document.activeElement===this._firstFocusableElement){const s=S.getFocusableElements(this._contentRef.value);(t=s[s.length-1])===null||t===void 0||t.focus(),e.preventDefault()}}else document.activeElement===this._lastFocusableElement&&(S.setFocusToFirstFocusableElementInContainer(this._contentRef.value),e.preventDefault())},this._handleCloseFromCloseComponent=async e=>{var t;e.stopPropagation();const i=e.target instanceof _,s=(t=this._contentRef.value)===null||t===void 0?void 0:t.contains(e.target);i&&s&&await this.close()},this._bindCloseOnEsc=async e=>{e.stopImmediatePropagation();const t=e.target;if([e.key==="Escape",t.tagName!=="INPUT",e.ctrlKey===!1,e.shiftKey===!1,e.altKey===!1].every(l=>l)){const[l]=r.openSheets.slice(-1);await l?.close()}},this.close=async()=>{if(this.opened)return new Promise(e=>{const t=parseFloat(getComputedStyle(this._contentRef.value||this).transitionDuration)*1e3;window.requestAnimationFrame(()=>{var i,s;(i=this._contentRef.value)===null||i===void 0||i.classList.remove(`sheet_hide-${this.transition}-start`),(s=this._contentRef.value)===null||s===void 0||s.classList.add(`sheet_hide-${this.transition}-end`),setTimeout(()=>{var l;(l=this._contentRef.value)===null||l===void 0||l.classList.remove(`sheet_hide-${this.transition}-start`,`sheet_hide-${this.transition}-end`),this[h]=!1,this._dispatchHSheetClosedEvent(),e()},t)})})},this._addInertToBodyChildrenElements=()=>{[...document.body.children].forEach(e=>{const t=e.tagName===A.toUpperCase(),i=e.hasAttribute("aria-live"),s=e.tagName==="H-BACKDROP";!t&&!i&&!s&&e.setAttribute("inert","")})},this._removeInertFromBodyChildrenElements=()=>{[...document.body.children].forEach(e=>{e.removeAttribute("inert")})},this.hidden=!0,this._focusableElements=[...this.querySelectorAll(H)]}static _appendSheetPortal(){if(!document.querySelector(`h-portal-target[name="${b}"]`)){const t=document.createElement("h-portal-target");t.setAttribute($,b),document.body.appendChild(t)}}static isSomeSheetOpen(){return r.openSheets.some(e=>e.opened)}connectedCallback(){super.connectedCallback(),r._appendSheetPortal(),document.addEventListener("keyup",this._keepFocusWithinSheet),document.addEventListener(p.close,this._handleCloseFromCloseComponent)}disconnectedCallback(){super.disconnectedCallback(),this[h]&&this.close(),document.removeEventListener(p.close,this._handleCloseFromCloseComponent),document.removeEventListener("keydown",this._bindCloseOnEsc),document.removeEventListener("keyup",this._keepFocusWithinSheet)}firstUpdated(e){super.firstUpdated(e),this._firstFocusableElement=this._focusSentinelStart.value,this._lastFocusableElement=this._focusSentinelEnd.value}
1updated(e){e.has(h)&&this._propsChangeStrategies[h][String(this[h])]()}_setFocusToFirstFocusableElementInSheetOrCloseBtn(){requestAnimationFrame(()=>{if(this._contentRef.value){const e=S.getFocusableElements(this._contentRef.value);e.length>0&&(e.length>1?e[1].focus():e[0].focus())}})}async open(){return this._focusedToggler=document.activeElement,new Promise(e=>{var t;this[h]=!0,(t=this._contentRef.value)===null||t===void 0||t.classList.add("sheet_visible",`sheet_show-${this.transition}-start`),window.requestAnimationFrame(()=>{setTimeout(()=>{var s;(s=this._contentRef.value)===null||s===void 0||s.classList.add(`sheet_show-${this.transition}-end`)},0);const i=parseFloat(getComputedStyle(this._contentRef.value||this).transitionDuration)*1e3;setTimeout(()=>{var s;(s=this._contentRef.value)===null||s===void 0||s.classList.remove(`sheet_show-${this.transition}-start`,`sheet_show-${this.transition}-end`),this._setFocusToFirstFocusableElementInSheetOrCloseBtn(),e()},i)})})}_dispatchSheetOpenedEvent(){this.emitCustomEvent(p.opened,{detail:this}),this._backdropController.show(),this._addInertToBodyChildrenElements()}_dispatchHSheetClosedEvent(){this.emitCustomEvent(p.closed),requestAnimationFrame(()=>{var e;(e=this._focusedToggler)===null||e===void 0||e.focus()}),this._backdropController.hide(),this._removeInertFromBodyChildrenElements()}render(){return w` 2 <h-portal ?disabled="${!this.opened}" to="${b}" hidden> 3 <div class="sheet-wrapper ${this.class}"> 4 <div tabindex="0" ${f(this._focusSentinelStart)}></div> 5 <div ${f(this._contentRef)} class="sheet" role="dialog" aria-label="${this.sheetLabel}"> 6 <div class="sheet__container">${this.getSlot("header")}
6 ${this.getSlot("body")} ${this.getSlot("footer")}</div> 7 </div> 8 <div tabindex="0" ${f(this._focusSentinelEnd)}></div> 9 </div> 10 </h-portal> 11 `}};a.openSheets=[];o([m({type:Boolean,reflect:!0}),n("design:type",Object)],a.prototype,"opened",void 0);o([m({type:String}),n("design:type",Object)],a.prototype,"class",void 0);o([m({type:String}),n("design:type",Object)],a.prototype,"transition",void 0);o([m({type:String,attribute:"sheet-label"}),n("design:type",Object)],a.prototype,"sheetLabel",void 0);o([T(),n("design:type",Object)],a.prototype,"_firstFocusableElement",void 0);o([T(),n("design:type",Object)],a.prototype,"_focusableElements",void 0);o([T(),n("design:type",Object)],a.prototype,"_lastFocusableElement",void 0);a=r=o([c("h-sheet"),n("design:paramtypes",[])],a);let v=class extends d{constructor(){super(),this.name="",this.tabIndex=0,this.setAttribute("role","button"),this.setAttribute("aria-haspopup","dialog")}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._openSheet),this.addEventListener("keydown",this._openSheetOnKeydownEvent)}disconnectedCallback(){this.removeEventListener("click",this._openSheet),this.removeEventListener("keydown",this._openSheetOnKeydownEvent)}_openSheet(){const e=document.querySelector(`h-sheet#${this.name}`);e?.open()}_openSheetOnKeydownEvent(e){(e.code==="Enter"||e.code==="Space")&&this._openSheet()}};o([m({type:String}),n("design:type",Object)],v.prototype,"name",void 0);v=o([c("h-sheet-opener"),n("design:paramtypes",[])],v);let y=class extends d{constructor(){super(),this.slot=this.hasAttribute("slot")?this.slot:"body",this.className=`sheet__body ${this.className}`}};y=o([c("h-sheet-body"),n("design:paramtypes",[])],y);let C=class extends d{constructor(){super(),this.slot=this.hasAttribute("slot")?this.slot:"footer",this.className=`sheet__footer ${this.className}`}};C=o([c("h-sheet-footer"),n("design:paramtypes",[])],C);let g=class extends d{constructor(){super(),this.slot=this.hasAttribute("slot")?this.slot:"header",this.className=`sheet__header ${this.className}`}};g=o([c("h-sheet-header"),n("design:paramtypes",[])],g);requestAnimationFrame(()=>{});globalThis.__phoenix_wc__=[O,a,y,_,C,g,v,k,L];
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.