forked from zammad/zammad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
chat-no-jquery.js
2625 lines (2423 loc) · 112 KB
/
chat-no-jquery.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
if (!window.zammadChatTemplates) {
window.zammadChatTemplates = {};
}
window.zammadChatTemplates["agent"] = function(__obj) {
if (!__obj) __obj = {};
var __out = [], __capture = function(callback) {
var out = __out, result;
__out = [];
callback.call(this);
result = __out.join('');
__out = out;
return __safe(result);
}, __sanitize = function(value) {
if (value && value.ecoSafe) {
return value;
} else if (typeof value !== 'undefined' && value != null) {
return __escape(value);
} else {
return '';
}
}, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
__safe = __obj.safe = function(value) {
if (value && value.ecoSafe) {
return value;
} else {
if (!(typeof value !== 'undefined' && value != null)) value = '';
var result = new String(value);
result.ecoSafe = true;
return result;
}
};
if (!__escape) {
__escape = __obj.escape = function(value) {
return ('' + value)
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"');
};
}
(function() {
(function() {
if (this.agent.avatar) {
__out.push('\n<img class="zammad-chat-agent-avatar" src="');
__out.push(__sanitize(this.agent.avatar));
__out.push('">\n');
}
__out.push('\n<span class="zammad-chat-agent-sentence">\n <span class="zammad-chat-agent-name">');
__out.push(__sanitize(this.agent.name));
__out.push('</span>\n</span>');
}).call(this);
}).call(__obj);
__obj.safe = __objSafe, __obj.escape = __escape;
return __out.join('');
};
/*! @license DOMPurify 2.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.3.1/LICENSE */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).DOMPurify=t()}(this,(function(){"use strict";var e=Object.hasOwnProperty,t=Object.setPrototypeOf,n=Object.isFrozen,r=Object.getPrototypeOf,o=Object.getOwnPropertyDescriptor,i=Object.freeze,a=Object.seal,l=Object.create,c="undefined"!=typeof Reflect&&Reflect,s=c.apply,u=c.construct;s||(s=function(e,t,n){return e.apply(t,n)}),i||(i=function(e){return e}),a||(a=function(e){return e}),u||(u=function(e,t){return new(Function.prototype.bind.apply(e,[null].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(t))))});var f,m=x(Array.prototype.forEach),d=x(Array.prototype.pop),p=x(Array.prototype.push),g=x(String.prototype.toLowerCase),h=x(String.prototype.match),y=x(String.prototype.replace),v=x(String.prototype.indexOf),b=x(String.prototype.trim),T=x(RegExp.prototype.test),A=(f=TypeError,function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return u(f,t)});function x(e){return function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return s(e,t,r)}}function S(e,r){t&&t(e,null);for(var o=r.length;o--;){var i=r[o];if("string"==typeof i){var a=g(i);a!==i&&(n(r)||(r[o]=a),i=a)}e[i]=!0}return e}function w(t){var n=l(null),r=void 0;for(r in t)s(e,t,[r])&&(n[r]=t[r]);return n}function N(e,t){for(;null!==e;){var n=o(e,t);if(n){if(n.get)return x(n.get);if("function"==typeof n.value)return x(n.value)}e=r(e)}return function(e){return console.warn("fallback value for",e),null}}var k=i(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),E=i(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),D=i(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),O=i(["animate","color-profile","cursor","discard","fedropshadow","feimage","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),R=i(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),_=i(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),M=i(["#text"]),L=i(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),F=i(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),I=i(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),C=i(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),z=a(/\{\{[\s\S]*|[\s\S]*\}\}/gm),H=a(/<%[\s\S]*|[\s\S]*%>/gm),U=a(/^data-[\-\w.\u00B7-\uFFFF]/),j=a(/^aria-[\-\w]+$/),B=a(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),P=a(/^(?:\w+script|data):/i),W=a(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),G="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function q(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var K=function(){return"undefined"==typeof window?null:window},V=function(e,t){if("object"!==(void 0===e?"undefined":G(e))||"function"!=typeof e.createPolicy)return null;var n=null,r="data-tt-policy-suffix";t.currentScript&&t.currentScript.hasAttribute(r)&&(n=t.currentScript.getAttribute(r));var o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML:function(e){return e}})}catch(e){return console.warn("TrustedTypes policy "+o+" could not be created."),null}};return function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:K(),n=function(t){return e(t)};if(n.version="2.3.1",n.removed=[],!t||!t.document||9!==t.document.nodeType)return n.isSupported=!1,n;var r=t.document,o=t.document,a=t.DocumentFragment,l=t.HTMLTemplateElement,c=t.Node,s=t.Element,u=t.NodeFilter,f=t.NamedNodeMap,x=void 0===f?t.NamedNodeMap||t.MozNamedAttrMap:f,Y=t.Text,X=t.Comment,$=t.DOMParser,Z=t.trustedTypes,J=s.prototype,Q=N(J,"cloneNode"),ee=N(J,"nextSibling"),te=N(J,"childNodes"),ne=N(J,"parentNode");if("function"==typeof l){var re=o.createElement("template");re.content&&re.content.ownerDocument&&(o=re.content.ownerDocument)}var oe=V(Z,r),ie=oe&&ze?oe.createHTML(""):"",ae=o,le=ae.implementation,ce=ae.createNodeIterator,se=ae.createDocumentFragment,ue=ae.getElementsByTagName,fe=r.importNode,me={};try{me=w(o).documentMode?o.documentMode:{}}catch(e){}var de={};n.isSupported="function"==typeof ne&&le&&void 0!==le.createHTMLDocument&&9!==me;var pe=z,ge=H,he=U,ye=j,ve=P,be=W,Te=B,Ae=null,xe=S({},[].concat(q(k),q(E),q(D),q(R),q(M))),Se=null,we=S({},[].concat(q(L),q(F),q(I),q(C))),Ne=null,ke=null,Ee=!0,De=!0,Oe=!1,Re=!1,_e=!1,Me=!1,Le=!1,Fe=!1,Ie=!1,Ce=!0,ze=!1,He=!0,Ue=!0,je=!1,Be={},Pe=null,We=S({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),Ge=null,qe=S({},["audio","video","img","source","image","track"]),Ke=null,Ve=S({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ye="http://www.w3.org/1998/Math/MathML",Xe="http://www.w3.org/2000/svg",$e="http://www.w3.org/1999/xhtml",Ze=$e,Je=!1,Qe=null,et=o.createElement("form"),tt=function(e){Qe&&Qe===e||(e&&"object"===(void 0===e?"undefined":G(e))||(e={}),e=w(e),Ae="ALLOWED_TAGS"in e?S({},e.ALLOWED_TAGS):xe,Se="ALLOWED_ATTR"in e?S({},e.ALLOWED_ATTR):we,Ke="ADD_URI_SAFE_ATTR"in e?S(w(Ve),e.ADD_URI_SAFE_ATTR):Ve,Ge="ADD_DATA_URI_TAGS"in e?S(w(qe),e.ADD_DATA_URI_TAGS):qe,Pe="FORBID_CONTENTS"in e?S({},e.FORBID_CONTENTS):We,Ne="FORBID_TAGS"in e?S({},e.FORBID_TAGS):{},ke="FORBID_ATTR"in e?S({},e.FORBID_ATTR):{},Be="USE_PROFILES"in e&&e.USE_PROFILES,Ee=!1!==e.ALLOW_ARIA_ATTR,De=!1!==e.ALLOW_DATA_ATTR,Oe=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Re=e.SAFE_FOR_TEMPLATES||!1,_e=e.WHOLE_DOCUMENT||!1,Fe=e.RETURN_DOM||!1,Ie=e.RETURN_DOM_FRAGMENT||!1,Ce=!1!==e.RETURN_DOM_IMPORT,ze=e.RETURN_TRUSTED_TYPE||!1,Le=e.FORCE_BODY||!1,He=!1!==e.SANITIZE_DOM,Ue=!1!==e.KEEP_CONTENT,je=e.IN_PLACE||!1,Te=e.ALLOWED_URI_REGEXP||Te,Ze=e.NAMESPACE||$e,Re&&(De=!1),Ie&&(Fe=!0),Be&&(Ae=S({},[].concat(q(M))),Se=[],!0===Be.html&&(S(Ae,k),S(Se,L)),!0===Be.svg&&(S(Ae,E),S(Se,F),S(Se,C)),!0===Be.svgFilters&&(S(Ae,D),S(Se,F),S(Se,C)),!0===Be.mathMl&&(S(Ae,R),S(Se,I),S(Se,C))),e.ADD_TAGS&&(Ae===xe&&(Ae=w(Ae)),S(Ae,e.ADD_TAGS)),e.ADD_ATTR&&(Se===we&&(Se=w(Se)),S(Se,e.ADD_ATTR)),e.ADD_URI_SAFE_ATTR&&S(Ke,e.ADD_URI_SAFE_ATTR),e.FORBID_CONTENTS&&(Pe===We&&(Pe=w(Pe)),S(Pe,e.FORBID_CONTENTS)),Ue&&(Ae["#text"]=!0),_e&&S(Ae,["html","head","body"]),Ae.table&&(S(Ae,["tbody"]),delete Ne.tbody),i&&i(e),Qe=e)},nt=S({},["mi","mo","mn","ms","mtext"]),rt=S({},["foreignobject","desc","title","annotation-xml"]),ot=S({},E);S(ot,D),S(ot,O);var it=S({},R);S(it,_);var at=function(e){var t=ne(e);t&&t.tagName||(t={namespaceURI:$e,tagName:"template"});var n=g(e.tagName),r=g(t.tagName);if(e.namespaceURI===Xe)return t.namespaceURI===$e?"svg"===n:t.namespaceURI===Ye?"svg"===n&&("annotation-xml"===r||nt[r]):Boolean(ot[n]);if(e.namespaceURI===Ye)return t.namespaceURI===$e?"math"===n:t.namespaceURI===Xe?"math"===n&&rt[r]:Boolean(it[n]);if(e.namespaceURI===$e){if(t.namespaceURI===Xe&&!rt[r])return!1;if(t.namespaceURI===Ye&&!nt[r])return!1;var o=S({},["title","style","font","a","script"]);return!it[n]&&(o[n]||!ot[n])}return!1},lt=function(e){p(n.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){try{e.outerHTML=ie}catch(t){e.remove()}}},ct=function(e,t){try{p(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){p(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!Se[e])if(Fe||Ie)try{lt(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},st=function(e){var t=void 0,n=void 0;if(Le)e="<remove></remove>"+e;else{var r=h(e,/^[\r\n\t ]+/);n=r&&r[0]}var i=oe?oe.createHTML(e):e;if(Ze===$e)try{t=(new $).parseFromString(i,"text/html")}catch(e){}if(!t||!t.documentElement){t=le.createDocument(Ze,"template",null);try{t.documentElement.innerHTML=Je?"":i}catch(e){}}var a=t.body||t.documentElement;return e&&n&&a.insertBefore(o.createTextNode(n),a.childNodes[0]||null),Ze===$e?ue.call(t,_e?"html":"body")[0]:_e?t.documentElement:a},ut=function(e){return ce.call(e.ownerDocument||e,e,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT,null,!1)},ft=function(e){return!(e instanceof Y||e instanceof X)&&!("string"==typeof e.nodeName&&"string"==typeof e.textContent&&"function"==typeof e.removeChild&&e.attributes instanceof x&&"function"==typeof e.removeAttribute&&"function"==typeof e.setAttribute&&"string"==typeof e.namespaceURI&&"function"==typeof e.insertBefore)},mt=function(e){return"object"===(void 0===c?"undefined":G(c))?e instanceof c:e&&"object"===(void 0===e?"undefined":G(e))&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},dt=function(e,t,r){de[e]&&m(de[e],(function(e){e.call(n,t,r,Qe)}))},pt=function(e){var t=void 0;if(dt("beforeSanitizeElements",e,null),ft(e))return lt(e),!0;if(h(e.nodeName,/[\u0080-\uFFFF]/))return lt(e),!0;var r=g(e.nodeName);if(dt("uponSanitizeElement",e,{tagName:r,allowedTags:Ae}),!mt(e.firstElementChild)&&(!mt(e.content)||!mt(e.content.firstElementChild))&&T(/<[/\w]/g,e.innerHTML)&&T(/<[/\w]/g,e.textContent))return lt(e),!0;if("select"===r&&T(/<template/i,e.innerHTML))return lt(e),!0;if(!Ae[r]||Ne[r]){if(Ue&&!Pe[r]){var o=ne(e)||e.parentNode,i=te(e)||e.childNodes;if(i&&o)for(var a=i.length-1;a>=0;--a)o.insertBefore(Q(i[a],!0),ee(e))}return lt(e),!0}return e instanceof s&&!at(e)?(lt(e),!0):"noscript"!==r&&"noembed"!==r||!T(/<\/no(script|embed)/i,e.innerHTML)?(Re&&3===e.nodeType&&(t=e.textContent,t=y(t,pe," "),t=y(t,ge," "),e.textContent!==t&&(p(n.removed,{element:e.cloneNode()}),e.textContent=t)),dt("afterSanitizeElements",e,null),!1):(lt(e),!0)},gt=function(e,t,n){if(He&&("id"===t||"name"===t)&&(n in o||n in et))return!1;if(De&&!ke[t]&&T(he,t));else if(Ee&&T(ye,t));else{if(!Se[t]||ke[t])return!1;if(Ke[t]);else if(T(Te,y(n,be,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==v(n,"data:")||!Ge[e]){if(Oe&&!T(ve,y(n,be,"")));else if(n)return!1}else;}return!0},ht=function(e){var t=void 0,r=void 0,o=void 0,i=void 0;dt("beforeSanitizeAttributes",e,null);var a=e.attributes;if(a){var l={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Se};for(i=a.length;i--;){var c=t=a[i],s=c.name,u=c.namespaceURI;if(r=b(t.value),o=g(s),l.attrName=o,l.attrValue=r,l.keepAttr=!0,l.forceKeepAttr=void 0,dt("uponSanitizeAttribute",e,l),r=l.attrValue,!l.forceKeepAttr&&(ct(s,e),l.keepAttr))if(T(/\/>/i,r))ct(s,e);else{Re&&(r=y(r,pe," "),r=y(r,ge," "));var f=e.nodeName.toLowerCase();if(gt(f,o,r))try{u?e.setAttributeNS(u,s,r):e.setAttribute(s,r),d(n.removed)}catch(e){}}}dt("afterSanitizeAttributes",e,null)}},yt=function e(t){var n=void 0,r=ut(t);for(dt("beforeSanitizeShadowDOM",t,null);n=r.nextNode();)dt("uponSanitizeShadowNode",n,null),pt(n)||(n.content instanceof a&&e(n.content),ht(n));dt("afterSanitizeShadowDOM",t,null)};return n.sanitize=function(e,o){var i=void 0,l=void 0,s=void 0,u=void 0,f=void 0;if((Je=!e)&&(e="\x3c!--\x3e"),"string"!=typeof e&&!mt(e)){if("function"!=typeof e.toString)throw A("toString is not a function");if("string"!=typeof(e=e.toString()))throw A("dirty is not a string, aborting")}if(!n.isSupported){if("object"===G(t.toStaticHTML)||"function"==typeof t.toStaticHTML){if("string"==typeof e)return t.toStaticHTML(e);if(mt(e))return t.toStaticHTML(e.outerHTML)}return e}if(Me||tt(o),n.removed=[],"string"==typeof e&&(je=!1),je);else if(e instanceof c)1===(l=(i=st("\x3c!----\x3e")).ownerDocument.importNode(e,!0)).nodeType&&"BODY"===l.nodeName||"HTML"===l.nodeName?i=l:i.appendChild(l);else{if(!Fe&&!Re&&!_e&&-1===e.indexOf("<"))return oe&&ze?oe.createHTML(e):e;if(!(i=st(e)))return Fe?null:ie}i&&Le&<(i.firstChild);for(var m=ut(je?e:i);s=m.nextNode();)3===s.nodeType&&s===u||pt(s)||(s.content instanceof a&&yt(s.content),ht(s),u=s);if(u=null,je)return e;if(Fe){if(Ie)for(f=se.call(i.ownerDocument);i.firstChild;)f.appendChild(i.firstChild);else f=i;return Ce&&(f=fe.call(r,f,!0)),f}var d=_e?i.outerHTML:i.innerHTML;return Re&&(d=y(d,pe," "),d=y(d,ge," ")),oe&&ze?oe.createHTML(d):d},n.setConfig=function(e){tt(e),Me=!0},n.clearConfig=function(){Qe=null,Me=!1},n.isValidAttribute=function(e,t,n){Qe||tt({});var r=g(e),o=g(t);return gt(r,o,n)},n.addHook=function(e,t){"function"==typeof t&&(de[e]=de[e]||[],p(de[e],t))},n.removeHook=function(e){de[e]&&d(de[e])},n.removeHooks=function(e){de[e]&&(de[e]=[])},n.removeAllHooks=function(){de={}},n}()}));
//# sourceMappingURL=purify.min.js.map
var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty,
bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
slice = [].slice;
(function(window) {
var Base, Core, Io, Log, Timeout, ZammadChat, myScript, scriptHost, scriptProtocol, scripts;
scripts = document.getElementsByTagName('script');
myScript = scripts[scripts.length - 1];
scriptProtocol = window.location.protocol.replace(':', '');
if (myScript && myScript.src) {
scriptHost = myScript.src.match('.*://([^:/]*).*')[1];
scriptProtocol = myScript.src.match('(.*)://[^:/]*.*')[1];
}
Core = (function() {
Core.prototype.defaults = {
debug: false
};
function Core(options) {
var key, ref, value;
this.options = {};
ref = this.defaults;
for (key in ref) {
value = ref[key];
this.options[key] = value;
}
for (key in options) {
value = options[key];
this.options[key] = value;
}
}
return Core;
})();
Base = (function(superClass) {
extend(Base, superClass);
function Base(options) {
Base.__super__.constructor.call(this, options);
this.log = new Log({
debug: this.options.debug,
logPrefix: this.options.logPrefix || this.logPrefix
});
}
return Base;
})(Core);
Log = (function(superClass) {
extend(Log, superClass);
function Log() {
this.log = bind(this.log, this);
this.error = bind(this.error, this);
this.notice = bind(this.notice, this);
this.debug = bind(this.debug, this);
return Log.__super__.constructor.apply(this, arguments);
}
Log.prototype.debug = function() {
var items;
items = 1 <= arguments.length ? slice.call(arguments, 0) : [];
if (!this.options.debug) {
return;
}
return this.log('debug', items);
};
Log.prototype.notice = function() {
var items;
items = 1 <= arguments.length ? slice.call(arguments, 0) : [];
return this.log('notice', items);
};
Log.prototype.error = function() {
var items;
items = 1 <= arguments.length ? slice.call(arguments, 0) : [];
return this.log('error', items);
};
Log.prototype.log = function(level, items) {
var element, item, j, len, logString;
items.unshift('||');
items.unshift(level);
items.unshift(this.options.logPrefix);
console.log.apply(console, items);
if (!this.options.debug) {
return;
}
logString = '';
for (j = 0, len = items.length; j < len; j++) {
item = items[j];
logString += ' ';
if (typeof item === 'object') {
logString += JSON.stringify(item);
} else if (item && item.toString) {
logString += item.toString();
} else {
logString += item;
}
}
element = document.querySelector('.js-chatLogDisplay');
if (element) {
return element.innerHTML = '<div>' + logString + '</div>' + element.innerHTML;
}
};
return Log;
})(Core);
Timeout = (function(superClass) {
extend(Timeout, superClass);
function Timeout() {
this.stop = bind(this.stop, this);
this.start = bind(this.start, this);
return Timeout.__super__.constructor.apply(this, arguments);
}
Timeout.prototype.timeoutStartedAt = null;
Timeout.prototype.logPrefix = 'timeout';
Timeout.prototype.defaults = {
debug: false,
timeout: 4,
timeoutIntervallCheck: 0.5
};
Timeout.prototype.start = function() {
var check, timeoutStartedAt;
this.stop();
timeoutStartedAt = new Date;
check = (function(_this) {
return function() {
var timeLeft;
timeLeft = new Date - new Date(timeoutStartedAt.getTime() + _this.options.timeout * 1000 * 60);
_this.log.debug("Timeout check for " + _this.options.timeout + " minutes (left " + (timeLeft / 1000) + " sec.)");
if (timeLeft < 0) {
return;
}
_this.stop();
return _this.options.callback();
};
})(this);
this.log.debug("Start timeout in " + this.options.timeout + " minutes");
return this.intervallId = setInterval(check, this.options.timeoutIntervallCheck * 1000 * 60);
};
Timeout.prototype.stop = function() {
if (!this.intervallId) {
return;
}
this.log.debug("Stop timeout of " + this.options.timeout + " minutes");
return clearInterval(this.intervallId);
};
return Timeout;
})(Base);
Io = (function(superClass) {
extend(Io, superClass);
function Io() {
this.ping = bind(this.ping, this);
this.send = bind(this.send, this);
this.reconnect = bind(this.reconnect, this);
this.close = bind(this.close, this);
this.connect = bind(this.connect, this);
this.set = bind(this.set, this);
return Io.__super__.constructor.apply(this, arguments);
}
Io.prototype.logPrefix = 'io';
Io.prototype.set = function(params) {
var key, results, value;
results = [];
for (key in params) {
value = params[key];
results.push(this.options[key] = value);
}
return results;
};
Io.prototype.connect = function() {
this.log.debug("Connecting to " + this.options.host);
this.ws = new window.WebSocket("" + this.options.host);
this.ws.onopen = (function(_this) {
return function(e) {
_this.log.debug('onOpen', e);
_this.options.onOpen(e);
return _this.ping();
};
})(this);
this.ws.onmessage = (function(_this) {
return function(e) {
var j, len, pipe, pipes;
pipes = JSON.parse(e.data);
_this.log.debug('onMessage', e.data);
for (j = 0, len = pipes.length; j < len; j++) {
pipe = pipes[j];
if (pipe.event === 'pong') {
_this.ping();
}
}
if (_this.options.onMessage) {
return _this.options.onMessage(pipes);
}
};
})(this);
this.ws.onclose = (function(_this) {
return function(e) {
_this.log.debug('close websocket connection', e);
if (_this.pingDelayId) {
clearTimeout(_this.pingDelayId);
}
if (_this.manualClose) {
_this.log.debug('manual close, onClose callback');
_this.manualClose = false;
if (_this.options.onClose) {
return _this.options.onClose(e);
}
} else {
_this.log.debug('error close, onError callback');
if (_this.options.onError) {
return _this.options.onError('Connection lost...');
}
}
};
})(this);
return this.ws.onerror = (function(_this) {
return function(e) {
_this.log.debug('onError', e);
if (_this.options.onError) {
return _this.options.onError(e);
}
};
})(this);
};
Io.prototype.close = function() {
this.log.debug('close websocket manually');
this.manualClose = true;
return this.ws.close();
};
Io.prototype.reconnect = function() {
this.log.debug('reconnect');
this.close();
return this.connect();
};
Io.prototype.send = function(event, data) {
var msg;
if (data == null) {
data = {};
}
this.log.debug('send', event, data);
msg = JSON.stringify({
event: event,
data: data
});
return this.ws.send(msg);
};
Io.prototype.ping = function() {
var localPing;
localPing = (function(_this) {
return function() {
return _this.send('ping');
};
})(this);
return this.pingDelayId = setTimeout(localPing, 29000);
};
return Io;
})(Base);
ZammadChat = (function(superClass) {
extend(ZammadChat, superClass);
ZammadChat.prototype.defaults = {
chatId: void 0,
show: true,
target: document.querySelector('body'),
host: '',
debug: false,
flat: false,
lang: void 0,
cssAutoload: true,
cssUrl: void 0,
fontSize: void 0,
buttonClass: 'open-zammad-chat',
inactiveClass: 'is-inactive',
title: '<strong>Chat</strong> with us!',
scrollHint: 'Scroll down to see new messages',
idleTimeout: 6,
idleTimeoutIntervallCheck: 0.5,
inactiveTimeout: 8,
inactiveTimeoutIntervallCheck: 0.5,
waitingListTimeout: 4,
waitingListTimeoutIntervallCheck: 0.5,
onReady: void 0,
onCloseAnimationEnd: void 0,
onError: void 0,
onOpenAnimationEnd: void 0,
onConnectionReestablished: void 0,
onSessionClosed: void 0,
onConnectionEstablished: void 0,
onCssLoaded: void 0
};
ZammadChat.prototype.logPrefix = 'chat';
ZammadChat.prototype._messageCount = 0;
ZammadChat.prototype.isOpen = false;
ZammadChat.prototype.blinkOnlineInterval = null;
ZammadChat.prototype.stopBlinOnlineStateTimeout = null;
ZammadChat.prototype.showTimeEveryXMinutes = 2;
ZammadChat.prototype.lastTimestamp = null;
ZammadChat.prototype.lastAddedType = null;
ZammadChat.prototype.inputDisabled = false;
ZammadChat.prototype.inputTimeout = null;
ZammadChat.prototype.isTyping = false;
ZammadChat.prototype.state = 'offline';
ZammadChat.prototype.initialQueueDelay = 10000;
ZammadChat.prototype.translations = {
'de': {
'<strong>Chat</strong> with us!': '<strong>Chatte</strong> mit uns!',
'All colleagues are busy.': 'Alle Kollegen sind beschäftigt.',
'Chat closed by %s': 'Chat von %s geschlossen',
'Compose your message…': 'Verfassen Sie Ihre Nachricht…',
'Connecting': 'Verbinde',
'Connection lost': 'Verbindung verloren',
'Connection re-established': 'Verbindung wieder aufgebaut',
'Offline': 'Offline',
'Online': 'Online',
'Scroll down to see new messages': 'Nach unten scrollen um neue Nachrichten zu sehen',
'Send': 'Senden',
'Since you didn\'t respond in the last %s minutes your conversation was closed.': 'Da Sie innerhalb der letzten %s Minuten nicht reagiert haben, wurde Ihre Unterhaltung geschlossen.',
'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> was closed.': 'Da Sie innerhalb der letzten %s Minuten nicht reagiert haben, wurde Ihre Unterhaltung mit <strong>%s</strong> geschlossen.',
'Start new conversation': 'Neue Unterhaltung starten',
'Today': 'Heute',
'We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!': 'Entschuldigung, es dauert länger als erwartet einen freien Platz zu bekommen. Versuchen Sie es später erneut oder senden Sie uns eine E-Mail. Vielen Dank!',
'You are on waiting list position <strong>%s</strong>.': 'Sie sind in der Warteliste auf Position <strong>%s</strong>.'
},
'es': {
'<strong>Chat</strong> with us!': '<strong>Chatee</strong> con nosotros!',
'All colleagues are busy.': 'Todos los colegas están ocupados.',
'Chat closed by %s': 'Chat cerrado por %s',
'Compose your message…': 'Escribe tu mensaje…',
'Connecting': 'Conectando',
'Connection lost': 'Conexión perdida',
'Connection re-established': 'Conexión reestablecida',
'Offline': 'Desconectado',
'Online': 'En línea',
'Scroll down to see new messages': 'Desplace hacia abajo para ver nuevos mensajes',
'Send': 'Enviar',
'Since you didn\'t respond in the last %s minutes your conversation was closed.': '',
'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> was closed.': '',
'Start new conversation': 'Iniciar nueva conversación',
'Today': 'Hoy',
'We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!': '',
'You are on waiting list position <strong>%s</strong>.': 'Usted está en la posición <strong>%s</strong> de la lista de espera.'
},
'fr': {
'<strong>Chat</strong> with us!': '<strong>Chattez</strong> avec nous!',
'All colleagues are busy.': 'Tout les agents sont occupés.',
'Chat closed by %s': 'Chat fermé par %s',
'Compose your message…': 'Ecrivez votre message…',
'Connecting': 'Connexion',
'Connection lost': 'Connexion perdue',
'Connection re-established': 'Connexion ré-établie',
'Offline': 'Hors-ligne',
'Online': 'En ligne',
'Scroll down to see new messages': 'Défiler vers le bas pour voir les nouveaux messages',
'Send': 'Envoyer',
'Since you didn\'t respond in the last %s minutes your conversation was closed.': '',
'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> was closed.': '',
'Start new conversation': 'Démarrer une nouvelle conversation',
'Today': 'Aujourd\'hui',
'We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!': '',
'You are on waiting list position <strong>%s</strong>.': 'Vous êtes actuellement en position <strong>%s</strong> dans la file d\'attente.'
},
'hr': {
'<strong>Chat</strong> with us!': '<strong>Čavrljajte</strong> sa nama!',
'All colleagues are busy.': 'Svi kolege su zauzeti.',
'Chat closed by %s': '%s zatvara chat',
'Compose your message…': 'Sastavite poruku…',
'Connecting': 'Povezivanje',
'Connection lost': 'Veza prekinuta',
'Connection re-established': 'Veza je ponovno uspostavljena',
'Offline': 'Odsutan',
'Online': 'Dostupan(a)',
'Scroll down to see new messages': 'Pomaknite se prema dolje da biste vidjeli nove poruke',
'Send': 'Šalji',
'Since you didn\'t respond in the last %s minutes your conversation was closed.': 'Budući da niste odgovorili u posljednjih %s minuta, Vaš je razgovor zatvoren.',
'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> was closed.': 'Budući da niste odgovorili u posljednjih %s minuta, Vaš je razgovor s <strong>%</strong>s zatvoren.',
'Start new conversation': 'Započni novi razgovor',
'Today': 'Danas',
'We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!': 'Oprostite, proces traje duže nego što se očekivalo da biste dobili slobodan termin. Molimo, pokušajte ponovno kasnije ili nam pošaljite e-mail. Hvala!',
'You are on waiting list position <strong>%s</strong>.': 'Nalazite se u redu čekanja na poziciji <strong>%s</strong>.'
},
'hu': {
'<strong>Chat</strong> with us!': '<strong>Chatelj</strong> velünk!',
'All colleagues are busy.': 'Jelenleg minden kollégánk elfoglalt.',
'Chat closed by %s': 'A csevegés %s által lezárva',
'Compose your message…': 'Írja meg üzenetét…',
'Connecting': 'Csatlakozás',
'Connection lost': 'A kapcsolat megszakadt',
'Connection re-established': 'A kapcsolat helyreállt',
'Offline': 'Offline',
'Online': 'Online',
'Scroll down to see new messages': 'Görgess lejjebb az új üzenetekhez',
'Send': 'Küldés',
'Since you didn\'t respond in the last %s minutes your conversation was closed.': '',
'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> was closed.': '',
'Start new conversation': 'Új beszélgetés indítása',
'Today': 'Ma',
'We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!': '',
'You are on waiting list position <strong>%s</strong>.': 'A várólistán a <strong>%s</strong>. pozícióban várakozol.'
},
'it': {
'<strong>Chat</strong> with us!': '<strong>Chatta</strong> con noi!',
'All colleagues are busy.': 'Tutti i colleghi sono occupati.',
'Chat closed by %s': 'Chat chiusa da %s',
'Compose your message…': 'Scrivi il tuo messaggio…',
'Connecting': 'Connessione in corso',
'Connection lost': 'Connessione persa',
'Connection re-established': 'Connessione ristabilita',
'Offline': 'Offline',
'Online': 'Online',
'Scroll down to see new messages': 'Scorri verso il basso per vedere i nuovi messaggi',
'Send': 'Invia',
'Since you didn\'t respond in the last %s minutes your conversation was closed.': '',
'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> was closed.': '',
'Start new conversation': 'Avvia una nuova chat',
'Today': 'Oggi',
'We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!': '',
'You are on waiting list position <strong>%s</strong>.': 'Sei alla posizione <strong>%s</strong> della lista di attesa.'
},
'nl': {
'<strong>Chat</strong> with us!': '<strong>Chat</strong> met ons!',
'All colleagues are busy.': 'Alle collega\'s zijn bezet.',
'Chat closed by %s': 'Chat gesloten door %s',
'Compose your message…': 'Stel je bericht op…',
'Connecting': 'Verbinden',
'Connection lost': 'Verbinding verbroken',
'Connection re-established': 'Verbinding hersteld',
'Offline': 'Offline',
'Online': 'Online',
'Scroll down to see new messages': 'Scroll naar beneden om nieuwe tickets te bekijken',
'Send': 'Verstuur',
'Since you didn\'t respond in the last %s minutes your conversation was closed.': '',
'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> was closed.': '',
'Start new conversation': 'Nieuw gesprek starten',
'Today': 'Vandaag',
'We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!': '',
'You are on waiting list position <strong>%s</strong>.': 'U bevindt zich op wachtlijstpositie <strong>%s</strong>.'
},
'pl': {
'<strong>Chat</strong> with us!': '<strong>Czatuj</strong> z nami!',
'All colleagues are busy.': 'Wszyscy agenci są zajęci.',
'Chat closed by %s': 'Chat zamknięty przez %s',
'Compose your message…': 'Skomponuj swoją wiadomość…',
'Connecting': 'Łączenie',
'Connection lost': 'Utracono połączenie',
'Connection re-established': 'Ponowne nawiązanie połączenia',
'Offline': 'Offline',
'Online': 'Online',
'Scroll down to see new messages': 'Skroluj w dół, aby zobaczyć wiadomości',
'Send': 'Wyślij',
'Since you didn\'t respond in the last %s minutes your conversation was closed.': 'Ponieważ nie odpowiedziałeś w ciągu ostatnich %s minut, Twoja rozmowa została zamknięta.',
'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> was closed.': 'Ponieważ nie odpowiedziałeś w ciągu ostatnich %s minut, Twoja rozmowa z <strong>%s</strong> została zamknięta.',
'Start new conversation': 'Rozpocznij nową rozmowę',
'Today': 'Dzisiaj',
'We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!': 'Przepraszamy, znalezienie wolnego konsultanta zajmuje więcej czasu niż oczekiwano. Spróbuj ponownie później lub wyślij nam e-mail. Dziękujemy!',
'You are on waiting list position <strong>%s</strong>.': 'Jesteś na pozycji listy oczekujących <strong>%s</strong>.'
},
'pt-br': {
'<strong>Chat</strong> with us!': '<strong>Converse</strong> conosco!',
'All colleagues are busy.': 'Nossos atendentes estão ocupados.',
'Chat closed by %s': 'Chat encerrado por %s',
'Compose your message…': 'Escreva sua mensagem…',
'Connecting': 'Conectando',
'Connection lost': 'Conexão perdida',
'Connection re-established': 'Conexão restabelecida',
'Offline': 'Desconectado',
'Online': 'Online',
'Scroll down to see new messages': 'Rolar para baixo para ver novas mensagems',
'Send': 'Enviar',
'Since you didn\'t respond in the last %s minutes your conversation was closed.': '',
'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> was closed.': '',
'Start new conversation': 'Iniciar uma nova conversa',
'Today': 'Hoje',
'We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!': '',
'You are on waiting list position <strong>%s</strong>.': 'Você está na posição <strong>%s</strong> da lista de espera.'
},
'ru': {
'<strong>Chat</strong> with us!': '<strong>Напишите</strong> нам!',
'All colleagues are busy.': 'Все коллеги заняты.',
'Chat closed by %s': 'Чат закрыт %s',
'Compose your message…': 'Составьте сообщение…',
'Connecting': 'Подключение',
'Connection lost': 'Подключение потеряно',
'Connection re-established': 'Подключение восстановлено',
'Offline': 'Оффлайн',
'Online': 'В сети',
'Scroll down to see new messages': 'Прокрутите вниз, чтобы увидеть новые сообщения',
'Send': 'Отправить',
'Since you didn\'t respond in the last %s minutes your conversation was closed.': '',
'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> was closed.': '',
'Start new conversation': 'Начать новую беседу',
'Today': 'Сегодня',
'We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!': '',
'You are on waiting list position <strong>%s</strong>.': 'Вы находитесь в списке ожидания <strong>%s</strong>.'
},
'sr': {
'<strong>Chat</strong> with us!': '<strong>Ћаскајте</strong> са нама!',
'All colleagues are busy.': 'Све колеге су заузете.',
'Chat closed by %s': 'Ћаскање затворено од стране %s',
'Compose your message…': 'Напишите поруку…',
'Connecting': 'Повезивање',
'Connection lost': 'Веза је изгубљена',
'Connection re-established': 'Веза је поново успостављена',
'Offline': 'Одсутан(а)',
'Online': 'Доступан(а)',
'Scroll down to see new messages': 'Скролујте на доле за нове поруке',
'Send': 'Пошаљи',
'Since you didn\'t respond in the last %s minutes your conversation was closed.': 'Пошто нисте одговорили у последњих %s минут(a), ваш разговор је завршен.',
'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> was closed.': 'Пошто нисте одговорили у последњих %s минут(a), ваш разговор са <strong>%s</strong> је завршен.',
'Start new conversation': 'Започни нови разговор',
'Today': 'Данас',
'We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!': 'Жао нам је, добијање празног термина траје дуже од очекиваног. Молимо покушајте поново касније или нам пошаљите имејл поруку. Хвала вам!',
'You are on waiting list position <strong>%s</strong>.': 'Ви сте тренутно <strong>%s.</strong> у реду за чекање.'
},
'sr-latn-rs': {
'<strong>Chat</strong> with us!': '<strong>Ćaskajte</strong> sa nama!',
'All colleagues are busy.': 'Sve kolege su zauzete.',
'Chat closed by %s': 'Ćaskanje zatvoreno od strane %s',
'Compose your message…': 'Napišite poruku…',
'Connecting': 'Povezivanje',
'Connection lost': 'Veza je izgubljena',
'Connection re-established': 'Veza je ponovo uspostavljena',
'Offline': 'Odsutan(a)',
'Online': 'Dostupan(a)',
'Scroll down to see new messages': 'Skrolujte na dole za nove poruke',
'Send': 'Pošalji',
'Since you didn\'t respond in the last %s minutes your conversation was closed.': 'Pošto niste odgovorili u poslednjih %s minut(a), vaš razgovor je završen.',
'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> was closed.': 'Pošto niste odgovorili u poslednjih %s minut(a), vaš razgovor sa <strong>%s</strong> je završen.',
'Start new conversation': 'Započni novi razgovor',
'Today': 'Danas',
'We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!': 'Žao nam je, dobijanje praznog termina traje duže od očekivanog. Molimo pokušajte ponovo kasnije ili nam pošaljite imejl poruku. Hvala vam!',
'You are on waiting list position <strong>%s</strong>.': 'Vi ste trenutno <strong>%s.</strong> u redu za čekanje.'
},
'sv': {
'<strong>Chat</strong> with us!': '<strong>Chatta</strong> med oss!',
'All colleagues are busy.': 'Alla kollegor är upptagna.',
'Chat closed by %s': 'Chatt stängd av %s',
'Compose your message…': 'Skriv ditt meddelande …',
'Connecting': 'Ansluter',
'Connection lost': 'Anslutningen försvann',
'Connection re-established': 'Anslutningen återupprättas',
'Offline': 'Offline',
'Online': 'Online',
'Scroll down to see new messages': 'Bläddra ner för att se nya meddelanden',
'Send': 'Skicka',
'Since you didn\'t respond in the last %s minutes your conversation was closed.': '',
'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> was closed.': '',
'Start new conversation': 'Starta ny konversation',
'Today': 'Idag',
'We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!': 'Det tar tyvärr längre tid än förväntat att få en ledig plats. Försök igen senare eller skicka ett mejl till oss. Tack!',
'You are on waiting list position <strong>%s</strong>.': 'Du är på väntelistan som position <strong>%s</strong>.'
}
};
ZammadChat.prototype.sessionId = void 0;
ZammadChat.prototype.scrolledToBottom = true;
ZammadChat.prototype.scrollSnapTolerance = 10;
ZammadChat.prototype.richTextFormatKey = {
66: true,
73: true,
85: true,
83: true
};
ZammadChat.prototype.T = function() {
var item, items, j, len, string, translations;
string = arguments[0], items = 2 <= arguments.length ? slice.call(arguments, 1) : [];
if (this.options.lang && this.options.lang !== 'en') {
if (!this.translations[this.options.lang]) {
this.log.notice("Translation '" + this.options.lang + "' needed!");
} else {
translations = this.translations[this.options.lang];
if (!translations[string]) {
this.log.notice("Translation needed for '" + string + "'");
}
string = translations[string] || string;
}
}
if (items) {
for (j = 0, len = items.length; j < len; j++) {
item = items[j];
string = string.replace(/%s/, item);
}
}
return string;
};
ZammadChat.prototype.view = function(name) {
return (function(_this) {
return function(options) {
if (!options) {
options = {};
}
options.T = _this.T;
options.background = _this.options.background;
options.flat = _this.options.flat;
options.fontSize = _this.options.fontSize;
return window.zammadChatTemplates[name](options);
};
})(this);
};
function ZammadChat(options) {
this.removeAttributes = bind(this.removeAttributes, this);
this.startTimeoutObservers = bind(this.startTimeoutObservers, this);
this.onCssLoaded = bind(this.onCssLoaded, this);
this.setAgentOnlineState = bind(this.setAgentOnlineState, this);
this.onConnectionEstablished = bind(this.onConnectionEstablished, this);
this.setSessionId = bind(this.setSessionId, this);
this.onConnectionReestablished = bind(this.onConnectionReestablished, this);
this.reconnect = bind(this.reconnect, this);
this.destroy = bind(this.destroy, this);
this.onScrollHintClick = bind(this.onScrollHintClick, this);
this.detectScrolledtoBottom = bind(this.detectScrolledtoBottom, this);
this.onLeaveTemporary = bind(this.onLeaveTemporary, this);
this.onAgentTypingEnd = bind(this.onAgentTypingEnd, this);
this.onAgentTypingStart = bind(this.onAgentTypingStart, this);
this.onQueue = bind(this.onQueue, this);
this.onQueueScreen = bind(this.onQueueScreen, this);
this.onWebSocketClose = bind(this.onWebSocketClose, this);
this.onCloseAnimationEnd = bind(this.onCloseAnimationEnd, this);
this.close = bind(this.close, this);
this.toggle = bind(this.toggle, this);
this.sessionClose = bind(this.sessionClose, this);
this.onOpenAnimationEnd = bind(this.onOpenAnimationEnd, this);
this.open = bind(this.open, this);
this.renderMessage = bind(this.renderMessage, this);
this.receiveMessage = bind(this.receiveMessage, this);
this.onSubmit = bind(this.onSubmit, this);
this.onInput = bind(this.onInput, this);
this.onReopenSession = bind(this.onReopenSession, this);
this.onError = bind(this.onError, this);
this.onWebSocketMessage = bind(this.onWebSocketMessage, this);
this.send = bind(this.send, this);
this.onKeydown = bind(this.onKeydown, this);
this.onPaste = bind(this.onPaste, this);
this.onDrop = bind(this.onDrop, this);
this.render = bind(this.render, this);
this.view = bind(this.view, this);
this.T = bind(this.T, this);
ZammadChat.__super__.constructor.call(this, options);
if (typeof jQuery !== 'undefined' && this.options.target instanceof jQuery) {
this.log.notice('Chat: target option is a jQuery object. jQuery is not a requirement for the chat any more.');
this.options.target = this.options.target.get(0);
}
this.isFullscreen = window.matchMedia && window.matchMedia('(max-width: 768px)').matches;
this.scrollRoot = this.getScrollRoot();
if (!window.WebSocket || !sessionStorage) {
this.state = 'unsupported';
this.log.notice('Chat: Browser not supported!');
return;
}
if (!this.options.chatId) {
this.state = 'unsupported';
this.log.error('Chat: need chatId as option!');
return;
}
if (!this.options.lang) {
this.options.lang = document.documentElement.getAttribute('lang');
}
if (this.options.lang) {
if (!this.translations[this.options.lang]) {
this.log.debug("lang: No " + this.options.lang + " found, try first two letters");
this.options.lang = this.options.lang.replace(/-.+?$/, '');
}
this.log.debug("lang: " + this.options.lang);
}
if (!this.options.host) {
this.detectHost();
}
this.loadCss();
this.io = new Io(this.options);
this.io.set({
onOpen: this.render,
onClose: this.onWebSocketClose,
onMessage: this.onWebSocketMessage,
onError: this.onError
});
this.io.connect();
}
ZammadChat.prototype.getScrollRoot = function() {
var end, html, start;
if ('scrollingElement' in document) {
return document.scrollingElement;
}
html = document.documentElement;
start = parseInt(html.pageYOffset, 10);
html.pageYOffset = start + 1;
end = parseInt(html.pageYOffset, 10);
html.pageYOffset = start;
if (end > start) {
return html;
} else {
return document.body;
}
};
ZammadChat.prototype.render = function() {
var btn;
if (!this.el || !document.querySelector('.zammad-chat')) {
this.renderBase();
}
btn = document.querySelector("." + this.options.buttonClass);
if (btn) {
btn.classList.add(this.options.inactiveClass);
}
this.setAgentOnlineState('online');
this.log.debug('widget rendered');
this.startTimeoutObservers();
this.idleTimeout.start();
this.sessionId = sessionStorage.getItem('sessionId');
return this.send('chat_status_customer', {
session_id: this.sessionId,
url: window.location.href
});
};
ZammadChat.prototype.renderBase = function() {
if (this.el) {
this.el.remove();
}
this.options.target.insertAdjacentHTML('beforeend', this.view('chat')({
title: this.options.title,
scrollHint: this.options.scrollHint
}));
this.el = this.options.target.querySelector('.zammad-chat');
this.input = this.el.querySelector('.zammad-chat-input');
this.body = this.el.querySelector('.zammad-chat-body');
this.el.querySelector('.js-chat-open').addEventListener('click', this.open);
this.el.querySelector('.js-chat-toggle').addEventListener('click', this.toggle);
this.el.querySelector('.js-chat-status').addEventListener('click', this.stopPropagation);
this.el.querySelector('.zammad-chat-controls').addEventListener('submit', this.onSubmit);
this.body.addEventListener('scroll', this.detectScrolledtoBottom);
this.el.querySelector('.zammad-scroll-hint').addEventListener('click', this.onScrollHintClick);
this.input.addEventListener('keydown', this.onKeydown);
this.input.addEventListener('input', this.onInput);
this.input.addEventListener('paste', this.onPaste);
this.input.addEventListener('drop', this.onDrop);
window.addEventListener('beforeunload', this.onLeaveTemporary);
return window.addEventListener('hashchange', (function(_this) {
return function() {
if (_this.isOpen) {
if (_this.sessionId) {
_this.send('chat_session_notice', {
session_id: _this.sessionId,
message: window.location.href
});
}
return;
}
return _this.idleTimeout.start();
};
})(this));
};
ZammadChat.prototype.stopPropagation = function(event) {
return event.stopPropagation();
};
ZammadChat.prototype.onDrop = function(e) {
var dataTransfer, file, reader, x, y;
e.stopPropagation();
e.preventDefault();
if (window.dataTransfer) {
dataTransfer = window.dataTransfer;
} else if (e.dataTransfer) {
dataTransfer = e.dataTransfer;
} else {
throw 'No clipboardData support';
}
x = e.clientX;
y = e.clientY;
file = dataTransfer.files[0];
if (file.type.match('image.*')) {
reader = new FileReader();
reader.onload = (function(_this) {
return function(e) {
var insert;
insert = function(dataUrl, width) {
var img, pos, range, result;
if (_this.isRetina()) {
width = width / 2;
}
result = dataUrl;
img = new Image();
img.style.width = '100%';
img.style.maxWidth = width + 'px';
img.src = result;
if (document.caretPositionFromPoint) {
pos = document.caretPositionFromPoint(x, y);
range = document.createRange();
range.setStart(pos.offsetNode, pos.offset);
range.collapse();
return range.insertNode(img);
} else if (document.caretRangeFromPoint) {
range = document.caretRangeFromPoint(x, y);
return range.insertNode(img);
} else {
return console.log('could not find carat');
}
};
return _this.resizeImage(e.target.result, 460, 'auto', 2, 'image/jpeg', 'auto', insert);
};
})(this);
return reader.readAsDataURL(file);
}
};
ZammadChat.prototype.onPaste = function(e) {
var clipboardData, docType, html, htmlTmp, imageFile, imageInserted, item, j, k, l, len, len1, len2, len3, m, match, newTag, node, outer, reader, ref, ref1, ref2, ref3, regex, replacementTag, sanitized, text;
e.stopPropagation();
e.preventDefault();
if (e.clipboardData) {
clipboardData = e.clipboardData;
} else if (window.clipboardData) {
clipboardData = window.clipboardData;
} else if (e.clipboardData) {
clipboardData = e.clipboardData;
} else {
throw 'No clipboardData support';
}
imageInserted = false;
if (clipboardData && clipboardData.items && clipboardData.items[0]) {
item = clipboardData.items[0];
if (item.kind === 'file' && (item.type === 'image/png' || item.type === 'image/jpeg')) {
imageFile = item.getAsFile();
reader = new FileReader();
reader.onload = (function(_this) {
return function(e) {
var insert;
insert = function(dataUrl, width) {
var img;
if (_this.isRetina()) {
width = width / 2;
}
img = new Image();
img.style.width = '100%';
img.style.maxWidth = width + 'px';
img.src = dataUrl;
return document.execCommand('insertHTML', false, img);
};
return _this.resizeImage(e.target.result, 460, 'auto', 2, 'image/jpeg', 'auto', insert);
};
})(this);
reader.readAsDataURL(imageFile);
imageInserted = true;
}
}
if (imageInserted) {
return;
}
text = void 0;
docType = void 0;
try {
text = clipboardData.getData('text/html');
docType = 'html';
if (!text || text.length === 0) {
docType = 'text';
text = clipboardData.getData('text/plain');
}
if (!text || text.length === 0) {
docType = 'text2';
text = clipboardData.getData('text');
}
} catch (error) {
e = error;
console.log('Sorry, can\'t insert markup because browser is not supporting it.');
docType = 'text3';
text = clipboardData.getData('text');
}
if (docType === 'text' || docType === 'text2' || docType === 'text3') {
text = '<div>' + text.replace(/\n/g, '</div><div>') + '</div>';
text = text.replace(/<div><\/div>/g, '<div><br></div>');
}
console.log('p', docType, text);
if (docType === 'html') {
html = document.createElement('div');
sanitized = DOMPurify.sanitize(text);
this.log.debug('sanitized HTML clipboard', sanitized);
html.innerHTML = sanitized;
match = false;
htmlTmp = text;
regex = new RegExp('<(/w|w)\:[A-Za-z]');
if (htmlTmp.match(regex)) {
match = true;
htmlTmp = htmlTmp.replace(regex, '');
}
regex = new RegExp('<(/o|o)\:[A-Za-z]');
if (htmlTmp.match(regex)) {
match = true;
htmlTmp = htmlTmp.replace(regex, '');
}
if (match) {
html = this.wordFilter(html);