@verdocs/web-sdk 4.1.14 → 4.2.0

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 (174) hide show
  1. package/dist/cjs/{EnvelopeStore-db4f3f17.js → EnvelopeStore-4aeb54e1.js} +1 -1
  2. package/dist/cjs/{TemplateStore-037833e5.js → TemplateStore-7c7f1c50.js} +1 -1
  3. package/dist/cjs/{index-a5472099.js → index-2a189d85.js} +0 -517
  4. package/dist/cjs/index-cfdfab36.js +12 -24
  5. package/dist/cjs/loader.cjs.js +1 -1
  6. package/dist/cjs/verdocs-build.cjs.entry.js +2 -2
  7. package/dist/cjs/{verdocs-button-panel.cjs.entry.js → verdocs-button-panel_2.cjs.entry.js} +21 -0
  8. package/dist/cjs/{verdocs-checkbox_3.cjs.entry.js → verdocs-checkbox_4.cjs.entry.js} +17 -2
  9. package/dist/cjs/{verdocs-dialog_2.cjs.entry.js → verdocs-dialog.cjs.entry.js} +0 -22
  10. package/dist/cjs/verdocs-envelope-recipient-link_2.cjs.entry.js +2 -2
  11. package/dist/cjs/verdocs-envelope-sidebar.cjs.entry.js +3 -4
  12. package/dist/cjs/verdocs-envelopes-list.cjs.entry.js +10 -11
  13. package/dist/cjs/verdocs-preview_10.cjs.entry.js +15 -13
  14. package/dist/cjs/verdocs-radio-button_3.cjs.entry.js +2 -2
  15. package/dist/cjs/verdocs-table.cjs.entry.js +28 -0
  16. package/dist/cjs/verdocs-templates-list.cjs.entry.js +2 -2
  17. package/dist/cjs/verdocs-view.cjs.entry.js +1 -1
  18. package/dist/cjs/verdocs-web-sdk.cjs.js +1 -1
  19. package/dist/collection/collection-manifest.json +0 -5
  20. package/dist/collection/components/embeds/verdocs-send/verdocs-send.js +13 -11
  21. package/dist/collection/components/embeds/verdocs-view/verdocs-view.js +1 -1
  22. package/dist/collection/components/envelopes/verdocs-envelope-sidebar/verdocs-envelope-sidebar.js +1 -2
  23. package/dist/collection/components/envelopes/verdocs-envelopes-list/verdocs-envelopes-list.js +10 -11
  24. package/dist/collection/components/templates/verdocs-templates-list/verdocs-templates-list.js +2 -2
  25. package/dist/components/EnvelopeStore.js +2 -2
  26. package/dist/components/TemplateFieldStore.js +1 -1
  27. package/dist/components/TemplateRoleStore.js +1 -1
  28. package/dist/components/TemplateStore.js +2 -2
  29. package/dist/components/index.js +0 -10
  30. package/dist/components/index3.js +166 -4207
  31. package/dist/components/index4.js +3692 -167
  32. package/dist/components/verdocs-dialog.js +37 -1
  33. package/dist/components/verdocs-envelope-sidebar.js +1 -2
  34. package/dist/components/verdocs-envelopes-list.js +10 -11
  35. package/dist/components/verdocs-send2.js +13 -11
  36. package/dist/components/verdocs-table.js +39 -1
  37. package/dist/components/verdocs-templates-list.js +2 -2
  38. package/dist/components/verdocs-view2.js +1 -1
  39. package/dist/esm/{EnvelopeStore-9df042b5.js → EnvelopeStore-1ed5dc8f.js} +1 -1
  40. package/dist/esm/{TemplateStore-78ad24d7.js → TemplateStore-7d41d941.js} +1 -1
  41. package/dist/esm/{index-7456b04f.js → index-7588a071.js} +1 -517
  42. package/dist/esm/index-b89cf6a4.js +12 -24
  43. package/dist/esm/loader.js +1 -1
  44. package/dist/esm/verdocs-build.entry.js +2 -2
  45. package/dist/esm/{verdocs-button-panel.entry.js → verdocs-button-panel_2.entry.js} +22 -2
  46. package/dist/esm/{verdocs-checkbox_3.entry.js → verdocs-checkbox_4.entry.js} +17 -3
  47. package/dist/{components/verdocs-dialog2.js → esm/verdocs-dialog.entry.js} +7 -21
  48. package/dist/esm/verdocs-envelope-recipient-link_2.entry.js +2 -2
  49. package/dist/esm/verdocs-envelope-sidebar.entry.js +3 -4
  50. package/dist/esm/verdocs-envelopes-list.entry.js +10 -11
  51. package/dist/esm/verdocs-preview_10.entry.js +15 -13
  52. package/dist/esm/verdocs-radio-button_3.entry.js +2 -2
  53. package/dist/{components/verdocs-table2.js → esm/verdocs-table.entry.js} +7 -24
  54. package/dist/esm/verdocs-templates-list.entry.js +2 -2
  55. package/dist/esm/verdocs-view.entry.js +1 -1
  56. package/dist/esm/verdocs-web-sdk.js +1 -1
  57. package/dist/esm-es5/{EnvelopeStore-9df042b5.js → EnvelopeStore-1ed5dc8f.js} +1 -1
  58. package/dist/esm-es5/{TemplateStore-78ad24d7.js → TemplateStore-7d41d941.js} +1 -1
  59. package/dist/esm-es5/index-7588a071.js +1 -0
  60. package/dist/esm-es5/index-b89cf6a4.js +1 -1
  61. package/dist/esm-es5/loader.js +1 -1
  62. package/dist/esm-es5/verdocs-build.entry.js +1 -1
  63. package/dist/esm-es5/verdocs-button-panel_2.entry.js +1 -0
  64. package/dist/esm-es5/verdocs-checkbox_4.entry.js +1 -0
  65. package/dist/esm-es5/{verdocs-dialog_2.entry.js → verdocs-dialog.entry.js} +1 -1
  66. package/dist/esm-es5/verdocs-envelope-recipient-link_2.entry.js +1 -1
  67. package/dist/esm-es5/verdocs-envelope-sidebar.entry.js +1 -1
  68. package/dist/esm-es5/verdocs-envelopes-list.entry.js +1 -1
  69. package/dist/esm-es5/verdocs-preview_10.entry.js +1 -1
  70. package/dist/esm-es5/verdocs-radio-button_3.entry.js +1 -1
  71. package/dist/esm-es5/verdocs-table.entry.js +1 -0
  72. package/dist/esm-es5/verdocs-templates-list.entry.js +1 -1
  73. package/dist/esm-es5/verdocs-view.entry.js +1 -1
  74. package/dist/esm-es5/verdocs-web-sdk.js +1 -1
  75. package/dist/types/components.d.ts +2 -322
  76. package/dist/verdocs-web-sdk/{p-5961ce51.entry.js → p-0d54abe5.entry.js} +1 -1
  77. package/dist/verdocs-web-sdk/p-1f771dad.entry.js +1 -0
  78. package/dist/verdocs-web-sdk/{p-95e90092.system.entry.js → p-2be9ba53.system.entry.js} +1 -1
  79. package/dist/verdocs-web-sdk/p-30513f94.entry.js +1 -0
  80. package/dist/verdocs-web-sdk/p-322fa613.system.js +1 -1
  81. package/dist/verdocs-web-sdk/p-3f4b3548.system.entry.js +1 -0
  82. package/dist/verdocs-web-sdk/{p-5309a156.system.entry.js → p-413ab8a1.system.entry.js} +1 -1
  83. package/dist/verdocs-web-sdk/{p-16850eac.system.entry.js → p-48fce604.system.entry.js} +1 -1
  84. package/dist/verdocs-web-sdk/p-61257cb2.entry.js +1 -0
  85. package/dist/verdocs-web-sdk/{p-225418c7.entry.js → p-687c07ad.entry.js} +1 -1
  86. package/dist/verdocs-web-sdk/p-73f45012.system.entry.js +1 -0
  87. package/dist/verdocs-web-sdk/{p-7fe48d2e.entry.js → p-78908c67.entry.js} +1 -1
  88. package/dist/verdocs-web-sdk/{p-5e3e9c4a.system.js → p-889cc411.system.js} +1 -1
  89. package/dist/verdocs-web-sdk/p-9440752e.system.entry.js +1 -0
  90. package/dist/verdocs-web-sdk/{p-f05a3654.system.entry.js → p-977a5a4b.system.entry.js} +1 -1
  91. package/dist/verdocs-web-sdk/{p-540d9467.entry.js → p-9d36d2ad.entry.js} +1 -1
  92. package/dist/verdocs-web-sdk/p-a706bac9.js +1 -0
  93. package/dist/verdocs-web-sdk/p-b3017cd6.entry.js +1 -0
  94. package/dist/verdocs-web-sdk/{p-316b550f.entry.js → p-b61842bd.entry.js} +1 -1
  95. package/dist/verdocs-web-sdk/{p-03aedbe9.system.entry.js → p-b6b6f12a.system.entry.js} +1 -1
  96. package/dist/verdocs-web-sdk/{p-0e022e75.system.entry.js → p-b7397955.system.entry.js} +1 -1
  97. package/dist/verdocs-web-sdk/p-ba6570b4.system.entry.js +1 -0
  98. package/dist/verdocs-web-sdk/{p-afbbdc2f.system.js → p-c8de3052.system.js} +1 -1
  99. package/dist/verdocs-web-sdk/p-cf7f4475.entry.js +1 -0
  100. package/dist/verdocs-web-sdk/{p-8a820b88.system.entry.js → p-d2feac5b.system.entry.js} +1 -1
  101. package/dist/verdocs-web-sdk/p-e7578fac.entry.js +1 -0
  102. package/dist/verdocs-web-sdk/{p-c28c4e43.js → p-f02e08da.js} +1 -1
  103. package/dist/verdocs-web-sdk/p-f5064e0c.system.js +1 -0
  104. package/dist/verdocs-web-sdk/{p-5df130eb.entry.js → p-f632ffac.entry.js} +1 -1
  105. package/dist/verdocs-web-sdk/{p-9ec464df.js → p-fc2ae858.js} +1 -1
  106. package/dist/verdocs-web-sdk/p-fc5e568d.system.entry.js +1 -0
  107. package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
  108. package/package.json +2 -3
  109. package/dist/cjs/verdocs-component-error.cjs.entry.js +0 -21
  110. package/dist/cjs/verdocs-settings-api-keys_4.cjs.entry.js +0 -542
  111. package/dist/cjs/verdocs-settings.cjs.entry.js +0 -42
  112. package/dist/cjs/verdocs-tabs.cjs.entry.js +0 -27
  113. package/dist/collection/components/embeds/verdocs-settings/verdocs-settings.css +0 -40
  114. package/dist/collection/components/embeds/verdocs-settings/verdocs-settings.js +0 -104
  115. package/dist/collection/components/settings/verdocs-settings-api-keys/verdocs-settings-api-keys.css +0 -64
  116. package/dist/collection/components/settings/verdocs-settings-api-keys/verdocs-settings-api-keys.js +0 -292
  117. package/dist/collection/components/settings/verdocs-settings-members/verdocs-settings-members.css +0 -80
  118. package/dist/collection/components/settings/verdocs-settings-members/verdocs-settings-members.js +0 -349
  119. package/dist/collection/components/settings/verdocs-settings-organization/TimeZones.js +0 -144
  120. package/dist/collection/components/settings/verdocs-settings-organization/verdocs-settings-organization.css +0 -44
  121. package/dist/collection/components/settings/verdocs-settings-organization/verdocs-settings-organization.js +0 -192
  122. package/dist/collection/components/settings/verdocs-settings-profile/verdocs-settings-profile.css +0 -44
  123. package/dist/collection/components/settings/verdocs-settings-profile/verdocs-settings-profile.js +0 -190
  124. package/dist/components/verdocs-settings-api-keys.d.ts +0 -11
  125. package/dist/components/verdocs-settings-api-keys.js +0 -6
  126. package/dist/components/verdocs-settings-api-keys2.js +0 -209
  127. package/dist/components/verdocs-settings-members.d.ts +0 -11
  128. package/dist/components/verdocs-settings-members.js +0 -6
  129. package/dist/components/verdocs-settings-members2.js +0 -273
  130. package/dist/components/verdocs-settings-organization.d.ts +0 -11
  131. package/dist/components/verdocs-settings-organization.js +0 -6
  132. package/dist/components/verdocs-settings-organization2.js +0 -142
  133. package/dist/components/verdocs-settings-profile.d.ts +0 -11
  134. package/dist/components/verdocs-settings-profile.js +0 -6
  135. package/dist/components/verdocs-settings-profile2.js +0 -140
  136. package/dist/components/verdocs-settings.d.ts +0 -11
  137. package/dist/components/verdocs-settings.js +0 -130
  138. package/dist/esm/verdocs-component-error.entry.js +0 -17
  139. package/dist/esm/verdocs-dialog_2.entry.js +0 -46
  140. package/dist/esm/verdocs-settings-api-keys_4.entry.js +0 -535
  141. package/dist/esm/verdocs-settings.entry.js +0 -38
  142. package/dist/esm/verdocs-tabs.entry.js +0 -23
  143. package/dist/esm-es5/index-7456b04f.js +0 -1
  144. package/dist/esm-es5/verdocs-button-panel.entry.js +0 -1
  145. package/dist/esm-es5/verdocs-checkbox_3.entry.js +0 -1
  146. package/dist/esm-es5/verdocs-component-error.entry.js +0 -1
  147. package/dist/esm-es5/verdocs-settings-api-keys_4.entry.js +0 -1
  148. package/dist/esm-es5/verdocs-settings.entry.js +0 -1
  149. package/dist/esm-es5/verdocs-tabs.entry.js +0 -1
  150. package/dist/types/components/embeds/verdocs-settings/verdocs-settings.d.ts +0 -26
  151. package/dist/types/components/settings/verdocs-settings-api-keys/verdocs-settings-api-keys.d.ts +0 -54
  152. package/dist/types/components/settings/verdocs-settings-members/verdocs-settings-members.d.ts +0 -58
  153. package/dist/types/components/settings/verdocs-settings-organization/TimeZones.d.ts +0 -1
  154. package/dist/types/components/settings/verdocs-settings-organization/verdocs-settings-organization.d.ts +0 -37
  155. package/dist/types/components/settings/verdocs-settings-profile/verdocs-settings-profile.d.ts +0 -37
  156. package/dist/verdocs-web-sdk/p-03f8d33f.entry.js +0 -1
  157. package/dist/verdocs-web-sdk/p-12c26b19.system.entry.js +0 -1
  158. package/dist/verdocs-web-sdk/p-141a992e.system.entry.js +0 -1
  159. package/dist/verdocs-web-sdk/p-3ecaea8a.system.entry.js +0 -1
  160. package/dist/verdocs-web-sdk/p-45cf0ab5.entry.js +0 -1
  161. package/dist/verdocs-web-sdk/p-4df630c2.system.entry.js +0 -1
  162. package/dist/verdocs-web-sdk/p-515ee177.system.entry.js +0 -1
  163. package/dist/verdocs-web-sdk/p-6fa08e21.system.entry.js +0 -1
  164. package/dist/verdocs-web-sdk/p-708b5430.system.entry.js +0 -1
  165. package/dist/verdocs-web-sdk/p-753d0e16.entry.js +0 -1
  166. package/dist/verdocs-web-sdk/p-952b88fb.system.js +0 -1
  167. package/dist/verdocs-web-sdk/p-971ab2d1.entry.js +0 -1
  168. package/dist/verdocs-web-sdk/p-e42587b7.entry.js +0 -1
  169. package/dist/verdocs-web-sdk/p-efc547dc.entry.js +0 -1
  170. package/dist/verdocs-web-sdk/p-f3b47dfc.js +0 -1
  171. package/dist/verdocs-web-sdk/p-f44b9bd0.entry.js +0 -1
  172. package/dist/verdocs-web-sdk/p-f73b68fb.entry.js +0 -1
  173. package/dist/verdocs-web-sdk/p-fbfdfcd4.system.entry.js +0 -1
  174. package/dist/verdocs-web-sdk/p-fe0c473d.entry.js +0 -1
