spyne 0.24.0 → 0.25.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 +3 -3
- package/lib/spyne.esm.js.LICENSE.txt +2 -2
- package/lib/spyne.esm.js.map +1 -1
- package/lib/spyne.umd.js +2 -2
- package/lib/spyne.umd.js.LICENSE.txt +2 -2
- package/package.json +1 -1
- package/src/spyne/spyne-app.js +3 -2
- package/src/spyne/spyne.js +5 -2
- package/src/spyne/utils/channel-fetch-util.js +3 -2
- package/src/spyne/utils/sanitize-data.js +65 -6
- package/src/spyne/utils/sanitize-html.js +8 -2
- package/src/spyne/utils/spyne-warn.js +26 -0
- package/src/spyne/views/dom-element.js +2 -1
- package/src/spyne/views/view-stream-selector.js +52 -47
- package/src/tests/index.test.js +5 -0
- package/src/tests/utils/security.test.js +65 -1
- package/src/tests/views/dom-el-selectors.test.js +7 -7
- package/src/tests/views/view-stream-selector.test.js +178 -0
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)};let Nt,_t=!1;const ft=e=>{if(!_t)throw new Error("sanitizeHTML is not configured. Call sanitizeHTMLConfigure() with appropriate config.");return Nt(e)};class mt{constructor(e,t={},r={}){if(this.template=this.formatTemplate(e),this.isProxyData=!0===t.__cms__isProxy,this.testMode=r?.testMode,this.template=mt.normalizeTripleBrackets(this.template),!0===this.isProxyData){const e=!0===it.enableCMSProxies?it.formatTemplateForProxyData:mt.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=mt.getStringArray(this.template);let o=this.template.match(mt.findTmplLoopsRE());o=null===o?[]:o;const s=mt.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(mt.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 mt.innerLoopRE().test(e)}removeThis(){void 0!==this&&(this.finalArr=void 0,this.templateData=void 0,this.template=void 0)}renderDocFrag(){let e=mt.replaceImgPath(this.finalArr.join(""));!0!==this.testMode&&(e=ft(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=mt.replaceImgPath(e),!0!==this.testMode&&(e=String(ft(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(mt.swapParamsForTagsRE(),(e,t,r,n)=>mt.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=mt.innerLoopRE();return e.replace(r,(e,r,n,o)=>{!0===mt.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=mt.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(mt.isPrimitiveTag(e)){const r=t.replace(/\$/g,"$$$$");return e.replace(mt.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(mt.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=mt.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=mt.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}}let Tt,At=!1,Ct=!1;const yt=/^(?:(?:https?|mailto|tel):|data:image\/|(?![a-z][a-z0-9+.-]*:)[\s\S]*$)/i,gt=e=>String(e).replace(/[\u0000-\u0020]/g,""),bt={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:yt},vt={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:yt};let It={allow:void 0,allowedOrigins:[],sandbox:"allow-scripts allow-same-origin allow-popups"},St=It;const Lt=e=>e?{allow:void 0!==e.allow?e.allow:It.allow,allowedOrigins:void 0!==e.allowedOrigins?e.allowedOrigins:It.allowedOrigins,sandbox:void 0!==e.sandbox?e.sandbox:It.sandbox}:It,Ot=(e,t=St)=>{const r=gt(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 Dt=!1;const Rt=["richtext","authoring","development"],Ht=()=>{const e=it?.mode;if(Rt.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"},wt=e=>{const t="richtext"===e?bt:vt,r=((e,t=St)=>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 Vt(e="app"){const t=wt(e);return e=>We.sanitize(e,t)}const Pt=(e={})=>{if(At)return void console.warn("sanitizeData is already configured. Reconfiguration is not allowed.");const{strict:t=!1,disableSanitize:r=!1,iframes:n}=e;Ct=!0===r,n&&"object"==typeof n&&(It=Lt(n),St=It),Ct?console.warn("SPYNE SECURITY WARNING: All data sanitization is DISABLED via config.disableSanitize. Do not use this setting in production."):Dt||(Dt=!0,We.addHook("afterSanitizeAttributes",e=>{if(!e||"IFRAME"!==e.tagName)return;const t=e.getAttribute("src")||"";""!==t&&!0!==Ot(t)&&(console.warn(`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}=St;!1!==r&&!0!==e.hasAttribute("sandbox")&&e.setAttribute("sandbox",r)}));const o=e=>{const t=Vt(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};Tt=(e,r={})=>{const{disableSanitize:n=!1,mode:s,iframes:i}=r;if(Ct||n)return e;const a=s||(t?"app":Ht());St=Lt(i);try{return o(a)(e)}finally{St=It}},Pt.sanitizeDataForce=(e,t)=>{if(Ct)return e;const r=t||Ht();return o(r)(e)},At=!0},Ut=(e,t={})=>{if(!At)throw new Error("sanitizeData is not configured. Call sanitizeDataConfigure() first.");return Tt(e,t)},Mt=["href","src","action","formaction","ping","poster","cite","codebase","manifest","icon","background"],Wt=(e,t,r)=>{if(Ct)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=wt(Ht());return{allowed:!0,value:We.sanitize(String(t),e)}}return"IFRAME"===o&&"src"===n?{allowed:Ot(t,It),value:t}:Mt.includes(n)&&!0!==(s=t,yt.test(gt(s)))?{allowed:!1,value:t}:{allowed:!0,value:t};var s},xt=(e,t)=>{if(!e||Ct)return;const r=Vt(t||Ht()),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)}};class Ft{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}=Wt(n,t,e.tagName);if(!0!==r)return void console.warn(`SPYNE WARNING: The attribute "${n}" was removed during sanitization.`,e);t=o}e.setAttribute(n,t)}else de(o,t)}),!0!==r&&(e=>{if(Ct||!e||"IFRAME"!==e.tagName)return e;const{sandbox:t}=It;!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 mt(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 $t=(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 Gt(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 jt=function(e,t){return jt=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])},jt(e,t)};function zt(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}jt(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function Bt(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 Yt(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 Kt(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 qt(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 Qt(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 Xt(e){return this instanceof Xt?(this.v=e,this):new Xt(e)}function Jt(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 Xt?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 Zt(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=Kt(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 er=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function tr(e){return kt(null==e?void 0:e.then)}function rr(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 nr=rr(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 or(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var sr=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=Kt(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 nr?e.errors:[e]}var l=this._finalizers;if(l){this._finalizers=null;try{for(var d=Kt(l),u=d.next();!u.done;u=d.next()){var h=u.value;try{cr(h)}catch(e){o=null!=o?o:[],e instanceof nr?o=Qt(Qt([],qt(o)),qt(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 nr(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)cr(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)&&or(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&or(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}(),ir=sr.EMPTY;function ar(e){return e instanceof sr||e&&"closed"in e&&kt(e.remove)&&kt(e.add)&&kt(e.unsubscribe)}function cr(e){kt(e)?e():e.unsubscribe()}var lr={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},dr={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=dr.delegate;return(null==o?void 0:o.setTimeout)?o.setTimeout.apply(o,Qt([e,t],qt(r))):setTimeout.apply(void 0,Qt([e,t],qt(r)))},clearTimeout:function(e){var t=dr.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function ur(e){dr.setTimeout(function(){throw e})}function hr(){}var Er=pr("C",void 0,void 0);function pr(e,t,r){return{kind:e,value:t,error:r}}function Nr(e){e()}var _r=function(e){function t(t){var r=e.call(this)||this;return r.isStopped=!1,t?(r.destination=t,ar(t)&&t.add(r)):r.destination=gr,r}return zt(t,e),t.create=function(e,t,r){return new Ar(e,t,r)},t.prototype.next=function(e){this.isStopped?yr(function(e){return pr("N",e,void 0)}(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?yr(pr("E",void 0,e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?yr(Er,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}(sr),fr=Function.prototype.bind;function mr(e,t){return fr.call(e,t)}var Tr=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){Cr(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){Cr(e)}else Cr(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){Cr(e)}},e}(),Ar=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&&lr.useDeprecatedNextContext?((s=Object.create(t)).unsubscribe=function(){return i.unsubscribe()},o={next:t.next&&mr(t.next,s),error:t.error&&mr(t.error,s),complete:t.complete&&mr(t.complete,s)}):o=t;return i.destination=new Tr(o),i}return zt(t,e),t}(_r);function Cr(e){ur(e)}function yr(e,t){var r=lr.onStoppedNotification;r&&dr.setTimeout(function(){return r(e,t)})}var gr={closed:!0,next:hr,error:function(e){throw e},complete:hr},br="function"==typeof Symbol&&Symbol.observable||"@@observable";function vr(e){return e}function Ir(e){return 0===e.length?vr:1===e.length?e[0]:function(t){return e.reduce(function(e,t){return t(e)},t)}}var Sr=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 _r||function(e){return e&&kt(e.next)&&kt(e.error)&&kt(e.complete)}(n)&&ar(n)?e:new Ar(e,t,r);return Nr(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=Lr(t))(function(t,n){var o=new Ar({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[br]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Ir(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=Lr(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 Lr(e){var t;return null!==(t=null!=e?e:lr.Promise)&&void 0!==t?t:Promise}function Or(e){return kt(e[br])}function Dr(e){return Symbol.asyncIterator&&kt(null==e?void 0:e[Symbol.asyncIterator])}function Rr(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 Hr="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function wr(e){return kt(null==e?void 0:e[Hr])}function Vr(e){return Jt(this,arguments,function(){var t,r,n;return Yt(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,Xt(t.read())];case 3:return r=o.sent(),n=r.value,r.done?[4,Xt(void 0)]:[3,5];case 4:return[2,o.sent()];case 5:return[4,Xt(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 Pr(e){return kt(null==e?void 0:e.getReader)}function Ur(e){if(e instanceof Sr)return e;if(null!=e){if(Or(e))return o=e,new Sr(function(e){var t=o[br]();if(kt(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")});if(er(e))return n=e,new Sr(function(e){for(var t=0;t<n.length&&!e.closed;t++)e.next(n[t]);e.complete()});if(tr(e))return r=e,new Sr(function(e){r.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,ur)});if(Dr(e))return Mr(e);if(wr(e))return t=e,new Sr(function(e){var r,n;try{for(var o=Kt(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(Pr(e))return Mr(Vr(e))}var t,r,n,o;throw Rr(e)}function Mr(e){return new Sr(function(t){(function(e,t){var r,n,o,s;return Bt(this,void 0,void 0,function(){var i,a;return Yt(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),r=Zt(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 Wr(e,t,r,n,o){return new xr(e,t,r,n,o)}var xr=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 zt(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}(_r),Fr=function(e){function t(t,r){return e.call(this)||this}return zt(t,e),t.prototype.schedule=function(e,t){return this},t}(sr),$r={setInterval: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.setInterval)?o.setInterval.apply(o,Qt([e,t],qt(r))):setInterval.apply(void 0,Qt([e,t],qt(r)))},clearInterval:function(e){var t=$r.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 zt(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),$r.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&&$r.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,or(n,this),null!=t&&(this.id=this.recycleAsyncId(r,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(Fr),Gr={now:function(){return(Gr.delegate||Date).now()},delegate:void 0},jr=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=Gr.now,e}(),zr=new(function(e){function t(t,r){void 0===r&&(r=jr.now);var n=e.call(this,t,r)||this;return n.actions=[],n._active=!1,n}return zt(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}(jr))(kr);function Br(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 Yr(e){return Gt(function(t,r){var n,o=null,s=!1;o=t.subscribe(Wr(r,void 0,void 0,function(i){n=Ur(e(i,Yr(e)(t))),o?(o.unsubscribe(),o=null,n.subscribe(r)):s=!0})),s&&(o.unsubscribe(),o=null,n.subscribe(r))})}function Kr(e,t){return void 0===t&&(t=0),Gt(function(r,n){r.subscribe(Wr(n,function(r){return Br(n,e,function(){return n.next(r)},t)},function(){return Br(n,e,function(){return n.complete()},t)},function(r){return Br(n,e,function(){return n.error(r)},t)}))})}function qr(e,t){return void 0===t&&(t=0),Gt(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function Qr(e,t){if(!e)throw new Error("Iterable cannot be null");return new Sr(function(r){Br(r,t,function(){var n=e[Symbol.asyncIterator]();Br(r,t,function(){n.next().then(function(e){e.done?r.complete():r.next(e.value)})},0,!0)})})}function Xr(e,t){if(null!=e){if(Or(e))return function(e,t){return Ur(e).pipe(qr(t),Kr(t))}(e,t);if(er(e))return function(e,t){return new Sr(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(tr(e))return function(e,t){return Ur(e).pipe(qr(t),Kr(t))}(e,t);if(Dr(e))return Qr(e,t);if(wr(e))return function(e,t){return new Sr(function(r){var n;return Br(r,t,function(){n=e[Hr](),Br(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(Pr(e))return function(e,t){return Qr(Vr(e),t)}(e,t)}throw Rr(e)}function Jr(e,t){return Gt(function(r,n){var o=0;r.subscribe(Wr(n,function(r){n.next(e.call(t,r,o++))}))})}var Zr=Array.isArray;function en(e){return Jr(function(t){return function(e,t){return Zr(t)?e.apply(void 0,Qt([],qt(t))):e(t)}(e,t)})}function tn(e,t,r){return void 0===r&&(r=vr),function(n){rn(t,function(){for(var o=e.length,s=new Array(o),i=o,a=o,c=function(o){rn(t,function(){var c=function(e,t){return t?Xr(e,t):Ur(e)}(e[o],t),l=!1;c.subscribe(Wr(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 rn(e,t,r){e?Br(r,e,t):t()}function nn(e,t,r){return void 0===r&&(r=1/0),kt(t)?nn(function(r,n){return Jr(function(e,o){return t(r,e,n,o)})(Ur(e(r,n)))},r):("number"==typeof t&&(r=t),Gt(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;Ur(r(e,d++)).subscribe(Wr(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?Br(t,i,function(){return p(e)}):p(e)};c.length&&l<n;)e();h()}catch(e){t.error(e)}}))};return e.subscribe(Wr(t,E,function(){u=!0,h()})),function(){null==a||a()}}(t,n,e,r)}))}var on=Array.isArray;function sn(){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 Ir(e)}(sn.apply(void 0,Qt([],qt(e))),en(r)):Gt(function(t,r){tn(Qt([t],qt(function(e){return 1===e.length&&on(e[0])?e[0]:e}(e))))(r)})}var an=rr(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),cn=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 zt(t,e),t.prototype.lift=function(e){var t=new ln(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new an},t.prototype.next=function(e){var t=this;Nr(function(){var r,n;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var o=Kt(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;Nr(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;Nr(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?ir:(this.currentObservers=null,s.push(e),new sr(function(){t.currentObservers=null,or(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 Sr;return e.source=this,e},t.create=function(e,t){return new ln(e,t)},t}(Sr),ln=function(e){function t(t,r){var n=e.call(this)||this;return n.destination=t,n.source=r,n}return zt(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:ir},t}(cn);function dn(e,t){return void 0===t&&(t=zr),Gt(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(Wr(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 Sr(function(e){return e.complete()});function hn(e){return e<=0?function(){return un}:Gt(function(t,r){var n=0;t.subscribe(Wr(r,function(t){++n<=e&&(r.next(t),e<=n&&r.complete())}))})}function En(e,t){return Gt(function(r,n){var o=0;r.subscribe(Wr(n,function(r){return e.call(t,r,o++)&&n.next(r)}))})}function pn(e){return Gt(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}function Nn(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 Ar({next:function(){o.unsubscribe(),e()}});return Ur(t.apply(void 0,Qt([],qt(r)))).subscribe(o)}}else e()}function _n(e,t){return void 0===t&&(t=!1),Gt(function(r,n){var o=0;r.subscribe(Wr(n,function(r){var s=e(r,o++);(s||t)&&n.next(r),!s&&n.complete()}))})}function fn(e,t,r){var n=kt(e)||t||r?{next:e,error:t,complete:r}:e;return n?Gt(function(e,t){var r;null===(r=n.subscribe)||void 0===r||r.call(n);var o=!0;e.subscribe(Wr(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)}))}):vr}class mn{constructor(e){this.props.observableStreams=mn.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(En(e=>void 0!==e&&void 0!==e.action)),E=e.pipe(En(a),Jr(d)),p=e.pipe(En(s),Jr(l)),N=e.pipe(En(i),Jr(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 Tn{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=mn.createDirectionalFiltersObject(),this.addDefaultDir=mn.addDefaultDir,this.sourceStreams=mn.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 Ft(t,e,r,n)}onDisposeCompleted(e){}animateInTween(e,t){!function(e,t){const r=1*window.getComputedStyle(e).opacity,n=$t(!0,t,"ease",1===r);e.style.cssText+=n}(e,t)}animateOutTween(e,t,r){!function(e,t,r){const n=$t(!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 Ft({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 An(){setTimeout(()=>{Ee(e=>{},this)},1)}class Cn{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=An}}const yn=!0===it.debug;class gn{constructor(e,t){this.addMixins(),this.props=e,this.broadcastFn=t,this.broadcaster(this.broadcastFn)}addDblClickEvt(e){return o(e,"dblclick").pipe(Jr(e=>{const t=re(e);return t.typeOverRide="dblclick",t}))}broadcast(e){if(e.length<=0&&!0===yn)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===yn?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 Cn("CHANNEL_ROUTE",e,t,"subscribe")},sendUIPayload:function(e,t){return new Cn("CHANNEL_UI",e,t,"subscribe")}};this.sendUIPayload=e.sendUIPayload,this.sendRoutePayload=e.sendRoutePayload}}const bn=u(ne,y(Array)),vn=u(ne,E),In=f([y(String),vn]),Sn=f([y(Array),vn]),Ln=u(f([bn,y(Object)])),On=u(f([vn,bn,y(Object)]));class Dn{constructor(e,t={},r,n){Ln(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=In(e)?Dn.filterSelector([e],r):void 0,c=Sn(e)?Dn.filterSelector(e,r):void 0,l=On(i)?Dn.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)||Ln(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 Dn.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(Dn.checkPayloadSelector)(r,t)}}function Rn(){return!0===it.debug}function Hn(e){return u(se(0),k(-1),b("nodeType"))(e)}function wn(e,t,r=!1){const n=Pn(e,t,r);return 1===n.length?p(n):n}function Vn(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===Rn()&&!1===i&&console.warn(`Spyne Warning: the selector, ${t} does not exist in this el, ${e}`)}}else console.warn(`Spyne Warning: the el object is not a valid single element, ${n}`)}function Pn(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){Vn(!0===n?"body":e,t,r)}return o}function Un(e,t,r){return Pn(t,r).forEach(t=>{t.style.cssText=e}),this}function Mn(e,t){function r(t){return Mn(e,t)}return Vn(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(Pn(e,t)).map(r),r.forEach=r=>Array.from(Pn(e,t)).map(r),r.getNodeListArray=()=>Pn(e,t),r.addClass=r=>(Pn(e,t).forEach(e=>e.classList.add(r)),this),r.removeClass=r=>(Pn(e,t).forEach(e=>{e.classList.remove(r)}),this),r.setClass=r=>(Pn(e,t).forEach(e=>{const t=u(m(E),z(" "))(e.className),n=r.split(" ");t.forEach(t=>e.classList.remove(t)),n.forEach(t=>e.classList.add(t))}),this),r.unmount=()=>{},r.toggleClass=(r,n)=>(Pn(e,t).forEach(e=>{(n=void 0!==n?n:!e.classList.contains(r))?e.classList.add(r):e.classList.remove(r)}),this),r.toggle=(e,t)=>(r.toggleClass(e,t),this),r.appendChild=e=>(0!==r.el.length?r.el.appendChild(e):console.warn(`Spyne Warning: The selector, ${t} does not appear to be valid!`),r.el),r.addAnimClass=r=>{requestAnimationFrame(()=>{Pn(e,t).forEach(e=>{try{e.classList.add(r)}catch(e){}})})},r.setActiveItem2=(r,n)=>{const o=Pn(e,t),s="string"==typeof n?wn(e,n):n,i=e=>e.isEqualNode(s)?e.classList.add(r):e.classList.remove(r);return!0===Hn(s)?o.forEach(i):!0===Rn()&&console.warn(`Spyne Warning: The selector, ${n}, does not appear to be a valid item in setActiveItem: ${r}`),this},r.setActiveItem=(r,n)=>{const o=Pn(e,t),s="string"==typeof n?wn(e,n):n;if(o.forEach(e=>e.classList.remove(r)),!0===Hn(s)){const e=Array.from(o).find(e=>e===s);e?e.classList.add(r):!0===Rn()&&console.warn(`Spyne Warning: The selector, ${n}, is valid but does not match any item in setActiveItem: ${r}`)}else!0===Rn()&&console.warn(`Spyne Warning: The selector, ${n}, does not appear to be a valid item in setActiveItem: ${r}`);return this},Object.defineProperty(r,"el",{get:()=>wn(e,t,!0)}),Object.defineProperty(r,"els",{get:()=>Pn(e,t)}),Object.defineProperty(r,"len",{get:()=>Pn(e,t,!1).length}),Object.defineProperty(r,"exists",{get:()=>Pn(e,t,!1).length>=1}),Object.defineProperty(r,"exist",{get:()=>Pn(e,t,!1).length>=1}),Object.defineProperty(r,"nodeList",{get:()=>Pn(e,t)}),Object.defineProperty(r,"arr",{get:()=>{const r=wn(e,t,!0);return void 0===r?[]:void 0===r.length?[r]:Array.from(r)}}),Object.defineProperty(r,"inline",{set:r=>Un(r,e,t),get:()=>r}),Object.defineProperty(r,"inlineCss",{set:r=>Un(r,e,t),get:()=>r}),r}class Wn{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:Tn,extendedSourcesHashMethods:{},debug:!1,template:void 0,node:document.createDocumentFragment(),name:Et(this)}},this._state={},this.$dirs=mn.createDirectionalFiltersObject(),this.addDefaultDirection=mn.addDefaultDir,this.addDownInternalDir=mn.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=Wn.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 Dn({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(Jr(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(En(e=>void 0!==e&&void 0!==e.action),Jr(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(En(e=>void 0!==e&&void 0!==e.action),fn(e=>this.tracer("addChildStraem do ",e)),Jr(e=>e),pn(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(nn(e=>{const t=e.observable.pipe(En(e=>void 0!==e&&void 0!==e.action),Jr(e=>{const t=Ye({},e);return t.action=e.action,this.tracer("autoMergeSubject$",t),t}));return!1===e.autoClosesBool?t:(o+=1,t.pipe(pn(n)))})),this.autoSubscriber$=this.autoMergeSubject$.pipe(En(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===Wn.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===Wn.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 gn(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===Wn.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)&&Wn.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$=Mn(this.props.el)}downStream(){}onRendered(){}onAnimFrameAfterRendered(){}afterRender(){}broadcastEvents(){return[]}getChannel(e){return H(e=>at().includes(e),e=>it.channelsMap.getStream(e).observer.pipe(_n(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=[Jr(e=>{const t=e;return t.$dir=o,t}),En(e=>{const t=i(e);return!0!==s(e)||t===this.props.vsid})];var c;!0===t&&a.unshift((c=1,En(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 Cn(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 Dn(e,t)}isLocalEvent(e){const t=K(["srcElement","el"],e),r=K(["props","el"],this);return Wn.elIsDomElement(r)&&Wn.elIsDomElement(t)&&r.contains(t)}addMixins(){const e=ut();this.createId=e.createId}}class xn{constructor(e){const t=String(e.props.name),r=`${t}_ROUTE_UPDATER`;return fe(xn.createTemporaryViewStreamObj)({id:r,name:t})}static createTemporaryViewStreamObj(e,t){const{name:r,id:n}=e,o=t,s=new Wn({id:n,name:r,data:t});s.onRendered=()=>{s.sendInfoToChannel("CHANNEL_ROUTE",o)},s.afterBroadcastEvents=()=>{s.disposeViewStream()},s.appendToNull()}}class Fn{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 xn(this),this.createChannelActionMethods(),this.streamsController=it.channelsMap;const n=this.getMainObserver();this.checkForPersistentDataMode=Fn.checkForPersistentDataMode.bind(this),this.observer$=this.props.observer=n;const o=this.streamsController.getStream("DISPATCHER"),s=U(t.name,"name");o.pipe(En(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(Jr(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(En(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(hn(1)):r}return t?e.pipe(hn(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 sn.apply(void 0,Qt([],qt(e)))}(...t))}return n.pipe(Jr(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 $n extends Fn{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(Jr(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),$n.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=$n.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}=$n.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=$n.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=$n.checkForEndRoute.bind(this),this.getIsDeepLinkBool=$n.getIsDeepLinkBool.bind(this),this.getDataFromLocationStr=$n.getDataFromLocationStr.bind(this),this.onIncomingDomEvent=$n.onIncomingDomEvent.bind(this),this.getDataFromString=$n.getDataFromString.bind(this),this.getParamsFromRouteStr=$n.getParamsFromRouteStr.bind(this),this.getLocationData=$n.getLocationData.bind(this),this.getRouteState=$n.getRouteState.bind(this),this.getDataFromParams=$n.getDataFromParams.bind(this),this.getRouteCount=$n.getRouteCount.bind(this),this.getExtraPayloadParams=$n.getExtraPayloadParams.bind(this),this.bindStaticMethodsWithConfigData()}bindStaticMethodsWithConfigData(){const e=He(3,$n.getRouteStrFromParams);this.getRouteStrFromParams=e(I,this.routeConfigJson,this.routeConfigJson.type)}}class kn extends Fn{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=kn.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(Jr(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,kn.checkForEventMethods(e),e.action=this.getActionState(e);const t=e.action,{payload:r,srcElement:n}=e,o=e.event;xt(o?.target),this.sendChannelPayload(t,r,n,o)}}class Gn{constructor(){this.createDomObservableFromEvent=Gn.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(Jr(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(Jr(n))}static createMergedObsFromObj(e){const t=e.mediaQueries||e.mediaQueries,r=[];return ce((e,t,n)=>{const o=Gn.createMediaQuery(e);return!1!==o&&r.push(Gn.createMediaQueryHandler(o,t)),r},t),r}}class jn extends Fn{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(jn.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 Gn.createDomObservableFromEvent("wheel",jn.getMouseWheelMapFn.bind(this)).pipe(dn(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(jn.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=jn.getScrollData(),l=Ve(jn.getScrollMapFn,[a,c,i,r,o]).bind(this);return Gn.createDomObservableFromEvent("scroll",l,r,o).pipe(dn(n),(d=e=>0===e.scrollDistance,Gt(function(e,t){var r=!1,n=0;e.subscribe(Wr(t,function(e){return(r||(r=!d(e,n++)))&&t.next(e)}))})),Jr(e=>{const t=jn.getScrollY(o);return e.payload.scrollDistanceAbs=Math.abs(this.currentScrollY-t),this.currentScrollY=t,e}));var d}createOrientationObservable(e){return Gn.createDomObservableFromEvent("orientationchange",jn.getOrientationMapFn.bind(this))}createResizeObservable(e){const t=e.debounceMSTimeForResize;return Gn.createDomObservableFromEvent("resize",jn.getResizeMapFn.bind(this)).pipe(dn(t))}getEventsFromConfig(e=this.domChannelConfig){const t=e.events;return D(e=>{const t=jn.createCurriedGenericEvent(e);return Gn.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(Jr(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=Gn.createMediaQueryHandler.bind(this),this.createMergedObsFromObj=Gn.createMergedObsFromObj.bind(this)}}class zn extends Fn{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 Bn extends Fn{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 Yn extends Fn{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 Kn=new Map;class qn{constructor(){this.addMixins(),Kn.set("DISPATCHER",new r),this.listRegisteredChannels=qn.listRegisteredChannels.bind(this),this.getChannelsList=qn.getChannelsList.bind(this)}get map(){return Kn}static getChannelsList(){return Array.from(Kn,(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 $n,Kn.set("CHANNEL_ROUTE",this.routeStream),this.uiStream=new kn,Kn.set("CHANNEL_UI",this.uiStream),this.domStream=new jn,Kn.set("CHANNEL_WINDOW",this.domStream),this.viewStreamLifecycle=new zn,Kn.set("CHANNEL_LIFECYCLE",this.viewStreamLifecycle),this.aiStream=new Bn,Kn.set("CHANNEL_AI",this.aiStream),this.routeStream.initializeStream(),this.domStream.initializeStream()}addKeyEvent(e){Kn.get("UI").addKeyEvent(e)}registerStream(e){const t=e.channelName;if(Kn.has(t)){if(u(Ue(["props","isRegistered"],!0))(Kn.get(t)))return void console.warn(`Spyne Warning: The Channel, ${t}, has already been registered!`)}Kn.set(t,e),e.initializeStream()}getChannelActions(e){return Kn.get(e).addRegisteredActions()}getProxySubject(e,t=!1){const r=!0===t?"replaySubject":"subject";return Kn.get(e)[r]}testStream(e){return void 0!==Kn.get(e)}getStream(e){return!1===this.testStream(e)&&Kn.set(e,new Yn(e)),Kn.get(e)}addMixins(){}}class Qn{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 Xn{constructor(e={},t,r,n){this._mapFn=Xn.setMapFn(e),this._url=Xn.setUrl(e),this._responseType=Xn.setResponseType(e),this._serverOptions=Xn.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&&Xn.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=fn(!0===c?e=>{console.log("DEBUG FETCH :",e,l)}:()=>{}),h=d(window.fetch(o,i)).pipe(nn(e=>d(Xn.parseResponse(e,l))),u,Jr((E=n,t=>{const r=!0===e?.disableSanitize?t:Ut(t,{mode:"app"});return E(r,l)})),Yr(e=>s(Xn.createFetchErrorPayload(e,l))),function(e){void 0===e&&(e={});var t=e.connector,r=void 0===t?function(){return new cn}: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 Gt(function(e,p){a++,d||l||u();var N=s=null!=s?s:r();p.add(function(){0!==--a||d||l||(n=Nn(E,c))}),N.subscribe(p),!t&&a>0&&(t=new Ar({next:function(e){return N.next(e)},error:function(e){d=!0,u(),n=Nn(h,o,e),N.error(e)},complete:function(){l=!0,u(),n=Nn(h,i),N.complete()}}),Ur(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 Xn.safeReadText(e);throw Xn.createFetchError({errorType:"FETCH_HTTP_ERROR",message:`Fetch request failed with status ${n} ${o}`,metadata:i,rawBody:t})}if("json"===r)return Xn.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 Xn.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 Xn.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:Xn.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&&console.warn("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()?(console.warn("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(Xn.baseOptions(),t);return r=Xn.updateMethodWhenBodyExists(r),r=Xn.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 Jn extends Fn{constructor(e,t={disableSanitize:!1}){Jn.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 Xn(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 Zn=it;class eo{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=eo.mergeDefaultConfig(r,this.defaultConfig()),this.props.parentEl=n||eo.createParentEl(),this.props.config=r,void 0!==this.props.traits&&this.addTraits(this.props.traits)}register(e){Zn=e,this.props.pluginName=this.props.name,!1!==Zn.initialized?(this.onBeforeRegistered(),this.props.config=re(this.props.config),Zn.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 Zn}static mergeDefaultConfig(e={},t=this.defaultConfig()){return Object.assign(t,e)}static getSpyneApp(e,t){!1===Zn.initialized?console.warn(`Spyne Warning: Unable to install plugin, ${e}! SpyneApp has not been initialized!`):Zn.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 Ft({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 to=new qn,ro="0.24.0";let no=new class{constructor(){this.version=ro}get channels(){return to}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 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){
|
|
2
2
|
/*!
|
|
3
|
-
* Spyne 0.
|
|
3
|
+
* Spyne 0.25.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:{},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,
|
|
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};
|
|
18
18
|
//# sourceMappingURL=spyne.esm.js.map
|