@creaditor/web-starterkit 1.0.4 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/dist/1260.creaditor.bundle.js +260 -128
  2. package/dist/1260.creaditor.bundle.js.gz +0 -0
  3. package/dist/1271.creaditor.bundle.js +1 -1
  4. package/dist/1271.creaditor.bundle.js.gz +0 -0
  5. package/dist/1529.creaditor.bundle.js +1 -1
  6. package/dist/1529.creaditor.bundle.js.gz +0 -0
  7. package/dist/1565.creaditor.bundle.js +237 -73
  8. package/dist/1565.creaditor.bundle.js.gz +0 -0
  9. package/dist/170.creaditor.bundle.js +11 -5
  10. package/dist/170.creaditor.bundle.js.gz +0 -0
  11. package/dist/2384.creaditor.bundle.js +33 -17
  12. package/dist/2384.creaditor.bundle.js.gz +0 -0
  13. package/dist/2590.creaditor.bundle.js +1 -2
  14. package/dist/2590.creaditor.bundle.js.gz +0 -0
  15. package/dist/3095.creaditor.bundle.js +91 -58
  16. package/dist/3095.creaditor.bundle.js.gz +0 -0
  17. package/dist/3521.creaditor.bundle.js +11 -9
  18. package/dist/3521.creaditor.bundle.js.gz +0 -0
  19. package/dist/3553.creaditor.bundle.js +1 -1
  20. package/dist/3553.creaditor.bundle.js.gz +0 -0
  21. package/dist/3932.creaditor.bundle.js +3 -3
  22. package/dist/3932.creaditor.bundle.js.gz +0 -0
  23. package/dist/4114.creaditor.bundle.js +1 -0
  24. package/dist/4114.creaditor.bundle.js.gz +0 -0
  25. package/dist/453.creaditor.bundle.js +1 -1
  26. package/dist/453.creaditor.bundle.js.gz +0 -0
  27. package/dist/4569.creaditor.bundle.js +141 -108
  28. package/dist/4569.creaditor.bundle.js.gz +0 -0
  29. package/dist/4819.creaditor.bundle.js +198 -235
  30. package/dist/4819.creaditor.bundle.js.gz +0 -0
  31. package/dist/5119.creaditor.bundle.js +1 -1
  32. package/dist/5119.creaditor.bundle.js.gz +0 -0
  33. package/dist/5340.creaditor.bundle.js +125 -36
  34. package/dist/5340.creaditor.bundle.js.gz +0 -0
  35. package/dist/5926.creaditor.bundle.js +24 -31
  36. package/dist/5926.creaditor.bundle.js.gz +0 -0
  37. package/dist/6713.creaditor.bundle.js +151 -0
  38. package/dist/6713.creaditor.bundle.js.gz +0 -0
  39. package/dist/6937.creaditor.bundle.js +1 -0
  40. package/dist/6937.creaditor.bundle.js.gz +0 -0
  41. package/dist/7209.creaditor.bundle.js +2 -3
  42. package/dist/7209.creaditor.bundle.js.gz +0 -0
  43. package/dist/7238.creaditor.bundle.js +3 -3
  44. package/dist/7238.creaditor.bundle.js.gz +0 -0
  45. package/dist/752.creaditor.bundle.js +3 -7
  46. package/dist/752.creaditor.bundle.js.gz +0 -0
  47. package/dist/7937.creaditor.bundle.js +63 -115
  48. package/dist/7937.creaditor.bundle.js.gz +0 -0
  49. package/dist/8196.creaditor.bundle.js +51 -0
  50. package/dist/8196.creaditor.bundle.js.gz +0 -0
  51. package/dist/8305.creaditor.bundle.js +6 -6
  52. package/dist/8305.creaditor.bundle.js.gz +0 -0
  53. package/dist/8478.creaditor.bundle.js +1 -0
  54. package/dist/8478.creaditor.bundle.js.gz +0 -0
  55. package/dist/8516.creaditor.bundle.js +1 -1
  56. package/dist/8516.creaditor.bundle.js.gz +0 -0
  57. package/dist/8676.creaditor.bundle.js +1 -0
  58. package/dist/8676.creaditor.bundle.js.gz +0 -0
  59. package/dist/8916.creaditor.bundle.js +4 -4
  60. package/dist/8916.creaditor.bundle.js.gz +0 -0
  61. package/dist/9041.creaditor.bundle.js +1 -1
  62. package/dist/9041.creaditor.bundle.js.gz +0 -0
  63. package/dist/9162.creaditor.bundle.js +4 -3
  64. package/dist/9162.creaditor.bundle.js.gz +0 -0
  65. package/dist/9694.creaditor.bundle.js +1 -1
  66. package/dist/9694.creaditor.bundle.js.gz +0 -0
  67. package/dist/creaditor.bundle.js +1683 -558
  68. package/dist/creaditor.bundle.js.gz +0 -0
  69. package/dist/service-worker.js +1 -1
  70. package/dist/service-worker.js.gz +0 -0
  71. package/package.json +1 -1
