{"version":3,"file":"alpine_components-C_k-bb9D.js","sources":["../../../app/javascript/components/alpine_components.js"],"sourcesContent":["window.Components={},window.Components.listbox=function(e){return{init(){this.optionCount=this.$refs.listbox.children.length,this.$watch(\"activeIndex\",(e=>{this.open&&(null!==this.activeIndex?this.activeDescendant=this.$refs.listbox.children[this.activeIndex].id:this.activeDescendant=\"\")}))},activeDescendant:null,optionCount:null,open:!1,activeIndex:null,selectedIndex:0,get active(){return this.items[this.activeIndex]},get[e.modelName||\"selected\"](){return this.items[this.selectedIndex]},choose(e){this.selectedIndex=e,this.open=!1},onButtonClick(){this.open||(this.activeIndex=this.selectedIndex,this.open=!0,this.$nextTick((()=>{this.$refs.listbox.focus(),this.$refs.listbox.children[this.activeIndex].scrollIntoView({block:\"nearest\"})})))},onOptionSelect(){null!==this.activeIndex&&(this.selectedIndex=this.activeIndex),this.open=!1,this.$refs.button.focus()},onEscape(){this.open=!1,this.$refs.button.focus()},onArrowUp(){this.activeIndex=this.activeIndex-1<0?this.optionCount-1:this.activeIndex-1,this.$refs.listbox.children[this.activeIndex].scrollIntoView({block:\"nearest\"})},onArrowDown(){this.activeIndex=this.activeIndex+1>this.optionCount-1?0:this.activeIndex+1,this.$refs.listbox.children[this.activeIndex].scrollIntoView({block:\"nearest\"})},...e}},window.Components.menu=function(e={open:!1}){return{init(){this.items=Array.from(this.$el.querySelectorAll('[role=\"menuitem\"]')),this.$watch(\"open\",(()=>{this.open&&(this.activeIndex=-1)}))},activeDescendant:null,activeIndex:null,items:null,open:e.open,focusButton(){this.$refs.button.focus()},onButtonClick(){this.open=!this.open,this.open&&this.$nextTick((()=>{this.$refs[\"menu-items\"].focus()}))},onButtonEnter(){this.open=!this.open,this.open&&(this.activeIndex=0,this.activeDescendant=this.items[this.activeIndex].id,this.$nextTick((()=>{this.$refs[\"menu-items\"].focus()})))},onArrowUp(){if(!this.open)return this.open=!0,this.activeIndex=this.items.length-1,void(this.activeDescendant=this.items[this.activeIndex].id);0!==this.activeIndex&&(this.activeIndex=-1===this.activeIndex?this.items.length-1:this.activeIndex-1,this.activeDescendant=this.items[this.activeIndex].id)},onArrowDown(){if(!this.open)return this.open=!0,this.activeIndex=0,void(this.activeDescendant=this.items[this.activeIndex].id);this.activeIndex!==this.items.length-1&&(this.activeIndex=this.activeIndex+1,this.activeDescendant=this.items[this.activeIndex].id)},onClickAway(e){if(this.open){const t=[\"[contentEditable=true]\",\"[tabindex]\",\"a[href]\",\"area[href]\",\"button:not([disabled])\",\"iframe\",\"input:not([disabled])\",\"select:not([disabled])\",\"textarea:not([disabled])\"].map((e=>`${e}:not([tabindex='-1'])`)).join(\",\");this.open=!1,e.target.closest(t)||this.focusButton()}}}},window.Components.popoverGroup=function(){return{__type:\"popoverGroup\",init(){let e=t=>{document.body.contains(this.$el)?t.target instanceof Element&&!this.$el.contains(t.target)&&window.dispatchEvent(new CustomEvent(\"close-popover-group\",{detail:this.$el})):window.removeEventListener(\"focus\",e,!0)};window.addEventListener(\"focus\",e,!0)}}},window.Components.popover=function({open:e=!1,focus:t=!1}={}){const i=[\"[contentEditable=true]\",\"[tabindex]\",\"a[href]\",\"area[href]\",\"button:not([disabled])\",\"iframe\",\"input:not([disabled])\",\"select:not([disabled])\",\"textarea:not([disabled])\"].map((e=>`${e}:not([tabindex='-1'])`)).join(\",\");return{__type:\"popover\",open:e,init(){t&&this.$watch(\"open\",(e=>{e&&this.$nextTick((()=>{!function(e){const t=Array.from(e.querySelectorAll(i));!function e(i){void 0!==i&&(i.focus({preventScroll:!0}),document.activeElement!==i&&e(t[t.indexOf(i)+1]))}(t[0])}(this.$refs.panel)}))}));let e=i=>{if(!document.body.contains(this.$el))return void window.removeEventListener(\"focus\",e,!0);let n=t?this.$refs.panel:this.$el;if(this.open&&i.target instanceof Element&&!n.contains(i.target)){let e=this.$el;for(;e.parentNode;)if(e=e.parentNode,e.__x instanceof this.constructor){if(\"popoverGroup\"===e.__x.$data.__type)return;if(\"popover\"===e.__x.$data.__type)break}this.open=!1}};window.addEventListener(\"focus\",e,!0)},onEscape(){this.open=!1,this.restoreEl&&this.restoreEl.focus()},onClosePopoverGroup(e){e.detail.contains(this.$el)&&(this.open=!1)},toggle(e){this.open=!this.open,this.open?this.restoreEl=e.currentTarget:this.restoreEl&&this.restoreEl.focus()}}},window.Components.radioGroup=function({initialCheckedIndex:e=0}={}){return{value:void 0,active:void 0,init(){let t=Array.from(this.$el.querySelectorAll(\"input\"));this.value=t[e]?.value;for(let e of t)e.addEventListener(\"change\",(()=>{this.active=e.value})),e.addEventListener(\"focus\",(()=>{this.active=e.value}));window.addEventListener(\"focus\",(()=>{console.log(\"Focus change\"),t.includes(document.activeElement)||(console.log(\"HIT\"),this.active=void 0)}),!0)}}},window.Components.tabs=function(){return{onTabClick(e){if(!this.$el.contains(e.detail))return;let t=Array.from(this.$el.querySelectorAll('[x-data^=\"Components.tab(\"]')),i=Array.from(this.$el.querySelectorAll('[x-data^=\"Components.tabPanel(\"]'));window.dispatchEvent(new CustomEvent(\"tab-select\",{detail:{tab:e.detail,panel:i[t.indexOf(e.detail)]}}))},onTabKeydown(e){if(!this.$el.contains(e.detail.tab))return;let t=Array.from(this.$el.querySelectorAll('[x-data^=\"Components.tab(\"]')),i=t.indexOf(e.detail.tab);\"ArrowLeft\"===e.detail.key?this.onTabClick({detail:t[(i-1+t.length)%t.length]}):\"ArrowRight\"===e.detail.key?this.onTabClick({detail:t[(i+1)%t.length]}):\"Home\"===e.detail.key||\"PageUp\"===e.detail.key?this.onTabClick({detail:t[0]}):\"End\"!==e.detail.key&&\"PageDown\"!==e.detail.key||this.onTabClick({detail:t[t.length-1]})}}},window.Components.tab=function(e=0){return{selected:!1,init(){let t=Array.from(this.$el.closest('[x-data^=\"Components.tabs(\"]').querySelectorAll('[x-data^=\"Components.tab(\"]'));this.selected=t.indexOf(this.$el)===e,this.$watch(\"selected\",(e=>{e&&this.$el.focus()}))},onClick(){window.dispatchEvent(new CustomEvent(\"tab-click\",{detail:this.$el}))},onKeydown(e){[\"ArrowLeft\",\"ArrowRight\",\"Home\",\"PageUp\",\"End\",\"PageDown\"].includes(e.key)&&e.preventDefault(),window.dispatchEvent(new CustomEvent(\"tab-keydown\",{detail:{tab:this.$el,key:e.key}}))},onTabSelect(e){this.selected=e.detail.tab===this.$el}}},window.Components.tabPanel=function(e=0){return{selected:!1,init(){let t=Array.from(this.$el.closest('[x-data^=\"Components.tabs(\"]').querySelectorAll('[x-data^=\"Components.tabPanel(\"]'));this.selected=t.indexOf(this.$el)===e},onTabSelect(e){this.selected=e.detail.panel===this.$el}}}; \n"],"names":["e","t","i","n","_a"],"mappings":"AAAA,OAAO,WAAW,CAAE,EAAC,OAAO,WAAW,QAAQ,SAASA,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,YAAY,KAAK,MAAM,QAAQ,SAAS,OAAO,KAAK,OAAO,cAAe,GAAG,CAAC,KAAK,OAAc,KAAK,cAAZ,KAAwB,KAAK,iBAAiB,KAAK,MAAM,QAAQ,SAAS,KAAK,WAAW,EAAE,GAAG,KAAK,iBAAiB,GAAG,CAAC,CAAE,EAAE,iBAAiB,KAAK,YAAY,KAAK,KAAK,GAAG,YAAY,KAAK,cAAc,EAAE,IAAI,QAAQ,CAAC,OAAO,KAAK,MAAM,KAAK,WAAW,CAAC,EAAE,IAAIA,EAAE,WAAW,UAAU,GAAG,CAAC,OAAO,KAAK,MAAM,KAAK,aAAa,CAAC,EAAE,OAAO,EAAE,CAAC,KAAK,cAAc,EAAE,KAAK,KAAK,EAAE,EAAE,eAAe,CAAC,KAAK,OAAO,KAAK,YAAY,KAAK,cAAc,KAAK,KAAK,GAAG,KAAK,UAAW,IAAI,CAAC,KAAK,MAAM,QAAQ,MAAK,EAAG,KAAK,MAAM,QAAQ,SAAS,KAAK,WAAW,EAAE,eAAe,CAAC,MAAM,SAAS,CAAC,CAAC,CAAC,EAAG,EAAE,gBAAgB,CAAQ,KAAK,cAAZ,OAA0B,KAAK,cAAc,KAAK,aAAa,KAAK,KAAK,GAA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