@salla.sa/twilight-components 1.0.19 → 1.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{esm → twilight-components}/Helper-d07ebbc7.js +0 -0
- package/dist/twilight-components/app-globals-0f993ce5.js +3 -0
- package/dist/twilight-components/css-shim-a64b8820.js +4 -0
- package/dist/twilight-components/dom-d08ba8aa.js +73 -0
- package/dist/twilight-components/index-9c087700.js +3010 -0
- package/dist/twilight-components/index.esm.js +4 -1
- package/dist/{esm → twilight-components}/salla-branches.entry.js +1 -1
- package/dist/twilight-components/salla-button.entry.js +75 -0
- package/dist/{esm → twilight-components}/salla-localization.entry.js +1 -1
- package/dist/{esm/salla-login-38586400.js → twilight-components/salla-login-57b18c2c.js} +1 -1
- package/dist/twilight-components/salla-login.entry.js +3 -0
- package/dist/twilight-components/salla-modal.entry.js +113 -0
- package/dist/twilight-components/salla-offer.entry.js +75 -0
- package/dist/{esm → twilight-components}/salla-product-availability.entry.js +1 -1
- package/dist/twilight-components/salla-rating.entry.js +228 -0
- package/dist/{esm/salla-search-ca856aab.js → twilight-components/salla-search-30fec1e8.js} +1 -1
- package/dist/twilight-components/salla-search.entry.js +3 -0
- package/dist/{esm/salla-button_5.entry.js → twilight-components/salla-tel-input.entry.js} +33 -294
- package/dist/twilight-components/salla-verify.entry.js +114 -0
- package/dist/twilight-components/shadow-css-bc14d9fd.js +389 -0
- package/dist/twilight-components/twilight-components.css +3 -1
- package/dist/twilight-components/twilight-components.esm.js +125 -1
- package/dist/types/components/salla-offer/offer-schema.d.ts +47 -0
- package/dist/types/components/salla-offer/salla-offer.d.ts +13 -48
- package/dist/types/components/salla-rating/order-feedback-response.d.ts +62 -0
- package/dist/types/components/salla-rating/salla-rating.d.ts +25 -23
- package/dist/types/components.d.ts +2 -10
- package/package.json +1 -1
- package/dist/cjs/Helper-fcea994c.js +0 -23
- package/dist/cjs/index-4b8b3ffe.js +0 -1696
- package/dist/cjs/index.cjs.js +0 -13
- package/dist/cjs/loader.cjs.js +0 -21
- package/dist/cjs/salla-branches.cjs.entry.js +0 -92
- package/dist/cjs/salla-button_5.cjs.entry.js +0 -1686
- package/dist/cjs/salla-localization.cjs.entry.js +0 -82
- package/dist/cjs/salla-login-008cc893.js +0 -125
- package/dist/cjs/salla-offer.cjs.entry.js +0 -50
- package/dist/cjs/salla-product-availability.cjs.entry.js +0 -75
- package/dist/cjs/salla-rating.cjs.entry.js +0 -300
- package/dist/cjs/salla-search-c7aad59a.js +0 -81
- package/dist/cjs/salla-search.cjs.entry.js +0 -11
- package/dist/cjs/twilight-components.cjs.js +0 -19
- package/dist/collection/Helpers/Helper.js +0 -19
- package/dist/collection/collection-manifest.json +0 -22
- package/dist/collection/components/generate-summary.js +0 -35
- package/dist/collection/components/salla-branches/salla-branches.css +0 -12
- package/dist/collection/components/salla-branches/salla-branches.js +0 -233
- package/dist/collection/components/salla-button/salla-button.css +0 -3
- package/dist/collection/components/salla-button/salla-button.js +0 -246
- package/dist/collection/components/salla-localization/salla-localization.js +0 -208
- package/dist/collection/components/salla-login/salla-login.css +0 -3
- package/dist/collection/components/salla-login/salla-login.js +0 -378
- package/dist/collection/components/salla-modal/salla-modal.js +0 -459
- package/dist/collection/components/salla-offer/salla-offer.js +0 -81
- package/dist/collection/components/salla-product-availability/salla-product-availability.js +0 -331
- package/dist/collection/components/salla-rating/salla-rating.css +0 -7
- package/dist/collection/components/salla-rating/salla-rating.js +0 -483
- package/dist/collection/components/salla-search/salla-search.js +0 -132
- package/dist/collection/components/salla-tel-input/salla-tel-input.js +0 -14
- package/dist/collection/components/salla-verify/salla-verify.js +0 -273
- package/dist/collection/index.js +0 -2
- package/dist/collection/interfaces/colors.js +0 -1
- package/dist/collection/interfaces/index.js +0 -2
- package/dist/collection/interfaces/ratio.js +0 -1
- package/dist/collection/plugins/tailwind-theme/generator.js +0 -62
- package/dist/collection/plugins/tailwind-theme/index.js +0 -26
- package/dist/esm/index-092659c7.js +0 -1668
- package/dist/esm/index.js +0 -4
- package/dist/esm/loader.js +0 -17
- package/dist/esm/polyfills/core-js.js +0 -11
- package/dist/esm/polyfills/css-shim.js +0 -1
- package/dist/esm/polyfills/dom.js +0 -79
- package/dist/esm/polyfills/es5-html-element.js +0 -1
- package/dist/esm/polyfills/index.js +0 -34
- package/dist/esm/polyfills/system.js +0 -6
- package/dist/esm/salla-offer.entry.js +0 -46
- package/dist/esm/salla-rating.entry.js +0 -296
- package/dist/esm/salla-search.entry.js +0 -3
- package/dist/esm/twilight-components.js +0 -17
- package/dist/index.cjs.js +0 -1
- package/dist/index.js +0 -1
- package/dist/twilight-components/p-03d0ec44.entry.js +0 -1
- package/dist/twilight-components/p-13a55257.entry.js +0 -1
- package/dist/twilight-components/p-160062c6.js +0 -1
- package/dist/twilight-components/p-47f17d3b.js +0 -1
- package/dist/twilight-components/p-5307c7b5.entry.js +0 -1
- package/dist/twilight-components/p-6a1f43c6.entry.js +0 -1
- package/dist/twilight-components/p-7088e517.entry.js +0 -1
- package/dist/twilight-components/p-924e3c88.js +0 -1
- package/dist/twilight-components/p-e8965b01.js +0 -1
- package/dist/twilight-components/p-ecb1b6cc.entry.js +0 -1
- package/dist/twilight-components/p-f11b401a.entry.js +0 -1
|
@@ -1,296 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, h, H as Host, g as getElement } from './index-092659c7.js';
|
|
2
|
-
import { H as Helper } from './Helper-d07ebbc7.js';
|
|
3
|
-
|
|
4
|
-
const sallaRatingCss = ":host{display:block}.unicode{unicode-bidi:plaintext}";
|
|
5
|
-
|
|
6
|
-
const SallaRating = class {
|
|
7
|
-
constructor(hostRef) {
|
|
8
|
-
registerInstance(this, hostRef);
|
|
9
|
-
this.order = {
|
|
10
|
-
shipping: { id: 5622 },
|
|
11
|
-
products: [
|
|
12
|
-
{
|
|
13
|
-
"title": "ميكروفون عالى الجودة",
|
|
14
|
-
"image": "https://salla-dev.s3.eu-central-1.amazonaws.com/Mvyk/pMdEEyMVpZFj4L1Hrdm2g48AuiSx0TrKULBiOnPo.jpg",
|
|
15
|
-
"price": "10,978.00 ر.س",
|
|
16
|
-
"qty": "2",
|
|
17
|
-
"totalBefore": "1120 ر.س",
|
|
18
|
-
"discount": "-5%",
|
|
19
|
-
"total": "1064 ر.س",
|
|
20
|
-
"id": "2314513454",
|
|
21
|
-
"getOptimusRouteKey": "7351233357"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"title": "ميكروفون عالى الجودة",
|
|
25
|
-
"image": "https://salla-dev.s3.eu-central-1.amazonaws.com/Mvyk/pMdEEyMVpZFj4L1Hrdm2g48AuiSx0TrKULBiOnPo.jpg",
|
|
26
|
-
"price": "10,978.00 ر.س",
|
|
27
|
-
"qty": "2",
|
|
28
|
-
"totalBefore": "1120 ر.س",
|
|
29
|
-
"discount": "-5%",
|
|
30
|
-
"total": "1064 ر.س",
|
|
31
|
-
"id": "2314513454",
|
|
32
|
-
"getOptimusRouteKey": "7351233357"
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
"title": "ساعة ذكية بنظام اندرويد",
|
|
36
|
-
"image": "https://salla-dev.s3.eu-central-1.amazonaws.com/Mvyk/T4kTqYNuPAZmPMLw1bx92RnjVMZyFszVXOUZQsFJ.jpg",
|
|
37
|
-
"price": "10,978.00 ر.س",
|
|
38
|
-
"qty": "2",
|
|
39
|
-
"totalBefore": "1120 ر.س",
|
|
40
|
-
"discount": "-5%",
|
|
41
|
-
"total": "1064 ر.س",
|
|
42
|
-
"id": "679822376",
|
|
43
|
-
"getOptimusRouteKey": "73233357"
|
|
44
|
-
}
|
|
45
|
-
],
|
|
46
|
-
storeLogo: "https://salla-dev.s3.eu-central-1.amazonaws.com/Mvyk/X3NKcY7nhaFQlR7kBBHvfDpMY48cerunKrmDA1gi.png",
|
|
47
|
-
shippingLogo: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcScPt4R6KaKDldrXb-9pUljFwL3m6A72BhN6p1qZJKprwC6VbCWC_8ASZgiJAoL_l7DepM&usqp=CAU"
|
|
48
|
-
};
|
|
49
|
-
/**
|
|
50
|
-
* Set to true to display store rating step
|
|
51
|
-
*/
|
|
52
|
-
this.isStoreRating = false;
|
|
53
|
-
/**
|
|
54
|
-
* Set to true to display products rating step
|
|
55
|
-
*/
|
|
56
|
-
this.isProductsRating = false;
|
|
57
|
-
/**
|
|
58
|
-
* Set to true to display shipping rating step
|
|
59
|
-
*/
|
|
60
|
-
this.isShippingRating = false;
|
|
61
|
-
this.ratingChain = Promise.resolve();
|
|
62
|
-
this.stepsCount = 0;
|
|
63
|
-
Helper.setHost(this.host);
|
|
64
|
-
}
|
|
65
|
-
async show() {
|
|
66
|
-
return this.modal.show();
|
|
67
|
-
}
|
|
68
|
-
async hide() {
|
|
69
|
-
return this.modal.hide();
|
|
70
|
-
}
|
|
71
|
-
componentWillLoad() {
|
|
72
|
-
this.stepsCount = [this.isStoreRating, this.isProductsRating, this.isShippingRating].filter(item => item).length;
|
|
73
|
-
// this.getData();
|
|
74
|
-
}
|
|
75
|
-
componentDidRender() {
|
|
76
|
-
this.show();
|
|
77
|
-
this.initiateRating();
|
|
78
|
-
}
|
|
79
|
-
initiateRating() {
|
|
80
|
-
this.handleWizard();
|
|
81
|
-
this.handleSubmitRating();
|
|
82
|
-
this.starsRating();
|
|
83
|
-
this.highlightSelectedStars();
|
|
84
|
-
}
|
|
85
|
-
// getdata
|
|
86
|
-
// private getData() {
|
|
87
|
-
// salla.api.order.endpointsMethods.details = 'get'
|
|
88
|
-
// salla.order.api.details(salla.config.page.id).then(data => console.log(''));
|
|
89
|
-
// }
|
|
90
|
-
// handle wizard
|
|
91
|
-
handleWizard() {
|
|
92
|
-
let index = 0, steps = this.host.querySelectorAll(".s-rating-step"), dots = this.host.querySelectorAll(".s-rating-step-dot"), nextBtnText = this.host.querySelector('#next-btn .s-button-text');
|
|
93
|
-
this.setModalHeight(steps[0]);
|
|
94
|
-
this.showActiveStep(steps, dots, index, nextBtnText);
|
|
95
|
-
Helper.onClick("#prev-btn", () => {
|
|
96
|
-
index > 0 && index--;
|
|
97
|
-
this.showActiveStep(steps, dots, index, nextBtnText);
|
|
98
|
-
index == 0 && Helper.toggle('#prev-btn', 's-rating-unvisiable', 'block', () => true);
|
|
99
|
-
});
|
|
100
|
-
Helper.onClick("#next-btn", () => {
|
|
101
|
-
this.ratingValidation();
|
|
102
|
-
if (index == this.stepsCount - 1) {
|
|
103
|
-
salla.event.dispatch("submit::order-rating");
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
index < this.stepsCount - 1 && index++;
|
|
107
|
-
this.showActiveStep(steps, dots, index, nextBtnText);
|
|
108
|
-
Helper.toggle('#prev-btn', 'block', 's-rating-unvisiable', () => true);
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
showActiveStep(steps, dots, index, nextBtnText) {
|
|
113
|
-
var _a;
|
|
114
|
-
// Active step
|
|
115
|
-
Helper.toggle('.s-rating-step', 's-rating-hidden', 's-rating-active', () => true);
|
|
116
|
-
Helper.toggleElement(steps[index], 's-rating-unactive', 's-rating-hidden', () => true);
|
|
117
|
-
setTimeout(() => Helper.toggleElement(steps[index], 's-rating-active', 's-rating-unactive', () => true), 200);
|
|
118
|
-
// Hanle dots
|
|
119
|
-
Helper.toggle('.s-rating-step-dot', 's-rating-bg-gray', 's-rating-bg-primary', () => true);
|
|
120
|
-
this.stepsCount > 1 && Helper.toggleElement(dots[index], 's-rating-bg-primary', 's-rating-bg-gray', () => true);
|
|
121
|
-
// Btn text
|
|
122
|
-
nextBtnText.innerHTML = ((_a = steps[index + 1]) === null || _a === void 0 ? void 0 : _a.dataset.stepName) || salla.lang.get('pages.rating.send_ratings');
|
|
123
|
-
this.setModalHeight(steps[index]);
|
|
124
|
-
}
|
|
125
|
-
setModalHeight(current) {
|
|
126
|
-
const wrapper = this.host.querySelector('.s-rating-wrapper');
|
|
127
|
-
setTimeout(() => wrapper === null || wrapper === void 0 ? void 0 : wrapper.setAttribute('style', 'height:' + (current === null || current === void 0 ? void 0 : current.scrollHeight) + 'px'));
|
|
128
|
-
}
|
|
129
|
-
// Listen to submit::order-rating event used in handleWizard()
|
|
130
|
-
handleSubmitRating() {
|
|
131
|
-
salla.event.on('submit::order-rating', () => this.sendRating().then(() => {
|
|
132
|
-
// Handle timer
|
|
133
|
-
let thankYouView = this.host.querySelector('.s-rating-thanks'), seconds = 10;
|
|
134
|
-
let timeToClose = setInterval(() => {
|
|
135
|
-
seconds--;
|
|
136
|
-
this.host.querySelector('.s-rating-thanks-time').innerHTML = `00:0${seconds}`;
|
|
137
|
-
if (seconds == 0) {
|
|
138
|
-
this.hide();
|
|
139
|
-
clearInterval(timeToClose);
|
|
140
|
-
}
|
|
141
|
-
}, 1000);
|
|
142
|
-
// Hide steps and show thanks msg
|
|
143
|
-
Helper.toggle('.s-rating-step', 's-rating-hidden', 's-rating-active', () => true);
|
|
144
|
-
this.host.querySelector('.s-rating-footer').classList.add('s-rating-unvisiable');
|
|
145
|
-
Helper.toggleElement(thankYouView, 's-rating-unactive', 's-rating-hidden', () => true);
|
|
146
|
-
setTimeout(() => Helper.toggleElement(thankYouView, 's-rating-active', 's-rating-unactive', () => true), 200);
|
|
147
|
-
this.setModalHeight(thankYouView);
|
|
148
|
-
}));
|
|
149
|
-
}
|
|
150
|
-
// handle star rating
|
|
151
|
-
starsRating() {
|
|
152
|
-
let selectedClasses = ['selected'];
|
|
153
|
-
// Listen for form submissions
|
|
154
|
-
salla.document.event.onSubmit('.s-rating-stars-element', function (event) {
|
|
155
|
-
// Prevent form from submitting
|
|
156
|
-
event.preventDefault();
|
|
157
|
-
// Get the selected star - activeElement is not supported in safari
|
|
158
|
-
var activeStars = event.target.querySelectorAll('.s-rating-btn-star.hovered');
|
|
159
|
-
var selected = activeStars[activeStars.length - 1];
|
|
160
|
-
if (!selected)
|
|
161
|
-
return;
|
|
162
|
-
var selectedIndex = parseInt(selected.dataset.star, 10);
|
|
163
|
-
event.target.querySelector('.rating_hidden_input').value = selectedIndex;
|
|
164
|
-
// Get all stars in this form (only search in the form, not the whole document)
|
|
165
|
-
// Loop through each star, and add or remove the `.selected` class to toggle highlighting
|
|
166
|
-
event.target
|
|
167
|
-
.querySelectorAll('.s-rating-btn-star')
|
|
168
|
-
.forEach(function (star, index) {
|
|
169
|
-
if (index < selectedIndex) {
|
|
170
|
-
// Selected star or before it, Add highlighting
|
|
171
|
-
star.classList.add(...selectedClasses);
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
// After selected star, Remove highlight
|
|
175
|
-
star.classList.remove(...selectedClasses);
|
|
176
|
-
});
|
|
177
|
-
// Remove aria-pressed from any previously selected star
|
|
178
|
-
var previousRating = event.target.querySelector('.s-rating-btn-star[aria-pressed="true"]');
|
|
179
|
-
if (previousRating) {
|
|
180
|
-
previousRating.removeAttribute('aria-pressed');
|
|
181
|
-
}
|
|
182
|
-
// Add aria-pressed role to the selected button
|
|
183
|
-
selected.setAttribute('aria-pressed', true);
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
highlightSelectedStars() {
|
|
187
|
-
let hover = ['hovered'];
|
|
188
|
-
Helper.all('.s-rating-stars-element', el => {
|
|
189
|
-
let starElements = el.querySelectorAll('.s-rating-btn-star');
|
|
190
|
-
// remove hovered state from stars ---
|
|
191
|
-
el.addEventListener('mouseout', () => starElements.forEach(star => star.classList.remove(...hover)));
|
|
192
|
-
starElements.forEach((starElement, index) => {
|
|
193
|
-
starElement.addEventListener('mouseover', () => {
|
|
194
|
-
starElement.classList.add(...hover);
|
|
195
|
-
if (index <= 1) {
|
|
196
|
-
starElement.previousElementSibling.tagName === 'BUTTON' ? starElement.previousElementSibling.classList.add(...hover) : null;
|
|
197
|
-
}
|
|
198
|
-
else {
|
|
199
|
-
for (let i = 0; i < index; i++) {
|
|
200
|
-
starElements[i].classList.add(...hover);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
});
|
|
204
|
-
starElement.addEventListener('mouseout', () => {
|
|
205
|
-
starElement.classList.contains(...hover) ? starElement.classList.remove(...hover) : null;
|
|
206
|
-
});
|
|
207
|
-
});
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
// send feedback rating and validation
|
|
211
|
-
sendRating() {
|
|
212
|
-
Helper.all('.s-rating-step', ratingStep => {
|
|
213
|
-
let type = ratingStep.dataset.type;
|
|
214
|
-
let formsData = [];
|
|
215
|
-
ratingStep.querySelectorAll('.rating-outer-form')
|
|
216
|
-
.forEach((form) => {
|
|
217
|
-
let formData = {};
|
|
218
|
-
form.querySelectorAll('[name]')
|
|
219
|
-
.forEach(function (input) {
|
|
220
|
-
let inputData = salla.helpers.inputData(input.name, input.value, formData);
|
|
221
|
-
formData[inputData.name] = inputData.value;
|
|
222
|
-
});
|
|
223
|
-
formsData = [];
|
|
224
|
-
formsData.push(formData);
|
|
225
|
-
this.sendFeedback(type, formsData);
|
|
226
|
-
});
|
|
227
|
-
});
|
|
228
|
-
return this.ratingChain;
|
|
229
|
-
}
|
|
230
|
-
sendFeedback(type, formsData) {
|
|
231
|
-
if (!formsData || formsData.length == 0) {
|
|
232
|
-
return;
|
|
233
|
-
}
|
|
234
|
-
this.nextBtn.load();
|
|
235
|
-
salla.config.canLeave = false;
|
|
236
|
-
this.ratingChain = salla.feedback.api[type](formsData[0])
|
|
237
|
-
.then(function () {
|
|
238
|
-
salla.config.canLeave = true;
|
|
239
|
-
}).catch(() => salla.config.canLeave = true);
|
|
240
|
-
}
|
|
241
|
-
ratingValidation() {
|
|
242
|
-
let errorMsg = '';
|
|
243
|
-
document.querySelectorAll('.s-rating-step.s-rating-active')
|
|
244
|
-
.forEach((ratingSection) => {
|
|
245
|
-
ratingSection.querySelectorAll('.rating-outer-form')
|
|
246
|
-
.forEach((rating) => {
|
|
247
|
-
let ratingInput = rating.querySelector('.rating_hidden_input');
|
|
248
|
-
let commentInput = rating.querySelector('.s-rating-comment');
|
|
249
|
-
let validationMessage = rating.querySelector('.s-rating-validation-msg');
|
|
250
|
-
if (ratingInput.value && commentInput.value && commentInput.value.length > 3) {
|
|
251
|
-
commentInput.classList.remove('s-rating-has-error');
|
|
252
|
-
validationMessage.innerHTML = '';
|
|
253
|
-
return;
|
|
254
|
-
}
|
|
255
|
-
else if (commentInput.value && commentInput.value.length > 3) {
|
|
256
|
-
commentInput.classList.remove('s-rating-has-error');
|
|
257
|
-
}
|
|
258
|
-
else {
|
|
259
|
-
commentInput.classList.add('s-rating-has-error');
|
|
260
|
-
}
|
|
261
|
-
errorMsg = ratingInput.value
|
|
262
|
-
? (salla.lang.get('common.errors.not_less_than_chars', { chars: 4 }) + ' ' + commentInput.getAttribute('placeholder'))
|
|
263
|
-
: (rating.dataset.starsError || salla.lang.get('pages.rating.rate_store_stars'));
|
|
264
|
-
validationMessage.innerHTML = errorMsg;
|
|
265
|
-
});
|
|
266
|
-
});
|
|
267
|
-
//Fire error to prevent going to next step
|
|
268
|
-
if (errorMsg) {
|
|
269
|
-
throw new Error(errorMsg);
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
// render
|
|
273
|
-
render() {
|
|
274
|
-
return (h(Host, null, h("salla-modal", { class: "hidden", "modal-width": "w-[800px]", ref: modal => this.modal = modal, title: salla.lang.get('pages.rating.rate_order') + ' <span class="unicode">(#' + this.orderId + ')</span>' }, h("div", { class: "s-rating-wrapper " }, this.isStoreRating && this.renderStoreRating(), this.isProductsRating && this.renderProductsRating(), this.isShippingRating && this.renderShippingRating(), this.renderThanksView()), h("div", { class: "s-rating-footer" }, h("button", { id: "prev-btn", class: "s-rating-btn s-rating-unvisiable" }, salla.lang.get('pages.order.rating_prev')), this.stepsCount > 1 ?
|
|
275
|
-
h("ul", { class: "s-rating-dots" }, [0, 1, 2].slice(0, this.stepsCount).map(index => h("li", { class: `${index == 0 ? 's-rating-bg-primary' : 's-rating-bg-gray'} s-rating-step-dot` }))) : '', h("salla-button", { id: "next-btn", ref: nextBtn => this.nextBtn = nextBtn }, "\u0627\u0644\u062A\u0627\u0644\u064A")))));
|
|
276
|
-
}
|
|
277
|
-
renderStoreRating() {
|
|
278
|
-
return (h("section", { class: "s-rating-step", "data-type": "store", "data-step-name": salla.lang.get('pages.rating.rate') + ' ' + salla.lang.get('pages.rating.store') }, h("div", { class: "rating-outer-form s-rating-step-wrap", "data-stars-error": salla.lang.get('pages.rating.rate_store_stars') }, h("input", { type: "hidden", name: "order_id", value: this.orderId }), h("input", { type: "hidden", name: "type", value: "store" }), h("div", { class: "s-rating-rounded-icon" }, h("img", { src: this.order.storeLogo, alt: "store name", class: "s-rating-store-logo" })), h("h2", { class: "s-rating-title" }, salla.lang.get('pages.rating.rate_the_store')), h("div", { class: "s-rating-stars-company" }, " ", this.getStarsRating('large')), h("textarea", { id: "storeReview", name: "comment", class: "s-rating-comment", placeholder: salla.lang.get('pages.rating.write_store_rate') }), h("small", { class: "s-rating-validation-msg" }))));
|
|
279
|
-
}
|
|
280
|
-
renderShippingRating() {
|
|
281
|
-
return (h("section", { class: "s-rating-step", "data-type": "shipping", "data-step-name": salla.lang.get('pages.rating.rate') + ' ' + salla.lang.get('pages.rating.shipping') }, h("div", { class: "rating-outer-form s-rating-step-wrap", "data-stars-error": salla.lang.get('pages.rating.rate_shipping_stars') }, h("input", { type: "hidden", name: "order_id", value: this.orderId }), h("input", { type: "hidden", name: "shipping_company_id", value: this.order.shipping.id }), h("input", { type: "hidden", name: "type", value: "shipping" }), h("div", { class: "s-rating-rounded-icon" }, h("img", { src: this.order.shippingLogo, alt: "company name", class: "s-rating-shipping-logo" })), h("h2", { class: "s-rating-title" }, " ", salla.lang.get('pages.rating.rate_shipping'), " \u0627\u0631\u0627\u0645\u0643\u0633"), h("div", { class: "s-rating-stars-company" }, " ", this.getStarsRating('large')), h("textarea", { id: "shippingReview", name: "comment", class: "s-rating-comment", placeholder: salla.lang.get('pages.rating.write_shipping_rate') }), h("small", { class: "s-rating-validation-msg" }))));
|
|
282
|
-
}
|
|
283
|
-
renderProductsRating() {
|
|
284
|
-
return (h("section", { class: "s-rating-step", "data-type": "product", "data-step-name": salla.lang.get('pages.rating.rate') + ' ' + salla.lang.get('pages.rating.products') }, this.order.products.map((item, index) => h("div", { class: "rating-outer-form s-rating-product", "data-stars-error": salla.lang.get('pages.order.rate_product_stars') }, h("img", { src: item.image, alt: item.title, class: "s-rating-product-img" }), h("div", { class: "s-rating-product-details" }, h("h3", { class: "s-rating-product-title" }, " ", item.title), h("div", { class: "s-rating-stars-product" }, " ", this.getStarsRating('small')), h("input", { type: "hidden", name: "order_id", value: this.orderId }), h("input", { type: "hidden", name: `products[${index}][product_id]`, value: item.getOptimusRouteKey }), h("input", { type: "hidden", name: "type", value: "products" }), h("textarea", { "data-product-id": item.id, name: `products[${index}][comment]`, id: `productReview_${item.id}`, class: "s-rating-comment", placeholder: salla.lang.get('pages.rating.write_product_rate') }), h("small", { class: "s-rating-validation-msg" }))))));
|
|
285
|
-
}
|
|
286
|
-
renderThanksView() {
|
|
287
|
-
return (h("div", { class: "s-rating-thanks s-rating-hidden" }, h("span", { class: "s-rating-thanks-icon sicon-check-circle2" }), h("h3", { class: "s-rating-thanks-title" }, salla.lang.get('pages.rating.thanks')), h("div", { class: "s-rating-thanks-msg", innerHTML: this.thanksMsg }), h("a", { href: "#!", onClick: () => this.hide(), class: "s-rating-thanks-btn" }, "\u0639\u0648\u062F\u0629 \u0625\u0644\u064A \u062A\u0641\u0627\u0635\u064A\u0644 \u0627\u0644\u0637\u0644\u0628"), h("time", { class: "s-rating-thanks-time" })));
|
|
288
|
-
}
|
|
289
|
-
getStarsRating(size) {
|
|
290
|
-
return (h("form", { class: "s-rating-stars-element" }, h("input", { type: "hidden", class: "rating_hidden_input", name: "rating", value: "" }), [1, 2, 3, 4, 5].map((star) => h("button", { type: "submit", class: `s-rating-btn-star s-rating-btn-star-` + size, "data-star": star }, h("i", { class: "sicon-star2" })))));
|
|
291
|
-
}
|
|
292
|
-
get host() { return getElement(this); }
|
|
293
|
-
};
|
|
294
|
-
SallaRating.style = sallaRatingCss;
|
|
295
|
-
|
|
296
|
-
export { SallaRating as salla_rating };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { p as promiseResolve, b as bootstrapLazy } from './index-092659c7.js';
|
|
2
|
-
|
|
3
|
-
/*
|
|
4
|
-
Stencil Client Patch Browser v2.8.1 | MIT Licensed | https://stenciljs.com
|
|
5
|
-
*/
|
|
6
|
-
const patchBrowser = () => {
|
|
7
|
-
const importMeta = import.meta.url;
|
|
8
|
-
const opts = {};
|
|
9
|
-
if (importMeta !== '') {
|
|
10
|
-
opts.resourcesUrl = new URL('.', importMeta).href;
|
|
11
|
-
}
|
|
12
|
-
return promiseResolve(opts);
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
patchBrowser().then(options => {
|
|
16
|
-
return bootstrapLazy([["salla-button_5",[[0,"salla-login",{"isLoginByMail":[4,"is-login-by-mail"],"loginTypeTitle":[1,"login-type-title"],"loginText":[1,"login-text"],"smsLabel":[1,"sms-label"],"mobileLabel":[1,"mobile-label"],"emailLabel":[1,"email-label"],"enterText":[1,"enter-text"],"bySMSText":[1,"by-s-m-s-text"],"byEmailText":[1,"by-email-text"],"backText":[1,"back-text"],"show":[64]},[[0,"verified","onVerified"],[0,"backClicked","onbackClicked"]]],[0,"salla-verify",{"withoutModal":[4,"without-modal"],"url":[1],"by":[1],"backText":[1,"back-text"],"autoReload":[4,"auto-reload"],"getCode":[64],"show":[64]}],[1,"salla-tel-input"],[4,"salla-button",{"btnStyle":[513,"btn-style"],"loading":[516],"disabled":[516],"loaderPosition":[1,"loader-position"],"wide":[4],"load":[64],"stop":[64],"disable":[64],"enable":[64]}],[4,"salla-modal",{"error":[4],"success":[4],"primary":[4],"isClosable":[1028,"is-closable"],"width":[513],"visible":[516],"isLoading":[1540,"is-loading"],"subTitleFirst":[4,"sub-title-first"],"subTitle":[1,"sub-title"],"icon":[1],"imageIcon":[1,"image-icon"],"title":[32],"show":[64],"hide":[64],"setTitle":[64],"loading":[64],"stopLoading":[64]}]]],["salla-branches",[[4,"salla-branches",{"position":[1],"displayAs":[1,"display-as"],"browseProductsFrom":[1,"browse-products-from"],"branches":[16],"current":[1026],"open":[32],"selected":[32],"isOpenedBefore":[32],"show":[64],"hide":[64]}]]],["salla-localization",[[4,"salla-localization",{"languagesTitle":[1,"languages-title"],"currenciesTitle":[1,"currencies-title"],"ok":[1],"show":[64],"hide":[64],"submit":[64]}]]],["salla-product-availability",[[4,"salla-product-availability",{"channels":[1],"buttonText":[1,"button-text"],"countryCode":[1,"country-code"],"subscribeText":[1,"subscribe-text"],"cancelText":[1,"cancel-text"],"subTitle":[1,"sub-title"],"mobileLabel":[1,"mobile-label"],"emailLabel":[1,"email-label"],"mobilePlaceholder":[1,"mobile-placeholder"],"emailPlaceholder":[1,"email-placeholder"],"productId":[2,"product-id"],"subscribedMessage":[1,"subscribed-message"],"isSubscribed":[1028,"is-subscribed"],"submit":[64]}]]],["salla-rating",[[0,"salla-rating",{"orderId":[2,"order-id"],"thanksMsg":[1,"thanks-msg"],"isStoreRating":[4,"is-store-rating"],"isProductsRating":[4,"is-products-rating"],"isShippingRating":[4,"is-shipping-rating"],"show":[64],"hide":[64]}]]],["salla-offer",[[0,"salla-offer",{"offer":[32],"show":[64]}]]],["salla-search",[[0,"salla-search",{"placeholder":[1],"noResultsText":[1,"no-results-text"],"results":[32]},[[0,"modalClosed","onModalClose"]]]]]], options);
|
|
17
|
-
});
|
package/dist/index.cjs.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('./cjs/index.cjs.js');
|
package/dist/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './esm/index.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{S as salla_search}from"./p-924e3c88.js";import"./p-e8965b01.js";import"./p-47f17d3b.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as s,h as e,g as r}from"./p-e8965b01.js";const a=class{constructor(e){s(this,e),this.offer=null,salla.offer.event.onExisted((s=>{salla.localStore.get("remember-offer-"+s.offer.offer_id)?salla.log("User selected to don't show this offer again."):this.show(s.product_id)}))}async show(s){this.modal.show().then((()=>salla.api.offer.details(s))).then((s=>this.offer=s.data[0])).then((()=>console.log(this.offer)))}rememberMe(s){salla.localStore.set("remember-offer-"+this.offer.id,s.target.checked)}render(){var s,r;return e("salla-modal",{ref:s=>this.modal=s,"is-loading":null===this.offer},null!==this.offer?[e("div",{class:"s-offer-header"},e("b",{class:"s-offer-title"},this.offer.name),e("h3",{class:"s-offer-subtitle"},this.offer.message)),e("div",{class:"s-offer-body"},(null===(s=this.offer.get.categories)||void 0===s?void 0:s.length)>0?this.offer.get.categories.map((s=>e("a",{href:s.urls.customer,class:"s-offer-badge"},e("i",{class:"s-offer-badge-icon sicon-tag"}),e("span",{class:"s-offer-badge-text"},s.name)))):null===(r=this.offer.get.products)||void 0===r?void 0:r.map((s=>e("div",{class:"s-offer-product"},"- ",s.name)))),e("div",{class:"s-offer-footer"},this.offer.expiry_date?e("p",{class:"s-offer-expiry"},salla.lang.get("pages.products.offer_expires_in")," ",this.offer.expiry_date):"",e("label",{class:"s-offer-remember-label"},e("input",{type:"checkbox",onChange:s=>this.rememberMe(s),class:"s-offer-remember-input"})," ",salla.lang.get("common.remember_my_choice")))]:"")}componentDidRender(){this.modal.querySelectorAll("[hidden]").forEach((s=>s.removeAttribute("hidden")))}get host(){return r(this)}};export{a as salla_offer}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as s,h as i,g as t}from"./p-e8965b01.js";import{H as l}from"./p-47f17d3b.js";const e=class{constructor(i){s(this,i),this.regType="sms",this.isLoginByMail=!0,this.loginTypeTitle=salla.lang.get("blocks.header.select_login_way"),this.loginText=salla.lang.get("blocks.header.login"),this.smsLabel=salla.lang.get("blocks.header.sms"),this.mobileLabel=salla.lang.get("common.elements.mobile"),this.emailLabel=salla.lang.get("common.elements.email"),this.enterText=salla.lang.get("blocks.header.enter"),this.bySMSText=salla.lang.get("blocks.header.login_by_sms"),this.byEmailText=salla.lang.get("blocks.header.login_by_email"),this.backText=salla.lang.get("common.elements.back"),this.title=this.host.title||salla.lang.get("blocks.header.login"),this.host.removeAttribute("title"),salla.auth.event.onVerificationFailed((()=>{}))}onVerified(s){if(s.detail.case){if("new_customer"===s.detail.case)return this.showTab(this.tab5);if("redirect"===salla.auth.event.getTypeActionOnVerified())return s.redirect_url?window.location.href=s.redirect_url:void window.location.reload()}else console.log("verified but without case!")}onbackClicked(){this.showTab("sms"==this.regType?this.tab2:this.tab3)}async show(){return this.showTab(this.isLoginByMail?this.tab1:this.tab2),this.modal.show()}showTab(s){[this.tab1,this.tab2,this.tab3,this.tab4,this.tab5].map((i=>l.toggleElement(i,"visible","hidden",(()=>i==s)))),setTimeout((()=>{[this.tab1,this.tab2,this.tab3,this.tab4,this.tab5].map((i=>l.toggleElement(i,"s-login-active","s-login-unactive",(()=>i==s))))}),200),setTimeout((()=>{this.host.querySelector(".s-login-wrapper").setAttribute("style","height:"+(null==s?void 0:s.scrollHeight)+"px")})),[this.tab2,this.tab3].includes(s)&&(this.regType=s===this.tab2?"sms":"email");let i=s==this.tab5;return this.modal.setTitle(i?salla.lang.get("common.titles.registration"):this.title),i||l.toggleElement(this.regMobileBlock,"s-hidden","s-block",(()=>"sms"===this.regType)).toggleElement(this.regEmailBlock,"s-hidden","s-block",(()=>"email"===this.regType)),this}loginByEmail(){if(!l.isValidEmail(this.email.value))return this.email.classList.add("s-has-error"),void(this.email.nextElementSibling.innerText="* "+salla.lang.get("common.elements.email_is_valid"));this.email.nextElementSibling.innerText="",this.email.classList.remove("s-has-error"),salla.auth.api.login({type:"email",email:this.email.value}).then((()=>this.showTab(this.tab4))).then((()=>(this.tab4.by="email")&&(this.tab4.url="auth/email/verify"))).then((()=>this.tab4.show({email:this.email.value})))}loginBySMS(){if(this.mobile.value.length<6)return this.mobile.classList.add("s-has-error"),void(this.mobile.nextElementSibling.innerText="* "+salla.lang.get("mobile_app.strings.incorrect_mobile"));this.mobile.nextElementSibling.innerText="",this.mobile.classList.remove("s-has-error"),salla.auth.api.login({type:"sms",mobile:this.mobile.value}).then((()=>this.showTab(this.tab4))).then((()=>(this.tab4.by="sms")&&(this.tab4.url="auth/mobile/verify"))).then((()=>this.tab4.show({mobile:this.mobile.value,country_code:"SA"})))}typing({target:s}){"tel"===s.type&&salla.helpers.digitsOnly(s),s.classList.remove("s-has-error"),s.nextElementSibling.innerText=""}newUser(){this.tab4.getCode().then((s=>salla.auth.api.register({first_name:this.firstName.value,last_name:this.lastName.value,phone:this.regMobile.value||this.mobile.value,email:this.regEmail.value||this.email.value,country_code:"",country_key:"",code:s,verified_by:this.regType})))}render(){return i("salla-modal",{id:"salla-login",title:this.title,ref:s=>this.modal=s,width:"xs"},i("div",{class:"s-login-wrapper"},this.isLoginByMail?i("div",{class:"s-login-tab",ref:s=>this.tab1=s},i("p",{class:"s-login-sub-title"},this.loginTypeTitle),i("a",{href:"#",class:"s-login-main-btn",onClick:()=>this.showTab(this.tab2)},i("i",{class:"s-login-main-btn-icon sicon-phone"}),i("span",{class:"s-login-main-btn-text"},this.smsLabel),i("i",{class:"main-btn-arrow sicon-keyboard_arrow_left"})),i("a",{href:"#",class:"s-login-main-btn",onClick:()=>this.showTab(this.tab3)},i("i",{class:"s-login-main-btn-icon sicon-mail"}),i("span",{class:"s-login-main-btn-text"},this.emailLabel),i("i",{class:"main-btn-arrow sicon-keyboard_arrow_left"}))):"",i("div",{class:"s-login-tab",ref:s=>this.tab2=s},i("label",{class:"s-login-label"},this.mobileLabel),i("salla-tel-input",null),i("input",{onChange:()=>this.loginBySMS(),type:"tel",ref:s=>this.mobile=s,onInput:this.typing,placeholder:"5xx xxx xxx",class:"s-login-input tel-input s-ltr"}),i("span",{class:"s-login-error-message"}),i("salla-button",{wide:!0,onClick:()=>this.loginBySMS()},this.enterText),this.isLoginByMail?i("a",{href:"#",onClick:()=>this.showTab(this.tab3),class:"s-login-link"},this.byEmailText):""),this.isLoginByMail?i("div",{class:"s-login-tab",ref:s=>this.tab3=s},i("label",{class:"s-login-label"},this.emailLabel),i("input",{onChange:()=>this.loginByEmail(),type:"email",ref:s=>this.email=s,onInput:this.typing,placeholder:"your@email.com",class:"s-login-input s-ltr"}),i("span",{class:"s-login-error-message"}),i("salla-button",{wide:!0,onClick:()=>this.loginByEmail()},this.enterText),i("a",{href:"#",onClick:()=>this.showTab(this.tab2),class:"s-login-link"},this.bySMSText)):"",i("salla-verify",{"without-modal":!0,ref:s=>this.tab4=s,autoReload:!1,"back-text":this.backText}),i("div",{ref:s=>this.tab5=s},i("label",{class:"s-login-label"},salla.lang.get("blocks.header.your_name")),i("input",{type:"text",class:"s-login-input",ref:s=>this.firstName=s,placeholder:salla.lang.get("pages.profile.first_name")}),i("label",{class:"s-login-label"},salla.lang.get("pages.profile.last_name")),i("input",{type:"text",class:"s-login-input",ref:s=>this.lastName=s,placeholder:salla.lang.get("pages.profile.last_name")}),i("div",{ref:s=>this.regMobileBlock=s},i("label",{class:"s-login-label"},this.mobileLabel),i("input",{type:"tel",ref:s=>this.regMobile=s,onInput:this.typing,placeholder:"5xx xxx xxx",class:"s-login-input s-ltr"}),i("span",{class:"s-login-error-message"})),i("div",{ref:s=>this.regEmailBlock=s},i("label",{class:"s-login-label"},this.emailLabel),i("input",{type:"email",ref:s=>this.regEmail=s,onInput:this.typing,placeholder:"your@email.com",class:"s-login-input s-ltr"}),i("span",{class:"s-login-error-message"})),i("salla-button",{wide:!0,onClick:()=>this.newUser()},salla.lang.get("blocks.header.register")))))}get host(){return t(this)}};e.style="salla-verify{display:block}";export{e as S}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
class t extends salla.AppHelpers{setHost(t){this.host=t}getElement(t){return this.host.querySelector(t)}getAttribute(t,e){var s;return null===(s=this.getElement(t))||void 0===s?void 0:s.getAttribute(e)}val(t){return this.getAttribute(t,"value")}isUser(){return"user"===salla.config.get("user.type")}}const e=new t;export{e as H}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as s,h as e,g as t}from"./p-e8965b01.js";let a=require("store/src/store-engine"),i=require("store/storages/sessionStorage"),h=a.createStore(i);const l=class{constructor(e){s(this,e),this.open=!1,this.isOpenedBefore=h.get("branch-choosed-before"),this.displayAs="default",this.browseProductsFrom="all",this.branches=[{id:1,name:"فرع الرياض",open:!0,available:!0,limited:!1,tag:"متوفر"},{id:2,name:"فرع جدة",open:!1,available:!1,limited:!1,tag:"غير متوفر"},{id:3,name:"فرع مكة",open:!0,available:!0,limited:!1,tag:"متوفر"},{id:4,name:"فرع المدينة",open:!0,available:!0,limited:!1,tag:"متوفر"},{id:5,name:"فرع جازان",open:!0,available:!0,limited:!0,tag:"الكمية محدودة"}],this.current=1,this.currentBranch=s=>this.branches.filter((s=>s.id==this.current))[0][s],this.statusColor=(s=null)=>s?s.limited?"s-branches-color-red":s.available?"s-branches-color-green":"s-branches-color-gray":this.currentBranch("limited")?"s-branches-color-red":this.currentBranch("available")?"s-branches-color-green":"s-branches-color-gray",this.isChoiceable=()=>"all"!==this.browseProductsFrom&&"single"==this.position||"header"==this.position,this.formTitle=()=>this.isChoiceable()?"توفر المنتج في الفروع الآخرى":"التسوق من فرع آخر",salla.event.on("branches::show",(()=>this.show()))}async show(){return this.modal.show()}async hide(){return this.modal.hide()}handelChange(s){this.selected=s.target.value}handleSubmit(){this.btn.load().then((()=>{setTimeout((()=>location.reload()),2e3)})),h.set("branch-choosed-before",!0),this.show(),setTimeout((()=>{this.current=this.selected}),300)}render(){return e("salla-modal",{icon:"sicon-store-alt",title:"فرع الرياض","sub-title":"أنت الآن تتصفح المتجر من","sub-title-first":!0,"is-closable":this.isOpenedBefore||"popup"!=this.displayAs?"true":"false",ref:s=>this.modal=s,"modal-width":"sm",id:"s-branches-modal",class:"hidden"},e("h4",{class:"s-branches-title"},this.formTitle()),this.branches.length<=5?e("div",{class:"s-branches-space-v"},this.branches.map((s=>e("div",{class:"s-branches-input-wrap"},e("input",{id:this.position+"_branch_"+s.id,disabled:!s.open&&this.isChoiceable(),name:"lang",type:"radio",value:s.id,onChange:s=>this.handelChange(s),class:{"s-branches-input":!0,"opacity-50":!s.open,hidden:!this.isChoiceable()},checked:this.current==s.id}),e("label",{htmlFor:this.position+"_branch_"+s.id,class:{"s-branches-label":!0,"s-branches-clickable":this.isChoiceable()}},e("span",{class:{"s-branches-is-closed":!s.open}},s.name),this.isChoiceable()?e("small",{class:"s-branches-closed-badge"},s.open?"":"مُغلق"):e("span",{class:this.statusColor(s)},s.tag)))))):e("select",{class:"s-branches-select",onInput:s=>this.handelChange(s)},this.branches.map((s=>e("option",{value:s.id,disabled:!s.open,selected:this.selected==s.id},s.name," ",s.open?"":"- مُغلق")))),this.isChoiceable()?e("slot",{name:"footer"},e("salla-button",{ref:s=>this.btn=s,onClick:()=>this.handleSubmit(),class:"s-branches-submit",wide:!0},salla.lang.get("common.elements.ok"))):"")}componentDidRender(){this.isOpenedBefore||"popup"!=this.displayAs||this.show()}get host(){return t(this)}};l.style=":host{display:block}";export{l as salla_branches}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,h as s,H as a,g as i}from"./p-e8965b01.js";import{H as e}from"./p-47f17d3b.js";const r=class{constructor(s){t(this,s),this.order={shipping:{id:5622},products:[{title:"ميكروفون عالى الجودة",image:"https://salla-dev.s3.eu-central-1.amazonaws.com/Mvyk/pMdEEyMVpZFj4L1Hrdm2g48AuiSx0TrKULBiOnPo.jpg",price:"10,978.00 ر.س",qty:"2",totalBefore:"1120 ر.س",discount:"-5%",total:"1064 ر.س",id:"2314513454",getOptimusRouteKey:"7351233357"},{title:"ميكروفون عالى الجودة",image:"https://salla-dev.s3.eu-central-1.amazonaws.com/Mvyk/pMdEEyMVpZFj4L1Hrdm2g48AuiSx0TrKULBiOnPo.jpg",price:"10,978.00 ر.س",qty:"2",totalBefore:"1120 ر.س",discount:"-5%",total:"1064 ر.س",id:"2314513454",getOptimusRouteKey:"7351233357"},{title:"ساعة ذكية بنظام اندرويد",image:"https://salla-dev.s3.eu-central-1.amazonaws.com/Mvyk/T4kTqYNuPAZmPMLw1bx92RnjVMZyFszVXOUZQsFJ.jpg",price:"10,978.00 ر.س",qty:"2",totalBefore:"1120 ر.س",discount:"-5%",total:"1064 ر.س",id:"679822376",getOptimusRouteKey:"73233357"}],storeLogo:"https://salla-dev.s3.eu-central-1.amazonaws.com/Mvyk/X3NKcY7nhaFQlR7kBBHvfDpMY48cerunKrmDA1gi.png",shippingLogo:"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcScPt4R6KaKDldrXb-9pUljFwL3m6A72BhN6p1qZJKprwC6VbCWC_8ASZgiJAoL_l7DepM&usqp=CAU"},this.isStoreRating=!1,this.isProductsRating=!1,this.isShippingRating=!1,this.ratingChain=Promise.resolve(),this.stepsCount=0,e.setHost(this.host)}async show(){return this.modal.show()}async hide(){return this.modal.hide()}componentWillLoad(){this.stepsCount=[this.isStoreRating,this.isProductsRating,this.isShippingRating].filter((t=>t)).length}componentDidRender(){this.show(),this.initiateRating()}initiateRating(){this.handleWizard(),this.handleSubmitRating(),this.starsRating(),this.highlightSelectedStars()}handleWizard(){let t=0,s=this.host.querySelectorAll(".s-rating-step"),a=this.host.querySelectorAll(".s-rating-step-dot"),i=this.host.querySelector("#next-btn .s-button-text");this.setModalHeight(s[0]),this.showActiveStep(s,a,t,i),e.onClick("#prev-btn",(()=>{t>0&&t--,this.showActiveStep(s,a,t,i),0==t&&e.toggle("#prev-btn","s-rating-unvisiable","block",(()=>!0))})),e.onClick("#next-btn",(()=>{this.ratingValidation(),t==this.stepsCount-1?salla.event.dispatch("submit::order-rating"):(t<this.stepsCount-1&&t++,this.showActiveStep(s,a,t,i),e.toggle("#prev-btn","block","s-rating-unvisiable",(()=>!0)))}))}showActiveStep(t,s,a,i){var r;e.toggle(".s-rating-step","s-rating-hidden","s-rating-active",(()=>!0)),e.toggleElement(t[a],"s-rating-unactive","s-rating-hidden",(()=>!0)),setTimeout((()=>e.toggleElement(t[a],"s-rating-active","s-rating-unactive",(()=>!0))),200),e.toggle(".s-rating-step-dot","s-rating-bg-gray","s-rating-bg-primary",(()=>!0)),this.stepsCount>1&&e.toggleElement(s[a],"s-rating-bg-primary","s-rating-bg-gray",(()=>!0)),i.innerHTML=(null===(r=t[a+1])||void 0===r?void 0:r.dataset.stepName)||salla.lang.get("pages.rating.send_ratings"),this.setModalHeight(t[a])}setModalHeight(t){const s=this.host.querySelector(".s-rating-wrapper");setTimeout((()=>null==s?void 0:s.setAttribute("style","height:"+(null==t?void 0:t.scrollHeight)+"px")))}handleSubmitRating(){salla.event.on("submit::order-rating",(()=>this.sendRating().then((()=>{let t=this.host.querySelector(".s-rating-thanks"),s=10,a=setInterval((()=>{s--,this.host.querySelector(".s-rating-thanks-time").innerHTML=`00:0${s}`,0==s&&(this.hide(),clearInterval(a))}),1e3);e.toggle(".s-rating-step","s-rating-hidden","s-rating-active",(()=>!0)),this.host.querySelector(".s-rating-footer").classList.add("s-rating-unvisiable"),e.toggleElement(t,"s-rating-unactive","s-rating-hidden",(()=>!0)),setTimeout((()=>e.toggleElement(t,"s-rating-active","s-rating-unactive",(()=>!0))),200),this.setModalHeight(t)}))))}starsRating(){let t=["selected"];salla.document.event.onSubmit(".s-rating-stars-element",(function(s){s.preventDefault();var a=s.target.querySelectorAll(".s-rating-btn-star.hovered"),i=a[a.length-1];if(i){var e=parseInt(i.dataset.star,10);s.target.querySelector(".rating_hidden_input").value=e,s.target.querySelectorAll(".s-rating-btn-star").forEach((function(s,a){a<e?s.classList.add(...t):s.classList.remove(...t)}));var r=s.target.querySelector('.s-rating-btn-star[aria-pressed="true"]');r&&r.removeAttribute("aria-pressed"),i.setAttribute("aria-pressed",!0)}}))}highlightSelectedStars(){let t=["hovered"];e.all(".s-rating-stars-element",(s=>{let a=s.querySelectorAll(".s-rating-btn-star");s.addEventListener("mouseout",(()=>a.forEach((s=>s.classList.remove(...t))))),a.forEach(((s,i)=>{s.addEventListener("mouseover",(()=>{if(s.classList.add(...t),i<=1)"BUTTON"===s.previousElementSibling.tagName&&s.previousElementSibling.classList.add(...t);else for(let s=0;s<i;s++)a[s].classList.add(...t)})),s.addEventListener("mouseout",(()=>{s.classList.contains(...t)&&s.classList.remove(...t)}))}))}))}sendRating(){return e.all(".s-rating-step",(t=>{let s=t.dataset.type,a=[];t.querySelectorAll(".rating-outer-form").forEach((t=>{let i={};t.querySelectorAll("[name]").forEach((function(t){let s=salla.helpers.inputData(t.name,t.value,i);i[s.name]=s.value})),a=[],a.push(i),this.sendFeedback(s,a)}))})),this.ratingChain}sendFeedback(t,s){s&&0!=s.length&&(this.nextBtn.load(),salla.config.canLeave=!1,this.ratingChain=salla.feedback.api[t](s[0]).then((function(){salla.config.canLeave=!0})).catch((()=>salla.config.canLeave=!0)))}ratingValidation(){let t="";if(document.querySelectorAll(".s-rating-step.s-rating-active").forEach((s=>{s.querySelectorAll(".rating-outer-form").forEach((s=>{let a=s.querySelector(".rating_hidden_input"),i=s.querySelector(".s-rating-comment"),e=s.querySelector(".s-rating-validation-msg");if(a.value&&i.value&&i.value.length>3)return i.classList.remove("s-rating-has-error"),void(e.innerHTML="");i.value&&i.value.length>3?i.classList.remove("s-rating-has-error"):i.classList.add("s-rating-has-error"),t=a.value?salla.lang.get("common.errors.not_less_than_chars",{chars:4})+" "+i.getAttribute("placeholder"):s.dataset.starsError||salla.lang.get("pages.rating.rate_store_stars"),e.innerHTML=t}))})),t)throw new Error(t)}render(){return s(a,null,s("salla-modal",{class:"hidden","modal-width":"w-[800px]",ref:t=>this.modal=t,title:salla.lang.get("pages.rating.rate_order")+' <span class="unicode">(#'+this.orderId+")</span>"},s("div",{class:"s-rating-wrapper "},this.isStoreRating&&this.renderStoreRating(),this.isProductsRating&&this.renderProductsRating(),this.isShippingRating&&this.renderShippingRating(),this.renderThanksView()),s("div",{class:"s-rating-footer"},s("button",{id:"prev-btn",class:"s-rating-btn s-rating-unvisiable"},salla.lang.get("pages.order.rating_prev")),this.stepsCount>1?s("ul",{class:"s-rating-dots"},[0,1,2].slice(0,this.stepsCount).map((t=>s("li",{class:(0==t?"s-rating-bg-primary":"s-rating-bg-gray")+" s-rating-step-dot"})))):"",s("salla-button",{id:"next-btn",ref:t=>this.nextBtn=t},"التالي"))))}renderStoreRating(){return s("section",{class:"s-rating-step","data-type":"store","data-step-name":salla.lang.get("pages.rating.rate")+" "+salla.lang.get("pages.rating.store")},s("div",{class:"rating-outer-form s-rating-step-wrap","data-stars-error":salla.lang.get("pages.rating.rate_store_stars")},s("input",{type:"hidden",name:"order_id",value:this.orderId}),s("input",{type:"hidden",name:"type",value:"store"}),s("div",{class:"s-rating-rounded-icon"},s("img",{src:this.order.storeLogo,alt:"store name",class:"s-rating-store-logo"})),s("h2",{class:"s-rating-title"},salla.lang.get("pages.rating.rate_the_store")),s("div",{class:"s-rating-stars-company"}," ",this.getStarsRating("large")),s("textarea",{id:"storeReview",name:"comment",class:"s-rating-comment",placeholder:salla.lang.get("pages.rating.write_store_rate")}),s("small",{class:"s-rating-validation-msg"})))}renderShippingRating(){return s("section",{class:"s-rating-step","data-type":"shipping","data-step-name":salla.lang.get("pages.rating.rate")+" "+salla.lang.get("pages.rating.shipping")},s("div",{class:"rating-outer-form s-rating-step-wrap","data-stars-error":salla.lang.get("pages.rating.rate_shipping_stars")},s("input",{type:"hidden",name:"order_id",value:this.orderId}),s("input",{type:"hidden",name:"shipping_company_id",value:this.order.shipping.id}),s("input",{type:"hidden",name:"type",value:"shipping"}),s("div",{class:"s-rating-rounded-icon"},s("img",{src:this.order.shippingLogo,alt:"company name",class:"s-rating-shipping-logo"})),s("h2",{class:"s-rating-title"}," ",salla.lang.get("pages.rating.rate_shipping")," ارامكس"),s("div",{class:"s-rating-stars-company"}," ",this.getStarsRating("large")),s("textarea",{id:"shippingReview",name:"comment",class:"s-rating-comment",placeholder:salla.lang.get("pages.rating.write_shipping_rate")}),s("small",{class:"s-rating-validation-msg"})))}renderProductsRating(){return s("section",{class:"s-rating-step","data-type":"product","data-step-name":salla.lang.get("pages.rating.rate")+" "+salla.lang.get("pages.rating.products")},this.order.products.map(((t,a)=>s("div",{class:"rating-outer-form s-rating-product","data-stars-error":salla.lang.get("pages.order.rate_product_stars")},s("img",{src:t.image,alt:t.title,class:"s-rating-product-img"}),s("div",{class:"s-rating-product-details"},s("h3",{class:"s-rating-product-title"}," ",t.title),s("div",{class:"s-rating-stars-product"}," ",this.getStarsRating("small")),s("input",{type:"hidden",name:"order_id",value:this.orderId}),s("input",{type:"hidden",name:`products[${a}][product_id]`,value:t.getOptimusRouteKey}),s("input",{type:"hidden",name:"type",value:"products"}),s("textarea",{"data-product-id":t.id,name:`products[${a}][comment]`,id:`productReview_${t.id}`,class:"s-rating-comment",placeholder:salla.lang.get("pages.rating.write_product_rate")}),s("small",{class:"s-rating-validation-msg"}))))))}renderThanksView(){return s("div",{class:"s-rating-thanks s-rating-hidden"},s("span",{class:"s-rating-thanks-icon sicon-check-circle2"}),s("h3",{class:"s-rating-thanks-title"},salla.lang.get("pages.rating.thanks")),s("div",{class:"s-rating-thanks-msg",innerHTML:this.thanksMsg}),s("a",{href:"#!",onClick:()=>this.hide(),class:"s-rating-thanks-btn"},"عودة إلي تفاصيل الطلب"),s("time",{class:"s-rating-thanks-time"}))}getStarsRating(t){return s("form",{class:"s-rating-stars-element"},s("input",{type:"hidden",class:"rating_hidden_input",name:"rating",value:""}),[1,2,3,4,5].map((a=>s("button",{type:"submit",class:"s-rating-btn-star s-rating-btn-star-"+t,"data-star":a},s("i",{class:"sicon-star2"})))))}get host(){return i(this)}};r.style=":host{display:block}.unicode{unicode-bidi:plaintext}";export{r as salla_rating}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,h as s,H as i,g as l}from"./p-e8965b01.js";import{H as a}from"./p-47f17d3b.js";const e=class{constructor(s){t(this,s),this.isUser=a.isUser(),this.buttonText=salla.lang.get("pages.products.notify_availability"),this.countryCode=salla.config.country_code||"SA",this.subscribeText=salla.lang.get("common.elements.submit"),this.cancelText=salla.lang.get("common.elements.cancel"),this.subTitle=salla.lang.get("pages.products.notify_availability_subtitle"),this.mobileLabel=salla.lang.get("common.elements.mobile"),this.emailLabel=salla.lang.get("common.elements.email"),this.mobilePlaceholder=salla.lang.get("common.elements.mobile_placeholder"),this.emailPlaceholder=salla.lang.get("common.elements.email_placeholder"),this.productId=salla.config.page.id,this.subscribedMessage=salla.lang.get("pages.products.notify_availability_success"),this.isSubscribed=!1,this.isUser||(this.channelsWatcher(this.channels),this.title_=this.host.title||salla.lang.get("pages.products.notify_availability_title"),this.host.removeAttribute("title"))}channelsWatcher(t){this.channels_=t.split(",")}async submit(){if(this.isUser)return salla.api.product.availabilitySubscribe(this.productId).then((()=>this.isSubscribed=!0));let t={id:this.productId,country_code:this.countryCode};return""!==this.mobile.value&&(t.mobile=this.mobile.value),""!==this.email.value&&(t.email=this.email.value),this.btn.load().then((()=>this.btn.disable())).then((()=>salla.api.product.availabilitySubscribe(t))).then((()=>this.isSubscribed=!0)).then((()=>this.btn.stop())).then((()=>this.modal.hide())).catch((()=>this.btn.stop()&&this.btn.enable()))}render(){return s(i,null,this.isSubscribed?s("div",{class:"s-product-availability-subscribed"},this.subscribedMessage):s("slot",null,s("salla-button",{wide:!0,onClick:()=>this.isUser?this.submit():this.modal.show()},this.buttonText)),this.isUser||this.isSubscribed?"":this.renderModal())}renderModal(){return s("salla-modal",{ref:t=>this.modal=t,title:this.title_,subTitle:this.subTitle,icon:"sicon-bell-ring",width:"md"},s("div",{class:"s-product-availability-body"},this.channels_.includes("email")?[s("label",{class:"s-product-availability-label"},this.emailLabel),s("input",{class:"s-product-availability-input",placeholder:this.emailPlaceholder,ref:t=>this.email=t,type:"email"})]:"",this.channels_.includes("sms")?[s("label",{class:"s-product-availability-label"},this.mobileLabel),s("input",{class:"s-product-availability-input",placeholder:this.mobilePlaceholder,ref:t=>this.mobile=t,type:"text"}),s("input",{type:"hidden",value:this.countryCode})]:""),s("div",{slot:"footer",class:"s-product-availability-footer"},s("salla-button",{wide:!0,ref:t=>this.btn=t,onClick:()=>this.submit()},this.subscribeText),s("salla-button",{wide:!0,"btn-style":"outline"},this.cancelText)))}get host(){return l(this)}static get watchers(){return{channels:["channelsWatcher"]}}};export{e as salla_product_availability}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as s,h as t,H as i,g as a}from"./p-e8965b01.js";import{H as e}from"./p-47f17d3b.js";const r=class{constructor(t){var i,a;s(this,t),this.results=[],this.placeholder=salla.lang.get("blocks.header.search_placeholder"),this.noResultsText=salla.lang.get("common.elements.no_options"),e.setHost(this.host),this.buttonSlot=(null===(i=e.getElement('[slot="button"]'))||void 0===i?void 0:i.innerHTML)||'<i class="sicon-search"></i>',this.productSlot=(null===(a=e.getElement('[slot="product"]'))||void 0===a?void 0:a.innerHTML)||this.getDefaultProductSlot()}onModalClose(){e.getElement(".s-search-input").value="",this.results=[],this.afterSearching()}getDefaultProductSlot(){return'<a target="_blank" href={url} class="s-search-product-image-container"> <img class="s-search-product-image" src="{image}" alt="{name}"/></a><div class="s-search-product-details"> <div class="s-search-product-name">{name}</div> <div class="s-search-product-price">{price}</div></div>'}search(s){if(e.hideElement(this.noResults),0===s.target.value.length)return this.results=[],void this.afterSearching();s.target.value.length<=2||(e.toggleElement(this.searchIcon,"s-search-spinner-loader","sicon-search",(()=>!0)),salla.search.api.search(s.target.value).then((s=>this.results=s.results)).catch((s=>"Query Same As Previous!"!==s?this.results=[]:null)).finally((()=>this.afterSearching(!1))))}afterSearching(s=!0){this.noResults.style.display=s||this.results.length>0?"none":"block",e.toggleElement(this.container,"s-search-container-open","no-results",(()=>this.results.length)).toggleElement(this.searchIcon,"s-search-spinner-loader","sicon-search",(()=>!1)),salla.search.api.previousQuery=""}render(){var s;return t(i,{class:"s-search"},t("button",{onClick:()=>this.modal.show(),class:"s-search-button",innerHTML:this.buttonSlot}),t("salla-modal",{ref:s=>this.modal=s},t("div",{class:"s-search-container",slot:"body",ref:s=>this.container=s},t("input",{class:"s-search-input",type:"text",placeholder:this.placeholder,onInput:s=>this.search(s)}),t("span",{class:"s-search-icon"},t("i",{class:"sicon-search",ref:s=>this.searchIcon=s})),t("div",{class:"s-search-results"},null===(s=this.results)||void 0===s?void 0:s.map((s=>{var i;return t("div",{class:"s-search-product",innerHTML:this.productSlot.replace(/\{name\}/g,s.title).replace(/\{price\}/g,null===(i=s.price)||void 0===i?void 0:i.after).replace(/\{url\}/g,s.url).replace(/\{image\}/g,s.thumb)})})),t("p",{ref:s=>this.noResults=s,class:"s-search-no-results"},this.noResultsText)))))}componentDidLoad(){this.afterSearching()}get host(){return a(this)}};export{r as S}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
let e,t,l,n=!1,o=!1,s=!1,i=!1;const r="undefined"!=typeof window?window:{},c=r.document||{head:{}},f={t:0,l:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,l,n)=>e.addEventListener(t,l,n),rel:(e,t,l,n)=>e.removeEventListener(t,l,n),ce:(e,t)=>new CustomEvent(e,t)},a=e=>Promise.resolve(e),u=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replace}catch(e){}return!1})(),$=(e,t,l)=>{l&&l.map((([l,n,o])=>{const s=e,i=d(t,o),r=h(l);f.ael(s,n,i,r),(t.o=t.o||[]).push((()=>f.rel(s,n,i,r)))}))},d=(e,t)=>l=>{try{256&e.t?e.i[t](l):(e.u=e.u||[]).push([t,l])}catch(e){ie(e)}},h=e=>0!=(2&e),y="http://www.w3.org/1999/xlink",p=new WeakMap,m=e=>"sc-"+e.$,b={},w=e=>"object"==(e=typeof e)||"function"===e,k=(e,t,...l)=>{let n=null,o=null,s=null,i=!1,r=!1,c=[];const f=t=>{for(let l=0;l<t.length;l++)n=t[l],Array.isArray(n)?f(n):null!=n&&"boolean"!=typeof n&&((i="function"!=typeof e&&!w(n))&&(n+=""),i&&r?c[c.length-1].h+=n:c.push(i?g(null,n):n),r=i)};if(f(l),t){t.key&&(o=t.key),t.name&&(s=t.name);{const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter((t=>e[t])).join(" "))}}const a=g(e,null);return a.p=t,c.length>0&&(a.m=c),a.k=o,a.g=s,a},g=(e,t)=>({t:0,S:e,h:t,v:null,m:null,p:null,k:null,g:null}),S={},v=(e,t,l,n,o,s)=>{if(l!==n){let i=se(e,t),c=t.toLowerCase();if("class"===t){const t=e.classList,o=M(l),s=M(n);t.remove(...o.filter((e=>e&&!s.includes(e)))),t.add(...s.filter((e=>e&&!o.includes(e))))}else if("style"===t){for(const t in l)n&&null!=n[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(const t in n)l&&n[t]===l[t]||(t.includes("-")?e.style.setProperty(t,n[t]):e.style[t]=n[t])}else if("key"===t);else if("ref"===t)n&&n(e);else if(i||"o"!==t[0]||"n"!==t[1]){const r=w(n);if((i||r&&null!==n)&&!o)try{if(e.tagName.includes("-"))e[t]=n;else{let o=null==n?"":n;"list"===t?i=!1:null!=l&&e[t]==o||(e[t]=o)}}catch(e){}let f=!1;c!==(c=c.replace(/^xlink\:?/,""))&&(t=c,f=!0),null==n||!1===n?!1===n&&""!==e.getAttribute(t)||(f?e.removeAttributeNS(y,t):e.removeAttribute(t)):(!i||4&s||o)&&!r&&(n=!0===n?"":n,f?e.setAttributeNS(y,t,n):e.setAttribute(t,n))}else t="-"===t[2]?t.slice(3):se(r,c)?c.slice(2):c[2]+t.slice(3),l&&f.rel(e,t,l,!1),n&&f.ael(e,t,n,!1)}},j=/\s/,M=e=>e?e.split(j):[],O=(e,t,l,n)=>{const o=11===t.v.nodeType&&t.v.host?t.v.host:t.v,s=e&&e.p||b,i=t.p||b;for(n in s)n in i||v(o,n,s[n],void 0,l,t.t);for(n in i)v(o,n,s[n],i[n],l,t.t)},C=(o,i,r,f)=>{let a,u,$,d=i.m[r],h=0;if(n||(s=!0,"slot"===d.S&&(e&&f.classList.add(e+"-s"),d.t|=d.m?2:1)),null!==d.h)a=d.v=c.createTextNode(d.h);else if(1&d.t)a=d.v=c.createTextNode("");else if(a=d.v=c.createElement(2&d.t?"slot-fb":d.S),O(null,d,!1),null!=e&&a["s-si"]!==e&&a.classList.add(a["s-si"]=e),d.m)for(h=0;h<d.m.length;++h)u=C(o,d,h,a),u&&a.appendChild(u);return a["s-hn"]=l,3&d.t&&(a["s-sr"]=!0,a["s-cr"]=t,a["s-sn"]=d.g||"",$=o&&o.m&&o.m[r],$&&$.S===d.S&&o.v&&R(o.v,!1)),a},R=(e,t)=>{f.t|=1;const n=e.childNodes;for(let e=n.length-1;e>=0;e--){const o=n[e];o["s-hn"]!==l&&o["s-ol"]&&(E(o).insertBefore(o,L(o)),o["s-ol"].remove(),o["s-ol"]=void 0,s=!0),t&&R(o,t)}f.t&=-2},x=(e,t,n,o,s,i)=>{let r,c=e["s-cr"]&&e["s-cr"].parentNode||e;for(c.shadowRoot&&c.tagName===l&&(c=c.shadowRoot);s<=i;++s)o[s]&&(r=C(null,n,s,e),r&&(o[s].v=r,c.insertBefore(r,L(t))))},P=(e,t,l,n,s)=>{for(;t<=l;++t)(n=e[t])&&(s=n.v,N(n),o=!0,s["s-ol"]?s["s-ol"].remove():R(s,!0),s.remove())},T=(e,t)=>e.S===t.S&&("slot"===e.S?e.g===t.g:e.k===t.k),L=e=>e&&e["s-ol"]||e,E=e=>(e["s-ol"]?e["s-ol"]:e).parentNode,W=(e,t)=>{const l=t.v=e.v,n=e.m,o=t.m,s=t.h;let i;null===s?("slot"===t.S||O(e,t,!1),null!==n&&null!==o?((e,t,l,n)=>{let o,s,i=0,r=0,c=0,f=0,a=t.length-1,u=t[0],$=t[a],d=n.length-1,h=n[0],y=n[d];for(;i<=a&&r<=d;)if(null==u)u=t[++i];else if(null==$)$=t[--a];else if(null==h)h=n[++r];else if(null==y)y=n[--d];else if(T(u,h))W(u,h),u=t[++i],h=n[++r];else if(T($,y))W($,y),$=t[--a],y=n[--d];else if(T(u,y))"slot"!==u.S&&"slot"!==y.S||R(u.v.parentNode,!1),W(u,y),e.insertBefore(u.v,$.v.nextSibling),u=t[++i],y=n[--d];else if(T($,h))"slot"!==u.S&&"slot"!==y.S||R($.v.parentNode,!1),W($,h),e.insertBefore($.v,u.v),$=t[--a],h=n[++r];else{for(c=-1,f=i;f<=a;++f)if(t[f]&&null!==t[f].k&&t[f].k===h.k){c=f;break}c>=0?(s=t[c],s.S!==h.S?o=C(t&&t[r],l,c,e):(W(s,h),t[c]=void 0,o=s.v),h=n[++r]):(o=C(t&&t[r],l,r,e),h=n[++r]),o&&E(u.v).insertBefore(o,L(u.v))}i>a?x(e,null==n[d+1]?null:n[d+1].v,l,n,r,d):r>d&&P(t,i,a)})(l,n,t,o):null!==o?(null!==e.h&&(l.textContent=""),x(l,null,t,o,0,o.length-1)):null!==n&&P(n,0,n.length-1)):(i=l["s-cr"])?i.parentNode.textContent=s:e.h!==s&&(l.data=s)},A=e=>{let t,l,n,o,s,i,r=e.childNodes;for(l=0,n=r.length;l<n;l++)if(t=r[l],1===t.nodeType){if(t["s-sr"])for(s=t["s-sn"],t.hidden=!1,o=0;o<n;o++)if(i=r[o].nodeType,r[o]["s-hn"]!==t["s-hn"]||""!==s){if(1===i&&s===r[o].getAttribute("slot")){t.hidden=!0;break}}else if(1===i||3===i&&""!==r[o].textContent.trim()){t.hidden=!0;break}A(t)}},D=[],F=e=>{let t,l,n,s,i,r,c=0,f=e.childNodes,a=f.length;for(;c<a;c++){if(t=f[c],t["s-sr"]&&(l=t["s-cr"])&&l.parentNode)for(n=l.parentNode.childNodes,s=t["s-sn"],r=n.length-1;r>=0;r--)l=n[r],l["s-cn"]||l["s-nr"]||l["s-hn"]===t["s-hn"]||(H(l,s)?(i=D.find((e=>e.j===l)),o=!0,l["s-sn"]=l["s-sn"]||s,i?i.M=t:D.push({M:t,j:l}),l["s-sr"]&&D.map((e=>{H(e.j,l["s-sn"])&&(i=D.find((e=>e.j===l)),i&&!e.M&&(e.M=i.M))}))):D.some((e=>e.j===l))||D.push({j:l}));1===t.nodeType&&F(t)}},H=(e,t)=>1===e.nodeType?null===e.getAttribute("slot")&&""===t||e.getAttribute("slot")===t:e["s-sn"]===t||""===t,N=e=>{e.p&&e.p.ref&&e.p.ref(null),e.m&&e.m.map(N)},U=e=>le(e).O,q=(e,t,l)=>{const n=U(e);return{emit:e=>V(n,t,{bubbles:!!(4&l),composed:!!(2&l),cancelable:!!(1&l),detail:e})}},V=(e,t,l)=>{const n=f.ce(t,l);return e.dispatchEvent(n),n},_=(e,t)=>{t&&!e.C&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.C=t)))},z=(e,t)=>{if(e.t|=16,!(4&e.t))return _(e,e.R),pe((()=>B(e,t)));e.t|=512},B=(e,t)=>{const l=e.i;let n;return t&&(e.t|=256,e.u&&(e.u.map((([e,t])=>Q(l,e,t))),e.u=null),n=Q(l,"componentWillLoad")),X(n,(()=>G(e,l,t)))},G=async(e,t,l)=>{const n=e.O,o=n["s-rc"];l&&(e=>{const t=e.P,l=e.O,n=t.t,o=((e,t)=>{let l=m(t),n=fe.get(l);if(e=11===e.nodeType?e:c,n)if("string"==typeof n){let t,o=p.get(e=e.head||e);o||p.set(e,o=new Set),o.has(l)||(t=c.createElement("style"),t.innerHTML=n,e.insertBefore(t,e.querySelector("link")),o&&o.add(l))}else e.adoptedStyleSheets.includes(n)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]);return l})(l.shadowRoot?l.shadowRoot:l.getRootNode(),t);10&n&&(l["s-sc"]=o,l.classList.add(o+"-h"))})(e);I(e,t),o&&(o.map((e=>e())),n["s-rc"]=void 0);{const t=n["s-p"],l=()=>J(e);0===t.length?l():(Promise.all(t).then(l),e.t|=4,t.length=0)}},I=(i,r)=>{try{r=r.render(),i.t&=-17,i.t|=2,((i,r)=>{const a=i.O,u=i.P,$=i.T||g(null,null),d=(e=>e&&e.S===S)(r)?r:k(null,null,r);if(l=a.tagName,u.L&&(d.p=d.p||{},u.L.map((([e,t])=>d.p[t]=a[e]))),d.S=null,d.t|=4,i.T=d,d.v=$.v=a.shadowRoot||a,e=a["s-sc"],t=a["s-cr"],n=0!=(1&u.t),o=!1,W($,d),f.t|=1,s){let e,t,l,n,o,s;F(d.v);let i=0;for(;i<D.length;i++)e=D[i],t=e.j,t["s-ol"]||(l=c.createTextNode(""),l["s-nr"]=t,t.parentNode.insertBefore(t["s-ol"]=l,t));for(i=0;i<D.length;i++)if(e=D[i],t=e.j,e.M){for(n=e.M.parentNode,o=e.M.nextSibling,l=t["s-ol"];l=l.previousSibling;)if(s=l["s-nr"],s&&s["s-sn"]===t["s-sn"]&&n===s.parentNode&&(s=s.nextSibling,!s||!s["s-nr"])){o=s;break}(!o&&n!==t.parentNode||t.nextSibling!==o)&&t!==o&&(!t["s-hn"]&&t["s-ol"]&&(t["s-hn"]=t["s-ol"].parentNode.nodeName),n.insertBefore(t,o))}else 1===t.nodeType&&(t.hidden=!0)}o&&A(d.v),f.t&=-2,D.length=0})(i,r)}catch(e){ie(e,i.O)}return null},J=e=>{const t=e.O,l=e.i,n=e.R;Q(l,"componentDidRender"),64&e.t||(e.t|=64,Y(t),Q(l,"componentDidLoad"),e.W(t),n||K()),e.A(t),e.C&&(e.C(),e.C=void 0),512&e.t&&ye((()=>z(e,!1))),e.t&=-517},K=()=>{Y(c.documentElement),ye((()=>V(r,"appload",{detail:{namespace:"twilight-components"}})))},Q=(e,t,l)=>{if(e&&e[t])try{return e[t](l)}catch(e){ie(e)}},X=(e,t)=>e&&e.then?e.then(t):t(),Y=e=>e.classList.add("hydrated"),Z=(e,t,l)=>{if(t.D){e.watchers&&(t.F=e.watchers);const n=Object.entries(t.D),o=e.prototype;if(n.map((([e,[n]])=>{31&n||2&l&&32&n?Object.defineProperty(o,e,{get(){return((e,t)=>le(this).H.get(t))(0,e)},set(l){((e,t,l,n)=>{const o=le(e),s=o.O,i=o.H.get(t),r=o.t,c=o.i;if(l=((e,t)=>null==e||w(e)?e:4&t?"false"!==e&&(""===e||!!e):2&t?parseFloat(e):1&t?e+"":e)(l,n.D[t][0]),!(8&r&&void 0!==i||l===i)&&(o.H.set(t,l),c)){if(n.F&&128&r){const e=n.F[t];e&&e.map((e=>{try{c[e](l,i,t)}catch(e){ie(e,s)}}))}2==(18&r)&&z(o,!1)}})(this,e,l,t)},configurable:!0,enumerable:!0}):1&l&&64&n&&Object.defineProperty(o,e,{value(...t){const l=le(this);return l.N.then((()=>l.i[e](...t)))}})})),1&l){const l=new Map;o.attributeChangedCallback=function(e,t,n){f.jmp((()=>{const t=l.get(e);this.hasOwnProperty(t)&&(n=this[t],delete this[t]),this[t]=(null!==n||"boolean"!=typeof this[t])&&n}))},e.observedAttributes=n.filter((([e,t])=>15&t[0])).map((([e,n])=>{const o=n[1]||e;return l.set(o,e),512&n[0]&&t.L.push([e,o]),o}))}}return e},ee=(e,t={})=>{const l=[],n=t.exclude||[],o=r.customElements,s=c.head,i=s.querySelector("meta[charset]"),a=c.createElement("style"),d=[];let h,y=!0;Object.assign(f,t),f.l=new URL(t.resourcesUrl||"./",c.baseURI).href,e.map((e=>e[1].map((t=>{const s={t:t[0],$:t[1],D:t[2],U:t[3]};s.D=t[2],s.U=t[3],s.L=[],s.F={};const i=s.$,r=class extends HTMLElement{constructor(e){super(e),oe(e=this,s),1&s.t&&e.attachShadow({mode:"open"})}connectedCallback(){h&&(clearTimeout(h),h=null),y?d.push(this):f.jmp((()=>(e=>{if(0==(1&f.t)){const t=le(e),l=t.P,n=()=>{};if(1&t.t)$(e,t,l.U);else{t.t|=1,12&l.t&&(e=>{const t=e["s-cr"]=c.createComment("");t["s-cn"]=!0,e.insertBefore(t,e.firstChild)})(e);{let l=e;for(;l=l.parentNode||l.host;)if(l["s-p"]){_(t,t.R=l);break}}l.D&&Object.entries(l.D).map((([t,[l]])=>{if(31&l&&e.hasOwnProperty(t)){const l=e[t];delete e[t],e[t]=l}})),(async(e,t,l,n,o)=>{if(0==(32&t.t)){{if(t.t|=32,(o=ce(l)).then){const e=()=>{};o=await o,e()}o.isProxied||(l.F=o.watchers,Z(o,l,2),o.isProxied=!0);const e=()=>{};t.t|=8;try{new o(t)}catch(e){ie(e)}t.t&=-9,t.t|=128,e()}if(o.style){let e=o.style;const t=m(l);if(!fe.has(t)){const n=()=>{};((e,t,l)=>{let n=fe.get(e);u&&l?(n=n||new CSSStyleSheet,n.replace(t)):n=t,fe.set(e,n)})(t,e,!!(1&l.t)),n()}}}const s=t.R,i=()=>z(t,!0);s&&s["s-rc"]?s["s-rc"].push(i):i()})(0,t,l)}n()}})(this)))}disconnectedCallback(){f.jmp((()=>(()=>{if(0==(1&f.t)){const e=le(this);e.o&&(e.o.map((e=>e())),e.o=void 0)}})()))}componentOnReady(){return le(this).q}};s.V=e[0],n.includes(i)||o.get(i)||(l.push(i),o.define(i,Z(r,s,1)))})))),a.innerHTML=l+"{visibility:hidden}.hydrated{visibility:inherit}",a.setAttribute("data-styles",""),s.insertBefore(a,i?i.nextSibling:s.firstChild),y=!1,d.length?d.map((e=>e.connectedCallback())):f.jmp((()=>h=setTimeout(K,30)))},te=new WeakMap,le=e=>te.get(e),ne=(e,t)=>te.set(t.i=e,t),oe=(e,t)=>{const l={t:0,O:e,P:t,H:new Map};return l.N=new Promise((e=>l.A=e)),l.q=new Promise((e=>l.W=e)),e["s-p"]=[],e["s-rc"]=[],$(e,l,t.U),te.set(e,l)},se=(e,t)=>t in e,ie=(e,t)=>(0,console.error)(e,t),re=new Map,ce=e=>{const t=e.$.replace(/-/g,"_"),l=e.V,n=re.get(l);return n?n[t]:import(`./${l}.entry.js`).then((e=>(re.set(l,e),e[t])),ie)},fe=new Map,ae=[],ue=[],$e=(e,t)=>l=>{e.push(l),i||(i=!0,t&&4&f.t?ye(he):f.raf(he))},de=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){ie(e)}e.length=0},he=()=>{de(ae),de(ue),(i=ae.length>0)&&f.raf(he)},ye=e=>a().then(e),pe=$e(ue,!0);export{S as H,ee as b,q as c,U as g,k as h,a as p,ne as r}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as i,h as t,H as s,g as e,c as a}from"./p-e8965b01.js";import{H as n}from"./p-47f17d3b.js";export{S as salla_login}from"./p-160062c6.js";const r=class{constructor(t){i(this,t),this.btnStyle="primary",this.loading=!1,this.disabled=!1,this.loaderPosition="before",this.wide=!1,this.hostAttributes={};for(let i=0;i<this.host.attributes.length;i++)this.hostAttributes[this.host.attributes[i].name]=this.host.attributes[i].value;this.hostAttributes.type=this.hostAttributes.type||"button",this.hostAttributes.class+=" s-button-btn btn--has-loading s-button-"+this.btnStyle+(this.wide?" s-button-wide ":"")+" loader-"+this.loaderPosition+("before"==this.loaderPosition?" s-button-loader-after":""),delete this.hostAttributes["btn-style"],delete this.hostAttributes.id,this.wide&&this.host.classList.add("s-button-wide")}async load(){return"center"==this.loaderPosition&&this.text.classList.add("s-button-hide"),this.host.setAttribute("loading",""),this.host}async stop(){return this.host.removeAttribute("loading"),this.host}async disable(){this.host.setAttribute("disabled","")}async enable(){this.host.removeAttribute("disabled")}handleVisible(i,t){this.btn.classList.remove("btn-"+t),this.btn.classList.add("btn-"+i)}handleLoading(i){n.toggleElement(this.btn,"btn--is-loading","btn--no-loading",(()=>i))}render(){return t(s,{class:"s-button-host-tag"},t("button",Object.assign({ref:i=>this.btn=i,disabled:this.disabled},this.hostAttributes),t("span",{class:"s-button-text",ref:i=>this.text=i},t("slot",null)),this.loading?t("span",{class:{"s-button-loader":!0,"s-button-loader-start":"start"===this.loaderPosition,"s-button-loader-end":"end"===this.loaderPosition,"s-button-loader-center":"center"===this.loaderPosition}}):""))}get host(){return e(this)}static get watchers(){return{btnStyle:["handleVisible"],loading:["handleLoading"]}}};r.style=":host{display:block}";const o=class{constructor(t){var s;i(this,t),this.modalOpened=a(this,"modalOpened",7),this.modalClosed=a(this,"modalClosed",7),this.error=!1,this.success=!1,this.primary=!1,this.isClosable=!0,this.width="md",this.visible=!1,this.isLoading=!1,this.subTitleFirst=!1,this.subTitle="",this.icon="",this.imageIcon="",n.setHost(this.host),salla.event.on("modal::open",(i=>i.dataset.target==this.host.id&&this.show())),salla.event.on("modal::close",(i=>i.dataset.target==this.host.id&&this.hide())),this.title=this.host.title,this.host.removeAttribute("title"),null===(s=n.getElement("[slot=body]"))||void 0===s||s.classList.add("s-modal-body","s-modal-"+this.width)}handleVisible(i){if(!i)return this.toggleModal(!1),void this.modalClosed.emit();this.host.classList.remove("hidden"),setTimeout((()=>this.toggleModal(!0))),this.modalOpened.emit()}async show(){return this.host.setAttribute("visible",""),this.host}async hide(){return this.host.removeAttribute("visible"),this.host}async setTitle(i){return this.title=i,this.host}async loading(){return this.isLoading=!0,this.host}async stopLoading(){return this.isLoading=!1,this.host}toggleModal(i){n.toggleElement(this.host.querySelector("[slot=body]")||this.host,"s-modal-entering","s-modal-leaving",(()=>i)).toggleElement(this.overlay,"s-modal-entering","s-modal-overlay-leaving",(()=>i)).toggleElement(document.body,"modal-is-open","modal-is-closed",(()=>i)),i||setTimeout((()=>this.host.classList.add("hidden")),350)}closeModal(){this.isClosable&&this.host.removeAttribute("visible")}render(){return this.host.id=this.host.id||"salla-modal",t(s,{class:"s-modal-container hidden","aria-modal":"true",role:"dialog"},t("div",{class:"s-modal-wrapper"},t("div",{class:"s-modal-overlay",ref:i=>this.overlay=i,onClick:()=>this.closeModal()}),t("span",{class:"s-modal-spacer"},""),t("slot",{name:"body"},t("div",{class:"s-modal-body s-modal-"+this.width,slot:"body"},this.isLoading?t("span",null,"Loading..."):[t("div",{class:{"s-modal-header":!0,"s-modal-is-center":""!=this.icon||""!=this.imageIcon}},this.isClosable?t("button",{class:"s-modal-close cursor-pointer",onClick:()=>this.closeModal(),type:"button"},t("span",{class:"sicon-cancel"})):"",this.error||this.success||this.icon?t("div",{class:{"s-modal-icon":!0,"s-modal-bg-error":this.error,"s-modal-bg-success":this.success,"s-modal-bg-normal":!this.error&&!this.success,"s-modal-bg-primary":this.primary}},t("i",{class:{[this.icon]:!0,"s-modal-text-error":this.error,"s-modal-text-success":this.success}})):this.imageIcon?t("img",{class:"s-modal-header-img",src:this.imageIcon}):"",this.title||this.subTitle?t("div",{class:"s-modal-header-content"},t("div",{class:{"s-modal-title":!0,"s-modal-title-below":this.subTitleFirst},innerHTML:this.title}),t("p",{class:{"s-modal-sub-title":!0},innerHTML:this.subTitle})):""),t("slot",null),t("slot",{name:"footer"})]))))}get host(){return e(this)}static get watchers(){return{visible:["handleVisible"]}}};var h,l=(function(i){var t;t=function(i){return function(){for(var t=[["Afghanistan (افغانستان)","af","93"],["Albania (Shqipëri)","al","355"],["Algeria (الجزائر)","dz","213"],["American Samoa","as","1",5,["684"]],["Andorra","ad","376"],["Angola","ao","244"],["Anguilla","ai","1",6,["264"]],["Antigua and Barbuda","ag","1",7,["268"]],["Argentina","ar","54"],["Armenia (Հայաստան)","am","374"],["Aruba","aw","297"],["Ascension Island","ac","247"],["Australia","au","61",0],["Austria (Österreich)","at","43"],["Azerbaijan (Azərbaycan)","az","994"],["Bahamas","bs","1",8,["242"]],["Bahrain (البحرين)","bh","973"],["Bangladesh (বাংলাদেশ)","bd","880"],["Barbados","bb","1",9,["246"]],["Belarus (Беларусь)","by","375"],["Belgium (België)","be","32"],["Belize","bz","501"],["Benin (Bénin)","bj","229"],["Bermuda","bm","1",10,["441"]],["Bhutan (འབྲུག)","bt","975"],["Bolivia","bo","591"],["Bosnia and Herzegovina (Босна и Херцеговина)","ba","387"],["Botswana","bw","267"],["Brazil (Brasil)","br","55"],["British Indian Ocean Territory","io","246"],["British Virgin Islands","vg","1",11,["284"]],["Brunei","bn","673"],["Bulgaria (България)","bg","359"],["Burkina Faso","bf","226"],["Burundi (Uburundi)","bi","257"],["Cambodia (កម្ពុជា)","kh","855"],["Cameroon (Cameroun)","cm","237"],["Canada","ca","1",1,["204","226","236","249","250","289","306","343","365","387","403","416","418","431","437","438","450","506","514","519","548","579","581","587","604","613","639","647","672","705","709","742","778","780","782","807","819","825","867","873","902","905"]],["Cape Verde (Kabu Verdi)","cv","238"],["Caribbean Netherlands","bq","599",1,["3","4","7"]],["Cayman Islands","ky","1",12,["345"]],["Central African Republic (République centrafricaine)","cf","236"],["Chad (Tchad)","td","235"],["Chile","cl","56"],["China (中国)","cn","86"],["Christmas Island","cx","61",2,["89164"]],["Cocos (Keeling) Islands","cc","61",1,["89162"]],["Colombia","co","57"],["Comoros (جزر القمر)","km","269"],["Congo (DRC) (Jamhuri ya Kidemokrasia ya Kongo)","cd","243"],["Congo (Republic) (Congo-Brazzaville)","cg","242"],["Cook Islands","ck","682"],["Costa Rica","cr","506"],["Côte d’Ivoire","ci","225"],["Croatia (Hrvatska)","hr","385"],["Cuba","cu","53"],["Curaçao","cw","599",0],["Cyprus (Κύπρος)","cy","357"],["Czech Republic (Česká republika)","cz","420"],["Denmark (Danmark)","dk","45"],["Djibouti","dj","253"],["Dominica","dm","1",13,["767"]],["Dominican Republic (República Dominicana)","do","1",2,["809","829","849"]],["Ecuador","ec","593"],["Egypt (مصر)","eg","20"],["El Salvador","sv","503"],["Equatorial Guinea (Guinea Ecuatorial)","gq","240"],["Eritrea","er","291"],["Estonia (Eesti)","ee","372"],["Eswatini","sz","268"],["Ethiopia","et","251"],["Falkland Islands (Islas Malvinas)","fk","500"],["Faroe Islands (Føroyar)","fo","298"],["Fiji","fj","679"],["Finland (Suomi)","fi","358",0],["France","fr","33"],["French Guiana (Guyane française)","gf","594"],["French Polynesia (Polynésie française)","pf","689"],["Gabon","ga","241"],["Gambia","gm","220"],["Georgia (საქართველო)","ge","995"],["Germany (Deutschland)","de","49"],["Ghana (Gaana)","gh","233"],["Gibraltar","gi","350"],["Greece (Ελλάδα)","gr","30"],["Greenland (Kalaallit Nunaat)","gl","299"],["Grenada","gd","1",14,["473"]],["Guadeloupe","gp","590",0],["Guam","gu","1",15,["671"]],["Guatemala","gt","502"],["Guernsey","gg","44",1,["1481","7781","7839","7911"]],["Guinea (Guinée)","gn","224"],["Guinea-Bissau (Guiné Bissau)","gw","245"],["Guyana","gy","592"],["Haiti","ht","509"],["Honduras","hn","504"],["Hong Kong (香港)","hk","852"],["Hungary (Magyarország)","hu","36"],["Iceland (Ísland)","is","354"],["India (भारत)","in","91"],["Indonesia","id","62"],["Iran (ایران)","ir","98"],["Iraq (العراق)","iq","964"],["Ireland","ie","353"],["Isle of Man","im","44",2,["1624","74576","7524","7924","7624"]],["Israel (ישראל)","il","972"],["Italy (Italia)","it","39",0],["Jamaica","jm","1",4,["876","658"]],["Japan (日本)","jp","81"],["Jersey","je","44",3,["1534","7509","7700","7797","7829","7937"]],["Jordan (الأردن)","jo","962"],["Kazakhstan (Казахстан)","kz","7",1,["33","7"]],["Kenya","ke","254"],["Kiribati","ki","686"],["Kosovo","xk","383"],["Kuwait (الكويت)","kw","965"],["Kyrgyzstan (Кыргызстан)","kg","996"],["Laos (ລາວ)","la","856"],["Latvia (Latvija)","lv","371"],["Lebanon (لبنان)","lb","961"],["Lesotho","ls","266"],["Liberia","lr","231"],["Libya (ليبيا)","ly","218"],["Liechtenstein","li","423"],["Lithuania (Lietuva)","lt","370"],["Luxembourg","lu","352"],["Macau (澳門)","mo","853"],["North Macedonia (Македонија)","mk","389"],["Madagascar (Madagasikara)","mg","261"],["Malawi","mw","265"],["Malaysia","my","60"],["Maldives","mv","960"],["Mali","ml","223"],["Malta","mt","356"],["Marshall Islands","mh","692"],["Martinique","mq","596"],["Mauritania (موريتانيا)","mr","222"],["Mauritius (Moris)","mu","230"],["Mayotte","yt","262",1,["269","639"]],["Mexico (México)","mx","52"],["Micronesia","fm","691"],["Moldova (Republica Moldova)","md","373"],["Monaco","mc","377"],["Mongolia (Монгол)","mn","976"],["Montenegro (Crna Gora)","me","382"],["Montserrat","ms","1",16,["664"]],["Morocco (المغرب)","ma","212",0],["Mozambique (Moçambique)","mz","258"],["Myanmar (Burma) (မြန်မာ)","mm","95"],["Namibia (Namibië)","na","264"],["Nauru","nr","674"],["Nepal (नेपाल)","np","977"],["Netherlands (Nederland)","nl","31"],["New Caledonia (Nouvelle-Calédonie)","nc","687"],["New Zealand","nz","64"],["Nicaragua","ni","505"],["Niger (Nijar)","ne","227"],["Nigeria","ng","234"],["Niue","nu","683"],["Norfolk Island","nf","672"],["North Korea (조선 민주주의 인민 공화국)","kp","850"],["Northern Mariana Islands","mp","1",17,["670"]],["Norway (Norge)","no","47",0],["Oman (عُمان)","om","968"],["Pakistan (پاکستان)","pk","92"],["Palau","pw","680"],["Palestine (فلسطين)","ps","970"],["Panama (Panamá)","pa","507"],["Papua New Guinea","pg","675"],["Paraguay","py","595"],["Peru (Perú)","pe","51"],["Philippines","ph","63"],["Poland (Polska)","pl","48"],["Portugal","pt","351"],["Puerto Rico","pr","1",3,["787","939"]],["Qatar (قطر)","qa","974"],["Réunion (La Réunion)","re","262",0],["Romania (România)","ro","40"],["Russia (Россия)","ru","7",0],["Rwanda","rw","250"],["Saint Barthélemy","bl","590",1],["Saint Helena","sh","290"],["Saint Kitts and Nevis","kn","1",18,["869"]],["Saint Lucia","lc","1",19,["758"]],["Saint Martin (Saint-Martin (partie française))","mf","590",2],["Saint Pierre and Miquelon (Saint-Pierre-et-Miquelon)","pm","508"],["Saint Vincent and the Grenadines","vc","1",20,["784"]],["Samoa","ws","685"],["San Marino","sm","378"],["São Tomé and Príncipe (São Tomé e Príncipe)","st","239"],["Saudi Arabia (المملكة العربية السعودية)","sa","966"],["Senegal (Sénégal)","sn","221"],["Serbia (Србија)","rs","381"],["Seychelles","sc","248"],["Sierra Leone","sl","232"],["Singapore","sg","65"],["Sint Maarten","sx","1",21,["721"]],["Slovakia (Slovensko)","sk","421"],["Slovenia (Slovenija)","si","386"],["Solomon Islands","sb","677"],["Somalia (Soomaaliya)","so","252"],["South Africa","za","27"],["South Korea (대한민국)","kr","82"],["South Sudan (جنوب السودان)","ss","211"],["Spain (España)","es","34"],["Sri Lanka (ශ්රී ලංකාව)","lk","94"],["Sudan (السودان)","sd","249"],["Suriname","sr","597"],["Svalbard and Jan Mayen","sj","47",1,["79"]],["Sweden (Sverige)","se","46"],["Switzerland (Schweiz)","ch","41"],["Syria (سوريا)","sy","963"],["Taiwan (台灣)","tw","886"],["Tajikistan","tj","992"],["Tanzania","tz","255"],["Thailand (ไทย)","th","66"],["Timor-Leste","tl","670"],["Togo","tg","228"],["Tokelau","tk","690"],["Tonga","to","676"],["Trinidad and Tobago","tt","1",22,["868"]],["Tunisia (تونس)","tn","216"],["Turkey (Türkiye)","tr","90"],["Turkmenistan","tm","993"],["Turks and Caicos Islands","tc","1",23,["649"]],["Tuvalu","tv","688"],["U.S. Virgin Islands","vi","1",24,["340"]],["Uganda","ug","256"],["Ukraine (Україна)","ua","380"],["United Arab Emirates (الإمارات العربية المتحدة)","ae","971"],["United Kingdom","gb","44",0],["United States","us","1",0],["Uruguay","uy","598"],["Uzbekistan (Oʻzbekiston)","uz","998"],["Vanuatu","vu","678"],["Vatican City (Città del Vaticano)","va","39",1,["06698"]],["Venezuela","ve","58"],["Vietnam (Việt Nam)","vn","84"],["Wallis and Futuna (Wallis-et-Futuna)","wf","681"],["Western Sahara (الصحراء الغربية)","eh","212",1,["5288","5289"]],["Yemen (اليمن)","ye","967"],["Zambia","zm","260"],["Zimbabwe","zw","263"],["Åland Islands","ax","358",1,["18"]]],s=0;s<t.length;s++){var e=t[s];t[s]={name:e[0],iso2:e[1],dialCode:e[2],priority:e[3]||0,areaCodes:e[4]||null}}function a(i,t){for(var s=0;s<t.length;s++){var e=t[s];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(i,e.key,e)}}var n={getInstance:function(i){var t=i.getAttribute("data-intl-tel-input-id");return window.intlTelInputGlobals.instances[t]},instances:{},documentReady:function(){return"complete"===document.readyState}};"object"==typeof window&&(window.intlTelInputGlobals=n);var r=0,o={allowDropdown:!0,autoHideDialCode:!0,autoPlaceholder:"polite",customContainer:"",customPlaceholder:null,dropdownContainer:null,excludeCountries:[],formatOnDisplay:!0,geoIpLookup:null,hiddenInput:"",initialCountry:"",localizedCountries:null,nationalMode:!0,onlyCountries:[],placeholderNumberType:"MOBILE",preferredCountries:["us","gb"],separateDialCode:!1,utilsScript:""},h=["800","822","833","844","855","866","877","880","881","882","883","884","885","886","887","888","889"],l=function(i,t){for(var s=Object.keys(i),e=0;e<s.length;e++)t(s[e],i[s[e]])},u=function(i){l(window.intlTelInputGlobals.instances,(function(t){window.intlTelInputGlobals.instances[t][i]()}))},d=function(){function s(i,t){var e=this;!function(i,t){if(!(i instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),this.id=r++,this.telInput=i,this.activeItem=null,this.highlightedItem=null;var a=t||{};this.options={},l(o,(function(i,t){e.options[i]=a.hasOwnProperty(i)?a[i]:t})),this.hadInitialPlaceholder=Boolean(i.getAttribute("placeholder"))}var e,n;return e=s,(n=[{key:"_init",value:function(){var i=this;if(this.options.nationalMode&&(this.options.autoHideDialCode=!1),this.options.separateDialCode&&(this.options.autoHideDialCode=this.options.nationalMode=!1),this.isMobile=/Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),this.isMobile&&(document.body.classList.add("iti-mobile"),this.options.dropdownContainer||(this.options.dropdownContainer=document.body)),"undefined"!=typeof Promise){var t=new Promise((function(t,s){i.resolveAutoCountryPromise=t,i.rejectAutoCountryPromise=s})),s=new Promise((function(t,s){i.resolveUtilsScriptPromise=t,i.rejectUtilsScriptPromise=s}));this.promise=Promise.all([t,s])}else this.resolveAutoCountryPromise=this.rejectAutoCountryPromise=function(){},this.resolveUtilsScriptPromise=this.rejectUtilsScriptPromise=function(){};this.selectedCountryData={},this._processCountryData(),this._generateMarkup(),this._setInitialState(),this._initListeners(),this._initRequests()}},{key:"_processCountryData",value:function(){this._processAllCountries(),this._processCountryCodes(),this._processPreferredCountries(),this.options.localizedCountries&&this._translateCountriesByLocale(),(this.options.onlyCountries.length||this.options.localizedCountries)&&this.countries.sort(this._countryNameSort)}},{key:"_addCountryCode",value:function(t,s,e){s.length>this.countryCodeMaxLen&&(this.countryCodeMaxLen=s.length),this.countryCodes.hasOwnProperty(s)||(this.countryCodes[s]=[]);for(var a=0;a<this.countryCodes[s].length;a++)if(this.countryCodes[s][a]===t)return;this.countryCodes[s][e!==i?e:this.countryCodes[s].length]=t}},{key:"_processAllCountries",value:function(){if(this.options.onlyCountries.length){var i=this.options.onlyCountries.map((function(i){return i.toLowerCase()}));this.countries=t.filter((function(t){return i.indexOf(t.iso2)>-1}))}else if(this.options.excludeCountries.length){var s=this.options.excludeCountries.map((function(i){return i.toLowerCase()}));this.countries=t.filter((function(i){return-1===s.indexOf(i.iso2)}))}else this.countries=t}},{key:"_translateCountriesByLocale",value:function(){for(var i=0;i<this.countries.length;i++){var t=this.countries[i].iso2.toLowerCase();this.options.localizedCountries.hasOwnProperty(t)&&(this.countries[i].name=this.options.localizedCountries[t])}}},{key:"_countryNameSort",value:function(i,t){return i.name.localeCompare(t.name)}},{key:"_processCountryCodes",value:function(){this.countryCodeMaxLen=0,this.dialCodes={},this.countryCodes={};for(var i=0;i<this.countries.length;i++){var t=this.countries[i];this.dialCodes[t.dialCode]||(this.dialCodes[t.dialCode]=!0),this._addCountryCode(t.iso2,t.dialCode,t.priority)}for(var s=0;s<this.countries.length;s++){var e=this.countries[s];if(e.areaCodes)for(var a=this.countryCodes[e.dialCode][0],n=0;n<e.areaCodes.length;n++){for(var r=e.areaCodes[n],o=1;o<r.length;o++){var h=e.dialCode+r.substr(0,o);this._addCountryCode(a,h),this._addCountryCode(e.iso2,h)}this._addCountryCode(e.iso2,e.dialCode+r)}}}},{key:"_processPreferredCountries",value:function(){this.preferredCountries=[];for(var i=0;i<this.options.preferredCountries.length;i++){var t=this.options.preferredCountries[i].toLowerCase(),s=this._getCountryData(t,!1,!0);s&&this.preferredCountries.push(s)}}},{key:"_createEl",value:function(i,t,s){var e=document.createElement(i);return t&&l(t,(function(i,t){return e.setAttribute(i,t)})),s&&s.appendChild(e),e}},{key:"_generateMarkup",value:function(){this.telInput.hasAttribute("autocomplete")||this.telInput.form&&this.telInput.form.hasAttribute("autocomplete")||this.telInput.setAttribute("autocomplete","off");var i="iti";this.options.allowDropdown&&(i+=" iti--allow-dropdown"),this.options.separateDialCode&&(i+=" iti--separate-dial-code"),this.options.customContainer&&(i+=" ",i+=this.options.customContainer);var t=this._createEl("div",{class:i});if(this.telInput.parentNode.insertBefore(t,this.telInput),this.flagsContainer=this._createEl("div",{class:"iti__flag-container"},t),t.appendChild(this.telInput),this.selectedFlag=this._createEl("div",{class:"iti__selected-flag",role:"combobox","aria-controls":"iti-".concat(this.id,"__country-listbox"),"aria-owns":"iti-".concat(this.id,"__country-listbox"),"aria-expanded":"false"},this.flagsContainer),this.selectedFlagInner=this._createEl("div",{class:"iti__flag"},this.selectedFlag),this.options.separateDialCode&&(this.selectedDialCode=this._createEl("div",{class:"iti__selected-dial-code"},this.selectedFlag)),this.options.allowDropdown&&(this.selectedFlag.setAttribute("tabindex","0"),this.dropdownArrow=this._createEl("div",{class:"iti__arrow"},this.selectedFlag),this.countryList=this._createEl("ul",{class:"iti__country-list iti__hide",id:"iti-".concat(this.id,"__country-listbox"),role:"listbox","aria-label":"List of countries"}),this.preferredCountries.length&&(this._appendListItems(this.preferredCountries,"iti__preferred",!0),this._createEl("li",{class:"iti__divider",role:"separator","aria-disabled":"true"},this.countryList)),this._appendListItems(this.countries,"iti__standard"),this.options.dropdownContainer?(this.dropdown=this._createEl("div",{class:"iti iti--container"}),this.dropdown.appendChild(this.countryList)):this.flagsContainer.appendChild(this.countryList)),this.options.hiddenInput){var s=this.options.hiddenInput,e=this.telInput.getAttribute("name");if(e){var a=e.lastIndexOf("[");-1!==a&&(s="".concat(e.substr(0,a),"[").concat(s,"]"))}this.hiddenInput=this._createEl("input",{type:"hidden",name:s}),t.appendChild(this.hiddenInput)}}},{key:"_appendListItems",value:function(i,t,s){for(var e="",a=0;a<i.length;a++){var n=i[a],r=s?"-preferred":"";e+="<li class='iti__country ".concat(t,"' tabIndex='-1' id='iti-").concat(this.id,"__item-").concat(n.iso2).concat(r,"' role='option' data-dial-code='").concat(n.dialCode,"' data-country-code='").concat(n.iso2,"' aria-selected='false'>"),e+="<div class='iti__flag-box'><div class='iti__flag iti__".concat(n.iso2,"'></div></div>"),e+="<span class='iti__country-name'>".concat(n.name,"</span>"),e+="<span class='iti__dial-code'>+".concat(n.dialCode,"</span>"),e+="</li>"}this.countryList.insertAdjacentHTML("beforeend",e)}},{key:"_setInitialState",value:function(){var i=this.telInput.getAttribute("value"),t=this.telInput.value,s=!i||"+"!==i.charAt(0)||t&&"+"===t.charAt(0)?t:i,e=this._getDialCode(s),a=this._isRegionlessNanp(s),n=this.options,r=n.initialCountry,o=n.nationalMode,h=n.autoHideDialCode,l=n.separateDialCode;e&&!a?this._updateFlagFromNumber(s):"auto"!==r&&(r?this._setFlag(r.toLowerCase()):e&&a?this._setFlag("us"):(this.defaultCountry=this.preferredCountries.length?this.preferredCountries[0].iso2:this.countries[0].iso2,s||this._setFlag(this.defaultCountry)),s||o||h||l||(this.telInput.value="+".concat(this.selectedCountryData.dialCode))),s&&this._updateValFromNumber(s)}},{key:"_initListeners",value:function(){this._initKeyListeners(),this.options.autoHideDialCode&&this._initBlurListeners(),this.options.allowDropdown&&this._initDropdownListeners(),this.hiddenInput&&this._initHiddenInputListener()}},{key:"_initHiddenInputListener",value:function(){var i=this;this._handleHiddenInputSubmit=function(){i.hiddenInput.value=i.getNumber()},this.telInput.form&&this.telInput.form.addEventListener("submit",this._handleHiddenInputSubmit)}},{key:"_getClosestLabel",value:function(){for(var i=this.telInput;i&&"LABEL"!==i.tagName;)i=i.parentNode;return i}},{key:"_initDropdownListeners",value:function(){var i=this;this._handleLabelClick=function(t){i.countryList.classList.contains("iti__hide")?i.telInput.focus():t.preventDefault()};var t=this._getClosestLabel();t&&t.addEventListener("click",this._handleLabelClick),this._handleClickSelectedFlag=function(){!i.countryList.classList.contains("iti__hide")||i.telInput.disabled||i.telInput.readOnly||i._showDropdown()},this.selectedFlag.addEventListener("click",this._handleClickSelectedFlag),this._handleFlagsContainerKeydown=function(t){i.countryList.classList.contains("iti__hide")&&-1!==["ArrowUp","Up","ArrowDown","Down"," ","Enter"].indexOf(t.key)&&(t.preventDefault(),t.stopPropagation(),i._showDropdown()),"Tab"===t.key&&i._closeDropdown()},this.flagsContainer.addEventListener("keydown",this._handleFlagsContainerKeydown)}},{key:"_initRequests",value:function(){var i=this;this.options.utilsScript&&!window.intlTelInputUtils?window.intlTelInputGlobals.documentReady()?window.intlTelInputGlobals.loadUtils(this.options.utilsScript):window.addEventListener("load",(function(){window.intlTelInputGlobals.loadUtils(i.options.utilsScript)})):this.resolveUtilsScriptPromise(),"auto"===this.options.initialCountry?this._loadAutoCountry():this.resolveAutoCountryPromise()}},{key:"_loadAutoCountry",value:function(){window.intlTelInputGlobals.autoCountry?this.handleAutoCountry():window.intlTelInputGlobals.startedLoadingAutoCountry||(window.intlTelInputGlobals.startedLoadingAutoCountry=!0,"function"==typeof this.options.geoIpLookup&&this.options.geoIpLookup((function(i){window.intlTelInputGlobals.autoCountry=i.toLowerCase(),setTimeout((function(){return u("handleAutoCountry")}))}),(function(){return u("rejectAutoCountryPromise")})))}},{key:"_initKeyListeners",value:function(){var i=this;this._handleKeyupEvent=function(){i._updateFlagFromNumber(i.telInput.value)&&i._triggerCountryChange()},this.telInput.addEventListener("keyup",this._handleKeyupEvent),this._handleClipboardEvent=function(){setTimeout(i._handleKeyupEvent)},this.telInput.addEventListener("cut",this._handleClipboardEvent),this.telInput.addEventListener("paste",this._handleClipboardEvent)}},{key:"_cap",value:function(i){var t=this.telInput.getAttribute("maxlength");return t&&i.length>t?i.substr(0,t):i}},{key:"_initBlurListeners",value:function(){var i=this;this._handleSubmitOrBlurEvent=function(){i._removeEmptyDialCode()},this.telInput.form&&this.telInput.form.addEventListener("submit",this._handleSubmitOrBlurEvent),this.telInput.addEventListener("blur",this._handleSubmitOrBlurEvent)}},{key:"_removeEmptyDialCode",value:function(){if("+"===this.telInput.value.charAt(0)){var i=this._getNumeric(this.telInput.value);i&&this.selectedCountryData.dialCode!==i||(this.telInput.value="")}}},{key:"_getNumeric",value:function(i){return i.replace(/\D/g,"")}},{key:"_trigger",value:function(i){var t=document.createEvent("Event");t.initEvent(i,!0,!0),this.telInput.dispatchEvent(t)}},{key:"_showDropdown",value:function(){this.countryList.classList.remove("iti__hide"),this.selectedFlag.setAttribute("aria-expanded","true"),this._setDropdownPosition(),this.activeItem&&(this._highlightListItem(this.activeItem,!1),this._scrollTo(this.activeItem,!0)),this._bindDropdownListeners(),this.dropdownArrow.classList.add("iti__arrow--up"),this._trigger("open:countrydropdown")}},{key:"_toggleClass",value:function(i,t,s){s&&!i.classList.contains(t)?i.classList.add(t):!s&&i.classList.contains(t)&&i.classList.remove(t)}},{key:"_setDropdownPosition",value:function(){var i=this;if(this.options.dropdownContainer&&this.options.dropdownContainer.appendChild(this.dropdown),!this.isMobile){var t=this.telInput.getBoundingClientRect(),s=window.pageYOffset||document.documentElement.scrollTop,e=t.top+s,a=this.countryList.offsetHeight,n=e+this.telInput.offsetHeight+a<s+window.innerHeight,r=e-a>s;this._toggleClass(this.countryList,"iti__country-list--dropup",!n&&r),this.options.dropdownContainer&&(this.dropdown.style.top="".concat(e+(!n&&r?0:this.telInput.offsetHeight),"px"),this.dropdown.style.left="".concat(t.left+document.body.scrollLeft,"px"),this._handleWindowScroll=function(){return i._closeDropdown()},window.addEventListener("scroll",this._handleWindowScroll))}}},{key:"_getClosestListItem",value:function(i){for(var t=i;t&&t!==this.countryList&&!t.classList.contains("iti__country");)t=t.parentNode;return t===this.countryList?null:t}},{key:"_bindDropdownListeners",value:function(){var i=this;this._handleMouseoverCountryList=function(t){var s=i._getClosestListItem(t.target);s&&i._highlightListItem(s,!1)},this.countryList.addEventListener("mouseover",this._handleMouseoverCountryList),this._handleClickCountryList=function(t){var s=i._getClosestListItem(t.target);s&&i._selectListItem(s)},this.countryList.addEventListener("click",this._handleClickCountryList);var t=!0;this._handleClickOffToClose=function(){t||i._closeDropdown(),t=!1},document.documentElement.addEventListener("click",this._handleClickOffToClose);var s="",e=null;this._handleKeydownOnDropdown=function(t){t.preventDefault(),"ArrowUp"===t.key||"Up"===t.key||"ArrowDown"===t.key||"Down"===t.key?i._handleUpDownKey(t.key):"Enter"===t.key?i._handleEnterKey():"Escape"===t.key?i._closeDropdown():/^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(t.key)&&(e&&clearTimeout(e),s+=t.key.toLowerCase(),i._searchForCountry(s),e=setTimeout((function(){s=""}),1e3))},document.addEventListener("keydown",this._handleKeydownOnDropdown)}},{key:"_handleUpDownKey",value:function(i){var t="ArrowUp"===i||"Up"===i?this.highlightedItem.previousElementSibling:this.highlightedItem.nextElementSibling;t&&(t.classList.contains("iti__divider")&&(t="ArrowUp"===i||"Up"===i?t.previousElementSibling:t.nextElementSibling),this._highlightListItem(t,!0))}},{key:"_handleEnterKey",value:function(){this.highlightedItem&&this._selectListItem(this.highlightedItem)}},{key:"_searchForCountry",value:function(i){for(var t=0;t<this.countries.length;t++)if(this._startsWith(this.countries[t].name,i)){var s=this.countryList.querySelector("#iti-".concat(this.id,"__item-").concat(this.countries[t].iso2));this._highlightListItem(s,!1),this._scrollTo(s,!0);break}}},{key:"_startsWith",value:function(i,t){return i.substr(0,t.length).toLowerCase()===t}},{key:"_updateValFromNumber",value:function(i){var t=i;if(this.options.formatOnDisplay&&window.intlTelInputUtils&&this.selectedCountryData){var s=!this.options.separateDialCode&&(this.options.nationalMode||"+"!==t.charAt(0)),e=intlTelInputUtils.numberFormat;t=intlTelInputUtils.formatNumber(t,this.selectedCountryData.iso2,s?e.NATIONAL:e.INTERNATIONAL)}t=this._beforeSetNumber(t),this.telInput.value=t}},{key:"_updateFlagFromNumber",value:function(i){var t=i,s=this.selectedCountryData.dialCode;t&&this.options.nationalMode&&"1"===s&&"+"!==t.charAt(0)&&("1"!==t.charAt(0)&&(t="1".concat(t)),t="+".concat(t)),this.options.separateDialCode&&s&&"+"!==t.charAt(0)&&(t="+".concat(s).concat(t));var e=this._getDialCode(t,!0),a=this._getNumeric(t),n=null;if(e){var r=this.countryCodes[this._getNumeric(e)],o=-1!==r.indexOf(this.selectedCountryData.iso2)&&a.length<=e.length-1;if(!("1"===s&&this._isRegionlessNanp(a)||o))for(var h=0;h<r.length;h++)if(r[h]){n=r[h];break}}else"+"===t.charAt(0)&&a.length?n="":t&&"+"!==t||(n=this.defaultCountry);return null!==n&&this._setFlag(n)}},{key:"_isRegionlessNanp",value:function(i){var t=this._getNumeric(i);if("1"===t.charAt(0)){var s=t.substr(1,3);return-1!==h.indexOf(s)}return!1}},{key:"_highlightListItem",value:function(i,t){var s=this.highlightedItem;s&&s.classList.remove("iti__highlight"),this.highlightedItem=i,this.highlightedItem.classList.add("iti__highlight"),t&&this.highlightedItem.focus()}},{key:"_getCountryData",value:function(i,s,e){for(var a=s?t:this.countries,n=0;n<a.length;n++)if(a[n].iso2===i)return a[n];if(e)return null;throw new Error("No country data for '".concat(i,"'"))}},{key:"_setFlag",value:function(i){var t=this.selectedCountryData.iso2?this.selectedCountryData:{};this.selectedCountryData=i?this._getCountryData(i,!1,!1):{},this.selectedCountryData.iso2&&(this.defaultCountry=this.selectedCountryData.iso2),this.selectedFlagInner.setAttribute("class","iti__flag iti__".concat(i));var s=i?"".concat(this.selectedCountryData.name,": +").concat(this.selectedCountryData.dialCode):"Unknown";if(this.selectedFlag.setAttribute("title",s),this.options.separateDialCode){var e=this.selectedCountryData.dialCode?"+".concat(this.selectedCountryData.dialCode):"";this.selectedDialCode.innerHTML=e;var a=this.selectedFlag.offsetWidth||this._getHiddenSelectedFlagWidth();this.telInput.style.paddingLeft="".concat(a+6,"px")}if(this._updatePlaceholder(),this.options.allowDropdown){var n=this.activeItem;if(n&&(n.classList.remove("iti__active"),n.setAttribute("aria-selected","false")),i){var r=this.countryList.querySelector("#iti-".concat(this.id,"__item-").concat(i,"-preferred"))||this.countryList.querySelector("#iti-".concat(this.id,"__item-").concat(i));r.setAttribute("aria-selected","true"),r.classList.add("iti__active"),this.activeItem=r,this.selectedFlag.setAttribute("aria-activedescendant",r.getAttribute("id"))}}return t.iso2!==i}},{key:"_getHiddenSelectedFlagWidth",value:function(){var i=this.telInput.parentNode.cloneNode();i.style.visibility="hidden",document.body.appendChild(i);var t=this.flagsContainer.cloneNode();i.appendChild(t);var s=this.selectedFlag.cloneNode(!0);t.appendChild(s);var e=s.offsetWidth;return i.parentNode.removeChild(i),e}},{key:"_updatePlaceholder",value:function(){if(window.intlTelInputUtils&&("aggressive"===this.options.autoPlaceholder||!this.hadInitialPlaceholder&&"polite"===this.options.autoPlaceholder)){var i=intlTelInputUtils.numberType[this.options.placeholderNumberType],t=this.selectedCountryData.iso2?intlTelInputUtils.getExampleNumber(this.selectedCountryData.iso2,this.options.nationalMode,i):"";t=this._beforeSetNumber(t),"function"==typeof this.options.customPlaceholder&&(t=this.options.customPlaceholder(t,this.selectedCountryData)),this.telInput.setAttribute("placeholder",t)}}},{key:"_selectListItem",value:function(i){var t=this._setFlag(i.getAttribute("data-country-code"));this._closeDropdown(),this._updateDialCode(i.getAttribute("data-dial-code"),!0),this.telInput.focus();var s=this.telInput.value.length;this.telInput.setSelectionRange(s,s),t&&this._triggerCountryChange()}},{key:"_closeDropdown",value:function(){this.countryList.classList.add("iti__hide"),this.selectedFlag.setAttribute("aria-expanded","false"),this.dropdownArrow.classList.remove("iti__arrow--up"),document.removeEventListener("keydown",this._handleKeydownOnDropdown),document.documentElement.removeEventListener("click",this._handleClickOffToClose),this.countryList.removeEventListener("mouseover",this._handleMouseoverCountryList),this.countryList.removeEventListener("click",this._handleClickCountryList),this.options.dropdownContainer&&(this.isMobile||window.removeEventListener("scroll",this._handleWindowScroll),this.dropdown.parentNode&&this.dropdown.parentNode.removeChild(this.dropdown)),this._trigger("close:countrydropdown")}},{key:"_scrollTo",value:function(i,t){var s=this.countryList,e=window.pageYOffset||document.documentElement.scrollTop,a=s.offsetHeight,n=s.getBoundingClientRect().top+e,r=n+a,o=i.offsetHeight,h=i.getBoundingClientRect().top+e,l=h+o,u=h-n+s.scrollTop,d=a/2-o/2;h<n?(t&&(u-=d),s.scrollTop=u):l>r&&(t&&(u+=d),s.scrollTop=u-(a-o))}},{key:"_updateDialCode",value:function(i,t){var s,e=this.telInput.value,a="+".concat(i);if("+"===e.charAt(0)){var n=this._getDialCode(e);s=n?e.replace(n,a):a}else{if(this.options.nationalMode||this.options.separateDialCode)return;if(e)s=a+e;else{if(!t&&this.options.autoHideDialCode)return;s=a}}this.telInput.value=s}},{key:"_getDialCode",value:function(i,t){var s="";if("+"===i.charAt(0))for(var e="",a=0;a<i.length;a++){var n=i.charAt(a);if(!isNaN(parseInt(n,10))){if(e+=n,t)this.countryCodes[e]&&(s=i.substr(0,a+1));else if(this.dialCodes[e]){s=i.substr(0,a+1);break}if(e.length===this.countryCodeMaxLen)break}}return s}},{key:"_getFullNumber",value:function(){var i=this.telInput.value.trim(),t=this.selectedCountryData.dialCode,s=this._getNumeric(i);return(this.options.separateDialCode&&"+"!==i.charAt(0)&&t&&s?"+".concat(t):"")+i}},{key:"_beforeSetNumber",value:function(i){var t=i;if(this.options.separateDialCode){var s=this._getDialCode(t);s&&(s="+".concat(this.selectedCountryData.dialCode),t=t.substr(" "===t[s.length]||"-"===t[s.length]?s.length+1:s.length))}return this._cap(t)}},{key:"_triggerCountryChange",value:function(){this._trigger("countrychange")}},{key:"handleAutoCountry",value:function(){"auto"===this.options.initialCountry&&(this.defaultCountry=window.intlTelInputGlobals.autoCountry,this.telInput.value||this.setCountry(this.defaultCountry),this.resolveAutoCountryPromise())}},{key:"handleUtils",value:function(){window.intlTelInputUtils&&(this.telInput.value&&this._updateValFromNumber(this.telInput.value),this._updatePlaceholder()),this.resolveUtilsScriptPromise()}},{key:"destroy",value:function(){var i=this.telInput.form;if(this.options.allowDropdown){this._closeDropdown(),this.selectedFlag.removeEventListener("click",this._handleClickSelectedFlag),this.flagsContainer.removeEventListener("keydown",this._handleFlagsContainerKeydown);var t=this._getClosestLabel();t&&t.removeEventListener("click",this._handleLabelClick)}this.hiddenInput&&i&&i.removeEventListener("submit",this._handleHiddenInputSubmit),this.options.autoHideDialCode&&(i&&i.removeEventListener("submit",this._handleSubmitOrBlurEvent),this.telInput.removeEventListener("blur",this._handleSubmitOrBlurEvent)),this.telInput.removeEventListener("keyup",this._handleKeyupEvent),this.telInput.removeEventListener("cut",this._handleClipboardEvent),this.telInput.removeEventListener("paste",this._handleClipboardEvent),this.telInput.removeAttribute("data-intl-tel-input-id");var s=this.telInput.parentNode;s.parentNode.insertBefore(this.telInput,s),s.parentNode.removeChild(s),delete window.intlTelInputGlobals.instances[this.id]}},{key:"getExtension",value:function(){return window.intlTelInputUtils?intlTelInputUtils.getExtension(this._getFullNumber(),this.selectedCountryData.iso2):""}},{key:"getNumber",value:function(i){if(window.intlTelInputUtils){var t=this.selectedCountryData.iso2;return intlTelInputUtils.formatNumber(this._getFullNumber(),t,i)}return""}},{key:"getNumberType",value:function(){return window.intlTelInputUtils?intlTelInputUtils.getNumberType(this._getFullNumber(),this.selectedCountryData.iso2):-99}},{key:"getSelectedCountryData",value:function(){return this.selectedCountryData}},{key:"getValidationError",value:function(){if(window.intlTelInputUtils){var i=this.selectedCountryData.iso2;return intlTelInputUtils.getValidationError(this._getFullNumber(),i)}return-99}},{key:"isValidNumber",value:function(){var i=this._getFullNumber().trim();return window.intlTelInputUtils?intlTelInputUtils.isValidNumber(i,this.options.nationalMode?this.selectedCountryData.iso2:""):null}},{key:"setCountry",value:function(i){var t=i.toLowerCase();this.selectedFlagInner.classList.contains("iti__".concat(t))||(this._setFlag(t),this._updateDialCode(this.selectedCountryData.dialCode,!1),this._triggerCountryChange())}},{key:"setNumber",value:function(i){var t=this._updateFlagFromNumber(i);this._updateValFromNumber(i),t&&this._triggerCountryChange()}},{key:"setPlaceholderNumberType",value:function(i){this.options.placeholderNumberType=i,this._updatePlaceholder()}}])&&a(e.prototype,n),s}();n.getCountryData=function(){return t};var c=function(i,t,s){var e=document.createElement("script");e.onload=function(){u("handleUtils"),t&&t()},e.onerror=function(){u("rejectUtilsScriptPromise"),s&&s()},e.className="iti-load-utils",e.async=!0,e.src=i,document.body.appendChild(e)};return n.loadUtils=function(i){if(!window.intlTelInputUtils&&!window.intlTelInputGlobals.startedLoadingUtilsScript){if(window.intlTelInputGlobals.startedLoadingUtilsScript=!0,"undefined"!=typeof Promise)return new Promise((function(t,s){return c(i,t,s)}));c(i)}return null},n.defaults=o,n.version="17.0.15",function(i,t){var s=new d(i,t);return s._init(),i.setAttribute("data-intl-tel-input-id",s.id),window.intlTelInputGlobals.instances[s.id]=s,s}}()},i.exports?i.exports=t():window.intlTelInput=t()}(h={path:undefined,exports:{},require:function(){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}()}}),h.exports);const u=class{constructor(t){i(this,t),console.log(l)}render(){return t(s,null,t("slot",null,t("h1",null,"Test Tel Input")))}},d=class{constructor(t){i(this,t),this.verified=a(this,"verified",7),this.backClicked=a(this,"backClicked",7),this.url="profile/verify-mobile",this.by="sms",this.autoReload=!0,n.setHost(this.host),this.withoutModal?this.modal={show:()=>"",hide:()=>""}:salla.event.on("profile::verify.mobile",(i=>this.show(i)))}async getCode(){return this.code.value}async show(i){return this.data=i,this.resendTimer(),this.otpInputs=document.querySelectorAll(".s-verify-input"),this.otpInputs[0].focus(),n.on("input",".s-verify-input",(i=>salla.helpers.digitsOnly(i.target))),n.onKeyUp(".s-verify-input",(i=>{var t,s,e,a;let n=i.keyCode||i.charCode;i.target.value?(null===(t=i.target.nextElementSibling)||void 0===t||t.focus(),null===(s=i.target.nextElementSibling)||void 0===s||s.select()):[8,46].includes(n)&&(null===(e=i.target.previousElementSibling)||void 0===e||e.focus(),null===(a=i.target.previousElementSibling)||void 0===a||a.select()),this.toggleOTPSubmit()})),n.on("paste",".s-verify-input",(i=>{let t=i.clipboardData.getData("text").toArabicDigits().replace(/[^0-9.]/g,"").replace("..",".");this.otpInputs.forEach(((i,s)=>i.value=t[s]||"")),this.toggleOTPSubmit(),setTimeout((()=>this.otpInputs[3].focus()),100)})),this.modal.show()}toggleOTPSubmit(){let i=[];if(this.otpInputs.forEach((t=>t.value&&i.push(t.value))),this.code.value=i.join(""),4===i.length)return this.btn.removeAttribute("disabled"),void this.btn.click();this.btn.setAttribute("disabled","")}resendTimer(){n.showElement(this.resendMessage).hideElement(this.resend);let i=30,t=setInterval((()=>{-1===i?(clearTimeout(t),n.hideElement(this.resendMessage).showElement(this.resend)):(this.timer.innerHTML=`${i>=10?i:"0"+i} : 00`,i--)}),1e3)}resendCode(){return this.btn.stop().then((()=>this.btn.disable())).then((()=>{this.otpInputs.forEach((i=>i.value="")),this.otpInputs[0].focus()})).then((()=>salla.api.auth.resend(Object.assign({resend_by:this.by},this.data)))).then((()=>this.resendTimer())).catch((()=>this.resendTimer()))}submit(){return this.btn.load().then((()=>this.btn.disable())).then((()=>salla.document.api.request(this.url,Object.assign({code:this.code.value},this.data)))).then((i=>this.verified.emit(i))).then((()=>this.btn.stop()&&this.btn.disable())).then((()=>this.modal.hide())).then((()=>this.autoReload&&window.location.reload())).catch((()=>this.btn.stop()&&this.btn.enable()))}render(){return this.withoutModal?this.myBody():t("salla-modal",{id:"s-verify",ref:i=>this.modal=i,title:salla.lang.get("pages.profile.verify_title")},this.myBody())}myBody(){return[t("div",{class:"s-verify-message",innerHTML:salla.lang.get("pages.profile.verify_message")}),t("input",{type:"hidden",name:"code",maxlength:"4",required:!0,ref:i=>this.code=i}),t("div",{class:"s-verify-codes",dir:"ltr"},[1,2,3,4].map((()=>t("input",{type:"text",maxlength:"1",class:"s-verify-input",required:!0})))),t("div",{slot:"footer",class:"s-verify-footer"},t("salla-button",{class:"s-verify-submit",disabled:!0,onClick:()=>this.submit(),ref:i=>this.btn=i},salla.lang.get("pages.profile.verify")),t("p",{class:"s-verify-resend-message",ref:i=>this.resendMessage=i},salla.lang.get("blocks.header.resend_after"),t("b",{class:"s-verify-timer",ref:i=>this.timer=i})),t("a",{href:"#",class:"s-verify-resend",onClick:()=>this.resendCode(),ref:i=>this.resend=i},salla.lang.get("blocks.comments.submit")),this.backText?t("a",{href:"#",class:"s-verify-resend",onClick:()=>this.backClicked.emit()},this.backText):"")]}get host(){return e(this)}};export{r as salla_button,o as salla_modal,u as salla_tel_input,d as salla_verify}
|