betajs-browser
Version:
BetaJS-Browser is a client-side JavaScript framework for Browser-specific methods.
6 lines • 67.1 kB
JavaScript
/*!
betajs-browser - v1.0.140 - 2023-08-30
Copyright (c) Oliver Friedmann,Rashad Aliyev
Apache-2.0 Software License.
*/
!function(){var e=this.subScope();e.binding("module","global:BetaJS.Browser"),e.binding("base","global:BetaJS"),e.define("module:",function(){return{guid:"02450b15-9bbf-4be2-b8f6-b483bc015d06",version:"1.0.140",datetime:1693425262199}}),e.assumeVersion("base:version","~1.0.104"),e.define("module:Ajax.IframePostmessageAjax",["base:Ajax.Support","base:Net.Uri","base:Net.HttpHeader","base:Promise","base:Types","base:Ajax.RequestException","base:Tokens","base:Objs"],function(c,l,e,d,h,t,p,f){var m=1,n={supports:function(e){return!!e.postmessage},execute:function(t){var n="postmessage_"+p.generate_token()+"_"+m++,e=f.objectBy(t.postmessage,n),e=f.extend(e,t.query),e=l.appendUriParams(t.uri,e),i=document.createElement("iframe"),o=(i.id=n,i.name=n,i.style.display="none",document.createElement("form")),r=(o.method=t.method,o.target=n,e=c.finalizeUri(t,e),o.action=e,o.style.display="none",d.create()),s=(document.body.appendChild(i),document.body.appendChild(o),f.iter(t.data,function(e,t){var n=document.createElement("input");n.type="hidden",n.name=t,n.value=h.is_array(e)||h.is_object(e)?JSON.stringify(e):e,o.appendChild(n)},this),!("postMessage"in window)),a=null,u=function(e){a(e.data)},a=function(e){"string"==typeof e&&(e=JSON.parse(e)),n in e&&(e=e[n],s&&(window.postMessage=null),window.removeEventListener("message",u,!1),document.body.removeChild(o),document.body.removeChild(i),c.promiseReturnData(r,t,e,"json"))};return i.onerror=function(){s&&(window.postMessage=null),window.removeEventListener("message",u,!1),document.body.removeChild(o),document.body.removeChild(i)},window.addEventListener("message",u,!1),s&&(window.postMessage=a),o.submit(),r}};return c.register(n,4),n}),e.define("module:Ajax.JsonpScriptAjax",["base:Ajax.Support","base:Net.Uri","base:Net.HttpHeader","base:Promise","base:Types","base:Ajax.RequestException","base:Tokens","base:Objs","base:Async","module:Info"],function(u,c,l,d,e,t,h,p,f,m){var _=1,n={supports:function(e){return!!e.jsonp&&"GET"===e.method},execute:function(n){var i="jsonp_"+h.generate_token()+"_"+_++,e=p.objectBy(n.jsonp,i),e=p.extend(e,n.query),e=(e=p.extend(e,n.data),c.appendUriParams(n.uri,e)),o=!1,r=(window[i]=function(e){if(!o){o=!0;try{delete window[i]}catch(t){window[i]=undefined}u.promiseReturnData(r,n,e,"json")}},d.create()),t=document.getElementsByTagName("head")[0],s=document.createElement("script"),a=!1;return s.onerror=function(e){e&&(e.stopPropagation?e.stopPropagation():e.cancelBubble=!0),o||(o=!0,u.promiseRequestException(r,l.HTTP_STATUS_BAD_REQUEST,l.format(l.HTTP_STATUS_BAD_REQUEST),null,"json"))},s.onload=s.onreadystatechange=function(){a||this.readyState&&"loaded"!=this.readyState&&"complete"!=this.readyState||(a=!0,s.onload=s.onreadystatechange=null,t.removeChild(s),m.isInternetExplorer()&&m.internetExplorerVersion()<9&&f.eventually(function(){o||s.onerror()}))},e=u.finalizeUri(n,e),s.src=e,t.appendChild(s),r}};return u.register(n,5),n}),e.define("module:Ajax.XDomainRequestAjax",["base:Ajax.Support","base:Net.Uri","base:Net.HttpHeader","base:Promise","base:Types","base:Ajax.RequestException","module:Info","base:Async","base:Ids"],function(o,r,s,a,u,e,t,c,l){var d={__requests:{},supports:function(e){return!!window.XDomainRequest&&!(e.forceJsonp||e.forcePostmessage||!e.isCorsRequest||!t.isInternetExplorer()||9<t.internetExplorerVersion())},execute:function(e){var t=r.appendUriParams(e.uri,e.query||{}),n=("GET"===e.method&&(t=r.appendUriParams(t,e.data||{})),a.create()),i=new XDomainRequest;return(d.__requests[l.objectId(i)]=i).onload=function(){o.promiseReturnData(n,e,i.responseText,"json"),delete d.__requests[l.objectId(i)]},i.ontimeout=function(){o.promiseRequestException(n,s.HTTP_STATUS_GATEWAY_TIMEOUT,s.format(s.HTTP_STATUS_GATEWAY_TIMEOUT),null,"json"),delete d.__requests[l.objectId(i)]},i.onerror=function(){o.promiseRequestException(n,s.HTTP_STATUS_BAD_REQUEST,s.format(s.HTTP_STATUS_BAD_REQUEST),null,"json"),delete d.__requests[l.objectId(i)]},t=o.finalizeUri(e,t),i.open(e.method,t),c.eventually(function(){"GET"===e.method||u.is_empty(e.data)?i.send():"json"===e.contentType?i.send(JSON.stringify(e.data)):i.send(r.encodeUriParams(e.data,undefined,!0))},this),n}};return o.register(d,9),d}),e.define("module:Ajax.XmlHttpRequestAjax",["base:Ajax.Support","base:Net.Uri","base:Net.HttpHeader","base:Promise","base:Types","base:Objs","base:Ajax.RequestException","module:Info"],function(u,c,l,d,h,p,e,f){var t={supports:function(t){if("undefined"!=typeof window){if(!window.XMLHttpRequest)return!1;if(t.forceJsonp||t.forcePostmessage)return!1;if(f.isInternetExplorer()&&f.internetExplorerVersion()<10&&t.isCorsRequest)return!1;try{p.iter(t.data,function(e){("undefined"!=typeof window.Blob&&e instanceof window.Blob||"undefined"!=typeof File&&e instanceof File)&&(t.requireFormData=!0)}),t.requireFormData&&new window.FormData}catch(e){t.requireFormData=!1}}return!0},create:function(){return new XMLHttpRequest},execute:function(e,t,n,i){var o,r=c.appendUriParams(e.uri,e.query||{}),s=(e.methodSupportsPayload||(r=c.appendUriParams(r,e.data||{})),d.create()),a=((i=i||this.create()).onreadystatechange=function(){4===i.readyState&&(l.isSuccessStatus(i.status)||0===i.status&&i.responseText?u.promiseReturnData(s,e,"binary"===e.contentType?i.response:"xml"===e.contentType?i.responseXML:i.responseText,e.decodeType||"json"):u.promiseRequestException(s,i.status,i.statusText,i.responseText,e.decodeType||"json"))},t&&((i.upload||i).onprogress=function(e){e.lengthComputable&&t.call(n||this,e.loaded,e.total)}),r=u.finalizeUri(e,r),c.parse(r));return f.isFirefox()&&a.user&&a.password&&(r=r.replace(a.user+":"+a.password+"@","")),i.open(e.method,r,!0),e.corscreds&&(i.withCredentials=!0),e.bearer&&i.setRequestHeader("Authorization","Bearer "+e.bearer),e.accept&&i.setRequestHeader("Accept",e.accept),"binary"===e.contentType&&(i.responseType="blob"),(a.user||a.password)&&i.setRequestHeader("Authorization","Basic "+btoa(a.user+":"+a.password)),e.methodSupportsPayload&&!h.is_empty(e.data)?e.noFormData?i.send(e.data.file):e.requireFormData?(o=new window.FormData,p.iter(e.data,function(e,t){o.append(t,e)},this),i.send(o)):"json"===e.contentType?(e.sendContentType&&i.setRequestHeader("Content-Type","application/json;charset=UTF-8"),i.send(JSON.stringify(e.data))):"xml"===e.contentType?(i.overrideMimeType("application/xml"),i.send(JSON.stringify(e.data))):(e.sendContentType&&i.setRequestHeader("Content-type","application/x-www-form-urlencoded"),i.send(c.encodeUriParams(e.data,undefined,!0))):i.send(),s}};return u.register(t,10),t}),e.define("module:Apps",["base:Time","base:Async","base:Promise","module:Info","module:Loader"],function(i,o,r,s,e){return{STATE_INCOMPATIBLE_DEVICE:1,STATE_APP_LAUNCHED:2,STATE_APP_INSTALLED_AND_LAUNCHED:3,STATE_APP_NOT_INSTALLED:4,STATE_UNKNOWN:5,launch:function(e){var t=r.create(),n=i.now();return s.isiOS()&&e.ios?(o.eventually(function(){3e3<i.now()-n?t.asyncSuccess(this.STATE_APP_LAUNCHED):(n=i.now(),o.eventually(function(){3e3<i.now()-n?t.asyncSuccess(this.STATE_APP_INSTALLED_AND_LAUNCHED):t.asyncError(this.STATE_APP_NOT_INSTALLED)},this,2500),document.location=e.ios.install)},this,2500),document.location=e.ios.launch):t.asyncError(this.STATE_INCOMPATIBLE_DEVICE),t},appStoreLink:function(e){return"itms://itunes.apple.com/us/app/"+e+"?mt=8&uo=4"},playStoreLink:function(e){return"https://play.google.com/store/apps/details?id=<"+e+">"},iOSAppURL:function(e,t){return e+"://"+t},androidAppUrl:function(e,t){return e+"://"+t},googleIntent:function(e,t,n){return"intent://"+t+";scheme="+e+";package="+n+";end"}}}),e.define("module:Blobs",["base:Promise"],function(o){return{createBlobByArrayBufferView:function(e,t,n,i){try{return new window.Blob([new DataView(e,t,n)],{type:i})}catch(r){try{return new window.Blob([new Uint8Array(e,t,n)],{type:i})}catch(s){var o=new(window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder);return o.append(e.slice(t,t+n)),o.getBlob(i)}}},loadFileIntoArrayBuffer:function(e){var t=o.create();try{var n=new FileReader;n.onloadend=function(e){t.asyncSuccess(e.target.result)},n.readAsArrayBuffer(e.files?e.files[0]:e)}catch(i){t.asyncError(i)}return t},loadFileIntoString:function(e){var t=o.create();try{var n=new FileReader;n.onloadend=function(e){t.asyncSuccess(e.target.result)},n.readAsText(e.files?e.files[0]:e)}catch(i){t.asyncError(i)}return t}}}),e.define("module:Canvas",["base:Maths"],function(s){return{isCanvasBlack:function(e){if(!e)throw Error("Missing canvas");var t=e.getContext("2d").getImageData(0,0,e.width,e.height).data;if(t){var n=0,i=0;if(e.width*e.height*3/4<1e4)return(n=t.reduce(function(e,t,n){return n&&(n+1)%4!=0&&(e+=t,i++),e}))/i<10;for(var i=1e4,o=0;o<1e4;o++){for(var r=s.randomInt(0,t.length);r&&(r+1)%4==0;)r=s.randomInt(0,t.length);n+=t[r]}return n/i<10}},isImageBlack:function(e){var t;if(e)return(t=document.createElement("canvas")).width=e.width,t.height=e.height,t.getContext("2d").drawImage(e,0,0,t.width,t.height),this.isCanvasBlack(t);throw Error("Missing image")}}}),e.define("module:Cookies",["base:Net.Cookies"],function(a){return{get:function(e){return a.getCookielikeValue(document.cookie,e)},set:function(e,t,n,i,o,r,s){document.cookie=a.createCookielikeValue(e,t,n,i,o,r,s)},remove:function(e,t,n,i){document.cookie=a.removeCookielikeValue(e,t,n,i)},has:function(e){return a.hasCookielikeValue(document.cookie,e)},keys:function(){return a.keysCookielike(document.cookie)}}}),e.define("module:Events",["base:Class","base:Objs","base:Functions","module:Dom"],function(e,t,s,a,n){return e.extend({scoped:n},function(e){return{constructor:function(){e.constructor.call(this),this.__callbacks={}},destroy:function(){this.clear(),e.destroy.call(this)},on:function(n,e,i,o,r){return e.split(" ").forEach(function(e){var t;e&&(t=s.as_method(i,o||n),n.addEventListener(e,t,!(!r||!a.passiveEventsSupported())&&r),this.__callbacks[e]=this.__callbacks[e]||[],this.__callbacks[e].push({element:n,callback_function:t,callback:i,context:o}))},this),this},off:function(o,e,r,s){return e.split(" ").forEach(function(e){if(e){var t=this.__callbacks[e];if(t)for(var n=0;n<t.length;){var i=t[n];o&&o!==i.element||r&&r!==i.callback||s&&s!==i.context?++n:(i.element.removeEventListener(e,i.callback_function,!1),t[n]=t[t.length-1],t.pop())}}},this),this},clear:function(){t.iter(this.__callbacks,function(e,t){e.forEach(function(e){e.element.removeEventListener(t,e.callback_function,!1)})}),this.__callbacks={}}}})}),e.define("module:FlashDetect",["base:Class"],function(e,t){return e.extend({scoped:t},function(s){return{constructor:function(){if(s.constructor.call(this),this.__version=null,navigator.plugins&&0<navigator.plugins.length){var e="application/x-shockwave-flash",t=navigator.mimeTypes;t&&t[e]&&t[e].enabledPlugin&&t[e].enabledPlugin.description&&(this.__version=this.parseVersion(t[e].enabledPlugin.description))}else if(-1==navigator.appVersion.indexOf("Mac")&&"execScript"in window)for(var n=0;n<this.__activeXDetectRules.length;n++)try{var i=new ActiveXObject(this.__activeXDetectRules[n].name),o=this.__activeXDetectRules[n].version(i);if(o){this.__version=this.parseActiveXVersion(o);break}}catch(r){}},parseVersion:function(e){var t=e.split(/ +/),n=t[2].split(/\./),t=t[3];return{raw:e,major:parseInt(n[0],10),minor:parseInt(n[1],10),revisionStr:t,revision:parseInt(t.replace(/[a-zA-Z]/g,""),10)}},parseActiveXVersion:function(e){var t=e.split(",");return{raw:e,major:parseInt(t[0].split(" ")[1],10),minor:parseInt(t[1],10),revision:parseInt(t[2],10),revisionStr:t[2]}},version:function(){return this.__version},installed:function(){return null!==this.__version},supported:function(){var e=navigator.userAgent;return this.installed()||!(-1!=e.indexOf("iPhone")||-1!=e.indexOf("iPod")||-1!=e.indexOf("iPad"))},majorAtLeast:function(e){return this.installed()&&this.version().major>=e},minorAtLeast:function(e){return this.installed()&&this.version().minor>=e},revisionAtLeast:function(e){return this.installed()&&this.version().revision>=e},versionAtLeast:function(e){if(!this.installed())return!1;for(var t=[this.version().major,this.version().minor,this.version().revision],n=Math.min(t.length,arguments.length),i=0;i<n;i++)if(t[i]!=arguments[i])return arguments[i]<t[i];return!0},__activeXDetectRules:[{name:"ShockwaveFlash.ShockwaveFlash.7",version:function(e){try{return e.GetVariable("$version")}catch(t){return null}}},{name:"ShockwaveFlash.ShockwaveFlash.6",version:function(e){try{e.AllowScriptAccess="always";try{return e.GetVariable("$version")}catch(t){return null}}catch(t){return"6,0,21"}}},{name:"ShockwaveFlash.ShockwaveFlash",version:function(e){try{return e.GetVariable("$version")}catch(t){return null}}}]}})}),e.define("module:FlashHelper",["base:Time","base:Objs","base:Types","base:Net.Uri","base:Ids","module:Info","module:Dom"],function(r,s,a,u,c,o,l){return{getFlashObject:function(e){var t=(e=l.unbox(e)).getElementsByTagName("EMBED")[0];if(!(t=(t=o.isInternetExplorer()&&o.internetExplorerVersion()<=10?null:t)||e.getElementsByTagName("OBJECT")[0]))for(var n=document.getElementsByTagName("OBJECT"),i=0;i<n.length;++i)e.contains(n[i])&&(t=n[i]);return t},embedTemplate:function(e){e=e||{};var t=[],n=(t.push({objectKey:"classid",value:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"}),t.push({objectKey:"codebase",value:"https://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab"}),t.push({embedKey:"align",value:"middle"}),t.push({embedKey:"play",value:"true"}),t.push({embedKey:"loop",value:"false"}),t.push({embedKey:"type",value:"application/x-shockwave-flash"}),t.push({embedKey:"pluginspage",value:"https://get.adobe.com/flashplayer"}),t.push({objectParam:"quality",embedKey:"quality",value:"high"}),t.push({objectParam:"allowScriptAccess",embedKey:"allowScriptAccess",value:"always"}),t.push({objectParam:"wmode",embedKey:"wmode",value:"opaque"}),t.push({objectParam:"movie",embedKey:"src",value:e.flashFile+(e.forceReload?"?"+r.now():"")}),e.width&&t.push({objectKey:"width",embedKey:"width",value:e.width}),e.height&&t.push({objectKey:"height",embedKey:"height",value:e.height}),e.bgcolor&&t.push({objectParam:"bgcolor",embedKey:"bgcolor",value:e.bgcolor}),e.FlashVars&&t.push({objectParam:"FlashVars",embedKey:"FlashVars",value:a.is_object(e.FlashVars)?u.encodeUriParams(e.FlashVars):e.FlashVars}),t.push({objectKey:"id",value:e.objectId||c.uniqueId("flash")}),[]),i=[],o=[];return s.iter(t,function(e){e.objectKey&&n.push(e.objectKey+'="'+e.value+'"'),e.embedKey&&o.push(e.embedKey+'="'+e.value+'"'),e.objectParam&&i.push('<param name="'+e.objectParam+'" value="'+e.value+'" />')},this),"<object "+n.join(" ")+">"+i.join(" ")+"<embed "+o.join(" ")+"></embed></object>"},embedFlashObject:function(e,t){if(e=l.unbox(e),(t=t||{}).parentBgcolor)try{var n,i,o=e.style.backgroundColor||"";0<=o.indexOf("rgb")&&(n=o.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/),i=function(e){return("0"+parseInt(e,10).toString(16)).slice(-2)},n)&&3<n.length&&(o="#"+i(n[1])+i(n[2])+i(n[3])),t.bgcolor=o}catch(s){}if(t.fixHalfPixels)try{var r=l.elementOffset(e);r.top%1!=0&&(e.style.marginTop=Math.round(r.top)-r.top+"px"),r.left%1!=0&&(e.style.marginLeft=Math.round(r.left)-r.left+"px")}catch(s){}return e.innerHTML=this.embedTemplate(t),this.getFlashObject(e)}}}),e.define("module:Hotkeys",["base:Objs"],function(c){return{SHIFT_NUMS:{"`":"~",1:"!",2:"@",3:"#",4:"$",5:"%",6:"^",7:"&",8:"*",9:"(",0:")","-":"_","=":"+",";":":","'":'"',",":"<",".":">","/":"?","\\":"|"},SPECIAL_KEYS:{esc:27,escape:27,tab:9,space:32,"return":13,enter:13,backspace:8,scrolllock:145,scroll_lock:145,scroll:145,capslock:20,caps_lock:20,caps:20,numlock:144,num_lock:144,num:144,pause:19,"break":19,insert:45,home:36,"delete":46,end:35,pageup:33,page_up:33,pu:33,pagedown:34,page_down:34,pd:34,left:37,up:38,right:39,down:40,f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123},MODIFIERS:["ctrl","alt","shift","meta"],keyCodeToCharacter:function(e){return 188==e?",":190==e?".":String.fromCharCode(e).toLowerCase()},handleKeyEvent:function(e,t,n){n=c.extend({disable_in_input:!1,keycode:!1},n);var i=e.toLowerCase().split("+");if(n.disable_in_input){var o=t.target||t.srcElement||null;if((o=o&&3==o.nodeType?o.parentNode:o)&&("INPUT"==o.tagName||"TEXTAREA"==o.tagName))return!1}var r=t.keyCode||t.which||0,s=this.keyCodeToCharacter(r),a=0,u={},o=(c.iter(this.MODIFIERS,function(e){u[e]={pressed:t[e+"Key"],wanted:!1}},this),c.iter(i,function(e){e in u?(u[e].wanted=!0,a++):1<e.length?this.SPECIAL_KEYS[e]==r&&a++:n.keycode?n.keycode==r&&a++:(s==e||t.shiftKey&&this.SHIFT_NUMS[s]==e)&&a++},this),e.toLowerCase().split("^"));return 1<o.length&&c.iter(o,function(e){1<e.length&&t.keyCode===this.SPECIAL_KEYS[e]&&(32===r&&t.preventDefault(),this.SPECIAL_KEYS[e]==r)&&a++},this),a==i.length&&c.all(u,function(e){return e.wanted==e.pressed})},register:function(t,n,i,o){o=c.extend({type:"keyup",propagate:!1,disable_in_input:!1,target:document,keycode:!1},o);var r=this,e=function(e){r.handleKeyEvent(t,e,o)&&(o.propagate||(e.preventDefault(),e.stopPropagation()),n.call(i||this,e))};return o.target.addEventListener(o.type,e,!1),{target:o.target,type:o.type,func:e}},unregister:function(e){e.target.removeEventListener(e.type,e.func,!1)}}}),e.define("module:Info",["base:Objs","module:FlashDetect"],function(i,t){return{__navigator:null,getNavigator:function(){return this.__navigator||(this.__navigator={appCodeName:navigator.appCodeName,appName:navigator.appName,appVersion:navigator.appVersion,cookieEnabled:navigator.cookieEnabled,onLine:navigator.onLine,platform:navigator.platform,userAgent:navigator.userAgent,window_chrome:"undefined"!=typeof window&&"chrome"in window,window_opera:"undefined"!=typeof window&&"opera"in window,language:navigator.language||navigator.userLanguage||"",isTouchable:this.isTouchable()}),this.__navigator},__cache:{},__cached:function(e,t,n){return e in this.__cache&&!n||(n=this.getNavigator(),this.__cache[e]=t.call(this,n,n.userAgent,n.userAgent.toLowerCase())),this.__cache[e]},setNavigator:function(e){this.__navigator=e,this.__cache={}},language:function(){return this.__cached("language",function(e){return e.language})},flash:function(e){return this.__cached("flash",function(){return new t},e)},isiOS:function(){return this.__cached("isiOS",function(e,t){var n;return!this.isInternetExplorer()&&!this.isIEMobile()&&(t=[t],e.platform&&t.push(e.platform),n=["iPhone","iPod","iPad"],t.some(function(t){return n.some(function(e){return-1!=t.indexOf(e)})})||e.platform&&"MacIntel"===e.platform&&e.isTouchable)})},isEdge:function(){return this.__cached("isEdge",function(e,t){return-1!=t.indexOf("Edge")})},isCordova:function(){return"undefined"!=typeof window&&(!!window.cordova||!!window._cordovaNative)||0===document.location.href.indexOf("file:///android_asset/www")||0===document.location.href.indexOf("file:///var/mobile/Containers/Bundle/Application")},isLocalCordova:function(){return this.__cached("isLocalCordova",function(){return this.isCordova()&&0!==document.location.href.indexOf("http")})},isChrome:function(){return this.__cached("isChrome",function(e,t){return(e.window_chrome||-1!=t.indexOf("CriOS"))&&!this.isOpera()&&!this.isEdge()})},isChromium:function(){return this.__cached("isChromium",function(e,t,n){return!this.isChrome()&&this.isAndroid()&&0<=n.indexOf("linux")})},isChromiumBased:function(){return this.__cached("isChromiumBased",function(){return this.isChrome()||this.isChromium()})},isOpera:function(){return this.__cached("isOpera",function(e,t){return e.window_opera||0<=t.indexOf(" OPR/")||0<=t.indexOf("OPiOS")||0<=t.indexOf("Opera")})},isAndroid:function(){return this.__cached("isAndroid",function(e,t,n){return-1!=n.indexOf("android")})},isWebOS:function(){return this.__cached("isWebOS",function(e,t,n){return-1!=n.indexOf("webos")})},isWindowsPhone:function(){return this.__cached("isWindowsPhone",function(e,t,n){return-1!=n.indexOf("windows phone")})},isBlackberry:function(){return this.__cached("isBlackberry",function(e,t,n){return-1!=n.indexOf("blackberry")})},iOSversion:function(){return this.__cached("iOSversion",function(e){return!!this.isiOS()&&(e=e.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),{major:parseInt(e[1],10),minor:parseInt(e[2],10),revision:parseInt(e[3]||0,10)})})},androidVersion:function(){return this.__cached("androidVersion",function(e){return!!this.isAndroid()&&(e=e.userAgent.match(/Android (\d+)\.(\d+)\.?(\d+)?/),{major:parseInt(e[1],10),minor:parseInt(e[2],10),revision:parseInt(e[3]||0,10)})})},isMobile:function(){return this.__cached("isMobile",function(){return this.isiOS()||this.isAndroid()||this.isWebOS()||this.isWindowsPhone()||this.isBlackberry()})},isDesktop:function(){return this.__cached("isDesktop",function(){return!this.isMobile()})},isInternetExplorer:function(){return this.__cached("isInternetExplorer",function(){return!this.isIEMobile()&&null!==this.internetExplorerVersion()})},isIEMobile:function(){return this.__cached("isIEMobile",function(e,t,n){return 0<=n.indexOf("iemobile")})},isFirefox:function(){return this.__cached("isFirefox",function(e,t,n){return-1!=n.indexOf("firefox")||-1!=n.indexOf("fxios")})},isSafari:function(){return this.__cached("isSafari",function(e,t,n){if(!(this.isChrome()||this.isOpera()||this.isEdge()||this.isFirefox()||-1==n.indexOf("safari")||this.isAndroid()))return!0;if(this.isiOS()&&-1!=t.indexOf("Macintosh")&&e.platform){if("iPad"===e.platform)return!0;if(e.isTouchable&&"MacIntel"===e.platform)return!0}return!1})},isWindows:function(){return this.__cached("isWindows",function(e){return-1!=e.appVersion.toLowerCase().indexOf("win")&&!this.isWindowsPhone()})},isMacOS:function(){return this.__cached("isMacOS",function(e){return!this.isiOS()&&-1!=e.appVersion.toLowerCase().indexOf("mac")})},isUnix:function(){return this.__cached("isUnix",function(e){return-1!=e.appVersion.toLowerCase().indexOf("x11")})},isLinux:function(){return this.__cached("isLinux",function(e){return!this.isAndroid()&&-1!=e.appVersion.toLowerCase().indexOf("linux")})},isTouchable:function(){return"undefined"!=typeof window&&"ontouchstart"in window||0<navigator.maxTouchPoints||0<navigator.msMaxTouchPoints},isScreenRecorderSupported:function(){return!("undefined"==typeof navigator.mediaDevices||!(this.isChrome()||this.isFirefox()||this.isOpera()||this.isEdge())||this.isMobile()||"undefined"==typeof navigator.mediaDevices.getDisplayMedia)},internetExplorerVersion:function(){return this.__cached("internetExplorerVersion",function(e,t){if("Microsoft Internet Explorer"==e.appName){t=new RegExp("MSIE ([0-9]+)").exec(t);if(t)return t[1]}else if("Netscape"==e.appName){t=new RegExp("Trident/.*rv:([0-9]+)").exec(e.userAgent);if(t)return parseFloat(t[1])}return null})},chromeVersion:function(){return this.__cached("chromeVersion",function(e,t){t=/(Chrome|CriOS)\/(\d+\.\d+)[^\d]/gi.exec(t);return t?parseFloat(t[2]):null})},operaVersion:function(){return this.__cached("operaVersion",function(e,t){t=/OPR\/(\d+\.\d+)[^\d]/gi.exec(t);return t?parseFloat(t[1]):null})},safariVersion:function(){return this.__cached("safariVersion",function(e,t){t=/Version\/(\d+\.\d+)[^\d]/gi.exec(t);return t?parseFloat(t[1]):null})},firefoxVersion:function(){return this.__cached("firefoxVersion",function(e,t){t=/Firefox\/(\d+\.\d+)/gi.exec(t);return t?parseFloat(t[1]):null})},edgeVersion:function(){return this.__cached("edgeVersion",function(e,t){t=/Edg\/(\d+\.\d+)|Edge\/(\d+\.\d+)/gi.exec(t);return t?parseFloat(t[1]):null})},inIframe:function(){try{return"undefined"!=typeof window&&window.self!==window.top}catch(e){return!0}},__devicesMap:{mobile:{format:"Mobile",check:function(){return this.isMobile()}},desktop:{format:"Desktop",check:function(){return this.isDesktop()}}},__obtainMatch:function(e,t){var n=null;return i.iter(e,function(e,t){if(e.check.apply(this)){if(n)return n=null,!1;delete(n=i.clone(e,1)).check,n.key=t}},this),n||t},getDevice:function(){return this.__cached("getDevice",function(){return this.__obtainMatch(this.__devicesMap,{key:"unknown",format:"Unknown Device"})})},formatDevice:function(){return this.getDevice().format},__osMap:{macosx:{format:"Mac OS-X",check:function(){return this.isMacOS()}},windows:{format:"Windows",check:function(){return this.isWindows()}},unix:{format:"Unix",check:function(){return this.isUnix()}},linux:{format:"Linux",check:function(){return this.isLinux()}},ios:{format:"iOS",check:function(){return this.isiOS()},version:function(){return this.iOSversion().major+"."+this.iOSversion().minor+"."+this.iOSversion().revision}},android:{format:"Android",check:function(){return this.isAndroid()}},webos:{format:"WebOS",check:function(){return this.isWebOS()}},windowsphone:{format:"Windows Phone",check:function(){return this.isWindowsPhone()}},blackberry:{format:"Blackberry",check:function(){return this.isBlackberry()}}},getOS:function(){return this.__cached("getOS",function(){return this.__obtainMatch(this.__osMap,{key:"unknown",format:"Unknown Operating System"})})},formatOS:function(){return this.getOS().format},formatOSVersion:function(){return this.getOS().version?this.getOS().version.apply(this):""},__browserMap:{chrome:{format:"Chrome",check:function(){return this.isChrome()},version:function(){return this.chromeVersion()}},chromium:{format:"Chromium",check:function(){return this.isChromium()}},opera:{format:"Opera",check:function(){return this.isOpera()},version:function(){return this.operaVersion()}},internetexplorer:{format:"Internet Explorer",check:function(){return this.isInternetExplorer()},version:function(){return this.internetExplorerVersion()}},firefox:{format:"Firefox",check:function(){return this.isFirefox()},version:function(){return this.firefoxVersion()}},safari:{format:"Safari",check:function(){return this.isSafari()},version:function(){return this.safariVersion()}},webos:{format:"WebOS",check:function(){return this.isWebOS()}},blackberry:{format:"Blackberry",check:function(){return this.isBlackberry()}},edge:{format:"Edge",check:function(){return this.isEdge()}},iemobile:{format:"IE Mobile",check:function(){return this.isIEMobile()}}},getBrowser:function(){return this.__cached("getBrowser",function(){return this.__obtainMatch(this.__browserMap,{key:"unknown",format:"Unknown Browser"})})},formatBrowser:function(){return this.getBrowser().format},formatBrowserVersion:function(){return this.getBrowser().version?this.getBrowser().version.apply(this):""},formatFlash:function(){return this.flash().installed()?"Flash "+this.flash().version().raw:this.flash().supported()?"Flash not installed but supported":"Flash not supported"}}}),e.define("module:Loader",["base:Ajax.Support","module:Info"],function(i,o){return{loadScript:function(e,t,n){var i=!1,o=document.getElementsByTagName("head")[0],r=document.createElement("script");r.src=e,r.onload=r.onreadystatechange=function(){i||this.readyState&&"loaded"!=this.readyState&&"complete"!=this.readyState||(i=!0,r.onload=r.onreadystatechange=null,t&&t.call(n||this,e))},o.appendChild(r)},loadStyles:function(e,t,n){var i=!1,o=document.getElementsByTagName("head")[0],r=document.createElement("link");r.rel="stylesheet",r.href=e,r.onload=r.onreadystatechange=function(){i||this.readyState&&"loaded"!=this.readyState&&"complete"!=this.readyState||(i=!0,r.onload=r.onreadystatechange=null,t&&t.call(n||this,e))},o.appendChild(r)},inlineStyles:function(e){var t=document.getElementsByTagName("head")[0],n=document.createElement("style");return o.isInternetExplorer()&&o.internetExplorerVersion()<9?(n.setAttribute("type","text/css"),n.styleSheet.cssText=e):n.textContent=e,t.appendChild(n),n},loadHtml:function(t,n,e){i.execute({uri:t,decodeType:"html"}).success(function(e){n.call(this,e,t)},e)},findScript:function(e){for(var t=0;t<document.scripts.length;++t)if(0<=document.scripts[t].src.toLowerCase().indexOf(e.toLowerCase()))return document.scripts[t];return null},loadByIframe:function(i,o,r){var s=document.createElement("iframe"),e=(i.visible?(s.style.border="none",s.style.width="1px",s.style.height="1px"):s.style.display="none",function(){var e=null,t=null;try{t=(e=s.contentDocument.body).textContent||e.innerText}catch(n){}o.call(r||this,t,e,s),i.remove&&document.body.removeChild(s)});s.attachEvent?s.attachEvent("onload",e):s.onload=e,s.src=i.url,document.body.appendChild(s)}}}),e.define("module:HashRouteBinder",["base:Router.RouteBinder","module:Events"],function(e,n,t){return e.extend({scoped:t},function(t){return{constructor:function(e){t.constructor.call(this,e),this.auto_destroy(new n).on(window,"hashchange",function(){this._localRouteChanged()},this)},_getLocalRoute:function(){var e=window.location.hash;return e.length&&"#"==e[0]?e.slice(1):e},_setLocalRoute:function(e){window.location.hash="#"+e.route}}})}),e.define("module:HistoryRouteBinder",["base:Router.RouteBinder","module:Events"],function(e,n,t){return e.extend({scoped:t},function(t){return{__used:!1,constructor:function(e){t.constructor.call(this,e),this.auto_destroy(new n).on(window,"hashchange",function(){this.__used&&this._localRouteChanged()},this)},_getLocalRoute:function(){return window.location.pathname},_setLocalRoute:function(e){window.history.pushState({},document.title,e.route),this.__used=!0}}},{supported:function(){return window.history&&window.history.pushState}})}),e.define("module:LocationRouteBinder",["base:Router.RouteBinder"],function(e,t){return e.extend({scoped:t},{_getLocalRoute:function(){return window.location.pathname},_setLocalRoute:function(e){window.location.pathname=e.route}})}),e.define("module:DomExtend.DomExtension",["base:Class","base:Objs","base:Functions","base:Async","module:Dom","module:DomMutation.NodeRemoveObserver","module:DomMutation.NodeResizeObserver"],function(e,i,o,r,s,a,u,t){return e.extend({scoped:t},function(n){return{_domMethods:[],_domAttrs:{},constructor:function(e,t){n.constructor.call(this),this._element=s.unbox(e),(this._element.domExtension=this)._actualBB=null,this._idealBB=null,this._attrs=t||{},i.iter(this._domMethods,function(e){this._element[e]=o.as_method(this[e],this)},this),i.iter(["get","set"],function(e){this._element[e]=o.as_method(this[e],this)},this),r.eventually(function(){this._nodeRemoveObserver=this.auto_destroy(new a(this._element)),this._nodeRemoveObserver.on("node-removed",this.weakDestroy,this),this._nodeResizeObserver=this.auto_destroy(new u(this._element)),this._nodeResizeObserver.on("node-resized",function(){this.recomputeBB(),this._notify("resized")},this)},this),this._element.style.display&&"inline"!=this._element.style.display||(this._element.style.display="inline-block")},domEvent:function(e){s.triggerDomEvent(this._element,e)},readAttr:function(e){return e in this._element.attributes?this._element.attributes[e].value:(e in this._element?this._element:this._attrs)[e]},hasAttr:function(e){return e in this._element.attributes||e in this._element||e in this._attrs},writeAttr:function(e,t){e in this._element.attributes?this._element.attributes[e].value=t:e in this._element?this._element[e]=t:this._attrs[e]=t},unsetAttr:function(e){delete this._element[e],this._element.removeAttribute(e),delete this._attrs[e]},get:function(e){var t=this._domAttrs[e]||{};return t.get?(t=o.callWithin(this,t.get),this.writeAttr(e,t),t):this.readAttr(e)},set:function(e,t){this.writeAttr(e,t);e=this._domAttrs[e]||{};e.set&&o.callWithin(this,e.set,t)},computeActualBB:function(e){if((t=s.elementDimensions(this._element).width)<e.width&&!this._element.style.width){this._element.style.width=e.width+"px";for(var t=s.elementDimensions(this._element).width,n=this._element;n!=document.body;)n=n.parentNode,t=Math.min(t,s.elementDimensions(n).width);this._element.style.width=null}return{width:t,height:t*e.height/e.width}},idealBB:function(){return null},recomputeBB:function(){var e,t=this.idealBB();t&&(e=this.computeActualBB(t),this._idealBB=t,this._actualBB=e,this.setActualBB(e))},setActualBB:function(e){}}})}),e.define("module:DomMutation.NodeRemoveObserver",["base:Classes.ConditionalInstance","base:Events.EventsMixin"],function(e,t,n){return e.extend({scoped:n},[t,function(t){return{constructor:function(e){t.constructor.call(this),this._node=e},_nodeRemoved:function(e){e===this._node&&this.trigger("node-removed")}}}])}),e.define("module:DomMutation.MutationObserverNodeRemoveObserver",["module:DomMutation.NodeRemoveObserver","base:Objs"],function(e,i,t){return e.extend({scoped:t},function(t){return{constructor:function(e){t.constructor.call(this,e);var n=this;this._observer=new window.MutationObserver(function(e){i.iter(e,function(e){for(var t=0;t<e.removedNodes.length;++t)n._nodeRemoved(e.removedNodes[t])})}),this._observer.observe(e.parentNode,{childList:!0})},destroy:function(){this._observer.disconnect(),t.destroy.call(this)}}},{supported:function(e){try{return!!window.MutationObserver}catch(t){return!1}}})}),e.define("module:DomMutation.DOMNodeRemovedNodeRemoveObserver",["module:DomMutation.NodeRemoveObserver","module:Info","module:Events"],function(e,t,n,i){return e.extend({scoped:i},function(t){return{constructor:function(e){t.constructor.call(this,e),this.auto_destroy(new n).on(document,"DOMNodeRemoved",function(e){this._nodeRemoved(e.target)},this)}}},{supported:function(e){return!t.isInternetExplorer()||9<=t.internetExplorerVersion()}})}),e.define("module:DomMutation.TimerNodeRemoveObserver",["module:DomMutation.NodeRemoveObserver","base:Timers.Timer"],function(e,n,t){return e.extend({scoped:t},function(t){return{constructor:function(e){t.constructor.call(this,e),this._timer=new n({context:this,fire:this._fire,delay:100})},destroy:function(){this._timer.weakDestroy(),t.destroy.call(this)},_fire:function(){this._node.parentElement||(this._timer.stop(),this._nodeRemoved(this._node))}}},{supported:function(e){return!0}})}),e.extend("module:DomMutation.NodeRemoveObserver",["module:DomMutation.NodeRemoveObserver","module:DomMutation.MutationObserverNodeRemoveObserver","module:DomMutation.DOMNodeRemovedNodeRemoveObserver","module:DomMutation.TimerNodeRemoveObserver"],function(e,t,n,i){return e.register(t,3),e.register(n,2),e.register(i,1),{}}),e.define("module:DomMutation.NodeResizeObserver",["base:Class","base:Events.EventsMixin","module:Events"],function(e,t,n,i){return e.extend({scoped:i},[t,function(t){return{constructor:function(e){t.constructor.call(this),this.auto_destroy(new n).on(window,"resize",function(e){this._resized()},this)},_resized:function(){this.trigger("node-resized")}}}])}),e.define("module:DomMutation.NodeInsertObserver",["base:Classes.ConditionalInstance","base:Events.EventsMixin"],function(e,t,n){return e.extend({scoped:n},[t,function(e){return{_nodeInserted:function(e,t){if(t)for(var n=0;n<e.childNodes.length;++n)this._nodeInserted(e.childNodes[n],t);this._options.parent&&e.parentNode!==this._options.parent||this._options.root&&!this._options.root.contains(e)||this._options.filter&&!this._options.filter.call(this._options.context||this,e)||this.trigger("node-inserted",e)}}}])}),e.define("module:DomMutation.MutationObserverNodeInsertObserver",["module:DomMutation.NodeInsertObserver","base:Objs"],function(e,i,t){return e.extend({scoped:t},function(t){return{constructor:function(e){t.constructor.call(this,e=e||{});var n=this;this._observer=new window.MutationObserver(function(e){i.iter(e,function(e){for(var t=0;t<e.addedNodes.length;++t)n._nodeInserted(e.addedNodes[t],!0)})}),this._observer.observe(this._options.root||this._options.parent||document.body,{childList:!0,subtree:!this._options.parent})},destroy:function(){this._observer.disconnect(),t.destroy.call(this)}}},{supported:function(e){try{return!!window.MutationObserver}catch(t){return!1}}})}),e.define("module:DomMutation.DOMNodeInsertedNodeInsertObserver",["module:DomMutation.NodeInsertObserver","module:Events"],function(e,n,t){return e.extend({scoped:t},function(t){return{constructor:function(e){t.constructor.call(this,e=e||{}),this.auto_destroy(new n).on(document,"DOMNodeInserted",function(e){this._nodeInserted(e.target,!0)},this)}}},{supported:function(e){return!0}})}),e.extend("module:DomMutation.NodeInsertObserver",["module:DomMutation.NodeInsertObserver","module:DomMutation.MutationObserverNodeInsertObserver","module:DomMutation.DOMNodeInsertedNodeInsertObserver"],function(e,t,n){return e.register(t,3),e.register(n,2),{}}),e.define("module:Dom",["base:Types","base:Objs","module:Info","base:Async"],function(a,c,u,r){var l={tr:["table","tbody"],td:["table","tbody","tr"],th:["table","thead","tr"]},n=["click","mousedown","mouseup","touchstart","touchend","keydown","keyup","keypress"],i=[],o=!1,s=function(){i.forEach(function(e){e.callback.call(e.context||this)}),o=!(i=[]),n.forEach(function(e){window.removeEventListener(e,s)})},d={ready:function(e,t){var n,i,o;"complete"===document.readyState||"loading"!==document.readyState&&!document.documentElement.doScroll?r.eventually(e,t):(n=!1,i=null,o=function(){clearInterval(i),document.removeEventListener("DOMContentLoaded",o),window.removeEventListener("load",o),n||(n=!0,e.apply(t||this))},document.addEventListener("DOMContentLoaded",o),window.addEventListener("load",o),i=setInterval(function(){"complete"!==document.readyState&&("loading"===document.readyState||document.documentElement.doScroll)||o()},10))},userInteraction:function(e,t){i.push({callback:e,context:t}),o||(o=!0,n.forEach(function(e){window.addEventListener(e,s)}))},isTabHidden:function(){return document.hidden||document.webkitHidden||document.mozHidden||document.msHidden},elementsByTemplate:function(n){n=n.trim();for(var i=u.isInternetExplorer()&&u.internetExplorerVersion()<9,o=[],e=(c.iter(l,function(e,t){0===n.indexOf("<"+t)&&(o=e,i=!1)}),[o.map(function(e){return"<"+e+">"}).join(""),i?"<br/>":"",n,o.map(function(e){return"</"+e+">"}).join("")].join("")),t=document.createElement("div"),r=(t.innerHTML=e,o.forEach(function(){t=t.children[0]}),[]),s=i?1:0;s<t.children.length;++s)r.push(t.children[s]);return r=i?r.filter(function(e){return!(0===e.tagName.indexOf("/")&&0<=n.toLowerCase().indexOf("<"+e.tagName.toLowerCase()))}):r},elementByTemplate:function(e,t){e=this.elementsByTemplate(e);return 1===e.length?e[0]:0!==e.length&&t?(t=document.createElement("div"),e.forEach(t.appendChild,t),t):null},changeTag:function(e,t){for(var n=document.createElement(t),i=0;i<e.attributes.length;++i){var o=e.attributes[i];n.setAttribute(o.nodeName,"value"in o?o.value:o.nodeValue)}for(;e.firstChild;)n.appendChild(e.firstChild);return e.parentNode&&e.parentNode.replaceChild(n,e),n},traverseNext:function(e,t){return(e=this.unbox(e)).firstChild&&!t?e.firstChild:e.parentNode?e.nextSibling||this.traverseNext(e.parentNode,!0):null},splitNode:function(e,t,n){return t=t||0,(n=n||(e.wholeText?e.wholeText.length:0))<(e.wholeText?e.wholeText.length:0)&&e.splitText(n),e=0<t?e.splitText(t):e},__FULLSCREEN_EVENTS:["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],__FULLSCREEN_METHODS:["requestFullscreen","webkitRequestFullscreen","mozRequestFullScreen","msRequestFullscreen","webkitEnterFullScreen"],__FULLSCREEN_ATTRS:["fullscreenElement","webkitFullscreenElement","mozFullScreenElement","msFullscreenElement"],__FULLSCREEN_EXIT_METHODS:["exitFullscreen","mozCancelFullScreen","webkitExitFullscreen","msExitFullscreen"],elementSupportsFullscreen:function(t){return t&&this.__FULLSCREEN_METHODS.some(function(e){return e in t})},elementEnterFullscreen:function(t){var n=!1;this.__FULLSCREEN_METHODS.forEach(function(e){!n&&e in t&&(t[e].call(t),n=!0)})},documentExitFullscreen:function(){this.__FULLSCREEN_EXIT_METHODS.forEach(function(e){document[e]&&document[e]()})},elementIsFullscreen:function(t){return this.__FULLSCREEN_ATTRS.some(function(e){return document[e]===t})},elementOnFullscreenChange:function(t,e,n){var i=this,o=function(){e.call(n||this,t,i.elementIsFullscreen(t))};return this.__FULLSCREEN_EVENTS.forEach(function(e){t.addEventListener(e,o,!1)}),o},elementOffFullscreenChange:function(t,n){this.__FULLSCREEN_EVENTS.forEach(function(e){t.removeEventListener(e,n,!1)})},__PIP_EVENTS:["enterpictureinpicture","leavepictureinpicture"],browserSupportsPIP:function(e){return e=e||HTMLVideoElement.prototype||{},"pictureInPictureEnabled"in document||!!(u.isMacOS()&&9<=u.safariVersion())&&!(!e.webkitSupportsPresentationMode||"function"!=typeof e.webkitSetPresentationMode)},videoElementEnterPIPMode:function(e){if(e&&e instanceof HTMLVideoElement){if(e=e||HTMLVideoElement.prototype||{},"pictureInPictureElement"in document&&!document.pictureInPictureElement&&"function"==typeof e.requestPictureInPicture)try{e.requestPictureInPicture()}catch(t){console.warn(t)}u.isMacOS()&&9<=u.safariVersion()&&"function"==typeof e.webkitSetPresentationMode&&e.webkitSetPresentationMode("picture-in-picture")}},videoElementExitPIPMode:function(e){if(e=e||HTMLVideoElement.prototype||{},"pictureInPictureElement"in document&&document.pictureInPictureElement&&"function"==typeof document.exitPictureInPicture)try{document.exitPictureInPicture()}catch(t){console.warn(t)}u.isMacOS()&&9<=u.safariVersion()&&"function"==typeof e.webkitSetPresentationMode&&e.webkitSetPresentationMode("inline")},videoIsInPIPMode:function(e){return"pictureInPictureElement"in document?!!document.pictureInPictureElement:u.isMacOS()&&9<=u.safariVersion()?"picture-in-picture"===e.webkitPresentationMode:void 0},videoAddPIPChangeListeners:function(t,e,n){var i,o;return t&&t instanceof HTMLVideoElement?(o=function(){e.call(n||this,t,i.videoIsInPIPMode(t))},(i=this).__PIP_EVENTS.forEach(function(e){t.addEventListener(e,o,!1)}),o):null},videoRemovePIPChangeListeners:function(t){if(!(t&&t instanceof HTMLVideoElement))return null;this.__PIP_EVENTS.forEach(function(e){t.removeEventListener(e,t)})},entitiesToUnicode:function(e){return!e||!a.is_string(e)||e.indexOf("&")<0?e:e.split(">").map(function(e){return e.split("<").map(function(e){var t=document.createElement("span");return t.innerHTML=e,e=t.textContent||t.innerText,t.remove&&t.remove(),e}).join("<")}).join(">")},unbox:function(e){return!(e=a.is_string(e)?document.querySelector(e):e)||e.nodeType?e:e.get(0)},triggerDomEvent:function(e,t,n,i){e=this.unbox(e);var o,r="on"+(t=t.toLowerCase()),s=null,a=!1;e[r]&&(s=e[r],e[r]=function(){a||(a=!0,s.apply(this,arguments))});try{try{o=i?new CustomEvent(t,i):new Event(t)}catch(u){try{i?(o=document.createEvent("CustomEvent")).initCustomEvent(t,i.bubbles||!1,i.cancelable||!1,i.detail||!1):(o=document.createEvent("Event")).initEvent(t,!1,!1)}catch(u){(o=document.createEventObject()).type=t}}c.extend(o,n),e.dispatchEvent(o),s&&(a||s.call(e,o),e[r]=s)}catch(u){throw s&&(e[r]=s),u}},elementOffset:function(e){var t=0,n=0;return(e=this.unbox(e)).getBoundingClientRect&&(t=(e=e.getBoundingClientRect()).top,n=e.left-(document.body.getBoundingClientRect?document.body.getBoundingClientRect().left:0)),docElem=document.documentElement,{top:t+(window.pageYOffset||docElem.scrollTop)-(docElem.clientTop||0),left:n+(window.pageXOffset||docElem.scrollLeft)-(docElem.clientLeft||0)}},getRelativeCoordinates:function(e,t){for(var n=e.pageX,e=e.pageY,i={left:t.offsetLeft,top:t.offsetTop},o=t.offsetParent;null!=o;)i.left+=o.offsetLeft,i.top+=o.offsetTop,o=o.offsetParent;return{x:n-i.left,y:e-i.top}},elementDimensions:function(e){var t,n,i;if((e=this.unbox(e))&&window.getComputedStyle){try{t=window.getComputedStyle(e)}catch(o){}if(t&&(i=parseInt(t.width,10),n=parseInt(t.height,10),i)&&n)return{width:i,height:n}}return e&&e.currentStyle&&(t=e.currentStyle,i=e.clientWidth-parseInt(t.paddingLeft||0,10)-parseInt(t.paddingRight||0,10),n=e.clientHeight-parseInt(t.paddingTop||0,10)-parseInt(t.paddingTop||0,10),i)&&n?{width:i,height:n}:e&&e.getBoundingClientRect?(n=(t=e.getBoundingClientRect()).bottom-t.top,{width:i=t.right-t.left,height:n}):{width:0,height:0}},childContainingElement:function(e,t){for(e=this.unbox(e),t=this.unbox(t);t.parentNode!=e;){if(t==document.body)return null;t=t.parentNode}return t},elementBoundingBox:function(e){var t=this.elementOffset(e),e=this.elementDimensions(e);return{left:t.left,top:t.top,right:t.left+e.width-1,bottom:t.top+e.height-1}},pointWithinElement:function(e,t,n){n=this.elementBoundingBox(n);return n.left<=e&&e<=n.right&&n.top<=t&&t<=n.bottom},elementFromPoint:function(e,t,n,i){a.is_array(n=n||[])||(n=[n]);for(var o=[],r=0;r<n.length;++r)n[r]=this.unbox(n[r]),o.push(n[r].style.zIndex),n[r].style.zIndex=-1;for(var s=document.elementFromPoint(e-window.pageXOffset,t-window.pageYOffset),r=0;r<n.length;++r)n[r].style.zIndex=o[r];for(;s&&i&&s.parentNode!==i;)s=s.parentNode;return s},elementAddClass:function(e,t){e.className?this.elementHasClass(e,t)||(e.className=e.className+" "+t):e.className=t},elementHasClass:function(e,t){return e.className.split(" ").some(function(e){return e===t})},elementRemoveClass:function(e,t){e.className=e.className.split(" ").filter(function(e){return e!==t}).join(" ")},elementInsertBefore:function(e,t){t.parentNode.insertBefore(e,t)},elementInsertAfter:function(e,t){t.nextSibling?t.parentNode.insertBefore(e,t.nextSibling):t.parentNode.appendChild(e)},elementInsertAt:function(e,t,n){n>=t.children.length?t.appendChild(e):t.insertBefore(e,t.children[Math.max(0,n)])},elementIndex:function(e){for(var t=0;e.previousElementSibling;)t++,e=e.previousElementSibling;return t},elementPrependChild:function(e,t){0<e.children.length?e.insertBefore(t,e.firstChild):e.appendChild(t)},elementFindClosestParent:function(e,t,n){for(var i=null;e;){if(-1<e.className.indexOf(t)){i=e;break}if(n&&-1<e.className.indexOf(n))break;e=e.parentElement}return i},elementReplaceClasses:function(e,t,n){this.elementHasClass(e,t)&&(this.elementRemoveClass(e,t),this.elementAddClass(e,n))},isElementVisible:function(e,t){t=t||.8;var n=this.elementOffset(e),i=n.left,n=n.top,o=e.offsetWidth,e=e.offsetHeight,r=n+e;return t<Math.max(0,Math.min(o,window.pageXOffset+window.innerWidth-i,i+o-window.pageXOffset))*Math.max(0,Math.min(e,window.pageYOffset+window.innerHeight-n,r-window.pageYOffset))/(o*e)},keyboardUnfocus:function(){document.activeElement&&document.activeElement.blur()},passiveEventsSupported:function(){return u.isiOS()},containerStickyBottom:function(n){var i=n.scrollHeight,o=!1,e=new MutationObserver(function(){var e,t;o||(o=!0,e=n.scrollHeight,(t=i)<(i=e)&&(n.scrollTop=n.scrollTop+e-t),o=!1)});return e.observe(n,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),e},isInputLikeElement:function(e){return"TEXTAREA"===e.nodeName||"INPUT"===e.nodeName},copyStringToClipboard:function(e){var t=document.createElement("input");t.style.display="none",document.body.appendChild(t),t.value=e,this.copyInputValueToClipboard(t),document.body.removeChild(t)},copyInputValueToClipboard:function(e){var t,n,i,o;return document.body.createTextRange?((t=document.body.createTextRange()).moveToElementText(e),t.select(),t.execCommand("Copy")):!(!window.getSelection||!document.createRange)&&(t=e.contentEditable,n=e.readOnly,e.contentEditable=!0,e.readOnly=!1,(i=document.createRange()).selectNodeContents(e),(o=window.getSelection()).removeAllRanges(),o.addRange(i),this.isInputLikeElement(e)&&e.select(),u.isiOS()&&e.setSelectionRange(0,999999),e.contentEditable=t,e.readOnly=n,document.execCommand("copy"))},onScrollIntoView:function(e,t,n,i){var o;this.isElementVisible(e,t)?n.call(i):(o=function(){d.isElementVisible(e,t)&&(n.call(i),document.removeEventListener("scroll",o))},document.addEventListener("scroll",o))}};return d}),e.define("module:Geometry",[],function(){return{padFitBoxInBox:function(e,t,n,i){var o=e/t,r=n/i,s=r<o?n/e:i/t;return{scale:s,offsetX:o<r?(n-e*s)/2:0,offsetY:r<o?(i-t*s)/2:0}}}}),e.define("module:Selection",["module:Dom"],function(o){return{selectNode:function(e,t){var n=null,i=null;window.getSelection?((n=window.getSelection()).removeAllRanges(),i=document.createRange()):document.selection&&(i=(n=document.selection).createRange()),t?(i.setStart(e,t),i.setEnd(e,t)):i.selectNode(e),n.addRange(i)},selectedHtml:function(){return window.getSelection?window.getSelection().toString():document.selection?document.selection.createRange().htmlText:""},selectionStartOffset:function(){return window.getSelection?window.getSelection().getRangeAt(0).startOffset:document.selection?document.selection.createRange().startOffset:null},selectionEndOffset:function(){return window.getSelection?window.getSelection().getRangeAt(0).endOffset:document.selection?document.selection.createRange().endOffset:null},selectionNonEmpty:function(){var e=this.selectionStart(),t=this.selectionEnd();return e&&t&&e&&t&&(e!=t||this.selectionStartOffset()!=this.selectionEndOffset())},selectionContained:function(e){return e.contains(this.selectionStart())&&e.contains(this.selectionEnd())},selectionNodes:function(){for(var e=[],t=this.selectionStart(),n=this.selectionEnd(),i=(e.push(t),t);i!=n;)i=o.traverseNext(i),e.push(i);return e},selectionLeaves:function(){return this.selectionNodes().filter(function(e){return!e.hasChildNodes()})},selectionStartNode:function(){return window.getSelection?window.getSelection().getRangeAt(0).startContainer:document.selection?document.selection.createRange().startContainer:null},selectionAncestor:function(){return window.getSelection?window.getSelection().getRangeAt(0).commonAncestorContainer:document.selection?document.selection.createRange().parentElement():null},selectionStart:function(){return window.getSelection?window.getSelection().getRangeAt(0).startContainer:document.selection?document.selection.createRange().startContainer:null},selectionEnd:function(){return window.getSelection?window.getSelection().getRangeAt(0).endContainer:document.selection?document.selection.createRange().endContainer:null},selectionSplitOffsets:function(){var e=this.selectionStartOffset(),t=this.selectionEndOffset(),n=this.selectionStart(),i=this.selectionEnd(),o=n==i;t<i.wholeText.length&&(i.splitText(t),o)&&(n=i),0<e&&(n=n.splitText(e),o)&&(i=n),this.selectRange(n,i)},selectRange:function(e,t,n,i){var o=null,r=null;window.getSelection?((o=window.getSelection()).removeAllRanges(),r=document.createRange()):document.selection&&(r=(o=document.selection).createRange()),r.setStart(e,n||0),r.setEnd(t,i||t.data.length),o.addRange(r)}}}),e.define("module:Upload.ChunkedFileUploader",["module:Upload.FileUploader","module:Upload.MultiUploader","module:Blobs","base:Promise","base:Objs","base:Tokens","base:Ajax.Support"],function(a,n,u,e,c,i,l,t){return a.extend({scoped:t},function(t){return{constructor:function(e){t.constructor.call(this,e),this._multiUploader=new n({uploadLimit:this._options.uploadLimit}),this._options.identifierParameter=this._options.identifierParameter||"identifier",this._options.chunks=c.extend({size:1e6,chunkNumberParameter:"chunknumber"},this._options.chunks),this._options.assembly=c.extend({fileNameParameter:"filename",totalSizeParameter:"totalsize",chunkNumberParameter:"chunknumber",fileTypeParameter:"filetype",ajaxOptions:null},this._options.assembly)},destroy:function(){this._multiUploader.destroy(),t.destroy.call(this)},reset:function(){t.reset.call(this),this._multiUploader.destroy(),this._multiUploader=new n({uploadLimit:this._options.uploadLimit})},__generateIdentifier:function(){return i.generate_token()},_upload:function(){var r=this.__generateIdentifier(),s=this._options.isBlob?this._options.source:this._options.source.files[0];u.loadFileIntoArrayBuffer(s).success(function(e){for(var t=0;t*this._options.chunks.size<s.size;){var n={},i=(n[this._options.chunks.chunkNumberParameter]=t+1,n[this._options.identifierParameter]=r,t*this._options.chunks.size),o=Math.min(this._options.chunks.size,s.size-i);this._multiUploader.addUploader(this._multiUploader.auto_destroy(a.create({url:this._options.chunks.url||this._options.url,source:u.createBlobByArrayBufferView(e,i,o,s.type),data:c.extend(n,this._options.data)}))),t++}this._multiUploader.on("error",function(e){this._errorCallback(e)},this).on("progress",function(e,t){this._progressCallback(e,t)},this).on("success",function(){var e={};e[this._options.identifierParameter]=r,e[this._options.assembly.fileNameParameter]=s.name||"blob",e[this._options.assembly.totalSizeParameter]=s.size,e[this._options.assembly.chunkNumberParameter]=t,e[this._options.assembly.fileTypeParameter]=s.type,l.execute(c.extend({method:this._options.method,uri:this._options.assembly.url||this._options.url,data:c.extend(e,this._options.data)},this._options.assembly.ajaxOptions)).success(function(){this._successCallback()},this).error(function(e){this._errorCallback(e)},this)},this),this._multiUploader.upload()},this)}}},{supported:function(e){return"undefined"!=typeof window.Blob&&"undefined"!=typeof FileReader&&"undefined"!=typeof DataView&&e.serverSupportsChunked}})}),e.define("module:Upload.CordovaFileUploader",["module:Upload.FileUploader","module:Info","base:Promise","base:Ajax.Support","base:Objs"],function(e,i,o,r,s,t){return e.extend({scoped:t},{_acquirePermission:function(){var t,n=o.create();return i.isAndroid()?(t=cordova.plugins.permissions).checkPermission(t.READ_EXTERNAL_STORAGE,function(e){e.hasPermission?n.asyncSuccess(!0):t.requestPermission(t.READ_EXTERNAL_STORAGE,function(e){e.hasPermission?n.asyncSuccess(!0):n.asyncError("Access to storage was not granted")},function(){n.asyncError("Could not request storage permission")})},function(){n.asyncError("Could not check storage permission")}):n.asyncSuccess(!0),n},_upload:function(){return this._acquirePermission().mapSuccess(function(){return window.resolveLocalFileSystemURL?this._uploadWithLocalFileSystem():this._uploadWithPlugin()},this)},_uploadWithPlugin:function(){var t=this,e=this._options.source.fullPath.split(":")[1],n=new window.FileUploadOptions;n.fileKey="file",n.fileName=e.substr(e.lastIndexOf("/")+1),n.mimeType=this._options.source.type,n.httpMethod=this._options.method,n.params=this._options.data,(new window.FileTransfer).upload(e,this._options.url,function(e){t._successCallback(e)},function(e){t._errorCallback(e)},n)},_uploadWithLocalFileSystem:function(){var n=this,e=this._options.source.fullPath;window.resolveLocalFileSystemURL(e,function(e){e.file(function(e){var t=new FileReader;t.onloadend=function(){var e=new Blob([new Uint8Array(this.result)],{type:n._options.source.type}),t=s.clone(n._options.data||{},1);return t.file=e,r.execute({method:n._options.method,uri:n._options.url,decodeType:"text",data:t},n._progressCallback,n).success(n._successCallback,n).error(n._errorCallback,n)},t.readAsArrayBuffer(e)},function(e){n._errorCallback(e)})},function(e){n._errorCallback(e)})}},{supported:function(e){return!(!navigator.device||!navigator.device.capture||!navigator.device.capture.captureVideo||!(window.resolveLocalFileSystemURL||window.FileTransfer&&window.FileUploadOptions)||e.isBlob||!("localURL"in e.source||"fullPath"in e.source))}})}),e.define("module:Upload.FileUploader",["base:Classes.ConditionalInstance","base:Events.EventsMixin","base:Objs","base:Types","base:Async","base:Promise"],function(e,t,n,i,o,r,s){return e.extend({scoped:s},[t,function(t){return{constructor:function(e){t.constructor.call(this,e),this._uploaded=0,this._state="idle"},_setState:function(e,t,n){this._state=e,this.trigger(e,t,n),this.trigger("state",e,t,n)},state:function(){return this._state},data:function(){return this._data},progress:function(){return{uploaded:this._uploaded,total:this._total}},reset:function(){"error"===this.state()&&(this._setState("idle"),delete this._data,this._uploaded=0,delete this._total,delete this._request)},upload:function(){return"idle"===this.state()&&(this._setState("uploading"),this.__upload()),this},__upload:function(){this._upload(),this._options.resilience--},_upload:function(){},_progressCallback:function(e,t){"uploading"===this.state()&&(this._uploaded=e,this._total=t,this.trigger("progress",e,t))},_successCallback:function(e){"uploading"===this.state()&&(this._data=e,this._setState("success",e,this._request))},_errorCallback:function(e){if("uploading"===this.state()){try{e.data&&(e=e.data()),i.is_string(e)&&(e=JSON.parse(e))}catch(t){}0<this._options.resilience&&(!this._options.resilienceCheck||this._options.resilienceCheck(e))?o.eventually(function(){this.__upload()},this,this._options.resilience_delay):this._options.essential?(this._data=e,this._setState("error",e,this._request)):this._successCallback({})}},uploadedBytes:function(){return this._uploaded},totalBytes:function(){return this._total||(this._options.source?!this._options.isBlob&&this._options.source.files&&this._options.source.files[0]?this._options.source.files[0].size:this._options.source.size||0:0)}}}],{_initializeOptions:function(e){return e=e||{},n.extend({method:"POST",serverSupportChunked:!1,serverSupportPostMessage:!1,isBlob:"undefined"!=typeof window.Blob&&e.source instanceof window.Blob,resilience:1,resilience_delay:1e3,s3:!1,essential:!0,data:{}},e)}})}),e.define("module:Upload.CustomUploader",["module:Upload.FileUploader"],function(e,t){return e.extend({scoped:t},{_upload:function(){this.trigger("upload",this._options)},progressCallback:function(e,t){this._progressCallback(e,t)},successCallback:function(e){this._successCallback(e)},errorCallback:function(e){this._errorCallback(e)}})}),e.extend("module:Upload.FileUploader",["module:Upload.FileUploader","module:Upload.FormDataFileUploader","module:Upload.FormIframeFileUploader","module:Upload.CordovaFileUploader","module:Upload.ChunkedFileUploader","module:Upload.S3MultipartFileUploader"],function(e,t,n,i,o,r){return e.register(r,5),e.register(o,4),e.register(i,3),e.register(t,2),e.register(n,1),{}}),e.define("module:Upload.FormDataFileUploader",["module:Upload.FileUploader","module:Info","base:Ajax.Support","base:Objs","base:Types"],function(e,n,t,i,o,r){return e.extend({scoped:r},{_upload:function(){var e=i.clone(o.is_empty(this._options.data)?{}:this._options.data,1);return e.file=this._options.isBlob?this._options.source:this._options.source.files[0],this._request=t.create(),t.execute({method:this._options.method,uri:this._options.url,decodeType:"text",data:e,noFormData:this._options.noFormData},this._progressCallback,this,this._request).success(this._successCallback,this).error(this._errorCallback,this)}},{supported:function(e){if(n.isInternetExplorer()&&n.internetExplorerVersion()<=9||n.isCordova()&&("localURL"in e.source||"fullPath"in e.source))return!1;try{new window.FormData}catch(t){return!1}return!0}})}),e.define("module:Upload.FormIframeFileUploader",["module:Upload.FileUploader","base:Net.Uri","base:Objs","base:Async"],function(e,h,p,f,t){return e.extend({scoped:t},{_upload:function(){var i=this,o=document.createElement("iframe"),e="upload-iframe-"+this.cid(),r=(o.id=e,o.name=e,o.style.display="none",document.createElement("form")),s=(r.method=this._options.method,r.target=e,r.style.display="none",document.body.appendChild(o),document.body.appendChild(r),this._options.source.parent),a=(r.appendChild(this._options.source),this._options.source.name||(this._options.source.name="file"),p.iter(this._options.data,function(e,t){var n=document.createElement("input");n.type="hidden",n.name=t,n.value=e,r.appendChild(n)},this),!("postMessage"in window)),t=null,u=function(e){t(e.data)},e=(o.onerror=function(){a&&(window.postMessage=null),window.removeEventListener("message",u,!1),s&&s.appendChild(i._options.source),document.body.removeChild(r),document.body.removeChild(o),i._errorCallback()},this._options.serverPostMessageKey||"_postmessage"),c=this._options.serverPostMessageIdKey||"_postmessageid",l=this.cid(),d=this._options.serverSupportPostMessageId,n={};n[e]=!0,d&&(n[c]=l),r.action=h.appendUriParams(this._options.url,n),r.encoding=r.enctype="multipart/form-data",t=function(e){try{var t=JSON.parse(e);d&&t[c]!==l||(a&&(window.postMessage=null),s&&s.appendChild(i._options.source),document.body.removeChild(r),document.body.removeChild(o),i._successCallback(t),f.eventually(function(){window.removeEventListener("message",u,!1)}))}catch(n){}},window.addEventListener("message",u,!1),a&&(window.postMessage=t),r.submit()}},{supported:function(e){return!e.isBlob&&e.serverSupportPostMessage}})}),e.define("module:Upload.MultiUploader",["module:Upload.FileUploader","base:Objs"],function(e,o,t){return e.extend({scoped:t},function(t){return{constructor:function(e){t.constructor.call(this,e),this._uploaders={},this._uploadLimit=this._options.uploadLimit||5,this._uploadingCount=0,this._end=!this._options.manualEnd},end:function(){this._end=!0,this._updateState()},addUploader:function(e){return(this._uploaders[e.cid()]=e).on("state",this._updateState,this),e.on("progress",this._updateProgress,this),"uploading"===this.state()&&("error"===e.state()&&e.reset(),"idle"===e.state())&&this._uploadingCount<this._uploadLimit&&(this._uploadingCount++,e.upload()),this},_upload:function(){o.iter(this._uploaders,function(e){"error"===e.state()&&e.reset(),"idle"===e.state()&&this._uploadingCount<this._uploadLimit&&(this._uploadingCount++,e.upload())},this),this._updateState()},_updateState:function(){var t,n,i;"uploading"!==this.state()||(this._uploadingCount=0,t=!1,n=0,o.iter(this._uploaders,function(e){switch(e.state()){case"uploading":this._uploadingCount++;break;case"error":t=!0;break;case"idle":n++}},this),0<n&&this._uploadingCount<this._uploadLimit&&o.iter(this._uploaders,function(e){this._uploadingCount<this._uploadLimit&&"idle"===e.state()&&(e.upload(),n--,this._uploadingCount++)},this),0<this._uploadingCount)||this._end&&(i=[],o.iter(this._uploaders,function(e){e=t&&"error"===e.state()||!t&&"success"===e.state()?e.data():undefined;i.push(e)},this),0<t?this._errorCallback(i):this._successCallback(i))},_updateProgress:function(){"uploading"===this.state()&&this._progressCallback(this.uploadedBytes(),this.totalBytes())},uploadedBytes:function(){var t=0;return o.iter(this._uploaders,function(e){t+=e.uploadedBytes()},this),t},totalBytes:function(){var t=0;return o.iter(this._uploaders,function(e){t+=e.totalBytes()},this),t}}})}),e.define("module:Upload.S3MultipartFileUploader",["module:Upload.FileUploader","module:Upload.MultiUploader","module:Upload.S3MultipartSupport"],function(i,n,o,e){return i.extend({scoped:e},function(t){return{constructor:function(e){t.constructor.call(this,e),this._parts=[],this._multiUploader=new n({uploadLimit:this._options.uploadLimit})},destroy:function(){this._multiUploader.destroy(),t.destroy.call(this)},reset:function(){t.reset.call(this),this._parts=[],this._multiUploader.destroy(),this._multiUploader=new n({uploadLimit:this._options.uploadLimit})},getUploadId:function(){return this._options.uploadId},_upload:function(){var e=this._options.isBlob?this._options.source:this._options.source.files[0];if(o.validateFileSize(e.size)){var t,e=o.chunkFile(e,{numberOfChunks:this._options.parts,chunkSize:this._options.chunkSize}),n=0;for(t in this._options.urls)this._options.urls.hasOwnProperty(t)&&n++;e.length>n?this._setState("error","Not enough parts to upload file"):(e.forEach(function(e,t){var n=t+1,t=this._multiUploader.auto_destroy(i.create({method:"PUT",url:this._options.urls[n],source:e,resilience:this._options.resilience,noFormData:!0}));this._multiUploader.addUploader(t),t.on("success",function(e,t){this._parts.push({ETag:t.getResponseHeader("ETag"),PartNumber:n})},this)}.bind(this)),this._multiUploader.on("error",this._errorCallback,this).on("progress",this._progressCallback,this).on("success",function(){this._successCallback(o.sortParts(this._parts))},this),this._multiUploader.upload())}else this._setState("error","File size is too big")}}},{supported:function(e){return e.s3&&e.urls}})}),e.define("module:Upload.S3MultipartSupport",["base:Maths"],function(t){var a=5368709120,u=52428800;return{chunkFile:function(e,t){if(!this.validateFileSize(e.size))return[];for(var n,i=524288e6<e.size?a:u,o=(t.chunkSize?(i=this.clampChunkSize(t.chunkSize),n=this.calculateNumberOfChunks(e.size,i),t.numberOfChunks&&n>this.clampNumberOfChunks(t.numberOfChunks)&&(i=this.clampChunkSize(this.calculateChunkSize(e.size,this.clampNumberOfChunks(t.numberOfChunks))))):t.numberOfChunks&&(i=this.clampChunkSize(this.calculateChunkSize(e.size,this.clampNumberOfChunks(t.numberOfChunks)))),0),r=e.size,s=[];o<r;)s.push(e.slice(o,o+i)),o+=i;return s},sortParts:function(e){return e.sort(function(e,t){return e.PartNumber<t.PartNumber?-1:1})},validateFileSize:function(e){return 0<e&&e<=5497558138880},validateChunkSize:function(e){return 5242880<=e&&e<=a},validateNumberOfChunks:function(e){return 1<=e&&e<=1e4},calculateChunkSize:function(e,t){return Math.ceil(e/t)},calculateNumberOfChunks:function(e,t){return Math.ceil(e/(t||u))},clampChunkSize:function(e){return t.clamp(e,5242880,a)},clampNumberOfChunks:function(e){return t.clamp(e,1,1e4)}}}),e.define("module:Upload.StreamingFileUploader",["module:Upload.FileUploader","module:Upload.MultiUploader","base:Promise","base:Objs","base:Tokens","base:Ajax.Support"],function(n,i,e,o,r,s,t){return n.extend({scoped:t},function(t){return{constructor:function(e){t.constructor.call(this,e),this._multiUploader=new i({uploadLimit:this._options.uploadLimit,manualEnd:!0}),this._options.identifierParameter=this._options.identifierParameter||"identifier",this._options.chunks=o.extend({chunkNumberParameter:"chunknumber"},this._options.chunks),this._options.assembly=o.extend({totalSizeParameter:"totalsize",chunkNumberParameter:"chunknumber",ajaxOptions:null},this._options.assembly),this._identifier=this.__generateIdentifier(),this._chunkNumber=0,this._totalSize=0},destroy:function(){this._multiUploader.destroy(),t.destroy.call(this)},reset:function(){t.reset.call(this),this._multiUploader.destroy(),this._multiUploader=new i({uploadLimit:this._options.uploadLimit}),this._identifier=this.__generateIdentifier(),this._chunkNumber=0,this._totalSize=0},__generateIdentifier:function(){return r.generate_token()},addChunk:function(e){var t={};t[this._options.chunks.chunkNumberParameter]=this._chunkNumber+1,t[this._options.identifierParameter]=this._identifier,this._multiUploader.addUploader(this._multiUploader.auto_destroy(n.create({url:this._options.chunks.url||this._options.url,source:e,data:o.extend(t,this._options.data)}))),this._chunkNumber++,this._totalSize+=e.size},end:function(){this._multiUploader.end()},_upload:function(){this._multiUploader.on("error",function(e){this._errorCallback(e)},this).on("progress",function(e,t){this._progressCallback(e,t)},this).on("success",function(){var e={};e[this._options.identifierParameter]=this._identifier,e[this._options.assembly.totalSizeParameter]=this._totalSize,e[this._options.assembly.chunkNumberParameter]=this._chunkNumber,s.execute(o.extend({method:this._options.method,uri:this._options.assembly.url||this._options.url,data:o.extend(e,this._options.data)},this._options.assembly.ajaxOptions)).success(function(){this._successCallback()},this).error(function(e){this._errorCallback(e)},this)},this),this._multiUploader.upload()}}},{supported:function(e){return"undefined"!=typeof window.Blob&&e.serverSupportsChunked}})})}.call(Scoped);