avo 4.0.0.beta.32 → 4.0.0.beta.33

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5b9c978ce261357e5a81894c47242b55abe28895b02c1dedd2d102567bf6d0da
4
- data.tar.gz: 7290328cdc399b9fd14abeb646e84a0e0256b714ba71ef88eaac00294db6404f
3
+ metadata.gz: 28947524979bea00957524d786569034af89a1ae31e94bd0fb2f37f3cd03ab5f
4
+ data.tar.gz: e8813308efce9a9c9f30bb9e75161dc46468df5a5049f84c2bc3e5f4dca98ab0
5
5
  SHA512:
6
- metadata.gz: f966bbf5104d23faa12b47819002d16ac9b39561d1112658ddde72cbb313eb2fb041c991fee21102df284a689594734395335f542f1cfa27bd7e4025f20b0c2f
7
- data.tar.gz: 9df3e5f7f29afa6f16f5eaa0b0e0211b4e006deba9e0e8736bf1d783254300739a14ac0b2e49b88cac2519dacdc92ed848e6dbbaaefade335bb562bb094ff738
6
+ metadata.gz: 360f4cd2b6f9fb9f8b6c113152788354e647a6809d9302f0df15bd08b7741a5259ed344c1cf89c99eba1518796305e6c04756036683a95ec50c6400caa541691
7
+ data.tar.gz: 3d12c4c7c4748710250fc6f718f21a9b4bf6f4ee4977e0ac60cb407acb3742f84560a92d561b196189c2ca10eefff53c082c6e74d1db7b46ab0d06db17552870
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- avo (4.0.0.beta.32)
4
+ avo (4.0.0.beta.33)
5
5
  actionview (>= 6.1)
6
6
  active_link_to
7
7
  activerecord (>= 6.1)
@@ -1101,6 +1101,9 @@
1101
1101
  .w-16 {
1102
1102
  width: calc(var(--spacing) * 16);
1103
1103
  }
1104
+ .w-32 {
1105
+ width: calc(var(--spacing) * 32);
1106
+ }
1104
1107
  .w-56 {
1105
1108
  width: calc(var(--spacing) * 56);
1106
1109
  }
@@ -692,7 +692,7 @@ function print() { __p += __j.call(arguments, '') }
692
692
  class="key-value__action-button key-value__action-button--drag ${this.options.disable_deleting_rows?"cursor-not-allowed":""}"
693
693
  >
694
694
  <svg class="key-value__action-icon key-value__action-icon--small" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" /></svg>
