spyne 0.25.0 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/spyne.esm.js CHANGED
@@ -1,6 +1,6 @@
1
- import{fromEventPattern as e,Observable as t,Subject as r,bindCallback as n,fromEvent as o,of as s,ReplaySubject as i,forkJoin as a,EMPTY as c,merge as l,from as d}from"rxjs";import{compose as u,complement as h,isEmpty as E,head as p,values as N,isNil as _,allPass as f,reject as m,equals as T,keys as A,find as C,is as y,assoc as g,prop as b,when as v,__ as I,join as S,replace as L,flatten as O,map as D,toPairs as R,ifElse as H,always as w,concat as V,either as P,propEq as U,test as M,findLastIndex as W,last as x,filter as F,invert as $,defaultTo as k,reduce as G,zipObj as j,split as z,fromPairs as B,has as Y,path as K,uniq as q,chain as Q,includes as X,mergeRight as J,pickAll as Z,pick as ee,mergeDeepRight as te,clone as re,not as ne,mergeAll as oe,lte as se,match as ie,without as ae,mapObjIndexed as ce,pipe as le,forEachObjIndexed as de,flip as ue,propSatisfies as he,forEach as Ee,props as pe,omit as Ne,any as _e,curry as fe,where as me,F as Te,all as Ae,slice as Ce,toLower as ye,findIndex as ge,apply as be,identity as ve,objOf as Ie,view as Se,lensIndex as Le,lensProp as Oe,over as De,reverse as Re,curryN as He,toUpper as we,partialRight as Ve,pluck as Pe,pathEq as Ue,pathSatisfies as Me}from"ramda";import We from"dompurify";class xe{constructor(){this.checkIfObjIsNotEmptyOrNil=xe.checkIfObjIsNotEmptyOrNil.bind(this)}static checkIfObjIsNotEmptyOrNil(e){const t=u(h(E),p,N),r=u(h(_),p,N);return f([t,r])(e)}static checkIfParamValueMatchesRegex(e,t){const r=m(T("routeName")),n=u(r,A),o=u(C(t=>M(new RegExp(t),e)),n)(t);return y(String,o)&&(t=g(e,b(o,t),t)),t}static formatStrAsWindowLocation(e){return{hash:e,search:e,pathname:e}}static getLocationStrByType(e,t=!1,r=window.location){return b({slash:"pathname",query:"search",hash:"hash"}[!0===t?"hash":e],r).replace(/^(\/)?(#)?(\/)?(.*)$/,"$4")}static createRouteArrayFromParams(e,t,r="slash",n){const o=[],s=t=>{const r={},i=t.routeName;let a=void 0!==e[i]?e[i]:b(i,n);const c=typeof t[a];"string"===c?a=t[a]:"undefined"===c&&(t=this.checkIfParamValueMatchesRegex(a,t)),r[i]=a,this.checkIfObjIsNotEmptyOrNil(r)&&o.push(r);const l=y(Object,t),d=Y(a,t),u=Y("routePath",t);if(!0===(d&&l)){const e=t[a];Y("routePath",e)&&s(e.routePath)}else!0===u&&void 0!==a&&s(t.routePath)};return s(t),o}static createSlashString(e){const t=m(_),r=v(h(_,I),S("/")),n=L(/^(\^*)(.*|^\$)(\$)$/,"$2");return u(n,r,t,O,D(N))(e)}static createQueryString(e){const t=m(_),r=this.checkIfObjIsNotEmptyOrNil,n=u(S("="),O,R),o=H(r,n,w(void 0)),s=D(o),i=v(h(E),V("?"));return u(i,S("&"),t,s)(e)}static checkPayloadForRegexOverrides(e,t,r="Value"){const n=u(e=>b(`${e}${r}`,t),p,A);return D(e=>{const t=n(e);return void 0!==t?g(u(p,A)(e),t,e):e},e)}static checkForRouteValWithMultipleVals(e){const t=e=>{const t=(t,r)=>(t[r]=(e=>{const t=e.match(/^[^|]*/);return t?"^$"===t[0]?"":t[0]:e})(e[r]),t);return"object"==typeof e&&(e=Object.keys(e).reduce(t,{})),e};return!0===Array.isArray(e)?e.map(t):e}static checkForRouteValsPartMatch(e,t={}){const r=(e,t)=>t.split("|").some(t=>((e,t)=>{const r=e.replace(/[-/\\^$+?.()|[\]{}]/g,"\\$&").replace(/\*/g,"[\\w\\d_-]*");return new RegExp(`^${r}$`).test(t)})(t,e))?e:t;return e.map(e=>{const n={...e};return Object.keys(n).forEach(e=>{Object.prototype.hasOwnProperty.call(n,e)&&t[e]&&(n[e]=r(t[e],n[e]))}),n})}static convertParamsToRoute(e,t=it.config.channels.ROUTE,r,n){const o=void 0!==r?r:t.type,s=t.isHash,i=t.routes.routePath,a=void 0!==n?n:this.getLocationStrByType(o,s),c=this.convertRouteToParams(a,t,o).routeData;let l=this.createRouteArrayFromParams(e,i,o,c);return l=xe.checkPayloadForRegexOverrides(l,e),l=xe.checkForRouteValWithMultipleVals(l),"query"===o?this.createQueryString(l):this.createSlashString(l)}static findIndexOfMatchedStringOrRegex(e,t){const r=t.includes(".+"),n=L(/^$/,"^$"),o=P(U(e,"str"),u(M(I,e),b("re")));return u(W(T(!0)),D(o),D(e=>{return{str:e,re:(t=e,r&&(t.startsWith("^")||(t="^"+t),t.endsWith("$")||(t+="$")),new RegExp(t))};var t}),D(n))(t)}static checkIfValueShouldMapToParam(e,t,r){const n=u(D(x),D(F(y(String))),R)(e),o=xe.findIndexOfMatchedStringOrRegex(t,n);let s=t;if(o>=0){const t=n[o],r=$(e),i=u(p,k([]),b(t))(r);!0===/^([-$\w]*)$/.test(i)&&!0===y(String,i)&&(s=i)}return s}static createArrFromSlashStr(e){return e.replace(/^([/])?(.*)$/,"$2").split("/")}static convertSlashRouteStrToParamsObj(e,t,r){const n=t,o=this.createArrFromSlashStr(t),s=[],i=[];let a=e;G((e,t)=>{const n=this.checkIfValueShouldMapToParam(a,t,r);a=this.checkIfParamValueMatchesRegex(t,a);const o=P(E,_);void 0!==a&&(e=>e!==x(s))(a.routeName)&&!1===o(n)&&(s.push(a.routeName),i.push(n));const c=K([t,"routePath"],a),l=K(["routePath"],a);void 0!==c?a=c:void 0!==l&&(a=l)},0,o);const c=j(s,i),l=this.getLastArrVal(s);return{paths:s,pathInnermost:l,routeData:c,routeValue:n}}static getLastArrVal(e){return void 0!==x(t=e)?x(t):"";var t}static createDefaultParamFromEmptyStr(e,t){const r={};return r[e.routeName]=this.checkIfValueShouldMapToParam(e,t),r}static convertQueryStrToParams(e,t,r){const n=t,o=t.replace(/^([?])?(.*)$/,"$2"),s=u(D(z("=")),z("&"))(o);let i=B(s),a=D(p,s);!0===E(t)&&(i=this.createDefaultParamFromEmptyStr(e,t,r),a=A(i));return{paths:a,pathInnermost:this.getLastArrVal(a),routeData:i,routeValue:n}}static convertRouteToParams(e,t,r){if(void 0===t)return{};const n=void 0!==r?r:t.type,o=k({},b("regexTokens",t)),s=t.routes.routePath;return"query"===n?this.convertQueryStrToParams(s,e):(e=e.replace(/\/$|$/,"/"),this.convertSlashRouteStrToParamsObj(s,e,o))}}class Fe{constructor(){this.createPopStateStream=Fe.createPopStateStream.bind(this)}static createPopStateStream(t){e(function(e){window.onpopstate=e},function(){window.onpopstate=function(){}}).subscribe(t)}static getLastArrVal(e){return void 0!==x(t=e)?x(t):"";var t}static compareRouteKeywords(e={},t){const r=(e,t)=>void 0!==t?ee(t,e):e;let n=r(e,t);return{pickValues:r,compare:(e={},t)=>{const o=r(e,t),s=e=>u(A,F(U(!0,e))),i=u(D(e=>{const t=b(e,n),r=b(e,o),s=T(t,r),i=void 0!==t,a=void 0!==r,c=!s,l=!1===i&&!0===a,d=!0===i&&!1===a,u={};return u[e]={same:s,changed:c,added:l,removed:d,previousExists:i,nextExists:a},u}),q,Q(A))([n,o]),a=Q(s("changed"),i),c=Q(s("added"),i),l=Q(s("removed"),i);return n=o,{pathsAdded:c,pathsRemoved:l,pathsChanged:a}},getComparer:()=>n}}static getRouteArrData(e,t){const r=F(X(I,e),t);return{paths:r,pathInnermost:Fe.getLastArrVal(r)}}static flattenConfigObject(e){const t=e=>Q(([e,r])=>"object"!=typeof r||null===r||Array.isArray(r)?[[e,r]]:D(([t,r])=>[`${e}.${t}`,r],t(r)),R(e));return N(B(t(e)))}static addRouteDatasets(e){const{type:t,isHash:r}=e,n=n=>{const o="query"===t?"":!0===r?"#":"/",s=xe.convertParamsToRoute(n,e);return o+s.replace(/^(.*\/)([\w-]*\/?)(.*)$/gm,"$1$2")},o=/^([A-Za-z0-9_-])+$/m,s=(e=[],t,r={})=>{let{routeName:i}=t;return R(t).reduce((t,a)=>{const[c,l]=a,d=y(Object,l),u=e=>M(o,e)?(e=>String(e).replace(/([-_])/g," ").toUpperCase())(e):c;if("routeName"===c||"404"===c)return t;i=i||b("routeName",l);let h=re(r);if(h[i]=String(c).replace(/([^A-Za-z0-9-_])/g,""),!0===d){if(1===A(h).length){const e=K(["routePath","routeName"],l);if(e){const o=re(h);o[e]="",o.navLevel=A(r).length,o.title=u(c),o.href=n(o),t.push(o)}}h=s(e,l,h)}else h.title=u(c),h.href=n(h);return h.navLevel=A(r).length,t.push(h),t},[])},i=s([],e.routes);let a=O(i);a=function e(t){return t.map(t=>{for(const r in t)void 0===r||"undefined"===r||void 0===t[r]?delete t[r]:t[r]&&"object"==typeof t[r]&&!Array.isArray(t[r])&&(t[r]=e([t[r]])[0]);return t})}(a);return{routeDatasetsArr:a,routeNamesArr:(e=>{const t=m(X(I,["title","href","navLevel","undefined"]));return u(q,t,O,D(A))(e)})(a)}}static conformRouteObject(e={},t=!1){const r=K(["channels","ROUTE"],e);let{add404s:n}=void 0!==r?r:e;n=n||t;const o=e=>{const t=e[1],r=y(Array,t);return""===t?e[1]="^$":r&&(e[1]=t.join("|")),e},s=u(B,D(e=>{const[t,r]=e,i=n?{404:".+"}:{},a=y(Object,r),c=y(Array,r),l="routePath"===t;return!0===a&&!1===c&&(e[1]=s(e[1]),l&&(e[1]=u(te(i),B,D(o),R)(e[1]))),e}),R);if(void 0!==r){e.channels.ROUTE=s(e.channels.ROUTE);const t=Fe.addRouteDatasets(e.channels.ROUTE);return e.channels.ROUTE=J(e.channels.ROUTE,t),e}return s(e)}static getLocationData(){return Z(["href","origin","protocol","host","hostname","port","pathname","search","hash"],window.location)}}const $e=Object.create({}),ke=u(ne,y(Array)),Ge=u(f([ke,y(Object)]));function je(e){return e&&"object"==typeof e&&"[object RegExp]"!==Object.prototype.toString.call(e)&&"[object Date]"!==Object.prototype.toString.call(e)}function ze(e,t){return t&&!0===t.clone&&je(e)?Ye((r=e,Array.isArray(r)?[]:{}),e,t):e;var r}function Be(e,t,r){const n=e.slice();return t.forEach(function(t,o){void 0===n[o]?n[o]=ze(t,r):je(t)?n[o]=Ye(e[o],t,r):-1===e.indexOf(t)&&n.push(ze(t,r))}),n}function Ye(e,t,r){const n=Array.isArray(t),o=(r||{arrayMerge:Be}).arrayMerge||Be;return n?Array.isArray(e)?o(e,t,r):ze(t,r):function(e,t,r){const n={};return je(e)&&Object.keys(e).forEach(function(t){n[t]=ze(e[t],r)}),Object.keys(t).forEach(function(o){je(t[o])&&e[o]?n[o]=Ye(e[o],t[o],r):n[o]=ze(t[o],r)}),n}(e,t,r)}let Ke,qe,Qe,Xe;Ye.all=function(e,t){if(!Array.isArray(e)||e.length<2)throw new Error("first argument should be an array with at least two elements");return e.reduce(function(e,r){return Ye(e,r,t)})};let Je=!0,Ze=!1;const et=[];let tt,rt;const nt=[],ot=new Map;const st=new class{constructor(){$e.foo=()=>console.log("used for testing purposes.")}addMethod(e,t,r=!1){if(!0===Object.prototype.hasOwnProperty.call($e,e)){const t=`Spyne Warning: the method name, ${e}, already exists.`;if(r)return t;console.warn(t)}else $e[e]=t}addMethods(e={},t=!1){let r;if(!1===Ge(e))return r=`Spyne Warning: the pluginMethods property, ${JSON.stringify(e)} needs to be an object.`,t?r:void console.warn(r);return A(e).map(n=>{const o=b(n,e);if("function"==typeof o)this.addMethod(n,o,t);else{if(r=`the value for ${n} is not a valid function.`,t)return r;console.warn(r)}}).join(",")}checkIfMethodExists(e){}get pluginMethodsObj(){return $e}};const it=new class{constructor(){Xe=!1}get channelsMap(){return Qe}get initialized(){return Xe}get config(){return Ke}get debug(){return Je}get mode(){return void 0!==Ke?.mode?Ke.mode:"app"}static listChannels(){return Array.from(qe.map.keys())}initialize(e={},t={},r,n){return qe=r,Ke=Ye(e,t),Ke.channels&&Ke.channels.ROUTE&&(Ke=n.conformRouteObject(Ke)),rt=Ke?.IMG_PATH,Je=void 0!==Ke.debug?Ke.debug:Je,this.getChannelActions=qe.getChannelActions.bind(qe),this.listRegisteredChannels=qe.listRegisteredChannels.bind(qe),Xe=!0,this._initialized=Xe,this.setChannelsMap(),t?.baseHref&&this.setHeadBaseHref(t.baseHref),Ke}setHeadBaseHref(e){const t=document.createElement("base");t.href=e,document.head.appendChild(t)}conformRouteConfig(e=!1){Ke=Fe.conformRouteObject(Ke,e)}setChannelsMap(){const e=qe.getStream.bind(qe),t=qe.testStream.bind(qe),r=qe.getProxySubject.bind(qe);Qe={getStream:e,testStream:t,getProxySubject:r}}setProp(e,t,r=!1){return r?Ke.ephemeralProps[e]=t:Ke.tmpProps[e]=t,t}getProp(e){if(Ke?.tmpProps&&Object.prototype.hasOwnProperty.call(Ke.tmpProps,e))return Ke.tmpProps[e];if(Ke?.ephemeralProps&&Object.prototype.hasOwnProperty.call(Ke.ephemeralProps,e)){const t=Ke.ephemeralProps[e];return delete Ke.ephemeralProps[e],t}}createTempProp(e){const t=Math.random().toString(36).slice(2,8);return this.setProp(t,e,!0),t}setChannelConfig(e,t){return Ke.channels[e]=t,Ke.channels[e]}getChannelConfig(e,t=Ke){if("CHANNEL_ROUTE"===e?e="ROUTE":"CHANNEL_WINDOW"===e&&(e="WINDOW"),void 0===t||void 0===Ke.channels)return void console.warn("Spyne warning: Spyne config object is empty!");const r=Ke.channels[e];if(void 0!==r)return r;console.warn(`Spyne warning: Spyne configuration for channel, ${e} is empty!`)}registerChannel(){}addPluginConfig(e,t={}){void 0===Ke.plugins&&(Ke.plugins={}),this.addPluginMethods(t.pluginMethods),Ke.plugins[e]=t}getPluginsMethodObj(e){return e&&this.addPluginMethods(e),st.pluginMethodsObj}addPluginMethods(e){e&&st.addMethods(e)}doNotTrackChannel(e){nt.push(e)}getUntrackedChannelsList(){return nt}registerProxyReviver(e,t){ot.set(e,t)}registerPlugin(e){this._initialized||console.warn("SpyneApp is not initialized yet. Plugin will not be fully registered."),e.register(this)}getProxyReviver(e){return ot.get(e)}getPluginConfigByPluginName(e){return Ke.plugins[e]}get IMG_PATH(){return rt}get excludeChannelsFromConsole(){return et}set excludeChannelsFromConsole(e){"string"==typeof e?et.includes(e)||et.push(e):Array.isArray(e)?e.forEach(e=>{"string"!=typeof e||et.includes(e)||et.push(e)}):console.warn("Invalid value provided to excludeChannelsFromConsole. Only strings or arrays are allowed.")}get linksData(){return console.warn("get links data in SpyneAppProperties is deprecated, use navLinks"),tt}set linksData(e){console.warn("set links data in SpyneAppProperties is deprecated, use navLinks")}get navLinks(){return tt}set navLinks(e){tt=e}get enableCMSProxies(){return Ze}getHrefFromData(e={}){return xe.convertParamsToRoute(e)}set enableCMSProxies(e=!0){Ze=Boolean(e)}setCMSProxyMethod(e){this.enableCMSProxies=!0,this.formatTemplateForProxyData=e}tempGetChannelsInstance(){}tempGetConfig(){}},at=()=>({includes:()=>!0===it.initialized?it.listRegisteredChannels():["CHANNEL_ROUTE","CHANNEL_UI","CHANNEL_WINDOW","DISPATCHER"]});void 0!==u&&void 0!==t&&(u(y(String),K(["data","srcElement","vsid"])),u(y(String),K(["data","srcElement","id"])));const ct=(e,t)=>{const{__proxy__proxyName:r}=e;void 0===r&&console.error("object is not proxy object ",e);const n=(r,n)=>{const o=K(n,e),{__proxy__isProxy:s,__proxy__props:i}=o;return s?t(r,i):r},o=n(re(e),[]),s=(e,t)=>{const r=t||[];Object.entries(e).forEach(([t,o])=>{const i=(e=>{let t=typeof e;return["number","boolean","string"].includes(t)?t="primitive":"object"===t&&(Array.isArray(e)?t="array":null===e&&(t="undefined")),t})(o),a=[...r];a.push(t),"object"!==i&&"array"!==i||(e[t]=n(o,a),s(o,a))})};return s(o),o},lt=function(e){const{__proxy__proxyName:t}=e;if(void 0!==t){const r=it.getProxyReviver(t);if("function"==typeof r)return ct(e,r)}const r=y(Array),n=y(Object);var o;return!1===r(o=e)&&!0===n(o)?u(B,R,re)(e):re(e)};class dt{constructor(e,t,r,n,o,s){const i=e;s&&console.time(s);const a={channelName:e,action:t,srcElement:n,event:o},c=dt.deepFreeze(r);if(a.payload=c,!0===it.debug){if(Object.prototype.hasOwnProperty.call(r,"payload")){const e=JSON.stringify(r);console.warn(`Spyne Warning: the following payload contains a nested payload property which may create conflicts: Action: ${t}, ${e}`)}const e=it.getChannelActions(i);dt.validateAction(t,i,e)}a.clone=()=>oe([{payload:lt(a.payload)},a.payload,{channel:re(i)},{event:re(o)},{srcElement:n},re(a.srcElement),{action:re(a.action)}]);const l={$dir:{get:()=>a._dir,set:e=>(a._dir=e,e)}};return"CHANNEL_ROUTE"===i&&(l.location={get:()=>dt.getLocationData()}),a._dir=void 0,Object.defineProperties(a,l),s&&console.timeEnd(s),a}static validateAction(e,t,r){const n=X(e,r);return!1===n&&!0===it.initialized&&console.warn(`warning: Action: '${e}' is not registered within the ${t} channel!`),n}static getLocationData(){return Z(["href","origin","protocol","host","hostname","port","pathname","search","hash"],window.location)}static getStreamItem(){}static deepClone(e){const t=y(Array),r=y(Object);var n;return!1===t(n=e)&&!0===r(n)?u(B,R,re)(e):re(e)}static deepFreeze(e){const t=u(se(0),k(-1),b("nodeType"));try{Object.freeze(e),Object.getOwnPropertyNames(e).forEach(function(r){!Object.prototype.hasOwnProperty.call(e,r)||!1!==t(e[r])||null===e[r]||"object"!=typeof e[r]&&"function"!=typeof e[r]||Object.isFrozen(e[r])||dt.deepFreeze(e[r])})}catch(t){return e}return e}static getMouseEventKeys(){return["altKey","bubbles","cancelBubble","cancelable","clientX","clientY","composed","ctrlKey","currentTarget","defaultPrevented","detail","eventPhase","fromElement","isTrusted","layerX","layerY","metaKey","movementX","movementY","offsetX","offsetY","pageX","pageY","path","relatedTarget","returnValue","screenX","screenY","shiftKey","sourceCapabilities","srcElement","target","timeStamp","toElement","type","view","which","x","y"]}}function ut(){return{createpropsMap:function(){const e=new WeakMap,t={vsid:this.props.vsid};return e.set(t,this.props),{key:t,weakMap:e}},gc:function(){for(const e in this)delete this[e]},createId:function(){return Math.random().toString(36).replace(/\d/gm,"").substring(1,8)},setTraceFunc:function(e){return!0===e?console.log:()=>{}}}}const ht=async(e,t)=>{window.setTimeout(async()=>{var t;await(t=1,new Promise(e=>setTimeout(e,t))),window.requestAnimationFrame(e)},t)},Et=e=>{if(void 0!==e.constructor.name)return e.constructor.name;const t=e.toString();return k(String(t).substr(0,12),ie(/^(function\s)(\w+)(\(.*)$/,t)[2])},pt=e=>{const t=u(h(E),p,N),r=u(h(_),p,N);return f([t,r])(e)};const Nt=(...e)=>{!0!==("undefined"!=typeof window&&!0===window.SPYNE_SUPPRESS_WARNINGS)&&console.warn(...e)},_t=(e=!0)=>{"undefined"!=typeof window&&(window.SPYNE_SUPPRESS_WARNINGS=!0===e)};let ft,mt=!1,Tt=!1;const At=/^(?:(?:https?|mailto|tel):|data:image\/|(?![a-z][a-z0-9+.-]*:)[\s\S]*$)/i,Ct=e=>String(e).replace(/[\u0000-\u0020]/g,""),yt=/^spyne-[a-z][a-z0-9-]*$/i,gt=[],bt=(e=[])=>{(Array.isArray(e)?e:[e]).forEach(e=>{if(e instanceof RegExp)return void gt.push(e);const t=String(e).toLowerCase();!0===/^[a-z][a-z0-9]*-[a-z0-9-]+$/.test(t)?gt.push(t):Nt(`SPYNE WARNING: "${e}" is not a valid custom element name (a hyphen is required) and was not added to the sanitizer allowlist.`)})},vt={tagNameCheck:e=>!!yt.test(e)||gt.some(t=>t instanceof RegExp?t.test(e):t===e),attributeNameCheck:/^data-[a-z0-9-]+$/i,allowCustomizedBuiltInElements:!1},It={ALLOWED_TAGS:["a","b","i","em","strong","u","p","br","ul","dl","dt","dd","ol","li","hr","blockquote","pre","code","span","div","section","article","aside","header","footer","h1","h2","h3","h4","h5","h6","table","thead","tbody","tr","td","th","img","figure","figcaption","video","source","iframe","input","button","label","link"],ADD_TAGS:["iframe","input","button","link"],ALLOWED_ATTR:["href","src","alt","class","title","width","height","style","target","rel","controls","poster","type","rows","cols","sandbox"],ALLOW_DATA_ATTR:!0,FORBID_ATTR:["onerror","onload","onclick","onmouseover","onfocus","onblur","onchange"],FORBID_TAGS:["script","object","embed","meta"],ALLOWED_URI_REGEXP:At,CUSTOM_ELEMENT_HANDLING:vt},St={FORBID_TAGS:["script","iframe","object","embed","form","input","button","link","meta"],FORBID_ATTR:["onerror","onload","onclick","onmouseover","onfocus","onblur","onchange"],ALLOW_DATA_ATTR:!1,ALLOWED_URI_REGEXP:At,CUSTOM_ELEMENT_HANDLING:vt};let Lt={allow:void 0,allowedOrigins:[],sandbox:"allow-scripts allow-same-origin allow-popups"},Ot=Lt;const Dt=e=>e?{allow:void 0!==e.allow?e.allow:Lt.allow,allowedOrigins:void 0!==e.allowedOrigins?e.allowedOrigins:Lt.allowedOrigins,sandbox:void 0!==e.sandbox?e.sandbox:Lt.sandbox}:Lt,Rt=(e,t=Ot)=>{const r=Ct(e);let n;try{n=new URL(r,window.location.href)}catch(e){return!1}if(n.origin===window.location.origin&&"null"!==n.origin)return!0;var o;if(!0!==("https:"===n.protocol||"http:"===n.protocol&&("localhost"===(o=n.hostname)||"127.0.0.1"===o||"[::1]"===o||o.endsWith(".localhost"))))return!1;const s=t.allowedOrigins;return!Array.isArray(s)||0===s.length||s.some(e=>{try{return new URL(e).origin===n.origin}catch(e){return!1}})};let Ht=!1;const wt=["richtext","authoring","development"],Vt=()=>{const e=it?.mode;if(wt.includes(e))return"richtext";if("app"===e)return"app";try{if("undefined"!=typeof process&&"development"===process?.env?.NODE_ENV)return"richtext"}catch(e){}return"app"},Pt=e=>{const t="richtext"===e?It:St,r=((e,t=Ot)=>void 0===t.allow?"richtext"===e:!0===t.allow)(e);return"richtext"===e&&!0!==r?{...t,ALLOWED_TAGS:t.ALLOWED_TAGS.filter(e=>"iframe"!==e),ADD_TAGS:t.ADD_TAGS.filter(e=>"iframe"!==e),FORBID_TAGS:[...t.FORBID_TAGS,"iframe"]}:"app"===e&&!0===r?{...t,FORBID_TAGS:t.FORBID_TAGS.filter(e=>"iframe"!==e),ADD_TAGS:["iframe"],ADD_ATTR:["sandbox"]}:t};function Ut(e="app"){const t=Pt(e);return e=>We.sanitize(e,t)}const Mt=(e={})=>{if(mt)return void Nt("sanitizeData is already configured. Reconfiguration is not allowed.");const{strict:t=!1,disableSanitize:r=!1,iframes:n,customElements:o}=e;Tt=!0===r,void 0!==o&&bt(o),n&&"object"==typeof n&&(Lt=Dt(n),Ot=Lt),Tt?console.warn("SPYNE SECURITY WARNING: All data sanitization is DISABLED via config.disableSanitize. Do not use this setting in production."):Ht||(Ht=!0,We.addHook("afterSanitizeAttributes",e=>{if(!e||"IFRAME"!==e.tagName)return;const t=e.getAttribute("src")||"";""!==t&&!0!==Rt(t)&&(Nt(`SPYNE WARNING: iframe src "${t}" was removed by the iframe policy (same-origin, https, or an allowed origin is required).`),e.removeAttribute("src"));const{sandbox:r}=Ot;!1!==r&&!0!==e.hasAttribute("sandbox")&&e.setAttribute("sandbox",r)}));const s=e=>{const t=Ut(e),r=e=>{if(Array.isArray(e))return e.map(r);if(e&&"object"==typeof e){const n={};for(const[o,s]of Object.entries(e))n[o]="string"==typeof s?t(s):r(s);return n}return"string"==typeof e?t(e):e};return r};ft=(e,r={})=>{const{disableSanitize:n=!1,mode:o,iframes:i}=r;if(Tt||n)return e;const a=o||(t?"app":Vt());Ot=Dt(i);try{return s(a)(e)}finally{Ot=Lt}},Mt.sanitizeDataForce=(e,t)=>{if(Tt)return e;const r=t||Vt();return s(r)(e)},mt=!0},Wt=(e,t={})=>{if(!mt)throw new Error("sanitizeData is not configured. Call sanitizeDataConfigure() first.");return ft(e,t)},xt=["href","src","action","formaction","ping","poster","cite","codebase","manifest","icon","background"],Ft=(e,t,r)=>{if(Tt)return{allowed:!0,value:t};const n=String(e).toLowerCase(),o=String(r||"").toUpperCase();if(n.startsWith("on"))return{allowed:!1,value:t};if("srcdoc"===n){const e=Pt(Vt());return{allowed:!0,value:We.sanitize(String(t),e)}}return"IFRAME"===o&&"src"===n?{allowed:Rt(t,Lt),value:t}:xt.includes(n)&&!0!==(s=t,At.test(Ct(s)))?{allowed:!1,value:t}:{allowed:!0,value:t};var s},$t=(e,t)=>{if(!e||Tt)return;const r=Ut(t||Vt()),n=/<(?:script|object|embed|form|input|button|link|meta)[^>]*>|on\w+=|javascript:/i;if("string"==typeof e.value&&n.test(e.value)){const t=r(e.value);t!==e.value&&(e.value=t)}if(e.isContentEditable&&"string"==typeof e.innerHTML&&n.test(e.innerHTML)){const t=r(e.innerHTML);t!==e.innerHTML&&(e.innerHTML=t)}};let kt,Gt=!1;const jt=e=>{if(!Gt)throw new Error("sanitizeHTML is not configured. Call sanitizeHTMLConfigure() with appropriate config.");return kt(e)};class zt{constructor(e,t={},r={}){if(this.template=this.formatTemplate(e),this.isProxyData=!0===t.__cms__isProxy,this.testMode=r?.testMode,this.template=zt.normalizeTripleBrackets(this.template),!0===this.isProxyData){const e=!0===it.enableCMSProxies?it.formatTemplateForProxyData:zt.formatTemplateForProxyData;"function"==typeof e&&(this.template=e(this.template))}(()=>{!0===y(Array,t)&&(t={spyneData:t},this.template=this.template.replace("{{/}}","{{/spyneData}}"),this.template=this.template.replace("{{#}}","{{#spyneData}}"))})(),this.templateData=t,this.currentOuterLoopData=null;const n=zt.getStringArray(this.template);let o=this.template.match(zt.findTmplLoopsRE());o=null===o?[]:o;const s=zt.parseTmplLoopsRE(),i=this.parseTheTmplLoop.bind(this),a=X(I,o),c=H(a,e=>e.replace(s,i),this.addParams.bind(this));this.finalArr=n.map(c)}static isPrimitiveTag(e){return/({{\.\*?}})/.test(e)}static normalizeTripleBrackets(e){return"string"!=typeof e||-1===e.indexOf("{{{")?e:e.replace(/\{\{\{([^{}]+?)\}\}\}/g,"{{$1}}")}static getNestedDataReducer(e={},t=""){return/(\.)/gm.test(String(t))?String(t).split(".").reduce((e,t)=>e[t]?e[t]:"string"==typeof e?e:"",e):e[t]??""}static getStringArray(e){const t=e.split(zt.findTmplLoopsRE()),r=/^([\\n\s\W]+)$/,n=t.filter((e,t)=>!(t>=2&&(t-2)%3==0));return m(e=>e.match(r),n)}static findTmplLoopsRE(){return/({{#([\w.]+)}}[\w\n\s\W]+?{{\/\2}})/gm}static parseTmplLoopsRE(){return/({{#([\w.]+)}})([\w\n\s\W]+?)({{\/\2}})/gm}static innerLoopRE(){return/({{#([\w.]+)}})([\w\n\s\W]+?)({{\/\2}})/gm}static swapParamsForTagsRE(){return/({{)(.*?)(}})/gm}static hasLoop(e){return zt.innerLoopRE().test(e)}removeThis(){void 0!==this&&(this.finalArr=void 0,this.templateData=void 0,this.template=void 0)}renderDocFrag(){let e=zt.replaceImgPath(this.finalArr.join(""));!0!==this.testMode&&(e=jt(e));const t=/^([^>]*?)(<){1}(\b)(thead|col|colgroup|tbody|td|tfoot|tr|th)(\b)([^\0]*)$/.test(e)?e:document.createRange().createContextualFragment(e);return window.setTimeout(this.removeThis,2),t}renderToString(){let e=this.finalArr.join("");return e=zt.replaceImgPath(e),!0!==this.testMode&&(e=String(jt(e))),window.setTimeout(this.removeThis,2),e}getTemplateString(){return this.finalArr.join("")}formatTemplate(e){return!0===["SCRIPT","TEMPLATE"].includes(b("nodeName",e))?e.innerHTML:e}getDataValFromPathStr(e,t){const r=String(e).split(".");return K(r,t)||""}addParams(e){return e.replace(zt.swapParamsForTagsRE(),(e,t,r,n)=>zt.getNestedDataReducer(this.templateData,r))}static replaceImgPath(e){const{IMG_PATH:t}=it;return void 0!==t?(e=e.replaceAll(/src\s*=\s*(['"])imgs\//g,`src=$1${t}`)).replaceAll(/url\(\s*(['"]?)imgs\//g,`url($1${t}`):e}processInnerLoop(e,t){const r=zt.innerLoopRE();return e.replace(r,(e,r,n,o)=>{!0===zt.hasLoop(o)&&(!0===it.debug&&!0!==this.testMode&&console.warn(`Spyne Warning: DomElementTemplate supports one level of nested array loops. A deeper nested loop was detected inside "{{#${n}}}". Consider restructuring via nested ViewStreams instead.`),o=o.replace(/{{[#/][\w.]+}}/g,""));const s=zt.getNestedDataReducer(t,n);if(!0===_(s)||E(s))return"";const i=Array.isArray(s)?s:[s],a=this.currentOuterLoopData;this.currentOuterLoopData=s;const c=i.map((e,t)=>this.substituteForItem(o,e,t)).join("");return this.currentOuterLoopData=a,c})}substituteForItem(e,t,r){if("string"==typeof t){if(zt.isPrimitiveTag(e)){const r=t.replace(/\$/g,"$$$$");return e.replace(zt.swapParamsForTagsRE(),r)}const n=this.buildStringItemContext(t,r);return this.substituteObject(e,n)}const n=this.buildItemContext(t,r);return this.substituteObject(e,n)}buildStringItemContext(e,t){const r={spyneLoopKey:e,loopIndex:t,loopNum:t+1};if(!0===this.isProxyData){const t=this.currentOuterLoopData;if(t&&"object"==typeof t){r.__cms__dataId=t.__cms__dataId||"";const n=`__cms__keyFor_${e}`;r.origKey=void 0!==t[n]?t[n]:""}else r.__cms__dataId="",r.origKey=""}return r}buildItemContext(e,t){const r=Object.assign({},e,{loopIndex:t,loopNum:t+1});return!0===this.isProxyData&&(r.__cms__dataId=e.__cms__dataId,r.spyneLoopKey=e,r.loopIndex=t,r.loopNum=t+1),r}substituteObject(e,t){const r=/(\.)/gm,n={loopIndex:t.loopIndex,loopNum:t.loopNum};return e.replace(zt.swapParamsForTagsRE(),(e,o,s)=>void 0!==n[s]?n[s]:!1===r.test(s)&&void 0!==t[s]?t[s]:this.getDataValFromPathStr(s,t))}parseTheTmplLoop(e,t,r,n){const o=n,s=zt.getNestedDataReducer(this.templateData,r);if(!0===_(s)||E(s))return"";const i=this.currentOuterLoopData;this.currentOuterLoopData=s;const a=Array.isArray(s)?s:[s],c=zt.hasLoop(o),l=a.map((e,t)=>{const r=c?this.processInnerLoop(o,e):o;return this.substituteForItem(r,e,t)}).join("");return this.currentOuterLoopData=i,l}}class Bt{constructor(e={},t=!1){var r,n;e.tagName=(r="div",n=e.tagName,k(r)(n)),e.attributes=void 0!==e.attributes?e.attributes:this.getDomAttributes(e),e.attrs=this.updateAttrs(e.attributes),e.fragment=document.createDocumentFragment(),this.testMode=t,this.props=e,this.addMixins()}setProp(e,t){this.props[e]=t}getProp(e){return this.props[e]}get el(){return this.props.el}setElAttrs(e,t){const r=!0===this.testMode;return this.getProp("attrs").forEach((t,n)=>{const o=(t,r)=>{e.dataset[r]=t};if("dataset"!==n){if(!0!==r){const{allowed:r,value:o}=Ft(n,t,e.tagName);if(!0!==r)return void Nt(`SPYNE WARNING: The attribute "${n}" was removed during sanitization.`,e);t=o}e.setAttribute(n,t)}else de(o,t)}),!0!==r&&(e=>{if(Tt||!e||"IFRAME"!==e.tagName)return e;const{sandbox:t}=Lt;!1!==t&&!0!==e.hasAttribute("sandbox")&&e.setAttribute("sandbox",t)})(e),e}updateAttrs(e,t){const r=void 0!==t?t:new Map;return ce((e,t)=>r.set(t,e),e),r}addTemplate(e){const t=this.getProp("template");return void 0!==t?(t=>{let r=this.getProp("data");r=y(Object,r)?r:{};const n=new zt(t,r,{testMode:this?.testMode}).renderDocFrag();return y(String,n)?e.innerHTML=n:e.appendChild(n),e})(t):e}createElement(e="div"){return document.createElement(e)}addContent(e){const t=this.getProp("data");if(!0===y(String,t)){const r=document.createTextNode(t);e.appendChild(r)}return e}execute(){const e=le(this.createElement.bind(this),this.setElAttrs.bind(this),this.addTemplate.bind(this),this.addContent.bind(this))(this.getProp("tagName"));this.props.el=e}render(){return this.execute(),this.props.template=void 0,this.props.data=void 0,this.props.attributes=void 0,this.getProp("el")}renderToHTMLString(){return this.execute(),this.props.template=void 0,this.props.data=void 0,this.props.attributes=void 0,this.getProp("el").outerHTML}returnIfDefined(e,t){if(void 0!==t){const r=void 0===t;e[t]=!1===r?t:Ye(e[t],t)}}updateprops(e){return this.returnIfDefined(this.props,e),this}updatepropsAndRun(e){return this.updateprops(e),this.execute(),this.getProp("fragment")}unmount(){void 0!==this.props&&(this.getProp("el").remove(),this.props=void 0,this.gc())}updateTag(e="div"){this.updateprops(e)}updateAttributes(e={}){this.updateprops(e)}updateTemplate(e){this.updateprops(e)}updateData(e={}){this.updateprops(e)}addTagAndRender(e="div"){this.updatepropsAndRun(e)}addAttrsibutesAndRender(e={}){this.updatepropsAndRun(e)}addTemplateAndRender(e){this.updatepropsAndRun(e)}addDataAndRender(e={}){this.updatepropsAndRun(e)}addMixins(){const e=ut();this.gc=e.gc.bind(this)}getDomAttributes(e){return ee(this.attributesArray,e)}get attributesArray(){return["accept","accept-charset","accesskey","action","align","allow","alt","async","autocapitalize","autocomplete","autofocus","autoplay","bgcolor","border","buffered","challenge","charset","checked","cite","class","code","codebase","color","cols","colspan","content","contenteditable","contextmenu","controls","coords","crossorigin","csp","dataset","datetime","decoding","default","defer","dir","dirname","disabled","download","draggable","dropzone","enctype","for","form","formaction","headers","height","hidden","high","href","hreflang","http-equiv","icon","id","importance","integrity","ismap","itemprop","keytype","kind","label","lang","language","lazyload","list","loop","low","manifest","max","maxlength","minlength","media","method","min","multiple","muted","name","novalidate","open","optimum","pattern","ping","placeholder","poster","preload","radiogroup","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","sandbox","scope","scoped","selected","shape","size","sizes","slot","span","spellcheck","src","srcdoc","srclang","srcset","start","step","style","summary","tabindex","target","title","translate","type","usemap","value","width","wrap"]}}const Yt=(e=!1,t=1,r="ease",n=!1)=>`${!0===n?"opacity:0;":""}transition: opacity ${t}s ${r}; opacity: ${!0===e?1:0};`;function Kt(e){return"function"==typeof e}function qt(e){return function(t){if(function(e){return Kt(null==e?void 0:e.lift)}(t))return t.lift(function(t){try{return e(t,this)}catch(e){this.error(e)}});throw new TypeError("Unable to lift unknown Observable type")}}var Qt=function(e,t){return Qt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},Qt(e,t)};function Xt(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}Qt(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function Jt(e,t,r,n){return new(r||(r=Promise))(function(o,s){function i(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(i,a)}c((n=n.apply(e,t||[])).next())})}function Zt(e,t){var r,n,o,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=a(0),i.throw=a(1),i.return=a(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function er(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function tr(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,s=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=s.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return i}function rr(e,t,r){if(r||2===arguments.length)for(var n,o=0,s=t.length;o<s;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}function nr(e){return this instanceof nr?(this.v=e,this):new nr(e)}function or(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,o=r.apply(e,t||[]),s=[];return n=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),i("next"),i("throw"),i("return",function(e){return function(t){return Promise.resolve(t).then(e,l)}}),n[Symbol.asyncIterator]=function(){return this},n;function i(e,t){o[e]&&(n[e]=function(t){return new Promise(function(r,n){s.push([e,t,r,n])>1||a(e,t)})},t&&(n[e]=t(n[e])))}function a(e,t){try{(r=o[e](t)).value instanceof nr?Promise.resolve(r.value.v).then(c,l):d(s[0][2],r)}catch(e){d(s[0][3],e)}var r}function c(e){a("next",e)}function l(e){a("throw",e)}function d(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}}function sr(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=er(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise(function(n,o){(function(e,t,r,n){Promise.resolve(n).then(function(t){e({value:t,done:r})},t)})(n,o,(t=e[r](t)).done,t.value)})}}}"function"==typeof SuppressedError&&SuppressedError;var ir=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function ar(e){return Kt(null==e?void 0:e.then)}function cr(e){var t=e(function(e){Error.call(e),e.stack=(new Error).stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var lr=cr(function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map(function(e,t){return t+1+") "+e.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}});function dr(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var ur=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,r,n,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var i=er(s),a=i.next();!a.done;a=i.next()){a.value.remove(this)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}else s.remove(this);var c=this.initialTeardown;if(Kt(c))try{c()}catch(e){o=e instanceof lr?e.errors:[e]}var l=this._finalizers;if(l){this._finalizers=null;try{for(var d=er(l),u=d.next();!u.done;u=d.next()){var h=u.value;try{pr(h)}catch(e){o=null!=o?o:[],e instanceof lr?o=rr(rr([],tr(o)),tr(e.errors)):o.push(e)}}}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=d.return)&&n.call(d)}finally{if(r)throw r.error}}}if(o)throw new lr(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)pr(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&dr(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&dr(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}(),hr=ur.EMPTY;function Er(e){return e instanceof ur||e&&"closed"in e&&Kt(e.remove)&&Kt(e.add)&&Kt(e.unsubscribe)}function pr(e){Kt(e)?e():e.unsubscribe()}var Nr={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},_r={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=_r.delegate;return(null==o?void 0:o.setTimeout)?o.setTimeout.apply(o,rr([e,t],tr(r))):setTimeout.apply(void 0,rr([e,t],tr(r)))},clearTimeout:function(e){var t=_r.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function fr(e){_r.setTimeout(function(){throw e})}function mr(){}var Tr=Ar("C",void 0,void 0);function Ar(e,t,r){return{kind:e,value:t,error:r}}function Cr(e){e()}var yr=function(e){function t(t){var r=e.call(this)||this;return r.isStopped=!1,t?(r.destination=t,Er(t)&&t.add(r)):r.destination=Or,r}return Xt(t,e),t.create=function(e,t,r){return new Ir(e,t,r)},t.prototype.next=function(e){this.isStopped?Lr(function(e){return Ar("N",e,void 0)}(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?Lr(Ar("E",void 0,e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?Lr(Tr,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(ur),gr=Function.prototype.bind;function br(e,t){return gr.call(e,t)}var vr=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){Sr(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){Sr(e)}else Sr(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){Sr(e)}},e}(),Ir=function(e){function t(t,r,n){var o,s,i=e.call(this)||this;Kt(t)||!t?o={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:i&&Nr.useDeprecatedNextContext?((s=Object.create(t)).unsubscribe=function(){return i.unsubscribe()},o={next:t.next&&br(t.next,s),error:t.error&&br(t.error,s),complete:t.complete&&br(t.complete,s)}):o=t;return i.destination=new vr(o),i}return Xt(t,e),t}(yr);function Sr(e){fr(e)}function Lr(e,t){var r=Nr.onStoppedNotification;r&&_r.setTimeout(function(){return r(e,t)})}var Or={closed:!0,next:mr,error:function(e){throw e},complete:mr},Dr="function"==typeof Symbol&&Symbol.observable||"@@observable";function Rr(e){return e}function Hr(e){return 0===e.length?Rr:1===e.length?e[0]:function(t){return e.reduce(function(e,t){return t(e)},t)}}var wr=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var n,o=this,s=(n=e)&&n instanceof yr||function(e){return e&&Kt(e.next)&&Kt(e.error)&&Kt(e.complete)}(n)&&Er(n)?e:new Ir(e,t,r);return Cr(function(){var e=o,t=e.operator,r=e.source;s.add(t?t.call(s,r):r?o._subscribe(s):o._trySubscribe(s))}),s},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=Vr(t))(function(t,n){var o=new Ir({next:function(t){try{e(t)}catch(e){n(e),o.unsubscribe()}},error:n,complete:t});r.subscribe(o)})},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[Dr]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Hr(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=Vr(e))(function(e,r){var n;t.subscribe(function(e){return n=e},function(e){return r(e)},function(){return e(n)})})},e.create=function(t){return new e(t)},e}();function Vr(e){var t;return null!==(t=null!=e?e:Nr.Promise)&&void 0!==t?t:Promise}function Pr(e){return Kt(e[Dr])}function Ur(e){return Symbol.asyncIterator&&Kt(null==e?void 0:e[Symbol.asyncIterator])}function Mr(e){return new TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var Wr="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function xr(e){return Kt(null==e?void 0:e[Wr])}function Fr(e){return or(this,arguments,function(){var t,r,n;return Zt(this,function(o){switch(o.label){case 0:t=e.getReader(),o.label=1;case 1:o.trys.push([1,,9,10]),o.label=2;case 2:return[4,nr(t.read())];case 3:return r=o.sent(),n=r.value,r.done?[4,nr(void 0)]:[3,5];case 4:return[2,o.sent()];case 5:return[4,nr(n)];case 6:return[4,o.sent()];case 7:return o.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function $r(e){return Kt(null==e?void 0:e.getReader)}function kr(e){if(e instanceof wr)return e;if(null!=e){if(Pr(e))return o=e,new wr(function(e){var t=o[Dr]();if(Kt(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")});if(ir(e))return n=e,new wr(function(e){for(var t=0;t<n.length&&!e.closed;t++)e.next(n[t]);e.complete()});if(ar(e))return r=e,new wr(function(e){r.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,fr)});if(Ur(e))return Gr(e);if(xr(e))return t=e,new wr(function(e){var r,n;try{for(var o=er(t),s=o.next();!s.done;s=o.next()){var i=s.value;if(e.next(i),e.closed)return}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}e.complete()});if($r(e))return Gr(Fr(e))}var t,r,n,o;throw Mr(e)}function Gr(e){return new wr(function(t){(function(e,t){var r,n,o,s;return Jt(this,void 0,void 0,function(){var i,a;return Zt(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),r=sr(e),c.label=1;case 1:return[4,r.next()];case 2:if((n=c.sent()).done)return[3,4];if(i=n.value,t.next(i),t.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),o={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),n&&!n.done&&(s=r.return)?[4,s.call(r)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})})(e,t).catch(function(e){return t.error(e)})})}function jr(e,t,r,n,o){return new zr(e,t,r,n,o)}var zr=function(e){function t(t,r,n,o,s,i){var a=e.call(this,t)||this;return a.onFinalize=s,a.shouldUnsubscribe=i,a._next=r?function(e){try{r(e)}catch(e){t.error(e)}}:e.prototype._next,a._error=o?function(e){try{o(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,a._complete=n?function(){try{n()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,a}return Xt(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(yr),Br=function(e){function t(t,r){return e.call(this)||this}return Xt(t,e),t.prototype.schedule=function(e,t){return this},t}(ur),Yr={setInterval:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=Yr.delegate;return(null==o?void 0:o.setInterval)?o.setInterval.apply(o,rr([e,t],tr(r))):setInterval.apply(void 0,rr([e,t],tr(r)))},clearInterval:function(e){var t=Yr.delegate;return((null==t?void 0:t.clearInterval)||clearInterval)(e)},delegate:void 0},Kr=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n.pending=!1,n}return Xt(t,e),t.prototype.schedule=function(e,t){var r;if(void 0===t&&(t=0),this.closed)return this;this.state=e;var n=this.id,o=this.scheduler;return null!=n&&(this.id=this.recycleAsyncId(o,n,t)),this.pending=!0,this.delay=t,this.id=null!==(r=this.id)&&void 0!==r?r:this.requestAsyncId(o,this.id,t),this},t.prototype.requestAsyncId=function(e,t,r){return void 0===r&&(r=0),Yr.setInterval(e.flush.bind(e,this),r)},t.prototype.recycleAsyncId=function(e,t,r){if(void 0===r&&(r=0),null!=r&&this.delay===r&&!1===this.pending)return t;null!=t&&Yr.clearInterval(t)},t.prototype.execute=function(e,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(e,t);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,t){var r,n=!1;try{this.work(e)}catch(e){n=!0,r=e||new Error("Scheduled action threw falsy error")}if(n)return this.unsubscribe(),r},t.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,r=this.scheduler,n=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,dr(n,this),null!=t&&(this.id=this.recycleAsyncId(r,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(Br),qr={now:function(){return(qr.delegate||Date).now()},delegate:void 0},Qr=function(){function e(t,r){void 0===r&&(r=e.now),this.schedulerActionCtor=t,this.now=r}return e.prototype.schedule=function(e,t,r){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(r,t)},e.now=qr.now,e}(),Xr=new(function(e){function t(t,r){void 0===r&&(r=Qr.now);var n=e.call(this,t,r)||this;return n.actions=[],n._active=!1,n}return Xt(t,e),t.prototype.flush=function(e){var t=this.actions;if(this._active)t.push(e);else{var r;this._active=!0;do{if(r=e.execute(e.state,e.delay))break}while(e=t.shift());if(this._active=!1,r){for(;e=t.shift();)e.unsubscribe();throw r}}},t}(Qr))(Kr);function Jr(e,t,r,n,o){void 0===n&&(n=0),void 0===o&&(o=!1);var s=t.schedule(function(){r(),o?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(s),!o)return s}function Zr(e){return qt(function(t,r){var n,o=null,s=!1;o=t.subscribe(jr(r,void 0,void 0,function(i){n=kr(e(i,Zr(e)(t))),o?(o.unsubscribe(),o=null,n.subscribe(r)):s=!0})),s&&(o.unsubscribe(),o=null,n.subscribe(r))})}function en(e,t){return void 0===t&&(t=0),qt(function(r,n){r.subscribe(jr(n,function(r){return Jr(n,e,function(){return n.next(r)},t)},function(){return Jr(n,e,function(){return n.complete()},t)},function(r){return Jr(n,e,function(){return n.error(r)},t)}))})}function tn(e,t){return void 0===t&&(t=0),qt(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function rn(e,t){if(!e)throw new Error("Iterable cannot be null");return new wr(function(r){Jr(r,t,function(){var n=e[Symbol.asyncIterator]();Jr(r,t,function(){n.next().then(function(e){e.done?r.complete():r.next(e.value)})},0,!0)})})}function nn(e,t){if(null!=e){if(Pr(e))return function(e,t){return kr(e).pipe(tn(t),en(t))}(e,t);if(ir(e))return function(e,t){return new wr(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}(e,t);if(ar(e))return function(e,t){return kr(e).pipe(tn(t),en(t))}(e,t);if(Ur(e))return rn(e,t);if(xr(e))return function(e,t){return new wr(function(r){var n;return Jr(r,t,function(){n=e[Wr](),Jr(r,t,function(){var e,t,o;try{t=(e=n.next()).value,o=e.done}catch(e){return void r.error(e)}o?r.complete():r.next(t)},0,!0)}),function(){return Kt(null==n?void 0:n.return)&&n.return()}})}(e,t);if($r(e))return function(e,t){return rn(Fr(e),t)}(e,t)}throw Mr(e)}function on(e,t){return qt(function(r,n){var o=0;r.subscribe(jr(n,function(r){n.next(e.call(t,r,o++))}))})}var sn=Array.isArray;function an(e){return on(function(t){return function(e,t){return sn(t)?e.apply(void 0,rr([],tr(t))):e(t)}(e,t)})}function cn(e,t,r){return void 0===r&&(r=Rr),function(n){ln(t,function(){for(var o=e.length,s=new Array(o),i=o,a=o,c=function(o){ln(t,function(){var c=function(e,t){return t?nn(e,t):kr(e)}(e[o],t),l=!1;c.subscribe(jr(n,function(e){s[o]=e,l||(l=!0,a--),a||n.next(r(s.slice()))},function(){--i||n.complete()}))},n)},l=0;l<o;l++)c(l)},n)}}function ln(e,t,r){e?Jr(r,e,t):t()}function dn(e,t,r){return void 0===r&&(r=1/0),Kt(t)?dn(function(r,n){return on(function(e,o){return t(r,e,n,o)})(kr(e(r,n)))},r):("number"==typeof t&&(r=t),qt(function(t,n){return function(e,t,r,n,o,s,i,a){var c=[],l=0,d=0,u=!1,h=function(){!u||c.length||l||t.complete()},E=function(e){return l<n?p(e):c.push(e)},p=function(e){s&&t.next(e),l++;var a=!1;kr(r(e,d++)).subscribe(jr(t,function(e){null==o||o(e),s?E(e):t.next(e)},function(){a=!0},void 0,function(){if(a)try{l--;for(var e=function(){var e=c.shift();i?Jr(t,i,function(){return p(e)}):p(e)};c.length&&l<n;)e();h()}catch(e){t.error(e)}}))};return e.subscribe(jr(t,E,function(){u=!0,h()})),function(){null==a||a()}}(t,n,e,r)}))}var un=Array.isArray;function hn(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=function(e){return Kt((t=e)[t.length-1])?e.pop():void 0;var t}(e);return r?function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Hr(e)}(hn.apply(void 0,rr([],tr(e))),an(r)):qt(function(t,r){cn(rr([t],tr(function(e){return 1===e.length&&un(e[0])?e[0]:e}(e))))(r)})}var En=cr(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),pn=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return Xt(t,e),t.prototype.lift=function(e){var t=new Nn(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new En},t.prototype.next=function(e){var t=this;Cr(function(){var r,n;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var o=er(t.currentObservers),s=o.next();!s.done;s=o.next()){s.value.next(e)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}})},t.prototype.error=function(e){var t=this;Cr(function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var r=t.observers;r.length;)r.shift().error(e)}})},t.prototype.complete=function(){var e=this;Cr(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,r=this,n=r.hasError,o=r.isStopped,s=r.observers;return n||o?hr:(this.currentObservers=null,s.push(e),new ur(function(){t.currentObservers=null,dr(s,e)}))},t.prototype._checkFinalizedStatuses=function(e){var t=this,r=t.hasError,n=t.thrownError,o=t.isStopped;r?e.error(n):o&&e.complete()},t.prototype.asObservable=function(){var e=new wr;return e.source=this,e},t.create=function(e,t){return new Nn(e,t)},t}(wr),Nn=function(e){function t(t,r){var n=e.call(this)||this;return n.destination=t,n.source=r,n}return Xt(t,e),t.prototype.next=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===r||r.call(t,e)},t.prototype.error=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===r||r.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,r;return null!==(r=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==r?r:hr},t}(pn);function _n(e,t){return void 0===t&&(t=Xr),qt(function(r,n){var o=null,s=null,i=null,a=function(){if(o){o.unsubscribe(),o=null;var e=s;s=null,n.next(e)}};function c(){var r=i+e,s=t.now();if(s<r)return o=this.schedule(void 0,r-s),void n.add(o);a()}r.subscribe(jr(n,function(r){s=r,i=t.now(),o||(o=t.schedule(c,e),n.add(o))},function(){a(),n.complete()},void 0,function(){s=o=null}))})}var fn=new wr(function(e){return e.complete()});function mn(e){return e<=0?function(){return fn}:qt(function(t,r){var n=0;t.subscribe(jr(r,function(t){++n<=e&&(r.next(t),e<=n&&r.complete())}))})}function Tn(e,t){return qt(function(r,n){var o=0;r.subscribe(jr(n,function(r){return e.call(t,r,o++)&&n.next(r)}))})}function An(e){return qt(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}function Cn(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];if(!0!==t){if(!1!==t){var o=new Ir({next:function(){o.unsubscribe(),e()}});return kr(t.apply(void 0,rr([],tr(r)))).subscribe(o)}}else e()}function yn(e,t){return void 0===t&&(t=!1),qt(function(r,n){var o=0;r.subscribe(jr(n,function(r){var s=e(r,o++);(s||t)&&n.next(r),!s&&n.complete()}))})}function gn(e,t,r){var n=Kt(e)||t||r?{next:e,error:t,complete:r}:e;return n?qt(function(e,t){var r;null===(r=n.subscribe)||void 0===r||r.call(n);var o=!0;e.subscribe(jr(t,function(e){var r;null===(r=n.next)||void 0===r||r.call(n,e),t.next(e)},function(){var e;o=!1,null===(e=n.complete)||void 0===e||e.call(n),t.complete()},function(e){var r;o=!1,null===(r=n.error)||void 0===r||r.call(n,e),t.error(e)},function(){var e,t;o&&(null===(e=n.unsubscribe)||void 0===e||e.call(n)),null===(t=n.finalize)||void 0===t||t.call(n)}))}):Rr}class bn{constructor(e){this.props.observableStreams=bn.createDirectionalObservables()}static createDirectionalFiltersObject(){const e="internal",t="parent",r="child";return{P:[t],C:[r],PCI:[t,e,r],CI:[r,e],PI:[t,e],PC:[t,r]}}static addDefaultDir(e){return ue(J)({$dir:["internal"]},re(e))}static addDownInternalDir(e,t=["internal","down"]){return ue(J)(re(e),{$dir:t})}static addChildAndInternalDir(e,t=["child","down"]){return ue(J)(re(e),{$dir:t})}static mapToDefaultDir(e){return this.addDefaultDir(e)}static createDirectionalObservables(e=new r,t,n){void 0!==t&&void 0!==n&&(e.viewName=t,e.vsid=n);const o=e=>he(t=>t.includes(e),"$dir"),s=o("parent"),i=o("child"),a=o("internal"),c=e=>J({from$:e}),l=c("child"),d=c("internal"),u=c("parent"),h=e.pipe(Tn(e=>void 0!==e&&void 0!==e.action)),E=e.pipe(Tn(a),on(d)),p=e.pipe(Tn(s),on(l)),N=e.pipe(Tn(i),on(u)),_={parent:p,internal:E,child:N};return{raw$:h,toInternal$:E,toParent$:p,toChild$:N,completeAll:()=>{Ee(e=>{e.complete(),e.isStopped=!0},[h,E,p,N])},completeStream:(e=[])=>{const t=e=>{if(void 0!==_[e]){(t=_[e]).complete(),t.isStopped=!0}var t};void 0!==e&&e.length>=1&&e.forEach(t)}}}}class vn{constructor(e,t={},n="",o="theName"){this.addMixins(),this._state="INIT",this.vsid=n,this.el=t.el,this.vsName=o,this.defaults={debug:!1,extendedHashMethods:{}},this.options=Ye(this.defaults,t);this.addActionListeners().forEach(e=>{const[t,r]=e;this.options.extendedHashMethods[t]=e=>this[r](e)}),this.options.hashMethods=this.setHashMethods(this.options.extendedHashMethods),this.sink$=e,this.sink$.subscribe(this.onObsSinkSubscribe.bind(this)),this.$dirs=bn.createDirectionalFiltersObject(),this.addDefaultDir=bn.addDefaultDir,this.sourceStreams=bn.createDirectionalObservables(new r,this.vsName,this.vsid),this._source$=this.sourceStreams.toInternal$}addActionListeners(){return[]}setHashMethods(e={}){return Ye({VS_DETRITUS_COLLECT:e=>this.onGarbageCollect(e),READY_FOR_VS_DETRITUS_COLLECT:e=>this.onReadyForGC(e),EXTIRPATE:e=>this.onDispose(e),VS_SPAWN:e=>this.onRender(e),VS_SPAWN_AND_ATTACH_TO_PARENT:e=>this.onRenderAndAttachToParent(e),VS_SPAWN_AND_ATTACH_TO_DOM:e=>this.onRenderAndAttachToDom(e),ATTACH_CHILD_TO_SELF:e=>this.onAttachChildToSelf(e)},e)}createDomItem(){this.props=void 0!==this.props?this.props:{};const e=F(e=>void 0!==e,ee(["id","className"],this.props)),{tagName:t,data:r,template:n}=this.props;return new Bt(t,e,r,n)}onDisposeCompleted(e){}animateInTween(e,t){!function(e,t){const r=1*window.getComputedStyle(e).opacity,n=Yt(!0,t,"ease",1===r);e.style.cssText+=n}(e,t)}animateOutTween(e,t,r){!function(e,t,r){const n=Yt(!1,t,"ease");e.style.cssText+=n,e.addEventListener("transitionend",r,!1)}(e,t,r)}setAnimateIn(e){if(!0===e.animateIn){const t=void 0!==e.el?e.el:this.domItem.el;this.animateInTween(t,e.animateInTime)}}disposeMethod(e){const t=void 0!==e.el.el?e.el.el:e.el,r={action:"READY_FOR_VS_DETRITUS_COLLECT",$dir:this.$dirs.PI,el:t},o=n((e,r)=>{this.animateOutTween(t,e.animateOutTime,r)}),s=e=>{this._source$.next(r)},i=!0===e.animateOut?e=>(o(e).subscribe(s),{action:"EXTIRPATING",$dir:this.$dirs.CI}):()=>({action:"EXTIRPATE_AND_READY_FOR_VS_DETRITUS_COLLECT",$dir:this.$dirs.CI});return i(e)}onDispose(e){return this.disposeMethod(e)}removeStream(){void 0!==this.sourceStreams&&this.sourceStreams.completeStream(["internal","child"])}onReadyForGC(e){this.removeStream()}onGarbageCollect(e){void 0!==this.domItem&&this.domItem.unmount(),void 0!==this.sourceStreams&&this.sourceStreams.completeStream(["parent"])}getSourceStream(){return this._source$}combineDomItems(e){if(void 0!==this.el)return;const t=_(e.query)?e.node:e.query,r=(e,t)=>e.insertBefore(t,e.firstChild);({appendChild:(e,t)=>e.appendChild(t),after:(e,t)=>e.after(t)}[e.attachType]||r)(t,this.domItem.render()),this.setAnimateIn(e)}onAttachChildToSelf(e){const t=e.childRenderData;return this.combineDomItems(t),{action:"CHILD_ATTACHED",$dir:this.$dirs.PI}}onRenderAndAttachToParent(e){return this.onRender(e),this.combineDomItems(e),{action:"VS_SPAWNED_AND_ATTACHED_TO_PARENT",el:this.el||this.domItem.el,$dir:this.$dirs.PI}}renderDomItem(e){const[t,r,n,o]=e;return this.domItem=new Bt({tagName:t,attributes:r,data:n,template:o}),this.domItem}onRender(e){return{action:"VS_SPAWNED",el:this.el||(e=>this.renderDomItem(e))(pe(["tagName","domAttributes","data","template"],e)),$dir:this.$dirs.I}}extendedMethods(e){}onRenderAndAttachToDom(e){return e.attachData.el=(e=>this.renderDomItem(e))(pe(["tagName","domAttributes","data","template"],e)),this.combineDomItems(e.attachData),{action:"VS_SPAWNED_AND_ATTACHED_TO_DOM",el:this.el||e.attachData.el.el,$dir:this.$dirs.CI}}onObsSinkSubscribe(e){const t=e.action,r=k(e=>this.extendedMethods(e)),n=r(this.options.hashMethods[t])(e);void 0!==n&&(e=>{this._source$.next(e)})(Object.freeze(n))}addMixins(){}}function In(){setTimeout(()=>{Ee(e=>{},this)},1)}class Sn{constructor(e,t,r,n="subscribe",o=!1){const s={name:e,observable:t,data:r,action:n};this.sendToDirectorStream(s)}sendToDirectorStream(e){const t=it.channelsMap.getStream("DISPATCHER"),r=lt(e);t.next(r),e=void 0}static deepClone(e){const t=y(Array),r=y(Object);var n;return!1===t(n=e)&&!0===r(n)?u(B,R,re)(e):re(e)}static getMouseEventKeys(){return["altKey","bubbles","cancelBubble","cancelable","clientX","clientY","composed","ctrlKey","currentTarget","defaultPrevented","detail","eventPhase","fromElement","isTrusted","layerX","layerY","metaKey","movementX","movementY","offsetX","offsetY","pageX","pageY","path","relatedTarget","returnValue","screenX","screenY","shiftKey","sourceCapabilities","srcElement","target","timeStamp","toElement","type","view","which","x","y"]}addMixins(){this.gc=In}}const Ln=!0===it.debug;class On{constructor(e,t){this.addMixins(),this.props=e,this.broadcastFn=t,this.broadcaster(this.broadcastFn)}addDblClickEvt(e){return o(e,"dblclick").pipe(on(e=>{const t=re(e);return t.typeOverRide="dblclick",t}))}broadcast(e){if(e.length<=0&&!0===Ln)return void console.warn(`Spyne Warning: The nested array in ${this.props.name}.broadcastEvents appears to be empty --\x3e vsid:${this.props.vsid}!`);const t={UI:this.sendUIPayload,ROUTE:this.sendRoutePayload},[r,n,s]=e;let i,a=this.props.el.querySelectorAll(r);if(a.length<=0){const e=this.props.el,t=t=>{t===e&&(a=[t])};(()=>{const n=(null!==e.parentElement?e.parentElement:document).querySelectorAll(r);n.forEach=Array.prototype.forEach,n.forEach(t)})()}const c=void 0!==s,l=e=>{const r="dblClick"!==n?o(e,n,{preventDefault:()=>!0}):this.addDblClickEvt(e);i=e.dataset.channel;const s={};s.payload=(e=>{const t={};for(const r in e)t[r]=e[r];return t})(e.dataset),s.payload=Ne(["channel"],s.payload),"ROUTE"===s.channel&&(s.payload.endPreventDefault=!0),s.channel=i,s.srcElement={},s.srcElement.id=this.props.id,s.srcElement.vsid=this.props.vsid,s.srcElement.isLocalEvent=c,s.srcElement.srcEvent=n,s.srcElement.el=e;var a;(0,t[a=i,"ROUTE"===a||"CHANNEL_ROUTE"===a?"ROUTE":("UI"!==a&&"CHANNEL_UI"!==a&&void 0!==a&&console.warn(`SpyneJS warning: The channel, ${a}, is not allowed here, only "UI" or "ROUTE" are valid channels, defaulting to CHANNEL_UI`),"UI")])(r,s)};!0===(void 0===a||a.length<=0)&&!0===Ln?console.warn(`Spyne Warning: The item ${r}, does not appear to exist in ${this.props.name} --\x3e vsid:${this.props.vsid}!`):(a.forEach=Array.prototype.forEach,a.forEach(l))}broadcaster(e){e().forEach(e=>this.broadcast(e))}addMixins(){const e={testFunc:function(e){console.log("stream mixin is ",e)},sendRoutePayload:function(e,t){return new Sn("CHANNEL_ROUTE",e,t,"subscribe")},sendUIPayload:function(e,t){return new Sn("CHANNEL_UI",e,t,"subscribe")}};this.sendUIPayload=e.sendUIPayload,this.sendRoutePayload=e.sendRoutePayload}}const Dn=u(ne,y(Array)),Rn=u(ne,E),Hn=f([y(String),Rn]),wn=f([y(Array),Rn]),Vn=u(f([Dn,y(Object)])),Pn=u(f([Rn,Dn,y(Object)]));class Un{constructor(e,t={},r,n){Vn(e)&&(e=b("selector",t=e),n=n||b("testMode",t));const o=[r,b("debugLabel",t)];r=u(C(y(String)))(o);let s=Ne(["debugLabel","label","selector","props","testMode","propFilters"],t);void 0!==t.props?s=oe([t.props,s]):void 0!==t.propFilters&&(s=oe([t.propFilters,s])),t.propFilters=s;const{propFilters:i}=t,a=Hn(e)?Un.filterSelector([e],r):void 0,c=wn(e)?Un.filterSelector(e,r):void 0,l=Pn(i)?Un.filterData(i,r):void 0;let d=m(_,[a,c,l]);const h=E(d);return h&&(d=[w(!1)],!0===it.debug&&!0!==n&&console.warn(`Spyne Warning: The Channel Filter, with selector: ${e}, and propFilters:${i} appears to be empty!`)),!0===n?{selector:e,propFilters:i,debugLabel:r,filters:t,testMode:n,filtersAreEmpty:h}:f(d)}static filterData(e,t){const r=t;return(()=>{if(E(e))return w(!1);e=D((e,t,r)=>{let n=Te;if((e=>y(String,e))(e)||(e=>y(Boolean,e))(e)||(e=>y(Number,e))(e))o=e,n=e=>e===o;else{if("function"==typeof e)return e;if((e=>y(Array,e))(e)||Vn(e))return console.warn(`ChannelPayloadFilter: Property "${e}" is an array/object, which is not allowed. This property will always return false.`),n}var o;return n},e);const t=me(e);return u(t,t=>{if(void 0===r)return t;const n={};return de((e,r)=>{n[r]=e(b(r,t))},e),console.log(`%c CHANNEL PAYLOAD FILTER DEBUGGER ["${r}"] - values: `,"color:orange;",{propsBooleans:n,comparedObj:t}),t},k({}),e=>{const{payload:t,srcElement:r,event:n}=e||{};return Object.assign({},e,r,n,t)})})()}static checkPayloadSelector(e,t,r){const{payload:n,srcElement:o,event:s}=r||{},i=[o,n,b("srcElement",s),r].reduce((e,t)=>{const r=b("el",t);return Un.elIsDomElement(r)&&void 0===e&&(e=r),e},void 0),a=e=>e.isEqualNode(i),c=e=>{const t=Array.from(document.querySelectorAll(e));return D(a,t)};if(void 0!==t){const r=u(O,D(c))(e),n=e;console.log(`%c CHANNEL PAYLOAD FILTER DEBUGGER ["${t}"] - selectors: `,"color:orange;",{el:i,selectorsArr:n,nodeArrResultsDebugger:r})}if("object"!=typeof i)return!1;const l=u(O,D(c))(e);return!0!==E(l)&&_e(T(!0),l)}static elIsDomElement(e){return y(String,e)&&(e=document.querySelector(e)),u(se(0),k(-1),b("nodeType"))(e)}static filterSelector(e,t){const r=m(E,e);return fe(Un.checkPayloadSelector)(r,t)}}function Mn(){return!0===it.debug}function Wn(e,t,r=!1){const n=Fn(e,t,r);return 1===n.length?p(n):n}function xn(e,t,r){const n=document.querySelector(e),o=u(se(0),k(-1),b("nodeType"));if(null===n||!1!==o(n)){if(void 0!==t&&String(t).trim().length>0){function s(e){try{return document.querySelectorAll(e).length>0}catch(e){return!1}}const i=s(t);!0===r&&!0===Mn()&&!1===i&&Nt(`Spyne Warning: the selector, ${t} does not exist in this el, ${e}`)}}else Nt(`Spyne Warning: the el object is not a valid single element, ${n}`)}function Fn(e,t,r=!1){let n=!1;const o=(r=>{let o=[];try{o=document.querySelectorAll(r)}catch(e){o=[]}try{n=document.querySelector(t)===document.querySelector(e),!0===n&&(o=[document.querySelector(t)])}catch(e){}return o})(void 0!==t?`${e} ${t}`:e);if(!0===r){xn(!0===n?"body":e,t,r)}return o}function $n(e,t,r){return Fn(t,r).forEach(t=>{t.style.cssText=e}),this}function kn(e,t){function r(t){return kn(e,t)}xn(e="string"==typeof e?e:function(e){let t=`${Math.random().toString(36).replace(/\d/gm,"").substring(1,8)}`;return void 0===e.dataset.vsid?e.dataset.vsid=t:t=e.dataset.vsid,`[data-vsid='${t}']`}(e),t,!1),r.map=r=>Array.from(Fn(e,t)).map(r),r.forEach=r=>Array.from(Fn(e,t)).map(r),r.addClass=n=>(Fn(e,t).forEach(e=>e.classList.add(n)),r),r.removeClass=n=>(Fn(e,t).forEach(e=>{e.classList.remove(n)}),r),r.setClass=n=>(Fn(e,t).forEach(e=>{const t=u(m(E),z(" "))(e.className),r=n.split(" ");t.forEach(t=>e.classList.remove(t)),r.forEach(t=>e.classList.add(t))}),r),r.unmount=()=>{},r.toggleClass=(n,o)=>(Fn(e,t).forEach(e=>{(o=void 0!==o?o:!e.classList.contains(n))?e.classList.add(n):e.classList.remove(n)}),r),r.toggle=(e,t)=>(r.toggleClass(e,t),r),r.appendChild=e=>{const n=r.el;return null!==n?n.appendChild(e):Nt(`Spyne Warning: The selector, ${t} does not appear to be valid!`),r.el},r.addAnimClass=n=>(requestAnimationFrame(()=>{Fn(e,t).forEach(e=>{try{e.classList.add(n)}catch(e){}})}),r),r.setActiveItem=(n,o)=>{const s=Fn(e,t),i="string"==typeof o?Wn(e,o):o;if(s.forEach(e=>e.classList.remove(n)),!0===(a=i,u(se(0),k(-1),b("nodeType"))(a))){const e=Array.from(s).find(e=>e===i);e?e.classList.add(n):!0===Mn()&&Nt(`Spyne Warning: The selector, ${o}, is valid but does not match any item in setActiveItem: ${n}`)}else!0===Mn()&&Nt(`Spyne Warning: The selector, ${o}, does not appear to be a valid item in setActiveItem: ${n}`);var a;return r};const n=(r=!0)=>Array.from(Fn(e,t,r));return Object.defineProperty(r,"el",{get:()=>{const r=n();return r.length>1&&!0===Mn()&&Nt(`Spyne Warning: el$("${void 0!==t?t:e}").el matched ${r.length} elements; returning the first. Use .els for the full list.`),r.length>=1?r[0]:null}}),Object.defineProperty(r,"els",{get:()=>n()}),Object.defineProperty(r,"arr",{get:()=>n()}),Object.defineProperty(r,"elLegacy",{get:()=>Wn(e,t,!0)}),Object.defineProperty(r,"len",{get:()=>Fn(e,t,!1).length}),Object.defineProperty(r,"length",{get:()=>Fn(e,t,!1).length}),Object.defineProperty(r,"exists",{get:()=>Fn(e,t,!1).length>=1}),Object.defineProperty(r,"inline",{set:r=>$n(r,e,t),get:()=>r}),Object.defineProperty(r,"inlineCss",{set:r=>$n(r,e,t),get:()=>r}),r}class Gn{constructor(e={}){this.vsnum=Math.random(),this.addMixins(),this._postRenderCalled=!1,this.defaults=()=>{const t=this.createId(),r=e.id?e.id:t;return{vsid:t,id:r,tagName:"div",el:void 0,data:void 0,animateIn:!1,animateInTime:.5,animateOut:!1,animateOutTime:.5,sendLifecyleEvents:!1,hashId:`#${r}`,id$:`#${r}`,viewClass:vn,extendedSourcesHashMethods:{},debug:!1,template:void 0,node:document.createDocumentFragment(),name:Et(this)}},this._state={},this.$dirs=bn.createDirectionalFiltersObject(),this.addDefaultDirection=bn.addDefaultDir,this.addDownInternalDir=bn.addDownInternalDir,this.props=Ye(this.defaults(),e),this.sendLifecycleMethod=!0===this.props.sendLifecyleEvents?this.sendLifecycleMethodActive.bind(this):this.sendLifecycleMethodInactive.bind(this);const t=this.attributesArray;this.props.domAttributes=ee(t,this.props),void 0!==this.props.traits&&this.addTraits(this.props.traits),this.loadAllMethods(),this.props.action="LOADED",this.sink$=new r,this.props.elIsAlreadyRenderedBool=this.elAlreadyExistsFn(this.props);const n=this.props.viewClass;this.view=new n(this.sink$,{el:this.props.el},this.props.vsid,this.props.id),this.sourceStreams=this.view.sourceStreams,this._rawSource$=this.view.getSourceStream(),this._rawSource$.viewName=this.props.name,this.sendEventsDownStream=this.sendEventsDownStreamFn,this.initViewStream(),this.isDevMode=Gn.isDevMode(),this.props.addedChannels=[],this.checkIfElementAlreadyExists()}get source$(){return this._source$}get attributesArray(){return["accesskey","class","contenteditable","dir","draggable","hidden","id","lang","spellcheck","style","tabindex","title","translate","aria-autocomplete","aria-checked","aria-disabled","aria-expanded","aria-haspopup","aria-hidden","aria-invalid","aria-label","aria-level","aria-multiline","aria-multiselectable","aria-orientation","aria-pressed","aria-readonly","aria-required","aria-selected","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","aria-atomic","aria-busy","aria-live","aria-relevant","aria-dropeffect","aria-grabbed","aria-activedescendant","aria-controls","aria-describedby","aria-flowto","aria-labelledby","aria-owns","aria-posinset","aria-setsize","accept","autocomplete","autofocus","checked","dirname","disabled","form","formaction","formenctype","formmethod","formnovalidate","formtarget","list","max","maxlength","min","minlength","multiple","name","pattern","placeholder","readonly","required","size","step","value","alt","srcset","sizes","usemap","ismap","href","target","download","ping","rel","hreflang","as","media","accept-charset","action","enctype","novalidate","content","charset","http-equiv","async","defer","integrity","nomodule","nonce","referrerpolicy","autocapitalize","autoplay","buffered","challenge","cite","code","codebase","color","cols","colspan","contextmenu","controls","coords","crossorigin","csp","dataset","datetime","decoding","default","for","headers","high","icon","importance","itemprop","keytype","kind","label","language","lazyload","loop","low","manifest","method","muted","open","optimum","poster","preload","radiogroup","reversed","role","rows","rowspan","sandbox","scope","scoped","selected","shape","slot","span","srcdoc","src","type","srclang","start","summary","wrap","width","height"]}static isDevMode(){return it.debug}static checkIfActionsAreRegistered(e=[],t){if(t.length>0){const r=t=>{const r=new RegExp(t);if(ge(M(r),n)<0){const r=1===e.length?"from added channel":"from added channels";console.warn(`Spyne Warning: The action, ${t}, in ${this.props.name}, does not match any of the registered actions ${r}, ${e.join(", ")}`)}},n=(e=>{const t=e.map(e=>it.getChannelActions(e));return O(t)})(e);t.forEach(r)}}static isValidNestedArr(e){const t=T(!0),r=Ae(t),n=y(String),o=u(r,D(n),Ce(0,2),k([]));return u(r,D(o),k([]))(e)}static elIsDomElement(e){return y(String,e)&&(e=document.querySelector(e)),u(se(0),k(-1),b("nodeType"))(e)}updatePropsToMatchEl(){const e=u(ye,P(b("tagName"),w("")));this.props.tagName=e(this.props.el)}elAlreadyExistsFn(e){const t=u(se(0),k(-1),b("nodeType"));return he(f([e=>document.body.contains(e),t]),"el")(e)}checkIfElementAlreadyExists(){!0===this.props.elIsAlreadyRenderedBool?(this.updatePropsToMatchEl(),this.postRender()):null===this.props.el&&console.error(`Spyne Error: The defined element for this ViewStream instance, ${this.constructor.name}, appears to not exist.`)}loadAllMethods(){const e=fe(this.onChannelMethodCall.bind(this));this.addActionListeners().forEach(t=>{let[r,n,o]=t;y(String,o)&&(o=new Un({selector:o})),this.props.extendedSourcesHashMethods[r]=e(n,o)}),this.props.hashSourceMethods=this.setSourceHashMethods(this.props.extendedSourcesHashMethods)}addActionListeners(){return[]}onChannelMethodCall(e,t,r){const n=t=>{void 0===this[e]?console.warn(`Spyne Warning: The method, ${e} does not appear to exist in ${this.constructor.name}!`):this[e](t)};if(void 0!==r.$dir&&r.$dir.includes("child")&&!0!==this.deleted){const e=Ye({},r);e.$dir=this.$dirs.C,this.sourceStreams.raw$.next(e)}!0===k(w(!0),t)(r)&&n(r=Ne(["$dir"],r))}setSourceHashMethods(e={}){const t={EXTIRPATING:e=>this.checkParentDispose(e),EXTIRPATE:e=>this.disposeViewStream(e),VS_SPAWNED:e=>this.onVSRendered(e),VS_SPAWNED_AND_ATTACHED_TO_DOM:e=>this.onVSRendered(e),VS_SPAWNED_AND_ATTACHED_TO_PARENT:e=>this.onVSRendered(e),READY_FOR_VS_DETRITUS_COLLECT:e=>this.onReadyToGC(e),VS_NULLITY:()=>({})};return Ye.all([{},t,e])}initViewStream(){this._source$=this._rawSource$.pipe(on(e=>this.onMapViewSource(e)),yn(this.notGCSTATE)),this.initAutoMergeSourceStreams(),this.updateSourceSubscription(this._source$,!0)}notGCSTATE(e){return!e.action.includes("READY_FOR_VS_DETRITUS_COLLECT")}eqGCSTATE(e){return!e.action.includes("READY_FOR_VS_DETRITUS_COLLECT")}notCOMPLETED(e){return!e.action.includes("COMPLETED")}notGCCOMPLETE(e){return!e.action.includes("GC_COMPLETE")}testVal(e){console.log("TESTING VALL IS ",e)}addParentStream(e,t){this.parent$=e.pipe(Tn(e=>void 0!==e&&void 0!==e.action),on(e=>{const t=Ye({},e);return"EXTIRPATE_AND_READY_FOR_VS_DETRITUS_COLLECT"===t.action&&(this.disposeViewStream(t),t.action="READY_FOR_VS_DETRITUS_COLLECT"),t})),this.updateSourceSubscription(this.parent$,!1,"PARENT"),this.renderAndAttachToParent(t)}addChildStream(e){const t=e.pipe(Tn(e=>void 0!==e&&void 0!==e.action),gn(e=>this.tracer("addChildStraem do ",e)),on(e=>e),An(e=>this.onChildCompleted(t.source)));this.updateSourceSubscription(t,!0,"CHILD")}onChildDisposed(e){}onChildCompleted(e){const t=(e=>{const t=e=>{for(;void 0!==e.destination;)e=t(e.destination);return e};return ee(["id","vsid"],t(e))})(e);return this.tracer("onChildCompleted ",this.vsnum,e),this.onChildDisposed(t,e),t}initAutoMergeSourceStreams(){const e={next:this.onSubscribeToSourcesNext.bind(this),error:this.onSubscribeToSourcesError.bind(this),complete:this.onSubscribeToSourcesComplete.bind(this)},t=()=>{this.props.el$=void 0,this.uberSource$.complete(),this.autoSubscriber$.complete(),this.sink$.complete(),this.props=void 0,this.deleted=!0,this.tracer("completeAll",this.deleted,this.props)},n=()=>{o-=1,0===o&&t()};let o=0;this.uberSource$=new r;this.autoMergeSubject$=this.uberSource$.pipe(dn(e=>{const t=e.observable.pipe(Tn(e=>void 0!==e&&void 0!==e.action),on(e=>{const t=Ye({},e);return t.action=e.action,this.tracer("autoMergeSubject$",t),t}));return!1===e.autoClosesBool?t:(o+=1,t.pipe(An(n)))})),this.autoSubscriber$=this.autoMergeSubject$.pipe(Tn(e=>void 0!==e&&void 0!==e.action)).subscribe(e)}updateSourceSubscription(e,t=!1,r){const n={observable:e,autoClosesBool:t,rel:r};this.tracer("updateSourceSubscription ",this.vsnum,n),this.uberSource$.next(n)}onSubscribeToSourcesNext(e={}){const t=k(e=>this.sendExtendedStreams(e)),r=(n=this.props.hashSourceMethods,o=e.action,void 0!==n[o]?o:u(p,F(u(M(I,o),e=>new RegExp(e))))(A(n)));var n,o;t(this.props.hashSourceMethods[r])(e),this.tracer("onSubscribeToSourcesNext",{payload:e})}onSubscribeToSourcesError(e=""){console.log("ALL ERROR ",this.constructor.name,e)}onSubscribeToSourcesComplete(){this.tracer("onSubscribeToSourcesComplete","VS_DETRITUS_COLLECT"),this.openSpigot("VS_DETRITUS_COLLECT")}sendExtendedStreams(e){this.tracer("sendExtendedStreams",e),this.openSpigot(e.action,e)}renderAndAttachToParent(e){this.openSpigot("VS_SPAWN_AND_ATTACH_TO_PARENT",e)}renderView(){this.openSpigot("VS_SPAWN")}renderViewAndAttachToDom(e,t,r){const n={node:e,type:t,attachType:r};this.openSpigot("VS_SPAWN_AND_ATTACH_TO_DOM",{attachData:n})}checkParentDispose(e){"parent"===e.from$&&this.disposeViewStream(e)}onBeforeDispose(){}setTimeout(e,t=0,r=!1){window.setTimeout((...t)=>{if(void 0!==this&&void 0!==this.props){const n=!0===r?e.bind(this):e;be(n,t)}},t)}disposeViewStream(e){this.onBeforeDispose(),this.openSpigot("EXTIRPATE")}onChildDispose(e){}onParentDisposing(e){this.openSpigot("EXTIRPATE")}onReadyToGC(e){const t=void 0!==e.from$&&"internal"===e.from$;this.tracer("onReadyToGC",t,e)}openSpigot(e,t={}){if(void 0!==this.props){this.props.action=e;const r=J(this.props,t);this.sink$.next(Object.freeze(r))}}setAttachData(e,t){return{node:this.props.el,type:"ViewStreamObservable",attachType:e,query:(()=>{const e=this.props.el.querySelector(t);return!0===Gn.isDevMode()&&y(String,t)&&_(e)&&console.warn(`Spyne Warning: The appendView query in ${this.props.name}, '${t}', appears to not exist!`),e})()}}getParentEls(e,t){const r=e=>e.parentElement;let n=0,o=e;for(;n<t;)o=r(o),n++;return o}setAttachParentData(e,t,r){t=""!==t?t:void 0;const n=this.getParentEls(this.props.el,r);return{node:n,type:"ViewStreamObservable",attachType:e,query:n.querySelector(t)}}onMapViewSource(e={}){return this.props=J(this.props,e),e}exchangeViewsWithChild(e,t){this.addChildStream(e.sourceStreams.toParent$),e.addParentStream(this.sourceStreams.toChild$,t)}appendToDom(e){void 0!==this.props.el&&console.warn(`Spyne Warning: The ViewStream, ${this.props.name}, has an element, ${this.props.el}, that is already rendered and does not need to be appendedToDom. This may create unsusual side effects!`),this.renderViewAndAttachToDom(e,"dom","appendChild")}appendToDomAfter(e){void 0!==this.props.el&&console.warn(`Spyne Warning: The ViewStream, ${this.props.name}, has an element, ${this.props.el}, that is already rendered and does not need to be appendedToDomAfter. This may create unsusual side effects!`),this.renderViewAndAttachToDom(e,"dom","after")}prependToDom(e){void 0!==this.props.el&&console.warn(`Spyne Warning: The ViewStream, ${this.props.name}, has an element, ${this.props.el}, that is already rendered and does not need to be prependedToDom. This may create unsusual side effects!`),this.renderViewAndAttachToDom(e,"dom","prependChild")}appendView(e,t){this.exchangeViewsWithChild(e,this.setAttachData("appendChild",t))}appendViewAfter(e,t){this.exchangeViewsWithChild(e,this.setAttachData("after",t))}appendViewToParentEl(e,t,r=1){this.exchangeViewsWithChild(e,this.setAttachParentData("appendChild",t,r))}prependViewToParentEl(e,t,r=1){this.exchangeViewsWithChild(e,this.setAttachParentData("prependChild",t,r))}prependView(e,t){this.exchangeViewsWithChild(e,this.setAttachData("prependChild",t))}appendToNull(){const e=document.getElementById("spyne-null-views");this.renderViewAndAttachToDom(e,"dom","appendChild")}onVSRendered(e){"internal"===e.from$&&this.postRender()}postRender(){if(!0===this._postRenderedCalled)return;this.beforeAfterRender(),this.afterRender(),this.onRendered();if(requestAnimationFrame(()=>this.onAnimFrameAfterRendered()),!0===this.isDevMode){const e=this.broadcastEvents();!1===Gn.isValidNestedArr(e)&&console.warn(`Spyne Warning: The array returned from broadcastEvents in ${this.props.name}, '${JSON.stringify(e)}', does not appear to be properly formatted!`)}this.initializeChannels(),this.viewsStreamBroadcaster=new On(this.props,this.broadcastEvents.bind(this)),this.afterBroadcastEvents(),this._postRenderedCalled=!0}addTraits(e){"Array"!==e.constructor.name&&(e=[e]);e.forEach(e=>{new e(this)})}afterBroadcastEvents(){if(!0===this.isDevMode){const e=e=>e[0],t=this.addActionListeners(),r=t.map(e);if(!1===Gn.isValidNestedArr(t))console.warn(`Spyne Warning: The array returned from addActionsListeners in ${this.props.name}, '${JSON.stringify(t)}', does not appear to be properly formatted!`);else{u(Ee(e=>{const t=k("",e[1]);!1===y(Function,this[t])&&console.warn(`Spyne Warning: The method in addActionListeners nested Array, '${JSON.stringify(e)}', in ${this.props.name}, does not appear to exist!`)}),k([]))(t)}const n=()=>{void 0!==K(["props","addedChannels"],this)&&Gn.checkIfActionsAreRegistered.bind(this)(this.props.addedChannels,r)};this.setTimeout(n,500)}}setDataVSID(){this.props.el.dataset.vsid=this.props.vsid}beforeAfterRender(){this.setDataVSID(),this.props.el$=kn(this.props.el)}downStream(){}onRendered(){}onAnimFrameAfterRendered(){}afterRender(){}broadcastEvents(){return[]}getChannel(e){return H(e=>at().includes(e),e=>it.channelsMap.getStream(e).observer.pipe(yn(e=>!0!==this.deleted)),e=>console.warn(`channel name ${e} is not within ${at}`))(e)}initializeChannels(){const e=e=>{const[t,r=!1]=Array.isArray(e)?e:[e];this?.addChannel(t,r)};Array.isArray(this?.props?.channels)?this?.props?.channels?.forEach(e):Array.isArray(this?.props?.channel)&&console.warn("props.channel is not a ViewStream property. Do you mean props.channels?")}addChannel(e,t=!1,r=!1,n=!1){const o=!0===r?this.$dirs.CI:this.$dirs.I;if(!0===this?.props?.addedChannels?.includes(e))return;const s=K(["srcElement","isLocalEvent"]),i=K(["srcElement","vsid"]),a=[on(e=>{const t=e;return t.$dir=o,t}),Tn(e=>{const t=i(e);return!0!==s(e)||t===this.props.vsid})];var c;!0===t&&a.unshift((c=1,Tn(function(e,t){return c<=t})));const l=this.getChannel(e).pipe(...a);this.updateSourceSubscription(l,!1),this.props.addedChannels.push(e)}checkIfChannelExists(e){const t=it.channelsMap.testStream(e);return!0!==t&&console.warn(`SPYNE WARNING: The ChannelPayload from ${this.props.name}, has been sent to a channel, ${e}, that has not been registered!`),t}sendInfoToChannel(e,t={},r){const n=t,o=k("VIEWSTREAM_EVENT"),i=u(o,b(e)),a={payload:n,action:r=r||i({CHANNEL_ROUTE:"CHANNEL_ROUTE_CHANGE_EVENT"})};try{if(a.srcElement=u(ee(["id","vsid","class","tagName"]),b("props"))(this),!0===this.checkIfChannelExists(e)){!1===/CHANNEL_LIFECYCLE/.test(r)&&Object.defineProperties(a,{payload:{get:()=>lt(t)}});const n=s(a);return new Sn(e,n,a)}}catch(e){console.warn("SPYNE WARNING ",e)}}tracer(...e){this.sendLifecycleMethod(...e)}sendLifecycleMethodInactive(){}sendLifecycleMethodActive(e,t){const r="VS_DETRITUS_COLLECT"===t;!0===me({from$:T("internal"),action:T("VS_SPAWNED_AND_ATTACHED_TO_PARENT")},t)?this.sendInfoToChannel("CHANNEL_LIFECYCLE",{action:"CHANNEL_LIFECYCLE_RENDERED_EVENT"},"CHANNEL_LIFECYCLE_RENDERED_EVENT"):!0===r&&this.sendInfoToChannel("CHANNEL_LIFECYCLE",{action:"CHANNEL_LIFECYCLE_DISPOSED_EVENT"},"CHANNEL_LIFECYCLE_DISPOSED_EVENT")}createActionFilter(e,t){return new Un(e,t)}isLocalEvent(e){const t=K(["srcElement","el"],e),r=K(["props","el"],this);return Gn.elIsDomElement(r)&&Gn.elIsDomElement(t)&&r.contains(t)}addMixins(){const e=ut();this.createId=e.createId}}class jn{constructor(e){const t=String(e.props.name),r=`${t}_ROUTE_UPDATER`;return fe(jn.createTemporaryViewStreamObj)({id:r,name:t})}static createTemporaryViewStreamObj(e,t){const{name:r,id:n}=e,o=t,s=new Gn({id:n,name:r,data:t});s.onRendered=()=>{s.sendInfoToChannel("CHANNEL_ROUTE",o)},s.afterBroadcastEvents=()=>{s.disposeViewStream()},s.appendToNull()}}class zn{constructor(e,t={}){this.addRegisteredActions.bind(this),this.createChannelActionsObj(e,t.extendedActionsArr),t.name=e,t.defaultActions=void 0!==t.data?[`${t.name}_EVENT`]:[],this.props=t,this.props.isRegistered=!1,this.props.isProxy=void 0!==this.props.isProxy&&this.props.isProxy;const r=void 0!==this.props.data;void 0!==this.props.replay?this.props.sendCachedPayload=this.props.replay:this.props.sendCachedPayload=void 0===this.props.sendCachedPayload?r:this.props.sendCachedPayload,this.sendPayloadToRouteChannel=new jn(this),this.createChannelActionMethods(),this.streamsController=it.channelsMap;const n=this.getMainObserver();this.checkForPersistentDataMode=zn.checkForPersistentDataMode.bind(this),this.observer$=this.props.observer=n;const o=this.streamsController.getStream("DISPATCHER"),s=U(t.name,"name");o.pipe(Tn(s)).subscribe(e=>this.onReceivedObservable(e))}getMainObserver(){void 0===this.streamsController&&console.warn(`Spyne Warning: The following channel, ${this.props.name}, appears to be registered before Spyne has been initialized.`);return!0===this.streamsController.testStream(this.props.name)?this.streamsController.getProxySubject(this.props.name,this.props.sendCachedPayload):!0===this.props.sendCachedPayload?new i(1):new r}onChannelInitialized(){}onRegistered(e=this.props){if(void 0!==e.data){const t=Object.keys(this.channelActions)[0];this.sendChannelPayload(t,e.data)}}get isProxy(){return this.props.isProxy}get channelName(){return this.props.name}get observer(){return this.observer$}checkForTraits(){const e=e=>{"Array"!==e.constructor.name&&(e=[e]);e.forEach(e=>new e(this))};void 0!==this.props.traits&&e(this.props.traits)}initializeStream(){this.checkForTraits(),this.onChannelInitialized(),this.checkForPersistentDataMode(),this.onRegistered(),this.props.isRegistered=!0}static checkForPersistentDataMode(e=this.props,t=this.channelActions){const r=E(t),n=void 0!==b("data",e);return!0===r&&!0===n&&(e.sendCachedPayload=!0,t=(()=>{const{name:t}=e,r=`${t}_EVENT`;return{[r]:r}})(),void 0!==this.channelActions&&(this.channelActions=t)),{props:e,actionsObj:t}}setTrace(e){}createChannelActionsObj(e,t=[]){const r=H(y(String),ve,p),n=t.concat(this.addRegisteredActions(e)),o=D(r,n),s=oe(Q(e=>Ie(e,e),o));this.channelActions=s}createChannelActionMethods(){const e=H(y(String),ve,p),t=(e,t)=>{window.setTimeout(()=>{"function"!=typeof this[e]&&console.warn(`"${this.props.name}", REQUIRES THE FOLLOWING METHOD ${e} FOR ACTION, ${t[0]}`)},100)},r=H(y(String),w("onViewStreamInfo"),e=>{const r=Se(Le(1),e);return t(r,e),r});this.channelActionMethods=B(D(t=>[e(t),r(t)],this.addRegisteredActions()))}addRegisteredActions(){let e=[];return K(["props","data"],this)&&(e=[`${this.props.name}_EVENT`]),e}onReceivedObservable(e){this.onIncomingObservable(e)}getActionMethodForObservable(e){e.unpacked=!0;const t=this.onViewStreamInfo.bind(this),r=K(["data","action"],e),n=b(r,this.channelActionMethods);let o=t;if(void 0!==n&&"onViewStreamInfo"!==n){!0===("function"==typeof this[n])&&(o=this[n].bind(this))}return o}onIncomingObservable(e){const t=T(e.name,this.props.name),{action:r,payload:n,srcElement:o}=e.data,s=t=>({clone:()=>{return t=e.data,oe([t,{action:b("action",t)},b("payload",t),b("srcElement",t)]);var t},action:r,payload:n,srcElement:o,event:t});return!0===t?(e=>e.observable.pipe(on(s)).subscribe(this.getActionMethodForObservable(e)))(e):void 0}onViewStreamInfo(e){}sendChannelPayload(e,t,r={},n={},o=this.observer$){const s=new dt(this.props.name,e,t,r,n);o.next(s)}getChannel(e,t){return H(e=>at().includes(e),r=>{const n=this.streamsController.getStream(r).observer;return n.source?n.source.channelName=e:n.channelName=e,void 0!==t?n.pipe(Tn(t)):n},e=>console.warn(`channel name ${e} is not within ${at}`))(e)}mergeChannels(e,t=!0){const r=e.map(e=>{if("string"==typeof e){const r=this.getChannel(e);return t?r.pipe(mn(1)):r}return t?e.pipe(mn(1)):e});let n;if(t)n=a(r);else if(0===r.length)n=c;else if(1===r.length)n=r[0];else{const[e,...t]=r;n=e.pipe(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return hn.apply(void 0,rr([],tr(e)))}(...t))}return n.pipe(on(t=>{const r={};return e.forEach((e,n)=>{const o="string"==typeof e?e:`channel_${n}`;r[e?.source?.channelName||e?.source?.source?.channelName||o]=t[n]}),r}))}static checkForNotTrackFlag(e={}){!0===e.doNotTrack&&it.doNotTrackChannel(e.channelName)}}class Bn extends zn{constructor(e="CHANNEL_ROUTE",t={}){t.sendCachedPayload=!0,super("CHANNEL_ROUTE",t),this.createChannelActionsObj(),this.routeConfigJson=this.getRouteConfig(),this.bindStaticMethods(),this.navToStream$=new i(1),this.observer$=this.navToStream$.pipe(on(e=>this.onMapNext(e))),this.compareRouteKeywords=Fe.compareRouteKeywords()}checkConfigForHash(){!0===("hash"===it.config.channels.ROUTE.type)&&(it.config.channels.ROUTE.type="slash",it.config.channels.ROUTE.isHash=!0)}onRegistered(){this.checkConfigForHash(),this.initStream()}createChannelActionsObj(){const e=this.addRegisteredActions(),t=oe(Q(e=>Ie(e,e),e));this.channelActions=t}addRegisteredActions(){return["CHANNEL_ROUTE_DEEPLINK_EVENT","CHANNEL_ROUTE_CHANGE_EVENT","CHANNEL_ROUTE_CONFIG_UPDATED_EVENT",["CHANNEL_ROUTE_UPDATE_CONFIG_EVENT","updateRouteConfig"]]}updateRouteConfig(e){const t=ee(["isHash","isHidden","routes","type"],e.payload);it.config.channels.ROUTE=J(it.config.channels.ROUTE,t),it.conformRouteConfig();const r=this.getRouteConfig();r.navLinks=[...r?.routeDatasetsArr],this.routeConfigJson=r,this.bindStaticMethodsWithConfigData(),this.sendChannelPayload("CHANNEL_ROUTE_CONFIG_UPDATED_EVENT",r,{},{},this.navToStream$)}getRouteConfig(){const e=it.config,t=K(["channels","ROUTE"],e);"query"===t.type&&(t.isHash=!1);const r=Fe.flattenConfigObject(t.routes);return t.paramsArr=r,t}initStream(){this.firstLoadStream$=new i(1),this.onIncomingDomEvent(void 0,this.routeConfigJson,"CHANNEL_ROUTE_DEEPLINK_EVENT"),Fe.createPopStateStream(this.onIncomingDomEvent.bind(this)),this.observer$=l(this.firstLoadStream$,this.navToStream$)}onMapNext(e,t=!1){return e.action="CHANNEL_ROUTE_CHANGE_EVENT",e}static removeSSID(e){const t=Oe(["routeData"]);return De(t,Ne(["vsid"]))(e)}static onIncomingDomEvent(e,t=this.routeConfigJson,r){const n=void 0!==r?r:this.channelActions.CHANNEL_ROUTE_CHANGE_EVENT,o=K(["state","routeCount"],e),s=!0===y(Number,o);let i=this.getDataFromString(t,s);!0===s&&(i.routeCount=o),"CHANNEL_ROUTE_DEEPLINK_EVENT"===r&&(i.navLinks=b("routeDatasetsArr",t),Object.defineProperty(i,"linksData",{get(){return this.navLinks},set(e){console.warn("set links data is deprecated in ROUTE DEEPLINK DATA, use navLinks")},enumerable:!0}));const a=this.compareRouteKeywords.compare(i.routeData,i.paths);i=J(i,a),this.sendChannelPayload(n,i,void 0,e,this.navToStream$)}static checkForRouteParamsOverrides(e){return e}static checkForEventMethods(e){const t=u(F(M(/^(event)([A-Z].*)([A-Z].*)$/gm)),A,b("payload"))(e);if(t.length>=1){const r=b("event",e);if(void 0!==r){const e=L(/^(event)([A-Z])(.*)([A-Z].*)$/gm,(e,t,r,n,o)=>String(r).toLowerCase()+n+o),n=t=>{const n=e(t);void 0!==r[n]&&r[n]()};t.forEach(n)}}return e}static checkForEndRoute(e,t=this.routeConfigJson,r){if(!0!==u(T("true"),K(["payload","endRoute"]))(e))return e;const n=void 0!==r?r:!0===it.debug,{payload:o}=e;let s=0;const i=(e=[],t)=>{const r=t[1],{routePath:a}=r,c=b("routeName",a),l=(e=>{const t=b("routeName",e);if(t){const r=u(A,Ne(["routeName"]))(e),n=o[t];return C(e=>new RegExp(`^${e}$`).test(n),r)}})(a),d=y(Object,r),h=y(Array,r);if(s+=1,!0===d&&!1===h){const t=a[l];t?u(Re,G(i,e),R)({nextRoutePath:t}):1===s?n&&console.warn(`Spyne Warning: use of end route method should add start route value of "${c}".`):e.push(c)}return e},{routes:a}=t,c=u(Re,G(i,[]),R)({routes:a});if(1===c.length){const t=c[0];e.payload[t]=""}return e}onViewStreamInfo(e){const t=e.action??this.channelActions.CHANNEL_ROUTE_CHANGE_EVENT;e?.srcElement?.el?.dataset&&(e.payload=function(e){const t={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}(e?.srcElement?.el?.dataset)??e.payload),Bn.checkForEventMethods(e),e=this.checkForEndRoute(e);let r=this.getDataFromParams(e);const n=b("srcElement",e),o=b("event",e),s=!r.isHidden,i=this.compareRouteKeywords.compare(r.routeData,r.paths);r=J(r,i),this.sendRouteStream(r,s),r=Bn.removeSSID(r),this.sendChannelPayload(t,r,n,o,this.navToStream$)}static checkAndConvertStrWithRegexTokens(e,t){return A(t)}sendRouteStream(e,t=!0){!0===t&&this.setWindowLocation(e)}static getRouteState(){return"CHANNEL_ROUTE_CHANGE_EVENT"}static getIsDeepLinkBool(e){return!1===e&&0===this._routeCount}static getRouteCount(e=!1){return void 0===this._routeCount?(this._routeCount=0,this._routeCount):(!1===e&&(this._routeCount+=1),this._routeCount)}static getExtraPayloadParams(e=this.routeConfigJson,t=!1){return{routeCount:this.getRouteCount(t),isDeepLink:this.getIsDeepLinkBool(t),isHash:e.isHash,isHistory:t,isHidden:e.isHidden,routeType:e.type}}static getDataFromParams(e,t=this.routeConfigJson){let r=b("payload",e);const n=this.getRouteStrFromParams(r,t),o=(e,r)=>k(r,b(e,t)),s=o("type","slash"),i=o("isHash",!1),a=xe.formatStrAsWindowLocation(n),c=this.getDataFromLocationStr(s,i,a),{pathInnermost:l,paths:d}=c;r=J(c.routeData,r);const{routeCount:u,isDeepLink:h,isHash:E,isHistory:p,isHidden:N,routeType:_}=this.getExtraPayloadParams(t);return{isDeepLink:h,routeCount:u,pathInnermost:l,paths:d,routeData:r,routeValue:n,isHash:E,isHidden:N,isHistory:p,routeType:_}}static getDataFromString(e=this.routeConfigJson,t=!1){const r=e.type,n=!0===e.isHash,o=xe.getLocationStrByType(r,n),{paths:s,pathInnermost:i,routeData:a,routeValue:c}=Bn.getParamsFromRouteStr(o,e,r),{routeCount:l,isDeepLink:d,isHash:u,routeType:h,isHidden:E}=this.getExtraPayloadParams(e,t);return{isDeepLink:d,routeCount:l,pathInnermost:i,paths:s,routeData:a,routeValue:c,isHash:u,isHidden:E,isHistory:t,routeType:h}}static getDataFromLocationStr(e="slash",t=this.routeConfigJson.isHash,r=window.location){const n=void 0!==this.routeConfigJson?this.routeConfigJson.type:e,o=xe.getLocationStrByType(n,t,r),{paths:s,pathInnermost:i,routeData:a,routeValue:c}=this.getParamsFromRouteStr(o,this.routeConfigJson,n);return{paths:s,pathInnermost:i,routeData:a,routeValue:c,action:this.getRouteState()}}static getLocationData(){return Z(["href","origin","protocol","host","hostname","port","pathname","search","hash"],window.location)}static getRouteStrFromParams(e,t,r){const n=void 0!==r?r:t.type;return xe.convertParamsToRoute(e,t,n)}static getParamsFromRouteStr(e,t,r){const n=void 0!==r?r:t.type;return xe.convertRouteToParams(e,t,n)}checkEmptyRouteStr(e,t=!1){const r=E(e);return!0===(!0===r&&!1===t)||!0===(!0===r&&!0===t)?"/":!0===(!1===r&&!0===t)?V("#",e):e}static removeLastSlash(e){return e.replace(/^(.*)(\/)$/,"$1")}setWindowLocation(e){let{isHash:t,routeValue:r,routeType:n}=e;r=this.checkEmptyRouteStr(r,t);const{routeCount:o}=e;if(!0===t||"query"===n){r=Bn.removeLastSlash(window.location.pathname)+r,window.history.pushState({routeCount:o},"",r)}else{const e=v(u(h(T("/")),p),V("/",I));window.history.pushState({routeCount:o},"",e(r))}}getWindowLocation(){return window.location.pathname}bindStaticMethods(){this.checkForEndRoute=Bn.checkForEndRoute.bind(this),this.getIsDeepLinkBool=Bn.getIsDeepLinkBool.bind(this),this.getDataFromLocationStr=Bn.getDataFromLocationStr.bind(this),this.onIncomingDomEvent=Bn.onIncomingDomEvent.bind(this),this.getDataFromString=Bn.getDataFromString.bind(this),this.getParamsFromRouteStr=Bn.getParamsFromRouteStr.bind(this),this.getLocationData=Bn.getLocationData.bind(this),this.getRouteState=Bn.getRouteState.bind(this),this.getDataFromParams=Bn.getDataFromParams.bind(this),this.getRouteCount=Bn.getRouteCount.bind(this),this.getExtraPayloadParams=Bn.getExtraPayloadParams.bind(this),this.bindStaticMethodsWithConfigData()}bindStaticMethodsWithConfigData(){const e=He(3,Bn.getRouteStrFromParams);this.getRouteStrFromParams=e(I,this.routeConfigJson,this.routeConfigJson.type)}}class Yn extends zn{constructor(e="CHANNEL_UI",t={}){t.sendCachedPayload=!1,super(e,t),this.keyEventsLoaded=!1,this.keyCodeArr=[]}addRegisteredActions(){return["CHANNEL_UI_DOMCONTENTLOADED_EVENT","CHANNEL_UI_ABORT_EVENT","CHANNEL_UI_ACTIVATE_EVENT","CHANNEL_UI_ADDTRACK_EVENT","CHANNEL_UI_AFTERPRINT_EVENT","CHANNEL_UI_AFTERSCRIPTEXECUTE_EVENT","CHANNEL_UI_ANIMATIONCANCEL_EVENT","CHANNEL_UI_ANIMATIONEND_EVENT","CHANNEL_UI_ANIMATIONITERATION_EVENT","CHANNEL_UI_ANIMATIONSTART_EVENT","CHANNEL_UI_APPINSTALLED_EVENT","CHANNEL_UI_AUDIOEND_EVENT","CHANNEL_UI_AUDIOSTART_EVENT","CHANNEL_UI_AUXCLICK_EVENT","CHANNEL_UI_BEFOREINPUT_EVENT","CHANNEL_UI_BEFOREPRINT_EVENT","CHANNEL_UI_BEFOREUNLOAD_EVENT","CHANNEL_UI_BEGINEVENT_EVENT","CHANNEL_UI_BLOCKED_EVENT","CHANNEL_UI_BLUR_EVENT","CHANNEL_UI_BOUNDARY_EVENT","CHANNEL_UI_BUFFEREDAMOUNTLOW_EVENT","CHANNEL_UI_CANCEL_EVENT","CHANNEL_UI_CANPLAY_EVENT","CHANNEL_UI_CANPLAYTHROUGH_EVENT","CHANNEL_UI_CHANGE_EVENT","CHANNEL_UI_CLICK_EVENT","CHANNEL_UI_CLOSE_EVENT","CHANNEL_UI_CLOSING_EVENT","CHANNEL_UI_COMPLETE_EVENT","CHANNEL_UI_COMPOSITIONEND_EVENT","CHANNEL_UI_COMPOSITIONSTART_EVENT","CHANNEL_UI_COMPOSITIONUPDATE_EVENT","CHANNEL_UI_CONNECT_EVENT","CHANNEL_UI_CONNECTIONSTATECHANGE_EVENT","CHANNEL_UI_CONTENTDELETE_EVENT","CHANNEL_UI_CONTEXTMENU_EVENT","CHANNEL_UI_COPY_EVENT","CHANNEL_UI_CUECHANGE_EVENT","CHANNEL_UI_CUT_EVENT","CHANNEL_UI_DATACHANNEL_EVENT","CHANNEL_UI_DBLCLICK_EVENT","CHANNEL_UI_DEVICECHANGE_EVENT","CHANNEL_UI_DEVICEMOTION_EVENT","CHANNEL_UI_DEVICEORIENTATION_EVENT","CHANNEL_UI_DRAG_EVENT","CHANNEL_UI_DRAGEND_EVENT","CHANNEL_UI_DRAGENTER_EVENT","CHANNEL_UI_DRAGLEAVE_EVENT","CHANNEL_UI_DRAGOVER_EVENT","CHANNEL_UI_DRAGSTART_EVENT","CHANNEL_UI_DROP_EVENT","CHANNEL_UI_DURATIONCHANGE_EVENT","CHANNEL_UI_EMPTIED_EVENT","CHANNEL_UI_END_EVENT","CHANNEL_UI_ENDEVENT_EVENT","CHANNEL_UI_ENDED_EVENT","CHANNEL_UI_ENTERPICTUREINPICTURE_EVENT","CHANNEL_UI_ERROR_EVENT","CHANNEL_UI_FOCUS_EVENT","CHANNEL_UI_FOCUSIN_EVENT","CHANNEL_UI_FOCUSOUT_EVENT","CHANNEL_UI_FORMDATA_EVENT","CHANNEL_UI_FULLSCREENCHANGE_EVENT","CHANNEL_UI_FULLSCREENERROR_EVENT","CHANNEL_UI_GAMEPADCONNECTED_EVENT","CHANNEL_UI_GAMEPADDISCONNECTED_EVENT","CHANNEL_UI_GATHERINGSTATECHANGE_EVENT","CHANNEL_UI_GESTURECHANGE_EVENT","CHANNEL_UI_GESTUREEND_EVENT","CHANNEL_UI_GESTURESTART_EVENT","CHANNEL_UI_GOTPOINTERCAPTURE_EVENT","CHANNEL_UI_HASHCHANGE_EVENT","CHANNEL_UI_ICECANDIDATE_EVENT","CHANNEL_UI_ICECANDIDATEERROR_EVENT","CHANNEL_UI_ICECONNECTIONSTATECHANGE_EVENT","CHANNEL_UI_ICEGATHERINGSTATECHANGE_EVENT","CHANNEL_UI_INPUT_EVENT","CHANNEL_UI_INPUTSOURCESCHANGE_EVENT","CHANNEL_UI_INSTALL_EVENT","CHANNEL_UI_INVALID_EVENT","CHANNEL_UI_KEYDOWN_EVENT","CHANNEL_UI_KEYUP_EVENT","CHANNEL_UI_LANGUAGECHANGE_EVENT","CHANNEL_UI_LEAVEPICTUREINPICTURE_EVENT","CHANNEL_UI_LOAD_EVENT","CHANNEL_UI_LOADEDDATA_EVENT","CHANNEL_UI_LOADEDMETADATA_EVENT","CHANNEL_UI_LOADEND_EVENT","CHANNEL_UI_LOADSTART_EVENT","CHANNEL_UI_LOSTPOINTERCAPTURE_EVENT","CHANNEL_UI_MARK_EVENT","CHANNEL_UI_MERCHANTVALIDATION_EVENT","CHANNEL_UI_MESSAGE_EVENT","CHANNEL_UI_MESSAGEERROR_EVENT","CHANNEL_UI_MOUSEDOWN_EVENT","CHANNEL_UI_MOUSEENTER_EVENT","CHANNEL_UI_MOUSELEAVE_EVENT","CHANNEL_UI_MOUSEMOVE_EVENT","CHANNEL_UI_MOUSEOUT_EVENT","CHANNEL_UI_MOUSEOVER_EVENT","CHANNEL_UI_MOUSEUP_EVENT","CHANNEL_UI_MUTE_EVENT","CHANNEL_UI_NEGOTIATIONNEEDED_EVENT","CHANNEL_UI_NOMATCH_EVENT","CHANNEL_UI_NOTIFICATIONCLICK_EVENT","CHANNEL_UI_OFFLINE_EVENT","CHANNEL_UI_ONLINE_EVENT","CHANNEL_UI_OPEN_EVENT","CHANNEL_UI_ORIENTATIONCHANGE_EVENT","CHANNEL_UI_PAGEHIDE_EVENT","CHANNEL_UI_PAGESHOW_EVENT","CHANNEL_UI_PASTE_EVENT","CHANNEL_UI_PAUSE_EVENT","CHANNEL_UI_PAYERDETAILCHANGE_EVENT","CHANNEL_UI_PAYMENTMETHODCHANGE_EVENT","CHANNEL_UI_PLAY_EVENT","CHANNEL_UI_PLAYING_EVENT","CHANNEL_UI_POINTERCANCEL_EVENT","CHANNEL_UI_POINTERDOWN_EVENT","CHANNEL_UI_POINTERENTER_EVENT","CHANNEL_UI_POINTERLEAVE_EVENT","CHANNEL_UI_POINTERLOCKCHANGE_EVENT","CHANNEL_UI_POINTERLOCKERROR_EVENT","CHANNEL_UI_POINTERMOVE_EVENT","CHANNEL_UI_POINTEROUT_EVENT","CHANNEL_UI_POINTEROVER_EVENT","CHANNEL_UI_POINTERUP_EVENT","CHANNEL_UI_POPSTATE_EVENT","CHANNEL_UI_PROGRESS_EVENT","CHANNEL_UI_PUSH_EVENT","CHANNEL_UI_PUSHSUBSCRIPTIONCHANGE_EVENT","CHANNEL_UI_RATECHANGE_EVENT","CHANNEL_UI_READYSTATECHANGE_EVENT","CHANNEL_UI_REJECTIONHANDLED_EVENT","CHANNEL_UI_REMOVETRACK_EVENT","CHANNEL_UI_REMOVESTREAM_EVENT","CHANNEL_UI_REPEATEVENT_EVENT","CHANNEL_UI_RESET_EVENT","CHANNEL_UI_RESIZE_EVENT","CHANNEL_UI_RESOURCETIMINGBUFFERFULL_EVENT","CHANNEL_UI_RESULT_EVENT","CHANNEL_UI_RESUME_EVENT","CHANNEL_UI_SCROLL_EVENT","CHANNEL_UI_SEARCH_EVENT","CHANNEL_UI_SEEKED_EVENT","CHANNEL_UI_SEEKING_EVENT","CHANNEL_UI_SELECT_EVENT","CHANNEL_UI_SELECTEDCANDIDATEPAIRCHANGE_EVENT","CHANNEL_UI_SELECTEND_EVENT","CHANNEL_UI_SELECTIONCHANGE_EVENT","CHANNEL_UI_SELECTSTART_EVENT","CHANNEL_UI_SHIPPINGADDRESSCHANGE_EVENT","CHANNEL_UI_SHIPPINGOPTIONCHANGE_EVENT","CHANNEL_UI_SIGNALINGSTATECHANGE_EVENT","CHANNEL_UI_SLOTCHANGE_EVENT","CHANNEL_UI_SOUNDEND_EVENT","CHANNEL_UI_SOUNDSTART_EVENT","CHANNEL_UI_SPEECHEND_EVENT","CHANNEL_UI_SPEECHSTART_EVENT","CHANNEL_UI_SQUEEZE_EVENT","CHANNEL_UI_SQUEEZEEND_EVENT","CHANNEL_UI_SQUEEZESTART_EVENT","CHANNEL_UI_STALLED_EVENT","CHANNEL_UI_START_EVENT","CHANNEL_UI_STATECHANGE_EVENT","CHANNEL_UI_STORAGE_EVENT","CHANNEL_UI_SUBMIT_EVENT","CHANNEL_UI_SUCCESS_EVENT","CHANNEL_UI_SUSPEND_EVENT","CHANNEL_UI_TIMEOUT_EVENT","CHANNEL_UI_TIMEUPDATE_EVENT","CHANNEL_UI_TOGGLE_EVENT","CHANNEL_UI_TONECHANGE_EVENT","CHANNEL_UI_TOUCHCANCEL_EVENT","CHANNEL_UI_TOUCHEND_EVENT","CHANNEL_UI_TOUCHMOVE_EVENT","CHANNEL_UI_TOUCHSTART_EVENT","CHANNEL_UI_TRACK_EVENT","CHANNEL_UI_TRANSITIONCANCEL_EVENT","CHANNEL_UI_TRANSITIONEND_EVENT","CHANNEL_UI_TRANSITIONRUN_EVENT","CHANNEL_UI_TRANSITIONSTART_EVENT","CHANNEL_UI_UNHANDLEDREJECTION_EVENT","CHANNEL_UI_UNLOAD_EVENT","CHANNEL_UI_UNMUTE_EVENT","CHANNEL_UI_UPGRADENEEDED_EVENT","CHANNEL_UI_VERSIONCHANGE_EVENT","CHANNEL_UI_VISIBILITYCHANGE_EVENT","CHANNEL_UI_VOICESCHANGED_EVENT","CHANNEL_UI_VOLUMECHANGE_EVENT","CHANNEL_UI_VRDISPLAYACTIVATE_EVENT","CHANNEL_UI_VRDISPLAYBLUR_EVENT","CHANNEL_UI_VRDISPLAYCONNECT_EVENT","CHANNEL_UI_VRDISPLAYDEACTIVATE_EVENT","CHANNEL_UI_VRDISPLAYDISCONNECT_EVENT","CHANNEL_UI_VRDISPLAYFOCUS_EVENT","CHANNEL_UI_VRDISPLAYPOINTERRESTRICTED_EVENT","CHANNEL_UI_VRDISPLAYPOINTERUNRESTRICTED_EVENT","CHANNEL_UI_VRDISPLAYPRESENTCHANGE_EVENT","CHANNEL_UI_WAITING_EVENT","CHANNEL_UI_WEBGLCONTEXTCREATIONERROR_EVENT","CHANNEL_UI_WEBGLCONTEXTLOST_EVENT","CHANNEL_UI_WEBGLCONTEXTRESTORED_EVENT","CHANNEL_UI_WEBKITMOUSEFORCECHANGED_EVENT","CHANNEL_UI_WEBKITMOUSEFORCEDOWN_EVENT","CHANNEL_UI_WEBKITMOUSEFORCEUP_EVENT","CHANNEL_UI_WEBKITMOUSEFORCEWILLBEGIN_EVENT","CHANNEL_UI_WHEEL_EVENT"]}loadKeyStream(){const e=t.fromEvent(document,"keyup");this.keyPresses$=e.groupBy(e=>e.keyCode).mergeAll().filter(e=>this.keyCodeArr.indexOf(e.keyCode)>=0).repeat().subscribe(this.onKeyPressed.bind(this))}addKeyEvent(e){!1===this.keyEventsLoaded&&this.loadKeyStream(),this.keyEventsLoaded=!0,this.registerKey(e)}registerKey(e){this.keyCodeArr.push(e)}onKeyPressed(e){}static removeSSID(e){const t=Oe(["payload"]);return De(t,Ne(["vsid"]))(e)}onIncomingObservable(e){const t=T(e.name,this.props.name);e.data=Yn.removeSSID(e.data);const{payload:r,srcElement:n}=e.data,o=e=>({payload:r,srcElement:n,event:e});return!0===t?(e=>e.observable.pipe(on(o)).subscribe(this.onUIEvent.bind(this)))(e):void 0}getActionState(e){const t=K(["event","type"]),r=K(["event","typeOverRide"]),n=u(we,P(r,t))(e),o="CHANNEL_UI";return void 0!==n?`${o}_${n}_EVENT`:o}static checkForEventMethods(e){const t=u(F(M(/^(event)([A-Z].*)([A-Z].*)$/gm)),A,b("payload"))(e);if(t.length>=1){const r=b("event",e);if(void 0!==r){const e=L(/^(event)([A-Z])(.*)([A-Z].*)$/gm,(e,t,r,n,o)=>String(r).toLowerCase()+n+o),n=t=>{const n=e(t);void 0!==r[n]&&"function"==typeof r[n]&&r[n]()};t.forEach(n)}}return e}onUIEvent(e){e.payload=function(e){const t={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}(e?.srcElement?.el?.dataset)??e.payload,Yn.checkForEventMethods(e),e.action=this.getActionState(e);const t=e.action,{payload:r,srcElement:n}=e,o=e.event;$t(o?.target),this.sendChannelPayload(t,r,n,o)}}class Kn{constructor(){this.createDomObservableFromEvent=Kn.createDomObservableFromEvent.bind(this)}static createDomObservableFromEvent(t,r,n=!0,o=window){return r=void 0===r?e=>e:r,e(e=>o.addEventListener(t,e,{passive:n}),()=>{o[t]=e=>e}).pipe(on(r))}static createMediaQuery(e){const t=window.matchMedia(e);return this.checkIfValidMediaQuery(t,e),!1!==t&&t}static checkIfValidMediaQuery(e,t){const r=e=>e.replace(/\s+/gm,""),n=void 0!==e.matches&&r(e.media).indexOf(r(t))>=0;return!1===n&&(t=>{console.warn(`Spyne Info: the following query string, "${t}", has been optimized to "${e.media}" by the browser and may not be a valid Media Query item!`)})(t),n}static createMediaQueryHandler(t,r){const n=(e=>t=>(t.mediaQueryName=e,t))(r),o=(s=t,{addHandler:e=>{s.addListener(e)},removeHandler:e=>{s.onchange=()=>{}}});var s;return new e(o.addHandler,o.removeHandler).pipe(on(n))}static createMergedObsFromObj(e){const t=e.mediaQueries||e.mediaQueries,r=[];return ce((e,t,n)=>{const o=Kn.createMediaQuery(e);return!1!==o&&r.push(Kn.createMediaQueryHandler(o,t)),r},t),r}}class qn extends zn{constructor(e="CHANNEL_WINDOW"){super(e),this.bindStaticMethods(),this.currentScrollY=0}initializeStream(){this.domChannelConfig=it.config.channels.WINDOW;const e=this.getActiveObservables(),t=l(...e);this.dom$=t,t.subscribe(e=>{const{action:t,payload:r,srcElement:n,event:o}=e;this.sendChannelPayload(t,r,n,o)})}static getMouseWheelMapFn(e){const t=this.channelActions.CHANNEL_WINDOW_WHEEL_EVENT,r=e.deltaY<=0?"up":"down",{deltaX:n,deltaY:o,deltaZ:s}=e;return{action:t,payload:{scrollDir:r,deltaX:n,deltaY:o,deltaZ:s},srcElement:e.srcElement,event:e}}static createCurriedGenericEvent(e){const t=`CHANNEL_WINDOW_${e.toUpperCase()}_EVENT`;return fe(qn.mapGenericEvent)(t)}static mapGenericEvent(e,t){return{action:e,payload:t,srcElement:t.srcElement,event:t}}static getResizeMapFn(e){return{action:this.channelActions.CHANNEL_WINDOW_RESIZE_EVENT,payload:ee(["innerWidth","innerHeight","outerWidth","outerHeight"],window),srcElement:e.srcElement,event:e}}static getOrientationMapFn(e){const t=this.channelActions.CHANNEL_WINDOW_ORIENTATION_EVENT,r=window.matchMedia("(orientation: portrait)").matches,n=ee(["innerWidth","innerHeight","outerWidth","outerHeight"],window);n.orientation=!0===r?"portrait":"landscape";return{action:t,payload:n,srcElement:e.srcElement,event:e}}getMediaQueryMapFn(e){return{action:this.channelActions.CHANNEL_WINDOW_MEDIA_QUERY_EVENT,payload:ee(["matches","media","mediaQueryName"],e),srcElement:e.srcElement,event:e}}createMouseWheelObservable(e){const t=e.debounceMSTimeForScroll;return Kn.createDomObservableFromEvent("wheel",qn.getMouseWheelMapFn.bind(this)).pipe(_n(t))}static getScrollData(){let e=0;return t=>{const r=e-t;return e=t,{scrollY:t,scrollDistance:r,scrollDir:r>=0?"up":"down"}}}static getScrollY(e){return void 0!==e.pageYOffset?e.pageYOffset:e.scrollTop}static getScrollMapFn(e,t,r,n,o){const s=n(qn.getScrollY(o)),{scrollDistance:i}=s;return{action:r,payload:s,srcElement:e.srcElement,scrollDistance:i,event:e}}createScrollObservable(e,t=window,r=!0){const n=e.debounceMSTimeForScroll,o=t,s=t===window,i=void 0!==e.scrollElForVals?e.scrollElForVals:t,a=s?"CHANNEL_WINDOW_SCROLL_EVENT":"CHANNEL_WINDOW_ELEMENT_SCROLL_EVENT",c=qn.getScrollData(),l=Ve(qn.getScrollMapFn,[a,c,i,r,o]).bind(this);return Kn.createDomObservableFromEvent("scroll",l,r,o).pipe(_n(n),(d=e=>0===e.scrollDistance,qt(function(e,t){var r=!1,n=0;e.subscribe(jr(t,function(e){return(r||(r=!d(e,n++)))&&t.next(e)}))})),on(e=>{const t=qn.getScrollY(o);return e.payload.scrollDistanceAbs=Math.abs(this.currentScrollY-t),this.currentScrollY=t,e}));var d}createOrientationObservable(e){return Kn.createDomObservableFromEvent("orientationchange",qn.getOrientationMapFn.bind(this))}createResizeObservable(e){const t=e.debounceMSTimeForResize;return Kn.createDomObservableFromEvent("resize",qn.getResizeMapFn.bind(this)).pipe(_n(t))}getEventsFromConfig(e=this.domChannelConfig){const t=e.events;return D(e=>{const t=qn.createCurriedGenericEvent(e);return Kn.createDomObservableFromEvent(e,t)},t)}getActiveObservables(e=this.domChannelConfig){let t=[];e.listenForMediaQueries=pt(e.mediaQueries)||pt(e.mediaQueries);const r={listenForResize:this.createResizeObservable.bind(this),listenForOrientation:this.createOrientationObservable.bind(this),listenForScroll:this.createScrollObservable.bind(this),listenForWheel:this.createMouseWheelObservable.bind(this)};ce((r,n,o)=>{e[n]&&t.push(r(e))},r),this.checkForMediaQueries(e.listenForMediaQueries);const n=this.getEventsFromConfig(e);return t=t.concat(n),t}checkForMediaQueries(e){const t=e=>{const{action:t,payload:r,srcElement:n,event:o}=e;this.sendChannelPayload(t,r,n,o,this.observer$)};!0===e&&this.getMediaQueryObservable(this.domChannelConfig).subscribe(t)}getMediaQueryObservable(e){const t=this.createMergedObsFromObj(e);return be(l,t).pipe(on(this.getMediaQueryMapFn.bind(this)))}addRegisteredActions(){return["CHANNEL_WINDOW_ABORT_EVENT","CHANNEL_WINDOW_AFTERPRINT_EVENT","CHANNEL_WINDOW_ANIMATIONEND_EVENT","CHANNEL_WINDOW_ANIMATIONITERATION_EVENT","CHANNEL_WINDOW_ANIMATIONSTART_EVENT","CHANNEL_WINDOW_APPINSTALLED_EVENT","CHANNEL_WINDOW_BEFOREPRINT_EVENT","CHANNEL_WINDOW_BEFOREUNLOAD_EVENT","CHANNEL_WINDOW_BEGINEVENT_EVENT","CHANNEL_WINDOW_BLUR_EVENT","CHANNEL_WINDOW_CACHED_EVENT","CHANNEL_WINDOW_CHANGE_EVENT","CHANNEL_WINDOW_CLICK_EVENT","CHANNEL_WINDOW_CLOSE_EVENT","CHANNEL_WINDOW_COMPOSITIONEND_EVENT","CHANNEL_WINDOW_COMPOSITIONSTART_EVENT","CHANNEL_WINDOW_COMPOSITIONUPDATE_EVENT","CHANNEL_WINDOW_COPY_EVENT","CHANNEL_WINDOW_CUT_EVENT","CHANNEL_WINDOW_DBLCLICK_EVENT","CHANNEL_WINDOW_DEVICECHANGE_EVENT","CHANNEL_WINDOW_DEVICELIGHT_EVENT","CHANNEL_WINDOW_DEVICEMOTION_EVENT","CHANNEL_WINDOW_DEVICEORIENTATION_EVENT","CHANNEL_WINDOW_DEVICEPROXIMITY_EVENT","CHANNEL_WINDOW_DOMATTRIBUTENAMECHANGED_EVENT","CHANNEL_WINDOW_DOMATTRMODIFIED_EVENT","CHANNEL_WINDOW_DOMCHARACTERDATAMODIFIED_EVENT","CHANNEL_WINDOW_DOMCONTENTLOADED_EVENT","CHANNEL_WINDOW_DOMCONTENTLOADED_EVENT","CHANNEL_WINDOW_DOMELEMENTNAMECHANGED_EVENT","CHANNEL_WINDOW_DRAGEND_EVENT","CHANNEL_WINDOW_DRAGENTER_EVENT","CHANNEL_WINDOW_DRAGLEAVE_EVENT","CHANNEL_WINDOW_DRAGOVER_EVENT","CHANNEL_WINDOW_DRAGSTART_EVENT","CHANNEL_WINDOW_DRAG_EVENT","CHANNEL_WINDOW_DROP_EVENT","CHANNEL_WINDOW_ELEMENT_SCROLL_EVENT","CHANNEL_WINDOW_ERROR_EVENT","CHANNEL_WINDOW_FOCUSIN_EVENT","CHANNEL_WINDOW_FOCUS_EVENT","CHANNEL_WINDOW_FULLSCREENCHANGE_EVENT","CHANNEL_WINDOW_FULLSCREENERROR_EVENT","CHANNEL_WINDOW_HASHCHANGE_EVENT","CHANNEL_WINDOW_INPUT_EVENT","CHANNEL_WINDOW_INVALID_EVENT","CHANNEL_WINDOW_KEYDOWN_EVENT","CHANNEL_WINDOW_KEYPRESS_EVENT","CHANNEL_WINDOW_KEYUP_EVENT","CHANNEL_WINDOW_LOAD_EVENT","CHANNEL_WINDOW_MEDIA_QUERY_EVENT","CHANNEL_WINDOW_MESSAGE_EVENT","CHANNEL_WINDOW_MOUSEDOWN_EVENT","CHANNEL_WINDOW_MOUSEENTER_EVENT","CHANNEL_WINDOW_MOUSELEAVE_EVENT","CHANNEL_WINDOW_MOUSEMOVE_EVENT","CHANNEL_WINDOW_MOUSEOUT_EVENT","CHANNEL_WINDOW_MOUSEOVER_EVENT","CHANNEL_WINDOW_MOUSEUP_EVENT","CHANNEL_WINDOW_MOUSEWHEEL_EVENT","CHANNEL_WINDOW_OFFLINE_EVENT","CHANNEL_WINDOW_ONLINE_EVENT","CHANNEL_WINDOW_OPEN_EVENT","CHANNEL_WINDOW_ORIENTATION_EVENT","CHANNEL_WINDOW_PAGEHIDE_EVENT","CHANNEL_WINDOW_PAGESHOW_EVENT","CHANNEL_WINDOW_PASTE_EVENT","CHANNEL_WINDOW_POPSTATE_EVENT","CHANNEL_WINDOW_POPSTATE_EVENT","CHANNEL_WINDOW_PROGRESSEVENTS_EVENT","CHANNEL_WINDOW_RESET_EVENT","CHANNEL_WINDOW_RESIZE_EVENT","CHANNEL_WINDOW_SCROLL_ELEMENT_ADDED_EVENT","CHANNEL_WINDOW_SCROLL_EVENT","CHANNEL_WINDOW_SCROLL_LOCK_EVENT",["CHANNEL_WINDOW_SCROLL_LOCK_EVENT","onScrollLockEvent"],["CHANNEL_WINDOW_SET_ELEMENT_TO_SCROLL_EVENT","onSetElementToScroll"],"CHANNEL_WINDOW_STORAGE_EVENT","CHANNEL_WINDOW_SUBMIT_EVENT","CHANNEL_WINDOW_TRANSITIONCANCEL_EVENT","CHANNEL_WINDOW_TRANSITIONEND_EVENT","CHANNEL_WINDOW_TRANSITIONRUN_EVENT","CHANNEL_WINDOW_TRANSITIONSTART_EVENT","CHANNEL_WINDOW_UNLOAD_EVENT","CHANNEL_WINDOW_WHEEL_EVENT"]}onScrollLockEvent(e){}onSetElementToScroll(e){let{config:t,el:r,scrollElement:n}=e.payload;t=t||{},t=Ye(this.domChannelConfig,t),n=n||r;this.sendChannelPayload("CHANNEL_WINDOW_SCROLL_ELEMENT_ADDED_EVENT",{el:r},r),this.createScrollObservable(t,n).subscribe(e=>{const{action:t,payload:r,srcElement:n,event:o}=e;this.sendChannelPayload(t,r,n,o)})}bindStaticMethods(){this.createMediaQueryHandler=Kn.createMediaQueryHandler.bind(this),this.createMergedObsFromObj=Kn.createMergedObsFromObj.bind(this)}}class Qn extends zn{constructor(e={}){super("CHANNEL_LIFECYCLE",e)}addRegisteredActions(){return["CHANNEL_LIFECYCLE_RENDERED_EVENT","CHANNEL_LIFECYCLE_DISPOSED_EVENT"]}onViewStreamInfo(e){const{action:t,srcElement:r}=e,n=r;n.action=t,this.onSendEvent(t,n)}onSendEvent(e,t={}){const r=this.channelActions[e],n={};window.setTimeout(()=>this.sendChannelPayload(r,t,n,void 0),0)}}class Xn extends zn{constructor(e={}){super("CHANNEL_AI",e)}addRegisteredActions(){return["CHANNEL_AI_RENDERED_EVENT","CHANNEL_AI_DISPOSED_EVENT"]}onViewStreamInfo(e){const{action:t,srcElement:r}=e,n=r;n.action=t,this.onSendEvent(t,n)}onSendEvent(e,t={}){const r=this.channelActions[e],n={};window.setTimeout(()=>this.sendChannelPayload(r,t,n,void 0),0)}}class Jn extends zn{constructor(e,t={}){t.isProxy=!0,super(e,t),this.props=t,this.subject$=new r,this.replaySub$=new i(1),this.observer$=l(this.subject$,this.replaySub$);!0===it.debug&&this.checkIfChannelIsStillProxy(e)}getMergedSubject(e=!1){return!0===e?this.replaySub$:this.subject$}checkIfChannelIsStillProxy(e){const t=e;ht(()=>{!0!==X(t,it.listRegisteredChannels())&&console.warn(`Spyne Warning: The channel, ${t} does not appear to be registered!`)},1e3)}get replaySubject(){return this.replaySub$}get subject(){return this.subject$}}const Zn=new Map;class eo{constructor(){this.addMixins(),Zn.set("DISPATCHER",new r),this.listRegisteredChannels=eo.listRegisteredChannels.bind(this),this.getChannelsList=eo.getChannelsList.bind(this)}get map(){return Zn}static getChannelsList(){return Array.from(Zn,(e,t)=>({key:e[0],val:e[1].constructor.name}))}static listRegisteredChannels(e=!1){const t=this.getChannelsList(),r=m(U("ChannelProxy","val")),n=F(U("ChannelProxy","val")),o=(!0===e?n:r)(t);return Pe(["key"],o)}listProxyChannels(){return this.listRegisteredChannels(!0)}checkForMissingChannels(){const e=this.getChannelsList(),t=F(U("ChannelProxy","val"))(e);if(t.length>=1){const e=`Spyne Warning: The following ${1===t.length?"Channel has":"Channels have"} not been initialized: ${u(S(", "),D(b("key")))(t)}`;console.warn(e)}}init(){this.createMainStreams()}createMainStreams(){this.routeStream=new Bn,Zn.set("CHANNEL_ROUTE",this.routeStream),this.uiStream=new Yn,Zn.set("CHANNEL_UI",this.uiStream),this.domStream=new qn,Zn.set("CHANNEL_WINDOW",this.domStream),this.viewStreamLifecycle=new Qn,Zn.set("CHANNEL_LIFECYCLE",this.viewStreamLifecycle),this.aiStream=new Xn,Zn.set("CHANNEL_AI",this.aiStream),this.routeStream.initializeStream(),this.domStream.initializeStream()}addKeyEvent(e){Zn.get("UI").addKeyEvent(e)}registerStream(e){const t=e.channelName;if(Zn.has(t)){if(u(Ue(["props","isRegistered"],!0))(Zn.get(t)))return void console.warn(`Spyne Warning: The Channel, ${t}, has already been registered!`)}Zn.set(t,e),e.initializeStream()}getChannelActions(e){return Zn.get(e).addRegisteredActions()}getProxySubject(e,t=!1){const r=!0===t?"replaySubject":"subject";return Zn.get(e)[r]}testStream(e){return void 0!==Zn.get(e)}getStream(e){return!1===this.testStream(e)&&Zn.set(e,new Jn(e)),Zn.get(e)}addMixins(){}}class to{constructor(e,t="",r=!0){return this.parentContext=e,this.omittedMethods=["autoBinder","initAutoBinder","getEnhancerMethods","checkForMalformedMethods","caller","arguments","bindParentViewStream"],this.prefix=t,!0===r&&this.autoBinder(),this.allMethodsList}initAutoBinder(){this.autoBinder()}getEnhancerMethods(){return function(e,t=[]){const r=V(["length","name","prototype","constructor"],t),n=u(ae(r),q),o=n(Object.getOwnPropertyNames(e.constructor.prototype)),s=n(Object.getOwnPropertyNames(e.constructor));return{methods:o,staticMethods:s,allMethods:V(o,s)}}(this,this.omittedMethods)}checkForMalformedMethods(e){const t=it?.debug||!1;if(""===this.prefix&&t)return void console.warn(`SPYNE WARNING: The following SpyneTrait ${this.constructor.name} needs a prefix`);const r=m(e=>0===e.indexOf(this.prefix),e);if(r.length>=1&&t){const e=`Spyne Warning: The following method(s) in ${this.constructor.name} require the prefix, "${this.prefix}": [${r.join(", ")}];`;console.warn(e)}}bindParentViewStream(e,t){this.checkForMalformedMethods(e.allMethods);const r={},n=(e,n=!1)=>{const o=!0===n?this.constructor:this;"function"===typeof o[e]&&(r[e]=t[e]=o[e].bind(t))},o=He(2,n)(I,!0);return D(o,e.staticMethods),D(n,e.methods),r}autoBinder(){const e=this.getEnhancerMethods();return this.allMethodsList=this.bindParentViewStream(e,this.parentContext),this.allMethodsList}}class ro{constructor(e={},t,r,n){this._mapFn=ro.setMapFn(e),this._url=ro.setUrl(e),this._responseType=ro.setResponseType(e),this._serverOptions=ro.setServerOptions(e),this._subscriber=void 0!==t?t:e=>console.log("FETCH RETURNED ",e),this.debug=!0===e?.debug,this.disableSanitize=!0===e?.disableSanitize,this.channelName=n;const o={mapFn:this.mapFn,url:this.url,serverOptions:this.serverOptions,responseType:this.responseType,disableSanitize:this.disableSanitize,debug:this.debug};!0!==r&&ro.startWindowFetch(o,this._subscriber,this.channelName)}static startWindowFetch(e,t,r){const{mapFn:n,url:o,serverOptions:i,responseType:a,debug:c}=e,l={channelName:r,url:o,responseType:a,serverOptions:i},u=gn(!0===c?e=>{console.log("DEBUG FETCH :",e,l)}:()=>{}),h=d(window.fetch(o,i)).pipe(dn(e=>d(ro.parseResponse(e,l))),u,on((E=n,t=>{const r=!0===e?.disableSanitize?t:Wt(t,{mode:"app"});return E(r,l)})),Zr(e=>s(ro.createFetchErrorPayload(e,l))),function(e){void 0===e&&(e={});var t=e.connector,r=void 0===t?function(){return new pn}:t,n=e.resetOnError,o=void 0===n||n,s=e.resetOnComplete,i=void 0===s||s,a=e.resetOnRefCountZero,c=void 0===a||a;return function(e){var t,n,s,a=0,l=!1,d=!1,u=function(){null==n||n.unsubscribe(),n=void 0},h=function(){u(),t=s=void 0,l=d=!1},E=function(){var e=t;h(),null==e||e.unsubscribe()};return qt(function(e,p){a++,d||l||u();var N=s=null!=s?s:r();p.add(function(){0!==--a||d||l||(n=Cn(E,c))}),N.subscribe(p),!t&&a>0&&(t=new Ir({next:function(e){return N.next(e)},error:function(e){d=!0,u(),n=Cn(h,o,e),N.error(e)},complete:function(){l=!0,u(),n=Cn(h,i),N.complete()}}),kr(e).subscribe(t))})(e)}}());var E;h.subscribe(t)}static async parseResponse(e,t){const{responseType:r}=t,n=e.status,o=e.statusText,s=e.headers?.get?.("content-type")||"",i={...t,status:n,statusText:o,contentType:s,ok:e.ok};if(!0!==e.ok){const t=await ro.safeReadText(e);throw ro.createFetchError({errorType:"FETCH_HTTP_ERROR",message:`Fetch request failed with status ${n} ${o}`,metadata:i,rawBody:t})}if("json"===r)return ro.parseJsonResponse(e,i);if("text"===r)return e.text();if("blob"===r)return e.blob();if("arrayBuffer"===r)return e.arrayBuffer();if("formData"===r)return e.formData();throw ro.createFetchError({errorType:"FETCH_UNSUPPORTED_RESPONSE_TYPE",message:`Unsupported fetch responseType "${r}"`,metadata:i})}static async parseJsonResponse(e,t){const r=await e.text(),n=r.trim();if(""===n)return null;try{return JSON.parse(n)}catch(e){throw ro.createFetchError({errorType:"FETCH_RESPONSE_PARSE_ERROR",message:"Expected JSON but could not parse response body.",metadata:t,rawBody:r,originalError:e})}}static createFetchError({errorType:e,message:t,metadata:r,rawBody:n="",originalError:o}){const s=new Error(t);return s.isChannelFetchError=!0,s.errorType=e,s.metadata=r,s.rawBody=n,s.originalError=o,s}static createFetchErrorPayload(e,t){const r=e?.metadata||t||{};return{isChannelFetchError:!0,isError:!0,error:!0,errorType:e?.errorType||"FETCH_UNKNOWN_ERROR",message:e?.message||"Unknown ChannelFetchUtil error",channelName:r.channelName,url:r.url,responseType:r.responseType,status:r.status,statusText:r.statusText,contentType:r.contentType,ok:r.ok,rawBodyPreview:ro.truncateBody(e?.rawBody),originalErrorMessage:e?.originalError?.message}}static truncateBody(e="",t=500){return"string"!=typeof e?"":e.length>t?`${e.slice(0,t)}...`:e}static async safeReadText(e){try{return await e.text()}catch(e){return""}}static setMapFn(e){return u(k(e=>e),b("mapFn"))(e)}static setUrl(e){const t=b("url",e);return void 0===t&&Nt("SPYNE WARNING: URL is undefined for data channel"),t}static setResponseType(e){return k("json",b("responseType",e))}get mapFn(){return this._mapFn}get url(){return this._url}get serverOptions(){return this._serverOptions}get responseType(){return this._responseType}static stringifyBodyIfItExists(e){const t=e?.body;if(!0!==(null!==t&&"object"==typeof t&&t.constructor===Object))return e;const r=new Headers(e.headers||{});return!0!==r.has("Content-Type")&&r.set("Content-Type","application/json"),{...e,headers:r,body:JSON.stringify(t)}}static updateMethodWhenBodyExists(e){return void 0!==e?.body&&"GET"===(e?.method||"GET").toUpperCase()?(Nt("SPYNE WARNING: Fetch body was provided with method GET. Changing method to POST.",e),{...e,method:"POST"}):e}static setServerOptions(e){const t=ee(["method","headers","body","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive"],e);let r=te(ro.baseOptions(),t);return r=ro.updateMethodWhenBodyExists(r),r=ro.stringifyBodyIfItExists(r),r}static baseOptions(){return{method:"GET",headers:new Headers({Accept:"application/json, text/plain, */*"}),mode:"cors",credentials:"same-origin",cache:"default",redirect:"follow",referrerPolicy:"no-referrer-when-downgrade",integrity:"",keepalive:!1}}}class no extends zn{constructor(e,t={disableSanitize:!1}){no.validateMapMethod(t,e),void 0!==t.map&&(t.mapFn=t.map),t.extendedActionsArr=[`${e}_RESPONSE_EVENT`,`${e}_ERROR_EVENT`,[`${e}_REQUEST_EVENT`,"onFetchUpdate"]],t.sendCachedPayload=!0,super(e,t)}static validateMapMethod(e,t,r=!1){const n=P(_,e=>"function"!=typeof e),o=Ae(n),s=f([o,e=>e.length>=1]);return!u(s,N,ee(["map","mapFn"]))(e)||(!1===r&&console.warn(`Spyne Warning: The map method for ChannelFetch, ${t}, appears to be invalid`),!1)}onRegistered(e=this.props){!0!==e?.pause&&this.startFetch()}addRegisteredActions(e){const t=u(k([]),K(["props","extendedActionsArr"]));return["CHANNEL_RESPONSE_EVENT","CHANNEL_ERROR_EVENT",["CHANNEL_UPDATE_RESPONSE_EVENT","onFetchUpdate"],["CHANNEL_FETCH_REQUEST_EVENT","onFetchUpdate"]].concat(t(this))}startFetch(e={},t=this.onFetchReturned.bind(this)){const r=this.consolidateAllFetchProps(e);return new ro(r,t,!1,this.props.name)}onFetchUpdate(e){const t=this.getPropsForFetch(e);this.startFetch(t)}onFetchReturned(e){const t=!0===e?.isChannelFetchError?`${this.props.name}_ERROR_EVENT`:`${this.props.name}_RESPONSE_EVENT`;return this.createChannelPayloadItem(e,t)}createChannelPayloadItem(e,t=`${this.props.name}_RESPONSE_EVENT`){const{name:r,sendCachedPayload:n,url:o}=this.props,s={name:r,sendCachedPayload:n,url:o};this.sendChannelPayload(t,e,s)}getPropsForFetch(e){return ee(["mapFn","url","header","body","mode","method","responseType","debug"],e?.payload??e?.viewStreamInfo?.payload??{})}consolidateAllFetchProps(e,t=this.props){const r=ee(["mapFn","url","header","body","mode","disableSanitize","method","responseType","debug"],t),n=m(_);return u(n,(e,t)=>te(e,t))(r,e)}get observer(){return this.observer$}}let oo=it;class so{constructor(e={}){let{name:t,config:r,parentEl:n}=e;this.props=e,void 0===r&&(r=re(e)),this.name=t||"empty",this.props.name=t,r=so.mergeDefaultConfig(r,this.defaultConfig()),this.props.parentEl=n||so.createParentEl(),this.props.config=r,void 0!==this.props.traits&&this.addTraits(this.props.traits)}register(e){oo=e,this.props.pluginName=this.props.name,!1!==oo.initialized?(this.onBeforeRegistered(),this.props.config=re(this.props.config),oo.addPluginConfig(this.name,this.props.config),this.onRegistered(),this.onRender()):console.warn(`Spyne Warning: SpyneApp has not been initialized yet! Cannot register plugin "${this.name}".`)}get SpyneAppProperties(){return oo}static mergeDefaultConfig(e={},t=this.defaultConfig()){return Object.assign(t,e)}static getSpyneApp(e,t){!1===oo.initialized?console.warn(`Spyne Warning: Unable to install plugin, ${e}! SpyneApp has not been initialized!`):oo.addPluginConfig(e,t)}static updateSpyneConfig(e,t,r){return!0===Me(y(Object),["config","plugins",t])(e)?(!0===e.config.debug&&console.warn(`Spyne Warning: The plugin, ${t}, already exists`),!1):(e.config.plugins[t]=r,e.config.plugins[t])}static createParentEl(e){return e||document.getElementById("spyne-plugins")||(()=>{const e=new Bt({id:"spyne-plugins"});document.body.appendChild(e.render());const t=document.getElementById("spyne-plugins");return t.style.cssText="position:absolute; top:0;left:0;width:100%;height:100%;min-height:100vh;z-index:1000000; pointer-events:none",t})()}addTraits(e){"Array"!==e.constructor.name&&(e=[e]);e.forEach(e=>new e(this))}onBeforeRegistered(){this.checkForRequiredWindowEvent()}checkForRequiredWindowEvent(){const e=this.props.requiredEvents??[],t=it.getChannelConfig("WINDOW"),r=e.filter(e=>!t.events.includes(e));r.length>0&&console.warn(`plugin "${this.props.name}" requires the following config.WINDOW.events, --\x3e ${r.join(", ")} <--`)}defaultConfig(){return{}}onRegistered(){}onRender(){}}const io=new eo,ao="0.25.0";let co=new class{constructor(){this.version=ao}get channels(){return io}init(e={},t=!1){
1
+ import{fromEventPattern as e,Observable as t,Subject as r,bindCallback as n,fromEvent as o,of as s,ReplaySubject as i,forkJoin as a,EMPTY as c,merge as l,from as u}from"rxjs";import{compose as d,complement as h,isEmpty as E,head as p,values as N,isNil as _,allPass as f,reject as m,equals as T,keys as A,find as y,is as C,assoc as g,prop as v,when as b,__ as I,join as S,replace as L,flatten as O,map as D,toPairs as R,ifElse as w,always as H,concat as P,either as V,propEq as U,test as x,findLastIndex as M,last as W,filter as F,invert as $,defaultTo as k,reduce as j,zipObj as G,split as z,fromPairs as B,has as Y,path as K,uniq as q,chain as Q,includes as X,mergeRight as J,pickAll as Z,pick as ee,mergeDeepRight as te,clone as re,not as ne,mergeAll as oe,lte as se,match as ie,without as ae,mapObjIndexed as ce,pipe as le,forEachObjIndexed as ue,flip as de,propSatisfies as he,forEach as Ee,props as pe,omit as Ne,any as _e,curry as fe,where as me,F as Te,all as Ae,slice as ye,toLower as Ce,findIndex as ge,apply as ve,identity as be,objOf as Ie,view as Se,lensIndex as Le,lensProp as Oe,over as De,reverse as Re,curryN as we,toUpper as He,partialRight as Pe,pluck as Ve,pathEq as Ue,pathSatisfies as xe}from"ramda";import Me from"dompurify";class We{constructor(){this.checkIfObjIsNotEmptyOrNil=We.checkIfObjIsNotEmptyOrNil.bind(this)}static checkIfObjIsNotEmptyOrNil(e){const t=d(h(E),p,N),r=d(h(_),p,N);return f([t,r])(e)}static checkIfParamValueMatchesRegex(e,t){const r=m(T("routeName")),n=d(r,A),o=d(y(t=>x(new RegExp(t),e)),n)(t);return C(String,o)&&(t=g(e,v(o,t),t)),t}static formatStrAsWindowLocation(e){return{hash:e,search:e,pathname:e}}static getLocationStrByType(e,t=!1,r=window.location){return v({slash:"pathname",query:"search",hash:"hash"}[!0===t?"hash":e],r).replace(/^(\/)?(#)?(\/)?(.*)$/,"$4")}static createRouteArrayFromParams(e,t,r="slash",n){const o=[],s=t=>{const r={},i=t.routeName;let a=void 0!==e[i]?e[i]:v(i,n);const c=typeof t[a];"string"===c?a=t[a]:"undefined"===c&&(t=this.checkIfParamValueMatchesRegex(a,t)),r[i]=a,this.checkIfObjIsNotEmptyOrNil(r)&&o.push(r);const l=C(Object,t),u=Y(a,t),d=Y("routePath",t);if(!0===(u&&l)){const e=t[a];Y("routePath",e)&&s(e.routePath)}else!0===d&&void 0!==a&&s(t.routePath)};return s(t),o}static createSlashString(e){const t=m(_),r=b(h(_,I),S("/")),n=L(/^(\^*)(.*|^\$)(\$)$/,"$2");return d(n,r,t,O,D(N))(e)}static createQueryString(e){const t=m(_),r=this.checkIfObjIsNotEmptyOrNil,n=d(S("="),O,R),o=w(r,n,H(void 0)),s=D(o),i=b(h(E),P("?"));return d(i,S("&"),t,s)(e)}static checkPayloadForRegexOverrides(e,t,r="Value"){const n=d(e=>v(`${e}${r}`,t),p,A);return D(e=>{const t=n(e);return void 0!==t?g(d(p,A)(e),t,e):e},e)}static checkForRouteValWithMultipleVals(e){const t=e=>{const t=(t,r)=>(t[r]=(e=>{const t=e.match(/^[^|]*/);return t?"^$"===t[0]?"":t[0]:e})(e[r]),t);return"object"==typeof e&&(e=Object.keys(e).reduce(t,{})),e};return!0===Array.isArray(e)?e.map(t):e}static checkForRouteValsPartMatch(e,t={}){const r=(e,t)=>t.split("|").some(t=>((e,t)=>{const r=e.replace(/[-/\\^$+?.()|[\]{}]/g,"\\$&").replace(/\*/g,"[\\w\\d_-]*");return new RegExp(`^${r}$`).test(t)})(t,e))?e:t;return e.map(e=>{const n={...e};return Object.keys(n).forEach(e=>{Object.prototype.hasOwnProperty.call(n,e)&&t[e]&&(n[e]=r(t[e],n[e]))}),n})}static convertParamsToRoute(e,t=ct.config.channels.ROUTE,r,n){const o=void 0!==r?r:t.type,s=t.isHash,i=t.routes.routePath,a=void 0!==n?n:this.getLocationStrByType(o,s),c=this.convertRouteToParams(a,t,o).routeData;let l=this.createRouteArrayFromParams(e,i,o,c);return l=We.checkPayloadForRegexOverrides(l,e),l=We.checkForRouteValWithMultipleVals(l),"query"===o?this.createQueryString(l):this.createSlashString(l)}static findIndexOfMatchedStringOrRegex(e,t){const r=t.includes(".+"),n=L(/^$/,"^$"),o=V(U(e,"str"),d(x(I,e),v("re")));return d(M(T(!0)),D(o),D(e=>{return{str:e,re:(t=e,r&&(t.startsWith("^")||(t="^"+t),t.endsWith("$")||(t+="$")),new RegExp(t))};var t}),D(n))(t)}static checkIfValueShouldMapToParam(e,t,r){const n=d(D(W),D(F(C(String))),R)(e),o=We.findIndexOfMatchedStringOrRegex(t,n);let s=t;if(o>=0){const t=n[o],r=$(e),i=d(p,k([]),v(t))(r);!0===/^([-$\w]*)$/.test(i)&&!0===C(String,i)&&(s=i)}return s}static createArrFromSlashStr(e){return e.replace(/^([/])?(.*)$/,"$2").split("/")}static convertSlashRouteStrToParamsObj(e,t,r){const n=t,o=this.createArrFromSlashStr(t),s=[],i=[];let a=e;j((e,t)=>{const n=this.checkIfValueShouldMapToParam(a,t,r);a=this.checkIfParamValueMatchesRegex(t,a);const o=V(E,_);void 0!==a&&(e=>e!==W(s))(a.routeName)&&!1===o(n)&&(s.push(a.routeName),i.push(n));const c=K([t,"routePath"],a),l=K(["routePath"],a);void 0!==c?a=c:void 0!==l&&(a=l)},0,o);const c=G(s,i),l=this.getLastArrVal(s);return{paths:s,pathInnermost:l,routeData:c,routeValue:n}}static getLastArrVal(e){return void 0!==W(t=e)?W(t):"";var t}static createDefaultParamFromEmptyStr(e,t){const r={};return r[e.routeName]=this.checkIfValueShouldMapToParam(e,t),r}static convertQueryStrToParams(e,t,r){const n=t,o=t.replace(/^([?])?(.*)$/,"$2"),s=d(D(z("=")),z("&"))(o);let i=B(s),a=D(p,s);!0===E(t)&&(i=this.createDefaultParamFromEmptyStr(e,t,r),a=A(i));return{paths:a,pathInnermost:this.getLastArrVal(a),routeData:i,routeValue:n}}static convertRouteToParams(e,t,r){if(void 0===t)return{};const n=void 0!==r?r:t.type,o=k({},v("regexTokens",t)),s=t.routes.routePath;return"query"===n?this.convertQueryStrToParams(s,e):(e=e.replace(/\/$|$/,"/"),this.convertSlashRouteStrToParamsObj(s,e,o))}}class Fe{constructor(){this.createPopStateStream=Fe.createPopStateStream.bind(this)}static createPopStateStream(t){e(function(e){window.onpopstate=e},function(){window.onpopstate=function(){}}).subscribe(t)}static getLastArrVal(e){return void 0!==W(t=e)?W(t):"";var t}static compareRouteKeywords(e={},t){const r=(e,t)=>void 0!==t?ee(t,e):e;let n=r(e,t);return{pickValues:r,compare:(e={},t)=>{const o=r(e,t),s=e=>d(A,F(U(!0,e))),i=d(D(e=>{const t=v(e,n),r=v(e,o),s=T(t,r),i=void 0!==t,a=void 0!==r,c=!s,l=!1===i&&!0===a,u=!0===i&&!1===a,d={};return d[e]={same:s,changed:c,added:l,removed:u,previousExists:i,nextExists:a},d}),q,Q(A))([n,o]),a=Q(s("changed"),i),c=Q(s("added"),i),l=Q(s("removed"),i);return n=o,{pathsAdded:c,pathsRemoved:l,pathsChanged:a}},getComparer:()=>n}}static getRouteArrData(e,t){const r=F(X(I,e),t);return{paths:r,pathInnermost:Fe.getLastArrVal(r)}}static flattenConfigObject(e){const t=e=>Q(([e,r])=>"object"!=typeof r||null===r||Array.isArray(r)?[[e,r]]:D(([t,r])=>[`${e}.${t}`,r],t(r)),R(e));return N(B(t(e)))}static addRouteDatasets(e){const{type:t,isHash:r}=e,n=n=>{const o="query"===t?"":!0===r?"#":"/",s=We.convertParamsToRoute(n,e);return o+s.replace(/^(.*\/)([\w-]*\/?)(.*)$/gm,"$1$2")},o=/^([A-Za-z0-9_-])+$/m,s=(e=[],t,r={})=>{let{routeName:i}=t;return R(t).reduce((t,a)=>{const[c,l]=a,u=C(Object,l),d=e=>x(o,e)?(e=>String(e).replace(/([-_])/g," ").toUpperCase())(e):c;if("routeName"===c||"404"===c)return t;i=i||v("routeName",l);let h=re(r);if(h[i]=String(c).replace(/([^A-Za-z0-9-_])/g,""),!0===u){if(1===A(h).length){const e=K(["routePath","routeName"],l);if(e){const o=re(h);o[e]="",o.navLevel=A(r).length,o.title=d(c),o.href=n(o),t.push(o)}}h=s(e,l,h)}else h.title=d(c),h.href=n(h);return h.navLevel=A(r).length,t.push(h),t},[])},i=s([],e.routes);let a=O(i);a=function e(t){return t.map(t=>{for(const r in t)void 0===r||"undefined"===r||void 0===t[r]?delete t[r]:t[r]&&"object"==typeof t[r]&&!Array.isArray(t[r])&&(t[r]=e([t[r]])[0]);return t})}(a);return{routeDatasetsArr:a,routeNamesArr:(e=>{const t=m(X(I,["title","href","navLevel","undefined"]));return d(q,t,O,D(A))(e)})(a)}}static conformRouteObject(e={},t=!1){const r=K(["channels","ROUTE"],e);let{add404s:n}=void 0!==r?r:e;n=n||t;const o=e=>{const t=e[1],r=C(Array,t);return""===t?e[1]="^$":r&&(e[1]=t.join("|")),e},s=d(B,D(e=>{const[t,r]=e,i=n?{404:".+"}:{},a=C(Object,r),c=C(Array,r),l="routePath"===t;return!0===a&&!1===c&&(e[1]=s(e[1]),l&&(e[1]=d(te(i),B,D(o),R)(e[1]))),e}),R);if(void 0!==r){e.channels.ROUTE=s(e.channels.ROUTE);const t=Fe.addRouteDatasets(e.channels.ROUTE);return e.channels.ROUTE=J(e.channels.ROUTE,t),e}return s(e)}static getLocationData(){return Z(["href","origin","protocol","host","hostname","port","pathname","search","hash"],window.location)}}const $e=Object.create({}),ke=d(ne,C(Array)),je=d(f([ke,C(Object)]));function Ge(e){return e&&"object"==typeof e&&"[object RegExp]"!==Object.prototype.toString.call(e)&&"[object Date]"!==Object.prototype.toString.call(e)}function ze(e,t){return t&&!0===t.clone&&Ge(e)?Ye((r=e,Array.isArray(r)?[]:{}),e,t):e;var r}function Be(e,t,r){const n=e.slice();return t.forEach(function(t,o){void 0===n[o]?n[o]=ze(t,r):Ge(t)?n[o]=Ye(e[o],t,r):-1===e.indexOf(t)&&n.push(ze(t,r))}),n}function Ye(e,t,r){const n=Array.isArray(t),o=(r||{arrayMerge:Be}).arrayMerge||Be;return n?Array.isArray(e)?o(e,t,r):ze(t,r):function(e,t,r){const n={};return Ge(e)&&Object.keys(e).forEach(function(t){n[t]=ze(e[t],r)}),Object.keys(t).forEach(function(o){Ge(t[o])&&e[o]?n[o]=Ye(e[o],t[o],r):n[o]=ze(t[o],r)}),n}(e,t,r)}let Ke,qe,Qe,Xe;Ye.all=function(e,t){if(!Array.isArray(e)||e.length<2)throw new Error("first argument should be an array with at least two elements");return e.reduce(function(e,r){return Ye(e,r,t)})};let Je,Ze,et=!0,tt=!1;const rt=[];let nt,ot;const st=[],it=new Map;const at=new class{constructor(){$e.foo=()=>console.log("used for testing purposes.")}addMethod(e,t,r=!1){if(!0===Object.prototype.hasOwnProperty.call($e,e)){const t=`Spyne Warning: the method name, ${e}, already exists.`;if(r)return t;console.warn(t)}else $e[e]=t}addMethods(e={},t=!1){let r;if(!1===je(e))return r=`Spyne Warning: the pluginMethods property, ${JSON.stringify(e)} needs to be an object.`,t?r:void console.warn(r);return A(e).map(n=>{const o=v(n,e);if("function"==typeof o)this.addMethod(n,o,t);else{if(r=`the value for ${n} is not a valid function.`,t)return r;console.warn(r)}}).join(",")}checkIfMethodExists(e){}get pluginMethodsObj(){return $e}};const ct=new class{constructor(){Xe=!1}get channelsMap(){return Qe}get initialized(){return Xe}get config(){return Ke}get debug(){return et}get mode(){return void 0!==Ke?.mode?Ke.mode:"app"}static listChannels(){return Array.from(qe.map.keys())}initialize(e={},t={},r,n){return qe=r,Ke=Ye(e,t),Ke.channels&&Ke.channels.ROUTE&&(Ke=n.conformRouteObject(Ke)),ot=Ke?.IMG_PATH,et=void 0!==Ke.debug?Ke.debug:et,this.getChannelActions=qe.getChannelActions.bind(qe),this.listRegisteredChannels=qe.listRegisteredChannels.bind(qe),Xe=!0,this._initialized=Xe,this.setChannelsMap(),t?.baseHref&&this.setHeadBaseHref(t.baseHref),Ke}setHeadBaseHref(e){const t=document.createElement("base");t.href=e,document.head.appendChild(t)}conformRouteConfig(e=!1){Ke=Fe.conformRouteObject(Ke,e)}setChannelsMap(){const e=qe.getStream.bind(qe),t=qe.testStream.bind(qe),r=qe.getProxySubject.bind(qe);Qe={getStream:e,testStream:t,getProxySubject:r}}setProp(e,t,r=!1){return r?Ke.ephemeralProps[e]=t:Ke.tmpProps[e]=t,t}getProp(e){if(Ke?.tmpProps&&Object.prototype.hasOwnProperty.call(Ke.tmpProps,e))return Ke.tmpProps[e];if(Ke?.ephemeralProps&&Object.prototype.hasOwnProperty.call(Ke.ephemeralProps,e)){const t=Ke.ephemeralProps[e];return delete Ke.ephemeralProps[e],t}}createTempProp(e){const t=Math.random().toString(36).slice(2,8);return this.setProp(t,e,!0),t}setChannelConfig(e,t){return Ke.channels[e]=t,Ke.channels[e]}getChannelConfig(e,t=Ke){if("CHANNEL_ROUTE"===e?e="ROUTE":"CHANNEL_WINDOW"===e&&(e="WINDOW"),void 0===t||void 0===Ke.channels)return void console.warn("Spyne warning: Spyne config object is empty!");const r=Ke.channels[e];if(void 0!==r)return r;console.warn(`Spyne warning: Spyne configuration for channel, ${e} is empty!`)}registerChannel(){}addPluginConfig(e,t={}){void 0===Ke.plugins&&(Ke.plugins={}),this.addPluginMethods(t.pluginMethods),Ke.plugins[e]=t}getPluginsMethodObj(e){return e&&this.addPluginMethods(e),at.pluginMethodsObj}addPluginMethods(e){e&&at.addMethods(e)}doNotTrackChannel(e){st.push(e)}getUntrackedChannelsList(){return st}registerProxyReviver(e,t){it.set(e,t)}registerPlugin(e){this._initialized||console.warn("SpyneApp is not initialized yet. Plugin will not be fully registered."),e.register(this)}getProxyReviver(e){return it.get(e)}registerCmsRehydrator(e){Je=e}get rehydrateCmsData(){return Je}registerCmsLineageWarner(e){Ze=e}get warnUnproxiedCmsData(){return Ze}getPluginConfigByPluginName(e){return Ke.plugins[e]}get IMG_PATH(){return ot}get excludeChannelsFromConsole(){return rt}set excludeChannelsFromConsole(e){"string"==typeof e?rt.includes(e)||rt.push(e):Array.isArray(e)?e.forEach(e=>{"string"!=typeof e||rt.includes(e)||rt.push(e)}):console.warn("Invalid value provided to excludeChannelsFromConsole. Only strings or arrays are allowed.")}get linksData(){return console.warn("get links data in SpyneAppProperties is deprecated, use navLinks"),nt}set linksData(e){console.warn("set links data in SpyneAppProperties is deprecated, use navLinks")}get navLinks(){return nt}set navLinks(e){nt=e}get enableCMSProxies(){return tt}getHrefFromData(e={}){return We.convertParamsToRoute(e)}set enableCMSProxies(e=!0){tt=Boolean(e)}setCMSProxyMethod(e){this.enableCMSProxies=!0,this.formatTemplateForProxyData=e}tempGetChannelsInstance(){}tempGetConfig(){}},lt=()=>({includes:()=>!0===ct.initialized?ct.listRegisteredChannels():["CHANNEL_ROUTE","CHANNEL_UI","CHANNEL_WINDOW","DISPATCHER"]});void 0!==d&&void 0!==t&&(d(C(String),K(["data","srcElement","vsid"])),d(C(String),K(["data","srcElement","id"])));const ut=(e={},t)=>{const{__proxy__proxyName:r}=e;void 0===r&&console.error("object is not proxy object ",e);const n=(r,n)=>{const o=K(n,e),{__proxy__isProxy:s,__proxy__props:i}=o;return s?t(r,i):r},o=n(re(e),[]),s=(e,t)=>{const r=t||[];Object.entries(e).forEach(([t,o])=>{const i=(e=>{let t=typeof e;return["number","boolean","string"].includes(t)?t="primitive":"object"===t&&(Array.isArray(e)?t="array":null===e&&(t="undefined")),t})(o),a=[...r];a.push(t),"object"!==i&&"array"!==i||(e[t]=n(o,a),s(o,a))})};return s(o),o},dt=(e={})=>{const{__proxy__proxyName:t}=e;if(void 0!==t){const r=ct.getProxyReviver(t);if("function"==typeof r)return ut(e,r)}},ht=function(e,t=new WeakSet){if(null===e||"object"!=typeof e)return e;const r=dt(e);if(void 0!==r)return r;if(t.has(e))return e;if(t.add(e),Array.isArray(e))return e.map(e=>ht(e,t));const n={};return Object.entries(e).forEach(([e,r])=>{n[e]=ht(r,t)}),n},Et=(e,t)=>{const r=e?.__proxy__proxyName;if(void 0===r)return t;const n=ct.getProxyReviver(r);return"function"!=typeof n?t:n(t,e.__proxy__props)},pt=function(e,t){return Et(e,e.filter(t))},Nt=function(e,t){return Et(e,e.filter((e,r)=>!1===t(e,r)))},_t=function(e,t){const r=e.map((e,r)=>{const n=null!==e&&"object"==typeof e&&void 0!==e.__proxy__proxyName;return t(n?ht(e):e,r)});return Et(e,r)},ft=function(e,t={}){const r=ht(e);return Object.entries(t).forEach(([e,t])=>{r[e]=t}),r},mt=function(e,t=!1){const r=dt(e);if(void 0!==r)return r;if(!0===t)return ht(e);const n=C(Array),o=C(Object);var s;return!1===n(s=e)&&!0===o(s)?d(B,R,re)(e):re(e)},Tt=new WeakMap;class At{constructor(e,t,r,n,o,s){const i=e;s&&console.time(s);const a={channelName:e,action:t,srcElement:n,event:o};if(a.payload=At.deepFreeze(r),!0===ct.debug){if(Object.prototype.hasOwnProperty.call(r,"payload")){const e=JSON.stringify(r);console.warn(`Spyne Warning: the following payload contains a nested payload property which may create conflicts: Action: ${t}, ${e}`)}const e=ct.getChannelActions(i);At.validateAction(t,i,e)}a.clone=()=>oe([{payload:mt(a.payload)},a.payload,{channel:re(i)},{event:re(o)},{srcElement:n},re(a.srcElement),{action:re(a.action)}]),a.safeClone=()=>{const e=ht(a.payload);return oe([{payload:e},e,{channel:i},{event:o},{srcElement:n},a.srcElement,{action:a.action}])};const c={$dir:{get:()=>a._dir,set:e=>(a._dir=e,e)}};return"CHANNEL_ROUTE"===i&&(c.location={get:()=>At.getLocationData()}),a._dir=void 0,Object.defineProperties(a,c),s&&console.timeEnd(s),a}static validateAction(e,t,r){const n=X(e,r);return!1===n&&!0===ct.initialized&&console.warn(`warning: Action: '${e}' is not registered within the ${t} channel!`),n}static getLocationData(){return Z(["href","origin","protocol","host","hostname","port","pathname","search","hash"],window.location)}static getStreamItem(){}static deepClone(e){const t=C(Array),r=C(Object);var n;return!1===t(n=e)&&!0===r(n)?d(B,R,re)(e):re(e)}static createReadOnlyProxyFacade(e){if(Tt.has(e))return Tt.get(e);const t=e=>(!0===ct.debug&&console.warn(`Spyne Warning: blocked write of '${String(e)}' on read-only channel payload data; use e.safeClone() for a writable copy`),!0),r=new Proxy(e,{get(e,t){const r=e[t];return null!==r&&"object"==typeof r&&!0===r.__proxy__isProxy?At.createReadOnlyProxyFacade(r):r},set:(e,r)=>t(r),defineProperty:(e,r)=>t(r),deleteProperty:(e,r)=>t(r)});return Tt.set(e,r),r}static deepFreeze(e){const t=d(se(0),k(-1),v("nodeType"));if(null!==e&&"object"==typeof e&&!0===e.__proxy__isProxy)return At.createReadOnlyProxyFacade(e);try{Object.getOwnPropertyNames(e).forEach(function(r){const n=e[r];if(Object.prototype.hasOwnProperty.call(e,r)&&!1===t(n)&&null!==n&&("object"==typeof n||"function"==typeof n)&&!Object.isFrozen(n)){const t=At.deepFreeze(n);t!==n&&(e[r]=t)}}),Object.freeze(e)}catch(t){return e}return e}static getMouseEventKeys(){return["altKey","bubbles","cancelBubble","cancelable","clientX","clientY","composed","ctrlKey","currentTarget","defaultPrevented","detail","eventPhase","fromElement","isTrusted","layerX","layerY","metaKey","movementX","movementY","offsetX","offsetY","pageX","pageY","path","relatedTarget","returnValue","screenX","screenY","shiftKey","sourceCapabilities","srcElement","target","timeStamp","toElement","type","view","which","x","y"]}}function yt(){return{createpropsMap:function(){const e=new WeakMap,t={vsid:this.props.vsid};return e.set(t,this.props),{key:t,weakMap:e}},gc:function(){for(const e in this)delete this[e]},createId:function(){return Math.random().toString(36).replace(/\d/gm,"").substring(1,8)},setTraceFunc:function(e){return!0===e?console.log:()=>{}}}}const Ct=async(e,t)=>{window.setTimeout(async()=>{var t;await(t=1,new Promise(e=>setTimeout(e,t))),window.requestAnimationFrame(e)},t)},gt=e=>{if(void 0!==e.constructor.name)return e.constructor.name;const t=e.toString();return k(String(t).substr(0,12),ie(/^(function\s)(\w+)(\(.*)$/,t)[2])},vt=e=>{const t=d(h(E),p,N),r=d(h(_),p,N);return f([t,r])(e)};const bt=(...e)=>{!0!==("undefined"!=typeof window&&!0===window.SPYNE_SUPPRESS_WARNINGS)&&console.warn(...e)},It=(e=!0)=>{"undefined"!=typeof window&&(window.SPYNE_SUPPRESS_WARNINGS=!0===e)};let St,Lt=!1,Ot=!1;const Dt=/^(?:(?:https?|mailto|tel):|data:image\/|(?![a-z][a-z0-9+.-]*:)[\s\S]*$)/i,Rt=e=>String(e).replace(/[\u0000-\u0020]/g,""),wt=e=>Dt.test(Rt(e)),Ht=/^spyne-[a-z][a-z0-9-]*$/i,Pt=[],Vt=(e=[])=>{(Array.isArray(e)?e:[e]).forEach(e=>{if(e instanceof RegExp)return void Pt.push(e);const t=String(e).toLowerCase();!0===/^[a-z][a-z0-9]*-[a-z0-9-]+$/.test(t)?Pt.push(t):bt(`SPYNE WARNING: "${e}" is not a valid custom element name (a hyphen is required) and was not added to the sanitizer allowlist.`)})},Ut={tagNameCheck:e=>!!Ht.test(e)||Pt.some(t=>t instanceof RegExp?t.test(e):t===e),attributeNameCheck:/^data-[a-z0-9-]+$/i,allowCustomizedBuiltInElements:!1},xt={ALLOWED_TAGS:["a","b","i","em","strong","u","p","br","ul","dl","dt","dd","ol","li","hr","blockquote","pre","code","span","div","section","article","aside","header","footer","h1","h2","h3","h4","h5","h6","table","thead","tbody","tr","td","th","img","figure","figcaption","video","source","iframe","input","button","label","link"],ADD_TAGS:["iframe","input","button","link"],ALLOWED_ATTR:["href","src","alt","class","title","width","height","style","target","rel","controls","poster","type","rows","cols","sandbox"],ALLOW_DATA_ATTR:!0,FORBID_ATTR:["onerror","onload","onclick","onmouseover","onfocus","onblur","onchange"],FORBID_TAGS:["script","object","embed","meta"],ALLOWED_URI_REGEXP:Dt,CUSTOM_ELEMENT_HANDLING:Ut},Mt={FORBID_TAGS:["script","iframe","object","embed","form","input","button","link","meta"],FORBID_ATTR:["onerror","onload","onclick","onmouseover","onfocus","onblur","onchange"],ALLOW_DATA_ATTR:!1,ALLOWED_URI_REGEXP:Dt,CUSTOM_ELEMENT_HANDLING:Ut};let Wt={allow:void 0,allowedOrigins:[],sandbox:"allow-scripts allow-same-origin allow-popups"},Ft=Wt;const $t=e=>e?{allow:void 0!==e.allow?e.allow:Wt.allow,allowedOrigins:void 0!==e.allowedOrigins?e.allowedOrigins:Wt.allowedOrigins,sandbox:void 0!==e.sandbox?e.sandbox:Wt.sandbox}:Wt,kt=(e,t=Ft)=>{const r=Rt(e);let n;try{n=new URL(r,window.location.href)}catch(e){return!1}if(n.origin===window.location.origin&&"null"!==n.origin)return!0;var o;if(!0!==("https:"===n.protocol||"http:"===n.protocol&&("localhost"===(o=n.hostname)||"127.0.0.1"===o||"[::1]"===o||o.endsWith(".localhost"))))return!1;const s=t.allowedOrigins;return!Array.isArray(s)||0===s.length||s.some(e=>{try{return new URL(e).origin===n.origin}catch(e){return!1}})};let jt=!1;const Gt=["_self","_parent","_top"];let zt={allowTarget:!0,addNoopener:!0,allowedDomains:[]},Bt=zt;const Yt=e=>e?{allowTarget:void 0!==e.allowTarget?!0===e.allowTarget:zt.allowTarget,addNoopener:void 0!==e.addNoopener?!0===e.addNoopener:zt.addNoopener,allowedDomains:void 0!==e.allowedDomains?e.allowedDomains:zt.allowedDomains}:zt,Kt=(e,t=Bt)=>{const r=Rt(e);if(/^(mailto|tel):/i.test(r))return!0;let n;try{n=new URL(r,window.location.href)}catch(e){return!1}if(n.origin===window.location.origin&&"null"!==n.origin)return!0;if(!0!==/^https?:$/.test(n.protocol))return!1;const o=t.allowedDomains;return!Array.isArray(o)||0===o.length||o.some(e=>{try{return new URL(e).origin===n.origin}catch(e){return!1}})},qt=e=>{const t=e.getAttribute("rel")||"",r=new Set(t.split(/\s+/).filter(Boolean));r.add("noopener"),r.add("noreferrer"),e.setAttribute("rel",Array.from(r).join(" "))};let Qt=!1;const Xt=["richtext","authoring","development"],Jt=()=>{const e=ct?.mode;if(Xt.includes(e))return"richtext";if("app"===e)return"app";try{if("undefined"!=typeof process&&"development"===process?.env?.NODE_ENV)return"richtext"}catch(e){}return"app"},Zt=e=>{const t="richtext"===e?xt:Mt,r=((e,t=Ft)=>void 0===t.allow?"richtext"===e:!0===t.allow)(e);if("richtext"===e&&!0!==r)return{...t,ALLOWED_TAGS:t.ALLOWED_TAGS.filter(e=>"iframe"!==e),ADD_TAGS:t.ADD_TAGS.filter(e=>"iframe"!==e),FORBID_TAGS:[...t.FORBID_TAGS,"iframe"]};if("app"===e){const e={...t},n=[];return!0===r&&(e.FORBID_TAGS=t.FORBID_TAGS.filter(e=>"iframe"!==e),e.ADD_TAGS=["iframe"],n.push("sandbox")),!0===Bt.allowTarget&&n.push("target","rel"),n.length>0&&(e.ADD_ATTR=n),e}return t};function er(e="app"){const t=Zt(e);return e=>Me.sanitize(e,t)}const tr=(e={})=>{if(Lt)return void bt("sanitizeData is already configured. Reconfiguration is not allowed.");const{strict:t=!1,disableSanitize:r=!1,iframes:n,customElements:o,anchors:s,allowTargetAttr:i,addNoopener:a}=e;Ot=!0===r,void 0!==o&&Vt(o),n&&"object"==typeof n&&(Wt=$t(n),Ft=Wt),zt=Yt({allowTarget:void 0!==s?.allowTarget?s.allowTarget:i,addNoopener:void 0!==s?.addNoopener?s.addNoopener:a,allowedDomains:s?.allowedDomains}),Bt=zt,Ot?console.warn("SPYNE SECURITY WARNING: All data sanitization is DISABLED via config.disableSanitize. Do not use this setting in production."):(jt||(jt=!0,Me.addHook("afterSanitizeAttributes",e=>{if(!e||"IFRAME"!==e.tagName)return;const t=e.getAttribute("src")||"";""!==t&&!0!==kt(t)&&(bt(`SPYNE WARNING: iframe src "${t}" was removed by the iframe policy (same-origin, https, or an allowed origin is required).`),e.removeAttribute("src"));const{sandbox:r}=Ft;!1!==r&&!0!==e.hasAttribute("sandbox")&&e.setAttribute("sandbox",r)})),Qt||(Qt=!0,Me.addHook("afterSanitizeAttributes",e=>{if(!e||"function"!=typeof e.getAttribute)return;if("A"!==e.tagName)return;const t=Bt,r=e.getAttribute("href");r&&t.allowedDomains.length>0&&!0!==Kt(r,t)&&(bt(`SPYNE WARNING: anchor href "${r}" was removed by the anchor policy (same-origin or an allowed domain is required).`),e.removeAttribute("href"));const n=e.getAttribute("target");n&&(!0===t.allowTarget&&e.getAttribute("href")?!0!==Gt.includes(n)&&!0===t.addNoopener&&qt(e):e.removeAttribute("target"))})));const c=e=>{const t=er(e),r=e=>{if(Array.isArray(e))return e.map(r);if(e&&"object"==typeof e){const n={};for(const[o,s]of Object.entries(e))n[o]="string"==typeof s?t(s):r(s);return n}return"string"==typeof e?t(e):e};return r};St=(e,r={})=>{const{disableSanitize:n=!1,mode:o,iframes:s,anchors:i}=r;if(Ot||n)return e;const a=o||(t?"app":Jt());Ft=$t(s),Bt=Yt(i);try{return c(a)(e)}finally{Ft=Wt,Bt=zt}},tr.sanitizeDataForce=(e,t)=>{if(Ot)return e;const r=t||Jt();return c(r)(e)},Lt=!0},rr=(e,t={})=>{if(!Lt)throw new Error("sanitizeData is not configured. Call sanitizeDataConfigure() first.");return St(e,t)},nr=["href","src","action","formaction","ping","poster","cite","codebase","manifest","icon","background"],or=(e,t)=>{if(!e||Ot)return;const r=er(t||Jt()),n=/<(?:script|object|embed|form|input|button|link|meta)[^>]*>|on\w+=|javascript:/i;if("string"==typeof e.value&&n.test(e.value)){const t=r(e.value);t!==e.value&&(e.value=t)}if(e.isContentEditable&&"string"==typeof e.innerHTML&&n.test(e.innerHTML)){const t=r(e.innerHTML);t!==e.innerHTML&&(e.innerHTML=t)}};let sr,ir=!1;const ar=e=>{if(!ir)throw new Error("sanitizeHTML is not configured. Call sanitizeHTMLConfigure() with appropriate config.");return sr(e)};class cr{constructor(e,t={},r={}){if(this.template=this.formatTemplate(e),this.isProxyData=!0===t.__cms__isProxy,this.testMode=r?.testMode,!1===this.isProxyData&&!0===ct.enableCMSProxies){const e=ct.rehydrateCmsData?.(t);void 0!==e?(t=e,this.isProxyData=!0):!0===cr.templateBindsProxiedChild(t,this.template)?this.isProxyData=!0:!0===ct.debug&&ct.warnUnproxiedCmsData?.(t,this.template)}if(this.template=cr.normalizeTripleBrackets(this.template),!0===this.isProxyData){const e=!0===ct.enableCMSProxies?ct.formatTemplateForProxyData:cr.formatTemplateForProxyData;"function"==typeof e&&(this.template=e(this.template))}(()=>{!0===C(Array,t)&&(t={spyneData:t},this.template=this.template.replace("{{/}}","{{/spyneData}}"),this.template=this.template.replace("{{#}}","{{#spyneData}}"))})(),this.templateData=t,this.currentOuterLoopData=null;const n=cr.getStringArray(this.template);let o=this.template.match(cr.findTmplLoopsRE());o=null===o?[]:o;const s=cr.parseTmplLoopsRE(),i=this.parseTheTmplLoop.bind(this),a=X(I,o),c=w(a,e=>e.replace(s,i),this.addParams.bind(this));this.finalArr=n.map(c)}static isPrimitiveTag(e){return/({{\.\*?}})/.test(e)}static templateBindsProxiedChild(e,t){if(null===e||"object"!=typeof e||"string"!=typeof t)return!1;if(-1===t.indexOf("{{"))return!1;const r=Object.keys(e);for(let n=0;n<r.length;n++){const o=r[n],s=e[o];if(null!==s&&"object"==typeof s&&!0===s.__cms__isProxy&&(-1!==t.indexOf(`{{${o}.`)||-1!==t.indexOf(`{{#${o}}}`)||-1!==t.indexOf(`{{#${o}.`)))return!0}return!1}static hasProxiedChild(e){if(null===e||"object"!=typeof e)return!1;const t=Object.values(e);for(let e=0;e<t.length;e++){const r=t[e];if(null!==r&&"object"==typeof r&&!0===r.__cms__isProxy)return!0}return!1}static normalizeTripleBrackets(e){return"string"!=typeof e||-1===e.indexOf("{{{")?e:e.replace(/\{\{\{([^{}]+?)\}\}\}/g,"{{$1}}")}static getNestedDataReducer(e={},t=""){return/(\.)/gm.test(String(t))?String(t).split(".").reduce((e,t)=>e[t]?e[t]:"string"==typeof e?e:"",e):e[t]??""}static getStringArray(e){const t=e.split(cr.findTmplLoopsRE()),r=/^([\\n\s\W]+)$/,n=t.filter((e,t)=>!(t>=2&&(t-2)%3==0));return m(e=>e.match(r),n)}static findTmplLoopsRE(){return/({{#([\w.]+)}}[\w\n\s\W]+?{{\/\2}})/gm}static parseTmplLoopsRE(){return/({{#([\w.]+)}})([\w\n\s\W]+?)({{\/\2}})/gm}static innerLoopRE(){return/({{#([\w.]+)}})([\w\n\s\W]+?)({{\/\2}})/gm}static swapParamsForTagsRE(){return/({{)(.*?)(}})/gm}static hasLoop(e){return cr.innerLoopRE().test(e)}removeThis(){void 0!==this&&(this.finalArr=void 0,this.templateData=void 0,this.template=void 0)}static stripInertCmsItems(e){if(-1===e.indexOf('data-cms-id=""'))return e;return e.replace(/<spyne-cms-item data-cms-id=""[^>]*>[\s\S]*?<spyne-cms-item-text>([\s\S]*?)<\/spyne-cms-item-text>\s*<\/spyne-cms-item>/g,"$1")}renderDocFrag(){let e=cr.replaceImgPath(this.finalArr.join(""));!0===this.isProxyData&&(e=cr.stripInertCmsItems(e)),!0!==this.testMode&&(e=ar(e));const t=/^([^>]*?)(<){1}(\b)(thead|col|colgroup|tbody|td|tfoot|tr|th)(\b)([^\0]*)$/.test(e)?e:document.createRange().createContextualFragment(e);return window.setTimeout(this.removeThis,2),t}renderToString(){let e=this.finalArr.join("");return e=cr.replaceImgPath(e),!0===this.isProxyData&&(e=cr.stripInertCmsItems(e)),!0!==this.testMode&&(e=String(ar(e))),window.setTimeout(this.removeThis,2),e}getTemplateString(){return this.finalArr.join("")}formatTemplate(e){return!0===["SCRIPT","TEMPLATE"].includes(v("nodeName",e))?e.innerHTML:e}getDataValFromPathStr(e,t){const r=String(e).split(".");return K(r,t)||""}addParams(e){return e.replace(cr.swapParamsForTagsRE(),(e,t,r,n)=>cr.getNestedDataReducer(this.templateData,r))}static replaceImgPath(e){const{IMG_PATH:t}=ct;return void 0!==t?(e=e.replaceAll(/src\s*=\s*(['"])imgs\//g,`src=$1${t}`)).replaceAll(/url\(\s*(['"]?)imgs\//g,`url($1${t}`):e}processInnerLoop(e,t){const r=cr.innerLoopRE();return e.replace(r,(e,r,n,o)=>{!0===cr.hasLoop(o)&&(!0===ct.debug&&!0!==this.testMode&&console.warn(`Spyne Warning: DomElementTemplate supports one level of nested array loops. A deeper nested loop was detected inside "{{#${n}}}". Consider restructuring via nested ViewStreams instead.`),o=o.replace(/{{[#/][\w.]+}}/g,""));const s=cr.getNestedDataReducer(t,n);if(!0===_(s)||E(s))return"";const i=Array.isArray(s)?s:[s],a=this.currentOuterLoopData;this.currentOuterLoopData=s;const c=i.map((e,t)=>this.substituteForItem(o,e,t)).join("");return this.currentOuterLoopData=a,c})}substituteForItem(e,t,r){if("string"==typeof t){if(cr.isPrimitiveTag(e)){const r=t.replace(/\$/g,"$$$$");return e.replace(cr.swapParamsForTagsRE(),r)}const n=this.buildStringItemContext(t,r);return this.substituteObject(e,n)}const n=this.buildItemContext(t,r);return this.substituteObject(e,n)}buildStringItemContext(e,t){const r={spyneLoopKey:e,loopIndex:t,loopNum:t+1};if(!0===this.isProxyData){const t=this.currentOuterLoopData;if(t&&"object"==typeof t){r.__cms__dataId=t.__cms__dataId||"";const n=`__cms__keyFor_${e}`;r.origKey=void 0!==t[n]?t[n]:""}else r.__cms__dataId="",r.origKey=""}return r}buildItemContext(e,t){const r=Object.assign({},e,{loopIndex:t,loopNum:t+1});return!0===this.isProxyData&&(r.__cms__dataId=e.__cms__dataId,r.spyneLoopKey=e,r.loopIndex=t,r.loopNum=t+1),r}substituteObject(e,t){const r=/(\.)/gm,n={loopIndex:t.loopIndex,loopNum:t.loopNum};return e.replace(cr.swapParamsForTagsRE(),(e,o,s)=>void 0!==n[s]?n[s]:!1===r.test(s)&&void 0!==t[s]?t[s]:this.getDataValFromPathStr(s,t))}parseTheTmplLoop(e,t,r,n){const o=n,s=cr.getNestedDataReducer(this.templateData,r);if(!0===_(s)||E(s))return"";const i=this.currentOuterLoopData;this.currentOuterLoopData=s;const a=Array.isArray(s)?s:[s],c=cr.hasLoop(o),l=a.map((e,t)=>{const r=c?this.processInnerLoop(o,e):o;return this.substituteForItem(r,e,t)}).join("");return this.currentOuterLoopData=i,l}}class lr{constructor(e={},t=!1){var r,n;e.tagName=(r="div",n=e.tagName,k(r)(n)),e.attributes=void 0!==e.attributes?e.attributes:this.getDomAttributes(e),e.attrs=this.updateAttrs(e.attributes),e.fragment=document.createDocumentFragment(),this.testMode=t,this.props=e,this.addMixins()}setProp(e,t){this.props[e]=t}getProp(e){return this.props[e]}get el(){return this.props.el}setElAttrs(e,t){const r=!0===this.testMode;return this.getProp("attrs").forEach((t,n)=>{const o=(t,r)=>{e.dataset[r]=t};if("dataset"!==n){if(!0!==r){const{allowed:r,value:o}=((e,t,r)=>{if(Ot)return{allowed:!0,value:t};const n=String(e).toLowerCase(),o=String(r||"").toUpperCase();if(n.startsWith("on"))return{allowed:!1,value:t};if("srcdoc"===n){const e=Zt(Jt());return{allowed:!0,value:Me.sanitize(String(t),e)}}return"IFRAME"===o&&"src"===n?{allowed:kt(t,Wt),value:t}:"A"===o&&"href"===n?!0!==wt(t)||zt.allowedDomains.length>0&&!0!==Kt(t,zt)?{allowed:!1,value:t}:{allowed:!0,value:t}:nr.includes(n)&&!0!==wt(t)?{allowed:!1,value:t}:{allowed:!0,value:t}})(n,t,e.tagName);if(!0!==r)return void bt(`SPYNE WARNING: The attribute "${n}" was removed during sanitization.`,e);t=o}e.setAttribute(n,t)}else ue(o,t)}),!0!==r&&(e=>{if(Ot||!e)return e;if("IFRAME"===e.tagName){const{sandbox:t}=Wt;!1!==t&&!0!==e.hasAttribute("sandbox")&&e.setAttribute("sandbox",t)}if("A"===e.tagName){const t=zt,r=e.getAttribute("target");r&&(!0===t.allowTarget&&e.getAttribute("href")?!0!==Gt.includes(r)&&!0===t.addNoopener&&qt(e):e.removeAttribute("target"))}})(e),e}updateAttrs(e,t){const r=void 0!==t?t:new Map;return ce((e,t)=>r.set(t,e),e),r}addTemplate(e){const t=this.getProp("template");return void 0!==t?(t=>{let r=this.getProp("data");r=C(Object,r)?r:{};const n=new cr(t,r,{testMode:this?.testMode}).renderDocFrag();return C(String,n)?e.innerHTML=n:e.appendChild(n),e})(t):e}createElement(e="div"){return document.createElement(e)}addContent(e){const t=this.getProp("data");if(!0===C(String,t)){const r=document.createTextNode(t);e.appendChild(r)}return e}execute(){const e=le(this.createElement.bind(this),this.setElAttrs.bind(this),this.addTemplate.bind(this),this.addContent.bind(this))(this.getProp("tagName"));this.props.el=e}render(){return this.execute(),this.props.template=void 0,this.props.data=void 0,this.props.attributes=void 0,this.getProp("el")}renderToHTMLString(){return this.execute(),this.props.template=void 0,this.props.data=void 0,this.props.attributes=void 0,this.getProp("el").outerHTML}returnIfDefined(e,t){if(void 0!==t){const r=void 0===t;e[t]=!1===r?t:Ye(e[t],t)}}updateprops(e){return this.returnIfDefined(this.props,e),this}updatepropsAndRun(e){return this.updateprops(e),this.execute(),this.getProp("fragment")}unmount(){void 0!==this.props&&(this.getProp("el").remove(),this.props=void 0,this.gc())}updateTag(e="div"){this.updateprops(e)}updateAttributes(e={}){this.updateprops(e)}updateTemplate(e){this.updateprops(e)}updateData(e={}){this.updateprops(e)}addTagAndRender(e="div"){this.updatepropsAndRun(e)}addAttrsibutesAndRender(e={}){this.updatepropsAndRun(e)}addTemplateAndRender(e){this.updatepropsAndRun(e)}addDataAndRender(e={}){this.updatepropsAndRun(e)}addMixins(){const e=yt();this.gc=e.gc.bind(this)}getDomAttributes(e){return ee(this.attributesArray,e)}get attributesArray(){return["accept","accept-charset","accesskey","action","align","allow","alt","async","autocapitalize","autocomplete","autofocus","autoplay","bgcolor","border","buffered","challenge","charset","checked","cite","class","code","codebase","color","cols","colspan","content","contenteditable","contextmenu","controls","coords","crossorigin","csp","dataset","datetime","decoding","default","defer","dir","dirname","disabled","download","draggable","dropzone","enctype","for","form","formaction","headers","height","hidden","high","href","hreflang","http-equiv","icon","id","importance","integrity","ismap","itemprop","keytype","kind","label","lang","language","lazyload","list","loop","low","manifest","max","maxlength","minlength","media","method","min","multiple","muted","name","novalidate","open","optimum","pattern","ping","placeholder","poster","preload","radiogroup","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","sandbox","scope","scoped","selected","shape","size","sizes","slot","span","spellcheck","src","srcdoc","srclang","srcset","start","step","style","summary","tabindex","target","title","translate","type","usemap","value","width","wrap"]}}const ur=(e=!1,t=1,r="ease",n=!1)=>`${!0===n?"opacity:0;":""}transition: opacity ${t}s ${r}; opacity: ${!0===e?1:0};`;function dr(e){return"function"==typeof e}function hr(e){return function(t){if(function(e){return dr(null==e?void 0:e.lift)}(t))return t.lift(function(t){try{return e(t,this)}catch(e){this.error(e)}});throw new TypeError("Unable to lift unknown Observable type")}}var Er=function(e,t){return Er=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},Er(e,t)};function pr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}Er(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function Nr(e,t,r,n){return new(r||(r=Promise))(function(o,s){function i(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(i,a)}c((n=n.apply(e,t||[])).next())})}function _r(e,t){var r,n,o,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=a(0),i.throw=a(1),i.return=a(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function fr(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function mr(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,s=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=s.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return i}function Tr(e,t,r){if(r||2===arguments.length)for(var n,o=0,s=t.length;o<s;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}function Ar(e){return this instanceof Ar?(this.v=e,this):new Ar(e)}function yr(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,o=r.apply(e,t||[]),s=[];return n=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),i("next"),i("throw"),i("return",function(e){return function(t){return Promise.resolve(t).then(e,l)}}),n[Symbol.asyncIterator]=function(){return this},n;function i(e,t){o[e]&&(n[e]=function(t){return new Promise(function(r,n){s.push([e,t,r,n])>1||a(e,t)})},t&&(n[e]=t(n[e])))}function a(e,t){try{(r=o[e](t)).value instanceof Ar?Promise.resolve(r.value.v).then(c,l):u(s[0][2],r)}catch(e){u(s[0][3],e)}var r}function c(e){a("next",e)}function l(e){a("throw",e)}function u(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}}function Cr(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=fr(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise(function(n,o){(function(e,t,r,n){Promise.resolve(n).then(function(t){e({value:t,done:r})},t)})(n,o,(t=e[r](t)).done,t.value)})}}}"function"==typeof SuppressedError&&SuppressedError;var gr=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function vr(e){return dr(null==e?void 0:e.then)}function br(e){var t=e(function(e){Error.call(e),e.stack=(new Error).stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var Ir=br(function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map(function(e,t){return t+1+") "+e.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}});function Sr(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var Lr=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,r,n,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var i=fr(s),a=i.next();!a.done;a=i.next()){a.value.remove(this)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}else s.remove(this);var c=this.initialTeardown;if(dr(c))try{c()}catch(e){o=e instanceof Ir?e.errors:[e]}var l=this._finalizers;if(l){this._finalizers=null;try{for(var u=fr(l),d=u.next();!d.done;d=u.next()){var h=d.value;try{Rr(h)}catch(e){o=null!=o?o:[],e instanceof Ir?o=Tr(Tr([],mr(o)),mr(e.errors)):o.push(e)}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}}if(o)throw new Ir(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)Rr(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&Sr(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&Sr(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}(),Or=Lr.EMPTY;function Dr(e){return e instanceof Lr||e&&"closed"in e&&dr(e.remove)&&dr(e.add)&&dr(e.unsubscribe)}function Rr(e){dr(e)?e():e.unsubscribe()}var wr={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Hr={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=Hr.delegate;return(null==o?void 0:o.setTimeout)?o.setTimeout.apply(o,Tr([e,t],mr(r))):setTimeout.apply(void 0,Tr([e,t],mr(r)))},clearTimeout:function(e){var t=Hr.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function Pr(e){Hr.setTimeout(function(){throw e})}function Vr(){}var Ur=xr("C",void 0,void 0);function xr(e,t,r){return{kind:e,value:t,error:r}}function Mr(e){e()}var Wr=function(e){function t(t){var r=e.call(this)||this;return r.isStopped=!1,t?(r.destination=t,Dr(t)&&t.add(r)):r.destination=Br,r}return pr(t,e),t.create=function(e,t,r){return new jr(e,t,r)},t.prototype.next=function(e){this.isStopped?zr(function(e){return xr("N",e,void 0)}(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?zr(xr("E",void 0,e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?zr(Ur,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(Lr),Fr=Function.prototype.bind;function $r(e,t){return Fr.call(e,t)}var kr=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){Gr(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){Gr(e)}else Gr(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){Gr(e)}},e}(),jr=function(e){function t(t,r,n){var o,s,i=e.call(this)||this;dr(t)||!t?o={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:i&&wr.useDeprecatedNextContext?((s=Object.create(t)).unsubscribe=function(){return i.unsubscribe()},o={next:t.next&&$r(t.next,s),error:t.error&&$r(t.error,s),complete:t.complete&&$r(t.complete,s)}):o=t;return i.destination=new kr(o),i}return pr(t,e),t}(Wr);function Gr(e){Pr(e)}function zr(e,t){var r=wr.onStoppedNotification;r&&Hr.setTimeout(function(){return r(e,t)})}var Br={closed:!0,next:Vr,error:function(e){throw e},complete:Vr},Yr="function"==typeof Symbol&&Symbol.observable||"@@observable";function Kr(e){return e}function qr(e){return 0===e.length?Kr:1===e.length?e[0]:function(t){return e.reduce(function(e,t){return t(e)},t)}}var Qr=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var n,o=this,s=(n=e)&&n instanceof Wr||function(e){return e&&dr(e.next)&&dr(e.error)&&dr(e.complete)}(n)&&Dr(n)?e:new jr(e,t,r);return Mr(function(){var e=o,t=e.operator,r=e.source;s.add(t?t.call(s,r):r?o._subscribe(s):o._trySubscribe(s))}),s},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=Xr(t))(function(t,n){var o=new jr({next:function(t){try{e(t)}catch(e){n(e),o.unsubscribe()}},error:n,complete:t});r.subscribe(o)})},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[Yr]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return qr(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=Xr(e))(function(e,r){var n;t.subscribe(function(e){return n=e},function(e){return r(e)},function(){return e(n)})})},e.create=function(t){return new e(t)},e}();function Xr(e){var t;return null!==(t=null!=e?e:wr.Promise)&&void 0!==t?t:Promise}function Jr(e){return dr(e[Yr])}function Zr(e){return Symbol.asyncIterator&&dr(null==e?void 0:e[Symbol.asyncIterator])}function en(e){return new TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var tn="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function rn(e){return dr(null==e?void 0:e[tn])}function nn(e){return yr(this,arguments,function(){var t,r,n;return _r(this,function(o){switch(o.label){case 0:t=e.getReader(),o.label=1;case 1:o.trys.push([1,,9,10]),o.label=2;case 2:return[4,Ar(t.read())];case 3:return r=o.sent(),n=r.value,r.done?[4,Ar(void 0)]:[3,5];case 4:return[2,o.sent()];case 5:return[4,Ar(n)];case 6:return[4,o.sent()];case 7:return o.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function on(e){return dr(null==e?void 0:e.getReader)}function sn(e){if(e instanceof Qr)return e;if(null!=e){if(Jr(e))return o=e,new Qr(function(e){var t=o[Yr]();if(dr(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")});if(gr(e))return n=e,new Qr(function(e){for(var t=0;t<n.length&&!e.closed;t++)e.next(n[t]);e.complete()});if(vr(e))return r=e,new Qr(function(e){r.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,Pr)});if(Zr(e))return an(e);if(rn(e))return t=e,new Qr(function(e){var r,n;try{for(var o=fr(t),s=o.next();!s.done;s=o.next()){var i=s.value;if(e.next(i),e.closed)return}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}e.complete()});if(on(e))return an(nn(e))}var t,r,n,o;throw en(e)}function an(e){return new Qr(function(t){(function(e,t){var r,n,o,s;return Nr(this,void 0,void 0,function(){var i,a;return _r(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),r=Cr(e),c.label=1;case 1:return[4,r.next()];case 2:if((n=c.sent()).done)return[3,4];if(i=n.value,t.next(i),t.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),o={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),n&&!n.done&&(s=r.return)?[4,s.call(r)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})})(e,t).catch(function(e){return t.error(e)})})}function cn(e,t,r,n,o){return new ln(e,t,r,n,o)}var ln=function(e){function t(t,r,n,o,s,i){var a=e.call(this,t)||this;return a.onFinalize=s,a.shouldUnsubscribe=i,a._next=r?function(e){try{r(e)}catch(e){t.error(e)}}:e.prototype._next,a._error=o?function(e){try{o(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,a._complete=n?function(){try{n()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,a}return pr(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(Wr),un=function(e){function t(t,r){return e.call(this)||this}return pr(t,e),t.prototype.schedule=function(e,t){return this},t}(Lr),dn={setInterval:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=dn.delegate;return(null==o?void 0:o.setInterval)?o.setInterval.apply(o,Tr([e,t],mr(r))):setInterval.apply(void 0,Tr([e,t],mr(r)))},clearInterval:function(e){var t=dn.delegate;return((null==t?void 0:t.clearInterval)||clearInterval)(e)},delegate:void 0},hn=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n.pending=!1,n}return pr(t,e),t.prototype.schedule=function(e,t){var r;if(void 0===t&&(t=0),this.closed)return this;this.state=e;var n=this.id,o=this.scheduler;return null!=n&&(this.id=this.recycleAsyncId(o,n,t)),this.pending=!0,this.delay=t,this.id=null!==(r=this.id)&&void 0!==r?r:this.requestAsyncId(o,this.id,t),this},t.prototype.requestAsyncId=function(e,t,r){return void 0===r&&(r=0),dn.setInterval(e.flush.bind(e,this),r)},t.prototype.recycleAsyncId=function(e,t,r){if(void 0===r&&(r=0),null!=r&&this.delay===r&&!1===this.pending)return t;null!=t&&dn.clearInterval(t)},t.prototype.execute=function(e,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(e,t);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,t){var r,n=!1;try{this.work(e)}catch(e){n=!0,r=e||new Error("Scheduled action threw falsy error")}if(n)return this.unsubscribe(),r},t.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,r=this.scheduler,n=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,Sr(n,this),null!=t&&(this.id=this.recycleAsyncId(r,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(un),En={now:function(){return(En.delegate||Date).now()},delegate:void 0},pn=function(){function e(t,r){void 0===r&&(r=e.now),this.schedulerActionCtor=t,this.now=r}return e.prototype.schedule=function(e,t,r){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(r,t)},e.now=En.now,e}(),Nn=new(function(e){function t(t,r){void 0===r&&(r=pn.now);var n=e.call(this,t,r)||this;return n.actions=[],n._active=!1,n}return pr(t,e),t.prototype.flush=function(e){var t=this.actions;if(this._active)t.push(e);else{var r;this._active=!0;do{if(r=e.execute(e.state,e.delay))break}while(e=t.shift());if(this._active=!1,r){for(;e=t.shift();)e.unsubscribe();throw r}}},t}(pn))(hn),_n=Nn;function fn(e,t,r){void 0===e&&(e=0),void 0===r&&(r=_n);var n,o=-1;return null!=t&&((n=t)&&dr(n.schedule)?r=t:o=t),new Qr(function(t){var n=function(e){return e instanceof Date&&!isNaN(e)}(e)?+e-r.now():e;n<0&&(n=0);var s=0;return r.schedule(function(){t.closed||(t.next(s++),0<=o?this.schedule(void 0,o):t.complete())},n)})}function mn(e,t,r,n,o){void 0===n&&(n=0),void 0===o&&(o=!1);var s=t.schedule(function(){r(),o?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(s),!o)return s}function Tn(e){return hr(function(t,r){var n,o=null,s=!1;o=t.subscribe(cn(r,void 0,void 0,function(i){n=sn(e(i,Tn(e)(t))),o?(o.unsubscribe(),o=null,n.subscribe(r)):s=!0})),s&&(o.unsubscribe(),o=null,n.subscribe(r))})}function An(e,t){return void 0===t&&(t=0),hr(function(r,n){r.subscribe(cn(n,function(r){return mn(n,e,function(){return n.next(r)},t)},function(){return mn(n,e,function(){return n.complete()},t)},function(r){return mn(n,e,function(){return n.error(r)},t)}))})}function yn(e,t){return void 0===t&&(t=0),hr(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function Cn(e,t){if(!e)throw new Error("Iterable cannot be null");return new Qr(function(r){mn(r,t,function(){var n=e[Symbol.asyncIterator]();mn(r,t,function(){n.next().then(function(e){e.done?r.complete():r.next(e.value)})},0,!0)})})}function gn(e,t){if(null!=e){if(Jr(e))return function(e,t){return sn(e).pipe(yn(t),An(t))}(e,t);if(gr(e))return function(e,t){return new Qr(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}(e,t);if(vr(e))return function(e,t){return sn(e).pipe(yn(t),An(t))}(e,t);if(Zr(e))return Cn(e,t);if(rn(e))return function(e,t){return new Qr(function(r){var n;return mn(r,t,function(){n=e[tn](),mn(r,t,function(){var e,t,o;try{t=(e=n.next()).value,o=e.done}catch(e){return void r.error(e)}o?r.complete():r.next(t)},0,!0)}),function(){return dr(null==n?void 0:n.return)&&n.return()}})}(e,t);if(on(e))return function(e,t){return Cn(nn(e),t)}(e,t)}throw en(e)}function vn(e,t){return hr(function(r,n){var o=0;r.subscribe(cn(n,function(r){n.next(e.call(t,r,o++))}))})}var bn=Array.isArray;function In(e){return vn(function(t){return function(e,t){return bn(t)?e.apply(void 0,Tr([],mr(t))):e(t)}(e,t)})}function Sn(e,t,r){return void 0===r&&(r=Kr),function(n){Ln(t,function(){for(var o=e.length,s=new Array(o),i=o,a=o,c=function(o){Ln(t,function(){var c=function(e,t){return t?gn(e,t):sn(e)}(e[o],t),l=!1;c.subscribe(cn(n,function(e){s[o]=e,l||(l=!0,a--),a||n.next(r(s.slice()))},function(){--i||n.complete()}))},n)},l=0;l<o;l++)c(l)},n)}}function Ln(e,t,r){e?mn(r,e,t):t()}function On(e,t,r){return void 0===r&&(r=1/0),dr(t)?On(function(r,n){return vn(function(e,o){return t(r,e,n,o)})(sn(e(r,n)))},r):("number"==typeof t&&(r=t),hr(function(t,n){return function(e,t,r,n,o,s,i,a){var c=[],l=0,u=0,d=!1,h=function(){!d||c.length||l||t.complete()},E=function(e){return l<n?p(e):c.push(e)},p=function(e){s&&t.next(e),l++;var a=!1;sn(r(e,u++)).subscribe(cn(t,function(e){null==o||o(e),s?E(e):t.next(e)},function(){a=!0},void 0,function(){if(a)try{l--;for(var e=function(){var e=c.shift();i?mn(t,i,function(){return p(e)}):p(e)};c.length&&l<n;)e();h()}catch(e){t.error(e)}}))};return e.subscribe(cn(t,E,function(){d=!0,h()})),function(){null==a||a()}}(t,n,e,r)}))}var Dn=Array.isArray;function Rn(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=function(e){return dr((t=e)[t.length-1])?e.pop():void 0;var t}(e);return r?function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return qr(e)}(Rn.apply(void 0,Tr([],mr(e))),In(r)):hr(function(t,r){Sn(Tr([t],mr(function(e){return 1===e.length&&Dn(e[0])?e[0]:e}(e))))(r)})}var wn=br(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Hn=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return pr(t,e),t.prototype.lift=function(e){var t=new Pn(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new wn},t.prototype.next=function(e){var t=this;Mr(function(){var r,n;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var o=fr(t.currentObservers),s=o.next();!s.done;s=o.next()){s.value.next(e)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}})},t.prototype.error=function(e){var t=this;Mr(function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var r=t.observers;r.length;)r.shift().error(e)}})},t.prototype.complete=function(){var e=this;Mr(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,r=this,n=r.hasError,o=r.isStopped,s=r.observers;return n||o?Or:(this.currentObservers=null,s.push(e),new Lr(function(){t.currentObservers=null,Sr(s,e)}))},t.prototype._checkFinalizedStatuses=function(e){var t=this,r=t.hasError,n=t.thrownError,o=t.isStopped;r?e.error(n):o&&e.complete()},t.prototype.asObservable=function(){var e=new Qr;return e.source=this,e},t.create=function(e,t){return new Pn(e,t)},t}(Qr),Pn=function(e){function t(t,r){var n=e.call(this)||this;return n.destination=t,n.source=r,n}return pr(t,e),t.prototype.next=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===r||r.call(t,e)},t.prototype.error=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===r||r.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,r;return null!==(r=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==r?r:Or},t}(Hn);function Vn(e,t){return void 0===t&&(t=Nn),hr(function(r,n){var o=null,s=null,i=null,a=function(){if(o){o.unsubscribe(),o=null;var e=s;s=null,n.next(e)}};function c(){var r=i+e,s=t.now();if(s<r)return o=this.schedule(void 0,r-s),void n.add(o);a()}r.subscribe(cn(n,function(r){s=r,i=t.now(),o||(o=t.schedule(c,e),n.add(o))},function(){a(),n.complete()},void 0,function(){s=o=null}))})}var Un=new Qr(function(e){return e.complete()});function xn(e){return e<=0?function(){return Un}:hr(function(t,r){var n=0;t.subscribe(cn(r,function(t){++n<=e&&(r.next(t),e<=n&&r.complete())}))})}function Mn(e,t){return hr(function(r,n){var o=0;r.subscribe(cn(n,function(r){return e.call(t,r,o++)&&n.next(r)}))})}function Wn(e){return hr(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}function Fn(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];if(!0!==t){if(!1!==t){var o=new jr({next:function(){o.unsubscribe(),e()}});return sn(t.apply(void 0,Tr([],mr(r)))).subscribe(o)}}else e()}function $n(e,t){return void 0===t&&(t=!1),hr(function(r,n){var o=0;r.subscribe(cn(n,function(r){var s=e(r,o++);(s||t)&&n.next(r),!s&&n.complete()}))})}function kn(e,t,r){var n=dr(e)||t||r?{next:e,error:t,complete:r}:e;return n?hr(function(e,t){var r;null===(r=n.subscribe)||void 0===r||r.call(n);var o=!0;e.subscribe(cn(t,function(e){var r;null===(r=n.next)||void 0===r||r.call(n,e),t.next(e)},function(){var e;o=!1,null===(e=n.complete)||void 0===e||e.call(n),t.complete()},function(e){var r;o=!1,null===(r=n.error)||void 0===r||r.call(n,e),t.error(e)},function(){var e,t;o&&(null===(e=n.unsubscribe)||void 0===e||e.call(n)),null===(t=n.finalize)||void 0===t||t.call(n)}))}):Kr}function jn(e,t,r){void 0===t&&(t=Nn);var n=fn(e,t);return function(e,t){return hr(function(r,n){var o=null!=t?t:{},s=o.leading,i=void 0===s||s,a=o.trailing,c=void 0!==a&&a,l=!1,u=null,d=null,h=!1,E=function(){null==d||d.unsubscribe(),d=null,c&&(_(),h&&n.complete())},p=function(){d=null,h&&n.complete()},N=function(t){return d=sn(e(t)).subscribe(cn(n,E,p))},_=function(){if(l){l=!1;var e=u;u=null,n.next(e),!h&&N(e)}};r.subscribe(cn(n,function(e){l=!0,u=e,(!d||d.closed)&&(i?_():N(e))},function(){h=!0,(!(c&&l&&d)||d.closed)&&n.complete()}))})}(function(){return n},r)}class Gn{constructor(e){this.props.observableStreams=Gn.createDirectionalObservables()}static createDirectionalFiltersObject(){const e="internal",t="parent",r="child";return{P:[t],C:[r],PCI:[t,e,r],CI:[r,e],PI:[t,e],PC:[t,r]}}static addDefaultDir(e){return de(J)({$dir:["internal"]},re(e))}static addDownInternalDir(e,t=["internal","down"]){return de(J)(re(e),{$dir:t})}static addChildAndInternalDir(e,t=["child","down"]){return de(J)(re(e),{$dir:t})}static mapToDefaultDir(e){return this.addDefaultDir(e)}static createDirectionalObservables(e=new r,t,n){void 0!==t&&void 0!==n&&(e.viewName=t,e.vsid=n);const o=e=>he(t=>t.includes(e),"$dir"),s=o("parent"),i=o("child"),a=o("internal"),c=e=>J({from$:e}),l=c("child"),u=c("internal"),d=c("parent"),h=e.pipe(Mn(e=>void 0!==e&&void 0!==e.action)),E=e.pipe(Mn(a),vn(u)),p=e.pipe(Mn(s),vn(l)),N=e.pipe(Mn(i),vn(d)),_={parent:p,internal:E,child:N};return{raw$:h,toInternal$:E,toParent$:p,toChild$:N,completeAll:()=>{Ee(e=>{e.complete(),e.isStopped=!0},[h,E,p,N])},completeStream:(e=[])=>{const t=e=>{if(void 0!==_[e]){(t=_[e]).complete(),t.isStopped=!0}var t};void 0!==e&&e.length>=1&&e.forEach(t)}}}}class zn{constructor(e,t={},n="",o="theName"){this.addMixins(),this._state="INIT",this.vsid=n,this.el=t.el,this.vsName=o,this.defaults={debug:!1,extendedHashMethods:{}},this.options=Ye(this.defaults,t);this.addActionListeners().forEach(e=>{const[t,r]=e;this.options.extendedHashMethods[t]=e=>this[r](e)}),this.options.hashMethods=this.setHashMethods(this.options.extendedHashMethods),this.sink$=e,this.sink$.subscribe(this.onObsSinkSubscribe.bind(this)),this.$dirs=Gn.createDirectionalFiltersObject(),this.addDefaultDir=Gn.addDefaultDir,this.sourceStreams=Gn.createDirectionalObservables(new r,this.vsName,this.vsid),this._source$=this.sourceStreams.toInternal$}addActionListeners(){return[]}setHashMethods(e={}){return Ye({VS_DETRITUS_COLLECT:e=>this.onGarbageCollect(e),READY_FOR_VS_DETRITUS_COLLECT:e=>this.onReadyForGC(e),EXTIRPATE:e=>this.onDispose(e),VS_SPAWN:e=>this.onRender(e),VS_SPAWN_AND_ATTACH_TO_PARENT:e=>this.onRenderAndAttachToParent(e),VS_SPAWN_AND_ATTACH_TO_DOM:e=>this.onRenderAndAttachToDom(e),ATTACH_CHILD_TO_SELF:e=>this.onAttachChildToSelf(e)},e)}createDomItem(){this.props=void 0!==this.props?this.props:{};const e=F(e=>void 0!==e,ee(["id","className"],this.props)),{tagName:t,data:r,template:n}=this.props;return new lr(t,e,r,n)}onDisposeCompleted(e){}animateInTween(e,t){!function(e,t){const r=1*window.getComputedStyle(e).opacity,n=ur(!0,t,"ease",1===r);e.style.cssText+=n}(e,t)}animateOutTween(e,t,r){!function(e,t,r){const n=ur(!1,t,"ease");e.style.cssText+=n,e.addEventListener("transitionend",r,!1)}(e,t,r)}setAnimateIn(e){if(!0===e.animateIn){const t=void 0!==e.el?e.el:this.domItem.el;this.animateInTween(t,e.animateInTime)}}disposeMethod(e){const t=void 0!==e.el.el?e.el.el:e.el,r={action:"READY_FOR_VS_DETRITUS_COLLECT",$dir:this.$dirs.PI,el:t},o=n((e,r)=>{this.animateOutTween(t,e.animateOutTime,r)}),s=e=>{this._source$.next(r)},i=!0===e.animateOut?e=>(o(e).subscribe(s),{action:"EXTIRPATING",$dir:this.$dirs.CI}):()=>({action:"EXTIRPATE_AND_READY_FOR_VS_DETRITUS_COLLECT",$dir:this.$dirs.CI});return i(e)}onDispose(e){return this.disposeMethod(e)}removeStream(){void 0!==this.sourceStreams&&this.sourceStreams.completeStream(["internal","child"])}onReadyForGC(e){this.removeStream()}onGarbageCollect(e){void 0!==this.domItem&&this.domItem.unmount(),void 0!==this.sourceStreams&&this.sourceStreams.completeStream(["parent"])}getSourceStream(){return this._source$}combineDomItems(e){if(void 0!==this.el)return;const t=_(e.query)?e.node:e.query,r=(e,t)=>e.insertBefore(t,e.firstChild);({appendChild:(e,t)=>e.appendChild(t),after:(e,t)=>e.after(t)}[e.attachType]||r)(t,this.domItem.render()),this.setAnimateIn(e)}onAttachChildToSelf(e){const t=e.childRenderData;return this.combineDomItems(t),{action:"CHILD_ATTACHED",$dir:this.$dirs.PI}}onRenderAndAttachToParent(e){return this.onRender(e),this.combineDomItems(e),{action:"VS_SPAWNED_AND_ATTACHED_TO_PARENT",el:this.el||this.domItem.el,$dir:this.$dirs.PI}}renderDomItem(e){const[t,r,n,o]=e;return this.domItem=new lr({tagName:t,attributes:r,data:n,template:o}),this.domItem}onRender(e){return{action:"VS_SPAWNED",el:this.el||(e=>this.renderDomItem(e))(pe(["tagName","domAttributes","data","template"],e)),$dir:this.$dirs.I}}extendedMethods(e){}onRenderAndAttachToDom(e){return e.attachData.el=(e=>this.renderDomItem(e))(pe(["tagName","domAttributes","data","template"],e)),this.combineDomItems(e.attachData),{action:"VS_SPAWNED_AND_ATTACHED_TO_DOM",el:this.el||e.attachData.el.el,$dir:this.$dirs.CI}}onObsSinkSubscribe(e){const t=e.action,r=k(e=>this.extendedMethods(e)),n=r(this.options.hashMethods[t])(e);void 0!==n&&(e=>{this._source$.next(e)})(Object.freeze(n))}addMixins(){}}function Bn(){setTimeout(()=>{Ee(e=>{},this)},1)}class Yn{constructor(e,t,r,n="subscribe",o=!1){const s={name:e,observable:t,data:r,action:n};this.sendToDirectorStream(s)}sendToDirectorStream(e){const t=ct.channelsMap.getStream("DISPATCHER"),r=mt(e);t.next(r),e=void 0}static deepClone(e){const t=C(Array),r=C(Object);var n;return!1===t(n=e)&&!0===r(n)?d(B,R,re)(e):re(e)}static getMouseEventKeys(){return["altKey","bubbles","cancelBubble","cancelable","clientX","clientY","composed","ctrlKey","currentTarget","defaultPrevented","detail","eventPhase","fromElement","isTrusted","layerX","layerY","metaKey","movementX","movementY","offsetX","offsetY","pageX","pageY","path","relatedTarget","returnValue","screenX","screenY","shiftKey","sourceCapabilities","srcElement","target","timeStamp","toElement","type","view","which","x","y"]}addMixins(){this.gc=Bn}}const Kn=!0===ct.debug;class qn{constructor(e,t){this.addMixins(),this.props=e,this.broadcastFn=t,this.broadcaster(this.broadcastFn)}addDblClickEvt(e){return o(e,"dblclick").pipe(vn(e=>{const t=re(e);return t.typeOverRide="dblclick",t}))}broadcast(e){if(e.length<=0&&!0===Kn)return void console.warn(`Spyne Warning: The nested array in ${this.props.name}.broadcastEvents appears to be empty --\x3e vsid:${this.props.vsid}!`);const t={UI:this.sendUIPayload,ROUTE:this.sendRoutePayload},[r,n,s]=e;let i,a=this.props.el.querySelectorAll(r);if(a.length<=0){const e=this.props.el,t=t=>{t===e&&(a=[t])};(()=>{const n=(null!==e.parentElement?e.parentElement:document).querySelectorAll(r);n.forEach=Array.prototype.forEach,n.forEach(t)})()}const c=void 0!==s,l=e=>{const r="dblClick"!==n?o(e,n,{preventDefault:()=>!0}):this.addDblClickEvt(e);i=e.dataset.channel;const s={};s.payload=(e=>{const t={};for(const r in e)t[r]=e[r];return t})(e.dataset),s.payload=Ne(["channel"],s.payload),"ROUTE"===s.channel&&(s.payload.endPreventDefault=!0),s.channel=i,s.srcElement={},s.srcElement.id=this.props.id,s.srcElement.vsid=this.props.vsid,s.srcElement.isLocalEvent=c,s.srcElement.srcEvent=n,s.srcElement.el=e;var a;(0,t[a=i,"ROUTE"===a||"CHANNEL_ROUTE"===a?"ROUTE":("UI"!==a&&"CHANNEL_UI"!==a&&void 0!==a&&console.warn(`SpyneJS warning: The channel, ${a}, is not allowed here, only "UI" or "ROUTE" are valid channels, defaulting to CHANNEL_UI`),"UI")])(r,s)};!0===(void 0===a||a.length<=0)&&!0===Kn?console.warn(`Spyne Warning: The item ${r}, does not appear to exist in ${this.props.name} --\x3e vsid:${this.props.vsid}!`):(a.forEach=Array.prototype.forEach,a.forEach(l))}broadcaster(e){e().forEach(e=>this.broadcast(e))}addMixins(){const e={testFunc:function(e){console.log("stream mixin is ",e)},sendRoutePayload:function(e,t){return new Yn("CHANNEL_ROUTE",e,t,"subscribe")},sendUIPayload:function(e,t){return new Yn("CHANNEL_UI",e,t,"subscribe")}};this.sendUIPayload=e.sendUIPayload,this.sendRoutePayload=e.sendRoutePayload}}const Qn=d(ne,C(Array)),Xn=d(ne,E),Jn=f([C(String),Xn]),Zn=f([C(Array),Xn]),eo=d(f([Qn,C(Object)])),to=d(f([Xn,Qn,C(Object)]));class ro{constructor(e,t={},r,n){eo(e)&&(e=v("selector",t=e),n=n||v("testMode",t));const o=[r,v("debugLabel",t)];r=d(y(C(String)))(o);let s=Ne(["debugLabel","label","selector","props","testMode","propFilters"],t);void 0!==t.props?s=oe([t.props,s]):void 0!==t.propFilters&&(s=oe([t.propFilters,s])),t.propFilters=s;const{propFilters:i}=t,a=Jn(e)?ro.filterSelector([e],r):void 0,c=Zn(e)?ro.filterSelector(e,r):void 0,l=to(i)?ro.filterData(i,r):void 0;let u=m(_,[a,c,l]);const h=E(u);return h&&(u=[H(!1)],!0===ct.debug&&!0!==n&&console.warn(`Spyne Warning: The Channel Filter, with selector: ${e}, and propFilters:${i} appears to be empty!`)),!0===n?{selector:e,propFilters:i,debugLabel:r,filters:t,testMode:n,filtersAreEmpty:h}:f(u)}static filterData(e,t){const r=t;return(()=>{if(E(e))return H(!1);e=D((e,t,r)=>{let n=Te;if((e=>C(String,e))(e)||(e=>C(Boolean,e))(e)||(e=>C(Number,e))(e))o=e,n=e=>e===o;else{if("function"==typeof e)return e;if((e=>C(Array,e))(e)||eo(e))return console.warn(`ChannelPayloadFilter: Property "${e}" is an array/object, which is not allowed. This property will always return false.`),n}var o;return n},e);const t=me(e);return d(t,t=>{if(void 0===r)return t;const n={};return ue((e,r)=>{n[r]=e(v(r,t))},e),console.log(`%c CHANNEL PAYLOAD FILTER DEBUGGER ["${r}"] - values: `,"color:orange;",{propsBooleans:n,comparedObj:t}),t},k({}),e=>{const{payload:t,srcElement:r,event:n}=e||{};return Object.assign({},e,r,n,t)})})()}static checkPayloadSelector(e,t,r){const{payload:n,srcElement:o,event:s}=r||{},i=[o,n,v("srcElement",s),r].reduce((e,t)=>{if(void 0!==e)return e;const r=v("el",t);return ro.elIsDomElement(r)&&(e=r),e},void 0),a=null!==i&&"object"==typeof i&&"function"==typeof i.matches,c=a?D(e=>{try{return i.matches(e)}catch(t){return!0===ct.debug&&console.warn(`Spyne Warning: The ChannelPayloadFilter selector, ${e}, is not a valid css selector!`),!1}},e):[];if(void 0!==t){const r=e;console.log(`%c CHANNEL PAYLOAD FILTER DEBUGGER ["${t}"] - selectors: `,"color:orange;",{el:i,selectorsArr:r,nodeArrResultsDebugger:c})}return!1!==a&&!0!==E(c)&&_e(T(!0),c)}static elIsDomElement(e){return C(String,e)&&(e=document.querySelector(e)),d(se(0),k(-1),v("nodeType"))(e)}static filterSelector(e,t){const r=m(E,e);return fe(ro.checkPayloadSelector)(r,t)}}function no(){return!0===ct.debug}function oo(e,t,r=!1){const n=io(e,t,r);return 1===n.length?p(n):n}function so(e,t,r){const n=document.querySelector(e),o=d(se(0),k(-1),v("nodeType"));if(null===n||!1!==o(n)){if(void 0!==t&&String(t).trim().length>0){function s(e){try{return document.querySelectorAll(e).length>0}catch(e){return!1}}const i=s(t);!0===r&&!0===no()&&!1===i&&bt(`Spyne Warning: the selector, ${t} does not exist in this el, ${e}`)}}else bt(`Spyne Warning: the el object is not a valid single element, ${n}`)}function io(e,t,r=!1){let n=!1;const o=(r=>{let o=[];try{o=document.querySelectorAll(r)}catch(e){o=[]}try{n=document.querySelector(t)===document.querySelector(e),!0===n&&(o=[document.querySelector(t)])}catch(e){}return o})(void 0!==t?`${e} ${t}`:e);if(!0===r){so(!0===n?"body":e,t,r)}return o}function ao(e,t,r){return io(t,r).forEach(t=>{t.style.cssText=e}),this}function co(e,t){function r(t){return co(e,t)}so(e="string"==typeof e?e:function(e){let t=`${Math.random().toString(36).replace(/\d/gm,"").substring(1,8)}`;return void 0===e.dataset.vsid?e.dataset.vsid=t:t=e.dataset.vsid,`[data-vsid='${t}']`}(e),t,!1),r.map=r=>Array.from(io(e,t)).map(r),r.forEach=r=>Array.from(io(e,t)).map(r),r.addClass=n=>(io(e,t).forEach(e=>e.classList.add(n)),r),r.removeClass=n=>(io(e,t).forEach(e=>{e.classList.remove(n)}),r),r.setClass=n=>(io(e,t).forEach(e=>{const t=d(m(E),z(" "))(e.className),r=n.split(" ");t.forEach(t=>e.classList.remove(t)),r.forEach(t=>e.classList.add(t))}),r),r.unmount=()=>{},r.toggleClass=(n,o)=>(io(e,t).forEach(e=>{(o=void 0!==o?o:!e.classList.contains(n))?e.classList.add(n):e.classList.remove(n)}),r),r.toggle=(e,t)=>(r.toggleClass(e,t),r),r.appendChild=e=>{const n=r.el;return null!==n?n.appendChild(e):bt(`Spyne Warning: The selector, ${t} does not appear to be valid!`),r.el},r.addAnimClass=n=>(requestAnimationFrame(()=>{io(e,t).forEach(e=>{try{e.classList.add(n)}catch(e){}})}),r),r.setActiveItem=(n,o)=>{const s=io(e,t),i="string"==typeof o?oo(e,o):o;if(s.forEach(e=>e.classList.remove(n)),!0===(a=i,d(se(0),k(-1),v("nodeType"))(a))){const e=Array.from(s).find(e=>e===i);e?e.classList.add(n):!0===no()&&bt(`Spyne Warning: The selector, ${o}, is valid but does not match any item in setActiveItem: ${n}`)}else!0===no()&&bt(`Spyne Warning: The selector, ${o}, does not appear to be a valid item in setActiveItem: ${n}`);var a;return r};const n=(r=!0)=>Array.from(io(e,t,r));return Object.defineProperty(r,"el",{get:()=>{const r=n();return r.length>1&&!0===no()&&bt(`Spyne Warning: el$("${void 0!==t?t:e}").el matched ${r.length} elements; returning the first. Use .els for the full list.`),r.length>=1?r[0]:null}}),Object.defineProperty(r,"els",{get:()=>n()}),Object.defineProperty(r,"arr",{get:()=>n()}),Object.defineProperty(r,"elLegacy",{get:()=>oo(e,t,!0)}),Object.defineProperty(r,"len",{get:()=>io(e,t,!1).length}),Object.defineProperty(r,"length",{get:()=>io(e,t,!1).length}),Object.defineProperty(r,"exists",{get:()=>io(e,t,!1).length>=1}),Object.defineProperty(r,"inline",{set:r=>ao(r,e,t),get:()=>r}),Object.defineProperty(r,"inlineCss",{set:r=>ao(r,e,t),get:()=>r}),r}class lo{constructor(e={}){this.vsnum=Math.random(),this.addMixins(),this._postRenderCalled=!1,this.defaults=()=>{const t=this.createId(),r=e.id?e.id:t;return{vsid:t,id:r,tagName:"div",el:void 0,data:void 0,animateIn:!1,animateInTime:.5,animateOut:!1,animateOutTime:.5,sendLifecyleEvents:!1,hashId:`#${r}`,id$:`#${r}`,viewClass:zn,extendedSourcesHashMethods:{},debug:!1,template:void 0,node:document.createDocumentFragment(),name:gt(this)}},this._state={},this.$dirs=Gn.createDirectionalFiltersObject(),this.addDefaultDirection=Gn.addDefaultDir,this.addDownInternalDir=Gn.addDownInternalDir,this.props=Ye(this.defaults(),e),this.sendLifecycleMethod=!0===this.props.sendLifecyleEvents?this.sendLifecycleMethodActive.bind(this):this.sendLifecycleMethodInactive.bind(this);const t=this.attributesArray;this.props.domAttributes=ee(t,this.props),void 0!==this.props.traits&&this.addTraits(this.props.traits),this.loadAllMethods(),this.props.action="LOADED",this.sink$=new r,this.props.elIsAlreadyRenderedBool=this.elAlreadyExistsFn(this.props);const n=this.props.viewClass;this.view=new n(this.sink$,{el:this.props.el},this.props.vsid,this.props.id),this.sourceStreams=this.view.sourceStreams,this._rawSource$=this.view.getSourceStream(),this._rawSource$.viewName=this.props.name,this.sendEventsDownStream=this.sendEventsDownStreamFn,this.initViewStream(),this.isDevMode=lo.isDevMode(),this.props.addedChannels=[],this.checkIfElementAlreadyExists()}get source$(){return this._source$}get attributesArray(){return["accesskey","class","contenteditable","dir","draggable","hidden","id","lang","spellcheck","style","tabindex","title","translate","aria-autocomplete","aria-checked","aria-disabled","aria-expanded","aria-haspopup","aria-hidden","aria-invalid","aria-label","aria-level","aria-multiline","aria-multiselectable","aria-orientation","aria-pressed","aria-readonly","aria-required","aria-selected","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","aria-atomic","aria-busy","aria-live","aria-relevant","aria-dropeffect","aria-grabbed","aria-activedescendant","aria-controls","aria-describedby","aria-flowto","aria-labelledby","aria-owns","aria-posinset","aria-setsize","accept","autocomplete","autofocus","checked","dirname","disabled","form","formaction","formenctype","formmethod","formnovalidate","formtarget","list","max","maxlength","min","minlength","multiple","name","pattern","placeholder","readonly","required","size","step","value","alt","srcset","sizes","usemap","ismap","href","target","download","ping","rel","hreflang","as","media","accept-charset","action","enctype","novalidate","content","charset","http-equiv","async","defer","integrity","nomodule","nonce","referrerpolicy","autocapitalize","autoplay","buffered","challenge","cite","code","codebase","color","cols","colspan","contextmenu","controls","coords","crossorigin","csp","dataset","datetime","decoding","default","for","headers","high","icon","importance","itemprop","keytype","kind","label","language","lazyload","loop","low","manifest","method","muted","open","optimum","poster","preload","radiogroup","reversed","role","rows","rowspan","sandbox","scope","scoped","selected","shape","slot","span","srcdoc","src","type","srclang","start","summary","wrap","width","height"]}static isDevMode(){return ct.debug}static checkIfActionsAreRegistered(e=[],t){if(t.length>0){const r=t=>{const r=new RegExp(t);if(ge(x(r),n)<0){const r=1===e.length?"from added channel":"from added channels";console.warn(`Spyne Warning: The action, ${t}, in ${this.props.name}, does not match any of the registered actions ${r}, ${e.join(", ")}`)}},n=(e=>{const t=e.map(e=>ct.getChannelActions(e));return O(t)})(e);t.forEach(r)}}static isValidNestedArr(e){const t=T(!0),r=Ae(t),n=C(String),o=d(r,D(n),ye(0,2),k([]));return d(r,D(o),k([]))(e)}static elIsDomElement(e){return C(String,e)&&(e=document.querySelector(e)),d(se(0),k(-1),v("nodeType"))(e)}updatePropsToMatchEl(){const e=d(Ce,V(v("tagName"),H("")));this.props.tagName=e(this.props.el)}elAlreadyExistsFn(e){const t=d(se(0),k(-1),v("nodeType"));return he(f([e=>document.body.contains(e),t]),"el")(e)}checkIfElementAlreadyExists(){!0===this.props.elIsAlreadyRenderedBool?(this.updatePropsToMatchEl(),this.postRender()):null===this.props.el&&console.error(`Spyne Error: The defined element for this ViewStream instance, ${this.constructor.name}, appears to not exist.`)}loadAllMethods(){const e=fe(this.onChannelMethodCall.bind(this));this.addActionListeners().forEach(t=>{let[r,n,o]=t;C(String,o)&&(o=new ro({selector:o})),this.props.extendedSourcesHashMethods[r]=e(n,o)}),this.props.hashSourceMethods=this.setSourceHashMethods(this.props.extendedSourcesHashMethods)}addActionListeners(){return[]}onChannelMethodCall(e,t,r){const n=t=>{void 0===this[e]?console.warn(`Spyne Warning: The method, ${e} does not appear to exist in ${this.constructor.name}!`):this[e](t)};if(void 0!==r.$dir&&r.$dir.includes("child")&&!0!==this.deleted){const e=Ye({},r);e.$dir=this.$dirs.C,this.sourceStreams.raw$.next(e)}!0===k(H(!0),t)(r)&&n(r=Ne(["$dir"],r))}setSourceHashMethods(e={}){const t={EXTIRPATING:e=>this.checkParentDispose(e),EXTIRPATE:e=>this.disposeViewStream(e),VS_SPAWNED:e=>this.onVSRendered(e),VS_SPAWNED_AND_ATTACHED_TO_DOM:e=>this.onVSRendered(e),VS_SPAWNED_AND_ATTACHED_TO_PARENT:e=>this.onVSRendered(e),READY_FOR_VS_DETRITUS_COLLECT:e=>this.onReadyToGC(e),VS_NULLITY:()=>({})};return Ye.all([{},t,e])}initViewStream(){this._source$=this._rawSource$.pipe(vn(e=>this.onMapViewSource(e)),$n(this.notGCSTATE)),this.initAutoMergeSourceStreams(),this.updateSourceSubscription(this._source$,!0)}notGCSTATE(e){return!e.action.includes("READY_FOR_VS_DETRITUS_COLLECT")}eqGCSTATE(e){return!e.action.includes("READY_FOR_VS_DETRITUS_COLLECT")}notCOMPLETED(e){return!e.action.includes("COMPLETED")}notGCCOMPLETE(e){return!e.action.includes("GC_COMPLETE")}testVal(e){console.log("TESTING VALL IS ",e)}addParentStream(e,t){this.parent$=e.pipe(Mn(e=>void 0!==e&&void 0!==e.action),vn(e=>{const t=Ye({},e);return"EXTIRPATE_AND_READY_FOR_VS_DETRITUS_COLLECT"===t.action&&(this.disposeViewStream(t),t.action="READY_FOR_VS_DETRITUS_COLLECT"),t})),this.updateSourceSubscription(this.parent$,!1,"PARENT"),this.renderAndAttachToParent(t)}addChildStream(e){const t=e.pipe(Mn(e=>void 0!==e&&void 0!==e.action),kn(e=>this.tracer("addChildStraem do ",e)),vn(e=>e),Wn(e=>this.onChildCompleted(t.source)));this.updateSourceSubscription(t,!0,"CHILD")}onChildDisposed(e){}onChildCompleted(e){const t=(e=>{const t=e=>{for(;void 0!==e.destination;)e=t(e.destination);return e};return ee(["id","vsid"],t(e))})(e);return this.tracer("onChildCompleted ",this.vsnum,e),this.onChildDisposed(t,e),t}initAutoMergeSourceStreams(){const e={next:this.onSubscribeToSourcesNext.bind(this),error:this.onSubscribeToSourcesError.bind(this),complete:this.onSubscribeToSourcesComplete.bind(this)},t=()=>{this.props.el$=void 0,this.uberSource$.complete(),this.autoSubscriber$.complete(),this.sink$.complete(),this.props=void 0,this.deleted=!0,this.tracer("completeAll",this.deleted,this.props)},n=()=>{o-=1,0===o&&t()};let o=0;this.uberSource$=new r;this.autoMergeSubject$=this.uberSource$.pipe(On(e=>{const t=e.observable.pipe(Mn(e=>void 0!==e&&void 0!==e.action),vn(e=>{const t=Ye({},e);return t.action=e.action,this.tracer("autoMergeSubject$",t),t}));return!1===e.autoClosesBool?t:(o+=1,t.pipe(Wn(n)))})),this.autoSubscriber$=this.autoMergeSubject$.pipe(Mn(e=>void 0!==e&&void 0!==e.action)).subscribe(e)}updateSourceSubscription(e,t=!1,r){const n={observable:e,autoClosesBool:t,rel:r};this.tracer("updateSourceSubscription ",this.vsnum,n),this.uberSource$.next(n)}onSubscribeToSourcesNext(e={}){const t=k(e=>this.sendExtendedStreams(e)),r=(n=this.props.hashSourceMethods,o=e.action,void 0!==n[o]?o:d(p,F(d(x(I,o),e=>new RegExp(e))))(A(n)));var n,o;t(this.props.hashSourceMethods[r])(e),this.tracer("onSubscribeToSourcesNext",{payload:e})}onSubscribeToSourcesError(e=""){console.log("ALL ERROR ",this.constructor.name,e)}onSubscribeToSourcesComplete(){this.tracer("onSubscribeToSourcesComplete","VS_DETRITUS_COLLECT"),this.openSpigot("VS_DETRITUS_COLLECT")}sendExtendedStreams(e){this.tracer("sendExtendedStreams",e),this.openSpigot(e.action,e)}renderAndAttachToParent(e){this.openSpigot("VS_SPAWN_AND_ATTACH_TO_PARENT",e)}renderView(){this.openSpigot("VS_SPAWN")}renderViewAndAttachToDom(e,t,r){const n={node:e,type:t,attachType:r};this.openSpigot("VS_SPAWN_AND_ATTACH_TO_DOM",{attachData:n})}checkParentDispose(e){"parent"===e.from$&&this.disposeViewStream(e)}onBeforeDispose(){}setTimeout(e,t=0,r=!1){window.setTimeout((...t)=>{if(void 0!==this&&void 0!==this.props){const n=!0===r?e.bind(this):e;ve(n,t)}},t)}disposeViewStream(e){this.onBeforeDispose(),this.openSpigot("EXTIRPATE")}onChildDispose(e){}onParentDisposing(e){this.openSpigot("EXTIRPATE")}onReadyToGC(e){const t=void 0!==e.from$&&"internal"===e.from$;this.tracer("onReadyToGC",t,e)}openSpigot(e,t={}){if(void 0!==this.props){this.props.action=e;const r=J(this.props,t);this.sink$.next(Object.freeze(r))}}setAttachData(e,t){return{node:this.props.el,type:"ViewStreamObservable",attachType:e,query:(()=>{const e=this.props.el.querySelector(t);return!0===lo.isDevMode()&&C(String,t)&&_(e)&&console.warn(`Spyne Warning: The appendView query in ${this.props.name}, '${t}', appears to not exist!`),e})()}}getParentEls(e,t){const r=e=>e.parentElement;let n=0,o=e;for(;n<t;)o=r(o),n++;return o}setAttachParentData(e,t,r){t=""!==t?t:void 0;const n=this.getParentEls(this.props.el,r);return{node:n,type:"ViewStreamObservable",attachType:e,query:n.querySelector(t)}}onMapViewSource(e={}){return this.props=J(this.props,e),e}exchangeViewsWithChild(e,t){this.addChildStream(e.sourceStreams.toParent$),e.addParentStream(this.sourceStreams.toChild$,t)}appendToDom(e){void 0!==this.props.el&&console.warn(`Spyne Warning: The ViewStream, ${this.props.name}, has an element, ${this.props.el}, that is already rendered and does not need to be appendedToDom. This may create unsusual side effects!`),this.renderViewAndAttachToDom(e,"dom","appendChild")}appendToDomAfter(e){void 0!==this.props.el&&console.warn(`Spyne Warning: The ViewStream, ${this.props.name}, has an element, ${this.props.el}, that is already rendered and does not need to be appendedToDomAfter. This may create unsusual side effects!`),this.renderViewAndAttachToDom(e,"dom","after")}prependToDom(e){void 0!==this.props.el&&console.warn(`Spyne Warning: The ViewStream, ${this.props.name}, has an element, ${this.props.el}, that is already rendered and does not need to be prependedToDom. This may create unsusual side effects!`),this.renderViewAndAttachToDom(e,"dom","prependChild")}appendView(e,t){this.exchangeViewsWithChild(e,this.setAttachData("appendChild",t))}appendViewAfter(e,t){this.exchangeViewsWithChild(e,this.setAttachData("after",t))}appendViewToParentEl(e,t,r=1){this.exchangeViewsWithChild(e,this.setAttachParentData("appendChild",t,r))}prependViewToParentEl(e,t,r=1){this.exchangeViewsWithChild(e,this.setAttachParentData("prependChild",t,r))}prependView(e,t){this.exchangeViewsWithChild(e,this.setAttachData("prependChild",t))}appendToNull(){const e=document.getElementById("spyne-null-views");this.renderViewAndAttachToDom(e,"dom","appendChild")}onVSRendered(e){"internal"===e.from$&&this.postRender()}postRender(){if(!0===this._postRenderedCalled)return;this.beforeAfterRender(),this.afterRender(),this.onRendered();if(requestAnimationFrame(()=>this.onAnimFrameAfterRendered()),!0===this.isDevMode){const e=this.broadcastEvents();!1===lo.isValidNestedArr(e)&&console.warn(`Spyne Warning: The array returned from broadcastEvents in ${this.props.name}, '${JSON.stringify(e)}', does not appear to be properly formatted!`)}this.initializeChannels(),this.viewsStreamBroadcaster=new qn(this.props,this.broadcastEvents.bind(this)),this.afterBroadcastEvents(),this._postRenderedCalled=!0}addTraits(e){"Array"!==e.constructor.name&&(e=[e]);e.forEach(e=>{new e(this)})}afterBroadcastEvents(){if(!0===this.isDevMode){const e=e=>e[0],t=this.addActionListeners(),r=t.map(e);if(!1===lo.isValidNestedArr(t))console.warn(`Spyne Warning: The array returned from addActionsListeners in ${this.props.name}, '${JSON.stringify(t)}', does not appear to be properly formatted!`);else{d(Ee(e=>{const t=k("",e[1]);!1===C(Function,this[t])&&console.warn(`Spyne Warning: The method in addActionListeners nested Array, '${JSON.stringify(e)}', in ${this.props.name}, does not appear to exist!`)}),k([]))(t)}const n=()=>{void 0!==K(["props","addedChannels"],this)&&lo.checkIfActionsAreRegistered.bind(this)(this.props.addedChannels,r)};this.setTimeout(n,500)}}setDataVSID(){this.props.el.dataset.vsid=this.props.vsid}beforeAfterRender(){this.setDataVSID(),this.props.el$=co(this.props.el)}downStream(){}onRendered(){}onAnimFrameAfterRendered(){}afterRender(){}broadcastEvents(){return[]}getChannel(e){return w(e=>lt().includes(e),e=>ct.channelsMap.getStream(e).observer.pipe($n(e=>!0!==this.deleted)),e=>console.warn(`channel name ${e} is not within ${lt}`))(e)}initializeChannels(){const e=e=>{const[t,r=!1]=Array.isArray(e)?e:[e];this?.addChannel(t,r)};Array.isArray(this?.props?.channels)?this?.props?.channels?.forEach(e):Array.isArray(this?.props?.channel)&&console.warn("props.channel is not a ViewStream property. Do you mean props.channels?")}addChannel(e,t=!1,r=!1,n=!1){const o=!0===r?this.$dirs.CI:this.$dirs.I;if(!0===this?.props?.addedChannels?.includes(e))return;const s=K(["srcElement","isLocalEvent"]),i=K(["srcElement","vsid"]),a=[vn(e=>{const t=e;return t.$dir=o,t}),Mn(e=>{const t=i(e);return!0!==s(e)||t===this.props.vsid})];var c;!0===t&&a.unshift((c=1,Mn(function(e,t){return c<=t})));const l=this.getChannel(e).pipe(...a);this.updateSourceSubscription(l,!1),this.props.addedChannels.push(e)}checkIfChannelExists(e){const t=ct.channelsMap.testStream(e);return!0!==t&&console.warn(`SPYNE WARNING: The ChannelPayload from ${this.props.name}, has been sent to a channel, ${e}, that has not been registered!`),t}sendInfoToChannel(e,t={},r){const n=t,o=k("VIEWSTREAM_EVENT"),i=d(o,v(e)),a={payload:n,action:r=r||i({CHANNEL_ROUTE:"CHANNEL_ROUTE_CHANGE_EVENT"})};try{if(a.srcElement=d(ee(["id","vsid","class","tagName"]),v("props"))(this),!0===this.checkIfChannelExists(e)){!1===/CHANNEL_LIFECYCLE/.test(r)&&Object.defineProperties(a,{payload:{get:()=>mt(t)}});const n=s(a);return new Yn(e,n,a)}}catch(e){console.warn("SPYNE WARNING ",e)}}tracer(...e){this.sendLifecycleMethod(...e)}sendLifecycleMethodInactive(){}sendLifecycleMethodActive(e,t){const r="VS_DETRITUS_COLLECT"===t;!0===me({from$:T("internal"),action:T("VS_SPAWNED_AND_ATTACHED_TO_PARENT")},t)?this.sendInfoToChannel("CHANNEL_LIFECYCLE",{action:"CHANNEL_LIFECYCLE_RENDERED_EVENT"},"CHANNEL_LIFECYCLE_RENDERED_EVENT"):!0===r&&this.sendInfoToChannel("CHANNEL_LIFECYCLE",{action:"CHANNEL_LIFECYCLE_DISPOSED_EVENT"},"CHANNEL_LIFECYCLE_DISPOSED_EVENT")}createActionFilter(e,t){return new ro(e,t)}isLocalEvent(e){const t=K(["srcElement","el"],e),r=K(["props","el"],this);return lo.elIsDomElement(r)&&lo.elIsDomElement(t)&&r.contains(t)}addMixins(){const e=yt();this.createId=e.createId}}class uo{constructor(e){const t=String(e.props.name),r=`${t}_ROUTE_UPDATER`;return fe(uo.createTemporaryViewStreamObj)({id:r,name:t})}static createTemporaryViewStreamObj(e,t){const{name:r,id:n}=e,o=t,s=new lo({id:n,name:r,data:t});s.onRendered=()=>{s.sendInfoToChannel("CHANNEL_ROUTE",o)},s.afterBroadcastEvents=()=>{s.disposeViewStream()},s.appendToNull()}}class ho{constructor(e,t={}){this.addRegisteredActions.bind(this),this.createChannelActionsObj(e,t.extendedActionsArr),t.name=e,t.defaultActions=void 0!==t.data?[`${t.name}_EVENT`]:[],this.props=t,this.props.isRegistered=!1,this.props.isProxy=void 0!==this.props.isProxy&&this.props.isProxy;const r=void 0!==this.props.data;void 0!==this.props.replay?this.props.sendCachedPayload=this.props.replay:this.props.sendCachedPayload=void 0===this.props.sendCachedPayload?r:this.props.sendCachedPayload,this.sendPayloadToRouteChannel=new uo(this),this.createChannelActionMethods(),this.streamsController=ct.channelsMap;const n=this.getMainObserver();this.checkForPersistentDataMode=ho.checkForPersistentDataMode.bind(this),this.observer$=this.props.observer=n;const o=this.streamsController.getStream("DISPATCHER"),s=U(t.name,"name");o.pipe(Mn(s)).subscribe(e=>this.onReceivedObservable(e))}getMainObserver(){void 0===this.streamsController&&console.warn(`Spyne Warning: The following channel, ${this.props.name}, appears to be registered before Spyne has been initialized.`);return!0===this.streamsController.testStream(this.props.name)?this.streamsController.getProxySubject(this.props.name,this.props.sendCachedPayload):!0===this.props.sendCachedPayload?new i(1):new r}onChannelInitialized(){}onRegistered(e=this.props){if(void 0!==e.data){const t=Object.keys(this.channelActions)[0];this.sendChannelPayload(t,e.data)}}get isProxy(){return this.props.isProxy}get channelName(){return this.props.name}get observer(){return this.observer$}checkForTraits(){const e=e=>{"Array"!==e.constructor.name&&(e=[e]);e.forEach(e=>new e(this))};void 0!==this.props.traits&&e(this.props.traits)}initializeStream(){this.checkForTraits(),this.onChannelInitialized(),this.checkForPersistentDataMode(),this.onRegistered(),this.props.isRegistered=!0}static checkForPersistentDataMode(e=this.props,t=this.channelActions){const r=E(t),n=void 0!==v("data",e);return!0===r&&!0===n&&(e.sendCachedPayload=!0,t=(()=>{const{name:t}=e,r=`${t}_EVENT`;return{[r]:r}})(),void 0!==this.channelActions&&(this.channelActions=t)),{props:e,actionsObj:t}}setTrace(e){}createChannelActionsObj(e,t=[]){const r=w(C(String),be,p),n=t.concat(this.addRegisteredActions(e)),o=D(r,n),s=oe(Q(e=>Ie(e,e),o));this.channelActions=s}createChannelActionMethods(){const e=w(C(String),be,p),t=(e,t)=>{window.setTimeout(()=>{"function"!=typeof this[e]&&console.warn(`"${this.props.name}", REQUIRES THE FOLLOWING METHOD ${e} FOR ACTION, ${t[0]}`)},100)},r=w(C(String),H("onViewStreamInfo"),e=>{const r=Se(Le(1),e);return t(r,e),r});this.channelActionMethods=B(D(t=>[e(t),r(t)],this.addRegisteredActions()))}addRegisteredActions(){let e=[];return K(["props","data"],this)&&(e=[`${this.props.name}_EVENT`]),e}onReceivedObservable(e){this.onIncomingObservable(e)}getActionMethodForObservable(e){e.unpacked=!0;const t=this.onViewStreamInfo.bind(this),r=K(["data","action"],e),n=v(r,this.channelActionMethods);let o=t;if(void 0!==n&&"onViewStreamInfo"!==n){!0===("function"==typeof this[n])&&(o=this[n].bind(this))}return o}onIncomingObservable(e){const t=T(e.name,this.props.name),{action:r,payload:n,srcElement:o}=e.data,s=t=>({clone:()=>{return t=e.data,oe([t,{action:v("action",t)},v("payload",t),v("srcElement",t)]);var t},safeClone:()=>{const e=ht(n);return oe([{payload:e},e,{action:r},{srcElement:o},{event:t}])},action:r,payload:n,srcElement:o,event:t});return!0===t?(e=>e.observable.pipe(vn(s)).subscribe(this.getActionMethodForObservable(e)))(e):void 0}onViewStreamInfo(e){}sendChannelPayload(e,t,r={},n={},o=this.observer$){const s=new At(this.props.name,e,t,r,n);o.next(s)}getChannel(e,t){return w(e=>lt().includes(e),r=>{const n=this.streamsController.getStream(r).observer;return n.source?n.source.channelName=e:n.channelName=e,void 0!==t?n.pipe(Mn(t)):n},e=>console.warn(`channel name ${e} is not within ${lt}`))(e)}mergeChannels(e,t=!0){const r=e.map(e=>{if("string"==typeof e){const r=this.getChannel(e);return t?r.pipe(xn(1)):r}return t?e.pipe(xn(1)):e});let n;if(t)n=a(r);else if(0===r.length)n=c;else if(1===r.length)n=r[0];else{const[e,...t]=r;n=e.pipe(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Rn.apply(void 0,Tr([],mr(e)))}(...t))}return n.pipe(vn(t=>{const r={};return e.forEach((e,n)=>{const o="string"==typeof e?e:`channel_${n}`;r[e?.source?.channelName||e?.source?.source?.channelName||o]=t[n]}),r}))}static checkForNotTrackFlag(e={}){!0===e.doNotTrack&&ct.doNotTrackChannel(e.channelName)}}class Eo extends ho{constructor(e="CHANNEL_ROUTE",t={}){t.sendCachedPayload=!0,super("CHANNEL_ROUTE",t),this.createChannelActionsObj(),this.routeConfigJson=this.getRouteConfig(),this.bindStaticMethods(),this.navToStream$=new i(1),this.observer$=this.navToStream$.pipe(vn(e=>this.onMapNext(e))),this.compareRouteKeywords=Fe.compareRouteKeywords()}checkConfigForHash(){!0===("hash"===ct.config.channels.ROUTE.type)&&(ct.config.channels.ROUTE.type="slash",ct.config.channels.ROUTE.isHash=!0)}onRegistered(){this.checkConfigForHash(),this.initStream()}createChannelActionsObj(){const e=this.addRegisteredActions(),t=oe(Q(e=>Ie(e,e),e));this.channelActions=t}addRegisteredActions(){return["CHANNEL_ROUTE_DEEPLINK_EVENT","CHANNEL_ROUTE_CHANGE_EVENT","CHANNEL_ROUTE_CONFIG_UPDATED_EVENT",["CHANNEL_ROUTE_UPDATE_CONFIG_EVENT","updateRouteConfig"]]}updateRouteConfig(e){const t=ee(["isHash","isHidden","routes","type"],e.payload);ct.config.channels.ROUTE=J(ct.config.channels.ROUTE,t),ct.conformRouteConfig();const r=this.getRouteConfig();r.navLinks=[...r?.routeDatasetsArr],this.routeConfigJson=r,this.bindStaticMethodsWithConfigData(),this.sendChannelPayload("CHANNEL_ROUTE_CONFIG_UPDATED_EVENT",r,{},{},this.navToStream$)}getRouteConfig(){const e=ct.config,t=K(["channels","ROUTE"],e);"query"===t.type&&(t.isHash=!1);const r=Fe.flattenConfigObject(t.routes);return t.paramsArr=r,t}initStream(){this.firstLoadStream$=new i(1),this.onIncomingDomEvent(void 0,this.routeConfigJson,"CHANNEL_ROUTE_DEEPLINK_EVENT"),Fe.createPopStateStream(this.onIncomingDomEvent.bind(this)),this.observer$=l(this.firstLoadStream$,this.navToStream$)}onMapNext(e,t=!1){return e.action="CHANNEL_ROUTE_CHANGE_EVENT",e}static removeSSID(e){const t=Oe(["routeData"]);return De(t,Ne(["vsid"]))(e)}static onIncomingDomEvent(e,t=this.routeConfigJson,r){const n=void 0!==r?r:this.channelActions.CHANNEL_ROUTE_CHANGE_EVENT,o=K(["state","routeCount"],e),s=!0===C(Number,o);let i=this.getDataFromString(t,s);!0===s&&(i.routeCount=o),"CHANNEL_ROUTE_DEEPLINK_EVENT"===r&&(i.navLinks=v("routeDatasetsArr",t),Object.defineProperty(i,"linksData",{get(){return this.navLinks},set(e){console.warn("set links data is deprecated in ROUTE DEEPLINK DATA, use navLinks")},enumerable:!0}));const a=this.compareRouteKeywords.compare(i.routeData,i.paths);i=J(i,a),this.sendChannelPayload(n,i,void 0,e,this.navToStream$)}static checkForRouteParamsOverrides(e){return e}static checkForEventMethods(e){const t=d(F(x(/^(event)([A-Z].*)([A-Z].*)$/gm)),A,v("payload"))(e);if(t.length>=1){const r=v("event",e);if(void 0!==r){const e=L(/^(event)([A-Z])(.*)([A-Z].*)$/gm,(e,t,r,n,o)=>String(r).toLowerCase()+n+o),n=t=>{const n=e(t);void 0!==r[n]&&r[n]()};t.forEach(n)}}return e}static checkForEndRoute(e,t=this.routeConfigJson,r){if(!0!==d(T("true"),K(["payload","endRoute"]))(e))return e;const n=void 0!==r?r:!0===ct.debug,{payload:o}=e;let s=0;const i=(e=[],t)=>{const r=t[1],{routePath:a}=r,c=v("routeName",a),l=(e=>{const t=v("routeName",e);if(t){const r=d(A,Ne(["routeName"]))(e),n=o[t];return y(e=>new RegExp(`^${e}$`).test(n),r)}})(a),u=C(Object,r),h=C(Array,r);if(s+=1,!0===u&&!1===h){const t=a[l];t?d(Re,j(i,e),R)({nextRoutePath:t}):1===s?n&&console.warn(`Spyne Warning: use of end route method should add start route value of "${c}".`):e.push(c)}return e},{routes:a}=t,c=d(Re,j(i,[]),R)({routes:a});if(1===c.length){const t=c[0];e.payload[t]=""}return e}onViewStreamInfo(e){const t=e.action??this.channelActions.CHANNEL_ROUTE_CHANGE_EVENT;e?.srcElement?.el?.dataset&&(e.payload=function(e){const t={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}(e?.srcElement?.el?.dataset)??e.payload),Eo.checkForEventMethods(e),e=this.checkForEndRoute(e);let r=this.getDataFromParams(e);const n=v("srcElement",e),o=v("event",e),s=!r.isHidden,i=this.compareRouteKeywords.compare(r.routeData,r.paths);r=J(r,i),this.sendRouteStream(r,s),r=Eo.removeSSID(r),this.sendChannelPayload(t,r,n,o,this.navToStream$)}static checkAndConvertStrWithRegexTokens(e,t){return A(t)}sendRouteStream(e,t=!0){!0===t&&this.setWindowLocation(e)}static getRouteState(){return"CHANNEL_ROUTE_CHANGE_EVENT"}static getIsDeepLinkBool(e){return!1===e&&0===this._routeCount}static getRouteCount(e=!1){return void 0===this._routeCount?(this._routeCount=0,this._routeCount):(!1===e&&(this._routeCount+=1),this._routeCount)}static getExtraPayloadParams(e=this.routeConfigJson,t=!1){return{routeCount:this.getRouteCount(t),isDeepLink:this.getIsDeepLinkBool(t),isHash:e.isHash,isHistory:t,isHidden:e.isHidden,routeType:e.type}}static getDataFromParams(e,t=this.routeConfigJson){let r=v("payload",e);const n=this.getRouteStrFromParams(r,t),o=(e,r)=>k(r,v(e,t)),s=o("type","slash"),i=o("isHash",!1),a=We.formatStrAsWindowLocation(n),c=this.getDataFromLocationStr(s,i,a),{pathInnermost:l,paths:u}=c;r=J(c.routeData,r);const{routeCount:d,isDeepLink:h,isHash:E,isHistory:p,isHidden:N,routeType:_}=this.getExtraPayloadParams(t);return{isDeepLink:h,routeCount:d,pathInnermost:l,paths:u,routeData:r,routeValue:n,isHash:E,isHidden:N,isHistory:p,routeType:_}}static getDataFromString(e=this.routeConfigJson,t=!1){const r=e.type,n=!0===e.isHash,o=We.getLocationStrByType(r,n),{paths:s,pathInnermost:i,routeData:a,routeValue:c}=Eo.getParamsFromRouteStr(o,e,r),{routeCount:l,isDeepLink:u,isHash:d,routeType:h,isHidden:E}=this.getExtraPayloadParams(e,t);return{isDeepLink:u,routeCount:l,pathInnermost:i,paths:s,routeData:a,routeValue:c,isHash:d,isHidden:E,isHistory:t,routeType:h}}static getDataFromLocationStr(e="slash",t=this.routeConfigJson.isHash,r=window.location){const n=void 0!==this.routeConfigJson?this.routeConfigJson.type:e,o=We.getLocationStrByType(n,t,r),{paths:s,pathInnermost:i,routeData:a,routeValue:c}=this.getParamsFromRouteStr(o,this.routeConfigJson,n);return{paths:s,pathInnermost:i,routeData:a,routeValue:c,action:this.getRouteState()}}static getLocationData(){return Z(["href","origin","protocol","host","hostname","port","pathname","search","hash"],window.location)}static getRouteStrFromParams(e,t,r){const n=void 0!==r?r:t.type;return We.convertParamsToRoute(e,t,n)}static getParamsFromRouteStr(e,t,r){const n=void 0!==r?r:t.type;return We.convertRouteToParams(e,t,n)}checkEmptyRouteStr(e,t=!1){const r=E(e);return!0===(!0===r&&!1===t)||!0===(!0===r&&!0===t)?"/":!0===(!1===r&&!0===t)?P("#",e):e}static removeLastSlash(e){return e.replace(/^(.*)(\/)$/,"$1")}setWindowLocation(e){let{isHash:t,routeValue:r,routeType:n}=e;r=this.checkEmptyRouteStr(r,t);const{routeCount:o}=e;if(!0===t||"query"===n){r=Eo.removeLastSlash(window.location.pathname)+r,window.history.pushState({routeCount:o},"",r)}else{const e=b(d(h(T("/")),p),P("/",I));window.history.pushState({routeCount:o},"",e(r))}}getWindowLocation(){return window.location.pathname}bindStaticMethods(){this.checkForEndRoute=Eo.checkForEndRoute.bind(this),this.getIsDeepLinkBool=Eo.getIsDeepLinkBool.bind(this),this.getDataFromLocationStr=Eo.getDataFromLocationStr.bind(this),this.onIncomingDomEvent=Eo.onIncomingDomEvent.bind(this),this.getDataFromString=Eo.getDataFromString.bind(this),this.getParamsFromRouteStr=Eo.getParamsFromRouteStr.bind(this),this.getLocationData=Eo.getLocationData.bind(this),this.getRouteState=Eo.getRouteState.bind(this),this.getDataFromParams=Eo.getDataFromParams.bind(this),this.getRouteCount=Eo.getRouteCount.bind(this),this.getExtraPayloadParams=Eo.getExtraPayloadParams.bind(this),this.bindStaticMethodsWithConfigData()}bindStaticMethodsWithConfigData(){const e=we(3,Eo.getRouteStrFromParams);this.getRouteStrFromParams=e(I,this.routeConfigJson,this.routeConfigJson.type)}}class po extends ho{constructor(e="CHANNEL_UI",t={}){t.sendCachedPayload=!1,super(e,t),this.keyEventsLoaded=!1,this.keyCodeArr=[]}addRegisteredActions(){return["CHANNEL_UI_DOMCONTENTLOADED_EVENT","CHANNEL_UI_ABORT_EVENT","CHANNEL_UI_ACTIVATE_EVENT","CHANNEL_UI_ADDTRACK_EVENT","CHANNEL_UI_AFTERPRINT_EVENT","CHANNEL_UI_AFTERSCRIPTEXECUTE_EVENT","CHANNEL_UI_ANIMATIONCANCEL_EVENT","CHANNEL_UI_ANIMATIONEND_EVENT","CHANNEL_UI_ANIMATIONITERATION_EVENT","CHANNEL_UI_ANIMATIONSTART_EVENT","CHANNEL_UI_APPINSTALLED_EVENT","CHANNEL_UI_AUDIOEND_EVENT","CHANNEL_UI_AUDIOSTART_EVENT","CHANNEL_UI_AUXCLICK_EVENT","CHANNEL_UI_BEFOREINPUT_EVENT","CHANNEL_UI_BEFOREPRINT_EVENT","CHANNEL_UI_BEFOREUNLOAD_EVENT","CHANNEL_UI_BEGINEVENT_EVENT","CHANNEL_UI_BLOCKED_EVENT","CHANNEL_UI_BLUR_EVENT","CHANNEL_UI_BOUNDARY_EVENT","CHANNEL_UI_BUFFEREDAMOUNTLOW_EVENT","CHANNEL_UI_CANCEL_EVENT","CHANNEL_UI_CANPLAY_EVENT","CHANNEL_UI_CANPLAYTHROUGH_EVENT","CHANNEL_UI_CHANGE_EVENT","CHANNEL_UI_CLICK_EVENT","CHANNEL_UI_CLOSE_EVENT","CHANNEL_UI_CLOSING_EVENT","CHANNEL_UI_COMPLETE_EVENT","CHANNEL_UI_COMPOSITIONEND_EVENT","CHANNEL_UI_COMPOSITIONSTART_EVENT","CHANNEL_UI_COMPOSITIONUPDATE_EVENT","CHANNEL_UI_CONNECT_EVENT","CHANNEL_UI_CONNECTIONSTATECHANGE_EVENT","CHANNEL_UI_CONTENTDELETE_EVENT","CHANNEL_UI_CONTEXTMENU_EVENT","CHANNEL_UI_COPY_EVENT","CHANNEL_UI_CUECHANGE_EVENT","CHANNEL_UI_CUT_EVENT","CHANNEL_UI_DATACHANNEL_EVENT","CHANNEL_UI_DBLCLICK_EVENT","CHANNEL_UI_DEVICECHANGE_EVENT","CHANNEL_UI_DEVICEMOTION_EVENT","CHANNEL_UI_DEVICEORIENTATION_EVENT","CHANNEL_UI_DRAG_EVENT","CHANNEL_UI_DRAGEND_EVENT","CHANNEL_UI_DRAGENTER_EVENT","CHANNEL_UI_DRAGLEAVE_EVENT","CHANNEL_UI_DRAGOVER_EVENT","CHANNEL_UI_DRAGSTART_EVENT","CHANNEL_UI_DROP_EVENT","CHANNEL_UI_DURATIONCHANGE_EVENT","CHANNEL_UI_EMPTIED_EVENT","CHANNEL_UI_END_EVENT","CHANNEL_UI_ENDEVENT_EVENT","CHANNEL_UI_ENDED_EVENT","CHANNEL_UI_ENTERPICTUREINPICTURE_EVENT","CHANNEL_UI_ERROR_EVENT","CHANNEL_UI_FOCUS_EVENT","CHANNEL_UI_FOCUSIN_EVENT","CHANNEL_UI_FOCUSOUT_EVENT","CHANNEL_UI_FORMDATA_EVENT","CHANNEL_UI_FULLSCREENCHANGE_EVENT","CHANNEL_UI_FULLSCREENERROR_EVENT","CHANNEL_UI_GAMEPADCONNECTED_EVENT","CHANNEL_UI_GAMEPADDISCONNECTED_EVENT","CHANNEL_UI_GATHERINGSTATECHANGE_EVENT","CHANNEL_UI_GESTURECHANGE_EVENT","CHANNEL_UI_GESTUREEND_EVENT","CHANNEL_UI_GESTURESTART_EVENT","CHANNEL_UI_GOTPOINTERCAPTURE_EVENT","CHANNEL_UI_HASHCHANGE_EVENT","CHANNEL_UI_ICECANDIDATE_EVENT","CHANNEL_UI_ICECANDIDATEERROR_EVENT","CHANNEL_UI_ICECONNECTIONSTATECHANGE_EVENT","CHANNEL_UI_ICEGATHERINGSTATECHANGE_EVENT","CHANNEL_UI_INPUT_EVENT","CHANNEL_UI_INPUTSOURCESCHANGE_EVENT","CHANNEL_UI_INSTALL_EVENT","CHANNEL_UI_INVALID_EVENT","CHANNEL_UI_KEYDOWN_EVENT","CHANNEL_UI_KEYUP_EVENT","CHANNEL_UI_LANGUAGECHANGE_EVENT","CHANNEL_UI_LEAVEPICTUREINPICTURE_EVENT","CHANNEL_UI_LOAD_EVENT","CHANNEL_UI_LOADEDDATA_EVENT","CHANNEL_UI_LOADEDMETADATA_EVENT","CHANNEL_UI_LOADEND_EVENT","CHANNEL_UI_LOADSTART_EVENT","CHANNEL_UI_LOSTPOINTERCAPTURE_EVENT","CHANNEL_UI_MARK_EVENT","CHANNEL_UI_MERCHANTVALIDATION_EVENT","CHANNEL_UI_MESSAGE_EVENT","CHANNEL_UI_MESSAGEERROR_EVENT","CHANNEL_UI_MOUSEDOWN_EVENT","CHANNEL_UI_MOUSEENTER_EVENT","CHANNEL_UI_MOUSELEAVE_EVENT","CHANNEL_UI_MOUSEMOVE_EVENT","CHANNEL_UI_MOUSEOUT_EVENT","CHANNEL_UI_MOUSEOVER_EVENT","CHANNEL_UI_MOUSEUP_EVENT","CHANNEL_UI_MUTE_EVENT","CHANNEL_UI_NEGOTIATIONNEEDED_EVENT","CHANNEL_UI_NOMATCH_EVENT","CHANNEL_UI_NOTIFICATIONCLICK_EVENT","CHANNEL_UI_OFFLINE_EVENT","CHANNEL_UI_ONLINE_EVENT","CHANNEL_UI_OPEN_EVENT","CHANNEL_UI_ORIENTATIONCHANGE_EVENT","CHANNEL_UI_PAGEHIDE_EVENT","CHANNEL_UI_PAGESHOW_EVENT","CHANNEL_UI_PASTE_EVENT","CHANNEL_UI_PAUSE_EVENT","CHANNEL_UI_PAYERDETAILCHANGE_EVENT","CHANNEL_UI_PAYMENTMETHODCHANGE_EVENT","CHANNEL_UI_PLAY_EVENT","CHANNEL_UI_PLAYING_EVENT","CHANNEL_UI_POINTERCANCEL_EVENT","CHANNEL_UI_POINTERDOWN_EVENT","CHANNEL_UI_POINTERENTER_EVENT","CHANNEL_UI_POINTERLEAVE_EVENT","CHANNEL_UI_POINTERLOCKCHANGE_EVENT","CHANNEL_UI_POINTERLOCKERROR_EVENT","CHANNEL_UI_POINTERMOVE_EVENT","CHANNEL_UI_POINTEROUT_EVENT","CHANNEL_UI_POINTEROVER_EVENT","CHANNEL_UI_POINTERUP_EVENT","CHANNEL_UI_POPSTATE_EVENT","CHANNEL_UI_PROGRESS_EVENT","CHANNEL_UI_PUSH_EVENT","CHANNEL_UI_PUSHSUBSCRIPTIONCHANGE_EVENT","CHANNEL_UI_RATECHANGE_EVENT","CHANNEL_UI_READYSTATECHANGE_EVENT","CHANNEL_UI_REJECTIONHANDLED_EVENT","CHANNEL_UI_REMOVETRACK_EVENT","CHANNEL_UI_REMOVESTREAM_EVENT","CHANNEL_UI_REPEATEVENT_EVENT","CHANNEL_UI_RESET_EVENT","CHANNEL_UI_RESIZE_EVENT","CHANNEL_UI_RESOURCETIMINGBUFFERFULL_EVENT","CHANNEL_UI_RESULT_EVENT","CHANNEL_UI_RESUME_EVENT","CHANNEL_UI_SCROLL_EVENT","CHANNEL_UI_SEARCH_EVENT","CHANNEL_UI_SEEKED_EVENT","CHANNEL_UI_SEEKING_EVENT","CHANNEL_UI_SELECT_EVENT","CHANNEL_UI_SELECTEDCANDIDATEPAIRCHANGE_EVENT","CHANNEL_UI_SELECTEND_EVENT","CHANNEL_UI_SELECTIONCHANGE_EVENT","CHANNEL_UI_SELECTSTART_EVENT","CHANNEL_UI_SHIPPINGADDRESSCHANGE_EVENT","CHANNEL_UI_SHIPPINGOPTIONCHANGE_EVENT","CHANNEL_UI_SIGNALINGSTATECHANGE_EVENT","CHANNEL_UI_SLOTCHANGE_EVENT","CHANNEL_UI_SOUNDEND_EVENT","CHANNEL_UI_SOUNDSTART_EVENT","CHANNEL_UI_SPEECHEND_EVENT","CHANNEL_UI_SPEECHSTART_EVENT","CHANNEL_UI_SQUEEZE_EVENT","CHANNEL_UI_SQUEEZEEND_EVENT","CHANNEL_UI_SQUEEZESTART_EVENT","CHANNEL_UI_STALLED_EVENT","CHANNEL_UI_START_EVENT","CHANNEL_UI_STATECHANGE_EVENT","CHANNEL_UI_STORAGE_EVENT","CHANNEL_UI_SUBMIT_EVENT","CHANNEL_UI_SUCCESS_EVENT","CHANNEL_UI_SUSPEND_EVENT","CHANNEL_UI_TIMEOUT_EVENT","CHANNEL_UI_TIMEUPDATE_EVENT","CHANNEL_UI_TOGGLE_EVENT","CHANNEL_UI_TONECHANGE_EVENT","CHANNEL_UI_TOUCHCANCEL_EVENT","CHANNEL_UI_TOUCHEND_EVENT","CHANNEL_UI_TOUCHMOVE_EVENT","CHANNEL_UI_TOUCHSTART_EVENT","CHANNEL_UI_TRACK_EVENT","CHANNEL_UI_TRANSITIONCANCEL_EVENT","CHANNEL_UI_TRANSITIONEND_EVENT","CHANNEL_UI_TRANSITIONRUN_EVENT","CHANNEL_UI_TRANSITIONSTART_EVENT","CHANNEL_UI_UNHANDLEDREJECTION_EVENT","CHANNEL_UI_UNLOAD_EVENT","CHANNEL_UI_UNMUTE_EVENT","CHANNEL_UI_UPGRADENEEDED_EVENT","CHANNEL_UI_VERSIONCHANGE_EVENT","CHANNEL_UI_VISIBILITYCHANGE_EVENT","CHANNEL_UI_VOICESCHANGED_EVENT","CHANNEL_UI_VOLUMECHANGE_EVENT","CHANNEL_UI_VRDISPLAYACTIVATE_EVENT","CHANNEL_UI_VRDISPLAYBLUR_EVENT","CHANNEL_UI_VRDISPLAYCONNECT_EVENT","CHANNEL_UI_VRDISPLAYDEACTIVATE_EVENT","CHANNEL_UI_VRDISPLAYDISCONNECT_EVENT","CHANNEL_UI_VRDISPLAYFOCUS_EVENT","CHANNEL_UI_VRDISPLAYPOINTERRESTRICTED_EVENT","CHANNEL_UI_VRDISPLAYPOINTERUNRESTRICTED_EVENT","CHANNEL_UI_VRDISPLAYPRESENTCHANGE_EVENT","CHANNEL_UI_WAITING_EVENT","CHANNEL_UI_WEBGLCONTEXTCREATIONERROR_EVENT","CHANNEL_UI_WEBGLCONTEXTLOST_EVENT","CHANNEL_UI_WEBGLCONTEXTRESTORED_EVENT","CHANNEL_UI_WEBKITMOUSEFORCECHANGED_EVENT","CHANNEL_UI_WEBKITMOUSEFORCEDOWN_EVENT","CHANNEL_UI_WEBKITMOUSEFORCEUP_EVENT","CHANNEL_UI_WEBKITMOUSEFORCEWILLBEGIN_EVENT","CHANNEL_UI_WHEEL_EVENT"]}loadKeyStream(){const e=t.fromEvent(document,"keyup");this.keyPresses$=e.groupBy(e=>e.keyCode).mergeAll().filter(e=>this.keyCodeArr.indexOf(e.keyCode)>=0).repeat().subscribe(this.onKeyPressed.bind(this))}addKeyEvent(e){!1===this.keyEventsLoaded&&this.loadKeyStream(),this.keyEventsLoaded=!0,this.registerKey(e)}registerKey(e){this.keyCodeArr.push(e)}onKeyPressed(e){}static removeSSID(e){const t=Oe(["payload"]);return De(t,Ne(["vsid"]))(e)}onIncomingObservable(e){const t=T(e.name,this.props.name);e.data=po.removeSSID(e.data);const{payload:r,srcElement:n}=e.data,o=e=>({payload:r,srcElement:n,event:e});return!0===t?(e=>e.observable.pipe(vn(o)).subscribe(this.onUIEvent.bind(this)))(e):void 0}getActionState(e){const t=K(["event","type"]),r=K(["event","typeOverRide"]),n=d(He,V(r,t))(e),o="CHANNEL_UI";return void 0!==n?`${o}_${n}_EVENT`:o}static checkForEventMethods(e){const t=d(F(x(/^(event)([A-Z].*)([A-Z].*)$/gm)),A,v("payload"))(e);if(t.length>=1){const r=v("event",e);if(void 0!==r){const e=L(/^(event)([A-Z])(.*)([A-Z].*)$/gm,(e,t,r,n,o)=>String(r).toLowerCase()+n+o),n=t=>{const n=e(t);void 0!==r[n]&&"function"==typeof r[n]&&r[n]()};t.forEach(n)}}return e}onUIEvent(e){e.payload=function(e){const t={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}(e?.srcElement?.el?.dataset)??e.payload,po.checkForEventMethods(e),e.action=this.getActionState(e);const t=e.action,{payload:r,srcElement:n}=e,o=e.event;or(o?.target),this.sendChannelPayload(t,r,n,o)}}class No{constructor(){this.createDomObservableFromEvent=No.createDomObservableFromEvent.bind(this)}static createDomObservableFromEvent(t,r,n=!0,o=window){return r=void 0===r?e=>e:r,e(e=>o.addEventListener(t,e,{passive:n}),()=>{o[t]=e=>e}).pipe(vn(r))}static createMediaQuery(e){const t=window.matchMedia(e);return this.checkIfValidMediaQuery(t,e),!1!==t&&t}static checkIfValidMediaQuery(e,t){const r=e=>e.replace(/\s+/gm,""),n=void 0!==e.matches&&r(e.media).indexOf(r(t))>=0;return!1===n&&(t=>{console.warn(`Spyne Info: the following query string, "${t}", has been optimized to "${e.media}" by the browser and may not be a valid Media Query item!`)})(t),n}static createMediaQueryHandler(t,r){const n=(e=>t=>(t.mediaQueryName=e,t))(r),o=(s=t,{addHandler:e=>{s.addListener(e)},removeHandler:e=>{s.onchange=()=>{}}});var s;return new e(o.addHandler,o.removeHandler).pipe(vn(n))}static createMergedObsFromObj(e){const t=e.mediaQueries||e.mediaQueries,r=[];return ce((e,t,n)=>{const o=No.createMediaQuery(e);return!1!==o&&r.push(No.createMediaQueryHandler(o,t)),r},t),r}}const _o=[];class fo extends ho{constructor(e="CHANNEL_WINDOW"){super(e),this.bindStaticMethods(),this.currentScrollY=0}initializeStream(){this.domChannelConfig=ct.config.channels.WINDOW;const e=this.getActiveObservables(),t=l(...e);this.dom$=t,t.subscribe(e=>{const{action:t,payload:r,srcElement:n,event:o}=e;this.sendChannelPayload(t,r,n,o)})}static getMouseWheelMapFn(e){const t=this.channelActions.CHANNEL_WINDOW_WHEEL_EVENT,r=e.deltaY<=0?"up":"down",{deltaX:n,deltaY:o,deltaZ:s}=e;return{action:t,payload:{scrollDir:r,deltaX:n,deltaY:o,deltaZ:s},srcElement:e.srcElement,event:e}}static createCurriedGenericEvent(e){const t=`CHANNEL_WINDOW_${e.toUpperCase()}_EVENT`;return fe(fo.mapGenericEvent)(t)}static mapGenericEvent(e,t){return{action:e,payload:t,srcElement:t.srcElement,event:t}}static getResizeMapFn(e){return{action:this.channelActions.CHANNEL_WINDOW_RESIZE_EVENT,payload:ee(["innerWidth","innerHeight","outerWidth","outerHeight"],window),srcElement:e.srcElement,event:e}}static getOrientationMapFn(e){const t=this.channelActions.CHANNEL_WINDOW_ORIENTATION_EVENT,r=window.matchMedia("(orientation: portrait)").matches,n=ee(["innerWidth","innerHeight","outerWidth","outerHeight"],window);n.orientation=!0===r?"portrait":"landscape";return{action:t,payload:n,srcElement:e.srcElement,event:e}}getMediaQueryMapFn(e){return{action:this.channelActions.CHANNEL_WINDOW_MEDIA_QUERY_EVENT,payload:ee(["matches","media","mediaQueryName"],e),srcElement:e.srcElement,event:e}}createMouseWheelObservable(e){const t=e.debounceMSTimeForScroll;return No.createDomObservableFromEvent("wheel",fo.getMouseWheelMapFn.bind(this)).pipe(Vn(t))}static getScrollData(){let e=0;return t=>{const r=e-t;return e=t,{scrollY:t,scrollDistance:r,scrollDir:r>=0?"up":"down"}}}static getScrollY(e){return void 0!==e.pageYOffset?e.pageYOffset:e.scrollTop}static getScrollMapFn(e,t,r,n,o){const s=n(fo.getScrollY(o)),{scrollDistance:i}=s;return{action:r,payload:s,srcElement:e.srcElement,scrollDistance:i,event:e}}createScrollObservable(e,t=window,r=!0){const n=e.debounceMSTimeForScroll,o=t,s=t===window,i=void 0!==e.scrollElForVals?e.scrollElForVals:t,a=s?"CHANNEL_WINDOW_SCROLL_EVENT":"CHANNEL_WINDOW_ELEMENT_SCROLL_EVENT",c=fo.getScrollData(),l=Pe(fo.getScrollMapFn,[a,c,i,r,o]).bind(this);return No.createDomObservableFromEvent("scroll",l,r,o).pipe(Vn(n),(u=e=>0===e.scrollDistance,hr(function(e,t){var r=!1,n=0;e.subscribe(cn(t,function(e){return(r||(r=!u(e,n++)))&&t.next(e)}))})),vn(e=>{const t=fo.getScrollY(o);return e.payload.scrollDistanceAbs=Math.abs(this.currentScrollY-t),this.currentScrollY=t,e}));var u}createOrientationObservable(e){return No.createDomObservableFromEvent("orientationchange",fo.getOrientationMapFn.bind(this))}createResizeObservable(e){const t=e.debounceMSTimeForResize;return No.createDomObservableFromEvent("resize",fo.getResizeMapFn.bind(this)).pipe(Vn(t))}getEventsFromConfig(e=this.domChannelConfig){const t=e.events,r=Array.isArray(e.customEvents)?e.customEvents.map(fo.conformCustomEventConfig).filter(e=>null!==e):[];r.forEach(e=>this.updateChannelActions(e.name));const n=e=>{const t=fo.createCurriedGenericEvent(e);return No.createDomObservableFromEvent(e,t)};return D(n,t).concat(D(({name:e,operator:t,value:r})=>{const o=n(e);return void 0===t?o:fo.customizeCustomEventObservable(o,t,r)},r))}static conformCustomEventConfig(e){if("string"==typeof e)return{name:e,operator:void 0,value:void 0};if(null!==e&&"object"==typeof e&&"string"==typeof e.name){const t=["buffer","count","debounce","throttle"].filter(t=>void 0!==e[t]),r=t[0];return t.length>1&&!0===ct.debug&&console.warn(`Spyne Warning: the customEvent, ${e.name}, sets multiple operators (${t.join(", ")}); using ${r}.`),{name:e.name,operator:r,value:void 0!==r?e[r]:void 0}}return console.warn(`Spyne Warning: the following config.customEvents entry is not a string or a {name} object and was skipped: ${JSON.stringify(e)}`),null}static customizeCustomEventObservable(e,t,r){switch(t){case"buffer":return e.pipe((s=e.pipe(Vn(r)),hr(function(e,t){var r=[];return e.subscribe(cn(t,function(e){return r.push(e)},function(){t.next(r),t.complete()})),sn(s).subscribe(cn(t,function(){var e=r;r=[],t.next(e)},Vr)),function(){r=null}})),Mn(e=>e.length>0),vn(fo.mapBatchedEvents));case"count":return e.pipe((n=r,void 0===o&&(o=null),o=null!=o?o:n,hr(function(e,t){var r=[],s=0;e.subscribe(cn(t,function(e){var i,a,c,l,u=null;s++%o===0&&r.push([]);try{for(var d=fr(r),h=d.next();!h.done;h=d.next())(N=h.value).push(e),n<=N.length&&(u=null!=u?u:[]).push(N)}catch(e){i={error:e}}finally{try{h&&!h.done&&(a=d.return)&&a.call(d)}finally{if(i)throw i.error}}if(u)try{for(var E=fr(u),p=E.next();!p.done;p=E.next()){var N=p.value;Sr(r,N),t.next(N)}}catch(e){c={error:e}}finally{try{p&&!p.done&&(l=E.return)&&l.call(E)}finally{if(c)throw c.error}}},function(){var e,n;try{for(var o=fr(r),s=o.next();!s.done;s=o.next()){var i=s.value;t.next(i)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}t.complete()},void 0,function(){r=null}))})),vn(fo.mapBatchedEvents));case"debounce":return e.pipe(Vn(r));case"throttle":return e.pipe(jn(r));default:return e}var n,o,s}static mapBatchedEvents(e){const t=e[e.length-1],{action:r,srcElement:n,event:o}=t;return{action:r,payload:{detail:e.map(e=>void 0!==e.event&&null!==e.event?e.event.detail:void 0),isBatch:!0,batchCount:e.length},srcElement:n,event:o}}getActiveObservables(e=this.domChannelConfig){let t=[];e.listenForMediaQueries=vt(e.mediaQueries)||vt(e.mediaQueries);const r={listenForResize:this.createResizeObservable.bind(this),listenForOrientation:this.createOrientationObservable.bind(this),listenForScroll:this.createScrollObservable.bind(this),listenForWheel:this.createMouseWheelObservable.bind(this)};ce((r,n,o)=>{e[n]&&t.push(r(e))},r),this.checkForMediaQueries(e.listenForMediaQueries);const n=this.getEventsFromConfig(e);return t=t.concat(n),t}checkForMediaQueries(e){const t=e=>{const{action:t,payload:r,srcElement:n,event:o}=e;this.sendChannelPayload(t,r,n,o,this.observer$)};!0===e&&this.getMediaQueryObservable(this.domChannelConfig).subscribe(t)}getMediaQueryObservable(e){const t=this.createMergedObsFromObj(e);return ve(l,t).pipe(vn(this.getMediaQueryMapFn.bind(this)))}updateChannelActions(e){if("string"!=typeof e)return;const t=`CHANNEL_WINDOW_${e.toUpperCase()}_EVENT`;_o.push(t)}addRegisteredActions(){return["CHANNEL_WINDOW_ABORT_EVENT","CHANNEL_WINDOW_AFTERPRINT_EVENT","CHANNEL_WINDOW_ANIMATIONEND_EVENT","CHANNEL_WINDOW_ANIMATIONITERATION_EVENT","CHANNEL_WINDOW_ANIMATIONSTART_EVENT","CHANNEL_WINDOW_APPINSTALLED_EVENT","CHANNEL_WINDOW_BEFOREPRINT_EVENT","CHANNEL_WINDOW_BEFOREUNLOAD_EVENT","CHANNEL_WINDOW_BEGINEVENT_EVENT","CHANNEL_WINDOW_BLUR_EVENT","CHANNEL_WINDOW_CACHED_EVENT","CHANNEL_WINDOW_CHANGE_EVENT","CHANNEL_WINDOW_CLICK_EVENT","CHANNEL_WINDOW_CLOSE_EVENT","CHANNEL_WINDOW_COMPOSITIONEND_EVENT","CHANNEL_WINDOW_COMPOSITIONSTART_EVENT","CHANNEL_WINDOW_COMPOSITIONUPDATE_EVENT","CHANNEL_WINDOW_COPY_EVENT","CHANNEL_WINDOW_CUT_EVENT","CHANNEL_WINDOW_DBLCLICK_EVENT","CHANNEL_WINDOW_DEVICECHANGE_EVENT","CHANNEL_WINDOW_DEVICELIGHT_EVENT","CHANNEL_WINDOW_DEVICEMOTION_EVENT","CHANNEL_WINDOW_DEVICEORIENTATION_EVENT","CHANNEL_WINDOW_DEVICEPROXIMITY_EVENT","CHANNEL_WINDOW_DOMATTRIBUTENAMECHANGED_EVENT","CHANNEL_WINDOW_DOMATTRMODIFIED_EVENT","CHANNEL_WINDOW_DOMCHARACTERDATAMODIFIED_EVENT","CHANNEL_WINDOW_DOMCONTENTLOADED_EVENT","CHANNEL_WINDOW_DOMCONTENTLOADED_EVENT","CHANNEL_WINDOW_DOMELEMENTNAMECHANGED_EVENT","CHANNEL_WINDOW_DRAGEND_EVENT","CHANNEL_WINDOW_DRAGENTER_EVENT","CHANNEL_WINDOW_DRAGLEAVE_EVENT","CHANNEL_WINDOW_DRAGOVER_EVENT","CHANNEL_WINDOW_DRAGSTART_EVENT","CHANNEL_WINDOW_DRAG_EVENT","CHANNEL_WINDOW_DROP_EVENT","CHANNEL_WINDOW_ELEMENT_SCROLL_EVENT","CHANNEL_WINDOW_ERROR_EVENT","CHANNEL_WINDOW_FOCUSIN_EVENT","CHANNEL_WINDOW_FOCUS_EVENT","CHANNEL_WINDOW_FULLSCREENCHANGE_EVENT","CHANNEL_WINDOW_FULLSCREENERROR_EVENT","CHANNEL_WINDOW_HASHCHANGE_EVENT","CHANNEL_WINDOW_INPUT_EVENT","CHANNEL_WINDOW_INVALID_EVENT","CHANNEL_WINDOW_KEYDOWN_EVENT","CHANNEL_WINDOW_KEYPRESS_EVENT","CHANNEL_WINDOW_KEYUP_EVENT","CHANNEL_WINDOW_LOAD_EVENT","CHANNEL_WINDOW_MEDIA_QUERY_EVENT","CHANNEL_WINDOW_MESSAGE_EVENT","CHANNEL_WINDOW_MOUSEDOWN_EVENT","CHANNEL_WINDOW_MOUSEENTER_EVENT","CHANNEL_WINDOW_MOUSELEAVE_EVENT","CHANNEL_WINDOW_MOUSEMOVE_EVENT","CHANNEL_WINDOW_MOUSEOUT_EVENT","CHANNEL_WINDOW_MOUSEOVER_EVENT","CHANNEL_WINDOW_MOUSEUP_EVENT","CHANNEL_WINDOW_MOUSEWHEEL_EVENT","CHANNEL_WINDOW_OFFLINE_EVENT","CHANNEL_WINDOW_ONLINE_EVENT","CHANNEL_WINDOW_OPEN_EVENT","CHANNEL_WINDOW_ORIENTATION_EVENT","CHANNEL_WINDOW_PAGEHIDE_EVENT","CHANNEL_WINDOW_PAGESHOW_EVENT","CHANNEL_WINDOW_PASTE_EVENT","CHANNEL_WINDOW_POPSTATE_EVENT","CHANNEL_WINDOW_POPSTATE_EVENT","CHANNEL_WINDOW_PROGRESSEVENTS_EVENT","CHANNEL_WINDOW_RESET_EVENT","CHANNEL_WINDOW_RESIZE_EVENT","CHANNEL_WINDOW_SCROLL_ELEMENT_ADDED_EVENT","CHANNEL_WINDOW_SCROLL_EVENT","CHANNEL_WINDOW_SCROLL_LOCK_EVENT",["CHANNEL_WINDOW_SCROLL_LOCK_EVENT","onScrollLockEvent"],["CHANNEL_WINDOW_SET_ELEMENT_TO_SCROLL_EVENT","onSetElementToScroll"],"CHANNEL_WINDOW_STORAGE_EVENT","CHANNEL_WINDOW_SUBMIT_EVENT","CHANNEL_WINDOW_TRANSITIONCANCEL_EVENT","CHANNEL_WINDOW_TRANSITIONEND_EVENT","CHANNEL_WINDOW_TRANSITIONRUN_EVENT","CHANNEL_WINDOW_TRANSITIONSTART_EVENT","CHANNEL_WINDOW_UNLOAD_EVENT","CHANNEL_WINDOW_WHEEL_EVENT"].concat(_o)}onScrollLockEvent(e){}onSetElementToScroll(e){let{config:t,el:r,scrollElement:n}=e.payload;t=t||{},t=Ye(this.domChannelConfig,t),n=n||r;this.sendChannelPayload("CHANNEL_WINDOW_SCROLL_ELEMENT_ADDED_EVENT",{el:r},r),this.createScrollObservable(t,n).subscribe(e=>{const{action:t,payload:r,srcElement:n,event:o}=e;this.sendChannelPayload(t,r,n,o)})}bindStaticMethods(){this.createMediaQueryHandler=No.createMediaQueryHandler.bind(this),this.createMergedObsFromObj=No.createMergedObsFromObj.bind(this)}}class mo extends ho{constructor(e={}){super("CHANNEL_LIFECYCLE",e)}addRegisteredActions(){return["CHANNEL_LIFECYCLE_RENDERED_EVENT","CHANNEL_LIFECYCLE_DISPOSED_EVENT"]}onViewStreamInfo(e){const{action:t,srcElement:r}=e,n=r;n.action=t,this.onSendEvent(t,n)}onSendEvent(e,t={}){const r=this.channelActions[e],n={};window.setTimeout(()=>this.sendChannelPayload(r,t,n,void 0),0)}}class To extends ho{constructor(e={}){super("CHANNEL_AI",e)}addRegisteredActions(){return["CHANNEL_AI_RENDERED_EVENT","CHANNEL_AI_DISPOSED_EVENT"]}onViewStreamInfo(e){const{action:t,srcElement:r}=e,n=r;n.action=t,this.onSendEvent(t,n)}onSendEvent(e,t={}){const r=this.channelActions[e],n={};window.setTimeout(()=>this.sendChannelPayload(r,t,n,void 0),0)}}class Ao extends ho{constructor(e,t={}){t.isProxy=!0,super(e,t),this.props=t,this.subject$=new r,this.replaySub$=new i(1),this.observer$=l(this.subject$,this.replaySub$);!0===ct.debug&&this.checkIfChannelIsStillProxy(e)}getMergedSubject(e=!1){return!0===e?this.replaySub$:this.subject$}checkIfChannelIsStillProxy(e){const t=e;Ct(()=>{!0!==X(t,ct.listRegisteredChannels())&&console.warn(`Spyne Warning: The channel, ${t} does not appear to be registered!`)},1e3)}get replaySubject(){return this.replaySub$}get subject(){return this.subject$}}const yo=new Map;class Co{constructor(){this.addMixins(),yo.set("DISPATCHER",new r),this.listRegisteredChannels=Co.listRegisteredChannels.bind(this),this.getChannelsList=Co.getChannelsList.bind(this)}get map(){return yo}static getChannelsList(){return Array.from(yo,(e,t)=>({key:e[0],val:e[1].constructor.name}))}static listRegisteredChannels(e=!1){const t=this.getChannelsList(),r=m(U("ChannelProxy","val")),n=F(U("ChannelProxy","val")),o=(!0===e?n:r)(t);return Ve(["key"],o)}listProxyChannels(){return this.listRegisteredChannels(!0)}checkForMissingChannels(){const e=this.getChannelsList(),t=F(U("ChannelProxy","val"))(e);if(t.length>=1){const e=`Spyne Warning: The following ${1===t.length?"Channel has":"Channels have"} not been initialized: ${d(S(", "),D(v("key")))(t)}`;console.warn(e)}}init(){this.createMainStreams()}createMainStreams(){this.routeStream=new Eo,yo.set("CHANNEL_ROUTE",this.routeStream),this.uiStream=new po,yo.set("CHANNEL_UI",this.uiStream),this.domStream=new fo,yo.set("CHANNEL_WINDOW",this.domStream),this.viewStreamLifecycle=new mo,yo.set("CHANNEL_LIFECYCLE",this.viewStreamLifecycle),this.aiStream=new To,yo.set("CHANNEL_AI",this.aiStream),this.routeStream.initializeStream(),this.domStream.initializeStream()}addKeyEvent(e){yo.get("UI").addKeyEvent(e)}registerStream(e){const t=e.channelName;if(yo.has(t)){if(d(Ue(["props","isRegistered"],!0))(yo.get(t)))return void console.warn(`Spyne Warning: The Channel, ${t}, has already been registered!`)}yo.set(t,e),e.initializeStream()}getChannelActions(e){return yo.get(e).addRegisteredActions()}getProxySubject(e,t=!1){const r=!0===t?"replaySubject":"subject";return yo.get(e)[r]}testStream(e){return void 0!==yo.get(e)}getStream(e){return!1===this.testStream(e)&&yo.set(e,new Ao(e)),yo.get(e)}addMixins(){}}class go{constructor(e,t="",r=!0){return this.parentContext=e,this.omittedMethods=["autoBinder","initAutoBinder","getEnhancerMethods","checkForMalformedMethods","caller","arguments","bindParentViewStream"],this.prefix=t,!0===r&&this.autoBinder(),this.allMethodsList}initAutoBinder(){this.autoBinder()}getEnhancerMethods(){return function(e,t=[]){const r=P(["length","name","prototype","constructor"],t),n=d(ae(r),q),o=n(Object.getOwnPropertyNames(e.constructor.prototype)),s=n(Object.getOwnPropertyNames(e.constructor));return{methods:o,staticMethods:s,allMethods:P(o,s)}}(this,this.omittedMethods)}checkForMalformedMethods(e){const t=ct?.debug||!1;if(""===this.prefix&&t)return void console.warn(`SPYNE WARNING: The following SpyneTrait ${this.constructor.name} needs a prefix`);const r=m(e=>0===e.indexOf(this.prefix),e);if(r.length>=1&&t){const e=`Spyne Warning: The following method(s) in ${this.constructor.name} require the prefix, "${this.prefix}": [${r.join(", ")}];`;console.warn(e)}}bindParentViewStream(e,t){this.checkForMalformedMethods(e.allMethods);const r={},n=(e,n=!1)=>{const o=!0===n?this.constructor:this;"function"===typeof o[e]&&(r[e]=t[e]=o[e].bind(t))},o=we(2,n)(I,!0);return D(o,e.staticMethods),D(n,e.methods),r}autoBinder(){const e=this.getEnhancerMethods();return this.allMethodsList=this.bindParentViewStream(e,this.parentContext),this.allMethodsList}}class vo{constructor(e={},t,r,n){this._mapFn=vo.setMapFn(e),this._url=vo.setUrl(e),this._responseType=vo.setResponseType(e),this._serverOptions=vo.setServerOptions(e),this._subscriber=void 0!==t?t:e=>console.log("FETCH RETURNED ",e),this.debug=!0===e?.debug,this.disableSanitize=!0===e?.disableSanitize,this.channelName=n;const o={mapFn:this.mapFn,url:this.url,serverOptions:this.serverOptions,responseType:this.responseType,disableSanitize:this.disableSanitize,debug:this.debug};!0!==r&&vo.startWindowFetch(o,this._subscriber,this.channelName)}static startWindowFetch(e,t,r){const{mapFn:n,url:o,serverOptions:i,responseType:a,debug:c}=e,l={channelName:r,url:o,responseType:a,serverOptions:i},d=kn(!0===c?e=>{console.log("DEBUG FETCH :",e,l)}:()=>{}),h=u(window.fetch(o,i)).pipe(On(e=>u(vo.parseResponse(e,l))),d,vn((E=n,t=>{const r=!0===e?.disableSanitize?t:rr(t,{mode:"app"});return E(r,l)})),Tn(e=>s(vo.createFetchErrorPayload(e,l))),function(e){void 0===e&&(e={});var t=e.connector,r=void 0===t?function(){return new Hn}:t,n=e.resetOnError,o=void 0===n||n,s=e.resetOnComplete,i=void 0===s||s,a=e.resetOnRefCountZero,c=void 0===a||a;return function(e){var t,n,s,a=0,l=!1,u=!1,d=function(){null==n||n.unsubscribe(),n=void 0},h=function(){d(),t=s=void 0,l=u=!1},E=function(){var e=t;h(),null==e||e.unsubscribe()};return hr(function(e,p){a++,u||l||d();var N=s=null!=s?s:r();p.add(function(){0!==--a||u||l||(n=Fn(E,c))}),N.subscribe(p),!t&&a>0&&(t=new jr({next:function(e){return N.next(e)},error:function(e){u=!0,d(),n=Fn(h,o,e),N.error(e)},complete:function(){l=!0,d(),n=Fn(h,i),N.complete()}}),sn(e).subscribe(t))})(e)}}());var E;h.subscribe(t)}static async parseResponse(e,t){const{responseType:r}=t,n=e.status,o=e.statusText,s=e.headers?.get?.("content-type")||"",i={...t,status:n,statusText:o,contentType:s,ok:e.ok};if(!0!==e.ok){const t=await vo.safeReadText(e);throw vo.createFetchError({errorType:"FETCH_HTTP_ERROR",message:`Fetch request failed with status ${n} ${o}`,metadata:i,rawBody:t})}if("json"===r)return vo.parseJsonResponse(e,i);if("text"===r)return e.text();if("blob"===r)return e.blob();if("arrayBuffer"===r)return e.arrayBuffer();if("formData"===r)return e.formData();throw vo.createFetchError({errorType:"FETCH_UNSUPPORTED_RESPONSE_TYPE",message:`Unsupported fetch responseType "${r}"`,metadata:i})}static async parseJsonResponse(e,t){const r=await e.text(),n=r.trim();if(""===n)return null;try{return JSON.parse(n)}catch(e){throw vo.createFetchError({errorType:"FETCH_RESPONSE_PARSE_ERROR",message:"Expected JSON but could not parse response body.",metadata:t,rawBody:r,originalError:e})}}static createFetchError({errorType:e,message:t,metadata:r,rawBody:n="",originalError:o}){const s=new Error(t);return s.isChannelFetchError=!0,s.errorType=e,s.metadata=r,s.rawBody=n,s.originalError=o,s}static createFetchErrorPayload(e,t){const r=e?.metadata||t||{};return{isChannelFetchError:!0,isError:!0,error:!0,errorType:e?.errorType||"FETCH_UNKNOWN_ERROR",message:e?.message||"Unknown ChannelFetchUtil error",channelName:r.channelName,url:r.url,responseType:r.responseType,status:r.status,statusText:r.statusText,contentType:r.contentType,ok:r.ok,rawBodyPreview:vo.truncateBody(e?.rawBody),originalErrorMessage:e?.originalError?.message}}static truncateBody(e="",t=500){return"string"!=typeof e?"":e.length>t?`${e.slice(0,t)}...`:e}static async safeReadText(e){try{return await e.text()}catch(e){return""}}static setMapFn(e){return d(k(e=>e),v("mapFn"))(e)}static setUrl(e){const t=v("url",e);return void 0===t&&bt("SPYNE WARNING: URL is undefined for data channel"),t}static setResponseType(e){return k("json",v("responseType",e))}get mapFn(){return this._mapFn}get url(){return this._url}get serverOptions(){return this._serverOptions}get responseType(){return this._responseType}static stringifyBodyIfItExists(e){const t=e?.body;if(!0!==(null!==t&&"object"==typeof t&&t.constructor===Object))return e;const r=new Headers(e.headers||{});return!0!==r.has("Content-Type")&&r.set("Content-Type","application/json"),{...e,headers:r,body:JSON.stringify(t)}}static updateMethodWhenBodyExists(e){return void 0!==e?.body&&"GET"===(e?.method||"GET").toUpperCase()?(bt("SPYNE WARNING: Fetch body was provided with method GET. Changing method to POST.",e),{...e,method:"POST"}):e}static setServerOptions(e){const t=ee(["method","headers","body","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive"],e);let r=te(vo.baseOptions(),t);return r=vo.updateMethodWhenBodyExists(r),r=vo.stringifyBodyIfItExists(r),r}static baseOptions(){return{method:"GET",headers:new Headers({Accept:"application/json, text/plain, */*"}),mode:"cors",credentials:"same-origin",cache:"default",redirect:"follow",referrerPolicy:"no-referrer-when-downgrade",integrity:"",keepalive:!1}}}class bo extends ho{constructor(e,t={disableSanitize:!1}){bo.validateMapMethod(t,e),void 0!==t.map&&(t.mapFn=t.map),t.extendedActionsArr=[`${e}_RESPONSE_EVENT`,`${e}_ERROR_EVENT`,[`${e}_REQUEST_EVENT`,"onFetchUpdate"]],t.sendCachedPayload=!0,super(e,t)}static validateMapMethod(e,t,r=!1){const n=V(_,e=>"function"!=typeof e),o=Ae(n),s=f([o,e=>e.length>=1]);return!d(s,N,ee(["map","mapFn"]))(e)||(!1===r&&console.warn(`Spyne Warning: The map method for ChannelFetch, ${t}, appears to be invalid`),!1)}onRegistered(e=this.props){!0!==e?.pause&&this.startFetch()}addRegisteredActions(e){const t=d(k([]),K(["props","extendedActionsArr"]));return["CHANNEL_RESPONSE_EVENT","CHANNEL_ERROR_EVENT",["CHANNEL_UPDATE_RESPONSE_EVENT","onFetchUpdate"],["CHANNEL_FETCH_REQUEST_EVENT","onFetchUpdate"]].concat(t(this))}startFetch(e={},t=this.onFetchReturned.bind(this)){const r=this.consolidateAllFetchProps(e);return new vo(r,t,!1,this.props.name)}onFetchUpdate(e){const t=this.getPropsForFetch(e);this.startFetch(t)}onFetchReturned(e){const t=!0===e?.isChannelFetchError?`${this.props.name}_ERROR_EVENT`:`${this.props.name}_RESPONSE_EVENT`;return this.createChannelPayloadItem(e,t)}createChannelPayloadItem(e,t=`${this.props.name}_RESPONSE_EVENT`){const{name:r,sendCachedPayload:n,url:o}=this.props,s={name:r,sendCachedPayload:n,url:o};this.sendChannelPayload(t,e,s)}getPropsForFetch(e){return ee(["mapFn","url","header","body","mode","method","responseType","debug"],e?.payload??e?.viewStreamInfo?.payload??{})}consolidateAllFetchProps(e,t=this.props){const r=ee(["mapFn","url","header","body","mode","disableSanitize","method","responseType","debug"],t),n=m(_);return d(n,(e,t)=>te(e,t))(r,e)}get observer(){return this.observer$}}let Io=ct;class So{constructor(e={}){let{name:t,config:r,parentEl:n}=e;this.props=e,void 0===r&&(r=re(e)),this.name=t||"empty",this.props.name=t,r=So.mergeDefaultConfig(r,this.defaultConfig()),this.props.parentEl=n||So.createParentEl(),this.props.config=r,void 0!==this.props.traits&&this.addTraits(this.props.traits)}register(e){Io=e,this.props.pluginName=this.props.name,!1!==Io.initialized?(this.onBeforeRegistered(),this.props.config=re(this.props.config),Io.addPluginConfig(this.name,this.props.config),this.onRegistered(),this.onRender()):console.warn(`Spyne Warning: SpyneApp has not been initialized yet! Cannot register plugin "${this.name}".`)}get SpyneAppProperties(){return Io}static mergeDefaultConfig(e={},t=this.defaultConfig()){return Object.assign(t,e)}static getSpyneApp(e,t){!1===Io.initialized?console.warn(`Spyne Warning: Unable to install plugin, ${e}! SpyneApp has not been initialized!`):Io.addPluginConfig(e,t)}static updateSpyneConfig(e,t,r){return!0===xe(C(Object),["config","plugins",t])(e)?(!0===e.config.debug&&console.warn(`Spyne Warning: The plugin, ${t}, already exists`),!1):(e.config.plugins[t]=r,e.config.plugins[t])}static createParentEl(e){return e||document.getElementById("spyne-plugins")||(()=>{const e=new lr({id:"spyne-plugins"});document.body.appendChild(e.render());const t=document.getElementById("spyne-plugins");return t.style.cssText="position:absolute; top:0;left:0;width:100%;height:100%;min-height:100vh;z-index:1000000; pointer-events:none",t})()}addTraits(e){"Array"!==e.constructor.name&&(e=[e]);e.forEach(e=>new e(this))}onBeforeRegistered(){this.checkForRequiredWindowEvent()}checkForRequiredWindowEvent(){const e=this.props.requiredEvents??[],t=this.props.requiredCustomEvents??[],r=ct.getChannelConfig("WINDOW"),n=e.filter(e=>!r.events.includes(e)),o=e=>"string"==typeof e?e:e?.name,s=r.customEvents.map(o),i=t.filter(e=>!s.includes(o(e)));if(n.length>0&&console.warn(`plugin "${this.props.name}" requires the following config.WINDOW.events, --\x3e ${n.join(", ")} <--`),i.length>0){const e=e=>"string"==typeof e?`'${e}'`:JSON.stringify(e);console.warn(`plugin "${this.props.name}" requires the following config.WINDOW.customEvents, --\x3e ${i.map(e).join(", ")} <--`)}}defaultConfig(){return{}}onRegistered(){}onRender(){}}const Lo=new Co,Oo="0.26.0";let Do=new class{constructor(){this.version=Oo}get channels(){return Lo}init(e={},t=!1){
2
2
  /*!
3
- * Spyne 0.25.0
3
+ * Spyne 0.26.0
4
4
  * https://spynejs.org
5
5
  *
6
6
  * @license
@@ -14,5 +14,5 @@ import{fromEventPattern as e,Observable as t,Subject as r,bindCallback as n,from
14
14
  *
15
15
  * This notice may not be removed or altered from any distribution.
16
16
  */
17
- if(!0===it.initialized)return t?"The Spyne Application has already been initialized!":void console.warn("The Spyne Application has already been initialized!");let r={scrollLock:!1,scrollLockX:31,scrollLockY:0,debug:!1,strict:!1,mode:"app",disableSanitize:!1,iframes:{},customElements:[],baseHref:void 0,IMG_PATH:"undefined"!=typeof IMG_PATH?IMG_PATH:void 0,pluginMethods:{},plugins:{},tmp:{},ephemeralProps:{},tmpProps:{},channels:{WINDOW:{mediaQueries:{},events:[],listenForResize:!0,listenForOrientation:!0,listenForScroll:!1,listenForMouseWheel:!1,listenForWheel:!1,debounceMSTimeForResize:200,debounceMSTimeForScroll:150},ROUTE:{type:"slash",isHash:!1,isHidden:!1,add404s:!1,routes:{routePath:{routeName:"change"}}}}};if(void 0!==e){const t=Fe;e=it.initialize(r,e,io,t)}this.pluginsFn=it.getPluginsMethodObj(e.pluginMethods),this.getChannelActions=e=>io.getChannelActions(e),this.registerChannel=e=>io.registerStream(e),this.registerPlugin=e=>it.registerPlugin(e),this.registerDataChannel=e=>io.registerStream(e),this.listChannels=()=>Array.from(io.map.keys());let n=new Gn({id:"spyne-null-views"});n.appendToDom(document.body),n.props.el.style.cssText="display:none; opacity:0; pointer-events:none;",io.init(),!0===it.config.debug&&(window.Spyne={version:ao}),((e={})=>{if(Gt)return void Nt("sanitizeHTML is already configured. Reconfiguration is not allowed.");const{strict:t=!1,mode:r="app",disableSanitize:n=!1,allowTargetAttr:o=!0,addNoopener:s=!0,debug:i=!1,iframes:a={}}=e;if(!0===n)return console.warn("SPYNE SECURITY WARNING: All HTML sanitization is DISABLED via config.disableSanitize. Do not use this setting in production."),kt=e=>e,void(Gt=!0);const c=["richtext","authoring","development"].includes(r),l=void 0!==a.allow?!0===a.allow:c,d={RETURN_TRUSTED_TYPE:!1,ADD_TAGS:[...l?["iframe"]:[],...c?["link"]:[]],ADD_ATTR:[...o?["target"]:[],...l?["sandbox"]:[]],CUSTOM_ELEMENT_HANDLING:vt,...!0!==l&&c?{FORBID_TAGS:["iframe"]}:{}},u=e=>We.sanitize(e,d);if(o&&We.addHook("afterSanitizeAttributes",e=>{if(!e||"function"!=typeof e.getAttribute)return;if("A"!==e.tagName)return;const t=e.getAttribute("href"),r=e.getAttribute("target");if(t||!r){if(r)if(["_blank","_self","_parent","_top"].includes(r)){if("_blank"===r&&s){const t=(e.getAttribute("rel")||"").split(/\s+/).filter(Boolean),r=new Set(t);r.add("noopener"),r.add("noreferrer"),e.setAttribute("rel",Array.from(r).join(" "))}}else e.removeAttribute("target")}else e.removeAttribute("target")}),kt=u,!0===t&&window.trustedTypes)try{const e=window.trustedTypes.createPolicy("default",{createHTML:e=>u(e)});kt=t=>e.createHTML(t),!0===i&&console.log("SPYNE: Trusted Types default policy registered. Note that browser enforcement additionally requires the CSP header: require-trusted-types-for 'script'.")}catch(e){Nt('SPYNE WARNING: A Trusted Types "default" policy already exists on this page. Falling back to direct sanitization.',e)}Gt=!0})(it.config),Mt(it.config)}static listChannels(){return Array.from(io.map.keys())}static getChannelActions(e){return io.getChannelActions(e)}static registerChannel(e){if(!1!==it.initialized)return io.registerStream(e);console.warn("Spyne has not been initialized")}};export{zn as Channel,no as ChannelFetch,ro as ChannelFetchUtil,dt as ChannelPayload,Un as ChannelPayloadFilter,eo as ChannelsMap,Bt as DomElement,zt as DomElementTemplate,co as SpyneApp,it as SpyneAppProperties,so as SpynePlugin,to as SpyneTrait,Gn as ViewStream,On as ViewStreamBroadcaster,vn as ViewStreamElement,Sn as ViewStreamPayload,kn as ViewStreamSelector,bt as allowCustomElements,Ye as deepMerge,lt as safeClone,Wt as sanitizeData,$t as sanitizeEventTarget,_t as setSpyneWarningsDisabled};
17
+ if(!0===ct.initialized)return t?"The Spyne Application has already been initialized!":void console.warn("The Spyne Application has already been initialized!");let r={scrollLock:!1,scrollLockX:31,scrollLockY:0,debug:!1,strict:!1,mode:"app",disableSanitize:!1,iframes:{},anchors:{},customElements:[],baseHref:void 0,IMG_PATH:"undefined"!=typeof IMG_PATH?IMG_PATH:void 0,pluginMethods:{},plugins:{},tmp:{},ephemeralProps:{},tmpProps:{},channels:{WINDOW:{mediaQueries:{},events:[],customEvents:[],listenForResize:!0,listenForOrientation:!0,listenForScroll:!1,listenForMouseWheel:!1,listenForWheel:!1,debounceMSTimeForResize:200,debounceMSTimeForScroll:150},ROUTE:{type:"slash",isHash:!1,isHidden:!1,add404s:!1,routes:{routePath:{routeName:"change"}}}}};if(void 0!==e){const t=Fe;e=ct.initialize(r,e,Lo,t)}this.pluginsFn=ct.getPluginsMethodObj(e.pluginMethods),this.getChannelActions=e=>Lo.getChannelActions(e),this.registerChannel=e=>Lo.registerStream(e),this.registerPlugin=e=>ct.registerPlugin(e),this.registerDataChannel=e=>Lo.registerStream(e),this.listChannels=()=>Array.from(Lo.map.keys());let n=new lo({id:"spyne-null-views"});n.appendToDom(document.body),n.props.el.style.cssText="display:none; opacity:0; pointer-events:none;",Lo.init(),!0===ct.config.debug&&(window.Spyne={version:Oo}),((e={})=>{if(ir)return void bt("sanitizeHTML is already configured. Reconfiguration is not allowed.");const{strict:t=!1,mode:r="app",disableSanitize:n=!1,allowTargetAttr:o=!0,debug:s=!1,iframes:i={},anchors:a={}}=e;if(!0===n)return console.warn("SPYNE SECURITY WARNING: All HTML sanitization is DISABLED via config.disableSanitize. Do not use this setting in production."),sr=e=>e,void(ir=!0);const c=["richtext","authoring","development"].includes(r),l=void 0!==i.allow?!0===i.allow:c,u={RETURN_TRUSTED_TYPE:!1,ADD_TAGS:[...l?["iframe"]:[],...c?["link"]:[]],ADD_ATTR:[...(void 0!==a.allowTarget?!0===a.allowTarget:!0===o)?["target","rel"]:[],...l?["sandbox"]:[]],CUSTOM_ELEMENT_HANDLING:Ut,...!0!==l&&c?{FORBID_TAGS:["iframe"]}:{}},d=e=>Me.sanitize(e,u);if(sr=d,!0===t&&window.trustedTypes)try{const e=window.trustedTypes.createPolicy("default",{createHTML:e=>d(e)});sr=t=>e.createHTML(t),!0===s&&console.log("SPYNE: Trusted Types default policy registered. Note that browser enforcement additionally requires the CSP header: require-trusted-types-for 'script'.")}catch(e){bt('SPYNE WARNING: A Trusted Types "default" policy already exists on this page. Falling back to direct sanitization.',e)}ir=!0})(ct.config),tr(ct.config)}static listChannels(){return Array.from(Lo.map.keys())}static getChannelActions(e){return Lo.getChannelActions(e)}static registerChannel(e){if(!1!==ct.initialized)return Lo.registerStream(e);console.warn("Spyne has not been initialized")}};export{ho as Channel,bo as ChannelFetch,vo as ChannelFetchUtil,At as ChannelPayload,ro as ChannelPayloadFilter,Co as ChannelsMap,lr as DomElement,cr as DomElementTemplate,Do as SpyneApp,ct as SpyneAppProperties,So as SpynePlugin,go as SpyneTrait,lo as ViewStream,qn as ViewStreamBroadcaster,zn as ViewStreamElement,Yn as ViewStreamPayload,co as ViewStreamSelector,Vt as allowCustomElements,Ye as deepMerge,ft as safeAugment,mt as safeClone,ht as safeCloneDeep,pt as safeFilter,_t as safeMap,Nt as safeReject,rr as sanitizeData,or as sanitizeEventTarget,It as setSpyneWarningsDisabled};
18
18
  //# sourceMappingURL=spyne.esm.js.map