@snippyly/plugin-staging 1.0.37 → 1.0.39
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/package.json +1 -1
- package/snippyly.js +39 -29
package/package.json
CHANGED
package/snippyly.js
CHANGED
|
@@ -3,35 +3,35 @@
|
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
5
|
*/
|
|
6
|
-
const i=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,t=Symbol(),
|
|
6
|
+
const i=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,t=Symbol(),n=new Map;class e{constructor(i,n){if(this._$cssResult$=!0,n!==t)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=i}get styleSheet(){let t=n.get(this.cssText);return i&&void 0===t&&(n.set(this.cssText,t=new CSSStyleSheet),t.replaceSync(this.cssText)),t}toString(){return this.cssText}}const s=(i,...n)=>{const s=1===i.length?i[0]:n.reduce(((t,n,e)=>t+(i=>{if(!0===i._$cssResult$)return i.cssText;if("number"==typeof i)return i;throw Error("Value passed to 'css' function must be a 'css' function result: "+i+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+i[e+1]),i[0]);return new e(s,t)},o=i?i=>i:i=>i instanceof CSSStyleSheet?(i=>{let n="";for(const t of i.cssRules)n+=t.cssText;return(i=>new e("string"==typeof i?i:i+"",t))(n)})(i):i
|
|
7
7
|
/**
|
|
8
8
|
* @license
|
|
9
9
|
* Copyright 2017 Google LLC
|
|
10
10
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
11
|
-
*/;var r;const l=window.trustedTypes,
|
|
11
|
+
*/;var r;const l=window.trustedTypes,a=l?l.emptyScript:"",d=window.reactiveElementPolyfillSupport,h={toAttribute(i,t){switch(t){case Boolean:i=i?a:null;break;case Object:case Array:i=null==i?i:JSON.stringify(i)}return i},fromAttribute(i,t){let n=i;switch(t){case Boolean:n=null!==i;break;case Number:n=null===i?null:Number(i);break;case Object:case Array:try{n=JSON.parse(i)}catch(i){n=null}}return n}},c=(i,t)=>t!==i&&(t==t||i==i),p={attribute:!0,type:String,converter:h,reflect:!1,hasChanged:c};class u extends HTMLElement{constructor(){super(),this._$Et=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Ei=null,this.o()}static addInitializer(i){var t;null!==(t=this.l)&&void 0!==t||(this.l=[]),this.l.push(i)}static get observedAttributes(){this.finalize();const i=[];return this.elementProperties.forEach(((t,n)=>{const e=this._$Eh(n,t);void 0!==e&&(this._$Eu.set(e,n),i.push(e))})),i}static createProperty(i,t=p){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(i,t),!t.noAccessor&&!this.prototype.hasOwnProperty(i)){const n="symbol"==typeof i?Symbol():"__"+i,e=this.getPropertyDescriptor(i,n,t);void 0!==e&&Object.defineProperty(this.prototype,i,e)}}static getPropertyDescriptor(i,t,n){return{get(){return this[t]},set(e){const s=this[i];this[t]=e,this.requestUpdate(i,s,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(i){return this.elementProperties.get(i)||p}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const i=Object.getPrototypeOf(this);if(i.finalize(),this.elementProperties=new Map(i.elementProperties),this._$Eu=new Map,this.hasOwnProperty("properties")){const i=this.properties,t=[...Object.getOwnPropertyNames(i),...Object.getOwnPropertySymbols(i)];for(const n of t)this.createProperty(n,i[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(i){const t=[];if(Array.isArray(i)){const n=new Set(i.flat(1/0).reverse());for(const i of n)t.unshift(o(i))}else void 0!==i&&t.push(o(i));return t}static _$Eh(i,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof i?i.toLowerCase():void 0}o(){var i;this._$Ep=new Promise((i=>this.enableUpdating=i)),this._$AL=new Map,this._$Em(),this.requestUpdate(),null===(i=this.constructor.l)||void 0===i||i.forEach((i=>i(this)))}addController(i){var t,n;(null!==(t=this._$Eg)&&void 0!==t?t:this._$Eg=[]).push(i),void 0!==this.renderRoot&&this.isConnected&&(null===(n=i.hostConnected)||void 0===n||n.call(i))}removeController(i){var t;null===(t=this._$Eg)||void 0===t||t.splice(this._$Eg.indexOf(i)>>>0,1)}_$Em(){this.constructor.elementProperties.forEach(((i,t)=>{this.hasOwnProperty(t)&&(this._$Et.set(t,this[t]),delete this[t])}))}createRenderRoot(){var t;const n=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return((t,n)=>{i?t.adoptedStyleSheets=n.map((i=>i instanceof CSSStyleSheet?i:i.styleSheet)):n.forEach((i=>{const n=document.createElement("style"),e=window.litNonce;void 0!==e&&n.setAttribute("nonce",e),n.textContent=i.cssText,t.appendChild(n)}))})(n,this.constructor.elementStyles),n}connectedCallback(){var i;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(i=this._$Eg)||void 0===i||i.forEach((i=>{var t;return null===(t=i.hostConnected)||void 0===t?void 0:t.call(i)}))}enableUpdating(i){}disconnectedCallback(){var i;null===(i=this._$Eg)||void 0===i||i.forEach((i=>{var t;return null===(t=i.hostDisconnected)||void 0===t?void 0:t.call(i)}))}attributeChangedCallback(i,t,n){this._$AK(i,n)}_$ES(i,t,n=p){var e,s;const o=this.constructor._$Eh(i,n);if(void 0!==o&&!0===n.reflect){const r=(null!==(s=null===(e=n.converter)||void 0===e?void 0:e.toAttribute)&&void 0!==s?s:h.toAttribute)(t,n.type);this._$Ei=i,null==r?this.removeAttribute(o):this.setAttribute(o,r),this._$Ei=null}}_$AK(i,t){var n,e,s;const o=this.constructor,r=o._$Eu.get(i);if(void 0!==r&&this._$Ei!==r){const i=o.getPropertyOptions(r),l=i.converter,a=null!==(s=null!==(e=null===(n=l)||void 0===n?void 0:n.fromAttribute)&&void 0!==e?e:"function"==typeof l?l:null)&&void 0!==s?s:h.fromAttribute;this._$Ei=r,this[r]=a(t,i.type),this._$Ei=null}}requestUpdate(i,t,n){let e=!0;void 0!==i&&(((n=n||this.constructor.getPropertyOptions(i)).hasChanged||c)(this[i],t)?(this._$AL.has(i)||this._$AL.set(i,t),!0===n.reflect&&this._$Ei!==i&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(i,n))):e=!1),!this.isUpdatePending&&e&&(this._$Ep=this._$E_())}async _$E_(){this.isUpdatePending=!0;try{await this._$Ep}catch(i){Promise.reject(i)}const i=this.scheduleUpdate();return null!=i&&await i,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var i;if(!this.isUpdatePending)return;this.hasUpdated,this._$Et&&(this._$Et.forEach(((i,t)=>this[t]=i)),this._$Et=void 0);let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),null===(i=this._$Eg)||void 0===i||i.forEach((i=>{var t;return null===(t=i.hostUpdate)||void 0===t?void 0:t.call(i)})),this.update(n)):this._$EU()}catch(i){throw t=!1,this._$EU(),i}t&&this._$AE(n)}willUpdate(i){}_$AE(i){var t;null===(t=this._$Eg)||void 0===t||t.forEach((i=>{var t;return null===(t=i.hostUpdated)||void 0===t?void 0:t.call(i)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(i)),this.updated(i)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Ep}shouldUpdate(i){return!0}update(i){void 0!==this._$EC&&(this._$EC.forEach(((i,t)=>this._$ES(t,this[t],i))),this._$EC=void 0),this._$EU()}updated(i){}firstUpdated(i){}}
|
|
12
12
|
/**
|
|
13
13
|
* @license
|
|
14
14
|
* Copyright 2017 Google LLC
|
|
15
15
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
16
16
|
*/
|
|
17
|
-
var y;u.finalized=!0,u.elementProperties=new Map,u.elementStyles=[],u.shadowRootOptions={mode:"open"},null==
|
|
17
|
+
var y;u.finalized=!0,u.elementProperties=new Map,u.elementStyles=[],u.shadowRootOptions={mode:"open"},null==d||d({ReactiveElement:u}),(null!==(r=globalThis.reactiveElementVersions)&&void 0!==r?r:globalThis.reactiveElementVersions=[]).push("1.3.2");const v=globalThis.trustedTypes,m=v?v.createPolicy("lit-html",{createHTML:i=>i}):void 0,g=`lit$${(Math.random()+"").slice(9)}$`,w="?"+g,f=`<${w}>`,b=document,$=(i="")=>b.createComment(i),S=i=>null===i||"object"!=typeof i&&"function"!=typeof i,C=Array.isArray,x=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,k=/-->/g,E=/>/g,L=/>|[ \n\r](?:([^\s"'>=/]+)([ \n\r]*=[ \n\r]*(?:[^ \n\r"'`<>=]|("|')|))|$)/g,M=/'/g,_=/"/g,A=/^(?:script|style|textarea|title)$/i,U=(i=>(t,...n)=>({_$litType$:i,strings:t,values:n}))(1),j=Symbol.for("lit-noChange"),T=Symbol.for("lit-nothing"),I=new WeakMap,O=b.createTreeWalker(b,129,null,!1),V=(i,t)=>{const n=i.length-1,e=[];let s,o=2===t?"<svg>":"",r=x;for(let t=0;t<n;t++){const n=i[t];let l,a,d=-1,h=0;for(;h<n.length&&(r.lastIndex=h,a=r.exec(n),null!==a);)h=r.lastIndex,r===x?"!--"===a[1]?r=k:void 0!==a[1]?r=E:void 0!==a[2]?(A.test(a[2])&&(s=RegExp("</"+a[2],"g")),r=L):void 0!==a[3]&&(r=L):r===L?">"===a[0]?(r=null!=s?s:x,d=-1):void 0===a[1]?d=-2:(d=r.lastIndex-a[2].length,l=a[1],r=void 0===a[3]?L:'"'===a[3]?_:M):r===_||r===M?r=L:r===k||r===E?r=x:(r=L,s=void 0);const c=r===L&&i[t+1].startsWith("/>")?" ":"";o+=r===x?n+f:d>=0?(e.push(l),n.slice(0,d)+"$lit$"+n.slice(d)+g+c):n+g+(-2===d?(e.push(void 0),t):c)}const l=o+(i[n]||"<?>")+(2===t?"</svg>":"");if(!Array.isArray(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==m?m.createHTML(l):l,e]};class R{constructor({strings:i,_$litType$:t},n){let e;this.parts=[];let s=0,o=0;const r=i.length-1,l=this.parts,[a,d]=V(i,t);if(this.el=R.createElement(a,n),O.currentNode=this.el.content,2===t){const i=this.el.content,t=i.firstChild;t.remove(),i.append(...t.childNodes)}for(;null!==(e=O.nextNode())&&l.length<r;){if(1===e.nodeType){if(e.hasAttributes()){const i=[];for(const t of e.getAttributeNames())if(t.endsWith("$lit$")||t.startsWith(g)){const n=d[o++];if(i.push(t),void 0!==n){const i=e.getAttribute(n.toLowerCase()+"$lit$").split(g),t=/([.?@])?(.*)/.exec(n);l.push({type:1,index:s,name:t[2],strings:i,ctor:"."===t[1]?Z:"?"===t[1]?J:"@"===t[1]?H:P})}else l.push({type:6,index:s})}for(const t of i)e.removeAttribute(t)}if(A.test(e.tagName)){const i=e.textContent.split(g),t=i.length-1;if(t>0){e.textContent=v?v.emptyScript:"";for(let n=0;n<t;n++)e.append(i[n],$()),O.nextNode(),l.push({type:2,index:++s});e.append(i[t],$())}}}else if(8===e.nodeType)if(e.data===w)l.push({type:2,index:s});else{let i=-1;for(;-1!==(i=e.data.indexOf(g,i+1));)l.push({type:7,index:s}),i+=g.length-1}s++}}static createElement(i,t){const n=b.createElement("template");return n.innerHTML=i,n}}function z(i,t,n=i,e){var s,o,r,l;if(t===j)return t;let a=void 0!==e?null===(s=n._$Cl)||void 0===s?void 0:s[e]:n._$Cu;const d=S(t)?void 0:t._$litDirective$;return(null==a?void 0:a.constructor)!==d&&(null===(o=null==a?void 0:a._$AO)||void 0===o||o.call(a,!1),void 0===d?a=void 0:(a=new d(i),a._$AT(i,n,e)),void 0!==e?(null!==(r=(l=n)._$Cl)&&void 0!==r?r:l._$Cl=[])[e]=a:n._$Cu=a),void 0!==a&&(t=z(i,a._$AS(i,t.values),a,e)),t}class B{constructor(i,t){this.v=[],this._$AN=void 0,this._$AD=i,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(i){var t;const{el:{content:n},parts:e}=this._$AD,s=(null!==(t=null==i?void 0:i.creationScope)&&void 0!==t?t:b).importNode(n,!0);O.currentNode=s;let o=O.nextNode(),r=0,l=0,a=e[0];for(;void 0!==a;){if(r===a.index){let t;2===a.type?t=new N(o,o.nextSibling,this,i):1===a.type?t=new a.ctor(o,a.name,a.strings,this,i):6===a.type&&(t=new F(o,this,i)),this.v.push(t),a=e[++l]}r!==(null==a?void 0:a.index)&&(o=O.nextNode(),r++)}return s}m(i){let t=0;for(const n of this.v)void 0!==n&&(void 0!==n.strings?(n._$AI(i,n,t),t+=n.strings.length-2):n._$AI(i[t])),t++}}class N{constructor(i,t,n,e){var s;this.type=2,this._$AH=T,this._$AN=void 0,this._$AA=i,this._$AB=t,this._$AM=n,this.options=e,this._$Cg=null===(s=null==e?void 0:e.isConnected)||void 0===s||s}get _$AU(){var i,t;return null!==(t=null===(i=this._$AM)||void 0===i?void 0:i._$AU)&&void 0!==t?t:this._$Cg}get parentNode(){let i=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===i.nodeType&&(i=t.parentNode),i}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(i,t=this){i=z(this,i,t),S(i)?i===T||null==i||""===i?(this._$AH!==T&&this._$AR(),this._$AH=T):i!==this._$AH&&i!==j&&this.$(i):void 0!==i._$litType$?this.T(i):void 0!==i.nodeType?this.k(i):(i=>{var t;return C(i)||"function"==typeof(null===(t=i)||void 0===t?void 0:t[Symbol.iterator])})(i)?this.S(i):this.$(i)}M(i,t=this._$AB){return this._$AA.parentNode.insertBefore(i,t)}k(i){this._$AH!==i&&(this._$AR(),this._$AH=this.M(i))}$(i){this._$AH!==T&&S(this._$AH)?this._$AA.nextSibling.data=i:this.k(b.createTextNode(i)),this._$AH=i}T(i){var t;const{values:n,_$litType$:e}=i,s="number"==typeof e?this._$AC(i):(void 0===e.el&&(e.el=R.createElement(e.h,this.options)),e);if((null===(t=this._$AH)||void 0===t?void 0:t._$AD)===s)this._$AH.m(n);else{const i=new B(s,this),t=i.p(this.options);i.m(n),this.k(t),this._$AH=i}}_$AC(i){let t=I.get(i.strings);return void 0===t&&I.set(i.strings,t=new R(i)),t}S(i){C(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,e=0;for(const s of i)e===t.length?t.push(n=new N(this.M($()),this.M($()),this,this.options)):n=t[e],n._$AI(s),e++;e<t.length&&(this._$AR(n&&n._$AB.nextSibling,e),t.length=e)}_$AR(i=this._$AA.nextSibling,t){var n;for(null===(n=this._$AP)||void 0===n||n.call(this,!1,!0,t);i&&i!==this._$AB;){const t=i.nextSibling;i.remove(),i=t}}setConnected(i){var t;void 0===this._$AM&&(this._$Cg=i,null===(t=this._$AP)||void 0===t||t.call(this,i))}}class P{constructor(i,t,n,e,s){this.type=1,this._$AH=T,this._$AN=void 0,this.element=i,this.name=t,this._$AM=e,this.options=s,n.length>2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=T}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(i,t=this,n,e){const s=this.strings;let o=!1;if(void 0===s)i=z(this,i,t,0),o=!S(i)||i!==this._$AH&&i!==j,o&&(this._$AH=i);else{const e=i;let r,l;for(i=s[0],r=0;r<s.length-1;r++)l=z(this,e[n+r],t,r),l===j&&(l=this._$AH[r]),o||(o=!S(l)||l!==this._$AH[r]),l===T?i=T:i!==T&&(i+=(null!=l?l:"")+s[r+1]),this._$AH[r]=l}o&&!e&&this.C(i)}C(i){i===T?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=i?i:"")}}class Z extends P{constructor(){super(...arguments),this.type=3}C(i){this.element[this.name]=i===T?void 0:i}}const K=v?v.emptyScript:"";class J extends P{constructor(){super(...arguments),this.type=4}C(i){i&&i!==T?this.element.setAttribute(this.name,K):this.element.removeAttribute(this.name)}}class H extends P{constructor(i,t,n,e,s){super(i,t,n,e,s),this.type=5}_$AI(i,t=this){var n;if((i=null!==(n=z(this,i,t,0))&&void 0!==n?n:T)===j)return;const e=this._$AH,s=i===T&&e!==T||i.capture!==e.capture||i.once!==e.once||i.passive!==e.passive,o=i!==T&&(e===T||s);s&&this.element.removeEventListener(this.name,this,e),o&&this.element.addEventListener(this.name,this,i),this._$AH=i}handleEvent(i){var t,n;"function"==typeof this._$AH?this._$AH.call(null!==(n=null===(t=this.options)||void 0===t?void 0:t.host)&&void 0!==n?n:this.element,i):this._$AH.handleEvent(i)}}class F{constructor(i,t,n){this.element=i,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(i){z(this,i)}}const D=window.litHtmlPolyfillSupport;
|
|
18
18
|
/**
|
|
19
19
|
* @license
|
|
20
20
|
* Copyright 2017 Google LLC
|
|
21
21
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
22
22
|
*/
|
|
23
|
-
var W,G;null==D||D(R,N),(null!==(y=globalThis.litHtmlVersions)&&void 0!==y?y:globalThis.litHtmlVersions=[]).push("2.2.6");class q extends u{constructor(){super(...arguments),this.renderOptions={host:this},this._$Dt=void 0}createRenderRoot(){var i,t;const
|
|
23
|
+
var W,G;null==D||D(R,N),(null!==(y=globalThis.litHtmlVersions)&&void 0!==y?y:globalThis.litHtmlVersions=[]).push("2.2.6");class q extends u{constructor(){super(...arguments),this.renderOptions={host:this},this._$Dt=void 0}createRenderRoot(){var i,t;const n=super.createRenderRoot();return null!==(i=(t=this.renderOptions).renderBefore)&&void 0!==i||(t.renderBefore=n.firstChild),n}update(i){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(i),this._$Dt=((i,t,n)=>{var e,s;const o=null!==(e=null==n?void 0:n.renderBefore)&&void 0!==e?e:t;let r=o._$litPart$;if(void 0===r){const i=null!==(s=null==n?void 0:n.renderBefore)&&void 0!==s?s:null;o._$litPart$=r=new N(t.insertBefore($(),i),i,void 0,null!=n?n:{})}return r._$AI(i),r})(t,this.renderRoot,this.renderOptions)}connectedCallback(){var i;super.connectedCallback(),null===(i=this._$Dt)||void 0===i||i.setConnected(!0)}disconnectedCallback(){var i;super.disconnectedCallback(),null===(i=this._$Dt)||void 0===i||i.setConnected(!1)}render(){return j}}q.finalized=!0,q._$litElement$=!0,null===(W=globalThis.litElementHydrateSupport)||void 0===W||W.call(globalThis,{LitElement:q});const X=globalThis.litElementPolyfillSupport;null==X||X({LitElement:q}),(null!==(G=globalThis.litElementVersions)&&void 0!==G?G:globalThis.litElementVersions=[]).push("3.2.0");
|
|
24
24
|
/**
|
|
25
25
|
* @license
|
|
26
26
|
* Copyright 2017 Google LLC
|
|
27
27
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
28
28
|
*/
|
|
29
|
-
const Q=(i,t)=>"method"===t.kind&&t.descriptor&&!("value"in t.descriptor)?{...t,finisher(
|
|
29
|
+
const Q=(i,t)=>"method"===t.kind&&t.descriptor&&!("value"in t.descriptor)?{...t,finisher(n){n.createProperty(t.key,i)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:t.key,initializer(){"function"==typeof t.initializer&&(this[t.key]=t.initializer.call(this))},finisher(n){n.createProperty(t.key,i)}};
|
|
30
30
|
/**
|
|
31
31
|
* @license
|
|
32
32
|
* Copyright 2017 Google LLC
|
|
33
33
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
34
|
-
*/function Y(i){return(t,
|
|
34
|
+
*/function Y(i){return(t,n)=>void 0!==n?((i,t,n)=>{t.constructor.createProperty(n,i)})(i,t,n):Q(i,t)
|
|
35
35
|
/**
|
|
36
36
|
* @license
|
|
37
37
|
* Copyright 2017 Google LLC
|
|
@@ -47,16 +47,16 @@ const Q=(i,t)=>"method"===t.kind&&t.descriptor&&!("value"in t.descriptor)?{...t,
|
|
|
47
47
|
* Copyright 2017 Google LLC
|
|
48
48
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
49
49
|
*/
|
|
50
|
-
const
|
|
50
|
+
const ni=1;
|
|
51
51
|
/**
|
|
52
52
|
* @license
|
|
53
53
|
* Copyright 2018 Google LLC
|
|
54
54
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
55
55
|
*/
|
|
56
|
-
const
|
|
56
|
+
const ei=(i=>(...t)=>({_$litDirective$:i,values:t}))(class extends class{constructor(i){}get _$AU(){return this._$AM._$AU}_$AT(i,t,n){this._$Ct=i,this._$AM=t,this._$Ci=n}_$AS(i,t){return this.update(i,t)}update(i,t){return this.render(...t)}}{constructor(i){var t;if(super(i),i.type!==ni||"class"!==i.name||(null===(t=i.strings)||void 0===t?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 n,e;if(void 0===this.et){this.et=new Set,void 0!==i.strings&&(this.st=new Set(i.strings.join(" ").split(/\s/).filter((i=>""!==i))));for(const i in t)t[i]&&!(null===(n=this.st)||void 0===n?void 0:n.has(i))&&this.et.add(i);return this.render(t)}const s=i.element.classList;this.et.forEach((i=>{i in t||(s.remove(i),this.et.delete(i))}));for(const i in t){const n=!!t[i];n===this.et.has(i)||(null===(e=this.st)||void 0===e?void 0:e.has(i))||(n?(s.add(i),this.et.add(i)):(s.remove(i),this.et.delete(i)))}return j}}),si="snippyly-cursor",oi="snippyly-comments",ri="snippyly-comments-sidebar",li="snippyly-huddle",ai="snippyly-recorder-notes",di="enable-url-navigation",hi=(i,t,n=!1,e="localStorage")=>{try{const s=n?btoa(t):t;"localStorage"===e?localStorage.setItem(i,s):sessionStorage.setItem(i,s)}catch(i){console.warn("Error in setLocalStorage: ",i)}},ci=(i,t=!1,n="localStorage")=>{try{let e=null;return e="localStorage"===n?localStorage.getItem(i):sessionStorage.getItem(i),e&&t?atob(e):e}catch(i){return console.warn("Error in getLocalStorage: ",i),null}},pi=(i,t="localStorage")=>{try{"localStorage"===t?localStorage.removeItem(i):sessionStorage.removeItem(i)}catch(i){console.warn("Error in removeLocalStorageData: ",i)}},ui=(...i)=>{if(i)switch(i.length){case 1:return s`calc(${i[0]}rem * var(--snippyly-base-rem-unit, 1))`;case 2:return s`calc(${i[0]}rem * var(--snippyly-base-rem-unit, 1)) calc(${i[1]}rem * var(--snippyly-base-rem-unit, 1))`;case 3:return s`calc(${i[0]}rem * var(--snippyly-base-rem-unit, 1)) calc(${i[1]}rem * var(--snippyly-base-rem-unit, 1))
|
|
57
57
|
calc(${i[2]}rem * var(--snippyly-base-rem-unit, 1))`;case 4:return s`calc(${i[0]}rem * var(--snippyly-base-rem-unit, 1)) calc(${i[1]}rem * var(--snippyly-base-rem-unit, 1))
|
|
58
|
-
calc(${i[2]}rem * var(--snippyly-base-rem-unit, 1)) calc(${i[3]}rem * var(--snippyly-base-rem-unit, 1))`}return s`0`};var yi=function(i,t,e,n){for(var s,o=arguments.length,r=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,e):n,l=i.length-1;l>=0;l--)(s=i[l])&&(r=(o<3?s(r):o>3?s(t,e,r):s(t,e))||r);return o>3&&r&&Object.defineProperty(t,e,r),r};let vi=class extends q{constructor(){super(),this._loadPlugin=!1,this.comments=[],this.addCommentMode=!1,this._expanded=!0,this.staging=true,this.copyLinkTooltip="Copy Link",this.invalidApiKey=!1,this.isUserGlobalContact=!1,this.addWindowClickEventListener=()=>{try{this.windowClickEventListener||(this.windowClickEventListener=()=>{this.menuOpenedId&&(this.menuOpenedId=void 0)},window.addEventListener("click",this.windowClickEventListener))}catch(i){console.warn("Error in addWindowClickEventListener: ",i)}},this.removeWindowClickEventListener=()=>{try{window.removeEventListener("click",this.windowClickEventListener),this.windowClickEventListener=void 0}catch(i){console.warn("Error in removeWindowClickEventListener: ",i)}},this.setWindowEventListner=()=>{try{window.addEventListener("locationchange",(()=>{this.checkUrl()}))}catch(i){console.warn("Error in setWindowEventListner: ",i)}},this.urlChangeListener=()=>{try{const i=history.pushState;history.pushState=function(){const t=i.apply(this,arguments);return window.dispatchEvent(new Event("pushstate")),window.dispatchEvent(new Event("locationchange")),t};const t=history.replaceState;history.replaceState=function(){const i=t.apply(this,arguments);return window.dispatchEvent(new Event("replacestate")),window.dispatchEvent(new Event("locationchange")),i},window.addEventListener("popstate",(()=>{window.dispatchEvent(new Event("locationchange"))}))}catch(i){console.warn("Error in urlChangeListener: ",i)}},this.checkUrl=()=>{var i;try{const t=new URL(document.location),e=t.searchParams;if(e.has("snippyly_google_token")){const n=JSON.parse(atob(e.get("snippyly_google_token"))),s={},o=(null===(i=n.providerData)||void 0===i?void 0:i.length)?n.providerData[0]:null;s.userId=n.uid,s.name=n.displayName||(null==o?void 0:o.displayName),s.email=n.email||(null==o?void 0:o.email),s.photoUrl=(null==n?void 0:n.photoURL)||(null==o?void 0:o.photoURL),s.contacts=window.SNIPPYLY_USER_CONTACTS||[],di("snippyly-user",JSON.stringify(s),!0),e.delete("snippyly_google_token"),window.history.replaceState({},document.title,t.href)}e.has("review")?(di("review","true",!1,"sessionStorage"),"true"!==e.get("review")&&(e.delete("review"),e.append("review","true"),window.history.replaceState({},document.title,t.href)),this.loadPluginUI()):ci("review",!1,"sessionStorage")&&(e.append("review","true"),window.history.replaceState({},document.title,t.href),this.loadPluginUI()),this.setVersionInUrl()}catch(i){console.warn("Error in checkUrl: ",i)}},this.detectVersion=()=>{try{if(this.projectVersionKey){const i=new URL(document.location).searchParams;if(i.get(this.projectVersionKey))this.projectVersion=i.get(this.projectVersionKey);else if(window.snippylyInitialLoadUrl){const i=new URL(window.snippylyInitialLoadUrl).searchParams;i.get(this.projectVersionKey)&&(this.projectVersion=i.get(this.projectVersionKey))}this.projectVersion&&di("projectVersion",this.projectVersion,!1,"sessionStorage")}}catch(i){console.warn("Error in detectVersion: ",i)}},this.setVersionInUrl=()=>{try{const i=this.projectVersionKey||ci("projectVersionKey",!1,"sessionStorage"),t=this.projectVersion||ci("projectVersion",!1,"sessionStorage");if(i&&t){const e=new URL(document.location),n=e.searchParams;n.get(i)||(n.set(i,t),window.history.replaceState({},document.title,e.href))}}catch(i){console.warn("Error in setVersionInUrl: ",i)}},this.loadPluginUI=()=>{try{if(this.loadPlugin)return this.generateLocation(),void this.setViewMode(this.viewMode);if(this.loadPlugin=!0,!document.querySelector(oi)){const i=document.createElement(oi);null==i||i.addEventListener("signIn",(()=>{this.loginWithGoogle()})),window.document.body.appendChild(i)}if(!document.querySelector(ri)){const i=document.createElement(ri);i.setAttribute(ai,"true"),window.document.body.appendChild(i)}if(!document.querySelector(si)){const i=document.createElement(si);window.document.body.appendChild(i)}if(!document.querySelector(li)){const i=document.createElement(li);window.document.body.appendChild(i)}if(!document.querySelector(hi)){const i=document.createElement(hi);window.document.body.appendChild(i)}((i="",t=!1,e)=>{if(console.log("load snippyly called"),document.getElementById("snippylyScript"))e&&e();else{const n=document.createElement("script");n.src=`https://cdn.jsdelivr.net/npm/@snippyly/sdk${t?"-staging":""}${i?"@"+i:""}/snippyly.js`,n.id="snippylyScript",n.type="module",document.body.appendChild(n),n.onload=()=>{e&&e()}}})(void 0,this.staging,(()=>{window.Snippyly&&this.initializeSnippyly()}))}catch(i){console.warn("Error in loadPluginUI: ",i)}},this.initializeSnippyly=async()=>{try{await(null===Snippyly||void 0===Snippyly?void 0:Snippyly.init(this.apiKey)),this.documentId=((i,t=0)=>{try{let e=3735928559^t,n=1103547991^t;for(let t,s=0;s<i.length;s++)t=i.charCodeAt(s),e=Math.imul(e^t,2654435761),n=Math.imul(n^t,1597334677);return e=Math.imul(e^e>>>16,2246822507)^Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507)^Math.imul(e^e>>>13,3266489909),4294967296*(2097151&n)+(e>>>0)}catch(i){return console.warn("Error in cyrb53: ",i),0}})((i=>{let t;return t=i.includes("http")?new URL(i):new URL("http://"+i),t.hostname.replace("www.","")})(window.location.origin))+"",null===Snippyly||void 0===Snippyly||Snippyly.setDocumentId(this.documentId+""),this.generateLocation(),this.setLocation(),this.commentElement=null===Snippyly||void 0===Snippyly?void 0:Snippyly.getCommentElement(),this.commentElement&&(this.commentElement.enableTextComments(!0),this.commentElement.enableSignInButton(!0),this.commentElement.enableAttachment(!0),this.commentElement.showScreenSizeInfo(!0),this.commentElement.addCommentModeChange&&this.commentElement.addCommentModeChange().subscribe((i=>{this.addCommentMode=i}))),this.selectionElement=Snippyly.getSelectionElement(),this.selectionElement&&this.selectionElement.enableLiveSelection(!0),this.identifySnippyly()}catch(i){console.warn("Error in initializeSnippyly: ",i)}},this.generateLocation=()=>{try{const i=new URL(document.location).searchParams,t=new URL(document.location);t.searchParams.delete("review"),t.searchParams.delete("sreviewId"),t.searchParams.delete("scommentId");const e=i.get("sversion")||this.projectVersion;this.location={url:t.href,version:e}}catch(i){console.warn("Error in generateLocation: ",i)}},this.setLocation=()=>{try{window.Snippyly&&(null===Snippyly||void 0===Snippyly?void 0:Snippyly.setLocation)&&(null===Snippyly||void 0===Snippyly||Snippyly.setLocation(JSON.parse(JSON.stringify(this.location))))}catch(i){console.warn("Error in setLocation: ",i)}},this.identifySnippyly=async()=>{var i;try{this.invalidApiKey=!1;let i={name:"Anonymous User",email:"anonymous@snippyly.com",userId:"anonymous",isAnonymous:!0};if(ci("snippyly-user",!0)){const t=JSON.parse(ci("snippyly-user",!0));(null==t?void 0:t.email)&&(i=t)}i.contacts=window.SNIPPYLY_USER_CONTACTS||[],i.isAnonymous?delete i.groupId:i.groupId=Snippyly.getDocumentId()+"",await Snippyly.identify(i),(null==i?void 0:i.isAnonymous)||(this.snippylyUser=JSON.parse(JSON.stringify(i))),this.getComments(),this.checkGlobalUserContact()}catch(t){t&&"string"==typeof t&&(null===(i=null==t?void 0:t.toLowerCase())||void 0===i?void 0:i.includes("invalid"))&&(this.invalidApiKey=!0),console.warn("Error in identifySnippyly: ",t)}},this.getComments=()=>{try{this.commentElement&&(this.commentSubscription&&this.commentSubscription.unsubscribe(),this.commentSubscription=this.commentElement.getAllCommentAnnotations(this.documentId).subscribe((i=>{this.comments=i,"All"!==this.viewMode&&(this.viewMode?this.comments=i.filter((i=>{var t;return(null===(t=null==i?void 0:i.location)||void 0===t?void 0:t.view)===this.viewMode})):this.comments=this.comments.filter((i=>{var t;return!(null===(t=null==i?void 0:i.location)||void 0===t?void 0:t.view)})))})))}catch(i){console.warn("Error in getComments: ",i)}},this.checkGlobalUserContact=()=>{try{this.commentElement&&this.commentElement.isUserGlobalContact().subscribe((i=>{!this.isUserGlobalContact&&i&&this.setViewMode("All"),this.isUserGlobalContact=i,i||this.setViewMode(null)}))}catch(i){console.warn("Error in checkGlobalUserContact: ",i)}},this.toggleCommentSidebar=()=>{try{this.commentElement&&this.commentElement.toggleCommentSidebar()}catch(i){console.warn("Error in toggleCommentSidebar: ",i)}},this.toggleSnippylyPluginToolbar=()=>{try{this.expanded=!this.expanded}catch(i){console.warn("Error in toggleSnippylyPluginToolbar: ",i)}},this.loginWithGoogle=()=>{try{window.open(`https://snippyly-login-staging.web.app/?redirect_url=${encodeURIComponent(window.location.href)}`,"_self")}catch(i){console.warn("Error in loginWithGoogle: ",i)}},this.removeSnippyly=async()=>{try{pi("review","sessionStorage"),pi("sreviewId","sessionStorage"),pi("projectVersionKey","sessionStorage"),pi("projectVersion","sessionStorage");const i=new URL(document.location),t=i.searchParams;t.delete("sreviewId"),t.delete("review"),this.projectVersionKey&&t.delete(this.projectVersionKey),this.projectVersion=void 0,this.projectVersionKey=void 0,delete window.snippylyInitialLoadUrl,window.history.replaceState({},document.title,i.href),window.location.reload()}catch(i){console.warn("Error in removeSnippyly: ",i)}},this.signOutUser=async()=>{try{await Snippyly.signOutUser(),pi("snippyly-user"),this.snippylyUser=void 0,window.open(`https://snippyly-login-staging.web.app/?signout=true&redirect_url=${encodeURIComponent(window.location.href)}`,"_self")}catch(i){console.warn("Error in signOutUser: ",i)}},this.toggleMenu=(i,t)=>{try{i.stopPropagation(),this.menuOpenedId===t?this.menuOpenedId=void 0:this.menuOpenedId=t}catch(i){console.warn("Error in toggleMenu: ",i)}},this.copyLink=()=>{try{navigator.clipboard.writeText(window.location.href),this.copyLinkTooltip="Link copied!",setTimeout((()=>{this.copyLinkTooltip="Copy Link"}),2e3)}catch(i){console.warn("Error in copyLink: ",i)}},this.setViewMode=i=>{try{this.viewMode=i,i?this.location.view=i:delete this.location.view,this.setLocation(),this.getComments()}catch(i){console.warn("Error in setViewMode: ",i)}},this.setAttribute("snippyly-comment-disabled","true");try{this.expanded=!0,this.detectVersion(),this.setWindowEventListner(),this.urlChangeListener(),this.checkUrl(),console.log("*** Staging Mode ON! ***")}catch(i){console.warn("Error in constructor: ",i)}}get loadPlugin(){return this._loadPlugin}set loadPlugin(i){this._loadPlugin=i,this.loadPlugin?this.classList.add("visible"):this.classList.remove("visible")}get expanded(){return this._expanded}set expanded(i){this._expanded=i,this.expanded?this.classList.add("expanded"):this.classList.remove("expanded")}get projectVersionKey(){return this._projectVersionKey}set projectVersionKey(i){try{this._projectVersionKey=i,this.projectVersionKey&&di("projectVersionKey",this.projectVersionKey,!1,"sessionStorage"),this.detectVersion()}catch(i){console.warn("Error in set projectVersionKey: ",i)}}get menuOpenedId(){return this._menuOpenedId}set menuOpenedId(i){this._menuOpenedId=i,this.menuOpenedId?this.addWindowClickEventListener():this.removeWindowClickEventListener()}render(){var i,t,e,n,s,o,r,l,h,a,d,c,p,u;return this.loadPlugin?U`
|
|
59
|
-
<div class="snippyly-plugin-container ${
|
|
58
|
+
calc(${i[2]}rem * var(--snippyly-base-rem-unit, 1)) calc(${i[3]}rem * var(--snippyly-base-rem-unit, 1))`}return s`0`};var yi=function(i,t,n,e){for(var s,o=arguments.length,r=o<3?t:null===e?e=Object.getOwnPropertyDescriptor(t,n):e,l=i.length-1;l>=0;l--)(s=i[l])&&(r=(o<3?s(r):o>3?s(t,n,r):s(t,n))||r);return o>3&&r&&Object.defineProperty(t,n,r),r};let vi=class extends q{constructor(){super(),this._loadPlugin=!1,this.comments=[],this.addCommentMode=!1,this._expanded=!0,this.staging=true,this.copyLinkTooltip="Copy Link",this.invalidApiKey=!1,this.isUserGlobalContact=!1,this.addWindowClickEventListener=()=>{try{this.windowClickEventListener||(this.windowClickEventListener=()=>{this.menuOpenedId&&(this.menuOpenedId=void 0)},window.addEventListener("click",this.windowClickEventListener))}catch(i){console.warn("Error in addWindowClickEventListener: ",i)}},this.removeWindowClickEventListener=()=>{try{window.removeEventListener("click",this.windowClickEventListener),this.windowClickEventListener=void 0}catch(i){console.warn("Error in removeWindowClickEventListener: ",i)}},this.setWindowEventListner=()=>{try{window.addEventListener("locationchange",(()=>{this.checkUrl()}))}catch(i){console.warn("Error in setWindowEventListner: ",i)}},this.urlChangeListener=()=>{try{const i=history.pushState;history.pushState=function(){const t=i.apply(this,arguments);return window.dispatchEvent(new Event("pushstate")),window.dispatchEvent(new Event("locationchange")),t};const t=history.replaceState;history.replaceState=function(){const i=t.apply(this,arguments);return window.dispatchEvent(new Event("replacestate")),window.dispatchEvent(new Event("locationchange")),i},window.addEventListener("popstate",(()=>{window.dispatchEvent(new Event("locationchange"))}))}catch(i){console.warn("Error in urlChangeListener: ",i)}},this.checkUrl=()=>{var i;try{const t=new URL(document.location),n=t.searchParams;if(n.has("snippyly_google_token")){const e=JSON.parse(atob(n.get("snippyly_google_token"))),s={},o=(null===(i=e.providerData)||void 0===i?void 0:i.length)?e.providerData[0]:null;s.userId=e.uid,s.name=e.displayName||(null==o?void 0:o.displayName),s.email=e.email||(null==o?void 0:o.email),s.photoUrl=(null==e?void 0:e.photoURL)||(null==o?void 0:o.photoURL),s.contacts=window.SNIPPYLY_USER_CONTACTS||[],hi("snippyly-user",JSON.stringify(s),!0),n.delete("snippyly_google_token"),window.history.replaceState({},document.title,t.href)}n.has("review")?(hi("review","true",!1,"sessionStorage"),"true"!==n.get("review")&&(n.delete("review"),n.append("review","true"),window.history.replaceState({},document.title,t.href)),this.loadPluginUI()):ci("review",!1,"sessionStorage")&&(n.append("review","true"),window.history.replaceState({},document.title,t.href),this.loadPluginUI()),this.setVersionInUrl()}catch(i){console.warn("Error in checkUrl: ",i)}},this.detectVersion=()=>{try{if(this.projectVersionKey){const i=new URL(document.location).searchParams;if(i.get(this.projectVersionKey))this.projectVersion=i.get(this.projectVersionKey);else if(window.snippylyInitialLoadUrl){const i=new URL(window.snippylyInitialLoadUrl).searchParams;i.get(this.projectVersionKey)&&(this.projectVersion=i.get(this.projectVersionKey))}this.projectVersion&&hi("projectVersion",this.projectVersion,!1,"sessionStorage")}}catch(i){console.warn("Error in detectVersion: ",i)}},this.setVersionInUrl=()=>{try{const i=this.projectVersionKey||ci("projectVersionKey",!1,"sessionStorage"),t=this.projectVersion||ci("projectVersion",!1,"sessionStorage");if(i&&t){const n=new URL(document.location),e=n.searchParams;e.get(i)||(e.set(i,t),window.history.replaceState({},document.title,n.href))}}catch(i){console.warn("Error in setVersionInUrl: ",i)}},this.loadPluginUI=()=>{try{if(this.loadPlugin)return this.generateLocation(),void this.setViewMode(this.viewMode);if(this.loadPlugin=!0,!document.querySelector(oi)){const i=document.createElement(oi);null==i||i.addEventListener("signIn",(()=>{this.loginWithGoogle()})),window.document.body.appendChild(i)}if(!document.querySelector(ri)){const i=document.createElement(ri);i.setAttribute(di,"true"),window.document.body.appendChild(i)}if(!document.querySelector(si)){const i=document.createElement(si);window.document.body.appendChild(i)}if(!document.querySelector(li)){const i=document.createElement(li);window.document.body.appendChild(i)}if(!document.querySelector(ai)){const i=document.createElement(ai);window.document.body.appendChild(i)}((i="",t=!1,n)=>{if(console.log("load snippyly called"),document.getElementById("snippylyScript"))n&&n();else{const e=document.createElement("script");e.src=`https://cdn.jsdelivr.net/npm/@snippyly/sdk${t?"-staging":""}${i?"@"+i:""}/snippyly.js`,e.id="snippylyScript",e.type="module",document.body.appendChild(e),e.onload=()=>{n&&n()}}})(void 0,this.staging,(()=>{window.Snippyly&&this.initializeSnippyly()}))}catch(i){console.warn("Error in loadPluginUI: ",i)}},this.initializeSnippyly=async()=>{try{await(null===Snippyly||void 0===Snippyly?void 0:Snippyly.init(this.apiKey)),this.documentId=((i,t=0)=>{try{let n=3735928559^t,e=1103547991^t;for(let t,s=0;s<i.length;s++)t=i.charCodeAt(s),n=Math.imul(n^t,2654435761),e=Math.imul(e^t,1597334677);return n=Math.imul(n^n>>>16,2246822507)^Math.imul(e^e>>>13,3266489909),e=Math.imul(e^e>>>16,2246822507)^Math.imul(n^n>>>13,3266489909),4294967296*(2097151&e)+(n>>>0)}catch(i){return console.warn("Error in cyrb53: ",i),0}})((i=>{let t;return t=i.includes("http")?new URL(i):new URL("http://"+i),t.hostname.replace("www.","")})(window.location.origin))+"",null===Snippyly||void 0===Snippyly||Snippyly.setDocumentId(this.documentId+""),this.generateLocation(),this.setLocation(),this.commentElement=null===Snippyly||void 0===Snippyly?void 0:Snippyly.getCommentElement(),this.commentElement&&(this.commentElement.enableTextComments(!0),this.commentElement.enableSignInButton(!0),this.commentElement.enableAttachment(!0),this.commentElement.showScreenSizeInfo(!0),this.commentElement.addCommentModeChange&&this.commentElement.addCommentModeChange().subscribe((i=>{this.addCommentMode=i}))),this.selectionElement=Snippyly.getSelectionElement(),this.selectionElement&&this.selectionElement.enableLiveSelection(!0),this.identifySnippyly()}catch(i){console.warn("Error in initializeSnippyly: ",i)}},this.generateLocation=()=>{try{const i=new URL(document.location).searchParams,t=new URL(document.location);t.searchParams.delete("review"),t.searchParams.delete("sreviewId"),t.searchParams.delete("scommentId");const n=i.get("sversion")||this.projectVersion;this.location={url:t.href,version:n}}catch(i){console.warn("Error in generateLocation: ",i)}},this.setLocation=()=>{try{window.Snippyly&&(null===Snippyly||void 0===Snippyly?void 0:Snippyly.setLocation)&&(null===Snippyly||void 0===Snippyly||Snippyly.setLocation(JSON.parse(JSON.stringify(this.location))))}catch(i){console.warn("Error in setLocation: ",i)}},this.identifySnippyly=async()=>{var i;try{this.invalidApiKey=!1;let i={name:"Anonymous User",email:"anonymous@snippyly.com",userId:"anonymous",isAnonymous:!0};if(ci("snippyly-user",!0)){const t=JSON.parse(ci("snippyly-user",!0));(null==t?void 0:t.email)&&(i=t)}i.contacts=window.SNIPPYLY_USER_CONTACTS||[],i.isAnonymous?delete i.groupId:i.groupId=Snippyly.getDocumentId()+"",await Snippyly.identify(i),(null==i?void 0:i.isAnonymous)||(this.snippylyUser=JSON.parse(JSON.stringify(i))),this.getComments(),this.checkGlobalUserContact()}catch(t){t&&"string"==typeof t&&(null===(i=null==t?void 0:t.toLowerCase())||void 0===i?void 0:i.includes("invalid"))&&(this.invalidApiKey=!0),console.warn("Error in identifySnippyly: ",t)}},this.getComments=()=>{try{this.commentElement&&(this.commentSubscription&&this.commentSubscription.unsubscribe(),this.commentSubscription=this.commentElement.getAllCommentAnnotations(this.documentId).subscribe((i=>{this.comments=i,"All"!==this.viewMode&&(this.viewMode?this.comments=i.filter((i=>{var t;return(null===(t=null==i?void 0:i.location)||void 0===t?void 0:t.view)===this.viewMode})):this.comments=this.comments.filter((i=>{var t;return!(null===(t=null==i?void 0:i.location)||void 0===t?void 0:t.view)})))})))}catch(i){console.warn("Error in getComments: ",i)}},this.checkGlobalUserContact=()=>{try{this.commentElement&&this.commentElement.isUserGlobalContact().subscribe((i=>{!this.isUserGlobalContact&&i&&this.setViewMode("All"),this.isUserGlobalContact=i,i||this.setViewMode(null)}))}catch(i){console.warn("Error in checkGlobalUserContact: ",i)}},this.toggleCommentSidebar=()=>{try{this.commentElement&&this.commentElement.toggleCommentSidebar()}catch(i){console.warn("Error in toggleCommentSidebar: ",i)}},this.toggleSnippylyPluginToolbar=()=>{try{this.expanded=!this.expanded}catch(i){console.warn("Error in toggleSnippylyPluginToolbar: ",i)}},this.loginWithGoogle=()=>{try{window.open(`https://snippyly-login-staging.web.app/?redirect_url=${encodeURIComponent(window.location.href)}`,"_self")}catch(i){console.warn("Error in loginWithGoogle: ",i)}},this.removeSnippyly=async()=>{try{pi("review","sessionStorage"),pi("sreviewId","sessionStorage"),pi("projectVersionKey","sessionStorage"),pi("projectVersion","sessionStorage");const i=new URL(document.location),t=i.searchParams;t.delete("sreviewId"),t.delete("review"),this.projectVersionKey&&t.delete(this.projectVersionKey),this.projectVersion=void 0,this.projectVersionKey=void 0,delete window.snippylyInitialLoadUrl,window.history.replaceState({},document.title,i.href),window.location.reload()}catch(i){console.warn("Error in removeSnippyly: ",i)}},this.signOutUser=async()=>{try{await Snippyly.signOutUser(),pi("snippyly-user"),this.snippylyUser=void 0,window.open(`https://snippyly-login-staging.web.app/?signout=true&redirect_url=${encodeURIComponent(window.location.href)}`,"_self")}catch(i){console.warn("Error in signOutUser: ",i)}},this.toggleMenu=(i,t)=>{try{i.stopPropagation(),this.menuOpenedId===t?this.menuOpenedId=void 0:this.menuOpenedId=t}catch(i){console.warn("Error in toggleMenu: ",i)}},this.copyLink=()=>{try{navigator.clipboard.writeText(window.location.href),this.copyLinkTooltip="Link copied!",setTimeout((()=>{this.copyLinkTooltip="Copy Link"}),2e3)}catch(i){console.warn("Error in copyLink: ",i)}},this.setViewMode=i=>{try{this.viewMode=i,i?this.location.view=i:delete this.location.view,this.setLocation(),this.getComments()}catch(i){console.warn("Error in setViewMode: ",i)}},this.setAttribute("snippyly-comment-disabled","true");try{this.expanded=!0,this.detectVersion(),this.setWindowEventListner(),this.urlChangeListener(),this.checkUrl(),console.log("*** Staging Mode ON! ***")}catch(i){console.warn("Error in constructor: ",i)}}get loadPlugin(){return this._loadPlugin}set loadPlugin(i){this._loadPlugin=i,this.loadPlugin?this.classList.add("visible"):this.classList.remove("visible")}get expanded(){return this._expanded}set expanded(i){this._expanded=i,this.expanded?this.classList.add("expanded"):this.classList.remove("expanded")}get projectVersionKey(){return this._projectVersionKey}set projectVersionKey(i){try{this._projectVersionKey=i,this.projectVersionKey&&hi("projectVersionKey",this.projectVersionKey,!1,"sessionStorage"),this.detectVersion()}catch(i){console.warn("Error in set projectVersionKey: ",i)}}get menuOpenedId(){return this._menuOpenedId}set menuOpenedId(i){this._menuOpenedId=i,this.menuOpenedId?this.addWindowClickEventListener():this.removeWindowClickEventListener()}render(){var i,t,n,e,s,o,r,l,a,d,h,c,p,u,y;return this.loadPlugin?U`
|
|
59
|
+
<div class="snippyly-plugin-container ${ei({expanded:this.expanded,active:null===(i=this.snippylyUser)||void 0===i?void 0:i.userId,"comment-mode-enabled":this.addCommentMode})}">
|
|
60
60
|
<div class="snippyly-logo-container snippyly-menu-trigger" @click=${()=>this.toggleSnippylyPluginToolbar()}>
|
|
61
61
|
${this.expanded?null:U`
|
|
62
62
|
<svg width="8" height="5" viewBox="0 0 8 5" fill="none" xmlns="http://www.w3.org/2000/svg" class="arrow-icon">
|
|
@@ -91,8 +91,7 @@ const ni=(i=>(...t)=>({_$litDirective$:i,values:t}))(class extends class{constru
|
|
|
91
91
|
<div class="menu-item">${this.expanded?"Hide Toolbar":"Show Toolbar"}</div>
|
|
92
92
|
</div>
|
|
93
93
|
</div>
|
|
94
|
-
|
|
95
|
-
<div class="snippyly-comment-tool-container snippyly-menu-trigger ${ni({disabled:!(null===(t=this.snippylyUser)||void 0===t?void 0:t.userId)})}">
|
|
94
|
+
<div class="snippyly-comment-tool-container snippyly-menu-trigger ${ei({disabled:!(null===(t=this.snippylyUser)||void 0===t?void 0:t.userId)})}">
|
|
96
95
|
<snippyly-comment-tool class="custom-tool">
|
|
97
96
|
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
98
97
|
<path
|
|
@@ -101,10 +100,10 @@ const ni=(i=>(...t)=>({_$litDirective$:i,values:t}))(class extends class{constru
|
|
|
101
100
|
</svg>
|
|
102
101
|
</snippyly-comment-tool>
|
|
103
102
|
<div class="snippyly-menu snippyly-tooltip">
|
|
104
|
-
<div class="menu-item">${this.invalidApiKey?"API key is Invalid":(null===(
|
|
103
|
+
<div class="menu-item">${this.invalidApiKey?"API key is Invalid":(null===(n=this.snippylyUser)||void 0===n?void 0:n.userId)?"Add comments":"Sign in to add comments"}</div>
|
|
105
104
|
</div>
|
|
106
105
|
</div>
|
|
107
|
-
${this.isUserGlobalContact||(null===(
|
|
106
|
+
${this.isUserGlobalContact||(null===(e=this.comments)||void 0===e?void 0:e.length)?U`
|
|
108
107
|
<div class="snippyly-comments-container snippyly-menu-trigger">
|
|
109
108
|
<div class="comment-counter" @click=${()=>this.toggleCommentSidebar()}>
|
|
110
109
|
${null===(s=this.comments)||void 0===s?void 0:s.length} ${1===(null===(o=this.comments)||void 0===o?void 0:o.length)?"Comment":"Comments"}
|
|
@@ -115,7 +114,7 @@ const ni=(i=>(...t)=>({_$litDirective$:i,values:t}))(class extends class{constru
|
|
|
115
114
|
</div>
|
|
116
115
|
`:null}
|
|
117
116
|
${this.isUserGlobalContact?U`
|
|
118
|
-
<div class="snippyly-menu-container snippyly-menu-trigger ${
|
|
117
|
+
<div class="snippyly-menu-container snippyly-menu-trigger ${ei({opened:"viewModeMenu"===this.menuOpenedId})}" id="viewModeMenu" @click=${i=>this.toggleMenu(i,"viewModeMenu")}>
|
|
119
118
|
<div class="comment-counter">
|
|
120
119
|
View: ${this.viewMode||"External"}
|
|
121
120
|
</div>
|
|
@@ -130,13 +129,15 @@ const ni=(i=>(...t)=>({_$litDirective$:i,values:t}))(class extends class{constru
|
|
|
130
129
|
<div class="snippyly-presence-container snippyly-menu-trigger">
|
|
131
130
|
<snippyly-presence max-users="4"></snippyly-presence>
|
|
132
131
|
</div>
|
|
133
|
-
<div class="snippyly-presence-container snippyly-menu-trigger">
|
|
134
|
-
<snippyly-recorder-tool type="all"></snippyly-recorder-tool>
|
|
135
|
-
</div>
|
|
136
|
-
<div class="snippyly-presence-container snippyly-menu-trigger">
|
|
137
|
-
<snippyly-huddle-tool type="all"></snippyly-huddle-tool>
|
|
138
|
-
</div>
|
|
139
132
|
${(null===(r=this.snippylyUser)||void 0===r?void 0:r.userId)?U`
|
|
133
|
+
<div class="snippyly-presence-container snippyly-menu-trigger">
|
|
134
|
+
<snippyly-recorder-tool type="all"></snippyly-recorder-tool>
|
|
135
|
+
</div>
|
|
136
|
+
<div class="snippyly-presence-container snippyly-menu-trigger">
|
|
137
|
+
<snippyly-huddle-tool type="all"></snippyly-huddle-tool>
|
|
138
|
+
</div>
|
|
139
|
+
`:null}
|
|
140
|
+
${(null===(l=this.snippylyUser)||void 0===l?void 0:l.userId)?U`
|
|
140
141
|
<div class="snippyly-share-container snippyly-menu-trigger" @click=${()=>this.copyLink()}>
|
|
141
142
|
<button class="snippyly-btn snippyly-primary-btn signin-btn">
|
|
142
143
|
Share
|
|
@@ -146,20 +147,19 @@ const ni=(i=>(...t)=>({_$litDirective$:i,values:t}))(class extends class{constru
|
|
|
146
147
|
</div>
|
|
147
148
|
</div>
|
|
148
149
|
`:null}
|
|
149
|
-
${(null===(
|
|
150
|
+
${(null===(a=this.snippylyUser)||void 0===a?void 0:a.userId)?null:U`
|
|
150
151
|
<div class="snippyly-signin-container snippyly-menu-trigger">
|
|
151
152
|
<button class="snippyly-btn snippyly-primary-btn signin-btn" @click=${()=>this.loginWithGoogle()}>
|
|
152
153
|
Sign in
|
|
153
154
|
</button>
|
|
154
155
|
</div>
|
|
155
156
|
`}
|
|
156
|
-
`:null}
|
|
157
157
|
|
|
158
|
-
<div class="snippyly-menu-container snippyly-menu-trigger ${
|
|
159
|
-
${this.expanded&&this.snippylyUser?(null===(
|
|
160
|
-
<img src=${null===(
|
|
158
|
+
<div class="snippyly-menu-container snippyly-menu-trigger ${ei({opened:"userMenu"===this.menuOpenedId})}" id="userMenu" @click=${i=>this.toggleMenu(i,"userMenu")}>
|
|
159
|
+
${this.expanded&&this.snippylyUser?(null===(d=this.snippylyUser)||void 0===d?void 0:d.photoUrl)?U`
|
|
160
|
+
<img src=${null===(h=this.snippylyUser)||void 0===h?void 0:h.photoUrl} class="profile-img" referrerpolicy="no-referrer" title=${null===(c=this.snippylyUser)||void 0===c?void 0:c.name} />
|
|
161
161
|
`:U`
|
|
162
|
-
<div class="profile-initial"><span>${(null===(
|
|
162
|
+
<div class="profile-initial"><span>${(null===(u=null===(p=this.snippylyUser)||void 0===p?void 0:p.name)||void 0===u?void 0:u.charAt(0))||"-"}</span></div>
|
|
163
163
|
`:null}
|
|
164
164
|
<svg width="4" height="14" viewBox="0 0 4 14" fill="none" xmlns="http://www.w3.org/2000/svg"
|
|
165
165
|
class="more-menu-icon">
|
|
@@ -170,7 +170,7 @@ const ni=(i=>(...t)=>({_$litDirective$:i,values:t}))(class extends class{constru
|
|
|
170
170
|
<div class="snippyly-menu">
|
|
171
171
|
<div class="menu-item" @click=${()=>this.toggleSnippylyPluginToolbar()}>${this.expanded?"Hide Toolbar":"Show Toolbar"}</div>
|
|
172
172
|
<div class="menu-item" @click=${()=>this.removeSnippyly()}>Exit Review Mode</div>
|
|
173
|
-
${(null===(
|
|
173
|
+
${(null===(y=this.snippylyUser)||void 0===y?void 0:y.userId)?U`
|
|
174
174
|
<div class="menu-item-divider"></div>
|
|
175
175
|
<div class="menu-item" @click=${()=>this.signOutUser()}>Sign out</div>
|
|
176
176
|
`:null}
|
|
@@ -490,4 +490,14 @@ const ni=(i=>(...t)=>({_$litDirective$:i,values:t}))(class extends class{constru
|
|
|
490
490
|
display: flex;
|
|
491
491
|
align-items: center;
|
|
492
492
|
}
|
|
493
|
-
|
|
493
|
+
|
|
494
|
+
.snippyly-plugin-container:not(.expanded) .snippyly-comment-tool-container,
|
|
495
|
+
.snippyly-plugin-container:not(.expanded) .snippyly-comments-container,
|
|
496
|
+
.snippyly-plugin-container:not(.expanded) #viewModeMenu,
|
|
497
|
+
.snippyly-plugin-container:not(.expanded) .spacer,
|
|
498
|
+
.snippyly-plugin-container:not(.expanded) .snippyly-presence-container,
|
|
499
|
+
.snippyly-plugin-container:not(.expanded) .snippyly-share-container,
|
|
500
|
+
.snippyly-plugin-container:not(.expanded) .snippyly-signin-container {
|
|
501
|
+
display: none;
|
|
502
|
+
}
|
|
503
|
+
`,yi([ii()],vi.prototype,"loadPlugin",null),yi([ii()],vi.prototype,"comments",void 0),yi([ii()],vi.prototype,"commentElement",void 0),yi([ii()],vi.prototype,"commentSubscription",void 0),yi([ii()],vi.prototype,"selectionElement",void 0),yi([ii()],vi.prototype,"addCommentMode",void 0),yi([ii()],vi.prototype,"_expanded",void 0),yi([ii()],vi.prototype,"snippylyUser",void 0),yi([Y()],vi.prototype,"apiKey",void 0),yi([ii()],vi.prototype,"staging",void 0),yi([Y()],vi.prototype,"projectVersionKey",null),yi([ii()],vi.prototype,"projectVersion",void 0),yi([ii()],vi.prototype,"_menuOpenedId",void 0),yi([ii()],vi.prototype,"copyLinkTooltip",void 0),yi([ii()],vi.prototype,"invalidApiKey",void 0),yi([ii()],vi.prototype,"documentId",void 0),yi([ii()],vi.prototype,"isUserGlobalContact",void 0),yi([ii()],vi.prototype,"location",void 0),yi([ii()],vi.prototype,"viewMode",void 0),vi=yi([(i=>t=>"function"==typeof t?((i,t)=>(window.customElements.define(i,t),t))(i,t):((i,t)=>{const{kind:n,elements:e}=t;return{kind:n,elements:e,finisher(t){window.customElements.define(i,t)}}})(i,t))("snippyly-plugin")],vi);export{vi as SnippylyPlugin};
|