@telia-ace/widget-runtime-flamingo 1.1.111-rc.5 → 1.1.111-rc.6
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/{index-Cb43X4KG.js → index-Bu5g2Hh-.js} +17 -17
- package/{index-BpOmXqng.mjs → index-CXqQFmLN.mjs} +148 -149
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/package.json +1 -1
- package/{render-CDXkSh_X.js → render-BWvHPAsL.js} +7 -7
- package/{render-DPn5L-ek.mjs → render-DUlmO95v.mjs} +33 -33
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
"use strict";const Nt=(i,t,e,...s)=>{const n=`[${i.get("$environment").name||"webprovisions"}] ${e}`;switch(t){case"info":console.info(n,...s);break;case"warning":console.warn(n,...s);break;case"error":console.error(n,...s);break}},es=i=>{const t=i.container||i;return{info:(e,...s)=>Nt(t,"info",e,...s),warn:(e,...s)=>Nt(t,"warning",e,...s),error:(e,...s)=>Nt(t,"error",e,...s)}};var et=(i=>(i.Implementation="implementation",i.Widget="widget",i))(et||{}),N=(i=>(i.Pre="pre",i.Post="post",i))(N||{});const ss=(i,t,e,s)=>{try{const n=new t(e,s);return{name:i,invoke:(r,o)=>{let a;return n[r]&&(a=n[r].call(n,o)),Promise.resolve(a)},getInstance:()=>n}}catch(n){if(n.message&&n.message.indexOf("is not a constructor")>=0)return{name:i,invoke:r=>{let o;return r==="initialize"&&(o=t(e,s)),Promise.resolve(o)},getInstance:()=>t};throw n}};function re(i,t){return typeof i>"u"?t:i}let is=class{constructor(t={}){this.part=t}createCommand(t,e,s){let n;typeof e=="function"?n={scope:et.Widget,stage:N.Post,defaultArgs:void 0,handlerResolver:e}:n={scope:re(e.scope,et.Widget),stage:re(e.stage,N.Post),defaultArgs:e.defaultArgs,handlerResolver:s};let r=this.part;const o=t.split(".");return o.forEach((a,h)=>{h===o.length-1?r[a]||(r[a]=()=>n):r=this.part[a]=this.part[a]||{}}),this}get(){return this.part}};const Ee=i=>{const t=new is({});return i(t),t.get()};Ee(i=>{i.createCommand("types.register",{scope:et.Implementation,stage:N.Pre},t=>(e,s)=>{t.container.get("$types")[e]=s}).createCommand("type",{stage:N.Pre},t=>e=>{t.container.register("$type",e)}).createCommand("settings",{stage:N.Pre,defaultArgs:[null]},t=>e=>{t.events.dispatch("settings:change",e,{bubbles:!0}),t.container.register("$settings",e)}).createCommand("plugin",{stage:N.Pre},t=>(e,s,n)=>{const{container:r}=t;let o=null,a=e,h=s;typeof e=="string"&&(o=e,a=s,h=n);const c=d=>{const{transformPluginSettings:l}=t.container.get("$environmentOptions"),p=l?l(h||{},o,t.container,a):s;try{const u=ss(o,a,r,p);r.get("$plugins").push(u),d&&u.invoke("initialize",null)}catch(u){es(t).warn("Error when initializing plugin",u)}};t.container.get("$instance")?c(!0):t.events.subscribeOnce("widget:instance-created",()=>c(!1))}).createCommand("container.register",t=>(e,s)=>{t.container.register(e,s)}).createCommand("container.registerAsync",t=>(e,s)=>{t.container.registerAsync(e,s)}).createCommand("container.registerFactory",t=>(e,s)=>{t.container.registerFactory(e,s)}).createCommand("container.touch",t=>(e,s)=>{t.container.touch(e,s)}).createCommand("csp",{},t=>e=>{t.container.register("csp",e)})});function ns(i){const t={};return[].filter.call(i.attributes,e=>/^data-/.test(e.name)).map(e=>e.name).forEach(e=>t[e.substr(5)]=i.getAttribute(e)),t}const rs=(i,t,e)=>{const s=ns(i);e({sourceDOMElement:i,eventType:t,data:s})};function oe(i,t,e){i.forEach(s=>{s.dataset.attached!=="true"&&(rs(s,t,e),s.dataset.monitored="true")})}function os(i,t,e){const s=i.container.get("bootstrapping.monitor");s&&s.events.subscribe("bootstrap:trigger-elements-updated",(r,o)=>{oe(o.triggerElements,t,e)});const n=i.container.get("triggerElements");n&&oe(n,t,e)}Ee(i=>{i.createCommand("ready",{scope:et.Implementation,stage:N.Pre},t=>e=>{const{container:s}=t,n=s.owner;s.get("bootstrapping").ready?e(n):n.events.subscribeOnce("bootstrap:ready",()=>{e(n)})})});const Mt=(i,t,e,...s)=>{const n=`[${i.get("$environment").name||"webprovisions"}] ${e}`;switch(t){case"info":console.info(n,...s);break;case"warning":console.warn(n,...s);break;case"error":console.error(n,...s);break}},as=i=>{const t=i.container||i;return{info:(e,...s)=>Mt(t,"info",e,...s),warn:(e,...s)=>Mt(t,"warning",e,...s),error:(e,...s)=>Mt(t,"error",e,...s)}};var ft=(i=>(i.Implementation="implementation",i.Widget="widget",i))(ft||{}),T=(i=>(i.Pre="pre",i.Post="post",i))(T||{});const cs=(i,t,e,s)=>{try{const n=new t(e,s);return{name:i,invoke:(r,o)=>{let a;return n[r]&&(a=n[r].call(n,o)),Promise.resolve(a)},getInstance:()=>n}}catch(n){if(n.message&&n.message.indexOf("is not a constructor")>=0)return{name:i,invoke:r=>{let o;return r==="initialize"&&(o=t(e,s)),Promise.resolve(o)},getInstance:()=>t};throw n}};function ae(i,t){return typeof i>"u"?t:i}class hs{constructor(t={}){this.part=t}createCommand(t,e,s){let n;typeof e=="function"?n={scope:ft.Widget,stage:T.Post,defaultArgs:void 0,handlerResolver:e}:n={scope:ae(e.scope,ft.Widget),stage:ae(e.stage,T.Post),defaultArgs:e.defaultArgs,handlerResolver:s};let r=this.part;const o=t.split(".");return o.forEach((a,h)=>{h===o.length-1?r[a]||(r[a]=()=>n):r=this.part[a]=this.part[a]||{}}),this}get(){return this.part}}const Jt=i=>{const t=new hs({});return i(t),t.get()};Jt(i=>{i.createCommand("types.register",{scope:ft.Implementation,stage:T.Pre},t=>(e,s)=>{t.container.get("$types")[e]=s}).createCommand("type",{stage:T.Pre},t=>e=>{t.container.register("$type",e)}).createCommand("settings",{stage:T.Pre,defaultArgs:[null]},t=>e=>{t.events.dispatch("settings:change",e,{bubbles:!0}),t.container.register("$settings",e)}).createCommand("plugin",{stage:T.Pre},t=>(e,s,n)=>{const{container:r}=t;let o=null,a=e,h=s;typeof e=="string"&&(o=e,a=s,h=n);const c=d=>{const{transformPluginSettings:l}=t.container.get("$environmentOptions"),p=l?l(h||{},o,t.container,a):s;try{const u=cs(o,a,r,p);r.get("$plugins").push(u),d&&u.invoke("initialize",null)}catch(u){as(t).warn("Error when initializing plugin",u)}};t.container.get("$instance")?c(!0):t.events.subscribeOnce("widget:instance-created",()=>c(!1))}).createCommand("container.register",t=>(e,s)=>{t.container.register(e,s)}).createCommand("container.registerAsync",t=>(e,s)=>{t.container.registerAsync(e,s)}).createCommand("container.registerFactory",t=>(e,s)=>{t.container.registerFactory(e,s)}).createCommand("container.touch",t=>(e,s)=>{t.container.touch(e,s)}).createCommand("csp",{},t=>e=>{t.container.register("csp",e)})});var Ae=(i=>(i.Activating="activating",i.Loading="loading",i.Activated="activated",i.Deactivating="deactivating",i.Deactivated="deactivated",i))(Ae||{});class ds{constructor(t){this.container=t,this.widget=t.get("$widget"),this.settings=t.get("$settings"),this.events=this.widget.events,this.widget.events.subscribe("settings:change",(e,s)=>{this.settings=s})}}const _t=(i,t,...e)=>typeof t=="string"?i(`[humany] ${t}`,...e):i(t,...e),Z=class{constructor(){this.keys=[],this.log=(t,...e)=>this.lookup(t,()=>Z.log(...e)),this.warn=(t,...e)=>this.lookup(t,()=>Z.warn(...e)),this.error=(t,...e)=>this.lookup(t,()=>Z.error(...e)),this.info=(t,...e)=>this.lookup(t,()=>Z.info(...e))}lookup(t,e){this.keys.indexOf(t)===-1&&(this.keys.push(t),e())}};let v=Z;v.log=(...i)=>_t(console.log,...i);v.warn=(...i)=>_t(console.warn,...i);v.error=(...i)=>_t(console.error,...i);v.info=(...i)=>_t(console.info,...i);const Ce=i=>{let t={},e,s;if(typeof i!="object"||i===null)return i;t=Array.isArray(i)?[]:{};for(s in i)e=i[s],t[s]=typeof e=="object"&&e!==null?Ce(e):e;return t};function ce(i){let t=0;if(i.length===0)return t.toString();for(let e=0;e<i.length;e++){const s=i.charCodeAt(e);t=(t<<5)-t+s,t=t&t}return t.toString()}let ls=class{constructor(t,e){this.lockWarningTime=t,this.lockErrorTime=e,this.tasks=[],this.current=Promise.resolve(),this.next=this.next.bind(this)}add(t,e,s,n){this.tasks.push({task:t,resolve:e,reject:s,done:n}),this.next()}next(){this.current=this.current.then(()=>{const t=this.tasks.shift();if(t){let e;const s=setTimeout(()=>{process.env.NODE_ENV!=="production"&&v.warn(`A lock has exceeded ${this.lockWarningTime} ms. Waiting additional ${this.lockErrorTime} ms before rejecting the task.`,t),e=setTimeout(()=>{t.reject("lock timeout exceeded")},this.lockErrorTime)},this.lockWarningTime),n=Promise.resolve(t.task()).then(r=>(clearTimeout(s),clearTimeout(e),r));return Promise.resolve(n).then(this.next).then(()=>n.then(r=>{t.done(),t.resolve(r)})).catch(r=>(t.done(),t.reject(r),this.next()))}return Promise.resolve()})}};const ht=new WeakMap;function E(i,t=5e3,e=1e3){return ht.has(i)||ht.set(i,new ls(t,e)),s=>new Promise((n,r)=>{const o=ht.get(i);o.add(s,n,r,()=>{o.tasks.length||ht.delete(i)})})}const ps=(i,t)=>{const e=()=>t.querySelectorAll("[data-loading=true]").length>0,s=(()=>{let n=!1;return()=>{n||(i.get("$widget").events.dispatch("widget:data-loaded",{element:t}),n=!0)}})();if(!e())return s();new MutationObserver((n,r)=>{n.find(o=>o.type==="attributes"&&o.attributeName==="data-loading")&&!e()&&(r.disconnect(),s())}).observe(t,{attributes:!0,childList:!0,subtree:!0})},us=(i,t)=>{i.get("$widget").container.getAsync("components").then(e=>{e.events.subscribeOnce("components:component-model-initialized",()=>{let s=e.nodes.visible.reduce((r,o)=>(!o.name||!o.type||o.type==="view"||o.type==="root"||o.attributes.layout.size==="none"||t.querySelector(`[data-name="${o.name}"]`)||r.push(o.name),r),[]),n=!1;new MutationObserver((r,o)=>{r.forEach(a=>{if(a.addedNodes){const h=Array.from(a.addedNodes).reduce((c,d)=>{const l=d.getAttribute&&d.getAttribute("data-name");return l&&s.indexOf(l)>-1&&c.push(l),c},[]);s=s.filter(c=>h.indexOf(c)===-1),!n&&s.length===0&&(n=!0,ps(i,t),o.disconnect())}})}).observe(t,{attributes:!1,characterData:!1,childList:!0,subtree:!0,attributeOldValue:!1,characterDataOldValue:!1})})})},S=()=>Math.floor((1+Math.random())*65536).toString(16).substring(1);function rt(){return S()+S()+"-"+S()+"-"+S()+"-"+S()+"-"+S()+S()+S()}class gs{constructor(t){const{events:e}=t.get("$widget");this.events=e.createChild(this)}action(t,e,s){this.events.dispatch("data:action",{action:e,value:s,target:t},{bubbles:!0})}subscribe(t,e){return this.events.subscribe("data:action",(s,{action:n,value:r,target:o})=>t===o&&e(t,n,r))}}const Oe=i=>{const t=[];return[(e,s)=>{t.push(i.subscribe(e,s))},()=>{t.forEach(e=>{e()})}]};let F=class{constructor(t,e=[]){this.platform=t,this.rules=e}match(t){return this.rules.every(e=>!(e.id&&e.id!==t.id||e.type&&e.type!==t.type))}ofType(t){return this.rules.push({type:t}),this}withId(t){return this.rules.push({id:t}),this}select(){return new ms(this.platform,this)}},Ft=class{constructor(t,e,s){this.platform=t,this.node=e,this.actions=new xt(t,new F(t).withId(e.id),s);const[n,r]=Oe(this.platform.events);this.subscribe=n,this.unsubscribe=r}properties(t){return t&&this.node.touchProperties(e=>t(e)),this.node.attributes.properties}context(t){return t&&this.subscribe("components:context-changed",(e,{node:s})=>{s===this.node&&t(this.node.attributes.context)}),this.node.attributes.context}layout(t){return t&&this.subscribe("components:layout-changed",(e,{node:s})=>{s===this.node&&t(this.node.attributes.layout)}),this.node.attributes.layout}writeProperties(t,e){this.node.writeProperties(t,e)}writeContext(t,e){this.node.writeProperties(t,e)}writeLayout(t,e){this.node.writeLayout(t,e)}dispose(){this.unsubscribe(),this.actions.dispose()}};class ms{constructor(t,e,s=!0){this.platform=t,this.target=e,this.clearOnDispose=s,this.removes=[],this.actions=new xt(this.platform,this.target)}writeProperties(t,e){this.removes.push(this.platform.write({options:e,attributes:{properties:t},target:this.target,removable:this.clearOnDispose}))}writeContext(t,e){this.removes.push(this.platform.write({options:e,attributes:{context:t},target:this.target,removable:this.clearOnDispose}))}writeLayout(t,e){this.removes.push(this.platform.write({options:e,attributes:{layout:t},target:this.target,removable:this.clearOnDispose}))}dispose(){this.removes.forEach(t=>{t()}),this.actions.dispose()}}const fs=(i,t,e)=>{const s=i.concat(),n=(r,o,a)=>{let h=!0;if(s.length){const c=s.shift(),d=(l,p)=>(h=!1,n(l,Object.assign({},o,p),a));return Promise.resolve(c(r,d,a)).then(l=>({...l,cancelled:h}))}return Promise.resolve({data:r,cancelled:!1,options:o})};return n(t,{},e)};let xt=class{constructor(t,e,s){this.platform=t,this.target=e,this.ns=s,this.subscriptions=[],this.create=this.create.bind(this)}create(t,e=()=>{}){const s={key:t,fn:e,target:this.target,ns:this.ns};this.platform.actionsState.handlers.push(s);const n=()=>{const r=this.platform.actionsState.handlers.indexOf(s);r>-1&&this.platform.actionsState.handlers.splice(r,1)};return this.subscriptions.push(n),n}dispatch(t,e){const s=this.platform.nodes.all.concat(this.platform.nodes.detached),n={},r=this.platform.actionsState.handlers.filter(o=>o.key===t&&(!o.ns||!this.ns||o.ns===this.ns));return Promise.all(r.map(o=>{const a=s.filter(c=>o.target.match(c)&&this.target.match(c)),h=this.platform.actionsState.watchers.filter(c=>c.key===t&&(!c.ns||!this.ns||c.ns===this.ns)&&a.some(d=>c.target.match(d))).map(c=>c.fn);return Promise.all(a.map(c=>{const d=new Ft(this.platform,c,this.ns);return fs(h,e,d).then(l=>{const{data:p={},options:u,cancelled:g}=l;return Promise.resolve(g?{}:o.fn(p,u,d)).then(b=>{n[c.id]=b})})}))})).then(()=>n)}watch(t,e){let s=t,n=this.ns;const r=t.split(".");r.length>1&&(n=r[0],s=r.splice(1).join("."));const o={fn:e,target:this.target,key:s,ns:n};this.platform.actionsState.watchers.push(o);const a=()=>{const h=this.platform.actionsState.watchers.indexOf(o);h>-1&&this.platform.actionsState.watchers.splice(h,1)};return this.subscriptions.push(a),a}dispose(){this.subscriptions.forEach(t=>t())}};Jt(i=>{i.createCommand("components",t=>e=>{t.events.subscribeOnce("components:platform-created",(s,{platform:n})=>{e.handlers&&e.handlers.forEach(([r,o])=>{n.addComponentHandler(r,o)})})})});let Bt=class{constructor(t,e){this.events=t,this.tags=[],this.children={},this.changesets=[],this.mountCount=0,this.id=rt(),this.type=e,this.attributes={context:{},properties:{},layout:{},tags:[]},this.writeLayout({size:"full",indent:0})}mount(t,e){let s=t.get("mounted-nodes");return s||(s=new Map,t.register("mounted-nodes",s)),s.has(this)?(process.env.NODE_ENV!=="production"&&v.error("Trying to mount an already mounted component node.",this),()=>{}):(this.events.dispatch("components:node-mounted",{node:this}),this.mountCount===0&&(this.mountCount=this.mountCount+1,this.events.dispatch("components:node-enter",{node:this})),()=>{s.delete(this),this.events.dispatch("components:node-unmounted",{node:this}),this.mountCount=this.mountCount-1,this.mountCount===0&&this.events.dispatch("components:node-exit",{node:this})})}appendChild(t,e="default"){if(t.parent){if(t.parent===this)return;t.parent.removeChild(t)}t.parent=this,this.children[e]||(this.children[e]=[]),this.children[e].push(t),this.events.dispatch("components:node-appended",{node:t})}prependChild(t,e="default"){if(t.parent){if(t.parent===this)return;t.parent.removeChild(t)}t.parent=this,this.children[e]||(this.children[e]=[]),this.children[e].unshift(t),this.events.dispatch("components:node-appended",{node:t})}touchProperties(t,e={},s){const n=[{properties:t},e];return this.changesets.push(n),this.events.dispatch("components:set-properties",{node:this}),()=>{if(s){const r=this.changesets.indexOf(n);r>-1&&(this.changesets.splice(r,1),this.events.dispatch("components:set-properties",{node:this}))}}}writeProperties(t,e={},s){const n=[{properties:t},e];return this.changesets.push(n),this.events.dispatch("components:set-properties",{node:this}),()=>{if(s){const r=this.changesets.indexOf(n);r>-1&&(this.changesets.splice(r,1),this.events.dispatch("components:set-properties",{node:this}))}}}writeLayout(t,e={},s){const n=[{layout:t},e];return this.changesets.push(n),this.events.dispatch("components:set-layout",{node:this}),()=>{if(!s)return;const r=this.changesets.indexOf(n);r>-1&&(this.changesets.splice(r,1),this.events.dispatch("components:set-layout",{node:this}))}}writeContext(t,e={},s){const n=[{context:t},e];return this.changesets.push(n),this.events.dispatch("components:set-context",{node:this}),()=>{if(!s)return;const r=this.changesets.indexOf(n);r>-1&&(this.changesets.splice(r,1),this.events.dispatch("components:set-context",{node:this}))}}getChildren(t="default"){const e=this.children[t]||[];return e.reduce((s,n,r)=>{const{order:o=r}=n.attributes.layout;return s[o]?s.splice(o,0,n):s[o]=n,s},Array(e.length))}remove(){this.parent&&this.parent.removeChild(this)}removeChild(t){Object.keys(this.children).forEach(e=>{const s=this.children[e],n=s.indexOf(t);n>-1&&(s.splice(n,1),this.events.dispatch("components:node-removed",{node:t,parentNode:this}))}),delete t.parent}};const Se=(i,t,e)=>{for(let s=0,n=i.length;s<n&&e(i[s])!==!0;s++){const r=t[i[s].id]||"default",o=i[s].getChildren(r);Se(o,t,e)}},Et=(i,t,e)=>{if(e(i)!==!0){const s=t[i.id]||"default",n=i.children[s];Se(n,t,e)}},pt=(i,t)=>{const e=[];return Et(i,t,s=>{e.push(s)}),e},Pe=(i,t,e)=>{let s;return Et(i,t,n=>{if(e(n))return s=n,!0}),s};let ys=class{constructor(t,e,s){this.root=t,this.switches=e,this.all=[],this.visible=[],this.detached=[],s.subscribe("components:node-appended",(n,r)=>{this.all.push(r.node),this.visible=pt(t,e)}),s.subscribe("components:node-removed",(n,r)=>{let o=this.all.indexOf(r.node);o>-1&&this.all.splice(o,1),o=this.visible.indexOf(r.node),o>-1&&this.visible.splice(o,1),this.visible=pt(t,e)}),s.subscribe("components:node-switched",(n,r)=>{this.visible=pt(t,e)})}query(t={}){const e=[];return Et(this.root,this.switches,s=>{Object.keys(t).every(n=>t[n]===s[n])&&e.push(s)}),e}get(t){return Pe(this.root,this.switches,e=>e.id===t)||this.detached.find(e=>e.id===t)}};class vs{constructor(){this.handlers=new Map}add(t,e){this.handlers.set(t,e)}get(t){return this.handlers.get(t)}}const bs=i=>{let t=i,e=0;for(;t.parent;)e=e+1,t=t.parent;return e},ws=i=>i.map(([t,e])=>[bs(t),t,e]).sort(([t],[e])=>t-e).map(([,t,e])=>[t,e]),Lt=i=>i instanceof Date?!1:i&&typeof i=="object"&&!Array.isArray(i),A=(i,...t)=>{if(!t.length)return i;const e=t.shift();if(Lt(i)&&Lt(e))for(const s in e)Lt(e[s])?(i[s]||Object.assign(i,{[s]:{}}),A(i[s],e[s])):Object.assign(i,{[s]:e[s]});return A(i,...t)},$s=(i,t)=>!i||i==="all"?!0:i.some(e=>t.indexOf(e)>-1),_s=(i,t)=>{let e=[],s=[],n;const r=()=>{process.env.NODE_ENV!=="production"&&console.time("state-processor.flush");const a=new Map,h=ws(e.map((d,l)=>[d,s[l]])),c=(d,l)=>{var p;const u=a.get(d)||{},g=l.context&&!u.context,b=l.properties&&!u.properties,x=l.layout&&!u.layout;a.set(d,{context:u.context||g,properties:u.properties||b,layout:u.layout||x}),b&&(d.attributes.properties={}),x&&(d.attributes.layout={}),g&&(d.attributes.context=A({},(p=d.parent)==null?void 0:p.attributes.context));const ct=[],St=[],Pt=[];if(d.changesets.forEach($=>{const[_,kt]=$;$s(kt.breakpoints,i.breakpoints)&&(b&&(typeof _.properties=="function"?ct.push(_.properties):A(d.attributes.properties,_.properties)),x&&(typeof _.layout=="function"?St.push(_.layout):A(d.attributes.layout,_.layout)),g&&(typeof _.context=="function"?Pt.push(_.context):A(d.attributes.context,_.context)))}),ct.forEach($=>{A(d.attributes.properties,$(d.attributes.properties))}),St.forEach($=>{A(d.attributes.layout,$(d.attributes.layout))}),Pt.forEach($=>{A(d.attributes.context,$(d.attributes.context))}),g||l.recursive){const $=i.getBranch(d),_=l.recursive?l:{context:!!g};d.getChildren($).forEach(kt=>{c(kt,_)})}};process.env.NODE_ENV!=="production"&&console.timeEnd("state-processor.flush"),h.forEach(([d,l])=>{c(d,l)}),e=[],s=[],t(a)},o=()=>{clearTimeout(n),n=setTimeout(r,0)};return(a,h)=>{const c=e.indexOf(a);if(c>-1){const d=s[c];return h.context&&(d.context=!0),h.properties&&(d.properties=!0),h.layout&&(d.layout=!0),h.recursive&&(d.recursive=!0),o()}return e.push(a),s.push(h),o()}};class K{constructor(t,e={}){this.providers=e,this.breakpoints=[],this.actionsState={handlers:[],watchers:[]},this.switches={},this.changesets=[],this.subscriptions=[],this.customComponentHandler=new vs,this.events=t.events.createChild(this);const s=new Bt(this.events,"root");s.name=`root-${t.name}`,this.nodes=new ys(s,this.switches,this.events);const n=this.processNode=_s(this,r=>{const o=Array.from(r.keys());process.env.NODE_ENV!=="production"&&console.info(`STATE PROCESSOR: ${o.length} node(s) processed:
|
|
1
|
+
"use strict";const Nt=(i,t,e,...s)=>{const n=`[${i.get("$environment").name||"webprovisions"}] ${e}`;switch(t){case"info":console.info(n,...s);break;case"warning":console.warn(n,...s);break;case"error":console.error(n,...s);break}},es=i=>{const t=i.container||i;return{info:(e,...s)=>Nt(t,"info",e,...s),warn:(e,...s)=>Nt(t,"warning",e,...s),error:(e,...s)=>Nt(t,"error",e,...s)}};var et=(i=>(i.Implementation="implementation",i.Widget="widget",i))(et||{}),N=(i=>(i.Pre="pre",i.Post="post",i))(N||{});const ss=(i,t,e,s)=>{try{const n=new t(e,s);return{name:i,invoke:(r,o)=>{let a;return n[r]&&(a=n[r].call(n,o)),Promise.resolve(a)},getInstance:()=>n}}catch(n){if(n.message&&n.message.indexOf("is not a constructor")>=0)return{name:i,invoke:r=>{let o;return r==="initialize"&&(o=t(e,s)),Promise.resolve(o)},getInstance:()=>t};throw n}};function re(i,t){return typeof i>"u"?t:i}let is=class{constructor(t={}){this.part=t}createCommand(t,e,s){let n;typeof e=="function"?n={scope:et.Widget,stage:N.Post,defaultArgs:void 0,handlerResolver:e}:n={scope:re(e.scope,et.Widget),stage:re(e.stage,N.Post),defaultArgs:e.defaultArgs,handlerResolver:s};let r=this.part;const o=t.split(".");return o.forEach((a,h)=>{h===o.length-1?r[a]||(r[a]=()=>n):r=this.part[a]=this.part[a]||{}}),this}get(){return this.part}};const Ae=i=>{const t=new is({});return i(t),t.get()};Ae(i=>{i.createCommand("types.register",{scope:et.Implementation,stage:N.Pre},t=>(e,s)=>{t.container.get("$types")[e]=s}).createCommand("type",{stage:N.Pre},t=>e=>{t.container.register("$type",e)}).createCommand("settings",{stage:N.Pre,defaultArgs:[null]},t=>e=>{t.events.dispatch("settings:change",e,{bubbles:!0}),t.container.register("$settings",e)}).createCommand("plugin",{stage:N.Pre},t=>(e,s,n)=>{const{container:r}=t;let o=null,a=e,h=s;typeof e=="string"&&(o=e,a=s,h=n);const c=l=>{const{transformPluginSettings:d}=t.container.get("$environmentOptions"),u=d?d(h||{},o,t.container,a):s;try{const p=ss(o,a,r,u);r.get("$plugins").push(p),l&&p.invoke("initialize",null)}catch(p){es(t).warn("Error when initializing plugin",p)}};t.container.get("$instance")?c(!0):t.events.subscribeOnce("widget:instance-created",()=>c(!1))}).createCommand("container.register",t=>(e,s)=>{t.container.register(e,s)}).createCommand("container.registerAsync",t=>(e,s)=>{t.container.registerAsync(e,s)}).createCommand("container.registerFactory",t=>(e,s)=>{t.container.registerFactory(e,s)}).createCommand("container.touch",t=>(e,s)=>{t.container.touch(e,s)}).createCommand("csp",{},t=>e=>{t.container.register("csp",e)})});function ns(i){const t={};return[].filter.call(i.attributes,e=>/^data-/.test(e.name)).map(e=>e.name).forEach(e=>t[e.substr(5)]=i.getAttribute(e)),t}const rs=(i,t,e)=>{const s=ns(i);e({sourceDOMElement:i,eventType:t,data:s})};function oe(i,t,e){i.forEach(s=>{s.dataset.attached!=="true"&&(rs(s,t,e),s.dataset.monitored="true")})}function os(i,t,e){const s=i.container.get("bootstrapping.monitor");s&&s.events.subscribe("bootstrap:trigger-elements-updated",(r,o)=>{oe(o.triggerElements,t,e)});const n=i.container.get("triggerElements");n&&oe(n,t,e)}Ae(i=>{i.createCommand("ready",{scope:et.Implementation,stage:N.Pre},t=>e=>{const{container:s}=t,n=s.owner;s.get("bootstrapping").ready?e(n):n.events.subscribeOnce("bootstrap:ready",()=>{e(n)})})});const Mt=(i,t,e,...s)=>{const n=`[${i.get("$environment").name||"webprovisions"}] ${e}`;switch(t){case"info":console.info(n,...s);break;case"warning":console.warn(n,...s);break;case"error":console.error(n,...s);break}},as=i=>{const t=i.container||i;return{info:(e,...s)=>Mt(t,"info",e,...s),warn:(e,...s)=>Mt(t,"warning",e,...s),error:(e,...s)=>Mt(t,"error",e,...s)}};var ft=(i=>(i.Implementation="implementation",i.Widget="widget",i))(ft||{}),T=(i=>(i.Pre="pre",i.Post="post",i))(T||{});const cs=(i,t,e,s)=>{try{const n=new t(e,s);return{name:i,invoke:(r,o)=>{let a;return n[r]&&(a=n[r].call(n,o)),Promise.resolve(a)},getInstance:()=>n}}catch(n){if(n.message&&n.message.indexOf("is not a constructor")>=0)return{name:i,invoke:r=>{let o;return r==="initialize"&&(o=t(e,s)),Promise.resolve(o)},getInstance:()=>t};throw n}};function ae(i,t){return typeof i>"u"?t:i}class hs{constructor(t={}){this.part=t}createCommand(t,e,s){let n;typeof e=="function"?n={scope:ft.Widget,stage:T.Post,defaultArgs:void 0,handlerResolver:e}:n={scope:ae(e.scope,ft.Widget),stage:ae(e.stage,T.Post),defaultArgs:e.defaultArgs,handlerResolver:s};let r=this.part;const o=t.split(".");return o.forEach((a,h)=>{h===o.length-1?r[a]||(r[a]=()=>n):r=this.part[a]=this.part[a]||{}}),this}get(){return this.part}}const Jt=i=>{const t=new hs({});return i(t),t.get()};Jt(i=>{i.createCommand("types.register",{scope:ft.Implementation,stage:T.Pre},t=>(e,s)=>{t.container.get("$types")[e]=s}).createCommand("type",{stage:T.Pre},t=>e=>{t.container.register("$type",e)}).createCommand("settings",{stage:T.Pre,defaultArgs:[null]},t=>e=>{t.events.dispatch("settings:change",e,{bubbles:!0}),t.container.register("$settings",e)}).createCommand("plugin",{stage:T.Pre},t=>(e,s,n)=>{const{container:r}=t;let o=null,a=e,h=s;typeof e=="string"&&(o=e,a=s,h=n);const c=l=>{const{transformPluginSettings:d}=t.container.get("$environmentOptions"),u=d?d(h||{},o,t.container,a):s;try{const p=cs(o,a,r,u);r.get("$plugins").push(p),l&&p.invoke("initialize",null)}catch(p){as(t).warn("Error when initializing plugin",p)}};t.container.get("$instance")?c(!0):t.events.subscribeOnce("widget:instance-created",()=>c(!1))}).createCommand("container.register",t=>(e,s)=>{t.container.register(e,s)}).createCommand("container.registerAsync",t=>(e,s)=>{t.container.registerAsync(e,s)}).createCommand("container.registerFactory",t=>(e,s)=>{t.container.registerFactory(e,s)}).createCommand("container.touch",t=>(e,s)=>{t.container.touch(e,s)}).createCommand("csp",{},t=>e=>{t.container.register("csp",e)})});var Ee=(i=>(i.Activating="activating",i.Loading="loading",i.Activated="activated",i.Deactivating="deactivating",i.Deactivated="deactivated",i))(Ee||{});class ls{constructor(t){this.container=t,this.widget=t.get("$widget"),this.settings=t.get("$settings"),this.events=this.widget.events,this.widget.events.subscribe("settings:change",(e,s)=>{this.settings=s})}}const _t=(i,t,...e)=>typeof t=="string"?i(`[humany] ${t}`,...e):i(t,...e),Z=class{constructor(){this.keys=[],this.log=(t,...e)=>this.lookup(t,()=>Z.log(...e)),this.warn=(t,...e)=>this.lookup(t,()=>Z.warn(...e)),this.error=(t,...e)=>this.lookup(t,()=>Z.error(...e)),this.info=(t,...e)=>this.lookup(t,()=>Z.info(...e))}lookup(t,e){this.keys.indexOf(t)===-1&&(this.keys.push(t),e())}};let v=Z;v.log=(...i)=>_t(console.log,...i);v.warn=(...i)=>_t(console.warn,...i);v.error=(...i)=>_t(console.error,...i);v.info=(...i)=>_t(console.info,...i);const Ce=i=>{let t={},e,s;if(typeof i!="object"||i===null)return i;t=Array.isArray(i)?[]:{};for(s in i)e=i[s],t[s]=typeof e=="object"&&e!==null?Ce(e):e;return t};function ce(i){let t=0;if(i.length===0)return t.toString();for(let e=0;e<i.length;e++){const s=i.charCodeAt(e);t=(t<<5)-t+s,t=t&t}return t.toString()}let ds=class{constructor(t,e){this.lockWarningTime=t,this.lockErrorTime=e,this.tasks=[],this.current=Promise.resolve(),this.next=this.next.bind(this)}add(t,e,s,n){this.tasks.push({task:t,resolve:e,reject:s,done:n}),this.next()}next(){this.current=this.current.then(()=>{const t=this.tasks.shift();if(t){let e;const s=setTimeout(()=>{process.env.NODE_ENV!=="production"&&v.warn(`A lock has exceeded ${this.lockWarningTime} ms. Waiting additional ${this.lockErrorTime} ms before rejecting the task.`,t),e=setTimeout(()=>{t.reject("lock timeout exceeded")},this.lockErrorTime)},this.lockWarningTime),n=Promise.resolve(t.task()).then(r=>(clearTimeout(s),clearTimeout(e),r));return Promise.resolve(n).then(this.next).then(()=>n.then(r=>{t.done(),t.resolve(r)})).catch(r=>(t.done(),t.reject(r),this.next()))}return Promise.resolve()})}};const ht=new WeakMap;function A(i,t=5e3,e=1e3){return ht.has(i)||ht.set(i,new ds(t,e)),s=>new Promise((n,r)=>{const o=ht.get(i);o.add(s,n,r,()=>{o.tasks.length||ht.delete(i)})})}const us=(i,t)=>{const e=()=>t.querySelectorAll("[data-loading=true]").length>0,s=(()=>{let n=!1;return()=>{n||(i.get("$widget").events.dispatch("widget:data-loaded",{element:t}),n=!0)}})();if(!e())return s();new MutationObserver((n,r)=>{n.find(o=>o.type==="attributes"&&o.attributeName==="data-loading")&&!e()&&(r.disconnect(),s())}).observe(t,{attributes:!0,childList:!0,subtree:!0})},ps=(i,t)=>{i.get("$widget").container.getAsync("components").then(e=>{e.events.subscribeOnce("components:component-model-initialized",()=>{let s=e.nodes.visible.reduce((r,o)=>(!o.name||!o.type||o.type==="view"||o.type==="root"||o.attributes.layout.size==="none"||t.querySelector(`[data-name="${o.name}"]`)||r.push(o.name),r),[]),n=!1;new MutationObserver((r,o)=>{r.forEach(a=>{if(a.addedNodes){const h=Array.from(a.addedNodes).reduce((c,l)=>{const d=l.getAttribute&&l.getAttribute("data-name");return d&&s.indexOf(d)>-1&&c.push(d),c},[]);s=s.filter(c=>h.indexOf(c)===-1),!n&&s.length===0&&(n=!0,us(i,t),o.disconnect())}})}).observe(t,{attributes:!1,characterData:!1,childList:!0,subtree:!0,attributeOldValue:!1,characterDataOldValue:!1})})})},S=()=>Math.floor((1+Math.random())*65536).toString(16).substring(1);function rt(){return S()+S()+"-"+S()+"-"+S()+"-"+S()+"-"+S()+S()+S()}class gs{constructor(t){const{events:e}=t.get("$widget");this.events=e.createChild(this)}action(t,e,s){this.events.dispatch("data:action",{action:e,value:s,target:t},{bubbles:!0})}subscribe(t,e){return this.events.subscribe("data:action",(s,{action:n,value:r,target:o})=>t===o&&e(t,n,r))}}const Oe=i=>{const t=[];return[(e,s)=>{t.push(i.subscribe(e,s))},()=>{t.forEach(e=>{e()})}]};let F=class{constructor(t,e=[]){this.platform=t,this.rules=e}match(t){return this.rules.every(e=>!(e.id&&e.id!==t.id||e.type&&e.type!==t.type))}ofType(t){return this.rules.push({type:t}),this}withId(t){return this.rules.push({id:t}),this}select(){return new ms(this.platform,this)}},Ft=class{constructor(t,e,s){this.platform=t,this.node=e,this.actions=new xt(t,new F(t).withId(e.id),s);const[n,r]=Oe(this.platform.events);this.subscribe=n,this.unsubscribe=r}properties(t){return t&&this.node.touchProperties(e=>t(e)),this.node.attributes.properties}context(t){return t&&this.subscribe("components:context-changed",(e,{node:s})=>{s===this.node&&t(this.node.attributes.context)}),this.node.attributes.context}layout(t){return t&&this.subscribe("components:layout-changed",(e,{node:s})=>{s===this.node&&t(this.node.attributes.layout)}),this.node.attributes.layout}writeProperties(t,e){this.node.writeProperties(t,e)}writeContext(t,e){this.node.writeProperties(t,e)}writeLayout(t,e){this.node.writeLayout(t,e)}dispose(){this.unsubscribe(),this.actions.dispose()}};class ms{constructor(t,e,s=!0){this.platform=t,this.target=e,this.clearOnDispose=s,this.removes=[],this.actions=new xt(this.platform,this.target)}writeProperties(t,e){this.removes.push(this.platform.write({options:e,attributes:{properties:t},target:this.target,removable:this.clearOnDispose}))}writeContext(t,e){this.removes.push(this.platform.write({options:e,attributes:{context:t},target:this.target,removable:this.clearOnDispose}))}writeLayout(t,e){this.removes.push(this.platform.write({options:e,attributes:{layout:t},target:this.target,removable:this.clearOnDispose}))}dispose(){this.removes.forEach(t=>{t()}),this.actions.dispose()}}const fs=(i,t,e)=>{const s=i.concat(),n=(r,o,a)=>{let h=!0;if(s.length){const c=s.shift(),l=(d,u)=>(h=!1,n(d,Object.assign({},o,u),a));return Promise.resolve(c(r,l,a)).then(d=>({...d,cancelled:h}))}return Promise.resolve({data:r,cancelled:!1,options:o})};return n(t,{},e)};let xt=class{constructor(t,e,s){this.platform=t,this.target=e,this.ns=s,this.subscriptions=[],this.create=this.create.bind(this)}create(t,e=()=>{}){const s={key:t,fn:e,target:this.target,ns:this.ns};this.platform.actionsState.handlers.push(s);const n=()=>{const r=this.platform.actionsState.handlers.indexOf(s);r>-1&&this.platform.actionsState.handlers.splice(r,1)};return this.subscriptions.push(n),n}dispatch(t,e){const s=this.platform.nodes.all.concat(this.platform.nodes.detached),n={},r=this.platform.actionsState.handlers.filter(o=>o.key===t&&(!o.ns||!this.ns||o.ns===this.ns));return Promise.all(r.map(o=>{const a=s.filter(c=>o.target.match(c)&&this.target.match(c)),h=this.platform.actionsState.watchers.filter(c=>c.key===t&&(!c.ns||!this.ns||c.ns===this.ns)&&a.some(l=>c.target.match(l))).map(c=>c.fn);return Promise.all(a.map(c=>{const l=new Ft(this.platform,c,this.ns);return fs(h,e,l).then(d=>{const{data:u={},options:p,cancelled:g}=d;return Promise.resolve(g?{}:o.fn(u,p,l)).then(b=>{n[c.id]=b})})}))})).then(()=>n)}watch(t,e){let s=t,n=this.ns;const r=t.split(".");r.length>1&&(n=r[0],s=r.splice(1).join("."));const o={fn:e,target:this.target,key:s,ns:n};this.platform.actionsState.watchers.push(o);const a=()=>{const h=this.platform.actionsState.watchers.indexOf(o);h>-1&&this.platform.actionsState.watchers.splice(h,1)};return this.subscriptions.push(a),a}dispose(){this.subscriptions.forEach(t=>t())}};Jt(i=>{i.createCommand("components",t=>e=>{t.events.subscribeOnce("components:platform-created",(s,{platform:n})=>{e.handlers&&e.handlers.forEach(([r,o])=>{n.addComponentHandler(r,o)})})})});let Bt=class{constructor(t,e){this.events=t,this.tags=[],this.children={},this.changesets=[],this.mountCount=0,this.id=rt(),this.type=e,this.attributes={context:{},properties:{},layout:{},tags:[]},this.writeLayout({size:"full",indent:0})}mount(t,e){let s=t.get("mounted-nodes");return s||(s=new Map,t.register("mounted-nodes",s)),s.has(this)?(process.env.NODE_ENV!=="production"&&v.error("Trying to mount an already mounted component node.",this),()=>{}):(this.events.dispatch("components:node-mounted",{node:this}),this.mountCount===0&&(this.mountCount=this.mountCount+1,this.events.dispatch("components:node-enter",{node:this})),()=>{s.delete(this),this.events.dispatch("components:node-unmounted",{node:this}),this.mountCount=this.mountCount-1,this.mountCount===0&&this.events.dispatch("components:node-exit",{node:this})})}appendChild(t,e="default"){if(t.parent){if(t.parent===this)return;t.parent.removeChild(t)}t.parent=this,this.children[e]||(this.children[e]=[]),this.children[e].push(t),this.events.dispatch("components:node-appended",{node:t})}prependChild(t,e="default"){if(t.parent){if(t.parent===this)return;t.parent.removeChild(t)}t.parent=this,this.children[e]||(this.children[e]=[]),this.children[e].unshift(t),this.events.dispatch("components:node-appended",{node:t})}touchProperties(t,e={},s){const n=[{properties:t},e];return this.changesets.push(n),this.events.dispatch("components:set-properties",{node:this}),()=>{if(s){const r=this.changesets.indexOf(n);r>-1&&(this.changesets.splice(r,1),this.events.dispatch("components:set-properties",{node:this}))}}}writeProperties(t,e={},s){const n=[{properties:t},e];return this.changesets.push(n),this.events.dispatch("components:set-properties",{node:this}),()=>{if(s){const r=this.changesets.indexOf(n);r>-1&&(this.changesets.splice(r,1),this.events.dispatch("components:set-properties",{node:this}))}}}writeLayout(t,e={},s){const n=[{layout:t},e];return this.changesets.push(n),this.events.dispatch("components:set-layout",{node:this}),()=>{if(!s)return;const r=this.changesets.indexOf(n);r>-1&&(this.changesets.splice(r,1),this.events.dispatch("components:set-layout",{node:this}))}}writeContext(t,e={},s){const n=[{context:t},e];return this.changesets.push(n),this.events.dispatch("components:set-context",{node:this}),()=>{if(!s)return;const r=this.changesets.indexOf(n);r>-1&&(this.changesets.splice(r,1),this.events.dispatch("components:set-context",{node:this}))}}getChildren(t="default"){const e=this.children[t]||[];return e.reduce((s,n,r)=>{const{order:o=r}=n.attributes.layout;return s[o]?s.splice(o,0,n):s[o]=n,s},Array(e.length))}remove(){this.parent&&this.parent.removeChild(this)}removeChild(t){Object.keys(this.children).forEach(e=>{const s=this.children[e],n=s.indexOf(t);n>-1&&(s.splice(n,1),this.events.dispatch("components:node-removed",{node:t,parentNode:this}))}),delete t.parent}};const Se=(i,t,e)=>{for(let s=0,n=i.length;s<n&&e(i[s])!==!0;s++){const r=t[i[s].id]||"default",o=i[s].getChildren(r);Se(o,t,e)}},At=(i,t,e)=>{if(e(i)!==!0){const s=t[i.id]||"default",n=i.children[s];Se(n,t,e)}},ut=(i,t)=>{const e=[];return At(i,t,s=>{e.push(s)}),e},Pe=(i,t,e)=>{let s;return At(i,t,n=>{if(e(n))return s=n,!0}),s};let ys=class{constructor(t,e,s){this.root=t,this.switches=e,this.all=[],this.visible=[],this.detached=[],s.subscribe("components:node-appended",(n,r)=>{this.all.push(r.node),this.visible=ut(t,e)}),s.subscribe("components:node-removed",(n,r)=>{let o=this.all.indexOf(r.node);o>-1&&this.all.splice(o,1),o=this.visible.indexOf(r.node),o>-1&&this.visible.splice(o,1),this.visible=ut(t,e)}),s.subscribe("components:node-switched",(n,r)=>{this.visible=ut(t,e)})}query(t={}){const e=[];return At(this.root,this.switches,s=>{Object.keys(t).every(n=>t[n]===s[n])&&e.push(s)}),e}get(t){return Pe(this.root,this.switches,e=>e.id===t)||this.detached.find(e=>e.id===t)}};class vs{constructor(){this.handlers=new Map}add(t,e){this.handlers.set(t,e)}get(t){return this.handlers.get(t)}}const bs=i=>{let t=i,e=0;for(;t.parent;)e=e+1,t=t.parent;return e},ws=i=>i.map(([t,e])=>[bs(t),t,e]).sort(([t],[e])=>t-e).map(([,t,e])=>[t,e]),Dt=i=>i instanceof Date?!1:i&&typeof i=="object"&&!Array.isArray(i),E=(i,...t)=>{if(!t.length)return i;const e=t.shift();if(Dt(i)&&Dt(e))for(const s in e)Dt(e[s])?(i[s]||Object.assign(i,{[s]:{}}),E(i[s],e[s])):Object.assign(i,{[s]:e[s]});return E(i,...t)},$s=(i,t)=>!i||i==="all"?!0:i.some(e=>t.indexOf(e)>-1),_s=(i,t)=>{let e=[],s=[],n;const r=()=>{process.env.NODE_ENV!=="production"&&console.time("state-processor.flush");const a=new Map,h=ws(e.map((l,d)=>[l,s[d]])),c=(l,d)=>{var u;const p=a.get(l)||{},g=d.context&&!p.context,b=d.properties&&!p.properties,x=d.layout&&!p.layout;a.set(l,{context:p.context||g,properties:p.properties||b,layout:p.layout||x}),b&&(l.attributes.properties={}),x&&(l.attributes.layout={}),g&&(l.attributes.context=E({},(u=l.parent)==null?void 0:u.attributes.context));const ct=[],St=[],Pt=[];if(l.changesets.forEach($=>{const[_,kt]=$;$s(kt.breakpoints,i.breakpoints)&&(b&&(typeof _.properties=="function"?ct.push(_.properties):E(l.attributes.properties,_.properties)),x&&(typeof _.layout=="function"?St.push(_.layout):E(l.attributes.layout,_.layout)),g&&(typeof _.context=="function"?Pt.push(_.context):E(l.attributes.context,_.context)))}),ct.forEach($=>{E(l.attributes.properties,$(l.attributes.properties))}),St.forEach($=>{E(l.attributes.layout,$(l.attributes.layout))}),Pt.forEach($=>{E(l.attributes.context,$(l.attributes.context))}),g||d.recursive){const $=i.getBranch(l),_=d.recursive?d:{context:!!g};l.getChildren($).forEach(kt=>{c(kt,_)})}};process.env.NODE_ENV!=="production"&&console.timeEnd("state-processor.flush"),h.forEach(([l,d])=>{c(l,d)}),e=[],s=[],t(a)},o=()=>{clearTimeout(n),n=setTimeout(r,0)};return(a,h)=>{const c=e.indexOf(a);if(c>-1){const l=s[c];return h.context&&(l.context=!0),h.properties&&(l.properties=!0),h.layout&&(l.layout=!0),h.recursive&&(l.recursive=!0),o()}return e.push(a),s.push(h),o()}};class K{constructor(t,e={}){this.providers=e,this.breakpoints=[],this.actionsState={handlers:[],watchers:[]},this.switches={},this.changesets=[],this.subscriptions=[],this.customComponentHandler=new vs,this.events=t.events.createChild(this);const s=new Bt(this.events,"root");s.name=`root-${t.name}`,this.nodes=new ys(s,this.switches,this.events);const n=this.processNode=_s(this,r=>{const o=Array.from(r.keys());process.env.NODE_ENV!=="production"&&console.info(`STATE PROCESSOR: ${o.length} node(s) processed:
|
|
2
2
|
${o.map(a=>`${a.name||"<no name>"} (${a.id})
|
|
3
|
-
`)}`),o.forEach(a=>{const h=r.get(a);a.parent&&a.parent.type==="root"&&this.events.dispatch("components:root-children-changed",{node:a}),h!=null&&h.context&&this.events.dispatch("components:context-changed",{node:a}),h!=null&&h.properties&&this.events.dispatch("components:properties-changed",{node:a}),h!=null&&h.layout&&this.events.dispatch("components:layout-changed",{node:a})}),this.events.dispatch("components:component-model-initialized",{},{bubbles:!0})});Promise.all(Object.keys(e).map(r=>e[r].load(this))),this.subscriptions.push(this.events.subscribe("components:node-appended",(r,o)=>{const{node:a}=o;this.changesets.forEach(h=>{const{changeset:c,target:
|
|
3
|
+
`)}`),o.forEach(a=>{const h=r.get(a);a.parent&&a.parent.type==="root"&&this.events.dispatch("components:root-children-changed",{node:a}),h!=null&&h.context&&this.events.dispatch("components:context-changed",{node:a}),h!=null&&h.properties&&this.events.dispatch("components:properties-changed",{node:a}),h!=null&&h.layout&&this.events.dispatch("components:layout-changed",{node:a})}),this.events.dispatch("components:component-model-initialized",{},{bubbles:!0})});Promise.all(Object.keys(e).map(r=>e[r].load(this))),this.subscriptions.push(this.events.subscribe("components:node-appended",(r,o)=>{const{node:a}=o;this.changesets.forEach(h=>{const{changeset:c,target:l,removes:d}=h,[u,p]=c;l.match(o.node)&&(u.properties&&d.push(a.writeProperties(u.properties,p)),u.context&&d.push(a.writeContext(u.context,p)),u.layout&&d.push(a.writeLayout(u.layout,p)))})})),this.subscriptions.push(this.events.subscribe("components:node-appended",(r,o)=>{n(o.node,{properties:!0,context:!0})})),this.subscriptions.push(this.events.subscribe("components:set-properties",(r,o)=>{n(o.node,{properties:!0})})),this.subscriptions.push(this.events.subscribe("components:set-context",(r,o)=>{n(o.node,{properties:!0,context:!0})})),this.subscriptions.push(this.events.subscribe("components:set-indent",(r,o)=>{n(o.node,{layout:!0})})),this.subscriptions.push(this.events.subscribe("components:set-layout",(r,o)=>{n(o.node,{layout:!0})})),this.subscriptions.push(this.events.subscribe("components:node-switched",(r,{node:o,branch:a})=>{n(o,{layout:!0,recursive:!0,properties:!0,context:!0})})),this.subscriptions.push(this.events.subscribe("components:node-removed",(r,{parentNode:o})=>{n(o,{properties:!0})})),this.events.parent&&this.events.parent.dispatch("components:platform-created",{platform:this})}static getInstance(t){return t.getAsync("components")}addBreakpoint(t){this.breakpoints.indexOf(t)===-1&&(this.breakpoints.push(t),this.processNode(this.nodes.root,{context:!0,properties:!0,layout:!0,recursive:!0}))}removeBreakpoint(t){const e=this.breakpoints.indexOf(t);e>-1&&(this.breakpoints.splice(e,1),this.processNode(this.nodes.root,{context:!0,properties:!0,layout:!0,recursive:!0}))}setSwitch(t,e){this.switches[t.id]=e,this.events.dispatch("components:node-switched",{node:t,branch:e})}getBranch(t){return this.switches[t.id]}createNode(t,e={}){const s=new Bt(this.events,t);return e.detached&&this.nodes.detached.push(s),s}components(){return new F(this)}actions(t,e){return new xt(this,t,e)}write(t){const{provider:e,target:s,attributes:n,options:r={},removable:o}=t,a=t.key||rt(),h={changeset:[n,r],target:s,removes:[]};if(e){const c=this.providers[e];c.write(a,s,n,r),h.removes.push(()=>{c.remove(a)})}return this.changesets.push(h),this.nodes.all.forEach(c=>{if(s.match(c)){let l=()=>{};n.properties&&(l=c.writeProperties(n.properties,r,o)),n.context&&(l=c.writeContext(n.context,r,o)),n.layout&&(l=c.writeContext(n.layout,r,o)),h.removes.push(l)}}),()=>{if(o){h.removes.forEach(l=>l());const c=this.changesets.indexOf(h);c>-1&&this.changesets.splice(c,1)}}}addComponentHandler(t,e){this.customComponentHandler.add(t,e)}getComponentHandler(t){return this.customComponentHandler.get(t)}dispose(){this.subscriptions.forEach(t=>t())}}const xs=i=>{if(Array.isArray(i)){const[t,...e]=i;return{definitionId:t,overrides:e}}return{definitionId:i,overrides:[]}},yt=(i,t,e,s,n,r)=>{e.forEach(o=>{const a=xs(o),h=s[a.definitionId];if(a.definitionId==="view"){const c=i.createNode("view");c.name="view",Object.keys(n).forEach(l=>{const d=n[l];yt(i,c,[d.entry],s,n,l)}),t.appendChild(c),a.overrides.forEach(l=>{l.properties&&c.writeProperties(l.properties,{breakpoints:l.breakpoints}),l.context&&c.writeContext(l.context,{breakpoints:l.breakpoints}),l.layout&&c.writeLayout(l.layout,{breakpoints:l.breakpoints})})}else if(i.getComponentHandler(h.type)){const c=i.getComponentHandler(h.type);c&&c(a,{platform:i,node:t,references:e,definitions:s,views:n,branch:r})}else{const c=s[a.definitionId];if(process.env.NODE_ENV!=="production"&&!c){v.error(`No definition found for component type '${a.definitionId}'.`);return}const l=i.createNode(c.type);l.name=a.definitionId,l.tags=c.tags||[],c.properties&&l.writeProperties(c.properties),c.context&&l.writeContext(c.context),c.layout&&l.writeLayout(c.layout),t.appendChild(l,r),a.overrides.forEach(d=>{const u={breakpoints:d.breakpoints};d.properties&&l.writeProperties(d.properties,u),d.context&&l.writeContext(d.context,u),d.layout&&l.writeLayout(d.layout,u)}),c.children&&yt(i,l,c.children,s,n)}})},ke=(i,t)=>{const{entry:e,components:s,breakpoints:n,views:r}=t,o=[];return Object.keys(n).forEach(a=>{const h=n[a],c=window.matchMedia(h);c.matches&&i.breakpoints.push(a);const l=d=>{d.matches?i.addBreakpoint(a):i.removeBreakpoint(a)};c.addListener(l),o.push(()=>c.removeListener(l))}),yt(i,i.nodes.root,[e],s,r),()=>o.forEach(a=>{a()})},Wt=(i,t)=>({id:i.id,type:i.type,name:i.name,branch:t||"default"}),Ne=(i,t,e,s=rt(),n={})=>i.getAsync("components").then(r=>{let o;if(typeof t=="string"){const c=new F(r);c.ofType(t),o=c}else o=t;const a={},h=c=>{const l=a[c.id];return l?Promise.resolve(l.controller):K.getInstance(i).then(d=>new Ft(d,c,s))};r.events.subscribe("components:node-enter",(c,{node:l})=>{o.match(l)&&h(l).then(d=>{Promise.resolve(e(d)).then(u=>{a[l.id]={dispose:u,controller:d}})})}),r.events.subscribe("components:node-exit",(c,{node:l})=>{const d=a[l.id];d&&(d.dispose&&d.dispose(),n.reuseController||(d.controller.dispose(),delete a[l.id]))})});class As{constructor(t){this.aliases=new Map,this.components=new Map,this.logger=new v;const{events:e}=t.get("$widget");this.events=e}getComponent(t){const e=this.aliases.get(t),s=this.components.get(e||t)||null;return process.env.NODE_ENV!=="production"&&(s||this.logger.warn(e||t,`Unable to resolve component: "${e||t}". You most likely forgot to register the required plugin for: ${e||t}.`)),s}registerComponent(t,e){return this.components.set(t,e),this.events.dispatch("component-resolver:resolve",t),()=>{this.components.delete(t)}}registerResolver(t,e){return this.events.subscribe("component-resolver:resolve",(s,n)=>{if(n===t){const r=this.getComponent(t);e(r)}})}registerAlias(t,e){return this.aliases.set(t,e),this.events.dispatch("component-resolver:resolve",t),()=>{this.aliases.delete(t)}}}var w=(i=>(i.open="open",i.closed="closed",i.hidden="hidden",i))(w||{});const Kt=Object.freeze(Object.defineProperty({__proto__:null,ActionResolver:gs,ActionsController:xt,ComponentNode:Bt,ComponentNodeController:Ft,ComponentPlatform:K,ComponentQuery:F,ComponentResolver:As,WidgetRenderState:w,asDescriptor:Wt,createChildren:yt,createComponentModel:ke,createEventSubscriber:Oe,extendComponent:Ne,findComponent:Pe,findVisibleComponents:ut,traverseComponents:At},Symbol.toStringTag,{value:"Module"}));var f=(i=>(i.Cookie="cookie",i.Local="local",i.Session="session",i))(f||{}),G=(i=>(i.Tenant="tenant",i.Implementation="implementation",i.Widget="widget",i))(G||{}),m=(i=>(i.Necessary="necessary",i.Functional="functional",i.Analytical="analytical",i.Marketing="marketing",i))(m||{});const P=(i,t,e,s={})=>he(i,e).then(n=>(process.env.NODE_ENV!=="production"&&n&&v.warn(`createStorageWriter: Attempted to create storage writer using unallowed category.
|
|
4
4
|
Key: ${t}
|
|
5
5
|
Category: ${JSON.stringify(e)}
|
|
6
6
|
Options: ${JSON.stringify(s)}`),r=>(Zt(i),he(i,e).then(o=>{if(o){process.env.NODE_ENV!=="production"&&v.warn(`storageWriter: Attempted to write to storage using unallowed category.
|
|
7
7
|
Key: ${t}
|
|
8
8
|
Category: ${JSON.stringify(e)}
|
|
9
9
|
Value: ${JSON.stringify(r)}
|
|
10
|
-
Options: ${JSON.stringify(s)}`);return}const{scope:a=G.Widget,medium:h=f.Session,duration:c}=s,
|
|
10
|
+
Options: ${JSON.stringify(s)}`);return}const{scope:a=G.Widget,medium:h=f.Session,duration:c}=s,l=Cs();return l[a][t]=Yt(r,e,c),h===f.Cookie?ks(i,l):Ms(i,h,l)})))),O=(i,t,e=f.Session)=>(Zt(i),typeof t>"u"?(process.env.NODE_ENV!=="production"&&v.warn("readStorage: Undefined key passed when reading storage. ",t,e),Promise.resolve(void 0)):e===f.Cookie?Ps(i).then(s=>bt(s,t)):Ns(i,e).then(s=>bt(s,t))),B=i=>!!Object.entries(i).filter(([t,e])=>typeof e<"u").length,Lt=i=>Object.entries(i).filter(([t,e])=>typeof e<"u").forEach(([t,{value:e}])=>{typeof e>"u"&&delete i[t]}),Me=(i,t)=>{const e={tenant:{...i.tenant,...t.tenant},implementation:{...i.implementation,...t.implementation},widget:{...i.widget,...t.widget}};return Lt(e.tenant),Lt(e.implementation),Lt(e.widget),e},Es=i=>Object.entries(i).reduce((t,e)=>{const[s,n]=e;return Object.entries(n).forEach(r=>{const[o,{expiration:a}]=r;a&&t.push(a)}),t},[]).slice().sort((t,e)=>new Date(e).valueOf()-new Date(t).valueOf()).shift()||Ct(),Et=i=>{const{name:t,implementation:{name:e,tenant:s}}=i.get("$widget");return[`humany_${s}`,`humany_${ce(s+e)}`,`humany_${ce(s+e+t)}`]},It=i=>{const t=new RegExp(`(?:^|;)\\s?${i}=(.*?)(?:;|$)`,"i"),e=document.cookie.match(t);return e&&e[1]&&JSON.parse(e[1])||void 0},Rt=(i,t,e)=>{const s=`${i}=${JSON.stringify(t).trim()}`,n=`expires=${new Date(e).toUTCString()}`,r="path=/",o="SameSite=None;Secure";return document.cookie=`${s}; ${n}; ${r}; ${o}`},Gt=i=>{const[t,e,s]=Et(i),n=It(t)||{},r=It(e)||{},o=It(s)||{};return{tenant:n,implementation:r,widget:o}},De=(i,t)=>{const e=Gt(i),s=Me(e,t),[n,r,o]=Et(i),{tenant:a,implementation:h,widget:c}=s,l=Es(t),d=Ct({days:-1});Rt(n,a,B(a)?l:d),Rt(r,h,B(h)?l:d),Rt(o,c,B(c)?l:d)},vt=(i,t)=>{const[e,s,n]=Et(i),r=t.getItem(e)||"{}",o=t.getItem(s)||"{}",a=t.getItem(n)||"{}";return{tenant:JSON.parse(r),implementation:JSON.parse(o),widget:JSON.parse(a)}},qt=(i,t,e)=>{const s=vt(i,t),n=Me(s,e),[r,o,a]=Et(i),{tenant:h,implementation:c,widget:l}=n;B(h)?t.setItem(r,JSON.stringify(h)):t.removeItem(r),B(c)?t.setItem(o,JSON.stringify(c)):t.removeItem(o),B(l)?t.setItem(a,JSON.stringify(l)):t.removeItem(a);const{events:d}=i.get("$widget");d.dispatch("storage:changed",{})},Cs=()=>({tenant:{},implementation:{},widget:{}}),Os=i=>i?!!i&&new Date>new Date(i):!1,bt=(i,t)=>{const e=i.widget[t]||i.implementation[t]||i.tenant[t];return e==null?void 0:e.value},Yt=(i,t,e)=>e?{value:i,category:t,expiration:typeof e=="object"?Ct(e):e}:{value:i,category:t},pt=(i,t)=>{const e=Ce(i);return Object.entries(e).forEach(([s,n])=>{Object.entries(n).forEach(([r,o])=>{const{expiration:a,category:h}=o;(Os(a)||Ss(t,h))&&(n[r]=Yt(void 0,h,a))})}),e},he=(i,t)=>O(i,"storagePolicy",f.Cookie).then((e=[m.Necessary])=>!!t&&e.indexOf(t)===-1),Ss=(i=[m.Necessary],t)=>!!t&&i.indexOf(t)===-1,Zt=i=>{const t=Gt(i),e=vt(i,window.localStorage),s=vt(i,sessionStorage),n=bt(t,"storagePolicy"),[r,o,a]=[t,e,s].map(h=>pt(h,n));De(i,r),qt(i,window.localStorage,o),qt(i,window.sessionStorage,a)},Ct=(i={days:30})=>{const{days:t=0,hours:e=0,minutes:s=0,seconds:n=0}=i,r=new Date;return r.setTime(r.getTime()+e*60*60*1e3),r.setTime(r.getTime()+t*24*60*60*1e3),r.setTime(r.getTime()+s*60*1e3),r.setTime(r.getTime()+n*1e3),r.toISOString()},Ps=i=>A(document)(()=>Gt(i)),ks=(i,t)=>A(document)(()=>De(i,t)),Ns=(i,t)=>{const e=t===f.Local?window.localStorage:window.sessionStorage;return A(e)(()=>vt(i,e))},Ms=(i,t,e)=>{const s=t===f.Local?window.localStorage:window.sessionStorage;return A(s)(()=>qt(i,s,e))};let gt=class{constructor(){this.memory={tenant:{},implementation:{},widget:{}}}async setItem(t,e,s={}){return A(this)(()=>{const n=pt(this.memory,[m.Necessary]),{scope:r=G.Tenant,expiration:o}=s;n[r][t]=Yt(e,m.Necessary,(o==null?void 0:o.toISOString())||Ct()),this.memory=n,process.env.NODE_ENV!=="production"&&v.warn(`StorageProvider: StorageProvider is deprecated, use createStorageWriter and readStorage instead, value stored temporarily in memory.
|
|
11
11
|
Key: ${t}
|
|
12
12
|
Value: ${JSON.stringify(e)}
|
|
13
13
|
Options: ${JSON.stringify(s)}
|
|
14
|
-
Memory: ${JSON.stringify(n)}`)})}async getItem(t){return
|
|
14
|
+
Memory: ${JSON.stringify(n)}`)})}async getItem(t){return A(this)(()=>{const e=pt(this.memory,[m.Necessary]);process.env.NODE_ENV!=="production"&&v.warn(`StorageProvider: StorageProvider is deprecated, use createStorageWriter and readStorage instead, value fetched from legacy memory storage.
|
|
15
15
|
Key: ${t}
|
|
16
|
-
Memory: ${JSON.stringify(e)}`);const s=bt(e,t);return this.memory=e,s})}async removeItem(t){return
|
|
16
|
+
Memory: ${JSON.stringify(e)}`);const s=bt(e,t);return this.memory=e,s})}async removeItem(t){return A(this)(()=>{const e=pt(this.memory,[m.Necessary]);delete e.tenant[t],delete e.implementation[t],delete e.widget[t],this.memory=e,process.env.NODE_ENV!=="production"&&v.warn(`StorageProvider: StorageProvider is deprecated, use createStorageWriter and readStorage instead, value removed from memory.
|
|
17
17
|
Key: ${t}
|
|
18
|
-
Memory: ${JSON.stringify(e)}`)})}async clear(){return Promise.resolve()}},
|
|
18
|
+
Memory: ${JSON.stringify(e)}`)})}async clear(){return Promise.resolve()}},Ds=class{constructor(){this.cookies=new gt,this.session=new gt,this.local=new gt}};Jt(i=>{i.createCommand("storage",t=>(e={})=>{const{consent:s}=e;if(typeof s<"u"){if(typeof s!="number"&&typeof s!="string"&&!Array.isArray(s)){process.env.NODE_ENV!=="production"&&v.warn(`storagePolicyConfigurationApi: passed consent is not valid. Consent either has to be a number, a string, an array of strings or an array of numbers.
|
|
19
19
|
Passed consent: ${JSON.stringify(s)}`);return}if(Array.isArray(s)&&!s.every(r=>typeof r=="number"||typeof r=="string")){process.env.NODE_ENV!=="production"&&v.warn(`storagePolicyConfigurationApi: passed consent is not valid. Consent either has to be a number, a string, an array of strings or an array of numbers.
|
|
20
20
|
Passed consent: ${JSON.stringify(s)}`);return}const n=[m.Necessary,m.Functional,m.Analytical,m.Marketing].filter((r,o,a)=>typeof s=="number"?s>o:typeof s=="string"?a.indexOf(s)+1>o:Array.isArray(s)?s.findIndex(h=>h===o+1||h===r)>-1:!0);return n.indexOf(m.Necessary)===-1&&(process.env.NODE_ENV!=="production"&&v.warn(`storagePolicyConfigurationApi: passed consent does not include category: '${m.Necessary}'. Consent has to atleast include the '${m.Necessary}' category.
|
|
21
|
-
Passed consent: ${JSON.stringify(s)}`),n.unshift(m.Necessary)),P(t.container,"storagePolicy",m.Necessary,{medium:f.Cookie,scope:G.Tenant,duration:{days:365}}).then(r=>r(n)).then(()=>{Zt(t.container),t.events.dispatch("storage:policy-changed",n)})}})});const
|
|
21
|
+
Passed consent: ${JSON.stringify(s)}`),n.unshift(m.Necessary)),P(t.container,"storagePolicy",m.Necessary,{medium:f.Cookie,scope:G.Tenant,duration:{days:365}}).then(r=>r(n)).then(()=>{Zt(t.container),t.events.dispatch("storage:policy-changed",n)})}})});const Ls=Object.freeze(Object.defineProperty({__proto__:null,StorageCategory:m,StorageMedium:f,StorageProvider:Ds,StorageScope:G,StorageService:gt,createStorageWriter:P,readStorage:O},Symbol.toStringTag,{value:"Module"})),Is=i=>{const t=(n,r)=>{n&&(r?n.classList.add("ace-tabbing"):n.classList.remove("ace-tabbing"))},e=n=>{n.key==="Tab"?t(i,!0):n.key==="Enter"&&document.activeElement&&document.activeElement.classList.contains("ace-widget-trigger")||t(i,!1)},s=n=>{document.activeElement&&document.activeElement.classList.contains("ace-widget-trigger")&&document.activeElement.classList.contains("ace-tabbing")||t(i,!1)};return document.addEventListener("keydown",e),document.addEventListener("click",s),()=>{document.removeEventListener("keydown",e),document.removeEventListener("click",s)}};function Rs(i,t){const{widgetName:e,label:s="",ariaLabel:n="",tooltip:r=""}=t;return i.classList.add("ace-widget-trigger"),i.classList.add(`ace-widget_${e}`),s.length&&i.classList.add("trigger-has-text"),n.length&&!i.getAttribute("aria-label")&&i.setAttribute("aria-label",n),n.length&&!i.getAttribute("tabindex")&&i.setAttribute("tabindex","0"),r.length&&!i.getAttribute("title")&&i.setAttribute("title",r),Is(i)}function Ts(i,t){i instanceof HTMLElement?(t&&i.setAttribute("title",t),i.classList.remove("ace-trigger-active"),i.classList.remove("ace-trigger-loading")):i instanceof Array&&i.forEach(e=>{t&&e.setAttribute("title",t),e.classList.remove("ace-trigger-active"),e.classList.remove("ace-trigger-loading")})}function Us(i){i instanceof HTMLElement?(i.classList.remove("ace-trigger-active"),i.classList.add("ace-trigger-loading")):i instanceof Array&&i.forEach(t=>{t.classList.remove("ace-trigger-active"),t.classList.add("ace-trigger-loading")})}function Le(i,t){i instanceof HTMLElement?(t&&i.setAttribute("title",t),i.classList.add("ace-trigger-active"),i.classList.remove("ace-trigger-loading")):i instanceof Array&&i.forEach(e=>{t&&e.setAttribute("title",t),e.classList.add("ace-trigger-active"),e.classList.remove("ace-trigger-loading")})}/**
|
|
22
22
|
* @license
|
|
23
23
|
* Copyright 2019 Google LLC
|
|
24
24
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
25
|
-
*/const mt=globalThis,Qt=mt.ShadowRoot&&(mt.ShadyCSS===void 0||mt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Xt=Symbol(),
|
|
25
|
+
*/const mt=globalThis,Qt=mt.ShadowRoot&&(mt.ShadyCSS===void 0||mt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Xt=Symbol(),le=new WeakMap;let Ie=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==Xt)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(Qt&&t===void 0){const s=e!==void 0&&e.length===1;s&&(t=le.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&le.set(e,t))}return t}toString(){return this.cssText}};const js=i=>new Ie(typeof i=="string"?i:i+"",void 0,Xt),te=(i,...t)=>{const e=i.length===1?i[0]:t.reduce((s,n,r)=>s+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+i[r+1],i[0]);return new Ie(e,i,Xt)},Vs=(i,t)=>{if(Qt)i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const e of t){const s=document.createElement("style"),n=mt.litNonce;n!==void 0&&s.setAttribute("nonce",n),s.textContent=e.cssText,i.appendChild(s)}},de=Qt?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return js(e)})(i):i;/**
|
|
26
26
|
* @license
|
|
27
27
|
* Copyright 2017 Google LLC
|
|
28
28
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
29
|
-
*/const{is:Hs,defineProperty:zs,getOwnPropertyDescriptor:Bs,getOwnPropertyNames:Ws,getOwnPropertySymbols:qs,getPrototypeOf:Js}=Object,M=globalThis,
|
|
29
|
+
*/const{is:Hs,defineProperty:zs,getOwnPropertyDescriptor:Bs,getOwnPropertyNames:Ws,getOwnPropertySymbols:qs,getPrototypeOf:Js}=Object,M=globalThis,ue=M.trustedTypes,Fs=ue?ue.emptyScript:"",Tt=M.reactiveElementPolyfillSupport,X=(i,t)=>i,wt={toAttribute(i,t){switch(t){case Boolean:i=i?Fs:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,t){let e=i;switch(t){case Boolean:e=i!==null;break;case Number:e=i===null?null:Number(i);break;case Object:case Array:try{e=JSON.parse(i)}catch{e=null}}return e}},ee=(i,t)=>!Hs(i,t),pe={attribute:!0,type:String,converter:wt,reflect:!1,hasChanged:ee};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),M.litPropertyMetadata??(M.litPropertyMetadata=new WeakMap);class H extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=pe){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),n=this.getPropertyDescriptor(t,s,e);n!==void 0&&zs(this.prototype,t,n)}}static getPropertyDescriptor(t,e,s){const{get:n,set:r}=Bs(this.prototype,t)??{get(){return this[e]},set(o){this[e]=o}};return{get(){return n==null?void 0:n.call(this)},set(o){const a=n==null?void 0:n.call(this);r.call(this,o),this.requestUpdate(t,a,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??pe}static _$Ei(){if(this.hasOwnProperty(X("elementProperties")))return;const t=Js(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(X("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(X("properties"))){const e=this.properties,s=[...Ws(e),...qs(e)];for(const n of s)this.createProperty(n,e[n])}const t=this[Symbol.metadata];if(t!==null){const e=litPropertyMetadata.get(t);if(e!==void 0)for(const[s,n]of e)this.elementProperties.set(s,n)}this._$Eh=new Map;for(const[e,s]of this.elementProperties){const n=this._$Eu(e,s);n!==void 0&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const n of s)e.unshift(de(n))}else t!==void 0&&e.push(de(t));return e}static _$Eu(t,e){const s=e.attribute;return s===!1?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var t;this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(e=>e(this))}addController(t){var e;(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&((e=t.hostConnected)==null||e.call(t))}removeController(t){var e;(e=this._$EO)==null||e.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Vs(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$EO)==null||t.forEach(e=>{var s;return(s=e.hostConnected)==null?void 0:s.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$EO)==null||t.forEach(e=>{var s;return(s=e.hostDisconnected)==null?void 0:s.call(e)})}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$EC(t,e){var r;const s=this.constructor.elementProperties.get(t),n=this.constructor._$Eu(t,s);if(n!==void 0&&s.reflect===!0){const o=(((r=s.converter)==null?void 0:r.toAttribute)!==void 0?s.converter:wt).toAttribute(e,s.type);this._$Em=t,o==null?this.removeAttribute(n):this.setAttribute(n,o),this._$Em=null}}_$AK(t,e){var r;const s=this.constructor,n=s._$Eh.get(t);if(n!==void 0&&this._$Em!==n){const o=s.getPropertyOptions(n),a=typeof o.converter=="function"?{fromAttribute:o.converter}:((r=o.converter)==null?void 0:r.fromAttribute)!==void 0?o.converter:wt;this._$Em=n,this[n]=a.fromAttribute(e,o.type),this._$Em=null}}requestUpdate(t,e,s){if(t!==void 0){if(s??(s=this.constructor.getPropertyOptions(t)),!(s.hasChanged??ee)(this[t],e))return;this.P(t,e,s)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(t,e,s){this._$AL.has(t)||this._$AL.set(t,e),s.reflect===!0&&this._$Em!==t&&(this._$Ej??(this._$Ej=new Set)).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var s;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[r,o]of this._$Ep)this[r]=o;this._$Ep=void 0}const n=this.constructor.elementProperties;if(n.size>0)for(const[r,o]of n)o.wrapped!==!0||this._$AL.has(r)||this[r]===void 0||this.P(r,this[r],o)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(s=this._$EO)==null||s.forEach(n=>{var r;return(r=n.hostUpdate)==null?void 0:r.call(n)}),this.update(e)):this._$EU()}catch(n){throw t=!1,this._$EU(),n}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$EO)==null||e.forEach(s=>{var n;return(n=s.hostUpdated)==null?void 0:n.call(s)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EC(e,this[e]))),this._$EU()}updated(t){}firstUpdated(t){}}H.elementStyles=[],H.shadowRootOptions={mode:"open"},H[X("elementProperties")]=new Map,H[X("finalized")]=new Map,Tt==null||Tt({ReactiveElement:H}),(M.reactiveElementVersions??(M.reactiveElementVersions=[])).push("2.0.4");/**
|
|
30
30
|
* @license
|
|
31
31
|
* Copyright 2017 Google LLC
|
|
32
32
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
33
33
|
*/const tt=globalThis,$t=tt.trustedTypes,ge=$t?$t.createPolicy("lit-html",{createHTML:i=>i}):void 0,Re="$lit$",k=`lit$${Math.random().toFixed(9).slice(2)}$`,Te="?"+k,Ks=`<${Te}>`,V=document,st=()=>V.createComment(""),it=i=>i===null||typeof i!="object"&&typeof i!="function",se=Array.isArray,Gs=i=>se(i)||typeof(i==null?void 0:i[Symbol.iterator])=="function",Ut=`[
|
|
34
34
|
\f\r]`,Y=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,me=/-->/g,fe=/>/g,I=RegExp(`>|${Ut}(?:([^\\s"'>=/]+)(${Ut}*=${Ut}*(?:[^
|
|
35
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),ye=/'/g,ve=/"/g,Ue=/^(?:script|style|textarea|title)$/i,Ys=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),Q=Ys(1),
|
|
35
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),ye=/'/g,ve=/"/g,Ue=/^(?:script|style|textarea|title)$/i,Ys=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),Q=Ys(1),D=Symbol.for("lit-noChange"),y=Symbol.for("lit-nothing"),be=new WeakMap,U=V.createTreeWalker(V,129);function je(i,t){if(!se(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return ge!==void 0?ge.createHTML(t):t}const Zs=(i,t)=>{const e=i.length-1,s=[];let n,r=t===2?"<svg>":t===3?"<math>":"",o=Y;for(let a=0;a<e;a++){const h=i[a];let c,l,d=-1,u=0;for(;u<h.length&&(o.lastIndex=u,l=o.exec(h),l!==null);)u=o.lastIndex,o===Y?l[1]==="!--"?o=me:l[1]!==void 0?o=fe:l[2]!==void 0?(Ue.test(l[2])&&(n=RegExp("</"+l[2],"g")),o=I):l[3]!==void 0&&(o=I):o===I?l[0]===">"?(o=n??Y,d=-1):l[1]===void 0?d=-2:(d=o.lastIndex-l[2].length,c=l[1],o=l[3]===void 0?I:l[3]==='"'?ve:ye):o===ve||o===ye?o=I:o===me||o===fe?o=Y:(o=I,n=void 0);const p=o===I&&i[a+1].startsWith("/>")?" ":"";r+=o===Y?h+Ks:d>=0?(s.push(c),h.slice(0,d)+Re+h.slice(d)+k+p):h+k+(d===-2?a:p)}return[je(i,r+(i[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]};class nt{constructor({strings:t,_$litType$:e},s){let n;this.parts=[];let r=0,o=0;const a=t.length-1,h=this.parts,[c,l]=Zs(t,e);if(this.el=nt.createElement(c,s),U.currentNode=this.el.content,e===2||e===3){const d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(n=U.nextNode())!==null&&h.length<a;){if(n.nodeType===1){if(n.hasAttributes())for(const d of n.getAttributeNames())if(d.endsWith(Re)){const u=l[o++],p=n.getAttribute(d).split(k),g=/([.?@])?(.*)/.exec(u);h.push({type:1,index:r,name:g[2],strings:p,ctor:g[1]==="."?Xs:g[1]==="?"?ti:g[1]==="@"?ei:Ot}),n.removeAttribute(d)}else d.startsWith(k)&&(h.push({type:6,index:r}),n.removeAttribute(d));if(Ue.test(n.tagName)){const d=n.textContent.split(k),u=d.length-1;if(u>0){n.textContent=$t?$t.emptyScript:"";for(let p=0;p<u;p++)n.append(d[p],st()),U.nextNode(),h.push({type:2,index:++r});n.append(d[u],st())}}}else if(n.nodeType===8)if(n.data===Te)h.push({type:2,index:r});else{let d=-1;for(;(d=n.data.indexOf(k,d+1))!==-1;)h.push({type:7,index:r}),d+=k.length-1}r++}}static createElement(t,e){const s=V.createElement("template");return s.innerHTML=t,s}}function q(i,t,e=i,s){var o,a;if(t===D)return t;let n=s!==void 0?(o=e._$Co)==null?void 0:o[s]:e._$Cl;const r=it(t)?void 0:t._$litDirective$;return(n==null?void 0:n.constructor)!==r&&((a=n==null?void 0:n._$AO)==null||a.call(n,!1),r===void 0?n=void 0:(n=new r(i),n._$AT(i,e,s)),s!==void 0?(e._$Co??(e._$Co=[]))[s]=n:e._$Cl=n),n!==void 0&&(t=q(i,n._$AS(i,t.values),n,s)),t}class Qs{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:s}=this._$AD,n=((t==null?void 0:t.creationScope)??V).importNode(e,!0);U.currentNode=n;let r=U.nextNode(),o=0,a=0,h=s[0];for(;h!==void 0;){if(o===h.index){let c;h.type===2?c=new ot(r,r.nextSibling,this,t):h.type===1?c=new h.ctor(r,h.name,h.strings,this,t):h.type===6&&(c=new si(r,this,t)),this._$AV.push(c),h=s[++a]}o!==(h==null?void 0:h.index)&&(r=U.nextNode(),o++)}return U.currentNode=V,n}p(t){let e=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class ot{get _$AU(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this._$Cv}constructor(t,e,s,n){this.type=2,this._$AH=y,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=n,this._$Cv=(n==null?void 0:n.isConnected)??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=q(this,t,e),it(t)?t===y||t==null||t===""?(this._$AH!==y&&this._$AR(),this._$AH=y):t!==this._$AH&&t!==D&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Gs(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==y&&it(this._$AH)?this._$AA.nextSibling.data=t:this.T(V.createTextNode(t)),this._$AH=t}$(t){var r;const{values:e,_$litType$:s}=t,n=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=nt.createElement(je(s.h,s.h[0]),this.options)),s);if(((r=this._$AH)==null?void 0:r._$AD)===n)this._$AH.p(e);else{const o=new Qs(n,this),a=o.u(this.options);o.p(e),this.T(a),this._$AH=o}}_$AC(t){let e=be.get(t.strings);return e===void 0&&be.set(t.strings,e=new nt(t)),e}k(t){se(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,n=0;for(const r of t)n===e.length?e.push(s=new ot(this.O(st()),this.O(st()),this,this.options)):s=e[n],s._$AI(r),n++;n<e.length&&(this._$AR(s&&s._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){var s;for((s=this._$AP)==null?void 0:s.call(this,!1,!0,e);t&&t!==this._$AB;){const n=t.nextSibling;t.remove(),t=n}}setConnected(t){var e;this._$AM===void 0&&(this._$Cv=t,(e=this._$AP)==null||e.call(this,t))}}class Ot{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,n,r){this.type=1,this._$AH=y,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=r,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=y}_$AI(t,e=this,s,n){const r=this.strings;let o=!1;if(r===void 0)t=q(this,t,e,0),o=!it(t)||t!==this._$AH&&t!==D,o&&(this._$AH=t);else{const a=t;let h,c;for(t=r[0],h=0;h<r.length-1;h++)c=q(this,a[s+h],e,h),c===D&&(c=this._$AH[h]),o||(o=!it(c)||c!==this._$AH[h]),c===y?t=y:t!==y&&(t+=(c??"")+r[h+1]),this._$AH[h]=c}o&&!n&&this.j(t)}j(t){t===y?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class Xs extends Ot{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===y?void 0:t}}class ti extends Ot{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==y)}}class ei extends Ot{constructor(t,e,s,n,r){super(t,e,s,n,r),this.type=5}_$AI(t,e=this){if((t=q(this,t,e,0)??y)===D)return;const s=this._$AH,n=t===y&&s!==y||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,r=t!==y&&(s===y||n);n&&this.element.removeEventListener(this.name,this,s),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e;typeof this._$AH=="function"?this._$AH.call(((e=this.options)==null?void 0:e.host)??this.element,t):this._$AH.handleEvent(t)}}class si{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){q(this,t)}}const jt=tt.litHtmlPolyfillSupport;jt==null||jt(nt,ot),(tt.litHtmlVersions??(tt.litHtmlVersions=[])).push("3.2.1");const ii=(i,t,e)=>{const s=(e==null?void 0:e.renderBefore)??t;let n=s._$litPart$;if(n===void 0){const r=(e==null?void 0:e.renderBefore)??null;s._$litPart$=n=new ot(t.insertBefore(st(),r),r,void 0,e??{})}return n._$AI(i),n};/**
|
|
36
36
|
* @license
|
|
37
37
|
* Copyright 2017 Google LLC
|
|
38
38
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
39
|
-
*/let W=class extends H{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e;const t=super.createRenderRoot();return(e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=ii(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)==null||t.setConnected(!1)}render(){return
|
|
39
|
+
*/let W=class extends H{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e;const t=super.createRenderRoot();return(e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=ii(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)==null||t.setConnected(!1)}render(){return D}};var xe;W._$litElement$=!0,W.finalized=!0,(xe=globalThis.litElementHydrateSupport)==null||xe.call(globalThis,{LitElement:W});const Vt=globalThis.litElementPolyfillSupport;Vt==null||Vt({LitElement:W});(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.1.1");/**
|
|
40
40
|
* @license
|
|
41
41
|
* Copyright 2017 Google LLC
|
|
42
42
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -48,11 +48,11 @@
|
|
|
48
48
|
* @license
|
|
49
49
|
* Copyright 2017 Google LLC
|
|
50
50
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
51
|
-
*/const Ve={ATTRIBUTE:1,CHILD:2
|
|
51
|
+
*/const Ve={ATTRIBUTE:1,CHILD:2},He=i=>(...t)=>({_$litDirective$:i,values:t});let ze=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,s){this._$Ct=t,this._$AM=e,this._$Ci=s}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};/**
|
|
52
52
|
* @license
|
|
53
53
|
* Copyright 2018 Google LLC
|
|
54
54
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
55
|
-
*/const oi=He(class extends ze{constructor(i){var t;if(super(i),i.type!==Ve.ATTRIBUTE||i.name!=="class"||((t=i.strings)==null?void 0:t.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(i){return" "+Object.keys(i).filter(t=>i[t]).join(" ")+" "}update(i,[t]){var s,n;if(this.st===void 0){this.st=new Set,i.strings!==void 0&&(this.nt=new Set(i.strings.join(" ").split(/\s/).filter(r=>r!=="")));for(const r in t)t[r]&&!((s=this.nt)!=null&&s.has(r))&&this.st.add(r);return this.render(t)}const e=i.element.classList;for(const r of this.st)r in t||(e.remove(r),this.st.delete(r));for(const r in t){const o=!!t[r];o===this.st.has(r)||(n=this.nt)!=null&&n.has(r)||(o?(e.add(r),this.st.add(r)):(e.remove(r),this.st.delete(r)))}return
|
|
55
|
+
*/const oi=He(class extends ze{constructor(i){var t;if(super(i),i.type!==Ve.ATTRIBUTE||i.name!=="class"||((t=i.strings)==null?void 0:t.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(i){return" "+Object.keys(i).filter(t=>i[t]).join(" ")+" "}update(i,[t]){var s,n;if(this.st===void 0){this.st=new Set,i.strings!==void 0&&(this.nt=new Set(i.strings.join(" ").split(/\s/).filter(r=>r!=="")));for(const r in t)t[r]&&!((s=this.nt)!=null&&s.has(r))&&this.st.add(r);return this.render(t)}const e=i.element.classList;for(const r of this.st)r in t||(e.remove(r),this.st.delete(r));for(const r in t){const o=!!t[r];o===this.st.has(r)||(n=this.nt)!=null&&n.has(r)||(o?(e.add(r),this.st.add(r)):(e.remove(r),this.st.delete(r)))}return D}}),lt=(i,t,e)=>{i&&e.style.setProperty(t,i)},Be=(i,t)=>{var e,s,n,r;lt((e=i.colors)==null?void 0:e.primaryBackground,"--primary-background",t),lt((s=i.colors)==null?void 0:s.textOnPrimaryBackground,"--text-on-primary-background",t),lt((n=i.colors)==null?void 0:n.secondaryBackground,"--secondary-background",t),lt((r=i.colors)==null?void 0:r.textOnSecondaryBackground,"--text-on-secondary-background",t)};var ai=Object.defineProperty,at=(i,t,e,s)=>{for(var n=void 0,r=i.length-1,o;r>=0;r--)(o=i[r])&&(n=o(t,e,n)||n);return n&&ai(t,e,n),n};const ne=class ne extends W{constructor(){super(...arguments),this.active=!1,this.loaded=!1}async connectedCallback(){super.connectedCallback(),this.icon=await this._renderSymbol(this.symbol),this.loaded=!0,this._applyBranding()}_toggleActive(){this.active=!this.active}_applyBranding(){var e;const t=((e=this.container)==null?void 0:e.get("$settings"))??{};t!=null&&t.branding&&Be(t.branding,this)}async _renderSymbol(t){const e=async s=>await Promise.resolve().then(()=>require("./index-BG1RS3tz.js")).then(r=>r[s]);if(t){const{type:s,content:n}=t;switch(s){case"Telia":{const r=await e(n);return r?Q`<telia-icon
|
|
56
56
|
class="trigger-icon"
|
|
57
57
|
svg=${r.svg}
|
|
58
58
|
size="lg"
|
|
@@ -159,7 +159,7 @@
|
|
|
159
159
|
align-items: center;
|
|
160
160
|
fill: var(--trigger-text-color, var(--text-on-primary-background));
|
|
161
161
|
}
|
|
162
|
-
`];let D=ne;at([J({attribute:!1})],D.prototype,"symbol");at([J({attribute:!1})],D.prototype,"container");at([C()],D.prototype,"active");at([C()],D.prototype,"loaded");at([C()],D.prototype,"icon");var j=(i=>(i.Inline="inline",i.Link="link",i.Badge="badge",i.Unsupported="unsupported",i))(j||{});const ci=(i,t)=>i&&t?"both":i?"widgetDOM":t?"triggerDOM":"none",We=i=>i?typeof i=="boolean"&&i?"link":typeof i=="object"&&!Array.isArray(i)?"badge":"unsupported":"inline",hi=async(i,t,e,s,n,r=!1)=>{var d,l;const o=ci(e,s),a=We(n),h={widgetDOMElement:e?e.cloneNode(!0):void 0,triggerDOMElement:s?s.cloneNode(!0):void 0},c={triggerType:a,cachedOriginals:h,widgetDOMElement:document.createElement("div")};switch(o){case"both":{c.widgetDOMElement=e||document.createElement("div"),a!=="inline"&&(c.triggerDOMElement=s);break}case"widgetDOM":{if(c.widgetDOMElement=e||document.createElement("div"),a!=="inline"){const p=document.body.appendChild(document.createElement("a"));a==="link"&&(p.innerText=t),c.triggerDOMElement=p}break}case"triggerDOM":{const p=document.createElement("div");c.widgetDOMElement=p,a==="inline"?(p.id=(s==null?void 0:s.id)||"",r?(p.style.display="none",(d=s==null?void 0:s.parentNode)==null||d.appendChild(p),c.callback=()=>{var u;(u=s==null?void 0:s.parentNode)==null||u.replaceChild(p,s),p.style.display=(s==null?void 0:s.style.display)||"block"}):(l=s==null?void 0:s.parentNode)==null||l.replaceChild(p,s),c.cachedOriginals.widgetDOMElement=s,c.cachedOriginals.triggerDOMElement=void 0):(c.widgetDOMElement=document.body.appendChild(p),c.triggerDOMElement=s);break}case"none":{const p=document.body.appendChild(document.createElement("div"));if(c.widgetDOMElement=p,a!=="inline"){customElements.get("ace-widget-trigger")||customElements.define("ace-widget-trigger",D);const u=document.createElement("ace-widget-trigger");u.symbol=n.symbol,u.container=i,document.body.appendChild(u),console.log("Created trigger"),c.triggerDOMElement=u}break}}return c},di="modals";class li{constructor(t,e){this.options=e,this.unsubscribe=[],this.container=t.createChild(this),this.container.register("widgetDOMElement",this.options.widgetDOMElement),this.container.register("triggerDOMElement",this.options.triggerDOMElement);const s=this.container.get("$widget");this.options.widgetDOMElement.classList.add("ace-widget"),this.options.widgetDOMElement.classList.add(`ace-widget_${s.name}`);const n=t.get("widgetDOMElements")||[];t.register("widgetDOMElements",[...n,this.options.widgetDOMElement])}render(){const{widgetDOMElement:t,triggerDOMElement:e}=this.options,s=this.container.get("$widget");return t.getAttribute("data-rendered")==="true"?Promise.resolve():(e&&this.options.triggerType===j.Badge&&Us(e),Promise.resolve().then(()=>require("./render-CDXkSh_X.js")).then(n=>n.default(this.container,t)).then(()=>{if(t.setAttribute("data-rendered","true"),e&&this.options.triggerType===j.Badge){const r=this.options.triggerOptions.openTooltip;De(e,r)}us(this.container,t);const n=this.container.get("$environment").widgets.all();O(this.container,di,f.Session).then(r=>{r&&r.forEach(o=>{n.find(a=>a.name===o.name&&a.state==="activated")&&s.events.dispatch("widget:modal-opened",o)})})}))}renderBadge(t){const{triggerDOMElement:e}=this.options;if(!e)return;e.getAttribute("role")||e.setAttribute("role","button");const{name:s}=this.container.get("$widget"),{label:n,symbol:r,ariaLabel:o,closedTooltip:a,openTooltip:h}=t,c={closedTooltip:a,openTooltip:h};this.options.triggerOptions=c;const d=Rs(e,{label:n,symbol:r,ariaLabel:o,widgetName:s,tooltip:a});this.unsubscribe.push(d)}async dispose(){var s,n,r,o;const{triggerDOMElement:t,widgetDOMElement:e}=this.options;this.options.cachedOriginals.widgetDOMElement&&e&&((s=e.parentNode)==null||s.replaceChild(this.options.cachedOriginals.widgetDOMElement,e)),this.options.cachedOriginals.triggerDOMElement&&t&&((n=t.parentNode)==null||n.replaceChild(this.options.cachedOriginals.triggerDOMElement,t)),this.unsubscribe.forEach(a=>{a()}),(r=e.parentNode)==null||r.removeChild(e),(o=t==null?void 0:t.parentNode)==null||o.removeChild(t)}}const lt="changesets",pi=i=>{const t={tags:i.tags};return i.context&&typeof i.context!="function"&&(t.context=i.context),i.properties&&typeof i.properties!="function"&&(t.properties=i.properties),i.layout&&typeof i.layout!="function"&&(t.layout=i.layout),t};class ie{constructor(t,e){this.container=t,this.storageWriter=e}static create(t){return P(t,lt,m.Necessary,{medium:f.Local}).then(e=>new ie(t,e))}write(t,e,s,n){return E(this)(()=>O(this.container,lt,f.Local).then((r={})=>{const{keys:o=[],items:a={}}=r,h=o.indexOf(t);return h>-1&&o.splice(h,1),o.push(t),a[t]={options:n,attributes:pi(s),rules:e.rules},this.storageWriter({keys:o,items:a})}))}remove(t){return E(this)(()=>O(this.container,lt,f.Local).then((e={})=>{const{keys:s=[],items:n={}}=e,r=s.indexOf(t);if(r>-1)return s.splice(r,1),delete n[t],this.storageWriter(e)}))}load(t){return E(this)(()=>O(this.container,lt,f.Local).then((e={})=>{const{keys:s=[],items:n={}}=e;s.forEach(r=>{const o=n[r];if(o){const{rules:a,attributes:h,options:c}=o;t.write({attributes:h,options:c,target:new F(t,a)})}})}))}}const ui=i=>{const{container:t}=i;return ie.create(t).then(e=>{const s=t.get("$settings"),n={localStorage:e},r=new K(i,n),o=ke(r,s);return i.events.subscribe("widget:state-change",(a,h)=>{h.state===Ae.Deactivating&&o()}),r})},gi=i=>Promise.resolve().then(()=>Ds).then(({StorageProvider:t})=>new t),mi=i=>Promise.resolve().then(()=>Kt).then(({ActionResolver:t})=>new t(i)),fi=i=>Promise.resolve().then(()=>Kt).then(({ComponentResolver:t})=>new t(i)),yi=i=>Promise.resolve().then(()=>Kt).then(()=>ui(i.get("$widget"))),Ht="$settings",zt="open",we="activeStickyWidget";class vi extends ds{constructor(t){super(t),this.outlets=new Map,this.activated=void 0,this.subs=[],this.handleBootstrapping=e=>{const s={triggerDOMElement:e.sourceDOMElement,withRenderState:"storage"};this.container.get("settings").then(n=>{const{activate:r}=n;(typeof r>"u"||r===null||r===!0)&&(this.activated=(this.activated||this.widget.activate()).then(()=>this.attach(s)))})},this.container.registerAsync("storage",()=>gi(this.container)),this.container.registerFactory("settings",()=>O(this.container,Ht,f.Local).then((e={})=>({...this.container.get("$settings"),...e}))),os(this,"load",this.handleBootstrapping),this.container.registerAsync("componentResolver",()=>fi(this.container)),this.container.registerAsync("actionResolver",()=>mi(this.container)),this.container.register("matchMedia",window.matchMedia),this.container.registerAsync("components",()=>yi(this.container))}initialize(){const t=this.container.getManyAsync("actionResolver","components"),e=this.container.get("csp");return e&&(window.webprovisionsEnvironmentVariables||(window.webprovisionsEnvironmentVariables={}),window.webprovisionsEnvironmentVariables.cspNonce=e.nonce),Promise.all([t,this.container.get("settings")]).then(([{actionResolver:s,components:n},r])=>(s.subscribe(this.widget.name,(h,c,d)=>this.onAction(c,d)),(h=>{n.nodes.query({type:"view"}).forEach(c=>{n.setSwitch(c,h)})})("index"),this.events.subscribe("widget:data-loaded",(h,{element:c})=>{this.widget.container.get("seoConfiguration")&&this.events.dispatch("widget:preloaded-replaced",{element:c})}),Promise.resolve()))}attach(t={}){return this.container.get("settings").then(async({trigger:e})=>{var p,u;const{widgetDOMElement:s,key:n=rt(),triggerDOMElement:r,withRenderState:o}=t,h=We(e)===j.Inline&&((r==null?void 0:r.childElementCount)||0)>0,c=await hi(this.container,this.widget.name,s,r,e,h);this.outlets.size<1&&!o&&this.setRenderState("unset");const d=()=>{const g=()=>b.querySelectorAll("[data-loading=true]").length===0,[b]=this.widget.container.get("widgetDOMElements"),x=(Pt,$)=>{g()&&(c.callback&&c.callback(),$.disconnect())},ct={attributes:!0,subtree:!0,childList:!0};g()&&c.callback&&c.callback(),new MutationObserver(x).observe(b,ct)};h&&this.widget.container.getAsync("dataClient").then(({events:g})=>{g.subscribe("data-client:fetched",(b,x)=>{x.unresolvedQueries===0&&d()})});const l=this.getOrCreateViewOutlet(n,c);if(this.outlets.set(n,l),this.widget.events.dispatch("widget:attached",{},{bubbles:!0}),c.triggerType===j.Badge&&e&&((p=c.triggerDOMElement)==null||p.setAttribute("aria-expanded","false"),l==null||l.renderBadge(e)),c.triggerType!==j.Inline&&((u=c.triggerDOMElement)==null||u.addEventListener("click",g=>{g.preventDefault(),this.container.get("settings").then(({trigger:b})=>{l.render().then(()=>this.renderState()).then(x=>b&&b.action&&b.action==="hide"?x===w.open?this.hide():this.open():x===w.open?this.close():this.open())})})),this.outlets.size>1)return this.renderState().then(g=>{this.triggerStateIfApplicable(g)});if(o)return o==="storage"?this.renderState().then(g=>{if(c.triggerType===j.Inline){this.triggerStateIfApplicable("open");return}this.triggerStateIfApplicable(g)}):this.triggerStateIfApplicable(o)})}detach(t){if(t){if(this.outlets.has(t)){const e=this.outlets.get(t);e==null||e.dispose(),this.outlets.delete(t);return}process.env.NODE_ENV!=="production"&&console.warn(`detach(): Could not find View Outlet with key ${t}`);return}this.outlets.forEach(e=>{e.dispose()}),this.outlets.clear()}triggerStateIfApplicable(t){switch(t){case"closed":this.close();break;case"open":this.open();break;case"hidden":this.hide();break;default:return}}getOrCreateViewOutlet(t,e){return this.outlets.has(t)?this.outlets.get(t):new li(this.container,e)}render(t={}){if(process.env.NODE_ENV!=="production"&&console.warn("widget.render() is deprecated. Use widget.attach() instead."),t.open){const e={...t,withRenderState:"open"};return this.attach(e)}return this.attach(t)}activate(t){t!=null&&t.override&&this.setSettings(()=>t.override),t!=null&&t.apiNotificationPriorityBy&&this.container.register("apiNotificationPriorityBy",t.apiNotificationPriorityBy)}setSettings(t){return Promise.all([this.container.get("settings"),P(this.container,Ht,m.Necessary,{medium:f.Local})]).then(([e,s])=>Promise.resolve(t(e)).then(n=>s(n).then(()=>{const r={...e,...n};return this.widget.events.dispatch("widget:settings-updated",r),r})))}clearSettings(){return P(this.container,Ht,m.Necessary,{medium:f.Local}).then(t=>t()).then(()=>this.container.get("settings")).then(t=>{this.widget.events.dispatch("widget:settings-updated",t)})}action({action:t,value:e}){return this.container.getAsync("actionResolver").then(s=>{s.action(this.widget.name,t,e)})}renderState(){return O(this.container,zt,f.Session).then((e=w.closed)=>e)}hide(){return this.outlets.size<1?(process.env.NODE_ENV!=="production"&&console.warn("hide(): No-op as no view outlets are registered. Invoke the attach() command first."),Promise.resolve()):(this.outlets.forEach(t=>t.render()),this.action({action:"hide"}).then(()=>{this.setTriggerState(!1)}))}open(){return this.outlets.size<1?(process.env.NODE_ENV!=="production"&&console.warn("open(): No-op as no view outlets are registered. Invoke the attach() command first."),Promise.resolve()):(this.outlets.forEach(t=>t.render()),this.action({action:"open"}).then(()=>(this.widget.events.dispatch("tracking:widget-rendered",{}),this.onOpen())))}close(){return this.outlets.size<1?(process.env.NODE_ENV!=="production"&&console.warn("close(): No-op as no view outlets are registered. Invoke the attach() command first."),Promise.resolve()):this.action({action:"close"}).then(()=>this.onClose())}show(){return process.env.NODE_ENV!=="production"&&console.warn("show(): Command is deprecated and will be removed in the future. Use open() instead."),this.open()}onAction(t,e){switch(t){case"close":case"open":case"hide":const s=t==="open"?w.open:t==="close"?w.closed:w.hidden;return this.setRenderState(s).then(()=>{this.setTriggerState(s===w.open),s!==w.hidden?s===w.open?this.onOpen():this.onClose():this.outlets.forEach(n=>{var r;return(r=n.options.triggerDOMElement)==null?void 0:r.setAttribute("aria-expanded","false")})})}}setRenderState(t){const{invoke:e,events:s}=this.container.get("$widget");return Promise.all([P(this.container,zt,m.Necessary,{medium:f.Session}),P(this.container,zt,m.Necessary,{medium:f.Local,duration:{minutes:5}}),e("renderState")]).then(([n,r,o])=>{t==="unset"||!t?(r(),n()):n(t),s.dispatch("widget:render-state-changed",{previous:o,next:t})})}onOpen(){return this.outlets.forEach(t=>{var e;return(e=t.options.triggerDOMElement)==null?void 0:e.setAttribute("aria-expanded","true")}),Promise.resolve()}onClose(){const t=this.container.getManyAsync("components");return this.container.get("settings").then(s=>{const{activate:n}=this.container.get("$settings");return s.activate!==n?this.setSettings(()=>Promise.resolve({activate:n})):Promise.resolve()}).then(()=>t).then(({components:s})=>{this.outlets.forEach(n=>{var r;return(r=n.options.triggerDOMElement)==null?void 0:r.setAttribute("aria-expanded","false")})})}setTriggerState(t){this.outlets.forEach(e=>{const{options:{triggerDOMElement:s,triggerOptions:n}}=e,{openTooltip:r,closedTooltip:o}=n||{};s&&(t?De(s,r):Ts(s,o))})}deactivate(){this.subs.forEach(e=>e());const t=[];return this.outlets.forEach(e=>t.push(e.dispose())),O(this.container,we,f.Local).then(e=>e===this.widget.name?P(this.container,we,m.Necessary,{medium:f.Local,scope:G.Implementation}).then(s=>s()).then(()=>Promise.all(t)):Promise.all(t))}}/**
|
|
162
|
+
`];let L=ne;at([J({attribute:!1})],L.prototype,"symbol");at([J({attribute:!1})],L.prototype,"container");at([C()],L.prototype,"active");at([C()],L.prototype,"loaded");at([C()],L.prototype,"icon");var j=(i=>(i.Inline="inline",i.Link="link",i.Badge="badge",i.Unsupported="unsupported",i))(j||{});const ci=(i,t)=>i&&t?"both":i?"widgetDOM":t?"triggerDOM":"none",We=i=>i?typeof i=="boolean"&&i?"link":typeof i=="object"&&!Array.isArray(i)?"badge":"unsupported":"inline",hi=async(i,t,e,s,n,r=!1)=>{var l,d;const o=ci(e,s),a=We(n),h={widgetDOMElement:e?e.cloneNode(!0):void 0,triggerDOMElement:s?s.cloneNode(!0):void 0},c={triggerType:a,cachedOriginals:h,widgetDOMElement:document.createElement("div")};switch(o){case"both":{c.widgetDOMElement=e||document.createElement("div"),a!=="inline"&&(c.triggerDOMElement=s);break}case"widgetDOM":{if(c.widgetDOMElement=e||document.createElement("div"),a!=="inline"){const u=document.body.appendChild(document.createElement("a"));a==="link"&&(u.innerText=t),c.triggerDOMElement=u}break}case"triggerDOM":{const u=document.createElement("div");c.widgetDOMElement=u,a==="inline"?(u.id=(s==null?void 0:s.id)||"",r?(u.style.display="none",(l=s==null?void 0:s.parentNode)==null||l.appendChild(u),c.callback=()=>{var p;(p=s==null?void 0:s.parentNode)==null||p.replaceChild(u,s),u.style.display=(s==null?void 0:s.style.display)||"block"}):(d=s==null?void 0:s.parentNode)==null||d.replaceChild(u,s),c.cachedOriginals.widgetDOMElement=s,c.cachedOriginals.triggerDOMElement=void 0):(c.widgetDOMElement=document.body.appendChild(u),c.triggerDOMElement=s);break}case"none":{const u=document.body.appendChild(document.createElement("div"));if(c.widgetDOMElement=u,a!=="inline"){customElements.get("ace-widget-trigger")||customElements.define("ace-widget-trigger",L);const p=document.createElement("ace-widget-trigger");p.symbol=n.symbol,p.container=i,document.body.appendChild(p),console.log("Created trigger"),c.triggerDOMElement=p}break}}return c},li="modals";class di{constructor(t,e){this.options=e,this.unsubscribe=[],this.container=t.createChild(this),this.container.register("widgetDOMElement",this.options.widgetDOMElement),this.container.register("triggerDOMElement",this.options.triggerDOMElement);const s=this.container.get("$widget");this.options.widgetDOMElement.classList.add("ace-widget"),this.options.widgetDOMElement.classList.add(`ace-widget_${s.name}`);const n=t.get("widgetDOMElements")||[];t.register("widgetDOMElements",[...n,this.options.widgetDOMElement])}render(){const{widgetDOMElement:t,triggerDOMElement:e}=this.options,s=this.container.get("$widget");return t.getAttribute("data-rendered")==="true"?Promise.resolve():(e&&this.options.triggerType===j.Badge&&Us(e),Promise.resolve().then(()=>require("./render-BWvHPAsL.js")).then(n=>n.default(this.container,t)).then(()=>{if(t.setAttribute("data-rendered","true"),e&&this.options.triggerType===j.Badge){const r=this.options.triggerOptions.openTooltip;Le(e,r)}ps(this.container,t);const n=this.container.get("$environment").widgets.all();O(this.container,li,f.Session).then(r=>{r&&r.forEach(o=>{n.find(a=>a.name===o.name&&a.state==="activated")&&s.events.dispatch("widget:modal-opened",o)})})}))}renderBadge(t){const{triggerDOMElement:e}=this.options;if(!e)return;e.getAttribute("role")||e.setAttribute("role","button");const{name:s}=this.container.get("$widget"),{label:n,symbol:r,ariaLabel:o,closedTooltip:a,openTooltip:h}=t,c={closedTooltip:a,openTooltip:h};this.options.triggerOptions=c;const l=Rs(e,{label:n,ariaLabel:o,widgetName:s,tooltip:a});this.unsubscribe.push(l)}async dispose(){var s,n,r,o;const{triggerDOMElement:t,widgetDOMElement:e}=this.options;this.options.cachedOriginals.widgetDOMElement&&e&&((s=e.parentNode)==null||s.replaceChild(this.options.cachedOriginals.widgetDOMElement,e)),this.options.cachedOriginals.triggerDOMElement&&t&&((n=t.parentNode)==null||n.replaceChild(this.options.cachedOriginals.triggerDOMElement,t)),this.unsubscribe.forEach(a=>{a()}),(r=e.parentNode)==null||r.removeChild(e),(o=t==null?void 0:t.parentNode)==null||o.removeChild(t)}}const dt="changesets",ui=i=>{const t={tags:i.tags};return i.context&&typeof i.context!="function"&&(t.context=i.context),i.properties&&typeof i.properties!="function"&&(t.properties=i.properties),i.layout&&typeof i.layout!="function"&&(t.layout=i.layout),t};class ie{constructor(t,e){this.container=t,this.storageWriter=e}static create(t){return P(t,dt,m.Necessary,{medium:f.Local}).then(e=>new ie(t,e))}write(t,e,s,n){return A(this)(()=>O(this.container,dt,f.Local).then((r={})=>{const{keys:o=[],items:a={}}=r,h=o.indexOf(t);return h>-1&&o.splice(h,1),o.push(t),a[t]={options:n,attributes:ui(s),rules:e.rules},this.storageWriter({keys:o,items:a})}))}remove(t){return A(this)(()=>O(this.container,dt,f.Local).then((e={})=>{const{keys:s=[],items:n={}}=e,r=s.indexOf(t);if(r>-1)return s.splice(r,1),delete n[t],this.storageWriter(e)}))}load(t){return A(this)(()=>O(this.container,dt,f.Local).then((e={})=>{const{keys:s=[],items:n={}}=e;s.forEach(r=>{const o=n[r];if(o){const{rules:a,attributes:h,options:c}=o;t.write({attributes:h,options:c,target:new F(t,a)})}})}))}}const pi=i=>{const{container:t}=i;return ie.create(t).then(e=>{const s=t.get("$settings"),n={localStorage:e},r=new K(i,n),o=ke(r,s);return i.events.subscribe("widget:state-change",(a,h)=>{h.state===Ee.Deactivating&&o()}),r})},gi=i=>Promise.resolve().then(()=>Ls).then(({StorageProvider:t})=>new t),mi=i=>Promise.resolve().then(()=>Kt).then(({ActionResolver:t})=>new t(i)),fi=i=>Promise.resolve().then(()=>Kt).then(({ComponentResolver:t})=>new t(i)),yi=i=>Promise.resolve().then(()=>Kt).then(()=>pi(i.get("$widget"))),Ht="$settings",zt="open",we="activeStickyWidget";class vi extends ls{constructor(t){super(t),this.outlets=new Map,this.activated=void 0,this.subs=[],this.handleBootstrapping=e=>{const s={triggerDOMElement:e.sourceDOMElement,withRenderState:"storage"};this.container.get("settings").then(n=>{const{activate:r}=n;(typeof r>"u"||r===null||r===!0)&&(this.activated=(this.activated||this.widget.activate()).then(()=>this.attach(s)))})},this.container.registerAsync("storage",()=>gi(this.container)),this.container.registerFactory("settings",()=>O(this.container,Ht,f.Local).then((e={})=>({...this.container.get("$settings"),...e}))),os(this,"load",this.handleBootstrapping),this.container.registerAsync("componentResolver",()=>fi(this.container)),this.container.registerAsync("actionResolver",()=>mi(this.container)),this.container.register("matchMedia",window.matchMedia),this.container.registerAsync("components",()=>yi(this.container))}initialize(){const t=this.container.getManyAsync("actionResolver","components"),e=this.container.get("csp");return e&&(window.webprovisionsEnvironmentVariables||(window.webprovisionsEnvironmentVariables={}),window.webprovisionsEnvironmentVariables.cspNonce=e.nonce),Promise.all([t,this.container.get("settings")]).then(([{actionResolver:s,components:n},r])=>(s.subscribe(this.widget.name,(h,c,l)=>this.onAction(c,l)),(h=>{n.nodes.query({type:"view"}).forEach(c=>{n.setSwitch(c,h)})})("index"),this.events.subscribe("widget:data-loaded",(h,{element:c})=>{this.widget.container.get("seoConfiguration")&&this.events.dispatch("widget:preloaded-replaced",{element:c})}),Promise.resolve()))}attach(t={}){return this.container.get("settings").then(async({trigger:e})=>{var u,p;const{widgetDOMElement:s,key:n=rt(),triggerDOMElement:r,withRenderState:o}=t,h=We(e)===j.Inline&&((r==null?void 0:r.childElementCount)||0)>0,c=await hi(this.container,this.widget.name,s,r,e,h);this.outlets.size<1&&!o&&this.setRenderState("unset");const l=()=>{const g=()=>b.querySelectorAll("[data-loading=true]").length===0,[b]=this.widget.container.get("widgetDOMElements"),x=(Pt,$)=>{g()&&(c.callback&&c.callback(),$.disconnect())},ct={attributes:!0,subtree:!0,childList:!0};g()&&c.callback&&c.callback(),new MutationObserver(x).observe(b,ct)};h&&this.widget.container.getAsync("dataClient").then(({events:g})=>{g.subscribe("data-client:fetched",(b,x)=>{x.unresolvedQueries===0&&l()})});const d=this.getOrCreateViewOutlet(n,c);if(this.outlets.set(n,d),this.widget.events.dispatch("widget:attached",{},{bubbles:!0}),c.triggerType===j.Badge&&e&&((u=c.triggerDOMElement)==null||u.setAttribute("aria-expanded","false"),d==null||d.renderBadge(e)),c.triggerType!==j.Inline&&((p=c.triggerDOMElement)==null||p.addEventListener("click",g=>{g.preventDefault(),this.container.get("settings").then(({trigger:b})=>{d.render().then(()=>this.renderState()).then(x=>b&&b.action&&b.action==="hide"?x===w.open?this.hide():this.open():x===w.open?this.close():this.open())})})),this.outlets.size>1)return this.renderState().then(g=>{this.triggerStateIfApplicable(g)});if(o)return o==="storage"?this.renderState().then(g=>{if(c.triggerType===j.Inline){this.triggerStateIfApplicable("open");return}this.triggerStateIfApplicable(g)}):this.triggerStateIfApplicable(o)})}detach(t){if(t){if(this.outlets.has(t)){const e=this.outlets.get(t);e==null||e.dispose(),this.outlets.delete(t);return}process.env.NODE_ENV!=="production"&&console.warn(`detach(): Could not find View Outlet with key ${t}`);return}this.outlets.forEach(e=>{e.dispose()}),this.outlets.clear()}triggerStateIfApplicable(t){switch(t){case"closed":this.close();break;case"open":this.open();break;case"hidden":this.hide();break;default:return}}getOrCreateViewOutlet(t,e){return this.outlets.has(t)?this.outlets.get(t):new di(this.container,e)}render(t={}){if(process.env.NODE_ENV!=="production"&&console.warn("widget.render() is deprecated. Use widget.attach() instead."),t.open){const e={...t,withRenderState:"open"};return this.attach(e)}return this.attach(t)}activate(t){t!=null&&t.override&&this.setSettings(()=>t.override),t!=null&&t.apiNotificationPriorityBy&&this.container.register("apiNotificationPriorityBy",t.apiNotificationPriorityBy)}setSettings(t){return Promise.all([this.container.get("settings"),P(this.container,Ht,m.Necessary,{medium:f.Local})]).then(([e,s])=>Promise.resolve(t(e)).then(n=>s(n).then(()=>{const r={...e,...n};return this.widget.events.dispatch("widget:settings-updated",r),r})))}clearSettings(){return P(this.container,Ht,m.Necessary,{medium:f.Local}).then(t=>t()).then(()=>this.container.get("settings")).then(t=>{this.widget.events.dispatch("widget:settings-updated",t)})}action({action:t,value:e}){return this.container.getAsync("actionResolver").then(s=>{s.action(this.widget.name,t,e)})}renderState(){return O(this.container,zt,f.Session).then((e=w.closed)=>e)}hide(){return this.outlets.size<1?(process.env.NODE_ENV!=="production"&&console.warn("hide(): No-op as no view outlets are registered. Invoke the attach() command first."),Promise.resolve()):(this.outlets.forEach(t=>t.render()),this.action({action:"hide"}).then(()=>{this.setTriggerState(!1)}))}open(){return this.outlets.size<1?(process.env.NODE_ENV!=="production"&&console.warn("open(): No-op as no view outlets are registered. Invoke the attach() command first."),Promise.resolve()):(this.outlets.forEach(t=>t.render()),this.action({action:"open"}).then(()=>(this.widget.events.dispatch("tracking:widget-rendered",{}),this.onOpen())))}close(){return this.outlets.size<1?(process.env.NODE_ENV!=="production"&&console.warn("close(): No-op as no view outlets are registered. Invoke the attach() command first."),Promise.resolve()):this.action({action:"close"}).then(()=>this.onClose())}show(){return process.env.NODE_ENV!=="production"&&console.warn("show(): Command is deprecated and will be removed in the future. Use open() instead."),this.open()}onAction(t,e){switch(t){case"close":case"open":case"hide":const s=t==="open"?w.open:t==="close"?w.closed:w.hidden;return this.setRenderState(s).then(()=>{this.setTriggerState(s===w.open),s!==w.hidden?s===w.open?this.onOpen():this.onClose():this.outlets.forEach(n=>{var r;return(r=n.options.triggerDOMElement)==null?void 0:r.setAttribute("aria-expanded","false")})})}}setRenderState(t){const{invoke:e,events:s}=this.container.get("$widget");return Promise.all([P(this.container,zt,m.Necessary,{medium:f.Session}),P(this.container,zt,m.Necessary,{medium:f.Local,duration:{minutes:5}}),e("renderState")]).then(([n,r,o])=>{t==="unset"||!t?(r(),n()):n(t),s.dispatch("widget:render-state-changed",{previous:o,next:t})})}onOpen(){return this.outlets.forEach(t=>{var e;return(e=t.options.triggerDOMElement)==null?void 0:e.setAttribute("aria-expanded","true")}),Promise.resolve()}onClose(){const t=this.container.getManyAsync("components");return this.container.get("settings").then(s=>{const{activate:n}=this.container.get("$settings");return s.activate!==n?this.setSettings(()=>Promise.resolve({activate:n})):Promise.resolve()}).then(()=>t).then(({components:s})=>{this.outlets.forEach(n=>{var r;return(r=n.options.triggerDOMElement)==null?void 0:r.setAttribute("aria-expanded","false")})})}setTriggerState(t){this.outlets.forEach(e=>{const{options:{triggerDOMElement:s,triggerOptions:n}}=e,{openTooltip:r,closedTooltip:o}=n||{};s&&(t?Le(s,r):Ts(s,o))})}deactivate(){this.subs.forEach(e=>e());const t=[];return this.outlets.forEach(e=>t.push(e.dispose())),O(this.container,we,f.Local).then(e=>e===this.widget.name?P(this.container,we,m.Necessary,{medium:f.Local,scope:G.Implementation}).then(s=>s()).then(()=>Promise.all(t)):Promise.all(t))}}/**
|
|
163
163
|
* @license
|
|
164
164
|
* Copyright 2021 Google LLC
|
|
165
165
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -179,11 +179,11 @@
|
|
|
179
179
|
* @license
|
|
180
180
|
* Copyright 2021 Google LLC
|
|
181
181
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
182
|
-
*/class wi extends Event{constructor(t){super("context-provider",{bubbles:!0,composed:!0}),this.context=t}}class z extends bi{constructor(t,e,s){var n,r;super(e.context!==void 0?e.initialValue:s),this.onContextRequest=o=>{const a=o.composedPath()[0];o.context===this.context&&a!==this.host&&(o.stopPropagation(),this.addCallback(o.callback,a,o.subscribe))},this.onProviderRequest=o=>{const a=o.composedPath()[0];if(o.context!==this.context||a===this.host)return;const h=new Set;for(const[c,{consumerHost:
|
|
182
|
+
*/class wi extends Event{constructor(t){super("context-provider",{bubbles:!0,composed:!0}),this.context=t}}class z extends bi{constructor(t,e,s){var n,r;super(e.context!==void 0?e.initialValue:s),this.onContextRequest=o=>{const a=o.composedPath()[0];o.context===this.context&&a!==this.host&&(o.stopPropagation(),this.addCallback(o.callback,a,o.subscribe))},this.onProviderRequest=o=>{const a=o.composedPath()[0];if(o.context!==this.context||a===this.host)return;const h=new Set;for(const[c,{consumerHost:l}]of this.subscriptions)h.has(c)||(h.add(c),l.dispatchEvent(new qe(this.context,c,!0)));o.stopPropagation()},this.host=t,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),(r=(n=this.host).addController)==null||r.call(n,this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new wi(this.context))}}/**
|
|
183
183
|
* @license
|
|
184
184
|
* Copyright 2022 Google LLC
|
|
185
185
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
186
|
-
*/function $i({context:i,subscribe:t}){return(e,s)=>{typeof s=="object"?s.addInitializer(function(){new $e(this,{context:i,callback:n=>{e.set.call(this,n)},subscribe:t})}):e.constructor.addInitializer(n=>{new $e(n,{context:i,callback:r=>{n[s]=r},subscribe:t})})}}const Je="children",Fe="descriptor",Ke="container",Ge="context",Ye="layout",Ze="properties";class Qe{constructor(t){(this.host=t).addController(this)}hostConnected(){}hostDisconnected(){}setDescriptor(t){this._descriptor=t}setContainer(t){this._container=t}async dispatch(t,e){if(!this._container||!this._descriptor)return;const s=await K.getInstance(this._container),n=new F(s).withId(this._descriptor.id);await s.actions(n,this._descriptor.type||rt()).dispatch(t,e)}}const _i=async(i,t)=>{const e=i.properties().provider;let s={},n="";Array.isArray(e)?(n=e[0],s=e[1]):n=e||"";const r=await t.getAsync(n);if(!r)throw new Error("No provider defined in ListComponent");return r.applyComponentNodeSettings(i.node.id,s),{provider:r,settings:s}},xi=async(i,t)=>{const{provider:e,settings:s={}}=await _i(i,t);return{addResource:(n,r)=>e.addResource(n,r),getData:(n,r)=>e.getData(n,r,s)}};class Xe{constructor(t){this.container=t,this.resources=new Map,this.nodeConfiguration=new Map}async getData(t,e,s){const n=this.resources.get(t);if(!n)throw new Error(`Unable to get EntityProvider for "${t}"`);return await n.query(e,s)}addResource(t,e){this.resources.set(t,e)}applyComponentNodeSettings(t,e){this.nodeConfiguration.set(t,e)}}const _e=i=>({title:i.Title,id:i.Id.toString()});class
|
|
186
|
+
*/function $i({context:i,subscribe:t}){return(e,s)=>{typeof s=="object"?s.addInitializer(function(){new $e(this,{context:i,callback:n=>{e.set.call(this,n)},subscribe:t})}):e.constructor.addInitializer(n=>{new $e(n,{context:i,callback:r=>{n[s]=r},subscribe:t})})}}const Je="children",Fe="descriptor",Ke="container",Ge="context",Ye="layout",Ze="properties";class Qe{constructor(t){(this.host=t).addController(this)}hostConnected(){}hostDisconnected(){}setDescriptor(t){this._descriptor=t}setContainer(t){this._container=t}async dispatch(t,e){if(!this._container||!this._descriptor)return;const s=await K.getInstance(this._container),n=new F(s).withId(this._descriptor.id);await s.actions(n,this._descriptor.type||rt()).dispatch(t,e)}}const _i=async(i,t)=>{const e=i.properties().provider;let s={},n="";Array.isArray(e)?(n=e[0],s=e[1]):n=e||"";const r=await t.getAsync(n);if(!r)throw new Error("No provider defined in ListComponent");return r.applyComponentNodeSettings(i.node.id,s),{provider:r,settings:s}},xi=async(i,t)=>{const{provider:e,settings:s={}}=await _i(i,t);return{addResource:(n,r)=>e.addResource(n,r),getData:(n,r)=>e.getData(n,r,s)}};class Xe{constructor(t){this.container=t,this.resources=new Map,this.nodeConfiguration=new Map}async getData(t,e,s){const n=this.resources.get(t);if(!n)throw new Error(`Unable to get EntityProvider for "${t}"`);return await n.query(e,s)}addResource(t,e){this.resources.set(t,e)}applyComponentNodeSettings(t,e){this.nodeConfiguration.set(t,e)}}const _e=i=>({title:i.Title,id:i.Id.toString()});class Ai extends Xe{constructor(t){super(t),this.addResource("item",{query:async(e,s)=>{const n=e.itemId,r="78aacc09-ae6f-5485-5ca3-9dacebb95825",o=t.get("$widget").name,a=s.projection||"",c=await(await fetch(`${a}/guides/${n}?client=${r}&funnel=${o}&site=%2F%2Fdemo.humany.cc%2Fadmin%2Finterfaces&phrase=&connectionId=&p.LastGuideId=2857`)).json();return c?_e(c):null}}),this.addResource("items",{query:async(e,s)=>{const n="",r=t.get("$widget").name,o=s.projection||"",d=await(await fetch(`${o}/guides?client=${n}&funnel=${r}&site=&phrase=&skip=0&take=10&sorting.type=popularity&sorting.direction=descending`)).json();return{items:(d.Matches||[]).map(u=>_e(u)),totalItems:(d==null?void 0:d.TotalMatches)||0}}})}}const Ei=async i=>{i.registerAsync("guideProvider",()=>new Ai(i))},Ci=(i,t,e,s,n)=>i.getAsync("componentResolver").then(r=>(r.registerComponent(t,e),Ne(i,t,s||(()=>{}),t,n))),Oi=i=>{const t={};return Object.keys(i).forEach(e=>{e.indexOf("css-")>-1&&(t[e]=i[e])}),t},ts=(i,t)=>{const e=Oi(t);Object.entries(e).forEach(([s,n])=>{i.style.setProperty(s.replace("css-",""),n)})};var Si=Object.defineProperty,R=(i,t,e,s)=>{for(var n=void 0,r=i.length-1,o;r>=0;r--)(o=i[r])&&(n=o(t,e,n)||n);return n&&Si(t,e,n),n};const Pi=i=>{const e=class e extends i{constructor(){super(...arguments),this.entry="",this._descriptorProvider=new z(this,Fe,void 0),this._childrenProvider=new z(this,Je,[]),this._propertiesProvider=new z(this,Ze,{}),this._contextProvider=new z(this,Ge,{}),this._layoutProvider=new z(this,Ye,{}),this.actions=new Qe(this),this.context={},this.layout={},this.properties={}}connectedCallback(){super.connectedCallback(),this.container&&(this.actions.setContainer(this.container),K.getInstance(this.container).then(async n=>{var o,a;const r=n.nodes.get(this.entry);if(r){this._propertyChangeListener=n.events.subscribe("components:properties-changed",(u,p)=>{r.id===p.node.id&&this._setProperties(p.node.attributes.properties)}),this._contextChangeListener=n.events.subscribe("components:context-changed",(u,p)=>{r.id===p.node.id&&this._setContext(p.node.attributes.context)}),this._layoutChangeListener=n.events.subscribe("components:layout-changed",(u,p)=>{r.id===p.node.id&&this._setLayout(p.node.attributes.layout)});const h="default";this._unmountNode=r.mount(this.container),this._setDescriptor(Wt(r,h)),this._setProperties(r.attributes.properties),this._setContext(r.attributes.context),this._setLayout(this.layout);const c=r.getChildren(h).map(u=>Wt(u));this._childrenProvider.setValue(c);const l=await this.container.getAsync("componentResolver");if(((o=this.descriptor)==null?void 0:o.type)==="area")return;const d=l.getComponent(((a=this.descriptor)==null?void 0:a.type)||"");d.then&&d.then(u=>{this.component=u.default})}}))}disconnectedCallback(){super.disconnectedCallback(),this._propertyChangeListener&&this._propertyChangeListener(),this._contextChangeListener&&this._contextChangeListener(),this._layoutChangeListener&&this._layoutChangeListener(),this._unmountNode&&this._unmountNode()}updated(){this.container&&this.actions.setContainer(this.container),this.renderRoot.host.style.setProperty("--width",this.layout.size==="full"?"var(--columns, 1)":`min(${this.layout.size||"var(--columns)"}, var(--columns))`),ts(this.renderRoot.host,this.properties)}_setProperties(n){this._propertiesProvider.setValue(n),this.properties=n}_setContext(n){this._contextProvider.setValue(n),this.context=n}_setLayout(n){this._layoutProvider.setValue(n),this.layout=n}_setDescriptor(n){this.descriptor=n,this._descriptorProvider.setValue(n),this.actions.setDescriptor(n)}};e.styles=[i.styles??[],te`
|
|
187
187
|
:host {
|
|
188
188
|
font-family: var(--font-family);
|
|
189
189
|
grid-column: span var(--width);
|
|
@@ -195,4 +195,4 @@
|
|
|
195
195
|
* {
|
|
196
196
|
box-sizing: border-box;
|
|
197
197
|
}
|
|
198
|
-
`];let t=e;return R([$i({context:Ke}),J({attribute:!1})],t.prototype,"container"),R([J()],t.prototype,"entry"),R([C()],t.prototype,"descriptor"),R([C()],t.prototype,"component"),R([C()],t.prototype,"context"),R([C()],t.prototype,"layout"),R([C()],t.prototype,"properties"),t};exports.ActionsController=Qe;exports.DataProvider=Xe;exports.E=y;exports.GuideProviderPlugin=
|
|
198
|
+
`];let t=e;return R([$i({context:Ke}),J({attribute:!1})],t.prototype,"container"),R([J()],t.prototype,"entry"),R([C()],t.prototype,"descriptor"),R([C()],t.prototype,"component"),R([C()],t.prototype,"context"),R([C()],t.prototype,"layout"),R([C()],t.prototype,"properties"),t};exports.ActionsController=Qe;exports.DataProvider=Xe;exports.E=y;exports.GuideProviderPlugin=Ei;exports.T=D;exports.Widget=vi;exports.WidgetComponent=Pi;exports.appendStyleFromProperties=ts;exports.childrenContext=Je;exports.containerContext=Ke;exports.contextCtx=Ge;exports.createDataProvider=xi;exports.createLitComponent=Ci;exports.descriptorContext=Fe;exports.e=He;exports.et=K;exports.i=ze;exports.i$1=z;exports.i$2=te;exports.layoutCtx=Ye;exports.mapBranding=Be;exports.n=J;exports.ot=w;exports.propertiesCtx=Ze;exports.r=W;exports.r$1=C;exports.t=Ve;exports.x=Q;
|