chrome-devtools-frontend
Version:
Chrome DevTools UI
50 lines (49 loc) • 15.2 kB
JavaScript
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const t=globalThis,e=t.trustedTypes,s=e?e.createPolicy("lit-html",{createHTML:t=>t}):void 0,i="$lit$",n=`lit$${Math.random().toFixed(9).slice(2)}$`,r="?"+n,o=`<${r}>`,h=document,l=()=>h.createComment(""),c=t=>null===t||"object"!=typeof t&&"function"!=typeof t,a=Array.isArray,d="[ \t\n\f\r]",u=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,$=/-->/g,_=/>/g,A=RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),f=/'/g,p=/"/g,v=/^(?:script|style|textarea|title)$/i,g=Symbol.for("lit-noChange"),y=Symbol.for("lit-nothing"),m=new WeakMap,b=h.createTreeWalker(h,129);function C(t,e){if(!a(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==s?s.createHTML(e):e}class x{constructor({strings:t,_$litType$:s},h){let c;this.parts=[];let a=0,d=0;const g=t.length-1,y=this.parts,[m,w]=((t,e)=>{const s=t.length-1,r=[];let h,l=2===e?"<svg>":3===e?"<math>":"",c=u;for(let e=0;e<s;e++){const s=t[e];let a,d,g=-1,y=0;for(;y<s.length&&(c.lastIndex=y,d=c.exec(s),null!==d);)y=c.lastIndex,c===u?"!--"===d[1]?c=$:void 0!==d[1]?c=_:void 0!==d[2]?(v.test(d[2])&&(h=RegExp("</"+d[2],"g")),c=A):void 0!==d[3]&&(c=A):c===A?">"===d[0]?(c=h??u,g=-1):void 0===d[1]?g=-2:(g=c.lastIndex-d[2].length,a=d[1],c=void 0===d[3]?A:'"'===d[3]?p:f):c===p||c===f?c=A:c===$||c===_?c=u:(c=A,h=void 0);const m=c===A&&t[e+1].startsWith("/>")?" ":"";l+=c===u?s+o:g>=0?(r.push(a),s.slice(0,g)+i+s.slice(g)+n+m):s+n+(-2===g?e:m)}return[C(t,l+(t[s]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),r]})(t,s);if(this.el=x.createElement(m,h),b.currentNode=this.el.content,2===s||3===s){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(c=b.nextNode())&&y.length<g;){if(1===c.nodeType){if(c.hasAttributes())for(const t of c.getAttributeNames())if(t.endsWith(i)){const e=w[d++],s=c.getAttribute(t).split(n),i=/([.?@])?(.*)/.exec(e);y.push({type:1,index:a,name:i[2],strings:s,ctor:"."===i[1]?T:"?"===i[1]?S:"@"===i[1]?E:M}),c.removeAttribute(t)}else t.startsWith(n)&&(y.push({type:6,index:a}),c.removeAttribute(t));if(v.test(c.tagName)){const t=c.textContent.split(n),s=t.length-1;if(s>0){c.textContent=e?e.emptyScript:"";for(let e=0;e<s;e++)c.append(t[e],l()),b.nextNode(),y.push({type:2,index:++a});c.append(t[s],l())}}}else if(8===c.nodeType)if(c.data===r)y.push({type:2,index:a});else{let t=-1;for(;-1!==(t=c.data.indexOf(n,t+1));)y.push({type:7,index:a}),t+=n.length-1}a++}}static createElement(t,e){const s=h.createElement("template");return s.innerHTML=t,s}}function w(t,e,s=t,i){if(e===g)return e;let n=void 0!==i?s._$Co?.[i]:s._$Cl;const r=c(e)?void 0:e._$litDirective$;return n?.constructor!==r&&(n?._$AO?.(!1),void 0===r?n=void 0:(n=new r(t),n._$AT(t,s,i)),void 0!==i?(s._$Co??=[])[i]=n:s._$Cl=n),void 0!==n&&(e=w(t,n._$AS(t,e.values),n,i)),e}let H=class{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,i=(t?.creationScope??h).importNode(e,!0);b.currentNode=i;let n=b.nextNode(),r=0,o=0,l=s[0];for(;void 0!==l;){if(r===l.index){let e;2===l.type?e=new N(n,n.nextSibling,this,t):1===l.type?e=new l.ctor(n,l.name,l.strings,this,t):6===l.type&&(e=new G(n,this,t)),this._$AV.push(e),l=s[++o]}r!==l?.index&&(n=b.nextNode(),r++)}return b.currentNode=h,i}p(t){let e=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}};class N{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,i){this.type=2,this._$AH=y,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=w(this,t,e),c(t)?t===y||null==t||""===t?(this._$AH!==y&&this._$AR(),this._$AH=y):t!==this._$AH&&t!==g&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>a(t)||"function"==typeof t?.[Symbol.iterator])(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&&c(this._$AH)?this._$AA.nextSibling.data=t:this.T(h.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:s}=t,i="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=x.createElement(C(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(e);else{const t=new H(i,this),s=t.u(this.options);t.p(e),this.T(s),this._$AH=t}}_$AC(t){let e=m.get(t.strings);return void 0===e&&m.set(t.strings,e=new x(t)),e}k(t){a(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,i=0;for(const n of t)i===e.length?e.push(s=new N(this.O(l()),this.O(l()),this,this.options)):s=e[i],s._$AI(n),i++;i<e.length&&(this._$AR(s&&s._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class M{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,i,n){this.type=1,this._$AH=y,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=n,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,i){const n=this.strings;let r=!1;if(void 0===n)t=w(this,t,e,0),r=!c(t)||t!==this._$AH&&t!==g,r&&(this._$AH=t);else{const i=t;let o,h;for(t=n[0],o=0;o<n.length-1;o++)h=w(this,i[s+o],e,o),h===g&&(h=this._$AH[o]),r||=!c(h)||h!==this._$AH[o],h===y?t=y:t!==y&&(t+=(h??"")+n[o+1]),this._$AH[o]=h}r&&!i&&this.j(t)}j(t){t===y?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class T extends M{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===y?void 0:t}}class S extends M{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==y)}}class E extends M{constructor(t,e,s,i,n){super(t,e,s,i,n),this.type=5}_$AI(t,e=this){if((t=w(this,t,e,0)??y)===g)return;const s=this._$AH,i=t===y&&s!==y||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,n=t!==y&&(s===y||i);i&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class G{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){w(this,t)}}const I={I:N},U=t.litHtmlPolyfillSupport;U?.(x,N),(t.litHtmlVersions??=[]).push("3.3.1");
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const k=1,O=2,P=3,j=4,B=t=>(...e)=>({_$litDirective$:t,values:e});let L=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)}};
/**
* @license
* Copyright 2018 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const R=B(class extends L{constructor(t){if(super(t),t.type!==k||"class"!==t.name||t.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter(e=>t[e]).join(" ")+" "}update(t,[e]){if(void 0===this.st){this.st=new Set,void 0!==t.strings&&(this.nt=new Set(t.strings.join(" ").split(/\s/).filter(t=>""!==t)));for(const t in e)e[t]&&!this.nt?.has(t)&&this.st.add(t);return this.render(e)}const s=t.element.classList;for(const t of this.st)t in e||(s.remove(t),this.st.delete(t));for(const t in e){const i=!!e[t];i===this.st.has(t)||this.nt?.has(t)||(i?(s.add(t),this.st.add(t)):(s.remove(t),this.st.delete(t)))}return g}}),W=t=>t??y,{I:D}=I,Z=t=>void 0===t.strings,V=()=>document.createComment(""),z=(t,e,s)=>{const i=t._$AA.parentNode,n=void 0===e?t._$AB:e._$AA;if(void 0===s){const e=i.insertBefore(V(),n),r=i.insertBefore(V(),n);s=new D(e,r,t,t.options)}else{const e=s._$AB.nextSibling,r=s._$AM,o=r!==t;if(o){let e;s._$AQ?.(t),s._$AM=t,void 0!==s._$AP&&(e=t._$AU)!==r._$AU&&s._$AP(e)}if(e!==n||o){let t=s._$AA;for(;t!==e;){const e=t.nextSibling;i.insertBefore(t,n),t=e}}}return s},K=(t,e,s=t)=>(t._$AI(e,s),t),X={},Y=(t,e=X)=>t._$AH=e,Q=t=>{t._$AR(),t._$AA.remove()},F=B(class extends L{constructor(t){if(super(t),t.type!==P&&t.type!==k&&t.type!==j)throw Error("The `live` directive is not allowed on child or event bindings");if(!Z(t))throw Error("`live` bindings can only contain a single expression")}render(t){return t}update(t,[e]){if(e===g||e===y)return e;const s=t.element,i=t.name;if(t.type===P){if(e===s[i])return g}else if(t.type===j){if(!!e===s.hasAttribute(i))return g}else if(t.type===k&&s.getAttribute(i)===e+"")return g;return Y(t),e}}),q=(t,e,s)=>{const i=new Map;for(let n=e;n<=s;n++)i.set(t[n],n);return i},J=B(class extends L{constructor(t){if(super(t),t.type!==O)throw Error("repeat() can only be used in text expressions")}dt(t,e,s){let i;void 0===s?s=e:void 0!==e&&(i=e);const n=[],r=[];let o=0;for(const e of t)n[o]=i?i(e,o):o,r[o]=s(e,o),o++;return{values:r,keys:n}}render(t,e,s){return this.dt(t,e,s).values}update(t,[e,s,i]){const n=(t=>t._$AH)(t),{values:r,keys:o}=this.dt(e,s,i);if(!Array.isArray(n))return this.ut=o,r;const h=this.ut??=[],l=[];let c,a,d=0,u=n.length-1,$=0,_=r.length-1;for(;d<=u&&$<=_;)if(null===n[d])d++;else if(null===n[u])u--;else if(h[d]===o[$])l[$]=K(n[d],r[$]),d++,$++;else if(h[u]===o[_])l[_]=K(n[u],r[_]),u--,_--;else if(h[d]===o[_])l[_]=K(n[d],r[_]),z(t,l[_+1],n[d]),d++,_--;else if(h[u]===o[$])l[$]=K(n[u],r[$]),z(t,n[d],n[u]),u--,$++;else if(void 0===c&&(c=q(o,$,_),a=q(h,d,u)),c.has(h[d]))if(c.has(h[u])){const e=a.get(o[$]),s=void 0!==e?n[e]:null;if(null===s){const e=z(t,n[d]);K(e,r[$]),l[$]=e}else l[$]=K(s,r[$]),z(t,n[d],s),n[e]=null;$++}else Q(n[u]),u--;else Q(n[d]),d++;for(;$<=_;){const e=z(t,l[_+1]);K(e,r[$]),l[$++]=e}for(;d<=u;){const t=n[d++];null!==t&&Q(t)}return this.ut=o,Y(t,l),g}}),tt="important",et=" !"+tt,st=B(class extends L{constructor(t){if(super(t),t.type!==k||"style"!==t.name||t.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce((e,s)=>{const i=t[s];return null==i?e:e+`${s=s.includes("-")?s:s.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${i};`},"")}update(t,[e]){const{style:s}=t.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(e)),this.render(e);for(const t of this.ft)null==e[t]&&(this.ft.delete(t),t.includes("-")?s.removeProperty(t):s[t]=null);for(const t in e){const i=e[t];if(null!=i){this.ft.add(t);const e="string"==typeof i&&i.endsWith(et);t.includes("-")||e?s.setProperty(t,e?i.slice(0,-11):i,e?tt:""):s[t]=i}}return g}});
/**
* @license
* Copyright 2018 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
let it=class extends L{constructor(t){if(super(t),this.it=y,t.type!==O)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===y||null==t)return this._t=void 0,this.it=t;if(t===g)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}};it.directiveName="unsafeHTML",it.resultType=1;const nt=B(it),rt=(t,e)=>{const s=t._$AN;if(void 0===s)return!1;for(const t of s)t._$AO?.(e,!1),rt(t,e);return!0},ot=t=>{let e,s;do{if(void 0===(e=t._$AM))break;s=e._$AN,s.delete(t),t=e}while(0===s?.size)},ht=t=>{for(let e;e=t._$AM;t=e){let s=e._$AN;if(void 0===s)e._$AN=s=new Set;else if(s.has(t))break;s.add(t),at(e)}};
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/function lt(t){void 0!==this._$AN?(ot(this),this._$AM=t,ht(this)):this._$AM=t}function ct(t,e=!1,s=0){const i=this._$AH,n=this._$AN;if(void 0!==n&&0!==n.size)if(e)if(Array.isArray(i))for(let t=s;t<i.length;t++)rt(i[t],!1),ot(i[t]);else null!=i&&(rt(i,!1),ot(i));else rt(this,t)}const at=t=>{t.type==O&&(t._$AP??=ct,t._$AQ??=lt)};class dt extends L{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,s){super._$AT(t,e,s),ht(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(rt(this,t),ot(this))}setValue(t){if(Z(this._$Ct))this._$Ct._$AI(t,this);else{const e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}}
/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/class ut{constructor(t){this.G=t}disconnect(){this.G=void 0}reconnect(t){this.G=t}deref(){return this.G}}class $t{constructor(){this.Y=void 0,this.Z=void 0}get(){return this.Y}pause(){this.Y??=new Promise(t=>this.Z=t)}resume(){this.Z?.(),this.Y=this.Z=void 0}}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const _t=t=>!(t=>null===t||"object"!=typeof t&&"function"!=typeof t)(t)&&"function"==typeof t.then,At=1073741823;class ft extends dt{constructor(){super(...arguments),this._$Cwt=At,this._$Cbt=[],this._$CK=new ut(this),this._$CX=new $t}render(...t){return t.find(t=>!_t(t))??g}update(t,e){const s=this._$Cbt;let i=s.length;this._$Cbt=e;const n=this._$CK,r=this._$CX;this.isConnected||this.disconnected();for(let t=0;t<e.length&&!(t>this._$Cwt);t++){const o=e[t];if(!_t(o))return this._$Cwt=t,o;t<i&&o===s[t]||(this._$Cwt=At,i=0,Promise.resolve(o).then(async t=>{for(;r.get();)await r.get();const e=n.deref();if(void 0!==e){const s=e._$Cbt.indexOf(o);s>-1&&s<e._$Cwt&&(e._$Cwt=s,e.setValue(t))}}))}return g}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}}const pt=B(ft),vt=()=>new gt;
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/class gt{}const yt=new WeakMap,mt=B(class extends dt{render(t){return y}update(t,[e]){const s=e!==this.G;return s&&void 0!==this.G&&this.rt(void 0),(s||this.lt!==this.ct)&&(this.G=e,this.ht=t.options?.host,this.rt(this.ct=t.element)),y}rt(t){if(this.isConnected||(t=void 0),"function"==typeof this.G){const e=this.ht??globalThis;let s=yt.get(e);void 0===s&&(s=new WeakMap,yt.set(e,s)),void 0!==s.get(this.G)&&this.G.call(this.ht,void 0),s.set(this.G,t),void 0!==t&&this.G.call(this.ht,t)}else this.G.value=t}get lt(){return"function"==typeof this.G?yt.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});export{it as UnsafeHTMLDirective,ft as UntilDirective,R as classMap,vt as createRef,W as ifDefined,F as live,mt as ref,J as repeat,st as styleMap,nt as unsafeHTML,pt as until};
//# sourceMappingURL=directives.js.map