diff --git a/dist/index.d.ts b/dist/index.d.ts index 824baad3..7bc86718 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -13,6 +13,7 @@ export { EnableInputsController } from "./enable_inputs_controller"; export { FallbackImageController } from "./fallback_image_controller"; export { LazyBlockController } from "./lazy_block_controller"; export { LimitedSelectionCheckboxesController } from "./limited_selection_checkboxes_controller"; +export { NestedFormController } from "./nested_form_controller"; export { PasswordConfirmController } from "./password_confirm_controller"; export { PasswordPeekController } from "./password_peek_controller"; export { ResponsiveIframeBodyController, ResponsiveIframeWrapperController } from "./responsive_iframe_controller"; diff --git a/dist/index.d.ts.map b/dist/index.d.ts.map index 15b86135..b285861a 100644 --- a/dist/index.d.ts.map +++ b/dist/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAC,wBAAwB,EAAC,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAC,kBAAkB,EAAC,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAC,mBAAmB,EAAC,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAC,mBAAmB,EAAC,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAC,2BAA2B,EAAC,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAC,eAAe,EAAC,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAC,qBAAqB,EAAC,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAC,uBAAuB,EAAC,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAC,qBAAqB,EAAC,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAC,kBAAkB,EAAC,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAC,sBAAsB,EAAC,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAC,uBAAuB,EAAC,MAAM,6BAA6B,CAAC;A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AAC,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAC,uBAAuB,EAAC,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAC,qBAAqB,EAAC,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAC,kBAAkB,EAAC,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAC,sBAAsB,EAAC,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAC,uBAAuB,EAAC,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAC,mBAAmB,EAAC,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAC,oCAAoC,EAAC,MAAM,2CAA2C,CAAC;AAC/F,OAAO,EAAC,oBAAoB,EAAC,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAC,yBAAyB,EAAC,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAC,sBAAsB,EAAC,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAC,8BAA8B,EAAE,iCAAiC,EAAC,MAAM,gCAAgC,CAAC;AACjH,OAAO,EAAC,yBAAyB,EAAC,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAC,wBAAwB,EAAC,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAC,kBAAkB,EAAC,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAC,qBAAqB,EAAC,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAC,sBAAsB,EAAC,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAC,kBAAkB,EAAC,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAC,qBAAqB,EAAC,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAC,sBAAsB,EAAC,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAC,mBAAmB,EAAC,MAAM,yBAAyB,CAAC"} \ No newline at end of file diff --git a/dist/nested_form_controller.d.ts b/dist/nested_form_controller.d.ts new file mode 100644 index 00000000..c5fbbf50 --- /dev/null +++ b/dist/nested_form_controller.d.ts @@ -0,0 +1,22 @@ +import { BaseController } from "./base_controller"; +export declare class NestedFormController extends BaseController { + static targets: string[]; + static values: { + insertMode: StringConstructor; + wrapperClass: StringConstructor; + }; + readonly targetTarget: HTMLElement; + readonly templateTarget: HTMLTemplateElement | HTMLScriptElement; + readonly wrapperClassValue: string; + readonly hasWrapperSelectorValue: boolean; + readonly insertModeValue: InsertPosition; + readonly hasInsertModeValue: boolean; + get wrapperClass(): string; + get insertMode(): InsertPosition; + connect(): void; + add(event?: Event): void; + remove(event: Event): void; + generateID(): string; + private checkStructure; +} +//# sourceMappingURL=nested_form_controller.d.ts.map \ No newline at end of file diff --git a/dist/nested_form_controller.d.ts.map b/dist/nested_form_controller.d.ts.map new file mode 100644 index 00000000..379c11e9 --- /dev/null +++ b/dist/nested_form_controller.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"nested_form_controller.d.ts","sourceRoot":"","sources":["../src/nested_form_controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,mBAAmB,CAAC;AAEjD,qBAAa,oBAAqB,SAAQ,cAAc;IACtD,MAAM,CAAC,OAAO,WAA0B;IACxC,MAAM,CAAC,MAAM;;;MAGX;IAEF,SAAiB,YAAY,EAAE,WAAW,CAAC;IAC3C,SAAiB,cAAc,EAAE,mBAAmB,GAAG,iBAAiB,CAAC;IAEzE,SAAiB,iBAAiB,EAAE,MAAM,CAAC;IAC3C,SAAiB,uBAAuB,EAAE,OAAO,CAAC;IAClD,SAAiB,eAAe,EAAE,cAAc,CAAC;IACjD,SAAiB,kBAAkB,EAAE,OAAO,CAAC;IAE7C,IAAI,YAAY,WAEf;IAED,IAAI,UAAU,IAAI,cAAc,CAE/B;IAED,OAAO;IAIP,GAAG,CAAC,KAAK,CAAC,EAAE,KAAK;IASjB,MAAM,CAAC,KAAK,EAAE,KAAK;IAoBnB,UAAU,IAAI,MAAM;IAIpB,OAAO,CAAC,cAAc;CAOvB"} \ No newline at end of file diff --git a/dist/stimulus-library.js b/dist/stimulus-library.js index 15464d78..4903e58b 100644 --- a/dist/stimulus-library.js +++ b/dist/stimulus-library.js @@ -1,2 +1,2 @@ -var e=require("stimulus");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function n(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t}var r=t(require("lodash.camelcase"));function i(){return(i=Object.assign||function(e){for(var t=1;t{const n=e[t];return"function"==typeof n?n:(...e)=>{}},h=(e,t,n)=>{let r=e;return!0===n?r=`${t.identifier}:${e}`:"string"==typeof n&&(r=`${n}:${e}`),r},d=(e,t,n)=>{const{bubbles:r,cancelable:i,composed:o}=t||{bubbles:!0,cancelable:!0,composed:!0};return t&&Object.assign(n,{originalEvent:t}),new CustomEvent(e,{bubbles:r,cancelable:i,composed:o,detail:n})},p={dispatchEvent:!0,eventPrefix:!0},f={events:["click","touchend"],onlyVisible:!0,dispatchEvent:!0,eventPrefix:!0},v={debug:!1,logger:console};class g{constructor(e,t={}){var n,r,i;this.log=(e,t)=>{this.debug&&(this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${e}`,"color: #3B82F6","color: unset"),this.logger.log(Object.assign({controllerId:this.controllerId},t)),this.logger.groupEnd())},this.debug=null!==(r=null!==(n=null==t?void 0:t.debug)&&void 0!==n?n:e.application.stimulusUseDebug)&&void 0!==r?r:v.debug,this.logger=null!==(i=null==t?void 0:t.logger)&&void 0!==i?i:v.logger,this.controller=e,this.controllerId=e.element.id||e.element.dataset.id,this.controllerInitialize=e.initialize.bind(e),this.controllerConnect=e.connect.bind(e),this.controllerDisconnect=e.disconnect.bind(e)}}class m extends g{constructor(e,t={}){super(e,t),this.observe=()=>{this.targetElement.addEventListener("mouseenter",this.onEnter),this.targetElement.addEventListener("mouseleave",this.onLeave)},this.unobserve=()=>{this.targetElement.removeEventListener("mouseenter",this.onEnter),this.targetElement.removeEventListener("mouseleave",this.onLeave)},this.onEnter=()=>{u(this.controller,"mouseEnter").call(this.controller),this.log("mouseEnter",{hover:!0})},this.onLeave=()=>{u(this.controller,"mouseLeave").call(this.controller),this.log("mouseLeave",{hover:!1})},this.targetElement=(null==t?void 0:t.element)||e.element,this.controller=e,this.enhanceController(),this.observe()}enhanceController(){const e=this.controller.disconnect.bind(this.controller);Object.assign(this.controller,{disconnect:()=>{this.unobserve(),e()}})}}class b extends g{constructor(e,t={}){super(e,t),this.observe=()=>{try{this.observer.observe(this.targetElement,this.options)}catch(e){this.controller.application.handleError(e,"At a minimum, one of childList, attributes, and/or characterData must be true",{})}},this.unobserve=()=>{this.observer.disconnect()},this.mutation=e=>{u(this.controller,"mutate").call(this.controller,e),this.log("mutate",{entries:e})},this.targetElement=(null==t?void 0:t.element)||e.element,this.controller=e,this.options=t,this.observer=new MutationObserver(this.mutation),this.enhanceController(),this.observe()}enhanceController(){const e=this.controller.disconnect.bind(this.controller);Object.assign(this.controller,{disconnect:()=>{this.unobserve(),e()}})}}const y=e=>{const t=t=>{const{innerWidth:n,innerHeight:r}=window,i={height:r||Infinity,width:n||Infinity,event:t};u(e,"windowResize").call(e,i)},n=e.disconnect.bind(e),r=()=>{window.addEventListener("resize",t),t()},i=()=>{window.removeEventListener("resize",t)};return Object.assign(e,{disconnect(){i(),n()}}),r(),[r,i]},E=(e,t=200)=>{let n=null;return function(){const r=arguments,i=this,o=()=>e.apply(i,r);n&&clearTimeout(n),n=setTimeout(o,t)}};var w=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundHandler=t.handler.bind(s(t)),t}o(t,e);var n=t.prototype;return n.connect=function(){var e=this.element;e.style.resize="none",e.style.boxSizing="border-box",e.addEventListener("input",this.boundHandler),e.addEventListener("focus",this.boundHandler),y(this),requestAnimationFrame(this.boundHandler)},n.windowResize=function(){this.handler()},n.handler=function(){this.autosize(this.element)},n.autosize=function(e){var t=e.offsetHeight-e.clientHeight;e.style.height="auto",e.style.height=e.scrollHeight+t+"px"},t}(a),C=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundHandler=t.updateCharCount.bind(s(t)),t}o(t,e);var n=t.prototype;return n.connect=function(){this.updateCharCount(),this.inputTarget.addEventListener("input",this.boundHandler)},n.disconnect=function(){this.inputTarget.removeEventListener("input",this.boundHandler)},n.updateCharCount=function(){var e=this.inputTarget.value.length;this.outputTarget.innerText=e.toString(),this.hasErrorClass&&(this.isValidCount(e)?this.outputTarget.classList.remove(this.errorClass):this.outputTarget.classList.add(this.errorClass))},n.isValidCount=function(e){var t=0,n=99999;return this.hasMinValue&&(t=this.minValue),this.hasMaxValue&&(n=this.maxValue),e>=t&&e<=n},t}(a);C.targets=["input","output"],C.values={min:Number,max:Number},C.classes=["error"];var T=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).supported=!1,t}o(t,e);var n=t.prototype;return n.connect=function(){this.supported=document.queryCommandSupported("copy"),this.hasRemoveUnusedValue&&this.removeUnusedValue&&(this.supported&&this.hasFallbackTarget?this.fallbackTarget.remove():this.hasCopyTarget&&this.copyTarget.remove())},n.select=function(e){e&&e.preventDefault(),this.sourceTarget.select()},n.copy=function(e){e&&e.preventDefault(),this.sourceTarget.select(),this.supported&&document.execCommand("copy")},t}(a);T.targets=["button","copy","fallback"],T.values={removeUnused:Boolean};var V=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n=t.prototype;return n.connect=function(){var e=this,t=this.messageValue;window.onbeforeunload=function(){return null==t||t},window.addEventListener("popstate",this.handlePopstate),window.addEventListener("submit",function(){window.removeEventListener("popstate",e.handlePopstate),window.onbeforeunload=null})},n.handlePopstate=function(e){return!1},t}(a);V.values={message:String};var L=function(e){function t(){return e.apply(this,arguments)||this}return o(t,e),t.prototype.connect=function(){console.log("Debug Controller",this,this.testTargets)},t}(a);L.targets=["test"];var x=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).initialValue=null,t.boundHandler=t.handler.bind(s(t)),t}o(t,e);var n=t.prototype;return n.connect=function(){var e=this.element;this.initialValue=this.isInputElement(e)&&this.isCheckable(e)?e.checked:e.value,e.addEventListener("input",this.boundHandler),e.addEventListener("change",this.boundHandler)},n.disconnect=function(){var e=this.element;e.removeEventListener("input",this.boundHandler),e.removeEventListener("change",this.boundHandler)},n.restore=function(){var e=this.element;this.isInputElement(e)&&this.isCheckable(e)?e.checked=this.initialValue:e.value=this.initialValue},n.handler=function(e){var t=this.element;this.initialValue!==t.value?t.setAttribute("data-dirty","true"):t.removeAttribute("data-dirty")},n.isCheckable=function(e){return"radio"===e.type||"checkbox"===e.type},n.isInputElement=function(e){return"INPUT"===e.tagName},t}(a),S=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n=t.prototype;return n.connect=function(){this.toggle()},n.toggle=function(){this.hasDisablerTarget&&this.disablerTarget.checked?this.disableInputs():this.enableInputs()},n.disableInputs=function(){var e=this.hasClearValue&&this.clearValue;this.disableTargets.forEach(function(t,n){e&&(t.value=""),t.disabled=!0})},n.enableInputs=function(){this.disableTargets.forEach(function(e,t){e.disabled=!1})},t}(a);S.targets=["disabler","disable"],S.values={clear:Boolean};var k=function(e){function t(){return e.apply(this,arguments)||this}return o(t,e),t.prototype.dismiss=function(){this.element.remove()},t}(a),H=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n=t.prototype;return n.connect=function(){((e,t={})=>{new b(this,t)})(0,{element:this.element,childList:!0}),this.checkEmpty()},n.mutate=function(e){this.checkEmpty()},n.checkEmpty=function(){var e,t=this;0===(e=this.hasScopeSelectorValue?this.element.querySelectorAll(this.scopeSelectorValue):this.element.children).length?(this.hasNotEmptyClass&&this.notEmptyClass.split(" ").forEach(function(e){return t.element.classList.remove(e)}),this.hasEmptyClass&&this.emptyClass.split(" ").forEach(function(e){return t.element.classList.add(e)}),this.element.dispatchEvent(new CustomEvent("dom:empty",{bubbles:!0,cancelable:!0}))):(this.hasNotEmptyClass&&this.notEmptyClass.split(" ").forEach(function(e){return t.element.classList.add(e)}),this.hasEmptyClass&&this.emptyClass.split(" ").forEach(function(e){return t.element.classList.remove(e)}),this.element.dispatchEvent(new CustomEvent("dom:not-empty",{bubbles:!0,cancelable:!0,detail:{count:e.length}})))},t}(a);H.classes=["empty","notEmpty"],H.values={scopeSelector:String};var I=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n=t.prototype;return n.connect=function(){this.toggle()},n.toggle=function(){this.hasEnablerTarget&&this.enablerTarget.checked?this.enableInputs():this.disableInputs()},n.disableInputs=function(){var e=this.hasClearValue&&this.clearValue;this.enableTargets.forEach(function(t,n){e&&(t.value=""),t.disabled=!0})},n.enableInputs=function(){this.enableTargets.forEach(function(e,t){e.disabled=!1})},t}(a);I.targets=["enabler","enable"],I.values={clear:Boolean};var M=function(e){function t(){return e.apply(this,arguments)||this}return o(t,e),t.prototype.connect=function(){var e=this,t=this.element;t.onerror=function(){e.hasPlaceholderValue?t.src=e.placeholderValue:t.style.display="none"}},t}(a);M.values={placeholder:String};var O=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n=t.prototype;return n.connect=function(){if(this.options={element:this.element,threshold:.3},"IntersectionObserver"in window){var e=((e,t={})=>{const{dispatchEvent:n,eventPrefix:r}=Object.assign({},p,t),i=(null==t?void 0:t.element)||e.element,o=e.disconnect.bind(e),s=new IntersectionObserver(t=>{const[o]=t;o.isIntersecting?(t=>{if(e.isVisible=!0,u(e,"appear").call(e,t),n){const n=h("appear",e,r),o=d(n,null,{controller:e,entry:t});i.dispatchEvent(o)}})(o):e.isVisible&&(t=>{if(e.isVisible=!1,u(e,"disappear").call(e,t),n){const n=h("disappear",e,r),o=d(n,null,{controller:e,entry:t});i.dispatchEvent(o)}})(o)},t),a=()=>{s.observe(i)},l=()=>{s.unobserve(i)};return Object.assign(e,{isVisible:!1,disconnect(){l(),o()}}),a(),[a,l]})(this,this.options);this.observe=e[0],this.unobserve=e[1]}else this.loadContent()},n.appear=function(e){var t=this.element;""===t.src&&e.target===t&&e.isIntersecting&&(this.loadContent(),this.unobserve&&this.unobserve())},t}(l),P=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).maxSelections=0,t.boundHandleInputs=t.handleInputs.bind(s(t)),t}o(t,e);var n=t.prototype;return n.connect=function(){var e=this;this.inputTargets.forEach(function(t){return t.addEventListener("change",e.boundHandleInputs)})},n.disconnect=function(){var e=this;this.inputTargets.forEach(function(t){return t.removeEventListener("change",e.boundHandleInputs)})},n.handleInputs=function(e){var t=this.inputTargets.reduce(function(e,t){return t.checked?e+1:e},0),n=e.target;t>this.maxSelections?(e.preventDefault(),n.checked=!1,n.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!0})),n.dispatchEvent(new CustomEvent("limited-selection:too-many",{bubbles:!0,cancelable:!0,detail:{target:n}})),this.hasErrorTarget&&(this.errorTarget.innerHTML=this.messageValue)):(n.dispatchEvent(new CustomEvent("limited-selection:selection",{bubbles:!0,cancelable:!0,detail:{target:n}})),this.hasErrorTarget&&(this.errorTarget.innerHTML=""))},t}(a);P.targets=["input","error"],P.values={max:Number,message:String};var j=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundCheckPasswordsMatch=t.checkPasswordsMatch.bind(s(t)),t}o(t,e);var n=t.prototype;return n.connect=function(){var e=this;this.passwordTargets.forEach(function(t){return t.addEventListener("change",e.boundCheckPasswordsMatch)})},n.disconnect=function(){var e=this;this.passwordTargets.forEach(function(t){return t.removeEventListener("change",e.boundCheckPasswordsMatch)})},n.allPasswordsMatch=function(){var e=new Set(this.passwordTargets.map(function(e){return e.value}));return e.has("")||1==e.size},n.checkPasswordsMatch=function(){var e=this;this.allPasswordsMatch()?(this.element.dispatchEvent(new CustomEvent("password-confirm:match")),this.hasErrorClass&&this.passwordTargets.forEach(function(t){return t.classList.remove(e.errorClass)})):(this.element.dispatchEvent(new CustomEvent("password-confirm:no-match")),this.hasErrorClass&&this.passwordTargets.forEach(function(t){return t.classList.add(e.errorClass)}))},t}(a);j.targets=["password"],j.classes=["error"];var D=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n=t.prototype;return n.peak=function(e){e&&e.preventDefault(),this.passwordTarget.type="text"},n.hide=function(e){e&&e.preventDefault(),this.passwordTarget.type="password"},n.toggle=function(e){e&&e.preventDefault(),"password"===this.passwordTarget.type?this.peak():this.hide()},t}(a);D.targets=["password"];var A=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundMessageReceived=t.messageReceived.bind(s(t)),t}o(t,e);var n=t.prototype;return n.connect=function(){window.addEventListener("message",this.boundMessageReceived)},n.disconnect=function(){window.removeEventListener("message",this.boundMessageReceived)},n.messageReceived=function(e){var t=e.data;t.hasOwnProperty("name")&&"iframe-body"===t.name&&t.hasOwnProperty("height")&&this.resize(t.height)},n.resize=function(e){this.element.style.height=e+"px"},t}(a),R=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n=t.prototype;return n.connect=function(){var e,t,n;window.self!==window.top&&(y(this),t={},null===(n=(e=this).constructor.debounces)||void 0===n||n.forEach(n=>{if("string"==typeof n&&(e[n]=E(e[n],null==t?void 0:t.wait)),"object"==typeof n){const{name:r,wait:i}=n;if(!r)return;e[r]=E(e[r],i||(null==t?void 0:t.wait))}}),this.postUpdate())},n.windowResize=function(e){this.postUpdate()},n.postUpdate=function(){var e={name:"iframe-body",height:this.getHeight()};window.parent.postMessage(e,"*")},n.getHeight=function(){var e=document.body,t=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,t.clientHeight,t.scrollHeight,t.offsetHeight)},t}(a);R.debounces=["postUpdate"];var B,z=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n=t.prototype;return n.cleanupSelf=function(){this.cleanup(this.element)},n.cleanup=function(e){var t,n,i,o=this;e.dataset.controller=(null==(t=e.dataset.controller)?void 0:t.replaceAll(new RegExp("(s|^)"+this.identifier+"(s|$)","g"),""))||"",""==e.dataset.controller&&delete e.dataset.controller;var s=new RegExp("(s|^)"+this.identifier+"\\..+?(s|$)","g");e.dataset.target=(null==(n=e.dataset.target)?void 0:n.replaceAll(s,""))||"",delete e.dataset[r.default(this.identifier+"-target")],""==e.dataset.target&&delete e.dataset.target,e.dataset.action=(null==(i=e.dataset.target)?void 0:i.replaceAll(s,""))||"",delete e.dataset[r.default(this.identifier+"-action")],""==e.dataset.action&&delete e.dataset.action;var a=this.constructor.values;a&&Object.keys(a).forEach(function(t){return delete e.dataset[r.default(o.identifier+"-"+t+"-value")]});var l=this.constructor.classes;l&&Object.keys(l).forEach(function(t){return delete e.dataset[r.default(o.identifier+"-"+t+"-class")]})},t}(a),F=function(e,t){var r=void 0===t?{}:t,i=r.behavior,o=void 0===i?"smooth":i,s=r.block,a=void 0===s?"start":s,l=r.inline,c=void 0===l?"nearest":l;try{var u=function(){e.scrollIntoView({behavior:o,block:a,inline:c})},h=function(){if("smooth"==o&&!N)return Promise.resolve(function(){try{return Promise.resolve(Promise.resolve().then(function(){return n(require("smoothscroll-polyfill"))})).then(function(e){B||(B=!0,(0,e.polyfill)())})}catch(e){return Promise.reject(e)}}()).then(function(){})}();return Promise.resolve(h&&h.then?h.then(u):u())}catch(e){return Promise.reject(e)}},N="scrollBehavior"in document.documentElement.style;function q(e){if(!e)return null;var t=getComputedStyle(e).overflowY;return"visible"!==t&&"hidden"!==t&&e.scrollHeight>=e.clientHeight?e:q(e.parentElement)||document.body}var W=function(e){function t(){return e.apply(this,arguments)||this}return o(t,e),t.prototype.connect=function(){var e=this;requestAnimationFrame(function(){F(e.element,{behavior:e.hasBehaviorValue?e.behaviorValue:"smooth",block:e.hasBlockValue?e.blockValue:"center",inline:e.hasInlineValue?e.inlineValue:"center"}).catch(function(){return e.element.scrollIntoView()}),e.cleanupSelf()})},t}(z);W.values={behavior:String,block:String,inline:String};var $=function(e){function t(){return e.apply(this,arguments)||this}return o(t,e),t.prototype.scroll=function(e){var t;e&&e.preventDefault(),null!=(t="document"==(this.hasModeValue?this.modeValue:"document")?document.body:q(this.element))&&F(t,{behavior:"smooth",block:"end"}).catch(function(){return t.scrollIntoView(!1)})},t}(a);$.values={mode:String};var U=function(e){function t(){return e.apply(this,arguments)||this}return o(t,e),t.prototype.scroll=function(){var e=document.querySelector(this.selectorValue);e?F(e,{behavior:this.hasBehaviorValue?this.behaviorValue:"smooth",block:this.hasBlockValue?this.blockValue:"center",inline:this.hasInlineValue?this.inlineValue:"center"}).catch(function(){return e.scrollIntoView()}):console.warn("Could not find target for '"+this.selectorValue+"'")},t}(a);U.values={selector:String,behavior:String,block:String,inline:String};var _=function(e){function t(){return e.apply(this,arguments)||this}return o(t,e),t.prototype.scroll=function(e){var t;e&&e.preventDefault(),null!=(t="document"==(this.hasModeValue?this.modeValue:"document")?document.body:q(this.element))&&F(t,{behavior:"smooth",block:"start"}).catch(function(){return t.scrollIntoView(!1)})},t}(a);_.values={mode:String};var Y=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).timeout=null,t}o(t,e);var n=t.prototype;return n.connect=function(){var e=this;requestAnimationFrame(function(){e.timeout=setTimeout(function(){return e.element.remove()},1e3*e.secondsValue)})},n.disconnect=function(){this.timeout&&clearTimeout(this.timeout)},t}(a);Y.values={seconds:Number};var G=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n=t.prototype;return n.connect=function(){var e=this;if(!this.hasInsertValue)throw new Error("`insert` value was not specified");requestAnimationFrame(function(){e.hasImmediateValue&&e.immediateValue&&e.execute()})},n.execute=function(e){e&&e.preventDefault();var t=document.querySelector(this.targetValue);if(null!=t){var n=this.element.cloneNode(!0);switch(this.cleanup(n),this.insertValue){case"beforebegin":case"beforeend":case"afterend":case"afterbegin":t.insertAdjacentHTML(this.insertValue,n.outerHTML);break;case"replaceOuter":t.outerHTML=n.outerHTML;break;case"replaceInner":t.innerHTML=n.outerHTML;break;case"prepend":t.insertAdjacentHTML("afterbegin",n.outerHTML);break;case"append":t.insertAdjacentHTML("beforeend",n.outerHTML);break;default:throw new Error("`insert` value was not specified")}this.element.remove()}else this.element.dispatchEvent(new CustomEvent("teleport:error",{bubbles:!0,cancelable:!0}))},t}(z);G.values={target:String,insert:String,immediate:Boolean};var J=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n=t.prototype;return n.connect=function(){var e=this;if(!this.hasClassValue)throw new Error("data-toggle-class-class-value must not be empty");(this.hasMouseEnterValue||this.hasMouseLeaveValue)&&((e,t={})=>{new m(this,t)})(),this.hasClickAwayValue&&this.clickAwayValue&&((e,t={})=>{const{onlyVisible:n,dispatchEvent:r,events:i,eventPrefix:o}=Object.assign({},f,t),s=i=>{const s=(null==t?void 0:t.element)||e.element;if(!(s.contains(i.target)||!function(e){const t=e.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight,r=window.innerWidth||document.documentElement.clientWidth;return t.top<=n&&t.top+t.height>=0&&t.left<=r&&t.left+t.width>=0}(s)&&n)&&(e.clickOutside&&e.clickOutside(i),r)){const t=h("click:outside",e,o),n=d(t,i,{controller:e});s.dispatchEvent(n)}},a=e.disconnect.bind(e);Object.assign(e,{disconnect(){null==i||i.forEach(e=>{window.removeEventListener(e,s,!1)}),a()}}),null==i||i.forEach(e=>{window.addEventListener(e,s,!1)})})(this),requestAnimationFrame(function(){e.hasInitialValue&&e.toggleTargets.forEach("on"===e.initialValue?function(t){return e.elementOn(t)}:function(t){return e.elementOff(t)})})},n.clickOutside=function(){var e=this;this.toggleTargets.forEach(function(t){e.elementWasToggled(t)&&(e.elementToggleStatus(t),e.elementToggle(t))})},n.mouseEnter=function(){if(this.hasMouseEnterValue)switch(this.mouseEnterValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle()}return{}},n.mouseLeave=function(){if(this.hasMouseLeaveValue)switch(this.mouseLeaveValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle()}return{}},n.on=function(e){var t=this;this.toggleTargets.forEach(function(e){t.elementToggleStatus(e),t.elementOn(e)})},n.off=function(e){var t=this;this.toggleTargets.forEach(function(e){t.elementToggleStatus(e),t.elementOff(e)})},n.toggle=function(e){var t=this;this.toggleTargets.forEach(function(e){t.elementToggleStatus(e),t.elementToggle(e)})},n.elementWasToggled=function(e){return"true"==e.dataset.toggled},n.elementToggleStatus=function(e){this.elementWasToggled(e)?delete e.dataset.toggled:e.dataset.toggled="true"},n.elementToggle=function(e){this.classValue.split(" ").forEach(function(t){return e.classList.toggle(t)})},n.elementOn=function(e){this.classValue.split(" ").forEach(function(t){return e.classList.toggle(t,!0)})},n.elementOff=function(e){this.classValue.split(" ").forEach(function(t){return e.classList.toggle(t,!1)})},t}(a);J.targets=["toggle"],J.values={class:String,mouseEnter:String,mouseLeave:String,clickAway:Boolean,initial:String};var K=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n=t.prototype;return n.toggle=function(e){e&&e.preventDefault();var t=this.getFrame().src;null==t||t!==this.getSrc()?this.setSrc():this.clear()},n.setSrc=function(e){e&&e.preventDefault();var t=this.getFrame();this.hasLoadingMessageValue&&(t.innerHTML=this.loadingMessageValue),t.src=this.getSrc()},n.clear=function(e){e&&e.preventDefault();var t=this.getFrame();t.src="",t.innerHTML=""},n.getFrame=function(){var e=document.getElementById(""+this.frameIdValue);if(null==e)throw new Error("Could not find frame with ID '"+this.frameIdValue+"'");if("TURBO-FRAME"!=e.nodeName)throw new Error("Element targeted by ID '"+this.frameIdValue+"'");return e},n.getSrc=function(){var e=this.element;if(this.hasSrcValue)return this.srcValue;if(function(e){return"A"==e.nodeName}(e))return e.href;throw new Error("No link given to drive frame to")},t}(a);K.values={frameId:String,src:String,loadingMessage:String};var Q=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundHandler=t.updateWordCount.bind(s(t)),t}o(t,e);var n=t.prototype;return n.connect=function(){this.updateWordCount(),this.inputTarget.addEventListener("input",this.boundHandler)},n.disconnect=function(){this.inputTarget.removeEventListener("input",this.boundHandler)},n.updateWordCount=function(){var e=0,t=this.inputTarget.value.match(/\S+/g);this.outputTarget.innerText=(e=t&&t.length||0).toString(),this.hasErrorClass&&(this.isValidCount(e)?this.outputTarget.classList.remove(this.errorClass):this.outputTarget.classList.add(this.errorClass))},n.isValidCount=function(e){var t=0,n=99999;return this.hasMinValue&&(t=this.minValue),this.hasMaxValue&&(n=this.maxValue),e>=t&&e<=n},t}(a);Q.targets=["input","output"],Q.values={min:Number,max:Number},Q.classes=["error"],exports.AsyncBlockController=l,exports.AutoSubmitFormController=c,exports.AutosizeController=w,exports.CharCountController=C,exports.ClipboardController=T,exports.ConfirmNavigationController=V,exports.DebugController=L,exports.DetectDirtyController=x,exports.DisableInputsController=S,exports.DismissableController=k,exports.EmptyDomController=H,exports.EnableInputsController=I,exports.FallbackImageController=M,exports.LazyBlockController=O,exports.LimitedSelectionCheckboxesController=P,exports.PasswordConfirmController=j,exports.PasswordPeekController=D,exports.ResponsiveIframeBodyController=R,exports.ResponsiveIframeWrapperController=A,exports.ScrollIntoFocusController=W,exports.ScrollToBottomController=$,exports.ScrollToController=U,exports.ScrollToTopController=_,exports.SelfDestructController=Y,exports.TeleportController=G,exports.ToggleClassController=J,exports.TurboFrameRCController=K,exports.WordCountController=Q; +var e=require("stimulus");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function n(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t}var r=t(require("lodash.camelcase"));function i(){return(i=Object.assign||function(e){for(var t=1;t{const n=e[t];return"function"==typeof n?n:(...e)=>{}},h=(e,t,n)=>{let r=e;return!0===n?r=`${t.identifier}:${e}`:"string"==typeof n&&(r=`${n}:${e}`),r},d=(e,t,n)=>{const{bubbles:r,cancelable:i,composed:o}=t||{bubbles:!0,cancelable:!0,composed:!0};return t&&Object.assign(n,{originalEvent:t}),new CustomEvent(e,{bubbles:r,cancelable:i,composed:o,detail:n})},p={dispatchEvent:!0,eventPrefix:!0},f={events:["click","touchend"],onlyVisible:!0,dispatchEvent:!0,eventPrefix:!0},v={debug:!1,logger:console};class g{constructor(e,t={}){var n,r,i;this.log=(e,t)=>{this.debug&&(this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${e}`,"color: #3B82F6","color: unset"),this.logger.log(Object.assign({controllerId:this.controllerId},t)),this.logger.groupEnd())},this.debug=null!==(r=null!==(n=null==t?void 0:t.debug)&&void 0!==n?n:e.application.stimulusUseDebug)&&void 0!==r?r:v.debug,this.logger=null!==(i=null==t?void 0:t.logger)&&void 0!==i?i:v.logger,this.controller=e,this.controllerId=e.element.id||e.element.dataset.id,this.controllerInitialize=e.initialize.bind(e),this.controllerConnect=e.connect.bind(e),this.controllerDisconnect=e.disconnect.bind(e)}}class m extends g{constructor(e,t={}){super(e,t),this.observe=()=>{this.targetElement.addEventListener("mouseenter",this.onEnter),this.targetElement.addEventListener("mouseleave",this.onLeave)},this.unobserve=()=>{this.targetElement.removeEventListener("mouseenter",this.onEnter),this.targetElement.removeEventListener("mouseleave",this.onLeave)},this.onEnter=()=>{u(this.controller,"mouseEnter").call(this.controller),this.log("mouseEnter",{hover:!0})},this.onLeave=()=>{u(this.controller,"mouseLeave").call(this.controller),this.log("mouseLeave",{hover:!1})},this.targetElement=(null==t?void 0:t.element)||e.element,this.controller=e,this.enhanceController(),this.observe()}enhanceController(){const e=this.controller.disconnect.bind(this.controller);Object.assign(this.controller,{disconnect:()=>{this.unobserve(),e()}})}}class b extends g{constructor(e,t={}){super(e,t),this.observe=()=>{try{this.observer.observe(this.targetElement,this.options)}catch(e){this.controller.application.handleError(e,"At a minimum, one of childList, attributes, and/or characterData must be true",{})}},this.unobserve=()=>{this.observer.disconnect()},this.mutation=e=>{u(this.controller,"mutate").call(this.controller,e),this.log("mutate",{entries:e})},this.targetElement=(null==t?void 0:t.element)||e.element,this.controller=e,this.options=t,this.observer=new MutationObserver(this.mutation),this.enhanceController(),this.observe()}enhanceController(){const e=this.controller.disconnect.bind(this.controller);Object.assign(this.controller,{disconnect:()=>{this.unobserve(),e()}})}}const y=e=>{const t=t=>{const{innerWidth:n,innerHeight:r}=window,i={height:r||Infinity,width:n||Infinity,event:t};u(e,"windowResize").call(e,i)},n=e.disconnect.bind(e),r=()=>{window.addEventListener("resize",t),t()},i=()=>{window.removeEventListener("resize",t)};return Object.assign(e,{disconnect(){i(),n()}}),r(),[r,i]},E=(e,t=200)=>{let n=null;return function(){const r=arguments,i=this,o=()=>e.apply(i,r);n&&clearTimeout(n),n=setTimeout(o,t)}};var w=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundHandler=t.handler.bind(s(t)),t}o(t,e);var n=t.prototype;return n.connect=function(){var e=this.element;e.style.resize="none",e.style.boxSizing="border-box",e.addEventListener("input",this.boundHandler),e.addEventListener("focus",this.boundHandler),y(this),requestAnimationFrame(this.boundHandler)},n.windowResize=function(){this.handler()},n.handler=function(){this.autosize(this.element)},n.autosize=function(e){var t=e.offsetHeight-e.clientHeight;e.style.height="auto",e.style.height=e.scrollHeight+t+"px"},t}(a),C=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundHandler=t.updateCharCount.bind(s(t)),t}o(t,e);var n=t.prototype;return n.connect=function(){this.updateCharCount(),this.inputTarget.addEventListener("input",this.boundHandler)},n.disconnect=function(){this.inputTarget.removeEventListener("input",this.boundHandler)},n.updateCharCount=function(){var e=this.inputTarget.value.length;this.outputTarget.innerText=e.toString(),this.hasErrorClass&&(this.isValidCount(e)?this.outputTarget.classList.remove(this.errorClass):this.outputTarget.classList.add(this.errorClass))},n.isValidCount=function(e){var t=0,n=99999;return this.hasMinValue&&(t=this.minValue),this.hasMaxValue&&(n=this.maxValue),e>=t&&e<=n},t}(a);C.targets=["input","output"],C.values={min:Number,max:Number},C.classes=["error"];var T=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).supported=!1,t}o(t,e);var n=t.prototype;return n.connect=function(){this.supported=document.queryCommandSupported("copy"),this.hasRemoveUnusedValue&&this.removeUnusedValue&&(this.supported&&this.hasFallbackTarget?this.fallbackTarget.remove():this.hasCopyTarget&&this.copyTarget.remove())},n.select=function(e){e&&e.preventDefault(),this.sourceTarget.select()},n.copy=function(e){e&&e.preventDefault(),this.sourceTarget.select(),this.supported&&document.execCommand("copy")},t}(a);T.targets=["button","copy","fallback"],T.values={removeUnused:Boolean};var V=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n=t.prototype;return n.connect=function(){var e=this,t=this.messageValue;window.onbeforeunload=function(){return null==t||t},window.addEventListener("popstate",this.handlePopstate),window.addEventListener("submit",function(){window.removeEventListener("popstate",e.handlePopstate),window.onbeforeunload=null})},n.handlePopstate=function(e){return!1},t}(a);V.values={message:String};var L=function(e){function t(){return e.apply(this,arguments)||this}return o(t,e),t.prototype.connect=function(){console.log("Debug Controller",this,this.testTargets)},t}(a);L.targets=["test"];var S=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).initialValue=null,t.boundHandler=t.handler.bind(s(t)),t}o(t,e);var n=t.prototype;return n.connect=function(){var e=this.element;this.initialValue=this.isInputElement(e)&&this.isCheckable(e)?e.checked:e.value,e.addEventListener("input",this.boundHandler),e.addEventListener("change",this.boundHandler)},n.disconnect=function(){var e=this.element;e.removeEventListener("input",this.boundHandler),e.removeEventListener("change",this.boundHandler)},n.restore=function(){var e=this.element;this.isInputElement(e)&&this.isCheckable(e)?e.checked=this.initialValue:e.value=this.initialValue},n.handler=function(e){var t=this.element;this.initialValue!==t.value?t.setAttribute("data-dirty","true"):t.removeAttribute("data-dirty")},n.isCheckable=function(e){return"radio"===e.type||"checkbox"===e.type},n.isInputElement=function(e){return"INPUT"===e.tagName},t}(a),x=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n=t.prototype;return n.connect=function(){this.toggle()},n.toggle=function(){this.hasDisablerTarget&&this.disablerTarget.checked?this.disableInputs():this.enableInputs()},n.disableInputs=function(){var e=this.hasClearValue&&this.clearValue;this.disableTargets.forEach(function(t,n){e&&(t.value=""),t.disabled=!0})},n.enableInputs=function(){this.disableTargets.forEach(function(e,t){e.disabled=!1})},t}(a);x.targets=["disabler","disable"],x.values={clear:Boolean};var k=function(e){function t(){return e.apply(this,arguments)||this}return o(t,e),t.prototype.dismiss=function(){this.element.remove()},t}(a),H=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n=t.prototype;return n.connect=function(){((e,t={})=>{new b(this,t)})(0,{element:this.element,childList:!0}),this.checkEmpty()},n.mutate=function(e){this.checkEmpty()},n.checkEmpty=function(){var e,t=this;0===(e=this.hasScopeSelectorValue?this.element.querySelectorAll(this.scopeSelectorValue):this.element.children).length?(this.hasNotEmptyClass&&this.notEmptyClass.split(" ").forEach(function(e){return t.element.classList.remove(e)}),this.hasEmptyClass&&this.emptyClass.split(" ").forEach(function(e){return t.element.classList.add(e)}),this.element.dispatchEvent(new CustomEvent("dom:empty",{bubbles:!0,cancelable:!0}))):(this.hasNotEmptyClass&&this.notEmptyClass.split(" ").forEach(function(e){return t.element.classList.add(e)}),this.hasEmptyClass&&this.emptyClass.split(" ").forEach(function(e){return t.element.classList.remove(e)}),this.element.dispatchEvent(new CustomEvent("dom:not-empty",{bubbles:!0,cancelable:!0,detail:{count:e.length}})))},t}(a);H.classes=["empty","notEmpty"],H.values={scopeSelector:String};var I=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n=t.prototype;return n.connect=function(){this.toggle()},n.toggle=function(){this.hasEnablerTarget&&this.enablerTarget.checked?this.enableInputs():this.disableInputs()},n.disableInputs=function(){var e=this.hasClearValue&&this.clearValue;this.enableTargets.forEach(function(t,n){e&&(t.value=""),t.disabled=!0})},n.enableInputs=function(){this.enableTargets.forEach(function(e,t){e.disabled=!1})},t}(a);I.targets=["enabler","enable"],I.values={clear:Boolean};var M=function(e){function t(){return e.apply(this,arguments)||this}return o(t,e),t.prototype.connect=function(){var e=this,t=this.element;t.onerror=function(){e.hasPlaceholderValue?t.src=e.placeholderValue:t.style.display="none"}},t}(a);M.values={placeholder:String};var O=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n=t.prototype;return n.connect=function(){if(this.options={element:this.element,threshold:.3},"IntersectionObserver"in window){var e=((e,t={})=>{const{dispatchEvent:n,eventPrefix:r}=Object.assign({},p,t),i=(null==t?void 0:t.element)||e.element,o=e.disconnect.bind(e),s=new IntersectionObserver(t=>{const[o]=t;o.isIntersecting?(t=>{if(e.isVisible=!0,u(e,"appear").call(e,t),n){const n=h("appear",e,r),o=d(n,null,{controller:e,entry:t});i.dispatchEvent(o)}})(o):e.isVisible&&(t=>{if(e.isVisible=!1,u(e,"disappear").call(e,t),n){const n=h("disappear",e,r),o=d(n,null,{controller:e,entry:t});i.dispatchEvent(o)}})(o)},t),a=()=>{s.observe(i)},l=()=>{s.unobserve(i)};return Object.assign(e,{isVisible:!1,disconnect(){l(),o()}}),a(),[a,l]})(this,this.options);this.observe=e[0],this.unobserve=e[1]}else this.loadContent()},n.appear=function(e){var t=this.element;""===t.src&&e.target===t&&e.isIntersecting&&(this.loadContent(),this.unobserve&&this.unobserve())},t}(l),D=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).maxSelections=0,t.boundHandleInputs=t.handleInputs.bind(s(t)),t}o(t,e);var n=t.prototype;return n.connect=function(){var e=this;this.inputTargets.forEach(function(t){return t.addEventListener("change",e.boundHandleInputs)})},n.disconnect=function(){var e=this;this.inputTargets.forEach(function(t){return t.removeEventListener("change",e.boundHandleInputs)})},n.handleInputs=function(e){var t=this.inputTargets.reduce(function(e,t){return t.checked?e+1:e},0),n=e.target;t>this.maxSelections?(e.preventDefault(),n.checked=!1,n.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!0})),n.dispatchEvent(new CustomEvent("limited-selection:too-many",{bubbles:!0,cancelable:!0,detail:{target:n}})),this.hasErrorTarget&&(this.errorTarget.innerHTML=this.messageValue)):(n.dispatchEvent(new CustomEvent("limited-selection:selection",{bubbles:!0,cancelable:!0,detail:{target:n}})),this.hasErrorTarget&&(this.errorTarget.innerHTML=""))},t}(a);D.targets=["input","error"],D.values={max:Number,message:String};var P=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n,r=t.prototype;return r.connect=function(){this.checkStructure()},r.add=function(e){e&&e.preventDefault();var t=this.templateTarget.innerHTML.replace(/NEW_RECORD/g,this.generateID());this.targetTarget.insertAdjacentHTML(this.insertMode,t)},r.remove=function(e){e.preventDefault();var t=e.target.closest(this.wrapperClass);if(null==t)throw new Error("#remove was clicked from outside of a child record. Could not find an ancestor with class "+this.wrapperClass);if("true"===t.dataset.newRecord)t.remove();else{t.style.display="none";var n=t.querySelector("input[name*='_destroy']");if(null==n)throw new Error("Could not find a hidden input with name '_destroy'. NestedForm cannot remove an already persisted record without it.");n.value="1"}},r.generateID=function(){return(new Date).getTime().toString()+Math.random()},r.checkStructure=function(){if(this.templateTarget.innerHTML.indexOf("NEW_RECORD"))throw new Error("Could not find 'NEW_RECORD' in the provided template. Please make sure you've passed `child_index: 'NEW_RECORD'` to `fields_for`")},(n=[{key:"wrapperClass",get:function(){return this.hasWrapperSelectorValue?this.wrapperClassValue:"nested-fields"}},{key:"insertMode",get:function(){return this.hasInsertModeValue?this.insertModeValue:"beforeend"}}])&&function(e,t){for(var n=0;n{if("string"==typeof n&&(e[n]=E(e[n],null==t?void 0:t.wait)),"object"==typeof n){const{name:r,wait:i}=n;if(!r)return;e[r]=E(e[r],i||(null==t?void 0:t.wait))}}),this.postUpdate())},n.windowResize=function(e){this.postUpdate()},n.postUpdate=function(){var e={name:"iframe-body",height:this.getHeight()};window.parent.postMessage(e,"*")},n.getHeight=function(){var e=document.body,t=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,t.clientHeight,t.scrollHeight,t.offsetHeight)},t}(a);N.debounces=["postUpdate"];var B,F=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n=t.prototype;return n.cleanupSelf=function(){this.cleanup(this.element)},n.cleanup=function(e){var t,n,i,o=this;e.dataset.controller=(null==(t=e.dataset.controller)?void 0:t.replaceAll(new RegExp("(s|^)"+this.identifier+"(s|$)","g"),""))||"",""==e.dataset.controller&&delete e.dataset.controller;var s=new RegExp("(s|^)"+this.identifier+"\\..+?(s|$)","g");e.dataset.target=(null==(n=e.dataset.target)?void 0:n.replaceAll(s,""))||"",delete e.dataset[r.default(this.identifier+"-target")],""==e.dataset.target&&delete e.dataset.target,e.dataset.action=(null==(i=e.dataset.target)?void 0:i.replaceAll(s,""))||"",delete e.dataset[r.default(this.identifier+"-action")],""==e.dataset.action&&delete e.dataset.action;var a=this.constructor.values;a&&Object.keys(a).forEach(function(t){return delete e.dataset[r.default(o.identifier+"-"+t+"-value")]});var l=this.constructor.classes;l&&Object.keys(l).forEach(function(t){return delete e.dataset[r.default(o.identifier+"-"+t+"-class")]})},t}(a),W=function(e,t){var r=void 0===t?{}:t,i=r.behavior,o=void 0===i?"smooth":i,s=r.block,a=void 0===s?"start":s,l=r.inline,c=void 0===l?"nearest":l;try{var u=function(){e.scrollIntoView({behavior:o,block:a,inline:c})},h=function(){if("smooth"==o&&!z)return Promise.resolve(function(){try{return Promise.resolve(Promise.resolve().then(function(){return n(require("smoothscroll-polyfill"))})).then(function(e){B||(B=!0,(0,e.polyfill)())})}catch(e){return Promise.reject(e)}}()).then(function(){})}();return Promise.resolve(h&&h.then?h.then(u):u())}catch(e){return Promise.reject(e)}},z="scrollBehavior"in document.documentElement.style;function q(e){if(!e)return null;var t=getComputedStyle(e).overflowY;return"visible"!==t&&"hidden"!==t&&e.scrollHeight>=e.clientHeight?e:q(e.parentElement)||document.body}var _=function(e){function t(){return e.apply(this,arguments)||this}return o(t,e),t.prototype.connect=function(){var e=this;requestAnimationFrame(function(){W(e.element,{behavior:e.hasBehaviorValue?e.behaviorValue:"smooth",block:e.hasBlockValue?e.blockValue:"center",inline:e.hasInlineValue?e.inlineValue:"center"}).catch(function(){return e.element.scrollIntoView()}),e.cleanupSelf()})},t}(F);_.values={behavior:String,block:String,inline:String};var $=function(e){function t(){return e.apply(this,arguments)||this}return o(t,e),t.prototype.scroll=function(e){var t;e&&e.preventDefault(),null!=(t="document"==(this.hasModeValue?this.modeValue:"document")?document.body:q(this.element))&&W(t,{behavior:"smooth",block:"end"}).catch(function(){return t.scrollIntoView(!1)})},t}(a);$.values={mode:String};var U=function(e){function t(){return e.apply(this,arguments)||this}return o(t,e),t.prototype.scroll=function(){var e=document.querySelector(this.selectorValue);e?W(e,{behavior:this.hasBehaviorValue?this.behaviorValue:"smooth",block:this.hasBlockValue?this.blockValue:"center",inline:this.hasInlineValue?this.inlineValue:"center"}).catch(function(){return e.scrollIntoView()}):console.warn("Could not find target for '"+this.selectorValue+"'")},t}(a);U.values={selector:String,behavior:String,block:String,inline:String};var Y=function(e){function t(){return e.apply(this,arguments)||this}return o(t,e),t.prototype.scroll=function(e){var t;e&&e.preventDefault(),null!=(t="document"==(this.hasModeValue?this.modeValue:"document")?document.body:q(this.element))&&W(t,{behavior:"smooth",block:"start"}).catch(function(){return t.scrollIntoView(!1)})},t}(a);Y.values={mode:String};var G=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).timeout=null,t}o(t,e);var n=t.prototype;return n.connect=function(){var e=this;requestAnimationFrame(function(){e.timeout=setTimeout(function(){return e.element.remove()},1e3*e.secondsValue)})},n.disconnect=function(){this.timeout&&clearTimeout(this.timeout)},t}(a);G.values={seconds:Number};var J=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n=t.prototype;return n.connect=function(){var e=this;if(!this.hasInsertValue)throw new Error("`insert` value was not specified");requestAnimationFrame(function(){e.hasImmediateValue&&e.immediateValue&&e.execute()})},n.execute=function(e){e&&e.preventDefault();var t=document.querySelector(this.targetValue);if(null!=t){var n=this.element.cloneNode(!0);switch(this.cleanup(n),this.insertValue){case"beforebegin":case"beforeend":case"afterend":case"afterbegin":t.insertAdjacentHTML(this.insertValue,n.outerHTML);break;case"replaceOuter":t.outerHTML=n.outerHTML;break;case"replaceInner":t.innerHTML=n.outerHTML;break;case"prepend":t.insertAdjacentHTML("afterbegin",n.outerHTML);break;case"append":t.insertAdjacentHTML("beforeend",n.outerHTML);break;default:throw new Error("`insert` value was not specified")}this.element.remove()}else this.element.dispatchEvent(new CustomEvent("teleport:error",{bubbles:!0,cancelable:!0}))},t}(F);J.values={target:String,insert:String,immediate:Boolean};var K=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n=t.prototype;return n.connect=function(){var e=this;if(!this.hasClassValue)throw new Error("data-toggle-class-class-value must not be empty");(this.hasMouseEnterValue||this.hasMouseLeaveValue)&&((e,t={})=>{new m(this,t)})(),this.hasClickAwayValue&&this.clickAwayValue&&((e,t={})=>{const{onlyVisible:n,dispatchEvent:r,events:i,eventPrefix:o}=Object.assign({},f,t),s=i=>{const s=(null==t?void 0:t.element)||e.element;if(!(s.contains(i.target)||!function(e){const t=e.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight,r=window.innerWidth||document.documentElement.clientWidth;return t.top<=n&&t.top+t.height>=0&&t.left<=r&&t.left+t.width>=0}(s)&&n)&&(e.clickOutside&&e.clickOutside(i),r)){const t=h("click:outside",e,o),n=d(t,i,{controller:e});s.dispatchEvent(n)}},a=e.disconnect.bind(e);Object.assign(e,{disconnect(){null==i||i.forEach(e=>{window.removeEventListener(e,s,!1)}),a()}}),null==i||i.forEach(e=>{window.addEventListener(e,s,!1)})})(this),requestAnimationFrame(function(){e.hasInitialValue&&e.toggleTargets.forEach("on"===e.initialValue?function(t){return e.elementOn(t)}:function(t){return e.elementOff(t)})})},n.clickOutside=function(){var e=this;this.toggleTargets.forEach(function(t){e.elementWasToggled(t)&&(e.elementToggleStatus(t),e.elementToggle(t))})},n.mouseEnter=function(){if(this.hasMouseEnterValue)switch(this.mouseEnterValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle()}return{}},n.mouseLeave=function(){if(this.hasMouseLeaveValue)switch(this.mouseLeaveValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle()}return{}},n.on=function(e){var t=this;this.toggleTargets.forEach(function(e){t.elementToggleStatus(e),t.elementOn(e)})},n.off=function(e){var t=this;this.toggleTargets.forEach(function(e){t.elementToggleStatus(e),t.elementOff(e)})},n.toggle=function(e){var t=this;this.toggleTargets.forEach(function(e){t.elementToggleStatus(e),t.elementToggle(e)})},n.elementWasToggled=function(e){return"true"==e.dataset.toggled},n.elementToggleStatus=function(e){this.elementWasToggled(e)?delete e.dataset.toggled:e.dataset.toggled="true"},n.elementToggle=function(e){this.classValue.split(" ").forEach(function(t){return e.classList.toggle(t)})},n.elementOn=function(e){this.classValue.split(" ").forEach(function(t){return e.classList.toggle(t,!0)})},n.elementOff=function(e){this.classValue.split(" ").forEach(function(t){return e.classList.toggle(t,!1)})},t}(a);K.targets=["toggle"],K.values={class:String,mouseEnter:String,mouseLeave:String,clickAway:Boolean,initial:String};var Q=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n=t.prototype;return n.toggle=function(e){e&&e.preventDefault();var t=this.getFrame().src;null==t||t!==this.getSrc()?this.setSrc():this.clear()},n.setSrc=function(e){e&&e.preventDefault();var t=this.getFrame();this.hasLoadingMessageValue&&(t.innerHTML=this.loadingMessageValue),t.src=this.getSrc()},n.clear=function(e){e&&e.preventDefault();var t=this.getFrame();t.src="",t.innerHTML=""},n.getFrame=function(){var e=document.getElementById(""+this.frameIdValue);if(null==e)throw new Error("Could not find frame with ID '"+this.frameIdValue+"'");if("TURBO-FRAME"!=e.nodeName)throw new Error("Element targeted by ID '"+this.frameIdValue+"'");return e},n.getSrc=function(){var e=this.element;if(this.hasSrcValue)return this.srcValue;if(function(e){return"A"==e.nodeName}(e))return e.href;throw new Error("No link given to drive frame to")},t}(a);Q.values={frameId:String,src:String,loadingMessage:String};var X=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundHandler=t.updateWordCount.bind(s(t)),t}o(t,e);var n=t.prototype;return n.connect=function(){this.updateWordCount(),this.inputTarget.addEventListener("input",this.boundHandler)},n.disconnect=function(){this.inputTarget.removeEventListener("input",this.boundHandler)},n.updateWordCount=function(){var e=0,t=this.inputTarget.value.match(/\S+/g);this.outputTarget.innerText=(e=t&&t.length||0).toString(),this.hasErrorClass&&(this.isValidCount(e)?this.outputTarget.classList.remove(this.errorClass):this.outputTarget.classList.add(this.errorClass))},n.isValidCount=function(e){var t=0,n=99999;return this.hasMinValue&&(t=this.minValue),this.hasMaxValue&&(n=this.maxValue),e>=t&&e<=n},t}(a);X.targets=["input","output"],X.values={min:Number,max:Number},X.classes=["error"],exports.AsyncBlockController=l,exports.AutoSubmitFormController=c,exports.AutosizeController=w,exports.CharCountController=C,exports.ClipboardController=T,exports.ConfirmNavigationController=V,exports.DebugController=L,exports.DetectDirtyController=S,exports.DisableInputsController=x,exports.DismissableController=k,exports.EmptyDomController=H,exports.EnableInputsController=I,exports.FallbackImageController=M,exports.LazyBlockController=O,exports.LimitedSelectionCheckboxesController=D,exports.NestedFormController=P,exports.PasswordConfirmController=j,exports.PasswordPeekController=R,exports.ResponsiveIframeBodyController=N,exports.ResponsiveIframeWrapperController=A,exports.ScrollIntoFocusController=_,exports.ScrollToBottomController=$,exports.ScrollToController=U,exports.ScrollToTopController=Y,exports.SelfDestructController=G,exports.TeleportController=J,exports.ToggleClassController=K,exports.TurboFrameRCController=Q,exports.WordCountController=X; //# sourceMappingURL=stimulus-library.js.map diff --git a/dist/stimulus-library.js.map b/dist/stimulus-library.js.map index 8ad101d9..99b305a4 100644 --- a/dist/stimulus-library.js.map +++ b/dist/stimulus-library.js.map @@ -1 +1 @@ -{"version":3,"file":"stimulus-library.js","sources":["../src/base_controller.ts","../src/async_block_controller.ts","../src/auto_submit_form_controller.ts","../node_modules/stimulus-use/dist/support/index.js","../node_modules/stimulus-use/dist/use-intersection/use-intersection.js","../node_modules/stimulus-use/dist/use-click-outside/use-click-outside.js","../node_modules/stimulus-use/dist/stimulus_use.js","../node_modules/stimulus-use/dist/use-hover/use-hover.js","../node_modules/stimulus-use/dist/use-mutation/use-mutation.js","../node_modules/stimulus-use/dist/use-window-resize/use-window-resize.js","../node_modules/stimulus-use/dist/use-debounce/use-debounce.js","../src/autosize_controller.ts","../src/char_count_controller.ts","../src/clipboard_controller.ts","../src/confirm_navigation_controller.ts","../src/debug_controller.ts","../src/detect_dirty_controller.ts","../src/disable_inputs_controller.ts","../src/dismissable_controller.ts","../src/empty_dom_controller.ts","../src/enable_inputs_controller.ts","../src/fallback_image_controller.ts","../src/lazy_block_controller.ts","../src/limited_selection_checkboxes_controller.ts","../src/password_confirm_controller.ts","../src/password_peek_controller.ts","../src/responsive_iframe_controller.ts","../src/utilities/scroll.ts","../src/utilities/ephemeral_controller.ts","../src/scroll_into_focus_controller.ts","../src/scroll_to_bottom_controller.ts","../src/scroll_to_controller.ts","../src/scroll_to_top_controller.ts","../src/self_destruct_controller.ts","../src/teleport_controller.ts","../src/toggle_class_controller.ts","../src/turbo_frame_rc_controller.ts","../src/utilities/turbo.ts","../src/utilities/elements.ts","../src/word_count_controller.ts"],"sourcesContent":["import {Context, Controller} from \"stimulus\";\r\n\r\nexport class BaseController extends Controller {\r\n\r\n constructor(context: Context) {\r\n super(context);\r\n return new Proxy(this, {\r\n get: (obj, prop) => {\r\n let returnVal = Reflect.get(obj, prop);\r\n let self = this;\r\n if (logProperty(prop.toString())) {\r\n if (typeof returnVal == \"function\") {\r\n return new Proxy(returnVal, {\r\n apply(target: any, thisArg: any, argArray?: any): any {\r\n self.log(prop.toString(), {\r\n args: argArray,\r\n });\r\n return Reflect.apply(target, thisArg, argArray);\r\n },\r\n });\r\n } else {\r\n this.log(prop.toString());\r\n }\r\n }\r\n return returnVal;\r\n },\r\n });\r\n }\r\n\r\n log(functionName: string, args: {} = {}): void {\r\n // @ts-ignore\r\n if (!this.application.debug) {\r\n return;\r\n }\r\n let logger = console;\r\n logger.groupCollapsed(`%c${this.identifier} %c#${functionName}`, \"color: #3B82F6\", \"color: unset\");\r\n logger.log({\r\n element: this.element,\r\n ...args,\r\n });\r\n logger.groupEnd();\r\n }\r\n\r\n}\r\n\r\nfunction logProperty(prop: string): boolean {\r\n switch (prop) {\r\n case \"application\":\r\n case \"element\":\r\n case \"constructor\":\r\n case \"initialize\":\r\n case \"log\":\r\n case \"data\":\r\n case \"valueDescriptorMap\":\r\n case \"identifier\":\r\n return false;\r\n }\r\n\r\n if (/^.*?Target(s)?$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?Value$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?ValueChanged$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?Class$/.test(prop)) {\r\n return false;\r\n }\r\n\r\n return true;\r\n}\r\n","import {BaseController} from \"./base_controller\";\n\nexport class AsyncBlockController extends BaseController {\n static targets = [\"replace\"];\n static values = {endpoint: String};\n\n declare readonly replaceTarget: HTMLElement;\n declare readonly hasReplaceTarget: boolean;\n declare readonly endpointValue: string;\n\n\n // This is a simple controller to load a block of content when the page loads.\n // It should be used to give a quick initial response before calling out to an\n // an AJAX endpoint to do some expensive work.\n connect() {\n this.loadContent();\n }\n\n loadContent() {\n let el = (this.hasReplaceTarget ? this.replaceTarget : this.element) as HTMLElement;\n fetch(this.endpointValue)\n .then((response) => response.text())\n .then((html) => {\n let newEl = document.createElement(\"div\");\n newEl.innerHTML = html;\n el.replaceWith(newEl);\n\n // Trigger event to show block has loaded\n let event = new CustomEvent(\"ajax:success\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n })\n .catch(err => {\n el.replaceWith(\"Sorry, this content failed to load\");\n\n let event = new CustomEvent(\"ajax:error\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n })\n .finally(() => {\n let event = new CustomEvent(\"ajax:complete\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n });\n }\n}\n","import {BaseController} from \"./base_controller\";\n\nexport class AutoSubmitFormController extends BaseController {\n\n private boundHandler = this.handler.bind(this);\n\n connect() {\n (this.element as HTMLElement).querySelectorAll(\"input, select, textarea\").forEach(el => el.addEventListener(\"change\", this.boundHandler));\n }\n\n disconnect() {\n (this.element as HTMLElement).querySelectorAll(\"input, select, textarea\").forEach(el => el.removeEventListener(\"change\", this.boundHandler));\n }\n\n private handler(e: Event) {\n // this.element.submit()\n // Moved to this to support remote forms and CSRF properly\n this.element.dispatchEvent(\n new CustomEvent(\"submit\", {\n bubbles: true,\n cancelable: true,\n }),\n );\n }\n}\n","export const method = (controller, methodName) => {\n const method = controller[methodName];\n if (typeof method == 'function') {\n return method;\n }\n else {\n return (...args) => { };\n }\n};\nexport const composeEventName = (name, controller, eventPrefix) => {\n let composedName = name;\n if (eventPrefix === true) {\n composedName = `${controller.identifier}:${name}`;\n }\n else if (typeof eventPrefix === 'string') {\n composedName = `${eventPrefix}:${name}`;\n }\n return composedName;\n};\nexport const extendedEvent = (type, event, detail) => {\n const { bubbles, cancelable, composed } = event || { bubbles: true, cancelable: true, composed: true };\n if (event) {\n Object.assign(detail, { originalEvent: event });\n }\n const customEvent = new CustomEvent(type, {\n bubbles,\n cancelable,\n composed,\n detail,\n });\n return customEvent;\n};\nexport function isElementInViewport(el) {\n const rect = el.getBoundingClientRect();\n const windowHeight = (window.innerHeight || document.documentElement.clientHeight);\n const windowWidth = (window.innerWidth || document.documentElement.clientWidth);\n const vertInView = (rect.top <= windowHeight) && ((rect.top + rect.height) >= 0);\n const horInView = (rect.left <= windowWidth) && ((rect.left + rect.width) >= 0);\n return (vertInView && horInView);\n}\n//# sourceMappingURL=index.js.map","import { method, extendedEvent, composeEventName } from '../support/index';\nconst defaultOptions = {\n dispatchEvent: true,\n eventPrefix: true,\n};\nexport const useIntersection = (controller, options = {}) => {\n const { dispatchEvent, eventPrefix } = Object.assign({}, defaultOptions, options);\n const targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n const callback = (entries) => {\n const [entry] = entries;\n if (entry.isIntersecting) {\n dispatchAppear(entry);\n }\n else if (controller.isVisible) {\n dispatchDisappear(entry);\n }\n };\n const dispatchAppear = (entry) => {\n controller.isVisible = true;\n method(controller, 'appear').call(controller, entry);\n // emit a custom \"appear\" event\n if (dispatchEvent) {\n const eventName = composeEventName('appear', controller, eventPrefix);\n const appearEvent = extendedEvent(eventName, null, { controller, entry });\n targetElement.dispatchEvent(appearEvent);\n }\n };\n const dispatchDisappear = (entry) => {\n controller.isVisible = false;\n method(controller, 'disappear').call(controller, entry);\n // emit a custom \"disappear\" event\n if (dispatchEvent) {\n const eventName = composeEventName('disappear', controller, eventPrefix);\n const disappearEvent = extendedEvent(eventName, null, { controller, entry });\n targetElement.dispatchEvent(disappearEvent);\n }\n };\n // keep a copy of the current disconnect() function of the controller\n // to support composing several behaviors\n const controllerDisconnect = controller.disconnect.bind(controller);\n const observer = new IntersectionObserver(callback, options);\n const observe = () => {\n observer.observe(targetElement);\n };\n const unobserve = () => {\n observer.unobserve(targetElement);\n };\n Object.assign(controller, {\n isVisible: false,\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-intersection.js.map","import { composeEventName, extendedEvent, isElementInViewport } from '../support/index';\nconst defaultOptions = {\n events: ['click', 'touchend'],\n onlyVisible: true,\n dispatchEvent: true,\n eventPrefix: true,\n};\nexport const useClickOutside = (controller, options = {}) => {\n const { onlyVisible, dispatchEvent, events, eventPrefix } = Object.assign({}, defaultOptions, options);\n const onEvent = (event) => {\n const targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n if (targetElement.contains(event.target) || (!isElementInViewport(targetElement) && onlyVisible)) {\n return;\n }\n // call the clickOutside method of the Stimulus controller\n if (controller.clickOutside) {\n controller.clickOutside(event);\n }\n // emit a custom event\n if (dispatchEvent) {\n const eventName = composeEventName('click:outside', controller, eventPrefix);\n const clickOutsideEvent = extendedEvent(eventName, event, { controller });\n targetElement.dispatchEvent(clickOutsideEvent);\n }\n };\n const observe = () => {\n events === null || events === void 0 ? void 0 : events.forEach(event => {\n window.addEventListener(event, onEvent, false);\n });\n };\n const unobserve = () => {\n events === null || events === void 0 ? void 0 : events.forEach(event => {\n window.removeEventListener(event, onEvent, false);\n });\n };\n // keep a copy of the current disconnect() function of the controller\n // to support composing several behaviors\n const controllerDisconnect = controller.disconnect.bind(controller);\n Object.assign(controller, {\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-click-outside.js.map","const defaultOptions = {\n debug: false,\n logger: console\n};\nexport class StimulusUse {\n constructor(controller, options = {}) {\n var _a, _b, _c;\n this.log = (functionName, args) => {\n if (!this.debug)\n return;\n this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${functionName}`, 'color: #3B82F6', 'color: unset');\n this.logger.log(Object.assign({ controllerId: this.controllerId }, args));\n this.logger.groupEnd();\n };\n this.debug = (_b = (_a = options === null || options === void 0 ? void 0 : options.debug) !== null && _a !== void 0 ? _a : controller.application.stimulusUseDebug) !== null && _b !== void 0 ? _b : defaultOptions.debug;\n this.logger = (_c = options === null || options === void 0 ? void 0 : options.logger) !== null && _c !== void 0 ? _c : defaultOptions.logger;\n this.controller = controller;\n this.controllerId = controller.element.id || controller.element.dataset.id;\n // make copies of lifecycle functions\n this.controllerInitialize = controller.initialize.bind(controller);\n this.controllerConnect = controller.connect.bind(controller);\n this.controllerDisconnect = controller.disconnect.bind(controller);\n }\n}\n//# sourceMappingURL=stimulus_use.js.map","import { StimulusUse } from '../stimulus_use';\nimport { method } from '../support/index';\nexport class UseHover extends StimulusUse {\n constructor(controller, options = {}) {\n super(controller, options);\n this.observe = () => {\n this.targetElement.addEventListener('mouseenter', this.onEnter);\n this.targetElement.addEventListener('mouseleave', this.onLeave);\n };\n this.unobserve = () => {\n this.targetElement.removeEventListener('mouseenter', this.onEnter);\n this.targetElement.removeEventListener('mouseleave', this.onLeave);\n };\n this.onEnter = () => {\n method(this.controller, 'mouseEnter').call(this.controller);\n this.log('mouseEnter', { hover: true });\n };\n this.onLeave = () => {\n method(this.controller, 'mouseLeave').call(this.controller);\n this.log('mouseLeave', { hover: false });\n };\n this.targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n this.controller = controller;\n this.enhanceController();\n this.observe();\n }\n enhanceController() {\n const controllerDisconnect = this.controller.disconnect.bind(this.controller);\n const disconnect = () => {\n this.unobserve();\n controllerDisconnect();\n };\n Object.assign(this.controller, { disconnect });\n }\n}\nexport const useHover = (controller, options = {}) => {\n const observer = new UseHover(controller, options);\n return [observer.observe, observer.unobserve];\n};\n//# sourceMappingURL=use-hover.js.map","import { StimulusUse } from '../stimulus_use';\nimport { method } from '../support/index';\nexport class UseMutation extends StimulusUse {\n constructor(controller, options = {}) {\n super(controller, options);\n this.observe = () => {\n try {\n this.observer.observe(this.targetElement, this.options);\n }\n catch (error) {\n this.controller.application.handleError(error, \"At a minimum, one of childList, attributes, and/or characterData must be true\", {});\n }\n };\n this.unobserve = () => {\n this.observer.disconnect();\n };\n this.mutation = (entries) => {\n method(this.controller, 'mutate').call(this.controller, entries);\n this.log('mutate', { entries });\n };\n this.targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n this.controller = controller;\n this.options = options;\n this.observer = new MutationObserver(this.mutation);\n this.enhanceController();\n this.observe();\n }\n enhanceController() {\n const controllerDisconnect = this.controller.disconnect.bind(this.controller);\n const disconnect = () => {\n this.unobserve();\n controllerDisconnect();\n };\n Object.assign(this.controller, { disconnect });\n }\n}\nexport const useMutation = (controller, options = {}) => {\n const observer = new UseMutation(controller, options);\n return [observer.observe, observer.unobserve];\n};\n//# sourceMappingURL=use-mutation.js.map","import { method } from '../support/index';\nexport const useWindowResize = (controller) => {\n const callback = (event) => {\n const { innerWidth, innerHeight } = window;\n const payload = {\n height: innerHeight || Infinity,\n width: innerWidth || Infinity,\n event\n };\n method(controller, 'windowResize').call(controller, payload);\n };\n const controllerDisconnect = controller.disconnect.bind(controller);\n const observe = () => {\n window.addEventListener('resize', callback);\n callback();\n };\n const unobserve = () => {\n window.removeEventListener('resize', callback);\n };\n Object.assign(controller, {\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-window-resize.js.map","import { Controller } from 'stimulus';\nclass DebounceController extends Controller {\n}\nDebounceController.debounces = [];\nconst defaultWait = 200;\nconst debounce = (fn, wait = defaultWait) => {\n let timeoutId = null;\n return function () {\n const args = arguments;\n const context = this;\n const callback = () => fn.apply(context, args);\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n timeoutId = setTimeout(callback, wait);\n };\n};\nexport const useDebounce = (controller, options) => {\n var _a;\n const constructor = controller.constructor;\n (_a = constructor.debounces) === null || _a === void 0 ? void 0 : _a.forEach((func) => {\n if (typeof func === \"string\") {\n controller[func] = debounce(controller[func], options === null || options === void 0 ? void 0 : options.wait);\n }\n if (typeof func === \"object\") {\n const { name, wait } = func;\n if (!name)\n return;\n controller[name] = debounce(controller[name], wait || (options === null || options === void 0 ? void 0 : options.wait));\n }\n });\n};\n//# sourceMappingURL=use-debounce.js.map","import {useWindowResize} from \"stimulus-use\";\nimport {BaseController} from \"./base_controller\";\n\nexport class AutosizeController extends BaseController {\n\n private boundHandler = this.handler.bind(this);\n\n connect() {\n let target = this.element as HTMLTextAreaElement;\n target.style.resize = \"none\";\n target.style.boxSizing = \"border-box\";\n target.addEventListener(\"input\", this.boundHandler);\n target.addEventListener(\"focus\", this.boundHandler);\n useWindowResize(this);\n requestAnimationFrame(this.boundHandler);\n }\n\n windowResize() {\n this.handler();\n }\n\n private handler() {\n this.autosize(this.element as HTMLTextAreaElement);\n };\n\n private autosize(element: HTMLTextAreaElement) {\n let offset = element.offsetHeight - element.clientHeight;\n element.style.height = \"auto\";\n element.style.height = element.scrollHeight + offset + \"px\";\n }\n\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class CharCountController extends BaseController {\r\n\r\n static targets = [\"input\", \"output\"];\r\n static values = {min: Number, max: Number};\r\n static classes = [\"error\"];\r\n\r\n declare readonly inputTarget: HTMLInputElement | HTMLTextAreaElement;\r\n declare readonly outputTarget: HTMLElement;\r\n declare minValue: number;\r\n declare hasMinValue: boolean;\r\n declare maxValue: number;\r\n declare hasMaxValue: boolean;\r\n declare errorClass: string;\r\n declare hasErrorClass: boolean;\r\n\r\n boundHandler = this.updateCharCount.bind(this);\r\n\r\n connect() {\r\n this.updateCharCount();\r\n this.inputTarget.addEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n this.inputTarget.removeEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n updateCharCount() {\r\n let charCount = this.inputTarget.value.length;\r\n this.outputTarget.innerText = charCount.toString();\r\n if (this.hasErrorClass) {\r\n if (this.isValidCount(charCount)) {\r\n this.outputTarget.classList.remove(this.errorClass);\r\n } else {\r\n this.outputTarget.classList.add(this.errorClass);\r\n }\r\n }\r\n }\r\n\r\n isValidCount(count: number) {\r\n let min = 0;\r\n let max = 99999;\r\n\r\n if (this.hasMinValue) {\r\n min = this.minValue;\r\n }\r\n\r\n if (this.hasMaxValue) {\r\n max = this.maxValue;\r\n }\r\n\r\n return count >= min && count <= max;\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class ClipboardController extends BaseController {\r\n\r\n static targets = [\"button\", \"copy\", \"fallback\"];\r\n static values = {removeUnused: Boolean};\r\n\r\n declare readonly sourceTarget: HTMLElement;\r\n declare readonly copyTarget: HTMLElement;\r\n declare readonly hasCopyTarget: boolean;\r\n declare readonly fallbackTarget: HTMLElement;\r\n declare readonly hasFallbackTarget: boolean;\r\n\r\n declare readonly hasRemoveUnusedValue: boolean;\r\n declare readonly removeUnusedValue: boolean;\r\n\r\n supported = false;\r\n\r\n connect() {\r\n this.supported = document.queryCommandSupported(\"copy\");\r\n\r\n if (this.hasRemoveUnusedValue && this.removeUnusedValue) {\r\n if (this.supported && this.hasFallbackTarget) {\r\n this.fallbackTarget.remove();\r\n } else if (this.hasCopyTarget) {\r\n this.copyTarget.remove();\r\n }\r\n }\r\n }\r\n\r\n select(event: MouseEvent) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n (this.sourceTarget as HTMLInputElement | HTMLTextAreaElement).select();\r\n }\r\n\r\n copy(event: ClipboardEvent) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n (this.sourceTarget as HTMLInputElement | HTMLTextAreaElement).select();\r\n if (this.supported) {\r\n document.execCommand(\"copy\");\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\n\nexport class ConfirmNavigationController extends BaseController {\n\n static values = {message: String};\n\n declare readonly messageValue: string;\n\n connect() {\n let confirmMessage = this.messageValue;\n window.onbeforeunload = () => (confirmMessage == null ? true : confirmMessage);\n window.addEventListener(\"popstate\", this.handlePopstate);\n window.addEventListener(\"submit\", () => {\n window.removeEventListener(\"popstate\", this.handlePopstate);\n window.onbeforeunload = null;\n });\n // TODO: Turbo navigation events\n }\n\n handlePopstate(event: PopStateEvent) {\n return false;\n }\n\n}\n","import {BaseController} from \"./base_controller\";\n\nexport class DebugController extends BaseController {\n\n static targets = [\"test\"];\n declare testTargets: HTMLElement[];\n\n connect() {\n console.log(\"Debug Controller\", this, this.testTargets);\n }\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DetectDirtyController extends BaseController {\r\n\r\n initialValue: string | boolean | null = null;\r\n\r\n boundHandler = this.handler.bind(this);\r\n\r\n connect() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n if (this.isInputElement(element) && this.isCheckable(element)) {\r\n this.initialValue = element.checked;\r\n } else {\r\n this.initialValue = element.value;\r\n }\r\n element.addEventListener(\"input\", this.boundHandler);\r\n element.addEventListener(\"change\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n element.removeEventListener(\"input\", this.boundHandler);\r\n element.removeEventListener(\"change\", this.boundHandler);\r\n }\r\n\r\n restore() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n if (this.isInputElement(element) && this.isCheckable(element)) {\r\n element.checked = this.initialValue as boolean;\r\n } else {\r\n element.value = this.initialValue as string;\r\n }\r\n }\r\n\r\n private handler(event?: Event) {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n\r\n if (this.initialValue !== element.value) {\r\n element.setAttribute(\"data-dirty\", \"true\");\r\n } else {\r\n element.removeAttribute(\"data-dirty\");\r\n }\r\n }\r\n\r\n private isCheckable(element: HTMLInputElement): boolean {\r\n return (element.type === \"radio\" || element.type === \"checkbox\");\r\n }\r\n\r\n private isInputElement(element: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement): element is HTMLInputElement {\r\n return element.tagName === \"INPUT\";\r\n }\r\n\r\n}\r\n\r\nexport function isDirty(element: HTMLElement) {\r\n return element.hasAttribute(\"data-dirty\");\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DisableInputsController extends BaseController {\r\n\r\n static targets = [\"disabler\", \"disable\"];\r\n\r\n static values = {\r\n clear: Boolean,\r\n };\r\n\r\n declare readonly hasDisablerTarget: boolean;\r\n declare readonly disablerTarget: HTMLInputElement;\r\n declare readonly disableTargets: Array;\r\n declare readonly clearValue: boolean;\r\n declare readonly hasClearValue: boolean;\r\n\r\n connect() {\r\n this.toggle();\r\n }\r\n\r\n toggle() {\r\n if (this.hasDisablerTarget && this.disablerTarget.checked) {\r\n this.disableInputs();\r\n } else {\r\n this.enableInputs();\r\n }\r\n }\r\n\r\n disableInputs() {\r\n let shouldClear = this.hasClearValue && this.clearValue;\r\n this.disableTargets.forEach((el, _) => {\r\n if (shouldClear) {\r\n el.value = \"\";\r\n }\r\n el.disabled = true;\r\n });\r\n }\r\n\r\n enableInputs() {\r\n this.disableTargets.forEach((el, _) => {\r\n el.disabled = false;\r\n });\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DismissableController extends BaseController {\r\n\r\n\r\n dismiss() {\r\n this.element.remove();\r\n }\r\n\r\n}\r\n","import {useMutation} from \"stimulus-use\";\r\nimport {BaseController} from \"./base_controller\";\r\n\r\nexport class EmptyDomController extends BaseController {\r\n\r\n static classes = [\"empty\", \"notEmpty\"];\r\n static values = {scopeSelector: String};\r\n\r\n declare hasEmptyClass: boolean;\r\n declare emptyClass: string;\r\n declare hasNotEmptyClass: boolean;\r\n declare notEmptyClass: string;\r\n\r\n declare hasScopeSelectorValue: boolean;\r\n declare scopeSelectorValue: string;\r\n\r\n connect() {\r\n useMutation(this, {element: this.element, childList: true});\r\n this.checkEmpty();\r\n }\r\n\r\n mutate(entries: MutationRecord[]) {\r\n this.checkEmpty();\r\n }\r\n\r\n checkEmpty() {\r\n let children;\r\n if (this.hasScopeSelectorValue) {\r\n children = this.element.querySelectorAll(this.scopeSelectorValue);\r\n } else {\r\n children = this.element.children;\r\n }\r\n\r\n if (children.length === 0) {\r\n if (this.hasNotEmptyClass) {\r\n let classes = this.notEmptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.remove(klass));\r\n }\r\n if (this.hasEmptyClass) {\r\n let classes = this.emptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.add(klass));\r\n }\r\n this.element.dispatchEvent(\r\n new CustomEvent(\"dom:empty\", {\r\n bubbles: true,\r\n cancelable: true,\r\n }),\r\n );\r\n } else {\r\n if (this.hasNotEmptyClass) {\r\n let classes = this.notEmptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.add(klass));\r\n }\r\n if (this.hasEmptyClass) {\r\n let classes = this.emptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.remove(klass));\r\n }\r\n this.element.dispatchEvent(\r\n new CustomEvent(\"dom:not-empty\", {\r\n bubbles: true,\r\n cancelable: true,\r\n detail: {\r\n count: children.length,\r\n },\r\n }),\r\n );\r\n }\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class EnableInputsController extends BaseController {\r\n\r\n static targets = [\"enabler\", \"enable\"];\r\n\r\n static values = {\r\n clear: Boolean,\r\n };\r\n\r\n declare readonly hasEnablerTarget: boolean;\r\n declare readonly enablerTarget: HTMLInputElement;\r\n declare readonly enableTargets: Array;\r\n declare readonly clearValue: boolean;\r\n declare readonly hasClearValue: boolean;\r\n\r\n connect() {\r\n this.toggle();\r\n }\r\n\r\n toggle() {\r\n if (this.hasEnablerTarget && this.enablerTarget.checked) {\r\n this.enableInputs();\r\n } else {\r\n this.disableInputs();\r\n }\r\n }\r\n\r\n disableInputs() {\r\n let shouldClear = this.hasClearValue && this.clearValue;\r\n this.enableTargets.forEach((el, _) => {\r\n if (shouldClear) {\r\n el.value = \"\";\r\n }\r\n el.disabled = true;\r\n });\r\n }\r\n\r\n enableInputs() {\r\n this.enableTargets.forEach((el, _) => {\r\n el.disabled = false;\r\n });\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class FallbackImageController extends BaseController {\r\n\r\n static values = {placeholder: String};\r\n\r\n declare readonly placeholderValue: string;\r\n declare readonly hasPlaceholderValue: boolean;\r\n\r\n connect() {\r\n let element = this.element as HTMLImageElement;\r\n\r\n element.onerror = () => {\r\n if (this.hasPlaceholderValue) {\r\n element.src = this.placeholderValue;\r\n } else {\r\n element.style.display = \"none\";\r\n }\r\n };\r\n }\r\n\r\n}\r\n","import {useIntersection} from \"stimulus-use\";\nimport {IntersectionOptions} from \"stimulus-use/dist/use-intersection/use-intersection\";\nimport {AsyncBlockController} from \"./async_block_controller\";\n\nexport class LazyBlockController extends AsyncBlockController {\n\n declare observe: () => void;\n declare unobserve: () => void;\n declare options: IntersectionOptions;\n declare isVisible: boolean;\n declare disappear: () => void;\n\n connect() {\n let element = this.element;\n this.options = {element, threshold: 0.3};\n\n if (\"IntersectionObserver\" in window) {\n [this.observe, this.unobserve] = useIntersection(this, this.options);\n } else {\n // Client doesn't support intersection observer, fallback to pre-loading\n this.loadContent();\n }\n }\n\n appear(entry: IntersectionObserverEntry) {\n let element = this.element as HTMLImageElement;\n if (element.src !== \"\") {\n return;\n }\n if (entry.target === element && entry.isIntersecting) {\n this.loadContent();\n if (this.unobserve) {\n this.unobserve();\n }\n }\n }\n\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class LimitedSelectionCheckboxesController extends BaseController {\r\n\r\n static targets = [\"input\", \"error\"];\r\n static values = {max: Number, message: String};\r\n\r\n declare readonly hasErrorTarget: boolean;\r\n declare readonly errorTarget: HTMLElement;\r\n declare readonly inputTargets: HTMLInputElement[];\r\n declare readonly maxValue: number;\r\n declare readonly messageValue: string;\r\n\r\n maxSelections = 0;\r\n\r\n boundHandleInputs = this.handleInputs.bind(this);\r\n\r\n connect() {\r\n this.inputTargets.forEach((el) => el.addEventListener(\"change\", this.boundHandleInputs));\r\n }\r\n\r\n disconnect() {\r\n this.inputTargets.forEach((el) => el.removeEventListener(\"change\", this.boundHandleInputs));\r\n }\r\n\r\n handleInputs(event: Event) {\r\n let tickedInputs = this.inputTargets.reduce((previousValue, el) => el.checked ? previousValue + 1 : previousValue, 0);\r\n let target = event.target as HTMLInputElement;\r\n if (tickedInputs > this.maxSelections) {\r\n event.preventDefault();\r\n target.checked = false;\r\n target.dispatchEvent(new CustomEvent(\"change\", {bubbles: true, cancelable: true}));\r\n target.dispatchEvent(new CustomEvent(\"limited-selection:too-many\", {bubbles: true, cancelable: true, detail: {target}}));\r\n if (this.hasErrorTarget) {\r\n this.errorTarget.innerHTML = this.messageValue;\r\n }\r\n } else {\r\n target.dispatchEvent(new CustomEvent(\"limited-selection:selection\", {bubbles: true, cancelable: true, detail: {target}}));\r\n if (this.hasErrorTarget) {\r\n this.errorTarget.innerHTML = \"\";\r\n }\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class PasswordConfirmController extends BaseController {\r\n\r\n static targets = [\"password\"];\r\n static classes = [\"error\"];\r\n\r\n declare readonly passwordTargets: HTMLInputElement[];\r\n\r\n declare readonly errorClass: string;\r\n declare readonly hasErrorClass: boolean;\r\n\r\n private boundCheckPasswordsMatch = this.checkPasswordsMatch.bind(this);\r\n\r\n connect() {\r\n this.passwordTargets.forEach((el) => el.addEventListener(\"change\", this.boundCheckPasswordsMatch));\r\n }\r\n\r\n disconnect() {\r\n this.passwordTargets.forEach((el) => el.removeEventListener(\"change\", this.boundCheckPasswordsMatch));\r\n }\r\n\r\n private allPasswordsMatch() {\r\n let values = new Set(this.passwordTargets.map(el => el.value)); // Create a unique set of the password values\r\n return values.has(\"\") || values.size == 1; // If any of the passwords are still blank, or there is only one distinct password value (i.e. they all are the same)\r\n }\r\n\r\n private checkPasswordsMatch() {\r\n if (this.allPasswordsMatch()) {\r\n this.element.dispatchEvent(new CustomEvent(\"password-confirm:match\"));\r\n if (this.hasErrorClass) {\r\n this.passwordTargets.forEach(el => el.classList.remove(this.errorClass));\r\n }\r\n } else {\r\n this.element.dispatchEvent(new CustomEvent(\"password-confirm:no-match\"));\r\n if (this.hasErrorClass) {\r\n this.passwordTargets.forEach(el => el.classList.add(this.errorClass));\r\n }\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class PasswordPeekController extends BaseController {\r\n\r\n static targets = [\"password\"];\r\n\r\n declare readonly passwordTarget: HTMLInputElement;\r\n\r\n\r\n peak(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n this.passwordTarget.type = \"text\";\r\n }\r\n\r\n hide(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n this.passwordTarget.type = \"password\";\r\n }\r\n\r\n toggle(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n if (this.passwordTarget.type === \"password\") {\r\n this.peak();\r\n } else {\r\n this.hide();\r\n }\r\n }\r\n}\r\n","import {useDebounce, useWindowResize} from \"stimulus-use\";\nimport {WindowResizePayload} from \"stimulus-use/dist/use-window-resize/use-window-resize\";\nimport {BaseController} from \"./base_controller\";\n\ninterface ResponsiveIframeMessage {\n name: string,\n height: number,\n}\n\nexport class ResponsiveIframeWrapperController extends BaseController {\n\n boundMessageReceived = this.messageReceived.bind(this);\n\n connect() {\n window.addEventListener(\"message\", this.boundMessageReceived);\n }\n\n disconnect() {\n window.removeEventListener(\"message\", this.boundMessageReceived);\n }\n\n messageReceived(message: MessageEvent) {\n let data = message.data;\n if (data.hasOwnProperty(\"name\") && data.name === \"iframe-body\" && data.hasOwnProperty(\"height\")) {\n this.resize(data.height);\n }\n }\n\n resize(height: number) {\n (this.element as HTMLIFrameElement).style.height = `${height}px`;\n }\n\n}\n\nexport class ResponsiveIframeBodyController extends BaseController {\n\n static debounces = [\"postUpdate\"];\n\n declare observe: () => void;\n declare unobserve: () => void;\n\n connect() {\n // If this Window is inside a frame\n if (window.self !== window.top) {\n useWindowResize(this);\n useDebounce(this, {});\n this.postUpdate();\n } else {\n // Not an iframe\n }\n }\n\n windowResize(payload: WindowResizePayload) {\n this.postUpdate();\n };\n\n postUpdate() {\n let payload: ResponsiveIframeMessage = {name: \"iframe-body\", height: this.getHeight()};\n window.parent.postMessage(\n payload,\n \"*\",\n );\n }\n\n getHeight(): number {\n const body = document.body;\n const html = document.documentElement;\n\n // Get the largest height out of body and html's various height measurements\n return Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);\n }\n\n}\n","const smoothSupported = \"scrollBehavior\" in document.documentElement.style;\r\nlet smoothPolyfilled: boolean;\r\n\r\nexport async function scrollToElement(element: Element, {behavior = \"smooth\", block = \"start\", inline = \"nearest\"}: ScrollIntoViewOptions = {}) {\r\n if (behavior == \"smooth\" && !smoothSupported) {\r\n await polyfillSmooth();\r\n }\r\n element.scrollIntoView({behavior, block, inline});\r\n}\r\n\r\nasync function polyfillSmooth() {\r\n const {polyfill} = await import(/* webpackChunkName: \"smoothscroll-polyfill\" */ \"smoothscroll-polyfill\");\r\n if (smoothPolyfilled) {\r\n return;\r\n }\r\n smoothPolyfilled = true;\r\n polyfill();\r\n}\r\n\r\nexport function getScrollParent(node: HTMLElement | null): HTMLElement | null {\r\n if (!node) {\r\n return null;\r\n }\r\n const overflowY = getComputedStyle(node).overflowY;\r\n const isScrollable = overflowY !== \"visible\" && overflowY !== \"hidden\";\r\n\r\n if (isScrollable && node.scrollHeight >= node.clientHeight) {\r\n return node;\r\n }\r\n\r\n return getScrollParent(node.parentElement) || document.body;\r\n}\r\n","import camelCase from \"lodash.camelcase\";\r\nimport {BaseController} from \"../base_controller\";\r\n\r\nexport class EphemeralController extends BaseController {\r\n\r\n cleanupSelf() {\r\n this.cleanup(this.element as HTMLElement);\r\n }\r\n\r\n cleanup(element: HTMLElement) {\r\n element.dataset.controller = element.dataset.controller?.replaceAll(new RegExp(`(\\s|^)${this.identifier}(\\s|$)`, \"g\"), \"\") || \"\";\r\n if (element.dataset.controller == \"\") {\r\n // If there are no controllers left, remove the attribute\r\n delete element.dataset.controller;\r\n }\r\n\r\n let substringIdentifierValueRegex = new RegExp(`(\\s|^)${this.identifier}\\\\..+?(\\s|$)`, \"g\");\r\n element.dataset.target = element.dataset.target?.replaceAll(substringIdentifierValueRegex, \"\") || \"\";\r\n delete element.dataset[camelCase(`${this.identifier}-target`)];\r\n if (element.dataset.target == \"\") {\r\n // If there are no targets left, remove the attribute\r\n delete element.dataset.target;\r\n }\r\n\r\n element.dataset.action = element.dataset.target?.replaceAll(substringIdentifierValueRegex, \"\") || \"\";\r\n delete element.dataset[camelCase(`${this.identifier}-action`)];\r\n if (element.dataset.action == \"\") {\r\n // If there are no actions left, remove the attribute\r\n delete element.dataset.action;\r\n }\r\n\r\n // @ts-ignore\r\n let values = this.constructor.values;\r\n if (values) {\r\n Object.keys(values).forEach(val => delete element.dataset[camelCase(`${this.identifier}-${val}-value`)]);\r\n }\r\n\r\n // @ts-ignore\r\n let classes = this.constructor.classes;\r\n if (classes) {\r\n Object.keys(classes).forEach(val => delete element.dataset[camelCase(`${this.identifier}-${val}-class`)]);\r\n }\r\n }\r\n\r\n}\r\n","import {EphemeralController} from \"./utilities/ephemeral_controller\";\r\nimport {scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollIntoFocusController extends EphemeralController {\r\n\r\n static values = {\r\n behavior: String,\r\n block: String,\r\n inline: String,\r\n };\r\n\r\n declare behaviorValue: ScrollBehavior;\r\n declare hasBehaviorValue: boolean;\r\n declare blockValue: ScrollLogicalPosition;\r\n declare hasBlockValue: boolean;\r\n declare inlineValue: ScrollLogicalPosition;\r\n declare hasInlineValue: boolean;\r\n\r\n connect() {\r\n requestAnimationFrame(() => {\r\n // Attempt smooth scrolling, with polyfill\r\n scrollToElement(\r\n this.element,\r\n {\r\n behavior: this.hasBehaviorValue ? this.behaviorValue : \"smooth\",\r\n block: this.hasBlockValue ? this.blockValue : \"center\",\r\n inline: this.hasInlineValue ? this.inlineValue : \"center\",\r\n },\r\n ).catch(() => this.element.scrollIntoView()); // Fallback to snap-scrolling\r\n this.cleanupSelf();\r\n });\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\nimport {getScrollParent, scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollToBottomController extends BaseController {\r\n\r\n static values = {\r\n mode: String,\r\n };\r\n\r\n declare modeValue: \"nearest\" | \"document\";\r\n declare hasModeValue: boolean;\r\n\r\n\r\n scroll(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n let mode = this.hasModeValue ? this.modeValue : \"document\";\r\n let target: null | HTMLElement;\r\n if (mode == \"document\") {\r\n target = document.body;\r\n } else {\r\n target = getScrollParent(this.element as HTMLElement);\r\n }\r\n if (target == null) {\r\n return;\r\n }\r\n scrollToElement(target!, {behavior: \"smooth\", block: \"end\"}).catch(() => target!.scrollIntoView(false));\r\n }\r\n\r\n}\r\n\r\n","import {BaseController} from \"./base_controller\";\r\nimport {scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollToController extends BaseController {\r\n\r\n static values = {\r\n selector: String,\r\n behavior: String,\r\n block: String,\r\n inline: String,\r\n };\r\n\r\n declare selectorValue: string;\r\n declare behaviorValue: ScrollBehavior;\r\n declare hasBehaviorValue: boolean;\r\n declare blockValue: ScrollLogicalPosition;\r\n declare hasBlockValue: boolean;\r\n declare inlineValue: ScrollLogicalPosition;\r\n declare hasInlineValue: boolean;\r\n\r\n\r\n scroll() {\r\n let target = document.querySelector(this.selectorValue);\r\n if (!target) {\r\n console.warn(`Could not find target for '${this.selectorValue}'`);\r\n return;\r\n }\r\n\r\n scrollToElement(\r\n target!,\r\n {\r\n behavior: this.hasBehaviorValue ? this.behaviorValue : \"smooth\",\r\n block: this.hasBlockValue ? this.blockValue : \"center\",\r\n inline: this.hasInlineValue ? this.inlineValue : \"center\",\r\n },\r\n ).catch(() => target!.scrollIntoView()); // Fallback to snap-scrolling\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\nimport {getScrollParent, scrollToElement} from \"./utilities/scroll\";\n\nexport class ScrollToTopController extends BaseController {\n\n static values = {\n mode: String,\n };\n\n declare modeValue: \"nearest\" | \"document\";\n declare hasModeValue: boolean;\n\n\n scroll(event?: Event) {\n if (event) {\n event.preventDefault();\n }\n let mode = this.hasModeValue ? this.modeValue : \"document\";\n let target: null | HTMLElement;\n if (mode == \"document\") {\n target = document.body;\n } else {\n target = getScrollParent(this.element as HTMLElement);\n }\n if (target == null) {\n return;\n }\n scrollToElement(target!, {behavior: \"smooth\", block: \"start\"}).catch(() => target!.scrollIntoView(false));\n }\n\n}\n\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class SelfDestructController extends BaseController {\r\n\r\n static values = {seconds: Number};\r\n\r\n declare readonly secondsValue: number;\r\n timeout: null | ReturnType = null;\r\n\r\n connect() {\r\n requestAnimationFrame(() => {\r\n // Only start countdown on first paint\r\n this.timeout = setTimeout(() => this.element.remove(), this.secondsValue * 1000);\r\n });\r\n }\r\n\r\n disconnect() {\r\n if (this.timeout) {\r\n clearTimeout(this.timeout);\r\n }\r\n }\r\n\r\n}\r\n","import {EphemeralController} from \"./utilities/ephemeral_controller\";\r\n\r\nexport class TeleportController extends EphemeralController {\r\n\r\n static values = {target: String, insert: String, immediate: Boolean};\r\n\r\n declare readonly immediateValue: boolean;\r\n declare readonly hasImmediateValue: boolean;\r\n declare readonly targetValue: string;\r\n declare readonly hasInsertValue: boolean;\r\n declare readonly insertValue: InsertPosition | \"replaceOuter\" | \"replaceInner\" | \"prepend\" | \"append\";\r\n\r\n connect() {\r\n if (!this.hasInsertValue) {\r\n throw new Error(\"`insert` value was not specified\");\r\n }\r\n\r\n requestAnimationFrame(() => {\r\n if (this.hasImmediateValue && this.immediateValue) {\r\n this.execute();\r\n }\r\n });\r\n }\r\n\r\n execute(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n let destination = document.querySelector(this.targetValue);\r\n\r\n if (destination == null) {\r\n this.element.dispatchEvent(new CustomEvent(\"teleport:error\", {bubbles: true, cancelable: true}));\r\n return;\r\n }\r\n\r\n let copy = this.element.cloneNode(true) as HTMLElement;\r\n this.cleanup(copy);\r\n\r\n switch (this.insertValue) {\r\n case \"beforebegin\":\r\n case \"beforeend\":\r\n case \"afterend\":\r\n case \"afterbegin\":\r\n destination.insertAdjacentHTML(this.insertValue, copy.outerHTML);\r\n break;\r\n case \"replaceOuter\":\r\n destination.outerHTML = copy.outerHTML;\r\n break;\r\n case \"replaceInner\":\r\n destination.innerHTML = copy.outerHTML;\r\n break;\r\n case \"prepend\":\r\n destination.insertAdjacentHTML(\"afterbegin\", copy.outerHTML);\r\n break;\r\n case \"append\":\r\n destination.insertAdjacentHTML(\"beforeend\", copy.outerHTML);\r\n break;\r\n default:\r\n throw new Error(\"`insert` value was not specified\");\r\n\r\n }\r\n this.element.remove();\r\n }\r\n\r\n}\r\n","import {useClickOutside, useHover} from \"stimulus-use\";\nimport {BaseController} from \"./base_controller\";\n\nexport type ToggleClassMode = \"on\" | \"off\" | \"toggle\"\n\nexport class ToggleClassController extends BaseController {\n\n static targets = [\"toggle\"];\n static values = {\n class: String,\n mouseEnter: String,\n mouseLeave: String,\n clickAway: Boolean,\n initial: String,\n };\n\n declare readonly toggleTargets: HTMLElement[];\n\n declare readonly classValue: string;\n declare readonly hasClassValue: boolean;\n\n declare readonly mouseEnterValue: ToggleClassMode;\n declare readonly hasMouseEnterValue: boolean;\n\n declare readonly mouseLeaveValue: ToggleClassMode;\n declare readonly hasMouseLeaveValue: boolean;\n\n declare readonly clickAwayValue: boolean;\n declare readonly hasClickAwayValue: boolean;\n\n declare readonly initialValue: \"on\" | \"off\";\n declare readonly hasInitialValue: boolean;\n\n connect() {\n if (!this.hasClassValue) {\n throw new Error(\"data-toggle-class-class-value must not be empty\");\n }\n\n if (this.hasMouseEnterValue || this.hasMouseLeaveValue) {\n useHover(this);\n }\n\n if (this.hasClickAwayValue && this.clickAwayValue) {\n useClickOutside(this);\n }\n\n requestAnimationFrame(() => {\n if (this.hasInitialValue) {\n if (this.initialValue === \"on\") {\n this.toggleTargets.forEach((target) => this.elementOn(target));\n } else {\n this.toggleTargets.forEach((target) => this.elementOff(target));\n }\n }\n });\n }\n\n clickOutside() {\n this.toggleTargets.forEach((target) => {\n if (this.elementWasToggled(target)) {\n this.elementToggleStatus(target);\n this.elementToggle(target);\n }\n });\n }\n\n mouseEnter() {\n if (this.hasMouseEnterValue) {\n switch (this.mouseEnterValue) {\n case \"on\":\n this.on();\n break;\n case \"off\":\n this.off();\n break;\n case \"toggle\":\n this.toggle();\n break;\n }\n }\n return {};\n }\n\n mouseLeave() {\n if (this.hasMouseLeaveValue) {\n switch (this.mouseLeaveValue) {\n case \"on\":\n this.on();\n break;\n case \"off\":\n this.off();\n break;\n case \"toggle\":\n this.toggle();\n break;\n }\n }\n return {};\n }\n\n on(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementOn(target);\n });\n }\n\n off(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementOff(target);\n });\n }\n\n toggle(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementToggle(target);\n });\n }\n\n private elementWasToggled(el: HTMLElement): boolean {\n return el.dataset.toggled == \"true\";\n }\n\n private elementToggleStatus(el: HTMLElement) {\n if (this.elementWasToggled(el)) {\n delete el.dataset.toggled;\n } else {\n el.dataset.toggled = \"true\";\n }\n }\n\n private elementToggle(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass));\n }\n\n private elementOn(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass, true));\n }\n\n private elementOff(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass, false));\n }\n\n}\n","import {BaseController} from \"./base_controller\";\nimport {isHTMLLinkElement} from \"./utilities/elements\";\nimport {isTurboFrame} from \"./utilities/turbo\";\n\nexport class TurboFrameRCController extends BaseController {\n\n static values = {\n frameId: String,\n src: String,\n loadingMessage: String,\n };\n\n declare readonly frameIdValue: string;\n declare readonly srcValue: string;\n declare readonly hasSrcValue: boolean;\n declare readonly loadingMessageValue: string;\n declare readonly hasLoadingMessageValue: boolean;\n\n toggle(event?: Event | null) {\n if (event) {\n event.preventDefault();\n }\n let frame = this.getFrame();\n let frameSrc = frame.src;\n if (frameSrc == null || frameSrc !== this.getSrc()) {\n this.setSrc();\n } else {\n this.clear();\n }\n }\n\n setSrc(event?: Event | null) {\n if (event) {\n event.preventDefault();\n }\n let frame = this.getFrame();\n if (this.hasLoadingMessageValue) {\n frame.innerHTML = this.loadingMessageValue;\n }\n\n frame.src = this.getSrc();\n }\n\n clear(event?: Event | null) {\n if (event) {\n event.preventDefault();\n }\n let frame = this.getFrame();\n frame.src = \"\";\n frame.innerHTML = \"\";\n }\n\n private getFrame(): TurboFrame {\n let frame = document.getElementById(`${this.frameIdValue}`);\n if (frame == null) {\n throw new Error(`Could not find frame with ID '${this.frameIdValue}'`);\n }\n if (!isTurboFrame(frame)) {\n throw new Error(`Element targeted by ID '${this.frameIdValue}'`);\n } else {\n return frame;\n }\n }\n\n private getSrc(): string {\n let element = this.element as HTMLElement;\n if (this.hasSrcValue) {\n return this.srcValue;\n } else if (isHTMLLinkElement(element)) {\n return element.href;\n } else {\n throw new Error(\"No link given to drive frame to\");\n }\n }\n\n}\n","export function isTurboFrame(element: HTMLElement): element is TurboFrame {\r\n return element.nodeName == \"TURBO-FRAME\";\r\n}\r\n","export function isHTMLLinkElement(element: Element): element is HTMLLinkElement {\n return element.nodeName == \"A\";\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class WordCountController extends BaseController {\r\n\r\n static targets = [\"input\", \"output\"];\r\n static values = {min: Number, max: Number};\r\n static classes = [\"error\"];\r\n\r\n declare readonly inputTarget: HTMLInputElement | HTMLTextAreaElement;\r\n declare readonly outputTarget: HTMLElement;\r\n declare minValue: number;\r\n declare hasMinValue: boolean;\r\n declare maxValue: number;\r\n declare hasMaxValue: boolean;\r\n declare errorClass: string;\r\n declare hasErrorClass: boolean;\r\n\r\n boundHandler = this.updateWordCount.bind(this);\r\n\r\n connect() {\r\n this.updateWordCount();\r\n this.inputTarget.addEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n this.inputTarget.removeEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n updateWordCount() {\r\n let wordCount = 0;\r\n let textAreaValue = this.inputTarget.value;\r\n let matches = textAreaValue.match(/\\S+/g);\r\n wordCount = (matches && matches.length) || 0;\r\n this.outputTarget.innerText = wordCount.toString();\r\n if (this.hasErrorClass) {\r\n if (this.isValidCount(wordCount)) {\r\n this.outputTarget.classList.remove(this.errorClass);\r\n } else {\r\n this.outputTarget.classList.add(this.errorClass);\r\n }\r\n }\r\n }\r\n\r\n isValidCount(count: number) {\r\n let min = 0;\r\n let max = 99999;\r\n\r\n if (this.hasMinValue) {\r\n min = this.minValue;\r\n }\r\n\r\n if (this.hasMaxValue) {\r\n max = this.maxValue;\r\n }\r\n\r\n return count >= min && count <= max;\r\n }\r\n\r\n}\r\n"],"names":["BaseController","context","_this","Proxy","get","obj","prop","returnVal","Reflect","self","test","logProperty","toString","apply","target","thisArg","argArray","log","args","functionName","this","application","debug","logger","console","groupCollapsed","identifier","element","groupEnd","Controller","AsyncBlockController","connect","loadContent","el","hasReplaceTarget","replaceTarget","fetch","endpointValue","then","response","text","html","newEl","document","createElement","innerHTML","replaceWith","event","CustomEvent","detail","dispatchEvent","err","endpoint","String","AutoSubmitFormController","handler","bind","querySelectorAll","forEach","addEventListener","_this2","boundHandler","disconnect","removeEventListener","_this3","e","bubbles","cancelable","method","controller","methodName","composeEventName","name","eventPrefix","composedName","extendedEvent","type","composed","Object","assign","originalEvent","defaultOptions","events","onlyVisible","StimulusUse","[object Object]","options","_a","_b","_c","controllerId","stimulusUseDebug","id","dataset","controllerInitialize","initialize","controllerConnect","controllerDisconnect","UseHover","super","observe","targetElement","onEnter","onLeave","unobserve","call","hover","enhanceController","UseMutation","observer","error","handleError","mutation","entries","MutationObserver","useWindowResize","callback","innerWidth","innerHeight","window","payload","height","Infinity","width","debounce","fn","wait","timeoutId","arguments","clearTimeout","setTimeout","AutosizeController","style","resize","boxSizing","requestAnimationFrame","windowResize","autosize","offset","offsetHeight","clientHeight","scrollHeight","CharCountController","updateCharCount","inputTarget","charCount","value","length","outputTarget","innerText","hasErrorClass","isValidCount","classList","remove","errorClass","add","count","min","max","hasMinValue","minValue","hasMaxValue","maxValue","Number","ClipboardController","supported","queryCommandSupported","hasRemoveUnusedValue","removeUnusedValue","hasFallbackTarget","fallbackTarget","hasCopyTarget","copyTarget","select","preventDefault","sourceTarget","copy","execCommand","removeUnused","Boolean","ConfirmNavigationController","confirmMessage","messageValue","onbeforeunload","handlePopstate","message","DebugController","testTargets","DetectDirtyController","initialValue","isInputElement","isCheckable","checked","restore","setAttribute","removeAttribute","tagName","DisableInputsController","toggle","hasDisablerTarget","disablerTarget","disableInputs","enableInputs","shouldClear","hasClearValue","clearValue","disableTargets","_","disabled","clear","DismissableController","dismiss","EmptyDomController","useMutation","childList","checkEmpty","mutate","children","hasScopeSelectorValue","scopeSelectorValue","hasNotEmptyClass","notEmptyClass","split","klass","hasEmptyClass","emptyClass","scopeSelector","EnableInputsController","hasEnablerTarget","enablerTarget","enableTargets","FallbackImageController","onerror","hasPlaceholderValue","src","placeholderValue","display","placeholder","LazyBlockController","threshold","IntersectionObserver","entry","isIntersecting","isVisible","eventName","appearEvent","dispatchAppear","disappearEvent","dispatchDisappear","useIntersection","appear","LimitedSelectionCheckboxesController","handleInputs","inputTargets","boundHandleInputs","tickedInputs","reduce","previousValue","maxSelections","hasErrorTarget","errorTarget","PasswordConfirmController","checkPasswordsMatch","passwordTargets","boundCheckPasswordsMatch","allPasswordsMatch","values","Set","map","has","size","_this4","PasswordPeekController","peak","passwordTarget","hide","ResponsiveIframeWrapperController","messageReceived","boundMessageReceived","data","hasOwnProperty","ResponsiveIframeBodyController","top","constructor","debounces","func","postUpdate","getHeight","parent","postMessage","body","documentElement","Math","smoothPolyfilled","EphemeralController","cleanupSelf","cleanup","replaceAll","RegExp","substringIdentifierValueRegex","camelCase","action","keys","val","classes","scrollToElement","behavior","block","inline","scrollIntoView","smoothSupported","Promise","polyfill","polyfillSmooth","getScrollParent","node","overflowY","getComputedStyle","parentElement","ScrollIntoFocusController","hasBehaviorValue","behaviorValue","hasBlockValue","blockValue","hasInlineValue","inlineValue","ScrollToBottomController","scroll","hasModeValue","modeValue","mode","ScrollToController","querySelector","selectorValue","warn","selector","ScrollToTopController","SelfDestructController","timeout","secondsValue","seconds","TeleportController","hasInsertValue","Error","hasImmediateValue","immediateValue","execute","destination","targetValue","cloneNode","insertValue","insertAdjacentHTML","outerHTML","insert","immediate","ToggleClassController","hasClassValue","hasMouseEnterValue","hasMouseLeaveValue","useHover","hasClickAwayValue","clickAwayValue","onEvent","contains","rect","getBoundingClientRect","windowHeight","windowWidth","clientWidth","left","isElementInViewport","clickOutside","clickOutsideEvent","useClickOutside","hasInitialValue","toggleTargets","elementOn","elementOff","elementWasToggled","elementToggleStatus","elementToggle","mouseEnter","mouseEnterValue","on","off","mouseLeave","mouseLeaveValue","_this5","toggled","classValue","class","clickAway","initial","TurboFrameRCController","frameSrc","getFrame","getSrc","setSrc","frame","hasLoadingMessageValue","loadingMessageValue","getElementById","frameIdValue","nodeName","hasSrcValue","srcValue","isHTMLLinkElement","href","frameId","loadingMessage","WordCountController","updateWordCount","wordCount","matches","match"],"mappings":"k0BAEaA,cAEX,WAAYC,SAEV,OADAC,cAAMD,aACKE,WAAY,CACrBC,IAAK,SAACC,EAAKC,GACT,IAAIC,EAAYC,QAAQJ,IAAIC,EAAKC,GAC7BG,OACJ,GAmCR,SAAqBH,GACnB,OAAQA,GACN,IAAK,cACL,IAAK,UACL,IAAK,cACL,IAAK,aACL,IAAK,MACL,IAAK,OACL,IAAK,qBACL,IAAK,aACH,SAGJ,QAAI,kBAAkBI,KAAKJ,IAGvB,aAAaI,KAAKJ,IAGlB,oBAAoBI,KAAKJ,IAGzB,aAAaI,KAAKJ,IAzDZK,CAAYL,EAAKM,YAAa,CAChC,GAAwB,mBAAbL,EACT,WAAWJ,MAAMI,EAAW,CAC1BM,eAAMC,EAAaC,EAAcC,GAI/B,OAHAP,EAAKQ,IAAIX,EAAKM,WAAY,CACxBM,KAAMF,IAEDR,QAAQK,MAAMC,EAAQC,EAASC,MAI1Cd,EAAKe,IAAIX,EAAKM,YAGlB,OAAOL,qCAKbU,IAAA,SAAIE,EAAsBD,GAExB,YAFwBA,IAAAA,EAAW,IAE9BE,KAAKC,YAAYC,MAAtB,CAGA,IAAIC,EAASC,QACbD,EAAOE,oBAAoBL,KAAKM,kBAAiBP,EAAgB,iBAAkB,gBACnFI,EAAON,OACLU,QAASP,KAAKO,SACXT,IAELK,EAAOK,gBAtCyBC,cCAvBC,kGAYXC,QAAA,WACEX,KAAKY,iBAGPA,YAAA,WACE,IAAIC,EAAMb,KAAKc,iBAAmBd,KAAKe,cAAgBf,KAAKO,QAC5DS,MAAMhB,KAAKiB,eACVC,KAAK,SAACC,UAAaA,EAASC,SAC5BF,KAAK,SAACG,GACL,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,QGPPqW,IAAAA,cAAb,wEAeiBxZ,EAAKyZ,gBAAgBnW,oBAftC,2BAiBEzB,QAAA,WACEX,KAAKuY,kBACLvY,KAAK4H,YAAYrF,iBAAiB,QAASvC,KAAKyC,iBAGlDC,WAAA,WACE1C,KAAK4H,YAAYjF,oBAAoB,QAAS3C,KAAKyC,iBAGrD8V,gBAAA,WACE,IAAIC,EAAY,EAEZC,EADgBzY,KAAK4H,YAAYE,MACT4Q,MAAM,QAElC1Y,KAAKgI,aAAaC,WADlBuQ,EAAaC,GAAWA,EAAQ1Q,QAAW,GACHvI,WACpCQ,KAAKkI,gBACHlI,KAAKmI,aAAaqQ,GACpBxY,KAAKgI,aAAaI,UAAUC,OAAOrI,KAAKsI,YAExCtI,KAAKgI,aAAaI,UAAUG,IAAIvI,KAAKsI,gBAK3CH,aAAA,SAAaK,GACX,IAAIC,EAAM,EACNC,EAAM,MAUV,OARI1I,KAAK2I,cACPF,EAAMzI,KAAK4I,UAGT5I,KAAK6I,cACPH,EAAM1I,KAAK8I,UAGNN,GAASC,GAAOD,GAASE,MArDK9J,GAEhC0Z,UAAU,CAAC,QAAS,UACpBA,SAAS,CAAC7P,IAAKM,OAAQL,IAAKK,QAC5BuP,UAAU,CAAC"} \ No newline at end of file +{"version":3,"file":"stimulus-library.js","sources":["../src/base_controller.ts","../src/async_block_controller.ts","../src/auto_submit_form_controller.ts","../node_modules/stimulus-use/dist/support/index.js","../node_modules/stimulus-use/dist/use-intersection/use-intersection.js","../node_modules/stimulus-use/dist/use-click-outside/use-click-outside.js","../node_modules/stimulus-use/dist/stimulus_use.js","../node_modules/stimulus-use/dist/use-hover/use-hover.js","../node_modules/stimulus-use/dist/use-mutation/use-mutation.js","../node_modules/stimulus-use/dist/use-window-resize/use-window-resize.js","../node_modules/stimulus-use/dist/use-debounce/use-debounce.js","../src/autosize_controller.ts","../src/char_count_controller.ts","../src/clipboard_controller.ts","../src/confirm_navigation_controller.ts","../src/debug_controller.ts","../src/detect_dirty_controller.ts","../src/disable_inputs_controller.ts","../src/dismissable_controller.ts","../src/empty_dom_controller.ts","../src/enable_inputs_controller.ts","../src/fallback_image_controller.ts","../src/lazy_block_controller.ts","../src/limited_selection_checkboxes_controller.ts","../src/nested_form_controller.ts","../src/password_confirm_controller.ts","../src/password_peek_controller.ts","../src/responsive_iframe_controller.ts","../src/utilities/scroll.ts","../src/utilities/ephemeral_controller.ts","../src/scroll_into_focus_controller.ts","../src/scroll_to_bottom_controller.ts","../src/scroll_to_controller.ts","../src/scroll_to_top_controller.ts","../src/self_destruct_controller.ts","../src/teleport_controller.ts","../src/toggle_class_controller.ts","../src/turbo_frame_rc_controller.ts","../src/utilities/turbo.ts","../src/utilities/elements.ts","../src/word_count_controller.ts"],"sourcesContent":["import {Context, Controller} from \"stimulus\";\r\n\r\nexport class BaseController extends Controller {\r\n\r\n constructor(context: Context) {\r\n super(context);\r\n return new Proxy(this, {\r\n get: (obj, prop) => {\r\n let returnVal = Reflect.get(obj, prop);\r\n let self = this;\r\n if (logProperty(prop.toString())) {\r\n if (typeof returnVal == \"function\") {\r\n return new Proxy(returnVal, {\r\n apply(target: any, thisArg: any, argArray?: any): any {\r\n self.log(prop.toString(), {\r\n args: argArray,\r\n });\r\n return Reflect.apply(target, thisArg, argArray);\r\n },\r\n });\r\n } else {\r\n this.log(prop.toString());\r\n }\r\n }\r\n return returnVal;\r\n },\r\n });\r\n }\r\n\r\n log(functionName: string, args: {} = {}): void {\r\n // @ts-ignore\r\n if (!this.application.debug) {\r\n return;\r\n }\r\n let logger = console;\r\n logger.groupCollapsed(`%c${this.identifier} %c#${functionName}`, \"color: #3B82F6\", \"color: unset\");\r\n logger.log({\r\n element: this.element,\r\n ...args,\r\n });\r\n logger.groupEnd();\r\n }\r\n\r\n}\r\n\r\nfunction logProperty(prop: string): boolean {\r\n switch (prop) {\r\n case \"application\":\r\n case \"element\":\r\n case \"constructor\":\r\n case \"initialize\":\r\n case \"log\":\r\n case \"data\":\r\n case \"valueDescriptorMap\":\r\n case \"identifier\":\r\n return false;\r\n }\r\n\r\n if (/^.*?Target(s)?$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?Value$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?ValueChanged$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?Class$/.test(prop)) {\r\n return false;\r\n }\r\n\r\n return true;\r\n}\r\n","import {BaseController} from \"./base_controller\";\n\nexport class AsyncBlockController extends BaseController {\n static targets = [\"replace\"];\n static values = {endpoint: String};\n\n declare readonly replaceTarget: HTMLElement;\n declare readonly hasReplaceTarget: boolean;\n declare readonly endpointValue: string;\n\n\n // This is a simple controller to load a block of content when the page loads.\n // It should be used to give a quick initial response before calling out to an\n // an AJAX endpoint to do some expensive work.\n connect() {\n this.loadContent();\n }\n\n loadContent() {\n let el = (this.hasReplaceTarget ? this.replaceTarget : this.element) as HTMLElement;\n fetch(this.endpointValue)\n .then((response) => response.text())\n .then((html) => {\n let newEl = document.createElement(\"div\");\n newEl.innerHTML = html;\n el.replaceWith(newEl);\n\n // Trigger event to show block has loaded\n let event = new CustomEvent(\"ajax:success\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n })\n .catch(err => {\n el.replaceWith(\"Sorry, this content failed to load\");\n\n let event = new CustomEvent(\"ajax:error\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n })\n .finally(() => {\n let event = new CustomEvent(\"ajax:complete\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n });\n }\n}\n","import {BaseController} from \"./base_controller\";\n\nexport class AutoSubmitFormController extends BaseController {\n\n private boundHandler = this.handler.bind(this);\n\n connect() {\n (this.element as HTMLElement).querySelectorAll(\"input, select, textarea\").forEach(el => el.addEventListener(\"change\", this.boundHandler));\n }\n\n disconnect() {\n (this.element as HTMLElement).querySelectorAll(\"input, select, textarea\").forEach(el => el.removeEventListener(\"change\", this.boundHandler));\n }\n\n private handler(e: Event) {\n // this.element.submit()\n // Moved to this to support remote forms and CSRF properly\n this.element.dispatchEvent(\n new CustomEvent(\"submit\", {\n bubbles: true,\n cancelable: true,\n }),\n );\n }\n}\n","export const method = (controller, methodName) => {\n const method = controller[methodName];\n if (typeof method == 'function') {\n return method;\n }\n else {\n return (...args) => { };\n }\n};\nexport const composeEventName = (name, controller, eventPrefix) => {\n let composedName = name;\n if (eventPrefix === true) {\n composedName = `${controller.identifier}:${name}`;\n }\n else if (typeof eventPrefix === 'string') {\n composedName = `${eventPrefix}:${name}`;\n }\n return composedName;\n};\nexport const extendedEvent = (type, event, detail) => {\n const { bubbles, cancelable, composed } = event || { bubbles: true, cancelable: true, composed: true };\n if (event) {\n Object.assign(detail, { originalEvent: event });\n }\n const customEvent = new CustomEvent(type, {\n bubbles,\n cancelable,\n composed,\n detail,\n });\n return customEvent;\n};\nexport function isElementInViewport(el) {\n const rect = el.getBoundingClientRect();\n const windowHeight = (window.innerHeight || document.documentElement.clientHeight);\n const windowWidth = (window.innerWidth || document.documentElement.clientWidth);\n const vertInView = (rect.top <= windowHeight) && ((rect.top + rect.height) >= 0);\n const horInView = (rect.left <= windowWidth) && ((rect.left + rect.width) >= 0);\n return (vertInView && horInView);\n}\n//# sourceMappingURL=index.js.map","import { method, extendedEvent, composeEventName } from '../support/index';\nconst defaultOptions = {\n dispatchEvent: true,\n eventPrefix: true,\n};\nexport const useIntersection = (controller, options = {}) => {\n const { dispatchEvent, eventPrefix } = Object.assign({}, defaultOptions, options);\n const targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n const callback = (entries) => {\n const [entry] = entries;\n if (entry.isIntersecting) {\n dispatchAppear(entry);\n }\n else if (controller.isVisible) {\n dispatchDisappear(entry);\n }\n };\n const dispatchAppear = (entry) => {\n controller.isVisible = true;\n method(controller, 'appear').call(controller, entry);\n // emit a custom \"appear\" event\n if (dispatchEvent) {\n const eventName = composeEventName('appear', controller, eventPrefix);\n const appearEvent = extendedEvent(eventName, null, { controller, entry });\n targetElement.dispatchEvent(appearEvent);\n }\n };\n const dispatchDisappear = (entry) => {\n controller.isVisible = false;\n method(controller, 'disappear').call(controller, entry);\n // emit a custom \"disappear\" event\n if (dispatchEvent) {\n const eventName = composeEventName('disappear', controller, eventPrefix);\n const disappearEvent = extendedEvent(eventName, null, { controller, entry });\n targetElement.dispatchEvent(disappearEvent);\n }\n };\n // keep a copy of the current disconnect() function of the controller\n // to support composing several behaviors\n const controllerDisconnect = controller.disconnect.bind(controller);\n const observer = new IntersectionObserver(callback, options);\n const observe = () => {\n observer.observe(targetElement);\n };\n const unobserve = () => {\n observer.unobserve(targetElement);\n };\n Object.assign(controller, {\n isVisible: false,\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-intersection.js.map","import { composeEventName, extendedEvent, isElementInViewport } from '../support/index';\nconst defaultOptions = {\n events: ['click', 'touchend'],\n onlyVisible: true,\n dispatchEvent: true,\n eventPrefix: true,\n};\nexport const useClickOutside = (controller, options = {}) => {\n const { onlyVisible, dispatchEvent, events, eventPrefix } = Object.assign({}, defaultOptions, options);\n const onEvent = (event) => {\n const targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n if (targetElement.contains(event.target) || (!isElementInViewport(targetElement) && onlyVisible)) {\n return;\n }\n // call the clickOutside method of the Stimulus controller\n if (controller.clickOutside) {\n controller.clickOutside(event);\n }\n // emit a custom event\n if (dispatchEvent) {\n const eventName = composeEventName('click:outside', controller, eventPrefix);\n const clickOutsideEvent = extendedEvent(eventName, event, { controller });\n targetElement.dispatchEvent(clickOutsideEvent);\n }\n };\n const observe = () => {\n events === null || events === void 0 ? void 0 : events.forEach(event => {\n window.addEventListener(event, onEvent, false);\n });\n };\n const unobserve = () => {\n events === null || events === void 0 ? void 0 : events.forEach(event => {\n window.removeEventListener(event, onEvent, false);\n });\n };\n // keep a copy of the current disconnect() function of the controller\n // to support composing several behaviors\n const controllerDisconnect = controller.disconnect.bind(controller);\n Object.assign(controller, {\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-click-outside.js.map","const defaultOptions = {\n debug: false,\n logger: console\n};\nexport class StimulusUse {\n constructor(controller, options = {}) {\n var _a, _b, _c;\n this.log = (functionName, args) => {\n if (!this.debug)\n return;\n this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${functionName}`, 'color: #3B82F6', 'color: unset');\n this.logger.log(Object.assign({ controllerId: this.controllerId }, args));\n this.logger.groupEnd();\n };\n this.debug = (_b = (_a = options === null || options === void 0 ? void 0 : options.debug) !== null && _a !== void 0 ? _a : controller.application.stimulusUseDebug) !== null && _b !== void 0 ? _b : defaultOptions.debug;\n this.logger = (_c = options === null || options === void 0 ? void 0 : options.logger) !== null && _c !== void 0 ? _c : defaultOptions.logger;\n this.controller = controller;\n this.controllerId = controller.element.id || controller.element.dataset.id;\n // make copies of lifecycle functions\n this.controllerInitialize = controller.initialize.bind(controller);\n this.controllerConnect = controller.connect.bind(controller);\n this.controllerDisconnect = controller.disconnect.bind(controller);\n }\n}\n//# sourceMappingURL=stimulus_use.js.map","import { StimulusUse } from '../stimulus_use';\nimport { method } from '../support/index';\nexport class UseHover extends StimulusUse {\n constructor(controller, options = {}) {\n super(controller, options);\n this.observe = () => {\n this.targetElement.addEventListener('mouseenter', this.onEnter);\n this.targetElement.addEventListener('mouseleave', this.onLeave);\n };\n this.unobserve = () => {\n this.targetElement.removeEventListener('mouseenter', this.onEnter);\n this.targetElement.removeEventListener('mouseleave', this.onLeave);\n };\n this.onEnter = () => {\n method(this.controller, 'mouseEnter').call(this.controller);\n this.log('mouseEnter', { hover: true });\n };\n this.onLeave = () => {\n method(this.controller, 'mouseLeave').call(this.controller);\n this.log('mouseLeave', { hover: false });\n };\n this.targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n this.controller = controller;\n this.enhanceController();\n this.observe();\n }\n enhanceController() {\n const controllerDisconnect = this.controller.disconnect.bind(this.controller);\n const disconnect = () => {\n this.unobserve();\n controllerDisconnect();\n };\n Object.assign(this.controller, { disconnect });\n }\n}\nexport const useHover = (controller, options = {}) => {\n const observer = new UseHover(controller, options);\n return [observer.observe, observer.unobserve];\n};\n//# sourceMappingURL=use-hover.js.map","import { StimulusUse } from '../stimulus_use';\nimport { method } from '../support/index';\nexport class UseMutation extends StimulusUse {\n constructor(controller, options = {}) {\n super(controller, options);\n this.observe = () => {\n try {\n this.observer.observe(this.targetElement, this.options);\n }\n catch (error) {\n this.controller.application.handleError(error, \"At a minimum, one of childList, attributes, and/or characterData must be true\", {});\n }\n };\n this.unobserve = () => {\n this.observer.disconnect();\n };\n this.mutation = (entries) => {\n method(this.controller, 'mutate').call(this.controller, entries);\n this.log('mutate', { entries });\n };\n this.targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n this.controller = controller;\n this.options = options;\n this.observer = new MutationObserver(this.mutation);\n this.enhanceController();\n this.observe();\n }\n enhanceController() {\n const controllerDisconnect = this.controller.disconnect.bind(this.controller);\n const disconnect = () => {\n this.unobserve();\n controllerDisconnect();\n };\n Object.assign(this.controller, { disconnect });\n }\n}\nexport const useMutation = (controller, options = {}) => {\n const observer = new UseMutation(controller, options);\n return [observer.observe, observer.unobserve];\n};\n//# sourceMappingURL=use-mutation.js.map","import { method } from '../support/index';\nexport const useWindowResize = (controller) => {\n const callback = (event) => {\n const { innerWidth, innerHeight } = window;\n const payload = {\n height: innerHeight || Infinity,\n width: innerWidth || Infinity,\n event\n };\n method(controller, 'windowResize').call(controller, payload);\n };\n const controllerDisconnect = controller.disconnect.bind(controller);\n const observe = () => {\n window.addEventListener('resize', callback);\n callback();\n };\n const unobserve = () => {\n window.removeEventListener('resize', callback);\n };\n Object.assign(controller, {\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-window-resize.js.map","import { Controller } from 'stimulus';\nclass DebounceController extends Controller {\n}\nDebounceController.debounces = [];\nconst defaultWait = 200;\nconst debounce = (fn, wait = defaultWait) => {\n let timeoutId = null;\n return function () {\n const args = arguments;\n const context = this;\n const callback = () => fn.apply(context, args);\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n timeoutId = setTimeout(callback, wait);\n };\n};\nexport const useDebounce = (controller, options) => {\n var _a;\n const constructor = controller.constructor;\n (_a = constructor.debounces) === null || _a === void 0 ? void 0 : _a.forEach((func) => {\n if (typeof func === \"string\") {\n controller[func] = debounce(controller[func], options === null || options === void 0 ? void 0 : options.wait);\n }\n if (typeof func === \"object\") {\n const { name, wait } = func;\n if (!name)\n return;\n controller[name] = debounce(controller[name], wait || (options === null || options === void 0 ? void 0 : options.wait));\n }\n });\n};\n//# sourceMappingURL=use-debounce.js.map","import {useWindowResize} from \"stimulus-use\";\nimport {BaseController} from \"./base_controller\";\n\nexport class AutosizeController extends BaseController {\n\n private boundHandler = this.handler.bind(this);\n\n connect() {\n let target = this.element as HTMLTextAreaElement;\n target.style.resize = \"none\";\n target.style.boxSizing = \"border-box\";\n target.addEventListener(\"input\", this.boundHandler);\n target.addEventListener(\"focus\", this.boundHandler);\n useWindowResize(this);\n requestAnimationFrame(this.boundHandler);\n }\n\n windowResize() {\n this.handler();\n }\n\n private handler() {\n this.autosize(this.element as HTMLTextAreaElement);\n };\n\n private autosize(element: HTMLTextAreaElement) {\n let offset = element.offsetHeight - element.clientHeight;\n element.style.height = \"auto\";\n element.style.height = element.scrollHeight + offset + \"px\";\n }\n\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class CharCountController extends BaseController {\r\n\r\n static targets = [\"input\", \"output\"];\r\n static values = {min: Number, max: Number};\r\n static classes = [\"error\"];\r\n\r\n declare readonly inputTarget: HTMLInputElement | HTMLTextAreaElement;\r\n declare readonly outputTarget: HTMLElement;\r\n declare minValue: number;\r\n declare hasMinValue: boolean;\r\n declare maxValue: number;\r\n declare hasMaxValue: boolean;\r\n declare errorClass: string;\r\n declare hasErrorClass: boolean;\r\n\r\n boundHandler = this.updateCharCount.bind(this);\r\n\r\n connect() {\r\n this.updateCharCount();\r\n this.inputTarget.addEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n this.inputTarget.removeEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n updateCharCount() {\r\n let charCount = this.inputTarget.value.length;\r\n this.outputTarget.innerText = charCount.toString();\r\n if (this.hasErrorClass) {\r\n if (this.isValidCount(charCount)) {\r\n this.outputTarget.classList.remove(this.errorClass);\r\n } else {\r\n this.outputTarget.classList.add(this.errorClass);\r\n }\r\n }\r\n }\r\n\r\n isValidCount(count: number) {\r\n let min = 0;\r\n let max = 99999;\r\n\r\n if (this.hasMinValue) {\r\n min = this.minValue;\r\n }\r\n\r\n if (this.hasMaxValue) {\r\n max = this.maxValue;\r\n }\r\n\r\n return count >= min && count <= max;\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class ClipboardController extends BaseController {\r\n\r\n static targets = [\"button\", \"copy\", \"fallback\"];\r\n static values = {removeUnused: Boolean};\r\n\r\n declare readonly sourceTarget: HTMLElement;\r\n declare readonly copyTarget: HTMLElement;\r\n declare readonly hasCopyTarget: boolean;\r\n declare readonly fallbackTarget: HTMLElement;\r\n declare readonly hasFallbackTarget: boolean;\r\n\r\n declare readonly hasRemoveUnusedValue: boolean;\r\n declare readonly removeUnusedValue: boolean;\r\n\r\n supported = false;\r\n\r\n connect() {\r\n this.supported = document.queryCommandSupported(\"copy\");\r\n\r\n if (this.hasRemoveUnusedValue && this.removeUnusedValue) {\r\n if (this.supported && this.hasFallbackTarget) {\r\n this.fallbackTarget.remove();\r\n } else if (this.hasCopyTarget) {\r\n this.copyTarget.remove();\r\n }\r\n }\r\n }\r\n\r\n select(event: MouseEvent) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n (this.sourceTarget as HTMLInputElement | HTMLTextAreaElement).select();\r\n }\r\n\r\n copy(event: ClipboardEvent) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n (this.sourceTarget as HTMLInputElement | HTMLTextAreaElement).select();\r\n if (this.supported) {\r\n document.execCommand(\"copy\");\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\n\nexport class ConfirmNavigationController extends BaseController {\n\n static values = {message: String};\n\n declare readonly messageValue: string;\n\n connect() {\n let confirmMessage = this.messageValue;\n window.onbeforeunload = () => (confirmMessage == null ? true : confirmMessage);\n window.addEventListener(\"popstate\", this.handlePopstate);\n window.addEventListener(\"submit\", () => {\n window.removeEventListener(\"popstate\", this.handlePopstate);\n window.onbeforeunload = null;\n });\n // TODO: Turbo navigation events\n }\n\n handlePopstate(event: PopStateEvent) {\n return false;\n }\n\n}\n","import {BaseController} from \"./base_controller\";\n\nexport class DebugController extends BaseController {\n\n static targets = [\"test\"];\n declare testTargets: HTMLElement[];\n\n connect() {\n console.log(\"Debug Controller\", this, this.testTargets);\n }\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DetectDirtyController extends BaseController {\r\n\r\n initialValue: string | boolean | null = null;\r\n\r\n boundHandler = this.handler.bind(this);\r\n\r\n connect() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n if (this.isInputElement(element) && this.isCheckable(element)) {\r\n this.initialValue = element.checked;\r\n } else {\r\n this.initialValue = element.value;\r\n }\r\n element.addEventListener(\"input\", this.boundHandler);\r\n element.addEventListener(\"change\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n element.removeEventListener(\"input\", this.boundHandler);\r\n element.removeEventListener(\"change\", this.boundHandler);\r\n }\r\n\r\n restore() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n if (this.isInputElement(element) && this.isCheckable(element)) {\r\n element.checked = this.initialValue as boolean;\r\n } else {\r\n element.value = this.initialValue as string;\r\n }\r\n }\r\n\r\n private handler(event?: Event) {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n\r\n if (this.initialValue !== element.value) {\r\n element.setAttribute(\"data-dirty\", \"true\");\r\n } else {\r\n element.removeAttribute(\"data-dirty\");\r\n }\r\n }\r\n\r\n private isCheckable(element: HTMLInputElement): boolean {\r\n return (element.type === \"radio\" || element.type === \"checkbox\");\r\n }\r\n\r\n private isInputElement(element: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement): element is HTMLInputElement {\r\n return element.tagName === \"INPUT\";\r\n }\r\n\r\n}\r\n\r\nexport function isDirty(element: HTMLElement) {\r\n return element.hasAttribute(\"data-dirty\");\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DisableInputsController extends BaseController {\r\n\r\n static targets = [\"disabler\", \"disable\"];\r\n\r\n static values = {\r\n clear: Boolean,\r\n };\r\n\r\n declare readonly hasDisablerTarget: boolean;\r\n declare readonly disablerTarget: HTMLInputElement;\r\n declare readonly disableTargets: Array;\r\n declare readonly clearValue: boolean;\r\n declare readonly hasClearValue: boolean;\r\n\r\n connect() {\r\n this.toggle();\r\n }\r\n\r\n toggle() {\r\n if (this.hasDisablerTarget && this.disablerTarget.checked) {\r\n this.disableInputs();\r\n } else {\r\n this.enableInputs();\r\n }\r\n }\r\n\r\n disableInputs() {\r\n let shouldClear = this.hasClearValue && this.clearValue;\r\n this.disableTargets.forEach((el, _) => {\r\n if (shouldClear) {\r\n el.value = \"\";\r\n }\r\n el.disabled = true;\r\n });\r\n }\r\n\r\n enableInputs() {\r\n this.disableTargets.forEach((el, _) => {\r\n el.disabled = false;\r\n });\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DismissableController extends BaseController {\r\n\r\n\r\n dismiss() {\r\n this.element.remove();\r\n }\r\n\r\n}\r\n","import {useMutation} from \"stimulus-use\";\r\nimport {BaseController} from \"./base_controller\";\r\n\r\nexport class EmptyDomController extends BaseController {\r\n\r\n static classes = [\"empty\", \"notEmpty\"];\r\n static values = {scopeSelector: String};\r\n\r\n declare hasEmptyClass: boolean;\r\n declare emptyClass: string;\r\n declare hasNotEmptyClass: boolean;\r\n declare notEmptyClass: string;\r\n\r\n declare hasScopeSelectorValue: boolean;\r\n declare scopeSelectorValue: string;\r\n\r\n connect() {\r\n useMutation(this, {element: this.element, childList: true});\r\n this.checkEmpty();\r\n }\r\n\r\n mutate(entries: MutationRecord[]) {\r\n this.checkEmpty();\r\n }\r\n\r\n checkEmpty() {\r\n let children;\r\n if (this.hasScopeSelectorValue) {\r\n children = this.element.querySelectorAll(this.scopeSelectorValue);\r\n } else {\r\n children = this.element.children;\r\n }\r\n\r\n if (children.length === 0) {\r\n if (this.hasNotEmptyClass) {\r\n let classes = this.notEmptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.remove(klass));\r\n }\r\n if (this.hasEmptyClass) {\r\n let classes = this.emptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.add(klass));\r\n }\r\n this.element.dispatchEvent(\r\n new CustomEvent(\"dom:empty\", {\r\n bubbles: true,\r\n cancelable: true,\r\n }),\r\n );\r\n } else {\r\n if (this.hasNotEmptyClass) {\r\n let classes = this.notEmptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.add(klass));\r\n }\r\n if (this.hasEmptyClass) {\r\n let classes = this.emptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.remove(klass));\r\n }\r\n this.element.dispatchEvent(\r\n new CustomEvent(\"dom:not-empty\", {\r\n bubbles: true,\r\n cancelable: true,\r\n detail: {\r\n count: children.length,\r\n },\r\n }),\r\n );\r\n }\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class EnableInputsController extends BaseController {\r\n\r\n static targets = [\"enabler\", \"enable\"];\r\n\r\n static values = {\r\n clear: Boolean,\r\n };\r\n\r\n declare readonly hasEnablerTarget: boolean;\r\n declare readonly enablerTarget: HTMLInputElement;\r\n declare readonly enableTargets: Array;\r\n declare readonly clearValue: boolean;\r\n declare readonly hasClearValue: boolean;\r\n\r\n connect() {\r\n this.toggle();\r\n }\r\n\r\n toggle() {\r\n if (this.hasEnablerTarget && this.enablerTarget.checked) {\r\n this.enableInputs();\r\n } else {\r\n this.disableInputs();\r\n }\r\n }\r\n\r\n disableInputs() {\r\n let shouldClear = this.hasClearValue && this.clearValue;\r\n this.enableTargets.forEach((el, _) => {\r\n if (shouldClear) {\r\n el.value = \"\";\r\n }\r\n el.disabled = true;\r\n });\r\n }\r\n\r\n enableInputs() {\r\n this.enableTargets.forEach((el, _) => {\r\n el.disabled = false;\r\n });\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class FallbackImageController extends BaseController {\r\n\r\n static values = {placeholder: String};\r\n\r\n declare readonly placeholderValue: string;\r\n declare readonly hasPlaceholderValue: boolean;\r\n\r\n connect() {\r\n let element = this.element as HTMLImageElement;\r\n\r\n element.onerror = () => {\r\n if (this.hasPlaceholderValue) {\r\n element.src = this.placeholderValue;\r\n } else {\r\n element.style.display = \"none\";\r\n }\r\n };\r\n }\r\n\r\n}\r\n","import {useIntersection} from \"stimulus-use\";\nimport {IntersectionOptions} from \"stimulus-use/dist/use-intersection/use-intersection\";\nimport {AsyncBlockController} from \"./async_block_controller\";\n\nexport class LazyBlockController extends AsyncBlockController {\n\n declare observe: () => void;\n declare unobserve: () => void;\n declare options: IntersectionOptions;\n declare isVisible: boolean;\n declare disappear: () => void;\n\n connect() {\n let element = this.element;\n this.options = {element, threshold: 0.3};\n\n if (\"IntersectionObserver\" in window) {\n [this.observe, this.unobserve] = useIntersection(this, this.options);\n } else {\n // Client doesn't support intersection observer, fallback to pre-loading\n this.loadContent();\n }\n }\n\n appear(entry: IntersectionObserverEntry) {\n let element = this.element as HTMLImageElement;\n if (element.src !== \"\") {\n return;\n }\n if (entry.target === element && entry.isIntersecting) {\n this.loadContent();\n if (this.unobserve) {\n this.unobserve();\n }\n }\n }\n\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class LimitedSelectionCheckboxesController extends BaseController {\r\n\r\n static targets = [\"input\", \"error\"];\r\n static values = {max: Number, message: String};\r\n\r\n declare readonly hasErrorTarget: boolean;\r\n declare readonly errorTarget: HTMLElement;\r\n declare readonly inputTargets: HTMLInputElement[];\r\n declare readonly maxValue: number;\r\n declare readonly messageValue: string;\r\n\r\n maxSelections = 0;\r\n\r\n boundHandleInputs = this.handleInputs.bind(this);\r\n\r\n connect() {\r\n this.inputTargets.forEach((el) => el.addEventListener(\"change\", this.boundHandleInputs));\r\n }\r\n\r\n disconnect() {\r\n this.inputTargets.forEach((el) => el.removeEventListener(\"change\", this.boundHandleInputs));\r\n }\r\n\r\n handleInputs(event: Event) {\r\n let tickedInputs = this.inputTargets.reduce((previousValue, el) => el.checked ? previousValue + 1 : previousValue, 0);\r\n let target = event.target as HTMLInputElement;\r\n if (tickedInputs > this.maxSelections) {\r\n event.preventDefault();\r\n target.checked = false;\r\n target.dispatchEvent(new CustomEvent(\"change\", {bubbles: true, cancelable: true}));\r\n target.dispatchEvent(new CustomEvent(\"limited-selection:too-many\", {bubbles: true, cancelable: true, detail: {target}}));\r\n if (this.hasErrorTarget) {\r\n this.errorTarget.innerHTML = this.messageValue;\r\n }\r\n } else {\r\n target.dispatchEvent(new CustomEvent(\"limited-selection:selection\", {bubbles: true, cancelable: true, detail: {target}}));\r\n if (this.hasErrorTarget) {\r\n this.errorTarget.innerHTML = \"\";\r\n }\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class NestedFormController extends BaseController {\r\n static targets = ['target', 'template'];\r\n static values = {\r\n insertMode: String,\r\n wrapperClass: String,\r\n };\r\n\r\n declare readonly targetTarget: HTMLElement;\r\n declare readonly templateTarget: HTMLTemplateElement | HTMLScriptElement;\r\n\r\n declare readonly wrapperClassValue: string;\r\n declare readonly hasWrapperSelectorValue: boolean;\r\n declare readonly insertModeValue: InsertPosition;\r\n declare readonly hasInsertModeValue: boolean;\r\n\r\n get wrapperClass() {\r\n return this.hasWrapperSelectorValue ? this.wrapperClassValue : 'nested-fields';\r\n }\r\n\r\n get insertMode(): InsertPosition {\r\n return this.hasInsertModeValue ? this.insertModeValue : 'beforeend';\r\n }\r\n\r\n connect() {\r\n this.checkStructure();\r\n }\r\n\r\n add(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n\r\n const content = this.templateTarget.innerHTML.replace(/NEW_RECORD/g, this.generateID());\r\n this.targetTarget.insertAdjacentHTML(this.insertMode, content);\r\n }\r\n\r\n remove(event: Event) {\r\n event.preventDefault();\r\n const wrapper: HTMLElement | null = (event.target as HTMLElement).closest(this.wrapperClass);\r\n if (wrapper == null) {\r\n throw new Error(`#remove was clicked from outside of a child record. Could not find an ancestor with class ${this.wrapperClass}`);\r\n }\r\n\r\n if (wrapper.dataset.newRecord === 'true') {\r\n wrapper.remove();\r\n } else {\r\n wrapper.style.display = 'none';\r\n let destroyInput = wrapper.querySelector(\"input[name*='_destroy']\") as HTMLInputElement | null;\r\n if (destroyInput == null) {\r\n throw new Error(`Could not find a hidden input with name '_destroy'. NestedForm cannot remove an already persisted record without it.`);\r\n }\r\n\r\n destroyInput.value = \"1\";\r\n }\r\n }\r\n\r\n generateID(): string {\r\n return new Date().getTime().toString() + Math.random();\r\n }\r\n\r\n private checkStructure() {\r\n let template = this.templateTarget.innerHTML;\r\n\r\n if (template.indexOf('NEW_RECORD')) {\r\n throw new Error(\"Could not find 'NEW_RECORD' in the provided template. Please make sure you've passed `child_index: 'NEW_RECORD'` to `fields_for`\")\r\n }\r\n }\r\n}","import {BaseController} from \"./base_controller\";\r\n\r\nexport class PasswordConfirmController extends BaseController {\r\n\r\n static targets = [\"password\"];\r\n static classes = [\"error\"];\r\n\r\n declare readonly passwordTargets: HTMLInputElement[];\r\n\r\n declare readonly errorClass: string;\r\n declare readonly hasErrorClass: boolean;\r\n\r\n private boundCheckPasswordsMatch = this.checkPasswordsMatch.bind(this);\r\n\r\n connect() {\r\n this.passwordTargets.forEach((el) => el.addEventListener(\"change\", this.boundCheckPasswordsMatch));\r\n }\r\n\r\n disconnect() {\r\n this.passwordTargets.forEach((el) => el.removeEventListener(\"change\", this.boundCheckPasswordsMatch));\r\n }\r\n\r\n private allPasswordsMatch() {\r\n let values = new Set(this.passwordTargets.map(el => el.value)); // Create a unique set of the password values\r\n return values.has(\"\") || values.size == 1; // If any of the passwords are still blank, or there is only one distinct password value (i.e. they all are the same)\r\n }\r\n\r\n private checkPasswordsMatch() {\r\n if (this.allPasswordsMatch()) {\r\n this.element.dispatchEvent(new CustomEvent(\"password-confirm:match\"));\r\n if (this.hasErrorClass) {\r\n this.passwordTargets.forEach(el => el.classList.remove(this.errorClass));\r\n }\r\n } else {\r\n this.element.dispatchEvent(new CustomEvent(\"password-confirm:no-match\"));\r\n if (this.hasErrorClass) {\r\n this.passwordTargets.forEach(el => el.classList.add(this.errorClass));\r\n }\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class PasswordPeekController extends BaseController {\r\n\r\n static targets = [\"password\"];\r\n\r\n declare readonly passwordTarget: HTMLInputElement;\r\n\r\n\r\n peak(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n this.passwordTarget.type = \"text\";\r\n }\r\n\r\n hide(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n this.passwordTarget.type = \"password\";\r\n }\r\n\r\n toggle(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n if (this.passwordTarget.type === \"password\") {\r\n this.peak();\r\n } else {\r\n this.hide();\r\n }\r\n }\r\n}\r\n","import {useDebounce, useWindowResize} from \"stimulus-use\";\nimport {WindowResizePayload} from \"stimulus-use/dist/use-window-resize/use-window-resize\";\nimport {BaseController} from \"./base_controller\";\n\ninterface ResponsiveIframeMessage {\n name: string,\n height: number,\n}\n\nexport class ResponsiveIframeWrapperController extends BaseController {\n\n boundMessageReceived = this.messageReceived.bind(this);\n\n connect() {\n window.addEventListener(\"message\", this.boundMessageReceived);\n }\n\n disconnect() {\n window.removeEventListener(\"message\", this.boundMessageReceived);\n }\n\n messageReceived(message: MessageEvent) {\n let data = message.data;\n if (data.hasOwnProperty(\"name\") && data.name === \"iframe-body\" && data.hasOwnProperty(\"height\")) {\n this.resize(data.height);\n }\n }\n\n resize(height: number) {\n (this.element as HTMLIFrameElement).style.height = `${height}px`;\n }\n\n}\n\nexport class ResponsiveIframeBodyController extends BaseController {\n\n static debounces = [\"postUpdate\"];\n\n declare observe: () => void;\n declare unobserve: () => void;\n\n connect() {\n // If this Window is inside a frame\n if (window.self !== window.top) {\n useWindowResize(this);\n useDebounce(this, {});\n this.postUpdate();\n } else {\n // Not an iframe\n }\n }\n\n windowResize(payload: WindowResizePayload) {\n this.postUpdate();\n };\n\n postUpdate() {\n let payload: ResponsiveIframeMessage = {name: \"iframe-body\", height: this.getHeight()};\n window.parent.postMessage(\n payload,\n \"*\",\n );\n }\n\n getHeight(): number {\n const body = document.body;\n const html = document.documentElement;\n\n // Get the largest height out of body and html's various height measurements\n return Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);\n }\n\n}\n","const smoothSupported = \"scrollBehavior\" in document.documentElement.style;\r\nlet smoothPolyfilled: boolean;\r\n\r\nexport async function scrollToElement(element: Element, {behavior = \"smooth\", block = \"start\", inline = \"nearest\"}: ScrollIntoViewOptions = {}) {\r\n if (behavior == \"smooth\" && !smoothSupported) {\r\n await polyfillSmooth();\r\n }\r\n element.scrollIntoView({behavior, block, inline});\r\n}\r\n\r\nasync function polyfillSmooth() {\r\n const {polyfill} = await import(/* webpackChunkName: \"smoothscroll-polyfill\" */ \"smoothscroll-polyfill\");\r\n if (smoothPolyfilled) {\r\n return;\r\n }\r\n smoothPolyfilled = true;\r\n polyfill();\r\n}\r\n\r\nexport function getScrollParent(node: HTMLElement | null): HTMLElement | null {\r\n if (!node) {\r\n return null;\r\n }\r\n const overflowY = getComputedStyle(node).overflowY;\r\n const isScrollable = overflowY !== \"visible\" && overflowY !== \"hidden\";\r\n\r\n if (isScrollable && node.scrollHeight >= node.clientHeight) {\r\n return node;\r\n }\r\n\r\n return getScrollParent(node.parentElement) || document.body;\r\n}\r\n","import camelCase from \"lodash.camelcase\";\r\nimport {BaseController} from \"../base_controller\";\r\n\r\nexport class EphemeralController extends BaseController {\r\n\r\n cleanupSelf() {\r\n this.cleanup(this.element as HTMLElement);\r\n }\r\n\r\n cleanup(element: HTMLElement) {\r\n element.dataset.controller = element.dataset.controller?.replaceAll(new RegExp(`(\\s|^)${this.identifier}(\\s|$)`, \"g\"), \"\") || \"\";\r\n if (element.dataset.controller == \"\") {\r\n // If there are no controllers left, remove the attribute\r\n delete element.dataset.controller;\r\n }\r\n\r\n let substringIdentifierValueRegex = new RegExp(`(\\s|^)${this.identifier}\\\\..+?(\\s|$)`, \"g\");\r\n element.dataset.target = element.dataset.target?.replaceAll(substringIdentifierValueRegex, \"\") || \"\";\r\n delete element.dataset[camelCase(`${this.identifier}-target`)];\r\n if (element.dataset.target == \"\") {\r\n // If there are no targets left, remove the attribute\r\n delete element.dataset.target;\r\n }\r\n\r\n element.dataset.action = element.dataset.target?.replaceAll(substringIdentifierValueRegex, \"\") || \"\";\r\n delete element.dataset[camelCase(`${this.identifier}-action`)];\r\n if (element.dataset.action == \"\") {\r\n // If there are no actions left, remove the attribute\r\n delete element.dataset.action;\r\n }\r\n\r\n // @ts-ignore\r\n let values = this.constructor.values;\r\n if (values) {\r\n Object.keys(values).forEach(val => delete element.dataset[camelCase(`${this.identifier}-${val}-value`)]);\r\n }\r\n\r\n // @ts-ignore\r\n let classes = this.constructor.classes;\r\n if (classes) {\r\n Object.keys(classes).forEach(val => delete element.dataset[camelCase(`${this.identifier}-${val}-class`)]);\r\n }\r\n }\r\n\r\n}\r\n","import {EphemeralController} from \"./utilities/ephemeral_controller\";\r\nimport {scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollIntoFocusController extends EphemeralController {\r\n\r\n static values = {\r\n behavior: String,\r\n block: String,\r\n inline: String,\r\n };\r\n\r\n declare behaviorValue: ScrollBehavior;\r\n declare hasBehaviorValue: boolean;\r\n declare blockValue: ScrollLogicalPosition;\r\n declare hasBlockValue: boolean;\r\n declare inlineValue: ScrollLogicalPosition;\r\n declare hasInlineValue: boolean;\r\n\r\n connect() {\r\n requestAnimationFrame(() => {\r\n // Attempt smooth scrolling, with polyfill\r\n scrollToElement(\r\n this.element,\r\n {\r\n behavior: this.hasBehaviorValue ? this.behaviorValue : \"smooth\",\r\n block: this.hasBlockValue ? this.blockValue : \"center\",\r\n inline: this.hasInlineValue ? this.inlineValue : \"center\",\r\n },\r\n ).catch(() => this.element.scrollIntoView()); // Fallback to snap-scrolling\r\n this.cleanupSelf();\r\n });\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\nimport {getScrollParent, scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollToBottomController extends BaseController {\r\n\r\n static values = {\r\n mode: String,\r\n };\r\n\r\n declare modeValue: \"nearest\" | \"document\";\r\n declare hasModeValue: boolean;\r\n\r\n\r\n scroll(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n let mode = this.hasModeValue ? this.modeValue : \"document\";\r\n let target: null | HTMLElement;\r\n if (mode == \"document\") {\r\n target = document.body;\r\n } else {\r\n target = getScrollParent(this.element as HTMLElement);\r\n }\r\n if (target == null) {\r\n return;\r\n }\r\n scrollToElement(target!, {behavior: \"smooth\", block: \"end\"}).catch(() => target!.scrollIntoView(false));\r\n }\r\n\r\n}\r\n\r\n","import {BaseController} from \"./base_controller\";\r\nimport {scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollToController extends BaseController {\r\n\r\n static values = {\r\n selector: String,\r\n behavior: String,\r\n block: String,\r\n inline: String,\r\n };\r\n\r\n declare selectorValue: string;\r\n declare behaviorValue: ScrollBehavior;\r\n declare hasBehaviorValue: boolean;\r\n declare blockValue: ScrollLogicalPosition;\r\n declare hasBlockValue: boolean;\r\n declare inlineValue: ScrollLogicalPosition;\r\n declare hasInlineValue: boolean;\r\n\r\n\r\n scroll() {\r\n let target = document.querySelector(this.selectorValue);\r\n if (!target) {\r\n console.warn(`Could not find target for '${this.selectorValue}'`);\r\n return;\r\n }\r\n\r\n scrollToElement(\r\n target!,\r\n {\r\n behavior: this.hasBehaviorValue ? this.behaviorValue : \"smooth\",\r\n block: this.hasBlockValue ? this.blockValue : \"center\",\r\n inline: this.hasInlineValue ? this.inlineValue : \"center\",\r\n },\r\n ).catch(() => target!.scrollIntoView()); // Fallback to snap-scrolling\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\nimport {getScrollParent, scrollToElement} from \"./utilities/scroll\";\n\nexport class ScrollToTopController extends BaseController {\n\n static values = {\n mode: String,\n };\n\n declare modeValue: \"nearest\" | \"document\";\n declare hasModeValue: boolean;\n\n\n scroll(event?: Event) {\n if (event) {\n event.preventDefault();\n }\n let mode = this.hasModeValue ? this.modeValue : \"document\";\n let target: null | HTMLElement;\n if (mode == \"document\") {\n target = document.body;\n } else {\n target = getScrollParent(this.element as HTMLElement);\n }\n if (target == null) {\n return;\n }\n scrollToElement(target!, {behavior: \"smooth\", block: \"start\"}).catch(() => target!.scrollIntoView(false));\n }\n\n}\n\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class SelfDestructController extends BaseController {\r\n\r\n static values = {seconds: Number};\r\n\r\n declare readonly secondsValue: number;\r\n timeout: null | ReturnType = null;\r\n\r\n connect() {\r\n requestAnimationFrame(() => {\r\n // Only start countdown on first paint\r\n this.timeout = setTimeout(() => this.element.remove(), this.secondsValue * 1000);\r\n });\r\n }\r\n\r\n disconnect() {\r\n if (this.timeout) {\r\n clearTimeout(this.timeout);\r\n }\r\n }\r\n\r\n}\r\n","import {EphemeralController} from \"./utilities/ephemeral_controller\";\r\n\r\nexport class TeleportController extends EphemeralController {\r\n\r\n static values = {target: String, insert: String, immediate: Boolean};\r\n\r\n declare readonly immediateValue: boolean;\r\n declare readonly hasImmediateValue: boolean;\r\n declare readonly targetValue: string;\r\n declare readonly hasInsertValue: boolean;\r\n declare readonly insertValue: InsertPosition | \"replaceOuter\" | \"replaceInner\" | \"prepend\" | \"append\";\r\n\r\n connect() {\r\n if (!this.hasInsertValue) {\r\n throw new Error(\"`insert` value was not specified\");\r\n }\r\n\r\n requestAnimationFrame(() => {\r\n if (this.hasImmediateValue && this.immediateValue) {\r\n this.execute();\r\n }\r\n });\r\n }\r\n\r\n execute(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n let destination = document.querySelector(this.targetValue);\r\n\r\n if (destination == null) {\r\n this.element.dispatchEvent(new CustomEvent(\"teleport:error\", {bubbles: true, cancelable: true}));\r\n return;\r\n }\r\n\r\n let copy = this.element.cloneNode(true) as HTMLElement;\r\n this.cleanup(copy);\r\n\r\n switch (this.insertValue) {\r\n case \"beforebegin\":\r\n case \"beforeend\":\r\n case \"afterend\":\r\n case \"afterbegin\":\r\n destination.insertAdjacentHTML(this.insertValue, copy.outerHTML);\r\n break;\r\n case \"replaceOuter\":\r\n destination.outerHTML = copy.outerHTML;\r\n break;\r\n case \"replaceInner\":\r\n destination.innerHTML = copy.outerHTML;\r\n break;\r\n case \"prepend\":\r\n destination.insertAdjacentHTML(\"afterbegin\", copy.outerHTML);\r\n break;\r\n case \"append\":\r\n destination.insertAdjacentHTML(\"beforeend\", copy.outerHTML);\r\n break;\r\n default:\r\n throw new Error(\"`insert` value was not specified\");\r\n\r\n }\r\n this.element.remove();\r\n }\r\n\r\n}\r\n","import {useClickOutside, useHover} from \"stimulus-use\";\nimport {BaseController} from \"./base_controller\";\n\nexport type ToggleClassMode = \"on\" | \"off\" | \"toggle\"\n\nexport class ToggleClassController extends BaseController {\n\n static targets = [\"toggle\"];\n static values = {\n class: String,\n mouseEnter: String,\n mouseLeave: String,\n clickAway: Boolean,\n initial: String,\n };\n\n declare readonly toggleTargets: HTMLElement[];\n\n declare readonly classValue: string;\n declare readonly hasClassValue: boolean;\n\n declare readonly mouseEnterValue: ToggleClassMode;\n declare readonly hasMouseEnterValue: boolean;\n\n declare readonly mouseLeaveValue: ToggleClassMode;\n declare readonly hasMouseLeaveValue: boolean;\n\n declare readonly clickAwayValue: boolean;\n declare readonly hasClickAwayValue: boolean;\n\n declare readonly initialValue: \"on\" | \"off\";\n declare readonly hasInitialValue: boolean;\n\n connect() {\n if (!this.hasClassValue) {\n throw new Error(\"data-toggle-class-class-value must not be empty\");\n }\n\n if (this.hasMouseEnterValue || this.hasMouseLeaveValue) {\n useHover(this);\n }\n\n if (this.hasClickAwayValue && this.clickAwayValue) {\n useClickOutside(this);\n }\n\n requestAnimationFrame(() => {\n if (this.hasInitialValue) {\n if (this.initialValue === \"on\") {\n this.toggleTargets.forEach((target) => this.elementOn(target));\n } else {\n this.toggleTargets.forEach((target) => this.elementOff(target));\n }\n }\n });\n }\n\n clickOutside() {\n this.toggleTargets.forEach((target) => {\n if (this.elementWasToggled(target)) {\n this.elementToggleStatus(target);\n this.elementToggle(target);\n }\n });\n }\n\n mouseEnter() {\n if (this.hasMouseEnterValue) {\n switch (this.mouseEnterValue) {\n case \"on\":\n this.on();\n break;\n case \"off\":\n this.off();\n break;\n case \"toggle\":\n this.toggle();\n break;\n }\n }\n return {};\n }\n\n mouseLeave() {\n if (this.hasMouseLeaveValue) {\n switch (this.mouseLeaveValue) {\n case \"on\":\n this.on();\n break;\n case \"off\":\n this.off();\n break;\n case \"toggle\":\n this.toggle();\n break;\n }\n }\n return {};\n }\n\n on(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementOn(target);\n });\n }\n\n off(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementOff(target);\n });\n }\n\n toggle(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementToggle(target);\n });\n }\n\n private elementWasToggled(el: HTMLElement): boolean {\n return el.dataset.toggled == \"true\";\n }\n\n private elementToggleStatus(el: HTMLElement) {\n if (this.elementWasToggled(el)) {\n delete el.dataset.toggled;\n } else {\n el.dataset.toggled = \"true\";\n }\n }\n\n private elementToggle(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass));\n }\n\n private elementOn(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass, true));\n }\n\n private elementOff(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass, false));\n }\n\n}\n","import {BaseController} from \"./base_controller\";\nimport {isHTMLLinkElement} from \"./utilities/elements\";\nimport {isTurboFrame} from \"./utilities/turbo\";\n\nexport class TurboFrameRCController extends BaseController {\n\n static values = {\n frameId: String,\n src: String,\n loadingMessage: String,\n };\n\n declare readonly frameIdValue: string;\n declare readonly srcValue: string;\n declare readonly hasSrcValue: boolean;\n declare readonly loadingMessageValue: string;\n declare readonly hasLoadingMessageValue: boolean;\n\n toggle(event?: Event | null) {\n if (event) {\n event.preventDefault();\n }\n let frame = this.getFrame();\n let frameSrc = frame.src;\n if (frameSrc == null || frameSrc !== this.getSrc()) {\n this.setSrc();\n } else {\n this.clear();\n }\n }\n\n setSrc(event?: Event | null) {\n if (event) {\n event.preventDefault();\n }\n let frame = this.getFrame();\n if (this.hasLoadingMessageValue) {\n frame.innerHTML = this.loadingMessageValue;\n }\n\n frame.src = this.getSrc();\n }\n\n clear(event?: Event | null) {\n if (event) {\n event.preventDefault();\n }\n let frame = this.getFrame();\n frame.src = \"\";\n frame.innerHTML = \"\";\n }\n\n private getFrame(): TurboFrame {\n let frame = document.getElementById(`${this.frameIdValue}`);\n if (frame == null) {\n throw new Error(`Could not find frame with ID '${this.frameIdValue}'`);\n }\n if (!isTurboFrame(frame)) {\n throw new Error(`Element targeted by ID '${this.frameIdValue}'`);\n } else {\n return frame;\n }\n }\n\n private getSrc(): string {\n let element = this.element as HTMLElement;\n if (this.hasSrcValue) {\n return this.srcValue;\n } else if (isHTMLLinkElement(element)) {\n return element.href;\n } else {\n throw new Error(\"No link given to drive frame to\");\n }\n }\n\n}\n","export function isTurboFrame(element: HTMLElement): element is TurboFrame {\r\n return element.nodeName == \"TURBO-FRAME\";\r\n}\r\n","export function isHTMLLinkElement(element: Element): element is HTMLLinkElement {\n return element.nodeName == \"A\";\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class WordCountController extends BaseController {\r\n\r\n static targets = [\"input\", \"output\"];\r\n static values = {min: Number, max: Number};\r\n static classes = [\"error\"];\r\n\r\n declare readonly inputTarget: HTMLInputElement | HTMLTextAreaElement;\r\n declare readonly outputTarget: HTMLElement;\r\n declare minValue: number;\r\n declare hasMinValue: boolean;\r\n declare maxValue: number;\r\n declare hasMaxValue: boolean;\r\n declare errorClass: string;\r\n declare hasErrorClass: boolean;\r\n\r\n boundHandler = this.updateWordCount.bind(this);\r\n\r\n connect() {\r\n this.updateWordCount();\r\n this.inputTarget.addEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n this.inputTarget.removeEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n updateWordCount() {\r\n let wordCount = 0;\r\n let textAreaValue = this.inputTarget.value;\r\n let matches = textAreaValue.match(/\\S+/g);\r\n wordCount = (matches && matches.length) || 0;\r\n this.outputTarget.innerText = wordCount.toString();\r\n if (this.hasErrorClass) {\r\n if (this.isValidCount(wordCount)) {\r\n this.outputTarget.classList.remove(this.errorClass);\r\n } else {\r\n this.outputTarget.classList.add(this.errorClass);\r\n }\r\n }\r\n }\r\n\r\n isValidCount(count: number) {\r\n let min = 0;\r\n let max = 99999;\r\n\r\n if (this.hasMinValue) {\r\n min = this.minValue;\r\n }\r\n\r\n if (this.hasMaxValue) {\r\n max = this.maxValue;\r\n }\r\n\r\n return count >= min && count <= max;\r\n }\r\n\r\n}\r\n"],"names":["BaseController","context","_this","Proxy","get","obj","prop","returnVal","Reflect","self","test","logProperty","toString","apply","target","thisArg","argArray","log","args","functionName","this","application","debug","logger","console","groupCollapsed","identifier","element","groupEnd","Controller","AsyncBlockController","connect","loadContent","el","hasReplaceTarget","replaceTarget","fetch","endpointValue","then","response","text","html","newEl","document","createElement","innerHTML","replaceWith","event","CustomEvent","detail","dispatchEvent","err","endpoint","String","AutoSubmitFormController","handler","bind","querySelectorAll","forEach","addEventListener","_this2","boundHandler","disconnect","removeEventListener","_this3","e","bubbles","cancelable","method","controller","methodName","composeEventName","name","eventPrefix","composedName","extendedEvent","type","composed","Object","assign","originalEvent","defaultOptions","events","onlyVisible","StimulusUse","[object Object]","options","_a","_b","_c","controllerId","stimulusUseDebug","id","dataset","controllerInitialize","initialize","controllerConnect","controllerDisconnect","UseHover","super","observe","targetElement","onEnter","onLeave","unobserve","call","hover","enhanceController","UseMutation","observer","error","handleError","mutation","entries","MutationObserver","useWindowResize","callback","innerWidth","innerHeight","window","payload","height","Infinity","width","debounce","fn","wait","timeoutId","arguments","clearTimeout","setTimeout","AutosizeController","style","resize","boxSizing","requestAnimationFrame","windowResize","autosize","offset","offsetHeight","clientHeight","scrollHeight","CharCountController","updateCharCount","inputTarget","charCount","value","length","outputTarget","innerText","hasErrorClass","isValidCount","classList","remove","errorClass","add","count","min","max","hasMinValue","minValue","hasMaxValue","maxValue","Number","ClipboardController","supported","queryCommandSupported","hasRemoveUnusedValue","removeUnusedValue","hasFallbackTarget","fallbackTarget","hasCopyTarget","copyTarget","select","preventDefault","sourceTarget","copy","execCommand","removeUnused","Boolean","ConfirmNavigationController","confirmMessage","messageValue","onbeforeunload","handlePopstate","message","DebugController","testTargets","DetectDirtyController","initialValue","isInputElement","isCheckable","checked","restore","setAttribute","removeAttribute","tagName","DisableInputsController","toggle","hasDisablerTarget","disablerTarget","disableInputs","enableInputs","shouldClear","hasClearValue","clearValue","disableTargets","_","disabled","clear","DismissableController","dismiss","EmptyDomController","useMutation","childList","checkEmpty","mutate","children","hasScopeSelectorValue","scopeSelectorValue","hasNotEmptyClass","notEmptyClass","split","klass","hasEmptyClass","emptyClass","scopeSelector","EnableInputsController","hasEnablerTarget","enablerTarget","enableTargets","FallbackImageController","onerror","hasPlaceholderValue","src","placeholderValue","display","placeholder","LazyBlockController","threshold","IntersectionObserver","entry","isIntersecting","isVisible","eventName","appearEvent","dispatchAppear","disappearEvent","dispatchDisappear","useIntersection","appear","LimitedSelectionCheckboxesController","handleInputs","inputTargets","boundHandleInputs","tickedInputs","reduce","previousValue","maxSelections","hasErrorTarget","errorTarget","NestedFormController","checkStructure","content","templateTarget","replace","generateID","targetTarget","insertAdjacentHTML","insertMode","wrapper","closest","wrapperClass","Error","newRecord","destroyInput","querySelector","Date","getTime","Math","random","indexOf","hasWrapperSelectorValue","wrapperClassValue","hasInsertModeValue","insertModeValue","PasswordConfirmController","checkPasswordsMatch","passwordTargets","boundCheckPasswordsMatch","allPasswordsMatch","values","Set","map","has","size","_this4","PasswordPeekController","peak","passwordTarget","hide","ResponsiveIframeWrapperController","messageReceived","boundMessageReceived","data","hasOwnProperty","ResponsiveIframeBodyController","top","constructor","debounces","func","postUpdate","getHeight","parent","postMessage","body","documentElement","smoothPolyfilled","EphemeralController","cleanupSelf","cleanup","replaceAll","RegExp","substringIdentifierValueRegex","camelCase","action","keys","val","classes","scrollToElement","behavior","block","inline","scrollIntoView","smoothSupported","Promise","polyfill","polyfillSmooth","getScrollParent","node","overflowY","getComputedStyle","parentElement","ScrollIntoFocusController","hasBehaviorValue","behaviorValue","hasBlockValue","blockValue","hasInlineValue","inlineValue","ScrollToBottomController","scroll","hasModeValue","modeValue","mode","ScrollToController","selectorValue","warn","selector","ScrollToTopController","SelfDestructController","timeout","secondsValue","seconds","TeleportController","hasInsertValue","hasImmediateValue","immediateValue","execute","destination","targetValue","cloneNode","insertValue","outerHTML","insert","immediate","ToggleClassController","hasClassValue","hasMouseEnterValue","hasMouseLeaveValue","useHover","hasClickAwayValue","clickAwayValue","onEvent","contains","rect","getBoundingClientRect","windowHeight","windowWidth","clientWidth","left","isElementInViewport","clickOutside","clickOutsideEvent","useClickOutside","hasInitialValue","toggleTargets","elementOn","elementOff","elementWasToggled","elementToggleStatus","elementToggle","mouseEnter","mouseEnterValue","on","off","mouseLeave","mouseLeaveValue","_this5","toggled","classValue","class","clickAway","initial","TurboFrameRCController","frameSrc","getFrame","getSrc","setSrc","frame","hasLoadingMessageValue","loadingMessageValue","getElementById","frameIdValue","nodeName","hasSrcValue","srcValue","isHTMLLinkElement","href","frameId","loadingMessage","WordCountController","updateWordCount","wordCount","matches","match"],"mappings":"k0BAEaA,cAEX,WAAYC,SAEV,OADAC,cAAMD,aACKE,WAAY,CACrBC,IAAK,SAACC,EAAKC,GACT,IAAIC,EAAYC,QAAQJ,IAAIC,EAAKC,GAC7BG,OACJ,GAmCR,SAAqBH,GACnB,OAAQA,GACN,IAAK,cACL,IAAK,UACL,IAAK,cACL,IAAK,aACL,IAAK,MACL,IAAK,OACL,IAAK,qBACL,IAAK,aACH,SAGJ,QAAI,kBAAkBI,KAAKJ,IAGvB,aAAaI,KAAKJ,IAGlB,oBAAoBI,KAAKJ,IAGzB,aAAaI,KAAKJ,IAzDZK,CAAYL,EAAKM,YAAa,CAChC,GAAwB,mBAAbL,EACT,WAAWJ,MAAMI,EAAW,CAC1BM,eAAMC,EAAaC,EAAcC,GAI/B,OAHAP,EAAKQ,IAAIX,EAAKM,WAAY,CACxBM,KAAMF,IAEDR,QAAQK,MAAMC,EAAQC,EAASC,MAI1Cd,EAAKe,IAAIX,EAAKM,YAGlB,OAAOL,qCAKbU,IAAA,SAAIE,EAAsBD,GAExB,YAFwBA,IAAAA,EAAW,IAE9BE,KAAKC,YAAYC,MAAtB,CAGA,IAAIC,EAASC,QACbD,EAAOE,oBAAoBL,KAAKM,kBAAiBP,EAAgB,iBAAkB,gBACnFI,EAAON,OACLU,QAASP,KAAKO,SACXT,IAELK,EAAOK,gBAtCyBC,cCAvBC,kGAYXC,QAAA,WACEX,KAAKY,iBAGPA,YAAA,WACE,IAAIC,EAAMb,K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BAGrDmX,gBAAA,WACE,IAAIC,EAAY,EAEZC,EADgB9Z,KAAK4H,YAAYE,MACTiS,MAAM,QAElC/Z,KAAKgI,aAAaC,WADlB4R,EAAaC,GAAWA,EAAQ/R,QAAW,GACHvI,WACpCQ,KAAKkI,gBACHlI,KAAKmI,aAAa0R,GACpB7Z,KAAKgI,aAAaI,UAAUC,OAAOrI,KAAKsI,YAExCtI,KAAKgI,aAAaI,UAAUG,IAAIvI,KAAKsI,gBAK3CH,aAAA,SAAaK,GACX,IAAIC,EAAM,EACNC,EAAM,MAUV,OARI1I,KAAK2I,cACPF,EAAMzI,KAAK4I,UAGT5I,KAAK6I,cACPH,EAAM1I,KAAK8I,UAGNN,GAASC,GAAOD,GAASE,MArDK9J,GAEhC+a,UAAU,CAAC,QAAS,UACpBA,SAAS,CAAClR,IAAKM,OAAQL,IAAKK,QAC5B4Q,UAAU,CAAC"} \ No newline at end of file diff --git a/dist/stimulus-library.modern.js b/dist/stimulus-library.modern.js index 029767ff..c6fc6eb7 100644 --- a/dist/stimulus-library.modern.js +++ b/dist/stimulus-library.modern.js @@ -1,2 +1,2 @@ -import{Controller as e}from"stimulus";import t from"lodash.camelcase";function s(){return(s=Object.assign||function(e){for(var t=1;t{let s=Reflect.get(e,t),n=this;if(function(e){switch(e){case"application":case"element":case"constructor":case"initialize":case"log":case"data":case"valueDescriptorMap":case"identifier":return!1}return!(/^.*?Target(s)?$/.test(e)||/^.*?Value$/.test(e)||/^.*?ValueChanged$/.test(e)||/^.*?Class$/.test(e))}(t.toString())){if("function"==typeof s)return new Proxy(s,{apply:(e,s,i)=>(n.log(t.toString(),{args:i}),Reflect.apply(e,s,i))});this.log(t.toString())}return s}})}log(e,t={}){if(!this.application.debug)return;let n=console;n.groupCollapsed(`%c${this.identifier} %c#${e}`,"color: #3B82F6","color: unset"),n.log(s({element:this.element},t)),n.groupEnd()}}class i extends n{connect(){this.loadContent()}loadContent(){let e=this.hasReplaceTarget?this.replaceTarget:this.element;fetch(this.endpointValue).then(e=>e.text()).then(t=>{let s=document.createElement("div");s.innerHTML=t,e.replaceWith(s);let n=new CustomEvent("ajax:success",{detail:""});e.dispatchEvent(n)}).catch(t=>{e.replaceWith("Sorry, this content failed to load");let s=new CustomEvent("ajax:error",{detail:""});e.dispatchEvent(s)}).finally(()=>{let t=new CustomEvent("ajax:complete",{detail:""});e.dispatchEvent(t)})}}i.targets=["replace"],i.values={endpoint:String};class a extends n{constructor(){super(...arguments),this.boundHandler=this.handler.bind(this)}connect(){this.element.querySelectorAll("input, select, textarea").forEach(e=>e.addEventListener("change",this.boundHandler))}disconnect(){this.element.querySelectorAll("input, select, textarea").forEach(e=>e.removeEventListener("change",this.boundHandler))}handler(e){this.element.dispatchEvent(new CustomEvent("submit",{bubbles:!0,cancelable:!0}))}}const l=(e,t)=>{const s=e[t];return"function"==typeof s?s:(...e)=>{}},r=(e,t,s)=>{let n=e;return!0===s?n=`${t.identifier}:${e}`:"string"==typeof s&&(n=`${s}:${e}`),n},o=(e,t,s)=>{const{bubbles:n,cancelable:i,composed:a}=t||{bubbles:!0,cancelable:!0,composed:!0};return t&&Object.assign(s,{originalEvent:t}),new CustomEvent(e,{bubbles:n,cancelable:i,composed:a,detail:s})},c={dispatchEvent:!0,eventPrefix:!0},h={events:["click","touchend"],onlyVisible:!0,dispatchEvent:!0,eventPrefix:!0},u={debug:!1,logger:console};class d{constructor(e,t={}){var s,n,i;this.log=(e,t)=>{this.debug&&(this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${e}`,"color: #3B82F6","color: unset"),this.logger.log(Object.assign({controllerId:this.controllerId},t)),this.logger.groupEnd())},this.debug=null!==(n=null!==(s=null==t?void 0:t.debug)&&void 0!==s?s:e.application.stimulusUseDebug)&&void 0!==n?n:u.debug,this.logger=null!==(i=null==t?void 0:t.logger)&&void 0!==i?i:u.logger,this.controller=e,this.controllerId=e.element.id||e.element.dataset.id,this.controllerInitialize=e.initialize.bind(e),this.controllerConnect=e.connect.bind(e),this.controllerDisconnect=e.disconnect.bind(e)}}class g extends d{constructor(e,t={}){super(e,t),this.observe=()=>{this.targetElement.addEventListener("mouseenter",this.onEnter),this.targetElement.addEventListener("mouseleave",this.onLeave)},this.unobserve=()=>{this.targetElement.removeEventListener("mouseenter",this.onEnter),this.targetElement.removeEventListener("mouseleave",this.onLeave)},this.onEnter=()=>{l(this.controller,"mouseEnter").call(this.controller),this.log("mouseEnter",{hover:!0})},this.onLeave=()=>{l(this.controller,"mouseLeave").call(this.controller),this.log("mouseLeave",{hover:!1})},this.targetElement=(null==t?void 0:t.element)||e.element,this.controller=e,this.enhanceController(),this.observe()}enhanceController(){const e=this.controller.disconnect.bind(this.controller);Object.assign(this.controller,{disconnect:()=>{this.unobserve(),e()}})}}class m extends d{constructor(e,t={}){super(e,t),this.observe=()=>{try{this.observer.observe(this.targetElement,this.options)}catch(e){this.controller.application.handleError(e,"At a minimum, one of childList, attributes, and/or characterData must be true",{})}},this.unobserve=()=>{this.observer.disconnect()},this.mutation=e=>{l(this.controller,"mutate").call(this.controller,e),this.log("mutate",{entries:e})},this.targetElement=(null==t?void 0:t.element)||e.element,this.controller=e,this.options=t,this.observer=new MutationObserver(this.mutation),this.enhanceController(),this.observe()}enhanceController(){const e=this.controller.disconnect.bind(this.controller);Object.assign(this.controller,{disconnect:()=>{this.unobserve(),e()}})}}const p=e=>{const t=t=>{const{innerWidth:s,innerHeight:n}=window,i={height:n||Infinity,width:s||Infinity,event:t};l(e,"windowResize").call(e,i)},s=e.disconnect.bind(e),n=()=>{window.addEventListener("resize",t),t()},i=()=>{window.removeEventListener("resize",t)};return Object.assign(e,{disconnect(){i(),s()}}),n(),[n,i]},b=(e,t=200)=>{let s=null;return function(){const n=arguments,i=this,a=()=>e.apply(i,n);s&&clearTimeout(s),s=setTimeout(a,t)}};class v extends n{constructor(){super(...arguments),this.boundHandler=this.handler.bind(this)}connect(){let e=this.element;e.style.resize="none",e.style.boxSizing="border-box",e.addEventListener("input",this.boundHandler),e.addEventListener("focus",this.boundHandler),p(this),requestAnimationFrame(this.boundHandler)}windowResize(){this.handler()}handler(){this.autosize(this.element)}autosize(e){let t=e.offsetHeight-e.clientHeight;e.style.height="auto",e.style.height=e.scrollHeight+t+"px"}}class f extends n{constructor(){super(...arguments),this.boundHandler=this.updateCharCount.bind(this)}connect(){this.updateCharCount(),this.inputTarget.addEventListener("input",this.boundHandler)}disconnect(){this.inputTarget.removeEventListener("input",this.boundHandler)}updateCharCount(){let e=this.inputTarget.value.length;this.outputTarget.innerText=e.toString(),this.hasErrorClass&&(this.isValidCount(e)?this.outputTarget.classList.remove(this.errorClass):this.outputTarget.classList.add(this.errorClass))}isValidCount(e){let t=0,s=99999;return this.hasMinValue&&(t=this.minValue),this.hasMaxValue&&(s=this.maxValue),e>=t&&e<=s}}f.targets=["input","output"],f.values={min:Number,max:Number},f.classes=["error"];class E extends n{constructor(){super(...arguments),this.supported=!1}connect(){this.supported=document.queryCommandSupported("copy"),this.hasRemoveUnusedValue&&this.removeUnusedValue&&(this.supported&&this.hasFallbackTarget?this.fallbackTarget.remove():this.hasCopyTarget&&this.copyTarget.remove())}select(e){e&&e.preventDefault(),this.sourceTarget.select()}copy(e){e&&e.preventDefault(),this.sourceTarget.select(),this.supported&&document.execCommand("copy")}}E.targets=["button","copy","fallback"],E.values={removeUnused:Boolean};class w extends n{connect(){let e=this.messageValue;window.onbeforeunload=()=>null==e||e,window.addEventListener("popstate",this.handlePopstate),window.addEventListener("submit",()=>{window.removeEventListener("popstate",this.handlePopstate),window.onbeforeunload=null})}handlePopstate(e){return!1}}w.values={message:String};class V extends n{connect(){console.log("Debug Controller",this,this.testTargets)}}V.targets=["test"];class y extends n{constructor(){super(...arguments),this.initialValue=null,this.boundHandler=this.handler.bind(this)}connect(){let e=this.element;this.initialValue=this.isInputElement(e)&&this.isCheckable(e)?e.checked:e.value,e.addEventListener("input",this.boundHandler),e.addEventListener("change",this.boundHandler)}disconnect(){let e=this.element;e.removeEventListener("input",this.boundHandler),e.removeEventListener("change",this.boundHandler)}restore(){let e=this.element;this.isInputElement(e)&&this.isCheckable(e)?e.checked=this.initialValue:e.value=this.initialValue}handler(e){let t=this.element;this.initialValue!==t.value?t.setAttribute("data-dirty","true"):t.removeAttribute("data-dirty")}isCheckable(e){return"radio"===e.type||"checkbox"===e.type}isInputElement(e){return"INPUT"===e.tagName}}class T extends n{connect(){this.toggle()}toggle(){this.hasDisablerTarget&&this.disablerTarget.checked?this.disableInputs():this.enableInputs()}disableInputs(){let e=this.hasClearValue&&this.clearValue;this.disableTargets.forEach((t,s)=>{e&&(t.value=""),t.disabled=!0})}enableInputs(){this.disableTargets.forEach((e,t)=>{e.disabled=!1})}}T.targets=["disabler","disable"],T.values={clear:Boolean};class C extends n{dismiss(){this.element.remove()}}class L extends n{connect(){((e,t={})=>{new m(this,t)})(0,{element:this.element,childList:!0}),this.checkEmpty()}mutate(e){this.checkEmpty()}checkEmpty(){let e;e=this.hasScopeSelectorValue?this.element.querySelectorAll(this.scopeSelectorValue):this.element.children,0===e.length?(this.hasNotEmptyClass&&this.notEmptyClass.split(" ").forEach(e=>this.element.classList.remove(e)),this.hasEmptyClass&&this.emptyClass.split(" ").forEach(e=>this.element.classList.add(e)),this.element.dispatchEvent(new CustomEvent("dom:empty",{bubbles:!0,cancelable:!0}))):(this.hasNotEmptyClass&&this.notEmptyClass.split(" ").forEach(e=>this.element.classList.add(e)),this.hasEmptyClass&&this.emptyClass.split(" ").forEach(e=>this.element.classList.remove(e)),this.element.dispatchEvent(new CustomEvent("dom:not-empty",{bubbles:!0,cancelable:!0,detail:{count:e.length}})))}}L.classes=["empty","notEmpty"],L.values={scopeSelector:String};class x extends n{connect(){this.toggle()}toggle(){this.hasEnablerTarget&&this.enablerTarget.checked?this.enableInputs():this.disableInputs()}disableInputs(){let e=this.hasClearValue&&this.clearValue;this.enableTargets.forEach((t,s)=>{e&&(t.value=""),t.disabled=!0})}enableInputs(){this.enableTargets.forEach((e,t)=>{e.disabled=!1})}}x.targets=["enabler","enable"],x.values={clear:Boolean};class S extends n{connect(){let e=this.element;e.onerror=()=>{this.hasPlaceholderValue?e.src=this.placeholderValue:e.style.display="none"}}}S.values={placeholder:String};class k extends i{connect(){this.options={element:this.element,threshold:.3},"IntersectionObserver"in window?[this.observe,this.unobserve]=((e,t={})=>{const{dispatchEvent:s,eventPrefix:n}=Object.assign({},c,t),i=(null==t?void 0:t.element)||e.element,a=e.disconnect.bind(e),h=new IntersectionObserver(t=>{const[a]=t;a.isIntersecting?(t=>{if(e.isVisible=!0,l(e,"appear").call(e,t),s){const s=r("appear",e,n),a=o(s,null,{controller:e,entry:t});i.dispatchEvent(a)}})(a):e.isVisible&&(t=>{if(e.isVisible=!1,l(e,"disappear").call(e,t),s){const s=r("disappear",e,n),a=o(s,null,{controller:e,entry:t});i.dispatchEvent(a)}})(a)},t),u=()=>{h.observe(i)},d=()=>{h.unobserve(i)};return Object.assign(e,{isVisible:!1,disconnect(){d(),a()}}),u(),[u,d]})(this,this.options):this.loadContent()}appear(e){let t=this.element;""===t.src&&e.target===t&&e.isIntersecting&&(this.loadContent(),this.unobserve&&this.unobserve())}}class H extends n{constructor(){super(...arguments),this.maxSelections=0,this.boundHandleInputs=this.handleInputs.bind(this)}connect(){this.inputTargets.forEach(e=>e.addEventListener("change",this.boundHandleInputs))}disconnect(){this.inputTargets.forEach(e=>e.removeEventListener("change",this.boundHandleInputs))}handleInputs(e){let t=this.inputTargets.reduce((e,t)=>t.checked?e+1:e,0),s=e.target;t>this.maxSelections?(e.preventDefault(),s.checked=!1,s.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!0})),s.dispatchEvent(new CustomEvent("limited-selection:too-many",{bubbles:!0,cancelable:!0,detail:{target:s}})),this.hasErrorTarget&&(this.errorTarget.innerHTML=this.messageValue)):(s.dispatchEvent(new CustomEvent("limited-selection:selection",{bubbles:!0,cancelable:!0,detail:{target:s}})),this.hasErrorTarget&&(this.errorTarget.innerHTML=""))}}H.targets=["input","error"],H.values={max:Number,message:String};class I extends n{constructor(){super(...arguments),this.boundCheckPasswordsMatch=this.checkPasswordsMatch.bind(this)}connect(){this.passwordTargets.forEach(e=>e.addEventListener("change",this.boundCheckPasswordsMatch))}disconnect(){this.passwordTargets.forEach(e=>e.removeEventListener("change",this.boundCheckPasswordsMatch))}allPasswordsMatch(){let e=new Set(this.passwordTargets.map(e=>e.value));return e.has("")||1==e.size}checkPasswordsMatch(){this.allPasswordsMatch()?(this.element.dispatchEvent(new CustomEvent("password-confirm:match")),this.hasErrorClass&&this.passwordTargets.forEach(e=>e.classList.remove(this.errorClass))):(this.element.dispatchEvent(new CustomEvent("password-confirm:no-match")),this.hasErrorClass&&this.passwordTargets.forEach(e=>e.classList.add(this.errorClass)))}}I.targets=["password"],I.classes=["error"];class M extends n{peak(e){e&&e.preventDefault(),this.passwordTarget.type="text"}hide(e){e&&e.preventDefault(),this.passwordTarget.type="password"}toggle(e){e&&e.preventDefault(),"password"===this.passwordTarget.type?this.peak():this.hide()}}M.targets=["password"];class O extends n{constructor(){super(...arguments),this.boundMessageReceived=this.messageReceived.bind(this)}connect(){window.addEventListener("message",this.boundMessageReceived)}disconnect(){window.removeEventListener("message",this.boundMessageReceived)}messageReceived(e){let t=e.data;t.hasOwnProperty("name")&&"iframe-body"===t.name&&t.hasOwnProperty("height")&&this.resize(t.height)}resize(e){this.element.style.height=`${e}px`}}class $ extends n{connect(){var e,t,s;window.self!==window.top&&(p(this),t={},null===(s=(e=this).constructor.debounces)||void 0===s||s.forEach(s=>{if("string"==typeof s&&(e[s]=b(e[s],null==t?void 0:t.wait)),"object"==typeof s){const{name:n,wait:i}=s;if(!n)return;e[n]=b(e[n],i||(null==t?void 0:t.wait))}}),this.postUpdate())}windowResize(e){this.postUpdate()}postUpdate(){let e={name:"iframe-body",height:this.getHeight()};window.parent.postMessage(e,"*")}getHeight(){const e=document.body,t=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,t.clientHeight,t.scrollHeight,t.offsetHeight)}}$.debounces=["postUpdate"];class A extends n{cleanupSelf(){this.cleanup(this.element)}cleanup(e){var s,n,i;e.dataset.controller=(null==(s=e.dataset.controller)?void 0:s.replaceAll(new RegExp(`(s|^)${this.identifier}(s|$)`,"g"),""))||"",""==e.dataset.controller&&delete e.dataset.controller;let a=new RegExp(`(s|^)${this.identifier}\\..+?(s|$)`,"g");e.dataset.target=(null==(n=e.dataset.target)?void 0:n.replaceAll(a,""))||"",delete e.dataset[t(`${this.identifier}-target`)],""==e.dataset.target&&delete e.dataset.target,e.dataset.action=(null==(i=e.dataset.target)?void 0:i.replaceAll(a,""))||"",delete e.dataset[t(`${this.identifier}-action`)],""==e.dataset.action&&delete e.dataset.action;let l=this.constructor.values;l&&Object.keys(l).forEach(s=>delete e.dataset[t(`${this.identifier}-${s}-value`)]);let r=this.constructor.classes;r&&Object.keys(r).forEach(s=>delete e.dataset[t(`${this.identifier}-${s}-class`)])}}const P="scrollBehavior"in document.documentElement.style;let j;async function D(e,{behavior:t="smooth",block:s="start",inline:n="nearest"}={}){"smooth"!=t||P||await async function(){const{polyfill:e}=await import("smoothscroll-polyfill");j||(j=!0,e())}(),e.scrollIntoView({behavior:t,block:s,inline:n})}function R(e){if(!e)return null;const t=getComputedStyle(e).overflowY;return"visible"!==t&&"hidden"!==t&&e.scrollHeight>=e.clientHeight?e:R(e.parentElement)||document.body}class z extends A{connect(){requestAnimationFrame(()=>{D(this.element,{behavior:this.hasBehaviorValue?this.behaviorValue:"smooth",block:this.hasBlockValue?this.blockValue:"center",inline:this.hasInlineValue?this.inlineValue:"center"}).catch(()=>this.element.scrollIntoView()),this.cleanupSelf()})}}z.values={behavior:String,block:String,inline:String};class B extends n{scroll(e){let t;e&&e.preventDefault(),t="document"==(this.hasModeValue?this.modeValue:"document")?document.body:R(this.element),null!=t&&D(t,{behavior:"smooth",block:"end"}).catch(()=>t.scrollIntoView(!1))}}B.values={mode:String};class N extends n{scroll(){let e=document.querySelector(this.selectorValue);e?D(e,{behavior:this.hasBehaviorValue?this.behaviorValue:"smooth",block:this.hasBlockValue?this.blockValue:"center",inline:this.hasInlineValue?this.inlineValue:"center"}).catch(()=>e.scrollIntoView()):console.warn(`Could not find target for '${this.selectorValue}'`)}}N.values={selector:String,behavior:String,block:String,inline:String};class F extends n{scroll(e){let t;e&&e.preventDefault(),t="document"==(this.hasModeValue?this.modeValue:"document")?document.body:R(this.element),null!=t&&D(t,{behavior:"smooth",block:"start"}).catch(()=>t.scrollIntoView(!1))}}F.values={mode:String};class q extends n{constructor(){super(...arguments),this.timeout=null}connect(){requestAnimationFrame(()=>{this.timeout=setTimeout(()=>this.element.remove(),1e3*this.secondsValue)})}disconnect(){this.timeout&&clearTimeout(this.timeout)}}q.values={seconds:Number};class W extends A{connect(){if(!this.hasInsertValue)throw new Error("`insert` value was not specified");requestAnimationFrame(()=>{this.hasImmediateValue&&this.immediateValue&&this.execute()})}execute(e){e&&e.preventDefault();let t=document.querySelector(this.targetValue);if(null==t)return void this.element.dispatchEvent(new CustomEvent("teleport:error",{bubbles:!0,cancelable:!0}));let s=this.element.cloneNode(!0);switch(this.cleanup(s),this.insertValue){case"beforebegin":case"beforeend":case"afterend":case"afterbegin":t.insertAdjacentHTML(this.insertValue,s.outerHTML);break;case"replaceOuter":t.outerHTML=s.outerHTML;break;case"replaceInner":t.innerHTML=s.outerHTML;break;case"prepend":t.insertAdjacentHTML("afterbegin",s.outerHTML);break;case"append":t.insertAdjacentHTML("beforeend",s.outerHTML);break;default:throw new Error("`insert` value was not specified")}this.element.remove()}}W.values={target:String,insert:String,immediate:Boolean};class U extends n{connect(){if(!this.hasClassValue)throw new Error("data-toggle-class-class-value must not be empty");(this.hasMouseEnterValue||this.hasMouseLeaveValue)&&((e,t={})=>{new g(this,t)})(),this.hasClickAwayValue&&this.clickAwayValue&&((e,t={})=>{const{onlyVisible:s,dispatchEvent:n,events:i,eventPrefix:a}=Object.assign({},h,t),l=i=>{const l=(null==t?void 0:t.element)||e.element;if(!(l.contains(i.target)||!function(e){const t=e.getBoundingClientRect(),s=window.innerHeight||document.documentElement.clientHeight,n=window.innerWidth||document.documentElement.clientWidth;return t.top<=s&&t.top+t.height>=0&&t.left<=n&&t.left+t.width>=0}(l)&&s)&&(e.clickOutside&&e.clickOutside(i),n)){const t=r("click:outside",e,a),s=o(t,i,{controller:e});l.dispatchEvent(s)}},c=e.disconnect.bind(e);Object.assign(e,{disconnect(){null==i||i.forEach(e=>{window.removeEventListener(e,l,!1)}),c()}}),null==i||i.forEach(e=>{window.addEventListener(e,l,!1)})})(this),requestAnimationFrame(()=>{this.hasInitialValue&&this.toggleTargets.forEach("on"===this.initialValue?e=>this.elementOn(e):e=>this.elementOff(e))})}clickOutside(){this.toggleTargets.forEach(e=>{this.elementWasToggled(e)&&(this.elementToggleStatus(e),this.elementToggle(e))})}mouseEnter(){if(this.hasMouseEnterValue)switch(this.mouseEnterValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle()}return{}}mouseLeave(){if(this.hasMouseLeaveValue)switch(this.mouseLeaveValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle()}return{}}on(e){this.toggleTargets.forEach(e=>{this.elementToggleStatus(e),this.elementOn(e)})}off(e){this.toggleTargets.forEach(e=>{this.elementToggleStatus(e),this.elementOff(e)})}toggle(e){this.toggleTargets.forEach(e=>{this.elementToggleStatus(e),this.elementToggle(e)})}elementWasToggled(e){return"true"==e.dataset.toggled}elementToggleStatus(e){this.elementWasToggled(e)?delete e.dataset.toggled:e.dataset.toggled="true"}elementToggle(e){this.classValue.split(" ").forEach(t=>e.classList.toggle(t))}elementOn(e){this.classValue.split(" ").forEach(t=>e.classList.toggle(t,!0))}elementOff(e){this.classValue.split(" ").forEach(t=>e.classList.toggle(t,!1))}}U.targets=["toggle"],U.values={class:String,mouseEnter:String,mouseLeave:String,clickAway:Boolean,initial:String};class Y extends n{toggle(e){e&&e.preventDefault();let t=this.getFrame().src;null==t||t!==this.getSrc()?this.setSrc():this.clear()}setSrc(e){e&&e.preventDefault();let t=this.getFrame();this.hasLoadingMessageValue&&(t.innerHTML=this.loadingMessageValue),t.src=this.getSrc()}clear(e){e&&e.preventDefault();let t=this.getFrame();t.src="",t.innerHTML=""}getFrame(){let e=document.getElementById(`${this.frameIdValue}`);if(null==e)throw new Error(`Could not find frame with ID '${this.frameIdValue}'`);if("TURBO-FRAME"!=e.nodeName)throw new Error(`Element targeted by ID '${this.frameIdValue}'`);return e}getSrc(){let e=this.element;if(this.hasSrcValue)return this.srcValue;if(function(e){return"A"==e.nodeName}(e))return e.href;throw new Error("No link given to drive frame to")}}Y.values={frameId:String,src:String,loadingMessage:String};class G extends n{constructor(){super(...arguments),this.boundHandler=this.updateWordCount.bind(this)}connect(){this.updateWordCount(),this.inputTarget.addEventListener("input",this.boundHandler)}disconnect(){this.inputTarget.removeEventListener("input",this.boundHandler)}updateWordCount(){let e=0,t=this.inputTarget.value.match(/\S+/g);e=t&&t.length||0,this.outputTarget.innerText=e.toString(),this.hasErrorClass&&(this.isValidCount(e)?this.outputTarget.classList.remove(this.errorClass):this.outputTarget.classList.add(this.errorClass))}isValidCount(e){let t=0,s=99999;return this.hasMinValue&&(t=this.minValue),this.hasMaxValue&&(s=this.maxValue),e>=t&&e<=s}}G.targets=["input","output"],G.values={min:Number,max:Number},G.classes=["error"];export{i as AsyncBlockController,a as AutoSubmitFormController,v as AutosizeController,f as CharCountController,E as ClipboardController,w as ConfirmNavigationController,V as DebugController,y as DetectDirtyController,T as DisableInputsController,C as DismissableController,L as EmptyDomController,x as EnableInputsController,S as FallbackImageController,k as LazyBlockController,H as LimitedSelectionCheckboxesController,I as PasswordConfirmController,M as PasswordPeekController,$ as ResponsiveIframeBodyController,O as ResponsiveIframeWrapperController,z as ScrollIntoFocusController,B as ScrollToBottomController,N as ScrollToController,F as ScrollToTopController,q as SelfDestructController,W as TeleportController,U as ToggleClassController,Y as TurboFrameRCController,G as WordCountController}; +import{Controller as e}from"stimulus";import t from"lodash.camelcase";function s(){return(s=Object.assign||function(e){for(var t=1;t{let s=Reflect.get(e,t),n=this;if(function(e){switch(e){case"application":case"element":case"constructor":case"initialize":case"log":case"data":case"valueDescriptorMap":case"identifier":return!1}return!(/^.*?Target(s)?$/.test(e)||/^.*?Value$/.test(e)||/^.*?ValueChanged$/.test(e)||/^.*?Class$/.test(e))}(t.toString())){if("function"==typeof s)return new Proxy(s,{apply:(e,s,i)=>(n.log(t.toString(),{args:i}),Reflect.apply(e,s,i))});this.log(t.toString())}return s}})}log(e,t={}){if(!this.application.debug)return;let n=console;n.groupCollapsed(`%c${this.identifier} %c#${e}`,"color: #3B82F6","color: unset"),n.log(s({element:this.element},t)),n.groupEnd()}}class i extends n{connect(){this.loadContent()}loadContent(){let e=this.hasReplaceTarget?this.replaceTarget:this.element;fetch(this.endpointValue).then(e=>e.text()).then(t=>{let s=document.createElement("div");s.innerHTML=t,e.replaceWith(s);let n=new CustomEvent("ajax:success",{detail:""});e.dispatchEvent(n)}).catch(t=>{e.replaceWith("Sorry, this content failed to load");let s=new CustomEvent("ajax:error",{detail:""});e.dispatchEvent(s)}).finally(()=>{let t=new CustomEvent("ajax:complete",{detail:""});e.dispatchEvent(t)})}}i.targets=["replace"],i.values={endpoint:String};class a extends n{constructor(){super(...arguments),this.boundHandler=this.handler.bind(this)}connect(){this.element.querySelectorAll("input, select, textarea").forEach(e=>e.addEventListener("change",this.boundHandler))}disconnect(){this.element.querySelectorAll("input, select, textarea").forEach(e=>e.removeEventListener("change",this.boundHandler))}handler(e){this.element.dispatchEvent(new CustomEvent("submit",{bubbles:!0,cancelable:!0}))}}const r=(e,t)=>{const s=e[t];return"function"==typeof s?s:(...e)=>{}},l=(e,t,s)=>{let n=e;return!0===s?n=`${t.identifier}:${e}`:"string"==typeof s&&(n=`${s}:${e}`),n},o=(e,t,s)=>{const{bubbles:n,cancelable:i,composed:a}=t||{bubbles:!0,cancelable:!0,composed:!0};return t&&Object.assign(s,{originalEvent:t}),new CustomEvent(e,{bubbles:n,cancelable:i,composed:a,detail:s})},c={dispatchEvent:!0,eventPrefix:!0},h={events:["click","touchend"],onlyVisible:!0,dispatchEvent:!0,eventPrefix:!0},d={debug:!1,logger:console};class u{constructor(e,t={}){var s,n,i;this.log=(e,t)=>{this.debug&&(this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${e}`,"color: #3B82F6","color: unset"),this.logger.log(Object.assign({controllerId:this.controllerId},t)),this.logger.groupEnd())},this.debug=null!==(n=null!==(s=null==t?void 0:t.debug)&&void 0!==s?s:e.application.stimulusUseDebug)&&void 0!==n?n:d.debug,this.logger=null!==(i=null==t?void 0:t.logger)&&void 0!==i?i:d.logger,this.controller=e,this.controllerId=e.element.id||e.element.dataset.id,this.controllerInitialize=e.initialize.bind(e),this.controllerConnect=e.connect.bind(e),this.controllerDisconnect=e.disconnect.bind(e)}}class g extends u{constructor(e,t={}){super(e,t),this.observe=()=>{this.targetElement.addEventListener("mouseenter",this.onEnter),this.targetElement.addEventListener("mouseleave",this.onLeave)},this.unobserve=()=>{this.targetElement.removeEventListener("mouseenter",this.onEnter),this.targetElement.removeEventListener("mouseleave",this.onLeave)},this.onEnter=()=>{r(this.controller,"mouseEnter").call(this.controller),this.log("mouseEnter",{hover:!0})},this.onLeave=()=>{r(this.controller,"mouseLeave").call(this.controller),this.log("mouseLeave",{hover:!1})},this.targetElement=(null==t?void 0:t.element)||e.element,this.controller=e,this.enhanceController(),this.observe()}enhanceController(){const e=this.controller.disconnect.bind(this.controller);Object.assign(this.controller,{disconnect:()=>{this.unobserve(),e()}})}}class m extends u{constructor(e,t={}){super(e,t),this.observe=()=>{try{this.observer.observe(this.targetElement,this.options)}catch(e){this.controller.application.handleError(e,"At a minimum, one of childList, attributes, and/or characterData must be true",{})}},this.unobserve=()=>{this.observer.disconnect()},this.mutation=e=>{r(this.controller,"mutate").call(this.controller,e),this.log("mutate",{entries:e})},this.targetElement=(null==t?void 0:t.element)||e.element,this.controller=e,this.options=t,this.observer=new MutationObserver(this.mutation),this.enhanceController(),this.observe()}enhanceController(){const e=this.controller.disconnect.bind(this.controller);Object.assign(this.controller,{disconnect:()=>{this.unobserve(),e()}})}}const p=e=>{const t=t=>{const{innerWidth:s,innerHeight:n}=window,i={height:n||Infinity,width:s||Infinity,event:t};r(e,"windowResize").call(e,i)},s=e.disconnect.bind(e),n=()=>{window.addEventListener("resize",t),t()},i=()=>{window.removeEventListener("resize",t)};return Object.assign(e,{disconnect(){i(),s()}}),n(),[n,i]},v=(e,t=200)=>{let s=null;return function(){const n=arguments,i=this,a=()=>e.apply(i,n);s&&clearTimeout(s),s=setTimeout(a,t)}};class b extends n{constructor(){super(...arguments),this.boundHandler=this.handler.bind(this)}connect(){let e=this.element;e.style.resize="none",e.style.boxSizing="border-box",e.addEventListener("input",this.boundHandler),e.addEventListener("focus",this.boundHandler),p(this),requestAnimationFrame(this.boundHandler)}windowResize(){this.handler()}handler(){this.autosize(this.element)}autosize(e){let t=e.offsetHeight-e.clientHeight;e.style.height="auto",e.style.height=e.scrollHeight+t+"px"}}class f extends n{constructor(){super(...arguments),this.boundHandler=this.updateCharCount.bind(this)}connect(){this.updateCharCount(),this.inputTarget.addEventListener("input",this.boundHandler)}disconnect(){this.inputTarget.removeEventListener("input",this.boundHandler)}updateCharCount(){let e=this.inputTarget.value.length;this.outputTarget.innerText=e.toString(),this.hasErrorClass&&(this.isValidCount(e)?this.outputTarget.classList.remove(this.errorClass):this.outputTarget.classList.add(this.errorClass))}isValidCount(e){let t=0,s=99999;return this.hasMinValue&&(t=this.minValue),this.hasMaxValue&&(s=this.maxValue),e>=t&&e<=s}}f.targets=["input","output"],f.values={min:Number,max:Number},f.classes=["error"];class E extends n{constructor(){super(...arguments),this.supported=!1}connect(){this.supported=document.queryCommandSupported("copy"),this.hasRemoveUnusedValue&&this.removeUnusedValue&&(this.supported&&this.hasFallbackTarget?this.fallbackTarget.remove():this.hasCopyTarget&&this.copyTarget.remove())}select(e){e&&e.preventDefault(),this.sourceTarget.select()}copy(e){e&&e.preventDefault(),this.sourceTarget.select(),this.supported&&document.execCommand("copy")}}E.targets=["button","copy","fallback"],E.values={removeUnused:Boolean};class w extends n{connect(){let e=this.messageValue;window.onbeforeunload=()=>null==e||e,window.addEventListener("popstate",this.handlePopstate),window.addEventListener("submit",()=>{window.removeEventListener("popstate",this.handlePopstate),window.onbeforeunload=null})}handlePopstate(e){return!1}}w.values={message:String};class y extends n{connect(){console.log("Debug Controller",this,this.testTargets)}}y.targets=["test"];class V extends n{constructor(){super(...arguments),this.initialValue=null,this.boundHandler=this.handler.bind(this)}connect(){let e=this.element;this.initialValue=this.isInputElement(e)&&this.isCheckable(e)?e.checked:e.value,e.addEventListener("input",this.boundHandler),e.addEventListener("change",this.boundHandler)}disconnect(){let e=this.element;e.removeEventListener("input",this.boundHandler),e.removeEventListener("change",this.boundHandler)}restore(){let e=this.element;this.isInputElement(e)&&this.isCheckable(e)?e.checked=this.initialValue:e.value=this.initialValue}handler(e){let t=this.element;this.initialValue!==t.value?t.setAttribute("data-dirty","true"):t.removeAttribute("data-dirty")}isCheckable(e){return"radio"===e.type||"checkbox"===e.type}isInputElement(e){return"INPUT"===e.tagName}}class T extends n{connect(){this.toggle()}toggle(){this.hasDisablerTarget&&this.disablerTarget.checked?this.disableInputs():this.enableInputs()}disableInputs(){let e=this.hasClearValue&&this.clearValue;this.disableTargets.forEach((t,s)=>{e&&(t.value=""),t.disabled=!0})}enableInputs(){this.disableTargets.forEach((e,t)=>{e.disabled=!1})}}T.targets=["disabler","disable"],T.values={clear:Boolean};class C extends n{dismiss(){this.element.remove()}}class L extends n{connect(){((e,t={})=>{new m(this,t)})(0,{element:this.element,childList:!0}),this.checkEmpty()}mutate(e){this.checkEmpty()}checkEmpty(){let e;e=this.hasScopeSelectorValue?this.element.querySelectorAll(this.scopeSelectorValue):this.element.children,0===e.length?(this.hasNotEmptyClass&&this.notEmptyClass.split(" ").forEach(e=>this.element.classList.remove(e)),this.hasEmptyClass&&this.emptyClass.split(" ").forEach(e=>this.element.classList.add(e)),this.element.dispatchEvent(new CustomEvent("dom:empty",{bubbles:!0,cancelable:!0}))):(this.hasNotEmptyClass&&this.notEmptyClass.split(" ").forEach(e=>this.element.classList.add(e)),this.hasEmptyClass&&this.emptyClass.split(" ").forEach(e=>this.element.classList.remove(e)),this.element.dispatchEvent(new CustomEvent("dom:not-empty",{bubbles:!0,cancelable:!0,detail:{count:e.length}})))}}L.classes=["empty","notEmpty"],L.values={scopeSelector:String};class x extends n{connect(){this.toggle()}toggle(){this.hasEnablerTarget&&this.enablerTarget.checked?this.enableInputs():this.disableInputs()}disableInputs(){let e=this.hasClearValue&&this.clearValue;this.enableTargets.forEach((t,s)=>{e&&(t.value=""),t.disabled=!0})}enableInputs(){this.enableTargets.forEach((e,t)=>{e.disabled=!1})}}x.targets=["enabler","enable"],x.values={clear:Boolean};class S extends n{connect(){let e=this.element;e.onerror=()=>{this.hasPlaceholderValue?e.src=this.placeholderValue:e.style.display="none"}}}S.values={placeholder:String};class k extends i{connect(){this.options={element:this.element,threshold:.3},"IntersectionObserver"in window?[this.observe,this.unobserve]=((e,t={})=>{const{dispatchEvent:s,eventPrefix:n}=Object.assign({},c,t),i=(null==t?void 0:t.element)||e.element,a=e.disconnect.bind(e),h=new IntersectionObserver(t=>{const[a]=t;a.isIntersecting?(t=>{if(e.isVisible=!0,r(e,"appear").call(e,t),s){const s=l("appear",e,n),a=o(s,null,{controller:e,entry:t});i.dispatchEvent(a)}})(a):e.isVisible&&(t=>{if(e.isVisible=!1,r(e,"disappear").call(e,t),s){const s=l("disappear",e,n),a=o(s,null,{controller:e,entry:t});i.dispatchEvent(a)}})(a)},t),d=()=>{h.observe(i)},u=()=>{h.unobserve(i)};return Object.assign(e,{isVisible:!1,disconnect(){u(),a()}}),d(),[d,u]})(this,this.options):this.loadContent()}appear(e){let t=this.element;""===t.src&&e.target===t&&e.isIntersecting&&(this.loadContent(),this.unobserve&&this.unobserve())}}class H extends n{constructor(){super(...arguments),this.maxSelections=0,this.boundHandleInputs=this.handleInputs.bind(this)}connect(){this.inputTargets.forEach(e=>e.addEventListener("change",this.boundHandleInputs))}disconnect(){this.inputTargets.forEach(e=>e.removeEventListener("change",this.boundHandleInputs))}handleInputs(e){let t=this.inputTargets.reduce((e,t)=>t.checked?e+1:e,0),s=e.target;t>this.maxSelections?(e.preventDefault(),s.checked=!1,s.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!0})),s.dispatchEvent(new CustomEvent("limited-selection:too-many",{bubbles:!0,cancelable:!0,detail:{target:s}})),this.hasErrorTarget&&(this.errorTarget.innerHTML=this.messageValue)):(s.dispatchEvent(new CustomEvent("limited-selection:selection",{bubbles:!0,cancelable:!0,detail:{target:s}})),this.hasErrorTarget&&(this.errorTarget.innerHTML=""))}}H.targets=["input","error"],H.values={max:Number,message:String};class M extends n{get wrapperClass(){return this.hasWrapperSelectorValue?this.wrapperClassValue:"nested-fields"}get insertMode(){return this.hasInsertModeValue?this.insertModeValue:"beforeend"}connect(){this.checkStructure()}add(e){e&&e.preventDefault();const t=this.templateTarget.innerHTML.replace(/NEW_RECORD/g,this.generateID());this.targetTarget.insertAdjacentHTML(this.insertMode,t)}remove(e){e.preventDefault();const t=e.target.closest(this.wrapperClass);if(null==t)throw new Error(`#remove was clicked from outside of a child record. Could not find an ancestor with class ${this.wrapperClass}`);if("true"===t.dataset.newRecord)t.remove();else{t.style.display="none";let e=t.querySelector("input[name*='_destroy']");if(null==e)throw new Error("Could not find a hidden input with name '_destroy'. NestedForm cannot remove an already persisted record without it.");e.value="1"}}generateID(){return(new Date).getTime().toString()+Math.random()}checkStructure(){if(this.templateTarget.innerHTML.indexOf("NEW_RECORD"))throw new Error("Could not find 'NEW_RECORD' in the provided template. Please make sure you've passed `child_index: 'NEW_RECORD'` to `fields_for`")}}M.targets=["target","template"],M.values={insertMode:String,wrapperClass:String};class I extends n{constructor(){super(...arguments),this.boundCheckPasswordsMatch=this.checkPasswordsMatch.bind(this)}connect(){this.passwordTargets.forEach(e=>e.addEventListener("change",this.boundCheckPasswordsMatch))}disconnect(){this.passwordTargets.forEach(e=>e.removeEventListener("change",this.boundCheckPasswordsMatch))}allPasswordsMatch(){let e=new Set(this.passwordTargets.map(e=>e.value));return e.has("")||1==e.size}checkPasswordsMatch(){this.allPasswordsMatch()?(this.element.dispatchEvent(new CustomEvent("password-confirm:match")),this.hasErrorClass&&this.passwordTargets.forEach(e=>e.classList.remove(this.errorClass))):(this.element.dispatchEvent(new CustomEvent("password-confirm:no-match")),this.hasErrorClass&&this.passwordTargets.forEach(e=>e.classList.add(this.errorClass)))}}I.targets=["password"],I.classes=["error"];class O extends n{peak(e){e&&e.preventDefault(),this.passwordTarget.type="text"}hide(e){e&&e.preventDefault(),this.passwordTarget.type="password"}toggle(e){e&&e.preventDefault(),"password"===this.passwordTarget.type?this.peak():this.hide()}}O.targets=["password"];class D extends n{constructor(){super(...arguments),this.boundMessageReceived=this.messageReceived.bind(this)}connect(){window.addEventListener("message",this.boundMessageReceived)}disconnect(){window.removeEventListener("message",this.boundMessageReceived)}messageReceived(e){let t=e.data;t.hasOwnProperty("name")&&"iframe-body"===t.name&&t.hasOwnProperty("height")&&this.resize(t.height)}resize(e){this.element.style.height=`${e}px`}}class $ extends n{connect(){var e,t,s;window.self!==window.top&&(p(this),t={},null===(s=(e=this).constructor.debounces)||void 0===s||s.forEach(s=>{if("string"==typeof s&&(e[s]=v(e[s],null==t?void 0:t.wait)),"object"==typeof s){const{name:n,wait:i}=s;if(!n)return;e[n]=v(e[n],i||(null==t?void 0:t.wait))}}),this.postUpdate())}windowResize(e){this.postUpdate()}postUpdate(){let e={name:"iframe-body",height:this.getHeight()};window.parent.postMessage(e,"*")}getHeight(){const e=document.body,t=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,t.clientHeight,t.scrollHeight,t.offsetHeight)}}$.debounces=["postUpdate"];class R extends n{cleanupSelf(){this.cleanup(this.element)}cleanup(e){var s,n,i;e.dataset.controller=(null==(s=e.dataset.controller)?void 0:s.replaceAll(new RegExp(`(s|^)${this.identifier}(s|$)`,"g"),""))||"",""==e.dataset.controller&&delete e.dataset.controller;let a=new RegExp(`(s|^)${this.identifier}\\..+?(s|$)`,"g");e.dataset.target=(null==(n=e.dataset.target)?void 0:n.replaceAll(a,""))||"",delete e.dataset[t(`${this.identifier}-target`)],""==e.dataset.target&&delete e.dataset.target,e.dataset.action=(null==(i=e.dataset.target)?void 0:i.replaceAll(a,""))||"",delete e.dataset[t(`${this.identifier}-action`)],""==e.dataset.action&&delete e.dataset.action;let r=this.constructor.values;r&&Object.keys(r).forEach(s=>delete e.dataset[t(`${this.identifier}-${s}-value`)]);let l=this.constructor.classes;l&&Object.keys(l).forEach(s=>delete e.dataset[t(`${this.identifier}-${s}-class`)])}}const A="scrollBehavior"in document.documentElement.style;let P;async function j(e,{behavior:t="smooth",block:s="start",inline:n="nearest"}={}){"smooth"!=t||A||await async function(){const{polyfill:e}=await import("smoothscroll-polyfill");P||(P=!0,e())}(),e.scrollIntoView({behavior:t,block:s,inline:n})}function N(e){if(!e)return null;const t=getComputedStyle(e).overflowY;return"visible"!==t&&"hidden"!==t&&e.scrollHeight>=e.clientHeight?e:N(e.parentElement)||document.body}class W extends R{connect(){requestAnimationFrame(()=>{j(this.element,{behavior:this.hasBehaviorValue?this.behaviorValue:"smooth",block:this.hasBlockValue?this.blockValue:"center",inline:this.hasInlineValue?this.inlineValue:"center"}).catch(()=>this.element.scrollIntoView()),this.cleanupSelf()})}}W.values={behavior:String,block:String,inline:String};class z extends n{scroll(e){let t;e&&e.preventDefault(),t="document"==(this.hasModeValue?this.modeValue:"document")?document.body:N(this.element),null!=t&&j(t,{behavior:"smooth",block:"end"}).catch(()=>t.scrollIntoView(!1))}}z.values={mode:String};class B extends n{scroll(){let e=document.querySelector(this.selectorValue);e?j(e,{behavior:this.hasBehaviorValue?this.behaviorValue:"smooth",block:this.hasBlockValue?this.blockValue:"center",inline:this.hasInlineValue?this.inlineValue:"center"}).catch(()=>e.scrollIntoView()):console.warn(`Could not find target for '${this.selectorValue}'`)}}B.values={selector:String,behavior:String,block:String,inline:String};class F extends n{scroll(e){let t;e&&e.preventDefault(),t="document"==(this.hasModeValue?this.modeValue:"document")?document.body:N(this.element),null!=t&&j(t,{behavior:"smooth",block:"start"}).catch(()=>t.scrollIntoView(!1))}}F.values={mode:String};class q extends n{constructor(){super(...arguments),this.timeout=null}connect(){requestAnimationFrame(()=>{this.timeout=setTimeout(()=>this.element.remove(),1e3*this.secondsValue)})}disconnect(){this.timeout&&clearTimeout(this.timeout)}}q.values={seconds:Number};class U extends R{connect(){if(!this.hasInsertValue)throw new Error("`insert` value was not specified");requestAnimationFrame(()=>{this.hasImmediateValue&&this.immediateValue&&this.execute()})}execute(e){e&&e.preventDefault();let t=document.querySelector(this.targetValue);if(null==t)return void this.element.dispatchEvent(new CustomEvent("teleport:error",{bubbles:!0,cancelable:!0}));let s=this.element.cloneNode(!0);switch(this.cleanup(s),this.insertValue){case"beforebegin":case"beforeend":case"afterend":case"afterbegin":t.insertAdjacentHTML(this.insertValue,s.outerHTML);break;case"replaceOuter":t.outerHTML=s.outerHTML;break;case"replaceInner":t.innerHTML=s.outerHTML;break;case"prepend":t.insertAdjacentHTML("afterbegin",s.outerHTML);break;case"append":t.insertAdjacentHTML("beforeend",s.outerHTML);break;default:throw new Error("`insert` value was not specified")}this.element.remove()}}U.values={target:String,insert:String,immediate:Boolean};class _ extends n{connect(){if(!this.hasClassValue)throw new Error("data-toggle-class-class-value must not be empty");(this.hasMouseEnterValue||this.hasMouseLeaveValue)&&((e,t={})=>{new g(this,t)})(),this.hasClickAwayValue&&this.clickAwayValue&&((e,t={})=>{const{onlyVisible:s,dispatchEvent:n,events:i,eventPrefix:a}=Object.assign({},h,t),r=i=>{const r=(null==t?void 0:t.element)||e.element;if(!(r.contains(i.target)||!function(e){const t=e.getBoundingClientRect(),s=window.innerHeight||document.documentElement.clientHeight,n=window.innerWidth||document.documentElement.clientWidth;return t.top<=s&&t.top+t.height>=0&&t.left<=n&&t.left+t.width>=0}(r)&&s)&&(e.clickOutside&&e.clickOutside(i),n)){const t=l("click:outside",e,a),s=o(t,i,{controller:e});r.dispatchEvent(s)}},c=e.disconnect.bind(e);Object.assign(e,{disconnect(){null==i||i.forEach(e=>{window.removeEventListener(e,r,!1)}),c()}}),null==i||i.forEach(e=>{window.addEventListener(e,r,!1)})})(this),requestAnimationFrame(()=>{this.hasInitialValue&&this.toggleTargets.forEach("on"===this.initialValue?e=>this.elementOn(e):e=>this.elementOff(e))})}clickOutside(){this.toggleTargets.forEach(e=>{this.elementWasToggled(e)&&(this.elementToggleStatus(e),this.elementToggle(e))})}mouseEnter(){if(this.hasMouseEnterValue)switch(this.mouseEnterValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle()}return{}}mouseLeave(){if(this.hasMouseLeaveValue)switch(this.mouseLeaveValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle()}return{}}on(e){this.toggleTargets.forEach(e=>{this.elementToggleStatus(e),this.elementOn(e)})}off(e){this.toggleTargets.forEach(e=>{this.elementToggleStatus(e),this.elementOff(e)})}toggle(e){this.toggleTargets.forEach(e=>{this.elementToggleStatus(e),this.elementToggle(e)})}elementWasToggled(e){return"true"==e.dataset.toggled}elementToggleStatus(e){this.elementWasToggled(e)?delete e.dataset.toggled:e.dataset.toggled="true"}elementToggle(e){this.classValue.split(" ").forEach(t=>e.classList.toggle(t))}elementOn(e){this.classValue.split(" ").forEach(t=>e.classList.toggle(t,!0))}elementOff(e){this.classValue.split(" ").forEach(t=>e.classList.toggle(t,!1))}}_.targets=["toggle"],_.values={class:String,mouseEnter:String,mouseLeave:String,clickAway:Boolean,initial:String};class Y extends n{toggle(e){e&&e.preventDefault();let t=this.getFrame().src;null==t||t!==this.getSrc()?this.setSrc():this.clear()}setSrc(e){e&&e.preventDefault();let t=this.getFrame();this.hasLoadingMessageValue&&(t.innerHTML=this.loadingMessageValue),t.src=this.getSrc()}clear(e){e&&e.preventDefault();let t=this.getFrame();t.src="",t.innerHTML=""}getFrame(){let e=document.getElementById(`${this.frameIdValue}`);if(null==e)throw new Error(`Could not find frame with ID '${this.frameIdValue}'`);if("TURBO-FRAME"!=e.nodeName)throw new Error(`Element targeted by ID '${this.frameIdValue}'`);return e}getSrc(){let e=this.element;if(this.hasSrcValue)return this.srcValue;if(function(e){return"A"==e.nodeName}(e))return e.href;throw new Error("No link given to drive frame to")}}Y.values={frameId:String,src:String,loadingMessage:String};class G extends n{constructor(){super(...arguments),this.boundHandler=this.updateWordCount.bind(this)}connect(){this.updateWordCount(),this.inputTarget.addEventListener("input",this.boundHandler)}disconnect(){this.inputTarget.removeEventListener("input",this.boundHandler)}updateWordCount(){let e=0,t=this.inputTarget.value.match(/\S+/g);e=t&&t.length||0,this.outputTarget.innerText=e.toString(),this.hasErrorClass&&(this.isValidCount(e)?this.outputTarget.classList.remove(this.errorClass):this.outputTarget.classList.add(this.errorClass))}isValidCount(e){let t=0,s=99999;return this.hasMinValue&&(t=this.minValue),this.hasMaxValue&&(s=this.maxValue),e>=t&&e<=s}}G.targets=["input","output"],G.values={min:Number,max:Number},G.classes=["error"];export{i as AsyncBlockController,a as AutoSubmitFormController,b as AutosizeController,f as CharCountController,E as ClipboardController,w as ConfirmNavigationController,y as DebugController,V as DetectDirtyController,T as DisableInputsController,C as DismissableController,L as EmptyDomController,x as EnableInputsController,S as FallbackImageController,k as LazyBlockController,H as LimitedSelectionCheckboxesController,M as NestedFormController,I as PasswordConfirmController,O as PasswordPeekController,$ as ResponsiveIframeBodyController,D as ResponsiveIframeWrapperController,W as ScrollIntoFocusController,z as ScrollToBottomController,B as ScrollToController,F as ScrollToTopController,q as SelfDestructController,U as TeleportController,_ as ToggleClassController,Y as TurboFrameRCController,G as WordCountController}; //# sourceMappingURL=stimulus-library.modern.js.map diff --git a/dist/stimulus-library.modern.js.map b/dist/stimulus-library.modern.js.map index 0fee86f8..7126f291 100644 --- a/dist/stimulus-library.modern.js.map +++ b/dist/stimulus-library.modern.js.map @@ -1 +1 @@ -{"version":3,"file":"stimulus-library.modern.js","sources":["../src/base_controller.ts","../src/async_block_controller.ts","../src/auto_submit_form_controller.ts","../node_modules/stimulus-use/dist/support/index.js","../node_modules/stimulus-use/dist/use-intersection/use-intersection.js","../node_modules/stimulus-use/dist/use-click-outside/use-click-outside.js","../node_modules/stimulus-use/dist/stimulus_use.js","../node_modules/stimulus-use/dist/use-hover/use-hover.js","../node_modules/stimulus-use/dist/use-mutation/use-mutation.js","../node_modules/stimulus-use/dist/use-window-resize/use-window-resize.js","../node_modules/stimulus-use/dist/use-debounce/use-debounce.js","../src/autosize_controller.ts","../src/char_count_controller.ts","../src/clipboard_controller.ts","../src/confirm_navigation_controller.ts","../src/debug_controller.ts","../src/detect_dirty_controller.ts","../src/disable_inputs_controller.ts","../src/dismissable_controller.ts","../src/empty_dom_controller.ts","../src/enable_inputs_controller.ts","../src/fallback_image_controller.ts","../src/lazy_block_controller.ts","../src/limited_selection_checkboxes_controller.ts","../src/password_confirm_controller.ts","../src/password_peek_controller.ts","../src/responsive_iframe_controller.ts","../src/utilities/ephemeral_controller.ts","../src/utilities/scroll.ts","../src/scroll_into_focus_controller.ts","../src/scroll_to_bottom_controller.ts","../src/scroll_to_controller.ts","../src/scroll_to_top_controller.ts","../src/self_destruct_controller.ts","../src/teleport_controller.ts","../src/toggle_class_controller.ts","../src/turbo_frame_rc_controller.ts","../src/utilities/turbo.ts","../src/utilities/elements.ts","../src/word_count_controller.ts"],"sourcesContent":["import {Context, Controller} from \"stimulus\";\r\n\r\nexport class BaseController extends Controller {\r\n\r\n constructor(context: Context) {\r\n super(context);\r\n return new Proxy(this, {\r\n get: (obj, prop) => {\r\n let returnVal = Reflect.get(obj, prop);\r\n let self = this;\r\n if (logProperty(prop.toString())) {\r\n if (typeof returnVal == \"function\") {\r\n return new Proxy(returnVal, {\r\n apply(target: any, thisArg: any, argArray?: any): any {\r\n self.log(prop.toString(), {\r\n args: argArray,\r\n });\r\n return Reflect.apply(target, thisArg, argArray);\r\n },\r\n });\r\n } else {\r\n this.log(prop.toString());\r\n }\r\n }\r\n return returnVal;\r\n },\r\n });\r\n }\r\n\r\n log(functionName: string, args: {} = {}): void {\r\n // @ts-ignore\r\n if (!this.application.debug) {\r\n return;\r\n }\r\n let logger = console;\r\n logger.groupCollapsed(`%c${this.identifier} %c#${functionName}`, \"color: #3B82F6\", \"color: unset\");\r\n logger.log({\r\n element: this.element,\r\n ...args,\r\n });\r\n logger.groupEnd();\r\n }\r\n\r\n}\r\n\r\nfunction logProperty(prop: string): boolean {\r\n switch (prop) {\r\n case \"application\":\r\n case \"element\":\r\n case \"constructor\":\r\n case \"initialize\":\r\n case \"log\":\r\n case \"data\":\r\n case \"valueDescriptorMap\":\r\n case \"identifier\":\r\n return false;\r\n }\r\n\r\n if (/^.*?Target(s)?$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?Value$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?ValueChanged$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?Class$/.test(prop)) {\r\n return false;\r\n }\r\n\r\n return true;\r\n}\r\n","import {BaseController} from \"./base_controller\";\n\nexport class AsyncBlockController extends BaseController {\n static targets = [\"replace\"];\n static values = {endpoint: String};\n\n declare readonly replaceTarget: HTMLElement;\n declare readonly hasReplaceTarget: boolean;\n declare readonly endpointValue: string;\n\n\n // This is a simple controller to load a block of content when the page loads.\n // It should be used to give a quick initial response before calling out to an\n // an AJAX endpoint to do some expensive work.\n connect() {\n this.loadContent();\n }\n\n loadContent() {\n let el = (this.hasReplaceTarget ? this.replaceTarget : this.element) as HTMLElement;\n fetch(this.endpointValue)\n .then((response) => response.text())\n .then((html) => {\n let newEl = document.createElement(\"div\");\n newEl.innerHTML = html;\n el.replaceWith(newEl);\n\n // Trigger event to show block has loaded\n let event = new CustomEvent(\"ajax:success\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n })\n .catch(err => {\n el.replaceWith(\"Sorry, this content failed to load\");\n\n let event = new CustomEvent(\"ajax:error\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n })\n .finally(() => {\n let event = new CustomEvent(\"ajax:complete\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n });\n }\n}\n","import {BaseController} from \"./base_controller\";\n\nexport class AutoSubmitFormController extends BaseController {\n\n private boundHandler = this.handler.bind(this);\n\n connect() {\n (this.element as HTMLElement).querySelectorAll(\"input, select, textarea\").forEach(el => el.addEventListener(\"change\", this.boundHandler));\n }\n\n disconnect() {\n (this.element as HTMLElement).querySelectorAll(\"input, select, textarea\").forEach(el => el.removeEventListener(\"change\", this.boundHandler));\n }\n\n private handler(e: Event) {\n // this.element.submit()\n // Moved to this to support remote forms and CSRF properly\n this.element.dispatchEvent(\n new CustomEvent(\"submit\", {\n bubbles: true,\n cancelable: true,\n }),\n );\n }\n}\n","export const method = (controller, methodName) => {\n const method = controller[methodName];\n if (typeof method == 'function') {\n return method;\n }\n else {\n return (...args) => { };\n }\n};\nexport const composeEventName = (name, controller, eventPrefix) => {\n let composedName = name;\n if (eventPrefix === true) {\n composedName = `${controller.identifier}:${name}`;\n }\n else if (typeof eventPrefix === 'string') {\n composedName = `${eventPrefix}:${name}`;\n }\n return composedName;\n};\nexport const extendedEvent = (type, event, detail) => {\n const { bubbles, cancelable, composed } = event || { bubbles: true, cancelable: true, composed: true };\n if (event) {\n Object.assign(detail, { originalEvent: event });\n }\n const customEvent = new CustomEvent(type, {\n bubbles,\n cancelable,\n composed,\n detail,\n });\n return customEvent;\n};\nexport function isElementInViewport(el) {\n const rect = el.getBoundingClientRect();\n const windowHeight = (window.innerHeight || document.documentElement.clientHeight);\n const windowWidth = (window.innerWidth || document.documentElement.clientWidth);\n const vertInView = (rect.top <= windowHeight) && ((rect.top + rect.height) >= 0);\n const horInView = (rect.left <= windowWidth) && ((rect.left + rect.width) >= 0);\n return (vertInView && horInView);\n}\n//# sourceMappingURL=index.js.map","import { method, extendedEvent, composeEventName } from '../support/index';\nconst defaultOptions = {\n dispatchEvent: true,\n eventPrefix: true,\n};\nexport const useIntersection = (controller, options = {}) => {\n const { dispatchEvent, eventPrefix } = Object.assign({}, defaultOptions, options);\n const targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n const callback = (entries) => {\n const [entry] = entries;\n if (entry.isIntersecting) {\n dispatchAppear(entry);\n }\n else if (controller.isVisible) {\n dispatchDisappear(entry);\n }\n };\n const dispatchAppear = (entry) => {\n controller.isVisible = true;\n method(controller, 'appear').call(controller, entry);\n // emit a custom \"appear\" event\n if (dispatchEvent) {\n const eventName = composeEventName('appear', controller, eventPrefix);\n const appearEvent = extendedEvent(eventName, null, { controller, entry });\n targetElement.dispatchEvent(appearEvent);\n }\n };\n const dispatchDisappear = (entry) => {\n controller.isVisible = false;\n method(controller, 'disappear').call(controller, entry);\n // emit a custom \"disappear\" event\n if (dispatchEvent) {\n const eventName = composeEventName('disappear', controller, eventPrefix);\n const disappearEvent = extendedEvent(eventName, null, { controller, entry });\n targetElement.dispatchEvent(disappearEvent);\n }\n };\n // keep a copy of the current disconnect() function of the controller\n // to support composing several behaviors\n const controllerDisconnect = controller.disconnect.bind(controller);\n const observer = new IntersectionObserver(callback, options);\n const observe = () => {\n observer.observe(targetElement);\n };\n const unobserve = () => {\n observer.unobserve(targetElement);\n };\n Object.assign(controller, {\n isVisible: false,\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-intersection.js.map","import { composeEventName, extendedEvent, isElementInViewport } from '../support/index';\nconst defaultOptions = {\n events: ['click', 'touchend'],\n onlyVisible: true,\n dispatchEvent: true,\n eventPrefix: true,\n};\nexport const useClickOutside = (controller, options = {}) => {\n const { onlyVisible, dispatchEvent, events, eventPrefix } = Object.assign({}, defaultOptions, options);\n const onEvent = (event) => {\n const targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n if (targetElement.contains(event.target) || (!isElementInViewport(targetElement) && onlyVisible)) {\n return;\n }\n // call the clickOutside method of the Stimulus controller\n if (controller.clickOutside) {\n controller.clickOutside(event);\n }\n // emit a custom event\n if (dispatchEvent) {\n const eventName = composeEventName('click:outside', controller, eventPrefix);\n const clickOutsideEvent = extendedEvent(eventName, event, { controller });\n targetElement.dispatchEvent(clickOutsideEvent);\n }\n };\n const observe = () => {\n events === null || events === void 0 ? void 0 : events.forEach(event => {\n window.addEventListener(event, onEvent, false);\n });\n };\n const unobserve = () => {\n events === null || events === void 0 ? void 0 : events.forEach(event => {\n window.removeEventListener(event, onEvent, false);\n });\n };\n // keep a copy of the current disconnect() function of the controller\n // to support composing several behaviors\n const controllerDisconnect = controller.disconnect.bind(controller);\n Object.assign(controller, {\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-click-outside.js.map","const defaultOptions = {\n debug: false,\n logger: console\n};\nexport class StimulusUse {\n constructor(controller, options = {}) {\n var _a, _b, _c;\n this.log = (functionName, args) => {\n if (!this.debug)\n return;\n this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${functionName}`, 'color: #3B82F6', 'color: unset');\n this.logger.log(Object.assign({ controllerId: this.controllerId }, args));\n this.logger.groupEnd();\n };\n this.debug = (_b = (_a = options === null || options === void 0 ? void 0 : options.debug) !== null && _a !== void 0 ? _a : controller.application.stimulusUseDebug) !== null && _b !== void 0 ? _b : defaultOptions.debug;\n this.logger = (_c = options === null || options === void 0 ? void 0 : options.logger) !== null && _c !== void 0 ? _c : defaultOptions.logger;\n this.controller = controller;\n this.controllerId = controller.element.id || controller.element.dataset.id;\n // make copies of lifecycle functions\n this.controllerInitialize = controller.initialize.bind(controller);\n this.controllerConnect = controller.connect.bind(controller);\n this.controllerDisconnect = controller.disconnect.bind(controller);\n }\n}\n//# sourceMappingURL=stimulus_use.js.map","import { StimulusUse } from '../stimulus_use';\nimport { method } from '../support/index';\nexport class UseHover extends StimulusUse {\n constructor(controller, options = {}) {\n super(controller, options);\n this.observe = () => {\n this.targetElement.addEventListener('mouseenter', this.onEnter);\n this.targetElement.addEventListener('mouseleave', this.onLeave);\n };\n this.unobserve = () => {\n this.targetElement.removeEventListener('mouseenter', this.onEnter);\n this.targetElement.removeEventListener('mouseleave', this.onLeave);\n };\n this.onEnter = () => {\n method(this.controller, 'mouseEnter').call(this.controller);\n this.log('mouseEnter', { hover: true });\n };\n this.onLeave = () => {\n method(this.controller, 'mouseLeave').call(this.controller);\n this.log('mouseLeave', { hover: false });\n };\n this.targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n this.controller = controller;\n this.enhanceController();\n this.observe();\n }\n enhanceController() {\n const controllerDisconnect = this.controller.disconnect.bind(this.controller);\n const disconnect = () => {\n this.unobserve();\n controllerDisconnect();\n };\n Object.assign(this.controller, { disconnect });\n }\n}\nexport const useHover = (controller, options = {}) => {\n const observer = new UseHover(controller, options);\n return [observer.observe, observer.unobserve];\n};\n//# sourceMappingURL=use-hover.js.map","import { StimulusUse } from '../stimulus_use';\nimport { method } from '../support/index';\nexport class UseMutation extends StimulusUse {\n constructor(controller, options = {}) {\n super(controller, options);\n this.observe = () => {\n try {\n this.observer.observe(this.targetElement, this.options);\n }\n catch (error) {\n this.controller.application.handleError(error, \"At a minimum, one of childList, attributes, and/or characterData must be true\", {});\n }\n };\n this.unobserve = () => {\n this.observer.disconnect();\n };\n this.mutation = (entries) => {\n method(this.controller, 'mutate').call(this.controller, entries);\n this.log('mutate', { entries });\n };\n this.targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n this.controller = controller;\n this.options = options;\n this.observer = new MutationObserver(this.mutation);\n this.enhanceController();\n this.observe();\n }\n enhanceController() {\n const controllerDisconnect = this.controller.disconnect.bind(this.controller);\n const disconnect = () => {\n this.unobserve();\n controllerDisconnect();\n };\n Object.assign(this.controller, { disconnect });\n }\n}\nexport const useMutation = (controller, options = {}) => {\n const observer = new UseMutation(controller, options);\n return [observer.observe, observer.unobserve];\n};\n//# sourceMappingURL=use-mutation.js.map","import { method } from '../support/index';\nexport const useWindowResize = (controller) => {\n const callback = (event) => {\n const { innerWidth, innerHeight } = window;\n const payload = {\n height: innerHeight || Infinity,\n width: innerWidth || Infinity,\n event\n };\n method(controller, 'windowResize').call(controller, payload);\n };\n const controllerDisconnect = controller.disconnect.bind(controller);\n const observe = () => {\n window.addEventListener('resize', callback);\n callback();\n };\n const unobserve = () => {\n window.removeEventListener('resize', callback);\n };\n Object.assign(controller, {\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-window-resize.js.map","import { Controller } from 'stimulus';\nclass DebounceController extends Controller {\n}\nDebounceController.debounces = [];\nconst defaultWait = 200;\nconst debounce = (fn, wait = defaultWait) => {\n let timeoutId = null;\n return function () {\n const args = arguments;\n const context = this;\n const callback = () => fn.apply(context, args);\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n timeoutId = setTimeout(callback, wait);\n };\n};\nexport const useDebounce = (controller, options) => {\n var _a;\n const constructor = controller.constructor;\n (_a = constructor.debounces) === null || _a === void 0 ? void 0 : _a.forEach((func) => {\n if (typeof func === \"string\") {\n controller[func] = debounce(controller[func], options === null || options === void 0 ? void 0 : options.wait);\n }\n if (typeof func === \"object\") {\n const { name, wait } = func;\n if (!name)\n return;\n controller[name] = debounce(controller[name], wait || (options === null || options === void 0 ? void 0 : options.wait));\n }\n });\n};\n//# sourceMappingURL=use-debounce.js.map","import {useWindowResize} from \"stimulus-use\";\nimport {BaseController} from \"./base_controller\";\n\nexport class AutosizeController extends BaseController {\n\n private boundHandler = this.handler.bind(this);\n\n connect() {\n let target = this.element as HTMLTextAreaElement;\n target.style.resize = \"none\";\n target.style.boxSizing = \"border-box\";\n target.addEventListener(\"input\", this.boundHandler);\n target.addEventListener(\"focus\", this.boundHandler);\n useWindowResize(this);\n requestAnimationFrame(this.boundHandler);\n }\n\n windowResize() {\n this.handler();\n }\n\n private handler() {\n this.autosize(this.element as HTMLTextAreaElement);\n };\n\n private autosize(element: HTMLTextAreaElement) {\n let offset = element.offsetHeight - element.clientHeight;\n element.style.height = \"auto\";\n element.style.height = element.scrollHeight + offset + \"px\";\n }\n\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class CharCountController extends BaseController {\r\n\r\n static targets = [\"input\", \"output\"];\r\n static values = {min: Number, max: Number};\r\n static classes = [\"error\"];\r\n\r\n declare readonly inputTarget: HTMLInputElement | HTMLTextAreaElement;\r\n declare readonly outputTarget: HTMLElement;\r\n declare minValue: number;\r\n declare hasMinValue: boolean;\r\n declare maxValue: number;\r\n declare hasMaxValue: boolean;\r\n declare errorClass: string;\r\n declare hasErrorClass: boolean;\r\n\r\n boundHandler = this.updateCharCount.bind(this);\r\n\r\n connect() {\r\n this.updateCharCount();\r\n this.inputTarget.addEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n this.inputTarget.removeEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n updateCharCount() {\r\n let charCount = this.inputTarget.value.length;\r\n this.outputTarget.innerText = charCount.toString();\r\n if (this.hasErrorClass) {\r\n if (this.isValidCount(charCount)) {\r\n this.outputTarget.classList.remove(this.errorClass);\r\n } else {\r\n this.outputTarget.classList.add(this.errorClass);\r\n }\r\n }\r\n }\r\n\r\n isValidCount(count: number) {\r\n let min = 0;\r\n let max = 99999;\r\n\r\n if (this.hasMinValue) {\r\n min = this.minValue;\r\n }\r\n\r\n if (this.hasMaxValue) {\r\n max = this.maxValue;\r\n }\r\n\r\n return count >= min && count <= max;\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class ClipboardController extends BaseController {\r\n\r\n static targets = [\"button\", \"copy\", \"fallback\"];\r\n static values = {removeUnused: Boolean};\r\n\r\n declare readonly sourceTarget: HTMLElement;\r\n declare readonly copyTarget: HTMLElement;\r\n declare readonly hasCopyTarget: boolean;\r\n declare readonly fallbackTarget: HTMLElement;\r\n declare readonly hasFallbackTarget: boolean;\r\n\r\n declare readonly hasRemoveUnusedValue: boolean;\r\n declare readonly removeUnusedValue: boolean;\r\n\r\n supported = false;\r\n\r\n connect() {\r\n this.supported = document.queryCommandSupported(\"copy\");\r\n\r\n if (this.hasRemoveUnusedValue && this.removeUnusedValue) {\r\n if (this.supported && this.hasFallbackTarget) {\r\n this.fallbackTarget.remove();\r\n } else if (this.hasCopyTarget) {\r\n this.copyTarget.remove();\r\n }\r\n }\r\n }\r\n\r\n select(event: MouseEvent) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n (this.sourceTarget as HTMLInputElement | HTMLTextAreaElement).select();\r\n }\r\n\r\n copy(event: ClipboardEvent) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n (this.sourceTarget as HTMLInputElement | HTMLTextAreaElement).select();\r\n if (this.supported) {\r\n document.execCommand(\"copy\");\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\n\nexport class ConfirmNavigationController extends BaseController {\n\n static values = {message: String};\n\n declare readonly messageValue: string;\n\n connect() {\n let confirmMessage = this.messageValue;\n window.onbeforeunload = () => (confirmMessage == null ? true : confirmMessage);\n window.addEventListener(\"popstate\", this.handlePopstate);\n window.addEventListener(\"submit\", () => {\n window.removeEventListener(\"popstate\", this.handlePopstate);\n window.onbeforeunload = null;\n });\n // TODO: Turbo navigation events\n }\n\n handlePopstate(event: PopStateEvent) {\n return false;\n }\n\n}\n","import {BaseController} from \"./base_controller\";\n\nexport class DebugController extends BaseController {\n\n static targets = [\"test\"];\n declare testTargets: HTMLElement[];\n\n connect() {\n console.log(\"Debug Controller\", this, this.testTargets);\n }\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DetectDirtyController extends BaseController {\r\n\r\n initialValue: string | boolean | null = null;\r\n\r\n boundHandler = this.handler.bind(this);\r\n\r\n connect() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n if (this.isInputElement(element) && this.isCheckable(element)) {\r\n this.initialValue = element.checked;\r\n } else {\r\n this.initialValue = element.value;\r\n }\r\n element.addEventListener(\"input\", this.boundHandler);\r\n element.addEventListener(\"change\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n element.removeEventListener(\"input\", this.boundHandler);\r\n element.removeEventListener(\"change\", this.boundHandler);\r\n }\r\n\r\n restore() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n if (this.isInputElement(element) && this.isCheckable(element)) {\r\n element.checked = this.initialValue as boolean;\r\n } else {\r\n element.value = this.initialValue as string;\r\n }\r\n }\r\n\r\n private handler(event?: Event) {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n\r\n if (this.initialValue !== element.value) {\r\n element.setAttribute(\"data-dirty\", \"true\");\r\n } else {\r\n element.removeAttribute(\"data-dirty\");\r\n }\r\n }\r\n\r\n private isCheckable(element: HTMLInputElement): boolean {\r\n return (element.type === \"radio\" || element.type === \"checkbox\");\r\n }\r\n\r\n private isInputElement(element: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement): element is HTMLInputElement {\r\n return element.tagName === \"INPUT\";\r\n }\r\n\r\n}\r\n\r\nexport function isDirty(element: HTMLElement) {\r\n return element.hasAttribute(\"data-dirty\");\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DisableInputsController extends BaseController {\r\n\r\n static targets = [\"disabler\", \"disable\"];\r\n\r\n static values = {\r\n clear: Boolean,\r\n };\r\n\r\n declare readonly hasDisablerTarget: boolean;\r\n declare readonly disablerTarget: HTMLInputElement;\r\n declare readonly disableTargets: Array;\r\n declare readonly clearValue: boolean;\r\n declare readonly hasClearValue: boolean;\r\n\r\n connect() {\r\n this.toggle();\r\n }\r\n\r\n toggle() {\r\n if (this.hasDisablerTarget && this.disablerTarget.checked) {\r\n this.disableInputs();\r\n } else {\r\n this.enableInputs();\r\n }\r\n }\r\n\r\n disableInputs() {\r\n let shouldClear = this.hasClearValue && this.clearValue;\r\n this.disableTargets.forEach((el, _) => {\r\n if (shouldClear) {\r\n el.value = \"\";\r\n }\r\n el.disabled = true;\r\n });\r\n }\r\n\r\n enableInputs() {\r\n this.disableTargets.forEach((el, _) => {\r\n el.disabled = false;\r\n });\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DismissableController extends BaseController {\r\n\r\n\r\n dismiss() {\r\n this.element.remove();\r\n }\r\n\r\n}\r\n","import {useMutation} from \"stimulus-use\";\r\nimport {BaseController} from \"./base_controller\";\r\n\r\nexport class EmptyDomController extends BaseController {\r\n\r\n static classes = [\"empty\", \"notEmpty\"];\r\n static values = {scopeSelector: String};\r\n\r\n declare hasEmptyClass: boolean;\r\n declare emptyClass: string;\r\n declare hasNotEmptyClass: boolean;\r\n declare notEmptyClass: string;\r\n\r\n declare hasScopeSelectorValue: boolean;\r\n declare scopeSelectorValue: string;\r\n\r\n connect() {\r\n useMutation(this, {element: this.element, childList: true});\r\n this.checkEmpty();\r\n }\r\n\r\n mutate(entries: MutationRecord[]) {\r\n this.checkEmpty();\r\n }\r\n\r\n checkEmpty() {\r\n let children;\r\n if (this.hasScopeSelectorValue) {\r\n children = this.element.querySelectorAll(this.scopeSelectorValue);\r\n } else {\r\n children = this.element.children;\r\n }\r\n\r\n if (children.length === 0) {\r\n if (this.hasNotEmptyClass) {\r\n let classes = this.notEmptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.remove(klass));\r\n }\r\n if (this.hasEmptyClass) {\r\n let classes = this.emptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.add(klass));\r\n }\r\n this.element.dispatchEvent(\r\n new CustomEvent(\"dom:empty\", {\r\n bubbles: true,\r\n cancelable: true,\r\n }),\r\n );\r\n } else {\r\n if (this.hasNotEmptyClass) {\r\n let classes = this.notEmptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.add(klass));\r\n }\r\n if (this.hasEmptyClass) {\r\n let classes = this.emptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.remove(klass));\r\n }\r\n this.element.dispatchEvent(\r\n new CustomEvent(\"dom:not-empty\", {\r\n bubbles: true,\r\n cancelable: true,\r\n detail: {\r\n count: children.length,\r\n },\r\n }),\r\n );\r\n }\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class EnableInputsController extends BaseController {\r\n\r\n static targets = [\"enabler\", \"enable\"];\r\n\r\n static values = {\r\n clear: Boolean,\r\n };\r\n\r\n declare readonly hasEnablerTarget: boolean;\r\n declare readonly enablerTarget: HTMLInputElement;\r\n declare readonly enableTargets: Array;\r\n declare readonly clearValue: boolean;\r\n declare readonly hasClearValue: boolean;\r\n\r\n connect() {\r\n this.toggle();\r\n }\r\n\r\n toggle() {\r\n if (this.hasEnablerTarget && this.enablerTarget.checked) {\r\n this.enableInputs();\r\n } else {\r\n this.disableInputs();\r\n }\r\n }\r\n\r\n disableInputs() {\r\n let shouldClear = this.hasClearValue && this.clearValue;\r\n this.enableTargets.forEach((el, _) => {\r\n if (shouldClear) {\r\n el.value = \"\";\r\n }\r\n el.disabled = true;\r\n });\r\n }\r\n\r\n enableInputs() {\r\n this.enableTargets.forEach((el, _) => {\r\n el.disabled = false;\r\n });\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class FallbackImageController extends BaseController {\r\n\r\n static values = {placeholder: String};\r\n\r\n declare readonly placeholderValue: string;\r\n declare readonly hasPlaceholderValue: boolean;\r\n\r\n connect() {\r\n let element = this.element as HTMLImageElement;\r\n\r\n element.onerror = () => {\r\n if (this.hasPlaceholderValue) {\r\n element.src = this.placeholderValue;\r\n } else {\r\n element.style.display = \"none\";\r\n }\r\n };\r\n }\r\n\r\n}\r\n","import {useIntersection} from \"stimulus-use\";\nimport {IntersectionOptions} from \"stimulus-use/dist/use-intersection/use-intersection\";\nimport {AsyncBlockController} from \"./async_block_controller\";\n\nexport class LazyBlockController extends AsyncBlockController {\n\n declare observe: () => void;\n declare unobserve: () => void;\n declare options: IntersectionOptions;\n declare isVisible: boolean;\n declare disappear: () => void;\n\n connect() {\n let element = this.element;\n this.options = {element, threshold: 0.3};\n\n if (\"IntersectionObserver\" in window) {\n [this.observe, this.unobserve] = useIntersection(this, this.options);\n } else {\n // Client doesn't support intersection observer, fallback to pre-loading\n this.loadContent();\n }\n }\n\n appear(entry: IntersectionObserverEntry) {\n let element = this.element as HTMLImageElement;\n if (element.src !== \"\") {\n return;\n }\n if (entry.target === element && entry.isIntersecting) {\n this.loadContent();\n if (this.unobserve) {\n this.unobserve();\n }\n }\n }\n\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class LimitedSelectionCheckboxesController extends BaseController {\r\n\r\n static targets = [\"input\", \"error\"];\r\n static values = {max: Number, message: String};\r\n\r\n declare readonly hasErrorTarget: boolean;\r\n declare readonly errorTarget: HTMLElement;\r\n declare readonly inputTargets: HTMLInputElement[];\r\n declare readonly maxValue: number;\r\n declare readonly messageValue: string;\r\n\r\n maxSelections = 0;\r\n\r\n boundHandleInputs = this.handleInputs.bind(this);\r\n\r\n connect() {\r\n this.inputTargets.forEach((el) => el.addEventListener(\"change\", this.boundHandleInputs));\r\n }\r\n\r\n disconnect() {\r\n this.inputTargets.forEach((el) => el.removeEventListener(\"change\", this.boundHandleInputs));\r\n }\r\n\r\n handleInputs(event: Event) {\r\n let tickedInputs = this.inputTargets.reduce((previousValue, el) => el.checked ? previousValue + 1 : previousValue, 0);\r\n let target = event.target as HTMLInputElement;\r\n if (tickedInputs > this.maxSelections) {\r\n event.preventDefault();\r\n target.checked = false;\r\n target.dispatchEvent(new CustomEvent(\"change\", {bubbles: true, cancelable: true}));\r\n target.dispatchEvent(new CustomEvent(\"limited-selection:too-many\", {bubbles: true, cancelable: true, detail: {target}}));\r\n if (this.hasErrorTarget) {\r\n this.errorTarget.innerHTML = this.messageValue;\r\n }\r\n } else {\r\n target.dispatchEvent(new CustomEvent(\"limited-selection:selection\", {bubbles: true, cancelable: true, detail: {target}}));\r\n if (this.hasErrorTarget) {\r\n this.errorTarget.innerHTML = \"\";\r\n }\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class PasswordConfirmController extends BaseController {\r\n\r\n static targets = [\"password\"];\r\n static classes = [\"error\"];\r\n\r\n declare readonly passwordTargets: HTMLInputElement[];\r\n\r\n declare readonly errorClass: string;\r\n declare readonly hasErrorClass: boolean;\r\n\r\n private boundCheckPasswordsMatch = this.checkPasswordsMatch.bind(this);\r\n\r\n connect() {\r\n this.passwordTargets.forEach((el) => el.addEventListener(\"change\", this.boundCheckPasswordsMatch));\r\n }\r\n\r\n disconnect() {\r\n this.passwordTargets.forEach((el) => el.removeEventListener(\"change\", this.boundCheckPasswordsMatch));\r\n }\r\n\r\n private allPasswordsMatch() {\r\n let values = new Set(this.passwordTargets.map(el => el.value)); // Create a unique set of the password values\r\n return values.has(\"\") || values.size == 1; // If any of the passwords are still blank, or there is only one distinct password value (i.e. they all are the same)\r\n }\r\n\r\n private checkPasswordsMatch() {\r\n if (this.allPasswordsMatch()) {\r\n this.element.dispatchEvent(new CustomEvent(\"password-confirm:match\"));\r\n if (this.hasErrorClass) {\r\n this.passwordTargets.forEach(el => el.classList.remove(this.errorClass));\r\n }\r\n } else {\r\n this.element.dispatchEvent(new CustomEvent(\"password-confirm:no-match\"));\r\n if (this.hasErrorClass) {\r\n this.passwordTargets.forEach(el => el.classList.add(this.errorClass));\r\n }\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class PasswordPeekController extends BaseController {\r\n\r\n static targets = [\"password\"];\r\n\r\n declare readonly passwordTarget: HTMLInputElement;\r\n\r\n\r\n peak(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n this.passwordTarget.type = \"text\";\r\n }\r\n\r\n hide(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n this.passwordTarget.type = \"password\";\r\n }\r\n\r\n toggle(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n if (this.passwordTarget.type === \"password\") {\r\n this.peak();\r\n } else {\r\n this.hide();\r\n }\r\n }\r\n}\r\n","import {useDebounce, useWindowResize} from \"stimulus-use\";\nimport {WindowResizePayload} from \"stimulus-use/dist/use-window-resize/use-window-resize\";\nimport {BaseController} from \"./base_controller\";\n\ninterface ResponsiveIframeMessage {\n name: string,\n height: number,\n}\n\nexport class ResponsiveIframeWrapperController extends BaseController {\n\n boundMessageReceived = this.messageReceived.bind(this);\n\n connect() {\n window.addEventListener(\"message\", this.boundMessageReceived);\n }\n\n disconnect() {\n window.removeEventListener(\"message\", this.boundMessageReceived);\n }\n\n messageReceived(message: MessageEvent) {\n let data = message.data;\n if (data.hasOwnProperty(\"name\") && data.name === \"iframe-body\" && data.hasOwnProperty(\"height\")) {\n this.resize(data.height);\n }\n }\n\n resize(height: number) {\n (this.element as HTMLIFrameElement).style.height = `${height}px`;\n }\n\n}\n\nexport class ResponsiveIframeBodyController extends BaseController {\n\n static debounces = [\"postUpdate\"];\n\n declare observe: () => void;\n declare unobserve: () => void;\n\n connect() {\n // If this Window is inside a frame\n if (window.self !== window.top) {\n useWindowResize(this);\n useDebounce(this, {});\n this.postUpdate();\n } else {\n // Not an iframe\n }\n }\n\n windowResize(payload: WindowResizePayload) {\n this.postUpdate();\n };\n\n postUpdate() {\n let payload: ResponsiveIframeMessage = {name: \"iframe-body\", height: this.getHeight()};\n window.parent.postMessage(\n payload,\n \"*\",\n );\n }\n\n getHeight(): number {\n const body = document.body;\n const html = document.documentElement;\n\n // Get the largest height out of body and html's various height measurements\n return Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);\n }\n\n}\n","import camelCase from \"lodash.camelcase\";\r\nimport {BaseController} from \"../base_controller\";\r\n\r\nexport class EphemeralController extends BaseController {\r\n\r\n cleanupSelf() {\r\n this.cleanup(this.element as HTMLElement);\r\n }\r\n\r\n cleanup(element: HTMLElement) {\r\n element.dataset.controller = element.dataset.controller?.replaceAll(new RegExp(`(\\s|^)${this.identifier}(\\s|$)`, \"g\"), \"\") || \"\";\r\n if (element.dataset.controller == \"\") {\r\n // If there are no controllers left, remove the attribute\r\n delete element.dataset.controller;\r\n }\r\n\r\n let substringIdentifierValueRegex = new RegExp(`(\\s|^)${this.identifier}\\\\..+?(\\s|$)`, \"g\");\r\n element.dataset.target = element.dataset.target?.replaceAll(substringIdentifierValueRegex, \"\") || \"\";\r\n delete element.dataset[camelCase(`${this.identifier}-target`)];\r\n if (element.dataset.target == \"\") {\r\n // If there are no targets left, remove the attribute\r\n delete element.dataset.target;\r\n }\r\n\r\n element.dataset.action = element.dataset.target?.replaceAll(substringIdentifierValueRegex, \"\") || \"\";\r\n delete element.dataset[camelCase(`${this.identifier}-action`)];\r\n if (element.dataset.action == \"\") {\r\n // If there are no actions left, remove the attribute\r\n delete element.dataset.action;\r\n }\r\n\r\n // @ts-ignore\r\n let values = this.constructor.values;\r\n if (values) {\r\n Object.keys(values).forEach(val => delete element.dataset[camelCase(`${this.identifier}-${val}-value`)]);\r\n }\r\n\r\n // @ts-ignore\r\n let classes = this.constructor.classes;\r\n if (classes) {\r\n Object.keys(classes).forEach(val => delete element.dataset[camelCase(`${this.identifier}-${val}-class`)]);\r\n }\r\n }\r\n\r\n}\r\n","const smoothSupported = \"scrollBehavior\" in document.documentElement.style;\r\nlet smoothPolyfilled: boolean;\r\n\r\nexport async function scrollToElement(element: Element, {behavior = \"smooth\", block = \"start\", inline = \"nearest\"}: ScrollIntoViewOptions = {}) {\r\n if (behavior == \"smooth\" && !smoothSupported) {\r\n await polyfillSmooth();\r\n }\r\n element.scrollIntoView({behavior, block, inline});\r\n}\r\n\r\nasync function polyfillSmooth() {\r\n const {polyfill} = await import(/* webpackChunkName: \"smoothscroll-polyfill\" */ \"smoothscroll-polyfill\");\r\n if (smoothPolyfilled) {\r\n return;\r\n }\r\n smoothPolyfilled = true;\r\n polyfill();\r\n}\r\n\r\nexport function getScrollParent(node: HTMLElement | null): HTMLElement | null {\r\n if (!node) {\r\n return null;\r\n }\r\n const overflowY = getComputedStyle(node).overflowY;\r\n const isScrollable = overflowY !== \"visible\" && overflowY !== \"hidden\";\r\n\r\n if (isScrollable && node.scrollHeight >= node.clientHeight) {\r\n return node;\r\n }\r\n\r\n return getScrollParent(node.parentElement) || document.body;\r\n}\r\n","import {EphemeralController} from \"./utilities/ephemeral_controller\";\r\nimport {scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollIntoFocusController extends EphemeralController {\r\n\r\n static values = {\r\n behavior: String,\r\n block: String,\r\n inline: String,\r\n };\r\n\r\n declare behaviorValue: ScrollBehavior;\r\n declare hasBehaviorValue: boolean;\r\n declare blockValue: ScrollLogicalPosition;\r\n declare hasBlockValue: boolean;\r\n declare inlineValue: ScrollLogicalPosition;\r\n declare hasInlineValue: boolean;\r\n\r\n connect() {\r\n requestAnimationFrame(() => {\r\n // Attempt smooth scrolling, with polyfill\r\n scrollToElement(\r\n this.element,\r\n {\r\n behavior: this.hasBehaviorValue ? this.behaviorValue : \"smooth\",\r\n block: this.hasBlockValue ? this.blockValue : \"center\",\r\n inline: this.hasInlineValue ? this.inlineValue : \"center\",\r\n },\r\n ).catch(() => this.element.scrollIntoView()); // Fallback to snap-scrolling\r\n this.cleanupSelf();\r\n });\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\nimport {getScrollParent, scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollToBottomController extends BaseController {\r\n\r\n static values = {\r\n mode: String,\r\n };\r\n\r\n declare modeValue: \"nearest\" | \"document\";\r\n declare hasModeValue: boolean;\r\n\r\n\r\n scroll(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n let mode = this.hasModeValue ? this.modeValue : \"document\";\r\n let target: null | HTMLElement;\r\n if (mode == \"document\") {\r\n target = document.body;\r\n } else {\r\n target = getScrollParent(this.element as HTMLElement);\r\n }\r\n if (target == null) {\r\n return;\r\n }\r\n scrollToElement(target!, {behavior: \"smooth\", block: \"end\"}).catch(() => target!.scrollIntoView(false));\r\n }\r\n\r\n}\r\n\r\n","import {BaseController} from \"./base_controller\";\r\nimport {scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollToController extends BaseController {\r\n\r\n static values = {\r\n selector: String,\r\n behavior: String,\r\n block: String,\r\n inline: String,\r\n };\r\n\r\n declare selectorValue: string;\r\n declare behaviorValue: ScrollBehavior;\r\n declare hasBehaviorValue: boolean;\r\n declare blockValue: ScrollLogicalPosition;\r\n declare hasBlockValue: boolean;\r\n declare inlineValue: ScrollLogicalPosition;\r\n declare hasInlineValue: boolean;\r\n\r\n\r\n scroll() {\r\n let target = document.querySelector(this.selectorValue);\r\n if (!target) {\r\n console.warn(`Could not find target for '${this.selectorValue}'`);\r\n return;\r\n }\r\n\r\n scrollToElement(\r\n target!,\r\n {\r\n behavior: this.hasBehaviorValue ? this.behaviorValue : \"smooth\",\r\n block: this.hasBlockValue ? this.blockValue : \"center\",\r\n inline: this.hasInlineValue ? this.inlineValue : \"center\",\r\n },\r\n ).catch(() => target!.scrollIntoView()); // Fallback to snap-scrolling\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\nimport {getScrollParent, scrollToElement} from \"./utilities/scroll\";\n\nexport class ScrollToTopController extends BaseController {\n\n static values = {\n mode: String,\n };\n\n declare modeValue: \"nearest\" | \"document\";\n declare hasModeValue: boolean;\n\n\n scroll(event?: Event) {\n if (event) {\n event.preventDefault();\n }\n let mode = this.hasModeValue ? this.modeValue : \"document\";\n let target: null | HTMLElement;\n if (mode == \"document\") {\n target = document.body;\n } else {\n target = getScrollParent(this.element as HTMLElement);\n }\n if (target == null) {\n return;\n }\n scrollToElement(target!, {behavior: \"smooth\", block: \"start\"}).catch(() => target!.scrollIntoView(false));\n }\n\n}\n\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class SelfDestructController extends BaseController {\r\n\r\n static values = {seconds: Number};\r\n\r\n declare readonly secondsValue: number;\r\n timeout: null | ReturnType = null;\r\n\r\n connect() {\r\n requestAnimationFrame(() => {\r\n // Only start countdown on first paint\r\n this.timeout = setTimeout(() => this.element.remove(), this.secondsValue * 1000);\r\n });\r\n }\r\n\r\n disconnect() {\r\n if (this.timeout) {\r\n clearTimeout(this.timeout);\r\n }\r\n }\r\n\r\n}\r\n","import {EphemeralController} from \"./utilities/ephemeral_controller\";\r\n\r\nexport class TeleportController extends EphemeralController {\r\n\r\n static values = {target: String, insert: String, immediate: Boolean};\r\n\r\n declare readonly immediateValue: boolean;\r\n declare readonly hasImmediateValue: boolean;\r\n declare readonly targetValue: string;\r\n declare readonly hasInsertValue: boolean;\r\n declare readonly insertValue: InsertPosition | \"replaceOuter\" | \"replaceInner\" | \"prepend\" | \"append\";\r\n\r\n connect() {\r\n if (!this.hasInsertValue) {\r\n throw new Error(\"`insert` value was not specified\");\r\n }\r\n\r\n requestAnimationFrame(() => {\r\n if (this.hasImmediateValue && this.immediateValue) {\r\n this.execute();\r\n }\r\n });\r\n }\r\n\r\n execute(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n let destination = document.querySelector(this.targetValue);\r\n\r\n if (destination == null) {\r\n this.element.dispatchEvent(new CustomEvent(\"teleport:error\", {bubbles: true, cancelable: true}));\r\n return;\r\n }\r\n\r\n let copy = this.element.cloneNode(true) as HTMLElement;\r\n this.cleanup(copy);\r\n\r\n switch (this.insertValue) {\r\n case \"beforebegin\":\r\n case \"beforeend\":\r\n case \"afterend\":\r\n case \"afterbegin\":\r\n destination.insertAdjacentHTML(this.insertValue, copy.outerHTML);\r\n break;\r\n case \"replaceOuter\":\r\n destination.outerHTML = copy.outerHTML;\r\n break;\r\n case \"replaceInner\":\r\n destination.innerHTML = copy.outerHTML;\r\n break;\r\n case \"prepend\":\r\n destination.insertAdjacentHTML(\"afterbegin\", copy.outerHTML);\r\n break;\r\n case \"append\":\r\n destination.insertAdjacentHTML(\"beforeend\", copy.outerHTML);\r\n break;\r\n default:\r\n throw new Error(\"`insert` value was not specified\");\r\n\r\n }\r\n this.element.remove();\r\n }\r\n\r\n}\r\n","import {useClickOutside, useHover} from \"stimulus-use\";\nimport {BaseController} from \"./base_controller\";\n\nexport type ToggleClassMode = \"on\" | \"off\" | \"toggle\"\n\nexport class ToggleClassController extends BaseController {\n\n static targets = [\"toggle\"];\n static values = {\n class: String,\n mouseEnter: String,\n mouseLeave: String,\n clickAway: Boolean,\n initial: String,\n };\n\n declare readonly toggleTargets: HTMLElement[];\n\n declare readonly classValue: string;\n declare readonly hasClassValue: boolean;\n\n declare readonly mouseEnterValue: ToggleClassMode;\n declare readonly hasMouseEnterValue: boolean;\n\n declare readonly mouseLeaveValue: ToggleClassMode;\n declare readonly hasMouseLeaveValue: boolean;\n\n declare readonly clickAwayValue: boolean;\n declare readonly hasClickAwayValue: boolean;\n\n declare readonly initialValue: \"on\" | \"off\";\n declare readonly hasInitialValue: boolean;\n\n connect() {\n if (!this.hasClassValue) {\n throw new Error(\"data-toggle-class-class-value must not be empty\");\n }\n\n if (this.hasMouseEnterValue || this.hasMouseLeaveValue) {\n useHover(this);\n }\n\n if (this.hasClickAwayValue && this.clickAwayValue) {\n useClickOutside(this);\n }\n\n requestAnimationFrame(() => {\n if (this.hasInitialValue) {\n if (this.initialValue === \"on\") {\n this.toggleTargets.forEach((target) => this.elementOn(target));\n } else {\n this.toggleTargets.forEach((target) => this.elementOff(target));\n }\n }\n });\n }\n\n clickOutside() {\n this.toggleTargets.forEach((target) => {\n if (this.elementWasToggled(target)) {\n this.elementToggleStatus(target);\n this.elementToggle(target);\n }\n });\n }\n\n mouseEnter() {\n if (this.hasMouseEnterValue) {\n switch (this.mouseEnterValue) {\n case \"on\":\n this.on();\n break;\n case \"off\":\n this.off();\n break;\n case \"toggle\":\n this.toggle();\n break;\n }\n }\n return {};\n }\n\n mouseLeave() {\n if (this.hasMouseLeaveValue) {\n switch (this.mouseLeaveValue) {\n case \"on\":\n this.on();\n break;\n case \"off\":\n this.off();\n break;\n case \"toggle\":\n this.toggle();\n break;\n }\n }\n return {};\n }\n\n on(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementOn(target);\n });\n }\n\n off(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementOff(target);\n });\n }\n\n toggle(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementToggle(target);\n });\n }\n\n private elementWasToggled(el: HTMLElement): boolean {\n return el.dataset.toggled == \"true\";\n }\n\n private elementToggleStatus(el: HTMLElement) {\n if (this.elementWasToggled(el)) {\n delete el.dataset.toggled;\n } else {\n el.dataset.toggled = \"true\";\n }\n }\n\n private elementToggle(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass));\n }\n\n private elementOn(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass, true));\n }\n\n private elementOff(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass, false));\n }\n\n}\n","import {BaseController} from \"./base_controller\";\nimport {isHTMLLinkElement} from \"./utilities/elements\";\nimport {isTurboFrame} from \"./utilities/turbo\";\n\nexport class TurboFrameRCController extends BaseController {\n\n static values = {\n frameId: String,\n src: String,\n loadingMessage: String,\n };\n\n declare readonly frameIdValue: string;\n declare readonly srcValue: string;\n declare readonly hasSrcValue: boolean;\n declare readonly loadingMessageValue: string;\n declare readonly hasLoadingMessageValue: boolean;\n\n toggle(event?: Event | null) {\n if (event) {\n event.preventDefault();\n }\n let frame = this.getFrame();\n let frameSrc = frame.src;\n if (frameSrc == null || frameSrc !== this.getSrc()) {\n this.setSrc();\n } else {\n this.clear();\n }\n }\n\n setSrc(event?: Event | null) {\n if (event) {\n event.preventDefault();\n }\n let frame = this.getFrame();\n if (this.hasLoadingMessageValue) {\n frame.innerHTML = this.loadingMessageValue;\n }\n\n frame.src = this.getSrc();\n }\n\n clear(event?: Event | null) {\n if (event) {\n event.preventDefault();\n }\n let frame = this.getFrame();\n frame.src = \"\";\n frame.innerHTML = \"\";\n }\n\n private getFrame(): TurboFrame {\n let frame = document.getElementById(`${this.frameIdValue}`);\n if (frame == null) {\n throw new Error(`Could not find frame with ID '${this.frameIdValue}'`);\n }\n if (!isTurboFrame(frame)) {\n throw new Error(`Element targeted by ID '${this.frameIdValue}'`);\n } else {\n return frame;\n }\n }\n\n private getSrc(): string {\n let element = this.element as HTMLElement;\n if (this.hasSrcValue) {\n return this.srcValue;\n } else if (isHTMLLinkElement(element)) {\n return element.href;\n } else {\n throw new Error(\"No link given to drive frame to\");\n }\n }\n\n}\n","export function isTurboFrame(element: HTMLElement): element is TurboFrame {\r\n return element.nodeName == \"TURBO-FRAME\";\r\n}\r\n","export function isHTMLLinkElement(element: Element): element is HTMLLinkElement {\n return element.nodeName == \"A\";\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class WordCountController extends BaseController {\r\n\r\n static targets = [\"input\", \"output\"];\r\n static values = {min: Number, max: Number};\r\n static classes = [\"error\"];\r\n\r\n declare readonly inputTarget: HTMLInputElement | HTMLTextAreaElement;\r\n declare readonly outputTarget: HTMLElement;\r\n declare minValue: number;\r\n declare hasMinValue: boolean;\r\n declare maxValue: number;\r\n declare hasMaxValue: boolean;\r\n declare errorClass: string;\r\n declare hasErrorClass: boolean;\r\n\r\n boundHandler = this.updateWordCount.bind(this);\r\n\r\n connect() {\r\n this.updateWordCount();\r\n this.inputTarget.addEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n this.inputTarget.removeEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n updateWordCount() {\r\n let wordCount = 0;\r\n let textAreaValue = this.inputTarget.value;\r\n let matches = textAreaValue.match(/\\S+/g);\r\n wordCount = (matches && matches.length) || 0;\r\n this.outputTarget.innerText = wordCount.toString();\r\n if (this.hasErrorClass) {\r\n if (this.isValidCount(wordCount)) {\r\n this.outputTarget.classList.remove(this.errorClass);\r\n } else {\r\n this.outputTarget.classList.add(this.errorClass);\r\n }\r\n }\r\n }\r\n\r\n isValidCount(count: number) {\r\n let min = 0;\r\n let max = 99999;\r\n\r\n if (this.hasMinValue) {\r\n min = this.minValue;\r\n }\r\n\r\n if (this.hasMaxValue) {\r\n max = this.maxValue;\r\n }\r\n\r\n return count >= min && count <= max;\r\n }\r\n\r\n}\r\n"],"names":["BaseController","Controller","constructor","context","super","Proxy","this","get","obj","prop","returnVal","Reflect","self","test","logProperty","toString","apply","target","thisArg","argArray","log","args","functionName","application","debug","logger","console","groupCollapsed","identifier","element","groupEnd","AsyncBlockController","connect","loadContent","el","hasReplaceTarget","replaceTarget","fetch","endpointValue","then","response","text","html","newEl","document","createElement","innerHTML","replaceWith","event","CustomEvent","detail","dispatchEvent","catch","err","finally","endpoint","String","AutoSubmitFormController","handler","bind","querySelectorAll","forEach","addEventListener","boundHandler","disconnect","removeEventListener","e","bubbles","cancelable","method","controller","methodName","composeEventName","name","eventPrefix","composedName","extendedEvent","type","composed","Object","assign","originalEvent","defaultOptions","events","onlyVisible","StimulusUse","[object Object]","options","_a","_b","_c","controllerId","stimulusUseDebug","id","dataset","controllerInitialize","initialize","controllerConnect","controllerDisconnect","UseHover","observe","targetElement","onEnter","onLeave","unobserve","call","hover","enhanceController","UseMutation","observer","error","handleError","mutation","entries","MutationObserver","useWindowResize","callback","innerWidth","innerHeight","window","payload","height","Infinity","width","debounce","fn","wait","timeoutId","arguments","clearTimeout","setTimeout","AutosizeController","style","resize","boxSizing","requestAnimationFrame","windowResize","autosize","offset","offsetHeight","clientHeight","scrollHeight","CharCountController","updateCharCount","inputTarget","charCount","value","length","outputTarget","innerText","hasErrorClass","isValidCount","classList","remove","errorClass","add","count","min","max","hasMinValue","minValue","hasMaxValue","maxValue","Number","ClipboardController","supported","queryCommandSupported","hasRemoveUnusedValue","removeUnusedValue","hasFallbackTarget","fallbackTarget","hasCopyTarget","copyTarget","select","preventDefault","sourceTarget","copy","execCommand","removeUnused","Boolean","ConfirmNavigationController","confirmMessage","messageValue","onbeforeunload","handlePopstate","message","DebugController","testTargets","DetectDirtyController","initialValue","isInputElement","isCheckable","checked","restore","setAttribute","removeAttribute","tagName","DisableInputsController","toggle","hasDisablerTarget","disablerTarget","disableInputs","enableInputs","shouldClear","hasClearValue","clearValue","disableTargets","_","disabled","clear","DismissableController","dismiss","EmptyDomController","useMutation","childList","checkEmpty","mutate","children","hasScopeSelectorValue","scopeSelectorValue","hasNotEmptyClass","notEmptyClass","split","klass","hasEmptyClass","emptyClass","scopeSelector","EnableInputsController","hasEnablerTarget","enablerTarget","enableTargets","FallbackImageController","onerror","hasPlaceholderValue","src","placeholderValue","display","placeholder","LazyBlockController","threshold","IntersectionObserver","entry","isIntersecting","isVisible","eventName","appearEvent","dispatchAppear","disappearEvent","dispatchDisappear","useIntersection","appear","LimitedSelectionCheckboxesController","handleInputs","inputTargets","boundHandleInputs","tickedInputs","reduce","previousValue","maxSelections","hasErrorTarget","errorTarget","PasswordConfirmController","checkPasswordsMatch","passwordTargets","boundCheckPasswordsMatch","allPasswordsMatch","values","Set","map","has","size","PasswordPeekController","peak","passwordTarget","hide","ResponsiveIframeWrapperController","messageReceived","boundMessageReceived","data","hasOwnProperty","ResponsiveIframeBodyController","top","debounces","func","postUpdate","getHeight","parent","postMessage","body","documentElement","Math","EphemeralController","cleanupSelf","cleanup","replaceAll","RegExp","substringIdentifierValueRegex","camelCase","action","keys","val","classes","smoothSupported","smoothPolyfilled","scrollToElement","behavior","block","inline","async","polyfill","polyfillSmooth","scrollIntoView","getScrollParent","node","overflowY","getComputedStyle","parentElement","ScrollIntoFocusController","hasBehaviorValue","behaviorValue","hasBlockValue","blockValue","hasInlineValue","inlineValue","ScrollToBottomController","scroll","hasModeValue","modeValue","mode","ScrollToController","querySelector","selectorValue","warn","selector","ScrollToTopController","SelfDestructController","timeout","secondsValue","seconds","TeleportController","hasInsertValue","Error","hasImmediateValue","immediateValue","execute","destination","targetValue","cloneNode","insertValue","insertAdjacentHTML","outerHTML","insert","immediate","ToggleClassController","hasClassValue","hasMouseEnterValue","hasMouseLeaveValue","useHover","hasClickAwayValue","clickAwayValue","onEvent","contains","rect","getBoundingClientRect","windowHeight","windowWidth","clientWidth","left","isElementInViewport","clickOutside","clickOutsideEvent","useClickOutside","hasInitialValue","toggleTargets","elementOn","elementOff","elementWasToggled","elementToggleStatus","elementToggle","mouseEnter","mouseEnterValue","on","off","mouseLeave","mouseLeaveValue","toggled","classValue","class","clickAway","initial","TurboFrameRCController","frameSrc","getFrame","getSrc","setSrc","frame","hasLoadingMessageValue","loadingMessageValue","getElementById","frameIdValue","nodeName","hasSrcValue","srcValue","isHTMLLinkElement","href","frameId","loadingMessage","WordCountController","updateWordCount","wordCount","matches","match"],"mappings":"2RAEaA,UAAuBC,EAElCC,YAAYC,GAEV,OADAC,MAAMD,OACKE,MAAMC,KAAM,CACrBC,IAAK,CAACC,EAAKC,KACT,IAAIC,EAAYC,QAAQJ,IAAIC,EAAKC,GAC7BG,EAAON,KACX,GAmCR,SAAqBG,GACnB,OAAQA,GACN,IAAK,cACL,IAAK,UACL,IAAK,cACL,IAAK,aACL,IAAK,MACL,IAAK,OACL,IAAK,qBACL,IAAK,aACH,SAGJ,QAAI,kBAAkBI,KAAKJ,IAGvB,aAAaI,KAAKJ,IAGlB,oBAAoBI,KAAKJ,IAGzB,aAAaI,KAAKJ,IAzDZK,CAAYL,EAAKM,YAAa,CAChC,GAAwB,mBAAbL,EACT,WAAWL,MAAMK,EAAW,CAC1BM,MAAK,CAACC,EAAaC,EAAcC,KAC/BP,EAAKQ,IAAIX,EAAKM,WAAY,CACxBM,KAAMF,IAEDR,QAAQK,MAAMC,EAAQC,EAASC,MAI1Cb,KAAKc,IAAIX,EAAKM,YAGlB,OAAOL,KAKbU,IAAIE,EAAsBD,EAAW,IAEnC,IAAKf,KAAKiB,YAAYC,MACpB,OA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K0I,YAAYE,MACTyQ,MAAM,QAClCF,EAAaC,GAAWA,EAAQvQ,QAAW,EAC3C7I,KAAK8I,aAAaC,UAAYoQ,EAAU1Y,WACpCT,KAAKgJ,gBACHhJ,KAAKiJ,aAAakQ,GACpBnZ,KAAK8I,aAAaI,UAAUC,OAAOnJ,KAAKoJ,YAExCpJ,KAAK8I,aAAaI,UAAUG,IAAIrJ,KAAKoJ,aAK3CH,aAAaK,GACX,IAAIC,EAAM,EACNC,EAAM,MAUV,OARIxJ,KAAKyJ,cACPF,EAAMvJ,KAAK0J,UAGT1J,KAAK2J,cACPH,EAAMxJ,KAAK4J,UAGNN,GAASC,GAAOD,GAASE,GAnD3ByP,UAAU,CAAC,QAAS,UACpBA,SAAS,CAAC1P,IAAKM,OAAQL,IAAKK,QAC5BoP,UAAU,CAAC"} \ No newline at end of file +{"version":3,"file":"stimulus-library.modern.js","sources":["../src/base_controller.ts","../src/async_block_controller.ts","../src/auto_submit_form_controller.ts","../node_modules/stimulus-use/dist/support/index.js","../node_modules/stimulus-use/dist/use-intersection/use-intersection.js","../node_modules/stimulus-use/dist/use-click-outside/use-click-outside.js","../node_modules/stimulus-use/dist/stimulus_use.js","../node_modules/stimulus-use/dist/use-hover/use-hover.js","../node_modules/stimulus-use/dist/use-mutation/use-mutation.js","../node_modules/stimulus-use/dist/use-window-resize/use-window-resize.js","../node_modules/stimulus-use/dist/use-debounce/use-debounce.js","../src/autosize_controller.ts","../src/char_count_controller.ts","../src/clipboard_controller.ts","../src/confirm_navigation_controller.ts","../src/debug_controller.ts","../src/detect_dirty_controller.ts","../src/disable_inputs_controller.ts","../src/dismissable_controller.ts","../src/empty_dom_controller.ts","../src/enable_inputs_controller.ts","../src/fallback_image_controller.ts","../src/lazy_block_controller.ts","../src/limited_selection_checkboxes_controller.ts","../src/nested_form_controller.ts","../src/password_confirm_controller.ts","../src/password_peek_controller.ts","../src/responsive_iframe_controller.ts","../src/utilities/ephemeral_controller.ts","../src/utilities/scroll.ts","../src/scroll_into_focus_controller.ts","../src/scroll_to_bottom_controller.ts","../src/scroll_to_controller.ts","../src/scroll_to_top_controller.ts","../src/self_destruct_controller.ts","../src/teleport_controller.ts","../src/toggle_class_controller.ts","../src/turbo_frame_rc_controller.ts","../src/utilities/turbo.ts","../src/utilities/elements.ts","../src/word_count_controller.ts"],"sourcesContent":["import {Context, Controller} from \"stimulus\";\r\n\r\nexport class BaseController extends Controller {\r\n\r\n constructor(context: Context) {\r\n super(context);\r\n return new Proxy(this, {\r\n get: (obj, prop) => {\r\n let returnVal = Reflect.get(obj, prop);\r\n let self = this;\r\n if (logProperty(prop.toString())) {\r\n if (typeof returnVal == \"function\") {\r\n return new Proxy(returnVal, {\r\n apply(target: any, thisArg: any, argArray?: any): any {\r\n self.log(prop.toString(), {\r\n args: argArray,\r\n });\r\n return Reflect.apply(target, thisArg, argArray);\r\n },\r\n });\r\n } else {\r\n this.log(prop.toString());\r\n }\r\n }\r\n return returnVal;\r\n },\r\n });\r\n }\r\n\r\n log(functionName: string, args: {} = {}): void {\r\n // @ts-ignore\r\n if (!this.application.debug) {\r\n return;\r\n }\r\n let logger = console;\r\n logger.groupCollapsed(`%c${this.identifier} %c#${functionName}`, \"color: #3B82F6\", \"color: unset\");\r\n logger.log({\r\n element: this.element,\r\n ...args,\r\n });\r\n logger.groupEnd();\r\n }\r\n\r\n}\r\n\r\nfunction logProperty(prop: string): boolean {\r\n switch (prop) {\r\n case \"application\":\r\n case \"element\":\r\n case \"constructor\":\r\n case \"initialize\":\r\n case \"log\":\r\n case \"data\":\r\n case \"valueDescriptorMap\":\r\n case \"identifier\":\r\n return false;\r\n }\r\n\r\n if (/^.*?Target(s)?$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?Value$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?ValueChanged$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?Class$/.test(prop)) {\r\n return false;\r\n }\r\n\r\n return true;\r\n}\r\n","import {BaseController} from \"./base_controller\";\n\nexport class AsyncBlockController extends BaseController {\n static targets = [\"replace\"];\n static values = {endpoint: String};\n\n declare readonly replaceTarget: HTMLElement;\n declare readonly hasReplaceTarget: boolean;\n declare readonly endpointValue: string;\n\n\n // This is a simple controller to load a block of content when the page loads.\n // It should be used to give a quick initial response before calling out to an\n // an AJAX endpoint to do some expensive work.\n connect() {\n this.loadContent();\n }\n\n loadContent() {\n let el = (this.hasReplaceTarget ? this.replaceTarget : this.element) as HTMLElement;\n fetch(this.endpointValue)\n .then((response) => response.text())\n .then((html) => {\n let newEl = document.createElement(\"div\");\n newEl.innerHTML = html;\n el.replaceWith(newEl);\n\n // Trigger event to show block has loaded\n let event = new CustomEvent(\"ajax:success\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n })\n .catch(err => {\n el.replaceWith(\"Sorry, this content failed to load\");\n\n let event = new CustomEvent(\"ajax:error\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n })\n .finally(() => {\n let event = new CustomEvent(\"ajax:complete\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n });\n }\n}\n","import {BaseController} from \"./base_controller\";\n\nexport class AutoSubmitFormController extends BaseController {\n\n private boundHandler = this.handler.bind(this);\n\n connect() {\n (this.element as HTMLElement).querySelectorAll(\"input, select, textarea\").forEach(el => el.addEventListener(\"change\", this.boundHandler));\n }\n\n disconnect() {\n (this.element as HTMLElement).querySelectorAll(\"input, select, textarea\").forEach(el => el.removeEventListener(\"change\", this.boundHandler));\n }\n\n private handler(e: Event) {\n // this.element.submit()\n // Moved to this to support remote forms and CSRF properly\n this.element.dispatchEvent(\n new CustomEvent(\"submit\", {\n bubbles: true,\n cancelable: true,\n }),\n );\n }\n}\n","export const method = (controller, methodName) => {\n const method = controller[methodName];\n if (typeof method == 'function') {\n return method;\n }\n else {\n return (...args) => { };\n }\n};\nexport const composeEventName = (name, controller, eventPrefix) => {\n let composedName = name;\n if (eventPrefix === true) {\n composedName = `${controller.identifier}:${name}`;\n }\n else if (typeof eventPrefix === 'string') {\n composedName = `${eventPrefix}:${name}`;\n }\n return composedName;\n};\nexport const extendedEvent = (type, event, detail) => {\n const { bubbles, cancelable, composed } = event || { bubbles: true, cancelable: true, composed: true };\n if (event) {\n Object.assign(detail, { originalEvent: event });\n }\n const customEvent = new CustomEvent(type, {\n bubbles,\n cancelable,\n composed,\n detail,\n });\n return customEvent;\n};\nexport function isElementInViewport(el) {\n const rect = el.getBoundingClientRect();\n const windowHeight = (window.innerHeight || document.documentElement.clientHeight);\n const windowWidth = (window.innerWidth || document.documentElement.clientWidth);\n const vertInView = (rect.top <= windowHeight) && ((rect.top + rect.height) >= 0);\n const horInView = (rect.left <= windowWidth) && ((rect.left + rect.width) >= 0);\n return (vertInView && horInView);\n}\n//# sourceMappingURL=index.js.map","import { method, extendedEvent, composeEventName } from '../support/index';\nconst defaultOptions = {\n dispatchEvent: true,\n eventPrefix: true,\n};\nexport const useIntersection = (controller, options = {}) => {\n const { dispatchEvent, eventPrefix } = Object.assign({}, defaultOptions, options);\n const targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n const callback = (entries) => {\n const [entry] = entries;\n if (entry.isIntersecting) {\n dispatchAppear(entry);\n }\n else if (controller.isVisible) {\n dispatchDisappear(entry);\n }\n };\n const dispatchAppear = (entry) => {\n controller.isVisible = true;\n method(controller, 'appear').call(controller, entry);\n // emit a custom \"appear\" event\n if (dispatchEvent) {\n const eventName = composeEventName('appear', controller, eventPrefix);\n const appearEvent = extendedEvent(eventName, null, { controller, entry });\n targetElement.dispatchEvent(appearEvent);\n }\n };\n const dispatchDisappear = (entry) => {\n controller.isVisible = false;\n method(controller, 'disappear').call(controller, entry);\n // emit a custom \"disappear\" event\n if (dispatchEvent) {\n const eventName = composeEventName('disappear', controller, eventPrefix);\n const disappearEvent = extendedEvent(eventName, null, { controller, entry });\n targetElement.dispatchEvent(disappearEvent);\n }\n };\n // keep a copy of the current disconnect() function of the controller\n // to support composing several behaviors\n const controllerDisconnect = controller.disconnect.bind(controller);\n const observer = new IntersectionObserver(callback, options);\n const observe = () => {\n observer.observe(targetElement);\n };\n const unobserve = () => {\n observer.unobserve(targetElement);\n };\n Object.assign(controller, {\n isVisible: false,\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-intersection.js.map","import { composeEventName, extendedEvent, isElementInViewport } from '../support/index';\nconst defaultOptions = {\n events: ['click', 'touchend'],\n onlyVisible: true,\n dispatchEvent: true,\n eventPrefix: true,\n};\nexport const useClickOutside = (controller, options = {}) => {\n const { onlyVisible, dispatchEvent, events, eventPrefix } = Object.assign({}, defaultOptions, options);\n const onEvent = (event) => {\n const targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n if (targetElement.contains(event.target) || (!isElementInViewport(targetElement) && onlyVisible)) {\n return;\n }\n // call the clickOutside method of the Stimulus controller\n if (controller.clickOutside) {\n controller.clickOutside(event);\n }\n // emit a custom event\n if (dispatchEvent) {\n const eventName = composeEventName('click:outside', controller, eventPrefix);\n const clickOutsideEvent = extendedEvent(eventName, event, { controller });\n targetElement.dispatchEvent(clickOutsideEvent);\n }\n };\n const observe = () => {\n events === null || events === void 0 ? void 0 : events.forEach(event => {\n window.addEventListener(event, onEvent, false);\n });\n };\n const unobserve = () => {\n events === null || events === void 0 ? void 0 : events.forEach(event => {\n window.removeEventListener(event, onEvent, false);\n });\n };\n // keep a copy of the current disconnect() function of the controller\n // to support composing several behaviors\n const controllerDisconnect = controller.disconnect.bind(controller);\n Object.assign(controller, {\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-click-outside.js.map","const defaultOptions = {\n debug: false,\n logger: console\n};\nexport class StimulusUse {\n constructor(controller, options = {}) {\n var _a, _b, _c;\n this.log = (functionName, args) => {\n if (!this.debug)\n return;\n this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${functionName}`, 'color: #3B82F6', 'color: unset');\n this.logger.log(Object.assign({ controllerId: this.controllerId }, args));\n this.logger.groupEnd();\n };\n this.debug = (_b = (_a = options === null || options === void 0 ? void 0 : options.debug) !== null && _a !== void 0 ? _a : controller.application.stimulusUseDebug) !== null && _b !== void 0 ? _b : defaultOptions.debug;\n this.logger = (_c = options === null || options === void 0 ? void 0 : options.logger) !== null && _c !== void 0 ? _c : defaultOptions.logger;\n this.controller = controller;\n this.controllerId = controller.element.id || controller.element.dataset.id;\n // make copies of lifecycle functions\n this.controllerInitialize = controller.initialize.bind(controller);\n this.controllerConnect = controller.connect.bind(controller);\n this.controllerDisconnect = controller.disconnect.bind(controller);\n }\n}\n//# sourceMappingURL=stimulus_use.js.map","import { StimulusUse } from '../stimulus_use';\nimport { method } from '../support/index';\nexport class UseHover extends StimulusUse {\n constructor(controller, options = {}) {\n super(controller, options);\n this.observe = () => {\n this.targetElement.addEventListener('mouseenter', this.onEnter);\n this.targetElement.addEventListener('mouseleave', this.onLeave);\n };\n this.unobserve = () => {\n this.targetElement.removeEventListener('mouseenter', this.onEnter);\n this.targetElement.removeEventListener('mouseleave', this.onLeave);\n };\n this.onEnter = () => {\n method(this.controller, 'mouseEnter').call(this.controller);\n this.log('mouseEnter', { hover: true });\n };\n this.onLeave = () => {\n method(this.controller, 'mouseLeave').call(this.controller);\n this.log('mouseLeave', { hover: false });\n };\n this.targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n this.controller = controller;\n this.enhanceController();\n this.observe();\n }\n enhanceController() {\n const controllerDisconnect = this.controller.disconnect.bind(this.controller);\n const disconnect = () => {\n this.unobserve();\n controllerDisconnect();\n };\n Object.assign(this.controller, { disconnect });\n }\n}\nexport const useHover = (controller, options = {}) => {\n const observer = new UseHover(controller, options);\n return [observer.observe, observer.unobserve];\n};\n//# sourceMappingURL=use-hover.js.map","import { StimulusUse } from '../stimulus_use';\nimport { method } from '../support/index';\nexport class UseMutation extends StimulusUse {\n constructor(controller, options = {}) {\n super(controller, options);\n this.observe = () => {\n try {\n this.observer.observe(this.targetElement, this.options);\n }\n catch (error) {\n this.controller.application.handleError(error, \"At a minimum, one of childList, attributes, and/or characterData must be true\", {});\n }\n };\n this.unobserve = () => {\n this.observer.disconnect();\n };\n this.mutation = (entries) => {\n method(this.controller, 'mutate').call(this.controller, entries);\n this.log('mutate', { entries });\n };\n this.targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n this.controller = controller;\n this.options = options;\n this.observer = new MutationObserver(this.mutation);\n this.enhanceController();\n this.observe();\n }\n enhanceController() {\n const controllerDisconnect = this.controller.disconnect.bind(this.controller);\n const disconnect = () => {\n this.unobserve();\n controllerDisconnect();\n };\n Object.assign(this.controller, { disconnect });\n }\n}\nexport const useMutation = (controller, options = {}) => {\n const observer = new UseMutation(controller, options);\n return [observer.observe, observer.unobserve];\n};\n//# sourceMappingURL=use-mutation.js.map","import { method } from '../support/index';\nexport const useWindowResize = (controller) => {\n const callback = (event) => {\n const { innerWidth, innerHeight } = window;\n const payload = {\n height: innerHeight || Infinity,\n width: innerWidth || Infinity,\n event\n };\n method(controller, 'windowResize').call(controller, payload);\n };\n const controllerDisconnect = controller.disconnect.bind(controller);\n const observe = () => {\n window.addEventListener('resize', callback);\n callback();\n };\n const unobserve = () => {\n window.removeEventListener('resize', callback);\n };\n Object.assign(controller, {\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-window-resize.js.map","import { Controller } from 'stimulus';\nclass DebounceController extends Controller {\n}\nDebounceController.debounces = [];\nconst defaultWait = 200;\nconst debounce = (fn, wait = defaultWait) => {\n let timeoutId = null;\n return function () {\n const args = arguments;\n const context = this;\n const callback = () => fn.apply(context, args);\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n timeoutId = setTimeout(callback, wait);\n };\n};\nexport const useDebounce = (controller, options) => {\n var _a;\n const constructor = controller.constructor;\n (_a = constructor.debounces) === null || _a === void 0 ? void 0 : _a.forEach((func) => {\n if (typeof func === \"string\") {\n controller[func] = debounce(controller[func], options === null || options === void 0 ? void 0 : options.wait);\n }\n if (typeof func === \"object\") {\n const { name, wait } = func;\n if (!name)\n return;\n controller[name] = debounce(controller[name], wait || (options === null || options === void 0 ? void 0 : options.wait));\n }\n });\n};\n//# sourceMappingURL=use-debounce.js.map","import {useWindowResize} from \"stimulus-use\";\nimport {BaseController} from \"./base_controller\";\n\nexport class AutosizeController extends BaseController {\n\n private boundHandler = this.handler.bind(this);\n\n connect() {\n let target = this.element as HTMLTextAreaElement;\n target.style.resize = \"none\";\n target.style.boxSizing = \"border-box\";\n target.addEventListener(\"input\", this.boundHandler);\n target.addEventListener(\"focus\", this.boundHandler);\n useWindowResize(this);\n requestAnimationFrame(this.boundHandler);\n }\n\n windowResize() {\n this.handler();\n }\n\n private handler() {\n this.autosize(this.element as HTMLTextAreaElement);\n };\n\n private autosize(element: HTMLTextAreaElement) {\n let offset = element.offsetHeight - element.clientHeight;\n element.style.height = \"auto\";\n element.style.height = element.scrollHeight + offset + \"px\";\n }\n\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class CharCountController extends BaseController {\r\n\r\n static targets = [\"input\", \"output\"];\r\n static values = {min: Number, max: Number};\r\n static classes = [\"error\"];\r\n\r\n declare readonly inputTarget: HTMLInputElement | HTMLTextAreaElement;\r\n declare readonly outputTarget: HTMLElement;\r\n declare minValue: number;\r\n declare hasMinValue: boolean;\r\n declare maxValue: number;\r\n declare hasMaxValue: boolean;\r\n declare errorClass: string;\r\n declare hasErrorClass: boolean;\r\n\r\n boundHandler = this.updateCharCount.bind(this);\r\n\r\n connect() {\r\n this.updateCharCount();\r\n this.inputTarget.addEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n this.inputTarget.removeEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n updateCharCount() {\r\n let charCount = this.inputTarget.value.length;\r\n this.outputTarget.innerText = charCount.toString();\r\n if (this.hasErrorClass) {\r\n if (this.isValidCount(charCount)) {\r\n this.outputTarget.classList.remove(this.errorClass);\r\n } else {\r\n this.outputTarget.classList.add(this.errorClass);\r\n }\r\n }\r\n }\r\n\r\n isValidCount(count: number) {\r\n let min = 0;\r\n let max = 99999;\r\n\r\n if (this.hasMinValue) {\r\n min = this.minValue;\r\n }\r\n\r\n if (this.hasMaxValue) {\r\n max = this.maxValue;\r\n }\r\n\r\n return count >= min && count <= max;\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class ClipboardController extends BaseController {\r\n\r\n static targets = [\"button\", \"copy\", \"fallback\"];\r\n static values = {removeUnused: Boolean};\r\n\r\n declare readonly sourceTarget: HTMLElement;\r\n declare readonly copyTarget: HTMLElement;\r\n declare readonly hasCopyTarget: boolean;\r\n declare readonly fallbackTarget: HTMLElement;\r\n declare readonly hasFallbackTarget: boolean;\r\n\r\n declare readonly hasRemoveUnusedValue: boolean;\r\n declare readonly removeUnusedValue: boolean;\r\n\r\n supported = false;\r\n\r\n connect() {\r\n this.supported = document.queryCommandSupported(\"copy\");\r\n\r\n if (this.hasRemoveUnusedValue && this.removeUnusedValue) {\r\n if (this.supported && this.hasFallbackTarget) {\r\n this.fallbackTarget.remove();\r\n } else if (this.hasCopyTarget) {\r\n this.copyTarget.remove();\r\n }\r\n }\r\n }\r\n\r\n select(event: MouseEvent) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n (this.sourceTarget as HTMLInputElement | HTMLTextAreaElement).select();\r\n }\r\n\r\n copy(event: ClipboardEvent) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n (this.sourceTarget as HTMLInputElement | HTMLTextAreaElement).select();\r\n if (this.supported) {\r\n document.execCommand(\"copy\");\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\n\nexport class ConfirmNavigationController extends BaseController {\n\n static values = {message: String};\n\n declare readonly messageValue: string;\n\n connect() {\n let confirmMessage = this.messageValue;\n window.onbeforeunload = () => (confirmMessage == null ? true : confirmMessage);\n window.addEventListener(\"popstate\", this.handlePopstate);\n window.addEventListener(\"submit\", () => {\n window.removeEventListener(\"popstate\", this.handlePopstate);\n window.onbeforeunload = null;\n });\n // TODO: Turbo navigation events\n }\n\n handlePopstate(event: PopStateEvent) {\n return false;\n }\n\n}\n","import {BaseController} from \"./base_controller\";\n\nexport class DebugController extends BaseController {\n\n static targets = [\"test\"];\n declare testTargets: HTMLElement[];\n\n connect() {\n console.log(\"Debug Controller\", this, this.testTargets);\n }\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DetectDirtyController extends BaseController {\r\n\r\n initialValue: string | boolean | null = null;\r\n\r\n boundHandler = this.handler.bind(this);\r\n\r\n connect() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n if (this.isInputElement(element) && this.isCheckable(element)) {\r\n this.initialValue = element.checked;\r\n } else {\r\n this.initialValue = element.value;\r\n }\r\n element.addEventListener(\"input\", this.boundHandler);\r\n element.addEventListener(\"change\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n element.removeEventListener(\"input\", this.boundHandler);\r\n element.removeEventListener(\"change\", this.boundHandler);\r\n }\r\n\r\n restore() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n if (this.isInputElement(element) && this.isCheckable(element)) {\r\n element.checked = this.initialValue as boolean;\r\n } else {\r\n element.value = this.initialValue as string;\r\n }\r\n }\r\n\r\n private handler(event?: Event) {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n\r\n if (this.initialValue !== element.value) {\r\n element.setAttribute(\"data-dirty\", \"true\");\r\n } else {\r\n element.removeAttribute(\"data-dirty\");\r\n }\r\n }\r\n\r\n private isCheckable(element: HTMLInputElement): boolean {\r\n return (element.type === \"radio\" || element.type === \"checkbox\");\r\n }\r\n\r\n private isInputElement(element: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement): element is HTMLInputElement {\r\n return element.tagName === \"INPUT\";\r\n }\r\n\r\n}\r\n\r\nexport function isDirty(element: HTMLElement) {\r\n return element.hasAttribute(\"data-dirty\");\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DisableInputsController extends BaseController {\r\n\r\n static targets = [\"disabler\", \"disable\"];\r\n\r\n static values = {\r\n clear: Boolean,\r\n };\r\n\r\n declare readonly hasDisablerTarget: boolean;\r\n declare readonly disablerTarget: HTMLInputElement;\r\n declare readonly disableTargets: Array;\r\n declare readonly clearValue: boolean;\r\n declare readonly hasClearValue: boolean;\r\n\r\n connect() {\r\n this.toggle();\r\n }\r\n\r\n toggle() {\r\n if (this.hasDisablerTarget && this.disablerTarget.checked) {\r\n this.disableInputs();\r\n } else {\r\n this.enableInputs();\r\n }\r\n }\r\n\r\n disableInputs() {\r\n let shouldClear = this.hasClearValue && this.clearValue;\r\n this.disableTargets.forEach((el, _) => {\r\n if (shouldClear) {\r\n el.value = \"\";\r\n }\r\n el.disabled = true;\r\n });\r\n }\r\n\r\n enableInputs() {\r\n this.disableTargets.forEach((el, _) => {\r\n el.disabled = false;\r\n });\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DismissableController extends BaseController {\r\n\r\n\r\n dismiss() {\r\n this.element.remove();\r\n }\r\n\r\n}\r\n","import {useMutation} from \"stimulus-use\";\r\nimport {BaseController} from \"./base_controller\";\r\n\r\nexport class EmptyDomController extends BaseController {\r\n\r\n static classes = [\"empty\", \"notEmpty\"];\r\n static values = {scopeSelector: String};\r\n\r\n declare hasEmptyClass: boolean;\r\n declare emptyClass: string;\r\n declare hasNotEmptyClass: boolean;\r\n declare notEmptyClass: string;\r\n\r\n declare hasScopeSelectorValue: boolean;\r\n declare scopeSelectorValue: string;\r\n\r\n connect() {\r\n useMutation(this, {element: this.element, childList: true});\r\n this.checkEmpty();\r\n }\r\n\r\n mutate(entries: MutationRecord[]) {\r\n this.checkEmpty();\r\n }\r\n\r\n checkEmpty() {\r\n let children;\r\n if (this.hasScopeSelectorValue) {\r\n children = this.element.querySelectorAll(this.scopeSelectorValue);\r\n } else {\r\n children = this.element.children;\r\n }\r\n\r\n if (children.length === 0) {\r\n if (this.hasNotEmptyClass) {\r\n let classes = this.notEmptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.remove(klass));\r\n }\r\n if (this.hasEmptyClass) {\r\n let classes = this.emptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.add(klass));\r\n }\r\n this.element.dispatchEvent(\r\n new CustomEvent(\"dom:empty\", {\r\n bubbles: true,\r\n cancelable: true,\r\n }),\r\n );\r\n } else {\r\n if (this.hasNotEmptyClass) {\r\n let classes = this.notEmptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.add(klass));\r\n }\r\n if (this.hasEmptyClass) {\r\n let classes = this.emptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.remove(klass));\r\n }\r\n this.element.dispatchEvent(\r\n new CustomEvent(\"dom:not-empty\", {\r\n bubbles: true,\r\n cancelable: true,\r\n detail: {\r\n count: children.length,\r\n },\r\n }),\r\n );\r\n }\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class EnableInputsController extends BaseController {\r\n\r\n static targets = [\"enabler\", \"enable\"];\r\n\r\n static values = {\r\n clear: Boolean,\r\n };\r\n\r\n declare readonly hasEnablerTarget: boolean;\r\n declare readonly enablerTarget: HTMLInputElement;\r\n declare readonly enableTargets: Array;\r\n declare readonly clearValue: boolean;\r\n declare readonly hasClearValue: boolean;\r\n\r\n connect() {\r\n this.toggle();\r\n }\r\n\r\n toggle() {\r\n if (this.hasEnablerTarget && this.enablerTarget.checked) {\r\n this.enableInputs();\r\n } else {\r\n this.disableInputs();\r\n }\r\n }\r\n\r\n disableInputs() {\r\n let shouldClear = this.hasClearValue && this.clearValue;\r\n this.enableTargets.forEach((el, _) => {\r\n if (shouldClear) {\r\n el.value = \"\";\r\n }\r\n el.disabled = true;\r\n });\r\n }\r\n\r\n enableInputs() {\r\n this.enableTargets.forEach((el, _) => {\r\n el.disabled = false;\r\n });\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class FallbackImageController extends BaseController {\r\n\r\n static values = {placeholder: String};\r\n\r\n declare readonly placeholderValue: string;\r\n declare readonly hasPlaceholderValue: boolean;\r\n\r\n connect() {\r\n let element = this.element as HTMLImageElement;\r\n\r\n element.onerror = () => {\r\n if (this.hasPlaceholderValue) {\r\n element.src = this.placeholderValue;\r\n } else {\r\n element.style.display = \"none\";\r\n }\r\n };\r\n }\r\n\r\n}\r\n","import {useIntersection} from \"stimulus-use\";\nimport {IntersectionOptions} from \"stimulus-use/dist/use-intersection/use-intersection\";\nimport {AsyncBlockController} from \"./async_block_controller\";\n\nexport class LazyBlockController extends AsyncBlockController {\n\n declare observe: () => void;\n declare unobserve: () => void;\n declare options: IntersectionOptions;\n declare isVisible: boolean;\n declare disappear: () => void;\n\n connect() {\n let element = this.element;\n this.options = {element, threshold: 0.3};\n\n if (\"IntersectionObserver\" in window) {\n [this.observe, this.unobserve] = useIntersection(this, this.options);\n } else {\n // Client doesn't support intersection observer, fallback to pre-loading\n this.loadContent();\n }\n }\n\n appear(entry: IntersectionObserverEntry) {\n let element = this.element as HTMLImageElement;\n if (element.src !== \"\") {\n return;\n }\n if (entry.target === element && entry.isIntersecting) {\n this.loadContent();\n if (this.unobserve) {\n this.unobserve();\n }\n }\n }\n\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class LimitedSelectionCheckboxesController extends BaseController {\r\n\r\n static targets = [\"input\", \"error\"];\r\n static values = {max: Number, message: String};\r\n\r\n declare readonly hasErrorTarget: boolean;\r\n declare readonly errorTarget: HTMLElement;\r\n declare readonly inputTargets: HTMLInputElement[];\r\n declare readonly maxValue: number;\r\n declare readonly messageValue: string;\r\n\r\n maxSelections = 0;\r\n\r\n boundHandleInputs = this.handleInputs.bind(this);\r\n\r\n connect() {\r\n this.inputTargets.forEach((el) => el.addEventListener(\"change\", this.boundHandleInputs));\r\n }\r\n\r\n disconnect() {\r\n this.inputTargets.forEach((el) => el.removeEventListener(\"change\", this.boundHandleInputs));\r\n }\r\n\r\n handleInputs(event: Event) {\r\n let tickedInputs = this.inputTargets.reduce((previousValue, el) => el.checked ? previousValue + 1 : previousValue, 0);\r\n let target = event.target as HTMLInputElement;\r\n if (tickedInputs > this.maxSelections) {\r\n event.preventDefault();\r\n target.checked = false;\r\n target.dispatchEvent(new CustomEvent(\"change\", {bubbles: true, cancelable: true}));\r\n target.dispatchEvent(new CustomEvent(\"limited-selection:too-many\", {bubbles: true, cancelable: true, detail: {target}}));\r\n if (this.hasErrorTarget) {\r\n this.errorTarget.innerHTML = this.messageValue;\r\n }\r\n } else {\r\n target.dispatchEvent(new CustomEvent(\"limited-selection:selection\", {bubbles: true, cancelable: true, detail: {target}}));\r\n if (this.hasErrorTarget) {\r\n this.errorTarget.innerHTML = \"\";\r\n }\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class NestedFormController extends BaseController {\r\n static targets = ['target', 'template'];\r\n static values = {\r\n insertMode: String,\r\n wrapperClass: String,\r\n };\r\n\r\n declare readonly targetTarget: HTMLElement;\r\n declare readonly templateTarget: HTMLTemplateElement | HTMLScriptElement;\r\n\r\n declare readonly wrapperClassValue: string;\r\n declare readonly hasWrapperSelectorValue: boolean;\r\n declare readonly insertModeValue: InsertPosition;\r\n declare readonly hasInsertModeValue: boolean;\r\n\r\n get wrapperClass() {\r\n return this.hasWrapperSelectorValue ? this.wrapperClassValue : 'nested-fields';\r\n }\r\n\r\n get insertMode(): InsertPosition {\r\n return this.hasInsertModeValue ? this.insertModeValue : 'beforeend';\r\n }\r\n\r\n connect() {\r\n this.checkStructure();\r\n }\r\n\r\n add(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n\r\n const content = this.templateTarget.innerHTML.replace(/NEW_RECORD/g, this.generateID());\r\n this.targetTarget.insertAdjacentHTML(this.insertMode, content);\r\n }\r\n\r\n remove(event: Event) {\r\n event.preventDefault();\r\n const wrapper: HTMLElement | null = (event.target as HTMLElement).closest(this.wrapperClass);\r\n if (wrapper == null) {\r\n throw new Error(`#remove was clicked from outside of a child record. Could not find an ancestor with class ${this.wrapperClass}`);\r\n }\r\n\r\n if (wrapper.dataset.newRecord === 'true') {\r\n wrapper.remove();\r\n } else {\r\n wrapper.style.display = 'none';\r\n let destroyInput = wrapper.querySelector(\"input[name*='_destroy']\") as HTMLInputElement | null;\r\n if (destroyInput == null) {\r\n throw new Error(`Could not find a hidden input with name '_destroy'. NestedForm cannot remove an already persisted record without it.`);\r\n }\r\n\r\n destroyInput.value = \"1\";\r\n }\r\n }\r\n\r\n generateID(): string {\r\n return new Date().getTime().toString() + Math.random();\r\n }\r\n\r\n private checkStructure() {\r\n let template = this.templateTarget.innerHTML;\r\n\r\n if (template.indexOf('NEW_RECORD')) {\r\n throw new Error(\"Could not find 'NEW_RECORD' in the provided template. Please make sure you've passed `child_index: 'NEW_RECORD'` to `fields_for`\")\r\n }\r\n }\r\n}","import {BaseController} from \"./base_controller\";\r\n\r\nexport class PasswordConfirmController extends BaseController {\r\n\r\n static targets = [\"password\"];\r\n static classes = [\"error\"];\r\n\r\n declare readonly passwordTargets: HTMLInputElement[];\r\n\r\n declare readonly errorClass: string;\r\n declare readonly hasErrorClass: boolean;\r\n\r\n private boundCheckPasswordsMatch = this.checkPasswordsMatch.bind(this);\r\n\r\n connect() {\r\n this.passwordTargets.forEach((el) => el.addEventListener(\"change\", this.boundCheckPasswordsMatch));\r\n }\r\n\r\n disconnect() {\r\n this.passwordTargets.forEach((el) => el.removeEventListener(\"change\", this.boundCheckPasswordsMatch));\r\n }\r\n\r\n private allPasswordsMatch() {\r\n let values = new Set(this.passwordTargets.map(el => el.value)); // Create a unique set of the password values\r\n return values.has(\"\") || values.size == 1; // If any of the passwords are still blank, or there is only one distinct password value (i.e. they all are the same)\r\n }\r\n\r\n private checkPasswordsMatch() {\r\n if (this.allPasswordsMatch()) {\r\n this.element.dispatchEvent(new CustomEvent(\"password-confirm:match\"));\r\n if (this.hasErrorClass) {\r\n this.passwordTargets.forEach(el => el.classList.remove(this.errorClass));\r\n }\r\n } else {\r\n this.element.dispatchEvent(new CustomEvent(\"password-confirm:no-match\"));\r\n if (this.hasErrorClass) {\r\n this.passwordTargets.forEach(el => el.classList.add(this.errorClass));\r\n }\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class PasswordPeekController extends BaseController {\r\n\r\n static targets = [\"password\"];\r\n\r\n declare readonly passwordTarget: HTMLInputElement;\r\n\r\n\r\n peak(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n this.passwordTarget.type = \"text\";\r\n }\r\n\r\n hide(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n this.passwordTarget.type = \"password\";\r\n }\r\n\r\n toggle(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n if (this.passwordTarget.type === \"password\") {\r\n this.peak();\r\n } else {\r\n this.hide();\r\n }\r\n }\r\n}\r\n","import {useDebounce, useWindowResize} from \"stimulus-use\";\nimport {WindowResizePayload} from \"stimulus-use/dist/use-window-resize/use-window-resize\";\nimport {BaseController} from \"./base_controller\";\n\ninterface ResponsiveIframeMessage {\n name: string,\n height: number,\n}\n\nexport class ResponsiveIframeWrapperController extends BaseController {\n\n boundMessageReceived = this.messageReceived.bind(this);\n\n connect() {\n window.addEventListener(\"message\", this.boundMessageReceived);\n }\n\n disconnect() {\n window.removeEventListener(\"message\", this.boundMessageReceived);\n }\n\n messageReceived(message: MessageEvent) {\n let data = message.data;\n if (data.hasOwnProperty(\"name\") && data.name === \"iframe-body\" && data.hasOwnProperty(\"height\")) {\n this.resize(data.height);\n }\n }\n\n resize(height: number) {\n (this.element as HTMLIFrameElement).style.height = `${height}px`;\n }\n\n}\n\nexport class ResponsiveIframeBodyController extends BaseController {\n\n static debounces = [\"postUpdate\"];\n\n declare observe: () => void;\n declare unobserve: () => void;\n\n connect() {\n // If this Window is inside a frame\n if (window.self !== window.top) {\n useWindowResize(this);\n useDebounce(this, {});\n this.postUpdate();\n } else {\n // Not an iframe\n }\n }\n\n windowResize(payload: WindowResizePayload) {\n this.postUpdate();\n };\n\n postUpdate() {\n let payload: ResponsiveIframeMessage = {name: \"iframe-body\", height: this.getHeight()};\n window.parent.postMessage(\n payload,\n \"*\",\n );\n }\n\n getHeight(): number {\n const body = document.body;\n const html = document.documentElement;\n\n // Get the largest height out of body and html's various height measurements\n return Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);\n }\n\n}\n","import camelCase from \"lodash.camelcase\";\r\nimport {BaseController} from \"../base_controller\";\r\n\r\nexport class EphemeralController extends BaseController {\r\n\r\n cleanupSelf() {\r\n this.cleanup(this.element as HTMLElement);\r\n }\r\n\r\n cleanup(element: HTMLElement) {\r\n element.dataset.controller = element.dataset.controller?.replaceAll(new RegExp(`(\\s|^)${this.identifier}(\\s|$)`, \"g\"), \"\") || \"\";\r\n if (element.dataset.controller == \"\") {\r\n // If there are no controllers left, remove the attribute\r\n delete element.dataset.controller;\r\n }\r\n\r\n let substringIdentifierValueRegex = new RegExp(`(\\s|^)${this.identifier}\\\\..+?(\\s|$)`, \"g\");\r\n element.dataset.target = element.dataset.target?.replaceAll(substringIdentifierValueRegex, \"\") || \"\";\r\n delete element.dataset[camelCase(`${this.identifier}-target`)];\r\n if (element.dataset.target == \"\") {\r\n // If there are no targets left, remove the attribute\r\n delete element.dataset.target;\r\n }\r\n\r\n element.dataset.action = element.dataset.target?.replaceAll(substringIdentifierValueRegex, \"\") || \"\";\r\n delete element.dataset[camelCase(`${this.identifier}-action`)];\r\n if (element.dataset.action == \"\") {\r\n // If there are no actions left, remove the attribute\r\n delete element.dataset.action;\r\n }\r\n\r\n // @ts-ignore\r\n let values = this.constructor.values;\r\n if (values) {\r\n Object.keys(values).forEach(val => delete element.dataset[camelCase(`${this.identifier}-${val}-value`)]);\r\n }\r\n\r\n // @ts-ignore\r\n let classes = this.constructor.classes;\r\n if (classes) {\r\n Object.keys(classes).forEach(val => delete element.dataset[camelCase(`${this.identifier}-${val}-class`)]);\r\n }\r\n }\r\n\r\n}\r\n","const smoothSupported = \"scrollBehavior\" in document.documentElement.style;\r\nlet smoothPolyfilled: boolean;\r\n\r\nexport async function scrollToElement(element: Element, {behavior = \"smooth\", block = \"start\", inline = \"nearest\"}: ScrollIntoViewOptions = {}) {\r\n if (behavior == \"smooth\" && !smoothSupported) {\r\n await polyfillSmooth();\r\n }\r\n element.scrollIntoView({behavior, block, inline});\r\n}\r\n\r\nasync function polyfillSmooth() {\r\n const {polyfill} = await import(/* webpackChunkName: \"smoothscroll-polyfill\" */ \"smoothscroll-polyfill\");\r\n if (smoothPolyfilled) {\r\n return;\r\n }\r\n smoothPolyfilled = true;\r\n polyfill();\r\n}\r\n\r\nexport function getScrollParent(node: HTMLElement | null): HTMLElement | null {\r\n if (!node) {\r\n return null;\r\n }\r\n const overflowY = getComputedStyle(node).overflowY;\r\n const isScrollable = overflowY !== \"visible\" && overflowY !== \"hidden\";\r\n\r\n if (isScrollable && node.scrollHeight >= node.clientHeight) {\r\n return node;\r\n }\r\n\r\n return getScrollParent(node.parentElement) || document.body;\r\n}\r\n","import {EphemeralController} from \"./utilities/ephemeral_controller\";\r\nimport {scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollIntoFocusController extends EphemeralController {\r\n\r\n static values = {\r\n behavior: String,\r\n block: String,\r\n inline: String,\r\n };\r\n\r\n declare behaviorValue: ScrollBehavior;\r\n declare hasBehaviorValue: boolean;\r\n declare blockValue: ScrollLogicalPosition;\r\n declare hasBlockValue: boolean;\r\n declare inlineValue: ScrollLogicalPosition;\r\n declare hasInlineValue: boolean;\r\n\r\n connect() {\r\n requestAnimationFrame(() => {\r\n // Attempt smooth scrolling, with polyfill\r\n scrollToElement(\r\n this.element,\r\n {\r\n behavior: this.hasBehaviorValue ? this.behaviorValue : \"smooth\",\r\n block: this.hasBlockValue ? this.blockValue : \"center\",\r\n inline: this.hasInlineValue ? this.inlineValue : \"center\",\r\n },\r\n ).catch(() => this.element.scrollIntoView()); // Fallback to snap-scrolling\r\n this.cleanupSelf();\r\n });\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\nimport {getScrollParent, scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollToBottomController extends BaseController {\r\n\r\n static values = {\r\n mode: String,\r\n };\r\n\r\n declare modeValue: \"nearest\" | \"document\";\r\n declare hasModeValue: boolean;\r\n\r\n\r\n scroll(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n let mode = this.hasModeValue ? this.modeValue : \"document\";\r\n let target: null | HTMLElement;\r\n if (mode == \"document\") {\r\n target = document.body;\r\n } else {\r\n target = getScrollParent(this.element as HTMLElement);\r\n }\r\n if (target == null) {\r\n return;\r\n }\r\n scrollToElement(target!, {behavior: \"smooth\", block: \"end\"}).catch(() => target!.scrollIntoView(false));\r\n }\r\n\r\n}\r\n\r\n","import {BaseController} from \"./base_controller\";\r\nimport {scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollToController extends BaseController {\r\n\r\n static values = {\r\n selector: String,\r\n behavior: String,\r\n block: String,\r\n inline: String,\r\n };\r\n\r\n declare selectorValue: string;\r\n declare behaviorValue: ScrollBehavior;\r\n declare hasBehaviorValue: boolean;\r\n declare blockValue: ScrollLogicalPosition;\r\n declare hasBlockValue: boolean;\r\n declare inlineValue: ScrollLogicalPosition;\r\n declare hasInlineValue: boolean;\r\n\r\n\r\n scroll() {\r\n let target = document.querySelector(this.selectorValue);\r\n if (!target) {\r\n console.warn(`Could not find target for '${this.selectorValue}'`);\r\n return;\r\n }\r\n\r\n scrollToElement(\r\n target!,\r\n {\r\n behavior: this.hasBehaviorValue ? this.behaviorValue : \"smooth\",\r\n block: this.hasBlockValue ? this.blockValue : \"center\",\r\n inline: this.hasInlineValue ? this.inlineValue : \"center\",\r\n },\r\n ).catch(() => target!.scrollIntoView()); // Fallback to snap-scrolling\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\nimport {getScrollParent, scrollToElement} from \"./utilities/scroll\";\n\nexport class ScrollToTopController extends BaseController {\n\n static values = {\n mode: String,\n };\n\n declare modeValue: \"nearest\" | \"document\";\n declare hasModeValue: boolean;\n\n\n scroll(event?: Event) {\n if (event) {\n event.preventDefault();\n }\n let mode = this.hasModeValue ? this.modeValue : \"document\";\n let target: null | HTMLElement;\n if (mode == \"document\") {\n target = document.body;\n } else {\n target = getScrollParent(this.element as HTMLElement);\n }\n if (target == null) {\n return;\n }\n scrollToElement(target!, {behavior: \"smooth\", block: \"start\"}).catch(() => target!.scrollIntoView(false));\n }\n\n}\n\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class SelfDestructController extends BaseController {\r\n\r\n static values = {seconds: Number};\r\n\r\n declare readonly secondsValue: number;\r\n timeout: null | ReturnType = null;\r\n\r\n connect() {\r\n requestAnimationFrame(() => {\r\n // Only start countdown on first paint\r\n this.timeout = setTimeout(() => this.element.remove(), this.secondsValue * 1000);\r\n });\r\n }\r\n\r\n disconnect() {\r\n if (this.timeout) {\r\n clearTimeout(this.timeout);\r\n }\r\n }\r\n\r\n}\r\n","import {EphemeralController} from \"./utilities/ephemeral_controller\";\r\n\r\nexport class TeleportController extends EphemeralController {\r\n\r\n static values = {target: String, insert: String, immediate: Boolean};\r\n\r\n declare readonly immediateValue: boolean;\r\n declare readonly hasImmediateValue: boolean;\r\n declare readonly targetValue: string;\r\n declare readonly hasInsertValue: boolean;\r\n declare readonly insertValue: InsertPosition | \"replaceOuter\" | \"replaceInner\" | \"prepend\" | \"append\";\r\n\r\n connect() {\r\n if (!this.hasInsertValue) {\r\n throw new Error(\"`insert` value was not specified\");\r\n }\r\n\r\n requestAnimationFrame(() => {\r\n if (this.hasImmediateValue && this.immediateValue) {\r\n this.execute();\r\n }\r\n });\r\n }\r\n\r\n execute(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n let destination = document.querySelector(this.targetValue);\r\n\r\n if (destination == null) {\r\n this.element.dispatchEvent(new CustomEvent(\"teleport:error\", {bubbles: true, cancelable: true}));\r\n return;\r\n }\r\n\r\n let copy = this.element.cloneNode(true) as HTMLElement;\r\n this.cleanup(copy);\r\n\r\n switch (this.insertValue) {\r\n case \"beforebegin\":\r\n case \"beforeend\":\r\n case \"afterend\":\r\n case \"afterbegin\":\r\n destination.insertAdjacentHTML(this.insertValue, copy.outerHTML);\r\n break;\r\n case \"replaceOuter\":\r\n destination.outerHTML = copy.outerHTML;\r\n break;\r\n case \"replaceInner\":\r\n destination.innerHTML = copy.outerHTML;\r\n break;\r\n case \"prepend\":\r\n destination.insertAdjacentHTML(\"afterbegin\", copy.outerHTML);\r\n break;\r\n case \"append\":\r\n destination.insertAdjacentHTML(\"beforeend\", copy.outerHTML);\r\n break;\r\n default:\r\n throw new Error(\"`insert` value was not specified\");\r\n\r\n }\r\n this.element.remove();\r\n }\r\n\r\n}\r\n","import {useClickOutside, useHover} from \"stimulus-use\";\nimport {BaseController} from \"./base_controller\";\n\nexport type ToggleClassMode = \"on\" | \"off\" | \"toggle\"\n\nexport class ToggleClassController extends BaseController {\n\n static targets = [\"toggle\"];\n static values = {\n class: String,\n mouseEnter: String,\n mouseLeave: String,\n clickAway: Boolean,\n initial: String,\n };\n\n declare readonly toggleTargets: HTMLElement[];\n\n declare readonly classValue: string;\n declare readonly hasClassValue: boolean;\n\n declare readonly mouseEnterValue: ToggleClassMode;\n declare readonly hasMouseEnterValue: boolean;\n\n declare readonly mouseLeaveValue: ToggleClassMode;\n declare readonly hasMouseLeaveValue: boolean;\n\n declare readonly clickAwayValue: boolean;\n declare readonly hasClickAwayValue: boolean;\n\n declare readonly initialValue: \"on\" | \"off\";\n declare readonly hasInitialValue: boolean;\n\n connect() {\n if (!this.hasClassValue) {\n throw new Error(\"data-toggle-class-class-value must not be empty\");\n }\n\n if (this.hasMouseEnterValue || this.hasMouseLeaveValue) {\n useHover(this);\n }\n\n if (this.hasClickAwayValue && this.clickAwayValue) {\n useClickOutside(this);\n }\n\n requestAnimationFrame(() => {\n if (this.hasInitialValue) {\n if (this.initialValue === \"on\") {\n this.toggleTargets.forEach((target) => this.elementOn(target));\n } else {\n this.toggleTargets.forEach((target) => this.elementOff(target));\n }\n }\n });\n }\n\n clickOutside() {\n this.toggleTargets.forEach((target) => {\n if (this.elementWasToggled(target)) {\n this.elementToggleStatus(target);\n this.elementToggle(target);\n }\n });\n }\n\n mouseEnter() {\n if (this.hasMouseEnterValue) {\n switch (this.mouseEnterValue) {\n case \"on\":\n this.on();\n break;\n case \"off\":\n this.off();\n break;\n case \"toggle\":\n this.toggle();\n break;\n }\n }\n return {};\n }\n\n mouseLeave() {\n if (this.hasMouseLeaveValue) {\n switch (this.mouseLeaveValue) {\n case \"on\":\n this.on();\n break;\n case \"off\":\n this.off();\n break;\n case \"toggle\":\n this.toggle();\n break;\n }\n }\n return {};\n }\n\n on(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementOn(target);\n });\n }\n\n off(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementOff(target);\n });\n }\n\n toggle(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementToggle(target);\n });\n }\n\n private elementWasToggled(el: HTMLElement): boolean {\n return el.dataset.toggled == \"true\";\n }\n\n private elementToggleStatus(el: HTMLElement) {\n if (this.elementWasToggled(el)) {\n delete el.dataset.toggled;\n } else {\n el.dataset.toggled = \"true\";\n }\n }\n\n private elementToggle(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass));\n }\n\n private elementOn(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass, true));\n }\n\n private elementOff(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass, false));\n }\n\n}\n","import {BaseController} from \"./base_controller\";\nimport {isHTMLLinkElement} from \"./utilities/elements\";\nimport {isTurboFrame} from \"./utilities/turbo\";\n\nexport class TurboFrameRCController extends BaseController {\n\n static values = {\n frameId: String,\n src: String,\n loadingMessage: String,\n };\n\n declare readonly frameIdValue: string;\n declare readonly srcValue: string;\n declare readonly hasSrcValue: boolean;\n declare readonly loadingMessageValue: string;\n declare readonly hasLoadingMessageValue: boolean;\n\n toggle(event?: Event | null) {\n if (event) {\n event.preventDefault();\n }\n let frame = this.getFrame();\n let frameSrc = frame.src;\n if (frameSrc == null || frameSrc !== this.getSrc()) {\n this.setSrc();\n } else {\n this.clear();\n }\n }\n\n setSrc(event?: Event | null) {\n if (event) {\n event.preventDefault();\n }\n let frame = this.getFrame();\n if (this.hasLoadingMessageValue) {\n frame.innerHTML = this.loadingMessageValue;\n }\n\n frame.src = this.getSrc();\n }\n\n clear(event?: Event | null) {\n if (event) {\n event.preventDefault();\n }\n let frame = this.getFrame();\n frame.src = \"\";\n frame.innerHTML = \"\";\n }\n\n private getFrame(): TurboFrame {\n let frame = document.getElementById(`${this.frameIdValue}`);\n if (frame == null) {\n throw new Error(`Could not find frame with ID '${this.frameIdValue}'`);\n }\n if (!isTurboFrame(frame)) {\n throw new Error(`Element targeted by ID '${this.frameIdValue}'`);\n } else {\n return frame;\n }\n }\n\n private getSrc(): string {\n let element = this.element as HTMLElement;\n if (this.hasSrcValue) {\n return this.srcValue;\n } else if (isHTMLLinkElement(element)) {\n return element.href;\n } else {\n throw new Error(\"No link given to drive frame to\");\n }\n }\n\n}\n","export function isTurboFrame(element: HTMLElement): element is TurboFrame {\r\n return element.nodeName == \"TURBO-FRAME\";\r\n}\r\n","export function isHTMLLinkElement(element: Element): element is HTMLLinkElement {\n return element.nodeName == \"A\";\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class WordCountController extends BaseController {\r\n\r\n static targets = [\"input\", \"output\"];\r\n static values = {min: Number, max: Number};\r\n static classes = [\"error\"];\r\n\r\n declare readonly inputTarget: HTMLInputElement | HTMLTextAreaElement;\r\n declare readonly outputTarget: HTMLElement;\r\n declare minValue: number;\r\n declare hasMinValue: boolean;\r\n declare maxValue: number;\r\n declare hasMaxValue: boolean;\r\n declare errorClass: string;\r\n declare hasErrorClass: boolean;\r\n\r\n boundHandler = this.updateWordCount.bind(this);\r\n\r\n connect() {\r\n this.updateWordCount();\r\n this.inputTarget.addEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n this.inputTarget.removeEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n updateWordCount() {\r\n let wordCount = 0;\r\n let textAreaValue = this.inputTarget.value;\r\n let matches = textAreaValue.match(/\\S+/g);\r\n wordCount = (matches && matches.length) || 0;\r\n this.outputTarget.innerText = wordCount.toString();\r\n if (this.hasErrorClass) {\r\n if (this.isValidCount(wordCount)) {\r\n this.outputTarget.classList.remove(this.errorClass);\r\n } else {\r\n this.outputTarget.classList.add(this.errorClass);\r\n }\r\n }\r\n }\r\n\r\n isValidCount(count: number) {\r\n let min = 0;\r\n let max = 99999;\r\n\r\n if (this.hasMinValue) {\r\n min = this.minValue;\r\n }\r\n\r\n if (this.hasMaxValue) {\r\n max = this.maxValue;\r\n }\r\n\r\n return count >= min && count <= max;\r\n }\r\n\r\n}\r\n"],"names":["BaseController","Controller","constructor","context","super","Proxy","this","get","obj","prop","returnVal","Reflect","self","test","logProperty","toString","apply","target","thisArg","argArray","log","args","functionName","application","debug","logger","console","groupCollapsed","identifier","element","groupEnd","AsyncBlockController","connect","loadContent","el","hasReplaceTarget","replaceTarget","fetch","endpointValue","then","response","text","html","newEl","document","createElement","innerHTML","replaceWith","event","CustomEvent","detail","dispatchEvent","catch","err","finally","endpoint","String","AutoSubmitFormController","handler","bind","querySelectorAll","forEach","addEventListener","boundHandler","disconnect","removeEventListener","e","bubbles","cancelable","method","controller","methodName","composeEventName","name","eventPrefix","composedName","extendedEvent","type","composed","Object","assign","originalEvent","defaultOptions","events","onlyVisible","StimulusUse","[object Object]","options","_a","_b","_c","controllerId","stimulusUseDebug","id","dataset","controllerInitialize","initialize","controllerConnect","controllerDisconnect","UseHover","observe","targetElement","onEnter","onLeave","unobserve","call","hover","enhanceController","UseMutation","observer","error","handleError","mutation","entries","MutationObserver","useWindowResize","callback","innerWidth","innerHeight","window","payload","height","Infinity","width","debounce","fn","wait","timeoutId","arguments","clearTimeout","setTimeout","AutosizeController","style","resize","boxSizing","requestAnimationFrame","windowResize","autosize","offset","offsetHeight","clientHeight","scrollHeight","CharCountController","updateCharCount","inputTarget","charCount","value","length","outputTarget","innerText","hasErrorClass","isValidCount","classList","remove","errorClass","add","count","min","max","hasMinValue","minValue","hasMaxValue","maxValue","Number","ClipboardController","supported","queryCommandSupported","hasRemoveUnusedValue","removeUnusedValue","hasFallbackTarget","fallbackTarget","hasCopyTarget","copyTarget","select","preventDefault","sourceTarget","copy","execCommand","removeUnused","Boolean","ConfirmNavigationController","confirmMessage","messageValue","onbeforeunload","handlePopstate","message","DebugController","testTargets","DetectDirtyController","initialValue","isInputElement","isCheckable","checked","restore","setAttribute","removeAttribute","tagName","DisableInputsController","toggle","hasDisablerTarget","disablerTarget","disableInputs","enableInputs","shouldClear","hasClearValue","clearValue","disableTargets","_","disabled","clear","DismissableController","dismiss","EmptyDomController","useMutation","childList","checkEmpty","mutate","children","hasScopeSelectorValue","scopeSelectorValue","hasNotEmptyClass","notEmptyClass","split","klass","hasEmptyClass","emptyClass","scopeSelector","EnableInputsController","hasEnablerTarget","enablerTarget","enableTargets","FallbackImageController","onerror","hasPlaceholderValue","src","placeholderValue","display","placeholder","LazyBlockController","threshold","IntersectionObserver","entry","isIntersecting","isVisible","eventName","appearEvent","dispatchAppear","disappearEvent","dispatchDisappear","useIntersection","appear","LimitedSelectionCheckboxesController","handleInputs","inputTargets","boundHandleInputs","tickedInputs","reduce","previousValue","maxSelections","hasErrorTarget","errorTarget","NestedFormController","wrapperClass","hasWrapperSelectorValue","wrapperClassValue","insertMode","hasInsertModeValue","insertModeValue","checkStructure","content","templateTarget","replace","generateID","targetTarget","insertAdjacentHTML","wrapper","closest","Error","newRecord","destroyInput","querySelector","Date","getTime","Math","random","indexOf","PasswordConfirmController","checkPasswordsMatch","passwordTargets","boundCheckPasswordsMatch","allPasswordsMatch","values","Set","map","has","size","PasswordPeekController","peak","passwordTarget","hide","ResponsiveIframeWrapperController","messageReceived","boundMessageReceived","data","hasOwnProperty","ResponsiveIframeBodyController","top","debounces","func","postUpdate","getHeight","parent","postMessage","body","documentElement","EphemeralController","cleanupSelf","cleanup","replaceAll","RegExp","substringIdentifierValueRegex","camelCase","action","keys","val","classes","smoothSupported","smoothPolyfilled","scrollToElement","behavior","block","inline","async","polyfill","polyfillSmooth","scrollIntoView","getScrollParent","node","overflowY","getComputedStyle","parentElement","ScrollIntoFocusController","hasBehaviorValue","behaviorValue","hasBlockValue","blockValue","hasInlineValue","inlineValue","ScrollToBottomController","scroll","hasModeValue","modeValue","mode","ScrollToController","selectorValue","warn","selector","ScrollToTopController","SelfDestructController","timeout","secondsValue","seconds","TeleportController","hasInsertValue","hasImmediateValue","immediateValue","execute","destination","targetValue","cloneNode","insertValue","outerHTML","insert","immediate","ToggleClassController","hasClassValue","hasMouseEnterValue","hasMouseLeaveValue","useHover","hasClickAwayValue","clickAwayValue","onEvent","contains","rect","getBoundingClientRect","windowHeight","windowWidth","clientWidth","left","isElementInViewport","clickOutside","clickOutsideEvent","useClickOutside","hasInitialValue","toggleTargets","elementOn","elementOff","elementWasToggled","elementToggleStatus","elementToggle","mouseEnter","mouseEnterValue","on","off","mouseLeave","mouseLeaveValue","toggled","classValue","class","clickAway","initial","TurboFrameRCController","frameSrc","getFrame","getSrc","setSrc","frame","hasLoadingMessageValue","loadingMessageValue","getElementById","frameIdValue","nodeName","hasSrcValue","srcValue","isHTMLLinkElement","href","frameId","loadingMessage","WordCountController","updateWordCount","wordCount","matches","match"],"mappings":"2RAEaA,UAAuBC,EAElCC,YAAYC,GAEV,OADAC,MAAMD,OACKE,MAAMC,KAAM,CACrBC,IAAK,CAACC,EAAKC,KACT,IAAIC,EAAYC,QAAQJ,IAAIC,EAAKC,GAC7BG,EAAON,KACX,GAmCR,SAAqBG,GACnB,OAAQA,GACN,IAAK,cACL,IAAK,UACL,IAAK,cACL,IAAK,aACL,IAAK,MACL,IAAK,OACL,IAAK,qBACL,IAAK,aACH,SAGJ,QAAI,kBAAkBI,KAAKJ,IAGvB,aAAaI,KAAKJ,IAGlB,oBAAoBI,KAAKJ,IAGzB,aAAaI,KAAKJ,IAzDZK,CAAYL,EAAKM,YAAa,CAChC,GAAwB,mBAAbL,EACT,WAAWL,MAAMK,EAAW,CAC1BM,MAAK,CAACC,EAAaC,EAAcC,KAC/BP,EAAKQ,IAAIX,EAAKM,WAAY,CACxBM,KAAMF,IAEDR,QAAQK,MAAMC,EAAQC,EAASC,MAI1Cb,KAAKc,IAAIX,EAAKM,YAGlB,OAAOL,KAKbU,IAAIE,EAAsBD,EAAW,IAEnC,IAAKf,KAAKiB,YAAYC,MACpB,OAEF,IAAIC,EAASC,QACbD,EAAOE,oBAAoBrB,KAAKsB,iBAAiBN,IAAgB,iBAAkB,gBACnFG,EAAOL,OACLS,QAASvB,KAAKuB,SACXR,IAELI,EAAOK,kBCtCEC,UAA6B/B,EAYxCgC,UACE1B,KAAK2B,cAGPA,cACE,IAAIC,EAAM5B,KAAK6B,iBAAmB7B,KAAK8B,cAAgB9B,KAAKuB,QAC5DQ,MAAM/B,KAAKgC,eACVC,KAAMC,GAAaA,EAASC,QAC5BF,KAAMG,IACL,IAAIC,EAAQC,SAASC,cAAc,OACnCF,EAAMG,UAAYJ,EAClBR,EAAGa,YAAYJ,GAGf,IAAIK,EAAQ,IAAIC,YAAY,eAAgB,CAACC,OAAU,KACvDhB,EAAGiB,cAAcH,KAElBI,MAAM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,KAApBA,EAAQwY,SFmEFG,CAAkB3Y,GAC3B,OAAOA,EAAQ4Y,KAEf,UAAUpJ,MAAM,oCAjEbsI,SAAS,CACde,QAASlX,OACTkL,IAAKlL,OACLmX,eAAgBnX,cGPPoX,UAA4B5a,EAAzCE,kCAeEI,kBAAeA,KAAKua,gBAAgBlX,KAAKrD,MAEzC0B,UACE1B,KAAKua,kBACLva,KAAK0I,YAAYlF,iBAAiB,QAASxD,KAAKyD,cAGlDC,aACE1D,KAAK0I,YAAY/E,oBAAoB,QAAS3D,KAAKyD,cAGrD8W,kBACE,IAAIC,EAAY,EAEZC,EADgBza,KAAK0I,YAAYE,MACT8R,MAAM,QAClCF,EAAaC,GAAWA,EAAQ5R,QAAW,EAC3C7I,KAAK8I,aAAaC,UAAYyR,EAAU/Z,WACpCT,KAAKgJ,gBACHhJ,KAAKiJ,aAAauR,GACpBxa,KAAK8I,aAAaI,UAAUC,OAAOnJ,KAAKoJ,YAExCpJ,KAAK8I,aAAaI,UAAUG,IAAIrJ,KAAKoJ,aAK3CH,aAAaK,GACX,IAAIC,EAAM,EACNC,EAAM,MAUV,OARIxJ,KAAKyJ,cACPF,EAAMvJ,KAAK0J,UAGT1J,KAAK2J,cACPH,EAAMxJ,KAAK4J,UAGNN,GAASC,GAAOD,GAASE,GAnD3B8Q,UAAU,CAAC,QAAS,UACpBA,SAAS,CAAC/Q,IAAKM,OAAQL,IAAKK,QAC5ByQ,UAAU,CAAC"} \ No newline at end of file diff --git a/dist/stimulus-library.module.js b/dist/stimulus-library.module.js index da01600a..78635819 100644 --- a/dist/stimulus-library.module.js +++ b/dist/stimulus-library.module.js @@ -1,2 +1,2 @@ -import{Controller as e}from"stimulus";import t from"lodash.camelcase";function n(){return(n=Object.assign||function(e){for(var t=1;t{const n=e[t];return"function"==typeof n?n:(...e)=>{}},c=(e,t,n)=>{let i=e;return!0===n?i=`${t.identifier}:${e}`:"string"==typeof n&&(i=`${n}:${e}`),i},u=(e,t,n)=>{const{bubbles:i,cancelable:r,composed:s}=t||{bubbles:!0,cancelable:!0,composed:!0};return t&&Object.assign(n,{originalEvent:t}),new CustomEvent(e,{bubbles:i,cancelable:r,composed:s,detail:n})},h={dispatchEvent:!0,eventPrefix:!0},d={events:["click","touchend"],onlyVisible:!0,dispatchEvent:!0,eventPrefix:!0},p={debug:!1,logger:console};class f{constructor(e,t={}){var n,i,r;this.log=(e,t)=>{this.debug&&(this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${e}`,"color: #3B82F6","color: unset"),this.logger.log(Object.assign({controllerId:this.controllerId},t)),this.logger.groupEnd())},this.debug=null!==(i=null!==(n=null==t?void 0:t.debug)&&void 0!==n?n:e.application.stimulusUseDebug)&&void 0!==i?i:p.debug,this.logger=null!==(r=null==t?void 0:t.logger)&&void 0!==r?r:p.logger,this.controller=e,this.controllerId=e.element.id||e.element.dataset.id,this.controllerInitialize=e.initialize.bind(e),this.controllerConnect=e.connect.bind(e),this.controllerDisconnect=e.disconnect.bind(e)}}class v extends f{constructor(e,t={}){super(e,t),this.observe=()=>{this.targetElement.addEventListener("mouseenter",this.onEnter),this.targetElement.addEventListener("mouseleave",this.onLeave)},this.unobserve=()=>{this.targetElement.removeEventListener("mouseenter",this.onEnter),this.targetElement.removeEventListener("mouseleave",this.onLeave)},this.onEnter=()=>{l(this.controller,"mouseEnter").call(this.controller),this.log("mouseEnter",{hover:!0})},this.onLeave=()=>{l(this.controller,"mouseLeave").call(this.controller),this.log("mouseLeave",{hover:!1})},this.targetElement=(null==t?void 0:t.element)||e.element,this.controller=e,this.enhanceController(),this.observe()}enhanceController(){const e=this.controller.disconnect.bind(this.controller);Object.assign(this.controller,{disconnect:()=>{this.unobserve(),e()}})}}class g extends f{constructor(e,t={}){super(e,t),this.observe=()=>{try{this.observer.observe(this.targetElement,this.options)}catch(e){this.controller.application.handleError(e,"At a minimum, one of childList, attributes, and/or characterData must be true",{})}},this.unobserve=()=>{this.observer.disconnect()},this.mutation=e=>{l(this.controller,"mutate").call(this.controller,e),this.log("mutate",{entries:e})},this.targetElement=(null==t?void 0:t.element)||e.element,this.controller=e,this.options=t,this.observer=new MutationObserver(this.mutation),this.enhanceController(),this.observe()}enhanceController(){const e=this.controller.disconnect.bind(this.controller);Object.assign(this.controller,{disconnect:()=>{this.unobserve(),e()}})}}const m=e=>{const t=t=>{const{innerWidth:n,innerHeight:i}=window,r={height:i||Infinity,width:n||Infinity,event:t};l(e,"windowResize").call(e,r)},n=e.disconnect.bind(e),i=()=>{window.addEventListener("resize",t),t()},r=()=>{window.removeEventListener("resize",t)};return Object.assign(e,{disconnect(){r(),n()}}),i(),[i,r]},b=(e,t=200)=>{let n=null;return function(){const i=arguments,r=this,s=()=>e.apply(r,i);n&&clearTimeout(n),n=setTimeout(s,t)}};var E=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundHandler=t.handler.bind(r(t)),t}i(t,e);var n=t.prototype;return n.connect=function(){var e=this.element;e.style.resize="none",e.style.boxSizing="border-box",e.addEventListener("input",this.boundHandler),e.addEventListener("focus",this.boundHandler),m(this),requestAnimationFrame(this.boundHandler)},n.windowResize=function(){this.handler()},n.handler=function(){this.autosize(this.element)},n.autosize=function(e){var t=e.offsetHeight-e.clientHeight;e.style.height="auto",e.style.height=e.scrollHeight+t+"px"},t}(s),y=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundHandler=t.updateCharCount.bind(r(t)),t}i(t,e);var n=t.prototype;return n.connect=function(){this.updateCharCount(),this.inputTarget.addEventListener("input",this.boundHandler)},n.disconnect=function(){this.inputTarget.removeEventListener("input",this.boundHandler)},n.updateCharCount=function(){var e=this.inputTarget.value.length;this.outputTarget.innerText=e.toString(),this.hasErrorClass&&(this.isValidCount(e)?this.outputTarget.classList.remove(this.errorClass):this.outputTarget.classList.add(this.errorClass))},n.isValidCount=function(e){var t=0,n=99999;return this.hasMinValue&&(t=this.minValue),this.hasMaxValue&&(n=this.maxValue),e>=t&&e<=n},t}(s);y.targets=["input","output"],y.values={min:Number,max:Number},y.classes=["error"];var w=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).supported=!1,t}i(t,e);var n=t.prototype;return n.connect=function(){this.supported=document.queryCommandSupported("copy"),this.hasRemoveUnusedValue&&this.removeUnusedValue&&(this.supported&&this.hasFallbackTarget?this.fallbackTarget.remove():this.hasCopyTarget&&this.copyTarget.remove())},n.select=function(e){e&&e.preventDefault(),this.sourceTarget.select()},n.copy=function(e){e&&e.preventDefault(),this.sourceTarget.select(),this.supported&&document.execCommand("copy")},t}(s);w.targets=["button","copy","fallback"],w.values={removeUnused:Boolean};var V=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.connect=function(){var e=this,t=this.messageValue;window.onbeforeunload=function(){return null==t||t},window.addEventListener("popstate",this.handlePopstate),window.addEventListener("submit",function(){window.removeEventListener("popstate",e.handlePopstate),window.onbeforeunload=null})},n.handlePopstate=function(e){return!1},t}(s);V.values={message:String};var T=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.connect=function(){console.log("Debug Controller",this,this.testTargets)},t}(s);T.targets=["test"];var C=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).initialValue=null,t.boundHandler=t.handler.bind(r(t)),t}i(t,e);var n=t.prototype;return n.connect=function(){var e=this.element;this.initialValue=this.isInputElement(e)&&this.isCheckable(e)?e.checked:e.value,e.addEventListener("input",this.boundHandler),e.addEventListener("change",this.boundHandler)},n.disconnect=function(){var e=this.element;e.removeEventListener("input",this.boundHandler),e.removeEventListener("change",this.boundHandler)},n.restore=function(){var e=this.element;this.isInputElement(e)&&this.isCheckable(e)?e.checked=this.initialValue:e.value=this.initialValue},n.handler=function(e){var t=this.element;this.initialValue!==t.value?t.setAttribute("data-dirty","true"):t.removeAttribute("data-dirty")},n.isCheckable=function(e){return"radio"===e.type||"checkbox"===e.type},n.isInputElement=function(e){return"INPUT"===e.tagName},t}(s),L=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.connect=function(){this.toggle()},n.toggle=function(){this.hasDisablerTarget&&this.disablerTarget.checked?this.disableInputs():this.enableInputs()},n.disableInputs=function(){var e=this.hasClearValue&&this.clearValue;this.disableTargets.forEach(function(t,n){e&&(t.value=""),t.disabled=!0})},n.enableInputs=function(){this.disableTargets.forEach(function(e,t){e.disabled=!1})},t}(s);L.targets=["disabler","disable"],L.values={clear:Boolean};var S=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.dismiss=function(){this.element.remove()},t}(s),k=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.connect=function(){((e,t={})=>{new g(this,t)})(0,{element:this.element,childList:!0}),this.checkEmpty()},n.mutate=function(e){this.checkEmpty()},n.checkEmpty=function(){var e,t=this;0===(e=this.hasScopeSelectorValue?this.element.querySelectorAll(this.scopeSelectorValue):this.element.children).length?(this.hasNotEmptyClass&&this.notEmptyClass.split(" ").forEach(function(e){return t.element.classList.remove(e)}),this.hasEmptyClass&&this.emptyClass.split(" ").forEach(function(e){return t.element.classList.add(e)}),this.element.dispatchEvent(new CustomEvent("dom:empty",{bubbles:!0,cancelable:!0}))):(this.hasNotEmptyClass&&this.notEmptyClass.split(" ").forEach(function(e){return t.element.classList.add(e)}),this.hasEmptyClass&&this.emptyClass.split(" ").forEach(function(e){return t.element.classList.remove(e)}),this.element.dispatchEvent(new CustomEvent("dom:not-empty",{bubbles:!0,cancelable:!0,detail:{count:e.length}})))},t}(s);k.classes=["empty","notEmpty"],k.values={scopeSelector:String};var H=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.connect=function(){this.toggle()},n.toggle=function(){this.hasEnablerTarget&&this.enablerTarget.checked?this.enableInputs():this.disableInputs()},n.disableInputs=function(){var e=this.hasClearValue&&this.clearValue;this.enableTargets.forEach(function(t,n){e&&(t.value=""),t.disabled=!0})},n.enableInputs=function(){this.enableTargets.forEach(function(e,t){e.disabled=!1})},t}(s);H.targets=["enabler","enable"],H.values={clear:Boolean};var I=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.connect=function(){var e=this,t=this.element;t.onerror=function(){e.hasPlaceholderValue?t.src=e.placeholderValue:t.style.display="none"}},t}(s);I.values={placeholder:String};var M=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.connect=function(){if(this.options={element:this.element,threshold:.3},"IntersectionObserver"in window){var e=((e,t={})=>{const{dispatchEvent:n,eventPrefix:i}=Object.assign({},h,t),r=(null==t?void 0:t.element)||e.element,s=e.disconnect.bind(e),o=new IntersectionObserver(t=>{const[s]=t;s.isIntersecting?(t=>{if(e.isVisible=!0,l(e,"appear").call(e,t),n){const n=c("appear",e,i),s=u(n,null,{controller:e,entry:t});r.dispatchEvent(s)}})(s):e.isVisible&&(t=>{if(e.isVisible=!1,l(e,"disappear").call(e,t),n){const n=c("disappear",e,i),s=u(n,null,{controller:e,entry:t});r.dispatchEvent(s)}})(s)},t),a=()=>{o.observe(r)},d=()=>{o.unobserve(r)};return Object.assign(e,{isVisible:!1,disconnect(){d(),s()}}),a(),[a,d]})(this,this.options);this.observe=e[0],this.unobserve=e[1]}else this.loadContent()},n.appear=function(e){var t=this.element;""===t.src&&e.target===t&&e.isIntersecting&&(this.loadContent(),this.unobserve&&this.unobserve())},t}(o),x=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).maxSelections=0,t.boundHandleInputs=t.handleInputs.bind(r(t)),t}i(t,e);var n=t.prototype;return n.connect=function(){var e=this;this.inputTargets.forEach(function(t){return t.addEventListener("change",e.boundHandleInputs)})},n.disconnect=function(){var e=this;this.inputTargets.forEach(function(t){return t.removeEventListener("change",e.boundHandleInputs)})},n.handleInputs=function(e){var t=this.inputTargets.reduce(function(e,t){return t.checked?e+1:e},0),n=e.target;t>this.maxSelections?(e.preventDefault(),n.checked=!1,n.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!0})),n.dispatchEvent(new CustomEvent("limited-selection:too-many",{bubbles:!0,cancelable:!0,detail:{target:n}})),this.hasErrorTarget&&(this.errorTarget.innerHTML=this.messageValue)):(n.dispatchEvent(new CustomEvent("limited-selection:selection",{bubbles:!0,cancelable:!0,detail:{target:n}})),this.hasErrorTarget&&(this.errorTarget.innerHTML=""))},t}(s);x.targets=["input","error"],x.values={max:Number,message:String};var O=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundCheckPasswordsMatch=t.checkPasswordsMatch.bind(r(t)),t}i(t,e);var n=t.prototype;return n.connect=function(){var e=this;this.passwordTargets.forEach(function(t){return t.addEventListener("change",e.boundCheckPasswordsMatch)})},n.disconnect=function(){var e=this;this.passwordTargets.forEach(function(t){return t.removeEventListener("change",e.boundCheckPasswordsMatch)})},n.allPasswordsMatch=function(){var e=new Set(this.passwordTargets.map(function(e){return e.value}));return e.has("")||1==e.size},n.checkPasswordsMatch=function(){var e=this;this.allPasswordsMatch()?(this.element.dispatchEvent(new CustomEvent("password-confirm:match")),this.hasErrorClass&&this.passwordTargets.forEach(function(t){return t.classList.remove(e.errorClass)})):(this.element.dispatchEvent(new CustomEvent("password-confirm:no-match")),this.hasErrorClass&&this.passwordTargets.forEach(function(t){return t.classList.add(e.errorClass)}))},t}(s);O.targets=["password"],O.classes=["error"];var P=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.peak=function(e){e&&e.preventDefault(),this.passwordTarget.type="text"},n.hide=function(e){e&&e.preventDefault(),this.passwordTarget.type="password"},n.toggle=function(e){e&&e.preventDefault(),"password"===this.passwordTarget.type?this.peak():this.hide()},t}(s);P.targets=["password"];var j=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundMessageReceived=t.messageReceived.bind(r(t)),t}i(t,e);var n=t.prototype;return n.connect=function(){window.addEventListener("message",this.boundMessageReceived)},n.disconnect=function(){window.removeEventListener("message",this.boundMessageReceived)},n.messageReceived=function(e){var t=e.data;t.hasOwnProperty("name")&&"iframe-body"===t.name&&t.hasOwnProperty("height")&&this.resize(t.height)},n.resize=function(e){this.element.style.height=e+"px"},t}(s),A=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.connect=function(){var e,t,n;window.self!==window.top&&(m(this),t={},null===(n=(e=this).constructor.debounces)||void 0===n||n.forEach(n=>{if("string"==typeof n&&(e[n]=b(e[n],null==t?void 0:t.wait)),"object"==typeof n){const{name:i,wait:r}=n;if(!i)return;e[i]=b(e[i],r||(null==t?void 0:t.wait))}}),this.postUpdate())},n.windowResize=function(e){this.postUpdate()},n.postUpdate=function(){var e={name:"iframe-body",height:this.getHeight()};window.parent.postMessage(e,"*")},n.getHeight=function(){var e=document.body,t=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,t.clientHeight,t.scrollHeight,t.offsetHeight)},t}(s);A.debounces=["postUpdate"];var D,R=function(e){function n(){return e.apply(this,arguments)||this}i(n,e);var r=n.prototype;return r.cleanupSelf=function(){this.cleanup(this.element)},r.cleanup=function(e){var n,i,r,s=this;e.dataset.controller=(null==(n=e.dataset.controller)?void 0:n.replaceAll(new RegExp("(s|^)"+this.identifier+"(s|$)","g"),""))||"",""==e.dataset.controller&&delete e.dataset.controller;var o=new RegExp("(s|^)"+this.identifier+"\\..+?(s|$)","g");e.dataset.target=(null==(i=e.dataset.target)?void 0:i.replaceAll(o,""))||"",delete e.dataset[t(this.identifier+"-target")],""==e.dataset.target&&delete e.dataset.target,e.dataset.action=(null==(r=e.dataset.target)?void 0:r.replaceAll(o,""))||"",delete e.dataset[t(this.identifier+"-action")],""==e.dataset.action&&delete e.dataset.action;var a=this.constructor.values;a&&Object.keys(a).forEach(function(n){return delete e.dataset[t(s.identifier+"-"+n+"-value")]});var l=this.constructor.classes;l&&Object.keys(l).forEach(function(n){return delete e.dataset[t(s.identifier+"-"+n+"-class")]})},n}(s),z=function(e,t){var n=void 0===t?{}:t,i=n.behavior,r=void 0===i?"smooth":i,s=n.block,o=void 0===s?"start":s,a=n.inline,l=void 0===a?"nearest":a;try{var c=function(){e.scrollIntoView({behavior:r,block:o,inline:l})},u=function(){if("smooth"==r&&!B)return Promise.resolve(function(){try{return Promise.resolve(import("smoothscroll-polyfill")).then(function(e){D||(D=!0,(0,e.polyfill)())})}catch(e){return Promise.reject(e)}}()).then(function(){})}();return Promise.resolve(u&&u.then?u.then(c):c())}catch(e){return Promise.reject(e)}},B="scrollBehavior"in document.documentElement.style;function N(e){if(!e)return null;var t=getComputedStyle(e).overflowY;return"visible"!==t&&"hidden"!==t&&e.scrollHeight>=e.clientHeight?e:N(e.parentElement)||document.body}var F=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.connect=function(){var e=this;requestAnimationFrame(function(){z(e.element,{behavior:e.hasBehaviorValue?e.behaviorValue:"smooth",block:e.hasBlockValue?e.blockValue:"center",inline:e.hasInlineValue?e.inlineValue:"center"}).catch(function(){return e.element.scrollIntoView()}),e.cleanupSelf()})},t}(R);F.values={behavior:String,block:String,inline:String};var $=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.scroll=function(e){var t;e&&e.preventDefault(),null!=(t="document"==(this.hasModeValue?this.modeValue:"document")?document.body:N(this.element))&&z(t,{behavior:"smooth",block:"end"}).catch(function(){return t.scrollIntoView(!1)})},t}(s);$.values={mode:String};var q=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.scroll=function(){var e=document.querySelector(this.selectorValue);e?z(e,{behavior:this.hasBehaviorValue?this.behaviorValue:"smooth",block:this.hasBlockValue?this.blockValue:"center",inline:this.hasInlineValue?this.inlineValue:"center"}).catch(function(){return e.scrollIntoView()}):console.warn("Could not find target for '"+this.selectorValue+"'")},t}(s);q.values={selector:String,behavior:String,block:String,inline:String};var W=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.scroll=function(e){var t;e&&e.preventDefault(),null!=(t="document"==(this.hasModeValue?this.modeValue:"document")?document.body:N(this.element))&&z(t,{behavior:"smooth",block:"start"}).catch(function(){return t.scrollIntoView(!1)})},t}(s);W.values={mode:String};var U=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).timeout=null,t}i(t,e);var n=t.prototype;return n.connect=function(){var e=this;requestAnimationFrame(function(){e.timeout=setTimeout(function(){return e.element.remove()},1e3*e.secondsValue)})},n.disconnect=function(){this.timeout&&clearTimeout(this.timeout)},t}(s);U.values={seconds:Number};var _=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.connect=function(){var e=this;if(!this.hasInsertValue)throw new Error("`insert` value was not specified");requestAnimationFrame(function(){e.hasImmediateValue&&e.immediateValue&&e.execute()})},n.execute=function(e){e&&e.preventDefault();var t=document.querySelector(this.targetValue);if(null!=t){var n=this.element.cloneNode(!0);switch(this.cleanup(n),this.insertValue){case"beforebegin":case"beforeend":case"afterend":case"afterbegin":t.insertAdjacentHTML(this.insertValue,n.outerHTML);break;case"replaceOuter":t.outerHTML=n.outerHTML;break;case"replaceInner":t.innerHTML=n.outerHTML;break;case"prepend":t.insertAdjacentHTML("afterbegin",n.outerHTML);break;case"append":t.insertAdjacentHTML("beforeend",n.outerHTML);break;default:throw new Error("`insert` value was not specified")}this.element.remove()}else this.element.dispatchEvent(new CustomEvent("teleport:error",{bubbles:!0,cancelable:!0}))},t}(R);_.values={target:String,insert:String,immediate:Boolean};var Y=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.connect=function(){var e=this;if(!this.hasClassValue)throw new Error("data-toggle-class-class-value must not be empty");(this.hasMouseEnterValue||this.hasMouseLeaveValue)&&((e,t={})=>{new v(this,t)})(),this.hasClickAwayValue&&this.clickAwayValue&&((e,t={})=>{const{onlyVisible:n,dispatchEvent:i,events:r,eventPrefix:s}=Object.assign({},d,t),o=r=>{const o=(null==t?void 0:t.element)||e.element;if(!(o.contains(r.target)||!function(e){const t=e.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight,i=window.innerWidth||document.documentElement.clientWidth;return t.top<=n&&t.top+t.height>=0&&t.left<=i&&t.left+t.width>=0}(o)&&n)&&(e.clickOutside&&e.clickOutside(r),i)){const t=c("click:outside",e,s),n=u(t,r,{controller:e});o.dispatchEvent(n)}},a=e.disconnect.bind(e);Object.assign(e,{disconnect(){null==r||r.forEach(e=>{window.removeEventListener(e,o,!1)}),a()}}),null==r||r.forEach(e=>{window.addEventListener(e,o,!1)})})(this),requestAnimationFrame(function(){e.hasInitialValue&&e.toggleTargets.forEach("on"===e.initialValue?function(t){return e.elementOn(t)}:function(t){return e.elementOff(t)})})},n.clickOutside=function(){var e=this;this.toggleTargets.forEach(function(t){e.elementWasToggled(t)&&(e.elementToggleStatus(t),e.elementToggle(t))})},n.mouseEnter=function(){if(this.hasMouseEnterValue)switch(this.mouseEnterValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle()}return{}},n.mouseLeave=function(){if(this.hasMouseLeaveValue)switch(this.mouseLeaveValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle()}return{}},n.on=function(e){var t=this;this.toggleTargets.forEach(function(e){t.elementToggleStatus(e),t.elementOn(e)})},n.off=function(e){var t=this;this.toggleTargets.forEach(function(e){t.elementToggleStatus(e),t.elementOff(e)})},n.toggle=function(e){var t=this;this.toggleTargets.forEach(function(e){t.elementToggleStatus(e),t.elementToggle(e)})},n.elementWasToggled=function(e){return"true"==e.dataset.toggled},n.elementToggleStatus=function(e){this.elementWasToggled(e)?delete e.dataset.toggled:e.dataset.toggled="true"},n.elementToggle=function(e){this.classValue.split(" ").forEach(function(t){return e.classList.toggle(t)})},n.elementOn=function(e){this.classValue.split(" ").forEach(function(t){return e.classList.toggle(t,!0)})},n.elementOff=function(e){this.classValue.split(" ").forEach(function(t){return e.classList.toggle(t,!1)})},t}(s);Y.targets=["toggle"],Y.values={class:String,mouseEnter:String,mouseLeave:String,clickAway:Boolean,initial:String};var G=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.toggle=function(e){e&&e.preventDefault();var t=this.getFrame().src;null==t||t!==this.getSrc()?this.setSrc():this.clear()},n.setSrc=function(e){e&&e.preventDefault();var t=this.getFrame();this.hasLoadingMessageValue&&(t.innerHTML=this.loadingMessageValue),t.src=this.getSrc()},n.clear=function(e){e&&e.preventDefault();var t=this.getFrame();t.src="",t.innerHTML=""},n.getFrame=function(){var e=document.getElementById(""+this.frameIdValue);if(null==e)throw new Error("Could not find frame with ID '"+this.frameIdValue+"'");if("TURBO-FRAME"!=e.nodeName)throw new Error("Element targeted by ID '"+this.frameIdValue+"'");return e},n.getSrc=function(){var e=this.element;if(this.hasSrcValue)return this.srcValue;if(function(e){return"A"==e.nodeName}(e))return e.href;throw new Error("No link given to drive frame to")},t}(s);G.values={frameId:String,src:String,loadingMessage:String};var J=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundHandler=t.updateWordCount.bind(r(t)),t}i(t,e);var n=t.prototype;return n.connect=function(){this.updateWordCount(),this.inputTarget.addEventListener("input",this.boundHandler)},n.disconnect=function(){this.inputTarget.removeEventListener("input",this.boundHandler)},n.updateWordCount=function(){var e=0,t=this.inputTarget.value.match(/\S+/g);this.outputTarget.innerText=(e=t&&t.length||0).toString(),this.hasErrorClass&&(this.isValidCount(e)?this.outputTarget.classList.remove(this.errorClass):this.outputTarget.classList.add(this.errorClass))},n.isValidCount=function(e){var t=0,n=99999;return this.hasMinValue&&(t=this.minValue),this.hasMaxValue&&(n=this.maxValue),e>=t&&e<=n},t}(s);J.targets=["input","output"],J.values={min:Number,max:Number},J.classes=["error"];export{o as AsyncBlockController,a as AutoSubmitFormController,E as AutosizeController,y as CharCountController,w as ClipboardController,V as ConfirmNavigationController,T as DebugController,C as DetectDirtyController,L as DisableInputsController,S as DismissableController,k as EmptyDomController,H as EnableInputsController,I as FallbackImageController,M as LazyBlockController,x as LimitedSelectionCheckboxesController,O as PasswordConfirmController,P as PasswordPeekController,A as ResponsiveIframeBodyController,j as ResponsiveIframeWrapperController,F as ScrollIntoFocusController,$ as ScrollToBottomController,q as ScrollToController,W as ScrollToTopController,U as SelfDestructController,_ as TeleportController,Y as ToggleClassController,G as TurboFrameRCController,J as WordCountController}; +import{Controller as e}from"stimulus";import t from"lodash.camelcase";function n(){return(n=Object.assign||function(e){for(var t=1;t{const n=e[t];return"function"==typeof n?n:(...e)=>{}},c=(e,t,n)=>{let r=e;return!0===n?r=`${t.identifier}:${e}`:"string"==typeof n&&(r=`${n}:${e}`),r},u=(e,t,n)=>{const{bubbles:r,cancelable:i,composed:s}=t||{bubbles:!0,cancelable:!0,composed:!0};return t&&Object.assign(n,{originalEvent:t}),new CustomEvent(e,{bubbles:r,cancelable:i,composed:s,detail:n})},h={dispatchEvent:!0,eventPrefix:!0},d={events:["click","touchend"],onlyVisible:!0,dispatchEvent:!0,eventPrefix:!0},p={debug:!1,logger:console};class f{constructor(e,t={}){var n,r,i;this.log=(e,t)=>{this.debug&&(this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${e}`,"color: #3B82F6","color: unset"),this.logger.log(Object.assign({controllerId:this.controllerId},t)),this.logger.groupEnd())},this.debug=null!==(r=null!==(n=null==t?void 0:t.debug)&&void 0!==n?n:e.application.stimulusUseDebug)&&void 0!==r?r:p.debug,this.logger=null!==(i=null==t?void 0:t.logger)&&void 0!==i?i:p.logger,this.controller=e,this.controllerId=e.element.id||e.element.dataset.id,this.controllerInitialize=e.initialize.bind(e),this.controllerConnect=e.connect.bind(e),this.controllerDisconnect=e.disconnect.bind(e)}}class v extends f{constructor(e,t={}){super(e,t),this.observe=()=>{this.targetElement.addEventListener("mouseenter",this.onEnter),this.targetElement.addEventListener("mouseleave",this.onLeave)},this.unobserve=()=>{this.targetElement.removeEventListener("mouseenter",this.onEnter),this.targetElement.removeEventListener("mouseleave",this.onLeave)},this.onEnter=()=>{l(this.controller,"mouseEnter").call(this.controller),this.log("mouseEnter",{hover:!0})},this.onLeave=()=>{l(this.controller,"mouseLeave").call(this.controller),this.log("mouseLeave",{hover:!1})},this.targetElement=(null==t?void 0:t.element)||e.element,this.controller=e,this.enhanceController(),this.observe()}enhanceController(){const e=this.controller.disconnect.bind(this.controller);Object.assign(this.controller,{disconnect:()=>{this.unobserve(),e()}})}}class g extends f{constructor(e,t={}){super(e,t),this.observe=()=>{try{this.observer.observe(this.targetElement,this.options)}catch(e){this.controller.application.handleError(e,"At a minimum, one of childList, attributes, and/or characterData must be true",{})}},this.unobserve=()=>{this.observer.disconnect()},this.mutation=e=>{l(this.controller,"mutate").call(this.controller,e),this.log("mutate",{entries:e})},this.targetElement=(null==t?void 0:t.element)||e.element,this.controller=e,this.options=t,this.observer=new MutationObserver(this.mutation),this.enhanceController(),this.observe()}enhanceController(){const e=this.controller.disconnect.bind(this.controller);Object.assign(this.controller,{disconnect:()=>{this.unobserve(),e()}})}}const m=e=>{const t=t=>{const{innerWidth:n,innerHeight:r}=window,i={height:r||Infinity,width:n||Infinity,event:t};l(e,"windowResize").call(e,i)},n=e.disconnect.bind(e),r=()=>{window.addEventListener("resize",t),t()},i=()=>{window.removeEventListener("resize",t)};return Object.assign(e,{disconnect(){i(),n()}}),r(),[r,i]},b=(e,t=200)=>{let n=null;return function(){const r=arguments,i=this,s=()=>e.apply(i,r);n&&clearTimeout(n),n=setTimeout(s,t)}};var y=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundHandler=t.handler.bind(i(t)),t}r(t,e);var n=t.prototype;return n.connect=function(){var e=this.element;e.style.resize="none",e.style.boxSizing="border-box",e.addEventListener("input",this.boundHandler),e.addEventListener("focus",this.boundHandler),m(this),requestAnimationFrame(this.boundHandler)},n.windowResize=function(){this.handler()},n.handler=function(){this.autosize(this.element)},n.autosize=function(e){var t=e.offsetHeight-e.clientHeight;e.style.height="auto",e.style.height=e.scrollHeight+t+"px"},t}(s),E=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundHandler=t.updateCharCount.bind(i(t)),t}r(t,e);var n=t.prototype;return n.connect=function(){this.updateCharCount(),this.inputTarget.addEventListener("input",this.boundHandler)},n.disconnect=function(){this.inputTarget.removeEventListener("input",this.boundHandler)},n.updateCharCount=function(){var e=this.inputTarget.value.length;this.outputTarget.innerText=e.toString(),this.hasErrorClass&&(this.isValidCount(e)?this.outputTarget.classList.remove(this.errorClass):this.outputTarget.classList.add(this.errorClass))},n.isValidCount=function(e){var t=0,n=99999;return this.hasMinValue&&(t=this.minValue),this.hasMaxValue&&(n=this.maxValue),e>=t&&e<=n},t}(s);E.targets=["input","output"],E.values={min:Number,max:Number},E.classes=["error"];var w=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).supported=!1,t}r(t,e);var n=t.prototype;return n.connect=function(){this.supported=document.queryCommandSupported("copy"),this.hasRemoveUnusedValue&&this.removeUnusedValue&&(this.supported&&this.hasFallbackTarget?this.fallbackTarget.remove():this.hasCopyTarget&&this.copyTarget.remove())},n.select=function(e){e&&e.preventDefault(),this.sourceTarget.select()},n.copy=function(e){e&&e.preventDefault(),this.sourceTarget.select(),this.supported&&document.execCommand("copy")},t}(s);w.targets=["button","copy","fallback"],w.values={removeUnused:Boolean};var V=function(e){function t(){return e.apply(this,arguments)||this}r(t,e);var n=t.prototype;return n.connect=function(){var e=this,t=this.messageValue;window.onbeforeunload=function(){return null==t||t},window.addEventListener("popstate",this.handlePopstate),window.addEventListener("submit",function(){window.removeEventListener("popstate",e.handlePopstate),window.onbeforeunload=null})},n.handlePopstate=function(e){return!1},t}(s);V.values={message:String};var T=function(e){function t(){return e.apply(this,arguments)||this}return r(t,e),t.prototype.connect=function(){console.log("Debug Controller",this,this.testTargets)},t}(s);T.targets=["test"];var C=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).initialValue=null,t.boundHandler=t.handler.bind(i(t)),t}r(t,e);var n=t.prototype;return n.connect=function(){var e=this.element;this.initialValue=this.isInputElement(e)&&this.isCheckable(e)?e.checked:e.value,e.addEventListener("input",this.boundHandler),e.addEventListener("change",this.boundHandler)},n.disconnect=function(){var e=this.element;e.removeEventListener("input",this.boundHandler),e.removeEventListener("change",this.boundHandler)},n.restore=function(){var e=this.element;this.isInputElement(e)&&this.isCheckable(e)?e.checked=this.initialValue:e.value=this.initialValue},n.handler=function(e){var t=this.element;this.initialValue!==t.value?t.setAttribute("data-dirty","true"):t.removeAttribute("data-dirty")},n.isCheckable=function(e){return"radio"===e.type||"checkbox"===e.type},n.isInputElement=function(e){return"INPUT"===e.tagName},t}(s),L=function(e){function t(){return e.apply(this,arguments)||this}r(t,e);var n=t.prototype;return n.connect=function(){this.toggle()},n.toggle=function(){this.hasDisablerTarget&&this.disablerTarget.checked?this.disableInputs():this.enableInputs()},n.disableInputs=function(){var e=this.hasClearValue&&this.clearValue;this.disableTargets.forEach(function(t,n){e&&(t.value=""),t.disabled=!0})},n.enableInputs=function(){this.disableTargets.forEach(function(e,t){e.disabled=!1})},t}(s);L.targets=["disabler","disable"],L.values={clear:Boolean};var S=function(e){function t(){return e.apply(this,arguments)||this}return r(t,e),t.prototype.dismiss=function(){this.element.remove()},t}(s),k=function(e){function t(){return e.apply(this,arguments)||this}r(t,e);var n=t.prototype;return n.connect=function(){((e,t={})=>{new g(this,t)})(0,{element:this.element,childList:!0}),this.checkEmpty()},n.mutate=function(e){this.checkEmpty()},n.checkEmpty=function(){var e,t=this;0===(e=this.hasScopeSelectorValue?this.element.querySelectorAll(this.scopeSelectorValue):this.element.children).length?(this.hasNotEmptyClass&&this.notEmptyClass.split(" ").forEach(function(e){return t.element.classList.remove(e)}),this.hasEmptyClass&&this.emptyClass.split(" ").forEach(function(e){return t.element.classList.add(e)}),this.element.dispatchEvent(new CustomEvent("dom:empty",{bubbles:!0,cancelable:!0}))):(this.hasNotEmptyClass&&this.notEmptyClass.split(" ").forEach(function(e){return t.element.classList.add(e)}),this.hasEmptyClass&&this.emptyClass.split(" ").forEach(function(e){return t.element.classList.remove(e)}),this.element.dispatchEvent(new CustomEvent("dom:not-empty",{bubbles:!0,cancelable:!0,detail:{count:e.length}})))},t}(s);k.classes=["empty","notEmpty"],k.values={scopeSelector:String};var H=function(e){function t(){return e.apply(this,arguments)||this}r(t,e);var n=t.prototype;return n.connect=function(){this.toggle()},n.toggle=function(){this.hasEnablerTarget&&this.enablerTarget.checked?this.enableInputs():this.disableInputs()},n.disableInputs=function(){var e=this.hasClearValue&&this.clearValue;this.enableTargets.forEach(function(t,n){e&&(t.value=""),t.disabled=!0})},n.enableInputs=function(){this.enableTargets.forEach(function(e,t){e.disabled=!1})},t}(s);H.targets=["enabler","enable"],H.values={clear:Boolean};var M=function(e){function t(){return e.apply(this,arguments)||this}return r(t,e),t.prototype.connect=function(){var e=this,t=this.element;t.onerror=function(){e.hasPlaceholderValue?t.src=e.placeholderValue:t.style.display="none"}},t}(s);M.values={placeholder:String};var I=function(e){function t(){return e.apply(this,arguments)||this}r(t,e);var n=t.prototype;return n.connect=function(){if(this.options={element:this.element,threshold:.3},"IntersectionObserver"in window){var e=((e,t={})=>{const{dispatchEvent:n,eventPrefix:r}=Object.assign({},h,t),i=(null==t?void 0:t.element)||e.element,s=e.disconnect.bind(e),o=new IntersectionObserver(t=>{const[s]=t;s.isIntersecting?(t=>{if(e.isVisible=!0,l(e,"appear").call(e,t),n){const n=c("appear",e,r),s=u(n,null,{controller:e,entry:t});i.dispatchEvent(s)}})(s):e.isVisible&&(t=>{if(e.isVisible=!1,l(e,"disappear").call(e,t),n){const n=c("disappear",e,r),s=u(n,null,{controller:e,entry:t});i.dispatchEvent(s)}})(s)},t),a=()=>{o.observe(i)},d=()=>{o.unobserve(i)};return Object.assign(e,{isVisible:!1,disconnect(){d(),s()}}),a(),[a,d]})(this,this.options);this.observe=e[0],this.unobserve=e[1]}else this.loadContent()},n.appear=function(e){var t=this.element;""===t.src&&e.target===t&&e.isIntersecting&&(this.loadContent(),this.unobserve&&this.unobserve())},t}(o),x=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).maxSelections=0,t.boundHandleInputs=t.handleInputs.bind(i(t)),t}r(t,e);var n=t.prototype;return n.connect=function(){var e=this;this.inputTargets.forEach(function(t){return t.addEventListener("change",e.boundHandleInputs)})},n.disconnect=function(){var e=this;this.inputTargets.forEach(function(t){return t.removeEventListener("change",e.boundHandleInputs)})},n.handleInputs=function(e){var t=this.inputTargets.reduce(function(e,t){return t.checked?e+1:e},0),n=e.target;t>this.maxSelections?(e.preventDefault(),n.checked=!1,n.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!0})),n.dispatchEvent(new CustomEvent("limited-selection:too-many",{bubbles:!0,cancelable:!0,detail:{target:n}})),this.hasErrorTarget&&(this.errorTarget.innerHTML=this.messageValue)):(n.dispatchEvent(new CustomEvent("limited-selection:selection",{bubbles:!0,cancelable:!0,detail:{target:n}})),this.hasErrorTarget&&(this.errorTarget.innerHTML=""))},t}(s);x.targets=["input","error"],x.values={max:Number,message:String};var O=function(e){function t(){return e.apply(this,arguments)||this}r(t,e);var n,i=t.prototype;return i.connect=function(){this.checkStructure()},i.add=function(e){e&&e.preventDefault();var t=this.templateTarget.innerHTML.replace(/NEW_RECORD/g,this.generateID());this.targetTarget.insertAdjacentHTML(this.insertMode,t)},i.remove=function(e){e.preventDefault();var t=e.target.closest(this.wrapperClass);if(null==t)throw new Error("#remove was clicked from outside of a child record. Could not find an ancestor with class "+this.wrapperClass);if("true"===t.dataset.newRecord)t.remove();else{t.style.display="none";var n=t.querySelector("input[name*='_destroy']");if(null==n)throw new Error("Could not find a hidden input with name '_destroy'. NestedForm cannot remove an already persisted record without it.");n.value="1"}},i.generateID=function(){return(new Date).getTime().toString()+Math.random()},i.checkStructure=function(){if(this.templateTarget.innerHTML.indexOf("NEW_RECORD"))throw new Error("Could not find 'NEW_RECORD' in the provided template. Please make sure you've passed `child_index: 'NEW_RECORD'` to `fields_for`")},(n=[{key:"wrapperClass",get:function(){return this.hasWrapperSelectorValue?this.wrapperClassValue:"nested-fields"}},{key:"insertMode",get:function(){return this.hasInsertModeValue?this.insertModeValue:"beforeend"}}])&&function(e,t){for(var n=0;n{if("string"==typeof n&&(e[n]=b(e[n],null==t?void 0:t.wait)),"object"==typeof n){const{name:r,wait:i}=n;if(!r)return;e[r]=b(e[r],i||(null==t?void 0:t.wait))}}),this.postUpdate())},n.windowResize=function(e){this.postUpdate()},n.postUpdate=function(){var e={name:"iframe-body",height:this.getHeight()};window.parent.postMessage(e,"*")},n.getHeight=function(){var e=document.body,t=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,t.clientHeight,t.scrollHeight,t.offsetHeight)},t}(s);j.debounces=["postUpdate"];var A,N=function(e){function n(){return e.apply(this,arguments)||this}r(n,e);var i=n.prototype;return i.cleanupSelf=function(){this.cleanup(this.element)},i.cleanup=function(e){var n,r,i,s=this;e.dataset.controller=(null==(n=e.dataset.controller)?void 0:n.replaceAll(new RegExp("(s|^)"+this.identifier+"(s|$)","g"),""))||"",""==e.dataset.controller&&delete e.dataset.controller;var o=new RegExp("(s|^)"+this.identifier+"\\..+?(s|$)","g");e.dataset.target=(null==(r=e.dataset.target)?void 0:r.replaceAll(o,""))||"",delete e.dataset[t(this.identifier+"-target")],""==e.dataset.target&&delete e.dataset.target,e.dataset.action=(null==(i=e.dataset.target)?void 0:i.replaceAll(o,""))||"",delete e.dataset[t(this.identifier+"-action")],""==e.dataset.action&&delete e.dataset.action;var a=this.constructor.values;a&&Object.keys(a).forEach(function(n){return delete e.dataset[t(s.identifier+"-"+n+"-value")]});var l=this.constructor.classes;l&&Object.keys(l).forEach(function(n){return delete e.dataset[t(s.identifier+"-"+n+"-class")]})},n}(s),W=function(e,t){var n=void 0===t?{}:t,r=n.behavior,i=void 0===r?"smooth":r,s=n.block,o=void 0===s?"start":s,a=n.inline,l=void 0===a?"nearest":a;try{var c=function(){e.scrollIntoView({behavior:i,block:o,inline:l})},u=function(){if("smooth"==i&&!z)return Promise.resolve(function(){try{return Promise.resolve(import("smoothscroll-polyfill")).then(function(e){A||(A=!0,(0,e.polyfill)())})}catch(e){return Promise.reject(e)}}()).then(function(){})}();return Promise.resolve(u&&u.then?u.then(c):c())}catch(e){return Promise.reject(e)}},z="scrollBehavior"in document.documentElement.style;function B(e){if(!e)return null;var t=getComputedStyle(e).overflowY;return"visible"!==t&&"hidden"!==t&&e.scrollHeight>=e.clientHeight?e:B(e.parentElement)||document.body}var F=function(e){function t(){return e.apply(this,arguments)||this}return r(t,e),t.prototype.connect=function(){var e=this;requestAnimationFrame(function(){W(e.element,{behavior:e.hasBehaviorValue?e.behaviorValue:"smooth",block:e.hasBlockValue?e.blockValue:"center",inline:e.hasInlineValue?e.inlineValue:"center"}).catch(function(){return e.element.scrollIntoView()}),e.cleanupSelf()})},t}(N);F.values={behavior:String,block:String,inline:String};var q=function(e){function t(){return e.apply(this,arguments)||this}return r(t,e),t.prototype.scroll=function(e){var t;e&&e.preventDefault(),null!=(t="document"==(this.hasModeValue?this.modeValue:"document")?document.body:B(this.element))&&W(t,{behavior:"smooth",block:"end"}).catch(function(){return t.scrollIntoView(!1)})},t}(s);q.values={mode:String};var $=function(e){function t(){return e.apply(this,arguments)||this}return r(t,e),t.prototype.scroll=function(){var e=document.querySelector(this.selectorValue);e?W(e,{behavior:this.hasBehaviorValue?this.behaviorValue:"smooth",block:this.hasBlockValue?this.blockValue:"center",inline:this.hasInlineValue?this.inlineValue:"center"}).catch(function(){return e.scrollIntoView()}):console.warn("Could not find target for '"+this.selectorValue+"'")},t}(s);$.values={selector:String,behavior:String,block:String,inline:String};var _=function(e){function t(){return e.apply(this,arguments)||this}return r(t,e),t.prototype.scroll=function(e){var t;e&&e.preventDefault(),null!=(t="document"==(this.hasModeValue?this.modeValue:"document")?document.body:B(this.element))&&W(t,{behavior:"smooth",block:"start"}).catch(function(){return t.scrollIntoView(!1)})},t}(s);_.values={mode:String};var U=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).timeout=null,t}r(t,e);var n=t.prototype;return n.connect=function(){var e=this;requestAnimationFrame(function(){e.timeout=setTimeout(function(){return e.element.remove()},1e3*e.secondsValue)})},n.disconnect=function(){this.timeout&&clearTimeout(this.timeout)},t}(s);U.values={seconds:Number};var Y=function(e){function t(){return e.apply(this,arguments)||this}r(t,e);var n=t.prototype;return n.connect=function(){var e=this;if(!this.hasInsertValue)throw new Error("`insert` value was not specified");requestAnimationFrame(function(){e.hasImmediateValue&&e.immediateValue&&e.execute()})},n.execute=function(e){e&&e.preventDefault();var t=document.querySelector(this.targetValue);if(null!=t){var n=this.element.cloneNode(!0);switch(this.cleanup(n),this.insertValue){case"beforebegin":case"beforeend":case"afterend":case"afterbegin":t.insertAdjacentHTML(this.insertValue,n.outerHTML);break;case"replaceOuter":t.outerHTML=n.outerHTML;break;case"replaceInner":t.innerHTML=n.outerHTML;break;case"prepend":t.insertAdjacentHTML("afterbegin",n.outerHTML);break;case"append":t.insertAdjacentHTML("beforeend",n.outerHTML);break;default:throw new Error("`insert` value was not specified")}this.element.remove()}else this.element.dispatchEvent(new CustomEvent("teleport:error",{bubbles:!0,cancelable:!0}))},t}(N);Y.values={target:String,insert:String,immediate:Boolean};var G=function(e){function t(){return e.apply(this,arguments)||this}r(t,e);var n=t.prototype;return n.connect=function(){var e=this;if(!this.hasClassValue)throw new Error("data-toggle-class-class-value must not be empty");(this.hasMouseEnterValue||this.hasMouseLeaveValue)&&((e,t={})=>{new v(this,t)})(),this.hasClickAwayValue&&this.clickAwayValue&&((e,t={})=>{const{onlyVisible:n,dispatchEvent:r,events:i,eventPrefix:s}=Object.assign({},d,t),o=i=>{const o=(null==t?void 0:t.element)||e.element;if(!(o.contains(i.target)||!function(e){const t=e.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight,r=window.innerWidth||document.documentElement.clientWidth;return t.top<=n&&t.top+t.height>=0&&t.left<=r&&t.left+t.width>=0}(o)&&n)&&(e.clickOutside&&e.clickOutside(i),r)){const t=c("click:outside",e,s),n=u(t,i,{controller:e});o.dispatchEvent(n)}},a=e.disconnect.bind(e);Object.assign(e,{disconnect(){null==i||i.forEach(e=>{window.removeEventListener(e,o,!1)}),a()}}),null==i||i.forEach(e=>{window.addEventListener(e,o,!1)})})(this),requestAnimationFrame(function(){e.hasInitialValue&&e.toggleTargets.forEach("on"===e.initialValue?function(t){return e.elementOn(t)}:function(t){return e.elementOff(t)})})},n.clickOutside=function(){var e=this;this.toggleTargets.forEach(function(t){e.elementWasToggled(t)&&(e.elementToggleStatus(t),e.elementToggle(t))})},n.mouseEnter=function(){if(this.hasMouseEnterValue)switch(this.mouseEnterValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle()}return{}},n.mouseLeave=function(){if(this.hasMouseLeaveValue)switch(this.mouseLeaveValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle()}return{}},n.on=function(e){var t=this;this.toggleTargets.forEach(function(e){t.elementToggleStatus(e),t.elementOn(e)})},n.off=function(e){var t=this;this.toggleTargets.forEach(function(e){t.elementToggleStatus(e),t.elementOff(e)})},n.toggle=function(e){var t=this;this.toggleTargets.forEach(function(e){t.elementToggleStatus(e),t.elementToggle(e)})},n.elementWasToggled=function(e){return"true"==e.dataset.toggled},n.elementToggleStatus=function(e){this.elementWasToggled(e)?delete e.dataset.toggled:e.dataset.toggled="true"},n.elementToggle=function(e){this.classValue.split(" ").forEach(function(t){return e.classList.toggle(t)})},n.elementOn=function(e){this.classValue.split(" ").forEach(function(t){return e.classList.toggle(t,!0)})},n.elementOff=function(e){this.classValue.split(" ").forEach(function(t){return e.classList.toggle(t,!1)})},t}(s);G.targets=["toggle"],G.values={class:String,mouseEnter:String,mouseLeave:String,clickAway:Boolean,initial:String};var J=function(e){function t(){return e.apply(this,arguments)||this}r(t,e);var n=t.prototype;return n.toggle=function(e){e&&e.preventDefault();var t=this.getFrame().src;null==t||t!==this.getSrc()?this.setSrc():this.clear()},n.setSrc=function(e){e&&e.preventDefault();var t=this.getFrame();this.hasLoadingMessageValue&&(t.innerHTML=this.loadingMessageValue),t.src=this.getSrc()},n.clear=function(e){e&&e.preventDefault();var t=this.getFrame();t.src="",t.innerHTML=""},n.getFrame=function(){var e=document.getElementById(""+this.frameIdValue);if(null==e)throw new Error("Could not find frame with ID '"+this.frameIdValue+"'");if("TURBO-FRAME"!=e.nodeName)throw new Error("Element targeted by ID '"+this.frameIdValue+"'");return e},n.getSrc=function(){var e=this.element;if(this.hasSrcValue)return this.srcValue;if(function(e){return"A"==e.nodeName}(e))return e.href;throw new Error("No link given to drive frame to")},t}(s);J.values={frameId:String,src:String,loadingMessage:String};var K=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundHandler=t.updateWordCount.bind(i(t)),t}r(t,e);var n=t.prototype;return n.connect=function(){this.updateWordCount(),this.inputTarget.addEventListener("input",this.boundHandler)},n.disconnect=function(){this.inputTarget.removeEventListener("input",this.boundHandler)},n.updateWordCount=function(){var e=0,t=this.inputTarget.value.match(/\S+/g);this.outputTarget.innerText=(e=t&&t.length||0).toString(),this.hasErrorClass&&(this.isValidCount(e)?this.outputTarget.classList.remove(this.errorClass):this.outputTarget.classList.add(this.errorClass))},n.isValidCount=function(e){var t=0,n=99999;return this.hasMinValue&&(t=this.minValue),this.hasMaxValue&&(n=this.maxValue),e>=t&&e<=n},t}(s);K.targets=["input","output"],K.values={min:Number,max:Number},K.classes=["error"];export{o as AsyncBlockController,a as AutoSubmitFormController,y as AutosizeController,E as CharCountController,w as ClipboardController,V as ConfirmNavigationController,T as DebugController,C as DetectDirtyController,L as DisableInputsController,S as DismissableController,k as EmptyDomController,H as EnableInputsController,M as FallbackImageController,I as LazyBlockController,x as LimitedSelectionCheckboxesController,O as NestedFormController,D as PasswordConfirmController,P as PasswordPeekController,j as ResponsiveIframeBodyController,R as ResponsiveIframeWrapperController,F as ScrollIntoFocusController,q as ScrollToBottomController,$ as ScrollToController,_ as ScrollToTopController,U as SelfDestructController,Y as TeleportController,G as ToggleClassController,J as TurboFrameRCController,K as WordCountController}; //# sourceMappingURL=stimulus-library.module.js.map diff --git a/dist/stimulus-library.module.js.map b/dist/stimulus-library.module.js.map index 773c07d0..d2d66a76 100644 --- a/dist/stimulus-library.module.js.map +++ b/dist/stimulus-library.module.js.map @@ -1 +1 @@ -{"version":3,"file":"stimulus-library.module.js","sources":["../src/base_controller.ts","../src/async_block_controller.ts","../src/auto_submit_form_controller.ts","../node_modules/stimulus-use/dist/support/index.js","../node_modules/stimulus-use/dist/use-intersection/use-intersection.js","../node_modules/stimulus-use/dist/use-click-outside/use-click-outside.js","../node_modules/stimulus-use/dist/stimulus_use.js","../node_modules/stimulus-use/dist/use-hover/use-hover.js","../node_modules/stimulus-use/dist/use-mutation/use-mutation.js","../node_modules/stimulus-use/dist/use-window-resize/use-window-resize.js","../node_modules/stimulus-use/dist/use-debounce/use-debounce.js","../src/autosize_controller.ts","../src/char_count_controller.ts","../src/clipboard_controller.ts","../src/confirm_navigation_controller.ts","../src/debug_controller.ts","../src/detect_dirty_controller.ts","../src/disable_inputs_controller.ts","../src/dismissable_controller.ts","../src/empty_dom_controller.ts","../src/enable_inputs_controller.ts","../src/fallback_image_controller.ts","../src/lazy_block_controller.ts","../src/limited_selection_checkboxes_controller.ts","../src/password_confirm_controller.ts","../src/password_peek_controller.ts","../src/responsive_iframe_controller.ts","../src/utilities/scroll.ts","../src/utilities/ephemeral_controller.ts","../src/scroll_into_focus_controller.ts","../src/scroll_to_bottom_controller.ts","../src/scroll_to_controller.ts","../src/scroll_to_top_controller.ts","../src/self_destruct_controller.ts","../src/teleport_controller.ts","../src/toggle_class_controller.ts","../src/turbo_frame_rc_controller.ts","../src/utilities/turbo.ts","../src/utilities/elements.ts","../src/word_count_controller.ts"],"sourcesContent":["import {Context, Controller} from \"stimulus\";\r\n\r\nexport class BaseController extends Controller {\r\n\r\n constructor(context: Context) {\r\n super(context);\r\n return new Proxy(this, {\r\n get: (obj, prop) => {\r\n let returnVal = Reflect.get(obj, prop);\r\n let self = this;\r\n if (logProperty(prop.toString())) {\r\n if (typeof returnVal == \"function\") {\r\n return new Proxy(returnVal, {\r\n apply(target: any, thisArg: any, argArray?: any): any {\r\n self.log(prop.toString(), {\r\n args: argArray,\r\n });\r\n return Reflect.apply(target, thisArg, argArray);\r\n },\r\n });\r\n } else {\r\n this.log(prop.toString());\r\n }\r\n }\r\n return returnVal;\r\n },\r\n });\r\n }\r\n\r\n log(functionName: string, args: {} = {}): void {\r\n // @ts-ignore\r\n if (!this.application.debug) {\r\n return;\r\n }\r\n let logger = console;\r\n logger.groupCollapsed(`%c${this.identifier} %c#${functionName}`, \"color: #3B82F6\", \"color: unset\");\r\n logger.log({\r\n element: this.element,\r\n ...args,\r\n });\r\n logger.groupEnd();\r\n }\r\n\r\n}\r\n\r\nfunction logProperty(prop: string): boolean {\r\n switch (prop) {\r\n case \"application\":\r\n case \"element\":\r\n case \"constructor\":\r\n case \"initialize\":\r\n case \"log\":\r\n case \"data\":\r\n case \"valueDescriptorMap\":\r\n case \"identifier\":\r\n return false;\r\n }\r\n\r\n if (/^.*?Target(s)?$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?Value$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?ValueChanged$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?Class$/.test(prop)) {\r\n return false;\r\n }\r\n\r\n return true;\r\n}\r\n","import {BaseController} from \"./base_controller\";\n\nexport class AsyncBlockController extends BaseController {\n static targets = [\"replace\"];\n static values = {endpoint: String};\n\n declare readonly replaceTarget: HTMLElement;\n declare readonly hasReplaceTarget: boolean;\n declare readonly endpointValue: string;\n\n\n // This is a simple controller to load a block of content when the page loads.\n // It should be used to give a quick initial response before calling out to an\n // an AJAX endpoint to do some expensive work.\n connect() {\n this.loadContent();\n }\n\n loadContent() {\n let el = (this.hasReplaceTarget ? this.replaceTarget : this.element) as HTMLElement;\n fetch(this.endpointValue)\n .then((response) => response.text())\n .then((html) => {\n let newEl = document.createElement(\"div\");\n newEl.innerHTML = html;\n el.replaceWith(newEl);\n\n // Trigger event to show block has loaded\n let event = new CustomEvent(\"ajax:success\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n })\n .catch(err => {\n el.replaceWith(\"Sorry, this content failed to load\");\n\n let event = new CustomEvent(\"ajax:error\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n })\n .finally(() => {\n let event = new CustomEvent(\"ajax:complete\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n });\n }\n}\n","import {BaseController} from \"./base_controller\";\n\nexport class AutoSubmitFormController extends BaseController {\n\n private boundHandler = this.handler.bind(this);\n\n connect() {\n (this.element as HTMLElement).querySelectorAll(\"input, select, textarea\").forEach(el => el.addEventListener(\"change\", this.boundHandler));\n }\n\n disconnect() {\n (this.element as HTMLElement).querySelectorAll(\"input, select, textarea\").forEach(el => el.removeEventListener(\"change\", this.boundHandler));\n }\n\n private handler(e: Event) {\n // this.element.submit()\n // Moved to this to support remote forms and CSRF properly\n this.element.dispatchEvent(\n new CustomEvent(\"submit\", {\n bubbles: true,\n cancelable: true,\n }),\n );\n }\n}\n","export const method = (controller, methodName) => {\n const method = controller[methodName];\n if (typeof method == 'function') {\n return method;\n }\n else {\n return (...args) => { };\n }\n};\nexport const composeEventName = (name, controller, eventPrefix) => {\n let composedName = name;\n if (eventPrefix === true) {\n composedName = `${controller.identifier}:${name}`;\n }\n else if (typeof eventPrefix === 'string') {\n composedName = `${eventPrefix}:${name}`;\n }\n return composedName;\n};\nexport const extendedEvent = (type, event, detail) => {\n const { bubbles, cancelable, composed } = event || { bubbles: true, cancelable: true, composed: true };\n if (event) {\n Object.assign(detail, { originalEvent: event });\n }\n const customEvent = new CustomEvent(type, {\n bubbles,\n cancelable,\n composed,\n detail,\n });\n return customEvent;\n};\nexport function isElementInViewport(el) {\n const rect = el.getBoundingClientRect();\n const windowHeight = (window.innerHeight || document.documentElement.clientHeight);\n const windowWidth = (window.innerWidth || document.documentElement.clientWidth);\n const vertInView = (rect.top <= windowHeight) && ((rect.top + rect.height) >= 0);\n const horInView = (rect.left <= windowWidth) && ((rect.left + rect.width) >= 0);\n return (vertInView && horInView);\n}\n//# sourceMappingURL=index.js.map","import { method, extendedEvent, composeEventName } from '../support/index';\nconst defaultOptions = {\n dispatchEvent: true,\n eventPrefix: true,\n};\nexport const useIntersection = (controller, options = {}) => {\n const { dispatchEvent, eventPrefix } = Object.assign({}, defaultOptions, options);\n const targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n const callback = (entries) => {\n const [entry] = entries;\n if (entry.isIntersecting) {\n dispatchAppear(entry);\n }\n else if (controller.isVisible) {\n dispatchDisappear(entry);\n }\n };\n const dispatchAppear = (entry) => {\n controller.isVisible = true;\n method(controller, 'appear').call(controller, entry);\n // emit a custom \"appear\" event\n if (dispatchEvent) {\n const eventName = composeEventName('appear', controller, eventPrefix);\n const appearEvent = extendedEvent(eventName, null, { controller, entry });\n targetElement.dispatchEvent(appearEvent);\n }\n };\n const dispatchDisappear = (entry) => {\n controller.isVisible = false;\n method(controller, 'disappear').call(controller, entry);\n // emit a custom \"disappear\" event\n if (dispatchEvent) {\n const eventName = composeEventName('disappear', controller, eventPrefix);\n const disappearEvent = extendedEvent(eventName, null, { controller, entry });\n targetElement.dispatchEvent(disappearEvent);\n }\n };\n // keep a copy of the current disconnect() function of the controller\n // to support composing several behaviors\n const controllerDisconnect = controller.disconnect.bind(controller);\n const observer = new IntersectionObserver(callback, options);\n const observe = () => {\n observer.observe(targetElement);\n };\n const unobserve = () => {\n observer.unobserve(targetElement);\n };\n Object.assign(controller, {\n isVisible: false,\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-intersection.js.map","import { composeEventName, extendedEvent, isElementInViewport } from '../support/index';\nconst defaultOptions = {\n events: ['click', 'touchend'],\n onlyVisible: true,\n dispatchEvent: true,\n eventPrefix: true,\n};\nexport const useClickOutside = (controller, options = {}) => {\n const { onlyVisible, dispatchEvent, events, eventPrefix } = Object.assign({}, defaultOptions, options);\n const onEvent = (event) => {\n const targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n if (targetElement.contains(event.target) || (!isElementInViewport(targetElement) && onlyVisible)) {\n return;\n }\n // call the clickOutside method of the Stimulus controller\n if (controller.clickOutside) {\n controller.clickOutside(event);\n }\n // emit a custom event\n if (dispatchEvent) {\n const eventName = composeEventName('click:outside', controller, eventPrefix);\n const clickOutsideEvent = extendedEvent(eventName, event, { controller });\n targetElement.dispatchEvent(clickOutsideEvent);\n }\n };\n const observe = () => {\n events === null || events === void 0 ? void 0 : events.forEach(event => {\n window.addEventListener(event, onEvent, false);\n });\n };\n const unobserve = () => {\n events === null || events === void 0 ? void 0 : events.forEach(event => {\n window.removeEventListener(event, onEvent, false);\n });\n };\n // keep a copy of the current disconnect() function of the controller\n // to support composing several behaviors\n const controllerDisconnect = controller.disconnect.bind(controller);\n Object.assign(controller, {\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-click-outside.js.map","const defaultOptions = {\n debug: false,\n logger: console\n};\nexport class StimulusUse {\n constructor(controller, options = {}) {\n var _a, _b, _c;\n this.log = (functionName, args) => {\n if (!this.debug)\n return;\n this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${functionName}`, 'color: #3B82F6', 'color: unset');\n this.logger.log(Object.assign({ controllerId: this.controllerId }, args));\n this.logger.groupEnd();\n };\n this.debug = (_b = (_a = options === null || options === void 0 ? void 0 : options.debug) !== null && _a !== void 0 ? _a : controller.application.stimulusUseDebug) !== null && _b !== void 0 ? _b : defaultOptions.debug;\n this.logger = (_c = options === null || options === void 0 ? void 0 : options.logger) !== null && _c !== void 0 ? _c : defaultOptions.logger;\n this.controller = controller;\n this.controllerId = controller.element.id || controller.element.dataset.id;\n // make copies of lifecycle functions\n this.controllerInitialize = controller.initialize.bind(controller);\n this.controllerConnect = controller.connect.bind(controller);\n this.controllerDisconnect = controller.disconnect.bind(controller);\n }\n}\n//# sourceMappingURL=stimulus_use.js.map","import { StimulusUse } from '../stimulus_use';\nimport { method } from '../support/index';\nexport class UseHover extends StimulusUse {\n constructor(controller, options = {}) {\n super(controller, options);\n this.observe = () => {\n this.targetElement.addEventListener('mouseenter', this.onEnter);\n this.targetElement.addEventListener('mouseleave', this.onLeave);\n };\n this.unobserve = () => {\n this.targetElement.removeEventListener('mouseenter', this.onEnter);\n this.targetElement.removeEventListener('mouseleave', this.onLeave);\n };\n this.onEnter = () => {\n method(this.controller, 'mouseEnter').call(this.controller);\n this.log('mouseEnter', { hover: true });\n };\n this.onLeave = () => {\n method(this.controller, 'mouseLeave').call(this.controller);\n this.log('mouseLeave', { hover: false });\n };\n this.targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n this.controller = controller;\n this.enhanceController();\n this.observe();\n }\n enhanceController() {\n const controllerDisconnect = this.controller.disconnect.bind(this.controller);\n const disconnect = () => {\n this.unobserve();\n controllerDisconnect();\n };\n Object.assign(this.controller, { disconnect });\n }\n}\nexport const useHover = (controller, options = {}) => {\n const observer = new UseHover(controller, options);\n return [observer.observe, observer.unobserve];\n};\n//# sourceMappingURL=use-hover.js.map","import { StimulusUse } from '../stimulus_use';\nimport { method } from '../support/index';\nexport class UseMutation extends StimulusUse {\n constructor(controller, options = {}) {\n super(controller, options);\n this.observe = () => {\n try {\n this.observer.observe(this.targetElement, this.options);\n }\n catch (error) {\n this.controller.application.handleError(error, \"At a minimum, one of childList, attributes, and/or characterData must be true\", {});\n }\n };\n this.unobserve = () => {\n this.observer.disconnect();\n };\n this.mutation = (entries) => {\n method(this.controller, 'mutate').call(this.controller, entries);\n this.log('mutate', { entries });\n };\n this.targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n this.controller = controller;\n this.options = options;\n this.observer = new MutationObserver(this.mutation);\n this.enhanceController();\n this.observe();\n }\n enhanceController() {\n const controllerDisconnect = this.controller.disconnect.bind(this.controller);\n const disconnect = () => {\n this.unobserve();\n controllerDisconnect();\n };\n Object.assign(this.controller, { disconnect });\n }\n}\nexport const useMutation = (controller, options = {}) => {\n const observer = new UseMutation(controller, options);\n return [observer.observe, observer.unobserve];\n};\n//# sourceMappingURL=use-mutation.js.map","import { method } from '../support/index';\nexport const useWindowResize = (controller) => {\n const callback = (event) => {\n const { innerWidth, innerHeight } = window;\n const payload = {\n height: innerHeight || Infinity,\n width: innerWidth || Infinity,\n event\n };\n method(controller, 'windowResize').call(controller, payload);\n };\n const controllerDisconnect = controller.disconnect.bind(controller);\n const observe = () => {\n window.addEventListener('resize', callback);\n callback();\n };\n const unobserve = () => {\n window.removeEventListener('resize', callback);\n };\n Object.assign(controller, {\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-window-resize.js.map","import { Controller } from 'stimulus';\nclass DebounceController extends Controller {\n}\nDebounceController.debounces = [];\nconst defaultWait = 200;\nconst debounce = (fn, wait = defaultWait) => {\n let timeoutId = null;\n return function () {\n const args = arguments;\n const context = this;\n const callback = () => fn.apply(context, args);\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n timeoutId = setTimeout(callback, wait);\n };\n};\nexport const useDebounce = (controller, options) => {\n var _a;\n const constructor = controller.constructor;\n (_a = constructor.debounces) === null || _a === void 0 ? void 0 : _a.forEach((func) => {\n if (typeof func === \"string\") {\n controller[func] = debounce(controller[func], options === null || options === void 0 ? void 0 : options.wait);\n }\n if (typeof func === \"object\") {\n const { name, wait } = func;\n if (!name)\n return;\n controller[name] = debounce(controller[name], wait || (options === null || options === void 0 ? void 0 : options.wait));\n }\n });\n};\n//# sourceMappingURL=use-debounce.js.map","import {useWindowResize} from \"stimulus-use\";\nimport {BaseController} from \"./base_controller\";\n\nexport class AutosizeController extends BaseController {\n\n private boundHandler = this.handler.bind(this);\n\n connect() {\n let target = this.element as HTMLTextAreaElement;\n target.style.resize = \"none\";\n target.style.boxSizing = \"border-box\";\n target.addEventListener(\"input\", this.boundHandler);\n target.addEventListener(\"focus\", this.boundHandler);\n useWindowResize(this);\n requestAnimationFrame(this.boundHandler);\n }\n\n windowResize() {\n this.handler();\n }\n\n private handler() {\n this.autosize(this.element as HTMLTextAreaElement);\n };\n\n private autosize(element: HTMLTextAreaElement) {\n let offset = element.offsetHeight - element.clientHeight;\n element.style.height = \"auto\";\n element.style.height = element.scrollHeight + offset + \"px\";\n }\n\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class CharCountController extends BaseController {\r\n\r\n static targets = [\"input\", \"output\"];\r\n static values = {min: Number, max: Number};\r\n static classes = [\"error\"];\r\n\r\n declare readonly inputTarget: HTMLInputElement | HTMLTextAreaElement;\r\n declare readonly outputTarget: HTMLElement;\r\n declare minValue: number;\r\n declare hasMinValue: boolean;\r\n declare maxValue: number;\r\n declare hasMaxValue: boolean;\r\n declare errorClass: string;\r\n declare hasErrorClass: boolean;\r\n\r\n boundHandler = this.updateCharCount.bind(this);\r\n\r\n connect() {\r\n this.updateCharCount();\r\n this.inputTarget.addEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n this.inputTarget.removeEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n updateCharCount() {\r\n let charCount = this.inputTarget.value.length;\r\n this.outputTarget.innerText = charCount.toString();\r\n if (this.hasErrorClass) {\r\n if (this.isValidCount(charCount)) {\r\n this.outputTarget.classList.remove(this.errorClass);\r\n } else {\r\n this.outputTarget.classList.add(this.errorClass);\r\n }\r\n }\r\n }\r\n\r\n isValidCount(count: number) {\r\n let min = 0;\r\n let max = 99999;\r\n\r\n if (this.hasMinValue) {\r\n min = this.minValue;\r\n }\r\n\r\n if (this.hasMaxValue) {\r\n max = this.maxValue;\r\n }\r\n\r\n return count >= min && count <= max;\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class ClipboardController extends BaseController {\r\n\r\n static targets = [\"button\", \"copy\", \"fallback\"];\r\n static values = {removeUnused: Boolean};\r\n\r\n declare readonly sourceTarget: HTMLElement;\r\n declare readonly copyTarget: HTMLElement;\r\n declare readonly hasCopyTarget: boolean;\r\n declare readonly fallbackTarget: HTMLElement;\r\n declare readonly hasFallbackTarget: boolean;\r\n\r\n declare readonly hasRemoveUnusedValue: boolean;\r\n declare readonly removeUnusedValue: boolean;\r\n\r\n supported = false;\r\n\r\n connect() {\r\n this.supported = document.queryCommandSupported(\"copy\");\r\n\r\n if (this.hasRemoveUnusedValue && this.removeUnusedValue) {\r\n if (this.supported && this.hasFallbackTarget) {\r\n this.fallbackTarget.remove();\r\n } else if (this.hasCopyTarget) {\r\n this.copyTarget.remove();\r\n }\r\n }\r\n }\r\n\r\n select(event: MouseEvent) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n (this.sourceTarget as HTMLInputElement | HTMLTextAreaElement).select();\r\n }\r\n\r\n copy(event: ClipboardEvent) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n (this.sourceTarget as HTMLInputElement | HTMLTextAreaElement).select();\r\n if (this.supported) {\r\n document.execCommand(\"copy\");\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\n\nexport class ConfirmNavigationController extends BaseController {\n\n static values = {message: String};\n\n declare readonly messageValue: string;\n\n connect() {\n let confirmMessage = this.messageValue;\n window.onbeforeunload = () => (confirmMessage == null ? true : confirmMessage);\n window.addEventListener(\"popstate\", this.handlePopstate);\n window.addEventListener(\"submit\", () => {\n window.removeEventListener(\"popstate\", this.handlePopstate);\n window.onbeforeunload = null;\n });\n // TODO: Turbo navigation events\n }\n\n handlePopstate(event: PopStateEvent) {\n return false;\n }\n\n}\n","import {BaseController} from \"./base_controller\";\n\nexport class DebugController extends BaseController {\n\n static targets = [\"test\"];\n declare testTargets: HTMLElement[];\n\n connect() {\n console.log(\"Debug Controller\", this, this.testTargets);\n }\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DetectDirtyController extends BaseController {\r\n\r\n initialValue: string | boolean | null = null;\r\n\r\n boundHandler = this.handler.bind(this);\r\n\r\n connect() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n if (this.isInputElement(element) && this.isCheckable(element)) {\r\n this.initialValue = element.checked;\r\n } else {\r\n this.initialValue = element.value;\r\n }\r\n element.addEventListener(\"input\", this.boundHandler);\r\n element.addEventListener(\"change\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n element.removeEventListener(\"input\", this.boundHandler);\r\n element.removeEventListener(\"change\", this.boundHandler);\r\n }\r\n\r\n restore() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n if (this.isInputElement(element) && this.isCheckable(element)) {\r\n element.checked = this.initialValue as boolean;\r\n } else {\r\n element.value = this.initialValue as string;\r\n }\r\n }\r\n\r\n private handler(event?: Event) {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n\r\n if (this.initialValue !== element.value) {\r\n element.setAttribute(\"data-dirty\", \"true\");\r\n } else {\r\n element.removeAttribute(\"data-dirty\");\r\n }\r\n }\r\n\r\n private isCheckable(element: HTMLInputElement): boolean {\r\n return (element.type === \"radio\" || element.type === \"checkbox\");\r\n }\r\n\r\n private isInputElement(element: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement): element is HTMLInputElement {\r\n return element.tagName === \"INPUT\";\r\n }\r\n\r\n}\r\n\r\nexport function isDirty(element: HTMLElement) {\r\n return element.hasAttribute(\"data-dirty\");\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DisableInputsController extends BaseController {\r\n\r\n static targets = [\"disabler\", \"disable\"];\r\n\r\n static values = {\r\n clear: Boolean,\r\n };\r\n\r\n declare readonly hasDisablerTarget: boolean;\r\n declare readonly disablerTarget: HTMLInputElement;\r\n declare readonly disableTargets: Array;\r\n declare readonly clearValue: boolean;\r\n declare readonly hasClearValue: boolean;\r\n\r\n connect() {\r\n this.toggle();\r\n }\r\n\r\n toggle() {\r\n if (this.hasDisablerTarget && this.disablerTarget.checked) {\r\n this.disableInputs();\r\n } else {\r\n this.enableInputs();\r\n }\r\n }\r\n\r\n disableInputs() {\r\n let shouldClear = this.hasClearValue && this.clearValue;\r\n this.disableTargets.forEach((el, _) => {\r\n if (shouldClear) {\r\n el.value = \"\";\r\n }\r\n el.disabled = true;\r\n });\r\n }\r\n\r\n enableInputs() {\r\n this.disableTargets.forEach((el, _) => {\r\n el.disabled = false;\r\n });\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DismissableController extends BaseController {\r\n\r\n\r\n dismiss() {\r\n this.element.remove();\r\n }\r\n\r\n}\r\n","import {useMutation} from \"stimulus-use\";\r\nimport {BaseController} from \"./base_controller\";\r\n\r\nexport class EmptyDomController extends BaseController {\r\n\r\n static classes = [\"empty\", \"notEmpty\"];\r\n static values = {scopeSelector: String};\r\n\r\n declare hasEmptyClass: boolean;\r\n declare emptyClass: string;\r\n declare hasNotEmptyClass: boolean;\r\n declare notEmptyClass: string;\r\n\r\n declare hasScopeSelectorValue: boolean;\r\n declare scopeSelectorValue: string;\r\n\r\n connect() {\r\n useMutation(this, {element: this.element, childList: true});\r\n this.checkEmpty();\r\n }\r\n\r\n mutate(entries: MutationRecord[]) {\r\n this.checkEmpty();\r\n }\r\n\r\n checkEmpty() {\r\n let children;\r\n if (this.hasScopeSelectorValue) {\r\n children = this.element.querySelectorAll(this.scopeSelectorValue);\r\n } else {\r\n children = this.element.children;\r\n }\r\n\r\n if (children.length === 0) {\r\n if (this.hasNotEmptyClass) {\r\n let classes = this.notEmptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.remove(klass));\r\n }\r\n if (this.hasEmptyClass) {\r\n let classes = this.emptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.add(klass));\r\n }\r\n this.element.dispatchEvent(\r\n new CustomEvent(\"dom:empty\", {\r\n bubbles: true,\r\n cancelable: true,\r\n }),\r\n );\r\n } else {\r\n if (this.hasNotEmptyClass) {\r\n let classes = this.notEmptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.add(klass));\r\n }\r\n if (this.hasEmptyClass) {\r\n let classes = this.emptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.remove(klass));\r\n }\r\n this.element.dispatchEvent(\r\n new CustomEvent(\"dom:not-empty\", {\r\n bubbles: true,\r\n cancelable: true,\r\n detail: {\r\n count: children.length,\r\n },\r\n }),\r\n );\r\n }\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class EnableInputsController extends BaseController {\r\n\r\n static targets = [\"enabler\", \"enable\"];\r\n\r\n static values = {\r\n clear: Boolean,\r\n };\r\n\r\n declare readonly hasEnablerTarget: boolean;\r\n declare readonly enablerTarget: HTMLInputElement;\r\n declare readonly enableTargets: Array;\r\n declare readonly clearValue: boolean;\r\n declare readonly hasClearValue: boolean;\r\n\r\n connect() {\r\n this.toggle();\r\n }\r\n\r\n toggle() {\r\n if (this.hasEnablerTarget && this.enablerTarget.checked) {\r\n this.enableInputs();\r\n } else {\r\n this.disableInputs();\r\n }\r\n }\r\n\r\n disableInputs() {\r\n let shouldClear = this.hasClearValue && this.clearValue;\r\n this.enableTargets.forEach((el, _) => {\r\n if (shouldClear) {\r\n el.value = \"\";\r\n }\r\n el.disabled = true;\r\n });\r\n }\r\n\r\n enableInputs() {\r\n this.enableTargets.forEach((el, _) => {\r\n el.disabled = false;\r\n });\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class FallbackImageController extends BaseController {\r\n\r\n static values = {placeholder: String};\r\n\r\n declare readonly placeholderValue: string;\r\n declare readonly hasPlaceholderValue: boolean;\r\n\r\n connect() {\r\n let element = this.element as HTMLImageElement;\r\n\r\n element.onerror = () => {\r\n if (this.hasPlaceholderValue) {\r\n element.src = this.placeholderValue;\r\n } else {\r\n element.style.display = \"none\";\r\n }\r\n };\r\n }\r\n\r\n}\r\n","import {useIntersection} from \"stimulus-use\";\nimport {IntersectionOptions} from \"stimulus-use/dist/use-intersection/use-intersection\";\nimport {AsyncBlockController} from \"./async_block_controller\";\n\nexport class LazyBlockController extends AsyncBlockController {\n\n declare observe: () => void;\n declare unobserve: () => void;\n declare options: IntersectionOptions;\n declare isVisible: boolean;\n declare disappear: () => void;\n\n connect() {\n let element = this.element;\n this.options = {element, threshold: 0.3};\n\n if (\"IntersectionObserver\" in window) {\n [this.observe, this.unobserve] = useIntersection(this, this.options);\n } else {\n // Client doesn't support intersection observer, fallback to pre-loading\n this.loadContent();\n }\n }\n\n appear(entry: IntersectionObserverEntry) {\n let element = this.element as HTMLImageElement;\n if (element.src !== \"\") {\n return;\n }\n if (entry.target === element && entry.isIntersecting) {\n this.loadContent();\n if (this.unobserve) {\n this.unobserve();\n }\n }\n }\n\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class LimitedSelectionCheckboxesController extends BaseController {\r\n\r\n static targets = [\"input\", \"error\"];\r\n static values = {max: Number, message: String};\r\n\r\n declare readonly hasErrorTarget: boolean;\r\n declare readonly errorTarget: HTMLElement;\r\n declare readonly inputTargets: HTMLInputElement[];\r\n declare readonly maxValue: number;\r\n declare readonly messageValue: string;\r\n\r\n maxSelections = 0;\r\n\r\n boundHandleInputs = this.handleInputs.bind(this);\r\n\r\n connect() {\r\n this.inputTargets.forEach((el) => el.addEventListener(\"change\", this.boundHandleInputs));\r\n }\r\n\r\n disconnect() {\r\n this.inputTargets.forEach((el) => el.removeEventListener(\"change\", this.boundHandleInputs));\r\n }\r\n\r\n handleInputs(event: Event) {\r\n let tickedInputs = this.inputTargets.reduce((previousValue, el) => el.checked ? previousValue + 1 : previousValue, 0);\r\n let target = event.target as HTMLInputElement;\r\n if (tickedInputs > this.maxSelections) {\r\n event.preventDefault();\r\n target.checked = false;\r\n target.dispatchEvent(new CustomEvent(\"change\", {bubbles: true, cancelable: true}));\r\n target.dispatchEvent(new CustomEvent(\"limited-selection:too-many\", {bubbles: true, cancelable: true, detail: {target}}));\r\n if (this.hasErrorTarget) {\r\n this.errorTarget.innerHTML = this.messageValue;\r\n }\r\n } else {\r\n target.dispatchEvent(new CustomEvent(\"limited-selection:selection\", {bubbles: true, cancelable: true, detail: {target}}));\r\n if (this.hasErrorTarget) {\r\n this.errorTarget.innerHTML = \"\";\r\n }\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class PasswordConfirmController extends BaseController {\r\n\r\n static targets = [\"password\"];\r\n static classes = [\"error\"];\r\n\r\n declare readonly passwordTargets: HTMLInputElement[];\r\n\r\n declare readonly errorClass: string;\r\n declare readonly hasErrorClass: boolean;\r\n\r\n private boundCheckPasswordsMatch = this.checkPasswordsMatch.bind(this);\r\n\r\n connect() {\r\n this.passwordTargets.forEach((el) => el.addEventListener(\"change\", this.boundCheckPasswordsMatch));\r\n }\r\n\r\n disconnect() {\r\n this.passwordTargets.forEach((el) => el.removeEventListener(\"change\", this.boundCheckPasswordsMatch));\r\n }\r\n\r\n private allPasswordsMatch() {\r\n let values = new Set(this.passwordTargets.map(el => el.value)); // Create a unique set of the password values\r\n return values.has(\"\") || values.size == 1; // If any of the passwords are still blank, or there is only one distinct password value (i.e. they all are the same)\r\n }\r\n\r\n private checkPasswordsMatch() {\r\n if (this.allPasswordsMatch()) {\r\n this.element.dispatchEvent(new CustomEvent(\"password-confirm:match\"));\r\n if (this.hasErrorClass) {\r\n this.passwordTargets.forEach(el => el.classList.remove(this.errorClass));\r\n }\r\n } else {\r\n this.element.dispatchEvent(new CustomEvent(\"password-confirm:no-match\"));\r\n if (this.hasErrorClass) {\r\n this.passwordTargets.forEach(el => el.classList.add(this.errorClass));\r\n }\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class PasswordPeekController extends BaseController {\r\n\r\n static targets = [\"password\"];\r\n\r\n declare readonly passwordTarget: HTMLInputElement;\r\n\r\n\r\n peak(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n this.passwordTarget.type = \"text\";\r\n }\r\n\r\n hide(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n this.passwordTarget.type = \"password\";\r\n }\r\n\r\n toggle(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n if (this.passwordTarget.type === \"password\") {\r\n this.peak();\r\n } else {\r\n this.hide();\r\n }\r\n }\r\n}\r\n","import {useDebounce, useWindowResize} from \"stimulus-use\";\nimport {WindowResizePayload} from \"stimulus-use/dist/use-window-resize/use-window-resize\";\nimport {BaseController} from \"./base_controller\";\n\ninterface ResponsiveIframeMessage {\n name: string,\n height: number,\n}\n\nexport class ResponsiveIframeWrapperController extends BaseController {\n\n boundMessageReceived = this.messageReceived.bind(this);\n\n connect() {\n window.addEventListener(\"message\", this.boundMessageReceived);\n }\n\n disconnect() {\n window.removeEventListener(\"message\", this.boundMessageReceived);\n }\n\n messageReceived(message: MessageEvent) {\n let data = message.data;\n if (data.hasOwnProperty(\"name\") && data.name === \"iframe-body\" && data.hasOwnProperty(\"height\")) {\n this.resize(data.height);\n }\n }\n\n resize(height: number) {\n (this.element as HTMLIFrameElement).style.height = `${height}px`;\n }\n\n}\n\nexport class ResponsiveIframeBodyController extends BaseController {\n\n static debounces = [\"postUpdate\"];\n\n declare observe: () => void;\n declare unobserve: () => void;\n\n connect() {\n // If this Window is inside a frame\n if (window.self !== window.top) {\n useWindowResize(this);\n useDebounce(this, {});\n this.postUpdate();\n } else {\n // Not an iframe\n }\n }\n\n windowResize(payload: WindowResizePayload) {\n this.postUpdate();\n };\n\n postUpdate() {\n let payload: ResponsiveIframeMessage = {name: \"iframe-body\", height: this.getHeight()};\n window.parent.postMessage(\n payload,\n \"*\",\n );\n }\n\n getHeight(): number {\n const body = document.body;\n const html = document.documentElement;\n\n // Get the largest height out of body and html's various height measurements\n return Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);\n }\n\n}\n","const smoothSupported = \"scrollBehavior\" in document.documentElement.style;\r\nlet smoothPolyfilled: boolean;\r\n\r\nexport async function scrollToElement(element: Element, {behavior = \"smooth\", block = \"start\", inline = \"nearest\"}: ScrollIntoViewOptions = {}) {\r\n if (behavior == \"smooth\" && !smoothSupported) {\r\n await polyfillSmooth();\r\n }\r\n element.scrollIntoView({behavior, block, inline});\r\n}\r\n\r\nasync function polyfillSmooth() {\r\n const {polyfill} = await import(/* webpackChunkName: \"smoothscroll-polyfill\" */ \"smoothscroll-polyfill\");\r\n if (smoothPolyfilled) {\r\n return;\r\n }\r\n smoothPolyfilled = true;\r\n polyfill();\r\n}\r\n\r\nexport function getScrollParent(node: HTMLElement | null): HTMLElement | null {\r\n if (!node) {\r\n return null;\r\n }\r\n const overflowY = getComputedStyle(node).overflowY;\r\n const isScrollable = overflowY !== \"visible\" && overflowY !== \"hidden\";\r\n\r\n if (isScrollable && node.scrollHeight >= node.clientHeight) {\r\n return node;\r\n }\r\n\r\n return getScrollParent(node.parentElement) || document.body;\r\n}\r\n","import camelCase from \"lodash.camelcase\";\r\nimport {BaseController} from \"../base_controller\";\r\n\r\nexport class EphemeralController extends BaseController {\r\n\r\n cleanupSelf() {\r\n this.cleanup(this.element as HTMLElement);\r\n }\r\n\r\n cleanup(element: HTMLElement) {\r\n element.dataset.controller = element.dataset.controller?.replaceAll(new RegExp(`(\\s|^)${this.identifier}(\\s|$)`, \"g\"), \"\") || \"\";\r\n if (element.dataset.controller == \"\") {\r\n // If there are no controllers left, remove the attribute\r\n delete element.dataset.controller;\r\n }\r\n\r\n let substringIdentifierValueRegex = new RegExp(`(\\s|^)${this.identifier}\\\\..+?(\\s|$)`, \"g\");\r\n element.dataset.target = element.dataset.target?.replaceAll(substringIdentifierValueRegex, \"\") || \"\";\r\n delete element.dataset[camelCase(`${this.identifier}-target`)];\r\n if (element.dataset.target == \"\") {\r\n // If there are no targets left, remove the attribute\r\n delete element.dataset.target;\r\n }\r\n\r\n element.dataset.action = element.dataset.target?.replaceAll(substringIdentifierValueRegex, \"\") || \"\";\r\n delete element.dataset[camelCase(`${this.identifier}-action`)];\r\n if (element.dataset.action == \"\") {\r\n // If there are no actions left, remove the attribute\r\n delete element.dataset.action;\r\n }\r\n\r\n // @ts-ignore\r\n let values = this.constructor.values;\r\n if (values) {\r\n Object.keys(values).forEach(val => delete element.dataset[camelCase(`${this.identifier}-${val}-value`)]);\r\n }\r\n\r\n // @ts-ignore\r\n let classes = this.constructor.classes;\r\n if (classes) {\r\n Object.keys(classes).forEach(val => delete element.dataset[camelCase(`${this.identifier}-${val}-class`)]);\r\n }\r\n }\r\n\r\n}\r\n","import {EphemeralController} from \"./utilities/ephemeral_controller\";\r\nimport {scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollIntoFocusController extends EphemeralController {\r\n\r\n static values = {\r\n behavior: String,\r\n block: String,\r\n inline: String,\r\n };\r\n\r\n declare behaviorValue: ScrollBehavior;\r\n declare hasBehaviorValue: boolean;\r\n declare blockValue: ScrollLogicalPosition;\r\n declare hasBlockValue: boolean;\r\n declare inlineValue: ScrollLogicalPosition;\r\n declare hasInlineValue: boolean;\r\n\r\n connect() {\r\n requestAnimationFrame(() => {\r\n // Attempt smooth scrolling, with polyfill\r\n scrollToElement(\r\n this.element,\r\n {\r\n behavior: this.hasBehaviorValue ? this.behaviorValue : \"smooth\",\r\n block: this.hasBlockValue ? this.blockValue : \"center\",\r\n inline: this.hasInlineValue ? this.inlineValue : \"center\",\r\n },\r\n ).catch(() => this.element.scrollIntoView()); // Fallback to snap-scrolling\r\n this.cleanupSelf();\r\n });\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\nimport {getScrollParent, scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollToBottomController extends BaseController {\r\n\r\n static values = {\r\n mode: String,\r\n };\r\n\r\n declare modeValue: \"nearest\" | \"document\";\r\n declare hasModeValue: boolean;\r\n\r\n\r\n scroll(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n let mode = this.hasModeValue ? this.modeValue : \"document\";\r\n let target: null | HTMLElement;\r\n if (mode == \"document\") {\r\n target = document.body;\r\n } else {\r\n target = getScrollParent(this.element as HTMLElement);\r\n }\r\n if (target == null) {\r\n return;\r\n }\r\n scrollToElement(target!, {behavior: \"smooth\", block: \"end\"}).catch(() => target!.scrollIntoView(false));\r\n }\r\n\r\n}\r\n\r\n","import {BaseController} from \"./base_controller\";\r\nimport {scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollToController extends BaseController {\r\n\r\n static values = {\r\n selector: String,\r\n behavior: String,\r\n block: String,\r\n inline: String,\r\n };\r\n\r\n declare selectorValue: string;\r\n declare behaviorValue: ScrollBehavior;\r\n declare hasBehaviorValue: boolean;\r\n declare blockValue: ScrollLogicalPosition;\r\n declare hasBlockValue: boolean;\r\n declare inlineValue: ScrollLogicalPosition;\r\n declare hasInlineValue: boolean;\r\n\r\n\r\n scroll() {\r\n let target = document.querySelector(this.selectorValue);\r\n if (!target) {\r\n console.warn(`Could not find target for '${this.selectorValue}'`);\r\n return;\r\n }\r\n\r\n scrollToElement(\r\n target!,\r\n {\r\n behavior: this.hasBehaviorValue ? this.behaviorValue : \"smooth\",\r\n block: this.hasBlockValue ? this.blockValue : \"center\",\r\n inline: this.hasInlineValue ? this.inlineValue : \"center\",\r\n },\r\n ).catch(() => target!.scrollIntoView()); // Fallback to snap-scrolling\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\nimport {getScrollParent, scrollToElement} from \"./utilities/scroll\";\n\nexport class ScrollToTopController extends BaseController {\n\n static values = {\n mode: String,\n };\n\n declare modeValue: \"nearest\" | \"document\";\n declare hasModeValue: boolean;\n\n\n scroll(event?: Event) {\n if (event) {\n event.preventDefault();\n }\n let mode = this.hasModeValue ? this.modeValue : \"document\";\n let target: null | HTMLElement;\n if (mode == \"document\") {\n target = document.body;\n } else {\n target = getScrollParent(this.element as HTMLElement);\n }\n if (target == null) {\n return;\n }\n scrollToElement(target!, {behavior: \"smooth\", block: \"start\"}).catch(() => target!.scrollIntoView(false));\n }\n\n}\n\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class SelfDestructController extends BaseController {\r\n\r\n static values = {seconds: Number};\r\n\r\n declare readonly secondsValue: number;\r\n timeout: null | ReturnType = null;\r\n\r\n connect() {\r\n requestAnimationFrame(() => {\r\n // Only start countdown on first paint\r\n this.timeout = setTimeout(() => this.element.remove(), this.secondsValue * 1000);\r\n });\r\n }\r\n\r\n disconnect() {\r\n if (this.timeout) {\r\n clearTimeout(this.timeout);\r\n }\r\n }\r\n\r\n}\r\n","import {EphemeralController} from \"./utilities/ephemeral_controller\";\r\n\r\nexport class TeleportController extends EphemeralController {\r\n\r\n static values = {target: String, insert: String, immediate: Boolean};\r\n\r\n declare readonly immediateValue: boolean;\r\n declare readonly hasImmediateValue: boolean;\r\n declare readonly targetValue: string;\r\n declare readonly hasInsertValue: boolean;\r\n declare readonly insertValue: InsertPosition | \"replaceOuter\" | \"replaceInner\" | \"prepend\" | \"append\";\r\n\r\n connect() {\r\n if (!this.hasInsertValue) {\r\n throw new Error(\"`insert` value was not specified\");\r\n }\r\n\r\n requestAnimationFrame(() => {\r\n if (this.hasImmediateValue && this.immediateValue) {\r\n this.execute();\r\n }\r\n });\r\n }\r\n\r\n execute(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n let destination = document.querySelector(this.targetValue);\r\n\r\n if (destination == null) {\r\n this.element.dispatchEvent(new CustomEvent(\"teleport:error\", {bubbles: true, cancelable: true}));\r\n return;\r\n }\r\n\r\n let copy = this.element.cloneNode(true) as HTMLElement;\r\n this.cleanup(copy);\r\n\r\n switch (this.insertValue) {\r\n case \"beforebegin\":\r\n case \"beforeend\":\r\n case \"afterend\":\r\n case \"afterbegin\":\r\n destination.insertAdjacentHTML(this.insertValue, copy.outerHTML);\r\n break;\r\n case \"replaceOuter\":\r\n destination.outerHTML = copy.outerHTML;\r\n break;\r\n case \"replaceInner\":\r\n destination.innerHTML = copy.outerHTML;\r\n break;\r\n case \"prepend\":\r\n destination.insertAdjacentHTML(\"afterbegin\", copy.outerHTML);\r\n break;\r\n case \"append\":\r\n destination.insertAdjacentHTML(\"beforeend\", copy.outerHTML);\r\n break;\r\n default:\r\n throw new Error(\"`insert` value was not specified\");\r\n\r\n }\r\n this.element.remove();\r\n }\r\n\r\n}\r\n","import {useClickOutside, useHover} from \"stimulus-use\";\nimport {BaseController} from \"./base_controller\";\n\nexport type ToggleClassMode = \"on\" | \"off\" | \"toggle\"\n\nexport class ToggleClassController extends BaseController {\n\n static targets = [\"toggle\"];\n static values = {\n class: String,\n mouseEnter: String,\n mouseLeave: String,\n clickAway: Boolean,\n initial: String,\n };\n\n declare readonly toggleTargets: HTMLElement[];\n\n declare readonly classValue: string;\n declare readonly hasClassValue: boolean;\n\n declare readonly mouseEnterValue: ToggleClassMode;\n declare readonly hasMouseEnterValue: boolean;\n\n declare readonly mouseLeaveValue: ToggleClassMode;\n declare readonly hasMouseLeaveValue: boolean;\n\n declare readonly clickAwayValue: boolean;\n declare readonly hasClickAwayValue: boolean;\n\n declare readonly initialValue: \"on\" | \"off\";\n declare readonly hasInitialValue: boolean;\n\n connect() {\n if (!this.hasClassValue) {\n throw new Error(\"data-toggle-class-class-value must not be empty\");\n }\n\n if (this.hasMouseEnterValue || this.hasMouseLeaveValue) {\n useHover(this);\n }\n\n if (this.hasClickAwayValue && this.clickAwayValue) {\n useClickOutside(this);\n }\n\n requestAnimationFrame(() => {\n if (this.hasInitialValue) {\n if (this.initialValue === \"on\") {\n this.toggleTargets.forEach((target) => this.elementOn(target));\n } else {\n this.toggleTargets.forEach((target) => this.elementOff(target));\n }\n }\n });\n }\n\n clickOutside() {\n this.toggleTargets.forEach((target) => {\n if (this.elementWasToggled(target)) {\n this.elementToggleStatus(target);\n this.elementToggle(target);\n }\n });\n }\n\n mouseEnter() {\n if (this.hasMouseEnterValue) {\n switch (this.mouseEnterValue) {\n case \"on\":\n this.on();\n break;\n case \"off\":\n this.off();\n break;\n case \"toggle\":\n this.toggle();\n break;\n }\n }\n return {};\n }\n\n mouseLeave() {\n if (this.hasMouseLeaveValue) {\n switch (this.mouseLeaveValue) {\n case \"on\":\n this.on();\n break;\n case \"off\":\n this.off();\n break;\n case \"toggle\":\n this.toggle();\n break;\n }\n }\n return {};\n }\n\n on(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementOn(target);\n });\n }\n\n off(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementOff(target);\n });\n }\n\n toggle(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementToggle(target);\n });\n }\n\n private elementWasToggled(el: HTMLElement): boolean {\n return el.dataset.toggled == \"true\";\n }\n\n private elementToggleStatus(el: HTMLElement) {\n if (this.elementWasToggled(el)) {\n delete el.dataset.toggled;\n } else {\n el.dataset.toggled = \"true\";\n }\n }\n\n private elementToggle(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass));\n }\n\n private elementOn(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass, true));\n }\n\n private elementOff(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass, false));\n }\n\n}\n","import {BaseController} from \"./base_controller\";\nimport {isHTMLLinkElement} from \"./utilities/elements\";\nimport {isTurboFrame} from \"./utilities/turbo\";\n\nexport class TurboFrameRCController extends BaseController {\n\n static values = {\n frameId: String,\n src: String,\n loadingMessage: String,\n };\n\n declare readonly frameIdValue: string;\n declare readonly srcValue: string;\n declare readonly hasSrcValue: boolean;\n declare readonly loadingMessageValue: string;\n declare readonly hasLoadingMessageValue: boolean;\n\n toggle(event?: Event | null) {\n if (event) {\n event.preventDefault();\n }\n let frame = this.getFrame();\n let frameSrc = frame.src;\n if (frameSrc == null || frameSrc !== this.getSrc()) {\n this.setSrc();\n } else {\n this.clear();\n }\n }\n\n setSrc(event?: Event | null) {\n if (event) {\n event.preventDefault();\n }\n let frame = this.getFrame();\n if (this.hasLoadingMessageValue) {\n frame.innerHTML = this.loadingMessageValue;\n }\n\n frame.src = this.getSrc();\n }\n\n clear(event?: Event | null) {\n if (event) {\n event.preventDefault();\n }\n let frame = this.getFrame();\n frame.src = \"\";\n frame.innerHTML = \"\";\n }\n\n private getFrame(): TurboFrame {\n let frame = document.getElementById(`${this.frameIdValue}`);\n if (frame == null) {\n throw new Error(`Could not find frame with ID '${this.frameIdValue}'`);\n }\n if (!isTurboFrame(frame)) {\n throw new Error(`Element targeted by ID '${this.frameIdValue}'`);\n } else {\n return frame;\n }\n }\n\n private getSrc(): string {\n let element = this.element as HTMLElement;\n if (this.hasSrcValue) {\n return this.srcValue;\n } else if (isHTMLLinkElement(element)) {\n return element.href;\n } else {\n throw new Error(\"No link given to drive frame to\");\n }\n }\n\n}\n","export function isTurboFrame(element: HTMLElement): element is TurboFrame {\r\n return element.nodeName == \"TURBO-FRAME\";\r\n}\r\n","export function isHTMLLinkElement(element: Element): element is HTMLLinkElement {\n return element.nodeName == \"A\";\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class WordCountController extends BaseController {\r\n\r\n static targets = [\"input\", \"output\"];\r\n static values = {min: Number, max: Number};\r\n static classes = [\"error\"];\r\n\r\n declare readonly inputTarget: HTMLInputElement | HTMLTextAreaElement;\r\n declare readonly outputTarget: HTMLElement;\r\n declare minValue: number;\r\n declare hasMinValue: boolean;\r\n declare maxValue: number;\r\n declare hasMaxValue: boolean;\r\n declare errorClass: string;\r\n declare hasErrorClass: boolean;\r\n\r\n boundHandler = this.updateWordCount.bind(this);\r\n\r\n connect() {\r\n this.updateWordCount();\r\n this.inputTarget.addEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n this.inputTarget.removeEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n updateWordCount() {\r\n let wordCount = 0;\r\n let textAreaValue = this.inputTarget.value;\r\n let matches = textAreaValue.match(/\\S+/g);\r\n wordCount = (matches && matches.length) || 0;\r\n this.outputTarget.innerText = wordCount.toString();\r\n if (this.hasErrorClass) {\r\n if (this.isValidCount(wordCount)) {\r\n this.outputTarget.classList.remove(this.errorClass);\r\n } else {\r\n this.outputTarget.classList.add(this.errorClass);\r\n }\r\n }\r\n }\r\n\r\n isValidCount(count: number) {\r\n let min = 0;\r\n let max = 99999;\r\n\r\n if (this.hasMinValue) {\r\n min = this.minValue;\r\n }\r\n\r\n if (this.hasMaxValue) {\r\n max = this.maxValue;\r\n }\r\n\r\n return count >= min && count <= max;\r\n }\r\n\r\n}\r\n"],"names":["BaseController","context","_this","Proxy","get","obj","prop","returnVal","Reflect","self","test","logProperty","toString","apply","target","thisArg","argArray","log","args","functionName","this","application","debug","logger","console","groupCollapsed","identifier","element","groupEnd","Controller","AsyncBlockController","connect","loadContent","el","hasReplaceTarget","replaceTarget","fetch","endpointValue","then","response","text","html","newEl","document","createElement","innerHTML","replaceWith","event","CustomEvent","detail","dispatchEvent","err","endpoint","String","AutoSubmitFormController","handler","bind","querySelectorAll","forEach","addEventListener","_this2","boundHandler","disconnect","removeEventListener","_this3","e","bubbles","cancelable","method","controller","methodName","composeEventName","name","eventPrefix","composedName","extendedEvent","type","composed","Object","assign","originalEvent","defaultOptions","events","onlyVisible","StimulusUse","[object Object]","options","_a","_b","_c","controllerId","stimulusUseDebug","id","dataset","controllerInitialize","initialize","controllerConnect","controllerDisconnect","UseHover","super","observe","targetElement","onEnter","onLeave","unobserve","call","hover","enhanceController","UseMutation","observer","error","handleError","mutation","entries","MutationObserver","useWindowResize","callback","innerWidth","innerHeight","window","payload","height","Infinity","width","debounce","fn","wait","timeoutId","arguments","clearTimeout","setTimeout","AutosizeController","style","resize","boxSizing","requestAnimationFrame","windowResize","autosize","offset","offsetHeight","clientHeight","scrollHeight","CharCountController","updateCharCount","inputTarget","charCount","value","length","outputTarget","innerText","hasErrorClass","isValidCount","classList","remove","errorClass","add","count","min","max","hasMinValue","minValue","hasMaxValue","maxValue","Number","ClipboardController","supported","queryCommandSupported","hasRemoveUnusedValue","removeUnusedValue","hasFallbackTarget","fallbackTarget","hasCopyTarget","copyTarget","select","preventDefault","sourceTarget","copy","execCommand","removeUnused","Boolean","ConfirmNavigationController","confirmMessage","messageValue","onbeforeunload","handlePopstate","message","DebugController","testTargets","DetectDirtyController","initialValue","isInputElement","isCheckable","checked","restore","setAttribute","removeAttribute","tagName","DisableInputsController","toggle","hasDisablerTarget","disablerTarget","disableInputs","enableInputs","shouldClear","hasClearValue","clearValue","disableTargets","_","disabled","clear","DismissableController","dismiss","EmptyDomController","useMutation","childList","checkEmpty","mutate","children","hasScopeSelectorValue","scopeSelectorValue","hasNotEmptyClass","notEmptyClass","split","klass","hasEmptyClass","emptyClass","scopeSelector","EnableInputsController","hasEnablerTarget","enablerTarget","enableTargets","FallbackImageController","onerror","hasPlaceholderValue","src","placeholderValue","display","placeholder","LazyBlockController","threshold","IntersectionObserver","entry","isIntersecting","isVisible","eventName","appearEvent","dispatchAppear","disappearEvent","dispatchDisappear","useIntersection","appear","LimitedSelectionCheckboxesController","handleInputs","inputTargets","boundHandleInputs","tickedInputs","reduce","previousValue","maxSelections","hasErrorTarget","errorTarget","PasswordConfirmController","checkPasswordsMatch","passwordTargets","boundCheckPasswordsMatch","allPasswordsMatch","values","Set","map","has","size","_this4","PasswordPeekController","peak","passwordTarget","hide","ResponsiveIframeWrapperController","messageReceived","boundMessageReceived","data","hasOwnProperty","ResponsiveIframeBodyController","top","constructor","debounces","func","postUpdate","getHeight","parent","postMessage","body","documentElement","Math","smoothPolyfilled","EphemeralController","cleanupSelf","cleanup","replaceAll","RegExp","substringIdentifierValueRegex","camelCase","action","keys","val","classes","scrollToElement","behavior","block","inline","scrollIntoView","smoothSupported","import","polyfill","polyfillSmooth","getScrollParent","node","overflowY","getComputedStyle","parentElement","ScrollIntoFocusController","hasBehaviorValue","behaviorValue","hasBlockValue","blockValue","hasInlineValue","inlineValue","ScrollToBottomController","scroll","hasModeValue","modeValue","mode","ScrollToController","querySelector","selectorValue","warn","selector","ScrollToTopController","SelfDestructController","timeout","secondsValue","seconds","TeleportController","hasInsertValue","Error","hasImmediateValue","immediateValue","execute","destination","targetValue","cloneNode","insertValue","insertAdjacentHTML","outerHTML","insert","immediate","ToggleClassController","hasClassValue","hasMouseEnterValue","hasMouseLeaveValue","useHover","hasClickAwayValue","clickAwayValue","onEvent","contains","rect","getBoundingClientRect","windowHeight","windowWidth","clientWidth","left","isElementInViewport","clickOutside","clickOutsideEvent","useClickOutside","hasInitialValue","toggleTargets","elementOn","elementOff","elementWasToggled","elementToggleStatus","elementToggle","mouseEnter","mouseEnterValue","on","off","mouseLeave","mouseLeaveValue","_this5","toggled","classValue","class","clickAway","initial","TurboFrameRCController","frameSrc","getFrame","getSrc","setSrc","frame","hasLoadingMessageValue","loadingMessageValue","getElementById","frameIdValue","nodeName","hasSrcValue","srcValue","isHTMLLinkElement","href","frameId","loadingMessage","WordCountController","updateWordCount","wordCount","matches","match"],"mappings":"mfAEaA,cAEX,WAAYC,SAEV,OADAC,cAAMD,aACKE,WAAY,CACrBC,IAAK,SAACC,EAAKC,GACT,IAAIC,EAAYC,QAAQJ,IAAIC,EAAKC,GAC7BG,OACJ,GAmCR,SAAqBH,GACnB,OAAQA,GACN,IAAK,cACL,IAAK,UACL,IAAK,cACL,IAAK,aACL,IAAK,MACL,IAAK,OACL,IAAK,qBACL,IAAK,aACH,SAGJ,QAAI,kBAAkBI,KAAKJ,IAGvB,aAAaI,KAAKJ,IAGlB,oBAAoBI,KAAKJ,IAGzB,aAAaI,KAAKJ,IAzDZK,CAAYL,EAAKM,YAAa,CAChC,GAAwB,mBAAbL,EACT,WAAWJ,MAAMI,EAAW,CAC1BM,eAAMC,EAAaC,EAAcC,GAI/B,OAHAP,EAAKQ,IAAIX,EAAKM,WAAY,CACxBM,KAAMF,IAEDR,QAAQK,MAAMC,EAAQC,EAASC,MAI1Cd,EAAKe,IAAIX,EAAKM,YAGlB,OAAOL,qCAKbU,IAAA,SAAIE,EAAsBD,GAExB,YAFwBA,IAAAA,EAAW,IAE9BE,KAAKC,YAAYC,MAAtB,CAGA,IAAIC,EAASC,QACbD,EAAOE,oBA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AAU5D,iCAAiCnU,KAAK8X,kBAEhD,OAAOJ,KAIHF,OAAA,WACN,IAAIjX,EAAUP,KAAKO,QACnB,GAAIP,KAAKgY,YACP,YAAYC,qBEnEgB1X,GAChC,MAA2B,KAApBA,EAAQwX,SFmEFG,CAAkB3X,GAC3B,OAAOA,EAAQ4X,KAEf,UAAUhE,MAAM,uCAnEsBvV,GAEnCyY,SAAS,CACde,QAASnW,OACTqL,IAAKrL,OACLoW,eAAgBpW,QGPPqW,IAAAA,cAAb,wEAeiBxZ,EAAKyZ,gBAAgBnW,oBAftC,2BAiBEzB,QAAA,WACEX,KAAKuY,kBACLvY,KAAK4H,YAAYrF,iBAAiB,QAASvC,KAAKyC,iBAGlDC,WAAA,WACE1C,KAAK4H,YAAYjF,oBAAoB,QAAS3C,KAAKyC,iBAGrD8V,gBAAA,WACE,IAAIC,EAAY,EAEZC,EADgBzY,KAAK4H,YAAYE,MACT4Q,MAAM,QAElC1Y,KAAKgI,aAAaC,WADlBuQ,EAAaC,GAAWA,EAAQ1Q,QAAW,GACHvI,WACpCQ,KAAKkI,gBACHlI,KAAKmI,aAAaqQ,GACpBxY,KAAKgI,aAAaI,UAAUC,OAAOrI,KAAKsI,YAExCtI,KAAKgI,aAAaI,UAAUG,IAAIvI,KAAKsI,gBAK3CH,aAAA,SAAaK,GACX,IAAIC,EAAM,EACNC,EAAM,MAUV,OARI1I,KAAK2I,cACPF,EAAMzI,KAAK4I,UAGT5I,KAAK6I,cACPH,EAAM1I,KAAK8I,UAGNN,GAASC,GAAOD,GAASE,MArDK9J,GAEhC0Z,UAAU,CAAC,QAAS,UACpBA,SAAS,CAAC7P,IAAKM,OAAQL,IAAKK,QAC5BuP,UAAU,CAAC"} \ No newline at end of file +{"version":3,"file":"stimulus-library.module.js","sources":["../src/base_controller.ts","../src/async_block_controller.ts","../src/auto_submit_form_controller.ts","../node_modules/stimulus-use/dist/support/index.js","../node_modules/stimulus-use/dist/use-intersection/use-intersection.js","../node_modules/stimulus-use/dist/use-click-outside/use-click-outside.js","../node_modules/stimulus-use/dist/stimulus_use.js","../node_modules/stimulus-use/dist/use-hover/use-hover.js","../node_modules/stimulus-use/dist/use-mutation/use-mutation.js","../node_modules/stimulus-use/dist/use-window-resize/use-window-resize.js","../node_modules/stimulus-use/dist/use-debounce/use-debounce.js","../src/autosize_controller.ts","../src/char_count_controller.ts","../src/clipboard_controller.ts","../src/confirm_navigation_controller.ts","../src/debug_controller.ts","../src/detect_dirty_controller.ts","../src/disable_inputs_controller.ts","../src/dismissable_controller.ts","../src/empty_dom_controller.ts","../src/enable_inputs_controller.ts","../src/fallback_image_controller.ts","../src/lazy_block_controller.ts","../src/limited_selection_checkboxes_controller.ts","../src/nested_form_controller.ts","../src/password_confirm_controller.ts","../src/password_peek_controller.ts","../src/responsive_iframe_controller.ts","../src/utilities/scroll.ts","../src/utilities/ephemeral_controller.ts","../src/scroll_into_focus_controller.ts","../src/scroll_to_bottom_controller.ts","../src/scroll_to_controller.ts","../src/scroll_to_top_controller.ts","../src/self_destruct_controller.ts","../src/teleport_controller.ts","../src/toggle_class_controller.ts","../src/turbo_frame_rc_controller.ts","../src/utilities/turbo.ts","../src/utilities/elements.ts","../src/word_count_controller.ts"],"sourcesContent":["import {Context, Controller} from \"stimulus\";\r\n\r\nexport class BaseController extends Controller {\r\n\r\n constructor(context: Context) {\r\n super(context);\r\n return new Proxy(this, {\r\n get: (obj, prop) => {\r\n let returnVal = Reflect.get(obj, prop);\r\n let self = this;\r\n if (logProperty(prop.toString())) {\r\n if (typeof returnVal == \"function\") {\r\n return new Proxy(returnVal, {\r\n apply(target: any, thisArg: any, argArray?: any): any {\r\n self.log(prop.toString(), {\r\n args: argArray,\r\n });\r\n return Reflect.apply(target, thisArg, argArray);\r\n },\r\n });\r\n } else {\r\n this.log(prop.toString());\r\n }\r\n }\r\n return returnVal;\r\n },\r\n });\r\n }\r\n\r\n log(functionName: string, args: {} = {}): void {\r\n // @ts-ignore\r\n if (!this.application.debug) {\r\n return;\r\n }\r\n let logger = console;\r\n logger.groupCollapsed(`%c${this.identifier} %c#${functionName}`, \"color: #3B82F6\", \"color: unset\");\r\n logger.log({\r\n element: this.element,\r\n ...args,\r\n });\r\n logger.groupEnd();\r\n }\r\n\r\n}\r\n\r\nfunction logProperty(prop: string): boolean {\r\n switch (prop) {\r\n case \"application\":\r\n case \"element\":\r\n case \"constructor\":\r\n case \"initialize\":\r\n case \"log\":\r\n case \"data\":\r\n case \"valueDescriptorMap\":\r\n case \"identifier\":\r\n return false;\r\n }\r\n\r\n if (/^.*?Target(s)?$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?Value$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?ValueChanged$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?Class$/.test(prop)) {\r\n return false;\r\n }\r\n\r\n return true;\r\n}\r\n","import {BaseController} from \"./base_controller\";\n\nexport class AsyncBlockController extends BaseController {\n static targets = [\"replace\"];\n static values = {endpoint: String};\n\n declare readonly replaceTarget: HTMLElement;\n declare readonly hasReplaceTarget: boolean;\n declare readonly endpointValue: string;\n\n\n // This is a simple controller to load a block of content when the page loads.\n // It should be used to give a quick initial response before calling out to an\n // an AJAX endpoint to do some expensive work.\n connect() {\n this.loadContent();\n }\n\n loadContent() {\n let el = (this.hasReplaceTarget ? this.replaceTarget : this.element) as HTMLElement;\n fetch(this.endpointValue)\n .then((response) => response.text())\n .then((html) => {\n let newEl = document.createElement(\"div\");\n newEl.innerHTML = html;\n el.replaceWith(newEl);\n\n // Trigger event to show block has loaded\n let event = new CustomEvent(\"ajax:success\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n })\n .catch(err => {\n el.replaceWith(\"Sorry, this content failed to load\");\n\n let event = new CustomEvent(\"ajax:error\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n })\n .finally(() => {\n let event = new CustomEvent(\"ajax:complete\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n });\n }\n}\n","import {BaseController} from \"./base_controller\";\n\nexport class AutoSubmitFormController extends BaseController {\n\n private boundHandler = this.handler.bind(this);\n\n connect() {\n (this.element as HTMLElement).querySelectorAll(\"input, select, textarea\").forEach(el => el.addEventListener(\"change\", this.boundHandler));\n }\n\n disconnect() {\n (this.element as HTMLElement).querySelectorAll(\"input, select, textarea\").forEach(el => el.removeEventListener(\"change\", this.boundHandler));\n }\n\n private handler(e: Event) {\n // this.element.submit()\n // Moved to this to support remote forms and CSRF properly\n this.element.dispatchEvent(\n new CustomEvent(\"submit\", {\n bubbles: true,\n cancelable: true,\n }),\n );\n }\n}\n","export const method = (controller, methodName) => {\n const method = controller[methodName];\n if (typeof method == 'function') {\n return method;\n }\n else {\n return (...args) => { };\n }\n};\nexport const composeEventName = (name, controller, eventPrefix) => {\n let composedName = name;\n if (eventPrefix === true) {\n composedName = `${controller.identifier}:${name}`;\n }\n else if (typeof eventPrefix === 'string') {\n composedName = `${eventPrefix}:${name}`;\n }\n return composedName;\n};\nexport const extendedEvent = (type, event, detail) => {\n const { bubbles, cancelable, composed } = event || { bubbles: true, cancelable: true, composed: true };\n if (event) {\n Object.assign(detail, { originalEvent: event });\n }\n const customEvent = new CustomEvent(type, {\n bubbles,\n cancelable,\n composed,\n detail,\n });\n return customEvent;\n};\nexport function isElementInViewport(el) {\n const rect = el.getBoundingClientRect();\n const windowHeight = (window.innerHeight || document.documentElement.clientHeight);\n const windowWidth = (window.innerWidth || document.documentElement.clientWidth);\n const vertInView = (rect.top <= windowHeight) && ((rect.top + rect.height) >= 0);\n const horInView = (rect.left <= windowWidth) && ((rect.left + rect.width) >= 0);\n return (vertInView && horInView);\n}\n//# sourceMappingURL=index.js.map","import { method, extendedEvent, composeEventName } from '../support/index';\nconst defaultOptions = {\n dispatchEvent: true,\n eventPrefix: true,\n};\nexport const useIntersection = (controller, options = {}) => {\n const { dispatchEvent, eventPrefix } = Object.assign({}, defaultOptions, options);\n const targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n const callback = (entries) => {\n const [entry] = entries;\n if (entry.isIntersecting) {\n dispatchAppear(entry);\n }\n else if (controller.isVisible) {\n dispatchDisappear(entry);\n }\n };\n const dispatchAppear = (entry) => {\n controller.isVisible = true;\n method(controller, 'appear').call(controller, entry);\n // emit a custom \"appear\" event\n if (dispatchEvent) {\n const eventName = composeEventName('appear', controller, eventPrefix);\n const appearEvent = extendedEvent(eventName, null, { controller, entry });\n targetElement.dispatchEvent(appearEvent);\n }\n };\n const dispatchDisappear = (entry) => {\n controller.isVisible = false;\n method(controller, 'disappear').call(controller, entry);\n // emit a custom \"disappear\" event\n if (dispatchEvent) {\n const eventName = composeEventName('disappear', controller, eventPrefix);\n const disappearEvent = extendedEvent(eventName, null, { controller, entry });\n targetElement.dispatchEvent(disappearEvent);\n }\n };\n // keep a copy of the current disconnect() function of the controller\n // to support composing several behaviors\n const controllerDisconnect = controller.disconnect.bind(controller);\n const observer = new IntersectionObserver(callback, options);\n const observe = () => {\n observer.observe(targetElement);\n };\n const unobserve = () => {\n observer.unobserve(targetElement);\n };\n Object.assign(controller, {\n isVisible: false,\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-intersection.js.map","import { composeEventName, extendedEvent, isElementInViewport } from '../support/index';\nconst defaultOptions = {\n events: ['click', 'touchend'],\n onlyVisible: true,\n dispatchEvent: true,\n eventPrefix: true,\n};\nexport const useClickOutside = (controller, options = {}) => {\n const { onlyVisible, dispatchEvent, events, eventPrefix } = Object.assign({}, defaultOptions, options);\n const onEvent = (event) => {\n const targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n if (targetElement.contains(event.target) || (!isElementInViewport(targetElement) && onlyVisible)) {\n return;\n }\n // call the clickOutside method of the Stimulus controller\n if (controller.clickOutside) {\n controller.clickOutside(event);\n }\n // emit a custom event\n if (dispatchEvent) {\n const eventName = composeEventName('click:outside', controller, eventPrefix);\n const clickOutsideEvent = extendedEvent(eventName, event, { controller });\n targetElement.dispatchEvent(clickOutsideEvent);\n }\n };\n const observe = () => {\n events === null || events === void 0 ? void 0 : events.forEach(event => {\n window.addEventListener(event, onEvent, false);\n });\n };\n const unobserve = () => {\n events === null || events === void 0 ? void 0 : events.forEach(event => {\n window.removeEventListener(event, onEvent, false);\n });\n };\n // keep a copy of the current disconnect() function of the controller\n // to support composing several behaviors\n const controllerDisconnect = controller.disconnect.bind(controller);\n Object.assign(controller, {\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-click-outside.js.map","const defaultOptions = {\n debug: false,\n logger: console\n};\nexport class StimulusUse {\n constructor(controller, options = {}) {\n var _a, _b, _c;\n this.log = (functionName, args) => {\n if (!this.debug)\n return;\n this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${functionName}`, 'color: #3B82F6', 'color: unset');\n this.logger.log(Object.assign({ controllerId: this.controllerId }, args));\n this.logger.groupEnd();\n };\n this.debug = (_b = (_a = options === null || options === void 0 ? void 0 : options.debug) !== null && _a !== void 0 ? _a : controller.application.stimulusUseDebug) !== null && _b !== void 0 ? _b : defaultOptions.debug;\n this.logger = (_c = options === null || options === void 0 ? void 0 : options.logger) !== null && _c !== void 0 ? _c : defaultOptions.logger;\n this.controller = controller;\n this.controllerId = controller.element.id || controller.element.dataset.id;\n // make copies of lifecycle functions\n this.controllerInitialize = controller.initialize.bind(controller);\n this.controllerConnect = controller.connect.bind(controller);\n this.controllerDisconnect = controller.disconnect.bind(controller);\n }\n}\n//# sourceMappingURL=stimulus_use.js.map","import { StimulusUse } from '../stimulus_use';\nimport { method } from '../support/index';\nexport class UseHover extends StimulusUse {\n constructor(controller, options = {}) {\n super(controller, options);\n this.observe = () => {\n this.targetElement.addEventListener('mouseenter', this.onEnter);\n this.targetElement.addEventListener('mouseleave', this.onLeave);\n };\n this.unobserve = () => {\n this.targetElement.removeEventListener('mouseenter', this.onEnter);\n this.targetElement.removeEventListener('mouseleave', this.onLeave);\n };\n this.onEnter = () => {\n method(this.controller, 'mouseEnter').call(this.controller);\n this.log('mouseEnter', { hover: true });\n };\n this.onLeave = () => {\n method(this.controller, 'mouseLeave').call(this.controller);\n this.log('mouseLeave', { hover: false });\n };\n this.targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n this.controller = controller;\n this.enhanceController();\n this.observe();\n }\n enhanceController() {\n const controllerDisconnect = this.controller.disconnect.bind(this.controller);\n const disconnect = () => {\n this.unobserve();\n controllerDisconnect();\n };\n Object.assign(this.controller, { disconnect });\n }\n}\nexport const useHover = (controller, options = {}) => {\n const observer = new UseHover(controller, options);\n return [observer.observe, observer.unobserve];\n};\n//# sourceMappingURL=use-hover.js.map","import { StimulusUse } from '../stimulus_use';\nimport { method } from '../support/index';\nexport class UseMutation extends StimulusUse {\n constructor(controller, options = {}) {\n super(controller, options);\n this.observe = () => {\n try {\n this.observer.observe(this.targetElement, this.options);\n }\n catch (error) {\n this.controller.application.handleError(error, \"At a minimum, one of childList, attributes, and/or characterData must be true\", {});\n }\n };\n this.unobserve = () => {\n this.observer.disconnect();\n };\n this.mutation = (entries) => {\n method(this.controller, 'mutate').call(this.controller, entries);\n this.log('mutate', { entries });\n };\n this.targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n this.controller = controller;\n this.options = options;\n this.observer = new MutationObserver(this.mutation);\n this.enhanceController();\n this.observe();\n }\n enhanceController() {\n const controllerDisconnect = this.controller.disconnect.bind(this.controller);\n const disconnect = () => {\n this.unobserve();\n controllerDisconnect();\n };\n Object.assign(this.controller, { disconnect });\n }\n}\nexport const useMutation = (controller, options = {}) => {\n const observer = new UseMutation(controller, options);\n return [observer.observe, observer.unobserve];\n};\n//# sourceMappingURL=use-mutation.js.map","import { method } from '../support/index';\nexport const useWindowResize = (controller) => {\n const callback = (event) => {\n const { innerWidth, innerHeight } = window;\n const payload = {\n height: innerHeight || Infinity,\n width: innerWidth || Infinity,\n event\n };\n method(controller, 'windowResize').call(controller, payload);\n };\n const controllerDisconnect = controller.disconnect.bind(controller);\n const observe = () => {\n window.addEventListener('resize', callback);\n callback();\n };\n const unobserve = () => {\n window.removeEventListener('resize', callback);\n };\n Object.assign(controller, {\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-window-resize.js.map","import { Controller } from 'stimulus';\nclass DebounceController extends Controller {\n}\nDebounceController.debounces = [];\nconst defaultWait = 200;\nconst debounce = (fn, wait = defaultWait) => {\n let timeoutId = null;\n return function () {\n const args = arguments;\n const context = this;\n const callback = () => fn.apply(context, args);\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n timeoutId = setTimeout(callback, wait);\n };\n};\nexport const useDebounce = (controller, options) => {\n var _a;\n const constructor = controller.constructor;\n (_a = constructor.debounces) === null || _a === void 0 ? void 0 : _a.forEach((func) => {\n if (typeof func === \"string\") {\n controller[func] = debounce(controller[func], options === null || options === void 0 ? void 0 : options.wait);\n }\n if (typeof func === \"object\") {\n const { name, wait } = func;\n if (!name)\n return;\n controller[name] = debounce(controller[name], wait || (options === null || options === void 0 ? void 0 : options.wait));\n }\n });\n};\n//# sourceMappingURL=use-debounce.js.map","import {useWindowResize} from \"stimulus-use\";\nimport {BaseController} from \"./base_controller\";\n\nexport class AutosizeController extends BaseController {\n\n private boundHandler = this.handler.bind(this);\n\n connect() {\n let target = this.element as HTMLTextAreaElement;\n target.style.resize = \"none\";\n target.style.boxSizing = \"border-box\";\n target.addEventListener(\"input\", this.boundHandler);\n target.addEventListener(\"focus\", this.boundHandler);\n useWindowResize(this);\n requestAnimationFrame(this.boundHandler);\n }\n\n windowResize() {\n this.handler();\n }\n\n private handler() {\n this.autosize(this.element as HTMLTextAreaElement);\n };\n\n private autosize(element: HTMLTextAreaElement) {\n let offset = element.offsetHeight - element.clientHeight;\n element.style.height = \"auto\";\n element.style.height = element.scrollHeight + offset + \"px\";\n }\n\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class CharCountController extends BaseController {\r\n\r\n static targets = [\"input\", \"output\"];\r\n static values = {min: Number, max: Number};\r\n static classes = [\"error\"];\r\n\r\n declare readonly inputTarget: HTMLInputElement | HTMLTextAreaElement;\r\n declare readonly outputTarget: HTMLElement;\r\n declare minValue: number;\r\n declare hasMinValue: boolean;\r\n declare maxValue: number;\r\n declare hasMaxValue: boolean;\r\n declare errorClass: string;\r\n declare hasErrorClass: boolean;\r\n\r\n boundHandler = this.updateCharCount.bind(this);\r\n\r\n connect() {\r\n this.updateCharCount();\r\n this.inputTarget.addEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n this.inputTarget.removeEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n updateCharCount() {\r\n let charCount = this.inputTarget.value.length;\r\n this.outputTarget.innerText = charCount.toString();\r\n if (this.hasErrorClass) {\r\n if (this.isValidCount(charCount)) {\r\n this.outputTarget.classList.remove(this.errorClass);\r\n } else {\r\n this.outputTarget.classList.add(this.errorClass);\r\n }\r\n }\r\n }\r\n\r\n isValidCount(count: number) {\r\n let min = 0;\r\n let max = 99999;\r\n\r\n if (this.hasMinValue) {\r\n min = this.minValue;\r\n }\r\n\r\n if (this.hasMaxValue) {\r\n max = this.maxValue;\r\n }\r\n\r\n return count >= min && count <= max;\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class ClipboardController extends BaseController {\r\n\r\n static targets = [\"button\", \"copy\", \"fallback\"];\r\n static values = {removeUnused: Boolean};\r\n\r\n declare readonly sourceTarget: HTMLElement;\r\n declare readonly copyTarget: HTMLElement;\r\n declare readonly hasCopyTarget: boolean;\r\n declare readonly fallbackTarget: HTMLElement;\r\n declare readonly hasFallbackTarget: boolean;\r\n\r\n declare readonly hasRemoveUnusedValue: boolean;\r\n declare readonly removeUnusedValue: boolean;\r\n\r\n supported = false;\r\n\r\n connect() {\r\n this.supported = document.queryCommandSupported(\"copy\");\r\n\r\n if (this.hasRemoveUnusedValue && this.removeUnusedValue) {\r\n if (this.supported && this.hasFallbackTarget) {\r\n this.fallbackTarget.remove();\r\n } else if (this.hasCopyTarget) {\r\n this.copyTarget.remove();\r\n }\r\n }\r\n }\r\n\r\n select(event: MouseEvent) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n (this.sourceTarget as HTMLInputElement | HTMLTextAreaElement).select();\r\n }\r\n\r\n copy(event: ClipboardEvent) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n (this.sourceTarget as HTMLInputElement | HTMLTextAreaElement).select();\r\n if (this.supported) {\r\n document.execCommand(\"copy\");\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\n\nexport class ConfirmNavigationController extends BaseController {\n\n static values = {message: String};\n\n declare readonly messageValue: string;\n\n connect() {\n let confirmMessage = this.messageValue;\n window.onbeforeunload = () => (confirmMessage == null ? true : confirmMessage);\n window.addEventListener(\"popstate\", this.handlePopstate);\n window.addEventListener(\"submit\", () => {\n window.removeEventListener(\"popstate\", this.handlePopstate);\n window.onbeforeunload = null;\n });\n // TODO: Turbo navigation events\n }\n\n handlePopstate(event: PopStateEvent) {\n return false;\n }\n\n}\n","import {BaseController} from \"./base_controller\";\n\nexport class DebugController extends BaseController {\n\n static targets = [\"test\"];\n declare testTargets: HTMLElement[];\n\n connect() {\n console.log(\"Debug Controller\", this, this.testTargets);\n }\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DetectDirtyController extends BaseController {\r\n\r\n initialValue: string | boolean | null = null;\r\n\r\n boundHandler = this.handler.bind(this);\r\n\r\n connect() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n if (this.isInputElement(element) && this.isCheckable(element)) {\r\n this.initialValue = element.checked;\r\n } else {\r\n this.initialValue = element.value;\r\n }\r\n element.addEventListener(\"input\", this.boundHandler);\r\n element.addEventListener(\"change\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n element.removeEventListener(\"input\", this.boundHandler);\r\n element.removeEventListener(\"change\", this.boundHandler);\r\n }\r\n\r\n restore() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n if (this.isInputElement(element) && this.isCheckable(element)) {\r\n element.checked = this.initialValue as boolean;\r\n } else {\r\n element.value = this.initialValue as string;\r\n }\r\n }\r\n\r\n private handler(event?: Event) {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n\r\n if (this.initialValue !== element.value) {\r\n element.setAttribute(\"data-dirty\", \"true\");\r\n } else {\r\n element.removeAttribute(\"data-dirty\");\r\n }\r\n }\r\n\r\n private isCheckable(element: HTMLInputElement): boolean {\r\n return (element.type === \"radio\" || element.type === \"checkbox\");\r\n }\r\n\r\n private isInputElement(element: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement): element is HTMLInputElement {\r\n return element.tagName === \"INPUT\";\r\n }\r\n\r\n}\r\n\r\nexport function isDirty(element: HTMLElement) {\r\n return element.hasAttribute(\"data-dirty\");\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DisableInputsController extends BaseController {\r\n\r\n static targets = [\"disabler\", \"disable\"];\r\n\r\n static values = {\r\n clear: Boolean,\r\n };\r\n\r\n declare readonly hasDisablerTarget: boolean;\r\n declare readonly disablerTarget: HTMLInputElement;\r\n declare readonly disableTargets: Array;\r\n declare readonly clearValue: boolean;\r\n declare readonly hasClearValue: boolean;\r\n\r\n connect() {\r\n this.toggle();\r\n }\r\n\r\n toggle() {\r\n if (this.hasDisablerTarget && this.disablerTarget.checked) {\r\n this.disableInputs();\r\n } else {\r\n this.enableInputs();\r\n }\r\n }\r\n\r\n disableInputs() {\r\n let shouldClear = this.hasClearValue && this.clearValue;\r\n this.disableTargets.forEach((el, _) => {\r\n if (shouldClear) {\r\n el.value = \"\";\r\n }\r\n el.disabled = true;\r\n });\r\n }\r\n\r\n enableInputs() {\r\n this.disableTargets.forEach((el, _) => {\r\n el.disabled = false;\r\n });\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DismissableController extends BaseController {\r\n\r\n\r\n dismiss() {\r\n this.element.remove();\r\n }\r\n\r\n}\r\n","import {useMutation} from \"stimulus-use\";\r\nimport {BaseController} from \"./base_controller\";\r\n\r\nexport class EmptyDomController extends BaseController {\r\n\r\n static classes = [\"empty\", \"notEmpty\"];\r\n static values = {scopeSelector: String};\r\n\r\n declare hasEmptyClass: boolean;\r\n declare emptyClass: string;\r\n declare hasNotEmptyClass: boolean;\r\n declare notEmptyClass: string;\r\n\r\n declare hasScopeSelectorValue: boolean;\r\n declare scopeSelectorValue: string;\r\n\r\n connect() {\r\n useMutation(this, {element: this.element, childList: true});\r\n this.checkEmpty();\r\n }\r\n\r\n mutate(entries: MutationRecord[]) {\r\n this.checkEmpty();\r\n }\r\n\r\n checkEmpty() {\r\n let children;\r\n if (this.hasScopeSelectorValue) {\r\n children = this.element.querySelectorAll(this.scopeSelectorValue);\r\n } else {\r\n children = this.element.children;\r\n }\r\n\r\n if (children.length === 0) {\r\n if (this.hasNotEmptyClass) {\r\n let classes = this.notEmptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.remove(klass));\r\n }\r\n if (this.hasEmptyClass) {\r\n let classes = this.emptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.add(klass));\r\n }\r\n this.element.dispatchEvent(\r\n new CustomEvent(\"dom:empty\", {\r\n bubbles: true,\r\n cancelable: true,\r\n }),\r\n );\r\n } else {\r\n if (this.hasNotEmptyClass) {\r\n let classes = this.notEmptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.add(klass));\r\n }\r\n if (this.hasEmptyClass) {\r\n let classes = this.emptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.remove(klass));\r\n }\r\n this.element.dispatchEvent(\r\n new CustomEvent(\"dom:not-empty\", {\r\n bubbles: true,\r\n cancelable: true,\r\n detail: {\r\n count: children.length,\r\n },\r\n }),\r\n );\r\n }\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class EnableInputsController extends BaseController {\r\n\r\n static targets = [\"enabler\", \"enable\"];\r\n\r\n static values = {\r\n clear: Boolean,\r\n };\r\n\r\n declare readonly hasEnablerTarget: boolean;\r\n declare readonly enablerTarget: HTMLInputElement;\r\n declare readonly enableTargets: Array;\r\n declare readonly clearValue: boolean;\r\n declare readonly hasClearValue: boolean;\r\n\r\n connect() {\r\n this.toggle();\r\n }\r\n\r\n toggle() {\r\n if (this.hasEnablerTarget && this.enablerTarget.checked) {\r\n this.enableInputs();\r\n } else {\r\n this.disableInputs();\r\n }\r\n }\r\n\r\n disableInputs() {\r\n let shouldClear = this.hasClearValue && this.clearValue;\r\n this.enableTargets.forEach((el, _) => {\r\n if (shouldClear) {\r\n el.value = \"\";\r\n }\r\n el.disabled = true;\r\n });\r\n }\r\n\r\n enableInputs() {\r\n this.enableTargets.forEach((el, _) => {\r\n el.disabled = false;\r\n });\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class FallbackImageController extends BaseController {\r\n\r\n static values = {placeholder: String};\r\n\r\n declare readonly placeholderValue: string;\r\n declare readonly hasPlaceholderValue: boolean;\r\n\r\n connect() {\r\n let element = this.element as HTMLImageElement;\r\n\r\n element.onerror = () => {\r\n if (this.hasPlaceholderValue) {\r\n element.src = this.placeholderValue;\r\n } else {\r\n element.style.display = \"none\";\r\n }\r\n };\r\n }\r\n\r\n}\r\n","import {useIntersection} from \"stimulus-use\";\nimport {IntersectionOptions} from \"stimulus-use/dist/use-intersection/use-intersection\";\nimport {AsyncBlockController} from \"./async_block_controller\";\n\nexport class LazyBlockController extends AsyncBlockController {\n\n declare observe: () => void;\n declare unobserve: () => void;\n declare options: IntersectionOptions;\n declare isVisible: boolean;\n declare disappear: () => void;\n\n connect() {\n let element = this.element;\n this.options = {element, threshold: 0.3};\n\n if (\"IntersectionObserver\" in window) {\n [this.observe, this.unobserve] = useIntersection(this, this.options);\n } else {\n // Client doesn't support intersection observer, fallback to pre-loading\n this.loadContent();\n }\n }\n\n appear(entry: IntersectionObserverEntry) {\n let element = this.element as HTMLImageElement;\n if (element.src !== \"\") {\n return;\n }\n if (entry.target === element && entry.isIntersecting) {\n this.loadContent();\n if (this.unobserve) {\n this.unobserve();\n }\n }\n }\n\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class LimitedSelectionCheckboxesController extends BaseController {\r\n\r\n static targets = [\"input\", \"error\"];\r\n static values = {max: Number, message: String};\r\n\r\n declare readonly hasErrorTarget: boolean;\r\n declare readonly errorTarget: HTMLElement;\r\n declare readonly inputTargets: HTMLInputElement[];\r\n declare readonly maxValue: number;\r\n declare readonly messageValue: string;\r\n\r\n maxSelections = 0;\r\n\r\n boundHandleInputs = this.handleInputs.bind(this);\r\n\r\n connect() {\r\n this.inputTargets.forEach((el) => el.addEventListener(\"change\", this.boundHandleInputs));\r\n }\r\n\r\n disconnect() {\r\n this.inputTargets.forEach((el) => el.removeEventListener(\"change\", this.boundHandleInputs));\r\n }\r\n\r\n handleInputs(event: Event) {\r\n let tickedInputs = this.inputTargets.reduce((previousValue, el) => el.checked ? previousValue + 1 : previousValue, 0);\r\n let target = event.target as HTMLInputElement;\r\n if (tickedInputs > this.maxSelections) {\r\n event.preventDefault();\r\n target.checked = false;\r\n target.dispatchEvent(new CustomEvent(\"change\", {bubbles: true, cancelable: true}));\r\n target.dispatchEvent(new CustomEvent(\"limited-selection:too-many\", {bubbles: true, cancelable: true, detail: {target}}));\r\n if (this.hasErrorTarget) {\r\n this.errorTarget.innerHTML = this.messageValue;\r\n }\r\n } else {\r\n target.dispatchEvent(new CustomEvent(\"limited-selection:selection\", {bubbles: true, cancelable: true, detail: {target}}));\r\n if (this.hasErrorTarget) {\r\n this.errorTarget.innerHTML = \"\";\r\n }\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class NestedFormController extends BaseController {\r\n static targets = ['target', 'template'];\r\n static values = {\r\n insertMode: String,\r\n wrapperClass: String,\r\n };\r\n\r\n declare readonly targetTarget: HTMLElement;\r\n declare readonly templateTarget: HTMLTemplateElement | HTMLScriptElement;\r\n\r\n declare readonly wrapperClassValue: string;\r\n declare readonly hasWrapperSelectorValue: boolean;\r\n declare readonly insertModeValue: InsertPosition;\r\n declare readonly hasInsertModeValue: boolean;\r\n\r\n get wrapperClass() {\r\n return this.hasWrapperSelectorValue ? this.wrapperClassValue : 'nested-fields';\r\n }\r\n\r\n get insertMode(): InsertPosition {\r\n return this.hasInsertModeValue ? this.insertModeValue : 'beforeend';\r\n }\r\n\r\n connect() {\r\n this.checkStructure();\r\n }\r\n\r\n add(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n\r\n const content = this.templateTarget.innerHTML.replace(/NEW_RECORD/g, this.generateID());\r\n this.targetTarget.insertAdjacentHTML(this.insertMode, content);\r\n }\r\n\r\n remove(event: Event) {\r\n event.preventDefault();\r\n const wrapper: HTMLElement | null = (event.target as HTMLElement).closest(this.wrapperClass);\r\n if (wrapper == null) {\r\n throw new Error(`#remove was clicked from outside of a child record. Could not find an ancestor with class ${this.wrapperClass}`);\r\n }\r\n\r\n if (wrapper.dataset.newRecord === 'true') {\r\n wrapper.remove();\r\n } else {\r\n wrapper.style.display = 'none';\r\n let destroyInput = wrapper.querySelector(\"input[name*='_destroy']\") as HTMLInputElement | null;\r\n if (destroyInput == null) {\r\n throw new Error(`Could not find a hidden input with name '_destroy'. NestedForm cannot remove an already persisted record without it.`);\r\n }\r\n\r\n destroyInput.value = \"1\";\r\n }\r\n }\r\n\r\n generateID(): string {\r\n return new Date().getTime().toString() + Math.random();\r\n }\r\n\r\n private checkStructure() {\r\n let template = this.templateTarget.innerHTML;\r\n\r\n if (template.indexOf('NEW_RECORD')) {\r\n throw new Error(\"Could not find 'NEW_RECORD' in the provided template. Please make sure you've passed `child_index: 'NEW_RECORD'` to `fields_for`\")\r\n }\r\n }\r\n}","import {BaseController} from \"./base_controller\";\r\n\r\nexport class PasswordConfirmController extends BaseController {\r\n\r\n static targets = [\"password\"];\r\n static classes = [\"error\"];\r\n\r\n declare readonly passwordTargets: HTMLInputElement[];\r\n\r\n declare readonly errorClass: string;\r\n declare readonly hasErrorClass: boolean;\r\n\r\n private boundCheckPasswordsMatch = this.checkPasswordsMatch.bind(this);\r\n\r\n connect() {\r\n this.passwordTargets.forEach((el) => el.addEventListener(\"change\", this.boundCheckPasswordsMatch));\r\n }\r\n\r\n disconnect() {\r\n this.passwordTargets.forEach((el) => el.removeEventListener(\"change\", this.boundCheckPasswordsMatch));\r\n }\r\n\r\n private allPasswordsMatch() {\r\n let values = new Set(this.passwordTargets.map(el => el.value)); // Create a unique set of the password values\r\n return values.has(\"\") || values.size == 1; // If any of the passwords are still blank, or there is only one distinct password value (i.e. they all are the same)\r\n }\r\n\r\n private checkPasswordsMatch() {\r\n if (this.allPasswordsMatch()) {\r\n this.element.dispatchEvent(new CustomEvent(\"password-confirm:match\"));\r\n if (this.hasErrorClass) {\r\n this.passwordTargets.forEach(el => el.classList.remove(this.errorClass));\r\n }\r\n } else {\r\n this.element.dispatchEvent(new CustomEvent(\"password-confirm:no-match\"));\r\n if (this.hasErrorClass) {\r\n this.passwordTargets.forEach(el => el.classList.add(this.errorClass));\r\n }\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class PasswordPeekController extends BaseController {\r\n\r\n static targets = [\"password\"];\r\n\r\n declare readonly passwordTarget: HTMLInputElement;\r\n\r\n\r\n peak(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n this.passwordTarget.type = \"text\";\r\n }\r\n\r\n hide(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n this.passwordTarget.type = \"password\";\r\n }\r\n\r\n toggle(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n if (this.passwordTarget.type === \"password\") {\r\n this.peak();\r\n } else {\r\n this.hide();\r\n }\r\n }\r\n}\r\n","import {useDebounce, useWindowResize} from \"stimulus-use\";\nimport {WindowResizePayload} from \"stimulus-use/dist/use-window-resize/use-window-resize\";\nimport {BaseController} from \"./base_controller\";\n\ninterface ResponsiveIframeMessage {\n name: string,\n height: number,\n}\n\nexport class ResponsiveIframeWrapperController extends BaseController {\n\n boundMessageReceived = this.messageReceived.bind(this);\n\n connect() {\n window.addEventListener(\"message\", this.boundMessageReceived);\n }\n\n disconnect() {\n window.removeEventListener(\"message\", this.boundMessageReceived);\n }\n\n messageReceived(message: MessageEvent) {\n let data = message.data;\n if (data.hasOwnProperty(\"name\") && data.name === \"iframe-body\" && data.hasOwnProperty(\"height\")) {\n this.resize(data.height);\n }\n }\n\n resize(height: number) {\n (this.element as HTMLIFrameElement).style.height = `${height}px`;\n }\n\n}\n\nexport class ResponsiveIframeBodyController extends BaseController {\n\n static debounces = [\"postUpdate\"];\n\n declare observe: () => void;\n declare unobserve: () => void;\n\n connect() {\n // If this Window is inside a frame\n if (window.self !== window.top) {\n useWindowResize(this);\n useDebounce(this, {});\n this.postUpdate();\n } else {\n // Not an iframe\n }\n }\n\n windowResize(payload: WindowResizePayload) {\n this.postUpdate();\n };\n\n postUpdate() {\n let payload: ResponsiveIframeMessage = {name: \"iframe-body\", height: this.getHeight()};\n window.parent.postMessage(\n payload,\n \"*\",\n );\n }\n\n getHeight(): number {\n const body = document.body;\n const html = document.documentElement;\n\n // Get the largest height out of body and html's various height measurements\n return Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);\n }\n\n}\n","const smoothSupported = \"scrollBehavior\" in document.documentElement.style;\r\nlet smoothPolyfilled: boolean;\r\n\r\nexport async function scrollToElement(element: Element, {behavior = \"smooth\", block = \"start\", inline = \"nearest\"}: ScrollIntoViewOptions = {}) {\r\n if (behavior == \"smooth\" && !smoothSupported) {\r\n await polyfillSmooth();\r\n }\r\n element.scrollIntoView({behavior, block, inline});\r\n}\r\n\r\nasync function polyfillSmooth() {\r\n const {polyfill} = await import(/* webpackChunkName: \"smoothscroll-polyfill\" */ \"smoothscroll-polyfill\");\r\n if (smoothPolyfilled) {\r\n return;\r\n }\r\n smoothPolyfilled = true;\r\n polyfill();\r\n}\r\n\r\nexport function getScrollParent(node: HTMLElement | null): HTMLElement | null {\r\n if (!node) {\r\n return null;\r\n }\r\n const overflowY = getComputedStyle(node).overflowY;\r\n const isScrollable = overflowY !== \"visible\" && overflowY !== \"hidden\";\r\n\r\n if (isScrollable && node.scrollHeight >= node.clientHeight) {\r\n return node;\r\n }\r\n\r\n return getScrollParent(node.parentElement) || document.body;\r\n}\r\n","import camelCase from \"lodash.camelcase\";\r\nimport {BaseController} from \"../base_controller\";\r\n\r\nexport class EphemeralController extends BaseController {\r\n\r\n cleanupSelf() {\r\n this.cleanup(this.element as HTMLElement);\r\n }\r\n\r\n cleanup(element: HTMLElement) {\r\n element.dataset.controller = element.dataset.controller?.replaceAll(new RegExp(`(\\s|^)${this.identifier}(\\s|$)`, \"g\"), \"\") || \"\";\r\n if (element.dataset.controller == \"\") {\r\n // If there are no controllers left, remove the attribute\r\n delete element.dataset.controller;\r\n }\r\n\r\n let substringIdentifierValueRegex = new RegExp(`(\\s|^)${this.identifier}\\\\..+?(\\s|$)`, \"g\");\r\n element.dataset.target = element.dataset.target?.replaceAll(substringIdentifierValueRegex, \"\") || \"\";\r\n delete element.dataset[camelCase(`${this.identifier}-target`)];\r\n if (element.dataset.target == \"\") {\r\n // If there are no targets left, remove the attribute\r\n delete element.dataset.target;\r\n }\r\n\r\n element.dataset.action = element.dataset.target?.replaceAll(substringIdentifierValueRegex, \"\") || \"\";\r\n delete element.dataset[camelCase(`${this.identifier}-action`)];\r\n if (element.dataset.action == \"\") {\r\n // If there are no actions left, remove the attribute\r\n delete element.dataset.action;\r\n }\r\n\r\n // @ts-ignore\r\n let values = this.constructor.values;\r\n if (values) {\r\n Object.keys(values).forEach(val => delete element.dataset[camelCase(`${this.identifier}-${val}-value`)]);\r\n }\r\n\r\n // @ts-ignore\r\n let classes = this.constructor.classes;\r\n if (classes) {\r\n Object.keys(classes).forEach(val => delete element.dataset[camelCase(`${this.identifier}-${val}-class`)]);\r\n }\r\n }\r\n\r\n}\r\n","import {EphemeralController} from \"./utilities/ephemeral_controller\";\r\nimport {scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollIntoFocusController extends EphemeralController {\r\n\r\n static values = {\r\n behavior: String,\r\n block: String,\r\n inline: String,\r\n };\r\n\r\n declare behaviorValue: ScrollBehavior;\r\n declare hasBehaviorValue: boolean;\r\n declare blockValue: ScrollLogicalPosition;\r\n declare hasBlockValue: boolean;\r\n declare inlineValue: ScrollLogicalPosition;\r\n declare hasInlineValue: boolean;\r\n\r\n connect() {\r\n requestAnimationFrame(() => {\r\n // Attempt smooth scrolling, with polyfill\r\n scrollToElement(\r\n this.element,\r\n {\r\n behavior: this.hasBehaviorValue ? this.behaviorValue : \"smooth\",\r\n block: this.hasBlockValue ? this.blockValue : \"center\",\r\n inline: this.hasInlineValue ? this.inlineValue : \"center\",\r\n },\r\n ).catch(() => this.element.scrollIntoView()); // Fallback to snap-scrolling\r\n this.cleanupSelf();\r\n });\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\nimport {getScrollParent, scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollToBottomController extends BaseController {\r\n\r\n static values = {\r\n mode: String,\r\n };\r\n\r\n declare modeValue: \"nearest\" | \"document\";\r\n declare hasModeValue: boolean;\r\n\r\n\r\n scroll(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n let mode = this.hasModeValue ? this.modeValue : \"document\";\r\n let target: null | HTMLElement;\r\n if (mode == \"document\") {\r\n target = document.body;\r\n } else {\r\n target = getScrollParent(this.element as HTMLElement);\r\n }\r\n if (target == null) {\r\n return;\r\n }\r\n scrollToElement(target!, {behavior: \"smooth\", block: \"end\"}).catch(() => target!.scrollIntoView(false));\r\n }\r\n\r\n}\r\n\r\n","import {BaseController} from \"./base_controller\";\r\nimport {scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollToController extends BaseController {\r\n\r\n static values = {\r\n selector: String,\r\n behavior: String,\r\n block: String,\r\n inline: String,\r\n };\r\n\r\n declare selectorValue: string;\r\n declare behaviorValue: ScrollBehavior;\r\n declare hasBehaviorValue: boolean;\r\n declare blockValue: ScrollLogicalPosition;\r\n declare hasBlockValue: boolean;\r\n declare inlineValue: ScrollLogicalPosition;\r\n declare hasInlineValue: boolean;\r\n\r\n\r\n scroll() {\r\n let target = document.querySelector(this.selectorValue);\r\n if (!target) {\r\n console.warn(`Could not find target for '${this.selectorValue}'`);\r\n return;\r\n }\r\n\r\n scrollToElement(\r\n target!,\r\n {\r\n behavior: this.hasBehaviorValue ? this.behaviorValue : \"smooth\",\r\n block: this.hasBlockValue ? this.blockValue : \"center\",\r\n inline: this.hasInlineValue ? this.inlineValue : \"center\",\r\n },\r\n ).catch(() => target!.scrollIntoView()); // Fallback to snap-scrolling\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\nimport {getScrollParent, scrollToElement} from \"./utilities/scroll\";\n\nexport class ScrollToTopController extends BaseController {\n\n static values = {\n mode: String,\n };\n\n declare modeValue: \"nearest\" | \"document\";\n declare hasModeValue: boolean;\n\n\n scroll(event?: Event) {\n if (event) {\n event.preventDefault();\n }\n let mode = this.hasModeValue ? this.modeValue : \"document\";\n let target: null | HTMLElement;\n if (mode == \"document\") {\n target = document.body;\n } else {\n target = getScrollParent(this.element as HTMLElement);\n }\n if (target == null) {\n return;\n }\n scrollToElement(target!, {behavior: \"smooth\", block: \"start\"}).catch(() => target!.scrollIntoView(false));\n }\n\n}\n\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class SelfDestructController extends BaseController {\r\n\r\n static values = {seconds: Number};\r\n\r\n declare readonly secondsValue: number;\r\n timeout: null | ReturnType = null;\r\n\r\n connect() {\r\n requestAnimationFrame(() => {\r\n // Only start countdown on first paint\r\n this.timeout = setTimeout(() => this.element.remove(), this.secondsValue * 1000);\r\n });\r\n }\r\n\r\n disconnect() {\r\n if (this.timeout) {\r\n clearTimeout(this.timeout);\r\n }\r\n }\r\n\r\n}\r\n","import {EphemeralController} from \"./utilities/ephemeral_controller\";\r\n\r\nexport class TeleportController extends EphemeralController {\r\n\r\n static values = {target: String, insert: String, immediate: Boolean};\r\n\r\n declare readonly immediateValue: boolean;\r\n declare readonly hasImmediateValue: boolean;\r\n declare readonly targetValue: string;\r\n declare readonly hasInsertValue: boolean;\r\n declare readonly insertValue: InsertPosition | \"replaceOuter\" | \"replaceInner\" | \"prepend\" | \"append\";\r\n\r\n connect() {\r\n if (!this.hasInsertValue) {\r\n throw new Error(\"`insert` value was not specified\");\r\n }\r\n\r\n requestAnimationFrame(() => {\r\n if (this.hasImmediateValue && this.immediateValue) {\r\n this.execute();\r\n }\r\n });\r\n }\r\n\r\n execute(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n let destination = document.querySelector(this.targetValue);\r\n\r\n if (destination == null) {\r\n this.element.dispatchEvent(new CustomEvent(\"teleport:error\", {bubbles: true, cancelable: true}));\r\n return;\r\n }\r\n\r\n let copy = this.element.cloneNode(true) as HTMLElement;\r\n this.cleanup(copy);\r\n\r\n switch (this.insertValue) {\r\n case \"beforebegin\":\r\n case \"beforeend\":\r\n case \"afterend\":\r\n case \"afterbegin\":\r\n destination.insertAdjacentHTML(this.insertValue, copy.outerHTML);\r\n break;\r\n case \"replaceOuter\":\r\n destination.outerHTML = copy.outerHTML;\r\n break;\r\n case \"replaceInner\":\r\n destination.innerHTML = copy.outerHTML;\r\n break;\r\n case \"prepend\":\r\n destination.insertAdjacentHTML(\"afterbegin\", copy.outerHTML);\r\n break;\r\n case \"append\":\r\n destination.insertAdjacentHTML(\"beforeend\", copy.outerHTML);\r\n break;\r\n default:\r\n throw new Error(\"`insert` value was not specified\");\r\n\r\n }\r\n this.element.remove();\r\n }\r\n\r\n}\r\n","import {useClickOutside, useHover} from \"stimulus-use\";\nimport {BaseController} from \"./base_controller\";\n\nexport type ToggleClassMode = \"on\" | \"off\" | \"toggle\"\n\nexport class ToggleClassController extends BaseController {\n\n static targets = [\"toggle\"];\n static values = {\n class: String,\n mouseEnter: String,\n mouseLeave: String,\n clickAway: Boolean,\n initial: String,\n };\n\n declare readonly toggleTargets: HTMLElement[];\n\n declare readonly classValue: string;\n declare readonly hasClassValue: boolean;\n\n declare readonly mouseEnterValue: ToggleClassMode;\n declare readonly hasMouseEnterValue: boolean;\n\n declare readonly mouseLeaveValue: ToggleClassMode;\n declare readonly hasMouseLeaveValue: boolean;\n\n declare readonly clickAwayValue: boolean;\n declare readonly hasClickAwayValue: boolean;\n\n declare readonly initialValue: \"on\" | \"off\";\n declare readonly hasInitialValue: boolean;\n\n connect() {\n if (!this.hasClassValue) {\n throw new Error(\"data-toggle-class-class-value must not be empty\");\n }\n\n if (this.hasMouseEnterValue || this.hasMouseLeaveValue) {\n useHover(this);\n }\n\n if (this.hasClickAwayValue && this.clickAwayValue) {\n useClickOutside(this);\n }\n\n requestAnimationFrame(() => {\n if (this.hasInitialValue) {\n if (this.initialValue === \"on\") {\n this.toggleTargets.forEach((target) => this.elementOn(target));\n } else {\n this.toggleTargets.forEach((target) => this.elementOff(target));\n }\n }\n });\n }\n\n clickOutside() {\n this.toggleTargets.forEach((target) => {\n if (this.elementWasToggled(target)) {\n this.elementToggleStatus(target);\n this.elementToggle(target);\n }\n });\n }\n\n mouseEnter() {\n if (this.hasMouseEnterValue) {\n switch (this.mouseEnterValue) {\n case \"on\":\n this.on();\n break;\n case \"off\":\n this.off();\n break;\n case \"toggle\":\n this.toggle();\n break;\n }\n }\n return {};\n }\n\n mouseLeave() {\n if (this.hasMouseLeaveValue) {\n switch (this.mouseLeaveValue) {\n case \"on\":\n this.on();\n break;\n case \"off\":\n this.off();\n break;\n case \"toggle\":\n this.toggle();\n break;\n }\n }\n return {};\n }\n\n on(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementOn(target);\n });\n }\n\n off(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementOff(target);\n });\n }\n\n toggle(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementToggle(target);\n });\n }\n\n private elementWasToggled(el: HTMLElement): boolean {\n return el.dataset.toggled == \"true\";\n }\n\n private elementToggleStatus(el: HTMLElement) {\n if (this.elementWasToggled(el)) {\n delete el.dataset.toggled;\n } else {\n el.dataset.toggled = \"true\";\n }\n }\n\n private elementToggle(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass));\n }\n\n private elementOn(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass, true));\n }\n\n private elementOff(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass, false));\n }\n\n}\n","import {BaseController} from \"./base_controller\";\nimport {isHTMLLinkElement} from \"./utilities/elements\";\nimport {isTurboFrame} from \"./utilities/turbo\";\n\nexport class TurboFrameRCController extends BaseController {\n\n static values = {\n frameId: String,\n src: String,\n loadingMessage: String,\n };\n\n declare readonly frameIdValue: string;\n declare readonly srcValue: string;\n declare readonly hasSrcValue: boolean;\n declare readonly loadingMessageValue: string;\n declare readonly hasLoadingMessageValue: boolean;\n\n toggle(event?: Event | null) {\n if (event) {\n event.preventDefault();\n }\n let frame = this.getFrame();\n let frameSrc = frame.src;\n if (frameSrc == null || frameSrc !== this.getSrc()) {\n this.setSrc();\n } else {\n this.clear();\n }\n }\n\n setSrc(event?: Event | null) {\n if (event) {\n event.preventDefault();\n }\n let frame = this.getFrame();\n if (this.hasLoadingMessageValue) {\n frame.innerHTML = this.loadingMessageValue;\n }\n\n frame.src = this.getSrc();\n }\n\n clear(event?: Event | null) {\n if (event) {\n event.preventDefault();\n }\n let frame = this.getFrame();\n frame.src = \"\";\n frame.innerHTML = \"\";\n }\n\n private getFrame(): TurboFrame {\n let frame = document.getElementById(`${this.frameIdValue}`);\n if (frame == null) {\n throw new Error(`Could not find frame with ID '${this.frameIdValue}'`);\n }\n if (!isTurboFrame(frame)) {\n throw new Error(`Element targeted by ID '${this.frameIdValue}'`);\n } else {\n return frame;\n }\n }\n\n private getSrc(): string {\n let element = this.element as HTMLElement;\n if (this.hasSrcValue) {\n return this.srcValue;\n } else if (isHTMLLinkElement(element)) {\n return element.href;\n } else {\n throw new Error(\"No link given to drive frame to\");\n }\n }\n\n}\n","export function isTurboFrame(element: HTMLElement): element is TurboFrame {\r\n return element.nodeName == \"TURBO-FRAME\";\r\n}\r\n","export function isHTMLLinkElement(element: Element): element is HTMLLinkElement {\n return element.nodeName == \"A\";\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class WordCountController extends BaseController {\r\n\r\n static targets = [\"input\", \"output\"];\r\n static values = {min: Number, max: Number};\r\n static classes = [\"error\"];\r\n\r\n declare readonly inputTarget: HTMLInputElement | HTMLTextAreaElement;\r\n declare readonly outputTarget: HTMLElement;\r\n declare minValue: number;\r\n declare hasMinValue: boolean;\r\n declare maxValue: number;\r\n declare hasMaxValue: boolean;\r\n declare errorClass: string;\r\n declare hasErrorClass: boolean;\r\n\r\n boundHandler = this.updateWordCount.bind(this);\r\n\r\n connect() {\r\n this.updateWordCount();\r\n this.inputTarget.addEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n this.inputTarget.removeEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n updateWordCount() {\r\n let wordCount = 0;\r\n let textAreaValue = this.inputTarget.value;\r\n let matches = textAreaValue.match(/\\S+/g);\r\n wordCount = (matches && matches.length) || 0;\r\n this.outputTarget.innerText = wordCount.toString();\r\n if (this.hasErrorClass) {\r\n if (this.isValidCount(wordCount)) {\r\n this.outputTarget.classList.remove(this.errorClass);\r\n } else {\r\n this.outputTarget.classList.add(this.errorClass);\r\n }\r\n }\r\n }\r\n\r\n isValidCount(count: number) {\r\n let min = 0;\r\n let max = 99999;\r\n\r\n if (this.hasMinValue) {\r\n min = this.minValue;\r\n }\r\n\r\n if (this.hasMaxValue) {\r\n max = this.maxValue;\r\n }\r\n\r\n return count >= min && count <= max;\r\n }\r\n\r\n}\r\n"],"names":["BaseController","context","_this","Proxy","get","obj","prop","returnVal","Reflect","self","test","logProperty","toString","apply","target","thisArg","argArray","log","args","functionName","this","application","debug","logger","console","groupCollapsed","identifier","element","groupEnd","Controller","AsyncBlockController","connect","loadContent","el","hasReplaceTarget","replaceTarget","fetch","endpointValue","then","response","text","html","newEl","document","createElement","innerHTML","replaceWith","event","CustomEvent","detail","dispatchEvent","err","endpoint","String","AutoSubmitFormController","handler","bind","querySelectorAll","forEach","addEventListener","_this2","boundHandler","disconnect","removeEventListener","_this3","e","bubbles","cancelable","method","controller","methodName","composeEventName","name","eventPrefix","composedName","extendedEvent","type","composed","Object","assign","originalEvent","defaultOptions","events","onlyVisible","StimulusUse","[object Object]","options","_a","_b","_c","controllerId","stimulusUseDebug","id","dataset","controllerInitialize","initialize","controllerConnect","controllerDisconnect","UseHover","super","observe","targetElement","onEnter","onLeave","unobserve","call","hover","enhanceController","UseMutation","observer","error","handleError","mutation","entries","MutationObserver","useWindowResize","callback","innerWidth","innerHeight","window","payload","height","Infinity","width","debounce","fn","wait","timeoutId","arguments","clearTimeout","setTimeout","AutosizeController","style","resize","boxSizing","requestAnimationFrame","windowResize","autosize","offset","offsetHeight","clientHeight","scrollHeight","CharCountController","updateCharCount","inputTarget","charCount","value","length","outputTarget","innerText","hasErrorClass","isValidCount","classList","remove","errorClass","add","count","min","max","hasMinValue","minValue","hasMaxValue","maxValue","Number","ClipboardController","supported","queryCommandSupported","hasRemoveUnusedValue","removeUnusedValue","hasFallbackTarget","fallbackTarget","hasCopyTarget","copyTarget","select","preventDefault","sourceTarget","copy","execCommand","removeUnused","Boolean","ConfirmNavigationController","confirmMessage","messageValue","onbeforeunload","handlePopstate","message","DebugController","testTargets","DetectDirtyController","initialValue","isInputElement","isCheckable","checked","restore","setAttribute","removeAttribute","tagName","DisableInputsController","toggle","hasDisablerTarget","disablerTarget","disableInputs","enableInputs","shouldClear","hasClearValue","clearValue","disableTargets","_","disabled","clear","DismissableController","dismiss","EmptyDomController","useMutation","childList","checkEmpty","mutate","children","hasScopeSelectorValue","scopeSelectorValue","hasNotEmptyClass","notEmptyClass","split","klass","hasEmptyClass","emptyClass","scopeSelector","EnableInputsController","hasEnablerTarget","enablerTarget","enableTargets","FallbackImageController","onerror","hasPlaceholderValue","src","placeholderValue","display","placeholder","LazyBlockController","threshold","IntersectionObserver","entry","isIntersecting","isVisible","eventName","appearEvent","dispatchAppear","disappearEvent","dispatchDisappear","useIntersection","appear","LimitedSelectionCheckboxesController","handleInputs","inputTargets","boundHandleInputs","tickedInputs","reduce","previousValue","maxSelections","hasErrorTarget","errorTarget","NestedFormController","checkStructure","content","templateTarget","replace","generateID","targetTarget","insertAdjacentHTML","insertMode","wrapper","closest","wrapperClass","Error","newRecord","destroyInput","querySelector","Date","getTime","Math","random","indexOf","hasWrapperSelectorValue","wrapperClassValue","hasInsertModeValue","insertModeValue","PasswordConfirmController","checkPasswordsMatch","passwordTargets","boundCheckPasswordsMatch","allPasswordsMatch","values","Set","map","has","size","_this4","PasswordPeekController","peak","passwordTarget","hide","ResponsiveIframeWrapperController","messageReceived","boundMessageReceived","data","hasOwnProperty","ResponsiveIframeBodyController","top","constructor","debounces","func","postUpdate","getHeight","parent","postMessage","body","documentElement","smoothPolyfilled","EphemeralController","cleanupSelf","cleanup","replaceAll","RegExp","substringIdentifierValueRegex","camelCase","action","keys","val","classes","scrollToElement","behavior","block","inline","scrollIntoView","smoothSupported","import","polyfill","polyfillSmooth","getScrollParent","node","overflowY","getComputedStyle","parentElement","ScrollIntoFocusController","hasBehaviorValue","behaviorValue","hasBlockValue","blockValue","hasInlineValue","inlineValue","ScrollToBottomController","scroll","hasModeValue","modeValue","mode","ScrollToController","selectorValue","warn","selector","ScrollToTopController","SelfDestructController","timeout","secondsValue","seconds","TeleportController","hasInsertValue","hasImmediateValue","immediateValue","execute","destination","targetValue","cloneNode","insertValue","outerHTML","insert","immediate","ToggleClassController","hasClassValue","hasMouseEnterValue","hasMouseLeaveValue","useHover","hasClickAwayValue","clickAwayValue","onEvent","contains","rect","getBoundingClientRect","windowHeight","windowWidth","clientWidth","left","isElementInViewport","clickOutside","clickOutsideEvent","useClickOutside","hasInitialValue","toggleTargets","elementOn","elementOff","elementWasToggled","elementToggleStatus","elementToggle","mouseEnter","mouseEnterValue","on","off","mouseLeave","mouseLeaveValue","_this5","toggled","classValue","class","clickAway","initial","TurboFrameRCController","frameSrc","getFrame","getSrc","setSrc","frame","hasLoadingMessageValue","loadingMessageValue","getElementById","frameIdValue","nodeName","hasSrcValue","srcValue","isHTMLLinkElement","href","frameId","loadingMessage","WordCountController","updateWordCount","wordCount","matches","match"],"mappings":"mfAEaA,cAEX,WAAYC,SAEV,OADAC,cAAMD,aACKE,WAAY,CACrBC,IAAK,SAACC,EAAKC,GACT,IAAIC,EAAYC,QAAQJ,IAAIC,EAAKC,GAC7BG,OACJ,GAmCR,SAAqBH,GACnB,OAAQA,GACN,IAAK,cACL,IAAK,UACL,IAAK,cACL,IAAK,aACL,IAAK,MACL,IAAK,OACL,IAAK,qBACL,IAAK,aACH,SAGJ,QAAI,kBAAkBI,KAAKJ,IAGvB,aAAaI,KAAKJ,IAGlB,oBAAoBI,KAAKJ,IAGzB,aAAaI,KAAKJ,IAzDZK,CAAYL,EAAKM,YAAa,CAChC,GAAwB,mBAAbL,EACT,WAAWJ,MAAMI,EAAW,CAC1BM,eAAMC,EAAaC,EAAcC,GAI/B,OAHAP,EAAKQ,IAAIX,EAAKM,WAAY,CACxBM,KAAMF,IAEDR,QAAQK,MAAMC,EAAQC,EAASC,MAI1Cd,EAAKe,IAAIX,EAAKM,YAGlB,OAAOL,qCAKb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J,MAAM,uCAnEsBjR,GAEnC8Z,SAAS,CACde,QAASxX,OACTqL,IAAKrL,OACLyX,eAAgBzX,QGPP0X,IAAAA,cAAb,wEAeiB7a,EAAK8a,gBAAgBxX,oBAftC,2BAiBEzB,QAAA,WACEX,KAAK4Z,kBACL5Z,KAAK4H,YAAYrF,iBAAiB,QAASvC,KAAKyC,iBAGlDC,WAAA,WACE1C,KAAK4H,YAAYjF,oBAAoB,QAAS3C,KAAKyC,iBAGrDmX,gBAAA,WACE,IAAIC,EAAY,EAEZC,EADgB9Z,KAAK4H,YAAYE,MACTiS,MAAM,QAElC/Z,KAAKgI,aAAaC,WADlB4R,EAAaC,GAAWA,EAAQ/R,QAAW,GACHvI,WACpCQ,KAAKkI,gBACHlI,KAAKmI,aAAa0R,GACpB7Z,KAAKgI,aAAaI,UAAUC,OAAOrI,KAAKsI,YAExCtI,KAAKgI,aAAaI,UAAUG,IAAIvI,KAAKsI,gBAK3CH,aAAA,SAAaK,GACX,IAAIC,EAAM,EACNC,EAAM,MAUV,OARI1I,KAAK2I,cACPF,EAAMzI,KAAK4I,UAGT5I,KAAK6I,cACPH,EAAM1I,KAAK8I,UAGNN,GAASC,GAAOD,GAASE,MArDK9J,GAEhC+a,UAAU,CAAC,QAAS,UACpBA,SAAS,CAAClR,IAAKM,OAAQL,IAAKK,QAC5B4Q,UAAU,CAAC"} \ No newline at end of file diff --git a/dist/stimulus-library.umd.js b/dist/stimulus-library.umd.js index a7afd6e0..9266340f 100644 --- a/dist/stimulus-library.umd.js +++ b/dist/stimulus-library.umd.js @@ -1,2 +1,2 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("stimulus"),require("lodash.camelcase")):"function"==typeof define&&define.amd?define(["exports","stimulus","lodash.camelcase"],t):t((e||self).stimulusLibrary={},e.stimulus,e.camelCase)}(this,function(e,t,n){function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=r(n);function o(){return(o=Object.assign||function(e){for(var t=1;t{const n=e[t];return"function"==typeof n?n:(...e)=>{}},d=(e,t,n)=>{let r=e;return!0===n?r=`${t.identifier}:${e}`:"string"==typeof n&&(r=`${n}:${e}`),r},p=(e,t,n)=>{const{bubbles:r,cancelable:i,composed:o}=t||{bubbles:!0,cancelable:!0,composed:!0};return t&&Object.assign(n,{originalEvent:t}),new CustomEvent(e,{bubbles:r,cancelable:i,composed:o,detail:n})},f={dispatchEvent:!0,eventPrefix:!0},v={events:["click","touchend"],onlyVisible:!0,dispatchEvent:!0,eventPrefix:!0},g={debug:!1,logger:console};class m{constructor(e,t={}){var n,r,i;this.log=(e,t)=>{this.debug&&(this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${e}`,"color: #3B82F6","color: unset"),this.logger.log(Object.assign({controllerId:this.controllerId},t)),this.logger.groupEnd())},this.debug=null!==(r=null!==(n=null==t?void 0:t.debug)&&void 0!==n?n:e.application.stimulusUseDebug)&&void 0!==r?r:g.debug,this.logger=null!==(i=null==t?void 0:t.logger)&&void 0!==i?i:g.logger,this.controller=e,this.controllerId=e.element.id||e.element.dataset.id,this.controllerInitialize=e.initialize.bind(e),this.controllerConnect=e.connect.bind(e),this.controllerDisconnect=e.disconnect.bind(e)}}class b extends m{constructor(e,t={}){super(e,t),this.observe=()=>{this.targetElement.addEventListener("mouseenter",this.onEnter),this.targetElement.addEventListener("mouseleave",this.onLeave)},this.unobserve=()=>{this.targetElement.removeEventListener("mouseenter",this.onEnter),this.targetElement.removeEventListener("mouseleave",this.onLeave)},this.onEnter=()=>{h(this.controller,"mouseEnter").call(this.controller),this.log("mouseEnter",{hover:!0})},this.onLeave=()=>{h(this.controller,"mouseLeave").call(this.controller),this.log("mouseLeave",{hover:!1})},this.targetElement=(null==t?void 0:t.element)||e.element,this.controller=e,this.enhanceController(),this.observe()}enhanceController(){const e=this.controller.disconnect.bind(this.controller);Object.assign(this.controller,{disconnect:()=>{this.unobserve(),e()}})}}class y extends m{constructor(e,t={}){super(e,t),this.observe=()=>{try{this.observer.observe(this.targetElement,this.options)}catch(e){this.controller.application.handleError(e,"At a minimum, one of childList, attributes, and/or characterData must be true",{})}},this.unobserve=()=>{this.observer.disconnect()},this.mutation=e=>{h(this.controller,"mutate").call(this.controller,e),this.log("mutate",{entries:e})},this.targetElement=(null==t?void 0:t.element)||e.element,this.controller=e,this.options=t,this.observer=new MutationObserver(this.mutation),this.enhanceController(),this.observe()}enhanceController(){const e=this.controller.disconnect.bind(this.controller);Object.assign(this.controller,{disconnect:()=>{this.unobserve(),e()}})}}const E=e=>{const t=t=>{const{innerWidth:n,innerHeight:r}=window,i={height:r||Infinity,width:n||Infinity,event:t};h(e,"windowResize").call(e,i)},n=e.disconnect.bind(e),r=()=>{window.addEventListener("resize",t),t()},i=()=>{window.removeEventListener("resize",t)};return Object.assign(e,{disconnect(){i(),n()}}),r(),[r,i]},w=(e,t=200)=>{let n=null;return function(){const r=arguments,i=this,o=()=>e.apply(i,r);n&&clearTimeout(n),n=setTimeout(o,t)}};var C=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundHandler=t.handler.bind(a(t)),t}s(t,e);var n=t.prototype;return n.connect=function(){var e=this.element;e.style.resize="none",e.style.boxSizing="border-box",e.addEventListener("input",this.boundHandler),e.addEventListener("focus",this.boundHandler),E(this),requestAnimationFrame(this.boundHandler)},n.windowResize=function(){this.handler()},n.handler=function(){this.autosize(this.element)},n.autosize=function(e){var t=e.offsetHeight-e.clientHeight;e.style.height="auto",e.style.height=e.scrollHeight+t+"px"},t}(l),T=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundHandler=t.updateCharCount.bind(a(t)),t}s(t,e);var n=t.prototype;return n.connect=function(){this.updateCharCount(),this.inputTarget.addEventListener("input",this.boundHandler)},n.disconnect=function(){this.inputTarget.removeEventListener("input",this.boundHandler)},n.updateCharCount=function(){var e=this.inputTarget.value.length;this.outputTarget.innerText=e.toString(),this.hasErrorClass&&(this.isValidCount(e)?this.outputTarget.classList.remove(this.errorClass):this.outputTarget.classList.add(this.errorClass))},n.isValidCount=function(e){var t=0,n=99999;return this.hasMinValue&&(t=this.minValue),this.hasMaxValue&&(n=this.maxValue),e>=t&&e<=n},t}(l);T.targets=["input","output"],T.values={min:Number,max:Number},T.classes=["error"];var V=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).supported=!1,t}s(t,e);var n=t.prototype;return n.connect=function(){this.supported=document.queryCommandSupported("copy"),this.hasRemoveUnusedValue&&this.removeUnusedValue&&(this.supported&&this.hasFallbackTarget?this.fallbackTarget.remove():this.hasCopyTarget&&this.copyTarget.remove())},n.select=function(e){e&&e.preventDefault(),this.sourceTarget.select()},n.copy=function(e){e&&e.preventDefault(),this.sourceTarget.select(),this.supported&&document.execCommand("copy")},t}(l);V.targets=["button","copy","fallback"],V.values={removeUnused:Boolean};var L=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.connect=function(){var e=this,t=this.messageValue;window.onbeforeunload=function(){return null==t||t},window.addEventListener("popstate",this.handlePopstate),window.addEventListener("submit",function(){window.removeEventListener("popstate",e.handlePopstate),window.onbeforeunload=null})},n.handlePopstate=function(e){return!1},t}(l);L.values={message:String};var S=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t.prototype.connect=function(){console.log("Debug Controller",this,this.testTargets)},t}(l);S.targets=["test"];var k=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).initialValue=null,t.boundHandler=t.handler.bind(a(t)),t}s(t,e);var n=t.prototype;return n.connect=function(){var e=this.element;this.initialValue=this.isInputElement(e)&&this.isCheckable(e)?e.checked:e.value,e.addEventListener("input",this.boundHandler),e.addEventListener("change",this.boundHandler)},n.disconnect=function(){var e=this.element;e.removeEventListener("input",this.boundHandler),e.removeEventListener("change",this.boundHandler)},n.restore=function(){var e=this.element;this.isInputElement(e)&&this.isCheckable(e)?e.checked=this.initialValue:e.value=this.initialValue},n.handler=function(e){var t=this.element;this.initialValue!==t.value?t.setAttribute("data-dirty","true"):t.removeAttribute("data-dirty")},n.isCheckable=function(e){return"radio"===e.type||"checkbox"===e.type},n.isInputElement=function(e){return"INPUT"===e.tagName},t}(l),H=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.connect=function(){this.toggle()},n.toggle=function(){this.hasDisablerTarget&&this.disablerTarget.checked?this.disableInputs():this.enableInputs()},n.disableInputs=function(){var e=this.hasClearValue&&this.clearValue;this.disableTargets.forEach(function(t,n){e&&(t.value=""),t.disabled=!0})},n.enableInputs=function(){this.disableTargets.forEach(function(e,t){e.disabled=!1})},t}(l);H.targets=["disabler","disable"],H.values={clear:Boolean};var I=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t.prototype.dismiss=function(){this.element.remove()},t}(l),M=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.connect=function(){((e,t={})=>{new y(this,t)})(0,{element:this.element,childList:!0}),this.checkEmpty()},n.mutate=function(e){this.checkEmpty()},n.checkEmpty=function(){var e,t=this;0===(e=this.hasScopeSelectorValue?this.element.querySelectorAll(this.scopeSelectorValue):this.element.children).length?(this.hasNotEmptyClass&&this.notEmptyClass.split(" ").forEach(function(e){return t.element.classList.remove(e)}),this.hasEmptyClass&&this.emptyClass.split(" ").forEach(function(e){return t.element.classList.add(e)}),this.element.dispatchEvent(new CustomEvent("dom:empty",{bubbles:!0,cancelable:!0}))):(this.hasNotEmptyClass&&this.notEmptyClass.split(" ").forEach(function(e){return t.element.classList.add(e)}),this.hasEmptyClass&&this.emptyClass.split(" ").forEach(function(e){return t.element.classList.remove(e)}),this.element.dispatchEvent(new CustomEvent("dom:not-empty",{bubbles:!0,cancelable:!0,detail:{count:e.length}})))},t}(l);M.classes=["empty","notEmpty"],M.values={scopeSelector:String};var x=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.connect=function(){this.toggle()},n.toggle=function(){this.hasEnablerTarget&&this.enablerTarget.checked?this.enableInputs():this.disableInputs()},n.disableInputs=function(){var e=this.hasClearValue&&this.clearValue;this.enableTargets.forEach(function(t,n){e&&(t.value=""),t.disabled=!0})},n.enableInputs=function(){this.enableTargets.forEach(function(e,t){e.disabled=!1})},t}(l);x.targets=["enabler","enable"],x.values={clear:Boolean};var O=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t.prototype.connect=function(){var e=this,t=this.element;t.onerror=function(){e.hasPlaceholderValue?t.src=e.placeholderValue:t.style.display="none"}},t}(l);O.values={placeholder:String};var P=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.connect=function(){if(this.options={element:this.element,threshold:.3},"IntersectionObserver"in window){var e=((e,t={})=>{const{dispatchEvent:n,eventPrefix:r}=Object.assign({},f,t),i=(null==t?void 0:t.element)||e.element,o=e.disconnect.bind(e),s=new IntersectionObserver(t=>{const[o]=t;o.isIntersecting?(t=>{if(e.isVisible=!0,h(e,"appear").call(e,t),n){const n=d("appear",e,r),o=p(n,null,{controller:e,entry:t});i.dispatchEvent(o)}})(o):e.isVisible&&(t=>{if(e.isVisible=!1,h(e,"disappear").call(e,t),n){const n=d("disappear",e,r),o=p(n,null,{controller:e,entry:t});i.dispatchEvent(o)}})(o)},t),a=()=>{s.observe(i)},l=()=>{s.unobserve(i)};return Object.assign(e,{isVisible:!1,disconnect(){l(),o()}}),a(),[a,l]})(this,this.options);this.observe=e[0],this.unobserve=e[1]}else this.loadContent()},n.appear=function(e){var t=this.element;""===t.src&&e.target===t&&e.isIntersecting&&(this.loadContent(),this.unobserve&&this.unobserve())},t}(c),D=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).maxSelections=0,t.boundHandleInputs=t.handleInputs.bind(a(t)),t}s(t,e);var n=t.prototype;return n.connect=function(){var e=this;this.inputTargets.forEach(function(t){return t.addEventListener("change",e.boundHandleInputs)})},n.disconnect=function(){var e=this;this.inputTargets.forEach(function(t){return t.removeEventListener("change",e.boundHandleInputs)})},n.handleInputs=function(e){var t=this.inputTargets.reduce(function(e,t){return t.checked?e+1:e},0),n=e.target;t>this.maxSelections?(e.preventDefault(),n.checked=!1,n.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!0})),n.dispatchEvent(new CustomEvent("limited-selection:too-many",{bubbles:!0,cancelable:!0,detail:{target:n}})),this.hasErrorTarget&&(this.errorTarget.innerHTML=this.messageValue)):(n.dispatchEvent(new CustomEvent("limited-selection:selection",{bubbles:!0,cancelable:!0,detail:{target:n}})),this.hasErrorTarget&&(this.errorTarget.innerHTML=""))},t}(l);D.targets=["input","error"],D.values={max:Number,message:String};var j=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundCheckPasswordsMatch=t.checkPasswordsMatch.bind(a(t)),t}s(t,e);var n=t.prototype;return n.connect=function(){var e=this;this.passwordTargets.forEach(function(t){return t.addEventListener("change",e.boundCheckPasswordsMatch)})},n.disconnect=function(){var e=this;this.passwordTargets.forEach(function(t){return t.removeEventListener("change",e.boundCheckPasswordsMatch)})},n.allPasswordsMatch=function(){var e=new Set(this.passwordTargets.map(function(e){return e.value}));return e.has("")||1==e.size},n.checkPasswordsMatch=function(){var e=this;this.allPasswordsMatch()?(this.element.dispatchEvent(new CustomEvent("password-confirm:match")),this.hasErrorClass&&this.passwordTargets.forEach(function(t){return t.classList.remove(e.errorClass)})):(this.element.dispatchEvent(new CustomEvent("password-confirm:no-match")),this.hasErrorClass&&this.passwordTargets.forEach(function(t){return t.classList.add(e.errorClass)}))},t}(l);j.targets=["password"],j.classes=["error"];var A=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.peak=function(e){e&&e.preventDefault(),this.passwordTarget.type="text"},n.hide=function(e){e&&e.preventDefault(),this.passwordTarget.type="password"},n.toggle=function(e){e&&e.preventDefault(),"password"===this.passwordTarget.type?this.peak():this.hide()},t}(l);A.targets=["password"];var R=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundMessageReceived=t.messageReceived.bind(a(t)),t}s(t,e);var n=t.prototype;return n.connect=function(){window.addEventListener("message",this.boundMessageReceived)},n.disconnect=function(){window.removeEventListener("message",this.boundMessageReceived)},n.messageReceived=function(e){var t=e.data;t.hasOwnProperty("name")&&"iframe-body"===t.name&&t.hasOwnProperty("height")&&this.resize(t.height)},n.resize=function(e){this.element.style.height=e+"px"},t}(l),B=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.connect=function(){var e,t,n;window.self!==window.top&&(E(this),t={},null===(n=(e=this).constructor.debounces)||void 0===n||n.forEach(n=>{if("string"==typeof n&&(e[n]=w(e[n],null==t?void 0:t.wait)),"object"==typeof n){const{name:r,wait:i}=n;if(!r)return;e[r]=w(e[r],i||(null==t?void 0:t.wait))}}),this.postUpdate())},n.windowResize=function(e){this.postUpdate()},n.postUpdate=function(){var e={name:"iframe-body",height:this.getHeight()};window.parent.postMessage(e,"*")},n.getHeight=function(){var e=document.body,t=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,t.clientHeight,t.scrollHeight,t.offsetHeight)},t}(l);B.debounces=["postUpdate"];var z,F=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.cleanupSelf=function(){this.cleanup(this.element)},n.cleanup=function(e){var t,n,r,o=this;e.dataset.controller=(null==(t=e.dataset.controller)?void 0:t.replaceAll(new RegExp("(s|^)"+this.identifier+"(s|$)","g"),""))||"",""==e.dataset.controller&&delete e.dataset.controller;var s=new RegExp("(s|^)"+this.identifier+"\\..+?(s|$)","g");e.dataset.target=(null==(n=e.dataset.target)?void 0:n.replaceAll(s,""))||"",delete e.dataset[i.default(this.identifier+"-target")],""==e.dataset.target&&delete e.dataset.target,e.dataset.action=(null==(r=e.dataset.target)?void 0:r.replaceAll(s,""))||"",delete e.dataset[i.default(this.identifier+"-action")],""==e.dataset.action&&delete e.dataset.action;var a=this.constructor.values;a&&Object.keys(a).forEach(function(t){return delete e.dataset[i.default(o.identifier+"-"+t+"-value")]});var l=this.constructor.classes;l&&Object.keys(l).forEach(function(t){return delete e.dataset[i.default(o.identifier+"-"+t+"-class")]})},t}(l),N=function(e,t){var n=void 0===t?{}:t,r=n.behavior,i=void 0===r?"smooth":r,o=n.block,s=void 0===o?"start":o,a=n.inline,l=void 0===a?"nearest":a;try{var c=function(){e.scrollIntoView({behavior:i,block:s,inline:l})},u=function(){if("smooth"==i&&!q)return Promise.resolve(function(){try{return Promise.resolve(import("smoothscroll-polyfill")).then(function(e){z||(z=!0,(0,e.polyfill)())})}catch(e){return Promise.reject(e)}}()).then(function(){})}();return Promise.resolve(u&&u.then?u.then(c):c())}catch(e){return Promise.reject(e)}},q="scrollBehavior"in document.documentElement.style;function W(e){if(!e)return null;var t=getComputedStyle(e).overflowY;return"visible"!==t&&"hidden"!==t&&e.scrollHeight>=e.clientHeight?e:W(e.parentElement)||document.body}var $=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t.prototype.connect=function(){var e=this;requestAnimationFrame(function(){N(e.element,{behavior:e.hasBehaviorValue?e.behaviorValue:"smooth",block:e.hasBlockValue?e.blockValue:"center",inline:e.hasInlineValue?e.inlineValue:"center"}).catch(function(){return e.element.scrollIntoView()}),e.cleanupSelf()})},t}(F);$.values={behavior:String,block:String,inline:String};var U=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t.prototype.scroll=function(e){var t;e&&e.preventDefault(),null!=(t="document"==(this.hasModeValue?this.modeValue:"document")?document.body:W(this.element))&&N(t,{behavior:"smooth",block:"end"}).catch(function(){return t.scrollIntoView(!1)})},t}(l);U.values={mode:String};var _=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t.prototype.scroll=function(){var e=document.querySelector(this.selectorValue);e?N(e,{behavior:this.hasBehaviorValue?this.behaviorValue:"smooth",block:this.hasBlockValue?this.blockValue:"center",inline:this.hasInlineValue?this.inlineValue:"center"}).catch(function(){return e.scrollIntoView()}):console.warn("Could not find target for '"+this.selectorValue+"'")},t}(l);_.values={selector:String,behavior:String,block:String,inline:String};var Y=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t.prototype.scroll=function(e){var t;e&&e.preventDefault(),null!=(t="document"==(this.hasModeValue?this.modeValue:"document")?document.body:W(this.element))&&N(t,{behavior:"smooth",block:"start"}).catch(function(){return t.scrollIntoView(!1)})},t}(l);Y.values={mode:String};var G=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).timeout=null,t}s(t,e);var n=t.prototype;return n.connect=function(){var e=this;requestAnimationFrame(function(){e.timeout=setTimeout(function(){return e.element.remove()},1e3*e.secondsValue)})},n.disconnect=function(){this.timeout&&clearTimeout(this.timeout)},t}(l);G.values={seconds:Number};var J=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.connect=function(){var e=this;if(!this.hasInsertValue)throw new Error("`insert` value was not specified");requestAnimationFrame(function(){e.hasImmediateValue&&e.immediateValue&&e.execute()})},n.execute=function(e){e&&e.preventDefault();var t=document.querySelector(this.targetValue);if(null!=t){var n=this.element.cloneNode(!0);switch(this.cleanup(n),this.insertValue){case"beforebegin":case"beforeend":case"afterend":case"afterbegin":t.insertAdjacentHTML(this.insertValue,n.outerHTML);break;case"replaceOuter":t.outerHTML=n.outerHTML;break;case"replaceInner":t.innerHTML=n.outerHTML;break;case"prepend":t.insertAdjacentHTML("afterbegin",n.outerHTML);break;case"append":t.insertAdjacentHTML("beforeend",n.outerHTML);break;default:throw new Error("`insert` value was not specified")}this.element.remove()}else this.element.dispatchEvent(new CustomEvent("teleport:error",{bubbles:!0,cancelable:!0}))},t}(F);J.values={target:String,insert:String,immediate:Boolean};var K=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.connect=function(){var e=this;if(!this.hasClassValue)throw new Error("data-toggle-class-class-value must not be empty");(this.hasMouseEnterValue||this.hasMouseLeaveValue)&&((e,t={})=>{new b(this,t)})(),this.hasClickAwayValue&&this.clickAwayValue&&((e,t={})=>{const{onlyVisible:n,dispatchEvent:r,events:i,eventPrefix:o}=Object.assign({},v,t),s=i=>{const s=(null==t?void 0:t.element)||e.element;if(!(s.contains(i.target)||!function(e){const t=e.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight,r=window.innerWidth||document.documentElement.clientWidth;return t.top<=n&&t.top+t.height>=0&&t.left<=r&&t.left+t.width>=0}(s)&&n)&&(e.clickOutside&&e.clickOutside(i),r)){const t=d("click:outside",e,o),n=p(t,i,{controller:e});s.dispatchEvent(n)}},a=e.disconnect.bind(e);Object.assign(e,{disconnect(){null==i||i.forEach(e=>{window.removeEventListener(e,s,!1)}),a()}}),null==i||i.forEach(e=>{window.addEventListener(e,s,!1)})})(this),requestAnimationFrame(function(){e.hasInitialValue&&e.toggleTargets.forEach("on"===e.initialValue?function(t){return e.elementOn(t)}:function(t){return e.elementOff(t)})})},n.clickOutside=function(){var e=this;this.toggleTargets.forEach(function(t){e.elementWasToggled(t)&&(e.elementToggleStatus(t),e.elementToggle(t))})},n.mouseEnter=function(){if(this.hasMouseEnterValue)switch(this.mouseEnterValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle()}return{}},n.mouseLeave=function(){if(this.hasMouseLeaveValue)switch(this.mouseLeaveValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle()}return{}},n.on=function(e){var t=this;this.toggleTargets.forEach(function(e){t.elementToggleStatus(e),t.elementOn(e)})},n.off=function(e){var t=this;this.toggleTargets.forEach(function(e){t.elementToggleStatus(e),t.elementOff(e)})},n.toggle=function(e){var t=this;this.toggleTargets.forEach(function(e){t.elementToggleStatus(e),t.elementToggle(e)})},n.elementWasToggled=function(e){return"true"==e.dataset.toggled},n.elementToggleStatus=function(e){this.elementWasToggled(e)?delete e.dataset.toggled:e.dataset.toggled="true"},n.elementToggle=function(e){this.classValue.split(" ").forEach(function(t){return e.classList.toggle(t)})},n.elementOn=function(e){this.classValue.split(" ").forEach(function(t){return e.classList.toggle(t,!0)})},n.elementOff=function(e){this.classValue.split(" ").forEach(function(t){return e.classList.toggle(t,!1)})},t}(l);K.targets=["toggle"],K.values={class:String,mouseEnter:String,mouseLeave:String,clickAway:Boolean,initial:String};var Q=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.toggle=function(e){e&&e.preventDefault();var t=this.getFrame().src;null==t||t!==this.getSrc()?this.setSrc():this.clear()},n.setSrc=function(e){e&&e.preventDefault();var t=this.getFrame();this.hasLoadingMessageValue&&(t.innerHTML=this.loadingMessageValue),t.src=this.getSrc()},n.clear=function(e){e&&e.preventDefault();var t=this.getFrame();t.src="",t.innerHTML=""},n.getFrame=function(){var e=document.getElementById(""+this.frameIdValue);if(null==e)throw new Error("Could not find frame with ID '"+this.frameIdValue+"'");if("TURBO-FRAME"!=e.nodeName)throw new Error("Element targeted by ID '"+this.frameIdValue+"'");return e},n.getSrc=function(){var e=this.element;if(this.hasSrcValue)return this.srcValue;if(function(e){return"A"==e.nodeName}(e))return e.href;throw new Error("No link given to drive frame to")},t}(l);Q.values={frameId:String,src:String,loadingMessage:String};var X=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundHandler=t.updateWordCount.bind(a(t)),t}s(t,e);var n=t.prototype;return n.connect=function(){this.updateWordCount(),this.inputTarget.addEventListener("input",this.boundHandler)},n.disconnect=function(){this.inputTarget.removeEventListener("input",this.boundHandler)},n.updateWordCount=function(){var e=0,t=this.inputTarget.value.match(/\S+/g);this.outputTarget.innerText=(e=t&&t.length||0).toString(),this.hasErrorClass&&(this.isValidCount(e)?this.outputTarget.classList.remove(this.errorClass):this.outputTarget.classList.add(this.errorClass))},n.isValidCount=function(e){var t=0,n=99999;return this.hasMinValue&&(t=this.minValue),this.hasMaxValue&&(n=this.maxValue),e>=t&&e<=n},t}(l);X.targets=["input","output"],X.values={min:Number,max:Number},X.classes=["error"],e.AsyncBlockController=c,e.AutoSubmitFormController=u,e.AutosizeController=C,e.CharCountController=T,e.ClipboardController=V,e.ConfirmNavigationController=L,e.DebugController=S,e.DetectDirtyController=k,e.DisableInputsController=H,e.DismissableController=I,e.EmptyDomController=M,e.EnableInputsController=x,e.FallbackImageController=O,e.LazyBlockController=P,e.LimitedSelectionCheckboxesController=D,e.PasswordConfirmController=j,e.PasswordPeekController=A,e.ResponsiveIframeBodyController=B,e.ResponsiveIframeWrapperController=R,e.ScrollIntoFocusController=$,e.ScrollToBottomController=U,e.ScrollToController=_,e.ScrollToTopController=Y,e.SelfDestructController=G,e.TeleportController=J,e.ToggleClassController=K,e.TurboFrameRCController=Q,e.WordCountController=X}); +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("stimulus"),require("lodash.camelcase")):"function"==typeof define&&define.amd?define(["exports","stimulus","lodash.camelcase"],t):t((e||self).stimulusLibrary={},e.stimulus,e.camelCase)}(this,function(e,t,n){function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=r(n);function o(){return(o=Object.assign||function(e){for(var t=1;t{const n=e[t];return"function"==typeof n?n:(...e)=>{}},d=(e,t,n)=>{let r=e;return!0===n?r=`${t.identifier}:${e}`:"string"==typeof n&&(r=`${n}:${e}`),r},p=(e,t,n)=>{const{bubbles:r,cancelable:i,composed:o}=t||{bubbles:!0,cancelable:!0,composed:!0};return t&&Object.assign(n,{originalEvent:t}),new CustomEvent(e,{bubbles:r,cancelable:i,composed:o,detail:n})},f={dispatchEvent:!0,eventPrefix:!0},v={events:["click","touchend"],onlyVisible:!0,dispatchEvent:!0,eventPrefix:!0},g={debug:!1,logger:console};class m{constructor(e,t={}){var n,r,i;this.log=(e,t)=>{this.debug&&(this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${e}`,"color: #3B82F6","color: unset"),this.logger.log(Object.assign({controllerId:this.controllerId},t)),this.logger.groupEnd())},this.debug=null!==(r=null!==(n=null==t?void 0:t.debug)&&void 0!==n?n:e.application.stimulusUseDebug)&&void 0!==r?r:g.debug,this.logger=null!==(i=null==t?void 0:t.logger)&&void 0!==i?i:g.logger,this.controller=e,this.controllerId=e.element.id||e.element.dataset.id,this.controllerInitialize=e.initialize.bind(e),this.controllerConnect=e.connect.bind(e),this.controllerDisconnect=e.disconnect.bind(e)}}class b extends m{constructor(e,t={}){super(e,t),this.observe=()=>{this.targetElement.addEventListener("mouseenter",this.onEnter),this.targetElement.addEventListener("mouseleave",this.onLeave)},this.unobserve=()=>{this.targetElement.removeEventListener("mouseenter",this.onEnter),this.targetElement.removeEventListener("mouseleave",this.onLeave)},this.onEnter=()=>{h(this.controller,"mouseEnter").call(this.controller),this.log("mouseEnter",{hover:!0})},this.onLeave=()=>{h(this.controller,"mouseLeave").call(this.controller),this.log("mouseLeave",{hover:!1})},this.targetElement=(null==t?void 0:t.element)||e.element,this.controller=e,this.enhanceController(),this.observe()}enhanceController(){const e=this.controller.disconnect.bind(this.controller);Object.assign(this.controller,{disconnect:()=>{this.unobserve(),e()}})}}class y extends m{constructor(e,t={}){super(e,t),this.observe=()=>{try{this.observer.observe(this.targetElement,this.options)}catch(e){this.controller.application.handleError(e,"At a minimum, one of childList, attributes, and/or characterData must be true",{})}},this.unobserve=()=>{this.observer.disconnect()},this.mutation=e=>{h(this.controller,"mutate").call(this.controller,e),this.log("mutate",{entries:e})},this.targetElement=(null==t?void 0:t.element)||e.element,this.controller=e,this.options=t,this.observer=new MutationObserver(this.mutation),this.enhanceController(),this.observe()}enhanceController(){const e=this.controller.disconnect.bind(this.controller);Object.assign(this.controller,{disconnect:()=>{this.unobserve(),e()}})}}const E=e=>{const t=t=>{const{innerWidth:n,innerHeight:r}=window,i={height:r||Infinity,width:n||Infinity,event:t};h(e,"windowResize").call(e,i)},n=e.disconnect.bind(e),r=()=>{window.addEventListener("resize",t),t()},i=()=>{window.removeEventListener("resize",t)};return Object.assign(e,{disconnect(){i(),n()}}),r(),[r,i]},w=(e,t=200)=>{let n=null;return function(){const r=arguments,i=this,o=()=>e.apply(i,r);n&&clearTimeout(n),n=setTimeout(o,t)}};var C=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundHandler=t.handler.bind(a(t)),t}s(t,e);var n=t.prototype;return n.connect=function(){var e=this.element;e.style.resize="none",e.style.boxSizing="border-box",e.addEventListener("input",this.boundHandler),e.addEventListener("focus",this.boundHandler),E(this),requestAnimationFrame(this.boundHandler)},n.windowResize=function(){this.handler()},n.handler=function(){this.autosize(this.element)},n.autosize=function(e){var t=e.offsetHeight-e.clientHeight;e.style.height="auto",e.style.height=e.scrollHeight+t+"px"},t}(l),T=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundHandler=t.updateCharCount.bind(a(t)),t}s(t,e);var n=t.prototype;return n.connect=function(){this.updateCharCount(),this.inputTarget.addEventListener("input",this.boundHandler)},n.disconnect=function(){this.inputTarget.removeEventListener("input",this.boundHandler)},n.updateCharCount=function(){var e=this.inputTarget.value.length;this.outputTarget.innerText=e.toString(),this.hasErrorClass&&(this.isValidCount(e)?this.outputTarget.classList.remove(this.errorClass):this.outputTarget.classList.add(this.errorClass))},n.isValidCount=function(e){var t=0,n=99999;return this.hasMinValue&&(t=this.minValue),this.hasMaxValue&&(n=this.maxValue),e>=t&&e<=n},t}(l);T.targets=["input","output"],T.values={min:Number,max:Number},T.classes=["error"];var V=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).supported=!1,t}s(t,e);var n=t.prototype;return n.connect=function(){this.supported=document.queryCommandSupported("copy"),this.hasRemoveUnusedValue&&this.removeUnusedValue&&(this.supported&&this.hasFallbackTarget?this.fallbackTarget.remove():this.hasCopyTarget&&this.copyTarget.remove())},n.select=function(e){e&&e.preventDefault(),this.sourceTarget.select()},n.copy=function(e){e&&e.preventDefault(),this.sourceTarget.select(),this.supported&&document.execCommand("copy")},t}(l);V.targets=["button","copy","fallback"],V.values={removeUnused:Boolean};var L=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.connect=function(){var e=this,t=this.messageValue;window.onbeforeunload=function(){return null==t||t},window.addEventListener("popstate",this.handlePopstate),window.addEventListener("submit",function(){window.removeEventListener("popstate",e.handlePopstate),window.onbeforeunload=null})},n.handlePopstate=function(e){return!1},t}(l);L.values={message:String};var S=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t.prototype.connect=function(){console.log("Debug Controller",this,this.testTargets)},t}(l);S.targets=["test"];var k=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).initialValue=null,t.boundHandler=t.handler.bind(a(t)),t}s(t,e);var n=t.prototype;return n.connect=function(){var e=this.element;this.initialValue=this.isInputElement(e)&&this.isCheckable(e)?e.checked:e.value,e.addEventListener("input",this.boundHandler),e.addEventListener("change",this.boundHandler)},n.disconnect=function(){var e=this.element;e.removeEventListener("input",this.boundHandler),e.removeEventListener("change",this.boundHandler)},n.restore=function(){var e=this.element;this.isInputElement(e)&&this.isCheckable(e)?e.checked=this.initialValue:e.value=this.initialValue},n.handler=function(e){var t=this.element;this.initialValue!==t.value?t.setAttribute("data-dirty","true"):t.removeAttribute("data-dirty")},n.isCheckable=function(e){return"radio"===e.type||"checkbox"===e.type},n.isInputElement=function(e){return"INPUT"===e.tagName},t}(l),H=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.connect=function(){this.toggle()},n.toggle=function(){this.hasDisablerTarget&&this.disablerTarget.checked?this.disableInputs():this.enableInputs()},n.disableInputs=function(){var e=this.hasClearValue&&this.clearValue;this.disableTargets.forEach(function(t,n){e&&(t.value=""),t.disabled=!0})},n.enableInputs=function(){this.disableTargets.forEach(function(e,t){e.disabled=!1})},t}(l);H.targets=["disabler","disable"],H.values={clear:Boolean};var I=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t.prototype.dismiss=function(){this.element.remove()},t}(l),M=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.connect=function(){((e,t={})=>{new y(this,t)})(0,{element:this.element,childList:!0}),this.checkEmpty()},n.mutate=function(e){this.checkEmpty()},n.checkEmpty=function(){var e,t=this;0===(e=this.hasScopeSelectorValue?this.element.querySelectorAll(this.scopeSelectorValue):this.element.children).length?(this.hasNotEmptyClass&&this.notEmptyClass.split(" ").forEach(function(e){return t.element.classList.remove(e)}),this.hasEmptyClass&&this.emptyClass.split(" ").forEach(function(e){return t.element.classList.add(e)}),this.element.dispatchEvent(new CustomEvent("dom:empty",{bubbles:!0,cancelable:!0}))):(this.hasNotEmptyClass&&this.notEmptyClass.split(" ").forEach(function(e){return t.element.classList.add(e)}),this.hasEmptyClass&&this.emptyClass.split(" ").forEach(function(e){return t.element.classList.remove(e)}),this.element.dispatchEvent(new CustomEvent("dom:not-empty",{bubbles:!0,cancelable:!0,detail:{count:e.length}})))},t}(l);M.classes=["empty","notEmpty"],M.values={scopeSelector:String};var x=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.connect=function(){this.toggle()},n.toggle=function(){this.hasEnablerTarget&&this.enablerTarget.checked?this.enableInputs():this.disableInputs()},n.disableInputs=function(){var e=this.hasClearValue&&this.clearValue;this.enableTargets.forEach(function(t,n){e&&(t.value=""),t.disabled=!0})},n.enableInputs=function(){this.enableTargets.forEach(function(e,t){e.disabled=!1})},t}(l);x.targets=["enabler","enable"],x.values={clear:Boolean};var O=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t.prototype.connect=function(){var e=this,t=this.element;t.onerror=function(){e.hasPlaceholderValue?t.src=e.placeholderValue:t.style.display="none"}},t}(l);O.values={placeholder:String};var D=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.connect=function(){if(this.options={element:this.element,threshold:.3},"IntersectionObserver"in window){var e=((e,t={})=>{const{dispatchEvent:n,eventPrefix:r}=Object.assign({},f,t),i=(null==t?void 0:t.element)||e.element,o=e.disconnect.bind(e),s=new IntersectionObserver(t=>{const[o]=t;o.isIntersecting?(t=>{if(e.isVisible=!0,h(e,"appear").call(e,t),n){const n=d("appear",e,r),o=p(n,null,{controller:e,entry:t});i.dispatchEvent(o)}})(o):e.isVisible&&(t=>{if(e.isVisible=!1,h(e,"disappear").call(e,t),n){const n=d("disappear",e,r),o=p(n,null,{controller:e,entry:t});i.dispatchEvent(o)}})(o)},t),a=()=>{s.observe(i)},l=()=>{s.unobserve(i)};return Object.assign(e,{isVisible:!1,disconnect(){l(),o()}}),a(),[a,l]})(this,this.options);this.observe=e[0],this.unobserve=e[1]}else this.loadContent()},n.appear=function(e){var t=this.element;""===t.src&&e.target===t&&e.isIntersecting&&(this.loadContent(),this.unobserve&&this.unobserve())},t}(c),P=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).maxSelections=0,t.boundHandleInputs=t.handleInputs.bind(a(t)),t}s(t,e);var n=t.prototype;return n.connect=function(){var e=this;this.inputTargets.forEach(function(t){return t.addEventListener("change",e.boundHandleInputs)})},n.disconnect=function(){var e=this;this.inputTargets.forEach(function(t){return t.removeEventListener("change",e.boundHandleInputs)})},n.handleInputs=function(e){var t=this.inputTargets.reduce(function(e,t){return t.checked?e+1:e},0),n=e.target;t>this.maxSelections?(e.preventDefault(),n.checked=!1,n.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!0})),n.dispatchEvent(new CustomEvent("limited-selection:too-many",{bubbles:!0,cancelable:!0,detail:{target:n}})),this.hasErrorTarget&&(this.errorTarget.innerHTML=this.messageValue)):(n.dispatchEvent(new CustomEvent("limited-selection:selection",{bubbles:!0,cancelable:!0,detail:{target:n}})),this.hasErrorTarget&&(this.errorTarget.innerHTML=""))},t}(l);P.targets=["input","error"],P.values={max:Number,message:String};var R=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n,r=t.prototype;return r.connect=function(){this.checkStructure()},r.add=function(e){e&&e.preventDefault();var t=this.templateTarget.innerHTML.replace(/NEW_RECORD/g,this.generateID());this.targetTarget.insertAdjacentHTML(this.insertMode,t)},r.remove=function(e){e.preventDefault();var t=e.target.closest(this.wrapperClass);if(null==t)throw new Error("#remove was clicked from outside of a child record. Could not find an ancestor with class "+this.wrapperClass);if("true"===t.dataset.newRecord)t.remove();else{t.style.display="none";var n=t.querySelector("input[name*='_destroy']");if(null==n)throw new Error("Could not find a hidden input with name '_destroy'. NestedForm cannot remove an already persisted record without it.");n.value="1"}},r.generateID=function(){return(new Date).getTime().toString()+Math.random()},r.checkStructure=function(){if(this.templateTarget.innerHTML.indexOf("NEW_RECORD"))throw new Error("Could not find 'NEW_RECORD' in the provided template. Please make sure you've passed `child_index: 'NEW_RECORD'` to `fields_for`")},(n=[{key:"wrapperClass",get:function(){return this.hasWrapperSelectorValue?this.wrapperClassValue:"nested-fields"}},{key:"insertMode",get:function(){return this.hasInsertModeValue?this.insertModeValue:"beforeend"}}])&&function(e,t){for(var n=0;n{if("string"==typeof n&&(e[n]=w(e[n],null==t?void 0:t.wait)),"object"==typeof n){const{name:r,wait:i}=n;if(!r)return;e[r]=w(e[r],i||(null==t?void 0:t.wait))}}),this.postUpdate())},n.windowResize=function(e){this.postUpdate()},n.postUpdate=function(){var e={name:"iframe-body",height:this.getHeight()};window.parent.postMessage(e,"*")},n.getHeight=function(){var e=document.body,t=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,t.clientHeight,t.scrollHeight,t.offsetHeight)},t}(l);B.debounces=["postUpdate"];var F,W=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.cleanupSelf=function(){this.cleanup(this.element)},n.cleanup=function(e){var t,n,r,o=this;e.dataset.controller=(null==(t=e.dataset.controller)?void 0:t.replaceAll(new RegExp("(s|^)"+this.identifier+"(s|$)","g"),""))||"",""==e.dataset.controller&&delete e.dataset.controller;var s=new RegExp("(s|^)"+this.identifier+"\\..+?(s|$)","g");e.dataset.target=(null==(n=e.dataset.target)?void 0:n.replaceAll(s,""))||"",delete e.dataset[i.default(this.identifier+"-target")],""==e.dataset.target&&delete e.dataset.target,e.dataset.action=(null==(r=e.dataset.target)?void 0:r.replaceAll(s,""))||"",delete e.dataset[i.default(this.identifier+"-action")],""==e.dataset.action&&delete e.dataset.action;var a=this.constructor.values;a&&Object.keys(a).forEach(function(t){return delete e.dataset[i.default(o.identifier+"-"+t+"-value")]});var l=this.constructor.classes;l&&Object.keys(l).forEach(function(t){return delete e.dataset[i.default(o.identifier+"-"+t+"-class")]})},t}(l),z=function(e,t){var n=void 0===t?{}:t,r=n.behavior,i=void 0===r?"smooth":r,o=n.block,s=void 0===o?"start":o,a=n.inline,l=void 0===a?"nearest":a;try{var c=function(){e.scrollIntoView({behavior:i,block:s,inline:l})},u=function(){if("smooth"==i&&!q)return Promise.resolve(function(){try{return Promise.resolve(import("smoothscroll-polyfill")).then(function(e){F||(F=!0,(0,e.polyfill)())})}catch(e){return Promise.reject(e)}}()).then(function(){})}();return Promise.resolve(u&&u.then?u.then(c):c())}catch(e){return Promise.reject(e)}},q="scrollBehavior"in document.documentElement.style;function $(e){if(!e)return null;var t=getComputedStyle(e).overflowY;return"visible"!==t&&"hidden"!==t&&e.scrollHeight>=e.clientHeight?e:$(e.parentElement)||document.body}var _=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t.prototype.connect=function(){var e=this;requestAnimationFrame(function(){z(e.element,{behavior:e.hasBehaviorValue?e.behaviorValue:"smooth",block:e.hasBlockValue?e.blockValue:"center",inline:e.hasInlineValue?e.inlineValue:"center"}).catch(function(){return e.element.scrollIntoView()}),e.cleanupSelf()})},t}(W);_.values={behavior:String,block:String,inline:String};var U=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t.prototype.scroll=function(e){var t;e&&e.preventDefault(),null!=(t="document"==(this.hasModeValue?this.modeValue:"document")?document.body:$(this.element))&&z(t,{behavior:"smooth",block:"end"}).catch(function(){return t.scrollIntoView(!1)})},t}(l);U.values={mode:String};var Y=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t.prototype.scroll=function(){var e=document.querySelector(this.selectorValue);e?z(e,{behavior:this.hasBehaviorValue?this.behaviorValue:"smooth",block:this.hasBlockValue?this.blockValue:"center",inline:this.hasInlineValue?this.inlineValue:"center"}).catch(function(){return e.scrollIntoView()}):console.warn("Could not find target for '"+this.selectorValue+"'")},t}(l);Y.values={selector:String,behavior:String,block:String,inline:String};var G=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t.prototype.scroll=function(e){var t;e&&e.preventDefault(),null!=(t="document"==(this.hasModeValue?this.modeValue:"document")?document.body:$(this.element))&&z(t,{behavior:"smooth",block:"start"}).catch(function(){return t.scrollIntoView(!1)})},t}(l);G.values={mode:String};var J=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).timeout=null,t}s(t,e);var n=t.prototype;return n.connect=function(){var e=this;requestAnimationFrame(function(){e.timeout=setTimeout(function(){return e.element.remove()},1e3*e.secondsValue)})},n.disconnect=function(){this.timeout&&clearTimeout(this.timeout)},t}(l);J.values={seconds:Number};var K=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.connect=function(){var e=this;if(!this.hasInsertValue)throw new Error("`insert` value was not specified");requestAnimationFrame(function(){e.hasImmediateValue&&e.immediateValue&&e.execute()})},n.execute=function(e){e&&e.preventDefault();var t=document.querySelector(this.targetValue);if(null!=t){var n=this.element.cloneNode(!0);switch(this.cleanup(n),this.insertValue){case"beforebegin":case"beforeend":case"afterend":case"afterbegin":t.insertAdjacentHTML(this.insertValue,n.outerHTML);break;case"replaceOuter":t.outerHTML=n.outerHTML;break;case"replaceInner":t.innerHTML=n.outerHTML;break;case"prepend":t.insertAdjacentHTML("afterbegin",n.outerHTML);break;case"append":t.insertAdjacentHTML("beforeend",n.outerHTML);break;default:throw new Error("`insert` value was not specified")}this.element.remove()}else this.element.dispatchEvent(new CustomEvent("teleport:error",{bubbles:!0,cancelable:!0}))},t}(W);K.values={target:String,insert:String,immediate:Boolean};var Q=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.connect=function(){var e=this;if(!this.hasClassValue)throw new Error("data-toggle-class-class-value must not be empty");(this.hasMouseEnterValue||this.hasMouseLeaveValue)&&((e,t={})=>{new b(this,t)})(),this.hasClickAwayValue&&this.clickAwayValue&&((e,t={})=>{const{onlyVisible:n,dispatchEvent:r,events:i,eventPrefix:o}=Object.assign({},v,t),s=i=>{const s=(null==t?void 0:t.element)||e.element;if(!(s.contains(i.target)||!function(e){const t=e.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight,r=window.innerWidth||document.documentElement.clientWidth;return t.top<=n&&t.top+t.height>=0&&t.left<=r&&t.left+t.width>=0}(s)&&n)&&(e.clickOutside&&e.clickOutside(i),r)){const t=d("click:outside",e,o),n=p(t,i,{controller:e});s.dispatchEvent(n)}},a=e.disconnect.bind(e);Object.assign(e,{disconnect(){null==i||i.forEach(e=>{window.removeEventListener(e,s,!1)}),a()}}),null==i||i.forEach(e=>{window.addEventListener(e,s,!1)})})(this),requestAnimationFrame(function(){e.hasInitialValue&&e.toggleTargets.forEach("on"===e.initialValue?function(t){return e.elementOn(t)}:function(t){return e.elementOff(t)})})},n.clickOutside=function(){var e=this;this.toggleTargets.forEach(function(t){e.elementWasToggled(t)&&(e.elementToggleStatus(t),e.elementToggle(t))})},n.mouseEnter=function(){if(this.hasMouseEnterValue)switch(this.mouseEnterValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle()}return{}},n.mouseLeave=function(){if(this.hasMouseLeaveValue)switch(this.mouseLeaveValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle()}return{}},n.on=function(e){var t=this;this.toggleTargets.forEach(function(e){t.elementToggleStatus(e),t.elementOn(e)})},n.off=function(e){var t=this;this.toggleTargets.forEach(function(e){t.elementToggleStatus(e),t.elementOff(e)})},n.toggle=function(e){var t=this;this.toggleTargets.forEach(function(e){t.elementToggleStatus(e),t.elementToggle(e)})},n.elementWasToggled=function(e){return"true"==e.dataset.toggled},n.elementToggleStatus=function(e){this.elementWasToggled(e)?delete e.dataset.toggled:e.dataset.toggled="true"},n.elementToggle=function(e){this.classValue.split(" ").forEach(function(t){return e.classList.toggle(t)})},n.elementOn=function(e){this.classValue.split(" ").forEach(function(t){return e.classList.toggle(t,!0)})},n.elementOff=function(e){this.classValue.split(" ").forEach(function(t){return e.classList.toggle(t,!1)})},t}(l);Q.targets=["toggle"],Q.values={class:String,mouseEnter:String,mouseLeave:String,clickAway:Boolean,initial:String};var X=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.toggle=function(e){e&&e.preventDefault();var t=this.getFrame().src;null==t||t!==this.getSrc()?this.setSrc():this.clear()},n.setSrc=function(e){e&&e.preventDefault();var t=this.getFrame();this.hasLoadingMessageValue&&(t.innerHTML=this.loadingMessageValue),t.src=this.getSrc()},n.clear=function(e){e&&e.preventDefault();var t=this.getFrame();t.src="",t.innerHTML=""},n.getFrame=function(){var e=document.getElementById(""+this.frameIdValue);if(null==e)throw new Error("Could not find frame with ID '"+this.frameIdValue+"'");if("TURBO-FRAME"!=e.nodeName)throw new Error("Element targeted by ID '"+this.frameIdValue+"'");return e},n.getSrc=function(){var e=this.element;if(this.hasSrcValue)return this.srcValue;if(function(e){return"A"==e.nodeName}(e))return e.href;throw new Error("No link given to drive frame to")},t}(l);X.values={frameId:String,src:String,loadingMessage:String};var Z=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundHandler=t.updateWordCount.bind(a(t)),t}s(t,e);var n=t.prototype;return n.connect=function(){this.updateWordCount(),this.inputTarget.addEventListener("input",this.boundHandler)},n.disconnect=function(){this.inputTarget.removeEventListener("input",this.boundHandler)},n.updateWordCount=function(){var e=0,t=this.inputTarget.value.match(/\S+/g);this.outputTarget.innerText=(e=t&&t.length||0).toString(),this.hasErrorClass&&(this.isValidCount(e)?this.outputTarget.classList.remove(this.errorClass):this.outputTarget.classList.add(this.errorClass))},n.isValidCount=function(e){var t=0,n=99999;return this.hasMinValue&&(t=this.minValue),this.hasMaxValue&&(n=this.maxValue),e>=t&&e<=n},t}(l);Z.targets=["input","output"],Z.values={min:Number,max:Number},Z.classes=["error"],e.AsyncBlockController=c,e.AutoSubmitFormController=u,e.AutosizeController=C,e.CharCountController=T,e.ClipboardController=V,e.ConfirmNavigationController=L,e.DebugController=S,e.DetectDirtyController=k,e.DisableInputsController=H,e.DismissableController=I,e.EmptyDomController=M,e.EnableInputsController=x,e.FallbackImageController=O,e.LazyBlockController=D,e.LimitedSelectionCheckboxesController=P,e.NestedFormController=R,e.PasswordConfirmController=j,e.PasswordPeekController=A,e.ResponsiveIframeBodyController=B,e.ResponsiveIframeWrapperController=N,e.ScrollIntoFocusController=_,e.ScrollToBottomController=U,e.ScrollToController=Y,e.ScrollToTopController=G,e.SelfDestructController=J,e.TeleportController=K,e.ToggleClassController=Q,e.TurboFrameRCController=X,e.WordCountController=Z}); //# sourceMappingURL=stimulus-library.umd.js.map diff --git a/dist/stimulus-library.umd.js.map b/dist/stimulus-library.umd.js.map index 45962d85..3faba85d 100644 --- a/dist/stimulus-library.umd.js.map +++ b/dist/stimulus-library.umd.js.map @@ -1 +1 @@ -{"version":3,"file":"stimulus-library.umd.js","sources":["../src/base_controller.ts","../src/async_block_controller.ts","../src/auto_submit_form_controller.ts","../node_modules/stimulus-use/dist/support/index.js","../node_modules/stimulus-use/dist/use-intersection/use-intersection.js","../node_modules/stimulus-use/dist/use-click-outside/use-click-outside.js","../node_modules/stimulus-use/dist/stimulus_use.js","../node_modules/stimulus-use/dist/use-hover/use-hover.js","../node_modules/stimulus-use/dist/use-mutation/use-mutation.js","../node_modules/stimulus-use/dist/use-window-resize/use-window-resize.js","../node_modules/stimulus-use/dist/use-debounce/use-debounce.js","../src/autosize_controller.ts","../src/char_count_controller.ts","../src/clipboard_controller.ts","../src/confirm_navigation_controller.ts","../src/debug_controller.ts","../src/detect_dirty_controller.ts","../src/disable_inputs_controller.ts","../src/dismissable_controller.ts","../src/empty_dom_controller.ts","../src/enable_inputs_controller.ts","../src/fallback_image_controller.ts","../src/lazy_block_controller.ts","../src/limited_selection_checkboxes_controller.ts","../src/password_confirm_controller.ts","../src/password_peek_controller.ts","../src/responsive_iframe_controller.ts","../src/utilities/scroll.ts","../src/utilities/ephemeral_controller.ts","../src/scroll_into_focus_controller.ts","../src/scroll_to_bottom_controller.ts","../src/scroll_to_controller.ts","../src/scroll_to_top_controller.ts","../src/self_destruct_controller.ts","../src/teleport_controller.ts","../src/toggle_class_controller.ts","../src/turbo_frame_rc_controller.ts","../src/utilities/turbo.ts","../src/utilities/elements.ts","../src/word_count_controller.ts"],"sourcesContent":["import {Context, Controller} from \"stimulus\";\r\n\r\nexport class BaseController extends Controller {\r\n\r\n constructor(context: Context) {\r\n super(context);\r\n return new Proxy(this, {\r\n get: (obj, prop) => {\r\n let returnVal = Reflect.get(obj, prop);\r\n let self = this;\r\n if (logProperty(prop.toString())) {\r\n if (typeof returnVal == \"function\") {\r\n return new Proxy(returnVal, {\r\n apply(target: any, thisArg: any, argArray?: any): any {\r\n self.log(prop.toString(), {\r\n args: argArray,\r\n });\r\n return Reflect.apply(target, thisArg, argArray);\r\n },\r\n });\r\n } else {\r\n this.log(prop.toString());\r\n }\r\n }\r\n return returnVal;\r\n },\r\n });\r\n }\r\n\r\n log(functionName: string, args: {} = {}): void {\r\n // @ts-ignore\r\n if (!this.application.debug) {\r\n return;\r\n }\r\n let logger = console;\r\n logger.groupCollapsed(`%c${this.identifier} %c#${functionName}`, \"color: #3B82F6\", \"color: unset\");\r\n logger.log({\r\n element: this.element,\r\n ...args,\r\n });\r\n logger.groupEnd();\r\n }\r\n\r\n}\r\n\r\nfunction logProperty(prop: string): boolean {\r\n switch (prop) {\r\n case \"application\":\r\n case \"element\":\r\n case \"constructor\":\r\n case \"initialize\":\r\n case \"log\":\r\n case \"data\":\r\n case \"valueDescriptorMap\":\r\n case \"identifier\":\r\n return false;\r\n }\r\n\r\n if (/^.*?Target(s)?$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?Value$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?ValueChanged$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?Class$/.test(prop)) {\r\n return false;\r\n }\r\n\r\n return true;\r\n}\r\n","import {BaseController} from \"./base_controller\";\n\nexport class AsyncBlockController extends BaseController {\n static targets = [\"replace\"];\n static values = {endpoint: String};\n\n declare readonly replaceTarget: HTMLElement;\n declare readonly hasReplaceTarget: boolean;\n declare readonly endpointValue: string;\n\n\n // This is a simple controller to load a block of content when the page loads.\n // It should be used to give a quick initial response before calling out to an\n // an AJAX endpoint to do some expensive work.\n connect() {\n this.loadContent();\n }\n\n loadContent() {\n let el = (this.hasReplaceTarget ? this.replaceTarget : this.element) as HTMLElement;\n fetch(this.endpointValue)\n .then((response) => response.text())\n .then((html) => {\n let newEl = document.createElement(\"div\");\n newEl.innerHTML = html;\n el.replaceWith(newEl);\n\n // Trigger event to show block has loaded\n let event = new CustomEvent(\"ajax:success\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n })\n .catch(err => {\n el.replaceWith(\"Sorry, this content failed to load\");\n\n let event = new CustomEvent(\"ajax:error\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n })\n .finally(() => {\n let event = new CustomEvent(\"ajax:complete\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n });\n }\n}\n","import {BaseController} from \"./base_controller\";\n\nexport class AutoSubmitFormController extends BaseController {\n\n private boundHandler = this.handler.bind(this);\n\n connect() {\n (this.element as HTMLElement).querySelectorAll(\"input, select, textarea\").forEach(el => el.addEventListener(\"change\", this.boundHandler));\n }\n\n disconnect() {\n (this.element as HTMLElement).querySelectorAll(\"input, select, textarea\").forEach(el => el.removeEventListener(\"change\", this.boundHandler));\n }\n\n private handler(e: Event) {\n // this.element.submit()\n // Moved to this to support remote forms and CSRF properly\n this.element.dispatchEvent(\n new CustomEvent(\"submit\", {\n bubbles: true,\n cancelable: true,\n }),\n );\n }\n}\n","export const method = (controller, methodName) => {\n const method = controller[methodName];\n if (typeof method == 'function') {\n return method;\n }\n else {\n return (...args) => { };\n }\n};\nexport const composeEventName = (name, controller, eventPrefix) => {\n let composedName = name;\n if (eventPrefix === true) {\n composedName = `${controller.identifier}:${name}`;\n }\n else if (typeof eventPrefix === 'string') {\n composedName = `${eventPrefix}:${name}`;\n }\n return composedName;\n};\nexport const extendedEvent = (type, event, detail) => {\n const { bubbles, cancelable, composed } = event || { bubbles: true, cancelable: true, composed: true };\n if (event) {\n Object.assign(detail, { originalEvent: event });\n }\n const customEvent = new CustomEvent(type, {\n bubbles,\n cancelable,\n composed,\n detail,\n });\n return customEvent;\n};\nexport function isElementInViewport(el) {\n const rect = el.getBoundingClientRect();\n const windowHeight = (window.innerHeight || document.documentElement.clientHeight);\n const windowWidth = (window.innerWidth || document.documentElement.clientWidth);\n const vertInView = (rect.top <= windowHeight) && ((rect.top + rect.height) >= 0);\n const horInView = (rect.left <= windowWidth) && ((rect.left + rect.width) >= 0);\n return (vertInView && horInView);\n}\n//# sourceMappingURL=index.js.map","import { method, extendedEvent, composeEventName } from '../support/index';\nconst defaultOptions = {\n dispatchEvent: true,\n eventPrefix: true,\n};\nexport const useIntersection = (controller, options = {}) => {\n const { dispatchEvent, eventPrefix } = Object.assign({}, defaultOptions, options);\n const targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n const callback = (entries) => {\n const [entry] = entries;\n if (entry.isIntersecting) {\n dispatchAppear(entry);\n }\n else if (controller.isVisible) {\n dispatchDisappear(entry);\n }\n };\n const dispatchAppear = (entry) => {\n controller.isVisible = true;\n method(controller, 'appear').call(controller, entry);\n // emit a custom \"appear\" event\n if (dispatchEvent) {\n const eventName = composeEventName('appear', controller, eventPrefix);\n const appearEvent = extendedEvent(eventName, null, { controller, entry });\n targetElement.dispatchEvent(appearEvent);\n }\n };\n const dispatchDisappear = (entry) => {\n controller.isVisible = false;\n method(controller, 'disappear').call(controller, entry);\n // emit a custom \"disappear\" event\n if (dispatchEvent) {\n const eventName = composeEventName('disappear', controller, eventPrefix);\n const disappearEvent = extendedEvent(eventName, null, { controller, entry });\n targetElement.dispatchEvent(disappearEvent);\n }\n };\n // keep a copy of the current disconnect() function of the controller\n // to support composing several behaviors\n const controllerDisconnect = controller.disconnect.bind(controller);\n const observer = new IntersectionObserver(callback, options);\n const observe = () => {\n observer.observe(targetElement);\n };\n const unobserve = () => {\n observer.unobserve(targetElement);\n };\n Object.assign(controller, {\n isVisible: false,\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-intersection.js.map","import { composeEventName, extendedEvent, isElementInViewport } from '../support/index';\nconst defaultOptions = {\n events: ['click', 'touchend'],\n onlyVisible: true,\n dispatchEvent: true,\n eventPrefix: true,\n};\nexport const useClickOutside = (controller, options = {}) => {\n const { onlyVisible, dispatchEvent, events, eventPrefix } = Object.assign({}, defaultOptions, options);\n const onEvent = (event) => {\n const targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n if (targetElement.contains(event.target) || (!isElementInViewport(targetElement) && onlyVisible)) {\n return;\n }\n // call the clickOutside method of the Stimulus controller\n if (controller.clickOutside) {\n controller.clickOutside(event);\n }\n // emit a custom event\n if (dispatchEvent) {\n const eventName = composeEventName('click:outside', controller, eventPrefix);\n const clickOutsideEvent = extendedEvent(eventName, event, { controller });\n targetElement.dispatchEvent(clickOutsideEvent);\n }\n };\n const observe = () => {\n events === null || events === void 0 ? void 0 : events.forEach(event => {\n window.addEventListener(event, onEvent, false);\n });\n };\n const unobserve = () => {\n events === null || events === void 0 ? void 0 : events.forEach(event => {\n window.removeEventListener(event, onEvent, false);\n });\n };\n // keep a copy of the current disconnect() function of the controller\n // to support composing several behaviors\n const controllerDisconnect = controller.disconnect.bind(controller);\n Object.assign(controller, {\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-click-outside.js.map","const defaultOptions = {\n debug: false,\n logger: console\n};\nexport class StimulusUse {\n constructor(controller, options = {}) {\n var _a, _b, _c;\n this.log = (functionName, args) => {\n if (!this.debug)\n return;\n this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${functionName}`, 'color: #3B82F6', 'color: unset');\n this.logger.log(Object.assign({ controllerId: this.controllerId }, args));\n this.logger.groupEnd();\n };\n this.debug = (_b = (_a = options === null || options === void 0 ? void 0 : options.debug) !== null && _a !== void 0 ? _a : controller.application.stimulusUseDebug) !== null && _b !== void 0 ? _b : defaultOptions.debug;\n this.logger = (_c = options === null || options === void 0 ? void 0 : options.logger) !== null && _c !== void 0 ? _c : defaultOptions.logger;\n this.controller = controller;\n this.controllerId = controller.element.id || controller.element.dataset.id;\n // make copies of lifecycle functions\n this.controllerInitialize = controller.initialize.bind(controller);\n this.controllerConnect = controller.connect.bind(controller);\n this.controllerDisconnect = controller.disconnect.bind(controller);\n }\n}\n//# sourceMappingURL=stimulus_use.js.map","import { StimulusUse } from '../stimulus_use';\nimport { method } from '../support/index';\nexport class UseHover extends StimulusUse {\n constructor(controller, options = {}) {\n super(controller, options);\n this.observe = () => {\n this.targetElement.addEventListener('mouseenter', this.onEnter);\n this.targetElement.addEventListener('mouseleave', this.onLeave);\n };\n this.unobserve = () => {\n this.targetElement.removeEventListener('mouseenter', this.onEnter);\n this.targetElement.removeEventListener('mouseleave', this.onLeave);\n };\n this.onEnter = () => {\n method(this.controller, 'mouseEnter').call(this.controller);\n this.log('mouseEnter', { hover: true });\n };\n this.onLeave = () => {\n method(this.controller, 'mouseLeave').call(this.controller);\n this.log('mouseLeave', { hover: false });\n };\n this.targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n this.controller = controller;\n this.enhanceController();\n this.observe();\n }\n enhanceController() {\n const controllerDisconnect = this.controller.disconnect.bind(this.controller);\n const disconnect = () => {\n this.unobserve();\n controllerDisconnect();\n };\n Object.assign(this.controller, { disconnect });\n }\n}\nexport const useHover = (controller, options = {}) => {\n const observer = new UseHover(controller, options);\n return [observer.observe, observer.unobserve];\n};\n//# sourceMappingURL=use-hover.js.map","import { StimulusUse } from '../stimulus_use';\nimport { method } from '../support/index';\nexport class UseMutation extends StimulusUse {\n constructor(controller, options = {}) {\n super(controller, options);\n this.observe = () => {\n try {\n this.observer.observe(this.targetElement, this.options);\n }\n catch (error) {\n this.controller.application.handleError(error, \"At a minimum, one of childList, attributes, and/or characterData must be true\", {});\n }\n };\n this.unobserve = () => {\n this.observer.disconnect();\n };\n this.mutation = (entries) => {\n method(this.controller, 'mutate').call(this.controller, entries);\n this.log('mutate', { entries });\n };\n this.targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n this.controller = controller;\n this.options = options;\n this.observer = new MutationObserver(this.mutation);\n this.enhanceController();\n this.observe();\n }\n enhanceController() {\n const controllerDisconnect = this.controller.disconnect.bind(this.controller);\n const disconnect = () => {\n this.unobserve();\n controllerDisconnect();\n };\n Object.assign(this.controller, { disconnect });\n }\n}\nexport const useMutation = (controller, options = {}) => {\n const observer = new UseMutation(controller, options);\n return [observer.observe, observer.unobserve];\n};\n//# sourceMappingURL=use-mutation.js.map","import { method } from '../support/index';\nexport const useWindowResize = (controller) => {\n const callback = (event) => {\n const { innerWidth, innerHeight } = window;\n const payload = {\n height: innerHeight || Infinity,\n width: innerWidth || Infinity,\n event\n };\n method(controller, 'windowResize').call(controller, payload);\n };\n const controllerDisconnect = controller.disconnect.bind(controller);\n const observe = () => {\n window.addEventListener('resize', callback);\n callback();\n };\n const unobserve = () => {\n window.removeEventListener('resize', callback);\n };\n Object.assign(controller, {\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-window-resize.js.map","import { Controller } from 'stimulus';\nclass DebounceController extends Controller {\n}\nDebounceController.debounces = [];\nconst defaultWait = 200;\nconst debounce = (fn, wait = defaultWait) => {\n let timeoutId = null;\n return function () {\n const args = arguments;\n const context = this;\n const callback = () => fn.apply(context, args);\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n timeoutId = setTimeout(callback, wait);\n };\n};\nexport const useDebounce = (controller, options) => {\n var _a;\n const constructor = controller.constructor;\n (_a = constructor.debounces) === null || _a === void 0 ? void 0 : _a.forEach((func) => {\n if (typeof func === \"string\") {\n controller[func] = debounce(controller[func], options === null || options === void 0 ? void 0 : options.wait);\n }\n if (typeof func === \"object\") {\n const { name, wait } = func;\n if (!name)\n return;\n controller[name] = debounce(controller[name], wait || (options === null || options === void 0 ? void 0 : options.wait));\n }\n });\n};\n//# sourceMappingURL=use-debounce.js.map","import {useWindowResize} from \"stimulus-use\";\nimport {BaseController} from \"./base_controller\";\n\nexport class AutosizeController extends BaseController {\n\n private boundHandler = this.handler.bind(this);\n\n connect() {\n let target = this.element as HTMLTextAreaElement;\n target.style.resize = \"none\";\n target.style.boxSizing = \"border-box\";\n target.addEventListener(\"input\", this.boundHandler);\n target.addEventListener(\"focus\", this.boundHandler);\n useWindowResize(this);\n requestAnimationFrame(this.boundHandler);\n }\n\n windowResize() {\n this.handler();\n }\n\n private handler() {\n this.autosize(this.element as HTMLTextAreaElement);\n };\n\n private autosize(element: HTMLTextAreaElement) {\n let offset = element.offsetHeight - element.clientHeight;\n element.style.height = \"auto\";\n element.style.height = element.scrollHeight + offset + \"px\";\n }\n\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class CharCountController extends BaseController {\r\n\r\n static targets = [\"input\", \"output\"];\r\n static values = {min: Number, max: Number};\r\n static classes = [\"error\"];\r\n\r\n declare readonly inputTarget: HTMLInputElement | HTMLTextAreaElement;\r\n declare readonly outputTarget: HTMLElement;\r\n declare minValue: number;\r\n declare hasMinValue: boolean;\r\n declare maxValue: number;\r\n declare hasMaxValue: boolean;\r\n declare errorClass: string;\r\n declare hasErrorClass: boolean;\r\n\r\n boundHandler = this.updateCharCount.bind(this);\r\n\r\n connect() {\r\n this.updateCharCount();\r\n this.inputTarget.addEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n this.inputTarget.removeEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n updateCharCount() {\r\n let charCount = this.inputTarget.value.length;\r\n this.outputTarget.innerText = charCount.toString();\r\n if (this.hasErrorClass) {\r\n if (this.isValidCount(charCount)) {\r\n this.outputTarget.classList.remove(this.errorClass);\r\n } else {\r\n this.outputTarget.classList.add(this.errorClass);\r\n }\r\n }\r\n }\r\n\r\n isValidCount(count: number) {\r\n let min = 0;\r\n let max = 99999;\r\n\r\n if (this.hasMinValue) {\r\n min = this.minValue;\r\n }\r\n\r\n if (this.hasMaxValue) {\r\n max = this.maxValue;\r\n }\r\n\r\n return count >= min && count <= max;\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class ClipboardController extends BaseController {\r\n\r\n static targets = [\"button\", \"copy\", \"fallback\"];\r\n static values = {removeUnused: Boolean};\r\n\r\n declare readonly sourceTarget: HTMLElement;\r\n declare readonly copyTarget: HTMLElement;\r\n declare readonly hasCopyTarget: boolean;\r\n declare readonly fallbackTarget: HTMLElement;\r\n declare readonly hasFallbackTarget: boolean;\r\n\r\n declare readonly hasRemoveUnusedValue: boolean;\r\n declare readonly removeUnusedValue: boolean;\r\n\r\n supported = false;\r\n\r\n connect() {\r\n this.supported = document.queryCommandSupported(\"copy\");\r\n\r\n if (this.hasRemoveUnusedValue && this.removeUnusedValue) {\r\n if (this.supported && this.hasFallbackTarget) {\r\n this.fallbackTarget.remove();\r\n } else if (this.hasCopyTarget) {\r\n this.copyTarget.remove();\r\n }\r\n }\r\n }\r\n\r\n select(event: MouseEvent) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n (this.sourceTarget as HTMLInputElement | HTMLTextAreaElement).select();\r\n }\r\n\r\n copy(event: ClipboardEvent) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n (this.sourceTarget as HTMLInputElement | HTMLTextAreaElement).select();\r\n if (this.supported) {\r\n document.execCommand(\"copy\");\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\n\nexport class ConfirmNavigationController extends BaseController {\n\n static values = {message: String};\n\n declare readonly messageValue: string;\n\n connect() {\n let confirmMessage = this.messageValue;\n window.onbeforeunload = () => (confirmMessage == null ? true : confirmMessage);\n window.addEventListener(\"popstate\", this.handlePopstate);\n window.addEventListener(\"submit\", () => {\n window.removeEventListener(\"popstate\", this.handlePopstate);\n window.onbeforeunload = null;\n });\n // TODO: Turbo navigation events\n }\n\n handlePopstate(event: PopStateEvent) {\n return false;\n }\n\n}\n","import {BaseController} from \"./base_controller\";\n\nexport class DebugController extends BaseController {\n\n static targets = [\"test\"];\n declare testTargets: HTMLElement[];\n\n connect() {\n console.log(\"Debug Controller\", this, this.testTargets);\n }\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DetectDirtyController extends BaseController {\r\n\r\n initialValue: string | boolean | null = null;\r\n\r\n boundHandler = this.handler.bind(this);\r\n\r\n connect() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n if (this.isInputElement(element) && this.isCheckable(element)) {\r\n this.initialValue = element.checked;\r\n } else {\r\n this.initialValue = element.value;\r\n }\r\n element.addEventListener(\"input\", this.boundHandler);\r\n element.addEventListener(\"change\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n element.removeEventListener(\"input\", this.boundHandler);\r\n element.removeEventListener(\"change\", this.boundHandler);\r\n }\r\n\r\n restore() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n if (this.isInputElement(element) && this.isCheckable(element)) {\r\n element.checked = this.initialValue as boolean;\r\n } else {\r\n element.value = this.initialValue as string;\r\n }\r\n }\r\n\r\n private handler(event?: Event) {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n\r\n if (this.initialValue !== element.value) {\r\n element.setAttribute(\"data-dirty\", \"true\");\r\n } else {\r\n element.removeAttribute(\"data-dirty\");\r\n }\r\n }\r\n\r\n private isCheckable(element: HTMLInputElement): boolean {\r\n return (element.type === \"radio\" || element.type === \"checkbox\");\r\n }\r\n\r\n private isInputElement(element: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement): element is HTMLInputElement {\r\n return element.tagName === \"INPUT\";\r\n }\r\n\r\n}\r\n\r\nexport function isDirty(element: HTMLElement) {\r\n return element.hasAttribute(\"data-dirty\");\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DisableInputsController extends BaseController {\r\n\r\n static targets = [\"disabler\", \"disable\"];\r\n\r\n static values = {\r\n clear: Boolean,\r\n };\r\n\r\n declare readonly hasDisablerTarget: boolean;\r\n declare readonly disablerTarget: HTMLInputElement;\r\n declare readonly disableTargets: Array;\r\n declare readonly clearValue: boolean;\r\n declare readonly hasClearValue: boolean;\r\n\r\n connect() {\r\n this.toggle();\r\n }\r\n\r\n toggle() {\r\n if (this.hasDisablerTarget && this.disablerTarget.checked) {\r\n this.disableInputs();\r\n } else {\r\n this.enableInputs();\r\n }\r\n }\r\n\r\n disableInputs() {\r\n let shouldClear = this.hasClearValue && this.clearValue;\r\n this.disableTargets.forEach((el, _) => {\r\n if (shouldClear) {\r\n el.value = \"\";\r\n }\r\n el.disabled = true;\r\n });\r\n }\r\n\r\n enableInputs() {\r\n this.disableTargets.forEach((el, _) => {\r\n el.disabled = false;\r\n });\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DismissableController extends BaseController {\r\n\r\n\r\n dismiss() {\r\n this.element.remove();\r\n }\r\n\r\n}\r\n","import {useMutation} from \"stimulus-use\";\r\nimport {BaseController} from \"./base_controller\";\r\n\r\nexport class EmptyDomController extends BaseController {\r\n\r\n static classes = [\"empty\", \"notEmpty\"];\r\n static values = {scopeSelector: String};\r\n\r\n declare hasEmptyClass: boolean;\r\n declare emptyClass: string;\r\n declare hasNotEmptyClass: boolean;\r\n declare notEmptyClass: string;\r\n\r\n declare hasScopeSelectorValue: boolean;\r\n declare scopeSelectorValue: string;\r\n\r\n connect() {\r\n useMutation(this, {element: this.element, childList: true});\r\n this.checkEmpty();\r\n }\r\n\r\n mutate(entries: MutationRecord[]) {\r\n this.checkEmpty();\r\n }\r\n\r\n checkEmpty() {\r\n let children;\r\n if (this.hasScopeSelectorValue) {\r\n children = this.element.querySelectorAll(this.scopeSelectorValue);\r\n } else {\r\n children = this.element.children;\r\n }\r\n\r\n if (children.length === 0) {\r\n if (this.hasNotEmptyClass) {\r\n let classes = this.notEmptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.remove(klass));\r\n }\r\n if (this.hasEmptyClass) {\r\n let classes = this.emptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.add(klass));\r\n }\r\n this.element.dispatchEvent(\r\n new CustomEvent(\"dom:empty\", {\r\n bubbles: true,\r\n cancelable: true,\r\n }),\r\n );\r\n } else {\r\n if (this.hasNotEmptyClass) {\r\n let classes = this.notEmptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.add(klass));\r\n }\r\n if (this.hasEmptyClass) {\r\n let classes = this.emptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.remove(klass));\r\n }\r\n this.element.dispatchEvent(\r\n new CustomEvent(\"dom:not-empty\", {\r\n bubbles: true,\r\n cancelable: true,\r\n detail: {\r\n count: children.length,\r\n },\r\n }),\r\n );\r\n }\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class EnableInputsController extends BaseController {\r\n\r\n static targets = [\"enabler\", \"enable\"];\r\n\r\n static values = {\r\n clear: Boolean,\r\n };\r\n\r\n declare readonly hasEnablerTarget: boolean;\r\n declare readonly enablerTarget: HTMLInputElement;\r\n declare readonly enableTargets: Array;\r\n declare readonly clearValue: boolean;\r\n declare readonly hasClearValue: boolean;\r\n\r\n connect() {\r\n this.toggle();\r\n }\r\n\r\n toggle() {\r\n if (this.hasEnablerTarget && this.enablerTarget.checked) {\r\n this.enableInputs();\r\n } else {\r\n this.disableInputs();\r\n }\r\n }\r\n\r\n disableInputs() {\r\n let shouldClear = this.hasClearValue && this.clearValue;\r\n this.enableTargets.forEach((el, _) => {\r\n if (shouldClear) {\r\n el.value = \"\";\r\n }\r\n el.disabled = true;\r\n });\r\n }\r\n\r\n enableInputs() {\r\n this.enableTargets.forEach((el, _) => {\r\n el.disabled = false;\r\n });\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class FallbackImageController extends BaseController {\r\n\r\n static values = {placeholder: String};\r\n\r\n declare readonly placeholderValue: string;\r\n declare readonly hasPlaceholderValue: boolean;\r\n\r\n connect() {\r\n let element = this.element as HTMLImageElement;\r\n\r\n element.onerror = () => {\r\n if (this.hasPlaceholderValue) {\r\n element.src = this.placeholderValue;\r\n } else {\r\n element.style.display = \"none\";\r\n }\r\n };\r\n }\r\n\r\n}\r\n","import {useIntersection} from \"stimulus-use\";\nimport {IntersectionOptions} from \"stimulus-use/dist/use-intersection/use-intersection\";\nimport {AsyncBlockController} from \"./async_block_controller\";\n\nexport class LazyBlockController extends AsyncBlockController {\n\n declare observe: () => void;\n declare unobserve: () => void;\n declare options: IntersectionOptions;\n declare isVisible: boolean;\n declare disappear: () => void;\n\n connect() {\n let element = this.element;\n this.options = {element, threshold: 0.3};\n\n if (\"IntersectionObserver\" in window) {\n [this.observe, this.unobserve] = useIntersection(this, this.options);\n } else {\n // Client doesn't support intersection observer, fallback to pre-loading\n this.loadContent();\n }\n }\n\n appear(entry: IntersectionObserverEntry) {\n let element = this.element as HTMLImageElement;\n if (element.src !== \"\") {\n return;\n }\n if (entry.target === element && entry.isIntersecting) {\n this.loadContent();\n if (this.unobserve) {\n this.unobserve();\n }\n }\n }\n\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class LimitedSelectionCheckboxesController extends BaseController {\r\n\r\n static targets = [\"input\", \"error\"];\r\n static values = {max: Number, message: String};\r\n\r\n declare readonly hasErrorTarget: boolean;\r\n declare readonly errorTarget: HTMLElement;\r\n declare readonly inputTargets: HTMLInputElement[];\r\n declare readonly maxValue: number;\r\n declare readonly messageValue: string;\r\n\r\n maxSelections = 0;\r\n\r\n boundHandleInputs = this.handleInputs.bind(this);\r\n\r\n connect() {\r\n this.inputTargets.forEach((el) => el.addEventListener(\"change\", this.boundHandleInputs));\r\n }\r\n\r\n disconnect() {\r\n this.inputTargets.forEach((el) => el.removeEventListener(\"change\", this.boundHandleInputs));\r\n }\r\n\r\n handleInputs(event: Event) {\r\n let tickedInputs = this.inputTargets.reduce((previousValue, el) => el.checked ? previousValue + 1 : previousValue, 0);\r\n let target = event.target as HTMLInputElement;\r\n if (tickedInputs > this.maxSelections) {\r\n event.preventDefault();\r\n target.checked = false;\r\n target.dispatchEvent(new CustomEvent(\"change\", {bubbles: true, cancelable: true}));\r\n target.dispatchEvent(new CustomEvent(\"limited-selection:too-many\", {bubbles: true, cancelable: true, detail: {target}}));\r\n if (this.hasErrorTarget) {\r\n this.errorTarget.innerHTML = this.messageValue;\r\n }\r\n } else {\r\n target.dispatchEvent(new CustomEvent(\"limited-selection:selection\", {bubbles: true, cancelable: true, detail: {target}}));\r\n if (this.hasErrorTarget) {\r\n this.errorTarget.innerHTML = \"\";\r\n }\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class PasswordConfirmController extends BaseController {\r\n\r\n static targets = [\"password\"];\r\n static classes = [\"error\"];\r\n\r\n declare readonly passwordTargets: HTMLInputElement[];\r\n\r\n declare readonly errorClass: string;\r\n declare readonly hasErrorClass: boolean;\r\n\r\n private boundCheckPasswordsMatch = this.checkPasswordsMatch.bind(this);\r\n\r\n connect() {\r\n this.passwordTargets.forEach((el) => el.addEventListener(\"change\", this.boundCheckPasswordsMatch));\r\n }\r\n\r\n disconnect() {\r\n this.passwordTargets.forEach((el) => el.removeEventListener(\"change\", this.boundCheckPasswordsMatch));\r\n }\r\n\r\n private allPasswordsMatch() {\r\n let values = new Set(this.passwordTargets.map(el => el.value)); // Create a unique set of the password values\r\n return values.has(\"\") || values.size == 1; // If any of the passwords are still blank, or there is only one distinct password value (i.e. they all are the same)\r\n }\r\n\r\n private checkPasswordsMatch() {\r\n if (this.allPasswordsMatch()) {\r\n this.element.dispatchEvent(new CustomEvent(\"password-confirm:match\"));\r\n if (this.hasErrorClass) {\r\n this.passwordTargets.forEach(el => el.classList.remove(this.errorClass));\r\n }\r\n } else {\r\n this.element.dispatchEvent(new CustomEvent(\"password-confirm:no-match\"));\r\n if (this.hasErrorClass) {\r\n this.passwordTargets.forEach(el => el.classList.add(this.errorClass));\r\n }\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class PasswordPeekController extends BaseController {\r\n\r\n static targets = [\"password\"];\r\n\r\n declare readonly passwordTarget: HTMLInputElement;\r\n\r\n\r\n peak(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n this.passwordTarget.type = \"text\";\r\n }\r\n\r\n hide(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n this.passwordTarget.type = \"password\";\r\n }\r\n\r\n toggle(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n if (this.passwordTarget.type === \"password\") {\r\n this.peak();\r\n } else {\r\n this.hide();\r\n }\r\n }\r\n}\r\n","import {useDebounce, useWindowResize} from \"stimulus-use\";\nimport {WindowResizePayload} from \"stimulus-use/dist/use-window-resize/use-window-resize\";\nimport {BaseController} from \"./base_controller\";\n\ninterface ResponsiveIframeMessage {\n name: string,\n height: number,\n}\n\nexport class ResponsiveIframeWrapperController extends BaseController {\n\n boundMessageReceived = this.messageReceived.bind(this);\n\n connect() {\n window.addEventListener(\"message\", this.boundMessageReceived);\n }\n\n disconnect() {\n window.removeEventListener(\"message\", this.boundMessageReceived);\n }\n\n messageReceived(message: MessageEvent) {\n let data = message.data;\n if (data.hasOwnProperty(\"name\") && data.name === \"iframe-body\" && data.hasOwnProperty(\"height\")) {\n this.resize(data.height);\n }\n }\n\n resize(height: number) {\n (this.element as HTMLIFrameElement).style.height = `${height}px`;\n }\n\n}\n\nexport class ResponsiveIframeBodyController extends BaseController {\n\n static debounces = [\"postUpdate\"];\n\n declare observe: () => void;\n declare unobserve: () => void;\n\n connect() {\n // If this Window is inside a frame\n if (window.self !== window.top) {\n useWindowResize(this);\n useDebounce(this, {});\n this.postUpdate();\n } else {\n // Not an iframe\n }\n }\n\n windowResize(payload: WindowResizePayload) {\n this.postUpdate();\n };\n\n postUpdate() {\n let payload: ResponsiveIframeMessage = {name: \"iframe-body\", height: this.getHeight()};\n window.parent.postMessage(\n payload,\n \"*\",\n );\n }\n\n getHeight(): number {\n const body = document.body;\n const html = document.documentElement;\n\n // Get the largest height out of body and html's various height measurements\n return Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);\n }\n\n}\n","const smoothSupported = \"scrollBehavior\" in document.documentElement.style;\r\nlet smoothPolyfilled: boolean;\r\n\r\nexport async function scrollToElement(element: Element, {behavior = \"smooth\", block = \"start\", inline = \"nearest\"}: ScrollIntoViewOptions = {}) {\r\n if (behavior == \"smooth\" && !smoothSupported) {\r\n await polyfillSmooth();\r\n }\r\n element.scrollIntoView({behavior, block, inline});\r\n}\r\n\r\nasync function polyfillSmooth() {\r\n const {polyfill} = await import(/* webpackChunkName: \"smoothscroll-polyfill\" */ \"smoothscroll-polyfill\");\r\n if (smoothPolyfilled) {\r\n return;\r\n }\r\n smoothPolyfilled = true;\r\n polyfill();\r\n}\r\n\r\nexport function getScrollParent(node: HTMLElement | null): HTMLElement | null {\r\n if (!node) {\r\n return null;\r\n }\r\n const overflowY = getComputedStyle(node).overflowY;\r\n const isScrollable = overflowY !== \"visible\" && overflowY !== \"hidden\";\r\n\r\n if (isScrollable && node.scrollHeight >= node.clientHeight) {\r\n return node;\r\n }\r\n\r\n return getScrollParent(node.parentElement) || document.body;\r\n}\r\n","import camelCase from \"lodash.camelcase\";\r\nimport {BaseController} from \"../base_controller\";\r\n\r\nexport class EphemeralController extends BaseController {\r\n\r\n cleanupSelf() {\r\n this.cleanup(this.element as HTMLElement);\r\n }\r\n\r\n cleanup(element: HTMLElement) {\r\n element.dataset.controller = element.dataset.controller?.replaceAll(new RegExp(`(\\s|^)${this.identifier}(\\s|$)`, \"g\"), \"\") || \"\";\r\n if (element.dataset.controller == \"\") {\r\n // If there are no controllers left, remove the attribute\r\n delete element.dataset.controller;\r\n }\r\n\r\n let substringIdentifierValueRegex = new RegExp(`(\\s|^)${this.identifier}\\\\..+?(\\s|$)`, \"g\");\r\n element.dataset.target = element.dataset.target?.replaceAll(substringIdentifierValueRegex, \"\") || \"\";\r\n delete element.dataset[camelCase(`${this.identifier}-target`)];\r\n if (element.dataset.target == \"\") {\r\n // If there are no targets left, remove the attribute\r\n delete element.dataset.target;\r\n }\r\n\r\n element.dataset.action = element.dataset.target?.replaceAll(substringIdentifierValueRegex, \"\") || \"\";\r\n delete element.dataset[camelCase(`${this.identifier}-action`)];\r\n if (element.dataset.action == \"\") {\r\n // If there are no actions left, remove the attribute\r\n delete element.dataset.action;\r\n }\r\n\r\n // @ts-ignore\r\n let values = this.constructor.values;\r\n if (values) {\r\n Object.keys(values).forEach(val => delete element.dataset[camelCase(`${this.identifier}-${val}-value`)]);\r\n }\r\n\r\n // @ts-ignore\r\n let classes = this.constructor.classes;\r\n if (classes) {\r\n Object.keys(classes).forEach(val => delete element.dataset[camelCase(`${this.identifier}-${val}-class`)]);\r\n }\r\n }\r\n\r\n}\r\n","import {EphemeralController} from \"./utilities/ephemeral_controller\";\r\nimport {scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollIntoFocusController extends EphemeralController {\r\n\r\n static values = {\r\n behavior: String,\r\n block: String,\r\n inline: String,\r\n };\r\n\r\n declare behaviorValue: ScrollBehavior;\r\n declare hasBehaviorValue: boolean;\r\n declare blockValue: ScrollLogicalPosition;\r\n declare hasBlockValue: boolean;\r\n declare inlineValue: ScrollLogicalPosition;\r\n declare hasInlineValue: boolean;\r\n\r\n connect() {\r\n requestAnimationFrame(() => {\r\n // Attempt smooth scrolling, with polyfill\r\n scrollToElement(\r\n this.element,\r\n {\r\n behavior: this.hasBehaviorValue ? this.behaviorValue : \"smooth\",\r\n block: this.hasBlockValue ? this.blockValue : \"center\",\r\n inline: this.hasInlineValue ? this.inlineValue : \"center\",\r\n },\r\n ).catch(() => this.element.scrollIntoView()); // Fallback to snap-scrolling\r\n this.cleanupSelf();\r\n });\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\nimport {getScrollParent, scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollToBottomController extends BaseController {\r\n\r\n static values = {\r\n mode: String,\r\n };\r\n\r\n declare modeValue: \"nearest\" | \"document\";\r\n declare hasModeValue: boolean;\r\n\r\n\r\n scroll(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n let mode = this.hasModeValue ? this.modeValue : \"document\";\r\n let target: null | HTMLElement;\r\n if (mode == \"document\") {\r\n target = document.body;\r\n } else {\r\n target = getScrollParent(this.element as HTMLElement);\r\n }\r\n if (target == null) {\r\n return;\r\n }\r\n scrollToElement(target!, {behavior: \"smooth\", block: \"end\"}).catch(() => target!.scrollIntoView(false));\r\n }\r\n\r\n}\r\n\r\n","import {BaseController} from \"./base_controller\";\r\nimport {scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollToController extends BaseController {\r\n\r\n static values = {\r\n selector: String,\r\n behavior: String,\r\n block: String,\r\n inline: String,\r\n };\r\n\r\n declare selectorValue: string;\r\n declare behaviorValue: ScrollBehavior;\r\n declare hasBehaviorValue: boolean;\r\n declare blockValue: ScrollLogicalPosition;\r\n declare hasBlockValue: boolean;\r\n declare inlineValue: ScrollLogicalPosition;\r\n declare hasInlineValue: boolean;\r\n\r\n\r\n scroll() {\r\n let target = document.querySelector(this.selectorValue);\r\n if (!target) {\r\n console.warn(`Could not find target for '${this.selectorValue}'`);\r\n return;\r\n }\r\n\r\n scrollToElement(\r\n target!,\r\n {\r\n behavior: this.hasBehaviorValue ? this.behaviorValue : \"smooth\",\r\n block: this.hasBlockValue ? this.blockValue : \"center\",\r\n inline: this.hasInlineValue ? this.inlineValue : \"center\",\r\n },\r\n ).catch(() => target!.scrollIntoView()); // Fallback to snap-scrolling\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\nimport {getScrollParent, scrollToElement} from \"./utilities/scroll\";\n\nexport class ScrollToTopController extends BaseController {\n\n static values = {\n mode: String,\n };\n\n declare modeValue: \"nearest\" | \"document\";\n declare hasModeValue: boolean;\n\n\n scroll(event?: Event) {\n if (event) {\n event.preventDefault();\n }\n let mode = this.hasModeValue ? this.modeValue : \"document\";\n let target: null | HTMLElement;\n if (mode == \"document\") {\n target = document.body;\n } else {\n target = getScrollParent(this.element as HTMLElement);\n }\n if (target == null) {\n return;\n }\n scrollToElement(target!, {behavior: \"smooth\", block: \"start\"}).catch(() => target!.scrollIntoView(false));\n }\n\n}\n\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class SelfDestructController extends BaseController {\r\n\r\n static values = {seconds: Number};\r\n\r\n declare readonly secondsValue: number;\r\n timeout: null | ReturnType = null;\r\n\r\n connect() {\r\n requestAnimationFrame(() => {\r\n // Only start countdown on first paint\r\n this.timeout = setTimeout(() => this.element.remove(), this.secondsValue * 1000);\r\n });\r\n }\r\n\r\n disconnect() {\r\n if (this.timeout) {\r\n clearTimeout(this.timeout);\r\n }\r\n }\r\n\r\n}\r\n","import {EphemeralController} from \"./utilities/ephemeral_controller\";\r\n\r\nexport class TeleportController extends EphemeralController {\r\n\r\n static values = {target: String, insert: String, immediate: Boolean};\r\n\r\n declare readonly immediateValue: boolean;\r\n declare readonly hasImmediateValue: boolean;\r\n declare readonly targetValue: string;\r\n declare readonly hasInsertValue: boolean;\r\n declare readonly insertValue: InsertPosition | \"replaceOuter\" | \"replaceInner\" | \"prepend\" | \"append\";\r\n\r\n connect() {\r\n if (!this.hasInsertValue) {\r\n throw new Error(\"`insert` value was not specified\");\r\n }\r\n\r\n requestAnimationFrame(() => {\r\n if (this.hasImmediateValue && this.immediateValue) {\r\n this.execute();\r\n }\r\n });\r\n }\r\n\r\n execute(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n let destination = document.querySelector(this.targetValue);\r\n\r\n if (destination == null) {\r\n this.element.dispatchEvent(new CustomEvent(\"teleport:error\", {bubbles: true, cancelable: true}));\r\n return;\r\n }\r\n\r\n let copy = this.element.cloneNode(true) as HTMLElement;\r\n this.cleanup(copy);\r\n\r\n switch (this.insertValue) {\r\n case \"beforebegin\":\r\n case \"beforeend\":\r\n case \"afterend\":\r\n case \"afterbegin\":\r\n destination.insertAdjacentHTML(this.insertValue, copy.outerHTML);\r\n break;\r\n case \"replaceOuter\":\r\n destination.outerHTML = copy.outerHTML;\r\n break;\r\n case \"replaceInner\":\r\n destination.innerHTML = copy.outerHTML;\r\n break;\r\n case \"prepend\":\r\n destination.insertAdjacentHTML(\"afterbegin\", copy.outerHTML);\r\n break;\r\n case \"append\":\r\n destination.insertAdjacentHTML(\"beforeend\", copy.outerHTML);\r\n break;\r\n default:\r\n throw new Error(\"`insert` value was not specified\");\r\n\r\n }\r\n this.element.remove();\r\n }\r\n\r\n}\r\n","import {useClickOutside, useHover} from \"stimulus-use\";\nimport {BaseController} from \"./base_controller\";\n\nexport type ToggleClassMode = \"on\" | \"off\" | \"toggle\"\n\nexport class ToggleClassController extends BaseController {\n\n static targets = [\"toggle\"];\n static values = {\n class: String,\n mouseEnter: String,\n mouseLeave: String,\n clickAway: Boolean,\n initial: String,\n };\n\n declare readonly toggleTargets: HTMLElement[];\n\n declare readonly classValue: string;\n declare readonly hasClassValue: boolean;\n\n declare readonly mouseEnterValue: ToggleClassMode;\n declare readonly hasMouseEnterValue: boolean;\n\n declare readonly mouseLeaveValue: ToggleClassMode;\n declare readonly hasMouseLeaveValue: boolean;\n\n declare readonly clickAwayValue: boolean;\n declare readonly hasClickAwayValue: boolean;\n\n declare readonly initialValue: \"on\" | \"off\";\n declare readonly hasInitialValue: boolean;\n\n connect() {\n if (!this.hasClassValue) {\n throw new Error(\"data-toggle-class-class-value must not be empty\");\n }\n\n if (this.hasMouseEnterValue || this.hasMouseLeaveValue) {\n useHover(this);\n }\n\n if (this.hasClickAwayValue && this.clickAwayValue) {\n useClickOutside(this);\n }\n\n requestAnimationFrame(() => {\n if (this.hasInitialValue) {\n if (this.initialValue === \"on\") {\n this.toggleTargets.forEach((target) => this.elementOn(target));\n } else {\n this.toggleTargets.forEach((target) => this.elementOff(target));\n }\n }\n });\n }\n\n clickOutside() {\n this.toggleTargets.forEach((target) => {\n if (this.elementWasToggled(target)) {\n this.elementToggleStatus(target);\n this.elementToggle(target);\n }\n });\n }\n\n mouseEnter() {\n if (this.hasMouseEnterValue) {\n switch (this.mouseEnterValue) {\n case \"on\":\n this.on();\n break;\n case \"off\":\n this.off();\n break;\n case \"toggle\":\n this.toggle();\n break;\n }\n }\n return {};\n }\n\n mouseLeave() {\n if (this.hasMouseLeaveValue) {\n switch (this.mouseLeaveValue) {\n case \"on\":\n this.on();\n break;\n case \"off\":\n this.off();\n break;\n case \"toggle\":\n this.toggle();\n break;\n }\n }\n return {};\n }\n\n on(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementOn(target);\n });\n }\n\n off(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementOff(target);\n });\n }\n\n toggle(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementToggle(target);\n });\n }\n\n private elementWasToggled(el: HTMLElement): boolean {\n return el.dataset.toggled == \"true\";\n }\n\n private elementToggleStatus(el: HTMLElement) {\n if (this.elementWasToggled(el)) {\n delete el.dataset.toggled;\n } else {\n el.dataset.toggled = \"true\";\n }\n }\n\n private elementToggle(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass));\n }\n\n private elementOn(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass, true));\n }\n\n private elementOff(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass, false));\n }\n\n}\n","import {BaseController} from \"./base_controller\";\nimport {isHTMLLinkElement} from \"./utilities/elements\";\nimport {isTurboFrame} from \"./utilities/turbo\";\n\nexport class TurboFrameRCController extends BaseController {\n\n static values = {\n frameId: String,\n src: String,\n loadingMessage: String,\n };\n\n declare readonly frameIdValue: string;\n declare readonly srcValue: string;\n declare readonly hasSrcValue: boolean;\n declare readonly loadingMessageValue: string;\n declare readonly hasLoadingMessageValue: boolean;\n\n toggle(event?: Event | null) {\n if (event) {\n event.preventDefault();\n }\n let frame = this.getFrame();\n let frameSrc = frame.src;\n if (frameSrc == null || frameSrc !== this.getSrc()) {\n this.setSrc();\n } else {\n this.clear();\n }\n }\n\n setSrc(event?: Event | null) {\n if (event) {\n event.preventDefault();\n }\n let frame = this.getFrame();\n if (this.hasLoadingMessageValue) {\n frame.innerHTML = this.loadingMessageValue;\n }\n\n frame.src = this.getSrc();\n }\n\n clear(event?: Event | null) {\n if (event) {\n event.preventDefault();\n }\n let frame = this.getFrame();\n frame.src = \"\";\n frame.innerHTML = \"\";\n }\n\n private getFrame(): TurboFrame {\n let frame = document.getElementById(`${this.frameIdValue}`);\n if (frame == null) {\n throw new Error(`Could not find frame with ID '${this.frameIdValue}'`);\n }\n if (!isTurboFrame(frame)) {\n throw new Error(`Element targeted by ID '${this.frameIdValue}'`);\n } else {\n return frame;\n }\n }\n\n private getSrc(): string {\n let element = this.element as HTMLElement;\n if (this.hasSrcValue) {\n return this.srcValue;\n } else if (isHTMLLinkElement(element)) {\n return element.href;\n } else {\n throw new Error(\"No link given to drive frame to\");\n }\n }\n\n}\n","export function isTurboFrame(element: HTMLElement): element is TurboFrame {\r\n return element.nodeName == \"TURBO-FRAME\";\r\n}\r\n","export function isHTMLLinkElement(element: Element): element is HTMLLinkElement {\n return element.nodeName == \"A\";\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class WordCountController extends BaseController {\r\n\r\n static targets = [\"input\", \"output\"];\r\n static values = {min: Number, max: Number};\r\n static classes = [\"error\"];\r\n\r\n declare readonly inputTarget: HTMLInputElement | HTMLTextAreaElement;\r\n declare readonly outputTarget: HTMLElement;\r\n declare minValue: number;\r\n declare hasMinValue: boolean;\r\n declare maxValue: number;\r\n declare hasMaxValue: boolean;\r\n declare errorClass: string;\r\n declare hasErrorClass: boolean;\r\n\r\n boundHandler = this.updateWordCount.bind(this);\r\n\r\n connect() {\r\n this.updateWordCount();\r\n this.inputTarget.addEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n this.inputTarget.removeEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n updateWordCount() {\r\n let wordCount = 0;\r\n let textAreaValue = this.inputTarget.value;\r\n let matches = textAreaValue.match(/\\S+/g);\r\n wordCount = (matches && matches.length) || 0;\r\n this.outputTarget.innerText = wordCount.toString();\r\n if (this.hasErrorClass) {\r\n if (this.isValidCount(wordCount)) {\r\n this.outputTarget.classList.remove(this.errorClass);\r\n } else {\r\n this.outputTarget.classList.add(this.errorClass);\r\n }\r\n }\r\n }\r\n\r\n isValidCount(count: number) {\r\n let min = 0;\r\n let max = 99999;\r\n\r\n if (this.hasMinValue) {\r\n min = this.minValue;\r\n }\r\n\r\n if (this.hasMaxValue) {\r\n max = this.maxValue;\r\n }\r\n\r\n return count >= min && count <= max;\r\n }\r\n\r\n}\r\n"],"names":["BaseController","context","_this","Proxy","get","obj","prop","returnVal","Reflect","self","test","logProperty","toString","apply","target","thisArg","argArray","log","args","functionName","this","application","debug","logger","console","groupCollapsed","identifier","element","groupEnd","Controller","AsyncBlockController","connect","loadContent","el","hasReplaceTarget","replaceTarget","fetch","endpointValue","then","response","text","html","newEl","document","createElement","innerHTML","replaceWith","event","CustomEvent","detail","dispatchEvent","err","endpoint","String","AutoSubmitFormController","handler","bind","querySelectorAll","forEach","addEventListener","_this2","boundHandler","disconnect","removeEventListener","_this3","e","bubbles","cancelable","method","controller","methodName","composeEventName","name","eventPrefix","composedName","extendedEvent","type","composed","Object","assign","originalEvent","defaultOptions","events","onlyVisible","StimulusUse","[object Object]","options","_a","_b","_c","controllerId","stimulusUseDebug","id","dataset","controllerInitialize","initialize","controllerConnect","controllerDisconnect","UseHover","super","observe","targetElement","onEnter","onLeave","unobserve","call","hover","enhanceController","UseMutation","observer","error","handleError","mutation","entries","MutationObserver","useWindowResize","callback","innerWidth","innerHeight","window","payload","height","Infinity","width","debounce","fn","wait","timeoutId","arguments","clearTimeout","setTimeout","AutosizeController","style","resize","boxSizing","requestAnimationFrame","windowResize","autosize","offset","offsetHeight","clientHeight","scrollHeight","CharCountController","updateCharCount","inputTarget","charCount","value","length","outputTarget","innerText","hasErrorClass","isValidCount","classList","remove","errorClass","add","count","min","max","hasMinValue","minValue","hasMaxValue","maxValue","Number","ClipboardController","supported","queryCommandSupported","hasRemoveUnusedValue","removeUnusedValue","hasFallbackTarget","fallbackTarget","hasCopyTarget","copyTarget","select","preventDefault","sourceTarget","copy","execCommand","removeUnused","Boolean","ConfirmNavigationController","confirmMessage","messageValue","onbeforeunload","handlePopstate","message","DebugController","testTargets","DetectDirtyController","initialValue","isInputElement","isCheckable","checked","restore","setAttribute","removeAttribute","tagName","DisableInputsController","toggle","hasDisablerTarget","disablerTarget","disableInputs","enableInputs","shouldClear","hasClearValue","clearValue","disableTargets","_","disabled","clear","DismissableController","dismiss","EmptyDomController","useMutation","childList","checkEmpty","mutate","children","hasScopeSelectorValue","scopeSelectorValue","hasNotEmptyClass","notEmptyClass","split","klass","hasEmptyClass","emptyClass","scopeSelector","EnableInputsController","hasEnablerTarget","enablerTarget","enableTargets","FallbackImageController","onerror","hasPlaceholderValue","src","placeholderValue","display","placeholder","LazyBlockController","threshold","IntersectionObserver","entry","isIntersecting","isVisible","eventName","appearEvent","dispatchAppear","disappearEvent","dispatchDisappear","useIntersection","appear","LimitedSelectionCheckboxesController","handleInputs","inputTargets","boundHandleInputs","tickedInputs","reduce","previousValue","maxSelections","hasErrorTarget","errorTarget","PasswordConfirmController","checkPasswordsMatch","passwordTargets","boundCheckPasswordsMatch","allPasswordsMatch","values","Set","map","has","size","_this4","PasswordPeekController","peak","passwordTarget","hide","ResponsiveIframeWrapperController","messageReceived","boundMessageReceived","data","hasOwnProperty","ResponsiveIframeBodyController","top","constructor","debounces","func","postUpdate","getHeight","parent","postMessage","body","documentElement","Math","smoothPolyfilled","EphemeralController","cleanupSelf","cleanup","replaceAll","RegExp","substringIdentifierValueRegex","camelCase","action","keys","val","classes","scrollToElement","behavior","block","inline","scrollIntoView","smoothSupported","import","polyfill","polyfillSmooth","getScrollParent","node","overflowY","getComputedStyle","parentElement","ScrollIntoFocusController","hasBehaviorValue","behaviorValue","hasBlockValue","blockValue","hasInlineValue","inlineValue","ScrollToBottomController","scroll","hasModeValue","modeValue","mode","ScrollToController","querySelector","selectorValue","warn","selector","ScrollToTopController","SelfDestructController","timeout","secondsValue","seconds","TeleportController","hasInsertValue","Error","hasImmediateValue","immediateValue","execute","destination","targetValue","cloneNode","insertValue","insertAdjacentHTML","outerHTML","insert","immediate","ToggleClassController","hasClassValue","hasMouseEnterValue","hasMouseLeaveValue","useHover","hasClickAwayValue","clickAwayValue","onEvent","contains","rect","getBoundingClientRect","windowHeight","windowWidth","clientWidth","left","isElementInViewport","clickOutside","clickOutsideEvent","useClickOutside","hasInitialValue","toggleTargets","elementOn","elementOff","elementWasToggled","elementToggleStatus","elementToggle","mouseEnter","mouseEnterValue","on","off","mouseLeave","mouseLeaveValue","_this5","toggled","classValue","class","clickAway","initial","TurboFrameRCController","frameSrc","getFrame","getSrc","setSrc","frame","hasLoadingMessageValue","loadingMessageValue","getElementById","frameIdValue","nodeName","hasSrcValue","srcValue","isHTMLLinkElement","href","frameId","loadingMessage","WordCountController","updateWordCount","wordCount","matches","match"],"mappings":"k1BAEaA,cAEX,WAAYC,SAEV,OADAC,cAAMD,aACKE,WAAY,CACrBC,IAAK,SAACC,EAAKC,GACT,IAAIC,EAAYC,QAAQJ,IAAIC,EAAKC,GAC7BG,OACJ,GAmCR,SAAqBH,GACnB,OAAQA,GACN,IAAK,cACL,IAAK,UACL,IAAK,cACL,IAAK,aACL,IAAK,MACL,IAAK,OACL,IAAK,qBACL,IAAK,aAC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EAAM1I,KAAK8I,UAGNN,GAASC,GAAOD,GAASE,MArDK9J,GAEhC0Z,UAAU,CAAC,QAAS,UACpBA,SAAS,CAAC7P,IAAKM,OAAQL,IAAKK,QAC5BuP,UAAU,CAAC"} \ No newline at end of file +{"version":3,"file":"stimulus-library.umd.js","sources":["../src/base_controller.ts","../src/async_block_controller.ts","../src/auto_submit_form_controller.ts","../node_modules/stimulus-use/dist/support/index.js","../node_modules/stimulus-use/dist/use-intersection/use-intersection.js","../node_modules/stimulus-use/dist/use-click-outside/use-click-outside.js","../node_modules/stimulus-use/dist/stimulus_use.js","../node_modules/stimulus-use/dist/use-hover/use-hover.js","../node_modules/stimulus-use/dist/use-mutation/use-mutation.js","../node_modules/stimulus-use/dist/use-window-resize/use-window-resize.js","../node_modules/stimulus-use/dist/use-debounce/use-debounce.js","../src/autosize_controller.ts","../src/char_count_controller.ts","../src/clipboard_controller.ts","../src/confirm_navigation_controller.ts","../src/debug_controller.ts","../src/detect_dirty_controller.ts","../src/disable_inputs_controller.ts","../src/dismissable_controller.ts","../src/empty_dom_controller.ts","../src/enable_inputs_controller.ts","../src/fallback_image_controller.ts","../src/lazy_block_controller.ts","../src/limited_selection_checkboxes_controller.ts","../src/nested_form_controller.ts","../src/password_confirm_controller.ts","../src/password_peek_controller.ts","../src/responsive_iframe_controller.ts","../src/utilities/scroll.ts","../src/utilities/ephemeral_controller.ts","../src/scroll_into_focus_controller.ts","../src/scroll_to_bottom_controller.ts","../src/scroll_to_controller.ts","../src/scroll_to_top_controller.ts","../src/self_destruct_controller.ts","../src/teleport_controller.ts","../src/toggle_class_controller.ts","../src/turbo_frame_rc_controller.ts","../src/utilities/turbo.ts","../src/utilities/elements.ts","../src/word_count_controller.ts"],"sourcesContent":["import {Context, Controller} from \"stimulus\";\r\n\r\nexport class BaseController extends Controller {\r\n\r\n constructor(context: Context) {\r\n super(context);\r\n return new Proxy(this, {\r\n get: (obj, prop) => {\r\n let returnVal = Reflect.get(obj, prop);\r\n let self = this;\r\n if (logProperty(prop.toString())) {\r\n if (typeof returnVal == \"function\") {\r\n return new Proxy(returnVal, {\r\n apply(target: any, thisArg: any, argArray?: any): any {\r\n self.log(prop.toString(), {\r\n args: argArray,\r\n });\r\n return Reflect.apply(target, thisArg, argArray);\r\n },\r\n });\r\n } else {\r\n this.log(prop.toString());\r\n }\r\n }\r\n return returnVal;\r\n },\r\n });\r\n }\r\n\r\n log(functionName: string, args: {} = {}): void {\r\n // @ts-ignore\r\n if (!this.application.debug) {\r\n return;\r\n }\r\n let logger = console;\r\n logger.groupCollapsed(`%c${this.identifier} %c#${functionName}`, \"color: #3B82F6\", \"color: unset\");\r\n logger.log({\r\n element: this.element,\r\n ...args,\r\n });\r\n logger.groupEnd();\r\n }\r\n\r\n}\r\n\r\nfunction logProperty(prop: string): boolean {\r\n switch (prop) {\r\n case \"application\":\r\n case \"element\":\r\n case \"constructor\":\r\n case \"initialize\":\r\n case \"log\":\r\n case \"data\":\r\n case \"valueDescriptorMap\":\r\n case \"identifier\":\r\n return false;\r\n }\r\n\r\n if (/^.*?Target(s)?$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?Value$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?ValueChanged$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?Class$/.test(prop)) {\r\n return false;\r\n }\r\n\r\n return true;\r\n}\r\n","import {BaseController} from \"./base_controller\";\n\nexport class AsyncBlockController extends BaseController {\n static targets = [\"replace\"];\n static values = {endpoint: String};\n\n declare readonly replaceTarget: HTMLElement;\n declare readonly hasReplaceTarget: boolean;\n declare readonly endpointValue: string;\n\n\n // This is a simple controller to load a block of content when the page loads.\n // It should be used to give a quick initial response before calling out to an\n // an AJAX endpoint to do some expensive work.\n connect() {\n this.loadContent();\n }\n\n loadContent() {\n let el = (this.hasReplaceTarget ? this.replaceTarget : this.element) as HTMLElement;\n fetch(this.endpointValue)\n .then((response) => response.text())\n .then((html) => {\n let newEl = document.createElement(\"div\");\n newEl.innerHTML = html;\n el.replaceWith(newEl);\n\n // Trigger event to show block has loaded\n let event = new CustomEvent(\"ajax:success\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n })\n .catch(err => {\n el.replaceWith(\"Sorry, this content failed to load\");\n\n let event = new CustomEvent(\"ajax:error\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n })\n .finally(() => {\n let event = new CustomEvent(\"ajax:complete\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n });\n }\n}\n","import {BaseController} from \"./base_controller\";\n\nexport class AutoSubmitFormController extends BaseController {\n\n private boundHandler = this.handler.bind(this);\n\n connect() {\n (this.element as HTMLElement).querySelectorAll(\"input, select, textarea\").forEach(el => el.addEventListener(\"change\", this.boundHandler));\n }\n\n disconnect() {\n (this.element as HTMLElement).querySelectorAll(\"input, select, textarea\").forEach(el => el.removeEventListener(\"change\", this.boundHandler));\n }\n\n private handler(e: Event) {\n // this.element.submit()\n // Moved to this to support remote forms and CSRF properly\n this.element.dispatchEvent(\n new CustomEvent(\"submit\", {\n bubbles: true,\n cancelable: true,\n }),\n );\n }\n}\n","export const method = (controller, methodName) => {\n const method = controller[methodName];\n if (typeof method == 'function') {\n return method;\n }\n else {\n return (...args) => { };\n }\n};\nexport const composeEventName = (name, controller, eventPrefix) => {\n let composedName = name;\n if (eventPrefix === true) {\n composedName = `${controller.identifier}:${name}`;\n }\n else if (typeof eventPrefix === 'string') {\n composedName = `${eventPrefix}:${name}`;\n }\n return composedName;\n};\nexport const extendedEvent = (type, event, detail) => {\n const { bubbles, cancelable, composed } = event || { bubbles: true, cancelable: true, composed: true };\n if (event) {\n Object.assign(detail, { originalEvent: event });\n }\n const customEvent = new CustomEvent(type, {\n bubbles,\n cancelable,\n composed,\n detail,\n });\n return customEvent;\n};\nexport function isElementInViewport(el) {\n const rect = el.getBoundingClientRect();\n const windowHeight = (window.innerHeight || document.documentElement.clientHeight);\n const windowWidth = (window.innerWidth || document.documentElement.clientWidth);\n const vertInView = (rect.top <= windowHeight) && ((rect.top + rect.height) >= 0);\n const horInView = (rect.left <= windowWidth) && ((rect.left + rect.width) >= 0);\n return (vertInView && horInView);\n}\n//# sourceMappingURL=index.js.map","import { method, extendedEvent, composeEventName } from '../support/index';\nconst defaultOptions = {\n dispatchEvent: true,\n eventPrefix: true,\n};\nexport const useIntersection = (controller, options = {}) => {\n const { dispatchEvent, eventPrefix } = Object.assign({}, defaultOptions, options);\n const targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n const callback = (entries) => {\n const [entry] = entries;\n if (entry.isIntersecting) {\n dispatchAppear(entry);\n }\n else if (controller.isVisible) {\n dispatchDisappear(entry);\n }\n };\n const dispatchAppear = (entry) => {\n controller.isVisible = true;\n method(controller, 'appear').call(controller, entry);\n // emit a custom \"appear\" event\n if (dispatchEvent) {\n const eventName = composeEventName('appear', controller, eventPrefix);\n const appearEvent = extendedEvent(eventName, null, { controller, entry });\n targetElement.dispatchEvent(appearEvent);\n }\n };\n const dispatchDisappear = (entry) => {\n controller.isVisible = false;\n method(controller, 'disappear').call(controller, entry);\n // emit a custom \"disappear\" event\n if (dispatchEvent) {\n const eventName = composeEventName('disappear', controller, eventPrefix);\n const disappearEvent = extendedEvent(eventName, null, { controller, entry });\n targetElement.dispatchEvent(disappearEvent);\n }\n };\n // keep a copy of the current disconnect() function of the controller\n // to support composing several behaviors\n const controllerDisconnect = controller.disconnect.bind(controller);\n const observer = new IntersectionObserver(callback, options);\n const observe = () => {\n observer.observe(targetElement);\n };\n const unobserve = () => {\n observer.unobserve(targetElement);\n };\n Object.assign(controller, {\n isVisible: false,\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-intersection.js.map","import { composeEventName, extendedEvent, isElementInViewport } from '../support/index';\nconst defaultOptions = {\n events: ['click', 'touchend'],\n onlyVisible: true,\n dispatchEvent: true,\n eventPrefix: true,\n};\nexport const useClickOutside = (controller, options = {}) => {\n const { onlyVisible, dispatchEvent, events, eventPrefix } = Object.assign({}, defaultOptions, options);\n const onEvent = (event) => {\n const targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n if (targetElement.contains(event.target) || (!isElementInViewport(targetElement) && onlyVisible)) {\n return;\n }\n // call the clickOutside method of the Stimulus controller\n if (controller.clickOutside) {\n controller.clickOutside(event);\n }\n // emit a custom event\n if (dispatchEvent) {\n const eventName = composeEventName('click:outside', controller, eventPrefix);\n const clickOutsideEvent = extendedEvent(eventName, event, { controller });\n targetElement.dispatchEvent(clickOutsideEvent);\n }\n };\n const observe = () => {\n events === null || events === void 0 ? void 0 : events.forEach(event => {\n window.addEventListener(event, onEvent, false);\n });\n };\n const unobserve = () => {\n events === null || events === void 0 ? void 0 : events.forEach(event => {\n window.removeEventListener(event, onEvent, false);\n });\n };\n // keep a copy of the current disconnect() function of the controller\n // to support composing several behaviors\n const controllerDisconnect = controller.disconnect.bind(controller);\n Object.assign(controller, {\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-click-outside.js.map","const defaultOptions = {\n debug: false,\n logger: console\n};\nexport class StimulusUse {\n constructor(controller, options = {}) {\n var _a, _b, _c;\n this.log = (functionName, args) => {\n if (!this.debug)\n return;\n this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${functionName}`, 'color: #3B82F6', 'color: unset');\n this.logger.log(Object.assign({ controllerId: this.controllerId }, args));\n this.logger.groupEnd();\n };\n this.debug = (_b = (_a = options === null || options === void 0 ? void 0 : options.debug) !== null && _a !== void 0 ? _a : controller.application.stimulusUseDebug) !== null && _b !== void 0 ? _b : defaultOptions.debug;\n this.logger = (_c = options === null || options === void 0 ? void 0 : options.logger) !== null && _c !== void 0 ? _c : defaultOptions.logger;\n this.controller = controller;\n this.controllerId = controller.element.id || controller.element.dataset.id;\n // make copies of lifecycle functions\n this.controllerInitialize = controller.initialize.bind(controller);\n this.controllerConnect = controller.connect.bind(controller);\n this.controllerDisconnect = controller.disconnect.bind(controller);\n }\n}\n//# sourceMappingURL=stimulus_use.js.map","import { StimulusUse } from '../stimulus_use';\nimport { method } from '../support/index';\nexport class UseHover extends StimulusUse {\n constructor(controller, options = {}) {\n super(controller, options);\n this.observe = () => {\n this.targetElement.addEventListener('mouseenter', this.onEnter);\n this.targetElement.addEventListener('mouseleave', this.onLeave);\n };\n this.unobserve = () => {\n this.targetElement.removeEventListener('mouseenter', this.onEnter);\n this.targetElement.removeEventListener('mouseleave', this.onLeave);\n };\n this.onEnter = () => {\n method(this.controller, 'mouseEnter').call(this.controller);\n this.log('mouseEnter', { hover: true });\n };\n this.onLeave = () => {\n method(this.controller, 'mouseLeave').call(this.controller);\n this.log('mouseLeave', { hover: false });\n };\n this.targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n this.controller = controller;\n this.enhanceController();\n this.observe();\n }\n enhanceController() {\n const controllerDisconnect = this.controller.disconnect.bind(this.controller);\n const disconnect = () => {\n this.unobserve();\n controllerDisconnect();\n };\n Object.assign(this.controller, { disconnect });\n }\n}\nexport const useHover = (controller, options = {}) => {\n const observer = new UseHover(controller, options);\n return [observer.observe, observer.unobserve];\n};\n//# sourceMappingURL=use-hover.js.map","import { StimulusUse } from '../stimulus_use';\nimport { method } from '../support/index';\nexport class UseMutation extends StimulusUse {\n constructor(controller, options = {}) {\n super(controller, options);\n this.observe = () => {\n try {\n this.observer.observe(this.targetElement, this.options);\n }\n catch (error) {\n this.controller.application.handleError(error, \"At a minimum, one of childList, attributes, and/or characterData must be true\", {});\n }\n };\n this.unobserve = () => {\n this.observer.disconnect();\n };\n this.mutation = (entries) => {\n method(this.controller, 'mutate').call(this.controller, entries);\n this.log('mutate', { entries });\n };\n this.targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n this.controller = controller;\n this.options = options;\n this.observer = new MutationObserver(this.mutation);\n this.enhanceController();\n this.observe();\n }\n enhanceController() {\n const controllerDisconnect = this.controller.disconnect.bind(this.controller);\n const disconnect = () => {\n this.unobserve();\n controllerDisconnect();\n };\n Object.assign(this.controller, { disconnect });\n }\n}\nexport const useMutation = (controller, options = {}) => {\n const observer = new UseMutation(controller, options);\n return [observer.observe, observer.unobserve];\n};\n//# sourceMappingURL=use-mutation.js.map","import { method } from '../support/index';\nexport const useWindowResize = (controller) => {\n const callback = (event) => {\n const { innerWidth, innerHeight } = window;\n const payload = {\n height: innerHeight || Infinity,\n width: innerWidth || Infinity,\n event\n };\n method(controller, 'windowResize').call(controller, payload);\n };\n const controllerDisconnect = controller.disconnect.bind(controller);\n const observe = () => {\n window.addEventListener('resize', callback);\n callback();\n };\n const unobserve = () => {\n window.removeEventListener('resize', callback);\n };\n Object.assign(controller, {\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-window-resize.js.map","import { Controller } from 'stimulus';\nclass DebounceController extends Controller {\n}\nDebounceController.debounces = [];\nconst defaultWait = 200;\nconst debounce = (fn, wait = defaultWait) => {\n let timeoutId = null;\n return function () {\n const args = arguments;\n const context = this;\n const callback = () => fn.apply(context, args);\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n timeoutId = setTimeout(callback, wait);\n };\n};\nexport const useDebounce = (controller, options) => {\n var _a;\n const constructor = controller.constructor;\n (_a = constructor.debounces) === null || _a === void 0 ? void 0 : _a.forEach((func) => {\n if (typeof func === \"string\") {\n controller[func] = debounce(controller[func], options === null || options === void 0 ? void 0 : options.wait);\n }\n if (typeof func === \"object\") {\n const { name, wait } = func;\n if (!name)\n return;\n controller[name] = debounce(controller[name], wait || (options === null || options === void 0 ? void 0 : options.wait));\n }\n });\n};\n//# sourceMappingURL=use-debounce.js.map","import {useWindowResize} from \"stimulus-use\";\nimport {BaseController} from \"./base_controller\";\n\nexport class AutosizeController extends BaseController {\n\n private boundHandler = this.handler.bind(this);\n\n connect() {\n let target = this.element as HTMLTextAreaElement;\n target.style.resize = \"none\";\n target.style.boxSizing = \"border-box\";\n target.addEventListener(\"input\", this.boundHandler);\n target.addEventListener(\"focus\", this.boundHandler);\n useWindowResize(this);\n requestAnimationFrame(this.boundHandler);\n }\n\n windowResize() {\n this.handler();\n }\n\n private handler() {\n this.autosize(this.element as HTMLTextAreaElement);\n };\n\n private autosize(element: HTMLTextAreaElement) {\n let offset = element.offsetHeight - element.clientHeight;\n element.style.height = \"auto\";\n element.style.height = element.scrollHeight + offset + \"px\";\n }\n\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class CharCountController extends BaseController {\r\n\r\n static targets = [\"input\", \"output\"];\r\n static values = {min: Number, max: Number};\r\n static classes = [\"error\"];\r\n\r\n declare readonly inputTarget: HTMLInputElement | HTMLTextAreaElement;\r\n declare readonly outputTarget: HTMLElement;\r\n declare minValue: number;\r\n declare hasMinValue: boolean;\r\n declare maxValue: number;\r\n declare hasMaxValue: boolean;\r\n declare errorClass: string;\r\n declare hasErrorClass: boolean;\r\n\r\n boundHandler = this.updateCharCount.bind(this);\r\n\r\n connect() {\r\n this.updateCharCount();\r\n this.inputTarget.addEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n this.inputTarget.removeEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n updateCharCount() {\r\n let charCount = this.inputTarget.value.length;\r\n this.outputTarget.innerText = charCount.toString();\r\n if (this.hasErrorClass) {\r\n if (this.isValidCount(charCount)) {\r\n this.outputTarget.classList.remove(this.errorClass);\r\n } else {\r\n this.outputTarget.classList.add(this.errorClass);\r\n }\r\n }\r\n }\r\n\r\n isValidCount(count: number) {\r\n let min = 0;\r\n let max = 99999;\r\n\r\n if (this.hasMinValue) {\r\n min = this.minValue;\r\n }\r\n\r\n if (this.hasMaxValue) {\r\n max = this.maxValue;\r\n }\r\n\r\n return count >= min && count <= max;\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class ClipboardController extends BaseController {\r\n\r\n static targets = [\"button\", \"copy\", \"fallback\"];\r\n static values = {removeUnused: Boolean};\r\n\r\n declare readonly sourceTarget: HTMLElement;\r\n declare readonly copyTarget: HTMLElement;\r\n declare readonly hasCopyTarget: boolean;\r\n declare readonly fallbackTarget: HTMLElement;\r\n declare readonly hasFallbackTarget: boolean;\r\n\r\n declare readonly hasRemoveUnusedValue: boolean;\r\n declare readonly removeUnusedValue: boolean;\r\n\r\n supported = false;\r\n\r\n connect() {\r\n this.supported = document.queryCommandSupported(\"copy\");\r\n\r\n if (this.hasRemoveUnusedValue && this.removeUnusedValue) {\r\n if (this.supported && this.hasFallbackTarget) {\r\n this.fallbackTarget.remove();\r\n } else if (this.hasCopyTarget) {\r\n this.copyTarget.remove();\r\n }\r\n }\r\n }\r\n\r\n select(event: MouseEvent) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n (this.sourceTarget as HTMLInputElement | HTMLTextAreaElement).select();\r\n }\r\n\r\n copy(event: ClipboardEvent) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n (this.sourceTarget as HTMLInputElement | HTMLTextAreaElement).select();\r\n if (this.supported) {\r\n document.execCommand(\"copy\");\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\n\nexport class ConfirmNavigationController extends BaseController {\n\n static values = {message: String};\n\n declare readonly messageValue: string;\n\n connect() {\n let confirmMessage = this.messageValue;\n window.onbeforeunload = () => (confirmMessage == null ? true : confirmMessage);\n window.addEventListener(\"popstate\", this.handlePopstate);\n window.addEventListener(\"submit\", () => {\n window.removeEventListener(\"popstate\", this.handlePopstate);\n window.onbeforeunload = null;\n });\n // TODO: Turbo navigation events\n }\n\n handlePopstate(event: PopStateEvent) {\n return false;\n }\n\n}\n","import {BaseController} from \"./base_controller\";\n\nexport class DebugController extends BaseController {\n\n static targets = [\"test\"];\n declare testTargets: HTMLElement[];\n\n connect() {\n console.log(\"Debug Controller\", this, this.testTargets);\n }\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DetectDirtyController extends BaseController {\r\n\r\n initialValue: string | boolean | null = null;\r\n\r\n boundHandler = this.handler.bind(this);\r\n\r\n connect() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n if (this.isInputElement(element) && this.isCheckable(element)) {\r\n this.initialValue = element.checked;\r\n } else {\r\n this.initialValue = element.value;\r\n }\r\n element.addEventListener(\"input\", this.boundHandler);\r\n element.addEventListener(\"change\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n element.removeEventListener(\"input\", this.boundHandler);\r\n element.removeEventListener(\"change\", this.boundHandler);\r\n }\r\n\r\n restore() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n if (this.isInputElement(element) && this.isCheckable(element)) {\r\n element.checked = this.initialValue as boolean;\r\n } else {\r\n element.value = this.initialValue as string;\r\n }\r\n }\r\n\r\n private handler(event?: Event) {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n\r\n if (this.initialValue !== element.value) {\r\n element.setAttribute(\"data-dirty\", \"true\");\r\n } else {\r\n element.removeAttribute(\"data-dirty\");\r\n }\r\n }\r\n\r\n private isCheckable(element: HTMLInputElement): boolean {\r\n return (element.type === \"radio\" || element.type === \"checkbox\");\r\n }\r\n\r\n private isInputElement(element: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement): element is HTMLInputElement {\r\n return element.tagName === \"INPUT\";\r\n }\r\n\r\n}\r\n\r\nexport function isDirty(element: HTMLElement) {\r\n return element.hasAttribute(\"data-dirty\");\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DisableInputsController extends BaseController {\r\n\r\n static targets = [\"disabler\", \"disable\"];\r\n\r\n static values = {\r\n clear: Boolean,\r\n };\r\n\r\n declare readonly hasDisablerTarget: boolean;\r\n declare readonly disablerTarget: HTMLInputElement;\r\n declare readonly disableTargets: Array;\r\n declare readonly clearValue: boolean;\r\n declare readonly hasClearValue: boolean;\r\n\r\n connect() {\r\n this.toggle();\r\n }\r\n\r\n toggle() {\r\n if (this.hasDisablerTarget && this.disablerTarget.checked) {\r\n this.disableInputs();\r\n } else {\r\n this.enableInputs();\r\n }\r\n }\r\n\r\n disableInputs() {\r\n let shouldClear = this.hasClearValue && this.clearValue;\r\n this.disableTargets.forEach((el, _) => {\r\n if (shouldClear) {\r\n el.value = \"\";\r\n }\r\n el.disabled = true;\r\n });\r\n }\r\n\r\n enableInputs() {\r\n this.disableTargets.forEach((el, _) => {\r\n el.disabled = false;\r\n });\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DismissableController extends BaseController {\r\n\r\n\r\n dismiss() {\r\n this.element.remove();\r\n }\r\n\r\n}\r\n","import {useMutation} from \"stimulus-use\";\r\nimport {BaseController} from \"./base_controller\";\r\n\r\nexport class EmptyDomController extends BaseController {\r\n\r\n static classes = [\"empty\", \"notEmpty\"];\r\n static values = {scopeSelector: String};\r\n\r\n declare hasEmptyClass: boolean;\r\n declare emptyClass: string;\r\n declare hasNotEmptyClass: boolean;\r\n declare notEmptyClass: string;\r\n\r\n declare hasScopeSelectorValue: boolean;\r\n declare scopeSelectorValue: string;\r\n\r\n connect() {\r\n useMutation(this, {element: this.element, childList: true});\r\n this.checkEmpty();\r\n }\r\n\r\n mutate(entries: MutationRecord[]) {\r\n this.checkEmpty();\r\n }\r\n\r\n checkEmpty() {\r\n let children;\r\n if (this.hasScopeSelectorValue) {\r\n children = this.element.querySelectorAll(this.scopeSelectorValue);\r\n } else {\r\n children = this.element.children;\r\n }\r\n\r\n if (children.length === 0) {\r\n if (this.hasNotEmptyClass) {\r\n let classes = this.notEmptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.remove(klass));\r\n }\r\n if (this.hasEmptyClass) {\r\n let classes = this.emptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.add(klass));\r\n }\r\n this.element.dispatchEvent(\r\n new CustomEvent(\"dom:empty\", {\r\n bubbles: true,\r\n cancelable: true,\r\n }),\r\n );\r\n } else {\r\n if (this.hasNotEmptyClass) {\r\n let classes = this.notEmptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.add(klass));\r\n }\r\n if (this.hasEmptyClass) {\r\n let classes = this.emptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.remove(klass));\r\n }\r\n this.element.dispatchEvent(\r\n new CustomEvent(\"dom:not-empty\", {\r\n bubbles: true,\r\n cancelable: true,\r\n detail: {\r\n count: children.length,\r\n },\r\n }),\r\n );\r\n }\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class EnableInputsController extends BaseController {\r\n\r\n static targets = [\"enabler\", \"enable\"];\r\n\r\n static values = {\r\n clear: Boolean,\r\n };\r\n\r\n declare readonly hasEnablerTarget: boolean;\r\n declare readonly enablerTarget: HTMLInputElement;\r\n declare readonly enableTargets: Array;\r\n declare readonly clearValue: boolean;\r\n declare readonly hasClearValue: boolean;\r\n\r\n connect() {\r\n this.toggle();\r\n }\r\n\r\n toggle() {\r\n if (this.hasEnablerTarget && this.enablerTarget.checked) {\r\n this.enableInputs();\r\n } else {\r\n this.disableInputs();\r\n }\r\n }\r\n\r\n disableInputs() {\r\n let shouldClear = this.hasClearValue && this.clearValue;\r\n this.enableTargets.forEach((el, _) => {\r\n if (shouldClear) {\r\n el.value = \"\";\r\n }\r\n el.disabled = true;\r\n });\r\n }\r\n\r\n enableInputs() {\r\n this.enableTargets.forEach((el, _) => {\r\n el.disabled = false;\r\n });\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class FallbackImageController extends BaseController {\r\n\r\n static values = {placeholder: String};\r\n\r\n declare readonly placeholderValue: string;\r\n declare readonly hasPlaceholderValue: boolean;\r\n\r\n connect() {\r\n let element = this.element as HTMLImageElement;\r\n\r\n element.onerror = () => {\r\n if (this.hasPlaceholderValue) {\r\n element.src = this.placeholderValue;\r\n } else {\r\n element.style.display = \"none\";\r\n }\r\n };\r\n }\r\n\r\n}\r\n","import {useIntersection} from \"stimulus-use\";\nimport {IntersectionOptions} from \"stimulus-use/dist/use-intersection/use-intersection\";\nimport {AsyncBlockController} from \"./async_block_controller\";\n\nexport class LazyBlockController extends AsyncBlockController {\n\n declare observe: () => void;\n declare unobserve: () => void;\n declare options: IntersectionOptions;\n declare isVisible: boolean;\n declare disappear: () => void;\n\n connect() {\n let element = this.element;\n this.options = {element, threshold: 0.3};\n\n if (\"IntersectionObserver\" in window) {\n [this.observe, this.unobserve] = useIntersection(this, this.options);\n } else {\n // Client doesn't support intersection observer, fallback to pre-loading\n this.loadContent();\n }\n }\n\n appear(entry: IntersectionObserverEntry) {\n let element = this.element as HTMLImageElement;\n if (element.src !== \"\") {\n return;\n }\n if (entry.target === element && entry.isIntersecting) {\n this.loadContent();\n if (this.unobserve) {\n this.unobserve();\n }\n }\n }\n\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class LimitedSelectionCheckboxesController extends BaseController {\r\n\r\n static targets = [\"input\", \"error\"];\r\n static values = {max: Number, message: String};\r\n\r\n declare readonly hasErrorTarget: boolean;\r\n declare readonly errorTarget: HTMLElement;\r\n declare readonly inputTargets: HTMLInputElement[];\r\n declare readonly maxValue: number;\r\n declare readonly messageValue: string;\r\n\r\n maxSelections = 0;\r\n\r\n boundHandleInputs = this.handleInputs.bind(this);\r\n\r\n connect() {\r\n this.inputTargets.forEach((el) => el.addEventListener(\"change\", this.boundHandleInputs));\r\n }\r\n\r\n disconnect() {\r\n this.inputTargets.forEach((el) => el.removeEventListener(\"change\", this.boundHandleInputs));\r\n }\r\n\r\n handleInputs(event: Event) {\r\n let tickedInputs = this.inputTargets.reduce((previousValue, el) => el.checked ? previousValue + 1 : previousValue, 0);\r\n let target = event.target as HTMLInputElement;\r\n if (tickedInputs > this.maxSelections) {\r\n event.preventDefault();\r\n target.checked = false;\r\n target.dispatchEvent(new CustomEvent(\"change\", {bubbles: true, cancelable: true}));\r\n target.dispatchEvent(new CustomEvent(\"limited-selection:too-many\", {bubbles: true, cancelable: true, detail: {target}}));\r\n if (this.hasErrorTarget) {\r\n this.errorTarget.innerHTML = this.messageValue;\r\n }\r\n } else {\r\n target.dispatchEvent(new CustomEvent(\"limited-selection:selection\", {bubbles: true, cancelable: true, detail: {target}}));\r\n if (this.hasErrorTarget) {\r\n this.errorTarget.innerHTML = \"\";\r\n }\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class NestedFormController extends BaseController {\r\n static targets = ['target', 'template'];\r\n static values = {\r\n insertMode: String,\r\n wrapperClass: String,\r\n };\r\n\r\n declare readonly targetTarget: HTMLElement;\r\n declare readonly templateTarget: HTMLTemplateElement | HTMLScriptElement;\r\n\r\n declare readonly wrapperClassValue: string;\r\n declare readonly hasWrapperSelectorValue: boolean;\r\n declare readonly insertModeValue: InsertPosition;\r\n declare readonly hasInsertModeValue: boolean;\r\n\r\n get wrapperClass() {\r\n return this.hasWrapperSelectorValue ? this.wrapperClassValue : 'nested-fields';\r\n }\r\n\r\n get insertMode(): InsertPosition {\r\n return this.hasInsertModeValue ? this.insertModeValue : 'beforeend';\r\n }\r\n\r\n connect() {\r\n this.checkStructure();\r\n }\r\n\r\n add(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n\r\n const content = this.templateTarget.innerHTML.replace(/NEW_RECORD/g, this.generateID());\r\n this.targetTarget.insertAdjacentHTML(this.insertMode, content);\r\n }\r\n\r\n remove(event: Event) {\r\n event.preventDefault();\r\n const wrapper: HTMLElement | null = (event.target as HTMLElement).closest(this.wrapperClass);\r\n if (wrapper == null) {\r\n throw new Error(`#remove was clicked from outside of a child record. Could not find an ancestor with class ${this.wrapperClass}`);\r\n }\r\n\r\n if (wrapper.dataset.newRecord === 'true') {\r\n wrapper.remove();\r\n } else {\r\n wrapper.style.display = 'none';\r\n let destroyInput = wrapper.querySelector(\"input[name*='_destroy']\") as HTMLInputElement | null;\r\n if (destroyInput == null) {\r\n throw new Error(`Could not find a hidden input with name '_destroy'. NestedForm cannot remove an already persisted record without it.`);\r\n }\r\n\r\n destroyInput.value = \"1\";\r\n }\r\n }\r\n\r\n generateID(): string {\r\n return new Date().getTime().toString() + Math.random();\r\n }\r\n\r\n private checkStructure() {\r\n let template = this.templateTarget.innerHTML;\r\n\r\n if (template.indexOf('NEW_RECORD')) {\r\n throw new Error(\"Could not find 'NEW_RECORD' in the provided template. Please make sure you've passed `child_index: 'NEW_RECORD'` to `fields_for`\")\r\n }\r\n }\r\n}","import {BaseController} from \"./base_controller\";\r\n\r\nexport class PasswordConfirmController extends BaseController {\r\n\r\n static targets = [\"password\"];\r\n static classes = [\"error\"];\r\n\r\n declare readonly passwordTargets: HTMLInputElement[];\r\n\r\n declare readonly errorClass: string;\r\n declare readonly hasErrorClass: boolean;\r\n\r\n private boundCheckPasswordsMatch = this.checkPasswordsMatch.bind(this);\r\n\r\n connect() {\r\n this.passwordTargets.forEach((el) => el.addEventListener(\"change\", this.boundCheckPasswordsMatch));\r\n }\r\n\r\n disconnect() {\r\n this.passwordTargets.forEach((el) => el.removeEventListener(\"change\", this.boundCheckPasswordsMatch));\r\n }\r\n\r\n private allPasswordsMatch() {\r\n let values = new Set(this.passwordTargets.map(el => el.value)); // Create a unique set of the password values\r\n return values.has(\"\") || values.size == 1; // If any of the passwords are still blank, or there is only one distinct password value (i.e. they all are the same)\r\n }\r\n\r\n private checkPasswordsMatch() {\r\n if (this.allPasswordsMatch()) {\r\n this.element.dispatchEvent(new CustomEvent(\"password-confirm:match\"));\r\n if (this.hasErrorClass) {\r\n this.passwordTargets.forEach(el => el.classList.remove(this.errorClass));\r\n }\r\n } else {\r\n this.element.dispatchEvent(new CustomEvent(\"password-confirm:no-match\"));\r\n if (this.hasErrorClass) {\r\n this.passwordTargets.forEach(el => el.classList.add(this.errorClass));\r\n }\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class PasswordPeekController extends BaseController {\r\n\r\n static targets = [\"password\"];\r\n\r\n declare readonly passwordTarget: HTMLInputElement;\r\n\r\n\r\n peak(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n this.passwordTarget.type = \"text\";\r\n }\r\n\r\n hide(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n this.passwordTarget.type = \"password\";\r\n }\r\n\r\n toggle(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n if (this.passwordTarget.type === \"password\") {\r\n this.peak();\r\n } else {\r\n this.hide();\r\n }\r\n }\r\n}\r\n","import {useDebounce, useWindowResize} from \"stimulus-use\";\nimport {WindowResizePayload} from \"stimulus-use/dist/use-window-resize/use-window-resize\";\nimport {BaseController} from \"./base_controller\";\n\ninterface ResponsiveIframeMessage {\n name: string,\n height: number,\n}\n\nexport class ResponsiveIframeWrapperController extends BaseController {\n\n boundMessageReceived = this.messageReceived.bind(this);\n\n connect() {\n window.addEventListener(\"message\", this.boundMessageReceived);\n }\n\n disconnect() {\n window.removeEventListener(\"message\", this.boundMessageReceived);\n }\n\n messageReceived(message: MessageEvent) {\n let data = message.data;\n if (data.hasOwnProperty(\"name\") && data.name === \"iframe-body\" && data.hasOwnProperty(\"height\")) {\n this.resize(data.height);\n }\n }\n\n resize(height: number) {\n (this.element as HTMLIFrameElement).style.height = `${height}px`;\n }\n\n}\n\nexport class ResponsiveIframeBodyController extends BaseController {\n\n static debounces = [\"postUpdate\"];\n\n declare observe: () => void;\n declare unobserve: () => void;\n\n connect() {\n // If this Window is inside a frame\n if (window.self !== window.top) {\n useWindowResize(this);\n useDebounce(this, {});\n this.postUpdate();\n } else {\n // Not an iframe\n }\n }\n\n windowResize(payload: WindowResizePayload) {\n this.postUpdate();\n };\n\n postUpdate() {\n let payload: ResponsiveIframeMessage = {name: \"iframe-body\", height: this.getHeight()};\n window.parent.postMessage(\n payload,\n \"*\",\n );\n }\n\n getHeight(): number {\n const body = document.body;\n const html = document.documentElement;\n\n // Get the largest height out of body and html's various height measurements\n return Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);\n }\n\n}\n","const smoothSupported = \"scrollBehavior\" in document.documentElement.style;\r\nlet smoothPolyfilled: boolean;\r\n\r\nexport async function scrollToElement(element: Element, {behavior = \"smooth\", block = \"start\", inline = \"nearest\"}: ScrollIntoViewOptions = {}) {\r\n if (behavior == \"smooth\" && !smoothSupported) {\r\n await polyfillSmooth();\r\n }\r\n element.scrollIntoView({behavior, block, inline});\r\n}\r\n\r\nasync function polyfillSmooth() {\r\n const {polyfill} = await import(/* webpackChunkName: \"smoothscroll-polyfill\" */ \"smoothscroll-polyfill\");\r\n if (smoothPolyfilled) {\r\n return;\r\n }\r\n smoothPolyfilled = true;\r\n polyfill();\r\n}\r\n\r\nexport function getScrollParent(node: HTMLElement | null): HTMLElement | null {\r\n if (!node) {\r\n return null;\r\n }\r\n const overflowY = getComputedStyle(node).overflowY;\r\n const isScrollable = overflowY !== \"visible\" && overflowY !== \"hidden\";\r\n\r\n if (isScrollable && node.scrollHeight >= node.clientHeight) {\r\n return node;\r\n }\r\n\r\n return getScrollParent(node.parentElement) || document.body;\r\n}\r\n","import camelCase from \"lodash.camelcase\";\r\nimport {BaseController} from \"../base_controller\";\r\n\r\nexport class EphemeralController extends BaseController {\r\n\r\n cleanupSelf() {\r\n this.cleanup(this.element as HTMLElement);\r\n }\r\n\r\n cleanup(element: HTMLElement) {\r\n element.dataset.controller = element.dataset.controller?.replaceAll(new RegExp(`(\\s|^)${this.identifier}(\\s|$)`, \"g\"), \"\") || \"\";\r\n if (element.dataset.controller == \"\") {\r\n // If there are no controllers left, remove the attribute\r\n delete element.dataset.controller;\r\n }\r\n\r\n let substringIdentifierValueRegex = new RegExp(`(\\s|^)${this.identifier}\\\\..+?(\\s|$)`, \"g\");\r\n element.dataset.target = element.dataset.target?.replaceAll(substringIdentifierValueRegex, \"\") || \"\";\r\n delete element.dataset[camelCase(`${this.identifier}-target`)];\r\n if (element.dataset.target == \"\") {\r\n // If there are no targets left, remove the attribute\r\n delete element.dataset.target;\r\n }\r\n\r\n element.dataset.action = element.dataset.target?.replaceAll(substringIdentifierValueRegex, \"\") || \"\";\r\n delete element.dataset[camelCase(`${this.identifier}-action`)];\r\n if (element.dataset.action == \"\") {\r\n // If there are no actions left, remove the attribute\r\n delete element.dataset.action;\r\n }\r\n\r\n // @ts-ignore\r\n let values = this.constructor.values;\r\n if (values) {\r\n Object.keys(values).forEach(val => delete element.dataset[camelCase(`${this.identifier}-${val}-value`)]);\r\n }\r\n\r\n // @ts-ignore\r\n let classes = this.constructor.classes;\r\n if (classes) {\r\n Object.keys(classes).forEach(val => delete element.dataset[camelCase(`${this.identifier}-${val}-class`)]);\r\n }\r\n }\r\n\r\n}\r\n","import {EphemeralController} from \"./utilities/ephemeral_controller\";\r\nimport {scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollIntoFocusController extends EphemeralController {\r\n\r\n static values = {\r\n behavior: String,\r\n block: String,\r\n inline: String,\r\n };\r\n\r\n declare behaviorValue: ScrollBehavior;\r\n declare hasBehaviorValue: boolean;\r\n declare blockValue: ScrollLogicalPosition;\r\n declare hasBlockValue: boolean;\r\n declare inlineValue: ScrollLogicalPosition;\r\n declare hasInlineValue: boolean;\r\n\r\n connect() {\r\n requestAnimationFrame(() => {\r\n // Attempt smooth scrolling, with polyfill\r\n scrollToElement(\r\n this.element,\r\n {\r\n behavior: this.hasBehaviorValue ? this.behaviorValue : \"smooth\",\r\n block: this.hasBlockValue ? this.blockValue : \"center\",\r\n inline: this.hasInlineValue ? this.inlineValue : \"center\",\r\n },\r\n ).catch(() => this.element.scrollIntoView()); // Fallback to snap-scrolling\r\n this.cleanupSelf();\r\n });\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\nimport {getScrollParent, scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollToBottomController extends BaseController {\r\n\r\n static values = {\r\n mode: String,\r\n };\r\n\r\n declare modeValue: \"nearest\" | \"document\";\r\n declare hasModeValue: boolean;\r\n\r\n\r\n scroll(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n let mode = this.hasModeValue ? this.modeValue : \"document\";\r\n let target: null | HTMLElement;\r\n if (mode == \"document\") {\r\n target = document.body;\r\n } else {\r\n target = getScrollParent(this.element as HTMLElement);\r\n }\r\n if (target == null) {\r\n return;\r\n }\r\n scrollToElement(target!, {behavior: \"smooth\", block: \"end\"}).catch(() => target!.scrollIntoView(false));\r\n }\r\n\r\n}\r\n\r\n","import {BaseController} from \"./base_controller\";\r\nimport {scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollToController extends BaseController {\r\n\r\n static values = {\r\n selector: String,\r\n behavior: String,\r\n block: String,\r\n inline: String,\r\n };\r\n\r\n declare selectorValue: string;\r\n declare behaviorValue: ScrollBehavior;\r\n declare hasBehaviorValue: boolean;\r\n declare blockValue: ScrollLogicalPosition;\r\n declare hasBlockValue: boolean;\r\n declare inlineValue: ScrollLogicalPosition;\r\n declare hasInlineValue: boolean;\r\n\r\n\r\n scroll() {\r\n let target = document.querySelector(this.selectorValue);\r\n if (!target) {\r\n console.warn(`Could not find target for '${this.selectorValue}'`);\r\n return;\r\n }\r\n\r\n scrollToElement(\r\n target!,\r\n {\r\n behavior: this.hasBehaviorValue ? this.behaviorValue : \"smooth\",\r\n block: this.hasBlockValue ? this.blockValue : \"center\",\r\n inline: this.hasInlineValue ? this.inlineValue : \"center\",\r\n },\r\n ).catch(() => target!.scrollIntoView()); // Fallback to snap-scrolling\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\nimport {getScrollParent, scrollToElement} from \"./utilities/scroll\";\n\nexport class ScrollToTopController extends BaseController {\n\n static values = {\n mode: String,\n };\n\n declare modeValue: \"nearest\" | \"document\";\n declare hasModeValue: boolean;\n\n\n scroll(event?: Event) {\n if (event) {\n event.preventDefault();\n }\n let mode = this.hasModeValue ? this.modeValue : \"document\";\n let target: null | HTMLElement;\n if (mode == \"document\") {\n target = document.body;\n } else {\n target = getScrollParent(this.element as HTMLElement);\n }\n if (target == null) {\n return;\n }\n scrollToElement(target!, {behavior: \"smooth\", block: \"start\"}).catch(() => target!.scrollIntoView(false));\n }\n\n}\n\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class SelfDestructController extends BaseController {\r\n\r\n static values = {seconds: Number};\r\n\r\n declare readonly secondsValue: number;\r\n timeout: null | ReturnType = null;\r\n\r\n connect() {\r\n requestAnimationFrame(() => {\r\n // Only start countdown on first paint\r\n this.timeout = setTimeout(() => this.element.remove(), this.secondsValue * 1000);\r\n });\r\n }\r\n\r\n disconnect() {\r\n if (this.timeout) {\r\n clearTimeout(this.timeout);\r\n }\r\n }\r\n\r\n}\r\n","import {EphemeralController} from \"./utilities/ephemeral_controller\";\r\n\r\nexport class TeleportController extends EphemeralController {\r\n\r\n static values = {target: String, insert: String, immediate: Boolean};\r\n\r\n declare readonly immediateValue: boolean;\r\n declare readonly hasImmediateValue: boolean;\r\n declare readonly targetValue: string;\r\n declare readonly hasInsertValue: boolean;\r\n declare readonly insertValue: InsertPosition | \"replaceOuter\" | \"replaceInner\" | \"prepend\" | \"append\";\r\n\r\n connect() {\r\n if (!this.hasInsertValue) {\r\n throw new Error(\"`insert` value was not specified\");\r\n }\r\n\r\n requestAnimationFrame(() => {\r\n if (this.hasImmediateValue && this.immediateValue) {\r\n this.execute();\r\n }\r\n });\r\n }\r\n\r\n execute(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n let destination = document.querySelector(this.targetValue);\r\n\r\n if (destination == null) {\r\n this.element.dispatchEvent(new CustomEvent(\"teleport:error\", {bubbles: true, cancelable: true}));\r\n return;\r\n }\r\n\r\n let copy = this.element.cloneNode(true) as HTMLElement;\r\n this.cleanup(copy);\r\n\r\n switch (this.insertValue) {\r\n case \"beforebegin\":\r\n case \"beforeend\":\r\n case \"afterend\":\r\n case \"afterbegin\":\r\n destination.insertAdjacentHTML(this.insertValue, copy.outerHTML);\r\n break;\r\n case \"replaceOuter\":\r\n destination.outerHTML = copy.outerHTML;\r\n break;\r\n case \"replaceInner\":\r\n destination.innerHTML = copy.outerHTML;\r\n break;\r\n case \"prepend\":\r\n destination.insertAdjacentHTML(\"afterbegin\", copy.outerHTML);\r\n break;\r\n case \"append\":\r\n destination.insertAdjacentHTML(\"beforeend\", copy.outerHTML);\r\n break;\r\n default:\r\n throw new Error(\"`insert` value was not specified\");\r\n\r\n }\r\n this.element.remove();\r\n }\r\n\r\n}\r\n","import {useClickOutside, useHover} from \"stimulus-use\";\nimport {BaseController} from \"./base_controller\";\n\nexport type ToggleClassMode = \"on\" | \"off\" | \"toggle\"\n\nexport class ToggleClassController extends BaseController {\n\n static targets = [\"toggle\"];\n static values = {\n class: String,\n mouseEnter: String,\n mouseLeave: String,\n clickAway: Boolean,\n initial: String,\n };\n\n declare readonly toggleTargets: HTMLElement[];\n\n declare readonly classValue: string;\n declare readonly hasClassValue: boolean;\n\n declare readonly mouseEnterValue: ToggleClassMode;\n declare readonly hasMouseEnterValue: boolean;\n\n declare readonly mouseLeaveValue: ToggleClassMode;\n declare readonly hasMouseLeaveValue: boolean;\n\n declare readonly clickAwayValue: boolean;\n declare readonly hasClickAwayValue: boolean;\n\n declare readonly initialValue: \"on\" | \"off\";\n declare readonly hasInitialValue: boolean;\n\n connect() {\n if (!this.hasClassValue) {\n throw new Error(\"data-toggle-class-class-value must not be empty\");\n }\n\n if (this.hasMouseEnterValue || this.hasMouseLeaveValue) {\n useHover(this);\n }\n\n if (this.hasClickAwayValue && this.clickAwayValue) {\n useClickOutside(this);\n }\n\n requestAnimationFrame(() => {\n if (this.hasInitialValue) {\n if (this.initialValue === \"on\") {\n this.toggleTargets.forEach((target) => this.elementOn(target));\n } else {\n this.toggleTargets.forEach((target) => this.elementOff(target));\n }\n }\n });\n }\n\n clickOutside() {\n this.toggleTargets.forEach((target) => {\n if (this.elementWasToggled(target)) {\n this.elementToggleStatus(target);\n this.elementToggle(target);\n }\n });\n }\n\n mouseEnter() {\n if (this.hasMouseEnterValue) {\n switch (this.mouseEnterValue) {\n case \"on\":\n this.on();\n break;\n case \"off\":\n this.off();\n break;\n case \"toggle\":\n this.toggle();\n break;\n }\n }\n return {};\n }\n\n mouseLeave() {\n if (this.hasMouseLeaveValue) {\n switch (this.mouseLeaveValue) {\n case \"on\":\n this.on();\n break;\n case \"off\":\n this.off();\n break;\n case \"toggle\":\n this.toggle();\n break;\n }\n }\n return {};\n }\n\n on(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementOn(target);\n });\n }\n\n off(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementOff(target);\n });\n }\n\n toggle(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementToggle(target);\n });\n }\n\n private elementWasToggled(el: HTMLElement): boolean {\n return el.dataset.toggled == \"true\";\n }\n\n private elementToggleStatus(el: HTMLElement) {\n if (this.elementWasToggled(el)) {\n delete el.dataset.toggled;\n } else {\n el.dataset.toggled = \"true\";\n }\n }\n\n private elementToggle(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass));\n }\n\n private elementOn(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass, true));\n }\n\n private elementOff(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass, false));\n }\n\n}\n","import {BaseController} from \"./base_controller\";\nimport {isHTMLLinkElement} from \"./utilities/elements\";\nimport {isTurboFrame} from \"./utilities/turbo\";\n\nexport class TurboFrameRCController extends BaseController {\n\n static values = {\n frameId: String,\n src: String,\n loadingMessage: String,\n };\n\n declare readonly frameIdValue: string;\n declare readonly srcValue: string;\n declare readonly hasSrcValue: boolean;\n declare readonly loadingMessageValue: string;\n declare readonly hasLoadingMessageValue: boolean;\n\n toggle(event?: Event | null) {\n if (event) {\n event.preventDefault();\n }\n let frame = this.getFrame();\n let frameSrc = frame.src;\n if (frameSrc == null || frameSrc !== this.getSrc()) {\n this.setSrc();\n } else {\n this.clear();\n }\n }\n\n setSrc(event?: Event | null) {\n if (event) {\n event.preventDefault();\n }\n let frame = this.getFrame();\n if (this.hasLoadingMessageValue) {\n frame.innerHTML = this.loadingMessageValue;\n }\n\n frame.src = this.getSrc();\n }\n\n clear(event?: Event | null) {\n if (event) {\n event.preventDefault();\n }\n let frame = this.getFrame();\n frame.src = \"\";\n frame.innerHTML = \"\";\n }\n\n private getFrame(): TurboFrame {\n let frame = document.getElementById(`${this.frameIdValue}`);\n if (frame == null) {\n throw new Error(`Could not find frame with ID '${this.frameIdValue}'`);\n }\n if (!isTurboFrame(frame)) {\n throw new Error(`Element targeted by ID '${this.frameIdValue}'`);\n } else {\n return frame;\n }\n }\n\n private getSrc(): string {\n let element = this.element as HTMLElement;\n if (this.hasSrcValue) {\n return this.srcValue;\n } else if (isHTMLLinkElement(element)) {\n return element.href;\n } else {\n throw new Error(\"No link given to drive frame to\");\n }\n }\n\n}\n","export function isTurboFrame(element: HTMLElement): element is TurboFrame {\r\n return element.nodeName == \"TURBO-FRAME\";\r\n}\r\n","export function isHTMLLinkElement(element: Element): element is HTMLLinkElement {\n return element.nodeName == \"A\";\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class WordCountController extends BaseController {\r\n\r\n static targets = [\"input\", \"output\"];\r\n static values = {min: Number, max: Number};\r\n static classes = [\"error\"];\r\n\r\n declare readonly inputTarget: HTMLInputElement | HTMLTextAreaElement;\r\n declare readonly outputTarget: HTMLElement;\r\n declare minValue: number;\r\n declare hasMinValue: boolean;\r\n declare maxValue: number;\r\n declare hasMaxValue: boolean;\r\n declare errorClass: string;\r\n declare hasErrorClass: boolean;\r\n\r\n boundHandler = this.updateWordCount.bind(this);\r\n\r\n connect() {\r\n this.updateWordCount();\r\n this.inputTarget.addEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n this.inputTarget.removeEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n updateWordCount() {\r\n let wordCount = 0;\r\n let textAreaValue = this.inputTarget.value;\r\n let matches = textAreaValue.match(/\\S+/g);\r\n wordCount = (matches && matches.length) || 0;\r\n this.outputTarget.innerText = wordCount.toString();\r\n if (this.hasErrorClass) {\r\n if (this.isValidCount(wordCount)) {\r\n this.outputTarget.classList.remove(this.errorClass);\r\n } else {\r\n this.outputTarget.classList.add(this.errorClass);\r\n }\r\n }\r\n }\r\n\r\n isValidCount(count: number) {\r\n let min = 0;\r\n let max = 99999;\r\n\r\n if (this.hasMinValue) {\r\n min = this.minValue;\r\n }\r\n\r\n if (this.hasMaxValue) {\r\n max = this.maxValue;\r\n }\r\n\r\n return count >= min && count <= max;\r\n }\r\n\r\n}\r\n"],"names":["BaseController","context","_this","Proxy","get","obj","prop","returnVal","Reflect","self","test","logProperty","toString","apply","target","thisArg","argArray","log","args","functionName","this","application","debug","logger","console","groupCollapsed","identifier","element","groupEnd","Controller","AsyncBlockController","connect","loadContent","el","hasReplaceTarget","replaceTarget","fetch","endpointValue","then","response","text","html","newEl","document","createElement","innerHTML","replaceWith","event","CustomEvent","detail","dispatchEvent","err","endpoint","String","AutoSubmitFormController","handler","bind","querySelectorAll","forEach","addEventListener","_this2","boundHandler","disconnect","removeEventListener","_this3","e","bubbles","cancelable","method","controller","methodName","composeEventName","name","eventPrefix","composedName","extendedEvent","type","composed","Object","assign","originalEvent","defaultOptions","events","onlyVisible","StimulusUse","[object Object]","options","_a","_b","_c","controllerId","stimulusUseDebug","id","dataset","controllerInitialize","initialize","controllerConnect","controllerDisconnect","UseHover","super","observe","targetElement","onEnter","onLeave","unobserve","call","hover","enhanceController","UseMutation","observer","error","handleError","mutation","entries","MutationObserver","useWindowResize","callback","innerWidth","innerHeight","window","payload","height","Infinity","width","debounce","fn","wait","timeoutId","arguments","clearTimeout","setTimeout","AutosizeController","style","resize","boxSizing","requestAnimationFrame","windowResize","autosize","offset","offsetHeight","clientHeight","scrollHeight","CharCountController","updateCharCount","inputTarget","charCount","value","length","outputTarget","innerText","hasErrorClass","isValidCount","classList","remove","errorClass","add","count","min","max","hasMinValue","minValue","hasMaxValue","maxValue","Number","ClipboardController","supported","queryCommandSupported","hasRemoveUnusedValue","removeUnusedValue","hasFallbackTarget","fallbackTarget","hasCopyTarget","copyTarget","select","preventDefault","sourceTarget","copy","execCommand","removeUnused","Boolean","ConfirmNavigationController","confirmMessage","messageValue","onbeforeunload","handlePopstate","message","DebugController","testTargets","DetectDirtyController","initialValue","isInputElement","isCheckable","checked","restore","setAttribute","removeAttribute","tagName","DisableInputsController","toggle","hasDisablerTarget","disablerTarget","disableInputs","enableInputs","shouldClear","hasClearValue","clearValue","disableTargets","_","disabled","clear","DismissableController","dismiss","EmptyDomController","useMutation","childList","checkEmpty","mutate","children","hasScopeSelectorValue","scopeSelectorValue","hasNotEmptyClass","notEmptyClass","split","klass","hasEmptyClass","emptyClass","scopeSelector","EnableInputsController","hasEnablerTarget","enablerTarget","enableTargets","FallbackImageController","onerror","hasPlaceholderValue","src","placeholderValue","display","placeholder","LazyBlockController","threshold","IntersectionObserver","entry","isIntersecting","isVisible","eventName","appearEvent","dispatchAppear","disappearEvent","dispatchDisappear","useIntersection","appear","LimitedSelectionCheckboxesController","handleInputs","inputTargets","boundHandleInputs","tickedInputs","reduce","previousValue","maxSelections","hasErrorTarget","errorTarget","NestedFormController","checkStructure","content","templateTarget","replace","generateID","targetTarget","insertAdjacentHTML","insertMode","wrapper","closest","wrapperClass","Error","newRecord","destroyInput","querySelector","Date","getTime","Math","random","indexOf","hasWrapperSelectorValue","wrapperClassValue","hasInsertModeValue","insertModeValue","PasswordConfirmController","checkPasswordsMatch","passwordTargets","boundCheckPasswordsMatch","allPasswordsMatch","values","Set","map","has","size","_this4","PasswordPeekController","peak","passwordTarget","hide","ResponsiveIframeWrapperController","messageReceived","boundMessageReceived","data","hasOwnProperty","ResponsiveIframeBodyController","top","constructor","debounces","func","postUpdate","getHeight","parent","postMessage","body","documentElement","smoothPolyfilled","EphemeralController","cleanupSelf","cleanup","replaceAll","RegExp","substringIdentifierValueRegex","camelCase","action","keys","val","classes","scrollToElement","behavior","block","inline","scrollIntoView","smoothSupported","import","polyfill","polyfillSmooth","getScrollParent","node","overflowY","getComputedStyle","parentElement","ScrollIntoFocusController","hasBehaviorValue","behaviorValue","hasBlockValue","blockValue","hasInlineValue","inlineValue","ScrollToBottomController","scroll","hasModeValue","modeValue","mode","ScrollToController","selectorValue","warn","selector","ScrollToTopController","SelfDestructController","timeout","secondsValue","seconds","TeleportController","hasInsertValue","hasImmediateValue","immediateValue","execute","destination","targetValue","cloneNode","insertValue","outerHTML","insert","immediate","ToggleClassController","hasClassValue","hasMouseEnterValue","hasMouseLeaveValue","useHover","hasClickAwayValue","clickAwayValue","onEvent","contains","rect","getBoundingClientRect","windowHeight","windowWidth","clientWidth","left","isElementInViewport","clickOutside","clickOutsideEvent","useClickOutside","hasInitialValue","toggleTargets","elementOn","elementOff","elementWasToggled","elementToggleStatus","elementToggle","mouseEnter","mouseEnterValue","on","off","mouseLeave","mouseLeaveValue","_this5","toggled","classValue","class","clickAway","initial","TurboFrameRCController","frameSrc","getFrame","getSrc","setSrc","frame","hasLoadingMessageValue","loadingMessageValue","getElementById","frameIdValue","nodeName","hasSrcValue","srcValue","isHTMLLinkElement","href","frameId","loadingMessage","WordCountController","updateWordCount","wordCount","matches","match"],"mappings":"k1BAEaA,cAEX,WAAYC,SAEV,OADAC,cAAMD,aACKE,WAAY,CACrBC,IAAK,SAACC,EAAKC,GACT,IAAIC,EAAYC,QAAQJ,IAAIC,EAAKC,GAC7BG,OACJ,GAmCR,SAAqBH,GACnB,OAAQA,GACN,IAAK,cACL,IAAK,UACL,IAAK,cACL,IAAK,aACL,IAAK,MACL,IAAK,OACL,IAAK,qBACL,IAAK,aACH,SAGJ,QAAI,kBAAkBI,KAAKJ,IAG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WACN,IAAItY,EAAUP,KAAKO,QACnB,GAAIP,KAAKqZ,YACP,YAAYC,qBEnEgB/Y,GAChC,MAA2B,KAApBA,EAAQ6Y,SFmEFG,CAAkBhZ,GAC3B,OAAOA,EAAQiZ,KAEf,UAAU3J,MAAM,uCAnEsBjR,GAEnC8Z,SAAS,CACde,QAASxX,OACTqL,IAAKrL,OACLyX,eAAgBzX,YGPP0X,cAAb,wEAeiB7a,EAAK8a,gBAAgBxX,oBAftC,2BAiBEzB,QAAA,WACEX,KAAK4Z,kBACL5Z,KAAK4H,YAAYrF,iBAAiB,QAASvC,KAAKyC,iBAGlDC,WAAA,WACE1C,KAAK4H,YAAYjF,oBAAoB,QAAS3C,KAAKyC,iBAGrDmX,gBAAA,WACE,IAAIC,EAAY,EAEZC,EADgB9Z,KAAK4H,YAAYE,MACTiS,MAAM,QAElC/Z,KAAKgI,aAAaC,WADlB4R,EAAaC,GAAWA,EAAQ/R,QAAW,GACHvI,WACpCQ,KAAKkI,gBACHlI,KAAKmI,aAAa0R,GACpB7Z,KAAKgI,aAAaI,UAAUC,OAAOrI,KAAKsI,YAExCtI,KAAKgI,aAAaI,UAAUG,IAAIvI,KAAKsI,gBAK3CH,aAAA,SAAaK,GACX,IAAIC,EAAM,EACNC,EAAM,MAUV,OARI1I,KAAK2I,cACPF,EAAMzI,KAAK4I,UAGT5I,KAAK6I,cACPH,EAAM1I,KAAK8I,UAGNN,GAASC,GAAOD,GAASE,MArDK9J,GAEhC+a,UAAU,CAAC,QAAS,UACpBA,SAAS,CAAClR,IAAKM,OAAQL,IAAKK,QAC5B4Q,UAAU,CAAC"} \ No newline at end of file diff --git a/docs/_partials/no-values.md b/docs/_partials/no-values.md index fe9804b1..8578f8ef 100644 --- a/docs/_partials/no-values.md +++ b/docs/_partials/no-values.md @@ -1,3 +1,3 @@ -| Value | Type | Purpose | Default | +| Value | Type | Description | Default | | --- | --- | --- | --- | | `-` | - | - | - | diff --git a/docs/_sidebar.md b/docs/_sidebar.md index 780a0a1c..cde6c73b 100644 --- a/docs/_sidebar.md +++ b/docs/_sidebar.md @@ -16,6 +16,7 @@ ** [FallbackImageController](./controllers/fallback_image_controller.md "Stimulus Library - FallbackImageController") ** [LazyBlockController](./controllers/lazy_block_controller.md "Stimulus Library - LazyBlockController") ** [LimitedSelectionCheckboxesController](./controllers/limited_selection_checkboxes_controller.md "Stimulus Library - LimitedSelectionCheckboxesController") +** [NestedFormController](./controllers/nested_form_controller.md "Stimulus Library - NestedFormController") ** [PasswordConfirmController](./controllers/password_confirm_controller.md "Stimulus Library - PasswordConfirmController") ** [PasswordPeekController](./controllers/password_peek_controller.md "Stimulus Library - PasswordPeekController") ** [ResponsiveIFrameController](controllers/responsive_iframe_controller.md "Stimulus Library - ResponsiveIFrame") diff --git a/docs/controllers/async_block_controller.md b/docs/controllers/async_block_controller.md index 8a6420c5..e977764e 100644 --- a/docs/controllers/async_block_controller.md +++ b/docs/controllers/async_block_controller.md @@ -30,7 +30,7 @@ AJAX load heavy content after the initial page load, while showing a placeholder #### [Values](https://stimulus.hotwire.dev/reference/values) -| Value | Type | Purpose | Default | +| Value | Type | Description | Default | | --- | --- | --- | --- | | `endpoint` | String | The URL to fetch content from | - | diff --git a/docs/controllers/char_count_controller.md b/docs/controllers/char_count_controller.md index 04159e7e..4dfce9a9 100644 --- a/docs/controllers/char_count_controller.md +++ b/docs/controllers/char_count_controller.md @@ -33,7 +33,7 @@ Add a visual count of the number of characters in a textarea/string input, with #### [Values](https://stimulus.hotwire.dev/reference/values) -| Value | Type | Purpose | Default | +| Value | Type | Description | Default | | --- | --- | --- | --- | | `min` | Number | The minimum number of character. This will add an `error` class (See: Classes) to the input if the min character are not met | 0 | | `max` | Number | The maximum number of character. This will add an `error` class (See: Classes) to the input if the max character are exceeded | 99,999 | diff --git a/docs/controllers/clipboard_controller.md b/docs/controllers/clipboard_controller.md index b95cbfad..8cb78e35 100644 --- a/docs/controllers/clipboard_controller.md +++ b/docs/controllers/clipboard_controller.md @@ -41,7 +41,7 @@ You can also wire up the controller to have a copy button, and an optional fallb #### [Values](https://stimulus.hotwire.dev/reference/values) -| Value | Type | Purpose | Default | +| Value | Type | Description | Default | | --- | --- | --- | --- | | `removeUnusedValue` | Boolean | If `copy` is not supported by the browser, remove the `copy` target from the DOM. Otherwise remove the `fallback` target | false | diff --git a/docs/controllers/confirm_navigation_controller.md b/docs/controllers/confirm_navigation_controller.md index dc03d0ba..2eb1d52c 100644 --- a/docs/controllers/confirm_navigation_controller.md +++ b/docs/controllers/confirm_navigation_controller.md @@ -28,7 +28,7 @@ Alert the user when they try to navigate away from a page that might have unsave #### [Values](https://stimulus.hotwire.dev/reference/values) -| Value | Type | Purpose | Default | +| Value | Type | Description | Default | | --- | --- | --- | --- | | `message` | String | The message to show to the user (if supported by the browser) | The native browser `are you sure?` dialogue | diff --git a/docs/controllers/disable_inputs_controller.md b/docs/controllers/disable_inputs_controller.md index cf0701ed..5bd08b92 100644 --- a/docs/controllers/disable_inputs_controller.md +++ b/docs/controllers/disable_inputs_controller.md @@ -28,7 +28,7 @@ Disable other inputs if a checkbox is ticked. #### [Values](https://stimulus.hotwire.dev/reference/values) -| Value | Type | Purpose | Default | +| Value | Type | Description | Default | | --- | --- | --- | --- | | `clear` | Boolean | Whether the controller should clear the targeted inputs when they become disabled | false | diff --git a/docs/controllers/empty_dom_controller.md b/docs/controllers/empty_dom_controller.md index d3f66433..793a7dc9 100644 --- a/docs/controllers/empty_dom_controller.md +++ b/docs/controllers/empty_dom_controller.md @@ -33,7 +33,7 @@ You can then style the controller, or show a nice placeholder when the container #### [Values](https://stimulus.hotwire.dev/reference/values) -| Value | Type | Purpose | Default | +| Value | Type | Description | Default | | --- | --- | --- | --- | | `scopeSelector` (Optional) | String | A CSS selector to pass to `querySelectorAll` to limit what elements are included in the count of empty/not-empty | All child elements of controller element | diff --git a/docs/controllers/enable_inputs_controller.md b/docs/controllers/enable_inputs_controller.md index b8216f0d..b70cea05 100644 --- a/docs/controllers/enable_inputs_controller.md +++ b/docs/controllers/enable_inputs_controller.md @@ -28,7 +28,7 @@ Enable other inputs if a checkbox is ticked. #### [Values](https://stimulus.hotwire.dev/reference/values) -| Value | Type | Purpose | Default | +| Value | Type | Description | Default | | --- | --- | --- | --- | | `clear` | Boolean | Whether the controller should clear the targeted inputs when they become disabled | false | diff --git a/docs/controllers/lazy_block_controller.md b/docs/controllers/lazy_block_controller.md index 921bfc15..06b91223 100644 --- a/docs/controllers/lazy_block_controller.md +++ b/docs/controllers/lazy_block_controller.md @@ -30,7 +30,7 @@ AJAX load content, only when it comes into view, while showing a placeholder. #### [Values](https://stimulus.hotwire.dev/reference/values) -| Value | Type | Purpose | Default | +| Value | Type | Description | Default | | --- | --- | --- | --- | | `endpoint` | String | The URL to fetch content from | - | diff --git a/docs/controllers/limited_selection_checkboxes_controller.md b/docs/controllers/limited_selection_checkboxes_controller.md index 64d9eb70..c7c98785 100644 --- a/docs/controllers/limited_selection_checkboxes_controller.md +++ b/docs/controllers/limited_selection_checkboxes_controller.md @@ -31,7 +31,7 @@ To only allow a user to select a limited number of checkboxes #### [Values](https://stimulus.hotwire.dev/reference/values) -| Value | Type | Purpose | Default | +| Value | Type | Description | Default | | --- | --- | --- | --- | | `max` | Number | The maximum number of checkboxes that can be checked | - | | `message` (Optional) | String | The error message to show when the user selects too many checkboxes | - | diff --git a/docs/controllers/nested_form_controller.md b/docs/controllers/nested_form_controller.md new file mode 100644 index 00000000..db15c55e --- /dev/null +++ b/docs/controllers/nested_form_controller.md @@ -0,0 +1,79 @@ +# NestedFormController + +## Purpose + +Primarily for Rails `accepts_nested_attributes_for` associations, enabling a form interface that allows a user to added and remove sub-records. + + + +## ** Actions ** + +#### [Actions](https://stimulus.hotwire.dev/reference/actions) + +| Action | Purpose | +| --- | --- | +| `add` | Add a new record to the form using the given template | +| `remove` | Remove the nearest parent record from the form. If the record is a new record, just removes it from the DOm, otherwise looks for a hidden input with `name="_destroy"` sets it to `1` (true) and hides the record using `display: none`| + +## ** Targets ** + +#### [Targets](https://stimulus.hotwire.dev/reference/targets) + +| Target | Purpose | Default | +| --- | --- | --- | +| `template` | The `