@nylas/react 1.1.0-canary.5 → 1.1.0-canary.7

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 (96) hide show
  1. package/dist/{elements-dc5b338e-e87f79b6.js → elements-dc5b338e-6078b875.js} +1 -1
  2. package/dist/{elements-dc5b338e-29ef67ec.cjs → elements-dc5b338e-96e197ca.cjs} +1 -1
  3. package/dist/{focus-visible-e8093c16-61d506d2.cjs → focus-visible-e8093c16-018ffd63.cjs} +1 -1
  4. package/dist/{focus-visible-e8093c16-e7357f74.js → focus-visible-e8093c16-ab01d60a.js} +1 -1
  5. package/dist/{index-f9ba9aa8.js → index-1fd24ccf.js} +1039 -1428
  6. package/dist/index-823fdc6f.cjs +36 -0
  7. package/dist/react.cjs +1 -1
  8. package/dist/react.js +52 -52
  9. package/package.json +3 -3
  10. package/dist/add-circle-icon_22.entry-9f634efd.js +0 -1731
  11. package/dist/add-circle-icon_22.entry-e7ec6c34.cjs +0 -1
  12. package/dist/archive-icon_7.entry-24bac466.js +0 -75
  13. package/dist/archive-icon_7.entry-6649ed76.cjs +0 -1
  14. package/dist/arrow-icon.entry-1fffd526.cjs +0 -1
  15. package/dist/arrow-icon.entry-82e59ce4.js +0 -15
  16. package/dist/bold-icon_3.entry-5a01fecf.cjs +0 -1
  17. package/dist/bold-icon_3.entry-72e585da.js +0 -35
  18. package/dist/calendar-cancel-icon.entry-0b52bdc9.cjs +0 -1
  19. package/dist/calendar-cancel-icon.entry-247b530c.js +0 -15
  20. package/dist/calendar-check-icon_2.entry-d7bb76c7.cjs +0 -1
  21. package/dist/calendar-check-icon_2.entry-dbb2df49.js +0 -25
  22. package/dist/calendar-icon.entry-911773c4.cjs +0 -1
  23. package/dist/calendar-icon.entry-d64cb3d3.js +0 -15
  24. package/dist/chevron-icon_3.entry-b72f4cdb.cjs +0 -1
  25. package/dist/chevron-icon_3.entry-db9f8217.js +0 -117
  26. package/dist/close-icon.entry-9d141bb4.js +0 -15
  27. package/dist/close-icon.entry-da590fa2.cjs +0 -1
  28. package/dist/constants-6ee60d6d-09ee73d9.cjs +0 -15
  29. package/dist/constants-6ee60d6d-d5928e79.js +0 -3740
  30. package/dist/document-refresh-icon.entry-5e8cc2f0.cjs +0 -1
  31. package/dist/document-refresh-icon.entry-ee9632d7.js +0 -15
  32. package/dist/forward-icon_6.entry-cac8473a.cjs +0 -3
  33. package/dist/forward-icon_6.entry-f054ad9d.js +0 -953
  34. package/dist/globe-icon.entry-2fde6ac4.js +0 -15
  35. package/dist/globe-icon.entry-bc484551.cjs +0 -1
  36. package/dist/google-logo-icon_4.entry-a9848399.cjs +0 -1
  37. package/dist/google-logo-icon_4.entry-dca87e45.js +0 -349
  38. package/dist/index-22f7e49c.cjs +0 -37
  39. package/dist/index.es-f57e612a-1d17c676.js +0 -3137
  40. package/dist/index.es-f57e612a-95ca3e17.cjs +0 -7
  41. package/dist/info-icon_2.entry-dbf3931a.js +0 -34
  42. package/dist/info-icon_2.entry-e67844eb.cjs +0 -1
  43. package/dist/loading-icon.entry-4566cba8.cjs +0 -1
  44. package/dist/loading-icon.entry-ae4c2d7e.js +0 -15
  45. package/dist/mailbox-store-47fc8a1a-2365f20f.js +0 -380
  46. package/dist/mailbox-store-47fc8a1a-cd3516a7.cjs +0 -1
  47. package/dist/nylas-additional-participants.entry-7c568149.cjs +0 -1
  48. package/dist/nylas-additional-participants.entry-e8426256.js +0 -81
  49. package/dist/nylas-booked-event-card_10.entry-6a664889.cjs +0 -1
  50. package/dist/nylas-booked-event-card_10.entry-ef767733.js +0 -782
  51. package/dist/nylas-form-card.entry-d8506b1f.js +0 -54
  52. package/dist/nylas-form-card.entry-e44169b6.cjs +0 -1
  53. package/dist/nylas-if-state.entry-044c49d2.cjs +0 -1
  54. package/dist/nylas-if-state.entry-98a336df.js +0 -94
  55. package/dist/nylas-list-folders.entry-509f9be4.cjs +0 -1
  56. package/dist/nylas-list-folders.entry-55ce3403.js +0 -120
  57. package/dist/nylas-list-threads.entry-1f57382a.js +0 -70
  58. package/dist/nylas-list-threads.entry-c36e2cf3.cjs +0 -1
  59. package/dist/nylas-login.entry-66f542b8.cjs +0 -1
  60. package/dist/nylas-login.entry-76358c2f.js +0 -73
  61. package/dist/nylas-mailbox-pagination.entry-5562257a.js +0 -101
  62. package/dist/nylas-mailbox-pagination.entry-89b0dd99.cjs +0 -1
  63. package/dist/nylas-mailbox-toolbar-button.entry-573e0429.cjs +0 -1
  64. package/dist/nylas-mailbox-toolbar-button.entry-6b1b5b15.js +0 -82
  65. package/dist/nylas-mailbox.entry-97c503f2.js +0 -134
  66. package/dist/nylas-mailbox.entry-e21a2f50.cjs +0 -1
  67. package/dist/nylas-provider.entry-07e1e26a.js +0 -145
  68. package/dist/nylas-provider.entry-61899957.cjs +0 -1
  69. package/dist/nylas-scheduler-editor.entry-60fe38ce.cjs +0 -7
  70. package/dist/nylas-scheduler-editor.entry-e326c9de.js +0 -2275
  71. package/dist/nylas-scheduling.entry-be0cc090.js +0 -235
  72. package/dist/nylas-scheduling.entry-d88289db.cjs +0 -1
  73. package/dist/nylas-threads-refresh.entry-8201f8dd.js +0 -74
  74. package/dist/nylas-threads-refresh.entry-c71ee775.cjs +0 -1
  75. package/dist/nylas-threads-search.entry-912a90a4.cjs +0 -1
  76. package/dist/nylas-threads-search.entry-fc477e01.js +0 -69
  77. package/dist/nylas-view-thread.entry-af418ddb.cjs +0 -1
  78. package/dist/nylas-view-thread.entry-d2953ea8.js +0 -203
  79. package/dist/people-icon.entry-4b598fde.js +0 -15
  80. package/dist/people-icon.entry-73cfa6f5.cjs +0 -1
  81. package/dist/play-icon_2.entry-1a487abb.cjs +0 -1
  82. package/dist/play-icon_2.entry-d1c2f823.js +0 -25
  83. package/dist/refresh-icon.entry-42d543d0.cjs +0 -1
  84. package/dist/refresh-icon.entry-6aedfce6.js +0 -15
  85. package/dist/register-component-cf5c8420-d3fb6bf9.cjs +0 -1
  86. package/dist/register-component-cf5c8420-dc1bc0a4.js +0 -109
  87. package/dist/scheduler-config-store-6222c0ed-000f1a4f.js +0 -18
  88. package/dist/scheduler-config-store-6222c0ed-758621fb.cjs +0 -1
  89. package/dist/scheduler-store-39d37291-4e8e9ff9.js +0 -293
  90. package/dist/scheduler-store-39d37291-b66c052c.cjs +0 -1
  91. package/dist/time-period-selector.entry-f1e27a00.js +0 -76
  92. package/dist/time-period-selector.entry-fb3d0178.cjs +0 -1
  93. package/dist/translate-icon.entry-0d44b6cb.cjs +0 -1
  94. package/dist/translate-icon.entry-3db947f5.js +0 -15
  95. package/dist/warning-icon.entry-a20657e4.cjs +0 -1
  96. package/dist/warning-icon.entry-a8ea0fe0.js +0 -15
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-22f7e49c.cjs");require("react");require("react-dom");const c=".sc-document-refresh-icon-h{display:flex}",d=c,t=class{constructor(a){e.registerInstance(this,a),this.width="18",this.height="18"}render(){return e.h("svg",{key:"342b2ec1d22ee4d18cdeca3e580dfab64f064f6e",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 18 18",width:this.width,height:this.height},e.h("rect",{key:"31c6b7537b841a88a4bb2e350d82b0fa2f7afb64",id:"Canvas",fill:"#ff13dc",opacity:"0"}),e.h("path",{key:"329d093aec82ef6d106c8b8804872b625353b245",d:"M9.19763,12.26283A4.44131,4.44131,0,0,1,16.948,10.71741l.62524-.62524a.24433.24433,0,0,1,.1748-.07373.25035.25035,0,0,1,.252.24875v2.50143a.25.25,0,0,1-.25.25l-2.4995-.00016A.25088.25088,0,0,1,15,12.76721v-.00054a.24436.24436,0,0,1,.07373-.175l.86988-.86987a3.02827,3.02827,0,0,0-5.29847.71808.48835.48835,0,0,1-.46081.30981H9.55908a.37949.37949,0,0,1-.36145-.48686Z"}),e.h("path",{key:"9a93dd95b038875b1e03d301e4f8e755c52577aa",d:"M17.80237,14.77441A4.4413,4.4413,0,0,1,10.052,16.31982l-.62524.62524a.24429.24429,0,0,1-.1748.07373A.25036.25036,0,0,1,9,16.77V14.26863a.25.25,0,0,1,.25-.25l2.4995.00016A.25087.25087,0,0,1,12,14.27v.00052a.24434.24434,0,0,1-.07373.175l-.86988.86988a3.02828,3.02828,0,0,0,5.29847-.71808.48836.48836,0,0,1,.46081-.30982h.62525a.3795.3795,0,0,1,.36145.48687Z"}),e.h("path",{key:"1a4884a9cbad845c54f8ec72be5228d9d66dd830",d:"M7,13.5A6.5,6.5,0,0,1,13.5,7c.16883,0,.33447.01264.5.02527V5H9.5A.5.5,0,0,1,9,4.5V0H2.5A.5.5,0,0,0,2,.5v15a.5.5,0,0,0,.5.5H7.49981A6.4779,6.4779,0,0,1,7,13.5Z"}),e.h("path",{key:"09d913a7482f9720ef4020cfd04770168c8d241b",d:"M10,0h.043a.5.5,0,0,1,.353.146L13.854,3.6A.5.5,0,0,1,14,3.957V4H10Z"}))}};t.style=d;exports.document_refresh_icon=t;
@@ -1,15 +0,0 @@
1
- import { r as t, h as e } from "./index-f9ba9aa8.js";
2
- import "react";
3
- import "react-dom";
4
- const c = ".sc-document-refresh-icon-h{display:flex}", d = c, s = class {
5
- constructor(a) {
6
- t(this, a), this.width = "18", this.height = "18";
7
- }
8
- render() {
9
- return e("svg", { key: "342b2ec1d22ee4d18cdeca3e580dfab64f064f6e", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 18 18", width: this.width, height: this.height }, e("rect", { key: "31c6b7537b841a88a4bb2e350d82b0fa2f7afb64", id: "Canvas", fill: "#ff13dc", opacity: "0" }), e("path", { key: "329d093aec82ef6d106c8b8804872b625353b245", d: "M9.19763,12.26283A4.44131,4.44131,0,0,1,16.948,10.71741l.62524-.62524a.24433.24433,0,0,1,.1748-.07373.25035.25035,0,0,1,.252.24875v2.50143a.25.25,0,0,1-.25.25l-2.4995-.00016A.25088.25088,0,0,1,15,12.76721v-.00054a.24436.24436,0,0,1,.07373-.175l.86988-.86987a3.02827,3.02827,0,0,0-5.29847.71808.48835.48835,0,0,1-.46081.30981H9.55908a.37949.37949,0,0,1-.36145-.48686Z" }), e("path", { key: "9a93dd95b038875b1e03d301e4f8e755c52577aa", d: "M17.80237,14.77441A4.4413,4.4413,0,0,1,10.052,16.31982l-.62524.62524a.24429.24429,0,0,1-.1748.07373A.25036.25036,0,0,1,9,16.77V14.26863a.25.25,0,0,1,.25-.25l2.4995.00016A.25087.25087,0,0,1,12,14.27v.00052a.24434.24434,0,0,1-.07373.175l-.86988.86988a3.02828,3.02828,0,0,0,5.29847-.71808.48836.48836,0,0,1,.46081-.30982h.62525a.3795.3795,0,0,1,.36145.48687Z" }), e("path", { key: "1a4884a9cbad845c54f8ec72be5228d9d66dd830", d: "M7,13.5A6.5,6.5,0,0,1,13.5,7c.16883,0,.33447.01264.5.02527V5H9.5A.5.5,0,0,1,9,4.5V0H2.5A.5.5,0,0,0,2,.5v15a.5.5,0,0,0,.5.5H7.49981A6.4779,6.4779,0,0,1,7,13.5Z" }), e("path", { key: "09d913a7482f9720ef4020cfd04770168c8d241b", d: "M10,0h.043a.5.5,0,0,1,.353.146L13.854,3.6A.5.5,0,0,1,14,3.957V4H10Z" }));
10
- }
11
- };
12
- s.style = d;
13
- export {
14
- s as document_refresh_icon
15
- };
@@ -1,3 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-22f7e49c.cjs"),bn=require("./register-component-cf5c8420-d3fb6bf9.cjs");require("react");require("react-dom");const yn=".sc-forward-icon-h{display:flex}",En=yn,St=class{constructor(t){o.registerInstance(this,t),this.width="15",this.height="15"}render(){return o.h("svg",{key:"6a4eb6d9a2531279db927e298081ac4da5428fca",fill:"auto",width:this.width,height:this.height,viewBox:"0 0 1920 1920",xmlns:"http://www.w3.org/2000/svg"},o.h("path",{key:"ad2847c25e5d83df09cf22a76a198eb4e7f212f9",d:"m1246.246 64-90.496 90.496 477.952 477.952h-590.848C467.878 632.448.038 1100.416.038 1675.392v109.056h128v-109.056c0-504.576 410.368-914.944 914.816-914.944h590.848l-477.952 478.08 90.496 90.496 632.448-632.576L1246.246 64Z","fill-rule":"evenodd"}))}};St.style=En;const Tn=':host{display:grid;color:var(--nylas-color-primary-900)}.editor{position:relative;display:block;max-height:300px;overflow:auto;padding:1rem;border:1px solid var(--nylas-color-primary-300)}.editor blockquote{visibility:hidden;overflow:hidden;position:relative;transition:height 0.3s ease;margin:0}.editor blockquote::before{content:"...";visibility:visible;opacity:1;position:absolute;top:0;left:0;background-color:var(--nylas-color-primary-300);width:20px;text-align:center;color:var(--nylas-color-primary-800);vertical-align:middle;display:flex;justify-content:center;align-items:center;align-self:center;cursor:pointer}.editor .collapsed{height:20px}.editor .expanded{visibility:visible;opacity:1;height:auto;margin:0px 0px 0px 0.8ex;border-left:1px solid var(--nylas-color-primary-300);padding-left:1rem}.editor .expanded::before{display:none;}.buttons{display:flex;margin-top:1rem;justify-content:space-between}.buttons sp-button{border-radius:var(--nylas-border-radius);background-color:var(--nylas-color-primary-400);color:var(--nylas-color-primary-900);fill:var(--nylas-color-primary-900)}.buttons sp-button:hover{background-color:var(--nylas-color-primary-500)}.buttons sp-button:disabled{background-color:var(--nylas-color-primary-200);color:var(--nylas-color-primary-600);cursor:not-allowed}.buttons sp-button chevron-icon{display:inline-block}.buttons .close{justify-self:end}.toolbar{position:absolute;display:none;background-color:var(--nylas-color-primary-200);border-radius:var(--nylas-border-radius);z-index:1}.toolbar sp-button{border:0}',An=Tn,Ct=class{constructor(t){o.registerInstance(this,t),this.close=o.createEvent(this,"close",7),this.send=o.createEvent(this,"send",7),this.closeComposer=i=>{this.close.emit(i)},this.sendComposer=i=>{var l;if(!this.editorEl){o.debug("no editor element");return}const f=this.editorEl.querySelector(".message-body");if(!f){o.debug("no message body");return}this.message&&(this.send.emit({message:this.message,replyBody:((l=f.querySelector(".message-body"))==null?void 0:l.innerHTML)||""}),this.close.emit(i),this.editorEl.innerHTML="")},this.message=void 0,this.viewEmailElement=void 0}connectedCallback(){}disconnectedCallback(){this.editorEl&&(this.editorEl.innerHTML="")}componentWillLoad(){}async componentDidLoad(){if(this.message&&this.watchBody(this.message),!this.editorEl){o.debug("[connectedCallback] no editor element");return}if(!this.toolbarEl){o.debug("[connectedCallback] no toolbar element");return}const t=this.editorEl,i=this.toolbarEl;t.addEventListener("mouseup",f=>{var B;const l=(B=this.host.shadowRoot)==null?void 0:B.getSelection();if(!l){o.debug("no selection");return}const p=l.getRangeAt(0),a=l.toString();if(!a){i.style.display="none";return}const m=t.querySelector(".message-body");if(!m){o.debug("no message body");return}const c=p.commonAncestorContainer.parentElement;if(!c)return;const E=m.getBoundingClientRect();o.debug("messageBodyRect",{messageBodyRect:E});const A=c.getBoundingClientRect();o.debug("foundRect",{foundRect:A});const le=(c.childNodes[0].textContent||"").indexOf(a),W=window.getComputedStyle(c).fontSize,j=parseInt(W.replace("px",""),10),te=A.top-E.top-i.clientHeight,be=le*(1/j)*100;i.style.top=`${te}px`,i.style.left=`${be}px`,i.style.display="block"})}watchBody(t){var a;if(!this.editorEl){o.debug("no editor element");return}this.editorEl.querySelectorAll(".message-body").forEach(m=>m.remove());const i=document.createElement("div");i.classList.add("message-body");const f=document.createElement("p");f.innerHTML="&nbsp;",i.appendChild(f);const l=document.createElement("br");i.appendChild(l);const p=document.createElement("div");if(p.classList.add("reply-text"),p.innerText=`On ${new Date(t.date*1e3).toLocaleDateString(void 0,{dateStyle:"full"})} <${(a=t.from)==null?void 0:a.map(m=>m.name||m.email).join(", ")}> wrote:`,i.appendChild(p),t.body){const m=document.createElement("html");m.innerHTML=t.body;const r=document.createElement("blockquote");r.classList.add("collapsed"),r.classList.add("gmail_quote"),r.innerHTML=m.innerHTML,i.appendChild(r),o.debug("replyContainer",{replyContainer:r})}this.editorEl.appendChild(i),this.editorEl.querySelectorAll("blockquote.collapsed").forEach(m=>{m.addEventListener("click",function(r){r.preventDefault();const c=r.target;c.classList.remove("collapsed"),c.classList.add("expanded")},{once:!0})}),this.editorEl.focus()}render(){return o.h(o.Host,{key:"7537b7c56a1e609f88189c2c4deed986827eb193"},o.h("sp-theme",{key:"efa28f8ed5585ec21b44ae5ec174aa10a9c92aba",scale:"medium",color:"dark"},o.h("div",{key:"c7932bcedcb2b3cfa4e0900578cf2b749000125d",class:"editor",contentEditable:!0,ref:t=>this.editorEl=t},o.h("div",{key:"89c06c0e76d29ea6713dd44b2452e261d0d7d43b",class:"toolbar",ref:t=>this.toolbarEl=t,contentEditable:!1},o.h("sp-button",{key:"beeb60448f03c8818925aeb13ab5231aa72f7526",quiet:!0,onClick:()=>document.execCommand("bold")},o.h("div",{key:"4e37be81a28ac4355f9d0d6d6c71b7b78cf41456",slot:"icon"},o.h("bold-icon",{key:"56cf047799a6a5713310d5b095ca91e6004d6107"})),o.h("div",{key:"2fe47f8f364f7fb1016990f2aecec655e2e6eb30",slot:"label"},"Bold")),o.h("sp-button",{key:"0416d13b88ccefd5005f4b97f7dded2118d37f43",quiet:!0,onClick:()=>document.execCommand("underline")},o.h("div",{key:"6d20e215eafbb91a17ce452a6b64295ab4ef2bb9",slot:"icon"},o.h("underline-icon",{key:"b8d988fa168047ed213fbcceb53b24bf3f766d7a"})),o.h("div",{key:"bd05639007b3ea849501b995137ceda70aed20da",slot:"label"},"Underline")),o.h("sp-button",{key:"9775c4787363cd4d21778f4c848c7f5a7564b507",quiet:!0,onClick:()=>document.execCommand("italic")},o.h("div",{key:"ca9d557028981c0fe209045e5d1748b19bbb5069",slot:"icon"},o.h("italic-icon",{key:"1be5debba3572e83ab132a3e44d8fc1e799f6619"})),o.h("div",{key:"cccb70309840e20f558158e6ef9edf8fe0e52eed",slot:"label"},"Italic")))),o.h("div",{key:"502854e008886de49ec435c1ebd73b48f2cc4c70",class:"buttons"},o.h("sp-button",{key:"9663a709ca8794dc76dec379a39c52a6a754cb6e",onClick:this.sendComposer,class:"send"},"Send"),o.h("sp-button",{key:"b0c7637932f2659c9115e74f1244db04992a69aa",onClick:this.closeComposer,class:"close"},"Close"))))}get host(){return o.getElement(this)}static get watchers(){return{message:["watchBody"]}}};Ct.style=An;const _n=":host{display:block}sp-button{padding:0;border:0;border-radius:var(--nylas-border-radius);min-block-size:50%;min-inline-size:2rem;background-color:var(--nylas-color-primary-300);fill:var(--nylas-color-primary-800)}sp-button:hover{background-color:var(--nylas-color-primary-400)}.summarize-button.stopped{animation:none}.summarize-button.playing{animation:pulse 2s infinite}.summarize-button.loading{display:flex;align-content:center;height:1.5rem;width:2rem;vertical-align:middle;animation:pulse 2s infinite;flex-wrap:wrap}.summarize-button.loading loading-icon{--dot-color:var(--nylas-color-primary-600)}@keyframes pulse{0%{transform:scale(1);box-shadow:0 0 0 0 var(--nylas-color-primary-300)}70%{transform:scale(1.05);box-shadow:0 0 0 10px rgba(255, 69, 0, 0)}100%{transform:scale(1);box-shadow:0 0 0 0 rgba(255, 69, 0, 0)}}@keyframes wave{0%{transform:translateX(0)}50%{transform:translateX(100%)}100%{transform:translateX(0)}}",wn=_n;var vn=function(t,i,f,l){var p=arguments.length,a=p<3?i:l===null?l=Object.getOwnPropertyDescriptor(i,f):l,m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,i,f,l);else for(var r=t.length-1;r>=0;r--)(m=t[r])&&(a=(p<3?m(a):p>3?m(i,f,a):m(i,f))||a);return p>3&&a&&Object.defineProperty(i,f,a),a},Fe=function(t,i){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,i)};const Be=class{constructor(t){o.registerInstance(this,t),this.summarize=o.createEvent(this,"summarize",7),this.abortController=new AbortController,this.onClick=async i=>{var f,l;i.preventDefault(),i.stopPropagation(),this.state==="stopped"?this.message&&(this.abortController=new AbortController,this.summarize.emit({abortController:this.abortController,playAudio:this.playAudio,message:this.message,updateState:this.updateState}).defaultPrevented||(o.debug("[nylas-summarize-message-button] Default event not prevented, summarizing message"),this.audioRef&&(await this.audioRef.play().then(()=>{var a;return(a=this.audioRef)==null?void 0:a.pause()}).catch(a=>console.error("Error playing audio:",a)),await this.audioRef.play().catch(a=>console.error("Error playing audio:",a))))):this.state==="playing"?((f=this.abortController)==null||f.abort(),(l=this.audioRef)==null||l.pause()):this.state="stopped"},this.message=void 0,this.state="stopped",this.playAudio=this.playAudio.bind(this),this.updateState=this.updateState.bind(this)}connectedCallback(){}disconnectedCallback(){}async componentWillLoad(){o.debug("[nylas-summarize-message-button] Component will load")}async componentDidLoad(){o.debug("[nylas-summarize-message-button] Component did load")}async updateState(t){this.state=t}async playAudio(t){if(!this.audioRef){this.state="stopped";return}if(!t){this.state="stopped";return}const i=this.audioRef;if(!("MediaSource"in window)){const r=await t;if(r==null)throw new Error("ReadableStream not yet supported in this browser.");const c=r.getReader(),E=[];await this.readChunk(c,E);const A=new Blob(E,{type:"audio/mpeg"}),M=URL.createObjectURL(A);i.src=M;return}const f=new MediaSource;let l,p=!1;i.src=URL.createObjectURL(f),f.addEventListener("sourceopen",a);async function a(){l=f.addSourceBuffer("audio/mpeg"),l.addEventListener("updateend",m);const r=await t;if(r==null)throw new Error("ReadableStream not yet supported in this browser.");const c=r.getReader(),E=()=>{c.read().then(({done:A,value:M})=>{if(A){p=!0;return}l.updating||l.appendBuffer(M),E()}).catch(A=>{console.error("Error while fetching and appending chunks:",A)})};E(),i.paused&&i.play().catch(A=>console.error("Error playing audio:",A))}function m(){if(p){f.endOfStream(),f.removeEventListener("sourceopen",a),f.removeEventListener("sourceclose",()=>{o.debug("[nylas-summarize-message-button] Source closed")}),l.removeEventListener("updateend",m);return}}}async readChunk(t,i){return t.read().then(({done:f,value:l})=>f?i:(i.push(l),this.readChunk(t,i)))}render(){return o.h(o.Host,{key:"8c0687fd071081bfe39b324debeb165a966301c0"},o.h("sp-theme",{key:"30328464c09cb718c83ffa123018ea2ade596774",scale:"medium",color:"dark"},o.h("sp-button",{key:"b7f0095382095c2c69a664cfd848a7d44e3fee3a",label:"Summarize email","icon-only":!0,onClickCapture:this.onClick,class:{"summarize-button":!0,stopped:this.state==="stopped",loading:this.state==="loading",playing:this.state==="playing"}},this.state==="stopped"&&o.h("play-icon",null),this.state==="loading"&&o.h("loading-icon",null),this.state==="playing"&&o.h("stop-icon",null)),o.h("audio",{key:"a5595d5d2a40baa947eece71ee22110d9225c879",ref:t=>this.audioRef=t,autoPlay:!0,onPlaying:()=>this.state="playing",onPause:()=>this.state="stopped",onEnded:()=>{this.state="stopped",o.debug("[nylas-summarize-message-button] Audio ended")}})))}};vn([bn.RegisterComponent({name:"nylas-summarize-message-button",eventToProps:{summarize:async(t,i)=>{const{playAudio:f,updateState:l,abortController:p,message:a}=t.detail,m=o.htmlToPlainText(a.body||"");await l("loading");try{const r=await i.messages.summarizeText(m),c=i.messages.textToSpeech(r,p);await f(c)}catch(r){await l("stopped"),console.error("Error summarizing message:",r)}}},fireRegisterEvent:!0}),Fe("design:type",Function),Fe("design:paramtypes",[]),Fe("design:returntype",void 0)],Be.prototype,"render",null);Be.style=wn;function I(t){return!window.matchMedia("(prefers-color-scheme: dark)").matches||!t?t:t==="transparent"?"color":t.startsWith("#")?Sn(t):t.startsWith("rgb")?Lt(t):t.startsWith("hsl")?Cn(t):Ln(t)?Rn(t):t}function Sn(t){t.length<7&&(t="#"+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]);const i=(255-parseInt(t.slice(1,3),16)).toString(16).padStart(2,"0"),f=(255-parseInt(t.slice(3,5),16)).toString(16).padStart(2,"0"),l=(255-parseInt(t.slice(5,7),16)).toString(16).padStart(2,"0");return`#${i}${f}${l}`}function Lt(t){var a;const i=(a=t.match(/\d+/g))==null?void 0:a.map(Number);if(!i)return t;const[f,l,p]=i;return`rgb(${255-f}, ${255-l}, ${255-p})`}function Cn(t){var a;const i=(a=t.match(/\d+\.?\d*/g))==null?void 0:a.map(Number);if(!i)return t;const[f,l,p]=i;return`hsl(${f}, ${l}%, ${100-p}%)`}function Ln(t){return/^[a-z]+$/i.test(t)}function Rn(t){return Lt(kn(t))}function kn(t){return t.toLowerCase()==="red"?"rgb(255, 0, 0)":"rgb(0, 0, 0)"}function vt(t){if(t instanceof HTMLStyleElement){let i=t.textContent;if(i){i=i.replaceAll(/@media\s*\(prefers-color-scheme:\s*(dark|light)\)\s*\{([^}]+)\}/g,"");const f=i.matchAll(/border-color:\s*([^;]+)/g);if(f)for(const r of f){const[c,E]=r,A=c.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&");i=i.replaceAll(A,c.replace(E,I(E)))}const l=i.matchAll(/border:\s*([^;]+)/g);if(l)for(const r of l){const c=r[0].trim(),E=c.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),[A,M,P]=r[1].split(" ");i=i.replaceAll(E,c.replace(P,I(P)))}const p=i.matchAll(/background-color:\s*([^;]+)/g);if(p)for(const r of p){const[c,E]=r,A=c.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&");i=i.replaceAll(A,c.replace(E,I(E))),o.debug("backgroundColor",{fullMatch:c,replace:c.replace(E,I(E)),color:E,invertColor:I(E)})}const a=i.matchAll(/background:\s*([^;]+)/g);if(a)for(const r of a){const c=r[0].trim(),E=c.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),[A,M,P]=r[1].split(" ");i=i.replaceAll(E,c.replace(P,I(P)))}const m=i.matchAll(/color:\s*([^;]+)/g);if(m)for(const r of m){const[c,E]=r,A=c.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&");i=i.replaceAll(A,c.replace(E,I(E)))}t.textContent=i}}if(t instanceof HTMLElement){const i=window.getComputedStyle(t),f=i.color||t.style.color,l=i.backgroundColor||t.style.backgroundColor,p=i.borderColor||t.style.borderColor;f&&!l?t.style.color="":f&&l?(t.style.color=I(f),t.style.backgroundColor=I(l),o.debug("element",t),o.debug("computedStyle.color",f),o.debug("computedStyle.backgroundColor",l),o.debug("invertColor(color)",I(f)),o.debug("invertColor(backgroundColor)",I(l))):!f&&l&&(t.style.backgroundColor=""),p&&(o.debug("borderColor",p),t.style.borderColor=I(p)),t.hasAttribute("bgcolor")&&t.removeAttribute("bgcolor")}}function Mn(t){vt(t),t.querySelectorAll("*").forEach(f=>vt(f))}var Rt={exports:{}};/*! @license DOMPurify 3.0.8 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.8/LICENSE */(function(t,i){(function(f,l){t.exports=l()})(o.commonjsGlobal,function(){const{entries:f,setPrototypeOf:l,isFrozen:p,getPrototypeOf:a,getOwnPropertyDescriptor:m}=Object;let{freeze:r,seal:c,create:E}=Object,{apply:A,construct:M}=typeof Reflect<"u"&&Reflect;r||(r=function(d){return d}),c||(c=function(d){return d}),A||(A=function(d,y,g){return d.apply(y,g)}),M||(M=function(d,y){return new d(...y)});const P=O(Array.prototype.forEach),le=O(Array.prototype.pop),W=O(Array.prototype.push),j=O(String.prototype.toLowerCase),te=O(String.prototype.toString),be=O(String.prototype.match),B=O(String.prototype.replace),xt=O(String.prototype.indexOf),Dt=O(String.prototype.trim),D=O(RegExp.prototype.test),ne=Ot(TypeError);function O(b){return function(d){for(var y=arguments.length,g=new Array(y>1?y-1:0),R=1;R<y;R++)g[R-1]=arguments[R];return A(b,d,g)}}function Ot(b){return function(){for(var d=arguments.length,y=new Array(d),g=0;g<d;g++)y[g]=arguments[g];return M(b,y)}}function h(b,d){let y=arguments.length>2&&arguments[2]!==void 0?arguments[2]:j;l&&l(b,null);let g=d.length;for(;g--;){let R=d[g];if(typeof R=="string"){const z=y(R);z!==R&&(p(d)||(d[g]=z),R=z)}b[R]=!0}return b}function It(b){for(let d=0;d<b.length;d++)m(b,d)===void 0&&(b[d]=null);return b}function G(b){const d=E(null);for(const[y,g]of f(b))m(b,y)!==void 0&&(Array.isArray(g)?d[y]=It(g):g&&typeof g=="object"&&g.constructor===Object?d[y]=G(g):d[y]=g);return d}function ce(b,d){for(;b!==null;){const g=m(b,d);if(g){if(g.get)return O(g.get);if(typeof g.value=="function")return O(g.value)}b=a(b)}function y(g){return console.warn("fallback value for",g),null}return y}const We=r(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),ye=r(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Ee=r(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Pt=r(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Te=r(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Ut=r(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ge=r(["#text"]),qe=r(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),Ae=r(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),$e=r(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),de=r(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),zt=c(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Ft=c(/<%[\w\W]*|[\w\W]*%>/gm),Ht=c(/\${[\w\W]*}/gm),Bt=c(/^data-[\-\w.\u00B7-\uFFFF]/),Wt=c(/^aria-[\-\w]+$/),Ye=c(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Gt=c(/^(?:\w+script|data):/i),qt=c(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),je=c(/^html$/i);var Xe=Object.freeze({__proto__:null,MUSTACHE_EXPR:zt,ERB_EXPR:Ft,TMPLIT_EXPR:Ht,DATA_ATTR:Bt,ARIA_ATTR:Wt,IS_ALLOWED_URI:Ye,IS_SCRIPT_OR_DATA:Gt,ATTR_WHITESPACE:qt,DOCTYPE_NAME:je});const $t=function(){return typeof window>"u"?null:window},Yt=function(d,y){if(typeof d!="object"||typeof d.createPolicy!="function")return null;let g=null;const R="data-tt-policy-suffix";y&&y.hasAttribute(R)&&(g=y.getAttribute(R));const z="dompurify"+(g?"#"+g:"");try{return d.createPolicy(z,{createHTML(X){return X},createScriptURL(X){return X}})}catch{return console.warn("TrustedTypes policy "+z+" could not be created."),null}};function Ve(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:$t();const d=u=>Ve(u);if(d.version="3.0.8",d.removed=[],!b||!b.document||b.document.nodeType!==9)return d.isSupported=!1,d;let{document:y}=b;const g=y,R=g.currentScript,{DocumentFragment:z,HTMLTemplateElement:X,Node:_e,Element:Ze,NodeFilter:we,NamedNodeMap:Xt=b.NamedNodeMap||b.MozNamedAttrMap,HTMLFormElement:Vt,DOMParser:Zt,trustedTypes:ue}=b,fe=Ze.prototype,Kt=ce(fe,"cloneNode"),Qt=ce(fe,"nextSibling"),Jt=ce(fe,"childNodes"),ve=ce(fe,"parentNode");if(typeof X=="function"){const u=y.createElement("template");u.content&&u.content.ownerDocument&&(y=u.content.ownerDocument)}let k,oe="";const{implementation:Se,createNodeIterator:en,createDocumentFragment:tn,getElementsByTagName:nn}=y,{importNode:on}=g;let U={};d.isSupported=typeof f=="function"&&typeof ve=="function"&&Se&&Se.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Ce,ERB_EXPR:Le,TMPLIT_EXPR:Re,DATA_ATTR:rn,ARIA_ATTR:an,IS_SCRIPT_OR_DATA:sn,ATTR_WHITESPACE:Ke}=Xe;let{IS_ALLOWED_URI:Qe}=Xe,w=null;const Je=h({},[...We,...ye,...Ee,...Te,...Ge]);let v=null;const et=h({},[...qe,...Ae,...$e,...de]);let _=Object.seal(E(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ie=null,ke=null,tt=!0,Me=!0,nt=!1,ot=!0,V=!1,q=!1,Ne=!1,xe=!1,Z=!1,me=!1,pe=!1,it=!0,rt=!1;const ln="user-content-";let De=!0,re=!1,K={},Q=null;const at=h({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let st=null;const lt=h({},["audio","video","img","source","image","track"]);let Oe=null;const ct=h({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),he="http://www.w3.org/1998/Math/MathML",ge="http://www.w3.org/2000/svg",F="http://www.w3.org/1999/xhtml";let J=F,Ie=!1,Pe=null;const cn=h({},[he,ge,F],te);let ae=null;const dn=["application/xhtml+xml","text/html"],un="text/html";let S=null,ee=null;const fn=y.createElement("form"),dt=function(e){return e instanceof RegExp||e instanceof Function},Ue=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(ee&&ee===e)){if((!e||typeof e!="object")&&(e={}),e=G(e),ae=dn.indexOf(e.PARSER_MEDIA_TYPE)===-1?un:e.PARSER_MEDIA_TYPE,S=ae==="application/xhtml+xml"?te:j,w="ALLOWED_TAGS"in e?h({},e.ALLOWED_TAGS,S):Je,v="ALLOWED_ATTR"in e?h({},e.ALLOWED_ATTR,S):et,Pe="ALLOWED_NAMESPACES"in e?h({},e.ALLOWED_NAMESPACES,te):cn,Oe="ADD_URI_SAFE_ATTR"in e?h(G(ct),e.ADD_URI_SAFE_ATTR,S):ct,st="ADD_DATA_URI_TAGS"in e?h(G(lt),e.ADD_DATA_URI_TAGS,S):lt,Q="FORBID_CONTENTS"in e?h({},e.FORBID_CONTENTS,S):at,ie="FORBID_TAGS"in e?h({},e.FORBID_TAGS,S):{},ke="FORBID_ATTR"in e?h({},e.FORBID_ATTR,S):{},K="USE_PROFILES"in e?e.USE_PROFILES:!1,tt=e.ALLOW_ARIA_ATTR!==!1,Me=e.ALLOW_DATA_ATTR!==!1,nt=e.ALLOW_UNKNOWN_PROTOCOLS||!1,ot=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,V=e.SAFE_FOR_TEMPLATES||!1,q=e.WHOLE_DOCUMENT||!1,Z=e.RETURN_DOM||!1,me=e.RETURN_DOM_FRAGMENT||!1,pe=e.RETURN_TRUSTED_TYPE||!1,xe=e.FORCE_BODY||!1,it=e.SANITIZE_DOM!==!1,rt=e.SANITIZE_NAMED_PROPS||!1,De=e.KEEP_CONTENT!==!1,re=e.IN_PLACE||!1,Qe=e.ALLOWED_URI_REGEXP||Ye,J=e.NAMESPACE||F,_=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&dt(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(_.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&dt(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(_.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(_.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),V&&(Me=!1),me&&(Z=!0),K&&(w=h({},Ge),v=[],K.html===!0&&(h(w,We),h(v,qe)),K.svg===!0&&(h(w,ye),h(v,Ae),h(v,de)),K.svgFilters===!0&&(h(w,Ee),h(v,Ae),h(v,de)),K.mathMl===!0&&(h(w,Te),h(v,$e),h(v,de))),e.ADD_TAGS&&(w===Je&&(w=G(w)),h(w,e.ADD_TAGS,S)),e.ADD_ATTR&&(v===et&&(v=G(v)),h(v,e.ADD_ATTR,S)),e.ADD_URI_SAFE_ATTR&&h(Oe,e.ADD_URI_SAFE_ATTR,S),e.FORBID_CONTENTS&&(Q===at&&(Q=G(Q)),h(Q,e.FORBID_CONTENTS,S)),De&&(w["#text"]=!0),q&&h(w,["html","head","body"]),w.table&&(h(w,["tbody"]),delete ie.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw ne('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ne('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');k=e.TRUSTED_TYPES_POLICY,oe=k.createHTML("")}else k===void 0&&(k=Yt(ue,R)),k!==null&&typeof oe=="string"&&(oe=k.createHTML(""));r&&r(e),ee=e}},ut=h({},["mi","mo","mn","ms","mtext"]),ft=h({},["foreignobject","desc","title","annotation-xml"]),mn=h({},["title","style","font","a","script"]),mt=h({},[...ye,...Ee,...Pt]),pt=h({},[...Te,...Ut]),pn=function(e){let n=ve(e);(!n||!n.tagName)&&(n={namespaceURI:J,tagName:"template"});const s=j(e.tagName),T=j(n.tagName);return Pe[e.namespaceURI]?e.namespaceURI===ge?n.namespaceURI===F?s==="svg":n.namespaceURI===he?s==="svg"&&(T==="annotation-xml"||ut[T]):!!mt[s]:e.namespaceURI===he?n.namespaceURI===F?s==="math":n.namespaceURI===ge?s==="math"&&ft[T]:!!pt[s]:e.namespaceURI===F?n.namespaceURI===ge&&!ft[T]||n.namespaceURI===he&&!ut[T]?!1:!pt[s]&&(mn[s]||!mt[s]):!!(ae==="application/xhtml+xml"&&Pe[e.namespaceURI]):!1},$=function(e){W(d.removed,{element:e});try{e.parentNode.removeChild(e)}catch{e.remove()}},ze=function(e,n){try{W(d.removed,{attribute:n.getAttributeNode(e),from:n})}catch{W(d.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e==="is"&&!v[e])if(Z||me)try{$(n)}catch{}else try{n.setAttribute(e,"")}catch{}},ht=function(e){let n=null,s=null;if(xe)e="<remove></remove>"+e;else{const L=be(e,/^[\r\n\t ]+/);s=L&&L[0]}ae==="application/xhtml+xml"&&J===F&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const T=k?k.createHTML(e):e;if(J===F)try{n=new Zt().parseFromString(T,ae)}catch{}if(!n||!n.documentElement){n=Se.createDocument(J,"template",null);try{n.documentElement.innerHTML=Ie?oe:T}catch{}}const C=n.body||n.documentElement;return e&&s&&C.insertBefore(y.createTextNode(s),C.childNodes[0]||null),J===F?nn.call(n,q?"html":"body")[0]:q?n.documentElement:C},gt=function(e){return en.call(e.ownerDocument||e,e,we.SHOW_ELEMENT|we.SHOW_COMMENT|we.SHOW_TEXT,null)},hn=function(e){return e instanceof Vt&&(typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||!(e.attributes instanceof Xt)||typeof e.removeAttribute!="function"||typeof e.setAttribute!="function"||typeof e.namespaceURI!="string"||typeof e.insertBefore!="function"||typeof e.hasChildNodes!="function")},bt=function(e){return typeof _e=="function"&&e instanceof _e},H=function(e,n,s){U[e]&&P(U[e],T=>{T.call(d,n,s,ee)})},yt=function(e){let n=null;if(H("beforeSanitizeElements",e,null),hn(e))return $(e),!0;const s=S(e.nodeName);if(H("uponSanitizeElement",e,{tagName:s,allowedTags:w}),e.hasChildNodes()&&!bt(e.firstElementChild)&&D(/<[/\w]/g,e.innerHTML)&&D(/<[/\w]/g,e.textContent))return $(e),!0;if(!w[s]||ie[s]){if(!ie[s]&&Tt(s)&&(_.tagNameCheck instanceof RegExp&&D(_.tagNameCheck,s)||_.tagNameCheck instanceof Function&&_.tagNameCheck(s)))return!1;if(De&&!Q[s]){const T=ve(e)||e.parentNode,C=Jt(e)||e.childNodes;if(C&&T){const L=C.length;for(let N=L-1;N>=0;--N)T.insertBefore(Kt(C[N],!0),Qt(e))}}return $(e),!0}return e instanceof Ze&&!pn(e)||(s==="noscript"||s==="noembed"||s==="noframes")&&D(/<\/no(script|embed|frames)/i,e.innerHTML)?($(e),!0):(V&&e.nodeType===3&&(n=e.textContent,P([Ce,Le,Re],T=>{n=B(n,T," ")}),e.textContent!==n&&(W(d.removed,{element:e.cloneNode()}),e.textContent=n)),H("afterSanitizeElements",e,null),!1)},Et=function(e,n,s){if(it&&(n==="id"||n==="name")&&(s in y||s in fn))return!1;if(!(Me&&!ke[n]&&D(rn,n))){if(!(tt&&D(an,n))){if(!v[n]||ke[n]){if(!(Tt(e)&&(_.tagNameCheck instanceof RegExp&&D(_.tagNameCheck,e)||_.tagNameCheck instanceof Function&&_.tagNameCheck(e))&&(_.attributeNameCheck instanceof RegExp&&D(_.attributeNameCheck,n)||_.attributeNameCheck instanceof Function&&_.attributeNameCheck(n))||n==="is"&&_.allowCustomizedBuiltInElements&&(_.tagNameCheck instanceof RegExp&&D(_.tagNameCheck,s)||_.tagNameCheck instanceof Function&&_.tagNameCheck(s))))return!1}else if(!Oe[n]){if(!D(Qe,B(s,Ke,""))){if(!((n==="src"||n==="xlink:href"||n==="href")&&e!=="script"&&xt(s,"data:")===0&&st[e])){if(!(nt&&!D(sn,B(s,Ke,"")))){if(s)return!1}}}}}}return!0},Tt=function(e){return e.indexOf("-")>0},At=function(e){H("beforeSanitizeAttributes",e,null);const{attributes:n}=e;if(!n)return;const s={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:v};let T=n.length;for(;T--;){const C=n[T],{name:L,namespaceURI:N,value:Y}=C,se=S(L);let x=L==="value"?Y:Dt(Y);if(s.attrName=se,s.attrValue=x,s.keepAttr=!0,s.forceKeepAttr=void 0,H("uponSanitizeAttribute",e,s),x=s.attrValue,s.forceKeepAttr||(ze(L,e),!s.keepAttr))continue;if(!ot&&D(/\/>/i,x)){ze(L,e);continue}V&&P([Ce,Le,Re],wt=>{x=B(x,wt," ")});const _t=S(e.nodeName);if(Et(_t,se,x)){if(rt&&(se==="id"||se==="name")&&(ze(L,e),x=ln+x),k&&typeof ue=="object"&&typeof ue.getAttributeType=="function"&&!N)switch(ue.getAttributeType(_t,se)){case"TrustedHTML":{x=k.createHTML(x);break}case"TrustedScriptURL":{x=k.createScriptURL(x);break}}try{N?e.setAttributeNS(N,L,x):e.setAttribute(L,x),le(d.removed)}catch{}}}H("afterSanitizeAttributes",e,null)},gn=function u(e){let n=null;const s=gt(e);for(H("beforeSanitizeShadowDOM",e,null);n=s.nextNode();)H("uponSanitizeShadowNode",n,null),!yt(n)&&(n.content instanceof z&&u(n.content),At(n));H("afterSanitizeShadowDOM",e,null)};return d.sanitize=function(u){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=null,s=null,T=null,C=null;if(Ie=!u,Ie&&(u="<!-->"),typeof u!="string"&&!bt(u))if(typeof u.toString=="function"){if(u=u.toString(),typeof u!="string")throw ne("dirty is not a string, aborting")}else throw ne("toString is not a function");if(!d.isSupported)return u;if(Ne||Ue(e),d.removed=[],typeof u=="string"&&(re=!1),re){if(u.nodeName){const Y=S(u.nodeName);if(!w[Y]||ie[Y])throw ne("root node is forbidden and cannot be sanitized in-place")}}else if(u instanceof _e)n=ht("<!---->"),s=n.ownerDocument.importNode(u,!0),s.nodeType===1&&s.nodeName==="BODY"||s.nodeName==="HTML"?n=s:n.appendChild(s);else{if(!Z&&!V&&!q&&u.indexOf("<")===-1)return k&&pe?k.createHTML(u):u;if(n=ht(u),!n)return Z?null:pe?oe:""}n&&xe&&$(n.firstChild);const L=gt(re?u:n);for(;T=L.nextNode();)yt(T)||(T.content instanceof z&&gn(T.content),At(T));if(re)return u;if(Z){if(me)for(C=tn.call(n.ownerDocument);n.firstChild;)C.appendChild(n.firstChild);else C=n;return(v.shadowroot||v.shadowrootmode)&&(C=on.call(g,C,!0)),C}let N=q?n.outerHTML:n.innerHTML;return q&&w["!doctype"]&&n.ownerDocument&&n.ownerDocument.doctype&&n.ownerDocument.doctype.name&&D(je,n.ownerDocument.doctype.name)&&(N="<!DOCTYPE "+n.ownerDocument.doctype.name+`>
2
- `+N),V&&P([Ce,Le,Re],Y=>{N=B(N,Y," ")}),k&&pe?k.createHTML(N):N},d.setConfig=function(){let u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ue(u),Ne=!0},d.clearConfig=function(){ee=null,Ne=!1},d.isValidAttribute=function(u,e,n){ee||Ue({});const s=S(u),T=S(e);return Et(s,T,n)},d.addHook=function(u,e){typeof e=="function"&&(U[u]=U[u]||[],W(U[u],e))},d.removeHook=function(u){if(U[u])return le(U[u])},d.removeHooks=function(u){U[u]&&(U[u]=[])},d.removeAllHooks=function(){U={}},d}var jt=Ve();return jt})})(Rt);const He=Rt.exports,Nn=":host{display:inline-grid;overflow:hidden;width:100%}.view-email{width:100%}.view-email div.gmail_quote{display:none;color:var(--nylas-color-primary-400)}.view-email div.gmail_quote.show{display:block}.view-email blockquote{border-color:var(--nylas-color-primary-500) !important}.view-email .nylas-view-email-toggle-button{display:flex;justify-content:center;align-items:center;cursor:pointer;background-color:var(--nylas-color-primary-200);color:var(--nylas-color-primary-600);border:0;border-radius:2px;font-size:14px;font-weight:500;line-height:1.5;transition:all 0.2s ease-in-out}.view-email .nylas-view-email-toggle-button:hover{background-color:var(--nylas-color-primary-200);color:var(--nylas-color-primary-600)}",xn=Nn;He.addHook("afterSanitizeAttributes",function(t){"target"in t&&(t.setAttribute("target","_blank"),t.setAttribute("rel","noopener"))});const kt=class{constructor(t){o.registerInstance(this,t),this.htmlElement=document.createElement("html"),this.setBody=i=>{var p;this.state="loading",this.styles=[],this.hoistedFontURLs=new Map,this.sanitizedBody="",document.querySelectorAll(".nylas-view-email-font").forEach(a=>{a.remove()}),(this.message?o.detectIfMessageIsHTML(this.message):o.detectHTMLOrPlainText(i))||(i=`<html><body>${o.parsePlainTextToHTML(i)}</body></html>`),this.htmlElement.innerHTML=i,this.detectDarkMode&&Mn(this.htmlElement),this.htmlElement.querySelectorAll("link").forEach(a=>{if(console.debug(`[nylas-view-email] Hoisting link: ${a.getAttribute("href")}`),a.getAttribute("rel")==="stylesheet"&&a.getAttribute("href")){const m=a.getAttribute("href");if(m){const r=new URL(m,window.location.href);(r.protocol==="https:"||r.protocol==="http:")&&this.hoistedFontURLs.set(r.href,r.href)}}}),this.htmlElement.querySelectorAll("style").forEach(a=>{a.innerHTML.split(`
3
- `).forEach(m=>{const r=m.match(/@import url\((.*)\)/);if(r){const c=new URL(r[1],window.location.href);(c.protocol==="https:"||c.protocol==="http:")&&this.hoistedFontURLs.set(c.href,c.href)}}),a.innerHTML=a.innerHTML.replace("body",":host"),this.styles.push(a),a.remove()}),this.htmlElement.querySelectorAll("a").forEach(a=>{a.setAttribute("target","_blank")});const l=this.htmlElement.querySelector(".gmail_quote");if(l){const a=document.createElement("button");a.classList.add("nylas-view-email-toggle-button"),a.setAttribute("aria-label","Show quoted text"),a.innerText="...",(p=l.parentElement)==null||p.insertBefore(a,l)}this.sanitizedBody=He.sanitize(this.htmlElement.innerHTML),this.hoistedFontURLs.forEach((a,m)=>{const r=document.createElement("link");r.setAttribute("rel","stylesheet"),r.setAttribute("href",a),r.classList.add("nylas-view-email-font"),document.head.appendChild(r)}),this.state="ready"},this.handleMobileSize=()=>{var f,l,p,a;const i=Math.max(document.documentElement.clientWidth||0,window.innerWidth||0);if(i<=768){const m=(f=this.viewEmailElement)==null?void 0:f.getBoundingClientRect();if(m&&this.viewEmailElement&&this.parent&&m.width>i){const r=this.parent,c=r==null?void 0:r.getBoundingClientRect();o.debug("Parent width:",c==null?void 0:c.width,"Parent height:",c==null?void 0:c.height),o.debug("Parent client width:",r.clientWidth,"Parent client height:",r.clientHeight);const E=c.width/m.width,A=c.height/m.height,M=Math.min(E,A);o.debug("Scale:",M),this.viewEmailElement.style.setProperty("transform",`scale(${M})`),this.viewEmailElement.style.setProperty("transform-origin","top left"),this.viewEmailElement.style.setProperty("height",`${m.height*M}px`)}}else(l=this.viewEmailElement)==null||l.style.removeProperty("transform"),(p=this.viewEmailElement)==null||p.style.removeProperty("transform-origin"),(a=this.viewEmailElement)==null||a.style.removeProperty("height")},this.message=void 0,this.parent=void 0,this.attachments=[],this.detectDarkMode=!0,this.state="loading",this.sanitizedBody="",this.styles=[],this.viewEmailElement=void 0,this.hoistedFontURLs=new Map}connectedCallback(){}disconnectedCallback(){o.debug("[nylas-view-email] Component disconnected"),this.state="loading",this.styles=[],this.hoistedFontURLs=new Map,this.sanitizedBody="",document.querySelectorAll(".nylas-view-email-font").forEach(t=>{t.remove()})}async componentWillLoad(){var t;o.debug("[nylas-view-email] component loaded"),this.setBody(((t=this.message)==null?void 0:t.body)??"")}async componentDidLoad(){o.debug("[nylas-view-thread] Component did load"),this.handleMobileSize()}async messageChanged(){var t;o.debug("[nylas-view-thread] Message changed",{message:this.message}),this.setBody(((t=this.message)==null?void 0:t.body)??"")}handleScroll(){this.handleMobileSize()}viewEmailElementChanged(){var i;const t=(i=this.viewEmailElement)==null?void 0:i.querySelectorAll(".nylas-view-email-toggle-button");t&&t.forEach(f=>{f.addEventListener("click",()=>{var p;const l=(p=this.viewEmailElement)==null?void 0:p.querySelector(".gmail_quote");l&&l.classList.toggle("show")})})}render(){return console.debug("[nylas-view-email] render",{hoistedFontURLs:this.hoistedFontURLs}),o.h(o.Host,{key:"4f0a1e688ae465d65943adc7dabac9cad6c62fe8"},this.state==="loading"&&o.h("div",null,"Loading..."),this.state==="ready"&&o.h(o.Fragment,null,this.styles.map(t=>o.h("style",null,He.sanitize(t.innerHTML))),o.h("div",{class:"view-email",part:"view-email",innerHTML:this.sanitizedBody,ref:t=>this.viewEmailElement=t})))}get host(){return o.getElement(this)}static get watchers(){return{message:["messageChanged"],viewEmailElement:["viewEmailElementChanged"]}}};kt.style=xn;const Dn=".sc-reply-all-icon-h{display:flex}",On=Dn,Mt=class{constructor(t){o.registerInstance(this,t),this.width="15",this.height="15"}render(){return o.h("svg",{key:"5473055eb158788f0e5c29e437f68bc42975f443",fill:"auto",width:this.width,height:this.height,viewBox:"0 0 1920 1920",xmlns:"http://www.w3.org/2000/svg"},o.h("path",{key:"8a27d6646e2807edce6b308ebfaa17e7e71c7ce7",d:"m1030.975 188 81.249 81.249-429.228 429.228h300.747c516.223 0 936.257 420.034 936.257 936.257v98.028h-114.92v-98.028c0-452.901-368.436-821.337-821.337-821.337H682.996l429.228 429.229-81.25 81.248-567.936-567.937L1030.975 188Zm-463.038.011 81.249 81.25-486.688 486.688 486.688 486.688-81.249 81.249L0 755.949 567.937 188.01Z","fill-rule":"evenodd"}))}};Mt.style=On;const In=".sc-reply-icon-h{display:flex}",Pn=In,Nt=class{constructor(t){o.registerInstance(this,t),this.width="15",this.height="15"}render(){return o.h("svg",{key:"fe3dcd629d521170b57ee467fc46c2cded6b74da",fill:"auto",width:this.width,height:this.height,viewBox:"0 0 1920 1920",xmlns:"http://www.w3.org/2000/svg"},o.h("path",{key:"8b71c92d370bd5038c286aeab7b145a9095f0f80",d:"M835.942 632.563H244.966l478.08-478.08-90.496-90.496L-.026 696.563 632.55 1329.14l90.496-90.496-478.08-478.08h590.976c504.448 0 914.816 410.368 914.816 914.816v109.184h128V1675.38c0-574.976-467.84-1042.816-1042.816-1042.816","fill-rule":"evenodd"}))}};Nt.style=Pn;exports.forward_icon=St;exports.nylas_composer=Ct;exports.nylas_summarize_message_button=Be;exports.nylas_view_email=kt;exports.reply_all_icon=Mt;exports.reply_icon=Nt;