spyne 0.22.4 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/spyne.esm.js +3 -3
- package/lib/spyne.esm.js.map +1 -1
- package/lib/spyne.umd.js +2 -2
- package/lib/spyne.umd.js.LICENSE.txt +2 -2
- package/package.json +1 -1
- package/src/spyne/channels/channel-fetch-class.js +2 -2
- package/src/spyne/spyne-app.js +2 -2
- package/src/spyne/utils/channel-fetch-util.js +5 -2
- package/src/spyne/utils/sanitize-html.js +68 -16
- package/src/spyne/utils/spyne-trait.js +5 -2
- package/src/spyne/views/dom-element-template.js +6 -4
- package/src/spyne/views/view-stream-broadcaster.js +4 -0
package/lib/spyne.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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 u}from"rxjs";import{compose as d,complement as h,isEmpty as E,head as p,values as N,isNil as _,allPass as f,reject as m,equals as T,keys as A,find as 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 ue,flip as de,propSatisfies as he,forEach as Ee,props as pe,omit as Ne,any as _e,curry as fe,where as me,F as Te,all as Ae,slice as 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=d(h(E),p,N),n=d(h(_),p,N);return f([t,n])(e)}static checkIfParamValueMatchesRegex(e,t){const n=m(T("routeName")),r=d(n,A),o=d(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),u=B(a,t),d=B("routePath",t);if(!0===(u&&l)){const e=t[a];B("routePath",e)&&s(e.routePath)}else!0===d&&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 d(r,n,t,O,D(N))(e)}static createQueryString(e){const t=m(_),n=this.checkIfObjIsNotEmptyOrNil,r=d(S("="),O,R),o=H(n,r,V(void 0)),s=D(o),i=b(h(E),w("?"));return d(i,S("&"),t,s)(e)}static checkPayloadForRegexOverrides(e,t,n="Value"){const r=d(e=>v(`${e}${n}`,t),p,A);return D(e=>{const t=r(e);return void 0!==t?g(d(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"),d(M(I,e),v("re")));return d(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=d(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=d(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=d(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=>d(A,F(U(!0,e))),i=d(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,u=!0===i&&!1===a,d={};return d[e]={same:s,changed:c,added:l,removed:u,previousExists:i,nextExists:a},d}),q,Q(A))([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,u=y(Object,l),d=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===u){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=d(c),o.href=r(o),t.push(o)}}h=s(e,l,h)}else h.title=d(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 d(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=d(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]=d(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=d(re,y(Array)),Ge=d(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}getHrefFromData(e={}){return Fe.convertParamsToRoute(e)}set enableCMSProxies(e=!0){et=Boolean(e)}setCMSProxyMethod(e){this.enableCMSProxies=!0,this.formatTemplateForProxyData=e}tempGetChannelsInstance(){}tempGetConfig(){}},ct=()=>({includes:()=>!0===at.initialized?at.listRegisteredChannels():["CHANNEL_ROUTE","CHANNEL_UI","CHANNEL_WINDOW","DISPATCHER"]});void 0!==d&&void 0!==t&&(d(y(String),K(["data","srcElement","vsid"])),d(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},ut=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)?d(z,R,ne)(e):ne(e)};class dt{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=dt.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);dt.validateAction(t,i,e)}a.clone=()=>oe([{payload:ut(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:()=>dt.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)?d(z,R,ne)(e):ne(e)}static deepFreeze(e){const t=d(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])||dt.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=d(h(E),p,N),n=d(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,this.template=mt.normalizeTripleBrackets(this.template),!0===this.isProxyData&&(!0===at.enableCMSProxies?this.template=at.formatTemplateForProxyData(this.template):console.warn("You need to be logged in to use the CMS Tools."));(()=>{!0===y(Array,t)&&(t={spyneData:t},this.template=this.template.replace("{{/}}","{{/spyneData}}"),this.template=this.template.replace("{{#}}","{{#spyneData}}"))})(),this.templateData=t,this.currentOuterLoopData=null;const 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=>e.replace(s,i),this.addParams.bind(this));this.finalArr=r.map(c)}static isPrimitiveTag(e){return/({{\.\*?}})/.test(e)}static normalizeTripleBrackets(e){return"string"!=typeof e||-1===e.indexOf("{{{")?e:e.replace(/\{\{\{([^{}]+?)\}\}\}/g,"{{$1}}")}static getNestedDataReducer(e={},t=""){return/(\.)/gm.test(String(t))?String(t).split(".").reduce((e,t)=>e[t]?e[t]:"string"==typeof e?e:"",e):e[t]??""}static getStringArray(e){const t=e.split(mt.findTmplLoopsRE()),n=/^([\\n\s\W]+)$/,r=t.filter((e,t)=>!(t>=2&&(t-2)%3==0));return m(e=>e.match(n),r)}static findTmplLoopsRE(){return/({{#([\w.]+)}}[\w\n\s\W]+?{{\/\2}})/gm}static parseTmplLoopsRE(){return/({{#([\w.]+)}})([\w\n\s\W]+?)({{\/\2}})/gm}static innerLoopRE(){return/({{#([\w.]+)}})([\w\n\s\W]+?)({{\/\2}})/gm}static swapParamsForTagsRE(){return/({{)(.*?)(}})/gm}static hasLoop(e){return mt.innerLoopRE().test(e)}removeThis(){void 0!==this&&(this.finalArr=void 0,this.templateData=void 0,this.template=void 0)}renderDocFrag(){let e=mt.replaceImgPath(this.finalArr.join(""));!0!==this.testMode&&(e=(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}processInnerLoop(e,t){const n=mt.innerLoopRE();return e.replace(n,(e,n,r,o)=>{!0===mt.hasLoop(o)&&(!0===at.debug&&!0!==this.testMode&&console.warn(`Spyne Warning: DomElementTemplate supports one level of nested array loops. A deeper nested loop was detected inside "{{#${r}}}". Consider restructuring via nested ViewStreams instead.`),o=o.replace(/{{[#/][\w.]+}}/g,""));const s=mt.getNestedDataReducer(t,r);if(!0===_(s)||E(s))return"";const i=Array.isArray(s)?s:[s],a=this.currentOuterLoopData;this.currentOuterLoopData=s;const c=i.map((e,t)=>this.substituteForItem(o,e,t)).join("");return this.currentOuterLoopData=a,c})}substituteForItem(e,t,n){if("string"==typeof t){if(mt.isPrimitiveTag(e)){const n=t.replace(/\$/g,"$$$$");return e.replace(mt.swapParamsForTagsRE(),n)}const r=this.buildStringItemContext(t,n);return this.substituteObject(e,r)}const r=this.buildItemContext(t,n);return this.substituteObject(e,r)}buildStringItemContext(e,t){const n={spyneLoopKey:e,loopIndex:t,loopNum:t+1};if(!0===this.isProxyData){const t=this.currentOuterLoopData;if(t&&"object"==typeof t){n.__cms__dataId=t.__cms__dataId||"";const r=`__cms__keyFor_${e}`;n.origKey=void 0!==t[r]?t[r]:""}else n.__cms__dataId="",n.origKey=""}return n}buildItemContext(e,t){const n=Object.assign({},e,{loopIndex:t,loopNum:t+1});return!0===this.isProxyData&&(n.__cms__dataId=e.__cms__dataId,n.spyneLoopKey=e,n.loopIndex=t,n.loopNum=t+1),n}substituteObject(e,t){const n=/(\.)/gm,r={loopIndex:t.loopIndex,loopNum:t.loopNum};return e.replace(mt.swapParamsForTagsRE(),(e,o,s)=>void 0!==r[s]?r[s]:!1===n.test(s)&&void 0!==t[s]?t[s]:this.getDataValFromPathStr(s,t))}parseTheTmplLoop(e,t,n,r){const o=r,s=mt.getNestedDataReducer(this.templateData,n);if(!0===_(s)||E(s))return"";const i=this.currentOuterLoopData;this.currentOuterLoopData=s;const a=Array.isArray(s)?s:[s],c=mt.hasLoop(o),l=a.map((e,t)=>{const n=c?this.processInnerLoop(o,e):o;return this.substituteForItem(n,e,t)}).join("");return this.currentOuterLoopData=i,l}}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?ue(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={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=a(0),i.throw=a(1),i.return=a(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)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 s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],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=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),i("next"),i("throw"),i("return",function(e){return function(t){return Promise.resolve(t).then(e,l)}}),r[Symbol.asyncIterator]=function(){return this},r;function i(e,t){o[e]&&(r[e]=function(t){return new Promise(function(n,r){s.push([e,t,n,r])>1||a(e,t)})},t&&(r[e]=t(r[e])))}function a(e,t){try{(n=o[e](t)).value instanceof Rt?Promise.resolve(n.value.v).then(c,l):u(s[0][2],n)}catch(e){u(s[0][3],e)}var n}function c(e){a("next",e)}function l(e){a("throw",e)}function u(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}}function 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 u=Lt(l),d=u.next();!d.done;d=u.next()){var h=d.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{d&&!d.done&&(r=u.return)&&r.call(u)}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 un(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 dn="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function hn(e){return Ct(null==e?void 0:e[dn])}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 un(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[dn](),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 un(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,u=0,d=!1,h=function(){!d||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,u++)).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(){d=!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 de(J)({$dir:["internal"]},ne(e))}static addDownInternalDir(e,t=["internal","down"]){return de(J)(ne(e),{$dir:t})}static addChildAndInternalDir(e,t=["child","down"]){return de(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"),u=c("internal"),d=c("parent"),h=e.pipe(zn(e=>void 0!==e&&void 0!==e.action)),E=e.pipe(zn(a),Dn(u)),p=e.pipe(zn(s),Dn(l)),N=e.pipe(zn(i),Dn(d)),_={parent:p,internal:E,child:N};return{raw$:h,toInternal$:E,toParent$:p,toChild$:N,completeAll:()=>{Ee(e=>{e.complete(),e.isStopped=!0},[h,E,p,N])},completeStream:(e=[])=>{const t=e=>{if(void 0!==_[e]){(t=_[e]).complete(),t.isStopped=!0}var t};void 0!==e&&e.length>=1&&e.forEach(t)}}}}class 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=ut(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)?d(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=d(re,y(Array)),ir=d(re,E),ar=f([y(String),ir]),cr=f([y(Array),ir]),lr=d(f([sr,y(Object)])),ur=d(f([ir,sr,y(Object)]));class dr{constructor(e,t={},n,r){lr(e)&&(e=v("selector",t=e),r=r||v("testMode",t));const o=[n,v("debugLabel",t)];n=d(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)?dr.filterSelector([e],n):void 0,c=cr(e)?dr.filterSelector(e,n):void 0,l=ur(i)?dr.filterData(i,n):void 0;let u=m(_,[a,c,l]);const h=E(u);return h&&(u=[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(u)}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 d(t,t=>{if(void 0===n)return t;const r={};return ue((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 dr.elIsDomElement(n)&&void 0===e&&(e=n),e},void 0),a=e=>e.isEqualNode(i),c=e=>{const t=Array.from(document.querySelectorAll(e));return D(a,t)};if(void 0!==t){const n=d(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=d(O,D(c))(e);return!0!==E(l)&&_e(T(!0),l)}static elIsDomElement(e){return y(String,e)&&(e=document.querySelector(e)),d(se(0),k(-1),v("nodeType"))(e)}static filterSelector(e,t){const n=m(E,e);return fe(dr.checkPayloadSelector)(n,t)}}function hr(){return!0===at.debug}function Er(e){return d(se(0),k(-1),v("nodeType"))(e)}function pr(e,t,n=!1){const r=_r(e,t,n);return 1===r.length?p(r):r}function Nr(e,t,n){const r=document.querySelector(e),o=d(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 _r(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){Nr(!0===r?"body":e,t,n)}return o}function fr(e,t,n){return _r(t,n).forEach(t=>{t.style.cssText=e}),this}function mr(e,t){function n(t){return mr(e,t)}return Nr(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(_r(e,t)).map(n),n.forEach=n=>Array.from(_r(e,t)).map(n),n.getNodeListArray=()=>_r(e,t),n.addClass=n=>(_r(e,t).forEach(e=>e.classList.add(n)),this),n.removeClass=n=>(_r(e,t).forEach(e=>{e.classList.remove(n)}),this),n.setClass=n=>(_r(e,t).forEach(e=>{const t=d(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)=>(_r(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(()=>{_r(e,t).forEach(e=>{try{e.classList.add(n)}catch(e){}})})},n.setActiveItem2=(n,r)=>{const o=_r(e,t),s="string"==typeof r?pr(e,r):r,i=e=>e.isEqualNode(s)?e.classList.add(n):e.classList.remove(n);return!0===Er(s)?o.forEach(i):!0===hr()&&console.warn(`Spyne Warning: The selector, ${r}, does not appear to be a valid item in setActiveItem: ${n}`),this},n.setActiveItem=(n,r)=>{const o=_r(e,t),s="string"==typeof r?pr(e,r):r;if(o.forEach(e=>e.classList.remove(n)),!0===Er(s)){const e=Array.from(o).find(e=>e===s);e?e.classList.add(n):!0===hr()&&console.warn(`Spyne Warning: The selector, ${r}, is valid but does not match any item in setActiveItem: ${n}`)}else!0===hr()&&console.warn(`Spyne Warning: The selector, ${r}, does not appear to be a valid item in setActiveItem: ${n}`);return this},Object.defineProperty(n,"el",{get:()=>pr(e,t,!0)}),Object.defineProperty(n,"els",{get:()=>_r(e,t)}),Object.defineProperty(n,"len",{get:()=>_r(e,t,!1).length}),Object.defineProperty(n,"exists",{get:()=>_r(e,t,!1).length>=1}),Object.defineProperty(n,"exist",{get:()=>_r(e,t,!1).length>=1}),Object.defineProperty(n,"nodeList",{get:()=>_r(e,t)}),Object.defineProperty(n,"arr",{get:()=>{const n=pr(e,t,!0);return void 0===n?[]:void 0===n.length?[n]:Array.from(n)}}),Object.defineProperty(n,"inline",{set:n=>fr(n,e,t),get:()=>n}),Object.defineProperty(n,"inlineCss",{set:n=>fr(n,e,t),get:()=>n}),n}class Tr{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=Tr.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=d(n,D(r),Ce(0,2),k([]));return d(n,D(o),k([]))(e)}static elIsDomElement(e){return y(String,e)&&(e=document.querySelector(e)),d(se(0),k(-1),v("nodeType"))(e)}updatePropsToMatchEl(){const e=d(ye,P(v("tagName"),V("")));this.props.tagName=e(this.props.el)}elAlreadyExistsFn(e){const t=d(se(0),k(-1),v("nodeType"));return he(f([e=>document.body.contains(e),t]),"el")(e)}checkIfElementAlreadyExists(){!0===this.props.elIsAlreadyRenderedBool?(this.updatePropsToMatchEl(),this.postRender()):null===this.props.el&&console.error(`Spyne Error: The defined element for this ViewStream instance, ${this.constructor.name}, appears to not exist.`)}loadAllMethods(){const e=fe(this.onChannelMethodCall.bind(this));this.addActionListeners().forEach(t=>{let[n,r,o]=t;y(String,o)&&(o=new dr({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:d(p,F(d(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===Tr.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===Tr.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===Tr.isValidNestedArr(t))console.warn(`Spyne Warning: The array returned from addActionsListeners in ${this.props.name}, '${JSON.stringify(t)}', does not appear to be properly formatted!`);else{d(Ee(e=>{const t=k("",e[1]);!1===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)&&Tr.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$=mr(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=d(o,v(e)),a={payload:r,action:n=n||i({CHANNEL_ROUTE:"CHANNEL_ROUTE_CHANGE_EVENT"})};try{if(a.srcElement=d(ee(["id","vsid","class","tagName"]),v("props"))(this),!0===this.checkIfChannelExists(e)){!1===/CHANNEL_LIFECYCLE/.test(n)&&Object.defineProperties(a,{payload:{get:()=>ut(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 dr(e,t)}isLocalEvent(e){const t=K(["srcElement","el"],e),n=K(["props","el"],this);return Tr.elIsDomElement(n)&&Tr.elIsDomElement(t)&&n.contains(t)}addMixins(){const e=ht();this.createId=e.createId}}class Ar{constructor(e){const t=String(e.props.name),n=`${t}_ROUTE_UPDATER`;return fe(Ar.createTemporaryViewStreamObj)({id:n,name:t})}static createTemporaryViewStreamObj(e,t){const{name:n,id:r}=e,o=t,s=new Tr({id:r,name:n,data:t});s.onRendered=()=>{s.sendInfoToChannel("CHANNEL_ROUTE",o)},s.afterBroadcastEvents=()=>{s.disposeViewStream()},s.appendToNull()}}class Cr{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 Ar(this),this.createChannelActionMethods(),this.streamsController=at.channelsMap;const r=this.getMainObserver();this.checkForPersistentDataMode=Cr.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 dt(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 yr extends Cr{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 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=d(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!==d(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=d(A,Ne(["routeName"]))(e),r=o[t];return C(e=>new RegExp(`^${e}$`).test(r),n)}})(a),u=y(Object,n),h=y(Array,n);if(s+=1,!0===u&&!1===h){const t=a[l];t?d(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=d(Re,j(i,[]),R)({routes:a});if(1===c.length){const t=c[0];e.payload[t]=""}return e}onViewStreamInfo(e){const t=e.action??this.channelActions.CHANNEL_ROUTE_CHANGE_EVENT;e?.srcElement?.el?.dataset&&(e.payload=function(e){const t={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}(e?.srcElement?.el?.dataset)??e.payload),yr.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=yr.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:u}=c;n=J(c.routeData,n);const{routeCount:d,isDeepLink:h,isHash:E,isHistory:p,isHidden:N,routeType:_}=this.getExtraPayloadParams(t);return{isDeepLink:h,routeCount:d,pathInnermost:l,paths:u,routeData: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}=yr.getParamsFromRouteStr(o,e,n),{routeCount:l,isDeepLink:u,isHash:d,routeType:h,isHidden:E}=this.getExtraPayloadParams(e,t);return{isDeepLink:u,routeCount:l,pathInnermost:i,paths:s,routeData:a,routeValue:c,isHash:d,isHidden:E,isHistory:t,routeType:h}}static getDataFromLocationStr(e="slash",t=this.routeConfigJson.isHash,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=yr.removeLastSlash(window.location.pathname)+n,window.history.pushState({routeCount:o},"",n)}else{const e=b(d(h(T("/")),p),w("/",I));window.history.pushState({routeCount:o},"",e(n))}}getWindowLocation(){return window.location.pathname}bindStaticMethods(){this.checkForEndRoute=yr.checkForEndRoute.bind(this),this.getIsDeepLinkBool=yr.getIsDeepLinkBool.bind(this),this.getDataFromLocationStr=yr.getDataFromLocationStr.bind(this),this.onIncomingDomEvent=yr.onIncomingDomEvent.bind(this),this.getDataFromString=yr.getDataFromString.bind(this),this.getParamsFromRouteStr=yr.getParamsFromRouteStr.bind(this),this.getLocationData=yr.getLocationData.bind(this),this.getRouteState=yr.getRouteState.bind(this),this.getDataFromParams=yr.getDataFromParams.bind(this),this.getRouteCount=yr.getRouteCount.bind(this),this.getExtraPayloadParams=yr.getExtraPayloadParams.bind(this),this.bindStaticMethodsWithConfigData()}bindStaticMethodsWithConfigData(){const e=He(3,yr.getRouteStrFromParams);this.getRouteStrFromParams=e(I,this.routeConfigJson,this.routeConfigJson.type)}}let gr,vr=!1,br=!1;const Ir={ALLOWED_TAGS:["a","b","i","em","strong","u","p","br","ul","dl","dt","dd","ol","li","hr","blockquote","pre","code","span","div","section","article","aside","header","footer","h1","h2","h3","h4","h5","h6","table","thead","tbody","tr","td","th","img","figure","figcaption","video","source","iframe","input","button","label","link"],ADD_TAGS:["iframe","input","button","link"],ALLOWED_ATTR:["href","src","alt","class","title","width","height","style","target","rel","controls","poster","type","rows","cols"],ALLOW_DATA_ATTR:!0,FORBID_ATTR:["onerror","onload","onclick","onmouseover","onfocus","onblur","onchange"],FORBID_TAGS:["script","object","embed","meta"],SAFE_URL_PATTERN:/^(https?:|mailto:|tel:|data:image\/)/i},Sr={FORBID_TAGS:["script","iframe","object","embed","form","input","button","link","meta"],FORBID_ATTR:["onerror","onload","onclick","onmouseover","onfocus","onblur","onchange"],ALLOW_DATA_ATTR:!1},Lr=()=>{try{const e=at?.mode||process?.env?.NODE_ENV;if("authoring"===e||"development"===e)return"richtext"}catch(e){}return"app"};function Or(e="app"){"development"===process?.env?.NODE_ENV&&(e="richtext");const t="richtext"===e?Ir:Sr;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)=>e))),r}}const Dr=(e={})=>{if(vr)return void console.warn("sanitizeData is already configured. Reconfiguration is not allowed.");const{strict:t=!1}=e,n=e=>{const t=Or(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};gr=(e,r={})=>{const{disableSanitize:o=!1,mode:s}=r,i=s||(br||t?"app":Lr());return o?e:n(i)(e)},Dr.sanitizeDataForce=(e,t)=>{const r=t||Lr();return n(r)(e)},vr=!0},Rr=(e,t={})=>{if(!vr)throw new Error("sanitizeData is not configured. Call sanitizeDataConfigure() first.");return gr(e,t)},Hr=(e,t)=>{if(!e)return;const n=Or(t||Lr()),r=/<(?:script|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 Vr extends Cr{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=Vr.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=d(Ve,P(n,t))(e),o="CHANNEL_UI";return void 0!==r?`${o}_${r}_EVENT`:o}static checkForEventMethods(e){const t=d(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,Vr.checkForEventMethods(e),e.action=this.getActionState(e);const t=e.action,{payload:n,srcElement:r}=e,o=e.event;Hr(o?.target),this.sendChannelPayload(t,n,r,o)}}class wr{constructor(){this.createDomObservableFromEvent=wr.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=wr.createMediaQuery(e);return!1!==o&&n.push(wr.createMediaQueryHandler(o,t)),n},t),n}}class Pr extends Cr{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(Pr.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 wr.createDomObservableFromEvent("wheel",Pr.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(Pr.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=Pr.getScrollData(),l=we(Pr.getScrollMapFn,[a,c,i,n,o]).bind(this);return wr.createDomObservableFromEvent("scroll",l,n,o).pipe(jn(r),(u=e=>0===e.scrollDistance,gt(function(e,t){var n=!1,r=0;e.subscribe(fn(t,function(e){return(n||(n=!u(e,r++)))&&t.next(e)}))})),Dn(e=>{const t=Pr.getScrollY(o);return e.payload.scrollDistanceAbs=Math.abs(this.currentScrollY-t),this.currentScrollY=t,e}));var u}createOrientationObservable(e){return wr.createDomObservableFromEvent("orientationchange",Pr.getOrientationMapFn.bind(this))}createResizeObservable(e){const t=e.debounceMSTimeForResize;return wr.createDomObservableFromEvent("resize",Pr.getResizeMapFn.bind(this)).pipe(jn(t))}getEventsFromConfig(e=this.domChannelConfig){const t=e.events;return D(e=>{const t=Pr.createCurriedGenericEvent(e);return wr.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=wr.createMediaQueryHandler.bind(this),this.createMergedObsFromObj=wr.createMergedObsFromObj.bind(this)}}class Ur extends Cr{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,void 0),0)}}class Mr extends Cr{constructor(e={}){super("CHANNEL_AI",e)}addRegisteredActions(){return["CHANNEL_AI_RENDERED_EVENT","CHANNEL_AI_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,void 0),0)}}class Wr extends Cr{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 xr=new Map;class Fr{constructor(){this.addMixins(),xr.set("DISPATCHER",new n),this.listRegisteredChannels=Fr.listRegisteredChannels.bind(this),this.getChannelsList=Fr.getChannelsList.bind(this)}get map(){return xr}static getChannelsList(){return Array.from(xr,(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: ${d(S(", "),D(v("key")))(t)}`;console.warn(e)}}init(){this.createMainStreams()}createMainStreams(){this.routeStream=new yr,xr.set("CHANNEL_ROUTE",this.routeStream),this.uiStream=new Vr,xr.set("CHANNEL_UI",this.uiStream),this.domStream=new Pr,xr.set("CHANNEL_WINDOW",this.domStream),this.viewStreamLifecycle=new Ur,xr.set("CHANNEL_LIFECYCLE",this.viewStreamLifecycle),this.aiStream=new Mr,xr.set("CHANNEL_AI",this.aiStream),this.routeStream.initializeStream(),this.domStream.initializeStream()}addKeyEvent(e){xr.get("UI").addKeyEvent(e)}registerStream(e){const t=e.channelName;if(xr.has(t)){if(d(Ue(["props","isRegistered"],!0))(xr.get(t)))return void console.warn(`Spyne Warning: The Channel, ${t}, has already been registered!`)}xr.set(t,e),e.initializeStream()}getChannelActions(e){return xr.get(e).addRegisteredActions()}getProxySubject(e,t=!1){const n=!0===t?"replaySubject":"subject";return xr.get(e)[n]}testStream(e){return void 0!==xr.get(e)}getStream(e){return!1===this.testStream(e)&&xr.set(e,new Wr(e)),xr.get(e)}addMixins(){}}class $r{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=d(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 kr{constructor(e,t,n,r){((e=!0)=>{br=!!e})(!0);this._mapFn=kr.setMapFn(e),this._url=kr.setUrl(e),this._responseType=kr.setResponseType(e),this._serverOptions=kr.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&&kr.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=u(window.fetch(o,s)).pipe(Jn(c),Kn(e=>u(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:Rr(n);return t(i,r)}})(r)),Qn());l.connect(),l.subscribe(t)}static setMapFn(e){return d(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"),d(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(kr.baseOptions(),t);return n=kr.updateMethodWhenBodyExists(n),n=kr.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 jr extends Cr{constructor(e,t={}){jr.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!d(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=d(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 kr(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 d(r,(e,t)=>te(e,t))(n,e)}get observer(){return this.observer$}}let Gr=at;class Yr{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=Yr.mergeDefaultConfig(n,this.defaultConfig()),this.props.parentEl=r||Yr.createParentEl(),this.props.config=n,void 0!==this.props.traits&&this.addTraits(this.props.traits)}register(e){Gr=e,this.props.pluginName=this.props.name,!1!==Gr.initialized?(this.onBeforeRegistered(),this.props.config=ne(this.props.config),Gr.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 Gr}static mergeDefaultConfig(e={},t=this.defaultConfig()){return Object.assign(t,e)}static getSpyneApp(e,t){!1===Gr.initialized?console.warn(`Spyne Warning: Unable to install plugin, ${e}! SpyneApp has not been initialized!`):Gr.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 zr=new Fr,Br="0.22.3";let Kr=new class{constructor(){this.version=Br}get channels(){return zr}init(e={},t=!1){
|
|
1
|
+
import{fromEventPattern as e,Observable as t,Subject as r,bindCallback as n,fromEvent as o,of as s,ReplaySubject as i,forkJoin as a,EMPTY as c,merge as l,from as u}from"rxjs";import{compose as d,complement as h,isEmpty as E,head as p,values as N,isNil as _,allPass as f,reject as m,equals as T,keys as A,find as 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 z,fromPairs as Y,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 re,not as ne,mergeAll as oe,lte as se,match as ie,without as ae,mapObjIndexed as ce,pipe as le,forEachObjIndexed as ue,flip as de,propSatisfies as he,forEach as Ee,props as pe,omit as Ne,any as _e,curry as fe,where as me,F as Te,all as Ae,slice as 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=d(h(E),p,N),r=d(h(_),p,N);return f([t,r])(e)}static checkIfParamValueMatchesRegex(e,t){const r=m(T("routeName")),n=d(r,A),o=d(C(t=>M(new RegExp(t),e)),n)(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,r=window.location){return v({slash:"pathname",query:"search",hash:"hash"}[!0===t?"hash":e],r).replace(/^(\/)?(#)?(\/)?(.*)$/,"$4")}static createRouteArrayFromParams(e,t,r="slash",n){const o=[],s=t=>{const r={},i=t.routeName;let a=void 0!==e[i]?e[i]:v(i,n);const c=typeof t[a];"string"===c?a=t[a]:"undefined"===c&&(t=this.checkIfParamValueMatchesRegex(a,t)),r[i]=a,this.checkIfObjIsNotEmptyOrNil(r)&&o.push(r);const l=y(Object,t),u=B(a,t),d=B("routePath",t);if(!0===(u&&l)){const e=t[a];B("routePath",e)&&s(e.routePath)}else!0===d&&void 0!==a&&s(t.routePath)};return s(t),o}static createSlashString(e){const t=m(_),r=b(h(_,I),S("/")),n=L(/^(\^*)(.*|^\$)(\$)$/,"$2");return d(n,r,t,O,D(N))(e)}static createQueryString(e){const t=m(_),r=this.checkIfObjIsNotEmptyOrNil,n=d(S("="),O,R),o=H(r,n,V(void 0)),s=D(o),i=b(h(E),w("?"));return d(i,S("&"),t,s)(e)}static checkPayloadForRegexOverrides(e,t,r="Value"){const n=d(e=>v(`${e}${r}`,t),p,A);return D(e=>{const t=n(e);return void 0!==t?g(d(p,A)(e),t,e):e},e)}static checkForRouteValWithMultipleVals(e){const t=e=>{const t=(t,r)=>(t[r]=(e=>{const t=e.match(/^[^|]*/);return t?"^$"===t[0]?"":t[0]:e})(e[r]),t);return"object"==typeof e&&(e=Object.keys(e).reduce(t,{})),e};return!0===Array.isArray(e)?e.map(t):e}static checkForRouteValsPartMatch(e,t={}){const r=(e,t)=>t.split("|").some(t=>((e,t)=>{const r=e.replace(/[-/\\^$+?.()|[\]{}]/g,"\\$&").replace(/\*/g,"[\\w\\d_-]*");return new RegExp(`^${r}$`).test(t)})(t,e))?e:t;return e.map(e=>{const n={...e};return Object.keys(n).forEach(e=>{Object.prototype.hasOwnProperty.call(n,e)&&t[e]&&(n[e]=r(t[e],n[e]))}),n})}static convertParamsToRoute(e,t=at.config.channels.ROUTE,r,n){const o=void 0!==r?r:t.type,s=t.isHash,i=t.routes.routePath,a=void 0!==n?n:this.getLocationStrByType(o,s),c=this.convertRouteToParams(a,t,o).routeData;let l=this.createRouteArrayFromParams(e,i,o,c);return l=Fe.checkPayloadForRegexOverrides(l,e),l=Fe.checkForRouteValWithMultipleVals(l),"query"===o?this.createQueryString(l):this.createSlashString(l)}static findIndexOfMatchedStringOrRegex(e,t){const r=t.includes(".+"),n=L(/^$/,"^$"),o=P(U(e,"str"),d(M(I,e),v("re")));return d(W(T(!0)),D(o),D(e=>{return{str:e,re:(t=e,r&&(t.startsWith("^")||(t="^"+t),t.endsWith("$")||(t+="$")),new RegExp(t))};var t}),D(n))(t)}static checkIfValueShouldMapToParam(e,t,r){const n=d(D(x),D(F(y(String))),R)(e),o=Fe.findIndexOfMatchedStringOrRegex(t,n);let s=t;if(o>=0){const t=n[o],r=$(e),i=d(p,k([]),v(t))(r);!0===/^([-$\w]*)$/.test(i)&&!0===y(String,i)&&(s=i)}return s}static createArrFromSlashStr(e){return e.replace(/^([/])?(.*)$/,"$2").split("/")}static convertSlashRouteStrToParamsObj(e,t,r){const n=t,o=this.createArrFromSlashStr(t),s=[],i=[];let a=e;j((e,t)=>{const n=this.checkIfValueShouldMapToParam(a,t,r);a=this.checkIfParamValueMatchesRegex(t,a);const o=P(E,_);void 0!==a&&(e=>e!==x(s))(a.routeName)&&!1===o(n)&&(s.push(a.routeName),i.push(n));const c=K([t,"routePath"],a),l=K(["routePath"],a);void 0!==c?a=c:void 0!==l&&(a=l)},0,o);const c=G(s,i),l=this.getLastArrVal(s);return{paths:s,pathInnermost:l,routeData:c,routeValue:n}}static getLastArrVal(e){return void 0!==x(t=e)?x(t):"";var t}static createDefaultParamFromEmptyStr(e,t){const r={};return r[e.routeName]=this.checkIfValueShouldMapToParam(e,t),r}static convertQueryStrToParams(e,t,r){const n=t,o=t.replace(/^([?])?(.*)$/,"$2"),s=d(D(z("=")),z("&"))(o);let i=Y(s),a=D(p,s);!0===E(t)&&(i=this.createDefaultParamFromEmptyStr(e,t,r),a=A(i));return{paths:a,pathInnermost:this.getLastArrVal(a),routeData:i,routeValue:n}}static convertRouteToParams(e,t,r){if(void 0===t)return{};const n=void 0!==r?r:t.type,o=k({},v("regexTokens",t)),s=t.routes.routePath;return"query"===n?this.convertQueryStrToParams(s,e):(e=e.replace(/\/$|$/,"/"),this.convertSlashRouteStrToParamsObj(s,e,o))}}class $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 r=(e,t)=>void 0!==t?ee(t,e):e;let n=r(e,t);return{pickValues:r,compare:(e={},t)=>{const o=r(e,t),s=e=>d(A,F(U(!0,e))),i=d(D(e=>{const t=v(e,n),r=v(e,o),s=T(t,r),i=void 0!==t,a=void 0!==r,c=!s,l=!1===i&&!0===a,u=!0===i&&!1===a,d={};return d[e]={same:s,changed:c,added:l,removed:u,previousExists:i,nextExists:a},d}),q,Q(A))([n,o]),a=Q(s("changed"),i),c=Q(s("added"),i),l=Q(s("removed"),i);return n=o,{pathsAdded:c,pathsRemoved:l,pathsChanged:a}},getComparer:()=>n}}static getRouteArrData(e,t){const r=F(X(I,e),t);return{paths:r,pathInnermost:$e.getLastArrVal(r)}}static flattenConfigObject(e){const t=e=>Q(([e,r])=>"object"!=typeof r||null===r||Array.isArray(r)?[[e,r]]:D(([t,r])=>[`${e}.${t}`,r],t(r)),R(e));return N(Y(t(e)))}static addRouteDatasets(e){const{type:t,isHash:r}=e,n=n=>{const o="query"===t?"":!0===r?"#":"/",s=Fe.convertParamsToRoute(n,e);return o+s.replace(/^(.*\/)([\w-]*\/?)(.*)$/gm,"$1$2")},o=/^([A-Za-z0-9_-])+$/m,s=(e=[],t,r={})=>{let{routeName:i}=t;return R(t).reduce((t,a)=>{const[c,l]=a,u=y(Object,l),d=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=re(r);if(h[i]=String(c).replace(/([^A-Za-z0-9-_])/g,""),!0===u){if(1===A(h).length){const e=K(["routePath","routeName"],l);if(e){const o=re(h);o[e]="",o.navLevel=A(r).length,o.title=d(c),o.href=n(o),t.push(o)}}h=s(e,l,h)}else h.title=d(c),h.href=n(h);return h.navLevel=A(r).length,t.push(h),t},[])},i=s([],e.routes);let a=O(i);a=function e(t){return t.map(t=>{for(const r in t)void 0===r||"undefined"===r||void 0===t[r]?delete t[r]:t[r]&&"object"==typeof t[r]&&!Array.isArray(t[r])&&(t[r]=e([t[r]])[0]);return t})}(a);return{routeDatasetsArr:a,routeNamesArr:(e=>{const t=m(X(I,["title","href","navLevel","undefined"]));return d(q,t,O,D(A))(e)})(a)}}static conformRouteObject(e={},t=!1){const r=K(["channels","ROUTE"],e);let{add404s:n}=void 0!==r?r:e;n=n||t;const o=e=>{const t=e[1],r=y(Array,t);return""===t?e[1]="^$":r&&(e[1]=t.join("|")),e},s=d(Y,D(e=>{const[t,r]=e,i=n?{404:".+"}:{},a=y(Object,r),c=y(Array,r),l="routePath"===t;return!0===a&&!1===c&&(e[1]=s(e[1]),l&&(e[1]=d(te(i),Y,D(o),R)(e[1]))),e}),R);if(void 0!==r){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=d(ne,y(Array)),Ge=d(f([je,y(Object)]));function ze(e){return e&&"object"==typeof e&&"[object RegExp]"!==Object.prototype.toString.call(e)&&"[object Date]"!==Object.prototype.toString.call(e)}function Ye(e,t){return t&&!0===t.clone&&ze(e)?Ke((r=e,Array.isArray(r)?[]:{}),e,t):e;var r}function Be(e,t,r){const n=e.slice();return t.forEach(function(t,o){void 0===n[o]?n[o]=Ye(t,r):ze(t)?n[o]=Ke(e[o],t,r):-1===e.indexOf(t)&&n.push(Ye(t,r))}),n}function Ke(e,t,r){const n=Array.isArray(t),o=(r||{arrayMerge:Be}).arrayMerge||Be;return n?Array.isArray(e)?o(e,t,r):Ye(t,r):function(e,t,r){const n={};return ze(e)&&Object.keys(e).forEach(function(t){n[t]=Ye(e[t],r)}),Object.keys(t).forEach(function(o){ze(t[o])&&e[o]?n[o]=Ke(e[o],t[o],r):n[o]=Ye(t[o],r)}),n}(e,t,r)}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,r){return Ke(e,r,t)})};let Ze=!0,et=!1;const tt=[];let rt,nt;const ot=[],st=new Map;const it=new class{constructor(){ke.foo=()=>console.log("used for testing purposes.")}addMethod(e,t,r=!1){if(!0===Object.prototype.hasOwnProperty.call(ke,e)){const t=`Spyne Warning: the method name, ${e}, already exists.`;if(r)return t;console.warn(t)}else ke[e]=t}addMethods(e={},t=!1){let r;if(!1===Ge(e))return r=`Spyne Warning: the pluginMethods property, ${JSON.stringify(e)} needs to be an object.`,t?r:void console.warn(r);return A(e).map(n=>{const o=v(n,e);if("function"==typeof o)this.addMethod(n,o,t);else{if(r=`the value for ${n} is not a valid function.`,t)return r;console.warn(r)}}).join(",")}checkIfMethodExists(e){}get pluginMethodsObj(){return 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={},r,n){return Qe=r,qe=Ke(e,t),qe.channels&&qe.channels.ROUTE&&(qe=n.conformRouteObject(qe)),nt=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),r=Qe.getProxySubject.bind(Qe);Xe={getStream:e,testStream:t,getProxySubject:r}}setProp(e,t,r=!1){return r?(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 r=qe.channels[e];if(void 0!==r)return r;console.warn(`Spyne warning: Spyne configuration for channel, ${e} is empty!`)}registerChannel(){}addPluginConfig(e,t={}){void 0===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 nt}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"),rt}set linksData(e){console.warn("set links data in SpyneAppProperties is deprecated, use navLinks")}get navLinks(){return rt}set navLinks(e){rt=e}get enableCMSProxies(){return et}getHrefFromData(e={}){return Fe.convertParamsToRoute(e)}set enableCMSProxies(e=!0){et=Boolean(e)}setCMSProxyMethod(e){this.enableCMSProxies=!0,this.formatTemplateForProxyData=e}tempGetChannelsInstance(){}tempGetConfig(){}},ct=()=>({includes:()=>!0===at.initialized?at.listRegisteredChannels():["CHANNEL_ROUTE","CHANNEL_UI","CHANNEL_WINDOW","DISPATCHER"]});void 0!==d&&void 0!==t&&(d(y(String),K(["data","srcElement","vsid"])),d(y(String),K(["data","srcElement","id"])));const lt=(e,t)=>{const{__proxy__proxyName:r}=e;void 0===r&&console.error("object is not proxy object ",e);const n=(r,n)=>{const o=K(n,e),{__proxy__isProxy:s,__proxy__props:i}=o;return s?t(r,i):r},o=n(re(e),[]),s=(e,t)=>{const r=t||[];Object.entries(e).forEach(([t,o])=>{const i=(e=>{let t=typeof e;return["number","boolean","string"].includes(t)?t="primitive":"object"===t&&(Array.isArray(e)?t="array":null===e&&(t="undefined")),t})(o),a=[...r];a.push(t),"object"!==i&&"array"!==i||(e[t]=n(o,a),s(o,a))})};return s(o),o},ut=function(e){const{__proxy__proxyName:t}=e;if(void 0!==t){const r=at.getProxyReviver(t);if("function"==typeof r)return lt(e,r)}const r=y(Array),n=y(Object);var o;return!1===r(o=e)&&!0===n(o)?d(Y,R,re)(e):re(e)};class dt{constructor(e,t,r,n,o,s){const i=e;s&&console.time(s);const a={channelName:e,action:t,srcElement:n,event:o},c=dt.deepFreeze(r);if(a.payload=c,!0===at.debug){if(Object.prototype.hasOwnProperty.call(r,"payload")){const e=JSON.stringify(r);console.warn(`Spyne Warning: the following payload contains a nested payload property which may create conflicts: Action: ${t}, ${e}`)}const e=at.getChannelActions(i);dt.validateAction(t,i,e)}a.clone=()=>oe([{payload:ut(a.payload)},a.payload,{channel:re(i)},{event:re(o)},{srcElement:n},re(a.srcElement),{action:re(a.action)}]);const l={$dir:{get:()=>a._dir,set:e=>(a._dir=e,e)}};return"CHANNEL_ROUTE"===i&&(l.location={get:()=>dt.getLocationData()}),a._dir=void 0,Object.defineProperties(a,l),s&&console.timeEnd(s),a}static validateAction(e,t,r){const n=X(e,r);return!1===n&&!0===at.initialized&&console.warn(`warning: Action: '${e}' is not registered within the ${t} channel!`),n}static getLocationData(){return Z(["href","origin","protocol","host","hostname","port","pathname","search","hash"],window.location)}static getStreamItem(){}static deepClone(e){const t=y(Array),r=y(Object);var n;return!1===t(n=e)&&!0===r(n)?d(Y,R,re)(e):re(e)}static deepFreeze(e){const t=d(se(0),k(-1),v("nodeType"));try{Object.freeze(e),Object.getOwnPropertyNames(e).forEach(function(r){!Object.prototype.hasOwnProperty.call(e,r)||!1!==t(e[r])||null===e[r]||"object"!=typeof e[r]&&"function"!=typeof e[r]||Object.isFrozen(e[r])||dt.deepFreeze(e[r])})}catch(t){return e}return e}static getMouseEventKeys(){return["altKey","bubbles","cancelBubble","cancelable","clientX","clientY","composed","ctrlKey","currentTarget","defaultPrevented","detail","eventPhase","fromElement","isTrusted","layerX","layerY","metaKey","movementX","movementY","offsetX","offsetY","pageX","pageY","path","relatedTarget","returnValue","screenX","screenY","shiftKey","sourceCapabilities","srcElement","target","timeStamp","toElement","type","view","which","x","y"]}}function 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=d(h(E),p,N),r=d(h(_),p,N);return f([t,r])(e)};let _t,ft=!1;class mt{constructor(e,t={},r={}){if(this.template=this.formatTemplate(e),this.isProxyData=!0===t.__cms__isProxy,this.testMode=r?.testMode,this.template=mt.normalizeTripleBrackets(this.template),!0===this.isProxyData){const e=!0===at.enableCMSProxies?at.formatTemplateForProxyData:mt.formatTemplateForProxyData;"function"==typeof e&&(this.template=e(this.template))}(()=>{!0===y(Array,t)&&(t={spyneData:t},this.template=this.template.replace("{{/}}","{{/spyneData}}"),this.template=this.template.replace("{{#}}","{{#spyneData}}"))})(),this.templateData=t,this.currentOuterLoopData=null;const n=mt.getStringArray(this.template);let o=this.template.match(mt.findTmplLoopsRE());o=null===o?[]:o;const s=mt.parseTmplLoopsRE(),i=this.parseTheTmplLoop.bind(this),a=X(I,o),c=H(a,e=>e.replace(s,i),this.addParams.bind(this));this.finalArr=n.map(c)}static isPrimitiveTag(e){return/({{\.\*?}})/.test(e)}static normalizeTripleBrackets(e){return"string"!=typeof e||-1===e.indexOf("{{{")?e:e.replace(/\{\{\{([^{}]+?)\}\}\}/g,"{{$1}}")}static getNestedDataReducer(e={},t=""){return/(\.)/gm.test(String(t))?String(t).split(".").reduce((e,t)=>e[t]?e[t]:"string"==typeof e?e:"",e):e[t]??""}static getStringArray(e){const t=e.split(mt.findTmplLoopsRE()),r=/^([\\n\s\W]+)$/,n=t.filter((e,t)=>!(t>=2&&(t-2)%3==0));return m(e=>e.match(r),n)}static findTmplLoopsRE(){return/({{#([\w.]+)}}[\w\n\s\W]+?{{\/\2}})/gm}static parseTmplLoopsRE(){return/({{#([\w.]+)}})([\w\n\s\W]+?)({{\/\2}})/gm}static innerLoopRE(){return/({{#([\w.]+)}})([\w\n\s\W]+?)({{\/\2}})/gm}static swapParamsForTagsRE(){return/({{)(.*?)(}})/gm}static hasLoop(e){return mt.innerLoopRE().test(e)}removeThis(){void 0!==this&&(this.finalArr=void 0,this.templateData=void 0,this.template=void 0)}renderDocFrag(){let e=mt.replaceImgPath(this.finalArr.join(""));!0!==this.testMode&&(e=(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 r=String(e).split(".");return K(r,t)||""}addParams(e){return e.replace(mt.swapParamsForTagsRE(),(e,t,r,n)=>mt.getNestedDataReducer(this.templateData,r))}static replaceImgPath(e){const{IMG_PATH:t}=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}processInnerLoop(e,t){const r=mt.innerLoopRE();return e.replace(r,(e,r,n,o)=>{!0===mt.hasLoop(o)&&(!0===at.debug&&!0!==this.testMode&&console.warn(`Spyne Warning: DomElementTemplate supports one level of nested array loops. A deeper nested loop was detected inside "{{#${n}}}". Consider restructuring via nested ViewStreams instead.`),o=o.replace(/{{[#/][\w.]+}}/g,""));const s=mt.getNestedDataReducer(t,n);if(!0===_(s)||E(s))return"";const i=Array.isArray(s)?s:[s],a=this.currentOuterLoopData;this.currentOuterLoopData=s;const c=i.map((e,t)=>this.substituteForItem(o,e,t)).join("");return this.currentOuterLoopData=a,c})}substituteForItem(e,t,r){if("string"==typeof t){if(mt.isPrimitiveTag(e)){const r=t.replace(/\$/g,"$$$$");return e.replace(mt.swapParamsForTagsRE(),r)}const n=this.buildStringItemContext(t,r);return this.substituteObject(e,n)}const n=this.buildItemContext(t,r);return this.substituteObject(e,n)}buildStringItemContext(e,t){const r={spyneLoopKey:e,loopIndex:t,loopNum:t+1};if(!0===this.isProxyData){const t=this.currentOuterLoopData;if(t&&"object"==typeof t){r.__cms__dataId=t.__cms__dataId||"";const n=`__cms__keyFor_${e}`;r.origKey=void 0!==t[n]?t[n]:""}else r.__cms__dataId="",r.origKey=""}return r}buildItemContext(e,t){const r=Object.assign({},e,{loopIndex:t,loopNum:t+1});return!0===this.isProxyData&&(r.__cms__dataId=e.__cms__dataId,r.spyneLoopKey=e,r.loopIndex=t,r.loopNum=t+1),r}substituteObject(e,t){const r=/(\.)/gm,n={loopIndex:t.loopIndex,loopNum:t.loopNum};return e.replace(mt.swapParamsForTagsRE(),(e,o,s)=>void 0!==n[s]?n[s]:!1===r.test(s)&&void 0!==t[s]?t[s]:this.getDataValFromPathStr(s,t))}parseTheTmplLoop(e,t,r,n){const o=n,s=mt.getNestedDataReducer(this.templateData,r);if(!0===_(s)||E(s))return"";const i=this.currentOuterLoopData;this.currentOuterLoopData=s;const a=Array.isArray(s)?s:[s],c=mt.hasLoop(o),l=a.map((e,t)=>{const r=c?this.processInnerLoop(o,e):o;return this.substituteForItem(r,e,t)}).join("");return this.currentOuterLoopData=i,l}}class Tt{constructor(e={},t=!1){var r,n;e.tagName=(r="div",n=e.tagName,k(r)(n)),e.attributes=void 0!==e.attributes?e.attributes:this.getDomAttributes(e),e.attrs=this.updateAttrs(e.attributes),e.fragment=document.createDocumentFragment(),this.testMode=t,this.props=e,this.addMixins()}setProp(e,t){this.props[e]=t}getProp(e){return this.props[e]}get el(){return this.props.el}setElAttrs(e,t){return this.getProp("attrs").forEach((t,r)=>{const n=(t,r)=>{e.dataset[r]=t};"dataset"===r?ue(n,t):e.setAttribute(r,t)}),e}updateAttrs(e,t){const r=void 0!==t?t:new Map;return ce((e,t)=>r.set(t,e),e),r}addTemplate(e){const t=this.getProp("template");return void 0!==t?(t=>{let r=this.getProp("data");r=y(Object,r)?r:{};const n=new mt(t,r,{testMode:this?.testMode}).renderDocFrag();return y(String,n)?e.innerHTML=n:e.appendChild(n),e})(t):e}createElement(e="div"){return document.createElement(e)}addContent(e){const t=this.getProp("data");if(!0===y(String,t)){const r=document.createTextNode(t);e.appendChild(r)}return e}execute(){const e=le(this.createElement.bind(this),this.setElAttrs.bind(this),this.addTemplate.bind(this),this.addContent.bind(this))(this.getProp("tagName"));this.props.el=e}render(){return this.execute(),this.props.template=void 0,this.props.data=void 0,this.props.attributes=void 0,this.getProp("el")}renderToHTMLString(){return this.execute(),this.props.template=void 0,this.props.data=void 0,this.props.attributes=void 0,this.getProp("el").outerHTML}returnIfDefined(e,t){if(void 0!==t){const r=void 0===t;e[t]=!1===r?t: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,r="ease",n=!1)=>`${!0===n?"opacity:0;":""}transition: opacity ${t}s ${r}; 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 r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},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 r(){this.constructor=e}vt(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function It(e,t,r,n){return new(r||(r=Promise))(function(o,s){function i(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(i,a)}c((n=n.apply(e,t||[])).next())})}function St(e,t){var r,n,o,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=a(0),i.throw=a(1),i.return=a(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function Lt(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ot(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,s=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=s.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return i}function Dt(e,t,r){if(r||2===arguments.length)for(var n,o=0,s=t.length;o<s;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}function Rt(e){return this instanceof Rt?(this.v=e,this):new Rt(e)}function Ht(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,o=r.apply(e,t||[]),s=[];return n=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),i("next"),i("throw"),i("return",function(e){return function(t){return Promise.resolve(t).then(e,l)}}),n[Symbol.asyncIterator]=function(){return this},n;function i(e,t){o[e]&&(n[e]=function(t){return new Promise(function(r,n){s.push([e,t,r,n])>1||a(e,t)})},t&&(n[e]=t(n[e])))}function a(e,t){try{(r=o[e](t)).value instanceof Rt?Promise.resolve(r.value.v).then(c,l):u(s[0][2],r)}catch(e){u(s[0][3],e)}var r}function c(e){a("next",e)}function l(e){a("throw",e)}function u(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}}function Vt(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=Lt(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise(function(n,o){(function(e,t,r,n){Promise.resolve(n).then(function(t){e({value:t,done:r})},t)})(n,o,(t=e[r](t)).done,t.value)})}}}"function"==typeof SuppressedError&&SuppressedError;var 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 r=e.indexOf(t);0<=r&&e.splice(r,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,r,n,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var i=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 u=Lt(l),d=u.next();!d.done;d=u.next()){var h=d.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){r={error:e}}finally{try{d&&!d.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}}if(o)throw new Mt(o)}},e.prototype.add=function(t){var r;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!==(r=this._finalizers)&&void 0!==r?r:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&Wt(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&Wt(r,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 r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=Gt.delegate;return(null==o?void 0:o.setTimeout)?o.setTimeout.apply(o,Dt([e,t],Ot(r))):setTimeout.apply(void 0,Dt([e,t],Ot(r)))},clearTimeout:function(e){var t=Gt.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function zt(e){Gt.setTimeout(function(){throw e})}function Yt(){}var Bt=null;function Kt(e){if(jt.useDeprecatedSynchronousErrorHandling){var t=!Bt;if(t&&(Bt={errorThrown:!1,error:null}),e(),t){var r=Bt,n=r.errorThrown,o=r.error;if(Bt=null,n)throw o}}else e()}var qt=function(e){function t(t){var r=e.call(this)||this;return r.isStopped=!1,t?(r.destination=t,$t(t)&&t.add(r)):r.destination=tr,r}return bt(t,e),t.create=function(e,t,r){return new Zt(e,t,r)},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){er(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){er(e)}else er(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){er(e)}},e}(),Zt=function(e){function t(t,r,n){var o,s,i=e.call(this)||this;Ct(t)||!t?o={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n: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 er(e){zt(e)}var tr={closed:!0,next:Yt,error:function(e){throw e},complete:Yt},rr="function"==typeof Symbol&&Symbol.observable||"@@observable";function nr(e){return e}function or(e){return 0===e.length?nr:1===e.length?e[0]:function(t){return e.reduce(function(e,t){return t(e)},t)}}var sr=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var n,o=this,s=(n=e)&&n instanceof qt||function(e){return e&&Ct(e.next)&&Ct(e.error)&&Ct(e.complete)}(n)&&$t(n)?e:new Zt(e,t,r);return Kt(function(){var e=o,t=e.operator,r=e.source;s.add(t?t.call(s,r):r?o._subscribe(s):o._trySubscribe(s))}),s},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=ir(t))(function(t,n){var o=new Zt({next:function(t){try{e(t)}catch(e){n(e),o.unsubscribe()}},error:n,complete:t});r.subscribe(o)})},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[rr]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return or(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=ir(e))(function(e,r){var n;t.subscribe(function(e){return n=e},function(e){return r(e)},function(){return e(n)})})},e.create=function(t){return new e(t)},e}();function ir(e){var t;return null!==(t=null!=e?e:jt.Promise)&&void 0!==t?t:Promise}function ar(e){return Ct(e[rr])}function cr(e){return Symbol.asyncIterator&&Ct(null==e?void 0:e[Symbol.asyncIterator])}function lr(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 ur="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function dr(e){return Ct(null==e?void 0:e[ur])}function hr(e){return Ht(this,arguments,function(){var t,r,n;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 r=o.sent(),n=r.value,r.done?[4,Rt(void 0)]:[3,5];case 4:return[2,o.sent()];case 5:return[4,Rt(n)];case 6:return[4,o.sent()];case 7:return o.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function Er(e){return Ct(null==e?void 0:e.getReader)}function pr(e){if(e instanceof sr)return e;if(null!=e){if(ar(e))return o=e,new sr(function(e){var t=o[rr]();if(Ct(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")});if(wt(e))return n=e,new sr(function(e){for(var t=0;t<n.length&&!e.closed;t++)e.next(n[t]);e.complete()});if(Pt(e))return r=e,new sr(function(e){r.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,zt)});if(cr(e))return Nr(e);if(dr(e))return t=e,new sr(function(e){var r,n;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){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}e.complete()});if(Er(e))return Nr(hr(e))}var t,r,n,o;throw lr(e)}function Nr(e){return new sr(function(t){(function(e,t){var r,n,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]),r=Vt(e),c.label=1;case 1:return[4,r.next()];case 2:if((n=c.sent()).done)return[3,4];if(i=n.value,t.next(i),t.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),o={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),n&&!n.done&&(s=r.return)?[4,s.call(r)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})})(e,t).catch(function(e){return t.error(e)})})}function _r(e,t,r,n,o){return new fr(e,t,r,n,o)}var fr=function(e){function t(t,r,n,o,s,i){var a=e.call(this,t)||this;return a.onFinalize=s,a.shouldUnsubscribe=i,a._next=r?function(e){try{r(e)}catch(e){t.error(e)}}:e.prototype._next,a._error=o?function(e){try{o(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,a._complete=n?function(){try{n()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,a}return bt(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(qt),mr=function(e){function t(t,r){return e.call(this)||this}return bt(t,e),t.prototype.schedule=function(e,t){return this},t}(xt),Tr={setInterval:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=Tr.delegate;return(null==o?void 0:o.setInterval)?o.setInterval.apply(o,Dt([e,t],Ot(r))):setInterval.apply(void 0,Dt([e,t],Ot(r)))},clearInterval:function(e){var t=Tr.delegate;return((null==t?void 0:t.clearInterval)||clearInterval)(e)},delegate:void 0},Ar=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n.pending=!1,n}return bt(t,e),t.prototype.schedule=function(e,t){var r;if(void 0===t&&(t=0),this.closed)return this;this.state=e;var n=this.id,o=this.scheduler;return null!=n&&(this.id=this.recycleAsyncId(o,n,t)),this.pending=!0,this.delay=t,this.id=null!==(r=this.id)&&void 0!==r?r:this.requestAsyncId(o,this.id,t),this},t.prototype.requestAsyncId=function(e,t,r){return void 0===r&&(r=0),Tr.setInterval(e.flush.bind(e,this),r)},t.prototype.recycleAsyncId=function(e,t,r){if(void 0===r&&(r=0),null!=r&&this.delay===r&&!1===this.pending)return t;null!=t&&Tr.clearInterval(t)},t.prototype.execute=function(e,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(e,t);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,t){var r,n=!1;try{this.work(e)}catch(e){n=!0,r=e||new Error("Scheduled action threw falsy error")}if(n)return this.unsubscribe(),r},t.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,r=this.scheduler,n=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,Wt(n,this),null!=t&&(this.id=this.recycleAsyncId(r,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(mr),Cr={now:function(){return(Cr.delegate||Date).now()},delegate:void 0},yr=function(){function e(t,r){void 0===r&&(r=e.now),this.schedulerActionCtor=t,this.now=r}return e.prototype.schedule=function(e,t,r){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(r,t)},e.now=Cr.now,e}(),gr=new(function(e){function t(t,r){void 0===r&&(r=yr.now);var n=e.call(this,t,r)||this;return n.actions=[],n._active=!1,n}return bt(t,e),t.prototype.flush=function(e){var t=this.actions;if(this._active)t.push(e);else{var r;this._active=!0;do{if(r=e.execute(e.state,e.delay))break}while(e=t.shift());if(this._active=!1,r){for(;e=t.shift();)e.unsubscribe();throw r}}},t}(yr))(Ar);function vr(e,t,r,n,o){void 0===n&&(n=0),void 0===o&&(o=!1);var s=t.schedule(function(){r(),o?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(s),!o)return s}function br(e,t){return void 0===t&&(t=0),gt(function(r,n){r.subscribe(_r(n,function(r){return vr(n,e,function(){return n.next(r)},t)},function(){return vr(n,e,function(){return n.complete()},t)},function(r){return vr(n,e,function(){return n.error(r)},t)}))})}function Ir(e,t){return void 0===t&&(t=0),gt(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function Sr(e,t){if(!e)throw new Error("Iterable cannot be null");return new sr(function(r){vr(r,t,function(){var n=e[Symbol.asyncIterator]();vr(r,t,function(){n.next().then(function(e){e.done?r.complete():r.next(e.value)})},0,!0)})})}function Lr(e,t){if(null!=e){if(ar(e))return function(e,t){return pr(e).pipe(Ir(t),br(t))}(e,t);if(wt(e))return function(e,t){return new sr(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}(e,t);if(Pt(e))return function(e,t){return pr(e).pipe(Ir(t),br(t))}(e,t);if(cr(e))return Sr(e,t);if(dr(e))return function(e,t){return new sr(function(r){var n;return vr(r,t,function(){n=e[ur](),vr(r,t,function(){var e,t,o;try{t=(e=n.next()).value,o=e.done}catch(e){return void r.error(e)}o?r.complete():r.next(t)},0,!0)}),function(){return Ct(null==n?void 0:n.return)&&n.return()}})}(e,t);if(Er(e))return function(e,t){return Sr(hr(e),t)}(e,t)}throw lr(e)}function Or(e,t){return gt(function(r,n){var o=0;r.subscribe(_r(n,function(r){n.next(e.call(t,r,o++))}))})}var Dr=Array.isArray;function Rr(e){return Or(function(t){return function(e,t){return Dr(t)?e.apply(void 0,Dt([],Ot(t))):e(t)}(e,t)})}function Hr(e,t,r){return void 0===r&&(r=nr),function(n){Vr(t,function(){for(var o=e.length,s=new Array(o),i=o,a=o,c=function(o){Vr(t,function(){var c=function(e,t){return t?Lr(e,t):pr(e)}(e[o],t),l=!1;c.subscribe(_r(n,function(e){s[o]=e,l||(l=!0,a--),a||n.next(r(s.slice()))},function(){--i||n.complete()}))},n)},l=0;l<o;l++)c(l)},n)}}function Vr(e,t,r){e?vr(r,e,t):t()}function wr(e,t,r){return void 0===r&&(r=1/0),Ct(t)?wr(function(r,n){return Or(function(e,o){return t(r,e,n,o)})(pr(e(r,n)))},r):("number"==typeof t&&(r=t),gt(function(t,n){return function(e,t,r,n,o,s,i,a){var c=[],l=0,u=0,d=!1,h=function(){!d||c.length||l||t.complete()},E=function(e){return l<n?p(e):c.push(e)},p=function(e){s&&t.next(e),l++;var a=!1;pr(r(e,u++)).subscribe(_r(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?vr(t,i,function(){return p(e)}):p(e)};c.length&&l<n;)e();h()}catch(e){t.error(e)}}))};return e.subscribe(_r(t,E,function(){d=!0,h()})),function(){null==a||a()}}(t,n,e,r)}))}var Pr=Array.isArray;function Ur(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=function(e){return Ct((t=e)[t.length-1])?e.pop():void 0;var t}(e);return r?function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return or(e)}(Ur.apply(void 0,Dt([],Ot(e))),Rr(r)):gt(function(t,r){Hr(Dt([t],Ot(function(e){return 1===e.length&&Pr(e[0])?e[0]:e}(e))))(r)})}var Mr=Ut(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Wr=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 xr(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new Mr},t.prototype.next=function(e){var t=this;Kt(function(){var r,n;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){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}})},t.prototype.error=function(e){var t=this;Kt(function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var r=t.observers;r.length;)r.shift().error(e)}})},t.prototype.complete=function(){var e=this;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,r=this,n=r.hasError,o=r.isStopped,s=r.observers;return n||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,r=t.hasError,n=t.thrownError,o=t.isStopped;r?e.error(n):o&&e.complete()},t.prototype.asObservable=function(){var e=new sr;return e.source=this,e},t.create=function(e,t){return new xr(e,t)},t}(sr),xr=function(e){function t(t,r){var n=e.call(this)||this;return n.destination=t,n.source=r,n}return bt(t,e),t.prototype.next=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===r||r.call(t,e)},t.prototype.error=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===r||r.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,r;return null!==(r=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==r?r:Ft},t}(Wr);var Fr={connector:function(){return new Wr}};function $r(e,t){void 0===t&&(t=Fr);var r=t.connector;return gt(function(t,n){var o,s=r();pr(e((o=s,new sr(function(e){return o.subscribe(e)})))).subscribe(n),n.add(t.subscribe(s))})}function kr(e,t){return void 0===t&&(t=gr),gt(function(r,n){var o=null,s=null,i=null,a=function(){if(o){o.unsubscribe(),o=null;var e=s;s=null,n.next(e)}};function c(){var r=i+e,s=t.now();if(s<r)return o=this.schedule(void 0,r-s),void n.add(o);a()}r.subscribe(_r(n,function(r){s=r,i=t.now(),o||(o=t.schedule(c,e),n.add(o))},function(){a(),n.complete()},void 0,function(){s=o=null}))})}var jr=new sr(function(e){return e.complete()});function Gr(e){return e<=0?function(){return jr}:gt(function(t,r){var n=0;t.subscribe(_r(r,function(t){++n<=e&&(r.next(t),e<=n&&r.complete())}))})}function zr(e,t){return gt(function(r,n){var o=0;r.subscribe(_r(n,function(r){return e.call(t,r,o++)&&n.next(r)}))})}function Yr(e){return gt(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}var Br=wr;var Kr=function(e){function t(t,r){var n=e.call(this)||this;return n.source=t,n.subjectFactory=r,n._subject=null,n._refCount=0,n._connection=null,yt(t)&&(n.lift=t.lift),n}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 r=this.getSubject();t.add(this.source.subscribe(_r(r,void 0,function(){e._teardown(),r.complete()},function(t){e._teardown(),r.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 r=null;e._refCount++;var n=_r(t,void 0,void 0,void 0,function(){if(!e||e._refCount<=0||0<--e._refCount)r=null;else{var n=e._connection,o=r;r=null,!n||o&&n!==o||n.unsubscribe(),t.unsubscribe()}});e.subscribe(n),n.closed||(r=e.connect())})(this)},t}(sr);function qr(e){return e?function(t){return $r(e)(t)}:function(e){return function(e,t){var r=Ct(e)?e:function(){return e};return Ct(t)?$r(t,{connector:r}):function(e){return new Kr(e,r)}}(new Wr)(e)}}function Qr(e,t){return void 0===t&&(t=!1),gt(function(r,n){var o=0;r.subscribe(_r(n,function(r){var s=e(r,o++);(s||t)&&n.next(r),!s&&n.complete()}))})}function Xr(e,t,r){var n=Ct(e)||t||r?{next:e,error:t,complete:r}:e;return n?gt(function(e,t){var r;null===(r=n.subscribe)||void 0===r||r.call(n);var o=!0;e.subscribe(_r(t,function(e){var r;null===(r=n.next)||void 0===r||r.call(n,e),t.next(e)},function(){var e;o=!1,null===(e=n.complete)||void 0===e||e.call(n),t.complete()},function(e){var r;o=!1,null===(r=n.error)||void 0===r||r.call(n,e),t.error(e)},function(){var e,t;o&&(null===(e=n.unsubscribe)||void 0===e||e.call(n)),null===(t=n.finalize)||void 0===t||t.call(n)}))}):nr}class Jr{constructor(e){this.props.observableStreams=Jr.createDirectionalObservables()}static createDirectionalFiltersObject(){const e="internal",t="parent",r="child";return{P:[t],C:[r],PCI:[t,e,r],CI:[r,e],PI:[t,e],PC:[t,r]}}static addDefaultDir(e){return de(J)({$dir:["internal"]},re(e))}static addDownInternalDir(e,t=["internal","down"]){return de(J)(re(e),{$dir:t})}static addChildAndInternalDir(e,t=["child","down"]){return de(J)(re(e),{$dir:t})}static mapToDefaultDir(e){return this.addDefaultDir(e)}static createDirectionalObservables(e=new r,t,n){void 0!==t&&void 0!==n&&(e.viewName=t,e.vsid=n);const o=e=>he(t=>t.includes(e),"$dir"),s=o("parent"),i=o("child"),a=o("internal"),c=e=>J({from$:e}),l=c("child"),u=c("internal"),d=c("parent"),h=e.pipe(zr(e=>void 0!==e&&void 0!==e.action)),E=e.pipe(zr(a),Or(u)),p=e.pipe(zr(s),Or(l)),N=e.pipe(zr(i),Or(d)),_={parent:p,internal:E,child:N};return{raw$:h,toInternal$:E,toParent$:p,toChild$:N,completeAll:()=>{Ee(e=>{e.complete(),e.isStopped=!0},[h,E,p,N])},completeStream:(e=[])=>{const t=e=>{if(void 0!==_[e]){(t=_[e]).complete(),t.isStopped=!0}var t};void 0!==e&&e.length>=1&&e.forEach(t)}}}}class Zr{constructor(e,t={},n="",o="theName"){this.addMixins(),this._state="INIT",this.vsid=n,this.el=t.el,this.vsName=o,this.defaults={debug:!1,extendedHashMethods:{}},this.options=Ke(this.defaults,t);this.addActionListeners().forEach(e=>{const[t,r]=e;this.options.extendedHashMethods[t]=e=>this[r](e)}),this.options.hashMethods=this.setHashMethods(this.options.extendedHashMethods),this.sink$=e,this.sink$.subscribe(this.onObsSinkSubscribe.bind(this)),this.$dirs=Jr.createDirectionalFiltersObject(),this.addDefaultDir=Jr.addDefaultDir,this.sourceStreams=Jr.createDirectionalObservables(new r,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:r,template:n}=this.props;return new Tt(t,e,r,n)}onDisposeCompleted(e){}animateInTween(e,t){!function(e,t){const r=1*window.getComputedStyle(e).opacity,n=At(!0,t,"ease",1===r);e.style.cssText+=n}(e,t)}animateOutTween(e,t,r){!function(e,t,r){const n=At(!1,t,"ease");e.style.cssText+=n,e.addEventListener("transitionend",r,!1)}(e,t,r)}setAnimateIn(e){if(!0===e.animateIn){const t=void 0!==e.el?e.el:this.domItem.el;this.animateInTween(t,e.animateInTime)}}disposeMethod(e){const t=void 0!==e.el.el?e.el.el:e.el,r={action:"READY_FOR_VS_DETRITUS_COLLECT",$dir:this.$dirs.PI,el:t},o=n((e,r)=>{this.animateOutTween(t,e.animateOutTime,r)}),s=e=>{this._source$.next(r)},i=!0===e.animateOut?e=>(o(e).subscribe(s),{action:"EXTIRPATING",$dir:this.$dirs.CI}):()=>({action:"EXTIRPATE_AND_READY_FOR_VS_DETRITUS_COLLECT",$dir:this.$dirs.CI});return i(e)}onDispose(e){return this.disposeMethod(e)}removeStream(){void 0!==this.sourceStreams&&this.sourceStreams.completeStream(["internal","child"])}onReadyForGC(e){this.removeStream()}onGarbageCollect(e){void 0!==this.domItem&&this.domItem.unmount(),void 0!==this.sourceStreams&&this.sourceStreams.completeStream(["parent"])}getSourceStream(){return this._source$}combineDomItems(e){if(void 0!==this.el)return;const t=_(e.query)?e.node:e.query,r=(e,t)=>e.insertBefore(t,e.firstChild);({appendChild:(e,t)=>e.appendChild(t),after:(e,t)=>e.after(t)}[e.attachType]||r)(t,this.domItem.render()),this.setAnimateIn(e)}onAttachChildToSelf(e){const t=e.childRenderData;return this.combineDomItems(t),{action:"CHILD_ATTACHED",$dir:this.$dirs.PI}}onRenderAndAttachToParent(e){return this.onRender(e),this.combineDomItems(e),{action:"VS_SPAWNED_AND_ATTACHED_TO_PARENT",el:this.el||this.domItem.el,$dir:this.$dirs.PI}}renderDomItem(e){const[t,r,n,o]=e;return this.domItem=new Tt({tagName:t,attributes:r,data:n,template:o}),this.domItem}onRender(e){return{action:"VS_SPAWNED",el:this.el||(e=>this.renderDomItem(e))(pe(["tagName","domAttributes","data","template"],e)),$dir:this.$dirs.I}}extendedMethods(e){}onRenderAndAttachToDom(e){return e.attachData.el=(e=>this.renderDomItem(e))(pe(["tagName","domAttributes","data","template"],e)),this.combineDomItems(e.attachData),{action:"VS_SPAWNED_AND_ATTACHED_TO_DOM",el:this.el||e.attachData.el.el,$dir:this.$dirs.CI}}onObsSinkSubscribe(e){const t=e.action,r=k(e=>this.extendedMethods(e)),n=r(this.options.hashMethods[t])(e);void 0!==n&&(e=>{this._source$.next(e)})(Object.freeze(n))}addMixins(){}}function en(){setTimeout(()=>{Ee(e=>{},this)},1)}class tn{constructor(e,t,r,n="subscribe",o=!1){const s={name:e,observable:t,data:r,action:n};this.sendToDirectorStream(s)}sendToDirectorStream(e){const t=at.channelsMap.getStream("DISPATCHER"),r=ut(e);t.next(r),e=void 0}static deepClone(e){const t=y(Array),r=y(Object);var n;return!1===t(n=e)&&!0===r(n)?d(Y,R,re)(e):re(e)}static getMouseEventKeys(){return["altKey","bubbles","cancelBubble","cancelable","clientX","clientY","composed","ctrlKey","currentTarget","defaultPrevented","detail","eventPhase","fromElement","isTrusted","layerX","layerY","metaKey","movementX","movementY","offsetX","offsetY","pageX","pageY","path","relatedTarget","returnValue","screenX","screenY","shiftKey","sourceCapabilities","srcElement","target","timeStamp","toElement","type","view","which","x","y"]}addMixins(){this.gc=en}}const rn=!0===at.debug;class nn{constructor(e,t){this.addMixins(),this.props=e,this.broadcastFn=t,this.broadcaster(this.broadcastFn)}addDblClickEvt(e){return o(e,"dblclick").pipe(Or(e=>{const t=re(e);return t.typeOverRide="dblclick",t}))}broadcast(e){if(e.length<=0&&!0===rn)return void console.warn(`Spyne Warning: The nested array in ${this.props.name}.broadcastEvents appears to be empty --\x3e vsid:${this.props.vsid}!`);const t={UI:this.sendUIPayload,ROUTE:this.sendRoutePayload},[r,n,s]=e;let i,a=this.props.el.querySelectorAll(r);if(a.length<=0){const e=this.props.el,t=t=>{t===e&&(a=[t])};(()=>{const n=(null!==e.parentElement?e.parentElement:document).querySelectorAll(r);n.forEach=Array.prototype.forEach,n.forEach(t)})()}const c=void 0!==s,l=e=>{const r="dblClick"!==n?o(e,n,{preventDefault:()=>!0}):this.addDblClickEvt(e);i=e.dataset.channel;const s={};s.payload=(e=>{const t={};for(const r in e)t[r]=e[r];return t})(e.dataset),s.payload=Ne(["channel"],s.payload),"ROUTE"===s.channel&&(s.payload.endPreventDefault=!0),s.channel=i,s.srcElement={},s.srcElement.id=this.props.id,s.srcElement.vsid=this.props.vsid,s.srcElement.isLocalEvent=c,s.srcElement.srcEvent=n,s.srcElement.el=e;var a;(0,t[a=i,"ROUTE"===a||"CHANNEL_ROUTE"===a?"ROUTE":("UI"!==a&&"CHANNEL_UI"!==a&&void 0!==a&&console.warn(`SpyneJS warning: The channel, ${a}, is not allowed here, only "UI" or "ROUTE" are valid channels, defaulting to CHANNEL_UI`),"UI")])(r,s)};!0===(void 0===a||a.length<=0)&&!0===rn?console.warn(`Spyne Warning: The item ${r}, does not appear to exist in ${this.props.name} --\x3e vsid:${this.props.vsid}!`):(a.forEach=Array.prototype.forEach,a.forEach(l))}broadcaster(e){e().forEach(e=>this.broadcast(e))}addMixins(){const e={testFunc:function(e){console.log("stream mixin is ",e)},sendRoutePayload:function(e,t){return new tn("CHANNEL_ROUTE",e,t,"subscribe")},sendUIPayload:function(e,t){return new tn("CHANNEL_UI",e,t,"subscribe")}};this.sendUIPayload=e.sendUIPayload,this.sendRoutePayload=e.sendRoutePayload}}const on=d(ne,y(Array)),sn=d(ne,E),an=f([y(String),sn]),cn=f([y(Array),sn]),ln=d(f([on,y(Object)])),un=d(f([sn,on,y(Object)]));class dn{constructor(e,t={},r,n){ln(e)&&(e=v("selector",t=e),n=n||v("testMode",t));const o=[r,v("debugLabel",t)];r=d(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=an(e)?dn.filterSelector([e],r):void 0,c=cn(e)?dn.filterSelector(e,r):void 0,l=un(i)?dn.filterData(i,r):void 0;let u=m(_,[a,c,l]);const h=E(u);return h&&(u=[V(!1)],!0===at.debug&&!0!==n&&console.warn(`Spyne Warning: The Channel Filter, with selector: ${e}, and propFilters:${i} appears to be empty!`)),!0===n?{selector:e,propFilters:i,debugLabel:r,filters:t,testMode:n,filtersAreEmpty:h}:f(u)}static filterData(e,t){const r=t;return(()=>{if(E(e))return V(!1);e=D((e,t,r)=>{let n=Te;if((e=>y(String,e))(e)||(e=>y(Boolean,e))(e)||(e=>y(Number,e))(e))o=e,n=e=>e===o;else{if("function"==typeof e)return e;if((e=>y(Array,e))(e)||ln(e))return console.warn(`ChannelPayloadFilter: Property "${e}" is an array/object, which is not allowed. This property will always return false.`),n}var o;return n},e);const t=me(e);return d(t,t=>{if(void 0===r)return t;const n={};return ue((e,r)=>{n[r]=e(v(r,t))},e),console.log(`%c CHANNEL PAYLOAD FILTER DEBUGGER ["${r}"] - values: `,"color:orange;",{propsBooleans:n,comparedObj:t}),t},k({}),e=>{const{payload:t,srcElement:r,event:n}=e||{};return Object.assign({},e,r,n,t)})})()}static checkPayloadSelector(e,t,r){const{payload:n,srcElement:o,event:s}=r||{},i=[o,n,v("srcElement",s),r].reduce((e,t)=>{const r=v("el",t);return dn.elIsDomElement(r)&&void 0===e&&(e=r),e},void 0),a=e=>e.isEqualNode(i),c=e=>{const t=Array.from(document.querySelectorAll(e));return D(a,t)};if(void 0!==t){const r=d(O,D(c))(e),n=e;console.log(`%c CHANNEL PAYLOAD FILTER DEBUGGER ["${t}"] - selectors: `,"color:orange;",{el:i,selectorsArr:n,nodeArrResultsDebugger:r})}if("object"!=typeof i)return!1;const l=d(O,D(c))(e);return!0!==E(l)&&_e(T(!0),l)}static elIsDomElement(e){return y(String,e)&&(e=document.querySelector(e)),d(se(0),k(-1),v("nodeType"))(e)}static filterSelector(e,t){const r=m(E,e);return fe(dn.checkPayloadSelector)(r,t)}}function hn(){return!0===at.debug}function En(e){return d(se(0),k(-1),v("nodeType"))(e)}function pn(e,t,r=!1){const n=_n(e,t,r);return 1===n.length?p(n):n}function Nn(e,t,r){const n=document.querySelector(e),o=d(se(0),k(-1),v("nodeType"));if(null===n||!1!==o(n)){if(void 0!==t&&String(t).trim().length>0){function s(e){try{return document.querySelectorAll(e).length>0}catch(e){return!1}}const i=s(t);!0===r&&!0===hn()&&!1===i&&console.warn(`Spyne Warning: the selector, ${t} does not exist in this el, ${e}`)}}else console.warn(`Spyne Warning: the el object is not a valid single element, ${n}`)}function _n(e,t,r=!1){let n=!1;const o=(r=>{let o=[];try{o=document.querySelectorAll(r)}catch(e){o=[]}try{n=document.querySelector(t)===document.querySelector(e),!0===n&&(o=[document.querySelector(t)])}catch(e){}return o})(void 0!==t?`${e} ${t}`:e);if(!0===r){Nn(!0===n?"body":e,t,r)}return o}function fn(e,t,r){return _n(t,r).forEach(t=>{t.style.cssText=e}),this}function mn(e,t){function r(t){return mn(e,t)}return Nn(e="string"==typeof e?e:function(e){let t=`${Math.random().toString(36).replace(/\d/gm,"").substring(1,8)}`;return void 0===e.dataset.vsid?e.dataset.vsid=t:t=e.dataset.vsid,`[data-vsid='${t}']`}(e),t,!1),r.map=r=>Array.from(_n(e,t)).map(r),r.forEach=r=>Array.from(_n(e,t)).map(r),r.getNodeListArray=()=>_n(e,t),r.addClass=r=>(_n(e,t).forEach(e=>e.classList.add(r)),this),r.removeClass=r=>(_n(e,t).forEach(e=>{e.classList.remove(r)}),this),r.setClass=r=>(_n(e,t).forEach(e=>{const t=d(m(E),z(" "))(e.className),n=r.split(" ");t.forEach(t=>e.classList.remove(t)),n.forEach(t=>e.classList.add(t))}),this),r.unmount=()=>{},r.toggleClass=(r,n)=>(_n(e,t).forEach(e=>{(n=void 0!==n?n:!e.classList.contains(r))?e.classList.add(r):e.classList.remove(r)}),this),r.toggle=(e,t)=>(r.toggleClass(e,t),this),r.appendChild=e=>(0!==r.el.length?r.el.appendChild(e):console.warn(`Spyne Warning: The selector, ${t} does not appear to be valid!`),r.el),r.addAnimClass=r=>{requestAnimationFrame(()=>{_n(e,t).forEach(e=>{try{e.classList.add(r)}catch(e){}})})},r.setActiveItem2=(r,n)=>{const o=_n(e,t),s="string"==typeof n?pn(e,n):n,i=e=>e.isEqualNode(s)?e.classList.add(r):e.classList.remove(r);return!0===En(s)?o.forEach(i):!0===hn()&&console.warn(`Spyne Warning: The selector, ${n}, does not appear to be a valid item in setActiveItem: ${r}`),this},r.setActiveItem=(r,n)=>{const o=_n(e,t),s="string"==typeof n?pn(e,n):n;if(o.forEach(e=>e.classList.remove(r)),!0===En(s)){const e=Array.from(o).find(e=>e===s);e?e.classList.add(r):!0===hn()&&console.warn(`Spyne Warning: The selector, ${n}, is valid but does not match any item in setActiveItem: ${r}`)}else!0===hn()&&console.warn(`Spyne Warning: The selector, ${n}, does not appear to be a valid item in setActiveItem: ${r}`);return this},Object.defineProperty(r,"el",{get:()=>pn(e,t,!0)}),Object.defineProperty(r,"els",{get:()=>_n(e,t)}),Object.defineProperty(r,"len",{get:()=>_n(e,t,!1).length}),Object.defineProperty(r,"exists",{get:()=>_n(e,t,!1).length>=1}),Object.defineProperty(r,"exist",{get:()=>_n(e,t,!1).length>=1}),Object.defineProperty(r,"nodeList",{get:()=>_n(e,t)}),Object.defineProperty(r,"arr",{get:()=>{const r=pn(e,t,!0);return void 0===r?[]:void 0===r.length?[r]:Array.from(r)}}),Object.defineProperty(r,"inline",{set:r=>fn(r,e,t),get:()=>r}),Object.defineProperty(r,"inlineCss",{set:r=>fn(r,e,t),get:()=>r}),r}class Tn{constructor(e={}){this.vsnum=Math.random(),this.addMixins(),this._postRenderCalled=!1,this.defaults=()=>{const t=this.createId(),r=e.id?e.id:t;return{vsid:t,id:r,tagName:"div",el:void 0,data:void 0,animateIn:!1,animateInTime:.5,animateOut:!1,animateOutTime:.5,sendLifecyleEvents:!1,hashId:`#${r}`,id$:`#${r}`,viewClass:Zr,extendedSourcesHashMethods:{},debug:!1,template:void 0,node:document.createDocumentFragment(),name:pt(this)}},this._state={},this.$dirs=Jr.createDirectionalFiltersObject(),this.addDefaultDirection=Jr.addDefaultDir,this.addDownInternalDir=Jr.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 r,this.props.elIsAlreadyRenderedBool=this.elAlreadyExistsFn(this.props);const n=this.props.viewClass;this.view=new n(this.sink$,{el:this.props.el},this.props.vsid,this.props.id),this.sourceStreams=this.view.sourceStreams,this._rawSource$=this.view.getSourceStream(),this._rawSource$.viewName=this.props.name,this.sendEventsDownStream=this.sendEventsDownStreamFn,this.initViewStream(),this.isDevMode=Tn.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 r=t=>{const r=new RegExp(t);if(ge(M(r),n)<0){const r=1===e.length?"from added channel":"from added channels";console.warn(`Spyne Warning: The action, ${t}, in ${this.props.name}, does not match any of the registered actions ${r}, ${e.join(", ")}`)}},n=(e=>{const t=e.map(e=>at.getChannelActions(e));return O(t)})(e);t.forEach(r)}}static isValidNestedArr(e){const t=T(!0),r=Ae(t),n=y(String),o=d(r,D(n),Ce(0,2),k([]));return d(r,D(o),k([]))(e)}static elIsDomElement(e){return y(String,e)&&(e=document.querySelector(e)),d(se(0),k(-1),v("nodeType"))(e)}updatePropsToMatchEl(){const e=d(ye,P(v("tagName"),V("")));this.props.tagName=e(this.props.el)}elAlreadyExistsFn(e){const t=d(se(0),k(-1),v("nodeType"));return he(f([e=>document.body.contains(e),t]),"el")(e)}checkIfElementAlreadyExists(){!0===this.props.elIsAlreadyRenderedBool?(this.updatePropsToMatchEl(),this.postRender()):null===this.props.el&&console.error(`Spyne Error: The defined element for this ViewStream instance, ${this.constructor.name}, appears to not exist.`)}loadAllMethods(){const e=fe(this.onChannelMethodCall.bind(this));this.addActionListeners().forEach(t=>{let[r,n,o]=t;y(String,o)&&(o=new dn({selector:o})),this.props.extendedSourcesHashMethods[r]=e(n,o)}),this.props.hashSourceMethods=this.setSourceHashMethods(this.props.extendedSourcesHashMethods)}addActionListeners(){return[]}onChannelMethodCall(e,t,r){const n=t=>{void 0===this[e]?console.warn(`Spyne Warning: The method, ${e} does not appear to exist in ${this.constructor.name}!`):this[e](t)};if(void 0!==r.$dir&&r.$dir.includes("child")&&!0!==this.deleted){const e=Ke({},r);e.$dir=this.$dirs.C,this.sourceStreams.raw$.next(e)}!0===k(V(!0),t)(r)&&n(r=Ne(["$dir"],r))}setSourceHashMethods(e={}){const t={EXTIRPATING:e=>this.checkParentDispose(e),EXTIRPATE:e=>this.disposeViewStream(e),VS_SPAWNED:e=>this.onVSRendered(e),VS_SPAWNED_AND_ATTACHED_TO_DOM:e=>this.onVSRendered(e),VS_SPAWNED_AND_ATTACHED_TO_PARENT:e=>this.onVSRendered(e),READY_FOR_VS_DETRITUS_COLLECT:e=>this.onReadyToGC(e),VS_NULLITY:()=>({})};return Ke.all([{},t,e])}initViewStream(){this._source$=this._rawSource$.pipe(Or(e=>this.onMapViewSource(e)),Qr(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(zr(e=>void 0!==e&&void 0!==e.action),Or(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(zr(e=>void 0!==e&&void 0!==e.action),Xr(e=>this.tracer("addChildStraem do ",e)),Or(e=>e),Yr(e=>this.onChildCompleted(t.source)));this.updateSourceSubscription(t,!0,"CHILD")}onChildDisposed(e){}onChildCompleted(e){const t=(e=>{const t=e=>{for(;void 0!==e.destination;)e=t(e.destination);return e};return ee(["id","vsid"],t(e))})(e);return this.tracer("onChildCompleted ",this.vsnum,e),this.onChildDisposed(t,e),t}initAutoMergeSourceStreams(){const e={next:this.onSubscribeToSourcesNext.bind(this),error:this.onSubscribeToSourcesError.bind(this),complete:this.onSubscribeToSourcesComplete.bind(this)},t=()=>{this.props.el$=void 0,this.uberSource$.complete(),this.autoSubscriber$.complete(),this.sink$.complete(),this.props=void 0,this.deleted=!0,this.tracer("completeAll",this.deleted,this.props)},n=()=>{o-=1,0===o&&t()};let o=0;this.uberSource$=new r;this.autoMergeSubject$=this.uberSource$.pipe(wr(e=>{const t=e.observable.pipe(zr(e=>void 0!==e&&void 0!==e.action),Or(e=>{const t=Ke({},e);return t.action=e.action,this.tracer("autoMergeSubject$",t),t}));return!1===e.autoClosesBool?t:(o+=1,t.pipe(Yr(n)))})),this.autoSubscriber$=this.autoMergeSubject$.pipe(zr(e=>void 0!==e&&void 0!==e.action)).subscribe(e)}updateSourceSubscription(e,t=!1,r){const n={observable:e,autoClosesBool:t,rel:r};this.tracer("updateSourceSubscription ",this.vsnum,n),this.uberSource$.next(n)}onSubscribeToSourcesNext(e={}){const t=k(e=>this.sendExtendedStreams(e)),r=(n=this.props.hashSourceMethods,o=e.action,void 0!==n[o]?o:d(p,F(d(M(I,o),e=>new RegExp(e))))(A(n)));var n,o;t(this.props.hashSourceMethods[r])(e),this.tracer("onSubscribeToSourcesNext",{payload:e})}onSubscribeToSourcesError(e=""){console.log("ALL ERROR ",this.constructor.name,e)}onSubscribeToSourcesComplete(){this.tracer("onSubscribeToSourcesComplete","VS_DETRITUS_COLLECT"),this.openSpigot("VS_DETRITUS_COLLECT")}sendExtendedStreams(e){this.tracer("sendExtendedStreams",e),this.openSpigot(e.action,e)}renderAndAttachToParent(e){this.openSpigot("VS_SPAWN_AND_ATTACH_TO_PARENT",e)}renderView(){this.openSpigot("VS_SPAWN")}renderViewAndAttachToDom(e,t,r){const n={node:e,type:t,attachType:r};this.openSpigot("VS_SPAWN_AND_ATTACH_TO_DOM",{attachData:n})}checkParentDispose(e){"parent"===e.from$&&this.disposeViewStream(e)}onBeforeDispose(){}setTimeout(e,t=0,r=!1){window.setTimeout((...t)=>{if(void 0!==this&&void 0!==this.props){const n=!0===r?e.bind(this):e;ve(n,t)}},t)}disposeViewStream(e){this.onBeforeDispose(),this.openSpigot("EXTIRPATE")}onChildDispose(e){}onParentDisposing(e){this.openSpigot("EXTIRPATE")}onReadyToGC(e){const t=void 0!==e.from$&&"internal"===e.from$;this.tracer("onReadyToGC",t,e)}openSpigot(e,t={}){if(void 0!==this.props){this.props.action=e;const r=J(this.props,t);this.sink$.next(Object.freeze(r))}}setAttachData(e,t){return{node:this.props.el,type:"ViewStreamObservable",attachType:e,query:(()=>{const e=this.props.el.querySelector(t);return!0===Tn.isDevMode()&&y(String,t)&&_(e)&&console.warn(`Spyne Warning: The appendView query in ${this.props.name}, '${t}', appears to not exist!`),e})()}}getParentEls(e,t){const r=e=>e.parentElement;let n=0,o=e;for(;n<t;)o=r(o),n++;return o}setAttachParentData(e,t,r){t=""!==t?t:void 0;const n=this.getParentEls(this.props.el,r);return{node:n,type:"ViewStreamObservable",attachType:e,query:n.querySelector(t)}}onMapViewSource(e={}){return this.props=J(this.props,e),e}exchangeViewsWithChild(e,t){this.addChildStream(e.sourceStreams.toParent$),e.addParentStream(this.sourceStreams.toChild$,t)}appendToDom(e){void 0!==this.props.el&&console.warn(`Spyne Warning: The ViewStream, ${this.props.name}, has an element, ${this.props.el}, that is already rendered and does not need to be appendedToDom. This may create unsusual side effects!`),this.renderViewAndAttachToDom(e,"dom","appendChild")}appendToDomAfter(e){void 0!==this.props.el&&console.warn(`Spyne Warning: The ViewStream, ${this.props.name}, has an element, ${this.props.el}, that is already rendered and does not need to be appendedToDomAfter. This may create unsusual side effects!`),this.renderViewAndAttachToDom(e,"dom","after")}prependToDom(e){void 0!==this.props.el&&console.warn(`Spyne Warning: The ViewStream, ${this.props.name}, has an element, ${this.props.el}, that is already rendered and does not need to be prependedToDom. This may create unsusual side effects!`),this.renderViewAndAttachToDom(e,"dom","prependChild")}appendView(e,t){this.exchangeViewsWithChild(e,this.setAttachData("appendChild",t))}appendViewAfter(e,t){this.exchangeViewsWithChild(e,this.setAttachData("after",t))}appendViewToParentEl(e,t,r=1){this.exchangeViewsWithChild(e,this.setAttachParentData("appendChild",t,r))}prependViewToParentEl(e,t,r=1){this.exchangeViewsWithChild(e,this.setAttachParentData("prependChild",t,r))}prependView(e,t){this.exchangeViewsWithChild(e,this.setAttachData("prependChild",t))}appendToNull(){const e=document.getElementById("spyne-null-views");this.renderViewAndAttachToDom(e,"dom","appendChild")}onVSRendered(e){"internal"===e.from$&&this.postRender()}postRender(){if(!0===this._postRenderedCalled)return;this.beforeAfterRender(),this.afterRender(),this.onRendered();if(requestAnimationFrame(()=>this.onAnimFrameAfterRendered()),!0===this.isDevMode){const e=this.broadcastEvents();!1===Tn.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 nn(this.props,this.broadcastEvents.bind(this)),this.afterBroadcastEvents(),this._postRenderedCalled=!0}addTraits(e){"Array"!==e.constructor.name&&(e=[e]);e.forEach(e=>{new e(this)})}afterBroadcastEvents(){if(!0===this.isDevMode){const e=e=>e[0],t=this.addActionListeners(),r=t.map(e);if(!1===Tn.isValidNestedArr(t))console.warn(`Spyne Warning: The array returned from addActionsListeners in ${this.props.name}, '${JSON.stringify(t)}', does not appear to be properly formatted!`);else{d(Ee(e=>{const t=k("",e[1]);!1===y(Function,this[t])&&console.warn(`Spyne Warning: The method in addActionListeners nested Array, '${JSON.stringify(e)}', in ${this.props.name}, does not appear to exist!`)}),k([]))(t)}const n=()=>{void 0!==K(["props","addedChannels"],this)&&Tn.checkIfActionsAreRegistered.bind(this)(this.props.addedChannels,r)};this.setTimeout(n,500)}}setDataVSID(){this.props.el.dataset.vsid=this.props.vsid}beforeAfterRender(){this.setDataVSID(),this.props.el$=mn(this.props.el)}downStream(){}onRendered(){}onAnimFrameAfterRendered(){}afterRender(){}broadcastEvents(){return[]}getChannel(e){return H(e=>ct().includes(e),e=>at.channelsMap.getStream(e).observer.pipe(Qr(e=>!0!==this.deleted)),e=>console.warn(`channel name ${e} is not within ${ct}`))(e)}initializeChannels(){const e=e=>{const[t,r=!1]=Array.isArray(e)?e:[e];this?.addChannel(t,r)};Array.isArray(this?.props?.channels)?this?.props?.channels?.forEach(e):Array.isArray(this?.props?.channel)&&console.warn("props.channel is not a ViewStream property. Do you mean props.channels?")}addChannel(e,t=!1,r=!1,n=!1){const o=!0===r?this.$dirs.CI:this.$dirs.I;if(!0===this?.props?.addedChannels?.includes(e))return;const s=K(["srcElement","isLocalEvent"]),i=K(["srcElement","vsid"]),a=[Or(e=>{const t=e;return t.$dir=o,t}),zr(e=>{const t=i(e);return!0!==s(e)||t===this.props.vsid})];var c;!0===t&&a.unshift((c=1,zr(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={},r){const n=t,o=k("VIEWSTREAM_EVENT"),i=d(o,v(e)),a={payload:n,action:r=r||i({CHANNEL_ROUTE:"CHANNEL_ROUTE_CHANGE_EVENT"})};try{if(a.srcElement=d(ee(["id","vsid","class","tagName"]),v("props"))(this),!0===this.checkIfChannelExists(e)){!1===/CHANNEL_LIFECYCLE/.test(r)&&Object.defineProperties(a,{payload:{get:()=>ut(t)}});const n=s(a);return new tn(e,n,a)}}catch(e){console.warn("SPYNE WARNING ",e)}}tracer(...e){this.sendLifecycleMethod(...e)}sendLifecycleMethodInactive(){}sendLifecycleMethodActive(e,t){const r="VS_DETRITUS_COLLECT"===t;!0===me({from$:T("internal"),action:T("VS_SPAWNED_AND_ATTACHED_TO_PARENT")},t)?this.sendInfoToChannel("CHANNEL_LIFECYCLE",{action:"CHANNEL_LIFECYCLE_RENDERED_EVENT"},"CHANNEL_LIFECYCLE_RENDERED_EVENT"):!0===r&&this.sendInfoToChannel("CHANNEL_LIFECYCLE",{action:"CHANNEL_LIFECYCLE_DISPOSED_EVENT"},"CHANNEL_LIFECYCLE_DISPOSED_EVENT")}createActionFilter(e,t){return new dn(e,t)}isLocalEvent(e){const t=K(["srcElement","el"],e),r=K(["props","el"],this);return Tn.elIsDomElement(r)&&Tn.elIsDomElement(t)&&r.contains(t)}addMixins(){const e=ht();this.createId=e.createId}}class An{constructor(e){const t=String(e.props.name),r=`${t}_ROUTE_UPDATER`;return fe(An.createTemporaryViewStreamObj)({id:r,name:t})}static createTemporaryViewStreamObj(e,t){const{name:r,id:n}=e,o=t,s=new Tn({id:n,name:r,data:t});s.onRendered=()=>{s.sendInfoToChannel("CHANNEL_ROUTE",o)},s.afterBroadcastEvents=()=>{s.disposeViewStream()},s.appendToNull()}}class Cn{constructor(e,t={}){this.addRegisteredActions.bind(this),this.createChannelActionsObj(e,t.extendedActionsArr),t.name=e,t.defaultActions=void 0!==t.data?[`${t.name}_EVENT`]:[],this.props=t,this.props.isRegistered=!1,this.props.isProxy=void 0!==this.props.isProxy&&this.props.isProxy;const r=void 0!==this.props.data;void 0!==this.props.replay?this.props.sendCachedPayload=this.props.replay:this.props.sendCachedPayload=void 0===this.props.sendCachedPayload?r:this.props.sendCachedPayload,this.sendPayloadToRouteChannel=new An(this),this.createChannelActionMethods(),this.streamsController=at.channelsMap;const n=this.getMainObserver();this.checkForPersistentDataMode=Cn.checkForPersistentDataMode.bind(this),this.observer$=this.props.observer=n;const o=this.streamsController.getStream("DISPATCHER"),s=U(t.name,"name");o.pipe(zr(s)).subscribe(e=>this.onReceivedObservable(e))}getMainObserver(){void 0===this.streamsController&&console.warn(`Spyne Warning: The following channel, ${this.props.name}, appears to be registered before Spyne has been initialized.`);return!0===this.streamsController.testStream(this.props.name)?this.streamsController.getProxySubject(this.props.name,this.props.sendCachedPayload):!0===this.props.sendCachedPayload?new i(1):new r}onChannelInitialized(){}onRegistered(e=this.props){if(void 0!==e.data){const t=Object.keys(this.channelActions)[0];this.sendChannelPayload(t,e.data)}}get isProxy(){return this.props.isProxy}get channelName(){return this.props.name}get observer(){return this.observer$}checkForTraits(){const e=e=>{"Array"!==e.constructor.name&&(e=[e]);e.forEach(e=>new e(this))};void 0!==this.props.traits&&e(this.props.traits)}initializeStream(){this.checkForTraits(),this.onChannelInitialized(),this.checkForPersistentDataMode(),this.onRegistered(),this.props.isRegistered=!0}static checkForPersistentDataMode(e=this.props,t=this.channelActions){const r=E(t),n=void 0!==v("data",e);return!0===r&&!0===n&&(e.sendCachedPayload=!0,t=(()=>{const{name:t}=e,r=`${t}_EVENT`;return{[r]:r}})(),void 0!==this.channelActions&&(this.channelActions=t)),{props:e,actionsObj:t}}setTrace(e){}createChannelActionsObj(e,t=[]){const r=H(y(String),be,p),n=t.concat(this.addRegisteredActions(e)),o=D(r,n),s=oe(Q(e=>Ie(e,e),o));this.channelActions=s}createChannelActionMethods(){const e=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)},r=H(y(String),V("onViewStreamInfo"),e=>{const r=Se(Le(1),e);return t(r,e),r});this.channelActionMethods=Y(D(t=>[e(t),r(t)],this.addRegisteredActions()))}addRegisteredActions(){let e=[];return K(["props","data"],this)&&(e=[`${this.props.name}_EVENT`]),e}onReceivedObservable(e){this.onIncomingObservable(e)}getActionMethodForObservable(e){e.unpacked=!0;const t=this.onViewStreamInfo.bind(this),r=K(["data","action"],e),n=v(r,this.channelActionMethods);let o=t;if(void 0!==n&&"onViewStreamInfo"!==n){!0===("function"==typeof this[n])&&(o=this[n].bind(this))}return o}onIncomingObservable(e){const t=T(e.name,this.props.name),{action:r,payload:n,srcElement:o}=e.data,s=t=>({clone:()=>{return t=e.data,oe([t,{action:v("action",t)},v("payload",t),v("srcElement",t)]);var t},action:r,payload:n,srcElement:o,event:t});return!0===t?(e=>e.observable.pipe(Or(s)).subscribe(this.getActionMethodForObservable(e)))(e):void 0}onViewStreamInfo(e){}sendChannelPayload(e,t,r={},n={},o=this.observer$){const s=new dt(this.props.name,e,t,r,n);o.next(s)}getChannel(e,t){return H(e=>ct().includes(e),r=>{const n=this.streamsController.getStream(r).observer;return n.source?n.source.channelName=e:n.channelName=e,void 0!==t?n.pipe(zr(t)):n},e=>console.warn(`channel name ${e} is not within ${ct}`))(e)}mergeChannels(e,t=!0){const r=e.map(e=>{if("string"==typeof e){const r=this.getChannel(e);return t?r.pipe(Gr(1)):r}return t?e.pipe(Gr(1)):e});let n;if(t)n=a(r);else if(0===r.length)n=c;else if(1===r.length)n=r[0];else{const[e,...t]=r;n=e.pipe(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Ur.apply(void 0,Dt([],Ot(e)))}(...t))}return n.pipe(Or(t=>{const r={};return e.forEach((e,n)=>{const o="string"==typeof e?e:`channel_${n}`;r[e?.source?.channelName||e?.source?.source?.channelName||o]=t[n]}),r}))}static checkForNotTrackFlag(e={}){!0===e.doNotTrack&&at.doNotTrackChannel(e.channelName)}}class yn extends Cn{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(Or(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 r=this.getRouteConfig();r.navLinks=[...r?.routeDatasetsArr],this.routeConfigJson=r,this.bindStaticMethodsWithConfigData(),this.sendChannelPayload("CHANNEL_ROUTE_CONFIG_UPDATED_EVENT",r,{},{},this.navToStream$)}getRouteConfig(){const e=at.config,t=K(["channels","ROUTE"],e);"query"===t.type&&(t.isHash=!1);const r=$e.flattenConfigObject(t.routes);return t.paramsArr=r,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,r){const n=void 0!==r?r:this.channelActions.CHANNEL_ROUTE_CHANGE_EVENT,o=K(["state","routeCount"],e),s=!0===y(Number,o);let i=this.getDataFromString(t,s);!0===s&&(i.routeCount=o),"CHANNEL_ROUTE_DEEPLINK_EVENT"===r&&(i.navLinks=v("routeDatasetsArr",t),Object.defineProperty(i,"linksData",{get(){return this.navLinks},set(e){console.warn("set links data is deprecated in ROUTE DEEPLINK DATA, use navLinks")},enumerable:!0}));const a=this.compareRouteKeywords.compare(i.routeData,i.paths);i=J(i,a),this.sendChannelPayload(n,i,void 0,e,this.navToStream$)}static checkForRouteParamsOverrides(e){return e}static checkForEventMethods(e){const t=d(F(M(/^(event)([A-Z].*)([A-Z].*)$/gm)),A,v("payload"))(e);if(t.length>=1){const r=v("event",e);if(void 0!==r){const e=L(/^(event)([A-Z])(.*)([A-Z].*)$/gm,(e,t,r,n,o)=>String(r).toLowerCase()+n+o),n=t=>{const n=e(t);void 0!==r[n]&&r[n]()};t.forEach(n)}}return e}static checkForEndRoute(e,t=this.routeConfigJson,r){if(!0!==d(T("true"),K(["payload","endRoute"]))(e))return e;const n=void 0!==r?r:!0===at.debug,{payload:o}=e;let s=0;const i=(e=[],t)=>{const r=t[1],{routePath:a}=r,c=v("routeName",a),l=(e=>{const t=v("routeName",e);if(t){const r=d(A,Ne(["routeName"]))(e),n=o[t];return C(e=>new RegExp(`^${e}$`).test(n),r)}})(a),u=y(Object,r),h=y(Array,r);if(s+=1,!0===u&&!1===h){const t=a[l];t?d(Re,j(i,e),R)({nextRoutePath:t}):1===s?n&&console.warn(`Spyne Warning: use of end route method should add start route value of "${c}".`):e.push(c)}return e},{routes:a}=t,c=d(Re,j(i,[]),R)({routes:a});if(1===c.length){const t=c[0];e.payload[t]=""}return e}onViewStreamInfo(e){const t=e.action??this.channelActions.CHANNEL_ROUTE_CHANGE_EVENT;e?.srcElement?.el?.dataset&&(e.payload=function(e){const t={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}(e?.srcElement?.el?.dataset)??e.payload),yn.checkForEventMethods(e),e=this.checkForEndRoute(e);let r=this.getDataFromParams(e);const n=v("srcElement",e),o=v("event",e),s=!r.isHidden,i=this.compareRouteKeywords.compare(r.routeData,r.paths);r=J(r,i),this.sendRouteStream(r,s),r=yn.removeSSID(r),this.sendChannelPayload(t,r,n,o,this.navToStream$)}static checkAndConvertStrWithRegexTokens(e,t){return A(t)}sendRouteStream(e,t=!0){!0===t&&this.setWindowLocation(e)}static getRouteState(){return"CHANNEL_ROUTE_CHANGE_EVENT"}static getIsDeepLinkBool(e){return!1===e&&0===this._routeCount}static getRouteCount(e=!1){return void 0===this._routeCount?(this._routeCount=0,this._routeCount):(!1===e&&(this._routeCount+=1),this._routeCount)}static getExtraPayloadParams(e=this.routeConfigJson,t=!1){return{routeCount:this.getRouteCount(t),isDeepLink:this.getIsDeepLinkBool(t),isHash:e.isHash,isHistory:t,isHidden:e.isHidden,routeType:e.type}}static getDataFromParams(e,t=this.routeConfigJson){let r=v("payload",e);const n=this.getRouteStrFromParams(r,t),o=(e,r)=>k(r,v(e,t)),s=o("type","slash"),i=o("isHash",!1),a=Fe.formatStrAsWindowLocation(n),c=this.getDataFromLocationStr(s,i,a),{pathInnermost:l,paths:u}=c;r=J(c.routeData,r);const{routeCount:d,isDeepLink:h,isHash:E,isHistory:p,isHidden:N,routeType:_}=this.getExtraPayloadParams(t);return{isDeepLink:h,routeCount:d,pathInnermost:l,paths:u,routeData:r,routeValue:n,isHash:E,isHidden:N,isHistory:p,routeType:_}}static getDataFromString(e=this.routeConfigJson,t=!1){const r=e.type,n=!0===e.isHash,o=Fe.getLocationStrByType(r,n),{paths:s,pathInnermost:i,routeData:a,routeValue:c}=yn.getParamsFromRouteStr(o,e,r),{routeCount:l,isDeepLink:u,isHash:d,routeType:h,isHidden:E}=this.getExtraPayloadParams(e,t);return{isDeepLink:u,routeCount:l,pathInnermost:i,paths:s,routeData:a,routeValue:c,isHash:d,isHidden:E,isHistory:t,routeType:h}}static getDataFromLocationStr(e="slash",t=this.routeConfigJson.isHash,r=window.location){const n=void 0!==this.routeConfigJson?this.routeConfigJson.type:e,o=Fe.getLocationStrByType(n,t,r),{paths:s,pathInnermost:i,routeData:a,routeValue:c}=this.getParamsFromRouteStr(o,this.routeConfigJson,n);return{paths:s,pathInnermost:i,routeData:a,routeValue:c,action:this.getRouteState()}}static getLocationData(){return Z(["href","origin","protocol","host","hostname","port","pathname","search","hash"],window.location)}static getRouteStrFromParams(e,t,r){const n=void 0!==r?r:t.type;return Fe.convertParamsToRoute(e,t,n)}static getParamsFromRouteStr(e,t,r){const n=void 0!==r?r:t.type;return Fe.convertRouteToParams(e,t,n)}checkEmptyRouteStr(e,t=!1){const r=E(e);return!0===(!0===r&&!1===t)||!0===(!0===r&&!0===t)?"/":!0===(!1===r&&!0===t)?w("#",e):e}static removeLastSlash(e){return e.replace(/^(.*)(\/)$/,"$1")}setWindowLocation(e){let{isHash:t,routeValue:r,routeType:n}=e;r=this.checkEmptyRouteStr(r,t);const{routeCount:o}=e;if(!0===t||"query"===n){r=yn.removeLastSlash(window.location.pathname)+r,window.history.pushState({routeCount:o},"",r)}else{const e=b(d(h(T("/")),p),w("/",I));window.history.pushState({routeCount:o},"",e(r))}}getWindowLocation(){return window.location.pathname}bindStaticMethods(){this.checkForEndRoute=yn.checkForEndRoute.bind(this),this.getIsDeepLinkBool=yn.getIsDeepLinkBool.bind(this),this.getDataFromLocationStr=yn.getDataFromLocationStr.bind(this),this.onIncomingDomEvent=yn.onIncomingDomEvent.bind(this),this.getDataFromString=yn.getDataFromString.bind(this),this.getParamsFromRouteStr=yn.getParamsFromRouteStr.bind(this),this.getLocationData=yn.getLocationData.bind(this),this.getRouteState=yn.getRouteState.bind(this),this.getDataFromParams=yn.getDataFromParams.bind(this),this.getRouteCount=yn.getRouteCount.bind(this),this.getExtraPayloadParams=yn.getExtraPayloadParams.bind(this),this.bindStaticMethodsWithConfigData()}bindStaticMethodsWithConfigData(){const e=He(3,yn.getRouteStrFromParams);this.getRouteStrFromParams=e(I,this.routeConfigJson,this.routeConfigJson.type)}}let gn,vn=!1,bn=!1;const In={ALLOWED_TAGS:["a","b","i","em","strong","u","p","br","ul","dl","dt","dd","ol","li","hr","blockquote","pre","code","span","div","section","article","aside","header","footer","h1","h2","h3","h4","h5","h6","table","thead","tbody","tr","td","th","img","figure","figcaption","video","source","iframe","input","button","label","link"],ADD_TAGS:["iframe","input","button","link"],ALLOWED_ATTR:["href","src","alt","class","title","width","height","style","target","rel","controls","poster","type","rows","cols"],ALLOW_DATA_ATTR:!0,FORBID_ATTR:["onerror","onload","onclick","onmouseover","onfocus","onblur","onchange"],FORBID_TAGS:["script","object","embed","meta"],SAFE_URL_PATTERN:/^(https?:|mailto:|tel:|data:image\/)/i},Sn={FORBID_TAGS:["script","iframe","object","embed","form","input","button","link","meta"],FORBID_ATTR:["onerror","onload","onclick","onmouseover","onfocus","onblur","onchange"],ALLOW_DATA_ATTR:!1},Ln=()=>{try{const e=at?.mode||process?.env?.NODE_ENV;if("authoring"===e||"development"===e)return"richtext"}catch(e){}return"app"};function On(e="app"){"development"===process?.env?.NODE_ENV&&(e="richtext");const t="richtext"===e?In:Sn;return r=>{let n=xe.sanitize(r,t);return"richtext"===e&&(n=n.replace(/<(a|img)\b([^>]+?)>/gi,e=>e.replace(/\b(href|src)="([^"]*)"/gi,(e,t,r)=>e))),n}}const Dn=(e={})=>{if(vn)return void console.warn("sanitizeData is already configured. Reconfiguration is not allowed.");const{strict:t=!1}=e,r=e=>{const t=On(e),r=e=>{if(Array.isArray(e))return e.map(r);if(e&&"object"==typeof e){const n={};for(const[o,s]of Object.entries(e))n[o]="string"==typeof s?t(s):r(s);return n}return"string"==typeof e?t(e):e};return r};gn=(e,n={})=>{const{disableSanitize:o=!1,mode:s}=n,i=s||(bn||t?"app":Ln());return o?e:r(i)(e)},Dn.sanitizeDataForce=(e,t)=>{const n=t||Ln();return r(n)(e)},vn=!0},Rn=(e,t={})=>{if(!vn)throw new Error("sanitizeData is not configured. Call sanitizeDataConfigure() first.");return gn(e,t)},Hn=(e,t)=>{if(!e)return;const r=On(t||Ln()),n=/<(?:script|object|embed|form|input|button|link|meta)[^>]*>|on\w+=|javascript:/i;if("string"==typeof e.value&&n.test(e.value)){const t=r(e.value);t!==e.value&&(e.value=t)}if(e.isContentEditable&&"string"==typeof e.innerHTML&&n.test(e.innerHTML)){const t=r(e.innerHTML);t!==e.innerHTML&&(e.innerHTML=t)}};class Vn extends Cn{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=Vn.removeSSID(e.data);const{payload:r,srcElement:n}=e.data,o=e=>({payload:r,srcElement:n,event:e});return!0===t?(e=>e.observable.pipe(Or(o)).subscribe(this.onUIEvent.bind(this)))(e):void 0}getActionState(e){const t=K(["event","type"]),r=K(["event","typeOverRide"]),n=d(Ve,P(r,t))(e),o="CHANNEL_UI";return void 0!==n?`${o}_${n}_EVENT`:o}static checkForEventMethods(e){const t=d(F(M(/^(event)([A-Z].*)([A-Z].*)$/gm)),A,v("payload"))(e);if(t.length>=1){const r=v("event",e);if(void 0!==r){const e=L(/^(event)([A-Z])(.*)([A-Z].*)$/gm,(e,t,r,n,o)=>String(r).toLowerCase()+n+o),n=t=>{const n=e(t);void 0!==r[n]&&"function"==typeof r[n]&&r[n]()};t.forEach(n)}}return e}onUIEvent(e){e.payload=function(e){const t={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}(e?.srcElement?.el?.dataset)??e.payload,Vn.checkForEventMethods(e),e.action=this.getActionState(e);const t=e.action,{payload:r,srcElement:n}=e,o=e.event;Hn(o?.target),this.sendChannelPayload(t,r,n,o)}}class wn{constructor(){this.createDomObservableFromEvent=wn.createDomObservableFromEvent.bind(this)}static createDomObservableFromEvent(t,r,n=!0,o=window){return r=void 0===r?e=>e:r,e(e=>o.addEventListener(t,e,{passive:n}),()=>{o[t]=e=>e}).pipe(Or(r))}static createMediaQuery(e){const t=window.matchMedia(e);return this.checkIfValidMediaQuery(t,e),!1!==t&&t}static checkIfValidMediaQuery(e,t){const r=e=>e.replace(/\s+/gm,""),n=void 0!==e.matches&&r(e.media).indexOf(r(t))>=0;return!1===n&&(t=>{console.warn(`Spyne Info: the following query string, "${t}", has been optimized to "${e.media}" by the browser and may not be a valid Media Query item!`)})(t),n}static createMediaQueryHandler(t,r){const n=(e=>t=>(t.mediaQueryName=e,t))(r),o=(s=t,{addHandler:e=>{s.addListener(e)},removeHandler:e=>{s.onchange=()=>{}}});var s;return new e(o.addHandler,o.removeHandler).pipe(Or(n))}static createMergedObsFromObj(e){const t=e.mediaQueries||e.mediaQueries,r=[];return ce((e,t,n)=>{const o=wn.createMediaQuery(e);return!1!==o&&r.push(wn.createMediaQueryHandler(o,t)),r},t),r}}class Pn extends Cn{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:r,srcElement:n,event:o}=e;this.sendChannelPayload(t,r,n,o)})}static getMouseWheelMapFn(e){const t=this.channelActions.CHANNEL_WINDOW_WHEEL_EVENT,r=e.deltaY<=0?"up":"down",{deltaX:n,deltaY:o,deltaZ:s}=e;return{action:t,payload:{scrollDir:r,deltaX:n,deltaY:o,deltaZ:s},srcElement:e.srcElement,event:e}}static createCurriedGenericEvent(e){const t=`CHANNEL_WINDOW_${e.toUpperCase()}_EVENT`;return fe(Pn.mapGenericEvent)(t)}static mapGenericEvent(e,t){return{action:e,payload:t,srcElement:t.srcElement,event:t}}static getResizeMapFn(e){return{action:this.channelActions.CHANNEL_WINDOW_RESIZE_EVENT,payload:ee(["innerWidth","innerHeight","outerWidth","outerHeight"],window),srcElement:e.srcElement,event:e}}static getOrientationMapFn(e){const t=this.channelActions.CHANNEL_WINDOW_ORIENTATION_EVENT,r=window.matchMedia("(orientation: portrait)").matches,n=ee(["innerWidth","innerHeight","outerWidth","outerHeight"],window);n.orientation=!0===r?"portrait":"landscape";return{action:t,payload:n,srcElement:e.srcElement,event:e}}getMediaQueryMapFn(e){return{action:this.channelActions.CHANNEL_WINDOW_MEDIA_QUERY_EVENT,payload:ee(["matches","media","mediaQueryName"],e),srcElement:e.srcElement,event:e}}createMouseWheelObservable(e){const t=e.debounceMSTimeForScroll;return wn.createDomObservableFromEvent("wheel",Pn.getMouseWheelMapFn.bind(this)).pipe(kr(t))}static getScrollData(){let e=0;return t=>{const r=e-t;return e=t,{scrollY:t,scrollDistance:r,scrollDir:r>=0?"up":"down"}}}static getScrollY(e){return void 0!==e.pageYOffset?e.pageYOffset:e.scrollTop}static getScrollMapFn(e,t,r,n,o){const s=n(Pn.getScrollY(o)),{scrollDistance:i}=s;return{action:r,payload:s,srcElement:e.srcElement,scrollDistance:i,event:e}}createScrollObservable(e,t=window,r=!0){const n=e.debounceMSTimeForScroll,o=t,s=t===window,i=void 0!==e.scrollElForVals?e.scrollElForVals:t,a=s?"CHANNEL_WINDOW_SCROLL_EVENT":"CHANNEL_WINDOW_ELEMENT_SCROLL_EVENT",c=Pn.getScrollData(),l=we(Pn.getScrollMapFn,[a,c,i,r,o]).bind(this);return wn.createDomObservableFromEvent("scroll",l,r,o).pipe(kr(n),(u=e=>0===e.scrollDistance,gt(function(e,t){var r=!1,n=0;e.subscribe(_r(t,function(e){return(r||(r=!u(e,n++)))&&t.next(e)}))})),Or(e=>{const t=Pn.getScrollY(o);return e.payload.scrollDistanceAbs=Math.abs(this.currentScrollY-t),this.currentScrollY=t,e}));var u}createOrientationObservable(e){return wn.createDomObservableFromEvent("orientationchange",Pn.getOrientationMapFn.bind(this))}createResizeObservable(e){const t=e.debounceMSTimeForResize;return wn.createDomObservableFromEvent("resize",Pn.getResizeMapFn.bind(this)).pipe(kr(t))}getEventsFromConfig(e=this.domChannelConfig){const t=e.events;return D(e=>{const t=Pn.createCurriedGenericEvent(e);return wn.createDomObservableFromEvent(e,t)},t)}getActiveObservables(e=this.domChannelConfig){let t=[];e.listenForMediaQueries=Nt(e.mediaQueries)||Nt(e.mediaQueries);const r={listenForResize:this.createResizeObservable.bind(this),listenForOrientation:this.createOrientationObservable.bind(this),listenForScroll:this.createScrollObservable.bind(this),listenForWheel:this.createMouseWheelObservable.bind(this)};ce((r,n,o)=>{e[n]&&t.push(r(e))},r),this.checkForMediaQueries(e.listenForMediaQueries);const n=this.getEventsFromConfig(e);return t=t.concat(n),t}checkForMediaQueries(e){const t=e=>{const{action:t,payload:r,srcElement:n,event:o}=e;this.sendChannelPayload(t,r,n,o,this.observer$)};!0===e&&this.getMediaQueryObservable(this.domChannelConfig).subscribe(t)}getMediaQueryObservable(e){const t=this.createMergedObsFromObj(e);return ve(l,t).pipe(Or(this.getMediaQueryMapFn.bind(this)))}addRegisteredActions(){return["CHANNEL_WINDOW_ABORT_EVENT","CHANNEL_WINDOW_AFTERPRINT_EVENT","CHANNEL_WINDOW_ANIMATIONEND_EVENT","CHANNEL_WINDOW_ANIMATIONITERATION_EVENT","CHANNEL_WINDOW_ANIMATIONSTART_EVENT","CHANNEL_WINDOW_APPINSTALLED_EVENT","CHANNEL_WINDOW_BEFOREPRINT_EVENT","CHANNEL_WINDOW_BEFOREUNLOAD_EVENT","CHANNEL_WINDOW_BEGINEVENT_EVENT","CHANNEL_WINDOW_BLUR_EVENT","CHANNEL_WINDOW_CACHED_EVENT","CHANNEL_WINDOW_CHANGE_EVENT","CHANNEL_WINDOW_CLICK_EVENT","CHANNEL_WINDOW_CLOSE_EVENT","CHANNEL_WINDOW_COMPOSITIONEND_EVENT","CHANNEL_WINDOW_COMPOSITIONSTART_EVENT","CHANNEL_WINDOW_COMPOSITIONUPDATE_EVENT","CHANNEL_WINDOW_COPY_EVENT","CHANNEL_WINDOW_CUT_EVENT","CHANNEL_WINDOW_DBLCLICK_EVENT","CHANNEL_WINDOW_DEVICECHANGE_EVENT","CHANNEL_WINDOW_DEVICELIGHT_EVENT","CHANNEL_WINDOW_DEVICEMOTION_EVENT","CHANNEL_WINDOW_DEVICEORIENTATION_EVENT","CHANNEL_WINDOW_DEVICEPROXIMITY_EVENT","CHANNEL_WINDOW_DOMATTRIBUTENAMECHANGED_EVENT","CHANNEL_WINDOW_DOMATTRMODIFIED_EVENT","CHANNEL_WINDOW_DOMCHARACTERDATAMODIFIED_EVENT","CHANNEL_WINDOW_DOMCONTENTLOADED_EVENT","CHANNEL_WINDOW_DOMCONTENTLOADED_EVENT","CHANNEL_WINDOW_DOMELEMENTNAMECHANGED_EVENT","CHANNEL_WINDOW_DRAGEND_EVENT","CHANNEL_WINDOW_DRAGENTER_EVENT","CHANNEL_WINDOW_DRAGLEAVE_EVENT","CHANNEL_WINDOW_DRAGOVER_EVENT","CHANNEL_WINDOW_DRAGSTART_EVENT","CHANNEL_WINDOW_DRAG_EVENT","CHANNEL_WINDOW_DROP_EVENT","CHANNEL_WINDOW_ELEMENT_SCROLL_EVENT","CHANNEL_WINDOW_ERROR_EVENT","CHANNEL_WINDOW_FOCUSIN_EVENT","CHANNEL_WINDOW_FOCUS_EVENT","CHANNEL_WINDOW_FULLSCREENCHANGE_EVENT","CHANNEL_WINDOW_FULLSCREENERROR_EVENT","CHANNEL_WINDOW_HASHCHANGE_EVENT","CHANNEL_WINDOW_INPUT_EVENT","CHANNEL_WINDOW_INVALID_EVENT","CHANNEL_WINDOW_KEYDOWN_EVENT","CHANNEL_WINDOW_KEYPRESS_EVENT","CHANNEL_WINDOW_KEYUP_EVENT","CHANNEL_WINDOW_LOAD_EVENT","CHANNEL_WINDOW_MEDIA_QUERY_EVENT","CHANNEL_WINDOW_MESSAGE_EVENT","CHANNEL_WINDOW_MOUSEDOWN_EVENT","CHANNEL_WINDOW_MOUSEENTER_EVENT","CHANNEL_WINDOW_MOUSELEAVE_EVENT","CHANNEL_WINDOW_MOUSEMOVE_EVENT","CHANNEL_WINDOW_MOUSEOUT_EVENT","CHANNEL_WINDOW_MOUSEOVER_EVENT","CHANNEL_WINDOW_MOUSEUP_EVENT","CHANNEL_WINDOW_MOUSEWHEEL_EVENT","CHANNEL_WINDOW_OFFLINE_EVENT","CHANNEL_WINDOW_ONLINE_EVENT","CHANNEL_WINDOW_OPEN_EVENT","CHANNEL_WINDOW_ORIENTATION_EVENT","CHANNEL_WINDOW_PAGEHIDE_EVENT","CHANNEL_WINDOW_PAGESHOW_EVENT","CHANNEL_WINDOW_PASTE_EVENT","CHANNEL_WINDOW_POPSTATE_EVENT","CHANNEL_WINDOW_POPSTATE_EVENT","CHANNEL_WINDOW_PROGRESSEVENTS_EVENT","CHANNEL_WINDOW_RESET_EVENT","CHANNEL_WINDOW_RESIZE_EVENT","CHANNEL_WINDOW_SCROLL_ELEMENT_ADDED_EVENT","CHANNEL_WINDOW_SCROLL_EVENT","CHANNEL_WINDOW_SCROLL_LOCK_EVENT",["CHANNEL_WINDOW_SCROLL_LOCK_EVENT","onScrollLockEvent"],["CHANNEL_WINDOW_SET_ELEMENT_TO_SCROLL_EVENT","onSetElementToScroll"],"CHANNEL_WINDOW_STORAGE_EVENT","CHANNEL_WINDOW_SUBMIT_EVENT","CHANNEL_WINDOW_TRANSITIONCANCEL_EVENT","CHANNEL_WINDOW_TRANSITIONEND_EVENT","CHANNEL_WINDOW_TRANSITIONRUN_EVENT","CHANNEL_WINDOW_TRANSITIONSTART_EVENT","CHANNEL_WINDOW_UNLOAD_EVENT","CHANNEL_WINDOW_WHEEL_EVENT"]}onScrollLockEvent(e){}onSetElementToScroll(e){let{config:t,el:r,scrollElement:n}=e.payload;t=t||{},t=Ke(this.domChannelConfig,t),n=n||r;this.sendChannelPayload("CHANNEL_WINDOW_SCROLL_ELEMENT_ADDED_EVENT",{el:r},r),this.createScrollObservable(t,n).subscribe(e=>{const{action:t,payload:r,srcElement:n,event:o}=e;this.sendChannelPayload(t,r,n,o)})}bindStaticMethods(){this.createMediaQueryHandler=wn.createMediaQueryHandler.bind(this),this.createMergedObsFromObj=wn.createMergedObsFromObj.bind(this)}}class Un extends Cn{constructor(e={}){super("CHANNEL_LIFECYCLE",e)}addRegisteredActions(){return["CHANNEL_LIFECYCLE_RENDERED_EVENT","CHANNEL_LIFECYCLE_DISPOSED_EVENT"]}onViewStreamInfo(e){const{action:t,srcElement:r}=e,n=r;n.action=t,this.onSendEvent(t,n)}onSendEvent(e,t={}){const r=this.channelActions[e],n={};window.setTimeout(()=>this.sendChannelPayload(r,t,n,void 0),0)}}class Mn extends Cn{constructor(e={}){super("CHANNEL_AI",e)}addRegisteredActions(){return["CHANNEL_AI_RENDERED_EVENT","CHANNEL_AI_DISPOSED_EVENT"]}onViewStreamInfo(e){const{action:t,srcElement:r}=e,n=r;n.action=t,this.onSendEvent(t,n)}onSendEvent(e,t={}){const r=this.channelActions[e],n={};window.setTimeout(()=>this.sendChannelPayload(r,t,n,void 0),0)}}class Wn extends Cn{constructor(e,t={}){t.isProxy=!0,super(e,t),this.props=t,this.subject$=new r,this.replaySub$=new i(1),this.observer$=l(this.subject$,this.replaySub$);!0===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 xn=new Map;class Fn{constructor(){this.addMixins(),xn.set("DISPATCHER",new r),this.listRegisteredChannels=Fn.listRegisteredChannels.bind(this),this.getChannelsList=Fn.getChannelsList.bind(this)}get map(){return xn}static getChannelsList(){return Array.from(xn,(e,t)=>({key:e[0],val:e[1].constructor.name}))}static listRegisteredChannels(e=!1){const t=this.getChannelsList(),r=m(U("ChannelProxy","val")),n=F(U("ChannelProxy","val")),o=(!0===e?n:r)(t);return Pe(["key"],o)}listProxyChannels(){return this.listRegisteredChannels(!0)}checkForMissingChannels(){const e=this.getChannelsList(),t=F(U("ChannelProxy","val"))(e);if(t.length>=1){const e=`Spyne Warning: The following ${1===t.length?"Channel has":"Channels have"} not been initialized: ${d(S(", "),D(v("key")))(t)}`;console.warn(e)}}init(){this.createMainStreams()}createMainStreams(){this.routeStream=new yn,xn.set("CHANNEL_ROUTE",this.routeStream),this.uiStream=new Vn,xn.set("CHANNEL_UI",this.uiStream),this.domStream=new Pn,xn.set("CHANNEL_WINDOW",this.domStream),this.viewStreamLifecycle=new Un,xn.set("CHANNEL_LIFECYCLE",this.viewStreamLifecycle),this.aiStream=new Mn,xn.set("CHANNEL_AI",this.aiStream),this.routeStream.initializeStream(),this.domStream.initializeStream()}addKeyEvent(e){xn.get("UI").addKeyEvent(e)}registerStream(e){const t=e.channelName;if(xn.has(t)){if(d(Ue(["props","isRegistered"],!0))(xn.get(t)))return void console.warn(`Spyne Warning: The Channel, ${t}, has already been registered!`)}xn.set(t,e),e.initializeStream()}getChannelActions(e){return xn.get(e).addRegisteredActions()}getProxySubject(e,t=!1){const r=!0===t?"replaySubject":"subject";return xn.get(e)[r]}testStream(e){return void 0!==xn.get(e)}getStream(e){return!1===this.testStream(e)&&xn.set(e,new Wn(e)),xn.get(e)}addMixins(){}}class $n{constructor(e,t="",r=!0){return this.parentContext=e,this.omittedMethods=["autoBinder","initAutoBinder","getEnhancerMethods","checkForMalformedMethods","caller","arguments","bindParentViewStream"],this.prefix=t,!0===r&&this.autoBinder(),this.allMethodsList}initAutoBinder(){this.autoBinder()}getEnhancerMethods(){return function(e,t=[]){const r=w(["length","name","prototype","constructor"],t),n=d(ae(r),q),o=n(Object.getOwnPropertyNames(e.constructor.prototype)),s=n(Object.getOwnPropertyNames(e.constructor));return{methods:o,staticMethods:s,allMethods:w(o,s)}}(this,this.omittedMethods)}checkForMalformedMethods(e){const t=at?.debug||!1;if(""===this.prefix&&t)return void console.warn(`SPYNE WARNING: The following SpyneTrait ${this.constructor.name} needs a prefix`);const r=m(e=>0===e.indexOf(this.prefix),e);if(r.length>=1&&t){const e=`Spyne Warning: The following method(s) in ${this.constructor.name} require the prefix, "${this.prefix}": [${r.join(", ")}];`;console.warn(e)}}bindParentViewStream(e,t){this.checkForMalformedMethods(e.allMethods);const r={},n=(e,n=!1)=>{const o=!0===n?this.constructor:this;"function"===typeof o[e]&&(r[e]=t[e]=o[e].bind(t))},o=He(2,n)(I,!0);return D(o,e.staticMethods),D(n,e.methods),r}autoBinder(){const e=this.getEnhancerMethods();return this.allMethodsList=this.bindParentViewStream(e,this.parentContext),this.allMethodsList}}class kn{constructor(e,t,r,n){((e=!0)=>{bn=!!e})(!0);this._mapFn=kn.setMapFn(e),this._url=kn.setUrl(e),this._responseType=kn.setResponseType(e),this._serverOptions=kn.setServerOptions(e),this._subscriber=void 0!==t?t:e=>console.log("FETCH RETURNED ",e),this.debug=void 0!==e.debug&&e.debug,this.disableSanitize=e?.disableSanitize,this.channelName=n;const o={mapFn:this.mapFn,url:this.url,serverOptions:this.serverOptions,responseType:this.responseType,disableSanitize:this.disableSanitize,debug:this.debug};!0!==r&&kn.startWindowFetch(o,this._subscriber,this.channelName)}static startWindowFetch(e,t,r){const{mapFn:n,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:r}):()=>{},l=u(window.fetch(o,s)).pipe(Xr(c),Br(e=>u(e[i]())),Or((t=>{const n={channelName:r,url:o,responseType:i,serverOptions:s};return r=>{const o=!0===e?.disableSanitize?r:Rn(r);return t(o,n)}})(n)),qr());l.connect(),l.subscribe(t)}static setMapFn(e){return d(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"),d(De(Oe("body"),JSON.stringify)))(e)}static updateMethodWhenBodyExists(e){const t=B("body"),r=U("GET","method"),n=f([t,r]);return b(n,g("method","POST"))(e)}static setServerOptions(e){const t=ee(["method","headers","body","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive"],e);let r=te(kn.baseOptions(),t);return r=kn.updateMethodWhenBodyExists(r),r=kn.stringifyBodyIfItExists(r),r}static baseOptions(){return{method:"GET",headers:new Headers({Accept:"application/json, text/plain, */*"}),mode:"cors",credentials:"same-origin",cache:"default",redirect:"follow",referrer:"client",referrerPolicy:"no-referrer-when-downgrade",integrity:"",keepalive:!1}}}class jn extends Cn{constructor(e,t={disableSanitize:!1}){jn.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,r=!1){const n=P(_,e=>"function"!=typeof e),o=Ae(n),s=f([o,e=>e.length>=1]);return!d(s,N,ee(["map","mapFn"]))(e)||(!1===r&&console.warn(`Spyne Warning: The map method for ChannelFetch, ${t}, appears to be invalid`),!1)}onRegistered(e=this.props){!0!==e?.pause&&this.startFetch()}addRegisteredActions(e){const t=d(k([]),K(["props","extendedActionsArr"]));return["CHANNEL_RESPONSE_EVENT",["CHANNEL_UPDATE_RESPONSE_EVENT","onFetchUpdate"],["CHANNEL_FETCH_REQUEST_EVENT","onFetchUpdate"]].concat(t(this))}startFetch(e={},t=this.onFetchReturned.bind(this)){const r=this.consolidateAllFetchProps(e);return new kn(r,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:r,sendCachedPayload:n,url:o}=this.props,s={name:r,sendCachedPayload:n,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 r=ee(["mapFn","url","header","body","mode","disableSanitize","method","responseType","debug"],t),n=m(_);return d(n,(e,t)=>te(e,t))(r,e)}get observer(){return this.observer$}}let Gn=at;class zn{constructor(e={}){let{name:t,config:r,parentEl:n}=e;this.props=e,void 0===r&&(r=re(e)),this.name=t||"empty",this.props.name=t,r=zn.mergeDefaultConfig(r,this.defaultConfig()),this.props.parentEl=n||zn.createParentEl(),this.props.config=r,void 0!==this.props.traits&&this.addTraits(this.props.traits)}register(e){Gn=e,this.props.pluginName=this.props.name,!1!==Gn.initialized?(this.onBeforeRegistered(),this.props.config=re(this.props.config),Gn.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 Gn}static mergeDefaultConfig(e={},t=this.defaultConfig()){return Object.assign(t,e)}static getSpyneApp(e,t){!1===Gn.initialized?console.warn(`Spyne Warning: Unable to install plugin, ${e}! SpyneApp has not been initialized!`):Gn.addPluginConfig(e,t)}static updateSpyneConfig(e,t,r){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]=r,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"),r=e.filter(e=>!t.events.includes(e));r.length>0&&console.warn(`plugin "${this.props.name}" requires the following config.WINDOW.events, --\x3e ${r.join(", ")} <--`)}defaultConfig(){return{}}onRegistered(){}onRender(){}}const Yn=new Fn,Bn="0.23.0";let Kn=new class{constructor(){this.version=Bn}get channels(){return Yn}init(e={},t=!1){
|
|
2
2
|
/*!
|
|
3
|
-
* Spyne 0.
|
|
3
|
+
* Spyne 0.23.0
|
|
4
4
|
* https://spynejs.org
|
|
5
5
|
*
|
|
6
6
|
* @license
|
|
@@ -14,5 +14,5 @@ import{fromEventPattern as e,Observable as t,Subject as n,bindCallback as r,from
|
|
|
14
14
|
*
|
|
15
15
|
* This notice may not be removed or altered from any distribution.
|
|
16
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
|
|
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 r={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(r,e,Yn,t)}this.pluginsFn=at.getPluginsMethodObj(e.pluginMethods),this.getChannelActions=e=>Yn.getChannelActions(e),this.registerChannel=e=>Yn.registerStream(e),this.registerPlugin=e=>at.registerPlugin(e),this.registerDataChannel=e=>Yn.registerStream(e),this.listChannels=()=>Array.from(Yn.map.keys());let n=new Tn({id:"spyne-null-views"});n.appendToDom(document.body),n.props.el.style.cssText="display:none; opacity:0; pointer-events:none;",Yn.init(),!0===at.config.debug&&(window.Spyne={version:Bn}),((e={})=>{if(ft)return void console.warn("sanitizeHTML is already configured. Reconfiguration is not allowed.");const{strict:t=!0,allowTargetAttr:r=!0,addNoopener:n=!0}=e;if(!t)return _t=e=>e,void(ft=!0);const o={RETURN_TRUSTED_TYPE:!1,ADD_ATTR:r?["target"]:[]},s=e=>xe.sanitize(e,o);if(r&&xe.addHook("afterSanitizeAttributes",e=>{if(!e||"function"!=typeof e.getAttribute)return;if("A"!==e.tagName)return;const t=e.getAttribute("href"),r=e.getAttribute("target");if(t||!r){if(r)if(["_blank","_self","_parent","_top"].includes(r)){if("_blank"===r&&n){const t=(e.getAttribute("rel")||"").split(/\s+/).filter(Boolean),r=new Set(t);r.add("noopener"),r.add("noreferrer"),e.setAttribute("rel",Array.from(r).join(" "))}}else e.removeAttribute("target")}else e.removeAttribute("target")}),window.trustedTypes){const e=window.trustedTypes.createPolicy("default",{createHTML:e=>s(e)});_t=t=>e.createHTML(t)}else _t=e=>s(e);ft=!0})(at.config),Dn(at.config)}static listChannels(){return Array.from(Yn.map.keys())}static getChannelActions(e){return Yn.getChannelActions(e)}static registerChannel(e){if(!1!==at.initialized)return Yn.registerStream(e);console.warn("Spyne has not been initialized")}};export{Cn as Channel,jn as ChannelFetch,kn as ChannelFetchUtil,dt as ChannelPayload,dn as ChannelPayloadFilter,Fn as ChannelsMap,Tt as DomElement,mt as DomElementTemplate,Kn as SpyneApp,at as SpyneAppProperties,zn as SpynePlugin,$n as SpyneTrait,Tn as ViewStream,nn as ViewStreamBroadcaster,Zr as ViewStreamElement,tn as ViewStreamPayload,mn as ViewStreamSelector,Ke as deepMerge,ut as safeClone,Rn as sanitizeData,Hn as sanitizeEventTarget};
|
|
18
18
|
//# sourceMappingURL=spyne.esm.js.map
|