// Xojo.js
//
// Client-side portion of the Xojo Web framework
//
// ©2023 Xojo Inc -- All Rights Reserved
"use strict";var XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb,XojoWeb;!function(a,r){a.fn.contextMenu=function(l){return this.each(function(){a(this).off("contextmenu"),a(this).on("contextmenu",function(e){if(e.target.classList.contains("dropdown-menu"))return!1;if(0"+t+"
";let c=document.createElement("div");c.setAttribute("class","modal-footer");let m=!1;if(""!==i){let e=document.createElement("button");e.type="button",e.setAttribute("class","btn btn-default"),e.setAttribute("data-bs-dismiss","modal"),e.innerHTML=i,c.appendChild(e),m=!0}if(""!==o){let e=document.createElement("button");e.type="button",e.setAttribute("class","btn btn-primary"),e.setAttribute("data-bs-dismiss","modal"),e.innerHTML=o,c.appendChild(e),m=!0}m||(c.style.display="none");return l.appendChild(a),l.appendChild(d),l.appendChild(c),r.appendChild(l),s.appendChild(r),s}(i,n,s,r,l),e.appendChild(t),t.id=o,t.style.display="block";const c=new bootstrap.Modal(t,{keyboard:!1,backdrop:"static"});t.addEventListener("hidden.bs.modal",function(){c.dispose(),t.remove(),m.delete(o)}),c.show(),m.set(o,c)}}}h.isDebugMode=function isDebugMode(){return h.debugBuild},h.sessionURL=function sessionURL(){return h.appURL+"/"+h.session.identifier()},h.invalidateControls=function invalidateControls(e){let t=h.controls.lookup(e);t&&t instanceof h.XojoPage&&t.refresh()},h.getNamedControl=function getNamedControl(e){return h.controls.lookup(e)},h.ShowDisconnectModal=function ShowDisconnectModal(){HideModal("reconnect");var e=h.session.sessionDisconnectData();showDialog("disconnect",e[0],e[1],"","",!1,"XojoDisconnect",!0)},h.ShowReconnectModal=function ShowReconnectModal(){HideModal("disconnect");var e=h.session.sessionInterruptionData();showDialog("reconnect",e[0],e[1],"","",!1,"XojoDisconnect",!0)},h.HideModal=HideModal,h.showDialog=showDialog,(h.XojoConsole||(h.XojoConsole={})).log=function log(e,t=!1){(h.debugBuild||t)&&console.log(e)},(h.view||(h.view={})).resized=function resized(e=0){var i;if(document.getElementById("XojoPages")){if(Modernizr.customevent){let e=document.getElementById("XojoSession");e&&(i=new CustomEvent("xojo_resized",{cancelable:!1,detail:{width:e.offsetWidth,height:e.offsetHeight}}),e.dispatchEvent(i))}let t=h.controls.findByType("XojoPage"),o;for(o=0;o>16&255,r[l++]=t>>8&255,r[l++]=255&t;2===n&&(t=h[e.charCodeAt(o)]<<2|h[e.charCodeAt(o+1)]>>4,r[l++]=255&t);1===n&&(t=h[e.charCodeAt(o)]<<10|h[e.charCodeAt(o+1)]<<4|h[e.charCodeAt(o+2)]>>2,r[l++]=t>>8&255,r[l++]=255&t);return r},o.fromByteArray=function p(e){for(var t,o=e.length,i=o%3,n=[],s=0,r=o-i;s>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}(i));return n.join("")}(e,s,r>2]+a[t<<4&63]+"==")):2==i&&(t=(e[o-2]<<8)+e[o-1],n.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return n.join("")};for(var a=[],h=[],d="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,m=n.length;rmUserActivityTimeout&&(setSessionTimeout(0),comm.triggerServerEvent("Event","UserTimedOut",null))}function monitorHashTag(e){lastHashTag=e,Modernizr.hashchange&&window.addEventListener("hashchange",function(){if(window.location.hash!=lastHashTag){lastHashTag=window.location.hash;let e=new XojoWeb.JSONItem;e.set("hash",window.location.hash),comm.triggerServerEvent("Event","HashTagChanged",e)}},!1)}function monitorFocus(){window.setInterval(function(){var e=document.hasFocus();e!=mLastFocus&&(mLastFocus=e,0{startAjaxConnection(!1)},500)}catch(e){}setTimeout(()=>{startAjaxConnection(!1)},5e3)}else setTimeout(keepalive,3e3)},xhr.send()}function isFirefox(){return-1e.controlID===t&&e.eventName===o);n?n.data=i:queuedCommands.push(e),experimentalSendEventsInBatches?msgQueueTimer||(i=50<(new Date).getTime()-lastBatchDepartedAt?0:50,msgQueueTimer=window.setTimeout(sendServerEventsInBatches,i)):msgQueueTimer=setTimeout(sendServerEvents,50)}}function sendServerEvents(){for(msgQueueTimer=null;0(msgQueueTimer=null,0{""===e&&(e="{}"),parseResponse(JSON.parse(e))}).catch(e=>{console.error(e)})}else msgQueueTimer=window.setTimeout(sendServerEventsInBatches,100)}function experimentalEnableServerEventsInBatches(){experimentalSendEventsInBatches=!0}function experimentalDisableServerEventsInBatches(){experimentalSendEventsInBatches=!1}function parseResponse(e){let o;if("{}"!=e.valueOf())for(o=0;o=t){var o=e[t];if(o&&(!o.ariaDisabled||"true"!==o.ariaDisabled)&&document.activeElement!==o)return this.mFocusIndex=t,e[t].focus(),!0}return!1}focusNext(){const e=this.focusableElements();var t=this.mFocusIndex+1;if(e&&e.length>=t){var o=e[t];if(o&&(!o.ariaDisabled||"true"!==o.ariaDisabled)&&document.activeElement!==o)return this.mFocusIndex=t,e[t].focus(),!0}return!1}getActiveChild(){const e=this.DOMElement();return e?e.querySelector(":focus, :focus-visible"):null}resize(e,t){let o=this.DOMElement();o&&(o.style.width=e.toString(10)+"px",o.style.height=t.toString(10)+"px",this.resized())}resized(){}parentResized(){}parentPanelShown(){}moveTo(e){let t=this.DOMElement();t&&(t.style.left=e.left.toString(10)+"px",t.style.top=e.top.toString(10)+"px",this.resize(e.width,e.height),this.refresh())}getAutoLayoutLocation(){var e=this.DOMElement();if(!e)return null;let t=new c.AutoLayoutParameters;return t.left=e.offsetLeft,t.top=e.offsetTop,t.width=e.offsetWidth,t.height=e.offsetHeight,t.baseline=0,t}adjustLocks(e,t){let o=this.mEdgeLocks;"height"==e&&(null==o.height&&null!=o.bottom&&"number"==typeof o.bottom?o.bottom=o.bottom-t:null!=o.height&&"number"==typeof o.height&&(o.height=o.height+t)),this.applyLocks()}applyLocks(){let a=this.DOMElement();if(a){let e="",t="",o="",i="",n="",s="",r="",l="";var h=this.mEdgeLocks;null==h.bottom&&null==h.height&&null==h.top||(null!=h.bottom&&"number"==typeof h.bottom&&(i=+h.bottom+"px"),s=h.height?h.height+"px":"",null!=h.top&&("string"==typeof h.top?(t=h.top,r=a.offsetHeight/2*-1+"px"):"number"==typeof h.top&&(t=+h.top+"px"))),null==h.right&&null==h.width&&null==h.left||(null!=h.right&&"number"==typeof h.right&&(o=+h.right+"px"),n=h.width?h.width+"px":"",null!=h.left&&("string"==typeof h.left?(e=h.left,l=a.offsetWidth/2*-1+"px"):"number"==typeof h.left&&(e=+h.left+"px")));var d=a.style.width,h=a.style.height;!this.mVisible&&this.parentLayout||(e&&(a.style.left=e),o&&(a.style.right=o),t&&(a.style.top=t),i&&(a.style.bottom=i),(n||o)&&(a.style.width=n),(s||i)&&(a.style.height=s),l&&(a.style.marginLeft=l),r&&(a.style.marginTop=r)),a.style.width===d&&a.style.height===h||this instanceof c.XojoView&&this.notifyContainedControls("resized")}}hasClass(e){return $("#"+this.controlID()).hasClass(e)}addClass(e){$("#"+this.controlID()).addClass(e),this.refresh()}removeClass(e){$("#"+this.controlID()).removeClass(e),this.refresh()}setCursor(e){let t=this.interactiveElement();t&&(t.style.cursor=e)}setEnabled(e,t=0){this.mEnabled!=e&&(this.mEnabled=e,this.interactiveElement()&&this.refresh())}getVisibleValue(){return""}setVisible(t){let o=this.DOMElement();if(o){let e="";if(t){if(o.style.display=this.getVisibleValue(),!this.mVisible&&(this instanceof c.XojoDialog||(e="shown"),this instanceof c.XojoPage)){let e=this;window.setTimeout(function(){c.TabEngine.activateTabEngine(e.tabEngine,!1)},50)}}else o.style.display="none",1==this.mVisible&&(e="hidden");this.mVisible=t,""!==e&&(this instanceof c.XojoPage||this.implementsEvent(e))&&this.triggerEvent(e)}}triggerEvent(e){const t=this;if(e!==this.mLastVisibilityEventSent){if(-1!==["shown","hidden"].indexOf(e)&&window.clearTimeout(this.mLastVisibilityEventTimer),!this.mAfterFirstShow&&-1!==["shown","hidden"].indexOf(e))return"hidden"===e?void 0:void window.setTimeout(function(){t.triggerEvent(e)},0);switch(e){case"shown":case"hidden":this.mLastVisibilityEventTimer=window.setTimeout(function(){"shown"===e&&!t.physicallyVisible||(t.mLastVisibilityEventSent=e,window.setTimeout(function(){t.mLastVisibilityEventSent=""},1e3),t.triggerServerEvent(e,null,t instanceof c.XojoView),t instanceof c.XojoView&&t.notifyContainedControls(e))},0)}}}setFocus(){let t=this.focusElement();if(t){var e=t.getAttribute("tabindex");if(e&&"-1"!=e){t.focus();let e=c.TabEngine.findTabEngineForControl(this);c.TabEngine.activateTabEngine(e,!1),null!==e&&void 0!==e&&e.setFocusedControl(this)}}}focusHandler(e){if(e instanceof FocusEvent||e instanceof MouseEvent)if("focus"==e.type){let e=c.TabEngine.findTabEngineForControl(this);e&&(c.TabEngine.activateTabEngine(e,!1),e.setFocusedControl(this)),this.gotFocus(),this.triggerServerEvent("FocusReceived",null),this.triggerServerEvent("gotfocus",null)}else if("blur"==e.type){let e=new c.JSONItem;e.set("lastValue",this.lostFocus()),this.triggerServerEvent("FocusLost",e),this.triggerServerEvent("lostfocus",e)}}applyColorAndSize(e,t,o=""){switch(this.mColor){case s.Default:var i="dark"===document.documentElement.getAttribute("data-bs-theme");c.session.isDarkModeEnabled||i?e.push(t+"-secondary"):e.push(t+"-light");break;case s.Primary:e.push(t+"-primary");break;case s.Success:e.push(t+"-success");break;case s.Info:e.push(t+"-info");break;case s.Warning:e.push(t+"-warning");break;case s.Danger:e.push(t+"-danger");break;case s.Link:e.push(t+"-link");break;case s.Secondary:e.push(t+"-secondary");break;case s.Light:e.push(t+"-light");break;case s.Dark:e.push(t+"-dark");break;default:e.push(t+"-light")}switch(this.mSize){case n.Large:e.push(o+"-lg");break;case n.Small:e.push(o+"-sm")}}attachContextualMenu(s=this.controlID(),n=0){if(null!=this.mContextMenu&&-1!=this.mContextMenu.length&&document.getElementById(s)){let e=this.controlID()+"_contextmenu";0n&&(n=s,t=i)}for(o=this.mConstraintSets[t].getConstraints(),i=0;ie instanceof r.XojoButton&&e.isCancel());return 0e.offsetWidth-160&&(r.style.left="menu"==s?"-90%":"-100%"));let a=0,h=!1;for(a=0;ae.position-t.position),i.map(({item:e})=>e)},c.preloadImage=function preloadImage(e){let t=document.createElement("div");t.style.left="-99999px",t.style.top="-99999px",t.style.backgroundImage="url("+e+")"},c.mergeDeep=function mergeDeep(e,...t){if(!t.length)return e;var o=t.shift();if(_isObject(e)&&_isObject(o))for(const i in o)_isObject(o[i])?(e[i]||Object.assign(e,{[i]:{}}),mergeDeep(e[i],o[i])):Object.assign(e,{[i]:o[i]});return mergeDeep(e,...t)}}(XojoWeb=XojoWeb||{}),function(p){class XojoAudioPlayer extends p.XojoVisualControl{constructor(e,t){super(e,t),this.mSource="",this.mShowControls=!1,this.mAutoPlay=!1,this.mLoop=!1,this.mPosterURL=""}play(){let e=this.audioElement();e&&e.play()}pause(){let e=this.audioElement();e&&e.pause()}seek(e){let t=this.audioElement();t&&(t.currentTime=e)}audioElement(){return document.getElementById(this.controlID()+"_audio")}currentTime(){var e=this.audioElement();return e?e.currentTime:0}duration(){var e=this.audioElement();return e?e.duration:0}interactiveElement(){return this.DOMElement("_audio")}focusElement(){return null}render(){super.render();let u=this.DOMElement();if(u){this.setAttributes();let m=document.getElementById(this.controlID("_audio"));if(!m){m=document.createElement("audio"),m.id=this.controlID("_audio"),m.style.width="100%",m.style.height="100%";let o=this,e=function(e){o.triggerServerEvent("DownloadAborted")},t=function(e){o.triggerServerEvent("PlaybackReady")},i=function(e){let t=new p.JSONItem;t.set("duration",o.duration()),o.triggerServerEvent("PlaybackReadyThroughEnd",t,!0)},n=function(e){o.triggerServerEvent("PlaybackEnded")},s=function(e){o.triggerServerEvent("DownloadError")},r=function(e){o.triggerServerEvent("PlaybackPaused")},l=function(e){o.triggerServerEvent("PlaybackBegan")},a=function(e){let t=new p.JSONItem;t.set("duration",o.duration()),t.set("time",o.currentTime()),o.debounceServerEvent("PlaybackProgressed",t,!0)},h=function(e){let t=new p.JSONItem;t.set("duration",o.duration()),t.set("time",o.currentTime()),o.debounceServerEvent("PositionChanged",t,!0)},d=function(e){o.triggerServerEvent("DownloadStalled")},c=function(e){o.triggerServerEvent("DownloadSuspended")};m.addEventListener("abort",e),m.addEventListener("canplay",t),m.addEventListener("canplaythrough",i),m.addEventListener("ended",n),m.addEventListener("error",s),m.addEventListener("pause",r),m.addEventListener("play",l),m.addEventListener("timeupdate",a),m.addEventListener("seeked",h),m.addEventListener("stalled",d),m.addEventListener("suspend",c),u.appendChild(m)}this.applyTooltip(this.enabled?m:u),""!=this.mSource&&m.setAttribute("src",this.mSource),this.mShowControls&&m.setAttribute("controls","true"),this.mAutoPlay&&m.setAttribute("autoplay","true"),this.mLoop&&m.setAttribute("loop","true"),this.enabled?m.removeAttribute("disabled"):m.setAttribute("disabled","true"),this.applyUserStyle(m)}}updateControl(e){super.updateControl(e);e=JSON.parse(e);e.source&&(this.mSource=e.source),e.controller&&(this.mShowControls=e.controller),e.autoplay&&(this.mAutoPlay=e.autoplay),e.loop&&(this.mLoop=e.loop),e.poster&&(this.mPosterURL=e.poster),this.refresh()}}p.XojoAudioPlayer=XojoAudioPlayer}(XojoWeb=XojoWeb||{}),function(e){let r;var t;(t=r=r||{})[t.equal=0]="equal",t[t.greaterThan=1]="greaterThan",t[t.lessThan=2]="lessThan";e.AutoLayoutParameters=class AutoLayoutParameters{constructor(){this.left=0,this.top=0,this.width=0,this.height=0,this.baseline=null}setPropertyByName(e,t){switch(e){case"left":this.left=t;break;case"top":this.top=t;break;case"height":this.height=t;break;case"width":this.width=t;break;case"baseline":this.baseline=t}}};class XojoConstraint{constructor(e,t,o,i,n,s,r,l){this.name="",this.active=!0,this.view1=e,this.attr1=t,this.relation=o,this.view2=i,this.attr2=n,this.constant=s,this.multiplier=r,this.priority=l}toString(){if(""!==this.name)return this.name;let e=this.view1+"."+this.attr1+" "+this.relation+" "+this.view2+"."+this.attr2;return this.constant<0?e+="-":e+="+",e+=this.constant.toString(10)+" x "+this.multiplier.toString(10)+" : "+this.priority.toString(10),e}}e.XojoConstraint=XojoConstraint;e.ConstraintSet=class ConstraintSet{constructor(e){this.mConstraints=[],this.mLayoutSize=-1,this.mLayoutSize=e}layoutSize(){return this.mLayoutSize}addConstraint(e){this.mConstraints.push(e)}removeConstraint(e){let t=0;for(t=0;t nav > .breadcrumb")}selectHandler(t){let e=t.target;if(e instanceof HTMLAnchorElement){t=e.getAttribute("idx");if(t){let e=new s.JSONItem;e.set("index",parseInt(t,10)),this.triggerServerEvent("pressed",e,!0)}}}updateControl(t){super.updateControl(t);t=JSON.parse(t);if(t.segments){let e=s.DecodeBase64(t.segments);this.mSegments=e.split(String.fromCharCode(0))}this.refresh()}focusableElements(){var e;let t=[];var o=null===(e=this.DOMElement())||void 0===e?void 0:e.querySelectorAll("a");if(o)for(let e=0;e{if(""!==this.mBackdropUrl){const s=new Image;if(s.src=this.mBackdropUrl,s.complete){const r=e.ctx;var t,o,i,n;r&&({top:t,left:o,width:i,height:n}=e.chartArea,r.drawImage(s,o,t,i,n))}else s.onload=()=>e.draw()}}}];"line"===this.mChartRawData.type&&(a={ticks:{font:{size:s,family:r},color:n},grid:{color:m.session.isDarkModeEnabled?this.mGridColor.dark:this.mGridColor.light}},e.scales={x:a,y:a});let t=document.createElement("canvas");t.className="chartjs-render-monitor",t.id=this.controlID()+"_chart",t.style.width="100%",t.style.height="100%";n=t.getContext("2d");if(n){this.applyTooltip(t),this.replaceEveryChild(t);var a=new CustomEvent("config",{detail:this.mChartRawData});i.dispatchEvent(a),this.mChartObj&&this.mChartObj.destroy();const c={data:{datasets:[]},options:{scales:{}},plugins:l};if(m.mergeDeep(c,{},this.mChartRawData),0e.data.length).reduce((e,t)=>Math.max(e,t))}catch(e){o=0}for(;this.mChartRawData.data.labels.lengththis.mListIndex?o.value=this.mMenu.item(this.mListIndex).caption:o.value=this.mValue;let t=e.querySelector(".input-group-append");t||(t=document.createElement("div"),t.className="input-group-append",e.appendChild(t));let i=e.querySelector("button");i||(i=document.createElement("button"),i.setAttribute("data-bs-toggle","dropdown"),i.setAttribute("data-bs-reference","parent"),i.type="button",i.id=this.controlID("_button"),e.appendChild(i)),i.disabled=!this.mEnabled,this.applyButtonStyle(i),this.applyUserStyle(o),this.applyUserStyle(i);let n=i.querySelector("#"+this.controlID("_menu"));if(this.mMenu&&0"),o=t.indexOf("\n");this.mCaption=t,this.mMultiline=e.multiline,e.align&&(this.mAlignment=e.align),this.refresh()}interactiveElement(){return null}applyCSSStyle(e,t,o){var i;let n=null===(i=this.DOMElement())||void 0===i?void 0:i.querySelector("label");if(n){if(t.startsWith('{"light":'))try{var s=JSON.parse(t);t=r.session.isDarkModeEnabled?s.dark:s.light}catch(e){}n.style.setProperty(e,t)}}getVisibleValue(){return"flex"}}r.XojoLabel=XojoLabel}(XojoWeb=XojoWeb||{}),function(s){let r;var e;(e=r=r||{})[e.Link=0]="Link",e[e.Button=1]="Button";class XojoLink extends s.XojoLabel{constructor(){super(...arguments),this.mURL="",this.mTarget=0,this.mAppearance=r.Link}interactiveElement(){var e=this.DOMElement();return e?e.children[0]:null}focusElement(){return document.querySelector("#"+this.controlID()+" a")}render(){super.render(),this.setAttributes();let i=document.createElement("div"),n=this.mURL;if(""!=n&&0!=this.enabled||(n="javascript:;"),this.mAppearance==r.Link){switch(this.mAlignment){case 0:i.style.textAlign="";break;case 1:i.style.textAlign="left";break;case 2:i.style.textAlign="center";break;case 3:i.style.textAlign="right"}i.style.width="100%",this.mMultiline&&(i.style.height="100%"),this.mMultiline||(i.style.whiteSpace="nowrap",i.style.textOverflow="ellipsis",i.style.overflow="hidden",i.style.alignItems="center")}if(this.mAppearance!=r.Link||this.enabled){let t=document.createElement("a");t.tabIndex=this.mTabIndex,t.href=n,t.innerHTML=this.mCaption;let e="_self";switch(this.mTarget){case 0:e="_self";break;case 1:e="_blank";break;case 2:e="_top";break;case 3:e="_parent"}if("_blank"==e&&(this.enabled?t.setAttribute("target",e):t.removeAttribute("href")),this.mAppearance==r.Button){let e=["btn"];this.enabled||e.push("disabled"),this.applyColorAndSize(e,"btn"),t.className=e.join(" ")}i.appendChild(t);let o=this;t.addEventListener("keydown",function(e){"space"==e.code.toLowerCase()&&(e.preventDefault(),window.location.href=o.mURL)}),this.applyUserStyle(t)}else{const e=document.createElement("span");e.style.width="100%",e.style.height="100%",e.innerHTML=this.mCaption,i.appendChild(e),this.applyUserStyle(i)}this.replaceEveryChild(i),this.attachContextualMenu(),this.applyTooltip(i)}updateControl(e){super.updateControl(e);e=JSON.parse(e);e.url&&(this.mURL=e.url),null!=e.external&&(this.mTarget=e.external),e.appearance&&(this.mAppearance=e.appearance),this.refresh()}applyCSSStyle(e,t,o,i=null){if(i){if(t.startsWith('{"light":'))try{var n=JSON.parse(t);t=s.session.isDarkModeEnabled?n.dark:n.light}catch(e){}i.style.setProperty(e,t)}}}s.XojoLink=XojoLink}(XojoWeb=XojoWeb||{}),function(c){let e;var t;(t=e=e||{})[t.Descending=-1]="Descending",t[t.None=0]="None",t[t.Ascending=1]="Ascending";let d;(t=d=d||{})[t.None=0]="None",t[t.Single=1]="Single",t[t.Multiple=2]="Multiple";class ListboxColumn{constructor(){this.mType="",this.mHeader="",this.mSortable=!1,this.mFieldName="",this.mWidth="",this.sortDirection=e.None,this.contextMenu=null}get type(){return this.mType}get fieldName(){return this.mFieldName}set header(e){this.mHeader=e}get header(){return this.mHeader}get sortable(){return this.mSortable}get width(){return this.mWidth}renderForDatasource(){var e;return e.label=this.mHeader,e.property=this.mFieldName,e.sortable=this.mSortable,e}static parse(t){let o=[],i;for(i=0;i=this.mColumns.length)){this.mColumns[o].header=i;let t=this.getDatatableAPIObject();if(t)if(!(o>=t.table().header().querySelector("tr").children.length)){let e=t.column(o).header();e instanceof HTMLTableCellElement&&(e.innerHTML=i),this.refresh()}}}setEnabled(e,t=!1){super.setEnabled(e,t);const o=this.DOMElement();o&&o.classList.toggle("disabled",!this.mEnabled)}setHasHeader(t){let o=this.getDatatableAPIObject();if(o){let e=o.table().header();!e&&t?this.refresh():t?(e.style.display="",o.columns.adjust().draw()):e.style.display="none"}}sendSelectionChanged(){0!==this.mSelectionChangedTimer&&(window.clearTimeout(this.mSelectionChangedTimer),this.mSelectionChangedTimer=0);const o=this;this.mSelectionChangedTimer=window.setTimeout(function(){var t=JSON.stringify(o.mSelectedKeys);if(t!==o.mLastSentSelectedKeys){o.mLastSentSelectedKeys=t;let e=new c.JSONItem;e.set("keys",o.mSelectedKeys),o.triggerServerEvent("selectionchanged",e,!0),o.mSelectionChangedTimer=0}},50)}updateTableConfig(){let s=this.DOMElement();if(s){var r,l=s.querySelector("table thead"),l=this.mHasHeader&&(null==l?void 0:l.offsetHeight)||0,l=s.offsetHeight-l+"px";let t=[],o=[],i=0;for(r of this.mColumns){let e={};e.data=r.fieldName.replace(new RegExp("[.]","g"),"\\."),e.name=r.fieldName,e.width=this.columnWidthValue(r.width),e.minWidth=e.width,e.maxWidth=e.width,e.orderable=r.sortable,e.title=r.header,r.sortDirection&&o.push([i,r.sortDirection]),t.push(e),i+=1}let e={toggleable:!1,style:"api"};switch(this.mSelectionType){case d.None:break;case d.Single:e.style="single";break;case d.Multiple:e.style="os",e.toggleable=!0}let n=this;l={dom:"t",columns:t,autoWidth:!1,serverSide:!0,ajax:{url:c.sessionURL()+"/data/"+this.controlID()+"/rowdata",type:"POST"},deferRender:!1,searching:!1,info:!1,lengthChange:!0,select:e,paging:!0,ordering:!0,order:o,rowReorder:{selector:"tr",enable:this.mRowReordering},colReorder:this.mColumnReordering,scrollX:!0,scrollY:l,scroller:{rowHeight:49},fixedHeader:{header:!1,footer:!1},fixedColumns:{leftColumns:this.mFixedLeftColumns},orderMulti:!1,tabIndex:this.mTabIndex,processing:""!=this.mProcessingText,language:{emptyTable:this.mNoItemsText,zeroRecords:this.mNoItemsText,processing:this.mProcessingText},orderClasses:this.mHighlightSortedColumn,destroy:!0,createdRow:function(e,t,o,i){n.createdRowCallback(e,t,o,i)},pageLength:25,drawCallback:function(e){n.drawBufferRow(),n.adjustColumns()},initComplete:function(e,t){n.mLastKnownSize=n.getRenderedSize(),n.drawBufferRow(),n.adjustColumns()}};return this.mDatatableOptions=l,this.mForceRefresh&&(this.mDatatableAPIObject&&this.mDatatableAPIObject.destroy(),this.mDatatableAPIObject=null),this.attachContextualMenu(),this.applyUserStyle(),this.getDatatableAPIObject()}}drawBufferRow(){const e=this.getDatatableAPIObject(),t=document.querySelector("#"+this.controlID()+" .dataTables_scrollBody");if(t){if(!e||0===e.rows().count()){const i=document.querySelector("#"+this.controlID("_table")+" .dataTables_empty");return t.style.overflow="hidden",void(i&&(i.style.height=t.clientHeight+"px"))}var o;t.style.overflow="auto",this.mIsDrawingOverflowBuffer||(this.mIsDrawingOverflowBuffer=!0,o=document.querySelector("#"+this.controlID()+" .dataTables_scrollBody table"),t&&o&&(t.clientHeight>o.clientHeight?t.style.background="var(--bs-background-color)":t.style.background=""),this.mIsDrawingOverflowBuffer=!1)}}reloadData(){-1!==this.mReloadDataTimer&&(window.clearTimeout(this.mReloadDataTimer),this.mReloadDataTimer=-1),this.mReloadDataTimer=window.setTimeout(()=>{let e=this.getDatatableAPIObject();e&&e.ajax&&e.ajax.reload()},50)}clear(){let e=this.getDatatableAPIObject();e&&e.clear()}refresh(e=!1){this.mForceRefresh=this.mForceRefresh||e,e&&(this.mForceRefresh=!1,null!==(e=this.DOMElement("_table_wrapper"))&&void 0!==e&&e.remove()),this.findTableAndApplyNodeStyle(),this.applySelectionColor(),super.refresh()}updateControl(e){super.updateControl(e);var t=JSON.parse(e);this.mForceRefresh=!0,t.columnData&&(e=ListboxColumn.parse(t.columnData),this.mFirstUpdate||JSON.stringify(this.mColumns)===JSON.stringify(e)||(this.mForceRefresh=!0),this.mFirstUpdate=!1,this.mColumns=e),this.mSelectionType!==t.selectiontype&&(this.mSelectionType=t.selectiontype,this.mForceRefresh=!0),this.mRowReordering=t.allowrowreordering,this.mColumnReordering=t.allowcolumnreordering,this.mNoItemsText=c.DecodeBase64(t.noitemstext),this.mProcessingText=c.DecodeBase64(t.processingtext),this.mHighlightSortedColumn=t.highlightcolumn,this.mFixedLeftColumns=t.frozencolumns,""!=t.selectColor&&(this.mSelectColor=t.selectColor),t.hasheader,this.mHasHeader!==t.hasheader&&(this.mHasHeader=t.hasheader,this.mForceRefresh=!0),this.findTableAndApplyNodeStyle(),this.applySelectionColor(),this.update()}findTableAndApplyNodeStyle(){const e=this.DOMElement();e&&e.querySelectorAll("table").forEach(e=>{this.applyTableNodeStyle(e)})}update(){!document.querySelector("#"+this.controlID("_table"))||this.mForceRefresh?this.refresh():this.updateTableConfig()}createdRowCallback(n,s,e,r){let t=this.getDatatableAPIObject(),l=0;try{s.DT_RowData&&(l=s.DT_RowData.pkey,this.preventSelectEvents(),-1tbody>tr.selected>* { box-shadow: inset 0 0 0 9999px "+e+"; color: white; }",0),n.insertRule("#"+this.controlID()+" table>tbody>tr.selected:hover>* { box-shadow: inset 0 0 0 9999px "+e+"; color: white }",1)}}applySelectionColor(){let e="var(--bs-primary)";this.mSelectColor&&(e=c.session.isDarkModeEnabled?this.mSelectColor.dark:this.mSelectColor.light),e!==this.mCurrentSelectColor&&(this.mCurrentSelectColor=e,this.setSelectionColor(e))}setVisible(e){var t=e&&!this.mVisible;super.setVisible(e),t&&this.refresh(!0)}columnWidthValue(e){if(!e||"*"===e)return e="auto";if(!(e=e.trim()).endsWith("%"))return e+"px";var t=this.DOMElement("").offsetWidth,e=parseInt(e.replace("%","").replace("px",""));const o=Math.floor(t*(e/100)-42);return o.toString(10)+"px"}static preventClicksOnBufferRow(e){var t=e.target;if(!(t&&t instanceof HTMLTableCellElement))return!1;const o=t.parentNode;return!(!o||!o.classList.contains("buffer"))&&(e.preventDefault(),e.stopPropagation(),!0)}preventSelectEvents(){this.mPreventSelect=!0;const e=this;window.setTimeout(function(){e.mPreventSelect=!1},0)}static prepareColumnHeaderCaption(e){let t=c.DecodeBase64(e);return""===t&&(t=" "),t=t.replace(" "," "),t}isNodeVisible(e){e.getBoundingClientRect();var t=null===(t=this.DOMElement(""))||void 0===t?void 0:t.querySelector(".dataTables_scrollBody");return t?e.offsetTop+e.clientHeight>t.scrollTop+t.clientHeight?1:e.offsetTop{const e=this.getDatatableAPIObject();e&&e.columns&&e.columns.adjust&&e.columns.adjust()},100)}resizeIfNeeded(){var e=this.getRenderedSize();this.mLastKnownSize.width!==e.width&&this.mLastKnownSize.height===e.height?(this.mLastKnownSize=e,this.adjustColumns()):this.mLastKnownSize.width===e.width&&this.mLastKnownSize.height===e.height||(this.mLastKnownSize=e,this.parentPanelShown())}getRenderedSize(){var e=this.DOMElement();return e?{width:e.offsetWidth,height:e.offsetHeight}:{width:-1,height:-1}}}XojoListBox.renderers=new c.dictionary,c.XojoListBox=XojoListBox}(XojoWeb=XojoWeb||{}),function(i){class RowData{constructor(e=null){this.mRowData=[],null!=e&&(this.mRowData=e)}setCell(e,t){for(;e>this.mRowData.length-1;)this.mRowData[e]="";this.mRowData[e]=t}getCell(e){return this.mRowData[e]}data(){return this.mRowData}get length(){return this.mRowData.length}}class XojoListView extends i.XojoVisualControl{constructor(e,t){super(e,t),this.mHasHeading=!1,this.mHeadingNames=[],this.mRows=[],this.mColumnCount=0}addRow(e){this.insertRow(this.mRows.length,e)}insertRow(e,t){this.mRows.push(new RowData);let o=this.mRows[e],i;for(i=0;i"),t;for(t=0;t");0==t&&this.mHasHeading?this.mHeadingNames=i:(i=new RowData(i),this.mRows.push(i))}}this.refresh()}resize(e,t){var o;e==this.mWidth&&t==this.mHeight||(o=this.mWidth!=e,this.mHeight,this.mWidth,this.mHeight,this.mWidth=e,this.mHeight=t,o&&this.adjustHeaderWidth())}}i.XojoListView=XojoListView}(XojoWeb=XojoWeb||{}),(XojoWeb||(XojoWeb={})).ListboxCellRenderer=class ListboxCellRenderer{render(e,t,o,i,n,s){}pointerEvent(e,t,o){return!1}};class XojoListboxBuiltinRenderer extends XojoWeb.ListboxCellRenderer{render(e,t,o,i,n,s){}}XojoWeb.XojoListBox.addRenderer("Xojo-Default",new XojoListboxBuiltinRenderer);class XojoImageRenderer extends XojoWeb.ListboxCellRenderer{render(e,t,o,i,n,s){let r=o.url;if(""!=r.trim()){let e=document.createElement("img");e.src=r,o.centered&&(e.style.display="block",e.style.margin="auto"),s.innerHTML=e.outerHTML}else s.innerHTML=""}}XojoWeb.XojoListBox.addRenderer("Xojo-Image",new XojoImageRenderer);class XojoStyleRenderer extends XojoWeb.ListboxCellRenderer{render(e,t,o,i,n,s){let r=0,l=s;"row"==o.xojo_target&&(l=t),delete o.xojo_target,s.innerText=o.xojo_value,delete o.xojo_value;var a=Object.keys(o);for(r=0;rOpenStreetMap contributors',maxzoom:20},satellite:{url:"https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",attribution:"Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community",maxzoom:19}};class XojoMapViewer extends a.XojoVisualControl{constructor(e,t){super(e,t),this.mAllowFullScreen=!0,this.mFullScreenControl=null,this.mCenter={latitude:0,longitude:0},this.mZoom=10,this.mMapInstance=null,this.mGeoJSON=null,this.mMarkers=[],this.mLocations=[],this.mMapType=o.Roadmap,this.mMapLayers=[0],this.mApiKey="",this.mMapStyle="",this.mMapStyleURL="",this.mRouteDrawingColor={light:"#007296",dark:"#007296"},this.mRoutePenSize=5;this.DOMElement()}drawGeoJSON(e){this.mGeoJSON=e,this.mMapInstance&&(this.removeGeoJSON(),this.mMapInstance.addSource("geojson_source",{type:"geojson",data:{type:"FeatureCollection",features:[e]}}),this.mMapInstance.addLayer({id:"geojson_layer",type:"line",source:"geojson_source",layout:{"line-cap":"round"},paint:{"line-color":a.session.isDarkModeEnabled?this.mRouteDrawingColor.dark:this.mRouteDrawingColor.light,"line-width":this.mRoutePenSize}}))}removeGeoJSON(){this.mMapInstance&&(this.mMapInstance.getLayer("geojson_layer")&&this.mMapInstance.removeLayer("geojson_layer"),this.mMapInstance.getSource("geojson_source")&&this.mMapInstance.removeSource("geojson_source"))}interactiveElement(){return null}render(){super.render();var e=this.DOMElement();if(e){if(this.setAttributes(),!this.mMapInstance){this.mMapInstance=new maplibregl.Map({container:e,style:this.buildRasterStyle(),center:[this.mCenter.longitude,this.mCenter.latitude],zoom:this.mZoom});const i=this,o=i.mMapInstance;o.addControl(new maplibregl.NavigationControl),o.on("zoomend",function(){i.mZoom=o.getZoom();const e=new a.JSONItem;e.set("zoomLevel",i.mZoom),i.triggerServerEvent("ZoomChanged",e,!0)}),o.on("moveend",function(){var e=o.getCenter();i.mCenter={latitude:e.lat,longitude:e.lng};const t=new a.JSONItem;t.set("latitude",i.mCenter.latitude),t.set("longitude",i.mCenter.longitude),i.triggerServerEvent("CenterChanged",t)}),o.on("click",function(e){var{lat:t,lng:e}=e.lngLat;const o=new a.JSONItem;o.set("latitude",t),o.set("longitude",e),o.set("locationIndex",i.getLocationIndex(t,e)),i.triggerServerEvent("Pressed",o)}),o.on("dblclick",function(e){const t=new a.JSONItem;t.set("latitude",e.lngLat.lat),t.set("longitude",e.lngLat.lng),i.triggerServerEvent("DoublePressed",t)}),this.setLayers()}this.mAllowFullScreen?this.mFullScreenControl||(this.mFullScreenControl=new maplibregl.FullscreenControl,this.mMapInstance.addControl(this.mFullScreenControl)):this.mFullScreenControl&&(this.mMapInstance.removeControl(this.mFullScreenControl),this.mFullScreenControl=null),this.resetMarkers(),this.mGeoJSON&&this.drawGeoJSON(this.mGeoJSON),this.applyTooltip(e);e=document.querySelector(`#${e.id} canvas`);e&&this.applyUserStyle(e)}}setLayers(){this.mMapInstance}addLocation(o,i,n,s){if(this.mMapInstance&&-1===this.getLocationIndex(o,i)){let e=null;""!==n.trim()&&(e=new maplibregl.Popup({offset:""===s?25:5}).setText(atob(n)));let t=null;""!==s&&(t=document.createElement("div"),t.className="marker",s=atob(s),t.style.width="25px",t.style.height="25px",t.style.backgroundImage=`url('${s}')`,t.style.backgroundRepeat="no-repeat",t.style.backgroundSize="contain",t.style.backgroundPosition="center center");const r=t?new maplibregl.Marker({element:t}):new maplibregl.Marker;r.setLngLat({lat:o,lng:i}),e&&r.setPopup(e),r.addTo(this.mMapInstance),this.mMarkers.push(r);const l=this;r.getElement().style.cursor="pointer",r.getElement().addEventListener("mouseenter",function(e){const t=r.getPopup();if(t&&!t.isOpen()){r.togglePopup();const o=document.activeElement;o&&o instanceof HTMLButtonElement&&o.classList.contains("maplibregl-popup-close-button")&&o.blur()}}),r.getElement().addEventListener("mouseleave",function(e){const t=r.getPopup();t&&t.isOpen()&&r.togglePopup()}),r.getElement().addEventListener("click",function(e){e.preventDefault(),e.stopPropagation();const t=new a.JSONItem;e=r.getLngLat();t.set("latitude",e.lat),t.set("longitude",e.lng),t.set("locationIndex",l.mMarkers.indexOf(r));e=l.implementsEvent("LocationSelected");l.triggerServerEvent("Pressed",t,e)})}}buildRasterStyle(){var e=this.mMapType===o.Satellite?i.satellite:i.roadmap;return{version:8,sources:{"raster-tiles":{type:"raster",tiles:[e.url],tileSize:256,attribution:e.attribution}},layers:[{id:"simple-tiles",type:"raster",source:"raster-tiles"}]}}removeLocationAt(e){if(0<=e){const t=this.mMarkers[e];this.mMarkers.splice(e,1),t.remove()}}getLocationIndex(t,o){for(let e=0;e .modal-backdrop");i.forEach(function(e){e.remove()}),t&&t.remove(),t=document.createElement("div"),t.id=e,document.body.appendChild(t);let n=document.createElement("div");n.className="modal fade",n.setAttribute("tabIndex","-1"),n.setAttribute("role","dialog"),n.id=this.controlID("_dialog");let s=document.createElement("div");s.className="modal-dialog",s.setAttribute("role","document"),n.appendChild(s);let r=document.createElement("div");if(r.className="modal-content",s.appendChild(r),""!=this.mTitle.trim()){let e=document.createElement("div");e.className="modal-header",e.innerHTML=""+this.mTitle+"
",r.appendChild(e)}let l="";if(""!=this.mMessage&&(l+=""+this.mMessage+"
"),""!=this.mExplanation&&(l+=""+this.mExplanation+"
"),""!=l.trim()){let e=document.createElement("div");e.className="modal-body",e.innerHTML=l,r.appendChild(e)}if(this.alternateButton.visible||this.actionButton.visible||this.cancelButton.visible){this.mNeedsFocusSet=!0;let e=document.createElement("div");e.className="modal-footer";const a=this.MakeButtonElement(this.cancelButton),h=window.matchMedia("(prefers-color-scheme: dark)");h.addEventListener("change",function(e){a.classList.toggle("btn-secondary",e.matches),a.classList.toggle("btn-light",!e.matches)}),this.alternateButton.visible&&e.appendChild(this.MakeButtonElement(this.alternateButton)),this.cancelButton.visible&&e.appendChild(a),this.actionButton.visible&&e.appendChild(this.MakeButtonElement(this.actionButton)),r.appendChild(e)}t.appendChild(n),null!==(e=this.mModal)&&void 0!==e&&e.dispose(),this.mModal=new bootstrap.Modal(n,{backdrop:"static",keyboard:this.cancelButton&&this.cancelButton.visible}),n.addEventListener("hide.bs.modal",function(e){o.mVisible=!1}),n.addEventListener("hidden.bs.modal",function(e){null!==t&&void 0!==t&&t.remove()}),this.actionButton&&this.actionButton.visible&&n.addEventListener("keydown",function(e){let t=new d.JSONItem;switch(e.keyCode){case 13:t.set("button","action");break;case 27:t.set("button","cancel");break;case 32:if(e.target instanceof HTMLElement)switch(e.target.getAttribute("action")){case"default":t.set("button","action");break;case"alt":t.set("button","altaction");break;case"cancel":t.set("button","cancel")}break;default:return}e.preventDefault(),o.hide(),o.triggerServerEvent("ButtonPressed",t)},!1),this.mVisible?(this.applyUserStyle(r),this.show()):this.hide()}show(){var e;this.mPreviousTabEngine=d.TabEngine.currentTabEngine(),null!==(e=this.mModal)&&void 0!==e&&e.show()}hide(){var e;null!==(e=this.mModal)&&void 0!==e&&e.hide(),d.TabEngine.activateTabEngine(this.mPreviousTabEngine,!1)}MakeButtonElement(e){let t=document.createElement("button");switch(e){case this.actionButton:t.id=this.controlID()+"_action",t.setAttribute("action","default");break;case this.alternateButton:t.id=this.controlID()+"_altaction",t.setAttribute("action","alt");break;case this.cancelButton:t.id=this.controlID()+"_cancel",t.setAttribute("action","cancel")}if(this.mNeedsFocusSet){this.mNeedsFocusSet=!1;let e="#"+t.id;var o="#"+this.controlID("_dialog");$(o).on("shown.bs.modal",function(){$(e).focus()})}let i=[];i.push("btn");o=d.session.isDarkModeEnabled?"btn-secondary":"btn-light";e.default?i.push("btn-primary"):e.cancel?(i.push(o),t.setAttribute("data-bs-dismiss","modal")):i.push(o),t.className=i.join(" "),t.innerHTML=e.caption;let n=this.controlID(),s=function(e){let t=d.controls.lookup(n);t&&t.selectHandler(e)};return t.addEventListener("pointerup",s),t}selectHandler(e){this.hide();let t=e.target;if(t instanceof HTMLButtonElement){let e=new d.JSONItem;switch(t.getAttribute("action")){case"default":e.set("button","action");break;case"alt":e.set("button","altaction");break;case"cancel":e.set("button","cancel")}this.triggerServerEvent("ButtonPressed",e,!0)}}updateControl(e){super.updateControl(e);var t=JSON.parse(e);if(this.mTitle=d.DecodeBase64(t.title),this.mMessage=d.DecodeBase64(t.message),this.mExplanation=d.DecodeBase64(t.explanation),void 0!==t.visible&&(this.mVisible=t.visible),t.buttons){let e;for(e=0;ethis.mMaximumValue)&&(this.mNumericValue=Math.min(this.mMaximumValue,Math.max(this.mMinimumValue,this.mNumericValue)),t.value=this.mNumericValue.toString(10));let e=Math.round(this.mNumericValue/this.mStep)*this.mStep;e!=this.mNumericValue&&(this.mNumericValue=e,t.value=e.toString(10))}let e=new n.JSONItem;e.set("value",this.mNumericValue),this.triggerServerEvent("ValueChanged",e,!0)}}n.XojoNumberField=XojoNumberField}(XojoWeb=XojoWeb||{}),function(n){class XojoPage extends n.XojoView{constructor(e,t){super(e,t),this.mTitle="",this.mMinWidth=0,this.mMinHeight=0,this.mResizeTimer=0,this.mLiveResize=!1,this.mTabOrderShouldLoop=!0}generateDOMElement(){super.generateDOMElement("XojoPage","XojoPages")}show(){super.show(),document.title=this.mTitle,this.refresh()}close(){super.close(),n.session.closePage(this)}setFocus(){super.setFocus(),!1===n.session.useTabOrderWrap&&n.TabEngine.deactivateTabEngine(this.mTabEngine)}resize(e,t,o=!0){super.resize(e,t);let i=new n.JSONItem;i.set("width",e),i.set("height",t),i.set("raiseevent",o),this.triggerServerEvent("resized",i,!0)}focusElement(){return null}resized(){if(this.mLiveResize)this.resizeHandler();else{0 li.active > a","background-color",!0)),e.appendChild(t),t.className="tab-content";var n="1px solid var(--bs-border-color)";for(l=0;l=l){let o=this.mTabContents[l];if(o){let t;for(t=0;tthis.mLastPageIndex&&(this.mOffset=this.mLastPageIndex-this.mVisiblePageCount),this.refresh())}interactiveElement(){return this.DOMElement("_inner")}focusElement(){return this.focusableElements()[this.mFocusIndex]}focusableElements(){var e;let t=[];const o=null===(e=this.interactiveElement())||void 0===e?void 0:e.querySelectorAll("a");return o&&o.forEach(function(e){e.ariaDisabled&&"true"===e.ariaDisabled||t.push(e)}),t}render(){super.render();let e=this.DOMElement();if(!e)return;if(this.setAttributes(),0==this.mVisiblePageCount){for(;0 #"+n.id);1 #${n.id} a.active`))&&i instanceof HTMLAnchorElement&&(i=(o=i.offsetTop)+i.clientHeight,n.scrollTop+n.clientHeight #"+n.id);1this.mListIndex&&-1',n.appendChild(s)),this.applyUserStyle(e)}}inputHandler(e){var t=document.getElementById(this.controlID()+"_search");if(t){if(t.value!=this.mLastChangeSentValue){this.mLastChangeSentValue=t.value,this.mValue=t.value;let e=new i.JSONItem;e.set("value",t.value),this.triggerServerEvent("textchanged",e,!0)}e.stopPropagation()}}pressHandler(e){var t=document.getElementById(this.controlID()+"_search");t&&(this.mLastSearchSentValue=t.value);let o=new i.JSONItem;o.set("value",this.mLastSearchSentValue),this.triggerServerEvent("pressed",o)}updateControl(e){super.updateControl(e);e=JSON.parse(e);e.cue&&(this.mCueText=i.DecodeBase64(e.cue)),"string"==typeof e.value&&(this.mValue=e.value,this.mRefreshFromScratch=!0),this.refresh()}}i.XojoSearchField=XojoSearchField}(XojoWeb=XojoWeb||{}),function(d){let c;var e;(e=c=c||{})[e.none=0]="none",e[e.single=1]="single",e[e.multiple=2]="multiple";class XojoSegment{constructor(){this.caption="",this.glyph="",this.iconURL="",this.enabled=!0,this.selected=!1,this.tooltip=""}static parse(t){let o=[],i;for(i=0;i=1e3*t.mDisconnectSeconds&&i.ShowDisconnectModal(),this.mTimer||(this.mTimer=window.setTimeout(function(){t.mTimer=0,t.run.call(t)},5e3))}}}(XojoWeb=XojoWeb||{}),function(t){class XojoSlider extends t.XojoVisualControl{constructor(){super(...arguments),this.mValue=50,this.mMaximumValue=100,this.mMinimumValue=0,this.mStepValue=1}render(){super.render();let o=this.DOMElement();if(o){this.setAttributes(),this.applyTooltip(o);let e=o.querySelector("input");if(e)return e.min=this.mMinimumValue.toString(10),e.max=this.mMaximumValue.toString(10),e.step=this.mStepValue.toString(10),e.value=this.mValue.toString(10),this.mEnabled?e.removeAttribute("disabled"):e.setAttribute("disabled","disabled"),void this.applyUserStyle(e);e=document.createElement("input"),e.id=this.controlID()+"_field",e.type="range",e.style.width="100%",e.className="form-range",e.setAttribute("min",this.mMinimumValue.toString(10)),e.setAttribute("max",this.mMaximumValue.toString(10)),e.setAttribute("step",this.mStepValue.toString(10)),e.setAttribute("value",this.mValue.toString(10)),this.replaceEveryChild(e),this.applyUserStyle(e);let t=this;o.addEventListener("change",function(e){t.valueChanged(e)})}}focusElement(){let e=this.DOMElement();return e?e.querySelector("#"+this.controlID("_field")):null}updateControl(e){super.updateControl(e);e=JSON.parse(e);this.mMaximumValue=e.max,this.mMinimumValue=e.min,this.mValue=e.value,this.mStepValue=e.step,this.refresh()}valueChanged(e){var t=document.getElementById(this.controlID("_field"));if(t&&t instanceof HTMLInputElement){t=t.valueAsNumber;if(t!=this.mValue){this.mValue=t,0=this.mFocusableControlIDs.length&&(o=0);var i=this.mFocusableControlIDs[o];let t=s.controls.lookup(i);if(t instanceof s.XojoVisualControl){if(t instanceof s.XojoView&&t.tabEngine){this.mCurrentFocusedItemID=t.controlID();let e=t.tabEngine;return t.willFocusOnFirstElement(),TabEngine.activateTabEngine(e,!1),e.mCurrentFocusedItemID=this.mCurrentFocusedItemID,e.focusFirst(),!0}if(this.isControlFocusable(t))return t.willFocusOnFirstElement(),this.focusOn(t),!0}}while(o=this.mFocusableControlIDs.length-1){this.mCurrentFocusedItemID=this.mFocusableControlIDs[this.mFocusableControlIDs.length-1];const o=TabEngine.findTabEngineForControl(this.mParentControl);return o?(this.mCurrentFocusedItemID="",TabEngine.activateTabEngine(o,!1),o.mCurrentFocusedItemID=this.mParentControl.controlID(),void o.focusNext()):void this.focusFirst()}-1!==e?this.focusAfter(this.mCurrentFocusedItemID):this.focusFirst()}}focusPrevious(){this.refresh();var e=this.mFocusableControlIDs.indexOf(this.mCurrentFocusedItemID);const t=this.focusedControl;if(!(t instanceof s.XojoVisualControl&&t.focusPrevious())){if(e<1){this.mCurrentFocusedItemID=this.mFocusableControlIDs[0];const o=TabEngine.findTabEngineForControl(this.mParentControl);return o?(TabEngine.activateTabEngine(o,!1),o.mCurrentFocusedItemID=this.mParentControl.controlID(),void o.focusPrevious()):void this.focusLast()}this.focusBefore(this.mCurrentFocusedItemID)}}focusOn(t){if(t instanceof s.XojoView&&t.tabEngine&&t.isFocusContainer())TabEngine.activateTabEngine(t.tabEngine,!0);else{let e="";t&&(e=t.controlID());var o=this.mCurrentFocusedItemID;t&&e==o?null!==(o=t.focusElement())&&void 0!==o&&o.focus():this.fireFocusEvents(e)&&(t&&(this.mCurrentFocusedItemID=t.controlID(),TabEngine.activateTabEngine(this,!0),null!==(t=t.focusElement())&&void 0!==t&&t.focus()),this.mCurrentFocusedItemID=e)}}clearFocus(){this.focusOn(null)}reFocus(){if(this.focusedControl&&this.focusedControl instanceof s.XojoVisualControl){let e=this.focusedControl.focusElement();e&&e.focus()}}fireFocusEvents(e){return this.mCurrentFocusedItemID!=e}isResponsibleForControl(e){return-1=this.mFiles.length?null:this.mFiles[e]}fileCount(){return this.mFiles.length}totalBytes(){let e=0,t=0;for(e=0;ethis.mFiles.length||this.mFiles.splice(e,1)}removeAllFiles(){this.mFiles=[]}setTimeout(e){this.mUploadTimeout=e}abort(){this.xhr&&this.xhr.abort()}upload(){if(!(this.mFiles.length<1)){let e=this;window.setTimeout(function(){e.doUpload()},1)}}doUpload(){let t=this;this.mLastProgress=-1;let e=function(e){t.mIsUploading=!1,t.mFiles=[]},o=function(e){t.mIsUploading=!0;e=Math.floor(e.loaded/e.total*100);e>t.mLastProgress&&(t.mLastProgress=e,t.mXojoEventCallback.call(t.mInterfaceControl,"progress",e))},i=function(e){t.mIsUploading=!1,t.mXojoEventCallback.call(t.mInterfaceControl,"error","timeout"),t.mFiles=[]},n=function(e){t.mIsUploading=!1,t.mXojoEventCallback.call(t.mInterfaceControl,"abort",""),t.mFiles=[]},s=function(e){t.mIsUploading=!1,t.mXojoEventCallback.call(t.mInterfaceControl,"loadend",""),t.mFiles=[]},r=new FormData;r.append("target",this.mInterfaceControl.controlID());let l,a=[];for(l=0;lthis.mMaxCount&&this.raiseUploadException(h.TooManyFiles,[o.length]),0this.mMaxBytes&&this.raiseUploadException(h.TooManyBytes,[t]),this.reorderElements()}}}reorderElements(){const t=this.DOMElement();var e=this.DOMElement("_button");if(t&&e&&this.mButtonGroup&&this.mInputElement&&this.mLabelElement){this.mHasFieldNameField?(this.mInputElement.parentElement===t&&t.removeChild(this.mInputElement),this.mButtonGroup.querySelector("#"+this.mInputElement.id)||this.mButtonGroup.prepend(this.mInputElement),this.mButtonGroup.querySelector("#"+this.mLabelElement.id)||this.mButtonGroup.prepend(this.mLabelElement)):(this.mButtonGroup.querySelector("#"+this.mInputElement.id)&&(this.mButtonGroup.removeChild(this.mInputElement),t.prepend(this.mInputElement)),this.mButtonGroup.querySelector("#"+this.mLabelElement.id)&&this.mButtonGroup.removeChild(this.mLabelElement));let e=0;this.mInputElement.files&&(e=this.mInputElement.files.length||0),this.mInputElement.style.display=this.mHasFieldNameField&&0