/**
 * 
 */
 var prebootInitFn = (function() {
      

function start(prebootData,win){const _document=(win||window).document||{},currentScript=_document.currentScript||[].slice.call(_document.getElementsByTagName("script"),-1)[0];if(!currentScript)return void console.error("Preboot initialization failed, no currentScript has been detected.");let serverNode=currentScript.parentNode;if(!serverNode)return void console.error("Preboot initialization failed, the script is detached");serverNode.removeChild(currentScript);let eventSelectors=(prebootData.opts||{}).eventSelectors||[];const appData={root:prebootData.opts?getAppRoot(_document,prebootData.opts,serverNode):null,events:[]};prebootData.apps&&prebootData.apps.push(appData),eventSelectors=eventSelectors.map(eventSelector=>(eventSelector.hasOwnProperty("replay")||(eventSelector.replay=!0),eventSelector)),eventSelectors.forEach(eventSelector=>handleEvents(_document,prebootData,appData,eventSelector))}

function createOverlay(_document){let overlay=_document.createElement("div");return overlay.setAttribute("id","prebootOverlay"),overlay.setAttribute("style","display:none;position:absolute;left:0;top:0;width:100%;height:100%;z-index:999999;background:black;opacity:.3"),_document.documentElement.appendChild(overlay),overlay}

function getAppRoot(_document,opts,serverNode){const root={serverNode};return root.clientNode=opts.buffer?createBuffer(root):root.serverNode,opts.disableOverlay||(root.overlay=createOverlay(_document)),root}

function handleEvents(_document,prebootData,appData,eventSelector){const serverRoot=appData.root.serverNode;!serverRoot||eventSelector.events.forEach(eventName=>{const handler=createListenHandler(_document,prebootData,eventSelector,appData);serverRoot.addEventListener(eventName,handler,!0),prebootData.listeners&&prebootData.listeners.push({node:serverRoot,eventName,handler})})}

function createListenHandler(_document,prebootData,eventSelector,appData){const CARET_EVENTS=["keyup","keydown","focusin","mouseup","mousedown"],CARET_NODES=["INPUT","TEXTAREA"],matches=_document.documentElement.matches||_document.documentElement.msMatchesSelector,opts=prebootData.opts;return function(event){const node=event.target;if(!matches.call(node,eventSelector.selector))return;const root=appData.root,eventName=event.type;if(!node||!eventName)return;const keyCodes=eventSelector.keyCodes;if(keyCodes&&keyCodes.length&&!keyCodes.filter(keyCode=>event.which===keyCode).length)return;eventSelector.preventDefault&&event.preventDefault(),eventSelector.action&&eventSelector.action(node,event);const nodeKey=getNodeKeyForPreboot({root,node});if(CARET_EVENTS.indexOf(eventName)>=0){const isCaretNode=CARET_NODES.indexOf(node.tagName?node.tagName:"")>=0;prebootData.activeNode={root,node,nodeKey,selection:isCaretNode?getSelection(node):void 0}}else"change"!==eventName&&"focusout"!==eventName&&(prebootData.activeNode=void 0);if(opts&&!opts.disableOverlay&&eventSelector.freeze){const overlay=root.overlay;overlay.style.display="block",overlay.classList.add("is-loading"),setTimeout(()=>{overlay.style.display="none"},1e4)}eventSelector.replay&&appData.events.push({node,nodeKey,event,name:eventName})}}

function getSelection(node){const nodeValue=(node=node||{}).value||"",selection={start:nodeValue.length,end:nodeValue.length,direction:"forward"};try{(node.selectionStart||0===node.selectionStart)&&(selection.start=node.selectionStart,selection.end=node.selectionEnd?node.selectionEnd:0,selection.direction=node.selectionDirection?node.selectionDirection:"none")}catch{}return selection}

function createBuffer(root){const serverNode=root.serverNode;if(!serverNode||!serverNode.parentNode||serverNode===document.documentElement||serverNode===document.body)return serverNode;const rootClientNode=serverNode.cloneNode(!1);return rootClientNode.style.display="none",serverNode.parentNode.insertBefore(rootClientNode,serverNode),serverNode.setAttribute("ng-non-bindable",""),rootClientNode}

function getNodeKeyForPreboot(nodeContext){const ancestors=[],root=nodeContext.root,node=nodeContext.node;let temp=node;for(;temp&&temp!==root.serverNode&&temp!==root.clientNode;)ancestors.push(temp),temp=temp.parentNode;temp&&ancestors.push(temp);let key=node.nodeName||"unknown";for(let i2=ancestors.length-1;i2>=0;i2--)if(temp=ancestors[i2],temp.childNodes&&i2>0)for(let j=0;j<temp.childNodes.length;j++)if(temp.childNodes[j]===ancestors[i2-1]){key+="_s"+(j+1);break}return key}


      return (function initAll(opts,win){const theWindow=win||window,data=theWindow.prebootData={opts,apps:[],listeners:[]};return()=>start(data,theWindow)})({"buffer":true,"replay":true,"disableOverlay":false,"eventSelectors":[{"selector":"input:not([data-preboot-ssr-value]),textarea:not([data-preboot-ssr-value])","events":["keypress","keyup","keydown","input","change"]},{"selector":"select,option","events":["change"]},{"selector":"input:not([data-preboot-ssr-value])","events":["keyup"],"preventDefault":true,"keyCodes":[13],"freeze":true},{"selector":"form","events":["submit"],"preventDefault":true,"freeze":true},{"selector":"input,textarea","events":["focusin","focusout","mousedown","mouseup"],"replay":false},{"selector":"button","events":["click"],"preventDefault":true,"freeze":true},{"selector":"a","events":["mousedown","mouseup"],"freeze":true},{"selector":"input[data-preboot-ssr-value],textarea[data-preboot-ssr-value]","events":["keypress","keyup","keydown","input","change"],"replay":false},{"selector":"input[data-preboot-focus=\"true\"],textarea[data-preboot-focus=\"true\"]","events":["focusin","focusout"],"replay":true}],"appRoot":"elk-app"});
    })();