UNPKG

@cbpds/web-components

Version:
5 lines 14.4 kB
/*! * CPB Design System web components - built with Stencil */ import{N as e,B as t}from"./p-9caf8482.js";let n;let s;let o=false;let l=false;let f=false;let i=false;let c=null;let r=false;const u=(e,t="")=>{{return()=>{}}};const a="slot-fb{display:contents}slot-fb[hidden]{display:none}";const d="http://www.w3.org/1999/xlink";const p={};const v="http://www.w3.org/2000/svg";const y="http://www.w3.org/1999/xhtml";const w=e=>{e=typeof e;return e==="object"||e==="function"};function g(e){var t,n,s;return(s=(n=(t=e.head)===null||t===void 0?void 0:t.querySelector('meta[name="csp-nonce"]'))===null||n===void 0?void 0:n.getAttribute("content"))!==null&&s!==void 0?s:undefined}const m=(e,t,...n)=>{let s=null;let o=null;let l=null;let f=false;let i=false;const c=[];const r=t=>{for(let n=0;n<t.length;n++){s=t[n];if(Array.isArray(s)){r(s)}else if(s!=null&&typeof s!=="boolean"){if(f=typeof e!=="function"&&!w(s)){s=String(s)}if(f&&i){c[c.length-1].t+=s}else{c.push(f?b(null,s):s)}i=f}}};r(n);if(t){if(t.key){o=t.key}if(t.name){l=t.name}{const e=t.className||t.class;if(e){t.class=typeof e!=="object"?e:Object.keys(e).filter((t=>e[t])).join(" ")}}}if(typeof e==="function"){return e(t===null?{}:t,c,j)}const u=b(e,null);u.o=t;if(c.length>0){u.l=c}{u.i=o}{u.u=l}return u};const b=(e,t)=>{const n={p:0,v:e,t,m:null,l:null};{n.o=null}{n.i=null}{n.u=null}return n};const h={};const $=e=>e&&e.v===h;const j={forEach:(e,t)=>e.map(k).forEach(t),map:(e,t)=>e.map(k).map(t).map(O)};const k=e=>({vattrs:e.o,vchildren:e.l,vkey:e.i,vname:e.u,vtag:e.v,vtext:e.t});const O=e=>{if(typeof e.vtag==="function"){const t=Object.assign({},e.vattrs);if(e.vkey){t.key=e.vkey}if(e.vname){t.name=e.vname}return m(e.vtag,t,...e.vchildren||[])}const t=b(e.vtag,e.vtext);t.o=e.vattrs;t.l=e.vchildren;t.i=e.vkey;t.u=e.vname;return t};const x=(e,t,n)=>{const s=be.ce(t,n);e.dispatchEvent(s);return s};const P=new WeakMap;const A=(e,t,n)=>{var s;const o=R(t);const l=we.get(o);e=e.nodeType===11?e:me;if(l){if(typeof l==="string"){e=e.head||e;let n=P.get(e);let f;if(!n){P.set(e,n=new Set)}if(!n.has(o)){{f=me.createElement("style");f.innerHTML=l;const t=(s=be.h)!==null&&s!==void 0?s:g(me);if(t!=null){f.setAttribute("nonce",t)}e.insertBefore(f,e.querySelector("link"))}if(t.p&4){f.innerHTML+=a}if(n){n.add(o)}}}else if(!e.adoptedStyleSheets.includes(l)){e.adoptedStyleSheets=[...e.adoptedStyleSheets,l]}}return o};const M=e=>{const t=e.$;const n=e.$hostElement$;const s=u("attachStyles",t.j);A(n.getRootNode(),t);s()};const R=(e,t)=>"sc-"+e.j;const C=(e,t,n,s,o,l)=>{if(n!==s){let f=ve(e,t);let i=t.toLowerCase();if(t==="class"){const t=e.classList;const o=U(n);const l=U(s);t.remove(...o.filter((e=>e&&!l.includes(e))));t.add(...l.filter((e=>e&&!o.includes(e))))}else if(t==="style"){{for(const t in n){if(!s||s[t]==null){if(t.includes("-")){e.style.removeProperty(t)}else{e.style[t]=""}}}}for(const t in s){if(!n||s[t]!==n[t]){if(t.includes("-")){e.style.setProperty(t,s[t])}else{e.style[t]=s[t]}}}}else if(t==="key");else if(t==="ref"){if(s){s(e)}}else if(!e.__lookupSetter__(t)&&t[0]==="o"&&t[1]==="n"){if(t[2]==="-"){t=t.slice(3)}else if(ve(ge,i)){t=i.slice(2)}else{t=i[2]+t.slice(3)}if(n||s){const o=t.endsWith(W);t=t.replace(D,"");if(n){be.rel(e,t,n,o)}if(s){be.ael(e,t,s,o)}}}else{const c=w(s);if((f||c&&s!==null)&&!o){try{if(!e.tagName.includes("-")){const o=s==null?"":s;if(t==="list"){f=false}else if(n==null||e[t]!=o){e[t]=o}}else{e[t]=s}}catch(e){}}let r=false;{if(i!==(i=i.replace(/^xlink\:?/,""))){t=i;r=true}}if(s==null||s===false){if(s!==false||e.getAttribute(t)===""){if(r){e.removeAttributeNS(d,t)}else{e.removeAttribute(t)}}}else if((!f||l&4||o)&&!c){s=s===true?"":s;if(r){e.setAttributeNS(d,t,s)}else{e.setAttribute(t,s)}}}}};const T=/\s/;const U=e=>!e?[]:e.split(T);const W="Capture";const D=new RegExp(W+"$");const E=(e,t,n,s)=>{const o=t.m.nodeType===11&&t.m.host?t.m.host:t.m;const l=e&&e.o||p;const f=t.o||p;{for(s of N(Object.keys(l))){if(!(s in f)){C(o,s,l[s],undefined,n,t.p)}}}for(s of N(Object.keys(f))){C(o,s,l[s],f[s],n,t.p)}};function N(e){return e.includes("ref")?[...e.filter((e=>e!=="ref")),"ref"]:e}const S=(e,t,l,c)=>{var r;const u=t.l[l];let a=0;let d;let p;let w;if(!o){f=true;if(u.v==="slot"){u.p|=u.l?2:1}}if(u.t!==null){d=u.m=me.createTextNode(u.t)}else if(u.p&1){d=u.m=me.createTextNode("")}else{if(!i){i=u.v==="svg"}d=u.m=me.createElementNS(i?v:y,u.p&2?"slot-fb":u.v);if(i&&u.v==="foreignObject"){i=false}{E(null,u,i)}if(u.l){for(a=0;a<u.l.length;++a){p=S(e,u,a);if(p){d.appendChild(p)}}}{if(u.v==="svg"){i=false}else if(d.tagName==="foreignObject"){i=true}}}d["s-hn"]=s;{if(u.p&(2|1)){d["s-sr"]=true;d["s-cr"]=n;d["s-sn"]=u.u||"";d["s-rf"]=(r=u.o)===null||r===void 0?void 0:r.ref;w=e&&e.l&&e.l[l];if(w&&w.v===u.v&&e.m){{L(e.m)}}}}return d};const L=e=>{be.p|=1;const t=e.closest(s.toLowerCase());if(t!=null){const n=Array.from(t.childNodes).find((e=>e["s-cr"]));const s=Array.from(e.childNodes);for(const e of n?s.reverse():s){if(e["s-sh"]!=null){t.insertBefore(e,n!==null&&n!==void 0?n:null);e["s-sh"]=undefined;f=true}}}be.p&=~1};const q=(e,n)=>{be.p|=1;const o=Array.from(e.childNodes);if(e["s-sr"]&&t.experimentalSlotFixes){let t=e;while(t=t.nextSibling){if(t&&t["s-sn"]===e["s-sn"]&&t["s-sh"]===s){o.push(t)}}}for(let e=o.length-1;e>=0;e--){const t=o[e];if(t["s-hn"]!==s&&t["s-ol"]){G(t).insertBefore(t,z(t));t["s-ol"].remove();t["s-ol"]=undefined;t["s-sh"]=undefined;f=true}if(n){q(t,n)}}be.p&=~1};const B=(e,t,n,s,o,l)=>{let f=e["s-cr"]&&e["s-cr"].parentNode||e;let i;for(;o<=l;++o){if(s[o]){i=S(null,n,o);if(i){s[o].m=i;f.insertBefore(i,z(t))}}}};const F=(e,t,n)=>{for(let s=t;s<=n;++s){const t=e[s];if(t){const e=t.m;Y(t);if(e){{l=true;if(e["s-ol"]){e["s-ol"].remove()}else{q(e,true)}}e.remove()}}}};const I=(e,t,n,s,o=false)=>{let l=0;let f=0;let i=0;let c=0;let r=t.length-1;let u=t[0];let a=t[r];let d=s.length-1;let p=s[0];let v=s[d];let y;let w;while(l<=r&&f<=d){if(u==null){u=t[++l]}else if(a==null){a=t[--r]}else if(p==null){p=s[++f]}else if(v==null){v=s[--d]}else if(K(u,p,o)){H(u,p,o);u=t[++l];p=s[++f]}else if(K(a,v,o)){H(a,v,o);a=t[--r];v=s[--d]}else if(K(u,v,o)){if(u.v==="slot"||v.v==="slot"){q(u.m.parentNode,false)}H(u,v,o);e.insertBefore(u.m,a.m.nextSibling);u=t[++l];v=s[--d]}else if(K(a,p,o)){if(u.v==="slot"||v.v==="slot"){q(a.m.parentNode,false)}H(a,p,o);e.insertBefore(a.m,u.m);a=t[--r];p=s[++f]}else{i=-1;{for(c=l;c<=r;++c){if(t[c]&&t[c].i!==null&&t[c].i===p.i){i=c;break}}}if(i>=0){w=t[i];if(w.v!==p.v){y=S(t&&t[f],n,i)}else{H(w,p,o);t[i]=undefined;y=w.m}p=s[++f]}else{y=S(t&&t[f],n,f);p=s[++f]}if(y){{G(u.m).insertBefore(y,z(u.m))}}}}if(l>r){B(e,s[d+1]==null?null:s[d+1].m,n,s,f,d)}else if(f>d){F(t,l,r)}};const K=(e,t,n=false)=>{if(e.v===t.v){if(e.v==="slot"){return e.u===t.u}if(!n){return e.i===t.i}return true}return false};const z=e=>e&&e["s-ol"]||e;const G=e=>(e["s-ol"]?e["s-ol"]:e).parentNode;const H=(e,t,n=false)=>{const s=t.m=e.m;const l=e.l;const f=t.l;const c=t.v;const r=t.t;let u;if(r===null){{i=c==="svg"?true:c==="foreignObject"?false:i}{if(c==="slot"&&!o){if(e.u!==t.u){t.m["s-sn"]=t.u||"";L(t.m.parentElement)}}else{E(e,t,i)}}if(l!==null&&f!==null){I(s,l,t,f,n)}else if(f!==null){if(e.t!==null){s.textContent=""}B(s,null,t,f,0,f.length-1)}else if(l!==null){F(l,0,l.length-1)}if(i&&c==="svg"){i=false}}else if(u=s["s-cr"]){u.parentNode.textContent=r}else if(e.t!==r){s.data=r}};const J=e=>{const t=e.childNodes;for(const e of t){if(e.nodeType===1){if(e["s-sr"]){const n=e["s-sn"];e.hidden=false;for(const s of t){if(s!==e){if(s["s-hn"]!==e["s-hn"]||n!==""){if(s.nodeType===1&&(n===s.getAttribute("slot")||n===s["s-sn"])){e.hidden=true;break}}else{if(s.nodeType===1||s.nodeType===3&&s.textContent.trim()!==""){e.hidden=true;break}}}}}J(e)}}};const Q=[];const V=e=>{let t;let n;let s;for(const o of e.childNodes){if(o["s-sr"]&&(t=o["s-cr"])&&t.parentNode){n=t.parentNode.childNodes;const e=o["s-sn"];for(s=n.length-1;s>=0;s--){t=n[s];if(!t["s-cn"]&&!t["s-nr"]&&t["s-hn"]!==o["s-hn"]&&(!t["s-sh"]||t["s-sh"]!==o["s-hn"])){if(X(t,e)){let n=Q.find((e=>e.k===t));l=true;t["s-sn"]=t["s-sn"]||e;if(n){n.k["s-sh"]=o["s-hn"];n.O=o}else{t["s-sh"]=o["s-hn"];Q.push({O:o,k:t})}if(t["s-sr"]){Q.map((e=>{if(X(e.k,t["s-sn"])){n=Q.find((e=>e.k===t));if(n&&!e.O){e.O=n.O}}}))}}else if(!Q.some((e=>e.k===t))){Q.push({k:t})}}}}if(o.nodeType===1){V(o)}}};const X=(e,t)=>{if(e.nodeType===1){if(e.getAttribute("slot")===null&&t===""){return true}if(e.getAttribute("slot")===t){return true}return false}if(e["s-sn"]===t){return true}return t===""};const Y=e=>{{e.o&&e.o.ref&&e.o.ref(null);e.l&&e.l.map(Y)}};const Z=(e,t,i=false)=>{var c,r,u,a,d;const p=e.$hostElement$;const v=e.$;const y=e.P||b(null,null);const w=$(t)?t:m(null,null,t);s=p.tagName;if(v.A){w.o=w.o||{};v.A.map((([e,t])=>w.o[t]=p[e]))}if(i&&w.o){for(const e of Object.keys(w.o)){if(p.hasAttribute(e)&&!["key","ref","style","class"].includes(e)){w.o[e]=p[e]}}}w.v=null;w.p|=4;e.P=w;w.m=y.m=p;o=(v.p&1)!==0;{n=p["s-cr"];l=false}H(y,w,i);{be.p|=1;if(f){V(w.m);for(const e of Q){const t=e.k;if(!t["s-ol"]){const e=me.createTextNode("");e["s-nr"]=t;t.parentNode.insertBefore(t["s-ol"]=e,t)}}for(const e of Q){const t=e.k;const n=e.O;if(n){const e=n.parentNode;let s=n.nextSibling;if(s&&s.nodeType===1){let n=(c=t["s-ol"])===null||c===void 0?void 0:c.previousSibling;while(n){let o=(r=n["s-nr"])!==null&&r!==void 0?r:null;if(o&&o["s-sn"]===t["s-sn"]&&e===o.parentNode){o=o.nextSibling;while(o===t||(o===null||o===void 0?void 0:o["s-sr"])){o=o===null||o===void 0?void 0:o.nextSibling}if(!o||!o["s-nr"]){s=o;break}}n=n.previousSibling}}if(!s&&e!==t.parentNode||t.nextSibling!==s){if(t!==s){e.insertBefore(t,s);if(t.nodeType===1){t.hidden=(u=t["s-ih"])!==null&&u!==void 0?u:false}}}t&&typeof n["s-rf"]==="function"&&n["s-rf"](t)}else{if(t.nodeType===1){if(i){t["s-ih"]=(a=t.hidden)!==null&&a!==void 0?a:false}t.hidden=true}}}}if(l){J(w.m)}be.p&=~1;Q.length=0}if(v.p&2){for(const e of w.m.childNodes){if(e["s-hn"]!==s&&!e["s-sh"]){if(i&&e["s-ih"]==null){e["s-ih"]=(d=e.hidden)!==null&&d!==void 0?d:false}e.hidden=true}}}n=undefined};const _=(e,t)=>{if(t&&!e.M&&t["s-p"]){t["s-p"].push(new Promise((t=>e.M=t)))}};const ee=(e,t)=>{{e.p|=16}if(e.p&4){e.p|=512;return}_(e,e.R);const n=()=>te(e,t);return Ae(n)};const te=(e,t)=>{const n=e.$hostElement$;const s=u("scheduleUpdate",e.$.j);const o=n;let l;if(t){{l=ue(o,"componentWillLoad")}}{l=ne(l,(()=>ue(o,"componentWillRender")))}s();return ne(l,(()=>oe(e,o,t)))};const ne=(e,t)=>se(e)?e.then(t):t();const se=e=>e instanceof Promise||e&&e.then&&typeof e.then==="function";const oe=async(e,t,n)=>{var s;const o=e.$hostElement$;const l=u("update",e.$.j);const f=o["s-rc"];if(n){M(e)}const i=u("render",e.$.j);{le(e,t,o,n)}if(f){f.map((e=>e()));o["s-rc"]=undefined}i();l();{const t=(s=o["s-p"])!==null&&s!==void 0?s:[];const n=()=>ie(e);if(t.length===0){n()}else{Promise.all(t).then(n);e.p|=4;t.length=0}}};const le=(e,t,n,s)=>{try{c=t;t=t.render();{e.p&=~16}{e.p|=2}{{{Z(e,t,s)}}}}catch(t){ye(t,e.$hostElement$)}c=null;return null};const fe=()=>c;const ie=e=>{const t=e.$.j;const n=e.$hostElement$;const s=u("postUpdate",t);const o=n;const l=e.R;{ue(o,"componentDidRender")}if(!(e.p&64)){e.p|=64;{ae(n)}{ue(o,"componentDidLoad")}s();{e.C(n);if(!l){re()}}}else{s()}{if(e.M){e.M();e.M=undefined}if(e.p&512){Pe((()=>ee(e,false)))}e.p&=~(4|512)}};const ce=e=>{{const t=pe(e);const n=t.$hostElement$.isConnected;if(n&&(t.p&(2|16))===2){ee(t,false)}return n}};const re=t=>{{ae(me.documentElement)}Pe((()=>x(ge,"appload",{detail:{namespace:e}})))};const ue=(e,t,n)=>{if(e&&e[t]){try{return e[t](n)}catch(e){ye(e)}}return undefined};const ae=e=>e.classList.add("hydrated");const de=new WeakMap;const pe=e=>de.get(e);const ve=(e,t)=>t in e;const ye=(e,t)=>(0,console.error)(e,t);const we=new Map;const ge=typeof window!=="undefined"?window:{};const me=ge.document||{head:{}};const be={p:0,T:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,s)=>e.addEventListener(t,n,s),rel:(e,t,n,s)=>e.removeEventListener(t,n,s),ce:(e,t)=>new CustomEvent(e,t)};const he=e=>Promise.resolve(e);const $e=[];const je=[];const ke=(e,t)=>n=>{e.push(n);if(!r){r=true;if(t&&be.p&4){Pe(xe)}else{be.raf(xe)}}};const Oe=e=>{for(let t=0;t<e.length;t++){try{e[t](performance.now())}catch(e){ye(e)}}e.length=0};const xe=()=>{Oe($e);{Oe(je);if(r=$e.length>0){be.raf(xe)}}};const Pe=e=>he().then(e);const Ae=ke(je,true);const Me=(e,t,n)=>{const s=e.get(t);if(!s){e.set(t,[n])}else if(!s.includes(n)){s.push(n)}};const Re=(e,t)=>{let n;return(...s)=>{if(n){clearTimeout(n)}n=setTimeout((()=>{n=0;e(...s)}),t)}};const Ce=e=>!("isConnected"in e)||e.isConnected;const Te=Re((e=>{for(let t of e.keys()){e.set(t,e.get(t).filter(Ce))}}),2e3);const Ue=()=>{if(typeof fe!=="function"){return{}}const e=new Map;return{dispose:()=>e.clear(),get:t=>{const n=fe();if(n){Me(e,t,n)}},set:t=>{const n=e.get(t);if(n){e.set(t,n.filter(ce))}Te(e)},reset:()=>{e.forEach((e=>e.forEach(ce)));Te(e)}}};const We=e=>typeof e==="function"?e():e;const De=(e,t=((e,t)=>e!==t))=>{const n=We(e);let s=new Map(Object.entries(n??{}));const o={dispose:[],get:[],set:[],reset:[]};const l=()=>{s=new Map(Object.entries(We(e)??{}));o.reset.forEach((e=>e()))};const f=()=>{o.dispose.forEach((e=>e()));l()};const i=e=>{o.get.forEach((t=>t(e)));return s.get(e)};const c=(e,n)=>{const l=s.get(e);if(t(n,l,e)){s.set(e,n);o.set.forEach((t=>t(e,n,l)))}};const r=typeof Proxy==="undefined"?{}:new Proxy(n,{get(e,t){return i(t)},ownKeys(e){return Array.from(s.keys())},getOwnPropertyDescriptor(){return{enumerable:true,configurable:true}},has(e,t){return s.has(t)},set(e,t,n){c(t,n);return true}});const u=(e,t)=>{o[e].push(t);return()=>{Ee(o[e],t)}};const a=(t,n)=>{const s=u("set",((e,s)=>{if(e===t){n(s)}}));const o=u("reset",(()=>n(We(e)[t])));return()=>{s();o()}};const d=(...e)=>{const t=e.reduce(((e,t)=>{if(t.set){e.push(u("set",t.set))}if(t.get){e.push(u("get",t.get))}if(t.reset){e.push(u("reset",t.reset))}if(t.dispose){e.push(u("dispose",t.dispose))}return e}),[]);return()=>t.forEach((e=>e()))};const p=e=>{const t=s.get(e);o.set.forEach((n=>n(e,t,t)))};return{state:r,get:i,set:c,on:u,onChange:a,use:d,dispose:f,reset:l,forceUpdate:p}};const Ee=(e,t)=>{const n=e.indexOf(t);if(n>=0){e[n]=e[e.length-1];e.length--}};const Ne=(e,t)=>{const n=De(e,t);n.use(Ue());return n};const{state:Se}=Ne({currentPage:undefined,currentParent:undefined,activeItemName:undefined});export{Se as s}; //# sourceMappingURL=p-c10c2190.js.map