@@ -0,0 +1 @@
1
+ import{r as e,c as t,h as i,H as s,F as o,g as l}from"./p-73a6f972.js";import{VerdocsEndpoint as a,integerSequence as r,createEnvelope as n,isValidEmail as d,isValidPhone as c,getRGBA as p,createTemplateDocument as h,deleteTemplateDocument as v,createTemplatev2 as m,updateField as u,createField as g,updateTemplate as f,createTemplateReminder as x,updateTemplateReminder as b,deleteTemplateReminder as w,updateTemplateRole as y,createTemplateRole as k}from"@verdocs/js-sdk";import{g as C,u as E}from"./p-f69d8d39.js";import{g as q,b as S,a as z,u as M}from"./p-316fc185.js";import{g as L}from"./p-fc2ae858.js";import{r as I,b as T,c as H,g as Z,d as V,e as D,f as R}from"./p-cc32d84f.js";import{S as _}from"./p-fd97809c.js";import{D as U,P as N,J as A,a as B,F as P,b as j,T as F}from"./p-b0766439.js";import{V as $}from"./p-026b3103.js";import{d as O}from"./p-edaec1b6.js";import{i as Q}from"./p-627f774b.js";import"./p-00b37c9a.js";import"./p-a706bac9.js";import"./p-251c4106.js";const W=class{constructor(i){e(this,i),this.sdkError=t(this,"sdkError",7),this.templateStore=null,this.fieldStore=null,this.roleStore=null,this.endpoint=a.getDefault(),this.templateId=null,this.loading=!0}onTemplateIdChanged(e){console.log("[PREVIEW] Template ID changed",e),this.loadTemplate(e).catch((e=>console.log("Unknown Error",e)))}async componentWillLoad(){var e,t,i,s,o,l;try{if(this.endpoint.loadSession(),!this.endpoint.session)return void console.log("[PREVIEW] Unable to start builder session, must be authenticated");if(!this.templateId)return void console.log(`[PREVIEW] Missing required template ID ${this.templateId}`);try{L(this.endpoint,this.templateId,!0).then((e=>{this.templateStore=e,this.fieldStore=C(this.templateId),this.roleStore=q(this.templateId),this.loading=!1})).catch((e=>{console.log(e)}))}catch(s){console.log("[PREVIEW] Error with preview session",s),null===(e=this.sdkError)||void 0===e||e.emit(new _(s.message,null===(t=s.response)||void 0===t?void 0:t.status,null===(i=s.response)||void 0===i?void 0:i.data))}}catch(e){console.log("[PREVIEW] Error with preview session",e),null===(s=this.sdkError)||void 0===s||s.emit(new _(e.message,null===(o=e.response)||void 0===o?void 0:o.status,null===(l=e.response)||void 0===l?void 0:l.data))}}async loadTemplate(e){e&&(this.templateStore=await L(this.endpoint,e,!1))}handlePageRendered(e){var t,i;const s=e.detail;(null===(i=null===(t=this.templateStore)||void 0===t?void 0:t.state)||void 0===i?void 0:i.fields.filter((e=>e.page===s.pageNumber))).forEach((e=>I(e,s,{disabled:!0,editable:!1,draggable:!1})))}render(){var e,t;return i(s,null,this.loading?i("verdocs-loader",null):((null===(t=null===(e=this.templateStore)||void 0===e?void 0:e.state)||void 0===t?void 0:t.documents)||[]).map((e=>{const t=r(1,e.pages);return i(o,null,t.map((t=>i("verdocs-template-document-page",{templateId:e.template_id,documentId:e.id,pageNumber:t,disabled:!0,editable:!1,done:!1,virtualWidth:612,virtualHeight:792,onPageRendered:e=>this.handlePageRendered(e),layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]}))))})))}static get watchers(){return{templateId:["onTemplateIdChanged"]}}};W.style='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-preview{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;min-height:200px;position:relative;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-preview div,verdocs-preview canvas{-webkit-box-sizing:border-box;box-sizing:border-box}';const Y='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"></path></svg>',X=class{constructor(i){e(this,i),this.sendingEnvelope=t(this,"sendingEnvelope",7),this.send=t(this,"send",7),this.exit=t(this,"exit",7),this.sdkError=t(this,"sdkError",7),this.searchContacts=t(this,"searchContacts",7),this.templateStore=null,this.roleStore=null,this.endpoint=a.getDefault(),this.templateId=null,this.environment="web",this.containerId=`verdocs-send-${Math.random().toString(36).substring(2,11)}`,this.rolesAtLevel={},this.showPickerForId="",this.sessionContacts=[],this.sending=!1,this.rolesCompleted={}}async reset(){this.rolesCompleted={}}onTemplateIdChanged(e){console.log("[SEND] Template ID changed",e),this.loadTemplate(e).catch((e=>console.log("Unknown Error",e)))}async componentWillLoad(){var e,t,i;try{return this.endpoint.loadSession(),this.endpoint.session?this.templateId?this.loadTemplate(this.templateId):void console.log(`[SEND] Missing required template ID ${this.templateId}`):void console.log("[SEND] Unable to start Send operation, must be authenticated")}catch(s){console.log("[SEND] Error with send session",s),null===(e=this.sdkError)||void 0===e||e.emit(new _(s.message,null===(t=s.response)||void 0===t?void 0:t.status,null===(i=s.response)||void 0===i?void 0:i.data))}}async loadTemplate(e){var t,i,s,o,l;if(e)try{this.endpoint.onSessionChanged(((e,t,i)=>{i&&(this.sessionContacts=[],this.sessionContacts.push({id:i.id,name:`${i.first_name} ${i.last_name}`,email:i.email,phone:i.phone}))})),this.templateStore=await L(this.endpoint,e,!1),this.roleStore=q(e),this.recomputeRolesCompleted(),(null===(i=null===(t=this.templateStore)||void 0===t?void 0:t.state)||void 0===i?void 0:i.is_sendable)||console.warn("[SEND] Template is not sendable",e)}catch(e){console.log("[SEND] Error with preview session",e),null===(s=this.sdkError)||void 0===s||s.emit(new _(e.message,null===(o=e.response)||void 0===o?void 0:o.status,null===(l=e.response)||void 0===l?void 0:l.data))}}recomputeRolesCompleted(){const e=this.roleStore.get("roles")||[],t={};this.rolesCompleted={},e.forEach((e=>{const i=e.sequence-1;t[i]||(t[i]=[]);const s=`r-${i}-${t[i].length}`;t[i].push({...e,id:s}),e.full_name&&(e.email||e.phone)&&(this.rolesCompleted[s]={...e,id:s})}))}getRoleLevels(){const e=this.roleStore.get("roles")||[],t={};this.rolesCompleted={},e.forEach((e=>{const i=e.sequence-1;t[i]||(t[i]=[]);const s=`r-${i}-${t[i].length}`;t[i].push({...e,id:s})})),this.rolesAtLevel=t;const i=Object.keys(t).map((e=>+e));return i.sort(((e,t)=>e-t)),i}getLevelIcon(e){const t=this.getRoleLevels();return i("div",e<0?{class:"level-icon",innerHTML:'<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M2 12C2 6.48 6.48 2 12 2s10 4.48 10 10-4.48 10-10 10S2 17.52 2 12zm10 6c3.31 0 6-2.69 6-6s-2.69-6-6-6-6 2.69-6 6 2.69 6 6 6z"></path></svg>'}:e>=t.length?{class:"level-icon",innerHTML:'<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="m18 7-1.41-1.41-6.34 6.34 1.41 1.41L18 7zm4.24-1.41L11.66 16.17 7.48 12l-1.41 1.41L11.66 19l12-12-1.42-1.41zM.41 13.41 6 19l1.41-1.41L1.83 12 .41 13.41z"></path></svg>'}:{class:"level-icon",innerHTML:'<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path></svg>'})}handleSelectContact(e,t){e.preventDefault(),this.rolesCompleted[t.id]={...t,...e.detail},this.showPickerForId=""}handleClickRole(e,t){e.stopPropagation(),this.showPickerForId=t.id}handleSend(e){var t,i,s;if(this.sending)return void console.log("Skipping duplicate send",e);console.log("Sending",e),e.preventDefault(),e.stopPropagation(),this.sending=!0,null===(t=this.sendingEnvelope)||void 0===t||t.emit({sending:!0});const o={template_id:this.templateId,name:null===(s=null===(i=this.templateStore)||void 0===i?void 0:i.state)||void 0===s?void 0:s.name,environment:this.environment,roles:Object.values(this.rolesCompleted),prepared_fields:[]};console.log("[SEND] Creating envelope",o),n(this.endpoint,o).then((e=>{var t,i;console.log("[SEND] Send envelope",e),this.reset().catch((e=>console.log("Unknown Error",e))),this.sending=!1,null===(t=this.sendingEnvelope)||void 0===t||t.emit({sending:!1}),null===(i=this.send)||void 0===i||i.emit({...o,envelope_id:e.id,envelope:e})})).catch((e=>{var t;console.log("Send error",e),this.sending=!1,null===(t=this.sendingEnvelope)||void 0===t||t.emit({sending:!1})}))}handleCancel(e){var t;e.stopPropagation(),null===(t=this.exit)||void 0===t||t.emit()}render(){var e,t;if(!this.endpoint.session)return i(s,{style:{display:"flex"}},i("verdocs-component-error",{message:"You must be authenticated to use this module."}));const o=S(this.roleStore),l=Object.values(this.rolesCompleted).filter((e=>d(e.email)||c(e.phone))).length>=o.length,a=this.getRoleLevels();return i(s,{class:{sendable:null===(t=null===(e=this.templateStore)||void 0===e?void 0:e.state)||void 0===t?void 0:t.is_sendable}},i("div",{class:"recipients"},i("div",{class:"left-line"}),i("div",{class:"level level-start"},this.getLevelIcon(-1),i("div",{class:"complete"},"Send Envelope")),a.map((e=>i("div",{class:`level level-${e}`},this.getLevelIcon(e),this.rolesAtLevel[e].map((e=>{var t,s,o,l,a,r;const n=`verdocs-send-recipient-${e.name}`;return e.email?i("div",{class:"recipient",style:{borderColor:p(z(this.roleStore,e.name))},onClick:t=>this.handleClickRole(t,e),id:n},null!==(a=null===(l=this.rolesCompleted[e.id])||void 0===l?void 0:l.full_name)&&void 0!==a?a:e.full_name,i("div",{class:"icon",innerHTML:Y}),this.showPickerForId===e.id&&i("verdocs-portal",{anchor:n,onClickAway:()=>this.showPickerForId=""},i("verdocs-contact-picker",{onExit:()=>this.showPickerForId="",onNext:t=>this.handleSelectContact(t,e),contactSuggestions:this.sessionContacts,templateRole:null!==(r=this.rolesCompleted[e.id])&&void 0!==r?r:e,onSearchContacts:e=>{var t;return null===(t=this.searchContacts)||void 0===t?void 0:t.emit(e.detail)}}))):i("div",{class:"recipient",style:{backgroundColor:p(z(this.roleStore,e.name))},onClick:t=>this.handleClickRole(t,e),id:n},null!==(s=null===(t=this.rolesCompleted[e.id])||void 0===t?void 0:t.full_name)&&void 0!==s?s:e.name,i("div",{class:"icon",innerHTML:Y}),this.showPickerForId===e.id&&i("verdocs-portal",{anchor:n,onClickAway:()=>this.showPickerForId=""},i("verdocs-contact-picker",{onExit:()=>this.showPickerForId="",onNext:t=>this.handleSelectContact(t,e),contactSuggestions:this.sessionContacts,templateRole:null!==(o=this.rolesCompleted[e.id])&&void 0!==o?o:e,onSearchContacts:e=>{var t;return null===(t=this.searchContacts)||void 0===t?void 0:t.emit(e.detail)}})))}))))),i("div",{class:"level level-done"},this.getLevelIcon(a.length),i("div",{class:"complete"},"Signing Complete"))),i("div",{class:"buttons"},i("verdocs-button",{label:"Cancel",size:"small",variant:"outline",onClick:e=>this.handleCancel(e),disabled:this.sending}),i("verdocs-button",{label:"Send",size:"small",disabled:!l||this.sending,onClick:e=>this.handleSend(e)}),this.sending&&i("verdocs-spinner",null)))}static get watchers(){return{templateId:["onTemplateIdChanged"]}}};X.style='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-send{padding:10px;position:relative;background:#ffffff;-ms-flex-direction:column;flex-direction:column;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;display:none}verdocs-send.sendable{display:-ms-flexbox;display:flex}verdocs-send .recipients{position:relative}verdocs-send .left-line{top:32px;left:20px;z-index:1;width:12px;bottom:30px;position:absolute;background:#ffffff;border-left:3px dotted #9b9b9b}verdocs-send .level{display:-ms-flexbox;display:flex;-webkit-column-gap:10px;-moz-column-gap:10px;column-gap:10px;margin-left:50px;position:relative;-ms-flex-direction:row;flex-direction:row;padding:8px 0 4px 0;border-bottom:1px solid rgba(151, 151, 151, 0.2666666667)}verdocs-send .level .level-icon{top:14px;z-index:2;left:-40px;width:24px;height:24px;position:absolute;background:#ffffff}verdocs-send .level .level-icon svg{fill:rgba(0, 0, 0, 0.537254902)}verdocs-send .level .recipient{height:30px;display:-ms-flexbox;display:flex;-ms-flex:0 0 30px;flex:0 0 30px;color:#000000;cursor:pointer;font-size:14px;-ms-flex-align:center;align-items:center;border-radius:30px;-ms-flex-direction:row;flex-direction:row;background:#dddddd;white-space:nowrap;border:2px solid #dddddd;padding:2px 10px 2px 14px}verdocs-send .level .recipient .icon{width:22px;height:22px;-ms-flex:0 0 22px;flex:0 0 22px;margin:0 0 0 10px}verdocs-send .level .recipient .icon svg{width:22px;height:22px;fill:#333333;outline:none}verdocs-send .level .complete{-ms-flex:1;flex:1;height:30px;display:-ms-flexbox;display:flex;color:#000000;font-size:14px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;padding:3px 10px 3px 2px}verdocs-send .buttons{display:-ms-flexbox;display:flex;margin-top:10px;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-direction:row;flex-direction:row}verdocs-send verdocs-contact-picker{left:0;top:41px;z-index:10;position:absolute;border:1px solid #dddddd;-webkit-box-shadow:0 0 6px 3px rgba(0, 0, 0, 0.1);box-shadow:0 0 6px 3px rgba(0, 0, 0, 0.1)}';const K=class{constructor(i){e(this,i),this.exit=t(this,"exit",7),this.next=t(this,"next",7),this.templateUpdated=t(this,"templateUpdated",7),this.sdkError=t(this,"sdkError",7),this.endpoint=a.getDefault(),this.templateId="",this.uploading=!1,this.progressLabel="Uploading...",this.progressPercent=0,this.showDeleteError=!1,this.confirmDeleteDocument=null,this.store=null}async componentWillLoad(){var e,t,i;try{if(this.endpoint.loadSession(),!this.templateId)return void console.log(`[ROLES] Missing required template ID ${this.templateId}`);if(!this.endpoint.session)return void console.log("[ROLES] Unable to start builder session, must be authenticated");this.store=await L(this.endpoint,this.templateId,!1)}catch(s){console.log("[TEMPLATE ATTACHMENTS] Error loading template",s),null===(e=this.sdkError)||void 0===e||e.emit(new _(s.message,null===(t=s.response)||void 0===t?void 0:t.status,null===(i=s.response)||void 0===i?void 0:i.data))}}handleCancel(e){e.stopPropagation(),this.exit.emit()}handleUploadProgress(e){e>=99?(this.progressPercent=100,this.progressLabel="Processing..."):this.progressPercent=e}async handleUpload(e){var t,i,s,o;e.stopPropagation();const l=e.detail.file;if(l){console.log("[ATTACHMENTS] Uploading...",l),this.uploading=!0,this.progressLabel="Uploading...";try{const e=await h(this.endpoint,this.templateId,l,this.handleUploadProgress.bind(this));console.log("[ATTACHMENTS] Created attachment",e),this.store=await L(this.endpoint,this.templateId,!1),console.log("[ATTACHMENTS] Updated template",this.store.state),null===(t=this.templateUpdated)||void 0===t||t.emit({endpoint:this.endpoint,template:this.store.state,event:"attachments"}),this.uploading=!1,this.progressLabel="",this.progressPercent=0}catch(e){console.log("[ATTACHMENTS] Error creating template",e),null===(i=this.sdkError)||void 0===i||i.emit(new _(e.message,null===(s=e.response)||void 0===s?void 0:s.status,null===(o=e.response)||void 0===o?void 0:o.data)),this.uploading=!1}}}handleNext(e){var t;e.stopPropagation(),this.uploading=!1,this.progressLabel="",this.progressPercent=0,null===(t=this.next)||void 0===t||t.emit({template:this.store.state})}async confirmDelete(){await v(this.endpoint,this.templateId,this.confirmDeleteDocument.id),this.store=await L(this.endpoint,this.templateId,!1),console.log("[ATTACHMENTS] New template",this.store.state),this.confirmDeleteDocument=null}async handleDelete(e){var t;(null===(t=this.store.state)||void 0===t?void 0:t.documents.length)>1?this.confirmDeleteDocument=e:this.showDeleteError=!0}getFileIcon(e){switch(e.mime){case"application/pdf":return B;case"image/jpeg":return A;case"image/png":return N;case"application/msword":case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return U}return P}render(){var e,t,o;if(!this.endpoint.session)return i(s,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}));const l=null===(e=this.store)||void 0===e?void 0:e.state;return l.isLoaded?this.endpoint.session&&l.profile_id?i(s,null,i("h5",null,"Existing Attachments"),i("div",{class:"attachments"},null===(t=this.store)||void 0===t?void 0:t.state.documents.map((e=>i("div",{class:"attachment"},i("div",{class:"file-icon",innerHTML:this.getFileIcon(e)}),i("div",{class:"filename",title:e.name},e.name),i("div",{class:"pages"},i("div",{class:"count"},e.pages),i("div",{class:"pages-icon",innerHTML:j})),i("div",{class:"trash-icon",innerHTML:F,onClick:()=>this.handleDelete(e)}))))),i("h5",null,"Attach a New Document"),this.uploading?i("div",{class:"loader-wrapper"},i("verdocs-loader",null),this.progressLabel&&i("div",{class:"progress-wrapper"},i("verdocs-progress-bar",{showPercent:!0,percent:this.progressPercent,label:this.progressLabel}))):i("verdocs-file-chooser",{onFileSelected:e=>this.handleUpload(e)}),i("div",{class:"buttons"},i("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:e=>this.handleCancel(e),disabled:this.uploading}),i("verdocs-button",{label:"Next",size:"small",onClick:e=>this.handleNext(e),disabled:!(null===(o=this.store)||void 0===o?void 0:o.state.documents.length)||this.uploading})),this.showDeleteError&&i("verdocs-ok-dialog",{heading:"Unable to Delete Attachment",message:"Templates must contain at least one attachment.",onNext:()=>this.showDeleteError=!1}),this.confirmDeleteDocument&&i("verdocs-ok-dialog",{heading:"Delete this Attachment?",message:"This operation cannot be undone. All fields placed<br />on the deleted attachment will also be removed.",onNext:()=>this.confirmDelete(),showCancel:!0,onExit:()=>{this.confirmDeleteDocument=null}})):i(s,{class:"empty"}):i(s,{class:"loading"},i("verdocs-loader",null))}};K.style='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-attachments{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-attachments h5{font-size:16px;font-weight:bold;margin:0 0 10px 0;color:#46497d}verdocs-template-attachments .attachments{margin:0 0 40px 0}verdocs-template-attachments .attachment{display:-ms-flexbox;display:flex;padding:5px 0;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;color:#33364b}verdocs-template-attachments .attachment:hover .trash-icon{display:-ms-flexbox;display:flex}verdocs-template-attachments .attachment:hover .pages{display:none}verdocs-template-attachments svg{width:28px;height:28px;fill:#5c6575;margin:2px 0 0 0}verdocs-template-attachments .file-icon{-ms-flex:0;flex:0}verdocs-template-attachments .pages{width:24px;height:24px;-ms-flex:0 0 24px;flex:0 0 24px;padding-left:4px;position:relative;margin:-10px 0 0 0}verdocs-template-attachments .pages .pages-icon{top:0;left:0;width:24px;height:24px;position:absolute}verdocs-template-attachments .pages .count{top:11px;left:7px;z-index:1;width:18px;font-size:12px;font-weight:500;position:absolute;text-align:center;letter-spacing:-2px}verdocs-template-attachments .filename{-ms-flex:1;flex:1;display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;border-bottom:1px dotted #cccccc}verdocs-template-attachments .trash-icon{-ms-flex:0;flex:0;display:none}verdocs-template-attachments .trash-icon:hover{cursor:pointer}verdocs-template-attachments verdocs-file-chooser{margin:10px 0;border:2px dashed #979797}verdocs-template-attachments .loader-wrapper{background-color:#ffffff;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;width:320px;height:320px;text-align:center;border:2px dashed #979797;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-attachments .progress-wrapper{padding:20px}verdocs-template-attachments .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-attachments .buttons .flex-fill{-ms-flex:1;flex:1}verdocs-template-attachments ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::-moz-placeholder{color:#aaaaaa}verdocs-template-attachments :-ms-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::placeholder{color:#aaaaaa}';const J=["attachments","roles","settings","fields","preview"],G=class{constructor(i){e(this,i),this.sdkError=t(this,"sdkError",7),this.stepChanged=t(this,"stepChanged",7),this.endpoint=a.getDefault(),this.templateId=null,this.step="preview",this.templateStore=null}onTemplateIdChanged(e){console.log("[BUILD_TABS] Template ID changed",e),this.loadTemplate(e).catch((e=>console.log("Unknown Error",e)))}onStepChanged(e){console.log("[BUILD_TABS] Step changed",e),this.loadTemplate(this.templateId).catch((e=>console.log("Unknown Error",e)))}async componentWillLoad(){var e,t,i,s,o,l;try{if(this.endpoint.loadSession(),!this.endpoint.session)return void console.log("[BUILD_TABS] Unable to start builder session, must be authenticated");if(!this.templateId)return this.step="attachments",void console.log("[BUILD_TABS] Missing required template ID, forcing view to attachments");try{this.templateStore=await L(this.endpoint,this.templateId,!1)}catch(s){console.log("[BUILD_TABS] Error loading template",s),null===(e=this.sdkError)||void 0===e||e.emit(new _(s.message,null===(t=s.response)||void 0===t?void 0:t.status,null===(i=s.response)||void 0===i?void 0:i.data))}}catch(e){console.log("[BUILD_TABS] Error loading template",e),null===(s=this.sdkError)||void 0===s||s.emit(new _(e.message,null===(o=e.response)||void 0===o?void 0:o.status,null===(l=e.response)||void 0===l?void 0:l.data))}}async loadTemplate(e){e&&(this.templateStore=await L(this.endpoint,e,!1))}setStep(e){var t;console.log("Selected step",e.detail.tab.id),e.stopPropagation(),e.preventDefault(),this.step=e.detail.tab.id,null===(t=this.stepChanged)||void 0===t||t.emit(e.detail.tab.id)}copyTemplateId(){navigator.clipboard.writeText(this.templateId).then((()=>{$("Template ID copied",{style:"success",duration:3e3})})).catch((e=>{var t;console.warn("[BUILD_TABS] Error copying to clipboard",e),null===(t=this.sdkError)||void 0===t||t.emit(e)}))}render(){var e,t,o,l,a,r,n,d,c,p,h,v,m,u,g,f,x,b,w,y,k;if(!this.endpoint.session)return i(s,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}));let C=!1,E=!1,q=!1;this.templateId&&this.templateStore&&this.templateStore.state&&(q=(null===(o=null===(t=null===(e=this.templateStore)||void 0===e?void 0:e.state)||void 0===t?void 0:t.documents)||void 0===o?void 0:o.length)>0,E=q&&(null===(r=null===(a=null===(l=this.templateStore)||void 0===l?void 0:l.state)||void 0===a?void 0:a.roles)||void 0===r?void 0:r.length)>0,C=E&&(null===(c=null===(d=null===(n=this.templateStore)||void 0===n?void 0:n.state)||void 0===d?void 0:d.fields)||void 0===c?void 0:c.length)>0);let S=Math.max(J.indexOf(this.step),0);return!C&&S>=4&&(S=3),!E&&S>=3&&(S=1),!q&&S>=1&&(S=0),i(s,null,i("verdocs-tabs",{onSelectTab:e=>this.setStep(e),selectedTab:S,tabs:[{id:"attachments",disabled:!1,label:"Attachment(s)"},{id:"roles",disabled:!q,label:"Roles"},{id:"settings",disabled:!E,label:"Settings"},{id:"fields",disabled:!E,label:"Fields"},{id:"preview",disabled:!C,label:"Preview/Send"}]}),this.templateId&&i("div",{class:"info"},i("verdocs-button-panel",{icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" fill="#5c6575"><path d="M11.925 18q.55 0 .938-.387.387-.388.387-.938 0-.55-.387-.925-.388-.375-.938-.375-.55 0-.925.375t-.375.925q0 .55.375.938.375.387.925.387Zm-.95-3.85h1.95q0-.8.2-1.287.2-.488 1.025-1.288.65-.625 1.025-1.213.375-.587.375-1.437 0-1.425-1.025-2.175Q13.5 6 12.1 6q-1.425 0-2.35.775t-1.275 1.85l1.775.7q.125-.45.55-.975.425-.525 1.275-.525.725 0 1.1.412.375.413.375.888 0 .475-.287.9-.288.425-.713.775-1.075.95-1.325 1.475-.25.525-.25 1.875ZM12 22.2q-2.125 0-3.988-.8-1.862-.8-3.237-2.175Q3.4 17.85 2.6 15.988 1.8 14.125 1.8 12t.8-3.988q.8-1.862 2.175-3.237Q6.15 3.4 8.012 2.6 9.875 1.8 12 1.8t3.988.8q1.862.8 3.237 2.175Q20.6 6.15 21.4 8.012q.8 1.863.8 3.988t-.8 3.988q-.8 1.862-2.175 3.237Q17.85 20.6 15.988 21.4q-1.863.8-3.988.8Zm0-2.275q3.325 0 5.625-2.3t2.3-5.625q0-3.325-2.3-5.625T12 4.075q-3.325 0-5.625 2.3T4.075 12q0 3.325 2.3 5.625t5.625 2.3ZM12 12Z"/></svg>'},i("div",{class:"template-details-panel"},i("h6",null,"Template Details"),i("div",{class:"row"},i("label",null,"ID:"),i("div",{class:"value"},this.templateId),i("div",{class:"icon-button",innerHTML:'<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"><path stroke-linecap="round" stroke-linejoin="round" d="M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 0 1-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 0 1 1.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 0 0-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 0 1-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 0 0-3.375-3.375h-1.5a1.125 1.125 0 0 1-1.125-1.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H9.75" /></svg>',onClick:()=>this.copyTemplateId()})),i("div",{class:"row"},i("label",null,"Name:"),i("div",{class:"value"},null===(h=null===(p=this.templateStore)||void 0===p?void 0:p.state)||void 0===h?void 0:h.name)),i("div",{class:"row"},i("label",null,"Visibility:"),i("div",{class:"value"},(null===(m=null===(v=this.templateStore)||void 0===v?void 0:v.state)||void 0===m?void 0:m.is_public)?"Public":(null===(g=null===(u=this.templateStore)||void 0===u?void 0:u.state)||void 0===g?void 0:g.is_personal)?"Private":"Shared")),i("div",{class:"row"},i("label",null,"Created:"),i("div",{class:"value"},(null===(x=null===(f=this.templateStore)||void 0===f?void 0:f.state)||void 0===x?void 0:x.counter)?O.format(new Date(null===(w=null===(b=this.templateStore)||void 0===b?void 0:b.state)||void 0===w?void 0:w.created_at),"P p"):"")),i("div",{class:"row"},i("label",null,"Used:"),i("div",{class:"value"},null===(k=null===(y=this.templateStore)||void 0===y?void 0:y.state)||void 0===k?void 0:k.counter," time(s)"))))))}static get watchers(){return{templateId:["onTemplateIdChanged"],step:["onStepChanged"]}}};G.style='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-build-tabs{-ms-flex:1;flex:1;gap:15px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-build-tabs verdocs-button-panel svg{-webkit-transform:scale(0.8);transform:scale(0.8)}verdocs-template-build-tabs verdocs-template-attachments,verdocs-template-build-tabs verdocs-template-roles{margin:20px}verdocs-template-build-tabs verdocs-template-fields{border-top:1px solid #777777}verdocs-template-build-tabs verdocs-template-attachments{padding:20px;background:#ffffff}verdocs-template-build-tabs verdocs-template-fields{width:100%}verdocs-template-build-tabs verdocs-preview{-ms-flex:1;flex:1}.template-details-panel .row{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;gap:8px;margin:10px 0}.template-details-panel label{-ms-flex:0 0 70px;flex:0 0 70px}.template-details-panel .value{-ms-flex:1;flex:1;font-weight:300;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.template-details-panel .icon-button{cursor:pointer;opacity:0.8;-ms-flex:0;flex:0;width:18px;height:18px}.template-details-panel .icon-button svg{stroke:#000000;width:18px;height:18px}.template-details-panel .icon-button:hover{opacity:1}';const ee=class{constructor(i){e(this,i),this.exit=t(this,"exit",7),this.next=t(this,"next",7),this.sdkError=t(this,"sdkError",7),this.templateCreated=t(this,"templateCreated",7),this.endpoint=a.getDefault(),this.file=void 0,this.creating=!1,this.progressLabel="Uploading...",this.progressPercent=0}componentWillLoad(){this.endpoint.setTimeout(3e4),this.endpoint.loadSession()}handleFileChanged(e){var t;this.file=(null===(t=e.target.files)||void 0===t?void 0:t[0])||null,console.log("[CREATE] Selected file",this.file)}handleUpload(e){e.stopPropagation(),document.getElementById("verdocs-template-create-file").click()}handleCancel(e){e.stopPropagation(),this.exit.emit()}async handleSubmit(e){var t,i,s;if(e.stopPropagation(),console.log("Submitting"),this.file){this.creating=!0,this.progressLabel="Uploading...";try{const e=await m(this.endpoint,{name:this.file.name,documents:[this.file]},(e=>{e>=99?(this.progressLabel="Processing...",this.progressPercent=100):this.progressPercent=e}));console.log("[CREATE] Created template",e),L(this.endpoint,e.id,!0).then((()=>{var t,i;null===(t=this.templateCreated)||void 0===t||t.emit({endpoint:this.endpoint,template:e,templateId:e.id}),null===(i=this.next)||void 0===i||i.emit(e),this.creating=!1,this.progressLabel="",this.progressPercent=0})).catch((e=>{console.log(e)}))}catch(e){console.log("[CREATE] Error creating template",e),null===(t=this.sdkError)||void 0===t||t.emit(new _(e.message,null===(i=e.response)||void 0===i?void 0:i.status,null===(s=e.response)||void 0===s?void 0:s.data)),this.creating=!1}}}render(){return i(s,null,this.endpoint.session?i("form",{onSubmit:e=>e.preventDefault(),onClick:e=>e.stopPropagation(),autocomplete:"off"},i("input",{type:"file",id:"verdocs-template-create-file",multiple:!0,accept:"application/pdf",style:{display:"none"},onChange:e=>this.handleFileChanged(e)}),this.creating?i("div",{class:"loader-wrapper"},i("verdocs-loader",null),this.progressLabel&&i("div",{class:"progress-wrapper"},i("verdocs-progress-bar",{showPercent:!0,percent:this.progressPercent,label:this.progressLabel}))):i("div",{class:"upload-box",onDrop:e=>{e.preventDefault(),e.target.classList.remove("drag-over"),this.file=e.dataTransfer.files[0]},onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect="copy"},onDragEnter:e=>e.target.classList.add("drag-over"),onDragLeave:e=>e.target.classList.remove("drag-over")},i("div",null,i("span",{innerHTML:'<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24"><path d="M6 2c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6H6zm7 7V3.5L18.5 9H13z"></path></svg>'})),i("div",{style:{marginTop:"20px",fontSize:"20px",fontWeight:"bold",overflowWrap:"anywhere"}},this.file?this.file.name:"Drag a file here"),i("div",{style:{marginTop:"20px",marginBottom:"20px",fontSize:"16px",height:"20px"}},this.file?" ":"Or, if you prefer..."),i("verdocs-button",{label:this.file?"Select a different file":"Select a file from your computer",size:"small",onClick:e=>this.handleUpload(e)})),i("div",{class:"buttons"},i("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:e=>this.handleCancel(e),disabled:this.creating}),i("verdocs-button",{label:"Next",size:"small",onClick:e=>this.handleSubmit(e),disabled:!this.file||this.creating}))):i("verdocs-component-error",{message:"You must be authenticated to use this module."}))}};ee.style='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-create{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-create form{background-color:#ffffff;padding:12px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-template-create form .upload-box{-webkit-box-sizing:border-box;box-sizing:border-box;width:320px;text-align:center;padding:44px 18px 66px;border:2px dashed #979797;color:rgba(0, 0, 0, 0.54)}verdocs-template-create form .upload-box.drag-over{border:2px solid #4c56cb}verdocs-template-create form .upload-box svg{width:64px;fill:#5c6575}verdocs-template-create .loader-wrapper{background-color:#ffffff;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;width:320px;height:320px;text-align:center;border:2px dashed #979797;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-create .progress-wrapper{padding:20px}verdocs-template-create .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-create .buttons .flex-fill{-ms-flex:1;flex:1}verdocs-template-create ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-create ::-moz-placeholder{color:#aaaaaa}verdocs-template-create :-ms-input-placeholder{color:#aaaaaa}verdocs-template-create ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-create ::placeholder{color:#aaaaaa}';const te='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.707 14.707"><g><rect x="6.275" y="0" fill="#ffffff7f" width="1" height="15"/></g></svg>',ie=[{id:"signature",tooltip:"Signature",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z"/></svg>'},{id:"initial",tooltip:"Initials",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M6.225 20.775V7h-5V3.225H15V7h-5v13.775Zm9.775 0v-8h-3V9h9.775v3.775h-3v8Z"/></svg>'},{id:"sep1",tooltip:"",icon:te},{id:"textbox",tooltip:"Text Box",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M3.425 16.15V13h11.15v3.15Zm0-5.15V7.85h17.15V11Z"/></svg>'},{id:"textarea",tooltip:"Text Area",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M3.225 20.725v-3.15h11.55v3.15Zm0-4.775V12.8h17.55v3.15Zm0-4.75V8.05h17.55v3.15Zm0-4.775v-3.15h17.55v3.15Z"/></svg>'},{id:"checkbox_group",tooltip:"Check Box",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z"/></svg>'},{id:"radio_button_group",tooltip:"Radio Button",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M12 17q2.075 0 3.538-1.463Q17 14.075 17 12t-1.462-3.538Q14.075 7 12 7 9.925 7 8.463 8.462 7 9.925 7 12q0 2.075 1.463 3.537Q9.925 17 12 17Zm0 5.85q-2.275 0-4.25-.85t-3.438-2.312Q2.85 18.225 2 16.25q-.85-1.975-.85-4.25T2 7.75q.85-1.975 2.312-3.438Q5.775 2.85 7.75 2q1.975-.85 4.25-.85t4.25.85q1.975.85 3.438 2.312Q21.15 5.775 22 7.75q.85 1.975.85 4.25T22 16.25q-.85 1.975-2.312 3.438Q18.225 21.15 16.25 22q-1.975.85-4.25.85Zm0-3.15q3.25 0 5.475-2.225Q19.7 15.25 19.7 12q0-3.25-2.225-5.475Q15.25 4.3 12 4.3q-3.25 0-5.475 2.225Q4.3 8.75 4.3 12q0 3.25 2.225 5.475Q8.75 19.7 12 19.7Zm0-7.7Z"/></svg>'},{id:"dropdown",tooltip:"Dropdown",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" stroke-width="1.5" stroke="currentColor"><path stroke="#ffffff" stroke-linecap="round" stroke-linejoin="round" d="M3 4.5h14.25M3 9h9.75M3 13.5h9.75m4.5-4.5v12m0 0l-3.75-3.75M17.25 21L21 17.25" /></svg>'},{id:"sep2",tooltip:"",icon:te},{id:"date",tooltip:"Date",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M7.6 13.925q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375ZM5.3 22.85q-1.325 0-2.238-.912-.912-.913-.912-2.238V6.3q0-1.325.912-2.238.913-.912 2.238-.912H6v-2h2.575v2h6.85v-2H18v2h.7q1.325 0 2.238.912.912.913.912 2.238v13.4q0 1.325-.912 2.238-.913.912-2.238.912Zm0-3.15h13.4V10H5.3v9.7ZM5.3 8h13.4V6.3H5.3Zm0 0V6.3 8Z"/></svg>'},{id:"timestamp",tooltip:"Timestamp",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M9 1h6v2H9zm10.03 6.39 1.42-1.42c-.43-.51-.9-.99-1.41-1.41l-1.42 1.42C16.07 4.74 14.12 4 12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9 9-4.03 9-9c0-2.12-.74-4.07-1.97-5.61zM13 14h-2V8h2v6z"></path></svg>'}],se=class{constructor(i){e(this,i),this.sdkError=t(this,"sdkError",7),this.templateUpdated=t(this,"templateUpdated",7),this.fieldsUpdated=t(this,"fieldsUpdated",7),this.pageHeights={},this.templateStore=null,this.fieldStore=null,this.roleStore=null,this.cachedPageInfo={},this.endpoint=a.getDefault(),this.templateId=null,this.toolbarTargetId=null,this.placing=null,this.showMustSelectRole=!1,this.selectedRoleName="",this.loading=!0}async componentWillLoad(){var e,t,i;try{if(this.endpoint.loadSession(),!this.templateId)return void console.log(`[FIELDS] Missing required template ID ${this.templateId}`);if(!this.endpoint.session)return void console.log("[FIELDS] Unable to start builder session, must be authenticated");L(this.endpoint,this.templateId,!0).then((e=>{var t,i;this.templateStore=e,this.fieldStore=C(this.templateId),this.roleStore=q(this.templateId),this.selectedRoleName=(null===(i=null===(t=this.roleStore.get("roles"))||void 0===t?void 0:t[0])||void 0===i?void 0:i.name)||"",this.loading=!1,this.fieldStore.onChange("fields",(e=>{var t;console.log("[FIELDS] Fields changed",{fields:e}),null===(t=this.fieldsUpdated)||void 0===t||t.emit({event:"updated",endpoint:this.endpoint,templateId:this.templateId,fields:e})}))})).catch((e=>{console.log(e)}))}catch(s){console.log("[FIELDS] Error with preview session",s),null===(e=this.sdkError)||void 0===e||e.emit(new _(s.message,null===(t=s.response)||void 0===t?void 0:t.status,null===(i=s.response)||void 0===i?void 0:i.data))}}componentDidRender(){Q.dynamicDrop(!0);const e=this.toolbarTargetId?document.getElementById(this.toolbarTargetId):null,t=document.getElementById("verdocs-template-fields-toolbar");e&&t&&(console.log("[FIELDS] Moving toolbar"),t.remove(),e.append(t))}componentWillUpdate(){var e;const t=this.roleStore.get("roles");this.selectedRoleName&&t.find((e=>e&&e.name===this.selectedRoleName))||(this.selectedRoleName=(null===(e=t[0])||void 0===e?void 0:e.name)||"",console.log("[FIELDS] Selected new role",this.selectedRoleName))}handleKeyDown(e){"Escape"===e.key&&(this.placing=null)}async handleFieldChange(e,t,i){console.log("[FIELDS] handleFieldChange",e,t,i)}attachFieldAttributes(e,t,i){i.addEventListener("input",(e=>this.handleFieldChange(t,e))),i.addEventListener("settingsChanged",(e=>{var t,i;console.log("Settings changed",e.detail),null===(t=this.templateUpdated)||void 0===t||t.emit({endpoint:this.endpoint,template:null===(i=this.templateStore)||void 0===i?void 0:i.state,event:"added-field"})})),i.addEventListener("deleted",(()=>{var e,s;console.log("[FIELDS] Deleted",this,t),i.remove(),null===(e=this.templateUpdated)||void 0===e||e.emit({endpoint:this.endpoint,template:null===(s=this.templateStore)||void 0===s?void 0:s.state,event:"updated-field"})})),i.setAttribute("templateid",this.templateId),i.setAttribute("fieldname",t.name),i.setAttribute("pageNumber",e.pageNumber),i.setAttribute("xScale",e.xScale),i.setAttribute("yScale",e.yScale),i.setAttribute("name",t.name)}handlePageRendered(e){const t=e.detail;this.cachedPageInfo[t.pageNumber]=t,this.pageHeights[t.pageNumber]=t.naturalHeight,this.fieldStore.get("fields").filter((e=>e&&e.page===t.pageNumber)).forEach((e=>{switch(e.type){case"checkbox_group":case"radio_button_group":(e.settings||{}).options.map(((t,i)=>{const s=V(e,i),o=document.getElementById(s);o&&(o.setAttribute("fieldname",e.name),o.setAttribute("pagenumber",String(e.page)),this.makeDraggable(o))}));break;default:const t=Z(e),i=document.getElementById(t);i&&(i.setAttribute("fieldname",e.name),i.setAttribute("pagenumber",String(e.page)),this.makeDraggable(i))}}))}makeDraggable(e){Q(e).draggable({listeners:{move:this.handleMoveField.bind(this),end:this.handleMoveEnd.bind(this)}})}async handleMoveField(e){const t=+(e.target.getAttribute("posX")||0),i=+(e.target.getAttribute("posY")||0),s=+(e.target.getAttribute("xScale")||1),o=+(e.target.getAttribute("yScale")||1),l=e.dx/s+t,a=e.dy/o+i;e.target.setAttribute("posX",l),e.target.setAttribute("posy",a),T(e.target,"translate",`${l}px, ${a}px`)}async handleMoveEnd(e){var t,i;const s=e.target.getAttribute("fieldname"),o=+(e.target.getAttribute("option")||"0"),l=this.fieldStore.get("fields").find((e=>e.name===s));if(!l)return void console.log("[FIELDS] Unable to find field",s,e.target);const a=e.target.getAttribute("pagenumber"),{naturalWidth:r=612,naturalHeight:n=792,renderedHeight:d=792}=this.cachedPageInfo[a],c=e.target.getBoundingClientRect(),p=e.target.parentElement.getBoundingClientRect(),h=l.settings.width||D(l.type),v=l.settings.height||R(l.type),m=Math.max(c.left-p.left,0),g=Math.max(d-(p.bottom-c.bottom),0),{x:f,y:x}=this.viewCoordinatesToPageCoordinates(m,g,a,r-h,n-v);switch(l.type){case"attachment":case"payment":case"initial":case"signature":case"date":case"dropdown":case"textarea":case"textbox":case"timestamp":l.settings.x=f,l.settings.y=x;break;case"checkbox_group":case"radio_button_group":{const e=l.settings.options[o];e&&(e.x=f,e.y=x)}}console.log("[FIELDS] Will update",s,x,o,l);const b=await u(this.endpoint,this.templateId,s,l);E(this.fieldStore,s,b),e.target.removeAttribute("posX"),e.target.removeAttribute("posY"),H(e.target),null===(t=this.templateUpdated)||void 0===t||t.emit({endpoint:this.endpoint,template:null===(i=this.templateStore)||void 0===i?void 0:i.state,event:"updated-field"})}generateFieldName(e,t){let i,s=1;do{i=`${e}P${t}-${s}`,s++}while(this.fieldStore.get("fields").some((e=>e&&e.name===i)));return i}viewCoordinatesToPageCoordinates(e,t,i,s,o){const{xScale:l=1,yScale:a=1,renderedHeight:r=792}=this.cachedPageInfo[i];return{x:Math.floor(Math.min(e/l,s)),y:Math.floor(Math.min(Math.max(r-t,0)/a,o))}}async handleClickPage(e,t){var i,s;if(this.placing){const o=e.offsetX,l=e.offsetY,a=D(this.placing),r=R(this.placing),n=this.cachedPageInfo[t],{naturalWidth:d=612,naturalHeight:c=792}=n,p=this.viewCoordinatesToPageCoordinates(o,l,t,d-a,c-r),h=Math.floor(p.x),v=Math.floor(p.y),m={name:this.generateFieldName(this.placing,t),role_name:this.selectedRoleName,template_id:this.templateId,document_id:n.documentId,type:this.placing,required:!0,page:t,validator:null,label:null,default:null,placeholder:null,group:null,settings:{x:h,y:v},x:h,y:v,width:a,height:r};switch(console.log("[FIELDS] Will save new field",m),m.type){case"attachment":case"payment":m.settings={x:h,y:v};break;case"initial":case"signature":m.settings={x:h,y:v,result:""};break;case"checkbox_group":m.setting={minimum_checked:0,maximum_checked:1e3,options:[{id:`${m.name}-1`,value:"Option 1",checked:!1,x:h,y:v}]};break;case"date":m.settings={x:h,y:v,width:a,height:r,result:""};break;case"dropdown":m.required=!1,m.settings={x:h,y:v,width:a,height:r,value:null,placeholder:"Choose",options:[{id:"option-1",value:"Option 1"}]};break;case"radio_button_group":m.setting={options:[{id:`${m.name}-1`,value:"Option 1",selected:!1,x:h,y:v}]};break;case"textarea":case"textbox":m.settings={x:h,y:v,width:a,height:r,result:"",leading:0,alignment:0,upperCase:!1};break;case"timestamp":m.settings={x:h,y:v,width:a,height:r}}"textarea"===m.type&&(m.settings.leading=16,m.type="textbox");const u=await g(this.endpoint,this.templateId,m);console.log("[FIELDS] Saved field",u),this.fieldStore.set("fields",[...this.fieldStore.get("fields"),u]),this.placing=null,null===(i=this.templateUpdated)||void 0===i||i.emit({endpoint:this.endpoint,template:null===(s=this.templateStore)||void 0===s?void 0:s.state,event:"added-field"})}}render(){var e,t,o;if(!this.endpoint.session)return i(s,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}));if(this.loading||!(null===(e=this.templateStore)||void 0===e?void 0:e.state.isLoaded))return i(s,null,i("verdocs-loader",null));const l=this.roleStore.get("roles").map((e=>({value:e.name,label:e.full_name?`${e.name}: ${e.full_name}`:e.name})));return i(s,{class:this.placing?{[`placing-${this.placing}`]:!0}:{},onSubmit:()=>{}},i("div",{id:"verdocs-template-fields-toolbar"},i("div",{class:"add-for"},"Add field:"),i("verdocs-select-input",{value:this.selectedRoleName,options:l,onInput:e=>this.selectedRoleName=e.target.value}),ie.map((e=>i("verdocs-toolbar-icon",{text:e.tooltip,icon:e.icon,onClick:()=>{e.tooltip&&(this.selectedRoleName?this.placing=e.id:this.showMustSelectRole=!0)}})))),i("div",{class:"pages"},((null===(o=null===(t=this.templateStore)||void 0===t?void 0:t.state)||void 0===o?void 0:o.documents)||[]).map((e=>r(1,e.pages).map((t=>i("verdocs-template-document-page",{templateId:this.templateId,documentId:e.id,pageNumber:t,virtualWidth:612,virtualHeight:792,disabled:!0,editable:!0,done:!1,onClick:e=>this.handleClickPage(e,t),onPageRendered:e=>this.handlePageRendered(e),layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})))))),this.showMustSelectRole&&i("verdocs-ok-dialog",{heading:"Unable to add field",message:this.roleStore.get("roles").length>0?"Please select a role before adding fields.":"Please add at least one role before adding fields.",onNext:()=>this.showMustSelectRole=!1}))}};se.style="@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-fields{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;position:relative;display:block;min-height:600px}verdocs-template-fields .page-0{padding:65px 15px 0 15px;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-fields .page-0 .user-placed-fields{height:100px;position:relative;background:#ffffff;-webkit-box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294);box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294)}verdocs-template-fields .page-0 .user-placed-fields .title{top:0;left:0;color:#ffffff;font-size:12px;padding:3px 6px;font-weight:bold;position:absolute;background:#46497d}verdocs-template-fields .pages{display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;min-height:200px;position:relative;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-template-fields .pages div,verdocs-template-fields .pages canvas{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-fields #verdocs-template-fields-toolbar{height:50px;display:-ms-flexbox;display:flex;-ms-flex:0 0 50px;flex:0 0 50px;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;font-weight:700;padding:0 20px 0 0;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;color:#f5f5fa;-ms-flex-pack:center;justify-content:center;background:#46497d}verdocs-template-fields #verdocs-template-fields-toolbar>verdocs-select-input{margin:0}verdocs-template-fields #verdocs-template-fields-toolbar svg{width:24px;height:24px}verdocs-template-fields #verdocs-template-fields-toolbar .add-for{margin:0;font-weight:500;color:#f5f5fa}verdocs-template-fields #verdocs-template-fields-toolbar verdocs-select-input{margin:0 20px 0 0}verdocs-template-fields.placing-attachment{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-checkbox_group{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-date{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath fill='%23000000' d='M7.6 13.925q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375ZM5.3 22.85q-1.325 0-2.238-.912-.912-.913-.912-2.238V6.3q0-1.325.912-2.238.913-.912 2.238-.912H6v-2h2.575v2h6.85v-2H18v2h.7q1.325 0 2.238.912.912.913.912 2.238v13.4q0 1.325-.912 2.238-.913.912-2.238.912Zm0-3.15h13.4V10H5.3v9.7ZM5.3 8h13.4V6.3H5.3Zm0 0V6.3 8Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-dropdown{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24' stroke-width='1.5' stroke='currentColor'%3E%3Cpath stroke='%23000000' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5h14.25M3 9h9.75M3 13.5h9.75m4.5-4.5v12m0 0l-3.75-3.75M17.25 21L21 17.25' /%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-initial{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M6.225 20.775V7h-5V3.225H15V7h-5v13.775Zm9.775 0v-8h-3V9h9.775v3.775h-3v8Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-payment{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-radio_button_group{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M12 17q2.075 0 3.538-1.463Q17 14.075 17 12t-1.462-3.538Q14.075 7 12 7 9.925 7 8.463 8.462 7 9.925 7 12q0 2.075 1.463 3.537Q9.925 17 12 17Zm0 5.85q-2.275 0-4.25-.85t-3.438-2.312Q2.85 18.225 2 16.25q-.85-1.975-.85-4.25T2 7.75q.85-1.975 2.312-3.438Q5.775 2.85 7.75 2q1.975-.85 4.25-.85t4.25.85q1.975.85 3.438 2.312Q21.15 5.775 22 7.75q.85 1.975.85 4.25T22 16.25q-.85 1.975-2.312 3.438Q18.225 21.15 16.25 22q-1.975.85-4.25.85Zm0-3.15q3.25 0 5.475-2.225Q19.7 15.25 19.7 12q0-3.25-2.225-5.475Q15.25 4.3 12 4.3q-3.25 0-5.475 2.225Q4.3 8.75 4.3 12q0 3.25 2.225 5.475Q8.75 19.7 12 19.7Zm0-7.7Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-signature{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-textarea{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M3.225 20.725v-3.15h11.55v3.15Zm0-4.775V12.8h17.55v3.15Zm0-4.75V8.05h17.55v3.15Zm0-4.775v-3.15h17.55v3.15Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-textbox{cursor:url(\"data:image/svg+xml,%3Csvg width='32' height='15' viewBox='0 0 32 15' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='path-1-inside-1_1401_24' fill='white'%3E%3Cpath d='M0 0H32V15H0V0Z'/%3E%3C/mask%3E%3Cpath d='M0 0H32V15H0V0Z' fill='%234C56CB' fill-opacity='0.1'/%3E%3Cpath d='M0 0V-1H-1V0H0ZM0 15H-1V16H0V15ZM0 1H32V-1H0V1ZM32 14H0V16H32V14ZM1 15V0H-1V15H1Z' fill='%234C56CB' mask='url(%23path-1-inside-1_1401_24)'/%3E%3Cpath d='M3 11.8V8.65H14.15V11.8H3ZM3 6.65V3.5H20.15V6.65H3Z' fill='%234C56CB'/%3E%3Cline x1='31.5' y1='1' x2='31.5' y2='14' stroke='%234C56CB' stroke-opacity='0.32' stroke-dasharray='1 1'/%3E%3C/svg%3E%0A\") 0 14, pointer}verdocs-template-fields.placing-timestamp{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath fill='%23000000' d='M9 1h6v2H9zm10.03 6.39 1.42-1.42c-.43-.51-.9-.99-1.41-1.41l-1.42 1.42C16.07 4.74 14.12 4 12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9 9-4.03 9-9c0-2.12-.74-4.07-1.97-5.61zM13 14h-2V8h2v6z'%3E%3C/path%3E%3C/svg%3E\") 16 16, pointer}";const oe=class{constructor(i){e(this,i),this.close=t(this,"close",7),this.sdkError=t(this,"sdkError",7),this.templateUpdated=t(this,"templateUpdated",7),this.store=null,this.endpoint=a.getDefault(),this.templateId="",this.name="",this.dirty=!1}async componentWillLoad(){var e,t,i,s,o;try{if(this.endpoint.loadSession(),!this.templateId)return void console.log(`[ROLES] Missing required template ID ${this.templateId}`);if(!this.endpoint.session)return void console.log("[ROLES] Unable to start builder session, must be authenticated");this.store=await L(this.endpoint,this.templateId,!1),this.name=null===(t=null===(e=this.store)||void 0===e?void 0:e.state)||void 0===t?void 0:t.name,this.dirty=!1}catch(e){console.log("[TEMPLATE NAME] Error loading template",e),null===(i=this.sdkError)||void 0===i||i.emit(new _(e.message,null===(s=e.response)||void 0===s?void 0:s.status,null===(o=e.response)||void 0===o?void 0:o.data))}}handleCancel(e){var t,i,s;e.stopPropagation(),this.name=null===(i=null===(t=this.store)||void 0===t?void 0:t.state)||void 0===i?void 0:i.name,this.dirty=!1,console.log("Closing"),null===(s=this.close)||void 0===s||s.emit()}async handleSave(e){var t,i,s;e.stopPropagation(),await f(this.endpoint,this.templateId,{name:this.name}),(null===(t=this.store)||void 0===t?void 0:t.state)&&(this.store.state.name=this.name),this.dirty=!1,null===(i=this.templateUpdated)||void 0===i||i.emit({endpoint:this.endpoint,template:this.store.state,event:"name"}),null===(s=this.close)||void 0===s||s.emit()}render(){var e,t;return this.endpoint.session?(null===(t=null===(e=this.store)||void 0===e?void 0:e.state)||void 0===t?void 0:t.isLoading)?i(s,{class:"loading"},i("verdocs-loader",null)):i(s,null,i("form",{onSubmit:e=>e.preventDefault(),onClick:e=>e.stopPropagation(),autocomplete:"off"},i("label",{htmlFor:"verdocs-template-name"},"Template Name"),i("verdocs-text-input",{id:"verdocs-template-name",value:this.name,autocomplete:"off",placeholder:"Template Name...",onInput:e=>{var t,i;this.name=e.target.value,this.dirty=this.name!==(null===(i=null===(t=this.store)||void 0===t?void 0:t.state)||void 0===i?void 0:i.name)}}),i("div",{class:"buttons"},i("verdocs-button",{size:"small",variant:"outline",label:"Cancel",disabled:!this.dirty,onClick:e=>this.handleCancel(e)}),i("verdocs-button",{size:"small",label:"Save",disabled:!this.dirty,onClick:e=>this.handleSave(e)})))):i(s,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}))}};oe.style="";const le=class{constructor(i){e(this,i),this.close=t(this,"close",7),this.sdkError=t(this,"sdkError",7),this.templateUpdated=t(this,"templateUpdated",7),this.store=null,this.endpoint=a.getDefault(),this.templateId="",this.showPlanBlocker=!1,this.sendReminders=!1,this.firstReminderDays="1",this.reminderDays="1",this.dirty=!1}async componentWillLoad(){var e,t,i,s,o;try{if(this.endpoint.loadSession(),!this.templateId)return void console.log(`[ROLES] Missing required template ID ${this.templateId}`);if(!this.endpoint.session)return void console.log("[ROLES] Unable to start builder session, must be authenticated");this.store=await L(this.endpoint,this.templateId,!1),this.sendReminders=!!(null===(t=null===(e=this.store)||void 0===e?void 0:e.state)||void 0===t?void 0:t.reminder_id),this.dirty=!1}catch(e){console.log("[TEMPLATE REMINDERS] Error loading template",e),null===(i=this.sdkError)||void 0===i||i.emit(new _(e.message,null===(s=e.response)||void 0===s?void 0:s.status,null===(o=e.response)||void 0===o?void 0:o.data))}}handleCancel(e){var t,i,s;e.stopPropagation(),this.sendReminders=!!(null===(i=null===(t=this.store)||void 0===t?void 0:t.state)||void 0===i?void 0:i.reminder_id),this.dirty=!1,null===(s=this.close)||void 0===s||s.emit()}async handleSave(e){var t,i,s,o,l,a,r,n,d;e.stopPropagation();try{if(this.sendReminders){const e={setup_time:+this.firstReminderDays,interval_time:+this.reminderDays};(null===(i=null===(t=this.store)||void 0===t?void 0:t.state)||void 0===i?void 0:i.reminder_id)?(await b(this.endpoint,this.templateId,null===(s=this.store)||void 0===s?void 0:s.state.reminder_id,e),this.store=await L(this.endpoint,this.templateId,!1)):(await x(this.endpoint,this.templateId,e),this.store=await L(this.endpoint,this.templateId,!1))}else await w(this.endpoint,this.templateId,null===(o=this.store)||void 0===o?void 0:o.state.reminder_id),this.store=await L(this.endpoint,this.templateId,!1);null===(l=this.templateUpdated)||void 0===l||l.emit({endpoint:this.endpoint,template:this.store.state,event:"attachments"})}catch(e){console.log("[TEMPLATE REMINDERS] Unable to update reminders",e),$(e.message),null===(a=this.sdkError)||void 0===a||a.emit(new _(e.message,null===(r=e.response)||void 0===r?void 0:r.status,null===(n=e.response)||void 0===n?void 0:n.data))}this.dirty=!1,null===(d=this.close)||void 0===d||d.emit()}render(){var e,t;return this.endpoint.session?this.endpoint.session&&(null===(t=null===(e=this.store)||void 0===e?void 0:e.state)||void 0===t?void 0:t.isLoaded)?i(s,null,i("form",{onSubmit:e=>e.preventDefault(),onClick:e=>e.stopPropagation(),autocomplete:"off"},i("h5",null,"Reminders"),i("div",{class:"input-row"},i("label",{htmlFor:"verdocs-send-reminders"},"Send Automatic Reminders"),i("verdocs-checkbox",{id:"verdocs-send-reminders",name:"automatic-reminders",checked:this.sendReminders,value:"on",onInput:e=>{this.sendReminders=e.target.checked,this.dirty=!0}})),i("p",null,i("strong",null,"NOTE:")," Reminders will only be sent for up to 14 days."),i("div",{class:"input-row"},i("label",{htmlFor:"verdocs-first-reminder-days"},"Days Before First Reminder"),i("verdocs-text-input",{id:"verdocs-first-reminder-days",type:"number",value:this.firstReminderDays,onInput:e=>{this.firstReminderDays=e.target.value,this.dirty=!0},disabled:!this.sendReminders})),i("div",{class:"input-row"},i("label",{htmlFor:"verdocs-days-between-reminders"},"Days Between Reminders"),i("verdocs-text-input",{id:"verdocs-days-between-reminders",type:"number",value:this.reminderDays,onInput:e=>{this.reminderDays=e.target.value,this.dirty=!0},disabled:!this.sendReminders})),i("div",{class:"buttons"},i("verdocs-button",{size:"small",variant:"outline",label:"Cancel",disabled:!this.dirty,onClick:e=>this.handleCancel(e)}),i("verdocs-button",{size:"small",label:"Save",disabled:!this.dirty,onClick:e=>this.handleSave(e)}))),this.showPlanBlocker&&i("verdocs-ok-dialog",{heading:"Upgrade to access this feature",message:"Please upgrade your plan to access this feature.",onNext:()=>this.showPlanBlocker=!1})):i(s,{class:"empty"}):i(s,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}))}};le.style='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-reminders{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-reminders.loading{min-height:300px;position:relative;display:block}verdocs-template-reminders.empty{display:none}verdocs-template-reminders form{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-template-reminders form h5{font-size:16px;font-weight:bold;color:#4c56cb;margin:0 0 20px 0}verdocs-template-reminders form label{font-size:16px;font-weight:500;margin:0 0 6px 0;color:#33364b}verdocs-template-reminders form input{border:none;font-size:18px;padding:3px 6px 3px 0;background:transparent;border-bottom:1px solid #33364b}verdocs-template-reminders form input:focus{outline:none}verdocs-template-reminders form .input-row{display:-ms-flexbox;display:flex;margin:0 0 10px 0;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}verdocs-template-reminders form .input-row label{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex}verdocs-template-reminders form .input-row verdocs-text-input{margin:0;display:-ms-flexbox;display:flex;-ms-flex:0 0 60px;flex:0 0 60px}verdocs-template-reminders form .input-row verdocs-text-input input{text-align:center}verdocs-template-reminders form .input-row verdocs-checkbox{display:-ms-flexbox;display:flex;-ms-flex:0 0 40px;flex:0 0 40px;-ms-flex-pack:center;justify-content:center}verdocs-template-reminders .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-direction:row;flex-direction:row}verdocs-template-reminders ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-reminders ::-moz-placeholder{color:#aaaaaa}verdocs-template-reminders :-ms-input-placeholder{color:#aaaaaa}verdocs-template-reminders ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-reminders ::placeholder{color:#aaaaaa}';const ae={everyone:"Everyone",everyone_as_creator:"Everyone as Me",organization_member:"Organization member",organization_member_as_creator:"Organization Member as Me",creator:"Me"},re='<svg xmlns="http://www.w3.org/2000/svg" height="20" width="20" fill="#00000089"><path d="m8.021 17.917-.313-2.5q-.27-.125-.625-.334-.354-.208-.625-.395l-2.312.979-1.979-3.438 1.979-1.5q-.021-.167-.031-.364-.011-.198-.011-.365 0-.146.011-.344.01-.198.031-.385l-1.979-1.5 1.979-3.417 2.312.958q.271-.187.615-.385t.635-.344l.313-2.5h3.958l.313 2.5q.312.167.625.344.312.177.604.385l2.333-.958 1.979 3.417-1.979 1.521q.021.187.021.364V10q0 .146-.01.333-.011.188-.011.396l1.958 1.5-1.979 3.438-2.312-.979q-.292.208-.615.395-.323.188-.614.334l-.313 2.5Zm1.937-5.355q1.063 0 1.813-.75t.75-1.812q0-1.062-.75-1.812t-1.813-.75q-1.041 0-1.802.75-.76.75-.76 1.812t.76 1.812q.761.75 1.802.75Zm0-1.333q-.5 0-.864-.364-.365-.365-.365-.865t.365-.865q.364-.364.864-.364t.865.364q.365.365.365.865t-.365.865q-.365.364-.865.364ZM10.021 10Zm-.854 6.583h1.666l.25-2.187q.605-.167 1.136-.49.531-.323 1.031-.802l2.021.875.854-1.375-1.792-1.354q.105-.333.136-.635.031-.303.031-.615 0-.292-.031-.573-.031-.281-.115-.635l1.792-1.396-.834-1.375-2.062.875q-.438-.438-1.021-.781-.583-.344-1.125-.49l-.271-2.208H9.167l-.271 2.208q-.584.146-1.125.458-.542.313-1.042.792l-2.021-.854-.833 1.375 1.75 1.354q-.083.333-.125.646-.042.312-.042.604t.042.594q.042.302.125.635l-1.75 1.375.833 1.375 2.021-.854q.479.458 1.021.771.542.312 1.146.479Z"/></svg>',ne='<svg xmlns="http://www.w3.org/2000/svg" fill="#ffffff" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor"><path strokeLinecap="round" strokeLinejoin="round" d="M12 9v6m3-3H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>',de='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path d="m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z"/></svg>',ce='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zm13.36-1.814a.75.75 0 10-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 00-1.06 1.06l2.25 2.25a.75.75 0 001.14-.094l3.75-5.25z" clip-rule="evenodd" /></svg>',pe='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M1.5 8.67v8.58a3 3 0 003 3h15a3 3 0 003-3V8.67l-8.928 5.493a3 3 0 01-3.144 0L1.5 8.67z" /><path d="M22.5 6.908V6.75a3 3 0 00-3-3h-15a3 3 0 00-3 3v.158l9.714 5.978a1.5 1.5 0 001.572 0L22.5 6.908z" /></svg>',he=class{constructor(i){e(this,i),this.next=t(this,"next",7),this.exit=t(this,"exit",7),this.sdkError=t(this,"sdkError",7),this.rolesUpdated=t(this,"rolesUpdated",7),this.templateStore=null,this.roleStore=null,this.endpoint=a.getDefault(),this.templateId="",this.showingRoleDialog=null,this.showingSenderDialog=!1,this.sender=null,this.loading=!0}async componentWillLoad(){var e,t,i;try{if(this.endpoint.loadSession(),!this.templateId)return void console.log(`[ROLES] Missing required template ID ${this.templateId}`);if(!this.endpoint.session)return void console.log("[ROLES] Unable to start builder session, must be authenticated");await L(this.endpoint,this.templateId,!1).then((e=>{var t;this.templateStore=e,this.roleStore=q(this.templateId),console.log("RS",null===(t=this.roleStore)||void 0===t?void 0:t.state),this.loading=!1,this.roleStore.onChange("roles",(e=>{var t;console.log("[ROLES] Roles changed",{roles:e}),null===(t=this.rolesUpdated)||void 0===t||t.emit({event:"updated",endpoint:this.endpoint,templateId:this.templateId,roles:e})}))})).catch((e=>{console.log(e)}))}catch(s){console.log("[FIELDS] Error with preview session",s),null===(e=this.sdkError)||void 0===e||e.emit(new _(s.message,null===(t=s.response)||void 0===t?void 0:t.status,null===(i=s.response)||void 0===i?void 0:i.data))}}componentDidRender(){Q.dynamicDrop(!0),Q(".recipient").draggable({listeners:{start:function(e){e.target.classList.add("dragging"),this.el.classList.add("dragging")}.bind(this),move:function(e){const t=+(e.target.getAttribute("dX")||0),i=+(e.target.getAttribute("dY")||0),s=+(e.target.dataset.sequence||0),o=+(e.target.dataset.order||0),l=e.dx+t,a=e.dy+i;e.target.setAttribute("dX",l),e.target.setAttribute("dY",a);const r=e.target.getBoundingClientRect();console.log("w",r.width),e.target.style.transform=`translate(${l+r.width-(o+1)}px, ${a-r.height*s}px)`}.bind(this),end:function(e){e.target.classList.remove("dragging"),this.el.classList.remove("dragging"),e.target.removeAttribute("dX"),e.target.removeAttribute("dY"),e.target.style.transform=null}.bind(this)}}),Q(".dropzone").dropzone({overlap:.05,ondrop:async function(e){var t;console.log("dropped",e.target.classList),e.target.classList.remove("active"),M(this.roleStore,e.relatedTarget.dataset.rolename,{sequence:+e.target.dataset.sequence,order:+e.target.dataset.order}),await this.renumberTemplateRoles(),console.log("[ROLES] Updated roles",this.getSortedRoles()),null===(t=this.rolesUpdated)||void 0===t||t.emit({event:"updated",endpoint:this.endpoint,templateId:this.templateId,roles:this.getSortedRoles()})}.bind(this),ondropactivate:e=>{e.target.classList.add("visible")},ondropdeactivate:e=>{e.target.classList.remove("visible")},ondragenter:e=>{e.target.classList.add("active")},ondragleave:e=>{e.target.classList.remove("active")}})}handleCancel(){var e;null===(e=this.exit)||void 0===e||e.emit()}handleSubmit(){var e;null===(e=this.next)||void 0===e||e.emit()}getSortedRoles(){return this.roleStore.state.roles.sort(((e,t)=>e.sequence===t.sequence?e.order-t.order:e.sequence-t.sequence))}getSequenceNumbers(){const e=[];return this.getSortedRoles().forEach((t=>{e.includes(t.sequence)||e.push(t.sequence)})),e.sort(((e,t)=>e-t))}getRoleNames(){return this.getSortedRoles().map((e=>e.name))}getRolesAtSequence(e){return this.roleStore.state.roles.filter((t=>t&&t.sequence===e))}renumberTemplateRoles(){const e=[],t=[];return this.getSequenceNumbers().forEach(((i,s)=>{this.getRolesAtSequence(i).forEach(((i,o)=>{e.includes(i.name)||(i.sequence=s+1,i.order=o+1,e.push(i.name),t.push(y(this.endpoint,this.templateId,i.name,{sequence:i.sequence,order:i.order})))}))})),Promise.all(t)}getNextRoleName(){let e="",t=Object.keys(this.roleStore.state).length-1;do{t++,e=`Recipient ${t}`}while(!e||this.roleStore.state.roles.some((t=>t&&t.name===e)));return e}callCreateRole(e,t,i){console.log("[ROLES] Will create role",{name:e,sequence:t,order:i}),k(this.endpoint,this.templateId,{template_id:this.templateId,name:e,sequence:t,message:"",order:i,full_name:"",email:"",phone:"",type:"signer",delegator:!1,kba_method:null}).then((async e=>{var t;console.log("[ROLES] Created role",e),this.roleStore.set("roles",[...this.roleStore.state.roles,e]),await this.renumberTemplateRoles(),null===(t=this.rolesUpdated)||void 0===t||t.emit({event:"added",endpoint:this.endpoint,templateId:this.templateId,roles:this.getSortedRoles()})})).catch((e=>{console.log("[ROLES] Error creating role",e)}))}handleAddRole(e,t){e.stopPropagation();const i=this.getRolesAtSequence(t).length+1,s=this.getNextRoleName();this.callCreateRole(s,t,i)}handleAddStep(e,t){e.stopPropagation();const i=this.getNextRoleName();this.callCreateRole(i,t,1)}render(){var e,t,l,a;if(!this.endpoint.session)return i(s,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}));if(this.loading||!(null===(e=this.templateStore)||void 0===e?void 0:e.state.isLoaded))return console.log("Loading",this.loading,null===(t=this.templateStore)||void 0===t?void 0:t.state.isLoaded),i(s,{class:"loading"},i("verdocs-loader",null));console.log("Rendering roles",this.roleStore.get("roles"));const r=this.getRoleNames(),n=this.getSequenceNumbers();return console.log("Rendering",r,n),i(s,null,i("form",{onSubmit:e=>e.preventDefault(),onClick:e=>e.stopPropagation(),autocomplete:"off"},i("h5",null,"Roles and Workflow"),i("div",{class:"participants"},i("div",{class:"left-line"}),i("div",{class:"row"},i("div",{class:"icon",innerHTML:'<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="#00000089"><path d="M2 12C2 6.48 6.48 2 12 2s10 4.48 10 10-4.48 10-10 10S2 17.52 2 12zm10 6c3.31 0 6-2.69 6-6s-2.69-6-6-6-6 2.69-6 6 2.69 6 6 6z"></path></svg>'}),i("div",{class:"row-roles"},i("div",{class:"sender"},i("span",{class:"label"},"Sender:")," ",ae[null===(a=null===(l=this.templateStore)||void 0===l?void 0:l.state)||void 0===a?void 0:a.sender]," ",i("div",{class:"settings-button",innerHTML:re,onClick:()=>this.showingSenderDialog=!0,"aria-role":"button"})))),i("div",{class:"row add-sequence","data-sequence":0},i("div",{class:"icon",innerHTML:ne}),i("div",{class:"row-roles"},i("div",{class:"dropzone","data-sequence":0,"data-order":1},"Add Step"))),n.map((e=>i(o,null,i("div",{class:"row"},i("div",{class:"icon",innerHTML:'<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="#00000089"><path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path></svg>'}),i("div",{class:"row-roles"},i("div",{class:"dropzone","data-order":.5,"data-sequence":e}),this.getRolesAtSequence(e).map((t=>i(o,null,t.email?i("div",{class:"recipient",style:{borderColor:p(z(this.roleStore,t.name))},"data-rolename":t.name,"data-sequence":e,"data-order":t.order},i("span",{class:"type-icon",innerHTML:"signer"===t.type?de:"cc"===t.type?pe:ce}),t.full_name," ",i("div",{class:"settings-button",innerHTML:re,onClick:()=>this.showingRoleDialog=t.name,"aria-role":"button"})):i("div",{class:"recipient",style:{backgroundColor:p(z(this.roleStore,t.name))},"data-rolename":t.name,"data-sequence":e,"data-order":t.order},i("span",{class:"type-icon",innerHTML:"signer"===t.type?de:"cc"===t.type?pe:ce}),t.name," ",i("div",{class:"settings-button",innerHTML:re,onClick:()=>this.showingRoleDialog=t.name,"aria-role":"button"})),i("div",{class:"dropzone","data-order":t.order+.5,"data-sequence":e})))),i("button",{class:"add-role",innerHTML:ne,onClick:t=>this.handleAddRole(t,e)}))),n.length>0&&i("div",{class:"row add-sequence","data-sequence":e},i("div",{class:"row-roles"},i("div",{class:"icon",innerHTML:ne}),i("div",{class:"dropzone","data-sequence":e+1,"data-order":1},"Add Step")))))),i("div",{class:"row","data-sequence":n.length+1},i("div",{class:"row-roles"},i("div",{class:"icon",innerHTML:ne}),i("button",{class:"add-step",innerHTML:ne,onClick:e=>this.handleAddStep(e,n.length+1)}))),i("div",{class:"row"},i("div",{class:"icon",innerHTML:'<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="#00000089"><path d="m18 7-1.41-1.41-6.34 6.34 1.41 1.41L18 7zm4.24-1.41L11.66 16.17 7.48 12l-1.41 1.41L11.66 19l12-12-1.42-1.41zM.41 13.41 6 19l1.41-1.41L1.83 12 .41 13.41z"></path></svg>'}),i("div",{class:"row-roles"},i("div",{class:"complete"},"Document Complete")))),r.length<1&&i("div",{class:"empty"},"You must add at least one Role before proceeding.",i("br",null)," Click the ",i("span",{innerHTML:ne})," Add button above to get started."),i("div",{class:"buttons"},i("div",{class:"flex-fill"}),i("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:()=>this.handleCancel()}),i("verdocs-button",{label:"OK",size:"small",onClick:()=>this.handleSubmit(),disabled:r.length<1}))),this.showingRoleDialog&&i("verdocs-template-role-properties",{endpoint:this.endpoint,templateId:this.templateId,roleName:this.showingRoleDialog,onClose:()=>{this.showingRoleDialog=null},onDelete:async()=>{var e;this.showingRoleDialog=null,await this.renumberTemplateRoles(),null===(e=this.rolesUpdated)||void 0===e||e.emit({event:"deleted",endpoint:this.endpoint,templateId:this.templateId,roles:this.getSortedRoles()})}}),this.showingSenderDialog&&i("verdocs-template-sender",{endpoint:this.endpoint,templateId:this.templateId,onClose:()=>this.showingSenderDialog=!1}))}get el(){return l(this)}};he.style='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-roles{display:block;min-width:400px;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-roles>form{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;background-color:#ffffff;padding:12px}verdocs-template-roles>form h5{font-size:16px;font-weight:bold;color:#46497d;margin:0 0 10px 0}verdocs-template-roles>form .participants{position:relative}verdocs-template-roles>form .left-line{top:32px;left:11px;z-index:1;width:12px;bottom:30px;position:absolute;background:#ffffff;border-left:3px dotted #9b9b9b}verdocs-template-roles>form .row{display:-ms-flexbox;display:flex;-webkit-column-gap:0;-moz-column-gap:0;column-gap:0;min-height:35px;margin-left:40px;position:relative;-ms-flex-direction:row;flex-direction:row;padding:6px 0 4px 0}verdocs-template-roles>form .row .row-roles{-ms-flex:1;flex:1;gap:10px;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-direction:row;flex-direction:row}verdocs-template-roles>form .row .icon{top:14px;z-index:2;left:-40px;width:24px;height:24px;position:absolute;background:#ffffff}verdocs-template-roles>form .row .sender{height:30px;display:-ms-flexbox;display:flex;font-size:14px;line-height:30px;-ms-flex-align:center;align-items:center;border-radius:30px;-ms-flex-direction:row;flex-direction:row;padding:0 5px 0 15px;border:1px solid #c6c9cc;background-color:#f5f5fa}verdocs-template-roles>form .row .complete{height:30px;display:-ms-flexbox;display:flex;font-size:14px;padding:0 15px;line-height:30px;-ms-flex-direction:row;flex-direction:row;border-radius:30px;background-color:#f5f5fa;border:1px solid #aeb4bf}verdocs-template-roles>form .row .label{font-weight:bold;margin-right:6px;color:#33364b}verdocs-template-roles>form .row .settings-button{display:-ms-flexbox;display:flex;cursor:pointer;margin:0 0 0 9px}verdocs-template-roles>form .row .recipient{height:30px;display:-ms-flexbox;display:flex;font-size:14px;border-radius:30px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;padding:0 5px 0 6px;white-space:nowrap;border:2px solid #aeb4bf}verdocs-template-roles>form .row .recipient .type-icon{width:24px;height:24px;-webkit-transform:scale(0.8);transform:scale(0.8);opacity:0.6;margin:0 12px 0 0}verdocs-template-roles>form .row .recipient.dragging{position:absolute}verdocs-template-roles>form .row .recipient.dragging+.dropzone{display:none !important}verdocs-template-roles>form .row .dropzone{width:14px;height:30px;display:none}verdocs-template-roles>form .row .dropzone svg{fill:#cccccc}verdocs-template-roles>form .row .dropzone.visible{margin:0 7px;display:-ms-flexbox;display:flex;-ms-flex:0 0 14px;flex:0 0 14px}verdocs-template-roles>form .row .dropzone.active{-ms-flex:0 0 120px;flex:0 0 120px;border-radius:30px;background:rgba(101, 77, 203, 0.4980392157);border:1px dashed #654dcb}verdocs-template-roles>form label{display:block;font-size:14px;font-weight:500;margin:0 0 4px 0;color:#5c6575}verdocs-template-roles>form input{border:none;font-size:18px;padding:3px 6px 3px 0;background:transparent;border-bottom:1px solid #33364b}verdocs-template-roles>form input:focus{outline:none}verdocs-template-roles .row.add-sequence{display:none}verdocs-template-roles .add-role{margin:0;padding:0;border:none;opacity:0.5;cursor:pointer;background:none}verdocs-template-roles .add-role:hover{opacity:1}verdocs-template-roles .add-role svg{width:32px;height:32px}verdocs-template-roles .add-step{margin:0;padding:0;border:none;opacity:0.5;cursor:pointer;background:none}verdocs-template-roles .add-step:hover{opacity:1}verdocs-template-roles .add-step svg{width:32px;height:32px}verdocs-template-roles.dragging .add-role{display:none}verdocs-template-roles.dragging form .row .recipient+.dropzone{display:-ms-flexbox;display:flex}verdocs-template-roles.dragging .row.add-sequence{display:-ms-flexbox;display:flex}verdocs-template-roles.dragging .row.add-sequence .dropzone{opacity:0.5;-ms-flex:0 0 120px;flex:0 0 120px;border-radius:30px;-ms-flex-align:center;align-items:center;background:rgba(101, 77, 203, 0.4980392157);-ms-flex-pack:center;justify-content:center;border:1px dashed #654dcb}verdocs-template-roles.dragging .row.add-sequence .dropzone.active{opacity:1}verdocs-template-roles .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-direction:row;flex-direction:row}verdocs-template-roles .empty{font-size:13px;margin-top:15px;margin-bottom:5px}verdocs-template-roles .empty svg{width:20px;height:20px;stroke:#666666;margin-bottom:-5px}verdocs-template-roles ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-roles ::-moz-placeholder{color:#aaaaaa}verdocs-template-roles :-ms-input-placeholder{color:#aaaaaa}verdocs-template-roles ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-roles ::placeholder{color:#aaaaaa}';const ve=class{constructor(i){e(this,i),this.close=t(this,"close",7),this.sdkError=t(this,"sdkError",7),this.templateUpdated=t(this,"templateUpdated",7),this.store=null,this.endpoint=a.getDefault(),this.templateId="",this.dirty=!1,this.personal=!1,this.public=!1}async componentWillLoad(){var e,t,i,s,o,l,a;try{if(this.endpoint.loadSession(),!this.templateId)return void console.log(`[VISIBILITY] Missing required template ID ${this.templateId}`);if(!this.endpoint.session)return void console.log("[VISIBILITY] Unable to start builder session, must be authenticated");this.store=await L(this.endpoint,this.templateId,!1),this.personal=(null===(t=null===(e=this.store)||void 0===e?void 0:e.state)||void 0===t?void 0:t.is_personal)||!0,this.public=(null===(s=null===(i=this.store)||void 0===i?void 0:i.state)||void 0===s?void 0:s.is_public)||!1,this.dirty=!1}catch(e){console.log("[TEMPLATE VISIBILITY] Error loading template",e),null===(o=this.sdkError)||void 0===o||o.emit(new _(e.message,null===(l=e.response)||void 0===l?void 0:l.status,null===(a=e.response)||void 0===a?void 0:a.data))}}handleCancel(e){var t,i,s,o,l;e.stopPropagation(),this.personal=null===(i=null===(t=this.store)||void 0===t?void 0:t.state)||void 0===i?void 0:i.is_personal,this.public=null===(o=null===(s=this.store)||void 0===s?void 0:s.state)||void 0===o?void 0:o.is_public,this.dirty=!1,null===(l=this.close)||void 0===l||l.emit()}async handleSave(e){var t,i,s;e.stopPropagation(),await f(this.endpoint,this.templateId,{is_personal:this.personal,is_public:this.public}),(null===(t=this.store)||void 0===t?void 0:t.state)&&(this.store.state.is_personal=this.personal,this.store.state.is_public=this.public),this.dirty=!1,null===(i=this.templateUpdated)||void 0===i||i.emit({endpoint:this.endpoint,template:this.store.state,event:"visibility"}),null===(s=this.close)||void 0===s||s.emit()}render(){var e,t;return this.endpoint.session?this.endpoint.session&&(null===(t=null===(e=this.store)||void 0===e?void 0:e.state)||void 0===t?void 0:t.isLoaded)?i(s,null,i("form",{onSubmit:e=>e.preventDefault(),onClick:e=>e.stopPropagation(),autocomplete:"off"},i("h5",null,"Visibility"),i("div",{class:"input-row"},i("label",{htmlFor:"verdocs-is-shared"},"Shared"),i("verdocs-checkbox",{id:"verdocs-is-shared",name:"is-shared",checked:!this.personal,value:"on",onInput:e=>{this.personal=!e.target.checked,this.dirty=!0}})),i("div",{class:"description"},"Shared templates are visible to other members of your Organization (if any)."),i("div",{class:"input-row"},i("label",{htmlFor:"verdocs-is-public"},"Public"),i("verdocs-checkbox",{id:"verdocs-is-public",name:"is-public",checked:this.public,value:"on",onInput:e=>{this.public=e.target.checked,this.dirty=!0}})),i("div",{class:"description"},"Public templates may appear in results when any other user searches for templates. Note that a template may be both Personal and Public, which may be useful if you want your template to be found via search but not otherwise displayed to other members of your Organization (if any)."),i("div",{class:"buttons"},i("verdocs-button",{size:"small",variant:"outline",label:"Cancel",disabled:!this.dirty,onClick:e=>this.handleCancel(e)}),i("verdocs-button",{size:"small",label:"Save",disabled:!this.dirty,onClick:e=>this.handleSave(e)})))):i(s,{class:"empty"}):i(s,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}))}};ve.style='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-visibility{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-visibility.loading{min-height:300px;position:relative;display:block}verdocs-template-visibility.empty{display:none}verdocs-template-visibility form{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-template-visibility form .description{font-size:14px;text-align:justify;color:#5c6575}verdocs-template-visibility form h5{font-size:16px;font-weight:bold;color:#4c56cb;margin:0}verdocs-template-visibility form label{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;font-size:16px;font-weight:500;margin:0 0 4px 0;color:#33364b}verdocs-template-visibility form input{border:none;font-size:18px;padding:3px 6px 3px 0;background:transparent;border-bottom:1px solid #33364b}verdocs-template-visibility form input:focus{outline:none}verdocs-template-visibility form .input-row{display:-ms-flexbox;display:flex;margin:20px 0 0 0;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}verdocs-template-visibility form .input-row verdocs-text-input{margin:0;display:-ms-flexbox;display:flex;-ms-flex:0 0 40px;flex:0 0 40px}verdocs-template-visibility form .input-row verdocs-text-input input{text-align:center}verdocs-template-visibility form .input-row verdocs-checkbox{-ms-flex:0;flex:0;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}verdocs-template-visibility form .input-row verdocs-checkbox label>input[type=checkbox]+*::before{margin-right:0}verdocs-template-visibility .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:25px;-ms-flex-direction:row;flex-direction:row}verdocs-template-visibility ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-visibility ::-moz-placeholder{color:#aaaaaa}verdocs-template-visibility :-ms-input-placeholder{color:#aaaaaa}verdocs-template-visibility ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-visibility ::placeholder{color:#aaaaaa}';export{W as verdocs_preview,X as verdocs_send,K as verdocs_template_attachments,G as verdocs_template_build_tabs,ee as verdocs_template_create,se as verdocs_template_fields,oe as verdocs_template_name,le as verdocs_template_reminders,he as verdocs_template_roles,ve as verdocs_template_visibility}
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(e,t,o,i){function r(e){return e instanceof o?e:new o((function(t){t(e)}))}return new(o||(o=Promise))((function(o,n){function a(e){try{c(i.next(e))}catch(e){n(e)}}function s(e){try{c(i["throw"](e))}catch(e){n(e)}}function c(e){e.done?o(e.value):r(e.value).then(a,s)}c((i=i.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var o={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},i,r,n,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(t){return c([e,t])}}function c(s){if(i)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(o=0)),o)try{if(i=1,r&&(n=s[0]&2?r["return"]:s[0]?r["throw"]||((n=r["return"])&&n.call(r),0):r.next)&&!(n=n.call(r,s[1])).done)return n;if(r=0,n)s=[s[0]&2,n.value];switch(s[0]){case 0:case 1:n=s;break;case 4:o.label++;return{value:s[1],done:false};case 5:o.label++;r=s[1];s=[0];continue;case 7:s=o.ops.pop();o.trys.pop();continue;default:if(!(n=o.trys,n=n.length>0&&n[n.length-1])&&(s[0]===6||s[0]===2)){o=0;continue}if(s[0]===3&&(!n||s[1]>n[0]&&s[1]<n[3])){o.label=s[1];break}if(s[0]===6&&o.label<n[1]){o.label=n[1];n=s;break}if(n&&o.label<n[2]){o.label=n[2];o.ops.push(s);break}if(n[2])o.ops.pop();o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e];r=0}finally{i=n=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};System.register(["./p-e748b2d2.system.js","@verdocs/js-sdk","./p-0d5fb952.system.js","./p-900006b0.system.js","./p-5e3e9c4a.system.js","./p-c8a15cb7.system.js","./p-f7620900.system.js","./p-952b88fb.system.js"],(function(e){"use strict";var t,o,i,r,n,a,s,c,d,l,f,b,u,p;return{setters:[function(e){t=e.r;o=e.h;i=e.H;r=e.c},function(e){n=e.VerdocsEndpoint;a=e.updateTemplateRole;s=e.deleteTemplateRole;c=e.updateTemplate},function(e){d=e.g;l=e.u;f=e.d},function(e){b=e.g},function(e){u=e.g},function(e){p=e.S},function(){},function(){}],execute:function(){var h='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-radio-button{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;width:20px;height:20px;display:block;font-size:11px;position:relative;background-color:transparent;-webkit-transform-origin:bottom left;transform-origin:bottom left;border-radius:100%}verdocs-radio-button.disabled{opacity:0.5}verdocs-radio-button input[type=radio]{position:absolute;opacity:0}verdocs-radio-button input[type=radio]+label:before{content:"";background:#f5f5fa;border-radius:100%;border:1px solid rgba(0, 0, 0, 0.6);display:inline-block;width:16px;height:16px;position:absolute;left:1px;top:1px;cursor:pointer;text-align:center;-webkit-transition:all 250ms ease;transition:all 250ms ease}verdocs-radio-button input[type=radio]:checked+label:before{background-color:#55bc81;-webkit-box-shadow:inset 0 0 0 2px #f5f5fa;box-shadow:inset 0 0 0 2px #f5f5fa}verdocs-radio-button input[type=radio]:focus+label:before{outline:none;border-color:#55bc81}verdocs-radio-button input[type=radio]:disabled+label:before{-webkit-box-shadow:inset 0 0 0 4px #f5f5fa;box-shadow:inset 0 0 0 4px #f5f5fa;border-color:#a0a0d0;background:#a0a0d0}verdocs-radio-button input[type=radio]+label:empty:before{margin-right:0}verdocs-radio-button.required input[type=radio]+label:before{border:1px solid #cc0000}verdocs-radio-button.hide{display:none}verdocs-radio-button.focused{-webkit-animation:verdocs-field-pulse 0.75s 2;animation:verdocs-field-pulse 0.75s 2}';var v=h;var m=e("verdocs_radio_button",function(){function e(e){t(this,e);this.checked=false;this.name="";this.value="";this.disabled=false}e.prototype.render=function(){return o(i,{key:"635ebb3b00a1ba9596addcc8722c0897c67ccefc",class:{disabled:this.disabled}},o("input",{key:"c3ec421823ccb3e8f587b535ba8e23f7069f4a61",type:"radio",value:this.value,name:this.name,id:"verdocs-radio-button-".concat(this.name,"-").concat(this.value),checked:this.checked,disabled:this.disabled}),o("label",{key:"80b453e62ed979c5f7ee73303d5dc43464b21289",htmlFor:"verdocs-radio-button-".concat(this.name,"-").concat(this.value)}))};return e}());m.style=v;var x='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-role-properties{font-family:"Inter", "Barlow", sans-serif;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-role-properties div{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-role-properties .background-overlay{position:fixed;z-index:10000;top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;background:rgba(0, 0, 0, 0.4980392157)}verdocs-template-role-properties .dialog{width:340px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;border-radius:4px;overflow:hidden;background:#ffffff;padding:16px;-webkit-box-shadow:3px 3px 5px 1px rgba(40, 40, 40, 0.4);box-shadow:3px 3px 5px 1px rgba(40, 40, 40, 0.4)}verdocs-template-role-properties .heading{display:-ms-flexbox;display:flex;font-size:20px;font-weight:500;-ms-flex-direction:row;flex-direction:row}verdocs-template-role-properties .buttons{display:-ms-flexbox;display:flex;margin-top:10px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-role-properties .buttons verdocs-button{margin-left:16px}verdocs-template-role-properties form .row{display:-ms-flexbox;display:flex;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;margin:0 0 10px 0;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}verdocs-template-role-properties form .row .input-label{display:block;color:#555570;font-weight:700;font-size:14px;margin:0 0 4px 0;-ms-flex:0 0 100px;flex:0 0 100px}verdocs-template-role-properties verdocs-select-input{-ms-flex:1;flex:1;margin:0}verdocs-template-role-properties verdocs-text-input{margin:0 0 10px 0}verdocs-template-role-properties verdocs-text-input label{margin:0;display:-ms-flexbox;display:flex;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}verdocs-template-role-properties verdocs-text-input .input-label{-ms-flex:0 0 100px;flex:0 0 100px}verdocs-template-role-properties verdocs-text-input input{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex}verdocs-template-role-properties verdocs-text-input verdocs-text-input{margin:0}verdocs-template-role-properties .checkbox-wrapper{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex}verdocs-template-role-properties .delete-button{height:34px;display:-ms-flexbox;display:flex;padding:0 6px;cursor:pointer;background:none;border-radius:4px;-ms-flex-align:center;align-items:center;border:1px solid #999;-ms-flex-pack:center;justify-content:center}verdocs-template-role-properties .delete-button svg{width:24px;height:24px}verdocs-template-role-properties .delete-button:active{background:#f3f3f3}';var y=x;var g='<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="#a50021"><path stroke-linecap="round" stroke-linejoin="round" d="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" /></svg>';var k=e("verdocs_template_role_properties",function(){function e(e){t(this,e);this.close=r(this,"close",7);this.delete=r(this,"delete",7);this.sdkError=r(this,"sdkError",7);this.templateStore=null;this.fieldStore=null;this.roleStore=null;this.endpoint=n.getDefault();this.templateId="";this.roleName="";this.sender="everyone";this.dirty=false;this.saving=false;this.name="";this.type="signer";this.full_name="";this.email="";this.phone="";this.delegator=false}e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,o,i,r,n;var a=this;return __generator(this,(function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);this.endpoint.loadSession();if(!this.templateId){console.log("[ROLE_PROPERTIES] Missing required template ID ".concat(this.templateId));return[2]}if(!this.endpoint.session){console.log("[ROLE_PROPERTIES] Unable to start builder session, must be authenticated");return[2]}i=this;return[4,u(this.endpoint,this.templateId,false)];case 1:i.templateStore=s.sent();this.fieldStore=b(this.templateId);this.roleStore=d(this.templateId);r=this.roleStore.state.roles.find((function(e){return e.name===a.roleName}));if(r){this.name=r.name;this.type=r.type;this.full_name=r.full_name;this.email=r.email;this.phone=r.phone;this.delegator=r.delegator;console.log("[ROLE_PROPERTIES] Editing role",r)}return[3,3];case 2:n=s.sent();console.log("[ROLE_PROPERTIES Error with preview session",n);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new p(n.message,(t=n.response)===null||t===void 0?void 0:t.status,(o=n.response)===null||o===void 0?void 0:o.data));return[3,3];case 3:return[2]}}))}))};e.prototype.handleCancel=function(e){var t=this;var o;e.stopPropagation();var i=this.roleStore.state.roles.find((function(e){return e.name===t.roleName}));if(i){this.name=i.name;this.type=i.type;this.full_name=i.full_name;this.email=i.email;this.phone=i.phone;this.delegator=i.delegator}this.dirty=false;(o=this.close)===null||o===void 0?void 0:o.emit()};e.prototype.handleSave=function(e){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(o){e.stopPropagation();this.saving=true;a(this.endpoint,this.templateId,this.roleName,{name:this.name,type:this.type,full_name:this.full_name,email:this.email,phone:this.phone,delegator:this.delegator}).then((function(e){return __awaiter(t,void 0,void 0,(function(){var t;return __generator(this,(function(o){console.log("[ROLE_PROPERTIES] Update result",e);this.saving=false;this.dirty=false;l(this.roleStore,this.roleName,e);(t=this.close)===null||t===void 0?void 0:t.emit();return[2]}))}))})).catch((function(e){console.log("[ROLE_PROPERTIES Update error",e);t.saving=false}));return[2]}))}))};e.prototype.handleDelete=function(e){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(o){e.stopPropagation();if(window.confirm("Are you sure you wish to remove this role? All associated fields will be removed as well. This action cannot be undone.")){s(this.endpoint,this.templateId,this.roleName).then((function(){var e;f(t.roleStore,t.roleName);(e=t.delete)===null||e===void 0?void 0:e.emit({templateId:t.templateId,roleName:t.roleName})})).catch((function(e){console.log("[ROLE_PROPERTIES Deletion error",e)}))}return[2]}))}))};e.prototype.render=function(){var e=this;var t=this.fieldStore.get("fields").some((function(t){return t.role_name===e.roleName}));return o(i,{key:"d3988edb91247f2dd580645350c7c5641d21c61a"},o("div",{key:"912555974fc01f6b5dbd37173217a17e1e6cc756",class:"background-overlay",onClick:function(t){return e.handleCancel(t)}},o("div",{key:"e6d8172451f3fe78fd4b932039b15615f4b4c843",class:"dialog"},o("form",{key:"0d0519144c0de4813a664a2345a85a7da15606c9",onSubmit:function(e){return e.preventDefault()},onClick:function(e){return e.stopPropagation()},autocomplete:"off"},o("verdocs-text-input",{key:"9169dd76bf19c5f809b78bdef9a20511d21cbdcc",id:"verdocs-role-name",label:"Role Name",value:this.name,autocomplete:"off",disabled:t,helpText:t?"This role has fields assigned and can no longer be renamed.":"A unique name to identify the role in the workflow. Submitted data will also be tagged with this value.",placeholder:"Role Name...",onInput:function(t){e.name=t.target.value;e.dirty=true}}),o("div",{key:"fba0622ed18d69ae13c2dc6dbc4f3c2230fb72d5",class:"row"},o("div",{key:"db653736e1e1b32a58ea8df1d5f9f58928ca7047",class:"input-label"},"Type:"),o("verdocs-select-input",{key:"7199410b3a1598e9fc74b6bcd42b58458e7c0ad7",value:this.type,options:[{label:"Signer",value:"signer"},{label:"CC",value:"cc"},{label:"Approver",value:"approver"}],onInput:function(t){e.type=t.target.value;e.dirty=true}}),o("verdocs-help-icon",{key:"8e553f8d63d8d57022d449b9db08d8ab0bbdd48c",text:"Most participants are Signers. CC roles are notified when documents are signed, but have no other actions. Approvers get notified when signing is completed to perform a final review."})),o("verdocs-text-input",{key:"da8fae069e9a65a8fbe41c926a4aabc2af0816f2",id:"verdocs-recipient-email",label:"Full Name",value:this.full_name,autocomplete:"off",helpText:"The recipient's full name, if it will always stay the same. Leave blank to supply this value later, when each new envelope is created from the template.",placeholder:"Full Name...",onInput:function(t){e.full_name=t.target.value;e.dirty=true}}),o("verdocs-text-input",{key:"5c2818a8b37c6fdef9dfd4a9a64bbb2c66216ca9",id:"verdocs-recipient-email",label:"Email",value:this.email,autocomplete:"off",helpText:"The recipient's email address, if it will always stay the same. Leave blank to supply this value later, when each new envelope is created from the template.",placeholder:"Email Address...",onInput:function(t){e.email=t.target.value;e.dirty=true}}),o("verdocs-text-input",{key:"4230659800aac4470c96d411436434511a208015",id:"verdocs-recipient-phone",label:"Phone",value:this.phone,autocomplete:"off",helpText:"The recipient's phone number, if it will always stay the same. Leave blank to supply this value later, when each new envelope is created from the template.",placeholder:"Phone Number...",onInput:function(t){e.phone=t.target.value;e.dirty=true}}),o("div",{key:"2a675d0120b3cbeff8af790260578126d3cf46ce",class:"row"},o("div",{key:"66c007c4d9ea713f5a399186e144d7445797765a",class:"input-label"},"May Delegate:"),o("div",{key:"ab88572b986a7c5def40a9c1e084fe3c62a766bf",class:"checkbox-wrapper"},o("verdocs-checkbox",{key:"b1ca8f96ffd71843beecdc349d86bf3d8cc35708",checked:this.delegator,onInput:function(t){e.delegator=t.target.checked;e.dirty=true}})),o("verdocs-help-icon",{key:"de1d5f121299c133edcc8001a9b6a6b63ff9b739",text:"If enabled, this recipient may delegate their actions to another individual."})),o("div",{key:"79869b6fb38187967ca3550284e4d25f63884fd0",class:"buttons"},o("button",{key:"e58733c07c6793e2c454e5f68c5ffc8907cec1f1",class:"delete-button",disabled:this.dirty,onClick:function(t){return e.handleDelete(t)},innerHTML:g}),o("div",{key:"55f4478946d4675a17055be652e19eb377ae5437",style:{flex:"1"}}),o("verdocs-button",{key:"f67fa328ee71a14f0bd1ba049ffddf228841eb67",size:"small",variant:"outline",label:"Cancel",disabled:!this.dirty,onClick:function(t){return e.handleCancel(t)}}),o("verdocs-button",{key:"690bc539949328f6130e4d8da5db97ed1b355992",size:"small",label:"Save",disabled:!this.dirty,onClick:function(t){return e.handleSave(t)}}))))))};return e}());k.style=y;var w='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-sender{font-family:"Inter", "Barlow", sans-serif;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-sender div{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-sender .background-overlay{position:absolute;z-index:10000;top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;background:rgba(0, 0, 0, 0.4980392157)}verdocs-template-sender .dialog{width:340px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;border-radius:4px;overflow:hidden;background:#ffffff;padding:16px;-webkit-box-shadow:3px 3px 5px 1px rgba(40, 40, 40, 0.4);box-shadow:3px 3px 5px 1px rgba(40, 40, 40, 0.4)}verdocs-template-sender .heading{display:-ms-flexbox;display:flex;font-size:20px;font-weight:500;-ms-flex-direction:row;flex-direction:row}verdocs-template-sender .buttons{display:-ms-flexbox;display:flex;margin-top:10px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-sender .buttons verdocs-button{margin-left:16px}verdocs-template-sender .options{row-gap:10px}verdocs-template-sender .options .option{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row}verdocs-template-sender .options .option .description{margin-left:10px}verdocs-template-sender .options .option .description .name{display:inline-block;vertical-align:top;margin-top:4px;margin-right:4px}';var _=w;var E=e("verdocs_template_sender",function(){function e(e){t(this,e);this.close=r(this,"close",7);this.sdkError=r(this,"sdkError",7);this.store=null;this.endpoint=n.getDefault();this.templateId="";this.sender="everyone";this.saving=false}e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,o,i,r,n,a;return __generator(this,(function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);this.endpoint.loadSession();if(!this.templateId){console.log("[SENDER] Missing required template ID ".concat(this.templateId));return[2]}if(!this.endpoint.session){console.log("[SENDER] Unable to start builder session, must be authenticated");return[2]}n=this;return[4,u(this.endpoint,this.templateId,false)];case 1:n.store=s.sent();this.sender=(t=(e=this.store)===null||e===void 0?void 0:e.state)===null||t===void 0?void 0:t.sender;return[3,3];case 2:a=s.sent();console.log("[SENDER] Error with preview session",a);(o=this.sdkError)===null||o===void 0?void 0:o.emit(new p(a.message,(i=a.response)===null||i===void 0?void 0:i.status,(r=a.response)===null||r===void 0?void 0:r.data));return[3,3];case 3:return[2]}}))}))};e.prototype.handleClose=function(){this.close.emit()};e.prototype.handleDismiss=function(e){if(e.target.className==="background-overlay"){e.preventDefault();this.handleClose()}};e.prototype.handleSelectSetting=function(e){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(o){this.saving=true;c(this.endpoint,this.templateId,{sender:e}).then((function(o){var i;console.log("Update result",o);if((i=t.store)===null||i===void 0?void 0:i.state){t.store.state.sender=e}t.saving=false;t.sender=e})).catch((function(e){console.log("Error saving",e);t.saving=false}));return[2]}))}))};e.prototype.render=function(){var e=this;return o(i,{key:"092c9e3593fffb0559c72fab66510070e73d7c05"},o("div",{key:"666b71a674030a3541138d6dd07a04ec2f352e20",class:"background-overlay",onClick:function(t){return e.handleDismiss(t)}},o("div",{key:"fcabfd99d07d0f72a874fd2ff32a7f72cda51d86",class:"dialog"},o("div",{key:"1098b307a0f787d282ae423f273f02231524598a",class:"options"},o("div",{key:"bb2bd6a5c6f338a955d0e38ddd72be127a908ea7",class:"option"},o("verdocs-radio-button",{key:"47ef7fa0ea436b284f76f8507ecf66ff098a3021",name:"template-sender",value:"everyone",checked:this.sender==="everyone",onInput:function(){return e.handleSelectSetting("everyone")}}),o("div",{key:"8dcc183312a85bf6bb0145a55933842951c859c4",class:"description"},o("div",{key:"c3e41eff5d8353846d5fe62e9739864743936d5d",class:"name"},"Anyone on the Web"),o("verdocs-help-icon",{key:"b3b965183887842c7f3434afc9602ca8d67de419",text:"Anyone can use this template. (Make its visibility is set to to 'Public' or 'Shared'.)"}))),o("div",{key:"4fa78b48a79fc3932a02553e9360fb656c735493",class:"option"},o("verdocs-radio-button",{key:"40429f3fbaa48e0515d4f1e860d0a256df551fb4",name:"template-sender",value:"everyone_as_creator",checked:this.sender==="everyone_as_creator",onInput:function(){return e.handleSelectSetting("everyone_as_creator")}}),o("div",{key:"5add2c44aac55f11094780c82ff6006b4b48ca8e",class:"description"},o("div",{key:"ac8e1c67ab3614b8e5dd3a255c0d71c1820ba83b",class:"name"},"Anyone on the Web as me"),o("verdocs-help-icon",{key:"4d2172b0dcef9cd3e46095e8337aa3c1b8e06523",text:"Anyone can use this template on my behalf. (Make sure its visibility is set to 'Public' or 'Shared'.)"}))),o("div",{key:"36970f9e7c4be312447a36c4a63b470ea85cddf8",class:"option"},o("verdocs-radio-button",{key:"b2fd0896b2bee7243450d6a50cc65fe96e98ab20",name:"template-sender",value:"organization_member",checked:this.sender==="organization_member",onInput:function(){return e.handleSelectSetting("organization_member")}}),o("div",{key:"0bbfeeaf609aa3106df12bf34ef778891e83d0df",class:"description"},o("div",{key:"bb62d9eece8db82b8ef071c0c24127086a89dccc",class:"name"},"Anyone in my organization"),o("verdocs-help-icon",{key:"73d7fa4b6f4b4896d778f3fbc165de2d7b6b2c87",text:"Anyone in my organization can use this template. (Make sure its visibility is set to 'Shared')"}))),o("div",{key:"e1eca6d0234cf0d01ee8d30690248eec07912d3c",class:"option"},o("verdocs-radio-button",{key:"f31029edc86697d113fc37f55c0a94bcc4a35f68",name:"template-sender",value:"organization_member_as_creator",checked:this.sender==="organization_member_as_creator",onInput:function(){return e.handleSelectSetting("organization_member_as_creator")}}),o("div",{key:"5a0f46208920de20dd725f4e16c5de556260d7cb",class:"description"},o("div",{key:"9bfd1c74d34afe93d4a0e11b0877ff7dadf19f83",class:"name"},"Anyone in my organization as me"),o("verdocs-help-icon",{key:"d72a7899414895b1637186c4f731be73cc786eb9",text:"Anyone in my organization can use this template on my behalf. (Make sure its visibility is set to to 'Shared'.)"}))),o("div",{key:"5e55d764e9040fb7b87e0456c2809286835b89e3",class:"option"},o("verdocs-radio-button",{key:"2309a84ec1b4487619f932e8a2316f51c331a13d",name:"template-sender",value:"creator",checked:this.sender==="creator",onInput:function(){return e.handleSelectSetting("creator")}}),o("div",{key:"f3bd9236d0b692415c5a39687c35ba71cf245703",class:"description"},o("div",{key:"8aa05e4b9f42d4febf3c3b28f53dec9de2e0c64d",class:"name"},"Me"),o("verdocs-help-icon",{key:"e79cb02b13641acd64983b91e8de6eb6284a8ee7",text:"Only I can use this template."})))),o("div",{key:"d4b7c6ee528df1ee7f7ec952e80826a20c29ff6c",class:"buttons"},o("verdocs-button",{key:"024ba9b87fc9131db993ecafd76105be0959df47",label:"Close",onClick:function(){return e.handleClose()}})))))};return e}());E.style=_}}}));
1
+ var __awaiter=this&&this.__awaiter||function(e,t,o,i){function r(e){return e instanceof o?e:new o((function(t){t(e)}))}return new(o||(o=Promise))((function(o,n){function a(e){try{c(i.next(e))}catch(e){n(e)}}function s(e){try{c(i["throw"](e))}catch(e){n(e)}}function c(e){e.done?o(e.value):r(e.value).then(a,s)}c((i=i.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var o={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},i,r,n,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(t){return c([e,t])}}function c(s){if(i)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(o=0)),o)try{if(i=1,r&&(n=s[0]&2?r["return"]:s[0]?r["throw"]||((n=r["return"])&&n.call(r),0):r.next)&&!(n=n.call(r,s[1])).done)return n;if(r=0,n)s=[s[0]&2,n.value];switch(s[0]){case 0:case 1:n=s;break;case 4:o.label++;return{value:s[1],done:false};case 5:o.label++;r=s[1];s=[0];continue;case 7:s=o.ops.pop();o.trys.pop();continue;default:if(!(n=o.trys,n=n.length>0&&n[n.length-1])&&(s[0]===6||s[0]===2)){o=0;continue}if(s[0]===3&&(!n||s[1]>n[0]&&s[1]<n[3])){o.label=s[1];break}if(s[0]===6&&o.label<n[1]){o.label=n[1];n=s;break}if(n&&o.label<n[2]){o.label=n[2];o.ops.push(s);break}if(n[2])o.ops.pop();o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e];r=0}finally{i=n=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};System.register(["./p-e748b2d2.system.js","@verdocs/js-sdk","./p-0d5fb952.system.js","./p-900006b0.system.js","./p-889cc411.system.js","./p-c8a15cb7.system.js","./p-f7620900.system.js","./p-f5064e0c.system.js"],(function(e){"use strict";var t,o,i,r,n,a,s,c,d,l,f,b,u,p;return{setters:[function(e){t=e.r;o=e.h;i=e.H;r=e.c},function(e){n=e.VerdocsEndpoint;a=e.updateTemplateRole;s=e.deleteTemplateRole;c=e.updateTemplate},function(e){d=e.g;l=e.u;f=e.d},function(e){b=e.g},function(e){u=e.g},function(e){p=e.S},function(){},function(){}],execute:function(){var h='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-radio-button{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;width:20px;height:20px;display:block;font-size:11px;position:relative;background-color:transparent;-webkit-transform-origin:bottom left;transform-origin:bottom left;border-radius:100%}verdocs-radio-button.disabled{opacity:0.5}verdocs-radio-button input[type=radio]{position:absolute;opacity:0}verdocs-radio-button input[type=radio]+label:before{content:"";background:#f5f5fa;border-radius:100%;border:1px solid rgba(0, 0, 0, 0.6);display:inline-block;width:16px;height:16px;position:absolute;left:1px;top:1px;cursor:pointer;text-align:center;-webkit-transition:all 250ms ease;transition:all 250ms ease}verdocs-radio-button input[type=radio]:checked+label:before{background-color:#55bc81;-webkit-box-shadow:inset 0 0 0 2px #f5f5fa;box-shadow:inset 0 0 0 2px #f5f5fa}verdocs-radio-button input[type=radio]:focus+label:before{outline:none;border-color:#55bc81}verdocs-radio-button input[type=radio]:disabled+label:before{-webkit-box-shadow:inset 0 0 0 4px #f5f5fa;box-shadow:inset 0 0 0 4px #f5f5fa;border-color:#a0a0d0;background:#a0a0d0}verdocs-radio-button input[type=radio]+label:empty:before{margin-right:0}verdocs-radio-button.required input[type=radio]+label:before{border:1px solid #cc0000}verdocs-radio-button.hide{display:none}verdocs-radio-button.focused{-webkit-animation:verdocs-field-pulse 0.75s 2;animation:verdocs-field-pulse 0.75s 2}';var v=h;var m=e("verdocs_radio_button",function(){function e(e){t(this,e);this.checked=false;this.name="";this.value="";this.disabled=false}e.prototype.render=function(){return o(i,{key:"635ebb3b00a1ba9596addcc8722c0897c67ccefc",class:{disabled:this.disabled}},o("input",{key:"c3ec421823ccb3e8f587b535ba8e23f7069f4a61",type:"radio",value:this.value,name:this.name,id:"verdocs-radio-button-".concat(this.name,"-").concat(this.value),checked:this.checked,disabled:this.disabled}),o("label",{key:"80b453e62ed979c5f7ee73303d5dc43464b21289",htmlFor:"verdocs-radio-button-".concat(this.name,"-").concat(this.value)}))};return e}());m.style=v;var x='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-role-properties{font-family:"Inter", "Barlow", sans-serif;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-role-properties div{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-role-properties .background-overlay{position:fixed;z-index:10000;top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;background:rgba(0, 0, 0, 0.4980392157)}verdocs-template-role-properties .dialog{width:340px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;border-radius:4px;overflow:hidden;background:#ffffff;padding:16px;-webkit-box-shadow:3px 3px 5px 1px rgba(40, 40, 40, 0.4);box-shadow:3px 3px 5px 1px rgba(40, 40, 40, 0.4)}verdocs-template-role-properties .heading{display:-ms-flexbox;display:flex;font-size:20px;font-weight:500;-ms-flex-direction:row;flex-direction:row}verdocs-template-role-properties .buttons{display:-ms-flexbox;display:flex;margin-top:10px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-role-properties .buttons verdocs-button{margin-left:16px}verdocs-template-role-properties form .row{display:-ms-flexbox;display:flex;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;margin:0 0 10px 0;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}verdocs-template-role-properties form .row .input-label{display:block;color:#555570;font-weight:700;font-size:14px;margin:0 0 4px 0;-ms-flex:0 0 100px;flex:0 0 100px}verdocs-template-role-properties verdocs-select-input{-ms-flex:1;flex:1;margin:0}verdocs-template-role-properties verdocs-text-input{margin:0 0 10px 0}verdocs-template-role-properties verdocs-text-input label{margin:0;display:-ms-flexbox;display:flex;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}verdocs-template-role-properties verdocs-text-input .input-label{-ms-flex:0 0 100px;flex:0 0 100px}verdocs-template-role-properties verdocs-text-input input{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex}verdocs-template-role-properties verdocs-text-input verdocs-text-input{margin:0}verdocs-template-role-properties .checkbox-wrapper{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex}verdocs-template-role-properties .delete-button{height:34px;display:-ms-flexbox;display:flex;padding:0 6px;cursor:pointer;background:none;border-radius:4px;-ms-flex-align:center;align-items:center;border:1px solid #999;-ms-flex-pack:center;justify-content:center}verdocs-template-role-properties .delete-button svg{width:24px;height:24px}verdocs-template-role-properties .delete-button:active{background:#f3f3f3}';var y=x;var g='<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="#a50021"><path stroke-linecap="round" stroke-linejoin="round" d="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" /></svg>';var k=e("verdocs_template_role_properties",function(){function e(e){t(this,e);this.close=r(this,"close",7);this.delete=r(this,"delete",7);this.sdkError=r(this,"sdkError",7);this.templateStore=null;this.fieldStore=null;this.roleStore=null;this.endpoint=n.getDefault();this.templateId="";this.roleName="";this.sender="everyone";this.dirty=false;this.saving=false;this.name="";this.type="signer";this.full_name="";this.email="";this.phone="";this.delegator=false}e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,o,i,r,n;var a=this;return __generator(this,(function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);this.endpoint.loadSession();if(!this.templateId){console.log("[ROLE_PROPERTIES] Missing required template ID ".concat(this.templateId));return[2]}if(!this.endpoint.session){console.log("[ROLE_PROPERTIES] Unable to start builder session, must be authenticated");return[2]}i=this;return[4,u(this.endpoint,this.templateId,false)];case 1:i.templateStore=s.sent();this.fieldStore=b(this.templateId);this.roleStore=d(this.templateId);r=this.roleStore.state.roles.find((function(e){return e.name===a.roleName}));if(r){this.name=r.name;this.type=r.type;this.full_name=r.full_name;this.email=r.email;this.phone=r.phone;this.delegator=r.delegator;console.log("[ROLE_PROPERTIES] Editing role",r)}return[3,3];case 2:n=s.sent();console.log("[ROLE_PROPERTIES Error with preview session",n);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new p(n.message,(t=n.response)===null||t===void 0?void 0:t.status,(o=n.response)===null||o===void 0?void 0:o.data));return[3,3];case 3:return[2]}}))}))};e.prototype.handleCancel=function(e){var t=this;var o;e.stopPropagation();var i=this.roleStore.state.roles.find((function(e){return e.name===t.roleName}));if(i){this.name=i.name;this.type=i.type;this.full_name=i.full_name;this.email=i.email;this.phone=i.phone;this.delegator=i.delegator}this.dirty=false;(o=this.close)===null||o===void 0?void 0:o.emit()};e.prototype.handleSave=function(e){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(o){e.stopPropagation();this.saving=true;a(this.endpoint,this.templateId,this.roleName,{name:this.name,type:this.type,full_name:this.full_name,email:this.email,phone:this.phone,delegator:this.delegator}).then((function(e){return __awaiter(t,void 0,void 0,(function(){var t;return __generator(this,(function(o){console.log("[ROLE_PROPERTIES] Update result",e);this.saving=false;this.dirty=false;l(this.roleStore,this.roleName,e);(t=this.close)===null||t===void 0?void 0:t.emit();return[2]}))}))})).catch((function(e){console.log("[ROLE_PROPERTIES Update error",e);t.saving=false}));return[2]}))}))};e.prototype.handleDelete=function(e){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(o){e.stopPropagation();if(window.confirm("Are you sure you wish to remove this role? All associated fields will be removed as well. This action cannot be undone.")){s(this.endpoint,this.templateId,this.roleName).then((function(){var e;f(t.roleStore,t.roleName);(e=t.delete)===null||e===void 0?void 0:e.emit({templateId:t.templateId,roleName:t.roleName})})).catch((function(e){console.log("[ROLE_PROPERTIES Deletion error",e)}))}return[2]}))}))};e.prototype.render=function(){var e=this;var t=this.fieldStore.get("fields").some((function(t){return t.role_name===e.roleName}));return o(i,{key:"d3988edb91247f2dd580645350c7c5641d21c61a"},o("div",{key:"912555974fc01f6b5dbd37173217a17e1e6cc756",class:"background-overlay",onClick:function(t){return e.handleCancel(t)}},o("div",{key:"e6d8172451f3fe78fd4b932039b15615f4b4c843",class:"dialog"},o("form",{key:"0d0519144c0de4813a664a2345a85a7da15606c9",onSubmit:function(e){return e.preventDefault()},onClick:function(e){return e.stopPropagation()},autocomplete:"off"},o("verdocs-text-input",{key:"9169dd76bf19c5f809b78bdef9a20511d21cbdcc",id:"verdocs-role-name",label:"Role Name",value:this.name,autocomplete:"off",disabled:t,helpText:t?"This role has fields assigned and can no longer be renamed.":"A unique name to identify the role in the workflow. Submitted data will also be tagged with this value.",placeholder:"Role Name...",onInput:function(t){e.name=t.target.value;e.dirty=true}}),o("div",{key:"fba0622ed18d69ae13c2dc6dbc4f3c2230fb72d5",class:"row"},o("div",{key:"db653736e1e1b32a58ea8df1d5f9f58928ca7047",class:"input-label"},"Type:"),o("verdocs-select-input",{key:"7199410b3a1598e9fc74b6bcd42b58458e7c0ad7",value:this.type,options:[{label:"Signer",value:"signer"},{label:"CC",value:"cc"},{label:"Approver",value:"approver"}],onInput:function(t){e.type=t.target.value;e.dirty=true}}),o("verdocs-help-icon",{key:"8e553f8d63d8d57022d449b9db08d8ab0bbdd48c",text:"Most participants are Signers. CC roles are notified when documents are signed, but have no other actions. Approvers get notified when signing is completed to perform a final review."})),o("verdocs-text-input",{key:"da8fae069e9a65a8fbe41c926a4aabc2af0816f2",id:"verdocs-recipient-email",label:"Full Name",value:this.full_name,autocomplete:"off",helpText:"The recipient's full name, if it will always stay the same. Leave blank to supply this value later, when each new envelope is created from the template.",placeholder:"Full Name...",onInput:function(t){e.full_name=t.target.value;e.dirty=true}}),o("verdocs-text-input",{key:"5c2818a8b37c6fdef9dfd4a9a64bbb2c66216ca9",id:"verdocs-recipient-email",label:"Email",value:this.email,autocomplete:"off",helpText:"The recipient's email address, if it will always stay the same. Leave blank to supply this value later, when each new envelope is created from the template.",placeholder:"Email Address...",onInput:function(t){e.email=t.target.value;e.dirty=true}}),o("verdocs-text-input",{key:"4230659800aac4470c96d411436434511a208015",id:"verdocs-recipient-phone",label:"Phone",value:this.phone,autocomplete:"off",helpText:"The recipient's phone number, if it will always stay the same. Leave blank to supply this value later, when each new envelope is created from the template.",placeholder:"Phone Number...",onInput:function(t){e.phone=t.target.value;e.dirty=true}}),o("div",{key:"2a675d0120b3cbeff8af790260578126d3cf46ce",class:"row"},o("div",{key:"66c007c4d9ea713f5a399186e144d7445797765a",class:"input-label"},"May Delegate:"),o("div",{key:"ab88572b986a7c5def40a9c1e084fe3c62a766bf",class:"checkbox-wrapper"},o("verdocs-checkbox",{key:"b1ca8f96ffd71843beecdc349d86bf3d8cc35708",checked:this.delegator,onInput:function(t){e.delegator=t.target.checked;e.dirty=true}})),o("verdocs-help-icon",{key:"de1d5f121299c133edcc8001a9b6a6b63ff9b739",text:"If enabled, this recipient may delegate their actions to another individual."})),o("div",{key:"79869b6fb38187967ca3550284e4d25f63884fd0",class:"buttons"},o("button",{key:"e58733c07c6793e2c454e5f68c5ffc8907cec1f1",class:"delete-button",disabled:this.dirty,onClick:function(t){return e.handleDelete(t)},innerHTML:g}),o("div",{key:"55f4478946d4675a17055be652e19eb377ae5437",style:{flex:"1"}}),o("verdocs-button",{key:"f67fa328ee71a14f0bd1ba049ffddf228841eb67",size:"small",variant:"outline",label:"Cancel",disabled:!this.dirty,onClick:function(t){return e.handleCancel(t)}}),o("verdocs-button",{key:"690bc539949328f6130e4d8da5db97ed1b355992",size:"small",label:"Save",disabled:!this.dirty,onClick:function(t){return e.handleSave(t)}}))))))};return e}());k.style=y;var w='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-sender{font-family:"Inter", "Barlow", sans-serif;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-sender div{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-sender .background-overlay{position:absolute;z-index:10000;top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;background:rgba(0, 0, 0, 0.4980392157)}verdocs-template-sender .dialog{width:340px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;border-radius:4px;overflow:hidden;background:#ffffff;padding:16px;-webkit-box-shadow:3px 3px 5px 1px rgba(40, 40, 40, 0.4);box-shadow:3px 3px 5px 1px rgba(40, 40, 40, 0.4)}verdocs-template-sender .heading{display:-ms-flexbox;display:flex;font-size:20px;font-weight:500;-ms-flex-direction:row;flex-direction:row}verdocs-template-sender .buttons{display:-ms-flexbox;display:flex;margin-top:10px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-sender .buttons verdocs-button{margin-left:16px}verdocs-template-sender .options{row-gap:10px}verdocs-template-sender .options .option{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row}verdocs-template-sender .options .option .description{margin-left:10px}verdocs-template-sender .options .option .description .name{display:inline-block;vertical-align:top;margin-top:4px;margin-right:4px}';var _=w;var E=e("verdocs_template_sender",function(){function e(e){t(this,e);this.close=r(this,"close",7);this.sdkError=r(this,"sdkError",7);this.store=null;this.endpoint=n.getDefault();this.templateId="";this.sender="everyone";this.saving=false}e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,o,i,r,n,a;return __generator(this,(function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);this.endpoint.loadSession();if(!this.templateId){console.log("[SENDER] Missing required template ID ".concat(this.templateId));return[2]}if(!this.endpoint.session){console.log("[SENDER] Unable to start builder session, must be authenticated");return[2]}n=this;return[4,u(this.endpoint,this.templateId,false)];case 1:n.store=s.sent();this.sender=(t=(e=this.store)===null||e===void 0?void 0:e.state)===null||t===void 0?void 0:t.sender;return[3,3];case 2:a=s.sent();console.log("[SENDER] Error with preview session",a);(o=this.sdkError)===null||o===void 0?void 0:o.emit(new p(a.message,(i=a.response)===null||i===void 0?void 0:i.status,(r=a.response)===null||r===void 0?void 0:r.data));return[3,3];case 3:return[2]}}))}))};e.prototype.handleClose=function(){this.close.emit()};e.prototype.handleDismiss=function(e){if(e.target.className==="background-overlay"){e.preventDefault();this.handleClose()}};e.prototype.handleSelectSetting=function(e){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(o){this.saving=true;c(this.endpoint,this.templateId,{sender:e}).then((function(o){var i;console.log("Update result",o);if((i=t.store)===null||i===void 0?void 0:i.state){t.store.state.sender=e}t.saving=false;t.sender=e})).catch((function(e){console.log("Error saving",e);t.saving=false}));return[2]}))}))};e.prototype.render=function(){var e=this;return o(i,{key:"092c9e3593fffb0559c72fab66510070e73d7c05"},o("div",{key:"666b71a674030a3541138d6dd07a04ec2f352e20",class:"background-overlay",onClick:function(t){return e.handleDismiss(t)}},o("div",{key:"fcabfd99d07d0f72a874fd2ff32a7f72cda51d86",class:"dialog"},o("div",{key:"1098b307a0f787d282ae423f273f02231524598a",class:"options"},o("div",{key:"bb2bd6a5c6f338a955d0e38ddd72be127a908ea7",class:"option"},o("verdocs-radio-button",{key:"47ef7fa0ea436b284f76f8507ecf66ff098a3021",name:"template-sender",value:"everyone",checked:this.sender==="everyone",onInput:function(){return e.handleSelectSetting("everyone")}}),o("div",{key:"8dcc183312a85bf6bb0145a55933842951c859c4",class:"description"},o("div",{key:"c3e41eff5d8353846d5fe62e9739864743936d5d",class:"name"},"Anyone on the Web"),o("verdocs-help-icon",{key:"b3b965183887842c7f3434afc9602ca8d67de419",text:"Anyone can use this template. (Make its visibility is set to to 'Public' or 'Shared'.)"}))),o("div",{key:"4fa78b48a79fc3932a02553e9360fb656c735493",class:"option"},o("verdocs-radio-button",{key:"40429f3fbaa48e0515d4f1e860d0a256df551fb4",name:"template-sender",value:"everyone_as_creator",checked:this.sender==="everyone_as_creator",onInput:function(){return e.handleSelectSetting("everyone_as_creator")}}),o("div",{key:"5add2c44aac55f11094780c82ff6006b4b48ca8e",class:"description"},o("div",{key:"ac8e1c67ab3614b8e5dd3a255c0d71c1820ba83b",class:"name"},"Anyone on the Web as me"),o("verdocs-help-icon",{key:"4d2172b0dcef9cd3e46095e8337aa3c1b8e06523",text:"Anyone can use this template on my behalf. (Make sure its visibility is set to 'Public' or 'Shared'.)"}))),o("div",{key:"36970f9e7c4be312447a36c4a63b470ea85cddf8",class:"option"},o("verdocs-radio-button",{key:"b2fd0896b2bee7243450d6a50cc65fe96e98ab20",name:"template-sender",value:"organization_member",checked:this.sender==="organization_member",onInput:function(){return e.handleSelectSetting("organization_member")}}),o("div",{key:"0bbfeeaf609aa3106df12bf34ef778891e83d0df",class:"description"},o("div",{key:"bb62d9eece8db82b8ef071c0c24127086a89dccc",class:"name"},"Anyone in my organization"),o("verdocs-help-icon",{key:"73d7fa4b6f4b4896d778f3fbc165de2d7b6b2c87",text:"Anyone in my organization can use this template. (Make sure its visibility is set to 'Shared')"}))),o("div",{key:"e1eca6d0234cf0d01ee8d30690248eec07912d3c",class:"option"},o("verdocs-radio-button",{key:"f31029edc86697d113fc37f55c0a94bcc4a35f68",name:"template-sender",value:"organization_member_as_creator",checked:this.sender==="organization_member_as_creator",onInput:function(){return e.handleSelectSetting("organization_member_as_creator")}}),o("div",{key:"5a0f46208920de20dd725f4e16c5de556260d7cb",class:"description"},o("div",{key:"9bfd1c74d34afe93d4a0e11b0877ff7dadf19f83",class:"name"},"Anyone in my organization as me"),o("verdocs-help-icon",{key:"d72a7899414895b1637186c4f731be73cc786eb9",text:"Anyone in my organization can use this template on my behalf. (Make sure its visibility is set to to 'Shared'.)"}))),o("div",{key:"5e55d764e9040fb7b87e0456c2809286835b89e3",class:"option"},o("verdocs-radio-button",{key:"2309a84ec1b4487619f932e8a2316f51c331a13d",name:"template-sender",value:"creator",checked:this.sender==="creator",onInput:function(){return e.handleSelectSetting("creator")}}),o("div",{key:"f3bd9236d0b692415c5a39687c35ba71cf245703",class:"description"},o("div",{key:"8aa05e4b9f42d4febf3c3b28f53dec9de2e0c64d",class:"name"},"Me"),o("verdocs-help-icon",{key:"e79cb02b13641acd64983b91e8de6eb6284a8ee7",text:"Only I can use this template."})))),o("div",{key:"d4b7c6ee528df1ee7f7ec952e80826a20c29ff6c",class:"buttons"},o("verdocs-button",{key:"024ba9b87fc9131db993ecafd76105be0959df47",label:"Close",onClick:function(){return e.handleClose()}})))))};return e}());E.style=_}}}));
@@ -0,0 +1 @@
1
+ import{r as o,c as a,h as e,H as r}from"./p-73a6f972.js";const c=class{constructor(e){o(this,e),this.colHeaderClick=a(this,"colHeaderClick",7),this.rowClick=a(this,"rowClick",7),this.columns=[],this.data=[]}render(){return e(r,{key:"30dc31671a4fe5fe698e16ff2dd4ea9929c7659b",class:"table-wrapper"},e("table",{key:"584e1b863ccf37c17b0e36ac3dd5178d3e591473",class:"table"},e("thead",{key:"e54fccb7ad63ff09d32719b2b9ce2beceae33d4a"},e("tr",{key:"1b435a6772c21795c5c7bd0dddb5a8225add0e55",class:"row header-row"},this.columns.map(((o,a)=>e("th",{class:`col header-col col-${a} col-${o.id}`,onClick:()=>{var a;return null===(a=this.colHeaderClick)||void 0===a?void 0:a.emit({col:o})},innerHTML:o.renderHeader?o.renderHeader(o):o.header||o.id}))))),e("tbody",{key:"75dd1db03c8ea79b186939b5dab16a800371c3db"},this.data.map((o=>e("tr",{class:"row data-row",onClick:()=>{var a;return null===(a=this.rowClick)||void 0===a?void 0:a.emit({row:o})}},this.columns.map(((a,r)=>a.renderCell?e("td",{class:`col data-col col-${r} col-${a.id}`,innerHTML:a.renderCell(a,o)}):e("td",{class:`col data-col col-${r} col-${a.id}`},o[a.id])))))))))}};c.style='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-table{width:100%;display:block;margin:0 0 10px 0;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:"Inter", "Barlow", sans-serif}verdocs-table .table-wrapper{margin:10px 0;padding:0}verdocs-table .table{width:100%;border:none;border-collapse:collapse}verdocs-table .row.data-row{border:1px solid #d4d4d8;background-color:#ffffff}verdocs-table .header-col{color:#5c6575;font-weight:600;text-align:left;padding:8px 16px}verdocs-table .data-col{font-weight:400;padding:8px 16px}';export{c as verdocs_table}
@@ -1 +1 @@
1
- import{c as e}from"./p-00b37c9a.js";import{getEnvelope as o}from"@verdocs/js-sdk";import{u as t}from"./p-f3b47dfc.js";const r={},n=async(n,s,i=!1)=>{var l;let a=!1;r[s]||(console.debug("[ENVELOPES] No envelope store found for ID, creating",s),r[s]=(o=>{const r=(new Date).toISOString();return e({isLoading:!0,isLoaded:!1,isError:!1,error:null,roleNames:[],id:o,template_id:"",name:"",status:"pending",profile_id:"",organization_id:"",no_contact:!1,created_at:r,updated_at:r,canceled_at:null,reminder_id:null,visibility:"private",recipients:[],profile:null,access_keys:[],data:t,history_entries:[],organization:null,reminder:null,search_key:"",template:null,documents:[],fields:[]})})(s),a=!0);const c=r[s];if(c.use({reset:()=>console.debug("[ENVELOPES] Store got reset"),dispose:()=>console.debug("[ENVELOPES] Store got disposed")}),a||i){console.debug("[ENVELOPES] Reloading envelope",{envelopeId:s,created:a,forceReload:i}),c.state.isLoading=!0,c.state.isLoaded=!1,c.state.isError=!1,c.state.error=t;try{const e=await o(n,s);null===(l=e.documents)||void 0===l||l.forEach((e=>{e.order||(e.order=0),e.page_numbers&&(e.pages=e.page_numbers)})),console.debug("[ENVELOPES] Got envelope",e),Object.assign(c.state,e),c.state.isLoaded=!0,c.state.isError=!1,c.state.error=t}catch(e){throw console.error("[ENVELOPES] Error loading envelope",e),c.state.isLoaded=!1,c.state.isError=!0,c.state.error=e,e}c.state.isLoading=!1}return c};export{n as g}
1
+ import{c as e}from"./p-00b37c9a.js";import{getEnvelope as o}from"@verdocs/js-sdk";import{u as t}from"./p-a706bac9.js";const r={},n=async(n,s,a=!1)=>{var i;let l=!1;r[s]||(console.debug("[ENVELOPES] No envelope store found for ID, creating",s),r[s]=(o=>{const r=(new Date).toISOString();return e({isLoading:!0,isLoaded:!1,isError:!1,error:null,roleNames:[],id:o,template_id:"",name:"",status:"pending",profile_id:"",organization_id:"",no_contact:!1,created_at:r,updated_at:r,canceled_at:null,reminder_id:null,visibility:"private",recipients:[],profile:null,access_keys:[],data:t,history_entries:[],organization:null,reminder:null,search_key:"",template:null,documents:[],fields:[]})})(s),l=!0);const c=r[s];if(c.use({reset:()=>console.debug("[ENVELOPES] Store got reset"),dispose:()=>console.debug("[ENVELOPES] Store got disposed")}),l||a){console.debug("[ENVELOPES] Reloading envelope",{envelopeId:s,created:l,forceReload:a}),c.state.isLoading=!0,c.state.isLoaded=!1,c.state.isError=!1,c.state.error=t;try{const e=await o(n,s);null===(i=e.documents)||void 0===i||i.forEach((e=>{e.order||(e.order=0),e.page_numbers&&(e.pages=e.page_numbers)})),console.debug("[ENVELOPES] Got envelope",e),Object.assign(c.state,e),c.state.isLoaded=!0,c.state.isError=!1,c.state.error=t}catch(e){throw console.error("[ENVELOPES] Error loading envelope",e),c.state.isLoaded=!1,c.state.isError=!0,c.state.error=e,e}c.state.isLoading=!1}return c};export{n as g}
@@ -0,0 +1 @@
1
+ var __extends=this&&this.__extends||function(){var e=function(n,t){e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)if(Object.prototype.hasOwnProperty.call(n,t))e[t]=n[t]};return e(n,t)};return function(n,t){if(typeof t!=="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");e(n,t);function r(){this.constructor=n}n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();var __assign=this&&this.__assign||function(){__assign=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++){n=arguments[t];for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i))e[i]=n[i]}return e};return __assign.apply(this,arguments)};var __awaiter=this&&this.__awaiter||function(e,n,t,r){function i(e){return e instanceof t?e:new t((function(n){n(e)}))}return new(t||(t=Promise))((function(t,a){function s(e){try{o(r.next(e))}catch(e){a(e)}}function u(e){try{o(r["throw"](e))}catch(e){a(e)}}function o(e){e.done?t(e.value):i(e.value).then(s,u)}o((r=r.apply(e,n||[])).next())}))};var __generator=this&&this.__generator||function(e,n){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(e){return function(n){return o([e,n])}}function o(u){if(r)throw new TypeError("Generator is already executing.");while(s&&(s=0,u[0]&&(t=0)),t)try{if(r=1,i&&(a=u[0]&2?i["return"]:u[0]?i["throw"]||((a=i["return"])&&a.call(i),0):i.next)&&!(a=a.call(i,u[1])).done)return a;if(i=0,a)u=[u[0]&2,a.value];switch(u[0]){case 0:case 1:a=u;break;case 4:t.label++;return{value:u[1],done:false};case 5:t.label++;i=u[1];u=[0];continue;case 7:u=t.ops.pop();t.trys.pop();continue;default:if(!(a=t.trys,a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){t.label=u[1];break}if(u[0]===6&&t.label<a[1]){t.label=a[1];a=u;break}if(a&&t.label<a[2]){t.label=a[2];t.ops.push(u);break}if(a[2])t.ops.pop();t.trys.pop();continue}u=n.call(e,t)}catch(e){u=[6,e];i=0}finally{r=a=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,n,t){if(t||arguments.length===2)for(var r=0,i=n.length,a;r<i;r++){if(a||!(r in n)){if(!a)a=Array.prototype.slice.call(n,0,r);a[r]=n[r]}}return e.concat(a||Array.prototype.slice.call(n))};System.register([],(function(e){"use strict";return{execute:function(){var n;(function(e){e.assertEqual=function(e){return e};function n(e){}e.assertIs=n;function t(e){throw new Error}e.assertNever=t;e.arrayToEnum=function(e){var n={};for(var t=0,r=e;t<r.length;t++){var i=r[t];n[i]=i}return n};e.getValidEnumValues=function(n){var t=e.objectKeys(n).filter((function(e){return typeof n[n[e]]!=="number"}));var r={};for(var i=0,a=t;i<a.length;i++){var s=a[i];r[s]=n[s]}return e.objectValues(r)};e.objectValues=function(n){return e.objectKeys(n).map((function(e){return n[e]}))};e.objectKeys=typeof Object.keys==="function"?function(e){return Object.keys(e)}:function(e){var n=[];for(var t in e){if(Object.prototype.hasOwnProperty.call(e,t)){n.push(t)}}return n};e.find=function(e,n){for(var t=0,r=e;t<r.length;t++){var i=r[t];if(n(i))return i}return undefined};e.isInteger=typeof Number.isInteger==="function"?function(e){return Number.isInteger(e)}:function(e){return typeof e==="number"&&isFinite(e)&&Math.floor(e)===e};function r(e,n){if(n===void 0){n=" | "}return e.map((function(e){return typeof e==="string"?"'".concat(e,"'"):e})).join(n)}e.joinValues=r;e.jsonStringifyReplacer=function(e,n){if(typeof n==="bigint"){return n.toString()}return n}})(n||(n={}));var t;(function(e){e.mergeShapes=function(e,n){return __assign(__assign({},e),n)}})(t||(t={}));var r=n.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var i=function(e){var n=typeof e;switch(n){case"undefined":return r.undefined;case"string":return r.string;case"number":return isNaN(e)?r.nan:r.number;case"boolean":return r.boolean;case"function":return r.function;case"bigint":return r.bigint;case"symbol":return r.symbol;case"object":if(Array.isArray(e)){return r.array}if(e===null){return r.null}if(e.then&&typeof e.then==="function"&&e.catch&&typeof e.catch==="function"){return r.promise}if(typeof Map!=="undefined"&&e instanceof Map){return r.map}if(typeof Set!=="undefined"&&e instanceof Set){return r.set}if(typeof Date!=="undefined"&&e instanceof Date){return r.date}return r.object;default:return r.unknown}};var a=n.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);var s=function(e){__extends(t,e);function t(n){var t=this.constructor;var r=e.call(this)||this;r.issues=[];r.addIssue=function(e){r.issues=__spreadArray(__spreadArray([],r.issues,true),[e],false)};r.addIssues=function(e){if(e===void 0){e=[]}r.issues=__spreadArray(__spreadArray([],r.issues,true),e,true)};var i=t.prototype;if(Object.setPrototypeOf){Object.setPrototypeOf(r,i)}else{r.__proto__=i}r.name="ZodError";r.issues=n;return r}Object.defineProperty(t.prototype,"errors",{get:function(){return this.issues},enumerable:false,configurable:true});t.prototype.format=function(e){var n=e||function(e){return e.message};var t={_errors:[]};var r=function(e){for(var i=0,a=e.issues;i<a.length;i++){var s=a[i];if(s.code==="invalid_union"){s.unionErrors.map(r)}else if(s.code==="invalid_return_type"){r(s.returnTypeError)}else if(s.code==="invalid_arguments"){r(s.argumentsError)}else if(s.path.length===0){t._errors.push(n(s))}else{var u=t;var o=0;while(o<s.path.length){var f=s.path[o];var c=o===s.path.length-1;if(!c){u[f]=u[f]||{_errors:[]}}else{u[f]=u[f]||{_errors:[]};u[f]._errors.push(n(s))}u=u[f];o++}}}};r(this);return t};t.assert=function(e){if(!(e instanceof t)){throw new Error("Not a ZodError: ".concat(e))}};t.prototype.toString=function(){return this.message};Object.defineProperty(t.prototype,"message",{get:function(){return JSON.stringify(this.issues,n.jsonStringifyReplacer,2)},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"isEmpty",{get:function(){return this.issues.length===0},enumerable:false,configurable:true});t.prototype.flatten=function(e){if(e===void 0){e=function(e){return e.message}}var n={};var t=[];for(var r=0,i=this.issues;r<i.length;r++){var a=i[r];if(a.path.length>0){n[a.path[0]]=n[a.path[0]]||[];n[a.path[0]].push(e(a))}else{t.push(e(a))}}return{formErrors:t,fieldErrors:n}};Object.defineProperty(t.prototype,"formErrors",{get:function(){return this.flatten()},enumerable:false,configurable:true});return t}(Error);s.create=function(e){var n=new s(e);return n};var u=function(e,t){var i;switch(e.code){case a.invalid_type:if(e.received===r.undefined){i="Required"}else{i="Expected ".concat(e.expected,", received ").concat(e.received)}break;case a.invalid_literal:i="Invalid literal value, expected ".concat(JSON.stringify(e.expected,n.jsonStringifyReplacer));break;case a.unrecognized_keys:i="Unrecognized key(s) in object: ".concat(n.joinValues(e.keys,", "));break;case a.invalid_union:i="Invalid input";break;case a.invalid_union_discriminator:i="Invalid discriminator value. Expected ".concat(n.joinValues(e.options));break;case a.invalid_enum_value:i="Invalid enum value. Expected ".concat(n.joinValues(e.options),", received '").concat(e.received,"'");break;case a.invalid_arguments:i="Invalid function arguments";break;case a.invalid_return_type:i="Invalid function return type";break;case a.invalid_date:i="Invalid date";break;case a.invalid_string:if(typeof e.validation==="object"){if("includes"in e.validation){i='Invalid input: must include "'.concat(e.validation.includes,'"');if(typeof e.validation.position==="number"){i="".concat(i," at one or more positions greater than or equal to ").concat(e.validation.position)}}else if("startsWith"in e.validation){i='Invalid input: must start with "'.concat(e.validation.startsWith,'"')}else if("endsWith"in e.validation){i='Invalid input: must end with "'.concat(e.validation.endsWith,'"')}else{n.assertNever(e.validation)}}else if(e.validation!=="regex"){i="Invalid ".concat(e.validation)}else{i="Invalid"}break;case a.too_small:if(e.type==="array")i="Array must contain ".concat(e.exact?"exactly":e.inclusive?"at least":"more than"," ").concat(e.minimum," element(s)");else if(e.type==="string")i="String must contain ".concat(e.exact?"exactly":e.inclusive?"at least":"over"," ").concat(e.minimum," character(s)");else if(e.type==="number")i="Number must be ".concat(e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than ").concat(e.minimum);else if(e.type==="date")i="Date must be ".concat(e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than ").concat(new Date(Number(e.minimum)));else i="Invalid input";break;case a.too_big:if(e.type==="array")i="Array must contain ".concat(e.exact?"exactly":e.inclusive?"at most":"less than"," ").concat(e.maximum," element(s)");else if(e.type==="string")i="String must contain ".concat(e.exact?"exactly":e.inclusive?"at most":"under"," ").concat(e.maximum," character(s)");else if(e.type==="number")i="Number must be ".concat(e.exact?"exactly":e.inclusive?"less than or equal to":"less than"," ").concat(e.maximum);else if(e.type==="bigint")i="BigInt must be ".concat(e.exact?"exactly":e.inclusive?"less than or equal to":"less than"," ").concat(e.maximum);else if(e.type==="date")i="Date must be ".concat(e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"," ").concat(new Date(Number(e.maximum)));else i="Invalid input";break;case a.custom:i="Invalid input";break;case a.invalid_intersection_types:i="Intersection results could not be merged";break;case a.not_multiple_of:i="Number must be a multiple of ".concat(e.multipleOf);break;case a.not_finite:i="Number must be finite";break;default:i=t.defaultError;n.assertNever(e)}return{message:i}};var o=u;function f(){return o}var c=function(e){var n=e.data,t=e.path,r=e.errorMaps,i=e.issueData;var a=__spreadArray(__spreadArray([],t,true),i.path||[],true);var s=__assign(__assign({},i),{path:a});if(i.message!==undefined){return __assign(__assign({},i),{path:a,message:i.message})}var u="";var o=r.filter((function(e){return!!e})).slice().reverse();for(var f=0,c=o;f<c.length;f++){var l=c[f];u=l(s,{data:n,defaultError:u}).message}return __assign(__assign({},i),{path:a,message:u})};function l(e,n){var t=f();var r=c({issueData:n,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,t,t===u?undefined:u].filter((function(e){return!!e}))});e.common.issues.push(r)}var h=function(){function e(){this.value="valid"}e.prototype.dirty=function(){if(this.value==="valid")this.value="dirty"};e.prototype.abort=function(){if(this.value!=="aborted")this.value="aborted"};e.mergeArray=function(e,n){var t=[];for(var r=0,i=n;r<i.length;r++){var a=i[r];if(a.status==="aborted")return d;if(a.status==="dirty")e.dirty();t.push(a.value)}return{status:e.value,value:t}};e.mergeObjectAsync=function(n,t){return __awaiter(this,void 0,void 0,(function(){var r,i,a,s,u,o;return __generator(this,(function(f){switch(f.label){case 0:r=[];i=0,a=t;f.label=1;case 1:if(!(i<a.length))return[3,5];s=a[i];return[4,s.key];case 2:u=f.sent();return[4,s.value];case 3:o=f.sent();r.push({key:u,value:o});f.label=4;case 4:i++;return[3,1];case 5:return[2,e.mergeObjectSync(n,r)]}}))}))};e.mergeObjectSync=function(e,n){var t={};for(var r=0,i=n;r<i.length;r++){var a=i[r];var s=a.key,u=a.value;if(s.status==="aborted")return d;if(u.status==="aborted")return d;if(s.status==="dirty")e.dirty();if(u.status==="dirty")e.dirty();if(s.value!=="__proto__"&&(typeof u.value!=="undefined"||a.alwaysSet)){t[s.value]=u.value}}return{status:e.value,value:t}};return e}();var d=Object.freeze({status:"aborted"});var v=function(e){return{status:"dirty",value:e}};var _=function(e){return{status:"valid",value:e}};var m=function(e){return e.status==="aborted"};var g=function(e){return e.status==="dirty"};var p=function(e){return e.status==="valid"};var y=function(e){return typeof Promise!=="undefined"&&e instanceof Promise};function b(e,n,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof n==="function"?e!==n||!r:!n.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(e):r?r.value:n.get(e)}function w(e,n,t,r,i){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof n==="function"?e!==n||!i:!n.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?i.call(e,t):i?i.value=t:n.set(e,t),t}typeof SuppressedError==="function"?SuppressedError:function(e,n,t){var r=new Error(t);return r.name="SuppressedError",r.error=e,r.suppressed=n,r};var x;(function(e){e.errToObj=function(e){return typeof e==="string"?{message:e}:e||{}};e.toString=function(e){return typeof e==="string"?e:e===null||e===void 0?void 0:e.message}})(x||(x={}));var k,N;var j=function(){function e(e,n,t,r){this._cachedPath=[];this.parent=e;this.data=n;this._path=t;this._key=r}Object.defineProperty(e.prototype,"path",{get:function(){var e,n;if(!this._cachedPath.length){if(this._key instanceof Array){(e=this._cachedPath).push.apply(e,__spreadArray(__spreadArray([],this._path,false),this._key,false))}else{(n=this._cachedPath).push.apply(n,__spreadArray(__spreadArray([],this._path,false),[this._key],false))}}return this._cachedPath},enumerable:false,configurable:true});return e}();var O=function(e,n){if(p(n)){return{success:true,data:n.value}}else{if(!e.common.issues.length){throw new Error("Validation failed but no issues detected.")}return{success:false,get error(){if(this._error)return this._error;var n=new s(e.common.issues);this._error=n;return this._error}}}};function A(e){if(!e)return{};var n=e.errorMap,t=e.invalid_type_error,r=e.required_error,i=e.description;if(n&&(t||r)){throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.')}if(n)return{errorMap:n,description:i};var a=function(n,i){var a,s;var u=e.message;if(n.code==="invalid_enum_value"){return{message:u!==null&&u!==void 0?u:i.defaultError}}if(typeof i.data==="undefined"){return{message:(a=u!==null&&u!==void 0?u:r)!==null&&a!==void 0?a:i.defaultError}}if(n.code!=="invalid_type")return{message:i.defaultError};return{message:(s=u!==null&&u!==void 0?u:t)!==null&&s!==void 0?s:i.defaultError}};return{errorMap:a,description:i}}var E=function(){function e(e){this.spa=this.safeParseAsync;this._def=e;this.parse=this.parse.bind(this);this.safeParse=this.safeParse.bind(this);this.parseAsync=this.parseAsync.bind(this);this.safeParseAsync=this.safeParseAsync.bind(this);this.spa=this.spa.bind(this);this.refine=this.refine.bind(this);this.refinement=this.refinement.bind(this);this.superRefine=this.superRefine.bind(this);this.optional=this.optional.bind(this);this.nullable=this.nullable.bind(this);this.nullish=this.nullish.bind(this);this.array=this.array.bind(this);this.promise=this.promise.bind(this);this.or=this.or.bind(this);this.and=this.and.bind(this);this.transform=this.transform.bind(this);this.brand=this.brand.bind(this);this.default=this.default.bind(this);this.catch=this.catch.bind(this);this.describe=this.describe.bind(this);this.pipe=this.pipe.bind(this);this.readonly=this.readonly.bind(this);this.isNullable=this.isNullable.bind(this);this.isOptional=this.isOptional.bind(this)}Object.defineProperty(e.prototype,"description",{get:function(){return this._def.description},enumerable:false,configurable:true});e.prototype._getType=function(e){return i(e.data)};e.prototype._getOrReturnCtx=function(e,n){return n||{common:e.parent.common,data:e.data,parsedType:i(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}};e.prototype._processInputParams=function(e){return{status:new h,ctx:{common:e.parent.common,data:e.data,parsedType:i(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}};e.prototype._parseSync=function(e){var n=this._parse(e);if(y(n)){throw new Error("Synchronous parse encountered promise.")}return n};e.prototype._parseAsync=function(e){var n=this._parse(e);return Promise.resolve(n)};e.prototype.parse=function(e,n){var t=this.safeParse(e,n);if(t.success)return t.data;throw t.error};e.prototype.safeParse=function(e,n){var t;var r={common:{issues:[],async:(t=n===null||n===void 0?void 0:n.async)!==null&&t!==void 0?t:false,contextualErrorMap:n===null||n===void 0?void 0:n.errorMap},path:(n===null||n===void 0?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:i(e)};var a=this._parseSync({data:e,path:r.path,parent:r});return O(r,a)};e.prototype.parseAsync=function(e,n){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(r){switch(r.label){case 0:return[4,this.safeParseAsync(e,n)];case 1:t=r.sent();if(t.success)return[2,t.data];throw t.error}}))}))};e.prototype.safeParseAsync=function(e,n){return __awaiter(this,void 0,void 0,(function(){var t,r,a;return __generator(this,(function(s){switch(s.label){case 0:t={common:{issues:[],contextualErrorMap:n===null||n===void 0?void 0:n.errorMap,async:true},path:(n===null||n===void 0?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:i(e)};r=this._parse({data:e,path:t.path,parent:t});return[4,y(r)?r:Promise.resolve(r)];case 1:a=s.sent();return[2,O(t,a)]}}))}))};e.prototype.refine=function(e,n){var t=function(e){if(typeof n==="string"||typeof n==="undefined"){return{message:n}}else if(typeof n==="function"){return n(e)}else{return n}};return this._refinement((function(n,r){var i=e(n);var s=function(){return r.addIssue(__assign({code:a.custom},t(n)))};if(typeof Promise!=="undefined"&&i instanceof Promise){return i.then((function(e){if(!e){s();return false}else{return true}}))}if(!i){s();return false}else{return true}}))};e.prototype.refinement=function(e,n){return this._refinement((function(t,r){if(!e(t)){r.addIssue(typeof n==="function"?n(t,r):n);return false}else{return true}}))};e.prototype._refinement=function(e){return new we({schema:this,typeName:Ie.ZodEffects,effect:{type:"refinement",refinement:e}})};e.prototype.superRefine=function(e){return this._refinement(e)};e.prototype.optional=function(){return xe.create(this,this._def)};e.prototype.nullable=function(){return ke.create(this,this._def)};e.prototype.nullish=function(){return this.nullable().optional()};e.prototype.array=function(){return se.create(this,this._def)};e.prototype.promise=function(){return be.create(this,this._def)};e.prototype.or=function(e){return fe.create([this,e],this._def)};e.prototype.and=function(e){return le.create(this,e,this._def)};e.prototype.transform=function(e){return new we(__assign(__assign({},A(this._def)),{schema:this,typeName:Ie.ZodEffects,effect:{type:"transform",transform:e}}))};e.prototype.default=function(e){var n=typeof e==="function"?e:function(){return e};return new Ne(__assign(__assign({},A(this._def)),{innerType:this,defaultValue:n,typeName:Ie.ZodDefault}))};e.prototype.brand=function(){return new Ae(__assign({typeName:Ie.ZodBranded,type:this},A(this._def)))};e.prototype.catch=function(e){var n=typeof e==="function"?e:function(){return e};return new je(__assign(__assign({},A(this._def)),{innerType:this,catchValue:n,typeName:Ie.ZodCatch}))};e.prototype.describe=function(e){var n=this.constructor;return new n(__assign(__assign({},this._def),{description:e}))};e.prototype.pipe=function(e){return Ee.create(this,e)};e.prototype.readonly=function(){return Ze.create(this)};e.prototype.isOptional=function(){return this.safeParse(undefined).success};e.prototype.isNullable=function(){return this.safeParse(null).success};return e}();var Z=/^c[^\s-]{8,}$/i;var I=/^[0-9a-z]+$/;var S=/^[0-9A-HJKMNP-TV-Z]{26}$/;var P=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i;var D=/^[a-z0-9_-]{21}$/i;var T=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;var M=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;var $="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";var U;var L=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;var z=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;var B=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;var C="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))";var V=new RegExp("^".concat(C,"$"));function W(e){var n="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";if(e.precision){n="".concat(n,"\\.\\d{").concat(e.precision,"}")}else if(e.precision==null){n="".concat(n,"(\\.\\d+)?")}return n}function q(e){return new RegExp("^".concat(W(e),"$"))}function K(e){var n="".concat(C,"T").concat(W(e));var t=[];t.push(e.local?"Z?":"Z");if(e.offset)t.push("([+-]\\d{2}:?\\d{2})");n="".concat(n,"(").concat(t.join("|"),")");return new RegExp("^".concat(n,"$"))}function R(e,n){if((n==="v4"||!n)&&L.test(e)){return true}if((n==="v6"||!n)&&z.test(e)){return true}return false}var F=function(e){__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}t.prototype._parse=function(e){if(this._def.coerce){e.data=String(e.data)}var t=this._getType(e);if(t!==r.string){var i=this._getOrReturnCtx(e);l(i,{code:a.invalid_type,expected:r.string,received:i.parsedType});return d}var s=new h;var u=undefined;for(var o=0,f=this._def.checks;o<f.length;o++){var c=f[o];if(c.kind==="min"){if(e.data.length<c.value){u=this._getOrReturnCtx(e,u);l(u,{code:a.too_small,minimum:c.value,type:"string",inclusive:true,exact:false,message:c.message});s.dirty()}}else if(c.kind==="max"){if(e.data.length>c.value){u=this._getOrReturnCtx(e,u);l(u,{code:a.too_big,maximum:c.value,type:"string",inclusive:true,exact:false,message:c.message});s.dirty()}}else if(c.kind==="length"){var v=e.data.length>c.value;var _=e.data.length<c.value;if(v||_){u=this._getOrReturnCtx(e,u);if(v){l(u,{code:a.too_big,maximum:c.value,type:"string",inclusive:true,exact:true,message:c.message})}else if(_){l(u,{code:a.too_small,minimum:c.value,type:"string",inclusive:true,exact:true,message:c.message})}s.dirty()}}else if(c.kind==="email"){if(!M.test(e.data)){u=this._getOrReturnCtx(e,u);l(u,{validation:"email",code:a.invalid_string,message:c.message});s.dirty()}}else if(c.kind==="emoji"){if(!U){U=new RegExp($,"u")}if(!U.test(e.data)){u=this._getOrReturnCtx(e,u);l(u,{validation:"emoji",code:a.invalid_string,message:c.message});s.dirty()}}else if(c.kind==="uuid"){if(!P.test(e.data)){u=this._getOrReturnCtx(e,u);l(u,{validation:"uuid",code:a.invalid_string,message:c.message});s.dirty()}}else if(c.kind==="nanoid"){if(!D.test(e.data)){u=this._getOrReturnCtx(e,u);l(u,{validation:"nanoid",code:a.invalid_string,message:c.message});s.dirty()}}else if(c.kind==="cuid"){if(!Z.test(e.data)){u=this._getOrReturnCtx(e,u);l(u,{validation:"cuid",code:a.invalid_string,message:c.message});s.dirty()}}else if(c.kind==="cuid2"){if(!I.test(e.data)){u=this._getOrReturnCtx(e,u);l(u,{validation:"cuid2",code:a.invalid_string,message:c.message});s.dirty()}}else if(c.kind==="ulid"){if(!S.test(e.data)){u=this._getOrReturnCtx(e,u);l(u,{validation:"ulid",code:a.invalid_string,message:c.message});s.dirty()}}else if(c.kind==="url"){try{new URL(e.data)}catch(n){u=this._getOrReturnCtx(e,u);l(u,{validation:"url",code:a.invalid_string,message:c.message});s.dirty()}}else if(c.kind==="regex"){c.regex.lastIndex=0;var m=c.regex.test(e.data);if(!m){u=this._getOrReturnCtx(e,u);l(u,{validation:"regex",code:a.invalid_string,message:c.message});s.dirty()}}else if(c.kind==="trim"){e.data=e.data.trim()}else if(c.kind==="includes"){if(!e.data.includes(c.value,c.position)){u=this._getOrReturnCtx(e,u);l(u,{code:a.invalid_string,validation:{includes:c.value,position:c.position},message:c.message});s.dirty()}}else if(c.kind==="toLowerCase"){e.data=e.data.toLowerCase()}else if(c.kind==="toUpperCase"){e.data=e.data.toUpperCase()}else if(c.kind==="startsWith"){if(!e.data.startsWith(c.value)){u=this._getOrReturnCtx(e,u);l(u,{code:a.invalid_string,validation:{startsWith:c.value},message:c.message});s.dirty()}}else if(c.kind==="endsWith"){if(!e.data.endsWith(c.value)){u=this._getOrReturnCtx(e,u);l(u,{code:a.invalid_string,validation:{endsWith:c.value},message:c.message});s.dirty()}}else if(c.kind==="datetime"){var g=K(c);if(!g.test(e.data)){u=this._getOrReturnCtx(e,u);l(u,{code:a.invalid_string,validation:"datetime",message:c.message});s.dirty()}}else if(c.kind==="date"){var g=V;if(!g.test(e.data)){u=this._getOrReturnCtx(e,u);l(u,{code:a.invalid_string,validation:"date",message:c.message});s.dirty()}}else if(c.kind==="time"){var g=q(c);if(!g.test(e.data)){u=this._getOrReturnCtx(e,u);l(u,{code:a.invalid_string,validation:"time",message:c.message});s.dirty()}}else if(c.kind==="duration"){if(!T.test(e.data)){u=this._getOrReturnCtx(e,u);l(u,{validation:"duration",code:a.invalid_string,message:c.message});s.dirty()}}else if(c.kind==="ip"){if(!R(e.data,c.version)){u=this._getOrReturnCtx(e,u);l(u,{validation:"ip",code:a.invalid_string,message:c.message});s.dirty()}}else if(c.kind==="base64"){if(!B.test(e.data)){u=this._getOrReturnCtx(e,u);l(u,{validation:"base64",code:a.invalid_string,message:c.message});s.dirty()}}else{n.assertNever(c)}}return{status:s.value,value:e.data}};t.prototype._regex=function(e,n,t){return this.refinement((function(n){return e.test(n)}),__assign({validation:n,code:a.invalid_string},x.errToObj(t)))};t.prototype._addCheck=function(e){return new t(__assign(__assign({},this._def),{checks:__spreadArray(__spreadArray([],this._def.checks,true),[e],false)}))};t.prototype.email=function(e){return this._addCheck(__assign({kind:"email"},x.errToObj(e)))};t.prototype.url=function(e){return this._addCheck(__assign({kind:"url"},x.errToObj(e)))};t.prototype.emoji=function(e){return this._addCheck(__assign({kind:"emoji"},x.errToObj(e)))};t.prototype.uuid=function(e){return this._addCheck(__assign({kind:"uuid"},x.errToObj(e)))};t.prototype.nanoid=function(e){return this._addCheck(__assign({kind:"nanoid"},x.errToObj(e)))};t.prototype.cuid=function(e){return this._addCheck(__assign({kind:"cuid"},x.errToObj(e)))};t.prototype.cuid2=function(e){return this._addCheck(__assign({kind:"cuid2"},x.errToObj(e)))};t.prototype.ulid=function(e){return this._addCheck(__assign({kind:"ulid"},x.errToObj(e)))};t.prototype.base64=function(e){return this._addCheck(__assign({kind:"base64"},x.errToObj(e)))};t.prototype.ip=function(e){return this._addCheck(__assign({kind:"ip"},x.errToObj(e)))};t.prototype.datetime=function(e){var n,t;if(typeof e==="string"){return this._addCheck({kind:"datetime",precision:null,offset:false,local:false,message:e})}return this._addCheck(__assign({kind:"datetime",precision:typeof(e===null||e===void 0?void 0:e.precision)==="undefined"?null:e===null||e===void 0?void 0:e.precision,offset:(n=e===null||e===void 0?void 0:e.offset)!==null&&n!==void 0?n:false,local:(t=e===null||e===void 0?void 0:e.local)!==null&&t!==void 0?t:false},x.errToObj(e===null||e===void 0?void 0:e.message)))};t.prototype.date=function(e){return this._addCheck({kind:"date",message:e})};t.prototype.time=function(e){if(typeof e==="string"){return this._addCheck({kind:"time",precision:null,message:e})}return this._addCheck(__assign({kind:"time",precision:typeof(e===null||e===void 0?void 0:e.precision)==="undefined"?null:e===null||e===void 0?void 0:e.precision},x.errToObj(e===null||e===void 0?void 0:e.message)))};t.prototype.duration=function(e){return this._addCheck(__assign({kind:"duration"},x.errToObj(e)))};t.prototype.regex=function(e,n){return this._addCheck(__assign({kind:"regex",regex:e},x.errToObj(n)))};t.prototype.includes=function(e,n){return this._addCheck(__assign({kind:"includes",value:e,position:n===null||n===void 0?void 0:n.position},x.errToObj(n===null||n===void 0?void 0:n.message)))};t.prototype.startsWith=function(e,n){return this._addCheck(__assign({kind:"startsWith",value:e},x.errToObj(n)))};t.prototype.endsWith=function(e,n){return this._addCheck(__assign({kind:"endsWith",value:e},x.errToObj(n)))};t.prototype.min=function(e,n){return this._addCheck(__assign({kind:"min",value:e},x.errToObj(n)))};t.prototype.max=function(e,n){return this._addCheck(__assign({kind:"max",value:e},x.errToObj(n)))};t.prototype.length=function(e,n){return this._addCheck(__assign({kind:"length",value:e},x.errToObj(n)))};t.prototype.nonempty=function(e){return this.min(1,x.errToObj(e))};t.prototype.trim=function(){return new t(__assign(__assign({},this._def),{checks:__spreadArray(__spreadArray([],this._def.checks,true),[{kind:"trim"}],false)}))};t.prototype.toLowerCase=function(){return new t(__assign(__assign({},this._def),{checks:__spreadArray(__spreadArray([],this._def.checks,true),[{kind:"toLowerCase"}],false)}))};t.prototype.toUpperCase=function(){return new t(__assign(__assign({},this._def),{checks:__spreadArray(__spreadArray([],this._def.checks,true),[{kind:"toUpperCase"}],false)}))};Object.defineProperty(t.prototype,"isDatetime",{get:function(){return!!this._def.checks.find((function(e){return e.kind==="datetime"}))},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"isDate",{get:function(){return!!this._def.checks.find((function(e){return e.kind==="date"}))},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"isTime",{get:function(){return!!this._def.checks.find((function(e){return e.kind==="time"}))},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"isDuration",{get:function(){return!!this._def.checks.find((function(e){return e.kind==="duration"}))},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"isEmail",{get:function(){return!!this._def.checks.find((function(e){return e.kind==="email"}))},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"isURL",{get:function(){return!!this._def.checks.find((function(e){return e.kind==="url"}))},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"isEmoji",{get:function(){return!!this._def.checks.find((function(e){return e.kind==="emoji"}))},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"isUUID",{get:function(){return!!this._def.checks.find((function(e){return e.kind==="uuid"}))},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"isNANOID",{get:function(){return!!this._def.checks.find((function(e){return e.kind==="nanoid"}))},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"isCUID",{get:function(){return!!this._def.checks.find((function(e){return e.kind==="cuid"}))},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"isCUID2",{get:function(){return!!this._def.checks.find((function(e){return e.kind==="cuid2"}))},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"isULID",{get:function(){return!!this._def.checks.find((function(e){return e.kind==="ulid"}))},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"isIP",{get:function(){return!!this._def.checks.find((function(e){return e.kind==="ip"}))},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"isBase64",{get:function(){return!!this._def.checks.find((function(e){return e.kind==="base64"}))},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"minLength",{get:function(){var e=null;for(var n=0,t=this._def.checks;n<t.length;n++){var r=t[n];if(r.kind==="min"){if(e===null||r.value>e)e=r.value}}return e},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"maxLength",{get:function(){var e=null;for(var n=0,t=this._def.checks;n<t.length;n++){var r=t[n];if(r.kind==="max"){if(e===null||r.value<e)e=r.value}}return e},enumerable:false,configurable:true});return t}(E);F.create=function(e){var n;return new F(__assign({checks:[],typeName:Ie.ZodString,coerce:(n=e===null||e===void 0?void 0:e.coerce)!==null&&n!==void 0?n:false},A(e)))};function H(e,n){var t=(e.toString().split(".")[1]||"").length;var r=(n.toString().split(".")[1]||"").length;var i=t>r?t:r;var a=parseInt(e.toFixed(i).replace(".",""));var s=parseInt(n.toFixed(i).replace(".",""));return a%s/Math.pow(10,i)}var J=function(e){__extends(t,e);function t(){var n=e.apply(this,arguments)||this;n.min=n.gte;n.max=n.lte;n.step=n.multipleOf;return n}t.prototype._parse=function(e){if(this._def.coerce){e.data=Number(e.data)}var t=this._getType(e);if(t!==r.number){var i=this._getOrReturnCtx(e);l(i,{code:a.invalid_type,expected:r.number,received:i.parsedType});return d}var s=undefined;var u=new h;for(var o=0,f=this._def.checks;o<f.length;o++){var c=f[o];if(c.kind==="int"){if(!n.isInteger(e.data)){s=this._getOrReturnCtx(e,s);l(s,{code:a.invalid_type,expected:"integer",received:"float",message:c.message});u.dirty()}}else if(c.kind==="min"){var v=c.inclusive?e.data<c.value:e.data<=c.value;if(v){s=this._getOrReturnCtx(e,s);l(s,{code:a.too_small,minimum:c.value,type:"number",inclusive:c.inclusive,exact:false,message:c.message});u.dirty()}}else if(c.kind==="max"){var _=c.inclusive?e.data>c.value:e.data>=c.value;if(_){s=this._getOrReturnCtx(e,s);l(s,{code:a.too_big,maximum:c.value,type:"number",inclusive:c.inclusive,exact:false,message:c.message});u.dirty()}}else if(c.kind==="multipleOf"){if(H(e.data,c.value)!==0){s=this._getOrReturnCtx(e,s);l(s,{code:a.not_multiple_of,multipleOf:c.value,message:c.message});u.dirty()}}else if(c.kind==="finite"){if(!Number.isFinite(e.data)){s=this._getOrReturnCtx(e,s);l(s,{code:a.not_finite,message:c.message});u.dirty()}}else{n.assertNever(c)}}return{status:u.value,value:e.data}};t.prototype.gte=function(e,n){return this.setLimit("min",e,true,x.toString(n))};t.prototype.gt=function(e,n){return this.setLimit("min",e,false,x.toString(n))};t.prototype.lte=function(e,n){return this.setLimit("max",e,true,x.toString(n))};t.prototype.lt=function(e,n){return this.setLimit("max",e,false,x.toString(n))};t.prototype.setLimit=function(e,n,r,i){return new t(__assign(__assign({},this._def),{checks:__spreadArray(__spreadArray([],this._def.checks,true),[{kind:e,value:n,inclusive:r,message:x.toString(i)}],false)}))};t.prototype._addCheck=function(e){return new t(__assign(__assign({},this._def),{checks:__spreadArray(__spreadArray([],this._def.checks,true),[e],false)}))};t.prototype.int=function(e){return this._addCheck({kind:"int",message:x.toString(e)})};t.prototype.positive=function(e){return this._addCheck({kind:"min",value:0,inclusive:false,message:x.toString(e)})};t.prototype.negative=function(e){return this._addCheck({kind:"max",value:0,inclusive:false,message:x.toString(e)})};t.prototype.nonpositive=function(e){return this._addCheck({kind:"max",value:0,inclusive:true,message:x.toString(e)})};t.prototype.nonnegative=function(e){return this._addCheck({kind:"min",value:0,inclusive:true,message:x.toString(e)})};t.prototype.multipleOf=function(e,n){return this._addCheck({kind:"multipleOf",value:e,message:x.toString(n)})};t.prototype.finite=function(e){return this._addCheck({kind:"finite",message:x.toString(e)})};t.prototype.safe=function(e){return this._addCheck({kind:"min",inclusive:true,value:Number.MIN_SAFE_INTEGER,message:x.toString(e)})._addCheck({kind:"max",inclusive:true,value:Number.MAX_SAFE_INTEGER,message:x.toString(e)})};Object.defineProperty(t.prototype,"minValue",{get:function(){var e=null;for(var n=0,t=this._def.checks;n<t.length;n++){var r=t[n];if(r.kind==="min"){if(e===null||r.value>e)e=r.value}}return e},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"maxValue",{get:function(){var e=null;for(var n=0,t=this._def.checks;n<t.length;n++){var r=t[n];if(r.kind==="max"){if(e===null||r.value<e)e=r.value}}return e},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"isInt",{get:function(){return!!this._def.checks.find((function(e){return e.kind==="int"||e.kind==="multipleOf"&&n.isInteger(e.value)}))},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"isFinite",{get:function(){var e=null,n=null;for(var t=0,r=this._def.checks;t<r.length;t++){var i=r[t];if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf"){return true}else if(i.kind==="min"){if(n===null||i.value>n)n=i.value}else if(i.kind==="max"){if(e===null||i.value<e)e=i.value}}return Number.isFinite(n)&&Number.isFinite(e)},enumerable:false,configurable:true});return t}(E);J.create=function(e){return new J(__assign({checks:[],typeName:Ie.ZodNumber,coerce:(e===null||e===void 0?void 0:e.coerce)||false},A(e)))};var Y=function(e){__extends(t,e);function t(){var n=e.apply(this,arguments)||this;n.min=n.gte;n.max=n.lte;return n}t.prototype._parse=function(e){if(this._def.coerce){e.data=BigInt(e.data)}var t=this._getType(e);if(t!==r.bigint){var i=this._getOrReturnCtx(e);l(i,{code:a.invalid_type,expected:r.bigint,received:i.parsedType});return d}var s=undefined;var u=new h;for(var o=0,f=this._def.checks;o<f.length;o++){var c=f[o];if(c.kind==="min"){var v=c.inclusive?e.data<c.value:e.data<=c.value;if(v){s=this._getOrReturnCtx(e,s);l(s,{code:a.too_small,type:"bigint",minimum:c.value,inclusive:c.inclusive,message:c.message});u.dirty()}}else if(c.kind==="max"){var _=c.inclusive?e.data>c.value:e.data>=c.value;if(_){s=this._getOrReturnCtx(e,s);l(s,{code:a.too_big,type:"bigint",maximum:c.value,inclusive:c.inclusive,message:c.message});u.dirty()}}else if(c.kind==="multipleOf"){if(e.data%c.value!==BigInt(0)){s=this._getOrReturnCtx(e,s);l(s,{code:a.not_multiple_of,multipleOf:c.value,message:c.message});u.dirty()}}else{n.assertNever(c)}}return{status:u.value,value:e.data}};t.prototype.gte=function(e,n){return this.setLimit("min",e,true,x.toString(n))};t.prototype.gt=function(e,n){return this.setLimit("min",e,false,x.toString(n))};t.prototype.lte=function(e,n){return this.setLimit("max",e,true,x.toString(n))};t.prototype.lt=function(e,n){return this.setLimit("max",e,false,x.toString(n))};t.prototype.setLimit=function(e,n,r,i){return new t(__assign(__assign({},this._def),{checks:__spreadArray(__spreadArray([],this._def.checks,true),[{kind:e,value:n,inclusive:r,message:x.toString(i)}],false)}))};t.prototype._addCheck=function(e){return new t(__assign(__assign({},this._def),{checks:__spreadArray(__spreadArray([],this._def.checks,true),[e],false)}))};t.prototype.positive=function(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:false,message:x.toString(e)})};t.prototype.negative=function(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:false,message:x.toString(e)})};t.prototype.nonpositive=function(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:true,message:x.toString(e)})};t.prototype.nonnegative=function(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:true,message:x.toString(e)})};t.prototype.multipleOf=function(e,n){return this._addCheck({kind:"multipleOf",value:e,message:x.toString(n)})};Object.defineProperty(t.prototype,"minValue",{get:function(){var e=null;for(var n=0,t=this._def.checks;n<t.length;n++){var r=t[n];if(r.kind==="min"){if(e===null||r.value>e)e=r.value}}return e},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"maxValue",{get:function(){var e=null;for(var n=0,t=this._def.checks;n<t.length;n++){var r=t[n];if(r.kind==="max"){if(e===null||r.value<e)e=r.value}}return e},enumerable:false,configurable:true});return t}(E);Y.create=function(e){var n;return new Y(__assign({checks:[],typeName:Ie.ZodBigInt,coerce:(n=e===null||e===void 0?void 0:e.coerce)!==null&&n!==void 0?n:false},A(e)))};var G=function(e){__extends(n,e);function n(){return e!==null&&e.apply(this,arguments)||this}n.prototype._parse=function(e){if(this._def.coerce){e.data=Boolean(e.data)}var n=this._getType(e);if(n!==r.boolean){var t=this._getOrReturnCtx(e);l(t,{code:a.invalid_type,expected:r.boolean,received:t.parsedType});return d}return _(e.data)};return n}(E);G.create=function(e){return new G(__assign({typeName:Ie.ZodBoolean,coerce:(e===null||e===void 0?void 0:e.coerce)||false},A(e)))};var Q=function(e){__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}t.prototype._parse=function(e){if(this._def.coerce){e.data=new Date(e.data)}var t=this._getType(e);if(t!==r.date){var i=this._getOrReturnCtx(e);l(i,{code:a.invalid_type,expected:r.date,received:i.parsedType});return d}if(isNaN(e.data.getTime())){var s=this._getOrReturnCtx(e);l(s,{code:a.invalid_date});return d}var u=new h;var o=undefined;for(var f=0,c=this._def.checks;f<c.length;f++){var v=c[f];if(v.kind==="min"){if(e.data.getTime()<v.value){o=this._getOrReturnCtx(e,o);l(o,{code:a.too_small,message:v.message,inclusive:true,exact:false,minimum:v.value,type:"date"});u.dirty()}}else if(v.kind==="max"){if(e.data.getTime()>v.value){o=this._getOrReturnCtx(e,o);l(o,{code:a.too_big,message:v.message,inclusive:true,exact:false,maximum:v.value,type:"date"});u.dirty()}}else{n.assertNever(v)}}return{status:u.value,value:new Date(e.data.getTime())}};t.prototype._addCheck=function(e){return new t(__assign(__assign({},this._def),{checks:__spreadArray(__spreadArray([],this._def.checks,true),[e],false)}))};t.prototype.min=function(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:x.toString(n)})};t.prototype.max=function(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:x.toString(n)})};Object.defineProperty(t.prototype,"minDate",{get:function(){var e=null;for(var n=0,t=this._def.checks;n<t.length;n++){var r=t[n];if(r.kind==="min"){if(e===null||r.value>e)e=r.value}}return e!=null?new Date(e):null},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"maxDate",{get:function(){var e=null;for(var n=0,t=this._def.checks;n<t.length;n++){var r=t[n];if(r.kind==="max"){if(e===null||r.value<e)e=r.value}}return e!=null?new Date(e):null},enumerable:false,configurable:true});return t}(E);Q.create=function(e){return new Q(__assign({checks:[],coerce:(e===null||e===void 0?void 0:e.coerce)||false,typeName:Ie.ZodDate},A(e)))};var X=function(e){__extends(n,e);function n(){return e!==null&&e.apply(this,arguments)||this}n.prototype._parse=function(e){var n=this._getType(e);if(n!==r.symbol){var t=this._getOrReturnCtx(e);l(t,{code:a.invalid_type,expected:r.symbol,received:t.parsedType});return d}return _(e.data)};return n}(E);X.create=function(e){return new X(__assign({typeName:Ie.ZodSymbol},A(e)))};var ee=function(e){__extends(n,e);function n(){return e!==null&&e.apply(this,arguments)||this}n.prototype._parse=function(e){var n=this._getType(e);if(n!==r.undefined){var t=this._getOrReturnCtx(e);l(t,{code:a.invalid_type,expected:r.undefined,received:t.parsedType});return d}return _(e.data)};return n}(E);ee.create=function(e){return new ee(__assign({typeName:Ie.ZodUndefined},A(e)))};var ne=function(e){__extends(n,e);function n(){return e!==null&&e.apply(this,arguments)||this}n.prototype._parse=function(e){var n=this._getType(e);if(n!==r.null){var t=this._getOrReturnCtx(e);l(t,{code:a.invalid_type,expected:r.null,received:t.parsedType});return d}return _(e.data)};return n}(E);ne.create=function(e){return new ne(__assign({typeName:Ie.ZodNull},A(e)))};var te=function(e){__extends(n,e);function n(){var n=e.apply(this,arguments)||this;n._any=true;return n}n.prototype._parse=function(e){return _(e.data)};return n}(E);te.create=function(e){return new te(__assign({typeName:Ie.ZodAny},A(e)))};var re=function(e){__extends(n,e);function n(){var n=e.apply(this,arguments)||this;n._unknown=true;return n}n.prototype._parse=function(e){return _(e.data)};return n}(E);re.create=function(e){return new re(__assign({typeName:Ie.ZodUnknown},A(e)))};var ie=function(e){__extends(n,e);function n(){return e!==null&&e.apply(this,arguments)||this}n.prototype._parse=function(e){var n=this._getOrReturnCtx(e);l(n,{code:a.invalid_type,expected:r.never,received:n.parsedType});return d};return n}(E);ie.create=function(e){return new ie(__assign({typeName:Ie.ZodNever},A(e)))};var ae=function(e){__extends(n,e);function n(){return e!==null&&e.apply(this,arguments)||this}n.prototype._parse=function(e){var n=this._getType(e);if(n!==r.undefined){var t=this._getOrReturnCtx(e);l(t,{code:a.invalid_type,expected:r.void,received:t.parsedType});return d}return _(e.data)};return n}(E);ae.create=function(e){return new ae(__assign({typeName:Ie.ZodVoid},A(e)))};var se=function(e){__extends(n,e);function n(){return e!==null&&e.apply(this,arguments)||this}n.prototype._parse=function(e){var n=this._processInputParams(e),t=n.ctx,i=n.status;var s=this._def;if(t.parsedType!==r.array){l(t,{code:a.invalid_type,expected:r.array,received:t.parsedType});return d}if(s.exactLength!==null){var u=t.data.length>s.exactLength.value;var o=t.data.length<s.exactLength.value;if(u||o){l(t,{code:u?a.too_big:a.too_small,minimum:o?s.exactLength.value:undefined,maximum:u?s.exactLength.value:undefined,type:"array",inclusive:true,exact:true,message:s.exactLength.message});i.dirty()}}if(s.minLength!==null){if(t.data.length<s.minLength.value){l(t,{code:a.too_small,minimum:s.minLength.value,type:"array",inclusive:true,exact:false,message:s.minLength.message});i.dirty()}}if(s.maxLength!==null){if(t.data.length>s.maxLength.value){l(t,{code:a.too_big,maximum:s.maxLength.value,type:"array",inclusive:true,exact:false,message:s.maxLength.message});i.dirty()}}if(t.common.async){return Promise.all(__spreadArray([],t.data,true).map((function(e,n){return s.type._parseAsync(new j(t,e,t.path,n))}))).then((function(e){return h.mergeArray(i,e)}))}var f=__spreadArray([],t.data,true).map((function(e,n){return s.type._parseSync(new j(t,e,t.path,n))}));return h.mergeArray(i,f)};Object.defineProperty(n.prototype,"element",{get:function(){return this._def.type},enumerable:false,configurable:true});n.prototype.min=function(e,t){return new n(__assign(__assign({},this._def),{minLength:{value:e,message:x.toString(t)}}))};n.prototype.max=function(e,t){return new n(__assign(__assign({},this._def),{maxLength:{value:e,message:x.toString(t)}}))};n.prototype.length=function(e,t){return new n(__assign(__assign({},this._def),{exactLength:{value:e,message:x.toString(t)}}))};n.prototype.nonempty=function(e){return this.min(1,e)};return n}(E);se.create=function(e,n){return new se(__assign({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ie.ZodArray},A(n)))};function ue(e){if(e instanceof oe){var n={};for(var t in e.shape){var r=e.shape[t];n[t]=xe.create(ue(r))}return new oe(__assign(__assign({},e._def),{shape:function(){return n}}))}else if(e instanceof se){return new se(__assign(__assign({},e._def),{type:ue(e.element)}))}else if(e instanceof xe){return xe.create(ue(e.unwrap()))}else if(e instanceof ke){return ke.create(ue(e.unwrap()))}else if(e instanceof he){return he.create(e.items.map((function(e){return ue(e)})))}else{return e}}var oe=function(e){__extends(t,e);function t(){var n=e.apply(this,arguments)||this;n._cached=null;n.nonstrict=n.passthrough;n.augment=n.extend;return n}t.prototype._getCached=function(){if(this._cached!==null)return this._cached;var e=this._def.shape();var t=n.objectKeys(e);return this._cached={shape:e,keys:t}};t.prototype._parse=function(e){var n=this;var t=this._getType(e);if(t!==r.object){var i=this._getOrReturnCtx(e);l(i,{code:a.invalid_type,expected:r.object,received:i.parsedType});return d}var s=this._processInputParams(e),u=s.status,o=s.ctx;var f=this._getCached(),c=f.shape,v=f.keys;var _=[];if(!(this._def.catchall instanceof ie&&this._def.unknownKeys==="strip")){for(var m in o.data){if(!v.includes(m)){_.push(m)}}}var g=[];for(var p=0,y=v;p<y.length;p++){var m=y[p];var b=c[m];var w=o.data[m];g.push({key:{status:"valid",value:m},value:b._parse(new j(o,w,o.path,m)),alwaysSet:m in o.data})}if(this._def.catchall instanceof ie){var x=this._def.unknownKeys;if(x==="passthrough"){for(var k=0,N=_;k<N.length;k++){var m=N[k];g.push({key:{status:"valid",value:m},value:{status:"valid",value:o.data[m]}})}}else if(x==="strict"){if(_.length>0){l(o,{code:a.unrecognized_keys,keys:_});u.dirty()}}else if(x==="strip");else{throw new Error("Internal ZodObject error: invalid unknownKeys value.")}}else{var O=this._def.catchall;for(var A=0,E=_;A<E.length;A++){var m=E[A];var w=o.data[m];g.push({key:{status:"valid",value:m},value:O._parse(new j(o,w,o.path,m)),alwaysSet:m in o.data})}}if(o.common.async){return Promise.resolve().then((function(){return __awaiter(n,void 0,void 0,(function(){var e,n,t,r,i,a;return __generator(this,(function(s){switch(s.label){case 0:e=[];n=0,t=g;s.label=1;case 1:if(!(n<t.length))return[3,5];r=t[n];return[4,r.key];case 2:i=s.sent();return[4,r.value];case 3:a=s.sent();e.push({key:i,value:a,alwaysSet:r.alwaysSet});s.label=4;case 4:n++;return[3,1];case 5:return[2,e]}}))}))})).then((function(e){return h.mergeObjectSync(u,e)}))}else{return h.mergeObjectSync(u,g)}};Object.defineProperty(t.prototype,"shape",{get:function(){return this._def.shape()},enumerable:false,configurable:true});t.prototype.strict=function(e){var n=this;return new t(__assign(__assign(__assign({},this._def),{unknownKeys:"strict"}),e!==undefined?{errorMap:function(t,r){var i,a,s,u;var o=(s=(a=(i=n._def).errorMap)===null||a===void 0?void 0:a.call(i,t,r).message)!==null&&s!==void 0?s:r.defaultError;if(t.code==="unrecognized_keys")return{message:(u=x.errToObj(e).message)!==null&&u!==void 0?u:o};return{message:o}}}:{}))};t.prototype.strip=function(){return new t(__assign(__assign({},this._def),{unknownKeys:"strip"}))};t.prototype.passthrough=function(){return new t(__assign(__assign({},this._def),{unknownKeys:"passthrough"}))};t.prototype.extend=function(e){var n=this;return new t(__assign(__assign({},this._def),{shape:function(){return __assign(__assign({},n._def.shape()),e)}}))};t.prototype.merge=function(e){var n=this;var r=new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:function(){return __assign(__assign({},n._def.shape()),e._def.shape())},typeName:Ie.ZodObject});return r};t.prototype.setKey=function(e,n){var t;return this.augment((t={},t[e]=n,t))};t.prototype.catchall=function(e){return new t(__assign(__assign({},this._def),{catchall:e}))};t.prototype.pick=function(e){var r=this;var i={};n.objectKeys(e).forEach((function(n){if(e[n]&&r.shape[n]){i[n]=r.shape[n]}}));return new t(__assign(__assign({},this._def),{shape:function(){return i}}))};t.prototype.omit=function(e){var r=this;var i={};n.objectKeys(this.shape).forEach((function(n){if(!e[n]){i[n]=r.shape[n]}}));return new t(__assign(__assign({},this._def),{shape:function(){return i}}))};t.prototype.deepPartial=function(){return ue(this)};t.prototype.partial=function(e){var r=this;var i={};n.objectKeys(this.shape).forEach((function(n){var t=r.shape[n];if(e&&!e[n]){i[n]=t}else{i[n]=t.optional()}}));return new t(__assign(__assign({},this._def),{shape:function(){return i}}))};t.prototype.required=function(e){var r=this;var i={};n.objectKeys(this.shape).forEach((function(n){if(e&&!e[n]){i[n]=r.shape[n]}else{var t=r.shape[n];var a=t;while(a instanceof xe){a=a._def.innerType}i[n]=a}}));return new t(__assign(__assign({},this._def),{shape:function(){return i}}))};t.prototype.keyof=function(){return ge(n.objectKeys(this.shape))};return t}(E);oe.create=function(e,n){return new oe(__assign({shape:function(){return e},unknownKeys:"strip",catchall:ie.create(),typeName:Ie.ZodObject},A(n)))};oe.strictCreate=function(e,n){return new oe(__assign({shape:function(){return e},unknownKeys:"strict",catchall:ie.create(),typeName:Ie.ZodObject},A(n)))};oe.lazycreate=function(e,n){return new oe(__assign({shape:e,unknownKeys:"strip",catchall:ie.create(),typeName:Ie.ZodObject},A(n)))};var fe=function(e){__extends(n,e);function n(){return e!==null&&e.apply(this,arguments)||this}n.prototype._parse=function(e){var n;var t=this;var r=this._processInputParams(e).ctx;var i=this._def.options;function u(e){var n;for(var t=0,i=e;t<i.length;t++){var u=i[t];if(u.result.status==="valid"){return u.result}}for(var o=0,f=e;o<f.length;o++){var u=f[o];if(u.result.status==="dirty"){(n=r.common.issues).push.apply(n,u.ctx.common.issues);return u.result}}var c=e.map((function(e){return new s(e.ctx.common.issues)}));l(r,{code:a.invalid_union,unionErrors:c});return d}if(r.common.async){return Promise.all(i.map((function(e){return __awaiter(t,void 0,void 0,(function(){var n;var t;return __generator(this,(function(i){switch(i.label){case 0:n=__assign(__assign({},r),{common:__assign(__assign({},r.common),{issues:[]}),parent:null});t={};return[4,e._parseAsync({data:r.data,path:r.path,parent:n})];case 1:return[2,(t.result=i.sent(),t.ctx=n,t)]}}))}))}))).then(u)}else{var o=undefined;var f=[];for(var c=0,h=i;c<h.length;c++){var v=h[c];var _=__assign(__assign({},r),{common:__assign(__assign({},r.common),{issues:[]}),parent:null});var m=v._parseSync({data:r.data,path:r.path,parent:_});if(m.status==="valid"){return m}else if(m.status==="dirty"&&!o){o={result:m,ctx:_}}if(_.common.issues.length){f.push(_.common.issues)}}if(o){(n=r.common.issues).push.apply(n,o.ctx.common.issues);return o.result}var g=f.map((function(e){return new s(e)}));l(r,{code:a.invalid_union,unionErrors:g});return d}};Object.defineProperty(n.prototype,"options",{get:function(){return this._def.options},enumerable:false,configurable:true});return n}(E);fe.create=function(e,n){return new fe(__assign({options:e,typeName:Ie.ZodUnion},A(n)))};function ce(e,t){var a=i(e);var s=i(t);if(e===t){return{valid:true,data:e}}else if(a===r.object&&s===r.object){var u=n.objectKeys(t);var o=n.objectKeys(e).filter((function(e){return u.indexOf(e)!==-1}));var f=__assign(__assign({},e),t);for(var c=0,l=o;c<l.length;c++){var h=l[c];var d=ce(e[h],t[h]);if(!d.valid){return{valid:false}}f[h]=d.data}return{valid:true,data:f}}else if(a===r.array&&s===r.array){if(e.length!==t.length){return{valid:false}}var v=[];for(var _=0;_<e.length;_++){var m=e[_];var g=t[_];var d=ce(m,g);if(!d.valid){return{valid:false}}v.push(d.data)}return{valid:true,data:v}}else if(a===r.date&&s===r.date&&+e===+t){return{valid:true,data:e}}else{return{valid:false}}}var le=function(e){__extends(n,e);function n(){return e!==null&&e.apply(this,arguments)||this}n.prototype._parse=function(e){var n=this._processInputParams(e),t=n.status,r=n.ctx;var i=function(e,n){if(m(e)||m(n)){return d}var i=ce(e.value,n.value);if(!i.valid){l(r,{code:a.invalid_intersection_types});return d}if(g(e)||g(n)){t.dirty()}return{status:t.value,value:i.data}};if(r.common.async){return Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then((function(e){var n=e[0],t=e[1];return i(n,t)}))}else{return i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};return n}(E);le.create=function(e,n,t){return new le(__assign({left:e,right:n,typeName:Ie.ZodIntersection},A(t)))};var he=function(e){__extends(n,e);function n(){return e!==null&&e.apply(this,arguments)||this}n.prototype._parse=function(e){var n=this;var t=this._processInputParams(e),i=t.status,s=t.ctx;if(s.parsedType!==r.array){l(s,{code:a.invalid_type,expected:r.array,received:s.parsedType});return d}if(s.data.length<this._def.items.length){l(s,{code:a.too_small,minimum:this._def.items.length,inclusive:true,exact:false,type:"array"});return d}var u=this._def.rest;if(!u&&s.data.length>this._def.items.length){l(s,{code:a.too_big,maximum:this._def.items.length,inclusive:true,exact:false,type:"array"});i.dirty()}var o=__spreadArray([],s.data,true).map((function(e,t){var r=n._def.items[t]||n._def.rest;if(!r)return null;return r._parse(new j(s,e,s.path,t))})).filter((function(e){return!!e}));if(s.common.async){return Promise.all(o).then((function(e){return h.mergeArray(i,e)}))}else{return h.mergeArray(i,o)}};Object.defineProperty(n.prototype,"items",{get:function(){return this._def.items},enumerable:false,configurable:true});n.prototype.rest=function(e){return new n(__assign(__assign({},this._def),{rest:e}))};return n}(E);he.create=function(e,n){if(!Array.isArray(e)){throw new Error("You must pass an array of schemas to z.tuple([ ... ])")}return new he(__assign({items:e,typeName:Ie.ZodTuple,rest:null},A(n)))};var de=function(e){__extends(n,e);function n(){return e!==null&&e.apply(this,arguments)||this}Object.defineProperty(n.prototype,"keySchema",{get:function(){return this._def.keyType},enumerable:false,configurable:true});Object.defineProperty(n.prototype,"valueSchema",{get:function(){return this._def.valueType},enumerable:false,configurable:true});n.prototype._parse=function(e){var n=this;var t=this._processInputParams(e),i=t.status,s=t.ctx;if(s.parsedType!==r.map){l(s,{code:a.invalid_type,expected:r.map,received:s.parsedType});return d}var u=this._def.keyType;var o=this._def.valueType;var f=__spreadArray([],s.data.entries(),true).map((function(e,n){var t=e[0],r=e[1];return{key:u._parse(new j(s,t,s.path,[n,"key"])),value:o._parse(new j(s,r,s.path,[n,"value"]))}}));if(s.common.async){var c=new Map;return Promise.resolve().then((function(){return __awaiter(n,void 0,void 0,(function(){var e,n,t,r,a;return __generator(this,(function(s){switch(s.label){case 0:e=0,n=f;s.label=1;case 1:if(!(e<n.length))return[3,5];t=n[e];return[4,t.key];case 2:r=s.sent();return[4,t.value];case 3:a=s.sent();if(r.status==="aborted"||a.status==="aborted"){return[2,d]}if(r.status==="dirty"||a.status==="dirty"){i.dirty()}c.set(r.value,a.value);s.label=4;case 4:e++;return[3,1];case 5:return[2,{status:i.value,value:c}]}}))}))}))}else{var h=new Map;for(var v=0,_=f;v<_.length;v++){var m=_[v];var g=m.key;var p=m.value;if(g.status==="aborted"||p.status==="aborted"){return d}if(g.status==="dirty"||p.status==="dirty"){i.dirty()}h.set(g.value,p.value)}return{status:i.value,value:h}}};return n}(E);de.create=function(e,n,t){return new de(__assign({valueType:n,keyType:e,typeName:Ie.ZodMap},A(t)))};var ve=function(e){__extends(n,e);function n(){return e!==null&&e.apply(this,arguments)||this}n.prototype._parse=function(e){var n=this._processInputParams(e),t=n.status,i=n.ctx;if(i.parsedType!==r.set){l(i,{code:a.invalid_type,expected:r.set,received:i.parsedType});return d}var s=this._def;if(s.minSize!==null){if(i.data.size<s.minSize.value){l(i,{code:a.too_small,minimum:s.minSize.value,type:"set",inclusive:true,exact:false,message:s.minSize.message});t.dirty()}}if(s.maxSize!==null){if(i.data.size>s.maxSize.value){l(i,{code:a.too_big,maximum:s.maxSize.value,type:"set",inclusive:true,exact:false,message:s.maxSize.message});t.dirty()}}var u=this._def.valueType;function o(e){var n=new Set;for(var r=0,i=e;r<i.length;r++){var a=i[r];if(a.status==="aborted")return d;if(a.status==="dirty")t.dirty();n.add(a.value)}return{status:t.value,value:n}}var f=__spreadArray([],i.data.values(),true).map((function(e,n){return u._parse(new j(i,e,i.path,n))}));if(i.common.async){return Promise.all(f).then((function(e){return o(e)}))}else{return o(f)}};n.prototype.min=function(e,t){return new n(__assign(__assign({},this._def),{minSize:{value:e,message:x.toString(t)}}))};n.prototype.max=function(e,t){return new n(__assign(__assign({},this._def),{maxSize:{value:e,message:x.toString(t)}}))};n.prototype.size=function(e,n){return this.min(e,n).max(e,n)};n.prototype.nonempty=function(e){return this.min(1,e)};return n}(E);ve.create=function(e,n){return new ve(__assign({valueType:e,minSize:null,maxSize:null,typeName:Ie.ZodSet},A(n)))};var _e=function(e){__extends(n,e);function n(){return e!==null&&e.apply(this,arguments)||this}Object.defineProperty(n.prototype,"schema",{get:function(){return this._def.getter()},enumerable:false,configurable:true});n.prototype._parse=function(e){var n=this._processInputParams(e).ctx;var t=this._def.getter();return t._parse({data:n.data,path:n.path,parent:n})};return n}(E);_e.create=function(e,n){return new _e(__assign({getter:e,typeName:Ie.ZodLazy},A(n)))};var me=function(e){__extends(n,e);function n(){return e!==null&&e.apply(this,arguments)||this}n.prototype._parse=function(e){if(e.data!==this._def.value){var n=this._getOrReturnCtx(e);l(n,{received:n.data,code:a.invalid_literal,expected:this._def.value});return d}return{status:"valid",value:e.data}};Object.defineProperty(n.prototype,"value",{get:function(){return this._def.value},enumerable:false,configurable:true});return n}(E);me.create=function(e,n){return new me(__assign({value:e,typeName:Ie.ZodLiteral},A(n)))};function ge(e,n){return new pe(__assign({values:e,typeName:Ie.ZodEnum},A(n)))}var pe=function(e){__extends(t,e);function t(){var n=e.apply(this,arguments)||this;k.set(n,void 0);return n}t.prototype._parse=function(e){if(typeof e.data!=="string"){var t=this._getOrReturnCtx(e);var r=this._def.values;l(t,{expected:n.joinValues(r),received:t.parsedType,code:a.invalid_type});return d}if(!b(this,k,"f")){w(this,k,new Set(this._def.values),"f")}if(!b(this,k,"f").has(e.data)){var t=this._getOrReturnCtx(e);var r=this._def.values;l(t,{received:t.data,code:a.invalid_enum_value,options:r});return d}return _(e.data)};Object.defineProperty(t.prototype,"options",{get:function(){return this._def.values},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"enum",{get:function(){var e={};for(var n=0,t=this._def.values;n<t.length;n++){var r=t[n];e[r]=r}return e},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"Values",{get:function(){var e={};for(var n=0,t=this._def.values;n<t.length;n++){var r=t[n];e[r]=r}return e},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"Enum",{get:function(){var e={};for(var n=0,t=this._def.values;n<t.length;n++){var r=t[n];e[r]=r}return e},enumerable:false,configurable:true});t.prototype.extract=function(e,n){if(n===void 0){n=this._def}return t.create(e,__assign(__assign({},this._def),n))};t.prototype.exclude=function(e,n){if(n===void 0){n=this._def}return t.create(this.options.filter((function(n){return!e.includes(n)})),__assign(__assign({},this._def),n))};return t}(E);k=new WeakMap;pe.create=ge;var ye=function(e){__extends(t,e);function t(){var n=e.apply(this,arguments)||this;N.set(n,void 0);return n}t.prototype._parse=function(e){var t=n.getValidEnumValues(this._def.values);var i=this._getOrReturnCtx(e);if(i.parsedType!==r.string&&i.parsedType!==r.number){var s=n.objectValues(t);l(i,{expected:n.joinValues(s),received:i.parsedType,code:a.invalid_type});return d}if(!b(this,N,"f")){w(this,N,new Set(n.getValidEnumValues(this._def.values)),"f")}if(!b(this,N,"f").has(e.data)){var s=n.objectValues(t);l(i,{received:i.data,code:a.invalid_enum_value,options:s});return d}return _(e.data)};Object.defineProperty(t.prototype,"enum",{get:function(){return this._def.values},enumerable:false,configurable:true});return t}(E);N=new WeakMap;ye.create=function(e,n){return new ye(__assign({values:e,typeName:Ie.ZodNativeEnum},A(n)))};var be=function(e){__extends(n,e);function n(){return e!==null&&e.apply(this,arguments)||this}n.prototype.unwrap=function(){return this._def.type};n.prototype._parse=function(e){var n=this;var t=this._processInputParams(e).ctx;if(t.parsedType!==r.promise&&t.common.async===false){l(t,{code:a.invalid_type,expected:r.promise,received:t.parsedType});return d}var i=t.parsedType===r.promise?t.data:Promise.resolve(t.data);return _(i.then((function(e){return n._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})})))};return n}(E);be.create=function(e,n){return new be(__assign({type:e,typeName:Ie.ZodPromise},A(n)))};var we=function(e){__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}t.prototype.innerType=function(){return this._def.schema};t.prototype.sourceType=function(){return this._def.schema._def.typeName===Ie.ZodEffects?this._def.schema.sourceType():this._def.schema};t.prototype._parse=function(e){var t=this;var r=this._processInputParams(e),i=r.status,a=r.ctx;var s=this._def.effect||null;var u={addIssue:function(e){l(a,e);if(e.fatal){i.abort()}else{i.dirty()}},get path(){return a.path}};u.addIssue=u.addIssue.bind(u);if(s.type==="preprocess"){var o=s.transform(a.data,u);if(a.common.async){return Promise.resolve(o).then((function(e){return __awaiter(t,void 0,void 0,(function(){var n;return __generator(this,(function(t){switch(t.label){case 0:if(i.value==="aborted")return[2,d];return[4,this._def.schema._parseAsync({data:e,path:a.path,parent:a})];case 1:n=t.sent();if(n.status==="aborted")return[2,d];if(n.status==="dirty")return[2,v(n.value)];if(i.value==="dirty")return[2,v(n.value)];return[2,n]}}))}))}))}else{if(i.value==="aborted")return d;var f=this._def.schema._parseSync({data:o,path:a.path,parent:a});if(f.status==="aborted")return d;if(f.status==="dirty")return v(f.value);if(i.value==="dirty")return v(f.value);return f}}if(s.type==="refinement"){var c=function(e){var n=s.refinement(e,u);if(a.common.async){return Promise.resolve(n)}if(n instanceof Promise){throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.")}return e};if(a.common.async===false){var h=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(h.status==="aborted")return d;if(h.status==="dirty")i.dirty();c(h.value);return{status:i.value,value:h.value}}else{return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then((function(e){if(e.status==="aborted")return d;if(e.status==="dirty")i.dirty();return c(e.value).then((function(){return{status:i.value,value:e.value}}))}))}}if(s.type==="transform"){if(a.common.async===false){var _=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!p(_))return _;var f=s.transform(_.value,u);if(f instanceof Promise){throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.")}return{status:i.value,value:f}}else{return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then((function(e){if(!p(e))return e;return Promise.resolve(s.transform(e.value,u)).then((function(e){return{status:i.value,value:e}}))}))}}n.assertNever(s)};return t}(E);we.create=function(e,n,t){return new we(__assign({schema:e,typeName:Ie.ZodEffects,effect:n},A(t)))};we.createWithPreprocess=function(e,n,t){return new we(__assign({schema:n,effect:{type:"preprocess",transform:e},typeName:Ie.ZodEffects},A(t)))};var xe=function(e){__extends(n,e);function n(){return e!==null&&e.apply(this,arguments)||this}n.prototype._parse=function(e){var n=this._getType(e);if(n===r.undefined){return _(undefined)}return this._def.innerType._parse(e)};n.prototype.unwrap=function(){return this._def.innerType};return n}(E);xe.create=function(e,n){return new xe(__assign({innerType:e,typeName:Ie.ZodOptional},A(n)))};var ke=function(e){__extends(n,e);function n(){return e!==null&&e.apply(this,arguments)||this}n.prototype._parse=function(e){var n=this._getType(e);if(n===r.null){return _(null)}return this._def.innerType._parse(e)};n.prototype.unwrap=function(){return this._def.innerType};return n}(E);ke.create=function(e,n){return new ke(__assign({innerType:e,typeName:Ie.ZodNullable},A(n)))};var Ne=function(e){__extends(n,e);function n(){return e!==null&&e.apply(this,arguments)||this}n.prototype._parse=function(e){var n=this._processInputParams(e).ctx;var t=n.data;if(n.parsedType===r.undefined){t=this._def.defaultValue()}return this._def.innerType._parse({data:t,path:n.path,parent:n})};n.prototype.removeDefault=function(){return this._def.innerType};return n}(E);Ne.create=function(e,n){return new Ne(__assign({innerType:e,typeName:Ie.ZodDefault,defaultValue:typeof n.default==="function"?n.default:function(){return n.default}},A(n)))};var je=function(e){__extends(n,e);function n(){return e!==null&&e.apply(this,arguments)||this}n.prototype._parse=function(e){var n=this;var t=this._processInputParams(e).ctx;var r=__assign(__assign({},t),{common:__assign(__assign({},t.common),{issues:[]})});var i=this._def.innerType._parse({data:r.data,path:r.path,parent:__assign({},r)});if(y(i)){return i.then((function(e){return{status:"valid",value:e.status==="valid"?e.value:n._def.catchValue({get error(){return new s(r.common.issues)},input:r.data})}}))}else{return{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new s(r.common.issues)},input:r.data})}}};n.prototype.removeCatch=function(){return this._def.innerType};return n}(E);je.create=function(e,n){return new je(__assign({innerType:e,typeName:Ie.ZodCatch,catchValue:typeof n.catch==="function"?n.catch:function(){return n.catch}},A(n)))};var Oe=function(e){__extends(n,e);function n(){return e!==null&&e.apply(this,arguments)||this}n.prototype._parse=function(e){var n=this._getType(e);if(n!==r.nan){var t=this._getOrReturnCtx(e);l(t,{code:a.invalid_type,expected:r.nan,received:t.parsedType});return d}return{status:"valid",value:e.data}};return n}(E);Oe.create=function(e){return new Oe(__assign({typeName:Ie.ZodNaN},A(e)))};var Ae=function(e){__extends(n,e);function n(){return e!==null&&e.apply(this,arguments)||this}n.prototype._parse=function(e){var n=this._processInputParams(e).ctx;var t=n.data;return this._def.type._parse({data:t,path:n.path,parent:n})};n.prototype.unwrap=function(){return this._def.type};return n}(E);var Ee=function(e){__extends(n,e);function n(){return e!==null&&e.apply(this,arguments)||this}n.prototype._parse=function(e){var n=this;var t=this._processInputParams(e),r=t.status,i=t.ctx;if(i.common.async){var a=function(){return __awaiter(n,void 0,void 0,(function(){var e;return __generator(this,(function(n){switch(n.label){case 0:return[4,this._def.in._parseAsync({data:i.data,path:i.path,parent:i})];case 1:e=n.sent();if(e.status==="aborted")return[2,d];if(e.status==="dirty"){r.dirty();return[2,v(e.value)]}else{return[2,this._def.out._parseAsync({data:e.value,path:i.path,parent:i})]}return[2]}}))}))};return a()}else{var s=this._def.in._parseSync({data:i.data,path:i.path,parent:i});if(s.status==="aborted")return d;if(s.status==="dirty"){r.dirty();return{status:"dirty",value:s.value}}else{return this._def.out._parseSync({data:s.value,path:i.path,parent:i})}}};n.create=function(e,t){return new n({in:e,out:t,typeName:Ie.ZodPipeline})};return n}(E);var Ze=function(e){__extends(n,e);function n(){return e!==null&&e.apply(this,arguments)||this}n.prototype._parse=function(e){var n=this._def.innerType._parse(e);var t=function(e){if(p(e)){e.value=Object.freeze(e.value)}return e};return y(n)?n.then((function(e){return t(e)})):t(n)};n.prototype.unwrap=function(){return this._def.innerType};return n}(E);Ze.create=function(e,n){return new Ze(__assign({innerType:e,typeName:Ie.ZodReadonly},A(n)))};var Ie;(function(e){e["ZodString"]="ZodString";e["ZodNumber"]="ZodNumber";e["ZodNaN"]="ZodNaN";e["ZodBigInt"]="ZodBigInt";e["ZodBoolean"]="ZodBoolean";e["ZodDate"]="ZodDate";e["ZodSymbol"]="ZodSymbol";e["ZodUndefined"]="ZodUndefined";e["ZodNull"]="ZodNull";e["ZodAny"]="ZodAny";e["ZodUnknown"]="ZodUnknown";e["ZodNever"]="ZodNever";e["ZodVoid"]="ZodVoid";e["ZodArray"]="ZodArray";e["ZodObject"]="ZodObject";e["ZodUnion"]="ZodUnion";e["ZodDiscriminatedUnion"]="ZodDiscriminatedUnion";e["ZodIntersection"]="ZodIntersection";e["ZodTuple"]="ZodTuple";e["ZodRecord"]="ZodRecord";e["ZodMap"]="ZodMap";e["ZodSet"]="ZodSet";e["ZodFunction"]="ZodFunction";e["ZodLazy"]="ZodLazy";e["ZodLiteral"]="ZodLiteral";e["ZodEnum"]="ZodEnum";e["ZodEffects"]="ZodEffects";e["ZodNativeEnum"]="ZodNativeEnum";e["ZodOptional"]="ZodOptional";e["ZodNullable"]="ZodNullable";e["ZodDefault"]="ZodDefault";e["ZodCatch"]="ZodCatch";e["ZodPromise"]="ZodPromise";e["ZodBranded"]="ZodBranded";e["ZodPipeline"]="ZodPipeline";e["ZodReadonly"]="ZodReadonly"})(Ie||(Ie={}));var Se=e("u",ee.create)}}}));