var T=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var N=(t,e,s)=>e in t?T(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var k=(t,e)=>{for(var s in e)T(t,s,{get:e[s],enumerable:!0})},q=(t,e,s,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of E(e))!S.call(t,a)&&a!==s&&T(t,a,{get:()=>e[a],enumerable:!(o=B(e,a))||o.enumerable});return t};var M=t=>q(T({},"__esModule",{value:!0}),t);var i=(t,e,s)=>N(t,typeof e!="symbol"?e+"":e,s);var P={};k(P,{Alert:()=>g,Autosave:()=>h,ColorPreview:()=>c,Dropdown:()=>l,Modal:()=>d,Popover:()=>f,Slideover:()=>m,Tabs:()=>u,Toggle:()=>p,transition:()=>r});module.exports=M(P);var V=require("@hotwired/stimulus");async function r(t,e,s={}){e?await b(t,s):await C(t,s)}async function b(t,e={}){let{transitionClasses:s,fromClasses:o,toClasses:a,toggleClass:n}=v("Enter",t,e);return x(t,{firstFrame(){t.classList.add(...s.split(" ")),t.classList.add(...o.split(" ")),t.classList.remove(...a.split(" ")),t.classList.remove(...n.split(" "))},secondFrame(){t.classList.remove(...o.split(" ")),t.classList.add(...a.split(" "))},ending(){t.classList.remove(...s.split(" "))}})}async function C(t,e={}){let{transitionClasses:s,fromClasses:o,toClasses:a,toggleClass:n}=v("Leave",t,e);return x(t,{firstFrame(){t.classList.add(...o.split(" ")),t.classList.remove(...a.split(" ")),t.classList.add(...s.split(" "))},secondFrame(){t.classList.remove(...o.split(" ")),t.classList.add(...a.split(" "))},ending(){t.classList.remove(...s.split(" ")),t.classList.add(...n.split(" "))}})}function v(t,e,s){return{transitionClasses:e.dataset[`transition${t}`]||s[t.toLowerCase()]||t.toLowerCase(),fromClasses:e.dataset[`transition${t}From`]||s[`${t.toLowerCase()}From`]||`${t.toLowerCase()}-from`,toClasses:e.dataset[`transition${t}To`]||s[`${t.toLowerCase()}To`]||`${t.toLowerCase()}-to`,toggleClass:e.dataset.toggleClass||s.toggleClass||s.toggle||"hidden"}}function O(t){t._stimulus_transition={timeout:null,interrupted:!1}}function U(t){t._stimulus_transition&&t._stimulus_transition.interrupt&&t._stimulus_transition.interrupt()}function x(t,e){t._stimulus_transition&&U(t);let s,o,a;return O(t),t._stimulus_transition.cleanup=()=>{o||e.firstFrame(),a||e.secondFrame(),e.ending(),t._stimulus_transition=null},t._stimulus_transition.interrupt=()=>{s=!0,t._stimulus_transition.timeout&&clearTimeout(t._stimulus_transition.timeout),t._stimulus_transition.cleanup()},new Promise(n=>{s||requestAnimationFrame(()=>{s||(e.firstFrame(),o=!0,requestAnimationFrame(()=>{s||(e.secondFrame(),a=!0,t._stimulus_transition&&(t._stimulus_transition.timeout=setTimeout(()=>{if(s){n();return}t._stimulus_transition.cleanup(),n()},$(t))))}))})})}function $(t){let e=Number(getComputedStyle(t).transitionDuration.replace(/,.*/,"").replace("s",""))*1e3,s=Number(getComputedStyle(t).transitionDelay.replace(/,.*/,"").replace("s",""))*1e3;return e===0&&(e=Number(getComputedStyle(t).animationDuration.replace("s",""))*1e3),e+s}var g=class extends V.Controller{connect(){setTimeout(()=>{b(this.element)},this.showDelayValue),this.hasDismissAfterValue&&setTimeout(()=>{this.close()},this.dismissAfterValue)}close(){C(this.element).then(()=>{this.element.remove()})}};i(g,"values",{dismissAfter:Number,showDelay:{type:Number,default:0}});var L=require("@hotwired/stimulus");var h=class extends L.Controller{connect(){this.timeout=null}save(){clearTimeout(this.timeout),this.timeout=setTimeout(()=>{this.statusTarget.textContent=this.submittingTextValue,this.formTarget.requestSubmit()},this.submitDurationValue)}success(){this.setStatus(this.successTextValue)}error(){this.setStatus(this.errorTextValue)}setStatus(t){this.statusTarget.textContent=t,this.timeout=setTimeout(()=>{this.statusTarget.textContent=""},this.statusDurationValue)}};i(h,"targets",["form","status"]),i(h,"values",{submitDuration:{type:Number,default:1e3},statusDuration:{type:Number,default:2e3},submittingText:{type:String,default:"Saving..."},successText:{type:String,default:"Saved!"},errorText:{type:String,default:"Unable to save."}});var I=require("@hotwired/stimulus");var c=class extends I.Controller{update(){this.preview=this.colorTarget.value}set preview(t){this.previewTarget.style[this.styleValue]=t;let e=this._getContrastYIQ(t);this.styleValue==="color"?this.previewTarget.style.backgroundColor=e:this.previewTarget.style.color=e}_getContrastYIQ(t){t=t.replace("#","");let e=128,s=parseInt(t.substr(0,2),16),o=parseInt(t.substr(2,2),16),a=parseInt(t.substr(4,2),16);return(s*299+o*587+a*114)/1e3>=e?"#000":"#fff"}};i(c,"targets",["preview","color"]),i(c,"values",{style:{type:String,default:"backgroundColor"}});var w=require("@hotwired/stimulus");var l=class extends w.Controller{connect(){this.boundBeforeCache=this.beforeCache.bind(this),document.addEventListener("turbo:before-cache",this.boundBeforeCache)}disconnect(){document.removeEventListener("turbo:before-cache",this.boundBeforeCache)}openValueChanged(){r(this.menuTarget,this.openValue,this.transitionOptions),this.openValue===!0&&this.hasMenuItemTarget&&this.menuItemTargets[0].focus()}show(){this.openValue=!0}close(){this.openValue=!1}hide(t){this.closeOnClickOutsideValue&&t.target.nodeType&&this.element.contains(t.target)===!1&&this.openValue&&(this.openValue=!1),this.closeOnEscapeValue&&t.key==="Escape"&&this.openValue&&(this.openValue=!1)}toggle(){this.openValue=!this.openValue}nextItem(t){t.preventDefault(),this.menuItemTargets[this.nextIndex].focus()}previousItem(t){t.preventDefault(),this.menuItemTargets[this.previousIndex].focus()}get currentItemIndex(){return this.menuItemTargets.indexOf(document.activeElement)}get nextIndex(){return Math.min(this.currentItemIndex+1,this.menuItemTargets.length-1)}get previousIndex(){return Math.max(this.currentItemIndex-1,0)}get transitionOptions(){return{enter:this.hasEnterClass?this.enterClass:"transition ease-out duration-100",enterFrom:this.hasEnterFromClass?this.enterFromClass:"transform opacity-0 scale-95",enterTo:this.hasEnterToClass?this.enterToClass:"transform opacity-100 scale-100",leave:this.hasLeaveClass?this.leaveClass:"transition ease-in duration-75",leaveFrom:this.hasLeaveFromClass?this.leaveFromClass:"transform opacity-100 scale-100",leaveTo:this.hasLeaveToClass?this.leaveToClass:"transform opacity-0 scale-95",toggleClass:this.hasToggleClass?this.toggleClass:"hidden"}}beforeCache(){this.openValue=!1,this.menuTarget.classList.add("hidden")}};i(l,"targets",["menu","button","menuItem"]),i(l,"values",{open:{type:Boolean,default:!1},closeOnEscape:{type:Boolean,default:!0},closeOnClickOutside:{type:Boolean,default:!0}}),i(l,"classes",["enter","enterFrom","enterTo","leave","leaveFrom","leaveTo","toggle"]);var y=require("@hotwired/stimulus");var d=class extends y.Controller{connect(){this.openValue&&this.open(),this.boundBeforeCache=this.beforeCache.bind(this),document.addEventListener("turbo:before-cache",this.boundBeforeCache)}disconnect(){document.removeEventListener("turbo:before-cache",this.boundBeforeCache)}open(){this.dialogTarget.showModal()}close(){this.dialogTarget.setAttribute("closing",""),Promise.all(this.dialogTarget.getAnimations().map(t=>t.finished)).then(()=>{this.dialogTarget.removeAttribute("closing"),this.dialogTarget.close()})}backdropClose(t){t.target.nodeName=="DIALOG"&&this.close()}show(){this.dialogTarget.show()}hide(){this.close()}beforeCache(){this.close()}};i(d,"targets",["dialog"]),i(d,"values",{open:Boolean});var A=require("@hotwired/stimulus");var f=class extends A.Controller{openValueChanged(){r(this.contentTarget,this.openValue),this.shouldAutoDismiss&&this.scheduleDismissal()}show(t){this.shouldAutoDismiss&&this.scheduleDismissal(),this.openValue=!0}hide(){this.openValue=!1}toggle(){this.openValue=!this.openValue}get shouldAutoDismiss(){return this.openValue&&this.hasDismissAfterValue}scheduleDismissal(){this.hasDismissAfterValue&&(this.cancelDismissal(),this.timeoutId=setTimeout(()=>{this.hide(),this.timeoutId=void 0},this.dismissAfterValue))}cancelDismissal(){typeof this.timeoutId=="number"&&(clearTimeout(this.timeoutId),this.timeoutId=void 0)}};i(f,"targets",["content"]),i(f,"values",{dismissAfter:Number,open:{type:Boolean,default:!1}});var _=require("@hotwired/stimulus");var m=class extends _.Controller{connect(){this.openValue&&this.open(),this.boundBeforeCache=this.beforeCache,document.addEventListener("turbo:before-cache",this.boundBeforeCache)}disconnect(){document.removeEventListener("turbo:before-cache",this.boundBeforeCache)}open(){this.dialogTarget.showModal()}close(){this.dialogTarget.setAttribute("closing",""),Promise.all(this.dialogTarget.getAnimations().map(t=>t.finished)).then(()=>{this.dialogTarget.removeAttribute("closing"),this.dialogTarget.close()})}backdropClose(t){t.target.nodeName=="DIALOG"&&this.close()}show(){this.open()}hide(){this.close()}beforeCache(){this.close()}};i(m,"targets",["dialog"]),i(m,"values",{open:Boolean});var D=require("@hotwired/stimulus");var u=class extends D.Controller{initialize(){this.updateAnchorValue&&this.anchor&&(this.indexValue=this.tabTargets.findIndex(t=>t.id===this.anchor))}connect(){this.showTab()}change(t){t.currentTarget.tagName==="SELECT"?this.indexValue=t.currentTarget.selectedIndex:t.currentTarget.dataset.index?this.indexValue=t.currentTarget.dataset.index:t.currentTarget.dataset.id?this.indexValue=this.tabTargets.findIndex(e=>e.id==t.currentTarget.dataset.id):this.indexValue=this.tabTargets.indexOf(t.currentTarget)}nextTab(){this.indexValue=Math.min(this.indexValue+1,this.tabsCount-1)}previousTab(){this.indexValue=Math.max(this.indexValue-1,0)}firstTab(){this.indexValue=0}lastTab(){this.indexValue=this.tabsCount-1}indexValueChanged(){if(this.showTab(),this.dispatch("tab-change",{target:this.tabTargets[this.indexValue],detail:{activeIndex:this.indexValue}}),this.updateAnchorValue){let t=this.tabTargets[this.indexValue].id;if(this.scrollToAnchorValue)location.hash=t;else{let s=window.location.href.split("#")[0]+"#"+t;typeof Turbo<"u"?Turbo.navigator.history.replace(new URL(s)):history.replaceState({},document.title,s)}}}showTab(){this.panelTargets.forEach((t,e)=>{let s=this.tabTargets[e];e===this.indexValue?(t.classList.remove("hidden"),s.ariaSelected="true",s.dataset.active=!0,this.hasInactiveTabClass&&s?.classList?.remove(...this.inactiveTabClasses),this.hasActiveTabClass&&s?.classList?.add(...this.activeTabClasses)):(t.classList.add("hidden"),s.ariaSelected=null,delete s.dataset.active,this.hasActiveTabClass&&s?.classList?.remove(...this.activeTabClasses),this.hasInactiveTabClass&&s?.classList?.add(...this.inactiveTabClasses))}),this.hasSelectTarget&&(this.selectTarget.selectedIndex=this.indexValue),this.scrollActiveTabIntoViewValue&&this.scrollToActiveTab()}scrollToActiveTab(){let t=this.element.querySelector("[aria-selected]");t&&t.scrollIntoView({inline:"center"})}get tabsCount(){return this.tabTargets.length}get anchor(){return document.URL.split("#").length>1?document.URL.split("#")[1]:null}};i(u,"classes",["activeTab","inactiveTab"]),i(u,"targets",["tab","panel","select"]),i(u,"values",{index:0,updateAnchor:Boolean,scrollToAnchor:Boolean,scrollActiveTabIntoView:Boolean});var F=require("@hotwired/stimulus");var p=class extends F.Controller{toggle(t){this.openValue=!this.openValue,this.animate()}toggleInput(t){this.openValue=t.target.checked,this.animate()}hide(){this.openValue=!1,this.animate()}show(){this.openValue=!0,this.animate()}animate(){this.toggleableTargets.forEach(t=>{r(t,this.openValue)})}};i(p,"targets",["toggleable"]),i(p,"values",{open:{type:Boolean,default:!1}});