/*Copyright (c), 2011 Sanford, L.P. All Rights Reserved.*/(function() {var n,aa=aa||{},p=this;p.Aa=!0;function q(){} function ba(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var d=Object.prototype.toString.call(a);if("[object Window]"==d)return"object";if("[object Array]"==d||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==d||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null"; else if("function"==b&&"undefined"==typeof a.call)return"object";return b}function ca(a){return"array"==ba(a)}function da(a){var b=ba(a);return"array"==b||"object"==b&&"number"==typeof a.length}function t(a){return"string"==typeof a}function ea(a){return"number"==typeof a}function u(a){return"function"==ba(a)}var fa="closure_uid_"+(1E9*Math.random()>>>0),ga=0;function ha(a,b,d){return a.call.apply(a.bind,arguments)} function ia(a,b,d){if(!a)throw Error();if(2b?1:0};function pa(a,b){b.unshift(a);z.call(this,la.apply(null,b));b.shift()}x(pa,z);pa.prototype.name="AssertionError";function qa(a,b){throw new pa("Failure"+(a?": "+a:""),Array.prototype.slice.call(arguments,1));};var B=Array.prototype,ra=B.indexOf?function(a,b,d){return B.indexOf.call(a,b,d)}:function(a,b,d){d=null==d?0:0>d?Math.max(0,a.length+d):d;if(t(a))return t(b)&&1==b.length?a.indexOf(b,d):-1;for(;db?null:t(a)?a.charAt(b):a[b]}function xa(a,b){var d=ra(a,b),e;(e=0<=d)&&B.splice.call(a,d,1);return e}function ya(a){return B.concat.apply(B,arguments)};var C;a:{var za=p.navigator;if(za){var Ba=za.userAgent;if(Ba){C=Ba;break a}}C=""};function Ca(a,b){for(var d in a)b.call(void 0,a[d],d,a)}function Da(a){var b=[],d=0,e;for(e in a)b[d++]=a[e];return b}function Ea(a){var b=[],d=0,e;for(e in a)b[d++]=e;return b}var Fa="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function Ga(a,b){for(var d,e,g=1;gparseFloat(a))?String(b):a}(),Pa={}; function F(a){var b;if(!(b=Pa[a])){b=0;for(var d=ma(String(Oa)).split("."),e=ma(String(a)).split("."),g=Math.max(d.length,e.length),h=0;0==b&&h");Ua("");function Va(a,b){Ca(b,function(b,e){"style"==e?a.style.cssText=b:"class"==e?a.className=b:"for"==e?a.htmlFor=b:e in Wa?a.setAttribute(Wa[e],b):0==e.lastIndexOf("aria-",0)||0==e.lastIndexOf("data-",0)?a.setAttribute(e,b):a[e]=b})}var Wa={cellpadding:"cellPadding",cellspacing:"cellSpacing",colspan:"colSpan",frameborder:"frameBorder",height:"height",maxlength:"maxLength",role:"role",rowspan:"rowSpan",type:"type",usemap:"useMap",valign:"vAlign",width:"width"}; function Xa(a,b){var d=[];Ya(a,b,d,!1);return d}function Ya(a,b,d,e){if(null!=a)for(a=a.firstChild;a;){if(b(a)&&(d.push(a),e)||Ya(a,b,d,e))return!0;a=a.nextSibling}return!1}var Za={SCRIPT:1,STYLE:1,HEAD:1,IFRAME:1,OBJECT:1},$a={IMG:" ",BR:"\n"};function ab(a,b,d){if(!(a.nodeName in Za))if(3==a.nodeType)d?b.push(String(a.nodeValue).replace(/(\r\n|\r|\n)/g,"")):b.push(a.nodeValue);else if(a.nodeName in $a)b.push($a[a.nodeName]);else for(a=a.firstChild;a;)ab(a,b,d),a=a.nextSibling};function bb(a){a.prototype.then=a.prototype.then;a.prototype.$goog_Thenable=!0}function cb(a){if(!a)return!1;try{return!!a.$goog_Thenable}catch(b){return!1}};function db(a,b){this.h=a;this.i=b;this.f=0;this.c=null}function eb(a){var b;0a.f&&(a.f++,b.next=a.c,a.c=b)};var hb=new db(function(){return new gb},function(a){a.reset()});function ib(){var a=jb,b=null;a.c&&(b=a.c,a.c=a.c.next,a.c||(a.f=null),b.next=null);return b}function gb(){this.next=this.f=this.c=null}gb.prototype.reset=function(){this.next=this.f=this.c=null};function kb(a){p.setTimeout(function(){throw a;},0)}var lb; function mb(){var a=p.MessageChannel;"undefined"===typeof a&&"undefined"!==typeof window&&window.postMessage&&window.addEventListener&&!A(C,"Presto")&&(a=function(){var a=document.createElement("IFRAME");a.style.display="none";a.src="";document.documentElement.appendChild(a);var b=a.contentWindow,a=b.document;a.open();a.write("");a.close();var d="callImmediate"+Math.random(),e="file:"==b.location.protocol?"*":b.location.protocol+"//"+b.location.host,a=v(function(a){if(("*"==e||a.origin==e)&&a.data== d)this.port1.onmessage()},this);b.addEventListener("message",a,!1);this.port1={};this.port2={postMessage:function(){b.postMessage(d,e)}}});if("undefined"!==typeof a&&!Ia()){var b=new a,d={},e=d;b.port1.onmessage=function(){if(void 0!==d.next){d=d.next;var a=d.fa;d.fa=null;a()}};return function(a){e.next={fa:a};e=e.next;b.port2.postMessage(0)}}return"undefined"!==typeof document&&"onreadystatechange"in document.createElement("SCRIPT")?function(a){var b=document.createElement("SCRIPT");b.onreadystatechange= function(){b.onreadystatechange=null;b.parentNode.removeChild(b);b=null;a();a=null};document.documentElement.appendChild(b)}:function(a){p.setTimeout(a,0)}};function nb(a,b){ob||pb();qb||(ob(),qb=!0);var d=jb,e=eb(hb);e.c=a;e.f=b;e.next=null;d.f?d.f.next=e:d.c=e;d.f=e}var ob;function pb(){if(p.Promise&&p.Promise.resolve){var a=p.Promise.resolve();ob=function(){a.then(rb)}}else ob=function(){var a=rb;!u(p.setImmediate)||p.Window&&p.Window.prototype&&p.Window.prototype.setImmediate==p.setImmediate?(lb||(lb=mb()),lb(a)):p.setImmediate(a)}}var qb=!1,jb=new function(){this.f=this.c=null}; function rb(){for(var a=null;a=ib();){try{a.c.call(a.f)}catch(b){kb(b)}fb(hb,a)}qb=!1};function G(a,b){this.c=sb;this.o=void 0;this.i=this.f=this.h=null;this.l=this.m=!1;if(a==tb)ub(this,vb,b);else try{var d=this;a.call(b,function(a){ub(d,vb,a)},function(a){if(!(a instanceof wb))try{if(a instanceof Error)throw a;throw Error("Promise rejected.");}catch(b){}ub(d,H,a)})}catch(e){ub(this,H,e)}}var sb=0,vb=2,H=3;function xb(){this.next=this.h=this.f=this.i=this.c=null;this.l=!1}xb.prototype.reset=function(){this.h=this.f=this.i=this.c=null;this.l=!1}; var yb=new db(function(){return new xb},function(a){a.reset()});function zb(a,b,d){var e=eb(yb);e.i=a;e.f=b;e.h=d;return e}function tb(){}function Ab(a){return new G(function(b,d){var e=a.length,g=[];if(e)for(var h=function(a,d){e--;g[a]=d;0==e&&b(g)},k=function(a){d(a)},l=0,m;m=a[l];l++)Bb(m,ja(h,l),k);else b(g)})}G.prototype.then=function(a,b,d){return Cb(this,u(a)?a:null,u(b)?b:null,d)};bb(G);function Bb(a,b,d,e){a instanceof G?Db(a,zb(b||q,d||null,e)):a.then(b,d,e)}n=G.prototype; n.ka=function(a,b){return Cb(this,null,a,b)};n.cancel=function(a){this.c==sb&&nb(function(){var b=new wb(a);Eb(this,b)},this)};function Eb(a,b){if(a.c==sb)if(a.h){var d=a.h;if(d.f){for(var e=0,g=null,h=null,k=d.f;k&&(k.l||(e++,k.c==a&&(g=k),!(g&&1=a.keyCode)a.keyCode=-1}catch(b){}};var Vb="closure_listenable_"+(1E6*Math.random()|0),Wb=0;function Xb(a,b,d,e,g){this.listener=a;this.c=null;this.src=b;this.type=d;this.aa=!!e;this.ba=g;++Wb;this.N=this.$=!1}function Yb(a){a.N=!0;a.listener=null;a.c=null;a.src=null;a.ba=null};function Zb(a){this.src=a;this.c={};this.f=0}function $b(a,b,d,e,g,h){var k=b.toString();b=a.c[k];b||(b=a.c[k]=[],a.f++);var l=ac(b,d,g,h);-1g.keyCode||void 0!=g.returnValue)){a:{var h=!1;if(0==g.keyCode)try{g.keyCode=-1;break a}catch(k){h=!0}if(h||void 0==g.returnValue)g.returnValue=!0}g=[];for(h=d.c;h;h=h.parentNode)g.push(h);for(var h=a.type,l=g.length-1;0<=l;l--){d.c=g[l];var m=nc(g[l],h,!0,d),e=e&&m}for(l=0;l>>0);function gc(a){if(u(a))return a;a[pc]||(a[pc]=function(b){return a.handleEvent(b)});return a[pc]};function I(){Mb.call(this);this.D=new Zb(this);this.da=this;this.R=null}x(I,Mb);I.prototype[Vb]=!0;I.prototype.addEventListener=function(a,b,d,e){fc(this,a,b,d,e)};I.prototype.removeEventListener=function(a,b,d,e){lc(this,a,b,d,e)}; function K(a,b){var d,e=a.R;if(e)for(d=[];e;e=e.R)d.push(e);var e=a.da,g=b,h=g.type||g;if(t(g))g=new Sb(g,e);else if(g instanceof Sb)g.target=g.target||e;else{var k=g,g=new Sb(h,e);Ga(g,k)}var k=!0,l;if(d)for(var m=d.length-1;0<=m;m--)l=g.c=d[m],k=qc(l,h,!0,g)&&k;l=g.c=e;k=qc(l,h,!0,g)&&k;k=qc(l,h,!1,g)&&k;if(d)for(m=0;m=Oc(this).value)for(u(b)&&(b=b()),a=new Fc(a,String(b),this.i),d&&(a.c=d),d="log:"+a.f,p.console&&(p.console.timeStamp?p.console.timeStamp(d):p.console.markTimeline&&p.console.markTimeline(d)),p.msWriteProfilerMark&&p.msWriteProfilerMark(d),d=this;d;)d=d.f};var Pc={},Qc=null; function Rc(a){Qc||(Qc=new Hc(""),Pc[""]=Qc,Qc.c=Mc);var b;if(!(b=Pc[a])){b=new Hc(a);var d=a.lastIndexOf("."),e=a.substr(d+1),d=Rc(a.substr(0,d));d.h||(d.h={});d.h[e]=b;b.f=d;Pc[a]=b}return b};function L(a,b){a&&a.log(Nc,b,void 0)};function Sc(){}Sc.prototype.c=null;function Tc(a){var b;(b=a.c)||(b={},Uc(a)&&(b[0]=!0,b[1]=!0),b=a.c=b);return b};var Vc;function Wc(){}x(Wc,Sc);function Xc(a){return(a=Uc(a))?new ActiveXObject(a):new XMLHttpRequest}function Uc(a){if(!a.f&&"undefined"==typeof XMLHttpRequest&&"undefined"!=typeof ActiveXObject){for(var b=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],d=0;db)throw Error("Bad port number "+b);a.s=b}else a.s=null}function vd(a,b,d){b instanceof xd?(a.h=b,Dd(a.h,a.m)):(d||(b=yd(b,Ed)),a.h=new xd(b,0,a.m))}function Fd(a){return a instanceof N?a.clone():new N(a,void 0)} function Gd(a,b){a instanceof N||(a=Fd(a));b instanceof N||(b=Fd(b));var d=a,e=b,g=d.clone(),h=!!e.i;h?td(g,e.i):h=!!e.o;h?g.o=e.o:h=!!e.c;h?g.c=e.c:h=null!=e.s;var k=e.f;if(h)ud(g,e.s);else if(h=!!e.f)if("/"!=k.charAt(0)&&(d.c&&!d.f?k="/"+k:(d=g.f.lastIndexOf("/"),-1!=d&&(k=g.f.substr(0,d+1)+k))),d=k,".."==d||"."==d)k="";else if(A(d,"./")||A(d,"/.")){for(var k=0==d.lastIndexOf("/",0),d=d.split("/"),l=[],m=0;m>4&15).toString(16)+(a&15).toString(16)} var zd=/[#\/\?@]/g,Bd=/[\#\?:]/g,Ad=/[\#\?]/g,Ed=/[\#\?@]/g,Cd=/#/g;function xd(a,b,d){this.h=this.c=null;this.f=a||null;this.i=!!d}function Id(a){a.c||(a.c=new Ac,a.h=0,a.f&&ad(a.f,function(b,d){var e=decodeURIComponent(b.replace(/\+/g," "));Id(a);a.f=null;var e=Kd(a,e),g=Ec(a.c,e);g||Bc(a.c,e,g=[]);g.push(d);a.h++}))}function Ld(a,b){Id(a);b=Kd(a,b);if(Dc(a.c.f,b)){a.f=null;a.h-=Ec(a.c,b).length;var d=a.c;Dc(d.f,b)&&(delete d.f[b],d.h--,d.i++,d.c.length>2*d.h&&Cc(d))}}n=xd.prototype; n.clear=function(){this.c=this.f=null;this.h=0};n.I=function(){Id(this);for(var a=this.c.J(),b=this.c.I(),d=[],e=0;e cachedWebPort : "+e+"/"+g);O("checkEnvironment > trying async service discovery");g?jd("https://"+e+":"+g+"/DYMO/DLS/Printing/StatusConnected",function(b){rd(b.target)?a():(Rd(null,null),Vd("127.0.0.1",a,d))},"GET",void 0,3E3):Vd("127.0.0.1",a,d)} function Wd(a,b){function d(b,d){O("checkEnvironment > web service found at :"+d+"/"+b);Rd(b,d);a();Xd||P.c()}var e=Sd(),g=e.Port,e=e.Host;O("checkEnvironment > cachedWebPort : "+e+"/"+g);O("checkEnvironment > trying synchronous service discovery");var g=g||41951,e=e||"127.0.0.1",h="127.0.0.1"===e;Yd(g,e)?d(g,e):h&&Yd(g,"localhost")?d(g,"localhost"):(Rd(null,null),b())}function Yd(a,b){try{return"true"===Td("https://"+b+":"+a+"/DYMO/DLS/Printing/StatusConnected",{},"GET")}catch(d){return!1}} function Vd(a,b,d){for(var e=[],g=41951;41960>=g;++g)e.push(Zd(g,a));Ab(e).then(function(){setTimeout(d,0)}).ka(function(e){ea(e)?(Rd(e,a),b()):d()})}function Zd(a,b){var d="https://"+b+":"+a+"/DYMO/DLS/Printing/StatusConnected";return new G(function(b,g){jd(d,function(d){rd(d.target)?g(a):b(a)},"GET",void 0,3E3)})} function $d(a,b,d){var e=Sd(),g="https://"+e.Host+":"+e.Port+"/DYMO/DLS/Printing/"+b;return new G(function(e,k){var l=[],m=null,r;for(r in d)l.push(encodeURIComponent(r)+"="+encodeURIComponent(d[r]));"POST"==a?m=l.length?l.join("&"):"":g+=l.length?"?"+l.join("&"):"";jd(g,function(a){var d=a.target;a=null;if(rd(d)){d=sd(d);try{a=window.JSON.parse(d)}catch(g){a=d}e(a)}else a="Failed to execute webservice command: "+b+". Error: "+d.w(),O("invokeWsCommandAsync > "+a),k(Error(a))},a||"GET",m,1E4)})} function ae(a,b,d){var e=Sd();a=Td("https://"+e.Host+":"+e.Port+"/DYMO/DLS/Printing/"+b,d,a);try{return window.JSON.parse(a)}catch(g){return a}} function be(){this.getPrinters=function(){return ae("GET","GetPrinters",{})};this.openLabelFile=function(a){return ae("GET","OpenLabelFile",{fileName:a})};this.printLabel=function(a,b,d,e){return ae("POST","PrintLabel",{printerName:a,printParamsXml:b,labelXml:d,labelSetXml:e})};this.printLabel2=function(a,b,d,e){return ae("POST","PrintLabel2",{printerName:a,printParamsXml:b,labelXml:d,labelSetXml:e})};this.renderLabel=function(a,b,d){return ae("POST","RenderLabel",{labelXml:a,renderParamsXml:b,printerName:d})}; this.loadImageAsPngBase64=function(a){return ae("GET","LoadImageAsPngBase64",{imageUri:a})};this.T=function(){return $d("GET","GetPrinters",{})};this.V=function(a){return $d("GET","OpenLabelFile",{fileName:a})};this.X=function(a,b,d,e){return $d("POST","PrintLabel",{printerName:a,printParamsXml:b,labelXml:d,labelSetXml:e})};this.W=function(a,b,d,e){return $d("POST","PrintLabel2",{printerName:a,printParamsXml:b,labelXml:d,labelSetXml:e})};this.Y=function(a,b,d){return $d("POST","RenderLabel",{labelXml:a, renderParamsXml:b,printerName:d})};this.U=function(a){return $d("GET","LoadImageAsPngBase64",{imageUri:a})}};var ce={};w("dymo.label.framework.FlowDirection",ce);ce.LeftToRight="LeftToRight";ce.RightToLeft="RightToLeft";var de={};w("dymo.label.framework.LabelWriterPrintQuality",de);de.Auto="Auto";de.Text="Text";de.BarcodeAndGraphics="BarcodeAndGraphics";var ee={};w("dymo.label.framework.TwinTurboRoll",ee);ee.Auto="Auto";ee.Left="Left";ee.Right="Right";var fe={};w("dymo.label.framework.TapeAlignment",fe);fe.Center="Center";fe.Left="Left";fe.Right="Right";var ge={};w("dymo.label.framework.TapeCutMode",ge); ge.AutoCut="AutoCut";ge.ChainMarks="ChainMarks";var he={};w("dymo.label.framework.AddressBarcodePosition",he);he.AboveAddress="AboveAddress";he.BelowAddress="BelowAddress";he.Suppress="Suppress";var Q={};w("dymo.label.framework.PrintJobStatus",Q);Q.S=0;Q.Unknown=Q.S;Q.va=1;Q.Printing=Q.va;Q.na=2;Q.Finished=Q.na;Q.Error=3;Q.Error=Q.Error;Q.ta=4;Q.PaperOut=Q.ta;Q.oa=5;Q.InQueue=Q.oa;Q.ea=-1;Q.ProcessingError=Q.ea;Q.ua=-2;Q.PrinterBusy=Q.ua;Q.pa=-3;Q.InvalidJobId=Q.pa;Q.sa=-4;Q.NotSpooled=Q.sa;function R(a){if("undefined"!=typeof DOMParser)return(new DOMParser).parseFromString(a,"application/xml");if("undefined"!=typeof ActiveXObject){var b=new ActiveXObject("MSXML2.DOMDocument");if(b){b.resolveExternals=!1;b.validateOnParse=!1;try{b.setProperty("ProhibitDTD",!0),b.setProperty("MaxXMLSize",2048),b.setProperty("MaxElementDepth",256)}catch(d){}}b.loadXML(a);return b}throw Error("Your browser does not support loading xml documents");} function ie(a){if("undefined"!=typeof XMLSerializer)return(new XMLSerializer).serializeToString(a);if(a=a.xml)return a;throw Error("Your browser does not support serializing XML documents");};function S(a,b,d,e){b=a.ownerDocument.createElement(b);d&&b.appendChild(a.ownerDocument.createTextNode(d));if(e)for(var g in e)b.setAttribute(g,e[g]);a.appendChild(b)}function T(a){if(a){var b=[];ab(a,b,!1);a=b.join("")}else a="";return a}function U(a,b){var d=a.getElementsByTagName(b);if(0"),d=b.documentElement,e=0;e")?(l=R(l),m.appendChild(l.documentElement.cloneNode(!0))):m.appendChild(b.createTextNode(l));h.appendChild(m)}}d.appendChild(h)}return ie(b)}W.toXml=je;W.prototype.toString=function(){return je(this.c)};function X(){} X.prototype.h=function(a,b){b=b.toString();0!=b.indexOf("")&&(b=""+b+"");this[a]=b;return this};X.prototype.setTextMarkup=X.prototype.h;X.prototype.f=function(a,b){this[a]=b;return this};X.prototype.setText=X.prototype.f;X.prototype.c=function(a,b){this[a]=b;return this};X.prototype.setBase64Image=X.prototype.c;function Y(a){this.f=R(a)}Y.prototype.c=function(){return ie(this.f)};Y.prototype.getLabelXml=Y.prototype.c;Y.prototype.M=function(a,b){return ke(this.c(),a,b)};Y.prototype.render=Y.prototype.M;Y.prototype.O=function(a,b){return le(this.c(),a,b)};Y.prototype.renderAsync=Y.prototype.O;Y.prototype.h=function(a,b,d){me(a,b,this.c(),d)};Y.prototype.print=Y.prototype.h;Y.prototype.H=function(a,b,d){return ne(a,b,this.c(),d)};Y.prototype.printAsync=Y.prototype.H; Y.prototype.A=function(a,b,d){return oe(a,b,this.c(),d)};Y.prototype.print2=Y.prototype.A;Y.prototype.F=function(a,b,d){return pe(a,b,this.c(),d)};Y.prototype.print2Async=Y.prototype.F;Y.prototype.G=function(a,b,d,e,g){return qe(a,b,this.c(),d,e,g)};Y.prototype.printAndPollStatus=Y.prototype.G;Y.prototype.B=function(a,b,d,e,g){return re(a,b,this.c(),d,e,g)};Y.prototype.printAndPollStatusAsync=Y.prototype.B;var se="AddressObject TextObject BarcodeObject ShapeObject CounterObject ImageObject CircularTextObject DateTimeObject".split(" "); function te(a,b){var d=b||se;return Xa(a.f.documentElement,function(a){return 1==a.nodeType&&0<=ra(d,a.tagName)})}Y.prototype.o=function(){for(var a=te(this),b=[],d=0;d').documentElement); for(h=R('').documentElement;e.firstChild;)e.removeChild(e.firstChild);d=d.split("\n");for(l=0;l is expected but not found: "+ie(e));e=g.ownerDocument.createElement("Image");V(e,b);d.replaceChild(e,g)}break;case "CircularTextObject":V(U(d,"Text"),b);break;case "DateTimeObject":V(U(d, "PreText"),b);break;case "CounterObject":V(U(d,"PreText"),b)}return this};Y.prototype.setObjectText=Y.prototype.da;Y.prototype.Z=function(a){var b=this.f.documentElement;if("ContinuousLabel"!=b.nodeName)throw Error("Cannot set length on non-continuous label.");var d=0==a?"Auto":"Fixed";a=0==a?7200:a;V(U(b,"LengthMode"),d);V(U(b,"LabelLength"),a);b=U(b,"RootCell");V(U(b,"Length"),a);V(U(b,"LengthMode"),d);return this};Y.prototype.setLabelLength=Y.prototype.Z;Y.prototype.toString=function(){return this.c()};/* Portions of this code are from MochiKit, received by The Closure Authors under the MIT license. All other code is Copyright 2005-2009 The Closure Authors. All Rights Reserved. */ function ye(a,b){this.l=[];this.B=a;this.G=b||null;this.i=this.c=!1;this.h=void 0;this.A=this.H=this.o=!1;this.m=0;this.f=null;this.s=0}ye.prototype.cancel=function(a){if(this.c)this.h instanceof ye&&this.h.cancel();else{if(this.f){var b=this.f;delete this.f;a?b.cancel(a):(b.s--,0>=b.s&&b.cancel())}this.B?this.B.call(this.G,this):this.A=!0;this.c||(a=new ze,Ae(this),Be(this,!1,a))}};ye.prototype.F=function(a,b){this.o=!1;Be(this,a,b)};function Be(a,b,d){a.c=!0;a.h=d;a.i=!b;Ce(a)} function Ae(a){if(a.c){if(!a.A)throw new De;a.A=!1}}function Ee(a,b,d,e){a.l.push([b,d,e]);a.c&&Ce(a)}ye.prototype.then=function(a,b,d){var e,g,h=new G(function(a,b){e=a;g=b});Ee(this,e,function(a){a instanceof ze?h.cancel():g(a)});return h.then(a,b,d)};bb(ye);function Fe(a){return ua(a.l,function(a){return u(a[1])})} function Ce(a){if(a.m&&a.c&&Fe(a)){var b=a.m,d=Ge[b];d&&(p.clearTimeout(d.u),delete Ge[b]);a.m=0}a.f&&(a.f.s--,delete a.f);for(var b=a.h,e=d=!1;a.l.length&&!a.o;){var g=a.l.shift(),h=g[0],k=g[1],g=g[2];if(h=a.i?k:h)try{var l=h.call(g||a.G,b);void 0!==l&&(a.i=a.i&&(l==b||l instanceof Error),a.h=b=l);if(cb(b)||"function"===typeof p.Promise&&b instanceof p.Promise)e=!0,a.o=!0}catch(m){b=m,a.i=!0,Fe(a)||(d=!0)}}a.h=b;e&&(l=v(a.F,a,!0),e=v(a.F,a,!1),b instanceof ye?(Ee(b,l,e),b.H=!0):b.then(l,e));d&&(b= new He(b),Ge[b.u]=b,a.m=b.u)}function De(){z.call(this)}x(De,z);De.prototype.message="Deferred has already fired";De.prototype.name="AlreadyCalledError";function ze(){z.call(this)}x(ze,z);ze.prototype.message="Deferred was canceled";ze.prototype.name="CanceledError";function He(a){this.u=p.setTimeout(v(this.f,this),0);this.c=a}He.prototype.f=function(){delete Ge[this.u];throw this.c;};var Ge={};function Ie(a,b){var d=b||{},e=d.document||document,g=document.createElement("SCRIPT"),h={ja:g,L:void 0},k=new ye(Je,h),l=null,m=null!=d.timeout?d.timeout:5E3;0>>=8)&255;k[g++]=(h>>>=8)&255;k[g++]=h>>>8&255;h=4294967296*Math.random();k[g++]=h&255;k[g++]=(h>>>=8)&255;k[g++]=(h>>>=8)&15|64;k[g++]=h>>>8&255;h=4294967296*Math.random();k[g++]=h&63|128;k[g++]= (h>>>=8)&255;k[g++]=(h>>>=8)&255;k[g++]=h>>>8&255;h=4294967296*Math.random();k[g++]=h&255;k[g++]=(h>>>=8)&255;k[g++]=(h>>>=8)&255;k[g++]=h>>>8&255;return void 0===b?a(k):k}for(var d=Array,e=new d(16),g=[],h={},k=0;256>k;k++)g[k]=(k+256).toString(16).substr(1).toUpperCase(),h[g[k]]=k;b.f=function(a){var b=new d(16),e=0;a.toUpperCase().replace(/[0-9A-F][0-9A-F]/g,function(a){b[e++]=h[a]});return b};b.h=a;b.c=d;return b}();function Xe(a,b,d,e){this.printerName=a;this.jobId=b;this.status=d;this.statusMessage=e}function Ye(a){var b={};a=a.split(" ");1<=a.length&&(b.status=parseInt(a[0],10));b.statusMessage=a.slice(1).join(" ");return b}function Ze(a){for(var b=0;b WebServicePresent");var d=new be;if(d)a={getPrinters:function(){return d.getPrinters()},openLabelFile:function(a){return d.openLabelFile(a)},printLabel:function(a,b,e,g){d.printLabel(a,b,e,g)},printLabel2:function(a,b,e,g){d.printLabel2(a,b,e,g)},renderLabel:function(a,b,e){return d.renderLabel(a, b,e)},loadImageAsPngBase64:function(a){return d.loadImageAsPngBase64(a)},getJobStatus:function(a,b){var e;u(d.getJobStatus)?e=Ye(d.getJobStatus(a,parseInt(b,10))):e={status:Q.S,statusMessage:"not implemented"};return new Xe(a,b,e.status,e.statusMessage)},T:function(){return d.T()},V:function(a){return d.V(a)},X:function(a,b,e,g){return d.X(a,b,e,g)},W:function(a,b,e,g){return d.W(a,b,e,g)},Y:function(a,b,e){return d.Y(a,b,e)},U:function(a){return d.U(a)}};else throw Error("Cannot establish connection to the web service. Is DYMO Label Framework installed?"); return a}if("ActiveXObject"in window){O("chooseEnvironment > ActiveXObject");a={};var e=ef();a.getPrinters=function(){return e.GetPrinters()};a.openLabelFile=function(a){return e.OpenLabelFile(a)};a.printLabel=function(a,b,d,g){e.PrintLabel(a,b,d,g)};a.renderLabel=function(a,b,d){return e.RenderLabel(a,b,d)};a.loadImageAsPngBase64=function(a){return e.LoadImageAsPngBase64(a)};a.printLabel2=function(a,b,d,g){if(u(e.PrintLabel2))return e.PrintLabel2(a,b,d,g).toString();e.PrintLabel(a,b,d,g)};a.getJobStatus= function(a,b){var d;u(e.GetJobStatus)?d=Ye(e.GetJobStatus(a,parseInt(b,10))):d={status:Q.S,statusMessage:"not implemented"};return new Xe(a,b,d.status,d.statusMessage)}}else if(-1!=navigator.platform.indexOf("Win")){O("chooseEnvironment > WIN");var g=bf();if(g)a={getPrinters:function(){return g.getPrinters()},openLabelFile:function(a){return g.openLabelFile(a)},printLabel:function(a,b,d,e){g.printLabel(a,b,d,e)},renderLabel:function(a,b,d){return g.renderLabel(a,b,d)},loadImageAsPngBase64:function(a){return g.loadImageAsPngBase64(a)}, printLabel2:function(a,b,d,e){if(u(g.printLabel2))return g.printLabel2(a,b,d,e).toString();g.printLabel(a,b,d,e)},getJobStatus:function(a,b){var d;u(g.getJobStatus)?d=Ye(g.getJobStatus(a,parseInt(b,10))):d={status:Q.S,statusMessage:"not implemented"};return new Xe(a,b,d.status,d.statusMessage)}};else throw Error("DYMO Label Framework is not installed");}else{O("chooseEnvironment > not WIN");var h;Ze("application/x-dymolabel")?(O("chooseEnvironment > _createSafariPlugin"),h=$e()):(O("chooseEnvironment > _createMacNsapiPlugin"), h=df());O("chooseEnvironment > safariPlugin : "+!!h);if(h)a={getPrinters:function(){return h.getPrinters()},openLabelFile:function(a){var b=h.openLabelFile(a);if(!b)throw Error("Unable to open label file '"+a+"'");return b},printLabel:function(a,b,d,e){h.printLabel(d,a,b,e)},renderLabel:function(a,b,d){return h.renderLabel(a,b,d)},loadImageAsPngBase64:function(a){var b=h.loadImageAsPngBase64(a);if(!b)throw Error("Unable to load image from uri '"+a+"'");return b},printLabel2:function(a,b,d,e){if(u(h.printLabel2))return h.printLabel2(d, a,b,e).toString();h.printLabel(d,a,b,e)},getJobStatus:function(a,b){var d;u(h.getJobStatus)?d=Ye(h.getJobStatus(a,parseInt(b,10))):d={status:Q.S,statusMessage:"not implemented"};return new Xe(a,b,d.status,d.statusMessage)}};else throw Error("DYMO Label Framework is not installed");}a.T=b(a.getPrinters);a.V=b(a.openLabelFile);a.X=b(a.printLabel);a.W=b(a.printLabel2);a.Y=b(a.renderLabel);a.U=b(a.loadImageAsPngBase64);return a}w("dymo.label.framework.trace",!1);var Xd=0; function O(a){window.dymo.label.framework.trace&&window.console&&window.console.log&&console.log(a)}function gf(a){function b(){throw d;}var d=a||Error("DYMO Label Framework Plugin or WebService are not installed");return{getPrinters:b,openLabelFile:b,printLabel:b,printLabel2:b,renderLabel:b,loadImageAsPngBase64:b,getJobStatus:b,T:b,V:b,X:b,W:b,Y:b,U:b}} var P=function(){function a(g,h){if(d)throw O("_createFramework > Error service discovery is in progress. "),Error("DYMO Label Framework service discovery is in progress.");return b?(O("_createFramework > returning existing instance of _framework, has callBack: "+!!g),g&&g(e),b):this&&this.constructor==a?(d=!0,P.c=function(){e=b=null;Xd=0},hf(function(a){e=a;O("onEnvironmentChecked > checkResult isBrowserSupported : "+a.isBrowserSupported+", isFrameworkInstalled: "+a.isFrameworkInstalled+", isWebServicePresent: "+ a.isWebServicePresent+", errorDetails: "+a.errorDetails);try{b=ff(a),Xd=a.isWebServicePresent?2:1}catch(l){O("onEnvironmentChecked > exception e : "+(l.description||l.message||l));if(!h)throw l;b=gf(l);O("onEnvironmentChecked > fall back to createFaultyFramework")}finally{d=!1}g&&g(e)},h),O("_createFramework > return _framework : "+b+(h?" (async)":" (sync)")),b):new a(g,h)}var b,d=!1,e=null;return a}();w("dymo.label.framework.init",function(a){P(a,!0)});function jf(a,b,d,e,g){this.printerType=a;this.name=b;this.modelName=d;this.isConnected=e;this.isLocal=g;this.c=this.C=""}function kf(a,b,d,e,g){jf.call(this,"LabelWriterPrinter",a,b,d,e);this.isTwinTurbo=g}x(kf,jf);function lf(a,b,d,e,g){jf.call(this,"TapePrinter",a,b,d,e);this.isAutoCutSupported=g}x(lf,jf);function mf(a,b,d,e,g){jf.call(this,"DZPrinter",a,b,d,e);this.isAutoCutSupported=g}x(mf,jf);function Z(a,b){this.c=a;this.f=b}Z.prototype.h=function(){return this.c.name};Z.prototype.getPrinterName=Z.prototype.h;Z.prototype.i=function(){return this.f};Z.prototype.getJobId=Z.prototype.i;Z.prototype.w=function(a){if(""!=this.c.C)nf(this,a);else{var b;try{b=P().getJobStatus(this.c.name,this.f)}catch(d){b=new Xe(this.h(),this.f,Q.ea,d.message||d)}a(b)}};Z.prototype.getStatus=Z.prototype.w; function nf(a,b){var d=a.h(),e=a.f,g=a.c.C;(new Pe(Gd(g,"getPrintJobStatus"),"callback")).send({jobId:e,printerName:a.c.c},function(a){b(new Xe(d,e,a.status,a.statusMessage))},function(){b(new Xe(d,e,Q.ea,'Error processing getPrintJobStatus(): Unable to contact "'+g+'"'))})};w("dymo.label.framework.VERSION","3.0.0"); function hf(a,b){function d(){O("checkLegacyPlugins");g.isWebServicePresent=!1;var b=window.navigator.platform;if(-1!=b.indexOf("Win"))if(O("checkLegacyPlugins > WIN platform "),"ActiveXObject"in window){O("checkLegacyPlugins > ActiveXObject");g.isBrowserSupported=!0;try{"object"!=typeof new ActiveXObject("DYMOLabelFrameworkIEPlugin.Plugin")?g.errorDetails="Unable to create DYMO.Label.Framework ActiveX object. Check that DYMO.Label.Framework is installed":g.isFrameworkInstalled=!0}catch(d){g.errorDetails= "Unable to create DYMO.Label.Framework ActiveX object. Check that DYMO.Label.Framework is installed. Exception details: "+d}}else O("checkLegacyPlugins > non-IE"),g.isBrowserSupported=!0,Ze("application/x-dymolabel")?(O("checkLegacyPlugins > 'application/x-dymolabel'"),g.isFrameworkInstalled=!0):g.errorDetails="DYMO Label Framework Plugin is not installed";else-1!=b.indexOf("Mac")?(O("checkLegacyPlugins > Mac platform"),g.isBrowserSupported=!0,Ze("application/x-dymolabel")?(O("checkLegacyPlugins > safariPluginFound"), b=$e(),"2.0"<=b.GetAPIVersion()?g.isFrameworkInstalled=!0:g.errorDetails="DYMO Label Safari Plugin is installed but outdated. Install the latest version."):Ze("application/x-npapi-dymolabel")?(O("checkLegacyPlugins > 'application/x-npapi-dymolabel'"),(b=df())&&b.getPrinters?g.isFrameworkInstalled=!0:g.errorDetails='DYMO NSAPI plugin is loaded but no callable functions found. If running Safari, then run it in 64-bit mode (MacOS X >= 10.7) or set "Open using Rosetta" option'):g.errorDetails="DYMO Label Plugin is not installed."): g.errorDetails="The operating system is not supported.";a&&a(g)}function e(){g.isBrowserSupported=!0;g.isFrameworkInstalled=!0;g.isWebServicePresent=!0;a&&a(g)}var g={isBrowserSupported:!1,isFrameworkInstalled:!1,isWebServicePresent:!1,errorDetails:""};if(Xd)return O("checkEnvironment > return existing instance of framework"),2==Xd?e():(g.isBrowserSupported=!0,g.isFrameworkInstalled=!0,g.isWebServicePresent=!1,a&&a(g)),g;b?Ud(e,d):Wd(e,d);return g}w("dymo.label.framework.checkEnvironment",hf); var of={};function pf(a,b,d){this.c=a;this.f=b;this.h=d}pf.prototype.getPrinters=function(){var a=qf(this.h),b=new N(this.c),d=this.f;""==d&&(d=b.c);for(b=0;b=l.length?a=-1:e=l.substr(d,4E3);(new Pe(k,"c")).send({j:h,cid:a,pl:e},function(d){var e=d.status,k=new Hc("dymo.label.framework");k.c=Lc;0==e?-1!=a?g(++a,0):k.log(Lc,"Finished sending job payload for "+h,void 0):-5==e?10>b?g(++d.lastAckChunkId,++b):k.log(Kc,'Unable to send print job data for "'+h+'": STATUS_INVALID_CHUNK_ID: Max retry count reached',void 0):10>b?g(a,++b):k.log(Kc,'Unable to send print job data for "'+h+'": Max retry count reached', void 0)},function(){var d=new Hc("dymo.label.framework");d.c=Lc;10>b?g(a,++b):d.log(Kc,'Unable to send print job data for "'+h+'": error: Max retry count reached',void 0)})}var h=We();b={printerName:a.c,labelXml:d,printParamsXml:b,labelSetXml:e};var k=Gd(a.C,"pl"),l=sc(b);g(0,0);return new Z(a,h)}function qe(a,b,d,e,g,h){function k(a){if(g(l,a)){var b=new Ue(function(){l.w(k);Pb(b)},h);Ve(b)}}var l=oe(a,b,d,e);l.w(k);return l}w("dymo.label.framework.printLabelAndPollStatus",qe); function re(a,b,d,e,g,h){return pe(a,b,d,e).then(function(a){function b(d){if(g(a,d)){var e=new Ue(function(){a.w(b);Pb(e)},h);Ve(e)}}a.w(b);return a})}w("dymo.label.framework.printLabelAndPollStatusAsync",re);function ke(a,b,d){if("undefined"==typeof a)throw Error("renderLabel(): labelXml parameter should be specified");"string"!=typeof a&&(a=a.toString());b=b||"";d=d||"";return P().renderLabel(a,b,d)}w("dymo.label.framework.renderLabel",ke); function le(a,b,d){if("undefined"==typeof a)throw Error("renderLabelAsync(): labelXml parameter should be specified");"string"!=typeof a&&(a=a.toString());b=b||"";d=d||"";return P().Y(a,b,d)}w("dymo.label.framework.renderLabelAsync",le);w("dymo.label.framework.loadImageAsPngBase64",function(a){return P().loadImageAsPngBase64(a)});w("dymo.label.framework.loadImageAsPngBase64Async",function(a){return P().U(a)}); w("dymo.label.framework.createLabelWriterPrintParamsXml",function(a){if(!a)return"";var b=R(""),d=b.documentElement;a.copies&&S(d,"Copies",a.copies.toString());a.jobTitle&&S(d,"JobTitle",a.jobTitle);a.flowDirection&&S(d,"FlowDirection",a.flowDirection);a.printQuality&&S(d,"PrintQuality",a.printQuality);a.twinTurboRoll&&S(d,"TwinTurboRoll",a.twinTurboRoll);return ie(b)}); w("dymo.label.framework.createTapePrintParamsXml",function(a){if(!a)return"";var b=R(""),d=b.documentElement;a.copies&&S(d,"Copies",a.copies.toString());a.jobTitle&&S(d,"JobTitle",a.jobTitle);a.flowDirection&&S(d,"FlowDirection",a.flowDirection);a.alignment&&S(d,"Alignment",a.alignment);a.cutMode&&S(d,"CutMode",a.cutMode);return ie(b)}); w("dymo.label.framework.createDZPrintParamsXml",function(a){if(!a)return"";var b=R(""),d=b.documentElement;a.copies&&S(d,"Copies",a.copies.toString());a.jobTitle&&S(d,"JobTitle",a.jobTitle);a.flowDirection&&S(d,"FlowDirection",a.flowDirection);a.alignment&&S(d,"Alignment",a.alignment);a.cutMode&&S(d,"CutMode",a.cutMode);return ie(b)}); w("dymo.label.framework.createLabelRenderParamsXml",function(a){function b(a,b){S(e,a,void 0,{Alpha:b.a||b.alpha||255,Red:b.r||b.red||0,Green:b.g||b.green||0,Blue:b.b||b.blue||0})}if(!a)return"";var d=R(""),e=d.documentElement;a.labelColor&&b("LabelColor",a.labelColor);a.shadowColor&&b("ShadowColor",a.shadowColor);"undefined"!=typeof a.shadowDepth&&S(e,"ShadowDepth",a.shadowDepth.toString());a.flowDirection&&S(e,"FlowDirection",a.flowDirection);"undefined"!=typeof a.pngUseDisplayResolution&& S(e,"PngUseDisplayResolution",a.pngUseDisplayResolution?"True":"False");return ie(d)});})();