PageSourceSearch

https://www.emprisebank.com/7954-1b5dd90cc8633b64e2ee.js

js emprisebank.com collected 2026-10-02 04:14:29 UTC 64,636 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunkmbb_gatsby_content=self.webpackChunkmbb_gatsby_content||[]).push([[7954],{7954:function(t,e,n){n.r(e),n.d(e,{default:function(){return ie}});var o=n(6540);function i(){return window.self!==window.top}const s={debug:!1,defaultDataAttributes:{languageCodename:void 0,environmentId:void 0},forceWebSpotlightMode:!1,isInsideWebSpotlight:!1,queryParam:"ksl-enabled",baseUrl:"kontent.ai"};function a(t){return t.forceWebSpotlightMode||i()&&t.isInsideWebSpotlight}var r,l,d,c;function u(t){return!t||function(t,e){const n=t.getAttribute(l.DisableFeatures);return n?.toLowerCase().includes(e)??!1}(t,d.Highlight)?c.None:t.hasAttribute(r.ElementCodename)?c.Element:t.hasAttribute(r.ComponentId)?c.ContentComponent:t.hasAttribute(r.ItemId)?c.ContentItem:c.None}!function(t){t.AddButtonInsertPosition="data-kontent-add-button-insert-position",t.ElementCodename="data-kontent-element-codename",t.ComponentId="data-kontent-component-id",t.ItemId="data-kontent-item-id",t.LanguageCodename="data-kontent-language-codename",t.EnvironmentId="data-kontent-environment-id"}(r||(r={})),function(t){t.AddButton="data-kontent-add-button",t.AddButtonRenderPosition="data-kontent-add-button-render-position",t.DisableFeatures="data-kontent-disable-features"}(l||(l={})),function(t){t.Highlight="highlight"}(d||(d={})),function(t){t.None="",t.Element="element",t.ContentComponent="content-component",t.ContentItem="content-item"}(c||(c={}));const p=`[${l.DisableFeatures}*="${d.Highlight}"]`,h=`*[${r.ElementCodename}]:not(${p})`,m=`*[${r.ComponentId}]:not([${r.ElementCodename}]):not(${p})`,g=`*[${r.ItemId}]:not([${r.ComponentId}]):not([${r.ElementCodename}]):not(${p})`,f=`${h}, ${m}, ${g}, ${`*[${l.AddButton}]`}`,b=`${h}, ${g}`;function v(t,e){const n=a(e);return e.debug||n?t.querySelectorAll(f):t.querySelectorAll(b)}function k(t,e){return C(t,e)||w(t,e)}function C(t,e){switch(u(t)){case c.None:return!1;case c.Element:case c.ContentItem:return!0;case c.ContentComponent:return e.debug||a(e)}}function w(t,e){return((a(e)||e.debug)&&t&&t.hasAttribute(l.AddButton))??!1}class y extends Error{constructor(t){super(t),this.name="AssertionError",Object.setPrototypeOf(this,y.prototype)}}class E extends Error{constructor(t){super(t),this.name="NotImplementedError",Object.setPrototypeOf(this,E.prototype)}}class I extends Error{constructor(t){super(t),this.name="InvalidEnvironmentError",Object.setPrototypeOf(this,I.prototype)}}class R extends Error{constructor(t){super(t),this.name="NotInitializedError",Object.setPrototypeOf(this,R.prototype)}}function L(t){throw new Error(t)}function x(t){return`https://app.${t.baseUrl??s.baseUrl}/goto/edit-item/project/${t.environmentId}/variant-codename/${t.languageCodename}/item/${t.itemId}`}function $(t){return"contentComponentId"in t?`${x({environmentId:(e={environmentId:t.environmentId,languageCodename:t.languageCodename,itemId:t.itemId,contentComponentId:t.contentComponentId,componentElementCodename:t.componentElementCodename,baseUrl:t.baseUrl}).environmentId,languageCodename:e.languageCodename,itemId:e.itemId,baseUrl:e.baseUrl})}/component/${e.contentComponentId}/element/${e.componentElementCodename}`:function(t){return`${x({environmentId:t.environmentId,languageCodename:t.languageCodename,itemId:t.itemId,baseUrl:t.baseUrl})}/element/${t.elementCodename}`}({environmentId:t.environmentId,languageCodename:t.languageCodename,itemId:t.itemId,elementCodename:t.elementCodename,baseUrl:t.baseUrl});var e}var T,A,P,S,B,_,M,H;!function(t){t.After="after",t.Before="before",t.End="end",t.Start="start"}(T||(T={})),function(t){t.CreateComponent="CreateComponent",t.CreateLinkedItem="CreateLinkedItem",t.InsertLinkedItem="InsertLinkedItem"}(A||(A={})),function(t){t.LinkedItems="LinkedItems",t.RichText="RichText",t.Unknown="Unknown"}(P||(P={})),function(t){t.CreateNew="createNew",t.Edit="edit",t.ViewParent="viewParent"}(S||(S={})),function(t){t.ItemNotTranslated="ItemNotTranslated",t.Ok="Ok",t.PermissionMissing="PermissionMissing",t.RteWithForbiddenComponents="RteWithForbiddenComponents",t.Unknown="Unknown"}(B||(B={})),function(t){t.ElementClicked="kontent-smart-link:element:clicked",t.ContentItemClicked="kontent-smart-link:content-item:clicked",t.ContentComponentClicked="kontent-smart-link:content-component:clicked",t.Initialized="kontent-smart-link:initialized",t.Status="kontent-smart-link:status",t.AddInitial="kontent-smart-link:add:initial",t.AddAction="
1kontent-smart-link:add:action",t.RefreshPreview="kontent-smart-link:preview:refresh",t.UpdatePreview="kontent-smart-link:preview:update",t.PreviewIFrameCurrentUrl="kontent-smart-link:preview:current-url",t.PreviewIFrameCurrentUrlResponse="kontent-smart-link:preview:current-url:response"}(_||(_={})),function(t){t.AddInitialResponse="kontent-smart-link:add:initial:response"}(M||(M={})),function(t){t[t.Debug=1]="Debug",t[t.Info=2]="Info",t[t.Warn=3]="Warn",t[t.Error=4]="Error"}(H||(H={}));let z=H.Info;function D(t){z=t}function V(...t){z<=H.Error&&console.error("[KSL][Error]: ",...t)}function N(...t){z<=H.Warn&&console.warn("[KSL][Warning]: ",...t)}function O(...t){z<=H.Info&&console.info("[KSL][Info]: ",...t)}function j(...t){z<=H.Debug&&console.log("[KSL][Debug]: ",...t)}function q(...t){z<=H.Info&&console.groupCollapsed(...t)}function U(){z<=H.Info&&console.groupEnd()}const F=(t,e)=>{const n=t.parsed.languageCodename??e.languageCodename,o=t.parsed.environmentId??e.environmentId;if(!n||!o){return{success:!1,missing:[...n?[]:["languageCodename"],...o?[]:["environmentId"]]}}return{success:!0,data:{languageCodename:n,projectId:o}}};function K(t,e){const n=F(t,e);return t.parsed.itemId&&n.success?{success:!0,data:{languageCodename:n.data.languageCodename,projectId:n.data.projectId,itemId:t.parsed.itemId}}:{success:!1,missing:[...t.parsed.itemId?[]:["itemId"],...n.success?[]:n.missing]}}function W(t,e){const n=K(t,e);return t.parsed.elementCodename&&n.success?{success:!0,data:{...n.data,elementCodename:t.parsed.elementCodename,contentComponentId:t.parsed.contentComponentId??void 0}}:{success:!1,missing:["elementCodename",...n.success?[]:n.missing]}}function Z(t,e){const n=K(t,e);return t.parsed.contentComponentId&&n.success?{success:!0,data:{...n.data,contentComponentId:t.parsed.contentComponentId}}:{success:!1,missing:["contentComponentId",...n.success?[]:n.missing]}}const Q=t=>{switch(t){case"after":return T.After;case"before":return T.Before;case"start":return T.Start;default:return T.End}};function G(t,e){const n=F(t,e.defaultDataAttributes),o=(t=>{const e=Q(t.parsed.placement);return e!==T.After&&e!==T.Before||t.parsed.targetId?{success:!0,data:{placement:e,targetId:t.parsed.targetId??void 0}}:{success:!1,missing:["targetId"]}})(t);return t.parsed.itemId&&t.parsed.elementCodename&&o.success&&n.success?(e.debug&&Y(t.debugData,"[KSL]: Parsed add button data attributes"),{success:!0,data:{projectId:n.data.projectId,languageCodename:n.data.languageCodename,itemId:t.parsed.itemId,contentComponentId:t.parsed.contentComponentId??void 0,insertPosition:o.data,elementCodename:t.parsed.elementCodename}}):(Y(t.debugData,"[KSL]: Parsing add button data attributes failed"),{success:!1,missing:[...t.parsed.itemId?[]:["itemId"],...t.parsed.elementCodename?[]:["elementCodename"],...o.success?[]:o.missing,...n.success?[]:n.missing]})}const Y=(t,e)=>{q(e),t.forEach(t=>{q(t.element),t.parsedAttributes.length>0&&(O("Resolved attributes:"),t.parsedAttributes.forEach(t=>{O(`${t.token}: ${t.dataAttribute}: ${t.value}`)})),t.skippedAttributes.length>0&&(O("Parsed Kontent.ai attributes:"),t.skippedAttributes.forEach(t=>{O(`${t.dataAttribute}: ${t.value}`)})),U()}),U()};function J(t,e){if(!t){const t=new y(e);throw V(t),t}}function X(t){const e=function(t){switch(t){case c.Element:return st;case c.ContentComponent:return it;case c.ContentItem:return ot;case c.None:return nt}}(u(t));return j("Parsing edit button data attributes for element: ",t),j("Parsing values from data attributes using this pattern: ",e),et(e,t)}function tt(t){const e=function(t){switch(t){case T.After:case T.Before:return rt;default:return lt}}(t.getAttribute(r.AddButtonInsertPosition));return j("Parsing add button data attributes for element: ",t),j("Parsing values from data attributes following this pattern: ",e),et(e,t)}const et=(t,e)=>{if(!e||0===t.length)return{parsed:{},debugData:[]};const n=Object.values(r).map(t=>{const n=e.getAttribute(t);return n?{dataAttribute:t,value:n}:null}).filter(t=>null!==t),o=function(t,e){const n=new Set,o=[];for(const i of t){const t=e.find(t=>i.dataAttributes.includes(t.dataAttribute)&&!n.has(t.dataAttribute));if(t||!i.optional){if(!t)break;n.add(t.dataAttribute),o.push({token:i.key,value:t.value,dataAttribute:t.dataAttribute})}}return o}(t,n),i=t.findIndex(t=>t.key===o.at(-1)?.token),s=t.slice(i+1),a=et(s,e.parentElement);return{parsed:{...Object.fromEntries(o.map(t=>[t.token,t.value])),...a.parsed},debugData:[...a.debugData,...n.length>0?[{element:e,parsedAttributes:n.filter(t=>void 0!==o.find(e=>e.dataAttribute===t.dataAttribute)).map(t=>({token:o.find(e=>e.dataAttribute===t.dataAttribute)?.token??L("[Parser]: Token not found"),dataAttribute:t.dataAttribute,value:t.value})),skippedAttributes:n.filter(t=>void 0===o.find(e=>e.dataAttribute===t.dataAttribute)).map(t=>({dataAttribute:t.dataAttribute,value:t.value}))}]:[]]}},nt=[{key:"languageCodename",dataAttributes:[r.LanguageCodename]},{key:"environmentId",dataAttributes:[r.EnvironmentId]}],ot=[{key:"itemId",dataAttributes:[r.ItemId]},...nt],it=[{key:"contentComponentId",dataAttributes:[r.ComponentId]},...ot],st=[{key:"elementCodename",dataAttributes:[r.ElementCodename]},{key:"contentComponentId",dataAttributes:[r.ComponentId],optional:!0},...ot],at=[{key:"elementCodename",dataAttributes:[r.ElementCodename]},{key:"contentComponentId",dataAttributes:[r.ComponentId],optional:!0},{key:"itemId",dataAttributes:[r.ItemId]},...nt],rt=[{key:"placement",dataAttributes:[r.AddButtonInsertPosition]},{key:"targetId",dataAttributes:[r.ComponentId,r.ItemId]},...at],lt=[{key:"placement",dataAttributes:[r.AddButtonInsertPosition],optional:!0},...at];function dt(t){const e=t.parentElement;if(!e)return null;const n=ct(e),o=!["TD","TH","TABLE"].includes(e.tagName);return n.isPositioned||n.isContentClipped&&o?e:dt(e)}function ct(t){const e=window.getComputedStyle(t);return{isPositioned:"static"!==e.getPropertyValue("position"),isContentClipped:e.getPropertyValue("overflow").split(" ").some(t=>["auto","scroll","clip","hidden"].includes(t))}}function ut(t){if(!t)return[0,0];const e=t.offsetParent;if(!e)return[0,0];const n=t=>{if(e.isSameNode(t)||!t)return[0,0];const[o,i]=n(t.parentElement);return[o+t.scrollTop,i+t.scrollLeft]};return n(t.parentElement)}function pt(t){const e=document.createElement("template");return e.innerHTML=t,e}"undefined"==typeof window&&(global.HTMLElement=null);class ht extends HTMLElement{static _template=null;static get is(){throw new E('KSLCustomElement: "is" getter is not implemented for this custom element.')}static get template(){return this._template??=this.initializeTemplate(),this._template}constructor(){super();const t=Object.getPrototypeOf(this).constructor;this.attachShadow({mode:"open"}).appendChild(t.template.content.cloneNode(!0))}static define(){if("undefined"==typeof window)throw new I("KSLCustomElement: custom elements can only be defined in a browser environment.");const t=this,e=window.customElements.get(this.is);return e?Promise.resolve(e):(customElements.define(this.is,t),customElements.whenDefined(this.is))}static initializeTemplate(){throw new E('KSLCustomElement: "initializeTemplate" method should be implemented for every component.')}updateAttribute(t,e){null!==e&&Boolean(e)?this.setAttribute(t,e.toString()):this.removeAttribute(t)}
1dispatchAsyncEvent(t,e,n=null){return new Promise((o,i)=>{const s=null!==n?window.setTimeout(i,n):0,a=new CustomEvent(t,{detail:{eventData:e,onResolve:t=>{window.clearTimeout(s),o(t)},onReject:t=>{window.clearTimeout(s),i(t)}}});this.dispatchEvent(a)})}}var mt,gt,ft;!function(t){t.Bottom="bottom",t.BottomEnd="bottom-end",t.BottomStart="bottom-start",t.Left="left",t.LeftEnd="left-end",t.LeftStart="left-start",t.None="",t.Right="right",t.RightEnd="right-end",t.RightStart="right-start",t.Top="top",t.TopEnd="top-end",t.TopStart="top-start"}(mt||(mt={}));class bt extends ht{get position(){return mt.None}targetRef=null;connectedCallback(){this.hasAttribute("tabindex")||this.setAttribute("tabindex","-1")}disconnectedCallback(){this.targetRef=null}attachTo(t){this.targetRef=t}calculateTopOffset(t,e){switch(this.position){case mt.TopStart:case mt.Top:case mt.TopEnd:return-t.height;case mt.BottomStart:case mt.Bottom:case mt.BottomEnd:return e.height;case mt.Left:case mt.Right:return(e.height-t.height)/2;case mt.LeftEnd:case mt.RightEnd:return e.height-t.height;case mt.LeftStart:case mt.RightStart:case mt.None:return 0}}calculateLeftOffset(t,e){switch(this.position){case mt.Top:case mt.Bottom:return(e.width-t.width)/2;case mt.TopEnd:case mt.BottomEnd:return e.width-t.width;case mt.LeftStart:case mt.Left:case mt.LeftEnd:return-t.width;case mt.RightStart:case mt.Right:case mt.RightEnd:return e.width;case mt.TopStart:case mt.BottomStart:case mt.None:return 0}}}!function(t){t.BackgroundDefault="rgba(255, 255, 255, 1)",t.BackgroundDefaultDisabled="rgba(223, 223, 223, 1)",t.BackgroundDefaultHover="rgba(21, 21, 21, 0.1)",t.BackgroundDefaultSelected="rgba(255, 240, 239, 1)",t.BackgroundSecondary="rgba(20, 22, 25, 1)",t.Primary="rgba(219, 60, 0, 1)",t.PrimaryHover="rgba(149, 48, 0, 1)",t.PrimaryTransparent="rgba(219, 60, 0, 0.5)",t.TextDefault="rgba(21, 21, 21, 1)",t.TextDefaultDisabled="rgba(140, 140, 140, 1)",t.TextSecondary="rgba(255, 255, 255, 1)"}(gt||(gt={})),function(t){t.Default="0 8px 32px rgba(16, 33, 60, 0.24), 0 0 8px rgba(0, 0, 0, 0.03)",t.Primary="0 8px 10px rgba(219, 60, 0, 0.2), 0 6px 20px rgba(219, 60, 0, 0.12), 0 8px 14px rgba(219, 60, 0, 0.14)"}(ft||(ft={}));const vt=`\n  <style>\n    :host {\n      --arrow-size: var(--ksl-pop-up-arrow-size, 12px);\n      --background-color: var(--ksl-pop-up-background-color, ${gt.BackgroundDefault});\n      --border-radius: var(--ksl-pop-up-border-radius, 4px);\n      --box-shadow: var(--ksl-pop-up-box-shadow, ${ft.Default});\n      --color: var(--ksl-pop-up-color, ${gt.TextDefault});\n      --padding: var(--ksl-pop-up-padding, 8px 8px);\n      \n      display: block;\n      position: absolute;\n      opacity: 0;\n      z-index: calc(var(--ksl-z-index, 9000) + 1000);\n      transition: opacity 250ms ease-in-out;\n    }\n  \n    :host([visible]) {\n      opacity: 1;\n    }\n    \n    :host(:focus) {\n      outline: none;\n    }\n  \n    .ksl-pop-up__content {\n      display: flex;\n      flex-direction: row;\n      justify-content: space-around;\n      align-items: center;
1\n      box-shadow: var(--box-shadow);\n      background-color: var(--background-color);\n      padding: var(--padding);\n      border-radius: var(--border-radius);\n      font-size: 12px;\n      line-height: 16px;\n      font-weight: normal;\n      color: var(--color);\n    }\n  \n    :host([position="${mt.RightStart}"]) .ksl-pop-up__content,\n    :host([position="${mt.Right}"]) .ksl-pop-up__content,\n    :host([position="${mt.RightEnd}"]) .ksl-pop-up__content {\n      margin-left: var(--arrow-size);\n    }\n  \n    :host([position="${mt.LeftStart}"]) .ksl-pop-up__content,\n    :host([position="${mt.Left}"]) .ksl-pop-up__content,\n    :host([position="${mt.LeftEnd}"]) .ksl-pop-up__content {\n      margin-right: var(--arrow-size);\n    }\n  \n    :host([position="${mt.BottomStart}"]) .ksl-pop-up__content,\n    :host([position="${mt.Bottom}"]) .ksl-pop-up__content,\n    :host([position="${mt.BottomEnd}"]) .ksl-pop-up__content {\n      margin-top: var(--arrow-size);\n    }\n  \n    :host([position="${mt.TopStart}"]) .ksl-pop-up__content,\n    :host([position="${mt.Top}"]) .ksl-pop-up__content,\n    :host([position="${mt.TopEnd}"]) .ksl-pop-up__content {\n      margin-bottom: var(--arrow-size);\n    }\n  \n    .ksl-pop-up__arrow {\n      position: absolute;\n      width: 0;\n      height: 0;\n      margin: 0 .25rem;\n    }\n  \n    :host([position="${mt.RightStart}"]) .ksl-pop-up__arrow,\n    :host([position="${mt.Right}"]) .ksl-pop-up__arrow,\n    :host([position="${mt.RightEnd}"]) .ksl-pop-up__arrow {\n      left: -(var(--arrow-size));\n      border-right: var(--arrow-size) solid var(--background-color);\n      border-top: var(--arrow-size) solid transparent;\n      border-bottom: var(--arrow-size) solid transparent;\n    }\n  \n    :host([position="${mt.LeftStart}"]) .ksl-pop-up__arrow,\n    :host([position="${mt.Left}"]) .ksl-pop-up__arrow,\n    :host([position="${mt.LeftEnd}"]) .ksl-pop-up__arrow {\n      right: -(var(--arrow-size));\n      border-top: var(--arrow-size) solid transparent;\n      border-left: var(--arrow-size) solid var(--background-color);\n      border-bottom: var(--arrow-size) solid transparent;\n    }\n  \n    :host([position="${mt.BottomStart}"]) .ksl-pop-up__arrow,\n    :host([position="${mt.Bottom}"]) .ksl-pop-up__arrow,\n    :host([position="${mt.BottomEnd}"]) .ksl-pop-up__arrow {\n      top: 0;\n      border-left: var(--arrow-size) solid transparent;\n      border-right: var(--arrow-size) solid transparent;\n      border-bottom: var(--arrow-size) solid var(--background-color);\n    }\n  \n    :host([position="${mt.TopStart}"]) .ksl-pop-up__arrow,\n    :host([position="${mt.Top}"]) .ksl-pop-up__arrow,\n    :host([position="${mt.TopEnd}"]) .ksl-pop-up__arrow {\n      bottom: 0;\n      border-top: var(--arrow-size) solid var(--background-color);\n      border-left: var(--arrow-size) solid transparent;\n      border-right: var(--arrow-size) solid transparent;\n    }\n  \n    :host([position="${mt.Top}"]) .ksl-pop-up__arrow,\n    :host([position="${mt.Bottom}"]) .ksl-pop-up__arrow {\n      left: calc(50% - var(--arrow-size) - 0.25rem);\n    }\n  \n    :host([position="${mt.TopEnd}"]) .ksl-pop-up__arrow,\n    :host([position="${mt.BottomEnd}"]) .ksl-pop-up__arrow {\n      right: 0;\n    }\n  \n    :host([position="${mt.TopStart}"]) .ksl-pop-up__arrow,\n    :host([position="${mt.BottomStart}"]) .ksl-pop-up__arrow {\n      left: 0;\n    }\n  \n    :host([position="${mt.Left}"]) .ksl-pop-up__arrow,\n    :host([position="${mt.Right}"]) .ksl-pop-up__arrow {\n      top: 8px;\n    }\n  \n    :host([position="${mt.LeftEnd}"]) .ksl-pop-up__arrow,\n    :host([position="${mt.RightEnd}"]) .ksl-pop-up__arrow {\n      bottom: 0;\n    }\n  \n    :host([position="${mt.LeftStart}"]) .ksl-pop-up__arrow,\n    :host([position="${mt.RightStart}"]) .ksl-pop-up__arrow {\n      top: 0;\n    }\n  </style>\n  <div class="ksl-pop-up__content">\n    <slot></slot>\n  </div>\n  <div class="ksl-pop-up__arrow"/>\n`;class kt extends bt{get position(){return this.getAttribute("position")??mt.Bottom}set position(t){this.updateAttribute("position",t)}get visible(){return this.hasAttribute("visible")}set visible(t){this.updateAttribute("visible",t)}static initializeTemplate(){return pt(vt)}connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","tooltip"),window.addEventListener("resize",this.adjustPosition,{capture:!0}),window.addEventListener("scroll",this.adjustPosition,{capture:!0})}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this.adjustPosition,{capture:!0}),window.removeEventListener("scroll",this.adjustPosition,{capture:!0})}attachTo=t=>{super.attachTo(t),this.adjustPosition()};adjustPosition=()=>
1{if(!this.targetRef||!this.offsetParent)return;const t=this.getBoundingClientRect(),e=this.targetRef.getBoundingClientRect(),n=this.offsetParent.getBoundingClientRect(),o=this.offsetParent.isSameNode(document.body),i=this.offsetParent.isSameNode(this.targetRef),s=this.calculateTopOffset(t,e),a=this.calculateLeftOffset(t,e);let r,l;if(i)r=s,l=a;else{const[t,n]=ut(this.parentElement);r=e.top+s+(o?window.pageYOffset:t),l=e.left+a+(o?window.pageXOffset:n)}o?(n.top+r+t.height>window.innerHeight?(this.style.bottom=`${n.height}px`,this.style.top="auto"):(this.style.bottom="auto",this.style.top=`${Math.max(-n.top,r)}px`),n.left+l+t.width>window.innerWidth?(this.style.right="0px",this.style.left="auto"):(this.style.right="auto",this.style.left=`${Math.max(-n.left,l)}px`)):(this.style.right="auto",this.style.left=`${l}px`,this.style.bottom="auto",this.style.top=`${r}px`)}}const Ct=`\n  <style>\n    :host {\n      --ksl-pop-up-arrow-size: 4px;\n      --ksl-pop-up-background-color: var(--ksl-color-background-secondary, ${gt.BackgroundSecondary});\n      --ksl-pop-up-box-shadow: none;\n      --ksl-pop-up-color: var(--ksl-color-text-secondary, ${gt.TextSecondary});\n      --ksl-pop-up-padding: 4px 6px;\n    }\n  </style>\n`;class wt extends kt{static get is(){return"ksl-tooltip"}static initializeTemplate(){const t=kt.initializeTemplate(),e=pt(Ct);return t.content.appendChild(e.content.cloneNode(!0)),t}}class yt extends ht{static get observedAttributes(){return["tooltip-disabled","tooltip-message"]}get tooltipDisabled(){return this.hasAttribute("tooltip-disabled")}set tooltipDisabled(t){this.updateAttribute("tooltip-disabled",t)}get tooltipMessage(){return this.getAttribute("tooltip-message")}set tooltipMessage(t){this.updateAttribute("tooltip-message",t)}get tooltipPosition(){return this.getAttribute("tooltip-position")??mt.Bottom}set tooltipPosition(t){this.updateAttribute("tooltip-position",t)}tooltipRef=null;connectedCallback(){this.addEventListener("focus",this.showTooltip),this.addEventListener("mouseenter",this.showTooltip),this.addEventListener("blur",this.hideTooltip),this.addEventListener("mouseleave",this.hideTooltip)}disconnectedCallback(){this.hideTooltip(),this.removeEventListener("focus",this.showTooltip),this.removeEventListener("mouseenter",this.showTooltip),this.removeEventListener("blur",this.hideTooltip),this.removeEventListener("mouseleave",this.hideTooltip)}attributeChangedCallback(t,e,n){"tooltip-disabled"===t?n&&this.hideTooltip():"tooltip-message"===t&&(n||this.hideTooltip())}showTooltip=()=>{if(this.tooltipRef&&this.hideTooltip(),!this.tooltipMessage||this.tooltipDisabled)return;const t=document.createElement(wt.is);t.innerText=this.tooltipMessage,this.tooltipRef=document.body.appendChild(t),this.tooltipRef.position=this.tooltipPosition,this.tooltipRef.attachTo(this),this.tooltipRef.visible=!0};hideTooltip=()=>{this.tooltipRef&&(this.tooltipRef.visible=!1,this.tooltipRef.remove(),this.tooltipRef=null)}}var Et;!function(t){t.CollapseScheme="icon-collapse-scheme",t.Edit="icon-edit",t.Plus="icon-plus",t.PlusPuzzle="icon-plus-puzzle",t.Puzzle="icon-puzzle",t.Spinner="icon-spinner"}(Et||(Et={}));const It=`\n  <template id="${Et.Edit}">\n    <svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">\n      <path fill-rule="evenodd" clip-rule="evenodd"\n            d="M1 14.993V10.0515L9.47121 1.58221C10.2522 0.801373 11.5183 0.801373 12.2993 1.58221L14.4132 3.69561C15.1945 4.47669 15.1945 5.74327 14.4132 6.52436L5.94263 14.993H1ZM5.52848 13.993L10.7581 8.7646L7.22982 5.23714L2 10.4658V13.993H5.52848ZM7.937 4.53012L11.4653 8.05757L13.7062 5.81717C14.0968 5.42663 14.0968 4.79334 13.7062 4.4028L11.5923 2.28939C11.2018 1.89898 10.5687 1.89898 10.1782 2.28939L7.937 4.53012Z"\n      />\n      <path\n          d="M9.48975 13.9982C9.2136 13.9982 8.98975 14.2221 8.98975 14.4982C8.98975 14.7743 9.2136 14.9982 9.48975 14.9982H14.4865C14.7626 14.9982 14.9865 14.7743 14.9865 14.4982C14.9865 14.2221 14.7626 13.9982 14.4865 13.9982H9.48975Z"\n      />\n    </svg>\n  </template>\n  <template id="${Et.Plus}">\n    <svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n      <path\n          d="M7.75366 16.5C7.75366 17.1904 8.31331 17.75 9.00366 17.75C9.69402 17.75 10.2537 17.1904 10.2537 16.5V10.2861H16.5C17.1904 10.2861 17.75 9.72642 17.75 9.03606C17.75 8.34571 17.1904 7.78606 16.5 7.78606H10.2537V1.5C10.2537 0.809643 9.69402 0.25 9.00366 0.25C8.31331 0.25 7.75366 0.809644 7.75366 1.5V7.78606H1.5C0.809644 7.78606 0.25 8.34571 0.25 9.03606C0.25 9.72642 0.809644 10.2861 1.5 10.2861H7.75366V16.5Z"\n      />\n    </svg>\n  </template>\n  <template id="${Et.Spinner}">
1\n    <svg class="spin-500" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">\n      <path fill-rule="evenodd" clip-rule="evenodd"\n            d="M1.25049 10.0001C1.25049 5.16797 5.16766 1.25069 9.99979 1.25061C10.345 1.2506 10.6248 1.53042 10.6248 1.8756C10.6248 2.22078 10.345 2.5006 9.99981 2.50061C5.85803 2.50068 2.50049 5.85831 2.50049 10.0001C2.50049 14.1418 5.85811 17.4995 9.99993 17.4995C14.1418 17.4995 17.4994 14.1418 17.4994 10.0001C17.4994 8.00692 16.7227 6.19654 15.4542 4.85289C15.2172 4.60189 15.2286 4.20633 15.4796 3.96937C15.7306 3.73241 16.1261 3.74379 16.3631 3.99479C17.8419 5.5612 18.7494 7.67533 18.7494 10.0001C18.7494 14.8322 14.8321 18.7495 9.99993 18.7495C5.16775 18.7495 1.25049 14.8322 1.25049 10.0001Z"\n      />\n    </svg>\n  </template>\n  <template id="${Et.Puzzle}">\n    <svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">\n      <path fill-rule="evenodd" clip-rule="evenodd"\n            d="M5.36522 2.48835C5.12409 2.7724 5.03429 3.10232 5.03429 3.27273V4.50861C5.03429 4.78476 4.81043 5.00861 4.53429 5.00861H2V14H4.0343V13.2727C4.0343 12.8522 4.21698 12.2958 4.60288 11.8412C5.00497 11.3675 5.63191 11 6.49745 11C7.36086 11 7.99972 11.3654 8.41593 11.8319C8.81555 12.2798 9.02461 12.8381 9.02461 13.2727V14.0072L11.0125 14.0014V11.4936C11.0125 11.2175 11.2363 10.9936 11.5125 10.9936H12.7273C12.8923 10.9936 13.2215 10.9016 13.5081 10.6537C13.7758 10.4221 14 10.0599 14 9.50642C14 8.95199 13.7748 8.58042 13.5038 8.34043C13.2141 8.08395 12.8857 7.98937 12.7273 7.98937H11.5125C11.2363 7.98937 11.0125 7.76551 11.0125 7.48937V5.00861H8.52459C8.24845 5.00861 8.02459 4.78476 8.02459 4.50861V3.27273C8.02459 3.11648 7.92916 2.7884 7.66975 2.49765C7.42692 2.2255 7.0522 2 6.49743 2C5.94479 2 5.59016 2.22337 5.36522 2.48835ZM4.60286 1.84119C5.00495 1.36753 5.6319 1 6.49743 1C7.36085 1 7.9997 1.36541 8.41592 1.83189C8.81554 2.27978 9.0246 2.83807 9.0246 3.27273V4.00861H11.5125C11.7886 4.00861 12.0125 4.23247 12.0125 4.50861V6.98937H12.7273C13.1597 6.98937 13.7177 7.19422 14.1667 7.59172C14.6343 8.00572 15 8.64268 15 9.50642C15 10.3712 14.6333 11.0025 14.1624 11.41C13.7103 11.8011 13.1531 11.9936 12.7273 11.9936H12.0125V14.5C12.0125 14.7756 11.7895 14.9992 11.5139 15L8.52605 15.0086C8.3932 15.009 8.26565 14.9565 8.17157 14.8627C8.07749 14.7689 8.02461 14.6415 8.02461 14.5086V13.2727C8.02461 13.1165 7.92918 12.7884 7.66976 12.4977C7.42694 12.2255 7.05222 12 6.49745 12C5.9448 12 5.59017 12.2234 5.36523 12.4884C5.12411 12.7724 5.0343 13.1023 5.0343 13.2727V14.5C5.0343 14.7761 4.81044 15 4.5343 15H1.5C1.22386 15 1 14.7761 1 14.5V4.50861C1 4.23247 1.22386 4.00861 1.5 4.00861H4.03429V3.27273C4.03429 2.85223 4.21696 2.29579 4.60286 1.84119Z"/>\n    </svg>\n  </template>\n  <template id="${Et.PlusPuzzle}">\n    <svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">\n      <path d="M4.5 8.97021C4.22386 8.97021 4 9.19407 4 9.47021C4 9.74636 4.22386 9.97021 4.5 9.97021H6.01123V11.5C6.01123 11.7761 6.23509 12 6.51123 12C6.78737 12 7.01123 11.7761 7.01123 11.5V9.97021H8.5C8.77614 9.97021 9 9.74636 9 9.47021C9 9.19407 8.77614 8.97021 8.5 8.97021H7.01123V7.5C7.01123 7.22386 6.78737 7 6.51123 7C6.23509 7 6.01123 7.22386 6.01123 7.5V8.97021H4.5Z" />\n      <path fill-rule="evenodd" clip-rule="evenodd" d="M6.49743 1C5.6319 1 5.00495 1.36753 4.60286 1.84119C4.21696 2.29579 4.03429 2.85223 4.03429 3.27273V4.00861H1.5C1.22386 4.00861 1 4.23247 1 4.50861V10.9545C1 12.5357 1.67001 13.5722 2.53739 14.1967C3.37928 14.8028 4.37453 15 5.04545 15H11.5125C11.7886 15 12.0125 14.7761 12.0125 14.5V11.9936H12.7273C13.1531 11.9936 13.7103 11.8011 14.1624 11.41C14.6333 11.0025 15 10.3712 15 9.50642C15 8.64268 14.6343 8.00572 14.1667 7.59172C13.7177 7.19422 13.1597 6.98937 12.7273 6.98937H12.0125V4.50861C12.0125 4.23247 11.7886 4.00861 11.5125 4.00861H9.0246V3.27273C9.0246 2.83807 8.81554 2.27978 8.41592 1.83189C7.9997 1.36541 7.36085 1 6.49743 1ZM5.03429 3.27273C5.03429 3.10232 5.12409 2.7724 5.36522 2.48835C5.59016 2.22337 5.94479 2 6.49743 2C7.0522 2 7.42692 2.2255 7.66975 2.49765C7.92916 2.7884 8.02459 3.11648 8.02459 3.27273V4.50861C8.02459 4.78476 8.24845 5.00861 8.52459 5.00861H11.0125V7.48937C11.0125 7.76551 11.2363 7.98937 11.5125 7.98937H12.7273C12.8857 7.98937 13.2141 8.08395 13.5038 8.34043C13.7748 8.58042 14 8.95199 14 9.50642C14 10.0599 13.7758 
110.4221 13.5081 10.6537C13.2215 10.9016 12.8923 10.9936 12.7273 10.9936H11.5125C11.2363 10.9936 11.0125 11.2175 11.0125 11.4936V14H5.04545C4.53456 14 3.75708 13.8426 3.1217 13.3851C2.51181 12.946 2 12.2098 2 10.9545V5.00861H4.53429C4.81043 5.00861 5.03429 4.78476 5.03429 4.50861V3.27273Z" />\n    </svg>\n  </template>\n  <template id="${Et.CollapseScheme}">\n    <svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">\n      <path fill-rule="evenodd" clip-rule="evenodd"\n            d="M14.9952 2.54249V4.99715H15.0024V6.99547H14.0027V6.00319H2.00561L2.00561 6.99547H1.00586L1.00586 6.00319H1.00244V2.54249C1.00244 1.69346 1.62932 1.00439 2.40172 1.00439H13.596C14.3684 1.00439 14.9952 1.69346 14.9952 2.54249ZM13.9955 5.00403H2.00561V4.99715H2.0022V2.54249C2.0022 2.15367 2.26888 2.00356 2.40172 2.00356H13.596C13.7288 2.00356 13.9955 2.15366 13.9955 2.54249V5.00403Z"\n      />\n      <path\n          d="M1.00625 14.0052H3.00537L3.00498 15.0044H1.50732C1.37433 15.0044 1.24678 14.938 1.15273 14.8198C1.05869 14.7016 1.00586 14.5412 1.00586 14.3741L1.00625 14.0052Z"\n      />\n      <path\n          d="M13.0029 13.9964H15.0021L15.0024 14.3653C15.0024 14.5325 14.9496 14.6928 14.8556 14.811C14.7615 14.9292 14.634 14.9956 14.501 14.9956H13.0033L13.0029 13.9964Z"\n      />\n      <path d="M1.00586 11.0039L1.00586 13.0022H2.00561L2.00561 11.0039H1.00586Z"/>\n      <path d="M14.0027 13.0022V11.0039H15.0024V13.0022H14.0027Z"/>\n      <path d="M1.00586 7.99464L1.00586 9.99296H2.00561L2.00561 7.99464H1.00586Z"/>\n      <path d="M14.0027 7.99464V9.99296H15.0024V7.99464H14.0027Z"/>\n      <path d="M6.00464 14.0052H4.00513L4.00513 15.0044H6.00464V14.0052Z"/>\n      <path d="M7.00439 14.0052H9.00391V15.0044H7.00439V14.0052Z"/>\n      <path d="M12.0032 14.0052H10.0037V15.0044H12.0032V14.0052Z"/>\n    </svg>\n  </template>\n`;class Rt extends ht{static _icons=null;static get is(){return"ksl-icon"}static get icons(){if(!Rt._icons){const t=document.createElement("template");t.innerHTML=It,Rt._icons=t}return Rt._icons}static get observedAttributes(){return["icon-name"]}get iconName(){return this.getAttribute("icon-name")}set iconName(t){this.updateAttribute("icon-name",t)}iconRef;constructor(){super(),J(this.shadowRoot,'Shadow root must be always accessible in "open" mode.');const t=this.getAttribute("icon-name"),e=this.getTemplateByIconName(t);if(e){const t=e.content.cloneNode(!0);this.shadowRoot.appendChild(t),this.iconRef=this.shadowRoot.lastElementChild}else this.iconRef=null}static initializeTemplate(){return pt("\n  <style>\n    @-webkit-keyframes spin-500 {\n      0% {\n        -webkit-transform: rotate(0deg);\n      }\n  \n      100% {\n        -webkit-transform: rotate(359deg);\n      }\n    }\n  \n    @keyframes spin-500 {\n      0% {\n        transform: rotate(0deg);\n      }\n  \n      100% {\n        transform: rotate(359deg);\n      }\n    }\n  \n  \n    :host {\n      display: flex;\n      flex-direction: column;\n      align-items: center;\n      justify-content: center;\n      width: var(--ksl-icon-width, 0px);\n      height: var(--ksl-icon-height, 0px);\n    }\n  \n    .spin-500 {\n      animation-direction: normal;\n      animation-delay: 0s;\n      animation-duration: 1s;\n      animation-iteration-count: infinite;\n      animation-name: spin-500;\n      animation-timing-function: linear;\n      transform-origin: center;\n    }\n  </style>\n")}attributeChangedCallback(t,e,n){"icon-name"===t&&this.updateIcon(n)}getTemplateByIconName=t=>{if(!t)return null;const e=Rt.icons.content.querySelector(`template#${t}`);return e instanceof HTMLTemplateElement?e:null};updateIcon=t=>{if(!this.shadowRoot)return;const e=this.getTemplateByIconName(t);if(e){const t=e.content.cloneNode(!0);this.iconRef?this.shadowRoot.replaceChild(t,this.iconRef):this.shadowRoot.appendChild(t),this.iconRef=this.shadowRoot.lastElementChild}else this.iconRef&&(this.iconRef.remove(),this.iconRef=null)}}var Lt;!function(t){t.Primary="primary",t.Quinary="quinary"}(Lt||(Lt={}));const xt=`\n  <style>\n    :host,\n    :host * {\n      box-sizing: border-box;\n    }\n    \n    :host {\n      display: block;\n    }\n    \n    :host([hidden]) {\n      display: none;\n    }\n    \n    :host(:focus) {\n      outline: none;\n    }\n\n    .ksl-button {\n      display: flex;\n      flex-direction: column;\n      justify-content: center;\n      align-items: center;\n      border: none;\n      cursor: pointer;\n    }\n    \n    .ksl-button:focus {\n      outline: none;\n    }
1\n    \n    :host([disabled]) .ksl-button {\n      cursor: not-allowed;\n    }\n    \n    .ksl-button__content,\n    :host([loading]) .ksl-button__loader {\n      display: flex;\n      flex-direction: column;\n      align-items: center;\n      justify-content: center;\n    }\n    \n    .ksl-button__loader,\n    :host([loading]) .ksl-button__content {\n      display: none;\n    }\n    \n    :host([type=${Lt.Primary}]) .ksl-button {\n      --ksl-icon-width: 18px;\n      --ksl-icon-height: 18px;\n      min-width: 40px;\n      max-width: 40px;\n      min-height: 40px;\n      max-height: 40px;\n      border-radius: 5000px;\n      box-shadow: var(--ksl-shadow-primary, ${ft.Primary});\n      background-color: var(--ksl-color-primary, ${gt.Primary});\n      color: var(--ksl-color-text-secondary, ${gt.TextSecondary});\n      fill: var(--ksl-color-text-secondary, ${gt.TextSecondary});\n    }\n    \n    :host([type=${Lt.Primary}]:not([disabled])) .ksl-button:hover,\n    :host([type=${Lt.Primary}]:not([disabled])) .ksl-button:active {\n      background-color: var(--ksl-color-primary-hover, ${gt.PrimaryHover});\n    }\n    \n    :host([type=${Lt.Primary}][disabled]) .ksl-button {\n      background-color: var(--ksl-color-background-default-disabled, ${gt.BackgroundDefaultDisabled});\n      color: var(--ksl-color-text-default-disabled, ${gt.TextDefaultDisabled});\n      fill: var(--ksl-color-text-default-disabled, ${gt.TextDefaultDisabled});\n      box-shadow: none;\n    }\n    \n    :host([type=${Lt.Primary}][loading]) .ksl-button {\n      color: var(--ksl-color-primary, ${gt.Primary});\n      fill: var(--ksl-color-primary, ${gt.Primary});\n      box-shadow: none;\n    }\n    \n    :host([type=${Lt.Quinary}]) .ksl-button {\n      --ksl-icon-width: 16px;\n      --ksl-icon-height: 16px;\n      border-radius: 5px;\n      padding: 0;\n      min-height: 24px;\n      min-width: 24px;\n      max-height: 24px;\n      max-width: 24px;\n      color: var(--ksl-color-text-default, ${gt.TextDefault});\n      fill: var(--ksl-color-text-default, ${gt.TextDefault});\n      background-color: var(--ksl-color-background-default, ${gt.BackgroundDefault});\n    }\n    \n    :host([type=${Lt.Quinary}][disabled]) .ksl-button {\n      color: var(--ksl-color-text-default-disabled, ${gt.TextDefaultDisabled});\n      fill: var(--ksl-color-text-default-disabled, ${gt.TextDefaultDisabled});\n    }\n    \n    :host([type=${Lt.Quinary}]:not([disabled])) .ksl-button:hover {\n      background-color: var(--ksl-color-background-default-hover, ${gt.BackgroundDefaultHover});\n    }\n    \n    :host([type=${Lt.Quinary}]:not([disabled])) .ksl-button:active {\n      background-color: var(--ksl-color-background-default-selected, ${gt.BackgroundDefaultSelected});\n    }\n  </style>\n  <button class="ksl-button">\n    <div class="ksl-button__content">\n      <slot></slot>\n    </div>\n    <ksl-icon icon-name="${Et.Spinner}" class="ksl-button__loader" />\n  </button>\n`;class $t extends yt{static get is(){return"ksl-button"}static get observedAttributes(){return[...yt.observedAttributes,"loading"]}get loading(){return this.hasAttribute("loading")}set loading(t){this.updateAttribute("loading",t)}get disabled(){return this.hasAttribute("disabled")}set disabled(t){this.updateAttribute("disabled",t)}constructor(){super(),J(this.shadowRoot,'Shadow root must be always accessible in "open" mode.')}static initializeTemplate(){return pt(xt)}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.handleClick,{capture:!0})}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",this.handleClick,{capture:!0})}attributeChangedCallback(t,e,n){if(super.attributeChangedCallback(t,e,n),"loading"===t){const t=Boolean(n);this.disabled=t,this.tooltipDisabled=t}}handleClick=t=>{this.disabled&&(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation())}}const Tt=`\n  <style>\n    :host,\n    :host * {\n      box-sizing: border-box;\n    }\n    \n    :host {\n      display: block;\n      position: absolute;\n      pointer-events: none;\n      touch-action: none;\n      min-height: 40px;\n      min-width: 40px;\n      width: 100%;\n      height: 100%;\n      border: 2px dashed;\n      border-color: var(--ksl-color-primary-transparent, ${gt.PrimaryTransparent});\n      border-radius: 5px;\n    }\n    \n    :host([hidden]) {\n      display: none;\n    }\n    \n    :host(:hover),\n    :host([selected]) {\n      border-color: var(--ksl-color-primary, ${gt.Primary});\n      z-index: calc(var(--ksl-z-index, 9000) + 10);\n    }\n    \n    :host(:focus) {\n      outline: none;\n    }\n    \n    .ksl-highlight__toolbar {\n      position: absolute;\n      top: 0;\n      right: 0;\n      display: flex;\n      flex-direction: row;\n      justify-content: center;\n      align-items: center;\n      pointer-events: all;\n      touch-action: auto;\n      min-height: 40px;\n      max-height: 40px;\n      border-radius: 8px;\n      background-color: var(--ksl-color-background-default, ${gt.Backgroun
1dDefault});\n      z-index: var(--ksl-z-index, 9000);\n      padding: 8px;\n      box-shadow: var(--ksl-shadow-default, ${ft.Default});\n    }\n    \n    .ksl-highlight__toolbar:hover {\n      z-index: calc(var(--ksl-z-index, 9000) + 10);\n    }\n    \n    .ksl-highlight__toolbar-button + .ksl-highlight__toolbar-button {\n      margin-left: 4px;\n    }\n  </style>\n  <div id="ksl-toolbar" class="ksl-highlight__toolbar">\n    <ksl-button \n      id="ksl-edit" \n      class="ksl-highlight__toolbar-button"\n      type="${Lt.Quinary}"\n      tooltip-position="${mt.BottomEnd}"\n    >\n      <ksl-icon icon-name="${Et.Edit}" />\n    </ksl-button>\n  </div>\n`;class At extends bt{static get is(){return"ksl-highlight"}get type(){return u(this.targetRef)}get selected(){return this.hasAttribute("selected")}set selected(t){this.updateAttribute("selected",t)}editButtonRef;constructor(){super(),J(this.shadowRoot,'Shadow root must be always accessible in "open" mode.'),this.editButtonRef=this.shadowRoot.querySelector("#ksl-edit")}static initializeTemplate(){return pt(Tt)}static getEditButtonTooltip(t){switch(t){case c.Element:return"Edit element";case c.ContentComponent:return"Edit component";case c.ContentItem:return"Edit item";case c.None:return"Edit"}}connectedCallback(){super.connectedCallback(),this.editButtonRef.addEventListener("click",this.handleEditButtonClick)}disconnectedCallback(){super.connectedCallback(),this.editButtonRef.removeEventListener("click",this.handleEditButtonClick),this.unregisterTargetNodeListeners()}attachTo=t=>{this.unregisterTargetNodeListeners(),super.attachTo(t);const e=this.type;this.hidden=e===c.None,this.editButtonRef.tooltipMessage=At.getEditButtonTooltip(e),this.targetRef&&(this.targetRef.addEventListener("mousemove",this.handleTargetNodeMouseEnter),this.targetRef.addEventListener("mouseleave",this.handleTargetNodeMouseLeave),this.targetRef.addEventListener("click",this.handleEditButtonClick))};adjustPosition=()=>{if(!this.targetRef||!this.offsetParent)return;this.offsetParent instanceof Pt||N("KSLHighlightElement: should be located inside KSLContainerElement to be positioned properly.");const t=this.offsetParent.getBoundingClientRect(),e=this.targetRef.getBoundingClientRect();this.style.top=e.top-t.top+"px",this.style.left=e.left-t.left+"px",this.style.width=`${e.width}px`,this.style.height=`${e.height}px`};unregisterTargetNodeListeners=()=>{this.targetRef&&(this.targetRef.removeEventListener("mousemove",this.handleTargetNodeMouseEnter),this.targetRef.removeEventListener("mouseleave",this.handleTargetNodeMouseLeave),this.targetRef.removeEventListener("click",this.handleEditButtonClick))};handleTargetNodeMouseEnter=()=>{this.selected=!0};handleTargetNodeMouseLeave=()=>{this.selected=!1};handleEditButtonClick=t=>{J(this.targetRef,"Target node is not set for this highlight."),t.preventDefault(),t.stopPropagation();const e=X(this.targetRef);this.dispatchEditEvent(e)};dispatchEditEvent=t=>{J(this.targetRef,"Target node is not set for this highlight element.");const e=new CustomEvent("ksl:highlight:edit",{detail:{data:t,targetNode:this.targetRef}});this.dispatchEvent(e)}}class Pt extends ht{static get is(){return"ksl-container"}_boundingClientRect=null;static initializeTemplate(){return pt("\n  <style>\n    :host {\n      display: block;\n      position: absolute;\n      box-sizing: border-box;\n      top: 0;\n      right: 0;\n      left: 0;\n      bottom: 0;\n      pointer-events: none;\n      touch-action: none;\n      z-index: var(--ksl-z-index, 9000);\n    }\n    \n    :host([clipped]) {\n      overflow: hidden;\n    }\n  </style>\n  <slot></slot>\n")}getBoundingClientRect(t=!1){return this._boundingClientRect&&!t||(this._boundingClientRect=super.getBoundingClientRect()),this._boundingClientRect}createHighlightForElement=t=>{const e=document.createElement(At.is);return e.attachTo(t),this.appendChild(e),e};createAddButtonForElement=t=>{const e=document.createElement(Dt.is);return e.attachTo(t),this.appendChild(e),e};adjustPosition=()=>{const t=this.parentElement;if(!t)return;const e=ct(t);if(!e.isPositioned){const[n,o]=ut(t);this.style.height=`${t.clientHeight}px`,this.style.width=`${t.clientWidth}px`,this.style.top=t.offsetTop-n+"px",this.style.left=t.offsetLeft-o+"px",this.updateAttribute("clipped",Boolean(e.isContentClipped))}this.getBoundingClientRect(!0)}}const St=`\n  <style>\n    :host {\n      --ksl-pop-up-arrow-size: 12px;\n      --ksl-pop-up-background-color: var(--ksl-color-background-default, ${gt.Backgroun
1dDefault});\n      --ksl-pop-up-border-radius: 4px;\n      --ksl-pop-up-box-shadow: var(--ksl-shadow-default, ${ft.Default});;\n      --ksl-pop-up-color: var(--ksl-color-text-default, ${gt.TextDefault});\n      --ksl-pop-up-padding: 8px;\n    }\n  </style>\n`;class Bt extends kt{static get is(){return"ksl-popover"}static initializeTemplate(){const t=kt.initializeTemplate(),e=pt(St);return t.content.appendChild(e.content.cloneNode(!0)),t}}const _t="Content is published",Mt="Insert...";var Ht;!function(t){t.CreateComponent="create-component",t.CreateLinkedItem="create-linked-item",t.InsertLinkedItem="insert-linked-item"}(Ht||(Ht={}));const zt=`\n  <style>\n    :host {\n      display: inline-block;\n      position: absolute;\n      z-index: calc(var(--ksl-z-index, 9000) + 20);\n      pointer-events: all;\n      touch-action: initial;\n    }\n    \n    :host(:focus) {\n      outline: none;\n    }\n  </style>\n  <ksl-button\n      type="${Lt.Primary}"\n      tooltip-position="${mt.Top}"\n  >\n    <ksl-icon icon-name="${Et.Plus}"/>\n  </ksl-button>\n`;class Dt extends bt{static get is(){return"ksl-add-button"}get position(){return this.targetRef?.getAttribute(l.AddButtonRenderPosition)??mt.Bottom}buttonRef;popoverRef=null;constructor(){super(),J(this.shadowRoot,'Shadow root must be available in "open" mode.'),this.buttonRef=this.shadowRoot.querySelector($t.is)}static initializeTemplate(){return pt(zt)}connectedCallback(){super.connectedCallback(),window.addEventListener("click",this.handleClickOutside,{capture:!0}),this.buttonRef.addEventListener("click",t=>{this.handleClick(t)}),this.buttonRef.tooltipMessage=Mt}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("click",this.handleClickOutside,{capture:!0}),this.buttonRef.removeEventListener("click",t=>{this.handleClick(t)}),this.dismissPopover()}adjustPosition=()=>{if(!this.targetRef||!this.offsetParent)return;this.offsetParent instanceof Pt||console.warn("KSLAddButtonElement: should be located inside KSLContainerElement to be positioned properly.");const t=this.offsetParent.getBoundingClientRect(),e=this.targetRef.getBoundingClientRect(),n=this.getBoundingClientRect(),o=this.calculateTopOffset(n,e),i=this.calculateLeftOffset(n,e);this.style.top=`${e.top-t.top+o}px`,this.style.left=`${e.left-t.left+i}px`};calculateTopOffset(t,e){const n=super.calculateTopOffset(t,e);switch(this.position){case mt.TopStart:case mt.Top:case mt.TopEnd:return n/2;case mt.BottomStart:case mt.Bottom:case mt.BottomEnd:return n-t.height/2;case mt.Left:case mt.LeftEnd:case mt.LeftStart:case mt.None:case mt.Right:case mt.RightEnd:case mt.RightStart:return n}}calculateLeftOffset(t,e){const n=super.calculateLeftOffset(t,e);switch(this.position){case mt.LeftStart:case mt.Left:case mt.LeftEnd:return n/2;case mt.RightStart:case mt.Right:case mt.RightEnd:return e.width-t.width/2;case mt.Bottom:case mt.BottomEnd:case mt.BottomStart:case mt.None:case mt.Top:case mt.TopEnd:case mt.TopStart:return n}}handleClick=async t=>{if(this.popoverRef)return;J(this.targetRef,"Target node is not set for this add button."),t.preventDefault(),t.stopPropagation(),this.buttonRef.loading=!0;const e=tt(this.targetRef);try{const t={data:e,targetNode:this.targetRef},n=await this.dispatchAsyncEvent("ksl:add-button:initial",t),{permissions:o}=n,i=o.get(S.ViewParent)!==B.Ok||o.get(S.Edit)!==B.Ok,s=o.get(S.CreateNew)===B.RteWithForbiddenComponents;i||s?(this.buttonRef.loading=!1,this.buttonRef.disabled=!0,this.buttonRef.tooltipMessage=i?"You are not allowed to add content here":"Components and items can't be added here"):(this.buttonRef.loading=!1,this.buttonRef.disabled=!1,this.buttonRef.tooltipMessage=Mt,this.displayPopover(n))}catch(n){V(n),this.buttonRef.loading=!1,this.buttonRef.disabled=!0,"object"==typeof n&&null!==n&&"message"in n&&"string"==typeof n.message?this.buttonRef.tooltipMessage=n.message:this.buttonRef.tooltipMessage="Something went wrong"}};handleClickOutside=t=>{if(!(this.popoverRef&&t.target instanceof Element))return;this.isSameNode(t.target)||this.contains(t.target)||this.dismissPopover()};displayPopover=t=>{J(this.shadowRoot,'Shadow root must be available in "open" mode.'),this.popoverRef&&this.dismissPopover(),this.buttonRef.tooltipPosition=mt.Bottom;const e=document.createElement(Bt.is);e.innerHTML=(({elementType:t,isParentPublished:e,permissions:n})=>{const o=n.get(S.CreateNew)===B.Ok;return`\n    <style>\n    .ksl-add-button__popover-button + .ksl-add-button__popover-button {\n      margin-left: 4px;\n    }\n  </style>\n  <ksl-button\n    id="${Ht.InsertLinkedItem}"\n    class="ksl-add-button__popover-button"\n    type="${Lt.Quinary}"\n    tooltip-position="${mt.Top}"\n    tooltip-message="${e?_t:"Insert existing item"}"\n    ${e&&"disabled"}\n  >\n    <ksl-icon icon-name="${Et.Puzzle}"/>\n  </ksl-button>\n  <ksl-button\n    id="${Ht.CreateLinkedItem}"\n    class="ksl-add-button__popover-button"\n    type="${Lt.Quinary}"\n    tooltip-position="${mt.Top}"\n    tooltip-message="${e?_t:(t=>t?"Create new item":"Your role cannot create items from the allowed types")(o)}"\n    ${(e||!o)&&"disabled"}\n    ${t!==P.LinkedItems&&"hidden"}\n  >\n    <ksl-icon icon-name="${Et.PlusPuzzle}"/>\n  </ksl-button>\n  <ksl-button\n    id="${Ht.CreateComponent}"\n    class="ksl-add-button__popover-button"\n    type="${Lt.Quinary}"\n    tooltip-position="${mt.Top}"\n    tooltip-message="${e?_t:"Insert new component"}"\n    ${e&&"disabled"}\n    ${t!==P.RichText&&"hidden"}\n  >
1\n    <ksl-icon icon-name="${Et.CollapseScheme}"/>\n  </ksl-button>\n`})(t);const n=this.shadowRoot;this.popoverRef=n.appendChild(e),this.popoverRef.position=mt.Top,this.popoverRef.attachTo(this),this.addPopoverEventListeners(t.elementType),this.popoverRef.visible=!0,this.popoverRef.adjustPosition()};dismissPopover=()=>{this.buttonRef.tooltipPosition=mt.Top,this.popoverRef&&(this.removePopoverEventListeners(),this.popoverRef.visible=!1,this.popoverRef.remove(),this.popoverRef=null)};addPopoverEventListeners=t=>{if(!this.popoverRef)return;const e=this.popoverRef.querySelector(`#${Ht.CreateComponent}`),n=this.popoverRef.querySelector(`#${Ht.CreateLinkedItem}`),o=this.popoverRef.querySelector(`#${Ht.InsertLinkedItem}`);e&&t===P.RichText&&e.addEventListener("click",t=>{this.handleCreateComponentClick(t)}),n&&t===P.LinkedItems&&n.addEventListener("click",t=>{this.handleCreateLinkedItemClick(t)}),o&&o.addEventListener("click",t=>{this.handleInsertLinkedItemClick(t)})};removePopoverEventListeners=()=>{if(!this.popoverRef)return;const t=this.popoverRef.querySelector(`#${Ht.CreateComponent}`),e=this.popoverRef.querySelector(`#${Ht.CreateLinkedItem}`),n=this.popoverRef.querySelector(`#${Ht.InsertLinkedItem}`);t&&t.removeEventListener("click",this.handleCreateComponentClick),e&&e.removeEventListener("click",this.handleCreateLinkedItemClick),n&&n.removeEventListener("click",this.handleInsertLinkedItemClick)};handleCreateComponentClick=t=>{this.handleAddActionClick(t,A.CreateComponent)};handleCreateLinkedItemClick=t=>{this.handleAddActionClick(t,A.CreateLinkedItem)};handleInsertLinkedItemClick=t=>{this.handleAddActionClick(t,A.InsertLinkedItem)};handleAddActionClick=(t,e)=>{J(this.targetRef,"Target node is not set for this add button."),t.preventDefault(),t.stopPropagation();const n=tt(this.targetRef),o=new CustomEvent("ksl:add-button:action",{detail:{data:{...n,action:e},targetNode:this.targetRef}});this.dismissPopover(),this.dispatchEvent(o)}}const Vt=[Rt,$t,Dt,At,Pt,wt,Bt],Nt=Vt.map(t=>t.is);function Ot(t){return Nt.includes(t.tagName.toLowerCase())}class jt{configuration;defaultContainer;containerByRenderingRoot;highlightByElement;addButtonByElement;constructor(t){this.configuration=t,this.containerByRenderingRoot=new Map,this.highlightByElement=new Map,this.addButtonByElement=new Map,this.defaultContainer=qt()}render=(t,e)=>{if(0===e.size)return void this.clear();const{newAddButtonByElement:n,newHighlightByElement:o}=this.processVisibleElements(t,this.addButtonByElement,this.highlightByElement);for(const[i,s]of o)e.has(i)||(s.remove(),o.delete(i));for(const[i,s]of n)e.has(i)||(s.remove(),n.delete(i));for(const[i,s]of this.containerByRenderingRoot.entries())0===s.children.length&&(s.remove(),this.containerByRenderingRoot.delete(i));this.highlightByElement=o,this.addButtonByElement=n};destroy=()=>{this.clear(),this.defaultContainer.remove()};clear=()=>{for(const[,t]of this.addButtonByElement.entries())t.remove();for(const[,t]of this.highlightByElement.entries())t.remove();for(const[,t]of this.containerByRenderingRoot.entries())t.remove();this.highlightByElement=new Map,this.containerByRenderingRoot=new Map,this.addButtonByElement=new Map,this.defaultContainer.innerHTML=""};processVisibleElements=(t,e,n)=>{const o=function(t){const e=new Map;for(const n of t){const t=dt(n),o=e.get(t)??new Set;e.set(t,o.add(n))}return e}(t);return Array.from(o.entries()).reduce((t,[e,n])=>{const o=this.createContainerIfNotExist(e);o.adjustPosition();for(const i of n){if(!(0===i.offsetHeight||0===i.offsetWidth)&&C(i,this.configuration)){const e=t.newHighlightByElement.get(i)??o.createHighlightForElement(i);e.adjustPosition(),t.newHighlightByElement.set(i,e)}if(w(i,this.configuration)){const e=t.newAddButtonByElement.get(i)??o.createAddButtonForElement(i);e.adjustPosition(),t.newAddButtonByElement.set(i,e)}}return t},{newAddButtonByElement:new Map(e),newHighlightByElement:new Map(n)})};createContainerIfNotExist=t=>{if(!t||t===document.body)return this.defaultContainer;const e=this.containerByRenderingRoot.get(t);if(e)return e;const n=document.createElement(Pt.is);return t.appendChild(n),this.containerByRenderingRoot.set(t,n),n}}const qt=()=>{const t=document.createElement(Pt.is);return window.document.body.appendChild(t),t};
1class Ut{iframeCommunicator;configuration;mutationObserver;intersectionObserver;renderer;enabled=!1;renderingTimeoutId=0;observedElements=new Set;visibleElements=new Set;constructor(t,e){if(this.iframeCommunicator=t,this.configuration=e,"undefined"==typeof window||"undefined"==typeof MutationObserver||"undefined"==typeof IntersectionObserver)throw new I("NodeSmartLinkProvider can only be initialized in a browser environment.");this.mutationObserver=new MutationObserver(this.onDomMutation),this.intersectionObserver=new IntersectionObserver(this.onElementVisibilityChange),this.renderer=new jt(this.configuration)}toggle=t=>{t??!this.enabled?this.enable():this.disable()};enable=()=>{this.enabled||(this.startRenderingInterval(),this.listenToGlobalEvents(),this.observeDomMutations(),this.enabled=!0)};disable=()=>{this.enabled&&(this.stopRenderingInterval(),this.unlistenToGlobalEvents(),this.disconnectObservers(),this.renderer.clear(),this.enabled=!1)};destroy=()=>{this.disable(),this.renderer.destroy()};augmentVisibleElements=()=>{requestAnimationFrame(()=>{this.renderer.render(this.visibleElements,this.observedElements)})};startRenderingInterval=()=>{this.renderingTimeoutId=window.setInterval(this.augmentVisibleElements,1e3)};stopRenderingInterval=()=>{this.renderingTimeoutId&&(clearInterval(this.renderingTimeoutId),this.renderingTimeoutId=0)};listenToGlobalEvents=()=>{window.addEventListener("ksl:add-button:initial",this.onAddInitialClick,{capture:!0}),window.addEventListener("ksl:add-button:action",this.onAddActionClick,{capture:!0}),window.addEventListener("ksl:highlight:edit",this.onEditElement,{capture:!0})};unlistenToGlobalEvents=()=>{window.removeEventListener("ksl:add-button:initial",this.onAddInitialClick,{capture:!0}),window.removeEventListener("ksl:add-button:action",this.onAddActionClick,{capture:!0}),window.removeEventListener("ksl:highlight:edit",this.onEditElement,{capture:!0})};observeDomMutations=()=>{this.enabled||(this.mutationObserver.observe(window.document.body,{childList:!0,subtree:!0}),v(document,this.configuration).forEach(t=>{t instanceof HTMLElement&&this.observeElementVisibility(t)}))};disconnectObservers=()=>{this.mutationObserver.disconnect(),this.intersectionObserver.disconnect(),this.observedElements.forEach(t=>{this.unobserveElementVisibility(t)}),this.observedElements=new Set,this.visibleElements=new Set};observeElementVisibility=t=>{this.observedElements.has(t)||(this.intersectionObserver.observe(t),this.observedElements.add(t))};unobserveElementVisibility=t=>{this.observedElements.has(t)&&(this.intersectionObserver.unobserve(t),this.observedElements.delete(t),this.visibleElements.delete(t))};onDomMutation=t=>{const e=t.filter(Ft);for(const n of e){for(const t of n.addedNodes)if(t instanceof HTMLElement){k(t,this.configuration)&&this.observeElementVisibility(t);for(const e of v(t,this.configuration))e instanceof HTMLElement&&this.observeElementVisibility(e)}for(const t of n.removedNodes)if(t instanceof HTMLElement){k(t,this.configuration)&&this.unobserveElementVisibility(t);for(const e of v(t,this.configuration))e instanceof HTMLElement&&this.unobserveElementVisibility(e)}}e.length>0&&this.augmentVisibleElements()};onElementVisibilityChange=t=>{const e=t.filter(t=>t.target instanceof HTMLElement);for(const n of e){const t=n.target;n.isIntersecting?this.visibleElements.add(t):this.visibleElements.delete(t)}e.length>0&&this.augmentVisibleElements()};onEditElement=t=>{const e=a(this.configuration),{data:n,targetNode:o}=t.detail,i={elementRect:o.getBoundingClientRect()},s=((t,e)=>{const{type:n,validationResult:o}="elementCodename"in t.parsed?{type:"element",validationResult:W(t,e.defaultDataAttributes)}:"contentComponentId"in t.parsed?{type:"contentComponent",validationResult:Z(t,e.defaultDataAttributes)}:{type:"contentItem",validationResult:K(t,e.defaultDataAttributes)};return o.success?(e.debug&&Y(t.debugData,"[KSL]: Parsed edit button data attributes"),"element"===n?{type:"element",data:o.data}:"contentComponent"===n?{type:"contentComponent",data:o.data}:{type:"contentItem",data:o.data}):(Y(t.debugData,"[KSL]: Parsing edit button data attributes failed"),{type:"error",missing:o.missing})})(n,this.configuration);if("error"===s.type)return V(`Required attribute was not found: ${s.missing[0]}. Skipped parsing these attributes: ${s.missing.slice(1).join(", ")}`),V("Debug info: ",s.debug),void V("Skipping edit button click");
1if("element"===s.type)if(e)this.iframeCommunicator.sendMessage(_.ElementClicked,s.data,i);else{const t=$({environmentId:s.data.projectId,languageCodename:s.data.languageCodename,itemId:s.data.itemId,elementCodename:s.data.elementCodename,baseUrl:this.configuration.baseUrl});window.open(t,"_blank")}else if("contentComponent"===s.type)e?this.iframeCommunicator.sendMessage(_.ContentComponentClicked,s.data,i):N("Edit buttons for content components are only functional inside Web Spotlight.");else if(e)this.iframeCommunicator.sendMessage(_.ContentItemClicked,s.data,i);else{const t=x({environmentId:s.data.projectId,languageCodename:s.data.languageCodename,itemId:s.data.itemId,baseUrl:this.configuration.baseUrl});window.open(t,"_blank")}};onAddInitialClick=t=>{const e=a(this.configuration),{eventData:n,onResolve:o,onReject:i}=t.detail,{data:s,targetNode:r}=n,l={elementRect:r.getBoundingClientRect()};console.log("data",s);const d=G(s,this.configuration);if(!d.success){const[t,...e]=d.missing;return void i({message:`Could not find required data attribute: '${t}'.${e.length>0?` All attributes higher in hierarchy were never searched for: [${e.join(", ")}]`:""}`})}
1e?this.iframeCommunicator.sendMessageWithResponse(_.AddInitial,d.data,t=>t&&t.elementType!==P.Unknown?o(t):(console.log("response",JSON.stringify(t)),i({message:"Something went wrong"})),l):i({message:"Add buttons are only functional inside Web Spotlight"})};onAddActionClick=t=>{const e=a(this.configuration),{data:n,targetNode:o}=t.detail,i={elementRect:o.getBoundingClientRect()},s=G(n,this.configuration);s.success&&(e?this.iframeCommunicator.sendMessage(_.AddAction,{...s.data,action:n.action},i):N("Add buttons are only functional inside Web Spotlight."))}}const Ft=t=>{const e="childList"===t.type,n=t.target instanceof HTMLElement&&!Ot(t.target);if(!e||!n)return!1;const o=Array.from(t.addedNodes).some(t=>t instanceof HTMLElement&&!Ot(t)),i=Array.from(t.removedNodes).some(t=>t instanceof HTMLElement&&!Ot(t));return o||i},Kt=(t,e,n)=>{const o=t.get(e)?.add(n)??new Set([n]);t.set(e,o)},Wt=(t,e,n)=>{t.get(e)?.delete(n)},Zt=(t,e,...n)=>{const o=t.get(e);o&&o.size>0&&o.forEach(t=>{t(...n)})};class Qt{events=new Map;callbacks=new Map;initialize(){if("undefined"==typeof window)throw new I("IFrameCommunicator can only be initialized in a browser environment.");window.addEventListener("message",this.onMessage,!0)}destroy(){this.events=new Map,window.removeEventListener("message",this.onMessage,!0)}sendMessageWithResponse=(t,e,n,o)=>{const i=window.crypto.getRandomValues(new Uint32Array(1))[0].toString(16);n&&this.callbacks.set(i,n),this.sendMessage(t,e,o,i)};sendMessage=(t,e,n,o)=>{if(!i())throw new I("IFrameCommunicator: iframe message can only be send while inside iframe.");const s={type:t,data:e,metadata:n,requestId:o};window.parent.postMessage(s,"*")};addMessageListener=(t,e)=>{Kt(this.events,t,e)};removeMessageListener=(t,e)=>{Wt(this.events,t,e)};onMessage=t=>{if(void 0===t.data)return;const e=t.data;Zt(this.events,e.type,e.data,e.metadata),void 0!==e.requestId&&this.executeCallback(e.requestId,e.data)};executeCallback=(t,e)=>{const n=this.callbacks.get(t);n&&(n(e),this.callbacks.delete(t))}}const Gt=(t,e)=>{let n=!1;const o=()=>{const o=function(t){return new RegExp(`[?&]${t}([=&]|$)`,"i").test(window.location.search)}(t);n!==o&&(e(o),n=o)};o();const i=window.setInterval(o,1e3);return()=>{clearInterval(i)}};function Yt(){try{window.location.reload()}catch(t){V(t)}}const Jt="Local storage is not available or access to local storage is denied for the current document. It may affect the proper work of the SDK.";var Xt;!function(t){t.Refresh="refresh",t.Update="update"}(Xt||(Xt={}));class te{configuration=s;iframeCommunicator;domSmartLinkManager;events;queryPresenceIntervalCleanup=null;constructor(t){this.configuration={...this.configuration,...t}
1,this.events=new Map,this.iframeCommunicator=new Qt,this.domSmartLinkManager=new Ut(this.iframeCommunicator,this.configuration),this.initialize()}static getSettingsStorage(){return t="kontent-smart-link:iframe-settings",{get(){try{const e=window.localStorage.getItem(t);return null!==e?JSON.parse(e):null}catch{return N(Jt),null}},set(e){try{const n=JSON.stringify(e);window.localStorage.setItem(t,n)}catch{N(Jt)}},remove(){try{window.localStorage.removeItem(t)}catch{N(Jt)}}};var t}initialize=async()=>{await function(){const t=Vt.map(async t=>await t.define());return Promise.all(t)}();D(this.configuration.debug?H.Debug:H.Info),this.configuration.queryParam?this.queryPresenceIntervalCleanup=Gt(this.configuration.queryParam,this.domSmartLinkManager.toggle):this.domSmartLinkManager.enable(),i()&&this.initializeIFrameCommunication()};destroy=()=>{this.events=new Map,this.queryPresenceIntervalCleanup?.(),this.iframeCommunicator.destroy(),this.domSmartLinkManager.destroy()};updateConfiguration=t=>{void 0!==t.queryParam&&(""===t.queryParam?this.domSmartLinkManager.enable():t.queryParam!==this.configuration.queryParam&&(this.queryPresenceIntervalCleanup?.(),this.queryPresenceIntervalCleanup=Gt(t.queryParam,this.domSmartLinkManager.toggle))),!0===t.debug&&D(H.Debug),Object.assign(this.configuration,t)};on=(t,e)=>{Kt(this.events,t,e)};off=(t,e)=>{Wt(this.events,t,e)};initializeIFrameCommunication=()=>
1{this.iframeCommunicator.initialize();const t=te.getSettingsStorage().get(),e=null===t||t.enabled,n={enabled:e,languageCodename:this.configuration.defaultDataAttributes.languageCodename??null,projectId:this.configuration.defaultDataAttributes.environmentId??null,supportedFeatures:{previewIFrameCurrentUrlHandler:!0,refreshHandler:!0,updateHandler:!0}};this.iframeCommunicator.sendMessageWithResponse(_.Initialized,n,()=>{Object.assign(this.configuration,{isInsideWebSpotlight:!0}),this.queryPresenceIntervalCleanup?.(),this.domSmartLinkManager.disable(),e&&this.domSmartLinkManager.enable(),this.iframeCommunicator.addMessageListener(_.Status,this.handleStatusMessage),this.iframeCommunicator.addMessageListener(_.RefreshPreview,this.handleRefreshMessage),this.iframeCommunicator.addMessageListener(_.UpdatePreview,this.handleUpdateMessage),this.iframeCommunicator.addMessageListener(_.PreviewIFrameCurrentUrl,this.handlePreviewIFrameCurrentUrlRequestMessage)})};handleStatusMessage=t=>{this.domSmartLinkManager.toggle(t.enabled),te.getSettingsStorage().set({enabled:t.enabled})};handleRefreshMessage=(t,e)=>{this.events.has(Xt.Refresh)?Zt(this.events,Xt.Refresh,t,e,Yt):Yt()};handleUpdateMessage=t=>{Zt(this.events,Xt.Update,t,void 0,void 0)};handlePreviewIFrameCurrentUrlRequestMessage=()=>{const t={previewUrl:window.location.href};
1this.iframeCommunicator.sendMessage(_.PreviewIFrameCurrentUrlResponse,t)}}var ee=te;class ne{static instance=null;sdk=null;static initializeOnLoad(t){if("undefined"==typeof window)throw new I("KontentSmartLink can only be initialized in a browser environment.");return new Promise(e=>{window.addEventListener("load",()=>{e(ne.initialize(t))})})}static initialize(t){return ne.instance??=new ne,ne.instance.sdk??=new ee(t),ne.instance}destroy=()=>{this.sdk?.destroy(),this.sdk=null};setConfiguration=t=>{if(!this.sdk)throw new R("KontentSmartLink is not initialized or has already been destroyed.");this.sdk.updateConfiguration(t)};on=(t,e)=>{if(!this.sdk)throw new R("KontentSmartLink is not initialized or has already been destroyed.");this.sdk.on(t,e)};off=(t,e)=>{if(!this.sdk)throw new R("KontentSmartLink is not initialized or has already been destroyed.");this.sdk.off(t,e)}}var oe=ne;n(5263);var ie=()=>((0,o.useEffect)(()=>{if({}.GATSBY_ENABLE_KONTENT_PREVIEW){const t=oe.initialize({queryParam:void 0,debug:!0});return()=>{null==t||t.destroy(),console.log("Destroy smart link")}}},[]),o.createElement(o.Fragment,null))}}]);
2//# sourceMappingURL=7954-1b5dd90cc8633b64e2ee.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.