UNPKG

@haxtheweb/haxcms-nodejs

Version:

HAXcms single and multisite nodejs server, api, and administration

6 lines 7.31 kB
/** * @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)}$`,o="?"+n,r=`<${o}>`,h=void 0===t.document?{createTreeWalker:()=>({})}:document,l=()=>h.createComment(""),c=t=>null===t||"object"!=typeof t&&"function"!=typeof t,$=Array.isArray,u=t=>$(t)||"function"==typeof t?.[Symbol.iterator],a="[ \t\n\f\r]",A=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,_=/-->/g,d=/>/g,p=RegExp(`>|${a}(?:([^\\s"'>=/]+)(${a}*=${a}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),g=/'/g,v=/"/g,m=/^(?:script|style|textarea|title)$/i,y=t=>(e,...s)=>({_$litType$:t,strings:e,values:s}),f=y(1),x=y(2),T=y(3),b=Symbol.for("lit-noChange"),C=Symbol.for("lit-nothing"),w=new WeakMap,E=h.createTreeWalker(h,129);function P(t,e){if(!$(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==s?s.createHTML(e):e}const V=(t,e)=>{const s=t.length-1,o=[];let h,$=2===e?"<svg>":3===e?"<math>":"",a=A;for(let e=0;e<s;e++){const s=t[e];let f,x,T=-1,b=0;for(;b<s.length&&(a.lastIndex=b,x=a.exec(s),null!==x);)b=a.lastIndex,a===A?"!--"===x[1]?a=_:void 0!==x[1]?a=d:void 0!==x[2]?(m.test(x[2])&&(h=RegExp("</"+x[2],"g")),a=p):void 0!==x[3]&&(a=p):a===p?">"===x[0]?(a=h??A,T=-1):void 0===x[1]?T=-2:(T=a.lastIndex-x[2].length,f=x[1],a=void 0===x[3]?p:'"'===x[3]?v:g):a===v||a===g?a=p:a===_||a===d?a=A:(a=p,h=void 0);const C=a===p&&t[e+1].startsWith("/>")?" ":"";$+=a===A?s+r:T>=0?(o.push(f),s.slice(0,T)+i+s.slice(T)+n+C):s+n+(-2===T?e:C)}return[P(t,$+(t[s]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),o]};class N{constructor({strings:t,_$litType$:s},r){let h;this.parts=[];let $=0,a=0;const A=t.length-1,_=this.parts,[d,p]=V(t,s);if(this.el=N.createElement(d,r),E.currentNode=this.el.content,2===s||3===s){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(h=E.nextNode())&&_.length<A;){if(1===h.nodeType){if(h.hasAttributes())for(const t of h.getAttributeNames())if(t.endsWith(i)){const e=p[a++],s=h.getAttribute(t).split(n),i=/([.?@])?(.*)/.exec(e);_.push({type:1,index:$,name:i[2],strings:s,ctor:"."===i[1]?H:"?"===i[1]?I:"@"===i[1]?L:R}),h.removeAttribute(t)}else t.startsWith(n)&&(_.push({type:6,index:$}),h.removeAttribute(t));if(m.test(h.tagName)){const t=h.textContent.split(n),s=t.length-1;if(s>0){h.textContent=e?e.emptyScript:"";for(let e=0;e<s;e++)h.append(t[e],l()),E.nextNode(),_.push({type:2,index:++$});h.append(t[s],l())}}}else if(8===h.nodeType)if(h.data===o)_.push({type:2,index:$});else{let t=-1;for(;-1!==(t=h.data.indexOf(n,t+1));)_.push({type:7,index:$}),t+=n.length-1}$++}}static createElement(t,e){const s=h.createElement("template");return s.innerHTML=t,s}}function S(t,e,s=t,i){if(e===b)return e;let n=void 0!==i?s._$Co?.[i]:s._$Cl;const o=c(e)?void 0:e._$litDirective$;return n?.constructor!==o&&(n?._$AO?.(!1),void 0===o?n=void 0:(n=new o(t),n._$AT(t,s,i)),void 0!==i?(s._$Co??=[])[i]=n:s._$Cl=n),void 0!==n&&(e=S(t,n._$AS(t,e.values),n,i)),e}class M{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);E.currentNode=i;let n=E.nextNode(),o=0,r=0,$=s[0];for(;void 0!==$;){if(o===$.index){let e;2===$.type?e=new k(n,n.nextSibling,this,t):1===$.type?e=new $.ctor(n,$.name,$.strings,this,t):6===$.type&&(e=new z(n,this,t)),this._$AV.push(e),$=s[++r]}o!==$?.index&&(n=E.nextNode(),o++)}return E.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 k{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,i){this.type=2,this._$AH=C,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=S(this,t,e),c(t)?t===C||null==t||""===t?(this._$AH!==C&&this._$AR(),this._$AH=C):t!==this._$AH&&t!==b&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):u(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!==C&&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=N.createElement(P(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(e);else{const t=new M(i,this),s=t.u(this.options);t.p(e),this.T(s),this._$AH=t}}_$AC(t){let e=w.get(t.strings);return void 0===e&&w.set(t.strings,e=new N(t)),e}k(t){$(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 k(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&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class R{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,i,n){this.type=1,this._$AH=C,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=C}_$AI(t,e=this,s,i){const n=this.strings;let o=!1;if(void 0===n)t=S(this,t,e,0),o=!c(t)||t!==this._$AH&&t!==b,o&&(this._$AH=t);else{const i=t;let r,h;for(t=n[0],r=0;r<n.length-1;r++)h=S(this,i[s+r],e,r),h===b&&(h=this._$AH[r]),o||=!c(h)||h!==this._$AH[r],h===C?t=C:t!==C&&(t+=(h??"")+n[r+1]),this._$AH[r]=h}o&&!i&&this.j(t)}j(t){t===C?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class H extends R{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===C?void 0:t}}class I extends R{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==C)}}class L extends R{constructor(t,e,s,i,n){super(t,e,s,i,n),this.type=5}_$AI(t,e=this){if((t=S(this,t,e,0)??C)===b)return;const s=this._$AH,i=t===C&&s!==C||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,n=t!==C&&(s===C||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 z{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){S(this,t)}}const B={M:i,P:n,A:o,C:1,L:V,R:M,D:u,V:S,I:k,H:R,N:I,U:L,B:H,F:z},U=t.litHtmlPolyfillSupport;U?.(N,k),(t.litHtmlVersions??=[]).push("3.3.0");const j=(t,e,s)=>{const i=s?.renderBefore??e;let n=i._$litPart$;if(void 0===n){const t=s?.renderBefore??null;i._$litPart$=n=new k(e.insertBefore(l(),t),t,void 0,s??{})}return n._$AI(t),n};export{B as _$LH,f as html,T as mathml,b as noChange,C as nothing,j as render,x as svg};