@@ -1,17 +1,18 @@
1
- "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[380,3095,4569],{73095(t,e,i){i.r(e),i.d(e,{default:()=>n});var s=i(59929),o=i(21421),r=i(69600);class n extends s.WF{constructor(){super(),this.contentRef=(0,o._)(),this.toggle=this.toggle.bind(this),this.onEnter=this.onEnter.bind(this),this.onKeydown=this.onKeydown.bind(this),this.overflow=!0,this.maxHeight=300,this.left=0,this.top=0,this.custom=!1,this.opened=!1}close(){this.toggle()}onBouncing(t){this.searchText=t.target.value;const e=new UIEvent("search",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(e)}render(){return s.qy`
1
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[380,3095,4569],{73095(t,e,i){i.r(e),i.d(e,{default:()=>n});var o=i(59929),s=i(21421),r=i(69600);class n extends o.WF{constructor(){super(),this.contentRef=(0,s._)(),this.toggle=this.toggle.bind(this),this.onEnter=this.onEnter.bind(this),this.onKeydown=this.onKeydown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.overflow=!0,this.maxHeight=300,this.left=0,this.top=0,this.custom=!1,this.opened=!1}close(){this.toggle()}onBouncing(t){this.searchText=t.target.value;const e=new UIEvent("search",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(e)}render(){return o.qy`
2
2
  <slot @click=${()=>this.toggle()} tabindex="0" name="trigger"></slot>
3
- ${this.opened?s.qy` <div
3
+ ${this.opened?o.qy` <div
4
4
  @mouseup=${this.onClickOutside}
5
+ @mousemove=${this.onPointerMove}
5
6
  class="backdrop"
6
7
  style="z-index:${(0,r.A)()};"
7
8
  >
8
9
  <div
9
- ${(0,o.K)(this.contentRef)}
10
+ ${(0,s.K)(this.contentRef)}
10
11
  @mouseup=${this.preventClosing}
11
12
  style="z-index:${(0,r.A)()};left:${this.left}px;top:${this.top}px;"
12
13
  class="dropdown-content fade-in ${this.custom?"":"dropdown-background"}"
13
14
  >
14
- ${this.search?s.qy`<cdtr-input
15
+ ${this.search?o.qy`<cdtr-input
15
16
  @input=${this.onBouncing}
16
17
  type="search"
17
18
  value=${this.searchText}
@@ -19,7 +20,7 @@
19
20
  <slot name="content"></slot>
20
21
  </div>
21
22
  </div>`:null}
22
- `}preventClosing(t){return t.stopPropagation(),setTimeout(()=>{this.calcRects()},0),!1}onClickOutside(){this.toggle(!1)}updated(){this.opened&&(setTimeout(()=>{this.calcRects()},0),this.contentRef.value?.classList.add("fade-in"),this.contentRef.value.style.maxHeight=`${this.maxHeight}px`)}calcRects(){let t=0,e=0;const i=this.getBoundingClientRect(),s=this.contentRef?.value?.getBoundingClientRect();s&&(t=i.left,e=i.top,t<0&&(t=0),e<0&&(e=0),t+s.width>window.innerWidth&&(t=window.innerWidth-s.width),e+s.height>window.innerHeight&&(e=window.innerHeight-s.height),this.left=t,this.top=e,this.contentRef.value.style.left=`${i.left}px`,this.contentRef.value.style.top=`${e+i.height}px`,this.contentRef.value.style.overflow=this.overflow?"hidden auto":"hidden")}toggle(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const e=t||!this.opened;e?(window.removeEventListener("keydown",this.onKeydown),window.addEventListener("keydown",this.onKeydown),this.opened=e,setTimeout(()=>{const t=this.focusedItem=this.querySelector("cdtr-dropdown-item[focused]")||this.querySelector("cdtr-dropdown-item");t&&t.focus()},20)):(window.removeEventListener("keydown",this.onKeydown),this.contentRef.value?.classList.add("fade-out"),setTimeout(()=>{this.opened=e},150)),this.setAttribute("aria-expanded",e)}onEnter(t){t.target===this&&13===t.keyCode&&this.toggle()}onKeydown(t){this.focusedItem&&40===t.keyCode&&this.focusedItem.nextElementSibling&&"CDTR-DROPDOWN-ITEM"===this.focusedItem.nextElementSibling.nodeName?(this.focusedItem=this.focusedItem.nextElementSibling,this.focusedItem&&this.focusedItem.focus()):this.focusedItem&&38===t.keyCode&&this.focusedItem.previousElementSibling&&"CDTR-DROPDOWN-ITEM"===this.focusedItem.previousElementSibling.nodeName?(this.focusedItem=this.focusedItem.previousElementSibling,this.focusedItem&&this.focusedItem.focus()):27===t.keyCode&&this.toggle();const e=new UIEvent("keypress",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(e)}connectedCallback(){super.connectedCallback(),this.setAttribute("role","button"),this.setAttribute("tabindex","0"),this.setAttribute("aria-disabled","false"),this.setAttribute("aria-haspopup","true"),this.setAttribute("aria-expanded",this.opened),this.addEventListener("keydown",this.onEnter),setTimeout(()=>{this.opened&&this.toggle(!0)},50)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("keydown",this.onKeydown)}patch(t){this.value=t,this.toggle(!1);const e=new UIEvent("change",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(e),setTimeout(()=>{this.focus()},0)}}n.styles=s.AH`
23
+ `}preventClosing(t){return t.stopPropagation(),setTimeout(()=>{this.calcRects()},0),!1}onClickOutside(){this.toggle(!1)}updated(){this.opened&&(setTimeout(()=>{this.calcRects()},0),this.contentRef.value?.classList.add("fade-in"),this.contentRef.value.style.maxHeight=`${this.maxHeight}px`)}calcRects(){let t=0,e=0;const i=this.getBoundingClientRect(),o=this.contentRef?.value?.getBoundingClientRect();o&&(t=i.left,e=i.top,t<0&&(t=0),e<0&&(e=0),t+o.width>window.innerWidth&&(t=window.innerWidth-o.width),e+o.height>window.innerHeight&&(e=window.innerHeight-o.height),this.left=t,this.top=e,this.contentRef.value.style.left=`${i.left}px`,this.contentRef.value.style.top=`${e+i.height}px`,this.contentRef.value.style.overflow=this.overflow?"hidden auto":"hidden")}toggle(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const e=t||!this.opened;e?(window.removeEventListener("keydown",this.onKeydown),window.addEventListener("keydown",this.onKeydown),this.style.removeProperty("--cdtr-item-hover"),this.opened=e,setTimeout(()=>{const t=this.focusedItem=this.querySelector("cdtr-dropdown-item[focused]")||this.querySelector("cdtr-dropdown-item");t&&t.focus()},20)):(window.removeEventListener("keydown",this.onKeydown),this.contentRef.value?.classList.add("fade-out"),setTimeout(()=>{this.opened=e},150)),this.setAttribute("aria-expanded",e)}onEnter(t){t.target===this&&13===t.keyCode&&this.toggle()}onPointerMove(){this.style.removeProperty("--cdtr-item-hover")}onKeydown(t){40!==t.keyCode&&38!==t.keyCode||this.style.setProperty("--cdtr-item-hover","transparent"),this.focusedItem&&40===t.keyCode&&this.focusedItem.nextElementSibling&&"CDTR-DROPDOWN-ITEM"===this.focusedItem.nextElementSibling.nodeName?(this.focusedItem=this.focusedItem.nextElementSibling,this.focusedItem&&this.focusedItem.focus()):this.focusedItem&&38===t.keyCode&&this.focusedItem.previousElementSibling&&"CDTR-DROPDOWN-ITEM"===this.focusedItem.previousElementSibling.nodeName?(this.focusedItem=this.focusedItem.previousElementSibling,this.focusedItem&&this.focusedItem.focus()):27===t.keyCode&&this.toggle();const e=new UIEvent("keypress",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(e)}connectedCallback(){super.connectedCallback(),this.setAttribute("role","button"),this.setAttribute("tabindex","0"),this.setAttribute("aria-disabled","false"),this.setAttribute("aria-haspopup","true"),this.setAttribute("aria-expanded",this.opened),this.addEventListener("keydown",this.onEnter),setTimeout(()=>{this.opened&&this.toggle(!0)},50)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("keydown",this.onKeydown)}patch(t){this.value=t,this.toggle(!1);const e=new UIEvent("change",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(e),setTimeout(()=>{this.focus()},0)}}n.styles=o.AH`
23
24
  :host {
24
25
  display: inline-block;
25
26
  overflow: hidden;
@@ -35,33 +36,38 @@
35
36
  background: transparent;
36
37
  overflow: hidden;
37
38
  }
39
+ /* padding lives here so custom content stays flush against the panel */
38
40
  .dropdown-background {
39
41
  background: #fff;
42
+ padding: 4px;
40
43
  }
41
44
  .dropdown-content {
42
45
  box-sizing: border-box;
43
- min-width: 50px;
44
- min-height: 50;
46
+ min-width: 180px;
47
+ min-height: 40px;
45
48
  position: fixed;
46
- border-radius: 0.25rem;
47
- /* padding: 3px; */
48
- box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
49
- transition: box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
49
+ border-radius: 10px;
50
+ border: 1px solid #eceef1;
51
+ /* layered depth: a tight ambient edge + a soft key shadow */
52
+ box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06),
53
+ 0 8px 24px -6px rgba(16, 24, 40, 0.16);
54
+ transition: box-shadow 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
50
55
  }
51
56
  .fade-in {
52
- animation: fade-in 0.3s;
57
+ animation: fade-in 180ms cubic-bezier(0.16, 1, 0.3, 1) both;
53
58
  }
54
59
  .fade-out {
55
- animation: fade-out 0.3s;
60
+ animation: fade-out 140ms ease both;
56
61
  opacity: 0;
57
62
  }
58
63
  @keyframes fade-in {
59
64
  from {
60
65
  opacity: 0;
61
- margin-top: 5px;
66
+ transform: translateY(-6px) scale(0.98);
62
67
  }
63
68
  to {
64
69
  opacity: 1;
70
+ transform: none;
65
71
  }
66
72
  }
67
73
  @keyframes fade-out {
@@ -69,42 +75,55 @@
69
75
  opacity: 1;
70
76
  }
71
77
  to {
72
- margin-top: 5px;
73
78
  opacity: 0;
79
+ transform: translateY(-4px);
80
+ }
81
+ }
82
+ @media (prefers-reduced-motion: reduce) {
83
+ .fade-in,
84
+ .fade-out {
85
+ animation-duration: 1ms;
86
+ transform: none;
74
87
  }
75
88
  }
76
- `,n.properties={search:{type:Boolean},searchText:{type:String},left:{type:Number},top:{type:Number},opened:{type:Boolean},maxHeight:{type:Number},overflow:{type:Boolean},value:{type:String},custom:{type:String}};class a extends s.WF{constructor(){super(),this.minWidth=50}render(){return s.qy`<paper-button style="min-width:${this.minWidth}px"
89
+ `,n.properties={search:{type:Boolean},searchText:{type:String},left:{type:Number},top:{type:Number},opened:{type:Boolean},maxHeight:{type:Number},overflow:{type:Boolean},value:{type:String},custom:{type:String}};class a extends o.WF{constructor(){super(),this.minWidth=50}render(){return o.qy`<paper-button style="min-width:${this.minWidth}px"
77
90
  ><slot></slot> <cdtr-dd-arrow-icon></cdtr-dd-arrow-icon
78
- ></paper-button>`}}a.properties={minWidth:{type:Number}},a.styles=s.AH`
91
+ ></paper-button>`}}a.properties={minWidth:{type:Number}},a.styles=o.AH`
79
92
  paper-button {
80
93
  display: flex;
94
+ align-items: center;
81
95
  justify-content: space-between;
96
+ gap: 8px;
82
97
  text-transform: capitalize;
83
98
  width: 100%;
84
- font-size: 14px;
85
- font-weight: 400;
86
- line-height: 1.5;
99
+ line-height: 1.4;
100
+ font-size: 13px;
101
+ font-weight: 500;
87
102
  color: rgb(33, 37, 41);
88
103
  background: rgb(255, 255, 255);
89
104
  background-clip: padding-box;
90
- border-width: 1px;
91
- border-style: solid;
92
- border-image: initial;
105
+ border: 1px solid var(--input-border-color, #ced4da);
93
106
  appearance: none;
94
- border-radius: 0.25rem;
107
+ border-radius: 8px;
95
108
  transition: border-color 0.15s ease-in-out 0s,
96
- box-shadow 0.15s ease-in-out 0s;
109
+ box-shadow 0.15s ease-in-out 0s, background-color 0.15s ease-in-out 0s;
97
110
  margin: 0px;
98
- font-family: var(--font-family);
99
- border-color: var(--input-border-color);
111
+ font-family: var(--font-family, "Inter", Arial, sans-serif);
100
112
  box-sizing: border-box;
101
- padding: 5px;
102
- font-size: 12px;
113
+ padding: 7px 10px;
114
+ cursor: pointer;
103
115
  }
104
116
  paper-button:hover {
105
- border-color: black;
117
+ border-color: #9aa1a9;
118
+ background: #fbfbfc;
106
119
  }
107
- `;class l extends s.WF{constructor(){super(),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this)}focus(){this.shadowRoot.querySelector(".dropdown-item").focus()}onFocus(){this.focused=!0}onBlur(){this.focused=!1}onClick(t){if(this.notClickable)return;const e=this.closest("cdtr-dropdown");e&&e.patch(this.value,t,this)}onPress(t){if(13===t.keyCode){const e=new UIEvent("click",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(e);const i=this.closest("cdtr-dropdown");i&&i.patch(this.value,t,this)}}connectedCallback(){super.connectedCallback(),this.selected&&this.scrollIntoView({behavior:"smooth",block:"start"})}render(){return s.qy`<div role="button"
120
+ paper-button:focus,
121
+ paper-button:focus-within {
122
+ outline: none;
123
+ border-color: var(--cdtr-dropdown-accent, #7c5cf6);
124
+ box-shadow: 0 0 0 3px rgba(124, 92, 246, 0.2);
125
+ }
126
+ `;class l extends o.WF{constructor(){super(),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this)}focus(){this.shadowRoot.querySelector(".dropdown-item").focus()}onFocus(){this.focused=!0}onBlur(){this.focused=!1}onClick(t){if(this.notClickable)return;const e=this.closest("cdtr-dropdown");e&&e.patch(this.value,t,this)}onPress(t){if(13===t.keyCode){const e=new UIEvent("click",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(e);const i=this.closest("cdtr-dropdown");i&&i.patch(this.value,t,this)}}connectedCallback(){super.connectedCallback(),this.selected&&this.scrollIntoView({behavior:"smooth",block:"start"})}render(){return o.qy`<div role="button"
108
127
  @click=${this.onClick}
109
128
  @keydown=${this.onPress}
110
129
  @blur=${this.onBlur}
@@ -112,57 +131,71 @@
112
131
  class="dropdown-item"
113
132
  tabindex="0"
114
133
  >
115
- ${this.selected?s.qy` <svg
116
- class="selected-svg"
117
- fill="var(--primary)"
134
+ <slot></slot>
135
+ ${this.selected?o.qy` <svg
136
+ class="check"
137
+ fill="currentColor"
118
138
  xmlns="http://www.w3.org/2000/svg"
119
139
  viewBox="0 0 24 24"
120
- width="24"
121
- height="24"
140
+ aria-hidden="true"
122
141
  >
123
142
  <path fill="none" d="M0 0h24v24H0z" />
124
143
  <path
125
144
  d="M10 15.172l9.192-9.193 1.415 1.414L10 18l-6.364-6.364 1.414-1.414z"
126
145
  />
127
146
  </svg>`:null}
128
- <slot></slot>
129
- </div>`}}l.properties={focused:{type:Boolean,reflect:!0},selected:{type:Boolean,reflect:!0},value:{type:String,reflect:!0},notClickable:{type:Boolean}},l.styles=s.AH`
147
+ </div>`}}l.properties={focused:{type:Boolean,reflect:!0},selected:{type:Boolean,reflect:!0},value:{type:String,reflect:!0},notClickable:{type:Boolean}},l.styles=o.AH`
130
148
  .dropdown-item {
131
149
  position: relative;
132
150
  box-sizing: border-box;
133
151
  display: flex;
134
- font-family: Arial, Helvetica, sans-serif;
135
- font-size: 12px;
136
- cursor: pointer;
137
- margin-bottom: 2px;
138
- display: flex;
139
152
  align-items: center;
140
- user-select: none;
141
- width: 100%;
142
153
  justify-content: space-between;
143
- box-sizing: border-box;
144
- padding: 10px 20px;
154
+ gap: 10px;
155
+ width: 100%;
156
+ padding: 8px 12px;
157
+ border-radius: 6px;
158
+ font-family: var(--font-family, "Inter", Arial, sans-serif);
159
+ font-size: 13px;
160
+ line-height: 1.4;
161
+ color: #212529;
162
+ cursor: pointer;
163
+ user-select: none;
164
+ transition: background-color 120ms ease, color 120ms ease,
165
+ box-shadow 120ms ease;
145
166
  }
167
+ /* hover = a translucent violet wash: ephemeral pointer feedback. The
168
+ parent sets --cdtr-item-hover to transparent while arrow-key
169
+ navigating so it never competes with the keyboard cursor below. */
146
170
  .dropdown-item:hover {
147
- background: #f3f3f396;
171
+ background: var(--cdtr-item-hover, rgba(124, 92, 246, 0.1));
148
172
  }
173
+ /* keyboard cursor: stronger wash + a left accent bar, so "where am I"
174
+ reads at a glance and is distinct from both hover and selected */
149
175
  .dropdown-item:focus {
150
- color: var(--primary-color);
151
176
  outline: none;
152
- background: #f3f3f3;
177
+ background: rgba(124, 92, 246, 0.16);
178
+ color: var(--cdtr-dropdown-accent-ink, #5a3cc9);
179
+ box-shadow: inset 3px 0 0 var(--cdtr-dropdown-accent, #7c5cf6);
153
180
  }
154
- .selected-svg {
181
+ /* selected = the committed choice: a SOLID chip (opaque, not a wash),
182
+ accent text, weight, and a check — so it can't be mistaken for hover */
183
+ :host([selected]) .dropdown-item {
184
+ color: var(--cdtr-dropdown-accent-ink, #5a3cc9);
185
+ font-weight: 600;
186
+ background: var(--cdtr-dropdown-selected-bg, #efeaff);
187
+ }
188
+ .check {
155
189
  width: 16px;
156
- position: absolute;
157
- left: 95%;
158
- transform: translate(-70%, -50%);
159
- top: 50%;
190
+ height: 16px;
191
+ flex: none;
192
+ color: var(--cdtr-dropdown-accent, #7c5cf6);
160
193
  }
161
- `,customElements.get("cdtr-dropdown-item")||customElements.define("cdtr-dropdown-item",l),customElements.get("cdtr-dropdown-button")||customElements.define("cdtr-dropdown-button",a),customElements.get("cdtr-dropdown")||customElements.define("cdtr-dropdown",n)},70380(t,e,i){i.r(e),i.d(e,{default:()=>p});var s=i(59929),o=i(21421),r=i(91597);const n="֑-߿יִ-﷽ﹰ-ﻼ",a="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",l=new RegExp("^[^"+a+"]*["+n+"]"),c=new RegExp("^[^"+n+"]*["+a+"]");var d=i(86319);const h=(0,r.S)();class p extends s.WF{constructor(){super(),this.inputRef=(0,o._)(),this.min=0,this.max=100,this.step=1,this.autofocus=!1,this.type="text",this.value="number"===this.type?"0":"",this.placeholder="",this.oldValue=this.value,this.successActive=!1,this._successTimeout=null}onSubmit(t){t.preventDefault();const e=new UIEvent("submit",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(e),this.oldValue=this.value}focus(){const t=this.inputRef.value;t.focus(),t.setSelectionRange(t.value.length,t.value.length)}onFocus(){const t=new UIEvent("focus",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(t)}onBlur(){const t=new UIEvent("blur",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(t),this.oldValue=this.value}render(){this.fullWidth&&(this.style.width="100%"),this.value||"text"!==this.type||(this.value=""),this.icon&&"string"!=typeof this.inputStyle&&(this.inputStyle="");const t=d.M.get("lang",this.placeholder)||this.placeholder||"";t&&("string"!=typeof this.inputStyle&&(this.inputStyle=""),-1===this.inputStyle.indexOf("text-align")&&(this.inputStyle+=";text-align:"+("rtl"===function(t){const e=String(t||"");return l.test(e)?"rtl":c.test(e)?"ltr":"neutral"}(t)?"right":"")));const e=this.multiline?s.qy` <textarea
194
+ `,customElements.get("cdtr-dropdown-item")||customElements.define("cdtr-dropdown-item",l),customElements.get("cdtr-dropdown-button")||customElements.define("cdtr-dropdown-button",a),customElements.get("cdtr-dropdown")||customElements.define("cdtr-dropdown",n)},70380(t,e,i){i.r(e),i.d(e,{default:()=>p});var o=i(59929),s=i(21421),r=i(91597);const n="֑-߿יִ-﷽ﹰ-ﻼ",a="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",l=new RegExp("^[^"+a+"]*["+n+"]"),c=new RegExp("^[^"+n+"]*["+a+"]");var d=i(86319);const h=(0,r.S)();class p extends o.WF{constructor(){super(),this.inputRef=(0,s._)(),this.min=0,this.max=100,this.step=1,this.autofocus=!1,this.type="text",this.value="number"===this.type?"0":"",this.placeholder="",this.oldValue=this.value,this.successActive=!1,this._successTimeout=null}onSubmit(t){t.preventDefault();const e=new UIEvent("submit",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(e),this.oldValue=this.value}focus(){const t=this.inputRef.value;t.focus(),t.setSelectionRange(t.value.length,t.value.length)}onFocus(){const t=new UIEvent("focus",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(t)}onBlur(){const t=new UIEvent("blur",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(t),this.oldValue=this.value}render(){this.fullWidth&&(this.style.width="100%"),this.value||"text"!==this.type||(this.value=""),this.icon&&"string"!=typeof this.inputStyle&&(this.inputStyle="");const t=d.M.get("lang",this.placeholder)||this.placeholder||"";t&&("string"!=typeof this.inputStyle&&(this.inputStyle=""),-1===this.inputStyle.indexOf("text-align")&&(this.inputStyle+=";text-align:"+("rtl"===function(t){const e=String(t||"");return l.test(e)?"rtl":c.test(e)?"ltr":"neutral"}(t)?"right":"")));const e=this.multiline?o.qy` <textarea
162
195
  row=${this.row||4}
163
196
  .disabled=${this.disabled}
164
197
  dir="auto"
165
- ${(0,o.K)(this.inputRef)}
198
+ ${(0,s.K)(this.inputRef)}
166
199
  style="${this.inputStyle}"
167
200
  .autofocus="${this.autofocus}"
168
201
  .placeholder="${t}"
@@ -172,10 +205,10 @@
172
205
  .max="${String(this.max)}"
173
206
  .step="${String(this.step)}"
174
207
  .value="${String(this.value)}"
175
- />`:s.qy` <input
208
+ />`:o.qy` <input
176
209
  .disabled=${this.disabled}
177
210
  dir="auto"
178
- ${(0,o.K)(this.inputRef)}
211
+ ${(0,s.K)(this.inputRef)}
179
212
  style="${this.inputStyle}"
180
213
  .autofocus="${this.autofocus}"
181
214
  .placeholder="${t}"
@@ -186,9 +219,9 @@
186
219
  .max="${String(this.max)}"
187
220
  .step="${String(this.step)}"
188
221
  .value="${String(this.value)}"
189
- />`;return s.qy`<form @submit=${this.onSubmit}>
222
+ />`;return o.qy`<form @submit=${this.onSubmit}>
190
223
  ${e}
191
- ${!this.icon||this.couchOnEmpty||this.successActive?null:s.qy`<cdtr-icon
224
+ ${!this.icon||this.couchOnEmpty||this.successActive?null:o.qy`<cdtr-icon
192
225
  color="#d9d9d9"
193
226
  width=${20}
194
227
  height=${20}
@@ -197,19 +230,19 @@
197
230
  left: 10px;"
198
231
  icon="${this.icon}"
199
232
  ></cdtr-icon>`}
200
- ${this.successActive?s.qy`<div class="success-overlay" aria-live="polite">
233
+ ${this.successActive?o.qy`<div class="success-overlay" aria-live="polite">
201
234
  <cdtr-couch-mark></cdtr-couch-mark>
202
235
  <span class="success-icon">✓</span>
203
236
  </div>`:null}
204
- ${!this.couchOnEmpty||this.value||this.successActive?null:s.qy`<cdtr-couch-mark
237
+ ${!this.couchOnEmpty||this.value||this.successActive?null:o.qy`<cdtr-couch-mark
205
238
  style="position: absolute;
206
239
  transform: translateY(-50%);
207
240
  left: 0;"
208
241
  ></cdtr-couch-mark>`}
209
- ${"text"===this.type&&this.maxLength?s.qy`<span class="counter"
242
+ ${"text"===this.type&&this.maxLength?o.qy`<span class="counter"
210
243
  >${this.value.length}/${this.maxLength}</span
211
244
  > `:null}
212
- </form>`}firstUpdated(){this.autofocus&&setTimeout(()=>{this.inputRef.value&&this.inputRef.value.focus()},500),void 0===this.value&&(this.value="")}focus(){super.focus(),this.inputRef.value.focus()}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._successTimeout&&(clearTimeout(this._successTimeout),this._successTimeout=null)}setValue(t){if(this.selectionStart=this.inputRef.value.selectionStart,!this.inputRef.value)return;const e=this.inputRef.value;if("text"===this.type&&this.max&&e.value.length>this.max)return e.value=this.value,void this.inputRef.value.focus();this.value=e.value;const i=new UIEvent(t.type,{view:window,bubbles:!0,cancelable:!0});if(this.dispatchEvent(i),"input"===t.type){const t=()=>{const t=new UIEvent("debounce",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(t)};h.run(t,500)}}success(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:2e3;this._successTimeout&&(clearTimeout(this._successTimeout),this._successTimeout=null),this.successActive=!0;const e=Number(t);!Number.isFinite(e)||e<=0||(this._successTimeout=setTimeout(()=>{this.successActive=!1,this._successTimeout=null},e))}patch(t){this.value=t}}p.styles=s.AH`
245
+ </form>`}firstUpdated(){this.autofocus&&setTimeout(()=>{this.inputRef.value&&this.inputRef.value.focus()},500),void 0===this.value&&(this.value="")}focus(){super.focus(),this.inputRef.value.focus()}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._successTimeout&&(clearTimeout(this._successTimeout),this._successTimeout=null)}setValue(t){if(this.selectionStart=this.inputRef.value.selectionStart,!this.inputRef.value)return;const e=this.inputRef.value;if("text"===this.type&&this.max&&e.value.length>this.max)return e.value=this.value,void this.inputRef.value.focus();this.value=e.value;const i=new UIEvent(t.type,{view:window,bubbles:!0,cancelable:!0});if(this.dispatchEvent(i),"input"===t.type){const t=()=>{const t=new UIEvent("debounce",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(t)};h.run(t,500)}}success(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:2e3;this._successTimeout&&(clearTimeout(this._successTimeout),this._successTimeout=null),this.successActive=!0;const e=Number(t);!Number.isFinite(e)||e<=0||(this._successTimeout=setTimeout(()=>{this.successActive=!1,this._successTimeout=null},e))}patch(t){this.value=t}}p.styles=o.AH`
213
246
  :host {
214
247
  display: inline-block;
215
248
  --cdtr-input-height: 30px;
@@ -343,7 +376,7 @@
343
376
  box-shadow: 0 0 10px rgba(79, 192, 111, 0.2);
344
377
  }
345
378
  }
346
- `,p.properties={value:{type:String,reflect:!0},step:{type:Number,reflect:!0},min:{type:Number,reflect:!0},max:{type:Number,reflect:!0},type:{type:String,reflect:!0},inputDir:{type:String},icon:{type:String,reflect:!0},placeholder:{type:String,reflect:!0},autofocus:{type:Boolean,reflect:!0},fullWidth:{type:Boolean,reflect:!0},selectionStart:{type:Number},inputStyle:{type:String,reflect:!0},maxLength:{type:Number},couchOnEmpty:{type:Boolean},disabled:{type:Boolean},multiline:{type:Boolean},row:{type:Number},successActive:{type:Boolean}},customElements.get("cdtr-input")||customElements.define("cdtr-input",p)},64569(t,e,i){i.r(e),i.d(e,{LinkElement:()=>x});var s=i(59929),o=i(86319),r=i(88385);const n=s.AH`
379
+ `,p.properties={value:{type:String,reflect:!0},step:{type:Number,reflect:!0},min:{type:Number,reflect:!0},max:{type:Number,reflect:!0},type:{type:String,reflect:!0},inputDir:{type:String},icon:{type:String,reflect:!0},placeholder:{type:String,reflect:!0},autofocus:{type:Boolean,reflect:!0},fullWidth:{type:Boolean,reflect:!0},selectionStart:{type:Number},inputStyle:{type:String,reflect:!0},maxLength:{type:Number},couchOnEmpty:{type:Boolean},disabled:{type:Boolean},multiline:{type:Boolean},row:{type:Number},successActive:{type:Boolean}},customElements.get("cdtr-input")||customElements.define("cdtr-input",p)},64569(t,e,i){i.r(e),i.d(e,{LinkElement:()=>x});var o=i(59929),s=i(86319),r=i(88385);const n=o.AH`
347
380
  :host {
348
381
  --paper-radio-button-checked-color: var(--primary);
349
382
  box-sizing: border-box;
@@ -494,33 +527,33 @@
494
527
  margin-top: 0.75rem;
495
528
  padding-left: 1rem;
496
529
  }
497
- `;var a=i(21421);i(73095),i(70380);const l="260px",c=[{type:"https:",text:"link"},{type:"http:",text:"link"},{type:"mailto:",text:"sendEmail"},{type:"tel:",text:"tel"},{type:"sms:",text:"sendSms"},{type:"whatsapp:",text:"sendWhatsapp"},{type:"anchor:",text:"anchor"}],d="cdtrAdd",h="cdtrRemove",p="cdtrAutomation",u=[d,h,p];function m(t,e){t=t.replace(/[\[\]]/g,"\\$&");var i=new RegExp("[?&]"+t+"(=([^&#]*)|&|#|$)").exec(e);return i?i[2]?decodeURIComponent(i[2].replace(/\+/g," ")):"":null}function f(t,e){switch(t){case"anchor:":return function(t){const{url:e,anchors:i,href:o,protocol:r,onChangeLink:n,onBlur:a,onRequest:l}=t;return s.qy`
530
+ `;var a=i(21421);i(73095),i(70380);const l="260px",c=[{type:"https:",text:"link"},{type:"http:",text:"link"},{type:"mailto:",text:"sendEmail"},{type:"tel:",text:"tel"},{type:"sms:",text:"sendSms"},{type:"whatsapp:",text:"sendWhatsapp"},{type:"anchor:",text:"anchor"}],d="cdtrAdd",h="cdtrRemove",p="cdtrAutomation",u=[d,h,p];function m(t,e){t=t.replace(/[\[\]]/g,"\\$&");var i=new RegExp("[?&]"+t+"(=([^&#]*)|&|#|$)").exec(e);return i?i[2]?decodeURIComponent(i[2].replace(/\+/g," ")):"":null}function f(t,e){switch(t){case"anchor:":return function(t){const{url:e,anchors:i,href:s,protocol:r,onChangeLink:n,onBlur:a,onRequest:l}=t;return o.qy`
498
531
  <cdtr-row alignItems="center" spacing="5">
499
532
  <cdtr-dropdown
500
533
  @change=${t=>{n({target:{value:"#"+t.target.value},anchor:!0}),a()}}
501
- .opened=${i.length>0&&"anchor:"===r&&!o}
534
+ .opened=${i.length>0&&"anchor:"===r&&!s}
502
535
  class="anchor-dd"
503
536
  >
504
537
  <cdtr-dropdown-button
505
538
  minWidth=${100}
506
539
  class=" dropdown-button"
507
540
  slot="trigger"
508
- ><lang-text .text=${e.isAnchor?o:""}></lang-text>
541
+ ><lang-text .text=${e.isAnchor?s:""}></lang-text>
509
542
  </cdtr-dropdown-button>
510
543
  <div style="min-width:150px" slot="content">
511
- ${i.map(t=>s.qy`<cdtr-dropdown-item
544
+ ${i.map(t=>o.qy`<cdtr-dropdown-item
512
545
  value="${t.props.name||t.props.element_ID}"
513
546
  >${t.props.name||t.props.element_ID}
514
547
  </cdtr-dropdown-item>`)}
515
548
  </div>
516
549
  </cdtr-dropdown>
517
- ${0===i.length?s.qy`<paper-button
550
+ ${0===i.length?o.qy`<paper-button
518
551
  @click=${()=>{"function"===l&&l("anchor")}}
519
552
  ><cdtr-title
520
553
  ><lang-text text="create_anchor"></lang-text></cdtr-title
521
554
  ></paper-button>`:null}
522
555
  </cdtr-row>
523
- `}(e);case"mailto:":return function(t){const{href:e,body:i,subject:o,onBlur:r,updateBody:n,updateSubject:a}=t,c="string"==typeof e?m("body",e):i||e.params.body,d="string"==typeof e?m("subject",e):o||e.params.subject;return s.qy`
556
+ `}(e);case"mailto:":return function(t){const{href:e,body:i,subject:s,onBlur:r,updateBody:n,updateSubject:a}=t,c="string"==typeof e?m("body",e):i||e.params.body,d="string"==typeof e?m("subject",e):s||e.params.subject;return o.qy`
524
557
  <cdtr-row spacing="5">
525
558
  <cdtr-title class="explain-title"
526
559
  ><lang-text text="add_catchy_subject"></lang-text
@@ -529,7 +562,7 @@
529
562
  inputStyle="height:${"40px"};"
530
563
  style="width:${l};"
531
564
  @change=${t=>{let{target:e}=t;a(e.value),r()}}
532
- value=${d||o||""}
565
+ value=${d||s||""}
533
566
  ></cdtr-input>
534
567
  <cdtr-title class="explain-title"
535
568
  ><lang-text text="email_body_if_needed"></lang-text
@@ -541,7 +574,7 @@
541
574
  @change=${t=>{let{target:e}=t;n(e.value),r()}}
542
575
  ></cdtr-input>
543
576
  </cdtr-row>
544
- `}(e);case"sms:":return function(t){const{href:e,body:i,onBlur:o,updateBody:r}=t,n="string"==typeof e?m("body",e):e.params.body;return s.qy`
577
+ `}(e);case"sms:":return function(t){const{href:e,body:i,onBlur:s,updateBody:r}=t,n="string"==typeof e?m("body",e):e.params.body;return o.qy`
545
578
  <cdtr-row spacing="5">
546
579
  <cdtr-title class="explain-title"
547
580
  ><lang-text text="sms_body_if_needed"></lang-text
@@ -550,10 +583,10 @@
550
583
  .multiline=${!0}
551
584
  value="${n||i||""}"
552
585
  style="width:${l};"
553
- @change=${t=>{let{target:e}=t;r(e.value),o()}}
586
+ @change=${t=>{let{target:e}=t;r(e.value),s()}}
554
587
  ></cdtr-input>
555
588
  </cdtr-row>
556
- `}(e);case"whatsapp:":return function(t){const{href:e,body:i,onBlur:o,updateBody:r}=t,n="string"==typeof e?m("text",e)||m("body",e):e.params&&(e.params.text||e.params.body)||"";return s.qy`
589
+ `}(e);case"whatsapp:":return function(t){const{href:e,body:i,onBlur:s,updateBody:r}=t,n="string"==typeof e?m("text",e)||m("body",e):e.params&&(e.params.text||e.params.body)||"";return o.qy`
557
590
  <cdtr-row spacing="5">
558
591
  <cdtr-title class="explain-title"
559
592
  ><lang-text text="whatsapp_body_if_needed"></lang-text
@@ -562,10 +595,10 @@
562
595
  .multiline=${!0}
563
596
  value="${n||i||""}"
564
597
  style="width:${l};"
565
- @change=${t=>{let{target:e}=t;r(e.value),o()}}
598
+ @change=${t=>{let{target:e}=t;r(e.value),s()}}
566
599
  ></cdtr-input>
567
600
  </cdtr-row>
568
- `}(e);default:return""}}function g(t,e,i,s,o,n){if(!t)return null;const a="string"==typeof t?new r.A({href:t,protocol:e,params:i}):new r.A(t);return t?"whatsapp:"===e||"whatsapp:"===a.protocol?function(t,e,i,s,o){const n="string"==typeof t?new r.A({href:t,protocol:e,params:i}):new r.A(t),a=(n.params&&(n.params.phone||function(t){try{const e=/whatsapp:([^?]+)/,i=t.match(e);return i?i[1]:""}catch(t){return""}}(n.fullHref))||m("phone",n.href||"")||n.url||"").replace(/\D+/g,"");if(!a)return null;const l=s||n.params&&(n.params.text||n.params.body)||"",c=l?encodeURIComponent(l):"";let d=`https://wa.me/${a}`;c&&(d+=`?text=${c}`);const h=new r.A(d);return h.target=o||h.target||"_blank",{url:h,params:h.params,protocol:"whatsapp:"}}(t,e,i,s,n):(a.isEmail?function(t,e,i){let s=!1;e?t.addParam("subject",e):t.params&&"subject"in t.params&&(delete t.params.subject,s=!0),i?t.addParam("body",i):t.params&&"body"in t.params&&(delete t.params.body,s=!0),s&&(t.href=t.getUrlWithParams())}(a,o,s):s?a.addParam("body",s):a.params&&"body"in a.params&&(delete a.params.body,a.href=a.getUrlWithParams()),a.target=n||a.target||"_blank",{url:a,params:a.params,protocol:a.protocol}):null}function b(t,e,i){if(!t)return{href:{},protocol:null,body:"",subject:""};if(t.startsWith("http")&&!t.startsWith("http://")&&!t.startsWith("https://"))return null;const s=r.A.getProtocol(t);let o=e;s&&(o=s+":");const n=new r.A({href:t,protocol:o||null});console.log("output",n);const a=(i instanceof r.A?i:new r.A(i)).url!==n.url;return{href:n,protocol:n.protocol,shouldBlur:n.isValid,clearParams:a}}function y(t){const{value:e="",inputRef:i,autofocus:o=!1,onChange:r,onBlur:n,onFocus:c,onKeyDown:d,placeholder:h="",inputStyle:p="",style:u="width:260px;",width:m=l}=t,f=t=>{r&&r(t),n&&n()},g=(()=>{if(null==e||""===e)return"";try{return decodeURI(String(e))||""}catch{return String(e)}})();return s.qy`
601
+ `}(e);default:return""}}function g(t,e,i,o,s,n){if(!t)return null;const a="string"==typeof t?new r.A({href:t,protocol:e,params:i}):new r.A(t);return t?"whatsapp:"===e||"whatsapp:"===a.protocol?function(t,e,i,o,s){const n="string"==typeof t?new r.A({href:t,protocol:e,params:i}):new r.A(t),a=(n.params&&(n.params.phone||function(t){try{const e=/whatsapp:([^?]+)/,i=t.match(e);return i?i[1]:""}catch(t){return""}}(n.fullHref))||m("phone",n.href||"")||n.url||"").replace(/\D+/g,"");if(!a)return null;const l=o||n.params&&(n.params.text||n.params.body)||"",c=l?encodeURIComponent(l):"";let d=`https://wa.me/${a}`;c&&(d+=`?text=${c}`);const h=new r.A(d);return h.target=s||h.target||"_blank",{url:h,params:h.params,protocol:"whatsapp:"}}(t,e,i,o,n):(a.isEmail?function(t,e,i){let o=!1;e?t.addParam("subject",e):t.params&&"subject"in t.params&&(delete t.params.subject,o=!0),i?t.addParam("body",i):t.params&&"body"in t.params&&(delete t.params.body,o=!0),o&&(t.href=t.getUrlWithParams())}(a,s,o):o?a.addParam("body",o):a.params&&"body"in a.params&&(delete a.params.body,a.href=a.getUrlWithParams()),a.target=n||a.target||"_blank",{url:a,params:a.params,protocol:a.protocol}):null}function b(t,e,i){if(!t)return{href:{},protocol:null,body:"",subject:""};if(t.startsWith("http")&&!t.startsWith("http://")&&!t.startsWith("https://"))return null;const o=r.A.getProtocol(t);let s=e;o&&(s=o+":");const n=new r.A({href:t,protocol:s||null});console.log("output",n);const a=(i instanceof r.A?i:new r.A(i)).url!==n.url;return{href:n,protocol:n.protocol,shouldBlur:n.isValid,clearParams:a}}function y(t){const{value:e="",inputRef:i,autofocus:s=!1,onChange:r,onBlur:n,onFocus:c,onKeyDown:d,placeholder:h="",inputStyle:p="",style:u="width:260px;",width:m=l}=t,f=t=>{r&&r(t),n&&n()},g=(()=>{if(null==e||""===e)return"";try{return decodeURI(String(e))||""}catch{return String(e)}})();return o.qy`
569
602
  <cdtr-row style="position:relative;" spacing="5">
570
603
  <span style="display:none;" aria-hidden="true">${e}</span>
571
604
  <cdtr-input
@@ -573,7 +606,7 @@
573
606
  ${i?(0,a.K)(i):""}
574
607
  style="${u}"
575
608
  inputStyle="${p}"
576
- .autofocus=${o}
609
+ .autofocus=${s}
577
610
  type="search"
578
611
  width="${m}"
579
612
  placeholder="${h}"
@@ -584,7 +617,7 @@
584
617
  .value="${g}"
585
618
  ></cdtr-input>
586
619
  </cdtr-row>
587
- `}function v(t){return class extends t{initAutomations(){this.showAutomations=!1,this.selectedAutomation=null,this.activeAutomationId=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null,this.activeTab="add",this.baseUrl="",this.showSaveSuccess=!1;const t=o.M.get("config","editor","configure","editorProps","mailingLists","items");this.mailingLists=t||[];const e=o.M.get("config","editor","configure","editorProps","automations")||{};this.automations=[],e.addAndRemoveFromMailingList&&this.automations.push({id:"addAndRemoveFromMailingList",name:"moving_from_mailing_list"})}onAutomationsClick(){if(this.showAutomations=!0,this.protocol="automation:",this.selectedAutomation=null,this.activeAutomationId=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null,this.href&&this.href.href){const t=this.href.href;if("string"==typeof t&&t.match(/^\[\[([^\]]+)\]\]\?/))this.parseAutomationLink(this.href);else{const t=new r.A(this.href);t.params&&t.params[p]?(this.baseUrl=this.extractBaseUrl(t),this.parseAutomationLink(t)):this.baseUrl=t.href||""}}else this.baseUrl="";this.requestUpdate()}extractBaseUrl(t){const e=[];t.protocol&&e.push(t.protocol),t.host&&(e.push("//"),e.push(t.host)),t.pathname&&e.push(t.pathname);const i=u,s=[];t.params&&Object.keys(t.params).forEach(e=>{if(!i.includes(e)){const i=t.params[e];s.push(`${e}=${encodeURIComponent(i)}`)}});let o=e.join("");return s.length>0&&(o+=`?${s.join("&")}`),t.href}onBackClick(){if(this.selectedAutomation)this.selectedAutomation=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null;else if(this.showAutomations=!1,this.activeAutomationId=null,"automation:"===this.protocol)if(this.baseUrl){const t=new r.A(this.baseUrl);this.href=t,this.protocol=t.protocol}else this.protocol=null,this.href={};this.requestUpdate()}onAutomationClick(t){this.selectedAutomation=t,this.activeAutomationId=t.id,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null,this.requestUpdate()}onActionSelect(t){this.automationAction===t?this.automationAction=null:this.automationAction=t,this.requestUpdate()}onTabChange(t){this.activeTab=t,this.requestUpdate()}onMailingListToggle(t,e){("add"===e?this.selectedMailingListsForAdd:this.selectedMailingListsForRemove).indexOf(t)>-1?"add"===e?this.selectedMailingListsForAdd=this.selectedMailingListsForAdd.filter(e=>e!==t):this.selectedMailingListsForRemove=this.selectedMailingListsForRemove.filter(e=>e!==t):"add"===e?this.selectedMailingListsForAdd=[...this.selectedMailingListsForAdd,t]:this.selectedMailingListsForRemove=[...this.selectedMailingListsForRemove,t],this.requestUpdate()}createAutomationLink(){if(!this.selectedAutomation)return null;const t=[];if(this.selectedMailingListsForAdd.length>0&&t.push(`${d}=${this.selectedMailingListsForAdd.join(",")}`),this.selectedMailingListsForRemove.length>0&&t.push(`${h}=${this.selectedMailingListsForRemove.join(",")}`),0===t.length)return null;const e=this.selectedAutomation.name||this.selectedAutomation.id;if(this.baseUrl&&this.baseUrl.trim()){let e=this.baseUrl.trim();e.match(/^https?:\/\//i)||e.includes("://")||!e.includes(".")&&e.match(/^[a-zA-Z]+:/)||(e=`https://${e}`),t.push(`url=${encodeURIComponent(e)}`)}return`[[${e}]]?${t.join("&")}`}onSaveAutomation(){const t=this.createAutomationLink();if(!t)return;console.log("Saving automation link:",t);const e=t.match(/^\[\[([^\]]+)\]\]\?(.+)$/);if(!e)return void console.error("Invalid automation link format:",t);const i=e[1],s=e[2],o={};s.split("&").forEach(t=>{const[e,i]=t.split("=");e&&i&&(o[decodeURIComponent(e)]=decodeURIComponent(i))});const n=o.url;let a;if(delete o.url,a=n?new r.A(n):new r.A("https://example.com"),a.params||(a.params={}),o[d]&&(a.params[d]=o[d]),o[h]&&(a.params[h]=o[h]),a.params[p]=i,a.href=t,a.url=n||"",this.href=a,this.protocol=null,this.value=a,this.link=a,this.lastUrl=a,console.log("Set href to:",this.href),console.log("Set href.href to:",this.href?.href),this.onDispatch(),console.log("After dispatch, href:",this.href),console.log("After dispatch, href.href:",this.href?.href),console.log("After dispatch, href.params:",this.href?.params),this.href&&(!this.href.params||!this.href.params[p])){console.log("Restoring automation params after dispatch");const t=this.href.href||this.href,e=String(t).match(/^\[\[([^\]]+)\]\]\?(.+)$/);if(e){const i=e[2],s={};i.split("&").forEach(t=>{const[e,i]=t.split("=");e&&i&&(s[decodeURIComponent(e)]=decodeURIComponent(i))});const o=s.url,n=o?new r.A(o):new r.A("https://example.com");n.params||(n.params={}),s[d]&&(n.params[d]=s[d]),s[h]&&(n.params[h]=s[h]),n.params[p]=e[1],n.href=t,n.url=o||"",this.href=n,this.value=n,this.link=n,this.lastUrl=n,console.log("Restored href:",this.href?.href),console.log("Restored params:",this.href?.params)}}this.showSaveSuccess=!0,this.requestUpdate(),setTimeout(()=>{this.showSaveSuccess=!1,this.requestUpdate()},2e3)}parseAutomationLink(t){if(!t)return;let e=null,i=!1,s=t.href||t;if("string"==typeof s&&s.match(/^\[\[([^\]]+)\]\]\?/)){i=!0;e=s.match(/^\[\[([^\]]+)\]\]\?/)[1]}else t.params&&(e=t.params[p],i=e&&""!==e&&"string"==typeof e&&""!==e.trim());if(i){if("string"==typeof s&&s.match(/^\[\[([^\]]+)\]\]\?(.+)$/)){const t=s.match(/^\[\[([^\]]+)\]\]\?(.+)$/)[2],e={};if(t.split("&").forEach(t=>{const[i,s]=t.split("=");i&&s&&(e[decodeURIComponent(i)]=decodeURIComponent(s))}),e.url?this.baseUrl=e.url:this.baseUrl="",e[d]){const t="string"==typeof e[d]?e[d].split(",").filter(t=>t.trim()):Array.isArray(e[d])?e[d]:[];this.selectedMailingListsForAdd=t}if(e[h]){const t="string"==typeof e[h]?e[h].split(",").filter(t=>t.trim()):Array.isArray(e[h])?e[h]:[];this.selectedMailingListsForRemove=t}}else if(t.params){const e=this.extractBaseUrl(t);if(this.baseUrl=e,t.params[d]){const e="string"==typeof t.params[d]?t.params[d].split(",").filter(t=>t.trim()):Array.isArray(t.params[d])?t.params[d]:[];this.selectedMailingListsForAdd=e}if(t.params[h]){const e="string"==typeof t.params[h]?t.params[h].split(",").filter(t=>t.trim()):Array.isArray(t.params[h])?t.params[h]:[];this.selectedMailingListsForRemove=e}}if((this.selectedMailingListsForAdd.length>0||this.selectedMailingListsForRemove.length>0)&&(this.showAutomations=!0,this.automations&&this.automations.length>0)){const t=String(e).trim(),i=this.automations.find(e=>e.name&&String(e.name).trim()===t||e.id&&String(e.id).trim()===t)||this.automations[0];this.selectedAutomation=i,this.activeAutomationId=i.id}}}renderAutomationsView(){return this.selectedAutomation?this.renderAutomationDetails():s.qy`
620
+ `}function v(t){return class extends t{initAutomations(){this.showAutomations=!1,this.selectedAutomation=null,this.activeAutomationId=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null,this.activeTab="add",this.baseUrl="",this.showSaveSuccess=!1;const t=s.M.get("config","editor","configure","editorProps","mailingLists","items");this.mailingLists=t||[];const e=s.M.get("config","editor","configure","editorProps","automations")||{};this.automations=[],e.addAndRemoveFromMailingList&&this.automations.push({id:"addAndRemoveFromMailingList",name:"moving_from_mailing_list"})}onAutomationsClick(){if(this.showAutomations=!0,this.protocol="automation:",this.selectedAutomation=null,this.activeAutomationId=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null,this.href&&this.href.href){const t=this.href.href;if("string"==typeof t&&t.match(/^\[\[([^\]]+)\]\]\?/))this.parseAutomationLink(this.href);else{const t=new r.A(this.href);t.params&&t.params[p]?(this.baseUrl=this.extractBaseUrl(t),this.parseAutomationLink(t)):this.baseUrl=t.href||""}}else this.baseUrl="";this.requestUpdate()}extractBaseUrl(t){const e=[];t.protocol&&e.push(t.protocol),t.host&&(e.push("//"),e.push(t.host)),t.pathname&&e.push(t.pathname);const i=u,o=[];t.params&&Object.keys(t.params).forEach(e=>{if(!i.includes(e)){const i=t.params[e];o.push(`${e}=${encodeURIComponent(i)}`)}});let s=e.join("");return o.length>0&&(s+=`?${o.join("&")}`),t.href}onBackClick(){if(this.selectedAutomation)this.selectedAutomation=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null;else if(this.showAutomations=!1,this.activeAutomationId=null,"automation:"===this.protocol)if(this.baseUrl){const t=new r.A(this.baseUrl);this.href=t,this.protocol=t.protocol}else this.protocol=null,this.href={};this.requestUpdate()}onAutomationClick(t){this.selectedAutomation=t,this.activeAutomationId=t.id,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null,this.requestUpdate()}onActionSelect(t){this.automationAction===t?this.automationAction=null:this.automationAction=t,this.requestUpdate()}onTabChange(t){this.activeTab=t,this.requestUpdate()}onMailingListToggle(t,e){("add"===e?this.selectedMailingListsForAdd:this.selectedMailingListsForRemove).indexOf(t)>-1?"add"===e?this.selectedMailingListsForAdd=this.selectedMailingListsForAdd.filter(e=>e!==t):this.selectedMailingListsForRemove=this.selectedMailingListsForRemove.filter(e=>e!==t):"add"===e?this.selectedMailingListsForAdd=[...this.selectedMailingListsForAdd,t]:this.selectedMailingListsForRemove=[...this.selectedMailingListsForRemove,t],this.requestUpdate()}createAutomationLink(){if(!this.selectedAutomation)return null;const t=[];if(this.selectedMailingListsForAdd.length>0&&t.push(`${d}=${this.selectedMailingListsForAdd.join(",")}`),this.selectedMailingListsForRemove.length>0&&t.push(`${h}=${this.selectedMailingListsForRemove.join(",")}`),0===t.length)return null;const e=this.selectedAutomation.name||this.selectedAutomation.id;if(this.baseUrl&&this.baseUrl.trim()){let e=this.baseUrl.trim();e.match(/^https?:\/\//i)||e.includes("://")||!e.includes(".")&&e.match(/^[a-zA-Z]+:/)||(e=`https://${e}`),t.push(`url=${encodeURIComponent(e)}`)}return`[[${e}]]?${t.join("&")}`}onSaveAutomation(){const t=this.createAutomationLink();if(!t)return;console.log("Saving automation link:",t);const e=t.match(/^\[\[([^\]]+)\]\]\?(.+)$/);if(!e)return void console.error("Invalid automation link format:",t);const i=e[1],o=e[2],s={};o.split("&").forEach(t=>{const[e,i]=t.split("=");e&&i&&(s[decodeURIComponent(e)]=decodeURIComponent(i))});const n=s.url;let a;if(delete s.url,a=n?new r.A(n):new r.A("https://example.com"),a.params||(a.params={}),s[d]&&(a.params[d]=s[d]),s[h]&&(a.params[h]=s[h]),a.params[p]=i,a.href=t,a.url=n||"",this.href=a,this.protocol=null,this.value=a,this.link=a,this.lastUrl=a,console.log("Set href to:",this.href),console.log("Set href.href to:",this.href?.href),this.onDispatch(),console.log("After dispatch, href:",this.href),console.log("After dispatch, href.href:",this.href?.href),console.log("After dispatch, href.params:",this.href?.params),this.href&&(!this.href.params||!this.href.params[p])){console.log("Restoring automation params after dispatch");const t=this.href.href||this.href,e=String(t).match(/^\[\[([^\]]+)\]\]\?(.+)$/);if(e){const i=e[2],o={};i.split("&").forEach(t=>{const[e,i]=t.split("=");e&&i&&(o[decodeURIComponent(e)]=decodeURIComponent(i))});const s=o.url,n=s?new r.A(s):new r.A("https://example.com");n.params||(n.params={}),o[d]&&(n.params[d]=o[d]),o[h]&&(n.params[h]=o[h]),n.params[p]=e[1],n.href=t,n.url=s||"",this.href=n,this.value=n,this.link=n,this.lastUrl=n,console.log("Restored href:",this.href?.href),console.log("Restored params:",this.href?.params)}}this.showSaveSuccess=!0,this.requestUpdate(),setTimeout(()=>{this.showSaveSuccess=!1,this.requestUpdate()},2e3)}parseAutomationLink(t){if(!t)return;let e=null,i=!1,o=t.href||t;if("string"==typeof o&&o.match(/^\[\[([^\]]+)\]\]\?/)){i=!0;e=o.match(/^\[\[([^\]]+)\]\]\?/)[1]}else t.params&&(e=t.params[p],i=e&&""!==e&&"string"==typeof e&&""!==e.trim());if(i){if("string"==typeof o&&o.match(/^\[\[([^\]]+)\]\]\?(.+)$/)){const t=o.match(/^\[\[([^\]]+)\]\]\?(.+)$/)[2],e={};if(t.split("&").forEach(t=>{const[i,o]=t.split("=");i&&o&&(e[decodeURIComponent(i)]=decodeURIComponent(o))}),e.url?this.baseUrl=e.url:this.baseUrl="",e[d]){const t="string"==typeof e[d]?e[d].split(",").filter(t=>t.trim()):Array.isArray(e[d])?e[d]:[];this.selectedMailingListsForAdd=t}if(e[h]){const t="string"==typeof e[h]?e[h].split(",").filter(t=>t.trim()):Array.isArray(e[h])?e[h]:[];this.selectedMailingListsForRemove=t}}else if(t.params){const e=this.extractBaseUrl(t);if(this.baseUrl=e,t.params[d]){const e="string"==typeof t.params[d]?t.params[d].split(",").filter(t=>t.trim()):Array.isArray(t.params[d])?t.params[d]:[];this.selectedMailingListsForAdd=e}if(t.params[h]){const e="string"==typeof t.params[h]?t.params[h].split(",").filter(t=>t.trim()):Array.isArray(t.params[h])?t.params[h]:[];this.selectedMailingListsForRemove=e}}if((this.selectedMailingListsForAdd.length>0||this.selectedMailingListsForRemove.length>0)&&(this.showAutomations=!0,this.automations&&this.automations.length>0)){const t=String(e).trim(),i=this.automations.find(e=>e.name&&String(e.name).trim()===t||e.id&&String(e.id).trim()===t)||this.automations[0];this.selectedAutomation=i,this.activeAutomationId=i.id}}}renderAutomationsView(){return this.selectedAutomation?this.renderAutomationDetails():o.qy`
588
621
  <div class="automations-view">
589
622
  <cdtr-row justify="space-between" alignItems="center" mb="1">
590
623
  <cdtr-title
@@ -601,7 +634,7 @@
601
634
  </cdtr-row>
602
635
  <cdtr-divider></cdtr-divider>
603
636
  <div class="automations-list" style="margin-top: 1rem;">
604
- ${this.automations.map(t=>{const e=this.activeAutomationId===t.id;return s.qy`
637
+ ${this.automations.map(t=>{const e=this.activeAutomationId===t.id;return o.qy`
605
638
  <div
606
639
  class="automation-card ${e?"active":""}"
607
640
  @click=${()=>this.onAutomationClick(t)}
@@ -623,7 +656,7 @@
623
656
  >
624
657
  <lang-text text="${t.name}"></lang-text>
625
658
  </cdtr-title>
626
- ${e?s.qy`
659
+ ${e?o.qy`
627
660
  <span
628
661
  style="color: var(--primary); font-weight: bold; font-size: 18px; margin-left: 0.5rem;"
629
662
  >✓</span
@@ -638,7 +671,7 @@
638
671
  </h6>
639
672
  </div>
640
673
  </div>
641
- `}renderAutomationDetails(){const t=this.selectedMailingListsForAdd.length>0||this.selectedMailingListsForRemove.length>0;return s.qy`
674
+ `}renderAutomationDetails(){const t=this.selectedMailingListsForAdd.length>0||this.selectedMailingListsForRemove.length>0;return o.qy`
642
675
  <div
643
676
  class="automation-details-view"
644
677
  style="display: flex; flex-direction: column; height: 100%;"
@@ -662,7 +695,7 @@
662
695
 
663
696
  <div class="automation-content">
664
697
  <!-- Success Message -->
665
- ${this.showSaveSuccess?s.qy`
698
+ ${this.showSaveSuccess?o.qy`
666
699
  <style>
667
700
  .save-success-container {
668
701
  margin-bottom: 1rem;
@@ -832,10 +865,10 @@
832
865
  </div>
833
866
 
834
867
  <!-- Add to mailing list section -->
835
- ${"add"===this.activeTab?s.qy`
868
+ ${"add"===this.activeTab?o.qy`
836
869
  <div class="action-section">
837
870
  <div class="mailing-lists-list" style="padding-left: 1rem;">
838
- ${this.mailingLists.map(t=>{const e=this.selectedMailingListsForAdd.includes(t.id);return s.qy`
871
+ ${this.mailingLists.map(t=>{const e=this.selectedMailingListsForAdd.includes(t.id);return o.qy`
839
872
  <div
840
873
  class="mailing-list-item ${e?"selected":""}"
841
874
  @click=${()=>this.onMailingListToggle(t.id,"add")}
@@ -860,12 +893,12 @@
860
893
  >
861
894
  ${t.name}
862
895
  </cdtr-title>
863
- ${e?s.qy`
896
+ ${e?o.qy`
864
897
  <span
865
898
  style="color: var(--primary); font-weight: bold; font-size: 18px; margin-left: 0.5rem;"
866
899
  >✓</span
867
900
  >
868
- `:s.qy`
901
+ `:o.qy`
869
902
  <span
870
903
  style="color: #ddd; font-size: 18px; margin-left: 0.5rem;"
871
904
  >○</span
@@ -879,10 +912,10 @@
879
912
  `:null}
880
913
 
881
914
  <!-- Remove from mailing list section -->
882
- ${"remove"===this.activeTab?s.qy`
915
+ ${"remove"===this.activeTab?o.qy`
883
916
  <div class="action-section">
884
917
  <div class="mailing-lists-list" style="padding-left: 1rem;">
885
- ${this.mailingLists.map(t=>{const e=this.selectedMailingListsForRemove.includes(t.id);return s.qy`
918
+ ${this.mailingLists.map(t=>{const e=this.selectedMailingListsForRemove.includes(t.id);return o.qy`
886
919
  <div
887
920
  class="mailing-list-item ${e?"selected":""}"
888
921
  @click=${()=>this.onMailingListToggle(t.id,"remove")}
@@ -907,12 +940,12 @@
907
940
  >
908
941
  ${t.name}
909
942
  </cdtr-title>
910
- ${e?s.qy`
943
+ ${e?o.qy`
911
944
  <span
912
945
  style="color: #f44336; font-weight: bold; font-size: 18px; margin-left: 0.5rem;"
913
946
  >✓</span
914
947
  >
915
- `:s.qy`
948
+ `:o.qy`
916
949
  <span
917
950
  style="color: #ddd; font-size: 18px; margin-left: 0.5rem;"
918
951
  >○</span
@@ -948,8 +981,8 @@
948
981
  </cdtr-row>
949
982
  </div>
950
983
  </div>
951
- `}}}customElements.get("paper-button")||Promise.resolve().then(i.bind(i,39239)),customElements.get("cdtr-emoji-picker")||i.e(3105).then(i.t.bind(i,63105,23));class x extends(v(s.WF)){constructor(){super(),this.inputRef=(0,a._)(),this.onBlur=this.onBlur.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.urlInputFocused=!1,this._urlInputRawValue="",this._lastSyncedMyHref=void 0,this._lastBodySyncHref=void 0,this.lastUrl=void 0,this.target="_blank",this.anchors=[],this.event=new UIEvent("change",{view:window,bubbles:!0,cancelable:!0}),this.options=c,this.body="",this.subject="",this.name=o.M.get("lang",c[0].text),this.initAutomations()}onDispatch(){const t=function(t){const{href:e,protocol:i,params:s,body:o,subject:r,target:n,dispatchEvent:a,event:l}=t;if(!e)return a(l),{dispatched:!0};const c=g(e,i,s,o,r,n);return c?{dispatched:!0,href:c.url,protocol:c.protocol,params:c.params,value:c.url,link:c.url,lastUrl:c.url}:{dispatched:!1}}({href:this.href,protocol:this.protocol,params:this.params,body:this.body,subject:this.subject,target:this.target,dispatchEvent:this.dispatchEvent.bind(this),event:this.event});if(t.dispatched){if(t.href){this.href=t.href,this.protocol=t.protocol,this.params=t.params?{...t.params}:{},this.value=t.value,this.link=t.link,this.lastUrl=t.lastUrl;const e="string"==typeof t.href?t.href:t.href?.href;this._urlInputRawValue=null!=e&&""!==e?String(e):""}this.dispatchEvent(this.event)}}onChangeLink(t){const e=t.target.value;this._urlInputRawValue=e;const i=b(e,this.protocol,this.href);null!==i?(this.href=i.href,this.protocol=i.protocol,i.clearParams&&(this.body="",this.subject=""),void 0!==i.body&&(this.body=i.body),void 0!==i.subject&&(this.subject=i.subject),i.shouldBlur&&this.onBlur()):this.href=e}onKeyDown(t){if("submit"===t.type){const t=this.inputRef?.value;void 0!==t?.value&&this.onChangeLink({target:{value:t.value}}),t&&"function"==typeof t.success&&t.success(),this.onDispatch()}}onUrlInputFocus(){const t=this.inputRef?.value?.value;null!=t&&(this._urlInputRawValue=t),this.urlInputFocused=!0}onUrlInputBlur(){this.urlInputFocused=!1,this.hasButton||this.onDispatch()}onBlur(){this.hasButton||this.onDispatch()}onClickOk(){this.onDispatch()}onChangeTarget(t){const e={target:t.target.value};this.target=e.target,t.stopPropagation(),!this.hasButton&&this.href&&this.onBlur()}resolveAnchors(){this.anchors=function(){const t=o.M.get("components");return t?.filter(t=>"anchor"===t.type&&t.props.name||t.props.element_ID)||[]}()}onChangeType(t){const e=function(t,e,i,s){const o=e.find(e=>e.type===t);if(!o)return{forceProtocolChange:!1};const r="anchor"===o.text,n=s!==o.type;return setTimeout(()=>{i&&i.value&&i.value.focus()},500),{protocol:o.type,forceProtocolChange:!0,shouldResolveAnchors:r,clearParams:n}}(t,this.options,this.inputRef,this.protocol);if(e.shouldResolveAnchors&&this.resolveAnchors(),this.protocol=e.protocol,this.forceProtocolChange=e.forceProtocolChange,e.clearParams&&(this.body="",this.subject=""),e.forceProtocolChange){const t=new r.A(this.href,{protocol:this.protocol});t.protocol=this.protocol,this.href=t,this.onBlur()}}connectedCallback(){super.connectedCallback(),this.href=new r.A(this.href);const t=String(this.href?.href||"").match(/^\[\[([^\]]+)\]\]\?/),e=this.href&&this.href.params&&this.href.params[p];(t||e)&&this.parseAutomationLink(this.href)}render(){const t=o.M.get("config","editor","configure","editorProps","linkPicker","savedVariables");this.resolveAnchors();const e=this.lastUrl!==this.href,i=new r.A(this.href,{protocol:e?null:this.protocol});this.protocol&&!e?i.protocol=this.protocol:i.protocol&&(this.protocol=i.protocol);const n=String(this.href?.href||this.href||"");if(this._lastBodySyncHref!==n){this._lastBodySyncHref=n,i.params?(this.body=i.params.text||i.params.body||"",this.subject=i.params.subject||""):(this.body="",this.subject="");n.match(/^\[\[([^\]]+)\]\]\?/)||i.params&&i.params[p]?(this.selectedAutomation=null,this.activeAutomationId=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null,this.showAutomations=!0,this.parseAutomationLink(this.href)):(this.showAutomations=!1,this.selectedAutomation=null,this.activeAutomationId=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null)}const l=function(t,e,i){let s=[];return t.isEmail?s=[]:t.isPhone?s=i.filter(t=>("tel:"===t.type||"sms:"===t.type||"whatsapp:"===t.type)&&t.type!==e):-1!==t.href.indexOf("http://")&&"https:"!==e&&(s=[{type:"https:",text:o.M.get("lang","is_user_wants_https"),reccomanded:!0}]),"anchor:"===e&&(s=[]),s}(i,this.protocol,this.options);let c=i.href;const d=String(i.href||""),h=d.match(/^\[\[([^\]]+)\]\]\?/),m=i.params&&i.params[p];if(h)c=d;else if(m){const t=u,e=[];i.params&&Object.keys(i.params).forEach(s=>{if(!t.includes(s)){const t=i.params[s];e.push(`${s}=${encodeURIComponent(t).replace(/%24/g,"$")}`)}});const s=i.url||"";c=i.protocol?"http:"===i.protocol||"https:"===i.protocol?`${i.protocol}//${s}`:`${i.protocol}${s}`:s,e.length>0&&(c+=`?${e.join("&")}`)}const g=function(t){switch(t){case"mailto:":return"what_the_email_address";case"tel:":return"what_the_phone_number";case"sms:":case"whatsapp:":return"what_the_phone_number_to_send_msg";case"anchor:":return"what_the_anchor_name";case"file:":return"what_the_file_name";default:return"what_the_url_address"}}(this.protocol),b=[...this.options],v=b.findIndex(t=>"http:"===t.type);v>-1&&b.splice(v,1);const x=o.M.get("config","editor","configure","editorProps","automations"),w={url:i,href:this.href,protocol:this.protocol,anchors:this.anchors,body:this.body,subject:this.subject,onChangeLink:this.onChangeLink.bind(this),onBlur:this.onBlur.bind(this),onRequest:this.onRequest,updateBody:t=>{this.body=t},updateSubject:t=>{this.subject=t}},$=null!=c&&""!==c?String(c):"",k=this._urlInputRawValue!==$,A=void 0!==this._lastSyncedMyHref&&$!==this._lastSyncedMyHref,_=this.urlInputFocused&&this._urlInputRawValue&&$&&!A;k&&!_?(this._urlInputRawValue=$,this._lastSyncedMyHref=$):k||(this._lastSyncedMyHref=$);const R=this.urlInputFocused&&void 0!==this._urlInputRawValue?this._urlInputRawValue:c,S={protocol:this.protocol,url:i,autofocus:this.autofocus,inputRef:(0,a.K)(this.inputRef),onChangeLink:this.onChangeLink.bind(this),onBlur:this.onUrlInputBlur.bind(this),onFocus:this.onUrlInputFocus.bind(this),onKeyDown:this.onKeyDown.bind(this),myHref:R};return this.showAutomations?s.qy` <div class="root">${this.renderAutomationsView()}</div>`:s.qy` <div class="root">
952
- ${q=this.label,q?s.qy`<cdtr-title
984
+ `}}}customElements.get("paper-button")||Promise.resolve().then(i.bind(i,39239)),customElements.get("cdtr-emoji-picker")||i.e(3105).then(i.t.bind(i,63105,23));class x extends(v(o.WF)){constructor(){super(),this.inputRef=(0,a._)(),this.onBlur=this.onBlur.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.urlInputFocused=!1,this._urlInputRawValue="",this._lastSyncedMyHref=void 0,this._lastBodySyncHref=void 0,this.lastUrl=void 0,this.target="_blank",this.anchors=[],this.event=new UIEvent("change",{view:window,bubbles:!0,cancelable:!0}),this.options=c,this.body="",this.subject="",this.name=s.M.get("lang",c[0].text),this.initAutomations()}onDispatch(){const t=function(t){const{href:e,protocol:i,params:o,body:s,subject:r,target:n,dispatchEvent:a,event:l}=t;if(!e)return a(l),{dispatched:!0};const c=g(e,i,o,s,r,n);return c?{dispatched:!0,href:c.url,protocol:c.protocol,params:c.params,value:c.url,link:c.url,lastUrl:c.url}:{dispatched:!1}}({href:this.href,protocol:this.protocol,params:this.params,body:this.body,subject:this.subject,target:this.target,dispatchEvent:this.dispatchEvent.bind(this),event:this.event});if(t.dispatched){if(t.href){this.href=t.href,this.protocol=t.protocol,this.params=t.params?{...t.params}:{},this.value=t.value,this.link=t.link,this.lastUrl=t.lastUrl;const e="string"==typeof t.href?t.href:t.href?.href;this._urlInputRawValue=null!=e&&""!==e?String(e):""}this.dispatchEvent(this.event)}}onChangeLink(t){const e=t.target.value;this._urlInputRawValue=e;const i=b(e,this.protocol,this.href);null!==i?(this.href=i.href,this.protocol=i.protocol,i.clearParams&&(this.body="",this.subject=""),void 0!==i.body&&(this.body=i.body),void 0!==i.subject&&(this.subject=i.subject),i.shouldBlur&&this.onBlur()):this.href=e}onKeyDown(t){if("submit"===t.type){const t=this.inputRef?.value;void 0!==t?.value&&this.onChangeLink({target:{value:t.value}}),t&&"function"==typeof t.success&&t.success(),this.onDispatch()}}onUrlInputFocus(){const t=this.inputRef?.value?.value;null!=t&&(this._urlInputRawValue=t),this.urlInputFocused=!0}onUrlInputBlur(){this.urlInputFocused=!1,this.hasButton||this.onDispatch()}onBlur(){this.hasButton||this.onDispatch()}onClickOk(){this.onDispatch()}onChangeTarget(t){const e={target:t.target.value};this.target=e.target,t.stopPropagation(),!this.hasButton&&this.href&&this.onBlur()}resolveAnchors(){this.anchors=function(){const t=s.M.get("components");return t?.filter(t=>"anchor"===t.type&&t.props.name||t.props.element_ID)||[]}()}onChangeType(t){const e=function(t,e,i,o){const s=e.find(e=>e.type===t);if(!s)return{forceProtocolChange:!1};const r="anchor"===s.text,n=o!==s.type;return setTimeout(()=>{i&&i.value&&i.value.focus()},500),{protocol:s.type,forceProtocolChange:!0,shouldResolveAnchors:r,clearParams:n}}(t,this.options,this.inputRef,this.protocol);if(e.shouldResolveAnchors&&this.resolveAnchors(),this.protocol=e.protocol,this.forceProtocolChange=e.forceProtocolChange,e.clearParams&&(this.body="",this.subject=""),e.forceProtocolChange){const t=new r.A(this.href,{protocol:this.protocol});t.protocol=this.protocol,this.href=t,this.onBlur()}}connectedCallback(){super.connectedCallback(),this.href=new r.A(this.href);const t=String(this.href?.href||"").match(/^\[\[([^\]]+)\]\]\?/),e=this.href&&this.href.params&&this.href.params[p];(t||e)&&this.parseAutomationLink(this.href)}render(){const t=s.M.get("config","editor","configure","editorProps","linkPicker","savedVariables");this.resolveAnchors();const e=this.lastUrl!==this.href,i=new r.A(this.href,{protocol:e?null:this.protocol});this.protocol&&!e?i.protocol=this.protocol:i.protocol&&(this.protocol=i.protocol);const n=String(this.href?.href||this.href||"");if(this._lastBodySyncHref!==n){this._lastBodySyncHref=n,i.params?(this.body=i.params.text||i.params.body||"",this.subject=i.params.subject||""):(this.body="",this.subject="");n.match(/^\[\[([^\]]+)\]\]\?/)||i.params&&i.params[p]?(this.selectedAutomation=null,this.activeAutomationId=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null,this.showAutomations=!0,this.parseAutomationLink(this.href)):(this.showAutomations=!1,this.selectedAutomation=null,this.activeAutomationId=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null)}const l=function(t,e,i){let o=[];return t.isEmail?o=[]:t.isPhone?o=i.filter(t=>("tel:"===t.type||"sms:"===t.type||"whatsapp:"===t.type)&&t.type!==e):-1!==t.href.indexOf("http://")&&"https:"!==e&&(o=[{type:"https:",text:s.M.get("lang","is_user_wants_https"),reccomanded:!0}]),"anchor:"===e&&(o=[]),o}(i,this.protocol,this.options);let c=i.href;const d=String(i.href||""),h=d.match(/^\[\[([^\]]+)\]\]\?/),m=i.params&&i.params[p];if(h)c=d;else if(m){const t=u,e=[];i.params&&Object.keys(i.params).forEach(o=>{if(!t.includes(o)){const t=i.params[o];e.push(`${o}=${encodeURIComponent(t).replace(/%24/g,"$")}`)}});const o=i.url||"";c=i.protocol?"http:"===i.protocol||"https:"===i.protocol?`${i.protocol}//${o}`:`${i.protocol}${o}`:o,e.length>0&&(c+=`?${e.join("&")}`)}const g=function(t){switch(t){case"mailto:":return"what_the_email_address";case"tel:":return"what_the_phone_number";case"sms:":case"whatsapp:":return"what_the_phone_number_to_send_msg";case"anchor:":return"what_the_anchor_name";case"file:":return"what_the_file_name";default:return"what_the_url_address"}}(this.protocol),b=[...this.options],v=b.findIndex(t=>"http:"===t.type);v>-1&&b.splice(v,1);const x=s.M.get("config","editor","configure","editorProps","automations"),w={url:i,href:this.href,protocol:this.protocol,anchors:this.anchors,body:this.body,subject:this.subject,onChangeLink:this.onChangeLink.bind(this),onBlur:this.onBlur.bind(this),onRequest:this.onRequest,updateBody:t=>{this.body=t},updateSubject:t=>{this.subject=t}},$=null!=c&&""!==c?String(c):"",k=this._urlInputRawValue!==$,A=void 0!==this._lastSyncedMyHref&&$!==this._lastSyncedMyHref,_=this.urlInputFocused&&this._urlInputRawValue&&$&&!A;k&&!_?(this._urlInputRawValue=$,this._lastSyncedMyHref=$):k||(this._lastSyncedMyHref=$);const R=this.urlInputFocused&&void 0!==this._urlInputRawValue?this._urlInputRawValue:c,S={protocol:this.protocol,url:i,autofocus:this.autofocus,inputRef:(0,a.K)(this.inputRef),onChangeLink:this.onChangeLink.bind(this),onBlur:this.onUrlInputBlur.bind(this),onFocus:this.onUrlInputFocus.bind(this),onKeyDown:this.onKeyDown.bind(this),myHref:R};return this.showAutomations?o.qy` <div class="root">${this.renderAutomationsView()}</div>`:o.qy` <div class="root">
985
+ ${q=this.label,q?o.qy`<cdtr-title
953
986
  style="font-weight: 700;
954
987
  font-size: 14.4px;
955
988
  margin-bottom: 0.6rem;
@@ -958,27 +991,27 @@
958
991
  ><cdtr-divider></cdtr-divider
959
992
  ></cdtr-title>`:null}
960
993
  <cdtr-row alignItems="center" justify="space-between" spacing="10">
961
- ${E=this.options,B=this.protocol,M=this.onChangeType.bind(this),s.qy`
962
- <cdtr-dropdown @change=${t=>M(t.target.value)}>
994
+ ${E=this.options,M=this.protocol,B=this.onChangeType.bind(this),o.qy`
995
+ <cdtr-dropdown @change=${t=>B(t.target.value)}>
963
996
  <cdtr-dropdown-button
964
997
  minWidth=${100}
965
998
  class=" dropdown-button"
966
999
  slot="trigger"
967
1000
  ><lang-text
968
- .text="${E.find(t=>t.type===B)?.text||"link"}"
1001
+ .text="${E.find(t=>t.type===M)?.text||"link"}"
969
1002
  ></lang-text>
970
1003
  </cdtr-dropdown-button>
971
1004
  <div slot="content">
972
- ${E.map(t=>s.qy`<cdtr-dropdown-item
973
- .focused=${t.type===B}
974
- .selected=${t.type===B}
1005
+ ${E.map(t=>o.qy`<cdtr-dropdown-item
1006
+ .focused=${t.type===M}
1007
+ .selected=${t.type===M}
975
1008
  value="${t.type}"
976
1009
  ><lang-text text="${t.text}"></lang-text>
977
1010
  </cdtr-dropdown-item>`)}
978
1011
  </div>
979
1012
  </cdtr-dropdown>
980
1013
  `}
981
- ${L=this.target,U=this.onChangeTarget.bind(this),s.qy`
1014
+ ${L=this.target,U=this.onChangeTarget.bind(this),o.qy`
982
1015
  <cdtr-dropdown @change=${t=>U(t)} style="min-width: 120px;">
983
1016
  <cdtr-dropdown-button minWidth=${120} class="dropdown-button" slot="trigger">
984
1017
  <lang-text .text=${L}></lang-text>
@@ -1001,7 +1034,7 @@
1001
1034
  `}
1002
1035
  </cdtr-row>
1003
1036
  <cdtr-row mt="1">
1004
- ${function(t,e){return 0===t.length?null:s.qy`${t.map(t=>s.qy`<paper-button
1037
+ ${function(t,e){return 0===t.length?null:o.qy`${t.map(t=>o.qy`<paper-button
1005
1038
  @click=${()=>e(t.type)}
1006
1039
  style="background:rgb(233, 237, 243);color:#000;font-size:13px;margin:0;margin-right:5px;"
1007
1040
  ><lang-text text="${t.text}"></lang-text
@@ -1012,9 +1045,9 @@
1012
1045
  <cdtr-title class="explain-title"
1013
1046
  ><lang-text .text="${g}"></lang-text
1014
1047
  ></cdtr-title>
1015
- ${function(t){const{protocol:e,url:i,autofocus:s,inputRef:o,onChangeLink:r,onBlur:n,onFocus:a,onKeyDown:l,myHref:c}=t;return"anchor:"===e?null:y({value:c,inputRef:o,autofocus:s,onChange:r,onBlur:n,onFocus:a,onKeyDown:l})}(S)}
1048
+ ${function(t){const{protocol:e,url:i,autofocus:o,inputRef:s,onChangeLink:r,onBlur:n,onFocus:a,onKeyDown:l,myHref:c}=t;return"anchor:"===e?null:y({value:c,inputRef:s,autofocus:o,onChange:r,onBlur:n,onFocus:a,onKeyDown:l})}(S)}
1016
1049
  ${f(this.protocol,w)}
1017
- ${x?s.qy` <cdtr-divider></cdtr-divider>
1050
+ ${x?o.qy` <cdtr-divider></cdtr-divider>
1018
1051
  <cdtr-row justify="flex-start" mt="1">
1019
1052
  <cdtr-title class="explain-title"
1020
1053
  ><lang-text
@@ -1030,18 +1063,18 @@
1030
1063
  </paper-button>
1031
1064
  <cdtr-divider></cdtr-divider
1032
1065
  ></cdtr-row>`:null}
1033
- ${function(t,e,i,o){return t&&Array.isArray(t)&&0!==t.length?s.qy`<cdtr-list-picker
1066
+ ${function(t,e,i,s){return t&&Array.isArray(t)&&0!==t.length?o.qy`<cdtr-list-picker
1034
1067
  .selected=${e}
1035
- @change=${t=>{i({target:{value:t.target.value}}),o()}}
1068
+ @change=${t=>{i({target:{value:t.target.value}}),s()}}
1036
1069
  heading="saved_links"
1037
1070
  .list=${t}
1038
1071
  ></cdtr-list-picker>`:null}(t,c,this.onChangeLink.bind(this),this.onBlur.bind(this))}
1039
1072
  </div>
1040
1073
 
1041
- ${C=this.hasButton,I=this.onClickOk.bind(this),C?s.qy`<hr style="margin: 1rem 0; border: none; border-top: 1px solid #e0e0e0;">
1074
+ ${C=this.hasButton,I=this.onClickOk.bind(this),C?o.qy`<hr style="margin: 1rem 0; border: none; border-top: 1px solid #e0e0e0;">
1042
1075
  <cdtr-row justify="flex-end" mt="1">
1043
1076
  <paper-button fullWidth @click=${I} raised class="add-button">
1044
1077
  <lang-text text="add_now"></lang-text>
1045
1078
  </paper-button>
1046
1079
  </cdtr-row>`:null}
1047
- </div>`;var C,I,L,U,E,B,M,q}}x.styles=n,x.properties={href:{type:String,reflect:!0},value:{type:Object},protocol:{type:String},name:{type:String},label:{type:String},target:{type:String},hasButton:{type:Boolean},params:{type:Object},explain:{type:String},anchors:{type:Array},link:{},body:{type:String},subject:{type:String},autofocus:{type:Boolean},onRequest:{type:Function}},customElements.get("cdtr-link-element")||customElements.define("cdtr-link-element",x)},88385(t,e,i){i.d(e,{A:()=>a});const s=t=>!(!t||!t.match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/)),o=t=>!(!t||!t.replace("-","").match(/^[+]*[(]{0,1}[0-9]{9,9}[)]{0,1}[-\s\./0-9]*$/g)&&!t.match(/[0-9]{3}-[0-9]{3}-[0-9]{4}/));function r(t){const e={},i=/([^&=]+)=?([^&]*)/g,s=t=>{try{return decodeURIComponent(t.replace(/\+/g," "))}catch(e){return t.replace(/\+/g," ")}},o=t.indexOf("?");let r,n=-1!==o?t.substring(o+1):"";for(;null!==(r=i.exec(n));){const t=s(r[1]),i=s(r[2]);t&&(e[t]=i)}return e}function n(t){if(!t)return"";let e=t.replace(/^[^:]+:(?:\/\/)?/,"");return e=e.replace(/^\/+/,""),e=e.split("?")[0],encodeURIComponent(e).replace(/%24/g,"$")}class a{static getProtocol(t){if(!t)return"";const e=t.indexOf(":");return e>0?t.slice(0,e):""}constructor(t,e){if(this.protocol="",this.href="",this.fullHref="",this.target="_self",this.isEmail=!1,this.isPhone=!1,this.isAnchor=!1,this.url="",this.isValid=!0,this.params={},"string"==typeof t?this.href=t:t&&"object"==typeof t&&Object.assign(this,t),/^\[\[[^\]]+\]\]\?/.test(this.href)){const t=this.href;this.isValid=!1,this.protocol=e?.protocol??"",this.isEmail=!1,this.isPhone=!1,this.isAnchor=!1,this.params={...this.params,...e?.params,...r(t)};const i=t.indexOf("?");return this.url=i>-1?t.slice(0,i):t,this.href=t,void(this.fullHref=t)}this.isValid=this.isValidUrl(this.href),this.protocol=e?.protocol??a.getProtocol(this.href);const i=function(t){if(!t)return"";let e=t.replace(/^[^:]+:(?:\/\/)?/,"");return e=e.replace(/^\/+/,""),e=e.split("?")[0],e}(this.href);if(this.isEmail=s(i),this.isPhone=o(i),this.protocol||(this.isEmail?this.protocol="mailto:":this.isPhone?this.protocol="tel:":this.isValid&&(this.protocol="https:")),this.isAnchor=this.href.startsWith("#"),e?.target){if(!["_blank","_self","_parent","_top"].includes(e.target))throw new Error(`Url: invalid target "${e.target}"`);this.target=e.target}this.params={...this.params,...e?.params,...r(this.href)},this.url=n(this.href),this.protocol&&!this.protocol.endsWith(":")&&(this.protocol+=":");const l="http:"===this.protocol||"https:"===this.protocol;this.href=l?`${this.protocol}//${this.url}`:this.protocol+this.url,this.fullHref=this.getUrlWithParams(),this.href=this.getUrlWithParams()}addParam(t,e){this.href=this.href.replace(new RegExp(`${t}=[^&]*`),`${t}=${e}`),this.params[t]=e}getUrlWithParams(){let t,e="";try{t=decodeURIComponent(this.url)}catch(e){t=this.url}if(Object.keys(this.params).length>0){t+="?",e="?";for(const i in this.params){const s=this.params[i],o=encodeURIComponent(i).replace(/%24/g,"$");if(s){const i=encodeURIComponent(s).replace(/%24/g,"$");t+=`${o}=${i}&`,e+=`${o}=${i}&`}else t+=`${o}&`,e+=`${o}&`}t=t.slice(0,-1)}const i=t=>{try{return decodeURIComponent(t)}catch{return t}};if(this.protocol&&("http:"===this.protocol||"https:"===this.protocol))return i(this.protocol+"//"+t);if("whatsapp:"===this.protocol){const s=this.extractPhoneFromTextUsingRegex(t);return s.length>0?i("https://wa.me/"+s[0]+e):i("https://wa.me/"+e)}return i(this.protocol+t)}extractPhoneFromTextUsingRegex(t){if(!t)return[];const e=[...t.matchAll(/(?:whatsapp:([^?\s]+)|\+?[\d\s\-\(\)\.]{7,20})/g)];return Array.from(new Set(e.map(t=>t[1]||t[0]).filter(t=>{const e=t.replace(/\D/g,"");return e.length>=7&&e.length<=15}).map(t=>t.trim())))}isValidUrl(t){if(!t)return!1;return/^(https?:\/\/)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}(\/.*)?$/.test(t)}}a.resetURL=n}}]);
1080
+ </div>`;var C,I,L,U,E,M,B,q}}x.styles=n,x.properties={href:{type:String,reflect:!0},value:{type:Object},protocol:{type:String},name:{type:String},label:{type:String},target:{type:String},hasButton:{type:Boolean},params:{type:Object},explain:{type:String},anchors:{type:Array},link:{},body:{type:String},subject:{type:String},autofocus:{type:Boolean},onRequest:{type:Function}},customElements.get("cdtr-link-element")||customElements.define("cdtr-link-element",x)},88385(t,e,i){i.d(e,{A:()=>a});const o=t=>!(!t||!t.match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/)),s=t=>!(!t||!t.replace("-","").match(/^[+]*[(]{0,1}[0-9]{9,9}[)]{0,1}[-\s\./0-9]*$/g)&&!t.match(/[0-9]{3}-[0-9]{3}-[0-9]{4}/));function r(t){const e={},i=/([^&=]+)=?([^&]*)/g,o=t=>{try{return decodeURIComponent(t.replace(/\+/g," "))}catch(e){return t.replace(/\+/g," ")}},s=t.indexOf("?");let r,n=-1!==s?t.substring(s+1):"";for(;null!==(r=i.exec(n));){const t=o(r[1]),i=o(r[2]);t&&(e[t]=i)}return e}function n(t){if(!t)return"";let e=t.replace(/^[^:]+:(?:\/\/)?/,"");return e=e.replace(/^\/+/,""),e=e.split("?")[0],encodeURIComponent(e).replace(/%24/g,"$")}class a{static getProtocol(t){if(!t)return"";const e=t.indexOf(":");return e>0?t.slice(0,e):""}constructor(t,e){if(this.protocol="",this.href="",this.fullHref="",this.target="_self",this.isEmail=!1,this.isPhone=!1,this.isAnchor=!1,this.url="",this.isValid=!0,this.params={},"string"==typeof t?this.href=t:t&&"object"==typeof t&&Object.assign(this,t),/^\[\[[^\]]+\]\]\?/.test(this.href)){const t=this.href;this.isValid=!1,this.protocol=e?.protocol??"",this.isEmail=!1,this.isPhone=!1,this.isAnchor=!1,this.params={...this.params,...e?.params,...r(t)};const i=t.indexOf("?");return this.url=i>-1?t.slice(0,i):t,this.href=t,void(this.fullHref=t)}this.isValid=this.isValidUrl(this.href),this.protocol=e?.protocol??a.getProtocol(this.href);const i=function(t){if(!t)return"";let e=t.replace(/^[^:]+:(?:\/\/)?/,"");return e=e.replace(/^\/+/,""),e=e.split("?")[0],e}(this.href);if(this.isEmail=o(i),this.isPhone=s(i),this.protocol||(this.isEmail?this.protocol="mailto:":this.isPhone?this.protocol="tel:":this.isValid&&(this.protocol="https:")),this.isAnchor=this.href.startsWith("#"),e?.target){if(!["_blank","_self","_parent","_top"].includes(e.target))throw new Error(`Url: invalid target "${e.target}"`);this.target=e.target}this.params={...this.params,...e?.params,...r(this.href)},this.url=n(this.href),this.protocol&&!this.protocol.endsWith(":")&&(this.protocol+=":");const l="http:"===this.protocol||"https:"===this.protocol;this.href=l?`${this.protocol}//${this.url}`:this.protocol+this.url,this.fullHref=this.getUrlWithParams(),this.href=this.getUrlWithParams()}addParam(t,e){this.href=this.href.replace(new RegExp(`${t}=[^&]*`),`${t}=${e}`),this.params[t]=e}getUrlWithParams(){let t,e="";try{t=decodeURIComponent(this.url)}catch(e){t=this.url}if(Object.keys(this.params).length>0){t+="?",e="?";for(const i in this.params){const o=this.params[i],s=encodeURIComponent(i).replace(/%24/g,"$");if(o){const i=encodeURIComponent(o).replace(/%24/g,"$");t+=`${s}=${i}&`,e+=`${s}=${i}&`}else t+=`${s}&`,e+=`${s}&`}t=t.slice(0,-1)}const i=t=>{try{return decodeURIComponent(t)}catch{return t}};if(this.protocol&&("http:"===this.protocol||"https:"===this.protocol))return i(this.protocol+"//"+t);if("whatsapp:"===this.protocol){const o=this.extractPhoneFromTextUsingRegex(t);return o.length>0?i("https://wa.me/"+o[0]+e):i("https://wa.me/"+e)}return i(this.protocol+t)}extractPhoneFromTextUsingRegex(t){if(!t)return[];const e=[...t.matchAll(/(?:whatsapp:([^?\s]+)|\+?[\d\s\-\(\)\.]{7,20})/g)];return Array.from(new Set(e.map(t=>t[1]||t[0]).filter(t=>{const e=t.replace(/\D/g,"");return e.length>=7&&e.length<=15}).map(t=>t.trim())))}isValidUrl(t){if(!t)return!1;return/^(https?:\/\/)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}(\/.*)?$/.test(t)}}a.resetURL=n}}]);