"use strict";(globalThis.blocksyJsonP=globalThis.blocksyJsonP||[]).push([[783],{6783:function(t,e,n){n.r(e),n.d(e,{bootButtonLoaderFlow:function(){return c}});var o=n(4705);function a(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,o)}return n}function l(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?a(Object(n),!0).forEach(function(e){(0,o.A)(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}const c=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t=l({el:null,event:null,chunk:null,loadedChunks:{},ensureAtLeast:500},t);const e=t.loadedChunks[t.chunk.id],n=(new Date).getTime(),{el:o}=t,a=o.dataset.buttonState,c=o.closest(".ct-panel.active");if(document.querySelector(".ct-panel.active")&&!c||"loading"===o.dataset.buttonState)return;if(c&&t.chunk.has_loader.will_open_overlay){o.dataset.buttonState="loading";const n=document.querySelector(".ct-panel.active .ct-toggle-close");if(e&&e.maybeGetPanelContent){e.maybeGetPanelContent(t.el,{event:t.event})&&(o.dataset.buttonState=a)}return void t.loadChunkWithPayload(t.chunk,{event:t.event,completeAction:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t=l({hasCheckmarkWithTimeout:!1,finalState:"",onCompleted:function(){}},t),n&&(n.click(),ctEvents.once("ct:modal:closed",t.onCompleted))},initialState:a},o)}let i=!0;if(e&&e.maybeGetPanelContent){e.maybeGetPanelContent(t.el,{event:t.event})&&(i=!1)}i&&(o.dataset.buttonState="loading"),t.loadChunkWithPayload(t.chunk,{event:t.event,completeAction:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e=l({hasCheckmarkWithTimeout:!1,finalState:"",onCompleted:function(){}},e);const a=function(){const a=(new Date).getTime();a-n<t.ensureAtLeast&&i?setTimeout(function(){o.dataset.buttonState=e.finalState,e.onCompleted()},t.ensureAtLeast-(a-n)):(o.dataset.buttonState=e.finalState,e.onCompleted())};e.hasCheckmarkWithTimeout?(o.dataset.buttonState="done",setTimeout(a,1e3)):a()},initialState:a},o)}}}]);