!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("spyne")):"function"==typeof define&&define.amd?define(["spyne"],e):"object"==typeof exports?exports["spyne-plugin-scroll-lock"]=e(require("spyne")):t["spyne-plugin-scroll-lock"]=e(t.spyne)}(self,(function(t){return(()=>{"use strict";var e={139:(t,e,r)=>{r.r(e)},882:e=>{e.exports=t}},r={};function n(t){var o=r[t];if(void 0!==o)return o.exports;var l=r[t]={exports:{}};return e[t](l,l.exports,n),l.exports}n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var o={};return(()=>{n.r(o),n.d(o,{SpynePluginScrollLock:()=>Ct});var t=n(882);function e(t){return null!=t&&"object"==typeof t&&!0===t["@@functional/placeholder"]}function r(t){return function r(n){return 0===arguments.length||e(n)?r:t.apply(this,arguments)}}function l(t){return function n(o,l){switch(arguments.length){case 0:return n;case 1:return e(o)?n:r((function(e){return t(o,e)}));default:return e(o)&&e(l)?n:e(o)?r((function(e){return t(e,l)})):e(l)?r((function(e){return t(o,e)})):t(o,l)}}}const c=l((function(t,e){return null!=e&&e.constructor===t||e instanceof t}));function s(t,e){switch(t){case 0:return function(){return e.apply(this,arguments)};case 1:return function(t){return e.apply(this,arguments)};case 2:return function(t,r){return e.apply(this,arguments)};case 3:return function(t,r,n){return e.apply(this,arguments)};case 4:return function(t,r,n,o){return e.apply(this,arguments)};case 5:return function(t,r,n,o,l){return e.apply(this,arguments)};case 6:return function(t,r,n,o,l,c){return e.apply(this,arguments)};case 7:return function(t,r,n,o,l,c,s){return e.apply(this,arguments)};case 8:return function(t,r,n,o,l,c,s,i){return e.apply(this,arguments)};case 9:return function(t,r,n,o,l,c,s,i,u){return e.apply(this,arguments)};case 10:return function(t,r,n,o,l,c,s,i,u,a){return e.apply(this,arguments)};default:throw new Error("First argument to _arity must be a non-negative integer no greater than ten")}}function i(t,e){return function(){return e.call(this,t.apply(this,arguments))}}function u(t){return function n(o,c,s){switch(arguments.length){case 0:return n;case 1:return e(o)?n:l((function(e,r){return t(o,e,r)}));case 2:return e(o)&&e(c)?n:e(o)?l((function(e,r){return t(e,c,r)})):e(c)?l((function(e,r){return t(o,e,r)})):r((function(e){return t(o,c,e)}));default:return e(o)&&e(c)&&e(s)?n:e(o)&&e(c)?l((function(e,r){return t(e,r,s)})):e(o)&&e(s)?l((function(e,r){return t(e,c,r)})):e(c)&&e(s)?l((function(e,r){return t(o,e,r)})):e(o)?r((function(e){return t(e,c,s)})):e(c)?r((function(e){return t(o,e,s)})):e(s)?r((function(e){return t(o,c,e)})):t(o,c,s)}}}const a=Array.isArray||function(t){return null!=t&&t.length>=0&&"[object Array]"===Object.prototype.toString.call(t)};function p(t){return"[object String]"===Object.prototype.toString.call(t)}const d=r((function(t){return!!a(t)||!!t&&"object"==typeof t&&!p(t)&&(1===t.nodeType?!!t.length:0===t.length||t.length>0&&t.hasOwnProperty(0)&&t.hasOwnProperty(t.length-1))}));var f=function(){function t(t){this.f=t}return t.prototype["@@transducer/init"]=function(){throw new Error("init not implemented on XWrap")},t.prototype["@@transducer/result"]=function(t){return t},t.prototype["@@transducer/step"]=function(t,e){return this.f(t,e)},t}(),S=l((function(t,e){return s(t.length,(function(){return t.apply(e,arguments)}))}));const L=S;function h(t,e,r){for(var n=r.next();!n.done;){if((e=t["@@transducer/step"](e,n.value))&&e["@@transducer/reduced"]){e=e["@@transducer/value"];break}n=r.next()}return t["@@transducer/result"](e)}function y(t,e,r,n){return t["@@transducer/result"](r[n](L(t["@@transducer/step"],t),e))}var E="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator";function g(t,e,r){if("function"==typeof t&&(t=function(t){return new f(t)}(t)),d(r))return function(t,e,r){for(var n=0,o=r.length;n<o;){if((e=t["@@transducer/step"](e,r[n]))&&e["@@transducer/reduced"]){e=e["@@transducer/value"];break}n+=1}return t["@@transducer/result"](e)}(t,e,r);if("function"==typeof r["fantasy-land/reduce"])return y(t,e,r,"fantasy-land/reduce");if(null!=r[E])return h(t,e,r[E]());if("function"==typeof r.next)return h(t,e,r);if("function"==typeof r.reduce)return y(t,e,r,"reduce");throw new TypeError("reduce: list must be array or iterable")}const _=u(g);function b(t,e){return function(){var r=arguments.length;if(0===r)return e();var n=arguments[r-1];return a(n)||"function"!=typeof n[t]?e.apply(this,arguments):n[t].apply(n,Array.prototype.slice.call(arguments,0,r-1))}}const N=r(b("tail",u(b("slice",(function(t,e,r){return Array.prototype.slice.call(r,t,e)})))(1,1/0)));function C(){if(0===arguments.length)throw new Error("pipe requires at least one argument");return s(arguments[0].length,_(i,arguments[0],N(arguments)))}const k=r((function(t){return p(t)?t.split("").reverse().join(""):Array.prototype.slice.call(t,0).reverse()}));function m(){if(0===arguments.length)throw new Error("compose requires at least one argument");return C.apply(this,k(arguments))}const O=l((function(t,e){return null==e||e!=e?t:e})),I=Number.isInteger||function(t){return t<<0===t},P=l((function(t,e){var r=t<0?e.length+t:t;return p(e)?e.charAt(r):e[r]})),A=l((function(t,e){return t.map((function(t){for(var r,n=e,o=0;o<t.length;){if(null==n)return;r=t[o],n=I(r)?P(r,n):n[r],o+=1}return n}))})),v=l((function(t,e){return A([t],e)[0]}));function w(t){for(var e,r=[];!(e=t.next()).done;)r.push(e.value);return r}function x(t,e,r){for(var n=0,o=r.length;n<o;){if(t(e,r[n]))return!0;n+=1}return!1}function $(t,e){return Object.prototype.hasOwnProperty.call(e,t)}const T="function"==typeof Object.is?Object.is:function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e};var R=Object.prototype.toString,j=function(){return"[object Arguments]"===R.call(arguments)?function(t){return"[object Arguments]"===R.call(t)}:function(t){return $("callee",t)}}();const D=j;var V=!{toString:null}.propertyIsEnumerable("toString"),H=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],K=function(){return arguments.propertyIsEnumerable("length")}(),G=function(t,e){for(var r=0;r<t.length;){if(t[r]===e)return!0;r+=1}return!1};const W="function"!=typeof Object.keys||K?r((function(t){if(Object(t)!==t)return[];var e,r,n=[],o=K&&D(t);for(e in t)!$(e,t)||o&&"length"===e||(n[n.length]=e);if(V)for(r=H.length-1;r>=0;)$(e=H[r],t)&&!G(n,e)&&(n[n.length]=e),r-=1;return n})):r((function(t){return Object(t)!==t?[]:Object.keys(t)})),U=r((function(t){return null===t?"Null":void 0===t?"Undefined":Object.prototype.toString.call(t).slice(8,-1)}));function B(t,e,r,n){var o=w(t);function l(t,e){return Y(t,e,r.slice(),n.slice())}return!x((function(t,e){return!x(l,e,t)}),w(e),o)}function Y(t,e,r,n){if(T(t,e))return!0;var o,l,c=U(t);if(c!==U(e))return!1;if(null==t||null==e)return!1;if("function"==typeof t["fantasy-land/equals"]||"function"==typeof e["fantasy-land/equals"])return"function"==typeof t["fantasy-land/equals"]&&t["fantasy-land/equals"](e)&&"function"==typeof e["fantasy-land/equals"]&&e["fantasy-land/equals"](t);if("function"==typeof t.equals||"function"==typeof e.equals)return"function"==typeof t.equals&&t.equals(e)&&"function"==typeof e.equals&&e.equals(t);switch(c){case"Arguments":case"Array":case"Object":if("function"==typeof t.constructor&&"Promise"===(o=t.constructor,null==(l=String(o).match(/^function (\w*)/))?"":l[1]))return t===e;break;case"Boolean":case"Number":case"String":if(typeof t!=typeof e||!T(t.valueOf(),e.valueOf()))return!1;break;case"Date":if(!T(t.valueOf(),e.valueOf()))return!1;break;case"Error":return t.name===e.name&&t.message===e.message;case"RegExp":if(t.source!==e.source||t.global!==e.global||t.ignoreCase!==e.ignoreCase||t.multiline!==e.multiline||t.sticky!==e.sticky||t.unicode!==e.unicode)return!1}for(var s=r.length-1;s>=0;){if(r[s]===t)return n[s]===e;s-=1}switch(c){case"Map":return t.size===e.size&&B(t.entries(),e.entries(),r.concat([t]),n.concat([e]));case"Set":return t.size===e.size&&B(t.values(),e.values(),r.concat([t]),n.concat([e]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var i=W(t);if(i.length!==W(e).length)return!1;var u=r.concat([t]),a=n.concat([e]);for(s=i.length-1;s>=0;){var p=i[s];if(!$(p,e)||!Y(e[p],t[p],u,a))return!1;s-=1}return!0}const q=l((function(t,e){return Y(t,e,[],[])}));function F(t,e){return function(t,e,r){var n,o;if("function"==typeof t.indexOf)switch(typeof e){case"number":if(0===e){for(n=1/e;r<t.length;){if(0===(o=t[r])&&1/o===n)return r;r+=1}return-1}if(e!=e){for(;r<t.length;){if("number"==typeof(o=t[r])&&o!=o)return r;r+=1}return-1}return t.indexOf(e,r);case"string":case"boolean":case"function":case"undefined":return t.indexOf(e,r);case"object":if(null===e)return t.indexOf(e,r)}for(;r<t.length;){if(q(t[r],e))return r;r+=1}return-1}(e,t,0)>=0}function M(t,r,n){return function(){for(var o=[],l=0,c=t,i=0;i<r.length||l<arguments.length;){var u;i<r.length&&(!e(r[i])||l>=arguments.length)?u=r[i]:(u=arguments[l],l+=1),o[i]=u,e(u)||(c-=1),i+=1}return c<=0?n.apply(this,o):s(c,M(t,o,n))}}const X=l((function(t,e){return 1===t?r(e):s(t,M(t,[],e))}));var z=r((function(t){return X(t.length,(function(e,r){var n=Array.prototype.slice.call(arguments,0);return n[0]=r,n[1]=e,t.apply(this,n)}))}));const J=z;function Z(t){return null!=t&&"function"==typeof t["@@transducer/step"]}function Q(t,e,r){return function(){if(0===arguments.length)return r();var n=Array.prototype.slice.call(arguments,0),o=n.pop();if(!a(o)){for(var l=0;l<t.length;){if("function"==typeof o[t[l]])return o[t[l]].apply(o,n);l+=1}if(Z(o)){var c=e.apply(null,n);return c(o)}}return r.apply(this,arguments)}}const tt=function(){return this.xf["@@transducer/init"]()},et=function(t){return this.xf["@@transducer/result"](t)};var rt=function(){function t(t,e){this.xf=e,this.f=t}return t.prototype["@@transducer/init"]=tt,t.prototype["@@transducer/result"]=et,t.prototype["@@transducer/step"]=function(t,e){return this.f(e)?this.xf["@@transducer/step"](t,e):t},t}();const nt=l(Q(["filter"],l((function(t,e){return new rt(t,e)})),(function(t,e){return r=e,"[object Object]"===Object.prototype.toString.call(r)?g((function(r,n){return t(e[n])&&(r[n]=e[n]),r}),{},W(e)):function(t,e){for(var r=0,n=e.length,o=[];r<n;)t(e[r])&&(o[o.length]=e[r]),r+=1;return o}(t,e);var r})));var ot=l((function(t,e){return nt((r=t,function(){return!r.apply(this,arguments)}),e);var r}));const lt=ot,ct=l((function(t,e){return lt(J(F)(t),e)})),st=l(F),it=l((function(t,e){return t<=e})),ut=l((function(t,e){return v([t],e)}));var at=function(){function t(t,e){this.xf=e,this.f=t,this.found=!1}return t.prototype["@@transducer/init"]=tt,t.prototype["@@transducer/result"]=function(t){return this.found||(t=this.xf["@@transducer/step"](t,void 0)),this.xf["@@transducer/result"](t)},t.prototype["@@transducer/step"]=function(t,e){var r;return this.f(e)&&(this.found=!0,t=(r=this.xf["@@transducer/step"](t,e))&&r["@@transducer/reduced"]?r:{"@@transducer/value":r,"@@transducer/reduced":!0}),t},t}();const pt=l(Q(["find"],l((function(t,e){return new at(t,e)})),(function(t,e){for(var r=0,n=e.length;r<n;){if(t(e[r]))return e[r];r+=1}})));let dt=["body"];class ft{constructor(e={}){e.debug=e.debug||t.SpyneAppProperties.debug,this.props=e,this.elIsDomElement=ft.elIsDomElement.bind(this),this.selectorIsDomElement=ft.selectorIsDomElement.bind(this),this.getSelectorFromEl=ft.getSelectorFromEl.bind(this)}static createId(){return Math.random().toString(36).replace(/\d/gm,"").substring(1,8)}static getScrollLockId(t){return!1===(t&&void 0!==t.dataset&&t.dataset.hasOwnProperty("scrollLockId"))&&(t.dataset.scrollLockId=ft.createId()),t.dataset.scrollLockId}addLockableElement(t,e=!1){const r=c(String,t)?document.body.querySelector(t):t,n=St.getSelectorFromEl(r),o=St.selectorIsDomElement(n),l=!1===St.checkIfElIsLocked(n);return n&&o&&l?(r.dataset.scrollLockId=ft.getScrollLockId(r),dt.push(n),n):(this.props.debug&&!1===e&&console.warn(`Spyne Plugin Warning: The element, ${n} is not valid: ${JSON.stringify({selObj:n,isValidDomEl:o,elHasNotBeenLocked:l})}`),!1)}removeLockableElement(t,e=!1){const r=c(String,t)?document.querySelector(t):t,n=St.getSelectorFromEl(r),o=St.checkIfElIsLocked(n),l=!!document.querySelector(n)&&!1===document.querySelector(n).isEqualNode(document.body);return n&&o&&l?(dt=ct([n],dt),!0):(this.props.debug,!1)}checkIfElIsLocked(t){const e=c(String,t)?t:St.getSelectorFromEl(t);return st(e,dt)}gc(){}static elIsDomElement(t){return m(it(0),O(-1),ut("nodeType"))(t)}static selectorIsDomElement(t){const e=/(body|data|#|\.)/g.test(t),r=document.querySelector(t),n=St.elIsDomElement(r),o=!!r&&document.body.contains(r);return e&&n&&o}static getSelectorFromEl(t){if(!1===St.elIsDomElement(t))return!1;const e=document.body.isEqualNode(t)?"body":"";let r=m((t=>t?`[data-vsid="${t}"]`:""),v(["dataset","vsid"]))(t),n=m((t=>t?`[data-scroll-lock-id="${t}"]`:""),ft.getScrollLockId)(t);const o=t.id?"#"+t.id:"";let l=t.className?"."+String(t.classList[0]).replace(/\s+/gm,"."):"";return m(O(""),pt((t=>String(t).length>1)))([e,n,r,o,l])}}let St=new ft;class Lt extends t.SpyneTrait{constructor(t){super(t,"plugin$ScrollEl$")}static plugin$ScrollEl$CheckForScrollAdjust(t){const{srcElement:e}=t,r=St.checkIfElIsLocked(e),n=m(O(!1),v(["props","addScrollbarProxy"]))(this);let o=0;const l=t=>{const{offsetWidth:e,clientWidth:r}=t,n=e-r;return n>=0?n:o};(r||!0===n)&&requestAnimationFrame((()=>{o=l(e);let t=!1;if(!0===n&&0===o){const e=document.getElementById("proxy-scrollbar");o=l(e),t=!0}var r;r=t,document.getElementById("proxy-scrollbar").classList.toggle("reveal",r),document.documentElement.style.setProperty("--scroll-lock-margin",`-${o}px`),document.documentElement.style.setProperty("--scroll-lock-padding",`${o}px`),document.documentElement.style.setProperty("--scroll-lock-width",`calc(100% + ${o}px`)}))}static plugin$ScrollEl$AddScrollEl(t,e=this.props){St.addLockableElement(t)}static plugin$ScrollEl$RemoveScrollEl(t,e=this.props){St.removeLockableElement(t)}}class ht extends t.Channel{constructor(t,e={}){e.sendCachedPayload=!1,e.traits=[Lt],e.scrollLocked=!1,e.addScrollbarProxy=!1,e.lockedElementsArr=[],super("CHANNEL_SPYNE_PLUGIN_SCROLL_LOCK",e)}onRegistered(){const e=["CHANNEL_WINDOW_ORIENTATION_EVENT","CHANNEL_WINDOW_RESIZE_EVENT","CHANNEL_WINDOW_SCROLL_ELEMENT_ADDED_EVENT"],r=new t.ChannelPayloadFilter({action:t=>e.indexOf(t)>=0});this.getChannel("CHANNEL_WINDOW",r).subscribe(this.onWindowEvent.bind(this))}onWindowEvent(t){this.plugin$ScrollEl$CheckForScrollAdjust(t)}onSetLock(t){}sendScrollLockEvent(t,e){}onInitLockEvent(t){const{payload:e}=t,{enableScrollLock:r,addScrollbarProxy:n,el:o}=e;this.props.addScrollbarProxy=!0===n||"true"===n,this.props.scrollLocked=!0===r||"true"===r,void 0!==o&&(this.props.scrollLocked?this.plugin$ScrollEl$AddScrollEl:this.plugin$ScrollEl$RemoveScrollEl)(o);const l=r?"CHANNEL_SPYNE_PLUGIN_SCROLL_LOCK_ENABLE_LOCK_EVENT":"CHANNEL_SPYNE_PLUGIN_SCROLL_LOCK_DISABLE_LOCK_EVENT";this.sendChannelPayload(l,{action:l,enableScrollLock:r,addScrollbarProxy:n},o)}onSetProxyVisible(t=!0){this.sendChannelPayload("CHANNEL_SPYNE_PLUGIN_SCROLL_LOCK_SET_PROXY_SCROLLBAR_EVENT",{proxyVisible:t})}onCheckAdjustMargin(t){const{payload:e}=t,{addScrollbarProxy:r}=e;this.props.addScrollbarProxy=r;const n=v(["payload","el"],t);this.plugin$ScrollEl$CheckForScrollAdjust({srcElement:n}),this.onSetProxyVisible(r)}addRegisteredActions(){return["CHANNEL_SPYNE_PLUGIN_SCROLL_LOCK_ENABLE_LOCK_EVENT","CHANNEL_SPYNE_PLUGIN_SCROLL_LOCK_DISABLE_LOCK_EVENT",["CHANNEL_SPYNE_PLUGIN_SCROLL_LOCK_INIT_EVENT","onInitLockEvent"],["CHANNEL_SPYNE_PLUGIN_SCROLL_LOCK_CHECK_MARGIN_ADJUST_EVENT","onCheckAdjustMargin"],["CHANNEL_SPYNE_PLUGIN_SCROLL_LOCK_SET_LOCK","onSetLock"],"CHANNEL_SPYNE_PLUGIN_SCROLL_LOCK_SET_PROXY_SCROLLBAR_EVENT",["CHANNEL_SPYNE_PLUGIN_SCROLL_LOCK_UPDATE_PROXY_SCROLLBAR_EVENT","onSetProxyVisible"]]}onViewStreamInfo(){}}const yt=l((function(t,e){for(var r={},n=0;n<t.length;)t[n]in e&&(r[t[n]]=e[t[n]]),n+=1;return r})),Et=l((function(t,e){for(var r=W(e),n=0;n<r.length;){var o=r[n];t(e[o],o,e),n+=1}return e}));class gt extends t.SpyneTrait{constructor(t){super(t,"pluginScrollLock$")}static pluginScrollLock$InitGlobalProps(){document.documentElement.style.setProperty("--scroll-lock-margin","-0px"),document.documentElement.style.setProperty("--scroll-lock-padding","0px"),document.documentElement.style.setProperty("--scroll-lock-width","calc(100% + 0px")}static pluginScrollLock$InitScrollProps(t=this.props){return t.scrollLocked=!1,t.addScrollbarProxy=!1,t.defaultScrollState=gt.pluginScrollLock$GetDefaultScrollState(t.el),t}static pluginScrollLock$GetDefaultScrollState(t=this.props.el){const e=gt.pluginScrollLock$GetAttrs(t,["position","overflow","top"]);return e.x=window.scrollX,e.y=window.scrollY,e}static pluginScrollLock$GetAttrs(t=this.props.el,e){return yt(e,window.getComputedStyle(t))}static pluginScrollLock$SetWindowScroll(t,e){window.scrollTo(t,e)}static pluginScrollLock$SetScrollLockProperties(t,e,r,n=this.props.el){Et(((t,e)=>n.style[e]=t),{position:t,overflow:e,top:r})}static pluginScrollLock$ScrollIntoView(t,e={}){const r={behavior:"auto",block:"nearest"};if(m(it(0),O(-1),ut("nodeType"))(t)){const n=Object.assign(r,e);this.props.scrollLocked?(this.pluginScrollLock$DisableBodyScroll(),t.scrollIntoView(n),this.pluginScrollLock$EnableBodyScroll()):t.scrollIntoView(n)}else console.warn(`Spyne Plugin Warning: the element, ${t} is not valid in "scrollLockScrollIntoView".`)}static pluginScrollLock$EnableBodyScroll(t=this.props){if(!0===this.props.scrollLocked)return;this.props.defaultScrollState=this.pluginScrollLock$GetDefaultScrollState();const{y:e}=this.props.defaultScrollState,r=-1*e+"px";this.props.scrollLocked=!0,this.pluginScrollLock$SetScrollLockProperties("fixed","hidden",r)}static pluginScrollLock$DisableBodyScroll(){this.props.scrollLocked=!1;const{position:t,overflow:e,top:r,x:n,y:o}=this.props.defaultScrollState;this.pluginScrollLock$SetScrollLockProperties(t,e,r),gt.pluginScrollLock$SetWindowScroll(n,o)}static pluginScrollLock$CheckForMainWindowScrollListener(){const e=t.SpyneAppProperties.getChannelConfig("WINDOW"),{listenForScroll:r}=e;!0!==r&&console.warn('SpynePluginScrollLock warning: Initial Configuration for WINDOW Channel requires "listenForScroll" property to be true. Config: ',e)}static pluginScrollLock$SendScrollEventToWindowChannel(t){const e="CHANNEL_WINDOW_SET_ELEMENT_TO_SCROLL_EVENT";this.sendInfoToChannel("CHANNEL_WINDOW",{el:t,action:e},e)}static pluginScrollLock$CheckForScrollLockMarginAdjust(t,e=!1){const r="CHANNEL_SPYNE_PLUGIN_SCROLL_LOCK_CHECK_MARGIN_ADJUST_EVENT";this.sendInfoToChannel("CHANNEL_SPYNE_PLUGIN_SCROLL_LOCK",{action:r,el:t,addScrollbarProxy:e},r,t)}static pluginScrollLock$SendScrollLockInfoToChannel(t,e=!0,r=!1){const n="CHANNEL_SPYNE_PLUGIN_SCROLL_LOCK_INIT_EVENT";(()=>{this.sendInfoToChannel("CHANNEL_SPYNE_PLUGIN_SCROLL_LOCK",{action:n,enableScrollLock:e,addScrollbarProxy:r,el:t},n,t),e&&t&&this.pluginScrollLock$SendScrollEventToWindowChannel(t)})()}}class _t extends t.ViewStream{constructor(t={}){(t=gt.pluginScrollLock$InitScrollProps(t)).traits=[gt],super(t)}addActionListeners(){return[["CHANNEL_SPYNE_PLUGIN_SCROLL_LOCK_ENABLE_LOCK_EVENT","onEnableScrollLock"],["CHANNEL_SPYNE_PLUGIN_SCROLL_LOCK_DISABLE_LOCK_EVENT","onDisableScrollLock"]]}onEnableScrollLock(t){const{payload:e}=t,{addScrollbarProxy:r}=e;this.props.addScrollbarProxy=r,this.pluginScrollLock$EnableBodyScroll()}onDisableScrollLock(){this.props.addScrollbarProxy=!1;const t=this.props.el;this.pluginScrollLock$DisableBodyScroll(),Lt.plugin$ScrollEl$CheckForScrollAdjust({srcElement:t})}broadcastEvents(){return[]}onRendered(){this.pluginScrollLock$CheckForMainWindowScrollListener(),this.addChannel("CHANNEL_SPYNE_PLUGIN_SCROLL_LOCK")}}class bt extends t.SpyneTrait{constructor(t){super(t,"proxyBar$")}static proxyBar$CheckToAddScrollBar(){var t=window.innerHeight;return document.body.offsetHeight>t}}class Nt extends t.ViewStream{constructor(t={}){t.id="proxy-scrollbar",t.traits=bt,t.class="reveal",super(t)}addActionListeners(){return[["CHANNEL_SPYNE_PLUGIN_SCROLL_LOCK_ENABLE_LOCK_EVENT","onEnableScroll"],["CHANNEL_SPYNE_PLUGIN_SCROLL_LOCK_DISABLE_LOCK_EVENT","onDisableScroll"],["CHANNEL_SPYNE_PLUGIN_SCROLL_LOCK_SET_PROXY_SCROLLBAR_EVENT","onSetVisibility"]]}onSetVisibility(t){const{payload:e}=t,{proxyVisible:r}=e;this.props.el$.toggleClass("reveal",r)}onDisableScroll(){this.props.el$.removeClass("reveal")}onEnableScroll(t){const{payload:e}=t,{addScrollbarProxy:r}=e;this.props.el$.toggleClass("reveal",r)}broadcastEvents(){return[]}onRendered(){this.addChannel("CHANNEL_SPYNE_PLUGIN_SCROLL_LOCK")}}n(139);class Ct extends t.SpynePlugin{constructor(t={}){t.name="SpynePluginScrollLock",console.log("scroll lock init 122521 ",window.Spyne),super(t),this.enableScrollTestVal="DISABLE THE WINDOW SCROLL "}defaultConfig(){return{text:"Hola Mundo",lockedEl:document.body,pluginMethods:{enableScroll:this.enableScroll.bind(this),enableScrollLock:this.enableScrollLock.bind(this),disableScrollLock:this.disableScrollLock.bind(this),scrollIntoView:this.scrollIntoView.bind(this),updateScrollMarginAdjust:this.onCheckScrollLockMarginAdjust.bind(this)}}}onCheckScrollLockMarginAdjust(t){this.checkScrollLockMarginAdjuster(t)}scrollIntoView(t,e={}){this.scrollLockScrollIntoView(t,e)}enableScrollLock(t,e=!1){this.sendScrolLockInfoToChannel(t,!0,e)}disableScrollLock(t){this.sendScrolLockInfoToChannel(t,!1,!1)}enableScroll(){return this.enableScrollTestVal}onRegistered(){gt.pluginScrollLock$InitGlobalProps(),t.SpyneApp.registerChannel(new ht)}onRender(){const{config:t}=this.props,{lockedEl:e}=t,r=c(String,e)?document.querySelector(e):e;this.props.bodyScrollEl=new _t({el:r}),this.props.proxyScrollbar=(new Nt).appendToDom(this.props.parentEl),this.checkScrollLockMarginAdjuster=gt.pluginScrollLock$CheckForScrollLockMarginAdjust.bind(this.props.bodyScrollEl),this.scrollLockScrollIntoView=gt.pluginScrollLock$ScrollIntoView.bind(this.props.bodyScrollEl),this.sendScrolLockInfoToChannel=gt.pluginScrollLock$SendScrollLockInfoToChannel.bind(this.props.bodyScrollEl)}}})(),o})()}));