@snippyly/plugin-staging 1.0.1 → 1.0.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snippyly/plugin-staging",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "",
5
5
  "main": "snippyly.js",
6
6
  "scripts": {
package/snippyly.js ADDED
@@ -0,0 +1,333 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2019 Google LLC
4
+ * SPDX-License-Identifier: BSD-3-Clause
5
+ */
6
+ const t=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),s=new Map;class e{constructor(t,s){if(this._$cssResult$=!0,s!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t}get styleSheet(){let i=s.get(this.cssText);return t&&void 0===i&&(s.set(this.cssText,i=new CSSStyleSheet),i.replaceSync(this.cssText)),i}toString(){return this.cssText}}const n=t?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let s="";for(const i of t.cssRules)s+=i.cssText;return(t=>new e("string"==typeof t?t:t+"",i))(s)})(t):t
7
+ /**
8
+ * @license
9
+ * Copyright 2017 Google LLC
10
+ * SPDX-License-Identifier: BSD-3-Clause
11
+ */;var o;const l=window.trustedTypes,r=l?l.emptyScript:"",h=window.reactiveElementPolyfillSupport,a={toAttribute(t,i){switch(i){case Boolean:t=t?r:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,i){let s=t;switch(i){case Boolean:s=null!==t;break;case Number:s=null===t?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch(t){s=null}}return s}},d=(t,i)=>i!==t&&(i==i||t==t),c={attribute:!0,type:String,converter:a,reflect:!1,hasChanged:d};class p extends HTMLElement{constructor(){super(),this._$Et=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Ei=null,this.o()}static addInitializer(t){var i;null!==(i=this.l)&&void 0!==i||(this.l=[]),this.l.push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((i,s)=>{const e=this._$Eh(s,i);void 0!==e&&(this._$Eu.set(e,s),t.push(e))})),t}static createProperty(t,i=c){if(i.state&&(i.attribute=!1),this.finalize(),this.elementProperties.set(t,i),!i.noAccessor&&!this.prototype.hasOwnProperty(t)){const s="symbol"==typeof t?Symbol():"__"+t,e=this.getPropertyDescriptor(t,s,i);void 0!==e&&Object.defineProperty(this.prototype,t,e)}}static getPropertyDescriptor(t,i,s){return{get(){return this[i]},set(e){const n=this[t];this[i]=e,this.requestUpdate(t,n,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||c}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),this.elementProperties=new Map(t.elementProperties),this._$Eu=new Map,this.hasOwnProperty("properties")){const t=this.properties,i=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const s of i)this.createProperty(s,t[s])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const i=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const t of s)i.unshift(n(t))}else void 0!==t&&i.push(n(t));return i}static _$Eh(t,i){const s=i.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof t?t.toLowerCase():void 0}o(){var t;this._$Ep=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Em(),this.requestUpdate(),null===(t=this.constructor.l)||void 0===t||t.forEach((t=>t(this)))}addController(t){var i,s;(null!==(i=this._$Eg)&&void 0!==i?i:this._$Eg=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(s=t.hostConnected)||void 0===s||s.call(t))}removeController(t){var i;null===(i=this._$Eg)||void 0===i||i.splice(this._$Eg.indexOf(t)>>>0,1)}_$Em(){this.constructor.elementProperties.forEach(((t,i)=>{this.hasOwnProperty(i)&&(this._$Et.set(i,this[i]),delete this[i])}))}createRenderRoot(){var i;const s=null!==(i=this.shadowRoot)&&void 0!==i?i:this.attachShadow(this.constructor.shadowRootOptions);return((i,s)=>{t?i.adoptedStyleSheets=s.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):s.forEach((t=>{const s=document.createElement("style"),e=window.litNonce;void 0!==e&&s.setAttribute("nonce",e),s.textContent=t.cssText,i.appendChild(s)}))})(s,this.constructor.elementStyles),s}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$Eg)||void 0===t||t.forEach((t=>{var i;return null===(i=t.hostConnected)||void 0===i?void 0:i.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$Eg)||void 0===t||t.forEach((t=>{var i;return null===(i=t.hostDisconnected)||void 0===i?void 0:i.call(t)}))}attributeChangedCallback(t,i,s){this._$AK(t,s)}_$ES(t,i,s=c){var e,n;const o=this.constructor._$Eh(t,s);if(void 0!==o&&!0===s.reflect){const l=(null!==(n=null===(e=s.converter)||void 0===e?void 0:e.toAttribute)&&void 0!==n?n:a.toAttribute)(i,s.type);this._$Ei=t,null==l?this.removeAttribute(o):this.setAttribute(o,l),this._$Ei=null}}_$AK(t,i){var s,e,n;const o=this.constructor,l=o._$Eu.get(t);if(void 0!==l&&this._$Ei!==l){const t=o.getPropertyOptions(l),r=t.converter,h=null!==(n=null!==(e=null===(s=r)||void 0===s?void 0:s.fromAttribute)&&void 0!==e?e:"function"==typeof r?r:null)&&void 0!==n?n:a.fromAttribute;this._$Ei=l,this[l]=h(i,t.type),this._$Ei=null}}requestUpdate(t,i,s){let e=!0;void 0!==t&&(((s=s||this.constructor.getPropertyOptions(t)).hasChanged||d)(this[t],i)?(this._$AL.has(t)||this._$AL.set(t,i),!0===s.reflect&&this._$Ei!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,s))):e=!1),!this.isUpdatePending&&e&&(this._$Ep=this._$E_())}async _$E_(){this.isUpdatePending=!0;try{await this._$Ep}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Et&&(this._$Et.forEach(((t,i)=>this[i]=t)),this._$Et=void 0);let i=!1;const s=this._$AL;try{i=this.shouldUpdate(s),i?(this.willUpdate(s),null===(t=this._$Eg)||void 0===t||t.forEach((t=>{var i;return null===(i=t.hostUpdate)||void 0===i?void 0:i.call(t)})),this.update(s)):this._$EU()}catch(t){throw i=!1,this._$EU(),t}i&&this._$AE(s)}willUpdate(t){}_$AE(t){var i;null===(i=this._$Eg)||void 0===i||i.forEach((t=>{var i;return null===(i=t.hostUpdated)||void 0===i?void 0:i.call(t)})),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._$Ep}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,i)=>this._$ES(i,this[i],t))),this._$EC=void 0),this._$EU()}updated(t){}firstUpdated(t){}}
12
+ /**
13
+ * @license
14
+ * Copyright 2017 Google LLC
15
+ * SPDX-License-Identifier: BSD-3-Clause
16
+ */
17
+ var u;p.finalized=!0,p.elementProperties=new Map,p.elementStyles=[],p.shadowRootOptions={mode:"open"},null==h||h({ReactiveElement:p}),(null!==(o=globalThis.reactiveElementVersions)&&void 0!==o?o:globalThis.reactiveElementVersions=[]).push("1.3.2");const v=globalThis.trustedTypes,y=v?v.createPolicy("lit-html",{createHTML:t=>t}):void 0,g=`lit$${(Math.random()+"").slice(9)}$`,m="?"+g,w=`<${m}>`,f=document,b=(t="")=>f.createComment(t),x=t=>null===t||"object"!=typeof t&&"function"!=typeof t,S=Array.isArray,C=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,$=/-->/g,k=/>/g,M=/>|[ \n \r](?:([^\s"'>=/]+)([ \n \r]*=[ \n \r]*(?:[^ \n \r"'`<>=]|("|')|))|$)/g,_=/'/g,L=/"/g,E=/^(?:script|style|textarea|title)$/i,A=(t=>(i,...s)=>({_$litType$:t,strings:i,values:s}))(1),U=Symbol.for("lit-noChange"),T=Symbol.for("lit-nothing"),O=new WeakMap,B=f.createTreeWalker(f,129,null,!1),R=(t,i)=>{const s=t.length-1,e=[];let n,o=2===i?"<svg>":"",l=C;for(let i=0;i<s;i++){const s=t[i];let r,h,a=-1,d=0;for(;d<s.length&&(l.lastIndex=d,h=l.exec(s),null!==h);)d=l.lastIndex,l===C?"!--"===h[1]?l=$:void 0!==h[1]?l=k:void 0!==h[2]?(E.test(h[2])&&(n=RegExp("</"+h[2],"g")),l=M):void 0!==h[3]&&(l=M):l===M?">"===h[0]?(l=null!=n?n:C,a=-1):void 0===h[1]?a=-2:(a=l.lastIndex-h[2].length,r=h[1],l=void 0===h[3]?M:'"'===h[3]?L:_):l===L||l===_?l=M:l===$||l===k?l=C:(l=M,n=void 0);const c=l===M&&t[i+1].startsWith("/>")?" ":"";o+=l===C?s+w:a>=0?(e.push(r),s.slice(0,a)+"$lit$"+s.slice(a)+g+c):s+g+(-2===a?(e.push(void 0),i):c)}const r=o+(t[s]||"<?>")+(2===i?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==y?y.createHTML(r):r,e]};class j{constructor({strings:t,_$litType$:i},s){let e;this.parts=[];let n=0,o=0;const l=t.length-1,r=this.parts,[h,a]=R(t,i);if(this.el=j.createElement(h,s),B.currentNode=this.el.content,2===i){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes)}for(;null!==(e=B.nextNode())&&r.length<l;){if(1===e.nodeType){if(e.hasAttributes()){const t=[];for(const i of e.getAttributeNames())if(i.endsWith("$lit$")||i.startsWith(g)){const s=a[o++];if(t.push(i),void 0!==s){const t=e.getAttribute(s.toLowerCase()+"$lit$").split(g),i=/([.?@])?(.*)/.exec(s);r.push({type:1,index:n,name:i[2],strings:t,ctor:"."===i[1]?H:"?"===i[1]?F:"@"===i[1]?V:Z})}else r.push({type:6,index:n})}for(const i of t)e.removeAttribute(i)}if(E.test(e.tagName)){const t=e.textContent.split(g),i=t.length-1;if(i>0){e.textContent=v?v.emptyScript:"";for(let s=0;s<i;s++)e.append(t[s],b()),B.nextNode(),r.push({type:2,index:++n});e.append(t[i],b())}}}else if(8===e.nodeType)if(e.data===m)r.push({type:2,index:n});else{let t=-1;for(;-1!==(t=e.data.indexOf(g,t+1));)r.push({type:7,index:n}),t+=g.length-1}n++}}static createElement(t,i){const s=f.createElement("template");return s.innerHTML=t,s}}function N(t,i,s=t,e){var n,o,l,r;if(i===U)return i;let h=void 0!==e?null===(n=s._$Cl)||void 0===n?void 0:n[e]:s._$Cu;const a=x(i)?void 0:i._$litDirective$;return(null==h?void 0:h.constructor)!==a&&(null===(o=null==h?void 0:h._$AO)||void 0===o||o.call(h,!1),void 0===a?h=void 0:(h=new a(t),h._$AT(t,s,e)),void 0!==e?(null!==(l=(r=s)._$Cl)&&void 0!==l?l:r._$Cl=[])[e]=h:s._$Cu=h),void 0!==h&&(i=N(t,h._$AS(t,i.values),h,e)),i}class z{constructor(t,i){this.v=[],this._$AN=void 0,this._$AD=t,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(t){var i;const{el:{content:s},parts:e}=this._$AD,n=(null!==(i=null==t?void 0:t.creationScope)&&void 0!==i?i:f).importNode(s,!0);B.currentNode=n;let o=B.nextNode(),l=0,r=0,h=e[0];for(;void 0!==h;){if(l===h.index){let i;2===h.type?i=new P(o,o.nextSibling,this,t):1===h.type?i=new h.ctor(o,h.name,h.strings,this,t):6===h.type&&(i=new D(o,this,t)),this.v.push(i),h=e[++r]}l!==(null==h?void 0:h.index)&&(o=B.nextNode(),l++)}return n}m(t){let i=0;for(const s of this.v)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++}}class P{constructor(t,i,s,e){var n;this.type=2,this._$AH=T,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cg=null===(n=null==e?void 0:e.isConnected)||void 0===n||n}get _$AU(){var t,i;return null!==(i=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==i?i:this._$Cg}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=N(this,t,i),x(t)?t===T||null==t||""===t?(this._$AH!==T&&this._$AR(),this._$AH=T):t!==this._$AH&&t!==U&&this.$(t):void 0!==t._$litType$?this.T(t):void 0!==t.nodeType?this.k(t):(t=>{var i;return S(t)||"function"==typeof(null===(i=t)||void 0===i?void 0:i[Symbol.iterator])})(t)?this.S(t):this.$(t)}M(t,i=this._$AB){return this._$AA.parentNode.insertBefore(t,i)}k(t){this._$AH!==t&&(this._$AR(),this._$AH=this.M(t))}$(t){this._$AH!==T&&x(this._$AH)?this._$AA.nextSibling.data=t:this.k(f.createTextNode(t)),this._$AH=t}T(t){var i;const{values:s,_$litType$:e}=t,n="number"==typeof e?this._$AC(t):(void 0===e.el&&(e.el=j.createElement(e.h,this.options)),e);if((null===(i=this._$AH)||void 0===i?void 0:i._$AD)===n)this._$AH.m(s);else{const t=new z(n,this),i=t.p(this.options);t.m(s),this.k(i),this._$AH=t}}_$AC(t){let i=O.get(t.strings);return void 0===i&&O.set(t.strings,i=new j(t)),i}S(t){S(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const n of t)e===i.length?i.push(s=new P(this.M(b()),this.M(b()),this,this.options)):s=i[e],s._$AI(n),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e)}_$AR(t=this._$AA.nextSibling,i){var s;for(null===(s=this._$AP)||void 0===s||s.call(this,!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){var i;void 0===this._$AM&&(this._$Cg=t,null===(i=this._$AP)||void 0===i||i.call(this,t))}}class Z{constructor(t,i,s,e,n){this.type=1,this._$AH=T,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=n,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=T}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,s,e){const n=this.strings;let o=!1;if(void 0===n)t=N(this,t,i,0),o=!x(t)||t!==this._$AH&&t!==U,o&&(this._$AH=t);else{const e=t;let l,r;for(t=n[0],l=0;l<n.length-1;l++)r=N(this,e[s+l],i,l),r===U&&(r=this._$AH[l]),o||(o=!x(r)||r!==this._$AH[l]),r===T?t=T:t!==T&&(t+=(null!=r?r:"")+n[l+1]),this._$AH[l]=r}o&&!e&&this.C(t)}C(t){t===T?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class H extends Z{constructor(){super(...arguments),this.type=3}C(t){this.element[this.name]=t===T?void 0:t}}const I=v?v.emptyScript:"";class F extends Z{constructor(){super(...arguments),this.type=4}C(t){t&&t!==T?this.element.setAttribute(this.name,I):this.element.removeAttribute(this.name)}}class V extends Z{constructor(t,i,s,e,n){super(t,i,s,e,n),this.type=5}_$AI(t,i=this){var s;if((t=null!==(s=N(this,t,i,0))&&void 0!==s?s:T)===U)return;const e=this._$AH,n=t===T&&e!==T||t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive,o=t!==T&&(e===T||n);n&&this.element.removeEventListener(this.name,this,e),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var i,s;"function"==typeof this._$AH?this._$AH.call(null!==(s=null===(i=this.options)||void 0===i?void 0:i.host)&&void 0!==s?s:this.element,t):this._$AH.handleEvent(t)}}class D{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){N(this,t)}}const J=window.litHtmlPolyfillSupport;
18
+ /**
19
+ * @license
20
+ * Copyright 2017 Google LLC
21
+ * SPDX-License-Identifier: BSD-3-Clause
22
+ */
23
+ var K,X;null==J||J(j,P),(null!==(u=globalThis.litHtmlVersions)&&void 0!==u?u:globalThis.litHtmlVersions=[]).push("2.2.6");class q extends p{constructor(){super(...arguments),this.renderOptions={host:this},this._$Dt=void 0}createRenderRoot(){var t,i;const s=super.createRenderRoot();return null!==(t=(i=this.renderOptions).renderBefore)&&void 0!==t||(i.renderBefore=s.firstChild),s}update(t){const i=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Dt=((t,i,s)=>{var e,n;const o=null!==(e=null==s?void 0:s.renderBefore)&&void 0!==e?e:i;let l=o._$litPart$;if(void 0===l){const t=null!==(n=null==s?void 0:s.renderBefore)&&void 0!==n?n:null;o._$litPart$=l=new P(i.insertBefore(b(),t),t,void 0,null!=s?s:{})}return l._$AI(t),l})(i,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!1)}render(){return U}}q.finalized=!0,q._$litElement$=!0,null===(K=globalThis.litElementHydrateSupport)||void 0===K||K.call(globalThis,{LitElement:q});const W=globalThis.litElementPolyfillSupport;null==W||W({LitElement:q}),(null!==(X=globalThis.litElementVersions)&&void 0!==X?X:globalThis.litElementVersions=[]).push("3.2.0");
24
+ /**
25
+ * @license
26
+ * Copyright 2017 Google LLC
27
+ * SPDX-License-Identifier: BSD-3-Clause
28
+ */
29
+ const G=(t,i)=>"method"===i.kind&&i.descriptor&&!("value"in i.descriptor)?{...i,finisher(s){s.createProperty(i.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:i.key,initializer(){"function"==typeof i.initializer&&(this[i.key]=i.initializer.call(this))},finisher(s){s.createProperty(i.key,t)}};
30
+ /**
31
+ * @license
32
+ * Copyright 2017 Google LLC
33
+ * SPDX-License-Identifier: BSD-3-Clause
34
+ */function Q(t){return(i,s)=>void 0!==s?((t,i,s)=>{i.constructor.createProperty(s,t)})(t,i,s):G(t,i)
35
+ /**
36
+ * @license
37
+ * Copyright 2017 Google LLC
38
+ * SPDX-License-Identifier: BSD-3-Clause
39
+ */}function Y(t){return Q({...t,state:!0})}
40
+ /**
41
+ * @license
42
+ * Copyright 2021 Google LLC
43
+ * SPDX-License-Identifier: BSD-3-Clause
44
+ */var tt;null===(tt=window.HTMLSlotElement)||void 0===tt||tt.prototype.assignedElements;
45
+ /**
46
+ * @license
47
+ * Copyright 2017 Google LLC
48
+ * SPDX-License-Identifier: BSD-3-Clause
49
+ */
50
+ const it=1;
51
+ /**
52
+ * @license
53
+ * Copyright 2018 Google LLC
54
+ * SPDX-License-Identifier: BSD-3-Clause
55
+ */
56
+ const st=(t=>(...i)=>({_$litDirective$:t,values:i}))(class extends class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,i,s){this._$Ct=t,this._$AM=i,this._$Ci=s}_$AS(t,i){return this.update(t,i)}update(t,i){return this.render(...i)}}{constructor(t){var i;if(super(t),t.type!==it||"class"!==t.name||(null===(i=t.strings)||void 0===i?void 0:i.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((i=>t[i])).join(" ")+" "}update(t,[i]){var s,e;if(void 0===this.et){this.et=new Set,void 0!==t.strings&&(this.st=new Set(t.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in i)i[t]&&!(null===(s=this.st)||void 0===s?void 0:s.has(t))&&this.et.add(t);return this.render(i)}const n=t.element.classList;this.et.forEach((t=>{t in i||(n.remove(t),this.et.delete(t))}));for(const t in i){const s=!!i[t];s===this.et.has(t)||(null===(e=this.st)||void 0===e?void 0:e.has(t))||(s?(n.add(t),this.et.add(t)):(n.remove(t),this.et.delete(t)))}return U}}),et=(t,i=0)=>{try{let s=3735928559^i,e=1103547991^i;for(let i,n=0;n<t.length;n++)i=t.charCodeAt(n),s=Math.imul(s^i,2654435761),e=Math.imul(e^i,1597334677);return s=Math.imul(s^s>>>16,2246822507)^Math.imul(e^e>>>13,3266489909),e=Math.imul(e^e>>>16,2246822507)^Math.imul(s^s>>>13,3266489909),4294967296*(2097151&e)+(s>>>0)}catch(t){return console.warn("Error in cyrb53: ",t),0}},nt=(t,i,s=!1,e="localStorage")=>{try{const n=s?btoa(i):i;"localStorage"===e?localStorage.setItem(t,n):sessionStorage.setItem(t,n)}catch(t){console.warn("Error in setLocalStorage: ",t)}},ot=(t,i=!1,s="localStorage")=>{try{let e=null;return e="localStorage"===s?localStorage.getItem(t):sessionStorage.getItem(t),e&&i?atob(e):e}catch(t){return console.warn("Error in getLocalStorage: ",t),null}},lt=(t,i="localStorage")=>{try{"localStorage"===i?localStorage.removeItem(t):sessionStorage.removeItem(t)}catch(t){console.warn("Error in removeLocalStorageData: ",t)}};var rt=function(t,i,s,e){for(var n,o=arguments.length,l=o<3?i:null===e?e=Object.getOwnPropertyDescriptor(i,s):e,r=t.length-1;r>=0;r--)(n=t[r])&&(l=(o<3?n(l):o>3?n(i,s,l):n(i,s))||l);return o>3&&l&&Object.defineProperty(i,s,l),l};let ht=class extends q{constructor(){super(),this._loadPlugin=!1,this.comments=[],this._expanded=!0,this.staging=true,this.copyLinkTooltip="Copy Link",this.setWindowEventListner=()=>{window.addEventListener("locationchange",(()=>{this.checkUrl(),console.log("location change event",window.location.href)}))},this.urlChangeListener=()=>{const t=history.pushState;history.pushState=function(){const i=t.apply(this,arguments);return window.dispatchEvent(new Event("pushstate")),window.dispatchEvent(new Event("locationchange")),i};const i=history.replaceState;history.replaceState=function(){const t=i.apply(this,arguments);return window.dispatchEvent(new Event("replacestate")),window.dispatchEvent(new Event("locationchange")),t},window.addEventListener("popstate",(()=>{window.dispatchEvent(new Event("locationchange"))}))},this.checkUrl=()=>{try{console.log("url in checkUrl",window.location.href);const t=new URL(document.location),i=t.searchParams;if(i.has("snippyly_google_token")){console.log("token",i.get("snippyly_google_token"));const s=JSON.parse(atob(i.get("snippyly_google_token"))),e={};e.userId=s.uid,e.name=s.displayName,e.email=s.email,e.photoUrl=null==s?void 0:s.photoURL,e.contacts=window.SNIPPYLY_USER_CONTACTS||[],nt("snippyly-user",JSON.stringify(e),!0),i.delete("snippyly_google_token"),window.history.replaceState({},document.title,t.href)}if(i.has("review-mode"))if(nt("review-mode","true",!1,"sessionStorage"),i.has("review-doc-id"))this.loadPluginUI();else{const s=new URL(document.location);s.searchParams.delete("review-mode");const e=et(s.href);i.append("review-doc-id",`${e}`),window.history.replaceState({},document.title,t.href),this.loadPluginUI()}else if(ot("review-mode",!1,"sessionStorage")){const s=new URL(document.location);s.searchParams.delete("review-mode"),i.append("review-mode","true");const e=et(s.href);i.append("review-doc-id",`${e}`),window.history.replaceState({},document.title,t.href),this.loadPluginUI()}}catch(t){console.warn("Error in checkUrl: ",t)}},this.loadPluginUI=()=>{this.loadPlugin=!0;const t=document.createElement("snippyly-comments");window.document.body.appendChild(t);const i=document.createElement("snippyly-comments-sidebar");window.document.body.appendChild(i);const s=document.createElement("snippyly-cursor");window.document.body.appendChild(s),((t="latest",i=!1,s)=>{if(console.log("load snippyly called"),document.getElementById("snippylyScript"))s&&s();else{const e=document.createElement("script");e.src=`https://cdn.jsdelivr.net/npm/@snippyly/sdk${i?"-staging":""}@${t||"latest"}/snippyly.js`,e.id="snippylyScript",e.type="module",document.body.appendChild(e),e.onload=()=>{s&&s()}}})(void 0,this.staging,(()=>{window.Snippyly&&(console.log("snippyly",Snippyly),this.initializeSnippyly())}))},this.initializeSnippyly=async()=>{await(null===Snippyly||void 0===Snippyly?void 0:Snippyly.init("UnHxMCCFcclkP4bErBL1")),this.commentElement=null===Snippyly||void 0===Snippyly?void 0:Snippyly.getCommentElement(),ot("snippyly-user",!0)&&this.identifySnippyly()},this.identifySnippyly=async()=>{this.snippylyUser=JSON.parse(ot("snippyly-user",!0)),await Snippyly.identify(this.snippylyUser),this.getComments()},this.getComments=()=>{this.commentElement&&this.commentElement.getAllCommentPinAnnotationsOnCurrentDocument().subscribe((t=>{this.comments=t}))},this.toggleCommentSidebar=()=>{this.commentElement&&this.commentElement.toggleCommentSidebar()},this.toggleSnippylyPluginToolbar=()=>{this.expanded=!this.expanded},this.loginWithGoogle=()=>{window.open(`https://snippyly-login-staging.web.app/?redirect_url=${encodeURIComponent(window.location.href)}`,"_self")},this.removeSnippyly=async()=>{try{lt("review-mode","sessionStorage");const t=new URL(document.location),i=t.searchParams;i.delete("review-doc-id"),i.delete("review-mode"),window.history.replaceState({},document.title,t.href),window.location.reload()}catch(t){console.warn("Error in removeSnippyly: ",t)}},this.signOutUser=async()=>{await Snippyly.signOutUser(),lt("snippyly-user"),this.snippylyUser=void 0,window.open(`https://snippyly-login-staging.web.app/?signout=true&redirect_url=${encodeURIComponent(window.location.href)}`,"_self")},this.toggleMenu=t=>{this.menuOpenedId===t?this.menuOpenedId=void 0:this.menuOpenedId=t},this.copyLink=()=>{navigator.clipboard.writeText(window.location.href),this.copyLinkTooltip="Copied!",setTimeout((()=>{this.copyLinkTooltip="Copy Link"}),2e3)},this.expanded=!0,this.setWindowEventListner(),this.urlChangeListener(),this.checkUrl(),console.log("*** Staging Mode ON! ***")}get loadPlugin(){return this._loadPlugin}set loadPlugin(t){this._loadPlugin=t,this.loadPlugin?this.classList.add("visible"):this.classList.remove("visible")}get expanded(){return this._expanded}set expanded(t){this._expanded=t,this.expanded?this.classList.add("expanded"):this.classList.remove("expanded")}render(){var t,i,s,e,n,o;return this.loadPlugin?A`
57
+ <div class="snippyly-plugin-container">
58
+ <div class="snippyly-btn-container snippyly-menu-trigger ${st({opened:"snippylyMenu"===this.menuOpenedId})}" id="snippylyMenu" @click=${()=>this.toggleMenu("snippylyMenu")}>
59
+ <div class="btn snippyly-btn">
60
+ <svg class="snippyly-logo" width="19" height="18" viewBox="0 0 19 18" fill="none" xmlns="http://www.w3.org/2000/svg">
61
+ <path d="M7.27564 0.223149C6.79031 0.00346224 6.25358 -0.0557657 5.73589 0.0532382C5.21819 0.162242 4.74372 0.434385 4.37475 0.833949C3.99784 1.2249 3.74112 1.72714 3.63818 2.275C3.53523 2.82287 3.59085 3.39088 3.79775 3.90475C3.99487 4.42252 4.33503 4.86527 4.77372 5.17507C5.21241 5.48487 5.72921 5.64732 6.25653 5.64115H8.91823V2.82595C8.92404 2.26743 8.77031 1.72008 8.4772 1.25563C8.1841 0.791185 7.76528 0.431303 7.27564 0.223149Z" fill="#FFCB00"/>
62
+ <path d="M16.9736 3.72115C16.3509 3.06258 15.5579 2.61408 14.6946 2.43229C13.8313 2.25049 12.9365 2.34355 12.1231 2.69972C11.3097 3.05588 10.6143 3.65918 10.1246 4.43343C9.63489 5.20769 9.37289 6.11818 9.37167 7.04995V11.7611H13.8313C14.714 11.771 15.5791 11.4985 16.3131 10.9793C17.0471 10.46 17.616 9.7183 17.9451 8.85115C18.2892 7.9918 18.3806 7.04259 18.2072 6.12744C18.0339 5.21229 17.604 4.3737 16.9736 3.72115Z" fill="#FF7162"/>
63
+ <path d="M14.4933 13.9835C14.2962 13.4652 13.956 13.0218 13.5172 12.7114C13.0783 12.401 12.5612 12.2379 12.0334 12.2435H9.37167V15.0611C9.36611 15.6198 9.52006 16.1671 9.81336 16.6316C10.1067 17.096 10.5256 17.4558 11.0154 17.6639C11.3431 17.8099 11.6949 17.8853 12.0504 17.8859C12.4867 17.8813 12.9153 17.7635 13.2987 17.5429C13.682 17.3223 14.0085 17.0057 14.2496 16.6206C14.4906 16.2356 14.6388 15.7939 14.6813 15.3342C14.7238 14.8745 14.6593 14.4107 14.4933 13.9835Z" fill="#0DCF82"/>
64
+ <path d="M0.351589 9.03355C0.00514201 9.8932 -0.0880133 10.8436 0.0843205 11.7602C0.256654 12.6768 0.686445 13.517 1.31742 14.1708C1.72451 14.6098 2.20989 14.9589 2.74541 15.1979C3.28094 15.4368 3.85595 15.5608 4.4371 15.5628C5.03193 15.5613 5.62062 15.4353 6.16924 15.192C6.9885 14.8437 7.68929 14.2415 8.17981 13.4645C8.67033 12.6874 8.92771 11.7717 8.91823 10.8372V6.12115H4.46544C3.58239 6.11147 2.71718 6.38434 1.98312 6.90402C1.24906 7.4237 0.680388 8.16595 0.351589 9.03355Z" fill="#A259FE"/>
65
+ </svg>
66
+ <svg width="8" height="5" viewBox="0 0 8 5" fill="none" xmlns="http://www.w3.org/2000/svg">
67
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M3.646 4.354L0.645996 1.354L1.354 0.646004L4 3.293L6.646 0.646004L7.354 1.354L4.354 4.354L4 4.707L3.646 4.354Z" fill="#5B5B5B"/>
68
+ </svg>
69
+ </div>
70
+ <div class="snippyly-menu">
71
+ <div class="menu-item" @click=${()=>this.toggleSnippylyPluginToolbar()}>${this.expanded?"Hide Toolbar":"Show Toolbar"}</div>
72
+ <div class="menu-item" @click=${()=>this.removeSnippyly()}>Exit Review Mode</div>
73
+ </div>
74
+ </div>
75
+ ${this.expanded?A`
76
+ <div class="btn comment-tool-btn ${st({disabled:!(null===(t=this.snippylyUser)||void 0===t?void 0:t.userId)})}">
77
+ <snippyly-comment-tool class="custom-tool">
78
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" class="btn comment-btn">
79
+ <path d="M1.944 16.75L3.64 13.992L3.927 13.527L3.69 13.034C3.225 12.083 2.993 11.124 3 10C3 6.134 6.134 3 10 3C13.866 3 17 6.134 17 10C17 13.866 13.866 17 10 17C8.86 17.007 7.888 16.768 6.926 16.291L6.658 16.16L6.362 16.197L1.944 16.749V16.75ZM6.487 17.19C7.547 17.708 8.74 18 10 18C14.418 18 18 14.418 18 10C18 5.582 14.418 2 10 2C5.582 2 2 5.582 2 10C2 11.243 2.283 12.419 2.789 13.468L0.672 16.908L0 18L1.272 17.841L6.487 17.189V17.19Z" fill="#5B5B5B"/>
80
+ </svg>
81
+ </snippyly-comment-tool>
82
+ </div>
83
+ ${(null===(i=this.comments)||void 0===i?void 0:i.length)?A`
84
+ <div class="comments-counter" @click=${()=>this.toggleCommentSidebar()}>
85
+ ${null===(s=this.comments)||void 0===s?void 0:s.length} ${1===(null===(e=this.comments)||void 0===e?void 0:e.length)?"Comment":"Comments"}
86
+ </div>
87
+ `:null}
88
+ <div class="spacer"></div>
89
+ <snippyly-presence max-users="4"></snippyly-presence>
90
+ ${(null===(n=this.snippylyUser)||void 0===n?void 0:n.userId)?A`
91
+ <div class="snippyly-btn-container snippyly-menu-trigger">
92
+ <button class="btn primary-btn share-btn" @click=${()=>this.copyLink()}>
93
+ Share
94
+ </button>
95
+ <div class="snippyly-menu">
96
+ <div class="menu-item">${this.copyLinkTooltip}</div>
97
+ </div>
98
+ </div>
99
+ <div class="snippyly-btn-container snippyly-menu-trigger profile-img-container ${st({opened:"userMenu"===this.menuOpenedId})}" id="userMenu" @click=${()=>this.toggleMenu("userMenu")}>
100
+ <img src=${null===(o=this.snippylyUser)||void 0===o?void 0:o.photoUrl} class="profile-img" />
101
+ <div class="snippyly-menu">
102
+ <div class="menu-item" @click=${()=>this.signOutUser()}>Sign Out</div>
103
+ </div>
104
+ </div>
105
+ `:A`
106
+ <button class="btn primary-btn signin-btn" @click=${()=>this.loginWithGoogle()}>
107
+ Sign in
108
+ </button>
109
+ `}
110
+ `:null}
111
+ </div>
112
+ `:A``}};ht.styles=((t,...s)=>{const n=1===t.length?t[0]:s.reduce(((i,s,e)=>i+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[e+1]),t[0]);return new e(n,i)})`
113
+ :host(.visible) {
114
+ display: flex;
115
+ padding: 16px;
116
+ border: 1px solid rgba(0, 0, 0, 0.12);
117
+ background: white;
118
+ border-radius: 8px;
119
+ position: fixed;
120
+ bottom: 0px;
121
+ right: 0px;
122
+ margin: 24px;
123
+ height: 72px;
124
+ box-sizing: border-box;
125
+ align-items: center;
126
+ z-index: 999999995;
127
+ box-shadow: 0 1rem 3rem #0000002d;
128
+ }
129
+
130
+ :host(.expanded) {
131
+ min-width: 450px;
132
+ }
133
+
134
+ .snippyly-plugin-container {
135
+ display: flex;
136
+ align-items: center;
137
+ width: 100%;
138
+ }
139
+
140
+ .snippyly-btn, .comment-tool-btn {
141
+ height: 28px;
142
+ padding: 8px;
143
+ border-radius: 8px;
144
+ cursor: pointer;
145
+ }
146
+
147
+ .snippyly-btn:hover, .comment-tool-btn:not(.disabled):hover, .comments-counter:hover {
148
+ background: #f0f0f0;
149
+ }
150
+
151
+ .snippyly-btn {
152
+ display: flex;
153
+ align-items: center;
154
+ }
155
+
156
+ .snippyly-logo {
157
+ margin-right: 8px;
158
+ }
159
+
160
+ .comment-tool-btn, .comment-tool-btn .custom-btn-container {
161
+ display: flex;
162
+ align-items: center;
163
+ }
164
+
165
+ .comment-tool-btn.disabled, .comment-tool-btn.disabled .btn {
166
+ cursor: not-allowed;
167
+ }
168
+
169
+ .comment-tool-btn.disabled .comment-btn path {
170
+ fill: #979797;
171
+ }
172
+
173
+ .comments-counter {
174
+ border: 1px solid #B6B1B1;
175
+ border-radius: 6px;
176
+ padding: 8px;
177
+ cursor: pointer;
178
+ }
179
+
180
+ .btn {
181
+ cursor: pointer;
182
+ }
183
+
184
+ .primary-btn {
185
+ height: 36px;
186
+ background: rgb(24, 160, 251);
187
+ border-radius: 6px;
188
+ border: 0;
189
+ box-shadow: none;
190
+ outline: none;
191
+ padding: 0 12px;
192
+ color: white;
193
+ /* margin: 0 12px; */
194
+ }
195
+
196
+ .profile-img-container {
197
+ display: flex;
198
+ }
199
+
200
+ .profile-img {
201
+ width: 36px;
202
+ height: 36px;
203
+ border-radius: 50px;
204
+ cursor: pointer;
205
+ /* margin: 0 12px; */
206
+ }
207
+
208
+ .snippyly-plugin-container > * {
209
+ margin: 0 6px;
210
+ }
211
+
212
+ .snippyly-plugin-container > *:first-child {
213
+ margin-left: 0px !important;
214
+ }
215
+
216
+ .snippyly-plugin-container > *:last-child {
217
+ margin-right: 0px !important;
218
+ }
219
+
220
+ .spacer {
221
+ flex: 1 0 auto;
222
+ }
223
+
224
+ .snippyly-menu-trigger {
225
+ position: relative;
226
+ }
227
+
228
+ .snippyly-menu {
229
+ position: absolute;
230
+ background: black;
231
+ color: white;
232
+ top: -64px;
233
+ left: 50%;
234
+ white-space: nowrap;
235
+ /* width: 150px; */
236
+ transform: translateX(-50%);
237
+ display: none;
238
+ border-radius: 4px;
239
+ }
240
+
241
+ .snippyly-menu:after {
242
+ content: '';
243
+ position: absolute;
244
+ display: block;
245
+ width: 0px;
246
+ z-index: 1;
247
+ border-style: solid;
248
+ border-color: rgb(0, 0, 0) transparent;
249
+ border-width: 12px 8px 0px;
250
+ bottom: -12px;
251
+ left: 50%;
252
+ transform: translateX(-50%);
253
+ }
254
+
255
+ .snippyly-menu-trigger:hover .snippyly-menu, .snippyly-menu-trigger.opened .snippyly-menu {
256
+ display: block;
257
+ }
258
+
259
+ :host(.expanded) #snippylyMenu.snippyly-menu-trigger .snippyly-menu:after {
260
+ left: 32px;
261
+ }
262
+
263
+ :host(:not(.expanded)) #snippylyMenu.snippyly-menu-trigger .snippyly-menu {
264
+ left: -20px;
265
+ }
266
+
267
+ :host(.expanded) #snippylyMenu.snippyly-menu-trigger .snippyly-menu {
268
+ left: 48px;
269
+ }
270
+
271
+ #snippylyMenu.snippyly-menu-trigger .snippyly-menu {
272
+ top: -100px;
273
+ }
274
+
275
+ :host(:not(.expanded)) #snippylyMenu.snippyly-menu-trigger .snippyly-menu:after {
276
+ left: unset;
277
+ right: 24px;
278
+ }
279
+
280
+ .menu-item {
281
+ padding: 8px;
282
+ cursor: pointer;
283
+ }
284
+
285
+ .s-presence-container {
286
+ display: inline-flex;
287
+ flex-direction: row-reverse;
288
+ align-items: center;
289
+ }
290
+
291
+ .s-presence-avatar {
292
+ position: relative;
293
+ box-shadow: 0px 0px 0px 3px;
294
+ border-radius: 50%;
295
+ overflow: hidden;
296
+ width: 24px;
297
+ height: 24px;
298
+ display: flex;
299
+ align-items: center;
300
+ justify-content: center;
301
+ font-size: 12px;
302
+ // background-color: white;
303
+ }
304
+
305
+ .s-presence-avatar.more-users {
306
+ background: #4578a7;
307
+ box-shadow: 0px 0px 0px 3px #4578a7;
308
+ }
309
+
310
+ .s-presence-avatar:not(:last-child):not(.more-users) {
311
+ margin-left: -6px !important;
312
+ }
313
+
314
+ .s-presence-avatar-image {
315
+ width: 100%;
316
+ height: auto;
317
+ display: block;
318
+ }
319
+
320
+ .s-presence-avatar-image-small {
321
+ width: 1.6rem;
322
+ height: auto;
323
+ display: block;
324
+ }
325
+
326
+ .s-presence-avatar-initial {
327
+ color: white;
328
+ }
329
+
330
+ .away {
331
+ filter: grayscale(1);
332
+ }
333
+ `,rt([Y()],ht.prototype,"loadPlugin",null),rt([Y()],ht.prototype,"comments",void 0),rt([Y()],ht.prototype,"commentElement",void 0),rt([Y()],ht.prototype,"_expanded",void 0),rt([Y()],ht.prototype,"snippylyUser",void 0),rt([Q()],ht.prototype,"apiKey",void 0),rt([Y()],ht.prototype,"staging",void 0),rt([Y()],ht.prototype,"menuOpenedId",void 0),rt([Y()],ht.prototype,"copyLinkTooltip",void 0),ht=rt([(t=>i=>"function"==typeof i?((t,i)=>(window.customElements.define(t,i),i))(t,i):((t,i)=>{const{kind:s,elements:e}=i;return{kind:s,elements:e,finisher(i){window.customElements.define(t,i)}}})(t,i))("snippyly-plugin")],ht);export{ht as SnippylyPlugin};
package/constants.d.ts DELETED
@@ -1,4 +0,0 @@
1
- export declare const REVIEW_MODE = "review-mode";
2
- export declare const REVIEW_DOC_ID = "review-doc-id";
3
- export declare const SNIPPYLY_USER = "snippyly-user";
4
- //# sourceMappingURL=constants.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,gBAAgB,CAAC;AACzC,eAAO,MAAM,aAAa,kBAAkB,CAAC;AAC7C,eAAO,MAAM,aAAa,kBAAkB,CAAC"}
package/constants.js DELETED
@@ -1,4 +0,0 @@
1
- export const REVIEW_MODE = 'review-mode';
2
- export const REVIEW_DOC_ID = 'review-doc-id';
3
- export const SNIPPYLY_USER = 'snippyly-user';
4
- //# sourceMappingURL=constants.js.map
package/constants.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAC;AACzC,MAAM,CAAC,MAAM,aAAa,GAAG,eAAe,CAAC;AAC7C,MAAM,CAAC,MAAM,aAAa,GAAG,eAAe,CAAC","sourcesContent":["export const REVIEW_MODE = 'review-mode';\r\nexport const REVIEW_DOC_ID = 'review-doc-id';\r\nexport const SNIPPYLY_USER = 'snippyly-user';"]}
package/environment.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export declare const SNIPPYLY_LOGIN_BASE_URL = "https://snippyly-login-staging.web.app/";
2
- export declare const SNIPPYLY_SDK_STAGING = true;
3
- //# sourceMappingURL=environment.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../src/environment.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,4CAA4C,CAAC;AAEjF,eAAO,MAAM,oBAAoB,OAAO,CAAC"}
package/environment.js DELETED
@@ -1,4 +0,0 @@
1
- export const SNIPPYLY_LOGIN_BASE_URL = 'https://snippyly-login-staging.web.app/';
2
- // export const SNIPPYLY_LOGIN_BASE_URL = 'http://127.0.0.1:8080';
3
- export const SNIPPYLY_SDK_STAGING = true;
4
- //# sourceMappingURL=environment.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"environment.js","sourceRoot":"","sources":["../src/environment.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,uBAAuB,GAAG,yCAAyC,CAAC;AACjF,kEAAkE;AAClE,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAC","sourcesContent":["export const SNIPPYLY_LOGIN_BASE_URL = 'https://snippyly-login-staging.web.app/';\r\n// export const SNIPPYLY_LOGIN_BASE_URL = 'http://127.0.0.1:8080';\r\nexport const SNIPPYLY_SDK_STAGING = true;"]}
@@ -1,39 +0,0 @@
1
- import { LitElement } from 'lit';
2
- export declare class SnippylyPlugin extends LitElement {
3
- private _loadPlugin;
4
- get loadPlugin(): boolean;
5
- set loadPlugin(value: boolean);
6
- comments: any[];
7
- commentElement: any;
8
- private _expanded;
9
- get expanded(): boolean;
10
- set expanded(value: boolean);
11
- snippylyUser: any;
12
- apiKey: string;
13
- staging: boolean;
14
- menuOpenedId?: string;
15
- copyLinkTooltip: string;
16
- constructor();
17
- setWindowEventListner: () => void;
18
- urlChangeListener: () => void;
19
- checkUrl: () => void;
20
- loadPluginUI: () => void;
21
- initializeSnippyly: () => Promise<void>;
22
- identifySnippyly: () => Promise<void>;
23
- getComments: () => void;
24
- toggleCommentSidebar: () => void;
25
- toggleSnippylyPluginToolbar: () => void;
26
- loginWithGoogle: () => void;
27
- removeSnippyly: () => Promise<void>;
28
- signOutUser: () => Promise<void>;
29
- toggleMenu: (id: string) => void;
30
- copyLink: () => void;
31
- static styles: import("lit").CSSResult;
32
- render(): import("lit-html").TemplateResult<1>;
33
- }
34
- declare global {
35
- interface HTMLElementTagNameMap {
36
- 'snippyly-comment-tool': any;
37
- }
38
- }
39
- //# sourceMappingURL=snippyly-plugin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"snippyly-plugin.d.ts","sourceRoot":"","sources":["../src/snippyly-plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,UAAU,EAAE,MAAM,KAAK,CAAC;AAU5C,qBACa,cAAe,SAAQ,UAAU;IAE1C,OAAO,CAAC,WAAW,CAAS;IAC5B,IACW,UAAU,YAEpB;IACD,IAAW,UAAU,CAAC,KAAK,SAAA,EAO1B;IAEQ,QAAQ,EAAE,GAAG,EAAE,CAAM;IAErB,cAAc,EAAE,GAAG,CAAC;IAG7B,OAAO,CAAC,SAAS,CAAQ;IACzB,IAAW,QAAQ,YAElB;IACD,IAAW,QAAQ,CAAC,KAAK,SAAA,EAOxB;IAEQ,YAAY,EAAE,GAAG,CAAC;IAEf,MAAM,EAAG,MAAM,CAAC;IAEnB,OAAO,UAAwB;IAE/B,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,eAAe,SAAe;;IAcvC,qBAAqB,aAKpB;IAED,iBAAiB,aAsBhB;IAED,QAAQ,aAgDP;IAED,YAAY,aAmBX;IAED,kBAAkB,sBAMjB;IAED,gBAAgB,sBAIf;IAED,WAAW,aAMV;IAED,oBAAoB,aAInB;IAED,2BAA2B,aAE1B;IAED,eAAe,aAEd;IAED,cAAc,sBAmBb;IAED,WAAW,sBAMV;IAED,UAAU,OAAQ,MAAM,UAMvB;IAED,QAAQ,aAMP;IAED,OAAgB,MAAM,0BA6NtB;IAES,MAAM;CAsElB;AAED,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,qBAAqB;QAC3B,uBAAuB,EAAE,GAAG,CAAC;KAChC;CACJ"}
@@ -1,543 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- /* eslint-disable @typescript-eslint/no-explicit-any */
8
- import { css, html, LitElement } from 'lit';
9
- import { customElement, property, state } from 'lit/decorators.js';
10
- import { classMap } from 'lit/directives/class-map.js';
11
- import * as Constants from './constants';
12
- import { SNIPPYLY_LOGIN_BASE_URL, SNIPPYLY_SDK_STAGING } from './environment';
13
- import { cyrb53, getLocalStorageData, loadSnippyly, removeLocalStorageData, setLocalStorageData } from './utils';
14
- let SnippylyPlugin = class SnippylyPlugin extends LitElement {
15
- constructor() {
16
- super();
17
- this._loadPlugin = false;
18
- this.comments = [];
19
- this._expanded = true;
20
- this.staging = SNIPPYLY_SDK_STAGING;
21
- this.copyLinkTooltip = 'Copy Link';
22
- this.setWindowEventListner = () => {
23
- window.addEventListener('locationchange', () => {
24
- this.checkUrl();
25
- console.log('location change event', window.location.href);
26
- });
27
- };
28
- this.urlChangeListener = () => {
29
- const oldPushState = history.pushState;
30
- history.pushState = function pushState() {
31
- // eslint-disable-next-line prefer-rest-params
32
- const ret = oldPushState.apply(this, arguments);
33
- window.dispatchEvent(new Event('pushstate'));
34
- window.dispatchEvent(new Event('locationchange'));
35
- return ret;
36
- };
37
- const oldReplaceState = history.replaceState;
38
- history.replaceState = function replaceState() {
39
- // eslint-disable-next-line prefer-rest-params
40
- const ret = oldReplaceState.apply(this, arguments);
41
- window.dispatchEvent(new Event('replacestate'));
42
- window.dispatchEvent(new Event('locationchange'));
43
- return ret;
44
- };
45
- window.addEventListener('popstate', () => {
46
- window.dispatchEvent(new Event('locationchange'));
47
- });
48
- };
49
- this.checkUrl = () => {
50
- try {
51
- console.log('url in checkUrl', window.location.href);
52
- const url = new URL(document.location);
53
- const params = url.searchParams;
54
- if (params.has("snippyly_google_token")) {
55
- console.log('token', params.get("snippyly_google_token"));
56
- const user = JSON.parse(atob(params.get("snippyly_google_token")));
57
- const snippylyUser = {};
58
- snippylyUser.userId = user.uid;
59
- snippylyUser.name = user.displayName;
60
- snippylyUser.email = user.email;
61
- snippylyUser.photoUrl = user === null || user === void 0 ? void 0 : user.photoURL;
62
- snippylyUser.contacts = window.SNIPPYLY_USER_CONTACTS || [];
63
- // localStorage.setItem(Constants.SNIPPYLY_USER, JSON.stringify(snippylyUser))
64
- setLocalStorageData(Constants.SNIPPYLY_USER, JSON.stringify(snippylyUser), true);
65
- params.delete("snippyly_google_token");
66
- window.history.replaceState({}, document.title, url.href);
67
- }
68
- if (params.has(Constants.REVIEW_MODE)) {
69
- // sessionStorage.setItem(Constants.REVIEW_MODE, 'true');
70
- setLocalStorageData(Constants.REVIEW_MODE, 'true', false, 'sessionStorage');
71
- if (params.has(Constants.REVIEW_DOC_ID)) {
72
- this.loadPluginUI();
73
- }
74
- else {
75
- // generate doc id and set it in params
76
- const tempUrl = new URL(document.location);
77
- tempUrl.searchParams.delete(Constants.REVIEW_MODE);
78
- const docId = cyrb53(tempUrl.href);
79
- params.append(Constants.REVIEW_DOC_ID, `${docId}`);
80
- window.history.replaceState({}, document.title, url.href);
81
- this.loadPluginUI();
82
- }
83
- }
84
- else {
85
- // check if review mode is there in session storage
86
- if (getLocalStorageData(Constants.REVIEW_MODE, false, 'sessionStorage')) {
87
- const tempUrl = new URL(document.location);
88
- tempUrl.searchParams.delete(Constants.REVIEW_MODE);
89
- params.append(Constants.REVIEW_MODE, 'true');
90
- const docId = cyrb53(tempUrl.href);
91
- params.append(Constants.REVIEW_DOC_ID, `${docId}`);
92
- window.history.replaceState({}, document.title, url.href);
93
- this.loadPluginUI();
94
- }
95
- }
96
- }
97
- catch (err) {
98
- console.warn('Error in checkUrl: ', err);
99
- }
100
- };
101
- this.loadPluginUI = () => {
102
- this.loadPlugin = true;
103
- const commentTool = document.createElement('snippyly-comments');
104
- window.document.body.appendChild(commentTool);
105
- const commentSidebar = document.createElement('snippyly-comments-sidebar');
106
- window.document.body.appendChild(commentSidebar);
107
- const cursorTag = document.createElement('snippyly-cursor');
108
- window.document.body.appendChild(cursorTag);
109
- loadSnippyly(undefined, this.staging, () => {
110
- if (window.Snippyly) {
111
- console.log('snippyly', Snippyly);
112
- this.initializeSnippyly();
113
- }
114
- });
115
- };
116
- this.initializeSnippyly = async () => {
117
- await (Snippyly === null || Snippyly === void 0 ? void 0 : Snippyly.init("UnHxMCCFcclkP4bErBL1"));
118
- this.commentElement = Snippyly === null || Snippyly === void 0 ? void 0 : Snippyly.getCommentElement();
119
- if (getLocalStorageData(Constants.SNIPPYLY_USER, true)) {
120
- this.identifySnippyly();
121
- }
122
- };
123
- this.identifySnippyly = async () => {
124
- this.snippylyUser = JSON.parse(getLocalStorageData(Constants.SNIPPYLY_USER, true));
125
- await Snippyly.identify(this.snippylyUser);
126
- this.getComments();
127
- };
128
- this.getComments = () => {
129
- if (this.commentElement) {
130
- this.commentElement.getAllCommentPinAnnotationsOnCurrentDocument().subscribe((comments) => {
131
- this.comments = comments;
132
- });
133
- }
134
- };
135
- this.toggleCommentSidebar = () => {
136
- if (this.commentElement) {
137
- this.commentElement.toggleCommentSidebar();
138
- }
139
- };
140
- this.toggleSnippylyPluginToolbar = () => {
141
- this.expanded = !this.expanded;
142
- };
143
- this.loginWithGoogle = () => {
144
- window.open(`${SNIPPYLY_LOGIN_BASE_URL}?redirect_url=${encodeURIComponent(window.location.href)}`, '_self');
145
- };
146
- this.removeSnippyly = async () => {
147
- try {
148
- // removeGoogleLoginIframe();
149
- // const element = document.getElementById('snippylyScript');
150
- // if (element) {
151
- // element.remove();
152
- // }
153
- // await Snippyly.signOutUser();
154
- // sessionStorage.removeItem(Constants.REVIEW_MODE);
155
- removeLocalStorageData(Constants.REVIEW_MODE, 'sessionStorage');
156
- const url = new URL(document.location);
157
- const params = url.searchParams;
158
- params.delete(Constants.REVIEW_DOC_ID);
159
- params.delete(Constants.REVIEW_MODE);
160
- window.history.replaceState({}, document.title, url.href);
161
- window.location.reload();
162
- }
163
- catch (err) {
164
- console.warn('Error in removeSnippyly: ', err);
165
- }
166
- };
167
- this.signOutUser = async () => {
168
- await Snippyly.signOutUser();
169
- removeLocalStorageData(Constants.SNIPPYLY_USER);
170
- this.snippylyUser = undefined;
171
- window.open(`${SNIPPYLY_LOGIN_BASE_URL}?signout=true&redirect_url=${encodeURIComponent(window.location.href)}`, '_self');
172
- // window.location.reload();
173
- };
174
- this.toggleMenu = (id) => {
175
- if (this.menuOpenedId === id) {
176
- this.menuOpenedId = undefined;
177
- }
178
- else {
179
- this.menuOpenedId = id;
180
- }
181
- };
182
- this.copyLink = () => {
183
- navigator.clipboard.writeText(window.location.href);
184
- this.copyLinkTooltip = 'Copied!';
185
- setTimeout(() => {
186
- this.copyLinkTooltip = 'Copy Link';
187
- }, 2000);
188
- };
189
- this.expanded = true;
190
- this.setWindowEventListner();
191
- this.urlChangeListener();
192
- this.checkUrl();
193
- if (SNIPPYLY_SDK_STAGING) {
194
- console.log('*** Staging Mode ON! ***');
195
- }
196
- }
197
- get loadPlugin() {
198
- return this._loadPlugin;
199
- }
200
- set loadPlugin(value) {
201
- this._loadPlugin = value;
202
- if (this.loadPlugin) {
203
- this.classList.add('visible');
204
- }
205
- else {
206
- this.classList.remove('visible');
207
- }
208
- }
209
- get expanded() {
210
- return this._expanded;
211
- }
212
- set expanded(value) {
213
- this._expanded = value;
214
- if (this.expanded) {
215
- this.classList.add('expanded');
216
- }
217
- else {
218
- this.classList.remove('expanded');
219
- }
220
- }
221
- render() {
222
- var _a, _b, _c, _d, _e, _f;
223
- if (!this.loadPlugin) {
224
- return html ``;
225
- }
226
- return html `
227
- <div class="snippyly-plugin-container">
228
- <div class="snippyly-btn-container snippyly-menu-trigger ${classMap({ opened: this.menuOpenedId === 'snippylyMenu' })}" id="snippylyMenu" @click=${() => this.toggleMenu("snippylyMenu")}>
229
- <div class="btn snippyly-btn">
230
- <svg class="snippyly-logo" width="19" height="18" viewBox="0 0 19 18" fill="none" xmlns="http://www.w3.org/2000/svg">
231
- <path d="M7.27564 0.223149C6.79031 0.00346224 6.25358 -0.0557657 5.73589 0.0532382C5.21819 0.162242 4.74372 0.434385 4.37475 0.833949C3.99784 1.2249 3.74112 1.72714 3.63818 2.275C3.53523 2.82287 3.59085 3.39088 3.79775 3.90475C3.99487 4.42252 4.33503 4.86527 4.77372 5.17507C5.21241 5.48487 5.72921 5.64732 6.25653 5.64115H8.91823V2.82595C8.92404 2.26743 8.77031 1.72008 8.4772 1.25563C8.1841 0.791185 7.76528 0.431303 7.27564 0.223149Z" fill="#FFCB00"/>
232
- <path d="M16.9736 3.72115C16.3509 3.06258 15.5579 2.61408 14.6946 2.43229C13.8313 2.25049 12.9365 2.34355 12.1231 2.69972C11.3097 3.05588 10.6143 3.65918 10.1246 4.43343C9.63489 5.20769 9.37289 6.11818 9.37167 7.04995V11.7611H13.8313C14.714 11.771 15.5791 11.4985 16.3131 10.9793C17.0471 10.46 17.616 9.7183 17.9451 8.85115C18.2892 7.9918 18.3806 7.04259 18.2072 6.12744C18.0339 5.21229 17.604 4.3737 16.9736 3.72115Z" fill="#FF7162"/>
233
- <path d="M14.4933 13.9835C14.2962 13.4652 13.956 13.0218 13.5172 12.7114C13.0783 12.401 12.5612 12.2379 12.0334 12.2435H9.37167V15.0611C9.36611 15.6198 9.52006 16.1671 9.81336 16.6316C10.1067 17.096 10.5256 17.4558 11.0154 17.6639C11.3431 17.8099 11.6949 17.8853 12.0504 17.8859C12.4867 17.8813 12.9153 17.7635 13.2987 17.5429C13.682 17.3223 14.0085 17.0057 14.2496 16.6206C14.4906 16.2356 14.6388 15.7939 14.6813 15.3342C14.7238 14.8745 14.6593 14.4107 14.4933 13.9835Z" fill="#0DCF82"/>
234
- <path d="M0.351589 9.03355C0.00514201 9.8932 -0.0880133 10.8436 0.0843205 11.7602C0.256654 12.6768 0.686445 13.517 1.31742 14.1708C1.72451 14.6098 2.20989 14.9589 2.74541 15.1979C3.28094 15.4368 3.85595 15.5608 4.4371 15.5628C5.03193 15.5613 5.62062 15.4353 6.16924 15.192C6.9885 14.8437 7.68929 14.2415 8.17981 13.4645C8.67033 12.6874 8.92771 11.7717 8.91823 10.8372V6.12115H4.46544C3.58239 6.11147 2.71718 6.38434 1.98312 6.90402C1.24906 7.4237 0.680388 8.16595 0.351589 9.03355Z" fill="#A259FE"/>
235
- </svg>
236
- <svg width="8" height="5" viewBox="0 0 8 5" fill="none" xmlns="http://www.w3.org/2000/svg">
237
- <path fill-rule="evenodd" clip-rule="evenodd" d="M3.646 4.354L0.645996 1.354L1.354 0.646004L4 3.293L6.646 0.646004L7.354 1.354L4.354 4.354L4 4.707L3.646 4.354Z" fill="#5B5B5B"/>
238
- </svg>
239
- </div>
240
- <div class="snippyly-menu">
241
- <div class="menu-item" @click=${() => this.toggleSnippylyPluginToolbar()}>${this.expanded ? 'Hide Toolbar' : 'Show Toolbar'}</div>
242
- <div class="menu-item" @click=${() => this.removeSnippyly()}>Exit Review Mode</div>
243
- </div>
244
- </div>
245
- ${this.expanded ?
246
- html `
247
- <div class="btn comment-tool-btn ${classMap({ disabled: !((_a = this.snippylyUser) === null || _a === void 0 ? void 0 : _a.userId) })}">
248
- <snippyly-comment-tool class="custom-tool">
249
- <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" class="btn comment-btn">
250
- <path d="M1.944 16.75L3.64 13.992L3.927 13.527L3.69 13.034C3.225 12.083 2.993 11.124 3 10C3 6.134 6.134 3 10 3C13.866 3 17 6.134 17 10C17 13.866 13.866 17 10 17C8.86 17.007 7.888 16.768 6.926 16.291L6.658 16.16L6.362 16.197L1.944 16.749V16.75ZM6.487 17.19C7.547 17.708 8.74 18 10 18C14.418 18 18 14.418 18 10C18 5.582 14.418 2 10 2C5.582 2 2 5.582 2 10C2 11.243 2.283 12.419 2.789 13.468L0.672 16.908L0 18L1.272 17.841L6.487 17.189V17.19Z" fill="#5B5B5B"/>
251
- </svg>
252
- </snippyly-comment-tool>
253
- </div>
254
- ${((_b = this.comments) === null || _b === void 0 ? void 0 : _b.length) ?
255
- html `
256
- <div class="comments-counter" @click=${() => this.toggleCommentSidebar()}>
257
- ${(_c = this.comments) === null || _c === void 0 ? void 0 : _c.length} ${((_d = this.comments) === null || _d === void 0 ? void 0 : _d.length) === 1 ? 'Comment' : 'Comments'}
258
- </div>
259
- ` : null}
260
- <div class="spacer"></div>
261
- <snippyly-presence max-users="4"></snippyly-presence>
262
- ${!((_e = this.snippylyUser) === null || _e === void 0 ? void 0 : _e.userId) ?
263
- html `
264
- <button class="btn primary-btn signin-btn" @click=${() => this.loginWithGoogle()}>
265
- Sign in
266
- </button>
267
- ` :
268
- html `
269
- <div class="snippyly-btn-container snippyly-menu-trigger">
270
- <button class="btn primary-btn share-btn" @click=${() => this.copyLink()}>
271
- Share
272
- </button>
273
- <div class="snippyly-menu">
274
- <div class="menu-item">${this.copyLinkTooltip}</div>
275
- </div>
276
- </div>
277
- <div class="snippyly-btn-container snippyly-menu-trigger profile-img-container ${classMap({ opened: this.menuOpenedId === 'userMenu' })}" id="userMenu" @click=${() => this.toggleMenu("userMenu")}>
278
- <img src=${(_f = this.snippylyUser) === null || _f === void 0 ? void 0 : _f.photoUrl} class="profile-img" />
279
- <div class="snippyly-menu">
280
- <div class="menu-item" @click=${() => this.signOutUser()}>Sign Out</div>
281
- </div>
282
- </div>
283
- `}
284
- `
285
- : null}
286
- </div>
287
- `;
288
- }
289
- };
290
- SnippylyPlugin.styles = css `
291
- :host(.visible) {
292
- display: flex;
293
- padding: 16px;
294
- border: 1px solid rgba(0, 0, 0, 0.12);
295
- background: white;
296
- border-radius: 8px;
297
- position: fixed;
298
- bottom: 0px;
299
- right: 0px;
300
- margin: 24px;
301
- height: 72px;
302
- box-sizing: border-box;
303
- align-items: center;
304
- z-index: 999999995;
305
- box-shadow: 0 1rem 3rem #0000002d;
306
- }
307
-
308
- :host(.expanded) {
309
- min-width: 450px;
310
- }
311
-
312
- .snippyly-plugin-container {
313
- display: flex;
314
- align-items: center;
315
- width: 100%;
316
- }
317
-
318
- .snippyly-btn, .comment-tool-btn {
319
- height: 28px;
320
- padding: 8px;
321
- border-radius: 8px;
322
- cursor: pointer;
323
- }
324
-
325
- .snippyly-btn:hover, .comment-tool-btn:not(.disabled):hover, .comments-counter:hover {
326
- background: #f0f0f0;
327
- }
328
-
329
- .snippyly-btn {
330
- display: flex;
331
- align-items: center;
332
- }
333
-
334
- .snippyly-logo {
335
- margin-right: 8px;
336
- }
337
-
338
- .comment-tool-btn, .comment-tool-btn .custom-btn-container {
339
- display: flex;
340
- align-items: center;
341
- }
342
-
343
- .comment-tool-btn.disabled, .comment-tool-btn.disabled .btn {
344
- cursor: not-allowed;
345
- }
346
-
347
- .comment-tool-btn.disabled .comment-btn path {
348
- fill: #979797;
349
- }
350
-
351
- .comments-counter {
352
- border: 1px solid #B6B1B1;
353
- border-radius: 6px;
354
- padding: 8px;
355
- cursor: pointer;
356
- }
357
-
358
- .btn {
359
- cursor: pointer;
360
- }
361
-
362
- .primary-btn {
363
- height: 36px;
364
- background: rgb(24, 160, 251);
365
- border-radius: 6px;
366
- border: 0;
367
- box-shadow: none;
368
- outline: none;
369
- padding: 0 12px;
370
- color: white;
371
- /* margin: 0 12px; */
372
- }
373
-
374
- .profile-img-container {
375
- display: flex;
376
- }
377
-
378
- .profile-img {
379
- width: 36px;
380
- height: 36px;
381
- border-radius: 50px;
382
- cursor: pointer;
383
- /* margin: 0 12px; */
384
- }
385
-
386
- .snippyly-plugin-container > * {
387
- margin: 0 6px;
388
- }
389
-
390
- .snippyly-plugin-container > *:first-child {
391
- margin-left: 0px !important;
392
- }
393
-
394
- .snippyly-plugin-container > *:last-child {
395
- margin-right: 0px !important;
396
- }
397
-
398
- .spacer {
399
- flex: 1 0 auto;
400
- }
401
-
402
- .snippyly-menu-trigger {
403
- position: relative;
404
- }
405
-
406
- .snippyly-menu {
407
- position: absolute;
408
- background: black;
409
- color: white;
410
- top: -64px;
411
- left: 50%;
412
- white-space: nowrap;
413
- /* width: 150px; */
414
- transform: translateX(-50%);
415
- display: none;
416
- border-radius: 4px;
417
- }
418
-
419
- .snippyly-menu:after {
420
- content: '';
421
- position: absolute;
422
- display: block;
423
- width: 0px;
424
- z-index: 1;
425
- border-style: solid;
426
- border-color: rgb(0, 0, 0) transparent;
427
- border-width: 12px 8px 0px;
428
- bottom: -12px;
429
- left: 50%;
430
- transform: translateX(-50%);
431
- }
432
-
433
- .snippyly-menu-trigger:hover .snippyly-menu, .snippyly-menu-trigger.opened .snippyly-menu {
434
- display: block;
435
- }
436
-
437
- :host(.expanded) #snippylyMenu.snippyly-menu-trigger .snippyly-menu:after {
438
- left: 32px;
439
- }
440
-
441
- :host(:not(.expanded)) #snippylyMenu.snippyly-menu-trigger .snippyly-menu {
442
- left: -20px;
443
- }
444
-
445
- :host(.expanded) #snippylyMenu.snippyly-menu-trigger .snippyly-menu {
446
- left: 48px;
447
- }
448
-
449
- #snippylyMenu.snippyly-menu-trigger .snippyly-menu {
450
- top: -100px;
451
- }
452
-
453
- :host(:not(.expanded)) #snippylyMenu.snippyly-menu-trigger .snippyly-menu:after {
454
- left: unset;
455
- right: 24px;
456
- }
457
-
458
- .menu-item {
459
- padding: 8px;
460
- cursor: pointer;
461
- }
462
-
463
- .s-presence-container {
464
- display: inline-flex;
465
- flex-direction: row-reverse;
466
- align-items: center;
467
- }
468
-
469
- .s-presence-avatar {
470
- position: relative;
471
- box-shadow: 0px 0px 0px 3px;
472
- border-radius: 50%;
473
- overflow: hidden;
474
- width: 24px;
475
- height: 24px;
476
- display: flex;
477
- align-items: center;
478
- justify-content: center;
479
- font-size: 12px;
480
- // background-color: white;
481
- }
482
-
483
- .s-presence-avatar.more-users {
484
- background: #4578a7;
485
- box-shadow: 0px 0px 0px 3px #4578a7;
486
- }
487
-
488
- .s-presence-avatar:not(:last-child):not(.more-users) {
489
- margin-left: -6px !important;
490
- }
491
-
492
- .s-presence-avatar-image {
493
- width: 100%;
494
- height: auto;
495
- display: block;
496
- }
497
-
498
- .s-presence-avatar-image-small {
499
- width: 1.6rem;
500
- height: auto;
501
- display: block;
502
- }
503
-
504
- .s-presence-avatar-initial {
505
- color: white;
506
- }
507
-
508
- .away {
509
- filter: grayscale(1);
510
- }
511
- `;
512
- __decorate([
513
- state()
514
- ], SnippylyPlugin.prototype, "loadPlugin", null);
515
- __decorate([
516
- state()
517
- ], SnippylyPlugin.prototype, "comments", void 0);
518
- __decorate([
519
- state()
520
- ], SnippylyPlugin.prototype, "commentElement", void 0);
521
- __decorate([
522
- state()
523
- ], SnippylyPlugin.prototype, "_expanded", void 0);
524
- __decorate([
525
- state()
526
- ], SnippylyPlugin.prototype, "snippylyUser", void 0);
527
- __decorate([
528
- property()
529
- ], SnippylyPlugin.prototype, "apiKey", void 0);
530
- __decorate([
531
- state()
532
- ], SnippylyPlugin.prototype, "staging", void 0);
533
- __decorate([
534
- state()
535
- ], SnippylyPlugin.prototype, "menuOpenedId", void 0);
536
- __decorate([
537
- state()
538
- ], SnippylyPlugin.prototype, "copyLinkTooltip", void 0);
539
- SnippylyPlugin = __decorate([
540
- customElement('snippyly-plugin')
541
- ], SnippylyPlugin);
542
- export { SnippylyPlugin };
543
- //# sourceMappingURL=snippyly-plugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"snippyly-plugin.js","sourceRoot":"","sources":["../src/snippyly-plugin.ts"],"names":[],"mappings":";;;;;;AAAA,uDAAuD;AACvD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,YAAY,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAMjH,IAAa,cAAc,GAA3B,MA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;;;qBAGnF,CAAC,CAAC;gBACC,IAAI,CAAA;;+EAEmD,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE;;;;yDAI3C,IAAI,CAAC,eAAe;;;yGAG4B,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,YAAY,KAAK,UAAU,EAAE,CAAC,0BAA0B,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC;uCACnL,MAAA,IAAI,CAAC,YAAY,0CAAE,QAAQ;;gEAEF,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE;;;qBAIpE;iBACH;YACD,CAAC,CAAC,IACN;;SAEH,CAAA;IACL,CAAC;CACJ,CAAA;AArSmB,qBAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6N5B,CAAA;AAxcA;IADC,KAAK,EAAE;gDAGP;AAUQ;IAAR,KAAK,EAAE;gDAAsB;AAErB;IAAR,KAAK,EAAE;sDAAqB;AAG7B;IADC,KAAK,EAAE;iDACiB;AAahB;IAAR,KAAK,EAAE;oDAAmB;AAEf;IAAX,QAAQ,EAAE;8CAAiB;AAEnB;IAAR,KAAK,EAAE;+CAAgC;AAE/B;IAAR,KAAK,EAAE;oDAAuB;AAEtB;IAAR,KAAK,EAAE;uDAA+B;AA1C9B,cAAc;IAD1B,aAAa,CAAC,iBAAiB,CAAC;GACpB,cAAc,CAohB1B;SAphBY,cAAc","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\r\nimport { css, html, LitElement } from 'lit';\r\nimport { customElement, property, state } from 'lit/decorators.js';\r\nimport { classMap } from 'lit/directives/class-map.js';\r\nimport * as Constants from './constants';\r\nimport { SNIPPYLY_LOGIN_BASE_URL, SNIPPYLY_SDK_STAGING } from './environment';\r\nimport { cyrb53, getLocalStorageData, loadSnippyly, removeLocalStorageData, setLocalStorageData } from './utils';\r\n\r\n// eslint-disable-next-line no-var\r\ndeclare var Snippyly: unknown | any;\r\n\r\n@customElement('snippyly-plugin')\r\nexport class SnippylyPlugin extends LitElement {\r\n\r\n private _loadPlugin = false;\r\n @state()\r\n public get loadPlugin() {\r\n return this._loadPlugin;\r\n }\r\n public set loadPlugin(value) {\r\n this._loadPlugin = value;\r\n if (this.loadPlugin) {\r\n this.classList.add('visible');\r\n } else {\r\n this.classList.remove('visible');\r\n }\r\n }\r\n\r\n @state() comments: any[] = [];\r\n\r\n @state() commentElement: any;\r\n\r\n @state()\r\n private _expanded = true;\r\n public get expanded() {\r\n return this._expanded;\r\n }\r\n public set expanded(value) {\r\n this._expanded = value;\r\n if (this.expanded) {\r\n this.classList.add('expanded');\r\n } else {\r\n this.classList.remove('expanded');\r\n }\r\n }\r\n\r\n @state() snippylyUser: any;\r\n\r\n @property() apiKey!: string;\r\n\r\n @state() staging = SNIPPYLY_SDK_STAGING;\r\n\r\n @state() menuOpenedId?: string;\r\n\r\n @state() copyLinkTooltip = 'Copy Link';\r\n\r\n constructor() {\r\n super();\r\n this.expanded = true;\r\n this.setWindowEventListner();\r\n this.urlChangeListener();\r\n this.checkUrl();\r\n\r\n if (SNIPPYLY_SDK_STAGING) {\r\n console.log('*** Staging Mode ON! ***');\r\n }\r\n }\r\n\r\n setWindowEventListner = () => {\r\n window.addEventListener('locationchange', () => {\r\n this.checkUrl();\r\n console.log('location change event', window.location.href);\r\n });\r\n }\r\n\r\n urlChangeListener = () => {\r\n const oldPushState = history.pushState;\r\n history.pushState = function pushState() {\r\n // eslint-disable-next-line prefer-rest-params\r\n const ret = oldPushState.apply(this, arguments as never);\r\n window.dispatchEvent(new Event('pushstate'));\r\n window.dispatchEvent(new Event('locationchange'));\r\n return ret;\r\n };\r\n\r\n const oldReplaceState = history.replaceState;\r\n history.replaceState = function replaceState() {\r\n // eslint-disable-next-line prefer-rest-params\r\n const ret = oldReplaceState.apply(this, arguments as never);\r\n window.dispatchEvent(new Event('replacestate'));\r\n window.dispatchEvent(new Event('locationchange'));\r\n return ret;\r\n };\r\n\r\n window.addEventListener('popstate', () => {\r\n window.dispatchEvent(new Event('locationchange'));\r\n });\r\n }\r\n\r\n checkUrl = () => {\r\n try {\r\n console.log('url in checkUrl', window.location.href);\r\n const url = new URL(document.location as unknown as URL);\r\n const params = url.searchParams;\r\n if (params.has(\"snippyly_google_token\")) {\r\n console.log('token', params.get(\"snippyly_google_token\"))\r\n const user = JSON.parse(atob(params.get(\"snippyly_google_token\")!));\r\n const snippylyUser: any = {};\r\n snippylyUser.userId = user.uid;\r\n snippylyUser.name = user.displayName;\r\n snippylyUser.email = user.email;\r\n snippylyUser.photoUrl = user?.photoURL;\r\n snippylyUser.contacts = (window as any).SNIPPYLY_USER_CONTACTS || [];\r\n // localStorage.setItem(Constants.SNIPPYLY_USER, JSON.stringify(snippylyUser))\r\n setLocalStorageData(Constants.SNIPPYLY_USER, JSON.stringify(snippylyUser), true);\r\n params.delete(\"snippyly_google_token\");\r\n window.history.replaceState({}, document.title, url.href);\r\n }\r\n if (params.has(Constants.REVIEW_MODE)) {\r\n // sessionStorage.setItem(Constants.REVIEW_MODE, 'true');\r\n setLocalStorageData(Constants.REVIEW_MODE, 'true', false, 'sessionStorage');\r\n if (params.has(Constants.REVIEW_DOC_ID)) {\r\n this.loadPluginUI();\r\n } else {\r\n // generate doc id and set it in params\r\n const tempUrl = new URL(document.location as unknown as URL);\r\n tempUrl.searchParams.delete(Constants.REVIEW_MODE);\r\n const docId = cyrb53(tempUrl.href);\r\n params.append(Constants.REVIEW_DOC_ID, `${docId}`);\r\n window.history.replaceState({}, document.title, url.href);\r\n this.loadPluginUI();\r\n }\r\n } else {\r\n // check if review mode is there in session storage\r\n if (getLocalStorageData(Constants.REVIEW_MODE, false, 'sessionStorage')) {\r\n const tempUrl = new URL(document.location as unknown as URL);\r\n tempUrl.searchParams.delete(Constants.REVIEW_MODE);\r\n params.append(Constants.REVIEW_MODE, 'true');\r\n const docId = cyrb53(tempUrl.href);\r\n params.append(Constants.REVIEW_DOC_ID, `${docId}`);\r\n window.history.replaceState({}, document.title, url.href);\r\n this.loadPluginUI();\r\n }\r\n }\r\n } catch (err) {\r\n console.warn('Error in checkUrl: ', err);\r\n }\r\n }\r\n\r\n loadPluginUI = () => {\r\n this.loadPlugin = true;\r\n\r\n const commentTool = document.createElement('snippyly-comments');\r\n window.document.body.appendChild(commentTool);\r\n\r\n const commentSidebar = document.createElement('snippyly-comments-sidebar');\r\n window.document.body.appendChild(commentSidebar);\r\n\r\n const cursorTag = document.createElement('snippyly-cursor');\r\n window.document.body.appendChild(cursorTag);\r\n\r\n loadSnippyly(undefined, this.staging, () => {\r\n if ((window as any).Snippyly) {\r\n console.log('snippyly', Snippyly);\r\n this.initializeSnippyly();\r\n }\r\n })\r\n\r\n }\r\n\r\n initializeSnippyly = async () => {\r\n await Snippyly?.init(\"UnHxMCCFcclkP4bErBL1\");\r\n this.commentElement = Snippyly?.getCommentElement();\r\n if (getLocalStorageData(Constants.SNIPPYLY_USER, true)) {\r\n this.identifySnippyly();\r\n }\r\n }\r\n\r\n identifySnippyly = async () => {\r\n this.snippylyUser = JSON.parse(getLocalStorageData(Constants.SNIPPYLY_USER, true)!);\r\n await Snippyly.identify(this.snippylyUser);\r\n this.getComments();\r\n }\r\n\r\n getComments = () => {\r\n if (this.commentElement) {\r\n this.commentElement.getAllCommentPinAnnotationsOnCurrentDocument().subscribe((comments: any) => {\r\n this.comments = comments;\r\n });\r\n }\r\n }\r\n\r\n toggleCommentSidebar = () => {\r\n if (this.commentElement) {\r\n this.commentElement.toggleCommentSidebar();\r\n }\r\n }\r\n\r\n toggleSnippylyPluginToolbar = () => {\r\n this.expanded = !this.expanded;\r\n }\r\n\r\n loginWithGoogle = () => {\r\n window.open(`${SNIPPYLY_LOGIN_BASE_URL}?redirect_url=${encodeURIComponent(window.location.href)}`, '_self')\r\n }\r\n\r\n removeSnippyly = async () => {\r\n try {\r\n // removeGoogleLoginIframe();\r\n // const element = document.getElementById('snippylyScript');\r\n // if (element) {\r\n // element.remove();\r\n // }\r\n // await Snippyly.signOutUser();\r\n // sessionStorage.removeItem(Constants.REVIEW_MODE);\r\n removeLocalStorageData(Constants.REVIEW_MODE, 'sessionStorage');\r\n const url = new URL(document.location as any);\r\n const params = url.searchParams;\r\n params.delete(Constants.REVIEW_DOC_ID);\r\n params.delete(Constants.REVIEW_MODE);\r\n window.history.replaceState({}, document.title, url.href);\r\n window.location.reload();\r\n } catch (err) {\r\n console.warn('Error in removeSnippyly: ', err);\r\n }\r\n }\r\n\r\n signOutUser = async () => {\r\n await Snippyly.signOutUser();\r\n removeLocalStorageData(Constants.SNIPPYLY_USER);\r\n this.snippylyUser = undefined;\r\n window.open(`${SNIPPYLY_LOGIN_BASE_URL}?signout=true&redirect_url=${encodeURIComponent(window.location.href)}`, '_self')\r\n // window.location.reload();\r\n }\r\n\r\n toggleMenu = (id: string) => {\r\n if (this.menuOpenedId === id) {\r\n this.menuOpenedId = undefined;\r\n } else {\r\n this.menuOpenedId = id;\r\n }\r\n }\r\n\r\n copyLink = () => {\r\n navigator.clipboard.writeText(window.location.href);\r\n this.copyLinkTooltip = 'Copied!';\r\n setTimeout(() => {\r\n this.copyLinkTooltip = 'Copy Link';\r\n }, 2000);\r\n }\r\n\r\n static override styles = css`\r\n :host(.visible) {\r\n display: flex;\r\n padding: 16px;\r\n border: 1px solid rgba(0, 0, 0, 0.12);\r\n background: white;\r\n border-radius: 8px;\r\n position: fixed;\r\n bottom: 0px;\r\n right: 0px;\r\n margin: 24px;\r\n height: 72px;\r\n box-sizing: border-box;\r\n align-items: center;\r\n z-index: 999999995;\r\n box-shadow: 0 1rem 3rem #0000002d;\r\n }\r\n\r\n :host(.expanded) {\r\n min-width: 450px;\r\n }\r\n\r\n .snippyly-plugin-container {\r\n display: flex;\r\n align-items: center;\r\n width: 100%;\r\n }\r\n\r\n .snippyly-btn, .comment-tool-btn {\r\n height: 28px;\r\n padding: 8px;\r\n border-radius: 8px;\r\n cursor: pointer;\r\n }\r\n\r\n .snippyly-btn:hover, .comment-tool-btn:not(.disabled):hover, .comments-counter:hover {\r\n background: #f0f0f0;\r\n }\r\n\r\n .snippyly-btn {\r\n display: flex;\r\n align-items: center;\r\n }\r\n\r\n .snippyly-logo {\r\n margin-right: 8px;\r\n }\r\n\r\n .comment-tool-btn, .comment-tool-btn .custom-btn-container {\r\n display: flex;\r\n align-items: center;\r\n }\r\n\r\n .comment-tool-btn.disabled, .comment-tool-btn.disabled .btn {\r\n cursor: not-allowed; \r\n }\r\n\r\n .comment-tool-btn.disabled .comment-btn path {\r\n fill: #979797;\r\n }\r\n\r\n .comments-counter {\r\n border: 1px solid #B6B1B1;\r\n border-radius: 6px;\r\n padding: 8px;\r\n cursor: pointer;\r\n }\r\n\r\n .btn {\r\n cursor: pointer;\r\n }\r\n\r\n .primary-btn {\r\n height: 36px;\r\n background: rgb(24, 160, 251);\r\n border-radius: 6px;\r\n border: 0;\r\n box-shadow: none;\r\n outline: none;\r\n padding: 0 12px;\r\n color: white;\r\n /* margin: 0 12px; */\r\n }\r\n \r\n .profile-img-container {\r\n display: flex;\r\n }\r\n\r\n .profile-img {\r\n width: 36px;\r\n height: 36px;\r\n border-radius: 50px;\r\n cursor: pointer;\r\n /* margin: 0 12px; */\r\n }\r\n\r\n .snippyly-plugin-container > * {\r\n margin: 0 6px;\r\n }\r\n\r\n .snippyly-plugin-container > *:first-child {\r\n margin-left: 0px !important;\r\n }\r\n\r\n .snippyly-plugin-container > *:last-child {\r\n margin-right: 0px !important;\r\n }\r\n\r\n .spacer {\r\n flex: 1 0 auto;\r\n }\r\n\r\n .snippyly-menu-trigger {\r\n position: relative;\r\n }\r\n\r\n .snippyly-menu {\r\n position: absolute;\r\n background: black;\r\n color: white;\r\n top: -64px;\r\n left: 50%;\r\n white-space: nowrap;\r\n /* width: 150px; */\r\n transform: translateX(-50%);\r\n display: none;\r\n border-radius: 4px;\r\n }\r\n\r\n .snippyly-menu:after {\r\n content: '';\r\n position: absolute;\r\n display: block;\r\n width: 0px;\r\n z-index: 1;\r\n border-style: solid;\r\n border-color: rgb(0, 0, 0) transparent;\r\n border-width: 12px 8px 0px;\r\n bottom: -12px;\r\n left: 50%;\r\n transform: translateX(-50%);\r\n }\r\n\r\n .snippyly-menu-trigger:hover .snippyly-menu, .snippyly-menu-trigger.opened .snippyly-menu {\r\n display: block;\r\n }\r\n\r\n :host(.expanded) #snippylyMenu.snippyly-menu-trigger .snippyly-menu:after {\r\n left: 32px;\r\n }\r\n\r\n :host(:not(.expanded)) #snippylyMenu.snippyly-menu-trigger .snippyly-menu {\r\n left: -20px;\r\n }\r\n\r\n :host(.expanded) #snippylyMenu.snippyly-menu-trigger .snippyly-menu {\r\n left: 48px;\r\n }\r\n\r\n #snippylyMenu.snippyly-menu-trigger .snippyly-menu {\r\n top: -100px;\r\n }\r\n\r\n :host(:not(.expanded)) #snippylyMenu.snippyly-menu-trigger .snippyly-menu:after {\r\n left: unset;\r\n right: 24px;\r\n }\r\n\r\n .menu-item {\r\n padding: 8px;\r\n cursor: pointer;\r\n }\r\n\r\n .s-presence-container {\r\n display: inline-flex;\r\n flex-direction: row-reverse;\r\n align-items: center;\r\n }\r\n\r\n .s-presence-avatar {\r\n position: relative;\r\n box-shadow: 0px 0px 0px 3px;\r\n border-radius: 50%;\r\n overflow: hidden;\r\n width: 24px;\r\n height: 24px;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n font-size: 12px;\r\n // background-color: white;\r\n }\r\n\r\n .s-presence-avatar.more-users {\r\n background: #4578a7;\r\n box-shadow: 0px 0px 0px 3px #4578a7;\r\n }\r\n\r\n .s-presence-avatar:not(:last-child):not(.more-users) {\r\n margin-left: -6px !important;\r\n }\r\n\r\n .s-presence-avatar-image {\r\n width: 100%;\r\n height: auto;\r\n display: block;\r\n }\r\n\r\n .s-presence-avatar-image-small {\r\n width: 1.6rem;\r\n height: auto;\r\n display: block;\r\n }\r\n\r\n .s-presence-avatar-initial {\r\n color: white;\r\n }\r\n\r\n .away {\r\n filter: grayscale(1);\r\n }\r\n `;\r\n\r\n override render() {\r\n if (!this.loadPlugin) {\r\n return html``;\r\n }\r\n return html`\r\n <div class=\"snippyly-plugin-container\">\r\n <div class=\"snippyly-btn-container snippyly-menu-trigger ${classMap({ opened: this.menuOpenedId === 'snippylyMenu' })}\" id=\"snippylyMenu\" @click=${() => this.toggleMenu(\"snippylyMenu\")}>\r\n <div class=\"btn snippyly-btn\">\r\n <svg class=\"snippyly-logo\" width=\"19\" height=\"18\" viewBox=\"0 0 19 18\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path d=\"M7.27564 0.223149C6.79031 0.00346224 6.25358 -0.0557657 5.73589 0.0532382C5.21819 0.162242 4.74372 0.434385 4.37475 0.833949C3.99784 1.2249 3.74112 1.72714 3.63818 2.275C3.53523 2.82287 3.59085 3.39088 3.79775 3.90475C3.99487 4.42252 4.33503 4.86527 4.77372 5.17507C5.21241 5.48487 5.72921 5.64732 6.25653 5.64115H8.91823V2.82595C8.92404 2.26743 8.77031 1.72008 8.4772 1.25563C8.1841 0.791185 7.76528 0.431303 7.27564 0.223149Z\" fill=\"#FFCB00\"/>\r\n <path d=\"M16.9736 3.72115C16.3509 3.06258 15.5579 2.61408 14.6946 2.43229C13.8313 2.25049 12.9365 2.34355 12.1231 2.69972C11.3097 3.05588 10.6143 3.65918 10.1246 4.43343C9.63489 5.20769 9.37289 6.11818 9.37167 7.04995V11.7611H13.8313C14.714 11.771 15.5791 11.4985 16.3131 10.9793C17.0471 10.46 17.616 9.7183 17.9451 8.85115C18.2892 7.9918 18.3806 7.04259 18.2072 6.12744C18.0339 5.21229 17.604 4.3737 16.9736 3.72115Z\" fill=\"#FF7162\"/>\r\n <path d=\"M14.4933 13.9835C14.2962 13.4652 13.956 13.0218 13.5172 12.7114C13.0783 12.401 12.5612 12.2379 12.0334 12.2435H9.37167V15.0611C9.36611 15.6198 9.52006 16.1671 9.81336 16.6316C10.1067 17.096 10.5256 17.4558 11.0154 17.6639C11.3431 17.8099 11.6949 17.8853 12.0504 17.8859C12.4867 17.8813 12.9153 17.7635 13.2987 17.5429C13.682 17.3223 14.0085 17.0057 14.2496 16.6206C14.4906 16.2356 14.6388 15.7939 14.6813 15.3342C14.7238 14.8745 14.6593 14.4107 14.4933 13.9835Z\" fill=\"#0DCF82\"/>\r\n <path d=\"M0.351589 9.03355C0.00514201 9.8932 -0.0880133 10.8436 0.0843205 11.7602C0.256654 12.6768 0.686445 13.517 1.31742 14.1708C1.72451 14.6098 2.20989 14.9589 2.74541 15.1979C3.28094 15.4368 3.85595 15.5608 4.4371 15.5628C5.03193 15.5613 5.62062 15.4353 6.16924 15.192C6.9885 14.8437 7.68929 14.2415 8.17981 13.4645C8.67033 12.6874 8.92771 11.7717 8.91823 10.8372V6.12115H4.46544C3.58239 6.11147 2.71718 6.38434 1.98312 6.90402C1.24906 7.4237 0.680388 8.16595 0.351589 9.03355Z\" fill=\"#A259FE\"/>\r\n </svg>\r\n <svg width=\"8\" height=\"5\" viewBox=\"0 0 8 5\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M3.646 4.354L0.645996 1.354L1.354 0.646004L4 3.293L6.646 0.646004L7.354 1.354L4.354 4.354L4 4.707L3.646 4.354Z\" fill=\"#5B5B5B\"/>\r\n </svg>\r\n </div>\r\n <div class=\"snippyly-menu\">\r\n <div class=\"menu-item\" @click=${() => this.toggleSnippylyPluginToolbar()}>${this.expanded ? 'Hide Toolbar' : 'Show Toolbar'}</div>\r\n <div class=\"menu-item\" @click=${() => this.removeSnippyly()}>Exit Review Mode</div>\r\n </div>\r\n </div>\r\n ${this.expanded ?\r\n html`\r\n <div class=\"btn comment-tool-btn ${classMap({ disabled: !this.snippylyUser?.userId })}\">\r\n <snippyly-comment-tool class=\"custom-tool\">\r\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" class=\"btn comment-btn\">\r\n <path d=\"M1.944 16.75L3.64 13.992L3.927 13.527L3.69 13.034C3.225 12.083 2.993 11.124 3 10C3 6.134 6.134 3 10 3C13.866 3 17 6.134 17 10C17 13.866 13.866 17 10 17C8.86 17.007 7.888 16.768 6.926 16.291L6.658 16.16L6.362 16.197L1.944 16.749V16.75ZM6.487 17.19C7.547 17.708 8.74 18 10 18C14.418 18 18 14.418 18 10C18 5.582 14.418 2 10 2C5.582 2 2 5.582 2 10C2 11.243 2.283 12.419 2.789 13.468L0.672 16.908L0 18L1.272 17.841L6.487 17.189V17.19Z\" fill=\"#5B5B5B\"/>\r\n </svg>\r\n </snippyly-comment-tool>\r\n </div>\r\n ${this.comments?.length ?\r\n html`\r\n <div class=\"comments-counter\" @click=${() => this.toggleCommentSidebar()}>\r\n ${this.comments?.length} ${this.comments?.length === 1 ? 'Comment' : 'Comments'}\r\n </div>\r\n ` : null\r\n }\r\n <div class=\"spacer\"></div>\r\n <snippyly-presence max-users=\"4\"></snippyly-presence>\r\n ${!this.snippylyUser?.userId ?\r\n html`\r\n <button class=\"btn primary-btn signin-btn\" @click=${() => this.loginWithGoogle()}>\r\n Sign in\r\n </button>\r\n ` :\r\n html`\r\n <div class=\"snippyly-btn-container snippyly-menu-trigger\">\r\n <button class=\"btn primary-btn share-btn\" @click=${() => this.copyLink()}>\r\n Share\r\n </button>\r\n <div class=\"snippyly-menu\">\r\n <div class=\"menu-item\">${this.copyLinkTooltip}</div>\r\n </div>\r\n </div>\r\n <div class=\"snippyly-btn-container snippyly-menu-trigger profile-img-container ${classMap({ opened: this.menuOpenedId === 'userMenu' })}\" id=\"userMenu\" @click=${() => this.toggleMenu(\"userMenu\")}>\r\n <img src=${this.snippylyUser?.photoUrl} class=\"profile-img\" />\r\n <div class=\"snippyly-menu\">\r\n <div class=\"menu-item\" @click=${() => this.signOutUser()}>Sign Out</div>\r\n </div>\r\n </div>\r\n `\r\n }\r\n `\r\n : null\r\n }\r\n </div>\r\n `\r\n }\r\n}\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n 'snippyly-comment-tool': any;\r\n }\r\n}"]}
package/utils.d.ts DELETED
@@ -1,6 +0,0 @@
1
- export declare const cyrb53: (str: string, seed?: number) => number;
2
- export declare const loadSnippyly: (version: string | undefined, staging: boolean | undefined, callback: Function) => void;
3
- export declare const setLocalStorageData: (key: string, value: string, encrypted?: boolean, storageType?: 'localStorage' | 'sessionStorage') => void;
4
- export declare const getLocalStorageData: (key: string, encrypted?: boolean, storageType?: 'localStorage' | 'sessionStorage') => string | null;
5
- export declare const removeLocalStorageData: (key: string, storageType?: 'localStorage' | 'sessionStorage') => void;
6
- //# sourceMappingURL=utils.d.ts.map
package/utils.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM,QAAS,MAAM,0BAgBjC,CAAC;AAEF,eAAO,MAAM,YAAY,wEAAmD,QAAQ,SAmBnF,CAAC;AAEF,eAAO,MAAM,mBAAmB,QAAS,MAAM,SAAS,MAAM,qCAAkC,cAAc,GAAG,gBAAgB,SAWhI,CAAA;AAED,eAAO,MAAM,mBAAmB,QAAS,MAAM,qCAAkC,cAAc,GAAG,gBAAgB,kBAajH,CAAA;AAED,eAAO,MAAM,sBAAsB,QAAS,MAAM,gBAAe,cAAc,GAAG,gBAAgB,SAUjG,CAAA"}
package/utils.js DELETED
@@ -1,82 +0,0 @@
1
- export const cyrb53 = (str, seed = 0) => {
2
- try {
3
- let h1 = 0xdeadbeef ^ seed, h2 = 0x41c6ce57 ^ seed;
4
- for (let i = 0, ch; i < str.length; i++) {
5
- ch = str.charCodeAt(i);
6
- h1 = Math.imul(h1 ^ ch, 2654435761);
7
- h2 = Math.imul(h2 ^ ch, 1597334677);
8
- }
9
- h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^ Math.imul(h2 ^ (h2 >>> 13), 3266489909);
10
- h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^ Math.imul(h1 ^ (h1 >>> 13), 3266489909);
11
- return 4294967296 * (2097151 & h2) + (h1 >>> 0);
12
- }
13
- catch (err) {
14
- console.warn('Error in cyrb53: ', err);
15
- return 0;
16
- }
17
- };
18
- export const loadSnippyly = (version = 'latest', staging = false, callback) => {
19
- console.log('load snippyly called');
20
- const existingScript = document.getElementById('snippylyScript');
21
- if (!existingScript) {
22
- const script = document.createElement('script');
23
- script.src = `https://cdn.jsdelivr.net/npm/@snippyly/sdk${staging ? '-staging' : ''}@${version || 'latest'}/snippyly.js`;
24
- script.id = 'snippylyScript';
25
- script.type = 'module';
26
- document.body.appendChild(script);
27
- script.onload = () => {
28
- if (callback) {
29
- callback();
30
- }
31
- };
32
- }
33
- else {
34
- if (callback) {
35
- callback();
36
- }
37
- }
38
- };
39
- export const setLocalStorageData = (key, value, encrypted = false, storageType = 'localStorage') => {
40
- try {
41
- const data = encrypted ? btoa(value) : value;
42
- if (storageType === 'localStorage') {
43
- localStorage.setItem(key, data);
44
- }
45
- else {
46
- sessionStorage.setItem(key, data);
47
- }
48
- }
49
- catch (err) {
50
- console.warn('Error in setLocalStorage: ', err);
51
- }
52
- };
53
- export const getLocalStorageData = (key, encrypted = false, storageType = 'localStorage') => {
54
- try {
55
- let data = null;
56
- if (storageType === 'localStorage') {
57
- data = localStorage.getItem(key);
58
- }
59
- else {
60
- data = sessionStorage.getItem(key);
61
- }
62
- return (data && encrypted) ? atob(data) : data;
63
- }
64
- catch (err) {
65
- console.warn('Error in getLocalStorage: ', err);
66
- return null;
67
- }
68
- };
69
- export const removeLocalStorageData = (key, storageType = 'localStorage') => {
70
- try {
71
- if (storageType === 'localStorage') {
72
- localStorage.removeItem(key);
73
- }
74
- else {
75
- sessionStorage.removeItem(key);
76
- }
77
- }
78
- catch (err) {
79
- console.warn('Error in removeLocalStorageData: ', err);
80
- }
81
- };
82
- //# sourceMappingURL=utils.js.map
package/utils.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,GAAW,EAAE,IAAI,GAAG,CAAC,EAAE,EAAE;IAC5C,IAAI;QACA,IAAI,EAAE,GAAG,UAAU,GAAG,IAAI,EACtB,EAAE,GAAG,UAAU,GAAG,IAAI,CAAC;QAC3B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACrC,EAAE,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;YACvB,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,EAAE,UAAU,CAAC,CAAC;YACpC,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,EAAE,UAAU,CAAC,CAAC;SACvC;QACD,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC;QACvF,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC;QACvF,OAAO,UAAU,GAAG,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AC,CAAA","sourcesContent":["export const cyrb53 = (str: string, seed = 0) => {\r\n try {\r\n let h1 = 0xdeadbeef ^ seed,\r\n h2 = 0x41c6ce57 ^ seed;\r\n for (let i = 0, ch; i < str.length; i++) {\r\n ch = str.charCodeAt(i);\r\n h1 = Math.imul(h1 ^ ch, 2654435761);\r\n h2 = Math.imul(h2 ^ ch, 1597334677);\r\n }\r\n h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^ Math.imul(h2 ^ (h2 >>> 13), 3266489909);\r\n h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^ Math.imul(h1 ^ (h1 >>> 13), 3266489909);\r\n return 4294967296 * (2097151 & h2) + (h1 >>> 0);\r\n } catch (err) {\r\n console.warn('Error in cyrb53: ', err);\r\n return 0;\r\n }\r\n};\r\n\r\nexport const loadSnippyly = (version = 'latest', staging = false, callback: Function) => {\r\n console.log('load snippyly called')\r\n const existingScript = document.getElementById('snippylyScript');\r\n if (!existingScript) {\r\n const script = document.createElement('script');\r\n script.src = `https://cdn.jsdelivr.net/npm/@snippyly/sdk${staging ? '-staging' : ''}@${version || 'latest'}/snippyly.js`;\r\n script.id = 'snippylyScript';\r\n script.type = 'module';\r\n document.body.appendChild(script);\r\n script.onload = () => {\r\n if (callback) {\r\n callback();\r\n }\r\n };\r\n } else {\r\n if (callback) {\r\n callback();\r\n }\r\n }\r\n};\r\n\r\nexport const setLocalStorageData = (key: string, value: string, encrypted = false, storageType: 'localStorage' | 'sessionStorage' = 'localStorage') => {\r\n try {\r\n const data = encrypted ? btoa(value) : value;\r\n if (storageType === 'localStorage') {\r\n localStorage.setItem(key, data);\r\n } else {\r\n sessionStorage.setItem(key, data);\r\n }\r\n } catch (err) {\r\n console.warn('Error in setLocalStorage: ', err);\r\n }\r\n}\r\n\r\nexport const getLocalStorageData = (key: string, encrypted = false, storageType: 'localStorage' | 'sessionStorage' = 'localStorage') => {\r\n try {\r\n let data = null;\r\n if (storageType === 'localStorage') {\r\n data = localStorage.getItem(key);\r\n } else {\r\n data = sessionStorage.getItem(key);\r\n }\r\n return (data && encrypted) ? atob(data) : data;\r\n } catch (err) {\r\n console.warn('Error in getLocalStorage: ', err);\r\n return null;\r\n }\r\n}\r\n\r\nexport const removeLocalStorageData = (key: string, storageType: 'localStorage' | 'sessionStorage' = 'localStorage') => {\r\n try {\r\n if (storageType === 'localStorage') {\r\n localStorage.removeItem(key);\r\n } else {\r\n sessionStorage.removeItem(key);\r\n }\r\n } catch (err) {\r\n console.warn('Error in removeLocalStorageData: ', err);\r\n }\r\n}"]}