chat-no-jquery.js 122 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720
  1. if (!window.zammadChatTemplates) {
  2. window.zammadChatTemplates = {};
  3. }
  4. window.zammadChatTemplates["agent"] = function(__obj) {
  5. if (!__obj) __obj = {};
  6. var __out = [], __capture = function(callback) {
  7. var out = __out, result;
  8. __out = [];
  9. callback.call(this);
  10. result = __out.join('');
  11. __out = out;
  12. return __safe(result);
  13. }, __sanitize = function(value) {
  14. if (value && value.ecoSafe) {
  15. return value;
  16. } else if (typeof value !== 'undefined' && value != null) {
  17. return __escape(value);
  18. } else {
  19. return '';
  20. }
  21. }, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
  22. __safe = __obj.safe = function(value) {
  23. if (value && value.ecoSafe) {
  24. return value;
  25. } else {
  26. if (!(typeof value !== 'undefined' && value != null)) value = '';
  27. var result = new String(value);
  28. result.ecoSafe = true;
  29. return result;
  30. }
  31. };
  32. if (!__escape) {
  33. __escape = __obj.escape = function(value) {
  34. return ('' + value)
  35. .replace(/&/g, '&')
  36. .replace(/</g, '&lt;')
  37. .replace(/>/g, '&gt;')
  38. .replace(/"/g, '&quot;');
  39. };
  40. }
  41. (function() {
  42. (function() {
  43. if (this.agent.avatar) {
  44. __out.push('\n<img class="zammad-chat-agent-avatar" src="');
  45. __out.push(__sanitize(this.agent.avatar));
  46. __out.push('">\n');
  47. }
  48. __out.push('\n<span class="zammad-chat-agent-sentence">\n <span class="zammad-chat-agent-name">');
  49. __out.push(__sanitize(this.agent.name));
  50. __out.push('</span>\n</span>');
  51. }).call(this);
  52. }).call(__obj);
  53. __obj.safe = __objSafe, __obj.escape = __escape;
  54. return __out.join('');
  55. };
  56. /*! @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 */
  57. !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&&lt(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}()}));
  58. //# sourceMappingURL=purify.min.js.map
  59. 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; },
  60. hasProp = {}.hasOwnProperty,
  61. bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
  62. slice = [].slice;
  63. (function(window) {
  64. var Base, Core, Io, Log, Timeout, ZammadChat, myScript, scriptHost, scriptProtocol, scripts;
  65. scripts = document.getElementsByTagName('script');
  66. myScript = scripts[scripts.length - 1];
  67. scriptProtocol = window.location.protocol.replace(':', '');
  68. if (myScript && myScript.src) {
  69. scriptHost = myScript.src.match('.*://([^:/]*).*')[1];
  70. scriptProtocol = myScript.src.match('(.*)://[^:/]*.*')[1];
  71. }
  72. Core = (function() {
  73. Core.prototype.defaults = {
  74. debug: false
  75. };
  76. function Core(options) {
  77. var key, ref, value;
  78. this.options = {};
  79. ref = this.defaults;
  80. for (key in ref) {
  81. value = ref[key];
  82. this.options[key] = value;
  83. }
  84. for (key in options) {
  85. value = options[key];
  86. this.options[key] = value;
  87. }
  88. }
  89. return Core;
  90. })();
  91. Base = (function(superClass) {
  92. extend(Base, superClass);
  93. function Base(options) {
  94. Base.__super__.constructor.call(this, options);
  95. this.log = new Log({
  96. debug: this.options.debug,
  97. logPrefix: this.options.logPrefix || this.logPrefix
  98. });
  99. }
  100. return Base;
  101. })(Core);
  102. Log = (function(superClass) {
  103. extend(Log, superClass);
  104. function Log() {
  105. this.log = bind(this.log, this);
  106. this.error = bind(this.error, this);
  107. this.notice = bind(this.notice, this);
  108. this.debug = bind(this.debug, this);
  109. return Log.__super__.constructor.apply(this, arguments);
  110. }
  111. Log.prototype.debug = function() {
  112. var items;
  113. items = 1 <= arguments.length ? slice.call(arguments, 0) : [];
  114. if (!this.options.debug) {
  115. return;
  116. }
  117. return this.log('debug', items);
  118. };
  119. Log.prototype.notice = function() {
  120. var items;
  121. items = 1 <= arguments.length ? slice.call(arguments, 0) : [];
  122. return this.log('notice', items);
  123. };
  124. Log.prototype.error = function() {
  125. var items;
  126. items = 1 <= arguments.length ? slice.call(arguments, 0) : [];
  127. return this.log('error', items);
  128. };
  129. Log.prototype.log = function(level, items) {
  130. var element, item, j, len, logString;
  131. items.unshift('||');
  132. items.unshift(level);
  133. items.unshift(this.options.logPrefix);
  134. console.log.apply(console, items);
  135. if (!this.options.debug) {
  136. return;
  137. }
  138. logString = '';
  139. for (j = 0, len = items.length; j < len; j++) {
  140. item = items[j];
  141. logString += ' ';
  142. if (typeof item === 'object') {
  143. logString += JSON.stringify(item);
  144. } else if (item && item.toString) {
  145. logString += item.toString();
  146. } else {
  147. logString += item;
  148. }
  149. }
  150. element = document.querySelector('.js-chatLogDisplay');
  151. if (element) {
  152. return element.innerHTML = '<div>' + logString + '</div>' + element.innerHTML;
  153. }
  154. };
  155. return Log;
  156. })(Core);
  157. Timeout = (function(superClass) {
  158. extend(Timeout, superClass);
  159. function Timeout() {
  160. this.stop = bind(this.stop, this);
  161. this.start = bind(this.start, this);
  162. return Timeout.__super__.constructor.apply(this, arguments);
  163. }
  164. Timeout.prototype.timeoutStartedAt = null;
  165. Timeout.prototype.logPrefix = 'timeout';
  166. Timeout.prototype.defaults = {
  167. debug: false,
  168. timeout: 4,
  169. timeoutIntervallCheck: 0.5
  170. };
  171. Timeout.prototype.start = function() {
  172. var check, timeoutStartedAt;
  173. this.stop();
  174. timeoutStartedAt = new Date;
  175. check = (function(_this) {
  176. return function() {
  177. var timeLeft;
  178. timeLeft = new Date - new Date(timeoutStartedAt.getTime() + _this.options.timeout * 1000 * 60);
  179. _this.log.debug("Timeout check for " + _this.options.timeout + " minutes (left " + (timeLeft / 1000) + " sec.)");
  180. if (timeLeft < 0) {
  181. return;
  182. }
  183. _this.stop();
  184. return _this.options.callback();
  185. };
  186. })(this);
  187. this.log.debug("Start timeout in " + this.options.timeout + " minutes");
  188. return this.intervallId = setInterval(check, this.options.timeoutIntervallCheck * 1000 * 60);
  189. };
  190. Timeout.prototype.stop = function() {
  191. if (!this.intervallId) {
  192. return;
  193. }
  194. this.log.debug("Stop timeout of " + this.options.timeout + " minutes");
  195. return clearInterval(this.intervallId);
  196. };
  197. return Timeout;
  198. })(Base);
  199. Io = (function(superClass) {
  200. extend(Io, superClass);
  201. function Io() {
  202. this.ping = bind(this.ping, this);
  203. this.send = bind(this.send, this);
  204. this.reconnect = bind(this.reconnect, this);
  205. this.close = bind(this.close, this);
  206. this.connect = bind(this.connect, this);
  207. this.set = bind(this.set, this);
  208. return Io.__super__.constructor.apply(this, arguments);
  209. }
  210. Io.prototype.logPrefix = 'io';
  211. Io.prototype.set = function(params) {
  212. var key, results, value;
  213. results = [];
  214. for (key in params) {
  215. value = params[key];
  216. results.push(this.options[key] = value);
  217. }
  218. return results;
  219. };
  220. Io.prototype.connect = function() {
  221. this.log.debug("Connecting to " + this.options.host);
  222. this.ws = new window.WebSocket("" + this.options.host);
  223. this.ws.onopen = (function(_this) {
  224. return function(e) {
  225. _this.log.debug('onOpen', e);
  226. _this.options.onOpen(e);
  227. return _this.ping();
  228. };
  229. })(this);
  230. this.ws.onmessage = (function(_this) {
  231. return function(e) {
  232. var j, len, pipe, pipes;
  233. pipes = JSON.parse(e.data);
  234. _this.log.debug('onMessage', e.data);
  235. for (j = 0, len = pipes.length; j < len; j++) {
  236. pipe = pipes[j];
  237. if (pipe.event === 'pong') {
  238. _this.ping();
  239. }
  240. }
  241. if (_this.options.onMessage) {
  242. return _this.options.onMessage(pipes);
  243. }
  244. };
  245. })(this);
  246. this.ws.onclose = (function(_this) {
  247. return function(e) {
  248. _this.log.debug('close websocket connection', e);
  249. if (_this.pingDelayId) {
  250. clearTimeout(_this.pingDelayId);
  251. }
  252. if (_this.manualClose) {
  253. _this.log.debug('manual close, onClose callback');
  254. _this.manualClose = false;
  255. if (_this.options.onClose) {
  256. return _this.options.onClose(e);
  257. }
  258. } else {
  259. _this.log.debug('error close, onError callback');
  260. if (_this.options.onError) {
  261. return _this.options.onError('Connection lost...');
  262. }
  263. }
  264. };
  265. })(this);
  266. return this.ws.onerror = (function(_this) {
  267. return function(e) {
  268. _this.log.debug('onError', e);
  269. if (_this.options.onError) {
  270. return _this.options.onError(e);
  271. }
  272. };
  273. })(this);
  274. };
  275. Io.prototype.close = function() {
  276. this.log.debug('close websocket manually');
  277. this.manualClose = true;
  278. return this.ws.close();
  279. };
  280. Io.prototype.reconnect = function() {
  281. this.log.debug('reconnect');
  282. this.close();
  283. return this.connect();
  284. };
  285. Io.prototype.send = function(event, data) {
  286. var msg;
  287. if (data == null) {
  288. data = {};
  289. }
  290. this.log.debug('send', event, data);
  291. msg = JSON.stringify({
  292. event: event,
  293. data: data
  294. });
  295. return this.ws.send(msg);
  296. };
  297. Io.prototype.ping = function() {
  298. var localPing;
  299. localPing = (function(_this) {
  300. return function() {
  301. return _this.send('ping');
  302. };
  303. })(this);
  304. return this.pingDelayId = setTimeout(localPing, 29000);
  305. };
  306. return Io;
  307. })(Base);
  308. ZammadChat = (function(superClass) {
  309. extend(ZammadChat, superClass);
  310. ZammadChat.prototype.defaults = {
  311. chatId: void 0,
  312. show: true,
  313. target: document.querySelector('body'),
  314. host: '',
  315. debug: false,
  316. flat: false,
  317. lang: void 0,
  318. cssAutoload: true,
  319. cssUrl: void 0,
  320. fontSize: void 0,
  321. buttonClass: 'open-zammad-chat',
  322. inactiveClass: 'is-inactive',
  323. title: '<strong>Chat</strong> with us!',
  324. scrollHint: 'Scroll down to see new messages',
  325. idleTimeout: 6,
  326. idleTimeoutIntervallCheck: 0.5,
  327. inactiveTimeout: 8,
  328. inactiveTimeoutIntervallCheck: 0.5,
  329. waitingListTimeout: 4,
  330. waitingListTimeoutIntervallCheck: 0.5,
  331. onReady: void 0,
  332. onCloseAnimationEnd: void 0,
  333. onError: void 0,
  334. onOpenAnimationEnd: void 0,
  335. onConnectionReestablished: void 0,
  336. onSessionClosed: void 0,
  337. onConnectionEstablished: void 0,
  338. onCssLoaded: void 0
  339. };
  340. ZammadChat.prototype.logPrefix = 'chat';
  341. ZammadChat.prototype._messageCount = 0;
  342. ZammadChat.prototype.isOpen = false;
  343. ZammadChat.prototype.blinkOnlineInterval = null;
  344. ZammadChat.prototype.stopBlinOnlineStateTimeout = null;
  345. ZammadChat.prototype.showTimeEveryXMinutes = 2;
  346. ZammadChat.prototype.lastTimestamp = null;
  347. ZammadChat.prototype.lastAddedType = null;
  348. ZammadChat.prototype.inputDisabled = false;
  349. ZammadChat.prototype.inputTimeout = null;
  350. ZammadChat.prototype.isTyping = false;
  351. ZammadChat.prototype.state = 'offline';
  352. ZammadChat.prototype.initialQueueDelay = 10000;
  353. ZammadChat.prototype.translations = {
  354. 'da': {
  355. '<strong>Chat</strong> with us!': '<strong>Chat</strong> med os!',
  356. 'All colleagues are busy.': 'Alle kollegaer er optaget.',
  357. 'Chat closed by %s': 'Chat lukket af %s',
  358. 'Compose your message…': '',
  359. 'Connecting': 'Forbinder',
  360. 'Connection lost': '',
  361. 'Connection re-established': 'Forbindelse genoprettet',
  362. 'Offline': 'Offline',
  363. 'Online': 'Online',
  364. 'Scroll down to see new messages': 'Scroll ned for at se nye beskeder',
  365. 'Send': 'Afsend',
  366. 'Since you didn\'t respond in the last %s minutes your conversation got closed.': 'Da du ikke har svaret i de sidste %s minutter er din samtale blevet lukket.',
  367. 'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> got closed.': 'Da du ikke har svaret i de sidste %s minutter er din samtale med <strong>%s</strong> blevet lukket.',
  368. 'Start new conversation': 'Start en ny samtale',
  369. 'Today': 'I dag',
  370. 'We are sorry, it takes longer as expected to get an empty slot. Please try again later or send us an email. Thank you!': 'Vi beklager, det tager længere end forventet at få en ledig plads. Prøv venligst igen senere eller send os en e-mail. På forhånd tak!',
  371. 'You are on waiting list position <strong>%s</strong>.': 'Du er i venteliste som nummer <strong>%s</strong>.'
  372. },
  373. 'de': {
  374. '<strong>Chat</strong> with us!': '<strong>Chatte</strong> mit uns!',
  375. 'All colleagues are busy.': 'Alle Kollegen sind beschäftigt.',
  376. 'Chat closed by %s': 'Chat von %s geschlossen',
  377. 'Compose your message…': 'Verfassen Sie Ihre Nachricht…',
  378. 'Connecting': 'Verbinde',
  379. 'Connection lost': 'Verbindung verloren',
  380. 'Connection re-established': 'Verbindung wieder aufgebaut',
  381. 'Offline': 'Offline',
  382. 'Online': 'Online',
  383. 'Scroll down to see new messages': 'Scrolle nach unten um neue Nachrichten zu sehen',
  384. 'Send': 'Senden',
  385. 'Since you didn\'t respond in the last %s minutes your conversation got closed.': 'Da Sie innerhalb der letzten %s Minuten nicht reagiert haben, wurde Ihre Unterhaltung geschlossen.',
  386. 'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> got closed.': 'Da Sie innerhalb der letzten %s Minuten nicht reagiert haben, wurde Ihre Unterhaltung mit <strong>%s</strong> geschlossen.',
  387. 'Start new conversation': 'Neue Unterhaltung starten',
  388. 'Today': 'Heute',
  389. 'We are sorry, it takes longer as expected to get an empty slot. Please try again later or send us an email. Thank you!': 'Entschuldigung, es dauert länger als erwartet einen freien Slot zu bekommen. Versuchen Sie es später erneut oder senden Sie uns eine E-Mail. Vielen Dank!',
  390. 'You are on waiting list position <strong>%s</strong>.': 'Sie sind in der Warteliste auf Position <strong>%s</strong>.'
  391. },
  392. 'el': {
  393. '<strong>Chat</strong> with us!': '<strong>Επικοινωνήστε</strong> μαζί μας!',
  394. 'All colleagues are busy.': 'Όλοι οι συνάδελφοι μας είναι απασχολημένοι.',
  395. 'Chat closed by %s': 'Η συνομιλία έκλεισε από τον/την %s',
  396. 'Compose your message…': '',
  397. 'Connecting': 'Σύνδεση',
  398. 'Connection lost': '',
  399. 'Connection re-established': 'Η σύνδεση αποκαταστάθηκε',
  400. 'Offline': 'Αποσυνδεμένος',
  401. 'Online': 'Ενεργό',
  402. 'Scroll down to see new messages': 'Μεταβείτε κάτω για να δείτε τα νέα μηνύματα',
  403. 'Send': 'Αποστολή',
  404. 'Since you didn\'t respond in the last %s minutes your conversation got closed.': 'Από τη στιγμή που δεν απαντήσατε τα τελευταία %s λεπτά η συνομιλία σας έκλεισε.',
  405. 'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> got closed.': 'Από τη στιγμή που δεν απαντήσατε τα τελευταία %s λεπτά η συνομιλία σας με τον/την <strong>%s</strong> έκλεισε.',
  406. 'Start new conversation': 'Έναρξη νέας συνομιλίας',
  407. 'Today': 'Σήμερα',
  408. 'We are sorry, it takes longer as expected to get an empty slot. Please try again later or send us an email. Thank you!': 'Λυπούμαστε που χρειάζεται περισσότερος χρόνος από τον αναμενόμενο για να βρεθεί μία κενή θέση. Παρακαλούμε δοκιμάστε ξανά αργότερα ή στείλτε μας ένα email. Ευχαριστούμε!',
  409. 'You are on waiting list position <strong>%s</strong>.': 'Βρίσκεστε σε λίστα αναμονής στη θέση <strong>%s</strong>.'
  410. },
  411. 'es': {
  412. '<strong>Chat</strong> with us!': '<strong>Chatee</strong> con nosotros!',
  413. 'All colleagues are busy.': 'Todos los colegas están ocupados.',
  414. 'Chat closed by %s': 'Chat cerrado por %s',
  415. 'Compose your message…': 'Escribe tu mensaje…',
  416. 'Connecting': 'Conectando',
  417. 'Connection lost': 'Conexión perdida',
  418. 'Connection re-established': 'Conexión reestablecida',
  419. 'Offline': 'Desconectado',
  420. 'Online': 'En línea',
  421. 'Scroll down to see new messages': 'Haga scroll hacia abajo para ver nuevos mensajes',
  422. 'Send': 'Enviar',
  423. 'Since you didn\'t respond in the last %s minutes your conversation got closed.': 'Puesto que usted no respondió en los últimos %s minutos su conversación se ha cerrado.',
  424. 'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> got closed.': 'Puesto que usted no respondió en los últimos %s minutos su conversación con <strong>%s</strong> se ha cerrado.',
  425. 'Start new conversation': 'Iniciar nueva conversación',
  426. 'Today': 'Hoy',
  427. 'We are sorry, it takes longer as expected to get an empty slot. Please try again later or send us an email. Thank you!': 'Lo sentimos, se tarda más tiempo de lo esperado para ser atendido por un agente. Inténtelo de nuevo más tarde o envíenos un correo electrónico. ¡Gracias!',
  428. 'You are on waiting list position <strong>%s</strong>.': 'Usted está en la posición <strong>%s</strong> de la lista de espera.'
  429. },
  430. 'es-co': {
  431. '<strong>Chat</strong> with us!': '',
  432. 'All colleagues are busy.': 'Todos los colaboradores están ocupados.',
  433. 'Chat closed by %s': 'Chat cerrado por %s',
  434. 'Compose your message…': 'Redacta tu mensaje…',
  435. 'Connecting': 'Conectando',
  436. 'Connection lost': 'Conexión perdida',
  437. 'Connection re-established': 'Conexión restablecida',
  438. 'Offline': '',
  439. 'Online': 'En línea',
  440. 'Scroll down to see new messages': 'Desplácese hacia abajo para ver nuevos mensajes',
  441. 'Send': 'Enviar',
  442. 'Since you didn\'t respond in the last %s minutes your conversation got closed.': 'Como no respondiste en los últimos %s minutos, tu conversación se cerró.',
  443. 'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> got closed.': 'Como no respondiste en los últimos %s minutos, tu conversación con <strong>%s</strong> se cerró.',
  444. 'Start new conversation': 'Iniciar nueva conversación',
  445. 'Today': 'Hoy dia',
  446. 'We are sorry, it takes longer as expected to get an empty slot. Please try again later or send us an email. Thank you!': 'Lo sentimos, lleva más tiempo del esperado obtener un espacio vacío. Vuelva a intentarlo más tarde o envíenos un correo electrónico. ¡Gracias!',
  447. 'You are on waiting list position <strong>%s</strong>.': 'Está en la posición de la lista de espera <strong>%s</strong>.'
  448. },
  449. 'fi': {
  450. '<strong>Chat</strong> with us!': '<strong>Keskustele</strong> kanssamme!',
  451. 'All colleagues are busy.': 'Kaikki kollegat ovat varattuja.',
  452. 'Chat closed by %s': '%s sulki keskustelun',
  453. 'Compose your message…': 'Kirjoita viesti…',
  454. 'Connecting': 'Yhdistetään',
  455. 'Connection lost': '',
  456. 'Connection re-established': 'Yhteys muodostettu uudelleen',
  457. 'Offline': 'Poissa',
  458. 'Online': 'Online',
  459. 'Scroll down to see new messages': 'Rullaa alas nähdäksesi uudet viestit',
  460. 'Send': 'Lähetä',
  461. 'Since you didn\'t respond in the last %s minutes your conversation got closed.': 'Koska et vastannut viimeiseen %s minuuttiin, keskustelusi suljettiin.',
  462. 'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> got closed.': 'Koska et vastannut viimeiseen %s minuuttiin, keskustelusi <strong>%s</strong> kanssa suljettiin.',
  463. 'Start new conversation': 'Aloita uusi keskustelu',
  464. 'Today': 'Tänään',
  465. 'We are sorry, it takes longer as expected to get an empty slot. Please try again later or send us an email. Thank you!': 'Olemme pahoillamme, tyhjän paikan vapautumisessa kestää odotettua pidempään. Ole hyvä ja yritä myöhemmin uudestaan tai lähetä meille sähköpostia. Kiitos!',
  466. 'You are on waiting list position <strong>%s</strong>.': 'Olet odotuslistalla sijalla <strong>%s</strong>.'
  467. },
  468. 'fr': {
  469. '<strong>Chat</strong> with us!': '<strong>Chattez</strong> avec nous!',
  470. 'All colleagues are busy.': 'Tout les agents sont occupés.',
  471. 'Chat closed by %s': 'Chat fermé par %s',
  472. 'Compose your message…': 'Ecrivez votre message…',
  473. 'Connecting': 'Connexion',
  474. 'Connection lost': 'Connexion perdue',
  475. 'Connection re-established': 'Connexion ré-établie',
  476. 'Offline': 'Hors-ligne',
  477. 'Online': 'En ligne',
  478. 'Scroll down to see new messages': 'Défiler vers le bas pour voir les nouveaux messages',
  479. 'Send': 'Envoyer',
  480. 'Since you didn\'t respond in the last %s minutes your conversation got closed.': 'Sans réponse de votre part depuis %s minutes, votre conservation a été clôturée.',
  481. 'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> got closed.': 'Sans réponse de votre part depuis %s minutes, votre conversation avec <strong>%s</strong> a été fermée.',
  482. 'Start new conversation': 'Démarrer une nouvelle conversation',
  483. 'Today': 'Aujourd\'hui',
  484. 'We are sorry, it takes longer as expected to get an empty slot. Please try again later or send us an email. Thank you!': 'Nous sommes désolés, trouver un opérateur disponible prend plus de temps que prévu. Réessayez plus tard ou envoyez-nous un mail. Merci !',
  485. 'You are on waiting list position <strong>%s</strong>.': 'Vous êtes actuellement en position <strong>%s</strong> dans la file d\\\'attente.'
  486. },
  487. 'he-il': {
  488. '<strong>Chat</strong> with us!': '<strong>שוחח</strong>איתנו!',
  489. 'All colleagues are busy.': 'כל הנציגים תפוסים',
  490. 'Chat closed by %s': 'הצאט נסגר ע"י %s',
  491. 'Compose your message…': '',
  492. 'Connecting': 'מתחבר',
  493. 'Connection lost': '',
  494. 'Connection re-established': 'החיבור שוחזר',
  495. 'Offline': 'מנותק',
  496. 'Online': 'אונליין',
  497. 'Scroll down to see new messages': 'גלול למטה כדי לראות הודעות חדשות',
  498. 'Send': 'שלח',
  499. 'Since you didn\'t respond in the last %s minutes your conversation got closed.': 'מכיוון שלא הגבת במהלך %s הדקות האחרונות השיחה שלך נסגרה.',
  500. 'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> got closed.': 'מכיוון שלא הגבת במהלך %s דקות השיחה שלך עם <strong>%s</strong> נסגרה.',
  501. 'Start new conversation': 'התחל שיחה חדשה',
  502. 'Today': 'היום',
  503. 'We are sorry, it takes longer as expected to get an empty slot. Please try again later or send us an email. Thank you!': 'מצטערים, הזמן לקבלת נציג ארוך מהרגיל. נסה שוב מאוחר יותר או שלח לנו דוא"ל. תודה!',
  504. 'You are on waiting list position <strong>%s</strong>.': 'מיקומך בתור <strong>%s</strong>.'
  505. },
  506. 'hu': {
  507. '<strong>Chat</strong> with us!': '<strong>Chatelj</strong> velünk!',
  508. 'All colleagues are busy.': 'Jelenleg minden kollégánk elfoglalt.',
  509. 'Chat closed by %s': 'A beszélgetést lezárta %s',
  510. 'Compose your message…': '',
  511. 'Connecting': 'Csatlakozás',
  512. 'Connection lost': '',
  513. 'Connection re-established': 'Újracsatlakozás',
  514. 'Offline': 'Offline',
  515. 'Online': 'Elérhető',
  516. 'Scroll down to see new messages': 'Görgess lejjebb az új üzenetekhez',
  517. 'Send': 'Küldés',
  518. 'Since you didn\'t respond in the last %s minutes your conversation got closed.': 'Mivel %s perce nem érkezett válasz, a beszélgetés lezárult.',
  519. 'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> got closed.': 'Mivel %s perce nem érkezett újabb üzenet, ezért a <strong>%s</strong> kollégával folytatott beszéletést lezártuk.',
  520. 'Start new conversation': 'Új beszélgetés indítása',
  521. 'Today': 'Ma',
  522. 'We are sorry, it takes longer as expected to get an empty slot. Please try again later or send us an email. Thank you!': 'Sajnáljuk, de a várakozási idő hosszabb a szokásosnál. Kérlek próbáld újra, vagy írd meg kérdésed emailben. Köszönjük!',
  523. 'You are on waiting list position <strong>%s</strong>.': 'A várólistán a <strong>%s</strong>. pozícióban várakozol.'
  524. },
  525. 'it': {
  526. '<strong>Chat</strong> with us!': '<strong>Chatta</strong> con noi!',
  527. 'All colleagues are busy.': 'Tutti i colleghi sono occupati.',
  528. 'Chat closed by %s': 'Chat chiusa da %s',
  529. 'Compose your message…': 'Scrivi il tuo messaggio…',
  530. 'Connecting': 'Connessione in corso',
  531. 'Connection lost': 'Connessione persa',
  532. 'Connection re-established': 'Connessione ristabilita',
  533. 'Offline': 'Offline',
  534. 'Online': 'Online',
  535. 'Scroll down to see new messages': 'Scorri verso il basso per vedere i nuovi messaggi',
  536. 'Send': 'Invia',
  537. 'Since you didn\'t respond in the last %s minutes your conversation got closed.': 'Dato che non hai risposto negli ultimi %s minuti, la tua conversazione è stata chiusa.',
  538. 'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> got closed.': 'Dato che non hai risposto negli ultimi %s minuti, la tua conversazione con <strong>%s</strong> è stata chiusa.',
  539. 'Start new conversation': 'Avvia una nuova chat',
  540. 'Today': 'Oggi',
  541. 'We are sorry, it takes longer as expected to get an empty slot. Please try again later or send us an email. Thank you!': 'Siamo spiacenti, ci vuole più tempo del previsto per ottenere uno spazio libero. Riprova più tardi o inviaci un\'e-mail. Grazie!',
  542. 'You are on waiting list position <strong>%s</strong>.': 'Sei alla posizione <strong>%s</strong> della lista di attesa.'
  543. },
  544. 'nb': {
  545. '<strong>Chat</strong> with us!': '<strong>Chat</strong> med oss!',
  546. 'All colleagues are busy.': 'Alle våre kolleger er for øyeblikket opptatt.',
  547. 'Chat closed by %s': 'Chat avsluttes om %s',
  548. 'Compose your message…': '',
  549. 'Connecting': 'Koble til',
  550. 'Connection lost': '',
  551. 'Connection re-established': 'Tilkoblingen er gjenopprettet',
  552. 'Offline': 'Avlogget',
  553. 'Online': 'Pålogget',
  554. 'Scroll down to see new messages': 'Rull ned for å se nye meldinger',
  555. 'Send': 'Send',
  556. 'Since you didn\'t respond in the last %s minutes your conversation got closed.': 'Ettersom du ikke har respondert i løpet av de siste %s minuttene, har samtalen nå blitt avsluttet.',
  557. 'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> got closed.': 'Ettersom du ikke har respondert i løpet av de siste %s minuttene av samtalen, vil samtalen med <strong>%s</strong> nå avsluttes.',
  558. 'Start new conversation': 'Start en ny samtale',
  559. 'Today': 'I dag',
  560. 'We are sorry, it takes longer as expected to get an empty slot. Please try again later or send us an email. Thank you!': 'Vi beklager, men det tar lengre tid enn vanlig å få en ledig plass i vår chat. Vennligst prøv igjen på et senere tidspunkt eller send oss en e-post. Tusen takk!',
  561. 'You are on waiting list position <strong>%s</strong>.': 'Du står nå i kø og er nr. <strong>%s</strong> på ventelisten.'
  562. },
  563. 'nl': {
  564. '<strong>Chat</strong> with us!': '<strong>Chat</strong> met ons!',
  565. 'All colleagues are busy.': 'Alle collega\'s zijn bezet.',
  566. 'Chat closed by %s': 'Chat gesloten door %s',
  567. 'Compose your message…': 'Stel je bericht op…',
  568. 'Connecting': 'Verbinden',
  569. 'Connection lost': 'Verbinding verbroken',
  570. 'Connection re-established': 'Verbinding hersteld',
  571. 'Offline': 'Offline',
  572. 'Online': 'Online',
  573. 'Scroll down to see new messages': 'Scroll naar beneden om nieuwe tickets te bekijken',
  574. 'Send': 'Verstuur',
  575. 'Since you didn\'t respond in the last %s minutes your conversation got closed.': 'De chat is afgesloten omdat je de laatste %s minuten niet hebt gereageerd.',
  576. 'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> got closed.': 'Je chat met <strong>%s</strong> is afgesloten omdat je niet hebt gereageerd in de laatste %s minuten.',
  577. 'Start new conversation': 'Nieuw gesprek starten',
  578. 'Today': 'Vandaag',
  579. 'We are sorry, it takes longer as expected to get an empty slot. Please try again later or send us an email. Thank you!': 'Onze excuses, het duurt langer dan verwacht om de chat te starten. Probeer het later opnieuw, of stuur ons een e-mail. Bedankt!',
  580. 'You are on waiting list position <strong>%s</strong>.': 'U bevindt zich op wachtlijstpositie <strong>%s</strong>.'
  581. },
  582. 'pl': {
  583. '<strong>Chat</strong> with us!': '<strong>Czatuj</strong> z nami!',
  584. 'All colleagues are busy.': 'Wszyscy agenci są zajęci.',
  585. 'Chat closed by %s': 'Chat zamknięty przez %s',
  586. 'Compose your message…': 'Skomponuj swoją wiadomość…',
  587. 'Connecting': 'Łączenie',
  588. 'Connection lost': 'Utracono połączenie',
  589. 'Connection re-established': 'Ponowne nawiązanie połączenia',
  590. 'Offline': 'Offline',
  591. 'Online': 'Online',
  592. 'Scroll down to see new messages': 'Skroluj w dół, aby zobaczyć wiadomości',
  593. 'Send': 'Wyślij',
  594. 'Since you didn\'t respond in the last %s minutes your conversation got closed.': 'Ponieważ nie odpowiedziałeś w ciągu ostatnich %s minut, Twoja rozmowa została zamknięta.',
  595. 'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> got closed.': 'Ponieważ nie odpowiedziałeś w ciągu ostatnich %s minut, Twoja rozmowa z <strong>%s</strong> została zamknięta.',
  596. 'Start new conversation': 'Rozpocznij nową rozmowę',
  597. 'Today': 'Dzisiaj',
  598. 'We are sorry, it takes longer as expected to get an empty slot. Please try again later or send us an email. Thank you!': 'Przepraszamy, otrzymanie pustego slotu trwa dłużej, niż oczekiwano. Spróbuj ponownie później lub wyślij nam e-mail. Dziękuję!',
  599. 'You are on waiting list position <strong>%s</strong>.': 'Jesteś na pozycji listy oczekujących <strong>%s</strong>.'
  600. },
  601. 'pt': {
  602. '<strong>Chat</strong> with us!': '<strong>Chat</strong> fale conosco!',
  603. 'All colleagues are busy.': 'Nossos atendentes estão ocupados.',
  604. 'Chat closed by %s': 'Chat encerrado por %s',
  605. 'Compose your message…': 'Escreva sua mensagem…',
  606. 'Connecting': 'Conectando',
  607. 'Connection lost': 'Conexão perdida',
  608. 'Connection re-established': 'Conexão restabelecida',
  609. 'Offline': 'Desconectado',
  610. 'Online': 'Online',
  611. 'Scroll down to see new messages': 'Rolar para baixo para ver novas mensagems',
  612. 'Send': 'Enviar',
  613. 'Since you didn\'t respond in the last %s minutes your conversation got closed.': 'Como você não respondeu nos últimos %s minutos sua conversa foi encerrada.',
  614. 'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> got closed.': 'Como você não respondeu nos últimos %s minutos sua conversa com <strong>%s</strong> foi encerrada.',
  615. 'Start new conversation': 'Iniciar uma nova conversa',
  616. 'Today': 'Hoje',
  617. 'We are sorry, it takes longer as expected to get an empty slot. Please try again later or send us an email. Thank you!': 'Desculpe, está levando mais tempo que o esperado para conseguir um assento vago. Por favor, tente novamente mais tarde ou envie-nos um e-mail. Obrigado!',
  618. 'You are on waiting list position <strong>%s</strong>.': 'Você está na posição <strong>%s</strong> da lista de espera.'
  619. },
  620. 'ru': {
  621. '<strong>Chat</strong> with us!': '<strong>Напишите</strong> нам!',
  622. 'All colleagues are busy.': 'Все коллеги заняты.',
  623. 'Chat closed by %s': 'Чат закрыт %s',
  624. 'Compose your message…': 'Составьте сообщение…',
  625. 'Connecting': 'Подключение',
  626. 'Connection lost': 'Подключение потеряно',
  627. 'Connection re-established': 'Подключение восстановлено',
  628. 'Offline': 'Оффлайн',
  629. 'Online': 'В сети',
  630. 'Scroll down to see new messages': 'Прокрутите вниз, чтобы увидеть новые сообщения',
  631. 'Send': 'Отправить',
  632. 'Since you didn\'t respond in the last %s minutes your conversation got closed.': 'Поскольку вы не ответили в течение последних %s минут, ваша беседа была закрыта.',
  633. 'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> got closed.': 'Поскольку вы не ответили в течение последних %s минут, ваш разговор с <strong>%s</strong> был закрыт.',
  634. 'Start new conversation': 'Начать новую беседу',
  635. 'Today': 'Сегодня',
  636. 'We are sorry, it takes longer as expected to get an empty slot. Please try again later or send us an email. Thank you!': 'Извините, получение свободного слота занимает больше времени, чем ожидалось. Пожалуйста, повторите попытку позже или отправьте нам письмо. Благодарим вас!',
  637. 'You are on waiting list position <strong>%s</strong>.': 'Вы находитесь в списке ожидания <strong>%s</strong>.'
  638. },
  639. 'sv': {
  640. '<strong>Chat</strong> with us!': '<strong>Chatta</strong> med oss!',
  641. 'All colleagues are busy.': 'Alla kollegor är upptagna.',
  642. 'Chat closed by %s': 'Chatt stängd av %s',
  643. 'Compose your message…': '',
  644. 'Connecting': 'Ansluter',
  645. 'Connection lost': '',
  646. 'Connection re-established': 'Anslutningen återupprättas',
  647. 'Offline': 'Offline',
  648. 'Online': 'Online',
  649. 'Scroll down to see new messages': 'Bläddra ner för att se nya meddelanden',
  650. 'Send': 'Skicka',
  651. 'Since you didn\'t respond in the last %s minutes your conversation got closed.': 'Då du inte svarat inom de senaste %s minuterna så avslutades din chatt.',
  652. 'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> got closed.': 'Eftersom du inte svarat inom %s minuterna i din konversation med <strong>%s</strong> så stängdes chatten.',
  653. 'Start new conversation': 'Starta ny konversation',
  654. 'Today': 'Idag',
  655. 'We are sorry, it takes longer as expected to get an empty slot. Please try again later or send us an email. Thank you!': 'Vi är ledsna, det tar längre tid som förväntat att få en ledig plats. Försök igen senare eller skicka ett e-postmeddelande till oss. Tack!',
  656. 'You are on waiting list position <strong>%s</strong>.': 'Du är på väntelistan som position <strong>%s</strong>.'
  657. },
  658. 'zh-cn': {
  659. '<strong>Chat</strong> with us!': '发起<strong>即时对话</strong>!',
  660. 'All colleagues are busy.': '所有同事都很忙。',
  661. 'Chat closed by %s': '对话被 %s 终止',
  662. 'Compose your message…': '编辑您的信息…',
  663. 'Connecting': '连接中',
  664. 'Connection lost': '',
  665. 'Connection re-established': '正在重新建立连接',
  666. 'Offline': '离线',
  667. 'Online': '在线',
  668. 'Scroll down to see new messages': '向下滚动以查看新消息',
  669. 'Send': '发送',
  670. 'Since you didn\'t respond in the last %s minutes your conversation got closed.': '由于您超过 %s 分钟没有任何回复, 该对话已被关闭.',
  671. 'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> got closed.': '由于您超过 %s 分钟没有回复, 您与 <strong>%s</strong> 的会话已被关闭.',
  672. 'Start new conversation': '开始新的会话',
  673. 'Today': '今天',
  674. 'We are sorry, it takes longer as expected to get an empty slot. Please try again later or send us an email. Thank you!': '非常抱歉, 目前需要等候更长的时间才能接入对话, 请稍后重试或向我们发送电子邮件. 谢谢!',
  675. 'You are on waiting list position <strong>%s</strong>.': '您目前的等候位置是第 <strong>%s</strong> 位.'
  676. },
  677. 'zh-tw': {
  678. '<strong>Chat</strong> with us!': '開始<strong>即時對话</strong>!',
  679. 'All colleagues are busy.': '所有服務人員都在忙碌中.',
  680. 'Chat closed by %s': '',
  681. 'Compose your message…': '',
  682. 'Connecting': '連線中',
  683. 'Connection lost': '',
  684. 'Connection re-established': '正在重新建立連線中',
  685. 'Offline': '离线',
  686. 'Online': '線上',
  687. 'Scroll down to see new messages': '向下滾動以查看新訊息',
  688. 'Send': '寄送',
  689. 'Since you didn\'t respond in the last %s minutes your conversation got closed.': '由於你超過 %s 分鐘沒有任何回應, 該對話已被關閉.',
  690. 'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> got closed.': '由於你超過 %s 分鐘沒有回應, 你與 <strong>%s</strong> 的對話已被關閉.',
  691. 'Start new conversation': '開始新的對話',
  692. 'Today': '今天',
  693. 'We are sorry, it takes longer as expected to get an empty slot. Please try again later or send us an email. Thank you!': '非常抱歉, 當前需要等候更長的時間方可排入對話程序, 請稍後重試或向我們寄送電子郵件. 謝謝!',
  694. 'You are on waiting list position <strong>%s</strong>.': '你目前的等候位置是第 <strong>%s</strong> 順位.'
  695. }
  696. };
  697. ZammadChat.prototype.sessionId = void 0;
  698. ZammadChat.prototype.scrolledToBottom = true;
  699. ZammadChat.prototype.scrollSnapTolerance = 10;
  700. ZammadChat.prototype.richTextFormatKey = {
  701. 66: true,
  702. 73: true,
  703. 85: true,
  704. 83: true
  705. };
  706. ZammadChat.prototype.T = function() {
  707. var item, items, j, len, string, translations;
  708. string = arguments[0], items = 2 <= arguments.length ? slice.call(arguments, 1) : [];
  709. if (this.options.lang && this.options.lang !== 'en') {
  710. if (!this.translations[this.options.lang]) {
  711. this.log.notice("Translation '" + this.options.lang + "' needed!");
  712. } else {
  713. translations = this.translations[this.options.lang];
  714. if (!translations[string]) {
  715. this.log.notice("Translation needed for '" + string + "'");
  716. }
  717. string = translations[string] || string;
  718. }
  719. }
  720. if (items) {
  721. for (j = 0, len = items.length; j < len; j++) {
  722. item = items[j];
  723. string = string.replace(/%s/, item);
  724. }
  725. }
  726. return string;
  727. };
  728. ZammadChat.prototype.view = function(name) {
  729. return (function(_this) {
  730. return function(options) {
  731. if (!options) {
  732. options = {};
  733. }
  734. options.T = _this.T;
  735. options.background = _this.options.background;
  736. options.flat = _this.options.flat;
  737. options.fontSize = _this.options.fontSize;
  738. return window.zammadChatTemplates[name](options);
  739. };
  740. })(this);
  741. };
  742. function ZammadChat(options) {
  743. this.removeAttributes = bind(this.removeAttributes, this);
  744. this.startTimeoutObservers = bind(this.startTimeoutObservers, this);
  745. this.onCssLoaded = bind(this.onCssLoaded, this);
  746. this.setAgentOnlineState = bind(this.setAgentOnlineState, this);
  747. this.onConnectionEstablished = bind(this.onConnectionEstablished, this);
  748. this.setSessionId = bind(this.setSessionId, this);
  749. this.onConnectionReestablished = bind(this.onConnectionReestablished, this);
  750. this.reconnect = bind(this.reconnect, this);
  751. this.destroy = bind(this.destroy, this);
  752. this.onScrollHintClick = bind(this.onScrollHintClick, this);
  753. this.detectScrolledtoBottom = bind(this.detectScrolledtoBottom, this);
  754. this.onLeaveTemporary = bind(this.onLeaveTemporary, this);
  755. this.onAgentTypingEnd = bind(this.onAgentTypingEnd, this);
  756. this.onAgentTypingStart = bind(this.onAgentTypingStart, this);
  757. this.onQueue = bind(this.onQueue, this);
  758. this.onQueueScreen = bind(this.onQueueScreen, this);
  759. this.onWebSocketClose = bind(this.onWebSocketClose, this);
  760. this.onCloseAnimationEnd = bind(this.onCloseAnimationEnd, this);
  761. this.close = bind(this.close, this);
  762. this.toggle = bind(this.toggle, this);
  763. this.sessionClose = bind(this.sessionClose, this);
  764. this.onOpenAnimationEnd = bind(this.onOpenAnimationEnd, this);
  765. this.open = bind(this.open, this);
  766. this.renderMessage = bind(this.renderMessage, this);
  767. this.receiveMessage = bind(this.receiveMessage, this);
  768. this.onSubmit = bind(this.onSubmit, this);
  769. this.onInput = bind(this.onInput, this);
  770. this.onReopenSession = bind(this.onReopenSession, this);
  771. this.onError = bind(this.onError, this);
  772. this.onWebSocketMessage = bind(this.onWebSocketMessage, this);
  773. this.send = bind(this.send, this);
  774. this.onKeydown = bind(this.onKeydown, this);
  775. this.onPaste = bind(this.onPaste, this);
  776. this.onDrop = bind(this.onDrop, this);
  777. this.render = bind(this.render, this);
  778. this.view = bind(this.view, this);
  779. this.T = bind(this.T, this);
  780. ZammadChat.__super__.constructor.call(this, options);
  781. if (typeof jQuery !== 'undefined' && this.options.target instanceof jQuery) {
  782. this.log.notice('Chat: target option is a jQuery object. jQuery is not a requirement for the chat any more.');
  783. this.options.target = this.options.target.get(0);
  784. }
  785. this.isFullscreen = window.matchMedia && window.matchMedia('(max-width: 768px)').matches;
  786. this.scrollRoot = this.getScrollRoot();
  787. if (!window.WebSocket || !sessionStorage) {
  788. this.state = 'unsupported';
  789. this.log.notice('Chat: Browser not supported!');
  790. return;
  791. }
  792. if (!this.options.chatId) {
  793. this.state = 'unsupported';
  794. this.log.error('Chat: need chatId as option!');
  795. return;
  796. }
  797. if (!this.options.lang) {
  798. this.options.lang = document.documentElement.getAttribute('lang');
  799. }
  800. if (this.options.lang) {
  801. if (!this.translations[this.options.lang]) {
  802. this.log.debug("lang: No " + this.options.lang + " found, try first two letters");
  803. this.options.lang = this.options.lang.replace(/-.+?$/, '');
  804. }
  805. this.log.debug("lang: " + this.options.lang);
  806. }
  807. if (!this.options.host) {
  808. this.detectHost();
  809. }
  810. this.loadCss();
  811. this.io = new Io(this.options);
  812. this.io.set({
  813. onOpen: this.render,
  814. onClose: this.onWebSocketClose,
  815. onMessage: this.onWebSocketMessage,
  816. onError: this.onError
  817. });
  818. this.io.connect();
  819. }
  820. ZammadChat.prototype.getScrollRoot = function() {
  821. var end, html, start;
  822. if ('scrollingElement' in document) {
  823. return document.scrollingElement;
  824. }
  825. html = document.documentElement;
  826. start = parseInt(html.pageYOffset, 10);
  827. html.pageYOffset = start + 1;
  828. end = parseInt(html.pageYOffset, 10);
  829. html.pageYOffset = start;
  830. if (end > start) {
  831. return html;
  832. } else {
  833. return document.body;
  834. }
  835. };
  836. ZammadChat.prototype.render = function() {
  837. var btn;
  838. if (!this.el || !document.querySelector('.zammad-chat')) {
  839. this.renderBase();
  840. }
  841. btn = document.querySelector("." + this.options.buttonClass);
  842. if (btn) {
  843. btn.classList.add(this.options.inactiveClass);
  844. }
  845. this.setAgentOnlineState('online');
  846. this.log.debug('widget rendered');
  847. this.startTimeoutObservers();
  848. this.idleTimeout.start();
  849. this.sessionId = sessionStorage.getItem('sessionId');
  850. return this.send('chat_status_customer', {
  851. session_id: this.sessionId,
  852. url: window.location.href
  853. });
  854. };
  855. ZammadChat.prototype.renderBase = function() {
  856. if (this.el) {
  857. this.el.remove();
  858. }
  859. this.options.target.insertAdjacentHTML('beforeend', this.view('chat')({
  860. title: this.options.title,
  861. scrollHint: this.options.scrollHint
  862. }));
  863. this.el = this.options.target.querySelector('.zammad-chat');
  864. this.input = this.el.querySelector('.zammad-chat-input');
  865. this.body = this.el.querySelector('.zammad-chat-body');
  866. this.el.querySelector('.js-chat-open').addEventListener('click', this.open);
  867. this.el.querySelector('.js-chat-toggle').addEventListener('click', this.toggle);
  868. this.el.querySelector('.js-chat-status').addEventListener('click', this.stopPropagation);
  869. this.el.querySelector('.zammad-chat-controls').addEventListener('submit', this.onSubmit);
  870. this.body.addEventListener('scroll', this.detectScrolledtoBottom);
  871. this.el.querySelector('.zammad-scroll-hint').addEventListener('click', this.onScrollHintClick);
  872. this.input.addEventListener('keydown', this.onKeydown);
  873. this.input.addEventListener('input', this.onInput);
  874. this.input.addEventListener('paste', this.onPaste);
  875. this.input.addEventListener('drop', this.onDrop);
  876. window.addEventListener('beforeunload', this.onLeaveTemporary);
  877. return window.addEventListener('hashchange', (function(_this) {
  878. return function() {
  879. if (_this.isOpen) {
  880. if (_this.sessionId) {
  881. _this.send('chat_session_notice', {
  882. session_id: _this.sessionId,
  883. message: window.location.href
  884. });
  885. }
  886. return;
  887. }
  888. return _this.idleTimeout.start();
  889. };
  890. })(this));
  891. };
  892. ZammadChat.prototype.stopPropagation = function(event) {
  893. return event.stopPropagation();
  894. };
  895. ZammadChat.prototype.onDrop = function(e) {
  896. var dataTransfer, file, reader, x, y;
  897. e.stopPropagation();
  898. e.preventDefault();
  899. if (window.dataTransfer) {
  900. dataTransfer = window.dataTransfer;
  901. } else if (e.dataTransfer) {
  902. dataTransfer = e.dataTransfer;
  903. } else {
  904. throw 'No clipboardData support';
  905. }
  906. x = e.clientX;
  907. y = e.clientY;
  908. file = dataTransfer.files[0];
  909. if (file.type.match('image.*')) {
  910. reader = new FileReader();
  911. reader.onload = (function(_this) {
  912. return function(e) {
  913. var insert;
  914. insert = function(dataUrl, width) {
  915. var img, pos, range, result;
  916. if (_this.isRetina()) {
  917. width = width / 2;
  918. }
  919. result = dataUrl;
  920. img = new Image();
  921. img.style.width = '100%';
  922. img.style.maxWidth = width + 'px';
  923. img.src = result;
  924. if (document.caretPositionFromPoint) {
  925. pos = document.caretPositionFromPoint(x, y);
  926. range = document.createRange();
  927. range.setStart(pos.offsetNode, pos.offset);
  928. range.collapse();
  929. return range.insertNode(img);
  930. } else if (document.caretRangeFromPoint) {
  931. range = document.caretRangeFromPoint(x, y);
  932. return range.insertNode(img);
  933. } else {
  934. return console.log('could not find carat');
  935. }
  936. };
  937. return _this.resizeImage(e.target.result, 460, 'auto', 2, 'image/jpeg', 'auto', insert);
  938. };
  939. })(this);
  940. return reader.readAsDataURL(file);
  941. }
  942. };
  943. ZammadChat.prototype.onPaste = function(e) {
  944. 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;
  945. e.stopPropagation();
  946. e.preventDefault();
  947. if (e.clipboardData) {
  948. clipboardData = e.clipboardData;
  949. } else if (window.clipboardData) {
  950. clipboardData = window.clipboardData;
  951. } else if (e.clipboardData) {
  952. clipboardData = e.clipboardData;
  953. } else {
  954. throw 'No clipboardData support';
  955. }
  956. imageInserted = false;
  957. if (clipboardData && clipboardData.items && clipboardData.items[0]) {
  958. item = clipboardData.items[0];
  959. if (item.kind === 'file' && (item.type === 'image/png' || item.type === 'image/jpeg')) {
  960. imageFile = item.getAsFile();
  961. reader = new FileReader();
  962. reader.onload = (function(_this) {
  963. return function(e) {
  964. var insert;
  965. insert = function(dataUrl, width) {
  966. var img;
  967. if (_this.isRetina()) {
  968. width = width / 2;
  969. }
  970. img = new Image();
  971. img.style.width = '100%';
  972. img.style.maxWidth = width + 'px';
  973. img.src = dataUrl;
  974. return document.execCommand('insertHTML', false, img);
  975. };
  976. return _this.resizeImage(e.target.result, 460, 'auto', 2, 'image/jpeg', 'auto', insert);
  977. };
  978. })(this);
  979. reader.readAsDataURL(imageFile);
  980. imageInserted = true;
  981. }
  982. }
  983. if (imageInserted) {
  984. return;
  985. }
  986. text = void 0;
  987. docType = void 0;
  988. try {
  989. text = clipboardData.getData('text/html');
  990. docType = 'html';
  991. if (!text || text.length === 0) {
  992. docType = 'text';
  993. text = clipboardData.getData('text/plain');
  994. }
  995. if (!text || text.length === 0) {
  996. docType = 'text2';
  997. text = clipboardData.getData('text');
  998. }
  999. } catch (error) {
  1000. e = error;
  1001. console.log('Sorry, can\'t insert markup because browser is not supporting it.');
  1002. docType = 'text3';
  1003. text = clipboardData.getData('text');
  1004. }
  1005. if (docType === 'text' || docType === 'text2' || docType === 'text3') {
  1006. text = '<div>' + text.replace(/\n/g, '</div><div>') + '</div>';
  1007. text = text.replace(/<div><\/div>/g, '<div><br></div>');
  1008. }
  1009. console.log('p', docType, text);
  1010. if (docType === 'html') {
  1011. html = document.createElement('div');
  1012. sanitized = DOMPurify.sanitize(text);
  1013. this.log.debug('sanitized HTML clipboard', sanitized);
  1014. html.innerHTML = sanitized;
  1015. match = false;
  1016. htmlTmp = text;
  1017. regex = new RegExp('<(/w|w)\:[A-Za-z]');
  1018. if (htmlTmp.match(regex)) {
  1019. match = true;
  1020. htmlTmp = htmlTmp.replace(regex, '');
  1021. }
  1022. regex = new RegExp('<(/o|o)\:[A-Za-z]');
  1023. if (htmlTmp.match(regex)) {
  1024. match = true;
  1025. htmlTmp = htmlTmp.replace(regex, '');
  1026. }
  1027. if (match) {
  1028. html = this.wordFilter(html);
  1029. }
  1030. ref = html.childNodes;
  1031. for (j = 0, len = ref.length; j < len; j++) {
  1032. node = ref[j];
  1033. if (node.nodeType === 8) {
  1034. node.remove();
  1035. }
  1036. }
  1037. ref1 = html.querySelectorAll('a, font, small, time, form, label');
  1038. for (k = 0, len1 = ref1.length; k < len1; k++) {
  1039. node = ref1[k];
  1040. node.outerHTML = node.innerHTML;
  1041. }
  1042. replacementTag = 'div';
  1043. ref2 = html.querySelectorAll('textarea');
  1044. for (l = 0, len2 = ref2.length; l < len2; l++) {
  1045. node = ref2[l];
  1046. outer = node.outerHTML;
  1047. regex = new RegExp('<' + node.tagName, 'i');
  1048. newTag = outer.replace(regex, '<' + replacementTag);
  1049. regex = new RegExp('</' + node.tagName, 'i');
  1050. newTag = newTag.replace(regex, '</' + replacementTag);
  1051. node.outerHTML = newTag;
  1052. }
  1053. ref3 = html.querySelectorAll('font, img, svg, input, select, button, style, applet, embed, noframes, canvas, script, frame, iframe, meta, link, title, head, fieldset');
  1054. for (m = 0, len3 = ref3.length; m < len3; m++) {
  1055. node = ref3[m];
  1056. node.remove();
  1057. }
  1058. this.removeAttributes(html);
  1059. text = html.innerHTML;
  1060. }
  1061. if (docType === 'text3') {
  1062. this.pasteHtmlAtCaret(text);
  1063. } else {
  1064. document.execCommand('insertHTML', false, text);
  1065. }
  1066. return true;
  1067. };
  1068. ZammadChat.prototype.onKeydown = function(e) {
  1069. var richtTextControl;
  1070. if (!this.inputDisabled && !e.shiftKey && e.keyCode === 13) {
  1071. e.preventDefault();
  1072. this.sendMessage();
  1073. }
  1074. richtTextControl = false;
  1075. if (!e.altKey && !e.ctrlKey && e.metaKey) {
  1076. richtTextControl = true;
  1077. } else if (!e.altKey && e.ctrlKey && !e.metaKey) {
  1078. richtTextControl = true;
  1079. }
  1080. if (richtTextControl && this.richTextFormatKey[e.keyCode]) {
  1081. e.preventDefault();
  1082. if (e.keyCode === 66) {
  1083. document.execCommand('bold');
  1084. return true;
  1085. }
  1086. if (e.keyCode === 73) {
  1087. document.execCommand('italic');
  1088. return true;
  1089. }
  1090. if (e.keyCode === 85) {
  1091. document.execCommand('underline');
  1092. return true;
  1093. }
  1094. if (e.keyCode === 83) {
  1095. document.execCommand('strikeThrough');
  1096. return true;
  1097. }
  1098. }
  1099. };
  1100. ZammadChat.prototype.send = function(event, data) {
  1101. if (data == null) {
  1102. data = {};
  1103. }
  1104. data.chat_id = this.options.chatId;
  1105. return this.io.send(event, data);
  1106. };
  1107. ZammadChat.prototype.onWebSocketMessage = function(pipes) {
  1108. var j, len, pipe;
  1109. for (j = 0, len = pipes.length; j < len; j++) {
  1110. pipe = pipes[j];
  1111. this.log.debug('ws:onmessage', pipe);
  1112. switch (pipe.event) {
  1113. case 'chat_error':
  1114. this.log.notice(pipe.data);
  1115. if (pipe.data && pipe.data.state === 'chat_disabled') {
  1116. this.destroy({
  1117. remove: true
  1118. });
  1119. }
  1120. break;
  1121. case 'chat_session_message':
  1122. if (pipe.data.self_written) {
  1123. return;
  1124. }
  1125. this.receiveMessage(pipe.data);
  1126. break;
  1127. case 'chat_session_typing':
  1128. if (pipe.data.self_written) {
  1129. return;
  1130. }
  1131. this.onAgentTypingStart();
  1132. break;
  1133. case 'chat_session_start':
  1134. this.onConnectionEstablished(pipe.data);
  1135. break;
  1136. case 'chat_session_queue':
  1137. this.onQueueScreen(pipe.data);
  1138. break;
  1139. case 'chat_session_closed':
  1140. this.onSessionClosed(pipe.data);
  1141. break;
  1142. case 'chat_session_left':
  1143. this.onSessionClosed(pipe.data);
  1144. break;
  1145. case 'chat_status_customer':
  1146. switch (pipe.data.state) {
  1147. case 'online':
  1148. this.sessionId = void 0;
  1149. if (!this.options.cssAutoload || this.cssLoaded) {
  1150. this.onReady();
  1151. } else {
  1152. this.socketReady = true;
  1153. }
  1154. break;
  1155. case 'offline':
  1156. this.onError('Zammad Chat: No agent online');
  1157. break;
  1158. case 'chat_disabled':
  1159. this.onError('Zammad Chat: Chat is disabled');
  1160. break;
  1161. case 'no_seats_available':
  1162. this.onError("Zammad Chat: Too many clients in queue. Clients in queue: " + pipe.data.queue);
  1163. break;
  1164. case 'reconnect':
  1165. this.onReopenSession(pipe.data);
  1166. }
  1167. }
  1168. }
  1169. };
  1170. ZammadChat.prototype.onReady = function() {
  1171. var base, btn;
  1172. this.log.debug('widget ready for use');
  1173. btn = document.querySelector("." + this.options.buttonClass);
  1174. if (btn) {
  1175. btn.addEventListener('click', this.open);
  1176. btn.classList.remove(this.options.inactiveClass);
  1177. }
  1178. if (typeof (base = this.options).onReady === "function") {
  1179. base.onReady();
  1180. }
  1181. if (this.options.show) {
  1182. return this.show();
  1183. }
  1184. };
  1185. ZammadChat.prototype.onError = function(message) {
  1186. var base, btn;
  1187. this.log.debug(message);
  1188. this.addStatus(message);
  1189. btn = document.querySelector("." + this.options.buttonClass);
  1190. if (btn) {
  1191. btn.classList.add('zammad-chat-is-hidden');
  1192. }
  1193. if (this.isOpen) {
  1194. this.disableInput();
  1195. this.destroy({
  1196. remove: false
  1197. });
  1198. } else {
  1199. this.destroy({
  1200. remove: true
  1201. });
  1202. }
  1203. return typeof (base = this.options).onError === "function" ? base.onError(message) : void 0;
  1204. };
  1205. ZammadChat.prototype.onReopenSession = function(data) {
  1206. var j, len, message, ref, unfinishedMessage;
  1207. this.log.debug('old messages', data.session);
  1208. this.inactiveTimeout.start();
  1209. unfinishedMessage = sessionStorage.getItem('unfinished_message');
  1210. if (data.agent) {
  1211. this.onConnectionEstablished(data);
  1212. ref = data.session;
  1213. for (j = 0, len = ref.length; j < len; j++) {
  1214. message = ref[j];
  1215. this.renderMessage({
  1216. message: message.content,
  1217. id: message.id,
  1218. from: message.created_by_id ? 'agent' : 'customer'
  1219. });
  1220. }
  1221. if (unfinishedMessage) {
  1222. this.input.innerHTML = unfinishedMessage;
  1223. }
  1224. }
  1225. if (data.position) {
  1226. this.onQueue(data);
  1227. }
  1228. this.show();
  1229. this.open();
  1230. this.scrollToBottom();
  1231. if (unfinishedMessage) {
  1232. return this.input.focus();
  1233. }
  1234. };
  1235. ZammadChat.prototype.onInput = function() {
  1236. var j, len, message, ref;
  1237. ref = this.el.querySelectorAll('.zammad-chat-message--unread');
  1238. for (j = 0, len = ref.length; j < len; j++) {
  1239. message = ref[j];
  1240. message.classList.remove('zammad-chat-message--unread');
  1241. }
  1242. sessionStorage.setItem('unfinished_message', this.input.innerHTML);
  1243. return this.onTyping();
  1244. };
  1245. ZammadChat.prototype.onTyping = function() {
  1246. if (this.isTyping && this.isTyping > new Date(new Date().getTime() - 1500)) {
  1247. return;
  1248. }
  1249. this.isTyping = new Date();
  1250. this.send('chat_session_typing', {
  1251. session_id: this.sessionId
  1252. });
  1253. return this.inactiveTimeout.start();
  1254. };
  1255. ZammadChat.prototype.onSubmit = function(event) {
  1256. event.preventDefault();
  1257. return this.sendMessage();
  1258. };
  1259. ZammadChat.prototype.sendMessage = function() {
  1260. var message, messageElement;
  1261. message = this.input.innerHTML;
  1262. if (!message) {
  1263. return;
  1264. }
  1265. this.inactiveTimeout.start();
  1266. sessionStorage.removeItem('unfinished_message');
  1267. messageElement = this.view('message')({
  1268. message: message,
  1269. from: 'customer',
  1270. id: this._messageCount++,
  1271. unreadClass: ''
  1272. });
  1273. this.maybeAddTimestamp();
  1274. if (this.el.querySelector('.zammad-chat-message--typing')) {
  1275. this.lastAddedType = 'typing-placeholder';
  1276. this.el.querySelector('.zammad-chat-message--typing').insertAdjacentHTML('beforebegin', messageElement);
  1277. } else {
  1278. this.lastAddedType = 'message--customer';
  1279. this.body.insertAdjacentHTML('beforeend', messageElement);
  1280. }
  1281. this.input.innerHTML = '';
  1282. this.scrollToBottom();
  1283. return this.send('chat_session_message', {
  1284. content: message,
  1285. id: this._messageCount,
  1286. session_id: this.sessionId
  1287. });
  1288. };
  1289. ZammadChat.prototype.receiveMessage = function(data) {
  1290. this.inactiveTimeout.start();
  1291. this.onAgentTypingEnd();
  1292. this.maybeAddTimestamp();
  1293. this.renderMessage({
  1294. message: data.message.content,
  1295. id: data.id,
  1296. from: 'agent'
  1297. });
  1298. return this.scrollToBottom({
  1299. showHint: true
  1300. });
  1301. };
  1302. ZammadChat.prototype.renderMessage = function(data) {
  1303. this.lastAddedType = "message--" + data.from;
  1304. data.unreadClass = document.hidden ? ' zammad-chat-message--unread' : '';
  1305. return this.body.insertAdjacentHTML('beforeend', this.view('message')(data));
  1306. };
  1307. ZammadChat.prototype.open = function() {
  1308. var remainerHeight;
  1309. if (this.isOpen) {
  1310. this.log.debug('widget already open, block');
  1311. return;
  1312. }
  1313. this.isOpen = true;
  1314. this.log.debug('open widget');
  1315. this.show();
  1316. if (!this.sessionId) {
  1317. this.showLoader();
  1318. }
  1319. this.el.classList.add('zammad-chat-is-open');
  1320. remainerHeight = this.el.clientHeight - this.el.querySelector('.zammad-chat-header').offsetHeight;
  1321. this.el.style.transform = "translateY(" + remainerHeight + "px)";
  1322. this.el.clientHeight;
  1323. if (!this.sessionId) {
  1324. this.el.addEventListener('transitionend', this.onOpenAnimationEnd);
  1325. this.el.classList.add('zammad-chat--animate');
  1326. this.el.clientHeight;
  1327. this.el.style.transform = '';
  1328. return this.send('chat_session_init', {
  1329. url: window.location.href
  1330. });
  1331. } else {
  1332. this.el.style.transform = '';
  1333. return this.onOpenAnimationEnd();
  1334. }
  1335. };
  1336. ZammadChat.prototype.onOpenAnimationEnd = function() {
  1337. var base;
  1338. this.el.removeEventListener('transitionend', this.onOpenAnimationEnd);
  1339. this.el.classList.remove('zammad-chat--animate');
  1340. this.idleTimeout.stop();
  1341. if (this.isFullscreen) {
  1342. this.disableScrollOnRoot();
  1343. }
  1344. return typeof (base = this.options).onOpenAnimationEnd === "function" ? base.onOpenAnimationEnd() : void 0;
  1345. };
  1346. ZammadChat.prototype.sessionClose = function() {
  1347. this.send('chat_session_close', {
  1348. session_id: this.sessionId
  1349. });
  1350. this.inactiveTimeout.stop();
  1351. this.waitingListTimeout.stop();
  1352. sessionStorage.removeItem('unfinished_message');
  1353. if (this.onInitialQueueDelayId) {
  1354. clearTimeout(this.onInitialQueueDelayId);
  1355. }
  1356. return this.setSessionId(void 0);
  1357. };
  1358. ZammadChat.prototype.toggle = function(event) {
  1359. if (this.isOpen) {
  1360. return this.close(event);
  1361. } else {
  1362. return this.open(event);
  1363. }
  1364. };
  1365. ZammadChat.prototype.close = function(event) {
  1366. var remainerHeight;
  1367. if (!this.isOpen) {
  1368. this.log.debug('can\'t close widget, it\'s not open');
  1369. return;
  1370. }
  1371. if (this.initDelayId) {
  1372. clearTimeout(this.initDelayId);
  1373. }
  1374. if (this.sessionId) {
  1375. this.log.debug('session close before widget close');
  1376. this.sessionClose();
  1377. }
  1378. this.log.debug('close widget');
  1379. if (event) {
  1380. event.stopPropagation();
  1381. }
  1382. if (this.isFullscreen) {
  1383. this.enableScrollOnRoot();
  1384. }
  1385. remainerHeight = this.el.clientHeight - this.el.querySelector('.zammad-chat-header').offsetHeight;
  1386. this.el.addEventListener('transitionend', this.onCloseAnimationEnd);
  1387. this.el.classList.add('zammad-chat--animate');
  1388. document.offsetHeight;
  1389. return this.el.style.transform = "translateY(" + remainerHeight + "px)";
  1390. };
  1391. ZammadChat.prototype.onCloseAnimationEnd = function() {
  1392. var base;
  1393. this.el.removeEventListener('transitionend', this.onCloseAnimationEnd);
  1394. this.el.classList.remove('zammad-chat-is-open', 'zammad-chat--animate');
  1395. this.el.style.transform = '';
  1396. this.showLoader();
  1397. this.el.querySelector('.zammad-chat-welcome').classList.remove('zammad-chat-is-hidden');
  1398. this.el.querySelector('.zammad-chat-agent').classList.add('zammad-chat-is-hidden');
  1399. this.el.querySelector('.zammad-chat-agent-status').classList.add('zammad-chat-is-hidden');
  1400. this.isOpen = false;
  1401. if (typeof (base = this.options).onCloseAnimationEnd === "function") {
  1402. base.onCloseAnimationEnd();
  1403. }
  1404. return this.io.reconnect();
  1405. };
  1406. ZammadChat.prototype.onWebSocketClose = function() {
  1407. if (this.isOpen) {
  1408. return;
  1409. }
  1410. if (this.el) {
  1411. this.el.classList.remove('zammad-chat-is-shown');
  1412. return this.el.classList.remove('zammad-chat-is-loaded');
  1413. }
  1414. };
  1415. ZammadChat.prototype.show = function() {
  1416. if (this.state === 'offline') {
  1417. return;
  1418. }
  1419. this.el.classList.add('zammad-chat-is-loaded');
  1420. return this.el.classList.add('zammad-chat-is-shown');
  1421. };
  1422. ZammadChat.prototype.disableInput = function() {
  1423. this.inputDisabled = true;
  1424. this.input.setAttribute('contenteditable', false);
  1425. this.el.querySelector('.zammad-chat-send').disabled = true;
  1426. return this.io.close();
  1427. };
  1428. ZammadChat.prototype.enableInput = function() {
  1429. this.inputDisabled = false;
  1430. this.input.setAttribute('contenteditable', true);
  1431. return this.el.querySelector('.zammad-chat-send').disabled = false;
  1432. };
  1433. ZammadChat.prototype.hideModal = function() {
  1434. return this.el.querySelector('.zammad-chat-modal').innerHTML = '';
  1435. };
  1436. ZammadChat.prototype.onQueueScreen = function(data) {
  1437. var show;
  1438. this.setSessionId(data.session_id);
  1439. show = (function(_this) {
  1440. return function() {
  1441. _this.onQueue(data);
  1442. return _this.waitingListTimeout.start();
  1443. };
  1444. })(this);
  1445. if (this.initialQueueDelay && !this.onInitialQueueDelayId) {
  1446. this.onInitialQueueDelayId = setTimeout(show, this.initialQueueDelay);
  1447. return;
  1448. }
  1449. if (this.onInitialQueueDelayId) {
  1450. clearTimeout(this.onInitialQueueDelayId);
  1451. }
  1452. return show();
  1453. };
  1454. ZammadChat.prototype.onQueue = function(data) {
  1455. this.log.notice('onQueue', data.position);
  1456. this.inQueue = true;
  1457. return this.el.querySelector('.zammad-chat-modal').innerHTML = this.view('waiting')({
  1458. position: data.position
  1459. });
  1460. };
  1461. ZammadChat.prototype.onAgentTypingStart = function() {
  1462. if (this.stopTypingId) {
  1463. clearTimeout(this.stopTypingId);
  1464. }
  1465. this.stopTypingId = setTimeout(this.onAgentTypingEnd, 3000);
  1466. if (this.el.querySelector('.zammad-chat-message--typing')) {
  1467. return;
  1468. }
  1469. this.maybeAddTimestamp();
  1470. this.body.insertAdjacentHTML('beforeend', this.view('typingIndicator')());
  1471. if (!this.isVisible(this.el.querySelector('.zammad-chat-message--typing'), true)) {
  1472. return;
  1473. }
  1474. return this.scrollToBottom();
  1475. };
  1476. ZammadChat.prototype.onAgentTypingEnd = function() {
  1477. if (this.el.querySelector('.zammad-chat-message--typing')) {
  1478. return this.el.querySelector('.zammad-chat-message--typing').remove();
  1479. }
  1480. };
  1481. ZammadChat.prototype.onLeaveTemporary = function() {
  1482. if (!this.sessionId) {
  1483. return;
  1484. }
  1485. return this.send('chat_session_leave_temporary', {
  1486. session_id: this.sessionId
  1487. });
  1488. };
  1489. ZammadChat.prototype.maybeAddTimestamp = function() {
  1490. var label, time, timestamp;
  1491. timestamp = Date.now();
  1492. if (!this.lastTimestamp || (timestamp - this.lastTimestamp) > this.showTimeEveryXMinutes * 60000) {
  1493. label = this.T('Today');
  1494. time = new Date().toTimeString().substr(0, 5);
  1495. if (this.lastAddedType === 'timestamp') {
  1496. this.updateLastTimestamp(label, time);
  1497. return this.lastTimestamp = timestamp;
  1498. } else {
  1499. this.body.insertAdjacentHTML('beforeend', this.view('timestamp')({
  1500. label: label,
  1501. time: time
  1502. }));
  1503. this.lastTimestamp = timestamp;
  1504. this.lastAddedType = 'timestamp';
  1505. return this.scrollToBottom();
  1506. }
  1507. }
  1508. };
  1509. ZammadChat.prototype.updateLastTimestamp = function(label, time) {
  1510. var timestamps;
  1511. if (!this.el) {
  1512. return;
  1513. }
  1514. timestamps = this.el.querySelectorAll('.zammad-chat-body .zammad-chat-timestamp');
  1515. if (!timestamps) {
  1516. return;
  1517. }
  1518. return timestamps[timestamps.length - 1].outerHTML = this.view('timestamp')({
  1519. label: label,
  1520. time: time
  1521. });
  1522. };
  1523. ZammadChat.prototype.addStatus = function(status) {
  1524. if (!this.el) {
  1525. return;
  1526. }
  1527. this.maybeAddTimestamp();
  1528. this.body.insertAdjacentHTML('beforeend', this.view('status')({
  1529. status: status
  1530. }));
  1531. return this.scrollToBottom();
  1532. };
  1533. ZammadChat.prototype.detectScrolledtoBottom = function() {
  1534. var scrollBottom;
  1535. scrollBottom = this.body.scrollTop + this.body.offsetHeight;
  1536. this.scrolledToBottom = Math.abs(scrollBottom - this.body.scrollHeight) <= this.scrollSnapTolerance;
  1537. if (this.scrolledToBottom) {
  1538. return this.el.querySelector('.zammad-scroll-hint').classList.add('is-hidden');
  1539. }
  1540. };
  1541. ZammadChat.prototype.showScrollHint = function() {
  1542. this.el.querySelector('.zammad-scroll-hint').classList.remove('is-hidden');
  1543. return this.body.scrollTop = this.body.scrollTop + this.el.querySelector('.zammad-scroll-hint').offsetHeight;
  1544. };
  1545. ZammadChat.prototype.onScrollHintClick = function() {
  1546. return this.body.scrollTo({
  1547. top: this.body.scrollHeight,
  1548. behavior: 'smooth'
  1549. });
  1550. };
  1551. ZammadChat.prototype.scrollToBottom = function(arg) {
  1552. var showHint;
  1553. showHint = (arg != null ? arg : {
  1554. showHint: false
  1555. }).showHint;
  1556. if (this.scrolledToBottom) {
  1557. return this.body.scrollTop = this.body.scrollHeight;
  1558. } else if (showHint) {
  1559. return this.showScrollHint();
  1560. }
  1561. };
  1562. ZammadChat.prototype.destroy = function(params) {
  1563. var btn;
  1564. if (params == null) {
  1565. params = {};
  1566. }
  1567. this.log.debug('destroy widget', params);
  1568. this.setAgentOnlineState('offline');
  1569. if (params.remove && this.el) {
  1570. this.el.remove();
  1571. btn = document.querySelector("." + this.options.buttonClass);
  1572. if (btn) {
  1573. btn.classList.add(this.options.inactiveClass);
  1574. btn.style.display = 'none';
  1575. }
  1576. }
  1577. if (this.waitingListTimeout) {
  1578. this.waitingListTimeout.stop();
  1579. }
  1580. if (this.inactiveTimeout) {
  1581. this.inactiveTimeout.stop();
  1582. }
  1583. if (this.idleTimeout) {
  1584. this.idleTimeout.stop();
  1585. }
  1586. return this.io.close();
  1587. };
  1588. ZammadChat.prototype.reconnect = function() {
  1589. this.log.notice('reconnecting');
  1590. this.disableInput();
  1591. this.lastAddedType = 'status';
  1592. this.setAgentOnlineState('connecting');
  1593. return this.addStatus(this.T('Connection lost'));
  1594. };
  1595. ZammadChat.prototype.onConnectionReestablished = function() {
  1596. var base;
  1597. this.lastAddedType = 'status';
  1598. this.setAgentOnlineState('online');
  1599. this.addStatus(this.T('Connection re-established'));
  1600. return typeof (base = this.options).onConnectionReestablished === "function" ? base.onConnectionReestablished() : void 0;
  1601. };
  1602. ZammadChat.prototype.onSessionClosed = function(data) {
  1603. var base;
  1604. this.addStatus(this.T('Chat closed by %s', data.realname));
  1605. this.disableInput();
  1606. this.setAgentOnlineState('offline');
  1607. this.inactiveTimeout.stop();
  1608. return typeof (base = this.options).onSessionClosed === "function" ? base.onSessionClosed(data) : void 0;
  1609. };
  1610. ZammadChat.prototype.setSessionId = function(id) {
  1611. this.sessionId = id;
  1612. if (id === void 0) {
  1613. return sessionStorage.removeItem('sessionId');
  1614. } else {
  1615. return sessionStorage.setItem('sessionId', id);
  1616. }
  1617. };
  1618. ZammadChat.prototype.onConnectionEstablished = function(data) {
  1619. var base;
  1620. if (this.onInitialQueueDelayId) {
  1621. clearTimeout(this.onInitialQueueDelayId);
  1622. }
  1623. this.inQueue = false;
  1624. if (data.agent) {
  1625. this.agent = data.agent;
  1626. }
  1627. if (data.session_id) {
  1628. this.setSessionId(data.session_id);
  1629. }
  1630. this.body.innerHTML = '';
  1631. this.el.querySelector('.zammad-chat-agent').innerHTML = this.view('agent')({
  1632. agent: this.agent
  1633. });
  1634. this.enableInput();
  1635. this.hideModal();
  1636. this.el.querySelector('.zammad-chat-welcome').classList.add('zammad-chat-is-hidden');
  1637. this.el.querySelector('.zammad-chat-agent').classList.remove('zammad-chat-is-hidden');
  1638. this.el.querySelector('.zammad-chat-agent-status').classList.remove('zammad-chat-is-hidden');
  1639. if (!this.isFullscreen) {
  1640. this.input.focus();
  1641. }
  1642. this.setAgentOnlineState('online');
  1643. this.waitingListTimeout.stop();
  1644. this.idleTimeout.stop();
  1645. this.inactiveTimeout.start();
  1646. return typeof (base = this.options).onConnectionEstablished === "function" ? base.onConnectionEstablished(data) : void 0;
  1647. };
  1648. ZammadChat.prototype.showCustomerTimeout = function() {
  1649. this.el.querySelector('.zammad-chat-modal').innerHTML = this.view('customer_timeout')({
  1650. agent: this.agent.name,
  1651. delay: this.options.inactiveTimeout
  1652. });
  1653. this.el.querySelector('.js-restart').addEventListener('click', function() {
  1654. return location.reload();
  1655. });
  1656. return this.sessionClose();
  1657. };
  1658. ZammadChat.prototype.showWaitingListTimeout = function() {
  1659. this.el.querySelector('.zammad-chat-modal').innerHTML = this.view('waiting_list_timeout')({
  1660. delay: this.options.watingListTimeout
  1661. });
  1662. this.el.querySelector('.js-restart').addEventListener('click', function() {
  1663. return location.reload();
  1664. });
  1665. return this.sessionClose();
  1666. };
  1667. ZammadChat.prototype.showLoader = function() {
  1668. return this.el.querySelector('.zammad-chat-modal').innerHTML = this.view('loader')();
  1669. };
  1670. ZammadChat.prototype.setAgentOnlineState = function(state) {
  1671. var capitalizedState;
  1672. this.state = state;
  1673. if (!this.el) {
  1674. return;
  1675. }
  1676. capitalizedState = state.charAt(0).toUpperCase() + state.slice(1);
  1677. this.el.querySelector('.zammad-chat-agent-status').dataset.status = state;
  1678. return this.el.querySelector('.zammad-chat-agent-status').textContent = this.T(capitalizedState);
  1679. };
  1680. ZammadChat.prototype.detectHost = function() {
  1681. var protocol;
  1682. protocol = 'ws://';
  1683. if (scriptProtocol === 'https') {
  1684. protocol = 'wss://';
  1685. }
  1686. return this.options.host = "" + protocol + scriptHost + "/ws";
  1687. };
  1688. ZammadChat.prototype.loadCss = function() {
  1689. var newSS, styles, url;
  1690. if (!this.options.cssAutoload) {
  1691. return;
  1692. }
  1693. url = this.options.cssUrl;
  1694. if (!url) {
  1695. url = this.options.host.replace(/^wss/i, 'https').replace(/^ws/i, 'http').replace(/\/ws$/i, '');
  1696. url += '/assets/chat/chat.css';
  1697. }
  1698. this.log.debug("load css from '" + url + "'");
  1699. styles = "@import url('" + url + "');";
  1700. newSS = document.createElement('link');
  1701. newSS.onload = this.onCssLoaded;
  1702. newSS.rel = 'stylesheet';
  1703. newSS.href = 'data:text/css,' + escape(styles);
  1704. return document.getElementsByTagName('head')[0].appendChild(newSS);
  1705. };
  1706. ZammadChat.prototype.onCssLoaded = function() {
  1707. var base;
  1708. this.cssLoaded = true;
  1709. if (this.socketReady) {
  1710. this.onReady();
  1711. }
  1712. return typeof (base = this.options).onCssLoaded === "function" ? base.onCssLoaded() : void 0;
  1713. };
  1714. ZammadChat.prototype.startTimeoutObservers = function() {
  1715. this.idleTimeout = new Timeout({
  1716. logPrefix: 'idleTimeout',
  1717. debug: this.options.debug,
  1718. timeout: this.options.idleTimeout,
  1719. timeoutIntervallCheck: this.options.idleTimeoutIntervallCheck,
  1720. callback: (function(_this) {
  1721. return function() {
  1722. _this.log.debug('Idle timeout reached, hide widget', new Date);
  1723. return _this.destroy({
  1724. remove: true
  1725. });
  1726. };
  1727. })(this)
  1728. });
  1729. this.inactiveTimeout = new Timeout({
  1730. logPrefix: 'inactiveTimeout',
  1731. debug: this.options.debug,
  1732. timeout: this.options.inactiveTimeout,
  1733. timeoutIntervallCheck: this.options.inactiveTimeoutIntervallCheck,
  1734. callback: (function(_this) {
  1735. return function() {
  1736. _this.log.debug('Inactive timeout reached, show timeout screen.', new Date);
  1737. _this.showCustomerTimeout();
  1738. return _this.destroy({
  1739. remove: false
  1740. });
  1741. };
  1742. })(this)
  1743. });
  1744. return this.waitingListTimeout = new Timeout({
  1745. logPrefix: 'waitingListTimeout',
  1746. debug: this.options.debug,
  1747. timeout: this.options.waitingListTimeout,
  1748. timeoutIntervallCheck: this.options.waitingListTimeoutIntervallCheck,
  1749. callback: (function(_this) {
  1750. return function() {
  1751. _this.log.debug('Waiting list timeout reached, show timeout screen.', new Date);
  1752. _this.showWaitingListTimeout();
  1753. return _this.destroy({
  1754. remove: false
  1755. });
  1756. };
  1757. })(this)
  1758. });
  1759. };
  1760. ZammadChat.prototype.disableScrollOnRoot = function() {
  1761. this.rootScrollOffset = this.scrollRoot.scrollTop;
  1762. this.scrollRoot.style.overflow = 'hidden';
  1763. return this.scrollRoot.style.position = 'fixed';
  1764. };
  1765. ZammadChat.prototype.enableScrollOnRoot = function() {
  1766. this.scrollRoot.scrollTop = this.rootScrollOffset;
  1767. this.scrollRoot.style.overflow = '';
  1768. return this.scrollRoot.style.position = '';
  1769. };
  1770. ZammadChat.prototype.isVisible = function(el, partial, hidden, direction) {
  1771. var bViz, clientSize, hVisible, lViz, rViz, rec, tViz, vVisible, vpHeight, vpWidth;
  1772. if (el.length < 1) {
  1773. return;
  1774. }
  1775. vpWidth = window.innerWidth;
  1776. vpHeight = window.innerHeight;
  1777. direction = direction ? direction : 'both';
  1778. clientSize = hidden === true ? t.offsetWidth * t.offsetHeight : true;
  1779. rec = el.getBoundingClientRect();
  1780. tViz = rec.top >= 0 && rec.top < vpHeight;
  1781. bViz = rec.bottom > 0 && rec.bottom <= vpHeight;
  1782. lViz = rec.left >= 0 && rec.left < vpWidth;
  1783. rViz = rec.right > 0 && rec.right <= vpWidth;
  1784. vVisible = partial ? tViz || bViz : tViz && bViz;
  1785. hVisible = partial ? lViz || rViz : lViz && rViz;
  1786. if (direction === 'both') {
  1787. return clientSize && vVisible && hVisible;
  1788. } else if (direction === 'vertical') {
  1789. return clientSize && vVisible;
  1790. } else if (direction === 'horizontal') {
  1791. return clientSize && hVisible;
  1792. }
  1793. };
  1794. ZammadChat.prototype.isRetina = function() {
  1795. var mq;
  1796. if (window.matchMedia) {
  1797. mq = window.matchMedia('only screen and (min--moz-device-pixel-ratio: 1.3), only screen and (-o-min-device-pixel-ratio: 2.6/2), only screen and (-webkit-min-device-pixel-ratio: 1.3), only screen and (min-device-pixel-ratio: 1.3), only screen and (min-resolution: 1.3dppx)');
  1798. return mq && mq.matches || (window.devicePixelRatio > 1);
  1799. }
  1800. return false;
  1801. };
  1802. ZammadChat.prototype.resizeImage = function(dataURL, x, y, sizeFactor, type, quallity, callback, force) {
  1803. var imageObject;
  1804. if (x == null) {
  1805. x = 'auto';
  1806. }
  1807. if (y == null) {
  1808. y = 'auto';
  1809. }
  1810. if (sizeFactor == null) {
  1811. sizeFactor = 1;
  1812. }
  1813. if (force == null) {
  1814. force = true;
  1815. }
  1816. imageObject = new Image();
  1817. imageObject.onload = function() {
  1818. var canvas, context, factor, imageHeight, imageWidth, newDataUrl, resize;
  1819. imageWidth = imageObject.width;
  1820. imageHeight = imageObject.height;
  1821. console.log('ImageService', 'current size', imageWidth, imageHeight);
  1822. if (y === 'auto' && x === 'auto') {
  1823. x = imageWidth;
  1824. y = imageHeight;
  1825. }
  1826. if (y === 'auto') {
  1827. factor = imageWidth / x;
  1828. y = imageHeight / factor;
  1829. }
  1830. if (x === 'auto') {
  1831. factor = imageWidth / y;
  1832. x = imageHeight / factor;
  1833. }
  1834. resize = false;
  1835. if (x < imageWidth || y < imageHeight) {
  1836. resize = true;
  1837. x = x * sizeFactor;
  1838. y = y * sizeFactor;
  1839. } else {
  1840. x = imageWidth;
  1841. y = imageHeight;
  1842. }
  1843. canvas = document.createElement('canvas');
  1844. canvas.width = x;
  1845. canvas.height = y;
  1846. context = canvas.getContext('2d');
  1847. context.drawImage(imageObject, 0, 0, x, y);
  1848. if (quallity === 'auto') {
  1849. if (x < 200 && y < 200) {
  1850. quallity = 1;
  1851. } else if (x < 400 && y < 400) {
  1852. quallity = 0.9;
  1853. } else if (x < 600 && y < 600) {
  1854. quallity = 0.8;
  1855. } else if (x < 900 && y < 900) {
  1856. quallity = 0.7;
  1857. } else {
  1858. quallity = 0.6;
  1859. }
  1860. }
  1861. newDataUrl = canvas.toDataURL(type, quallity);
  1862. if (resize) {
  1863. console.log('ImageService', 'resize', x / sizeFactor, y / sizeFactor, quallity, (newDataUrl.length * 0.75) / 1024 / 1024, 'in mb');
  1864. callback(newDataUrl, x / sizeFactor, y / sizeFactor, true);
  1865. return;
  1866. }
  1867. console.log('ImageService', 'no resize', x, y, quallity, (newDataUrl.length * 0.75) / 1024 / 1024, 'in mb');
  1868. return callback(newDataUrl, x, y, false);
  1869. };
  1870. return imageObject.src = dataURL;
  1871. };
  1872. ZammadChat.prototype.pasteHtmlAtCaret = function(html) {
  1873. var el, frag, lastNode, node, range, sel;
  1874. sel = void 0;
  1875. range = void 0;
  1876. if (window.getSelection) {
  1877. sel = window.getSelection();
  1878. if (sel.getRangeAt && sel.rangeCount) {
  1879. range = sel.getRangeAt(0);
  1880. range.deleteContents();
  1881. el = document.createElement('div');
  1882. el.innerHTML = html;
  1883. frag = document.createDocumentFragment(node, lastNode);
  1884. while (node = el.firstChild) {
  1885. lastNode = frag.appendChild(node);
  1886. }
  1887. range.insertNode(frag);
  1888. if (lastNode) {
  1889. range = range.cloneRange();
  1890. range.setStartAfter(lastNode);
  1891. range.collapse(true);
  1892. sel.removeAllRanges();
  1893. return sel.addRange(range);
  1894. }
  1895. }
  1896. } else if (document.selection && document.selection.type !== 'Control') {
  1897. return document.selection.createRange().pasteHTML(html);
  1898. }
  1899. };
  1900. ZammadChat.prototype.wordFilter = function(editor) {
  1901. var content, cur_level, el, i, j, k, l, last_level, len, len1, len2, len3, len4, len5, len6, len7, list_tag, m, matches, n, o, p, pnt, q, r, ref, ref1, ref10, ref2, ref3, ref4, ref5, ref6, ref7, ref8, ref9, s, start, str, txt;
  1902. content = editor.html();
  1903. content = content.replace(/<!--[\s\S]+?-->/gi, '');
  1904. content = content.replace(/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi, '');
  1905. content = content.replace(/<(\/?)s>/gi, '<$1strike>');
  1906. content = content.replace(/&nbsp;/gi, ' ');
  1907. editor.innerHTML = content;
  1908. ref = editor.querySelectorAll('p');
  1909. for (j = 0, len = ref.length; j < len; j++) {
  1910. p = ref[j];
  1911. str = p.getAttribute('style');
  1912. matches = /mso-list:\w+ \w+([0-9]+)/.exec(str);
  1913. if (matches) {
  1914. p.dataset._listLevel = parseInt(matches[1], 10);
  1915. }
  1916. }
  1917. last_level = 0;
  1918. pnt = null;
  1919. ref1 = editor.querySelectorAll('p');
  1920. for (k = 0, len1 = ref1.length; k < len1; k++) {
  1921. p = ref1[k];
  1922. cur_level = p.dataset._listLevel;
  1923. if (cur_level !== void 0) {
  1924. txt = p.textContent;
  1925. list_tag = '<ul></ul>';
  1926. if (/^\s*\w+\./.test(txt)) {
  1927. matches = /([0-9])\./.exec(txt);
  1928. if (matches) {
  1929. start = parseInt(matches[1], 10);
  1930. list_tag = (ref2 = start > 1) != null ? ref2 : '<ol start="' + start + {
  1931. '"></ol>': '<ol></ol>'
  1932. };
  1933. } else {
  1934. list_tag = '<ol></ol>';
  1935. }
  1936. }
  1937. if (cur_level > last_level) {
  1938. if (last_level === 0) {
  1939. p.insertAdjacentHTML('beforebegin', list_tag);
  1940. pnt = p.previousElementSibling;
  1941. } else {
  1942. }
  1943. pnt.insertAdjacentHTML('beforeend', list_tag);
  1944. }
  1945. if (cur_level < last_level) {
  1946. for (i = l = ref3 = i, ref4 = last_level - cur_level; ref3 <= ref4 ? l <= ref4 : l >= ref4; i = ref3 <= ref4 ? ++l : --l) {
  1947. pnt = pnt.parentNode;
  1948. }
  1949. }
  1950. if (p.querySelector('span:first')) {
  1951. p.querySelector('span:first').remove();
  1952. }
  1953. pnt.insertAdjacentHTML('beforeend', '<li>' + p.innerHTML + '</li>');
  1954. p.remove();
  1955. last_level = cur_level;
  1956. } else {
  1957. last_level = 0;
  1958. }
  1959. }
  1960. ref5 = editor.querySelectorAll('[style]');
  1961. for (m = 0, len2 = ref5.length; m < len2; m++) {
  1962. el = ref5[m];
  1963. el.removeAttribute('style');
  1964. }
  1965. ref6 = editor.querySelectorAll('[align]');
  1966. for (n = 0, len3 = ref6.length; n < len3; n++) {
  1967. el = ref6[n];
  1968. el.removeAttribute('align');
  1969. }
  1970. ref7 = editor.querySelectorAll('span');
  1971. for (o = 0, len4 = ref7.length; o < len4; o++) {
  1972. el = ref7[o];
  1973. el.outerHTML = el.innerHTML;
  1974. }
  1975. ref8 = editor.querySelectorAll('span:empty');
  1976. for (q = 0, len5 = ref8.length; q < len5; q++) {
  1977. el = ref8[q];
  1978. el.remove();
  1979. }
  1980. ref9 = editor.querySelectorAll("[class^='Mso']");
  1981. for (r = 0, len6 = ref9.length; r < len6; r++) {
  1982. el = ref9[r];
  1983. el.removeAttribute('class');
  1984. }
  1985. ref10 = editor.querySelectorAll('p:empty');
  1986. for (s = 0, len7 = ref10.length; s < len7; s++) {
  1987. el = ref10[s];
  1988. el.remove();
  1989. }
  1990. return editor;
  1991. };
  1992. ZammadChat.prototype.removeAttribute = function(element) {
  1993. var att, j, len, ref, results;
  1994. if (!element) {
  1995. return;
  1996. }
  1997. ref = element.attributes;
  1998. results = [];
  1999. for (j = 0, len = ref.length; j < len; j++) {
  2000. att = ref[j];
  2001. results.push(element.removeAttribute(att.name));
  2002. }
  2003. return results;
  2004. };
  2005. ZammadChat.prototype.removeAttributes = function(html) {
  2006. var j, len, node, ref;
  2007. ref = html.querySelectorAll('*');
  2008. for (j = 0, len = ref.length; j < len; j++) {
  2009. node = ref[j];
  2010. this.removeAttribute(node);
  2011. }
  2012. return html;
  2013. };
  2014. return ZammadChat;
  2015. })(Base);
  2016. return window.ZammadChat = ZammadChat;
  2017. })(window);
  2018. if (!window.zammadChatTemplates) {
  2019. window.zammadChatTemplates = {};
  2020. }
  2021. window.zammadChatTemplates["chat"] = function(__obj) {
  2022. if (!__obj) __obj = {};
  2023. var __out = [], __capture = function(callback) {
  2024. var out = __out, result;
  2025. __out = [];
  2026. callback.call(this);
  2027. result = __out.join('');
  2028. __out = out;
  2029. return __safe(result);
  2030. }, __sanitize = function(value) {
  2031. if (value && value.ecoSafe) {
  2032. return value;
  2033. } else if (typeof value !== 'undefined' && value != null) {
  2034. return __escape(value);
  2035. } else {
  2036. return '';
  2037. }
  2038. }, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
  2039. __safe = __obj.safe = function(value) {
  2040. if (value && value.ecoSafe) {
  2041. return value;
  2042. } else {
  2043. if (!(typeof value !== 'undefined' && value != null)) value = '';
  2044. var result = new String(value);
  2045. result.ecoSafe = true;
  2046. return result;
  2047. }
  2048. };
  2049. if (!__escape) {
  2050. __escape = __obj.escape = function(value) {
  2051. return ('' + value)
  2052. .replace(/&/g, '&amp;')
  2053. .replace(/</g, '&lt;')
  2054. .replace(/>/g, '&gt;')
  2055. .replace(/"/g, '&quot;');
  2056. };
  2057. }
  2058. (function() {
  2059. (function() {
  2060. __out.push('<div class="zammad-chat');
  2061. if (this.flat) {
  2062. __out.push(__sanitize(' zammad-chat--flat'));
  2063. }
  2064. __out.push('"');
  2065. if (this.fontSize) {
  2066. __out.push(__sanitize(" style='font-size: " + this.fontSize + "'"));
  2067. }
  2068. __out.push('>\n <div class="zammad-chat-header js-chat-open"');
  2069. if (this.background) {
  2070. __out.push(__sanitize(" style='background: " + this.background + "'"));
  2071. }
  2072. __out.push('>\n <div class="zammad-chat-header-controls js-chat-toggle">\n <span class="zammad-chat-agent-status zammad-chat-is-hidden js-chat-status" data-status="online"></span>\n <span class="zammad-chat-header-icon">\n <svg class="zammad-chat-header-icon-open" width="13" height="7" viewBox="0 0 13 7"><path d="M10.807 7l1.4-1.428-5-4.9L6.5-.02l-.7.7-4.9 4.9 1.414 1.413L6.5 2.886 10.807 7z" fill-rule="evenodd"/></svg>\n <svg class="zammad-chat-header-icon-close" width="13" height="13" viewBox="0 0 13 13"><path d="m2.241.12l-2.121 2.121 4.243 4.243-4.243 4.243 2.121 2.121 4.243-4.243 4.243 4.243 2.121-2.121-4.243-4.243 4.243-4.243-2.121-2.121-4.243 4.243-4.243-4.243" fill-rule="evenodd"/></svg>\n </span>\n </div>\n <div class="zammad-chat-agent zammad-chat-is-hidden">\n </div>\n <div class="zammad-chat-welcome">\n <svg class="zammad-chat-icon" viewBox="0 0 24 24" width="24" height="24"><path d="M2 5C2 4 3 3 4 3h16c1 0 2 1 2 2v10C22 16 21 17 20 17H4C3 17 2 16 2 15V5zM12 17l6 4v-4h-6z"/></svg>\n <span class="zammad-chat-welcome-text">');
  2073. __out.push(this.T(this.title));
  2074. __out.push('</span>\n </div>\n </div>\n <div class="zammad-chat-modal"></div>\n <div class="zammad-scroll-hint is-hidden">\n <svg class="zammad-scroll-hint-icon" width="20" height="18" viewBox="0 0 20 18"><path d="M0,2.00585866 C0,0.898053512 0.898212381,0 1.99079514,0 L18.0092049,0 C19.1086907,0 20,0.897060126 20,2.00585866 L20,11.9941413 C20,13.1019465 19.1017876,14 18.0092049,14 L1.99079514,14 C0.891309342,14 0,13.1029399 0,11.9941413 L0,2.00585866 Z M10,14 L16,18 L16,14 L10,14 Z" fill-rule="evenodd"/></svg>\n ');
  2075. __out.push(this.T(this.scrollHint));
  2076. __out.push('\n </div>\n <div class="zammad-chat-body"></div>\n <form class="zammad-chat-controls">\n <div class="zammad-chat-input" rows="1" placeholder="');
  2077. __out.push(this.T('Compose your message…'));
  2078. __out.push('" contenteditable="true"></div>\n <button type="submit" class="zammad-chat-button zammad-chat-send"');
  2079. if (this.background) {
  2080. __out.push(__sanitize(" style='background: " + this.background + "'"));
  2081. }
  2082. __out.push('>');
  2083. __out.push(this.T('Send'));
  2084. __out.push('</button>\n </form>\n</div>');
  2085. }).call(this);
  2086. }).call(__obj);
  2087. __obj.safe = __objSafe, __obj.escape = __escape;
  2088. return __out.join('');
  2089. };
  2090. if (!window.zammadChatTemplates) {
  2091. window.zammadChatTemplates = {};
  2092. }
  2093. window.zammadChatTemplates["customer_timeout"] = function(__obj) {
  2094. if (!__obj) __obj = {};
  2095. var __out = [], __capture = function(callback) {
  2096. var out = __out, result;
  2097. __out = [];
  2098. callback.call(this);
  2099. result = __out.join('');
  2100. __out = out;
  2101. return __safe(result);
  2102. }, __sanitize = function(value) {
  2103. if (value && value.ecoSafe) {
  2104. return value;
  2105. } else if (typeof value !== 'undefined' && value != null) {
  2106. return __escape(value);
  2107. } else {
  2108. return '';
  2109. }
  2110. }, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
  2111. __safe = __obj.safe = function(value) {
  2112. if (value && value.ecoSafe) {
  2113. return value;
  2114. } else {
  2115. if (!(typeof value !== 'undefined' && value != null)) value = '';
  2116. var result = new String(value);
  2117. result.ecoSafe = true;
  2118. return result;
  2119. }
  2120. };
  2121. if (!__escape) {
  2122. __escape = __obj.escape = function(value) {
  2123. return ('' + value)
  2124. .replace(/&/g, '&amp;')
  2125. .replace(/</g, '&lt;')
  2126. .replace(/>/g, '&gt;')
  2127. .replace(/"/g, '&quot;');
  2128. };
  2129. }
  2130. (function() {
  2131. (function() {
  2132. __out.push('<div class="zammad-chat-modal-text">\n ');
  2133. if (this.agent) {
  2134. __out.push('\n ');
  2135. __out.push(this.T('Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> got closed.', this.delay, this.agent));
  2136. __out.push('\n ');
  2137. } else {
  2138. __out.push('\n ');
  2139. __out.push(this.T('Since you didn\'t respond in the last %s minutes your conversation got closed.', this.delay));
  2140. __out.push('\n ');
  2141. }
  2142. __out.push('\n <br>\n <div class="zammad-chat-button js-restart"');
  2143. if (this.background) {
  2144. __out.push(__sanitize(" style='background: " + this.background + "'"));
  2145. }
  2146. __out.push('>');
  2147. __out.push(this.T('Start new conversation'));
  2148. __out.push('</div>\n</div>');
  2149. }).call(this);
  2150. }).call(__obj);
  2151. __obj.safe = __objSafe, __obj.escape = __escape;
  2152. return __out.join('');
  2153. };
  2154. if (!window.zammadChatTemplates) {
  2155. window.zammadChatTemplates = {};
  2156. }
  2157. window.zammadChatTemplates["loader"] = function(__obj) {
  2158. if (!__obj) __obj = {};
  2159. var __out = [], __capture = function(callback) {
  2160. var out = __out, result;
  2161. __out = [];
  2162. callback.call(this);
  2163. result = __out.join('');
  2164. __out = out;
  2165. return __safe(result);
  2166. }, __sanitize = function(value) {
  2167. if (value && value.ecoSafe) {
  2168. return value;
  2169. } else if (typeof value !== 'undefined' && value != null) {
  2170. return __escape(value);
  2171. } else {
  2172. return '';
  2173. }
  2174. }, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
  2175. __safe = __obj.safe = function(value) {
  2176. if (value && value.ecoSafe) {
  2177. return value;
  2178. } else {
  2179. if (!(typeof value !== 'undefined' && value != null)) value = '';
  2180. var result = new String(value);
  2181. result.ecoSafe = true;
  2182. return result;
  2183. }
  2184. };
  2185. if (!__escape) {
  2186. __escape = __obj.escape = function(value) {
  2187. return ('' + value)
  2188. .replace(/&/g, '&amp;')
  2189. .replace(/</g, '&lt;')
  2190. .replace(/>/g, '&gt;')
  2191. .replace(/"/g, '&quot;');
  2192. };
  2193. }
  2194. (function() {
  2195. (function() {
  2196. __out.push('<span class="zammad-chat-loading-animation">\n <span class="zammad-chat-loading-circle"></span>\n <span class="zammad-chat-loading-circle"></span>\n <span class="zammad-chat-loading-circle"></span>\n</span>\n<span class="zammad-chat-modal-text">');
  2197. __out.push(this.T('Connecting'));
  2198. __out.push('</span>');
  2199. }).call(this);
  2200. }).call(__obj);
  2201. __obj.safe = __objSafe, __obj.escape = __escape;
  2202. return __out.join('');
  2203. };
  2204. if (!window.zammadChatTemplates) {
  2205. window.zammadChatTemplates = {};
  2206. }
  2207. window.zammadChatTemplates["message"] = function(__obj) {
  2208. if (!__obj) __obj = {};
  2209. var __out = [], __capture = function(callback) {
  2210. var out = __out, result;
  2211. __out = [];
  2212. callback.call(this);
  2213. result = __out.join('');
  2214. __out = out;
  2215. return __safe(result);
  2216. }, __sanitize = function(value) {
  2217. if (value && value.ecoSafe) {
  2218. return value;
  2219. } else if (typeof value !== 'undefined' && value != null) {
  2220. return __escape(value);
  2221. } else {
  2222. return '';
  2223. }
  2224. }, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
  2225. __safe = __obj.safe = function(value) {
  2226. if (value && value.ecoSafe) {
  2227. return value;
  2228. } else {
  2229. if (!(typeof value !== 'undefined' && value != null)) value = '';
  2230. var result = new String(value);
  2231. result.ecoSafe = true;
  2232. return result;
  2233. }
  2234. };
  2235. if (!__escape) {
  2236. __escape = __obj.escape = function(value) {
  2237. return ('' + value)
  2238. .replace(/&/g, '&amp;')
  2239. .replace(/</g, '&lt;')
  2240. .replace(/>/g, '&gt;')
  2241. .replace(/"/g, '&quot;');
  2242. };
  2243. }
  2244. (function() {
  2245. (function() {
  2246. __out.push('<div class="zammad-chat-message zammad-chat-message--');
  2247. __out.push(__sanitize(this.from));
  2248. __out.push(__sanitize(this.unreadClass));
  2249. __out.push('">\n <span class="zammad-chat-message-body"');
  2250. if (this.background && this.from === 'customer') {
  2251. __out.push(__sanitize(" style='background: " + this.background + "'"));
  2252. }
  2253. __out.push('>');
  2254. __out.push(this.message);
  2255. __out.push('</span>\n</div>');
  2256. }).call(this);
  2257. }).call(__obj);
  2258. __obj.safe = __objSafe, __obj.escape = __escape;
  2259. return __out.join('');
  2260. };
  2261. if (!window.zammadChatTemplates) {
  2262. window.zammadChatTemplates = {};
  2263. }
  2264. window.zammadChatTemplates["status"] = function(__obj) {
  2265. if (!__obj) __obj = {};
  2266. var __out = [], __capture = function(callback) {
  2267. var out = __out, result;
  2268. __out = [];
  2269. callback.call(this);
  2270. result = __out.join('');
  2271. __out = out;
  2272. return __safe(result);
  2273. }, __sanitize = function(value) {
  2274. if (value && value.ecoSafe) {
  2275. return value;
  2276. } else if (typeof value !== 'undefined' && value != null) {
  2277. return __escape(value);
  2278. } else {
  2279. return '';
  2280. }
  2281. }, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
  2282. __safe = __obj.safe = function(value) {
  2283. if (value && value.ecoSafe) {
  2284. return value;
  2285. } else {
  2286. if (!(typeof value !== 'undefined' && value != null)) value = '';
  2287. var result = new String(value);
  2288. result.ecoSafe = true;
  2289. return result;
  2290. }
  2291. };
  2292. if (!__escape) {
  2293. __escape = __obj.escape = function(value) {
  2294. return ('' + value)
  2295. .replace(/&/g, '&amp;')
  2296. .replace(/</g, '&lt;')
  2297. .replace(/>/g, '&gt;')
  2298. .replace(/"/g, '&quot;');
  2299. };
  2300. }
  2301. (function() {
  2302. (function() {
  2303. __out.push('<div class="zammad-chat-status">\n <div class="zammad-chat-status-inner">\n ');
  2304. __out.push(this.status);
  2305. __out.push('\n </div>\n</div>');
  2306. }).call(this);
  2307. }).call(__obj);
  2308. __obj.safe = __objSafe, __obj.escape = __escape;
  2309. return __out.join('');
  2310. };
  2311. if (!window.zammadChatTemplates) {
  2312. window.zammadChatTemplates = {};
  2313. }
  2314. window.zammadChatTemplates["timestamp"] = function(__obj) {
  2315. if (!__obj) __obj = {};
  2316. var __out = [], __capture = function(callback) {
  2317. var out = __out, result;
  2318. __out = [];
  2319. callback.call(this);
  2320. result = __out.join('');
  2321. __out = out;
  2322. return __safe(result);
  2323. }, __sanitize = function(value) {
  2324. if (value && value.ecoSafe) {
  2325. return value;
  2326. } else if (typeof value !== 'undefined' && value != null) {
  2327. return __escape(value);
  2328. } else {
  2329. return '';
  2330. }
  2331. }, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
  2332. __safe = __obj.safe = function(value) {
  2333. if (value && value.ecoSafe) {
  2334. return value;
  2335. } else {
  2336. if (!(typeof value !== 'undefined' && value != null)) value = '';
  2337. var result = new String(value);
  2338. result.ecoSafe = true;
  2339. return result;
  2340. }
  2341. };
  2342. if (!__escape) {
  2343. __escape = __obj.escape = function(value) {
  2344. return ('' + value)
  2345. .replace(/&/g, '&amp;')
  2346. .replace(/</g, '&lt;')
  2347. .replace(/>/g, '&gt;')
  2348. .replace(/"/g, '&quot;');
  2349. };
  2350. }
  2351. (function() {
  2352. (function() {
  2353. __out.push('<div class="zammad-chat-timestamp"><strong>');
  2354. __out.push(__sanitize(this.label));
  2355. __out.push('</strong> ');
  2356. __out.push(__sanitize(this.time));
  2357. __out.push('</div>');
  2358. }).call(this);
  2359. }).call(__obj);
  2360. __obj.safe = __objSafe, __obj.escape = __escape;
  2361. return __out.join('');
  2362. };
  2363. if (!window.zammadChatTemplates) {
  2364. window.zammadChatTemplates = {};
  2365. }
  2366. window.zammadChatTemplates["typingIndicator"] = function(__obj) {
  2367. if (!__obj) __obj = {};
  2368. var __out = [], __capture = function(callback) {
  2369. var out = __out, result;
  2370. __out = [];
  2371. callback.call(this);
  2372. result = __out.join('');
  2373. __out = out;
  2374. return __safe(result);
  2375. }, __sanitize = function(value) {
  2376. if (value && value.ecoSafe) {
  2377. return value;
  2378. } else if (typeof value !== 'undefined' && value != null) {
  2379. return __escape(value);
  2380. } else {
  2381. return '';
  2382. }
  2383. }, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
  2384. __safe = __obj.safe = function(value) {
  2385. if (value && value.ecoSafe) {
  2386. return value;
  2387. } else {
  2388. if (!(typeof value !== 'undefined' && value != null)) value = '';
  2389. var result = new String(value);
  2390. result.ecoSafe = true;
  2391. return result;
  2392. }
  2393. };
  2394. if (!__escape) {
  2395. __escape = __obj.escape = function(value) {
  2396. return ('' + value)
  2397. .replace(/&/g, '&amp;')
  2398. .replace(/</g, '&lt;')
  2399. .replace(/>/g, '&gt;')
  2400. .replace(/"/g, '&quot;');
  2401. };
  2402. }
  2403. (function() {
  2404. (function() {
  2405. __out.push('<div class="zammad-chat-message zammad-chat-message--typing zammad-chat-message--agent">\n <span class="zammad-chat-message-body">\n <span class="zammad-chat-loading-animation">\n <span class="zammad-chat-loading-circle"></span>\n <span class="zammad-chat-loading-circle"></span>\n <span class="zammad-chat-loading-circle"></span>\n </span>\n </span>\n</div>');
  2406. }).call(this);
  2407. }).call(__obj);
  2408. __obj.safe = __objSafe, __obj.escape = __escape;
  2409. return __out.join('');
  2410. };
  2411. if (!window.zammadChatTemplates) {
  2412. window.zammadChatTemplates = {};
  2413. }
  2414. window.zammadChatTemplates["waiting"] = function(__obj) {
  2415. if (!__obj) __obj = {};
  2416. var __out = [], __capture = function(callback) {
  2417. var out = __out, result;
  2418. __out = [];
  2419. callback.call(this);
  2420. result = __out.join('');
  2421. __out = out;
  2422. return __safe(result);
  2423. }, __sanitize = function(value) {
  2424. if (value && value.ecoSafe) {
  2425. return value;
  2426. } else if (typeof value !== 'undefined' && value != null) {
  2427. return __escape(value);
  2428. } else {
  2429. return '';
  2430. }
  2431. }, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
  2432. __safe = __obj.safe = function(value) {
  2433. if (value && value.ecoSafe) {
  2434. return value;
  2435. } else {
  2436. if (!(typeof value !== 'undefined' && value != null)) value = '';
  2437. var result = new String(value);
  2438. result.ecoSafe = true;
  2439. return result;
  2440. }
  2441. };
  2442. if (!__escape) {
  2443. __escape = __obj.escape = function(value) {
  2444. return ('' + value)
  2445. .replace(/&/g, '&amp;')
  2446. .replace(/</g, '&lt;')
  2447. .replace(/>/g, '&gt;')
  2448. .replace(/"/g, '&quot;');
  2449. };
  2450. }
  2451. (function() {
  2452. (function() {
  2453. __out.push('<div class="zammad-chat-modal-text">\n <span class="zammad-chat-loading-animation">\n <span class="zammad-chat-loading-circle"></span>\n <span class="zammad-chat-loading-circle"></span>\n <span class="zammad-chat-loading-circle"></span>\n </span>\n ');
  2454. __out.push(this.T('All colleagues are busy.'));
  2455. __out.push('<br>\n ');
  2456. __out.push(this.T('You are on waiting list position <strong>%s</strong>.', this.position));
  2457. __out.push('\n</div>');
  2458. }).call(this);
  2459. }).call(__obj);
  2460. __obj.safe = __objSafe, __obj.escape = __escape;
  2461. return __out.join('');
  2462. };
  2463. if (!window.zammadChatTemplates) {
  2464. window.zammadChatTemplates = {};
  2465. }
  2466. window.zammadChatTemplates["waiting_list_timeout"] = function(__obj) {
  2467. if (!__obj) __obj = {};
  2468. var __out = [], __capture = function(callback) {
  2469. var out = __out, result;
  2470. __out = [];
  2471. callback.call(this);
  2472. result = __out.join('');
  2473. __out = out;
  2474. return __safe(result);
  2475. }, __sanitize = function(value) {
  2476. if (value && value.ecoSafe) {
  2477. return value;
  2478. } else if (typeof value !== 'undefined' && value != null) {
  2479. return __escape(value);
  2480. } else {
  2481. return '';
  2482. }
  2483. }, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
  2484. __safe = __obj.safe = function(value) {
  2485. if (value && value.ecoSafe) {
  2486. return value;
  2487. } else {
  2488. if (!(typeof value !== 'undefined' && value != null)) value = '';
  2489. var result = new String(value);
  2490. result.ecoSafe = true;
  2491. return result;
  2492. }
  2493. };
  2494. if (!__escape) {
  2495. __escape = __obj.escape = function(value) {
  2496. return ('' + value)
  2497. .replace(/&/g, '&amp;')
  2498. .replace(/</g, '&lt;')
  2499. .replace(/>/g, '&gt;')
  2500. .replace(/"/g, '&quot;');
  2501. };
  2502. }
  2503. (function() {
  2504. (function() {
  2505. __out.push('<div class="zammad-chat-modal-text">\n ');
  2506. __out.push(this.T('We are sorry, it takes longer as expected to get an empty slot. Please try again later or send us an email. Thank you!'));
  2507. __out.push('\n <br>\n <div class="zammad-chat-button js-restart"');
  2508. if (this.background) {
  2509. __out.push(__sanitize(" style='background: " + this.background + "'"));
  2510. }
  2511. __out.push('>');
  2512. __out.push(this.T('Start new conversation'));
  2513. __out.push('</div>\n</div>');
  2514. }).call(this);
  2515. }).call(__obj);
  2516. __obj.safe = __objSafe, __obj.escape = __escape;
  2517. return __out.join('');
  2518. };