stimulus-library 0.7.2 → 0.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/controllers/signal/events.d.ts +1 -0
- package/dist/controllers/signal/events.d.ts.map +1 -1
- package/dist/stimulus-library.cjs.js +1 -1
- package/dist/stimulus-library.cjs.js.map +1 -1
- package/dist/stimulus-library.es.js +5 -2
- package/dist/stimulus-library.es.js.map +1 -1
- package/dist/stimulus-library.umd.js +1 -1
- package/dist/stimulus-library.umd.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.7.3](https://github.com/Sub-Xaero/stimulus-library/compare/v0.7.2...v0.7.3) (2022-02-16)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **SignalVisibilityController:** New hide/show events added in 0.7.2 should have included the nameValue. Now fixed. ([00dd27b](https://github.com/Sub-Xaero/stimulus-library/commit/00dd27b79a62032c286d16ddff9494c4585963e1))
|
|
11
|
+
|
|
5
12
|
### [0.7.2](https://github.com/Sub-Xaero/stimulus-library/compare/v0.7.1...v0.7.2) (2022-02-16)
|
|
6
13
|
|
|
7
14
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare function signalEventName(name: string, type: string): string;
|
|
2
2
|
export declare function signalConnectEvent(name: string): string;
|
|
3
3
|
export declare function signalValueEvent(name: string): string;
|
|
4
|
+
export declare function signalVisibilityEvent(name: string, action: "hide" | "show"): string;
|
|
4
5
|
//# sourceMappingURL=events.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../src/controllers/signal/events.ts"],"names":[],"mappings":"AAAA,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAElE;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAErD"}
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../src/controllers/signal/events.ts"],"names":[],"mappings":"AAAA,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAElE;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAEnF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var hs=Object.defineProperty;var Re=Object.getOwnPropertySymbols;var cs=Object.prototype.hasOwnProperty,ds=Object.prototype.propertyIsEnumerable;var se=(t,e,s)=>e in t?hs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,ie=(t,e)=>{for(var s in e||(e={}))cs.call(e,s)&&se(t,s,e[s]);if(Re)for(var s of Re(e))ds.call(e,s)&&se(t,s,e[s]);return t};var n=(t,e,s)=>(se(t,typeof e!="symbol"?e+"":e,s),s);Object.defineProperty(exports,"__esModule",{value:!0});exports[Symbol.toStringTag]="Module";var ms=require("stimulus"),p=require("lodash-es"),w=require("date-fns");function fs(t){if(t&&t.__esModule)return t;var e={__proto__:null,[Symbol.toStringTag]:"Module"};return t&&Object.keys(t).forEach(function(s){if(s!=="default"){var i=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:function(){return t[s]}})}}),e.default=t,Object.freeze(e)}function gs(t){switch(t){case"application":case"el":case"element":case"constructor":case"initialize":case"log":case"logEvent":case"dispatch":case"data":case"valueDescriptorMap":case"mutate":case"identifier":return!1}return!(/^_.*?$/.test(t)||/^.*?Target(s)?$/.test(t)||/^.*?Value$/.test(t)||/^.*?ValueChanged$/.test(t)||/^.*?Class$/.test(t)||/^.*?Classes$/.test(t)||/^.*?ClassesPresent$/.test(t))}function qe(t,e,s={}){if(!t.application.debug)return;let i=console;i.groupCollapsed(...N(t.identifier,"#3B82F6"),`#${e}`),i.log(ie({element:t.element,controller:t},s)),i.groupEnd()}function Pe(t,e,s={}){if(!t.application.debug)return;let i=console;i.groupCollapsed(...N(t.identifier,"#F39B1AFF"),`!! ${e} !!`),i.warn(ie({element:t.element,controller:t},s)),i.groupEnd()}function ps(t,e,s,i){if(!t.application.debug)return;let r=console;r.groupCollapsed(...$e([{text:t.identifier,color:"#3B82F6"},{text:e,color:"#0be000"}]),s.detail),r.log(...N("Dispatched on","#3b82f6"),i),r.log(...N("event","#3b82f6"),s),r.log(...N("event details","#3b82f6"),s.detail),r.groupEnd()}function N(t,e){return $e([{text:t,color:e}])}function $e(t){let e="",s=t.flatMap(i=>(e+=`%c${i.text}%c `,[`color: ${i.color}`,"color: unset"]));return[e,...s]}function re(t,e,s,i={}){let r=Object.assign({},{bubbles:!0,cancelable:!0,detail:{target:e}},i);r.detail.target||(r.detail.target=e);let a=new CustomEvent(s,r);ps(t,s,a,e),e.dispatchEvent(a)}class u extends ms.Controller{constructor(e){super(e);return this.application.debug?new Proxy(this,{get:(s,i)=>{let r=Reflect.get(s,i),a=this;if("logFormattedMessage"in this.application)return r;if(gs(i.toString())){if(typeof r=="function")return new Proxy(r,{apply(l,h,o){return qe(a,i.toString(),{args:o}),Reflect.apply(l,h,o)}});qe(this,i.toString())}return r}}):this}get el(){return this.element}get isTurboPreview(){return document.documentElement.hasAttribute("data-turbo-preview")||document.documentElement.hasAttribute("data-turbolinks-preview")}get isTurbolinksPreview(){return this.isTurboPreview}get csrfToken(){return this.metaValue("csrf-token")}metaValue(e){const s=document.head.querySelector(`meta[name="${e}"]`);return(s==null?void 0:s.getAttribute("content"))||null}dispatchEvent(e,s,i={}){re(this,e,s,i)}}class $ extends u{_cleanupSelf(){this.cleanup(this.el)}cleanup(e){var a,l,h;e.dataset.controller=((a=e.dataset.controller)==null?void 0:a.replaceAll(new RegExp(`(\\s|^)${this.identifier}(\\s|$)`,"g"),""))||"",e.dataset.controller==""&&delete e.dataset.controller;let s=new RegExp(`(\\s|^)${this.identifier}\\..+?(\\s|$)`,"g");e.dataset.target=((l=e.dataset.target)==null?void 0:l.replaceAll(s,""))||"",delete e.dataset[p.camelCase(`${this.identifier}-target`)],e.dataset.target==""&&delete e.dataset.target,e.dataset.action=((h=e.dataset.target)==null?void 0:h.replaceAll(s,""))||"",delete e.dataset[p.camelCase(`${this.identifier}-action`)],e.dataset.action==""&&delete e.dataset.action;let i=this.constructor.values;i&&Object.keys(i).forEach(o=>delete e.dataset[p.camelCase(`${this.identifier}-${o}-value`)]);let r=this.constructor.classes;r&&Object.keys(r).forEach(o=>delete e.dataset[p.camelCase(`${this.identifier}-${o}-class`)])}}const T="scrollBehavior"in document.documentElement.style;let ze;async function x(t,{behavior:e="smooth",block:s="start",inline:i="nearest"}={}){e=="smooth"&&!T&&await C(),t.scrollIntoView({behavior:e,block:s,inline:i})}async function ae(t,{behavior:e="smooth"}={}){e=="smooth"&&!T&&await C(),t.scrollTo({top:0,left:0,behavior:e})}async function ne(t,{behavior:e="smooth"}={}){e=="smooth"&&!T&&await C(),t==window?t.scrollTo({top:document.body.scrollHeight,left:0,behavior:e}):t.scrollTo({top:t.scrollHeight,left:0,behavior:e})}async function le(t,{behavior:e="smooth"}={}){e=="smooth"&&!T&&await C(),t.scrollTo({left:0,behavior:e})}async function _s(t,{behavior:e="smooth"}={}){e=="smooth"&&!T&&await C(),t==window?t.scrollTo({left:document.body.scrollWidth,behavior:e}):t.scrollTo({left:t.scrollWidth,behavior:e})}async function Ue(t,e,{behavior:s="smooth"}={}){s=="smooth"&&!T&&await C(),t.scrollBy({top:-e,left:0,behavior:s})}async function je(t,e,{behavior:s="smooth"}={}){s=="smooth"&&!T&&await C(),t.scrollBy({top:e,left:0,behavior:s})}async function We(t,e,{behavior:s="smooth"}={}){s=="smooth"&&!T&&await C(),t.scrollBy({top:0,left:-e,behavior:s})}async function Ke(t,e,{behavior:s="smooth"}={}){s=="smooth"&&!T&&await C(),t.scrollBy({top:0,left:e,behavior:s})}async function C(){const{polyfill:t}=await Promise.resolve().then(function(){return fs(require("smoothscroll-polyfill"))});ze||(ze=!0,t())}function z(t){if(!t)return null;if(t==document.body)return window;const e=getComputedStyle(t).overflowY;return e!=="visible"&&e!=="hidden"&&t.scrollHeight>=t.clientHeight?t:z(t.parentElement)||document.body}function oe(t){return t.nodeName=="TURBO-FRAME"}function bs(t){return{all:t=t||new Map,on:function(e,s){var i=t.get(e);i?i.push(s):t.set(e,[s])},off:function(e,s){var i=t.get(e);i&&(s?i.splice(i.indexOf(s)>>>0,1):t.set(e,[]))},emit:function(e,s){var i=t.get(e);i&&i.slice().map(function(r){r(s)}),(i=t.get("*"))&&i.slice().map(function(r){r(e,s)})}}}const S=bs();function vs(t){return t.nodeName=="LINK"}function ue(t){return t.nodeName=="A"}function he(t){return t.nodeName=="FORM"}function _(t){return t.nodeName=="INPUT"}function ws(t){return t.nodeName=="LABEL"}function U(t){return t.nodeName=="TEXTAREA"}function ys(t){return t.nodeName=="BUTTON"}function A(t){return t.nodeName=="SELECT"}function Es(t){return t.nodeName=="IMG"}function Ts(t){return t.nodeName=="INPUT"&&t.type=="button"}function Ge(t){return t.nodeName=="INPUT"&&t.type=="submit"}function Je(t){return t.nodeName=="INPUT"&&t.type=="reset"}function Xe(t){return t.nodeName=="BUTTON"&&t.type=="button"}function Ye(t){return t.nodeName=="BUTTON"&&t.type=="submit"}function Ze(t){return t.nodeName=="BUTTON"&&t.type=="reset"}function Qe(t){return Ze(t)||Je(t)}function et(t){return Ye(t)||Ge(t)}function j(t){return Qe(t)||et(t)||Xe(t)}function V(t){return _(t)&&(t.type==="radio"||t.type==="checkbox")}function tt(t){return _(t)||A(t)||U(t)}function st(t){let e=document.createElement("button");return e.type=t,e.style.display="none",e.dataset.sythentic="true",e}function it(t,e){let s=document.createElement("input");return s.type="hidden",s.name=t,s.value=e,s}function ce(t,e,s){let i=t.insertAdjacentElement(e,s);if(!i)throw new Error(`Failed to insert element ${s.nodeName} into ${t.nodeName}`);return i}function Cs(t,e,s,i){return ce(s,i,it(t,e))}function de(t,e,s){return ce(e,s,st(t))}function me(t){let e=t.form||document;return Array.from(e.querySelectorAll(`input[type="radio"][name="${t.name}"]`))}function fe(t){return me(t).filter(e=>e!==t)}function rt(t){const e=t.getBoundingClientRect(),s=window.innerHeight||document.documentElement.clientHeight,i=window.innerWidth||document.documentElement.clientWidth,r=e.top<=s&&e.top+e.height>=0,a=e.left<=i&&e.left+e.width>=0;return r&&a}function ge(t){if(t.requestSubmit)t.requestSubmit();else{let e=t.querySelector('button[type="submit"]');e||(e=de("submit",t,"beforeend")),e.click()}}function at(t){let e=t.querySelector('button[type="reset"]');e||(e=de("reset",t,"beforeend")),e.click()}function nt(t){return Array.isArray(t)?t:[t]}function v(t,e,s){const i=t.disconnect.bind(t);return e(),Object.assign(t,{disconnect(){s(),i()}}),i}function c(t,e,s,i,r){(r==null?void 0:r.debounce)?(i=p.debounce(i.bind(t),r.debounce),delete r.debounce):i=i.bind(t);let a=nt(s),l=()=>a.forEach(o=>e.addEventListener(o,i,r)),h=()=>a.forEach(o=>e.removeEventListener(o,i));return v(t,l,h),{setup:l,teardown:h}}function lt(t,e,s,i,r){return c(t,e,s,i,r)}function k(t,e,s,i,r){let a=[];return e.forEach(l=>{let{setup:h,teardown:o}=c(t,l,s,i,r);a.push({setup:h,teardown:o})}),[()=>a.forEach(l=>l.setup()),()=>a.forEach(l=>l.teardown())]}function Ss(t,e,s,i,r){return k(t,e,s,i,r)}function ot(t,e){let s=e||document.documentElement,i=document.fullscreenElement!==null;const r=()=>i=document.fullscreenElement!==null,a=()=>i,l=async()=>i?await d():await f();let h=()=>document.addEventListener("fullscreenchange",r),o=()=>document.removeEventListener("fullscreenchange",r);const d=async()=>{document.exitFullscreen&&(i=!1,await document.exitFullscreen())},f=async()=>{i&&await d(),s.requestFullscreen&&(await s.requestFullscreen(),i=!0)};return v(t,h,o),{isFullscreen:a,enter:f,exit:d,toggle:l,teardown:o}}function W(t){if(t===null||typeof t!="object")return t;for(const e in t)Object.getOwnPropertyDescriptor(t,e)!=null&&(t[e]=W(t[e]));return new Proxy(t,{get(e,s){return e[s]},set(e,s,i){return e[s]=W(i),!0}})}function Vs(t,e={},s,i){s&&(s=s.bind(t)),i&&(i=i.bind(t));const{enableHighAccuracy:r=!0,maximumAge:a=3e4,timeout:l=27e3}=e,h=navigator&&"geolocation"in navigator,o=W({locatedAt:null,error:null,coords:{accuracy:0,latitude:1/0,longitude:1/0,altitude:null,altitudeAccuracy:null,heading:null,speed:null},teardown:()=>{f&&(navigator.geolocation.clearWatch(f),f=null)}});let d=()=>{h&&(f=navigator.geolocation.watchPosition(g=>{o.locatedAt=g.timestamp,o.coords=g.coords,o.error=null,s&&s(g)},g=>{o.error=g,i&&i(g)},{enableHighAccuracy:r,maximumAge:a,timeout:l}))},f=null;return v(t,d,o.teardown),o}function pe(t,e,s,i,r={}){let a=Array.from(i.childNodes),l=()=>{let o=e.parentElement;if(["beforebegin","afterend"].includes(s)&&o==null)throw new Error("Cannot insert beforebegin into a node with no parent");switch(s){case"beforeend":e.append(i);break;case"afterbegin":e.prepend(i);break;case"beforebegin":o.insertBefore(i,e);break;case"afterend":o.insertBefore(i,e);break}},h=r.cleanup?()=>a.forEach(o=>o.remove()):()=>{};return v(t,l,h),[a,h]}function xs(t,e,s,i,r={}){const a=document.createRange().createContextualFragment(i);return pe(t,e,s,a,r)}function ut(t,e,s,i,r={}){const a=new DocumentFragment;a.append(i);let[l,h]=pe(t,e,s,a,r);return[l[0],h]}function H(t,e,s){e=e.bind(t);let i=null,r=()=>i=setInterval(e,s),a=()=>{i!==null&&clearInterval(i)};return v(t,r,a),a}const ht={boolean:{deserialize:t=>t==="true",serialize:t=>String(t),isEmpty:t=>t===""||t===null},object:{deserialize:t=>JSON.parse(t),serialize:t=>JSON.stringify(t),isEmpty:t=>{const e=Object.values(JSON.parse(t));return e.length===0||e.every(s=>s===""||s===null)}},number:{deserialize:t=>Number.parseFloat(t),serialize:t=>String(t),isEmpty:t=>t===""||t===null},any:{deserialize:t=>t,serialize:t=>String(t),isEmpty:t=>t===""||t===null},string:{deserialize:t=>t,serialize:t=>String(t),isEmpty:t=>t===""||t===null},map:{deserialize:t=>new Map(JSON.parse(t)),serialize:t=>JSON.stringify(Array.from(t.entries())),isEmpty:t=>{const e=Array.from(t.values());return e.length===0||e.every(s=>s===""||s===null)}},set:{deserialize:t=>new Set(JSON.parse(t)),serialize:t=>JSON.stringify(Array.from(t.entries())),isEmpty:t=>{const e=Array.from(t.values());return e.length===0||e.every(s=>s===""||s===null)}}};function ct(t,e,s,i={writeDefaults:!0}){let r,{writeDefaults:a}=i;s==null?r="any":s instanceof Set?r="set":s instanceof Map?r="map":typeof s=="boolean"?r="boolean":typeof s=="string"?r="string":typeof s=="object"||Array.isArray(s)?r="object":Number.isNaN(s)?r="any":r="number";let l=W({value:s}),h=localStorage;const o=ht[r],d=()=>{const b=h.getItem(e);return b==null?(l.value=s,a&&s!==null&&h.setItem(e,o.serialize(s))):l.value=o.deserialize(b),l.value},f=b=>{h.setItem(e,o.serialize(b)),l.value=b},g=()=>(h.removeItem(e),l.value=s,l.value),E=()=>{let b=h.getItem(e);return o.isEmpty(b)};return d(),{get value(){return d()},set value(b){f(b)},read:d,clear:g,write:f,isEmpty:E}}function M(t,e,s){let i,r=null;e=e.bind(t);let a=()=>{e(),r=null,Object.assign(t,{disconnect:i})},l=()=>r=setTimeout(a,s),h=()=>{r!==null&&(clearTimeout(r),r=null)};return i=v(t,l,h),h}function dt(t,e,s,i,r){const a=(g,E)=>{_(g)?g.value=E:g.textContent=E},l=g=>_(g)?g.value:g.innerHTML;let h=()=>{},o=l(e);const d=()=>{a(e,o),h(),r&&r.call(t)};return v(t,()=>{a(e,s),i!==void 0&&(h=M(t,d,i))},d),{teardown:d,update(g){a(e,g)}}}async function mt(t,e,s){try{return await fetch(e,s)}catch(i){if(t===1)throw i;return await mt(t-1,e,s)}}class D extends u{get _errorMessage(){return this.hasErrorMessageValue?this.errorMessageValue:"This content failed to load"}get _maxRetries(){return this.hasMaxRetriesValue?this.maxRetriesValue:1}connect(){}async loadContent(e=null){e==null||e.preventDefault();let s=this,i=this.hasReplaceTarget?this.replaceTarget:this.el,r=()=>{i.replaceWith(this._errorMessage),s.dispatchEvent(i,"ajax:error")};try{let a=await mt(this._maxRetries,this.endpointValue);a.ok||r();let l=await a.text(),h=document.createElement("div");if(h.innerHTML=l,this.hasSelectorValue){let o=h.querySelectorAll(this.selectorValue);i.replaceWith(...o)}else i.replaceWith(...h.children);s.dispatchEvent(i,"ajax:success")}catch{r()}finally{s.dispatchEvent(i,"ajax:complete")}}}n(D,"targets",["replace"]),n(D,"values",{endpoint:String,errorMessage:String,selector:String,maxRetries:Number});class _e extends D{get _errorMessage(){return this.hasErrorMessageValue?this.errorMessageValue:"This content failed to load"}async connect(){await this.loadContent()}}n(_e,"targets",["replace"]),n(_e,"values",{endpoint:String,errorMessage:String,selector:String,maxRetries:Number});function ks(t,e,s){e=e.bind(t);let i=new IntersectionObserver(e,s);return{observer:i,teardown:()=>{i==null||i.disconnect(),i=null},observe:h=>i==null?void 0:i.observe(h),unobserve:h=>i==null?void 0:i.unobserve(h)}}function be(t,e,s,i,r){s&&(s=s.bind(t)),i&&(i=i.bind(t));let a=r!=null?r:{},l=E=>{E.forEach(b=>{b.isIntersecting?s&&s(b):i&&i(b)})},{observer:h,observe:o,unobserve:d,teardown:f}=ks(t,l,a);return v(t,()=>o(e),f),{observer:h,observe:()=>o(e),unobserve:()=>d(e),teardown:f}}class Ms extends D{async connect(){let e=this.el;if("IntersectionObserver"in window){let{observe:s,unobserve:i}=be(this,e,this.appear,null,{threshold:.3});this.observe=s,this.unobserve=i}else await this.loadContent()}async appear(e){e.target===this.el&&e.isIntersecting&&(await this.loadContent(),this.unobserve&&this.unobserve())}}class ve extends D{connect(){if(!this.hasSecondsValue)throw new Error("Required value `seconds` is missing");requestAnimationFrame(()=>{this._timeout(),H(this,this._timeout,this.secondsValue*1e3)})}async _timeout(){await this.loadContent()}}n(ve,"targets",["replace"]),n(ve,"values",{endpoint:String,errorMessage:String,selector:String,maxRetries:Number,seconds:Number});class ft extends u{get _eventModes(){if(this.hasEventModeValue){let e=this.eventModeValue.split(" ").map(s=>s.trim());if(e.length===1&&e[0]==="debounced")return["change","input"];if(!e.every(s=>["change","input"].includes(s)))throw new Error(`The modeValue provided '${this.eventModeValue}' is not one of the recognised configuration options`);return e}else return["change"]}get _debounceTimeout(){return this.hasDebounceIntervalValue?this.debounceIntervalValue:-1}get _mode(){if(this.hasSubmitModeValue){if(!["direct","request"].includes(this.submitModeValue))throw new Error(`The modeValue provided '${this.submitModeValue}' is not one of the recognised configuration options`);return this.submitModeValue}else return"request"}get _cssSelector(){let e=["input","textarea","select"],s=":not([data-no-autosubmit])";return e.map(i=>i.concat(s)).join(",")}get inputElements(){let e=Array.from(this.element.querySelectorAll(this._cssSelector));return e=e.filter(s=>!this._ancestorIsTrix(s)),e}connect(){this.inputElements.forEach(e=>c(this,e,this._eventModes,this.submit,{debounce:this._debounceTimeout&&this._debounceTimeout>0?this._debounceTimeout:void 0}))}_ancestorIsTrix(e){return e.closest("trix-toolbar")!==null&&e.closest("trix-editor")!==null}submit(){let e=this.el;this._mode=="request"?ge(e):e.submit()}}n(ft,"values",{submitMode:String,eventMode:String,debounceInterval:Number});class As extends u{connect(){let{teardown:e}=be(this,this.el,this.appear);if(this._unobserveIntersection=e,!U(this.el))throw new Error(`Expected controller to be attached to a textarea, but was a '${this.el.tagName}'`);requestAnimationFrame(()=>{this.el.style.resize="none",this.el.style.boxSizing="border-box",this._handler(),c(this,window,["resize"],this._handler),c(this,this.el,["input","change","focus"],this._handler,{debounce:100})})}appear(e){this.autosize(this.el),this._unobserveIntersection()}_handler(){this.autosize(this.el)}autosize(e){let s=e.offsetHeight-e.clientHeight;e.style.height="auto",e.style.height=e.scrollHeight+s+"px"}}function O(t,e){const s=t[e];return typeof s=="function"?s:s!=null?()=>s:()=>{}}function K(t){return p.upperFirst(p.camelCase(t))}function Ds(t,e){let s=t.element,i=()=>t[`has${K(e)}Class`]==!0,r=()=>t[`${e}Classes`],a=()=>O(t,`default${K(e)}Classes`).call(t)||[],l=()=>i()?r():a();t[`${e}Classes`]==null&&Object.defineProperty(t,`${e}Classes`,{get:()=>i()?t[`${e}Class`].split(" "):a()});let h={[`add${K(e)}Classes`]:(o=s)=>o.classList.add(...l()),[`remove${K(e)}Classes`]:(o=s)=>o.classList.remove(...l()),[`${e}ClassesPresent`]:(o=s)=>l().every(d=>o.classList.contains(d))};Object.assign(t,h)}function y(t){(t.constructor.classes||[]).forEach(s=>Ds(t,s))}class G extends u{connect(){y(this),requestAnimationFrame(()=>{c(this,this.inputTarget,"input",this._updateCharCount),this._updateCharCount()})}_updateCharCount(){let e=this.inputTarget.value.length;this.outputTarget.innerText=e.toString(),this._isValidCount(e)?this.removeErrorClasses(this.outputTarget):this.addErrorClasses(this.outputTarget)}_isValidCount(e){let s=0,i=99999;return this.hasMinValue&&(s=this.minValue),this.hasMaxValue&&(i=this.maxValue),e>=s&&e<=i}}n(G,"targets",["input","output"]),n(G,"values",{min:Number,max:Number}),n(G,"classes",["error"]);class we extends u{connect(){this.toggle()}toggle(){this.hasDisablerTarget&&this.disablerTarget.checked?this.disable():this.enable()}disable(){let e=this.hasClearValue&&this.clearValue;this.disableTargets.forEach((s,i)=>{e&&(s.value=""),s.disabled=!0})}enable(){this.disableTargets.forEach((e,s)=>{e.disabled=!1})}}n(we,"targets",["disabler","disable"]),n(we,"values",{clear:Boolean});class ye extends u{connect(){this.toggle()}toggle(){this.hasEnablerTarget&&this.enablerTarget.checked?this.enable():this.disable()}disable(){let e=this.hasClearValue&&this.clearValue;this.enableTargets.forEach((s,i)=>{e&&(s.value=""),s.disabled=!0})}enable(){this.enableTargets.forEach((e,s)=>{e.disabled=!1})}}n(ye,"targets",["enabler","enable"]),n(ye,"values",{clear:Boolean});class gt extends u{get _checked(){return this._enabled.filter(e=>e.checked)}get _enabled(){return this.checkboxTargets.filter(e=>!e.disabled&&!e.readOnly)}get _unchecked(){return this._enabled.filter(e=>!e.checked)}connect(){requestAnimationFrame(()=>{!this.hasSelectAllTarget||(c(this,this.selectAllTarget,"change",this._toggle),k(this,this.checkboxTargets,"change",this._refresh),this._refresh())})}_toggle(e){e.preventDefault();let s=e.target;this._enabled.forEach(i=>i.checked=i.disabled||i.readOnly?i.checked:s.checked)}_refresh(){const e=this._enabled.length,s=this._checked.length;this.selectAllTarget.checked=s>0,this.selectAllTarget.indeterminate=s>0&&s<e}}n(gt,"targets",["selectAll","checkbox"]);class pt extends u{connect(){k(this,this.checkboxTargets,"change",this._update)}_otherCheckboxes(e){return Array.from(this.checkboxTargets).filter(s=>s!==e)}_update(e){const s=e.target;if(!s)throw new Error("No target found on event");let i=this._otherCheckboxes(s);s.checked&&i.forEach(r=>{r.checked=!1,this.dispatchEvent(this.el,"change")})}}n(pt,"targets",["checkbox"]);class Ls extends u{get _cacheAttrName(){return"detect-dirty-load-value"}connect(){let e=this.el;this._cacheLoadValues(),this._checkDirty(),c(this,e,["input","change"],this._checkDirty,{debounce:10})}restore(e){e==null||e.preventDefault(),this._restoreElementFromLoadValue()}_getElementValue(){let e=this.el;return V(e)?e.checked:e.value}_getElementLoadValue(){let e=this.el,s=e.getAttribute(this._cacheAttrName);if(V(e))return s==null?e.defaultChecked:s=="true";if(A(e))Array.from(e.options).forEach(r=>{if(r.defaultSelected)return e.value=r.value,r.value});else if(s!==null)return s;return s}_elementHasCachedLoadValue(){return this.el.hasAttribute(this._cacheAttrName)}_checkDirty(){let e=this.el;_(e)&&e.type=="radio"&&fe(e).forEach(s=>s.removeAttribute("data-dirty")),this._isElementDirty()?e.setAttribute("data-dirty","true"):e.removeAttribute("data-dirty")}_isElementDirty(){return this._getElementValue()!==this._getElementLoadValue()}_restoreElementFromLoadValue(){let e=this.el,s=e.getAttribute(this._cacheAttrName);V(e)?(e.setAttribute(this._cacheAttrName,e.checked.toString()),e.checked=s==null?e.defaultChecked:s=="true"):A(e)?s==null?Array.from(e.options).forEach(r=>{if(r.defaultSelected){e.value=r.value;return}}):e.value=s:e.value=s==null?e.defaultValue:s}_cacheLoadValues(){let e=this.el;!this._elementHasCachedLoadValue()&&V(e)?e.setAttribute(this._cacheAttrName,e.checked.toString()):e.setAttribute(this._cacheAttrName,e.value.toString())}}function Is(t){return t.hasAttribute("data-dirty")}class Ns extends u{get _formElements(){return Array.from(this.el.querySelectorAll("input, select, textarea"))}get _cacheAttrName(){return"detect-dirty-load-value"}connect(){let e=this.el;this._cacheLoadValues(),this._checkDirty(),c(this,e,["input","change"],this._checkDirty,{debounce:10})}restore(e){e==null||e.preventDefault(),this._formElements.forEach(s=>this._restoreElementFromLoadValue(s))}_getElementValue(e){return V(e)?e.checked:e.value}_getElementLoadValue(e){let s=e.getAttribute(this._cacheAttrName);if(V(e))return s==null?e.defaultChecked:s=="true";if(A(e))Array.from(e.options).forEach(r=>{if(r.defaultSelected)return e.value=r.value,r.value});else if(s!==null)return s;return s}_elementHasCachedLoadValue(e){return e.hasAttribute(this._cacheAttrName)}_checkElementDirty(e){_(e)&&e.type=="radio"&&fe(e).forEach(s=>s.removeAttribute("data-dirty")),this._isElementDirty(e)?e.setAttribute("data-dirty","true"):e.removeAttribute("data-dirty")}_isElementDirty(e){return this._getElementValue(e)!==this._getElementLoadValue(e)}_cacheElementLoadValue(e){!this._elementHasCachedLoadValue(e)&&V(e)?e.setAttribute(this._cacheAttrName,e.checked.toString()):e.setAttribute(this._cacheAttrName,e.value.toString())}_restoreElementFromLoadValue(e){let s=e.getAttribute(this._cacheAttrName);V(e)?(e.setAttribute(this._cacheAttrName,e.checked.toString()),e.checked=s==null?e.defaultChecked:s=="true"):A(e)?s==null?Array.from(e.options).forEach(r=>{if(r.defaultSelected){e.value=r.value;return}}):e.value=s:e.value=s==null?e.defaultValue:s}_cacheLoadValues(){this._formElements.forEach(e=>this._cacheElementLoadValue(e))}_checkDirty(){this._formElements.forEach(e=>this._checkElementDirty(e)),this._formElements.some(e=>_t(e))?this.el.setAttribute("data-dirty","true"):this.el.removeAttribute("data-dirty")}}function _t(t){return t.hasAttribute("data-dirty")}class Ee extends u{connect(){}disable(){let e=this.hasClearValue&&this.clearValue;this.inputTargets.forEach((s,i)=>{e&&(s.value=""),s.disabled=!0})}enable(){this.inputTargets.forEach((e,s)=>e.disabled=!1)}}n(Ee,"targets",["input"]),n(Ee,"values",{clear:Boolean});class bt extends u{get _mode(){const e=["immediate","wait"];if(this.hasModeValue){if(e.includes(this.modeValue))return this.modeValue;throw new Error(`The given modeValue '${this.modeValue}' is not one of the supported modes: "${e.join('", "')}"`)}else return e[0]}connect(){this._mode=="immediate"&&this.steal()}steal(){this.el.focus()}}n(bt,"values",{mode:String});class Te extends u{get _mode(){if(this.hasSubmitModeValue){if(!["direct","request"].includes(this.submitModeValue))throw new Error(`The modeValue provided '${this.submitModeValue}' is not one of the recognised configuration options`);return this.submitModeValue}else return"request"}get form(){let e;if(this.hasFormSelectorValue){if(e=document.querySelector(this.formSelectorValue),!e)throw new Error(`Could not find a form on the page that matches selector '${this.formSelectorValue}'`)}else e=this.formTarget;return e}submit(e){e==null||e.preventDefault();let s=this.formTarget;this._mode=="request"?ge(s):s.submit()}reset(e){e==null||e.preventDefault(),at(this.form)}}n(Te,"targets",["form"]),n(Te,"values",{formSelector:String,submitMode:String});class vt extends u{get _formID(){if(this.hasIdValue)return this.idValue;let e=this.el.id;if(e!=="")return e;throw new Error(`No ID value to uniquely identify this form. Please either specify data-${this.identifier}-id-value or give this form an 'id' attribute. `)}get _formIdentifier(){return`${location.href} ${this._formID}`}get _formElements(){return this.el.elements}get _formData(){let e={[this._formIdentifier]:{}};for(const s of this._formElements){let i=s;i.name.length>0&&(_(i)&&i.type=="checkbox"?e[this._formIdentifier][i.name]=i.checked:_(i)&&i.type=="radio"?i.checked&&(e[this._formIdentifier][i.name]=i.value):e[this._formIdentifier][i.name]=i.value)}return e}get _restoreOnLoad(){return this.hasRestoreOnLoadValue?this.restoreOnLoadValue:!0}get _clearOnSubmit(){return this.hasClearOnSubmitValue?this.clearOnSubmitValue:!0}connect(){requestAnimationFrame(()=>{let e=this.el;if(!he(e))throw new Error("Expected controller to be mounted on a form element.");this._restoreOnLoad&&this.restore(),this._clearOnSubmit&&c(this,this.el,"submit",this._clear)})}_clear(){localStorage.removeItem(this._formIdentifier),this.dispatchEvent(this.el,"form-save:cleared")}clear(e){e==null||e.preventDefault(),this._clear()}save(e){e.preventDefault();let s=this._formData;localStorage.setItem(this._formIdentifier,JSON.stringify(s[this._formIdentifier])),this.dispatchEvent(this.el,"form-save:save:success")}restore(e){if(e==null||e.preventDefault(),localStorage.getItem(this._formIdentifier)){const s=JSON.parse(localStorage.getItem(this._formIdentifier));for(const i of this._formElements){let r=i;r.name in s&&(_(r)&&r.type=="checkbox"?r.checked=s[r.name]:_(r)&&r.type=="radio"?r.value==s[r.name]&&(r.checked=!0):r.value=s[r.name])}this.dispatchEvent(this.el,"form-save:restore:success")}else this.dispatchEvent(this.el,"form-save:restore:empty")}}n(vt,"values",{id:String,restoreOnLoad:Boolean,clearOnSubmit:Boolean});class Ce extends u{connect(){k(this,this.inputTargets,"change",this._handleInputs)}_handleInputs(e){let s=this.inputTargets.reduce((r,a)=>a.checked?r+1:r,0),i=e.target;s>this.maxValue?(e.preventDefault(),i.checked=!1,this.dispatchEvent(i,"change"),this.dispatchEvent(i,"limited-selection:too-many"),this.hasErrorTarget&&this.hasMessageValue&&(this.errorTarget.innerHTML=this.messageValue)):(this.dispatchEvent(i,"limited-selection:selection"),this.hasErrorTarget&&(this.errorTarget.innerHTML=""))}}n(Ce,"targets",["input","error"]),n(Ce,"values",{max:Number,message:String});class J extends u{constructor(){super(...arguments);n(this,"_errors",[]);n(this,"_firstClick",!1)}get defaultCurrentClasses(){return["currentError"]}get _errorCount(){return this._errors.length}get _previousIndex(){let e=this._index-1;return e<0?0:e}get _nextIndex(){let e=this._index+1;return e>this._errors.length-1?this._errors.length-1:e}get _index(){return p.clamp(this.hasIndexValue?this.indexValue:0,0,this._errors.length)}get _selector(){if(this.hasSelectorValue)return this.selectorValue;throw new Error("Expected `selectorValue` to be present")}get _currentError(){return this._errors[this._index]}get _otherErrors(){return this._errors.filter((e,s)=>s!==this._index)}connect(){y(this),requestAnimationFrame(()=>{this._firstClick=!0,this._toggleButtons(),this._toggleVisibility()})}async current(e){e==null||e.preventDefault(),this._firstClick&&(this._firstClick=!1,this._toggleButtons()),await x(this._currentError,{behavior:"smooth",block:"center",inline:"center"}),this._updateClasses()}async next(e){e==null||e.preventDefault(),this._firstClick?(this._firstClick=!1,this._toggleButtons()):this.indexValue=this._nextIndex,await x(this._currentError,{behavior:"smooth",block:"center",inline:"center"}),this._updateClasses()}async previous(e){e==null||e.preventDefault(),this._firstClick?(this._firstClick=!1,this._toggleButtons()):this.indexValue=this._previousIndex,await x(this._currentError,{behavior:"smooth",block:"center",inline:"center"}),this._updateClasses()}indexValueChanged(){this._toggleButtons()}selectorValueChanged(){this._errors=Array.from(document.querySelectorAll(this._selector)),this.indexValue=0,this._toggleButtons(),this._toggleVisibility()}_updateClasses(){this.addCurrentClasses(this._currentError),this._otherErrors.forEach(e=>this.removeCurrentClasses(e))}_toggleVisibility(){this._errorCount===0?this.el.style.display="none":this.el.style.display=""}_toggleButtons(){if(this.hasNextTarget)if(!this.hasCurrentTarget&&this._firstClick&&this.indexValue==this._errorCount-1){this.nextTarget.removeAttribute("disabled");return}else this.indexValue>=this._errorCount-1?this.nextTarget.setAttribute("disabled","true"):this.nextTarget.removeAttribute("disabled");this.hasPreviousTarget&&(this.indexValue<=0?this.previousTarget.setAttribute("disabled","true"):this.previousTarget.removeAttribute("disabled"))}}n(J,"values",{selector:String,index:Number}),n(J,"classes",["current"]),n(J,"targets",["next","current","previous"]);class Se extends u{get _wrapperClass(){return this.hasWrapperSelectorValue?this.wrapperClassValue:"nested-fields"}get _insertMode(){return this.hasInsertModeValue?this.insertModeValue:"beforeend"}connect(){this._checkStructure()}add(e){e==null||e.preventDefault();const s=this.templateTarget.innerHTML.replace(/NEW_RECORD/g,this._generateID());this.targetTarget.insertAdjacentHTML(this._insertMode,s)}remove(e){e.preventDefault();const s=e.target.closest(`.${this._wrapperClass}`);if(s==null)throw new Error(`#remove was clicked from outside of a child record. Could not find an ancestor with class .${this._wrapperClass}`);if(s.dataset.newRecord==="true")s.remove();else{s.style.display="none";let i=s.querySelector("input[name*='_destroy']");if(i==null)throw new Error("Could not find a hidden input with name '_destroy'. NestedForm cannot remove an already persisted record without it.");i.value="1"}}_generateID(){return new Date().getTime().toString()+Math.random().toString().slice(2)}_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`")}}n(Se,"targets",["target","template"]),n(Se,"values",{insertMode:String,wrapperClass:String});class Ve extends u{connect(){y(this),k(this,this.passwordTargets,"change",this._checkPasswordsMatch)}_allPasswordsMatch(){let e=new Set(this.passwordTargets.map(s=>s.value));return e.has("")||e.size==1}_checkPasswordsMatch(){let e=this.el;this._allPasswordsMatch()?(this.dispatchEvent(e,"password-confirm:match"),this.passwordTargets.forEach(s=>this.removeErrorClasses(s))):(this.dispatchEvent(e,"password-confirm:no-match"),this.passwordTargets.forEach(s=>this.addErrorClasses(s)))}}n(Ve,"targets",["password"]),n(Ve,"classes",["error"]);class wt extends u{peak(e){e==null||e.preventDefault(),this.passwordTarget.type="text"}hide(e){e==null||e.preventDefault(),this.passwordTarget.type="password"}toggle(e){e==null||e.preventDefault(),this.passwordTarget.type==="password"?this.peak():this.hide()}}n(wt,"targets",["password"]);class xe extends u{get _selector(){return this.hasSelectorValue?this.selectorValue:`[data-controller~="${this.identifier}"]`}replace(e){const[s,i,r]=e.detail;if(s instanceof Node){let a=s.querySelector(this._selector);if(a==null)throw new Error(`expected new form DOM with [data-controller="${this.identifier}"] to be present in returned payload`);let l=this.el.parentNode;if(l==null)throw new Error("expected form to have a DOM parent, could not execute replaceChild");l.replaceChild(a,this.el),this.dispatchEvent(a,"remote-form:replace")}else console.log("Unknown",s)}}n(xe,"targets",[]),n(xe,"values",{selector:String});function B(t,e,s,i){let r=i;(r==null?void 0:r.debounce)?(s=p.debounce(s.bind(t),r.debounce),delete r.debounce):s=s.bind(t);let a=nt(e),l=()=>a.forEach(o=>S.on(o,s)),h=()=>a.forEach(o=>S.off(o,s));return v(t,l,h),{setup:l,teardown:h}}class yt extends u{get _eventName(){return`sync:${this._key}`}get _key(){if(this.hasKeyValue)return this.keyValue;throw new Error("Expected `keyValue` to be present")}get _value(){let e=this.el;return _(e)&&e.type==="checkbox"?e.checked:_(e)&&e.type==="radio"?e.checked?e.value:"":e.value}set _value(e){let s=this.el;_(s)&&s.type==="checkbox"?s.checked=e.toString()==="true":_(s)&&s.type==="radio"?s.checked=s.value===e:_(s)||U(s)||A(s)?s.value=e.toString():s.innerHTML=e.toString()}connect(){B(this,this._eventName,this._read),requestAnimationFrame(()=>{tt(this.el)&&(this._emit(),c(this,this.el,"input",this._emit))})}_emit(){S.emit(this._eventName,{value:this._value,dispatcher:this.el})}_read(e){if(e===void 0)throw new Error("No payload received");let{dispatcher:s,value:i}=e;s!==this.el&&(this._value=i)}}n(yt,"values",{key:String});class X extends u{get _maxMessage(){return this.hasMaxMessageValue?this.maxMessageValue:`Value must be less than ${this.maxValue}`}get _minMessage(){return this.hasMinMessageValue?this.minMessageValue:`Value must be greater than ${this.minValue}`}get defaultWarningHideClasses(){return["hide"]}connect(){y(this),this.addWarningHideClasses(this.warningTarget),c(this,this.inputTarget,"input",this._check),this._check()}_check(){this.hasMinValue&&Number.parseFloat(this.inputTarget.value)<this.minValue?(this.removeWarningHideClasses(this.warningTarget),this.addInputWarningClasses(this.inputTarget),this.warningTarget.innerText=this._minMessage):this.hasMaxValue&&Number.parseFloat(this.inputTarget.value)>this.maxValue?(this.removeWarningHideClasses(this.warningTarget),this.addInputWarningClasses(this.inputTarget),this.warningTarget.innerText=this._maxMessage):(this.addWarningHideClasses(this.warningTarget),this.removeInputWarningClasses(this.inputTarget),this.warningTarget.innerText="")}}n(X,"classes",["inputWarning","warningHide"]),n(X,"targets",["input","warning"]),n(X,"values",{max:Number,min:Number,minMessage:String,maxMessage:String});class Y extends u{connect(){y(this),this._updateWordCount(),c(this,this.inputTarget,"input",this._updateWordCount)}_updateWordCount(){let e=0,i=this.inputTarget.value.match(/\S+/g);e=i&&i.length||0,this.outputTarget.innerText=e.toString(),this._isValidCount(e)?this.removeErrorClasses(this.outputTarget):this.addErrorClasses(this.outputTarget)}_isValidCount(e){let s=0,i=99999;return this.hasMinValue&&(s=this.minValue),this.hasMaxValue&&(i=this.maxValue),e>=s&&e<=i}}n(Y,"targets",["input","output"]),n(Y,"values",{min:Number,max:Number}),n(Y,"classes",["error"]);class ke extends u{initialize(){this._hasLoadedSuccessfully=this._hasLoadedSuccessfully.bind(this),this._success=this._success.bind(this),this._fail=this._fail.bind(this)}connect(){let e=this.el;e.onerror=this._fail,e.complete&&!this._hasLoadedSuccessfully()?this._fail():this._success()}disconnect(){this.removeSuccessClasses(),this.removeFailClasses()}_success(){this.addSuccessClasses()}_fail(){let e=this.el;this.addFailClasses(),this.hasPlaceholderValue&&e.src!==this.placeholderValue?(this.dispatchEvent(e,"fallback-image:placeholder"),e.src=this.placeholderValue,e.onerror=this._fail):(this.dispatchEvent(e,"fallback-image:fail"),e.style.display="none")}_hasLoadedSuccessfully(){let e=this.el;return e.naturalHeight>0&&e.naturalWidth>0}}n(ke,"values",{placeholder:String}),n(ke,"classes",["success","fail"]);var L=window.CustomEvent;(!L||typeof L=="object")&&(L=function(e,s){s=s||{};var i=document.createEvent("CustomEvent");return i.initCustomEvent(e,!!s.bubbles,!!s.cancelable,s.detail||null),i},L.prototype=window.Event.prototype);function Et(t,e){var s="on"+e.type.toLowerCase();return typeof t[s]=="function"&&t[s](e),t.dispatchEvent(e)}function Hs(t){for(;t&&t!==document.body;){var e=window.getComputedStyle(t),s=function(i,r){return!(e[i]===void 0||e[i]===r)};if(e.opacity<1||s("zIndex","auto")||s("transform","none")||s("mixBlendMode","normal")||s("filter","none")||s("perspective","none")||e.isolation==="isolate"||e.position==="fixed"||e.webkitOverflowScrolling==="touch")return!0;t=t.parentElement}return!1}function F(t){for(;t;){if(t.localName==="dialog")return t;t.parentElement?t=t.parentElement:t.parentNode?t=t.parentNode.host:t=null}return null}function Tt(t){for(;t&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;t&&t.blur&&t!==document.body&&t.blur()}function Os(t,e){for(var s=0;s<t.length;++s)if(t[s]===e)return!0;return!1}function Me(t){return!t||!t.hasAttribute("method")?!1:t.getAttribute("method").toLowerCase()==="dialog"}function Ct(t){var e=["button","input","keygen","select","textarea"],s=e.map(function(l){return l+":not([disabled])"});s.push('[tabindex]:not([disabled]):not([tabindex=""])');var i=t.querySelector(s.join(", "));if(!i&&"attachShadow"in Element.prototype)for(var r=t.querySelectorAll("*"),a=0;a<r.length&&!(r[a].tagName&&r[a].shadowRoot&&(i=Ct(r[a].shadowRoot),i));a++);return i}function St(t){return t.isConnected||document.body.contains(t)}function Vt(t){if(t.submitter)return t.submitter;var e=t.target;if(!(e instanceof HTMLFormElement))return null;var s=m.formSubmitter;if(!s){var i=t.target,r="getRootNode"in i&&i.getRootNode()||document;s=r.activeElement}return!s||s.form!==e?null:s}function Bs(t){if(!t.defaultPrevented){var e=t.target,s=m.imagemapUseValue,i=Vt(t);s===null&&i&&(s=i.value);var r=F(e);if(!!r){var a=i&&i.getAttribute("formmethod")||e.getAttribute("method");a==="dialog"&&(t.preventDefault(),s!=null?r.close(s):r.close())}}}function xt(t){if(this.dialog_=t,this.replacedStyleTop_=!1,this.openAsModal_=!1,t.hasAttribute("role")||t.setAttribute("role","dialog"),t.show=this.show.bind(this),t.showModal=this.showModal.bind(this),t.close=this.close.bind(this),t.addEventListener("submit",Bs,!1),"returnValue"in t||(t.returnValue=""),"MutationObserver"in window){var e=new MutationObserver(this.maybeHideModal.bind(this));e.observe(t,{attributes:!0,attributeFilter:["open"]})}else{var s=!1,i=function(){s?this.downgradeModal():this.maybeHideModal(),s=!1}.bind(this),r,a=function(l){if(l.target===t){var h="DOMNodeRemoved";s|=l.type.substr(0,h.length)===h,window.clearTimeout(r),r=window.setTimeout(i,0)}};["DOMAttrModified","DOMNodeRemoved","DOMNodeRemovedFromDocument"].forEach(function(l){t.addEventListener(l,a)})}Object.defineProperty(t,"open",{set:this.setOpen.bind(this),get:t.hasAttribute.bind(t,"open")}),this.backdrop_=document.createElement("div"),this.backdrop_.className="backdrop",this.backdrop_.addEventListener("mouseup",this.backdropMouseEvent_.bind(this)),this.backdrop_.addEventListener("mousedown",this.backdropMouseEvent_.bind(this)),this.backdrop_.addEventListener("click",this.backdropMouseEvent_.bind(this))}xt.prototype={get dialog(){return this.dialog_},maybeHideModal:function(){this.dialog_.hasAttribute("open")&&St(this.dialog_)||this.downgradeModal()},downgradeModal:function(){!this.openAsModal_||(this.openAsModal_=!1,this.dialog_.style.zIndex="",this.replacedStyleTop_&&(this.dialog_.style.top="",this.replacedStyleTop_=!1),this.backdrop_.parentNode&&this.backdrop_.parentNode.removeChild(this.backdrop_),m.dm.removeDialog(this))},setOpen:function(t){t?this.dialog_.hasAttribute("open")||this.dialog_.setAttribute("open",""):(this.dialog_.removeAttribute("open"),this.maybeHideModal())},backdropMouseEvent_:function(t){if(this.dialog_.hasAttribute("tabindex"))this.dialog_.focus();else{var e=document.createElement("div");this.dialog_.insertBefore(e,this.dialog_.firstChild),e.tabIndex=-1,e.focus(),this.dialog_.removeChild(e)}var s=document.createEvent("MouseEvents");s.initMouseEvent(t.type,t.bubbles,t.cancelable,window,t.detail,t.screenX,t.screenY,t.clientX,t.clientY,t.ctrlKey,t.altKey,t.shiftKey,t.metaKey,t.button,t.relatedTarget),this.dialog_.dispatchEvent(s),t.stopPropagation()},focus_:function(){var t=this.dialog_.querySelector("[autofocus]:not([disabled])");!t&&this.dialog_.tabIndex>=0&&(t=this.dialog_),t||(t=Ct(this.dialog_)),Tt(document.activeElement),t&&t.focus()},updateZIndex:function(t,e){if(t<e)throw new Error("dialogZ should never be < backdropZ");this.dialog_.style.zIndex=t,this.backdrop_.style.zIndex=e},show:function(){this.dialog_.open||(this.setOpen(!0),this.focus_())},showModal:function(){if(this.dialog_.hasAttribute("open"))throw new Error("Failed to execute 'showModal' on dialog: The element is already open, and therefore cannot be opened modally.");if(!St(this.dialog_))throw new Error("Failed to execute 'showModal' on dialog: The element is not in a Document.");if(!m.dm.pushDialog(this))throw new Error("Failed to execute 'showModal' on dialog: There are too many open modal dialogs.");Hs(this.dialog_.parentElement)&&console.warn("A dialog is being shown inside a stacking context. This may cause it to be unusable. For more information, see this link: https://github.com/GoogleChrome/dialog-polyfill/#stacking-context"),this.setOpen(!0),this.openAsModal_=!0,m.needsCentering(this.dialog_)?(m.reposition(this.dialog_),this.replacedStyleTop_=!0):this.replacedStyleTop_=!1,this.dialog_.parentNode.insertBefore(this.backdrop_,this.dialog_.nextSibling),this.focus_()},close:function(t){if(!this.dialog_.hasAttribute("open"))throw new Error("Failed to execute 'close' on dialog: The element does not have an 'open' attribute, and therefore cannot be closed.");this.setOpen(!1),t!==void 0&&(this.dialog_.returnValue=t);var e=new L("close",{bubbles:!1,cancelable:!1});Et(this.dialog_,e)}};var m={};m.reposition=function(t){var e=document.body.scrollTop||document.documentElement.scrollTop,s=e+(window.innerHeight-t.offsetHeight)/2;t.style.top=Math.max(e,s)+"px"};m.isInlinePositionSetByStylesheet=function(t){for(var e=0;e<document.styleSheets.length;++e){var s=document.styleSheets[e],i=null;try{i=s.cssRules}catch{}if(!!i)for(var r=0;r<i.length;++r){var a=i[r],l=null;try{l=document.querySelectorAll(a.selectorText)}catch{}if(!(!l||!Os(l,t))){var h=a.style.getPropertyValue("top"),o=a.style.getPropertyValue("bottom");if(h&&h!=="auto"||o&&o!=="auto")return!0}}}return!1};m.needsCentering=function(t){var e=window.getComputedStyle(t);return e.position!=="absolute"||t.style.top!=="auto"&&t.style.top!==""||t.style.bottom!=="auto"&&t.style.bottom!==""?!1:!m.isInlinePositionSetByStylesheet(t)};m.forceRegisterDialog=function(t){if((window.HTMLDialogElement||t.showModal)&&console.warn("This browser already supports <dialog>, the polyfill may not work correctly",t),t.localName!=="dialog")throw new Error("Failed to register dialog: The element is not a dialog.");new xt(t)};m.registerDialog=function(t){t.showModal||m.forceRegisterDialog(t)};m.DialogManager=function(){this.pendingDialogStack=[];var t=this.checkDOM_.bind(this);this.overlay=document.createElement("div"),this.overlay.className="_dialog_overlay",this.overlay.addEventListener("click",function(e){this.forwardTab_=void 0,e.stopPropagation(),t([])}.bind(this)),this.handleKey_=this.handleKey_.bind(this),this.handleFocus_=this.handleFocus_.bind(this),this.zIndexLow_=1e5,this.zIndexHigh_=1e5+150,this.forwardTab_=void 0,"MutationObserver"in window&&(this.mo_=new MutationObserver(function(e){var s=[];e.forEach(function(i){for(var r=0,a;a=i.removedNodes[r];++r){if(a instanceof Element)a.localName==="dialog"&&s.push(a);else continue;s=s.concat(a.querySelectorAll("dialog"))}}),s.length&&t(s)}))};m.DialogManager.prototype.blockDocument=function(){document.documentElement.addEventListener("focus",this.handleFocus_,!0),document.addEventListener("keydown",this.handleKey_),this.mo_&&this.mo_.observe(document,{childList:!0,subtree:!0})};m.DialogManager.prototype.unblockDocument=function(){document.documentElement.removeEventListener("focus",this.handleFocus_,!0),document.removeEventListener("keydown",this.handleKey_),this.mo_&&this.mo_.disconnect()};m.DialogManager.prototype.updateStacking=function(){for(var t=this.zIndexHigh_,e=0,s;s=this.pendingDialogStack[e];++e)s.updateZIndex(--t,--t),e===0&&(this.overlay.style.zIndex=--t);var i=this.pendingDialogStack[0];if(i){var r=i.dialog.parentNode||document.body;r.appendChild(this.overlay)}else this.overlay.parentNode&&this.overlay.parentNode.removeChild(this.overlay)};m.DialogManager.prototype.containedByTopDialog_=function(t){for(;t=F(t);){for(var e=0,s;s=this.pendingDialogStack[e];++e)if(s.dialog===t)return e===0;t=t.parentElement}return!1};m.DialogManager.prototype.handleFocus_=function(t){var e=t.composedPath?t.composedPath()[0]:t.target;if(!this.containedByTopDialog_(e)&&document.activeElement!==document.documentElement&&(t.preventDefault(),t.stopPropagation(),Tt(e),this.forwardTab_!==void 0)){var s=this.pendingDialogStack[0],i=s.dialog,r=i.compareDocumentPosition(e);return r&Node.DOCUMENT_POSITION_PRECEDING&&(this.forwardTab_?s.focus_():e!==document.documentElement&&document.documentElement.focus()),!1}};m.DialogManager.prototype.handleKey_=function(t){if(this.forwardTab_=void 0,t.keyCode===27){t.preventDefault(),t.stopPropagation();var e=new L("cancel",{bubbles:!1,cancelable:!0}),s=this.pendingDialogStack[0];s&&Et(s.dialog,e)&&s.dialog.close()}else t.keyCode===9&&(this.forwardTab_=!t.shiftKey)};m.DialogManager.prototype.checkDOM_=function(t){var e=this.pendingDialogStack.slice();e.forEach(function(s){t.indexOf(s.dialog)!==-1?s.downgradeModal():s.maybeHideModal()})};m.DialogManager.prototype.pushDialog=function(t){var e=(this.zIndexHigh_-this.zIndexLow_)/2-1;return this.pendingDialogStack.length>=e?!1:(this.pendingDialogStack.unshift(t)===1&&this.blockDocument(),this.updateStacking(),!0)};m.DialogManager.prototype.removeDialog=function(t){var e=this.pendingDialogStack.indexOf(t);e!==-1&&(this.pendingDialogStack.splice(e,1),this.pendingDialogStack.length===0&&this.unblockDocument(),this.updateStacking())};m.dm=new m.DialogManager;m.formSubmitter=null;m.imagemapUseValue=null;if(window.HTMLDialogElement===void 0){var kt=document.createElement("form");if(kt.setAttribute("method","dialog"),kt.method!=="dialog"){var I=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"method");if(I){var Fs=I.get;I.get=function(){return Me(this)?"dialog":Fs.call(this)};var Rs=I.set;I.set=function(t){return typeof t=="string"&&t.toLowerCase()==="dialog"?this.setAttribute("method",t):Rs.call(this,t)},Object.defineProperty(HTMLFormElement.prototype,"method",I)}}document.addEventListener("click",function(t){if(m.formSubmitter=null,m.imagemapUseValue=null,!t.defaultPrevented){var e=t.target;if("composedPath"in t){var s=t.composedPath();e=s.shift()||e}if(!(!e||!Me(e.form))){var i=e.type==="submit"&&["button","input"].indexOf(e.localName)>-1;if(!i){if(!(e.localName==="input"&&e.type==="image"))return;m.imagemapUseValue=t.offsetX+","+t.offsetY}var r=F(e);!r||(m.formSubmitter=e)}}},!1),document.addEventListener("submit",function(t){var e=t.target,s=F(e);if(!s){var i=Vt(t),r=i&&i.getAttribute("formmethod")||e.getAttribute("method");r==="dialog"&&t.preventDefault()}});var qs=HTMLFormElement.prototype.submit,Ps=function(){if(!Me(this))return qs.call(this);var t=F(this);t&&t.close()};HTMLFormElement.prototype.submit=Ps}class Ae extends u{constructor(){super(...arguments);n(this,"_dialog",null)}get _src(){return this.hasSrcValue?this.srcValue:this.el.src}get _srcSet(){return this.hasSrcSetValue?this.srcSetValue:this.el.srcset}get _sizes(){return this.hasSizesValue?this.sizesValue:this.el.sizes}get _modalClassName(){return this.hasModalClass?this.modalClass:"image-lightbox-dialog"}get _imageClassName(){return this.hasImageClass?this.imageClass:"image-lightbox-image"}initialize(){this.open=this.open.bind(this),this.close=this.close.bind(this)}connect(){}disconnect(){this.close()}open(){let e=this.el;if(this._dialog)return;this._dialog=document.createElement("dialog");let s=document.createElement("img");s.className=this._imageClassName,s.src=this._src,s.srcset=this._srcSet,s.sizes=this._sizes,this._dialog.appendChild(s),e.insertAdjacentElement("afterend",this._dialog),m.registerDialog(this._dialog),this._dialog.className=this._modalClassName,this._dialog.showModal(),x(this._dialog,{behavior:"smooth",block:"end"}).catch(()=>this._dialog.scrollIntoView(!1)),c(this,this._dialog,"click",this.close),c(this,this._dialog,"cancel",this.close),c(this,this._dialog,"close",this.close)}close(){this._dialog&&(this._dialog.close(),this._dialog.remove(),this._dialog=null,x(this.el,{behavior:"smooth",block:"end"}).catch(()=>this.el.scrollIntoView(!1)))}}n(Ae,"values",{src:String,srcSet:String,sizes:String}),n(Ae,"classes",["modal","image"]);class Mt extends u{async play(e){e==null||e.preventDefault(),await this.mediaTarget.play()}pause(e){e==null||e.preventDefault(),this.mediaTarget.pause()}restart(e){e==null||e.preventDefault(),this.mediaTarget.currentTime=0}seek(e){e==null||e.preventDefault(),this.mediaTarget.currentTime+=5}}n(Mt,"targets",["media"]);class At extends u{get _increment(){return this.hasIncrementValue?this.incrementValue:50}get _behaviour(){if(this.hasBehaviourValue){if(["auto","smooth"].includes(this.behaviourValue))return this.behaviourValue;throw new Error(`'${this.behaviourValue}' is not a recognised scroll behaviour`)}else return"auto"}async scrollTop(e){e==null||e.preventDefault(),await ae(this.el,{behavior:this._behaviour})}async scrollBottom(e){e==null||e.preventDefault(),await ne(this.el,{behavior:this._behaviour})}async scrollLeft(e){e==null||e.preventDefault(),await le(this.el,{behavior:this._behaviour})}async scrollRight(e){e==null||e.preventDefault(),await le(this.el,{behavior:this._behaviour})}async up(e){e==null||e.preventDefault(),await Ue(this.el,this._increment,{behavior:this._behaviour})}async down(e){e==null||e.preventDefault(),await je(this.el,this._increment,{behavior:this._behaviour})}async left(e){e==null||e.preventDefault(),await We(this.el,this._increment,{behavior:this._behaviour})}async right(e){e==null||e.preventDefault(),await Ke(this.el,this._increment,{behavior:this._behaviour})}}n(At,"values",{behaviour:String,increment:Number});class Dt extends ${connect(){requestAnimationFrame(()=>{x(this.el,{behavior:this.hasBehaviorValue?this.behaviorValue:"smooth",block:this.hasBlockValue?this.blockValue:"center",inline:this.hasInlineValue?this.inlineValue:"center"}).catch(()=>this.el.scrollIntoView()),this._cleanupSelf()})}}n(Dt,"values",{behavior:String,block:String,inline:String});class Lt extends u{get _mode(){return this.hasModeValue?this.modeValue:"document"}get _scrollTarget(){let e;return this._mode=="document"?e=window:e=z(this.el),e}async scroll(e){e==null||e.preventDefault(),this._scrollTarget&&await ne(this._scrollTarget)}}n(Lt,"values",{mode:String});class It extends u{scroll(){let e=document.querySelector(this.selectorValue);if(!e){console.warn(`Could not find target for '${this.selectorValue}'`);return}x(e,{behavior:this.hasBehaviorValue?this.behaviorValue:"smooth",block:this.hasBlockValue?this.blockValue:"center",inline:this.hasInlineValue?this.inlineValue:"center"}).catch(()=>e.scrollIntoView())}}n(It,"values",{selector:String,behavior:String,block:String,inline:String});class Nt extends u{get _mode(){return this.hasModeValue?this.modeValue:"document"}get _scrollTarget(){let e;return this._mode=="document"?e=window:e=z(this.el),e}async scroll(e){e==null||e.preventDefault(),this._scrollTarget&&await ae(this._scrollTarget)}}n(Nt,"values",{mode:String});function Ht(t){t=t.trim();let e=t.includes("&&"),s=t.includes("||"),i=t.includes("(")||t.includes(")");if(e&&s)throw new Error("Cannot have both && and || in the same expression.");if(i)throw new Error("Cannot have logical groupings `(>3 && <= 9) || (>1 && <2)` in the expression. Only supports simple expressions like `>1 && <3`");let r=t.split(e?"&&":"||");return e?r.map(a=>De(a)):s?r.map(a=>De(a)):[De(t)]}function De(t){let s=[">=","<=","==","!=",">","<"].find(l=>t.includes(l));if(!s)throw new Error(`Could not find operator in expression: ${t}`);let i=t.split(s)[1].trim(),r=/^-?\d*(\.\d+)?$/.test(i);if(r&&(i=parseFloat(i)),i==="")throw new Error(`Could not find a value in expression: ${t}`);let a=l=>l!=="";switch(s){case">":return l=>r&&a(l)&&l>i;case"<":return l=>r&&a(l)&&l<i;case">=":return l=>r&&a(l)&&l>=i;case"<=":return l=>r&&a(l)&&l<=i;case"==":return l=>a(l)&&l==i;case"!=":return l=>a(l)&&l!=i;default:throw new Error(`Unknown operator ${s}`)}}function R(t,e){return`signal:${e}:${t}`}function q(t){return R(t,"connect")}function P(t){return R(t,"value")}class Ot extends u{get _predicates(){return Ht(this.whenValue)}connect(){S.emit(q(this.nameValue)),B(this,P(this.nameValue),this._onSignal)}_onSignal(e){let s=e.value;if(!this.hasWhenValue){this.dispatchEvent(this.el,R(this.nameValue,"match"));return}this._predicates.every(i=>i(s))?this.dispatchEvent(this.el,R(this.nameValue,"match"),{detail:{element:this.el,value:s}}):this.dispatchEvent(this.el,R(this.nameValue,"no-match"),{detail:{element:this.el,value:s}})}}n(Ot,"values",{name:String,when:String});function Z(t,e,s,i){s=s.bind(t);let r=new MutationObserver(s),a=()=>r.observe(e,i),l=()=>r.disconnect();return v(t,a,l),l}class Bt extends u{get _children(){return this.hasScopeSelectorValue?Array.from(this.el.querySelectorAll(this.scopeSelectorValue)):Array.from(this.el.children)}get _name(){if(this.hasNameValue)return this.nameValue;throw new Error("SignalEmptyDomController requires a nameValue to be provided")}connect(){B(this,q(this._name),this.emitChildCount),S.emit(q(this._name)),Z(this,this.el,this.mutate,{childList:!0}),this.emitChildCount()}mutate(e){this.emitChildCount()}emitChildCount(){let e=this._children.length;S.emit(P(this._name),{element:this.el,value:e.toString()})}}n(Bt,"values",{name:String,scopeSelector:String});class Ft extends u{get _debounceTimeout(){return this.hasDebounceIntervalValue?this.debounceIntervalValue:1}get _name(){return this.hasNameValue?this.nameValue:this.element.name}connect(){B(this,q(this._name),()=>this.emitValue()),lt(this,this.el,["input","change"],this.emitValue,{debounce:this._debounceTimeout||void 0}),requestAnimationFrame(()=>this.emitValue())}emitValue(){var s;let e=this.el.value;if(_(this.el)&&this.el.type==="checkbox")e=this.el.checked?"true":"false";else if(_(this.el)&&this.el.type==="radio"){let i=(s=me(this.el).find(r=>r.checked))==null?void 0:s.value;e=i||""}this.dispatchEvent(this.el,P(this._name),{detail:{value:e}}),S.emit(P(this._name),{element:this.el,value:e})}}n(Ft,"values",{name:String,debounceInterval:Number});class Le extends u{get _predicates(){return Ht(this.showValue)}get defaultHideClasses(){return["hide"]}connect(){y(this),S.emit(q(this.nameValue)),B(this,P(this.nameValue),this._onSignal)}_onSignal(e){let s=e.value;if(this.showValue=="default"){s==""?this.removeHideClasses(this.el):this.addHideClasses(this.el);return}this._predicates.every(i=>i(s))?(this.dispatchEvent(this.el,"signal-visibility:show",{detail:{predicate:this.showValue,value:s}}),this.removeHideClasses(this.el)):(this.dispatchEvent(this.el,"signal-visibility:hide",{detail:{predicate:this.showValue,value:s}}),this.addHideClasses(this.el))}}n(Le,"values",{name:String,show:String}),n(Le,"classes",["hide"]);class Rt extends u{constructor(){super(...arguments);n(this,"_lastIndex",null);n(this,"_reverse",!1)}get _tableHead(){let e=this.el.tHead;if(e==null)throw new Error("Expected table to have a <thead> element.");return e}get _tableHeaders(){let e=this._tableHead.rows;if(e.length==0)throw new Error("Expected table to have a <thead> element with at least one row.");return Array.from(e[0].cells)}get _tableBody(){return this.el.tBodies[0]}get _tableRows(){return Array.from(this._tableBody.rows)}connect(){requestAnimationFrame(()=>{k(this,this._tableHeaders,"click",this.sort),this.hasStartSortValue&&this._sortByColumn(this.startSortValue)})}sort(e){e.preventDefault();let s=e.target,i=this._indexOfHeaderCell(s);s.dataset.sortable!="false"&&(s.dataset.sort=="asc"?(this._reverse=!0,this._otherHeaderCells(s).forEach(r=>delete r.dataset.sort),s.dataset.sort="desc",this._sortByColumn(i)):(this._reverse=!1,this._otherHeaderCells(s).forEach(r=>delete r.dataset.sort),s.dataset.sort="asc",this._sortByColumn(i)))}_indexOfHeaderCell(e){return this._tableHeaders.indexOf(e)}_otherHeaderCells(e){return Array.from(this._tableHeaders).filter(s=>s!=e)}_sortByColumn(e){let s=document.createDocumentFragment();this._tableRows.sort((a,l)=>{var E,b;let h=Array.from(a.cells),o=Array.from(l.cells),d=((E=h[e])==null?void 0:E.innerText)||"",f=((b=o[e])==null?void 0:b.innerText)||"",g=d.localeCompare(f,"en",{sensitivity:"base",numeric:!0,caseFirst:"upper"});return a.dataset.sortTop||l.dataset.sortBottom?a.dataset.sortTop&&l.dataset.sortTop?g:-1:a.dataset.sortBottom||l.dataset.sortTop?a.dataset.sortBottom&&l.dataset.sortBottom?g:1:this._reverse?g>0?-1:1:g}).forEach(a=>s.appendChild(a)),this._tableBody.innerHTML="",this._tableBody.appendChild(s),this._lastIndex=e}}n(Rt,"values",{startSort:Number});class Ie extends u{get _truncated(){return this.hasTruncatedValue?this.truncatedValue:!1}set _truncated(e){this.truncatedValue=e}get _tableBody(){return this.el.tBodies[0]}get _tableRows(){return Array.from(this._tableBody.rows)}get _limit(){return this.hasLimitValue?this.limitValue:20}connect(){Z(this,this._tableBody,this.mutate,{childList:!0}),requestAnimationFrame(()=>{this.truncate(),c(this,this.showMoreTarget,"click",this.expand)})}truncate(e){e==null||e.preventDefault(),this._truncated=!0,this._tableRows.length>=this._limit?(this._tableRows.slice(this._limit).forEach(s=>{s!==this.showMoreTarget&&this._hideElement(s)}),this._showElement(this.showMoreTarget)):this._hideElement(this.showMoreTarget)}expand(e){this._truncated=!1,e==null||e.preventDefault(),this._tableRows.slice(this._limit).forEach(s=>{s!==this.showMoreTarget&&this._showElement(s)}),this._hideElement(this.showMoreTarget)}mutate(e){this._truncated&&this._reTruncate()}_showElement(e){e.style.display=""}_hideElement(e){e.style.display="none"}_reTruncate(){this._tableRows.slice(0,this._limit).forEach(e=>{e!==this.showMoreTarget&&this._showElement(e)}),this._tableRows.slice(this._limit).forEach(e=>{e!==this.showMoreTarget&&this._hideElement(e)}),this._showElement(this.showMoreTarget)}}n(Ie,"targets",["showMore"]),n(Ie,"values",{limit:Number,truncated:Boolean});class qt extends u{alert(){alert(this.messageValue)}}n(qt,"values",{message:String});class $s extends u{connect(){let{enter:e,exit:s,toggle:i}=ot(this);this.enter=e,this.exit=s,this.toggle=i}}class Pt extends u{get _threshold(){return this.hasThresholdValue?this.thresholdValue.split(",").map(e=>Number.parseFloat(e.trim())).filter(e=>e>=0&&e<=1):[0,1]}connect(){be(this,this.el,this.appear,this.disappear,{threshold:this._threshold})}appear(e){re(this,this.el,"intersection:appear")}disappear(e){re(this,this.el,"intersection:disappear")}}n(Pt,"values",{threshold:String});class $t extends u{connect(){if(!this.hasSecondsValue)throw new Error("Expected `secondsValue` to be present");requestAnimationFrame(()=>{H(this,this._interval,this.secondsValue*1e3)})}_interval(){this.dispatchEvent(this.el,"interval:action")}}n($t,"values",{seconds:Number});class zt extends u{get name(){return this.hasNameValue?this.nameValue:""}get _addedEventName(){return[this.name,"presence","added"].filter(e=>!!e).join(":")}get _removedEventName(){return[this.name,"presence","removed"].filter(e=>!!e).join(":")}connect(){this.dispatchEvent(this.el,this._addedEventName)}disconnect(){this.dispatchEvent(this.el,this._removedEventName)}}n(zt,"values",{name:String});class Ut extends u{print(e){e==null||e.preventDefault(),window.print()}}class jt extends u{connect(){requestAnimationFrame(()=>{M(this,this._timeout,this.secondsValue*1e3)})}_timeout(){this.dispatchEvent(this.el,"timeout")}}n(jt,"values",{seconds:Number});class zs extends u{connect(){c(this,window,["focus","blur"],this._handleVisibility),c(this,document,"visibilitychange",this._handleVisibility),requestAnimationFrame(()=>{this._handleVisibility()})}appear(){this.dispatchEvent(this.el,"user-focus:active")}away(){this.dispatchEvent(this.el,"user-focus:away")}_handleVisibility(){this._documentIsActive()?this.appear():this.away()}_documentIsActive(){return document.visibilityState=="visible"&&document.hasFocus()}}class Wt extends u{get _tickInterval(){return this.hasMillisecondsTarget?1:this.hasSecondsTarget?1e3:this.hasMinutesTarget?15e3:3e5}connect(){requestAnimationFrame(()=>{H(this,this._tick,this._tickInterval)})}_tick(){let e=new Date;this.hasHoursTarget&&(this.hoursTarget.innerHTML=e.getHours().toString().padStart(2,"0")),this.hasMinutesTarget&&(this.minutesTarget.innerHTML=e.getMinutes().toString().padStart(2,"0")),this.hasSecondsTarget&&(this.secondsTarget.innerHTML=e.getSeconds().toString().padStart(2,"0")),this.hasMillisecondsTarget&&(this.millisecondsTarget.innerHTML=e.getMilliseconds().toString().padStart(3,"0"))}}n(Wt,"targets",["hours","minutes","seconds","milliseconds"]);class Q extends u{constructor(){super(...arguments);n(this,"_interval",null)}get _removeUnused(){return this.hasRemoveUnusedValue?this.removeUnusedValue:!1}get _deadlineDate(){return new Date(this.deadlineValue)}connect(){this._interval=setInterval(this._tick.bind(this),1e3),this.addCountingDownClasses()}disconnect(){this._clearTick(),this.removeCountingDownClasses(),this.removeEndedClasses()}deadlineValueChanged(){this._interval==null&&(this._interval=setInterval(this._tick.bind(this),1e3))}_tick(){try{const e=new Date;let s={};w.isPast(this._deadlineDate)?(s={years:0,months:0,days:0,hours:0,minutes:0,seconds:0},this._clearTick(),this.removeCountingDownClasses(),this.addEndedClasses(),this.dispatchEvent(this.el,"countdown:ended")):s=w.intervalToDuration({start:this._deadlineDate,end:e}),this.hasYearsTarget&&this._updateTarget(this.yearsTarget,this._years(s)),this.hasMonthsTarget&&this._updateTarget(this.monthsTarget,this._months(s)),this.hasDaysTarget&&this._updateTarget(this.daysTarget,this._days(s)),this.hasHoursTarget&&this._updateTarget(this.hoursTarget,this._hours(s)),this.hasMinutesTarget&&this._updateTarget(this.minutesTarget,this._minutes(s)),this.hasSecondsTarget&&this._updateTarget(this.secondsTarget,this._seconds(s))}catch(e){console.error(e),this._clearTick()}}_clearTick(){this._interval&&(clearInterval(this._interval),this._interval=null)}_updateTarget(e,s){this._removeTargetIfUnused(e,s),e.innerHTML=s.toString()}_removeTargetIfUnused(e,s){this._removeUnused&&(s===0&&e.dataset.unused?Number.parseInt(e.dataset.unused)>Date.now()+1500&&e.remove():s==0?e.dataset.unused=Date.now().toString():e.dataset.unused=void 0)}_years(e){return e.years||0}_months(e){return e.months||0}_days(e){return e.days||0}_hours(e){return e.hours||0}_minutes(e){return e.minutes||0}_seconds(e){return e.seconds||0}}n(Q,"values",{deadline:String,removeUnused:Boolean}),n(Q,"targets",["years","months","days","hours","minutes","seconds"]),n(Q,"classes",["countingDown","ended"]);class Kt extends u{get _format(){return["years","months","weeks","days","hours",...this._minutes?["minutes"]:[],...this._seconds?["seconds"]:[]]}get _output(){let{years:e,months:s,weeks:i,days:r,hours:a,minutes:l,seconds:h}=this._duration;e||(e=0),s||(s=0),i||(i=0),r||(r=0),a||(a=0),l||(l=0),h||(h=0);let o=[e,s,i,r,a];return!this._minutes&&!this._seconds&&o.every(d=>d===0)?(l=l+h/60,`${(l/60).toFixed(1)} hours`):w.formatDuration(this._duration,{format:this._format,delimiter:", "})}get _seconds(){return this.hasSecondsValue?this.secondsValue:!0}get _minutes(){return this.hasMinutesValue?this.minutesValue:!0}get _timestamp(){if(this.hasTimestampValue)return w.toDate(this.timestampValue*1e3);throw new Error("Expected `timestampValue` to be present")}get _duration(){return w.intervalToDuration({start:new Date,end:this._timestamp})}get _tickInterval(){return this._seconds?1e3:this._minutes?15e3:12e4}connect(){this._clearInterval=H(this,this._update,this._tickInterval),this._update()}_update(){try{this.el.innerHTML=this._output}catch{this._clearInterval()}}}n(Kt,"values",{timestamp:Number,minutes:Boolean,seconds:Boolean});class ee extends u{get defaultHideClasses(){return["hide"]}get defaultActiveClasses(){return["is-active"]}get _currentTab(){return this.hasCurrentTabValue?this.currentTabValue:0}get _equalize(){return this.hasEqualizeValue?this.equalizeValue:!1}connect(){k(this,this.linkTargets,"click",this.switchTabs),this._equalize&&this._setMinHeight(),this.currentTabValue=this._currentTab}switchTabs(e){e.preventDefault(),this.currentTabValue=this.linkTargets.indexOf(e.currentTarget)}currentTabValueChanged(){let e=this._currentTab;e=this._clampIndex(e),this._selectTab(e)}_selectTab(e){e=this._clampIndex(e);let s=this.linkTargets,i=this.contentTargets,r=i[e],a=s[e],l=[...i.slice(0,e),...i.slice(e+1)],h=[...s.slice(0,e),...s.slice(e+1)];this.addActiveClasses(a),a.setAttribute("aria-selected","true"),this.addActiveClasses(r),this.removeHideClasses(r),h.forEach(o=>{o.removeAttribute("aria-selected"),this.removeActiveClasses(o)}),l.forEach(o=>{this.removeActiveClasses(o),this.addHideClasses(o)})}_clampIndex(e){return p.clamp(e,0,this.contentTargets.length-1)}_setMinHeight(){let e=0;this.contentTargets.forEach(s=>{let i=s.hasAttribute("tab-hidden");i&&this.removeHideClasses(s);let r=s.offsetHeight;r>e&&(e=r),i&&this.addHideClasses(s)}),this.contentTargets.forEach(s=>s.style.minHeight=e+"px")}}n(ee,"values",{currentTab:Number,equalize:Boolean}),n(ee,"targets",["link","content"]),n(ee,"classes",["active","hide"]);class Gt extends u{get _duration(){return w.isPast(this._timestamp)?w.intervalToDuration({start:this._timestamp,end:new Date}):w.intervalToDuration({start:new Date,end:this._timestamp})}get _nextUpdate(){let e=this._duration;return e.years&&e.years>0||e.months&&e.months>0||e.days&&e.days>0?null:e.hours&&e.hours>0?18e5:3e4}timestampValueChanged(){this._timestamp=w.toDate(this.timestampValue*1e3)}connect(){if(!this.hasTimestampValue)throw new Error("Expected `timestampValue` to be present");this._update()}_update(){this.el.innerHTML=w.formatDistanceToNow(this._timestamp,{addSuffix:!0,includeSeconds:!0}),this._nextUpdate&&M(this,this._update,this._nextUpdate)}}n(Gt,"values",{timestamp:Number});class Jt extends u{get defaultActiveClasses(){return["active"]}get defaultCollapsedClasses(){return["collapsed"]}initialize(){this._nodeClicked=this._nodeClicked.bind(this)}connect(){y(this),Z(this,this.el,this.mutate,{subtree:!0,childList:!0}),this._setup()}disconnect(){this._teardown()}_setup(){this._setupNode(this.el)}_setupNode(e){const s=i=>{let r=i.parentElement;r&&(this._nodeActive(r)||this._hideNode(r),r.removeEventListener("click",this._nodeClicked),r.addEventListener("click",this._nodeClicked))};(e.tagName==="UL"||e.tagName==="OL")&&s(e),e.querySelectorAll("ul, ol").forEach(i=>s(i))}_teardown(){this.el.querySelectorAll("ul, ol, li").forEach(e=>this._teardownNode(e))}_teardownNode(e){[e,...Array.from(e.querySelectorAll("ul, ol, li"))].forEach(s=>{s.removeEventListener("click",this._nodeClicked),this.removeActiveClasses(s),this.removeCollapsedClasses(s)})}_nodeClicked(e){e&&e.stopImmediatePropagation();let s=e.target;!s||!this._hasNested(s)||(this._nodeActive(s)?this._hideNode(s):this._showNode(s))}_nodeActive(e){return this.activeClassesPresent(e)}_showNode(e){this.removeCollapsedClasses(e),this.addActiveClasses(e)}_hideNode(e){this.removeActiveClasses(e),this.addCollapsedClasses(e)}_hasNested(e){return e.querySelectorAll("ul, ol").length>0}mutate(e){for(const s of e)s.type==="childList"&&(Array.from(s.addedNodes||[]).forEach(i=>this._setupNode(i)),Array.from(s.removedNodes||[]).forEach(i=>this._teardownNode(i)))}}n(Jt,"classes",["active","collapsed"]);class Ne extends u{get defaultActiveClasses(){return["active"]}get defaultInactiveClasses(){return["inactive"]}get _key(){return this.keyValue.replaceAll("#","")}get _anchor(){return window.location.hash.substr(1)}set _anchor(e){window.location.hash=e}connect(){y(this),requestAnimationFrame(()=>{this._checkAnchor(),c(this,window,"hashchange",this._checkAnchor)})}write(e){e==null||e.preventDefault(),this._anchor=this._key}_checkAnchor(){this._key===this._anchor?(this.dispatchEvent(this.el,"anchor-spy:active"),this.addActiveClasses(this.el),this.removeInactiveClasses(this.el)):(this.dispatchEvent(this.el,"anchor-spy:inactive"),this.addInactiveClasses(this.el),this.removeActiveClasses(this.el))}}n(Ne,"values",{key:String}),n(Ne,"classes",["active","inactive"]);class Xt extends u{get _pages(){return this.hasPagesValue?Math.abs(this.pagesValue):1}get _timeout(){return this.hasTimeoutValue?this.timeoutValue:1500}connect(){c(this,this.el,"click",this.goBack)}goBack(e){e==null||e.preventDefault(),history.go(-this._pages),this.el.href&&M(this,this.fallback,this._timeout)}fallback(){window.location.href=this.el.href}}n(Xt,"values",{timeout:Number,pages:Number});class He extends u{constructor(){super(...arguments);n(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")}}n(He,"targets",["source","button","copy","fallback"]),n(He,"values",{removeUnused:Boolean});class Yt extends u{get _message(){return this.hasMessageValue?this.messageValue:"Are you sure?"}get _eventType(){if(he(this.el))return"submit";if(ue(this.el))return"click";throw new Error("Can't handle confirmation on attached element")}connect(){requestAnimationFrame(()=>{c(this,this.el,this._eventType,this.confirm)})}confirm(e){window.confirm(this._message)||(e.preventDefault(),this.dispatchEvent(this.el,"confirm:cancelled"))}}n(Yt,"values",{message:String});class Zt extends u{get _message(){return this.hasMessageValue?this.messageValue:"Do you want to leave this page? Changes you made may not be saved"}connect(){window.onbeforeunload=()=>this._message,c(this,window,"popstate",this.confirmNavigation),c(this,window,"submit",this.allowSubmit),c(this,window,["turbolinks:before-visit","turbo:before-visit"],this.confirmTurboNavigation)}disconnect(){window.onbeforeunload=null}allowSubmit(e){window.removeEventListener("popstate",this.confirmNavigation),window.onbeforeunload=null}confirmNavigation(e){return!1}confirmTurboNavigation(e){confirm(this._message)||e.preventDefault()}}n(Zt,"values",{message:String});class Qt extends u{connect(){console.log("Debug Controller",this,this.testTargets)}}n(Qt,"targets",["test"]);class es extends u{get _message(){return this.hasMessageValue?this.messageValue:"Submitting..."}get _timeout(){return this.hasTimeoutValue?this.timeoutValue:1e3}connect(){requestAnimationFrame(()=>{c(this,this.el,["click"],this.disable),c(this,window,["turbo:load","turbolinks:load"],this._enable)})}disable(e){let s=this.el;this._isDisabled(s)?(e==null||e.preventDefault(),e==null||e.stopImmediatePropagation()):(this._disable(),dt(this,s,this._message,this._timeout,this._enable))}enable(e){e==null||e.preventDefault();let s=this.el;this._isDisabled(s)&&this._enable()}_isDisabled(e){return j(e)?e.disabled:e.dataset.disabled=="true"}_disable(){let e=this.el;j(e)?e.disabled=!0:e.dataset.disabled="true"}_enable(){let e=this.el;j(e)?e.disabled=!1:e.dataset.disabled=void 0}}n(es,"values",{message:String,timeout:Number});class ts extends u{dismiss(){this.el.remove()}}class Us extends ts{}class Oe extends u{get _id(){if(this.hasIdValue)return this.idValue;let e=this.el.id;if(e!=="")return e;throw new Error(`No ID value to uniquely identify this element. Please either specify data-${this.identifier}-id-value or give this element an 'id' attribute. `)}get _uniqueIdentifier(){return`${location.href} ${this._id}`}get _restoreOnLoad(){return this.hasRestoreOnLoadValue?this.restoreOnLoadValue:!0}get _element(){return this.hasElementTarget?this.elementTarget:this.el}initialize(){this.save=p.debounce(this.save.bind(this),300)}connect(){this._store=ct(this,this._uniqueIdentifier,{}),requestAnimationFrame(()=>{this._restoreOnLoad&&this.restore()})}clear(e){e&&e.preventDefault(),this._store.clear(),this.dispatchEvent(this._element,"element-save:cleared")}save(e){e&&e.preventDefault();let s=this._element,i=this.attributesValue.split(" "),r={};i.forEach(a=>r[a]=p.get(s,a)),this._store.value=r,this.dispatchEvent(s,"element-save:save:success")}restore(e){e&&e.preventDefault();let s=this._element;if(this._store.isEmpty())this.dispatchEvent(s,"element-save:restore:empty");else{const i=this._store.value;Object.keys(i).forEach(r=>p.set(s,r,i[r])),this.dispatchEvent(s,"element-save:restore:success")}}}n(Oe,"targets",["element"]),n(Oe,"values",{id:String,attributes:String,restoreOnLoad:Boolean});class te extends u{get _container(){return this.hasContainerTarget?this.containerTarget:this.el}get _children(){let e=this._container;return this.hasScopeSelectorValue?Array.from(e.querySelectorAll(this.scopeSelectorValue)):Array.from(e.children)}connect(){y(this),Z(this,this._container,this.mutate,{childList:!0}),this.checkEmpty()}mutate(e){this.checkEmpty()}checkEmpty(){let e=this._container,s=this._children;s.length===0?(this.removeNotEmptyClasses(),this.addEmptyClasses(),this.dispatchEvent(e,"dom:empty")):(this.addNotEmptyClasses(),this.removeEmptyClasses(),this.dispatchEvent(e,"dom:not-empty",{detail:{count:s.length}}))}}n(te,"targets",["container"]),n(te,"classes",["empty","notEmpty"]),n(te,"values",{scopeSelector:String});class ss extends u{get _mode(){return this.hasModeValue?this.modeValue:"mouseover"}get _supportsPrefetch(){var s,i;const e=document.createElement("link");return((s=e.relList)==null?void 0:s.supports)&&((i=e.relList)==null?void 0:i.supports("prefetch"))}get _href(){return this.el.href}get _existingPrefetch(){return(document.head.querySelectorAll(`link[rel="prefetch"][href="${this._href}"]`)||[]).length>0}get _connectionSuitable(){const e=navigator.connection;if(!e)return!0;if(e){if(e.saveData)return Pe(this,"Data Saving is enabled"),!1;if(/2g/.test(e.effectiveType))return Pe(this,"Network is too slow"),!1}return!0}connect(){if(!!this._supportsPrefetch)switch(this._mode){case"intersect":this._setupObserver();break;case"mouseover":c(this,this.el,"mouseover",this.prefetch,{once:!0});break;default:throw new Error(`'${this._mode}' is not a supported prefetch mode`)}}_setupObserver(){new IntersectionObserver(([s],i)=>{s.isIntersecting&&(this.prefetch(),i.unobserve(s.target))}).observe(this.element)}prefetch(){if(this._existingPrefetch||!this._connectionSuitable)return;const e=document.createElement("link");Object.assign(e,{rel:"prefetch",href:this._href,as:"document"}),document.head.appendChild(e)}}n(ss,"values",{mode:String});class is extends Ut{get defaultUnsupportedClasses(){return["unsupported"]}connect(){y(this),"print"in window||this.addUnsupportedClasses(),c(this,this.el,"click",this.print)}}n(is,"classes",["unsupported"]);class js extends u{connect(){c(this,window,"message",this.messageReceived)}messageReceived(e){let s=e.data;s.hasOwnProperty("name")&&s.name==="iframe-body"&&s.hasOwnProperty("height")&&this.resize(s.height)}resize(e){this.el.style.height=`${e}px`}}class Ws extends u{connect(){window.self!==window.top&&(c(this,window,"resize",this.postUpdate,{debounce:200}),this.postUpdate())}postUpdate(){let e={name:"iframe-body",height:this.getHeight()};window.parent.postMessage(e,"*")}getHeight(){const e=document.body,s=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,s.clientHeight,s.scrollHeight,s.offsetHeight)}}class rs extends u{connect(){requestAnimationFrame(()=>{M(this,()=>this.el.remove(),this.secondsValue*1e3)})}}n(rs,"values",{seconds:Number});class Be extends u{constructor(){super(...arguments);n(this,"_magicElement",null)}get defaultStuckClasses(){return["stuck"]}get _mode(){if(this.hasModeValue){if(!["top","bottom"].includes(this.modeValue))throw new Error(`The modeValue provided '${this.modeValue}' is not one of the recognised configuration options`);if(this.modeValue==="top")return"beforebegin"}return"afterend"}connect(){this._magicElement=document.createElement("div"),ut(this,this.el,this._mode,this._magicElement),new IntersectionObserver(s=>{s.forEach(i=>{i.target===this._magicElement&&(i.intersectionRatio===0?this.addStuckClasses():i.intersectionRatio===1&&this.removeStuckClasses())})},{threshold:[0,1]}).observe(this._magicElement)}}n(Be,"classes",["stuck"]),n(Be,"values",{mode:String});class as extends ${connect(){if(!this.hasInsertValue)throw new Error("`insert` value was not specified");requestAnimationFrame(()=>{this.hasImmediateValue&&this.immediateValue&&this.execute()})}execute(e){e==null||e.preventDefault();let s=this.el,i=document.querySelector(this.targetValue);if(i==null){this.dispatchEvent(s,"teleport:error");return}let r=s.cloneNode(!0);switch(this.cleanup(r),this.insertValue){case"beforebegin":case"beforeend":case"afterend":case"afterbegin":i.insertAdjacentHTML(this.insertValue,r.outerHTML);break;case"replaceOuter":i.outerHTML=r.outerHTML;break;case"replaceInner":i.innerHTML=r.outerHTML;break;case"prepend":i.insertAdjacentHTML("afterbegin",r.outerHTML);break;case"append":i.insertAdjacentHTML("beforeend",r.outerHTML);break;default:throw new Error("`insert` value was not specified")}s.remove()}}n(as,"values",{target:String,insert:String,immediate:Boolean});class ns extends ${constructor(){super(...arguments);n(this,"_previousState",{})}get _value(){if(this.hasValueValue)return this.valueValue;throw new Error("Expected `valueValue` to be present")}get _attribute(){if(this.hasAttributeValue)return this.attributeValue;throw new Error("Expected `attributeValue` to be present")}get _seconds(){if(this.hasSecondsValue)return this.secondsValue*1e3;throw new Error("Expected `secondsValue` to be present")}connect(){this.setState(),M(this,this.removeState,this._seconds)}disconnect(){this.removeState()}setState(){this._previousState[this._attribute]=p.get(this.el,this._attribute),p.set(this.el,this._attribute,this.valueValue)}removeState(){p.set(this.el,this._attribute,this._previousState[this._attribute])}}n(ns,"values",{attribute:String,seconds:Number,value:String});function ls(t,e,s,i,r="temporary-state"){var a;(!t.dataset.controller||!((a=t.dataset.controller)==null?void 0:a.includes(r)))&&(t.dataset.controller=(t.dataset.controller||` ${r} `).trim().replaceAll(" "," ")),t[p.camelCase(`${r}-attribute-value`)]=e,t[p.camelCase(`${r}-seconds-value`)]=i.toString()}function Ks(t,e,s){ls(t,"className",e,s)}function Gs(t,e,s){s=s.bind(t);const i=a=>{e.contains(a.target)||!rt(e)||s(a)};let{teardown:r}=c(t,window,["click","touchend"],i);return v(t,()=>{},r),{teardown:r}}function Js(t,e,s,i){let r=null,a=null;if(s){s=s.bind(t);let{teardown:o}=c(t,e,"mouseenter",s);r=o}if(i){i=i.bind(t);let{teardown:o}=c(t,e,"mouseleave",i);a=o}let l=()=>{},h=()=>{r&&r(),a&&a()};return v(t,l,h),{teardown:h}}class Fe extends u{connect(){if(!this.hasClassValue)throw new Error("data-toggle-class-class-value must not be empty");(this.hasMouseEnterValue||this.hasMouseLeaveValue)&&Js(this,this.el,this.mouseEnter,this.mouseLeave),this.hasClickAwayValue&&this.clickAwayValue&&Gs(this,this.el,this.clickOutside),requestAnimationFrame(()=>{this.hasInitialValue&&(this.initialValue==="on"?this.toggleTargets.forEach(e=>this._elementOn(e)):this.toggleTargets.forEach(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();break}return{}}mouseLeave(){if(this.hasMouseLeaveValue)switch(this.mouseLeaveValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle();break}return{}}on(e){this.toggleTargets.forEach(s=>{this._elementToggleStatus(s),this._elementOn(s)})}off(e){this.toggleTargets.forEach(s=>{this._elementToggleStatus(s),this._elementOff(s)})}toggle(e){this.toggleTargets.forEach(s=>{this._elementToggleStatus(s),this._elementToggle(s)})}_elementWasToggled(e){return e.dataset.toggled=="true"}_elementToggleStatus(e){this._elementWasToggled(e)?delete e.dataset.toggled:e.dataset.toggled="true"}_elementToggle(e){this.classValue.split(" ").forEach(i=>e.classList.toggle(i))}_elementOn(e){this.classValue.split(" ").forEach(i=>e.classList.toggle(i,!0))}_elementOff(e){this.classValue.split(" ").forEach(i=>e.classList.toggle(i,!1))}}n(Fe,"targets",["toggle"]),n(Fe,"values",{class:String,mouseEnter:String,mouseLeave:String,clickAway:Boolean,initial:String});function Xs(t){const e=t.disconnect.bind(t);let s=!1,i=(o,d)=>{o.forEach(f=>{f.type==="childList"&&Array.from(f.addedNodes).some(g=>g.tagName==="TRIX-TOOLBAR")&&(l(),d.disconnect())})},r=o=>O(t,"pasteEvent").call(t,o),a=new MutationObserver(i),l=()=>{if(t.element.tagName!=="TRIX-EDITOR")throw new Error("Expected controller to be mounted on an instance of <trix-editor>");let o=t.element,d=t.element.parentElement;if(d==null)throw new Error("Could not traverse DOM tree from <trix-editor>");o.addEventListener("trix-paste",r);let f=d.querySelector("trix-toolbar");if(!s&&!f){s=!0,a.observe(d,{childList:!0});return}else if(f)a.disconnect();else throw new Error("Could not find an instance of <trix-toolbar> that is a sibling of this <trix-editor>");O(t,"install").call(t,{toolbar:f,editor:o})},h=()=>{if(t.element.tagName!=="TRIX-EDITOR")throw new Error("Expected controller to be mounted on an instance of <trix-editor>");let o=t.element,d=t.element.parentElement;if(d==null)throw new Error("Could not traverse DOM tree from <trix-editor>");o.removeEventListener("trix-paste",r);let f=d.querySelector("trix-toolbar");if(!f)throw new Error("Could not find <trix-toolbar> that is a sibling of this <trix-editor> element");O(t,"uninstall").call(t,{toolbar:f,editor:o})};l(),Object.assign(t,{disconnect(){a.disconnect(),h(),O(t,"uninstall").call({toolbar,editor:t.element}),e()}})}class Ys extends u{get enabledBehaviours(){let e=i=>i!==void 0&&i!=="false",s=(i,r)=>e(i)?[r]:[];return[...s(this.el.dataset.noBold,this.bold),...s(this.el.dataset.noBulletList,this.bulletList),...s(this.el.dataset.noCode,this.code),...s(this.el.dataset.noHeading,this.heading),...s(this.el.dataset.noItalic,this.italic),...s(this.el.dataset.noStrikethrough,this.strikethrough),...s(this.el.dataset.noLink,this.link),...s(this.el.dataset.noIndents,this.indents),...s(this.el.dataset.noNumberList,this.numberList),...s(this.el.dataset.noQuote,this.quote),...s(this.el.dataset.noFileUploads,this.fileUploads)]}get bold(){return this.formattingHandlers(".trix-button--icon-bold","bold")}get bulletList(){return this.formattingHandlers(".trix-button--icon-bullet-list","bullet-list")}get code(){return this.formattingHandlers(".trix-button--icon-code","code")}get heading(){return this.formattingHandlers(".trix-button--icon-heading-1","heading")}get italic(){return this.formattingHandlers(".trix-button--icon-italic","italic")}get strikethrough(){return this.formattingHandlers(".trix-button--icon-strike","strike")}get link(){return this.formattingHandlers(".trix-button--icon-link","href")}get indents(){return this.simpleHideShowHandlers([".trix-button--icon-decrease-nesting-level, .trix-button--icon-increase-nesting-level",".trix-button--icon-decrease-nesting-level, .trix-button--icon-increase-nesting-level"].join(", "))}get numberList(){return this.simpleHideShowHandlers(".trix-button--icon-number-list")}get quote(){return this.simpleHideShowHandlers(".trix-button--icon-quote")}get fileUploads(){let e=".trix-button-group.trix-button-group--file-tools",s=a=>a==null?void 0:a.preventDefault(),i=this,r=this.el;return{install(a){i.simpleHideShowHandlers(e).install(a),i.el.addEventListener("trix-file-accept",s)},pasteEvent(a){let{dataTransfer:l,html:h}=a.paste,{editor:o}=r;(l.files.length>0||h.includes("<img"))&&(alert("The content you pasted contains images and/or files. File uploads are not supported."),o.undo())},uninstall(a){i.simpleHideShowHandlers(e).uninstall(a),i.el.removeEventListener("trix-file-accept",s)}}}connect(){Xs(this)}install(e){this.enabledBehaviours.forEach(s=>s.install(e))}pasteEvent(e){this.enabledBehaviours.forEach(s=>s.pasteEvent&&s.pasteEvent(e))}uninstall(e){this.enabledBehaviours.forEach(s=>s.uninstall(e))}simpleHideShowHandlers(e){return{install:({toolbar:s})=>this.hideToolbarSelector(s,e),uninstall:({toolbar:s})=>this.showToolbarSelector(s,e)}}formattingHandlers(e,s){let i=this.el,{editor:r}=i;return{install:a=>{this.simpleHideShowHandlers(e).install(a)},pasteEvent(a){let{range:l}=a.paste,h=i.editor.getSelectedRange();r.setSelectedRange(l),r.deactivateAttribute(s),r.setSelectedRange(h)},uninstall:a=>{this.simpleHideShowHandlers(e).uninstall(a)}}}showToolbarSelector(e,s){e.querySelectorAll(s).forEach(i=>i.style.display="")}hideToolbarSelector(e,s){e.querySelectorAll(s).forEach(i=>i.style.display="none")}}class os extends u{toggle(e){e==null||e.preventDefault();let i=this._getFrame().src;i==null||i!==this._getSrc()?this._setSrc():this._clear()}setSrc(e){e==null||e.preventDefault(),this._setSrc()}clear(e){e==null||e.preventDefault(),this._clear()}_setSrc(){let e=this._getFrame();this.hasLoadingMessageValue&&(e.innerHTML=this.loadingMessageValue),e.src=this._getSrc()}_clear(){let e=this._getFrame();e.src="",e.innerHTML=""}_getFrame(){let e=document.getElementById(`${this.frameIdValue}`);if(e==null)throw new Error(`Could not find frame with ID '${this.frameIdValue}'`);if(oe(e))return e;throw new Error(`Element targeted by ID '${this.frameIdValue}'`)}_getSrc(){let e=this.el;if(this.hasSrcValue)return this.srcValue;if(ue(e))return e.href;throw new Error("No link given to drive frame to")}}n(os,"values",{frameId:String,src:String,loadingMessage:String});class us extends u{get _poll(){return this.hasPollValue?this.pollValue:!1}connect(){let e=this.el;if(oe(e)){if(e.src)throw new Error("The provided <turbo-frame> element has no `src` attribute.")}else throw new Error("Expected controller to be mounted on a <turbo-frame> element.");this._poll&&requestAnimationFrame(()=>M(this,this.refresh,this.intervalValue))}refresh(e){e==null||e.preventDefault();let s=this.el;s.src=s.src}}n(us,"values",{interval:Number,poll:Boolean});exports.AlertController=qt;exports.AnchorSpyController=Ne;exports.AsyncBlockController=_e;exports.AutoSubmitFormController=ft;exports.AutosizeController=As;exports.BackLinkController=Xt;exports.BaseController=u;exports.CharCountController=G;exports.CheckboxDisableInputsController=we;exports.CheckboxEnableInputsController=ye;exports.CheckboxSelectAllController=gt;exports.CheckboxXORController=pt;exports.ClipboardController=He;exports.ClockController=Wt;exports.ConfirmController=Yt;exports.ConfirmNavigationController=Zt;exports.CountdownController=Q;exports.DebugController=Qt;exports.DetectDirtyController=Ls;exports.DetectDirtyFormController=Ns;exports.DisableWithController=es;exports.DismissableController=ts;exports.DurationController=Kt;exports.ElementSaveController=Oe;exports.EmptyDomController=te;exports.EnableInputsController=Ee;exports.EphemeralController=$;exports.EventBus=S;exports.FallbackImageController=ke;exports.FocusStealController=bt;exports.FormRcController=Te;exports.FormSaveController=vt;exports.FullscreenController=$s;exports.IntersectionController=Pt;exports.IntervalController=$t;exports.LazyBlockController=Ms;exports.LightboxImageController=Ae;exports.LimitedSelectionCheckboxesController=Ce;exports.LoadBlockController=D;exports.MediaPlayerController=Mt;exports.NavigateFormErrorsController=J;exports.NestedFormController=Se;exports.PasswordConfirmController=Ve;exports.PasswordPeekController=wt;exports.PollBlockController=ve;exports.PrefetchController=ss;exports.PresenceController=zt;exports.PrintButtonController=is;exports.PrintController=Ut;exports.RemoteFormController=xe;exports.RemoveController=Us;exports.ResponsiveIframeBodyController=Ws;exports.ResponsiveIframeWrapperController=js;exports.ScrollContainerController=At;exports.ScrollIntoFocusController=Dt;exports.ScrollToBottomController=Lt;exports.ScrollToController=It;exports.ScrollToTopController=Nt;exports.SelfDestructController=rs;exports.SignalActionController=Ot;exports.SignalDomChildrenController=Bt;exports.SignalInputController=Ft;exports.SignalVisibilityController=Le;exports.StickyController=Be;exports.StorageSerializers=ht;exports.SyncInputsController=yt;exports.TableSortController=Rt;exports.TableTruncateController=Ie;exports.TabsController=ee;exports.TeleportController=as;exports.TemporaryStateController=ns;exports.TimeDistanceController=Gt;exports.TimeoutController=jt;exports.ToggleClassController=Fe;exports.TreeViewController=Jt;exports.TrixModifierController=Ys;exports.TurboFrameRCController=os;exports.TurboFrameRefreshController=us;exports.UserFocusController=zs;exports.ValueWarnController=X;exports.WordCountController=Y;exports.applyTemporaryClass=Ks;exports.applyTemporaryState=ls;exports.createHiddenButton=st;exports.createHiddenInput=it;exports.getAllRadiosInGroup=me;exports.getOtherRadiosInGroup=fe;exports.getScrollParent=z;exports.insertElement=ce;exports.insertHiddenButton=de;exports.insertHiddenInput=Cs;exports.isDirty=Is;exports.isElementCheckable=V;exports.isElementInViewport=rt;exports.isFormDirty=_t;exports.isHTMLAnchorElement=ue;exports.isHTMLButtonButtonElement=Xe;exports.isHTMLButtonElement=ys;exports.isHTMLButtonInputElement=Ts;exports.isHTMLFormElement=he;exports.isHTMLImageElement=Es;exports.isHTMLInputElement=_;exports.isHTMLLabelElement=ws;exports.isHTMLLinkElement=vs;exports.isHTMLResetButtonElement=Ze;exports.isHTMLResetInputElement=Je;exports.isHTMLSelectElement=A;exports.isHTMLSubmitButtonElement=Ye;exports.isHTMLSubmitInputElement=Ge;exports.isHTMLTextAreaElement=U;exports.isTurboFrame=oe;exports.isTypeOfButtonableElement=j;exports.isTypeOfFormInputElement=tt;exports.isTypeOfResetButtonElement=Qe;exports.isTypeOfSubmitButtonElement=et;exports.requestReset=at;exports.requestSubmit=ge;exports.scrollAbsoluteBottom=ne;exports.scrollAbsoluteLeft=le;exports.scrollAbsoluteRight=_s;exports.scrollAbsoluteTop=ae;exports.scrollDown=je;exports.scrollLeft=We;exports.scrollRight=Ke;exports.scrollToElement=x;exports.scrollUp=Ue;exports.useCollectionEventListener=k;exports.useCollectionEventListeners=Ss;exports.useEventListener=c;exports.useEventListeners=lt;exports.useFullscreen=ot;exports.useGeolocation=Vs;exports.useInjectedElement=ut;exports.useInjectedFragment=pe;exports.useInjectedHTML=xs;exports.useInterval=H;exports.useLocalStorage=ct;exports.useTemporaryContent=dt;exports.useTimeout=M;
|
|
1
|
+
"use strict";var cs=Object.defineProperty;var Re=Object.getOwnPropertySymbols;var ds=Object.prototype.hasOwnProperty,ms=Object.prototype.propertyIsEnumerable;var se=(t,e,s)=>e in t?cs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,ie=(t,e)=>{for(var s in e||(e={}))ds.call(e,s)&&se(t,s,e[s]);if(Re)for(var s of Re(e))ms.call(e,s)&&se(t,s,e[s]);return t};var n=(t,e,s)=>(se(t,typeof e!="symbol"?e+"":e,s),s);Object.defineProperty(exports,"__esModule",{value:!0});exports[Symbol.toStringTag]="Module";var fs=require("stimulus"),p=require("lodash-es"),w=require("date-fns");function gs(t){if(t&&t.__esModule)return t;var e={__proto__:null,[Symbol.toStringTag]:"Module"};return t&&Object.keys(t).forEach(function(s){if(s!=="default"){var i=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:function(){return t[s]}})}}),e.default=t,Object.freeze(e)}function ps(t){switch(t){case"application":case"el":case"element":case"constructor":case"initialize":case"log":case"logEvent":case"dispatch":case"data":case"valueDescriptorMap":case"mutate":case"identifier":return!1}return!(/^_.*?$/.test(t)||/^.*?Target(s)?$/.test(t)||/^.*?Value$/.test(t)||/^.*?ValueChanged$/.test(t)||/^.*?Class$/.test(t)||/^.*?Classes$/.test(t)||/^.*?ClassesPresent$/.test(t))}function qe(t,e,s={}){if(!t.application.debug)return;let i=console;i.groupCollapsed(...H(t.identifier,"#3B82F6"),`#${e}`),i.log(ie({element:t.element,controller:t},s)),i.groupEnd()}function Pe(t,e,s={}){if(!t.application.debug)return;let i=console;i.groupCollapsed(...H(t.identifier,"#F39B1AFF"),`!! ${e} !!`),i.warn(ie({element:t.element,controller:t},s)),i.groupEnd()}function _s(t,e,s,i){if(!t.application.debug)return;let r=console;r.groupCollapsed(...$e([{text:t.identifier,color:"#3B82F6"},{text:e,color:"#0be000"}]),s.detail),r.log(...H("Dispatched on","#3b82f6"),i),r.log(...H("event","#3b82f6"),s),r.log(...H("event details","#3b82f6"),s.detail),r.groupEnd()}function H(t,e){return $e([{text:t,color:e}])}function $e(t){let e="",s=t.flatMap(i=>(e+=`%c${i.text}%c `,[`color: ${i.color}`,"color: unset"]));return[e,...s]}function re(t,e,s,i={}){let r=Object.assign({},{bubbles:!0,cancelable:!0,detail:{target:e}},i);r.detail.target||(r.detail.target=e);let a=new CustomEvent(s,r);_s(t,s,a,e),e.dispatchEvent(a)}class u extends fs.Controller{constructor(e){super(e);return this.application.debug?new Proxy(this,{get:(s,i)=>{let r=Reflect.get(s,i),a=this;if("logFormattedMessage"in this.application)return r;if(ps(i.toString())){if(typeof r=="function")return new Proxy(r,{apply(l,h,o){return qe(a,i.toString(),{args:o}),Reflect.apply(l,h,o)}});qe(this,i.toString())}return r}}):this}get el(){return this.element}get isTurboPreview(){return document.documentElement.hasAttribute("data-turbo-preview")||document.documentElement.hasAttribute("data-turbolinks-preview")}get isTurbolinksPreview(){return this.isTurboPreview}get csrfToken(){return this.metaValue("csrf-token")}metaValue(e){const s=document.head.querySelector(`meta[name="${e}"]`);return(s==null?void 0:s.getAttribute("content"))||null}dispatchEvent(e,s,i={}){re(this,e,s,i)}}class $ extends u{_cleanupSelf(){this.cleanup(this.el)}cleanup(e){var a,l,h;e.dataset.controller=((a=e.dataset.controller)==null?void 0:a.replaceAll(new RegExp(`(\\s|^)${this.identifier}(\\s|$)`,"g"),""))||"",e.dataset.controller==""&&delete e.dataset.controller;let s=new RegExp(`(\\s|^)${this.identifier}\\..+?(\\s|$)`,"g");e.dataset.target=((l=e.dataset.target)==null?void 0:l.replaceAll(s,""))||"",delete e.dataset[p.camelCase(`${this.identifier}-target`)],e.dataset.target==""&&delete e.dataset.target,e.dataset.action=((h=e.dataset.target)==null?void 0:h.replaceAll(s,""))||"",delete e.dataset[p.camelCase(`${this.identifier}-action`)],e.dataset.action==""&&delete e.dataset.action;let i=this.constructor.values;i&&Object.keys(i).forEach(o=>delete e.dataset[p.camelCase(`${this.identifier}-${o}-value`)]);let r=this.constructor.classes;r&&Object.keys(r).forEach(o=>delete e.dataset[p.camelCase(`${this.identifier}-${o}-class`)])}}const T="scrollBehavior"in document.documentElement.style;let ze;async function x(t,{behavior:e="smooth",block:s="start",inline:i="nearest"}={}){e=="smooth"&&!T&&await C(),t.scrollIntoView({behavior:e,block:s,inline:i})}async function ae(t,{behavior:e="smooth"}={}){e=="smooth"&&!T&&await C(),t.scrollTo({top:0,left:0,behavior:e})}async function ne(t,{behavior:e="smooth"}={}){e=="smooth"&&!T&&await C(),t==window?t.scrollTo({top:document.body.scrollHeight,left:0,behavior:e}):t.scrollTo({top:t.scrollHeight,left:0,behavior:e})}async function le(t,{behavior:e="smooth"}={}){e=="smooth"&&!T&&await C(),t.scrollTo({left:0,behavior:e})}async function bs(t,{behavior:e="smooth"}={}){e=="smooth"&&!T&&await C(),t==window?t.scrollTo({left:document.body.scrollWidth,behavior:e}):t.scrollTo({left:t.scrollWidth,behavior:e})}async function Ue(t,e,{behavior:s="smooth"}={}){s=="smooth"&&!T&&await C(),t.scrollBy({top:-e,left:0,behavior:s})}async function je(t,e,{behavior:s="smooth"}={}){s=="smooth"&&!T&&await C(),t.scrollBy({top:e,left:0,behavior:s})}async function We(t,e,{behavior:s="smooth"}={}){s=="smooth"&&!T&&await C(),t.scrollBy({top:0,left:-e,behavior:s})}async function Ke(t,e,{behavior:s="smooth"}={}){s=="smooth"&&!T&&await C(),t.scrollBy({top:0,left:e,behavior:s})}async function C(){const{polyfill:t}=await Promise.resolve().then(function(){return gs(require("smoothscroll-polyfill"))});ze||(ze=!0,t())}function z(t){if(!t)return null;if(t==document.body)return window;const e=getComputedStyle(t).overflowY;return e!=="visible"&&e!=="hidden"&&t.scrollHeight>=t.clientHeight?t:z(t.parentElement)||document.body}function oe(t){return t.nodeName=="TURBO-FRAME"}function vs(t){return{all:t=t||new Map,on:function(e,s){var i=t.get(e);i?i.push(s):t.set(e,[s])},off:function(e,s){var i=t.get(e);i&&(s?i.splice(i.indexOf(s)>>>0,1):t.set(e,[]))},emit:function(e,s){var i=t.get(e);i&&i.slice().map(function(r){r(s)}),(i=t.get("*"))&&i.slice().map(function(r){r(e,s)})}}}const S=vs();function ws(t){return t.nodeName=="LINK"}function ue(t){return t.nodeName=="A"}function he(t){return t.nodeName=="FORM"}function _(t){return t.nodeName=="INPUT"}function ys(t){return t.nodeName=="LABEL"}function U(t){return t.nodeName=="TEXTAREA"}function Es(t){return t.nodeName=="BUTTON"}function A(t){return t.nodeName=="SELECT"}function Ts(t){return t.nodeName=="IMG"}function Cs(t){return t.nodeName=="INPUT"&&t.type=="button"}function Ge(t){return t.nodeName=="INPUT"&&t.type=="submit"}function Je(t){return t.nodeName=="INPUT"&&t.type=="reset"}function Xe(t){return t.nodeName=="BUTTON"&&t.type=="button"}function Ye(t){return t.nodeName=="BUTTON"&&t.type=="submit"}function Ze(t){return t.nodeName=="BUTTON"&&t.type=="reset"}function Qe(t){return Ze(t)||Je(t)}function et(t){return Ye(t)||Ge(t)}function j(t){return Qe(t)||et(t)||Xe(t)}function V(t){return _(t)&&(t.type==="radio"||t.type==="checkbox")}function tt(t){return _(t)||A(t)||U(t)}function st(t){let e=document.createElement("button");return e.type=t,e.style.display="none",e.dataset.sythentic="true",e}function it(t,e){let s=document.createElement("input");return s.type="hidden",s.name=t,s.value=e,s}function ce(t,e,s){let i=t.insertAdjacentElement(e,s);if(!i)throw new Error(`Failed to insert element ${s.nodeName} into ${t.nodeName}`);return i}function Ss(t,e,s,i){return ce(s,i,it(t,e))}function de(t,e,s){return ce(e,s,st(t))}function me(t){let e=t.form||document;return Array.from(e.querySelectorAll(`input[type="radio"][name="${t.name}"]`))}function fe(t){return me(t).filter(e=>e!==t)}function rt(t){const e=t.getBoundingClientRect(),s=window.innerHeight||document.documentElement.clientHeight,i=window.innerWidth||document.documentElement.clientWidth,r=e.top<=s&&e.top+e.height>=0,a=e.left<=i&&e.left+e.width>=0;return r&&a}function ge(t){if(t.requestSubmit)t.requestSubmit();else{let e=t.querySelector('button[type="submit"]');e||(e=de("submit",t,"beforeend")),e.click()}}function at(t){let e=t.querySelector('button[type="reset"]');e||(e=de("reset",t,"beforeend")),e.click()}function nt(t){return Array.isArray(t)?t:[t]}function v(t,e,s){const i=t.disconnect.bind(t);return e(),Object.assign(t,{disconnect(){s(),i()}}),i}function c(t,e,s,i,r){(r==null?void 0:r.debounce)?(i=p.debounce(i.bind(t),r.debounce),delete r.debounce):i=i.bind(t);let a=nt(s),l=()=>a.forEach(o=>e.addEventListener(o,i,r)),h=()=>a.forEach(o=>e.removeEventListener(o,i));return v(t,l,h),{setup:l,teardown:h}}function lt(t,e,s,i,r){return c(t,e,s,i,r)}function k(t,e,s,i,r){let a=[];return e.forEach(l=>{let{setup:h,teardown:o}=c(t,l,s,i,r);a.push({setup:h,teardown:o})}),[()=>a.forEach(l=>l.setup()),()=>a.forEach(l=>l.teardown())]}function Vs(t,e,s,i,r){return k(t,e,s,i,r)}function ot(t,e){let s=e||document.documentElement,i=document.fullscreenElement!==null;const r=()=>i=document.fullscreenElement!==null,a=()=>i,l=async()=>i?await d():await f();let h=()=>document.addEventListener("fullscreenchange",r),o=()=>document.removeEventListener("fullscreenchange",r);const d=async()=>{document.exitFullscreen&&(i=!1,await document.exitFullscreen())},f=async()=>{i&&await d(),s.requestFullscreen&&(await s.requestFullscreen(),i=!0)};return v(t,h,o),{isFullscreen:a,enter:f,exit:d,toggle:l,teardown:o}}function W(t){if(t===null||typeof t!="object")return t;for(const e in t)Object.getOwnPropertyDescriptor(t,e)!=null&&(t[e]=W(t[e]));return new Proxy(t,{get(e,s){return e[s]},set(e,s,i){return e[s]=W(i),!0}})}function xs(t,e={},s,i){s&&(s=s.bind(t)),i&&(i=i.bind(t));const{enableHighAccuracy:r=!0,maximumAge:a=3e4,timeout:l=27e3}=e,h=navigator&&"geolocation"in navigator,o=W({locatedAt:null,error:null,coords:{accuracy:0,latitude:1/0,longitude:1/0,altitude:null,altitudeAccuracy:null,heading:null,speed:null},teardown:()=>{f&&(navigator.geolocation.clearWatch(f),f=null)}});let d=()=>{h&&(f=navigator.geolocation.watchPosition(g=>{o.locatedAt=g.timestamp,o.coords=g.coords,o.error=null,s&&s(g)},g=>{o.error=g,i&&i(g)},{enableHighAccuracy:r,maximumAge:a,timeout:l}))},f=null;return v(t,d,o.teardown),o}function pe(t,e,s,i,r={}){let a=Array.from(i.childNodes),l=()=>{let o=e.parentElement;if(["beforebegin","afterend"].includes(s)&&o==null)throw new Error("Cannot insert beforebegin into a node with no parent");switch(s){case"beforeend":e.append(i);break;case"afterbegin":e.prepend(i);break;case"beforebegin":o.insertBefore(i,e);break;case"afterend":o.insertBefore(i,e);break}},h=r.cleanup?()=>a.forEach(o=>o.remove()):()=>{};return v(t,l,h),[a,h]}function ks(t,e,s,i,r={}){const a=document.createRange().createContextualFragment(i);return pe(t,e,s,a,r)}function ut(t,e,s,i,r={}){const a=new DocumentFragment;a.append(i);let[l,h]=pe(t,e,s,a,r);return[l[0],h]}function O(t,e,s){e=e.bind(t);let i=null,r=()=>i=setInterval(e,s),a=()=>{i!==null&&clearInterval(i)};return v(t,r,a),a}const ht={boolean:{deserialize:t=>t==="true",serialize:t=>String(t),isEmpty:t=>t===""||t===null},object:{deserialize:t=>JSON.parse(t),serialize:t=>JSON.stringify(t),isEmpty:t=>{const e=Object.values(JSON.parse(t));return e.length===0||e.every(s=>s===""||s===null)}},number:{deserialize:t=>Number.parseFloat(t),serialize:t=>String(t),isEmpty:t=>t===""||t===null},any:{deserialize:t=>t,serialize:t=>String(t),isEmpty:t=>t===""||t===null},string:{deserialize:t=>t,serialize:t=>String(t),isEmpty:t=>t===""||t===null},map:{deserialize:t=>new Map(JSON.parse(t)),serialize:t=>JSON.stringify(Array.from(t.entries())),isEmpty:t=>{const e=Array.from(t.values());return e.length===0||e.every(s=>s===""||s===null)}},set:{deserialize:t=>new Set(JSON.parse(t)),serialize:t=>JSON.stringify(Array.from(t.entries())),isEmpty:t=>{const e=Array.from(t.values());return e.length===0||e.every(s=>s===""||s===null)}}};function ct(t,e,s,i={writeDefaults:!0}){let r,{writeDefaults:a}=i;s==null?r="any":s instanceof Set?r="set":s instanceof Map?r="map":typeof s=="boolean"?r="boolean":typeof s=="string"?r="string":typeof s=="object"||Array.isArray(s)?r="object":Number.isNaN(s)?r="any":r="number";let l=W({value:s}),h=localStorage;const o=ht[r],d=()=>{const b=h.getItem(e);return b==null?(l.value=s,a&&s!==null&&h.setItem(e,o.serialize(s))):l.value=o.deserialize(b),l.value},f=b=>{h.setItem(e,o.serialize(b)),l.value=b},g=()=>(h.removeItem(e),l.value=s,l.value),E=()=>{let b=h.getItem(e);return o.isEmpty(b)};return d(),{get value(){return d()},set value(b){f(b)},read:d,clear:g,write:f,isEmpty:E}}function M(t,e,s){let i,r=null;e=e.bind(t);let a=()=>{e(),r=null,Object.assign(t,{disconnect:i})},l=()=>r=setTimeout(a,s),h=()=>{r!==null&&(clearTimeout(r),r=null)};return i=v(t,l,h),h}function dt(t,e,s,i,r){const a=(g,E)=>{_(g)?g.value=E:g.textContent=E},l=g=>_(g)?g.value:g.innerHTML;let h=()=>{},o=l(e);const d=()=>{a(e,o),h(),r&&r.call(t)};return v(t,()=>{a(e,s),i!==void 0&&(h=M(t,d,i))},d),{teardown:d,update(g){a(e,g)}}}async function mt(t,e,s){try{return await fetch(e,s)}catch(i){if(t===1)throw i;return await mt(t-1,e,s)}}class D extends u{get _errorMessage(){return this.hasErrorMessageValue?this.errorMessageValue:"This content failed to load"}get _maxRetries(){return this.hasMaxRetriesValue?this.maxRetriesValue:1}connect(){}async loadContent(e=null){e==null||e.preventDefault();let s=this,i=this.hasReplaceTarget?this.replaceTarget:this.el,r=()=>{i.replaceWith(this._errorMessage),s.dispatchEvent(i,"ajax:error")};try{let a=await mt(this._maxRetries,this.endpointValue);a.ok||r();let l=await a.text(),h=document.createElement("div");if(h.innerHTML=l,this.hasSelectorValue){let o=h.querySelectorAll(this.selectorValue);i.replaceWith(...o)}else i.replaceWith(...h.children);s.dispatchEvent(i,"ajax:success")}catch{r()}finally{s.dispatchEvent(i,"ajax:complete")}}}n(D,"targets",["replace"]),n(D,"values",{endpoint:String,errorMessage:String,selector:String,maxRetries:Number});class _e extends D{get _errorMessage(){return this.hasErrorMessageValue?this.errorMessageValue:"This content failed to load"}async connect(){await this.loadContent()}}n(_e,"targets",["replace"]),n(_e,"values",{endpoint:String,errorMessage:String,selector:String,maxRetries:Number});function Ms(t,e,s){e=e.bind(t);let i=new IntersectionObserver(e,s);return{observer:i,teardown:()=>{i==null||i.disconnect(),i=null},observe:h=>i==null?void 0:i.observe(h),unobserve:h=>i==null?void 0:i.unobserve(h)}}function be(t,e,s,i,r){s&&(s=s.bind(t)),i&&(i=i.bind(t));let a=r!=null?r:{},l=E=>{E.forEach(b=>{b.isIntersecting?s&&s(b):i&&i(b)})},{observer:h,observe:o,unobserve:d,teardown:f}=Ms(t,l,a);return v(t,()=>o(e),f),{observer:h,observe:()=>o(e),unobserve:()=>d(e),teardown:f}}class As extends D{async connect(){let e=this.el;if("IntersectionObserver"in window){let{observe:s,unobserve:i}=be(this,e,this.appear,null,{threshold:.3});this.observe=s,this.unobserve=i}else await this.loadContent()}async appear(e){e.target===this.el&&e.isIntersecting&&(await this.loadContent(),this.unobserve&&this.unobserve())}}class ve extends D{connect(){if(!this.hasSecondsValue)throw new Error("Required value `seconds` is missing");requestAnimationFrame(()=>{this._timeout(),O(this,this._timeout,this.secondsValue*1e3)})}async _timeout(){await this.loadContent()}}n(ve,"targets",["replace"]),n(ve,"values",{endpoint:String,errorMessage:String,selector:String,maxRetries:Number,seconds:Number});class ft extends u{get _eventModes(){if(this.hasEventModeValue){let e=this.eventModeValue.split(" ").map(s=>s.trim());if(e.length===1&&e[0]==="debounced")return["change","input"];if(!e.every(s=>["change","input"].includes(s)))throw new Error(`The modeValue provided '${this.eventModeValue}' is not one of the recognised configuration options`);return e}else return["change"]}get _debounceTimeout(){return this.hasDebounceIntervalValue?this.debounceIntervalValue:-1}get _mode(){if(this.hasSubmitModeValue){if(!["direct","request"].includes(this.submitModeValue))throw new Error(`The modeValue provided '${this.submitModeValue}' is not one of the recognised configuration options`);return this.submitModeValue}else return"request"}get _cssSelector(){let e=["input","textarea","select"],s=":not([data-no-autosubmit])";return e.map(i=>i.concat(s)).join(",")}get inputElements(){let e=Array.from(this.element.querySelectorAll(this._cssSelector));return e=e.filter(s=>!this._ancestorIsTrix(s)),e}connect(){this.inputElements.forEach(e=>c(this,e,this._eventModes,this.submit,{debounce:this._debounceTimeout&&this._debounceTimeout>0?this._debounceTimeout:void 0}))}_ancestorIsTrix(e){return e.closest("trix-toolbar")!==null&&e.closest("trix-editor")!==null}submit(){let e=this.el;this._mode=="request"?ge(e):e.submit()}}n(ft,"values",{submitMode:String,eventMode:String,debounceInterval:Number});class Ds extends u{connect(){let{teardown:e}=be(this,this.el,this.appear);if(this._unobserveIntersection=e,!U(this.el))throw new Error(`Expected controller to be attached to a textarea, but was a '${this.el.tagName}'`);requestAnimationFrame(()=>{this.el.style.resize="none",this.el.style.boxSizing="border-box",this._handler(),c(this,window,["resize"],this._handler),c(this,this.el,["input","change","focus"],this._handler,{debounce:100})})}appear(e){this.autosize(this.el),this._unobserveIntersection()}_handler(){this.autosize(this.el)}autosize(e){let s=e.offsetHeight-e.clientHeight;e.style.height="auto",e.style.height=e.scrollHeight+s+"px"}}function B(t,e){const s=t[e];return typeof s=="function"?s:s!=null?()=>s:()=>{}}function K(t){return p.upperFirst(p.camelCase(t))}function Ls(t,e){let s=t.element,i=()=>t[`has${K(e)}Class`]==!0,r=()=>t[`${e}Classes`],a=()=>B(t,`default${K(e)}Classes`).call(t)||[],l=()=>i()?r():a();t[`${e}Classes`]==null&&Object.defineProperty(t,`${e}Classes`,{get:()=>i()?t[`${e}Class`].split(" "):a()});let h={[`add${K(e)}Classes`]:(o=s)=>o.classList.add(...l()),[`remove${K(e)}Classes`]:(o=s)=>o.classList.remove(...l()),[`${e}ClassesPresent`]:(o=s)=>l().every(d=>o.classList.contains(d))};Object.assign(t,h)}function y(t){(t.constructor.classes||[]).forEach(s=>Ls(t,s))}class G extends u{connect(){y(this),requestAnimationFrame(()=>{c(this,this.inputTarget,"input",this._updateCharCount),this._updateCharCount()})}_updateCharCount(){let e=this.inputTarget.value.length;this.outputTarget.innerText=e.toString(),this._isValidCount(e)?this.removeErrorClasses(this.outputTarget):this.addErrorClasses(this.outputTarget)}_isValidCount(e){let s=0,i=99999;return this.hasMinValue&&(s=this.minValue),this.hasMaxValue&&(i=this.maxValue),e>=s&&e<=i}}n(G,"targets",["input","output"]),n(G,"values",{min:Number,max:Number}),n(G,"classes",["error"]);class we extends u{connect(){this.toggle()}toggle(){this.hasDisablerTarget&&this.disablerTarget.checked?this.disable():this.enable()}disable(){let e=this.hasClearValue&&this.clearValue;this.disableTargets.forEach((s,i)=>{e&&(s.value=""),s.disabled=!0})}enable(){this.disableTargets.forEach((e,s)=>{e.disabled=!1})}}n(we,"targets",["disabler","disable"]),n(we,"values",{clear:Boolean});class ye extends u{connect(){this.toggle()}toggle(){this.hasEnablerTarget&&this.enablerTarget.checked?this.enable():this.disable()}disable(){let e=this.hasClearValue&&this.clearValue;this.enableTargets.forEach((s,i)=>{e&&(s.value=""),s.disabled=!0})}enable(){this.enableTargets.forEach((e,s)=>{e.disabled=!1})}}n(ye,"targets",["enabler","enable"]),n(ye,"values",{clear:Boolean});class gt extends u{get _checked(){return this._enabled.filter(e=>e.checked)}get _enabled(){return this.checkboxTargets.filter(e=>!e.disabled&&!e.readOnly)}get _unchecked(){return this._enabled.filter(e=>!e.checked)}connect(){requestAnimationFrame(()=>{!this.hasSelectAllTarget||(c(this,this.selectAllTarget,"change",this._toggle),k(this,this.checkboxTargets,"change",this._refresh),this._refresh())})}_toggle(e){e.preventDefault();let s=e.target;this._enabled.forEach(i=>i.checked=i.disabled||i.readOnly?i.checked:s.checked)}_refresh(){const e=this._enabled.length,s=this._checked.length;this.selectAllTarget.checked=s>0,this.selectAllTarget.indeterminate=s>0&&s<e}}n(gt,"targets",["selectAll","checkbox"]);class pt extends u{connect(){k(this,this.checkboxTargets,"change",this._update)}_otherCheckboxes(e){return Array.from(this.checkboxTargets).filter(s=>s!==e)}_update(e){const s=e.target;if(!s)throw new Error("No target found on event");let i=this._otherCheckboxes(s);s.checked&&i.forEach(r=>{r.checked=!1,this.dispatchEvent(this.el,"change")})}}n(pt,"targets",["checkbox"]);class Is extends u{get _cacheAttrName(){return"detect-dirty-load-value"}connect(){let e=this.el;this._cacheLoadValues(),this._checkDirty(),c(this,e,["input","change"],this._checkDirty,{debounce:10})}restore(e){e==null||e.preventDefault(),this._restoreElementFromLoadValue()}_getElementValue(){let e=this.el;return V(e)?e.checked:e.value}_getElementLoadValue(){let e=this.el,s=e.getAttribute(this._cacheAttrName);if(V(e))return s==null?e.defaultChecked:s=="true";if(A(e))Array.from(e.options).forEach(r=>{if(r.defaultSelected)return e.value=r.value,r.value});else if(s!==null)return s;return s}_elementHasCachedLoadValue(){return this.el.hasAttribute(this._cacheAttrName)}_checkDirty(){let e=this.el;_(e)&&e.type=="radio"&&fe(e).forEach(s=>s.removeAttribute("data-dirty")),this._isElementDirty()?e.setAttribute("data-dirty","true"):e.removeAttribute("data-dirty")}_isElementDirty(){return this._getElementValue()!==this._getElementLoadValue()}_restoreElementFromLoadValue(){let e=this.el,s=e.getAttribute(this._cacheAttrName);V(e)?(e.setAttribute(this._cacheAttrName,e.checked.toString()),e.checked=s==null?e.defaultChecked:s=="true"):A(e)?s==null?Array.from(e.options).forEach(r=>{if(r.defaultSelected){e.value=r.value;return}}):e.value=s:e.value=s==null?e.defaultValue:s}_cacheLoadValues(){let e=this.el;!this._elementHasCachedLoadValue()&&V(e)?e.setAttribute(this._cacheAttrName,e.checked.toString()):e.setAttribute(this._cacheAttrName,e.value.toString())}}function Ns(t){return t.hasAttribute("data-dirty")}class Hs extends u{get _formElements(){return Array.from(this.el.querySelectorAll("input, select, textarea"))}get _cacheAttrName(){return"detect-dirty-load-value"}connect(){let e=this.el;this._cacheLoadValues(),this._checkDirty(),c(this,e,["input","change"],this._checkDirty,{debounce:10})}restore(e){e==null||e.preventDefault(),this._formElements.forEach(s=>this._restoreElementFromLoadValue(s))}_getElementValue(e){return V(e)?e.checked:e.value}_getElementLoadValue(e){let s=e.getAttribute(this._cacheAttrName);if(V(e))return s==null?e.defaultChecked:s=="true";if(A(e))Array.from(e.options).forEach(r=>{if(r.defaultSelected)return e.value=r.value,r.value});else if(s!==null)return s;return s}_elementHasCachedLoadValue(e){return e.hasAttribute(this._cacheAttrName)}_checkElementDirty(e){_(e)&&e.type=="radio"&&fe(e).forEach(s=>s.removeAttribute("data-dirty")),this._isElementDirty(e)?e.setAttribute("data-dirty","true"):e.removeAttribute("data-dirty")}_isElementDirty(e){return this._getElementValue(e)!==this._getElementLoadValue(e)}_cacheElementLoadValue(e){!this._elementHasCachedLoadValue(e)&&V(e)?e.setAttribute(this._cacheAttrName,e.checked.toString()):e.setAttribute(this._cacheAttrName,e.value.toString())}_restoreElementFromLoadValue(e){let s=e.getAttribute(this._cacheAttrName);V(e)?(e.setAttribute(this._cacheAttrName,e.checked.toString()),e.checked=s==null?e.defaultChecked:s=="true"):A(e)?s==null?Array.from(e.options).forEach(r=>{if(r.defaultSelected){e.value=r.value;return}}):e.value=s:e.value=s==null?e.defaultValue:s}_cacheLoadValues(){this._formElements.forEach(e=>this._cacheElementLoadValue(e))}_checkDirty(){this._formElements.forEach(e=>this._checkElementDirty(e)),this._formElements.some(e=>_t(e))?this.el.setAttribute("data-dirty","true"):this.el.removeAttribute("data-dirty")}}function _t(t){return t.hasAttribute("data-dirty")}class Ee extends u{connect(){}disable(){let e=this.hasClearValue&&this.clearValue;this.inputTargets.forEach((s,i)=>{e&&(s.value=""),s.disabled=!0})}enable(){this.inputTargets.forEach((e,s)=>e.disabled=!1)}}n(Ee,"targets",["input"]),n(Ee,"values",{clear:Boolean});class bt extends u{get _mode(){const e=["immediate","wait"];if(this.hasModeValue){if(e.includes(this.modeValue))return this.modeValue;throw new Error(`The given modeValue '${this.modeValue}' is not one of the supported modes: "${e.join('", "')}"`)}else return e[0]}connect(){this._mode=="immediate"&&this.steal()}steal(){this.el.focus()}}n(bt,"values",{mode:String});class Te extends u{get _mode(){if(this.hasSubmitModeValue){if(!["direct","request"].includes(this.submitModeValue))throw new Error(`The modeValue provided '${this.submitModeValue}' is not one of the recognised configuration options`);return this.submitModeValue}else return"request"}get form(){let e;if(this.hasFormSelectorValue){if(e=document.querySelector(this.formSelectorValue),!e)throw new Error(`Could not find a form on the page that matches selector '${this.formSelectorValue}'`)}else e=this.formTarget;return e}submit(e){e==null||e.preventDefault();let s=this.formTarget;this._mode=="request"?ge(s):s.submit()}reset(e){e==null||e.preventDefault(),at(this.form)}}n(Te,"targets",["form"]),n(Te,"values",{formSelector:String,submitMode:String});class vt extends u{get _formID(){if(this.hasIdValue)return this.idValue;let e=this.el.id;if(e!=="")return e;throw new Error(`No ID value to uniquely identify this form. Please either specify data-${this.identifier}-id-value or give this form an 'id' attribute. `)}get _formIdentifier(){return`${location.href} ${this._formID}`}get _formElements(){return this.el.elements}get _formData(){let e={[this._formIdentifier]:{}};for(const s of this._formElements){let i=s;i.name.length>0&&(_(i)&&i.type=="checkbox"?e[this._formIdentifier][i.name]=i.checked:_(i)&&i.type=="radio"?i.checked&&(e[this._formIdentifier][i.name]=i.value):e[this._formIdentifier][i.name]=i.value)}return e}get _restoreOnLoad(){return this.hasRestoreOnLoadValue?this.restoreOnLoadValue:!0}get _clearOnSubmit(){return this.hasClearOnSubmitValue?this.clearOnSubmitValue:!0}connect(){requestAnimationFrame(()=>{let e=this.el;if(!he(e))throw new Error("Expected controller to be mounted on a form element.");this._restoreOnLoad&&this.restore(),this._clearOnSubmit&&c(this,this.el,"submit",this._clear)})}_clear(){localStorage.removeItem(this._formIdentifier),this.dispatchEvent(this.el,"form-save:cleared")}clear(e){e==null||e.preventDefault(),this._clear()}save(e){e.preventDefault();let s=this._formData;localStorage.setItem(this._formIdentifier,JSON.stringify(s[this._formIdentifier])),this.dispatchEvent(this.el,"form-save:save:success")}restore(e){if(e==null||e.preventDefault(),localStorage.getItem(this._formIdentifier)){const s=JSON.parse(localStorage.getItem(this._formIdentifier));for(const i of this._formElements){let r=i;r.name in s&&(_(r)&&r.type=="checkbox"?r.checked=s[r.name]:_(r)&&r.type=="radio"?r.value==s[r.name]&&(r.checked=!0):r.value=s[r.name])}this.dispatchEvent(this.el,"form-save:restore:success")}else this.dispatchEvent(this.el,"form-save:restore:empty")}}n(vt,"values",{id:String,restoreOnLoad:Boolean,clearOnSubmit:Boolean});class Ce extends u{connect(){k(this,this.inputTargets,"change",this._handleInputs)}_handleInputs(e){let s=this.inputTargets.reduce((r,a)=>a.checked?r+1:r,0),i=e.target;s>this.maxValue?(e.preventDefault(),i.checked=!1,this.dispatchEvent(i,"change"),this.dispatchEvent(i,"limited-selection:too-many"),this.hasErrorTarget&&this.hasMessageValue&&(this.errorTarget.innerHTML=this.messageValue)):(this.dispatchEvent(i,"limited-selection:selection"),this.hasErrorTarget&&(this.errorTarget.innerHTML=""))}}n(Ce,"targets",["input","error"]),n(Ce,"values",{max:Number,message:String});class J extends u{constructor(){super(...arguments);n(this,"_errors",[]);n(this,"_firstClick",!1)}get defaultCurrentClasses(){return["currentError"]}get _errorCount(){return this._errors.length}get _previousIndex(){let e=this._index-1;return e<0?0:e}get _nextIndex(){let e=this._index+1;return e>this._errors.length-1?this._errors.length-1:e}get _index(){return p.clamp(this.hasIndexValue?this.indexValue:0,0,this._errors.length)}get _selector(){if(this.hasSelectorValue)return this.selectorValue;throw new Error("Expected `selectorValue` to be present")}get _currentError(){return this._errors[this._index]}get _otherErrors(){return this._errors.filter((e,s)=>s!==this._index)}connect(){y(this),requestAnimationFrame(()=>{this._firstClick=!0,this._toggleButtons(),this._toggleVisibility()})}async current(e){e==null||e.preventDefault(),this._firstClick&&(this._firstClick=!1,this._toggleButtons()),await x(this._currentError,{behavior:"smooth",block:"center",inline:"center"}),this._updateClasses()}async next(e){e==null||e.preventDefault(),this._firstClick?(this._firstClick=!1,this._toggleButtons()):this.indexValue=this._nextIndex,await x(this._currentError,{behavior:"smooth",block:"center",inline:"center"}),this._updateClasses()}async previous(e){e==null||e.preventDefault(),this._firstClick?(this._firstClick=!1,this._toggleButtons()):this.indexValue=this._previousIndex,await x(this._currentError,{behavior:"smooth",block:"center",inline:"center"}),this._updateClasses()}indexValueChanged(){this._toggleButtons()}selectorValueChanged(){this._errors=Array.from(document.querySelectorAll(this._selector)),this.indexValue=0,this._toggleButtons(),this._toggleVisibility()}_updateClasses(){this.addCurrentClasses(this._currentError),this._otherErrors.forEach(e=>this.removeCurrentClasses(e))}_toggleVisibility(){this._errorCount===0?this.el.style.display="none":this.el.style.display=""}_toggleButtons(){if(this.hasNextTarget)if(!this.hasCurrentTarget&&this._firstClick&&this.indexValue==this._errorCount-1){this.nextTarget.removeAttribute("disabled");return}else this.indexValue>=this._errorCount-1?this.nextTarget.setAttribute("disabled","true"):this.nextTarget.removeAttribute("disabled");this.hasPreviousTarget&&(this.indexValue<=0?this.previousTarget.setAttribute("disabled","true"):this.previousTarget.removeAttribute("disabled"))}}n(J,"values",{selector:String,index:Number}),n(J,"classes",["current"]),n(J,"targets",["next","current","previous"]);class Se extends u{get _wrapperClass(){return this.hasWrapperSelectorValue?this.wrapperClassValue:"nested-fields"}get _insertMode(){return this.hasInsertModeValue?this.insertModeValue:"beforeend"}connect(){this._checkStructure()}add(e){e==null||e.preventDefault();const s=this.templateTarget.innerHTML.replace(/NEW_RECORD/g,this._generateID());this.targetTarget.insertAdjacentHTML(this._insertMode,s)}remove(e){e.preventDefault();const s=e.target.closest(`.${this._wrapperClass}`);if(s==null)throw new Error(`#remove was clicked from outside of a child record. Could not find an ancestor with class .${this._wrapperClass}`);if(s.dataset.newRecord==="true")s.remove();else{s.style.display="none";let i=s.querySelector("input[name*='_destroy']");if(i==null)throw new Error("Could not find a hidden input with name '_destroy'. NestedForm cannot remove an already persisted record without it.");i.value="1"}}_generateID(){return new Date().getTime().toString()+Math.random().toString().slice(2)}_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`")}}n(Se,"targets",["target","template"]),n(Se,"values",{insertMode:String,wrapperClass:String});class Ve extends u{connect(){y(this),k(this,this.passwordTargets,"change",this._checkPasswordsMatch)}_allPasswordsMatch(){let e=new Set(this.passwordTargets.map(s=>s.value));return e.has("")||e.size==1}_checkPasswordsMatch(){let e=this.el;this._allPasswordsMatch()?(this.dispatchEvent(e,"password-confirm:match"),this.passwordTargets.forEach(s=>this.removeErrorClasses(s))):(this.dispatchEvent(e,"password-confirm:no-match"),this.passwordTargets.forEach(s=>this.addErrorClasses(s)))}}n(Ve,"targets",["password"]),n(Ve,"classes",["error"]);class wt extends u{peak(e){e==null||e.preventDefault(),this.passwordTarget.type="text"}hide(e){e==null||e.preventDefault(),this.passwordTarget.type="password"}toggle(e){e==null||e.preventDefault(),this.passwordTarget.type==="password"?this.peak():this.hide()}}n(wt,"targets",["password"]);class xe extends u{get _selector(){return this.hasSelectorValue?this.selectorValue:`[data-controller~="${this.identifier}"]`}replace(e){const[s,i,r]=e.detail;if(s instanceof Node){let a=s.querySelector(this._selector);if(a==null)throw new Error(`expected new form DOM with [data-controller="${this.identifier}"] to be present in returned payload`);let l=this.el.parentNode;if(l==null)throw new Error("expected form to have a DOM parent, could not execute replaceChild");l.replaceChild(a,this.el),this.dispatchEvent(a,"remote-form:replace")}else console.log("Unknown",s)}}n(xe,"targets",[]),n(xe,"values",{selector:String});function F(t,e,s,i){let r=i;(r==null?void 0:r.debounce)?(s=p.debounce(s.bind(t),r.debounce),delete r.debounce):s=s.bind(t);let a=nt(e),l=()=>a.forEach(o=>S.on(o,s)),h=()=>a.forEach(o=>S.off(o,s));return v(t,l,h),{setup:l,teardown:h}}class yt extends u{get _eventName(){return`sync:${this._key}`}get _key(){if(this.hasKeyValue)return this.keyValue;throw new Error("Expected `keyValue` to be present")}get _value(){let e=this.el;return _(e)&&e.type==="checkbox"?e.checked:_(e)&&e.type==="radio"?e.checked?e.value:"":e.value}set _value(e){let s=this.el;_(s)&&s.type==="checkbox"?s.checked=e.toString()==="true":_(s)&&s.type==="radio"?s.checked=s.value===e:_(s)||U(s)||A(s)?s.value=e.toString():s.innerHTML=e.toString()}connect(){F(this,this._eventName,this._read),requestAnimationFrame(()=>{tt(this.el)&&(this._emit(),c(this,this.el,"input",this._emit))})}_emit(){S.emit(this._eventName,{value:this._value,dispatcher:this.el})}_read(e){if(e===void 0)throw new Error("No payload received");let{dispatcher:s,value:i}=e;s!==this.el&&(this._value=i)}}n(yt,"values",{key:String});class X extends u{get _maxMessage(){return this.hasMaxMessageValue?this.maxMessageValue:`Value must be less than ${this.maxValue}`}get _minMessage(){return this.hasMinMessageValue?this.minMessageValue:`Value must be greater than ${this.minValue}`}get defaultWarningHideClasses(){return["hide"]}connect(){y(this),this.addWarningHideClasses(this.warningTarget),c(this,this.inputTarget,"input",this._check),this._check()}_check(){this.hasMinValue&&Number.parseFloat(this.inputTarget.value)<this.minValue?(this.removeWarningHideClasses(this.warningTarget),this.addInputWarningClasses(this.inputTarget),this.warningTarget.innerText=this._minMessage):this.hasMaxValue&&Number.parseFloat(this.inputTarget.value)>this.maxValue?(this.removeWarningHideClasses(this.warningTarget),this.addInputWarningClasses(this.inputTarget),this.warningTarget.innerText=this._maxMessage):(this.addWarningHideClasses(this.warningTarget),this.removeInputWarningClasses(this.inputTarget),this.warningTarget.innerText="")}}n(X,"classes",["inputWarning","warningHide"]),n(X,"targets",["input","warning"]),n(X,"values",{max:Number,min:Number,minMessage:String,maxMessage:String});class Y extends u{connect(){y(this),this._updateWordCount(),c(this,this.inputTarget,"input",this._updateWordCount)}_updateWordCount(){let e=0,i=this.inputTarget.value.match(/\S+/g);e=i&&i.length||0,this.outputTarget.innerText=e.toString(),this._isValidCount(e)?this.removeErrorClasses(this.outputTarget):this.addErrorClasses(this.outputTarget)}_isValidCount(e){let s=0,i=99999;return this.hasMinValue&&(s=this.minValue),this.hasMaxValue&&(i=this.maxValue),e>=s&&e<=i}}n(Y,"targets",["input","output"]),n(Y,"values",{min:Number,max:Number}),n(Y,"classes",["error"]);class ke extends u{initialize(){this._hasLoadedSuccessfully=this._hasLoadedSuccessfully.bind(this),this._success=this._success.bind(this),this._fail=this._fail.bind(this)}connect(){let e=this.el;e.onerror=this._fail,e.complete&&!this._hasLoadedSuccessfully()?this._fail():this._success()}disconnect(){this.removeSuccessClasses(),this.removeFailClasses()}_success(){this.addSuccessClasses()}_fail(){let e=this.el;this.addFailClasses(),this.hasPlaceholderValue&&e.src!==this.placeholderValue?(this.dispatchEvent(e,"fallback-image:placeholder"),e.src=this.placeholderValue,e.onerror=this._fail):(this.dispatchEvent(e,"fallback-image:fail"),e.style.display="none")}_hasLoadedSuccessfully(){let e=this.el;return e.naturalHeight>0&&e.naturalWidth>0}}n(ke,"values",{placeholder:String}),n(ke,"classes",["success","fail"]);var L=window.CustomEvent;(!L||typeof L=="object")&&(L=function(e,s){s=s||{};var i=document.createEvent("CustomEvent");return i.initCustomEvent(e,!!s.bubbles,!!s.cancelable,s.detail||null),i},L.prototype=window.Event.prototype);function Et(t,e){var s="on"+e.type.toLowerCase();return typeof t[s]=="function"&&t[s](e),t.dispatchEvent(e)}function Os(t){for(;t&&t!==document.body;){var e=window.getComputedStyle(t),s=function(i,r){return!(e[i]===void 0||e[i]===r)};if(e.opacity<1||s("zIndex","auto")||s("transform","none")||s("mixBlendMode","normal")||s("filter","none")||s("perspective","none")||e.isolation==="isolate"||e.position==="fixed"||e.webkitOverflowScrolling==="touch")return!0;t=t.parentElement}return!1}function R(t){for(;t;){if(t.localName==="dialog")return t;t.parentElement?t=t.parentElement:t.parentNode?t=t.parentNode.host:t=null}return null}function Tt(t){for(;t&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;t&&t.blur&&t!==document.body&&t.blur()}function Bs(t,e){for(var s=0;s<t.length;++s)if(t[s]===e)return!0;return!1}function Me(t){return!t||!t.hasAttribute("method")?!1:t.getAttribute("method").toLowerCase()==="dialog"}function Ct(t){var e=["button","input","keygen","select","textarea"],s=e.map(function(l){return l+":not([disabled])"});s.push('[tabindex]:not([disabled]):not([tabindex=""])');var i=t.querySelector(s.join(", "));if(!i&&"attachShadow"in Element.prototype)for(var r=t.querySelectorAll("*"),a=0;a<r.length&&!(r[a].tagName&&r[a].shadowRoot&&(i=Ct(r[a].shadowRoot),i));a++);return i}function St(t){return t.isConnected||document.body.contains(t)}function Vt(t){if(t.submitter)return t.submitter;var e=t.target;if(!(e instanceof HTMLFormElement))return null;var s=m.formSubmitter;if(!s){var i=t.target,r="getRootNode"in i&&i.getRootNode()||document;s=r.activeElement}return!s||s.form!==e?null:s}function Fs(t){if(!t.defaultPrevented){var e=t.target,s=m.imagemapUseValue,i=Vt(t);s===null&&i&&(s=i.value);var r=R(e);if(!!r){var a=i&&i.getAttribute("formmethod")||e.getAttribute("method");a==="dialog"&&(t.preventDefault(),s!=null?r.close(s):r.close())}}}function xt(t){if(this.dialog_=t,this.replacedStyleTop_=!1,this.openAsModal_=!1,t.hasAttribute("role")||t.setAttribute("role","dialog"),t.show=this.show.bind(this),t.showModal=this.showModal.bind(this),t.close=this.close.bind(this),t.addEventListener("submit",Fs,!1),"returnValue"in t||(t.returnValue=""),"MutationObserver"in window){var e=new MutationObserver(this.maybeHideModal.bind(this));e.observe(t,{attributes:!0,attributeFilter:["open"]})}else{var s=!1,i=function(){s?this.downgradeModal():this.maybeHideModal(),s=!1}.bind(this),r,a=function(l){if(l.target===t){var h="DOMNodeRemoved";s|=l.type.substr(0,h.length)===h,window.clearTimeout(r),r=window.setTimeout(i,0)}};["DOMAttrModified","DOMNodeRemoved","DOMNodeRemovedFromDocument"].forEach(function(l){t.addEventListener(l,a)})}Object.defineProperty(t,"open",{set:this.setOpen.bind(this),get:t.hasAttribute.bind(t,"open")}),this.backdrop_=document.createElement("div"),this.backdrop_.className="backdrop",this.backdrop_.addEventListener("mouseup",this.backdropMouseEvent_.bind(this)),this.backdrop_.addEventListener("mousedown",this.backdropMouseEvent_.bind(this)),this.backdrop_.addEventListener("click",this.backdropMouseEvent_.bind(this))}xt.prototype={get dialog(){return this.dialog_},maybeHideModal:function(){this.dialog_.hasAttribute("open")&&St(this.dialog_)||this.downgradeModal()},downgradeModal:function(){!this.openAsModal_||(this.openAsModal_=!1,this.dialog_.style.zIndex="",this.replacedStyleTop_&&(this.dialog_.style.top="",this.replacedStyleTop_=!1),this.backdrop_.parentNode&&this.backdrop_.parentNode.removeChild(this.backdrop_),m.dm.removeDialog(this))},setOpen:function(t){t?this.dialog_.hasAttribute("open")||this.dialog_.setAttribute("open",""):(this.dialog_.removeAttribute("open"),this.maybeHideModal())},backdropMouseEvent_:function(t){if(this.dialog_.hasAttribute("tabindex"))this.dialog_.focus();else{var e=document.createElement("div");this.dialog_.insertBefore(e,this.dialog_.firstChild),e.tabIndex=-1,e.focus(),this.dialog_.removeChild(e)}var s=document.createEvent("MouseEvents");s.initMouseEvent(t.type,t.bubbles,t.cancelable,window,t.detail,t.screenX,t.screenY,t.clientX,t.clientY,t.ctrlKey,t.altKey,t.shiftKey,t.metaKey,t.button,t.relatedTarget),this.dialog_.dispatchEvent(s),t.stopPropagation()},focus_:function(){var t=this.dialog_.querySelector("[autofocus]:not([disabled])");!t&&this.dialog_.tabIndex>=0&&(t=this.dialog_),t||(t=Ct(this.dialog_)),Tt(document.activeElement),t&&t.focus()},updateZIndex:function(t,e){if(t<e)throw new Error("dialogZ should never be < backdropZ");this.dialog_.style.zIndex=t,this.backdrop_.style.zIndex=e},show:function(){this.dialog_.open||(this.setOpen(!0),this.focus_())},showModal:function(){if(this.dialog_.hasAttribute("open"))throw new Error("Failed to execute 'showModal' on dialog: The element is already open, and therefore cannot be opened modally.");if(!St(this.dialog_))throw new Error("Failed to execute 'showModal' on dialog: The element is not in a Document.");if(!m.dm.pushDialog(this))throw new Error("Failed to execute 'showModal' on dialog: There are too many open modal dialogs.");Os(this.dialog_.parentElement)&&console.warn("A dialog is being shown inside a stacking context. This may cause it to be unusable. For more information, see this link: https://github.com/GoogleChrome/dialog-polyfill/#stacking-context"),this.setOpen(!0),this.openAsModal_=!0,m.needsCentering(this.dialog_)?(m.reposition(this.dialog_),this.replacedStyleTop_=!0):this.replacedStyleTop_=!1,this.dialog_.parentNode.insertBefore(this.backdrop_,this.dialog_.nextSibling),this.focus_()},close:function(t){if(!this.dialog_.hasAttribute("open"))throw new Error("Failed to execute 'close' on dialog: The element does not have an 'open' attribute, and therefore cannot be closed.");this.setOpen(!1),t!==void 0&&(this.dialog_.returnValue=t);var e=new L("close",{bubbles:!1,cancelable:!1});Et(this.dialog_,e)}};var m={};m.reposition=function(t){var e=document.body.scrollTop||document.documentElement.scrollTop,s=e+(window.innerHeight-t.offsetHeight)/2;t.style.top=Math.max(e,s)+"px"};m.isInlinePositionSetByStylesheet=function(t){for(var e=0;e<document.styleSheets.length;++e){var s=document.styleSheets[e],i=null;try{i=s.cssRules}catch{}if(!!i)for(var r=0;r<i.length;++r){var a=i[r],l=null;try{l=document.querySelectorAll(a.selectorText)}catch{}if(!(!l||!Bs(l,t))){var h=a.style.getPropertyValue("top"),o=a.style.getPropertyValue("bottom");if(h&&h!=="auto"||o&&o!=="auto")return!0}}}return!1};m.needsCentering=function(t){var e=window.getComputedStyle(t);return e.position!=="absolute"||t.style.top!=="auto"&&t.style.top!==""||t.style.bottom!=="auto"&&t.style.bottom!==""?!1:!m.isInlinePositionSetByStylesheet(t)};m.forceRegisterDialog=function(t){if((window.HTMLDialogElement||t.showModal)&&console.warn("This browser already supports <dialog>, the polyfill may not work correctly",t),t.localName!=="dialog")throw new Error("Failed to register dialog: The element is not a dialog.");new xt(t)};m.registerDialog=function(t){t.showModal||m.forceRegisterDialog(t)};m.DialogManager=function(){this.pendingDialogStack=[];var t=this.checkDOM_.bind(this);this.overlay=document.createElement("div"),this.overlay.className="_dialog_overlay",this.overlay.addEventListener("click",function(e){this.forwardTab_=void 0,e.stopPropagation(),t([])}.bind(this)),this.handleKey_=this.handleKey_.bind(this),this.handleFocus_=this.handleFocus_.bind(this),this.zIndexLow_=1e5,this.zIndexHigh_=1e5+150,this.forwardTab_=void 0,"MutationObserver"in window&&(this.mo_=new MutationObserver(function(e){var s=[];e.forEach(function(i){for(var r=0,a;a=i.removedNodes[r];++r){if(a instanceof Element)a.localName==="dialog"&&s.push(a);else continue;s=s.concat(a.querySelectorAll("dialog"))}}),s.length&&t(s)}))};m.DialogManager.prototype.blockDocument=function(){document.documentElement.addEventListener("focus",this.handleFocus_,!0),document.addEventListener("keydown",this.handleKey_),this.mo_&&this.mo_.observe(document,{childList:!0,subtree:!0})};m.DialogManager.prototype.unblockDocument=function(){document.documentElement.removeEventListener("focus",this.handleFocus_,!0),document.removeEventListener("keydown",this.handleKey_),this.mo_&&this.mo_.disconnect()};m.DialogManager.prototype.updateStacking=function(){for(var t=this.zIndexHigh_,e=0,s;s=this.pendingDialogStack[e];++e)s.updateZIndex(--t,--t),e===0&&(this.overlay.style.zIndex=--t);var i=this.pendingDialogStack[0];if(i){var r=i.dialog.parentNode||document.body;r.appendChild(this.overlay)}else this.overlay.parentNode&&this.overlay.parentNode.removeChild(this.overlay)};m.DialogManager.prototype.containedByTopDialog_=function(t){for(;t=R(t);){for(var e=0,s;s=this.pendingDialogStack[e];++e)if(s.dialog===t)return e===0;t=t.parentElement}return!1};m.DialogManager.prototype.handleFocus_=function(t){var e=t.composedPath?t.composedPath()[0]:t.target;if(!this.containedByTopDialog_(e)&&document.activeElement!==document.documentElement&&(t.preventDefault(),t.stopPropagation(),Tt(e),this.forwardTab_!==void 0)){var s=this.pendingDialogStack[0],i=s.dialog,r=i.compareDocumentPosition(e);return r&Node.DOCUMENT_POSITION_PRECEDING&&(this.forwardTab_?s.focus_():e!==document.documentElement&&document.documentElement.focus()),!1}};m.DialogManager.prototype.handleKey_=function(t){if(this.forwardTab_=void 0,t.keyCode===27){t.preventDefault(),t.stopPropagation();var e=new L("cancel",{bubbles:!1,cancelable:!0}),s=this.pendingDialogStack[0];s&&Et(s.dialog,e)&&s.dialog.close()}else t.keyCode===9&&(this.forwardTab_=!t.shiftKey)};m.DialogManager.prototype.checkDOM_=function(t){var e=this.pendingDialogStack.slice();e.forEach(function(s){t.indexOf(s.dialog)!==-1?s.downgradeModal():s.maybeHideModal()})};m.DialogManager.prototype.pushDialog=function(t){var e=(this.zIndexHigh_-this.zIndexLow_)/2-1;return this.pendingDialogStack.length>=e?!1:(this.pendingDialogStack.unshift(t)===1&&this.blockDocument(),this.updateStacking(),!0)};m.DialogManager.prototype.removeDialog=function(t){var e=this.pendingDialogStack.indexOf(t);e!==-1&&(this.pendingDialogStack.splice(e,1),this.pendingDialogStack.length===0&&this.unblockDocument(),this.updateStacking())};m.dm=new m.DialogManager;m.formSubmitter=null;m.imagemapUseValue=null;if(window.HTMLDialogElement===void 0){var kt=document.createElement("form");if(kt.setAttribute("method","dialog"),kt.method!=="dialog"){var I=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"method");if(I){var Rs=I.get;I.get=function(){return Me(this)?"dialog":Rs.call(this)};var qs=I.set;I.set=function(t){return typeof t=="string"&&t.toLowerCase()==="dialog"?this.setAttribute("method",t):qs.call(this,t)},Object.defineProperty(HTMLFormElement.prototype,"method",I)}}document.addEventListener("click",function(t){if(m.formSubmitter=null,m.imagemapUseValue=null,!t.defaultPrevented){var e=t.target;if("composedPath"in t){var s=t.composedPath();e=s.shift()||e}if(!(!e||!Me(e.form))){var i=e.type==="submit"&&["button","input"].indexOf(e.localName)>-1;if(!i){if(!(e.localName==="input"&&e.type==="image"))return;m.imagemapUseValue=t.offsetX+","+t.offsetY}var r=R(e);!r||(m.formSubmitter=e)}}},!1),document.addEventListener("submit",function(t){var e=t.target,s=R(e);if(!s){var i=Vt(t),r=i&&i.getAttribute("formmethod")||e.getAttribute("method");r==="dialog"&&t.preventDefault()}});var Ps=HTMLFormElement.prototype.submit,$s=function(){if(!Me(this))return Ps.call(this);var t=R(this);t&&t.close()};HTMLFormElement.prototype.submit=$s}class Ae extends u{constructor(){super(...arguments);n(this,"_dialog",null)}get _src(){return this.hasSrcValue?this.srcValue:this.el.src}get _srcSet(){return this.hasSrcSetValue?this.srcSetValue:this.el.srcset}get _sizes(){return this.hasSizesValue?this.sizesValue:this.el.sizes}get _modalClassName(){return this.hasModalClass?this.modalClass:"image-lightbox-dialog"}get _imageClassName(){return this.hasImageClass?this.imageClass:"image-lightbox-image"}initialize(){this.open=this.open.bind(this),this.close=this.close.bind(this)}connect(){}disconnect(){this.close()}open(){let e=this.el;if(this._dialog)return;this._dialog=document.createElement("dialog");let s=document.createElement("img");s.className=this._imageClassName,s.src=this._src,s.srcset=this._srcSet,s.sizes=this._sizes,this._dialog.appendChild(s),e.insertAdjacentElement("afterend",this._dialog),m.registerDialog(this._dialog),this._dialog.className=this._modalClassName,this._dialog.showModal(),x(this._dialog,{behavior:"smooth",block:"end"}).catch(()=>this._dialog.scrollIntoView(!1)),c(this,this._dialog,"click",this.close),c(this,this._dialog,"cancel",this.close),c(this,this._dialog,"close",this.close)}close(){this._dialog&&(this._dialog.close(),this._dialog.remove(),this._dialog=null,x(this.el,{behavior:"smooth",block:"end"}).catch(()=>this.el.scrollIntoView(!1)))}}n(Ae,"values",{src:String,srcSet:String,sizes:String}),n(Ae,"classes",["modal","image"]);class Mt extends u{async play(e){e==null||e.preventDefault(),await this.mediaTarget.play()}pause(e){e==null||e.preventDefault(),this.mediaTarget.pause()}restart(e){e==null||e.preventDefault(),this.mediaTarget.currentTime=0}seek(e){e==null||e.preventDefault(),this.mediaTarget.currentTime+=5}}n(Mt,"targets",["media"]);class At extends u{get _increment(){return this.hasIncrementValue?this.incrementValue:50}get _behaviour(){if(this.hasBehaviourValue){if(["auto","smooth"].includes(this.behaviourValue))return this.behaviourValue;throw new Error(`'${this.behaviourValue}' is not a recognised scroll behaviour`)}else return"auto"}async scrollTop(e){e==null||e.preventDefault(),await ae(this.el,{behavior:this._behaviour})}async scrollBottom(e){e==null||e.preventDefault(),await ne(this.el,{behavior:this._behaviour})}async scrollLeft(e){e==null||e.preventDefault(),await le(this.el,{behavior:this._behaviour})}async scrollRight(e){e==null||e.preventDefault(),await le(this.el,{behavior:this._behaviour})}async up(e){e==null||e.preventDefault(),await Ue(this.el,this._increment,{behavior:this._behaviour})}async down(e){e==null||e.preventDefault(),await je(this.el,this._increment,{behavior:this._behaviour})}async left(e){e==null||e.preventDefault(),await We(this.el,this._increment,{behavior:this._behaviour})}async right(e){e==null||e.preventDefault(),await Ke(this.el,this._increment,{behavior:this._behaviour})}}n(At,"values",{behaviour:String,increment:Number});class Dt extends ${connect(){requestAnimationFrame(()=>{x(this.el,{behavior:this.hasBehaviorValue?this.behaviorValue:"smooth",block:this.hasBlockValue?this.blockValue:"center",inline:this.hasInlineValue?this.inlineValue:"center"}).catch(()=>this.el.scrollIntoView()),this._cleanupSelf()})}}n(Dt,"values",{behavior:String,block:String,inline:String});class Lt extends u{get _mode(){return this.hasModeValue?this.modeValue:"document"}get _scrollTarget(){let e;return this._mode=="document"?e=window:e=z(this.el),e}async scroll(e){e==null||e.preventDefault(),this._scrollTarget&&await ne(this._scrollTarget)}}n(Lt,"values",{mode:String});class It extends u{scroll(){let e=document.querySelector(this.selectorValue);if(!e){console.warn(`Could not find target for '${this.selectorValue}'`);return}x(e,{behavior:this.hasBehaviorValue?this.behaviorValue:"smooth",block:this.hasBlockValue?this.blockValue:"center",inline:this.hasInlineValue?this.inlineValue:"center"}).catch(()=>e.scrollIntoView())}}n(It,"values",{selector:String,behavior:String,block:String,inline:String});class Nt extends u{get _mode(){return this.hasModeValue?this.modeValue:"document"}get _scrollTarget(){let e;return this._mode=="document"?e=window:e=z(this.el),e}async scroll(e){e==null||e.preventDefault(),this._scrollTarget&&await ae(this._scrollTarget)}}n(Nt,"values",{mode:String});function Ht(t){t=t.trim();let e=t.includes("&&"),s=t.includes("||"),i=t.includes("(")||t.includes(")");if(e&&s)throw new Error("Cannot have both && and || in the same expression.");if(i)throw new Error("Cannot have logical groupings `(>3 && <= 9) || (>1 && <2)` in the expression. Only supports simple expressions like `>1 && <3`");let r=t.split(e?"&&":"||");return e?r.map(a=>De(a)):s?r.map(a=>De(a)):[De(t)]}function De(t){let s=[">=","<=","==","!=",">","<"].find(l=>t.includes(l));if(!s)throw new Error(`Could not find operator in expression: ${t}`);let i=t.split(s)[1].trim(),r=/^-?\d*(\.\d+)?$/.test(i);if(r&&(i=parseFloat(i)),i==="")throw new Error(`Could not find a value in expression: ${t}`);let a=l=>l!=="";switch(s){case">":return l=>r&&a(l)&&l>i;case"<":return l=>r&&a(l)&&l<i;case">=":return l=>r&&a(l)&&l>=i;case"<=":return l=>r&&a(l)&&l<=i;case"==":return l=>a(l)&&l==i;case"!=":return l=>a(l)&&l!=i;default:throw new Error(`Unknown operator ${s}`)}}function N(t,e){return`signal:${e}:${t}`}function q(t){return N(t,"connect")}function P(t){return N(t,"value")}function Ot(t,e){return N(`${t}:${e}`,"visibility")}class Bt extends u{get _predicates(){return Ht(this.whenValue)}connect(){S.emit(q(this.nameValue)),F(this,P(this.nameValue),this._onSignal)}_onSignal(e){let s=e.value;if(!this.hasWhenValue){this.dispatchEvent(this.el,N(this.nameValue,"match"));return}this._predicates.every(i=>i(s))?this.dispatchEvent(this.el,N(this.nameValue,"match"),{detail:{element:this.el,value:s}}):this.dispatchEvent(this.el,N(this.nameValue,"no-match"),{detail:{element:this.el,value:s}})}}n(Bt,"values",{name:String,when:String});function Z(t,e,s,i){s=s.bind(t);let r=new MutationObserver(s),a=()=>r.observe(e,i),l=()=>r.disconnect();return v(t,a,l),l}class Ft extends u{get _children(){return this.hasScopeSelectorValue?Array.from(this.el.querySelectorAll(this.scopeSelectorValue)):Array.from(this.el.children)}get _name(){if(this.hasNameValue)return this.nameValue;throw new Error("SignalEmptyDomController requires a nameValue to be provided")}connect(){F(this,q(this._name),this.emitChildCount),S.emit(q(this._name)),Z(this,this.el,this.mutate,{childList:!0}),this.emitChildCount()}mutate(e){this.emitChildCount()}emitChildCount(){let e=this._children.length;S.emit(P(this._name),{element:this.el,value:e.toString()})}}n(Ft,"values",{name:String,scopeSelector:String});class Rt extends u{get _debounceTimeout(){return this.hasDebounceIntervalValue?this.debounceIntervalValue:1}get _name(){return this.hasNameValue?this.nameValue:this.element.name}connect(){F(this,q(this._name),()=>this.emitValue()),lt(this,this.el,["input","change"],this.emitValue,{debounce:this._debounceTimeout||void 0}),requestAnimationFrame(()=>this.emitValue())}emitValue(){var s;let e=this.el.value;if(_(this.el)&&this.el.type==="checkbox")e=this.el.checked?"true":"false";else if(_(this.el)&&this.el.type==="radio"){let i=(s=me(this.el).find(r=>r.checked))==null?void 0:s.value;e=i||""}this.dispatchEvent(this.el,P(this._name),{detail:{value:e}}),S.emit(P(this._name),{element:this.el,value:e})}}n(Rt,"values",{name:String,debounceInterval:Number});class Le extends u{get _predicates(){return Ht(this.showValue)}get defaultHideClasses(){return["hide"]}connect(){y(this),S.emit(q(this.nameValue)),F(this,P(this.nameValue),this._onSignal)}_onSignal(e){let s=e.value;if(this.showValue=="default"){s==""?this.removeHideClasses(this.el):this.addHideClasses(this.el);return}this._predicates.every(i=>i(s))?(this.dispatchEvent(this.el,Ot(this.nameValue,"show"),{detail:{predicate:this.showValue,value:s}}),this.removeHideClasses(this.el)):(this.dispatchEvent(this.el,Ot(this.nameValue,"hide"),{detail:{predicate:this.showValue,value:s}}),this.addHideClasses(this.el))}}n(Le,"values",{name:String,show:String}),n(Le,"classes",["hide"]);class qt extends u{constructor(){super(...arguments);n(this,"_lastIndex",null);n(this,"_reverse",!1)}get _tableHead(){let e=this.el.tHead;if(e==null)throw new Error("Expected table to have a <thead> element.");return e}get _tableHeaders(){let e=this._tableHead.rows;if(e.length==0)throw new Error("Expected table to have a <thead> element with at least one row.");return Array.from(e[0].cells)}get _tableBody(){return this.el.tBodies[0]}get _tableRows(){return Array.from(this._tableBody.rows)}connect(){requestAnimationFrame(()=>{k(this,this._tableHeaders,"click",this.sort),this.hasStartSortValue&&this._sortByColumn(this.startSortValue)})}sort(e){e.preventDefault();let s=e.target,i=this._indexOfHeaderCell(s);s.dataset.sortable!="false"&&(s.dataset.sort=="asc"?(this._reverse=!0,this._otherHeaderCells(s).forEach(r=>delete r.dataset.sort),s.dataset.sort="desc",this._sortByColumn(i)):(this._reverse=!1,this._otherHeaderCells(s).forEach(r=>delete r.dataset.sort),s.dataset.sort="asc",this._sortByColumn(i)))}_indexOfHeaderCell(e){return this._tableHeaders.indexOf(e)}_otherHeaderCells(e){return Array.from(this._tableHeaders).filter(s=>s!=e)}_sortByColumn(e){let s=document.createDocumentFragment();this._tableRows.sort((a,l)=>{var E,b;let h=Array.from(a.cells),o=Array.from(l.cells),d=((E=h[e])==null?void 0:E.innerText)||"",f=((b=o[e])==null?void 0:b.innerText)||"",g=d.localeCompare(f,"en",{sensitivity:"base",numeric:!0,caseFirst:"upper"});return a.dataset.sortTop||l.dataset.sortBottom?a.dataset.sortTop&&l.dataset.sortTop?g:-1:a.dataset.sortBottom||l.dataset.sortTop?a.dataset.sortBottom&&l.dataset.sortBottom?g:1:this._reverse?g>0?-1:1:g}).forEach(a=>s.appendChild(a)),this._tableBody.innerHTML="",this._tableBody.appendChild(s),this._lastIndex=e}}n(qt,"values",{startSort:Number});class Ie extends u{get _truncated(){return this.hasTruncatedValue?this.truncatedValue:!1}set _truncated(e){this.truncatedValue=e}get _tableBody(){return this.el.tBodies[0]}get _tableRows(){return Array.from(this._tableBody.rows)}get _limit(){return this.hasLimitValue?this.limitValue:20}connect(){Z(this,this._tableBody,this.mutate,{childList:!0}),requestAnimationFrame(()=>{this.truncate(),c(this,this.showMoreTarget,"click",this.expand)})}truncate(e){e==null||e.preventDefault(),this._truncated=!0,this._tableRows.length>=this._limit?(this._tableRows.slice(this._limit).forEach(s=>{s!==this.showMoreTarget&&this._hideElement(s)}),this._showElement(this.showMoreTarget)):this._hideElement(this.showMoreTarget)}expand(e){this._truncated=!1,e==null||e.preventDefault(),this._tableRows.slice(this._limit).forEach(s=>{s!==this.showMoreTarget&&this._showElement(s)}),this._hideElement(this.showMoreTarget)}mutate(e){this._truncated&&this._reTruncate()}_showElement(e){e.style.display=""}_hideElement(e){e.style.display="none"}_reTruncate(){this._tableRows.slice(0,this._limit).forEach(e=>{e!==this.showMoreTarget&&this._showElement(e)}),this._tableRows.slice(this._limit).forEach(e=>{e!==this.showMoreTarget&&this._hideElement(e)}),this._showElement(this.showMoreTarget)}}n(Ie,"targets",["showMore"]),n(Ie,"values",{limit:Number,truncated:Boolean});class Pt extends u{alert(){alert(this.messageValue)}}n(Pt,"values",{message:String});class zs extends u{connect(){let{enter:e,exit:s,toggle:i}=ot(this);this.enter=e,this.exit=s,this.toggle=i}}class $t extends u{get _threshold(){return this.hasThresholdValue?this.thresholdValue.split(",").map(e=>Number.parseFloat(e.trim())).filter(e=>e>=0&&e<=1):[0,1]}connect(){be(this,this.el,this.appear,this.disappear,{threshold:this._threshold})}appear(e){re(this,this.el,"intersection:appear")}disappear(e){re(this,this.el,"intersection:disappear")}}n($t,"values",{threshold:String});class zt extends u{connect(){if(!this.hasSecondsValue)throw new Error("Expected `secondsValue` to be present");requestAnimationFrame(()=>{O(this,this._interval,this.secondsValue*1e3)})}_interval(){this.dispatchEvent(this.el,"interval:action")}}n(zt,"values",{seconds:Number});class Ut extends u{get name(){return this.hasNameValue?this.nameValue:""}get _addedEventName(){return[this.name,"presence","added"].filter(e=>!!e).join(":")}get _removedEventName(){return[this.name,"presence","removed"].filter(e=>!!e).join(":")}connect(){this.dispatchEvent(this.el,this._addedEventName)}disconnect(){this.dispatchEvent(this.el,this._removedEventName)}}n(Ut,"values",{name:String});class jt extends u{print(e){e==null||e.preventDefault(),window.print()}}class Wt extends u{connect(){requestAnimationFrame(()=>{M(this,this._timeout,this.secondsValue*1e3)})}_timeout(){this.dispatchEvent(this.el,"timeout")}}n(Wt,"values",{seconds:Number});class Us extends u{connect(){c(this,window,["focus","blur"],this._handleVisibility),c(this,document,"visibilitychange",this._handleVisibility),requestAnimationFrame(()=>{this._handleVisibility()})}appear(){this.dispatchEvent(this.el,"user-focus:active")}away(){this.dispatchEvent(this.el,"user-focus:away")}_handleVisibility(){this._documentIsActive()?this.appear():this.away()}_documentIsActive(){return document.visibilityState=="visible"&&document.hasFocus()}}class Kt extends u{get _tickInterval(){return this.hasMillisecondsTarget?1:this.hasSecondsTarget?1e3:this.hasMinutesTarget?15e3:3e5}connect(){requestAnimationFrame(()=>{O(this,this._tick,this._tickInterval)})}_tick(){let e=new Date;this.hasHoursTarget&&(this.hoursTarget.innerHTML=e.getHours().toString().padStart(2,"0")),this.hasMinutesTarget&&(this.minutesTarget.innerHTML=e.getMinutes().toString().padStart(2,"0")),this.hasSecondsTarget&&(this.secondsTarget.innerHTML=e.getSeconds().toString().padStart(2,"0")),this.hasMillisecondsTarget&&(this.millisecondsTarget.innerHTML=e.getMilliseconds().toString().padStart(3,"0"))}}n(Kt,"targets",["hours","minutes","seconds","milliseconds"]);class Q extends u{constructor(){super(...arguments);n(this,"_interval",null)}get _removeUnused(){return this.hasRemoveUnusedValue?this.removeUnusedValue:!1}get _deadlineDate(){return new Date(this.deadlineValue)}connect(){this._interval=setInterval(this._tick.bind(this),1e3),this.addCountingDownClasses()}disconnect(){this._clearTick(),this.removeCountingDownClasses(),this.removeEndedClasses()}deadlineValueChanged(){this._interval==null&&(this._interval=setInterval(this._tick.bind(this),1e3))}_tick(){try{const e=new Date;let s={};w.isPast(this._deadlineDate)?(s={years:0,months:0,days:0,hours:0,minutes:0,seconds:0},this._clearTick(),this.removeCountingDownClasses(),this.addEndedClasses(),this.dispatchEvent(this.el,"countdown:ended")):s=w.intervalToDuration({start:this._deadlineDate,end:e}),this.hasYearsTarget&&this._updateTarget(this.yearsTarget,this._years(s)),this.hasMonthsTarget&&this._updateTarget(this.monthsTarget,this._months(s)),this.hasDaysTarget&&this._updateTarget(this.daysTarget,this._days(s)),this.hasHoursTarget&&this._updateTarget(this.hoursTarget,this._hours(s)),this.hasMinutesTarget&&this._updateTarget(this.minutesTarget,this._minutes(s)),this.hasSecondsTarget&&this._updateTarget(this.secondsTarget,this._seconds(s))}catch(e){console.error(e),this._clearTick()}}_clearTick(){this._interval&&(clearInterval(this._interval),this._interval=null)}_updateTarget(e,s){this._removeTargetIfUnused(e,s),e.innerHTML=s.toString()}_removeTargetIfUnused(e,s){this._removeUnused&&(s===0&&e.dataset.unused?Number.parseInt(e.dataset.unused)>Date.now()+1500&&e.remove():s==0?e.dataset.unused=Date.now().toString():e.dataset.unused=void 0)}_years(e){return e.years||0}_months(e){return e.months||0}_days(e){return e.days||0}_hours(e){return e.hours||0}_minutes(e){return e.minutes||0}_seconds(e){return e.seconds||0}}n(Q,"values",{deadline:String,removeUnused:Boolean}),n(Q,"targets",["years","months","days","hours","minutes","seconds"]),n(Q,"classes",["countingDown","ended"]);class Gt extends u{get _format(){return["years","months","weeks","days","hours",...this._minutes?["minutes"]:[],...this._seconds?["seconds"]:[]]}get _output(){let{years:e,months:s,weeks:i,days:r,hours:a,minutes:l,seconds:h}=this._duration;e||(e=0),s||(s=0),i||(i=0),r||(r=0),a||(a=0),l||(l=0),h||(h=0);let o=[e,s,i,r,a];return!this._minutes&&!this._seconds&&o.every(d=>d===0)?(l=l+h/60,`${(l/60).toFixed(1)} hours`):w.formatDuration(this._duration,{format:this._format,delimiter:", "})}get _seconds(){return this.hasSecondsValue?this.secondsValue:!0}get _minutes(){return this.hasMinutesValue?this.minutesValue:!0}get _timestamp(){if(this.hasTimestampValue)return w.toDate(this.timestampValue*1e3);throw new Error("Expected `timestampValue` to be present")}get _duration(){return w.intervalToDuration({start:new Date,end:this._timestamp})}get _tickInterval(){return this._seconds?1e3:this._minutes?15e3:12e4}connect(){this._clearInterval=O(this,this._update,this._tickInterval),this._update()}_update(){try{this.el.innerHTML=this._output}catch{this._clearInterval()}}}n(Gt,"values",{timestamp:Number,minutes:Boolean,seconds:Boolean});class ee extends u{get defaultHideClasses(){return["hide"]}get defaultActiveClasses(){return["is-active"]}get _currentTab(){return this.hasCurrentTabValue?this.currentTabValue:0}get _equalize(){return this.hasEqualizeValue?this.equalizeValue:!1}connect(){k(this,this.linkTargets,"click",this.switchTabs),this._equalize&&this._setMinHeight(),this.currentTabValue=this._currentTab}switchTabs(e){e.preventDefault(),this.currentTabValue=this.linkTargets.indexOf(e.currentTarget)}currentTabValueChanged(){let e=this._currentTab;e=this._clampIndex(e),this._selectTab(e)}_selectTab(e){e=this._clampIndex(e);let s=this.linkTargets,i=this.contentTargets,r=i[e],a=s[e],l=[...i.slice(0,e),...i.slice(e+1)],h=[...s.slice(0,e),...s.slice(e+1)];this.addActiveClasses(a),a.setAttribute("aria-selected","true"),this.addActiveClasses(r),this.removeHideClasses(r),h.forEach(o=>{o.removeAttribute("aria-selected"),this.removeActiveClasses(o)}),l.forEach(o=>{this.removeActiveClasses(o),this.addHideClasses(o)})}_clampIndex(e){return p.clamp(e,0,this.contentTargets.length-1)}_setMinHeight(){let e=0;this.contentTargets.forEach(s=>{let i=s.hasAttribute("tab-hidden");i&&this.removeHideClasses(s);let r=s.offsetHeight;r>e&&(e=r),i&&this.addHideClasses(s)}),this.contentTargets.forEach(s=>s.style.minHeight=e+"px")}}n(ee,"values",{currentTab:Number,equalize:Boolean}),n(ee,"targets",["link","content"]),n(ee,"classes",["active","hide"]);class Jt extends u{get _duration(){return w.isPast(this._timestamp)?w.intervalToDuration({start:this._timestamp,end:new Date}):w.intervalToDuration({start:new Date,end:this._timestamp})}get _nextUpdate(){let e=this._duration;return e.years&&e.years>0||e.months&&e.months>0||e.days&&e.days>0?null:e.hours&&e.hours>0?18e5:3e4}timestampValueChanged(){this._timestamp=w.toDate(this.timestampValue*1e3)}connect(){if(!this.hasTimestampValue)throw new Error("Expected `timestampValue` to be present");this._update()}_update(){this.el.innerHTML=w.formatDistanceToNow(this._timestamp,{addSuffix:!0,includeSeconds:!0}),this._nextUpdate&&M(this,this._update,this._nextUpdate)}}n(Jt,"values",{timestamp:Number});class Xt extends u{get defaultActiveClasses(){return["active"]}get defaultCollapsedClasses(){return["collapsed"]}initialize(){this._nodeClicked=this._nodeClicked.bind(this)}connect(){y(this),Z(this,this.el,this.mutate,{subtree:!0,childList:!0}),this._setup()}disconnect(){this._teardown()}_setup(){this._setupNode(this.el)}_setupNode(e){const s=i=>{let r=i.parentElement;r&&(this._nodeActive(r)||this._hideNode(r),r.removeEventListener("click",this._nodeClicked),r.addEventListener("click",this._nodeClicked))};(e.tagName==="UL"||e.tagName==="OL")&&s(e),e.querySelectorAll("ul, ol").forEach(i=>s(i))}_teardown(){this.el.querySelectorAll("ul, ol, li").forEach(e=>this._teardownNode(e))}_teardownNode(e){[e,...Array.from(e.querySelectorAll("ul, ol, li"))].forEach(s=>{s.removeEventListener("click",this._nodeClicked),this.removeActiveClasses(s),this.removeCollapsedClasses(s)})}_nodeClicked(e){e&&e.stopImmediatePropagation();let s=e.target;!s||!this._hasNested(s)||(this._nodeActive(s)?this._hideNode(s):this._showNode(s))}_nodeActive(e){return this.activeClassesPresent(e)}_showNode(e){this.removeCollapsedClasses(e),this.addActiveClasses(e)}_hideNode(e){this.removeActiveClasses(e),this.addCollapsedClasses(e)}_hasNested(e){return e.querySelectorAll("ul, ol").length>0}mutate(e){for(const s of e)s.type==="childList"&&(Array.from(s.addedNodes||[]).forEach(i=>this._setupNode(i)),Array.from(s.removedNodes||[]).forEach(i=>this._teardownNode(i)))}}n(Xt,"classes",["active","collapsed"]);class Ne extends u{get defaultActiveClasses(){return["active"]}get defaultInactiveClasses(){return["inactive"]}get _key(){return this.keyValue.replaceAll("#","")}get _anchor(){return window.location.hash.substr(1)}set _anchor(e){window.location.hash=e}connect(){y(this),requestAnimationFrame(()=>{this._checkAnchor(),c(this,window,"hashchange",this._checkAnchor)})}write(e){e==null||e.preventDefault(),this._anchor=this._key}_checkAnchor(){this._key===this._anchor?(this.dispatchEvent(this.el,"anchor-spy:active"),this.addActiveClasses(this.el),this.removeInactiveClasses(this.el)):(this.dispatchEvent(this.el,"anchor-spy:inactive"),this.addInactiveClasses(this.el),this.removeActiveClasses(this.el))}}n(Ne,"values",{key:String}),n(Ne,"classes",["active","inactive"]);class Yt extends u{get _pages(){return this.hasPagesValue?Math.abs(this.pagesValue):1}get _timeout(){return this.hasTimeoutValue?this.timeoutValue:1500}connect(){c(this,this.el,"click",this.goBack)}goBack(e){e==null||e.preventDefault(),history.go(-this._pages),this.el.href&&M(this,this.fallback,this._timeout)}fallback(){window.location.href=this.el.href}}n(Yt,"values",{timeout:Number,pages:Number});class He extends u{constructor(){super(...arguments);n(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")}}n(He,"targets",["source","button","copy","fallback"]),n(He,"values",{removeUnused:Boolean});class Zt extends u{get _message(){return this.hasMessageValue?this.messageValue:"Are you sure?"}get _eventType(){if(he(this.el))return"submit";if(ue(this.el))return"click";throw new Error("Can't handle confirmation on attached element")}connect(){requestAnimationFrame(()=>{c(this,this.el,this._eventType,this.confirm)})}confirm(e){window.confirm(this._message)||(e.preventDefault(),this.dispatchEvent(this.el,"confirm:cancelled"))}}n(Zt,"values",{message:String});class Qt extends u{get _message(){return this.hasMessageValue?this.messageValue:"Do you want to leave this page? Changes you made may not be saved"}connect(){window.onbeforeunload=()=>this._message,c(this,window,"popstate",this.confirmNavigation),c(this,window,"submit",this.allowSubmit),c(this,window,["turbolinks:before-visit","turbo:before-visit"],this.confirmTurboNavigation)}disconnect(){window.onbeforeunload=null}allowSubmit(e){window.removeEventListener("popstate",this.confirmNavigation),window.onbeforeunload=null}confirmNavigation(e){return!1}confirmTurboNavigation(e){confirm(this._message)||e.preventDefault()}}n(Qt,"values",{message:String});class es extends u{connect(){console.log("Debug Controller",this,this.testTargets)}}n(es,"targets",["test"]);class ts extends u{get _message(){return this.hasMessageValue?this.messageValue:"Submitting..."}get _timeout(){return this.hasTimeoutValue?this.timeoutValue:1e3}connect(){requestAnimationFrame(()=>{c(this,this.el,["click"],this.disable),c(this,window,["turbo:load","turbolinks:load"],this._enable)})}disable(e){let s=this.el;this._isDisabled(s)?(e==null||e.preventDefault(),e==null||e.stopImmediatePropagation()):(this._disable(),dt(this,s,this._message,this._timeout,this._enable))}enable(e){e==null||e.preventDefault();let s=this.el;this._isDisabled(s)&&this._enable()}_isDisabled(e){return j(e)?e.disabled:e.dataset.disabled=="true"}_disable(){let e=this.el;j(e)?e.disabled=!0:e.dataset.disabled="true"}_enable(){let e=this.el;j(e)?e.disabled=!1:e.dataset.disabled=void 0}}n(ts,"values",{message:String,timeout:Number});class ss extends u{dismiss(){this.el.remove()}}class js extends ss{}class Oe extends u{get _id(){if(this.hasIdValue)return this.idValue;let e=this.el.id;if(e!=="")return e;throw new Error(`No ID value to uniquely identify this element. Please either specify data-${this.identifier}-id-value or give this element an 'id' attribute. `)}get _uniqueIdentifier(){return`${location.href} ${this._id}`}get _restoreOnLoad(){return this.hasRestoreOnLoadValue?this.restoreOnLoadValue:!0}get _element(){return this.hasElementTarget?this.elementTarget:this.el}initialize(){this.save=p.debounce(this.save.bind(this),300)}connect(){this._store=ct(this,this._uniqueIdentifier,{}),requestAnimationFrame(()=>{this._restoreOnLoad&&this.restore()})}clear(e){e&&e.preventDefault(),this._store.clear(),this.dispatchEvent(this._element,"element-save:cleared")}save(e){e&&e.preventDefault();let s=this._element,i=this.attributesValue.split(" "),r={};i.forEach(a=>r[a]=p.get(s,a)),this._store.value=r,this.dispatchEvent(s,"element-save:save:success")}restore(e){e&&e.preventDefault();let s=this._element;if(this._store.isEmpty())this.dispatchEvent(s,"element-save:restore:empty");else{const i=this._store.value;Object.keys(i).forEach(r=>p.set(s,r,i[r])),this.dispatchEvent(s,"element-save:restore:success")}}}n(Oe,"targets",["element"]),n(Oe,"values",{id:String,attributes:String,restoreOnLoad:Boolean});class te extends u{get _container(){return this.hasContainerTarget?this.containerTarget:this.el}get _children(){let e=this._container;return this.hasScopeSelectorValue?Array.from(e.querySelectorAll(this.scopeSelectorValue)):Array.from(e.children)}connect(){y(this),Z(this,this._container,this.mutate,{childList:!0}),this.checkEmpty()}mutate(e){this.checkEmpty()}checkEmpty(){let e=this._container,s=this._children;s.length===0?(this.removeNotEmptyClasses(),this.addEmptyClasses(),this.dispatchEvent(e,"dom:empty")):(this.addNotEmptyClasses(),this.removeEmptyClasses(),this.dispatchEvent(e,"dom:not-empty",{detail:{count:s.length}}))}}n(te,"targets",["container"]),n(te,"classes",["empty","notEmpty"]),n(te,"values",{scopeSelector:String});class is extends u{get _mode(){return this.hasModeValue?this.modeValue:"mouseover"}get _supportsPrefetch(){var s,i;const e=document.createElement("link");return((s=e.relList)==null?void 0:s.supports)&&((i=e.relList)==null?void 0:i.supports("prefetch"))}get _href(){return this.el.href}get _existingPrefetch(){return(document.head.querySelectorAll(`link[rel="prefetch"][href="${this._href}"]`)||[]).length>0}get _connectionSuitable(){const e=navigator.connection;if(!e)return!0;if(e){if(e.saveData)return Pe(this,"Data Saving is enabled"),!1;if(/2g/.test(e.effectiveType))return Pe(this,"Network is too slow"),!1}return!0}connect(){if(!!this._supportsPrefetch)switch(this._mode){case"intersect":this._setupObserver();break;case"mouseover":c(this,this.el,"mouseover",this.prefetch,{once:!0});break;default:throw new Error(`'${this._mode}' is not a supported prefetch mode`)}}_setupObserver(){new IntersectionObserver(([s],i)=>{s.isIntersecting&&(this.prefetch(),i.unobserve(s.target))}).observe(this.element)}prefetch(){if(this._existingPrefetch||!this._connectionSuitable)return;const e=document.createElement("link");Object.assign(e,{rel:"prefetch",href:this._href,as:"document"}),document.head.appendChild(e)}}n(is,"values",{mode:String});class rs extends jt{get defaultUnsupportedClasses(){return["unsupported"]}connect(){y(this),"print"in window||this.addUnsupportedClasses(),c(this,this.el,"click",this.print)}}n(rs,"classes",["unsupported"]);class Ws extends u{connect(){c(this,window,"message",this.messageReceived)}messageReceived(e){let s=e.data;s.hasOwnProperty("name")&&s.name==="iframe-body"&&s.hasOwnProperty("height")&&this.resize(s.height)}resize(e){this.el.style.height=`${e}px`}}class Ks extends u{connect(){window.self!==window.top&&(c(this,window,"resize",this.postUpdate,{debounce:200}),this.postUpdate())}postUpdate(){let e={name:"iframe-body",height:this.getHeight()};window.parent.postMessage(e,"*")}getHeight(){const e=document.body,s=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,s.clientHeight,s.scrollHeight,s.offsetHeight)}}class as extends u{connect(){requestAnimationFrame(()=>{M(this,()=>this.el.remove(),this.secondsValue*1e3)})}}n(as,"values",{seconds:Number});class Be extends u{constructor(){super(...arguments);n(this,"_magicElement",null)}get defaultStuckClasses(){return["stuck"]}get _mode(){if(this.hasModeValue){if(!["top","bottom"].includes(this.modeValue))throw new Error(`The modeValue provided '${this.modeValue}' is not one of the recognised configuration options`);if(this.modeValue==="top")return"beforebegin"}return"afterend"}connect(){this._magicElement=document.createElement("div"),ut(this,this.el,this._mode,this._magicElement),new IntersectionObserver(s=>{s.forEach(i=>{i.target===this._magicElement&&(i.intersectionRatio===0?this.addStuckClasses():i.intersectionRatio===1&&this.removeStuckClasses())})},{threshold:[0,1]}).observe(this._magicElement)}}n(Be,"classes",["stuck"]),n(Be,"values",{mode:String});class ns extends ${connect(){if(!this.hasInsertValue)throw new Error("`insert` value was not specified");requestAnimationFrame(()=>{this.hasImmediateValue&&this.immediateValue&&this.execute()})}execute(e){e==null||e.preventDefault();let s=this.el,i=document.querySelector(this.targetValue);if(i==null){this.dispatchEvent(s,"teleport:error");return}let r=s.cloneNode(!0);switch(this.cleanup(r),this.insertValue){case"beforebegin":case"beforeend":case"afterend":case"afterbegin":i.insertAdjacentHTML(this.insertValue,r.outerHTML);break;case"replaceOuter":i.outerHTML=r.outerHTML;break;case"replaceInner":i.innerHTML=r.outerHTML;break;case"prepend":i.insertAdjacentHTML("afterbegin",r.outerHTML);break;case"append":i.insertAdjacentHTML("beforeend",r.outerHTML);break;default:throw new Error("`insert` value was not specified")}s.remove()}}n(ns,"values",{target:String,insert:String,immediate:Boolean});class ls extends ${constructor(){super(...arguments);n(this,"_previousState",{})}get _value(){if(this.hasValueValue)return this.valueValue;throw new Error("Expected `valueValue` to be present")}get _attribute(){if(this.hasAttributeValue)return this.attributeValue;throw new Error("Expected `attributeValue` to be present")}get _seconds(){if(this.hasSecondsValue)return this.secondsValue*1e3;throw new Error("Expected `secondsValue` to be present")}connect(){this.setState(),M(this,this.removeState,this._seconds)}disconnect(){this.removeState()}setState(){this._previousState[this._attribute]=p.get(this.el,this._attribute),p.set(this.el,this._attribute,this.valueValue)}removeState(){p.set(this.el,this._attribute,this._previousState[this._attribute])}}n(ls,"values",{attribute:String,seconds:Number,value:String});function os(t,e,s,i,r="temporary-state"){var a;(!t.dataset.controller||!((a=t.dataset.controller)==null?void 0:a.includes(r)))&&(t.dataset.controller=(t.dataset.controller||` ${r} `).trim().replaceAll(" "," ")),t[p.camelCase(`${r}-attribute-value`)]=e,t[p.camelCase(`${r}-seconds-value`)]=i.toString()}function Gs(t,e,s){os(t,"className",e,s)}function Js(t,e,s){s=s.bind(t);const i=a=>{e.contains(a.target)||!rt(e)||s(a)};let{teardown:r}=c(t,window,["click","touchend"],i);return v(t,()=>{},r),{teardown:r}}function Xs(t,e,s,i){let r=null,a=null;if(s){s=s.bind(t);let{teardown:o}=c(t,e,"mouseenter",s);r=o}if(i){i=i.bind(t);let{teardown:o}=c(t,e,"mouseleave",i);a=o}let l=()=>{},h=()=>{r&&r(),a&&a()};return v(t,l,h),{teardown:h}}class Fe extends u{connect(){if(!this.hasClassValue)throw new Error("data-toggle-class-class-value must not be empty");(this.hasMouseEnterValue||this.hasMouseLeaveValue)&&Xs(this,this.el,this.mouseEnter,this.mouseLeave),this.hasClickAwayValue&&this.clickAwayValue&&Js(this,this.el,this.clickOutside),requestAnimationFrame(()=>{this.hasInitialValue&&(this.initialValue==="on"?this.toggleTargets.forEach(e=>this._elementOn(e)):this.toggleTargets.forEach(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();break}return{}}mouseLeave(){if(this.hasMouseLeaveValue)switch(this.mouseLeaveValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle();break}return{}}on(e){this.toggleTargets.forEach(s=>{this._elementToggleStatus(s),this._elementOn(s)})}off(e){this.toggleTargets.forEach(s=>{this._elementToggleStatus(s),this._elementOff(s)})}toggle(e){this.toggleTargets.forEach(s=>{this._elementToggleStatus(s),this._elementToggle(s)})}_elementWasToggled(e){return e.dataset.toggled=="true"}_elementToggleStatus(e){this._elementWasToggled(e)?delete e.dataset.toggled:e.dataset.toggled="true"}_elementToggle(e){this.classValue.split(" ").forEach(i=>e.classList.toggle(i))}_elementOn(e){this.classValue.split(" ").forEach(i=>e.classList.toggle(i,!0))}_elementOff(e){this.classValue.split(" ").forEach(i=>e.classList.toggle(i,!1))}}n(Fe,"targets",["toggle"]),n(Fe,"values",{class:String,mouseEnter:String,mouseLeave:String,clickAway:Boolean,initial:String});function Ys(t){const e=t.disconnect.bind(t);let s=!1,i=(o,d)=>{o.forEach(f=>{f.type==="childList"&&Array.from(f.addedNodes).some(g=>g.tagName==="TRIX-TOOLBAR")&&(l(),d.disconnect())})},r=o=>B(t,"pasteEvent").call(t,o),a=new MutationObserver(i),l=()=>{if(t.element.tagName!=="TRIX-EDITOR")throw new Error("Expected controller to be mounted on an instance of <trix-editor>");let o=t.element,d=t.element.parentElement;if(d==null)throw new Error("Could not traverse DOM tree from <trix-editor>");o.addEventListener("trix-paste",r);let f=d.querySelector("trix-toolbar");if(!s&&!f){s=!0,a.observe(d,{childList:!0});return}else if(f)a.disconnect();else throw new Error("Could not find an instance of <trix-toolbar> that is a sibling of this <trix-editor>");B(t,"install").call(t,{toolbar:f,editor:o})},h=()=>{if(t.element.tagName!=="TRIX-EDITOR")throw new Error("Expected controller to be mounted on an instance of <trix-editor>");let o=t.element,d=t.element.parentElement;if(d==null)throw new Error("Could not traverse DOM tree from <trix-editor>");o.removeEventListener("trix-paste",r);let f=d.querySelector("trix-toolbar");if(!f)throw new Error("Could not find <trix-toolbar> that is a sibling of this <trix-editor> element");B(t,"uninstall").call(t,{toolbar:f,editor:o})};l(),Object.assign(t,{disconnect(){a.disconnect(),h(),B(t,"uninstall").call({toolbar,editor:t.element}),e()}})}class Zs extends u{get enabledBehaviours(){let e=i=>i!==void 0&&i!=="false",s=(i,r)=>e(i)?[r]:[];return[...s(this.el.dataset.noBold,this.bold),...s(this.el.dataset.noBulletList,this.bulletList),...s(this.el.dataset.noCode,this.code),...s(this.el.dataset.noHeading,this.heading),...s(this.el.dataset.noItalic,this.italic),...s(this.el.dataset.noStrikethrough,this.strikethrough),...s(this.el.dataset.noLink,this.link),...s(this.el.dataset.noIndents,this.indents),...s(this.el.dataset.noNumberList,this.numberList),...s(this.el.dataset.noQuote,this.quote),...s(this.el.dataset.noFileUploads,this.fileUploads)]}get bold(){return this.formattingHandlers(".trix-button--icon-bold","bold")}get bulletList(){return this.formattingHandlers(".trix-button--icon-bullet-list","bullet-list")}get code(){return this.formattingHandlers(".trix-button--icon-code","code")}get heading(){return this.formattingHandlers(".trix-button--icon-heading-1","heading")}get italic(){return this.formattingHandlers(".trix-button--icon-italic","italic")}get strikethrough(){return this.formattingHandlers(".trix-button--icon-strike","strike")}get link(){return this.formattingHandlers(".trix-button--icon-link","href")}get indents(){return this.simpleHideShowHandlers([".trix-button--icon-decrease-nesting-level, .trix-button--icon-increase-nesting-level",".trix-button--icon-decrease-nesting-level, .trix-button--icon-increase-nesting-level"].join(", "))}get numberList(){return this.simpleHideShowHandlers(".trix-button--icon-number-list")}get quote(){return this.simpleHideShowHandlers(".trix-button--icon-quote")}get fileUploads(){let e=".trix-button-group.trix-button-group--file-tools",s=a=>a==null?void 0:a.preventDefault(),i=this,r=this.el;return{install(a){i.simpleHideShowHandlers(e).install(a),i.el.addEventListener("trix-file-accept",s)},pasteEvent(a){let{dataTransfer:l,html:h}=a.paste,{editor:o}=r;(l.files.length>0||h.includes("<img"))&&(alert("The content you pasted contains images and/or files. File uploads are not supported."),o.undo())},uninstall(a){i.simpleHideShowHandlers(e).uninstall(a),i.el.removeEventListener("trix-file-accept",s)}}}connect(){Ys(this)}install(e){this.enabledBehaviours.forEach(s=>s.install(e))}pasteEvent(e){this.enabledBehaviours.forEach(s=>s.pasteEvent&&s.pasteEvent(e))}uninstall(e){this.enabledBehaviours.forEach(s=>s.uninstall(e))}simpleHideShowHandlers(e){return{install:({toolbar:s})=>this.hideToolbarSelector(s,e),uninstall:({toolbar:s})=>this.showToolbarSelector(s,e)}}formattingHandlers(e,s){let i=this.el,{editor:r}=i;return{install:a=>{this.simpleHideShowHandlers(e).install(a)},pasteEvent(a){let{range:l}=a.paste,h=i.editor.getSelectedRange();r.setSelectedRange(l),r.deactivateAttribute(s),r.setSelectedRange(h)},uninstall:a=>{this.simpleHideShowHandlers(e).uninstall(a)}}}showToolbarSelector(e,s){e.querySelectorAll(s).forEach(i=>i.style.display="")}hideToolbarSelector(e,s){e.querySelectorAll(s).forEach(i=>i.style.display="none")}}class us extends u{toggle(e){e==null||e.preventDefault();let i=this._getFrame().src;i==null||i!==this._getSrc()?this._setSrc():this._clear()}setSrc(e){e==null||e.preventDefault(),this._setSrc()}clear(e){e==null||e.preventDefault(),this._clear()}_setSrc(){let e=this._getFrame();this.hasLoadingMessageValue&&(e.innerHTML=this.loadingMessageValue),e.src=this._getSrc()}_clear(){let e=this._getFrame();e.src="",e.innerHTML=""}_getFrame(){let e=document.getElementById(`${this.frameIdValue}`);if(e==null)throw new Error(`Could not find frame with ID '${this.frameIdValue}'`);if(oe(e))return e;throw new Error(`Element targeted by ID '${this.frameIdValue}'`)}_getSrc(){let e=this.el;if(this.hasSrcValue)return this.srcValue;if(ue(e))return e.href;throw new Error("No link given to drive frame to")}}n(us,"values",{frameId:String,src:String,loadingMessage:String});class hs extends u{get _poll(){return this.hasPollValue?this.pollValue:!1}connect(){let e=this.el;if(oe(e)){if(e.src)throw new Error("The provided <turbo-frame> element has no `src` attribute.")}else throw new Error("Expected controller to be mounted on a <turbo-frame> element.");this._poll&&requestAnimationFrame(()=>M(this,this.refresh,this.intervalValue))}refresh(e){e==null||e.preventDefault();let s=this.el;s.src=s.src}}n(hs,"values",{interval:Number,poll:Boolean});exports.AlertController=Pt;exports.AnchorSpyController=Ne;exports.AsyncBlockController=_e;exports.AutoSubmitFormController=ft;exports.AutosizeController=Ds;exports.BackLinkController=Yt;exports.BaseController=u;exports.CharCountController=G;exports.CheckboxDisableInputsController=we;exports.CheckboxEnableInputsController=ye;exports.CheckboxSelectAllController=gt;exports.CheckboxXORController=pt;exports.ClipboardController=He;exports.ClockController=Kt;exports.ConfirmController=Zt;exports.ConfirmNavigationController=Qt;exports.CountdownController=Q;exports.DebugController=es;exports.DetectDirtyController=Is;exports.DetectDirtyFormController=Hs;exports.DisableWithController=ts;exports.DismissableController=ss;exports.DurationController=Gt;exports.ElementSaveController=Oe;exports.EmptyDomController=te;exports.EnableInputsController=Ee;exports.EphemeralController=$;exports.EventBus=S;exports.FallbackImageController=ke;exports.FocusStealController=bt;exports.FormRcController=Te;exports.FormSaveController=vt;exports.FullscreenController=zs;exports.IntersectionController=$t;exports.IntervalController=zt;exports.LazyBlockController=As;exports.LightboxImageController=Ae;exports.LimitedSelectionCheckboxesController=Ce;exports.LoadBlockController=D;exports.MediaPlayerController=Mt;exports.NavigateFormErrorsController=J;exports.NestedFormController=Se;exports.PasswordConfirmController=Ve;exports.PasswordPeekController=wt;exports.PollBlockController=ve;exports.PrefetchController=is;exports.PresenceController=Ut;exports.PrintButtonController=rs;exports.PrintController=jt;exports.RemoteFormController=xe;exports.RemoveController=js;exports.ResponsiveIframeBodyController=Ks;exports.ResponsiveIframeWrapperController=Ws;exports.ScrollContainerController=At;exports.ScrollIntoFocusController=Dt;exports.ScrollToBottomController=Lt;exports.ScrollToController=It;exports.ScrollToTopController=Nt;exports.SelfDestructController=as;exports.SignalActionController=Bt;exports.SignalDomChildrenController=Ft;exports.SignalInputController=Rt;exports.SignalVisibilityController=Le;exports.StickyController=Be;exports.StorageSerializers=ht;exports.SyncInputsController=yt;exports.TableSortController=qt;exports.TableTruncateController=Ie;exports.TabsController=ee;exports.TeleportController=ns;exports.TemporaryStateController=ls;exports.TimeDistanceController=Jt;exports.TimeoutController=Wt;exports.ToggleClassController=Fe;exports.TreeViewController=Xt;exports.TrixModifierController=Zs;exports.TurboFrameRCController=us;exports.TurboFrameRefreshController=hs;exports.UserFocusController=Us;exports.ValueWarnController=X;exports.WordCountController=Y;exports.applyTemporaryClass=Gs;exports.applyTemporaryState=os;exports.createHiddenButton=st;exports.createHiddenInput=it;exports.getAllRadiosInGroup=me;exports.getOtherRadiosInGroup=fe;exports.getScrollParent=z;exports.insertElement=ce;exports.insertHiddenButton=de;exports.insertHiddenInput=Ss;exports.isDirty=Ns;exports.isElementCheckable=V;exports.isElementInViewport=rt;exports.isFormDirty=_t;exports.isHTMLAnchorElement=ue;exports.isHTMLButtonButtonElement=Xe;exports.isHTMLButtonElement=Es;exports.isHTMLButtonInputElement=Cs;exports.isHTMLFormElement=he;exports.isHTMLImageElement=Ts;exports.isHTMLInputElement=_;exports.isHTMLLabelElement=ys;exports.isHTMLLinkElement=ws;exports.isHTMLResetButtonElement=Ze;exports.isHTMLResetInputElement=Je;exports.isHTMLSelectElement=A;exports.isHTMLSubmitButtonElement=Ye;exports.isHTMLSubmitInputElement=Ge;exports.isHTMLTextAreaElement=U;exports.isTurboFrame=oe;exports.isTypeOfButtonableElement=j;exports.isTypeOfFormInputElement=tt;exports.isTypeOfResetButtonElement=Qe;exports.isTypeOfSubmitButtonElement=et;exports.requestReset=at;exports.requestSubmit=ge;exports.scrollAbsoluteBottom=ne;exports.scrollAbsoluteLeft=le;exports.scrollAbsoluteRight=bs;exports.scrollAbsoluteTop=ae;exports.scrollDown=je;exports.scrollLeft=We;exports.scrollRight=Ke;exports.scrollToElement=x;exports.scrollUp=Ue;exports.useCollectionEventListener=k;exports.useCollectionEventListeners=Vs;exports.useEventListener=c;exports.useEventListeners=lt;exports.useFullscreen=ot;exports.useGeolocation=xs;exports.useInjectedElement=ut;exports.useInjectedFragment=pe;exports.useInjectedHTML=ks;exports.useInterval=O;exports.useLocalStorage=ct;exports.useTemporaryContent=dt;exports.useTimeout=M;
|
|
2
2
|
//# sourceMappingURL=stimulus-library.cjs.js.map
|