695
- </a>`}setOptions(){let r;try{r=JSON.parse(this.controllerTarget.dataset.options)}catch{r={}}this.options={...r,inputClasses:this.controllerTarget.dataset.inputClasses,editable:AS(this.controllerTarget.dataset.editable)}}};var kN=class extends er{spinnerMarkup='<span class="loading-spinner" aria-hidden="true"></span>';static values={confirmationMessage:String,confirmed:Boolean};connect(){this.button.setAttribute("data-original-content",this.button.innerHTML),this.dialog=document.getElementById("turbo-confirm"),this.dialogCloseHandler=this.handleDialogClose.bind(this),this.dialog.addEventListener("close",this.dialogCloseHandler)}disconnect(){this.dialog.removeEventListener("close",this.dialogCloseHandler)}attemptSubmit(){this.applyLoader()}get button(){return this.context.scope.element}applyLoader(){let{button:r}=this;r.style.width=`${r.getBoundingClientRect().width}px`,r.style.height=`${r.getBoundingClientRect().height}px`,r.innerHTML=this.spinnerMarkup,r.classList.add("justify-center")}handleDialogClose(){this.dialog.returnValue!=="confirm"&&this.resetButton()}resetButton(){let{button:r}=this;r.innerHTML=r.getAttribute("data-original-content"),r.removeAttribute("disabled")}};var AN=class extends er{connect(){this.observer=new MutationObserver(()=>this.updateMapStyle()),this.observer.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),this.waitForMap().then(()=>this.updateMapStyle())}disconnect(){this.observer&&this.observer.disconnect()}waitForMap(){return new Promise(r=>{let e=()=>{this.mapkickInstance?.map?r():requestAnimationFrame(e)};e()})}get mapkickInstance(){let r=this.element.querySelector('[id^="map-"]')||this.element.querySelector("[id]");return r?.id?window.Mapkick?.maps?.[r.id]:null}get isDark(){return document.documentElement.classList.contains("dark")}updateMapStyle(){let r=this.mapkickInstance;if(!r?.map)return;let e=r.map,t=e.getStyle();if(!t)return;let n=this.isDark?"mapbox://styles/mapbox/dark-v11":"mapbox://styles/mapbox/light-v11",i=t.name||t.sprite||"",o=/dark/i.test(i);if(this.isDark===o)return;let a=this.captureMapkickState(e);e.setStyle(n),e.once("style.load",()=>{this.restoreMapkickState(e,a)})}captureMapkickState(r){let e=r.getStyle(),t={},n=[],i=[];for(let[o,a]of Object.entries(e.sources))o==="composite"||o.startsWith("mapbox")||(t[o]={type:a.type,data:a.data});for(let o of e.layers)o.source&&t[o.source]&&n.push(o);for(let o of Object.keys(r.style?.imageManager?.images||{}))if(o.startsWith("mapkick-")){let a=r.style.imageManager.images[o];a&&i.push({id:o,data:a.data,pixelRatio:a.pixelRatio||1})}return{sources:t,layers:n,images:i}}restoreMapkickState(r,e){for(let t of e.images)r.hasImage(t.id)||r.addImage(t.id,t.data,{pixelRatio:t.pixelRatio});for(let[t,n]of Object.entries(e.sources))r.getSource(t)||r.addSource(t,n);for(let t of e.layers)r.getLayer(t.id)||r.addLayer(t)}};var HLe=Ao(l9()),VLe=Ao(VG()),WG=class extends EventTarget{constructor(e,t){super(),this.file=e,this.controller=t,this.finished=!1}hasFinished(){return this.finished}handle(){let e=new HLe.DirectUpload(this.file,this.controller.directUploadsUrlValue,this);this.#e(this.file),e.create((t,n)=>{t&&console.log("Error",t),this.listItem.classList.add("text-gray-400"),this.finished=!0,this.dispatchEvent(new Event("done"))})}#e(e){let t=document.createElement("div");t.classList.add("flex","justify-between","gap-2","text-sm"),t.innerHTML=`<div>${(0,VLe.escape)(e.name)}</div><div class="progress">0%</div>`,this.listItem=this.controller.uploadingContainerTarget.appendChild(t)}directUploadWillStoreFileWithXHR(e){e.upload.addEventListener("progress",t=>this.#t(t))}#t(e){let t=e.loaded/e.total*100,n=this.listItem.querySelector(".progress");n.textContent=`${t.toFixed(2)}%`}},CN=class extends er{static targets=["dropzone","uploadingContainer"];static values={directUploadsUrl:String};dropCopy="drop it like it's hot";connect(){this.attachHandlers(),this.setupFileInput(),this.fileUploadInput=this.dropzoneTarget.querySelector(".file-upload-input"),this.titleEl=this.fileUploadInput?.querySelector(".file-upload-input__title"),this.originalTitleHTML=this.titleEl?.innerHTML}disconnect(){this.fileInput&&(this.fileInput.remove(),this.fileInput=null)}setupFileInput(){this.fileInput=document.createElement("input"),this.fileInput.type="file",this.fileInput.multiple=!0,this.fileInput.style.display="none",this.element.appendChild(this.fileInput),this.fileInput.addEventListener("change",r=>{let e=Array.from(r.target.files);this.#e(e),this.fileInput.value=""})}triggerFileBrowser(){this.fileInput.click()}attachHandlers(){let r=this;Array.from(["drag","dragstart","dragend","dragover","dragenter","dragleave","drop"]).forEach(e=>{r.dropzoneTarget.addEventListener(e,t=>{t.preventDefault(),t.stopPropagation()})}),this.dropzoneTarget.addEventListener("dragover",e=>{r.dragAction()},!1),this.dropzoneTarget.addEventListener("dragleave",e=>{r.dropAction()},!1),this.dropzoneTarget.addEventListener("drop",e=>{r.dropAction();let{files:t}=e.dataTransfer;this.#e(t)},!1)}#e(r){this.uploadObjects=[],Array.from(r).forEach(e=>{let t=new WG(e,this);this.uploadObjects.push(t),t.addEventListener("done",()=>{this.#t()}),t.handle()})}#t(){this.uploadObjects.every(r=>r.hasFinished())&&this.#r()}#r(){let r=document.createElement("turbo-stream");r.setAttribute("action","refresh"),r.setAttribute("method","morph"),r.setAttribute("render","morph"),this.element.appendChild(r)}dragAction(){this.fileUploadInput?.setAttribute("data-dragging","true"),this.titleEl&&(this.titleEl.textContent=this.dropCopy)}dropAction(){this.fileUploadInput?.removeAttribute("data-dragging"),this.titleEl&&(this.titleEl.innerHTML=this.originalTitleHTML)}};var WLe=()=>{document.querySelector(`turbo-frame#${window.Avo.configuration.modal_frame_id}`).innerHTML=""};var ON=class extends er{static outlets=["field"];static values={itemDetailsFrameId:String,controllerSelector:String,controllerName:String,selectedItems:Array};get otherController(){return this.application.getControllerForElementAndIdentifier(document.querySelector(this.controllerSelectorValue),this.controllerNameValue)}get modalController(){return this.application.getControllerForElementAndIdentifier(document.querySelector('[data-controller="modal"]'),"modal")}selectItem(r){let{params:e}=r,{attaching:t,multiple:n}=e,i=r.target.closest('[data-component="avo/media_library/list_item_component"]'),o=[this.#e(i)];t&&(r.preventDefault(),this.insertAttachments(o,r),WLe())}insertAttachments(r,e){if(!this.otherController){console.error(`[Avo->] The Media Library failed to find any field outlets to inject the asset. Tried selector: ${this.controllerSelectorValue} and name: ${this.controllerNameValue}`);return}this.otherController.insertAttachments(r,e)}closeItemDetails(){document.querySelector(`turbo-frame#${this.itemDetailsFrameIdValue}`).innerHTML=""}#e(r){let e=JSON.parse(r.dataset.mediaLibraryBlobParam),t=r.dataset.mediaLibraryPathParam,n=r.dataset.mediaLibraryUrlParam;return{blob:e,path:t,url:n}}};var DN=class extends er{static targets=["svg","items","self","trigger"];collapsed=!0;transitionClass="css-animate-slide-down";get key(){return this.selfTarget.getAttribute("data-menu-key-param")}get defaultState(){return this.selfTarget.getAttribute("data-menu-default-collapsed-state")}get userState(){return window.localStorage.getItem(this.key)}set userState(r){window.localStorage.setItem(this.key,r)}get initiallyCollapsed(){return this.userState?this.userState==="collapsed":this.defaultState==="collapsed"}connect(){this.initiallyCollapsed?(this.collapsed=!0,this.markCollapsed()):(this.collapsed=!1,this.markExpanded())}triggerCollapse(){this.collapsed=!this.collapsed,this.userState=this.collapsed?"collapsed":"expanded",this.updateDom()}updateDom(){this.collapsed?this.markCollapsed():this.markExpanded()}markCollapsed(){this.svgTarget.classList.add("rotate-90"),this.hasTriggerTarget&&this.triggerTarget.setAttribute("aria-expanded","false"),this.leave(this.itemsTarget)}markExpanded(){this.svgTarget.classList.remove("rotate-90"),this.hasTriggerTarget&&this.triggerTarget.setAttribute("aria-expanded","true"),this.enter(this.itemsTarget)}async toggle(r){r.toggleAttribute("hidden"),await this.animateTransition(r)}async leave(r){r.setAttribute("hidden",!0),await this.animateTransition(r)}async enter(r){r.removeAttribute("hidden"),await this.animateTransition(r)}async animateTransition(r){r.classList.add(this.transitionClass),await this.onTransitionsEnded(r),r.classList.remove(this.transitionClass)}onTransitionsEnded(r){return Promise.allSettled(r.getAnimations().map(e=>e.finished))}};var nE=class extends er{static targets=["modal","backdrop"];static values={closeModalOnBackdropClick:{type:Boolean,default:!0}};connectModal(){this.handleKeydown=this.handleKeydown.bind(this),document.addEventListener("keydown",this.handleKeydown)}disconnectModal(){document.removeEventListener("keydown",this.handleKeydown)}handleKeydown(r){r.key==="Escape"&&this.isOpen()&&this.closeModalOnBackdropClickValue&&this.closeModal()}close(r){r.target===this.backdropTarget&&!this.closeModalOnBackdropClickValue||this.closeModal()}addModalOpen(){document.body.classList.add("modal-open")}removeModalOpen(){document.body.classList.remove("modal-open")}dispatchClose(){document.dispatchEvent(new Event("modal-controller:close"))}closeModal(){throw new Error("Subclass must implement closeModal()")}isOpen(){throw new Error("Subclass must implement isOpen()")}};var IN=class extends nE{connect(){this.connectModal(),this.addModalOpen(),this.modalTarget.focus()}disconnect(){this.disconnectModal()}isOpen(){return!0}closeModal(){this.modalTarget.remove(),this.removeModalOpen(),this.dispatchClose()}};var MN=class extends er{static targets=["container"];static values={currentWidth:String,currentHeight:String};connect(){this.modalElement=this.element,this.updateWidthClass(this.currentWidthValue),this.updateHeightClass(this.currentHeightValue)}changeWidth(r){let e=r.currentTarget.dataset.width;this.updateWidthClass(e),this.currentWidthValue=e}changeHeight(r){let e=r.currentTarget.dataset.height;this.updateHeightClass(e),this.currentHeightValue=e}updateWidthClass(r){this.modalElement.classList.remove("modal--width-sm","modal--width-md","modal--width-lg","modal--width-xl","modal--width-2xl","modal--width-3xl","modal--width-4xl","modal--width-full","modal--width-25","modal--width-50","modal--width-75","modal--width-100"),this.containerTarget.classList.remove("w-sm","w-md","w-lg","w-xl","w-2xl","w-3xl","w-4xl","w-full"),this.modalElement.classList.add(`modal--width-${r}`),r==="full"?this.containerTarget.classList.add("w-full"):this.containerTarget.classList.add(`w-${r}`)}updateHeightClass(r){this.modalElement.classList.remove("modal--height-auto","modal--height-sm","modal--height-md","modal--height-lg","modal--height-xl","modal--height-2xl","modal--height-3xl","modal--height-4xl","modal--height-full","modal--height-25","modal--height-50","modal--height-75","modal--height-100"),this.modalElement.classList.add(`modal--height-${r}`)}};var PN=class extends yh{static targets=["selector"];getFilterValue(){let r=Array.from(this.selectorTarget.selectedOptions).map(({value:e})=>e);return r.length===0?null:r}getFilterClass(){let{filterClass:r}=this.selectorTarget.dataset;return r}};var iE=class extends er{add(e){e.preventDefault();let t=this.templateTarget.innerHTML.replace(/NEW_RECORD/g,new Date().getTime().toString());this.targetTarget.insertAdjacentHTML("beforebegin",t)}remove(e){e.preventDefault();let t=e.target.closest(this.wrapperSelectorValue);if(t.dataset.newRecord==="true")t.remove();else{t.style.display="none";let n=t.querySelector("input[name*='_destroy']");n.value="1"}}};iE.targets=["target","template"];iE.values={wrapperSelector:{type:String,default:".nested-form-wrapper"}};var LN=class extends iE{static targets=["addButton","removeButton","nestedRecord"];static values={limit:Number,confirmMessage:String};add(r){super.add(r),this.toggleAddButton()}remove(r){window.confirm(this.confirmMessageValue)&&(super.remove(r),this.toggleAddButton())}toggleAddButton(){this.limitValue>0&&this.addButtonTarget.classList.toggle("!hidden",this.nestedRecordTargets.length>=this.limitValue)}};var RN=class extends er{refresh(){let r=this.context.scope.element.closest("turbo-frame");this.element.querySelector("svg").classList.add("animate-spin"),r?(r.classList.add("opacity-50"),r.addEventListener("turbo:frame-load",()=>{r.classList.remove("opacity-50")},{once:!0}),r.reload()):console.error(`Element with ID '${this.turboFrameIdValue}' not found.`)}};var qN=class extends er{static targets=["selector"];get turboFrame(){return this.selectorTarget.dataset.turboFrame}reload(){document.querySelector(`[data-per-page-option="${this.selectorTarget.value}"][data-turbo-frame="${this.turboFrame}"]`).click()}};var FN=class extends nE{connect(){this.connectModal(),this.handleOpen=this.openModal.bind(this),this.handleToggle=this.toggleModal.bind(this),document.addEventListener("persistent-modal:open",this.handleOpen),document.addEventListener("persistent-modal:toggle",this.handleToggle)}disconnect(){this.disconnectModal(),document.removeEventListener("persistent-modal:open",this.handleOpen),document.removeEventListener("persistent-modal:toggle",this.handleToggle)}isOpen(){return!this.modalTarget.hasAttribute("hidden")}closeModal(){this.modalTarget.setAttribute("hidden",""),this.removeModalOpen(),this.dispatchClose()}openModal(){this.modalTarget.removeAttribute("hidden"),this.addModalOpen(),this.modalTarget.focus()}toggleModal(){this.isOpen()?this.closeModal():this.openModal()}};var NN=class extends er{static values={url:String};connect(){let r=this;this.tippyInstance=bS(r.context.element,{content:"loading...",allowHTML:!0,theme:"preview",maxWidth:550,async onShow(e){let n=await(await fetch(r.urlValue)).text();e.setContent(n)}})}disconnect(){this.tippyInstance&&(this.tippyInstance.destroy(),this.tippyInstance=null)}};var BN=class extends er{static targets=["label","valueInput","visibleInput"];update(){this.valueInputTarget.value=this.visibleInputTarget.value,this.labelTarget.textContent=this.valueInputTarget.value}};var tY=Ao(Tqe()),rY=Ao(Kqe()),VN=class extends er{lastCheckedIndex=null;autoClicking=!1;get itemSelectorCells(){return document.querySelectorAll(".item-selector-cell")}get hasLastCheckedIndex(){return this.lastCheckedIndex!==null}connect(){this.#t()}disconnect(){this.#r()}toggleMultiple(r){if(this.autoClicking)return;if(!this.hasLastCheckedIndex){this.#c(r);return}if(!r.shiftKey){this.#u();return}let e=parseInt(r.target.dataset.index),t=(0,tY.default)((0,rY.default)(this.lastCheckedIndex,e),[this.lastCheckedIndex,e]);this.autoClicking=!0;let n=r.target.checked;t.forEach(i=>{let o=document.querySelector(`input[type="checkbox"][data-index="${i}"]`);o.checked!==n&&o.click()}),this.#f(r),this.autoClicking=!1,this.#u(),this.#e()}#e(){this.#r(),this.#t()}#t(){this.boundMouseenterHandler=this.#i.bind(this),this.boundMouseleaveHandler=this.#n.bind(this),Array.from(this.itemSelectorCells).forEach(r=>{r.addEventListener("mouseenter",this.boundMouseenterHandler),r.addEventListener("mouseleave",this.boundMouseleaveHandler)}),document.addEventListener("keydown",this.#o),document.addEventListener("keyup",this.#s)}#r(){Array.from(this.itemSelectorCells).forEach(r=>{r.removeEventListener("mouseenter",this.boundMouseenterHandler),r.removeEventListener("mouseleave",this.boundMouseleaveHandler)}),document.removeEventListener("keydown",this.#o),document.removeEventListener("keyup",this.#s)}#i(r){r.target.closest("tr").classList.add("highlighted-row"),this.lastCheckedIndex&&this.#a(this.lastCheckedIndex,parseInt(r.target.closest("tr").dataset.index))}#n(r){r.target.closest("tr").classList.remove("highlighted-row"),document.querySelectorAll("tr[data-index]").forEach(e=>{e.classList.remove("highlighted-row")})}#a(r,e){(0,tY.default)((0,rY.default)(r,e)).forEach(n=>{document.querySelector(`tr[data-index="${n}"]`).classList.add("highlighted-row")})}#o(r){r.shiftKey&&document.body.classList.add("shift-pressed")}#s(r){r.shiftKey||document.body.classList.remove("shift-pressed")}#u(){this.lastCheckedIndex=null}#c(r){this.lastCheckedIndex=parseInt(r.target.dataset.index),r.target.closest("tr").classList.add("highlighted-row")}#f(r){this.lastCheckedIndex=parseInt(r.target.dataset.index),r.target.closest("tr").classList.add("highlighted-row")}};var WN=class extends er{static values={polymorphic:Boolean,searchable:Boolean,targetName:String,relationName:String};beforeStreamRender(r){let{relationName:e}=r.target.dataset;if(r.target.action!=="update-belongs-to"||this.relationNameValue!==e)return!1;r.detail.render=t=>{this.searchableValue?this.updateSearchable(t):this.updateNonSearchable(t)}}updateSearchable(r){document.querySelector(`input[name="${this.targetNameValue}"][type="hidden"]`).value=r.dataset.targetRecordId,document.querySelector(`input[name="${this.targetNameValue}"][type="text"]`).value=r.dataset.targetResourceLabel}updateNonSearchable(r){let e=document.querySelector(`select[name="${this.targetNameValue}"]`),t=document.createElement("option");t.value=r.dataset.targetRecordId,t.text=r.dataset.targetResourceLabel,t.selected="selected",e.appendChild(t)}};var aY=Ao(aNe()),$N=class extends er{static targets=[];static values={view:String};debugOnInput(r){console.log("onInput",r,r.target.value)}toggle({params:r}){let{toggleTarget:e,toggleTargets:t}=r;e&&this.toggleAvoTarget(e),t&&t.length>0&&t.forEach(this.toggleAvoTarget.bind(this))}disable({params:r}){let{disableTarget:e,disableTargets:t}=r;e&&this.disableAvoTarget(e),t&&t.length>0&&t.forEach(this.disableAvoTarget.bind(this))}toggleAvoTarget(r){let e=(0,aY.default)(r),t=document.querySelector(`[data-resource-edit-target="${e}"]`);t&&t.classList.toggle("hidden")}disableAvoTarget(r){let e=(0,aY.default)(r);document.querySelectorAll(`[data-resource-edit-target="${e}"]`).forEach(this.toggleItemDisabled),document.querySelectorAll(`[data-resource-edit-target="${e}"] input`).forEach(this.toggleItemDisabled),document.querySelectorAll(`[data-resource-edit-target="${e}"] select`).forEach(this.toggleItemDisabled),document.querySelectorAll(`[data-resource-edit-target="${e}"] [data-slot="value"] button`).forEach(this.toggleItemDisabled)}toggleItemDisabled(r){r.disabled=!r.disabled}};var KN=class extends er{};var GN=class extends er{static targets=["input","overlay"];static values={debounce:{type:Number,default:300},url:String};connect(){this.#n(),this.#o()}disconnect(){this.#n(),this.#o()}blurOnEscape(r){r.key==="Escape"&&(r.preventDefault(),this.inputTarget.blur())}search(){this.debouncedSearch()}debouncedSearch=this.debounce(this.performSearch,this.debounceValue);async performSearch(){let r=this.inputTarget.value,[e,t]=this.urlValue.split("?"),n=this.buildSearchUrl(e,t,r);(!t||!t.includes("turbo_frame"))&&window.history.replaceState({},"",n);try{this.#i(),await hK(n,{responseKind:"turbo-stream",headers:{Accept:"text/vnd.turbo-stream.html","X-Search-Request":"resource-search-controller"}})}catch{}finally{this.#s()}}buildSearchUrl(r,e,t){let n=new URLSearchParams(e);return t?n.set("q",t):n.delete("q"),n.set("page","1"),`${r}?${n.toString()}`}debounce(r,e){let t;return function(...i){let o=()=>{clearTimeout(t),r.apply(this,i)};clearTimeout(t),t=setTimeout(o,e)}}#e=null;#t=null;#r=500;#i(){this.#n(),this.#e=setTimeout(()=>this.#a(),this.#r)}#n(){this.#e&&(clearTimeout(this.#e),this.#e=null)}#a(){document.body.classList.add("search-loading"),this.overlayTarget.classList.add("is-active"),this.#t=this.overlayTarget}#o(){document.body.classList.remove("search-loading"),this.#t&&this.#t.classList.remove("is-active"),this.#t=null}#s(){this.#n(),this.#o()}};var YN=class extends er{};function d_(r){return{current:r}}function uE(r,e){var t=void 0;return function(){for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];t&&clearTimeout(t),t=setTimeout(function(){return r.apply(void 0,i)},e)}}function j$t(r,e){return W$t(r)||V$t(r,e)||H$t(r,e)||U$t()}function U$t(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
695
+ </a>`}setOptions(){let r;try{r=JSON.parse(this.controllerTarget.dataset.options)}catch{r={}}this.options={...r,inputClasses:this.controllerTarget.dataset.inputClasses,editable:AS(this.controllerTarget.dataset.editable)}}};var kN=class extends er{spinnerMarkup='<span class="loading-spinner" aria-hidden="true"></span>';static values={confirmationMessage:String,confirmed:Boolean};connect(){this.button.setAttribute("data-original-content",this.button.innerHTML),this.dialog=document.getElementById("turbo-confirm"),this.dialogCloseHandler=this.handleDialogClose.bind(this),this.dialog.addEventListener("close",this.dialogCloseHandler)}disconnect(){this.dialog.removeEventListener("close",this.dialogCloseHandler)}attemptSubmit(){this.applyLoader()}get button(){return this.context.scope.element}applyLoader(){let{button:r}=this;r.style.width=`${r.getBoundingClientRect().width}px`,r.style.height=`${r.getBoundingClientRect().height}px`,r.innerHTML=this.spinnerMarkup,r.classList.add("justify-center")}handleDialogClose(){this.dialog.returnValue!=="confirm"&&this.resetButton()}resetButton(){let{button:r}=this;r.innerHTML=r.getAttribute("data-original-content"),r.removeAttribute("disabled")}};var AN=class extends er{connect(){this.observer=new MutationObserver(()=>this.updateMapStyle()),this.observer.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),this.waitForMap().then(()=>this.updateMapStyle())}disconnect(){this.observer&&this.observer.disconnect()}waitForMap(){return new Promise(r=>{let e=()=>{this.mapkickInstance?.map?r():requestAnimationFrame(e)};e()})}get mapkickInstance(){let r=this.element.querySelector('[id^="map-"]')||this.element.querySelector("[id]");return r?.id?window.Mapkick?.maps?.[r.id]:null}get isDark(){return document.documentElement.classList.contains("dark")}updateMapStyle(){let r=this.mapkickInstance;if(!r?.map)return;let e=r.map,t=e.getStyle();if(!t)return;let n=this.isDark?"mapbox://styles/mapbox/dark-v11":"mapbox://styles/mapbox/light-v11",i=t.name||t.sprite||"",o=/dark/i.test(i);if(this.isDark===o)return;let a=this.captureMapkickState(e);e.setStyle(n),e.once("style.load",()=>{this.restoreMapkickState(e,a)})}captureMapkickState(r){let e=r.getStyle(),t={},n=[],i=[];for(let[o,a]of Object.entries(e.sources))o==="composite"||o.startsWith("mapbox")||(t[o]={type:a.type,data:a.data});for(let o of e.layers)o.source&&t[o.source]&&n.push(o);for(let o of Object.keys(r.style?.imageManager?.images||{}))if(o.startsWith("mapkick-")){let a=r.style.imageManager.images[o];a&&i.push({id:o,data:a.data,pixelRatio:a.pixelRatio||1})}return{sources:t,layers:n,images:i}}restoreMapkickState(r,e){for(let t of e.images)r.hasImage(t.id)||r.addImage(t.id,t.data,{pixelRatio:t.pixelRatio});for(let[t,n]of Object.entries(e.sources))r.getSource(t)||r.addSource(t,n);for(let t of e.layers)r.getLayer(t.id)||r.addLayer(t)}};var HLe=Ao(l9()),VLe=Ao(VG()),WG=class extends EventTarget{constructor(e,t){super(),this.file=e,this.controller=t,this.finished=!1}hasFinished(){return this.finished}handle(){let e=new HLe.DirectUpload(this.file,this.controller.directUploadsUrlValue,this);this.#e(this.file),e.create((t,n)=>{t&&console.log("Error",t),this.listItem.classList.add("text-gray-400"),this.finished=!0,this.dispatchEvent(new Event("done"))})}#e(e){let t=document.createElement("div");t.classList.add("flex","justify-between","gap-2","text-sm"),t.innerHTML=`<div>${(0,VLe.escape)(e.name)}</div><div class="progress">0%</div>`,this.listItem=this.controller.uploadingContainerTarget.appendChild(t)}directUploadWillStoreFileWithXHR(e){e.upload.addEventListener("progress",t=>this.#t(t))}#t(e){let t=e.loaded/e.total*100,n=this.listItem.querySelector(".progress");n.textContent=`${t.toFixed(2)}%`}},CN=class extends er{static targets=["dropzone","uploadingContainer"];static values={directUploadsUrl:String};dropCopy="drop it like it's hot";connect(){this.attachHandlers(),this.setupFileInput(),this.fileUploadInput=this.dropzoneTarget.querySelector(".file-upload-input"),this.titleEl=this.fileUploadInput?.querySelector(".file-upload-input__title"),this.originalTitleHTML=this.titleEl?.innerHTML}disconnect(){this.fileInput&&(this.fileInput.remove(),this.fileInput=null)}setupFileInput(){this.fileInput=document.createElement("input"),this.fileInput.type="file",this.fileInput.multiple=!0,this.fileInput.style.display="none",this.element.appendChild(this.fileInput),this.fileInput.addEventListener("change",r=>{let e=Array.from(r.target.files);this.#e(e),this.fileInput.value=""})}triggerFileBrowser(){this.fileInput.click()}attachHandlers(){let r=this;Array.from(["drag","dragstart","dragend","dragover","dragenter","dragleave","drop"]).forEach(e=>{r.dropzoneTarget.addEventListener(e,t=>{t.preventDefault(),t.stopPropagation()})}),this.dropzoneTarget.addEventListener("dragover",e=>{r.dragAction()},!1),this.dropzoneTarget.addEventListener("dragleave",e=>{r.dropAction()},!1),this.dropzoneTarget.addEventListener("drop",e=>{r.dropAction();let{files:t}=e.dataTransfer;this.#e(t)},!1)}#e(r){this.uploadObjects=[],Array.from(r).forEach(e=>{let t=new WG(e,this);this.uploadObjects.push(t),t.addEventListener("done",()=>{this.#t()}),t.handle()})}#t(){this.uploadObjects.every(r=>r.hasFinished())&&this.#r()}#r(){let r=document.createElement("turbo-stream");r.setAttribute("action","refresh"),r.setAttribute("method","morph"),r.setAttribute("render","morph"),this.element.appendChild(r)}dragAction(){this.fileUploadInput?.setAttribute("data-dragging","true"),this.titleEl&&(this.titleEl.textContent=this.dropCopy)}dropAction(){this.fileUploadInput?.removeAttribute("data-dragging"),this.titleEl&&(this.titleEl.innerHTML=this.originalTitleHTML)}};var WLe=()=>{document.querySelector(`turbo-frame#${window.Avo.configuration.modal_frame_id}`).innerHTML=""};var ON=class extends er{static outlets=["field"];static values={itemDetailsFrameId:String,controllerSelector:String,controllerName:String,selectedItems:Array};get otherController(){return this.application.getControllerForElementAndIdentifier(document.querySelector(this.controllerSelectorValue),this.controllerNameValue)}get modalController(){return this.application.getControllerForElementAndIdentifier(document.querySelector('[data-controller="modal"]'),"modal")}selectItem(r){let{params:e}=r,{attaching:t,multiple:n}=e,i=r.target.closest('[data-component="avo/media_library/list_item_component"]'),o=[this.#e(i)];t&&(r.preventDefault(),this.insertAttachments(o,r),WLe())}insertAttachments(r,e){if(!this.otherController){console.error(`[Avo->] The Media Library failed to find any field outlets to inject the asset. Tried selector: ${this.controllerSelectorValue} and name: ${this.controllerNameValue}`);return}this.otherController.insertAttachments(r,e)}closeItemDetails(){document.querySelector(`turbo-frame#${this.itemDetailsFrameIdValue}`).innerHTML=""}#e(r){let e=JSON.parse(r.dataset.mediaLibraryBlobParam),t=r.dataset.mediaLibraryPathParam,n=r.dataset.mediaLibraryUrlParam;return{blob:e,path:t,url:n}}};var DN=class extends er{static targets=["svg","items","self","trigger"];collapsed=!0;transitionClass="css-animate-slide-down";get key(){return this.selfTarget.getAttribute("data-menu-key-param")}get defaultState(){return this.selfTarget.getAttribute("data-menu-default-collapsed-state")}get userState(){return window.localStorage.getItem(this.key)}set userState(r){window.localStorage.setItem(this.key,r)}get initiallyCollapsed(){return this.userState?this.userState==="collapsed":this.defaultState==="collapsed"}connect(){this.initiallyCollapsed?(this.collapsed=!0,this.markCollapsed()):(this.collapsed=!1,this.markExpanded())}triggerCollapse(){this.collapsed=!this.collapsed,this.userState=this.collapsed?"collapsed":"expanded",this.updateDom()}updateDom(){this.collapsed?this.markCollapsed():this.markExpanded()}markCollapsed(){this.svgTarget.classList.add("sidebar-icon--collapsed"),this.hasTriggerTarget&&this.triggerTarget.setAttribute("aria-expanded","false"),this.leave(this.itemsTarget)}markExpanded(){this.svgTarget.classList.remove("sidebar-icon--collapsed"),this.hasTriggerTarget&&this.triggerTarget.setAttribute("aria-expanded","true"),this.enter(this.itemsTarget)}async toggle(r){r.toggleAttribute("hidden"),await this.animateTransition(r)}async leave(r){r.setAttribute("hidden",!0),await this.animateTransition(r)}async enter(r){r.removeAttribute("hidden"),await this.animateTransition(r)}async animateTransition(r){r.classList.add(this.transitionClass),await this.onTransitionsEnded(r),r.classList.remove(this.transitionClass)}onTransitionsEnded(r){return Promise.allSettled(r.getAnimations().map(e=>e.finished))}};var nE=class extends er{static targets=["modal","backdrop"];static values={closeModalOnBackdropClick:{type:Boolean,default:!0}};connectModal(){this.handleKeydown=this.handleKeydown.bind(this),document.addEventListener("keydown",this.handleKeydown)}disconnectModal(){document.removeEventListener("keydown",this.handleKeydown)}handleKeydown(r){r.key==="Escape"&&this.isOpen()&&this.closeModalOnBackdropClickValue&&this.closeModal()}close(r){r.target===this.backdropTarget&&!this.closeModalOnBackdropClickValue||this.closeModal()}addModalOpen(){document.body.classList.add("modal-open")}removeModalOpen(){document.body.classList.remove("modal-open")}dispatchClose(){document.dispatchEvent(new Event("modal-controller:close"))}closeModal(){throw new Error("Subclass must implement closeModal()")}isOpen(){throw new Error("Subclass must implement isOpen()")}};var IN=class extends nE{connect(){this.connectModal(),this.addModalOpen(),this.modalTarget.focus()}disconnect(){this.disconnectModal()}isOpen(){return!0}closeModal(){this.modalTarget.remove(),this.removeModalOpen(),this.dispatchClose()}};var MN=class extends er{static targets=["container"];static values={currentWidth:String,currentHeight:String};connect(){this.modalElement=this.element,this.updateWidthClass(this.currentWidthValue),this.updateHeightClass(this.currentHeightValue)}changeWidth(r){let e=r.currentTarget.dataset.width;this.updateWidthClass(e),this.currentWidthValue=e}changeHeight(r){let e=r.currentTarget.dataset.height;this.updateHeightClass(e),this.currentHeightValue=e}updateWidthClass(r){this.modalElement.classList.remove("modal--width-sm","modal--width-md","modal--width-lg","modal--width-xl","modal--width-2xl","modal--width-3xl","modal--width-4xl","modal--width-full","modal--width-25","modal--width-50","modal--width-75","modal--width-100"),this.containerTarget.classList.remove("w-sm","w-md","w-lg","w-xl","w-2xl","w-3xl","w-4xl","w-full"),this.modalElement.classList.add(`modal--width-${r}`),r==="full"?this.containerTarget.classList.add("w-full"):this.containerTarget.classList.add(`w-${r}`)}updateHeightClass(r){this.modalElement.classList.remove("modal--height-auto","modal--height-sm","modal--height-md","modal--height-lg","modal--height-xl","modal--height-2xl","modal--height-3xl","modal--height-4xl","modal--height-full","modal--height-25","modal--height-50","modal--height-75","modal--height-100"),this.modalElement.classList.add(`modal--height-${r}`)}};var PN=class extends yh{static targets=["selector"];getFilterValue(){let r=Array.from(this.selectorTarget.selectedOptions).map(({value:e})=>e);return r.length===0?null:r}getFilterClass(){let{filterClass:r}=this.selectorTarget.dataset;return r}};var iE=class extends er{add(e){e.preventDefault();let t=this.templateTarget.innerHTML.replace(/NEW_RECORD/g,new Date().getTime().toString());this.targetTarget.insertAdjacentHTML("beforebegin",t)}remove(e){e.preventDefault();let t=e.target.closest(this.wrapperSelectorValue);if(t.dataset.newRecord==="true")t.remove();else{t.style.display="none";let n=t.querySelector("input[name*='_destroy']");n.value="1"}}};iE.targets=["target","template"];iE.values={wrapperSelector:{type:String,default:".nested-form-wrapper"}};var LN=class extends iE{static targets=["addButton","removeButton","nestedRecord"];static values={limit:Number,confirmMessage:String};add(r){super.add(r),this.toggleAddButton()}remove(r){window.confirm(this.confirmMessageValue)&&(super.remove(r),this.toggleAddButton())}toggleAddButton(){this.limitValue>0&&this.addButtonTarget.classList.toggle("!hidden",this.nestedRecordTargets.length>=this.limitValue)}};var RN=class extends er{refresh(){let r=this.context.scope.element.closest("turbo-frame");this.element.querySelector("svg").classList.add("animate-spin"),r?(r.classList.add("opacity-50"),r.addEventListener("turbo:frame-load",()=>{r.classList.remove("opacity-50")},{once:!0}),r.reload()):console.error(`Element with ID '${this.turboFrameIdValue}' not found.`)}};var qN=class extends er{static targets=["selector"];get turboFrame(){return this.selectorTarget.dataset.turboFrame}reload(){document.querySelector(`[data-per-page-option="${this.selectorTarget.value}"][data-turbo-frame="${this.turboFrame}"]`).click()}};var FN=class extends nE{connect(){this.connectModal(),this.handleOpen=this.openModal.bind(this),this.handleToggle=this.toggleModal.bind(this),document.addEventListener("persistent-modal:open",this.handleOpen),document.addEventListener("persistent-modal:toggle",this.handleToggle)}disconnect(){this.disconnectModal(),document.removeEventListener("persistent-modal:open",this.handleOpen),document.removeEventListener("persistent-modal:toggle",this.handleToggle)}isOpen(){return!this.modalTarget.hasAttribute("hidden")}closeModal(){this.modalTarget.setAttribute("hidden",""),this.removeModalOpen(),this.dispatchClose()}openModal(){this.modalTarget.removeAttribute("hidden"),this.addModalOpen(),this.modalTarget.focus()}toggleModal(){this.isOpen()?this.closeModal():this.openModal()}};var NN=class extends er{static values={url:String};connect(){let r=this;this.tippyInstance=bS(r.context.element,{content:"loading...",allowHTML:!0,theme:"preview",maxWidth:550,async onShow(e){let n=await(await fetch(r.urlValue)).text();e.setContent(n)}})}disconnect(){this.tippyInstance&&(this.tippyInstance.destroy(),this.tippyInstance=null)}};var BN=class extends er{static targets=["label","valueInput","visibleInput"];update(){this.valueInputTarget.value=this.visibleInputTarget.value,this.labelTarget.textContent=this.valueInputTarget.value}};var tY=Ao(Tqe()),rY=Ao(Kqe()),VN=class extends er{lastCheckedIndex=null;autoClicking=!1;get itemSelectorCells(){return document.querySelectorAll(".item-selector-cell")}get hasLastCheckedIndex(){return this.lastCheckedIndex!==null}connect(){this.#t()}disconnect(){this.#r()}toggleMultiple(r){if(this.autoClicking)return;if(!this.hasLastCheckedIndex){this.#c(r);return}if(!r.shiftKey){this.#u();return}let e=parseInt(r.target.dataset.index),t=(0,tY.default)((0,rY.default)(this.lastCheckedIndex,e),[this.lastCheckedIndex,e]);this.autoClicking=!0;let n=r.target.checked;t.forEach(i=>{let o=document.querySelector(`input[type="checkbox"][data-index="${i}"]`);o.checked!==n&&o.click()}),this.#f(r),this.autoClicking=!1,this.#u(),this.#e()}#e(){this.#r(),this.#t()}#t(){this.boundMouseenterHandler=this.#i.bind(this),this.boundMouseleaveHandler=this.#n.bind(this),Array.from(this.itemSelectorCells).forEach(r=>{r.addEventListener("mouseenter",this.boundMouseenterHandler),r.addEventListener("mouseleave",this.boundMouseleaveHandler)}),document.addEventListener("keydown",this.#o),document.addEventListener("keyup",this.#s)}#r(){Array.from(this.itemSelectorCells).forEach(r=>{r.removeEventListener("mouseenter",this.boundMouseenterHandler),r.removeEventListener("mouseleave",this.boundMouseleaveHandler)}),document.removeEventListener("keydown",this.#o),document.removeEventListener("keyup",this.#s)}#i(r){r.target.closest("tr").classList.add("highlighted-row"),this.lastCheckedIndex&&this.#a(this.lastCheckedIndex,parseInt(r.target.closest("tr").dataset.index))}#n(r){r.target.closest("tr").classList.remove("highlighted-row"),document.querySelectorAll("tr[data-index]").forEach(e=>{e.classList.remove("highlighted-row")})}#a(r,e){(0,tY.default)((0,rY.default)(r,e)).forEach(n=>{document.querySelector(`tr[data-index="${n}"]`).classList.add("highlighted-row")})}#o(r){r.shiftKey&&document.body.classList.add("shift-pressed")}#s(r){r.shiftKey||document.body.classList.remove("shift-pressed")}#u(){this.lastCheckedIndex=null}#c(r){this.lastCheckedIndex=parseInt(r.target.dataset.index),r.target.closest("tr").classList.add("highlighted-row")}#f(r){this.lastCheckedIndex=parseInt(r.target.dataset.index),r.target.closest("tr").classList.add("highlighted-row")}};var WN=class extends er{static values={polymorphic:Boolean,searchable:Boolean,targetName:String,relationName:String};beforeStreamRender(r){let{relationName:e}=r.target.dataset;if(r.target.action!=="update-belongs-to"||this.relationNameValue!==e)return!1;r.detail.render=t=>{this.searchableValue?this.updateSearchable(t):this.updateNonSearchable(t)}}updateSearchable(r){document.querySelector(`input[name="${this.targetNameValue}"][type="hidden"]`).value=r.dataset.targetRecordId,document.querySelector(`input[name="${this.targetNameValue}"][type="text"]`).value=r.dataset.targetResourceLabel}updateNonSearchable(r){let e=document.querySelector(`select[name="${this.targetNameValue}"]`),t=document.createElement("option");t.value=r.dataset.targetRecordId,t.text=r.dataset.targetResourceLabel,t.selected="selected",e.appendChild(t)}};var aY=Ao(aNe()),$N=class extends er{static targets=[];static values={view:String};debugOnInput(r){console.log("onInput",r,r.target.value)}toggle({params:r}){let{toggleTarget:e,toggleTargets:t}=r;e&&this.toggleAvoTarget(e),t&&t.length>0&&t.forEach(this.toggleAvoTarget.bind(this))}disable({params:r}){let{disableTarget:e,disableTargets:t}=r;e&&this.disableAvoTarget(e),t&&t.length>0&&t.forEach(this.disableAvoTarget.bind(this))}toggleAvoTarget(r){let e=(0,aY.default)(r),t=document.querySelector(`[data-resource-edit-target="${e}"]`);t&&t.classList.toggle("hidden")}disableAvoTarget(r){let e=(0,aY.default)(r);document.querySelectorAll(`[data-resource-edit-target="${e}"]`).forEach(this.toggleItemDisabled),document.querySelectorAll(`[data-resource-edit-target="${e}"] input`).forEach(this.toggleItemDisabled),document.querySelectorAll(`[data-resource-edit-target="${e}"] select`).forEach(this.toggleItemDisabled),document.querySelectorAll(`[data-resource-edit-target="${e}"] [data-slot="value"] button`).forEach(this.toggleItemDisabled)}toggleItemDisabled(r){r.disabled=!r.disabled}};var KN=class extends er{};var GN=class extends er{static targets=["input","overlay"];static values={debounce:{type:Number,default:300},url:String};connect(){this.#n(),this.#o()}disconnect(){this.#n(),this.#o()}blurOnEscape(r){r.key==="Escape"&&(r.preventDefault(),this.inputTarget.blur())}search(){this.debouncedSearch()}debouncedSearch=this.debounce(this.performSearch,this.debounceValue);async performSearch(){let r=this.inputTarget.value,[e,t]=this.urlValue.split("?"),n=this.buildSearchUrl(e,t,r);(!t||!t.includes("turbo_frame"))&&window.history.replaceState({},"",n);try{this.#i(),await hK(n,{responseKind:"turbo-stream",headers:{Accept:"text/vnd.turbo-stream.html","X-Search-Request":"resource-search-controller"}})}catch{}finally{this.#s()}}buildSearchUrl(r,e,t){let n=new URLSearchParams(e);return t?n.set("q",t):n.delete("q"),n.set("page","1"),`${r}?${n.toString()}`}debounce(r,e){let t;return function(...i){let o=()=>{clearTimeout(t),r.apply(this,i)};clearTimeout(t),t=setTimeout(o,e)}}#e=null;#t=null;#r=500;#i(){this.#n(),this.#e=setTimeout(()=>this.#a(),this.#r)}#n(){this.#e&&(clearTimeout(this.#e),this.#e=null)}#a(){document.body.classList.add("search-loading"),this.overlayTarget.classList.add("is-active"),this.#t=this.overlayTarget}#o(){document.body.classList.remove("search-loading"),this.#t&&this.#t.classList.remove("is-active"),this.#t=null}#s(){this.#n(),this.#o()}};var YN=class extends er{};function d_(r){return{current:r}}function uE(r,e){var t=void 0;return function(){for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];t&&clearTimeout(t),t=setTimeout(function(){return r.apply(void 0,i)},e)}}function j$t(r,e){return W$t(r)||V$t(r,e)||H$t(r,e)||U$t()}function U$t(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
696
696
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function H$t(r,e){if(r){if(typeof r=="string")return sNe(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return sNe(r,e)}}function sNe(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function V$t(r,e){var t=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var n,i,o,a,s=[],u=!0,h=!1;try{if(o=(t=t.call(r)).next,e===0){if(Object(t)!==t)return;u=!1}else for(;!(u=(n=o.call(t)).done)&&(s.push(n.value),s.length!==e);u=!0);}catch(d){h=!0,i=d}finally{try{if(!u&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(h)throw i}}return s}}function W$t(r){if(Array.isArray(r))return r}function cE(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:new Set;return r;var t}function Hv(r){return r.reduce(function(e,t){return e.concat(t)},[])}var $$t=0;function ZN(){return"autocomplete-".concat($$t++)}function fE(r,e){return e.reduce(function(t,n){return t&&t[n]},r)}function Gb(r){return r.collections.length===0?0:r.collections.reduce(function(e,t){return e+t.items.length},0)}function lNe(r){return r!==Object(r)}function sY(r,e){if(r===e)return!0;if(lNe(r)||lNe(e)||typeof r=="function"||typeof e=="function")return r===e;if(Object.keys(r).length!==Object.keys(e).length)return!1;for(var t=0,n=Object.keys(r);t<n.length;t++){var i=n[t];if(!(i in e)||!sY(r[i],e[i]))return!1}return!0}var p_=function(){};function uNe(r){if(typeof window<"u")return r({window})}var XN="1.19.4";var cNe=[{segment:"autocomplete-core",version:XN}];function lY(r){var e=r.item,t=r.items,n=t===void 0?[]:t;return{index:e.__autocomplete_indexName,items:[e],positions:[1+n.findIndex(function(i){return i.objectID===e.objectID})],queryID:e.__autocomplete_queryID,algoliaSource:["autocomplete"]}}function K$t(r,e){return X$t(r)||Z$t(r,e)||Y$t(r,e)||G$t()}function G$t(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
697
697
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Y$t(r,e){if(r){if(typeof r=="string")return fNe(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return fNe(r,e)}}function fNe(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function Z$t(r,e){var t=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var n,i,o,a,s=[],u=!0,h=!1;try{if(o=(t=t.call(r)).next,e===0){if(Object(t)!==t)return;u=!1}else for(;!(u=(n=o.call(t)).done)&&(s.push(n.value),s.length!==e);u=!0);}catch(d){h=!0,i=d}finally{try{if(!u&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(h)throw i}}return s}}function X$t(r){if(Array.isArray(r))return r}function hNe(r){var e=(r.version||"").split(".").map(Number),t=K$t(e,2),n=t[0],i=t[1],o=n>=3,a=n===2&&i>=4,s=n===1&&i>=10;return o||a||s}var J$t=["items"],Q$t=["items"];function EO(r){"@babel/helpers - typeof";return EO=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},EO(r)}function JN(r){return n9t(r)||r9t(r)||t9t(r)||e9t()}function e9t(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
698
698
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function t9t(r,e){if(r){if(typeof r=="string")return uY(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return uY(r,e)}}function r9t(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function n9t(r){if(Array.isArray(r))return uY(r)}function uY(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function pNe(r,e){if(r==null)return{};var t=i9t(r,e),n,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);for(i=0;i<o.length;i++)n=o[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(r,n)&&(t[n]=r[n])}return t}function i9t(r,e){if(r==null)return{};var t={},n=Object.keys(r),i,o;for(o=0;o<n.length;o++)i=n[o],!(e.indexOf(i)>=0)&&(t[i]=r[i]);return t}function dNe(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function hE(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?dNe(Object(t),!0).forEach(function(n){o9t(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):dNe(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function o9t(r,e,t){return e=a9t(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function a9t(r){var e=s9t(r,"string");return EO(e)==="symbol"?e:String(e)}function s9t(r,e){if(EO(r)!=="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(EO(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function l9t(r){for(var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:20,t=[],n=0;n<r.objectIDs.length;n+=e)t.push(hE(hE({},r),{},{objectIDs:r.objectIDs.slice(n,n+e)}));return t}function QN(r){return r.map(function(e){var t=e.items,n=pNe(e,J$t);return hE(hE({},n),{},{objectIDs:t?.map(function(i){var o=i.objectID;return o})||n.objectIDs})})}function mNe(r){var e=hNe(r);function t(n,i,o){if(e&&typeof o<"u"){var a=o[0].__autocomplete_algoliaCredentials,s=a.appId,u=a.apiKey,h={"X-Algolia-Application-Id":s,"X-Algolia-API-Key":u};r.apply(void 0,[n].concat(JN(i),[{headers:h}]))}else r.apply(void 0,[n].concat(JN(i)))}return{init:function(i,o){r("init",{appId:i,apiKey:o})},setAuthenticatedUserToken:function(i){r("setAuthenticatedUserToken",i)},setUserToken:function(i){r("setUserToken",i)},clickedObjectIDsAfterSearch:function(){for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];o.length>0&&t("clickedObjectIDsAfterSearch",QN(o),o[0].items)},clickedObjectIDs:function(){for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];o.length>0&&t("clickedObjectIDs",QN(o),o[0].items)},clickedFilters:function(){for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];o.length>0&&r.apply(void 0,["clickedFilters"].concat(o))},convertedObjectIDsAfterSearch:function(){for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];o.length>0&&t("convertedObjectIDsAfterSearch",QN(o),o[0].items)},convertedObjectIDs:function(){for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];o.length>0&&t("convertedObjectIDs",QN(o),o[0].items)},convertedFilters:function(){for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];o.length>0&&r.apply(void 0,["convertedFilters"].concat(o))},viewedObjectIDs:function(){for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];o.length>0&&o.reduce(function(s,u){var h=u.items,d=pNe(u,Q$t);return[].concat(JN(s),JN(l9t(hE(hE({},d),{},{objectIDs:h?.map(function(y){var S=y.objectID;return S})||d.objectIDs})).map(function(y){return{items:h,payload:y}})))},[]).forEach(function(s){var u=s.items,h=s.payload;return t("viewedObjectIDs",[h],u)})},viewedFilters:function(){for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];o.length>0&&r.apply(void 0,["viewedFilters"].concat(o))}}}function gNe(r){var e=r.items,t=e.reduce(function(n,i){var o;return n[i.__autocomplete_indexName]=((o=n[i.__autocomplete_indexName])!==null&&o!==void 0?o:[]).concat(i),n},{});return Object.keys(t).map(function(n){var i=t[n];return{index:n,items:i,algoliaSource:["autocomplete"]}})}function dE(r){return r.objectID&&r.__autocomplete_indexName&&r.__autocomplete_queryID}function TO(r){"@babel/helpers - typeof";return TO=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},TO(r)}function pE(r){return h9t(r)||f9t(r)||c9t(r)||u9t()}function u9t(){throw new TypeError(`Invalid attempt to spread non-iterable instance.