@snippyly/plugin-staging 1.0.57 → 1.0.58

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/snippyly.js +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snippyly/plugin-staging",
3
- "version": "1.0.57",
3
+ "version": "1.0.58",
4
4
  "description": "",
5
5
  "main": "snippyly.js",
6
6
  "scripts": {
package/snippyly.js CHANGED
@@ -637,7 +637,7 @@ const et=(t=>(...i)=>({_$litDirective$:t,values:i}))(class extends class{constru
637
637
  padding: 0px 2px;
638
638
  }
639
639
  }
640
- `;var wt=function(t,i,o,e){for(var s,n=arguments.length,r=n<3?i:null===e?e=Object.getOwnPropertyDescriptor(i,o):e,l=t.length-1;l>=0;l--)(s=t[l])&&(r=(n<3?s(r):n>3?s(i,o,r):s(i,o))||r);return n>3&&r&&Object.defineProperty(i,o,r),r};let Ct=class extends X{constructor(){var t,i,o,e,s;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.exitReviewModeCalled=!1,this.addWindowClickEventListener=()=>{try{this.windowClickEventListener||(this.windowClickEventListener=()=>{this.menuOpenedId&&(this.menuOpenedId=void 0)},window.addEventListener("click",this.windowClickEventListener))}catch(t){console.warn("Error in addWindowClickEventListener: ",t)}},this.removeWindowClickEventListener=()=>{try{window.removeEventListener("click",this.windowClickEventListener),this.windowClickEventListener=void 0}catch(t){console.warn("Error in removeWindowClickEventListener: ",t)}},this.setWindowEventListner=()=>{try{window.addEventListener("locationchange",(()=>{this.checkUrl()}))}catch(t){console.warn("Error in setWindowEventListner: ",t)}},this.urlChangeListener=()=>{try{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"))}))}catch(t){console.warn("Error in urlChangeListener: ",t)}},this.checkUrl=()=>{var t;try{const i=new URL(document.location),o=i.searchParams;if(o.has("snippyly_google_token")){const e=JSON.parse(atob(o.get("snippyly_google_token"))),s={},n=(null===(t=e.providerData)||void 0===t?void 0:t.length)?e.providerData[0]:null;s.userId=e.uid,s.name=e.displayName||(null==n?void 0:n.displayName),s.email=e.email||(null==n?void 0:n.email),s.photoUrl=(null==e?void 0:e.photoURL)||(null==n?void 0:n.photoURL),ht("snippyly-user",JSON.stringify(s),!0),o.delete("snippyly_google_token"),window.history.replaceState({},document.title,i.href)}o.has("review")?(ht("review","true",!1,"sessionStorage"),"true"!==o.get("review")&&(o.delete("review"),o.append("review","true"),window.history.replaceState({},document.title,i.href)),this.loadPluginUI()):pt("review",!1,"sessionStorage")&&(o.append("review","true"),window.history.replaceState({},document.title,i.href),this.loadPluginUI()),this.setVersionInUrl()}catch(t){console.warn("Error in checkUrl: ",t)}},this.detectVersion=()=>{try{if(this.projectVersionKey){const t=new URL(document.location).searchParams;if(t.get(this.projectVersionKey))this.projectVersion=t.get(this.projectVersionKey);else if(window.snippylyInitialLoadUrl){const t=new URL(window.snippylyInitialLoadUrl).searchParams;t.get(this.projectVersionKey)&&(this.projectVersion=t.get(this.projectVersionKey))}this.projectVersion&&ht("projectVersion",this.projectVersion,!1,"sessionStorage")}else{const t=new URL(document.location).searchParams;t.has("review")&&t.has("sversion")&&(ht("projectVersionKey","sversion",!1,"sessionStorage"),this.projectVersion=t.get("sversion"),this.projectVersion&&ht("projectVersion",this.projectVersion,!1,"sessionStorage"))}}catch(t){console.warn("Error in detectVersion: ",t)}},this.setVersionInUrl=()=>{try{const t=this.projectVersionKey||pt("projectVersionKey",!1,"sessionStorage"),i=this.projectVersion||pt("projectVersion",!1,"sessionStorage");if(t&&i){const o=new URL(document.location),e=o.searchParams;e.get(t)||(e.set(t,i),window.history.replaceState({},document.title,o.href))}}catch(t){console.warn("Error in setVersionInUrl: ",t)}},this.loadPluginUI=()=>{try{if(this.loadPlugin)return this.generateLocation(),void this.setViewMode(this.viewMode);if(this.loadPlugin=!0,!document.querySelector(nt)){const t=document.createElement(nt);null==t||t.addEventListener("signIn",(()=>{this.loginWithGoogle()})),window.document.body.appendChild(t)}if(!document.querySelector(rt)){const t=document.createElement(rt);t.setAttribute(ct,"true"),window.document.body.appendChild(t)}if(!document.querySelector(st)){const t=document.createElement(st);window.document.body.appendChild(t)}if(!document.querySelector(lt)){const t=document.createElement(lt);window.document.body.appendChild(t)}if(!document.querySelector(at)){const t=document.createElement(at);window.document.body.appendChild(t)}if(!document.querySelector(dt)){const t=document.createElement(dt);window.document.body.appendChild(t)}((t="",i=!1,o)=>{if(console.log("load snippyly called"),document.getElementById("snippylyScript"))o&&o();else{const e=document.createElement("script");e.src=`https://cdn.jsdelivr.net/npm/@snippyly/sdk${i?"-staging":""}${t?"@"+t:""}/snippyly.js`,e.id="snippylyScript",e.type="module",document.body.appendChild(e),e.onload=()=>{o&&o()}}})(void 0,this.staging,(()=>{window.Snippyly&&this.initializeSnippyly()}))}catch(t){console.warn("Error in loadPluginUI: ",t)}},this.initializeSnippyly=async()=>{try{await(null===Snippyly||void 0===Snippyly?void 0:Snippyly.init(this.apiKey)),this.documentId=((t,i=0)=>{try{let o=3735928559^i,e=1103547991^i;for(let i,s=0;s<t.length;s++)i=t.charCodeAt(s),o=Math.imul(o^i,2654435761),e=Math.imul(e^i,1597334677);return o=Math.imul(o^o>>>16,2246822507)^Math.imul(e^e>>>13,3266489909),e=Math.imul(e^e>>>16,2246822507)^Math.imul(o^o>>>13,3266489909),4294967296*(2097151&e)+(o>>>0)}catch(t){return console.warn("Error in cyrb53: ",t),0}})((t=>{let i;return i=t.includes("http")?new URL(t):new URL("http://"+t),i.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.showCommentIndex(!0),this.commentElement.addCommentModeChange&&this.commentElement.addCommentModeChange().subscribe((t=>{this.addCommentMode=t}))),this.selectionElement=Snippyly.getSelectionElement(),this.selectionElement&&this.selectionElement.enableLiveSelection(!0),this.identifySnippyly()}catch(t){console.warn("Error in initializeSnippyly: ",t)}},this.generateLocation=()=>{try{const t=new URL(document.location).searchParams,i=new URL(document.location);i.searchParams.delete("review"),i.searchParams.delete("sreviewId"),i.searchParams.delete("scommentId");const o=t.get("sversion")||this.projectVersion;this.location={url:yt(i.href),version:o}}catch(t){console.warn("Error in generateLocation: ",t)}},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(t){console.warn("Error in setLocation: ",t)}},this.identifySnippyly=async()=>{var t,i;try{this.invalidApiKey=!1;let i={name:"Anonymous User",email:"anonymous@snippyly.com",userId:"anonymous",isAnonymous:!0};if(pt("snippyly-user",!0)){const t=JSON.parse(pt("snippyly-user",!0));(null==t?void 0:t.email)&&(i=t)}i.isAnonymous?delete i.groupId:i.groupId=Snippyly.getDocumentId()+"",(null===(t=null==i?void 0:i.contacts)||void 0===t?void 0:t.length)&&(i.contacts=[]),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((t=>{this.comments=t,"All"!==this.viewMode&&(this.viewMode?this.comments=t.filter((t=>{var i;return(null===(i=null==t?void 0:t.location)||void 0===i?void 0:i.view)===this.viewMode})):this.comments=this.comments.filter((t=>{var i;return!(null===(i=null==t?void 0:t.location)||void 0===i?void 0:i.view)})))})))}catch(t){console.warn("Error in getComments: ",t)}},this.checkGlobalUserContact=()=>{try{this.commentElement&&this.commentElement.isUserGlobalContact().subscribe((t=>{!this.isUserGlobalContact&&t&&this.setViewMode("All"),this.isUserGlobalContact=t,t||this.setViewMode(null)}))}catch(t){console.warn("Error in checkGlobalUserContact: ",t)}},this.toggleCommentSidebar=()=>{try{this.commentElement&&this.commentElement.toggleCommentSidebar()}catch(t){console.warn("Error in toggleCommentSidebar: ",t)}},this.toggleSnippylyPluginToolbar=()=>{try{this.expanded=!this.expanded}catch(t){console.warn("Error in toggleSnippylyPluginToolbar: ",t)}},this.loginWithGoogle=()=>{try{window.open(`https://snippyly-login-staging.web.app/?redirect_url=${encodeURIComponent(window.location.href)}`,"_self")}catch(t){console.warn("Error in loginWithGoogle: ",t)}},this.removeSnippyly=async()=>{try{this.exitReviewModeCalled=!0,vt("review","sessionStorage"),vt("sreviewId","sessionStorage"),vt("projectVersionKey","sessionStorage"),vt("projectVersion","sessionStorage");const t=new URL(document.location),i=t.searchParams;i.delete("sreviewId"),i.delete("review"),this.projectVersionKey&&i.delete(this.projectVersionKey),i.delete("sversion"),this.projectVersion=void 0,this.projectVersionKey=void 0,delete window.snippylyInitialLoadUrl,window.history.replaceState({},document.title,t.href),window.location.reload()}catch(t){console.warn("Error in removeSnippyly: ",t)}},this.signOutUser=async()=>{try{await Snippyly.signOutUser(),vt("snippyly-user"),this.snippylyUser=void 0,window.open(`https://snippyly-login-staging.web.app/?signout=true&redirect_url=${encodeURIComponent(window.location.href)}`,"_self")}catch(t){console.warn("Error in signOutUser: ",t)}},this.toggleMenu=(t,i)=>{try{t.stopPropagation(),this.menuOpenedId===i?this.menuOpenedId=void 0:this.menuOpenedId=i}catch(t){console.warn("Error in toggleMenu: ",t)}},this.copyLink=()=>{try{navigator.clipboard.writeText(window.location.href),this.copyLinkTooltip="Link copied!",setTimeout((()=>{this.copyLinkTooltip="Copy Link"}),2e3)}catch(t){console.warn("Error in copyLink: ",t)}},this.setViewMode=t=>{try{this.viewMode=t,t?this.location.view=t:delete this.location.view,this.setLocation(),this.getComments()}catch(t){console.warn("Error in setViewMode: ",t)}},this.setAttribute("snippyly-comment-disabled","true"),null===(i=null===(t=null===document||void 0===document?void 0:document.body)||void 0===t?void 0:t.style)||void 0===i||i.setProperty("transform","none","important"),null===(s=null===(e=null===(o=null===document||void 0===document?void 0:document.body)||void 0===o?void 0:o.parentElement)||void 0===e?void 0:e.style)||void 0===s||s.setProperty("transform","none","important");try{this.expanded=!0,this.detectVersion(),this.setWindowEventListner(),this.urlChangeListener(),this.checkUrl(),console.log("*** Staging Mode ON! ***")}catch(t){console.warn("Error in constructor: ",t)}}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")}get projectVersionKey(){return this._projectVersionKey}set projectVersionKey(t){try{this._projectVersionKey=t,this.projectVersionKey&&ht("projectVersionKey",this.projectVersionKey,!1,"sessionStorage"),this.exitReviewModeCalled||this.detectVersion()}catch(t){console.warn("Error in set projectVersionKey: ",t)}}get menuOpenedId(){return this._menuOpenedId}set menuOpenedId(t){this._menuOpenedId=t,this.menuOpenedId?this.addWindowClickEventListener():this.removeWindowClickEventListener()}render(){var t,i,o,e,s,n,r;return this.loadPlugin?this.snippylyUser?_`
640
+ `;var wt=function(t,i,o,e){for(var s,n=arguments.length,r=n<3?i:null===e?e=Object.getOwnPropertyDescriptor(i,o):e,l=t.length-1;l>=0;l--)(s=t[l])&&(r=(n<3?s(r):n>3?s(i,o,r):s(i,o))||r);return n>3&&r&&Object.defineProperty(i,o,r),r};let Ct=class extends X{constructor(){var t,i,o,e,s;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.exitReviewModeCalled=!1,this.addWindowClickEventListener=()=>{try{this.windowClickEventListener||(this.windowClickEventListener=()=>{this.menuOpenedId&&(this.menuOpenedId=void 0)},window.addEventListener("click",this.windowClickEventListener))}catch(t){console.warn("Error in addWindowClickEventListener: ",t)}},this.removeWindowClickEventListener=()=>{try{window.removeEventListener("click",this.windowClickEventListener),this.windowClickEventListener=void 0}catch(t){console.warn("Error in removeWindowClickEventListener: ",t)}},this.setWindowEventListner=()=>{try{window.addEventListener("locationchange",(()=>{this.checkUrl()}))}catch(t){console.warn("Error in setWindowEventListner: ",t)}},this.urlChangeListener=()=>{try{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"))}))}catch(t){console.warn("Error in urlChangeListener: ",t)}},this.checkUrl=()=>{try{const t=new URL(document.location),i=t.searchParams;if(i.has("snippyly_google_token")){const o=JSON.parse(atob(i.get("snippyly_google_token"))),e={};e.userId=o.uid,e.name=o.displayName,e.email=o.email,e.photoUrl=null==o?void 0:o.photoURL,ht("snippyly-user",JSON.stringify(e),!0),i.delete("snippyly_google_token"),window.history.replaceState({},document.title,t.href)}i.has("review")?(ht("review","true",!1,"sessionStorage"),"true"!==i.get("review")&&(i.delete("review"),i.append("review","true"),window.history.replaceState({},document.title,t.href)),this.loadPluginUI()):pt("review",!1,"sessionStorage")&&(i.append("review","true"),window.history.replaceState({},document.title,t.href),this.loadPluginUI()),this.setVersionInUrl()}catch(t){console.warn("Error in checkUrl: ",t)}},this.detectVersion=()=>{try{if(this.projectVersionKey){const t=new URL(document.location).searchParams;if(t.get(this.projectVersionKey))this.projectVersion=t.get(this.projectVersionKey);else if(window.snippylyInitialLoadUrl){const t=new URL(window.snippylyInitialLoadUrl).searchParams;t.get(this.projectVersionKey)&&(this.projectVersion=t.get(this.projectVersionKey))}this.projectVersion&&ht("projectVersion",this.projectVersion,!1,"sessionStorage")}else{const t=new URL(document.location).searchParams;t.has("review")&&t.has("sversion")&&(ht("projectVersionKey","sversion",!1,"sessionStorage"),this.projectVersion=t.get("sversion"),this.projectVersion&&ht("projectVersion",this.projectVersion,!1,"sessionStorage"))}}catch(t){console.warn("Error in detectVersion: ",t)}},this.setVersionInUrl=()=>{try{const t=this.projectVersionKey||pt("projectVersionKey",!1,"sessionStorage"),i=this.projectVersion||pt("projectVersion",!1,"sessionStorage");if(t&&i){const o=new URL(document.location),e=o.searchParams;e.get(t)||(e.set(t,i),window.history.replaceState({},document.title,o.href))}}catch(t){console.warn("Error in setVersionInUrl: ",t)}},this.loadPluginUI=()=>{try{if(this.loadPlugin)return this.generateLocation(),void this.setViewMode(this.viewMode);if(this.loadPlugin=!0,!document.querySelector(nt)){const t=document.createElement(nt);null==t||t.addEventListener("signIn",(()=>{this.loginWithGoogle()})),window.document.body.appendChild(t)}if(!document.querySelector(rt)){const t=document.createElement(rt);t.setAttribute(ct,"true"),window.document.body.appendChild(t)}if(!document.querySelector(st)){const t=document.createElement(st);window.document.body.appendChild(t)}if(!document.querySelector(lt)){const t=document.createElement(lt);window.document.body.appendChild(t)}if(!document.querySelector(at)){const t=document.createElement(at);window.document.body.appendChild(t)}if(!document.querySelector(dt)){const t=document.createElement(dt);window.document.body.appendChild(t)}((t="",i=!1,o)=>{if(console.log("load snippyly called"),document.getElementById("snippylyScript"))o&&o();else{const e=document.createElement("script");e.src=`https://cdn.jsdelivr.net/npm/@snippyly/sdk${i?"-staging":""}${t?"@"+t:""}/snippyly.js`,e.id="snippylyScript",e.type="module",document.body.appendChild(e),e.onload=()=>{o&&o()}}})(void 0,this.staging,(()=>{window.Snippyly&&this.initializeSnippyly()}))}catch(t){console.warn("Error in loadPluginUI: ",t)}},this.initializeSnippyly=async()=>{try{await(null===Snippyly||void 0===Snippyly?void 0:Snippyly.init(this.apiKey)),this.documentId=((t,i=0)=>{try{let o=3735928559^i,e=1103547991^i;for(let i,s=0;s<t.length;s++)i=t.charCodeAt(s),o=Math.imul(o^i,2654435761),e=Math.imul(e^i,1597334677);return o=Math.imul(o^o>>>16,2246822507)^Math.imul(e^e>>>13,3266489909),e=Math.imul(e^e>>>16,2246822507)^Math.imul(o^o>>>13,3266489909),4294967296*(2097151&e)+(o>>>0)}catch(t){return console.warn("Error in cyrb53: ",t),0}})((t=>{let i;return i=t.includes("http")?new URL(t):new URL("http://"+t),i.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.showCommentIndex(!0),this.commentElement.addCommentModeChange&&this.commentElement.addCommentModeChange().subscribe((t=>{this.addCommentMode=t}))),this.selectionElement=Snippyly.getSelectionElement(),this.selectionElement&&this.selectionElement.enableLiveSelection(!0),this.identifySnippyly()}catch(t){console.warn("Error in initializeSnippyly: ",t)}},this.generateLocation=()=>{try{const t=new URL(document.location).searchParams,i=new URL(document.location);i.searchParams.delete("review"),i.searchParams.delete("sreviewId"),i.searchParams.delete("scommentId");const o=t.get("sversion")||this.projectVersion;this.location={url:yt(i.href),version:o}}catch(t){console.warn("Error in generateLocation: ",t)}},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(t){console.warn("Error in setLocation: ",t)}},this.identifySnippyly=async()=>{var t,i;try{this.invalidApiKey=!1;let i={name:"Anonymous User",email:"anonymous@snippyly.com",userId:"anonymous",isAnonymous:!0};if(pt("snippyly-user",!0)){const t=JSON.parse(pt("snippyly-user",!0));(null==t?void 0:t.email)&&(i=t)}i.isAnonymous?delete i.groupId:i.groupId=Snippyly.getDocumentId()+"",(null===(t=null==i?void 0:i.contacts)||void 0===t?void 0:t.length)&&(i.contacts=[]),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((t=>{this.comments=t,"All"!==this.viewMode&&(this.viewMode?this.comments=t.filter((t=>{var i;return(null===(i=null==t?void 0:t.location)||void 0===i?void 0:i.view)===this.viewMode})):this.comments=this.comments.filter((t=>{var i;return!(null===(i=null==t?void 0:t.location)||void 0===i?void 0:i.view)})))})))}catch(t){console.warn("Error in getComments: ",t)}},this.checkGlobalUserContact=()=>{try{this.commentElement&&this.commentElement.isUserGlobalContact().subscribe((t=>{!this.isUserGlobalContact&&t&&this.setViewMode("All"),this.isUserGlobalContact=t,t||this.setViewMode(null)}))}catch(t){console.warn("Error in checkGlobalUserContact: ",t)}},this.toggleCommentSidebar=()=>{try{this.commentElement&&this.commentElement.toggleCommentSidebar()}catch(t){console.warn("Error in toggleCommentSidebar: ",t)}},this.toggleSnippylyPluginToolbar=()=>{try{this.expanded=!this.expanded}catch(t){console.warn("Error in toggleSnippylyPluginToolbar: ",t)}},this.loginWithGoogle=()=>{try{window.open(`https://snippyly-login-staging.web.app/?redirect_url=${encodeURIComponent(window.location.href)}`,"_self")}catch(t){console.warn("Error in loginWithGoogle: ",t)}},this.removeSnippyly=async()=>{try{this.exitReviewModeCalled=!0,vt("review","sessionStorage"),vt("sreviewId","sessionStorage"),vt("projectVersionKey","sessionStorage"),vt("projectVersion","sessionStorage");const t=new URL(document.location),i=t.searchParams;i.delete("sreviewId"),i.delete("review"),this.projectVersionKey&&i.delete(this.projectVersionKey),i.delete("sversion"),this.projectVersion=void 0,this.projectVersionKey=void 0,delete window.snippylyInitialLoadUrl,window.history.replaceState({},document.title,t.href),window.location.reload()}catch(t){console.warn("Error in removeSnippyly: ",t)}},this.signOutUser=async()=>{try{await Snippyly.signOutUser(),vt("snippyly-user"),this.snippylyUser=void 0,window.open(`https://snippyly-login-staging.web.app/?signout=true&redirect_url=${encodeURIComponent(window.location.href)}`,"_self")}catch(t){console.warn("Error in signOutUser: ",t)}},this.toggleMenu=(t,i)=>{try{t.stopPropagation(),this.menuOpenedId===i?this.menuOpenedId=void 0:this.menuOpenedId=i}catch(t){console.warn("Error in toggleMenu: ",t)}},this.copyLink=()=>{try{navigator.clipboard.writeText(window.location.href),this.copyLinkTooltip="Link copied!",setTimeout((()=>{this.copyLinkTooltip="Copy Link"}),2e3)}catch(t){console.warn("Error in copyLink: ",t)}},this.setViewMode=t=>{try{this.viewMode=t,t?this.location.view=t:delete this.location.view,this.setLocation(),this.getComments()}catch(t){console.warn("Error in setViewMode: ",t)}},this.setAttribute("snippyly-comment-disabled","true"),null===(i=null===(t=null===document||void 0===document?void 0:document.body)||void 0===t?void 0:t.style)||void 0===i||i.setProperty("transform","none","important"),null===(s=null===(e=null===(o=null===document||void 0===document?void 0:document.body)||void 0===o?void 0:o.parentElement)||void 0===e?void 0:e.style)||void 0===s||s.setProperty("transform","none","important");try{this.expanded=!0,this.detectVersion(),this.setWindowEventListner(),this.urlChangeListener(),this.checkUrl(),console.log("*** Staging Mode ON! ***")}catch(t){console.warn("Error in constructor: ",t)}}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")}get projectVersionKey(){return this._projectVersionKey}set projectVersionKey(t){try{this._projectVersionKey=t,this.projectVersionKey&&ht("projectVersionKey",this.projectVersionKey,!1,"sessionStorage"),this.exitReviewModeCalled||this.detectVersion()}catch(t){console.warn("Error in set projectVersionKey: ",t)}}get menuOpenedId(){return this._menuOpenedId}set menuOpenedId(t){this._menuOpenedId=t,this.menuOpenedId?this.addWindowClickEventListener():this.removeWindowClickEventListener()}render(){var t,i,o,e,s,n,r;return this.loadPlugin?this.snippylyUser?_`
641
641
  <div class="snippyly-plugin-container">
642
642
  <div class="toolbar ${et({expanded:this.expanded})}">
643
643