spyne 0.20.12 → 0.20.17

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Spyne 0.20.12
2
+ * Spyne 0.20.17
3
3
  * https://spynejs.org
4
4
  *
5
5
  * @license
@@ -15,7 +15,7 @@
15
15
  */
16
16
 
17
17
  /*!
18
- * spynejs 0.20.12
18
+ * spynejs 0.20.17
19
19
  * https://spynejs.org
20
20
  * (c) 2017-present Frank Batista
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spyne",
3
- "version": "0.20.12",
3
+ "version": "0.20.17",
4
4
  "description": "Reactive Real-DOM Framework for Advanced Javascript applications",
5
5
  "sideEffects": true,
6
6
  "main": "./lib/spyne.esm.js",
@@ -6,7 +6,7 @@ import { sanitizeHTMLConfigure } from './utils/sanitize-html.js'
6
6
  import { sanitizeDataConfigure } from './utils/sanitize-data.js'
7
7
 
8
8
  const _channels = new ChannelsMap()
9
- const version = '0.20.12'
9
+ const version = '0.20.17'
10
10
 
11
11
  class SpyneApplication {
12
12
  /**
@@ -43,7 +43,7 @@ class SpyneApplication {
43
43
  init(config = {}, testMode = false) {
44
44
  // this.channels = new ChannelsMap();
45
45
  /*!
46
- * Spyne 0.20.12
46
+ * Spyne 0.20.17
47
47
  * https://spynejs.org
48
48
  *
49
49
  * @license
package/lib/spyne.esm.js DELETED
@@ -1,18 +0,0 @@
1
- import{fromEventPattern as e,Observable as t,Subject as n,bindCallback as r,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 v,when as b,__ as I,join as S,replace as L,flatten as O,map as D,toPairs as R,ifElse as H,always as V,concat as w,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 j,zipObj as G,split as Y,fromPairs as z,has as B,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 ne,not as re,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 ve,identity as be,objOf as Ie,view as Se,lensIndex as Le,lensProp as Oe,over as De,reverse as Re,curryN as He,toUpper as Ve,partialRight as we,pluck as Pe,pathEq as Ue,propIs as Me,pathSatisfies as We}from"ramda";import xe from"dompurify";class Fe{constructor(){this.checkIfObjIsNotEmptyOrNil=Fe.checkIfObjIsNotEmptyOrNil.bind(this)}static checkIfObjIsNotEmptyOrNil(e){const t=u(h(E),p,N),n=u(h(_),p,N);return f([t,n])(e)}static checkIfParamValueMatchesRegex(e,t){const n=m(T("routeName")),r=u(n,A),o=u(C((t=>M(new RegExp(t),e))),r)(t);return y(String,o)&&(t=g(e,v(o,t),t)),t}static formatStrAsWindowLocation(e){return{hash:e,search:e,pathname:e}}static getLocationStrByType(e,t=!1,n=window.location){return v({slash:"pathname",query:"search",hash:"hash"}[!0===t?"hash":e],n).replace(/^(\/)?(#)?(\/)?(.*)$/,"$4")}static createRouteArrayFromParams(e,t,n="slash",r){const o=[],s=t=>{const n={},i=t.routeName;let a=void 0!==e[i]?e[i]:v(i,r);const c=typeof t[a];"string"===c?a=t[a]:"undefined"===c&&(t=this.checkIfParamValueMatchesRegex(a,t)),n[i]=a,this.checkIfObjIsNotEmptyOrNil(n)&&o.push(n);const l=y(Object,t),d=B(a,t),u=B("routePath",t);if(!0===(d&&l)){const e=t[a];B("routePath",e)&&s(e.routePath)}else!0===u&&void 0!==a&&s(t.routePath)};return s(t),o}static createSlashString(e){const t=m(_),n=b(h(_,I),S("/")),r=L(/^(\^*)(.*|^\$)(\$)$/,"$2");return u(r,n,t,O,D(N))(e)}static createQueryString(e){const t=m(_),n=this.checkIfObjIsNotEmptyOrNil,r=u(S("="),O,R),o=H(n,r,V(void 0)),s=D(o),i=b(h(E),w("?"));return u(i,S("&"),t,s)(e)}static checkPayloadForRegexOverrides(e,t,n="Value"){const r=u((e=>v(`${e}${n}`,t)),p,A);return D((e=>{const t=r(e);return void 0!==t?g(u(p,A)(e),t,e):e}),e)}static checkForRouteValWithMultipleVals(e){const t=e=>{const t=(t,n)=>(t[n]=(e=>{const t=e.match(/^[^|]*/);return t?"^$"===t[0]?"":t[0]:e})(e[n]),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 n=(e,t)=>t.split("|").some((t=>((e,t)=>{const n=e.replace(/[-/\\^$+?.()|[\]{}]/g,"\\$&").replace(/\*/g,"[\\w\\d_-]*");return new RegExp(`^${n}$`).test(t)})(t,e)))?e:t;return e.map((e=>{const r={...e};return Object.keys(r).forEach((e=>{Object.prototype.hasOwnProperty.call(r,e)&&t[e]&&(r[e]=n(t[e],r[e]))})),r}))}static convertParamsToRoute(e,t=at.config.channels.ROUTE,n,r){const o=void 0!==n?n:t.type,s=t.isHash,i=t.routes.routePath,a=void 0!==r?r:this.getLocationStrByType(o,s),c=this.convertRouteToParams(a,t,o).routeData;let l=this.createRouteArrayFromParams(e,i,o,c);return l=Fe.checkPayloadForRegexOverrides(l,e),l=Fe.checkForRouteValWithMultipleVals(l),"query"===o?this.createQueryString(l):this.createSlashString(l)}static findIndexOfMatchedStringOrRegex(e,t){const n=t.includes(".+"),r=L(/^$/,"^$"),o=P(U(e,"str"),u(M(I,e),v("re")));return u(W(T(!0)),D(o),D((e=>{return{str:e,re:(t=e,n&&(t.startsWith("^")||(t="^"+t),t.endsWith("$")||(t+="$")),new RegExp(t))};var t})),D(r))(t)}static checkIfValueShouldMapToParam(e,t,n){const r=u(D(x),D(F(y(String))),R)(e),o=Fe.findIndexOfMatchedStringOrRegex(t,r);let s=t;if(o>=0){const t=r[o],n=$(e),i=u(p,k([]),v(t))(n);!0===/^([-$\w]*)$/.test(i)&&!0===y(String,i)&&(s=i)}return s}static createArrFromSlashStr(e){return e.replace(/^([/])?(.*)$/,"$2").split("/")}static convertSlashRouteStrToParamsObj(e,t,n){const r=t,o=this.createArrFromSlashStr(t),s=[],i=[];let a=e;j(((e,t)=>{const r=this.checkIfValueShouldMapToParam(a,t,n);a=this.checkIfParamValueMatchesRegex(t,a);const o=P(E,_);void 0!==a&&(e=>e!==x(s))(a.routeName)&&!1===o(r)&&(s.push(a.routeName),i.push(r));const c=K([t,"routePath"],a),l=K(["routePath"],a);void 0!==c?a=c:void 0!==l&&(a=l)}),0,o);const c=G(s,i),l=this.getLastArrVal(s);return{paths:s,pathInnermost:l,routeData:c,routeValue:r}}static getLastArrVal(e){return void 0!==x(t=e)?x(t):"";var t}static createDefaultParamFromEmptyStr(e,t){const n={};return n[e.routeName]=this.checkIfValueShouldMapToParam(e,t),n}static convertQueryStrToParams(e,t,n){const r=t,o=t.replace(/^([?])?(.*)$/,"$2"),s=u(D(Y("=")),Y("&"))(o);let i=z(s),a=D(p,s);!0===E(t)&&(i=this.createDefaultParamFromEmptyStr(e,t,n),a=A(i));return{paths:a,pathInnermost:this.getLastArrVal(a),routeData:i,routeValue:r}}static convertRouteToParams(e,t,n){if(void 0===t)return{};const r=void 0!==n?n:t.type,o=k({},v("regexTokens",t)),s=t.routes.routePath;return"query"===r?this.convertQueryStrToParams(s,e):(e=e.replace(/\/$|$/,"/"),this.convertSlashRouteStrToParamsObj(s,e,o))}}class $e{constructor(){this.createPopStateStream=$e.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 n=(e,t)=>void 0!==t?ee(t,e):e;let r=n(e,t);return{pickValues:n,compare:(e={},t)=>{const o=n(e,t),s=e=>u(A,F(U(!0,e))),i=u(D((e=>{const t=v(e,r),n=v(e,o),s=T(t,n),i=void 0!==t,a=void 0!==n,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))([r,o]),a=Q(s("changed"),i),c=Q(s("added"),i),l=Q(s("removed"),i);return r=o,{pathsAdded:c,pathsRemoved:l,pathsChanged:a}},getComparer:()=>r}}static getRouteArrData(e,t){const n=F(X(I,e),t);return{paths:n,pathInnermost:$e.getLastArrVal(n)}}static flattenConfigObject(e){const t=e=>Q((([e,n])=>"object"!=typeof n||null===n||Array.isArray(n)?[[e,n]]:D((([t,n])=>[`${e}.${t}`,n]),t(n))),R(e));return N(z(t(e)))}static addRouteDatasets(e){const{type:t,isHash:n}=e,r=r=>{const o="query"===t?"":!0===n?"#":"/",s=Fe.convertParamsToRoute(r,e);return o+s.replace(/^(.*\/)([\w-]*\/?)(.*)$/gm,"$1$2")},o=/^([A-Za-z0-9_-])+$/m,s=(e=[],t,n={})=>{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||v("routeName",l);let h=ne(n);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=ne(h);o[e]="",o.navLevel=A(n).length,o.title=u(c),o.href=r(o),t.push(o)}}h=s(e,l,h)}else h.title=u(c),h.href=r(h);return h.navLevel=A(n).length,t.push(h),t}),[])},i=s([],e.routes);let a=O(i);a=function e(t){return t.map((t=>{for(const n in t)void 0===n||"undefined"===n||void 0===t[n]?delete t[n]:t[n]&&"object"==typeof t[n]&&!Array.isArray(t[n])&&(t[n]=e([t[n]])[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 n=K(["channels","ROUTE"],e);let{add404s:r}=void 0!==n?n:e;r=r||t;const o=e=>{const t=e[1],n=y(Array,t);return""===t?e[1]="^$":n&&(e[1]=t.join("|")),e},s=u(z,D((e=>{const[t,n]=e,i=r?{404:".+"}:{},a=y(Object,n),c=y(Array,n),l="routePath"===t;return!0===a&&!1===c&&(e[1]=s(e[1]),l&&(e[1]=u(te(i),z,D(o),R)(e[1]))),e})),R);if(void 0!==n){e.channels.ROUTE=s(e.channels.ROUTE);const t=$e.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 ke=Object.create({}),je=u(re,y(Array)),Ge=u(f([je,y(Object)]));function Ye(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&&Ye(e)?Ke((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function Be(e,t,n){const r=e.slice();return t.forEach((function(t,o){void 0===r[o]?r[o]=ze(t,n):Ye(t)?r[o]=Ke(e[o],t,n):-1===e.indexOf(t)&&r.push(ze(t,n))})),r}function Ke(e,t,n){const r=Array.isArray(t),o=(n||{arrayMerge:Be}).arrayMerge||Be;return r?Array.isArray(e)?o(e,t,n):ze(t,n):function(e,t,n){const r={};return Ye(e)&&Object.keys(e).forEach((function(t){r[t]=ze(e[t],n)})),Object.keys(t).forEach((function(o){Ye(t[o])&&e[o]?r[o]=Ke(e[o],t[o],n):r[o]=ze(t[o],n)})),r}(e,t,n)}let qe,Qe,Xe,Je;Ke.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,n){return Ke(e,n,t)}))};let Ze=!0,et=!1;const tt=[];let nt,rt;const ot=[],st=new Map;const it=new class{constructor(){ke.foo=()=>console.log("used for testing purposes.")}addMethod(e,t,n=!1){if(!0===Object.prototype.hasOwnProperty.call(ke,e)){const t=`Spyne Warning: the method name, ${e}, already exists.`;if(n)return t;console.warn(t)}else ke[e]=t}addMethods(e={},t=!1){let n;if(!1===Ge(e))return n=`Spyne Warning: the pluginMethods property, ${JSON.stringify(e)} needs to be an object.`,t?n:void console.warn(n);return A(e).map((r=>{const o=v(r,e);if("function"==typeof o)this.addMethod(r,o,t);else{if(n=`the value for ${r} is not a valid function.`,t)return n;console.warn(n)}})).join(",")}checkIfMethodExists(e){}get pluginMethodsObj(){return ke}};const at=new class{constructor(){Je=!1}get channelsMap(){return Xe}get initialized(){return Je}get config(){return qe}get debug(){return Ze}static listChannels(){return Array.from(Qe.map.keys())}initialize(e={},t={},n,r){return Qe=n,qe=Ke(e,t),qe.channels&&qe.channels.ROUTE&&(qe=r.conformRouteObject(qe)),rt=qe?.IMG_PATH,Ze=void 0!==qe.debug?qe.debug:Ze,this.getChannelActions=Qe.getChannelActions.bind(Qe),this.listRegisteredChannels=Qe.listRegisteredChannels.bind(Qe),Je=!0,this._initialized=Je,this.setChannelsMap(),t?.baseHref&&this.setHeadBaseHref(t.baseHref),qe}setHeadBaseHref(e){const t=document.createElement("base");t.href=e,document.head.appendChild(t)}conformRouteConfig(e=!1){qe=$e.conformRouteObject(qe,e)}setChannelsMap(){const e=Qe.getStream.bind(Qe),t=Qe.testStream.bind(Qe),n=Qe.getProxySubject.bind(Qe);Xe={getStream:e,testStream:t,getProxySubject:n}}setProp(e,t,n=!1){return n?(qe.ephemeralProps[e]=t,t):(qe.tmpProps[e]=t,e)}getProp(e){if(qe.ephemeralProps.hasOwnProperty(e)){const t=qe.ephemeralProps[e];return delete qe.ephemeralProps[e],t}return qe?.tmpProps?.[e]}createTempProp(e){const t=Math.random().toString(36).slice(2,8);return this.setProp(t,e,!0),t}setChannelConfig(e,t){return qe.channels[e]=t,qe.channels[e]}getChannelConfig(e,t=qe){if("CHANNEL_ROUTE"===e?e="ROUTE":"CHANNEL_WINDOW"===e&&(e="WINDOW"),void 0===t||void 0===qe.channels)return void console.warn("Spyne warning: Spyne config object is empty!");const n=qe.channels[e];if(void 0!==n)return n;console.warn(`Spyne warning: Spyne configuration for channel, ${e} is empty!`)}registerChannel(){}addPluginConfig(e,t={}){void 0===qe.plugins&&(qe.plugins={}),this.addPluginMethods(t.pluginMethods),qe.plugins[e]=t}getPluginsMethodObj(e){return e&&this.addPluginMethods(e),it.pluginMethodsObj}addPluginMethods(e){e&&it.addMethods(e)}doNotTrackChannel(e){ot.push(e)}getUntrackedChannelsList(){return ot}registerProxyReviver(e,t){st.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 st.get(e)}getPluginConfigByPluginName(e){return qe.plugins[e]}get IMG_PATH(){return rt}get excludeChannelsFromConsole(){return tt}set excludeChannelsFromConsole(e){"string"==typeof e?tt.includes(e)||tt.push(e):Array.isArray(e)?e.forEach((e=>{"string"!=typeof e||tt.includes(e)||tt.push(e)})):console.warn("Invalid value provided to excludeChannelsFromConsole. Only strings or arrays are allowed.")}get linksData(){return console.warn("get links data in SpyneAppProperties is deprecated, use navLinks"),nt}set linksData(e){console.warn("set links data in SpyneAppProperties is deprecated, use navLinks")}get navLinks(){return nt}set navLinks(e){nt=e}get enableCMSProxies(){return et}set enableCMSProxies(e=!0){et=Boolean(e)}setCMSProxyMethod(e){this.enableCMSProxies=!0}formatTemplateForProxyData(e){const t=/(({{(?!loopNum|loopIndex))(.*?)(}}))/gm,n=new RegExp("(?<=>)(.*?)(({{)(.*)(}}))","gm"),r=(e,t,n,r)=>(e=>{const t=(e=>/({{\.\*?}})/.test(e))(e),{key:n,dataId:r}=(e=>{const n=/^\{\{([^}]+?)\.[^.}]+}}$/gm;let r="__cms__dataId";const o=t?"{{loopIndex}}":String(e).replace(/({{)([\w_]+(\.))*?(\w+)(}})/gm,"$4");return/(\w\.)/.test(e)&&(r=String(e).replace(n,"$1.")+r),{key:o,dataId:r}})(e);let o=`<spyne-cms-item data-cms-id="{{${r}}}" data-cms-key="${n}"`;return t&&(o+=' data-cms-orig-key="{{origKey}}"'),`${o}><spyne-cms-item-hitbox></spyne-cms-item-hitbox><spyne-cms-item-text>${t?"{{spyneLoopKey}}":e}</spyne-cms-item-text></spyne-cms-item>`})(e);return String(e).replace(n,((e,n,o,s,i)=>`${n}${String(o).replace(t,r)}`))}tempGetChannelsInstance(){}tempGetConfig(){}},ct=()=>({includes:()=>!0===at.initialized?at.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 lt=(e,t)=>{const{__proxy__proxyName:n}=e;void 0===n&&console.error("object is not proxy object ",e);const r=(n,r)=>{const o=K(r,e),{__proxy__isProxy:s,__proxy__props:i}=o;return s?t(n,i):n},o=r(ne(e),[]),s=(e,t)=>{const n=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=[...n];a.push(t),"object"!==i&&"array"!==i||(e[t]=r(o,a),s(o,a))}))};return s(o),o},dt=function(e){const{__proxy__proxyName:t}=e;if(void 0!==t){const n=at.getProxyReviver(t);if("function"==typeof n)return lt(e,n)}const n=y(Array),r=y(Object);var o;return!1===n(o=e)&&!0===r(o)?u(z,R,ne)(e):ne(e)};class ut{constructor(e,t,n,r,o,s){const i=e;s&&console.time(s);const a={channelName:e,action:t,srcElement:r,event:o},c=ut.deepFreeze(n);if(a.payload=c,!0===at.debug){if(Object.prototype.hasOwnProperty.call(n,"payload")){const e=JSON.stringify(n);console.warn(`Spyne Warning: the following payload contains a nested payload property which may create conflicts: Action: ${t}, ${e}`)}const e=at.getChannelActions(i);ut.validateAction(t,i,e)}a.clone=()=>oe([{payload:dt(a.payload)},a.payload,{channel:ne(i)},{event:ne(o)},{srcElement:r},ne(a.srcElement),{action:ne(a.action)}]);const l={$dir:{get:()=>a._dir,set:e=>(a._dir=e,e)}};return"CHANNEL_ROUTE"===i&&(l.location={get:()=>ut.getLocationData()}),a._dir=void 0,Object.defineProperties(a,l),s&&console.timeEnd(s),a}static validateAction(e,t,n){const r=X(e,n);return!1===r&&!0===at.initialized&&console.warn(`warning: Action: '${e}' is not registered within the ${t} channel!`),r}static getLocationData(){return Z(["href","origin","protocol","host","hostname","port","pathname","search","hash"],window.location)}static getStreamItem(){}static deepClone(e){const t=y(Array),n=y(Object);var r;return!1===t(r=e)&&!0===n(r)?u(z,R,ne)(e):ne(e)}static deepFreeze(e){const t=u(se(0),k(-1),v("nodeType"));try{Object.freeze(e),Object.getOwnPropertyNames(e).forEach((function(n){!Object.prototype.hasOwnProperty.call(e,n)||!1!==t(e[n])||null===e[n]||"object"!=typeof e[n]&&"function"!=typeof e[n]||Object.isFrozen(e[n])||ut.deepFreeze(e[n])}))}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 ht(){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 Et=async(e,t)=>{window.setTimeout((async()=>{var t;await(t=1,new Promise((e=>setTimeout(e,t)))),window.requestAnimationFrame(e)}),t)},pt=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])},Nt=e=>{const t=u(h(E),p,N),n=u(h(_),p,N);return f([t,n])(e)};let _t,ft=!1;class mt{constructor(e,t={},n={}){this.template=this.formatTemplate(e),this.isProxyData=!0===t.__cms__isProxy,this.testMode=n?.testMode,at.enableCMSProxies&&!0===this.isProxyData&&(this.template=at.formatTemplateForProxyData(this.template));(()=>{!0===y(Array,t)&&(t={spyneData:t},this.template=this.template.replace("{{/}}","{{/spyneData}}"),this.template=this.template.replace("{{#}}","{{#spyneData}}"))})(),this.templateData=t;const r=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,t)=>e.replace(s,i)),this.addParams.bind(this));this.finalArr=r.map(c)}static isPrimitiveTag(e){return/({{\.\*?}})/.test(e)}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()),n=/^([\\n\s\W]+)$/;return m((e=>e.match(n)),t)}static findTmplLoopsRE(){return/({{#[\w.]+}}[\w\n\s\W]+?{{\/[\w.]+}})/gm}static parseTmplLoopsRE(){return/({{#([\w.]+)}})([\w\n\s\W]+?)({{\/\2}})/gm}static swapParamsForTagsRE(){return/({{)(.*?)(}})/gm}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=(e=>{if(!ft)throw new Error("sanitizeHTML is not configured. Call sanitizeHTMLConfigure() with appropriate config.");return _t(e)})(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),window.setTimeout(this.removeThis,2),e}getTemplateString(){return this.finalArr.join("")}formatTemplate(e){return!0===["SCRIPT","TEMPLATE"].includes(v("nodeName",e))?e.innerHTML:e}getDataValFromPathStr(e,t){const n=String(e).split(".");return K(n,t)||""}addParams(e){return e.replace(mt.swapParamsForTagsRE(),((e,t,n,r)=>mt.getNestedDataReducer(this.templateData,n)))}static replaceImgPath(e){const{IMG_PATH:t}=at;return void 0!==t?(e=e.replaceAll(/src\s*=\s*(['"])imgs\//g,`src=$1${t}`)).replaceAll(/url\(\s*(['"]?)imgs\//g,`url($1${t}`):e}parseTheTmplLoop(e,t,n,r){const o=/(\.)/gm,s=r;let i=mt.getNestedDataReducer(this.templateData,n);const a=(e,t,n)=>{if(mt.isPrimitiveTag(t))return c(e,t);return l((()=>{const t=e,r=n,o=n+1;if(this.isProxyData){return{spyneLoopKey:t,__cms__dataId:i.__cms__dataId,origKey:i[`__cms__keyFor_${e}`],loopIndex:r,loopNum:o,d:e}}return{spyneLoopKey:t,loopIndex:r,loopNum:o}})(),t,n)},c=(e,t,n,r)=>(e=e.replace(/\$/g,"$$$$"),t.replace(mt.swapParamsForTagsRE(),e)),l=(e,t,n)=>t.replace(mt.swapParamsForTagsRE(),((t,r,s)=>{const i={loopIndex:n,loopNum:n+1};if(!1===o.test(s)&&void 0!==e[s])return void 0!==i[s]?i[s]:e[s];const a=this.getDataValFromPathStr(s,e);return void 0!==i[s]?i[s]:a}));return!0===_(i)||E(i)?"":(void 0===i.length&&(i=[i]),i=Array.isArray(i)?i:[i],i.map(((e,t)=>"string"==typeof e?a(e,s,t):l(e,s,t))).join(""))}}class Tt{constructor(e={},t=!1){var n,r;e.tagName=(n="div",r=e.tagName,k(n)(r)),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){return this.getProp("attrs").forEach(((t,n)=>{const r=(t,n)=>{e.dataset[n]=t};"dataset"===n?de(r,t):e.setAttribute(n,t)})),e}updateAttrs(e,t){const n=void 0!==t?t:new Map;return ce(((e,t)=>n.set(t,e)),e),n}addTemplate(e){const t=this.getProp("template");return void 0!==t?(t=>{let n=this.getProp("data");n=y(Object,n)?n:{};const r=new mt(t,n,{testMode:this?.testMode}).renderDocFrag();return y(String,r)?e.innerHTML=r:e.appendChild(r),e})(t):e}createElement(e="div"){return document.createElement(e)}addContent(e){const t=this.getProp("data");if(!0===y(String,t)){const n=document.createTextNode(t);e.appendChild(n)}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 n=void 0===t;e[t]=!1===n?t:Ke(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=ht();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 At=(e=!1,t=1,n="ease",r=!1)=>`${!0===r?"opacity:0;":""}transition: opacity ${t}s ${n}; opacity: ${!0===e?1:0};`;function Ct(e){return"function"==typeof e}function yt(e){return Ct(null==e?void 0:e.lift)}function gt(e){return function(t){if(yt(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 vt=function(e,t){return vt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},vt(e,t)};function bt(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}vt(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function It(e,t,n,r){return new(n||(n=Promise))((function(o,s){function i(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,a)}c((r=r.apply(e,t||[])).next())}))}function St(e,t){var n,r,o,s,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function Lt(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ot(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,s=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=s.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=s.return)&&n.call(s)}finally{if(o)throw o.error}}return i}function Dt(e,t,n){if(n||2===arguments.length)for(var r,o=0,s=t.length;o<s;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}function Rt(e){return this instanceof Rt?(this.v=e,this):new Rt(e)}function Ht(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,o=n.apply(e,t||[]),s=[];return r={},i("next"),i("throw"),i("return"),r[Symbol.asyncIterator]=function(){return this},r;function i(e){o[e]&&(r[e]=function(t){return new Promise((function(n,r){s.push([e,t,n,r])>1||a(e,t)}))})}function a(e,t){try{(n=o[e](t)).value instanceof Rt?Promise.resolve(n.value.v).then(c,l):d(s[0][2],n)}catch(e){d(s[0][3],e)}var n}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 Vt(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=Lt(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,o){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,o,(t=e[n](t)).done,t.value)}))}}}"function"==typeof SuppressedError&&SuppressedError;var wt=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function Pt(e){return Ct(null==e?void 0:e.then)}function Ut(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 Mt=Ut((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 Wt(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var xt=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,n,r,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var i=Lt(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(Ct(c))try{c()}catch(e){o=e instanceof Mt?e.errors:[e]}var l=this._finalizers;if(l){this._finalizers=null;try{for(var d=Lt(l),u=d.next();!u.done;u=d.next()){var h=u.value;try{kt(h)}catch(e){o=null!=o?o:[],e instanceof Mt?o=Dt(Dt([],Ot(o)),Ot(e.errors)):o.push(e)}}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=d.return)&&r.call(d)}finally{if(n)throw n.error}}}if(o)throw new Mt(o)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)kt(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).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)&&Wt(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&Wt(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}(),Ft=xt.EMPTY;function $t(e){return e instanceof xt||e&&"closed"in e&&Ct(e.remove)&&Ct(e.add)&&Ct(e.unsubscribe)}function kt(e){Ct(e)?e():e.unsubscribe()}var jt={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Gt={setTimeout:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=Gt.delegate;return(null==o?void 0:o.setTimeout)?o.setTimeout.apply(o,Dt([e,t],Ot(n))):setTimeout.apply(void 0,Dt([e,t],Ot(n)))},clearTimeout:function(e){var t=Gt.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function Yt(e){Gt.setTimeout((function(){throw e}))}function zt(){}var Bt=null;function Kt(e){if(jt.useDeprecatedSynchronousErrorHandling){var t=!Bt;if(t&&(Bt={errorThrown:!1,error:null}),e(),t){var n=Bt,r=n.errorThrown,o=n.error;if(Bt=null,r)throw o}}else e()}var qt=function(e){function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,$t(t)&&t.add(n)):n.destination=tn,n}return bt(t,e),t.create=function(e,t,n){return new Zt(e,t,n)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(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}(xt),Qt=Function.prototype.bind;function Xt(e,t){return Qt.call(e,t)}var Jt=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){en(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){en(e)}else en(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){en(e)}},e}(),Zt=function(e){function t(t,n,r){var o,s,i=e.call(this)||this;Ct(t)||!t?o={next:null!=t?t:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:i&&jt.useDeprecatedNextContext?((s=Object.create(t)).unsubscribe=function(){return i.unsubscribe()},o={next:t.next&&Xt(t.next,s),error:t.error&&Xt(t.error,s),complete:t.complete&&Xt(t.complete,s)}):o=t;return i.destination=new Jt(o),i}return bt(t,e),t}(qt);function en(e){Yt(e)}var tn={closed:!0,next:zt,error:function(e){throw e},complete:zt},nn="function"==typeof Symbol&&Symbol.observable||"@@observable";function rn(e){return e}function on(e){return 0===e.length?rn:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)}}var sn=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(e,t,n){var r,o=this,s=(r=e)&&r instanceof qt||function(e){return e&&Ct(e.next)&&Ct(e.error)&&Ct(e.complete)}(r)&&$t(r)?e:new Zt(e,t,n);return Kt((function(){var e=o,t=e.operator,n=e.source;s.add(t?t.call(s,n):n?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 n=this;return new(t=an(t))((function(t,r){var o=new Zt({next:function(t){try{e(t)}catch(e){r(e),o.unsubscribe()}},error:r,complete:t});n.subscribe(o)}))},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[nn]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return on(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=an(e))((function(e,n){var r;t.subscribe((function(e){return r=e}),(function(e){return n(e)}),(function(){return e(r)}))}))},e.create=function(t){return new e(t)},e}();function an(e){var t;return null!==(t=null!=e?e:jt.Promise)&&void 0!==t?t:Promise}function cn(e){return Ct(e[nn])}function ln(e){return Symbol.asyncIterator&&Ct(null==e?void 0:e[Symbol.asyncIterator])}function dn(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 un="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function hn(e){return Ct(null==e?void 0:e[un])}function En(e){return Ht(this,arguments,(function(){var t,n,r;return St(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,Rt(t.read())];case 3:return n=o.sent(),r=n.value,n.done?[4,Rt(void 0)]:[3,5];case 4:return[2,o.sent()];case 5:return[4,Rt(r)];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 pn(e){return Ct(null==e?void 0:e.getReader)}function Nn(e){if(e instanceof sn)return e;if(null!=e){if(cn(e))return o=e,new sn((function(e){var t=o[nn]();if(Ct(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(wt(e))return r=e,new sn((function(e){for(var t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete()}));if(Pt(e))return n=e,new sn((function(e){n.then((function(t){e.closed||(e.next(t),e.complete())}),(function(t){return e.error(t)})).then(null,Yt)}));if(ln(e))return _n(e);if(hn(e))return t=e,new sn((function(e){var n,r;try{for(var o=Lt(t),s=o.next();!s.done;s=o.next()){var i=s.value;if(e.next(i),e.closed)return}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}e.complete()}));if(pn(e))return _n(En(e))}var t,n,r,o;throw dn(e)}function _n(e){return new sn((function(t){(function(e,t){var n,r,o,s;return It(this,void 0,void 0,(function(){var i,a;return St(this,(function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=Vt(e),c.label=1;case 1:return[4,n.next()];case 2:if((r=c.sent()).done)return[3,4];if(i=r.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]),r&&!r.done&&(s=n.return)?[4,s.call(n)]:[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 fn(e,t,n,r,o){return new mn(e,t,n,r,o)}var mn=function(e){function t(t,n,r,o,s,i){var a=e.call(this,t)||this;return a.onFinalize=s,a.shouldUnsubscribe=i,a._next=n?function(e){try{n(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=r?function(){try{r()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,a}return bt(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(qt),Tn=function(e){function t(t,n){return e.call(this)||this}return bt(t,e),t.prototype.schedule=function(e,t){return this},t}(xt),An={setInterval:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=An.delegate;return(null==o?void 0:o.setInterval)?o.setInterval.apply(o,Dt([e,t],Ot(n))):setInterval.apply(void 0,Dt([e,t],Ot(n)))},clearInterval:function(e){var t=An.delegate;return((null==t?void 0:t.clearInterval)||clearInterval)(e)},delegate:void 0},Cn=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r.pending=!1,r}return bt(t,e),t.prototype.schedule=function(e,t){var n;if(void 0===t&&(t=0),this.closed)return this;this.state=e;var r=this.id,o=this.scheduler;return null!=r&&(this.id=this.recycleAsyncId(o,r,t)),this.pending=!0,this.delay=t,this.id=null!==(n=this.id)&&void 0!==n?n:this.requestAsyncId(o,this.id,t),this},t.prototype.requestAsyncId=function(e,t,n){return void 0===n&&(n=0),An.setInterval(e.flush.bind(e,this),n)},t.prototype.recycleAsyncId=function(e,t,n){if(void 0===n&&(n=0),null!=n&&this.delay===n&&!1===this.pending)return t;null!=t&&An.clearInterval(t)},t.prototype.execute=function(e,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(e,t);if(n)return n;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,t){var n,r=!1;try{this.work(e)}catch(e){r=!0,n=e||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),n},t.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,n=this.scheduler,r=n.actions;this.work=this.state=this.scheduler=null,this.pending=!1,Wt(r,this),null!=t&&(this.id=this.recycleAsyncId(n,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(Tn),yn={now:function(){return(yn.delegate||Date).now()},delegate:void 0},gn=function(){function e(t,n){void 0===n&&(n=e.now),this.schedulerActionCtor=t,this.now=n}return e.prototype.schedule=function(e,t,n){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(n,t)},e.now=yn.now,e}(),vn=new(function(e){function t(t,n){void 0===n&&(n=gn.now);var r=e.call(this,t,n)||this;return r.actions=[],r._active=!1,r}return bt(t,e),t.prototype.flush=function(e){var t=this.actions;if(this._active)t.push(e);else{var n;this._active=!0;do{if(n=e.execute(e.state,e.delay))break}while(e=t.shift());if(this._active=!1,n){for(;e=t.shift();)e.unsubscribe();throw n}}},t}(gn))(Cn);function bn(e,t,n,r,o){void 0===r&&(r=0),void 0===o&&(o=!1);var s=t.schedule((function(){n(),o?e.add(this.schedule(null,r)):this.unsubscribe()}),r);if(e.add(s),!o)return s}function In(e,t){return void 0===t&&(t=0),gt((function(n,r){n.subscribe(fn(r,(function(n){return bn(r,e,(function(){return r.next(n)}),t)}),(function(){return bn(r,e,(function(){return r.complete()}),t)}),(function(n){return bn(r,e,(function(){return r.error(n)}),t)})))}))}function Sn(e,t){return void 0===t&&(t=0),gt((function(n,r){r.add(e.schedule((function(){return n.subscribe(r)}),t))}))}function Ln(e,t){if(!e)throw new Error("Iterable cannot be null");return new sn((function(n){bn(n,t,(function(){var r=e[Symbol.asyncIterator]();bn(n,t,(function(){r.next().then((function(e){e.done?n.complete():n.next(e.value)}))}),0,!0)}))}))}function On(e,t){if(null!=e){if(cn(e))return function(e,t){return Nn(e).pipe(Sn(t),In(t))}(e,t);if(wt(e))return function(e,t){return new sn((function(n){var r=0;return t.schedule((function(){r===e.length?n.complete():(n.next(e[r++]),n.closed||this.schedule())}))}))}(e,t);if(Pt(e))return function(e,t){return Nn(e).pipe(Sn(t),In(t))}(e,t);if(ln(e))return Ln(e,t);if(hn(e))return function(e,t){return new sn((function(n){var r;return bn(n,t,(function(){r=e[un](),bn(n,t,(function(){var e,t,o;try{t=(e=r.next()).value,o=e.done}catch(e){return void n.error(e)}o?n.complete():n.next(t)}),0,!0)})),function(){return Ct(null==r?void 0:r.return)&&r.return()}}))}(e,t);if(pn(e))return function(e,t){return Ln(En(e),t)}(e,t)}throw dn(e)}function Dn(e,t){return gt((function(n,r){var o=0;n.subscribe(fn(r,(function(n){r.next(e.call(t,n,o++))})))}))}var Rn=Array.isArray;function Hn(e){return Dn((function(t){return function(e,t){return Rn(t)?e.apply(void 0,Dt([],Ot(t))):e(t)}(e,t)}))}function Vn(e,t,n){return void 0===n&&(n=rn),function(r){wn(t,(function(){for(var o=e.length,s=new Array(o),i=o,a=o,c=function(o){wn(t,(function(){var c=function(e,t){return t?On(e,t):Nn(e)}(e[o],t),l=!1;c.subscribe(fn(r,(function(e){s[o]=e,l||(l=!0,a--),a||r.next(n(s.slice()))}),(function(){--i||r.complete()})))}),r)},l=0;l<o;l++)c(l)}),r)}}function wn(e,t,n){e?bn(n,e,t):t()}function Pn(e,t,n){return void 0===n&&(n=1/0),Ct(t)?Pn((function(n,r){return Dn((function(e,o){return t(n,e,r,o)}))(Nn(e(n,r)))}),n):("number"==typeof t&&(n=t),gt((function(t,r){return function(e,t,n,r,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<r?p(e):c.push(e)},p=function(e){s&&t.next(e),l++;var a=!1;Nn(n(e,d++)).subscribe(fn(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?bn(t,i,(function(){return p(e)})):p(e)};c.length&&l<r;)e();h()}catch(e){t.error(e)}})))};return e.subscribe(fn(t,E,(function(){u=!0,h()}))),function(){null==a||a()}}(t,r,e,n)})))}var Un=Array.isArray;function Mn(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=function(e){return Ct((t=e)[t.length-1])?e.pop():void 0;var t}(e);return n?function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return on(e)}(Mn.apply(void 0,Dt([],Ot(e))),Hn(n)):gt((function(t,n){Vn(Dt([t],Ot(function(e){return 1===e.length&&Un(e[0])?e[0]:e}(e))))(n)}))}var Wn=Ut((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),xn=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 bt(t,e),t.prototype.lift=function(e){var t=new Fn(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new Wn},t.prototype.next=function(e){var t=this;Kt((function(){var n,r;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var o=Lt(t.currentObservers),s=o.next();!s.done;s=o.next()){s.value.next(e)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}}))},t.prototype.error=function(e){var t=this;Kt((function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var n=t.observers;n.length;)n.shift().error(e)}}))},t.prototype.complete=function(){var e=this;Kt((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,n=this,r=n.hasError,o=n.isStopped,s=n.observers;return r||o?Ft:(this.currentObservers=null,s.push(e),new xt((function(){t.currentObservers=null,Wt(s,e)})))},t.prototype._checkFinalizedStatuses=function(e){var t=this,n=t.hasError,r=t.thrownError,o=t.isStopped;n?e.error(r):o&&e.complete()},t.prototype.asObservable=function(){var e=new sn;return e.source=this,e},t.create=function(e,t){return new Fn(e,t)},t}(sn),Fn=function(e){function t(t,n){var r=e.call(this)||this;return r.destination=t,r.source=n,r}return bt(t,e),t.prototype.next=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===n||n.call(t,e)},t.prototype.error=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===n||n.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,n;return null!==(n=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==n?n:Ft},t}(xn);var $n={connector:function(){return new xn}};function kn(e,t){void 0===t&&(t=$n);var n=t.connector;return gt((function(t,r){var o,s=n();Nn(e((o=s,new sn((function(e){return o.subscribe(e)}))))).subscribe(r),r.add(t.subscribe(s))}))}function jn(e,t){return void 0===t&&(t=vn),gt((function(n,r){var o=null,s=null,i=null,a=function(){if(o){o.unsubscribe(),o=null;var e=s;s=null,r.next(e)}};function c(){var n=i+e,s=t.now();if(s<n)return o=this.schedule(void 0,n-s),void r.add(o);a()}n.subscribe(fn(r,(function(n){s=n,i=t.now(),o||(o=t.schedule(c,e),r.add(o))}),(function(){a(),r.complete()}),void 0,(function(){s=o=null})))}))}var Gn=new sn((function(e){return e.complete()}));function Yn(e){return e<=0?function(){return Gn}:gt((function(t,n){var r=0;t.subscribe(fn(n,(function(t){++r<=e&&(n.next(t),e<=r&&n.complete())})))}))}function zn(e,t){return gt((function(n,r){var o=0;n.subscribe(fn(r,(function(n){return e.call(t,n,o++)&&r.next(n)})))}))}function Bn(e){return gt((function(t,n){try{t.subscribe(n)}finally{n.add(e)}}))}var Kn=Pn;var qn=function(e){function t(t,n){var r=e.call(this)||this;return r.source=t,r.subjectFactory=n,r._subject=null,r._refCount=0,r._connection=null,yt(t)&&(r.lift=t.lift),r}return bt(t,e),t.prototype._subscribe=function(e){return this.getSubject().subscribe(e)},t.prototype.getSubject=function(){var e=this._subject;return e&&!e.isStopped||(this._subject=this.subjectFactory()),this._subject},t.prototype._teardown=function(){this._refCount=0;var e=this._connection;this._subject=this._connection=null,null==e||e.unsubscribe()},t.prototype.connect=function(){var e=this,t=this._connection;if(!t){t=this._connection=new xt;var n=this.getSubject();t.add(this.source.subscribe(fn(n,void 0,(function(){e._teardown(),n.complete()}),(function(t){e._teardown(),n.error(t)}),(function(){return e._teardown()})))),t.closed&&(this._connection=null,t=xt.EMPTY)}return t},t.prototype.refCount=function(){return gt((function(e,t){var n=null;e._refCount++;var r=fn(t,void 0,void 0,void 0,(function(){if(!e||e._refCount<=0||0<--e._refCount)n=null;else{var r=e._connection,o=n;n=null,!r||o&&r!==o||r.unsubscribe(),t.unsubscribe()}}));e.subscribe(r),r.closed||(n=e.connect())}))(this)},t}(sn);function Qn(e){return e?function(t){return kn(e)(t)}:function(e){return function(e,t){var n=Ct(e)?e:function(){return e};return Ct(t)?kn(t,{connector:n}):function(e){return new qn(e,n)}}(new xn)(e)}}function Xn(e,t){return void 0===t&&(t=!1),gt((function(n,r){var o=0;n.subscribe(fn(r,(function(n){var s=e(n,o++);(s||t)&&r.next(n),!s&&r.complete()})))}))}function Jn(e,t,n){var r=Ct(e)||t||n?{next:e,error:t,complete:n}:e;return r?gt((function(e,t){var n;null===(n=r.subscribe)||void 0===n||n.call(r);var o=!0;e.subscribe(fn(t,(function(e){var n;null===(n=r.next)||void 0===n||n.call(r,e),t.next(e)}),(function(){var e;o=!1,null===(e=r.complete)||void 0===e||e.call(r),t.complete()}),(function(e){var n;o=!1,null===(n=r.error)||void 0===n||n.call(r,e),t.error(e)}),(function(){var e,t;o&&(null===(e=r.unsubscribe)||void 0===e||e.call(r)),null===(t=r.finalize)||void 0===t||t.call(r)})))})):rn}class Zn{constructor(e){this.props.observableStreams=Zn.createDirectionalObservables()}static createDirectionalFiltersObject(){const e="internal",t="parent",n="child";return{P:[t],C:[n],PCI:[t,e,n],CI:[n,e],PI:[t,e],PC:[t,n]}}static addDefaultDir(e){return ue(J)({$dir:["internal"]},ne(e))}static addDownInternalDir(e,t=["internal","down"]){return ue(J)(ne(e),{$dir:t})}static addChildAndInternalDir(e,t=["child","down"]){return ue(J)(ne(e),{$dir:t})}static mapToDefaultDir(e){return this.addDefaultDir(e)}static createDirectionalObservables(e=new n,t,r){void 0!==t&&void 0!==r&&(e.viewName=t,e.vsid=r);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(zn((e=>void 0!==e&&void 0!==e.action))),E=e.pipe(zn(a),Dn(d)),p=e.pipe(zn(s),Dn(l)),N=e.pipe(zn(i),Dn(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 er{constructor(e,t={},r="",o="theName"){this.addMixins(),this._state="INIT",this.vsid=r,this.el=t.el,this.vsName=o,this.defaults={debug:!1,extendedHashMethods:{}},this.options=Ke(this.defaults,t);this.addActionListeners().forEach((e=>{const[t,n]=e;this.options.extendedHashMethods[t]=e=>this[n](e)})),this.options.hashMethods=this.setHashMethods(this.options.extendedHashMethods),this.sink$=e,this.sink$.subscribe(this.onObsSinkSubscribe.bind(this)),this.$dirs=Zn.createDirectionalFiltersObject(),this.addDefaultDir=Zn.addDefaultDir,this.sourceStreams=Zn.createDirectionalObservables(new n,this.vsName,this.vsid),this._source$=this.sourceStreams.toInternal$}addActionListeners(){return[]}setHashMethods(e={}){return Ke({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:n,template:r}=this.props;return new Tt(t,e,n,r)}onDisposeCompleted(e){}animateInTween(e,t){!function(e,t){const n=1*window.getComputedStyle(e).opacity,r=At(!0,t,"ease",1===n);e.style.cssText+=r}(e,t)}animateOutTween(e,t,n){!function(e,t,n){const r=At(!1,t,"ease");e.style.cssText+=r,e.addEventListener("transitionend",n,!1)}(e,t,n)}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,n={action:"READY_FOR_VS_DETRITUS_COLLECT",$dir:this.$dirs.PI,el:t},o=r(((e,n)=>{this.animateOutTween(t,e.animateOutTime,n)})),s=e=>{this._source$.next(n)},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,n=(e,t)=>e.insertBefore(t,e.firstChild);({appendChild:(e,t)=>e.appendChild(t),after:(e,t)=>e.after(t)}[e.attachType]||n)(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,n,r,o]=e;return this.domItem=new Tt({tagName:t,attributes:n,data:r,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,n=k((e=>this.extendedMethods(e))),r=n(this.options.hashMethods[t])(e);void 0!==r&&(e=>{this._source$.next(e)})(Object.freeze(r))}addMixins(){}}function tr(){setTimeout((()=>{Ee((e=>{}),this)}),1)}class nr{constructor(e,t,n,r="subscribe",o=!1){const s={name:e,observable:t,data:n,action:r};this.sendToDirectorStream(s)}sendToDirectorStream(e){const t=at.channelsMap.getStream("DISPATCHER"),n=dt(e);t.next(n),e=void 0}static deepClone(e){const t=y(Array),n=y(Object);var r;return!1===t(r=e)&&!0===n(r)?u(z,R,ne)(e):ne(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=tr}}const rr=!0===at.debug;class or{constructor(e,t){this.addMixins(),this.props=e,this.broadcastFn=t,this.broadcaster(this.broadcastFn)}addDblClickEvt(e){return o(e,"dblclick").pipe(Dn((e=>{const t=ne(e);return t.typeOverRide="dblclick",t})))}broadcast(e){if(e.length<=0&&!0===rr)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},[n,r,s]=e;let i,a=this.props.el.querySelectorAll(n);if(a.length<=0){const e=this.props.el,t=t=>{t===e&&(a=[t])};(()=>{const r=(null!==e.parentElement?e.parentElement:document).querySelectorAll(n);r.forEach=Array.prototype.forEach,r.forEach(t)})()}const c=void 0!==s,l=e=>{const n="dblClick"!==r?o(e,r,{preventDefault:()=>!0}):this.addDblClickEvt(e);i=e.dataset.channel;const s={};s.payload=(e=>{const t={};for(const n in e)t[n]=e[n];return t})(e.dataset),s.payload=Ne(["channel"],s.payload),s.channel=i,s.srcElement={},s.srcElement.id=this.props.id,s.srcElement.vsid=this.props.vsid,s.srcElement.isLocalEvent=c,s.srcElement.srcEvent=r,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"))])(n,s)};!0===(void 0===a||a.length<=0)&&!0===rr?console.warn(`Spyne Warning: The item ${n}, 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 nr("CHANNEL_ROUTE",e,t,"subscribe")},sendUIPayload:function(e,t){return new nr("CHANNEL_UI",e,t,"subscribe")}};this.sendUIPayload=e.sendUIPayload,this.sendRoutePayload=e.sendRoutePayload}}const sr=u(re,y(Array)),ir=u(re,E),ar=f([y(String),ir]),cr=f([y(Array),ir]),lr=u(f([sr,y(Object)])),dr=u(f([ir,sr,y(Object)]));class ur{constructor(e,t={},n,r){lr(e)&&(e=v("selector",t=e),r=r||v("testMode",t));const o=[n,v("debugLabel",t)];n=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=ar(e)?ur.filterSelector([e],n):void 0,c=cr(e)?ur.filterSelector(e,n):void 0,l=dr(i)?ur.filterData(i,n):void 0;let d=m(_,[a,c,l]);const h=E(d);return h&&(d=[V(!1)],!0===at.debug&&!0!==r&&console.warn(`Spyne Warning: The Channel Filter, with selector: ${e}, and propFilters:${i} appears to be empty!`)),!0===r?{selector:e,propFilters:i,debugLabel:n,filters:t,testMode:r,filtersAreEmpty:h}:f(d)}static filterData(e,t){const n=t;return(()=>{if(E(e))return V(!1);e=D(((e,t,n)=>{let r=Te;if((e=>y(String,e))(e)||(e=>y(Boolean,e))(e)||(e=>y(Number,e))(e))o=e,r=e=>e===o;else{if("function"==typeof e)return e;if((e=>y(Array,e))(e)||lr(e))return console.warn(`ChannelPayloadFilter: Property "${e}" is an array/object, which is not allowed. This property will always return false.`),r}var o;return r}),e);const t=me(e);return u(t,(t=>{if(void 0===n)return t;const r={};return de(((e,n)=>{r[n]=e(v(n,t))}),e),console.log(`%c CHANNEL PAYLOAD FILTER DEBUGGER ["${n}"] - values: `,"color:orange;",{propsBooleans:r,comparedObj:t}),t}),k({}),(e=>{const{payload:t,srcElement:n,event:r}=e||{};return Object.assign({},e,n,r,t)}))})()}static checkPayloadSelector(e,t,n){const{payload:r,srcElement:o,event:s}=n||{},i=[o,r,v("srcElement",s),n].reduce(((e,t)=>{const n=v("el",t);return ur.elIsDomElement(n)&&void 0===e&&(e=n),e}),void 0),a=e=>e.isEqualNode(i),c=e=>{const t=O(document.querySelectorAll(e));return D(a,t)};if(void 0!==t){const n=u(O,D(c))(e),r=e;console.log(`%c CHANNEL PAYLOAD FILTER DEBUGGER ["${t}"] - selectors: `,"color:orange;",{el:i,selectorsArr:r,nodeArrResultsDebugger:n})}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),v("nodeType"))(e)}static filterSelector(e,t){const n=m(E,e);return fe(ur.checkPayloadSelector)(n,t)}}function hr(){return!0===at.debug}function Er(e,t,n=!1){const r=Nr(e,t,n);return 1===r.length?p(r):r}function pr(e,t,n){const r=document.querySelector(e),o=u(se(0),k(-1),v("nodeType"));if(null===r||!1!==o(r)){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===n&&!0===hr()&&!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, ${r}`)}function Nr(e,t,n=!1){let r=!1;const o=(n=>{let o=[];try{o=document.querySelectorAll(n)}catch(e){o=[]}try{r=document.querySelector(t)===document.querySelector(e),!0===r&&(o=[document.querySelector(t)])}catch(e){}return o})(void 0!==t?`${e} ${t}`:e);if(!0===n){pr(!0===r?"body":e,t,n)}return o}function _r(e,t,n){return Nr(t,n).forEach((t=>{t.style.cssText=e})),this}function fr(e,t){function n(t){return fr(e,t)}return pr(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),n.map=n=>Array.from(Nr(e,t)).map(n),n.forEach=n=>Array.from(Nr(e,t)).map(n),n.getNodeListArray=()=>Nr(e,t),n.addClass=n=>(Nr(e,t).forEach((e=>e.classList.add(n))),this),n.removeClass=n=>(Nr(e,t).forEach((e=>{e.classList.remove(n)})),this),n.setClass=n=>(Nr(e,t).forEach((e=>{const t=u(m(E),Y(" "))(e.className),r=n.split(" ");t.forEach((t=>e.classList.remove(t))),r.forEach((t=>e.classList.add(t)))})),this),n.unmount=()=>{},n.toggleClass=(n,r)=>(Nr(e,t).forEach((e=>{(r=void 0!==r?r:!e.classList.contains(n))?e.classList.add(n):e.classList.remove(n)})),this),n.toggle=(e,t)=>(n.toggleClass(e,t),this),n.appendChild=e=>(0!==n.el.length?n.el.appendChild(e):console.warn(`Spyne Warning: The selector, ${t} does not appear to be valid!`),n.el),n.addAnimClass=n=>{requestAnimationFrame((()=>{Nr(e,t).forEach((e=>{try{e.classList.add(n)}catch(e){}}))}))},n.setActiveItem=(n,r)=>{const o=Nr(e,t),s="string"==typeof r?Er(e,r):r,i=e=>e.isEqualNode(s)?e.classList.add(n):e.classList.remove(n);var a;return!0===(a=s,u(se(0),k(-1),v("nodeType"))(a))?o.forEach(i):!0===hr()&&console.warn(`Spyne Warning: The selector, ${r}, does not appear to be a valid item in setActiveItem: ${n}`),this},Object.defineProperty(n,"el",{get:()=>Er(e,t,!0)}),Object.defineProperty(n,"els",{get:()=>Nr(e,t)}),Object.defineProperty(n,"len",{get:()=>Nr(e,t,!1).length}),Object.defineProperty(n,"exists",{get:()=>Nr(e,t,!1).length>=1}),Object.defineProperty(n,"exist",{get:()=>Nr(e,t,!1).length>=1}),Object.defineProperty(n,"nodeList",{get:()=>Nr(e,t)}),Object.defineProperty(n,"arr",{get:()=>{const n=Er(e,t,!0);return void 0===n?[]:void 0===n.length?[n]:Array.from(n)}}),Object.defineProperty(n,"inline",{set:n=>_r(n,e,t),get:()=>n}),Object.defineProperty(n,"inlineCss",{set:n=>_r(n,e,t),get:()=>n}),n}class mr{constructor(e={}){this.vsnum=Math.random(),this.addMixins(),this._postRenderCalled=!1,this.defaults=()=>{const t=this.createId(),n=e.id?e.id:t;return{vsid:t,id:n,tagName:"div",el:void 0,data:void 0,animateIn:!1,animateInTime:.5,animateOut:!1,animateOutTime:.5,sendLifecyleEvents:!1,hashId:`#${n}`,id$:`#${n}`,viewClass:er,extendedSourcesHashMethods:{},debug:!1,template:void 0,node:document.createDocumentFragment(),name:pt(this)}},this._state={},this.$dirs=Zn.createDirectionalFiltersObject(),this.addDefaultDirection=Zn.addDefaultDir,this.addDownInternalDir=Zn.addDownInternalDir,this.props=Ke(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 n,this.props.elIsAlreadyRenderedBool=this.elAlreadyExistsFn(this.props);const r=this.props.viewClass;this.view=new r(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=mr.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 at.debug}static checkIfActionsAreRegistered(e=[],t){if(t.length>0){const n=t=>{const n=new RegExp(t);if(ge(M(n),r)<0){const n=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 ${n}, ${e.join(", ")}`)}},r=(e=>{const t=e.map((e=>at.getChannelActions(e)));return O(t)})(e);t.forEach(n)}}static isValidNestedArr(e){const t=T(!0),n=Ae(t),r=y(String),o=u(n,D(r),Ce(0,2),k([]));return u(n,D(o),k([]))(e)}static elIsDomElement(e){return y(String,e)&&(e=document.querySelector(e)),u(se(0),k(-1),v("nodeType"))(e)}updatePropsToMatchEl(){const e=u(ye,P(v("tagName"),V("")));this.props.tagName=e(this.props.el)}elAlreadyExistsFn(e){const t=u(se(0),k(-1),v("nodeType"));return he(f([e=>document.body.contains(e),t]),"el")(e)}checkIfElementAlreadyExists(){!0===this.props.elIsAlreadyRenderedBool?(this.updatePropsToMatchEl(),this.postRender()):null===this.props.el&&console.error(`Spyne Error: The defined element for this ViewStream instance, ${this.constructor.name}, appears to not exist.`)}loadAllMethods(){const e=fe(this.onChannelMethodCall.bind(this));this.addActionListeners().forEach((t=>{let[n,r,o]=t;y(String,o)&&(o=new ur({selector:o})),this.props.extendedSourcesHashMethods[n]=e(r,o)})),this.props.hashSourceMethods=this.setSourceHashMethods(this.props.extendedSourcesHashMethods)}addActionListeners(){return[]}onChannelMethodCall(e,t,n){const r=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!==n.$dir&&n.$dir.includes("child")&&!0!==this.deleted){const e=Ke({},n);e.$dir=this.$dirs.C,this.sourceStreams.raw$.next(e)}!0===k(V(!0),t)(n)&&r(n=Ne(["$dir"],n))}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 Ke.all([{},t,e])}initViewStream(){this._source$=this._rawSource$.pipe(Dn((e=>this.onMapViewSource(e))),Xn(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(zn((e=>void 0!==e&&void 0!==e.action)),Dn((e=>{const t=Ke({},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(zn((e=>void 0!==e&&void 0!==e.action)),Jn((e=>this.tracer("addChildStraem do ",e))),Dn((e=>e)),Bn((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)},r=()=>{o-=1,0===o&&t()};let o=0;this.uberSource$=new n;this.autoMergeSubject$=this.uberSource$.pipe(Pn((e=>{const t=e.observable.pipe(zn((e=>void 0!==e&&void 0!==e.action)),Dn((e=>{const t=Ke({},e);return t.action=e.action,this.tracer("autoMergeSubject$",t),t})));return!1===e.autoClosesBool?t:(o+=1,t.pipe(Bn(r)))}))),this.autoSubscriber$=this.autoMergeSubject$.pipe(zn((e=>void 0!==e&&void 0!==e.action))).subscribe(e)}updateSourceSubscription(e,t=!1,n){const r={observable:e,autoClosesBool:t,rel:n};this.tracer("updateSourceSubscription ",this.vsnum,r),this.uberSource$.next(r)}onSubscribeToSourcesNext(e={}){const t=k((e=>this.sendExtendedStreams(e))),n=(r=this.props.hashSourceMethods,o=e.action,void 0!==r[o]?o:u(p,F(u(M(I,o),(e=>new RegExp(e)))))(A(r)));var r,o;t(this.props.hashSourceMethods[n])(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,n){const r={node:e,type:t,attachType:n};this.openSpigot("VS_SPAWN_AND_ATTACH_TO_DOM",{attachData:r})}checkParentDispose(e){"parent"===e.from$&&this.disposeViewStream(e)}onBeforeDispose(){}setTimeout(e,t=0,n=!1){window.setTimeout(((...t)=>{if(void 0!==this&&void 0!==this.props){const r=!0===n?e.bind(this):e;ve(r,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 n=J(this.props,t);this.sink$.next(Object.freeze(n))}}setAttachData(e,t){return{node:this.props.el,type:"ViewStreamObservable",attachType:e,query:(()=>{const e=this.props.el.querySelector(t);return!0===mr.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 n=e=>e.parentElement;let r=0,o=e;for(;r<t;)o=n(o),r++;return o}setAttachParentData(e,t,n){t=""!==t?t:void 0;const r=this.getParentEls(this.props.el,n);return{node:r,type:"ViewStreamObservable",attachType:e,query:r.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,n=1){this.exchangeViewsWithChild(e,this.setAttachParentData("appendChild",t,n))}prependViewToParentEl(e,t,n=1){this.exchangeViewsWithChild(e,this.setAttachParentData("prependChild",t,n))}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===mr.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 or(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(),n=t.map(e);if(!1===mr.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 r=()=>{void 0!==K(["props","addedChannels"],this)&&mr.checkIfActionsAreRegistered.bind(this)(this.props.addedChannels,n)};this.setTimeout(r,500)}}setDataVSID(){this.props.el.dataset.vsid=this.props.vsid}beforeAfterRender(){this.setDataVSID(),this.props.el$=fr(this.props.el)}downStream(){}onRendered(){}onAnimFrameAfterRendered(){}afterRender(){}broadcastEvents(){return[]}getChannel(e){return H((e=>ct().includes(e)),(e=>at.channelsMap.getStream(e).observer.pipe(Xn((e=>!0!==this.deleted)))),(e=>console.warn(`channel name ${e} is not within ${ct}`)))(e)}initializeChannels(){const e=e=>{const[t,n=!1]=Array.isArray(e)?e:[e];this?.addChannel(t,n)};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,n=!1,r=!1){const o=!0===n?this.$dirs.CI:this.$dirs.I;if(!0===this?.props?.addedChannels?.includes(e))return;const s=K(["srcElement","isLocalEvent"]),i=K(["srcElement","vsid"]),a=[Dn((e=>{const t=e;return t.$dir=o,t})),zn((e=>{const t=i(e);return!0!==s(e)||t===this.props.vsid}))];var c;!0===t&&a.unshift((c=1,zn((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=at.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={},n){const r=t,o=k("VIEWSTREAM_EVENT"),i=u(o,v(e)),a={payload:r,action:n=n||i({CHANNEL_ROUTE:"CHANNEL_ROUTE_CHANGE_EVENT"})};try{if(a.srcElement=u(ee(["id","vsid","class","tagName"]),v("props"))(this),!0===this.checkIfChannelExists(e)){!1===/CHANNEL_LIFECYCLE/.test(n)&&Object.defineProperties(a,{payload:{get:()=>dt(t)}});const r=s(a);return new nr(e,r,a)}}catch(e){console.warn("SPYNE WARNING ",e)}}tracer(...e){this.sendLifecycleMethod(...e)}sendLifecycleMethodInactive(){}sendLifecycleMethodActive(e,t){const n="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===n&&this.sendInfoToChannel("CHANNEL_LIFECYCLE",{action:"CHANNEL_LIFECYCLE_DISPOSED_EVENT"},"CHANNEL_LIFECYCLE_DISPOSED_EVENT")}createActionFilter(e,t){return new ur(e,t)}isLocalEvent(e){const t=K(["srcElement","el"],e),n=K(["props","el"],this);return mr.elIsDomElement(n)&&mr.elIsDomElement(t)&&n.contains(t)}addMixins(){const e=ht();this.createId=e.createId}}class Tr{constructor(e){const t=String(e.props.name),n=`${t}_ROUTE_UPDATER`;return fe(Tr.createTemporaryViewStreamObj)({id:n,name:t})}static createTemporaryViewStreamObj(e,t){const{name:n,id:r}=e,o=t,s=new mr({id:r,name:n,data:t});s.onRendered=()=>{s.sendInfoToChannel("CHANNEL_ROUTE",o)},s.afterBroadcastEvents=()=>{s.disposeViewStream()},s.appendToNull()}}class Ar{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 n=void 0!==this.props.data;void 0!==this.props.replay?this.props.sendCachedPayload=this.props.replay:this.props.sendCachedPayload=void 0===this.props.sendCachedPayload?n:this.props.sendCachedPayload,this.sendPayloadToRouteChannel=new Tr(this),this.createChannelActionMethods(),this.streamsController=at.channelsMap;const r=this.getMainObserver();this.checkForPersistentDataMode=Ar.checkForPersistentDataMode.bind(this),this.observer$=this.props.observer=r;const o=this.streamsController.getStream("DISPATCHER"),s=U(t.name,"name");o.pipe(zn(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 n}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 n=E(t),r=void 0!==v("data",e);return!0===n&&!0===r&&(e.sendCachedPayload=!0,t=(()=>{const{name:t}=e,n=`${t}_EVENT`;return{[n]:n}})(),void 0!==this.channelActions&&(this.channelActions=t)),{props:e,actionsObj:t}}setTrace(e){}createChannelActionsObj(e,t=[]){const n=H(y(String),be,p),r=t.concat(this.addRegisteredActions(e)),o=D(n,r),s=oe(Q((e=>Ie(e,e)),o));this.channelActions=s}createChannelActionMethods(){const e=H(y(String),be,p),t=(e,t)=>{window.setTimeout((()=>{"function"!=typeof this[e]&&console.warn(`"${this.props.name}", REQUIRES THE FOLLOWING METHOD ${e} FOR ACTION, ${t[0]}`)}),100)},n=H(y(String),V("onViewStreamInfo"),(e=>{const n=Se(Le(1),e);return t(n,e),n}));this.channelActionMethods=z(D((t=>[e(t),n(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),n=K(["data","action"],e),r=v(n,this.channelActionMethods);let o=t;if(void 0!==r&&"onViewStreamInfo"!==r){!0===("function"==typeof this[r])&&(o=this[r].bind(this))}return o}onIncomingObservable(e){const t=T(e.name,this.props.name),{action:n,payload:r,srcElement:o}=e.data,s=t=>({clone:()=>{return t=e.data,oe([t,{action:v("action",t)},v("payload",t),v("srcElement",t)]);var t},action:n,payload:r,srcElement:o,event:t});return!0===t?(e=>e.observable.pipe(Dn(s)).subscribe(this.getActionMethodForObservable(e)))(e):void 0}onViewStreamInfo(e){}sendChannelPayload(e,t,n={},r={},o=this.observer$){const s=new ut(this.props.name,e,t,n,r);o.next(s)}getChannel(e,t){return H((e=>ct().includes(e)),(n=>{const r=this.streamsController.getStream(n).observer;return r.source?r.source.channelName=e:r.channelName=e,void 0!==t?r.pipe(zn(t)):r}),(e=>console.warn(`channel name ${e} is not within ${ct}`)))(e)}mergeChannels(e,t=!0){const n=e.map((e=>{if("string"==typeof e){const n=this.getChannel(e);return t?n.pipe(Yn(1)):n}return t?e.pipe(Yn(1)):e}));let r;if(t)r=a(n);else if(0===n.length)r=c;else if(1===n.length)r=n[0];else{const[e,...t]=n;r=e.pipe(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Mn.apply(void 0,Dt([],Ot(e)))}(...t))}return r.pipe(Dn((t=>{const n={};return e.forEach(((e,r)=>{const o="string"==typeof e?e:`channel_${r}`;n[e?.source?.channelName||e?.source?.source?.channelName||o]=t[r]})),n})))}static checkForNotTrackFlag(e={}){!0===e.doNotTrack&&at.doNotTrackChannel(e.channelName)}}class Cr extends Ar{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(Dn((e=>this.onMapNext(e)))),this.compareRouteKeywords=$e.compareRouteKeywords()}checkConfigForHash(){!0===("hash"===at.config.channels.ROUTE.type)&&(at.config.channels.ROUTE.type="slash",at.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);at.config.channels.ROUTE=J(at.config.channels.ROUTE,t),at.conformRouteConfig();const n=this.getRouteConfig();n.navLinks=[...n?.routeDatasetsArr],this.routeConfigJson=n,this.bindStaticMethodsWithConfigData(),this.sendChannelPayload("CHANNEL_ROUTE_CONFIG_UPDATED_EVENT",n,{},{},this.navToStream$)}getRouteConfig(){const e=at.config,t=K(["channels","ROUTE"],e);"query"===t.type&&(t.isHash=!1);const n=$e.flattenConfigObject(t.routes);return t.paramsArr=n,t}initStream(){this.firstLoadStream$=new i(1),this.onIncomingDomEvent(void 0,this.routeConfigJson,"CHANNEL_ROUTE_DEEPLINK_EVENT"),$e.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,n){const r=void 0!==n?n: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"===n&&(i.navLinks=v("routeDatasetsArr",t),Object.defineProperty(i,"linksData",{get(){return console.warn("get links data is deprecated in ROUTE DEEPLINK DATA, use navLinks"),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(r,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,v("payload"))(e);if(t.length>=1){const n=v("event",e);if(void 0!==n){const e=L(/^(event)([A-Z])(.*)([A-Z].*)$/gm,((e,t,n,r,o)=>String(n).toLowerCase()+r+o)),r=t=>{const r=e(t);void 0!==n[r]&&n[r]()};t.forEach(r)}}return e}static checkForEndRoute(e,t=this.routeConfigJson,n){if(!0!==u(T("true"),K(["payload","endRoute"]))(e))return e;const r=void 0!==n?n:!0===at.debug,{payload:o}=e;let s=0;const i=(e=[],t)=>{const n=t[1],{routePath:a}=n,c=v("routeName",a),l=(e=>{const t=v("routeName",e);if(t){const n=u(A,Ne(["routeName"]))(e),r=o[t];return C((e=>new RegExp(`^${e}$`).test(r)),n)}})(a),d=y(Object,n),h=y(Array,n);if(s+=1,!0===d&&!1===h){const t=a[l];t?u(Re,j(i,e),R)({nextRoutePath:t}):1===s?r&&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,j(i,[]),R)({routes:a});if(1===c.length){const t=c[0];e.payload[t]=""}return e}onViewStreamInfo(e){const t=e.action??this.channelActions.CHANNEL_ROUTE_CHANGE_EVENT;e?.srcElement?.el?.dataset&&(e.payload=function(e){const t={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}(e?.srcElement?.el?.dataset)??e.payload),Cr.checkForEventMethods(e),e=this.checkForEndRoute(e);let n=this.getDataFromParams(e);const r=v("srcElement",e),o=v("event",e),s=!n.isHidden,i=this.compareRouteKeywords.compare(n.routeData,n.paths);n=J(n,i),this.sendRouteStream(n,s),n=Cr.removeSSID(n),this.sendChannelPayload(t,n,r,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 n=v("payload",e);const r=this.getRouteStrFromParams(n,t),o=(e,n)=>k(n,v(e,t)),s=o("type","slash"),i=o("isHash",!1),a=Fe.formatStrAsWindowLocation(r),c=this.getDataFromLocationStr(s,i,a),{pathInnermost:l,paths:d}=c;n=J(c.routeData,n);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:n,routeValue:r,isHash:E,isHidden:N,isHistory:p,routeType:_}}static getDataFromString(e=this.routeConfigJson,t=!1){const n=e.type,r=!0===e.isHash,o=Fe.getLocationStrByType(n,r),{paths:s,pathInnermost:i,routeData:a,routeValue:c}=Cr.getParamsFromRouteStr(o,e,n),{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,n=window.location){const r=void 0!==this.routeConfigJson?this.routeConfigJson.type:e,o=Fe.getLocationStrByType(r,t,n),{paths:s,pathInnermost:i,routeData:a,routeValue:c}=this.getParamsFromRouteStr(o,this.routeConfigJson,r);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,n){const r=void 0!==n?n:t.type;return Fe.convertParamsToRoute(e,t,r)}static getParamsFromRouteStr(e,t,n){const r=void 0!==n?n:t.type;return Fe.convertRouteToParams(e,t,r)}checkEmptyRouteStr(e,t=!1){const n=E(e);return!0===(!0===n&&!1===t)||!0===(!0===n&&!0===t)?"/":!0===(!1===n&&!0===t)?w("#",e):e}static removeLastSlash(e){return e.replace(/^(.*)(\/)$/,"$1")}setWindowLocation(e){let{isHash:t,routeValue:n,routeType:r}=e;n=this.checkEmptyRouteStr(n,t);const{routeCount:o}=e;if(!0===t||"query"===r){n=Cr.removeLastSlash(window.location.pathname)+n,window.history.pushState({routeCount:o},"",n)}else{const e=b(u(h(T("/")),p),w("/",I));window.history.pushState({routeCount:o},"",e(n))}}getWindowLocation(){return window.location.pathname}bindStaticMethods(){this.checkForEndRoute=Cr.checkForEndRoute.bind(this),this.getIsDeepLinkBool=Cr.getIsDeepLinkBool.bind(this),this.getDataFromLocationStr=Cr.getDataFromLocationStr.bind(this),this.onIncomingDomEvent=Cr.onIncomingDomEvent.bind(this),this.getDataFromString=Cr.getDataFromString.bind(this),this.getParamsFromRouteStr=Cr.getParamsFromRouteStr.bind(this),this.getLocationData=Cr.getLocationData.bind(this),this.getRouteState=Cr.getRouteState.bind(this),this.getDataFromParams=Cr.getDataFromParams.bind(this),this.getRouteCount=Cr.getRouteCount.bind(this),this.getExtraPayloadParams=Cr.getExtraPayloadParams.bind(this),this.bindStaticMethodsWithConfigData()}bindStaticMethodsWithConfigData(){const e=He(3,Cr.getRouteStrFromParams);this.getRouteStrFromParams=e(I,this.routeConfigJson,this.routeConfigJson.type)}}let yr,gr=!1,vr=!1;const br={ALLOWED_TAGS:["a","b","i","em","strong","u","p","br","ul","ol","li","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"],ALLOWED_ATTR:["href","src","alt","title","width","height","style","target","rel","controls","poster","type","rows","cols"],ALLOW_DATA_ATTR:!0,FORBID_ATTR:["onerror","onload","onclick","onmouseover","onfocus","onblur","onchange"],FORBID_TAGS:["script","iframe","object","embed","form","input","button","meta","link"],SAFE_URL_PATTERN:/^(https?:|mailto:|tel:|data:image\/)/i},Ir={FORBID_TAGS:["script","iframe","object","embed","form","input","button","link","meta"],FORBID_ATTR:["onerror","onload","onclick","onmouseover","onfocus","onblur","onchange"],ALLOW_DATA_ATTR:!1},Sr=()=>{try{const e=at?.mode;if("authoring"===e||"development"===e)return"richtext"}catch(e){}return"app"};function Lr(e="app"){const t="richtext"===e?br:Ir;return n=>{let r=xe.sanitize(n,t);return"richtext"===e&&(r=r.replace(/<(a|img)\b([^>]+?)>/gi,(e=>e.replace(/\b(href|src)="([^"]*)"/gi,((e,t,n)=>br.SAFE_URL_PATTERN.test(n)?e:`${t}=""`))))),r}}const Or=(e={})=>{if(gr)return void console.warn("sanitizeData is already configured. Reconfiguration is not allowed.");const{strict:t=!1}=e,n=e=>{const t=Lr(e),n=e=>{if(Array.isArray(e))return e.map(n);if(e&&"object"==typeof e){const r={};for(const[o,s]of Object.entries(e))r[o]="string"==typeof s?t(s):n(s);return r}return"string"==typeof e?t(e):e};return n};yr=(e,r={})=>{const{disableSanitize:o=!1,mode:s}=r,i=s||(vr||t?"app":Sr());return o?e:n(i)(e)},Or.sanitizeDataForce=(e,t)=>{const r=t||Sr();return n(r)(e)},gr=!0},Dr=(e,t={})=>{if(!gr)throw new Error("sanitizeData is not configured. Call sanitizeDataConfigure() first.");return yr(e,t)},Rr=(e,t)=>{if(!e)return;const n=Lr(t||Sr()),r=/<(?:script|iframe|object|embed|form|input|button|link|meta)[^>]*>|on\w+=|javascript:/i;if("string"==typeof e.value&&r.test(e.value)){const t=n(e.value);t!==e.value&&(e.value=t)}if(e.isContentEditable&&"string"==typeof e.innerHTML&&r.test(e.innerHTML)){const t=n(e.innerHTML);t!==e.innerHTML&&(e.innerHTML=t)}};class Hr extends Ar{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=Hr.removeSSID(e.data);const{payload:n,srcElement:r}=e.data,o=e=>({payload:n,srcElement:r,event:e});return!0===t?(e=>e.observable.pipe(Dn(o)).subscribe(this.onUIEvent.bind(this)))(e):void 0}getActionState(e){const t=K(["event","type"]),n=K(["event","typeOverRide"]),r=u(Ve,P(n,t))(e),o="CHANNEL_UI";return void 0!==r?`${o}_${r}_EVENT`:o}static checkForEventMethods(e){const t=u(F(M(/^(event)([A-Z].*)([A-Z].*)$/gm)),A,v("payload"))(e);if(t.length>=1){const n=v("event",e);if(void 0!==n){const e=L(/^(event)([A-Z])(.*)([A-Z].*)$/gm,((e,t,n,r,o)=>String(n).toLowerCase()+r+o)),r=t=>{const r=e(t);void 0!==n[r]&&"function"==typeof n[r]&&n[r]()};t.forEach(r)}}return e}onUIEvent(e){e.payload=function(e){const t={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}(e?.srcElement?.el?.dataset)??e.payload,Hr.checkForEventMethods(e),e.action=this.getActionState(e);const t=e.action,{payload:n,srcElement:r}=e,o=e.event;Rr(o?.target),this.sendChannelPayload(t,n,r,o)}}class Vr{constructor(){this.createDomObservableFromEvent=Vr.createDomObservableFromEvent.bind(this)}static createDomObservableFromEvent(t,n,r=!0,o=window){return n=void 0===n?e=>e:n,e((e=>o.addEventListener(t,e,{passive:r})),(()=>{o[t]=e=>e})).pipe(Dn(n))}static createMediaQuery(e){const t=window.matchMedia(e);return this.checkIfValidMediaQuery(t,e),!1!==t&&t}static checkIfValidMediaQuery(e,t){const n=e=>e.replace(/\s+/gm,""),r=void 0!==e.matches&&n(e.media).indexOf(n(t))>=0;return!1===r&&(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),r}static createMediaQueryHandler(t,n){const r=(e=>t=>(t.mediaQueryName=e,t))(n),o=(s=t,{addHandler:e=>{s.addListener(e)},removeHandler:e=>{s.onchange=()=>{}}});var s;return new e(o.addHandler,o.removeHandler).pipe(Dn(r))}static createMergedObsFromObj(e){const t=e.mediaQueries||e.mediaQueries,n=[];return ce(((e,t,r)=>{const o=Vr.createMediaQuery(e);return!1!==o&&n.push(Vr.createMediaQueryHandler(o,t)),n}),t),n}}class wr extends Ar{constructor(e="CHANNEL_WINDOW"){super(e),this.bindStaticMethods(),this.currentScrollY=0}initializeStream(){this.domChannelConfig=at.config.channels.WINDOW;const e=this.getActiveObservables(),t=l(...e);this.dom$=t,t.subscribe((e=>{const{action:t,payload:n,srcElement:r,event:o}=e;this.sendChannelPayload(t,n,r,o)}))}static getMouseWheelMapFn(e){const t=this.channelActions.CHANNEL_WINDOW_WHEEL_EVENT,n=e.deltaY<=0?"up":"down",{deltaX:r,deltaY:o,deltaZ:s}=e;return{action:t,payload:{scrollDir:n,deltaX:r,deltaY:o,deltaZ:s},srcElement:e.srcElement,event:e}}static createCurriedGenericEvent(e){const t=`CHANNEL_WINDOW_${e.toUpperCase()}_EVENT`;return fe(wr.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,n=window.matchMedia("(orientation: portrait)").matches,r=ee(["innerWidth","innerHeight","outerWidth","outerHeight"],window);r.orientation=!0===n?"portrait":"landscape";return{action:t,payload:r,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 Vr.createDomObservableFromEvent("wheel",wr.getMouseWheelMapFn.bind(this)).pipe(jn(t))}static getScrollData(){let e=0;return t=>{const n=e-t;return e=t,{scrollY:t,scrollDistance:n,scrollDir:n>=0?"up":"down"}}}static getScrollY(e){return void 0!==e.pageYOffset?e.pageYOffset:e.scrollTop}static getScrollMapFn(e,t,n,r,o){const s=r(wr.getScrollY(o)),{scrollDistance:i}=s;return{action:n,payload:s,srcElement:e.srcElement,scrollDistance:i,event:e}}createScrollObservable(e,t=window,n=!0){const r=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=wr.getScrollData(),l=we(wr.getScrollMapFn,[a,c,i,n,o]).bind(this);return Vr.createDomObservableFromEvent("scroll",l,n,o).pipe(jn(r),(d=e=>0===e.scrollDistance,gt((function(e,t){var n=!1,r=0;e.subscribe(fn(t,(function(e){return(n||(n=!d(e,r++)))&&t.next(e)})))}))),Dn((e=>{const t=wr.getScrollY(o);return e.payload.scrollDistanceAbs=Math.abs(this.currentScrollY-t),this.currentScrollY=t,e})));var d}createOrientationObservable(e){return Vr.createDomObservableFromEvent("orientationchange",wr.getOrientationMapFn.bind(this))}createResizeObservable(e){const t=e.debounceMSTimeForResize;return Vr.createDomObservableFromEvent("resize",wr.getResizeMapFn.bind(this)).pipe(jn(t))}getEventsFromConfig(e=this.domChannelConfig){const t=e.events;return D((e=>{const t=wr.createCurriedGenericEvent(e);return Vr.createDomObservableFromEvent(e,t)}),t)}getActiveObservables(e=this.domChannelConfig){let t=[];e.listenForMediaQueries=Nt(e.mediaQueries)||Nt(e.mediaQueries);const n={listenForResize:this.createResizeObservable.bind(this),listenForOrientation:this.createOrientationObservable.bind(this),listenForScroll:this.createScrollObservable.bind(this),listenForWheel:this.createMouseWheelObservable.bind(this)};ce(((n,r,o)=>{e[r]&&t.push(n(e))}),n),this.checkForMediaQueries(e.listenForMediaQueries);const r=this.getEventsFromConfig(e);return t=t.concat(r),t}checkForMediaQueries(e){const t=e=>{const{action:t,payload:n,srcElement:r,event:o}=e;this.sendChannelPayload(t,n,r,o,this.observer$)};!0===e&&this.getMediaQueryObservable(this.domChannelConfig).subscribe(t)}getMediaQueryObservable(e){const t=this.createMergedObsFromObj(e);return ve(l,t).pipe(Dn(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:n,scrollElement:r}=e.payload;t=t||{},t=Ke(this.domChannelConfig,t),r=r||n;this.sendChannelPayload("CHANNEL_WINDOW_SCROLL_ELEMENT_ADDED_EVENT",{el:n},n),this.createScrollObservable(t,r).subscribe((e=>{const{action:t,payload:n,srcElement:r,event:o}=e;this.sendChannelPayload(t,n,r,o)}))}bindStaticMethods(){this.createMediaQueryHandler=Vr.createMediaQueryHandler.bind(this),this.createMergedObsFromObj=Vr.createMergedObsFromObj.bind(this)}}class Pr extends Ar{constructor(e={}){super("CHANNEL_LIFECYCLE",e)}addRegisteredActions(){return["CHANNEL_LIFECYCLE_RENDERED_EVENT","CHANNEL_LIFECYCLE_DISPOSED_EVENT"]}onViewStreamInfo(e){const{action:t,srcElement:n}=e,r=n;r.action=t,this.onSendEvent(t,r)}onSendEvent(e,t={}){const n=this.channelActions[e],r={};window.setTimeout((()=>this.sendChannelPayload(n,t,r,undefined)),0)}}class Ur extends Ar{constructor(e,t={}){t.isProxy=!0,super(e,t),this.props=t,this.subject$=new n,this.replaySub$=new i(1),this.observer$=l(this.subject$,this.replaySub$);!0===at.debug&&this.checkIfChannelIsStillProxy(e)}getMergedSubject(e=!1){return!0===e?this.replaySub$:this.subject$}checkIfChannelIsStillProxy(e){const t=e;Et((()=>{!0!==X(t,at.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 Mr=new Map;class Wr{constructor(){this.addMixins(),Mr.set("DISPATCHER",new n),this.listRegisteredChannels=Wr.listRegisteredChannels.bind(this),this.getChannelsList=Wr.getChannelsList.bind(this)}get map(){return Mr}static getChannelsList(){return Array.from(Mr,((e,t)=>({key:e[0],val:e[1].constructor.name})))}static listRegisteredChannels(e=!1){const t=this.getChannelsList(),n=m(U("ChannelProxy","val")),r=F(U("ChannelProxy","val")),o=(!0===e?r:n)(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(v("key")))(t)}`;console.warn(e)}}init(){this.createMainStreams()}createMainStreams(){this.routeStream=new Cr,Mr.set("CHANNEL_ROUTE",this.routeStream),this.uiStream=new Hr,Mr.set("CHANNEL_UI",this.uiStream),this.domStream=new wr,Mr.set("CHANNEL_WINDOW",this.domStream),this.viewStreamLifecycle=new Pr,Mr.set("CHANNEL_LIFECYCLE",this.viewStreamLifecycle),this.routeStream.initializeStream(),this.domStream.initializeStream()}addKeyEvent(e){Mr.get("UI").addKeyEvent(e)}registerStream(e){const t=e.channelName;if(Mr.has(t)){if(u(Ue(["props","isRegistered"],!0))(Mr.get(t)))return void console.warn(`Spyne Warning: The Channel, ${t}, has already been registered!`)}Mr.set(t,e),e.initializeStream()}getChannelActions(e){return Mr.get(e).addRegisteredActions()}getProxySubject(e,t=!1){const n=!0===t?"replaySubject":"subject";return Mr.get(e)[n]}testStream(e){return void 0!==Mr.get(e)}getStream(e){return!1===this.testStream(e)&&Mr.set(e,new Ur(e)),Mr.get(e)}addMixins(){}}class xr{constructor(e,t="",n=!0){return this.parentContext=e,this.omittedMethods=["autoBinder","initAutoBinder","getEnhancerMethods","checkForMalformedMethods","caller","arguments","bindParentViewStream"],this.prefix=t,!0===n&&this.autoBinder(),this.allMethodsList}initAutoBinder(){this.autoBinder()}getEnhancerMethods(){return function(e,t=[]){const n=w(["length","name","prototype","constructor"],t),r=u(ae(n),q),o=r(Object.getOwnPropertyNames(e.constructor.prototype)),s=r(Object.getOwnPropertyNames(e.constructor));return{methods:o,staticMethods:s,allMethods:w(o,s)}}(this,this.omittedMethods)}checkForMalformedMethods(e){if(""===this.prefix)return void console.warn(`SPYNE WARNING: The following SpyneTrait ${this.constructor.name} needs a prefix`);const t=m((e=>0===e.indexOf(this.prefix)),e);if(t.length>=1){const e=`Spyne Warning: The following method(s) in ${this.constructor.name} require the prefix, "${this.prefix}": [${t.join(", ")}];`;console.warn(e)}}bindParentViewStream(e,t){this.checkForMalformedMethods(e.allMethods);const n={},r=(e,r=!1)=>{const o=!0===r?this.constructor:this;"function"===typeof o[e]&&(n[e]=t[e]=o[e].bind(t))},o=He(2,r)(I,!0);return D(o,e.staticMethods),D(r,e.methods),n}autoBinder(){const e=this.getEnhancerMethods();return this.allMethodsList=this.bindParentViewStream(e,this.parentContext),this.allMethodsList}}class Fr{constructor(e,t,n,r){((e=!0)=>{vr=!!e})(!0);this._mapFn=Fr.setMapFn(e),this._url=Fr.setUrl(e),this._responseType=Fr.setResponseType(e),this._serverOptions=Fr.setServerOptions(e),this._subscriber=void 0!==t?t:e=>console.log("FETCH RETURNED ",e),this.debug=void 0!==e.debug&&e.debug,this.channelName=r;const o={mapFn:this.mapFn,url:this.url,serverOptions:this.serverOptions,responseType:this.responseType,debug:this.debug};!0!==n&&Fr.startWindowFetch(o,this._subscriber,this.channelName)}static startWindowFetch(e,t,n){const{mapFn:r,url:o,serverOptions:s,responseType:i,debug:a}=e,c=!0===a?e=>console.log("DEBUG FETCH :",e,{url:o,serverOptions:s,responseType:i,channelName:n}):()=>{},l=d(window.fetch(o,s)).pipe(Jn(c),Kn((e=>d(e[i]()))),Dn((t=>{const r={channelName:n,url:o,responseType:i,serverOptions:s};return n=>{const s=!0===e?.disableSanitize;if(s){const e="undefined"!=typeof process&&process.env&&process.env.NODE_ENV?process.env.NODE_ENV:"development",t=`SPYNE SECURITY WARNING — Sanitization disabled for fetch from ${o}. Data will enter the reactive stream unsanitized. Only use disableSanitize=true for trusted or controlled sources.`;if("production"===e)throw new Error(`SpyneJS security policy violation: disableSanitize=true is not allowed in production (${o}).`);console.warn(`%c${t}`,"color:#f33;font-weight:bold;")}const i=s?n:Dr(n);return t(i,r)}})(r)),Qn());l.connect(),l.subscribe(t)}static setMapFn(e){return u(k((e=>e)),v("mapFn"))(e)}static setUrl(e){const t=v("url",e);return void 0===t&&console.warn("SPYNE WARNING: URL is undefined for data channel"),t}static setResponseType(e){return k("json",v("responseType",e))}get mapFn(){return this._mapFn}get url(){return this._url}get serverOptions(){return this._serverOptions}get responseType(){return this._responseType}static stringifyBodyIfItExists(e){return b(Me(Object,"body"),u(De(Oe("body"),JSON.stringify)))(e)}static updateMethodWhenBodyExists(e){const t=B("body"),n=U("GET","method"),r=f([t,n]);return b(r,g("method","POST"))(e)}static setServerOptions(e){const t=ee(["method","headers","body","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive"],e);let n=te(Fr.baseOptions(),t);return n=Fr.updateMethodWhenBodyExists(n),n=Fr.stringifyBodyIfItExists(n),n}static baseOptions(){return{method:"GET",headers:new Headers({Accept:"application/json, text/plain, */*"}),mode:"cors",credentials:"same-origin",cache:"default",redirect:"follow",referrer:"client",referrerPolicy:"no-referrer-when-downgrade",integrity:"",keepalive:!1}}}class $r extends Ar{constructor(e,t={}){$r.validateMapMethod(t,e),void 0!==t.map&&(t.mapFn=t.map),t.extendedActionsArr=[`${e}_RESPONSE_EVENT`,[`${e}_REQUEST_EVENT`,"onFetchUpdate"]],t.sendCachedPayload=!0,super(e,t)}static validateMapMethod(e,t,n=!1){const r=P(_,(e=>"function"!=typeof e)),o=Ae(r),s=f([o,e=>e.length>=1]);return!u(s,N,ee(["map","mapFn"]))(e)||(!1===n&&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_UPDATE_RESPONSE_EVENT","onFetchUpdate"],["CHANNEL_FETCH_REQUEST_EVENT","onFetchUpdate"]].concat(t(this))}startFetch(e={},t=this.onFetchReturned.bind(this)){const n=this.consolidateAllFetchProps(e);return new Fr(n,t,!1,this.props.name)}onFetchUpdate(e){const t=this.getPropsForFetch(e);this.startFetch(t)}onFetchReturned(e){return this.createChannelPayloadItem(e)}createChannelPayloadItem(e,t=`${this.props.name}_RESPONSE_EVENT`){const{name:n,sendCachedPayload:r,url:o}=this.props,s={name:n,sendCachedPayload:r,url:o};this.sendChannelPayload(t,e,s)}getPropsForFetch(e){const t=K(["viewStreamInfo","payload"],e);return ee(["mapFn","url","header","body","mode","method","responseType","debug"],t)}consolidateAllFetchProps(e,t=this.props){const n=ee(["mapFn","url","header","body","mode","method","responseType","debug"],t),r=m(_);return u(r,((e,t)=>te(e,t)))(n,e)}get observer(){return this.observer$}}let kr=at;class jr{constructor(e={}){let{name:t,config:n,parentEl:r}=e;this.props=e,void 0===n&&(n=ne(e)),this.name=t||"empty",this.props.name=t,n=jr.mergeDefaultConfig(n,this.defaultConfig()),this.props.parentEl=r||jr.createParentEl(),this.props.config=n,void 0!==this.props.traits&&this.addTraits(this.props.traits)}register(e){kr=e,this.props.pluginName=this.props.name,!1!==kr.initialized?(this.onBeforeRegistered(),this.props.config=ne(this.props.config),kr.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 kr}static mergeDefaultConfig(e={},t=this.defaultConfig()){return Object.assign(t,e)}static getSpyneApp(e,t){!1===kr.initialized?console.warn(`Spyne Warning: Unable to install plugin, ${e}! SpyneApp has not been initialized!`):kr.addPluginConfig(e,t)}static updateSpyneConfig(e,t,n){return!0===We(y(Object),["config","plugins",t])(e)?(!0===e.config.debug&&console.warn(`Spyne Warning: The plugin, ${t}, already exists`),!1):(e.config.plugins[t]=n,e.config.plugins[t])}static createParentEl(e){return e||document.getElementById("spyne-plugins")||(()=>{const e=new Tt({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=at.getChannelConfig("WINDOW"),n=e.filter((e=>!t.events.includes(e)));n.length>0&&console.warn(`plugin "${this.props.name}" requires the following config.WINDOW.events, --\x3e ${n.join(", ")} <--`)}defaultConfig(){return{}}onRegistered(){}onRender(){}}const Gr=new Wr,Yr="0.20.12";let zr=new class{constructor(){this.version=Yr}get channels(){return Gr}init(e={},t=!1){
2
- /*!
3
- * Spyne 0.20.12
4
- * https://spynejs.org
5
- *
6
- * @license
7
- * Copyright 2017-2025, Frank Batista,
8
- * Relevant Context, LLC. All rights reserved.
9
- *
10
- * Licensed under the GNU Lesser General Public License v3.0 (the "License");
11
- * You may not use this file except in compliance with the License.
12
- * A copy of the License is located in the project root, or at:
13
- * https://www.gnu.org/licenses/lgpl-3.0.html
14
- *
15
- * This notice may not be removed or altered from any distribution.
16
- */
17
- if(!0===at.initialized)return t?"The Spyne Application has already been initialized!":void console.warn("The Spyne Application has already been initialized!");let n={scrollLock:!1,scrollLockX:31,scrollLockY:0,debug:!1,strict:!1,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=$e;e=at.initialize(n,e,Gr,t)}this.pluginsFn=at.getPluginsMethodObj(e.pluginMethods),this.getChannelActions=e=>Gr.getChannelActions(e),this.registerChannel=e=>Gr.registerStream(e),this.registerPlugin=e=>at.registerPlugin(e),this.registerDataChannel=e=>Gr.registerStream(e),this.listChannels=()=>Array.from(Gr.map.keys());let r=new mr({id:"spyne-null-views"});r.appendToDom(document.body),r.props.el.style.cssText="display:none; opacity:0; pointer-events:none;",Gr.init(),!0===at.config.debug&&(window.Spyne={version:Yr}),(e=>{if(ft)console.warn("sanitizeHTML is already configured. Reconfiguration is not allowed.");else{if(e.strict)if(window.trustedTypes){const e=window.trustedTypes.createPolicy("default",{createHTML:e=>xe.sanitize(e,{RETURN_TRUSTED_TYPE:!1})});_t=t=>e.createHTML(t)}else _t=e=>xe.sanitize(e);else _t=e=>e;ft=!0}})(at.config),Or(at.config)}static listChannels(){return Array.from(Gr.map.keys())}static getChannelActions(e){return Gr.getChannelActions(e)}static registerChannel(e){if(!1!==at.initialized)return Gr.registerStream(e);console.warn("Spyne has not been initialized")}};export{Ar as Channel,$r as ChannelFetch,Fr as ChannelFetchUtil,ut as ChannelPayload,ur as ChannelPayloadFilter,Wr as ChannelsMap,Tt as DomElement,mt as DomElementTemplate,zr as SpyneApp,at as SpyneAppProperties,jr as SpynePlugin,xr as SpyneTrait,mr as ViewStream,or as ViewStreamBroadcaster,er as ViewStreamElement,nr as ViewStreamPayload,fr as ViewStreamSelector,Ke as deepMerge,dt as safeClone,Dr as sanitizeData,Rr as sanitizeEventTarget};
18
- //# sourceMappingURL=spyne.esm.js.map
@@ -1,16 +0,0 @@
1
- /*!
2
- * Spyne 0.20.2
3
- * https://spynejs.org
4
- *
5
- * @license Copyright 2017-2021, Frank Batista, Relevant Context, LLC. All rights reserved.
6
- * Spyne is licensed under the GNU Lesser General Public License v3.0
7
- *
8
- * @author: Frank Batista,
9
- * @email: frbatista.nyc@gmail.com
10
- */
11
-
12
- /*!
13
- * spynejs 0.20.2
14
- * https://spynejs.org
15
- * (c) 2017-present Frank Batista
16
- */