spyne 0.20.4 → 0.20.5
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 +13 -8
- package/lib/spyne.esm.js.map +1 -1
- package/lib/spyne.umd.js +2 -2
- package/lib/spyne.umd.js.LICENSE.txt +12 -7
- package/package.json +1 -1
- package/src/spyne/channels/channel.js +42 -2
- package/src/spyne/spyne-app.js +12 -7
- package/src/spyne/utils/channel-payload-filter.js +18 -1
- package/src/spyne/views/view-stream-broadcaster.js +12 -1
package/lib/spyne.esm.js
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
import{compose as e,not as t,is as r,allPass as n,keys as o,prop as s,path as i,fromPairs as a,toPairs as c,clone as l,mergeAll as d,includes as h,pickAll as u,lte as E,defaultTo as p,match as N,head as _,filter as T,test as m,__ as A,concat as f,without as C,uniq as y,complement as g,isEmpty as I,values as v,isNil as b,ifElse as S,reject as L,mapObjIndexed as O,pipe as D,pick as H,forEachObjIndexed as R,flip as V,mergeRight as w,propSatisfies as P,forEach as U,props as M,omit as W,find as F,always as x,flatten as $,map as k,any as G,equals as j,curry as Y,where as z,split as B,all as K,slice as q,toLower as Q,either as X,findIndex as J,apply as Z,propEq as ee,identity as te,chain as re,objOf as ne,view as oe,lensIndex as se,assoc as ie,when as ae,join as ce,replace as le,findLastIndex as de,last as he,invert as ue,reduce as Ee,zipObj as pe,has as Ne,mergeDeepRight as _e,lensProp as Te,over as me,reverse as Ae,curryN as fe,toUpper as Ce,partialRight as ye,pluck as ge,pathEq as Ie,propIs as ve,pathSatisfies as be}from"ramda";import{Observable as Se,Subject as Le,bindCallback as Oe,fromEvent as De,of as He,ReplaySubject as Re,fromEventPattern as Ve,merge as we,from as Pe}from"rxjs";import Ue from"dompurify";const Me=Object.create({}),We=e(t,r(Array)),Fe=e(n([We,r(Object)]));function xe(e){return e&&"object"==typeof e&&"[object RegExp]"!==Object.prototype.toString.call(e)&&"[object Date]"!==Object.prototype.toString.call(e)}function $e(e,t){return t&&!0===t.clone&&xe(e)?Ge((r=e,Array.isArray(r)?[]:{}),e,t):e;var r}function ke(e,t,r){const n=e.slice();return t.forEach((function(t,o){void 0===n[o]?n[o]=$e(t,r):xe(t)?n[o]=Ge(e[o],t,r):-1===e.indexOf(t)&&n.push($e(t,r))})),n}function Ge(e,t,r){const n=Array.isArray(t),o=(r||{arrayMerge:ke}).arrayMerge||ke;return n?Array.isArray(e)?o(e,t,r):$e(t,r):function(e,t,r){const n={};return xe(e)&&Object.keys(e).forEach((function(t){n[t]=$e(e[t],r)})),Object.keys(t).forEach((function(o){xe(t[o])&&e[o]?n[o]=Ge(e[o],t[o],r):n[o]=$e(t[o],r)})),n}(e,t,r)}let je,Ye,ze,Be;Ge.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 Ge(e,r,t)}))};let Ke,qe=!0;const Qe=[],Xe=new Map,Je=new class{constructor(){Me.foo=()=>console.log("used for testing purposes.")}addMethod(e,t,r=!1){if(!0===Object.prototype.hasOwnProperty.call(Me,e)){const t=`Spyne Warning: the method name, ${e}, already exists.`;if(r)return t;console.warn(t)}else Me[e]=t}addMethods(e={},t=!1){let r;if(!1===Fe(e))return r=`Spyne Warning: the pluginMethods property, ${JSON.stringify(e)} needs to be an object.`,t?r:void console.warn(r);return o(e).map((n=>{const o=s(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 Me}};const Ze=new class{constructor(){Be=!1}get channelsMap(){return ze}get initialized(){return Be}get config(){return je}get debug(){return qe}static listChannels(){return Array.from(Ye.map.keys())}initialize(e={},t={},r,n){return Ye=r,je=Ge(e,t),je.channels&&je.channels.ROUTE&&(je=n.conformRouteObject(je)),Ke=je?.IMG_PATH,qe=void 0!==je.debug?je.debug:qe,this.getChannelActions=Ye.getChannelActions.bind(Ye),this.listRegisteredChannels=Ye.listRegisteredChannels.bind(Ye),Be=!0,this._initialized=Be,this.setChannelsMap(),t?.baseHref&&this.setHeadBaseHref(t.baseHref),je}setHeadBaseHref(e){const t=document.createElement("base");t.href=e,document.head.appendChild(t)}conformRouteConfig(e=!1){je=SpyneUtilsChannelRoute.conformRouteObject(je,e)}setChannelsMap(){const e=Ye.getStream.bind(Ye),t=Ye.testStream.bind(Ye),r=Ye.getProxySubject.bind(Ye);ze={getStream:e,testStream:t,getProxySubject:r}}setProp(e,t){je.tmp[e]=t}getProp(e){return i(["tmp",e],je)}setChannelConfig(e,t){return je.channels[e]=t,je.channels[e]}getChannelConfig(e,t=je){if("CHANNEL_ROUTE"===e?e="ROUTE":"CHANNEL_WINDOW"===e&&(e="WINDOW"),void 0===t||void 0===je.channels)return void console.warn("Spyne warning: Spyne config object is empty!");const r=je.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===je.plugins&&(je.plugins={}),this.addPluginMethods(t.pluginMethods),je.plugins[e]=t}getPluginsMethodObj(e){return e&&this.addPluginMethods(e),Je.pluginMethodsObj}addPluginMethods(e){e&&Je.addMethods(e)}doNotTrackChannel(e){Qe.push(e)}getUntrackedChannelsList(){return Qe}registerProxyReviver(e,t){Xe.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 Xe.get(e)}getPluginConfigByPluginName(e){return je.plugins[e]}get IMG_PATH(){return Ke}tempGetChannelsInstance(){}tempGetConfig(){}},et=()=>({includes:()=>!0===Ze.initialized?Ze.listRegisteredChannels():["CHANNEL_ROUTE","CHANNEL_UI","CHANNEL_WINDOW","DISPATCHER"]});void 0!==e&&void 0!==Se&&(e(r(String),i(["data","srcElement","vsid"])),e(r(String),i(["data","srcElement","id"])));const tt=(e,t)=>{const{__proxy__proxyName:r}=e;void 0===r&&console.error("object is not proxy object ",e);const n=(r,n)=>{const o=i(n,e),{__proxy__isProxy:s,__proxy__props:a}=o;return s?t(r,a):r},o=n(l(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},rt=function(t){const{__proxy__proxyName:n}=t;if(void 0!==n){const e=Ze.getProxyReviver(n);if("function"==typeof e)return tt(t,e)}const o=r(Array),s=r(Object);var i;return!1===o(i=t)&&!0===s(i)?e(a,c,l)(t):l(t)};class nt{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=nt.deepFreeze(r);if(a.payload=c,!0===Ze.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=Ze.getChannelActions(i);nt.validateAction(t,i,e)}a.clone=()=>d([{payload:rt(a.payload)},a.payload,{channel:l(i)},{event:l(o)},{srcElement:n},l(a.srcElement),{action:l(a.action)}]);const h={$dir:{get:()=>a._dir,set:e=>(a._dir=e,e)}};return"CHANNEL_ROUTE"===i&&(h.location={get:()=>nt.getLocationData()}),a._dir=void 0,Object.defineProperties(a,h),s&&console.timeEnd(s),a}static validateAction(e,t,r){const n=h(e,r);return!1===n&&!0===Ze.initialized&&console.warn(`warning: Action: '${e}' is not registered within the ${t} channel!`),n}static getLocationData(){return u(["href","origin","protocol","host","hostname","port","pathname","search","hash"],window.location)}static getStreamItem(){}static deepClone(t){const n=r(Array),o=r(Object);var s;return!1===n(s=t)&&!0===o(s)?e(a,c,l)(t):l(t)}static deepFreeze(t){const r=e(E(0),p(-1),s("nodeType"));try{Object.freeze(t),Object.getOwnPropertyNames(t).forEach((function(e){!Object.prototype.hasOwnProperty.call(t,e)||!1!==r(t[e])||null===t[e]||"object"!=typeof t[e]&&"function"!=typeof t[e]||Object.isFrozen(t[e])||nt.deepFreeze(t[e])}))}catch(e){return t}return t}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 ot(){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 st=async(e,t)=>{window.setTimeout((async()=>{var t;await(t=1,new Promise((e=>setTimeout(e,t)))),window.requestAnimationFrame(e)}),t)},it=e=>{if(void 0!==e.constructor.name)return e.constructor.name;const t=e.toString();return p(String(t).substr(0,12),N(/^(function\s)(\w+)(\(.*)$/,t)[2])},at=t=>{const r=e(g(I),_,v),o=e(g(b),_,v);return n([r,o])(t)};let ct,lt=!1;class dt{constructor(e,t={},n={}){this.template=this.formatTemplate(e),this.isProxyData=!0===t.__cms__isProxy,this.testMode=n?.testMode;(()=>{!0===r(Array,t)&&(t={spyneData:t},this.template=this.template.replace("{{/}}","{{/spyneData}}"),this.template=this.template.replace("{{#}}","{{#spyneData}}"))})(),this.templateData=t;const o=dt.getStringArray(this.template);let s=this.template.match(dt.findTmplLoopsRE());s=null===s?[]:s;const i=dt.parseTmplLoopsRE(),a=this.parseTheTmplLoop.bind(this),c=h(A,s),l=S(c,((e,t)=>e.replace(i,a)),this.addParams.bind(this));this.finalArr=o.map(l)}static isPrimitiveTag(e){return/({{\.\*?}})/.test(e)}static getNestedDataReducer(e={},t=""){return/(\.)/gm.test(String(t))?String(t).split(".").reduce(((e,t)=>e[t]?e[t]:"string"==typeof e?e:""),e):e[t]??""}static getStringArray(e){const t=e.split(dt.findTmplLoopsRE()),r=/^([\\n\s\W]+)$/;return L((e=>e.match(r)),t)}static findTmplLoopsRE(){return/({{#[\w.]+}}[\w\n\s\W]+?{{\/[\w.]+}})/gm}static parseTmplLoopsRE(){return/({{#([\w.]+)}})([\w\n\s\W]+?)({{\/\2}})/gm}static swapParamsForTagsRE(){return/({{)(.*?)(}})/gm}removeThis(){void 0!==this&&(this.finalArr=void 0,this.templateData=void 0,this.template=void 0)}renderDocFrag(){let e=dt.replaceImgPath(this.finalArr.join(""));!0!==this.testMode&&(e=(e=>{if(!lt)throw new Error("sanitizeHTML is not configured. Call sanitizeHTMLConfigure() with appropriate config.");return ct(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=dt.replaceImgPath(e),window.setTimeout(this.removeThis,2),e}getTemplateString(){return this.finalArr.join("")}formatTemplate(e){return!0===["SCRIPT","TEMPLATE"].includes(s("nodeName",e))?e.innerHTML:e}getDataValFromPathStr(e,t){const r=String(e).split(".");return i(r,t)||""}addParams(e){return e.replace(dt.swapParamsForTagsRE(),((e,t,r,n)=>dt.getNestedDataReducer(this.templateData,r)))}static replaceImgPath(e){const{IMG_PATH:t}=Ze;return void 0!==t?(e=e.replaceAll(/src\s*=\s*(['"])imgs\//g,`src=$1${t}`)).replaceAll(/url\(\s*(['"]?)imgs\//g,`url($1${t}`):e}parseTheTmplLoop(e,t,r,n){const o=/(\.)/gm,s=n;let i=dt.getNestedDataReducer(this.templateData,r);const a=(e,t,r)=>{if(dt.isPrimitiveTag(t))return c(e,t);return l((()=>{const t=e,n=r,o=r+1;if(this.isProxyData){return{spyneLoopKey:t,__cms__dataId:i.__cms__dataId,origKey:i[`__cms__keyFor_${e}`],loopIndex:n,loopNum:o,d:e}}return{spyneLoopKey:t,loopIndex:n,loopNum:o}})(),t,r)},c=(e,t,r,n)=>t.replace(dt.swapParamsForTagsRE(),e),l=(e,t,r)=>t.replace(dt.swapParamsForTagsRE(),((t,n,s)=>{const i={loopIndex:r,loopNum:r+1};if(!1===o.test(s)&&void 0!==e[s])return void 0!==i[s]?i[s]:e[s];const a=this.getDataValFromPathStr(s,e);return void 0!==i[s]?i[s]:a}));return!0===b(i)||I(i)?"":(void 0===i.length&&(i=[i]),i.map(((e,t)=>"string"==typeof e?a(e,s,t):l(e,s,t))).join(""))}}class ht{constructor(e={},t=!1){var r,n;e.tagName=(r="div",n=e.tagName,p(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?R(n,t):e.setAttribute(r,t)})),e}updateAttrs(e,t){const r=void 0!==t?t:new Map;return O(((e,t)=>r.set(t,e)),e),r}addTemplate(e){const t=this.getProp("template");return void 0!==t?(t=>{let n=this.getProp("data");n=r(Object,n)?n:{};const o=new dt(t,n,{testMode:this?.testMode}).renderDocFrag();return r(String,o)?e.innerHTML=o:e.appendChild(o),e})(t):e}createElement(e="div"){return document.createElement(e)}addContent(e){const t=this.getProp("data");if(!0===r(String,t)){const r=document.createTextNode(t);e.appendChild(r)}return e}execute(){const e=D(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:Ge(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=ot();this.gc=e.gc.bind(this)}getDomAttributes(e){return H(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 ut=(e=!1,t=1,r="ease",n=!1)=>`${!0===n?"opacity:0;":""}transition: opacity ${t}s ${r}; opacity: ${!0===e?1:0};`;function Et(e){return"function"==typeof e}function pt(e){return Et(null==e?void 0:e.lift)}function Nt(e){return function(t){if(pt(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 _t=function(e,t){return _t=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])},_t(e,t)};function Tt(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}_t(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function mt(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 At(e,t){var r,n,o,s,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(c){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(i=0)),i;)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 i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],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 ft(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 Ct(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 yt(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 gt(e){return this instanceof gt?(this.v=e,this):new gt(e)}function It(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,o=r.apply(e,t||[]),s=[];return n={},i("next"),i("throw"),i("return"),n[Symbol.asyncIterator]=function(){return this},n;function i(e){o[e]&&(n[e]=function(t){return new Promise((function(r,n){s.push([e,t,r,n])>1||a(e,t)}))})}function a(e,t){try{(r=o[e](t)).value instanceof gt?Promise.resolve(r.value.v).then(c,l):d(s[0][2],r)}catch(e){d(s[0][3],e)}var r}function c(e){a("next",e)}function l(e){a("throw",e)}function d(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}}function 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=ft(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;function bt(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 St=bt((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 Lt(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var Ot=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=ft(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(Et(c))try{c()}catch(e){o=e instanceof St?e.errors:[e]}var l=this._finalizers;if(l){this._finalizers=null;try{for(var d=ft(l),h=d.next();!h.done;h=d.next()){var u=h.value;try{Rt(u)}catch(e){o=null!=o?o:[],e instanceof St?o=yt(yt([],Ct(o)),Ct(e.errors)):o.push(e)}}}catch(e){r={error:e}}finally{try{h&&!h.done&&(n=d.return)&&n.call(d)}finally{if(r)throw r.error}}}if(o)throw new St(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)Rt(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)&&Lt(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&Lt(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}(),Dt=Ot.EMPTY;function Ht(e){return e instanceof Ot||e&&"closed"in e&&Et(e.remove)&&Et(e.add)&&Et(e.unsubscribe)}function Rt(e){Et(e)?e():e.unsubscribe()}var Vt={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},wt={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=wt.delegate;return(null==o?void 0:o.setTimeout)?o.setTimeout.apply(o,yt([e,t],Ct(r))):setTimeout.apply(void 0,yt([e,t],Ct(r)))},clearTimeout:function(e){var t=wt.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function Pt(e){wt.setTimeout((function(){throw e}))}function Ut(){}var Mt=null;function Wt(e){if(Vt.useDeprecatedSynchronousErrorHandling){var t=!Mt;if(t&&(Mt={errorThrown:!1,error:null}),e(),t){var r=Mt,n=r.errorThrown,o=r.error;if(Mt=null,n)throw o}}else e()}var Ft=function(e){function t(t){var r=e.call(this)||this;return r.isStopped=!1,t?(r.destination=t,Ht(t)&&t.add(r)):r.destination=Yt,r}return Tt(t,e),t.create=function(e,t,r){return new Gt(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}(Ot),xt=Function.prototype.bind;function $t(e,t){return xt.call(e,t)}var kt=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){jt(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){jt(e)}else jt(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){jt(e)}},e}(),Gt=function(e){function t(t,r,n){var o,s,i=e.call(this)||this;Et(t)||!t?o={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:i&&Vt.useDeprecatedNextContext?((s=Object.create(t)).unsubscribe=function(){return i.unsubscribe()},o={next:t.next&&$t(t.next,s),error:t.error&&$t(t.error,s),complete:t.complete&&$t(t.complete,s)}):o=t;return i.destination=new kt(o),i}return Tt(t,e),t}(Ft);function jt(e){Pt(e)}var Yt={closed:!0,next:Ut,error:function(e){throw e},complete:Ut},zt="function"==typeof Symbol&&Symbol.observable||"@@observable";function Bt(e){return e}var Kt=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 Ft||function(e){return e&&Et(e.next)&&Et(e.error)&&Et(e.complete)}(n)&&Ht(n)?e:new Gt(e,t,r);return Wt((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=qt(t))((function(t,n){var o=new Gt({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[zt]=function(){return this},e.prototype.pipe=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return(0===(e=t).length?Bt:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)})(this)},e.prototype.toPromise=function(e){var t=this;return new(e=qt(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 qt(e){var t;return null!==(t=null!=e?e:Vt.Promise)&&void 0!==t?t:Promise}var Qt="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function Xt(e){if(e instanceof Kt)return e;if(null!=e){if(function(e){return Et(e[zt])}(e))return i=e,new Kt((function(e){var t=i[zt]();if(Et(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if((s=e)&&"number"==typeof s.length&&"function"!=typeof s)return o=e,new Kt((function(e){for(var t=0;t<o.length&&!e.closed;t++)e.next(o[t]);e.complete()}));if(Et(null==(n=e)?void 0:n.then))return r=e,new Kt((function(e){r.then((function(t){e.closed||(e.next(t),e.complete())}),(function(t){return e.error(t)})).then(null,Pt)}));if(function(e){return Symbol.asyncIterator&&Et(null==e?void 0:e[Symbol.asyncIterator])}(e))return Jt(e);if(function(e){return Et(null==e?void 0:e[Qt])}(e))return t=e,new Kt((function(e){var r,n;try{for(var o=ft(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(function(e){return Et(null==e?void 0:e.getReader)}(e))return Jt(function(e){return It(this,arguments,(function(){var t,r,n;return At(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,gt(t.read())];case 3:return r=o.sent(),n=r.value,r.done?[4,gt(void 0)]:[3,5];case 4:return[2,o.sent()];case 5:return[4,gt(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]}}))}))}(e))}var t,r,n,o,s,i;throw function(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.")}(e)}function Jt(e){return new Kt((function(t){(function(e,t){var r,n,o,s;return mt(this,void 0,void 0,(function(){var i,a;return At(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 Zt(e,t,r,n,o){return new er(e,t,r,n,o)}var er=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 Tt(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}(Ft),tr=function(e){function t(t,r){return e.call(this)||this}return Tt(t,e),t.prototype.schedule=function(e,t){return this},t}(Ot),rr={setInterval:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=rr.delegate;return(null==o?void 0:o.setInterval)?o.setInterval.apply(o,yt([e,t],Ct(r))):setInterval.apply(void 0,yt([e,t],Ct(r)))},clearInterval:function(e){var t=rr.delegate;return((null==t?void 0:t.clearInterval)||clearInterval)(e)},delegate:void 0},nr=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 Tt(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),rr.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&&rr.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,Lt(n,this),null!=t&&(this.id=this.recycleAsyncId(r,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(tr),or={now:function(){return(or.delegate||Date).now()},delegate:void 0},sr=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=or.now,e}(),ir=new(function(e){function t(t,r){void 0===r&&(r=sr.now);var n=e.call(this,t,r)||this;return n.actions=[],n._active=!1,n}return Tt(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}(sr))(nr);function ar(e,t){return Nt((function(r,n){var o=0;r.subscribe(Zt(n,(function(r){n.next(e.call(t,r,o++))})))}))}function cr(e,t,r){return void 0===r&&(r=1/0),Et(t)?cr((function(r,n){return ar((function(e,o){return t(r,e,n,o)}))(Xt(e(r,n)))}),r):("number"==typeof t&&(r=t),Nt((function(t,n){return function(e,t,r,n,o,s,i,a){var c=[],l=0,d=0,h=!1,u=function(){!h||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;Xt(r(e,d++)).subscribe(Zt(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?function(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);e.add(s)}(t,i,(function(){return p(e)})):p(e)};c.length&&l<n;)e();u()}catch(e){t.error(e)}})))};return e.subscribe(Zt(t,E,(function(){h=!0,u()}))),function(){null==a||a()}}(t,n,e,r)})))}var lr=bt((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),dr=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 Tt(t,e),t.prototype.lift=function(e){var t=new hr(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new lr},t.prototype.next=function(e){var t=this;Wt((function(){var r,n;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var o=ft(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;Wt((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;Wt((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?Dt:(this.currentObservers=null,s.push(e),new Ot((function(){t.currentObservers=null,Lt(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 Kt;return e.source=this,e},t.create=function(e,t){return new hr(e,t)},t}(Kt),hr=function(e){function t(t,r){var n=e.call(this)||this;return n.destination=t,n.source=r,n}return Tt(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:Dt},t}(dr);var ur={connector:function(){return new dr}};function Er(e,t){void 0===t&&(t=ur);var r=t.connector;return Nt((function(t,n){var o,s=r();Xt(e((o=s,new Kt((function(e){return o.subscribe(e)}))))).subscribe(n),n.add(t.subscribe(s))}))}function pr(e,t){return void 0===t&&(t=ir),Nt((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(Zt(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})))}))}function Nr(e,t){return Nt((function(r,n){var o=0;r.subscribe(Zt(n,(function(r){return e.call(t,r,o++)&&n.next(r)})))}))}function _r(e){return Nt((function(t,r){try{t.subscribe(r)}finally{r.add(e)}}))}var Tr=cr;var mr=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,pt(t)&&(n.lift=t.lift),n}return Tt(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 Ot;var r=this.getSubject();t.add(this.source.subscribe(Zt(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=Ot.EMPTY)}return t},t.prototype.refCount=function(){return Nt((function(e,t){var r=null;e._refCount++;var n=Zt(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}(Kt);function Ar(e){return e?function(t){return Er(e)(t)}:function(e){return function(e,t){var r=Et(e)?e:function(){return e};return Et(t)?Er(t,{connector:r}):function(e){return new mr(e,r)}}(new dr)(e)}}function fr(e,t){return void 0===t&&(t=!1),Nt((function(r,n){var o=0;r.subscribe(Zt(n,(function(r){var s=e(r,o++);(s||t)&&n.next(r),!s&&n.complete()})))}))}function Cr(e,t,r){var n=Et(e)||t||r?{next:e,error:t,complete:r}:e;return n?Nt((function(e,t){var r;null===(r=n.subscribe)||void 0===r||r.call(n);var o=!0;e.subscribe(Zt(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)})))})):Bt}class yr{constructor(e){this.props.observableStreams=yr.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 V(w)({$dir:["internal"]},l(e))}static addDownInternalDir(e,t=["internal","down"]){return V(w)(l(e),{$dir:t})}static addChildAndInternalDir(e,t=["child","down"]){return V(w)(l(e),{$dir:t})}static mapToDefaultDir(e){return this.addDefaultDir(e)}static createDirectionalObservables(e=new Le,t,r){void 0!==t&&void 0!==r&&(e.viewName=t,e.vsid=r);const n=e=>P((t=>t.includes(e)),"$dir"),o=n("parent"),s=n("child"),i=n("internal"),a=e=>w({from$:e}),c=a("child"),l=a("internal"),d=a("parent"),h=e.pipe(Nr((e=>void 0!==e&&void 0!==e.action))),u=e.pipe(Nr(i),ar(l)),E=e.pipe(Nr(o),ar(c)),p=e.pipe(Nr(s),ar(d)),N={parent:E,internal:u,child:p};return{raw$:h,toInternal$:u,toParent$:E,toChild$:p,completeAll:()=>{U((e=>{e.complete(),e.isStopped=!0}),[h,u,E,p])},completeStream:(e=[])=>{const t=e=>{if(void 0!==N[e]){(t=N[e]).complete(),t.isStopped=!0}var t};void 0!==e&&e.length>=1&&e.forEach(t)}}}}class gr{constructor(e,t={},r="",n="theName"){this.addMixins(),this._state="INIT",this.vsid=r,this.vsName=n,this.defaults={debug:!1,extendedHashMethods:{}},this.options=Ge(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=yr.createDirectionalFiltersObject(),this.addDefaultDir=yr.addDefaultDir,this.sourceStreams=yr.createDirectionalObservables(new Le,this.vsName,this.vsid),this._source$=this.sourceStreams.toInternal$}addActionListeners(){return[]}setHashMethods(e={}){return Ge({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=T((e=>void 0!==e),H(["id","className"],this.props)),{tagName:t,data:r,template:n}=this.props;return new ht(t,e,r,n)}onDisposeCompleted(e){}animateInTween(e,t){!function(e,t){const r=1*window.getComputedStyle(e).opacity,n=ut(!0,t,"ease",1===r);e.style.cssText+=n}(e,t)}animateOutTween(e,t,r){!function(e,t,r){const n=ut(!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},n=Oe(((e,r)=>{this.animateOutTween(t,e.animateOutTime,r)})),o=e=>{this._source$.next(r)},s=!0===e.animateOut?e=>(n(e).subscribe(o),{action:"EXTIRPATING",$dir:this.$dirs.CI}):()=>({action:"EXTIRPATE_AND_READY_FOR_VS_DETRITUS_COLLECT",$dir:this.$dirs.CI});return s(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){const t=b(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.domItem.el,$dir:this.$dirs.PI}}renderDomItem(e){const[t,r,n,o]=e;return this.domItem=new ht({tagName:t,attributes:r,data:n,template:o}),this.domItem}onRender(e){return{action:"VS_SPAWNED",el:(e=>this.renderDomItem(e))(M(["tagName","domAttributes","data","template"],e)),$dir:this.$dirs.I}}extendedMethods(e){}onRenderAndAttachToDom(e){return e.attachData.el=(e=>this.renderDomItem(e))(M(["tagName","domAttributes","data","template"],e)),this.combineDomItems(e.attachData),{action:"VS_SPAWNED_AND_ATTACHED_TO_DOM",el:e.attachData.el.el,$dir:this.$dirs.CI}}onObsSinkSubscribe(e){const t=e.action,r=p((e=>this.extendedMethods(e))),n=r(this.options.hashMethods[t])(e);void 0!==n&&(e=>{this._source$.next(e)})(Object.freeze(n))}addMixins(){}}function Ir(){setTimeout((()=>{U((e=>{}),this)}),1)}class vr{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=Ze.channelsMap.getStream("DISPATCHER"),r=rt(e);t.next(r),e=void 0}static deepClone(t){const n=r(Array),o=r(Object);var s;return!1===n(s=t)&&!0===o(s)?e(a,c,l)(t):l(t)}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=Ir}}const br=!0===Ze.debug;class Sr{constructor(e,t){this.addMixins(),this.props=e,this.broadcastFn=t,this.broadcaster(this.broadcastFn)}addDblClickEvt(e){return De(e,"dblclick").pipe(ar((e=>{const t=l(e);return t.typeOverRide="dblclick",t})))}broadcast(e){if(e.length<=0&&!0===br)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,o]=e;let s,i=this.props.el.querySelectorAll(r);if(i.length<=0){const e=this.props.el,t=t=>{t===e&&(i=[t])};(()=>{const n=(null!==e.parentElement?e.parentElement:document).querySelectorAll(r);n.forEach=Array.prototype.forEach,n.forEach(t)})()}const a=void 0!==o,c=e=>{const r="dblClick"!==n?De(e,n,{preventDefault:()=>!0}):this.addDblClickEvt(e);s=e.dataset.channel;const o={};o.payload=(e=>{const t={};for(const r in e)t[r]=e[r];return t})(e.dataset),o.payload=W(["channel"],o.payload),o.channel=s,o.srcElement={},o.srcElement.id=this.props.id,o.srcElement.vsid=this.props.vsid,o.srcElement.isLocalEvent=a,o.srcElement.srcEvent=n,o.srcElement.el=e;(void 0!==s?t[s]:t.UI)(r,o)};!0===(void 0===i||i.length<=0)&&!0===br?console.warn(`Spyne Warning: The item ${r}, does not appear to exist in ${this.props.name} --\x3e vsid:${this.props.vsid}!`):(i.forEach=Array.prototype.forEach,i.forEach(c))}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 vr("CHANNEL_ROUTE",e,t,"subscribe")},sendUIPayload:function(e,t){return new vr("CHANNEL_UI",e,t,"subscribe")}};this.sendUIPayload=e.sendUIPayload,this.sendRoutePayload=e.sendRoutePayload}}const Lr=e(t,r(Array)),Or=e(t,I),Dr=n([r(String),Or]),Hr=n([r(Array),Or]),Rr=e(n([Lr,r(Object)])),Vr=e(n([Or,Lr,r(Object)]));class wr{constructor(t,o={},i,a){Rr(t)&&(t=s("selector",o=t),a=a||s("testMode",o));const c=[i,s("debugLabel",o)];i=e(F(r(String)))(c);let l=W(["debugLabel","label","selector","props","testMode","propFilters"],o);void 0!==o.props?l=d([o.props,l]):void 0!==o.propFilters&&(l=d([o.propFilters,l])),o.propFilters=l;const{propFilters:h}=o,u=Dr(t)?wr.filterSelector([t],i):void 0,E=Hr(t)?wr.filterSelector(t,i):void 0,p=Vr(h)?wr.filterData(h,i):void 0;let N=L(b,[u,E,p]);const _=I(N);return _&&(N=[x(!1)],!0===Ze.debug&&!0!==a&&console.warn(`Spyne Warning: The Channel Filter, with selector: ${t}, and propFilters:${h} appears to be empty!`)),!0===a?{selector:t,propFilters:h,debugLabel:i,filters:o,testMode:a,filtersAreEmpty:_}:n(N)}static filterData(t,n){const o=n;return(()=>{if(I(t))return x(!1);t=k(((e,t,n)=>{var o;return!0===r(String,e)?(o=e,e=>e===o):e}),t);const n=z(t);return e(n,(e=>{if(void 0===o)return e;const r={};return R(((t,n)=>{r[n]=t(s(n,e))}),t),console.log(`%c CHANNEL PAYLOAD FILTER DEBUGGER ["${o}"] - values: `,"color:orange;",{propsBooleans:r,comparedObj:e}),e}),p({}),(e=>{const{payload:t,srcElement:r,event:n}=e||{};return Object.assign({},e,r,n,t)}))})()}static checkPayloadSelector(t,r,n){const{payload:o,srcElement:i,event:a}=n||{},c=[i,o,s("srcElement",a),n].reduce(((e,t)=>{const r=s("el",t);return wr.elIsDomElement(r)&&void 0===e&&(e=r),e}),void 0),l=e=>e.isEqualNode(c),d=e=>{const t=$(document.querySelectorAll(e));return k(l,t)};if(void 0!==r){const n=e($,k(d))(t),o=t;console.log(`%c CHANNEL PAYLOAD FILTER DEBUGGER ["${r}"] - selectors: `,"color:orange;",{el:c,selectorsArr:o,nodeArrResultsDebugger:n})}if("object"!=typeof c)return!1;const h=e($,k(d))(t);return!0!==I(h)&&G(j(!0),h)}static elIsDomElement(t){return r(String,t)&&(t=document.querySelector(t)),e(E(0),p(-1),s("nodeType"))(t)}static filterSelector(e,t){const r=L(I,e);return Y(wr.checkPayloadSelector)(r,t)}}function Pr(){return!0===Ze.debug}function Ur(e,t,r=!1){const n=Wr(e,t,r);return 1===n.length?_(n):n}function Mr(t,r,n){const o=document.querySelector(t),i=e(E(0),p(-1),s("nodeType"));if(null===o||!1!==i(o)){if(void 0!==r&&String(r).trim().length>0){function a(e){try{return document.querySelectorAll(e).length>0}catch(e){return!1}}const c=a(r);!0===n&&!0===Pr()&&!1===c&&console.warn(`Spyne Warning: the selector, ${r} does not exist in this el, ${t}`)}}else console.warn(`Spyne Warning: the el object is not a valid single element, ${o}`)}function Wr(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){Mr(!0===n?"body":e,t,r)}return o}function Fr(e,t,r){return Wr(t,r).forEach((t=>{t.style.cssText=e})),this}function xr(t,r){function n(e){return xr(t,e)}return Mr(t="string"==typeof t?t: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}']`}(t),r,!1),n.map=e=>Array.from(Wr(t,r)).map(e),n.forEach=e=>Array.from(Wr(t,r)).map(e),n.getNodeListArray=()=>Wr(t,r),n.addClass=e=>(Wr(t,r).forEach((t=>t.classList.add(e))),this),n.removeClass=e=>(Wr(t,r).forEach((t=>{t.classList.remove(e)})),this),n.setClass=n=>(Wr(t,r).forEach((t=>{const r=e(L(I),B(" "))(t.className),o=n.split(" ");r.forEach((e=>t.classList.remove(e))),o.forEach((e=>t.classList.add(e)))})),this),n.unmount=()=>{},n.toggleClass=(e,n)=>(Wr(t,r).forEach((t=>{(n=void 0!==n?n:!t.classList.contains(e))?t.classList.add(e):t.classList.remove(e)})),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, ${r} does not appear to be valid!`),n.el),n.addAnimClass=e=>{requestAnimationFrame((()=>{Wr(t,r).forEach((t=>{try{t.classList.add(e)}catch(e){}}))}))},n.setActiveItem=(n,o)=>{const i=Wr(t,r),a="string"==typeof o?Ur(t,o):o,c=e=>e.isEqualNode(a)?e.classList.add(n):e.classList.remove(n);var l;return!0===(l=a,e(E(0),p(-1),s("nodeType"))(l))?i.forEach(c):!0===Pr()&&console.warn(`Spyne Warning: The selector, ${o}, does not appear to be a valid item in setActiveItem: ${n}`),this},Object.defineProperty(n,"el",{get:()=>Ur(t,r,!0)}),Object.defineProperty(n,"els",{get:()=>Wr(t,r)}),Object.defineProperty(n,"len",{get:()=>Wr(t,r,!1).length}),Object.defineProperty(n,"exists",{get:()=>Wr(t,r,!1).length>=1}),Object.defineProperty(n,"exist",{get:()=>Wr(t,r,!1).length>=1}),Object.defineProperty(n,"nodeList",{get:()=>Wr(t,r)}),Object.defineProperty(n,"arr",{get:()=>{const e=Ur(t,r,!0);return void 0===e?[]:void 0===e.length?[e]:Array.from(e)}}),Object.defineProperty(n,"inline",{set:e=>Fr(e,t,r),get:()=>n}),Object.defineProperty(n,"inlineCss",{set:e=>Fr(e,t,r),get:()=>n}),n}class $r{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:gr,extendedSourcesHashMethods:{},debug:!1,template:void 0,node:document.createDocumentFragment(),name:it(this)}},this._state={},this.$dirs=yr.createDirectionalFiltersObject(),this.addDefaultDirection=yr.addDefaultDir,this.addDownInternalDir=yr.addDownInternalDir,this.props=Ge(this.defaults(),e),this.sendLifecycleMethod=!0===this.props.sendLifecyleEvents?this.sendLifecycleMethodActive.bind(this):this.sendLifecycleMethodInactive.bind(this);const t=this.attributesArray;this.props.domAttributes=H(t,this.props),void 0!==this.props.traits&&this.addTraits(this.props.traits),this.loadAllMethods(),this.props.action="LOADED",this.sink$=new Le;const r=this.props.viewClass;this.view=new r(this.sink$,{},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=$r.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 Ze.debug}static checkIfActionsAreRegistered(e=[],t){if(t.length>0){const r=t=>{const r=new RegExp(t);if(J(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=>Ze.getChannelActions(e)));return $(t)})(e);t.forEach(r)}}static isValidNestedArr(t){const n=j(!0),o=K(n),s=r(String),i=e(o,k(s),q(0,2),p([]));return e(o,k(i),p([]))(t)}static elIsDomElement(t){return r(String,t)&&(t=document.querySelector(t)),e(E(0),p(-1),s("nodeType"))(t)}updatePropsToMatchEl(){const t=e(Q,X(s("tagName"),x("")));this.props.tagName=t(this.props.el)}checkIfElementAlreadyExists(){const t=e(E(0),p(-1),s("nodeType"));P(n([e=>document.body.contains(e),t]),"el")(this.props)?(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=Y(this.onChannelMethodCall.bind(this));this.addActionListeners().forEach((t=>{let[n,o,s]=t;r(String,s)&&(s=new wr({selector:s})),this.props.extendedSourcesHashMethods[n]=e(o,s)})),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=Ge({},r);e.$dir=this.$dirs.C,this.sourceStreams.raw$.next(e)}!0===p(x(!0),t)(r)&&n(r=W(["$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 Ge.all([{},t,e])}initViewStream(){this._source$=this._rawSource$.pipe(ar((e=>this.onMapViewSource(e))),fr(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(Nr((e=>void 0!==e&&void 0!==e.action)),ar((e=>{const t=Ge({},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(Nr((e=>void 0!==e&&void 0!==e.action)),Cr((e=>this.tracer("addChildStraem do ",e))),ar((e=>e)),_r((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 H(["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=()=>{n-=1,0===n&&t()};let n=0;this.uberSource$=new Le;this.autoMergeSubject$=this.uberSource$.pipe(cr((e=>{const t=e.observable.pipe(Nr((e=>void 0!==e&&void 0!==e.action)),ar((e=>{const t=Ge({},e);return t.action=e.action,this.tracer("autoMergeSubject$",t),t})));return!1===e.autoClosesBool?t:(n+=1,t.pipe(_r(r)))}))),this.autoSubscriber$=this.autoMergeSubject$.pipe(Nr((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(t={}){const r=p((e=>this.sendExtendedStreams(e))),n=(s=this.props.hashSourceMethods,i=t.action,void 0!==s[i]?i:e(_,T(e(m(A,i),(e=>new RegExp(e)))))(o(s)));var s,i;r(this.props.hashSourceMethods[n])(t),this.tracer("onSubscribeToSourcesNext",{payload:t})}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;Z(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=w(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===$r.isDevMode()&&r(String,t)&&b(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=w(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===$r.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 Sr(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 t=e=>e[0],n=this.addActionListeners(),o=n.map(t);if(!1===$r.isValidNestedArr(n))console.warn(`Spyne Warning: The array returned from addActionsListeners in ${this.props.name}, '${JSON.stringify(n)}', does not appear to be properly formatted!`);else{e(U((e=>{const t=p("",e[1]);!1===r(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!`)})),p([]))(n)}const s=()=>{void 0!==i(["props","addedChannels"],this)&&$r.checkIfActionsAreRegistered.bind(this)(this.props.addedChannels,o)};this.setTimeout(s,500)}}setDataVSID(){this.props.el.dataset.vsid=this.props.vsid}beforeAfterRender(){this.setDataVSID(),this.props.el$=xr(this.props.el)}downStream(){}onRendered(){}onAnimFrameAfterRendered(){}afterRender(){}broadcastEvents(){return[]}getChannel(e){return S((e=>et().includes(e)),(e=>Ze.channelsMap.getStream(e).observer.pipe(fr((e=>!0!==this.deleted)))),(e=>console.warn(`channel name ${e} is not within ${et}`)))(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)}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=i(["srcElement","isLocalEvent"]),a=i(["srcElement","vsid"]),c=[ar((e=>{const t=e;return t.$dir=o,t})),Nr((e=>{const t=a(e);return!0!==s(e)||t===this.props.vsid}))];var l;!0===t&&c.unshift((l=1,Nr((function(e,t){return l<=t}))));const d=this.getChannel(e).pipe(...c);this.updateSourceSubscription(d,!1),this.props.addedChannels.push(e)}checkIfChannelExists(e){const t=Ze.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(t,r={},n){const o=r,i=p("VIEWSTREAM_EVENT"),a=e(i,s(t)),c={payload:o,action:n=n||a({CHANNEL_ROUTE:"CHANNEL_ROUTE_CHANGE_EVENT"})};try{if(c.srcElement=e(H(["id","vsid","class","tagName"]),s("props"))(this),!0===this.checkIfChannelExists(t)){!1===/CHANNEL_LIFECYCLE/.test(n)&&Object.defineProperties(c,{payload:{get:()=>rt(r)}});const e=He(c);return new vr(t,e,c)}}catch(e){console.warn("SPYNE WARNING ",e)}}tracer(...e){this.sendLifecycleMethod(...e)}sendLifecycleMethodInactive(){}sendLifecycleMethodActive(e,t){const r="VS_DETRITUS_COLLECT"===t;!0===z({from$:j("internal"),action:j("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 wr(e,t)}isLocalEvent(e){const t=i(["srcElement","el"],e),r=i(["props","el"],this);return $r.elIsDomElement(r)&&$r.elIsDomElement(t)&&r.contains(t)}addMixins(){const e=ot();this.createId=e.createId}}class kr{constructor(e){const t=String(e.props.name),r=`${t}_ROUTE_UPDATER`;return Y(kr.createTemporaryViewStreamObj)({id:r,name:t})}static createTemporaryViewStreamObj(e,t){const{name:r,id:n}=e,o=t,s=new $r({id:n,name:r,data:t});s.onRendered=()=>{s.sendInfoToChannel("CHANNEL_ROUTE",o)},s.afterBroadcastEvents=()=>{s.disposeViewStream()},s.appendToNull()}}class Gr{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;this.props.sendCachedPayload=void 0===this.props.sendCachedPayload?r:this.props.sendCachedPayload,this.sendPayloadToRouteChannel=new kr(this),this.createChannelActionMethods(),this.streamsController=Ze.channelsMap;const n=this.getMainObserver();this.checkForPersistentDataMode=Gr.checkForPersistentDataMode.bind(this),this.observer$=this.props.observer=n;const o=this.streamsController.getStream("DISPATCHER"),s=ee(t.name,"name");o.pipe(Nr(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 Re(1):new Le}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=I(t),n=void 0!==s("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 n=S(r(String),te,_),o=t.concat(this.addRegisteredActions(e)),s=k(n,o),i=d(re((e=>ne(e,e)),s));this.channelActions=i}createChannelActionMethods(){const e=S(r(String),te,_),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=S(r(String),x("onViewStreamInfo"),(e=>{const r=oe(se(1),e);return t(r,e),r}));this.channelActionMethods=a(k((t=>[e(t),n(t)]),this.addRegisteredActions()))}addRegisteredActions(){let e=[];return i(["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=i(["data","action"],e),n=s(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=j(e.name,this.props.name),{action:r,payload:n,srcElement:o}=e.data,i=t=>({clone:()=>{return t=e.data,d([t,{action:s("action",t)},s("payload",t),s("srcElement",t)]);var t},action:r,payload:n,srcElement:o,event:t});return!0===t?(e=>e.observable.pipe(ar(i)).subscribe(this.getActionMethodForObservable(e)))(e):void 0}onViewStreamInfo(e){}sendChannelPayload(e,t,r={},n={},o=this.observer$){const s=new nt(this.props.name,e,t,r,n);o.next(s)}getChannel(e,t){return S((e=>et().includes(e)),(e=>{const r=this.streamsController.getStream(e).observer;return void 0!==t?r.pipe(Nr(t)):r}),(e=>console.warn(`channel name ${e} is not within ${et}`)))(e)}static checkForNotTrackFlag(e={}){!0===e.doNotTrack&&Ze.doNotTrackChannel(e.channelName)}}class jr{constructor(){this.checkIfObjIsNotEmptyOrNil=jr.checkIfObjIsNotEmptyOrNil.bind(this)}static checkIfObjIsNotEmptyOrNil(t){const r=e(g(I),_,v),o=e(g(b),_,v);return n([r,o])(t)}static checkIfParamValueMatchesRegex(t,n){const i=L(j("routeName")),a=e(i,o),c=e(F((e=>m(new RegExp(e),t))),a)(n);return r(String,c)&&(n=ie(t,s(c,n),n)),n}static formatStrAsWindowLocation(e){return{hash:e,search:e,pathname:e}}static getLocationStrByType(e,t=!1,r=window.location){return s({slash:"pathname",query:"search",hash:"hash"}[!0===t?"hash":e],r).replace(/^(\/)?(#)?(\/)?(.*)$/,"$4")}static createRouteArrayFromParams(e,t,n="slash",o){const i=[],a=t=>{const n={},c=t.routeName;let l=void 0!==e[c]?e[c]:s(c,o);const d=typeof t[l];"string"===d?l=t[l]:"undefined"===d&&(t=this.checkIfParamValueMatchesRegex(l,t)),n[c]=l,this.checkIfObjIsNotEmptyOrNil(n)&&i.push(n);const h=r(Object,t),u=Ne(l,t),E=Ne("routePath",t);if(!0===(u&&h)){const e=t[l];Ne("routePath",e)&&a(e.routePath)}else!0===E&&void 0!==l&&a(t.routePath)};return a(t),i}static createSlashString(t){const r=L(b),n=ae(g(b,A),ce("/")),o=le(/^(\^*)(.*|^\$)(\$)$/,"$2");return e(o,n,r,$,k(v))(t)}static createQueryString(t){const r=L(b),n=this.checkIfObjIsNotEmptyOrNil,o=e(ce("="),$,c),s=S(n,o,x(void 0)),i=k(s),a=ae(g(I),f("?"));return e(a,ce("&"),r,i)(t)}static checkPayloadForRegexOverrides(t,r,n="Value"){const i=e((e=>s(`${e}${n}`,r)),_,o);return k((t=>{const r=i(t);return void 0!==r?ie(e(_,o)(t),r,t):t}),t)}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=Ze.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=jr.checkPayloadForRegexOverrides(l,e),l=jr.checkForRouteValWithMultipleVals(l),"query"===o?this.createQueryString(l):this.createSlashString(l)}static findIndexOfMatchedStringOrRegex(t,r){const n=le(/^$/,"^$"),o=X(ee(t,"str"),e(m(A,t),s("re")));return e(de(j(!0)),k(o),k((e=>{return{str:e,re:(t=e,new RegExp(t))};var t})),k(n))(r)}static checkIfValueShouldMapToParam(t,n,o){const i=e(k(he),k(T(r(String))),c)(t),a=jr.findIndexOfMatchedStringOrRegex(n,i);let l=n;if(a>=0){const n=i[a],o=ue(t),c=e(_,p([]),s(n))(o);!0===/^([-$\w]*)$/.test(c)&&!0===r(String,c)&&(l=c)}return l}static createArrFromSlashStr(e){return e.replace(/^([/])?(.*)$/,"$2").split("/")}static convertSlashRouteStrToParamsObj(e,t,r){const n=t,o=this.createArrFromSlashStr(t),s=[],a=[];let c=e;Ee(((e,t)=>{const n=this.checkIfValueShouldMapToParam(c,t,r);c=this.checkIfParamValueMatchesRegex(t,c);const o=X(I,b);void 0!==c&&(e=>e!==he(s))(c.routeName)&&!1===o(n)&&(s.push(c.routeName),a.push(n));const l=i([t,"routePath"],c),d=i(["routePath"],c);void 0!==l?c=l:void 0!==d&&(c=d)}),0,o);const l=pe(s,a),d=this.getLastArrVal(s);return{paths:s,pathInnermost:d,routeData:l,routeValue:n}}static getLastArrVal(e){return void 0!==he(t=e)?he(t):"";var t}static createDefaultParamFromEmptyStr(e,t){const r={};return r[e.routeName]=this.checkIfValueShouldMapToParam(e,t),r}static convertQueryStrToParams(t,r,n){const s=r,i=r.replace(/^([?])?(.*)$/,"$2"),c=e(k(B("=")),B("&"))(i);let l=a(c),d=k(_,c);!0===I(r)&&(l=this.createDefaultParamFromEmptyStr(t,r,n),d=o(l));return{paths:d,pathInnermost:this.getLastArrVal(d),routeData:l,routeValue:s}}static convertRouteToParams(e,t,r){if(void 0===t)return{};const n=void 0!==r?r:t.type,o=p({},s("regexTokens",t)),i=t.routes.routePath;return"query"===n?this.convertQueryStrToParams(i,e):(e=e.replace(/\/$|$/,"/"),this.convertSlashRouteStrToParamsObj(i,e,o))}}class Yr{constructor(){this.createPopStateStream=Yr.createPopStateStream.bind(this)}static createPopStateStream(e){Ve((function(e){window.onpopstate=e}),(function(){window.onpopstate=function(){}})).subscribe(e)}static getLastArrVal(e){return void 0!==he(t=e)?he(t):"";var t}static compareRouteKeywords(t={},r){const n=(e,t)=>void 0!==t?H(t,e):e;let i=n(t,r);return{pickValues:n,compare:(t={},r)=>{const a=n(t,r),c=t=>e(o,T(ee(!0,t))),l=e(k((e=>{const t=s(e,i),r=s(e,a),n=j(t,r),o=void 0!==t,c=void 0!==r,l=!n,d=!1===o&&!0===c,h=!0===o&&!1===c,u={};return u[e]={same:n,changed:l,added:d,removed:h,previousExists:o,nextExists:c},u})),y,re(o))([i,a]),d=re(c("changed"),l),h=re(c("added"),l),u=re(c("removed"),l);return i=a,{pathsAdded:h,pathsRemoved:u,pathsChanged:d}},getComparer:()=>i}}static getRouteArrData(e,t){const r=T(h(A,e),t);return{paths:r,pathInnermost:Yr.getLastArrVal(r)}}static flattenConfigObject(e){const t=e=>re((([e,r])=>"object"!=typeof r||null===r||Array.isArray(r)?[[e,r]]:k((([t,r])=>[`${e}.${t}`,r]),t(r))),c(e));return v(a(t(e)))}static addRouteDatasets(t){const{type:n,isHash:a}=t,d=e=>{const r="query"===n?"":!0===a?"#":"/",o=jr.convertParamsToRoute(e,t);return r+o.replace(/^(.*\/)([\w-]*\/?)(.*)$/gm,"$1$2")},u=/^([A-Za-z0-9_-])+$/m,E=(e=[],t,n={})=>{let{routeName:a}=t;return c(t).reduce(((t,c)=>{const[h,p]=c,N=r(Object,p),_=e=>m(u,e)?(e=>String(e).replace(/([-_])/g," ").toUpperCase())(e):h;if("routeName"===h||"404"===h)return t;a=a||s("routeName",p);let T=l(n);if(T[a]=String(h).replace(/([^A-Za-z0-9-_])/g,""),!0===N){if(1===o(T).length){const e=i(["routePath","routeName"],p);if(e){const r=l(T);r[e]="",r.navLevel=o(n).length,r.title=_(h),r.href=d(r),t.push(r)}}T=E(e,p,T)}else T.title=_(h),T.href=d(T);return T.navLevel=o(n).length,t.push(T),t}),[])},p=E([],t.routes),N=$(p);return{routeDatasetsArr:N,routeNamesArr:(t=>{const r=L(h(A,["title","href","navLevel"]));return e(y,r,$,k(o))(t)})(N)}}static conformRouteObject(t={},n=!1){const o=i(["channels","ROUTE"],t);let{add404s:s}=void 0!==o?o:t;s=s||n;const l=e=>{const t=e[1],n=r(Array,t);return""===t?e[1]="^$":n&&(e[1]=t.join("|")),e},d=e(a,k((t=>{const[n,o]=t,i=s?{404:".+"}:{},h=r(Object,o),u=r(Array,o),E="routePath"===n;return!0===h&&!1===u&&(t[1]=d(t[1]),E&&(t[1]=e(_e(i),a,k(l),c)(t[1]))),t})),c);if(void 0!==o){t.channels.ROUTE=d(t.channels.ROUTE);const e=Yr.addRouteDatasets(t.channels.ROUTE);return t.channels.ROUTE=w(t.channels.ROUTE,e),t}return d(t)}static getLocationData(){return u(["href","origin","protocol","host","hostname","port","pathname","search","hash"],window.location)}}class zr extends Gr{constructor(e="CHANNEL_ROUTE",t={}){t.sendCachedPayload=!0,super("CHANNEL_ROUTE",t),this.createChannelActionsObj(),this.routeConfigJson=this.getRouteConfig(),this.bindStaticMethods(),this.navToStream$=new Re(1),this.observer$=this.navToStream$.pipe(ar((e=>this.onMapNext(e)))),this.compareRouteKeywords=Yr.compareRouteKeywords()}checkConfigForHash(){!0===("hash"===Ze.config.channels.ROUTE.type)&&(Ze.config.channels.ROUTE.type="slash",Ze.config.channels.ROUTE.isHash=!0)}onRegistered(){this.checkConfigForHash(),this.initStream()}createChannelActionsObj(){const e=this.addRegisteredActions(),t=d(re((e=>ne(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=H(["isHash","isHidden","routes","type"],e.payload);Ze.config.channels.ROUTE=w(Ze.config.channels.ROUTE,t),Ze.conformRouteConfig();const r=this.getRouteConfig();this.routeConfigJson=r,this.bindStaticMethodsWithConfigData(),this.sendChannelPayload("CHANNEL_ROUTE_CONFIG_UPDATED_EVENT",r,{},{},this.navToStream$)}getRouteConfig(){const e=Ze.config,t=i(["channels","ROUTE"],e);"query"===t.type&&(t.isHash=!1);const r=Yr.flattenConfigObject(t.routes);return t.paramsArr=r,t}initStream(){this.firstLoadStream$=new Re(1),this.onIncomingDomEvent(void 0,this.routeConfigJson,"CHANNEL_ROUTE_DEEPLINK_EVENT"),Yr.createPopStateStream(this.onIncomingDomEvent.bind(this)),this.observer$=we(this.firstLoadStream$,this.navToStream$)}onMapNext(e,t=!1){return e.action="CHANNEL_ROUTE_CHANGE_EVENT",e}static removeSSID(e){const t=Te(["routeData"]);return me(t,W(["vsid"]))(e)}static onIncomingDomEvent(e,t=this.routeConfigJson,n){const o=void 0!==n?n:this.channelActions.CHANNEL_ROUTE_CHANGE_EVENT,a=i(["state","routeCount"],e),c=!0===r(Number,a);let l=this.getDataFromString(t,c);!0===c&&(l.routeCount=a),"CHANNEL_ROUTE_DEEPLINK_EVENT"===n&&(l.linksData=s("routeDatasetsArr",t));const d=this.compareRouteKeywords.compare(l.routeData,l.paths);l=w(l,d),this.sendChannelPayload(o,l,void 0,e,this.navToStream$)}static checkForRouteParamsOverrides(e){return e}static checkForEventMethods(t){const r=e(T(m(/^(event)([A-Z].*)([A-Z].*)$/gm)),o,s("payload"))(t);if(r.length>=1){const e=s("event",t);if(void 0!==e){const t=le(/^(event)([A-Z])(.*)([A-Z].*)$/gm,((e,t,r,n,o)=>String(r).toLowerCase()+n+o)),n=r=>{const n=t(r);void 0!==e[n]&&e[n]()};r.forEach(n)}}return t}static checkForEndRoute(t,n=this.routeConfigJson,a){if(!0!==e(j("true"),i(["payload","endRoute"]))(t))return t;const l=void 0!==a?a:!0===Ze.debug,{payload:d}=t;let h=0;const u=(t=[],n)=>{const i=n[1],{routePath:a}=i,E=s("routeName",a),p=(t=>{const r=s("routeName",t);if(r){const n=e(o,W(["routeName"]))(t),s=d[r];return F((e=>new RegExp(`^${e}$`).test(s)),n)}})(a),N=r(Object,i),_=r(Array,i);if(h+=1,!0===N&&!1===_){const r=a[p];r?e(Ae,Ee(u,t),c)({nextRoutePath:r}):1===h?l&&console.warn(`Spyne Warning: use of end route method should add start route value of "${E}".`):t.push(E)}return t},{routes:E}=n,p=e(Ae,Ee(u,[]),c)({routes:E});if(1===p.length){const e=p[0];t.payload[e]=""}return t}onViewStreamInfo(e){const t=this.channelActions.CHANNEL_ROUTE_CHANGE_EVENT;zr.checkForEventMethods(e),e=this.checkForEndRoute(e);let r=this.getDataFromParams(e);const n=s("srcElement",e),o=s("event",e),i=!r.isHidden,a=this.compareRouteKeywords.compare(r.routeData,r.paths);r=w(r,a),this.sendRouteStream(r,i),r=zr.removeSSID(r),this.sendChannelPayload(t,r,n,o,this.navToStream$)}static checkAndConvertStrWithRegexTokens(e,t){return o(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=s("payload",e);const n=this.getRouteStrFromParams(r,t),o=(e,r)=>p(r,s(e,t)),i=o("type","slash"),a=o("isHash",!1),c=jr.formatStrAsWindowLocation(n),l=this.getDataFromLocationStr(i,a,c),{pathInnermost:d,paths:h}=l;r=w(l.routeData,r);const{routeCount:u,isDeepLink:E,isHash:N,isHistory:_,isHidden:T,routeType:m}=this.getExtraPayloadParams(t);return{isDeepLink:E,routeCount:u,pathInnermost:d,paths:h,routeData:r,routeValue:n,isHash:N,isHidden:T,isHistory:_,routeType:m}}static getDataFromString(e=this.routeConfigJson,t=!1){const r=e.type,n=!0===e.isHash,o=jr.getLocationStrByType(r,n),{paths:s,pathInnermost:i,routeData:a,routeValue:c}=zr.getParamsFromRouteStr(o,e,r),{routeCount:l,isDeepLink:d,isHash:h,routeType:u,isHidden:E}=this.getExtraPayloadParams(e,t);return{isDeepLink:d,routeCount:l,pathInnermost:i,paths:s,routeData:a,routeValue:c,isHash:h,isHidden:E,isHistory:t,routeType:u}}static getDataFromLocationStr(e="slash",t=this.routeConfigJson.isHash,r=window.location){const n=void 0!==this.routeConfigJson?this.routeConfigJson.type:e,o=jr.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 u(["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 jr.convertParamsToRoute(e,t,n)}static getParamsFromRouteStr(e,t,r){const n=void 0!==r?r:t.type;return jr.convertRouteToParams(e,t,n)}checkEmptyRouteStr(e,t=!1){const r=I(e);return!0===(!0===r&&!1===t)||!0===(!0===r&&!0===t)?"/":!0===(!1===r&&!0===t)?f("#",e):e}static removeLastSlash(e){return e.replace(/^(.*)(\/)$/,"$1")}setWindowLocation(t){let{isHash:r,routeValue:n,routeType:o}=t;n=this.checkEmptyRouteStr(n,r);const{routeCount:s}=t;if(!0===r||"query"===o){n=zr.removeLastSlash(window.location.pathname)+n,window.history.pushState({routeCount:s},"",n)}else{const t=ae(e(g(j("/")),_),f("/",A));window.history.pushState({routeCount:s},"",t(n))}}getWindowLocation(){return window.location.pathname}bindStaticMethods(){this.checkForEndRoute=zr.checkForEndRoute.bind(this),this.getIsDeepLinkBool=zr.getIsDeepLinkBool.bind(this),this.getDataFromLocationStr=zr.getDataFromLocationStr.bind(this),this.onIncomingDomEvent=zr.onIncomingDomEvent.bind(this),this.getDataFromString=zr.getDataFromString.bind(this),this.getParamsFromRouteStr=zr.getParamsFromRouteStr.bind(this),this.getLocationData=zr.getLocationData.bind(this),this.getRouteState=zr.getRouteState.bind(this),this.getDataFromParams=zr.getDataFromParams.bind(this),this.getRouteCount=zr.getRouteCount.bind(this),this.getExtraPayloadParams=zr.getExtraPayloadParams.bind(this),this.bindStaticMethodsWithConfigData()}bindStaticMethodsWithConfigData(){const e=fe(3,zr.getRouteStrFromParams);this.getRouteStrFromParams=e(A,this.routeConfigJson,this.routeConfigJson.type)}}class Br extends Gr{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=Se.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=Te(["payload"]);return me(t,W(["vsid"]))(e)}onIncomingObservable(e){const t=j(e.name,this.props.name);e.data=Br.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(ar(o)).subscribe(this.onUIEvent.bind(this)))(e):void 0}getActionState(t){const r=i(["event","type"]),n=i(["event","typeOverRide"]),o=e(Ce,X(n,r))(t),s="CHANNEL_UI";return void 0!==o?`${s}_${o}_EVENT`:s}static checkForEventMethods(t){const r=e(T(m(/^(event)([A-Z].*)([A-Z].*)$/gm)),o,s("payload"))(t);if(r.length>=1){const e=s("event",t);if(void 0!==e){const t=le(/^(event)([A-Z])(.*)([A-Z].*)$/gm,((e,t,r,n,o)=>String(r).toLowerCase()+n+o)),n=r=>{const n=t(r);void 0!==e[n]&&"function"==typeof e[n]&&e[n]()};r.forEach(n)}}return t}onUIEvent(e){Br.checkForEventMethods(e),e.action=this.getActionState(e);const t=e.action,{payload:r,srcElement:n}=e,o=e.event;this.sendChannelPayload(t,r,n,o)}}class Kr{constructor(){this.createDomObservableFromEvent=Kr.createDomObservableFromEvent.bind(this)}static createDomObservableFromEvent(e,t,r=!0,n=window){return t=void 0===t?e=>e:t,Ve((t=>n.addEventListener(e,t,{passive:r})),(()=>{n[e]=e=>e})).pipe(ar(t))}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(e,t){const r=(e=>t=>(t.mediaQueryName=e,t))(t),n=(o=e,{addHandler:e=>{o.addListener(e)},removeHandler:e=>{o.onchange=()=>{}}});var o;return new Ve(n.addHandler,n.removeHandler).pipe(ar(r))}static createMergedObsFromObj(e){const t=e.mediaQueries||e.mediaQueries,r=[];return O(((e,t,n)=>{const o=Kr.createMediaQuery(e);return!1!==o&&r.push(Kr.createMediaQueryHandler(o,t)),r}),t),r}}class qr extends Gr{constructor(e="CHANNEL_WINDOW"){super(e),this.bindStaticMethods(),this.currentScrollY=0}initializeStream(){this.domChannelConfig=Ze.config.channels.WINDOW;const e=this.getActiveObservables(),t=we(...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 Y(qr.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:H(["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=H(["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:H(["matches","media","mediaQueryName"],e),srcElement:e.srcElement,event:e}}createMouseWheelObservable(e){const t=e.debounceMSTimeForScroll;return Kr.createDomObservableFromEvent("wheel",qr.getMouseWheelMapFn.bind(this)).pipe(pr(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(qr.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=qr.getScrollData(),l=ye(qr.getScrollMapFn,[a,c,i,r,o]).bind(this);return Kr.createDomObservableFromEvent("scroll",l,r,o).pipe(pr(n),(d=e=>0===e.scrollDistance,Nt((function(e,t){var r=!1,n=0;e.subscribe(Zt(t,(function(e){return(r||(r=!d(e,n++)))&&t.next(e)})))}))),ar((e=>{const t=qr.getScrollY(o);return e.payload.scrollDistanceAbs=Math.abs(this.currentScrollY-t),this.currentScrollY=t,e})));var d}createOrientationObservable(e){return Kr.createDomObservableFromEvent("orientationchange",qr.getOrientationMapFn.bind(this))}createResizeObservable(e){const t=e.debounceMSTimeForResize;return Kr.createDomObservableFromEvent("resize",qr.getResizeMapFn.bind(this)).pipe(pr(t))}getEventsFromConfig(e=this.domChannelConfig){const t=e.events;return k((e=>{const t=qr.createCurriedGenericEvent(e);return Kr.createDomObservableFromEvent(e,t)}),t)}getActiveObservables(e=this.domChannelConfig){let t=[];e.listenForMediaQueries=at(e.mediaQueries)||at(e.mediaQueries);const r={listenForResize:this.createResizeObservable.bind(this),listenForOrientation:this.createOrientationObservable.bind(this),listenForScroll:this.createScrollObservable.bind(this),listenForWheel:this.createMouseWheelObservable.bind(this)};O(((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 Z(we,t).pipe(ar(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=Ge(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=Kr.createMediaQueryHandler.bind(this),this.createMergedObsFromObj=Kr.createMergedObsFromObj.bind(this)}}class Qr extends Gr{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,undefined)),0)}}class Xr extends Gr{constructor(e,t={}){t.isProxy=!0,super(e,t),this.props=t,this.subject$=new Le,this.replaySub$=new Re(1),this.observer$=we(this.subject$,this.replaySub$);!0===Ze.debug&&this.checkIfChannelIsStillProxy(e)}getMergedSubject(e=!1){return!0===e?this.replaySub$:this.subject$}checkIfChannelIsStillProxy(e){const t=e;st((()=>{!0!==h(t,Ze.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 Jr=new Map;class Zr{constructor(){this.addMixins(),Jr.set("DISPATCHER",new Le),this.listRegisteredChannels=Zr.listRegisteredChannels.bind(this),this.getChannelsList=Zr.getChannelsList.bind(this)}get map(){return Jr}static getChannelsList(){return Array.from(Jr,((e,t)=>({key:e[0],val:e[1].constructor.name})))}static listRegisteredChannels(e=!1){const t=this.getChannelsList(),r=L(ee("ChannelProxy","val")),n=T(ee("ChannelProxy","val")),o=(!0===e?n:r)(t);return ge(["key"],o)}listProxyChannels(){return this.listRegisteredChannels(!0)}checkForMissingChannels(){const t=this.getChannelsList(),r=T(ee("ChannelProxy","val"))(t);if(r.length>=1){const t=`Spyne Warning: The following ${1===r.length?"Channel has":"Channels have"} not been initialized: ${e(ce(", "),k(s("key")))(r)}`;console.warn(t)}}init(){this.createMainStreams()}createMainStreams(){this.routeStream=new zr,Jr.set("CHANNEL_ROUTE",this.routeStream),this.uiStream=new Br,Jr.set("CHANNEL_UI",this.uiStream),this.domStream=new qr,Jr.set("CHANNEL_WINDOW",this.domStream),this.viewStreamLifecycle=new Qr,Jr.set("CHANNEL_LIFECYCLE",this.viewStreamLifecycle),this.routeStream.initializeStream(),this.domStream.initializeStream()}addKeyEvent(e){Jr.get("UI").addKeyEvent(e)}registerStream(t){const r=t.channelName;if(Jr.has(r)){if(e(Ie(["props","isRegistered"],!0))(Jr.get(r)))return void console.warn(`Spyne Warning: The Channel, ${r}, has already been registered!`)}Jr.set(r,t),t.initializeStream()}getChannelActions(e){return Jr.get(e).addRegisteredActions()}getProxySubject(e,t=!1){const r=!0===t?"replaySubject":"subject";return Jr.get(e)[r]}testStream(e){return void 0!==Jr.get(e)}getStream(e){return!1===this.testStream(e)&&Jr.set(e,new Xr(e)),Jr.get(e)}addMixins(){}}class en{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(t,r=[]){const n=f(["length","name","prototype","constructor"],r),o=e(C(n),y),s=o(Object.getOwnPropertyNames(t.constructor.prototype)),i=o(Object.getOwnPropertyNames(t.constructor));return{methods:s,staticMethods:i,allMethods:f(s,i)}}(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=L((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 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=fe(2,n)(A,!0);return k(o,e.staticMethods),k(n,e.methods),r}autoBinder(){const e=this.getEnhancerMethods();return this.allMethodsList=this.bindParentViewStream(e,this.parentContext),this.allMethodsList}}class tn{constructor(e,t,r,n){this._mapFn=tn.setMapFn(e),this._url=tn.setUrl(e),this._responseType=tn.setResponseType(e),this._serverOptions=tn.setServerOptions(e),this._subscriber=void 0!==t?t:e=>console.log("FETCH RETURNED ",e),this.debug=void 0!==e.debug&&e.debug,this.channelName=n;const o={mapFn:this.mapFn,url:this.url,serverOptions:this.serverOptions,responseType:this.responseType,debug:this.debug};!0!==r&&tn.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=Pe(window.fetch(o,s)).pipe(Cr(c),Tr((e=>Pe(e[i]()))),ar((e=>{const t={channelName:r,url:o,responseType:i,serverOptions:s};return r=>e(r,t)})(n)),Ar());l.connect(),l.subscribe(t)}static setMapFn(t){return e(p((e=>e)),s("mapFn"))(t)}static setUrl(e){const t=s("url",e);return void 0===t&&console.warn("SPYNE WARNING: URL is undefined for data channel"),t}static setResponseType(e){return p("json",s("responseType",e))}get mapFn(){return this._mapFn}get url(){return this._url}get serverOptions(){return this._serverOptions}get responseType(){return this._responseType}static stringifyBodyIfItExists(t){return ae(ve(Object,"body"),e(me(Te("body"),JSON.stringify)))(t)}static updateMethodWhenBodyExists(e){const t=Ne("body"),r=ee("GET","method"),o=n([t,r]);return ae(o,ie("method","POST"))(e)}static setServerOptions(e){const t=H(["method","headers","body","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive"],e);let r=_e(tn.baseOptions(),t);return r=tn.updateMethodWhenBodyExists(r),r=tn.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 rn extends Gr{constructor(e,t={}){rn.validateMapMethod(t,e),void 0!==t.map&&(t.mapFn=t.map),t.extendedActionsArr=[`${e}_DATA_EVENT`,[`${e}_UPDATE_DATA_EVENT`,"onFetchUpdate"]],t.sendCachedPayload=!0,super(e,t)}static validateMapMethod(t,r,o=!1){const s=X(b,(e=>"function"!=typeof e)),i=K(s),a=n([i,e=>e.length>=1]);return!e(a,v,H(["map","mapFn"]))(t)||(!1===o&&console.warn(`Spyne Warning: The map method for ChannelFetch, ${r}, appears to be invalid`),!1)}onRegistered(){this.startFetch()}addRegisteredActions(t){const r=e(p([]),i(["props","extendedActionsArr"]));return["CHANNEL_DATA_EVENT",["CHANNEL_UPDATE_DATA_EVENT","onFetchUpdate"]].concat(r(this))}startFetch(e={},t=this.onFetchReturned.bind(this)){const r=this.consolidateAllFetchProps(e);return new tn(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}_DATA_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=i(["viewStreamInfo","payload"],e);return H(["mapFn","url","header","body","mode","method","responseType","debug"],t)}consolidateAllFetchProps(t,r=this.props){const n=H(["mapFn","url","header","body","mode","method","responseType","debug"],r),o=L(b);return e(o,((e,t)=>_e(e,t)))(n,t)}get observer(){return this.observer$}}let nn=Ze;class on{constructor(e={}){let{name:t,config:r,parentEl:n}=e;this.props=e,void 0===r&&(r=l(e)),this.name=t||"empty",this.props.name=t,r=on.mergeDefaultConfig(r,this.defaultConfig()),this.props.parentEl=n||on.createParentEl(),this.props.config=r,void 0!==this.props.traits&&this.addTraits(this.props.traits)}register(e){nn=e,this.props.pluginName=this.props.name,!1!==nn.initialized?(this.onBeforeRegistered(),this.props.config=l(this.props.config),nn.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 nn}static mergeDefaultConfig(e={},t=this.defaultConfig()){return Object.assign(t,e)}static getSpyneApp(e,t){!1===nn.initialized?console.warn(`Spyne Warning: Unable to install plugin, ${e}! SpyneApp has not been initialized!`):nn.addPluginConfig(e,t)}static updateSpyneConfig(e,t,n){return!0===be(r(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 ht({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(){}defaultConfig(){return{}}onRegistered(){}onRender(){}}const sn=new Zr,an="0.20.4";let cn=new class{constructor(){this.version=an}get channels(){return sn}init(e={},t=!1){
|
|
1
|
+
import{compose as e,not as t,is as r,allPass as n,keys as o,prop as s,path as i,fromPairs as a,toPairs as c,clone as l,mergeAll as d,includes as h,pickAll as u,lte as E,defaultTo as p,match as N,head as _,filter as T,test as m,__ as A,concat as f,without as C,uniq as y,complement as g,isEmpty as I,values as v,isNil as b,ifElse as S,reject as L,mapObjIndexed as O,pipe as D,pick as H,forEachObjIndexed as R,flip as V,mergeRight as w,propSatisfies as P,forEach as U,props as M,omit as W,find as F,always as x,flatten as $,map as k,any as G,equals as j,curry as Y,where as z,F as B,split as K,all as q,slice as Q,toLower as X,either as J,findIndex as Z,apply as ee,propEq as te,identity as re,chain as ne,objOf as oe,view as se,lensIndex as ie,assoc as ae,when as ce,join as le,replace as de,findLastIndex as he,last as ue,invert as Ee,reduce as pe,zipObj as Ne,has as _e,mergeDeepRight as Te,lensProp as me,over as Ae,reverse as fe,curryN as Ce,toUpper as ye,partialRight as ge,pluck as Ie,pathEq as ve,propIs as be,pathSatisfies as Se}from"ramda";import{Observable as Le,Subject as Oe,bindCallback as De,fromEvent as He,of as Re,ReplaySubject as Ve,combineLatest as we,forkJoin as Pe,fromEventPattern as Ue,merge as Me,from as We}from"rxjs";import Fe from"dompurify";const xe=Object.create({}),$e=e(t,r(Array)),ke=e(n([$e,r(Object)]));function Ge(e){return e&&"object"==typeof e&&"[object RegExp]"!==Object.prototype.toString.call(e)&&"[object Date]"!==Object.prototype.toString.call(e)}function je(e,t){return t&&!0===t.clone&&Ge(e)?ze((r=e,Array.isArray(r)?[]:{}),e,t):e;var r}function Ye(e,t,r){const n=e.slice();return t.forEach((function(t,o){void 0===n[o]?n[o]=je(t,r):Ge(t)?n[o]=ze(e[o],t,r):-1===e.indexOf(t)&&n.push(je(t,r))})),n}function ze(e,t,r){const n=Array.isArray(t),o=(r||{arrayMerge:Ye}).arrayMerge||Ye;return n?Array.isArray(e)?o(e,t,r):je(t,r):function(e,t,r){const n={};return Ge(e)&&Object.keys(e).forEach((function(t){n[t]=je(e[t],r)})),Object.keys(t).forEach((function(o){Ge(t[o])&&e[o]?n[o]=ze(e[o],t[o],r):n[o]=je(t[o],r)})),n}(e,t,r)}let Be,Ke,qe,Qe;ze.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 ze(e,r,t)}))};let Xe,Je=!0;const Ze=[],et=new Map,tt=new class{constructor(){xe.foo=()=>console.log("used for testing purposes.")}addMethod(e,t,r=!1){if(!0===Object.prototype.hasOwnProperty.call(xe,e)){const t=`Spyne Warning: the method name, ${e}, already exists.`;if(r)return t;console.warn(t)}else xe[e]=t}addMethods(e={},t=!1){let r;if(!1===ke(e))return r=`Spyne Warning: the pluginMethods property, ${JSON.stringify(e)} needs to be an object.`,t?r:void console.warn(r);return o(e).map((n=>{const o=s(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 xe}};const rt=new class{constructor(){Qe=!1}get channelsMap(){return qe}get initialized(){return Qe}get config(){return Be}get debug(){return Je}static listChannels(){return Array.from(Ke.map.keys())}initialize(e={},t={},r,n){return Ke=r,Be=ze(e,t),Be.channels&&Be.channels.ROUTE&&(Be=n.conformRouteObject(Be)),Xe=Be?.IMG_PATH,Je=void 0!==Be.debug?Be.debug:Je,this.getChannelActions=Ke.getChannelActions.bind(Ke),this.listRegisteredChannels=Ke.listRegisteredChannels.bind(Ke),Qe=!0,this._initialized=Qe,this.setChannelsMap(),t?.baseHref&&this.setHeadBaseHref(t.baseHref),Be}setHeadBaseHref(e){const t=document.createElement("base");t.href=e,document.head.appendChild(t)}conformRouteConfig(e=!1){Be=SpyneUtilsChannelRoute.conformRouteObject(Be,e)}setChannelsMap(){const e=Ke.getStream.bind(Ke),t=Ke.testStream.bind(Ke),r=Ke.getProxySubject.bind(Ke);qe={getStream:e,testStream:t,getProxySubject:r}}setProp(e,t){Be.tmp[e]=t}getProp(e){return i(["tmp",e],Be)}setChannelConfig(e,t){return Be.channels[e]=t,Be.channels[e]}getChannelConfig(e,t=Be){if("CHANNEL_ROUTE"===e?e="ROUTE":"CHANNEL_WINDOW"===e&&(e="WINDOW"),void 0===t||void 0===Be.channels)return void console.warn("Spyne warning: Spyne config object is empty!");const r=Be.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===Be.plugins&&(Be.plugins={}),this.addPluginMethods(t.pluginMethods),Be.plugins[e]=t}getPluginsMethodObj(e){return e&&this.addPluginMethods(e),tt.pluginMethodsObj}addPluginMethods(e){e&&tt.addMethods(e)}doNotTrackChannel(e){Ze.push(e)}getUntrackedChannelsList(){return Ze}registerProxyReviver(e,t){et.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 et.get(e)}getPluginConfigByPluginName(e){return Be.plugins[e]}get IMG_PATH(){return Xe}tempGetChannelsInstance(){}tempGetConfig(){}},nt=()=>({includes:()=>!0===rt.initialized?rt.listRegisteredChannels():["CHANNEL_ROUTE","CHANNEL_UI","CHANNEL_WINDOW","DISPATCHER"]});void 0!==e&&void 0!==Le&&(e(r(String),i(["data","srcElement","vsid"])),e(r(String),i(["data","srcElement","id"])));const ot=(e,t)=>{const{__proxy__proxyName:r}=e;void 0===r&&console.error("object is not proxy object ",e);const n=(r,n)=>{const o=i(n,e),{__proxy__isProxy:s,__proxy__props:a}=o;return s?t(r,a):r},o=n(l(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},st=function(t){const{__proxy__proxyName:n}=t;if(void 0!==n){const e=rt.getProxyReviver(n);if("function"==typeof e)return ot(t,e)}const o=r(Array),s=r(Object);var i;return!1===o(i=t)&&!0===s(i)?e(a,c,l)(t):l(t)};class it{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=it.deepFreeze(r);if(a.payload=c,!0===rt.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=rt.getChannelActions(i);it.validateAction(t,i,e)}a.clone=()=>d([{payload:st(a.payload)},a.payload,{channel:l(i)},{event:l(o)},{srcElement:n},l(a.srcElement),{action:l(a.action)}]);const h={$dir:{get:()=>a._dir,set:e=>(a._dir=e,e)}};return"CHANNEL_ROUTE"===i&&(h.location={get:()=>it.getLocationData()}),a._dir=void 0,Object.defineProperties(a,h),s&&console.timeEnd(s),a}static validateAction(e,t,r){const n=h(e,r);return!1===n&&!0===rt.initialized&&console.warn(`warning: Action: '${e}' is not registered within the ${t} channel!`),n}static getLocationData(){return u(["href","origin","protocol","host","hostname","port","pathname","search","hash"],window.location)}static getStreamItem(){}static deepClone(t){const n=r(Array),o=r(Object);var s;return!1===n(s=t)&&!0===o(s)?e(a,c,l)(t):l(t)}static deepFreeze(t){const r=e(E(0),p(-1),s("nodeType"));try{Object.freeze(t),Object.getOwnPropertyNames(t).forEach((function(e){!Object.prototype.hasOwnProperty.call(t,e)||!1!==r(t[e])||null===t[e]||"object"!=typeof t[e]&&"function"!=typeof t[e]||Object.isFrozen(t[e])||it.deepFreeze(t[e])}))}catch(e){return t}return t}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 at(){return{createpropsMap:function(){const e=new WeakMap,t={vsid:this.props.vsid};return e.set(t,this.props),{key:t,weakMap:e}},gc:function(){for(const e in this)delete this[e]},createId:function(){return Math.random().toString(36).replace(/\d/gm,"").substring(1,8)},setTraceFunc:function(e){return!0===e?console.log:()=>{}}}}const ct=async(e,t)=>{window.setTimeout((async()=>{var t;await(t=1,new Promise((e=>setTimeout(e,t)))),window.requestAnimationFrame(e)}),t)},lt=e=>{if(void 0!==e.constructor.name)return e.constructor.name;const t=e.toString();return p(String(t).substr(0,12),N(/^(function\s)(\w+)(\(.*)$/,t)[2])},dt=t=>{const r=e(g(I),_,v),o=e(g(b),_,v);return n([r,o])(t)};let ht,ut=!1;class Et{constructor(e,t={},n={}){this.template=this.formatTemplate(e),this.isProxyData=!0===t.__cms__isProxy,this.testMode=n?.testMode;(()=>{!0===r(Array,t)&&(t={spyneData:t},this.template=this.template.replace("{{/}}","{{/spyneData}}"),this.template=this.template.replace("{{#}}","{{#spyneData}}"))})(),this.templateData=t;const o=Et.getStringArray(this.template);let s=this.template.match(Et.findTmplLoopsRE());s=null===s?[]:s;const i=Et.parseTmplLoopsRE(),a=this.parseTheTmplLoop.bind(this),c=h(A,s),l=S(c,((e,t)=>e.replace(i,a)),this.addParams.bind(this));this.finalArr=o.map(l)}static isPrimitiveTag(e){return/({{\.\*?}})/.test(e)}static getNestedDataReducer(e={},t=""){return/(\.)/gm.test(String(t))?String(t).split(".").reduce(((e,t)=>e[t]?e[t]:"string"==typeof e?e:""),e):e[t]??""}static getStringArray(e){const t=e.split(Et.findTmplLoopsRE()),r=/^([\\n\s\W]+)$/;return L((e=>e.match(r)),t)}static findTmplLoopsRE(){return/({{#[\w.]+}}[\w\n\s\W]+?{{\/[\w.]+}})/gm}static parseTmplLoopsRE(){return/({{#([\w.]+)}})([\w\n\s\W]+?)({{\/\2}})/gm}static swapParamsForTagsRE(){return/({{)(.*?)(}})/gm}removeThis(){void 0!==this&&(this.finalArr=void 0,this.templateData=void 0,this.template=void 0)}renderDocFrag(){let e=Et.replaceImgPath(this.finalArr.join(""));!0!==this.testMode&&(e=(e=>{if(!ut)throw new Error("sanitizeHTML is not configured. Call sanitizeHTMLConfigure() with appropriate config.");return ht(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=Et.replaceImgPath(e),window.setTimeout(this.removeThis,2),e}getTemplateString(){return this.finalArr.join("")}formatTemplate(e){return!0===["SCRIPT","TEMPLATE"].includes(s("nodeName",e))?e.innerHTML:e}getDataValFromPathStr(e,t){const r=String(e).split(".");return i(r,t)||""}addParams(e){return e.replace(Et.swapParamsForTagsRE(),((e,t,r,n)=>Et.getNestedDataReducer(this.templateData,r)))}static replaceImgPath(e){const{IMG_PATH:t}=rt;return void 0!==t?(e=e.replaceAll(/src\s*=\s*(['"])imgs\//g,`src=$1${t}`)).replaceAll(/url\(\s*(['"]?)imgs\//g,`url($1${t}`):e}parseTheTmplLoop(e,t,r,n){const o=/(\.)/gm,s=n;let i=Et.getNestedDataReducer(this.templateData,r);const a=(e,t,r)=>{if(Et.isPrimitiveTag(t))return c(e,t);return l((()=>{const t=e,n=r,o=r+1;if(this.isProxyData){return{spyneLoopKey:t,__cms__dataId:i.__cms__dataId,origKey:i[`__cms__keyFor_${e}`],loopIndex:n,loopNum:o,d:e}}return{spyneLoopKey:t,loopIndex:n,loopNum:o}})(),t,r)},c=(e,t,r,n)=>t.replace(Et.swapParamsForTagsRE(),e),l=(e,t,r)=>t.replace(Et.swapParamsForTagsRE(),((t,n,s)=>{const i={loopIndex:r,loopNum:r+1};if(!1===o.test(s)&&void 0!==e[s])return void 0!==i[s]?i[s]:e[s];const a=this.getDataValFromPathStr(s,e);return void 0!==i[s]?i[s]:a}));return!0===b(i)||I(i)?"":(void 0===i.length&&(i=[i]),i.map(((e,t)=>"string"==typeof e?a(e,s,t):l(e,s,t))).join(""))}}class pt{constructor(e={},t=!1){var r,n;e.tagName=(r="div",n=e.tagName,p(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?R(n,t):e.setAttribute(r,t)})),e}updateAttrs(e,t){const r=void 0!==t?t:new Map;return O(((e,t)=>r.set(t,e)),e),r}addTemplate(e){const t=this.getProp("template");return void 0!==t?(t=>{let n=this.getProp("data");n=r(Object,n)?n:{};const o=new Et(t,n,{testMode:this?.testMode}).renderDocFrag();return r(String,o)?e.innerHTML=o:e.appendChild(o),e})(t):e}createElement(e="div"){return document.createElement(e)}addContent(e){const t=this.getProp("data");if(!0===r(String,t)){const r=document.createTextNode(t);e.appendChild(r)}return e}execute(){const e=D(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:ze(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=at();this.gc=e.gc.bind(this)}getDomAttributes(e){return H(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 Nt=(e=!1,t=1,r="ease",n=!1)=>`${!0===n?"opacity:0;":""}transition: opacity ${t}s ${r}; opacity: ${!0===e?1:0};`;function _t(e){return"function"==typeof e}function Tt(e){return _t(null==e?void 0:e.lift)}function mt(e){return function(t){if(Tt(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 At=function(e,t){return At=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])},At(e,t)};function ft(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}At(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function Ct(e,t,r,n){return new(r||(r=Promise))((function(o,s){function i(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}c((n=n.apply(e,t||[])).next())}))}function yt(e,t){var r,n,o,s,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(c){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(i=0)),i;)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 i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],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 gt(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 It(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 vt(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 bt(e){return this instanceof bt?(this.v=e,this):new bt(e)}function St(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,o=r.apply(e,t||[]),s=[];return n={},i("next"),i("throw"),i("return"),n[Symbol.asyncIterator]=function(){return this},n;function i(e){o[e]&&(n[e]=function(t){return new Promise((function(r,n){s.push([e,t,r,n])>1||a(e,t)}))})}function a(e,t){try{(r=o[e](t)).value instanceof bt?Promise.resolve(r.value.v).then(c,l):d(s[0][2],r)}catch(e){d(s[0][3],e)}var r}function c(e){a("next",e)}function l(e){a("throw",e)}function d(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}}function Lt(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=gt(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;function Ot(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 Dt=Ot((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 Ht(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var Rt=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=gt(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(_t(c))try{c()}catch(e){o=e instanceof Dt?e.errors:[e]}var l=this._finalizers;if(l){this._finalizers=null;try{for(var d=gt(l),h=d.next();!h.done;h=d.next()){var u=h.value;try{Pt(u)}catch(e){o=null!=o?o:[],e instanceof Dt?o=vt(vt([],It(o)),It(e.errors)):o.push(e)}}}catch(e){r={error:e}}finally{try{h&&!h.done&&(n=d.return)&&n.call(d)}finally{if(r)throw r.error}}}if(o)throw new Dt(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)Pt(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)&&Ht(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&Ht(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}(),Vt=Rt.EMPTY;function wt(e){return e instanceof Rt||e&&"closed"in e&&_t(e.remove)&&_t(e.add)&&_t(e.unsubscribe)}function Pt(e){_t(e)?e():e.unsubscribe()}var Ut={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Mt={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=Mt.delegate;return(null==o?void 0:o.setTimeout)?o.setTimeout.apply(o,vt([e,t],It(r))):setTimeout.apply(void 0,vt([e,t],It(r)))},clearTimeout:function(e){var t=Mt.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function Wt(e){Mt.setTimeout((function(){throw e}))}function Ft(){}var xt=null;function $t(e){if(Ut.useDeprecatedSynchronousErrorHandling){var t=!xt;if(t&&(xt={errorThrown:!1,error:null}),e(),t){var r=xt,n=r.errorThrown,o=r.error;if(xt=null,n)throw o}}else e()}var kt=function(e){function t(t){var r=e.call(this)||this;return r.isStopped=!1,t?(r.destination=t,wt(t)&&t.add(r)):r.destination=Kt,r}return ft(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}(Rt),Gt=Function.prototype.bind;function jt(e,t){return Gt.call(e,t)}var Yt=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){Bt(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){Bt(e)}else Bt(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){Bt(e)}},e}(),zt=function(e){function t(t,r,n){var o,s,i=e.call(this)||this;_t(t)||!t?o={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:i&&Ut.useDeprecatedNextContext?((s=Object.create(t)).unsubscribe=function(){return i.unsubscribe()},o={next:t.next&&jt(t.next,s),error:t.error&&jt(t.error,s),complete:t.complete&&jt(t.complete,s)}):o=t;return i.destination=new Yt(o),i}return ft(t,e),t}(kt);function Bt(e){Wt(e)}var Kt={closed:!0,next:Ft,error:function(e){throw e},complete:Ft},qt="function"==typeof Symbol&&Symbol.observable||"@@observable";function Qt(e){return e}var Xt=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 kt||function(e){return e&&_t(e.next)&&_t(e.error)&&_t(e.complete)}(n)&&wt(n)?e:new zt(e,t,r);return $t((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=Jt(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[qt]=function(){return this},e.prototype.pipe=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return(0===(e=t).length?Qt:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)})(this)},e.prototype.toPromise=function(e){var t=this;return new(e=Jt(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 Jt(e){var t;return null!==(t=null!=e?e:Ut.Promise)&&void 0!==t?t:Promise}var Zt="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function er(e){if(e instanceof Xt)return e;if(null!=e){if(function(e){return _t(e[qt])}(e))return i=e,new Xt((function(e){var t=i[qt]();if(_t(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if((s=e)&&"number"==typeof s.length&&"function"!=typeof s)return o=e,new Xt((function(e){for(var t=0;t<o.length&&!e.closed;t++)e.next(o[t]);e.complete()}));if(_t(null==(n=e)?void 0:n.then))return r=e,new Xt((function(e){r.then((function(t){e.closed||(e.next(t),e.complete())}),(function(t){return e.error(t)})).then(null,Wt)}));if(function(e){return Symbol.asyncIterator&&_t(null==e?void 0:e[Symbol.asyncIterator])}(e))return tr(e);if(function(e){return _t(null==e?void 0:e[Zt])}(e))return t=e,new Xt((function(e){var r,n;try{for(var o=gt(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(function(e){return _t(null==e?void 0:e.getReader)}(e))return tr(function(e){return St(this,arguments,(function(){var t,r,n;return yt(this,(function(o){switch(o.label){case 0:t=e.getReader(),o.label=1;case 1:o.trys.push([1,,9,10]),o.label=2;case 2:return[4,bt(t.read())];case 3:return r=o.sent(),n=r.value,r.done?[4,bt(void 0)]:[3,5];case 4:return[2,o.sent()];case 5:return[4,bt(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]}}))}))}(e))}var t,r,n,o,s,i;throw function(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.")}(e)}function tr(e){return new Xt((function(t){(function(e,t){var r,n,o,s;return Ct(this,void 0,void 0,(function(){var i,a;return yt(this,(function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),r=Lt(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 rr(e,t,r,n,o){return new nr(e,t,r,n,o)}var nr=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 ft(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}(kt),or=function(e){function t(t,r){return e.call(this)||this}return ft(t,e),t.prototype.schedule=function(e,t){return this},t}(Rt),sr={setInterval:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=sr.delegate;return(null==o?void 0:o.setInterval)?o.setInterval.apply(o,vt([e,t],It(r))):setInterval.apply(void 0,vt([e,t],It(r)))},clearInterval:function(e){var t=sr.delegate;return((null==t?void 0:t.clearInterval)||clearInterval)(e)},delegate:void 0},ir=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 ft(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),sr.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&&sr.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,Ht(n,this),null!=t&&(this.id=this.recycleAsyncId(r,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(or),ar={now:function(){return(ar.delegate||Date).now()},delegate:void 0},cr=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=ar.now,e}(),lr=new(function(e){function t(t,r){void 0===r&&(r=cr.now);var n=e.call(this,t,r)||this;return n.actions=[],n._active=!1,n}return ft(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}(cr))(ir);function dr(e,t){return mt((function(r,n){var o=0;r.subscribe(rr(n,(function(r){n.next(e.call(t,r,o++))})))}))}function hr(e,t,r){return void 0===r&&(r=1/0),_t(t)?hr((function(r,n){return dr((function(e,o){return t(r,e,n,o)}))(er(e(r,n)))}),r):("number"==typeof t&&(r=t),mt((function(t,n){return function(e,t,r,n,o,s,i,a){var c=[],l=0,d=0,h=!1,u=function(){!h||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;er(r(e,d++)).subscribe(rr(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?function(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);e.add(s)}(t,i,(function(){return p(e)})):p(e)};c.length&&l<n;)e();u()}catch(e){t.error(e)}})))};return e.subscribe(rr(t,E,(function(){h=!0,u()}))),function(){null==a||a()}}(t,n,e,r)})))}var ur=Ot((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),Er=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 ft(t,e),t.prototype.lift=function(e){var t=new pr(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new ur},t.prototype.next=function(e){var t=this;$t((function(){var r,n;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var o=gt(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;$t((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;$t((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?Vt:(this.currentObservers=null,s.push(e),new Rt((function(){t.currentObservers=null,Ht(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 Xt;return e.source=this,e},t.create=function(e,t){return new pr(e,t)},t}(Xt),pr=function(e){function t(t,r){var n=e.call(this)||this;return n.destination=t,n.source=r,n}return ft(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:Vt},t}(Er);var Nr={connector:function(){return new Er}};function _r(e,t){void 0===t&&(t=Nr);var r=t.connector;return mt((function(t,n){var o,s=r();er(e((o=s,new Xt((function(e){return o.subscribe(e)}))))).subscribe(n),n.add(t.subscribe(s))}))}function Tr(e,t){return void 0===t&&(t=lr),mt((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(rr(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 mr=new Xt((function(e){return e.complete()}));function Ar(e){return e<=0?function(){return mr}:mt((function(t,r){var n=0;t.subscribe(rr(r,(function(t){++n<=e&&(r.next(t),e<=n&&r.complete())})))}))}function fr(e,t){return mt((function(r,n){var o=0;r.subscribe(rr(n,(function(r){return e.call(t,r,o++)&&n.next(r)})))}))}function Cr(e){return mt((function(t,r){try{t.subscribe(r)}finally{r.add(e)}}))}var yr=hr;var gr=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,Tt(t)&&(n.lift=t.lift),n}return ft(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 Rt;var r=this.getSubject();t.add(this.source.subscribe(rr(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=Rt.EMPTY)}return t},t.prototype.refCount=function(){return mt((function(e,t){var r=null;e._refCount++;var n=rr(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}(Xt);function Ir(e){return e?function(t){return _r(e)(t)}:function(e){return function(e,t){var r=_t(e)?e:function(){return e};return _t(t)?_r(t,{connector:r}):function(e){return new gr(e,r)}}(new Er)(e)}}function vr(e,t){return void 0===t&&(t=!1),mt((function(r,n){var o=0;r.subscribe(rr(n,(function(r){var s=e(r,o++);(s||t)&&n.next(r),!s&&n.complete()})))}))}function br(e,t,r){var n=_t(e)||t||r?{next:e,error:t,complete:r}:e;return n?mt((function(e,t){var r;null===(r=n.subscribe)||void 0===r||r.call(n);var o=!0;e.subscribe(rr(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)})))})):Qt}class Sr{constructor(e){this.props.observableStreams=Sr.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 V(w)({$dir:["internal"]},l(e))}static addDownInternalDir(e,t=["internal","down"]){return V(w)(l(e),{$dir:t})}static addChildAndInternalDir(e,t=["child","down"]){return V(w)(l(e),{$dir:t})}static mapToDefaultDir(e){return this.addDefaultDir(e)}static createDirectionalObservables(e=new Oe,t,r){void 0!==t&&void 0!==r&&(e.viewName=t,e.vsid=r);const n=e=>P((t=>t.includes(e)),"$dir"),o=n("parent"),s=n("child"),i=n("internal"),a=e=>w({from$:e}),c=a("child"),l=a("internal"),d=a("parent"),h=e.pipe(fr((e=>void 0!==e&&void 0!==e.action))),u=e.pipe(fr(i),dr(l)),E=e.pipe(fr(o),dr(c)),p=e.pipe(fr(s),dr(d)),N={parent:E,internal:u,child:p};return{raw$:h,toInternal$:u,toParent$:E,toChild$:p,completeAll:()=>{U((e=>{e.complete(),e.isStopped=!0}),[h,u,E,p])},completeStream:(e=[])=>{const t=e=>{if(void 0!==N[e]){(t=N[e]).complete(),t.isStopped=!0}var t};void 0!==e&&e.length>=1&&e.forEach(t)}}}}class Lr{constructor(e,t={},r="",n="theName"){this.addMixins(),this._state="INIT",this.vsid=r,this.vsName=n,this.defaults={debug:!1,extendedHashMethods:{}},this.options=ze(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=Sr.createDirectionalFiltersObject(),this.addDefaultDir=Sr.addDefaultDir,this.sourceStreams=Sr.createDirectionalObservables(new Oe,this.vsName,this.vsid),this._source$=this.sourceStreams.toInternal$}addActionListeners(){return[]}setHashMethods(e={}){return ze({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=T((e=>void 0!==e),H(["id","className"],this.props)),{tagName:t,data:r,template:n}=this.props;return new pt(t,e,r,n)}onDisposeCompleted(e){}animateInTween(e,t){!function(e,t){const r=1*window.getComputedStyle(e).opacity,n=Nt(!0,t,"ease",1===r);e.style.cssText+=n}(e,t)}animateOutTween(e,t,r){!function(e,t,r){const n=Nt(!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},n=De(((e,r)=>{this.animateOutTween(t,e.animateOutTime,r)})),o=e=>{this._source$.next(r)},s=!0===e.animateOut?e=>(n(e).subscribe(o),{action:"EXTIRPATING",$dir:this.$dirs.CI}):()=>({action:"EXTIRPATE_AND_READY_FOR_VS_DETRITUS_COLLECT",$dir:this.$dirs.CI});return s(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){const t=b(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.domItem.el,$dir:this.$dirs.PI}}renderDomItem(e){const[t,r,n,o]=e;return this.domItem=new pt({tagName:t,attributes:r,data:n,template:o}),this.domItem}onRender(e){return{action:"VS_SPAWNED",el:(e=>this.renderDomItem(e))(M(["tagName","domAttributes","data","template"],e)),$dir:this.$dirs.I}}extendedMethods(e){}onRenderAndAttachToDom(e){return e.attachData.el=(e=>this.renderDomItem(e))(M(["tagName","domAttributes","data","template"],e)),this.combineDomItems(e.attachData),{action:"VS_SPAWNED_AND_ATTACHED_TO_DOM",el:e.attachData.el.el,$dir:this.$dirs.CI}}onObsSinkSubscribe(e){const t=e.action,r=p((e=>this.extendedMethods(e))),n=r(this.options.hashMethods[t])(e);void 0!==n&&(e=>{this._source$.next(e)})(Object.freeze(n))}addMixins(){}}function Or(){setTimeout((()=>{U((e=>{}),this)}),1)}class Dr{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=rt.channelsMap.getStream("DISPATCHER"),r=st(e);t.next(r),e=void 0}static deepClone(t){const n=r(Array),o=r(Object);var s;return!1===n(s=t)&&!0===o(s)?e(a,c,l)(t):l(t)}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=Or}}const Hr=!0===rt.debug;class Rr{constructor(e,t){this.addMixins(),this.props=e,this.broadcastFn=t,this.broadcaster(this.broadcastFn)}addDblClickEvt(e){return He(e,"dblclick").pipe(dr((e=>{const t=l(e);return t.typeOverRide="dblclick",t})))}broadcast(e){if(e.length<=0&&!0===Hr)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,o]=e;let s,i=this.props.el.querySelectorAll(r);if(i.length<=0){const e=this.props.el,t=t=>{t===e&&(i=[t])};(()=>{const n=(null!==e.parentElement?e.parentElement:document).querySelectorAll(r);n.forEach=Array.prototype.forEach,n.forEach(t)})()}const a=void 0!==o,c=e=>{const r="dblClick"!==n?He(e,n,{preventDefault:()=>!0}):this.addDblClickEvt(e);s=e.dataset.channel;const o={};o.payload=(e=>{const t={};for(const r in e)t[r]=e[r];return t})(e.dataset),o.payload=W(["channel"],o.payload),o.channel=s,o.srcElement={},o.srcElement.id=this.props.id,o.srcElement.vsid=this.props.vsid,o.srcElement.isLocalEvent=a,o.srcElement.srcEvent=n,o.srcElement.el=e;var i;(0,t[(i=s,"ROUTE"===i||"CHANNEL_ROUTE"===i?"ROUTE":("UI"!==i&&"CHANNEL_UI"!==i&&void 0!==i&&console.warn(`SpyneJS warning: The channel, ${i}, is not allowed here, only "UI" or "ROUTE" are valid channels, defaulting to CHANNEL_UI`),"UI"))])(r,o)};!0===(void 0===i||i.length<=0)&&!0===Hr?console.warn(`Spyne Warning: The item ${r}, does not appear to exist in ${this.props.name} --\x3e vsid:${this.props.vsid}!`):(i.forEach=Array.prototype.forEach,i.forEach(c))}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 Dr("CHANNEL_ROUTE",e,t,"subscribe")},sendUIPayload:function(e,t){return new Dr("CHANNEL_UI",e,t,"subscribe")}};this.sendUIPayload=e.sendUIPayload,this.sendRoutePayload=e.sendRoutePayload}}const Vr=e(t,r(Array)),wr=e(t,I),Pr=n([r(String),wr]),Ur=n([r(Array),wr]),Mr=e(n([Vr,r(Object)])),Wr=e(n([wr,Vr,r(Object)]));class Fr{constructor(t,o={},i,a){Mr(t)&&(t=s("selector",o=t),a=a||s("testMode",o));const c=[i,s("debugLabel",o)];i=e(F(r(String)))(c);let l=W(["debugLabel","label","selector","props","testMode","propFilters"],o);void 0!==o.props?l=d([o.props,l]):void 0!==o.propFilters&&(l=d([o.propFilters,l])),o.propFilters=l;const{propFilters:h}=o,u=Pr(t)?Fr.filterSelector([t],i):void 0,E=Ur(t)?Fr.filterSelector(t,i):void 0,p=Wr(h)?Fr.filterData(h,i):void 0;let N=L(b,[u,E,p]);const _=I(N);return _&&(N=[x(!1)],!0===rt.debug&&!0!==a&&console.warn(`Spyne Warning: The Channel Filter, with selector: ${t}, and propFilters:${h} appears to be empty!`)),!0===a?{selector:t,propFilters:h,debugLabel:i,filters:o,testMode:a,filtersAreEmpty:_}:n(N)}static filterData(t,n){const o=n;return(()=>{if(I(t))return x(!1);t=k(((e,t,n)=>{let o=B;if((e=>r(String,e))(e)||(e=>r(Boolean,e))(e)||(e=>r(Number,e))(e))s=e,o=e=>e===s;else{if("function"==typeof e)return e;if((e=>r(Array,e))(e)||Mr(e))return console.warn(`ChannelPayloadFilter: Property "${e}" is an array/object, which is not allowed. This property will always return false.`),o}var s;return o}),t);const n=z(t);return e(n,(e=>{if(void 0===o)return e;const r={};return R(((t,n)=>{r[n]=t(s(n,e))}),t),console.log(`%c CHANNEL PAYLOAD FILTER DEBUGGER ["${o}"] - values: `,"color:orange;",{propsBooleans:r,comparedObj:e}),e}),p({}),(e=>{const{payload:t,srcElement:r,event:n}=e||{};return Object.assign({},e,r,n,t)}))})()}static checkPayloadSelector(t,r,n){const{payload:o,srcElement:i,event:a}=n||{},c=[i,o,s("srcElement",a),n].reduce(((e,t)=>{const r=s("el",t);return Fr.elIsDomElement(r)&&void 0===e&&(e=r),e}),void 0),l=e=>e.isEqualNode(c),d=e=>{const t=$(document.querySelectorAll(e));return k(l,t)};if(void 0!==r){const n=e($,k(d))(t),o=t;console.log(`%c CHANNEL PAYLOAD FILTER DEBUGGER ["${r}"] - selectors: `,"color:orange;",{el:c,selectorsArr:o,nodeArrResultsDebugger:n})}if("object"!=typeof c)return!1;const h=e($,k(d))(t);return!0!==I(h)&&G(j(!0),h)}static elIsDomElement(t){return r(String,t)&&(t=document.querySelector(t)),e(E(0),p(-1),s("nodeType"))(t)}static filterSelector(e,t){const r=L(I,e);return Y(Fr.checkPayloadSelector)(r,t)}}function xr(){return!0===rt.debug}function $r(e,t,r=!1){const n=Gr(e,t,r);return 1===n.length?_(n):n}function kr(t,r,n){const o=document.querySelector(t),i=e(E(0),p(-1),s("nodeType"));if(null===o||!1!==i(o)){if(void 0!==r&&String(r).trim().length>0){function a(e){try{return document.querySelectorAll(e).length>0}catch(e){return!1}}const c=a(r);!0===n&&!0===xr()&&!1===c&&console.warn(`Spyne Warning: the selector, ${r} does not exist in this el, ${t}`)}}else console.warn(`Spyne Warning: the el object is not a valid single element, ${o}`)}function Gr(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){kr(!0===n?"body":e,t,r)}return o}function jr(e,t,r){return Gr(t,r).forEach((t=>{t.style.cssText=e})),this}function Yr(t,r){function n(e){return Yr(t,e)}return kr(t="string"==typeof t?t: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}']`}(t),r,!1),n.map=e=>Array.from(Gr(t,r)).map(e),n.forEach=e=>Array.from(Gr(t,r)).map(e),n.getNodeListArray=()=>Gr(t,r),n.addClass=e=>(Gr(t,r).forEach((t=>t.classList.add(e))),this),n.removeClass=e=>(Gr(t,r).forEach((t=>{t.classList.remove(e)})),this),n.setClass=n=>(Gr(t,r).forEach((t=>{const r=e(L(I),K(" "))(t.className),o=n.split(" ");r.forEach((e=>t.classList.remove(e))),o.forEach((e=>t.classList.add(e)))})),this),n.unmount=()=>{},n.toggleClass=(e,n)=>(Gr(t,r).forEach((t=>{(n=void 0!==n?n:!t.classList.contains(e))?t.classList.add(e):t.classList.remove(e)})),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, ${r} does not appear to be valid!`),n.el),n.addAnimClass=e=>{requestAnimationFrame((()=>{Gr(t,r).forEach((t=>{try{t.classList.add(e)}catch(e){}}))}))},n.setActiveItem=(n,o)=>{const i=Gr(t,r),a="string"==typeof o?$r(t,o):o,c=e=>e.isEqualNode(a)?e.classList.add(n):e.classList.remove(n);var l;return!0===(l=a,e(E(0),p(-1),s("nodeType"))(l))?i.forEach(c):!0===xr()&&console.warn(`Spyne Warning: The selector, ${o}, does not appear to be a valid item in setActiveItem: ${n}`),this},Object.defineProperty(n,"el",{get:()=>$r(t,r,!0)}),Object.defineProperty(n,"els",{get:()=>Gr(t,r)}),Object.defineProperty(n,"len",{get:()=>Gr(t,r,!1).length}),Object.defineProperty(n,"exists",{get:()=>Gr(t,r,!1).length>=1}),Object.defineProperty(n,"exist",{get:()=>Gr(t,r,!1).length>=1}),Object.defineProperty(n,"nodeList",{get:()=>Gr(t,r)}),Object.defineProperty(n,"arr",{get:()=>{const e=$r(t,r,!0);return void 0===e?[]:void 0===e.length?[e]:Array.from(e)}}),Object.defineProperty(n,"inline",{set:e=>jr(e,t,r),get:()=>n}),Object.defineProperty(n,"inlineCss",{set:e=>jr(e,t,r),get:()=>n}),n}class zr{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:Lr,extendedSourcesHashMethods:{},debug:!1,template:void 0,node:document.createDocumentFragment(),name:lt(this)}},this._state={},this.$dirs=Sr.createDirectionalFiltersObject(),this.addDefaultDirection=Sr.addDefaultDir,this.addDownInternalDir=Sr.addDownInternalDir,this.props=ze(this.defaults(),e),this.sendLifecycleMethod=!0===this.props.sendLifecyleEvents?this.sendLifecycleMethodActive.bind(this):this.sendLifecycleMethodInactive.bind(this);const t=this.attributesArray;this.props.domAttributes=H(t,this.props),void 0!==this.props.traits&&this.addTraits(this.props.traits),this.loadAllMethods(),this.props.action="LOADED",this.sink$=new Oe;const r=this.props.viewClass;this.view=new r(this.sink$,{},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=zr.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 rt.debug}static checkIfActionsAreRegistered(e=[],t){if(t.length>0){const r=t=>{const r=new RegExp(t);if(Z(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=>rt.getChannelActions(e)));return $(t)})(e);t.forEach(r)}}static isValidNestedArr(t){const n=j(!0),o=q(n),s=r(String),i=e(o,k(s),Q(0,2),p([]));return e(o,k(i),p([]))(t)}static elIsDomElement(t){return r(String,t)&&(t=document.querySelector(t)),e(E(0),p(-1),s("nodeType"))(t)}updatePropsToMatchEl(){const t=e(X,J(s("tagName"),x("")));this.props.tagName=t(this.props.el)}checkIfElementAlreadyExists(){const t=e(E(0),p(-1),s("nodeType"));P(n([e=>document.body.contains(e),t]),"el")(this.props)?(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=Y(this.onChannelMethodCall.bind(this));this.addActionListeners().forEach((t=>{let[n,o,s]=t;r(String,s)&&(s=new Fr({selector:s})),this.props.extendedSourcesHashMethods[n]=e(o,s)})),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=ze({},r);e.$dir=this.$dirs.C,this.sourceStreams.raw$.next(e)}!0===p(x(!0),t)(r)&&n(r=W(["$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 ze.all([{},t,e])}initViewStream(){this._source$=this._rawSource$.pipe(dr((e=>this.onMapViewSource(e))),vr(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(fr((e=>void 0!==e&&void 0!==e.action)),dr((e=>{const t=ze({},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(fr((e=>void 0!==e&&void 0!==e.action)),br((e=>this.tracer("addChildStraem do ",e))),dr((e=>e)),Cr((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 H(["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=()=>{n-=1,0===n&&t()};let n=0;this.uberSource$=new Oe;this.autoMergeSubject$=this.uberSource$.pipe(hr((e=>{const t=e.observable.pipe(fr((e=>void 0!==e&&void 0!==e.action)),dr((e=>{const t=ze({},e);return t.action=e.action,this.tracer("autoMergeSubject$",t),t})));return!1===e.autoClosesBool?t:(n+=1,t.pipe(Cr(r)))}))),this.autoSubscriber$=this.autoMergeSubject$.pipe(fr((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(t={}){const r=p((e=>this.sendExtendedStreams(e))),n=(s=this.props.hashSourceMethods,i=t.action,void 0!==s[i]?i:e(_,T(e(m(A,i),(e=>new RegExp(e)))))(o(s)));var s,i;r(this.props.hashSourceMethods[n])(t),this.tracer("onSubscribeToSourcesNext",{payload:t})}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;ee(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=w(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===zr.isDevMode()&&r(String,t)&&b(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=w(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===zr.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 Rr(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 t=e=>e[0],n=this.addActionListeners(),o=n.map(t);if(!1===zr.isValidNestedArr(n))console.warn(`Spyne Warning: The array returned from addActionsListeners in ${this.props.name}, '${JSON.stringify(n)}', does not appear to be properly formatted!`);else{e(U((e=>{const t=p("",e[1]);!1===r(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!`)})),p([]))(n)}const s=()=>{void 0!==i(["props","addedChannels"],this)&&zr.checkIfActionsAreRegistered.bind(this)(this.props.addedChannels,o)};this.setTimeout(s,500)}}setDataVSID(){this.props.el.dataset.vsid=this.props.vsid}beforeAfterRender(){this.setDataVSID(),this.props.el$=Yr(this.props.el)}downStream(){}onRendered(){}onAnimFrameAfterRendered(){}afterRender(){}broadcastEvents(){return[]}getChannel(e){return S((e=>nt().includes(e)),(e=>rt.channelsMap.getStream(e).observer.pipe(vr((e=>!0!==this.deleted)))),(e=>console.warn(`channel name ${e} is not within ${nt}`)))(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)}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=i(["srcElement","isLocalEvent"]),a=i(["srcElement","vsid"]),c=[dr((e=>{const t=e;return t.$dir=o,t})),fr((e=>{const t=a(e);return!0!==s(e)||t===this.props.vsid}))];var l;!0===t&&c.unshift((l=1,fr((function(e,t){return l<=t}))));const d=this.getChannel(e).pipe(...c);this.updateSourceSubscription(d,!1),this.props.addedChannels.push(e)}checkIfChannelExists(e){const t=rt.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(t,r={},n){const o=r,i=p("VIEWSTREAM_EVENT"),a=e(i,s(t)),c={payload:o,action:n=n||a({CHANNEL_ROUTE:"CHANNEL_ROUTE_CHANGE_EVENT"})};try{if(c.srcElement=e(H(["id","vsid","class","tagName"]),s("props"))(this),!0===this.checkIfChannelExists(t)){!1===/CHANNEL_LIFECYCLE/.test(n)&&Object.defineProperties(c,{payload:{get:()=>st(r)}});const e=Re(c);return new Dr(t,e,c)}}catch(e){console.warn("SPYNE WARNING ",e)}}tracer(...e){this.sendLifecycleMethod(...e)}sendLifecycleMethodInactive(){}sendLifecycleMethodActive(e,t){const r="VS_DETRITUS_COLLECT"===t;!0===z({from$:j("internal"),action:j("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 Fr(e,t)}isLocalEvent(e){const t=i(["srcElement","el"],e),r=i(["props","el"],this);return zr.elIsDomElement(r)&&zr.elIsDomElement(t)&&r.contains(t)}addMixins(){const e=at();this.createId=e.createId}}class Br{constructor(e){const t=String(e.props.name),r=`${t}_ROUTE_UPDATER`;return Y(Br.createTemporaryViewStreamObj)({id:r,name:t})}static createTemporaryViewStreamObj(e,t){const{name:r,id:n}=e,o=t,s=new zr({id:n,name:r,data:t});s.onRendered=()=>{s.sendInfoToChannel("CHANNEL_ROUTE",o)},s.afterBroadcastEvents=()=>{s.disposeViewStream()},s.appendToNull()}}class Kr{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;this.props.sendCachedPayload=void 0===this.props.sendCachedPayload?r:this.props.sendCachedPayload,this.sendPayloadToRouteChannel=new Br(this),this.createChannelActionMethods(),this.streamsController=rt.channelsMap;const n=this.getMainObserver();this.checkForPersistentDataMode=Kr.checkForPersistentDataMode.bind(this),this.observer$=this.props.observer=n;const o=this.streamsController.getStream("DISPATCHER"),s=te(t.name,"name");o.pipe(fr(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 Ve(1):new Oe}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=I(t),n=void 0!==s("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 n=S(r(String),re,_),o=t.concat(this.addRegisteredActions(e)),s=k(n,o),i=d(ne((e=>oe(e,e)),s));this.channelActions=i}createChannelActionMethods(){const e=S(r(String),re,_),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=S(r(String),x("onViewStreamInfo"),(e=>{const r=se(ie(1),e);return t(r,e),r}));this.channelActionMethods=a(k((t=>[e(t),n(t)]),this.addRegisteredActions()))}addRegisteredActions(){let e=[];return i(["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=i(["data","action"],e),n=s(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=j(e.name,this.props.name),{action:r,payload:n,srcElement:o}=e.data,i=t=>({clone:()=>{return t=e.data,d([t,{action:s("action",t)},s("payload",t),s("srcElement",t)]);var t},action:r,payload:n,srcElement:o,event:t});return!0===t?(e=>e.observable.pipe(dr(i)).subscribe(this.getActionMethodForObservable(e)))(e):void 0}onViewStreamInfo(e){}sendChannelPayload(e,t,r={},n={},o=this.observer$){const s=new it(this.props.name,e,t,r,n);o.next(s)}getChannel(e,t){return S((e=>nt().includes(e)),(e=>{const r=this.streamsController.getStream(e).observer;return void 0!==t?r.pipe(fr(t)):r}),(e=>console.warn(`channel name ${e} is not within ${nt}`)))(e)}mergeChannels(e,t=!1){const r=e.map((e=>{if("string"==typeof e){const r=this.getChannel(e);return t?r:r.pipe(Ar(1))}return t?e:e.pipe(Ar(1))}));return(t?we:Pe)(r).pipe(dr((t=>{const r={};return e.forEach(((e,n)=>{r["string"==typeof e?e:`channel_${n}`]=t[n]})),r})))}static checkForNotTrackFlag(e={}){!0===e.doNotTrack&&rt.doNotTrackChannel(e.channelName)}}class qr{constructor(){this.checkIfObjIsNotEmptyOrNil=qr.checkIfObjIsNotEmptyOrNil.bind(this)}static checkIfObjIsNotEmptyOrNil(t){const r=e(g(I),_,v),o=e(g(b),_,v);return n([r,o])(t)}static checkIfParamValueMatchesRegex(t,n){const i=L(j("routeName")),a=e(i,o),c=e(F((e=>m(new RegExp(e),t))),a)(n);return r(String,c)&&(n=ae(t,s(c,n),n)),n}static formatStrAsWindowLocation(e){return{hash:e,search:e,pathname:e}}static getLocationStrByType(e,t=!1,r=window.location){return s({slash:"pathname",query:"search",hash:"hash"}[!0===t?"hash":e],r).replace(/^(\/)?(#)?(\/)?(.*)$/,"$4")}static createRouteArrayFromParams(e,t,n="slash",o){const i=[],a=t=>{const n={},c=t.routeName;let l=void 0!==e[c]?e[c]:s(c,o);const d=typeof t[l];"string"===d?l=t[l]:"undefined"===d&&(t=this.checkIfParamValueMatchesRegex(l,t)),n[c]=l,this.checkIfObjIsNotEmptyOrNil(n)&&i.push(n);const h=r(Object,t),u=_e(l,t),E=_e("routePath",t);if(!0===(u&&h)){const e=t[l];_e("routePath",e)&&a(e.routePath)}else!0===E&&void 0!==l&&a(t.routePath)};return a(t),i}static createSlashString(t){const r=L(b),n=ce(g(b,A),le("/")),o=de(/^(\^*)(.*|^\$)(\$)$/,"$2");return e(o,n,r,$,k(v))(t)}static createQueryString(t){const r=L(b),n=this.checkIfObjIsNotEmptyOrNil,o=e(le("="),$,c),s=S(n,o,x(void 0)),i=k(s),a=ce(g(I),f("?"));return e(a,le("&"),r,i)(t)}static checkPayloadForRegexOverrides(t,r,n="Value"){const i=e((e=>s(`${e}${n}`,r)),_,o);return k((t=>{const r=i(t);return void 0!==r?ae(e(_,o)(t),r,t):t}),t)}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=rt.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=qr.checkPayloadForRegexOverrides(l,e),l=qr.checkForRouteValWithMultipleVals(l),"query"===o?this.createQueryString(l):this.createSlashString(l)}static findIndexOfMatchedStringOrRegex(t,r){const n=de(/^$/,"^$"),o=J(te(t,"str"),e(m(A,t),s("re")));return e(he(j(!0)),k(o),k((e=>{return{str:e,re:(t=e,new RegExp(t))};var t})),k(n))(r)}static checkIfValueShouldMapToParam(t,n,o){const i=e(k(ue),k(T(r(String))),c)(t),a=qr.findIndexOfMatchedStringOrRegex(n,i);let l=n;if(a>=0){const n=i[a],o=Ee(t),c=e(_,p([]),s(n))(o);!0===/^([-$\w]*)$/.test(c)&&!0===r(String,c)&&(l=c)}return l}static createArrFromSlashStr(e){return e.replace(/^([/])?(.*)$/,"$2").split("/")}static convertSlashRouteStrToParamsObj(e,t,r){const n=t,o=this.createArrFromSlashStr(t),s=[],a=[];let c=e;pe(((e,t)=>{const n=this.checkIfValueShouldMapToParam(c,t,r);c=this.checkIfParamValueMatchesRegex(t,c);const o=J(I,b);void 0!==c&&(e=>e!==ue(s))(c.routeName)&&!1===o(n)&&(s.push(c.routeName),a.push(n));const l=i([t,"routePath"],c),d=i(["routePath"],c);void 0!==l?c=l:void 0!==d&&(c=d)}),0,o);const l=Ne(s,a),d=this.getLastArrVal(s);return{paths:s,pathInnermost:d,routeData:l,routeValue:n}}static getLastArrVal(e){return void 0!==ue(t=e)?ue(t):"";var t}static createDefaultParamFromEmptyStr(e,t){const r={};return r[e.routeName]=this.checkIfValueShouldMapToParam(e,t),r}static convertQueryStrToParams(t,r,n){const s=r,i=r.replace(/^([?])?(.*)$/,"$2"),c=e(k(K("=")),K("&"))(i);let l=a(c),d=k(_,c);!0===I(r)&&(l=this.createDefaultParamFromEmptyStr(t,r,n),d=o(l));return{paths:d,pathInnermost:this.getLastArrVal(d),routeData:l,routeValue:s}}static convertRouteToParams(e,t,r){if(void 0===t)return{};const n=void 0!==r?r:t.type,o=p({},s("regexTokens",t)),i=t.routes.routePath;return"query"===n?this.convertQueryStrToParams(i,e):(e=e.replace(/\/$|$/,"/"),this.convertSlashRouteStrToParamsObj(i,e,o))}}class Qr{constructor(){this.createPopStateStream=Qr.createPopStateStream.bind(this)}static createPopStateStream(e){Ue((function(e){window.onpopstate=e}),(function(){window.onpopstate=function(){}})).subscribe(e)}static getLastArrVal(e){return void 0!==ue(t=e)?ue(t):"";var t}static compareRouteKeywords(t={},r){const n=(e,t)=>void 0!==t?H(t,e):e;let i=n(t,r);return{pickValues:n,compare:(t={},r)=>{const a=n(t,r),c=t=>e(o,T(te(!0,t))),l=e(k((e=>{const t=s(e,i),r=s(e,a),n=j(t,r),o=void 0!==t,c=void 0!==r,l=!n,d=!1===o&&!0===c,h=!0===o&&!1===c,u={};return u[e]={same:n,changed:l,added:d,removed:h,previousExists:o,nextExists:c},u})),y,ne(o))([i,a]),d=ne(c("changed"),l),h=ne(c("added"),l),u=ne(c("removed"),l);return i=a,{pathsAdded:h,pathsRemoved:u,pathsChanged:d}},getComparer:()=>i}}static getRouteArrData(e,t){const r=T(h(A,e),t);return{paths:r,pathInnermost:Qr.getLastArrVal(r)}}static flattenConfigObject(e){const t=e=>ne((([e,r])=>"object"!=typeof r||null===r||Array.isArray(r)?[[e,r]]:k((([t,r])=>[`${e}.${t}`,r]),t(r))),c(e));return v(a(t(e)))}static addRouteDatasets(t){const{type:n,isHash:a}=t,d=e=>{const r="query"===n?"":!0===a?"#":"/",o=qr.convertParamsToRoute(e,t);return r+o.replace(/^(.*\/)([\w-]*\/?)(.*)$/gm,"$1$2")},u=/^([A-Za-z0-9_-])+$/m,E=(e=[],t,n={})=>{let{routeName:a}=t;return c(t).reduce(((t,c)=>{const[h,p]=c,N=r(Object,p),_=e=>m(u,e)?(e=>String(e).replace(/([-_])/g," ").toUpperCase())(e):h;if("routeName"===h||"404"===h)return t;a=a||s("routeName",p);let T=l(n);if(T[a]=String(h).replace(/([^A-Za-z0-9-_])/g,""),!0===N){if(1===o(T).length){const e=i(["routePath","routeName"],p);if(e){const r=l(T);r[e]="",r.navLevel=o(n).length,r.title=_(h),r.href=d(r),t.push(r)}}T=E(e,p,T)}else T.title=_(h),T.href=d(T);return T.navLevel=o(n).length,t.push(T),t}),[])},p=E([],t.routes),N=$(p);return{routeDatasetsArr:N,routeNamesArr:(t=>{const r=L(h(A,["title","href","navLevel"]));return e(y,r,$,k(o))(t)})(N)}}static conformRouteObject(t={},n=!1){const o=i(["channels","ROUTE"],t);let{add404s:s}=void 0!==o?o:t;s=s||n;const l=e=>{const t=e[1],n=r(Array,t);return""===t?e[1]="^$":n&&(e[1]=t.join("|")),e},d=e(a,k((t=>{const[n,o]=t,i=s?{404:".+"}:{},h=r(Object,o),u=r(Array,o),E="routePath"===n;return!0===h&&!1===u&&(t[1]=d(t[1]),E&&(t[1]=e(Te(i),a,k(l),c)(t[1]))),t})),c);if(void 0!==o){t.channels.ROUTE=d(t.channels.ROUTE);const e=Qr.addRouteDatasets(t.channels.ROUTE);return t.channels.ROUTE=w(t.channels.ROUTE,e),t}return d(t)}static getLocationData(){return u(["href","origin","protocol","host","hostname","port","pathname","search","hash"],window.location)}}class Xr extends Kr{constructor(e="CHANNEL_ROUTE",t={}){t.sendCachedPayload=!0,super("CHANNEL_ROUTE",t),this.createChannelActionsObj(),this.routeConfigJson=this.getRouteConfig(),this.bindStaticMethods(),this.navToStream$=new Ve(1),this.observer$=this.navToStream$.pipe(dr((e=>this.onMapNext(e)))),this.compareRouteKeywords=Qr.compareRouteKeywords()}checkConfigForHash(){!0===("hash"===rt.config.channels.ROUTE.type)&&(rt.config.channels.ROUTE.type="slash",rt.config.channels.ROUTE.isHash=!0)}onRegistered(){this.checkConfigForHash(),this.initStream()}createChannelActionsObj(){const e=this.addRegisteredActions(),t=d(ne((e=>oe(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=H(["isHash","isHidden","routes","type"],e.payload);rt.config.channels.ROUTE=w(rt.config.channels.ROUTE,t),rt.conformRouteConfig();const r=this.getRouteConfig();this.routeConfigJson=r,this.bindStaticMethodsWithConfigData(),this.sendChannelPayload("CHANNEL_ROUTE_CONFIG_UPDATED_EVENT",r,{},{},this.navToStream$)}getRouteConfig(){const e=rt.config,t=i(["channels","ROUTE"],e);"query"===t.type&&(t.isHash=!1);const r=Qr.flattenConfigObject(t.routes);return t.paramsArr=r,t}initStream(){this.firstLoadStream$=new Ve(1),this.onIncomingDomEvent(void 0,this.routeConfigJson,"CHANNEL_ROUTE_DEEPLINK_EVENT"),Qr.createPopStateStream(this.onIncomingDomEvent.bind(this)),this.observer$=Me(this.firstLoadStream$,this.navToStream$)}onMapNext(e,t=!1){return e.action="CHANNEL_ROUTE_CHANGE_EVENT",e}static removeSSID(e){const t=me(["routeData"]);return Ae(t,W(["vsid"]))(e)}static onIncomingDomEvent(e,t=this.routeConfigJson,n){const o=void 0!==n?n:this.channelActions.CHANNEL_ROUTE_CHANGE_EVENT,a=i(["state","routeCount"],e),c=!0===r(Number,a);let l=this.getDataFromString(t,c);!0===c&&(l.routeCount=a),"CHANNEL_ROUTE_DEEPLINK_EVENT"===n&&(l.linksData=s("routeDatasetsArr",t));const d=this.compareRouteKeywords.compare(l.routeData,l.paths);l=w(l,d),this.sendChannelPayload(o,l,void 0,e,this.navToStream$)}static checkForRouteParamsOverrides(e){return e}static checkForEventMethods(t){const r=e(T(m(/^(event)([A-Z].*)([A-Z].*)$/gm)),o,s("payload"))(t);if(r.length>=1){const e=s("event",t);if(void 0!==e){const t=de(/^(event)([A-Z])(.*)([A-Z].*)$/gm,((e,t,r,n,o)=>String(r).toLowerCase()+n+o)),n=r=>{const n=t(r);void 0!==e[n]&&e[n]()};r.forEach(n)}}return t}static checkForEndRoute(t,n=this.routeConfigJson,a){if(!0!==e(j("true"),i(["payload","endRoute"]))(t))return t;const l=void 0!==a?a:!0===rt.debug,{payload:d}=t;let h=0;const u=(t=[],n)=>{const i=n[1],{routePath:a}=i,E=s("routeName",a),p=(t=>{const r=s("routeName",t);if(r){const n=e(o,W(["routeName"]))(t),s=d[r];return F((e=>new RegExp(`^${e}$`).test(s)),n)}})(a),N=r(Object,i),_=r(Array,i);if(h+=1,!0===N&&!1===_){const r=a[p];r?e(fe,pe(u,t),c)({nextRoutePath:r}):1===h?l&&console.warn(`Spyne Warning: use of end route method should add start route value of "${E}".`):t.push(E)}return t},{routes:E}=n,p=e(fe,pe(u,[]),c)({routes:E});if(1===p.length){const e=p[0];t.payload[e]=""}return t}onViewStreamInfo(e){const t=this.channelActions.CHANNEL_ROUTE_CHANGE_EVENT;Xr.checkForEventMethods(e),e=this.checkForEndRoute(e);let r=this.getDataFromParams(e);const n=s("srcElement",e),o=s("event",e),i=!r.isHidden,a=this.compareRouteKeywords.compare(r.routeData,r.paths);r=w(r,a),this.sendRouteStream(r,i),r=Xr.removeSSID(r),this.sendChannelPayload(t,r,n,o,this.navToStream$)}static checkAndConvertStrWithRegexTokens(e,t){return o(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=s("payload",e);const n=this.getRouteStrFromParams(r,t),o=(e,r)=>p(r,s(e,t)),i=o("type","slash"),a=o("isHash",!1),c=qr.formatStrAsWindowLocation(n),l=this.getDataFromLocationStr(i,a,c),{pathInnermost:d,paths:h}=l;r=w(l.routeData,r);const{routeCount:u,isDeepLink:E,isHash:N,isHistory:_,isHidden:T,routeType:m}=this.getExtraPayloadParams(t);return{isDeepLink:E,routeCount:u,pathInnermost:d,paths:h,routeData:r,routeValue:n,isHash:N,isHidden:T,isHistory:_,routeType:m}}static getDataFromString(e=this.routeConfigJson,t=!1){const r=e.type,n=!0===e.isHash,o=qr.getLocationStrByType(r,n),{paths:s,pathInnermost:i,routeData:a,routeValue:c}=Xr.getParamsFromRouteStr(o,e,r),{routeCount:l,isDeepLink:d,isHash:h,routeType:u,isHidden:E}=this.getExtraPayloadParams(e,t);return{isDeepLink:d,routeCount:l,pathInnermost:i,paths:s,routeData:a,routeValue:c,isHash:h,isHidden:E,isHistory:t,routeType:u}}static getDataFromLocationStr(e="slash",t=this.routeConfigJson.isHash,r=window.location){const n=void 0!==this.routeConfigJson?this.routeConfigJson.type:e,o=qr.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 u(["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 qr.convertParamsToRoute(e,t,n)}static getParamsFromRouteStr(e,t,r){const n=void 0!==r?r:t.type;return qr.convertRouteToParams(e,t,n)}checkEmptyRouteStr(e,t=!1){const r=I(e);return!0===(!0===r&&!1===t)||!0===(!0===r&&!0===t)?"/":!0===(!1===r&&!0===t)?f("#",e):e}static removeLastSlash(e){return e.replace(/^(.*)(\/)$/,"$1")}setWindowLocation(t){let{isHash:r,routeValue:n,routeType:o}=t;n=this.checkEmptyRouteStr(n,r);const{routeCount:s}=t;if(!0===r||"query"===o){n=Xr.removeLastSlash(window.location.pathname)+n,window.history.pushState({routeCount:s},"",n)}else{const t=ce(e(g(j("/")),_),f("/",A));window.history.pushState({routeCount:s},"",t(n))}}getWindowLocation(){return window.location.pathname}bindStaticMethods(){this.checkForEndRoute=Xr.checkForEndRoute.bind(this),this.getIsDeepLinkBool=Xr.getIsDeepLinkBool.bind(this),this.getDataFromLocationStr=Xr.getDataFromLocationStr.bind(this),this.onIncomingDomEvent=Xr.onIncomingDomEvent.bind(this),this.getDataFromString=Xr.getDataFromString.bind(this),this.getParamsFromRouteStr=Xr.getParamsFromRouteStr.bind(this),this.getLocationData=Xr.getLocationData.bind(this),this.getRouteState=Xr.getRouteState.bind(this),this.getDataFromParams=Xr.getDataFromParams.bind(this),this.getRouteCount=Xr.getRouteCount.bind(this),this.getExtraPayloadParams=Xr.getExtraPayloadParams.bind(this),this.bindStaticMethodsWithConfigData()}bindStaticMethodsWithConfigData(){const e=Ce(3,Xr.getRouteStrFromParams);this.getRouteStrFromParams=e(A,this.routeConfigJson,this.routeConfigJson.type)}}class Jr extends Kr{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=Le.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=me(["payload"]);return Ae(t,W(["vsid"]))(e)}onIncomingObservable(e){const t=j(e.name,this.props.name);e.data=Jr.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(dr(o)).subscribe(this.onUIEvent.bind(this)))(e):void 0}getActionState(t){const r=i(["event","type"]),n=i(["event","typeOverRide"]),o=e(ye,J(n,r))(t),s="CHANNEL_UI";return void 0!==o?`${s}_${o}_EVENT`:s}static checkForEventMethods(t){const r=e(T(m(/^(event)([A-Z].*)([A-Z].*)$/gm)),o,s("payload"))(t);if(r.length>=1){const e=s("event",t);if(void 0!==e){const t=de(/^(event)([A-Z])(.*)([A-Z].*)$/gm,((e,t,r,n,o)=>String(r).toLowerCase()+n+o)),n=r=>{const n=t(r);void 0!==e[n]&&"function"==typeof e[n]&&e[n]()};r.forEach(n)}}return t}onUIEvent(e){Jr.checkForEventMethods(e),e.action=this.getActionState(e);const t=e.action,{payload:r,srcElement:n}=e,o=e.event;this.sendChannelPayload(t,r,n,o)}}class Zr{constructor(){this.createDomObservableFromEvent=Zr.createDomObservableFromEvent.bind(this)}static createDomObservableFromEvent(e,t,r=!0,n=window){return t=void 0===t?e=>e:t,Ue((t=>n.addEventListener(e,t,{passive:r})),(()=>{n[e]=e=>e})).pipe(dr(t))}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(e,t){const r=(e=>t=>(t.mediaQueryName=e,t))(t),n=(o=e,{addHandler:e=>{o.addListener(e)},removeHandler:e=>{o.onchange=()=>{}}});var o;return new Ue(n.addHandler,n.removeHandler).pipe(dr(r))}static createMergedObsFromObj(e){const t=e.mediaQueries||e.mediaQueries,r=[];return O(((e,t,n)=>{const o=Zr.createMediaQuery(e);return!1!==o&&r.push(Zr.createMediaQueryHandler(o,t)),r}),t),r}}class en extends Kr{constructor(e="CHANNEL_WINDOW"){super(e),this.bindStaticMethods(),this.currentScrollY=0}initializeStream(){this.domChannelConfig=rt.config.channels.WINDOW;const e=this.getActiveObservables(),t=Me(...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 Y(en.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:H(["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=H(["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:H(["matches","media","mediaQueryName"],e),srcElement:e.srcElement,event:e}}createMouseWheelObservable(e){const t=e.debounceMSTimeForScroll;return Zr.createDomObservableFromEvent("wheel",en.getMouseWheelMapFn.bind(this)).pipe(Tr(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(en.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=en.getScrollData(),l=ge(en.getScrollMapFn,[a,c,i,r,o]).bind(this);return Zr.createDomObservableFromEvent("scroll",l,r,o).pipe(Tr(n),(d=e=>0===e.scrollDistance,mt((function(e,t){var r=!1,n=0;e.subscribe(rr(t,(function(e){return(r||(r=!d(e,n++)))&&t.next(e)})))}))),dr((e=>{const t=en.getScrollY(o);return e.payload.scrollDistanceAbs=Math.abs(this.currentScrollY-t),this.currentScrollY=t,e})));var d}createOrientationObservable(e){return Zr.createDomObservableFromEvent("orientationchange",en.getOrientationMapFn.bind(this))}createResizeObservable(e){const t=e.debounceMSTimeForResize;return Zr.createDomObservableFromEvent("resize",en.getResizeMapFn.bind(this)).pipe(Tr(t))}getEventsFromConfig(e=this.domChannelConfig){const t=e.events;return k((e=>{const t=en.createCurriedGenericEvent(e);return Zr.createDomObservableFromEvent(e,t)}),t)}getActiveObservables(e=this.domChannelConfig){let t=[];e.listenForMediaQueries=dt(e.mediaQueries)||dt(e.mediaQueries);const r={listenForResize:this.createResizeObservable.bind(this),listenForOrientation:this.createOrientationObservable.bind(this),listenForScroll:this.createScrollObservable.bind(this),listenForWheel:this.createMouseWheelObservable.bind(this)};O(((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 ee(Me,t).pipe(dr(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=ze(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=Zr.createMediaQueryHandler.bind(this),this.createMergedObsFromObj=Zr.createMergedObsFromObj.bind(this)}}class tn extends Kr{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,undefined)),0)}}class rn extends Kr{constructor(e,t={}){t.isProxy=!0,super(e,t),this.props=t,this.subject$=new Oe,this.replaySub$=new Ve(1),this.observer$=Me(this.subject$,this.replaySub$);!0===rt.debug&&this.checkIfChannelIsStillProxy(e)}getMergedSubject(e=!1){return!0===e?this.replaySub$:this.subject$}checkIfChannelIsStillProxy(e){const t=e;ct((()=>{!0!==h(t,rt.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 nn=new Map;class on{constructor(){this.addMixins(),nn.set("DISPATCHER",new Oe),this.listRegisteredChannels=on.listRegisteredChannels.bind(this),this.getChannelsList=on.getChannelsList.bind(this)}get map(){return nn}static getChannelsList(){return Array.from(nn,((e,t)=>({key:e[0],val:e[1].constructor.name})))}static listRegisteredChannels(e=!1){const t=this.getChannelsList(),r=L(te("ChannelProxy","val")),n=T(te("ChannelProxy","val")),o=(!0===e?n:r)(t);return Ie(["key"],o)}listProxyChannels(){return this.listRegisteredChannels(!0)}checkForMissingChannels(){const t=this.getChannelsList(),r=T(te("ChannelProxy","val"))(t);if(r.length>=1){const t=`Spyne Warning: The following ${1===r.length?"Channel has":"Channels have"} not been initialized: ${e(le(", "),k(s("key")))(r)}`;console.warn(t)}}init(){this.createMainStreams()}createMainStreams(){this.routeStream=new Xr,nn.set("CHANNEL_ROUTE",this.routeStream),this.uiStream=new Jr,nn.set("CHANNEL_UI",this.uiStream),this.domStream=new en,nn.set("CHANNEL_WINDOW",this.domStream),this.viewStreamLifecycle=new tn,nn.set("CHANNEL_LIFECYCLE",this.viewStreamLifecycle),this.routeStream.initializeStream(),this.domStream.initializeStream()}addKeyEvent(e){nn.get("UI").addKeyEvent(e)}registerStream(t){const r=t.channelName;if(nn.has(r)){if(e(ve(["props","isRegistered"],!0))(nn.get(r)))return void console.warn(`Spyne Warning: The Channel, ${r}, has already been registered!`)}nn.set(r,t),t.initializeStream()}getChannelActions(e){return nn.get(e).addRegisteredActions()}getProxySubject(e,t=!1){const r=!0===t?"replaySubject":"subject";return nn.get(e)[r]}testStream(e){return void 0!==nn.get(e)}getStream(e){return!1===this.testStream(e)&&nn.set(e,new rn(e)),nn.get(e)}addMixins(){}}class sn{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(t,r=[]){const n=f(["length","name","prototype","constructor"],r),o=e(C(n),y),s=o(Object.getOwnPropertyNames(t.constructor.prototype)),i=o(Object.getOwnPropertyNames(t.constructor));return{methods:s,staticMethods:i,allMethods:f(s,i)}}(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=L((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 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=Ce(2,n)(A,!0);return k(o,e.staticMethods),k(n,e.methods),r}autoBinder(){const e=this.getEnhancerMethods();return this.allMethodsList=this.bindParentViewStream(e,this.parentContext),this.allMethodsList}}class an{constructor(e,t,r,n){this._mapFn=an.setMapFn(e),this._url=an.setUrl(e),this._responseType=an.setResponseType(e),this._serverOptions=an.setServerOptions(e),this._subscriber=void 0!==t?t:e=>console.log("FETCH RETURNED ",e),this.debug=void 0!==e.debug&&e.debug,this.channelName=n;const o={mapFn:this.mapFn,url:this.url,serverOptions:this.serverOptions,responseType:this.responseType,debug:this.debug};!0!==r&&an.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=We(window.fetch(o,s)).pipe(br(c),yr((e=>We(e[i]()))),dr((e=>{const t={channelName:r,url:o,responseType:i,serverOptions:s};return r=>e(r,t)})(n)),Ir());l.connect(),l.subscribe(t)}static setMapFn(t){return e(p((e=>e)),s("mapFn"))(t)}static setUrl(e){const t=s("url",e);return void 0===t&&console.warn("SPYNE WARNING: URL is undefined for data channel"),t}static setResponseType(e){return p("json",s("responseType",e))}get mapFn(){return this._mapFn}get url(){return this._url}get serverOptions(){return this._serverOptions}get responseType(){return this._responseType}static stringifyBodyIfItExists(t){return ce(be(Object,"body"),e(Ae(me("body"),JSON.stringify)))(t)}static updateMethodWhenBodyExists(e){const t=_e("body"),r=te("GET","method"),o=n([t,r]);return ce(o,ae("method","POST"))(e)}static setServerOptions(e){const t=H(["method","headers","body","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive"],e);let r=Te(an.baseOptions(),t);return r=an.updateMethodWhenBodyExists(r),r=an.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 cn extends Kr{constructor(e,t={}){cn.validateMapMethod(t,e),void 0!==t.map&&(t.mapFn=t.map),t.extendedActionsArr=[`${e}_DATA_EVENT`,[`${e}_UPDATE_DATA_EVENT`,"onFetchUpdate"]],t.sendCachedPayload=!0,super(e,t)}static validateMapMethod(t,r,o=!1){const s=J(b,(e=>"function"!=typeof e)),i=q(s),a=n([i,e=>e.length>=1]);return!e(a,v,H(["map","mapFn"]))(t)||(!1===o&&console.warn(`Spyne Warning: The map method for ChannelFetch, ${r}, appears to be invalid`),!1)}onRegistered(){this.startFetch()}addRegisteredActions(t){const r=e(p([]),i(["props","extendedActionsArr"]));return["CHANNEL_DATA_EVENT",["CHANNEL_UPDATE_DATA_EVENT","onFetchUpdate"]].concat(r(this))}startFetch(e={},t=this.onFetchReturned.bind(this)){const r=this.consolidateAllFetchProps(e);return new an(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}_DATA_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=i(["viewStreamInfo","payload"],e);return H(["mapFn","url","header","body","mode","method","responseType","debug"],t)}consolidateAllFetchProps(t,r=this.props){const n=H(["mapFn","url","header","body","mode","method","responseType","debug"],r),o=L(b);return e(o,((e,t)=>Te(e,t)))(n,t)}get observer(){return this.observer$}}let ln=rt;class dn{constructor(e={}){let{name:t,config:r,parentEl:n}=e;this.props=e,void 0===r&&(r=l(e)),this.name=t||"empty",this.props.name=t,r=dn.mergeDefaultConfig(r,this.defaultConfig()),this.props.parentEl=n||dn.createParentEl(),this.props.config=r,void 0!==this.props.traits&&this.addTraits(this.props.traits)}register(e){ln=e,this.props.pluginName=this.props.name,!1!==ln.initialized?(this.onBeforeRegistered(),this.props.config=l(this.props.config),ln.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 ln}static mergeDefaultConfig(e={},t=this.defaultConfig()){return Object.assign(t,e)}static getSpyneApp(e,t){!1===ln.initialized?console.warn(`Spyne Warning: Unable to install plugin, ${e}! SpyneApp has not been initialized!`):ln.addPluginConfig(e,t)}static updateSpyneConfig(e,t,n){return!0===Se(r(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 pt({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(){}defaultConfig(){return{}}onRegistered(){}onRender(){}}const hn=new on,un="0.20.5";let En=new class{constructor(){this.version=un}get channels(){return hn}init(e={},t=!1){
|
|
2
2
|
/*!
|
|
3
|
-
* Spyne 0.20.
|
|
3
|
+
* Spyne 0.20.5
|
|
4
4
|
* https://spynejs.org
|
|
5
5
|
*
|
|
6
|
-
* @license
|
|
7
|
-
*
|
|
6
|
+
* @license
|
|
7
|
+
* Copyright 2017-2025, Frank Batista,
|
|
8
|
+
* Relevant Context, LLC. All rights reserved.
|
|
8
9
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
* Licensed under the GNU Lesser General Public License v3.0 (the "License");
|
|
11
|
+
* You may not use this file except in compliance with the License.
|
|
12
|
+
* A copy of the License is located in the project root, or at:
|
|
13
|
+
* https://www.gnu.org/licenses/lgpl-3.0.html
|
|
14
|
+
*
|
|
15
|
+
* This notice may not be removed or altered from any distribution.
|
|
16
|
+
*/
|
|
17
|
+
if(!0===rt.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:{},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=Qr;e=rt.initialize(r,e,hn,t)}this.pluginsFn=rt.getPluginsMethodObj(e.pluginMethods),this.getChannelActions=e=>hn.getChannelActions(e),this.registerChannel=e=>hn.registerStream(e),this.registerPlugin=e=>rt.registerPlugin(e),this.registerDataChannel=e=>hn.registerStream(e),this.listChannels=()=>Array.from(hn.map.keys());let n=new zr({id:"spyne-null-views"});n.appendToDom(document.body),n.props.el.style.cssText="display:none; opacity:0; pointer-events:none;",hn.init(),!0===rt.config.debug&&(window.Spyne={version:un}),(e=>{if(ut)console.warn("sanitizeHTML is already configured. Reconfiguration is not allowed.");else{if(e.strict)if(window.trustedTypes){const e=window.trustedTypes.createPolicy("default",{createHTML:e=>Fe.sanitize(e,{RETURN_TRUSTED_TYPE:!1})});ht=t=>e.createHTML(t)}else ht=e=>Fe.sanitize(e);else ht=e=>e;ut=!0}})(rt.config)}static listChannels(){return Array.from(hn.map.keys())}static getChannelActions(e){return hn.getChannelActions(e)}static registerChannel(e){if(!1!==rt.initialized)return hn.registerStream(e);console.warn("Spyne has not been initialized")}};export{Kr as Channel,cn as ChannelFetch,an as ChannelFetchUtil,it as ChannelPayload,Fr as ChannelPayloadFilter,on as ChannelsMap,pt as DomElement,Et as DomElementTemplate,En as SpyneApp,rt as SpyneAppProperties,dn as SpynePlugin,sn as SpyneTrait,zr as ViewStream,Rr as ViewStreamBroadcaster,Lr as ViewStreamElement,Dr as ViewStreamPayload,Yr as ViewStreamSelector,ze as deepMerge,st as safeClone};
|
|
13
18
|
//# sourceMappingURL=spyne.esm.js.map
|