/*
 Eloquence WEBDLG v2
 (C) Copyright Marxmeier Software AG, 2020-2025
 Version: 2.1.3
 $Id: 00-base.js,v 29.23 2025/07/28 09:26:00 rhg Exp $
 $Id: 05-const.js,v 29.10 2025/07/03 14:15:50 rhg Exp $
 $Id: 05-util.js,v 29.5 2024/05/23 09:46:00 rhg Exp $
 $Id: 05-window.js,v 29.5 2025/03/13 14:28:36 rhg Exp $
 $Id: 10-dlg.js,v 29.16 2025/07/03 14:14:54 rhg Exp $
 $Id: 10-login.js,v 29.3 2025/01/28 12:14:51 rhg Exp $
 $Id: 10-message.js,v 29.1 2023/06/07 08:47:34 rhg Exp $
 $Id: 10-popup.js,v 29.1 2023/06/07 08:47:34 rhg Exp $
 $Id: 10-strings.js,v 29.2 2025/07/03 14:14:54 rhg Exp $
 $Id: 20-pointer.js,v 29.6 2025/07/07 11:26:27 rhg Exp $
 $Id: 20-checkbox.js,v 29.2 2024/07/11 14:11:34 rhg Exp $
 $Id: 20-combobox.js,v 29.9 2025/07/03 14:14:54 rhg Exp $
 $Id: 20-dialog.js,v 29.2 2024/07/11 14:11:34 rhg Exp $
 $Id: 20-edittext.js,v 29.5 2025/07/03 14:14:54 rhg Exp $
 $Id: 20-groupbox.js,v 29.3 2025/01/29 10:32:24 rhg Exp $
 $Id: 20-htmlview.js,v 29.4 2024/07/11 14:11:34 rhg Exp $
 $Id: 20-listbox.js,v 29.12 2025/07/11 11:49:39 rhg Exp $
 $Id: 20-menuitem.js,v 29.2 2024/07/11 14:11:34 rhg Exp $
 $Id: 20-menu.js,v 29.6 2025/07/07 12:16:35 rhg Exp $
 $Id: 20-plugin.js,v 29.7 2025/01/28 12:13:35 rhg Exp $
 $Id: 20-poptext.js,v 29.8 2025/07/11 11:50:29 rhg Exp $
 $Id: 20-progressbar.js,v 29.2 2024/07/11 14:11:34 rhg Exp $
 $Id: 20-pushbutton.js,v 29.3 2024/07/11 14:11:34 rhg Exp $
 $Id: 20-radiobutton.js,v 29.2 2024/07/11 14:11:34 rhg Exp $
 $Id: 20-splitter.js,v 29.3 2024/07/11 14:11:34 rhg Exp $
 $Id: 20-statictext.js,v 29.2 2024/07/11 14:11:34 rhg Exp $
 $Id: 20-statusbar.js,v 29.2 2024/07/11 14:11:34 rhg Exp $
 $Id: 20-tabbox.js,v 29.3 2025/07/03 14:13:15 rhg Exp $
 $Id: 20-toolbar.js,v 29.2 2024/07/11 14:11:34 rhg Exp $
 $Id: 20-tree.js,v 29.4 2024/07/11 14:10:32 rhg Exp $
 $Id: 20-windowmenu.js,v 29.2 2024/07/11 14:12:26 rhg Exp $
 $Id: 99-main.js,v 29.19 2025/07/28 09:22:37 rhg Exp $
*/
var eq=eq||{};eq.c=eq.c||{};eq.p=eq.p||{};eq.p.version=20103;eq.c.Obj=function(){};(eq.c.Obj.setClassName=function(a,b){var c=Object.getOwnPropertyDescriptor(b.prototype.constructor,"name");void 0!==c?c.value=a:c={value:a,configurable:!0,enumerable:!1,writable:!1};Object.defineProperty(b.prototype.constructor,"name",c)})("Obj",eq.c.Obj);
eq.c.Obj.subClass=function(a,b){var c=this;b.prototype=Object.create(c.prototype);Object.defineProperty(b.prototype,"constructor",{value:b,configurable:!1,enumerable:!1,writable:!0});eq.c.Obj.setClassName(a,b);b.subClass=function(d,e){return c.subClass.call(this,d,e)};return eq.c[a]=b};
eq.MainOp={apiThreadStarted:1,ssnNewOrResume:2,inject:3,message:4,login:5,applicationStopped:6,applicationFailed:7,popupPos:8,warnLeavingPage:9,windowFeature:10,windowFeatures:11,grid:12,layout:13,notifyBusy:14,typeAhead:15,cancelCurrentCall:16,update:17,updated:18,synced:19,openUrl:20,beep:21,playSound:22,startApp:23,activate:24,clipboard:25,resume:26,addControl:27,modifyControl:28,deleteControl:29,invalidate:30,onMouseButton2:31,onClipboardMenu:32,dlg_DRAW:33,dlg_DO:34,dlg_POPUP_BOX:35};
eq.ApiOp={documentComplete:1,installPlugins:2,injectDone:3,openWebSocket:4,closeWebSocket:5,onLoginEvent:6,onEvent:7,onPopupEvent:8,onSynced:9,onDo:10,onHelp:11,onMouseButton2:12,invalidate:13,update:14,updated:15,canceled:16,grid:17,logError:18};eq.UpdateTag={changed:1,dialogDo:2,mouseButton2:3,ctxMenuOpen:4,ctxMenuAct:5,tabOrder:6,colResized:7,colMoved:8,sortSequence:9,lineOrder:10,plgUpdate:11,plgGetVal:12,screenSize:13,clipboard:14};
eq.RqTag={child:1,cssid:2,cssclsDel:3,cssclsAdd:4,font:5,raster:6,posSize:7,size:8,border:9,rule:10,ruleMode:11,tabOnEnter:12,visible:13,sensitive:14,inactive:15,tabStop:16,bgColor:17,fgColor:18,focusColor:19,btnMask:20,contextMenu:21,clipboardMenu:22,url:23,help:24,toolTip:25,dndMode:27,dropRule:28,globalDropRule:29,dialogState:30,dialogPosSize:31,logoIcon:32,fKey:33,dialogTimer:34,ruleButton2:35,dialogDo:36,margin:37,bgImage:38,vx:39,vy:40,vWidth:41,vHeight:42,accel:43,text:45,textPos:46,align:47,
active:48,radioGroup:49,icon:50,iconActive:51,type:52,itemId:53,objId:54,scrollable:55,multiline:56,readonly:57,wrapmode:58,maxchars:59,content:60,ispassword:61,fitfont:62,autocomplete:63,autotab:64,vcRule:65,columns:66,colOrder:67,colState:68,colTitle:69,lineOrder:70,activeLine:71,vActiveLine:72,topItem:73,rowHeight:74,status:75,bgColor2:76,fgColor2:77,gridColor:78,colToolTip:79,lineToolTip:80,emptyNode:81,separator:82,tabs:83,selectedTab:84,panes:85,vertical:86,position:87,quickExpand:88,value:89,
items:94,boxSize:95,open:96,scaling:97,plgInt:98,plgString:99,plgBinary:100,popupPos:101,baseUrl:102,helpBaseUrl:103,windowFeature:104,layout:105,notifyBusy:106,typeAhead:107,openUrl:108,openHelpUrl:109,startApp:110,activate:111,beep:112,soundUrl:113,clipboard:114};
eq.RsValType={idFocus:1,ruleOnce:2,textValue:3,buttonChecked:4,caretPos:5,activeLine:6,activeLineCol:7,topItem:8,selectedTab:9,splitterPos:10,scrollPos:11,status:12,colOrder:13,colWidth:14,lineOrder:15,emptyNode:16,ruleKey:17,mouseBtns:18,mouseCnt:19,mouseMods:20,dialogMax:21,dialogPos:22,dialogSize:23,screenSize:24,dragFrom:25,dragContent:26,dropContent:27,dropAction:28,dropPos:29,dropColumn:30,dropLine:31,dropElement:32,plgVoid:33,plgInt:34,plgString:35,plgBinary:36};
eq.PopupPos={top:1,left:2,login:4,message:8,box:16};eq.DlgCall={set:6};eq.DlgValType={tInt:1,tString:2};eq.LayoutMode={inline:1,maximized:2,dialog:4};eq.DialogMode={none:0,layout:1,scale:2,inline:3,modeMask:3,stateShift:2};eq.DialogState={maximized:1};eq.DialogRaster={pos:1,size:2};eq.Margin={top:1,right:2,bottom:4,left:8};eq.BgFill={tile:0,topLeft:1,center:2,scale:3};eq.FontStyle={bold:1,italic:2};eq.TextPos={right:1,left:2,bottom:3,top:4};
eq.ColState={alignMask:3,visible:4,raster:8,movable:16,sizable:32,sortable:64,userHide:128};eq.ColType={colAlphaNofold:0,colNumeric:1,colBoolean:2,colBarGraph:3,colAlphaFold:5,colDate:6};eq.MenuType={item:0,sep:1,radio:2,check:3};eq.TabState={visible:1,sensitive:2};eq.RuleType={bgColor:1,bgColor2:2,bgImage:3,childFont:4,fgColor:5,fgColor2:6,focusColor:7,font:8,gridColor:9,height:10,width:11};eq.atrGET=1;eq.atrSET=2;eq.atrIDX=4;eq.atrINT=8;eq.atrSTR=16;eq.atrBIN=32;eq.atrPRI=64;eq.atrNOC=128;
eq.atrLST=256;eq.atrSYN=512;eq.PluginFlags={focusable:4,tabOnEnter:8};eq.KeyMod={shift:1,ctrl:2,alt:4,meta:8};eq.Dnd={local:1,global:2,move:4,copy:8,link:16,all:28,dropExact:32};eq.Dom={};eq.Dom.viewRect=function(){return{x:window.pageXOffset,y:window.pageYOffset,w:document.documentElement.clientWidth,h:document.documentElement.clientHeight}};
eq.Dom.scrollIntoView=function(a,b){for(var c=b,d,e,f,g,h,l,k,n,m,p,q,r;(d=c.parentNode)&&d!==document;){if(e=d.classList){if(e.contains("eq-dialog"))break;e.contains("eq-pane")&&f&&f.contains("eq-view")&&(c=d.getBoundingClientRect(),void 0===g&&(g=b.getBoundingClientRect()),f=!1,(k=g.top)<(n=c.top)?(void 0===h&&(h=2*a.grid.hr),d.scrollTop=Math.floor(d.scrollTop-n+k-h),f=!0):(m=g.bottom)>(p=c.bottom)&&(void 0===h&&(h=2*a.grid.hr),m=m-p+h,k-m>=n&&(d.scrollTop=Math.ceil(d.scrollTop+m),f=!0)),(k=g.left)<
(n=c.left)?(void 0===l&&(l=2*a.grid.wr),d.scrollLeft=Math.floor(d.scrollLeft-n+k-l),f=!0):(m=g.right)>(p=c.right)&&(void 0===l&&(l=2*a.grid.wr),m=m-p+l,k-m>=n&&(d.scrollLeft=Math.ceil(d.scrollLeft+m),f=!0)),f&&(g=void 0))}c=d;f=e}void 0===g&&(g=b.getBoundingClientRect());f=!1;0>(k=g.top)?(void 0===h&&(h=2*a.grid.hr),r=Math.floor(window.pageYOffset+k-h),f=!0):(m=g.bottom)>(p=document.documentElement.clientHeight)&&(void 0===h&&(h=2*a.grid.hr),m=m-p+h,0<=k-m&&(r=Math.ceil(window.pageYOffset+m),f=!0));
0>(k=g.left)?(void 0===l&&(l=2*a.grid.wr),q=Math.floor(window.pageXOffset+k-l),f=!0):(m=g.right)>(p=document.documentElement.clientWidth)&&(void 0===l&&(l=2*a.grid.wr),m=m-p+l,0<=k-m&&(q=Math.ceil(window.pageXOffset+m),f=!0));f&&window.scrollTo(void 0!==q?q:window.pageXOffset,void 0!==r?r:window.pageYOffset)};
eq.Dom.setContent=function(a,b,c,d){var e=this.reIsHtml.exec(b);if(e){if(a.textContent="",this.setHtmlContent(e[1],a),c){a=a.getElementsByTagName("U");c=this.reCharOrDigit;var f=0;for(b=a.length;f<b;f++){e=a[f];var g=e.childNodes,h,l;if(1===g.length&&(h=g[0]).nodeType===Node.TEXT_NODE&&c.test(l=h.nodeValue)){if(d){e.parentNode.replaceChild(document.createTextNode(l),e);break}return l}}}}else{if(c)for(h=this.reAccel,c=this.reCharOrDigit;e=h.exec(b);)if(void 0!==(l=e[1])&&c.test(l)){if(d)return l=((f=
e.index)?b.substring(0,f):"")+l,b.length>(f+=2)&&(l+=b.substring(f)),a.textContent=l,h.lastIndex=0,null;a.textContent="";(f=e.index)&&a.appendChild(document.createTextNode(b.substring(0,f)));(e=document.createElement("U")).textContent=l;a.appendChild(e);b.length>(f+=2)&&a.appendChild(document.createTextNode(b.substring(f)));h.lastIndex=0;return l}a.textContent=b}return null};eq.Dom.setTextContent=function(a,b){this.reIsHtml.exec(b)?a.textContent=b.replace(this.reUnHtml,""):a.textContent=b};
eq.Dom.setHtmlContent=function(a,b,c){a=this.ParseHtml.parseFromString(a,"text/html");var d,e;if(c&&(d=a.head))for(;e=d.firstChild;)c.appendChild(e);if(b&&(d=a.body)){if("BODY"===b.tagName)for(a=(c=d.getAttributeNames()).length,e=0;e<a;e++){var f=c[e];b.setAttribute(f,d.getAttribute(f))}for(;e=d.firstChild;)b.appendChild(e)}};eq.Dom.isHtmlContent=function(a){return this.reIsHtml.test(a)};eq.Dom.ParseHtml=new DOMParser;eq.Dom.reIsHtml=/^<html>(.*?)(<\/html>)?$/i;eq.Dom.reUnHtml=/<[^>]*>/g;
eq.Dom.reAccel=/&(.)?/g;eq.Dom.reCharOrDigit=/^[A-Z0-9]$/i;
eq.Dom.decodeAccelKey=function(a,b,c){if(0===a.length)return null;if(1===a.length)b&&!this.reCharOrDigit.test(a)&&(a=c.code,a=void 0!==a?a.replace(this.reAccelCode,""):String.fromCharCode(c.keyCode));else switch(a){case "Add":a="+";break;case "ArrowDown":a="Down";break;case "ArrowLeft":a="Left";break;case "ArrowRight":a="Right";break;case "ArrowUp":a="Up";break;case "Del":a="Delete";break;case "Divide":a="/";break;case "Esc":a="Escape";break;case "Multiply":a="*";break;case "Spacebar":a="Space";break;
case "Subtract":a="-";break;case "Unidentified":switch(c.code){case "NumpadDecimal":a=",";break;default:return null}}return a};eq.Dom.reAccelCode=/^(Digit|Key|Numpad)/;
eq.Dom.decodeAccelAttr=function(a,b){for(var c=a.split(" "),d=eq.KeyMod,e=0,f=0,g=c.length;f<g;f++)switch(a=c[f].toUpperCase()){case "SHIFT":e|=d.shift;break;case "CTRL":e|=d.ctrl;break;case "ALT":case "ALTGRAPH":e|=d.alt;break;case "META":e|=d.meta;break;default:a=a.replace(this.reAccelAttr,"");e===d.shift&&1===a.length&&(e=0);if(b){switch(a){case "ADD":c="+";break;case "BACKSPACE":c="\u232b";break;case "DELETE":c="\u2326";break;case "DIVIDE":c="/";break;case "DOWN":c="\u21e3";break;case "END":c=
"\u21f2";break;case "ENTER":c="\u23ce";break;case "ESCAPE":c="\u238b";break;case "HOME":c="\u21f1";break;case "LEFT":c="\u21e0";break;case "MULTIPLY":c="*";break;case "PAGEDOWN":c="\u21df";break;case "PAGEUP":c="\u21de";break;case "RIGHT":c="\u2192";break;case "SPACE":c="\u2423";break;case "SUBTRACT":c="-";break;case "TAB":c="\u21e5";break;case " ":case "UP":c="\u21e1";break;default:c=a}e?(f="",e&d.shift&&(f+="\u21e7"),e&d.ctrl&&(f+="\u2303"),e&d.alt&&(f+="\u2325"),e&d.meta&&(f+="\u2318"),b.tag=f+
c):b.tag=c}return e?String.fromCharCode(e+48)+a:a}return null};eq.Dom.reAccelAttr=/(^KP)|(^NUMPAD)|_/ig;eq.Dom.copyContent=function(a,b){a.textContent="";if(b)for(b=b.firstChild;b;)a.appendChild(b.cloneNode(!0)),b=b.nextSibling};eq.Dom.copyFont=function(a,b){b=window.getComputedStyle(b);a=a.style;a.fontFamily=b.fontFamily;a.fontSize=b.fontSize;a.fontStyle=b.fontStyle;a.fontWeight=b.fontWeight};
eq.Dom.copyColors=function(a,b){b=window.getComputedStyle(b);a=a.style;a.color=b.color;a.backgroundColor=b.backgroundColor};eq.Dom.setFont=function(a,b){a=a.style;var c=eq.FontStyle,d;if(d=b.fc){a.fontFamily=d;var e=!0}else a.fontFamily="";(d=b.sz)?(a.fontSize=d,e=!0):a.fontSize="";if((b=b.st)&c.italic){a.fontStyle="italic";var f=e=!0}b&c.bold&&(a.fontWeight="bold",f=e=!0);f||(a.fontStyle="");return e};
eq.Dom.adjustElementFontSize=function(a){var b=eq.app.fnSizeFactor;if(b&&1!==b){a=a.style;var c=a.fontSize,d;c&&(d=this.reFontSize.exec(c))&&(c=Number(d[1]),c===c&&(a.fontSize=Math.round(c*b*1E3)/1E3+d[2]))}};eq.Dom.reFontSize=/^([0-9.]+)(.+)$/;
eq.Dom.resolveWindowFeatures=function(a){for(var b=this.resolveWindowFeatures.re,c=window.screen,d="",e=0,f,g,h;f=b.exec(a);){switch(g=f[1]){case "left":case "screenX":case "width":case "innerWidth":h=c.availWidth*f[7]/100;break;case "top":case "screenY":case "height":case "innerHeight":h=c.availHeight*f[7]/100;break;default:continue}f[2]&&h<f[3]&&(h=f[3]);f[4]&&h>f[5]&&(h=f[5]);d+=a.substring(e,f.index)+g+"="+Math.round(h);e=f.index+f[0].length}return d+a.substring(e)};
eq.Dom.resolveWindowFeatures.re=/([a-z]+)=(([0-9]+)<)?(([0-9]+)>)?(([0-9]+)%)/ig;eq.Dom.updateQueryString=function(a,b,c){var d=this.updateQueryString.re.exec(a),e=d[2];e?(a=new RegExp("([?&])"+b+"=[^&#]*","i"),e.match(a)?void 0!==c?e=e.replace(a,"$1"+b+"="+c):(e=e.replace(a,""),e.length&&"&"===e.charAt(0)&&(e=e.replace("&","?"))):void 0!==c&&(e=e+"&"+b+"="+c)):void 0!==c&&(e="?"+b+"="+c);a=d[1];e&&(a+=e);d[3]&&(a+=d[3]);return a};eq.Dom.updateQueryString.re=/^([^?#]+)([?][^#]*)?(#.*)?$/;
eq.Dom.zIndex=function(a){a=window.getComputedStyle(a).zIndex;return+a===+a?+a:0};eq.Dom.zIndexMax=function(a){a=a.children;for(var b=0,c=a.length;0<=--c;){var d=window.getComputedStyle(a[c]).zIndex;+d===+d&&+d>b&&(b=+d)}return b};eq.Dom.eqControl=function(a){for(var b;a&&a!==document;){if((b=a.classList)&&b.contains("eq-control"))return a;a=a.parentNode}return null};eq.Dom.eqDialog=function(a){for(var b;a&&a!==document;){if((b=a.classList)&&b.contains("eq-dialog"))return a;a=a.parentNode}return null};
eq.Dom.eqOverlay=function(a){for(var b;a&&a!==document;){if((b=a.classList)&&b.contains("eq-overlay"))return a;a=a.parentNode}return null};eq.Dom.isRootChild=function(a){for(var b;a&&a!==document;){if((b=a.classList)&&b.contains("eq-root"))return!0;a=a.parentNode}return!1};eq.Dom.isMenu=function(a){for(var b;a&&a!==document;){if(b=a.classList)if(b.contains("eq-menubar")||b.contains("eq-menu"))return!0;a=a.parentNode}return!1};
eq.Dom.closeMenu=function(){var a=eq.app,b=a.menuOpen;if(b){if((b=document.getElementById(b))&&b.classList.contains("eq-open")){b.classList.remove("eq-open");b=b.getElementsByClassName("eq-open");for(var c=b.length;0<=--c;)b[c].classList.remove("eq-open")}a.menuOpen=void 0;a.constructor.ttClose()}};eq.Dom.parentIndex=function(a){for(var b=0;a=a.previousElementSibling;)b++;return b};eq.Dom.firstChildByTagName=function(a,b){for(a=a.firstElementChild;a&&a.tagName!==b;)a=a.nextElementSibling;return a};
eq.Dom.inputElement=function(a){var b=a.getElementsByTagName("INPUT");if(1!==b.length)throw Error("BUG: InputElement id:"+a.id+" elements:"+b.length+", expected: 1");return b[0]};eq.Dom.consumeEvent=function(a){a.preventDefault();a.stopImmediatePropagation()};eq.Dom.fireEvent=function(a,b){var c=document.createEvent("Event");c.initEvent(b,!0,!0);a.dispatchEvent(c)};eq.Dom.fireMouseEvent=function(a,b,c){var d=document.createEvent("MouseEvent");d.initEvent(b,!0,!0);void 0!==c&&(d.eq=c);a.dispatchEvent(d)};
eq.Dom.fireClick=function(a,b){this.fireMouseEvent(a,"mousedown",b);this.fireMouseEvent(a,"mouseup",b);this.fireMouseEvent(a,"click",b)};eq.Dom.isEnterOrSpace=function(a){switch(a){case "Enter":return 10;case " ":case "Spacebar":return 32}return 0};eq.Dom.onNextCycle=function(a,b){var c=this.onNextCycle,d=c.queue;d.push({cb:a,arg:b});1===d.length&&window.setTimeout(c.exec)};eq.Dom.onNextCycle.queue=[];
eq.Dom.onNextCycle.exec=function(){for(var a=eq.Dom.onNextCycle,b=a.queue,c=0,d=b.length;c<d;c++){var e=b[c],f=e.arg;void 0!==f?e.cb(f):e.cb()}d&&b.splice(0,d);b.length&&window.setTimeout(a.exec)};eq.Dom.cancelNextCycle=function(a){for(var b=this.onNextCycle.queue,c=b.length;0<=--c;)if(b[c].cb===a){b.splice(c,1);break}};
eq.Dom.onNextFrame=function(a,b){var c=this.onNextFrame,d=c.queue[c.queue_i],e=d.get(a);if(void 0===e)d.set(a,[b]),1===d.size&&window.requestAnimationFrame(c.exec);else{a=b.cb;c=0;for(d=e.length;c<d;c++)if(e[c].cb===a){e[c]=b;return}e.push(b)}};eq.Dom.onNextFrame.queue=[new Map,new Map];eq.Dom.onNextFrame.queue_i=0;eq.Dom.onNextFrame.exec=function(){var a=eq.Dom.onNextFrame,b=a.queue[a.queue_i];++a.queue_i===a.queue.length&&(a.queue_i=0);b.forEach(a.commit);b.clear()};
eq.Dom.onNextFrame.commit=function(a,b){for(var c=0,d=a.length;c<d;c++){var e=a[c];e.cb(b,e)}};eq.c.Obj.subClass("Timers",function(){eq.c.Obj.call(this);this.m=new Map});eq.c.Timers.prototype.dispose=function(){this.m.forEach(eq.c.Timers.cbDispose);this.m.clear()};eq.c.Timers.cbDispose=function(a){window.clearTimeout(a.id)};eq.c.Timers.prototype.add=function(a,b,c,d){b={elapsed:b,canceled:c,arg:d};b.id=window.setTimeout(eq.c.Timers.cbElapsed,a,this,b);this.m.set(b.id,b);return b.id};
eq.c.Timers.prototype.cancel=function(a){var b=this.m.get(a),c;b&&(window.clearTimeout(a),this.m.delete(a),(c=b.canceled)&&c(b.arg))};eq.c.Timers.prototype.cancelAll=function(){this.m.forEach(eq.c.Timers.cbCancel);this.m.clear()};eq.c.Timers.cbCancel=function(a){window.clearTimeout(a.id);var b=a.canceled;b&&b(a.arg)};eq.c.Timers.cbElapsed=function(a,b){a.m.delete(b.id);(a=b.elapsed)&&a(b.arg)};
eq.c.Obj.subClass("Window",function(a,b,c){eq.c.Obj.call(this);var d=a.classList;if(!d.contains("eq-window")&&!d.contains("eq-dialog"))throw Error("BUG: Invalid window root");c&&d.add("eq-d"+c.id);var e=eq.app,f,g;d=a.style;void 0===(f=e.wl)?e.wl=[]:0===f.length&&(f=void 0);b||(b=document.body);if(void 0===f)f=e.wl,d.zIndex=eq.Dom.zIndex(b)+1;else{var h=0;for(g=f.length;;){if(void 0===(e=f[h].root))throw Error("BUG: Window root undefined");if(++h===g){e.classList.remove("eq-active");d.zIndex=eq.Dom.zIndex(e)+
1;break}}}this.root=a;this.dlg=c;this.modified={};f.push(this);d.visibility="hidden";b.appendChild(a)});
eq.c.Window.prototype.close=function(){var a,b,c,d,e;if(void 0===(a=this.root))throw Error("BUG: Window root undefined");if(void 0===(b=eq.app.wl))throw Error("BUG: Window list undefined");for(c=b.length;0<=--c;)if(b[c]===this){b.splice(c,1);var f=eq.Dom.zIndex(a);for(d=b.length;c<d;c++){if(void 0===(e=b[c].root))throw Error("BUG: Window root undefined");e.style.zIndex=f++}break}if(-1===c)throw Error("BUG: Window not in list");a.parentNode.removeChild(a);this.forcedInline=this.whenVisible=this.pos=
this.modified=this.dlg=this.root=void 0;return(d=b.length)?b[d-1]:null};
eq.c.Window.setupFrame=function(a){var b=document.createElement("DIV"),c=document.createElement("DIV"),d=document.createElement("DIV"),e=document.createElement("DIV"),f=document.createElement("DIV"),g=document.createElement("DIV"),h=document.createElement("DIV");b.className="eq-window";c.className="eq-pane";d.className="eq-caption";e.className="eq-logo eq-move";d.appendChild(e);f.className="eq-title eq-move";f.appendChild(document.createTextNode("\u00a0"));f.appendChild(document.createElement("SPAN"));
d.appendChild(f);g.className="eq-max";d.appendChild(g);h.className="eq-close";d.appendChild(h);c.appendChild(d);c.appendChild(a);b.appendChild(c);for(a=0;8>a;a++){switch(a){case 0:var l="eq-top";break;case 1:l="eq-top eq-right";break;case 2:l="eq-right";break;case 3:l="eq-bottom eq-right";break;case 4:l="eq-bottom";break;case 5:l="eq-bottom eq-left";break;case 6:l="eq-left";break;case 7:l="eq-top eq-left"}c=document.createElement("DIV");c.className=l+" eq-resize";b.appendChild(c);b.onmousedown=eq.c.App.onGlobalMouseDownOrClick}return b};
eq.c.Window.prototype.setPos=function(a,b){if(-1===a||-1===b)eq.Dom.onNextFrame(this,{cb:eq.c.Window.setPos.center,x:a,y:b});else{var c;if(void 0===(c=this.root))throw Error("BUG: Window root undefined");eq.c.Window.setPos(this,c,a,b)}};eq.c.Window.setPos=function(a,b,c,d){b=b.style;b.left=+c===+c?0<c?c+"px":0:c;b.top=+d===+d?0<d?d+"px":0:d;eq.Dom.onNextFrame(a,{cb:eq.c.Window.setPos.makeVisible})};
eq.c.Window.setPos.center=function(a,b){var c=eq.c.Window,d,e,f,g,h;if(void 0===(d=a.root))c.setPos.makeVisible(a);else{var l=d.getBoundingClientRect();var k=b.x;b=b.y;if(void 0!==(e=eq.app.wl))for(f=e.length;0<=--f;)if(e[f]===a){if(0<f){if(void 0===(e=e[f-1].root))throw Error("BUG: Window root undefined");(g=d.offsetParent)!==document.body&&(h=g.getBoundingClientRect());g=e.getBoundingClientRect();if(0===g.width||0===g.height)break;-1===k&&(k=(g.width-l.width)/2+g.left,void 0!==h&&(k-=h.left));-1===
b&&(b=(g.height-l.height)/2+g.top,void 0!==h&&(b-=h.top));c.setPos(a,d,k,b);return}break}(g=d.offsetParent)===document.body?(h=eq.Dom.viewRect(),-1===k&&(k=(h.w-l.width)/2+h.x),-1===b&&(b=(h.h-l.height)/2+h.y)):(h=g.getBoundingClientRect(),-1===k&&(k=(h.width-l.width)/2),-1===b&&(b=(h.height-l.height)/2));c.setPos(a,d,k,b)}};
eq.c.Window.setPos.makeVisible=function(a){var b;void 0===(b=a.root)||a.makeBaseDialogInline()||(b.style.visibility="");void 0!==(b=a.whenVisible)&&(a.whenVisible=void 0,eq.Dom.onNextFrame(a,b))};eq.c.Window.prototype.setTitle=function(a){var b,c,d;if(void 0===(b=this.root))throw Error("BUG: Window root undefined");(c=this.forcedInline)?c.t=a:(d=b.querySelector(".eq-window>.eq-pane>.eq-caption>.eq-title>span"))&&eq.Dom.setTextContent(d,a)};
eq.c.Window.prototype.setIcon=function(a){var b,c;a=a?"url('"+a+"')":"";if(void 0===(b=this.root))throw Error("BUG: Window root undefined");if(c=this.forcedInline)c.ic=a;else if(b=b.querySelector(".eq-window>.eq-pane>.eq-caption>.eq-logo"))b.style.backgroundImage=a};
eq.c.Window.prototype.canClose=function(){var a,b,c;if(void 0===(a=this.root))throw Error("BUG: Window root undefined");return(b=this.forcedInline)?b.c:(c=a.querySelector(".eq-window>.eq-pane>.eq-caption>.eq-close"))?null!==c.offsetParent:!1};
eq.c.Window.prototype.activate=function(){var a,b,c,d,e;if(void 0===(a=this.root))throw Error("BUG: Window root undefined");if(void 0===(b=eq.app.wl))throw Error("BUG: Window list undefined");for(c=d=b.length;0<=--c;)if(b[c]===this){a.classList.add("eq-active");if(c!==d-1){b.splice(c,1);var f=eq.Dom.zIndex(a);for(d=b.length;c<d;){if(void 0===(e=b[c].root))throw Error("BUG: Window root undefined");e.style.zIndex=f++;++c===d&&e.classList.remove("eq-active")}a.style.zIndex=f;b.push(this);return!0}return!1}throw Error("BUG: Window not in list");
};
eq.c.Window.prototype.makeInline=function(a){var b,c,d;if(void 0===(b=this.root))throw Error("BUG: Window root undefined");if(b.classList.contains("eq-window")){if(!(c=b.querySelector(".eq-window>.eq-pane>.eq-dialog")))throw Error("BUG: no Dialog in Window");var e=b.classList;if(a){a=c.querySelector(".eq-dialog>.eq-pane>.eq-view");var f=b.querySelector(".eq-window>.eq-pane>.eq-caption>.eq-title>span");var g=b.querySelector(".eq-window>.eq-pane>.eq-caption>.eq-logo");this.forcedInline={x:b.offsetLeft,y:b.offsetTop,
w:a.offsetWidth,h:a.offsetHeight,t:f?f.textContent:void 0,l:g?g.style.backgroundImage:void 0,r:e.contains("eq-resize"),c:e.contains("eq-close"),m:e.contains("eq-max")}}(e=c.style).visibility="hidden";e.zIndex=eq.Dom.zIndex(b);(e=c.classList).add("eq-inline");(d=this.dlg)&&e.add("eq-d"+d.id);b.parentNode.replaceChild(c,b);return this.root=c}return null};
eq.c.Window.prototype.makeFramed=function(a){var b=eq.c.Window,c=this.forcedInline,d,e,f;if(void 0===(d=this.root))throw Error("BUG: Window root undefined");if(d.classList.contains("eq-dialog")&&(!a||void 0!==c)){var g=eq.Dom.zIndex(d);var h=b.setupFrame((b=d.parentNode).removeChild(d));(f=h.style).visibility="hidden";f.zIndex=g;d.style.zIndex="";(g=d.classList).remove("eq-inline");g.remove("eq-max");(e=this.dlg)&&g.remove("eq-d"+e.id);g=h.classList;e&&g.add("eq-d"+e.id);a&&(this.forcedInline=void 0,
a=d.querySelector(".eq-dialog>.eq-pane>.eq-view"),f.left=0<c.x?c.x+"px":0,f.top=0<c.y?c.y+"px":0,(f=a.style).width=0<c.w?c.w+"px":0,f.height=0<c.h?c.h+"px":0,c.t&&(a=h.querySelector(".eq-window>.eq-pane>.eq-caption>.eq-title>span"),a.textContent=c.t),c.l&&(a=h.querySelector(".eq-window>.eq-pane>.eq-caption>.eq-logo"),a.style.backgroundImage=c.l),c.r?g.add("eq-resize"):g.remove("eq-resize"),c.c?g.add("eq-close"):g.remove("eq-close"),c.m?g.add("eq-max"):g.remove("eq-max"));b.appendChild(h);return this.root=
h}return null};eq.c.Window.prototype.makeBaseDialogInline=function(){var a=eq.app,b,c;if(void 0!==(b=a.wl)&&1===b.length&&b[0]===this&&void 0!==(c=a.layoutMode)&&c&eq.LayoutMode.inline&&c&eq.LayoutMode.dialog){if(void 0===this.root)throw Error("BUG: Window root undefined");if(a=this.makeInline(!0))return c&eq.LayoutMode.maximized?a.classList.add("eq-max"):a.classList.remove("eq-max"),a.style.visibility="",!0}return!1};
eq.c.Window.zOrderModified=function(){var a=eq.app,b,c,d,e;if(void 0!==(b=a.wl)){void 0===(c=a.layoutMode)||c&eq.LayoutMode.inline&&c&eq.LayoutMode.dialog||(c=void 0);var f=!0;for(a=b.length;0<=--a;){var g=b[a];if(void 0===g.root)throw Error("BUG: Window root undefined");if(void 0!==c&&void 0!==g.dlg)if(0===a){if(d=g.makeInline(!0))c&eq.LayoutMode.maximized?d.classList.add("eq-max"):d.classList.remove("eq-max"),d.style.visibility=""}else if(d=g.makeFramed(!0))d.style.visibility="";if(void 0===(d=
g.root))throw Error("BUG: Window root undefined");g=d.classList;void 0===f?g.remove("eq-active"):(f=void 0,g.add("eq-active"));e?g.add("eq-hidden"):(g.remove("eq-hidden"),g.contains("eq-window")||(e=!0))}}};eq.c.Window.fromTarget=function(a){var b,c,d;if(void 0!==(b=eq.app.wl))for(;a&&a!==document;){if(c=a.classList){if(c.contains("eq-dialog")||c.contains("eq-popup-box"))break;if(c.contains("eq-window")){for(c=b.length;0<=--c;)if((d=b[c]).root===a)return d;break}}a=a.parentNode}return null};
eq.c.Window.moveMode={left:1,top:2,right:4,bottom:8,size:16};
eq.c.Window.prototype.onMouseDownOrClick=function(a){var b="mousedown"===a.type;if(b||"pointerdown"===a.type){var c=eq.c.Window,d=this.root,e=a.target,f=e.parentNode,g=e.classList,h;if(f&&g){var l=eq.app;var k=c.moveMode;if(g.contains("eq-resize")&&f===d)if(g.contains("eq-top")){var n=k.top+k.size;g.contains("eq-left")?n+=k.left:g.contains("eq-right")&&(n+=k.right)}else g.contains("eq-bottom")?(n=k.bottom,g.contains("eq-left")?n+=k.left+k.size:g.contains("eq-right")&&(n+=k.right)):g.contains("eq-left")?
n=k.left+k.size:g.contains("eq-right")&&(n=k.right);else{for(;f&&f!==d&&(!(h=f.classList)||!h.contains("eq-caption"));)g=h,e=f,f=e.parentNode;if(f&&(h=f.classList)&&h.contains("eq-caption")&&(f=f.parentNode)&&(h=f.classList)&&h.contains("eq-pane")&&(f=f.parentNode)&&f===d){if(g.contains("eq-close")){if(!b)return!1;g.add("eq-click");var m;void 0!==(m=this.dlg)?m===l.currDlg?l.submit(document.body,{type:"close"}):m.pendingClose=!0:this.close();return!0}if(g.contains("eq-max")){if(!b)return!1;(g=f.classList).contains("eq-max")?
(g.remove("eq-max"),l=this.pos,void 0!==l&&(this.pos=void 0,c.setPos(this,d,l.x,l.y))):(this.pos={x:d.offsetLeft,y:d.offsetTop},g.add("eq-max"));return this.modified.maximized=!0}g.contains("eq-move")&&(f.classList.contains("eq-max")||(n=k.left+k.top))}}if(void 0!==n)return a={w:this,x:a.clientX,y:a.clientY,mode:n},(f=d.offsetParent)===document.body?a.px=a.py=0:(d=f.getBoundingClientRect(),a.px=d.left,a.py=d.top),l.moveCapture(a,c.onMove),!0}}return!1};
eq.c.Window.onMove=function(a,b){b.busy||(b.busy=!0,eq.Dom.onNextFrame(b.w,{cb:eq.c.Window.onMove.exec,x:a.clientX,y:a.clientY,m:b}))};
eq.c.Window.onMove.exec=function(a,b){var c=eq.c.Window,d=c.moveMode,e=b.x,f=b.y;b=b.m;var g=b.mode,h=g&d.size,l=a.root;if(void 0===l)b.busy=void 0;else{var k=l.getBoundingClientRect();if(g&d.left&&e!==b.x&&(void 0===b.maxX||e<=b.maxX)){var n=k.left+window.pageXOffset-b.px,m=n+e-b.x;0>m&&(m=0,e=b.x-n);l.style.left=m?m+"px":0;a.modified.pos=!0;if(h){if(void 0===p){var p=l.querySelector(".eq-dialog>.eq-pane>.eq-view");p={rc:k,dv:p,drc:p.getBoundingClientRect()}}p.dv.style.width=n+p.drc.width-m+"px";
p.cx=e;p.cw=k.width}else b.x=e}g&d.top&&f!==b.y&&(void 0===b.maxY||f<=b.maxY)&&(n=k.top+window.pageYOffset-b.py,m=n+f-b.y,0>m&&(m=0,f=b.y-n),l.style.top=m?m+"px":0,a.modified.pos=!0,h?(void 0===p&&(p=l.querySelector(".eq-dialog>.eq-pane>.eq-view"),p={rc:k,dv:p,drc:p.getBoundingClientRect()}),p.dv.style.height=n+p.drc.height-m+"px",p.cy=f,p.cw=k.height):b.y=f);g&d.right&&e!==b.x&&(void 0===b.minX||e>=b.minX)&&(void 0===p&&(p=l.querySelector(".eq-dialog>.eq-pane>.eq-view"),p={rc:k,dv:p,drc:p.getBoundingClientRect()}),
p.dv.style.width=p.drc.width+e-b.x+"px",p.cx=e,p.cw=k.width);g&d.bottom&&f!==b.y&&(void 0===b.minY||f>=b.minY)&&(void 0===p&&(p=l.querySelector(".eq-dialog>.eq-pane>.eq-view"),p={rc:k,dv:p,drc:p.getBoundingClientRect()}),p.dv.style.height=p.drc.height+f-b.y+"px",p.cy=f,p.ch=k.height);if(void 0===p)b.busy=void 0;else eq.Dom.onNextFrame(a,{cb:c.onMove.chk,m:b,chk:p})}};
eq.c.Window.onMove.chk=function(a,b){var c=b.m,d=a.root,e=b.chk,f=d.getBoundingClientRect();if(void 0!==e.cw&&e.cw!==f.width||void 0!==e.ch&&e.ch!==f.height)void 0!==e.cw&&(e.cw=f.width),void 0!==e.ch&&(e.ch=f.height);else{if(e.done){c.busy=void 0;return}void 0!==e.cx&&(f.width!==e.rc.width?(c.x=e.cx,c.minX=c.maxX=void 0,a.modified.size=!0):(d.style.left=e.rc.left+window.pageXOffset-c.px+"px",e.dv.style.width=e.drc.width+"px",void 0===c.minX&&void 0===c.maxX&&(e.cx<c.x?(c.minX=c.x,c.maxX=void 0):
(c.maxX=c.x,c.minX=void 0))));void 0!==e.cy&&(f.height!==e.rc.height?(c.y=e.cy,c.minY=c.maxY=void 0,a.modified.size=!0):(d.style.top=e.rc.top+window.pageYOffset-c.py+"px",e.dv.style.height=e.drc.height+"px",void 0===c.minY&&void 0===c.maxY&&(e.cy<c.y?(c.minY=c.y,c.maxY=void 0):(c.maxY=c.y,c.minY=void 0))));e.done=!0}eq.Dom.onNextFrame(a,b)};eq.d=eq.d||new Map;eq.c.Obj.subClass("DlgElement",function(a,b){eq.c.Obj.call(this);this.toolTip=this.accel=this.tvNodes=this.cssRules=null;this.ddi=void 0});
eq.c.DlgElement.prototype.sensitive=!0;eq.c.DlgElement.addClass=function(a,b){var c=this;c.subClass(a,b);b.dlgSubClass=function(d,e){return c.dlgSubClass.call(this,d,e)};eq.d.set(a,[b]);return b};eq.c.DlgElement.dlgSubClass=function(a,b){var c=eq.d.get(this.name);if(!c)throw Error("DLG class '"+this.name+"' not registered");this.subClass(a,b);delete b.subClass;c.push(b);return b};
eq.c.DlgElement.prototype.dispose=function(a,b){var c=this.cssRules,d=c?c.length:0;if(d){var e=eq.app.stl,f=e.sheet,g=e.owner,h=g.length;e=0;var l,k;if(-1===(l=k=g.indexOf(b)))throw Error(this.constructor.name+".dispose("+b+") "+d+" stale CSS rules");do f.deleteRule(k),e++;while(++l<h&&g[l]===b);g.splice(k,e);c.length=0;this.cssRules=null;if(e!==d)throw Error(this.constructor.name+".dispose("+b+") CSS rules inconsistent:"+d+"/"+e);}if(c=this.tvNodes){f=eq.c.DlgElement;g=f.triggerVisible;h=g.wh;e=
0;for(d=c.length;e<d;e++)if(k=h.get(l=c[e]))k.forEach(f.disposeTvNodes,this),0===k.size&&(h.delete(l),0===h.size&&g.ob.disconnect());c.length=0;this.tvNodes=null}d=this.accel;null!==d&&(a=a.accel,a.get(d)===b&&a.delete(d),this.accel=null);this.toolTip=null;this.ddi=void 0};eq.c.DlgElement.disposeTvNodes=function(a,b,c){for(var d=0;d<a.length;)a[d].self===this?a.splice(d,1):d++;0===a.length&&c.delete(b)};
eq.c.DlgElement.prototype.updateId=function(a,b,c){var d=this.cssRules,e=d?d.length:0;if(e){var f=eq.c.DlgElement,g=eq.app.stl,h=g.sheet;g=g.owner;var l=g.length,k=0,n;if(-1===(n=g.indexOf(c)))throw Error(this.constructor.name+".updateId("+c+") "+e+" stale CSS rules");do h.deleteRule(n),f.insertCssRule(h,n,b,d[k++].rule),g[n]=b;while(++n<l&&g[n]===c);if(k!==e)throw Error(this.constructor.name+".updateId("+c+") CSS rules inconsistent:"+e+"/"+k);}else if(-1!==(e=eq.app.stl.owner.indexOf(c)))throw Error(this.constructor.name+
".updateId("+c+") CSS rules inconsistent:"+e);d=this.accel;null!==d&&(a=a.accel,a.get(d)===c&&a.set(d,b))};
eq.c.DlgElement.prototype.setAttr=function(a,b,c,d){for(var e=eq.RqTag,f=0,g=d.length;f<g;f++){var h=d[f],l=h.t;switch(l){case e.sensitive:l=!!(h.v&1);h=h.v>>1;var k,n,m,p,q;if(h)this.sensitive=l,this.parentDisabled=h,this.setSensitive(a,b,c,!1);else if(this.sensitive!==l&&(this.sensitive=l,this.parentDisabled||this.setSensitive(a,b,c,l),k=(h=c.querySelectorAll(".eq-control")).length))for(n=a.eds;0<=--k;){if(void 0===(m=n.get(q=(p=h[k]).id)))throw Error(this.constructor.name+".setAttr("+b+") sensitive BUG: child "+
q+" not registered");l?m.parentDisabled&&0>=--m.parentDisabled&&(m.parentDisabled=void 0,m.sensitive&&m.setSensitive(a,q,p,!0)):m.parentDisabled?m.parentDisabled++:(m.parentDisabled=1,m.sensitive&&m.setSensitive(a,q,p,!1))}break;case e.toolTip:(this.toolTip=h.v)?eq.app.ttAttach(c):(eq.app.ttDetach(c),this.toolTip=null);break;default:throw Error(this.constructor.name+".setAttr("+b+") failed: tag "+l);}}};eq.c.DlgElement.setAttr=function(a){a.t.setAttr(a.d,a.i,a.e,a.r)};
eq.c.DlgElement.setFont=function(a,b){eq.Dom.setFont(a,b)?a.classList.add("eq-font"):a.classList.remove("eq-font")};eq.c.DlgElement.prototype.setSensitive=function(a,b,c,d){a=c.classList;d?a.remove("eq-disabled"):a.add("eq-disabled")};
eq.c.DlgElement.prototype.setAccel=function(a,b,c,d){var e=this.accel;c=void 0===c||null===c?null:d?String.fromCharCode(d+48)+c.toUpperCase():c.toUpperCase();c!==e&&(a=a.accel,null!==e&&a.get(e)===b&&a.delete(e),null===c||a.has(c)?this.accel=null:a.set(this.accel=c,b))};eq.c.DlgElement.prototype.onEvent=function(a,b,c,d){return!0};eq.c.DlgElement.prototype.onKey=function(a,b,c,d,e,f){return!1};eq.c.DlgElement.prototype.onAccel=function(a,b,c){eq.Dom.fireClick(this.focusElement(a,c))};
eq.c.DlgElement.prototype.onTypeAhead=function(a,b,c,d){switch(d){case "ShiftTab":var e=-1;break;case "Tab":e=1;break;case "ShiftEnter":e=-1;case "Enter":d=c.classList;if(d.contains("eq-enter"))return!1;a.fkey&&0<a.fkey.length&&a.fkey[0]||void 0!==e||d.contains("eq-noenter")||(e=1)}if(e){d=eq.app;var f=a.nextTab(b,-1===e);f?(d.pendingTabMode=e,d.pendingTabModeId=a=f.id,d.setFocus(a,f)):d.processEvent(a,{type:"blur",target:this.focusElement(a,c)},b,c,this);return!0}return!1};
eq.c.DlgElement.prototype.onSubmit=function(a,b,c,d){};eq.c.DlgElement.prototype.onChange=function(a,b,c,d){return!0};eq.c.DlgElement.prototype.onToolTip=function(a){return this.toolTip};eq.c.DlgElement.prototype.onDragStart=function(a,b,c,d,e,f){return!1};eq.c.DlgElement.setDropModes=function(a,b){var c=eq.Dnd;a.dataTransfer.effectAllowed=b&c.move?b&c.copy?b&c.link?"all":"copyMove":b&c.link?"linkMove":"move":b&c.copy?b&c.link?"copyLink":"copy":b&c.link?"link ":"none"};
eq.c.DlgElement.prototype.onDragOver=function(a,b,c,d){return null};eq.c.DlgElement.prototype.onDrop=function(a,b,c,d,e){return 0};eq.c.DlgElement.prototype.focusElement=function(a,b){return b};eq.c.DlgElement.prototype.focusGained=function(a,b){};eq.c.DlgElement.prototype.focusLost=function(a,b){};eq.c.DlgElement.prototype.changed=function(a,b,c,d){return null};eq.c.DlgElement.prototype.onUpdate=function(a,b,c,d,e,f){throw Error("BUG: "+this.constructor.name+".onUpdate("+b+") not implemented");};
eq.c.DlgElement.onUpdate=function(a,b){var c=eq.UpdateTag;switch(b){case c.screenSize:return b=eq.app.scrnUpdate(!1),b.updated=!1,[b.w,b.h];case c.clipboard:if(window.isSecureContext&&navigator.clipboard)return navigator.clipboard.readText().then(function(d){eq.c.DlgElement.onUpdateReturn(a,[d])}).catch(function(d){eq.c.DlgElement.onUpdateReturn(a,[void 0]);console.warn("Clipboard.readText failed: "+d.message)}),null;console.warn("Clipboard: not available");return[void 0]}throw Error("DlgElement.onUpdate: tag "+
b+" not handled");};eq.c.DlgElement.prototype.onUpdateReturn=function(a,b,c){var d=this.ddi;if(!d)throw Error("BUG: "+this.constructor.name+".onUpdate("+b+") undefined context");this.ddi=void 0;eq.c.DlgElement.onUpdateReturn(d,c);a.temp&&eq.app.closeDialog(a)};eq.c.DlgElement.onUpdateReturn=function(a,b){a.o=eq.ApiOp.updated;a.d=b;eq.app.api.postMessage(a)};eq.c.DlgElement.prototype.onMessage=function(a,b,c,d){};
eq.c.DlgElement.prototype.updated=function(a,b,c,d,e){var f=eq.UpdateTag;switch(d){case f.mouseButton2:a=eq.app;a.onceRule=e.rule;a.onceId=b;a.submit(c,{id:b,type:"click"});break;case f.ctxMenuOpen:b=eq.Dom;c=e.y;var g,h,l;d=a.addControl(e.et);(f=d.style).left=e.x+window.pageXOffset+"px";f.top=c+window.pageYOffset+"px";f=eq.app.fnDefault;for(var k=a.root.length;0<=--k;)if((h=(g=a.root[k]).classList).contains("eq-dialog")){(l=g.firstElementChild).classList.contains("eq-menubar")?g=l:h.contains("eq-root-font")||
(g=null);g&&(b.copyFont(d,g),b.adjustElementFontSize(d),d.classList.add("eq-root-font"),f=null);break}f&&(b.setFont(d,f)?(b.adjustElementFontSize(d),d.classList.add("eq-root-font")):d.classList.add("eq-default-font"));a.eds.get(d.id).contextMenuId=e.id;b.onNextFrame(d,{cb:eq.c.DlgElement.showContextMenu,y:c});break;default:throw Error(this.constructor.name+".updated("+b+") invalid tag "+d);}};
eq.c.DlgElement.showContextMenu=function(a,b){eq.app.makeOverlay(a,a,eq.c.Menu.closeContextMenu);a.classList.contains("eq-scroll")&&(a.style.maxHeight=document.documentElement.clientHeight-b.y-2+"px")};
eq.c.DlgElement.prototype.setCssRule=function(a,b,c){var d=eq.c.DlgElement,e=this.cssRules,f=eq.app.stl,g=f.sheet;f=f.owner;var h=f.length,l,k,n,m;e||(e=this.cssRules=[]);var p=0;for(l=e.length;p<l;p++)if(b===(k=e[p]).type){if(-1!==(n=f.indexOf(a)))for(m=p;0<p--;)if(++n>=h||f[n]!==a){n=-1;break}if(-1===n)throw Error(this.constructor.name+".setCssRule("+a+") not found, type:"+b);g.deleteRule(n);c?(k.rule=c,d.insertCssRule(g,n,a,c)):(e.splice(m,1),f.splice(n,1),0===e.length&&(this.cssRules=null));return}if(-1!==
(n=f.indexOf(a))){for(p=1;++n<h&&f[n]===a;)p++;if(p!==l)throw Error(this.constructor.name+".setCssRule("+a+") inconsistent:"+l+"/"+p+", type:"+b);}else{if(l)throw Error(this.constructor.name+".setCssRule("+a+") inconsistent:"+l+", type:"+b);n=h}c&&(e.push({rule:c,type:b}),d.insertCssRule(g,n,a,c),f.splice(n,0,a))};eq.c.DlgElement.insertCssRule=function(a,b,c,d){if(Array.isArray(d)){var e="";for(var f=0,g=d.length;f<g;f++)e+="#"+c+d[f]}else e="#"+c+d;a.insertRule(e,b)};
eq.c.DlgElement.prototype.duplicateCssRules=function(a){var b=this.cssRules,c=b?b.length:null;if(c){var d=eq.c.DlgElement,e=eq.app.stl,f=e.sheet;e=e.owner;var g=e.length,h,l;for(h=1;-1!==e.indexOf(l=a+"-"+h);h++);for(h=0;h<c;h++,g++)d.insertCssRule(f,g,l,b[h].rule),e.push(l);return l}return""};
eq.c.DlgElement.prototype.whenVisible=function(a,b,c,d){if(null!==c.offsetParent)d.call(this,a,b,c);else{var e=eq.c.DlgElement,f=this.tvNodes,g,h,l;for(g=c;(h=g.parentNode)&&null===h.offsetParent;g=h);if(g){null===f?this.tvNodes=[g]:-1===f.indexOf(g)&&f.push(g);void 0===(f=(l=(h=e.triggerVisible).wh).get(g))&&(l.set(g,f=new Map),h.ob.observe(g,e.onTriggerVisibleMode));void 0===(e=f.get(b))&&f.set(b,e=[]);b=0;for(g=e.length;b<g;b++)if(e[b].cb===d)return;e.push({cb:d,self:this,dlg:a,el:c})}else console.error("DlgElement.whenVisible: No parent to watch for '"+
b+"'")}};eq.c.DlgElement.onTriggerVisibleMode={attributes:!0,attributeFilter:["class","style"]};eq.c.DlgElement.onTriggerVisible=function(a,b){b=eq.c.DlgElement;for(var c=b.triggerVisible,d=c.wh,e=0,f=a.length;e<f;e++){var g=a[e].target,h=d.get(g);h&&"none"!==window.getComputedStyle(g).display&&(h.forEach(b.onTriggerVisibleExec,g),h.clear(),d.delete(g),0===d.size&&c.ob.disconnect())}};
eq.c.DlgElement.onTriggerVisibleExec=function(a,b){for(var c=0,d=a.length;c<d;c++){var e=a[c],f=e.self,g=f.tvNodes;e.cb.call(f,e.dlg,b,e.el);g&&-1!==(c=g.indexOf(this))&&(g.splice(c,1),0===g.length&&(f.tvNodes=null))}a.length=0};eq.c.DlgElement.triggerVisible={ob:new MutationObserver(eq.c.DlgElement.onTriggerVisible),wh:new Map};eq.c.DlgElement.prototype.onClipboardMenu=function(a,b,c,d,e,f){return!1};
eq.c.DlgElement.onClipboardMenu=function(a,b,c,d,e,f){var g=f.split("|"),h=g.length,l;if(6!==h)return!1;f=eq.app;var k=eq.Dom;var n=c.readOnly;var m=c.selectionEnd>c.selectionStart;var p=!!navigator.clipboard;var q=eq.c.DlgElement.clipboardMenuOnClick;var r=document.createElement("UL");r.className="eq-menubar";r.dataset.clipboardId=b;for(b=0;b<h;b++)if(g[b]){switch(b){case 0:continue;case 1:if(n||!m||!p)continue;break;case 2:if(!m||!p)continue;break;case 3:if(n||!p)continue;break;case 4:if(n||!m)continue;
break;case 5:if(!c.value.length)continue;if(r.children.length){var t=document.createElement("LI");t.className="eq-item eq-sep";r.appendChild(t)}}t=document.createElement("LI");t.className="eq-item";t.dataset.clipboardAction=b;t.onclick=q;var u=document.createElement("LABEL");k.setContent(u,g[b],!0,!0);t.appendChild(u);r.appendChild(t)}if(!r.children.length)return!1;g=f.fnDefault;for(b=a.root.length;0<=--b;)if((n=(h=a.root[b]).classList).contains("eq-dialog")){(l=h.firstElementChild).classList.contains("eq-menubar")?
h=l:n.contains("eq-root-font")||(h=null);h&&(k.copyFont(r,h),k.adjustElementFontSize(r),r.classList.add("eq-root-font"),g=null);break}g&&(k.setFont(r,g)?(k.adjustElementFontSize(r),r.classList.add("eq-root-font")):r.classList.add("eq-default-font"));(a=r.style).left=d+window.pageXOffset+"px";a.top=e+window.pageYOffset+"px";f.makeOverlay(r,r,eq.c.DlgElement.closeClipboardMenu);f.overlay.ct=c;return!0};
eq.c.DlgElement.clipboardMenuOnClick=function(a){eq.Dom.consumeEvent(a);a=eq.app;var b=this.dataset.clipboardAction,c=a.overlay.ct;if("5"===b)c.select();else{var d=c.selectionStart,e=c.selectionEnd;if(e>d){var f=c.value;"1"!==b&&"2"!==b||navigator.clipboard.writeText(f.substring(d,e)).catch(function(g){console.warn("Clipboard.writeText failed: "+g.message)});"2"!==b&&(c.value=f.substring(0,d)+f.substring(e),c.selectionStart=c.selectionEnd=d)}"3"===b&&(c.focus(),navigator.clipboard.readText().then(function(g){var h=
c.value;d=c.selectionStart;c.value=h.substring(0,d)+g+h.substring(d);c.selectionStart=c.selectionEnd=d+g.length}).catch(function(g){console.warn("Clipboard.readText failed: "+g.message)}))}a.closeOverlay();c.focus()};eq.c.DlgElement.closeClipboardMenu=function(a){a.parentNode.removeChild(a)};eq.c.Obj.subClass("Dlg",function(a){eq.c.Obj.call(this);this.id=a;this.grid={};this.w=null;this.root=[];this.eds=new Map;this.tabOrder=null;this.accel=new Map});delete eq.c.Dlg.subClass;
eq.c.Dlg.prototype.close=function(){var a=this.constructor,b=eq.c.App;this.resetCurrDlg();b.ttClose();if(document.title===this.title){var c=b.title;c!==document.title&&(document.title=c,eq.app.updateSessionList())}for(c=this.root.length;0<=--c;){var d=this.root[c];b.removeRootListeners(d);if(d.classList.contains("eq-dialog")){if(null===this.w)throw Error("Dlg.close("+this.id+") BUG: no Window");this.w.close();this.w=null}else d.parentNode.removeChild(d)}this.root.length=0;if(null!==this.w)throw Error("Dlg.close("+
this.id+") BUG: Window not closed");this.accel.clear();this.eds.forEach(a.cbDisposeDlgElement,this);this.eds.clear();this.tabOrder=null;this.ddo=this.vcrule=this.timer=this.fkey=this.icon=this.title=this.layout=this.whenReadyArg=this.whenReady=this.pendingClose=void 0;this.temp&&(a=document.getElementById("eq-temp"))&&a.parentNode.removeChild(a)};eq.c.Dlg.cbDisposeDlgElement=function(a,b){a.dispose(this,b)};
eq.c.Dlg.prototype.resetCurrDlg=function(){var a=eq.app;if(this===a.currDlg)this.whenReady&&this.callWhenReady(),a.currDlg=null,a.focus=null,a.changed.clear(),a.setIdle(this);else if(this.whenReady&&this.ddo)throw Error("Dlg.resetCurrDlg BUG: whenReady pending");this.whenReadyArg=this.whenReady=this.ddo=void 0};eq.c.Dlg.prototype.callWhenReady=function(){var a=this.whenReady,b=this.whenReadyArg;this.whenReadyArg=this.whenReady=void 0;a(this,b)};
eq.c.Dlg.prototype.addRoot=function(a){var b=a.classList,c,d;a.style.display="none";b.add("eq-root");if(b.contains("eq-dialog")){if(null!==this.w)throw Error("Dlg.addRoot("+this.id+") BUG: Window exists");var e=eq.c.Window;var f=eq.LayoutMode;if(void 0!==(c=eq.app.layoutMode)&&c&f.inline&&!(c&f.dialog))var g=a;else c=void 0,g=void 0===(d=this.layout)||d.mode===eq.DialogMode.inline?a:e.setupFrame(a);this.w=new e(g,document.getElementById("eq-dialog"),this);void 0!==c&&(b.add("eq-inline"),c&f.maximized?
b.add("eq-max"):b.remove("eq-max"))}else throw Error("Dlg.addRoot("+this.id+") BUG: not a Dialog");this.root.push(a);eq.c.App.addRootListeners(a)};
eq.c.Dlg.prototype.removeElement=function(a){var b=this.root,c=this.eds,d,e,f;if(-1!==(d=b.indexOf(a))){b.splice(d,1);var g=0===b.length}if(!g){b=a.querySelectorAll("[id]");for(d=b.length;0<=--d;)void 0!==(f=c.get(e=b[d].id))&&(f.dispose(this,e),c.delete(e));void 0!==(f=c.get(e=a.id))&&(f.dispose(this,e),c.delete(e))}if(void 0===g)a.parentNode.removeChild(a);else if(eq.c.App.removeRootListeners(a),a.classList.contains("eq-dialog")){if(null===this.w)throw Error("Dlg.removeElement("+this.id+") BUG: no Window");
this.w.close();this.w=null}else a.parentNode.removeChild(a);return g};
eq.c.Dlg.prototype.visible=function(){for(var a=this.constructor,b=!0,c=this.root.length;0<=--c;){var d=this.root[c];if(d.classList.contains("eq-dialog")){if(null===this.w)throw Error("Dlg.visible("+this.id+") BUG: no Window");"none"===(b=d.style).display&&(b.visibility="hidden",b.display="");d!==this.w.root&&"none"===(b=this.w.root.style).display&&(b.visibility="hidden",b.display="");for(var e=d.querySelector(".eq-dialog>.eq-pane>.eq-view>.eq-container"),f=e.parentNode.parentNode,g=d.firstElementChild,
h="eq-top",l;g;){if((b=g.classList).contains("eq-panel")){if(b.contains("eq-hidden")||b.contains("eq-toolbar")&&!b.contains(h)){var k=g.nextElementSibling;e.appendChild(g);b.remove("eq-rt");b.remove("eq-panel");b.remove("eq-horz");g=k;continue}}else if(b.contains("eq-pane")){l=g.firstElementChild;for(h="eq-left";l;){if((b=l.classList).contains("eq-panel")){if(b.contains("eq-hidden")||b.contains("eq-toolbar")&&!b.contains(h)){k=l.nextElementSibling;e.appendChild(l);b.remove("eq-rt");b.remove("eq-panel");
b.remove("eq-vert");l=k;continue}}else b.contains("eq-view")&&(h="eq-right");l=l.nextElementSibling}h="eq-bottom"}g=g.nextElementSibling}(b=(g=d.firstElementChild).classList).contains("eq-idle")&&(b=(g=g.nextElementSibling).classList);!b.contains("eq-menubar")&&(l=e.querySelector(".eq-menubar:not(.eq-hidden)"))&&((b=l.classList).add("eq-rt"),b.add("eq-panel"),d.insertBefore(l,g));(b=(g=d.lastElementChild).classList).contains("eq-idle")&&(b=g.previousElementSibling.classList);!b.contains("eq-statusbar")&&
(l=e.querySelector(".eq-statusbar:not(.eq-hidden)"))&&((b=l.classList).add("eq-rt"),b.add("eq-panel"),d.appendChild(l));e=e.querySelectorAll(".eq-toolbar:not(.eq-hidden)");h=0;for(k=e.length;h<k;h++)(b=(g=e[h]).classList).contains("eq-top")?(b.add("eq-rt"),b.add("eq-panel"),b.add("eq-horz"),(l=d.firstElementChild).classList.contains("eq-idle")&&(l=l.nextElementSibling),l.classList.contains("eq-menubar")?d.insertBefore(g,l.nextElementSibling):d.insertBefore(g,l)):b.contains("eq-bottom")?(b.add("eq-rt"),
b.add("eq-panel"),b.add("eq-horz"),(l=d.lastElementChild).classList.contains("eq-idle")&&(l=l.previousElementSibling),l.classList.contains("eq-statusbar")?d.insertBefore(g,l):d.appendChild(g)):b.contains("eq-left")?(b.add("eq-rt"),b.add("eq-panel"),b.add("eq-vert"),f.insertBefore(g,f.firstElementChild)):b.contains("eq-right")&&(b.add("eq-rt"),b.add("eq-panel"),b.add("eq-vert"),f.appendChild(g));if(void 0!==(k=this.fn)){f=d.id;g=this.eds.get(f);b=eq.FontStyle;e=k.fc;h=k.sz;var n=k.st;k=eq.app.fnSizeFactor;
this.fn=void 0;if(void 0===g)throw Error("Dlg.visible("+this.id+") BUG: not registered");if(e||h||n&(b.bold|b.italic)){var m=",.eq-d"+this.id+"{";e&&(m+="font-family:"+e+";");h&&(m+="font-size:"+h+";");n&b.bold&&(m+="font-weight:bold;");n&b.italic&&(m+="font-style:italic;");m+="}";(b=d.classList).add("eq-root-font");b.remove("eq-default-font")}else(b=d.classList).add("eq-default-font"),b.remove("eq-root-font");g.setCssRule(f,eq.RuleType.font,m);m=k&&1!==k?" .eq-fn,.eq-d"+this.id+" .eq-fn{font-size:"+
Math.round(1E3*k)/10+"%}":void 0;g.setCssRule(f,eq.RuleType.childFont,m)}eq.Dom.onNextFrame(this,{cb:a.commitVisible,rl:d,rc:d.getBoundingClientRect()});b=!1}else d.style.display=""}b&&this.whenReady&&this.callWhenReady()};
eq.c.Dlg.commitVisible=function(a,b){var c=eq.app,d=eq.LayoutMode,e=eq.DialogMode,f=a.w,g=b.rl,h=!0,l,k;if(null===f)a.whenReady&&a.callWhenReady();else{if(void 0===(l=f.root))throw Error("Dlg.commitVisible("+a.id+") BUG: Window root undefined");if(b=b.rc){var n=g.getBoundingClientRect();if(b.width!==n.width||b.height!==n.height){eq.Dom.onNextFrame(a,{cb:eq.c.Dlg.commitVisible,rl:g});return}}void 0===(b=a.layout)?g!==l&&(g.style.visibility=""):void 0!==(k=c.layoutMode)&&k&d.inline&&!(k&d.dialog)?(a.layout=
void 0,g!==l&&(g.style.visibility="")):(a.layout=void 0,void 0!==b.mode&&(b.mode===e.inline?f.makeInline()&&(l=f.root):f.makeFramed()&&(l=f.root)),(d=l.classList).contains("eq-dialog")?g!==l&&(g.style.visibility=""):(f.setTitle(a.title||c.title),f.setIcon(a.icon),void 0!==b.mode&&(b.mode===e.layout?(d.add("eq-resize"),void 0!==b.state&&(b.state&eq.DialogState.maximized?d.add("eq-max"):d.remove("eq-max"))):(d.remove("eq-resize"),d.remove("eq-max"))),g.classList.contains("eq-rule")?d.add("eq-close"):
(d.remove("eq-close"),a.pendingClose=void 0),g!==l&&(g.style.visibility=""),void 0!==b.x&&void 0!==b.y&&(f.whenVisible={cb:eq.c.Dlg.whenVisible,d:a},h=!1,f.setPos(b.x,b.y))));if(h)eq.Dom.onNextFrame(a,{cb:eq.c.Dlg.makeVisible})}};
eq.c.Dlg.makeVisible=function(a){var b=a.w,c;if(null===b)a.whenReady&&a.callWhenReady();else{if(void 0===(c=b.root))throw Error("Dlg.makeVisible("+a.id+") BUG: Window root undefined");b.makeBaseDialogInline()||(c.style.visibility="");eq.Dom.onNextFrame(b,{cb:eq.c.Dlg.whenVisible,d:a})}};
eq.c.Dlg.whenVisible=function(a,b){b=b.d;var c,d,e,f;b.whenReady&&b.callWhenReady();eq.c.Window.zOrderModified();if((b=a.dlg)&&b===(c=eq.app).currDlg&&null!==(d=c.focus)&&(e=document.getElementById(d))&&e.classList.contains("eq-focused")&&void 0!==(f=b.eds.get(d)))eq.Dom.onNextCycle(eq.c.App.setElementFocus,{d:b,e:e,f:f.focusElement(b,e)})};
eq.c.Dlg.prototype.addControl=function(a,b,c){var d;if(void 0===c&&!(c=a.id))throw Error("addControl: root id not set");for(;;){var e=a.tg;e=document.createElement(void 0!==e?e:"DIV");this.updateControl(c,e,a);void 0===d&&(d=e);void 0!==b&&b.appendChild(e);b=e;if(void 0===a.et)break;a=a.et}a=a.ch;if(void 0!==a){e=0;for(var f=a.length;e<f;e++){var g=a[e],h=g.id;"*"===h&&(g.id=(h=c)+"-"+(e+1));this.addControl(g,b,h||c)}}return d};
eq.c.Dlg.prototype.modifyControl=function(a,b,c){for(;;){var d=c.tg;if(void 0!==d&&d!==b.tagName){d=document.createElement(d);var e=b.classList;e&&e.contains("eq-event")&&d.classList.add("eq-event");b.parentNode.replaceChild(d,b);b=d}this.updateControl(a,b,c);if(void 0===c.et)break;e=b.children;b=void 0;c=c.et;for(var f=0,g=e.length;f<g;f++){var h=e[f];if(!h.classList.contains("eq-rt")){b=h;break}}if(void 0===b)throw Error("modifyControl: id '"+a+"' nested template, no child");}c=c.ch;if(void 0!==
c){e=b.children;f=0;for(g=c.length;f<g;f++)h=c[f],f>=e.length&&(d=h.tg,b.appendChild(document.createElement(void 0!==d?d:"DIV"))),this.modifyControl(a,e[f],h);for(;e.length>g;)b.removeChild(e[g])}};
eq.c.Dlg.prototype.updateControl=function(a,b,c){var d,e,f;for(r in c)switch(r){case "id":var g=b.id,h=c.id;if(g!==h){if(g){if(void 0===e&&void 0===(e=(d=this.eds).get(g)))throw Error("BUG: updateControl id:"+g+" not registered");d.delete(g);d.set(h,e);e.updateId(this,h,g)}b.id=h}break;case "dcn":g=b.id;var l,k,n,m;if(!g)throw Error("BUG: updateControl '"+c.dcn+"' id undefined");if(void 0!==e||void 0!==(e=(d=this.eds).get(g)))throw Error("BUG: updateControl id:"+g+"already registered as '"+e.constructor.name+
"'");var p=void 0;if(l=eq.d.get(c.dcn))for(h=l.length;0<=--h;){if(void 0!==(n=(k=l[h]).useIf))if("function"===typeof n){if(!n())continue}else if(!n)continue;p=k;break}void 0===p&&(p=eq.c.DlgElement);(m=p.adjustElementTemplate)&&m(c);d.set(g,new p(this,b));break;case "hc":eq.Dom.setContent(b,c.hc);break;case "hca":if(void 0===f&&void 0===(f=(d||(d=this.eds)).get(a)))throw Error("BUG: updateControl id:"+a+" not registered");h=eq.Dom.setContent(b,c.hca,!0);f.setAccel(this,a,h,eq.KeyMod.alt);break;case "ec":b.value=
c.ec;"TEXTAREA"===b.tagName&&(b.textContent=c.ec);break;case "at":for(var q in c.at){var r=c.at[q];null!==r?q in b?b[q]=r:b.setAttribute(q,r):b.removeAttribute(q)}break;case "clr":p=c.clr;h=0;for(g=p.length;h<g;h++)b.classList.remove(p[h]);break;case "cla":p=c.cla;h=0;for(g=p.length;h<g;h++)b.classList.add(p[h]);break;case "st":for(var t in c.st)h=c.st[t],b.style.setProperty(t,null!==h?h:"");break;case "ds":for(var u in c.ds)h=c.ds[u],null!==h?b.dataset[u]=h:delete b.dataset[u];break;case "rt":case "rtd":if(void 0===
f&&void 0===(f=(d||(d=this.eds)).get(a)))throw Error("BUG: updateControl id:"+a+" not registered");if("rt"===r)f.setAttr(this,a,b,c.rt);else eq.Dom.onNextCycle(eq.c.DlgElement.setAttr,{t:f,d:this,i:a,e:b,r:c.rtd});break;case "cr":if(void 0===f&&void 0===(f=(d||(d=this.eds)).get(a)))throw Error("BUG: updateControl id:"+a+" not registered");p=c.cr;h=0;for(g=p.length;h<g;h++)l=p[h],f.setCssRule(a,l.ty,l.rl);break;case "ev":h=c.ev;if(void 0===f&&void 0===(f=(d||(d=this.eds)).get(a)))throw Error("BUG: updateControl id:"+
a+" not registered");void 0!==h.a&&(f.a=null!==h.a?h.a:void 0);void 0!==h.c&&(f.c=null!==h.c?h.c:void 0);void 0!==h.m&&(f.m=null!==h.m?h.m:void 0);void 0!==h.f&&(f.f=null!==h.f?h.f:void 0);void 0!==f.a||void 0!==f.c?b.classList.add("eq-event"):b.classList.remove("eq-event");break;case "dlg":h=c.dlg;var v;void 0!==h.l&&(this.layout=h.l?h.l:void 0);void 0!==h.t&&(this.title=h.t?h.t:void 0,(v=this.w)&&v.root&&v.setTitle(this.title||eq.c.App.title));void 0!==h.ic&&(this.icon=h.ic?h.ic:void 0,(v=this.w)&&
v.root&&v.setIcon(this.icon));void 0!==h.f&&(this.fkey=h.f?h.f:void 0);void 0!==h.tm&&(this.timer=h.tm?h.tm:void 0);void 0!==h.vc&&(this.vcrule=h.vc?h.vc:void 0);void 0!==h.d&&(h.d?this.ddo=h.d:this.ddo&&(this.ddo=void 0,this.resetCurrDlg()))}};
eq.c.Dlg.prototype.calcGrid=function(a){for(var b=this.constructor,c=this.grid,d=document.body,e,f,g=0;2>g;g++){var h=b.getGridTemplate(),l=h.style,k=h.firstElementChild,n=eq.FontStyle,m;if(m=a.fc)l.fontFamily=m;if(m=a.sz)l.fontSize=m;(m=a.st)&n.bold&&(l.fontWeight="bold");m&n.italic&&(l.fontStyle="italic");0===g?((l=k.style).width="1ch",l.height="1em",d.appendChild(h),l=k.getBoundingClientRect(),c.wr=e=l.width,c.hr=f=l.height):(k.textContent="X",d.appendChild(h),l=k.getBoundingClientRect(),c.wf=
(c.wp=Math.ceil(l.width))/e,c.hf=(c.hp=Math.ceil(l.height))/f);d.removeChild(h)}};eq.c.Dlg.getGridTemplate=function(){var a=this.gridTemplate;void 0===a&&(this.gridTemplate=a=document.createElement("DIV"),a.className="eq-grid",a.style.zIndex=eq.Dom.zIndex(document.body)-1,a.appendChild(document.createElement("P")));return a.cloneNode(!0)};
eq.c.Dlg.prototype.copyFontToElement=function(a){for(var b=eq.Dom,c,d,e,f=this.root.length;0<=--f;)if((d=(c=this.root[f]).classList).contains("eq-dialog")&&d.contains("eq-root-font"))return b.copyFont(a,c),b.adjustElementFontSize(a),!0;return(e=eq.app.fnDefault)&&b.setFont(a,e)?(b.adjustElementFontSize(a),!0):!1};
eq.c.Dlg.prototype.nextTab=function(a,b){var c=this.tabOrder,d;if(null!==c&&(d=c.length)){a=c.indexOf(a);for(var e=-1===a?0:b?a-1:a+1,f;;){b?-1===e&&(e=d-1):e===d&&(e=0);if(e===a)break;-1===a&&(a=0);if((f=document.getElementById(c[e]))&&!f.classList.contains("eq-notab"))return f;b?e--:e++}}return null};
eq.c.Dlg.prototype.isAccel=function(a,b,c){if(null===(a=eq.Dom.decodeAccelKey(a,b,c)))return!1;a=this.accel.get(b?String.fromCharCode(b+48)+a.toUpperCase():a.toUpperCase());if(void 0!==a){b=this.eds.get(a);var d;if(void 0!==b&&(d=document.getElementById(a))&&!d.classList.contains("eq-disabled"))return eq.app.cancelUserAction(),b.onAccel(this,a,d),!0}return!1};eq.c.Dlg.dndType="application/com.eloquence.webdlg2";
eq.c.Dlg.onDragStart=function(a){var b=eq.Dom,c,d,e,f,g;if(!(c=eq.app).idle&&(d=c.currDlg)){c.pendingMouseDown=void 0;c.pendingClick=void 0;c.stopPendingClickTimer();if("Window"===this.constructor.name)(e=document.getElementById(f=this.name))||(f=void 0);else if(e=b.eqControl(this))f=e.id;if(f&&!e.classList.contains("eq-disabled")){if(!(g=d.eds.get(f)))throw Error("Dlg.onDragStart BUG: "+f+" not registered");var h={serial:++c.dndSerial,ch:[]};if(g.onDragStart(d,f,e,this,a,h)){h.drag&&(a.dataTransfer.setData(d.constructor.dndType,
h.serial.toString()),c.dnd=h);return}}}a.dataTransfer.clearData();b.consumeEvent(a)};eq.c.Dlg.onDragOver=function(a){a.preventDefault();var b=eq.app,c,d,e,f,g,h;if((c=b.dnd)&&(d=c.drag))if(b.idle||!(e=b.currDlg)){if(f=d.over)f.classList.remove("eq-dragover"),d.over=null}else(f=eq.Dom.eqControl(a=a.target))&&!f.classList.contains("eq-disabled")&&(h=e.eds.get(g=f.id))&&(a=h.onDragOver(e,g,f,a),(f=d.over)&&f.classList.remove("eq-dragover"),a&&a.classList.add("eq-dragover"),d.over=a)};
eq.c.Dlg.onDrop=function(a){var b=eq.Dom,c=eq.app,d,e,f,g,h,l,k;b.consumeEvent(a);if(!c.idle&&(d=c.currDlg)){if((f=(e=a.dataTransfer).getData(eq.c.Dlg.dndType)).length){if(!(h=c.dnd)||h.serial!==Number(f)){c.dnd=null;return}h.drop=l={}}else if((f=e.getData("text/plain")).length)l={content:f},h={ch:[],drop:l};else if((g=e.files)&&(k=g.length)){f="";for(l=0;l<k;l++)f+=g.item(l).name+"\n";l={content:f};h={ch:[],drop:l}}else{c.dnd=null;return}switch(e.dropEffect){case "move":l.action=1;break;case "copy":l.action=
2;break;case "link":l.action=4}e=0;l=a.target;var n,m;for(a="Window"===this.constructor.name?document.getElementById(m=this.name):l;a=b.eqControl(a);){if(a.classList.contains("eq-disabled")){a=null;break}a.classList.contains("eq-dialog")&&(n=a);if(!(k=d.eds.get(m=a.id)))throw Error("Dlg.onDrop BUG: "+m+" not registered");if((e=k.onDrop(d,m,a,l,h))||n)break;a=a.parentNode}if(a&&e){if(!n){if(!(n=b.eqDialog(a)))throw Error("Dlg.onDrop BUG: "+m+" no Dialog");if(!(k=d.eds.get(n.id)))throw Error("Dlg.onDrop BUG: Dialog "+
n.id+" not registered");k.onDrop(d,n.id,n,n,h)}l=0;for(k=(b=h.ch).length;l<k;l++)c.setChanged(b[l],"dnd");c.onceRule=e;c.onceId=m;c.submit(a,{id:m,type:"dnd"});return}}c.dnd=null};
eq.c.Window.subClass("LoginDialog",function(a,b){var c=this.constructor,d=eq.c.Window,e=eq.strings,f=eq.app,g=eq.Dom,h,l,k,n;if(c.singleton)throw Error("BUG: login dialog singleton exists");c.singleton=this;this.accel=new Map;if(h=document.getElementById("eq-login-dialog"))h=h.cloneNode(!0),h.removeAttribute("id"),h.style.display="";else{h=document.createElement("DIV");h.className="eq-login-dialog";var m=document.createElement("DIV");g.setContent(m,e.get("login.prompt"));h.appendChild(m);m=document.createElement("DIV");
m.className="eq-title";h.appendChild(m);var p=document.createElement("LABEL");var q=document.createElement("SPAN");q.className="eq-label";var r=g.setContent(q,e.get("login.label.name"),!0);p.appendChild(q);m=document.createElement("INPUT");m.type="text";m.className="eq-login";p.appendChild(m);h.appendChild(p);null!==r&&this.accel.set(r.toUpperCase(),m);p=document.createElement("LABEL");q=document.createElement("SPAN");q.className="eq-label";r=g.setContent(q,e.get("login.label.pass"),!0);p.appendChild(q);
m=document.createElement("INPUT");m.type="password";m.className="eq-password";p.appendChild(m);h.appendChild(p);null!==r&&this.accel.set(r.toUpperCase(),m);var t=document.createElement("DIV");t.className="eq-button";void 0!==b?(p=document.createElement("LABEL"),p.className="eq-save",m=document.createElement("INPUT"),m.type="checkbox",p.appendChild(m),q=document.createElement("SPAN"),r=g.setContent(q,e.get("login.save"),!0),p.appendChild(q),t.appendChild(p),null!==r&&this.accel.set(r.toUpperCase(),
m)):t.appendChild(document.createElement("DIV"));m=document.createElement("BUTTON");m.type="button";m.className="eq-ok";r=g.setContent(m,e.get("login.ok"),!0);t.appendChild(m);null!==r&&this.accel.set(r.toUpperCase(),m);m=document.createElement("BUTTON");m.type="button";m.className="eq-cancel";r=g.setContent(m,e.get("login.cancel"),!0);t.appendChild(m);null!==r&&this.accel.set(r.toUpperCase(),m);h.appendChild(t)}e=h.getElementsByClassName("eq-title");r=0;for(m=e.length;r<m;r++)g.setContent(e[r],f.title);
e=h.getElementsByClassName("eq-login");if(1!==e.length)throw Error("LoginDialog: "+e.length+" Login fields, expected: 1");(m=this.elLogin=e[0]).oninput=c.onInput;a?m.value=a:m.classList.add("eq-focused");e=h.getElementsByClassName("eq-password");if(1!==e.length)throw Error("LoginDialog: "+e.length+" Password fields, expected: 1");(m=this.elPswd=e[0]).oninput=c.onInput;a&&m.classList.add("eq-focused");e=h.getElementsByClassName("eq-ok");if(1!==e.length)throw Error("LoginDialog: "+e.length+" OK buttons, expected: 1");
(m=this.elOk=e[0]).onclick=c.onOk;m.disabled=!0;a=h.querySelectorAll(".eq-save input");if(a.length){if(1<a.length)throw Error("LoginDialog: "+a.length+" Save buttons, expected: 1");(m=this.elSave=a[0]).checked=!!b}e=h.getElementsByClassName("eq-cancel");if(e.length){if(1<e.length)throw Error("LoginDialog: "+e.length+" Cancel buttons, expected: 1");(m=this.elCancel=e[0]).onclick=c.onCancel}h.onfocus=c.onFocus;(b=h.classList).contains("eq-inline")?(b.add("eq-window"),d.call(this,h),d=this.root):(d.call(this,
d.setupFrame(h)),(d=this.root).classList.add("eq-close"));this.notifyOnClose=!0;(l=f.fnDefault)&&g.setFont(d,l)&&g.adjustElementFontSize(d);this.whenVisible={cb:c.setFocus};this.setTitle(f.title);this.setIcon(f.logoIcon);g=0;e=h.getElementsByClassName("eq-label");r=0;for(m=e.length;r<m;r++)(h=Number(window.getComputedStyle(e[r]).width.replace(/px$/,"")))&&h>g&&(g=h);if(g)for(r=0,m=e.length;r<m;r++)e[r].style.width=g+"px";void 0!==(k=f.popupPos)&&k&(n=eq.PopupPos).login?this.setPos(k&n.left?0:-1,k&
n.top?0:-1):this.setPos(-1,-1);this.activate();window.addEventListener("keydown",c.onKey,!0)});delete eq.c.LoginDialog.subClass;eq.c.LoginDialog.singleton=null;
eq.c.LoginDialog.prototype.close=function(){var a=this.constructor,b=eq.c.Window;if(this!==a.singleton)throw Error("BUG: unexpected login dialog invocation");window.removeEventListener("keydown",a.onKey,!0);this.accel.clear();this.accel=null;this.notifyOnClose&&eq.app.api.postMessage({o:eq.ApiOp.onLoginEvent});b.prototype.close.call(this);a.singleton=null};eq.c.LoginDialog.close=function(){this.singleton&&this.singleton.close()};
eq.c.LoginDialog.setFocus=function(a){var b=eq.c.LoginDialog;if(b.singleton){if(!b.onFocus(a))eq.Dom.onNextCycle(b.commitFocus);return!0}return!1};eq.c.LoginDialog.commitFocus=function(){var a=eq.c.LoginDialog.singleton,b;a&&(b=a.root.querySelector(".eq-focused"))&&b.focus()};eq.c.LoginDialog.prototype.setFocusElement=function(a){for(var b=this.root.querySelectorAll(".eq-focused"),c=b.length;0<=--c;)b[c].classList.remove("eq-focused");a.classList.add("eq-focused");a.focus()};
eq.c.LoginDialog.prototype.focusable=function(){var a=[this.elLogin,this.elPswd];this.elSave&&a.push(this.elSave);a.push(this.elOk);this.elCancel&&a.push(this.elCancel);return a};eq.c.LoginDialog.onFocus=function(a){var b=eq.c.LoginDialog.singleton;if(a&&a.target)for(var c=b.focusable(),d,e=c.length;0<=--e;)if((d=c[e])===a.target)return d.classList.contains("eq-focused")||b.setFocusElement(d),!0;return!1};
eq.c.LoginDialog.onOk=function(a){a=eq.c.LoginDialog.singleton;var b=a.elLogin.value,c=a.elPswd.value;b&&c&&(eq.app.api.postMessage({o:eq.ApiOp.onLoginEvent,l:b,p:c,s:a.elSave?a.elSave.checked:!0}),a.notifyOnClose=!1,a.close())};eq.c.LoginDialog.onCancel=function(a){eq.c.LoginDialog.singleton.close()};
eq.c.LoginDialog.onKey=function(a){var b=eq.c.LoginDialog.singleton,c=a.key,d=eq.Dom,e,f;if(1===c.length&&a.altKey&&null!==(f=d.decodeAccelKey(c,eq.KeyMod.alt,a))&&(e=b.accel.get(f.toUpperCase())))"INPUT"!==e.tagName||"text"!==e.type&&"password"!==e.type?d.fireClick(e):e.focus(),d.consumeEvent(a);else{f=b.focusable();var g;for(e=document.activeElement;e&&e!==document&&e!==b.root&&-1===(g=f.indexOf(e));)e=e.parentNode;if(-1!==g)switch(c){case "Escape":case "Esc":b.close();d.consumeEvent(a);break;case " ":case "Spacebar":switch(e){case b.elOk:case b.elCancel:case b.elSave:d.fireClick(e),
d.consumeEvent(a)}break;case "Enter":switch(e){case b.elOk:case b.elCancel:case b.elSave:d.fireClick(e);d.consumeEvent(a);return;case b.elPswd:if(c=b.elLogin.value,e=b.elPswd.value,c&&e){eq.app.api.postMessage({o:eq.ApiOp.onLoginEvent,l:c,p:e,s:b.elSave?b.elSave.checked:!0});b.notifyOnClose=!1;b.close();d.consumeEvent(a);return}}case "Tab":do a.shiftKey?0>--g&&(g=f.length-1):++g==f.length&&(g=0);while((e=f[g]).disabled);b.setFocusElement(e);d.consumeEvent(a)}}};
eq.c.LoginDialog.onInput=function(a){a=eq.c.LoginDialog.singleton;var b=a.elPswd.value;a.elOk.disabled=!(a.elLogin.value&&b)};
eq.c.Window.subClass("MessageDialog",function(a,b,c){var d=this.constructor,e=eq.c.Window,f=eq.app,g=eq.Dom,h,l,k,n;d.singleton&&d.singleton.close();d.singleton=this;this.accel=new Map;var m=document.createElement("DIV");m.className="eq-message-dialog";var p=document.createElement("SPAN");g.setContent(p,a);m.appendChild(p);a=document.createElement("DIV");p=document.createElement("BUTTON");p.className="eq-focused";p.type="button";c?(this.onCancel=c,c=g.setContent(p,eq.strings.get("message.cancel"),
!0)):c=g.setContent(p,eq.strings.get("message.ok"),!0);null!==c&&this.accel.set(c.toUpperCase(),p);p.onclick=d.close;a.appendChild(p);m.appendChild(a);e.call(this,e.setupFrame(m));(e=this.root).classList.add("eq-close");(h=f.topDialog())&&h.copyFontToElement(e)||(l=f.fnDefault)&&g.setFont(e,l)&&g.adjustElementFontSize(e);this.whenVisible={cb:d.setFocus};this.setTitle(f.title);this.setIcon(f.logoIcon);void 0!==(k=f.popupPos)&&k&(n=eq.PopupPos).message?this.setPos(k&n.left?0:-1,k&n.top?0:-1):this.setPos(-1,
-1);this.activate();window.addEventListener("keydown",d.onKey,!0);b&&(this.closeTimeout=window.setTimeout(d.close,b))});delete eq.c.MessageDialog.subClass;eq.c.MessageDialog.setFocus=function(){var a=eq.c.MessageDialog.singleton,b;return a&&(b=a.root.querySelector(".eq-focused"))?(b.focus(),!0):!1};eq.c.MessageDialog.singleton=null;
eq.c.MessageDialog.prototype.close=function(){var a=this.constructor,b=eq.c.Window;if(this!==a.singleton)throw Error("BUG: unexpected message dialog invocation");void 0!==this.closeTimeout&&(window.clearTimeout(this.closeTimeout),this.closeTimeout=void 0);window.removeEventListener("keydown",a.onKey,!0);this.accel.clear();this.accel=null;b.prototype.close.call(this);if(this.onCancel)this.onCancel();a.singleton=null};eq.c.MessageDialog.close=function(){var a=eq.c.MessageDialog;a.singleton&&a.singleton.close()};
eq.c.MessageDialog.onKey=function(a){var b=eq.c.MessageDialog.singleton,c=a.key,d=eq.Dom,e,f;if(1===c.length&&a.altKey&&null!==(f=d.decodeAccelKey(c,eq.KeyMod.alt,a))&&(e=b.accel.get(f.toUpperCase())))d.fireClick(e),d.consumeEvent(a);else switch(c){case "Escape":case "Esc":case " ":case "Spacebar":case "Enter":eq.c.MessageDialog.singleton.close(),d.consumeEvent(a)}};
eq.c.Window.subClass("PopupBox",function(a){var b=this.constructor,c=eq.c.Window,d=eq.Dom,e=eq.app,f,g,h,l,k,n;if(b.singleton)throw Error("BUG: POPUP BOX singleton exists");b.singleton=this;this.accel=new Map;var m=document.createElement("DIV");m.className="eq-popup-box";var p=a.msg.split("\n");for(var q=0,r=p.length;q<r;q++){var t=document.createElement("P");d.setContent(t,p[q]);m.appendChild(t)}p=document.createElement("DIV");p.className="eq-pushbutton";var u=0<(u=a.btnDefault)?u-1:0;q=0;for(r=
a.btn.length;q<r;q++){t=document.createElement("BUTTON");t.type="button";if(d.isHtmlContent(f=a.btn[q])||-1!==f.indexOf("&"))null===(g=d.setContent(t,f,!0))||this.accel.has(g=g.toUpperCase())||this.accel.set(g,t);else{for(var v=0,y=f.length;v<y;v++){var w=v?f.substring(0,v)+"&"+f.substring(v):"&"+f.substring(v);if(null===(g=d.setContent(t,w,!0)))break;if(!this.accel.has(g=g.toUpperCase())){this.accel.set(g,t);break}}w="&"+w}q===u&&t.classList.add("eq-focused");p.appendChild(t)}m.appendChild(p);c.call(this,
c.setupFrame(m));c=this.root;(h=e.topDialog())&&h.copyFontToElement(c)||(l=e.fnDefault)&&d.setFont(c,l)&&d.adjustElementFontSize(c);this.whenVisible={cb:b.setFocus};this.setTitle(a.title||e.title);this.setIcon(e.logoIcon);void 0!==(k=e.popupPos)&&k&(n=eq.PopupPos).box?this.setPos(k&n.left?0:-1,k&n.top?0:-1):this.setPos(-1,-1);this.activate()});delete eq.c.PopupBox.subClass;
eq.c.PopupBox.setFocus=function(){var a=eq.c.PopupBox.singleton,b;return a&&(b=a.root.querySelector(".eq-focused"))?(b.focus(),!0):!1};eq.c.PopupBox.singleton=null;
eq.c.PopupBox.prototype.close=function(a){var b=this.constructor,c=eq.c.Window;if(this!==b.singleton)throw Error("BUG: unexpected POPUP BOX invocation");if(void 0!==a){var d=a.target;if(c.fromTarget(d)===this&&this.onMouseDownOrClick(a))return a.stopPropagation(),!1;if("click"!==a.type)return!1;d=this.buttonIndex(d);if(-1===d)return!1;eq.app.api.postMessage({o:eq.ApiOp.onPopupEvent,d:d+1});a.stopPropagation()}this.accel.clear();this.accel=null;c.prototype.close.call(this);b.singleton=null;return!0};
eq.c.PopupBox.prototype.onKey=function(a){var b=a.key,c=eq.Dom,d;if(this!==this.constructor.singleton)throw Error("BUG: unexpected POPUP BOX invocation");if(1===b.length&&null!==c.decodeAccelKey(b,a.ctrlKey||a.altKey||a.metaKey?eq.KeyMod.alt:0,a)&&(d=this.accel.get(b.toUpperCase())))return c.fireClick(d),!0;if(-1!==(d=this.buttonIndex(document.activeElement))){var e=this.root.querySelector(".eq-popup-box>.eq-pushbutton").children;switch(b){case "Enter":case " ":case "Spacebar":return c.fireClick(e[d]),
!0;case "Tab":var f=a.shiftKey?-1:1;break;case "Home":d=f=0;break;case "End":d=0;f=-1;break;case "PageUp":case "ArrowUp":case "Up":case "ArrowLeft":case "Left":f=-1;break;case "PageDown":case "ArrowDown":case "Down":case "ArrowRight":case "Right":f=1}if(void 0!==f){a=e.length;0>(d+=f)?d=a-1:d>=a&&(d=0);for(f=0;f<a;f++)e[f].classList.remove("eq-focused");(d=e[d]).classList.add("eq-focused");d.focus();return!0}}return!1};
eq.c.PopupBox.prototype.isEvent=function(a){a=a.target;for(var b=this.root;a&&a!==document&&a!==b;)a=a.parentNode;return a===b};eq.c.PopupBox.prototype.buttonIndex=function(a){if(a)for(var b;(b=a.parentNode)&&b!==document&&b!==this.root;){var c=b.classList;if(c&&c.contains("eq-pushbutton")){b=this.root.querySelector(".eq-popup-box>.eq-pushbutton").children;c=0;for(var d=b.length;c<d;c++)if(a===b[c])return c;break}a=b}return-1};
eq.strings.get=function(a){a=a.split(".");var b=this.m,c,d,e;if(void 0!==b){if((c=eq.app.locale.tag)&&(d=b.get(c))&&(e=this.fromPath(d,a)))return e;if(d=b.get("default"))if(e=this.fromPath(d,a))return e}return this.fromPath(this.default,a)};eq.strings.fromPath=function(a,b){for(var c=0,d=b.length;c<d&&(a=a[b[c]]);c++);return a};
eq.strings.default={login:{prompt:"Please enter your login and password to start:",label:{name:"&Login:",pass:"&Password:"},ok:"L&ogin",cancel:"&Cancel",save:"&Save login"},message:{ok:"&Dismiss",cancel:"&Cancel",dlgListen:"<html>Waiting for DLG connection on port"},clipboardMenu:"&Undo|Cu&t|&Copy|&Paste|&Delete|Select &All"};eq.Pointer={id:null,rc:!1,ht:null};eq.Pointer.supported=function(){return"PointerEvent"in window};
eq.Pointer.install=function(){this.supported()&&(window.addEventListener("pointercancel",this.cancel),window.addEventListener("pointerdown",this.down),window.addEventListener("pointerup",this.up),window.addEventListener("pointermove",this.move),window.addEventListener("gotpointercapture",this.capture))};eq.Pointer.cancel=function(){var a=eq.Pointer,b;null!==a.id&&(a.id=null,(b=eq.app).mouseDownTimers.cancelAll(),void 0!==b.capture&&b.endCapture());null!==(b=a.ht)&&(a.ht=null,window.clearTimeout(b.t))};
eq.Pointer.down=function(a){var b=eq.Pointer,c,d,e,f,g,h,l,k,n;b.cancel();if(a.isPrimary&&1===a.buttons&&"mouse"!==a.pointerType){b.id=a.pointerId;if(!((c=eq.app).idle||(e=(d=a.target).classList)&&e.contains("eq-idle"))){if(void 0!==c.overlay){(f=eq.Dom).eqOverlay(d)&&(g=f.eqControl(d)||c.overlay.el)&&(h=c.currDlg)&&void 0!==(k=h.eds.get(l=g.id))&&void 0!==k.c&&-1!==k.c.indexOf("pointerdown")&&(k.onChange(h,l,g,a)||f.consumeEvent(a));return}if((g=(f=eq.Dom).eqControl(d))&&!g.classList.contains("eq-disabled")&&
(h=c.currDlg)&&void 0!==(k=h.eds.get(l=g.id))){for(;d&&d!==document&&!d.id;){if((e=d.classList)&&e.contains("eq-cmc")){var m=d;break}d=d.parentNode}b.ht={x:a.clientX,y:a.clientY,c:m,t:window.setTimeout(b.onHoldTimeout,750,g)};void 0!==k.c&&-1!==k.c.indexOf("pointerdown")&&(k.onChange(h,l,g,a)||f.consumeEvent(a));return}}(n=eq.c.Window.fromTarget(a.target))&&n.onMouseDownOrClick(a)&&eq.Dom.consumeEvent(a)}};eq.Pointer.mouseDown=function(){this.cancel()};
eq.Pointer.onHoldTimeout=function(a){var b=eq.Pointer,c=b.ht,d=eq.app;b.ht=null;!d.idle&&d.currDlg&&(b.cancel(),d.apiMouseButton2(a.id,2,2,c.x,c.y,c.c))};eq.Pointer.up=function(a){var b=eq.Pointer,c,d;if(a.pointerId===b.id){if(d=(c=eq.app).capture)c.capture=void 0,d.done&&d.done(d.arg,a);b.cancel()}};
eq.Pointer.move=function(a){var b=eq.Pointer,c;if(a.pointerId===b.id){if(null!==(c=b.ht)){if(5>Math.abs(a.clientX-c.x)&&5>Math.abs(a.clientY-c.y))return;b.ht=null;window.clearTimeout(c.t)}if(b=eq.app.capture)eq.Dom.consumeEvent(a),b.cb&&b.cb(a,b.arg)}};eq.Pointer.capture=function(a){var b;eq.app.capture&&(b=a.pointerId)===eq.Pointer.id&&a.target.releasePointerCapture(b)};eq.c.DlgElement.addClass("CheckBox",function(a,b){eq.c.DlgElement.call(this,a,b)});
eq.c.CheckBox.prototype.setSensitive=function(a,b,c,d){eq.Dom.inputElement(c).disabled=!d;eq.c.DlgElement.prototype.setSensitive.call(this,a,b,c,d)};eq.c.CheckBox.prototype.onKey=function(a,b,c,d,e,f){if(e)return!1;a=eq.Dom;return(d=a.isEnterOrSpace(d))&&(10!==d||c.classList.contains("eq-noenter"))?(a.fireClick(a.inputElement(c),{key:d}),a.consumeEvent(f),!0):!1};
eq.c.CheckBox.prototype.onTypeAhead=function(a,b,c,d){var e;switch(d){case "Enter":case "ShiftEnter":c.classList.contains("eq-noenter")&&(e=10);break;case " ":e=32}return void 0!==e?(a=eq.Dom,a.fireClick(a.inputElement(c),{key:e}),!0):eq.c.DlgElement.prototype.onTypeAhead.call(this,a,b,c,d)};eq.c.CheckBox.prototype.onSubmit=function(a,b,c,d){a=eq.app;a.changed.has(b)||a.changed.set(b,"input")};eq.c.CheckBox.prototype.focusElement=function(a,b){return eq.Dom.inputElement(b)};
eq.c.CheckBox.prototype.changed=function(a,b,c,d){return{id:b,ty:eq.RsValType.buttonChecked,iv:c.checked?1:0}};eq.c.DlgElement.addClass("ComboBox",function(a,b){eq.c.DlgElement.call(this,a,b);this.dnd=this.tc=null;this.globalDropRule=this.dropRule=this.dndMode=0});eq.c.ComboBox.prototype.dispose=function(a,b){this.dnd=this.tc=null;eq.c.DlgElement.prototype.dispose.call(this,a,b)};
eq.c.ComboBox.adjustElementTemplate=function(a){for(;a;){var b=a.ev,c,d;b&&(c=b.c)&&-1!==(d=c.indexOf("mousedown"))&&c.splice(d,0,"pointerdown");a=a.et}};eq.c.ComboBox.line=function(a,b){for(var c,d;a&&(c=a.parentNode);){if(d=c.classList){if(d.contains("eq-column"))return void 0!==b&&(b.c=c),a;if(d.contains("eq-combobox")){void 0!==b&&(b.ct=c);break}}a=a.parentNode}};
eq.c.ComboBox.select=function(a,b,c){void 0===b&&((b=a.querySelector(".eq-combobox>.eq-column"))||(b=document.body.querySelector("body>.eq-combobox.eq-column")));a=b.querySelectorAll(".eq-column>.eq-selected");for(var d=0,e=a.length;d<e;d++)a[d].classList.remove("eq-selected");c&&b===c.parentNode&&(c.classList.add("eq-selected"),1<b.children.length&&this.scrollIntoView(c,{cb:this.scrollIntoView}))};
eq.c.ComboBox.scrollIntoView=function(a,b){var c=a.parentNode,d=c.children,e,f;if(1<d.length)if(eq.app.idle||0>=(e=c.getBoundingClientRect().height)||0>=(f=d[0].getBoundingClientRect().height))eq.Dom.onNextFrame(a,b);else b=c.scrollTop,a=a.offsetTop,a<b?c.scrollTop=a:a+f>b+e&&(c.scrollTop=Math.ceil(a+f-e+2))};
eq.c.ComboBox.open=function(a,b){var c=eq.c.ComboBox,d=a.classList;c.open.ctx=null;if(!d.contains("eq-open")){void 0===b&&(b=a.querySelector(".eq-combobox>.eq-column"));var e=a.firstElementChild,f=e.value,g=f.length,h=a.getBoundingClientRect(),l=b.style,k=b.classList,n;if(g)for(var m=b.children,p,q,r=0,t=m.length;r<t;r++){q=(p=m[r]).textContent;if(g<q.length){if(f!==q.substring(0,g))continue}else if(f!==q)continue;var u=p;break}l.left=h.left+window.pageXOffset+"px";l.top=h.bottom+window.pageYOffset+
"px";(n=l.maxWidth)?l.width=n:l.width=h.width+"px";eq.Dom.copyFont(b,e);eq.Dom.copyColors(b,a);k.add("eq-combobox");d.contains("eq-border")?k.add("eq-border"):k.remove("eq-border");eq.app.makeOverlay(a,b,c.close);d.add("eq-open");d.add("eq-enter");(e=b.getBoundingClientRect()).bottom>window.pageYOffset+document.documentElement.clientHeight?(l.top=h.top+window.pageYOffset-e.height+"px",d.remove("eq-dn"),k.remove("eq-dn"),d.add("eq-up"),k.add("eq-up")):(d.remove("eq-up"),k.remove("eq-up"),d.add("eq-dn"),
k.add("eq-dn"));c.select(a,b,u)}};eq.c.ComboBox.open.ctx=null;eq.c.ComboBox.autoOpen=function(a){eq.c.ComboBox.open(a)};eq.c.ComboBox.onFocus=function(){var a=this.parentNode,b;if(a&&(b=a.classList)&&b.contains("eq-auto")&&!b.contains("eq-disabled")&&!b.contains("eq-open"))eq.Dom.onNextCycle(eq.c.ComboBox.autoOpen,a)};
eq.c.ComboBox.preSelectIfOpen=function(a){var b,c,d,e,f;if(a.classList.contains("eq-open")&&(b=a.firstElementChild)&&(d=(c=b.value).length)){b=document.body.querySelector("body>.eq-combobox.eq-column");for(var g=0,h=(e=b.children).length;g<h;g++){var l=(f=e[g]).textContent;if(d<l.length){if(c!==l.substring(0,d))continue}else if(c!==l)continue;eq.c.ComboBox.select(a,b,f);break}}};
eq.c.ComboBox.close=function(a,b,c){var d=a.classList,e=b.classList,f;if(!d.contains("eq-open"))throw Error("ComboBox.close BUG: not open, id:"+a.id);a.appendChild(b);e.remove("eq-combobox");e.remove("eq-border");d.remove("eq-open");d.remove("eq-enter");e=(d=eq.c.ComboBox.open).ctx;c&&(f=b.querySelector(".eq-column>.eq-selected"))&&(b=a.firstElementChild,c=b.maxLength,b.value=c&&0<c?f.textContent.substring(0,c):f.textContent,b.select(),eq.Dom.fireEvent(a,"input"),e&&e.el===a&&1<e.cnt&&eq.app.submit(a,
{id:a.id,type:"input"}));e&&(window.clearTimeout(e.t),d.ctx=null)};eq.c.ComboBox.close.ctx=function(){var a=eq.c.ComboBox.open.ctx,b,c;a&&(c=(b=a.el).classList)&&c.contains("eq-open")&&eq.app.closeOverlay(b,!0)};eq.c.ComboBox.move=function(a,b){var c=b.c;if(c){var d=eq.c.ComboBox,e=b.el,f={};a=d.line(a.target,f);e!==f.ct&&(d.select(e,c,a),a&&(b.close=!0))}};
eq.c.ComboBox.move.done=function(a){var b=a.el,c=a.a,d;if(a.close)if(b.classList.contains("eq-auto")&&(d=document.body.querySelector("body>.eq-combobox.eq-column>.eq-selected"))){a=b.firstElementChild;var e=a.maxLength;a.value=e&&0<e?d.textContent.substring(0,e):d.textContent;a.select();eq.Dom.fireEvent(b,"input")}else eq.app.closeOverlay(b,!0);void 0!==c&&c.classList.remove("eq-click");return!0};
eq.c.ComboBox.onInput=function(a){var b,c,d,e;"INPUT"===(a=a.target).tagName&&(b=eq.app.currDlg)&&(c=b.eds.get(this.id))&&(d=c.tc)&&((e=a.parentNode).classList.contains("eq-open")&&eq.c.ComboBox.select(e,document.body.querySelector("body>.eq-combobox.eq-column")),c.textChanged(this,a,d))};
eq.c.ComboBox.prototype.textChanged=function(a,b,c){b=b.value.length;var d=c.llast;if(b<d||b>d&&b>=c.lmin)d=eq.app,c.tid&&d.dialogTimers.cancel(c.tid),c.tid=d.dialogTimers.add(c.delay,eq.c.ComboBox.onAutoComplete,null,{self:this,el:a});c.llast=b};eq.c.ComboBox.onAutoComplete=function(a){var b=a.el.id,c=eq.app;c.onceRule=a.self.tc.rule;c.onceId=b;c.submit(a.el,{id:b,type:"timer"})};
eq.c.ComboBox.prototype.setAttr=function(a,b,c,d){for(var e=eq.RqTag,f,g=0,h=d.length;g<h;g++){var l=d[g];switch(l.t){case e.content:var k=this.tc;if(k&&(k.llast=l.l))eq.Dom.onNextCycle(eq.c.ComboBox.preSelectIfOpen,c);break;case e.items:var n=eq.Dom;l=l.v;var m=l.length;k=c.classList;var p;m?k.remove("eq-empty"):k.add("eq-empty");if(k.contains("eq-open")){k=document.body.querySelector("body>.eq-combobox.eq-column");if(!k)throw Error("ComboBox.setAttr BUG: open, no column");if(m&&this.tc)n.onNextCycle(eq.c.ComboBox.preSelectIfOpen,
c)}else c.querySelector(".eq-combobox>.eq-button")||(k=document.createElement("DIV"),k.className="eq-rt eq-button",c.appendChild(k)),(k=c.querySelector(".eq-combobox>.eq-column"))||(k=document.createElement("DIV"),k.className="eq-rt eq-column",c.appendChild(k));if(m)var q=(p=k.children).length;else k.textContent="",p=k.children,q=0;for(var r=0;r<m;r++){if(r<q)var t=p[r];else t=document.createElement("DIV"),k.appendChild(t);n.setContent(t,l[r])}for(;p.length>m;)k.removeChild(k.lastElementChild);break;
case e.boxSize:n=l.w;l=l.h;k=c.classList.contains("eq-open")?document.body.querySelector("body>.eq-combobox.eq-column"):c.querySelector(".eq-combobox>.eq-column");if(!k)throw Error("ComboBox.setAttr BUG: boxSize, no column");(k=k.style).maxWidth=n?n:"";k.maxHeight=l?l:"";break;case e.autocomplete:(l=l.v)?(this.tc={rule:l.r,delay:l.d,lmin:l.m,llast:eq.Dom.inputElement(c).value.length,tid:0},c.oninput=eq.c.ComboBox.onInput):(this.tc=null,c.oninput=null);break;case e.dndMode:k=eq.Dom.inputElement(c);
(this.dndMode=l.i)?k.ondragstart=a.constructor.onDragStart:k.ondragstart=null;break;case e.dropRule:k=eq.Dom.inputElement(c);n=eq.c.ComboBox;(this.dropRule=l.i)||this.globalDropRule?(l=a.constructor,k.ondragover=n.onDragOver,k.ondrop=l.onDrop):(k.ondragover=null,k.ondrop=null);break;case e.globalDropRule:k=eq.Dom.inputElement(c);n=eq.c.ComboBox;(this.globalDropRule=l.i)||this.dropRule?(l=a.constructor,k.ondragover=n.onDragOver,k.ondrop=l.onDrop):(k.ondragover=null,k.ondrop=null);break;default:f?f.push(l):
f=[l]}}f&&eq.c.DlgElement.prototype.setAttr.call(this,a,b,c,f)};eq.c.ComboBox.prototype.setSensitive=function(a,b,c,d){eq.Dom.inputElement(c).disabled=!d;eq.c.DlgElement.prototype.setSensitive.call(this,a,b,c,d)};
eq.c.ComboBox.prototype.onKey=function(a,b,c,d,e,f){if(e)return!1;a=eq.c.ComboBox;b=eq.Dom;var g=c.querySelector(".eq-combobox>.eq-column");switch(d){case "Enter":return!g&&(eq.app.closeOverlay(c,!0),c.classList.contains("eq-noenter"))?(b.consumeEvent(f),!0):!1;case "Escape":case "Esc":return g||eq.app.closeOverlay(c,!1),b.consumeEvent(f),!0;case "PageUp":case "PageDown":case "ArrowUp":case "Up":case "ArrowDown":case "Down":if(g){a.open(c,g);var h=0}break;case "ArrowLeft":case "Left":case "ArrowRight":case "Right":return!0;
default:return!e&&1===d.length}var l;if((g=document.body.querySelector("body>.eq-combobox.eq-column"))&&(l=g.children).length){if(void 0===h)switch(d){case "PageUp":var k=l[0];break;case "PageDown":k=l[l.length-1];break;case "ArrowUp":case "Up":h=-1;break;case "ArrowDown":case "Down":h=1}void 0!==h&&((k=g.querySelector(".eq-column>.eq-selected"))?(d=b.parentIndex(k),e=l.length,-1===(d+=h)?d=0:d>=e&&(d=e-1),k=l[d]):k=l[0]);void 0!==k&&a.select(c,g,k)}b.consumeEvent(f);return!0};
eq.c.ComboBox.prototype.onTypeAhead=function(a,b,c,d){if(1===d.length){a=eq.Dom.inputElement(c);var e=a.maxLength,f=a.value,g=f.length,h;if(e&&0<e&&g>=e)return!0;e=a.selectionStart;var l=a.selectionEnd;f=0<e?l<g?f.substring(0,e)+d+f.substring(l):f.substring(0,e)+d:l<g?d+f.substring(l):d;a.value=f;(h=this.tc)&&this.textChanged(c,a,h);eq.app.setChanged(b,"input");return!0}return eq.c.DlgElement.prototype.onTypeAhead.call(this,a,b,c,d)};
eq.c.ComboBox.prototype.onChange=function(a,b,c,d){var e="pointerdown"===d.type;if(e||"mousedown"===d.type){a=eq.c.ComboBox;var f=eq.app,g=d.target,h;if(g&&g.classList.contains("eq-button")){if((h=c.classList).contains("eq-disabled"))return!1;if(h.contains("eq-focus")&&f.setFocus(b,c))return f.pendingFocus={id:b,act:a.open},!1;if(h.contains("eq-empty"))return!1;e=c.querySelector(".eq-combobox>.eq-column");b={el:c,a:g};g.classList.add("eq-click");e?a.open(c,b.c=e):b.close=!0;f.moveCapture(b,a.move,
a.move.done);eq.Dom.consumeEvent(d);return!1}if((h=c.classList).contains("eq-open")){b={el:c};var l={};g=a.line(g,l);if(l.c){a.select(c,b.c=l.c,g);if(e)return!0;if(h.contains("eq-rule"))return(e=(d=a.open).ctx)?(e.cnt++,f.closeOverlay(c,!0)):d.ctx={el:c,cnt:1,t:window.setTimeout(a.close.ctx,eq.c.App.doubleClick.tv)},!0;b.close=!0}f.moveCapture(b,a.move,a.move.done);if(c!==l.ct)return eq.Dom.consumeEvent(d),!1}}return!0};
eq.c.ComboBox.prototype.onDragStart=function(a,b,c,d,e,f){a=this.dndMode;c=eq.Dnd;var g;if(a&c.local){if((g=d.selectionEnd)<=(c=d.selectionStart))return!1;f.drag={id:b,content:d.value.substring(c,g)};(this.dnd=f).ch.push(b);eq.c.DlgElement.setDropModes(e,a);return!0}return a&c.global?(eq.c.DlgElement.setDropModes(e,c.all),!0):!1};eq.c.ComboBox.onDragOver=function(a){a.preventDefault();var b,c,d;(b=eq.app.dnd)&&(c=b.drag)&&(d=c.over)&&(c.over=null,d.classList.remove("eq-dragover"))};
eq.c.ComboBox.prototype.onDrop=function(a,b,c,d,e){e.drop.pos=eq.Dom.inputElement(c).selectionStart;(this.dnd=e).ch.push(e.drop.id=b);return e.drag?this.dropRule:this.globalDropRule};eq.c.ComboBox.prototype.focusElement=function(a,b){a=eq.Dom.inputElement(b);a.onfocus=b.classList.contains("eq-auto")?eq.c.ComboBox.onFocus:null;return a};eq.c.ComboBox.prototype.focusGained=function(a,b){void 0===eq.app.pendingMouseDown&&b!==document.activeElement&&(b.select(),b.scrollLeft=b.scrollWidth)};
eq.c.ComboBox.prototype.focusLost=function(a,b){b.classList.contains("eq-open")&&eq.app.closeOverlay(b);a=eq.Dom.inputElement(b);a.selectionStart=a.selectionEnd=0;a.blur()};
eq.c.ComboBox.prototype.changed=function(a,b,c,d){a=[];for(var e=0,f=d.length;e<f;e++)switch(d[e]){case "input":a.push({ty:eq.RsValType.textValue,sv:c.value});break;case "dnd":var g=this.dnd,h,l,k,n;g&&((h=g.drag)&&h.id===b&&void 0!==(k=h.content)&&(h.content=null,a.push({ty:eq.RsValType.dragContent,sv:k})),(l=g.drop)&&l.id===b&&void 0!==(n=l.pos)&&a.push({ty:eq.RsValType.dropPos,iv:n}))}this.dnd=null;switch(a.length){case 0:return null;case 1:return a[0].id=b,a[0];default:return{id:b,v:a}}};
eq.c.ComboBox.prototype.onClipboardMenu=function(a,b,c,d,e,f){return eq.c.DlgElement.onClipboardMenu(a,b,c.firstElementChild,d,e,f)};eq.c.DlgElement.addClass("Dialog",function(a,b){eq.c.DlgElement.call(this,a,b);this.dnd=null;this.globalDropRule=this.dropRule=0});eq.c.Dialog.prototype.dispose=function(a,b){this.dnd=null;eq.c.DlgElement.prototype.dispose.call(this,a,b)};
eq.c.Dialog.prototype.setAttr=function(a,b,c,d){for(var e=eq.RqTag,f,g=a.constructor,h=0,l=d.length;h<l;h++){var k=d[h];switch(k.t){case e.dropRule:(this.dropRule=k.i)||this.globalDropRule?(c.ondragover=g.onDragOver,c.ondrop=g.onDrop):(c.ondragover=null,c.ondrop=null);break;case e.globalDropRule:(this.globalDropRule=k.i)||this.dropRule?(c.ondragover=g.onDragOver,c.ondrop=g.onDrop):(c.ondragover=null,c.ondrop=null);break;default:f?f.push(k):f=[k]}}f&&eq.c.DlgElement.prototype.setAttr.call(this,a,b,
c,f)};eq.c.Dialog.prototype.onDrop=function(a,b,c,d,e){(this.dnd=e).ch.push(b);return e.drag?this.dropRule:this.globalDropRule};
eq.c.Dialog.prototype.changed=function(a,b,c,d){a=[];c=0;for(var e=d.length;c<e;c++)switch(d[c]){case "dnd":var f=this.dnd,g,h,l;f&&((g=f.drag)&&void 0!==(h=g.id)&&(g.id=null,a.push({ty:eq.RsValType.dragFrom,sv:h})),f=f.drop)&&(void 0!==(h=f.content)&&(f.content=null,a.push({ty:eq.RsValType.dropContent,sv:h})),void 0!==(l=f.action)&&a.push({ty:eq.RsValType.dropAction,iv:l}))}this.dnd=null;switch(a.length){case 0:return null;case 1:return a[0].id=b,a[0];default:return{id:b,v:a}}};
eq.c.DlgElement.addClass("EditText",function(a,b){eq.c.DlgElement.call(this,a,b);this.hardWrap=!1;this.autoTab=0;this.dnd=this.tc=this.ff=null;this.globalDropRule=this.dropRule=this.dndMode=0;this.ignoreNextBlur=!1});eq.c.EditText.prototype.dispose=function(a,b){this.dnd=this.tc=this.ff=null;eq.c.DlgElement.prototype.dispose.call(this,a,b)};
eq.c.EditText.onInput=function(a){var b,c,d,e,f,g,h;"INPUT"===(a=a.target).tagName&&(c=(b=eq.app).currDlg)&&(e=c.eds.get(d=this.id))&&((f=e.tc)&&e.textChanged(this,a,f),(f=e.autoTab)&1&&0<(g=a.maxLength)&&a.value.length>=g&&(h=c.nextTab(d,!1))&&(f&4&&(e.ignoreNextBlur=!0,eq.Dom.onNextCycle(eq.c.EditText.nextEventCycle,this)),b.setFocus(h.id,h)))};
eq.c.EditText.prototype.textChanged=function(a,b,c){b=b.value.length;var d=c.llast;if(b<d||b>d&&b>=c.lmin)d=eq.app,c.tid&&d.dialogTimers.cancel(c.tid),c.tid=d.dialogTimers.add(c.delay,eq.c.EditText.onAutoComplete,null,{self:this,el:a});c.llast=b};eq.c.EditText.onAutoComplete=function(a){var b=a.el.id,c=eq.app;c.onceRule=a.self.tc.rule;c.onceId=b;c.submit(a.el,{id:b,type:"timer"})};
eq.c.EditText.prototype.wrapCols=function(a,b,c){if(this.hardWrap){a=c.firstElementChild;var d;if(b=a.getBoundingClientRect().width){c=eq.c.EditText.getFontSizeTemplate();eq.Dom.copyFont(c,a);(d=document.body).appendChild(c);var e=c.getBoundingClientRect();if(e=e.width)a.cols=Math.floor(b/e);d.removeChild(c)}}};
eq.c.EditText.prototype.fitFont=function(a,b,c){if(a=this.ff){b=document.body;var d=eq.c.EditText.getFontSizeTemplate(),e=c.firstElementChild,f=e.style;c=c.style;var g,h;eq.Dom.copyFont(d,e);b.appendChild(d);e=d.getBoundingClientRect();(g=e.width)&&(h=a.w)&&(f.width=h*g+"px",c.width="");(g=e.height)&&(h=a.h)&&(f.height=h*g+"px",c.height="");b.removeChild(d)}};
eq.c.EditText.getFontSizeTemplate=function(){var a=this.fontSizeTemplate;void 0===a&&(this.fontSizeTemplate=a=document.createElement("DIV"),a.className="eq-grid",a.textContent="X",a.style.zIndex=eq.Dom.zIndex(document.body)-1);return a.cloneNode(!0)};
eq.c.EditText.prototype.setAttr=function(a,b,c,d){for(var e=eq.RqTag,f,g=0,h=d.length;g<h;g++){var l=d[g];switch(l.t){case e.multiline:this.hardWrap=!1;this.autoTab=0;this.tc=this.ff=null;break;case e.content:var k=this.tc;k&&(k.llast=l.l);break;case e.wrapmode:(this.hardWrap=!!l.b)?this.whenVisible(a,b,c,this.wrapCols):c.firstElementChild.removeAttribute("cols");break;case e.fitfont:(l=l.ff)?(this.ff=l,this.whenVisible(a,b,c,this.fitFont)):(l=c.firstElementChild.style,l.width=l.height="",this.ff=
null);break;case e.autocomplete:l=l.v;var n;l&&"INPUT"===(n=c.firstElementChild).tagName?(this.tc={rule:l.r,delay:l.d,lmin:l.m,llast:n.value.length,tid:0},c.oninput=eq.c.EditText.onInput):(this.tc=null,c.oninput=null);break;case e.autotab:(this.autoTab=l.i)?c.oninput=eq.c.EditText.onInput:c.oninput=null;break;case e.dndMode:n=c.firstElementChild;(this.dndMode=l.i)?n.ondragstart=a.constructor.onDragStart:n.ondragstart=null;break;case e.dropRule:n=c.firstElementChild;k=eq.c.EditText;(this.dropRule=
l.i)||this.globalDropRule?(l=a.constructor,n.ondragover=k.onDragOver,n.ondrop=l.onDrop):(n.ondragover=null,n.ondrop=null);break;case e.globalDropRule:n=c.firstElementChild;k=eq.c.EditText;(this.globalDropRule=l.i)||this.dropRule?(l=a.constructor,n.ondragover=k.onDragOver,n.ondrop=l.onDrop):(n.ondragover=null,n.ondrop=null);break;default:f?f.push(l):f=[l]}}f&&eq.c.DlgElement.prototype.setAttr.call(this,a,b,c,f)};
eq.c.EditText.prototype.setSensitive=function(a,b,c,d){var e=c.getElementsByTagName("INPUT");0===e.length&&(e=c.getElementsByTagName("TEXTAREA"));if(1!==e.length)throw Error("BUG: EditText.setSensitive id:"+c.id+" elements:"+e.length+", expected: 1");e[0].disabled=!d;eq.c.DlgElement.prototype.setSensitive.call(this,a,b,c,d)};eq.c.EditText.prototype.onEvent=function(a,b,c,d){return"blur"!==d.type||!this.ignoreNextBlur};eq.c.EditText.nextEventCycle=function(a){a.ignoreNextBlur=!1};
eq.c.EditText.prototype.onKey=function(a,b,c,d,e,f){if(e)return!1;switch(d){case "ArrowUp":case "Up":case "ArrowDown":case "Down":return 0!=c.getElementsByTagName("TEXTAREA").length;case "Backspace":case "ArrowLeft":case "Left":d=this.autoTab;var g,h;d&2&&(g=c.firstElementChild)&&0===g.selectionStart&&(h=a.nextTab(b,!0))&&(a=eq.Dom,d&4&&(this.ignoreNextBlur=!0,a.onNextCycle(eq.c.EditText.nextEventCycle,this)),eq.app.setFocus(h.id,h),a.consumeEvent(f));return!0;case "ArrowRight":case "Right":return d=
this.autoTab,d&1&&(g=c.firstElementChild)&&g.selectionStart>=g.maxLength&&g.value.length&&(h=a.nextTab(b,!1))&&(a=eq.Dom,d&4&&(this.ignoreNextBlur=!0,a.onNextCycle(eq.c.EditText.nextEventCycle,this)),eq.app.setFocus(h.id,h),a.consumeEvent(f)),!0}return!e&&1===d.length};
eq.c.EditText.prototype.onTypeAhead=function(a,b,c,d){var e=c.firstElementChild,f;switch(d){case "Enter":"TEXTAREA"===e.tagName&&(f="\n");break;default:1===d.length&&(f=d)}if(void 0!==f){var g=e.maxLength;a=e.value;d=a.length;var h;if(g&&0<g&&d>=g)return!0;g=e.selectionStart;var l=e.selectionEnd;a=0<g?l<d?a.substring(0,g)+f+a.substring(l):a.substring(0,g)+f:l<d?f+a.substring(l):f;e.value=a;"TEXTAREA"===e.tagName?e.textContent=a:(h=this.tc)&&this.textChanged(c,e,h);eq.app.setChanged(b,"input");return!0}return eq.c.DlgElement.prototype.onTypeAhead.call(this,
a,b,c,d)};eq.c.EditText.prototype.onDragStart=function(a,b,c,d,e,f){a=this.dndMode;c=eq.Dnd;var g;if(a&c.local){if((g=d.selectionEnd)<=(c=d.selectionStart))return!1;f.drag={id:b,content:d.value.substring(c,g)};(this.dnd=f).ch.push(b);eq.c.DlgElement.setDropModes(e,a);return!0}return a&c.global?(eq.c.DlgElement.setDropModes(e,c.all),!0):!1};eq.c.EditText.onDragOver=function(a){a.preventDefault();var b,c,d;(b=eq.app.dnd)&&(c=b.drag)&&(d=c.over)&&(c.over=null,d.classList.remove("eq-dragover"))};
eq.c.EditText.prototype.onDrop=function(a,b,c,d,e){e.drop.pos=c.firstElementChild.selectionStart;(this.dnd=e).ch.push(e.drop.id=b);return e.drag?this.dropRule:this.globalDropRule};eq.c.EditText.prototype.focusElement=function(a,b){a=b.getElementsByTagName("INPUT");0===a.length&&(a=b.getElementsByTagName("TEXTAREA"));if(1!==a.length)throw Error("BUG: EditText.focusElement id:"+b.id+" elements:"+a.length+", expected: 1");return a[0]};
eq.c.EditText.prototype.focusGained=function(a,b){void 0===eq.app.pendingMouseDown&&b!==document.activeElement&&("INPUT"===b.tagName?(b.select(),b.scrollLeft=b.scrollWidth):b.selectionStart=b.selectionEnd=0)};eq.c.EditText.prototype.focusLost=function(a,b){a=b.firstElementChild;"INPUT"===a.tagName&&(a.selectionStart=a.selectionEnd=0);a.blur()};
eq.c.EditText.prototype.changed=function(a,b,c,d){a=[];for(var e=0,f=d.length;e<f;e++)switch(d[e]){case "input":a.push({ty:eq.RsValType.textValue,sv:c.value});break;case "blur":var g=c.selectionStart;0<=g&&a.push({ty:eq.RsValType.caretPos,iv:g});break;case "dnd":var h=this.dnd,l,k,n;h&&((l=h.drag)&&l.id===b&&void 0!==(n=l.content)&&(l.content=null,a.push({ty:eq.RsValType.dragContent,sv:n})),(k=h.drop)&&k.id===b&&void 0!==(g=k.pos)&&a.push({ty:eq.RsValType.dropPos,iv:g}))}this.dnd=null;switch(a.length){case 0:return null;
case 1:return a[0].id=b,a[0];default:return{id:b,v:a}}};eq.c.EditText.prototype.onClipboardMenu=function(a,b,c,d,e,f){return eq.c.DlgElement.onClipboardMenu(a,b,c.firstElementChild,d,e,f)};eq.c.DlgElement.addClass("GroupBox",function(a,b){eq.c.DlgElement.call(this,a,b);this.attrAccel=null;this.globalDropRule=this.dropRule=0;this.scrl=null});
eq.c.GroupBox.prototype.dispose=function(a,b){var c=this.attrAccel;if(null!==c){var d=a.accel;d.get(c)===b&&d.delete(c);this.attrAccel=null}eq.c.DlgElement.prototype.dispose.call(this,a,b)};eq.c.GroupBox.prototype.updateId=function(a,b,c){var d=this.attrAccel;if(null!==d){var e=a.accel;e.get(d)===c&&e.set(d,b)}eq.c.DlgElement.prototype.updateId.call(this,a,b,c)};
eq.c.GroupBox.scroll=function(a,b){if(!eq.app.idle&&a.offsetWidth&&a.offsetHeight&&a.getClientRects().length){b.self.scrl=null;a.dataset.scroll="ignore";var c;0<=(c=b.left)&&(a.scrollLeft=c);0<=(c=b.top)&&(a.scrollTop=c)}else eq.Dom.onNextFrame(a,b)};eq.c.GroupBox.onScroll=function(a){if("scroll"in this.dataset)delete this.dataset.scroll;else{a=this.parentNode;var b;a&&(b=a.classList)&&b.contains("eq-groupbox")&&eq.app.setChanged(a.id,"scroll")}};
eq.c.GroupBox.prototype.setAttr=function(a,b,c,d){for(var e=eq.RqTag,f,g=0,h=d.length;g<h;g++){var l=d[g];switch(l.t){case e.vx:var k=this.scrl,n=eq.c.GroupBox;k?k.left=l.i:k=this.scrl={cb:n.scroll,self:this,left:l.i,top:-1};n.scroll(c.lastElementChild,k);break;case e.vy:k=this.scrl;n=eq.c.GroupBox;k?k.top=l.i:k=this.scrl={cb:n.scroll,self:this,left:-1,top:l.i};n.scroll(c.lastElementChild,k);break;case e.vWidth:case e.vHeight:l.s?(c.classList.add("eq-scroll"),c.lastElementChild.onscroll=eq.c.GroupBox.onScroll):
(c.classList.remove("eq-scroll"),c.lastElementChild.onscroll=null);break;case e.text:k=l.v;n=c.firstElementChild;l=c.classList;if(k){if(!n||!n.classList.contains("eq-title")){n=document.createElement("DIV");n.className="eq-rt eq-title";n.appendChild(document.createElement("DIV"));var m=document.createElement("SPAN");m.className="eq-fn";n.appendChild(m);n.appendChild(document.createElement("DIV"));c.insertBefore(n,c.firstElementChild)}k=eq.Dom.setContent(n.children[1],k,!0);this.setAccel(a,b,k,eq.KeyMod.alt);
l.add("eq-title")}else n&&n.classList.contains("eq-title")&&(c.removeChild(n),l.remove("eq-title"));break;case e.accel:n=this.attrAccel;k=eq.Dom.decodeAccelAttr(l.v);k!==n&&(l=a.accel,null!==n&&l.get(n)===b&&l.delete(n),null===k||l.has(k)?this.attrAccel=null:l.set(this.attrAccel=k,b));break;case e.dropRule:k=c.lastElementChild;(this.dropRule=l.i)||this.globalDropRule?(l=a.constructor,k.ondragover=l.onDragOver,k.ondrop=l.onDrop):(k.ondragover=null,k.ondrop=null);break;case e.globalDropRule:k=c.lastElementChild;
(this.globalDropRule=l.i)||this.dropRule?(l=a.constructor,k.ondragover=l.onDragOver,k.ondrop=l.onDrop):(k.ondragover=null,k.ondrop=null);break;default:f?f.push(l):f=[l]}}f&&eq.c.DlgElement.prototype.setAttr.call(this,a,b,c,f)};
eq.c.GroupBox.prototype.onAccel=function(a,b,c){if((b=eq.Dom.eqControl(c.parentNode))&&b.classList.contains("eq-tabbox")){a=a.eds.get(b.id);if(void 0===a)throw Error("GroupBox.onAccel("+c.id+") BUG: TabBox "+b.id+" not registered");a.onTabAccel(b,c)}else(c=c.querySelector(".eq-focus:not(.eq-disabled)"))&&eq.app.setFocus(c.id,c)};eq.c.GroupBox.prototype.onDrop=function(a,b,c,d,e){return e.drag?this.dropRule:this.globalDropRule};
eq.c.GroupBox.prototype.changed=function(a,b,c,d){return{id:b,ty:eq.RsValType.scrollPos,x:c.scrollLeft,y:c.scrollTop}};eq.c.DlgElement.addClass("HtmlView",function(a,b){eq.c.DlgElement.call(this,a,b);this.dnd=null;this.globalDropRule=this.dropRule=this.dndMode=0});eq.c.HtmlView.re=/^eloq:([0-9]*)(\/(.*))?$/i;eq.c.HtmlView.ctx=new Map;eq.c.HtmlView.timeout=void 0;eq.c.HtmlView.prototype.dispose=function(a,b){this.dnd=null;eq.c.DlgElement.prototype.dispose.call(this,a,b)};
eq.c.HtmlView.startTimeout=function(){void 0!==this.timeout&&window.clearTimeout(this.timeout);this.timeout=window.setTimeout(this.timeoutElapsed,1E4)};eq.c.HtmlView.timeoutElapsed=function(){var a=eq.c.HtmlView;a.timeout=void 0;a.ctx.clear()};
eq.c.HtmlView.ready=function(){var a=eq.c.HtmlView,b=this.name,c=a.ctx.get(b);if(c){var d=c.self;var e=c.url;var f=c.cn;a.ctx.delete(b)}try{var g=this.contentWindow,h=g.document,l=h.body;g.name=b;f&&(l.style.margin="0",eq.Dom.setHtmlContent(f,l,h.head));var k=l.querySelectorAll('a[href^="eloq:"]');c=0;for(var n=k.length;c<n;c++){var m=k[c];m.dataset.eqLink=m.href;m.href="#";m.addEventListener("click",a.clicked)}d&&d.dndUpdate(b,this)}catch(p){console.warn("HtmlView:"+b+(e?" '"+e+"' ":" ")+p.name+
": "+p.message)}};eq.c.HtmlView.clicked=function(a){var b=a.view.name,c,d;b&&(c=document.getElementById(b))&&(d=this.dataset.eqLink)&&eq.c.HtmlView.submit(b,c,d);a.preventDefault();a.stopImmediatePropagation()};
eq.c.HtmlView.submit=function(a,b,c){if(!b.classList.contains("eq-disabled")){var d=eq.app;c=this.re.exec(c);var e;if(c&&(0<c.length&&c[1].length&&(e=c[1]),2<c.length&&c[3]))try{b.dataset.eqLink=decodeURIComponent(c[3])}catch(f){delete b.dataset.eqLink}d.setChanged(a,"change");if(void 0!==e||b.classList.contains("eq-rule"))void 0!==e&&(d.onceRule=e,d.onceId=a),d.submit(b,{id:a,type:"change"})}};eq.c.HtmlView.prototype.onMessage=function(a,b,c,d){eq.c.HtmlView.submit(b,c,d)};
eq.c.HtmlView.createFrame=function(a){var b=document.createElement("IFRAME");b.name=a;b.onload=this.ready;return b};
eq.c.HtmlView.prototype.setAttr=function(a,b,c,d){for(var e=eq.c.HtmlView,f=eq.RqTag,g,h=0,l=d.length;h<l;h++){var k=d[h];switch(k.t){case f.url:var n=c.firstElementChild;n&&"IFRAME"!==n.tagName&&(c.removeChild(n),n=null);n||c.appendChild(n=e.createFrame(b));n.src=k.v;e.startTimeout();e.ctx.set(b,{self:this,dlg:a,url:k.v});break;case f.content:n=c.firstElementChild;switch(k.ty){case 0:n&&"IFRAME"!==n.tagName&&(c.removeChild(n),n=null);n||c.appendChild(n=e.createFrame(b));n.src="about:blank";e.startTimeout();
e.ctx.set(b,{self:this,dlg:a,cn:k.v});break;case 1:n&&"TEXTAREA"!==n.tagName&&(c.removeChild(n),n=null);n||(n=document.createElement("TEXTAREA"),n.className="eq-fn",n.readOnly=!0,n.wrap="off",n.autocapitalize="none",n.autocomplete="off",n.autocorrect="off",n.spellcheck=!1,c.appendChild(n));n.value=n.textContent=k.v;e.ctx.delete(b);this.dndUpdate(b,n);break;default:throw Error("HtmlView.setAttr: tag "+k.t+" invalid type "+k.ty);}break;case f.dndMode:this.dndMode=k.i;this.dndUpdate(b,c.firstElementChild);
break;case f.dropRule:this.dropRule=k.i;this.dndUpdate(b,c.firstElementChild);break;case f.globalDropRule:this.globalDropRule=k.i;this.dndUpdate(b,c.firstElementChild);break;default:g?g.push(k):g=[k]}}g&&eq.c.DlgElement.prototype.setAttr.call(this,a,b,c,g)};
eq.c.HtmlView.prototype.dndUpdate=function(a,b){if(b)try{if("IFRAME"===b.tagName)b=b.contentWindow;else if("TEXTAREA"!==b.tagName)throw Error("HtmlView.dndUpdate "+a+" invalid tagName:"+b.tagName);var c;b.ondragstart=this.dndMode?(c||(c=eq.c.Dlg)).onDragStart:null;this.dropRule||this.globalDropRule?(b.ondragover=eq.c.HtmlView.onDragOver,b.ondrop=(c||eq.c.Dlg).onDrop):(b.ondragover=null,b.ondrop=null)}catch(d){}};
eq.c.HtmlView.prototype.onDragStart=function(a,b,c,d,e,f){if(a=c.firstElementChild)try{if("IFRAME"===a.tagName){a=a.contentWindow;var g=a.getSelection().toString()}else{if("TEXTAREA"!==a.tagName)throw Error("HtmlView.onDragStart "+b+" invalid tagName:"+a.tagName);var h,l;(l=a.selectionEnd)>(h=a.selectionStart)&&(g=a.value.substring(h,l))}if(g){var k=this.dndMode,n=eq.Dnd;if(k&n.local)return f.drag={id:b,content:g},(this.dnd=f).ch.push(b),eq.c.DlgElement.setDropModes(e,k),!0;if(k&n.global)return eq.c.DlgElement.setDropModes(e,
n.all),!0}}catch(m){}return!1};eq.c.HtmlView.onDragOver=function(a){a.preventDefault();var b,c,d;(b=eq.app.dnd)&&(c=b.drag)&&(d=c.over)&&(c.over=null,d.classList.remove("eq-dragover"))};
eq.c.HtmlView.prototype.onDrop=function(a,b,c,d,e){if(a=c.firstElementChild)try{if("IFRAME"===a.tagName){for(;d&&!d.id;)d=d.parentNode;d&&(e.drop.element=d.id);e.drop.pos=0}else{if("TEXTAREA"!==a.tagName)throw Error("HtmlView.onDrop "+b+" invalid tagName:"+a.tagName);e.drop.pos=a.selectionStart}(this.dnd=e).ch.push(e.drop.id=b);return e.drag?this.dropRule:this.globalDropRule}catch(f){}return 0};
eq.c.HtmlView.prototype.changed=function(a,b,c,d){a=[];for(var e=0,f=d.length;e<f;e++)switch(d[e]){case "change":var g=c.dataset.eqLink;g&&delete c.dataset.eqLink;a.push({ty:eq.RsValType.textValue,sv:g||""});break;case "dnd":var h=this.dnd,l,k,n;h&&((l=h.drag)&&l.id===b&&void 0!==(g=l.content)&&(l.content=null,a.push({ty:eq.RsValType.dragContent,sv:g})),(k=h.drop)&&k.id===b&&(void 0!==(n=k.pos)&&a.push({ty:eq.RsValType.dropPos,iv:n}),void 0!==(g=k.element)&&(k.element=null,a.push({ty:eq.RsValType.dropElement,
sv:g}))))}this.dnd=null;switch(a.length){case 0:return null;case 1:return a[0].id=b,a[0];default:return{id:b,v:a}}};eq.c.DlgElement.addClass("ListBox",function(a,b){eq.c.DlgElement.call(this,a,b);this.activeCol=0;this.dnd=this.ttLine=this.ttHeader=this.lineOrder=null;this.globalDropRule=this.dropRule=this.dndMode=0});
eq.c.ListBox.prototype.dispose=function(a,b){var c;null!==(c=this.lineOrder)&&(c.length=0,this.lineOrder=null);null!==(c=this.ttHeader)&&(c.length=0,this.ttHeader=null);null!==(c=this.ttLine)&&(c.length=0,this.ttLine=null);this.dnd=null;eq.c.DlgElement.prototype.dispose.call(this,a,b)};eq.c.ListBox.adjustElementTemplate=function(a){for(;a;){var b=a.ev,c,d;b&&(c=b.c)&&-1!==(d=c.indexOf("mousedown"))&&c.splice(d,0,"pointerdown");a=a.et}};
eq.c.ListBox.select=function(a,b){for(var c=a.querySelectorAll(".eq-column>.eq-selected"),d=0,e=c.length;d<e;d++)c[d].classList.remove("eq-selected");if(void 0!==b)for(c=a.querySelectorAll(".eq-column"),d=0,e=c.length;d<e;d++)a=c[d].children,b<a.length&&a[b].classList.add("eq-selected")};
eq.c.ListBox.scrollIntoView=function(a,b){var c=a.querySelector(".eq-column").children;if(b<c.length){var d=c[0].parentNode.parentNode;var e=d.getBoundingClientRect().height;var f=c[0].getBoundingClientRect().height;if(0<e&&0<f){var g=d.scrollTop;b=c[b].offsetTop;if(b<g){d.scrollTop=b;var h=eq.app}else b+f>g+e&&(d.scrollTop=Math.ceil(b+f-e+2),h=eq.app);h&&h.setChanged(a.id,"scroll")}}};
eq.c.ListBox.onScroll=function(){if("scroll"in this.dataset)delete this.dataset.scroll;else eq.Dom.onNextFrame(this,{cb:eq.c.ListBox.onScroll.exec})};eq.c.ListBox.onScroll.exec=function(a){var b=a.classList,c;b&&b.contains("eq-pane")&&(c=a.parentNode)&&(b=c.classList)&&b.contains("eq-listbox")&&(eq.app.setChanged(c.id,"scroll"),b.contains("eq-multi")&&(b=a.previousElementSibling))&&(b.style.marginLeft="-"+a.scrollLeft+"px")};
eq.c.ListBox.setTopItem=function(a,b){var c=a.querySelector(".eq-column"),d=c.children,e=c.parentNode,f=0;if(1<d.length){var g,h,l;if(eq.app.idle||0>=(g=c.getBoundingClientRect().height)||0>=(h=e.getBoundingClientRect().height)||0>=(l=d[0].getBoundingClientRect().height)){eq.Dom.onNextFrame(a,b);return}if(0<(a=g-h)){c=b.li;var k,n;null!==(k=b.self.lineOrder)&&(c=-1===(n=k.indexOf(c))?0:n);0<l&&(f=c*l)>a&&(f=Math.ceil(a+2))}}e.dataset.scroll="ignore";e.scrollTop=f};
eq.c.ListBox.prototype.setAutoWidth=function(a,b,c){eq.Dom.onNextFrame(c,{cb:eq.c.ListBox.execAutoWidth,dlg:a})};
eq.c.ListBox.execAutoWidth=function(a,b){for(var c=a.firstElementChild.children,d=a.lastElementChild.children,e=2*b.dlg.grid.wr,f=0,g=0,h=d.length;f<h;f++){var l;if((l=d[f]).classList.contains("eq-auto")){var k=Number(window.getComputedStyle(l).width.replace(/px$/,""));if(isNaN(k)){if(0!==g)throw Error("ListBox.execAutoWidth BUG: column["+f+"] width NaN, autowidth:"+g);eq.Dom.onNextFrame(a,b);break}var n=c[f];var m=Number(window.getComputedStyle(n).width.replace(/px$/,""));if(isNaN(m))throw Error("ListBox.execAutoWidth BUG: header["+
f+"] width NaN, autowidth:"+g);m>k&&(k=m);k<e&&(k=e);n.style.width=l.style.width=k+"px";g++}}};eq.c.ListBox.colResize=function(a,b){b.busy||(b.busy=!0,eq.Dom.onNextFrame(b.el,{cb:eq.c.ListBox.colResize.exec,x:a.clientX,m:b}))};eq.c.ListBox.colResize.exec=function(a,b){a=b.x;b=b.m;if(a!==b.x){var c=b.h,d=b.c,e=b.w+a-b.x,f=2*b.dlg.grid.wr;e>=f?(c.style.width=d.style.width=e+"px",b.x=a,b.w=e):(c.style.width=d.style.width=f+"px",b.x-=b.w-f,b.w=f);b.modified=!0}b.busy=void 0};
eq.c.ListBox.colResize.done=function(a){if(a.modified){var b=eq.app,c=a.el.id;b.setChanged(c,"resize");b.apiUpdate(c,eq.UpdateTag.colResized,{col:eq.Dom.parentIndex(a.h),width:a.w})}return!1};eq.c.ListBox.colMove=function(a,b){b.busy||(b.busy=!0,eq.Dom.onNextFrame(b.el,{cb:eq.c.ListBox.colMove.exec,x:a.clientX,m:b}))};
eq.c.ListBox.colMove.exec=function(a,b){a=b.m;var c=a.el.getElementsByClassName("eq-space");b=b.x;var d=a.cw,e=a.x,f=a.lx,g=a.f,h=a.t,l,k,n;if(2===c.length){0>(l=f+b-e)&&(l=0,b=e-f);if(l>f)var m=a.ow;else if(l<f)m=0;else{a.busy=void 0;return}m+=l;e=k=0;for(f=d.length;e<f;e++){var p=e===h?d[g]:e>=g&&e<h?d[e+1]:d[e];k+=p;if(m<k-p/2)break}for(d=0;2>d;d++)g=(n=c[d]).parentNode,e<f?g.insertBefore(n,g.children[e]):g.appendChild(n);a.t=eq.Dom.parentIndex(n);a.ob.style.left=(a.lx=l)+"px";a.x=b}a.busy=void 0};
eq.c.ListBox.colMove.done=function(a){var b=eq.app,c=a.el,d=a.f,e=a.t,f;b.closeOverlay(c);e!==d&&(c=c.id,b.setChanged(c,"move"),b.apiUpdate(c,eq.UpdateTag.colMoved,{from:d,to:e}),null!==(f=a.self.ttHeader)&&f.splice(e,0,f.splice(d,1)[0]));return!1};
eq.c.ListBox.colMove.closeOverlay=function(a,b){a=a.getElementsByClassName("eq-space");var c=b.firstElementChild,d;if(2!==a.length)throw Error("ListBox.colMove.closeOverlay BUG: "+a.length+" eq-space elements");var e=a[0];e.parentNode.replaceChild(c.firstElementChild.firstElementChild,e);e=a[0];e.parentNode.replaceChild(c.lastElementChild.firstElementChild,e);(d=c.id)&&eq.app.removeStyles(d);b.parentNode.removeChild(b)};
eq.c.ListBox.prototype.setAttr=function(a,b,c,d){for(var e=eq.c.ListBox,f=eq.app,g=eq.Dom,h=eq.RqTag,l,k=0,n=d.length;k<n;k++){var m=d[k];switch(m.t){case h.columns:var p,q=c.classList;null!==(p=this.lineOrder)&&(p.length=0,this.lineOrder=null);null!==(p=this.ttHeader)&&(p.length=0,this.ttHeader=null);if(0===m.l)if(q.contains("eq-single"))c.firstElementChild.firstElementChild.textContent="";else{c.textContent="";q.remove("eq-multi");q.add("eq-single");var r=document.createElement("DIV");r.className=
"eq-pane";r.onscroll=e.onScroll;p=document.createElement("DIV");p.className="eq-column";r.appendChild(p);c.appendChild(r)}else if(q.contains("eq-multi"))c.firstElementChild.textContent="",c.lastElementChild.textContent="";else{c.textContent="";q.remove("eq-single");q.add("eq-multi");var t=document.createElement("DIV");t.className="eq-caption";r=document.createElement("DIV");r.className="eq-pane";r.onscroll=e.onScroll;c.appendChild(t);c.appendChild(r)}break;case h.colOrder:m=m.m;var u=m.length;t=c.firstElementChild;
var v=t.children;r=c.lastElementChild;var y=r.children,w=this.ttHeader;for(q=0;q<u;q++)(p=m[q])!==q&&(t.insertBefore(v[p],v[q]),r.insertBefore(y[p],y[q]),null!==w&&w.splice(q,0,w.splice(p,1)[0]));break;case h.colState:w=eq.c.DlgElement;var B=m.s,x=m.uh;u=B.length;t=c.firstElementChild;v=t.children;r=c.lastElementChild;y=r.children;var E=eq.ColType,z,A,C,O;for(m=z=A=0;m<u;m++)if(null===(C=B[m]))z<v.length&&t.removeChild(v[z]),A<y.length&&r.removeChild(y[A]);else{z<v.length?q=(p=v[z]).firstElementChild:
(f.ttAttach(p=document.createElement("DIV")),p.appendChild(q=document.createElement("SPAN")),t.appendChild(p));z++;if(null!==C.w)p.style.width=C.w;else{p.style.width="";var L=!0}var F=q.style;w.setFont(q,C.fn);null!==C.bc&&(F.backgroundColor=C.bc);null!==C.fc&&(F.color=C.fc);p.className="";q=p.classList;C.movable&&q.add("eq-move");C.sizable&&q.add("eq-resize");C.sortable&&q.add("eq-sort");x&&q.add("eq-cmc");A<y.length?(p=y[A]).firstElementChild&&(O=!0):(p=document.createElement("DIV"),r.appendChild(p));
A++;p.className="eq-column";q=p.classList;switch(C.type){case E.colBoolean:q.add("eq-bool");break;case E.colBarGraph:q.add("eq-bar")}F=p.style;null!==C.w?F.width=C.w:(q.add("eq-auto"),F.width="");switch(C.align){case 0:F.textAlign="";break;case 1:F.textAlign="center";break;case 2:F.textAlign="right"}}L&&O&&this.whenVisible(a,b,c,this.setAutoWidth);break;case h.colTitle:q=m.ct;u=q.length;v=c.firstElementChild.children;var G;for(m=0;m<u;m++)void 0!==(G=q[m])&&G.length?g.setContent(v[m].firstElementChild,
G):v[m].firstElementChild.textContent=" ";break;case h.lineOrder:q=c.querySelector(".eq-selected");u=this.lineOrder;p=m.s;if(q){var D=g.parentIndex(q);if(null!==u){if(D>=u.length)throw Error("ListBox.setAttr lineOrder: selection "+D+" >= lineOrder "+u.length);D=u[D]}}null!==u&&(u.length=0);null!==(u=m.o)&&0===u.length&&(u=null);this.lineOrder=u;q&&(null!==u&&-1===(D=u.indexOf(D))&&q.classList.remove("eq-selected"),-1!==D&&(e.select(c,D),e.scrollIntoView(c,D)));if((t=c.firstElementChild).classList.contains("eq-caption")){y=
t.querySelectorAll(".eq-caption>.eq-up,.eq-caption>.eq-dn");u=y.length;for(m=0;m<u;m++)q=y[m].classList,q.remove("eq-up"),q.remove("eq-dn"),q.remove("eq-first"),q.remove("eq-second");if(u=p.length)for(r=t.children,v=r.length,m=0;m<u;m++)w=p[m],t=w.i,t<v&&(q=r[t].classList,w.d?q.add("eq-dn"):q.add("eq-up"),0===m?q.add("eq-first"):1===m&&q.add("eq-second"))}break;case h.toolTip:(this.toolTip=m.v)?f.ttAttach(c.lastElementChild):(f.ttDetach(c.lastElementChild),this.toolTip=null);break;case h.colToolTip:w=
this.ttHeader;null!==w&&(w.length=0);this.ttHeader=m.ctt;break;case h.content:y=c.querySelectorAll(".eq-column");B=y.length;p=m.c;u=this.lineOrder;D=(q=c.querySelector(".eq-selected"))?g.parentIndex(q):-1;w=this.ttLine;r=null!==w?w.length:0;E=this.dndMode;var M,I;if(B!==p.length)throw Error("ListBox.setAttr content: column count "+p.length+", expected: "+B);if(E)var H=eq.c.Dlg;(t=c.firstElementChild).classList.contains("eq-caption")||(t=null);for(z=0;z<B;z++){var J=(M=p[z])?M.length:0;if(null!==u&&
u.length<J)throw Error("ListBox.setAttr content: lineOrder "+u.length+", min. expected: "+J);A=y[z];J?F=(C=A.children).length:(A.textContent="",C=A.children,F=0);q=A.classList;q.contains("eq-auto")&&(L=!0,A.style.width="",t&&(t.children[z].style.width=""));for(v=0;v<J;v++){m=null!==u?u[v]:v;v<F?(x=C[v],(I=x.classList).remove("eq-active"),v===D?I.add("eq-selected"):I.remove("eq-selected"),E?(x.draggable=!0,x.ondragstart=H.onDragStart):(x.draggable=!1,x.ondragstart=null),null!==w&&m<r&&w[m]&&f.ttAttach(x)):
(x=document.createElement("DIV"),x.className=v===D?"eq-fn eq-selected":"eq-fn",I=x.classList,E&&(x.draggable=!0,x.ondragstart=H.onDragStart),A.appendChild(x),null!==w&&(m<r&&w[m]?f.ttAttach(x):f.ttDetach(x)));var N=x.style;G=M[m];q.contains("eq-bool")?("1"===G&&I.add("eq-active"),x.textContent=" ",N.backgroundSize=""):q.contains("eq-bar")?(N.backgroundSize=void 0!==G&&G.length?G+"% 100%":"0",x.textContent=" "):(void 0!==G&&G.length?g.setContent(x,G):x.textContent=" ",N.backgroundSize="")}for(;C.length>
J;)A.removeChild(A.lastElementChild)}L&&this.whenVisible(a,b,c,this.setAutoWidth);break;case h.lineToolTip:w=this.ttLine;r=null!==w?w.length:0;y=m.ltt;B=null!==y?y.length:0;u=this.lineOrder;x=null!==u?u.length:0;p=c.querySelectorAll(".eq-column");E=(q=p.length)?p[0].children.length:0;var K;for(v=0;v<E;v++){if(null===u)m=v;else{if(v>=x)continue;m=u[v]}if(z=null!==y&&m<B&&y[m])z=null===w||m>=r||!w[m];else if(null!==w&&m<r&&w[m])for(t=0;t<q;t++)v<(K=p[t].children).length&&f.ttDetach(K[v]);if(z)for(t=
0;t<q;t++)v<(K=p[t].children).length&&f.ttAttach(K[v])}null!==w&&(w.length=0);this.ttLine=y;break;case h.activeLine:w=m.i;if(0<w){w--;if(null!==(u=this.lineOrder)){if(-1===(v=u.indexOf(w))){e.select(c);break}w=v}e.select(c,w);e.scrollIntoView(c,w)}else e.select(c);break;case h.vActiveLine:w=m.i;0<w?(e.select(c,--w),e.scrollIntoView(c,w)):e.select(c);break;case h.topItem:e.setTopItem(c,{cb:e.setTopItem,self:this,li:m.i});break;case h.dndMode:y=c.querySelectorAll(".eq-column>div");if(this.dndMode=m.i)for(q=
a.constructor.onDragStart,m=0,u=y.length;m<u;m++)(x=y[m]).draggable=!0,x.ondragstart=q;else for(m=0,u=y.length;m<u;m++)(x=y[m]).draggable=!1,x.ondragstart=null;break;case h.dropRule:r=c.lastElementChild;(this.dropRule=m.i)||this.globalDropRule?(H=a.constructor,r.ondragover=H.onDragOver,r.ondrop=H.onDrop):(r.ondragover=null,r.ondrop=null);break;case h.globalDropRule:r=c.lastElementChild;(this.globalDropRule=m.i)||this.dropRule?(H=a.constructor,r.ondragover=H.onDragOver,r.ondrop=H.onDrop):(r.ondragover=
null,r.ondrop=null);break;default:l?l.push(m):l=[m]}}l&&eq.c.DlgElement.prototype.setAttr.call(this,a,b,c,l)};eq.c.ListBox.prototype.onEvent=function(a,b,c,d){if("keydown"===d.type)return!0;a=d.target;for(var e,f;!(!a||(e=a.classList)&&e.contains("eq-listbox")||e&&e.contains("eq-column"));){if((f=a.parentNode)&&(e=f.classList)&&e.contains("eq-column"))return!0;a=f}return!1};
eq.c.ListBox.prototype.onKey=function(a,b,c,d,e,f){if(e)return!1;e=eq.c.ListBox;var g=eq.app,h=eq.Dom,l=h.isEnterOrSpace(d);if(l){var k=c.querySelector(".eq-column>.eq-selected");k&&(f.eq={key:l},g.processEvent(a,f,b,c,this));h.consumeEvent(f);return!0}switch(d){case "Escape":case "Esc":return e.select(c),h.consumeEvent(f),!0;case "Home":case "End":case "PageUp":case "PageDown":case "ArrowUp":case "Up":case "ArrowDown":case "Down":break;default:return this.selectOnKey(c,d)?(g.setChanged(b,"mousedown"),
h.consumeEvent(f),this.f&&g.processEvent(a,f,b,c,this),!0):!1}var n=c.querySelector(".eq-listbox .eq-column").children,m=0;k=-1;if(n.length){switch(d){case "Home":k=0;l=36;break;case "End":k=n.length-1;l=35;break;case "PageUp":m=-10;l=33;break;case "PageDown":m=10;l=34;break;case "ArrowUp":case "Up":m=-1;l=38;break;case "ArrowDown":case "Down":m=1,l=40}d=null;if(-1!==k)d=n[k];else if(0!==m){if((-1>m||1<m)&&1<n.length){k=n[0].parentNode.parentNode;k=k.getBoundingClientRect().height;var p=n[0].getBoundingClientRect().height;
0<k&&0<p&&(m=0<m?Math.floor(k/p):Math.ceil(-(k/p)))}(k=c.querySelector(".eq-column>.eq-selected"))?(k=h.parentIndex(k),0>(k+=m)?k=0:k>=n.length&&(k=n.length-1),d=n[k]):0<m&&(d=n[0])}null===d||d.classList.contains("eq-selected")||(g.setChanged(b,"mousedown"),e.select(c,n=h.parentIndex(d)),this.activeCol=0,e.scrollIntoView(c,n),this.f&&(f.eq={key:l},g.processEvent(a,f,b,c,this)))}h.consumeEvent(f);return!0};
eq.c.ListBox.prototype.selectOnKey=function(a,b){if(1===b.length){var c=a.querySelector(".eq-column"),d,e,f,g;if(d=c.querySelector(".eq-column>.eq-selected"))d=d.nextElementSibling;d||(d=c.firstElementChild);if(e=d){var h=(f=eq.c.ListBox).reSelectOnKey;b=b.toUpperCase();do{if((g=h.exec(e.textContent))&&b===g[1].toUpperCase())return f.select(a,b=eq.Dom.parentIndex(e)),f.scrollIntoView(a,b),!0;(e=e.nextElementSibling)||(e=c.firstElementChild)}while(e!==d)}}return!1};eq.c.ListBox.reSelectOnKey=/^\s*([^\s])/;
eq.c.ListBox.prototype.onChange=function(a,b,c,d){for(var e=eq.c.ListBox,f=eq.Dom,g=d.target,h="pointerdown"===d.type,l=h||"mousedown"===d.type,k,n,m,p,q;g&&(!(k=g.classList)||!k.contains("eq-listbox"));){q=g.parentNode;if(k){if(k.contains("eq-column"))break;(n=l&&k.contains("eq-resize"))&&g!==d.target&&(p=d.clientX-(m=g.getBoundingClientRect()).left,8>=p?n=!!(g=g.previousElementSibling):p<m.width-8&&(n=!1));if(n){b=f.parentIndex(g);for(h=g.parentNode.nextElementSibling.firstElementChild;b--;)h=h.nextElementSibling;
eq.app.moveCapture({dlg:a,el:c,h:g,c:h,x:d.clientX,w:Number(window.getComputedStyle(g).width.replace(/px$/,""))},e.colResize,e.colResize.done);f.consumeEvent(d);return!1}}if(q&&(k=q.classList)){if(k.contains("eq-column")){h||(e.select(c,f.parentIndex(g)),this.activeCol=f.parentIndex(q)+1);break}if(l&&k.contains("eq-caption"))return eq.app.mouseDownTimers.add(150,e.beginColMove,e.colHeaderClicked,{self:this,id:b,el:c,e:d,hd:g}),f.consumeEvent(d),!1}g=q}return!0};
eq.c.ListBox.colHeaderClicked=function(a){var b=a.hd;if(b.classList.contains("eq-sort")){var c=a.self,d=eq.app,e=a.id,f=a.e,g=c.ttLine;d.setChanged(e,"sort");if(null!==g){var h=g.length;c=c.lineOrder;var l=null!==c?c.length:0;a=a.el.querySelectorAll(".eq-column");var k=a.length,n=k?a[0].children.length:0,m,p;for(m=0;m<n;m++){if(null===c)var q=m;else{if(m>=l)throw Error("ListBox.colMove.done: line "+m+" >= lineOrder "+l);q=c[m]}if(q<h&&g[q])for(q=0;q<k;q++)m<(p=a[q].children).length&&d.ttDetach(p[m])}}d.apiUpdate(e,
eq.UpdateTag.sortSequence,{col:eq.Dom.parentIndex(b),add:f.ctrlKey||f.shiftKey})}};
eq.c.ListBox.beginColMove=function(a){var b=a.self,c=a.id,d=a.el,e=a.e;a=a.hd;if(a.classList.contains("eq-move")){var f=eq.c.ListBox,g=eq.app,h=eq.Dom.parentIndex(a),l=a.parentNode,k=l.getBoundingClientRect(),n=[],m,p,q,r;var t=document.createElement("DIV");(m=t.style).position="absolute";m.overflow="hidden";d.parentNode.querySelector(".eq-root-font #"+c)?(t.className="eq-root-font",eq.Dom.copyFont(t,d)):t.className="eq-default-font";var u=document.createElement("DIV");u.className="eq-listbox eq-multi";
d.classList.contains("eq-focused")&&(u.className+=" eq-focused");t.appendChild(u);var v=document.createElement("DIV");v.className="eq-caption";v.style.height=k.height+"px";u.appendChild(v);var y=document.createElement("DIV");y.className="eq-pane";u.appendChild(y);m.left=(r=k.left)+window.pageXOffset+"px";m.top=k.top+window.pageYOffset+"px";m.width=k.width+"px";var w=k.height;k=(q=l.nextElementSibling).getBoundingClientRect();m.height=(m=u.style).height=k.height+w+"px";w=q.children;for(var B=0,x=n.length=
w.length;B<x;B++)k=w[B].getBoundingClientRect(),n[B]=k.width,B===h&&(m.left=(r=k.left-r)+"px",m.width=(p=k.width)+"px",q=w[B]);k=document.createElement("DIV");k.className="eq-space";k.style.width=a.style.width;k.appendChild(document.createElement("DIV"));v.appendChild(l.replaceChild(k,a));k=document.createElement("DIV");k.className="eq-column eq-space";k.style.width=q.style.width;k.appendChild(document.createElement("DIV"));y.appendChild((l=l.nextElementSibling).replaceChild(k,q));u.id=b.duplicateCssRules(c);
g.makeOverlay(d,t,f.colMove.closeOverlay);y.scrollTop=l.scrollTop;g.moveCapture({self:b,el:d,ob:u,ow:p,cw:n,lx:r,x:e.clientX,f:h,t:h},f.colMove,f.colMove.done)}};
eq.c.ListBox.prototype.onToolTip=function(a){for(var b,c,d,e;a&&(!(b=a.classList)||!b.contains("eq-listbox"));){if(b){if(b.contains("eq-caption"))return null;if(b.contains("eq-column"))break}if((c=a.parentNode)&&(b=c.classList)){if(b.contains("eq-caption"))return null!==(b=this.ttHeader)&&(c=eq.Dom.parentIndex(a),c<b.length&&(e=b[c]))?e:(e=a.textContent)?e:null;if(b.contains("eq-column")){if(null!==(b=this.ttLine)){c=eq.Dom.parentIndex(a);if(null!==(d=this.lineOrder)){if(c>=d.length)break;c=d[c]}if(c<
b.length&&(e=b[c]))return e}break}}a=c}return eq.c.DlgElement.prototype.onToolTip.call(this,a)};
eq.c.ListBox.prototype.onDragStart=function(a,b,c,d,e,f){var g=this.dndMode;a=eq.Dnd;if(g&a.local)return f.drag={id:b},eq.c.DlgElement.setDropModes(e,g),!0;if(g&a.global){if(c.classList.contains("eq-multi"))for(b=eq.Dom.parentIndex(d),c=d.parentNode.parentNode.children,d="",f=0,g=c.length;f<g;f++)f&&(d+="\t"),d+=c[f].children[b].textContent;else d=d.textContent;e.dataTransfer.setData("text/plain",d);eq.c.DlgElement.setDropModes(e,a.all);return!0}return!1};
eq.c.ListBox.prototype.onDragOver=function(a,b,c,d){for(var e,f;d&&(e=d.parentNode);){if((f=e.classList)&&f.contains("eq-column"))return d;if(e===c||f&&f.contains("eq-pane"))break;d=e}return null};
eq.c.ListBox.prototype.onDrop=function(a,b,c,d,e){for(var f,g;d&&(f=d.parentNode)&&(!(g=f.classList)||!g.contains("eq-column"));){if(f===c||g&&g.contains("eq-pane"))return this.dndMode&eq.Dnd.dropExact?0:(e.drop.column=-1,e.drop.line=0,(this.dnd=e).ch.push(e.drop.id=b),e.drag?this.dropRule:this.globalDropRule);d=f}if(d&&f){d=(a=eq.Dom).parentIndex(d);if(null!==(c=this.lineOrder)){if(d>=c.length)throw Error("ListBox.onDrop: dropLine "+d+" >= lineOrder "+c.length);d=c[d]}e.drop.line=d+1;e.drop.column=
a.parentIndex(f);(this.dnd=e).ch.push(e.drop.id=b);return e.drag?this.dropRule:this.globalDropRule}return 0};
eq.c.ListBox.prototype.changed=function(a,b,c,d){a=[];for(var e=0,f=d.length;e<f;e++)switch(d[e]){case "mousedown":var g=c.querySelector(".eq-selected");if(g){var h=this.lineOrder;g=eq.Dom.parentIndex(g);if(null!==h){if(g>=h.length)throw Error("ListBox.changed: activeLine "+g+" >= lineOrder "+h.length);g=h[g]}a.push({ty:eq.RsValType.activeLineCol,i1:g+1,i2:this.activeCol})}else a.push({ty:eq.RsValType.activeLineCol,i1:0,i2:0});break;case "scroll":var l=c.querySelector(".eq-column").children;h=this.lineOrder;
g=0;var k;1<l.length&&0<(k=l[0].getBoundingClientRect().height)&&(g=Math.round(l[0].parentNode.parentNode.scrollTop/k));if(null!==h){if(g>=h.length)throw Error("ListBox.changed: topItem "+g+" >= lineOrder "+h.length);g=h[g]}a.push({ty:eq.RsValType.topItem,iv:g});break;case "resize":a.push({ty:eq.RsValType.colWidth});break;case "move":a.push({ty:eq.RsValType.colOrder});break;case "sort":a.push({ty:eq.RsValType.lineOrder});break;case "dnd":h=this.dnd;var n,m;h&&(n=h.drop)&&n.id===b&&(void 0!==(m=n.column)&&
a.push({ty:eq.RsValType.dropColumn,iv:m}),void 0!==(m=n.line)&&a.push({ty:eq.RsValType.dropLine,iv:m}))}this.dnd=null;switch(a.length){case 0:return null;case 1:return a[0].id=b,a[0];default:return{id:b,v:a}}};
eq.c.ListBox.prototype.updated=function(a,b,c,d,e){var f=eq.UpdateTag;switch(d){case f.sortSequence:case f.ctxMenuAct:this.setAttr(a,b,c,e.rt);case f.colResized:case f.colMoved:"rule"in c.dataset&&(a=eq.app,d=c.dataset.rule,+d===+d&&(a.onceRule=d,a.onceId=b,a.submit(c,{id:b,type:"change"})));break;default:eq.c.DlgElement.prototype.updated.call(this,a,b,c,d,e)}};
eq.c.DlgElement.addClass("MenuItem",function(a,b){eq.c.DlgElement.call(this,a,b);this.textPos=0;this.type=eq.MenuType.item;this.menuAccel=this.attrAccel=null});
eq.c.MenuItem.prototype.dispose=function(a,b){var c=this.attrAccel;if(null!==c){var d=a.accel;d.get(c)===b&&d.delete(c);this.attrAccel=null}c=this.menuAccel;if(null!==c){var e=document.getElementById(b),f;if(e&&(e=eq.Dom.eqControl(e.parentNode))&&e.classList.contains("eq-menu")&&void 0!==(f=a.eds.get(e.id))){if(!(f instanceof eq.c.Menu))throw Error("MenuItem.dispose("+b+") BUG: parent "+e.id+" not Menu");null!==(d=f.accelMap)&&d.get(c)===b&&d.delete(c)}this.menuAccel=null}eq.c.DlgElement.prototype.dispose.call(this,
a,b)};eq.c.MenuItem.prototype.updateId=function(a,b,c){var d=this.attrAccel;if(null!==d){var e=a.accel;e.get(d)===c&&e.set(d,b)}d=this.menuAccel;if(null!==d){var f=eq.Dom,g=document.getElementById(b),h;if(g&&(g=f.eqControl(g.parentNode))&&g.classList.contains("eq-menu")&&void 0!==(h=a.eds.get(g.id))){if(!(h instanceof eq.c.Menu))throw Error("MenuItem.dispose("+b+") BUG: parent "+g.id+" not Menu");null!==(e=h.accelMap)&&e.get(d)===c&&e.set(d,b)}}eq.c.DlgElement.prototype.updateId.call(this,a,b,c)};
eq.c.MenuItem.prototype.setAttr=function(a,b,c,d){for(var e=eq.Dom,f=eq.RqTag,g,h=0,l=d.length;h<l;h++){var k=d[h];switch(k.t){case f.textPos:this.textPos=k.v;break;case f.type:k=this.type=k.v;var n=c.classList,m=eq.MenuType;if(k===m.sep)n.add("eq-sep"),c.textContent="";else{n.remove("eq-sep");var p=eq.TextPos,q;switch(this.textPos){case p.right:n.remove("eq-vert");n.add("eq-horz");var r=["IMG","SPAN"];break;case p.left:n.remove("eq-vert");n.add("eq-horz");r=["SPAN","IMG"];break;case p.bottom:n.remove("eq-horz");
n.add("eq-vert");r=["IMG","SPAN"];break;case p.top:n.remove("eq-horz");n.add("eq-vert");r=["SPAN","IMG"];break;default:n.remove("eq-horz"),n.remove("eq-vert")}(p=e.firstChildByTagName(c,"LABEL"))?n=(q=p.children).length:(p=document.createElement("LABEL"),p.className="eq-rt eq-fn",c.insertBefore(p,c.firstElementChild),n=0);if(r){if(2!==n||q[0].tagName!==r[0]||q[1].tagName!==r[1])n&&(p.textContent=""),p.appendChild(document.createElement(r[0])),p.appendChild(document.createElement(r[1]))}else n&&(p.textContent=
"");n=e.firstChildByTagName(c,"INPUT");switch(k){case m.radio:case m.check:if(n)var t=n.id;else n=document.createElement("INPUT"),n.id=t=c.id+"-1",n.className="eq-rt",c.insertBefore(n,c.firstElementChild);p.htmlFor=t;if(k===m.radio)for(n.type="radio",p=c;p=p.parentNode;){if(t=p.id){n.name=t;break}}else n.type="checkbox",n.removeAttribute("name");break;default:p.removeAttribute("for"),n&&c.removeChild(n)}}break;case f.text:if(p=e.firstChildByTagName(c,"LABEL")){t=e.firstChildByTagName(p,"SPAN");m=
c;for(var u;m=e.eqControl(m.parentNode);){if((n=m.classList).contains("eq-menubar")){n.contains("eq-overlay")&&(m=null);break}n.contains("eq-menu")&&!u&&(u=m)}p=e.setContent(t||p,k.v,!0,!m);if(m&&u){if(void 0===(k=a.eds.get(u.id)))throw Error("MenuItem.setAttr("+b+") text BUG: parent "+u.id+" not registered");if(!(k instanceof eq.c.Menu))throw Error("MenuItem.setAttr("+b+") text BUG: parent "+u.id+" not Menu");this.menuAccel=k.setMenuAccel(b,this.menuAccel,p)}}break;case f.accel:n=this.attrAccel;
m={};p=e.decodeAccelAttr(k.v,m);p!==n&&(k=a.accel,t=c.querySelector(".eq-acc"),null!==n&&k.get(n)===b&&k.delete(n),null===p||k.has(p)?(this.attrAccel=null,t&&t.parentNode.removeChild(t)):(k.set(this.attrAccel=p,b),t||(t=document.createElement("DIV"),t.className="eq-acc",c.appendChild(t)),t.textContent=m.tag));break;case f.icon:p=e.firstChildByTagName(c,"LABEL");var v;p&&(v=e.firstChildByTagName(p,"IMG"))&&(v.src=k.v);break;case f.active:(q=c.firstElementChild)&&"INPUT"===q.tagName&&(q.checked=0!==
k.v);break;default:g?g.push(k):g=[k]}}g&&eq.c.DlgElement.prototype.setAttr.call(this,a,b,c,g)};eq.c.MenuItem.prototype.onEvent=function(a,b,c,d){b=eq.Dom;var e=eq.app,f;if(f=b.eqOverlay(c)){b.consumeEvent(d);if("rule"in c.dataset&&(d=c.dataset.rule,(c=(b=a.eds.get(f.id).contextMenuId)?document.getElementById(b):null)&&+d===+d))return e.onceRule=d,e.onceId=b,e.submit(c,{id:b,type:"contextmenu"}),!1;e.closeOverlay(f);return!1}return!0};
eq.c.MenuItem.prototype.onAccel=function(a,b,c){var d=eq.Dom,e,f,g,h;if((e=c.firstElementChild)&&"INPUT"===e.tagName&&void 0!==(f=e.checked))if(g=e.name){if(!f&&(h=c.parentNode)){h=h.querySelectorAll('li>input[name="'+g+'"]');for(g=h.length;0<=--g;)(f=h[g])!==e&&(f.checked=!1);e.checked=!0}}else e.checked=!f;h=c;e=!0;for(f=null;(h=d.eqControl(h.parentNode))&&!(g=h.classList).contains("eq-menubar");)g.contains("eq-menu")&&(f=h,g.contains("eq-open")||(e=!1));d.closeMenu();f&&!e&&(f.classList.add("eq-flash"),
window.setTimeout(eq.c.MenuItem.flashMenu,100,f));eq.app.processEvent(a,{type:"click",target:c},b,c,this)};eq.c.MenuItem.flashMenu=function(a){a.classList.remove("eq-flash")};eq.c.MenuItem.prototype.onSubmit=function(a,b,c,d){a=eq.MenuType;var e;switch(this.type){case a.radio:case a.check:(e=eq.app).changed.has(b)||e.changed.set(b,"input")}};
eq.c.MenuItem.prototype.onChange=function(a,b,c,d){var e=eq.Dom;if(a=e.eqOverlay(c)){(d=eq.app).changed.delete(b);if("obj"in c.dataset)b=c.dataset.obj,d.apiUpdate(b,eq.UpdateTag.ctxMenuAct,{c:e.parentIndex(c)});else if("item"in c.dataset){b=c.dataset.item;d.apiUpdate(null,eq.UpdateTag.ctxMenuAct,{i:b});b=document.getElementById(b);var f,g;if(b&&(f=b.firstElementChild)&&"INPUT"===f.tagName&&void 0!==(g=f.checked))if(e=f.name){if(!g&&(b=b.parentNode)){g=b.querySelectorAll('li>input[name="'+e+'"]');
for(e=g.length;0<=--e;)(b=g[e])!==f&&(b.checked=!1);f.checked=!0}}else f.checked=!g}"rule"in c.dataset||d.closeOverlay(a)}else if(d.menuMouseUp&&(f=c.firstElementChild)&&"INPUT"===f.tagName&&void 0!==(g=f.checked))if(e=f.name){if(!g&&(c=c.parentNode)){g=c.querySelectorAll('li>input[name="'+e+'"]');for(e=g.length;0<=--e;)(c=g[e])!==f&&(c.checked=!1);f.checked=!0}}else f.checked=!g;return!0};
eq.c.MenuItem.prototype.changed=function(a,b,c,d){a=eq.MenuType;switch(this.type){case a.radio:case a.check:if(c=eq.Dom.inputElement(c))return{id:b,ty:eq.RsValType.buttonChecked,iv:c.checked?1:0}}return null};eq.c.DlgElement.addClass("Menu",function(a,b){eq.c.DlgElement.call(this,a,b);this.accelMap=this.menuAccel=null;this.textPos=0});eq.c.Menu.addClass=eq.c.DlgElement.addClass;
eq.c.Menu.prototype.dispose=function(a,b){null!==this.accelMap&&(this.accelMap.clear(),this.accelMap=null);var c=this.menuAccel;if(null!==c){var d=document.getElementById(b),e,f;if(d&&(d=eq.Dom.eqControl(d.parentNode))&&d.classList.contains("eq-menu")&&void 0!==(e=a.eds.get(d.id))){if(!(e instanceof eq.c.Menu))throw Error("Menu.dispose("+b+") BUG: parent "+d.id+" not Menu");null!==(f=e.accelMap)&&f.get(c)===b&&f.delete(c)}this.menuAccel=null}eq.c.DlgElement.prototype.dispose.call(this,a,b)};
eq.c.Menu.adjustElementTemplate=function(a){for(;a;){var b=a.ev,c,d;b&&(c=b.c)&&-1!==(d=c.indexOf("mousedown"))&&c.splice(d,0,"pointerdown");a=a.et}};
eq.c.Menu.prototype.updateId=function(a,b,c){var d=this.menuAccel;if(null!==d){var e=eq.Dom,f=document.getElementById(b),g,h;if(f&&(f=e.eqControl(f.parentNode))&&f.classList.contains("eq-menu")&&void 0!==(g=a.eds.get(f.id))){if(!(g instanceof eq.c.Menu))throw Error("Menu.dispose("+b+") BUG: parent "+f.id+" not Menu");null!==(h=g.accelMap)&&h.get(d)===c&&h.set(d,b)}}eq.c.DlgElement.prototype.updateId.call(this,a,b,c)};
eq.c.Menu.openMenu=function(a,b){for(var c=b,d,e;(c=c.parentNode)&&c!==document;)if((d=c.classList)&&d.contains("eq-menubar")){d=b.classList;d.remove("eq-rtl");d.add("eq-ltr");d.add("eq-open");if(b=(c=b).lastElementChild)e=".eq-d"+a.id,(a=document.querySelector(".eq-dialog"+e))||(a=document.querySelector(".eq-window"+e+" .eq-dialog")),a&&(b=b.getBoundingClientRect(),a=a.getBoundingClientRect(),b.right>a.right&&(c=c.getBoundingClientRect(),c.right-b.width>=a.left&&(d.remove("eq-ltr"),d.add("eq-rtl"))));
break}};eq.c.Menu.closeContextMenu=function(a){var b=eq.app.currDlg;if(!b)throw Error("BUG: Menu.closeContextMenu no current dialog");b.removeElement(a)};
eq.c.Menu.prototype.setAttr=function(a,b,c,d){for(var e=eq.Dom,f=eq.RqTag,g,h=0,l=d.length;h<l;h++){var k=d[h];switch(k.t){case f.textPos:var n=c.classList,m=eq.TextPos,p;switch(this.textPos=k.v){case m.right:n.remove("eq-vert");n.add("eq-horz");var q=["IMG","SPAN"];break;case m.left:n.remove("eq-vert");n.add("eq-horz");q=["SPAN","IMG"];break;case m.bottom:n.remove("eq-horz");n.add("eq-vert");q=["IMG","SPAN"];break;case m.top:n.remove("eq-horz");n.add("eq-vert");q=["SPAN","IMG"];break;default:n.remove("eq-horz"),
n.remove("eq-vert")}(m=e.firstChildByTagName(c,"LABEL"))?k=(p=m.children).length:(m=document.createElement("LABEL"),m.className="eq-rt eq-fn",c.insertBefore(m,c.firstElementChild),k=0);if(q){if(2!==k||p[0].tagName!==q[0]||p[1].tagName!==q[1])k&&(m.textContent=""),m.appendChild(document.createElement(q[0])),m.appendChild(document.createElement(q[1]))}else k&&(m.textContent="");break;case f.text:if(m=e.firstChildByTagName(c,"LABEL")){for(var r=e.firstChildByTagName(m,"SPAN"),t=c,u;t=e.eqControl(t.parentNode);){if((n=
t.classList).contains("eq-menubar")){n.contains("eq-overlay")&&(t=null);break}n.contains("eq-menu")&&!u&&(u=t)}k=e.setContent(r||m,k.v,!0,!t);if(t)if(u){if(void 0===(n=a.eds.get(u.id)))throw Error("Menu.setAttr("+b+") text BUG: parent "+u.id+" not registered");if(!(n instanceof eq.c.Menu))throw Error("Menu.setAttr("+b+") text BUG: parent "+u.id+" not Menu");this.menuAccel=n.setMenuAccel(b,this.menuAccel,k)}else this.setAccel(a,b,k,eq.KeyMod.alt)}break;case f.icon:m=e.firstChildByTagName(c,"LABEL");
var v;m&&(v=e.firstChildByTagName(m,"IMG"))&&(v.src=k.v);break;case f.align:n=c.classList;k.v?n.contains("eq-right")||(n.add("eq-right"),r=document.createElement("LI"),r.className="eq-sep",c.parentNode.insertBefore(r,c)):n.contains("eq-right")&&(n.remove("eq-right"),c.parentNode.removeChild(c.previousElementSibling));break;default:g?g.push(k):g=[k]}}g&&eq.c.DlgElement.prototype.setAttr.call(this,a,b,c,g)};
eq.c.Menu.prototype.setMenuAccel=function(a,b,c){c=null!==c?c.toUpperCase():null;if(c!==b){var d=this.accelMap;null===d&&(this.accelMap=d=new Map);null!==b&&d.get(b)===a&&d.delete(b);if(null===c||d.has(c))return null;d.set(c,a)}return c};
eq.c.Menu.prototype.onKey=function(a,b,c,d,e,f){if(!e)switch(d){case "Escape":case "Esc":var g,h;(g=c.parentNode)&&(h=g.classList)&&h.contains("eq-menubar")?eq.Dom.closeMenu():c.classList.remove("eq-open");return!0;default:if(1===d.length){b=this.accelMap;var l,k;if(null!==b&&(l=b.get(d.toUpperCase()))&&(c=document.getElementById(l))&&void 0!==(k=a.eds.get(l)))k.onAccel(a,l,c);return!0}}return!1};eq.c.Menu.prototype.onAccel=function(a,b,c){this.onChange(a,b,c,null)};
eq.c.Menu.prototype.onChange=function(a,b,c,d){var e=eq.app,f=eq.Dom;d=c.parentNode;var g,h=d&&(g=d.classList)&&g.contains("eq-menubar"),l=(g=c.classList).contains("eq-open");f.eqOverlay(c)&&(e.changed.delete(b),h=!1);if(h)f.closeMenu(),l||(eq.c.Menu.openMenu(a,c),e.menuOpen=b,e.constructor.ttClose());else if(l)g.remove("eq-open");else{b=eq.c.Menu;e=[c];for(var k;d;){if("UL"!==(k=(c=d).tagName)||"LI"!==k||(d=d.parentNode)&&(g=d.classList)&&g.contains("eq-menubar")){c=c.getElementsByClassName("eq-open");
for(g=c.length;0<=--g;)c[g].classList.remove("eq-open");break}(g=d.classList)&&g.contains("eq-menu")&&e.push(d)}for(g=e.length;0<=--g;)b.openMenu(a,e[g])}return!1};eq.p.pluginApiVersion=3;eq.c.DlgElement.subClass("DlgPlugin",function(a,b){eq.c.DlgElement.call(this,a,b);this.values=new Map;var c=this.constructor;(c=c.instanceMethods?this.apiInit:c.init)&&c.call(this,a,b)});eq.c.DlgPlugin.addClass=eq.c.DlgElement.addClass;eq.c.DlgPlugin.instanceMethods=!1;
eq.c.DlgPlugin.prototype.dispose=function(a,b){var c=this.constructor;c=c.instanceMethods?this.apiDispose:c.dispose;var d;null!==(d=this.values)&&(d.clear(),this.values=null);c&&c.call(this,a,b);eq.c.DlgElement.prototype.dispose.call(this,a,b)};eq.c.DlgPlugin.prototype.intAttrChanged=function(a,b,c,d,e){eq.app.setChanged(a,b);this.values.set(void 0!==d&&null!==d?c+" "+d:c,{ty:eq.RsValType.plgInt,a:c,i:d,iv:e})};
eq.c.DlgPlugin.prototype.stringAttrChanged=function(a,b,c,d,e){eq.app.setChanged(a,b);this.values.set(void 0!==d&&null!==d?c+"["+d+"]":c,{ty:eq.RsValType.plgString,a:c,i:d,sv:e})};eq.c.DlgPlugin.prototype.binaryAttrChanged=function(a,b,c,d,e){eq.app.setChanged(a,b);this.values.set(void 0!==d&&null!==d?c+"["+d+"]":c,{ty:eq.RsValType.plgBinary,a:c,i:d,bv:e})};eq.c.DlgPlugin.prototype.submit=function(a,b,c,d){var e=eq.app;void 0!==d&&(e.onceRule=d,e.onceId=a);e.submit(b,{id:a,type:c})};
eq.c.DlgPlugin.prototype.setAttr=function(a,b,c,d){for(var e=eq.RqTag,f,g=0,h=d.length;g<h;g++){var l=d[g];switch(l.t){case e.plgInt:case e.plgString:case e.plgBinary:case e.font:var k=this.constructor;(k=k.instanceMethods?this.apiSetAttr:k.setAttr)&&k.call(this,a,b,c,l.a,l.i,l.v);break;default:f?f.push(l):f=[l]}}f&&eq.c.DlgElement.prototype.setAttr.call(this,a,b,c,f)};
eq.c.DlgPlugin.prototype.setSensitive=function(a,b,c,d){var e=this.constructor;(e=e.instanceMethods?this.apiSetSensitive:e.setSensitive)&&e.call(this,a,b,c,d);eq.c.DlgElement.prototype.setSensitive.call(this,a,b,c,d)};eq.c.DlgPlugin.prototype.onEvent=function(a,b,c,d){var e=this.constructor;return(e=e.instanceMethods?this.apiOnEvent:e.onEvent)?e.call(this,a,b,c,d):!0};
eq.c.DlgPlugin.prototype.onKey=function(a,b,c,d,e,f){d=this.constructor;d=d.instanceMethods?this.apiOnKey:d.onKey;var g;return d&&!1!==(g=d.call(this,a,b,c,f))?(g&&eq.Dom.consumeEvent(f),!0):!1};eq.c.DlgPlugin.prototype.onTypeAhead=function(a,b,c,d){var e=this.constructor;return(e=e.instanceMethods?this.apiOnTypeAhead:e.onTypeAhead)&&e.call(this,a,b,c,d)?!0:eq.c.DlgElement.prototype.onTypeAhead.call(this,a,b,c,d)};
eq.c.DlgPlugin.prototype.onSubmit=function(a,b,c,d){var e=this.constructor;(e=e.instanceMethods?this.apiOnSubmit:e.onSubmit)&&e.call(this,a,b,c,d)};eq.c.DlgPlugin.prototype.onChange=function(a,b,c,d){var e=this.constructor;return(e=e.instanceMethods?this.apiOnChange:e.onChange)?e.call(this,a,b,c,d):!0};eq.c.DlgPlugin.prototype.focusElement=function(a,b){var c=this.constructor;return(c=c.instanceMethods?this.apiFocusElement:c.focusElement)?c.call(this,a,b):b};
eq.c.DlgPlugin.prototype.focusGained=function(a,b){var c=this.constructor;if(c=c.instanceMethods?this.apiFocusGained:c.focusGained)return c.call(this,a,b)};eq.c.DlgPlugin.prototype.focusLost=function(a,b){var c=this.constructor;if(c=c.instanceMethods?this.apiFocusLost:c.focusLost)return c.call(this,a,b)};
eq.c.DlgPlugin.prototype.changed=function(a,b,c,d){var e=this.constructor;e=e.instanceMethods?this.apiChanged:e.changed;var f=[];e&&e.call(this,a,b,c,d);this.values.forEach(eq.c.DlgPlugin.cbChanged,f);this.values.clear();switch(f.length){case 0:return null;case 1:return f[0].id=b,f[0];default:return{id:b,v:f}}};eq.c.DlgPlugin.cbChanged=function(a){this.push(a)};
eq.c.DlgPlugin.prototype.onUpdate=function(a,b,c,d,e,f){var g=this.constructor,h=eq.UpdateTag;if(0>e||e>=g.atr.length)throw Error(g.name+".onUpdate("+b+") failed: attribute index "+e+" out of range");switch(d){case h.plgUpdate:var l=g.instanceMethods?this.apiOnUpdate:g.onUpdate;l&&l.call(this,a,b,c,g.atr[e][0],f);break;case h.plgGetVal:if((d=g.instanceMethods?this.apiGetAttr:g.getAttr)&&void 0!==(l=d.call(this,a,b,c,g.atr[e][0],f)))return null===l?null:l instanceof Uint8Array?{b:l}:"number"===typeof l?
{i:l}:{s:l};break;default:throw Error(g.name+".onUpdate("+b+") failed: tag "+d);}};eq.c.DlgPlugin.prototype.onUpdateReturn=function(a,b,c){if(void 0===c)c=void 0;else{if(null===c)throw Error("BUG: "+this.constructor.name+".onUpdate("+b+") null value");c=c instanceof Uint8Array?{b:c}:"number"===typeof c?{i:c}:{s:c}}eq.c.DlgElement.prototype.onUpdateReturn.call(this,a,b,c)};eq.plugin.install=function(){var a=this.m,b=[];void 0!==a&&(a.forEach(this.cb,b),a.clear());return b};
eq.plugin.cb=function(a,b){var c=a.prp.minVersion;if(void 0!==c&&c>eq.p.pluginApiVersion)console.error("Insufficient API version "+eq.p.pluginApiVersion+" for plugin '"+b+"', expected: "+c+" or newer");else if(!("plg"+b in eq.c)){var d={n:b},e=eq.c.DlgPlugin.addClass("plg"+b,function(m,p){eq.c.DlgPlugin.call(this,m,p)}),f,g;delete e.subClass;delete e.dlgSubClass;if(f=1<=c){e.instanceMethods=!0;var h=e.prototype}for(var l in a)switch(l){case "atr":d.a=e.atr=a.atr;break;case "prp":d.p=a.prp;break;case "static":var k=
a.static,n;for(n in k)n in e&&console.warn("Plugin '"+b+"' overrides static method: "+n),e[n]=k[n];break;default:f?(l in h&&console.warn("Plugin '"+b+"' overrides instance method: "+l),h[l]=a[l]):(l in e&&console.warn("Plugin '"+b+"' overrides method: "+l),e[l]=a[l])}if(void 0===c)for(a=d.a,b=0,c=a.length;b<c;b++)a[b][1]|=eq.atrPRI;this.push(d);(g=e.install)&&g.call(e)}};eq.c.DlgElement.addClass("PopText",function(a,b){eq.c.DlgElement.call(this,a,b)});
eq.c.PopText.adjustElementTemplate=function(a){for(;a;){var b=a.ev,c,d;b&&(c=b.c)&&-1!==(d=c.indexOf("mousedown"))&&c.splice(d,0,"pointerdown");a=a.et}};eq.c.PopText.line=function(a,b){for(var c,d;a&&(c=a.parentNode);){if(d=c.classList){if(d.contains("eq-column"))return void 0!==b&&(b.c=c),a;if(d.contains("eq-poptext")){void 0!==b&&(b.ct=c);break}}a=a.parentNode}};
eq.c.PopText.select=function(a,b,c){void 0===b&&((b=a.querySelector(".eq-poptext>.eq-column"))||(b=document.body.querySelector("body>.eq-poptext.eq-column")));a=b.querySelectorAll(".eq-column>.eq-selected");for(var d=0,e=a.length;d<e;d++)a[d].classList.remove("eq-selected");c&&b===c.parentNode&&(c.classList.add("eq-selected"),1<b.children.length&&this.scrollIntoView(c,{cb:this.scrollIntoView}))};
eq.c.PopText.scrollIntoView=function(a,b){var c=a.parentNode,d=c.children,e,f;if(1<d.length)if(eq.app.idle||0>=(e=c.getBoundingClientRect().height)||0>=(f=d[0].getBoundingClientRect().height))eq.Dom.onNextFrame(a,b);else b=c.scrollTop,a=a.offsetTop,a<b?c.scrollTop=a:a+f>b+e&&(c.scrollTop=Math.ceil(a+f-e+2))};
eq.c.PopText.open=function(a,b){var c=a.classList;if(!c.contains("eq-open")){var d=a.firstElementChild;if(void 0===b){b=a.querySelector(".eq-poptext>.eq-column");var e=b.querySelector(".eq-column>.eq-selected")}else var f=d.textContent;var g=eq.c.PopText,h=a.getBoundingClientRect(),l=b.style,k=b.classList,n;if(f&&f.length)for(var m=b.children,p=0,q=m.length;p<q;p++)if(f===m[p].textContent){e=m[p];break}l.left=h.left+window.pageXOffset+"px";l.top=h.bottom+window.pageYOffset+"px";(n=l.maxWidth)?l.width=
n:l.width=h.width+"px";eq.Dom.copyFont(b,d);eq.Dom.copyColors(b,a);k.add("eq-poptext");c.contains("eq-border")?k.add("eq-border"):k.remove("eq-border");eq.app.makeOverlay(a,b,g.close);c.add("eq-open");c.add("eq-enter");(d=b.getBoundingClientRect()).bottom>window.pageYOffset+document.documentElement.clientHeight?(l.top=h.top+window.pageYOffset-d.height+"px",c.remove("eq-dn"),k.remove("eq-dn"),c.add("eq-up"),k.add("eq-up")):(c.remove("eq-up"),k.remove("eq-up"),c.add("eq-dn"),k.add("eq-dn"));g.select(a,
b,e)}};eq.c.PopText.close=function(a,b,c){var d=a.classList,e=b.classList,f;if(!d.contains("eq-open"))throw Error("PopText.close BUG: not open, id:"+a.id);a.appendChild(b);e.remove("eq-poptext");e.remove("eq-border");d.remove("eq-open");d.remove("eq-enter");c&&(f=b.querySelector(".eq-column>.eq-selected"))&&(b=eq.Dom,b.copyContent(a.firstElementChild,f),b.fireEvent(a,"input"))};
eq.c.PopText.move=function(a,b){var c=b.c;if(c){var d=eq.c.PopText,e=b.el,f={};a=d.line(a.target,f);e!==f.ct&&(d.select(e,c,a),a&&(b.close=b.commit=!0))}};eq.c.PopText.move.done=function(a){a.close&&eq.app.closeOverlay(a.el,a.commit);a=a.a;void 0!==a&&a.classList.remove("eq-click");return!0};
eq.c.PopText.prototype.setAttr=function(a,b,c,d){for(var e=eq.Dom,f=eq.RqTag,g,h=0,l=d.length;h<l;h++){var k=d[h];switch(k.t){case f.content:var n=k.v;k=n.length;var m=c.classList,p;k?m.remove("eq-empty"):m.add("eq-empty");if(m.contains("eq-open")){if(m=document.body.querySelector("body>.eq-poptext.eq-column"),!m)throw Error("PopText.setAttr BUG: open, no column");}else c.querySelector(".eq-poptext>.eq-button")||(m=document.createElement("DIV"),m.className="eq-rt eq-button",c.appendChild(m)),(m=c.querySelector(".eq-poptext>.eq-column"))||
(m=document.createElement("DIV"),m.className="eq-rt eq-column",c.appendChild(m));if(k)var q=(p=m.children).length;else m.textContent="",p=m.children,q=0;for(var r=0;r<k;r++){if(r<q)var t=p[r];else t=document.createElement("DIV"),m.appendChild(t);e.setContent(t,n[r])}for(;p.length>k;)m.removeChild(m.lastElementChild);e.copyContent(c.firstElementChild,m.querySelector(".eq-selected"));break;case f.activeLine:m=c.querySelector(".eq-poptext>.eq-column");p=m.children;n=k.v;var u;0<n&&n<=p.length&&(u=p[n-
1]);e.copyContent(c.firstElementChild,u);break;case f.boxSize:n=k.w;k=k.h;m=c.classList.contains("eq-open")?document.body.querySelector("body>.eq-poptext.eq-column"):c.querySelector(".eq-poptext>.eq-column");if(!m)throw Error("PopText.setAttr BUG: boxSize, no column");(m=m.style).maxWidth=n?n:"";m.maxHeight=k?k:"";break;default:g?g.push(k):g=[k]}}g&&eq.c.DlgElement.prototype.setAttr.call(this,a,b,c,g)};
eq.c.PopText.prototype.onKey=function(a,b,c,d,e,f){if(e)return!1;a=eq.c.PopText;b=eq.Dom;e=c.querySelector(".eq-poptext>.eq-column");switch(d){case "Enter":return!e&&(eq.app.closeOverlay(c,!0),c.classList.contains("eq-noenter"))?(b.consumeEvent(f),!0):!1;case "Escape":case "Esc":return e||eq.app.closeOverlay(c,!1),b.consumeEvent(f),!0;case "PageUp":case "PageDown":case "ArrowUp":case "Up":case "ArrowDown":case "Down":if(e){a.open(c,e);var g=0}break;default:return this.selectOnKey(c,d,f)?(b.consumeEvent(f),
!0):!1}var h;if((e=document.body.querySelector("body>.eq-poptext.eq-column"))&&(h=e.children).length){if(void 0===g)switch(d){case "PageUp":var l=h[0];break;case "PageDown":l=h[h.length-1];break;case "ArrowUp":case "Up":g=-1;break;case "ArrowDown":case "Down":g=1}void 0!==g&&((l=e.querySelector(".eq-column>.eq-selected"))?(d=eq.Dom.parentIndex(l),l=h.length,-1===(d+=g)?d=0:d>=l&&(d=l-1),l=h[d]):l=h[0]);void 0!==l&&a.select(c,e,l)}b.consumeEvent(f);return!0};
eq.c.PopText.prototype.selectOnKey=function(a,b){if(1===b.length){var c=a.querySelector(".eq-poptext>.eq-column"),d=!!c,e,f,g,h;c||(c=document.body.querySelector("body>.eq-poptext.eq-column"));if(e=c.querySelector(".eq-column>.eq-selected"))e=e.nextElementSibling;e||(e=c.firstElementChild);if(f=e){var l=(g=eq.c.PopText).reSelectOnKey;b=b.toUpperCase();do{if((h=l.exec(f.textContent))&&b===h[1].toUpperCase())return g.select(a,c,f),d&&g.open(a),!0;(f=f.nextElementSibling)||(f=c.firstElementChild)}while(f!==
e)}}return!1};eq.c.PopText.reSelectOnKey=/^\s*([^\s])/;
eq.c.PopText.prototype.onChange=function(a,b,c,d){var e="pointerdown"===d.type;if(e||"mousedown"===d.type){a=eq.c.PopText;var f=eq.app,g=eq.Dom,h=d.target,l=h&&h.classList.contains("eq-button");if(!l&&(l=c===g.eqControl(h)&&(h=c.querySelector(".eq-poptext>.eq-button")),c.classList.contains("eq-open"))){b={el:c};l={};var k=a.line(h,l);if(l.c){a.select(c,b.c=l.c,k);if(e)return!0;b.close=b.commit=!0}else c===l.ct&&(b.a=h,b.close=!0,h.classList.add("eq-click"));f.moveCapture(b,a.move,a.move.done);return c!==
l.ct?(g.consumeEvent(d),!1):!0}if(l){e=c.classList;if(e.contains("eq-disabled")||e.contains("eq-empty"))return!1;if(e.contains("eq-focus")&&f.setFocus(b,c))return f.pendingFocus={id:b,act:a.open},!1;e=c.querySelector(".eq-poptext>.eq-column");b={el:c,a:h};h.classList.add("eq-click");e?a.open(c,b.c=e):b.close=!0;f.moveCapture(b,a.move,a.move.done);g.consumeEvent(d);return!1}}return!0};eq.c.PopText.prototype.focusLost=function(a,b){b.classList.contains("eq-open")&&eq.app.closeOverlay(b)};
eq.c.PopText.prototype.changed=function(a,b,c,d){a=0;for(var e=d.length;a<e;a++)if("input"===d[a])return c=c.querySelector(".eq-poptext>.eq-column>.eq-selected"),{id:b,ty:eq.RsValType.activeLine,iv:c?eq.Dom.parentIndex(c)+1:0};return null};eq.c.DlgElement.addClass("ProgressBar",function(a,b){eq.c.DlgElement.call(this,a,b)});
eq.c.ProgressBar.prototype.setAttr=function(a,b,c,d){for(var e=eq.RqTag,f,g=0,h=d.length;g<h;g++){var l=d[g];switch(l.t){case e.vertical:if(!c.firstElementChild){var k=document.createElement("DIV"),n=document.createElement("SPAN"),m=document.createElement("SPAN");n.className=m.className="eq-fn";k.appendChild(m);c.appendChild(n);c.appendChild(k)}n=c.classList;l.v?(n.remove("eq-horz"),n.add("eq-vert")):(n.remove("eq-vert"),n.add("eq-horz"));break;case e.value:n=c.classList;k=c.querySelector(".eq-progressbar>div");
(l=l.v)?(n.remove("eq-noval"),n.add("eq-val"),n.contains("eq-horz")?k.style.width=l:k.style.height=l):(n.remove("eq-val"),n.add("eq-noval"),k.style.width="");break;case e.text:k=eq.Dom;n=c.getElementsByTagName("SPAN");k.setContent(n[0],l.v);k.setContent(n[1],l.v);break;default:f?f.push(l):f=[l]}}f&&eq.c.DlgElement.prototype.setAttr.call(this,a,b,c,f)};eq.c.DlgElement.addClass("PushButton",function(a,b){eq.c.DlgElement.call(this,a,b)});
eq.c.PushButton.prototype.setSensitive=function(a,b,c,d){var e=c.getElementsByTagName("BUTTON");if(1!==e.length)throw Error("BUG: PushButton.setSensitive id:"+c.id+" elements:"+e.length+", expected: 1");e[0].disabled=!d;eq.c.DlgElement.prototype.setSensitive.call(this,a,b,c,d)};eq.c.PushButton.prototype.onKey=function(a,b,c,d,e,f){if(e)return!1;a=eq.Dom;return(d=a.isEnterOrSpace(d))&&(10!==d||c.classList.contains("eq-noenter"))?(a.fireClick(c,{key:d}),a.consumeEvent(f),!0):!1};
eq.c.PushButton.prototype.onTypeAhead=function(a,b,c,d){var e;switch(d){case "Enter":case "ShiftEnter":c.classList.contains("eq-noenter")&&(e=10);break;case " ":e=32}return void 0!==e?(eq.Dom.fireClick(c,{key:e}),!0):eq.c.DlgElement.prototype.onTypeAhead.call(this,a,b,c,d)};eq.c.PushButton.prototype.focusElement=function(a,b){a=b.getElementsByTagName("BUTTON");if(1!==a.length)throw Error("BUG: PushButton.focusElement id:"+b.id+" elements:"+a.length+", expected: 1");return a[0]};
eq.c.DlgElement.addClass("RadioButton",function(a,b){eq.c.DlgElement.call(this,a,b)});eq.c.RadioButton.prototype.setSensitive=function(a,b,c,d){eq.Dom.inputElement(c).disabled=!d;eq.c.DlgElement.prototype.setSensitive.call(this,a,b,c,d)};eq.c.RadioButton.prototype.onEvent=function(a,b,c,d){return!eq.Dom.inputElement(c).checked};
eq.c.RadioButton.prototype.onKey=function(a,b,c,d,e,f){if(e)return!1;a=eq.Dom;if(b=a.isEnterOrSpace(d))return 10!==b||c.classList.contains("eq-noenter")?(a.fireClick(a.inputElement(c),{key:b}),a.consumeEvent(f),!0):!1;e=f.target;var g=c.parentNode.querySelectorAll('input[name="'+e.name+'"]'),h=0;if(g.length){switch(d){case "Home":c=g[0];b=36;break;case "End":c=g[g.length-1];b=35;break;case "PageUp":h=-1;b=33;break;case "PageDown":h=1;b=34;break;default:return!1}if(0!==h){c=null;d=0;for(var l=g.length;d<
l;d++)if(e===g[d]){-1===(d+=h)?d=l-1:d>=l&&(d=0);c=g[d];break}}if(null!==c)return a.fireClick(c,{key:b}),a.consumeEvent(f),!0}return!1};eq.c.RadioButton.prototype.onTypeAhead=function(a,b,c,d){var e;switch(d){case "Enter":case "ShiftEnter":c.classList.contains("eq-noenter")&&(e=10);break;case " ":e=32}return void 0!==e?(a=eq.Dom,a.fireClick(a.inputElement(c),{key:e}),!0):eq.c.DlgElement.prototype.onTypeAhead.call(this,a,b,c,d)};
eq.c.RadioButton.prototype.onSubmit=function(a,b,c,d){a=eq.app;a.changed.has(b)||a.changed.set(b,"input")};eq.c.RadioButton.prototype.focusElement=function(a,b){return eq.Dom.inputElement(b)};eq.c.RadioButton.prototype.changed=function(a,b,c,d){return c.checked?{id:b,ty:eq.RsValType.buttonChecked,iv:1}:null};eq.c.DlgElement.addClass("Splitter",function(a,b){eq.c.DlgElement.call(this,a,b);this.panes=[];this.lastPos=null});
eq.c.Splitter.prototype.dispose=function(a,b){var c;null!==(c=this.panes)&&(c.length=0,this.panes=null);eq.c.DlgElement.prototype.dispose.call(this,a,b)};eq.c.Splitter.adjustElementTemplate=function(a){for(;a;){var b=a.ev,c,d;b&&(c=b.c)&&-1!==(d=c.indexOf("mousedown"))&&c.splice(d,0,"pointerdown");a=a.et}};eq.c.Splitter.move=function(a,b){b.busy||(b.busy=!0,eq.Dom.onNextFrame(b.el,{cb:eq.c.Splitter.move.exec,x:a.clientX,y:a.clientY,m:b}))};
eq.c.Splitter.move.exec=function(a,b){a=b.x;var c=b.y;b=b.m;var d=b.pa,e=d.getBoundingClientRect(),f;void 0!==b.x?2<Math.abs(f=a-b.x)&&(c=e.width+f,0<=c&&(d.style.width=c+"px",d.getBoundingClientRect().width!==e.width&&(b.x=a,b.modified=!0))):2<Math.abs(f=c-b.y)&&(a=e.height+f,0<=a&&(d.style.height=a+"px",d.getBoundingClientRect().height!==e.height&&(b.y=c,b.modified=!0)));b.busy=void 0};
eq.c.Splitter.move.done=function(a,b){var c=a.el,d=c.classList,e;if(a.modified)(e=eq.app).setChanged(a=a.id,"change"),d.contains("eq-rule")&&e.submit(c,{id:a,type:"change"});else if(void 0!==b&&d.contains("eq-quick")){e=!1;var f=a.pa,g=f.style;if(void 0!==a.x){var h=g.width;"0%"===h||"100%"===h?null!==(b=a.self).lastPos&&(g.width=b.lastPos+"px",b.lastPos=null,e=!0):64<=(f=f.getBoundingClientRect()).height&&(b=b.clientY,b<=f.top+28&&b>=f.top?((b=a.self).lastPos=f.width,g.width="0%",e=!0):b>=f.bottom-
28&&b<=f.bottom&&((b=a.self).lastPos=f.width,g.width="100%",e=!0))}else h=g.height,"0%"===h||"100%"===h?null!==(b=a.self).lastPos&&(g.height=b.lastPos+"px",b.lastPos=null,e=!0):64<=(f=f.getBoundingClientRect()).width&&(b=b.clientX,b<=f.left+28&&b>=f.left?((b=a.self).lastPos=f.height,g.height="0%",e=!0):b>=f.right-28&&b<=f.right&&((b=a.self).lastPos=f.height,g.height="100%",e=!0));e&&((e=eq.app).setChanged(a=a.id,"change"),d.contains("eq-rule")&&e.submit(c,{id:a,type:"change"}))}return!0};
eq.c.Splitter.prototype.setAttr=function(a,b,c,d){for(var e=eq.RqTag,f,g=0,h=d.length;g<h;g++){var l=d[g];switch(l.t){case e.panes:var k=this.panes,n=c.querySelector("#"+b+">.eq-pane");if(n){l=n.querySelectorAll("#"+b+">.eq-pane>*>:only-child");for(var m=0,p=l.length;m<p;m++){n.removeChild(l[m].parentNode);var q=!0}q&&(k.length=0);l=n.querySelectorAll("#"+b+">.eq-pane>*>:first-child");m=0;for(p=l.length;m<p;m++){var r=l[m];r.classList.contains("eq-hidden")&&(n.removeChild(r.parentNode),c.appendChild(r));
q&&k.push(r.id)}}else n=document.createElement("DIV"),n.className="eq-rt eq-pane",c.appendChild(n);l=c.querySelectorAll("#"+b+">:not(.eq-pane)");m=0;for(p=l.length;m<p;m++)if(r=l[m],!r.classList.contains("eq-hidden")){var t=document.createElement("DIV"),u=document.createElement("DIV"),v=k.indexOf(r.id);n.insertBefore(t,0===v?n.firstElementChild:null);t.appendChild(r);u.className="eq-caption";t.appendChild(u);-1===v&&k.push(r.id)}break;case e.position:k=l.v;l=c.querySelectorAll("#"+b+">.eq-pane>*");
0<=k&&2===l.length?(l=(n=l[0]).style,c.classList.contains("eq-vert")?(m=n.parentNode.getBoundingClientRect().height,l.width="",0==k?(0<m?(k=n.getBoundingClientRect().height,this.lastPos=0<k?k:m/2):this.lastPos=null,l.height="0%"):0<m&&k>=m?(k=n.getBoundingClientRect().height,this.lastPos=0<k?k:m/2,l.height="100%"):(this.lastPos=null,l.height=k+"px")):(m=n.parentNode.getBoundingClientRect().width,l.height="",0==k?(0<m?(k=n.getBoundingClientRect().width,this.lastPos=0<k?k:m/2):this.lastPos=null,l.width=
"0%"):0<m&&k>=m?(k=n.getBoundingClientRect().width,this.lastPos=0<k?k:m/2,l.width="100%"):(this.lastPos=null,l.width=k+"px"))):l.length&&(l=l[0].style,l.width=l.height="");break;default:f?f.push(l):f=[l]}}f&&eq.c.DlgElement.prototype.setAttr.call(this,a,b,c,f)};
eq.c.Splitter.prototype.onChange=function(a,b,c,d){var e=d.target;e&&e.classList.contains("eq-caption")&&(a=eq.c.Splitter,b={self:this,id:b,el:c,pa:e.parentNode},c.classList.contains("eq-vert")?b.y=d.clientY:b.x=d.clientX,eq.app.moveCapture(b,a.move,a.move.done),d.stopPropagation());return!1};
eq.c.Splitter.prototype.changed=function(a,b,c,d){return-1!==d.indexOf("change")&&(a=c.querySelectorAll("#"+b+">.eq-pane>*"),2===a.length)?(a=a[0].getBoundingClientRect(),{id:b,ty:eq.RsValType.splitterPos,iv:c.classList.contains("eq-vert")?a.height:a.width}):null};eq.c.DlgElement.addClass("StaticText",function(a,b){eq.c.DlgElement.call(this,a,b)});
eq.c.StaticText.prototype.onAccel=function(a,b,c){for(;c=c.nextElementSibling;)if(!(a=c.classList).contains("eq-disabled")&&(a=a.contains("eq-focus")?c:c.querySelector(".eq-focus:not(.eq-disabled)"))){eq.app.setFocus(a.id,a);break}};eq.c.DlgElement.addClass("StatusBar",function(a,b){eq.c.DlgElement.call(this,a,b);this.globalDropRule=this.dropRule=0});
eq.c.StatusBar.prototype.setAttr=function(a,b,c,d){for(var e=eq.RqTag,f,g=a.constructor,h=0,l=d.length;h<l;h++){var k=d[h];switch(k.t){case e.dropRule:(this.dropRule=k.i)||this.globalDropRule?(c.ondragover=g.onDragOver,c.ondrop=g.onDrop):(c.ondragover=null,c.ondrop=null);break;case e.globalDropRule:(this.globalDropRule=k.i)||this.dropRule?(c.ondragover=g.onDragOver,c.ondrop=g.onDrop):(c.ondragover=null,c.ondrop=null);break;default:f?f.push(k):f=[k]}}f&&eq.c.DlgElement.prototype.setAttr.call(this,
a,b,c,f)};eq.c.StatusBar.prototype.onDrop=function(a,b,c,d,e){return e.drag?this.dropRule:this.globalDropRule};eq.c.DlgElement.addClass("TabBox",function(a,b){eq.c.DlgElement.call(this,a,b);this.ttTabs=null});eq.c.TabBox.prototype.dispose=function(a,b){var c;null!==(c=this.ttTabs)&&(c.length=0,this.ttTabs=null);eq.c.DlgElement.prototype.dispose.call(this,a,b)};
eq.c.TabBox.select=function(a,b,c,d){var e,f;if(c)if((e=c.parentNode)&&(f=e.classList)&&f.contains("eq-tabs")&&(f=c.classList)){if(f.contains("eq-selected")||f.contains("eq-hidden")||!d&&f.contains("eq-disabled"))return null}else e=void 0;a=b.children;e=void 0===e?-1:eq.Dom.parentIndex(c);b=null;d=0;for(var g=a.length;d<g;d++)for(var h=a[d].children,l=0,k=h.length;l<k;l++)f=(c=h[l]).classList,l!==e||f.contains("eq-hidden")?f.remove("eq-selected"):(f.add("eq-selected"),b=c);return b};
eq.c.TabBox.prototype.setAttr=function(a,b,c,d){for(var e=eq.c.TabBox,f=eq.app,g=eq.Dom,h=eq.RqTag,l,k=0,n=d.length;k<n;k++){var m=d[k];switch(m.t){case h.tabs:var p=eq.c.DlgElement,q=eq.TabState;m=m.v;var r=c.firstElementChild,t=[],u,v,y,w,B;if(!r||!r.classList.contains("eq-tabs")){var x=document.createElement("DIV");x.className="eq-rt eq-tabs";r=c.insertBefore(x,r)}null!==(u=this.ttTabs)&&(u.length=0);(v=m.length)?(this.ttTabs=u=[],u.length=v):this.ttTabs=u=null;if(v)var E=(y=r.children).length;
else r.textContent="",y=r.children,E=0;t.length=v;for(var z=0;z<v;z++){z<E?x=y[z]:(x=document.createElement("DIV"),x.className="eq-fn",r.appendChild(x));var A=x.classList;if((w=(B=m[z]).s)&q.visible){A.remove("eq-hidden");w&q.sensitive?A.remove("eq-disabled"):A.add("eq-disabled");(u[z]=B.tt)?f.ttAttach(x):f.ttDetach(x);p.setFont(x,B.f);if(A=B.i){x.textContent="";w=document.createElement("IMG");var C=document.createElement("SPAN");w.src=A;x.appendChild(w);x=x.appendChild(C)}t[z]=g.setContent(x,B.t||
" ",!0)}else A.add("eq-hidden"),f.ttDetach(x),u[z]=t[z]=null}for(;y.length>v;)r.removeChild(r.lastElementChild);e.select(a,c,null,!1);if(v)g.onNextCycle(e.setTabAccel,{dlg:a,el:c,ac:t});break;case h.selectedTab:(m=m.v)&&m<=(y=c.firstElementChild.children).length&&(x=y[m-1]);e.select(a,c,x,!0);break;default:l?l.push(m):l=[m]}}l&&eq.c.DlgElement.prototype.setAttr.call(this,a,b,c,l)};
eq.c.TabBox.setTabAccel=function(a){var b=a.dlg,c=b.eds,d=a.el;a=a.ac;for(var e=d.lastElementChild.children,f,g,h=0,l=e.length;h<l;h++){if(void 0===(g=c.get(f=e[h].id)))throw Error("TabBox.setTabAccel("+d.id+") BUG: child "+f+" not registered");g.setAccel(b,f,a[h],eq.KeyMod.alt)}};
eq.c.TabBox.prototype.onEvent=function(a,b,c,d){a=d.target;for(var e,f;a&&(!(e=a.classList)||!e.contains("eq-tabbox"));){if((f=a.parentNode)&&(e=f.classList)&&e.contains("eq-tabs"))return c.classList.contains("eq-rule")||c.lastElementChild.children[eq.Dom.parentIndex(a)].classList.contains("eq-rule");a=f}return!1};
eq.c.TabBox.prototype.onKey=function(a,b,c,d,e,f){if(e)return!1;a=c.parentNode.querySelectorAll(".eq-tabs > :not(.eq-hidden):not(.eq-disabled)");b=0;if(a.length){switch(d){case "Home":c=a[0];d=36;break;case "End":c=a[a.length-1];d=35;break;case "PageUp":b=-1;d=33;break;case "PageDown":b=1;d=34;break;default:return!1}if(0!==b){c=null;e=0;for(var g=a.length;e<g;e++)if(a[e].classList.contains("eq-selected")){-1===(e+=b)?e=g-1:e>=g&&(e=0);c=a[e];break}}if(null!==c)return a=eq.Dom,a.fireClick(c,{key:d}),
a.consumeEvent(f),!0}return!1};eq.c.TabBox.prototype.onTabAccel=function(a,b){for(var c=a.lastElementChild.children,d=0,e=c.length;d<e;d++)if(b===c[d]){a=(b=a.firstElementChild.children[d]).classList;a.contains("eq-hidden")||a.contains("eq-disabled")||(eq.Dom.fireClick(b),b.classList.add("eq-flash"),window.setTimeout(eq.c.TabBox.flashTab,100,b));break}};eq.c.TabBox.flashTab=function(a){a.classList.remove("eq-flash")};
eq.c.TabBox.prototype.onSubmit=function(a,b,c,d){a=c.lastElementChild.children;for(var e=0,f=a.length;e<f;e++)if((c=(b=a[e]).classList).contains("eq-selected")){c.contains("eq-rule")&&(d.id=b.id);break}};
eq.c.TabBox.prototype.onChange=function(a,b,c,d){if("mousedown"===d.type){var e=eq.Dom;d=d.target;for(var f,g;d&&(!(f=d.classList)||!f.contains("eq-tabbox"));){if((g=d.parentNode)&&(f=g.classList)&&f.contains("eq-tabs")){if(f=eq.c.TabBox.select(a,c,d,!1)){if(f.classList.contains("eq-rule")||c.classList.contains("eq-rule"))return void 0===this.a&&a.updateControl(b,c,{ev:{a:["mousedown"]}}),!0;void 0!==this.a&&a.updateControl(b,c,{ev:{a:null}});eq.app.apiUpdate(b,eq.UpdateTag.tabOrder,e.parentIndex(d))}break}d=
g}}return!1};eq.c.TabBox.prototype.onToolTip=function(a){for(var b,c,d;a&&(!(b=a.classList)||!b.contains("eq-tabbox"));){if((c=a.parentNode)&&(b=c.classList)&&b.contains("eq-tabs")){if(null!==(b=this.ttTabs)&&(a=eq.Dom.parentIndex(a),a<b.length&&(d=b[a])))return d;break}a=c}return null};
eq.c.TabBox.prototype.changed=function(a,b,c,d){return(c=c.firstElementChild)&&c.classList.contains("eq-tabs")&&(c=c.querySelector(".eq-tabs>.eq-selected"))?{id:b,ty:eq.RsValType.selectedTab,iv:eq.Dom.parentIndex(c)}:null};eq.c.TabBox.prototype.updated=function(a,b,c,d,e){var f=eq.UpdateTag;switch(d){case f.tabOrder:a.tabOrder=e;break;default:eq.c.DlgElement.prototype.updated.call(this,a,b,c,d,e)}};
eq.c.DlgElement.addClass("ToolBar",function(a,b){eq.c.DlgElement.call(this,a,b);this.globalDropRule=this.dropRule=0});
eq.c.ToolBar.prototype.setAttr=function(a,b,c,d){for(var e=eq.RqTag,f,g=a.constructor,h=0,l=d.length;h<l;h++){var k=d[h];switch(k.t){case e.dropRule:(this.dropRule=k.i)||this.globalDropRule?(c.ondragover=g.onDragOver,c.ondrop=g.onDrop):(c.ondragover=null,c.ondrop=null);break;case e.globalDropRule:(this.globalDropRule=k.i)||this.dropRule?(c.ondragover=g.onDragOver,c.ondrop=g.onDrop):(c.ondragover=null,c.ondrop=null);break;default:f?f.push(k):f=[k]}}f&&eq.c.DlgElement.prototype.setAttr.call(this,a,
b,c,f)};eq.c.ToolBar.prototype.onDrop=function(a,b,c,d,e){return e.drag?this.dropRule:this.globalDropRule};eq.c.DlgElement.addClass("Tree",function(a,b){eq.c.DlgElement.call(this,a,b);this.emptyNode=0;this.dnd=null;this.globalDropRule=this.dropRule=this.dndMode=0});eq.c.Tree.itemFlags={node:1,open:2,auto:4};eq.c.Tree.prototype.dispose=function(a,b){this.dnd=null;eq.c.DlgElement.prototype.dispose.call(this,a,b)};
eq.c.Tree.adjustElementTemplate=function(a){for(;a;){var b=a.ev,c,d;b&&(c=b.c)&&-1!==(d=c.indexOf("mousedown"))&&c.splice(d,0,"pointerdown");a=a.et}};
eq.c.Tree.select=function(a,b){var c;if(void 0!==b){var d=a.querySelectorAll(".eq-tree .eq-item");if(0<=b&&b<d.length)var e=(c=d[b]).classList}if(c){d=c;for(var f;(d=d.parentNode)&&(f=d.classList)&&!f.contains("eq-tree");)f.contains("eq-node")&&f.add("eq-open");this.scrollIntoView(a,{cb:this.scrollIntoView,ti:c})}d=a.querySelectorAll(".eq-tree .eq-selected");a=0;for(f=d.length;a<f;a++)d[a].classList.remove("eq-selected");return c?(e.add("eq-selected"),!0):!1};
eq.c.Tree.scrollIntoView=function(a,b){var c=b.ti,d,e;if(eq.app.idle||0>=(d=a.getBoundingClientRect().height)||0>=(e=c.querySelector(".eq-item>span").getBoundingClientRect().height))eq.Dom.onNextFrame(a,b);else b=a.scrollTop,c=c.offsetTop,c<b?a.scrollTop=Math.floor(c-e/2):c+e>b+d&&(a.scrollTop=Math.ceil(c+1.5*e-d))};eq.c.Tree.selectedIndex=function(a,b){void 0===b&&(b=a.querySelector(".eq-tree .eq-selected"));if(b){a=a.querySelectorAll(".eq-tree .eq-item");for(var c=0,d=a.length;c<d;c++)if(b===a[c])return c}return-1};
eq.c.Tree.itemIndex=function(a,b){a=a.querySelectorAll(".eq-tree .eq-item");for(var c=0,d=a.length;c<d;c++)if(b===a[c])return c;return-1};eq.c.Tree.itemExpanded=function(a){for(var b;a&&(!(b=a.classList)||!b.contains("eq-tree"));){if(b&&(b.contains("eq-node")||b.contains("eq-leaf"))){for(;(a=a.parentNode)&&(b=a.classList)&&!b.contains("eq-tree");)if(b.contains("eq-node")&&!b.contains("eq-open"))return!1;return!0}a=a.parentNode}return!1};
eq.c.Tree.moveDone=function(a){a.ti.classList.remove("eq-click");eq.app.setChanged(a.id,"status");return!0};
eq.c.Tree.prototype.setAttr=function(a,b,c,d){for(var e=eq.c.Tree,f=eq.RqTag,g,h=0,l=d.length;h<l;h++){var k=d[h];switch(k.t){case f.content:this.setContent(c.querySelector(".eq-tree>.eq-pane"),k.v);break;case f.activeLine:var n=k.v;0<n?e.select(c,n-1):e.select(c);break;case f.status:var m=c.querySelectorAll(".eq-tree .eq-node");n=k.v;var p=0,q=n.length;k=0;for(var r=m.length;k<r;k++){var t=m[k].classList;p<q&&k===n[p]&&!t.contains("eq-empty")?(t.add("eq-open"),p++):t.remove("eq-open")}break;case f.dndMode:m=
c.querySelectorAll(".eq-tree .eq-item>span");if(this.dndMode=k.i)for(n=a.constructor.onDragStart,k=0,r=m.length;k<r;k++)(p=m[k]).draggable=!0,p.ondragstart=n;else for(k=0,r=m.length;k<r;k++)(p=m[k]).draggable=!1,p.ondragstart=null;break;case f.dropRule:(this.dropRule=k.i)||this.globalDropRule?(m=a.constructor,c.ondragover=m.onDragOver,c.ondrop=m.onDrop):(c.ondragover=null,c.ondrop=null);break;case f.globalDropRule:(this.globalDropRule=k.i)||this.dropRule?(m=a.constructor,c.ondragover=m.onDragOver,
c.ondrop=m.onDrop):(c.ondragover=null,c.ondrop=null);break;default:g?g.push(k):g=[k]}}g&&eq.c.DlgElement.prototype.setAttr.call(this,a,b,c,g)};
eq.c.Tree.prototype.setContent=function(a,b,c){var d=eq.c.Tree.itemFlags,e=eq.Dom,f=b.length,g=this.dndMode;if(g)var h=eq.c.Dlg;a.textContent="";f||void 0===c||(c=c.classList,c.add("eq-empty"),c.remove("eq-open"),c.remove("eq-auto"));for(var l=0;l<f;l++){var k=b[l],n=document.createElement("DIV"),m=document.createElement("SPAN");if("object"===typeof k){var p=document.createElement("DIV"),q=document.createElement("DIV");c=n.classList;n.className="eq-item eq-node";k.f&d.open&&c.add("eq-open");k.f&d.auto&&
c.add("eq-auto");p.className="eq-button";n.appendChild(p);e.setContent(m,k.hc);g&&(m.draggable=!0,m.ondragstart=h.onDragStart);n.appendChild(m);q.className="eq-pane";this.setContent(q,k.ch,n);n.appendChild(q)}else n.className="eq-item eq-leaf",e.setContent(m,k),g&&(m.draggable=!0,m.ondragstart=h.onDragStart),n.appendChild(m);a.appendChild(n)}};
eq.c.Tree.prototype.onEvent=function(a,b,c,d){if("keydown"===d.type)return!0;a=d.target;for(var e;a&&(!(e=a.classList)||!e.contains("eq-tree"));){if("SPAN"===a.tagName){for(;(a=a.parentNode)&&(!(e=a.classList)||!e.contains("eq-tree"));)if(e&&(e.contains("eq-node")||e.contains("eq-leaf")))return!0;break}a=a.parentNode}return!1};
eq.c.Tree.prototype.onKey=function(a,b,c,d,e,f){if(e)return!1;var g=eq.c.Tree;e=eq.app;var h=eq.Dom,l=h.isEnterOrSpace(d);if(l){if(d=c.querySelector(".eq-tree .eq-selected>span"))f.eq={key:l},e.processEvent(a,f,b,c,this);h.consumeEvent(f);return!0}switch(d){case "Escape":case "Esc":return g.select(c),h.consumeEvent(f),!0;case "Home":case "PageUp":case "End":case "PageDown":case "ArrowUp":case "Up":case "ArrowDown":case "Down":break;case "ArrowLeft":case "Left":var k=-1;break;case "ArrowRight":case "Right":k=
1;break;default:return!1}if(void 0!==k){if(d=c.querySelector(".eq-tree .eq-node.eq-selected")){a=d.classList;var n;if(1===k){if(!a.contains("eq-open"))if(a.contains("eq-empty")){var m;"rule"in c.dataset&&-1!==(m=g.itemIndex(c,d))&&(k=c.dataset.rule,+k===+k&&(this.emptyNode=m+1,e.setChanged(b,"emptynode"),e.onceRule=k,e.onceId=b,e.submit(c,{id:b,type:"click"})))}else a.add("eq-open"),e.setChanged(b,"status")}else a.contains("eq-open")&&(a.remove("eq-open"),e.setChanged(b,"status"),c.classList.contains("eq-auto")&&
a.contains("eq-auto")&&(n=d.querySelector(".eq-pane"))&&(n.textContent="",a.remove("eq-auto"),a.add("eq-empty")))}h.consumeEvent(f);return!0}n=c.querySelectorAll(".eq-tree .eq-item");var p=n.length;if(p){switch(d){case "Home":m=0;l=36;break;case "End":m=p-1;l=35;break;case "PageUp":m=0;l=33;break;case "PageDown":m=p-1;l=34;break;case "ArrowUp":case "Up":k=-1;l=38;break;case "ArrowDown":case "Down":k=1,l=40}d=g.selectedIndex(c);void 0!==k&&(-1===(m=d)?m=0:-1===(m+=k)?m=0:m>=p&&(m=p-1));for(var q=m;!g.itemExpanded(n[q]);)if(0>
k){if(-1===--q){for(q=m;!g.itemExpanded(n[++q]););break}}else if(++q===p){for(q=m;!g.itemExpanded(n[--q]););break}if(q!==d&&(g.select(c,q)&&e.setChanged(b,"change"),this.f))return f.eq={key:l},e.processEvent(a,f,b,c,this),h.consumeEvent(f),!0}h.consumeEvent(f);return!0};
eq.c.Tree.prototype.onChange=function(a,b,c,d){var e="pointerdown"===d.type;if(e||"mousedown"===d.type){a=eq.c.Tree;var f=eq.app;if(d=d.target)if(d.classList.contains("eq-button")){d=d.parentNode;var g;if(d&&(g=d.classList)&&g.contains("eq-node")){e=!0;var h,l;g.contains("eq-open")?(g.remove("eq-open"),c.classList.contains("eq-auto")&&g.contains("eq-auto")&&(h=d.querySelector(".eq-pane"))&&(h.textContent="",g.remove("eq-auto"),g.add("eq-empty"))):g.contains("eq-empty")?(e=!1,"rule"in c.dataset&&-1!==
(l=a.itemIndex(c,d))&&(h=c.dataset.rule,+h===+h&&(this.emptyNode=l+1,f.setChanged(b,"emptynode"),f.onceRule=h,f.onceId=b,f.submit(c,{id:b,type:"click"})))):g.add("eq-open");e&&(g.add("eq-click"),f.moveCapture({id:b,ti:d},null,a.moveDone))}}else for(;d&&(!(g=d.classList)||!g.contains("eq-tree"));){if(g&&g.contains("eq-item")){if(e)return!0;l=a.selectedIndex(c,d);if(a.select(c,l))return f.setChanged(b,"change"),!0;break}d=d.parentNode}}return!1};
eq.c.Tree.prototype.onDragStart=function(a,b,c,d,e,f){a=this.dndMode;c=eq.Dnd;return a&c.local?(f.drag={id:b},eq.c.DlgElement.setDropModes(e,a),!0):a&c.global?(e.dataTransfer.setData("text/plain",d.textContent),eq.c.DlgElement.setDropModes(e,c.all),!0):!1};eq.c.Tree.prototype.onDragOver=function(a,b,c,d){for(var e,f;d&&(e=d.parentNode);){if((f=e.classList)&&f.contains("eq-item"))return d;if(e===c||f&&f.contains("eq-pane"))break;d=e}return null};
eq.c.Tree.prototype.onDrop=function(a,b,c,d,e){for(;d&&(d=d.parentNode)&&(!(a=d.classList)||!a.contains("eq-item"));)if(d===c||a&&a.contains("eq-pane"))return this.dndMode&eq.Dnd.dropExact?0:(e.drop.line=0,(this.dnd=e).ch.push(e.drop.id=b),e.drag?this.dropRule:this.globalDropRule);if(d){c=c.querySelectorAll(".eq-tree .eq-item");a=0;for(var f=c.length;a<f;a++)if(d===c[a])return e.drop.line=a+1,(this.dnd=e).ch.push(e.drop.id=b),e.drag?this.dropRule:this.globalDropRule}return 0};
eq.c.Tree.prototype.changed=function(a,b,c,d){a=[];for(var e=0,f=d.length;e<f;e++)switch(d[e]){case "change":a.push({ty:eq.RsValType.activeLine,iv:eq.c.Tree.selectedIndex(c)+1});break;case "emptynode":0<this.emptyNode&&(a.push({ty:eq.RsValType.emptyNode,iv:this.emptyNode}),this.emptyNode=0);break;case "status":for(var g=c.querySelectorAll(".eq-tree .eq-node"),h=[],l=0,k=g.length;l<k;l++)g[l].classList.contains("eq-open")&&h.push(l);a.splice(0,0,{ty:eq.RsValType.status,vv:h});break;case "dnd":g=this.dnd;
var n,m;g&&(n=g.drop)&&n.id===b&&void 0!==(m=n.line)&&a.push({ty:eq.RsValType.dropLine,iv:m})}this.dnd=null;switch(a.length){case 0:return null;case 1:return a[0].id=b,a[0];default:return{id:b,v:a}}};eq.c.Menu.addClass("WindowMenu",function(a,b){eq.c.Menu.call(this,a,b)});
eq.c.WindowMenu.prototype.onChange=function(a,b,c,d){a=eq.Dom;var e=c.classList.contains("eq-open");a.closeMenu();if(e)for(b=d.target;(b=b.parentNode)&&b!==c;){if(b.classList.contains("eq-item")){eq.c.App.activateSession(eq.app.sessionByIndex(a.parentIndex(b)));break}}else{d=eq.app;e=c.lastElementChild;var f=d.sessionTitles();e.textContent="";for(var g=0,h=f.length;g<h;g++){var l=document.createElement("LI"),k=document.createElement("LABEL");l.className="eq-item";k.className="eq-fn";a.setContent(k,
f[g]);l.appendChild(k);e.appendChild(l)}c.classList.add("eq-open");d.menuOpen=b;d.constructor.ttClose()}return!0};
eq.c.Obj.subClass("App",function(){eq.c.Obj.call(this);this.scrn=null;this.initSessionList();this.cssClasses=this.title=null;this.dlg=new Map;this.currDlg=null;this.pendingSync=this.pendingCurrDlgId=0;this.pendingFocus=this.focus=null;this.dlgFocus=!1;this.changed=new Map;this.dialogTimers=new eq.c.Timers;this.mouseDownTimers=new eq.c.Timers;this.idle=!0;this.fnDefault=this.locale=null;this.fnSizeFactor=void 0;this.dnd=this.logoIcon=null;this.dndSerial=0;var a=/^(http[s]?:\/\/)([^/]+)(\/[^?#]+\/)?[^?#]*[?#]?.*$/i;
try{var b=a.exec(document.querySelector("script#eq-webdlg").src);this.scriptBase=b[1]+b[2]+(b[3]||"/")}catch(f){throw Error('WEBDLG: <script id="eq-webdlg"> not found');}try{this.app=/[?&]app=([^&#]+)/i.exec(b[0])[1]}catch(f){}try{var c=/[?&]host=([^&#]+)/i.exec(b[0])[1]}catch(f){}try{var d=/[?&]port=([^&#]+)/i.exec(b[0])[1]}catch(f){}try{var e=/[?&]path=([^&#]+)/i.exec(b[0])[1]}catch(f){}b=a.exec(window.location.href);c=c||b[2];if(d)try{c=/^(.+?:)[^:]*$/.exec(c)[1]+d}catch(f){c+=":"+d}this.appBase=
b[1]+c;void 0!==e?(e=e.replace(/^\/|\/$/g,""),e=e.length?"/"+e+"/":"/"):e=this.constructor.sameOrigin(this.appBase,this.scriptBase)?b[3]||"/":"/";this.appBase+=e;this.appWS="ws"+b[1].substring(4).toLowerCase()+c+e});delete eq.c.App.subClass;eq.c.App.doubleClick={tv:200,md:[0,0],mu:[0,0]};eq.c.App.toolTipTimeout={show:750,hide:5E3,update:75};eq.c.App.timeout={pagehide:300,debounceKey:500,showIdle:2E3,typeAhead:1E4};
eq.c.App.start=function(a){var b=eq.app,c=b.constructor,d=window.sessionStorage;eq.c.MessageDialog.close();var e=document.body.getElementsByClassName("eq-start");for(var f=0,g=e.length;f<g;f++){if(void 0!==a&&a.target===e[f]&&"app"in e[f].dataset)var h=e[f].dataset.app;e[f].removeEventListener("click",c.start);e[f].classList.add("eq-disabled");"disabled"in e[f]&&(e[f].disabled=!0)}if(void 0===b.currApp)if(void 0!==h)b.currApp=h;else{if(!b.app)throw Error("Cannot start, application name undefined");
b.currApp=b.app}d.setItem("eq-webdlg.app",b.currApp);a=b.args||c.args;b.args=void 0;b.api.postMessage({o:eq.ApiOp.openWebSocket,v:eq.p.version,app:b.currApp,url:b.appWS,sid:d.getItem("eq-webdlg.sid"),args:a});(e=document.documentElement).classList.add("eq-webdlg");e.classList.contains("eq-restart")&&(b.restart=!0,e.classList.remove("eq-restart"))};
eq.c.App.prepareStart=function(a){var b=eq.app;if(void 0===a&&(b.currApp=window.sessionStorage.getItem("eq-webdlg.app")))return this.start(),!1;if(a&&void 0!==b.currApp&&document.documentElement.classList.contains("eq-restart")){a=window.sessionStorage;var c=a.getItem("eq-webdlg.sid"),d=a.getItem("eq-webdlg.opn");b.updateSessionList(!0);a.removeItem("eq-webdlg.app");a.removeItem("eq-webdlg.uat");a.removeItem("eq-webdlg.sid");d&&d===c&&a.removeItem("eq-webdlg.opn");this.start();return!1}b.currApp=
void 0;b=document.body.getElementsByClassName("eq-start");a=b.length;if(!a)return!0;for(c=0;c<a;c++)b[c].addEventListener("click",this.start),b[c].classList.remove("eq-disabled"),"disabled"in b[c]&&(b[c].disabled=!1);return!1};
eq.c.App.stopped=function(){var a=eq.app,b=a.constructor,c,d,e,f,g;a.stopped=window.setTimeout(b.onStopped,b.timeout.pagehide);a.ttDispose();a.mouseDownTimers.dispose();a.dialogTimers.dispose();void 0!==a.typeAhead&&(b.cancelTypeAhead(),a.typeAhead=void 0);a.cancelUserAction();eq.c.LoginDialog.close();void 0!==a.popupBox&&(a.popupBox.close(),a.popupBox=void 0);a.dndSerial=0;if(c=a.dnd)(d=c.drag)&&(e=d.over)&&e.classList.remove("eq-dragover"),a.dnd=null;a.dlg.forEach(b.cbCloseDlg);a.dlg.clear();a.currDlg=
null;a.pendingCurrDlgId=0;a.pendingSync=0;a.cleanupStyles();a.focus=null;a.pendingFocus=null;a.dlgFocus=!1;a.changed.clear();a.pendingMouseDown=void 0;a.pendingClick=void 0;a.pendingTabMode=void 0;a.pendingTabModeId=void 0;a.onceRule=void 0;a.onceId=void 0;a.layoutMode=void 0;a.notifyBusy=void 0;a.idle=!0;for(f in eq.c)(g=eq.c[f]).dispose&&g.dispose();a.fnDefault=null;a.fnSizeFactor=void 0;a.logoIcon=null;a.title=null;a.popupPos=void 0;if(c=a.wfs)c.clear(),a.wfs=void 0;this.scrn=null;c=document.documentElement.classList;
c.remove("eq-webdlg");b.warnWhenLeavingPage(!1);a.warnLeavingPage=0;if(null!==a.cssClasses){d=0;for(e=(b=a.cssClasses).length;d<e;d++)c.remove(b[d]);a.cssClasses=null}};eq.c.App.onStopped=function(){var a=eq.app,b=window.sessionStorage,c=b.getItem("eq-webdlg.sid"),d=b.getItem("eq-webdlg.opn");a.stopped=void 0;a.updateSessionList(!0);b.removeItem("eq-webdlg.app");b.removeItem("eq-webdlg.uat");b.removeItem("eq-webdlg.sid");d&&(d===c?b.removeItem("eq-webdlg.opn"):c&&window.close())};
eq.c.App.cbCloseDlg=function(a){a.close()};
eq.c.App.domReady=function(a){var b=eq.app,c=b.constructor;c.title=document.title;var d=document.getElementById("eq-style");d||(d=document.createElement("STYLE"),d.id="eq-style",document.head.appendChild(d));b.stl={sheet:d.sheet,owner:[]};if(!b.stl.sheet)throw Error('WEBDLG: <style id="eq-style"> StyleSheet undefined');b.cleanupStyles();void 0!==window.onhelp&&(window.addEventListener("help",c.onHelp,!0),c.onHelpInstalled=!0);void 0!==document.onhelp&&(document.addEventListener("help",c.onHelp,!0),
c.onHelpInstalled=!0);"complete"===document.readyState?c.documentComplete():window.addEventListener("load",c.documentComplete);c.prepareStart()&&c.start();void 0!==a&&window.removeEventListener("DOMContentLoaded",c.domReady);delete c.domReady};
eq.c.App.documentComplete=function(a){var b=eq.app,c=b.constructor,d,e;b.api.postMessage({o:eq.ApiOp.documentComplete,v:eq.p.version,b:b.appBase});void 0!==(d=eq.plugin)&&(e=d.install()).length&&b.api.postMessage({o:eq.ApiOp.installPlugins,p:e});void 0!==a&&window.removeEventListener("load",c.documentComplete);delete c.documentComplete};
eq.c.App.apiStart=function(){var a=eq.app,b=a.constructor;b.sameOrigin(window.location.href,a.scriptBase)?a.api=new Worker(a.scriptBase+"eq-webdlg-api.js"):(a.apiUrl=(window.URL||window.webkitURL).createObjectURL(new Blob(["importScripts('"+a.scriptBase+"eq-webdlg-api.js');"],{type:"application/javascript"})),a.api=new Worker(a.apiUrl));a.api.onmessage=b.apiReceived;a.api.onerror=b.apiError};eq.c.App.sameOrigin=function(a,b){var c=this.sameOrigin.re;return c.exec(a)[1]===c.exec(b)[1]};
eq.c.App.sameOrigin.re=/^(http[s]?:\/\/[^/]+)/i;
eq.c.App.apiReceived=function(a){var b=eq.app,c=b.constructor,d=eq.MainOp,e=!1;b.dlgListen&&c.dlgListener.close();for(var f=0,g=a.data.length;f<g;f++){var h=a.data[f],l=h.o,k=h.d;switch(l){case d.apiThreadStarted:void 0!==b.apiUrl&&((window.URL||window.webkitURL).revokeObjectURL(b.apiUrl),b.apiUrl=void 0);continue;case d.ssnNewOrResume:var n=window.sessionStorage,m=n.getItem("eq-webdlg.sid");h=n.getItem("eq-webdlg.opn");if(!k.uat)throw Error("apiReceived ssnNewOrResume: invalid, user agent tag undefined");n.setItem("eq-webdlg.uat",
k.uat);if(!k.sid)throw Error("apiReceived ssnNewOrResume: invalid, session id undefined");n.setItem("eq-webdlg.sid",k.sid);m&&m===h&&(m=h=null);h||n.setItem("eq-webdlg.opn",k.sid);window.name="eq-webdlg."+k.sid;b.updateSessionList();b.title=k.title;b.locale=k.locale;b.fnDefault=k.fn;b.fnSizeFactor=k.sf;b.logoIcon=k.icon;b.cssClasses=k=k.css;n=document.documentElement.classList;h=0;for(l=k.length;h<l;h++)n.add(k[h]);c.warnWhenLeavingPage(!0);m||c.dlgListener.message();continue;case d.inject:k=h.inj;
m=!0;h=0;for(l=k.length;h<l;h++)c.inject(k[h])&&(m=!1);m&&b.api.postMessage({o:eq.ApiOp.injectDone});continue;case d.message:new eq.c.MessageDialog(h.s,1E4,null);continue;case d.login:new eq.c.LoginDialog(h.login,h.save);continue;case d.applicationStopped:c.stopped();k&&c.prepareStart(!0);continue;case d.applicationFailed:c.stopped();b.currApp=void 0;c.prepareStart(!1);continue;case d.popupPos:b.popupPos=k;continue;case d.warnLeavingPage:b.warnLeavingPage=1<k?k:c.dlgListener()?0:k;continue;case d.windowFeature:var p=
b.wfs;k=h.k.toUpperCase();h=h.v;p||(p=new Map);h.length?p.set(k,h):p.delete(k);b.wfs=p;continue;case d.windowFeatures:(p=b.wfs)?p.clear():p=new Map;h=0;for(l=k.length;h<l;h++)m=k[h],p.set(m.k.toUpperCase(),m.v);b.wfs=p;continue;case d.layout:b.layoutMode=k;continue;case d.notifyBusy:b.notifyBusy=0!==k;continue;case d.typeAhead:k?void 0===b.typeAhead&&(b.typeAhead={active:!1,dlg:null,focus:null,buf:[],timer:0}):void 0!==b.typeAhead&&(c.cancelTypeAhead(),b.typeAhead=void 0);continue;case d.cancelCurrentCall:l=
h.i;if(!l)var q=b.currDlg;else if(void 0===(q=b.dlg.get(l))||l!==b.pendingCurrDlgId&&q!==b.currDlg)continue;null!==q?(b.mouseDownTimers.dispose(),b.dialogTimers.dispose(),b.cancelUserAction(),b.startTypeAhead(),(q=b.currDlg)&&q.resetCurrDlg(),b.pendingSync=0,b.pendingCurrDlgId=0):void 0!==b.popupBox&&(b.popupBox.close(),b.popupBox=void 0);l&&b.api.postMessage({o:eq.ApiOp.canceled,i:l});continue;case d.update:var r=h.c;if(r.length){var t;if(void 0===(q=b.dlg.get(h.i)))throw Error("apiReceived update: DLG "+
h.i+" does not exist");if(void 0===(t=q.eds.get(r)))throw Error("apiReceived update: id "+r+" not registered");var u=document.getElementById(r);k=t.onUpdate(q,r,u,h.t,h.a,h.x);null===k&&(t.ddi=h)}else q=void 0,k=eq.c.DlgElement.onUpdate(h,h.t);null!==k&&(eq.c.DlgElement.onUpdateReturn(h,k),void 0!==q&&q.temp&&b.closeDialog(q));continue;case d.updated:q=b.currDlg;null!==q&&k===q.id&&(u=document.getElementById(r=h.i))&&void 0!==(t=q.eds.get(r))&&t.updated(q,r,u,h.t,h.a);continue;case d.synced:if(2!==
b.pendingSync)throw Error("apiReceived synced BUG: pendingSync="+b.pendingSync);b.pendingSync=0;continue;case d.openUrl:l=k.t;m=k.k;(h=(p=b.wfs)?p.get(m.toUpperCase()):void 0)&&(h=eq.Dom.resolveWindowFeatures(h));window.open(k.u,0===l.lastIndexOf("_",0)?l:"eq-webdlg."+l,h)||console.error("Failed to open window '"+m+"' for URL '"+k.u+"'");continue;case d.beep:c.beep();continue;case d.playSound:c.playSound(k.url);continue;case d.startApp:l=k.app;h=k.wf;h||(h=(p=b.wfs)?p.get(l.toUpperCase()):void 0);
h&&(h=eq.Dom.resolveWindowFeatures(h));window.open(eq.Dom.updateQueryString(window.location.href,"app",l),"_blank",h)||console.error("Failed to open window for application '"+l+"'");continue;case d.activate:c.activateSession(b.sessionByTitle(k));continue;case d.clipboard:window.isSecureContext&&navigator.clipboard?navigator.clipboard.writeText(k).catch(function(v){console.warn("Clipboard.writeText failed: "+v.message)}):console.warn("Clipboard: not available");continue;case d.invalidate:for(h=k.length;0<=
--h;)q=b.dlg.get(k[h]),void 0!==q&&b.closeDialog(q);continue;case d.onMouseButton2:b.onMouseButton2(h.d,h.i,h.x,h.y,h.c);continue;case d.onClipboardMenu:b.onClipboardMenu(h.d,h.i,h.x,h.y,h.c,h.m);continue}if(null===b.currDlg||!b.currDlg.ddo){if(!b.idle)throw Error("apiReceived op "+l+": invalid, not idle");if(null!==b.currDlg)throw Error("apiReceived op "+l+": invalid, current Dialog pending");if(null!==b.focus)throw Error("apiReceived op "+l+": invalid, focus pending");if(b.changed.size)throw Error("apiReceived op "+
l+": invalid, "+b.changed.size+" changed elements pending");}if(void 0!==b.popupBox)throw Error("apiReceived op "+l+": invalid, POPUP BOX open");if(0!==b.pendingSync)throw Error("apiReceived op "+l+": invalid, pendingSync="+b.pendingSync);if(0!==b.pendingCurrDlgId)throw Error("apiReceived op "+l+": invalid, pendingCurrDlgId="+b.pendingCurrDlgId);switch(l){case d.resume:e=!0;break;case d.grid:l=h.i;k=h.f;q=b.dlg.get(l);void 0===q&&(q=b.newDialog(l));q.calcGrid(q.fn=k);b.api.postMessage({o:eq.ApiOp.grid,
d:l,g:q.grid});break;case d.addControl:l=h.i;q=b.dlg.get(l);if(void 0===q){if("eq-temp"!==k.pa)throw Error("apiReceived addControl: DLG "+l+" does not exist");q=b.newTempDialog(l)}if(void 0!==k.pa){u=document.getElementById(k.pa);if(!u)throw Error("apiReceived addControl: parent '"+k.pa+"' does not exist");(n=u.classList).contains("eq-container")||(u=n.contains("eq-dialog")?u.querySelector(".eq-dialog>.eq-pane>.eq-view>.eq-container"):u.querySelector(".eq-container"));if(!u)throw Error("apiReceived addControl: parent '"+
k.pa+"' container not found");u=q.addControl(k,u)}else q.close(),q.addRoot(q.addControl(k)),b.setIdle(q);break;case d.modifyControl:l=h.i;q=b.dlg.get(l);if(void 0===q)throw Error("apiReceived modifyControl: DLG "+l+" does not exist");if(!k.id)throw Error("apiReceived modifyControl: id not set");if(!(u=document.getElementById(k.id)))throw Error("apiReceived modifyControl: id '"+k.id+"' does not exist");q.modifyControl(k.id,u,k);break;case d.deleteControl:l=h.i;q=b.dlg.get(l);u=document.getElementById(k);
if(void 0===q)throw Error("apiReceived deleteControl: DLG "+l+" does not exist");if(!u)throw Error("apiReceived deleteControl: id '"+k+"' does not exist");q.removeElement(u)&&b.closeDialog(q);break;case d.dlg_DRAW:e&&(e=!1,b.dialogsVisible());b.pendingSync=1;eq.Dom.onNextCycle(c.dlg_DRAW,h);break;case d.dlg_DO:e&&(e=!1,b.dialogsVisible());b.restart&&(b.restart=void 0,document.documentElement.classList.add("eq-restart"));l=h.i;q=b.dlg.get(l);if(void 0===q)throw Error("apiReceived dlg_DO: DLG "+l+" does not exist");
q.ddo&&(b.pendingSync=1);b.pendingCurrDlgId=l;eq.Dom.onNextCycle(c.dlg_DO,h);break;case d.dlg_POPUP_BOX:e&&(e=!1,b.dialogsVisible());b.restart&&(b.restart=void 0,document.documentElement.classList.add("eq-restart"));b.popupBox=new eq.c.PopupBox(k);b.dlgFocus=!0;break;default:throw Error("apiReceived invalid op: "+l);}}if(e&&(b.dialogsVisible(),(q=b.topDialog())&&q.ddo)){if(null!==b.currDlg)throw Error("apiReceived resume: invalid, current Dialog pending");b.setCurrDialog(q);q.ddo.f&&b.setFocus(q.ddo.f);
q.ddo.t&&(q.tabOrder=q.ddo.t);b.setIdle()}};
eq.c.App.dlg_DO=function(a){var b=eq.app,c=b.constructor,d=a.i,e=b.pendingCurrDlgId,f=b.dlg.get(d);b.pendingCurrDlgId=0;if(void 0===f)throw Error("App.dlg_DO: DLG "+d+" does not exist");if(f.whenReady&&f.ddo)throw Error("App.dlg_DO BUG: whenReady pending");if(e!==d){if(0!==e)throw Error("App.dlg_DO: unexpected pending DLG "+e+", expected: "+d+" or zero");}else f.whenReady=c.dlg_DO.ready,f.whenReadyArg=a.d.f,b.setCurrDialog(f),void 0!==(a=a.d.t)&&(f.tabOrder=a)};
eq.c.App.dlg_DO.ready=function(a,b){var c=eq.app,d=c.constructor;if(a!==c.currDlg){if(c.currDlg)throw Error("App.dlg_DO.ready: unexpected DLG "+c.currDlg.id+", expected: "+a.id);if(a.ddo){if(1!==c.pendingSync)throw Error("App.dlg_DO.ready BUG: Dialog.do pendingSync="+c.pendingSync);c.pendingSync=2;c.api.postMessage({o:eq.ApiOp.onSynced})}}else{b?c.setFocus(b):d.resetFocus();c.setIdle();if(null!==c.pendingFocus){b=c.pendingFocus;var e,f;c.pendingFocus=null;b.id===c.focus&&(e=b.act)&&(f=document.getElementById(b.id))&&
e(f)}if(a.ddo){if(1!==c.pendingSync)throw Error("App.dlg_DO.ready BUG: Dialog.do pendingSync="+c.pendingSync);c.pendingSync=2;c.api.postMessage({o:eq.ApiOp.onSynced})}else{e=a.w;if(null!==e){var g;(f=e.root.querySelector(".eq-window>.eq-pane>.eq-caption>.eq-close"))&&(g=f.classList).contains("eq-click")&&g.remove("eq-click");if(a.pendingClose){eq.Dom.onNextCycle(d.submitWindowClose);return}d.warnWhenLeavingPage(1<c.warnLeavingPage||!e.canClose())}if(a.vcrule&&c.scrn&&c.scrn.updated)eq.Dom.onNextCycle(d.submitViewChanged);
else c.dlgFocus=!0,void 0!==a.timer&&c.dialogTimers.add(a.timer.delay,d.submitDialogTimer,null,a.timer.rule)}}};eq.c.App.dlg_DRAW=function(a){var b=eq.app;a=a.i;var c=b.dlg.get(a);if(void 0===c)throw Error("App.dlg_DRAW: DLG "+a+" does not exist");if(c.whenReady)throw Error("App.dlg_DRAW BUG: whenReady pending");c.whenReady=b.constructor.dlg_DRAW.ready;b.setCurrDialog(c)};
eq.c.App.dlg_DRAW.ready=function(a){var b=eq.app;if(a!==b.currDlg){if(b.currDlg)throw Error("App.dlg_DRAW.ready: unexpected DLG "+b.currDlg.id+", expected: "+a.id);}else a.ddo||(b.currDlg=null);if(1!==b.pendingSync)throw Error("App.dlg_DRAW.ready BUG: Dialog.do pendingSync="+b.pendingSync);b.pendingSync=2;b.api.postMessage({o:eq.ApiOp.onSynced})};eq.c.App.submitWindowClose=function(){var a=eq.app,b;!a.idle&&(b=a.currDlg)&&b.pendingClose&&(b.pendingClose=void 0,a.submit(document.body,{type:"close"}))};
eq.c.App.submitDialogTimer=function(a){var b=eq.app;!b.idle&&b.currDlg&&(b.onceRule=a,b.submit(document.body,{type:"timer"}))};eq.c.App.submitViewChanged=function(){var a=eq.app,b,c;!a.idle&&(b=a.currDlg)&&(c=b.vcrule)&&(a.onceRule=c,a.submit(document.body,{type:"change"}))};eq.c.App.prototype.apiUpdate=function(a,b,c){var d=this.currDlg;if(!d)throw Error("BUG: apiUpdate no current Dialog");this.api.postMessage({o:eq.ApiOp.update,d:d.id,i:a,t:b,a:c})};
eq.c.App.apiError=function(){var a=eq.app;void 0!==a.apiUrl&&((window.URL||window.webkitURL).revokeObjectURL(a.apiUrl),a.apiUrl=void 0)};
eq.c.App.onEvent=function(a){var b=eq.app,c=eq.Dom,d=a.target;switch(a.type){case "focusin":var e=!0;break;case "mousedown":if(0!==a.button)return;var f=!0}b.dlgFocus=!0;if(d.classList.contains("eq-idle"))c.consumeEvent(a),f&&(d.style.cursor="wait",b.notifyBusy&&b.constructor.beep());else if(!b.idle){var g=c.eqControl(d),h;if(g){if((h=g.classList).contains("eq-disabled")){f&&h.contains("eq-md")||c.consumeEvent(a);if(b.menuOpen)c.onNextCycle(c.closeMenu);return}var l=g.id,k=b.currDlg,n;if(!k)throw Error("BUG: onEvent no current Dialog");
if(void 0!==(n=k.eds.get(l))){if(f){var m=h.contains("eq-focus")||h.contains("eq-md");b.pendingMouseDown={id:l,t:d}}else if(e){h.contains("eq-focus")?l!==b.focus&&b.setFocus(l,g):c.consumeEvent(a);return}b.processEvent(k,a,l,g,n)}h=b.menuOpen&&c.isMenu(g)}if(f&&(m||c.consumeEvent(a),b.menuOpen&&!h))c.onNextCycle(c.closeMenu)}};
eq.c.App.prototype.processEvent=function(a,b,c,d,e){var f=b.type;if(void 0!==e.c&&-1!==e.c.indexOf(f)){var g=this.changed.get(c);void 0===g?this.changed.set(c,[f]):-1===g.indexOf(f)&&g.push(f);if(!e.onChange(a,c,d,b))return!1}if(void 0!==e.a&&-1!==e.a.indexOf(f)){if(!e.onEvent(a,c,d,b))return!1;if("mousedown"===f){if(void 0!==(a=this.pendingClick)){this.stopPendingClickTimer();if(void 0===e.m)return!1;c!==a.id&&eq.c.App.commitPendingClick();return!0}d={btn:b.buttons};if(void 0===d.btn)switch(b.button){case 0:d.btn=
1;break;case 1:d.btn=4;break;case 2:d.btn=2;break;default:d.btn=0}this.pendingClick={id:c,type:"click",cnt:0,ea:d}}else if(void 0!==(a=this.pendingClick)){if(void 0!==a.ev)throw Error("BUG: onEvent pending click id:"+a.id+" and id:"+a.ev.id+" type:"+a.ev.type);a.ev={id:c,type:f,ea:b.eq}}else this.submit(d,{id:c,type:f,ea:b.eq});return!0}return!1};eq.c.App.prototype.cancelUserAction=function(){void 0!==this.capture&&this.endCapture();this.closeOverlay();eq.Dom.closeMenu()};
eq.c.App.onCancelUserAction=function(a){if("focus"==a.type)eq.Dom.isRootChild(a.target)||eq.c.PopupBox.setFocus()?eq.app.dlgFocus=!0:eq.c.LoginDialog.setFocus(a)||eq.c.MessageDialog.setFocus();else if(a.target===window){var b=eq.app;b.cancelUserAction();"blur"==a.type&&(b.dlgFocus=!1)}};
eq.c.App.prototype.setChanged=function(a,b){if(!this.idle){var c=this.currDlg,d;if(!c)throw Error("BUG: setChanged no current Dialog");void 0!==(d=c.eds.get(a))&&void 0!==d.c&&-1!==d.c.indexOf(b)&&(c=this.changed.get(a),void 0===c?this.changed.set(a,[b]):-1===c.indexOf(b)&&c.push(b))}};
eq.c.App.prototype.elementsChanged=function(a){var b=this.constructor,c=this.currDlg,d,e,f,g,h=[{ty:eq.RsValType.idFocus,sv:this.focus||""}];if(!c)throw Error("BUG: elementsChanged no current Dialog");void 0!==a&&(void 0!==a.key?h.push({ty:eq.RsValType.ruleKey,iv:a.key}):(void 0!==a.btn&&h.push({ty:eq.RsValType.mouseBtns,iv:a.btn}),void 0!==a.cnt&&h.push({ty:eq.RsValType.mouseCnt,iv:a.cnt}),void 0!==a.mod&&h.push({ty:eq.RsValType.mouseMods,iv:a.mod})));null!==(d=c.w)&&(f=(e=d.root).querySelector(".eq-window>.eq-pane>.eq-dialog>.eq-pane>.eq-view"))&&
((a=d.modified).maximized&&(a.maximized=void 0,h.push({ty:eq.RsValType.dialogMax,iv:e.classList.contains("eq-max")?1:0})),a.pos&&(a.pos=void 0,h.push({ty:eq.RsValType.dialogPos,x:e.offsetLeft,y:e.offsetTop})),a.size&&(a.size=void 0,h.push({ty:eq.RsValType.dialogSize,w:f.offsetWidth,h:f.offsetHeight})));(g=this.scrn)&&g.updated&&(g.updated=!1,h.push({ty:eq.RsValType.screenSize,w:g.w,h:g.h}));void 0!==this.onceRule&&(h.push({id:this.onceId,ty:eq.RsValType.ruleOnce,iv:this.onceRule}),this.onceId=this.onceRule=
void 0);this.changed.forEach(b.cbElementsChanged,{d:c,c:h});this.changed.clear();return h};eq.c.App.prototype.updateElementsChanged=function(){var a=this.constructor,b=this.currDlg,c=[];if(!b)throw Error("BUG: updateElementsChanged no current Dialog");this.changed.forEach(a.cbElementsChanged,{d:b,c:c});this.changed.clear();return c};
eq.c.App.cbElementsChanged=function(a,b){var c=this.d,d,e;if(void 0===(d=c.eds.get(b)))throw Error("BUG: elementsChanged id:"+b+" not registered, type:"+a);var f=document.getElementById(b);f.classList.contains("eq-event")||(f=f.querySelector(".eq-event"));if(!f)throw Error("BUG: cbElementsChanged id:"+b+" event element not found");null!==(e=d.changed(c,b,f,a))&&this.c.push(e)};
eq.c.App.prototype.submit=function(a,b){if(-1===this.onceRule||void 0===this.onceRule&&a.classList.contains("eq-help"))this.api.postMessage({o:eq.ApiOp.onHelp,d:-1===this.onceRule&&void 0!==this.onceId?this.onceId:a.id});else{var c,d,e,f;this.mouseDownTimers.dispose();this.dialogTimers.dispose();"timer"!==b.type&&this.cancelUserAction();if(d=(c=this.currDlg).ddo){b=this.focus||"";var g;if(d.hide||d.show)d.hide&&(a=document.getElementById(d.hide))&&(a.style.display="none"),d.show&&(a=document.getElementById(d.show))&&
(a.style.display="");else for(a=c.root.length;0<=--a;)(g=c.root[a]).classList.contains("eq-dialog")?c.w.root.style.display="none":g.style.display="none";this.focus=this.currDlg=null;this.changed.clear();this.setIdle(c);this.api.postMessage({o:eq.ApiOp.onDo,i:c.id,f:b})}else{c.whenReady&&c.callWhenReady();if(a!==document.body&&void 0!==(f=c.eds.get(e=a.id)))f.onSubmit(c,e,a,b);this.setIdle(c);eq.Dom.onNextCycle(this.constructor.apiSubmit,b)}}};
eq.c.App.apiSubmit=function(a){var b=eq.app,c,d;null!==b.currDlg&&(a.changed=b.elementsChanged(a.ea),b.api.postMessage({o:eq.ApiOp.onEvent,d:a}),b.startTypeAhead(),b.currDlg=null,b.focus=null,a=b.dnd)&&((c=a.drag)&&(d=c.over)&&d.classList.remove("eq-dragover"),b.dnd=null)};
eq.c.App.onGlobalKeyDown=function(a){var b=a.key;switch(b){case "Alt":case "AltGraph":case "CapsLock":case "Control":case "Fn":case "FnLock":case "Hyper":case "Meta":case "NumLock":case "OS":case "Scroll":case "ScrollLock":case "Shift":case "Super":case "Symbol":case "SymbolLock":return}var c=eq.app,d=c.constructor,e=eq.Dom;if(c.dlgFocus)if(b===c.debounceKey)d.debounceKey(b),e.consumeEvent(a);else if(void 0!==c.popupBox)c.popupBox.onKey(a)&&e.consumeEvent(a);else if(c.addTypeAhead(a))e.consumeEvent(a);
else if(c.idle)e.consumeEvent(a),c.notifyBusy&&d.beep();else{var f=c.currDlg;if(f){var g=eq.KeyMod,h=a.shiftKey?g.shift:0;a.ctrlKey&&(h|=g.ctrl);a.altKey&&(h|=g.alt);a.metaKey&&(h|=g.meta);h===g.shift&&1===b.length&&(h=0);var l=c.menuOpen,k,n,m;if(l&&(k=document.getElementById(l))){if(m=(n=k.getElementsByClassName("eq-open")).length)k=n[m-1];if(void 0!==(m=f.eds.get(n=k.id))){if(m.onKey(f,l,k,b,h,a))return;k=n=m=void 0}}var p,q=a.target;void 0!==c.overlay?k=c.overlay.el:null===c.focus||q!==document.body&&
!e.eqControl(q)||(k=document.getElementById(c.focus));if(k){if((p=k.classList).contains("eq-disabled")){e.consumeEvent(a);return}if(void 0===(m=f.eds.get(n=k.id)))return}var r;switch(b){case "Enter":!(h||p&&p.contains("eq-enter"))&&f.fkey&&0<f.fkey.length&&f.fkey[0]&&(r=0);break;case "F1":r=1;d.onHelpInstalled&&(c.onHelpIgnore=!0);break;case "F2":r=2;break;case "F3":r=3;break;case "F4":r=4;break;case "F5":r=5;break;case "F6":r=6;break;case "F7":r=7;break;case "F8":r=8;break;case "F9":r=9;break;case "F10":r=
10;break;case "F11":r=11;break;case "F12":r=12}if(void 0!==r){if(f.isAccel(b,h,a)){e.consumeEvent(a);l===c.menuOpen&&e.closeMenu();return}if(!h&&f.fkey&&r<f.fkey.length&&(f=f.fkey[r])){e.consumeEvent(a);0<f?(c.onceRule=f,null!==c.focus&&(k=document.getElementById(c.focus))?(c.onceId=c.focus,c.submit(k,{id:c.onceId,type:"key"})):c.submit(document.body,{type:"key"})):-1===f&&c.api.postMessage({o:eq.ApiOp.onHelp,d:k?k.id:null});l===c.menuOpen&&e.closeMenu();return}c.onHelpIgnore=void 0}else if(k){if(m.onKey(f,
n,k,b,h,a)){l===c.menuOpen&&e.closeMenu();return}if(f.isAccel(b,h,a)){e.consumeEvent(a);l===c.menuOpen&&e.closeMenu();return}if(h<=g.shift)switch(b){case "Enter":if(p.contains("eq-enter")||p.contains("eq-noenter"))break;case "Tab":var t=h?-1:1;break;case "ArrowUp":case "Up":case "ArrowLeft":case "Left":h||(t=-1);break;case "ArrowDown":case "Down":case "ArrowRight":case "Right":h||(t=1)}t&&(e.consumeEvent(a),c.inSetFocus||((a=f.nextTab(n,-1===t))?(c.pendingTabMode=t,c.pendingTabModeId=k=a.id,c.setFocus(k,
a)):c.processEvent(f,{type:"blur",target:m.focusElement(f,k)},n,k,m)))}else f.isAccel(b,h,a)&&e.consumeEvent(a);l===c.menuOpen&&e.closeMenu()}}else void 0!==c.debounceKeyTimer&&(window.clearTimeout(c.debounceKeyTimer),c.debounceKeyTimer=void 0,c.debounceKey=void 0)};eq.c.App.onGlobalKeyUp=function(a){var b=eq.app;a.key===b.debounceKey&&(window.clearTimeout(b.debounceKeyTimer),b.debounceKeyTimer=void 0,b.debounceKey=void 0,eq.Dom.consumeEvent(a))};
eq.c.App.debounceKey=function(a){var b=eq.app;b.debounceKey=a;void 0!==b.debounceKeyTimer&&window.clearTimeout(b.debounceKeyTimer);b.debounceKeyTimer=window.setTimeout(this.onDebounceKeyTimer,this.timeout.debounceKey)};eq.c.App.onDebounceKeyTimer=function(){var a=eq.app;a.debounceKeyTimer=void 0;a.debounceKey=void 0};eq.c.App.onHelp=function(a){var b=eq.app;return b.onHelpIgnore?(b.onHelpIgnore=void 0,eq.Dom.consumeEvent(a),!1):!0};
eq.c.App.onGlobalMouseDownOrClick=function(a){var b=a.eq;if(void 0!==b){if(b.onGlobalMouseDownOrClick)return;b.onGlobalMouseDownOrClick=!0}else a.eq={onGlobalMouseDownOrClick:!0};b=eq.app;var c=b.currDlg,d=a.target,e=d,f="mousedown"===a.type,g,h,l,k;f&&(g=performance.now());b.toolTip&&b.toolTip.tt&&b.constructor.ttClose();if(!b.idle&&c)for(;e&&e!==document;){if((h=e.classList)&&!h.contains("eq-disabled")){if(h.contains("eq-idle")||h.contains("eq-control")&&(k=e.id))break;!l&&h.contains("eq-cmc")&&
(l=e)}e=e.parentNode}if(k){var n=a.buttons,m=e.dataset.mask||2;if(void 0===n)switch(a.button){case 0:n=1;break;case 1:n=4;break;case 2:n=2;break;default:n=0}if(n&2||n&m){for(;e&&e!==document;){if(h=e.classList)if((f=h.contains("eq-overlay")||h.contains("eq-tip"))||h.contains("eq-root")||h.contains("eq-window")){a.preventDefault();a.stopImmediatePropagation();f||b.apiMouseButton2(k,n,m,a.clientX,a.clientY,l);break}e=e.parentNode}return}}if(0!==a.button)b.cancelUserAction();else{f&&(k=eq.c.App.doubleClick,
k.md[1]=k.md[0],k.md[0]=Math.ceil(g),eq.Pointer.cancel());void 0!==b.capture&&(a.stopPropagation(),b.endCapture());g=eq.Dom;f&&void 0!==b.overlay&&(g.eqOverlay(d)?c&&(e=g.eqControl(d)||b.overlay.el)&&(h=c.eds.get(k=e.id),void 0!==h&&(b.processEvent(c,a,k,e,h),g.consumeEvent(a))):g.eqControl(d)!==b.overlay.el&&(b.closeOverlay(),g.consumeEvent(a)));if(b.menuOpen){for(e=d;e&&e!==document;){if(h=e.classList)if(h.contains("eq-dialog")||h.contains("eq-menubar")){var p=!0;break}e=e.parentNode}if(!p)g.onNextCycle(g.closeMenu)}if(b.idle&&
void 0!==b.popupBox){if(b.popupBox.isEvent(a)){if(b.popupBox.close(a)){b.popupBox=void 0;g.consumeEvent(a);return}}else if(!d.classList.contains("eq-idle"))return;f&&a.preventDefault()}else(b=eq.c.Window.fromTarget(d))&&b.onMouseDownOrClick(a)&&f&&g.consumeEvent(a)}};eq.c.App.onGlobalMouseDoubleClick=function(a){a=eq.c.App.doubleClick;var b=a.md[0]-a.mu[0];b>a.tv&&(a.tv=b)};
eq.c.App.onGlobalMouseUp=function(a){var b=eq.app;if(0===a.button){var c=performance.now(),d=eq.c.App.doubleClick;d.mu[0]=d.mu[1];d.mu[1]=Math.ceil(c)}b.mouseDownTimers.cancelAll();if(void 0!==b.capture&&(a.stopPropagation(),!b.endCapture(a))){b.pendingMouseDown=void 0;b.pendingClick=void 0;b.stopPendingClickTimer();return}if(b.idle)b.pendingMouseDown=void 0,b.pendingClick=void 0,b.stopPendingClickTimer();else{var e=eq.Dom;if(void 0!==(c=b.pendingMouseDown)){var f=c.t;if(f===a.target){var g=c.id;
d=b.currDlg;var h=e.eqControl(f);if(!d)throw Error("BUG: onGlobalMouseUp no current Dialog");b.processEvent(d,{type:"click",target:f},g,h,d.eds.get(g));h.classList.contains("eq-focus")&&b.setFocus(g,h)}else if(b.menuOpen&&e.isMenu(f=a.target)){d=b.currDlg;h=e.eqControl(f);g=h.id;if(!d)throw Error("BUG: onGlobalMouseUp no current Dialog");b.processEvent(d,{type:"click",target:f,menuMouseUp:!0},g,h,d.eds.get(g))}b.pendingMouseDown=void 0;if(b.menuOpen&&e.isMenu(f=a.target)&&(h=e.eqControl(f))&&h.classList.contains("eq-item"))e.onNextCycle(e.closeMenu)}if(void 0!==
(c=b.pendingClick)){b.stopPendingClickTimer();d=b.currDlg;h=e.eqControl(a.target);var l;if(!d)throw Error("BUG: onGlobalMouseUp pendingClick no current Dialog");if(h&&(g=h.id)===c.id){void 0!==a.eq?c.ea=a.eq:(e=c.ea=c.ea||{},f=0,e.cnt=c.cnt?c.cnt+1:1,a.shiftKey&&(f+=1),a.ctrlKey&&(f+=2),a.metaKey&&(f+=4),a.altKey&&(f+=8),f&&(e.mod=f));if(void 0!==(l=d.eds.get(g))&&void 0!==l.m&&0===c.cnt){c.cnt=1;a=b.constructor;b.commitPendingClickTimer=window.setTimeout(a.commitPendingClick,a.doubleClick.tv);return}b.submit(h,
c)}else void 0!==(c=c.ev)&&(h=document.getElementById(c.id))&&b.submit(h,c);b.pendingClick=void 0}}};eq.c.App.commitPendingClick=function(){var a=eq.app,b;a.commitPendingClickTimer=void 0;if(void 0!==(b=a.pendingClick)){var c=b.id,d,e,f;(d=a.currDlg)&&void 0!==(e=d.eds.get(c))&&void 0!==e.m&&(b.cnt>=e.m?(f=document.getElementById(c))&&a.submit(f,b):void 0!==(b=b.ev)&&(f=document.getElementById(b.id))&&a.submit(f,b));a.pendingClick=void 0}};
eq.c.App.prototype.stopPendingClickTimer=function(){void 0!==this.commitPendingClickTimer&&(window.clearTimeout(this.commitPendingClickTimer),this.commitPendingClickTimer=void 0)};eq.c.App.prototype.apiMouseButton2=function(a,b,c,d,e,f){var g=this.currDlg;if(!g)throw Error("BUG: apiMouseButton2 no current Dialog");this.api.postMessage({o:eq.ApiOp.onMouseButton2,d:g.id,i:a,b:b,m:c,x:d,y:e,c:f?eq.Dom.parentIndex(f)+1:0})};
eq.c.App.prototype.onMouseButton2=function(a,b,c,d,e){var f,g;!this.idle&&(f=this.currDlg)&&a===f.id&&(this.cancelUserAction(),a=eq.UpdateTag,(g=this.updateElementsChanged()).length&&this.apiUpdate(null,a.changed,{c:g}),this.apiUpdate(b,a.mouseButton2,{x:c,y:d,c:e}))};
eq.c.App.prototype.onClipboardMenu=function(a,b,c,d,e,f){var g,h,l;if(!this.idle&&(g=this.currDlg)&&a===g.id){if(!(h=document.getElementById(b)))throw Error("App.onClipboardMenu '"+b+"' does not exist");if(void 0===(l=g.eds.get(b)))throw Error("App.onClipboardMenu '"+b+"' not registered");window.isSecureContext&&b===this.focus?f||(f=eq.strings.get("clipboardMenu")):f=null;if(!f||/^(?:0|false|no|off)$/i.test(f)||!l.onClipboardMenu(g,b,h,c,d,f))this.onMouseButton2(a,b,c,d,e)}};
eq.c.App.prototype.moveCapture=function(a,b,c){var d=this.constructor;void 0!==this.capture&&this.endCapture();d.ttClose();this.capture={arg:a,cb:b,done:c};window.addEventListener("mousemove",d.onCapture)};eq.c.App.prototype.endCapture=function(a){var b=this.capture;window.removeEventListener("mousemove",this.constructor.onCapture);this.capture=void 0;return b.done?b.done(b.arg,a):!0};
eq.c.App.onCapture=function(a){a.stopPropagation();var b=eq.app,c=b.constructor;(b=b.capture)?b.cb&&b.cb(a,b.arg):window.removeEventListener("mousemove",c.onCapture)};eq.c.App.onGlobalContextMenu=function(a){for(var b=a.target,c;b&&b!==document;){if(c=b.classList)if(c.contains("eq-idle")||c.contains("eq-overlay")||c.contains("eq-tip")||c.contains("eq-root")||c.contains("eq-window"))return a.preventDefault(),a.stopImmediatePropagation(),!1;b=b.parentNode}return!0};
eq.c.App.onGlobalPageHide=function(a){a=eq.app;void 0!==a.stopped&&(window.clearTimeout(a.stopped),a.stopped=void 0);a.updateSessionList(!0)};eq.c.App.onGlobalDragEnd=function(a){var b,c,d;(b=eq.app.dnd)&&(c=b.drag)&&(d=c.over)&&(c.over=null,d.classList.remove("eq-dragover"))};
eq.c.App.onStorageModified=function(a){if(a.storageArea===window.localStorage)switch(a.key){case "eq-webdlg.sls":var b=eq.app;if(a.newValue)try{var c=JSON.parse(a.newValue),d=b.sls;if(!d||c.ts>=d.ts)b.sls=c}catch(e){console.log("Failed to parse session list, "+e.message),b.sls=void 0,window.localStorage.removeItem("eq-webdlg.sls")}else b.sls=void 0;b.updateSessionList();break;case "eq-webdlg.act":a.newValue&&(b=window.sessionStorage.getItem("eq-webdlg.sid"))&&a.newValue===b&&(window.focus(),window.localStorage.removeItem("eq-webdlg.act"))}};
eq.c.App.activateSession=function(a){var b,c;a&&(b=window.sessionStorage.getItem("eq-webdlg.sid"))&&a!==b&&(c=window.open("","eq-webdlg."+a))&&(c.focus(),window.localStorage.setItem("eq-webdlg.act",a))};eq.c.App.prototype.sessionTitles=function(){var a=[],b=this.sls,c=window.sessionStorage,d,e,f;if(void 0!==b&&(d=c.getItem("eq-webdlg.uat"))&&b.ua==d&&(e=c.getItem("eq-webdlg.opn")))for(c=0,d=(b=b.sn).length;c<d;c++)e===(f=b[c]).o&&f.t&&a.push(f.t);return a};
eq.c.App.prototype.sessionByIndex=function(a){var b=this.sls,c=window.sessionStorage,d,e,f;if(void 0!==b&&(d=c.getItem("eq-webdlg.uat"))&&b.ua==d&&(e=c.getItem("eq-webdlg.opn")))for(c=0,d=(b=b.sn).length;c<d;c++)if(e===(f=b[c]).o&&f.t&&0===a--)return f.s;return null};
eq.c.App.prototype.sessionByTitle=function(a){var b=this.sls,c=window.sessionStorage,d,e,f,g;if(void 0!==b&&(d=c.getItem("eq-webdlg.uat"))&&b.ua==d&&(e=c.getItem("eq-webdlg.sid"))&&(f=c.getItem("eq-webdlg.opn")))for(c=0,d=(b=b.sn).length;c<d;c++)if(f===(g=b[c]).o&&e!==g.s&&a===g.t)return g.s;return null};
eq.c.App.prototype.initSessionList=function(){var a=window.sessionStorage,b,c;if(b=a.getItem("eq-webdlg.opn")){if(void 0===(c=this.sls))try{if(c=JSON.parse(window.localStorage.getItem("eq-webdlg.sls")))this.sls=c}catch(f){}if(c){for(var d=0,e=(c=c.sn).length;d<e;d++)if(c[d].o===b)return;a.removeItem("eq-webdlg.opn")}}};
eq.c.App.prototype.updateSessionList=function(a){var b=window.sessionStorage,c,d,e,f,g;if(!a&&(c=b.getItem("eq-webdlg.uat"))&&(d=b.getItem("eq-webdlg.sid"))&&(e=b.getItem("eq-webdlg.opn"))){if(void 0===(f=this.sls))try{if(f=JSON.parse(window.localStorage.getItem("eq-webdlg.sls")))this.sls=f}catch(n){}f&&f.ua===c||(this.sls=f={ua:c,sn:[]});var h,l=(g=f.sn).length;a=document.title;for(h=0;h<l;h++)if(d===(b=g[h]).s){if(b.o!==e||b.t!==a){b.o=e;b.t=a;var k=!0}break}h===l&&(g.push({s:d,o:e,t:a}),k=!0);
k&&(f.ts=Date.now(),window.localStorage.setItem("eq-webdlg.sls",JSON.stringify(f)))}else if(this.sls=void 0,(c=b.getItem("eq-webdlg.uat"))&&(d=b.getItem("eq-webdlg.sid")))try{if(f=JSON.parse(window.localStorage.getItem("eq-webdlg.sls")),f.ua===c)for(h=0,l=(g=f.sn).length;h<l;h++)if(d===g[h].s){g.splice(h,1);f.ts=Date.now();window.localStorage.setItem("eq-webdlg.sls",JSON.stringify(f));break}}catch(n){}};eq.c.App.rootEventTypes=["change","focusin","input","mousedown"];
eq.c.App.addRootListeners=function(a){for(var b=this.onEvent,c=this.rootEventTypes,d=0,e=c.length;d<e;d++)a.addEventListener(c[d],b,!0)};eq.c.App.removeRootListeners=function(a){for(var b=this.onEvent,c=this.rootEventTypes,d=0,e=c.length;d<e;d++)a.removeEventListener(c[d],b,!0)};
eq.c.App.prototype.setFocus=function(a,b){if(a!==this.focus){var c=this.constructor,d=this.currDlg;if(!d)throw Error("BUG: setFocus no current Dialog");var e=document.body.getElementsByClassName("eq-focused");var f=0;for(var g=e.length;f<g;f++)e[f].classList.remove("eq-focused");if(null!==(e=this.focus)){if(void 0===(f=d.eds.get(e)))throw Error("setFocus: from '"+e+"' not registered");g=document.getElementById(e);if(!g)throw Error("setFocus: from '"+e+"' does not exist");this.pendingTabModeId===e&&
(this.pendingTabModeId=this.pendingTabMode=void 0);f.focusLost(d,g);if(this.processEvent(d,{type:"blur",target:f.focusElement(d,g)},e,g,f))return this.focus=a,!0}if(void 0===(f=d.eds.get(a)))throw Error("setFocus: to '"+a+"' not registered");if(void 0===b&&!(b=document.getElementById(a)))throw Error("setFocus: to '"+a+"' does not exist");this.focus=a;b.classList.add("eq-focused");this.pendingTabModeId!==a&&(this.pendingTabModeId=this.pendingTabMode=void 0);f.focusGained(d,a=f.focusElement(d,b));this.pendingTabModeId=
this.pendingTabMode=void 0;this.inSetFocus=!0;eq.Dom.onNextCycle(c.setElementFocus,{d:d,e:b,f:a})}return!1};eq.c.App.setElementFocus=function(a){a.f.focus();var b=eq.Dom;b.scrollIntoView(a.d,a.e);b.onNextCycle(eq.c.App.verifyElementFocus)};
eq.c.App.verifyElementFocus=function(){var a=eq.app,b=a.focus,c=a.typeAhead,d;!b||(d=eq.Dom.eqControl(document.activeElement))&&d.id===b||(d=document.activeElement)&&d!==document.body&&d.blur();a.inSetFocus=void 0;if(void 0!==c&&c.active){var e=a.constructor,f=a.currDlg,g,h;if(null!==f&&!f.ddo&&f===c.dlg&&b===c.focus){d=document.getElementById(b);for(var l=0,k=c.buf,n=k.length;l<n&&(g=f.eds.get(b))&&!(("Enter"===(h=k[l++])||"ShiftEnter"===h)&&f.fkey&&0<f.fkey.length&&f.fkey[0])&&g.onTypeAhead(f,b,
d,h);)if(a.focus!==b){if(null!==(c.focus=a.focus)){k.splice(0,l);return}break}}e.cancelTypeAhead()}};eq.c.App.resetFocus=function(a){a=document.body.getElementsByClassName("eq-focused");for(var b=0,c=a.length;b<c;b++)a[b].classList.remove("eq-focused");document.documentElement.focus()};
eq.c.App.prototype.setIdle=function(a){var b=this.constructor,c=eq.Dom;if(void 0===a)c.onNextCycle(b.setActive);else{this.idle=!0;c.cancelNextCycle(b.setActive);for(var d,e=0,f=a.root.length;e<f;e++){var g=a.root[e];g.querySelector(".eq-root>.eq-idle")||(d=document.createElement("DIV"),d.className="eq-idle",d.style.zIndex=c.zIndex(g)+2,g.appendChild(d))}d&&(void 0!==this.idleTimer&&window.clearTimeout(this.idleTimer),this.idleTimer=window.setTimeout(b.showIdle,b.timeout.showIdle));b.warnWhenLeavingPage(!0)}};
eq.c.App.setActive=function(){var a=eq.app,b=a.currDlg,c;if(null!==b){a.idle=!1;a=0;for(var d=b.root.length;a<d;a++)(c=b.root[a].querySelector(".eq-root>.eq-idle"))&&c.parentNode.removeChild(c);void 0!==this.idleTimer&&(window.clearTimeout(this.idleTimer),this.idleTimer=void 0)}};eq.c.App.showIdle=function(){eq.app.idleTimer=void 0;for(var a=document.body.getElementsByClassName("eq-idle"),b=0,c=a.length;b<c;b++)a[b].classList.add("eq-fog")};
eq.c.App.prototype.makeOverlay=function(a,b,c){if(void 0!==this.overlay)throw Error("makeOverlay BUG: pending overlay id:"+this.overlay.el.id);if(document.body.querySelector("body>.eq-overlay"))throw Error("makeOverlay BUG: orphaned overlay");this.overlay={el:a,overlay:b,onClose:c};a=document.body;c=this.constructor;b.classList.add("eq-overlay");b.style.zIndex=eq.Dom.zIndexMax(a)+1;a.appendChild(b);b.onmousedown=this.constructor.onGlobalMouseDownOrClick;c.ttClose()};
eq.c.App.prototype.closeOverlay=function(a,b){var c=this.overlay;if(void 0===c){if(document.body.querySelector("body>.eq-overlay"))throw Error("closeOverlay BUG: orphaned overlay");}else{var d=c.overlay;if(void 0!==a&&a!==c.el)throw Error("closeOverlay BUG: wrong id:"+a.id+", expected:"+c.el.id);if(!d.classList.contains("eq-overlay"))throw Error("closeOverlay BUG: no overlay id:"+c.el.id);d.onmousedown=null;this.overlay=void 0;c.onClose(c.el,d,b);d.style.zIndex="";d.classList.remove("eq-overlay")}};
eq.c.App.prototype.cleanupStyles=function(){var a=this.stl,b=a.sheet,c=b.cssRules,d;if(d=c.length){if(d!==a.owner.length)throw Error("cleanupStyles BUG: "+d+" stale rules, inconsistent owner.length:"+a.owner.length);console.warn("cleanupStyles: "+d+" stale rules");do b.deleteRule(d-1);while(d=c.length);a.owner.length=0}else if(a.owner.length)throw Error("cleanupStyles BUG: inconsistent owner.length:"+a.owner.length);};
eq.c.App.prototype.removeStyles=function(a){var b=this.stl,c=b.sheet;b=b.owner;var d=b.length,e=0,f,g;if(-1!==(f=g=b.indexOf(a))){do c.deleteRule(g),e++;while(++f<d&&b[f]===a);b.splice(g,e)}};eq.c.App.prototype.newDialog=function(a){var b=eq.LayoutMode,c=this.layoutMode;void 0!==c&&c&b.inline&&!(c&b.dialog)&&(this.dlg.forEach(eq.c.App.cbInvalidateCloseDlg,this),this.dlg.clear());b=new eq.c.Dlg(a);this.dlg.set(a,b);return b};
eq.c.App.cbInvalidateCloseDlg=function(a){this.api.postMessage({o:eq.ApiOp.invalidate,d:a.id});a.close()};eq.c.App.prototype.newTempDialog=function(a){var b=document.getElementById("eq-temp");if(b)throw Error("newTempDialog BUG: 'eq-temp' already exists");b=document.createElement("DIV");b.id="eq-temp";b.className="eq-dialog eq-hidden eq-container";document.body.appendChild(b);b=new eq.c.Dlg(a);this.dlg.set(a,b);b.temp=!0;return b};eq.c.App.prototype.closeDialog=function(a){this.dlg.delete(a.id);a.close()};
eq.c.App.prototype.topDialog=function(){var a,b,c;if(void 0!==(a=this.wl))for(b=a.length;0<=--b;)if(void 0!==(c=a[b].dlg))return c;return null};eq.c.App.prototype.setCurrDialog=function(a){var b=this.constructor,c=this.currDlg;null!==c&&c!==a&&c.ddo&&(this.focus=this.currDlg=null,this.changed.clear(),this.setIdle(c),c.ddo=void 0);null!==a.w&&a.w.activate()&&b.ttClose();a.visible();this.currDlg=a;(a=a.title||b.title)!==document.title&&(document.title=a,this.updateSessionList())};
eq.c.App.prototype.dialogsVisible=function(){this.dlg.forEach(this.constructor.cbDialogsVisible)};eq.c.App.cbDialogsVisible=function(a){a.visible()};eq.c.App.prototype.startTypeAhead=function(){var a=this.typeAhead,b,c;if(void 0!==a&&!a.active&&null!==(b=this.focus)){if(null===(c=this.currDlg))throw Error("App.startTypeAhead BUG: no current Dialog");a.active=!0;a.dlg=c;a.focus=b}};
eq.c.App.prototype.addTypeAhead=function(a){var b=this.constructor,c=this.typeAhead,d;if(void 0!==c&&c.active){switch(d=a.key){case "Tab":case "Enter":a.shiftKey&&(d="Shift"+d);break;case " ":case "Spacebar":d=" ";break;case "Shift":case "CapsLock":return!1;default:if(1!==d.length||a.ctrlKey||a.altKey||a.metaKey)return b.cancelTypeAhead(),!1}c.buf.push(d);0!==c.timer&&window.clearTimeout(c.timer);c.timer=window.setTimeout(b.cancelTypeAhead,b.timeout.typeAhead);return!0}return!1};
eq.c.App.cancelTypeAhead=function(){var a=eq.app.typeAhead;void 0!==a&&(a.active=!1,a.dlg=null,a.focus=null,a.buf.length=0,0!==a.timer&&(window.clearTimeout(a.timer),a.timer=0))};
eq.c.App.prototype.ttAttach=function(a){if(!a.onmouseenter){var b=this.constructor;if(a.onmouseleave)throw Error("BUG: App.ttAttach id:"+eq.Dom.eqControl(a).id+" event handler in use");a.onmouseenter=b.ttOnMouseEnter;a.onmouseleave=b.ttOnMouseLeave;void 0===this.toolTip&&(this.toolTip={dlg:null,el:null,ed:null,dd:!1,tt:null,ti:0,x:0,y:0,upd:!1})}else if(!a.onmouseleave)throw Error("BUG: App.ttAttach id:"+eq.Dom.eqControl(a).id+" event handler not set");};
eq.c.App.prototype.ttDetach=function(a){if(a.onmouseenter){var b=this.toolTip;if(!a.onmouseleave)throw Error("BUG: App.ttDetach id:"+eq.Dom.eqControl(a).id+" event handler not set");a.onmouseenter=null;a.onmouseleave=null;a.onmousemove=null;b&&b.el===a&&this.constructor.ttClose()}else if(a.onmouseleave)throw Error("BUG: App.ttDetach id:"+eq.Dom.eqControl(a).id+" event handler in use");};
eq.c.App.ttShow=function(){var a=eq.app,b,c,d,e,f,g,h;if(c=a.toolTip){var l=a.constructor;if((g=c.dlg)&&(d=c.ed)&&(b=d.onToolTip(c.el))){var k=eq.Dom;(e=c.tt)?(d=e.style,c.dd?e.classList.add("eq-disabled"):e.classList.remove("eq-disabled")):(c.tt=e=document.createElement("DIV"),e.className="eq-tip",c.dd&&e.classList.add("eq-disabled"),(d=e.style).zIndex=k.zIndexMax(f=document.body)+1,g.copyFontToElement(e)||(h=a.fnDefault)&&k.setFont(e,h)&&k.adjustElementFontSize(e),f.appendChild(e));e.onmouseenter=
l.ttOnMouseEnter;e.onmouseleave=l.ttOnMouseLeave;e.onmousemove=l.ttOnMouseMove;k.setContent(e,b);a=k.viewRect();b=e.getBoundingClientRect();d.maxWidth="";d.maxHeight="";(e=c.x+12)+b.width>=a.x+a.w&&(e=a.x+a.w-b.width-1)<a.x&&(e=a.x+1,d.maxWidth=a.w-2+"px");(g=c.y+12)+b.height>=a.y+a.h&&(g=a.y+a.h-b.height-1)<a.y&&(g=a.y+1,d.maxHeight=a.h-2+"px");d.left=e+"px";d.top=g+"px";c.ti=window.setTimeout(l.ttHide,l.toolTipTimeout.hide);c.upd=!1}else l.ttHide()}};
eq.c.App.ttHide=function(){var a,b;if(a=eq.app.toolTip){if(b=a.el)b.onmousemove=null;if(b=a.tt)b.parentNode.removeChild(b),a.tt=null;if(b=a.ti)window.clearTimeout(b),a.ti=0,a.upd=!1}};eq.c.App.ttClose=function(){var a,b;if(a=eq.app.toolTip){a.dlg=null;a.ed=null;if(b=a.el)b.classList.remove("eq-tt"),b.onmousemove=null,a.el=null;if(b=a.tt)b.parentNode.removeChild(b),a.tt=null;if(b=a.ti)window.clearTimeout(b),a.ti=0,a.upd=!1}};
eq.c.App.prototype.ttDispose=function(){this.constructor.ttClose();this.toolTip=void 0};
eq.c.App.prototype.ttMouseEnter=function(a,b,c,d){var e,f;if(a.classList.contains("eq-tip")){if(!(e=this.toolTip))throw Error("BUG: App.ttOnMouseEnter no current tooltip");if(a!==e.tt)throw Error("BUG: App.ttOnMouseEnter tooltip element mismatch");if(f=e.ti)window.clearTimeout(f),e.ti=0,e.upd=!1;e.x=b;e.y=c}else if(e=this.toolTip){var g=this.constructor;e.x=b;e.y=c;if(b=this.currDlg){if(f=e.ti)window.clearTimeout(f),e.ti=0,e.upd=!1;if(a!==e.el){if(!(f=eq.Dom.eqControl(a))){g.ttClose();return}e.dlg=
b;e.el=a;if(void 0===(e.ed=b.eds.get(b=f.id)))throw Error("BUG: App.ttOnMouseEnter id:"+b+" not registered");e.dd=f.classList.contains("eq-disabled");a.classList.add("eq-tt")}a.onmousemove=g.ttOnMouseMove;0===d&&(a=e.upd=!!e.tt,e.ti=window.setTimeout(g.ttShow,a?g.toolTipTimeout.update:g.toolTipTimeout.show))}}};eq.c.App.ttOnMouseEnter=function(a){var b=eq.app;void 0===b.capture&&(a.stopImmediatePropagation(),b.ttMouseEnter(a.target,a.pageX,a.pageY,void 0!==a.buttons?a.buttons:a.button))};
eq.c.App.ttOnMouseLeave=function(a){var b=eq.app,c=a.target,d,e,f;c.classList.remove("eq-tt");if(void 0===b.capture){a.stopImmediatePropagation();if(d=b.toolTip){d.x=a.pageX;d.y=a.pageY;if(e=d.ti)window.clearTimeout(e),d.ti=0,d.upd=!1;if(d.tt){e=b.constructor;var g=d.upd=!b.idle;d.ti=window.setTimeout(e.ttClose,g?e.toolTipTimeout.update:e.toolTipTimeout.hide)}}for(;(c=c.parentNode)&&c!==document;)if((f=c.classList)&&f.contains("eq-tt")){b.ttMouseEnter(c,d.x,d.y,void 0!==a.buttons?a.buttons:a.button);
break}}};eq.c.App.ttOnMouseMove=function(a){var b=eq.app,c,d;if(void 0===b.capture&&(a.stopImmediatePropagation(),c=b.toolTip))if(c.x=a.pageX,c.y=a.pageY,c.tt){if(!c.upd){if(d=c.ti)window.clearTimeout(d),c.ti=0,c.upd=!1;b.idle||(a=b.constructor,c.ti=window.setTimeout(a.ttHide,a.toolTipTimeout.hide))}}else{if(d=c.ti)window.clearTimeout(d),c.ti=0,c.upd=!1;0===(void 0!==a.buttons?a.buttons:a.button)&&(a=b.constructor,c.ti=window.setTimeout(a.ttShow,a.toolTipTimeout.show))}};
eq.c.App.prototype.scrnUpdate=function(a){var b=window.screen,c=Math.ceil(b.availWidth),d=Math.ceil(b.availHeight),e;b.orientation?0===b.orientation.type.lastIndexOf("portrait",0)?c>d&&(b=c,c=d,d=b):c<d&&(b=c,c=d,d=b):(b=window.orientation,b&&b%180)?c<d&&(b=c,c=d,d=b):c>d&&(b=c,c=d,d=b);if(b=this.scrn){if(c===b.w&&d===b.h)return b;b.w=c;b.h=d;b.updated=!0}else b=this.scrn={w:c,h:d,updated:!0};if(a&&!this.idle&&(e=this.currDlg)&&e.vcrule)eq.Dom.onNextCycle(this.constructor.submitViewChanged);return b};
eq.c.App.onResize=function(a){eq.c.App.onCancelUserAction(a);a=eq.app;a.scrn&&a.scrnUpdate(!0)};
eq.c.App.inject=function(a){var b=a.length;if(!b)return console.error("App.inject() failed, empty URL."),!1;for(var c=this.inject,d=document.head,e=d.getElementsByClassName("eq-inject"),f=0,g=e.length;f<g;f++){var h=e[f];if("SCRIPT"===h.tagName)var l=h.src;else"LINK"===h.tagName&&(l=h.href);if(!((h=l.length)<b)&&(h>b&&(l=l.substring(h-b)),l.toLowerCase()===a.toLowerCase()))return!1}if(/\.js$/i.test(a))return b=document.createElement("SCRIPT"),b.src=a,b.className="eq-inject",c.pending++,b.onload=c.ready,
b.onerror=c.failed,d.appendChild(b),!0;if(/\.css$/i.test(a))return b=document.createElement("LINK"),b.href=a,b.className="eq-inject",b.rel="stylesheet",b.type="text/css",c.pending++,b.onload=c.ready,b.onerror=c.failed,d.appendChild(b),!0;console.error("App.inject("+a+") failed, unknown type.");return!1};eq.c.App.inject.pending=0;
eq.c.App.inject.ready=function(a){a=a.target;var b=--eq.c.App.inject.pending,c,d;a.onload=a.onerror=null;if(0===b)a=eq.app.api,b=eq.ApiOp,void 0!==(c=eq.plugin)&&(d=c.install()).length&&a.postMessage({o:b.installPlugins,p:d}),a.postMessage({o:b.injectDone});else if(0>b)throw Error("BUG App.inject.ready pending:"+b);};eq.c.App.inject.failed=function(a){var b=a.target;b.parentNode.removeChild(b);eq.c.App.inject.ready(a)};
eq.c.App.dlgListener=function(){var a=eq.app.currApp,b;return a&&(b=/^.+?:([0-9]+)$/.exec(a))?b[1]:null};eq.c.App.dlgListener.message=function(){var a=this();a?(eq.app.dlgListen=!0,new eq.c.MessageDialog(eq.strings.get("message.dlgListen")+" <b>"+a+"</b>",0,this.canceled)):eq.app.dlgListen=!0};eq.c.App.dlgListener.close=function(){var a=eq.app;a.dlgListen&&(a.dlgListen=!1,eq.c.MessageDialog.close())};eq.c.App.dlgListener.canceled=function(){var a=eq.app;a.dlgListen&&a.api.postMessage({o:eq.ApiOp.closeWebSocket})};
eq.c.App.beep=function(){try{var a=document.getElementById("eq-beep");a||(a=document.createElement("AUDIO"),a.id="eq-beep",a.src="eq-webdlg-beep.mp3",document.body.appendChild(a));a.play()}catch(b){console.error("beep "+b.name+": "+b.message)}};eq.c.App.playSound=function(a){try{var b=document.getElementById("eq-sound");b||(b=document.createElement("AUDIO"),b.id="eq-sound",document.body.appendChild(b));b.src=a;b.play()}catch(c){console.error("playSound '"+a+"' "+c.name+": "+c.message)}};
eq.c.App.warnWhenLeavingPage=function(a){a&&eq.app.warnLeavingPage?window.addEventListener("beforeunload",this.onBeforeUnload,!0):window.removeEventListener("beforeunload",this.onBeforeUnload,!0)};eq.c.App.onBeforeUnload=function(a){a.preventDefault();return a.returnValue="Do you want to leave this page? This will terminate the running program."};
eq.c.App.onWindowMessage=function(a){var b=eq.app,c,d,e,f,g,h;if(!b.idle&&(c=b.currDlg)&&Array.isArray(d=a.data)&&2===d.length&&(e=d[0])&&(f=d[1])&&(g=document.getElementById(e))&&void 0!==(h=c.eds.get(e)))h.onMessage(c,e,g,f)};window.onerror=function(a,b,c,d,e){if(b){e=eq.app;try{e.api.postMessage({o:eq.ApiOp.logError,msg:b.split("/").pop()+":"+c+":"+d+" "+a})}catch(f){}}return!1};
eq.redirected||function(){var a=eq.c.App;eq.app=new a;try{var b=/(\?[^#]+)/.exec(window.location.href)[1];if(b){for(var c=/[?&]([^=]+)=([^&]*)/g,d,e;d=c.exec(b);)void 0===e&&(e={}),e[d[1]]=d[2];a.args=e}}catch(f){}window.addEventListener("blur",a.onCancelUserAction,!0);window.addEventListener("click",a.onGlobalMouseDownOrClick,!0);window.addEventListener("contextmenu",a.onGlobalContextMenu,!0);window.addEventListener("dblclick",a.onGlobalMouseDoubleClick,!0);window.addEventListener("dragend",a.onGlobalDragEnd,
!0);window.addEventListener("focus",a.onCancelUserAction,!0);window.addEventListener("keydown",a.onGlobalKeyDown,!0);window.addEventListener("keyup",a.onGlobalKeyUp,!0);window.addEventListener("message",a.onWindowMessage,!0);window.addEventListener("mousedown",a.onGlobalMouseDownOrClick,!0);window.addEventListener("mouseup",a.onGlobalMouseUp,!0);window.addEventListener("pagehide",a.onGlobalPageHide,!0);window.addEventListener("storage",a.onStorageModified);window.addEventListener("resize",a.onResize,
!0);window.screen.orientation?window.screen.orientation.addEventListener("change",a.onResize,!0):window.addEventListener("orientationchange",a.onResize,!0);eq.Pointer.install();a.apiStart();"loading"===document.readyState?window.addEventListener("DOMContentLoaded",a.domReady):a.domReady()}();eq.start=function(a,b){if(document.documentElement.classList.contains("eq-webdlg"))return!1;var c=eq.c.App,d;if(c.documentComplete)return!1;(d=eq.app).currApp=a;d.args=b;c.start();return!0};
//# sourceMappingURL=eq-webdlg-ui.src.map
