@globules-io/ogx.js 1.15.1 → 1.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* globules.io OGX.JS 1.
|
|
2
|
-
window.console||(window.console={});for(var methods=["log","debug","warn","info"],i=0;i<methods.length;i++)console[methods[i]]=function(){};if(void 0===OGX)var OGX={};if(OGX.Data={},OGX.Data.weld=function(t,e,r,i){void 0===r&&(r=!1),void 0===i&&(i=!1);var a=t;return i&&(a=JSON.parse(JSON.stringify(t))),function t(e,i){for(var a in i)!e.hasOwnProperty(a)||r?e[a]=i[a]:"object"==typeof i[a]&&t(e[a],i[a])}(a,e),a},OGX.Data.merge=function(t,e,r,i,a){for(var s in void 0===r&&(r=!1),void 0===i&&(i=!1),void 0===a&&(a=!1),i&&(t=JSON.parse(JSON.stringify(t))),e)r?a?t.hasOwnProperty(s)&&(t[s]=e[s]):t[s]=e[s]:t.hasOwnProperty(s)||a||(t[s]=e[s]);return t},OGX.Data.diff=function(t,e,r){void 0===r&&(r=!1);var i={},a=!1;for(var s in e)(!r&&!t.hasOwnProperty(s)||r&&t.hasOwnProperty(s)&&t[s]!==e[s])&&(i[s]=e[s],a=!0);return!!a&&i},OGX.Data.props=function(t,e){for(var r in e)if(!t.hasOwnProperty(e[r]))return!1;return!0},OGX.Data.clone=function(t){return JSON.parse(JSON.stringify(t))},OGX.Data.isOML=function(t){for(var e in t)if(-1!==e.indexOf(":"))return!0;return!1},OGX.Data.stringToVal=function(t){if("string"!=typeof t)return t;var e=-1;return"true"===t&&(e=!0),"false"===t&&(e=!1),-1!==e?e:t.match(/^([0-9]+(\.[0-9]+)?)$/g)?Number(t):t.match(/^(\[|{)/g)?JSON.parse(t):t},OGX.Data.pad=function(t,e,r,i){void 0===i&&(i="0"),void 0===r&&(r=-1);for(var a=String(t);a.length<e;)-1===r?a=i+a:a+=i;return a},OGX.Data.addDec=function(t){return parseFloat(Math.round(100*t)/100).toFixed(2)},OGX.Data.isInt=function(t){return Number(t)===t&&t%1==0},OGX.Data.isFloat=function(t){return Number(t)===t&&t%1!=0},OGX.Data.dateToLocale=function(t,e){return"string"==typeof t&&(t=new Date(t+" ")),void 0===e&&(e={}),OGX.Data.merge(e,{weekday:"long",year:"numeric",month:"long",day:"numeric"}),t.toLocaleDateString(navigator.language,e)},OGX.Data.eval=function(__obj,__path,__value){void 0===__value&&(__value=null);var str="__obj."+__path,res;__value&&(str+=" = "+JSON.stringify(__value));try{res=eval(str)}catch(t){}return res},OGX.Data.getBestSize=function(t,e,r,i){if(void 0===r&&(r=10),void 0===i&&(i=200),"string"==typeof e){if(-1!==e.indexOf("|")){var a=e.substr(e.length-1,1);["+","-"].includes(a)?e=e.substr(0,e.length-1):a="+",a="+"===a?1:-1;for(var s,n=e.split("|"),o=new OGX.List,f=0;f<n.length;f++)-1!==(s=n[f]).indexOf("px")&&(s=s.replace("px","")),-1!==s.indexOf("%")&&(s=Math.round(Number(s.split("%")[0])*t/100)),s<=t&&o.insert({m:t-s,s:n[f],n:s});return o.order("m",a),"100%"===o[0].s&&o.length>1&&o[1].m<i?o[1].s:o[0].s}(m=/(\d+)(%|px)?/gi.exec(e))&&("%"===m[2].trim()?e=Math.round(Number(m[1])*t/100):("px"===m[2].trim()&&(e=m[1]),e=Number(e)))}return e},OGX.Data.same=function(t,e,r){void 0===r&&(r=!0);var i,a=0,s=0;for(i in t)a++;for(i in e)s++;if(a!==s)return!1;if(typeof t!=typeof e)return!1;if(!["object","array"].includes(typeof t))return t===e;return function t(e,a){for(i in e){if(typeof e[i]!=typeof a[i])return!1;if(r&&"object"==typeof e[i]&&a.hasOwnProperty(i)){if(!t(e[i],a[i]))return!1}else if("array"==typeof e[i]){if(e[i].length!==a[i].length)return!1;if(e[i].sort(),a[i].sort(),r){for(var s=0;s<e[i].length;s++)if(!t(e[i][s],a[i][s]))return!1}else if(JSON.parse(JSON.stringify(e[i]))!==JSON.parse(JSON.stringify(__b[i])))return!1}else if(e[i]!==a[i])return!1}return!0}(t,e)},OGX.Data.clipboard=function(t){if(void 0!==t)if(void 0!==navigator.clipboard)navigator.clipboard.writeText(t);else{var e=document.createElement("textarea");e.value=t,e.style.top="-1000px",e.style.left="0",e.style.position="fixed",document.body.appendChild(e),e.focus(),e.select();try{document.execCommand("copy")}catch(t){}document.body.removeChild(e)}},void 0===OGX)var OGX={};OGX.List=function(){var filteringMode="and",filterCount=0,indexes=!1;1===arguments.length&&arguments[0]instanceof Array&&(arguments=arguments[0]);var array=Object.create(Array.prototype);for(var method in array=Array.apply(array,arguments)||array,OGX.List.prototype)OGX.List.prototype.hasOwnProperty(method)&&(array[method]=OGX.List.prototype[method]);function addToCache(t){var e;for(var r in indexes){if(-1!==r.indexOf("|")){r=r.split("|"),e=[];for(var i=0;i<r.length;i++)t.hasOwnProperty(r[i])&&e.push(t[r[i]]);e=e.join("|"),r=r.join("|")}else t.hasOwnProperty(r)&&(e=t[r]);indexes.hasOwnProperty(r)||(indexes[r]={}),indexes[r][e]=t}}function matchesCache(t){var e,r=[],i=[];for(var a in indexes){e=!0,r=-1!==a.indexOf("|")?a.split("|"):[a];for(var s=0;s<r.length;s++)if(!t.hasOwnProperty(r[s])){e=!1;break}e&&i.push(a)}return!!i.length&&i}function dynamicSort(t,e){return function(r,i){return r[t]<i[t]?-1*e:r[t]>i[t]?e:0}}function extract(__item,__by,__mode,__param){var data;try{data=eval("__item."+__by)}catch(t){}if(data)switch(__mode){case"substr":return data=data.substr(__param[0],__param[1]),data;case"numrange":return data=Number(data),Array.isArray(__param)?(data=Math.floor(data/__param[0]),data="pre"===__param[2]?__param[1]+data*__param[0]+" - "+__param[1]+(data+1)*__param[0]:data*__param[0]+__param[1]+" - "+(data+1)*__param[0]+__param[1]):(data=Math.floor(data/__param),data=data*__param+" - "+(data+1)*__param),data;case"date":if(!Array.isArray(__param)){if("year"===__param)return data=data.substr(0,4),data;if("month"===__param)return data=data.substr(0,7),data;if("week"===__param)return data=data.substr(0,4)+" week "+moment(data).week(),data}return data=moment(data).unix(),data=Math.floor(data/(60*__param[0]*60*24)),data*=60*__param[0]*60*24,data=moment(1e3*data).format(__param[1])+" - "+moment(1e3*data+1e3*__param[0]*60*60*24).format(__param[1]),data;default:return data}return!1}return array.insert=function(t,e){return void 0===e?array.push(t):array.splice(e,0,t),indexes&&addToCache(t),!0},array.delete=function(t){var e=this,r=array.splice(t,1);if(r.length){if(indexes){var i=matchesCache(r[0]);i&&setTimeout((function(){e.rebuild(i)}),0)}return r[0]}return!1},array.last=function(){if(this.length)return this[this.length-1]},array.findDelete=function(__property,__value,__limit){var t=0;void 0===__limit&&(__limit=0);for(var removed=new OGX.List,ev,prop,i=0;i<this.length;i++){prop=null,ev="this["+i+"]."+__property;try{prop=eval(ev)}catch(t){}if(null==prop);else if(prop===__value){if(removed.push(this.splice(i,1)[0]),indexes){var idxs=matchesCache(removed.last());idxs&&this.rebuild(idxs)}if(t++,__limit>0&&__limit===t)return 1===__limit?removed[0]:removed;i--}}return removed},array.findReplace=function(__property,__value,__object,__limit){var t=0;void 0===__limit&&(__limit=0);for(var replaced=new OGX.List,ev,prop,i=0;i<this.length;i++){prop=null,ev="this["+i+"]."+__property;try{prop=eval(ev)}catch(t){}if(null==prop);else if(prop===__value&&(replaced.push(this[i]),t++,this[i]=__object,__limit>0&&__limit===t))return 1===__limit?replaced[0]:replaced}return!!replaced.length&&replaced},array.findUpdate=function(__property,__value,__object,__strict,__limit){var t=0;void 0===__strict&&(__strict=!1),void 0===__limit&&(__limit=0);for(var updated=new OGX.List,upd,ev,prop,i=0;i<this.length;i++){prop=null,ev="this["+i+"]."+__property;try{prop=eval(ev)}catch(t){}if(null==prop);else if(prop===__value){for(var a in upd=!1,__object)__strict?this[i].hasOwnProperty(a)&&(this[i][a]=__object[a],upd=!0):(this[i][a]=__object[a],upd=!0);if(upd&&(t++,updated.push(this[i]),__limit>0&&__limit===t))return 1===__limit?updated[0]:updated}}return!!updated.length&&updated},array.findIndex=function(__property,__value){var isReg=!1,ev,prop;__value instanceof RegExp&&(isReg=!0);for(var i=0;i<this.length;i++){prop=null,ev="this["+i+"]."+__property;try{prop=eval(ev)}catch(t){}if(null!==prop)if(isReg){if(prop.match(__value))return{index:i}}else if(prop===__value)return{index:i}}return!1},array.find=function(t,e,r){var i=0,a=new OGX.List,s=!1;e instanceof RegExp&&(s=!0),void 0===r&&(r=0);for(var n=0;n<this.length;n++)if(s?this[n][t].match(e)&&(a.push(this[n]),i++):this[n][t]===e&&(a.push(this[n]),i++),r>0&&i===r)return 1===r?a[0]:a;return!!a.length&&a},array.swap=function(t,e){var r=this[t];this[t]=this[e],this[e]=r},array.cache=function(){indexes||(indexes={});var t=[],e=[];if(arguments.length>1){for(var r=0;r<arguments.length;r++)t.push(arguments[r]);t=t.join("|")}else t=arguments[0];indexes.hasOwnProperty(t)||(indexes[t]={});for(var i=0;i<this.length;i++){e=[];for(r=0;r<arguments.length;r++)e.push(this[i][arguments[r]]);e=e.join("|"),indexes[t].hasOwnProperty(e)||(indexes[t][e]=[]),indexes[t][e].push(this[i])}return!0},array.uncache=function(t){if(!indexes)return!1;var e=t;return arguments.length>1&&(e=arguments.join("|")),!!indexes.hasOwnProperty(e)&&(delete indexes[e],!0)},array.deleteProperty=function(t){for(var e=0,r=0;r<this.length;r++)this[r].hasOwnProperty(t)&&(delete this[r][t],e++);return indexes&&this.rebuild(),e},array.rebuild=function(t){if(Array.isArray(t))for(var e=0;e<t.length;e++)delete indexes[t[e]],this.cache(t[e]);else if(indexes)for(var r in indexes)delete indexes[r],this.cache.apply(this,r.split("|"))},array.read=function(t,e,r){var i,a,s=arguments;if(!indexes)return!1;if(!s.length)return indexes;if("object"==typeof t){for(var n in r=s[1],i=[],a=[],t)i.push(n),a.push(t[n]);i=i.join("|"),a=a.join("|")}else i=t,a=e;return void 0===r&&(r=0),!(!indexes.hasOwnProperty(i)||!indexes[i].hasOwnProperty(a))&&(r?r>1?indexes[i][a].splice(0,r):indexes[i][a][0]:indexes[i][a])},array.clear=function(){indexes=!1,filterCount=0,this.length=0},array.unique=function(t,e,r){void 0===e&&(e=!0),void 0===r?r=[t]:Array.isArray(r)||(r=[r]);for(var i,a=this.get(),s=[],n=new OGX.List,o=0;o<a.length;o++)if(!s.includes(a[o][t])&&(s.push(a[o][t]),e)){i={};for(var f=0;f<r.length;f++)i[r[f]]=a[o][t];n.push(i)}return e?n:s},array.order=function(t,e){array.sort(dynamicSort(t,e))},array.group=function(t,e,r){if(Array.isArray(t))return array.groupm(t,e,r);for(var i,a={},s=0;s<this.length;s++)(i=extract(this[s],t,e,r))&&(i=i.split(".").pop(),a.hasOwnProperty(i)||(a[i]=new OGX.List),a[i].push(this[s]));return a},array.groupm=function(t,e,r){return function i(a,s){var n=new OGX.List(a),o=e,f=r;void 0!==e&&Array.isArray(e)&&(o=e[s]),void 0!==r&&Array.isArray(r)&&(f=r[s]);var h=n.group(t[s],o,f);if(s+1<=t.length-1)for(var l in h)h[l]=i(h[l],s+1);return h}(this,0)},array.filters={},array.addFilter=function(t,e,r){this.filters.hasOwnProperty(t)||(this.filters[t]=[]);var i={};return i[e]=r,this.filters[t].push(i),filterCount++,!0},array.removeFilter=function(t){return!!this.filters.hasOwnProperty(t)&&(filterCount-=this.filters[t].length,delete this.filters[t],!0)},array.getFilters=function(){return this.filters},array.resetFilters=function(){this.filters={},filterCount=0},array.setFilters=function(t){for(var e in this.resetFilters(),t)for(var r=0;r<t[e].length;r++)for(var i in t[e][r])array.addFilter(e,i,t[e][r][i])},array.setFilteringMode=function(t){filterMode=t},array.get=function(t,e,r,i,a){void 0===e&&(e=!1),void 0===r&&(r=!1),"number"==typeof r&&(i=r,r=!1),void 0===i&&(i=0),void 0===a&&(a=!1);var s=this.getFilters();for(var n in this.resetFilters(),t)for(var o in t[n])this.addFilter(n,o,t[n][o]);var f=this.filter(i,a);if(this.resetFilters(),this.setFilters(s),a)return f;if(1===i)return!!f.length&&f[0];if(e)for(var n in e){f.order(n,e[n]);break}return r?f.group.apply(null,r):f},array.unset=function(t,e){void 0===e&&(e=0);var r=new OGX.List,i=this.get(t,null,null,e,!0);if(i)for(var a=0;a<i.length;a++)r.push(this.delete(i[a]-r.length));return 1===e&&r.length?r[0]:r},array.update=function(t,e,r,i){void 0===r&&(r=!1),void 0===i&&(i=0);var a=this.get(t,null,i);if(a&&(Array.isArray(a)||(a=[itinerary]),a.length)){for(var s,n=[],o=0;o<a.length;o++)for(var f in e)r&&!a[o].hasOwnProperty(f)||(a[o][f]=e[f],(s=matchesCache(a[o]))&&-1===n.indexOf(s)&&n.push(s));return indexes&&n.length&&setTimeout((function(){that.rebuild(n)}),0),a}return[]},array.filter=function(__limit,__as_position){void 0===__limit&&(__limit=0),void 0===__as_position&&(__as_position=!1);for(var ar=[],positions=[],isDate,isString,isNum,isArray,isObject,hasFilters=!1,reg=/[0-9]{4}\-[0-9]{2}\-[0-9]{2}( [0-9]{2}\:[0-9]{2}\:[0-9]{2})?/g,isMatch=!1,matches=0,str,o,err,counter,total,i=0;i<this.length;i++)for(var a in isMatch=!0,matches=0,this.filters){err=!1,hasFilters=!0;try{o=null,str="this["+i+"]."+a,o=eval(str)}catch(t){err=!0}if(err||void 0===o)isMatch=!1;else{isDate=!1,isString=!1,isNum=!1,isArray=Array.isArray(o),isObject=!isArray&&"object"==typeof o,isArray?"string"==typeof o[0]?(isString=!0,o[0].match(reg)&&(isDate=!0)):isNum="number"==typeof o[0]:"string"==typeof o?(isString=!0,o.match(reg)&&(isDate=!0)):isNum="number"==typeof o;for(var j=0;j<this.filters[a].length;j++)for(var b in this.filters[a][j]){if(String(this.filters[a][j][b]).length)if("function"===b)isMatch=this.filters[a][j][b](o),isMatch&&matches++;else switch(b){case"eq":if(isDate){if("string"!=typeof this.filters[a][j][b]||!this.filters[a][j][b].match(reg)){isMatch=!1;break}moment(o).format("YYYY-MM-DD")!==moment(this.filters[a][j][b]).format("YYYY-MM-DD")?isMatch=!1:matches++}else if(isString){if("string"!=typeof this.filters[a][j][b]){isMatch=!1;break}o.toLowerCase()!==String(this.filters[a][j][b]).toLowerCase()?isMatch=!1:matches++}else o!==this.filters[a][j][b]?isMatch=!1:matches++;break;case"eqjson":JSON.stringify(o)!==JSON.stringify(this.filters[a][j][b])?isMatch=!1:matches++;break;case"neq":if(isDate){if("string"!=typeof this.filters[a][j][b]||!this.filters[a][j][b].match(reg)){isMatch=!0,matches++;break}moment(o).format("YYYY-MM-DD")===moment(this.filters[a][j][b]).format("YYYY-MM-DD")?isMatch=!1:matches++}else if(isString){if("string"!=typeof this.filters[a][j][b]){isMatch=!0,matches++;break}o.toLowerCase()===this.filters[a][j][b].toLowerCase()?isMatch=!1:matches++}else o===this.filters[a][j][b]?isMatch=!1:matches++;break;case"in":if((isString||isNum)&&Array.isArray(this.filters[a][j][b])){isMatch=!1;for(var k=0;k<this.filters[a][j][b].length;k++)if(isString){if(-1!==o.indexOf(this.filters[a][j][b][k])){isMatch=!0;break}}else if(isNum&&o===this.filters[a][j][b][k]){isMatch=!0;break}isMatch&&matches++}else if(isString||isNum)isArray?isString&&-1===o.indexOf(this.filters[a][j][b])||isNum&&o!==this.filters[a][j][b]?isMatch=!1:matches++:isString&&-1===o.toLowerCase().indexOf(this.filters[a][j][b].toLowerCase())||isNum&&o!==this.filters[a][j][b]?isMatch=!1:matches++;else if(isArray)-1===o.indexOf(this.filters[a][j][b])?isMatch=!1:matches++;else if(isObject){for(var p in counter=0,total=0,this.filters[a][j][b])total++,o.hasOwnProperty(p)&&-1!==String(o[p]).toLocaleLowerCase().indexOf(String(this.filters[a][j][b][p]).toLowerCase())&&counter++;isMatch=total===counter,isMatch&&matches++}break;case"nin":if(Array.isArray(this.filters[a][j][b])){for(var k=0;k<this.filters[a][j][b].length;k++)if(isString){if(-1!==o.indexOf(this.filters[a][j][b][k])){isMatch=!1;break}}else if(isNum&&o===this.filters[a][j][b][k]){isMatch=!1;break}isMatch&&matches++}else isString&&"string"==typeof this.filters[a][j][b]?-1!==o.toLowerCase().indexOf(this.filters[a][j][b].toLowerCase())&&(isMatch=!1):isNum?o===this.filters[a][j][b]&&(isMatch=!1):-1!==o.indexOf(this.filters[a][j][b])&&(isMatch=!1),isMatch&&matches++;break;case"gt":if(isDate){if("string"!=typeof this.filters[a][j][b]||!this.filters[a][j][b].match(reg)){isMatch=!1;break}moment(o).unix()<=moment(this.filters[a][j][b]).unix()?isMatch=!1:matches++}else{if("number"!=typeof this.filters[a][j][b]){isMatch=!1;break}o<=this.filters[a][j][b]?isMatch=!1:matches++}break;case"gte":if(isDate){if("string"!=typeof this.filters[a][j][b]||!this.filters[a][j][b].match(reg)){isMatch=!1;break}moment(o).unix()<moment(this.filters[a][j][b]).unix()?isMatch=!1:matches++}else{if("number"!=typeof this.filters[a][j][b]){isMatch=!1;break}o<this.filters[a][j][b]?isMatch=!1:matches++}break;case"lt":if(isDate){if("string"!=typeof this.filters[a][j][b]||!this.filters[a][j][b].match(reg)){isMatch=!1;break}moment(o).unix()>=moment(this.filters[a][j][b]).unix()?isMatch=!1:matches++}else{if("number"!=typeof this.filters[a][j][b]){isMatch=!1;break}o>=this.filters[a][j][b]?isMatch=!1:matches++}break;case"lte":if(isDate){if("string"!=typeof this.filters[a][j][b]||!this.filters[a][j][b].match(reg)){isMatch=!1;break}moment(o).unix()>moment(this.filters[a][j][b]).unix()?isMatch=!1:matches++}else{if("number"!=typeof this.filters[a][j][b]){isMatch=!1;break}o>this.filters[a][j][b]?isMatch=!1:matches++}break;case"btw":if(isDate){if("string"!=typeof this.filters[a][j][b]||!this.filters[a][j][b].match(reg)){isMatch=!1;break}moment(this.filters[a][j][b][0]).unix()>moment(o).unix()||moment(this.filters[a][j][b][1]).unix()<moment(o).unix()?isMatch=!1:matches++}else{if("number"!=typeof this.filters[a][j][b]){isMatch=!1;break}this.filters[a][j][b][0]>o||this.filters[a][j][b][1]<o?isMatch=!1:matches++}break;case"substr":o.toLowerCase().substr(this.filters[a][j][b][0],this.filters[a][j][b][1]).toLowerCase()!==this.filters[a][j][b][2].toLowerCase()?isMatch=!1:matches++;break;case"regex":o.toString().match(this.filters[a][j][b])?matches++:isMatch=!1}else matches++;if(!isMatch)break}}if("or"===filteringMode?isMatch&&(ar.push(this[i]),positions.push(i)):matches===filterCount&&(ar.push(this[i]),positions.push(i)),__limit&&ar.length===__limit)return __as_position?positions:OGX.List.apply(null,ar)}return __as_position?positions:hasFilters?OGX.List.apply(null,ar):array},array},OGX.Object=function(){"use strict";var t=new OGX.List,e=new OGX.List;function r(t){for(var e=t.split("."),r=OGX,i=0;i<e.length;i++)void 0!==r[e[i]]&&(r=r[e[i]]);return r}e.cache("_NAME_","id"),this.isRegistered=function(t,e){return typeof("undefined"!==this.register[t][e])},this.getExtend=function(e){var r=t.get({main:{eq:e}},null,1);return!!r&&r.extends},this.getExtends=function(e){var r=[],i=t.get({main:{eq:e}},null,1);if(i){var a;r=r.concat(i.extends);for(var s=0;s<i.extends.length;s++)(a=this.getExtends(i.extends[s]))&&(r=r.concat(a))}var n=[];for(s=0;s<r.length;s++)n.includes(r[s])||n.push(r[s]);return n},this.register=function(){var e=Array.prototype.slice.call(arguments),r=e.shift();t.push({main:r,extends:e})},this.create=function(t,i){void 0===i&&(i={});var a=this.getExtends(t),s=!1;if(a.length){var n=r(t);n.prototype=Object.create({});var o,f=[];f.push(n.prototype);for(var h=0;h<a.length;h++)void 0!==(o=r(a[h]))&&f.push(o.prototype);Object.assign.apply(null,f),n.prototype.constructor=n,(a.includes("View")||a.includes("Controller")||a.includes("Stage"))&&(i._sub_=t.split(".").pop()),s=new n(i)}else OGX.hasOwnProperty(t)&&(s=new OGX[t](i));return OGX.hasOwnProperty(t)&&OGX[t].hasOwnProperty("FLOAT")&&OGX[t].FLOAT&&(s.floating=!0),!!s&&(e.insert(s),s)},this.cache=function(t){if(void 0===t)return e;e.insert(t)},this.uncache=function(t){e.findDelete("id",t.id)},this.get=function(t,r,i){return e.get(t,r,i)},this.destroy=function(t,r){void 0===r&&(r=!0),t.blur(),"function"==typeof t.destroy&&t.destroy(),"function"==typeof t.__destroy&&t.__destroy(),r&&t.clear(),t.el&&t.el.remove(),t.parent&&t.parent.nodes.findDelete("id",t.id,1),e.findDelete("id",t.id,1)}},"function"!=typeof Object.assign&&Object.defineProperty(Object,"assign",{value:function(t,e){"use strict";if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var r=Object(t),i=1;i<arguments.length;i++){var a=arguments[i];if(null!=a)for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(r[s]=a[s])}return r},writable:!0,configurable:!0});if(void 0===OGX)var OGX={};function require(){OGX.Object.register.apply(null,arguments)}function construct(__that,__cls){var ext=OGX.Object.getExtend(__cls);for(var a in ext)eval("OGX."+ext[a]).call(__that,arguments.callee.caller.arguments[0])}OGX.Object=new OGX.Object;if(OGX.OML=function(e,t){"use strict";var n=e,i=t,o=!1,r=null,a={},s={};function d(){o=!0}function l(e,t){e.construct.apply(e,t)}function u(e,t){var n,i=[];for(var o in t)if(n=/^(\S*)\:Bind$/g.exec(o))if(Array.isArray(t[o]))for(var r=0;r<t[o].length;r++)t[o][r].property=n[1],bpush({uxi:e,config:t[o][r]});else t[o].property=n[1],i.push({uxi:e,config:t[o]});return i}function c(e){setTimeout((function(){O(e.config),e.uxi.bind(e.config)}),0)}function f(e){return e.hasOwnProperty("instance")&&e.instance||e.hasOwnProperty("scroll")&&e.scroll}function p(e,t){if("string"==typeof t["node:OML"])t["node:OML"]=h(t["node:OML"]);else if(Array.isArray(t["node:OML"]))for(var n=0;n<t["node:OML"].length;n++)"string"==typeof t["node:OML"][n]&&(t["node:OML"][n]=h(t["node:OML"][n]));return e.__proto__.hasOwnProperty("placeholder")&&e.placeholder(t),t}function h(e){return 0===e.indexOf("{{")?OGX.OSE.exec(e):OGX.Data.clone(OGX.Cache.read("oml",e))}function O(e,t){var n,o=0;return function e(r){if(!(Array.isArray(r)||"object"!=typeof r||o>=i)){var d=!1;for(var l in r)-1!==l.indexOf(":OSE")?(r[n=l.split(":").shift()]=OGX.OSE.exec(r[l],{},a,t,s),delete r[l],d||(d=!0,o++),e(r[n])):-1!==l.indexOf(":")||"object"!=typeof r[l]||Array.isArray(r[l])||r[l]instanceof HTMLElement||r[l]instanceof jQuery||(d||(d=!0,o++),e(r[l]))}}(e),e}function g(e,t){switch(e){case"scope":return OGX.Scope.fork(t);default:return OGX.OSE.fork(e,t)}}this.get=function(e){return OGX.Cache.read("oml",e)},this.make=function(e,t,n){var i={};return i[e+":"+t]=n,i},this.parse=function(e){return"string"==typeof e&&("{"!==e.substr(0,1)&&(e="{"+e+"}"),e=JSON.parse(e)),e},this.rename=function(e,t,n){function i(e,t,n){var i={};for(var o in e)i[o.replace(t,n)]=e[o];return i}void 0===n&&(n="default"),Array.isArray(n)||(n=[n],t=[t]);for(var o=0;o<n.length;o++)e=i(e,n[o],t[o]);return e},this.getNodeById=function(e,t){return function e(n){var i;for(var o in n){if(n[o].hasOwnProperty("id")&&n[o].id===t)return n[o];if(n[o].hasOwnProperty("node:OML"))if(Array.isArray(n[o]["node:OML"])){for(var r=0;r<n[o]["node:OML"].length;r++)if(i=e(n[o]["node:OML"][r]))return i}else if(i=e(n[o]["node:OML"]))return i}return!1}(e)},this.replaceDataRecursive=function(e,t,n){function i(e){var a,s;for(var d in e)if(-1!==d.indexOf(":OSE"))a=d.split(":"),(s=r(e[d],t,n))&&(e[a[0]]=s,delete e[d],i(e[a[0]]));else if("node:OML"===d)if("string"==typeof e[d]&&0===e[d].indexOf("{{"))e[d]=OGX.OSE.exec(e[d]),o(e[d]);else if(Array.isArray(e[d]))for(var l=0;l<e[d].length;l++)o(e[d][l]);else o(e[d])}function o(e){var o;for(var a in e)-1!==a.indexOf("{{")&&(o=r(a,t,n))&&(e[o]=e[a],delete e[a],a=o),i(e[a])}function r(e,t,n){var i,o,r=/{{([\S ]+)}}/gi;for(a[n]=t;i=r.exec(e);){if(o=OGX.OSE.exec(i[0],{},a),-1!==["string","number"].indexOf(typeof o))e=e.replace(i[0],o);else if(-1!==["boolean","object"].indexOf(typeof o))return o;r.lastIndex=0}return e}o(e)},this.render=function(e,t,i,a,s){t=(t=p(e,{"node:OML":t}))["node:OML"],void 0===s&&(s=!1),n&&(o=!1,r&&clearTimeout(r),r=setTimeout(d,n)),function(e,t,n,i,r){var a=[],s=((new Date).getTime(),[]);function d(e,t){if(!o)if(Array.isArray(e))for(var c=0;c<e.length;c++)d(e[c],t);else{var h,m,v,w,G,X,M,A,_,y,x,E,N,b,P,L;if(!r)for(A in e)-1!==A.indexOf(":Point")&&(h=A.split(":")[0],/^(#|\.)/gi.test(h)?(e[A].el=h,e[A].mode=0):(e[A].el=null,e[A].mode=1,e[A].id=h),e[A].parent=t,e[A].data=n,e[A].route_data=i,M=OGX.Object.create("Point",e[A]),t.add(M),M.parent=t,M.focus(),d(M.oml(),M),delete e[A]);for(A in e)if((N=/((?!:)[\S ]+):(\S+)/gi.exec(A))&&(h=N[1],void 0!==(m=v=N[2])&&(-1!==h.indexOf("{{")&&"object"==typeof e[A]["data:OML"]&&(h=OGX.Templater.make(h,e[A]["data:OML"]),delete e[A]["data:OML"]),-1===["Route","OML"].indexOf(m)))){switch(v.indexOf(".")>0&&(v=v.substr(0,v.indexOf(".")-1)),X=e[A],G=!0,w=!0,b=!1,L=!1,v){case"Uxi":return void e[A].attach(t,h);case"Fork":(E=g(h,e[A]))&&d(E,t),w=!1,G=!1;break;case"Html":X.el=h,X.html=e[A].html,(w=f(X))||(X.template=!1);break;case"Template":X.template=m.split(".")[1],X.el=h,m="Html",w=f(X);break;case"Ghost":X.el=h;break;case"Controller":X.id=h,L=!0;break;default:-1!==[".","#"].indexOf(h.substr(0,1))?X.el=h:(X.id=h,X.el=t.el[0],X.parent=t)}G&&(X=O(X,i)),_=!1,y=!1,w?(r&&(x=r.find("id",X.id.replace(/^#/gi,""),1))&&(y=!0),y?(x.wake(X.el),M=x):M=OGX.Object.create(m,X),t.add(M),_=M):b?(b.blur(),$(h).html(P),b.el=$(h),t.add(b),setTimeout((function(){t.blured||b.focus()}),0)):(_=t,"Html"===m&&OGX.HtmlRender(X)),_&&e[A].hasOwnProperty("node:OML")&&!b&&!y&&(e[A]=p(e,e[A]),d(e[A]["node:OML"],_)),w&&(M.parent=t,"function"==typeof M.construct&&(y||(L?(s.push(M),l(M,[n,i])):M.construct.apply(M,[n,i])))),M&&!L&&(w||y)&&(t.blured||M.floating||M.focus()),void 0!==M&&M&&!L&&(a=a.concat(u(M,e[A])))}}}d(t,e),a.length&&function(e){for(var t=0;t<e.length;t++)c(e[t])}(a);setTimeout((function(){!function(e){for(var t=0;t<e.length;t++)e[t].focus()}(s)}),0)}(e,t,i,a,s)}},void 0===OGX)var OGX={};OGX.Stages={},OGX.Views={},OGX.Controllers={},require("Core","Uxi","Touch"),OGX.Core=function(e){construct(this,"Core");var t=this;void 0===e&&(e={});var n,i=OGX.Data.merge(e,{encrypted:!1,max_render_time:300,max_depth:2,disable_context:!1}),o={jwt:!0,scope:["public"],routing:{routes:{},options:{history:!0,bookmark:!0},errors:{403:!1,404:!1}},stages:{blured:!0,use:!1,closeable:!1,anim:!1},overlays:{delay:200,anim:"fade"},popups:{blured:!1,sleeping:!1},theater:!1,observe:!1,auto_exit:!1,chromeos:!1},r=!1,a=!1,s=!1,d=/(iPhone|iPod|iPad)/i.test(navigator.userAgent),l=matchMedia("(prefers-color-scheme: dark)").matches;function u(e){app.remove(OGX.Popup.NAME,e.id),e.cb&&e.cb(e.params),r.el.trigger(OGX.Popup.CLOSE,e.id)}function c(e){e.matches}function f(){if(r)for(var e=r.gather(""),t=0;t<e.length;t++)e[t]._NAME_!==OGX.Controller.NAME&&([OGX.Popup.NAME,OGX.Window.NAME].includes(e[t]._NAME_)?e[t]._NAME_===OGX.Popup.NAME?e[t].sleeping||(e[t].resize(),e[t].centered&&e[t].center(),e[t].resizeNodes()):e[t]._NAME_===OGX.Window.NAME&&(e[t].sleeping||(e[t].resize(),e[t].resizeNodes())):e[t].sleeping||(e[t].resize(),e[t].resizeNodes()))}function p(){n.routing&&(t.router=new OGX.Router(n.routing),t.router.start()),function(){var e,i,o,a,s,d,l,u=!1;for(var c in n.vapps)i=(e=c.split(":"))[0],o=e[1],(s=OGX.Data.merge(n.vapps[c],n.stages,!1,!0)).id=i,!0===s.use&&(u=i,a=i+"/"+s.home),d=t.addStage(o,s),!0===s.use&&(r=d);u&&(l=n.bookmark&&-1!==window.location.href.indexOf("#")?window.location.href.split("#").pop():a,setTimeout((function(){t.goto(l)}),0),setTimeout((function(){$(document).trigger(OGX.App.READY)}),100))}(),n.theater&&function(){for(var e=app.gather(OGX.Stage.NAME),i=[],o=0;o<e.length;o++)e[o].theater&&i.push(e[o]);n.theater.stages=i,n.theater.el="body",t.theater=t.create("Theater",n.theater)}()}this._NAME_=OGX.App.NAME,this.router=!1,this.isWebView=function(){return s},this.isTouch=function(){return this.touch.touchable()},this.iOS=function(){return d},this.getURL=function(){return r.url},this.isDarkMode=function(){return l},this.toggleTheme=function(){var e="(prefers-color-scheme: ";l?($("head").children('link[data="dark"]').attr("media",e+"light)"),$("head").children('link[data="light"]').attr("media",e+"dark)")):($("head").children('link[data="dark"]').attr("media",e+"dark)"),$("head").children('link[data="light"]').attr("media",e+"light)")),l=!l},this.moveNode=function(e,t,n){e.detach(),e.attach(t,n)},this.addStage=function(e,t){OGX.Data.merge(t,n.stages),t.el="body";var i=OGX.Object.create(e,t);return this.add(i),t.hasOwnProperty("node:OML")&&OGX.OML.render(i,t["node:OML"]),setTimeout((function(){i.construct(t),t.use?(i.el.css("display","block"),i.focus(),a=i):i.sleep()}),0),i},this.removeStage=function(e){var t=this.cfind("Stage",e);t&&(t.destroy(),t.kill(),this.find("Stage",e,"remove"))},this.useStage=function(e){if(!r||r.id!==e){var t=this.cfind("Stage",e);return!!t&&(r&&r.blur(2),(r=t).focus(1),!0)}},this.getStage=function(e){if(void 0===e)return r||a;var t=this.find("Stage",e);return t||!1},this.showStage=function(e,n){if(!r||r.id!==e){var i=this.cfind(OGX.Stage.NAME,e);if(i){if(void 0===n&&(n=i.anim?i.anim:!!a.anim&&a.anim),n){var o=$(window).height();switch(n){case OGX.Stage.SWAP:a&&(i.wake(),a.el.on("transitionend",(function(){a.el.off("transitionend"),a.el.css("top",-o+"px"),i.el.css("top","0px"),i.el.on("transitionend",(function(){i.el.off("transitionend"),i.el.css("transform","scale(1)"),a.el.removeClass("ogx_stage_anim"),a.el.css({top:"0px",transform:"scale(1)"}),a.sleep(),t.el.trigger(OGX.Stage.SWAP,{old:a,new:i}),a=i}))})),i.el.addClass("ogx_stage_anim"),a.el.addClass("ogx_stage_anim"),a.el.css("transform","scale(0.9)")),i.el.css("top",o+"px"),i.el.css("display","block"),i.el.css("transform","scale(0.9)"),i.el.addClass("ogx_stage_anim");break;case OGX.Stage.FLIP:a&&(i.wake(),a.el.on("transitionend",(function(){a.el.off("transitionend"),a.el.removeClass("ogx_stage_anim"),a.el.css("transform","scaleX(1)"),a.sleep(),i.el.css("transform","scaleX(1)"),t.el.trigger(OGX.Stage.SWAP,{old:a,new:i}),a=i})),i.el.addClass("ogx_stage_anim"),i.el.css("transform","scaleX(0)"),a.el.addClass("ogx_stage_anim"),a.el.css("transform","scaleX(0)")),i.el.css("display","block")}}else a&&a.id!==i.id&&a.sleep(),i.sleeping&&i.wake(),i.el.css("display","block"),a=i;t.useStage(e)}}},this.getWindow=function(e){return this.cfind(OGX.Window.NAME,e)},this.getWindows=function(){return this.gather(OGX.Window.NAME)},this.windowExists=function(e){return!1!==this.cfind(OGX.Window.NAME,e)},this.addWindow=function(e,t){if(e=OGX.Data.merge(e,n.windows),void 0===t){if(!a)return!1;t=a}var i;return!!t&&(e.el=t.el,e.parent=t,e.hasOwnProperty("node:OML")?(i=OGX.Object.create(OGX.Window.NAME,e),t.add(i),i.focus(),OGX.OML.render(i,e["node:OML"])):i=t.create(OGX.Window.NAME,e),i)},this.windowOpen=function(e){return this.cfind(OGX.Window.NAME,e).status===OGX.Window.OPEN},this.showWindow=function(e,t,i,o){!0===t&&(t=n.anim);var r=this.cfind(OGX.Window.NAME,e);return!!r&&(r.sleeping&&attachWindow(e),r.blured&&r.focus(),r.show(t,i,o),!0)},this.hideWindow=function(e,t,i,o){!0===t&&(t=n.anim),"string"!=typeof e&&(e=this.findWindow(e).id),this.cfind(OGX.Window.NAME,e).hide(t,i,o)},this.swapWindows=function(e,t){var n,i,o,r;return!(!this.windowExists(e)||!this.windowExists(t))&&(n=this.getWindow(e),i=this.getWindow(t),o=n.el.css("z-index"),r=i.el.css("z-index"),n.el.css("z-index",r),i.el.css("z-index",o),!0)},this.sleepWindow=function(e){this.cfind(OGX.Window.NAME,e).sleep()},this.blurWindow=function(e){this.cfind(OGX.Window.NAME,e).blur()},this.focusWindow=function(e){this.cfind(OGX.Window.NAME,e).focus()},this.removeWindow=function(e){return this.find(OGX.Window.NAME,e,"remove")},this.removeWindows=function(e){for(var t=0;t<e.length;t++)this.removeWindow(e[t]);return!0},this.removeAllWindows=function(e){void 0===e&&(e=[]);for(var t=this.gather(OGX.Window.NAME),n=0;n<t.length;n++)e.includes(t[n].id)&&this.removeWindow(t[n].id)},this.findWindow=function(e){for(var t=e;t.hasOwnProperty("parent")&&t.parent;){if(t.parent._NAME_===OGX.Window.NAME)return t.parent;t=t.parent}return!1},this.addPopup=function(e,t){var i;return void 0!==t&&t||(t=r),e.el=t.el[0],e.parent=t,e.chromeos=n.chromeos,e.hasOwnProperty("node:OML")?(i=OGX.Object.create(OGX.Popup.NAME,e),t.add(i),i.focus(),OGX.OML.render(i,e["node:OML"])):i=t.create(OGX.Popup.NAME,e),setTimeout((function(){i.show()}),0),i},this.removePopup=function(e,t,n,i,o){var r=!1;void 0===o&&(o=a,r=!0),void 0===n&&(n=!1),void 0===i&&(i=!1),void 0===t&&(t=!0);var s=null;return!!(s=r?o.find(OGX.Popup.NAME,e):app.cfind(OGX.Popup.NAME,e))&&(s.hide(t,u,{id:e,cb:n,params:i},null,!0),!0)},this.findPopup=function(e){var t;t=e instanceof HTMLElement?e:e.el;var n=$(t).parents(".ogx_popup");if(n.length){var i=$(n[0]).data("ogx-id");return this.cfind(OGX.Popup.NAME,i)}return!1},this.getVisiblePopups=function(){for(var e=this.gather(OGX.Popup.NAME),t=[],n=0;n<e.length;n++)"visible"===e[n].el.css("visibility")&&t.push(e[n]);return t},this.popupExists=function(e){return!1!==this.cfind(OGX.Popup.NAME,e)},this.groupPopups=function(e,n,i){void 0===i&&(i=null);var o={drag:!0,resize:!0,anim:!1};i&&OGX.Data.merge(o,i,!0);var r=e.id,a=n.id,s=e.nodes.get({_NAME_:{eq:"Container"}},null,1),d=n.nodes.get({_NAME_:{eq:"Container"}},null,1);if(s&&d){var l=s.nodes.get({_NAME_:{eq:"Carousel"}},null,1),u=s.nodes.get({_NAME_:{eq:"Tabs"}},null,1),c=d.nodes.get({_NAME_:{eq:"Carousel"}},null,1),f=(g=d.nodes.get({_NAME_:{eq:"Tabs"}},null,1)).index(),p=l.panels().slice();e.nodes=new OGX.List;for(var h=0;h<p.length;h++)g.add(u[h]),y=p[h].instance?{"default:Uxi":p[h].instance}:{"default:Html":{html:p[h].html}},c.addNode(y,null,!1);f+=u.length,c.showPanel(f,!1),g.index(f),t.removePopup(e.id,!1,!1,!1,e.parent)}else if(s||d){var O,g,m;s?(O=s.nodes.get({_NAME_:{eq:"Carousel"}},null,1),g=s.nodes.get({_NAME_:{eq:"Tabs"}},null,1),E=n):(O=d.nodes.get({_NAME_:{eq:"Carousel"}},null,1),g=d.nodes.get({_NAME_:{eq:"Tabs"}},null,1),E=e),E.nodes.length?((m=E.nodes.slice()[0]).blur(),E.nodes=new OGX.List,y={"default:Uxi":m}):y={"default:Html":{html:E.el.find(".ogx_popup_body").first().html()}};var v=E.title();t.removePopup(E.id,!1,!1,!1,E.parent),O.addNode(y,null,!0),g.add(v),g.index(g.set().length-1)}else{var w=e.nodes;w=!!w.length&&w[0];var G,X,M=n.nodes;M=!!M.length&&M[0],w?(w.detach(),G={"default:Uxi":w}):G={"default:Html":{html:e.el.find(".ogx_popup_body").children().first().detach()}},M?(M.detach(),X={"default:Uxi":M}):X={"default:Html":{html:n.el.find(".ogx_popup_body").children().first().detach()}};var A=n.icons()||e.icons();"boolean"==typeof A&&(A=!1),!(A&&Array.isArray(A)&&A.length)&&(A=!1);var _=this.gather("Popup");_=_.get({id:{in:e.group}});var y={id:e.group+"_"+_.length,width:e.el.width(),height:e.el.height(),title:e.group,group:e.group,icons:A,"node:OML":[{"default:Container":{index:1,tabs:{list:[n.title(),e.title()]},"node:OML":[X,G]}}]};OGX.Data.merge(y,o,!0);var x=e.parent,E=app.addPopup(y,e.parent);this.removePopup(e.id,!1,!1,!1,x),this.removePopup(n.id,!1,!1,!1,x),$(document).trigger(OGX.Popup.GROUP,{popups:[r,a],popup:E})}},this.ungroupPopup=function(e,t,n){var i=e.icons(),o=e.nodes.get({_NAME_:{eq:"Container"}},null,1).nodes.get({_NAME_:{eq:"Carousel"}},null,1),r=o.getPanel(t),a={};if(r.instance){var s=o.nodes.get({id:{eq:r.instance.id},_NAME_:{eq:r.instance._NAME_}},null,1);s&&(a["default:Uxi"]=s)}else a["default:Html"]={html:r.html};o.removePanel(t);var d="popup_"+(new Date).getTime();this.addPopup({id:d,group:e.group,title:n,resize:!0,drag:!0,icons:i,"node:OML":[a]}),$(document).trigger(OGX.Popup.UNGROUP,{from_popup:e.id,from_index:t,to_popup:d})},this.addOverlay=function(e,t){return void 0===t&&(t=a),!!t&&(t.addOverlay(e),!0)},this.removeOverlay=function(e,t){void 0===t&&(t=a),t&&t.removeOverlay(e)},this.theater=!1,this.getJSON=function(e){return OGX.Data.clone(OGX.Cache.read("json",e))},this.getOML=function(e){return OGX.Data.clone(OGX.Cache.read("oml",e))},this.goto=function(e,t){return void 0===t&&(t={}),t=OGX.Data.merge(t,{history:!0,data:null},!1),this.router.goto(e,t)},this.getDefaults=function(e){return n[e]},OGX.Net=new OGX.Net({ios:d,encrypted:i.encrypted}),OGX.Net.load("app.json",(function(e){i.encrypted&&(e=function(e){var t=document.cookie.match("(^|[^;]+)\\s*ogx_key\\s*=\\s*([^;]+)");if(t)return t=decodeURIComponent(t.pop()),document.cookie="ogx_key=; expires=Thu, 01 Jan 1970 00:00:01 GMT;",e=CryptoJS.AES.decrypt(e,t,{mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7}).toString(CryptoJS.enc.Utf8),JSON.parse(e)}(e)),i.disable_context&&(window.oncontextmenu=function(){return!1}),n=e,OGX.Scope=new OGX.Scope(n.jwt),OGX.OML=new OGX.OML(i.max_render_time,i.max_depth),s=void 0!==window.ontouchstart,d&&$("body").addClass("ios"),n=OGX.Data.weld(n,o,!1,!1),t.el=$(document),OGX.Net.preload(n.preload,p),window.addEventListener("resize",f),function(e){if(!0){var t=window.matchMedia("(prefers-color-scheme: dark)");t.addListener(c)}else t.removeListener(c)}()}))},OGX.App=function(e){"use strict";return OGX.Object.create("Core",e)},OGX.App.NAME="App",OGX.App.LOADING="AppLoading",OGX.App.READY="AppReady";if(OGX.Audio=function(){"use strict";var e=!1;this.get=function(e){var t;return!!(t=OGX.Cache.read("snd",e))&&t},this.play=function(t,i,n){void 0===i&&(i=1),void 0===n&&(n=!1);var a=this.get(t);return!!a&&(a.hasOwnProperty("howl")?(a.howl.volume(i),a.howl.loop(n)):a.howl=new Howl({src:["snd/"+a.file],loop:n,volume:i}),e?a.howl.play():setTimeout((function(){a.howl.play()}),0),!0)},this.stop=function(e){if(void 0!==e){var t=this.get(e);if(t)return t.howl.stop(),!0}return!1},this.prepare=function(){for(var e=OGX.Cache.get({ext:{eq:"snd"}}),t=0;t<e.length;t++)e[t].hasOwnProperty("howl")||(e[t].howl=new Howl({src:["snd/"+e[t].file]}))},$(document).on("touchstart mousedown",(function t(){e=!0,$(document).off("touchstart mousedown",t)}))},OGX.Audio=new OGX.Audio,OGX.Bind=function(){"use strict";var e=this,t={object:null,event:null,mode:"eq",action:"filter",property:null,remote_property:null,min_length:0},i={};function n(t,i){var n,o,r,s,l="string"==typeof i.object;function c(t,n){if("object"==typeof n){if(function(t,i){for(var n in t.__p)e.unbindFilter(n);t.__p={}}(i),i.remote_property&&Array.isArray(i.remote_property)){var r=0;for(var s in n)i.__p[i.remote_property[r]]=!0,o(i.remote_property[r],i.mode,n[s]),r++;return}if(i.remote_property)n=i.object._NAME_===OGX.DynamicList.NAME?i.object.getSelection().unique(i.remote_property,!1):n[i.remote_property],o(i.property,i.mode,n),a(i,n);else{if(Array.isArray(i.property)){r=0;for(var s in n)i.__p[i.property[r]]=!0,o(i.property[r],i.mode,n[s]),r++;return}o(i.property,i.mode,n),a(i,n)}}else i.remote_property?o(i.remote_property,i.mode,n):o(i.property,i.mode,n)}function d(e){if(i.min_length&&e.target.value.length<i.min_length&&e.target.value.length)return!1;o(i.property,i.mode,e.target.value)}switch(l?(t&&(i.object={el:$(i.object)},n=i.event),r=d):(t&&(n=OGX[i.object._NAME_].BIND),r=c),i.action){case"render":o=e.bindRender;break;case"filter":o=e.bindFilter}t?(i.object.el.on(n,r),l?d({target:{value:i.object.el.val()}}):(s=i.object.bindValue?i.object.bindValue():i.object.val(),Array.isArray(s)&&s.hasOwnProperty("insert")&&(s=JSON.parse(JSON.stringify(s))),c(0,s))):i.object.el.off(n,r)}function a(e,t){for(var i in t)e.__p[i]=!0}this.bind=function(e){return OGX.Data.merge(e,t),!!e.property&&(e.object&&"string"==typeof e.object&&(e.event="input change",e.action="filter"),e.__p={},i.hasOwnProperty(e.property)||(i[e.property]=[]),i[e.property].push(e),n(!0,e),!0)},this.unbind=function(e){for(var t=0;t<i[e].length;t++)n(!1,i[e][t]);return delete i[e],!0},this.clearBinds=function(){for(var e in i){for(var t=0;t<i[e].length;t++)n(!1,i[e][t]);delete i[e]}}},OGX.Bind.prototype.unbindFilter=function(e){},OGX.Bind.prototype.bindFilter=function(e,t,i){},OGX.Bind.prototype.bindRender=function(e,t){},OGX.Bind.prototype.bindValue=null,OGX.Cache=function(){"use strict";var e=new OGX.List;e.cache("ext","id"),this.read=function(t,i){var n=e.read({ext:t,id:i},null,1);return!!n&&("snd"===n.ext?n:n.data)},this.get=function(t,i){return void 0===i&&(i=0),e.get(t,null,null,i)},this.set=function(t){e=new OGX.List(t)},this.query=function(e){},this.add=function(t){if(Array.isArray(t))for(var i=0;i<t.length;i++)e.insert(t[i]);else e.insert(t)},this.remove=function(t,i){return e.unset({ext:{eq:t},id:{eq:i}},1)},"undefined"!=typeof __array&&this.set(__array)},OGX.Cache=new OGX.Cache,require("Calendar","Uxi","Bind","Touch"),OGX.Calendar=function(e){construct(this,"Calendar");var t,i,n,a,o=this,r=e,s={display_date:moment(),date:!1,format:"YYYY-MM-DD",layouts:[{layout:"MONTH_DAYS",engine:"DAY_NUMBER",config:!1}],layout:0,selectable:!0,mode:"select",swipe:!0,browse:!0,chromeos:!1},l=[],c={x:1,y:1},d=!1,u=!1;function h(e){e?(i.on(o.touch.down,".ogx_calendar_left",f),i.on(o.touch.down,".ogx_calendar_right",f)):(i.off(o.touch.down,".ogx_calendar_left",f),i.off(o.touch.down,".ogx_calendar_right",f))}function f(e){e.preventDefault(),e.stopImmediatePropagation(),u||(u=!0,$(this).hasClass("ogx_calendar_left")?t.swipeLeft():t.swipeRight(),setTimeout((function(){u=!1}),350))}function g(e){e?i.on("click",".ogx_calendar_layout_item",_):i.off("click",".ogx_calendar_layout_item",_)}function _(e){var t,i=$(this),n=i.data("ogx-date");"toggle"===r.mode&&i.hasClass("ogx_calendar_selected_item")?(m(),o.el.trigger(OGX.Calendar.UNSELECT,""),r.date=!1):(m(),t=n,o.el.find('.ogx_calendar_layout_item[data-ogx-date="'+t+'"]').addClass("ogx_calendar_selected_item"),r.date=moment(n),r.display_date=r.date.clone(),o.el.trigger(OGX.Calendar.SELECT,r.date),O()),setTimeout(p,0)}function p(){for(var e=t.getCells(),i=0;i<e.length;i++)0==e[i].offset.x&&0==e[i].offset.y||w(e[i].abs,e[i].rel,e[i].offset,$(e[i].element).children(0)[0])}function m(){o.el.find(".ogx_calendar_selected_item").removeClass("ogx_calendar_selected_item")}function v(){for(var e=t.getCells(),i=0;i<e.length;i++)w(e[i].abs,e[i].rel,e[i].offset,$(e[i].element).children(0)[0])}function y(e){e?(i.on(OGX.GridSwiper.SWIPE_START,(function(){r.selectable&&g(!1)})),i.on(OGX.GridSwiper.SWIPE_END,(function(){r.selectable&&g(!0)})),i.on(OGX.GridSwiper.SWIPE_LEFT,(function(e,t){var i=l[a].value();x(i.value,i.unit),b(l[a].labels(r.display_date))})),i.on(OGX.GridSwiper.SWIPE_RIGHT,(function(e,t){var i=l[a].value();x(-1*i.value,i.unit),b(l[a].labels(r.display_date))})),i.on(OGX.GridSwiper.SWIPE_UP,(function(e,t){a=t.cell.y-1,O(),b(l[a].labels(r.display_date))})),i.on(OGX.GridSwiper.SWIPE_DOWN,(function(e,t){a=t.cell.y-1,O(),b(l[a].labels(r.display_date))}))):(i.off(OGX.GridSwiper.SWIPE_LEFT),i.off(OGX.GridSwiper.SWIPE_RIGHT),i.off(OGX.GridSwiper.SWIPE_UP),i.off(OGX.GridSwiper.SWIPE_DOWN),i.off(OGX.GridSwiper.SWIPE_START),i.off(OGX.GridSwiper.SWIPE_END))}function x(e,t){r.display_date.add(e,t),O()}function O(){var e=l[a].format(r.display_date),t="";r.browse&&(t+='<span class="ogx_calendar_left"></span><span class="ogx_calendar_display_date">'+r.display_date.format(e)+"</span>"),r.date&&(t+='<span class="ogx_calendar_selected_date">'+r.date.format(r.format)+"</span>"),r.browse&&(t+='<span class="ogx_calendar_right"></span>'),i.children(".ogx_calendar_head").children(".ogx_calendar_head_date").html(t)}function b(e){i.children(".ogx_calendar_head").children(".ogx_calendar_head_labels").html(e)}function w(e,t,i,n){if(t.y-1>=0&&t.y-1<r.layouts.length){var o=$(n),s=l[a].value(),c=r.display_date.clone().add(i.x*s.value,s.unit),d=l[t.y-1].html(c,OGX.CalendarEngine[r.layouts[t.y-1].engine],r.layouts[t.y-1].config,r.date);o.html(d)}}function G(e,t){return OGX.CalendarLayout[e].prototype=Object.create(OGX.CalendarLayout.BASE_LAYOUT.prototype),OGX.CalendarLayout[e].prototype.constructor=OGX.CalendarLayout[e],new OGX.CalendarLayout[e](t)}this._NAME_=OGX.Calendar.NAME,this.el=null,this.enable=function(){d||(d=!0,r.selectable&&g(!0),y(!0),r.browse&&h(!0))},this.disable=function(){d&&(d=!1,r.selectable&&g(!1),y(!1),r.browse&&h(!1))},this.resize=function(){this.resizeNodes()},this.val=function(e){return void 0!==e&&(r.date=e,moment.isMoment(r.date)||(r.date=moment(r.date)),r.display_date=r.date.clone(),O(),setTimeout(v,0)),r.date?r.date:""},this.refresh=function(){setTimeout(v,0)},this.display=function(e){return void 0!==e?(r.display_date=e,moment.isMoment(r.display_date)||(r.display_date=moment(r.display_date)),O(),setTimeout(v,0),!0):r.display_date},this.axis=function(e,t){r.axis.x=e,r.axis.y=t},this.getLayout=function(){return a},function(){for(var e in s)r.hasOwnProperty(e)||(r[e]=s[e]);o.el=i=$(r.el),i.addClass("ogx_calendar"),r.date&&(moment.isMoment(r.date)||(r.date=moment(r.date)),r.display_date=r.date.clone()),r.display_date?moment.isMoment(r.display_date)||(r.display_date=moment(r.display_date)):r.display_date=moment(),a=r.layout,c.y=a+1}(),i.html('<div class="ogx_calendar_head"><div class="ogx_calendar_head_date"></div><div class="ogx_calendar_head_labels"></div></div><div class="ogx_calendar_body"></div>'),function(){n=[[!1,!1,!1]];for(var e=0;e<r.layouts.length;e++)n.push([w,w,w]);n.push([!1,!1,!1])}(),function(){for(var e=0;e<r.layouts.length;e++)l.push(G(r.layouts[e].layout,{}))}(),t=o.create("GridSwiper",{el:r.el+" .ogx_calendar_body",loop:!0,map:n,start:{x:1,y:a+1},chromeos:r.chromeos,enabled:r.swipe}),O(),b(l[a].labels(r.display_date)),o.enable()},OGX.Calendar.NAME="Calendar",OGX.Calendar.SELECT="CalendarSelect",OGX.Calendar.UNSELECT="CalendarUnselect",OGX.Calendar.BIND=OGX.Calendar.SELECT+" "+OGX.Calendar.UNSELECT,OGX.CalendarLayout={},OGX.CalendarLayout.BASE_LAYOUT=function(){"use strict";this.labels=function(e){return""},this.html=function(e,t,i,n){return""},this.value=function(){return{value:1,unit:"months"}},this.format=function(){return"YYYY-MM"}},OGX.CalendarLayout.MONTH_DAYS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(){for(var e="",t=function(){for(var e=new Date(Date.UTC(2017,0,2)),t=[],i=0;i<7;i++)t.push(e.toLocaleDateString(navigator.language,{weekday:"short"})),e.setDate(e.getDate()+1);return t}(),i=0;i<t.length;i++)e+='<span class="ogx_calendar_layout_month_days_label">'+t[i]+"</span>";return e},this.html=function(e,t,i,n){var a,o=e.format("MM"),r=moment(e.format("YYYY-MM-")+"01").day(),s=moment(e.format("YYYY-MM-")+"01").subtract(r,"days"),l="";n&&(l=n.format("YYYY-MM-DD"));for(var c,d="",u=0;u<42;u++)c="",a=s.format("YYYY-MM-DD"),s.format("MM")!==o&&(c+="ogx_calendar_layout_month_days_offset "),a===moment().format("YYYY-MM-DD")&&(c+="ogx_calendar_layout_month_days_today "),n&&l===a&&(c+="ogx_calendar_selected_item "),d+='<div class="ogx_calendar_layout_item ogx_calendar_layout_month_days '+c+'" data-ogx-date="'+a+'">'+t(a,i)+"</div>",s.add(1,"days");return d},this.value=function(){return{value:1,unit:"months"}},this.format=function(){return"YYYY-MM"}},OGX.CalendarLayout.CENTURY_DECADES=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_century_decades_label">'+100*Math.floor(Number(e.format("YYYY"))/100)+"'s</span>"},this.html=function(e,t,i,n){var a,o,r=moment(),s=100*Math.floor(Number(r.format("YYYY"))/100),l=10*Math.floor(Number(r.format("YYYY").substr(2))/10),c=100*Math.floor(Number(e.format("YYYY"))/100),d=0,u=0;n&&(d=100*Math.floor(Number(n.format("YYYY"))/100),u=10*Math.floor(Number(n.format("YYYY").substr(2))/10));for(var h="",f=0;f<10;f++)o="",s+l===c+(a=10*f)&&(o="ogx_calendar_layout_century_decades_current "),d+u===c+a&&(o+="ogx_calendar_selected_item "),h+='<div class="ogx_calendar_layout_item ogx_calendar_layout_century_decades '+o+'" data-ogx-date="'+(c+a)+'-01-01">'+t(c+a,i)+"</div>";return h},this.value=function(){return{value:100,unit:"years"}},this.format=function(){return"YYYY"}},OGX.CalendarLayout.CENTURY_YEARS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_century_decades_label">'+100*Math.floor(Number(e.format("YYYY"))/100)+"'s</span>"},this.html=function(e,t,i,n){var a,o=moment(),r=100*Math.floor(Number(o.format("YYYY"))/100),s=Number(o.format("YYYY").substr(2)),l=100*Math.floor(Number(e.format("YYYY"))/100),c=0,d=0;n&&(c=100*Math.floor(Number(n.format("YYYY"))/100),d=Math.floor(Number(n.format("YYYY").substr(2))));for(var u="",h=0;h<100;h++)a="",l+h===r+s&&(a+="ogx_calendar_layout_century_years_current "),l+h===c+d&&(a+="ogx_calendar_selected_item"),u+='<div class="ogx_calendar_layout_item ogx_calendar_layout_century_years '+a+'" data-ogx-date="'+(l+h)+'-01-01">'+t(l+h+"-01-01",i)+"</div>";return u},this.value=function(){return{value:100,unit:"years"}},this.format=function(){return"Y"}},OGX.CalendarLayout.DECADE_YEARS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_century_years_label">'+10*Math.floor(Number(e.format("YYYY"))/10)+"'s</span>"},this.html=function(e,t,i,n){var a,o=10*Math.floor(Number(e.format("YYYY"))/10),r="",s=Number(moment().format("YYYY")),l="";n&&(l=Number(n.format("YYYY")));for(var c=0;c<10;c++)a="",o+c===s&&(a+="ogx_calendar_layout_decade_years_current "),o+c===l&&(a+="ogx_calendar_selected_item "),r+='<div class="ogx_calendar_layout_item ogx_calendar_layout_decade_years '+a+'" data-ogx-date="'+(o+c)+'-01-01">'+t(o+c+"-01-01",i)+"</div>";return r},this.value=function(){return{value:10,unit:"years"}},this.format=function(){return"Y"}},OGX.CalendarLayout.DECADE_MONTHS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){for(var t=10*Math.floor(Number(e.format("YYYY"))/10),i=Number(String(t).substr(2,2)),n="",a=0;a<10;a++)n+='<span class="ogx_calendar_layout_decade_months_label">\''+i+"</span>",i++;return n},this.html=function(e,t,i,n){var a,o,r,s,l=10*Math.floor(Number(e.format("YYYY"))/10),c="",d=moment().format("YYYY-MM");n&&(a=n.format("YYYY-MM"));for(var u=0;u<12;u++){s=u+1;for(var h=0;h<10;h++)o="",(r=l+h+"-"+(s<10?"0"+s:s))===d&&(o="ogx_calendar_layout_decade_months_current "),r===a&&(o+="ogx_calendar_selected_item "),moment(r+"-01"),c+='<div class="ogx_calendar_layout_item ogx_calendar_layout_decade_months '+o+'" data-ogx-date="'+r+'-01">'+t(r+"-01",i)+"</div>"}return c},this.value=function(){return{value:10,unit:"years"}},this.format=function(e){return"["+10*Math.floor(Number(e.format("YYYY"))/10)+"'s]"}},OGX.CalendarLayout.YEAR_MONTHS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_year_months_label">Months</span>'},this.html=function(e,t,i,n){var a,o,r=moment().format("YYYY-MM"),s=e.format("YYYY"),l="",c="";n&&(c=n.format("YYYY-MM"));for(var d=1;d<13;d++)a="",s+"-"+(o=d<10?"0"+d:d)===r&&(a+="ogx_calendar_layout_year_months_current "),s+"-"+o===c&&(a+="ogx_calendar_selected_item "),l+='<div class="ogx_calendar_layout_item ogx_calendar_layout_year_months '+a+'" data-ogx-date="'+s+"-"+o+'-01">'+t(s+"-"+o+"-01",i)+"</div>";return l},this.value=function(){return{value:1,unit:"years"}},this.format=function(){return"Y"}},OGX.CalendarLayout.YEAR_WEEKS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_year_weeks_label">Weeks</span>'},this.html=function(e,t,i,n){var a=moment().week(),o=e.format("YYYY"),r=moment().format("YYYY"),s="",l="";n&&(l=n.week(),s=n.format("YYYY"));for(var c,d,u="",h=1;h<53;h++)c="",a===h&&o===r&&(c="ogx_calendar_layout_year_weeks_current "),l===h&&o===s&&(c+="ogx_calendar_selected_item "),u+='<div class="ogx_calendar_layout_item ogx_calendar_layout_year_weeks '+c+'" data-ogx-date="'+(d=moment().year(o).week(h).format("YYYY-MM-DD"))+'">'+t(d,i)+"</div>";return u},this.value=function(){return{value:1,unit:"years"}},this.format=function(){return"Y"}},OGX.CalendarLayout.YEAR_DAYS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_year_weeks_label">Nth Day</span>'},this.html=function(e,t,i,n){var a,o,r,s="",l=e.format("YYYY-MM-DD"),c=moment(e.format("YYYY")+"-01-01"),d="";n&&(d=n.format("YYYY-MM-DD")),o=e.isLeapYear()?366:365;for(var u=0;u<o;u++)a="",(r=c.format("YYYY-MM-DD"))===l&&(a="ogx_calendar_layout_year_days_current "),r===d&&(a+="ogx_calendar_selected_item "),s+='<div class="ogx_calendar_layout_item ogx_calendar_layout_year_days '+a+'" data-ogx-date="'+r+'">'+t(r,i)+"</div>",c.add(1,"days");return s},this.value=function(){return{value:1,unit:"years"}},this.format=function(){return"Y"}},OGX.CalendarLayout.MONTH_WEEKS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_year_weeks_label">Nth Week</span>'},this.html=function(e,t,i,n){var a,o="",r=moment(),s=Number(r.format("YYYY")),l=Number(r.format("w")),c=Number(e.format("YYYY")),d=0,u=0;n&&(d=Number(n.format("YYYY")),u=Number(n.format("w")));o="";for(var h,f=moment(e.format("YYYY-MM-[01]")),g=0;g<5;g++)h="",a=Number(f.format("w")),c===d&&a===u&&(h+="ogx_calendar_selected_item "),c===s&&a===l&&(h+="ogx_calendar_layout_month_weeks_current"),o+='<div class="ogx_calendar_layout_item ogx_calendar_layout_month_weeks '+h+'" data-ogx-date="'+f.format("YYYY-MM-DD")+'">'+t(f.format("YYYY-MM-DD"),i)+"</div>",f.add(7,"days");return o},this.value=function(){return{value:1,unit:"months"}},this.format=function(){return"[(]YYYY-MM[)] W"}},OGX.CalendarLayout.WEEK_DAYS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){for(var t="",i=function(){for(var e=new Date(Date.UTC(2017,0,2)),t=[],i=0;i<7;i++)t.push(e.toLocaleDateString(navigator.language,{weekday:"short"})),e.setDate(e.getDate()+1);return t}(),n=function(e){for(var t=e.clone(),i=t.day(),n=t.subtract(i,"day"),a=[],o=0;o<7;o++)a.push(n.format("DD")),n.add(1,"day");return a}(e),a=0;a<i.length;a++)t+='<span class="ogx_calendar_layout_month_days_label">'+i[a]+" "+n[a]+"</span>";return t},this.html=function(e,t,i,n){var a,o,r="",s=e.weekday(),l=e.subtract(s,"days"),c=moment().format("YYYY-MM-DD"),d="";n&&(d=n.format("YYYY-MM-DD"));for(var u=0;u<7;u++)a="",(o=l.format("YYYY-MM-DD"))===c&&(a="ogx_calendar_layout_week_days_current "),o===d&&(a+="ogx_calendar_selected_item "),r+='<div class="ogx_calendar_layout_item ogx_calendar_layout_week_days '+a+'" data-ogx-date="'+o+'">'+t(o,i)+"</div>",l.add(1,"days");return r},this.value=function(){return{value:1,unit:"weeks"}},this.format=function(){return"YYYY-MM (wo [week])"}},OGX.CalendarLayout.DAY_HOURS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_day_hours_label">Hours</span>'},this.html=function(e,t,i,n){var a,o,r="",s=Number(moment().format("HH")),l=e.format("YYYY-MM-DD "),c=moment().format("YYYY-MM-DD "),d="",u="";n&&(d=Number(n.format("HH")),u=n.format("YYYY-MM-DD "));for(var h=0;h<24;h++)o="",h===s&&l===c&&(o="ogx_calendar_layout_days_hours_current "),h===d&&l===u&&(o+="ogx_calendar_selected_item "),r+='<div class="ogx_calendar_layout_item ogx_calendar_layout_days_hours '+o+'" data-ogx-date="'+(l+(a=h<10?"0"+h:String(h)))+':00">'+t(l+a+":00",i)+"</div>";return r},this.value=function(){return{value:1,unit:"days"}},this.format=function(){return"YYYY-MM-DD HH:[00]"}},OGX.CalendarLayout.DAY_WORK_HOURS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_day_work_hours_label">Work Hours</span>'},this.html=function(e,t,i,n){i&&void 0!==i?i.hasOwnProperty("start")||(i.start=8,i.end=17):i={start:8,end:17};var a,o,r="",s=Number(moment().format("HH")),l=e.format("YYYY-MM-DD "),c=moment().format("YYYY-MM-DD "),d="",u="";n&&(d=Number(n.format("HH")),u=n.format("YYYY-MM-DD "));for(var h=i.start;h<i.end+1;h++)o="",h===s&&l===c&&(o="ogx_calendar_layout_days_work_hours_current "),h===d&&u===l&&(o+="ogx_calendar_selected_item "),r+='<div class="ogx_calendar_layout_item ogx_calendar_layout_days_work_hours '+o+'" data-ogx-date="'+(l+(a=h<10?"0"+h:h))+':00">'+t(l+a+":00",i)+"</div>";return r},this.value=function(){return{value:1,unit:"days"}},this.format=function(){return"YYYY-MM-DD HH:[00]"}},OGX.CalendarLayout.DAY=function(e){"use strict";this.labels=function(e){return'<span class="ogx_calendar_layout_day_label">'+function(e){for(var t=new Date(Date.UTC(2017,0,2)),i=[],n=e.day(),a=0;a<7;a++)i.push(t.toLocaleDateString(navigator.language,{weekday:"long"})),t.setDate(t.getDate()+1);return i[n]}(e)+"</span>"},this.html=function(e,t,i,n){var a="",o=e.format("YYYY-MM-DD"),r=moment().format("YYYY-MM-DD");return n&&o===n.format("YYYY-MM-DD")&&(a+="ogx_calendar_selected_item "),o===r&&(a+="ogx_calendar_layout_day_current "),'<div class="ogx_calendar_layout_item ogx_calendar_layout_day '+a+'" data-ogx-date="'+o+'">'+t(o,i)+"</div>"},this.value=function(){return{value:1,unit:"days"}},this.format=function(){return"YYYY-MM-DD"},this.select=function(e){}},OGX.CalendarEngine={},OGX.CalendarEngine.CELL_VALUE=function(e,t){var i=moment(e);return t.hasOwnProperty("css")||(t.css=""),'<div class="ogx_calendar_engine_cell_value '+t.css+'">'+i.format(t.format)+"</div>"},OGX.CalendarEngine.DAY_NUMBER=function(e,t){var i=moment(e);return OGX.CalendarEngine.CELL_VALUE(i,{format:"DD",css:"ogx_calendar_engine_day_number"})},OGX.CalendarEngine.WEEK_NUMBER=function(e,t){return'<div class="ogx_calendar_engine_week_number">'+moment(e).week()+"</div>"},OGX.CalendarEngine.MONTH_NUMBER=function(e,t){return OGX.CalendarEngine.CELL_VALUE(e,{format:"MM",css:"ogx_calendar_engine_month_number"})},OGX.CalendarEngine.YEAR_NUMBER=function(e,t){return OGX.CalendarEngine.CELL_VALUE(e,{format:"YY",css:"ogx_calendar_engine_year_number"})},OGX.CalendarEngine.DECADE_NUMBER=function(e){return'<div class="ogx_calendar_engine_date_day_number">'+String(e).substr(2)+"'s</div>"},require("Carousel","Uxi","Placeholder","Touch"),OGX.Carousel=function(e){construct(this,"Carousel");var t,i,n,a,o,r,s=this,l=e,c={min_x:100,anim:!0,drag:!0,drag_left:!0,drag_right:!0,dots:!1,css:!1,index:0,capture:!1},d={position:"bottom"},u=!1,h=0,f=0,g=new OGX.List,_="ogx_carousel";function p(e){if(void 0!==e&&g[e]&&g[e].instance){var t=s.find(g[e].instance._NAME_,g[e].instance.id);t&&t.blur(2)}}function m(e){if(void 0!==e&&g[e]&&g[e].instance){var t=s.find(g[e].instance._NAME_,g[e].instance.id);t&&t.focus(1)}}function v(e){i.off("transitionend"),i.removeClass(_+"_anim")}function y(e){if(e.dirX){if(-1===e.dirX&&!l.drag_right)return;if(1===e.dirX&&!l.drag_left)return}if(e.distX>e.distY){var t=r*n*-1+e.distX*e.dirX;t<=0&&t>-1*(i.width()-s.el.width())&&i.css({transform:"translate3d("+t+"px, 0, 0)"})}}function x(e){if(e.distX>l.min_x){var i=r+-1*e.dirX;i>=0&&i<f&&r!==i&&(p(r),r=i,t.trigger(OGX.Carousel.CHANGE,r))}var n=0;r&&(n=100/f*(-1*r)),O(n,r,!0)}function O(e,t,n){n?(i.addClass(_+"_anim"),i.on("transitionend",(function(){i.off("transitionend"),i.removeClass(_+"_anim"),m(t)}))):(i.removeClass(_+"_anim"),m(t)),i.css({transform:"translate3d("+e+"%, 0, 0)"})}function b(){u=!0,clearInterval(a),a=setInterval(w,50),n=Math.floor(t.innerWidth()),i.removeClass(_+"_anim")}function w(){u=!1,clearInterval(a),a=!1}function G(){var e,t,n;f&&(g.clear(),i.children("."+_+"_view").each((function(i,a){e=$(a),(t=e.children(":first")).length?(t[0].hasAttribute("data-ogx-id")&&(n=t.data("ogx-id"),t.hasClass("ogx_scroller_outer")&&(n=t.find(".ogx_scroller_inner:first").data("ogx-id"))),void 0!==s.nodes[i]&&(i!==r?s.nodes[i].blur():s.nodes[i].focus(),g.push({index:i,instance:s.nodes.get({id:{eq:String(n)}},null,1),html:!1}))):g.push({index:i,instance:!1,html:e.html()})})))}function X(){for(var e=[],n=0;n<f;n++)i.append('<div class="'+_+'_view" style="width:'+100/f+'%;" data-ogx-panel-id="'+h+'"></div>'),e.push("."+_+'[data-ogx-id="'+s.id+'"] > .'+_+"_views > ."+_+'_view[data-ogx-panel-id="'+h+'"]'),h++;i.css("width",100*f+"%"),s.placeholders(l,e),t.trigger(OGX.Carousel.READY)}this._NAME_=OGX.Carousel.NAME,this.el=null,this.construct=function(){G(),l.index&&this.showPanel(l.index,!1)},this.enable=function(){l.drag&&this.touch.swipe.enable(),setTimeout((function(){for(var e=0;e<g.length;e++)g[e].instance&&(e!==r?g[e].instance.blur():g[e].instance.focus())}),0)},this.disable=function(){l.drag&&this.touch.swipe.disable()},this.focus=function(){this.blured&&(this.blured=!1,this.enabled&&(this.ux(!0),this.enable()))},this.resize=function(){setTimeout(b,0)},this.show=function(e,t){var i=this.getNodeIndex(e,t);i&&this.showPanel(i.index)},this.getNodeIndex=function(e,t){var i=g.get({"instance.id":{eq:t},"instance._NAME_":{eq:e}},null,1);return!!i&&{index:i.index}},this.anim=function(e){if(void 0===e)return l.anim;l.anim=e},this.drag=function(e){if(void 0===e)return l.drag;l.drag!==e&&(l.drag?this.touch.swipe.disable():this.touch.swipe.enable(),l.drag=e)},this.dragLeft=function(e){if(void 0===e)return l.drag_left;l.drag_left=e},this.dragRight=function(e){if(void 0===e)return l.drag_right;l.drag_right=e},this.destroy=function(){a&&clearInterval(a),l.dots&&o.destroy()},this.val=function(e){if(void 0===e)return r;this.showPanel(e)},this.prev=function(){r>0&&this.showPanel(r-1)},this.next=function(){r+1<f&&this.showPanel(r+1)},this.panels=function(){return g},this.addNode=function(e,n,a,o){void 0===a&&(a=!1),void 0===o&&(o=!1);var r=function(e){void 0===e&&(e="");return f++,i.append('<div class="'+_+'_view" style="width:'+100/f+'%;" data-ogx-panel-id="'+h+'">'+e+"</div>"),i.css("width",Math.round(100*f)+"%"),i.children("."+_+"_view").css("width",100/f+"%"),++h-1}(),l="."+_+'[data-ogx-id="'+this.id+'"] > .'+_+"_views > ."+_+'_view[data-ogx-panel-id="'+r+'"]',c={},d=l;if(e.hasOwnProperty("_NAME_"));else{for(var u in e){d+=":"+u.split(":")[1],c[d]=e[u];break}var g=null;setTimeout((function(){s.observe(!0,{childList:!0,subtree:!0},(function(){s.observe(!1),g&&clearTimeout(g),g=setTimeout(G,20),a&&s.showPanel(f-1,o)})),OGX.OML.render(s,c,n)}),0)}return t.trigger(OGX.Carousel.ADDED,f),!0},this.removeNode=function(e){for(var t=0;t<g.length;t++)if(g[t].instance.id===e)return this.removePanel(t),!0;return!1},this.showPanel=function(e,t,i){if((void 0===i&&(i=!1),e>=0&&e<f&&!u)&&((a=r)!==e||i)){void 0===t&&(t=l.anim),r!==e&&p(r);var n=100/f*(-1*e),a=e;return setTimeout((function(){O(n,a,t)}),0),r=e,l.dots&&o.select(e),!0}return!1},this.getPanel=function(e){return g.get({index:{eq:e}},null,1)},this.swapPanels=function(e,n){var a=i.children("."+_+"_view:eq("+e+")").detach();n>e?i.children("."+_+"_view:eq("+(n-1)+")").after(a):i.children("."+_+"_view:eq("+n+")").before(a);var o=100/f*(-1*n);i.removeClass(_+"_anim"),i.css({transform:"translate3d("+o+"%, 0, 0)"}),r=n,setTimeout(G,0),t.trigger(OGX.Carousel.CHANGE,r)},this.removePanel=function(e,n){if(void 0===n&&(n=!0),e>=0&&e<f){var a=null;if(n&&(n="remove"),i.children("."+_+"_view:eq("+e+")").children().data("ogx-id")){var o=g[e];o.instance&&(a=this.find(o.instance._NAME_,o.instance.id,n))&&(n||a.detach()),g.splice(e,1)}return f--,i.children("."+_+"_view:eq("+e+")").remove(),i.removeClass(_+"_anim").css("width",Math.round(100*f)+"%"),i.children("."+_+"_view").css("width",100/f+"%"),e>=r?e--:e=r,e<0&&(e=0),s.showPanel(e,!1,!0),t.trigger(OGX.Carousel.REMOVED,f),a}return!1},this.empty=function(){this.clear(),i.empty(),i.removeClass(_+"_anim").css("width","100%"),i.css({transform:"translate3d(0%, 0, 0)"}),f=0,g=new OGX.List,l.index=0,l["node:OML"]=[]},this.render=function(e,t){l["node:OML"]=e,f=l["node:OML"].length,X(),OGX.OML.render(this,l["node:OML"],t)},OGX.Data.merge(l,c,!1),l.dots&&("boolean"==typeof l.dots&&(l.dots={}),OGX.Data.merge(l.dots,d)),r=l.index,s.el=t=$(l.el),n=Math.floor(t.innerWidth()),l.hasOwnProperty("node:OML")&&(f=l["node:OML"].length),function(){t.addClass(_);var e="";l.dots&&"top"===l.dots.position&&(e+='<div class="carousel_dots"></div>'),e+='<div class="'+_+'_views" style="width:'+100*f+'%;"></div>',l.dots&&"bottom"===l.dots.position&&(e+='<div class="carousel_dots"></div>'),t.append(e),(i=t.find("."+_+"_views:first")).css({transform:"translate3d("+100/f*(-1*r)+"%, 0, 0)"})}(),l.dots&&(o=s.create("Dots",{el:"."+_+'[data-ogx-id="'+s.id+'"] > .carousel_dots',total:f})).bind("dots",s),X(),s.touch.swipe.set({x:!0,cb_down:v,cb_swipe:y,cb_up:x,capture:l.capture}),l.drag||s.drag(!1)},OGX.Carousel.NAME="Carousel",OGX.Carousel.READY="CarouselReady",OGX.Carousel.DRAG="CarouselDrag",OGX.Carousel.CHANGE="CarouselChange",OGX.Carousel.RESTORE="CarouselRestore",OGX.Carousel.ADDED="CarouselAdded",OGX.Carousel.REMOVED="CarouselRemoved",void 0===OGX)var OGX={};require("Chat","Uxi","Touch"),OGX.Chat=function(__config){construct(this,"Chat");var that=this,config=__config,config_default={placeholder:"Type a message",dot_speed:600,on_keyb_update_delay:300,messages:[],handle_keyboard:!0,hide_keyboard_on_send:!1,emojis:!1,template_left:'<div class="ogx_chat_message ogx_chat_message_left" style="{{$opacity}} data-id="{{$uid}}"><span class="ogx_chat_message_icon" style="{{$bg}}"><span>{{$letter}}</span></span><span class="ogx_chat_message_container"><span class="ogx_chat_message_body">{{$body}}</span><span class="ogx_chat_message_date">{{$date}}</span><span style="clear:both"></span></span></div>',template_right:'<div class="ogx_chat_message ogx_chat_message_right" style="{{$opacity}}" data-id="{{$uid}}"><span class="ogx_chat_message_container"><span class="ogx_chat_message_body">{{$body}}</span><span class="ogx_chat_message_date">{{$date}}</span><span style="clear:both"></span></span></div>',key:"_id",from_key:"from",users:[],user:!1,display_mode:OGX.Chat.DISPLAY_INITIALS,picture_key:"",restrict:{multiline:!1,length:500,allowed:/./},date_format:"YYYY-MM-DD h:mm:ss A",url_encode:!0},emojis_default={template:'<span class="ogx_chat_emoji">{{$emoji}}</span>',button:!1,list:[],map:{emoji:"char",search:"name"}},container,inner,scroller,composer,emojis,emoji_list,intv,oldh=!1,typing={},type=".",enabled=!1;function render(){if(config.messages.length>0){for(var e=0;e<config.messages.length;e++)addMessage(config.messages[e]);scroller.resize(),scroller.bottom()}scroller.vocal()}function addMessage(__msg,__prepend){void 0===__prepend&&(__prepend=!1),scroller.observe(!1),scroller.mute();var u=config.users.find(config.key,__msg[config.from_key],1);if(u){var initals=u.first_name.substr(0,1).toUpperCase()+u.last_name.substr(0,1).toUpperCase();switch(config.display_mode){case OGX.Chat.DISPLAY_INITIALS:__msg.letter=initals,__msg.bg="";break;case OGX.Chat.DISPLAY_PICTURE:__msg.letter="";var e=eval("u."+config.picture_key);"undefined"!==e?__msg.bg="background-image:url('"+e+"')":(__msg.letter=initals,__msg.bg="")}__msg.uid=u[config.key],__msg.opacity=__prepend?"opacity:1;":"",config.url_encode&&(__msg.body=decodeURIComponent(__msg.body));var html=OGX.Templater.make(getTemplate(__msg),__msg);__prepend?inner.prepend(html):inner.append(html);var msg=inner.children(".ogx_chat_message:last");setTimeout((function(){msg.addClass("ogx_chat_message_anim"),scroller.resize(),__prepend||scroller.bottom(),scroller.vocal(),scroller.observe(!0)}),100)}}function addTyping(e){typing[e]=!0;var t='<div class="ogx_chat_typing" data-user="'+e+'"><span class="ogx_chat_typing_body">.</div></div>';inner.append(t),animTyping(!0)}function removeTyping(e){typing[e]=!1,inner.find('.ogx_chat_typing[data-user="'+e+'"]').remove(),0===inner.find(".ogx_chat_typing").length&&animTyping(!1)}function animTyping(e){e?intv||(intv=setInterval(typeDot,config.dot_speed)):(clearInterval(intv),intv=null)}function typeDot(){(type+=".").length>3&&(type="."),inner.find(".ogx_chat_typing_body").html(type)}function getTemplate(e){return e[config.from_key]===config.user?config.template_right:config.template_left}function sendMessage(){var e=composer.find("textarea").val();if(e.length&&(e=(e=(e=e.replace(/^[\r|\n\r]+/,"")).replace(/<\/?[^>]+(>|$)/g,"")).replace(/’/,"'")).length){var t={body:e=e.replace(/[\r\n]/g,"<br>"),date:moment().format(config.date_format)};t[config.from_key]=config.user,addMessage(t);var i=OGX.Data.clone(t);config.url_encode&&(i.body=encodeURIComponent(i.body)),delete i.bg,delete i.letter,composer.find("textarea").val(""),that.el.trigger(OGX.Chat.SEND_MESSAGE,i)}}function handleShowKeyb(e){oldh||(oldh=container.height()),container.height(oldh-e.keyboardHeight),updateScroller()}function handleHideKeyb(){container.height(oldh),updateScroller()}function updateScroller(){setTimeout((function(){scroller.resize(),scroller.bottom()}),config.on_keyb_update_delay)}function renderEmojis(){var e,t=[];config.emojis.list=config.emojis.list.slice(0,250);for(var i=0;i<config.emojis.list.length;i++)for(var n in e=OGX.Data.clone(config.emojis.list[i]),config.emojis.map)e[n]=e[config.emojis.map[n]],t.push(e);(emoji_list=that.create("DynamicList",{el:'.ogx_chat[data-ogx-id="'+that.id+'"] .ogx_chat_emojis_list',key:"codes",scroll:!0,display:{html:"{{$emoji}}",css:"ogx_chat_emoji"},list:t})).bind({object:'.ogx_chat[data-ogx-id="'+that.id+'"] .ogx_chat_emoji_search',property:config.emojis.map.search,mode:"in"})}function showEmojis(e){e?emojis.removeClass("ogx_chat_emojis_hidden"):emojis.addClass("ogx_chat_emojis_hidden"),listenEmojis(e)}function listenEmojis(e){e?emojis.on(that.touch.down,".ogx_chat_emoji",(function(e){var t=that.el.find(".ogx_chat_composer .ogx_chat_composer_input textarea"),i=t.val()+$(this).text();t.val(i)})):emojis.off(that.touch.down,".ogx_chat_emoji")}function listenKeyb(e){e?(window.addEventListener("native.keyboardshow",handleShowKeyb),window.addEventListener("native.keyboardhide",handleHideKeyb)):(window.removeEventListener("native.keyboardshow",handleShowKeyb),window.removeEventListener("native.keyboardhide",handleHideKeyb))}function listenArea(e){e?composer.on("keyup","textarea",(function(e){13===e.which&&(sendMessage(),config.hide_keyboard_on_send&&handleHideKeyb())})):composer.off("keyup","textarea")}function listenComposer(e){e?(composer.on("click",".ogx_chat_composer_send",(function(){sendMessage(),config.hide_keyboard_on_send&&handleHideKeyb()})),config.emojis&&composer.on("click",".ogx_chat_composer_emoji",(function(){showEmojis(emojis.hasClass("ogx_chat_emojis_hidden"))}))):(composer.off("click",".ogx_chat_composer_send"),config.emojis&&composer.off("click",".ogx_chat_composer_emoji"))}function initScroller(){scroller=that.create("Scroller",{el:that.el.find(".ogx_chat_messages")[0],initDelay:100,auto_scroll:!0,trigger:!0}),inner=scroller.inner(),(inner=$(inner)).addClass("ogx_chat_messages_inner"),scroller.mute(),scroller.resize(),render()}function initMarkup(){var e='<div class="ogx_chat_messages"></div>';config.emojis&&(e+='<div class= "ogx_chat_emojis ogx_chat_emojis_hidden"><input class="ogx_chat_emoji_search" type="text" placeholder="search"><span class="ogx_chat_emojis_list"></span></div>'),e+='<div class="ogx_chat_composer">',e+='<span class="ogx_chat_composer_input"><textarea placeholder="'+config.placeholder+'">',e+="</textarea></span>",config.emojis&&(e+='<span class="ogx_chat_composer_emoji"></span>'),e+='<span class="ogx_chat_composer_send"></span></div>',container.append(e),composer=container.find(".ogx_chat_composer"),config.emojis&&(emojis=container.find(".ogx_chat_emojis"),setTimeout(renderEmojis,10))}function initUsers(){for(var e in config.users)typing[e]=!1}function initDefaults(){config.hasOwnProperty("emojis")&&config.emojis&&(OGX.Data.merge(config.emojis,emojis_default,!1),config.emojis.list=new OGX.List(config.emojis.list)),OGX.Data.merge(config,config_default,!1),config.users.hasOwnProperty("find")||(config.users=new OGX.List(config.users)),that.el=container=$(config.el),container.addClass("ogx_chat")}function init(){if(initDefaults(),initMarkup(),initUsers(),initScroller(),config.restrict){var e=OGX.Data.clone(config.restrict);config.restrict.hasOwnProperty("forbidden")&&(e.forbidden=config.restrict.forbidden),config.restrict.hasOwnProperty("allowed")&&(e.allowed=config.restrict.allowed),e.el=that.el.find(".ogx_chat_composer .ogx_chat_composer_input textarea")[0],OGX.Form.restrictField(e)}that.enable()}this._NAME_=OGX.Chat.NAME,this.el=null,this.enable=function(){enabled||(enabled=!0,config.handle_keyboard&&listenKeyb(!0),listenComposer(!0),listenArea(!0))},this.disable=function(){this.el.find(".ogx_chat_composer .ogx_chat_composer_input textarea").blur(),enabled&&(enabled=!1,config.handle_keyboard&&listenKeyb(!1),listenComposer(!1),listenArea(!1))},this.users=function(e){return void 0!==e?(e.hasOwnProperty("find")||(e=new OGX.List(e)),config.users=e,!0):config.users},this.user=function(e){return void 0===e?config.user:(config.user=e,!0)},this.typing=function(e,t){e&&!typing[t]?addTyping(t):!e&&typing[t]&&removeTyping(t)},this.compose=function(e){composer.find("textarea").val(e)},this.clear=function(){inner.empty()},this.getScroller=function(){return scroller},this.addMessage=function(e){addMessage(e)},this.setMessages=function(e){config.messages=e,render()},this.prependMessages=function(e){for(var t=this.el.find(".ogx_scroller_outer").first(),i=inner.height(),n=t.scrollTop(),a=0;a<e.length;a++)addMessage(e[a],!0);config.messages=e.concat(config.messages);var o=inner.height();this.el.find(".ogx_scroller_outer").scrollTop(n+(o-i))},this.destroy=function(){config.restrict&&OGX.Form.unrestrictField(that.el.find(".ogx_chat_composer .ogx_chat_composer_input textarea")[0])},init()},OGX.Chat.NAME="Chat",OGX.Chat.SEND_MESSAGE="ChatSend",OGX.Chat.DISPLAY_INITIALS="ChatDisplayInitials",OGX.Chat.DISPLAY_PICTURE="ChatDisplayPicture",OGX.Color={},OGX.Color.hexToRgb=function(e){"use strict";e=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(e,t,i,n){return t+t+i+i+n+n}));var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null},OGX.Color.rgbToHex=function(e,t,i){"use strict";return"#"+((1<<24)+(e<<16)+(t<<8)+i).toString(16).slice(1)},OGX.Color.rgbToHsl=function(e){"use strict";var t,i,n,a=new RegExp("rgb\\(([0-9]+)\\, ([0-9 ]+)\\, ([0-9]+)","g").exec(e);if(a){a.shift(),t=a[0],i=a[1],n=a[2],t/=255,i/=255,n/=255;var o,r,s=Math.max(t,i,n),l=Math.min(t,i,n),c=(s+l)/2;if(s===l)o=r=0;else{var d=s-l;switch(r=c>.5?d/(2-s-l):d/(s+l),s){case t:o=(i-n)/d+(i<n?6:0);break;case i:o=(n-t)/d+2;break;case n:o=(t-i)/d+4}o/=6}return[o,r,c]}return!1},OGX.Color.hslToRgb=function(e,t,i){"use strict";var n,a,o;if(0===t)n=a=o=i;else{var r=function(e,t,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?e+6*(t-e)*i:i<.5?t:i<2/3?e+(t-e)*(2/3-i)*6:e},s=i<.5?i*(1+t):i+t-i*t,l=2*i-s;n=r(l,s,e+1/3),a=r(l,s,e),o=r(l,s,e-1/3)}return[Math.round(255*n),Math.round(255*a),Math.round(255*o)]},require("Container","Uxi"),OGX.Container=function(e){construct(this,"Container");var t=this,i={tabs:!0,carousel:{enabled:!0},enabled:!0,reorder:!0,anim:!0,flatten:!1,chromeos:!1,index:0,dots:!1},n=e,a=!1,o="normal",r=0;function s(e){e?(t.tabs.el.on(OGX.Tabs.SELECT,(function(e,i){var n=t.tabs.index();t.carousel.val(n),t.el.trigger(OGX.Container.CHANGE,n)})),t.tabs.el.on(OGX.Tabs.CLOSE,(function(){})),t.tabs.el.on(OGX.Tabs.REORDER,(function(e,i){t.carousel.swapPanels(i.from,i.to)})),t.tabs.el.on(OGX.Tabs.ADD,(function(){})),t.carousel.el.on(OGX.Carousel.CHANGE,(function(e,i){t.tabs.index(i),t.el.trigger(OGX.Container.CHANGE,i)}))):(t.tabs.el.off(OGX.Tabs.SELECT),t.tabs.el.off(OGX.Tabs.CLOSE),t.tabs.el.off(OGX.Tabs.REORDER),t.tabs.el.off(OGX.Tabs.ADD),t.carousel.el.off(OGX.Carousel.CHANGE)),l(e)}function l(e){e?t.tabs.el.on(OGX.Tabs.REMOVE,(function(e,i){l(!1);var n=t.el.parents(".ogx_popup:first").data("ogx-id");n=app.cfind("Popup",n),app.ungroupPopup(n,i.index,i.label),setTimeout((function(){l(!0)}),200)})):t.tabs.el.off(OGX.Tabs.REMOVE)}this.carousel=null,this.tabs=null,this.el=null,this._NAME_=OGX.Container.NAME,this.construct=function(){this.carousel=this.find(OGX.Carousel.NAME,this.id+"_carousel")},this.show=function(e,t){if(this.carousel&&"normal"===o){var i=this.carousel.getNodeIndex(e,t);i&&(this.carousel.val(i.index),n.tabs&&this.tabs.index(i.index))}},this.index=function(e){return!(!this.carousel||"normal"!==o)&&(this.carousel.val(e),n.tabs&&this.tabs.index(e),!0)},this.enable=function(){n.tabs&&this.carousel&&s(!0)},this.disable=function(){n.tabs&&this.carousel&&s(!1)},this.resize=function(){var e,t,i;n.flatten&&(this.carousel&&"flattened"!==o&&this.el.width()>=n.flatten?(o="flattened",n.tabs&&(this.tabs.blur(),this.tabs.hide()),this.carousel.blur(),r=(e=this.carousel.el.children(".ogx_carousel_views:first"),t=e[0].style.transform,i=/translate3d\(([0-9px%,\.\- ]+)\)/,t=(t=t.match(i))[1].split(","))[0],this.carousel.el.children(".ogx_carousel_views:first").addClass("ogx_container_flattened").css("transform","translate3d(0px, 0px, 0px)")):this.carousel&&"flattened"===o&&this.el.width()<n.flatten&&(o="normal",n.tabs&&(this.tabs.focus(),this.tabs.show()),this.carousel.focus(),this.carousel.el.children(".ogx_carousel_views:first").removeClass("ogx_container_flattened").css("transform","translate3d("+r+", 0px, 0px)")))},this.empty=function(){this.carousel.empty(),this.tabs.empty()},function(){OGX.Data.merge(n,i,!1),OGX.Data.merge(n.carousel,i.carousel,!1),n.tabs&&"object"!=typeof n.tabs&&(n.tabs={}),t.el=a=$(n.el),a.addClass("ogx_container");var e=!1;n.tabs&&(!function(){var e={el:'.ogx_container[data-ogx-id="'+t.id+'"]',reorder:n.reorder,editable:!1,chromeos:n.chromeos,enabled:n.enabled,index:n.index};if(!0===n.tabs){n.tabs=[];for(var i=0;i<n["node:OML"].length;i++)for(var a in n["node:OML"][i])n["node:OML"][i][a].hasOwnProperty("title")&&n.tabs.push({label:n["node:OML"][i][a].title})}e=OGX.Data.merge(n.tabs,e),t.tabs=t.create("Tabs",e)}(),e="ogx_carousel_shink");var o=n["node:OML"].slice(),r={},s='.ogx_container[data-ogx-id="'+t.id+'"]:Carousel';r["node:OML"]={},r["node:OML"][s]={id:t.id+"_carousel",css:e,anim:n.anim,chromeos:n.chromeos,drag:n.carousel.drag,enabled:n.carousel.enabled,index:n.index,dots:n.dots,"node:OML":o},n["node:OML"]=r["node:OML"],setTimeout((function(){t.resize()}),0)}()},OGX.Container.NAME="Container",OGX.Container.CHANGE="ContainerChange",require("Controller","Touch"),OGX.Controller=function(e){construct(this,"Controller");e=OGX.Data.merge(e,{enabled:!0,blured:!0,always_on:!1}),this.el=!1,this.enabled=e.enabled,this.blured=e.blured,this.floating=!1,this.always_on=e.always_on,this.id=e.id,this._CLASS_=e._sub_,delete e._sub_,this._NAME_=OGX.Controller.NAME},OGX.Controller.prototype.blur=function(){this.always_on||this.blured||(this.blured=!0,this.ux(!1),this.disable())},OGX.Controller.prototype.focus=function(){this.blured&&(this.blured=!1,this.enabled&&(this.ux(!0),this.enable()))},OGX.Controller.prototype.construct=function(){},OGX.Controller.prototype.enable=function(){},OGX.Controller.prototype.disable=function(){},OGX.Controller.prototype.ux=function(){},OGX.Controller.prototype.resize=function(){},OGX.Controller.prototype.clear=function(){},OGX.Controller.prototype.destroy=function(){},OGX.Controller.prototype.kill=function(){OGX.Object.destroy(this)},OGX.Controller.NAME="Controller",OGX.Display=function(e){"use strict";var t,i,n={display:!1,displays:!1},a={html:!1,css:!1,oml:!1,placeholder:!1,template:!1,view:!1,bind_css:!1,add_css:!1,calc_css:!1,bind_template:!1};function o(e,t){return-1!==e.indexOf("{{")?OGX.OSE.exec(e,t):e}function r(e){if(t.display&&!t.display.hasOwnProperty("bind"))return t.display;if(t.displays&&t.display.hasOwnProperty("bind")){if(e.hasOwnProperty(t.display.bind)){var i=e[t.display.bind];return t.displays[i]}if(t.displays.hasOwnProperty("__default"))return t.displays.__default}return!1}function s(e){var t=OGX.Data.merge(a,e,!0,!0);return t.template&&("object"==typeof t.template?t.bind_template=!0:(t.html=OGX.Templater.get(t.template),t.template=!1)),t.css&&(t.bind_css="object"==typeof t.css&&t.css.hasOwnProperty("bind"),t.add_css="object"==typeof t.css&&t.css.hasOwnProperty("add"),t.calc_css="object"==typeof t.css&&t.css.hasOwnProperty("conditions")),t}function l(e){if(void 0===e&&(e={}),t=OGX.Data.clone(n),!e.hasOwnProperty("display")&&!e.hasOwnProperty("displays"))return t.display=OGX.Data.merge(a,e,!0,!0,!0),t.display=s(t.display),void(i=r());if(e.hasOwnProperty("display")&&e.display&&!e.display.hasOwnProperty("bind"))return t.display=OGX.Data.merge(a,e.display,!0,!0,!0),t.display=s(t.display),void(i=r());if(e.hasOwnProperty("display")&&e.display&&e.display.hasOwnProperty("bind")&&e.hasOwnProperty("displays")&&e.displays&&(t.display=e.display,t.displays=OGX.Data.clone(e.displays)),t.displays)for(var o in t.displays)t.displays[o]=OGX.Data.merge(a,t.displays[o],!0,!0,!0),t.displays[o]=s(t.displays[o])}this._NAME_=OGX.Display.NAME,this.val=function(e){if(void 0===e)return OGX.Data.clone(t);l(e)},this.display=function(e){return t.displays&&t.displays.hasOwnProperty(e)?(i=t.displays[e],!0):i},this.css=function(e){var t,n="",a=void 0!==e;if((t=a?r(e):i)&&(t.bind_css&&a?n+=e[o(t.css.bind,e)]:t.css&&"string"==typeof t.css&&(n=o(t.css,e)),t.add_css&&(n+=" "+o(t.css.add,e)),t.calc_css&&a))for(var s,l,c=0;c<t.css.conditions.length;c++)if(OGX.OSE.exec(t.css.conditions[c][0],e)&&((s=t.css.conditions[c][1]).hasOwnProperty("css")&&(n=o(s.css,e)),s.hasOwnProperty("add")&&(n+=" "+o(s.add,e)),s.hasOwnProperty("remove"))){l=s.remove.explode(" ");for(var d=0;d<l.length;d++)n=n.replace(o(l[d],e),"")}return n||""},this.html=function(e){var t,n=!1,a=void 0!==e;return(t=a?r(e):i)&&(t.bind_template&&a?n=OGX.Templater.get(e[t.template.bind]):(t.template||t.html)&&(n=t.html),a&&n&&(n=OGX.Templater.make(n,e))),n||(n=""),n},this.oml=function(e,t,n){void 0===n&&(n="&item");var a={},o=r(t);if(o||(o=i),o){if(o.oml)return a=OGX.OML.rename(OGX.Data.clone(o.oml),e),void 0!==n&&OGX.OML.replaceDataRecursive(a,t,n),o.placeholder?function(e,t,i){var n,a,o=OGX.Data.clone(e.oml);for(var r in o){var s,l;for(var c in o[n=r.replace("default",t)]=o[r],o[n]["node:OML"]=[],e.placeholder){l=i[c].length;for(var d=0;d<l;d++){for(var u in s=OGX.Data.clone(e.placeholder[c]),(a=OGX.Data.clone(i))[c]=a[c][d],s){s[u].data=a;break}o[n]["node:OML"].push(s)}return delete o[r],o}}return!1}(o,e,t):a;if(o.template)return"string"==typeof o.template?a[e+":Templates."+o.template]={data:t}:a[e+":Templates."+t[o.template.bind]]={data:t},a;if(o.hasOwnProperty("html"))return a[e+":Html"]={html:this.html(t)},a}return!1},this.hasOML=function(){return!1!==i.oml},this.toJSON=function(){return t},l(e)},OGX.Display.NAME="Display",require("Dots","Uxi","Touch"),OGX.Dots=function(e){construct(this,"Dots");var t,i=this,n=e,a={el:"document",total:0,current:0,clickable:!0},o={};function r(e){switch(o[e]._NAME_){case OGX.Carousel.NAME:o[e].el.off(OGX.Carousel.CHANGE,s),o[e].el.off(OGX.Carousel.ADDED+" "+OGX.Carousel.REMOVED,l),delete o[e];break;case OGX.Iceberg.NAME:o[e].el.off(OGX.Iceberg.SHOW,s),delete o[e]}}function s(e,t){i.select(t)}function l(e,t){n.total=t,d()}function c(e){e?t.on(i.touch.down,".ogx_dots_item",(function(){var e=Number($(this).data("id"));i.select(e),t.trigger(OGX.Dots.SELECT,e),function(e){for(var t in o)switch(o[t]._NAME_){case OGX.Carousel.NAME:o[t].val(e)}}(e)})):t.off(i.touch.down)}function d(){for(var e,i="",a=0;a<n.total;a++)e="",n.current===a&&(e="ogx_dots_selected"),i+='<div class="ogx_dots_item" data-id="'+a+'"><span class="ogx_dots_gfx '+e+'"></span></div>';t.html(i)}this._NAME_=OGX.Dots.NAME,this.el=null,this.enable=function(){n.clickable&&c(!0)},this.disable=function(){n.clickable&&c(!1)},this.bind=function(e,t){return!(o.hasOwnProperty(e)||!t.hasOwnProperty("_NAME_"))&&function(e,t){switch(o[e]=t,t._NAME_){case OGX.Carousel.NAME:n.total=t.panels().length,n.current=t.val(),t.el.on(OGX.Carousel.CHANGE,s),t.el.on(OGX.Carousel.ADDED+" "+OGX.Carousel.REMOVED,l);break;case OGX.Iceberg.NAME:n.total=t.panels().length,n.current=t.val(),t.el.on(OGX.Iceberg.SHOW,s)}return!0}(e,t)},this.unbind=function(e){return!!o.hasOwnProperty(e)&&r(e)},this.select=function(e){t.find(".ogx_dots_selected").removeClass("ogx_dots_selected"),t.children(".ogx_dots_item:eq("+e+")").children(".ogx_dots_gfx:first").addClass("ogx_dots_selected"),n.current=e},this.destroy=function(){!function(){for(var e in o)r(e)}()},OGX.Data.merge(n,a),i.el=t=$(n.el),t.addClass("ogx_dots"),d()},OGX.Dots.NAME="Dots",OGX.Dots.SELECT="DotsSelect",require("DynamicList","Uxi","Bind","Touch"),OGX.DynamicList=function(e){construct(this,"DynamicList");var t,i,n,a,o=this,r=e,s={el:null,key:!1,as:"item",display:!1,displays:!1,reorder:!1,swipe:!1,reselect:!1,chromeos:!1,min_x:30,click_time:100,hold_time:2e3,interval:5,list:[],selection:[],mode:OGX.DynamicList.SELECT_MODE_SINGLE,trigger:!1,scope:!0,swipe_template:'<div class="ogx_dynamic_list_item ogx_dynamic_list_swiper_back_item" style="height:{{$height}}px; z-index:{{$zindex}}; margin-bottom:{{$margin}}px;">{{$template}}</div>',zindex:1},l={mode:OGX.DynamicList.SWIPE_MODE_DELETE,options:{},template:!1,html:""},c=new OGX.List,d=1,u="__id__",h={mode:!1,stime:0,target:0,si:0,ei:0,y:0},f=null,g=null,_=null,p=0,m=new OGX.Display(r),v=!1,y=!1;function x(e,t,i){if(m.hasOML()){var n,a,s=m.oml('.ogx_dynamic_list[data-ogx-id="'+o.id+'"] .ogx_dynamic_list_item[data-ogx-id="'+i[t]+'"]',i,r.as);$('.ogx_dynamic_list[data-ogx-id="'+o.id+'"] .ogx_dynamic_list_item[data-ogx-id="'+i[t]+'"]').find(".ogx_uxi").each((function(e,t){n=$(t).data("ogx-id"),(a=o.cfind(!1,n,1))&&o.find(a._NAME_,a.id,"remove")})),OGX.OML.render(o,s,i)}else e.html(m.html(i))}function O(){var e=W(),i=c;n&&(c.resetFilters(),c.setFilters(r.list.getFilters()),(i=c.filter()).length!==c.length&&(i.length?t.trigger(OGX.DynamicList.SELECT,i):t.trigger(OGX.DynamicList.UNSELECT)));for(var s,l,d,u="",h=[],f=0;f<e.length;f++)(!r.scope||!e[f].hasOwnProperty("scope")||r.scope&&OGX.Scope.eval(e[f].scope))&&(!1,l="",s=e[f][a],c.find(a,s,1)&&(l="ogx_dynamic_list_selected_item"),m.html(e[f]),u+='<div class="ogx_dynamic_list_item '+l+" "+m.css(e[f])+'" data-ogx-id='+s+"></div>",d=m.oml('.ogx_dynamic_list[data-ogx-id="'+o.id+'"] .ogx_dynamic_list_item[data-ogx-id="'+s+'"]',e[f],r.as),h.push(d));t.html(u),function(e){for(var t=0;t<e.length;t++)o.parse(e[t])}(h),r.trigger&&t.trigger(OGX.DynamicList.RENDER)}function b(e){e?$(document).on(OGX.Scope.CHANGE,w):$(document).off(OGX.Scope.CHANGE,w)}function w(){o.render()}function G(e){void 0!==t&&v&&(e?t.on("click",".ogx_dynamic_list_item",R):t.off("click",".ogx_dynamic_list_item",R))}function X(e){e?t.on(o.touch.down,".ogx_dynamic_list_item",C):t.off(o.touch.down,".ogx_dynamic_list_item",C)}function E(e){e?g=setInterval(S,20):(clearInterval(g),g=null)}function T(e){e?t.on(o.touch.move,".ogx_dynamic_list_item",D):t.off(o.touch.move,".ogx_dynamic_list_item")}function C(e){h.mode=!1,h.target=$(e.currentTarget),h.si=h.target.index(),h.cy=t.offset().top,e=o.event(e),h.startx=e.pageX,h.starty=e.pageY,_&&clearInterval(_),h.stime=(new Date).getTime(),r.reorder&&E(!0),T(!0),$("body").on(o.touch.up,M)}function D(e){e=o.event(e),h.y=-1*(h.starty-e.pageY),h.mx=e.pageX-h.startx,h.px=e.pageX,h.py=e.pageY,h.st=!1,r.swipe&&!h.mode&&Math.abs(h.mx)>r.min_x&&(h.mode="swipe",r.scroll&&!h.st&&(h.st=!0,y.disable(),y.container().css("cssText","height:"+y.container().height()+"px !important;")),r.reorder&&E(!1),L(!0))}function S(){!h.mode&&(new Date).getTime()-h.stime>r.hold_time&&(h.mode="reorder",h.item=r.list.find(a,h.target.data("id").toString(),1),t.trigger(OGX.DynamicList.HOLD,h.item),E(!1),setTimeout(function(){h.tgy=h.target.position().top,h.tgx=h.target.position().left,h.y=0;var e=h.target.outerWidth(),i=h.target.outerHeight();h.clone=h.target.clone().css({position:"absolute",left:h.tgx+"px",top:h.tgy+"px",width:e+"px",height:i+"px"}).addClass("ogx_dynamic_list_reorder").prependTo(t),h.target.addClass("ogx_dynamic_list_frozen"),_=setInterval(P,r.interval),t.on(o.touch.move,Y)}(),0))}function M(e){if($("body").off(o.touch.up,M),(r.reorder||r.swipe)&&(clearInterval(_),_=!1,T(!1)),r.swipe&&L(!1),r.reorder&&E(!1),r.scroll&&(y.enable(),y.container().removeAttr("style")),r.reorder&&"reorder"===h.mode){if(t.off(o.touch.move,Y),h.clone){var i=JSON.parse(JSON.stringify(r.list[h.si]));return r.list.delete(h.si),r.list.insert(i,h.ei),h.clone.remove(),h.clone=!1,h.target.removeClass("ogx_dynamic_list_frozen"),void t.trigger(OGX.DynamicList.DROP,h.item)}if((new Date).getTime()-h.stime<r.click_time){var n=h.target.data("id").toString(),s=r.list.find(a,n,1);t.trigger(OGX.DynamicList.SELECT,s),o.select(a,n)}}else if(r.swipe&&"swipe"===h.mode){var l=h.target.outerWidth(!0),c=Math.abs(100*h.mx/l);c<50?c?(h.target.addClass("ogx_dynamic_list_swiper_trans_item_restore"),h.target.addClass("ogx_dynamic_list_swiper_trans_item").css("transform","translateX(0px)")):(h.target.next(".ogx_dynamic_list_swiper_back_item:first").remove(),h.target.css("transform","translateX(0px)")):h.mx>0?(h.target.attr("data-side","left"),h.target.addClass("ogx_dynamic_list_swiper_trans_item").css("transform","translateX("+l+"px)")):(h.target.attr("data-side","right"),h.target.addClass("ogx_dynamic_list_swiper_trans_item").css("transform","translateX("+-1*l+"px)"))}h.mode=!1}function L(e){e?f=setInterval(N,r.interval):(clearInterval(f),f=!1)}function N(){if("swipe"===h.mode&&Math.abs(h.mx)>r.min_x){var e=parseInt(h.target.css("border-top-width").split("px")[0]),t=parseInt(h.target.css("border-bottom-width").split("px")[0]),i=h.target.outerHeight();if(!h.target.hasClass("ogx_dynamic_list_swiper_work")){h.target.addClass("ogx_dynamic_list_swiper_work");var n={};n.height=i,n.margin=-2*(e+t),n.top=h.target.position().top,n.zindex=r.zindex;var a="";r.swipe.template?a=OGX.Templater.get(r.swipe.template):r.swipe.html&&(a=r.swipe.html),n.template=a,a=OGX.Templater.make(r.swipe_template,n),h.target.after(a)}if(r.swipe.mode===OGX.DynamicList.SWIPE_MODE_SIDE&&(h.mx<0?(p=1,h.target.next(".ogx_dynamic_list_swiper_back_item:first").addClass("ogx_dynamic_list_swiper_side_left").removeClass("ogx_dynamic_list_swiper_side_right")):(p=-1,h.target.next(".ogx_dynamic_list_swiper_back_item:first").addClass("ogx_dynamic_list_swiper_side_right").removeClass("ogx_dynamic_list_swiper_side_left"))),h.py>=h.target.offset().top&&h.py<=h.target.offset().top+i){h.target.css("transform","translateX("+h.mx+"px)");var o=h.target.next(".ogx_dynamic_list_swiper_back_item:first");h.mx<0?o.addClass("ogx_dynamic_list_swiper_right").removeClass("ogx_dynamic_list_swiper_left"):o.addClass("ogx_dynamic_list_swiper_left").removeClass("ogx_dynamic_list_swiper_right")}else M(h.target)}}function A(e){e?t.on("transitionend",".ogx_dynamic_list_swiper_trans_item",k):t.off("transitionend",".ogx_dynamic_list_swiper_trans_item",k)}function k(e){var i=$(this),n=i.next(".ogx_dynamic_list_swiper_back_item:first");if(i.hasClass("ogx_dynamic_list_swiper_trans_item_restore"))n.remove(),i.css("transform","translateX(0px)"),i.removeClass("ogx_dynamic_list_swiper_trans_item");else{var a,o=i.index(),s=i.data("ogx-id");switch(r.swipe.mode){case OGX.DynamicList.SWIPE_MODE_DELETE:i.remove(),I(n),a=r.list.findDelete(r.key,String(s),1),t.trigger(OGX.DynamicList.DELETE,{item:a,index:o});break;case OGX.DynamicList.SWIPE_MODE_SIDE:var l;a=r.list.find(r.key,s,1),l=-1===p?"right":"left",t.trigger(OGX.DynamicList.SIDED,{side:l,item:a,index:o});break;case OGX.DynamicList.SWIPE_MODE_CUSTOM:}}i.removeClass("ogx_dynamic_list_swiper_work"),i.removeClass("ogx_dynamic_list_swiper_trans_item_restore")}function I(e,t){e.addClass("ogx_dynamic_list_swiper_delete"),e.on("transitionend",(function(){e.off("transitionend"),e.remove()}))}function Y(e){e.preventDefault(),e.stopImmediatePropagation(),e=o.event(e),h.y=-1*(h.starty-e.pageY)}function P(){if(Math.abs(t.offset().top-h.cy)>1)return clearInterval(_),_=!1,h.clone.remove(),h.clone=!1,h.target.removeClass("ogx_dynamic_list_frozen"),void t.trigger(OGX.DynamicList.RELEASE);var e=!1,i=t.children(".ogx_dynamic_list_item:last"),n=i.offset().top+-1*h.cy;if(h.tgy+h.y<n?h.clone.css({top:h.tgy+h.y}):e=i,!e){var o,s,l,c,d=0;t.children(".ogx_dynamic_list_item").each((function(t,i){if((i=$(i))[0]!==h.clone[0]&&!i.hasClass("ogx_dynamic_list_frozen")){if(o=i.offset().top,s=i.outerHeight(),c=o+s/2,(l=h.clone.offset().top)>o&&l<c)return d=-1,void(e=i);if(l>c&&l<o+s)return d=1,void(e=i)}}))}if(e){switch(h.ei=r.list.findIndex(a,$(e).data("id").toString()).index,d){case-1:e.index()-1!==h.target.index()&&h.target.detach().insertBefore(e);break;case 1:e.index()+1!==h.target.index()&&h.target.detach().insertAfter(e)}e=!1}}function R(e){var i,n=$(this);switch(r.mode){case OGX.DynamicList.SELECT_MODE_SINGLE:!r.reselect&&n.hasClass("ogx_dynamic_list_selected_item")||n.hasClass("ogx_dynamic_list_swiper_trans_item")||(i=z(n.index(),!0),t.trigger(OGX.DynamicList.SELECT,i));break;case OGX.DynamicList.SELECT_MODE_TOGGLE:n.hasClass("ogx_dynamic_list_selected_item")||n.hasClass("ogx_dynamic_list_swiper_trans_item")?(i=z(n.index(),!1),t.trigger(OGX.DynamicList.UNSELECT,i)):(o.resetSelection(),i=z(n.index(),!0),t.trigger(OGX.DynamicList.SELECT,i));break;case OGX.DynamicList.SELECT_MODE_MULTI:n.hasClass("ogx_dynamic_list_selected_item")||n.hasClass("ogx_dynamic_list_swiper_trans_item")?(i=z(n.index(),!1),t.trigger(OGX.DynamicList.UNSELECT,i)):(i=z(n.index(),!0),t.trigger(OGX.DynamicList.SELECT,i));break;case OGX.DynamicList.SELECT_MODE_HIT:var a=W();if(n.hasClass("ogx_dynamic_list_swiper_back_item")){var s="left";n.hasClass("ogx_dynamic_list_swiper_side_right")&&(s="right"),t.trigger(OGX.DynamicList.BACK_HIT,{side:s,item:a[n.index()]})}else t.trigger(OGX.DynamicList.SELECT,a[n.index()])}}function H(e,i,n){var s=null;"single"===r.mode&&(o.resetSelection(),s=1);var l,d=W(),u={};Array.isArray(i)?(u[a]={in:i},sel=d.get(u,null,s)):(u[a]={eq:i},sel=d.get(u)),sel&&!Array.isArray(sel)&&(sel=[sel]);for(var h=0;h<sel.length;h++)(l=t.find('.ogx_dynamic_list_item[data-ogx-id="'+sel[h][a]+'"]'))&&(n?(l.addClass("ogx_dynamic_list_selected_item"),c.push(sel[h])):l.removeClass("ogx_dynamic_list_selected_item"));return"single"===r.mode&&sel.length?sel[0]:sel}function z(e,i){var n,s,l=W();if((n=t.find(".ogx_dynamic_list_item:eq("+e+")")).length>0){r.mode===OGX.DynamicList.SELECT_MODE_SINGLE&&o.resetSelection();var d=n.data("ogx-id");return r.key&&"string"!=typeof l[0][a]||(d=String(d)),s=l.find(a,d,1),i?(n.addClass("ogx_dynamic_list_selected_item"),c.push(l[e])):(n.removeClass("ogx_dynamic_list_selected_item"),c.findDelete(a,d,1)),s}return!1}function W(){return n?i:r.list}function j(){for(var e=0;e<r.list.length;e++)r.list[e][a]=String(d),d++}function U(e){for(var t=0;t<e.length;t++)delete e[t][a];return e}this._NAME_=OGX.DynamicList.NAME,this.el=null,this.enable=function(e){return void 0===e&&(e=!1),!(!e&&r.mode===OGX.DynamicList.STATIC)&&(this.touch.enable(),G(!0),(r.reorder||r.swipe)&&(X(!0),r.swipe&&A(!0)),!0)},this.disable=function(e){return void 0===e&&(e=!1),!(!e&&r.mode===OGX.DynamicList.STATIC)&&(this.touch.disable(),G(!1),(r.reorder||r.swipe)&&(X(!1),r.swipe&&A(!1)),!0)},this.bindFilter=function(e,t,a){void 0!==a&&(r.list.removeFilter(e),r.list.addFilter(e,t,a)),r.list.getFilters()&&(i=r.list.filter(),n=!0),setTimeout(O,0)},this.unbindFilter=function(e){r.list.removeFilter(e),i=r.list.filter(),n=!0,setTimeout(O,0)},this.bindValue=function(){return this.getSelection()},this.destroy=function(){r.scope&&b(!1),this.clearBinds(),t.empty(),t.removeClass("ogx_dynamic_list")},this.val=function(e,t,i){if(void 0===e){if(!r.key){var n=JSON.parse(JSON.stringify(r.list));return U(OGX.List(n))}return r.list}var o;void 0===t&&(t=!1),void 0===i&&(i=!0),e.hasOwnProperty("insert")||(e=new OGX.List(e)),this.resetSelection(),t||(o=r.list.getFilters()),r.list=e,r.key||(d=1,a=u,e=JSON.parse(JSON.stringify(e)),j()),!t&&Object.keys(o).length?(r.list.setFilters(o),setTimeout(this.filter,0)):i?setTimeout(O,0):O()},this.getFilteredList=function(){if(n){if(!r.key){var e=JSON.parse(JSON.stringify(i));return U(OGX.List(e))}return i}return!1},this.display=function(e){return void 0===e?r.display:r.display.val(e)},this.mode=function(e){return void 0===e?r.mode:(r.mode!==e&&(r.mode===OGX.DynamicList.STATIC?this.enable(!0):e===OGX.DynamicList.STATIC&&this.disable(!0),r.mode=e),!0)},this.order=function(e,t){return r.list.order(e,t),setTimeout(O,0),!0},this.filter=function(){return i=r.list.filter(),n=!0,setTimeout(O,0),i},this.unfilter=function(){return n=!1,setTimeout(O,0),!0},this.addFilter=function(e,t,i){return r.list.addFilter(e,t,i)},this.removeFilter=function(e,t,i){return r.list.removeFilter(e,t,i)},this.resetFilters=function(){return r.list.resetFilters()},this.getFilters=function(){return r.list.getFilters()},this.insert=function(e,o){if(!Array.isArray(e)){r.key||(e[a]=d++);var s=!1,l=!0;if(n){var c=new OGX.List(e);c.setFilters(r.list.getFilters()),0===c.filter().length?l=!1:i.push(e)}var u='<div class="ogx_dynamic_list_item '+m.css(e)+'" data-ogx-id='+e[a]+"></div>",h=m.oml('.ogx_dynamic_list[data-ogx-id="'+this.id+'"] .ogx_dynamic_list_item[data-ogx-id="'+e[a]+'"]',e,r.as);if(void 0===o)r.list.push(e),l&&t.append(u);else if(r.list.insert(e,o),l&&(n?s=(i=r.list.filter()).findIndex(a,e[a]):0===o?t.prepend(u):s=r.list.findIndex(a,e[a]),s)){var f=t.children(".ogx_dynamic_list_item:nth-child("+(s.index+1)+")");f.length>0?f.before(u):t.append(u)}return this.parse(h),r.trigger&&t.trigger(OGX.DynamicList.RENDER),l}for(var g=0;g<e.length;g++)void 0!==o?this.insert(e[g],o+g):this.insert(e[g])},this.delete=function(e){var o=W().delete(e);if(o){r.list.findDelete(a,o[a],1),n&&i.findDelete(a,o[a],1);var s=t.children(".ogx_dynamic_list_item:eq("+e+")");return this.remove(o[a]),s.remove(),!0}return!1},this.deleteSelection=function(){for(var e=0;e<c.length;e++)r.list.findDelete(a,c[e][a],1),n&&i.findDelete(a,c[e][a],1),this.remove(c[e][a]),t.children(".ogx_dynamic_list_selected_item").remove();return!0},this.findDelete=function(e,o,s){void 0===s&&1===arguments.length&&(o=e,e=a);var l,c,d=r.list.findDelete(e,o,s);d&&!Array.isArray(d)&&(d=[d]);for(var u=0;u<d.length;u++)n&&i.findDelete(e,o,s),c=(l=t.children('.ogx_dynamic_list_item[data-ogx-id="'+d[u][a]+'"]')).next(".ogx_dynamic_list_swiper_back_item"),l.remove(),this.remove(d[u][a]),I(c);return 1===s?d[0]:d},this.findIndex=function(e,i){var n=arguments.length;1===n&&(i=e,e=a);var o=r.list.find(e,i,1);return o?t.children('.ogx_dynamic_list_item[data-ogx-id="'+o[a]+'"]').index():-1},this.findReplace=function(e,o,s){var l=arguments.length;2===l&&(s=o,o=e,e=a),r.key||(s[a]=d++);var c=r.list.findReplace(e,o,s,1);if(c){n&&i.findReplace(e,o,s,1);var u=t.children('.ogx_dynamic_list_item[data-ogx-id="'+c[a]+'"]:first');return u.length&&(u.attr("data-ogx-id",s[a]),x(u,a,s),r.trigger&&t.trigger(OGX.DynamicList.RENDER)),!0}return!1},this.replaceAt=function(e,t){var i=W();if(void 0===i[e])return!1;if(r.key)i[e]=t;else{var n=i[e][a];i[e]=t,i[e].key=n}return this.refreshAt(e)},this.select=function(e,t){return void 0===t&&(t=e,e=a),H(e,t,!0)},this.selectIndex=function(e){return z(e,!0)},this.index=function(e){if(void 0!==e){var i=W();return this.select(a,i[e][a])}return t.children(".ogx_dynamic_list_selected_item").index()},this.unselect=function(e,t){return H(e,t,!1)},this.unselectIndex=function(e){return z(e,!1)},this.resetSelection=function(){c=new OGX.List,t.children(".ogx_dynamic_list_selected_item").removeClass("ogx_dynamic_list_selected_item")},this.getSelection=function(e){if(void 0===e&&(e=!1),!e){var i;if(r.key)i=c;else i=U(JSON.parse(JSON.stringify(c)));return r.mode===OGX.DynamicList.SELECT_MODE_SINGLE?!!i.length&&i[0]:i=new OGX.List(i)}return t.children(".ogx_dynamic_list_selected_item")},this.getElement=function(e,i){var n=arguments.length;1===n&&(i=e,e=a);var o=r.list.find(e,i,1);return!!o&&t.children('.ogx_dynamic_list_item[data-ogx-id="'+o[a]+'"]')[0]},this.findUpdate=function(e,o,s,l,c,d){var u;"number"==typeof l&&(d=c,Array.prototype.unshift.call(arguments,a)),void 0===d&&(d=!0);var h=r.list.findUpdate.apply(r.list,arguments);if(h&&!Array.isArray(h)&&(h=[h]),h.length&&d){n&&i.findUpdate.apply(i,arguments);for(var f=0;f<h.length;f++)(u=t.children('.ogx_dynamic_list_item[data-ogx-id="'+h[f][a]+'"]:first')).length&&(x(u,a,h[f]),r.trigger&&t.trigger(OGX.DynamicList.RENDER));return h.length}return!1},this.update=function(e,o,s,l,c){void 0===c&&(c=!0);var d=r.list.update(e,o,s,l);if(d&&!Array.isArray(d)&&(d=[d]),d.length&&c){n&&i.update(arguments);for(var u=0;u<d.length;u++)el=t.children('.ogx_dynamic_list_item[data-ogx-id="'+d[u][a]+'"]:first'),el.length&&(x(el,a,d[u]),r.trigger&&t.trigger(OGX.DynamicList.RENDER));return d.length}return!1},this.refresh=function(e,i,n){var o=arguments.length;void 0!==n&&o--,1===o&&(i=e,e=a);var s=r.list.find(e,i,n);if(s&&s.length){for(var l,c=0;c<s.length;c++)(l=t.children('.ogx_dynamic_list_item[data-ogx-id="'+s[c][a]+'"]')).length>0&&x(l,a,s[c]);return!0}return!1},this.refreshAt=function(e){var i=W();if(void 0!==i[e]){var n=t.children('.ogx_dynamic_list_item[data-ogx-id="'+i[e][a]+'"]');if(n.length>0)return x(n,a,i[e]),!0}return!1},this.restore=function(e,i){var n=arguments.length;1===n&&(i=e,e=a);var o=r.list.find(e,i,1),s=t.children('.ogx_dynamic_list_item[data-ogx-id="'+o[a]+'"]');s.addClass("ogx_dynamic_list_swiper_trans_item_restore"),s.css({transform:"translateX(0px)","z-index":r.zindex+1}),setTimeout((function(){s.next(".ogx_dynamic_list_swiper_back_item:first").remove()}),200)},this.clear=function(){t.empty()},this.reset=function(){t.empty(),n=!1,r.list=new OGX.List,c=new OGX.List,i=new OGX.List},this.render=function(){setTimeout(O,0)},r||(r={}),OGX.Data.merge(r,s),r.list.hasOwnProperty("_NAME_")||(r.list=new OGX.List(r.list)),!r.key&&r.list.length>0?(a=u,j()):a=r.key,r.swipe&&("object"!=typeof r.swipe&&(r.swipe={}),OGX.Data.merge(r.swipe,l)),o.el=t=$(r.el),t.addClass("ogx_dynamic_list"),r.selection.length&&o.observe(!0,{childList:!0,subtree:!0},(function(){o.observe(!1);for(var e=0;e<r.selection.length;e++)o.select(a,r.selection[e])})),o.val(r.list,!1,!1),v=!0,o.blured||G(!0),r.scope&&b(!0),t.trigger(OGX.DynamicList.READY),r.scroll&&(y=o.find(OGX.Scroller.NAME,r.id+"_scroller"))},OGX.DynamicList.NAME="DynamicList",OGX.DynamicList.HOLD="DynamicListHold",OGX.DynamicList.RELEASE="DynamicListRelease",OGX.DynamicList.DROP="DynamicListDrop",OGX.DynamicList.SELECT="DynamicListSelect",OGX.DynamicList.DELETE="DynamicListDelete",OGX.DynamicList.SIDED="DynamicListSided",OGX.DynamicList.BACK_HIT="DynamicListBackHit",OGX.DynamicList.UNSELECT="DynamicListUnselect",OGX.DynamicList.RENDER="DynamicListRender",OGX.DynamicList.SELECT_MODE_SINGLE="single",OGX.DynamicList.SELECT_MODE_TOGGLE="toggle",OGX.DynamicList.SELECT_MODE_MULTI="multi",OGX.DynamicList.SELECT_MODE_HIT="hit",OGX.DynamicList.STATIC="static",OGX.DynamicList.SWIPE_LEFT="DynamicListSwipeLeft",OGX.DynamicList.SWIPE_RIGHT="DynamicListSwipeRight",OGX.DynamicList.SWIPE_MODE_DELETE="DynamicListSwipeModeDelete",OGX.DynamicList.SWIPE_MODE_SIDE="DynamicListSwipeModeSide",OGX.DynamicList.SWIPE_MODE_CUSTOM="DynamicListSwipeModeCustom",OGX.DynamicList.READY="DynamicListReady",OGX.DynamicList.BIND=OGX.DynamicList.SELECT+" "+OGX.DynamicList.UNSELECT,OGX.Form=function(){"use strict";var e=this,t={el:!1,allowed:!1,forbidden:!1,change_cb:!1,submit_cb:!1,validate:!1,diff:!0,params:null,elem_types:["input","select","textarea"],wait:1e3,fields:{}},i={el:!1,allowed:/[a-z0-9\\!\\.\\?\\#\\@\\$\\:\\(\\)\\/_,;%'"’ \\-]/,forbidden:/[<>]/,pattern:!1,validate:!1,mask:!1,mask_char:"%",paste:!0,autocomplete:null,multiline:!1,input_cb:!1,change_cb:!1,diff:!0,val:null,last_change:!1,wait:2e3,intv:!1,max:2500,type:"string",params:null},n=new OGX.List,a=new OGX.List,o=!1;function r(t,i){if(!o){var a,r=n.find("el",i,1);if(r&&r.config.change_cb){for(var s in r.fields)if(r.fields[s].intv)return;var c=d(r.form);for(var u in c)r.config.fields.hasOwnProperty(u)&&r.config.fields[u].hasOwnProperty("type")?c[u]=l(r.config.fields[u].type,c[u]):r.config.hasOwnProperty("type")&&(c[u]=l(r.config.type,c[u]));if(a=JSON.stringify(c),!r.diff||r.val!==a){var h;if(r.val=a,r.config.validate){h={obj:c,form:i,valid:!1};var f=e.validate(r.form);!0===f?h.valid=!0:(h.valid=!1,h.error=f)}else h=c;r.config.params&&(h.params=r.config.params),r.config.change_cb(h)}}}}function s(t){var i={el:t.el,config:t,field:$(t.el),intv:!1};i.name=i.field.attr("name"),i.val=i.field.val(),i.field.val(i.val),t.pattern&&i.field.attr("pattern",t.pattern),n.insert(i),$(document).on("input change",i.el,(function(e){if(!o){var t=$(this).val();if(!i.config.diff||i.config.diff&&t!==i.val){if(i.config.input_cb){var n={value:null,obj:{},el:null};t=l(i.config.type,t),n.el=i.field[0],n.value=t,n.property=i.name,n.obj[i.name]=t,i.config.input_cb(n,i.config.params)}i.intv&&clearTimeout(i.intv),i.intv=setTimeout((function(){!function(e){var t=$(e.el).val();if(e.val=t,e.config.change_cb){var i={value:null,obj:{},el:null};t=l(e.config.type,t),i.el=e.field[0],i.property=e.name,i.value=t,i.obj[i.property]=t,e.config.validate&&(i.valid=i.el.checkValidity()),e.config.change_cb(i,e.config.params)}}(i)}),i.config.wait)}}})),t.multiline||$(document).on("keydown",i.el,(function(e){var t=$(this);if(void 0!==e.which&&void 0!==e.key){if(!o){if(i.config.mask&&8===e.which||46===e.which){var n=t[0].selectionStart,a=t.val();return a=8===e.which?a.substr(0,n-1):a.substr(0,n),t.val(a),!1}if(8!==e.which&&13!==e.which&&1===e.key.length){var r=e.key;if(13!==e.which&&i.config.mask){if((a=t.val()).length>=i.config.mask.length)return e.preventDefault(),e.stopImmediatePropagation(),!1;for(var s=i.config.mask,c=0;c<a.length;c++)i.config.mask.substr(c,1)===i.config.mask_char&&(s=s.replace(i.config.mask_char,a.substr(c,1)));var d=s.indexOf(i.config.mask_char),u=!1;return d+1<s.length+1&&(u=s.substr(d+1,1)),-1!==d&&(r===i.config.mask.substr(s.indexOf(i.config.mask_char)-1,1)?s=s.substr(0,s.indexOf(i.config.mask_char)-1):(s=s.substr(0,s.indexOf(i.config.mask_char)),u&&u!==i.config.mask_char&&setTimeout((function(){i.field.val(s+r+u)}),0))),void i.field.val(s)}}if(13===e.which){e.preventDefault(),e.stopImmediatePropagation();a=$(this).val();if(i.intv&&(clearInterval(i.intv),i.intv=null),i.config.change_cb){var h={value:null,obj:{},el:null};a=l(i.config.type,a),h.el=i.field[0],h.property=i.name,h.value=a,h.obj[i.name]=a,i.config.validate&&(h.valid=i.field[0].checkValidity()),i.config.change_cb(h,i.config.params)}else i.field.trigger("change",a)}}}else i.config.mask&&setTimeout((function(){for(var e=t.val(),n="",a=0,o=0;o<i.config.mask.length&&o-a!==e.length;o++)i.config.mask.substr(o,1)===i.config.mask_char||i.config.mask.substr(o,1)===e.substr(o-a,1)?n+=e.substr(o-a,1):i.config.mask.substr(o,1)!==i.config.mask_char&&(n+=i.config.mask.substr(o,1),o&&a++);t.val(n)}),0)})),(i.config.allowed||i.config.forbidden)&&e.restrictField(i.config)}function l(e,t){switch(e){case"string":return String(t);case"number":return Number(t);case"int":return parseInt(t);case"bool":return!![!0,"true",1].includes(t)}}function c(){for(var e=0;e<n.length;e++)n[e].hasOwnProperty("field")&&n[e].field.length&&(n[e].val=$(n[e].field[0]).val())}function d(e){return $(e).serializeArray().map(function(e){return this[e.name]=e.value,this}.bind({}))[0]}this.updateBind=function(e,t){var i=this.getBind(e);return!!i&&(OGX.Data.merge(i.config,t,!0,!1,!1),!0)},this.getBind=function(e){return n.get({el:{in:e}},null,null,1)},this.bindForm=function(a){return OGX.Data.merge(a,t),function(t){for(var a,l,c={el:t.el,config:t,form:$(t.el),fields:new OGX.List,val:""},u=0;u<t.elem_types.length;u++)c.form.find(t.elem_types[u]).each((function(e,n){n.hasAttribute("name")&&(l=n.getAttribute("name"),a=OGX.Data.clone(i),OGX.Data.merge(a,t,!0,!1,!0),t.fields.hasOwnProperty(l)&&(a=OGX.Data.merge(a,t.fields[l],!0)),a.el=t.el+" "+t.elem_types[u]+'[name="'+l+'"]',a.change_cb=r,a.params=t.el,s(a),c.fields.insert({el:a.el}))}));c.form.on("submit",(function(t){if(t.preventDefault(),t.stopImmediatePropagation(),!o){var i={obj:d(c.el),form:c.el};if(c.config.params&&(i.params=c.config.params),c.config.validate){var n=e.validate(c.el);!0===n?i.valid=!0:(i.valid=!1,i.error=n)}c.config.submit_cb?c.config.submit_cb(i):c.form.trigger("submit",i)}})),n.insert(c)}(a),!0},this.enable=function(){o&&(o=!1)},this.disable=function(){o||(o=!0)},this.unbindForm=function(e){if(void 0===e)unbindAll("form");else{var t=n.find("el",e,1);if(t){for(var i in $(document).off("submit",t.el),t.fields)this.unbindField(t.fields[i].el);n.findDelete("el",e,1)}}},this.unbindAll=function(t){void 0===t&&(t="all");for(var i=0;i<n.length;i++)["form","all"].includes(t)&&n[i].hasOwnProperty("fields")?e.unbindForm(n[i].el):["field","all"].includes(t)&&!n[i].hasOwnProperty("fields")&&e.unbindField(n[i].el)},this.bindField=function(e){return OGX.Data.merge(e,i),s(e),!0},this.unbindField=function(e){var t=n.find("el",e,1);t&&($(document).off("input change",t.el),t.config.multiline||$(document).off("keydown",t.el),t.intv&&clearInterval(t.intv),a.find("el",t.el,1)&&this.unrestrictField(t.el),n.findDelete("el",t.el,1))},this.restrictField=function(e){return OGX.Data.merge(e,i),function(e){var t={el:e.el,config:e,field:$(e.el),keys:[],content:null},i=[8,9];null===e.autocomplete&&t.field[0].hasAttribute("autocomplete")&&"on"===t.field.attr("autocomplete")?e.autocomplete=!0:e.autocomplete=!1;e.autocomplete||t.keys.push(229);-1!==["input","texarea"].indexOf(t.field.get(0).tagName.toLowerCase())?t.content="val":t.content="html";t.config.multiline||t.keys.push(13);$(document).on("textInput keydown",t.el,(function(e){if("keydown"===e.type&&8==e.keyCode||46==e.keyCode)$(this).trigger("input");else if("textInput"===e.type){var n=e.originalEvent.data;if(t.config.allowed&&!n.match(t.config.allowed))return e.preventDefault(),e.stopImmediatePropagation(),!1;if(t.config.forbidden&&n.match(t.config.forbidden))return e.preventDefault(),e.stopImmediatePropagation(),!1;if("keydown"===e.type&&-1!==t.keys.indexOf(e.which)&&-1===e.which.indexOf(i))return e.preventDefault(),e.stopImmediatePropagation(),!1;if($(e.originalEvent.target)[t.content]().length>=t.config.max)return e.preventDefault(),e.stopImmediatePropagation(),!1}})),$(document).on("paste",t.el,(function(e){if(!t.config.paste)return e.preventDefault(),e.stopImmediatePropagation(),!1;var i=e.originalEvent.clipboardData.getData("Text");return t.config.forbidden&&i.match(t.config.forbidden)?(e.preventDefault(),e.stopImmediatePropagation(),!1):void 0})),a.insert(t)}(e),!0},this.unrestrictField=function(e){var t=a.find("el",e,1);return!!t&&($(document).off("textInput keydown",t.el),$(document).off("paste",t.el),a.findDelete("el",e,1),!0)},this.toObj=function(e){return d(e)},this.populate=function(e,t,i){var n,a,o;void 0===i&&(i=null),$(e).find("*[name]").each((function(e,r){n=r.getAttribute("name"),o=!1,"string"!=typeof(o=OGX.Data.eval(t,n))&&(o=JSON.stringify(o)),void 0!==o&&(i&&i.hasOwnProperty(n)&&"function"==typeof i[n]&&(o=i[n](o)),(a=$(r)).val(o),r.hasAttribute("type")&&"hidden"===a.attr("type")&&a.trigger("change"))})),setTimeout(c,0)},this.validate=function(e){var i,n=$(e),a=t.elem_types,o=[];return n.find(a.join(",")).each((function(e,t){"submit"!==(i=$(t)).attr("type")&&(t.checkValidity()||o.push(i))})),!o.length||o}},OGX.Form=new OGX.Form,OGX.Geo=function(e){"use strict";var t=this;void 0===e&&(e={});var i,n,a,o={map:null,markers:[],icon:"",browser_loc:null},r=e;function s(e,i){for(var n,a={},o=0;o<e.length;o++){n=!1;for(var r=0;r<i.length;r++){for(var s=0;s<i[r].address_components.length;s++)if(-1!==i[r].address_components[s].types.indexOf(e[o][0])){a.hasOwnProperty(e[o][1])&&a[e[o][1]].length||(a[e[o][1]]=i[r].address_components[s].short_name),n=!0;break}if(n)break}}return a=t.clean(a)}function l(e){return e*(Math.PI/180)}function c(e){return Array.isArray(e)?new google.maps.LatLng(e[0],e[1]):"function"!=typeof e.lat?new google.maps.LatLng(e.lat,e.lng):e}function d(e){var t={gmap:new google.maps.LatLng(e.coords.latitude,e.coords.longitude),raw:{lat:e.coords.latitude,lng:e.coords.longitude}};a?(a(t),a=null):$(document).trigger(OGX.Geo.BROWSER_LOC_SUCCESS,t)}function u(e){$(document).trigger(OGX.Geo.BROWSER_LOC_ERROR,e)}this._NAME_=OGX.Geo.NAME,this.setMap=function(e){r.map=e,google.maps.event.addListenerOnce(r.map,"tilesloaded",(function(){$(document).trigger(OGX.Geo.MAP_LOADED)}))},this.getMap=function(){return r.map},this.getMapRadius=function(){return!!r.map&&function(){if(r.map){var e=r.map.getBounds(),t=e.getCenter(),i=e.getNorthEast(),n=3963,a=t.lat()/57.2958,o=t.lng()/57.2958,s=i.lat()/57.2958,l=i.lng()/57.2958;return n*Math.acos(Math.sin(a)*Math.sin(s)+Math.cos(a)*Math.cos(s)*Math.cos(l-o))}return!1}()},this.getCurrentLocation=function(){return!!r.map&&(e=r.map.getCenter(),new google.maps.LatLng(e.lat(),e.lng()));var e},this.getBrowserLocation=function(e){a=void 0===e?null:e,navigator.geolocation.getCurrentPosition(d,u,{maximumAge:0,timeout:1e4,enableHighAccuracy:!0})},this.getDistance=function(e,t,i,n){var a=l(i-e),o=l(n-t),r=Math.sin(a/2)*Math.sin(a/2)+Math.cos(l(e))*Math.cos(l(i))*Math.sin(o/2)*Math.sin(o/2),s=6371*(2*Math.atan2(Math.sqrt(r),Math.sqrt(1-r)));return Math.round(1e3*s)/1e3},this.addressToLatLng=function(e,t,n){i.geocode({address:e},(function(e,i){i==google.maps.GeocoderStatus.OK?t(e[0].geometry.location,n):t(!1,n)}))},this.getCityBoundaries=function(e,t,n,a,o){i.geocode({address:e+", "+t+", "+n},(function(e,t){t==google.maps.GeocoderStatus.OK?a(e[0].geometry,o):a(!1,o)}))},this.latLngToZip=function(e,t,n){e=c(e),i.geocode({location:e},(function(e,i){if(i===google.maps.GeocoderStatus.OK){var n=s([["postal_code","zip"]],e);t(n)}}))},this.latLngToCountryStateCity=function(e,t,n){e=c(e),i.geocode({location:e},(function(e,i){if(i===google.maps.GeocoderStatus.OK){var a=s([["country","country"],["administrative_area_level_1","state"],["locality","city"],["administrative_area_level_2","city"]],e);t(a,n)}else t(!1,n)}))},this.partialAddressToCountryStateCity=function(e,t,n){i.geocode({address:e},(function(e,i){if(i===google.maps.GeocoderStatus.OK){var a=s([["country","country"],["administrative_area_level_1","state"],["locality","city"],["administrative_area_level_2","city"]],e);t(a,n)}else t(!1,n)}))},this.latLngToAddress=function(e,t,n){e=c(e),i.geocode({location:e},(function(e,i){if(i===google.maps.GeocoderStatus.OK){var a=s([["street_number","number"],["route","street"],["postal_code","zip"],["country","country"],["administrative_area_level_1","state"],["locality","city"],["administrative_area_level_2","city"]],e);e[0].hasOwnProperty("formatted_address")&&(a.formatted=e[0].formatted_address),t(a,n)}else t(!1,n)}))},this.partialAddressToAddress=function(e,t,n){i.geocode({address:e},(function(e,i){if(i===google.maps.GeocoderStatus.OK){var a=s([["street_number","number"],["route","street"],["postal_code","zip"],["country","country"],["administrative_area_level_1","state"],["locality","city"],["administrative_area_level_2","city"]],e);e[0].hasOwnProperty("formatted_address")&&(a.formatted=e[0].formatted_address),a.lat=e[0].geometry.location.lat(),a.lng=e[0].geometry.location.lng(),t(a,n)}else t(!1,n)}))},this.zipToAddress=function(e,t,i){this.partialAddressToAddress(e,t,i)},this.zipToLatLng=function(e,t,n){i.geocode({address:e},(function(e,i){if(i===google.maps.GeocoderStatus.OK){var a={};a.lat=e[0].geometry.location.lat(),a.lng=e[0].geometry.location.lng(),t(a,n)}else t(!1,n)}))},this.getRoute=function(e){var t={start:!1,end:!1,waypoints:!1,optimize:!0,mode:OGX.Geo.TRAVEL_MODE_CAR,callback:!1,params:!1};for(var i in t)e.hasOwnProperty(i)||(e[i]=t[i]);var n=new google.maps.DirectionsService,a={origin:e.start,destination:e.end,travelMode:e.mode};e.waypoints&&(a.waypoints=e.waypoints,e.optimize&&(a.optimizeWaypoints=!0)),n.route(a,(function(t,i){i===google.maps.DirectionsStatus.OK?e.callback(t,e.params):e.callback(!1,e.params)}))},this.calcRouteMinutes=function(e){for(var t=0,i=0;i<e.legs.length;i++)t+=e.legs[i].duration.value;return t=Math.round(t/60)},this.drawRoute=function(e,t){void 0===t&&(t=!0),n||(n=new google.maps.DirectionsRenderer({suppressMarkers:!t})),n.setMap(r.map),n.setDirections(e)},this.clearRoute=function(){r.map&&n&&n.setMap(null)},this.latLngToLoc=function(e,t){return new google.maps.LatLng(e,t)},this.clean=function(e,t){var i;if(void 0===t&&(t=!1),e.hasOwnProperty("city")&&e.hasOwnProperty("vicinity")&&-1!==e.vicinity.indexOf(",")&&(i=new RegExp(", ([a-z -']+)$","gi").exec(e.vicinity))&&i.length>1&&(e.city===i[1]?e.vicinity=e.vicinity.replace(i[0],""):e.city?e.city.length>i[1].length&&(e.city=i[1],e.vicinity=e.vicinity.replace(i[0],"")):e.city=i[1]),t)for(var n in e)-1===t.indexOf(n)&&delete e[n];return e},"undefined"!=typeof google&&void 0!==google.maps?(i=new google.maps.Geocoder,function(){for(var e in o)r.hasOwnProperty(e)||(r[e]=o[e])}(),r.map&&r.markers.length):$(document).trigger(OGX.Geo.ERROR_GMAP)},OGX.Geo.NAME="Geo",OGX.Geo.ERROR="GEO_error",OGX.Geo.ERROR_GMAP="GEO_GMAP_ERROR",OGX.Geo.TRAVEL_MODE_CAR="DRIVING",OGX.Geo.TRAVEL_MODE_TRANSIT="TRANSIT",OGX.Geo.TRAVEL_MODE_WALK="WALKING",OGX.Geo.TRAVEL_MODE_BIKE="BICYCLING",OGX.Geo.BROWSER_LOC_SUCCESS="GEO_BROWSER_LOC_SUCCESS",OGX.Geo.BROWSER_LOC_ERROR="GEO_BROWSER_LOC_ERROR",OGX.Geo.MAP_LOADED="GEO_MAP_LOADED",require("Ghost","Uxi"),OGX.Ghost=function(e){construct(this,"Ghost"),this.el=$(e.el),this._NAME_=OGX.Ghost.NAME,css="ogx_ghost",this.el.addClass(css),delete css},OGX.Ghost.NAME="Ghost",require("GridSwiper","Uxi","Touch"),OGX.GridSwiper=function(e){construct(this,"GridSwiper");var t,i,n,a,o,r,s,l,c,d,u,h,f=this,g=e,_={map:[[!0,!0,!0],[!0,!0,!0],[!0,!0,!0]],axis:{x:!0,y:!0},loop:!0,start:!1,chromeos:!1,capture:!1},p=!1,m={x:null,y:null},v={x:0,y:0},y=".ogx_grid_swiper_cell",x=!1,O=!1,b={x:0,y:0},w={x:0,y:0},G=(new Date).getTime()+Math.round(1e3*Math.random()),X=[];function E(e){e?t.on(f.touch.down,T):t.off(f.touch.down,T)}function T(e){p=!1,o=0,r=0,s=0,l=0,e=Y(e),m.x=e.pageX,m.y=e.pageY,x=!0,M(!0)}function C(e){e?$("body").on(f.touch.up,D):$("body").off(f.touch.up,D)}function D(e){x&&(x=!1,M(!1),S())}function S(e,t,o){var r,s;void 0===e&&(e=0),void 0===t&&(t=0),void 0===o&&(o=!0),o&&k(!0),i.addClass("ogx_grid_swiper_anim"),v=I(i),r=-1*Math.round((v.x+e)/n)*n*-1,s=-1*Math.round((v.y+t)/a)*a*-1,i.css({transform:"translate3d("+r+"px, "+s+"px, 0px)"})}function M(e){e?(N(!0),t.on(f.touch.move,L)):(N(!1),t.off(f.touch.move,L))}function L(e){e=Y(e),g.capture&&(e.preventDefault(),e.stopImmediatePropagation()),o=0,r=0,s=0,l=0,p||(g.axis.x&&Math.abs(e.pageX-m.x)>Math.abs(e.pageY-m.y)?p="x":g.axis.y&&Math.abs(e.pageX-m.x)<Math.abs(e.pageY-m.y)&&(p="y")),p&&(g.axis.x&&"x"===p?(o=Math.abs(e.pageX-m.x),s=e.pageX-m.x>0?1:-1):g.axis.y&&"y"===p&&(r=Math.abs(e.pageY-m.y),l=e.pageY-m.y>0?1:-1))}function N(e){e?h||(O=!1,h=setInterval(A,10)):h&&(clearInterval(h),h=null)}function A(){if((o||r)&&(O||t.trigger(OGX.GridSwiper.SWIPE_START),O=!0),g.axis.x&&"x"===p&&o&&s&&o<=n){if(!g.loop&&(b.x+-1*s<0||b.x+-1*s>g.map[0].length-1))return;if((c=(b.x+-1*s)%g.map[0].length)<0&&(c=Math.abs(g.map[0].length+c)),!1===g.map[w.y][c])return;u=o*s,i.css({transform:"translate3d("+(-1*b.x*n+u)+"px, "+v.y+"px, 0px)"})}else if(g.axis.y&&"y"===p&&r&&l&&r<=a){if(!g.loop&&(b.y+-1*l<0||b.y+-1*l>g.map.length-1))return;if((d=(b.y+-1*l)%g.map.length)<0&&(d=Math.abs(g.map.length+d)),!1===g.map[d][w.x])return;u=r*l,i.css({transform:"translate3d("+v.x+"px, "+(-1*b.y*a+u)+"px, 0px)"})}}function k(e){e?(i.off("transitionend"),i.on("transitionend",(function(){O&&(t.trigger(OGX.GridSwiper.SWIPE_END),O=!1),i.off("transitionend"),i.removeClass("ogx_grid_swiper_anim"),v=I(i);var e={x:null,y:null};e.x=-1*Math.round(v.x/n),e.y=-1*Math.round(v.y/a),b.x!==e.x?(s=b.x>e.x?1:-1,b.x=e.x,w.x=P(b).x,-1===s?(i.children(y+"[data-y="+(b.y-1)+"]").attr("data-x",b.x).css("left",b.x*n),i.children(y+"[data-y="+(b.y+1)+"]").attr("data-x",b.x).css("left",b.x*n),i.children(y+"[data-x="+(b.x-2)+"][data-y="+b.y+"]").attr("data-x",b.x+1).css("left",(b.x+1)*n),t.trigger(OGX.GridSwiper.SWIPE_LEFT,{cell:w,point:b}),R(X=[{x:b.x+1,y:b.y},{x:b.x,y:b.y-1},{x:b.x,y:b.y+1}]),z()):(i.children(y+"[data-y="+(b.y-1)+"]").attr("data-x",b.x).css("left",b.x*n),i.children(y+"[data-y="+(b.y+1)+"]").attr("data-x",b.x).css("left",b.x*n),i.children(y+"[data-x="+(b.x+2)+"][data-y="+b.y+"]").attr("data-x",b.x-1).css("left",(b.x-1)*n),t.trigger(OGX.GridSwiper.SWIPE_RIGHT,{cell:w,point:b}),R(X=[{x:b.x-1,y:b.y},{x:b.x,y:b.y-1},{x:b.x,y:b.y+1}]),z())):b.y!==e.y&&(l=b.y>e.y?1:-1,b.y=e.y,w.y=P(b).y,-1===l?(i.children(y+"[data-x="+(b.x-1)+"]").attr("data-y",b.y).css("top",b.y*a),i.children(y+"[data-x="+(b.x+1)+"]").attr("data-y",b.y).css("top",b.y*a),i.children(y+"[data-y="+(b.y-2)+"][data-x="+b.x+"]").attr("data-y",b.y+1).css("top",(b.y+1)*a),t.trigger(OGX.GridSwiper.SWIPE_UP,{cell:w,point:b}),R(X=[{x:b.x,y:b.y+1},{x:b.x-1,y:b.y},{x:b.x+1,y:b.y}]),z()):(i.children(y+"[data-x="+(b.x-1)+"]").attr("data-y",b.y).css("top",b.y*a),i.children(y+"[data-x="+(b.x+1)+"]").attr("data-y",b.y).css("top",b.y*a),i.children(y+"[data-y="+(b.y+2)+"][data-x="+b.x+"]").attr("data-y",b.y-1).css("top",(b.y-1)*a),t.trigger(OGX.GridSwiper.SWIPE_DOWN,{cell:w,point:b}),R(X=[{x:b.x,y:b.y-1},{x:b.x-1,y:b.y},{x:b.x+1,y:b.y}]),z())),p=0}))):i.off("transitionend")}function I(e,t){var i=e.css("transform");return"none"===i?0:(i=(i=(i=i.substr(7)).substr(0,i.length-1)).split(","),{x:Number(i[4]),y:Number(i[5])})}function Y(e){return e.hasOwnProperty("originalEvent")&&void 0!==e.originalEvent.changedTouches?e.originalEvent.changedTouches[0]:e}function P(e){var t={x:0,y:0};return t.x=e.x%g.map[0].length,t.x<0&&(t.x=Math.abs(g.map[0].length+t.x)),t.y=e.y%g.map.length,t.y<0&&(t.y=Math.abs(g.map.length+t.y)),t}function R(e){for(var t,i={x:null,y:null},n=0;n<e.length;n++){if(e[n].y<0||e[n].y>g.map.length-1){if(!g.loop)return!1;i.y=P(e[n]).y}else i.y=e[n].y;if(e[n].x<0||e[n].x>g.map[0].length-1){if(!g.loop)return!1;i.x=P(e[n]).x}else i.x=e[n].x;t=g.map[i.y][i.x],H(e[n],t)}}function H(e,t){var n=!1;switch(typeof t){case"string":i.children(y+'[data-x="'+e.x+'"][data-y="'+e.y+'"]').children(y+"_content:first").html(t);break;case"function":(n=t(e,P(e),{x:e.x-b.x,y:e.y-b.y},i.children(y+'[data-x="'+e.x+'"][data-y="'+e.y+'"]').children(y+"_content:first")[0]))&&i.children(y+'[data-x="'+e.x+'"][data-y="'+e.y+'"]').children(y+"_content:first").html(n);break;case"object":var a='.ogx_grid_swiper[data-ogx-id="'+G+'"] > .ogx_grid_swiper_container > '+y+'[data-x="'+e.x+'"][data-y="'+e.y+'"] > '+y+"_content",o=P(e);for(var r in t){t[r].id="cell_"+o.x+"_"+o.y;break}t=OGX.OML.rename(t,a);var s=f.nodes.find("id","cell_"+o.x+"_"+o.y,1);s&&f.remove(s._NAME_,s.id),$(a).empty(),OGX.OML.render(f,t,{abs:e,rel:P(e)}),z()}}function z(){for(var e=0;e<f.nodes.length;e++)f.nodes[e].id==="cell_"+w.x+"_"+w.y?f.nodes[e].focus():f.nodes[e].blur()}function W(){X=[],g.axis.x&&(X.push({x:g.start.x-1,y:g.start.y}),X.push({x:g.start.x+1,y:g.start.y})),X.push({x:g.start.x,y:g.start.y}),g.axis.y&&(X.push({x:g.start.x,y:g.start.y-1}),X.push({x:g.start.x,y:g.start.y+1})),R(X)}function j(){g.map.length||(g.map=[[]],g.axis.y=!1),g.map.length&&!Array.isArray(g.map[0])&&(g.map=[g.map],g.axis.y=!1),g.start||(g.start={x:null,y:null},g.start.y=Math.floor(g.map.length/2),g.start.x=Math.floor(g.map[0].length/2))}function U(){var e=g.start.x*-n,o=g.start.y*-a,r=g.start.y-1,s=g.start.x,l='<div class="ogx_grid_swiper_container" style="transform:translate3d('+e+"px, "+o+'px, 0px);">',c=-1*e,d=-1*o-a;g.axis.y&&(l+='<div class="ogx_grid_swiper_cell" style="left:'+c+"px; top:"+d+'px;" data-x="'+s+'" data-y="'+r+'"><div class="ogx_grid_swiper_cell_content"></div></div>',l+='<div class="ogx_grid_swiper_cell" style="left:'+c+"px; top:"+(d+2*a)+'px;" data-x="'+s+'" data-y="'+(r+2)+'"><div class="ogx_grid_swiper_cell_content"></div></div>'),l+='<div class="ogx_grid_swiper_cell" style="left:'+c+"px; top:"+(d+a)+'px;" data-x="'+s+'" data-y="'+(r+1)+'"><div class="ogx_grid_swiper_cell_content"></div></div>',g.axis.x&&(l+='<div class="ogx_grid_swiper_cell" style="left:'+(c-n)+"px; top:"+-1*o+'px;" data-x="'+(s-1)+'" data-y="'+g.start.y+'"><div class="ogx_grid_swiper_cell_content"></div></div>',l+='<div class="ogx_grid_swiper_cell" style="left:'+(c+n)+"px; top:"+-1*o+'px;" data-x="'+(s+1)+'" data-y="'+g.start.y+'"><div class="ogx_grid_swiper_cell_content"></div></div>'),l+="</div>",t.html(l),i=t.children(".ogx_grid_swiper_container:first"),b.x=g.start.x,b.y=g.start.y,v.x=e,v.y=o,w.x=g.start.x,w.y=g.start.y}this._NAME_=OGX.GridSwiper.NAME,this.el=null,this.enable=function(){E(!0),C(!0),z()},this.disable=function(){E(!1),C(!1),N(!1)},this.focus=function(){this.blured&&(this.blured=!1,this.enabled&&(this.ux(!0),this.enable()))},this.resize=function(){k(!1),i.removeClass("ogx_grid_swiper_anim"),n=t.width(),a=t.height();var e=b.x*-n,o=b.y*-a;i.children(y+"[data-y="+(b.y-1)+"]").css({top:(b.y-1)*a,left:b.x*n}),i.children(y+"[data-y="+b.y+"]").css({top:b.y*a,left:b.x*n}),i.children(y+"[data-y="+(b.y+1)+"]").css({top:(b.y+1)*a,left:b.x*n}),i.children(y+"[data-x="+(b.x-1)+"]").css({top:b.y*a,left:(b.x-1)*n}),i.children(y+"[data-x="+(b.x+1)+"]").css({top:b.y*a,left:(b.x+1)*n}),i.css("transform","translate3d("+e+"px, "+o+"px, 0px"),M(!1),setTimeout((function(){S(0,0,!1),i.addClass("ogx_grid_swiper_anim")}),0)},this.setMap=function(e,t){g.map=e,void 0!==t&&(g.start=t),j(),U(),W()},this.setMapCell=function(e,t){g.map[e.y]||(g.map[e.y]=[]),g.map[e.y][e.x]=t},this.getMapCell=function(e){return e.y>0&&g.map.length<e.y&&e.x>0&&g.map[e.y].length<e.x&&g.map[e.y][e.x]},this.getCells=function(){var e,t,n,a,o=[];return i.children(y).each((function(i,r){e=$(r),t={x:Number(e.attr("data-x")),y:Number(e.attr("data-y"))},n=P(t),a={x:t.x-b.x,y:t.y-b.y},o.push({abs:t,rel:n,offset:a,element:r})})),o},this.getCellContent=function(e){return i.children(y+"[data-x="+e.x+"][data-y="+e.y+"]").children(y+"_content:first")[0]},this.getCurrentCell=function(){return w},this.renderCellContent=function(e){R([e])},this.setTopCell=function(e){this.setOffsetCell({x:0,y:-1},e)},this.setBottomCell=function(e){this.setOffsetCell({x:0,y:1},e)},this.setLeftCell=function(e){this.setOffsetCell({x:-1,y:0},e)},this.setRightCell=function(e){this.setOffsetCell({x:1,y:0},e)},this.setOffsetCell=function(e,t){var i={x:e.x+b.x,y:e.y+b.y};this.setMapCell(i,t)},this.getOffsetCell=function(e){var t={x:e.x+b.x,y:e.y+b.y};return this.getMapCell(t)},this.getOffsetCellContent=function(e){var t={x:e.x+b.x,y:e.y+b.y};return this.getCellContent(t)},this.swipeRight=function(){S(-n)},this.swipeLeft=function(){S(n)},this.swipeUp=function(){S(0,-a)},this.swipeDown=function(){S(0,a)},OGX.Data.merge(g,_),(t=$(g.el)).addClass("ogx_grid_swiper"),t.attr("data-ogx-id",G),n=t.width(),a=t.height(),j(),U(),W()},OGX.GridSwiper.NAME="GridSwiper",OGX.GridSwiper.SWIPE_LEFT="GridSwiperSwipeLeft",OGX.GridSwiper.SWIPE_RIGHT="GridSwiperSwipeRight",OGX.GridSwiper.SWIPE_UP="GridSwiperSwipeUp",OGX.GridSwiper.SWIPE_DOWN="GridSwiperSwipeDown",OGX.GridSwiper.SWIPE_START="GridSwiperSwipeStart",OGX.GridSwiper.SWIPE_END="GridSwiperSwipeEnd",require("GroupedList","Uxi","Bind","Touch"),OGX.GroupedList=function(e){construct(this,"GroupedList");var t,i,n,a,o,r=this,s=e,l={group_by:"name",group_mode:null,group_param:null,group_order:null,order:null,list:new OGX.List,key:null,swipe:!1,reorder:!1,display:!1,mode:OGX.DynamicList.SELECT_MODE_HIT,scope:["public"]},c=[];function d(e){e?t.on(r.touch.down,".ogx_grouped_list_item",u):t.off(r.touch.down,".ogx_grouped_list_item",u)}function u(){t.find(".ogx_grouped_list_selected_item").removeClass("ogx_grouped_list_selected_item"),$(this).addClass("ogx_grouped_list_selected_item");var e=s.list[Number($(this).data("id"))];t.trigger(OGX.GroupedList.SELECT,e)}function h(e){var t=s.group_order.indexOf(e);if(-1===t)return t;for(var i=t,n=0;n<t;n++)-1===c.indexOf(s.group_order[n])&&i--;return i}function f(e,t){for(var n,a=0;a<i.nodes.length;a++)if(n=i.nodes[a].val().find(e,t,1))return{list:i.nodes[a],item:n};return!1}function g(){var e=!1,t=!1;if(s.list&&(e=s.list,a&&(e=n),e.length&&(t=o,o=e.group(s.group_by,s.group_mode,s.group_param))),e&&e.length){if(JSON.stringify(t)!==JSON.stringify(o)){r.find(OGX.NestList.NAME,r.id+"_nests","remove");var l=function(){var e='.ogx_grouped_list[data-ogx-id="'+r.id+'"]',t={};t[e+":NestList"]={id:r.id+"_nests",list:[],"node:OML":[]};var i,n=[],a=OGX.Data.clone(s.group_order);for(var l in o)i=s.group_order?s.group_order.indexOf(l):n.length,t[e+":NestList"].list.push({title:l}),c.push(l),n[i]={"default:DynamicList":{list:o[l],key:s.key,mode:s.mode,display:s.display,swipe:s.swipe,reorder:s.reorder,order:s.order}};for(var d=0;d<n.length;d++)void 0===n[d]&&(n.splice(d,1),a.splice(d,1),d--);return t[e+":NestList"]["node:OML"]=n,t[e+":NestList"].order=a,t}();OGX.OML.render(r,l),(i=r.find(OGX.NestList.NAME,r.id+"_nests")).updateNestsHeight()}}else o=!1,r.el.empty()}this._NAME_=OGX.GroupedList.NAME,this.el=null,this.enable=function(){d(!0)},this.disable=function(){d(!1)},this.bindFilter=function(e,t,i){s.list.removeFilter(e),void 0!==i&&s.list.addFilter(e,t,i),s.list.getFilters()&&(n=s.list.filter(),a=!0),setTimeout(g,0)},this.bindValue=function(){return this.getSelection()},this.destroy=function(){this.clearBinds()},this.scope=function(e){return void 0!==e?(s.scope=e,i.scope(e),!0):s.scope},this.val=function(e){if(void 0===e)return s.list;e.hasOwnProperty("insert")||(e=new OGX.List(e));var t=s.list.getFilters();"{}"!==JSON.stringify(t)&&(a=!0,e.setFilters(t),n=e.filter()),s.list=e,setTimeout(g,0)},this.nests=function(){return i||!1},this.filter=function(){return n=s.list.filter(),a=!0,setTimeout(g,0),!0},this.unfilter=function(){return a=!1,setTimeout(g,0),!0},this.addFilter=function(e,t,i){return s.list.addFilter(e,t,i)},this.removeFilter=function(e,t,i){return s.list.removeFilter(e,t,i)},this.resetFilters=function(){return s.list.resetFilters()},this.getFilters=function(){return s.list.getFilters()},this.addGroup=function(e,t,n){if(s.list.length){var a={title:e,scope:s.scope},o={};void 0===t&&(t=[]),o["default:DynamicList"]={list:t,key:s.key,mode:s.mode,display:s.display,swipe:s.swipe,reorder:s.reorder},i.addNest(a,o,n),s.group_order.insert(e,n),s.list=new OGX.List(s.list.concat(t)),c.push(e)}else s.list.insert(t),g()},this.removeGroup=function(e){return!!this.getGroupList(e)&&(i.removeNest(e),s.list.findDelete(s.group_by,e),c.splice(c.indexOf(e),1),!0)},this.addToGroup=function(e,t){var n=this.getGroupList(e);n&&(n.insert(t),s.list.push(t),setTimeout((function(){i.updateNestHeight(e)}),0))},this.removeFromGroup=function(e,t,n){2===arguments.length&&(n=t,t=s.key);var a=this.getGroupList(e);a&&(a.findDelete(t,n,1),s.list.findDelete(t,n,1),a.val().length?setTimeout((function(){i.updateNestHeight(e)}),0):this.removeGroup(e))},this.updateGroupItem=function(e,t,i,n){this.getGroupList(e).findUpdate(t,i,n,!1,1),s.list.findUpdate(t,i,n,1)},this.replaceGroupItem=function(e,t,i,n){this.getGroupList(e).findReplace(t,i,n),s.list.findReplace(t,i,n,1)},this.getGroupList=function(e){var t=h(e);return-1!==t&&t<i.nodes.length&&i.nodes[t]},this.hasGroup=function(e){return-1!==c.indexOf(e)},this.addItem=function(e){if(s.list.length){var t=e[s.group_by];if(this.hasGroup(t))this.addToGroup(t,e);else{var n=-1;-1!==s.group_order.indexOf(t)&&(n=h(t)),-1!==n?this.addGroup(t,[e],n):this.addGroup(t,[e])}setTimeout((function(){i.updateNestHeight(t)}),0)}else s.list.insert(e),g()},this.removeItem=function(e,t){s.key&&1===arguments.length&&(t=e,e=s.key);var n=s.list.find(e,t,1);if(n){var a=n[s.group_by];return this.removeFromGroup(a,e,t),setTimeout((function(){i.updateNestHeight(a)}),0),!0}return!1},this.replaceItem=function(e,t,n){s.key&&2===arguments.length&&(t=e,e=s.key);var a=f(e,t);if(a){var o=null;return a.item[s.group_by]!==n[s.group_by]?(o=a.item[s.group_by],a.list.findDelete(e,t,1),s.list.findDelete(e,t,1),-1===s.list.unique(s.group_by,!1).indexOf(o)&&(this.removeGroup(o),o=!1),this.addItem(n),setTimeout((function(){o&&i.updateNestHeight(a.item[s.group_by]),i.updateNestHeight(n[s.group_by])}),0)):a.list.findReplace(e,t,n),!0}return!1},this.updateItem=function(e,t,n,a){if(s.key){var o=arguments.length;void 0!==a&&(o--,a=!1),2===o&&(n=t,t=e,e=s.key)}var r=f(e,t);if(r){if(n.hasOwnProperty(s.group_by)&&r.item[s.group_by]!==n[s.group_by]){var l=r.item[s.group_by],c=r.list.findDelete(e,t,1);r.list.val().length||this.removeGroup(l),s.list.findDelete(e,t,1),c=OGX.Data.merge(c,n,!0,!1,a),this.addItem(c),r.list.val().length&&setTimeout((function(){i.updateNestHeight(l)}),0)}else r.list.findUpdate(e,t,n,a,1);return!0}return!1},this.render=function(){return setTimeout(g,0),!0},this.refresh=function(){var e=t.find(".ogx_grouped_list_selected_item:first");if(e.length>0){var i=e.data("id");e.html(OGX.Templater.make(s.template,s.list[i]))}},OGX.Data.merge(s,l),s.list.hasOwnProperty("insert")||(s.list=new OGX.List(s.list)),s.group_order&&!s.group_order.hasOwnProperty("insert")&&(s.group_order=new OGX.List(s.group_order)),s.display&&s.display.hasOwnProperty("css")&&("object"!=typeof s.display.css&&s.display.css?s.display.css+=" ogx_grouped_list_item":s.display.hasOwnProperty("add")?s.display.add="ogx_grouped_list_item "+s.display.add:s.display.add="ogx_grouped_list_item"),o=!1,r.el=t=$(s.el),t.addClass("ogx_grouped_list"),g()},OGX.GroupedList.NAME="GroupedList",OGX.GroupedList.SELECT="GroupedListSelect",OGX.GroupedList.BIND=OGX.GroupedList.SELECT,require("Html","Uxi","Placeholder"),OGX.Html=function(e){construct(this,"Html"),this.rendered=!1,this._NAME_=OGX.Html.NAME,void 0!==e&&e&&(this.el=$(e.el),OGX.HtmlRender(e))},OGX.HtmlRender=function(e){var t=$(e.el),i=new OGX.Display(e);data=!1,e.data&&Object.keys(e.data).length&&(data=e.data),t.html(i.html(data)),e.css&&t.addClass(i.css(data)),e.hasOwnProperty("id")&&e.id&&"#"===e.id.substr(0,1)&&t.attr("id",e.id.substr(1))},OGX.Html.NAME="Html",require("Iceberg","Uxi","Touch"),OGX.Iceberg=function(e){construct(this,"Iceberg");var t,i,n,a,o=this,r={left:0,right:0,top:0,bottom:0,min:50,drag:!0,flatten:!1,"node:OML":{}},s=e,l=!1,c="normal",d="main",u={left:null,main:null,right:null,top:null,bottom:null},h=[0,0,0],f=0,g=0,_=0,p=0;function m(e){for(var t in u)u[t]&&u[t].instance&&(e===t?u[t].instance.focus():u[t].instance.blur())}function v(){l.hasClass("ogx_iceberg_anim")||(l.off("transitionend"),h=b(l))}function y(e){var t=0;return e.dirY&&e.distY>e.distX&&(t=1),t}function x(e){s.drag&&e.dist&&(!(n=y(e))&&["main","left","right"].includes(d)?e.dirX&&e.distX&&(t=h[0]+e.distX*e.dirX)<=g&&t>=f&&l.css({transform:"translate3d("+t+"px, 0, 0)"}):["main","top","bottom"].includes(d)&&e.dirY&&e.distY&&(i=h[1]+e.distY*e.dirY)<=p&&i>=_&&l.css({transform:"translate3d(0, "+i+"px, 0)"}))}function O(e){if(t=0,i=0,n=y(e),e.swipe&&e.dist){var o;switch(e.swipe=!1,d){case"main":-1===e.dirX&&s.right&&!n?(t=-u.right.outerWidth(),o="right",e.swipe=!0):1===e.dirX&&s.left&&!n?(t=u.left.outerWidth(),o="left",e.swipe=!0):1===e.dirY&&s.top&&n?(i=u.top.outerHeight(),o="top",e.swipe=!0):-1===e.dirY&&s.bottom&&n&&(i=-u.bottom.outerHeight(),o="bottom",e.swipe=!0);break;case"left":-1!==e.dirX||n||(t=0,o="main",e.swipe=!0);break;case"right":1!==e.dirX||n||(t=0,o="main",e.swipe=!0);break;case"top":-1===e.dirY&&n&&(i=0,o="main",e.swipe=!0);break;case"bottom":1===e.dirY&&n&&(i=0,o="main",e.swipe=!0)}a=n?1===e.dirY?OGX.Iceberg.SWIPE_DOWN:OGX.Iceberg.SWIPE_UP:1===e.dirX?OGX.Iceberg.SWIPE_RIGHT:OGX.Iceberg.SWIPE_LEFT,e.swipe&&e.dist&&(l.addClass("ogx_iceberg_anim"),l.on("transitionend",(function(){l.off("transitionend"),l.removeClass("ogx_iceberg_anim"),h=b(l),m(d=o),l.trigger(a,d)})),l.css({transform:"translate3d("+t+"px, "+i+"px, 0)"}))}else if(e.dist){switch(t=0,i=0,d){case"left":t=u.left.outerWidth();break;case"right":t=-u.right.outerWidth();break;case"top":i=u.top.outerHeight();break;case"bottom":i=-u.bottom.outerHeight()}l.addClass("ogx_iceberg_anim"),l.on("transitionend",(function(){l.off("transitionend"),l.removeClass("ogx_iceberg_anim"),h=b(l),l.trigger(OGX.Iceberg.RESTORE,d)})),l.css({transform:"translate3d("+t+"px, "+i+"px, 0)"})}}function b(e){var t=e[0].style.transform;if(t=t.match(/translate3d\(([0-9px%,\.\- ]+)\)/)){t=t[1].split(",");for(var i=0;i<t.length;i++)t[i]=Number(t[i].split("px")[0]);return t}return[0,0,0]}function w(){var e;for(var t in u)u[t]&&((e=u[t].children(":first")).length&&e[0].hasAttribute("data-ogx-id")?u[t].instance=o.nodes.find("id",String(e.data("ogx-id")),1):u[t].instance=!1)}this._NAME_=OGX.Iceberg.NAME,this.el=null,this.show=function(e,t){if(void 0===e&&(e=!1),"normal"===c)for(var i in u)if(u[i]&&u[i].instance&&u[i].instance.id===t){if(!e)return this.val(i),!0;if(u[i].instance._NAME_===u[i].instance.NAME)return this.val(i),!0}return!1},this.val=function(e){if(void 0===e)return d;if(t=0,i=0,"normal"===c){switch(e){case"left":t=u.left.outerWidth();break;case"top":i=u.top.outerHeight();break;case"main":t=0;break;case"right":t=u.left.outerWidth();break;case"bottom":i=-u.bottom.outerHeight()}u[d].instance&&u[d].instance.blur(),u[d=e].instance&&u[d].instance.focus(),l.css({transform:"translate3d("+t+"px, "+i+"px, 0)"})}},this.enable=function(){"flattened"!==c&&(this.touch.swipe.enable(),setTimeout((function(){m(d)}),0))},this.disable=function(){this.touch.swipe.disable()},this.focus=function(){this.blured&&(this.blured=!1,this.enabled&&(this.ux(!0),this.enable()))},this.resize=function(){u.left&&(g=u.left.outerWidth()),u.right&&(f=-u.right.outerWidth()),u.top&&(p=u.top.outerHeight()),u.bottom&&(_=-u.bottom.outerHeight()),s.flatten&&("flattened"!==c&&this.el.outerWidth()>=s.flatten?(c="flattened",h=b(l),l.addClass("ogx_iceberg_views_flattened").css("transform","translate3d(0px, 0px, 0px)"),l.children(".ogx_iceberg_view").addClass("ogx_iceberg_view_flattened"),this.disable()):"flattened"===c&&this.el.width()<s.flatten&&(c="normal",l.children(".ogx_iceberg_view").removeClass("ogx_iceberg_view_flattened"),l.removeClass("ogx_iceberg_views_flattened").css("transform","translate3d("+h[0]+"px, 0px, 0px)"),this.enable()))},OGX.Data.merge(s,r),width=Math.round($(s.el).innerWidth()),height=$(s.el).innerHeight(),o.el=$(s.el),o.el.addClass("ogx_iceberg"),function(){var e,t,i='<div class="ogx_iceberg_views ogx_hw">',n={},a='.ogx_iceberg[data-ogx-id="'+o.id+'"] > .ogx_iceberg_views > .ogx_iceberg_view[data-ogx-panel-id="';for(var r in s["node:OML"])for(var c in s["node:OML"][r])0===c.indexOf("left")&&(i+='<div class="ogx_iceberg_view_left ogx_view ogx_iceberg_view" data-ogx-panel-id="left" style="width:'+(isNaN(s.left)?s.left:s.left+"px")+';"></div>',n.left=a+'left"]',u.left=!0),0===c.indexOf("top")&&(i+='<div class="ogx_iceberg_view_top ogx_view ogx_iceberg_view" data-ogx-panel-id="top" style="height:'+(isNaN(s.top)?s.top:s.top+"px")+';"></div>',n.top=a+'top"]',u.top=!0),0===c.indexOf("main")&&(i+='<div class="ogx_iceberg_view_main ogx_view ogx_iceberg_view" data-ogx-panel-id="main"></div>',n.main=a+'main"]'),0===c.indexOf("right")&&(i+='<div class="ogx_iceberg_view_right ogx_view ogx_iceberg_view" data-ogx-panel-id="right" style="width:'+(isNaN(s.right)?s.right:s.right+"px")+';"></div>',n.right=a+'right"]',u.right=!0),0===c.indexOf("bottom")&&(i+='<div class="ogx_iceberg_view_bottom ogx_view ogx_iceberg_view" data-ogx-panel-id="bottom" style="height:'+(isNaN(s.bottom)?s.bottom:s.bottom+"px")+';"></div>',n.bottom=a+'bottom"]',u.bottom=!0);for(o.el.html(i),r=0;r<s["node:OML"].length;r++)for(var c in s["node:OML"][r])e=c.split(":")[0],t=c.replace(e,n[e]),s["node:OML"][r][t]=s["node:OML"][r][c],delete s["node:OML"][r][c];l=o.el.children(".ogx_iceberg_views:first"),u.left&&(u.left=l.children(".ogx_iceberg_view_left:first"),g=u.left.outerWidth()),u.top&&(u.top=l.children(".ogx_iceberg_view_top:first"),p=u.top.outerHeight()),u.main=l.children(".ogx_iceberg_view_main:first"),u.right&&(u.right=l.children(".ogx_iceberg_view_right:first"),f=-u.right.outerWidth()),u.bottom&&(u.bottom=l.children(".ogx_iceberg_view_bottom:first"),_=-u.bottom.outerHeight())}(),setTimeout(w,0),o.touch.swipe.set({x:!0,y:!0,min_x:s.min,min_y:s.min,cb_down:v,cb_swipe:x,cb_up:O}),o.resize()},OGX.Iceberg.NAME="Iceberg",OGX.Iceberg.SHOW="icebergShow",OGX.Iceberg.SWIPE_UP="icebergSwipeUp",OGX.Iceberg.SWIPE_DOWN="icebergSwipeDown",OGX.Iceberg.SWIPE_LEFT="icebergSwipeLeft",OGX.Iceberg.SWIPE_RIGHT="icebergSwipeRight",OGX.Iceberg.RESTORE="icebergRestore",OGX.Loading=function(e){"use strict";var t=!1,i={display:{css:"ogx_loading",html:" ",anim:OGX.Overlay.FADE}};e.hasOwnProperty("loading")&&e.loading&&setTimeout(this.addLoading,0),this.hasLoading=function(){return!!t},this.addLoading=function(e){t||(t=!0,void 0===e&&(e={}),OGX.Data.merge(e,i),this.addOverlay(e))},this.removeLoading=function(e){t&&(this.removeOverlay(e),t=!1)}},OGX.Media=function(){"use strict";var e=!1,t={},i=0;function n(e,t,i){var n=$(e),a=n.parent().innerWidth(),o=n.parent().innerHeight(),r=function(e,t){var i={};return e.width/e.height>t.width/t.height?(i.width=t.width,i.height=Math.round(e.height*(t.width/e.width))):(i.width=Math.round(e.width*(t.height/e.height)),i.height=t.height),i}({width:t,height:i},{width:a,height:o}),s=(a-r.width)/2,l=(o-r.height)/2;n.css("left",s+"px"),n.css("top",l+"px"),n.prop("width",r.width),n.prop("height",r.height)}function a(e){var t,i=$(e);i&&(i.find(".ogx_video").each((function(e,i){t=$(i),function(e,t,i){var n=$(e),a=t/i,o=n.parent().innerWidth(),r=n.parent().innerHeight(),s=o,l=Math.ceil(s/a);l<r&&(s=(l=r)*a),n.prop("width",s),n.prop("height",l)}(i,parseInt(t.data("width"),10),parseInt(t.data("height"),10))})),i.find(".ogx_video_resp").each((function(e,i){t=$(i),function(e,t,i){var n=$(e),a=t/i,o=n.parent().innerWidth(),r=n.parent().innerHeight(),s=o,l=Math.ceil(s/a);l<r&&(s=(l=r)*a),n.prop("width",s),n.prop("height",l)}(i,parseInt(t.data("width"),10),parseInt(t.data("height"),10))})),i.find(".ogx_video_poster").each((function(e,i){t=$(i),function(e,t,i){var n=$(e),a=t/i,o=n.parent().innerWidth(),r=n.parent().innerHeight(),s=o,l=Math.ceil(s/a),c=0,d=0;l<r&&(l=r,s=Math.ceil(l*a)),s>o?c=(s-o)/2*-1:s<o&&(c=(o-s)/2*-1),l>r?d=(l-r)/2*-1:l<r&&(d=(r-l)/2*-1),n.css("left",c+"px"),n.css("top",d+"px"),n.prop("width",s),n.prop("height",l)}(i,parseInt(t.data("width"),10),parseInt(t.data("height"),10))})),i.find(".ogx_image_contain").each((function(e,i){t=$(i),n(i,parseInt(t.data("width"),10),parseInt(t.data("height"),10))})),i.find(".ogx_image_cover").each((function(e,i){t=$(i),function(e,t,i){var n=$(e),a=n.parent().innerWidth(),o=a/(t/i),r=(n.parent().innerHeight()-o)/2;r>0&&(r=0),n.parent().css("overflow","hidden"),n.prop("width",a),n.prop("height",o),n.css("top",r+"px")}(i,parseInt(t.data("width"),10),parseInt(t.data("height"),10))})),i.find(".ogx_image_fit").each((function(e,i){t=$(i),function(e,t,i){var n=$(e),a=t/i,o=n.parent().innerWidth(),r=o,s=Math.ceil(r/a),l=0;r>o?l=(r-o)/2*-1:r<o&&(l=(o-r)/2*-1),n.css("left",l+"px"),n.prop("width",r),n.prop("height",s)}(i,parseInt(t.data("width"),10),parseInt(t.data("height"),10))})),i.find(".ogx_image_scale").each((function(e,i){t=$(i),function(e,t,i){var n=$(e),a=t/i,o=n.parent().innerWidth(),r=Math.ceil(o/a);n.prop("width",o),n.prop("height",r)}(i,parseInt(t.data("width"),10),parseInt(t.data("height"),10))})),i.find(".ogx_image_resp").each((function(e,i){t=$(i),function(e,t,i){var n=$(e),a=t/i,o=n.parent().innerWidth();o>t&&(o=t);var r=Math.ceil(o/a);n.prop("width",o),n.prop("height",r)}(i,parseInt(t.data("width"),10),parseInt(t.data("height"),10))})))}function o(e){e?$(window).on("resize",r):$(window).off("resize",r)}function r(){for(var e in t)a(t[e].selector)}function s(e){var t;e.find(".ogx_video, .ogx_video_resp, .ogx_video_poster").each((function(e,i){(t=$(i)).parent().css("overflow","hidden"),i.hasAttribute("data-width")||(t.attr("data-width",t.attr("width")),t.attr("data-height",t.attr("height")))})),e.find(".ogx_image_cover, .ogx_image_contain, .ogx_image_fit, .ogx_image_scale, .ogx_image_resp").each((function(e,i){(t=$(i)).css("position","relative"),i.hasAttribute("data-width")||(t.attr("data-width",t.attr("width")),t.attr("data-height",t.attr("height")))})),a(e)}this.resize=function(e){void 0!==e?a(e):r()},this.bind=function(n,a){return!t.hasOwnProperty(n)&&(t[n]={observer:null,element:a},t[n].observer=(r=a,l=null,(c=new(window.MutationObserver||window.WebKitMutationObserver)((function(e,t){e.forEach((function(e){l&&clearTimeout(l),l=setTimeout((()=>{s($(r))}),10)}))}))).observe(document.querySelector(r),{childList:!0,subtree:!0}),c),t[n].selector=a,i++,e||(e=!0,o(!0)),s($(a)),!0);var r,l,c},this.unbind=function(n){return!(!t.hasOwnProperty(n)||!t[n].observer)&&(t[n].observer.disconnect(),delete t[n],!--i&&e&&(e=!1,o(!1)),!0)}},OGX.Media=new OGX.Media,require("NestList","Uxi","Bind"),OGX.NestList=function(e){construct(this,"NestList");var t,i,n=this,a={scope:["public"],template:'<div class="ogx_nest_list_item {{$dsp}}" data-ogx-nest-id="{{$id}}"><div class="ogx_nest_list_item_head {{$css}}"><span class="ogx_nest_list_item_title">{{$title}}</span><span class="ogx_nest_list_item_icon"></span></div><div class="ogx_nest_list_item_body"><div class="ogx_nest_list_item_content">{{$body}}</div></div></div>',list:new OGX.List,item_default:!1,map:{title:"title",scope:"scope",id:"id"},order:!1},o={title:"",scope:[],open:!0},r={id:0,title:!1,scope:[],height:0,y:0,hidden:!1,open:!0,selector:!1},s=e,l=!1,c=0,d=0,u=1,h={y:0,h:0,way:1},f=!1,g=new OGX.List;function _(e){e?t.on("click",".ogx_nest_list_item_head",p):t.off("click",".ogx_nest_list_item_head",p)}function p(e){l||(l=!0,m($(this)))}function m(e){var i=e.parent(0).data("ogx-nest-id"),n=!1;e.hasClass("ogx_nest_list_item_head_closed")?(h.way=1,e.addClass("ogx_nest_list_item_head_open").removeClass("ogx_nest_list_item_head_closed"),g.findUpdate("id",i,{open:!0},!1,1),n=!0):(h.way=0,e.removeClass("ogx_nest_list_item_head_open").addClass("ogx_nest_list_item_head_closed"),g.findUpdate("id",i,{open:!1},!1,1));var a=g.find("id",i,1);n?(!function(e){var t=v(e);if(t)return t.focus(),!0}(a),t.trigger(OGX.NestList.OPEN,a)):(!function(e){var t=v(e);if(t)return t.blur(),!0}(a),t.trigger(OGX.NestList.CLOSE,a)),setTimeout(x,0)}function v(e){var t=$(e.selector).find(".ogx_uxi:first");if(t.length){var i=String(t.data("ogx-id")),a=n.nodes.find("id",i,1);if(a)return a}return!1}function y(e){if(e.hasOwnProperty("scope"))for(var t=0;t<e.scope.length;t++)if(-1!==s.scope.indexOf(e.scope[t]))return!0;return!1}function x(){var e;!function(){var e=0;d=0,h.y=0,h.h=0;for(var i=0;i<g.length;i++)g[i].y=e,g[i].hidden||(c||(c=t.children(".ogx_nest_list_item:eq("+i+")").children(".ogx_nest_list_item_head").outerHeight(!0)),d+=c,h.y=e,g[i].open&&(h.y+=g[i].height,e+=g[i].height,d+=g[i].height),h.h=g[i].height);d-=h.h}();for(var i=t.children(".ogx_nest_list_mask:first"),a=0;a<g.length;a++)(e=t.children('.ogx_nest_list_item[data-ogx-nest-id="'+g[a].id+'"]')).removeClass("ogx_nest_list_item_noanim"),e.css("transform","translateY("+g[a].y+"px)");var o="height:"+Math.ceil(d+h.h)+"px !important;";i.on("transitionend",(function(){h.way||t.css("cssText",o),l=!1,n.scroller&&n.scroller.resize()})),h.way&&t.css("cssText",o),setTimeout((function(){i.css({transform:"translateY("+h.y+"px)"})}),0)}function O(e,i){OGX.Data.merge(e,o);var a=OGX.Data.merge(r,e,!0,!0);e.hasOwnProperty(s.map.id)?a.id=e[s.map.id]:(a.id=u,u++);var l,c,d=((c={css:"",dsp:"ogx_nest_list_prep",id:(l=a).id})[s.map.title]=l[s.map.title],l.open?c.css="ogx_nest_list_item_head_open":c.css="ogx_nest_list_item_head_closed",OGX.Templater.make(s.template,c));void 0!==i&&i<s.list.length-1?t.children(".ogx_nest_list_item:eq("+i+")").before(d):t.children(".ogx_nest_list_mask:first").before(d),a.selector='.ogx_nest_list[data-ogx-id="'+n.id+'"] > .ogx_nest_list_item[data-ogx-nest-id="'+a.id+'"] > .ogx_nest_list_item_body > .ogx_nest_list_item_content';var h=$('.ogx_nest_list[data-ogx-id="'+n.id+'"] > .ogx_nest_list_item[data-ogx-nest-id="'+a.id+'"]');return a.hidden&&h.addClass("ogx_nest_list_item_hidden"),h.removeClass("ogx_nest_list_prep"),a}function b(){var e=s.list;f&&(e=i),t.empty(),g.clear();var a;t.html('<div class="ogx_nest_list_mask"></div>'),s.hasOwnProperty("node:OML")||(s["node:OML"]=[]);for(var o=0;o<e.length;o++)a=O(e[o]),g.push(a),s["node:OML"][o]=OGX.OML.rename(s["node:OML"][o],a.selector);n.observe(!0,{childList:!0,subtree:!0},(function(){n.updateNestsHeight()}))}function w(){for(var e=[],t=0;t<s.list.length;t++)e[s.order.indexOf(s.list[t][s.map.title])]=s.list[t];return s.list=new OGX.List(e)}function G(){s.list.hasOwnProperty("insert")||(s.list=new OGX.List(s.list));for(var e=0;e<s.list.length;e++)s.item_default?OGX.Data.merge(s.list[e],s.item_default):OGX.Data.merge(s.list[e],o),s.order&&w()}this.el=null,this._NAME_=OGX.NestList.NAME,this.enable=function(){_(!0)},this.disable=function(){_(!1)},this.show=function(e,t){var i=this.find(e,t);i&&m(i.el.parents(".ogx_nest_list_item:first").children(".ogx_nest_list_item_head:first"))},this.bindFilter=function(e,t,n){s.list.removeFilter(e),void 0!==n&&s.list.addFilter(e,t,n),s.list.getFilters()&&(i=s.list.filter(),f=!0),setTimeout(b,0)},this.destroy=function(){t.children(".ogx_nest_list_mask").off("transitionend"),n.observe(!1)},this.scope=function(e){return void 0!==e?(s.scope=e,function(){for(var e,i=0;i<g.length;i++)(e=t.children(g[i].selector)).addClass("ogx_nest_list_item_noanim"),y(g[i])?(g[i].hidden=!1,e.removeClass("ogx_nest_list_item_hidden")):(g[i].hidden=!0,e.addClass("ogx_nest_list_item_hidden"));setTimeout(x,0)}(),!0):s.scope},this.val=function(e){if(void 0===e)return s.list;s.list=e,G(),setTimeout(b,0)},this.addNest=function(e,t,i){var n=O(e,i);if(g.insert(n,i),t=OGX.OML.rename(t,n.selector),OGX.OML.render(this,t),void 0!==i){var a=this.nodes.pop();this.nodes.insert(a,i)}},this.removeNest=function(e){var t=g.findIndex(s.map.title,e);t&&(this.nodes[t.index].kill(),this.nodes.splice(t.index,1),$('.ogx_nest_list[data-ogx-id="'+n.id+'"] > .ogx_nest_list_item[data-ogx-nest-id="'+g[t.index].id+'"]').remove(),g.splice(t.index,1),setTimeout(x,0))},this.updateNestHeight=function(e){var t=g.find(s.map.title,e,1);setTimeout((function(){var e,i;e=t,i=$(e.selector).outerHeight(!0),e.height=i,x()}),0)},this.updateNestsHeight=function(){for(var e,t=0;t<g.length;t++)e=g[t],this.updateNestHeight(e[s.map.title])},this.updateMask=function(){x()},OGX.Data.merge(s,a),G(),s.template=s.template.replace("{{$title}}","{{$"+s.map.title+"}}"),n.el=t=$(s.el),t.addClass("ogx_nest_list"),s.list.length&&b()},OGX.NestList.NAME="NestList",OGX.NestList.OPEN="NestListOpen",OGX.NestList.CLOSE="NestListClose",OGX.NestList.READY="NestListReady",OGX.Net=function(e){"use strict";var t=1,i=OGX.Data.merge(e,{file_default:{file:!1,path:!1},extensions:[{ext:"json",path:"/json",type:"json"},{ext:"js",path:"/js",type:"text"},{ext:"html",path:"/html",type:"text"},{ext:"oml",path:"/oml",type:"json"},{ext:"ose",path:"/ose",type:"text"},{ext:"mp3",path:"/snd",type:"mp3"},{ext:"wav",path:"/snd"},{ext:"ogg",path:"/snd"},{ext:"png",path:"/img"},{ext:"jpg",path:"/img"},{ext:"gif",path:"/img"},{ext:"svg",path:"/img"}],ios:!1},!1,!0);function n(e,t,i){switch(e.ext){case"json":case"txt":case"oml":case"ose":case"html":case"snd":"app.json"!==e.file&&OGX.Cache.add(e)}void 0!==t?setTimeout((function(){t(e.data,i)}),0):$(document).trigger(OGX.Net.LOAD_SUCCESS,e)}function a(e,t,a){var o;"/"===(o=e.path+"/"+e.file).substr(0,1)&&(o=o.substr(1)),i.encrypted&&"app.json"===o&&(e.type="text"),$.ajax({dataType:e.type,url:o}).done((function(i){e.data=i,n(e,t,a)}))}i.extensions.hasOwnProperty("insert")||(i.extensions=new OGX.List(i.extensions)),this.preload=function(e,t,i){var n={loaded:0,total:0,files:new OGX.List};for(var a in e)for(var o=0;o<e[a].length;o++)n.total++,this.load(a+"/"+e[a][o],r);function r(e,a){n.loaded++,n.files.insert(e),n.loaded===n.total&&setTimeout((function(){t(n.files,i)}),0)}},this.load=function(e,o,r){var s,l={file:null,path:null};-1!==e.indexOf("/")?(s=e.split("/"),l.file=s.pop(),l.path=s.join("/")):(l.path="",l.file=e),OGX.Data.merge(l,i.file_default);var c=function(e){var t;if(t=/([a-z0-9\_\-]+\.)?([a-z0-9\_\-]+)\.([a-z0-9]{3,4})/gi.exec(e))return t.shift(),t;return!1}(l.file);if(c)switch(l.ext=c[2],l.id=c[1],l.ext){case"json":case"txt":case"oml":case"ose":case"html":l.type=i.extensions.find("ext",l.ext,1).type,a(l,o,r);break;case"mp3":case"ogg":case"wav":!function(e,t,i){var a;function o(){var o=e.path+"/"+e.file;"/"===o.substr(0,1)&&(o=o.substr(1)),a=new Audio(o),e.data=a,e.ext="snd",e.format=e.file.split(".").pop(),n(e,t,i)}o()}(l,o,r);break;case"png":case"gif":case"jpg":case"svg":!function(e,t,i){var a=new Image;function o(){a.onload=function(){e.data=a,n(e,t,i)};var o=e.path+"/"+e.file;"/"===o.substr(0,1)&&(o=o.substr(1)),a.src=o}o()}(l,o,r);break;case"ttf":case"eot":case"woff":case"woff2":!function(e,i,a){function o(){var o,r='<div class="ogx_font_loader" style="font-family:'+e.file.split(".")[0]+';" data-ogx-id="font-loader-'+t+'"><b>ogx</b> <i>font</i> init</div>';$("body").append(r),n(e,i,a),o=t,setTimeout((function(){$('.ogx_font_loader[data-ogx-id="font-loader-'+o+'"]').remove()}),150),t++}o()}(l,o,r);break;case"pak":!function(e,t,i){function o(a){for(var o,r=/<!--\[([a-zA-Z0-9_\-]+)\]-->/gi,s=[];o=r.exec(a);)s.push(o[1]);r=/<!--\[[a-zA-Z0-9_\-]+\]-->/gi;var l,c,d,u=a.split(r);u.shift();for(var h=0;h<s.length;h++){switch(e.path){case"/html":c="template."+s[h]+".html",d=u[h];break;default:c=s[h]+"."+e.path.substr(1),d=JSON.parse(u[h])}l={ext:e.path.substr(1),data:d,path:e.path,id:s[h],file:c},OGX.Cache.add(l)}n(e,t,i)}a(e,o,i)}(l,o,r)}}},OGX.Net.LOAD_SUCCESS="NET_LOAD_SUCCESS",OGX.OSE=function(){"use strict";var charcode,to="__thread_object",lo="__local_object",ro="__route_object",oo="__object";function convertValue(e){if(-1===e.indexOf(":"))return e;var t=e.split(":");switch(t[1]){case"Boolean":return"true"===t[0];case"Number":var i=Number(t[0]);return!isNaN(i)&&i}}function convertToJS(e,t,i,n,a){var o,r,s,l,c,d=0,u="";if(e=(e=e.replace(/^[ \n\r]*{{|}}[\r\n ]*$/g,"")).replace(/(\/\*+((?!\*+\/)[\S\s])*\*+\/)/g,""),(r=/(screen ?([<>=!+]+ ?\d+) ?\? ?([\S\s]+) ?\: ?([\S\s]+);?)/gi.exec(e))&&(l=(l=(l="var a;"+r[0]).replace("screen","screen.width")).replace(r[3],'a="'+r[3].trim()+'"'),l="null"!==r[4]?l.replace(r[4],'a="'+r[4].trim()+'"'):l.replace(r[4],"a=false;"),l+=";if(a){return a;}",c=new Function(l),e=e.replace(r[0],c())),(r=/(scope ([\S ]+) ?\? ?([\S ]+)\: ?([\S ]+);?)/gi.exec(e))&&(l=r[0],e="null"===(l=(s=OGX.Scope.eval(r[2]))?r[3]:r[4])?e.replace(r[0],""):e.replace(r[0],l)),(r=/(uxi *(?:#|\$|&|@)*([a-z0-9_\-]+)):(([a-z0-9]+))/gi.exec(e))&&(s='OGX.Object.get({_NAME_:{eq:"'+r[3]+'"}, id:{eq:"'+r[2]+'"}}, null, 1);')===(e=e.replace(r[0],s)))return"return "+e;if((r=/mongogx ([a-z0-9_\-]+)\.([a-z0-9_\-]+)\.([a-z]+)\(([\S ]+)\)/gi.exec(e))&&(s="mongogx.setDatabase('"+r[1]+"');",s+="mongogx.setCollection('"+r[2]+"');",(s+="return mongogx."+r[3]+"("+r[4]+")[0];")===(e=e.replace(r[0],s))))return s;if(isSingleVar(e))return"return "+replaceVars(e,t,i,n,a)+";";for(e+="\r\n";o=/[\S ]+(\r\n|\n)?/gi.exec(e);){if(l=replaceLoop(l=o[0].replace(/(\r\n|\n)/gi,"").trim(),t,i,n,a),charcode++,l=replaceVars(l,t,i,n,a),/^(app|OGX)\.\S+;?/g.test(l))return"return "+l+";";if(e=e.replace(o[0],""),u+=l+"\n",++d>100)return}return u="var __echo=[];\n"+u+'\nif(!__echo.length){return;}else{return __echo.join("");}'}function runJS(e,t,i,n,a,o){var r;try{r=new Function(oo,to,ro,lo,e)(t,i,n,a)}catch(e){return}if(void 0!==r)return r}function isSingleVar(e){return/^[ ]*\S+( \S+)?[ ]*$/g.test(e)}function getTrueVal(__string,__object,__thread_object,__route_object,__local_object){var e=!1;try{e=eval(__string)}catch(e){}return!e||e&&e instanceof HTMLElement?'"'+__string+'"':e?'"'+e+'"':__string}function replaceLoop(e,t,i,n,a){var o,r,s,l;return(o=/loop (\S+) ?(as (\S+) ?(\S+ )?)?{/gi.exec(e))&&(r="__"+String.fromCharCode(charcode).toLowerCase()+"__",s=(s=o[0]).replace(o[0],"for(var "+r+" in JSON.parse(JSON.stringify("+o[1]+"))){"),o[2]&&(l=o[4]?"&"+o[3]+"="+r+"; &"+o[4]+"="+o[1]+"["+r+"]; ":"&"+o[3]+"="+o[1]+"["+r+"]; "),s+=l,e=e.replace(o[0],s)),e}function replaceVars(e,t,i,n,a){for(var o,r,s,l=0;r=/((&|#|@|\$)([a-z0-9\-_]+))(\.[a-z0-9\-_\.\[\]\$]+|\.\$|\.)?(;)?/gi.exec(e);){switch(s=!1,r[2]){case"&":s=to+"."+r[3];break;case"@":s=lo+"."+r[3];break;case"$":s=oo+"."+r[3];break;case"#":s=r[3]}if(o=r[0].replace(r[1],s),e=e.replace(r[0],o),++l>300)return e}for(;r=/([a-z_\-]+)\((\$|@|&)\)/gi.exec(e);){switch(r[2]){case"&":s=to;break;case"@":s=lo;break;case"$":s=oo}o=r[1]+"("+s+")",e=e.replace(r[0],o)}for(;/^(json|ose|template|oml|crumb) (\S+)/g.test(e);)if((r=/crumb (\S+)?/gi.exec(e))&&(o="__route_object."+r[1],e=e.replace(r[0],o)),(r=/json (\S+)(;)?/gi.exec(e))&&(e=e.replace(r[0],"app.getJSON("+getTrueVal(r[1],t,i,n,a)+")")),(r=/^template (\S+)[ ;]?/gi.exec(e))&&(e=e.replace(r[0],"OGX.Templater.make(OGX.Templater.get("+getTrueVal(r[1],t,i,n,a)+"), "+r[2]+", "+to+","+ro+","+lo+")")),(r=/^ose (\S+)(;)?/gi.exec(e))&&(r[1]=getTrueVal(r[1],t,i,n,a),script=that.get(r[1]),script&&(e=exp.replace(r[0],script.replace(/({{|}})/g,"")))),(r=/^oml (\S+)(;)?/gi.exec(e))&&(e=e.replace(r[0],"app.getOML("+getTrueVal(r[1],t,i,n,a)+")")),++l>300)return e;for(;r=/echo ('|")?(((?![;}\r\n]+|$)([\S\s]))*)(?:'|")?/gi.exec(e);){var c="+$1+",d="'";if(void 0!==r[1]&&(d="\\"+r[1]),c=d+c+d,r[2]=r[2].replace(/(__(?!;\n\r)[a-z0-9_\-\.]+)/gi,c),o="__echo.push("+d+r[2]+d+");",e=e.replace(r[0],o),++l>300)return e}return e}this.get=function(e){return OGX.Cache.read("ose",e)},this.fork=function(e,t){var i,n;if(i=e.split(":")[0],void 0===t.data&&(t.data={}),void 0!==(n=OGX.OSE.exec(i,t.data)))for(var a in t.values)if(convertValue(a)===n)return t.values[a];return!1},this.execScript=function(e,t,i,n){var a=this.get(e);return a&&this.exec(a,t,i,n),!1},this.exec=function(e,t,i,n,a){void 0===t&&(t={}),void 0===i&&(i={}),void 0===n&&(n={}),void 0===a&&(a={}),charcode=65;var o=runJS(convertToJS(e,t,i,n,a),t,i,n,a,e);if(void 0!==o)return o},this.loadExecScript=function(e,t,i,n,a){$.get(e,(function(e){OGX.OSE.exec(e,t,i,n,a)}))}},OGX.OSE=new OGX.OSE,OGX.OSE.SCRIPT_LOADED="OSE_SCRIPT_LOADED",OGX.OSE.SCRIPTS_LOADED="OSE_SCRIPTS_LOADED",OGX.Overlay=function(e){"use strict";var t=this,i=!1,n=!1,a={anim:OGX.Overlay.FADE,display:{css:"",html:" "},index:!1,close_on_click:!1},o=!1,r="mousedown";function s(e){i&&(e?i.on(r,l):i.off(r,l))}function l(){s(!1),t.removeOverlay()}e.hasOwnProperty("overlay")&&e.overlay&&setTimeout((function(){t.addOverlay(e.overlay)}),0),this.hasOverlay=function(){return!!i},this.addOverlay=function(e){if("object"!=typeof e&&(e={}),OGX.Data.merge(e,a),e.display.hasOwnProperty("_NAME_")||(e.display=new OGX.Display(e.display)),o=e,!this.hasOverlay()){var t=this.el;o.hasOwnProperty("el")&&(t=$(o.el));var n="z-index:"+(o.zindex?o.zindex:this.topIndex(t))+";",r='<div class="ogx_overlay '+o.display.css()+'" style="'+n+'">'+o.display.html()+"</div>";if(t.prepend(r),(i=t.children(".ogx_overlay:first")).off("transitionend"),o.anim)switch(o.anim){case OGX.Overlay.FADE:setTimeout((function(){i&&i.removeClass("ogx_overlay_fade_out").addClass("ogx_overlay_fade_in")}),50)}else i.css("opacity",1)}e.close_on_click&&s(!0)},this.removeOverlay=function(e){s(!1);var t=!1;if(void 0===e||!0===e?o.anim&&(t=o.anim):t=e,i){if(t){switch(t){case OGX.Overlay.FADE:i.removeClass("ogx_overlay_fade_in").addClass("ogx_overlay_fade_out"),i.css("opacity")>0?i.on("transitionend",(function(){i&&(i.off("transitionend"),i.remove(),i=!1)})):i&&(i.removeClass("ogx_overlay_fade_in").removeClass("ogx_overlay_fade_out"),i.off("transitionend"),i.remove(),i=!1)}return}return i.remove(),void(i=!1)}},this.addGroupOverlay=function(){n||(this.el.prepend('<div class="ogx_group_overlay" style="z-index:'+(this.topIndex()+1e3)+'"></div>'),n=!0)},this.removeGroupOverlay=function(){n&&(this.el.children(".ogx_group_overlay:first").remove(),n=!1)}},OGX.Overlay.FADE="fade",OGX.Overlay.REMOVE="OverlayRemove",OGX.Placeholder=function(e){"use strict";this.pholder=null,e.hasOwnProperty("placeholder")&&(this.pholder=e.placeholder),this.placeholder(e)},OGX.Placeholder.prototype.placeholder=function(e){var t;if("object"==typeof e["node:OML"]&&!Array.isArray(e["node:OML"])){var i=this.selector;for(var n in this.pholder&&(i+=" "+this.pholder),e["node:OML"])0===n.indexOf("default")&&(t=n.replace("default",i),e["node:OML"][t]=e["node:OML"][n],delete e["node:OML"][n])}},OGX.Placeholder.prototype.placeholders=function(e,t){if(void 0!==e&&void 0!==t){e.hasOwnProperty("node:OML")||(e["node:OML"]=[]);var i,n,a=e["node:OML"];a&&"string"==typeof a&&(0===a.indexOf("{{")?e["node:OML"]=OGX.OSE.exec(a):e["node:OML"]=OGX.Cache.read("oml",e["node:OML"]));for(var o=0;o<e["node:OML"].length;o++)for(var r in"string"==typeof(n=e["node:OML"][o])&&(n=0===n.indexOf("{{")?OGX.OSE.exec(n):OGX.Cache.read("oml",n)),n)if(0===r.indexOf("default")){i=r.split(":")[1],n[t[o]+":"+i]=n[r],delete n[r];break}return e}return!1},require("Point","Uxi","Placeholder"),OGX.Point=function(e){construct(this,"Point");var t,i=this,n=OGX.Data.merge(e,{live:[],mode:0}),a=new OGX.List,o=0;function r(){var e=function(){var e=i.el.width();if(e&&e!==o&&(o=e),o)for(var t=0;t<i.points.length;t++)if(o>=i.points[t].min&&o<i.points[t].max)return{id:t,oml:i.points[t].oml};return!1}();return!(!e||e.id===i.point)&&(i.point=e.id,!0)}this.points=[],this.point=null,this.el=$(e.el),this._NAME_=OGX.Point.NAME,this.construct=function(e,t){},this.resize=function(){r()&&(!function(e){for(var t,o=0;o<n.live.length;o++)(t=i.find(!1,n.live[o]))&&(t.sleep(),e&&a.push(t),t.parent.nodes.findDelete("id",t.id,1))}(n.live.length&&!a.length),this.nodes.length&&(this.clear(),n.mode||this.el.empty()),OGX.OML.render(this,this.points[this.point].oml,n.data,n.route_data,a),this.el.trigger(OGX.Point.CHANGE,{min:this.points[this.point].min,max:this.points[this.point].max}))},this.oml=function(){return this.point||r(),this.points[this.point].oml},t=!0,n.el||(n.el=n.parent.el,t=!1),i.el=$(n.el),i.el.addClass("ogx_point"),t&&i.el.addClass("ogx_point_uxi"),function(){var e,t=i.id;for(var a in n.mode&&(t=n.parent.id),n)if(/^\d+\-\d+$/gi.test(a)){e=a.split("-");var o=JSON.parse(JSON.stringify(n[a]));for(var r in o)0===r.indexOf("default:")&&(o['.ogx_point[data-ogx-id="'+t+'"]:'+r.split(":")[1]]=o[r],delete o[r]);i.points.push({min:parseInt(e[0],10),max:parseInt(e[1],10),oml:o})}}(),r()},OGX.Point.NAME="Point",OGX.Point.CHANGE="PointChange",require("Popup","Uxi","Placeholder","Touch","Resize"),OGX.Popup=function(e){construct(this,"Popup");var t,i,n=this,a={el:!1,width:"80%",height:"80%",html:!1,template:!1,title:!1,icon:!1,icons:!1,view:!1,drag:!1,resize:!1,maximize:!0,center:!0,x:null,y:null,show:!1,group:!1,data:{},buttons:[],buttons_enabled:!0,anim:OGX.Popup.FADE,anim_param:{scale:.7},responsive:!0,overlay:!1,zindex:!1,chromeos:!1,parent:null},o={label:"",callback:null,params:null,enabled:!0},r=e,s=null,l=null,c=null,d="ogx_popup",u=[],h=[],f={w:0,h:0},g=!1,_=!1,p=null,m=!1,v=null;function O(){_=!0,b(!0)}function b(e){void 0===e&&(e=!1),r.anim&&n.el.removeClass(d+"_"+r.anim);var t=D();u[0]="translate3d("+t.x+"px, "+t.y+"px, 0px)";var i={transform:u.join(" ")};e?(r.width=n.el.width(),r.height=n.el.height()):!e&&r.responsive&&(w(r.width)?i.width=OGX.Data.getBestSize(c.width(),n.el.width()):i.width=r.width,w(r.height)?i.height=OGX.Data.getBestSize(c.height(),n.el.height()):i.height=r.height),n.el.css(i),n.resizeNodes()}function w(e){return"string"==typeof e&&-1!==e.indexOf("|")}function G(){n.blurNodes(),n.front()}function X(){n.focusNodes(),r.anim&&n.el.addClass(d+"_"+r.anim)}function E(){s.addClass(d+"_drag"),n.front()}function T(){if(s.removeClass(d+"_drag"),g){for(var e=0;e<h.length;e++)h[e].removeGroupOverlay();return h=[],void app.groupPopups(n,g,{drag:r.drag,resize:r.resize,anim:r.anim})}"function"==typeof r.drag&&r.drag(n,!1)}function C(e){if(t=n.el.position(),n.x=t.left,n.y=t.top,n.parent&&(h=n.parent.nodes.get({_NAME_:{eq:"Popup"},group:{eq:n.group},blured:{eq:!1}},{z:-1})).length){g=!1;for(var a=0;a<h.length;a++)n.id!==h[a].id&&h[a].group===n.group&&(i={left:h[a].x,top:h[a].y},f.w=h[a].el.width(),f.h=h[a].el.height(),t.left>i.left&&t.left<i.left+f.w&&t.top>i.top&&t.top<i.top+f.h&&(g||(g=h[a],h[a].addGroupOverlay())),g||h[a].removeGroupOverlay())}g||"function"==typeof r.drag&&r.drag(n,e)}function D(){var e=c.width(),t=c.height();e>screen.width&&(e=screen.width),t>screen.height&&(t=screen.height);var i=r.width,n=r.height;if(_||(i=OGX.Data.getBestSize(e,i),n=OGX.Data.getBestSize(t,n)),r.center)"string"==typeof i&&(i=-1!==i.indexOf("%")?Math.round(e*Number(i.substr(0,i.length-1))/100):Number(i)),"string"==typeof n&&(n=-1!==n.indexOf("%")?Math.round(t*Number(n.substr(0,n.length-1))/100):Number(n)),x=Math.round(e/2-i/2),y=Math.round(t/2-n/2),r.drag&&(r.center=!1);else{var a=s.position();x=a.left,y=a.top,x>e&&(x=e-x),x<-i&&(x=0),y>t&&(y=t-n),y<0&&(y=0)}return{x:x,y:y,w:i,h:n}}function S(e,t,i,a,o,l){var c=!1,h=null;if(void 0===l&&(l=!1),void 0!==t&&!0!==t||(t=r.anim),t&&(c=t),!t&&p&&(c=p),t?n.el.removeClass(d+"_notrans"):n.el.addClass(d+"_notrans"),e?(n.front(),l||n.el.trigger(OGX.Popup.SHOW,n)):l||n.el.trigger(OGX.Popup.HIDE,n),c){var f={};switch(h=d+"_"+c,c){case OGX.Popup.SCALE:u[1]=e?"scale(1,1)":"scale("+r.anim_param.scale+", "+r.anim_param.scale+")",f.transform=u.join(" ");break;case OGX.Popup.FADE:f.opacity=e?1:0}e&&(s.css("display","flex"),f.visibility="visible",f.display="flex"),t||e||(f.visibility="hidden",f.display="none"),setTimeout((function(){s.css(f)}),50),t?(p=c,s.on("transitionend",(function(){s.off("transitionend"),e?n.resizeNodes():s.css({display:"none",visibility:"hidden"}),h&&s.removeClass(h),M(i,a,o)})),h&&s.addClass(h)):(s.removeClass(h),M(i,a,o))}else e?s.css({opacity:e,display:"flex",visibility:"visible"}):s.css({display:"none",visibility:"hidden"}),M(i,a,o)}function M(e,t,i){void 0!==e&&e&&e(t),void 0!==i&&i&&i(n.id)}function L(e){e?s.on(n.touch.down,"."+d+"_button",N):s.off(n.touch.down,"."+d+"_button",N)}function N(e){e.preventDefault(),e.stopImmediatePropagation();var t=$(this);if(!t.hasClass(d+"_button_disabled")){var i=t.index();s.trigger(OGX.Popup.CLICK_BUTTON,{index:i,value:r.buttons[i].label}),r.buttons[i].hasOwnProperty("callback")&&r.buttons[i].callback&&(r.buttons[i].hasOwnProperty("params")?r.buttons[i].callback.apply(null,[r.buttons[i].params]):r.buttons[i].callback())}}function A(){for(var e,t="",i=0;i<r.buttons.length;i++)r.buttons.length>0&&(e=r.buttons[i].enabled?"":d+"_button_disabled",t+='<span class="'+d+"_button "+e+'">'+r.buttons[i].label+"</span>");return t}function k(e,t){void 0===t&&(t=!0),r.buttons=new OGX.List(e);for(var i=0;i<e.length;i++)r.buttons[i]=OGX.Data.merge(r.buttons[i],o);if(t){var n=A();l.html(n)}}function I(e){e?n.el.on(n.touch.down,"."+d+"_icons_icon",(function(e){e.preventDefault(),e.stopImmediatePropagation();var t,i=$(this).index(),n=r.icons[i];"object"==typeof n&&n.hasOwnProperty("callback")&&(n.hasOwnProperty("params")&&(t=n.params),n.callback.call(null,t))})):n.el.off(n.touch.down,"."+d+"_icons_icon")}function Y(){for(var e,t="",i=0;i<r.icons.length;i++)e="string"==typeof r.icons[i]?r.icons[i]:r.icons[i].icon,t+='<div class="'+d+'_icons_icon" style="background-image:url(\''+e+"')\"></div>";return t}this.anim=null,this.el=null,this._NAME_=OGX.Popup.NAME,this.group=r.group,this.x=0,this.y=0,this.z=0,this.construct=function(){},this.enable=function(){this.touch.enable(),this.enableResize(),r.icons&&r.icons.length&&I(!0),r.buttons&&r.buttons.length&&r.buttons_enabled&&L(!0)},this.disable=function(){this.touch.disable(),this.disableResize(),r.icons&&r.icons.length&&I(!1),r.buttons&&r.buttons.length&&r.buttons_enabled&&L(!1)},this.show=function(e,t,i){S(1,e,t,i),this.focus(1)},this.hide=function(e,t,i,n,a){S(0,e,t,i,n,a),this.blur(1)},this.resize=function(){b()},this.maximize=function(){r.maximize&&!m&&(m=!0,v={width:r.width,height:r.height,x:this.x,y:this.y},r.width=r.height="100%",b(!1),this.x=this.y=0,this.move(this.x,this.y))},this.normalize=function(){r.maximize&&m&&(m=!1,r.width=v.width,r.height=v.height,b(!1),this.x=v.x,this.y=v.y,v=null,this.move(this.x,this.y))},this.destroy=function(){s.off("transitionend")},this.buttons=function(e){if(void 0===e)return r.buttons;k(e)},this.enableButton=function(e){r.buttons[e].enabled=!0,l.children("."+d+"_button:eq("+e+")").removeClass(d+"_button_disabled"),r.buttons_enabled||(r.buttons_enabled=!0)},this.disableButton=function(e){r.buttons[e].enabled=!1,l.children("."+d+"_button:eq("+e+")").addClass(d+"_button_disabled")},this.enableButtons=function(){if(r.buttons.length)for(var e=0;e<r.buttons.length;e++)this.enableButton(e);r.buttons_enabled=!0},this.disableButtons=function(){if(r.buttons.length)for(var e=0;e<r.buttons.length;e++)this.disableButton(e);r.buttons_enabled=!1},this.center=function(){var e=D();u[0]="translate3d("+e.x+"px, "+e.y+"px, 0px)",this.x=e.x,this.y=e.y,n.el.css({transform:u.join(" ")})},this.move=function(e,t){null===e&&(e=n.el.position().left),null===t&&(t=n.el.position().top),u[0]="translate3d("+e+"px, "+t+"px, 0px)",this.x=e,this.y=t,n.el.css({transform:u.join(" ")})},this.front=function(){this.z=r.parent.topIndex(),this.el.css("z-index",this.z)},this.icon=function(e){if(void 0===e)return r.icon;r.icon=e,this.el.children("."+d+"_head:first").children("."+d+"_icon:first").css("background-image","url("+e+")")},this.title=function(e){if(void 0===e)return r.title;r.title=e,this.el.find("."+d+"_title:first").html(e)},this.icons=function(e){if(void 0===e)return r.icons;r.icons&&r.icons.length&&I(!1),r.icons=e,this.el.find("."+d+"_icons:first").html(Y()),I(!0)},function(){if(OGX.Data.merge(r,app.getDefaults("popups"),!1),OGX.Data.merge(r,a,!1),k(r.buttons,!1),(s=$(r.el)).addClass(d),c=s.parent(),n.anim=r.anim,n.centered=r.center,function(){r.index?n.z=r.index:n.z=r.parent.topIndex();var e=D();null!==r.x&&null!==r.y?(n.x=e.x=r.x,n.y=e.y=r.y):(n.x=e.x,n.y=e.y);var t=e.w,i=e.h;-1===String(t).indexOf("%")&&(t+="px"),-1===String(i).indexOf("%")&&(i+="px");var a="";(r.icon||r.title||r.icons||r.drag)&&(a+='<div class="'+d+'_head">',r.icon&&(a+='<div class="'+d+'_icon" style="background-image:url(\''+r.icon+"')\"></div>"),r.title&&(a+='<div class="'+d+'_title">'+r.title+"</div>"),a+='<div class="'+d+'_icons">',r.icons&&(a+=Y()),a+="</div></div>");var o,c=1;if(u=["translate3d("+e.x+"px, "+e.y+"px, 0)"],r.anim)switch(r.anim){case OGX.Popup.FADE:c=0,o=d+"_fade";break;case OGX.Popup.SCALE:o=d+"_scale",u[1]="scale("+r.anim_param.scale+", "+r.anim_param.scale+")"}a+='<div class="'+d+'_body ogx_view">',r.html?a+=r.html:r.template&&(a+=OGX.Templater.make(OGX.Templater.get(r.template),r.data)),a+="</div>",r.buttons&&r.buttons.length&&(a+='<div class="'+d+'_buttons">',a+=A(),a+="</div>"),s.html(a),s.css({width:t,height:i,opacity:c,transform:u.join(" "),"z-index":n.z}),r.anim&&s.addClass(o),n.el=s,l=s.children("."+d+"_buttons:first")}(),r.drag){var e={x:!0,y:!0,cb_down:E,cb_up:T,target:"."+d+"_head:first"};r.group?e.cb_drag=C:"function"==typeof r.drag&&(e.cb_drag=function(e){r.drag(n,e)}),n.touch.drag.set(e)}if(r.resize&&n.setResize({top:!1,cb_resize:O,cb_down:G,cb_up:X}),r.hasOwnProperty("html")&&r.html)r["node:OML"]=[{"default:Html":{html:r.html}}];else if(r.hasOwnProperty("view")&&r.view){var t={};t["default:Views."+r.view.id]=r,r["node:OML"].push(t)}n.placeholders(r,["."+d+'[data-ogx-id="'+r.id+'"] > .'+d+"_body"]),r.overlay&&n.addOverlay(),n.observe(!0,undefined,(function(){n.resizeNodes(),n.observe(!1),r.show&&n.show()}))}()},OGX.Popup.NAME="Popup",OGX.Popup.FADE="fade",OGX.Popup.SCALE="scale",OGX.Popup.HIDE="PopupHide",OGX.Popup.SHOW="PopupShow",OGX.Popup.CLOSE="PopupClose",OGX.Popup.DRAG="PopupDrag",OGX.Popup.GROUP="PopupGroup",OGX.Popup.UNGROUP="PopupUngroup",OGX.Popup.CLICK_BUTTON="PopupClickButton",OGX.Popup.FLOAT=!0,OGX.Resize=function(e){"use strict";var t,i,n,a,o,r,s,l,c=this,d=e,u={enabled:!0,top:!0,left:!0,right:!0,bottom:!0,min_width:100,min_height:100,max_width:0,max_height:0,border:10,cb_up:!1,cb_down:!1,cb_resize:!1},h=!1,f="mousedown",g="mouseup",_="mousemove",p=(d=!1,!1),m=!1,v={w:0,h:0};function y(e){d&&(e?c.el.on(f,x):c.el.off(f,x))}function x(e){var u=E(e);n=u.pageX,a=u.pageY;var h=c.el.position();t=h.left,i=h.top;var f=c.el.offset(),g=n-f.left,_=a-f.top;v.w=c.el.width(),v.h=c.el.height(),o=0,r=0,s=0,l=0,d.top&&_<d.border&&(l=-1),d.bottom&&_>c.el.height()-d.border&&(l=1),d.left&&g<d.border&&(s=-1),d.right&&g>c.el.width()-d.border&&(s=1),p=-1!==window.getComputedStyle(c.el[0],"width"),m=-1!==window.getComputedStyle(c.el[0],"height"),(s||l)&&(e.preventDefault(),c.hasOwnProperty("dragable")&&c.dragable&&c.touch.drag.disable(),O(!0),w(!0),d.cb_down&&d.cb_down())}function O(e){e?h||(h=setInterval(b,5)):h&&(clearInterval(h),h=!1)}function b(){if(-1===s||-1===l){var e=t,n=i;o&&s&&(e+=o),r&&l&&(n+=r),o&&-1===s&&r&&1===l&&(n=i),c.el.css("transform","translate3d("+e+"px, "+n+"px, 0)")}s&&v.w+o*s>d.min_width&&(p?c.el.width(Math.round(100*(v.w+o*s)/c.el.parent().width()*100)/100+"%"):c.el.width(v.w+o*s)),l&&v.h+r*l>d.min_height&&(m?c.el.height(Math.round(100*(v.h+r*l)/c.el.parent().height()*100)/100+"%"):c.el.height(v.h+r*l)),(o||r)&&(d.cb_resize?d.cb_resize():c.el.trigger(OGX.Resize.RESIZING))}function w(e){e?($("body").on(_,G),$("body").on(g,X)):($("body").off(_,G),$("body").off(g,X))}function G(e){e.preventDefault(),e.stopImmediatePropagation(),e=E(e),o=e.pageX-n,r=e.pageY-a}function X(e){O(!1),w(!1),e=E(e),o=e.pageX-n,r=e.pageY-a,d.cb_up&&d.cb_up(),c.hasOwnProperty("dragable")&&c.dragable&&(y(!1),c.touch.drag.enable(),setTimeout((function(){y(!0)}),0))}function E(e){return e.hasOwnProperty("originalEvent")&&void 0!==e.originalEvent.changedTouches?e.originalEvent.changedTouches[0]:e}this.resizable=!0,this.setResize=function(e){OGX.Data.merge(e,u,!1),d=e},this.enableResize=function(){y(!0)},this.disableResize=function(){y(!1)},OGX.Data.merge(d,u,!1),void 0===window.ontouchstart||d.chromeos||(f="touchstart",_="touchmove",g="touchend")},OGX.Resize.RESIZING="resizeResizing",require("Roulette","Uxi","Bind","Touch"),OGX.Roulette=function(e){construct(this,"Roulette");var t,i,n,a,o,r,s,l=this,c=e,d={force_coef:10,time_coef:.1,min_force_pitch:2,value:null,name:!1,required:!1,display:!1,key:"value",mode:OGX.Roulette.MODE_REWIND,icon:!1,list:new OGX.List,capture:!1},u={template:!1,html:'<span class="ogx_roulette_block_label">{{$label}}</span>',css:!1},h="object",f=0,g=0,_="ogx_roulette";function p(e,t){void 0===t&&(t=!0),l.el.children('input[name="'+c.name+'"]').val(e),t&&l.el.children('input[name="'+c.name+'"]').trigger("change")}function m(e){e?t.on(l.touch.down,"."+_+"_icon",(function(e){e.preventDefault(),e.stopImmediatePropagation(),l.next(!0)})):t.off(l.touch.down,"."+_+"_icon")}function v(e){e?t.on("change","input[type=hidden]",y):t.off("change","input[type=hidden]",y)}function y(e){e.preventDefault(),e.stopImmediatePropagation(),l.loopval(0,OGX.Data.stringToVal(e.target.value),!1)}function x(e){return g+e>c.list.length-1?c.list[0]:g+e<0?c.list[c.list.length-1]:c.list[g+e]}function O(e){a=e.y,G(!0)}function b(e){var t;e.dirY!==o?(t=0,a=e.pt1.y):(t=e.pt1.y-a,a=e.pt1.y),o=e.dirY,i.css({transition:"none",transform:"translate3D(0px, "+(C(i)+t)+"px, 0px)"})}function w(e){G(!1),trans=C(i);var t=Math.round(trans/n)*n,a=Math.round(t/n%c.list.length);if(a=a<=0?Math.abs(a):c.list.length-a,g!==a){switch(g=a,h){case"string":c.value=c.list[g];break;case"object":c.value=c.list[g][c.key]}c.name&&l.el.children('input[name="'+c.name+'"]').val(c.value).trigger("input"),l.el.trigger(OGX.Roulette.CHANGE,c.value)}i.css({transition:"all 0.2s ease-out",transform:"translate3D(0px, "+t+"px, 0px)"})}function G(e){e?r=setInterval(X,10):clearInterval(r)}function X(){var e,t,a;(e=Math.floor((i.position().top+n*o)/(n*c.list.length)*-1))!==f&&(0===i.children("."+_+'_stripe[data-id="'+e+'"]').length&&((t=s.clone()).css("top",e*(n*c.list.length)+"px"),t.attr("data-id",e),i.append(t)),i.children("."+_+"_stripe").each((function(e,t){a=i.position().top+$(t).position().top,(Math.ceil(a+n*c.list.length)<-n||a>n)&&$(t).remove()})),f=e)}function E(){G(!1),i.off("transitionend",E)}function T(){var e="",a="";c.icon&&(a+='<div class="'+_+'_container">'),a+='<div class="'+_+'_stripes">';for(var o=0;o<2;o++){a+='<div class="'+_+'_stripe" style="top:'+o*(c.list.length*n)+'px;" data-id="'+o+'">';for(var r=0;r<c.list.length;r++){switch(h){case"string":e=OGX.Templater.make(c.display.html(),{label:c.list[r]});break;case"object":e=c.display.html(c.list[r])}a+='<div class="'+_+"_block "+c.display.css(c.list[r])+'" style="height:'+n+"px; line-height:"+n+'px;" data-ogx-id="'+r+'">'+e+"</div>"}a+="</div>"}if(a+="</div>",c.icon&&(a+='</div><div class="'+_+'_icon"></div>'),void 0===g&&(g=0),c.name){var l="";switch(c.required&&(l=" required"),h){case"string":a+='<input type="hidden" name="'+c.name+'" value="'+c.list[g]+'" '+l+">";break;case"object":a+='<input type="hidden" name="'+c.name+'" value="'+c.list[g][c.key]+'" '+l+">"}}t.html(a),i=t.children("."+_+"_stripes:first"),c.icon&&(i=t.children("."+_+"_container:first").children("."+_+"_stripes:first")),s=(s=i.children("."+_+"_stripe:last")).detach();var d=g*n*-1;i.css({transition:"none",transform:"translate3D(0px, "+d+"px, 0px)"})}function C(e){var t=0;return"none"!==e.css("transform")&&(t=Number(e.css("transform").split(",")[5].split(")")[0])),t}function D(e){switch(h){case"string":return{index:c.list.indexOf(e)};case"object":return c.list.findIndex(c.key,e)}}function S(){c.list.length>0&&!c.list.hasOwnProperty("insert")&&(c.list=new OGX.List(c.list)),"string"==typeof c.list[0]&&(h="string"),1===c.list.length&&(c.list[1]=c.list[0])}this._NAME_=OGX.Roulette.NAME,this.el=null,this.enable=function(){t.removeClass(_+"_disabled"),this.touch.swipe.enable(),c.icon&&m(!0),c.name&&v(!0)},this.disable=function(){t.addClass(_+"_disabled"),this.touch.swipe.disable(),c.icon&&m(!1),c.name&&v(!1),G(!1)},this.bindFilter=function(e,t,i){c.list.removeFilter(e),c.list.addFilter(e,t,i),c.list.filter(),setTimeout(T,0)},this.bindRender=function(e,t){},this.val=function(e,t){if(void 0!==e){var a=D(e).index;a>-1&&(!function(e,t){void 0===t&&(t=!0);i.off("transitionend",E),G(!1),o=-1;var a=C(i),r=Math.round(a/n)*n,s=a-r,l=Math.round(r/n%c.list.length);l=l<=0?Math.abs(l):c.list.length-l;var d=l-e;c.mode===OGX.Roulette.MODE_CLOSEST&&d>c.list.length/2&&(d=-1*(c.list.length-l+e));var u=a+d*n-s,h=20*Math.round(Math.abs(d*n)*c.time_coef);G(!0),i.on("transitionend",E),i.css({transition:"all "+h+"ms ease-out",transform:"translate3D(0px, "+u+"px, 0px)"}),g=e}(a),c.name&&p(e,!1))}else switch(h){case"string":return c.list[g];case"object":return c.list[g][c.key]}},this.item=function(){return c.list[g]},this.loopval=function(e,t,a){var o=g,r=D(t).index;r>-1&&(g=r);var s=o-r,l=c.time_coef*Math.abs(s+e*c.list.length);G(!0),i.css({transition:"all "+l+"s ease-out",transform:"translate3D(0px, "+(C(i)+(s*n-c.list.length*n*e))+"px, 0px)"}),i.on("transitionend",E),c.name&&p(t,a),void 0!==a&&a&&this.el.trigger(OGX.Roulette.CHANGE,val)},this.next=function(e){var t,i=x(1);switch(o=1,h){case"string":t=i;break;case"object":t=i[c.key]}this.val(t),void 0!==e&&e&&(this.el.trigger(OGX.Roulette.CHANGE,t),c.name&&this.el.children('input[name="'+c.name+'"]').trigger("input"))},this.prev=function(e){var t,i=x(-1);switch(h){case"string":t=i;break;case"object":t=i[c.key]}this.val(t),void 0!==e&&e&&(this.el.trigger(OGX.Roulette.CHANGE,t),c.name&&this.el.children('input[name="'+c.name+'"]').trigger("change"))},this.setData=function(e,t){c.value=t,c.list=e,S(),g=void 0===t?0:D(t).index,setTimeout(T,0)},function(){if(OGX.Data.merge(c,d),S(),c.display?c.display=new OGX.Display(c.display):c.display=new OGX.Display(u),(t=l.el=$(c.el)).addClass(_),t.width(),n=t.height(),c.list.length){var e=t.parent();e[0].hasAttribute("data-value")&&(c.value=OGX.Data.stringToVal(e.data("value")),e.removeAttr("data-value")),null===c.value&&(c.value=c.list[0],"object"==typeof c.value&&(c.value=c.value.value)),g=D(c.value).index}}(),c.list.length&&T(),l.touch.swipe.set({x:!1,y:!0,cb_down:O,cb_swipe:b,cb_up:w,target:'ogx_roulette[data-ogx-id="'+l.id+'"] .ogx_roulette_container:first',capture:c.capture})},OGX.Roulette.NAME="Roulette",OGX.Roulette.CHANGE="RouletteChange",OGX.Roulette.MODE_REWIND="RouletteModeRewind",OGX.Roulette.MODE_CLOSEST="RouetteModeClosest",OGX.Roulette.BIND=OGX.Roulette.CHANGE,require("RouletteTree","Uxi"),OGX.RouletteTree=function(e){construct(this,"RouletteTree");var t,n,a=this,o=e,r={groups:!1,data:!1,value:!1,required:!1},s=!1;function l(e){e?t.on(OGX.Roulette.CHANGE,d):t.off(OGX.Roulette.CHANGE,d)}function c(){for(var e,t=0;t<s.length;t++)t>0&&(e=s[t-1].roulette.val()),0===t||t-1>=0&&null!==e&&String(e).length>0?s[t].roulette.focus():t>0&&_(s[t].roulette)}function d(e,a){e.stopImmediatePropagation();var o,r=$(e.target).data("ogx-id"),l=s.findIndex("id",String(r)),c=s[l.index].roulette.item().hasOwnProperty("head");if(n=l.index,l.index+1<s.length)for(i=l.index+1;i<s.length;i++)c?(s[i].roulette.val(""),s[i].roulette.blur()):(o=u(i-1,s[i-1].roulette.val()),s[i].roulette.setData(o,o[0].value),i===l.index+1?s[i].roulette.focus():s[i].roulette.blur());var d=h(n);t.trigger(OGX.RouletteTree.CHANGE,d),c&&!n&&(n=-1)}function u(e,t){for(var i=[],n=0;n<e+1;n++)i.push(s[n].roulette.val());return g(i)}function h(e){if(void 0===e&&(e=s.length),e<0)return!1;for(var t={},i=0;i<e+1;i++)t[o.groups[i]]=s[i].roulette.val();return t}function f(e){for(var t,i=[],a=0;a<o.groups.length;a++)e.hasOwnProperty(o.groups[a])&&(t=e[o.groups[a]],String(t).length&&(!isNaN(t)&&(t=String(t)),s[a].roulette.val(t),n=a,a>0&&s[a].roulette.setData(g(i),t),i.push(t)));setTimeout(c,0)}function g(e){for(var t=o.data,i=0;i<e.length;i++)e[i].length&&(t=t[e[i]]);var n=[{label:o.groups[e.length],value:""}];for(var a in t)n.push({label:a,value:a});return n}function _(e){setTimeout((function(){e.blur()}),0)}this._NAME_=OGX.RouletteTree.NAME,this.el=null,this.enable=function(){s&&(c(),l(!0))},this.disable=function(){s&&l(!1)},this.val=function(e){if(void 0===e)return n>-1?h(n):{};f(e)},o=OGX.Data.merge(o,r),a.el=t=$(o.el),t.addClass("ogx_roulette_tree"),function(){s=new OGX.List;var e,i,n=0;!function r(l,c){var d;if(!Array.isArray(l)&&"object"==typeof l){if(c>n){for(var u in n=c,t.append('<div class="ogx_roulette_tree_roulette" data-ogx-roulette="'+c+'"></div>'),i=o.groups[c-1],e=[{label:i,value:"",head:!0}],l)e.push({label:u,value:u});d=a.create(OGX.Roulette.NAME,{el:'.ogx_roulette_tree[data-ogx-id="'+a.id+'"] .ogx_roulette_tree_roulette[data-ogx-roulette="'+c+'"]',list:e,icon:o.icon,value:null,name:i,required:o.required}),n>1&&_(d),s.push({roulette:d,group:i,id:d.id})}if(c<o.groups.length)for(var u in l)r(l[u],c+1)}}(o.data,1)}(),n=-1,o.value&&setTimeout((function(){f(o.value)}),0),a.enable()},OGX.RouletteTree.NAME="RouletteTree",OGX.RouletteTree.CHANGE="RouletteTreeChange",OGX.RouletteTree.BIND=OGX.RouletteTree.CHANGE,OGX.Router=function(__routing){"use strict";var routing=__routing,page=window.location.pathname.split("/").slice(-1)[0],locked=!1,url=!1,pattern=!1,options_default={history:!0,reload:!1};function findRoute(e){var t,i,n,a,o,r=[],s=OGX.Data.clone(routing.routes);for(var l in s){for(-1!==(o=l).indexOf(":OML")&&(o=o.replace(":OML","")),n=o;i=/(?!\/)([a-z0-9_\-]+)\:([^\/]+)/gi.exec(n);)n=n.replace(i[0],i[2]),r.push(i[1]);if((t=e.match("^"+n+"$"))&&t.length){t.shift(),-1!==l.indexOf(":OML")&&(s[o]=OGX.Data.clone(OGX.Cache.read("oml",s[l])),delete s[l],l=o);var c=s[l];a={};for(var d=0;d<t.length;d++)a[r[d]]=t[d];return{stage:e.split("/").shift(),route:c,data:a,pattern:l}}}return!1}function clearStage(e){var t=e.selector+" "+e.pholder,i=$(t),n=app.cfind(null,String(i.find(".ogx_uxi").first().data("ogx-id")));n&&(n._NAME_===OGX.Scroller.NAME&&(n=n.parent),n.kill(),i.empty())}function onBackButton(e){e.preventDefault(),e.stopImmediatePropagation(),locked||navigator.app.backHistory()}function onPopState(e){if(locked)return e.preventDefault(),e.stopImmediatePropagation(),!1;null!==e.originalEvent.state?app.goto(e.originalEvent.state.url,{history:!1}):-1!==window.location.href.indexOf("#")&&app.goto(window.location.href.split("#").pop(),{history:!1})}this.start=function(){$(document).on("backbutton",onBackButton),$(window).on("popstate",onPopState)},this.stop=function(){$(document).off("backbutton",onBackButton),$(window).off("popstate",onPopState)},this.lock=function(){locked=!0},this.unlock=function(){locked=!1},this.isLocked=function(){return locked},this.addToHist=function(e){var t={url:e};history.pushState(t,"title"+(new Date).getTime(),page+"#"+e)},this.goto=function(__url,__options){if(!locked){void 0!==__options&&__options||(__options={}),OGX.Data.merge(__options,options_default);var r=findRoute(__url);if(r){r.route.hasOwnProperty("scope")||(r.route.scope="public");var access=!0;if(OGX.Scope.eval(r.route.scope)||(access=!1),routing.options.hasOwnProperty("eval")&&routing.options.eval){var fnc=eval(routing.options.eval);if(fnc){var res=fnc(r);res||(access=!1)}}if(!access)return routing.errors[403]?setTimeout((function(){app.goto(routing.errors[403],{history:!1})}),0):$(document).trigger(OGX.Router.FORBIDDEN,{url:__url,scope:r.route.scope}),!1;delete r.route.scope;var target_stage=OGX.Object.get({_NAME_:{eq:OGX.Stage.NAME},id:{eq:r.stage}},null,1);if(r.route.hasOwnProperty("origin:Route")){for(var valid=!1,origins=r.route["origin:Route"].split(","),reg,i=0;i<origins.length;i++)if("self"===origins[i]){if(reg=r.pattern.replace(/([a-z]+:)/,""),RegExp(reg).test(target_stage.url)){valid=!0;break}}else if(0===target_stage.url.indexOf(origins[i])){valid=!0;break}if(!valid)return void app.goto(r.route["origin:Route"]);delete r.route["origin:Route"]}url=r.url=__url,pattern=r.pattern;var stage=app.getStage(),render=!0,same=!0,selector,uxi;if(r.stage!==stage.id&&(stage=app.cfind(OGX.Stage.NAME,r.stage),same=!1),stage.url===r.url)if(__options.reload)for(var a in r.route)selector=a.split(":")[0],uxi=stage.nodes.get({selector:{eq:selector}},null,1),uxi&&app.find(uxi._NAME_,uxi.id,"remove");else render=!1;else same&&clearStage(stage);return same||(app.showStage(r.stage),stage=app.getStage()),stage.pattern=pattern,stage.url=r.url,render&&OGX.OML.render(stage,r.route,__options.data,r.data),render&&__options.history&&this.addToHist(__url),!0}return routing.errors[404]?setTimeout((function(){app.goto(routing.errors[404],{history:!1})}),0):$(document).trigger(OGX.Router.NOT_FOUND,{url:__url}),!1}return!1}},OGX.Router.BACK="RouterBack",OGX.Router.EXIT="ReouterExit",OGX.Router.FORBIDDEN="403",OGX.Router.NOT_FOUND="404",OGX.Scope=function(e){"use strict";var t=["public"],i=!1,n=e;this.CHANGE="ScopeChange",this.scope=function(e){return void 0===e?t:n?($(document).trigger(OGX.Scope.CHANGE),!1):(t=e,!0)},this.token=function(e,n){if(void 0===e)return!!i;var a=function(e){var t=JSON.parse(atob(e.split(".")[1]));if(t)return t;return!1}(e);return!(!a||a.iss!==n)&&(i=e,t=a.scope.split(" "),$(document).trigger(OGX.Scope.CHANGE),!0)},this.eval=function(e,i){void 0===i&&(i=t),e=function(e){if(-1===e.indexOf("/^"))return e;for(var i,n=e.split(" "),a=t.join(" "),o=0;o<n.length;o++)0===n[o].indexOf("/^")&&(i=(i=n[o].slice(2)).slice(0,-2),i=new RegExp(i,"g"),e=a.match(i)?e.replace(n[o],"1"):e.replace(n[o],"0"));return e}(e);var n=i;"string"==typeof n&&(n=n.split(" "));var a=e.match(/(?!0|1)([a-z0-9_]+)/gi);if(a&&a.length)for(var o=0;o<a.length;o++)e=n.includes(a[o])?e.replace(a[o],"1"):e.replace(a[o],"0");e=e.replace(/ /g,"|");try{var r=new Function("return "+e+";")();return"number"==typeof r&&r>0}catch(e){}return!1},this.fork=function(e){for(var t in e)if(this.eval(t))return e[t];return!1}},require("Scroller","Uxi","Touch"),OGX.Scroller=function(e){construct(this,"Scroller");var t,i,n,a,o,r,s,l,c,d,u,h=this,f=e,g={check_delay:30,fade_delay:300,css:!1,zindex:9999,observe:!0,auto_scroll:!1,scroll_callback:!1,trigger:!0},_=0,p="init",m=!1,v=!1,y=null;function x(e){e?i.on(h.touch.down,O):i.off(h.touch.down,O)}function O(e){e=h.event(e),S(!1),G(!0),b(!0),x(!1),M("in"),C(!0)}function b(e){e?(d=setInterval(T,10),i.on(h.touch.move,w)):(clearInterval(d),i.off(h.touch.move,w))}function w(e){e=h.event(e)}function G(e){e?$(document).on(h.touch.up,X):$(document).off(h.touch.up,X)}function X(){b(!1),G(!1),x(!0),C(!1),M("out")}function E(e){e?(window.addEventListener("resize",A),i.on("scroll",(function(e){e.stopImmediatePropagation(),T()})),i.on("wheel",(function(e){C(!0)})),void 0!==OGX.NestedList&&$(document).on(OGX.NestedList.OPENED+" "+OGX.NestedList.CLOSED,(function(){h.update()}))):(window.removeEventListener("resize",A),i.off("scroll"),i.off("wheel"),void 0!==OGX.NestedList&&$(document).off(OGX.NestedList.OPENED+" "+OGX.NestedList.CLOSED))}function T(){var e,a=(e=i.scrollTop())/s,r=Math.round(o.position().top);o.css("top",a+"px"),f.trigger&&!m&&(h.el.trigger(OGX.Scroller.SCROLL,{top:e,percent:100*e/n}),-1*e==i.outerHeight(!0)-t.outerHeight(!0)?r!==Math.round(a)&&h.el.trigger(OGX.Scroller.BOTTOM):0===e&&(r&&r!==Math.round(a)||!r)&&h.el.trigger(OGX.Scroller.TOP)),f.scroll_callback&&f.scroll_callback()}function C(e){e?(c&&C(!1),l=t.position().top,c=setInterval(D,f.check_delay-10)):(c&&(clearInterval(c),c=null),v=!1,h.el.trigger(OGX.Scroller.END))}function D(){var e=t.position().top;e!==l?(v||(v=!0,h.el.trigger(OGX.Scroller.START)),M("in")):M("out"),l=e}function S(e){e?u=setInterval(T,f.check_delay):clearInterval(u)}function M(e){o.hasClass("ogx_scroller_track_anim")||o.addClass("ogx_scroller_track_anim"),"in"===e?(clearTimeout(y),y=null,o.addClass("ogx_scroller_track_anim_fade_in").removeClass("ogx_scroller_track_anim_fade_out")):y||(y=setTimeout((function(){o.addClass("ogx_scroller_track_anim_fade_out").removeClass("ogx_scroller_track_anim_fade_in")}),f.fade_delay))}function L(e){e?h.observe(!0,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","src","width","height"]},N):h.observe(!1)}function N(){_!==t.height()&&(_=t.height(),A(),f.auto_scroll&&h.bottom())}function A(){if(a=i.innerHeight(),n=t.height(),s=n/a,n>a){var e=Math.round(a/s);o.css("height",e+"px"),r.css("display","block")}else r.css("display","none");"init"===p&&(p=OGX.Scroller.READY,h.el.trigger(OGX.Scroller.READY))}this._NAME_=OGX.Scroller.NAME,this.el=null,this.enable=function(){A(),E(!0),f.observe&&setTimeout((function(){L(!0)}),0),x(!0)},this.disable=function(){E(!1),f.observe&&L(!1),G(!1),b(!1),x(!1),C(!1),S(!1),o.removeClass("ogx_scroller_track_anim_fade_in"),o.removeClass("ogx_scroller_track_anim_fade_out")},this.resize=function(){A()},this.destroy=function(){h.el.removeClass("ogx_scroller_outer"),t.remove(),r.remove()},this.top=function(){n>a&&(i[0].scrollTop=0,A())},this.bottom=function(){n>a&&(i.scrollTop(n),A())},this.scroll=function(e){i[0].scrollTop=e,A()},this.mute=function(){m=!0},this.vocal=function(){m=!1},this.container=function(){return t},this.inner=function(){return t[0]},this.outer=function(){return i[0]},this.state=function(){return p},OGX.Data.merge(f,g),function(){h.el=$(f.el),h.el.addClass("ogx_scroller_outer ogx_hw"),(i=h.el).html('<div class="ogx_scroller_inner ogx_hw"></div>'),t=i.children(".ogx_scroller_inner");var e='<div class=ogx_scroller_track ogx_hw" style="z-index:'+f.zindex+';"><div class="ogx_scroller_track_button"></div></div>';i.parent().append(e),r=i.parent().find(".ogx_scroller_track"),o=r.find(".ogx_scroller_track_button")}(),A()},OGX.Scroller.NAME="Scroller",OGX.Scroller.READY="ScrollerReady",OGX.Scroller.TOP="ScrollerTop",OGX.Scroller.BOTTOM="ScrollerBottom",OGX.Scroller.SCROLL="ScrollerScroll",OGX.Scroller.START="ScrollerStart",OGX.Scroller.END="ScrollerEnd",require("StackedTree","Uxi","Touch"),OGX.StackedTree=function(e){construct(this,"StackedTree");var t,i,n,a,o=this,r={scope:["public"],speed:200,list:[],display:{html:"{{$label}}"},displays:!1,chromeos:!1},s=e,l=[],c=[0],d=0,u=!1,h="ogx_stacked_tree";function f(e){e?(t.on(o.touch.down,"."+h+"_level_prev",g),t.on(OGX.DynamicList.SELECT,_)):(t.off(o.touch.down,"."+h+"_level_prev",g),t.off(OGX.DynamicList.SELECT,_))}function g(e){e.preventDefault(),e.stopImmediatePropagation(),y(--d,!0),c.pop(),o.el.trigger(OGX.StackedTree.BACK)}function _(e,t){u=t;var i=l[d].findIndex("__id__",t.__id__);t.hasOwnProperty("items")&&t.items.length&&function(e){if(!e.hasOwnProperty("scope"))return!0;for(var t=0;t<s.scope.length;t++)if(-1!==e.scope.indexOf(s.scope[t]))return!0;return!1}(t)?(c.push(i),v(++d,t.items),o.el.trigger(OGX.StackedTree.ENTER,t),setTimeout((function(){y(d)}),0)):o.el.trigger(OGX.StackedTree.SELECT,t)}function p(e){e?$(window).on("resize",m):$(window).off("resize",m)}function m(){i.removeClass(h+"_anim"),n=i.width(),i.css("transform","translateX("+d*Math.round(n/c.length)*-1+"px)")}function v(e,t){i.removeClass(h+"_anim").css("width",100*(e+1)+"%"),n=i.width();var r,c='<div class="'+h+'_level" data-level="'+e+'">';e>0&&(r=(r=a.css(u)).replace(h+"_door",""),c+='<div class="'+h+"_item ogx_stacked_tree_level_prev "+r+'">'+a.html(u)+"</div>"),c+='<div class="'+h+'_level_list"></div></div>',i.append(c);var d=i.children("."+h+'_level[data-level="'+e+'"]').children("."+h+"_level_list");i.children("."+h+"_level").css("flex-basis",Math.floor(100/(e+1)*100)/100+"%"),function(e,t,i){l[e]&&o.remove(l[e].id,OGX.DynamicList.NAME);var n=o.create("DynamicList",{el:t,mode:"hit",scroll:!0,display:s.display,displays:s.displays,list:i});l[e]=n}(e,d[0],t)}function y(e,t){i.addClass(h+"_anim"),void 0!==t&&t&&(f(!1),i.on("transitionend",(function(){i.off("transitionend"),i.removeClass(h+"_anim").css("width",100*(e+1)+"%"),o.remove(l[e+1].id,OGX.DynamicList.NAME),l.splice(e+1,1),i.children("."+h+'_level[data-level="'+(e+1)+'"]').remove(),i.children("."+h+"_level").css("flex-basis",Math.floor(100/(e+1)*100)/100+"%"),n=i.width(),u=!1,f(!0)}))),n=i.width(),i.css("transform","translateX("+e*Math.round(n/c.length)*-1+"px)")}this._NAME_=OGX.StackedTree.NAME,this.el=null,this.enable=function(){this.touch.enable(),f(!0),p(!0)},this.disable=function(){this.touch.disable(),f(!1),p(!1)},this.resize=function(){m()},this.destroy=function(){},this.val=function(e){if(e.length){var t=e.slice();return s.list={items:t},!0}return!1},this.scope=function(e){return void 0!==e?(s.scope=e,c=[0],d=0,u=!1,!0):s.scope},function(){s=OGX.Data.merge(s,r,!1,!0);var e=(a=new OGX.Display(s)).val();if(e=function(e){if(e.display&&"object"==typeof e.display&&!e.display.hasOwnProperty("bind")&&(e.display=i(e.display)),e.displays)for(var t in e.displays)e.displays[t]=i(e.displays[t]);function i(e){var t=['{{return typeof($items) !== "undefined" && $items.length > 0}}',{add:"ogx_stacked_tree_door"}];if(e.hasOwnProperty("css"))if("object"==typeof e.css)e.css.hasOwnProperty("add")&&e.css.add?e.css.add+=" ogx_stacked_tree_item":e.css.add="ogx_stacked_tree_item",e.css.hasOwnProperty("conditions")?e.css.conditions.push(t):e.css.conditions=[t];else{var i="";e.css&&(i=e.css),i+=" ogx_stacked_tree_item",e.css={add:i,conditions:[t]}}else e.css={add:"ogx_stacked_tree_item",conditions:[t]};return e}return e}(e),a.val(e),s.display=e.display,s.displays=e.displays,o.el=t=$(s.el),t.addClass(h),s.list.length){var i=s.list.slice();s.list={items:i}}}(),t.html('<div class="'+h+'_container" style="width:100%"></div>'),i=t.children("."+h+"_container:first"),s.list.items.length&&v(c[0],s.list.items)},OGX.StackedTree.NAME="StackedTree",OGX.StackedTree.BACK="StackedTreeBack",OGX.StackedTree.ENTER="StackedTreeEnter",OGX.StackedTree.SELECT="StackedTreeSelect",require("Stage","Uxi","Touch","Placeholder"),OGX.Stage=function(e){construct(this,"Stage");var t=this,i=OGX.Data.merge({id:"stage",anim:null,group_watch:!1},e,!0,!0);function n(e){e?t.el.on(t.touch.down,".ogx_stage_exit",(function(){app.theater.show()})):t.el.off(t.touch.down,".ogx_stage_exit")}this.el=null,this.id=i.id,this.anim=i.anim,this.theater=!1,this.home=null,this.url=null,this.route=null,this._CLASS_=e._sub_,this._NAME_=OGX.Stage.NAME,delete e._sub_,this.enable=function(){i.closeable&&n(!0)},this.disable=function(){i.closeable&&n(!1)},function(){i.hasOwnProperty("theater")&&(t.theater=i.theater),t.home=i.home;var e=new OGX.Display(i),n="block";i.hasOwnProperty("use")&&i.use||(n="none");var a="";i.closeable&&(a='<div class="ogx_stage_exit"></div>');var o=e.html();i.hasOwnProperty("data")&&(o=OGX.Templater.make(o,i.data)),a+=o,t.el=container=$(i.el),container.html(a),container.addClass("ogx_stage").css("display",n)}()},OGX.Stage.NAME="Stage",OGX.Stage.SWAP="swap",OGX.Stage.FLIP="flip",require("Switch","Uxi","Bind","Touch"),OGX.Switch=function(e){construct(this,"Switch");var t,i=this,n=e,a={el:"document",bind:!1,labels:!0,data:[{label:"OFF",value:!1},{label:"ON",value:!0}],value:!1,name:!1},o="ogx_switch";function r(e){n.value===n.data[0].value?n.value=n.data[1].value:n.value=n.data[0].value,s()}function s(){"undefined"==typeof __trigger?__trigger=!1:__trigger=!0;var e=t.find("."+o+"_dot:first"),i=t.find("."+o+"_label:first"),a=t.find("."+o+"_label:last");n.value==n.data[0].value?(e.removeClass(o+"_dot_right").addClass(o+"_dot_left"),i.removeClass(o+"_label_off").addClass(o+"_label_on").addClass(o+"_selected"),a.removeClass(o+"_label_on").addClass(o+"_label_off").removeClass(o+"_selected")):(e.removeClass(o+"_dot_left").addClass(o+"_dot_right"),a.removeClass(o+"_label_off").addClass(o+"_label_on").addClass(o+"_selected"),i.removeClass(o+"_label_on").addClass(o+"_label_off").removeClass(o+"_selected")),n.name&&t.find('input[type="hidden"]').attr("value",n.value).trigger("input")}function l(e){e?t.on(i.touch.down,c):t.off(i.touch.down,c)}function c(e){e.preventDefault(),e.stopImmediatePropagation(),r(),d(!1),t.trigger(OGX.Switch.CHANGE,n.value),t.children("."+o+"_val").trigger("input"),d(!0)}function d(e){e?t.on("change","input[type=hidden]",u):t.off("change","input[type=hidden]",u)}function u(e){e.preventDefault(),e.stopImmediatePropagation(),n.value=OGX.Data.stringToVal(e.target.value),s()}this._NAME_=OGX.Switch.NAME,this.el=null,this.enable=function(){l(!0),n.name&&d(!0),t.removeClass(o+"_disabled")},this.disable=function(){l(!1),n.name&&d(!1),t.addClass(o+"_disabled")},this.bindRender=function(e,t){},this.val=function(e,i){return void 0===i&&(i=!0),void 0!==e&&n.value!==e&&(r(),i&&t.children("."+o+"_val:first").trigger("input")),n.value},this.toggle=function(e){r(e=void 0===e)},function(){var e;void 0===n&&(n={}),n.hasOwnProperty("data")&&!n.hasOwnProperty("value")&&(e=n.data[0].value),OGX.Data.merge(n,a),void 0!==e&&(n.value=e),i.el=t=$(n.el),t.addClass(o+"_disabled");var r=t.parent();r[0].hasAttribute("data-value")&&(n.value=OGX.Data.stringToVal(r.data("value")),r.removeAttr("data-value"))}(),function(){var e="";n.labels&&(e+='<span class="'+o+'_label_on ogx_switch_label">'+n.data[0].label+"</span>");var i="";n.value===n.data[1].value&&(i=o+"_dot_right"),e+='<div class="'+o+'_track"><div class="'+o+'_track_bg"></div><div class="'+o+"_dot "+i+'"></div></div>',n.labels&&(e+='<span class="'+o+'_label_off ogx_switch_label">'+n.data[1].label+"</span>"),n.name&&(e+='<input class="'+o+'_val" type="hidden" name="'+n.name+'" value="'+n.value+'"></div>'),t.html(e),t.addClass(o)}(),setTimeout(s,0)},OGX.Switch.NAME="Switch",OGX.Switch.CHANGE="SwitchChange",OGX.Switch.BIND=OGX.Switch.CHANGE,require("Tabs","Uxi","Touch"),OGX.Tabs=function(e){construct(this,"Tabs");var t,i=this,n=e,a={editable:!0,detachable:!1,detach_min:20,reorder:!0,icons:!1,index:0,list:new OGX.List,display:{html:"",css:""}},o=!1,r=0,s=!1,l=!1,c=!1,d=!1,u=!1,h={x:0,y:0},f="ogx_tabs";function g(){for(var e,i,a='<div class="'+f+'_container">',s=0;s<n.list.length;s++)i=n.display.css(n.list[s]),s===r&&(i+=" ogx_tabs_tab_active"),e=!1,"string"==typeof n.list[s]?e=n.list[s]:(n.list[s].hasOwnProperty("label")&&(e=n.list[s].label),n.list[s].hasOwnProperty("enabled")&&n.list[s].enabled&&(i+=" "+f+"_tab_disabled")),a+='<div class="'+f+"_tab "+i+'">',e&&(a+='<span class="'+f+'_tab_label">'+e+"</span>"),n.editable&&(a+='<span class="'+f+'_tab_close"><span></span></span>'),a+="</div>",i="";a+="</div>",n.editable&&(a+='<div class="'+f+'_tab_add"><span></span></div>',t.addClass(f+"_editable")),t.html(a),o=t.children("."+f+"_container:first").children("."+f+"_tab:eq("+r+")")}function _(e){s||(u=!1,l=$(e),c={from:l.index()},t.children("."+f+"_container:first").children("."+f+"_tab_active:first").removeClass(f+"_tab_active"),h.x=l.position().left,h.y=l.position().top,(s={el:$(e).clone(),x:h.x,y:l.position().top}).w=l.width(),s.el.width(s.w),l.addClass(f+"_tab_active").addClass(f+"_frozen"),o=l,s.el.addClass(f+"_tab_active").addClass(f+"_float").css("transform","translate3d("+h.x+"px, "+s.y+"px, 0px)"),t.children("."+f+"_container:first").prepend(s.el),d=setInterval(m,5))}function p(e,a){if(s)if(u=a,Math.abs(a.x)>Math.abs(a.y)){var o=s.x+a.x;s.el.css("transform","translate3d("+o+"px, "+s.y+"px, 0px)")}else{var r=s.y+a.y;if(s.el.css("transform","translate3d("+s.x+"px, "+r+"px, 0px)"),Math.abs(a.y)>4){c.to=l.index(),v();var d=n.list[c.from];"object"==typeof d&&(d=d.label);var h={label:d,index:c.to};i.removeAt(c.to),t.trigger(OGX.Tabs.REMOVE,h)}}}function m(){var e,i,n;s&&u&&(idx=l.index(),Math.abs(u.x)>Math.abs(u.y)&&t.children("."+f+"_container:first").children("."+f+"_tab").each((function(t,a){(e=$(a)).hasClass(f+"_tab_active")||(i=e.position(),n=e.width(),idx!==t&&(s.x+u.x>i.left+n/2&&s.x+u.x<i.left+n?(l.detach(),e.after(l)):s.x+u.x>i.left&&s.x+u.x<i.left+n/2&&(l.detach(),e.before(l))))})))}function v(){if(s&&(clearInterval(d),d=!1,u=!1,s.el.remove(),s=!1,l.removeClass(f+"_frozen"),c.to=l.index(),c.to!==c.from)){var e=n.list.splice(c.from,1);n.list.insert(e[0],c.to),r=c.to,i.el.trigger(OGX.Tabs.REORDER,c)}}function y(e){e?(t.on("click","."+f+"_tab",(function(){var e=$(this);e.hasClass(f+"_tab_disabled")||(o&&o.removeClass(f+"_tab_active"),e.addClass(f+"_tab_active"),r!==(o=e).index()&&(r=o.index(),t.trigger(OGX.Tabs.SELECT,n.list[o.index()])))})),n.editable&&t.on("click","."+f+"_tab_close",(function(e){return e.preventDefault(),e.stopImmediatePropagation(),t.trigger(OGX.Tabs.CLOSE,{index:r,tab:n.list[r]}),i.removeCurrent(),updateContainerWidth(),!1}))):(t.off("click","."+f+"_tab"),n.editable&&(t.off("click","."+f+"_tab_add"),t.off("click","."+f+"_tab_close")))}this._NAME_=OGX.Tabs.NAME,this.el=null,this.enable=function(){y(!0),n.reorder&&this.touch.hold.enable()},this.disable=function(){y(!1),n.reorder&&this.touch.hold.disable()},this.empty=function(){this.clear(),r=0,o=null,n.list=new OGX.List,t.empty()},this.val=function(e){if(void 0===e)return o;var t;"string"==typeof e?t=n.list.indexOf(e):e.hasOwnProperty("label")&&(t=(t=n.list.findIndex("label",e.label)).index),this.index(t)},this.set=function(e){if(void 0===e)return n.list;e.hasOwnProperty("insert")||(e=new OGX.List(e)),n.list=e,setTimeout(g,0)},this.add=function(e){n.icons&&(e.hasOwnProperty("icon")||(e.icon=n.icon_default)),n.list.push(e),r=n.list.length-1,setTimeout((function(){var e,i,n;g(),e=t.width(),i=t.children("."+f+"_container:first"),(n=i.width())>e&&i.css("transform","translateX("+-1*(n-e)+"px)")}),0)},this.addAt=function(e,t){n.icons&&(e.hasOwnProperty("icon")||(e.icon=n.icon_default)),n.list.insert(e,t),r=t,setTimeout(g,0)},this.removeCurrent=function(){o&&this.removeTabAt(r)},this.removeAt=function(e){return!!n.list.delete(e)&&(t.children("."+f+"_container:first").children("."+f+"_tab:eq("+e+")").remove(),o=null,function(){r>0?r--:r=0;i.index(r)}(),!0)},this.enableTab=function(e){t.children("."+f+"_container:first").children("."+f+"_tab:eq("+e+")").removeClass(f+"_tab_disabled")},this.disableTab=function(e){t.children("."+f+"_container:first").children("."+f+"_tab:eq("+e+")").addClass(f+"_tab_disabled")},this.index=function(e){return void 0!==e?(o&&(o.removeClass(f+"_tab_active"),o=null),(o=t.children("."+f+"_container:first").children("."+f+"_tab:eq("+e+")")).addClass(f+"_tab_active"),r=e,!0):o?r:-1},this.select=function(e){o&&o.removeClass(f+"_tab_active");var t=n.list.findIndex("label",e);this.index(t.index)},n||(n={}),OGX.Data.merge(n,a),n.list.hasOwnProperty("insert")||(n.list=new OGX.List(n.list)),n.display.hasOwnProperty("_NAME_")||(n.display=new OGX.Display(n.display)),i.el=t=$(n.el),t.addClass(f),n.editable&&t.addClass(f+"_editable"),r=n.index,setTimeout(g,0),n.reorder&&i.touch.hold.set({target:".ogx_tabs_tab",cb_hold:_,cb_move:p,cb_up:v})},OGX.Tabs.NAME="Tabs",OGX.Tabs.SELECT="TabsSelect",OGX.Tabs.CLOSE="TabsClose",OGX.Tabs.REORDER="TabsReoroder",OGX.Tabs.ADD="TabsAdded",OGX.Tabs.REMOVE="TabsRemoved",require("Tags","Uxi","Touch"),OGX.Tags=function(__config){construct(this,"Tags");var that=this,config=__config,config_default={remove:!0,add:!0,name:!1,tags:[],current_tags:[],tags_ascii:[],mode:OGX.Tags.MODE_STRING,keycode:13,placeholder:"keywords",restrict:!1,strict:!1,required:!1,max:0,display_max:0,display_more:!1,click_more:!1,hide_input_on_disable:!0,more_word:"other"},container,input,sliced={org:[],rem:[]};function updateHidden(e){var t;t=1===config.max&&config.current_tags.length?config.current_tags[0]:JSON.stringify(config.current_tags),container.find("input[type=hidden]").val(t),e&&container.find("input[type=hidden]").trigger("change")}function addTag(e){var t=!1;switch(config.mode){case OGX.Tags.MODE_STRING:case OGX.Tags.MODE_ASCII:-1===config.current_tags.indexOf(e)&&(config.current_tags.push(e),t=!0);break;case OGX.Tags.MODE_OBJECT:var i=config.current_tags.find("label",e,1);i||((i=config.tags.find("label",e,1))?config.current_tags.push(i):config.current_tags.push({label:e}),t=!0)}if(t){var n="";!0===config.remove&&(n='<span class="ogx_tags_remove"></span>');var a='<span class="ogx_tags_tag"><span>'+e+"</span>"+n+"</span>";container.find(".ogx_tags_tags:first").append(a),listenHidden(!1),updateHidden(!0),listenHidden(!0),container.trigger(OGX.Tags.TAG_ADDED,e),container.trigger(OGX.Tags.CHANGE,[config.current_tags])}container.find(".ogx_tags_input:first").focus()}function removeTag(e){var t=!1;switch(config.mode){case OGX.Tags.MODE_STRING:case OGX.Tags.MODE_ASCII:var i=config.current_tags.indexOf(e);i>-1&&(t=config.current_tags.splice(i,1));break;case OGX.Tags.MODE_OBJECT:t=config.current_tags.findDelete("label",e)}return t&&container.find(".ogx_tags_tags:first").find(".ogx_tags_tag").each((function(t,i){if($(i).find("span:first").text()===e)return $(i).remove(),listenHidden(!1),updateHidden(!0),void listenHidden(!0)})),t}function displayTags(e,t){if(e){container.find(".ogx_tags_container:first").length>0&&(displayTags(!1),listenTagAdd(!1));for(var i='<div class="ogx_tags_container">',n=!1,a=0;a<t.length;a++)if("object"==typeof t[a]&&t[a].hasOwnProperty("__m__"))n=t[a].__m__;else switch(config.mode){case OGX.Tags.MODE_STRING:case OGX.Tags.MODE_ASCII:i+='<span class="ogx_tags_tag ogx_tags_container_tag">'+t[a]+"</span>";break;case OGX.Tags.MODE_OBJECT:i+='<span class="ogx_tags_tag ogx_tags_container_tag">'+t[a].label+"</span>"}n&&(i+='<span class="ogx_tags_tag ogx_tags_more">+'+n+" "+config.more_word+"</span>"),i+="</div>",container.append(i),listenTagAdd(!0)}else container.find(".ogx_tags_container").remove(),listenTagAdd(!1)}function renderTags(e){for(var t="",i="",n=0;n<e.length;n++)switch(i=!0===config.remove?'<span class="ogx_tags_remove"></span>':"",config.mode){case OGX.Tags.MODE_STRING:case OGX.Tags.MODE_ASCII:t+='<span class="ogx_tags_tag"><span>'+e[n]+"</span>"+i+"</span>";break;case OGX.Tags.MODE_OBJECT:t+='<span class="ogx_tags_tag"><span>'+e[n].label+"</span>"+i+"</span>"}return config.current_tags=e,container.find(".ogx_tags_tags:first").html(t),updateHidden(!1),!0}function trimTags(e){return e=OGX.Data.clone(e),sliced={org:OGX.Data.clone(e),rem:[]},Array.isArray(e)&&config.display_max&&e.length>config.display_max&&(sliced.rem=e.slice(config.display_max),e=e.slice(0,config.display_max)),config.display_more&&sliced.rem.length&&e.push({__m__:sliced.rem.length}),new OGX.List(e)}function findTags(e){for(var t,i=[],n=0;n<config.tags.length;n++)if(t=!1,0===config.tags[n].toLowerCase().indexOf(e.toLowerCase())&&-1===config.current_tags.indexOf(config.tags[n])){if(config.display_max){if(!(i.length+1<=config.display_max))return i;t=!0}else t=!0;t&&i.push(config.tags[n])}return trimTags(i)}function findTagsObj(e){var t=new RegExp(e,"gi"),i=config.tags.find("label",t);if(i&&i.length)for(var n=0;n<config.current_tags.length;n++)i.findDelete("label",config.current_tags[n].label);return i&&i.length?trimTags(i):[]}function findTagsAscii(e){var t,i=stringToAscii(e.substr(0,3)),n=[];if(config.tags_ascii[i])for(var a=0;a<config.tags_ascii[i].length;a++)if(t=!1,-1!==config.tags_ascii[i][a].toLowerCase().indexOf(e.toLowerCase())&&-1===config.current_tags.indexOf(config.tags[a])){if(config.display_max){if(!(n.length+1<=config.display_max))return n;t=!0}else t=!0;t&&n.push(config.tags_ascii[i][a])}return n&&n.length?trimTags(n):[]}function stringToAscii(e){for(var t="",i=0;i<e.length;i++)t+=e.toLowerCase().charCodeAt(i).toString();return t}function listenInput(e){e?input.on("keyup",(function(e){var t=$(this).val();if(t.length>=3)if(!config.strict&&e.which===config.keycode&&config.add)addTag(t),input.val(""),displayTags(!1);else{var i;switch(config.mode){case OGX.Tags.MODE_STRING:i=findTags(t);break;case OGX.Tags.MODE_OBJECT:i=findTagsObj(t);break;case OGX.Tags.MODE_ASCII:i=findTagsAscii(t)}i.length>0?displayTags(!0,i):displayTags(!1)}else displayTags(!1)})):input.off("keyup")}function listenSelect(e){e?container.on(that.touch.down,".ogx_tags_tag",onSelect):container.off(that.touch.down,".ogx_tags_tag",onSelect)}function onSelect(e){var t=$(this).text();switch(config.mode){case OGX.Tags.MODE_OBJECT:t=config.current_tags.get({label:{eq:t}},null,1)}that.el.trigger(OGX.Tags.SELECT,t)}function listenMore(e){e?container.on(that.touch.down,".ogx_tags_more",onMore):container.off(that.touch.down,".ogx_tags_more",onMore)}function onMore(e){e.preventDefault(),e.stopImmediatePropagation(),sliced.rem.length&&($(this).remove(),displayTags(!0,sliced.org))}function listenTagAdd(e){e?container.on(that.touch.down,".ogx_tags_container_tag",onAdd):container.off(that.touch.down,".ogx_tags_container_tag",onAdd)}function onAdd(e){addTag($(this).text()),input.val(""),displayTags(!1),config.max&&config.current_tags.length===config.max&&(listenInput(!1),input.css("display","none"))}function listenTagRemove(e){e?container.on(that.touch.down,".ogx_tags_remove",onRemove):container.off(that.touch.down,".ogx_tags_remove",onRemove)}function onRemove(e){e.preventDefault(),e.stopImmediatePropagation();var t=removeTag($(this).parent("span:first").find("span:first").text());container.trigger(OGX.Tags.TAG_REMOVED,t),container.trigger(OGX.Tags.CHANGE,[config.current_tags]),config.max&&config.current_tags.length<config.max&&(listenInput(!0),input.css("display","block")),input.focus()}function listenHidden(e){e?container.on("change","input[type=hidden]",onHiddenChange):container.off("change","input[type=hidden]",onHiddenChange)}function onHiddenChange(e){e.preventDefault(),e.stopImmediatePropagation(),e.target.value.length?config.current_tags=JSON.parse(e.target.value):config.current_tags=[],renderTags(config.current_tags)}function initInput(){var e='<span class="ogx_tags_tags"></span>';if(config.add&&(e+='<input type="text" class="ogx_tags_input" placeholder="'+config.placeholder+'">'),config.name){var t="";config.required&&(t="required"),e+='<input type="hidden" name="'+config.name+'" '+t+">"}if(container.html(e),input=container.find(".ogx_tags_input:first"),config.restrict){var i={multiline:!1,max:30};"object"==typeof config.restrict&&(i=config.restrict),i.el=input[0],OGX.Form.restrictField(i)}}function initDefaults(){for(var a in config||(config={}),config_default)config.hasOwnProperty(a)||(config[a]=config_default[a]);config.tags.hasOwnProperty("insert")||(config.tags=new OGX.List(config.tags)),config.current_tags.hasOwnProperty("insert")||(config.current_tags=new OGX.List(config.current_tags)),config.restrict&&("string"==typeof config.restrict.allowed&&(config.restrict.allowed=eval(config.restrict.allowed)),"string"==typeof config.restrict.forbidden&&(config.restrict.forbidden=eval(config.restrict.forbidden))),that.el=container=$(config.el),container.addClass("ogx_tags")}function init(){initDefaults(),initInput(),config.current_tags.length>0&&renderTags(config.current_tags)}this._NAME_=OGX.Tags.NAME,this.el=null,this.enable=function(){if(config.remove&&(listenInput(!0),listenTagAdd(!0),listenTagRemove(!0)),config.display_more&&config.click_more&&listenMore(!0),config.name&&listenHidden(!0),listenSelect(!0),config.add){var e=container.find(".ogx_tags_input:first");e.prop("placeholder",config.placeholder),e.prop("disabled",!1),config.hide_input_on_disable&&e.removeClass("ogx_tags_hidden")}},this.disable=function(){if(config.remove&&(listenInput(!1),listenTagAdd(!1),listenTagRemove(!1)),config.display_more&&config.click_more&&listenMore(!1),config.name&&listenHidden(!1),listenSelect(!1),config.add){var e=container.find(".ogx_tags_input:first");e.prop("placeholder",""),e.prop("disabled",!0),config.hide_input_on_disable&&e.addClass("ogx_tags_hidden")}},this.destroy=function(){config.restrict&&OGX.Form.unrestrictField(container.find(".ogx_tags_input:first")[0])},this.tags=function(e){return void 0!==e?(e.hasOwnProperty("insert")||(e=new OGX.List(e)),config.tags=e,!0):config.tags},this.val=function(e,t){if(displayTags(!1),listenTagAdd(!1),void 0!==e){if(void 0!==t){var i=e,n=config.tags.find(i,t,1);n&&(e=[n])}return e.hasOwnProperty("insert")||(e=new OGX.List(e)),config.current_tags=e,config.max&&config.current_tags.length>=config.max&&container.find(".ogx_tags_input:first").css("display","none"),renderTags(config.current_tags)}return config.current_tags},this.clear=function(){config.max&&config.current_tags.length===config.max&&(container.find(".ogx_tags_input:first").css("display","block"),listenInput(!0)),config.current_tags=new OGX.List,container.find(".ogx_tags_tags:first").empty(),container.find("input[type=hidden]").val("")},this.render=function(e){return renderTags(trimTags(e))},this.add=function(e){return addTag(e)},this.remove=function(e){return removeTag(e)},init()},OGX.Tags.prototype.tagDataset=function(e,t,i){"use strict";void 0===i&&(i=!1);for(var n,a=[],o=0;o<e.length;o++)for(var r=0;r<t.length;r++)if(e[o].hasOwnProperty(t[r])){n=e[o][t[r]].split(" ");for(var s=0;s<n.length;s++)i&&-1!==i.indexOf(n[s])||a.includes(n[s])||a.push(n[s])}return a},OGX.Tags.prototype.tagDatatree=function(e,t){"use strict";!function(e,t){var i=[];if(function e(n){if(n.hasOwnProperty("items"))for(var a=0;a<n.items.length;a++){for(var o in n.items[a])t.indexOf(o)>-1&&(i.includes(n.items[a][o])||i.push(n.items[a][o]));return e(n.items[a]),!0}}(e));}(e,t)},OGX.Tags.NAME="Tags",OGX.Tags.CHANGE="TagsChange",OGX.Tags.SELECT="TagsSelect",OGX.Tags.TAG_ADDED="TagsTagAdded",OGX.Tags.TAG_REMOVED="TagsTagRemoved",OGX.Tags.MODE_STRING="string",OGX.Tags.MODE_OBJECT="object",OGX.Tags.MODE_ASCII="ascii",OGX.Tags.BIND=OGX.Tags.CHANGE,OGX.Templater=function(){"use strict";var e,t=this;this.jmake=function(e,t){for(var i,n,a=JSON.stringify(e);m=/({{(\$|#)[a-z0-9_\.]*}})|("{{(\$)}}")/gi.exec(a);)m[0].match(/"{{(\$)}}"/)?(i="<-"+(i=JSON.stringify(t)).substring(1).slice(0,-1)+"->",a=(a=(a=a.replace(m[0],i)).replace(/<\-/,"{")).replace(/\->/,"}")):("object"==typeof(n=OGX.OSE.exec(m[0],t))&&(n=JSON.stringify(n),m[0]='"'+m[0]+'"'),a=a.replace(m[0],n));return JSON.parse(a)},this.make=function(t,i,n,a,o){var r,s;for(e={},void 0===o&&(o={}),OGX.Data.merge(e,o);r=/{{[^{]+(({[^{]+)+)?}}/gi.exec(t);)void 0===(s=OGX.OSE.exec(r[0],i,n,a,e))&&(s=""),t=t.replace(r[0],s);return t},this.get=function(e){var i=OGX.Cache.read("html",e);return!!i&&function(e){var i;for(;i=/{{ ?template (\S+) ?}}/gi.exec(e);)e=e.replace(i[0],t.get(i[1]));return e}(i)}},OGX.Templater=new OGX.Templater,require("Theater","Uxi","Touch"),OGX.Theater=function(e){construct(this,"Theater");var t,i,n,a=this,o=e,r={anim:!1,display:!0,icon_size:50,timeout:30},s={template:!1,html:'<span class="ogx_theater_stage_icon" style="background-image:url(\'{{$icon}}\')"></span><span class="ogx_theater_stage_label">{{$label}}</span>'},l='<div class="list"></div>',c=!0;function d(e){e?($(document).on("backbutton",u),$(window).on("popstate",u),list.el.on(OGX.DynamicList.SELECT,(function(e,t){!function(e){a.el.trigger(OGX.Theater.HIDE);var t=app.find(OGX.Stage.NAME,e);t.wake(),t.resizeNodes();var n,r=list.el.find('.ogx_theater_stage[data-ogx-id="'+t.id+'"]').position();a.observe(!0,{childList:!0},(function(){a.observe(!1),(n=i.children(".ogx_theater_trans:first")).on("transitionend",(function(){n.off("transitionend"),a.hide(),n.remove(),t.url?(app.showStage(t.id,!1),app.router.addToHist(t.url)):app.goto(t.id+"/"+t.home)})),n.removeClass("ogx_theater_trans_hide"),setTimeout((function(){n.addClass("ogx_theater_trans_grow").css({opacity:1,width:"100%",height:"100%",transform:"translate3d(0px, 0px, 0px)"})}),o.timeout)}),null,i),i.append('<div class="ogx_theater_trans ogx_theater_trans_hide" style="width:'+o.icon_size+"px; height:"+o.icon_size+"px; transform:translate3d("+r.left+"px,"+r.top+'px, 0px);" data-ogx-id="'+t.id+'"><div class="icon" style="background-image:url(\'/img/'+t.theater.icon+"')\"></div></div>")}(t.id)}))):($(document).off("backbutton",u),$(window).off("popstate",u),list.el.off(OGX.DynamicList.SELECT))}function u(){a.hide()}function h(){t.prepend(l);for(var e,i=[],r=0;r<n.length;r++)e={id:n[r].id,name:"",icon:""},"object"==typeof n[r].theater&&n[r].theater.hasOwnProperty("icon")&&(e.icon="./img/"+n[r].theater.icon,e.label=n[r].theater.label),i.push(e);$(".ogx_theater > .list").on(OGX.DynamicList.RENDER,(function(e){$(".ogx_theater > .list").off(OGX.DynamicList.RENDER),setTimeout((function(){l=$(".ogx_theater:first").detach()}),0)})),list=a.create("DynamicList",{el:".ogx_theater > .list",display:{html:o.display.html,css:"ogx_theater_stage"},key:"id",scroll:!0,mode:"hit",list:i,trigger:!0})}function f(){var e=app.gather(OGX.Stage.NAME);n=[];for(var t=0;t<e.length;t++)e[t].theater&&n.push(e[t])}this._NAME_=OGX.Theater.NAME,this.update=function(){f()},this.show=function(){c&&(i.prepend(l),function(){a.el.trigger(OGX.Theater.SHOW);var e,n=app.getStage();a.observe(!0,{childList:!0},(function(t){a.observe(!1),n.sleep(),e=i.children(".ogx_theater_trans:first");var r=list.el.find('.ogx_theater_stage[data-ogx-id="'+n.id+'"]').position();e.removeClass("ogx_theater_trans_hide"),setTimeout((function(){e.on("transitionend",(function(){e.off("transitionend"),setTimeout((function(){e.remove()}),0)})),e.addClass("ogx_theater_trans_show").addClass("ogx_theater_trans_shrink").css({opacity:0,width:o.icon_size+"px",height:o.icon_size+"px",transform:"translate3d("+r.left+"px, "+r.top+"px, 0px)"})}),o.timeout)}),null,i),i.append('<div class="ogx_theater_trans ogx_theater_trans_hide" data-ogx-id="'+n.id+'"><div class="icon" style="background-image:url(\'/img/'+n.theater.icon+"')\"></div></div>"),t.css("visibility","visible")}(),this.focusNodes(),d(!0),c=!1)},this.hide=function(){c||(this.blurNodes(),l=t.detach(),d(!1),c=!0)},this.tile=function(e,t){void 0===t&&(t="x")},OGX.Data.merge(o,r),o.display&&("object"!=typeof o.display&&(o.display={}),OGX.Data.merge(o.display,s),o.display.template&&(o.display.html=OGX.Templater.get(o.display.template))),a.el=t=$(o.el),t.addClass("ogx_theater").css("visibility","hidden"),i=$("body"),f(),$(document).on(OGX.App.READY,h)},OGX.Theater.NAME="Theater",OGX.Theater.ZOOM="TheaterZoom",OGX.Theater.SHOW="TheaterShow",OGX.Theater.HIDE="TheaterHide",OGX.Touch=function(e){"use strict";var t=this;this.touch=!1,this.touch||this.initTouch(e.chromeos),this.touch.swipe=new OGX.Touches.Swipe(this),this.touch.hold=new OGX.Touches.Hold(this),this.touch.drag=new OGX.Touches.Drag(this),this.touch.isRightClick=function(e){var i=t.event(e),n=!1;return i.which?n=3===i.which:i.button&&(n=2===i.button),n},this.touch.enable=function(){t.touch.swipe.enable(),t.touch.hold.enable(),t.touch.drag.enable()},this.touch.disable=function(){t.touch.swipe.disable(),t.touch.hold.disable(),t.touch.drag.disable()}},OGX.Touch.prototype.initTouch=function(e){void 0===e&&(e=!1),this.touch={hold:{}},this.touch.click="click",this.touch.down="mousedown",this.touch.up="mouseup",this.touch.move="mousemove",void 0===window.ontouchstart||e||(this.touch.down="touchstart",this.touch.up="touchend",this.touch.move="touchmove")},OGX.Touch.prototype.touchable=function(){return void 0!==window.ontouchstart},OGX.Touch.prototype.event=function(e){return e.hasOwnProperty("originalEvent")&&void 0!==e.originalEvent.changedTouches?e.originalEvent.changedTouches[0]:e},OGX.Touches={},OGX.Touches.Swipe=function(e){"use strict";var t,i=e,n={speed:10,x:!0,y:!1,min_x:100,min_y:100,cb_down:!1,cb_swipe:!1,cb_up:!1,target:!1,capture:!1},a=!1,o={x:0,y:0},r={x:0,y:0},s=0,l=0,c=0,d=0,u=0,h=!1,f=!1,g=!1;function _(e){g||(g=!0,e=i.event(e),o.x=e.pageX,o.y=e.pageY,c=d=0,s=l=u=0,p(!0),a.cb_down&&a.cb_down(o))}function p(e){e?(m(!0),h=setInterval(O,a.speed)):(m(!1),h&&(clearInterval(h),h=!1))}function m(e){e?t.on(i.touch.move,x):t.off(i.touch.move,x)}function v(e){e?($("body").on(i.touch.up,y),t.on(i.touch.down,_)):($("body").off(i.touch.up,y),t.off(i.touch.down,_))}function y(e,t){f&&(void 0===t&&(t=!1),p(!1),g&&a.cb_up&&a.cb_up({pt0:o,pt1:r,distX:c,distY:d,dist:u,dirX:s,dirY:l,swipe:t}),g=!1)}function x(e){a.capture&&(e.preventDefault(),e.stopImmediatePropagation()),e=i.event(e),r.x=e.pageX,r.y=e.pageY,s=r.x>o.x?1:-1,l=r.y>o.y?1:-1,c=Math.abs(r.x-o.x),d=Math.abs(r.y-o.y),u=Math.sqrt(Math.abs(Math.pow(r.x-o.x,2)-Math.pow(r.y-o.y,2)))}function O(){a.cb_swipe&&(a.x&&a.min_x&&c>=a.min_x||a.y&&a.min_y&&d>=a.min_y?y(0,!0):a.cb_swipe({pt0:o,pt1:r,dirX:s,dirY:l,distX:c,distY:d,dist:u}))}this.set=function(e){a||(a=OGX.Data.clone(n)),OGX.Data.merge(a,e,!0),t=i.el},this.enable=function(){!f&&a&&(f=!0,v(!0))},this.disable=function(){f&&a&&(f=!1,v(!1),p(!1))}},OGX.Touches.Hold=function(e){"use strict";var t={cb_hold:!1,cb_up:!1,cb_move:!1,time:1e3,el:this.el,target:!1,capture:!1},i=!1,n=!1,a=!1,o=!1,r=!1,s=!1,l=e,c={x:0,y:0},d={x:0,y:0},u=!1;function h(e){e=l.event(e),u=e.target.offsetParent,o||(o=!0,n=(new Date).getTime(),c.x=l.el.offset().left+e.pageX,c.y=l.el.offset().top+e.pageY,$("body").on(l.touch.move,f),a=setInterval(g,1))}function f(e){i.capture&&(e.preventDefault(),e.stopImmediatePropagation()),e=l.event(e),d.x=l.el.offset().left+e.pageX,d.y=l.el.offset().top+e.pageY,!r&&Math.abs(c.x-d.x)>5||Math.abs(c.y-d.y)>5?(clearInterval(a),a=!1):i.cb_move&&i.cb_move(d,{x:d.x-c.x,y:d.y-c.y})}function g(){o&&(new Date).getTime()-n>i.time&&(r||(r=!0,i.cb_hold?i.cb_hold(u):l.el.trigger(OGX.Touch.HOLD_START)))}function _(){r=!1,o=!1,$("body").off(l.touch.move,f),clearInterval(a),a=!1,i.cb_up?i.cb_up():l.el.trigger(OGX.Touch.HOLD_END)}this.set=function(e){i=e,OGX.Data.merge(i,t)},this.enable=function(){!s&&i&&(s=!0,l.el.on(l.touch.down,i.target,h),$("body").on(l.touch.up,_))},this.disable=function(){s&&i&&(s=!1,(o||a)&&(r=!1,o=!1,clearInterval(a),a=!1),l.el.off(l.touch.down,i.target,h),$("body").off(l.touch.up,_),$("body").off(l.touch.move,f))}},OGX.Touches.Drag=function(e){"use strict";var t,i,n,a,o,r,s=!1,l={min:10,limit_x:null,limit_y:null,target:!1,cb_down:!1,cb_drag:!1,cb_up:!1,border:10,capture:!1},c=e,d=!1,u=!1;function h(e){var t=[];t=s.target?[c.touch.down,s.target,f]:[c.touch.down,f],e?c.el.on.apply(c.el,t):c.el.off.apply(c.el,t)}function f(l){l=e.event(l),n=l.pageX,a=l.pageY;var d=c.el.position();t=d.left,i=d.top;var u=c.el.offset(),h=n-u.left,f=a-u.top;if(s.border){if(h<s.border||h>c.el.width()-s.border)return;if(f<s.border||f>c.el.height()-s.border)return}o=0,r=0,g(!0),_(!0),s.cb_down&&s.cb_down()}function g(e){e?d||(d=setInterval(v,10)):d&&(clearInterval(d),d=null)}function _(e){e?($("body").on(c.touch.move,m),$("body").on(c.touch.up,p)):($("body").off(c.touch.move,m),$("body").off(c.touch.up,p))}function p(t){g(!1),_(!1),t=e.event(t),s.x&&(o=t.pageX-n),s.y&&(r=t.pageY-a),s.cb_up&&s.cb_up({distX:o,distY:r})}function m(t){s.capture&&(t.preventDefault(),t.stopImmediatePropagation()),t=e.event(t);var i,l=!1;s.x&&(i=t.pageX-n,null!==s.limit_x?i>=s.limit_x.min&&i<=s.limit_x.max&&(s.min?Math.abs(i)>s.min&&(o=i,l=!0):(o=i,l=!0)):s.min?Math.abs(i)>s.min&&(o=i,l=!0):o=i),s.y&&(i=t.pageY-a,null!==s.limit_y?i>=s.limit_y.min&&i<=s.limit_y.max&&(s.min?Math.abs(i)>s.min&&(r=i,l=!0):(r=i,l=!0)):r=i),l&&s.cb_drag&&s.cb_drag({distX:o,distY:r,x:t.pageX,y:t.pageY})}function v(){c.el.css({transform:"translate3d("+(t+o)+"px, "+(i+r)+"px, 0px)"})}this.dragable=!0,this.set=function(e){s=e,OGX.Data.merge(s,l)},this.enable=function(){!u&&s&&(u=!0,h(!0))},this.disable=function(){u&&s&&(u=!1,h(!1),_(!1),g(!1))}},OGX.Touch.HOLD_START="TouchHoldStart",OGX.Touch.HOLD_END="TouchHoldEnd",require("Tree","Uxi","Touch"),OGX.Tree=function(e){construct(this,"Tree");var t,i,n,a,o,r,s,l,c=this,d=e,u={show_root:!0,root_label:"root",editable:!1,sort:{enabled:!0,property:"label",way:1},toggle:!0,drag_after:1e3,icon_size:30,scope:["public"],chromeos:!1,types:{root:{mode:"folder",icons:{open:"folder_open",close:"folder_closed",empty:null}},file:{mode:"file",icon:"file"},folder:{mode:"folder",icons:{open:"folder_open",close:"folder_closed",empty:null}}},data:{id:0,type:"root",label:d.root_label,state:"closed",items:[]},template:'<div class="ogx_tree_item" data-id="{{$_id_}}"><span class="ogx_tree_item_arrow {{$arrow_style}} {{$arrow_display}}"><span style="width:{{$arrow_size}}; height:{{$arrow_size}}"></span></span><span class="ogx_tree_item_icon {{$icon}}" style="width:{{$size}}px; height:{{$size}}px;"></span><div class="ogx_tree_item_label">{{$label}}</div><div class="ogx_tree_item_container {{$container_display}}"></div></div>'};function h(){var e={icon:X({type:"root",state:"open"}),size:d.icon_size,_id_:d.data._id_,label:d.root_label,container_display:"",arrow_display:"",arrow_style:"ogx_tree_item_arrow_open",arrow_size:Math.round(d.icon_size/2)+"px"};t.html(OGX.Templater.make(d.template,e)),d.data.element=t.children(".ogx_tree_item:first")}function f(){h(),g(d.data,d.data.element)}function g(e,t){if(e.hasOwnProperty("items")){var i,n;i=d.sort.enabled?function(e,t,i){return e.sort(function(e,t){return function(i,n){return i[e]<n[e]?-1*t:i[e]>n[e]?t:0}}(t,i)),e}(e.items,d.sort.property,d.sort.way):e.items;for(var a=0;a<i.length;a++)n={icon:null,size:d.icon_size,_id_:e.items[a]._id_,label:e.items[a].label,container_display:"",arrow_display:"",arrow_style:"",arrow_size:Math.round(d.icon_size/2)+"px"},e.items[a].hasOwnProperty("state")||(e.items[a].state="close"),"folder"===E(e.items[a])?(e.items[a].items.length||(e.items[a].state="close",n.arrow_style="ogx_tree_item_arrow_disabled"),"open"===e.items[a].state?n.arrow_style="ogx_tree_item_arrow_open":(n.arrow_style+=" ogx_tree_item_arrow_close",n.container_display="ogx_tree_item_container_hidden"),n.icon=X(e.items[a])):(n.arrow_display="ogx_tree_item_arrow_hidden",n.icon=X(e.items[a])),t.children(".ogx_tree_item_container:last").append(OGX.Templater.make(d.template,n)),e.items[a].element=t.children(".ogx_tree_item_container:last").children(".ogx_tree_item:last"),g(e.items[a],e.items[a].element)}}function _(e){var t=JSON.parse(JSON.stringify(e));return delete t._id_,delete t.element,t}function p(e){"folder"===E(e)&&(e.items.length||(e.state="close",e.element.children(".ogx_tree_item_arrow:first").addClass("ogx_tree_item_arrow_disabled")),"open"===e.state?(e.element.children(".ogx_tree_item_arrow:first").removeClass("ogx_tree_item_arrow_close").removeClass("ogx_tree_item_arrow_disabled").addClass("ogx_tree_item_arrow_open"),e.element.children(".ogx_tree_item_container:first").css("display","block")):(e.element.children(".ogx_tree_item_arrow:first").removeClass("ogx_tree_item_arrow_open").addClass("ogx_tree_item_arrow_close"),e.element.children(".ogx_tree_item_container:first").css("display","none")),e.element.children(".ogx_tree_item_icon:first").attr("class","ogx_tree_item_icon "+X(e)))}function m(){if(s){var e=O(s);e&&(e.children(".ogx_tree_item_icon:first").removeClass("ogx_tree_selected_item"),s=null)}}function v(e){return G((function(t,i,n,a){return t._id_===e&&(n.items.splice(a,1),n.items.length||(n.state="close"),p(n),!0)}))}function y(e,t){return G((function(i){return i._id_===t&&(i.items.push(e),i.state="open",p(i),!0)}))}function x(e){return G((function(t,i){return t._id_===e&&t}))}function O(e){var t=x(e);return!!t&&t.element}function b(e){var t=function(e){return G((function(t,i){return e===i+"/"+t.label&&t}))}(e);return!!t&&t.element}function w(){l=1,G((function(e){return e._id_=l++,e.hasOwnProperty("type")||(e.hasOwnProperty("items")?e.type="folder":e.type="file"),!1}))}function G(e,t){var i;if(void 0===t&&(t=d.data),i=function t(n,a,o,r){if(i=e(n,a,o,r))return i;if(n.hasOwnProperty("items")&&n.items.length)for(var s=0;s<n.items.length;s++)if(i=t(n.items[s],a+"/"+n.label,n,s))return i;return!1}(t,""))return i}function X(e){return!!d.types.hasOwnProperty(e.type)&&(d.types[e.type].hasOwnProperty("icons")?"close"===e.state&&!e.items.length&&d.types[e.type].icons.hasOwnProperty("empty")?d.types[e.type].icons.empty:d.types[e.type].icons[e.state]:d.types[e.type].icon)}function E(e){return!!d.types.hasOwnProperty(e.type)&&d.types[e.type].mode}function T(e){var i,n;n=_(x(i=e.data("id"))),d.toggle?e.children(".ogx_tree_item_icon:first").hasClass("ogx_tree_selected_item")?(m(),t.trigger(OGX.Tree.UNSELECT,n)):(m(),e.children(".ogx_tree_item_icon:first").addClass("ogx_tree_selected_item"),s=i,t.trigger(OGX.Tree.SELECT,n)):(m(),e.children(".ogx_tree_item_icon:first").addClass("ogx_tree_selected_item"),t.trigger(OGX.Tree.SELECT,n))}function C(e){e?(d.editable?(t.on(c.touch.down,".ogx_tree_item > .ogx_tree_item_icon",(function(e){e.preventDefault(),T($(this).parent(0)),1!==$(this).parent(0).data("id")&&function(){o&&clearInterval(o);r=(new Date).getTime(),o=setInterval(D,50)}()})),$(document).on(c.touch.up,(function(){M(),n&&(S(!1),function(){var e=n.offset().left,o=n.offset().top,r=(s=e,l=o,G((function(e,t){return c=e.element.offset(),d=e.element.children(".ogx_tree_item_icon:first"),s>=c.left&&s<=c.left+d.width()&&l>=c.top&&l<=c.top+d.height()&&e})));var s,l,c,d;!r||r&&(r._id_===i._id_||"folder"!==E(r))?(a.css("opacity",1),n.remove(),n=null,i=null):(h=r,v((u=i)._id_),y(u,h._id_),h.element.children(".ogx_tree_item_container:first").empty(),h.state="open",g(h,h.element),p(h),a.remove(),n.remove(),n=null,t.trigger(OGX.Tree.DROP,i),i=null);var u,h}())}))):t.on("click",".ogx_tree_item > .ogx_tree_item_icon",(function(e){e.preventDefault(),T($(this).parent(0))})),t.on(c.touch.down,".ogx_tree_item_arrow",(function(e){if(e.preventDefault(),M(),$(this).parent(0).children(".ogx_tree_item_container:first").children().length>0){var i=x($(this).parent(0).data("id"));"open"===i.state?(i.state="close",t.trigger(OGX.Tree.CLOSE,i)):(i.state="open",t.trigger(OGX.Tree.OPEN,i)),p(i)}}))):(d.editable?t.off(c.touch.down,".ogx_tree_item > .ogx_tree_item_icon"):t.off("click",".ogx_tree_item > .ogx_tree_item_icon"),t.off(c.touch.down,".ogx_tree_item_arrow"))}function D(){var e;(new Date).getTime()-r>=d.drag_after&&(s&&(i=x(s))&&(e=i.element,a=e,(n=e.clone()).children(".ogx_tree_item_arrow:first").css("display","none"),e.css("opacity",.3),n.addClass("ogx_tree_item_drag"),n.css({top:e.offset().top,left:e.offset().left}),t.prepend(n),S(!0),t.trigger(OGX.Tree.DRAG,i)),M())}function S(e){e?$(document).on(c.touch.move,(function(e){e=function(e){if(e.hasOwnProperty("originalEvent")&&void 0!==e.originalEvent.changedTouches)return e.originalEvent.changedTouches[0];return e}(e),n.css({top:e.pageY+"px",left:e.pageX+"px"})})):$(document).off(c.touch.move)}function M(){o&&(clearInterval(o),o=null)}this._NAME_=OGX.Tree.NAME,this.el=null,this.enable=function(){C(!0)},this.disable=function(){C(!1)},this.setIconSize=function(e){d.icon_size=e,t.find(".ogx_tree_item_icon").each((function(t,i){$(i).css({width:e+"px",height:e+"px"})})),$(".ogx_tree_item_arrow span").css({width:Math.round(d.icon_size/2)+"px",height:Math.round(d.icon_size/2)+"px"})},this.addItem=function(e){if(s){var t=x(s);return"folder"===E(t)&&(e._id_=++l,y(e,s),t.element.children(".ogx_tree_item_container:first").empty(),t.state="open",g(t,t.element),t.element.children(".ogx_tree_item_container:first").css("display","block")),!0}return!1},this.selectItemByPropVal=function(e,t){var i=function(e,t){function i(i,n){return!(!i.data.hasOwnProperty(e)||i.data[e]!==t)&&n+"/"+i.label}return G(i)}(e,t);return!!i&&(m(),function(e){var t=O(e);t&&(s=e,t.children(".ogx_tree_item_icon:first").addClass("ogx_tree_selected_item"))}(i._id_),!0)},this.selectItemByPath=function(e){var t=b(e);return!!t&&(m(),t.addClass("ogx_tree_selected_item"),s=t.data("id"),!0)},this.updateSelectedItemDataProperty=function(e,t){return!!s&&(x(s).data[e]=t,!0)},this.updateSelectedItemData=function(e){return!!s&&(x(s).data=e,!0)},this.updateSelectedItemLabel=function(e){if(s){var t=x(s);return t.label=e,O(t._id_).children(".ogx_tree_item_label:first").html(e),!0}return!1},this.deleteItemByPath=function(e){var t=b(e);return!!t&&v(t.data("id"))},this.deleteSelectedItem=function(){return function(){function e(e,t,i,n){if(e._id_===s)return e.element.remove(),i.items.splice(n,1),p(i),!0}if(s)return G(e);return!1}()},this.getSelectedItem=function(){return function(){if(s)return x(s);return!1}()},this.getTree=function(){var e=G(_,JSON.parse(JSON.stringify(d.data)));if(e)return e},this.setData=function(e){e.hasOwnProperty("types")&&this.setTypes(e.types),e.hasOwnProperty("tree")&&this.setTree(e.tree)},this.setTypes=function(e){d.types=e},this.setTree=function(e){d.data=e,d.data.hasOwnProperty("state")||(d.data.state="open"),w(),f()},this.newTree=function(){l=1,d.data={_id_:l,type:"root",state:"open",label:d.root_label,element:null,items:[]},h()},this.filterTree=function(e){!function(e){var t=[];function i(n,a,o,r){if(-1!==(a+n.label).indexOf(e)&&t.push(a+"/"+n.label),n.hasOwnProperty("items")&&n.items.length)for(var s=0;s<n.items.length;s++)i(n.items[s],a+"/"+n.label,n,s)}i(d.data,"")}(e)},function(){if(OGX.Data.merge(d,u),c.el=t=$(d.el),t.addClass("ogx_tree"),t.attr("data-ogx-id",c.id),Array.isArray(d.data)){var e=JSON.stringify(d.data);d.data={type:"root",label:d.root_label,items:JSON.parse(e)}}}(),w(),d.data&&f()},OGX.Tree.NAME="Tree",OGX.Tree.SELECT="TreeSelect",OGX.Tree.UNSELECT="TreeUnselect",OGX.Tree.OPEN="TreeOpen",OGX.Tree.CLOSE="TreeClose",OGX.Tree.DRAG="TreeDrag",OGX.Tree.DROP="TreeDrop",require("TreedList","Uxi"),OGX.TreedList=function(e){construct(this,"TreedList");var t=this,i={renderer:"Tree",list:new OGX.List,types:null,display:null,displays:null,group_by:null,group_mode:null,group_param:null},n=e,a=null,o=null;function r(){switch(s(n.list),n.renderer){case OGX.Tree.NAME:i={el:n.el,data:undefined},n.types&&(i.types=n.types),i.tree=function(){var e={type:"root",label:"root",state:"open",items:[]};function t(e,i){if(Array.isArray(e)){for(var n=0;n<e.length;n++)e[n].type="file";i.items=e}else for(var a in e)i.items.push({type:"folder",label:a,state:"open",items:[]}),t(e[a],i.items[i.items.length-1])}return t(a,e),e}(),o=t.create(n.renderer,i);break;case OGX.StackedTree.NAME:(i=function(){var e={display:!1,displays:!1};n.display&&n.display.hasOwnProperty("bind")?(e.display=OGX.Data.clone(n.display),e.displays=OGX.Data.clone(n.displays)):(e.display={bind:"__type"},e.displays={__default:OGX.Data.clone(n.display)},"object"==typeof e.displays.__default.css?e.displays.__default.css.hasOwnProperty("add")?e.displays.__default.css.add+=" ogx_stacked_tree_item":e.displays.__default.css.add="ogx_stacked_tree_item":e.displays.__default.css={add:e.displays.__default.css+" ogx_stacked_tree_item"});for(var t=0;t<n.group_by.length;t++)grp=n.group_by[t],e.displays[grp]={html:"{{$label}}",css:"ogx_stacked_tree_item"};return e}()).el=n.el;var e=function(){var e={data:[]};function t(e,i,a,o){var r;if(Array.isArray(e)){for(var s=0;s<e.length;s++)e[s].hasOwnProperty("scope")||(e[s].scope=["public"]);i.items=e}else for(var l in e)r={label:l,__type:n.group_by[o],scope:["public"],items:[]},a?(i.data.push(r),t(e[l],i.data[i.data.length-1],!1,o+1)):(i.items.push(r),t(e[l],i.items[i.items.length-1],!1,o+1))}return t(a,e,!0,0),e}();i.list=e.data,n.hasOwnProperty("id")&&(i.id=n.id+"_stacked"),o=t.create(n.renderer,i);break;case OGX.RouletteTree.NAME:var i;(i=OGX.Data.clone(n)).hasOwnProperty("id")&&(i.id=i.id+"_roultree"),i.data=a;for(var r=[],l=0;l<n.group_by.length;l++)r.push(n.group_by[l].split(".").pop());i.groups=r,o=t.create(n.renderer,i)}}function s(e,t,i,o){n.list=e,void 0!==t&&(n.group_by=t),void 0!==i&&(n.group_mode=i),void 0!==o&&(n.group_param=o),a=n.list.group(n.group_by,n.group_mode,n.group_param)}this._NAME_=OGX.TreedList.NAME,this.el=null,this.val=function(e,t,i,n){return void 0!==e?(s(e),a):a},this.getRenderer=function(){return o},this.getTree=function(){return a},n&&void 0!==n||(n={}),OGX.Data.merge(n,i),n.list.hasOwnProperty("insert")||(n.list=new OGX.List(n.list)),$(n.el).addClass("ogx_treedlist"),r()},OGX.TreedList.NAME="TreedList",require("Uxi","Overlay","Loading"),OGX.Uxi=function(e){construct(this,"Uxi"),this.el=null,this.id=null,this.sleeping=!1,this.blured=!0,this.floating=!1,this.scroll=!1,this.scroller=null,this.enabled=!1,this.always_on=!1,this.nodes=new OGX.List,this.points={},this.observer=!1,this.parent=null,this.floats=null,this.group=null,this.always_on=null,this.scroll=null,this.selector=null,this.title=null,config_default={id:(new Date).getTime()+""+Math.round(1e3*Math.random()),title:"",enabled:!0,always_on:!1,scroll:!1,el:!1,css:""},void 0===e&&(e={}),OGX.Data.merge(e,config_default,!1),OGX.Data.merge(this,e,!0,!1,!0);var t="#"===this.id.substr(0,1);if(t&&(this.id=this.id.substr(1)),this.selector='.ogx_uxi[data-ogx-id="'+this.id+'"]',e.el){var i=$(e.el),n="ogx_uxi "+e.css,a='<div class="'+n+'" data-ogx-id="'+this.id+'"';if(t&&(a+=' id="'+this.id+'"'),a+="></div>",e.scroll){this.scroller=this.create("Scroller",{id:this.id+"_scroller",el:e.el}),e.el='.ogx_uxi[data-ogx-id="'+this.id+'_scroller"] > .ogx_scroller_inner',(i=$(e.el)).addClass(n).attr("data-ogx-id",this.id),t&&i.attr("id",this.id);var o=this;setTimeout((function(){o.scroller.resize()}),0)}else i.append(a),e.el='.ogx_uxi[data-ogx-id="'+this.id+'"]'}},OGX.Uxi.prototype.enable=function(){},OGX.Uxi.prototype.disable=function(){},OGX.Uxi.prototype.ux=function(){},OGX.Uxi.prototype.construct=function(){},OGX.Uxi.prototype.destroy=function(){},OGX.Uxi.prototype.resize=function(){},OGX.Uxi.prototype.show=function(){this.el&&this.el.removeClass("ogx_uxi_hide")},OGX.Uxi.prototype.hide=function(){this.el&&this.el.addClass("ogx_uxi_hide")},OGX.Uxi.prototype.render=function(e,t){OGX.OML.render(this,e,t)},OGX.Uxi.prototype.empty=function(){this.clear()},OGX.Uxi.prototype.observe=function(e,t,i,n,a){var o=this,r=this.el,s=null;if(void 0!==a&&(r=a),e){if(!this.observer)return void 0===t&&(t={childList:!0,subtree:!0}),this.observer=new MutationObserver((function(e,t){e.forEach((function(e){s&&clearTimeout(s),s=setTimeout((()=>{void 0!==i?i(e,n):o.el.trigger(OGX.View.CHANGED,e)}),10)}))})),this.observer.observe(r[0],t),!0}else if(this.observer)return this.observer.disconnect(),this.observer=null,!0;return!1},OGX.Uxi.prototype.sleep=function(){this.sleeping||(this.blur(2),this.sleeping=!0,this.scroll?(this.__parent=this.el.parent(".ogx_scroller_outer:first").parent(0),this.el=this.__parent.children(".ogx_scroller_outer:first").detach()):(this.__parent=this.el.parent(0),this.el=this.el.detach()))},OGX.Uxi.prototype.wake=function(e){e=void 0===e?this.__parent:$(e),this.sleeping&&(this.sleeping=!1,e.prepend(this.el),this.el=e.find('.ogx_uxi[data-ogx-id="'+this.id+'"]'),this.focus(2),delete this.__parent)},OGX.Uxi.prototype.detach=function(){this.sleep(),this.parent.nodes.findDelete("id",this.id,1)},OGX.Uxi.prototype.attach=function(e,t){this.parent=e,this.parent.nodes.insert(this),this.wake(t),setTimeout((()=>this.resizeNodes),0)},OGX.Uxi.prototype.resizeNodes=function(){for(var e=this.gather(),t=0;t<e.length;t++)e[t].resize()},OGX.Uxi.prototype.kill=function(){OGX.Object.destroy(this)},OGX.Uxi.prototype.reveal=function(e){var t=this.path();if(t){for(var i=0;i<t.length;i++)i>0&&t[i]._NAME_===OGX.Carousel.NAME&&t[i-1]._NAME_===OGX.Container.NAME||(t[i].floating?t[i].show(e):t[i].show(this._NAME_,this.id));return!0}},OGX.Uxi.prototype.focus=function(e){if(void 0===e&&(e=1),this.blured)switch(this.blured=!1,this.enabled&&(this.ux(!0),this.enable()),e){case 1:this.focusNodes();break;case 2:this.focusTree()}},OGX.Uxi.prototype.focusTree=function(){for(var e=this.gather(),t=0;t<e.length;t++)"function"==typeof e[t].focus&&e[t].focus(0)},OGX.Uxi.prototype.focusNodes=function(){for(var e=0;e<this.nodes.length;e++)"function"==typeof this.nodes[e].focus&&this.nodes[e].focus(1)},OGX.Uxi.prototype.blur=function(e){if(void 0===e&&(e=1),!this.always_on&&!this.blured)switch(this.blured=!0,this.ux(!1),this.disable(),e){case 1:this.blurNodes();break;case 2:this.blurTree()}},OGX.Uxi.prototype.blurTree=function(){for(var e=this.gather(),t=0;t<e.length;t++)"function"==typeof e[t].blur&&e[t].blur(0)},OGX.Uxi.prototype.blurNodes=function(){for(var e=0;e<this.nodes.length;e++)"function"==typeof this.nodes[e].blur&&this.nodes[e].blur(1)},OGX.Uxi.prototype.path=function(){for(var e=new OGX.List,t=this;t&&t.hasOwnProperty("parent");)e.insert(t,0),t=t.parent;return e.shift(),e},OGX.Uxi.prototype.gather=function(e){var t=[],i={_NAME_:{eq:""}};return void 0!==e&&(Array.isArray(e)?i={_NAME_:{regex:new RegExp(e.join("|"))}}:-1!==e.indexOf(".")?(comp=e.split("."),i={_NAME_:{regex:new RegExp(comp[0].slice(0,-1))},_CLASS_:{eq:comp[1]}}):i={_NAME_:{regex:new RegExp(e)}}),function e(n){if(void 0!==n&&void 0!==n.nodes&&n.nodes.length){var a=n.nodes.get(i);a&&(t=t.concat(a));for(var o=0;o<n.nodes.length;o++)void 0!==n.nodes[o]&&void 0!==n.nodes[o].nodes&&n.nodes[o].nodes.length&&(a=e(n.nodes[o]))&&a.length&&(t=t.concat(a[0]))}}(this),new OGX.List(t)},OGX.Uxi.prototype.cfind=function(e,t,i){var n;n=t instanceof RegExp?{id:{regex:t}}:{id:{eq:t}},e&&(n._NAME_={eq:e}),void 0===i&&(i=1);var a=OGX.Object.get(n,null,i);return(1===i||!!a.length)&&a},OGX.Uxi.prototype.find=function(e,t,i){void 0===i&&(i=!1);var n={};if(typeof t==typeof e==="undefined")return!1;return void 0!==t&&(t instanceof RegExp?n.id={regex:t}:n.id={eq:t}),void 0!==e&&(n._NAME_={eq:e}),function e(t){var a;if(void 0!==t.nodes&&t.nodes.length){if(a=t.nodes.get(n,null,1)){if(i)switch(i){case"remove":return a.kill(),a}return a}for(var o=0;o<t.nodes.length;o++)if(a=e(t.nodes[o]))return a}return!1}(this)},OGX.Uxi.prototype.clear=function(){for(var e=this.gather(),t=0;t<e.length;t++)OGX.Object.destroy(e[t],!1);return this.nodes=new OGX.List,!0},OGX.Uxi.prototype.add=function(e){e.parent=this,this.nodes.insert(e)},OGX.Uxi.prototype.remove=function(e,t){return this.find(e,t,"remove")},OGX.Uxi.prototype.create=function(e,t){"undefined"==typeof __construct&&(__construct=!0);var i=Array.prototype.slice.call(arguments),n=[];t.hasOwnProperty("data")&&n.push(t.data),n=n.concat(i.splice(0,3)),void 0!==OGX[e]&&OGX[e].hasOwnProperty("FLOAT")&&OGX[e].FLOAT&&(t.parent=this,t.el=this.el[0]);var a=OGX.Object.create(e,t);return this.add(a),"function"==typeof a.construct&&a.construct.apply(a,n),t.hasOwnProperty("node:OML")&&OGX.OML.render(a,t["node:OML"]),a.focus(),a},OGX.Uxi.prototype.parse=function(e){e=OGX.OML.parse(e),OGX.OML.render(this,e)},OGX.Uxi.prototype.topIndex=function(){var e,t=0;return this.el.find("*").each((function(i,n){e=$(n).css("z-index"),e=Number(e),isNaN(e)||e>t&&(t=e)})),t+1},OGX.Uxi.prototype.stage=function(){return function e(t){if(t.parent)return t.parent._NAME_!==OGX.Stage.NAME?e(t.parent):t.parent}(this)},OGX.Uxi.prototype.on=function(){this.el&&this.el.on.apply(this.el,arguments)},OGX.Uxi.prototype.off=function(){this.el&&this.el.off.apply(this.el,arguments)},require("View","Uxi","Placeholder","Touch"),OGX.View=function(e){construct(this,"View");var t=this,i=!1,n=e;this.el=null,this._CLASS_=e._sub_,this._NAME_=OGX.View.NAME,delete e._sub_,this.enable=function(){n.observe&&this.observe(!0)},this.disable=function(){n.observe&&this.observe(!1)},this.container=function(){return i},this.render=function(e){void 0===e?n.hasOwnProperty("html")&&n.html&&i.html(n.html):i.html(e),i.trigger(OGX.View.RENDER)},function(){t.el=i=$(n.el);var a=new OGX.Display(e);n.html=a.html(e.data),i.addClass("ogx_view ogx_hw"),t.render()}()},OGX.View.NAME="View",OGX.View.CHANGED="ViewChanged",OGX.View.RENDER="ViewRender",require("Window","Uxi","Placeholder","Touch","Resize"),OGX.Window=function(__config){construct(this,"Window");var that=this,container=!1,config_default={anim:!1,resize:!1,drag:!0,show:!1,width:"100%",height:"100%",min_width:100,min_height:100,max_width:0,max_height:0,head:OGX.Window.HEAD_BACK,icons:[],title:"",win_html:'<div class="ogx_window_head ogx_window_head_{{$head}} ogx_window_head_{{$side}}">$INNER</div><div class="ogx_window_body">{{$html}}</div>',win_inner:['<span class="ogx_window_main_{{$head}} ogx_window_main_icon"></span>','<span class="ogx_window_title">{{$title}}</span>','<span class="ogx_window_icons">$ICONS</span>'],zindex:!1,close_on_click_out:!1,close_dist:100,parent:null},config=__config,pt={x:null,y:null},dir={x:0,y:0},showto=50,user_resized=!1,zd;function genIcons(){for(var e="",t=0;t<config.icons.length;t++)e+='<div class="ogx_window_icon" style="background-image:url(\''+("string"==typeof config.icons[t]?config.icons[t]:config.icons[t].icon)+"')\"></div>";return e}function listenBackIcon(e){e?that.el.on(that.touch.down,".ogx_window_main_back",onBack):that.el.off(that.touch.down,".ogx_window_main_back",onBack)}function onBack(e){e.preventDefault(),e.stopImmediatePropagation(),that.el.trigger(OGX.Window.HIT_BACK,that),that.hide()}function listenIcons(e){e?that.el.on(that.touch.down,".ogx_window_icon",onIcon):that.el.off(that.touch.down,".ogx_window_icon",onIcon)}function onIcon(e){e.preventDefault(),e.stopImmediatePropagation();var t=$(this).index();if("string"==typeof config.icons[t])that.el.trigger(OGX.Window.HIT_ICON,{index:t,id:config.id});else{var i=t;config.icons[t].hasOwnProperty("callback")&&config.icons[t].callback&&(config.icons[t].hasOwnProperty("params")&&(i=config.icons[t].params),config.icons[t].callback.call(null,i))}}function onDrag(e){(e.distX*dir.x>config.close_dist||e.distY*dir.y>config.close_dist)&&that.hide()}function onRelease(e){e.distX*dir.x>config.close_dist||e.distY*dir.y>config.close_dist?that.hide():(e.distX||e.distY)&&(config.anim&&(that.el.addClass("ogx_window_anim_in"),that.el.on("transitionend",(function(){that.el.off("transitionend"),that.el.removeClass("ogx_window_anim_in")}))),that.el.css("transform","translate3d("+pt.x+"px, "+pt.y+"px, 0px)"))}function render(){var e=prepWindow();container.html(e),zd=config.zindex?config.zindex:config.parent.topIndex();var t=getLimitedSize();container.css({width:t.width,height:t.height,"z-index":zd})}function getLimitedSize(){var e,t,i,n=config.parent.el.width(),a=config.parent.el.height();user_resized?(n=config.width,a=config.height):(e=OGX.Data.getBestSize(n,config.width),t=OGX.Data.getBestSize(a,config.height));var o={width:e,height:t};return(config.min_width||config.max_width)&&(-1!==config.width.indexOf("%")?(n=config.parent.el.width(),i=Number(config.width.split("%")[0])*n/100,config.min_width&&i<config.min_width?o.width=config.min_width+"px":config.max_width&&i>config.max_width&&(o.width=config.max_width+"px")):(-1!==(i=config.width).indexOf("px")&&(i=Number(i.split("px")[0])),config.min_width&&i<config.min_width?o.width=config.min_width+"px":config.max_width&&i>config.max_width&&(o.width=config.max_width+"px"))),(config.min_height||config.max_height)&&(-1!==config.height.indexOf("%")?(a=config.parent.el.height(),i=Number(config.height.split("%")[0])*a/100,config.min_height&&i<config.min_height?o.height=config.min_height+"px":config.max_height&&i>config.max_height&&(o.height=config.max_height+"px")):(-1!==(i=config.height).indexOf("px")&&(i=Number(i.split("px")[0])),config.min_height&&i<config.min_height?o.height=config.min_height+"px":config.max_height&&i>config.max_height&&(o.height=config.max_height+"px"))),o}function listenBody(e){e?that.parent.el.on(that.touch.down,".ogx_overlay",onBody):that.parent.el.off(that.touch.down,".ogx_overlay",onBody)}function onBody(e){that.status===OGX.Window.OPEN&&(that.hide(),that.parent.removeOverlay(OGX.Overlay.Fade))}function animWindow(e,t,i,n){void 0===t&&(t=config.anim);var a={opac:1,tX:0,tY:0},o=container.parent().width(),r=container.parent().height(),s=that.el.outerWidth(),l=that.el.outerHeight(),c=that.el.find(".ogx_window_main_icon:first");switch(e&&(placeWindow(!0),c.removeClass("ogx_window_main_icon_left ogx_window_main_icon_right ogx_window_main_icon_top")),t){case OGX.Window.ANIM_NONE:break;case OGX.Window.ANIM_TOP:e?(a.tY=0,c.addClass("ogx_window_main_icon_top")):a.tY=-l-10;break;case OGX.Window.ANIM_BOTTOM:e?(a.tY=0,c.addClass("ogx_window_main_icon_bottom")):a.tY=r+10;break;case OGX.Window.ANIM_RIGHT:e?(a.tX=o-s,c.addClass("ogx_window_main_icon_right")):a.tX=o+10;break;case OGX.Window.ANIM_LEFT:e?(a.tX=0,c.addClass("ogx_window_main_icon_left")):a.tX=-s-10}var d=100;e?(pt.x=a.tX,pt.y=a.tY):d=0,setTimeout((function(){dir.x,that.el.on("transitionend",(function(){that.el.off("transitionend"),e?that.el.removeClass("ogx_window_anim_in").addClass("ogx_window_open"):that.el.removeClass("ogx_window_anim_out ogx_window_open"),"function"==typeof i&&i(n),e?(that.status=OGX.Window.OPEN,that.el.trigger(OGX.Window.OPEN,that)):(that.status=OGX.Window.CLOSED,that.el.trigger(OGX.Window.CLOSED,that))})),e?(that.status=OGX.Window.OPENING,that.el.trigger(OGX.Window.OPENING,that)):(that.status=OGX.Window.CLOSING,that.el.trigger(OGX.Window.CLOSING,that)),config.anim!==OGX.Window.ANIM_NONE&&(e?that.el.addClass("ogx_window_anim_in"):that.el.addClass("ogx_window_anim_out")),that.el.css({transform:"translate3d("+a.tX+"px, "+a.tY+"px, 0px)",opacity:a.opac,visibility:"visible"})}),d)}function placeWindow(e){var t=container.parent().width(),i=container.parent().height(),n=that.el.outerHeight(),a=that.el.outerWidth();that.el.removeClass("ogx_window_anim_in").removeClass("ogx_window_anim_out");var o={x:0,y:0};switch(config.anim){case OGX.Window.ANIM_TOP:o.y=e?-n:n,dir.y=-1;break;case OGX.Window.ANIM_BOTTOM:o.y=e?i:i-n,dir.y=1;break;case OGX.Window.ANIM_RIGHT:o.x=e?t:t-a,dir.x=1;break;case OGX.Window.ANIM_LEFT:e&&(o.x=-a),dir.x=-1}that.el.css({transform:"translate3d("+o.x+"px, "+o.y+"px, 0px)"})}function prepWindow(){var e=new OGX.Display(config),t={};t.head=config.head,t.title=config.title,t.icons=config.icons,t.html=e.html();var i=config.win_html,n="";switch(config.anim){case OGX.Window.ANIM_RIGHT:case OGX.Window.ANIM_TOP:case OGX.Window.ANIM_BOTTOM:n=config.win_inner,t.side="right";break;case OGX.Window.ANIM_LEFT:n=config.win_inner.reverse(),t.side="left"}n=n.toString().replace(/>,</g,"><"),i=i.replace("$INNER",n);var a="";return config.icons&&config.icons.length&&(a=genIcons()),i=i.replace("$ICONS",a),OGX.Templater.make(i,t)}function onResize(){user_resized=!0,that.resizeNodes()}function listenScroll(e){e?(that.el.on(OGX.Scroller.START,(function(){that.disable()})),that.el.on(OGX.Scroller.END,(function(){that.enable()}))):(that.el.off(OGX.Scroller.START),that.el.off(OGX.Scroller.END))}function initPlaceholders(){that.placeholders(config,['.ogx_window[data-ogx-id="'+that.id+'"] > .ogx_window_body'])}function initDefaults(){OGX.Data.merge(config,app.getDefaults("windows")),OGX.Data.merge(config,config_default),-1!==config.head.indexOf(".")&&(config.head=eval(config.head)),-1!==config.anim.indexOf(".")&&(config.anim=eval(config.anim)),that.el=container=$(config.el),container.addClass("ogx_window"),that.dragable=config.drag,that.resizable=config.resize}function init(){if(initDefaults(),render(),initPlaceholders(),placeWindow(!0),config.drag){var e={},t={top:!1,bottom:!1,left:!1,right:!1,cb_resize:onResize};switch(t.min_width=config.min_width,t.min_height=config.min_width,t.max_width=config.max_width,t.max_height=config.max_height,e.cb_drag=onDrag,e.cb_up=onRelease,config.anim){case OGX.Window.ANIM_LEFT:e.x=!0,e.y=!1,e.limit_x={min:-300,max:0},t.right=!0;break;case OGX.Window.ANIM_RIGHT:e.x=!0,e.y=!1,e.limit_x={min:0,max:300},t.left=!0;break;case OGX.Window.ANIM_TOP:e.x=!1,e.y=!0,e.limit_y={min:-300,max:0},t.bottom=!0;break;case OGX.Window.ANIM_BOTTOM:e.x=!1,e.y=!0,e.limit_y={min:0,max:300},t.top=!0}that.touch.drag.set(e)}config.resize&&that.setResize(t),config.show&&that.show(),listenScroll(!0)}this.el=null,this._NAME_=OGX.Window.NAME,this.id=config.id,this.dragable=null,this.resizeable=null,this.status=OGX.Window.CLOSED,this.enable=function(){config.close_on_click_out&&listenBody(!0),config.head&&listenBackIcon(!0),config.icons&&listenIcons(!0),config.drag&&this.touch.enable(),config.resize&&this.enableResize()},this.disable=function(){config.close_on_click_out&&listenBody(!1),config.head&&listenBackIcon(!1),config.icons&&listenIcons(!1),config.drag&&this.touch.disable(),config.resize&&this.disableResize()},this.show=function(e,t,i){-1===[OGX.Window.OPEN,OGX.Window.OPENING].indexOf(this.status)&&(this.focus(1),this.front(),null==e&&(e=config.anim),setTimeout((function(){animWindow(!0,e,t,i)}),showto),showto&&(showto=0))},this.hide=function(e,t,i){-1===[OGX.Window.CLOSED,OGX.Window.CLOSING].indexOf(this.status)&&(this.blur(1),void 0!==e&&!0!==e||(e=config.anim),animWindow(!1,e,t,i))},this.resize=function(){var e=getLimitedSize();container.css({width:e.width,height:e.height}),this.place()},this.destroy=function(){config.drag&&this.touch.disable(),listenScroll(!1)},this.icons=function(e){if(void 0===e)return config.icons;config.icons&&config.icons.length&&listenIcons(!1),config.icons=e,this.el.find(".ogx_window_icons:first").html(genIcons()),listenIcons(!0)},this.front=function(){return zd=config.parent.topIndex(),this.el.css("z-index",zd),this},this.place=function(){placeWindow(this.status===OGX.Window.CLOSED)},this.drag=function(e){e?config.drag||(this.touch.enable(),config.drag=this.dragable=!0):config.drag&&(this.touch.disable(),config.drag=this.dragable=!1)},init()},OGX.Window.NAME="Window",OGX.Window.READY="WindowReady",OGX.Window.ANIM_LEFT="left",OGX.Window.ANIM_RIGHT="right",OGX.Window.ANIM_TOP="top",OGX.Window.ANIM_BOTTOM="bottom",OGX.Window.ANIM_NONE="none",OGX.Window.HEAD_BACK="back",OGX.Window.HEAD_CLOSE="close",OGX.Window.HEAD_NONE="none",OGX.Window.CLOSING="WindowClosing",OGX.Window.CLOSED="WindowClosed",OGX.Window.OPENING="WindowOpening",OGX.Window.OPEN="WindowOpen",OGX.Window.HIT_ICON="WindowHitIcon",OGX.Window.HIT_BACK="WindowHitBack",OGX.Window.FLOAT=!0,String.prototype.hasOwnProperty("substr")||(String.prototype.substr=function(e,t){return e<0&&(e=this.length-e),this.slice(e,e+t)});
|
|
1
|
+
/* globules.io OGX.JS 1.16.0.32 */
|
|
2
|
+
window.console||(window.console={});for(var methods=["log","debug","warn","info"],i=0;i<methods.length;i++)console[methods[i]]=function(){};if(void 0===OGX)var OGX={};if(OGX.Data={},OGX.Data.weld=function(t,e,r,i){void 0===r&&(r=!1),void 0===i&&(i=!1);var a=t;return i&&(a=JSON.parse(JSON.stringify(t))),function t(e,i){for(var a in i)!e.hasOwnProperty(a)||r?e[a]=i[a]:"object"==typeof i[a]&&t(e[a],i[a])}(a,e),a},OGX.Data.merge=function(t,e,r,i,a){for(var s in void 0===r&&(r=!1),void 0===i&&(i=!1),void 0===a&&(a=!1),i&&(t=JSON.parse(JSON.stringify(t))),e)r?a?t.hasOwnProperty(s)&&(t[s]=e[s]):t[s]=e[s]:t.hasOwnProperty(s)||a||(t[s]=e[s]);return t},OGX.Data.diff=function(t,e,r){void 0===r&&(r=!1);var i={},a=!1;for(var s in e)(!r&&!t.hasOwnProperty(s)||r&&t.hasOwnProperty(s)&&t[s]!==e[s])&&(i[s]=e[s],a=!0);return!!a&&i},OGX.Data.props=function(t,e){for(var r in e)if(!t.hasOwnProperty(e[r]))return!1;return!0},OGX.Data.clone=function(t){return JSON.parse(JSON.stringify(t))},OGX.Data.isOML=function(t){for(var e in t)if(-1!==e.indexOf(":"))return!0;return!1},OGX.Data.stringToVal=function(t){if("string"!=typeof t)return t;var e=-1;return"true"===t&&(e=!0),"false"===t&&(e=!1),-1!==e?e:t.match(/^([0-9]+(\.[0-9]+)?)$/g)?Number(t):t.match(/^(\[|{)/g)?JSON.parse(t):t},OGX.Data.pad=function(t,e,r,i){void 0===i&&(i="0"),void 0===r&&(r=-1);for(var a=String(t);a.length<e;)-1===r?a=i+a:a+=i;return a},OGX.Data.addDec=function(t){return parseFloat(Math.round(100*t)/100).toFixed(2)},OGX.Data.isInt=function(t){return Number(t)===t&&t%1==0},OGX.Data.isFloat=function(t){return Number(t)===t&&t%1!=0},OGX.Data.dateToLocale=function(t,e){return"string"==typeof t&&(t=new Date(t+" ")),void 0===e&&(e={}),OGX.Data.merge(e,{weekday:"long",year:"numeric",month:"long",day:"numeric"}),t.toLocaleDateString(navigator.language,e)},OGX.Data.eval=function(__obj,__path,__value){void 0===__value&&(__value=null);var str="__obj."+__path,res;__value&&(str+=" = "+JSON.stringify(__value));try{res=eval(str)}catch(t){}return res},OGX.Data.getBestSize=function(t,e,r,i){if(void 0===r&&(r=10),void 0===i&&(i=200),"string"==typeof e){if(-1!==e.indexOf("|")){var a=e.substr(e.length-1,1);["+","-"].includes(a)?e=e.substr(0,e.length-1):a="+",a="+"===a?1:-1;for(var s,n=e.split("|"),o=new OGX.List,f=0;f<n.length;f++)-1!==(s=n[f]).indexOf("px")&&(s=s.replace("px","")),-1!==s.indexOf("%")&&(s=Math.round(Number(s.split("%")[0])*t/100)),s<=t&&o.insert({m:t-s,s:n[f],n:s});return o.order("m",a),"100%"===o[0].s&&o.length>1&&o[1].m<i?o[1].s:o[0].s}(m=/(\d+)(%|px)?/gi.exec(e))&&("%"===m[2].trim()?e=Math.round(Number(m[1])*t/100):("px"===m[2].trim()&&(e=m[1]),e=Number(e)))}return e},OGX.Data.same=function(t,e,r){void 0===r&&(r=!0);var i,a=0,s=0;for(i in t)a++;for(i in e)s++;if(a!==s)return!1;if(typeof t!=typeof e)return!1;if(!["object","array"].includes(typeof t))return t===e;return function t(e,a){for(i in e){if(typeof e[i]!=typeof a[i])return!1;if(r&&"object"==typeof e[i]&&a.hasOwnProperty(i)){if(!t(e[i],a[i]))return!1}else if("array"==typeof e[i]){if(e[i].length!==a[i].length)return!1;if(e[i].sort(),a[i].sort(),r){for(var s=0;s<e[i].length;s++)if(!t(e[i][s],a[i][s]))return!1}else if(JSON.parse(JSON.stringify(e[i]))!==JSON.parse(JSON.stringify(__b[i])))return!1}else if(e[i]!==a[i])return!1}return!0}(t,e)},OGX.Data.clipboard=function(t){if(void 0!==t)if(void 0!==navigator.clipboard)navigator.clipboard.writeText(t);else{var e=document.createElement("textarea");e.value=t,e.style.top="-1000px",e.style.left="0",e.style.position="fixed",document.body.appendChild(e),e.trigger("focus"),e.select();try{document.execCommand("copy")}catch(t){}document.body.removeChild(e)}},void 0===OGX)var OGX={};OGX.List=function(){var filteringMode="and",filterCount=0,indexes=!1;1===arguments.length&&arguments[0]instanceof Array&&(arguments=arguments[0]);var array=Object.create(Array.prototype);for(var method in array=Array.apply(array,arguments)||array,OGX.List.prototype)OGX.List.prototype.hasOwnProperty(method)&&(array[method]=OGX.List.prototype[method]);function addToCache(t){var e;for(var r in indexes){if(-1!==r.indexOf("|")){r=r.split("|"),e=[];for(var i=0;i<r.length;i++)t.hasOwnProperty(r[i])&&e.push(t[r[i]]);e=e.join("|"),r=r.join("|")}else t.hasOwnProperty(r)&&(e=t[r]);indexes.hasOwnProperty(r)||(indexes[r]={}),indexes[r][e]=t}}function matchesCache(t){var e,r=[],i=[];for(var a in indexes){e=!0,r=-1!==a.indexOf("|")?a.split("|"):[a];for(var s=0;s<r.length;s++)if(!t.hasOwnProperty(r[s])){e=!1;break}e&&i.push(a)}return!!i.length&&i}function dynamicSort(t,e){return function(r,i){return r[t]<i[t]?-1*e:r[t]>i[t]?e:0}}function extract(__item,__by,__mode,__param){var data;try{data=eval("__item."+__by)}catch(t){}if(data)switch(__mode){case"substr":return data=data.substr(__param[0],__param[1]),data;case"numrange":return data=Number(data),Array.isArray(__param)?(data=Math.floor(data/__param[0]),data="pre"===__param[2]?__param[1]+data*__param[0]+" - "+__param[1]+(data+1)*__param[0]:data*__param[0]+__param[1]+" - "+(data+1)*__param[0]+__param[1]):(data=Math.floor(data/__param),data=data*__param+" - "+(data+1)*__param),data;case"date":if(!Array.isArray(__param)){if("year"===__param)return data=data.substr(0,4),data;if("month"===__param)return data=data.substr(0,7),data;if("week"===__param)return data=data.substr(0,4)+" week "+moment(data).week(),data}return data=moment(data).unix(),data=Math.floor(data/(60*__param[0]*60*24)),data*=60*__param[0]*60*24,data=moment(1e3*data).format(__param[1])+" - "+moment(1e3*data+1e3*__param[0]*60*60*24).format(__param[1]),data;default:return data}return!1}return array.insert=function(t,e){return void 0===e?array.push(t):array.splice(e,0,t),indexes&&addToCache(t),!0},array.delete=function(t){var e=this,r=array.splice(t,1);if(r.length){if(indexes){var i=matchesCache(r[0]);i&&setTimeout((function(){e.rebuild(i)}),0)}return r[0]}return!1},array.last=function(){if(this.length)return this[this.length-1]},array.findDelete=function(__property,__value,__limit){var t=0;void 0===__limit&&(__limit=0);for(var removed=new OGX.List,ev,prop,i=0;i<this.length;i++){prop=null,ev="this["+i+"]."+__property;try{prop=eval(ev)}catch(t){}if(null==prop);else if(prop===__value){if(removed.push(this.splice(i,1)[0]),indexes){var idxs=matchesCache(removed.last());idxs&&this.rebuild(idxs)}if(t++,__limit>0&&__limit===t)return 1===__limit?removed[0]:removed;i--}}return removed},array.findReplace=function(__property,__value,__object,__limit){var t=0;void 0===__limit&&(__limit=0);for(var replaced=new OGX.List,ev,prop,i=0;i<this.length;i++){prop=null,ev="this["+i+"]."+__property;try{prop=eval(ev)}catch(t){}if(null==prop);else if(prop===__value&&(replaced.push(this[i]),t++,this[i]=__object,__limit>0&&__limit===t))return 1===__limit?replaced[0]:replaced}return!!replaced.length&&replaced},array.findUpdate=function(__property,__value,__object,__strict,__limit){var t=0;void 0===__strict&&(__strict=!1),void 0===__limit&&(__limit=0);for(var updated=new OGX.List,upd,ev,prop,i=0;i<this.length;i++){prop=null,ev="this["+i+"]."+__property;try{prop=eval(ev)}catch(t){}if(null==prop);else if(prop===__value){for(var a in upd=!1,__object)__strict?this[i].hasOwnProperty(a)&&(this[i][a]=__object[a],upd=!0):(this[i][a]=__object[a],upd=!0);if(upd&&(t++,updated.push(this[i]),__limit>0&&__limit===t))return 1===__limit?updated[0]:updated}}return!!updated.length&&updated},array.findIndex=function(__property,__value){var isReg=!1,ev,prop;__value instanceof RegExp&&(isReg=!0);for(var i=0;i<this.length;i++){prop=null,ev="this["+i+"]."+__property;try{prop=eval(ev)}catch(t){}if(null!==prop)if(isReg){if(prop.match(__value))return{index:i}}else if(prop===__value)return{index:i}}return!1},array.find=function(t,e,r){var i=0,a=new OGX.List,s=!1;e instanceof RegExp&&(s=!0),void 0===r&&(r=0);for(var n=0;n<this.length;n++)if(s?this[n][t].match(e)&&(a.push(this[n]),i++):this[n][t]===e&&(a.push(this[n]),i++),r>0&&i===r)return 1===r?a[0]:a;return!!a.length&&a},array.swap=function(t,e){var r=this[t];this[t]=this[e],this[e]=r},array.cache=function(){indexes||(indexes={});var t=[],e=[];if(arguments.length>1){for(var r=0;r<arguments.length;r++)t.push(arguments[r]);t=t.join("|")}else t=arguments[0];indexes.hasOwnProperty(t)||(indexes[t]={});for(var i=0;i<this.length;i++){e=[];for(r=0;r<arguments.length;r++)e.push(this[i][arguments[r]]);e=e.join("|"),indexes[t].hasOwnProperty(e)||(indexes[t][e]=[]),indexes[t][e].push(this[i])}return!0},array.uncache=function(t){if(!indexes)return!1;var e=t;return arguments.length>1&&(e=arguments.join("|")),!!indexes.hasOwnProperty(e)&&(delete indexes[e],!0)},array.deleteProperty=function(t){for(var e=0,r=0;r<this.length;r++)this[r].hasOwnProperty(t)&&(delete this[r][t],e++);return indexes&&this.rebuild(),e},array.rebuild=function(t){if(Array.isArray(t))for(var e=0;e<t.length;e++)delete indexes[t[e]],this.cache(t[e]);else if(indexes)for(var r in indexes)delete indexes[r],this.cache.apply(this,r.split("|"))},array.read=function(t,e,r){var i,a,s=arguments;if(!indexes)return!1;if(!s.length)return indexes;if("object"==typeof t){for(var n in r=s[1],i=[],a=[],t)i.push(n),a.push(t[n]);i=i.join("|"),a=a.join("|")}else i=t,a=e;return void 0===r&&(r=0),!(!indexes.hasOwnProperty(i)||!indexes[i].hasOwnProperty(a))&&(r?r>1?indexes[i][a].splice(0,r):indexes[i][a][0]:indexes[i][a])},array.clear=function(){indexes=!1,filterCount=0,this.length=0},array.unique=function(t,e,r){void 0===e&&(e=!0),void 0===r?r=[t]:Array.isArray(r)||(r=[r]);for(var i,a=this.get(),s=[],n=new OGX.List,o=0;o<a.length;o++)if(!s.includes(a[o][t])&&(s.push(a[o][t]),e)){i={};for(var f=0;f<r.length;f++)i[r[f]]=a[o][t];n.push(i)}return e?n:s},array.order=function(t,e){array.sort(dynamicSort(t,e))},array.group=function(t,e,r){if(Array.isArray(t))return array.groupm(t,e,r);for(var i,a={},s=0;s<this.length;s++)(i=extract(this[s],t,e,r))&&(i=i.split(".").pop(),a.hasOwnProperty(i)||(a[i]=new OGX.List),a[i].push(this[s]));return a},array.groupm=function(t,e,r){return function i(a,s){var n=new OGX.List(a),o=e,f=r;void 0!==e&&Array.isArray(e)&&(o=e[s]),void 0!==r&&Array.isArray(r)&&(f=r[s]);var h=n.group(t[s],o,f);if(s+1<=t.length-1)for(var l in h)h[l]=i(h[l],s+1);return h}(this,0)},array.filters={},array.addFilter=function(t,e,r){this.filters.hasOwnProperty(t)||(this.filters[t]=[]);var i={};return i[e]=r,this.filters[t].push(i),filterCount++,!0},array.removeFilter=function(t){return!!this.filters.hasOwnProperty(t)&&(filterCount-=this.filters[t].length,delete this.filters[t],!0)},array.getFilters=function(){return this.filters},array.resetFilters=function(){this.filters={},filterCount=0},array.setFilters=function(t){for(var e in this.resetFilters(),t)for(var r=0;r<t[e].length;r++)for(var i in t[e][r])array.addFilter(e,i,t[e][r][i])},array.setFilteringMode=function(t){filterMode=t},array.get=function(t,e,r,i,a){void 0===e&&(e=!1),void 0===r&&(r=!1),"number"==typeof r&&(i=r,r=!1),void 0===i&&(i=0),void 0===a&&(a=!1);var s=this.getFilters();for(var n in this.resetFilters(),t)for(var o in t[n])this.addFilter(n,o,t[n][o]);var f=this.filter(i,a);if(this.resetFilters(),this.setFilters(s),a)return f;if(1===i)return!!f.length&&f[0];if(e)for(var n in e){f.order(n,e[n]);break}return r?f.group.apply(null,r):f},array.unset=function(t,e){void 0===e&&(e=0);var r=new OGX.List,i=this.get(t,null,null,e,!0);if(i)for(var a=0;a<i.length;a++)r.push(this.delete(i[a]-r.length));return 1===e&&r.length?r[0]:r},array.update=function(t,e,r,i){void 0===r&&(r=!1),void 0===i&&(i=0);var a=this.get(t,null,i);if(a&&(Array.isArray(a)||(a=[itinerary]),a.length)){for(var s,n=[],o=0;o<a.length;o++)for(var f in e)r&&!a[o].hasOwnProperty(f)||(a[o][f]=e[f],(s=matchesCache(a[o]))&&-1===n.indexOf(s)&&n.push(s));return indexes&&n.length&&setTimeout((function(){that.rebuild(n)}),0),a}return[]},array.filter=function(__limit,__as_position){void 0===__limit&&(__limit=0),void 0===__as_position&&(__as_position=!1);for(var ar=[],positions=[],isDate,isString,isNum,isArray,isObject,hasFilters=!1,reg=/[0-9]{4}\-[0-9]{2}\-[0-9]{2}( [0-9]{2}\:[0-9]{2}\:[0-9]{2})?/g,isMatch=!1,matches=0,str,o,err,counter,total,i=0;i<this.length;i++)for(var a in isMatch=!0,matches=0,this.filters){err=!1,hasFilters=!0;try{o=null,str="this["+i+"]."+a,o=eval(str)}catch(t){err=!0}if(err||void 0===o)isMatch=!1;else{isDate=!1,isString=!1,isNum=!1,isArray=Array.isArray(o),isObject=!isArray&&"object"==typeof o,isArray?"string"==typeof o[0]?(isString=!0,o[0].match(reg)&&(isDate=!0)):isNum="number"==typeof o[0]:"string"==typeof o?(isString=!0,o.match(reg)&&(isDate=!0)):isNum="number"==typeof o;for(var j=0;j<this.filters[a].length;j++)for(var b in this.filters[a][j]){if(String(this.filters[a][j][b]).length)if("function"===b)isMatch=this.filters[a][j][b](o),isMatch&&matches++;else switch(b){case"eq":if(isDate){if("string"!=typeof this.filters[a][j][b]||!this.filters[a][j][b].match(reg)){isMatch=!1;break}moment(o).format("YYYY-MM-DD")!==moment(this.filters[a][j][b]).format("YYYY-MM-DD")?isMatch=!1:matches++}else if(isString){if("string"!=typeof this.filters[a][j][b]){isMatch=!1;break}o.toLowerCase()!==String(this.filters[a][j][b]).toLowerCase()?isMatch=!1:matches++}else o!==this.filters[a][j][b]?isMatch=!1:matches++;break;case"eqjson":JSON.stringify(o)!==JSON.stringify(this.filters[a][j][b])?isMatch=!1:matches++;break;case"neq":if(isDate){if("string"!=typeof this.filters[a][j][b]||!this.filters[a][j][b].match(reg)){isMatch=!0,matches++;break}moment(o).format("YYYY-MM-DD")===moment(this.filters[a][j][b]).format("YYYY-MM-DD")?isMatch=!1:matches++}else if(isString){if("string"!=typeof this.filters[a][j][b]){isMatch=!0,matches++;break}o.toLowerCase()===this.filters[a][j][b].toLowerCase()?isMatch=!1:matches++}else o===this.filters[a][j][b]?isMatch=!1:matches++;break;case"in":if((isString||isNum)&&Array.isArray(this.filters[a][j][b])){isMatch=!1;for(var k=0;k<this.filters[a][j][b].length;k++)if(isString){if(-1!==o.indexOf(this.filters[a][j][b][k])){isMatch=!0;break}}else if(isNum&&o===this.filters[a][j][b][k]){isMatch=!0;break}isMatch&&matches++}else if(isString||isNum)isArray?isString&&-1===o.indexOf(this.filters[a][j][b])||isNum&&o!==this.filters[a][j][b]?isMatch=!1:matches++:isString&&-1===o.toLowerCase().indexOf(this.filters[a][j][b].toLowerCase())||isNum&&o!==this.filters[a][j][b]?isMatch=!1:matches++;else if(isArray)-1===o.indexOf(this.filters[a][j][b])?isMatch=!1:matches++;else if(isObject){for(var p in counter=0,total=0,this.filters[a][j][b])total++,o.hasOwnProperty(p)&&-1!==String(o[p]).toLocaleLowerCase().indexOf(String(this.filters[a][j][b][p]).toLowerCase())&&counter++;isMatch=total===counter,isMatch&&matches++}break;case"nin":if(Array.isArray(this.filters[a][j][b])){for(var k=0;k<this.filters[a][j][b].length;k++)if(isString){if(-1!==o.indexOf(this.filters[a][j][b][k])){isMatch=!1;break}}else if(isNum&&o===this.filters[a][j][b][k]){isMatch=!1;break}isMatch&&matches++}else isString&&"string"==typeof this.filters[a][j][b]?-1!==o.toLowerCase().indexOf(this.filters[a][j][b].toLowerCase())&&(isMatch=!1):isNum?o===this.filters[a][j][b]&&(isMatch=!1):-1!==o.indexOf(this.filters[a][j][b])&&(isMatch=!1),isMatch&&matches++;break;case"gt":if(isDate){if("string"!=typeof this.filters[a][j][b]||!this.filters[a][j][b].match(reg)){isMatch=!1;break}moment(o).unix()<=moment(this.filters[a][j][b]).unix()?isMatch=!1:matches++}else{if("number"!=typeof this.filters[a][j][b]){isMatch=!1;break}o<=this.filters[a][j][b]?isMatch=!1:matches++}break;case"gte":if(isDate){if("string"!=typeof this.filters[a][j][b]||!this.filters[a][j][b].match(reg)){isMatch=!1;break}moment(o).unix()<moment(this.filters[a][j][b]).unix()?isMatch=!1:matches++}else{if("number"!=typeof this.filters[a][j][b]){isMatch=!1;break}o<this.filters[a][j][b]?isMatch=!1:matches++}break;case"lt":if(isDate){if("string"!=typeof this.filters[a][j][b]||!this.filters[a][j][b].match(reg)){isMatch=!1;break}moment(o).unix()>=moment(this.filters[a][j][b]).unix()?isMatch=!1:matches++}else{if("number"!=typeof this.filters[a][j][b]){isMatch=!1;break}o>=this.filters[a][j][b]?isMatch=!1:matches++}break;case"lte":if(isDate){if("string"!=typeof this.filters[a][j][b]||!this.filters[a][j][b].match(reg)){isMatch=!1;break}moment(o).unix()>moment(this.filters[a][j][b]).unix()?isMatch=!1:matches++}else{if("number"!=typeof this.filters[a][j][b]){isMatch=!1;break}o>this.filters[a][j][b]?isMatch=!1:matches++}break;case"btw":if(isDate){if("string"!=typeof this.filters[a][j][b]||!this.filters[a][j][b].match(reg)){isMatch=!1;break}moment(this.filters[a][j][b][0]).unix()>moment(o).unix()||moment(this.filters[a][j][b][1]).unix()<moment(o).unix()?isMatch=!1:matches++}else{if("number"!=typeof this.filters[a][j][b]){isMatch=!1;break}this.filters[a][j][b][0]>o||this.filters[a][j][b][1]<o?isMatch=!1:matches++}break;case"substr":o.toLowerCase().substr(this.filters[a][j][b][0],this.filters[a][j][b][1]).toLowerCase()!==this.filters[a][j][b][2].toLowerCase()?isMatch=!1:matches++;break;case"regex":o.toString().match(this.filters[a][j][b])?matches++:isMatch=!1}else matches++;if(!isMatch)break}}if("or"===filteringMode?isMatch&&(ar.push(this[i]),positions.push(i)):matches===filterCount&&(ar.push(this[i]),positions.push(i)),__limit&&ar.length===__limit)return __as_position?positions:OGX.List.apply(null,ar)}return __as_position?positions:hasFilters?OGX.List.apply(null,ar):array},array},OGX.Object=function(){"use strict";var t=new OGX.List,e=new OGX.List;function r(t){for(var e=t.split("."),r=OGX,i=0;i<e.length;i++)void 0!==r[e[i]]&&(r=r[e[i]]);return r}e.cache("_NAME_","id"),this.isRegistered=function(t,e){return typeof("undefined"!==this.register[t][e])},this.getExtend=function(e){var r=t.get({main:{eq:e}},null,1);return!!r&&r.extends},this.getExtends=function(e){var r=[],i=t.get({main:{eq:e}},null,1);if(i){var a;r=r.concat(i.extends);for(var s=0;s<i.extends.length;s++)(a=this.getExtends(i.extends[s]))&&(r=r.concat(a))}var n=[];for(s=0;s<r.length;s++)n.includes(r[s])||n.push(r[s]);return n},this.register=function(){var e=Array.prototype.slice.call(arguments),r=e.shift();t.push({main:r,extends:e})},this.create=function(t,i){void 0===i&&(i={});var a=this.getExtends(t),s=!1;if(a.length){var n=r(t);n.prototype=Object.create({});var o,f=[];f.push(n.prototype);for(var h=0;h<a.length;h++)void 0!==(o=r(a[h]))&&f.push(o.prototype);Object.assign.apply(null,f),n.prototype.constructor=n,(a.includes("View")||a.includes("Controller")||a.includes("Stage"))&&(i._sub_=t.split(".").pop()),s=new n(i)}else OGX.hasOwnProperty(t)&&(s=new OGX[t](i));return OGX.hasOwnProperty(t)&&OGX[t].hasOwnProperty("FLOAT")&&OGX[t].FLOAT&&(s.floating=!0),!!s&&(e.insert(s),s)},this.cache=function(t){if(void 0===t)return e;e.insert(t)},this.uncache=function(t){e.findDelete("id",t.id)},this.get=function(t,r,i){return e.get(t,r,i)},this.destroy=function(t,r){void 0===r&&(r=!0),t.blur(),"function"==typeof t.destroy&&t.destroy(),"function"==typeof t.__destroy&&t.__destroy(),r&&t.clear(),t.el&&t.el.remove(),t.parent&&t.parent.nodes.findDelete("id",t.id,1),e.findDelete("id",t.id,1)}},"function"!=typeof Object.assign&&Object.defineProperty(Object,"assign",{value:function(t,e){"use strict";if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var r=Object(t),i=1;i<arguments.length;i++){var a=arguments[i];if(null!=a)for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(r[s]=a[s])}return r},writable:!0,configurable:!0});if(void 0===OGX)var OGX={};function require(){OGX.Object.register.apply(null,arguments)}function construct(__that,__cls){var ext=OGX.Object.getExtend(__cls);for(var a in ext)eval("OGX."+ext[a]).call(__that,arguments.callee.caller.arguments[0])}OGX.Object=new OGX.Object;if(OGX.OML=function(e,t){"use strict";var n=e,i=t,o=!1,r=null,a={},s={};function d(){o=!0}function l(e,t){e.construct.apply(e,t)}function u(e,t){var n,i=[];for(var o in t)if(n=/^(\S*)\:Bind$/g.exec(o))if(Array.isArray(t[o]))for(var r=0;r<t[o].length;r++)t[o][r].property=n[1],bpush({uxi:e,config:t[o][r]});else t[o].property=n[1],i.push({uxi:e,config:t[o]});return i}function c(e){setTimeout((function(){O(e.config),e.uxi.bind(e.config)}),0)}function f(e){return e.hasOwnProperty("instance")&&e.instance||e.hasOwnProperty("scroll")&&e.scroll}function p(e,t){if("string"==typeof t["node:OML"])t["node:OML"]=h(t["node:OML"]);else if(Array.isArray(t["node:OML"]))for(var n=0;n<t["node:OML"].length;n++)"string"==typeof t["node:OML"][n]&&(t["node:OML"][n]=h(t["node:OML"][n]));return e.__proto__.hasOwnProperty("placeholder")&&e.placeholder(t),t}function h(e){return 0===e.indexOf("{{")?OGX.OSE.exec(e):OGX.Data.clone(OGX.Cache.read("oml",e))}function O(e,t){var n,o=0;return function e(r){if(!(Array.isArray(r)||"object"!=typeof r||o>=i)){var d=!1;for(var l in r)-1!==l.indexOf(":OSE")?(r[n=l.split(":").shift()]=OGX.OSE.exec(r[l],{},a,t,s),delete r[l],d||(d=!0,o++),e(r[n])):-1!==l.indexOf(":")||"object"!=typeof r[l]||Array.isArray(r[l])||r[l]instanceof HTMLElement||r[l]instanceof jQuery||(d||(d=!0,o++),e(r[l]))}}(e),e}function g(e,t){switch(e){case"scope":return OGX.Scope.fork(t);default:return OGX.OSE.fork(e,t)}}this.get=function(e){return OGX.Cache.read("oml",e)},this.make=function(e,t,n){var i={};return i[e+":"+t]=n,i},this.parse=function(e){return"string"==typeof e&&("{"!==e.substr(0,1)&&(e="{"+e+"}"),e=JSON.parse(e)),e},this.rename=function(e,t,n){function i(e,t,n){var i={};for(var o in e)i[o.replace(t,n)]=e[o];return i}void 0===n&&(n="default"),Array.isArray(n)||(n=[n],t=[t]);for(var o=0;o<n.length;o++)e=i(e,n[o],t[o]);return e},this.getNodeById=function(e,t){return function e(n){var i;for(var o in n){if(n[o].hasOwnProperty("id")&&n[o].id===t)return n[o];if(n[o].hasOwnProperty("node:OML"))if(Array.isArray(n[o]["node:OML"])){for(var r=0;r<n[o]["node:OML"].length;r++)if(i=e(n[o]["node:OML"][r]))return i}else if(i=e(n[o]["node:OML"]))return i}return!1}(e)},this.replaceDataRecursive=function(e,t,n){function i(e){var a,s;for(var d in e)if(-1!==d.indexOf(":OSE"))a=d.split(":"),(s=r(e[d],t,n))&&(e[a[0]]=s,delete e[d],i(e[a[0]]));else if("node:OML"===d)if("string"==typeof e[d]&&0===e[d].indexOf("{{"))e[d]=OGX.OSE.exec(e[d]),o(e[d]);else if(Array.isArray(e[d]))for(var l=0;l<e[d].length;l++)o(e[d][l]);else o(e[d])}function o(e){var o;for(var a in e)-1!==a.indexOf("{{")&&(o=r(a,t,n))&&(e[o]=e[a],delete e[a],a=o),i(e[a])}function r(e,t,n){var i,o,r=/{{([\S ]+)}}/gi;for(a[n]=t;i=r.exec(e);){if(o=OGX.OSE.exec(i[0],{},a),-1!==["string","number"].indexOf(typeof o))e=e.replace(i[0],o);else if(-1!==["boolean","object"].indexOf(typeof o))return o;r.lastIndex=0}return e}o(e)},this.render=function(e,t,i,a,s){t=(t=p(e,{"node:OML":t}))["node:OML"],void 0===s&&(s=!1),n&&(o=!1,r&&clearTimeout(r),r=setTimeout(d,n)),function(e,t,n,i,r){var a=[],s=((new Date).getTime(),[]);function d(e,t){if(!o)if(Array.isArray(e))for(var c=0;c<e.length;c++)d(e[c],t);else{var m,v,w,G,X,M,A,_,y,x,E,N,b,P,L,S;if(!r)for(_ in e)-1!==_.indexOf(":Point")&&(m=_.split(":")[0],/^(#|\.)/gi.test(m)?(e[_].el=m,e[_].mode=0):(e[_].el=null,e[_].mode=1,e[_].id=m),e[_].parent=t,e[_].data=n,e[_].route_data=i,A=OGX.Object.create("Point",e[_]),t.add(A),A.parent=t,A.focus(),d(A.oml(),A),delete e[_]);for(_ in e)if((b=/((?!:)[\S ]+):(\S+)/gi.exec(_))&&(m=b[1],void 0!==(v=w=b[2])&&(-1!==m.indexOf("{{")&&"object"==typeof e[_]["data:OML"]&&(m=OGX.Templater.make(m,e[_]["data:OML"]),delete e[_]["data:OML"]),"string"==typeof e[_]&&0===e[_].indexOf("{{")&&(e[_]=h(e[_])),-1===["Route","OML"].indexOf(v)))){switch(w.indexOf(".")>0&&(w=w.substr(0,w.indexOf(".")-1)),M=e[_],X=!0,G=!0,P=!1,S=!1,w){case"Uxi":return void e[_].attach(t,m);case"Fork":(N=g(m,e[_]))&&d(N,t),G=!1,X=!1;break;case"Html":M.el=m,M.html=e[_].html,(G=f(M))||(M.template=!1);break;case"Template":M.template=v.split(".")[1],M.el=m,v="Html",G=f(M);break;case"Ghost":M.el=m;break;case"Controller":M.id=m,S=!0;break;default:-1!==[".","#"].indexOf(m.substr(0,1))?M.el=m:(M.id=m,M.el=t.el[0],M.parent=t)}X&&(M=O(M,i)),y=!1,x=!1,G?(r&&(E=r.find("id",M.id.replace(/^#/gi,""),1))&&(x=!0),x?(E.wake(M.el),A=E):A=OGX.Object.create(v,M),t.add(A),y=A):P?(P.blur(),$(m).html(L),P.el=$(m),t.add(P),setTimeout((function(){t.blured||P.focus()}),0)):(y=t,"Html"===v&&OGX.HtmlRender(M)),y&&e[_].hasOwnProperty("node:OML")&&!P&&!x&&(e[_]=p(e,e[_]),d(e[_]["node:OML"],y)),G&&(A.parent=t,"function"==typeof A.construct&&(x||(S?(s.push(A),l(A,[n,i])):A.construct.apply(A,[n,i])))),A&&!S&&(G||x)&&(t.blured||A.floating||A.focus()),void 0!==A&&A&&!S&&(a=a.concat(u(A,e[_])))}}}d(t,e),a.length&&function(e){for(var t=0;t<e.length;t++)c(e[t])}(a);setTimeout((function(){!function(e){for(var t=0;t<e.length;t++)e[t].focus()}(s)}),0)}(e,t,i,a,s)}},void 0===OGX)var OGX={};OGX.Stages={},OGX.Views={},OGX.Controllers={},require("Core","Uxi","Touch"),OGX.Core=function(e){construct(this,"Core");var t=this;void 0===e&&(e={});var n,i=OGX.Data.merge(e,{encrypted:!1,max_render_time:300,max_depth:2,disable_context:!1}),o={jwt:!0,scope:["public"],routing:{routes:{},options:{history:!0,bookmark:!0,jail:!1},errors:{403:!1,404:!1}},stages:{blured:!0,use:!1,closeable:!1,anim:!1},overlays:{delay:200,anim:"fade"},popups:{blured:!1,sleeping:!1},theater:!1,observe:!1,auto_exit:!1,chromeos:!1},r=!1,a=!1,s=!1,d=/(iPhone|iPod|iPad)/i.test(navigator.userAgent),l=matchMedia("(prefers-color-scheme: dark)").matches;function u(e){app.remove(OGX.Popup.NAME,e.id),e.cb&&e.cb(e.params),r.el.trigger(OGX.Popup.CLOSE,e.id)}function c(e){e.matches}function f(){if(r)for(var e=r.gather(""),t=0;t<e.length;t++)e[t]._NAME_!==OGX.Controller.NAME&&([OGX.Popup.NAME,OGX.Window.NAME].includes(e[t]._NAME_)?e[t]._NAME_===OGX.Popup.NAME?e[t].sleeping||(e[t].resize(),e[t].centered&&e[t].center(),e[t].resizeNodes()):e[t]._NAME_===OGX.Window.NAME&&(e[t].sleeping||(e[t].resize(),e[t].resizeNodes())):e[t].sleeping||(e[t].resize(),e[t].resizeNodes()))}function p(){n.routing&&(t.router=new OGX.Router(n.routing),t.router.start()),function(){var e,i,o,a,s,d,l,u=!1;for(var c in n.vapps)i=(e=c.split(":"))[0],o=e[1],(s=OGX.Data.merge(n.vapps[c],n.stages,!1,!0)).id=i,!0===s.use&&(u=i,a=i+"/"+s.home),d=t.addStage(o,s),!0===s.use&&(r=d);u&&(l=n.routing.options.bookmark&&-1!==window.location.href.indexOf("#")&&app.router.request().route.stage==r.id?window.location.href.split("#").pop():a,l=a,setTimeout((function(){t.goto(l)}),0),setTimeout((function(){$(document).trigger(OGX.App.READY)}),100))}(),n.theater&&function(){for(var e=app.gather(OGX.Stage.NAME),i=[],o=0;o<e.length;o++)e[o].theater&&i.push(e[o]);n.theater.stages=i,n.theater.el="body",t.theater=t.create("Theater",n.theater)}()}this._NAME_=OGX.App.NAME,this.router=!1,this.isWebView=function(){return s},this.isTouch=function(){return this.touch.touchable()},this.iOS=function(){return d},this.getURL=function(){return r.url},this.isDarkMode=function(){return l},this.toggleTheme=function(){var e="(prefers-color-scheme: ";l?($("head").children('link[data="dark"]').attr("media",e+"light)"),$("head").children('link[data="light"]').attr("media",e+"dark)")):($("head").children('link[data="dark"]').attr("media",e+"dark)"),$("head").children('link[data="light"]').attr("media",e+"light)")),l=!l},this.moveNode=function(e,t,n){e.detach(),e.attach(t,n)},this.addStage=function(e,t){OGX.Data.merge(t,n.stages),t.el="body";var i=OGX.Object.create(e,t);return this.add(i),t.hasOwnProperty("node:OML")&&OGX.OML.render(i,t["node:OML"]),setTimeout((function(){i.construct(t),t.use?(i.el.css("display","block"),i.focus(),a=i):i.sleep()}),0),i},this.removeStage=function(e){var t=this.cfind("Stage",e);t&&(t.destroy(),t.kill(),this.find("Stage",e,"remove"))},this.useStage=function(e){if(!r||r.id!==e){var t=this.cfind("Stage",e);return!!t&&(r&&r.blur(2),(r=t).focus(1),!0)}},this.getStage=function(e){if(void 0===e)return r||a;var t=this.find("Stage",e);return t||!1},this.showStage=function(e,n){if(!r||r.id!==e){var i=this.cfind(OGX.Stage.NAME,e);if(i){if(void 0===n&&(n=i.anim?i.anim:!!a.anim&&a.anim),n){var o=$(window).height();switch(n){case OGX.Stage.SWAP:a&&(i.wake(),a.el.on("transitionend",(function(){a.el.off("transitionend"),a.el.css("top",-o+"px"),i.el.css("top","0px"),i.el.on("transitionend",(function(){i.el.off("transitionend"),i.el.css("transform","scale(1)"),a.el.removeClass("ogx_stage_anim"),a.el.css({top:"0px",transform:"scale(1)"}),a.sleep(),t.el.trigger(OGX.Stage.SWAP,{old:a,new:i}),a=i}))})),i.el.addClass("ogx_stage_anim"),a.el.addClass("ogx_stage_anim"),a.el.css("transform","scale(0.9)")),i.el.css("top",o+"px"),i.el.css("display","block"),i.el.css("transform","scale(0.9)"),i.el.addClass("ogx_stage_anim");break;case OGX.Stage.FLIP:a&&(i.wake(),a.el.on("transitionend",(function(){a.el.off("transitionend"),a.el.removeClass("ogx_stage_anim"),a.el.css("transform","scaleX(1)"),a.sleep(),i.el.css("transform","scaleX(1)"),t.el.trigger(OGX.Stage.SWAP,{old:a,new:i}),a=i})),i.el.addClass("ogx_stage_anim"),i.el.css("transform","scaleX(0)"),a.el.addClass("ogx_stage_anim"),a.el.css("transform","scaleX(0)")),i.el.css("display","block")}}else a&&a.id!==i.id&&a.sleep(),i.sleeping&&i.wake(),i.el.css("display","block"),a=i;t.useStage(e)}}},this.getWindow=function(e){return this.cfind(OGX.Window.NAME,e)},this.getWindows=function(){return this.gather(OGX.Window.NAME)},this.windowExists=function(e){return!1!==this.cfind(OGX.Window.NAME,e)},this.addWindow=function(e,t){if(e=OGX.Data.merge(e,n.windows),void 0===t){if(!a)return!1;t=a}var i;return!!t&&(e.el=t.el,e.parent=t,e.hasOwnProperty("node:OML")?(i=OGX.Object.create(OGX.Window.NAME,e),t.add(i),i.focus(),OGX.OML.render(i,e["node:OML"])):i=t.create(OGX.Window.NAME,e),i)},this.windowOpen=function(e){return this.cfind(OGX.Window.NAME,e).status===OGX.Window.OPEN},this.showWindow=function(e,t,i,o){!0===t&&(t=n.anim);var r=this.cfind(OGX.Window.NAME,e);return!!r&&(r.sleeping&&attachWindow(e),r.blured&&r.focus(),r.show(t,i,o),!0)},this.hideWindow=function(e,t,i,o){!0===t&&(t=n.anim),"string"!=typeof e&&(e=this.findWindow(e).id),this.cfind(OGX.Window.NAME,e).hide(t,i,o)},this.swapWindows=function(e,t){var n,i,o,r;return!(!this.windowExists(e)||!this.windowExists(t))&&(n=this.getWindow(e),i=this.getWindow(t),o=n.el.css("z-index"),r=i.el.css("z-index"),n.el.css("z-index",r),i.el.css("z-index",o),!0)},this.sleepWindow=function(e){this.cfind(OGX.Window.NAME,e).sleep()},this.blurWindow=function(e){this.cfind(OGX.Window.NAME,e).blur()},this.focusWindow=function(e){this.cfind(OGX.Window.NAME,e).focus()},this.removeWindow=function(e){return this.find(OGX.Window.NAME,e,"remove")},this.removeWindows=function(e){for(var t=0;t<e.length;t++)this.removeWindow(e[t]);return!0},this.removeAllWindows=function(e){void 0===e&&(e=[]);for(var t=this.gather(OGX.Window.NAME),n=0;n<t.length;n++)e.includes(t[n].id)&&this.removeWindow(t[n].id)},this.findWindow=function(e){for(var t=e;t.hasOwnProperty("parent")&&t.parent;){if(t.parent._NAME_===OGX.Window.NAME)return t.parent;t=t.parent}return!1},this.addPopup=function(e,t){var i;return void 0!==t&&t||(t=r),e.el=t.el[0],e.parent=t,e.chromeos=n.chromeos,e.hasOwnProperty("node:OML")?(i=OGX.Object.create(OGX.Popup.NAME,e),t.add(i),i.focus(),OGX.OML.render(i,e["node:OML"])):i=t.create(OGX.Popup.NAME,e),setTimeout((function(){i.show()}),0),i},this.removePopup=function(e,t,n,i,o){var r=!1;void 0===o&&(o=a,r=!0),void 0===n&&(n=!1),void 0===i&&(i=!1),void 0===t&&(t=!0);var s=null;return!!(s=r?o.find(OGX.Popup.NAME,e):app.cfind(OGX.Popup.NAME,e))&&(s.hide(t,u,{id:e,cb:n,params:i},null,!0),!0)},this.findPopup=function(e){var t;t=e instanceof HTMLElement?e:e.el;var n=$(t).parents(".ogx_popup");if(n.length){var i=$(n[0]).data("ogx-id");return this.cfind(OGX.Popup.NAME,i)}return!1},this.getVisiblePopups=function(){for(var e=this.gather(OGX.Popup.NAME),t=[],n=0;n<e.length;n++)"visible"===e[n].el.css("visibility")&&t.push(e[n]);return t},this.popupExists=function(e){return!1!==this.cfind(OGX.Popup.NAME,e)},this.groupPopups=function(e,n,i){void 0===i&&(i=null);var o={drag:!0,resize:!0,anim:!1};i&&OGX.Data.merge(o,i,!0);var r=e.id,a=n.id,s=e.nodes.get({_NAME_:{eq:"Container"}},null,1),d=n.nodes.get({_NAME_:{eq:"Container"}},null,1);if(s&&d){var l=s.nodes.get({_NAME_:{eq:"Carousel"}},null,1),u=s.nodes.get({_NAME_:{eq:"Tabs"}},null,1),c=d.nodes.get({_NAME_:{eq:"Carousel"}},null,1),f=(g=d.nodes.get({_NAME_:{eq:"Tabs"}},null,1)).index(),p=l.panels().slice();e.nodes=new OGX.List;for(var h=0;h<p.length;h++)g.add(u[h]),y=p[h].instance?{"default:Uxi":p[h].instance}:{"default:Html":{html:p[h].html}},c.addNode(y,null,!1);f+=u.length,c.showPanel(f,!1),g.index(f),t.removePopup(e.id,!1,!1,!1,e.parent)}else if(s||d){var O,g,m;s?(O=s.nodes.get({_NAME_:{eq:"Carousel"}},null,1),g=s.nodes.get({_NAME_:{eq:"Tabs"}},null,1),E=n):(O=d.nodes.get({_NAME_:{eq:"Carousel"}},null,1),g=d.nodes.get({_NAME_:{eq:"Tabs"}},null,1),E=e),E.nodes.length?((m=E.nodes.slice()[0]).blur(),E.nodes=new OGX.List,y={"default:Uxi":m}):y={"default:Html":{html:E.el.find(".ogx_popup_body").first().html()}};var v=E.title();t.removePopup(E.id,!1,!1,!1,E.parent),O.addNode(y,null,!0),g.add(v),g.index(g.set().length-1)}else{var w=e.nodes;w=!!w.length&&w[0];var G,X,M=n.nodes;M=!!M.length&&M[0],w?(w.detach(),G={"default:Uxi":w}):G={"default:Html":{html:e.el.find(".ogx_popup_body").children().first().detach()}},M?(M.detach(),X={"default:Uxi":M}):X={"default:Html":{html:n.el.find(".ogx_popup_body").children().first().detach()}};var A=n.icons()||e.icons();"boolean"==typeof A&&(A=!1),!(A&&Array.isArray(A)&&A.length)&&(A=!1);var _=this.gather("Popup");_=_.get({id:{in:e.group}});var y={id:e.group+"_"+_.length,width:e.el.width(),height:e.el.height(),title:e.group,group:e.group,icons:A,"node:OML":[{"default:Container":{index:1,tabs:{list:[n.title(),e.title()]},"node:OML":[X,G]}}]};OGX.Data.merge(y,o,!0);var x=e.parent,E=app.addPopup(y,e.parent);this.removePopup(e.id,!1,!1,!1,x),this.removePopup(n.id,!1,!1,!1,x),$(document).trigger(OGX.Popup.GROUP,{popups:[r,a],popup:E})}},this.ungroupPopup=function(e,t,n){var i=e.icons(),o=e.nodes.get({_NAME_:{eq:"Container"}},null,1).nodes.get({_NAME_:{eq:"Carousel"}},null,1),r=o.getPanel(t),a={};if(r.instance){var s=o.nodes.get({id:{eq:r.instance.id},_NAME_:{eq:r.instance._NAME_}},null,1);s&&(a["default:Uxi"]=s)}else a["default:Html"]={html:r.html};o.removePanel(t);var d="popup_"+(new Date).getTime();this.addPopup({id:d,group:e.group,title:n,resize:!0,drag:!0,icons:i,"node:OML":[a]}),$(document).trigger(OGX.Popup.UNGROUP,{from_popup:e.id,from_index:t,to_popup:d})},this.addOverlay=function(e,t){return void 0===t&&(t=a),!!t&&(t.addOverlay(e),!0)},this.removeOverlay=function(e,t){void 0===t&&(t=a),t&&t.removeOverlay(e)},this.theater=!1,this.getJSON=function(e){return OGX.Data.clone(OGX.Cache.read("json",e))},this.getOML=function(e){return OGX.Data.clone(OGX.Cache.read("oml",e))},this.goto=function(e,t){return this.router.goto(e,t)},this.getDefaults=function(e){return n[e]},OGX.Net=new OGX.Net({ios:d,encrypted:i.encrypted}),OGX.Net.load("app.json",(function(e){i.encrypted&&(e=function(e){var t=document.cookie.match("(^|[^;]+)\\s*ogx_key\\s*=\\s*([^;]+)");if(t)return t=decodeURIComponent(t.pop()),document.cookie="ogx_key=; expires=Thu, 01 Jan 1970 00:00:01 GMT;",e=CryptoJS.AES.decrypt(e,t,{mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7}).toString(CryptoJS.enc.Utf8),JSON.parse(e)}(e)),i.disable_context&&(window.oncontextmenu=function(){return!1}),n=e,OGX.Scope=new OGX.Scope(n.jwt),OGX.OML=new OGX.OML(i.max_render_time,i.max_depth),s=void 0!==window.ontouchstart,d&&$("body").addClass("ios"),n=OGX.Data.weld(n,o,!1,!1),t.el=$(document),OGX.Net.preload(n.preload,p),window.addEventListener("resize",f),function(e){if(!0){var t=window.matchMedia("(prefers-color-scheme: dark)");t.addListener(c)}else t.removeListener(c)}()}))},OGX.App=function(e){"use strict";return OGX.Object.create("Core",e)},OGX.App.NAME="App",OGX.App.LOADING="AppLoading",OGX.App.READY="AppReady";if(OGX.Audio=function(){"use strict";var t=!1;this.get=function(t){var e;return!!(e=OGX.Cache.read("snd",t))&&e},this.play=function(e,i,n){void 0===i&&(i=1),void 0===n&&(n=!1);var a=this.get(e);return!!a&&(a.hasOwnProperty("howl")?(a.howl.volume(i),a.howl.loop(n)):a.howl=new Howl({src:["snd/"+a.file],loop:n,volume:i}),t?a.howl.play():setTimeout((function(){a.howl.play()}),0),!0)},this.stop=function(t){if(void 0!==t){var e=this.get(t);if(e)return e.howl.stop(),!0}return!1},this.prepare=function(){for(var t=OGX.Cache.get({ext:{eq:"snd"}}),e=0;e<t.length;e++)t[e].hasOwnProperty("howl")||(t[e].howl=new Howl({src:["snd/"+t[e].file]}))},$(document).on("touchstart mousedown",(function e(){t=!0,$(document).off("touchstart mousedown",e)}))},OGX.Audio=new OGX.Audio,OGX.Bind=function(){"use strict";var t=this,e={object:null,event:null,mode:"eq",action:"filter",property:null,remote_property:null,min_length:0},i={};function n(e,i){var n,r,o,s,l="string"==typeof i.object;function c(e,n){if("object"==typeof n){if(function(e,i){for(var n in e.__p)t.unbindFilter(n);e.__p={}}(i),i.remote_property&&Array.isArray(i.remote_property)){var o=0;for(var s in n)i.__p[i.remote_property[o]]=!0,r(i.remote_property[o],i.mode,n[s]),o++;return}if(i.remote_property)n=i.object._NAME_===OGX.DynamicList.NAME?i.object.getSelection().unique(i.remote_property,!1):n[i.remote_property],r(i.property,i.mode,n),a(i,n);else{if(Array.isArray(i.property)){o=0;for(var s in n)i.__p[i.property[o]]=!0,r(i.property[o],i.mode,n[s]),o++;return}r(i.property,i.mode,n),a(i,n)}}else i.remote_property?r(i.remote_property,i.mode,n):r(i.property,i.mode,n)}function d(t){if(i.min_length&&t.target.value.length<i.min_length&&t.target.value.length)return!1;r(i.property,i.mode,t.target.value)}switch(l?(e&&(i.object={el:$(i.object)},n=i.event),o=d):(e&&(n=OGX[i.object._NAME_].BIND),o=c),i.action){case"render":r=t.bindRender;break;case"filter":r=t.bindFilter}e?(i.object.el.on(n,o),l?d({target:{value:i.object.el.val()}}):(s=i.object.bindValue?i.object.bindValue():i.object.val(),Array.isArray(s)&&s.hasOwnProperty("insert")&&(s=JSON.parse(JSON.stringify(s))),c(0,s))):i.object.el.off(n,o)}function a(t,e){for(var i in e)t.__p[i]=!0}this.bind=function(t){return OGX.Data.merge(t,e),!!t.property&&(t.object&&"string"==typeof t.object&&(t.event="input change",t.action="filter"),t.__p={},i.hasOwnProperty(t.property)||(i[t.property]=[]),i[t.property].push(t),n(!0,t),!0)},this.unbind=function(t){for(var e=0;e<i[t].length;e++)n(!1,i[t][e]);return delete i[t],!0},this.clearBinds=function(){for(var t in i){for(var e=0;e<i[t].length;e++)n(!1,i[t][e]);delete i[t]}}},OGX.Bind.prototype.unbindFilter=function(t){},OGX.Bind.prototype.bindFilter=function(t,e,i){},OGX.Bind.prototype.bindRender=function(t,e){},OGX.Bind.prototype.bindValue=null,OGX.Cache=function(){"use strict";var t=new OGX.List;t.cache("ext","id"),this.read=function(e,i){var n=t.read({ext:e,id:i},null,1);return!!n&&("snd"===n.ext?n:n.data)},this.get=function(e,i){return void 0===i&&(i=0),t.get(e,null,null,i)},this.set=function(e){t=new OGX.List(e)},this.query=function(t){},this.add=function(e){if(Array.isArray(e))for(var i=0;i<e.length;i++)t.insert(e[i]);else t.insert(e)},this.remove=function(e,i){return t.unset({ext:{eq:e},id:{eq:i}},1)},"undefined"!=typeof __array&&this.set(__array)},OGX.Cache=new OGX.Cache,require("Calendar","Uxi","Bind","Touch"),OGX.Calendar=function(t){construct(this,"Calendar");var e,i,n,a,r=this,o=t,s={display_date:moment(),date:!1,format:"YYYY-MM-DD",layouts:[{layout:"MONTH_DAYS",engine:"DAY_NUMBER",config:!1}],layout:0,selectable:!0,mode:"select",swipe:!0,browse:!0,chromeos:!1},l=[],c={x:1,y:1},d=!1,u=!1;function h(t){t?(i.on(r.touch.down,".ogx_calendar_left",f),i.on(r.touch.down,".ogx_calendar_right",f)):(i.off(r.touch.down,".ogx_calendar_left",f),i.off(r.touch.down,".ogx_calendar_right",f))}function f(t){t.preventDefault(),t.stopImmediatePropagation(),u||(u=!0,$(this).hasClass("ogx_calendar_left")?e.swipeLeft():e.swipeRight(),setTimeout((function(){u=!1}),350))}function g(t){t?i.on("click",".ogx_calendar_layout_item",_):i.off("click",".ogx_calendar_layout_item",_)}function _(t){var e,i=$(this),n=i.data("ogx-date");"toggle"===o.mode&&i.hasClass("ogx_calendar_selected_item")?(m(),r.el.trigger(OGX.Calendar.UNSELECT,""),o.date=!1):(m(),e=n,r.el.find('.ogx_calendar_layout_item[data-ogx-date="'+e+'"]').addClass("ogx_calendar_selected_item"),o.date=moment(n),o.display_date=o.date.clone(),r.el.trigger(OGX.Calendar.SELECT,o.date),O()),setTimeout(p,0)}function p(){for(var t=e.getCells(),i=0;i<t.length;i++)0==t[i].offset.x&&0==t[i].offset.y||w(t[i].abs,t[i].rel,t[i].offset,$(t[i].element).children(0)[0])}function m(){r.el.find(".ogx_calendar_selected_item").removeClass("ogx_calendar_selected_item")}function v(){for(var t=e.getCells(),i=0;i<t.length;i++)w(t[i].abs,t[i].rel,t[i].offset,$(t[i].element).children(0)[0])}function y(t){t?(i.on(OGX.GridSwiper.SWIPE_START,(function(){o.selectable&&g(!1)})),i.on(OGX.GridSwiper.SWIPE_END,(function(){o.selectable&&g(!0)})),i.on(OGX.GridSwiper.SWIPE_LEFT,(function(t,e){var i=l[a].value();x(i.value,i.unit),b(l[a].labels(o.display_date))})),i.on(OGX.GridSwiper.SWIPE_RIGHT,(function(t,e){var i=l[a].value();x(-1*i.value,i.unit),b(l[a].labels(o.display_date))})),i.on(OGX.GridSwiper.SWIPE_UP,(function(t,e){a=e.cell.y-1,O(),b(l[a].labels(o.display_date))})),i.on(OGX.GridSwiper.SWIPE_DOWN,(function(t,e){a=e.cell.y-1,O(),b(l[a].labels(o.display_date))}))):(i.off(OGX.GridSwiper.SWIPE_LEFT),i.off(OGX.GridSwiper.SWIPE_RIGHT),i.off(OGX.GridSwiper.SWIPE_UP),i.off(OGX.GridSwiper.SWIPE_DOWN),i.off(OGX.GridSwiper.SWIPE_START),i.off(OGX.GridSwiper.SWIPE_END))}function x(t,e){o.display_date.add(t,e),O()}function O(){var t=l[a].format(o.display_date),e="";o.browse&&(e+='<span class="ogx_calendar_left"></span><span class="ogx_calendar_display_date">'+o.display_date.format(t)+"</span>"),o.date&&(e+='<span class="ogx_calendar_selected_date">'+o.date.format(o.format)+"</span>"),o.browse&&(e+='<span class="ogx_calendar_right"></span>'),i.children(".ogx_calendar_head").children(".ogx_calendar_head_date").html(e)}function b(t){i.children(".ogx_calendar_head").children(".ogx_calendar_head_labels").html(t)}function w(t,e,i,n){if(e.y-1>=0&&e.y-1<o.layouts.length){var r=$(n),s=l[a].value(),c=o.display_date.clone().add(i.x*s.value,s.unit),d=l[e.y-1].html(c,OGX.CalendarEngine[o.layouts[e.y-1].engine],o.layouts[e.y-1].config,o.date);r.html(d)}}function G(t,e){return OGX.CalendarLayout[t].prototype=Object.create(OGX.CalendarLayout.BASE_LAYOUT.prototype),OGX.CalendarLayout[t].prototype.constructor=OGX.CalendarLayout[t],new OGX.CalendarLayout[t](e)}this._NAME_=OGX.Calendar.NAME,this.el=null,this.enable=function(){return d||(d=!0,o.selectable&&g(!0),y(!0),o.browse&&h(!0)),this},this.disable=function(){return d&&(d=!1,o.selectable&&g(!1),y(!1),o.browse&&h(!1)),this},this.resize=function(){return this.resizeNodes(),this},this.val=function(t){return void 0!==t&&(o.date=t,moment.isMoment(o.date)||(o.date=moment(o.date)),o.display_date=o.date.clone(),O(),setTimeout(v,0)),o.date?o.date:""},this.refresh=function(){return setTimeout(v,0),this},this.display=function(t){return void 0!==t?(o.display_date=t,moment.isMoment(o.display_date)||(o.display_date=moment(o.display_date)),O(),setTimeout(v,0),!0):o.display_date},this.axis=function(t,e){return o.axis.x=t,o.axis.y=e,this},this.getLayout=function(){return a},function(){for(var t in s)o.hasOwnProperty(t)||(o[t]=s[t]);r.el=i=$(o.el),i.addClass("ogx_calendar"),o.date&&(moment.isMoment(o.date)||(o.date=moment(o.date)),o.display_date=o.date.clone()),o.display_date?moment.isMoment(o.display_date)||(o.display_date=moment(o.display_date)):o.display_date=moment(),a=o.layout,c.y=a+1}(),i.html('<div class="ogx_calendar_head"><div class="ogx_calendar_head_date"></div><div class="ogx_calendar_head_labels"></div></div><div class="ogx_calendar_body"></div>'),function(){n=[[!1,!1,!1]];for(var t=0;t<o.layouts.length;t++)n.push([w,w,w]);n.push([!1,!1,!1])}(),function(){for(var t=0;t<o.layouts.length;t++)l.push(G(o.layouts[t].layout,{}))}(),e=r.create("GridSwiper",{el:o.el+" .ogx_calendar_body",loop:!0,map:n,start:{x:1,y:a+1},chromeos:o.chromeos,enabled:o.swipe}),O(),b(l[a].labels(o.display_date)),r.enable()},OGX.Calendar.NAME="Calendar",OGX.Calendar.SELECT="CalendarSelect",OGX.Calendar.UNSELECT="CalendarUnselect",OGX.Calendar.BIND=OGX.Calendar.SELECT+" "+OGX.Calendar.UNSELECT,OGX.CalendarLayout={},OGX.CalendarLayout.BASE_LAYOUT=function(){"use strict";this.labels=function(t){return""},this.html=function(t,e,i,n){return""},this.value=function(){return{value:1,unit:"months"}},this.format=function(){return"YYYY-MM"}},OGX.CalendarLayout.MONTH_DAYS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(){for(var t="",e=function(){for(var t=new Date(Date.UTC(2017,0,2)),e=[],i=0;i<7;i++)e.push(t.toLocaleDateString(navigator.language,{weekday:"short"})),t.setDate(t.getDate()+1);return e}(),i=0;i<e.length;i++)t+='<span class="ogx_calendar_layout_month_days_label">'+e[i]+"</span>";return t},this.html=function(t,e,i,n){var a,r=t.format("MM"),o=moment(t.format("YYYY-MM-")+"01").day(),s=moment(t.format("YYYY-MM-")+"01").subtract(o,"days"),l="";n&&(l=n.format("YYYY-MM-DD"));for(var c,d="",u=0;u<42;u++)c="",a=s.format("YYYY-MM-DD"),s.format("MM")!==r&&(c+="ogx_calendar_layout_month_days_offset "),a===moment().format("YYYY-MM-DD")&&(c+="ogx_calendar_layout_month_days_today "),n&&l===a&&(c+="ogx_calendar_selected_item "),d+='<div class="ogx_calendar_layout_item ogx_calendar_layout_month_days '+c+'" data-ogx-date="'+a+'">'+e(a,i)+"</div>",s.add(1,"days");return d},this.value=function(){return{value:1,unit:"months"}},this.format=function(){return"YYYY-MM"}},OGX.CalendarLayout.CENTURY_DECADES=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(t){return'<span class="ogx_calendar_layout_century_decades_label">'+100*Math.floor(Number(t.format("YYYY"))/100)+"'s</span>"},this.html=function(t,e,i,n){var a,r,o=moment(),s=100*Math.floor(Number(o.format("YYYY"))/100),l=10*Math.floor(Number(o.format("YYYY").substr(2))/10),c=100*Math.floor(Number(t.format("YYYY"))/100),d=0,u=0;n&&(d=100*Math.floor(Number(n.format("YYYY"))/100),u=10*Math.floor(Number(n.format("YYYY").substr(2))/10));for(var h="",f=0;f<10;f++)r="",s+l===c+(a=10*f)&&(r="ogx_calendar_layout_century_decades_current "),d+u===c+a&&(r+="ogx_calendar_selected_item "),h+='<div class="ogx_calendar_layout_item ogx_calendar_layout_century_decades '+r+'" data-ogx-date="'+(c+a)+'-01-01">'+e(c+a,i)+"</div>";return h},this.value=function(){return{value:100,unit:"years"}},this.format=function(){return"YYYY"}},OGX.CalendarLayout.CENTURY_YEARS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(t){return'<span class="ogx_calendar_layout_century_decades_label">'+100*Math.floor(Number(t.format("YYYY"))/100)+"'s</span>"},this.html=function(t,e,i,n){var a,r=moment(),o=100*Math.floor(Number(r.format("YYYY"))/100),s=Number(r.format("YYYY").substr(2)),l=100*Math.floor(Number(t.format("YYYY"))/100),c=0,d=0;n&&(c=100*Math.floor(Number(n.format("YYYY"))/100),d=Math.floor(Number(n.format("YYYY").substr(2))));for(var u="",h=0;h<100;h++)a="",l+h===o+s&&(a+="ogx_calendar_layout_century_years_current "),l+h===c+d&&(a+="ogx_calendar_selected_item"),u+='<div class="ogx_calendar_layout_item ogx_calendar_layout_century_years '+a+'" data-ogx-date="'+(l+h)+'-01-01">'+e(l+h+"-01-01",i)+"</div>";return u},this.value=function(){return{value:100,unit:"years"}},this.format=function(){return"Y"}},OGX.CalendarLayout.DECADE_YEARS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(t){return'<span class="ogx_calendar_layout_century_years_label">'+10*Math.floor(Number(t.format("YYYY"))/10)+"'s</span>"},this.html=function(t,e,i,n){var a,r=10*Math.floor(Number(t.format("YYYY"))/10),o="",s=Number(moment().format("YYYY")),l="";n&&(l=Number(n.format("YYYY")));for(var c=0;c<10;c++)a="",r+c===s&&(a+="ogx_calendar_layout_decade_years_current "),r+c===l&&(a+="ogx_calendar_selected_item "),o+='<div class="ogx_calendar_layout_item ogx_calendar_layout_decade_years '+a+'" data-ogx-date="'+(r+c)+'-01-01">'+e(r+c+"-01-01",i)+"</div>";return o},this.value=function(){return{value:10,unit:"years"}},this.format=function(){return"Y"}},OGX.CalendarLayout.DECADE_MONTHS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(t){for(var e=10*Math.floor(Number(t.format("YYYY"))/10),i=Number(String(e).substr(2,2)),n="",a=0;a<10;a++)n+='<span class="ogx_calendar_layout_decade_months_label">\''+i+"</span>",i++;return n},this.html=function(t,e,i,n){var a,r,o,s,l=10*Math.floor(Number(t.format("YYYY"))/10),c="",d=moment().format("YYYY-MM");n&&(a=n.format("YYYY-MM"));for(var u=0;u<12;u++){s=u+1;for(var h=0;h<10;h++)r="",(o=l+h+"-"+(s<10?"0"+s:s))===d&&(r="ogx_calendar_layout_decade_months_current "),o===a&&(r+="ogx_calendar_selected_item "),moment(o+"-01"),c+='<div class="ogx_calendar_layout_item ogx_calendar_layout_decade_months '+r+'" data-ogx-date="'+o+'-01">'+e(o+"-01",i)+"</div>"}return c},this.value=function(){return{value:10,unit:"years"}},this.format=function(t){return"["+10*Math.floor(Number(t.format("YYYY"))/10)+"'s]"}},OGX.CalendarLayout.YEAR_MONTHS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(t){return'<span class="ogx_calendar_layout_year_months_label">Months</span>'},this.html=function(t,e,i,n){var a,r,o=moment().format("YYYY-MM"),s=t.format("YYYY"),l="",c="";n&&(c=n.format("YYYY-MM"));for(var d=1;d<13;d++)a="",s+"-"+(r=d<10?"0"+d:d)===o&&(a+="ogx_calendar_layout_year_months_current "),s+"-"+r===c&&(a+="ogx_calendar_selected_item "),l+='<div class="ogx_calendar_layout_item ogx_calendar_layout_year_months '+a+'" data-ogx-date="'+s+"-"+r+'-01">'+e(s+"-"+r+"-01",i)+"</div>";return l},this.value=function(){return{value:1,unit:"years"}},this.format=function(){return"Y"}},OGX.CalendarLayout.YEAR_WEEKS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(t){return'<span class="ogx_calendar_layout_year_weeks_label">Weeks</span>'},this.html=function(t,e,i,n){var a=moment().week(),r=t.format("YYYY"),o=moment().format("YYYY"),s="",l="";n&&(l=n.week(),s=n.format("YYYY"));for(var c,d,u="",h=1;h<53;h++)c="",a===h&&r===o&&(c="ogx_calendar_layout_year_weeks_current "),l===h&&r===s&&(c+="ogx_calendar_selected_item "),u+='<div class="ogx_calendar_layout_item ogx_calendar_layout_year_weeks '+c+'" data-ogx-date="'+(d=moment().year(r).week(h).format("YYYY-MM-DD"))+'">'+e(d,i)+"</div>";return u},this.value=function(){return{value:1,unit:"years"}},this.format=function(){return"Y"}},OGX.CalendarLayout.YEAR_DAYS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(t){return'<span class="ogx_calendar_layout_year_weeks_label">Nth Day</span>'},this.html=function(t,e,i,n){var a,r,o,s="",l=t.format("YYYY-MM-DD"),c=moment(t.format("YYYY")+"-01-01"),d="";n&&(d=n.format("YYYY-MM-DD")),r=t.isLeapYear()?366:365;for(var u=0;u<r;u++)a="",(o=c.format("YYYY-MM-DD"))===l&&(a="ogx_calendar_layout_year_days_current "),o===d&&(a+="ogx_calendar_selected_item "),s+='<div class="ogx_calendar_layout_item ogx_calendar_layout_year_days '+a+'" data-ogx-date="'+o+'">'+e(o,i)+"</div>",c.add(1,"days");return s},this.value=function(){return{value:1,unit:"years"}},this.format=function(){return"Y"}},OGX.CalendarLayout.MONTH_WEEKS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(t){return'<span class="ogx_calendar_layout_year_weeks_label">Nth Week</span>'},this.html=function(t,e,i,n){var a,r="",o=moment(),s=Number(o.format("YYYY")),l=Number(o.format("w")),c=Number(t.format("YYYY")),d=0,u=0;n&&(d=Number(n.format("YYYY")),u=Number(n.format("w")));r="";for(var h,f=moment(t.format("YYYY-MM-[01]")),g=0;g<5;g++)h="",a=Number(f.format("w")),c===d&&a===u&&(h+="ogx_calendar_selected_item "),c===s&&a===l&&(h+="ogx_calendar_layout_month_weeks_current"),r+='<div class="ogx_calendar_layout_item ogx_calendar_layout_month_weeks '+h+'" data-ogx-date="'+f.format("YYYY-MM-DD")+'">'+e(f.format("YYYY-MM-DD"),i)+"</div>",f.add(7,"days");return r},this.value=function(){return{value:1,unit:"months"}},this.format=function(){return"[(]YYYY-MM[)] W"}},OGX.CalendarLayout.WEEK_DAYS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(t){for(var e="",i=function(){for(var t=new Date(Date.UTC(2017,0,2)),e=[],i=0;i<7;i++)e.push(t.toLocaleDateString(navigator.language,{weekday:"short"})),t.setDate(t.getDate()+1);return e}(),n=function(t){for(var e=t.clone(),i=e.day(),n=e.subtract(i,"day"),a=[],r=0;r<7;r++)a.push(n.format("DD")),n.add(1,"day");return a}(t),a=0;a<i.length;a++)e+='<span class="ogx_calendar_layout_month_days_label">'+i[a]+" "+n[a]+"</span>";return e},this.html=function(t,e,i,n){var a,r,o="",s=t.weekday(),l=t.subtract(s,"days"),c=moment().format("YYYY-MM-DD"),d="";n&&(d=n.format("YYYY-MM-DD"));for(var u=0;u<7;u++)a="",(r=l.format("YYYY-MM-DD"))===c&&(a="ogx_calendar_layout_week_days_current "),r===d&&(a+="ogx_calendar_selected_item "),o+='<div class="ogx_calendar_layout_item ogx_calendar_layout_week_days '+a+'" data-ogx-date="'+r+'">'+e(r,i)+"</div>",l.add(1,"days");return o},this.value=function(){return{value:1,unit:"weeks"}},this.format=function(){return"YYYY-MM (wo [week])"}},OGX.CalendarLayout.DAY_HOURS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(t){return'<span class="ogx_calendar_layout_day_hours_label">Hours</span>'},this.html=function(t,e,i,n){var a,r,o="",s=Number(moment().format("HH")),l=t.format("YYYY-MM-DD "),c=moment().format("YYYY-MM-DD "),d="",u="";n&&(d=Number(n.format("HH")),u=n.format("YYYY-MM-DD "));for(var h=0;h<24;h++)r="",h===s&&l===c&&(r="ogx_calendar_layout_days_hours_current "),h===d&&l===u&&(r+="ogx_calendar_selected_item "),o+='<div class="ogx_calendar_layout_item ogx_calendar_layout_days_hours '+r+'" data-ogx-date="'+(l+(a=h<10?"0"+h:String(h)))+':00">'+e(l+a+":00",i)+"</div>";return o},this.value=function(){return{value:1,unit:"days"}},this.format=function(){return"YYYY-MM-DD HH:[00]"}},OGX.CalendarLayout.DAY_WORK_HOURS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(t){return'<span class="ogx_calendar_layout_day_work_hours_label">Work Hours</span>'},this.html=function(t,e,i,n){i&&void 0!==i?i.hasOwnProperty("start")||(i.start=8,i.end=17):i={start:8,end:17};var a,r,o="",s=Number(moment().format("HH")),l=t.format("YYYY-MM-DD "),c=moment().format("YYYY-MM-DD "),d="",u="";n&&(d=Number(n.format("HH")),u=n.format("YYYY-MM-DD "));for(var h=i.start;h<i.end+1;h++)r="",h===s&&l===c&&(r="ogx_calendar_layout_days_work_hours_current "),h===d&&u===l&&(r+="ogx_calendar_selected_item "),o+='<div class="ogx_calendar_layout_item ogx_calendar_layout_days_work_hours '+r+'" data-ogx-date="'+(l+(a=h<10?"0"+h:h))+':00">'+e(l+a+":00",i)+"</div>";return o},this.value=function(){return{value:1,unit:"days"}},this.format=function(){return"YYYY-MM-DD HH:[00]"}},OGX.CalendarLayout.DAY=function(t){"use strict";this.labels=function(t){return'<span class="ogx_calendar_layout_day_label">'+function(t){for(var e=new Date(Date.UTC(2017,0,2)),i=[],n=t.day(),a=0;a<7;a++)i.push(e.toLocaleDateString(navigator.language,{weekday:"long"})),e.setDate(e.getDate()+1);return i[n]}(t)+"</span>"},this.html=function(t,e,i,n){var a="",r=t.format("YYYY-MM-DD"),o=moment().format("YYYY-MM-DD");return n&&r===n.format("YYYY-MM-DD")&&(a+="ogx_calendar_selected_item "),r===o&&(a+="ogx_calendar_layout_day_current "),'<div class="ogx_calendar_layout_item ogx_calendar_layout_day '+a+'" data-ogx-date="'+r+'">'+e(r,i)+"</div>"},this.value=function(){return{value:1,unit:"days"}},this.format=function(){return"YYYY-MM-DD"},this.select=function(t){}},OGX.CalendarEngine={},OGX.CalendarEngine.CELL_VALUE=function(t,e){var i=moment(t);return e.hasOwnProperty("css")||(e.css=""),'<div class="ogx_calendar_engine_cell_value '+e.css+'">'+i.format(e.format)+"</div>"},OGX.CalendarEngine.DAY_NUMBER=function(t,e){var i=moment(t);return OGX.CalendarEngine.CELL_VALUE(i,{format:"DD",css:"ogx_calendar_engine_day_number"})},OGX.CalendarEngine.WEEK_NUMBER=function(t,e){return'<div class="ogx_calendar_engine_week_number">'+moment(t).week()+"</div>"},OGX.CalendarEngine.MONTH_NUMBER=function(t,e){return OGX.CalendarEngine.CELL_VALUE(t,{format:"MM",css:"ogx_calendar_engine_month_number"})},OGX.CalendarEngine.YEAR_NUMBER=function(t,e){return OGX.CalendarEngine.CELL_VALUE(t,{format:"YY",css:"ogx_calendar_engine_year_number"})},OGX.CalendarEngine.DECADE_NUMBER=function(t){return'<div class="ogx_calendar_engine_date_day_number">'+String(t).substr(2)+"'s</div>"},require("Carousel","Uxi","Placeholder","Touch"),OGX.Carousel=function(t){construct(this,"Carousel");var e,i,n,a,r,o,s=this,l=t,c={min_x:100,anim:!0,drag:!0,drag_left:!0,drag_right:!0,dots:!1,css:!1,index:0,capture:!1},d={position:"bottom"},u=!1,h=0,f=0,g=new OGX.List,_="ogx_carousel";function p(t){if(void 0!==t&&g[t]&&g[t].instance){var e=s.find(g[t].instance._NAME_,g[t].instance.id);e&&e.blur(2)}}function m(t){if(void 0!==t&&g[t]&&g[t].instance){var e=s.find(g[t].instance._NAME_,g[t].instance.id);e&&e.focus(1)}}function v(t){i.off("transitionend"),i.removeClass(_+"_anim")}function y(t){if(t.dirX){if(-1===t.dirX&&!l.drag_right)return;if(1===t.dirX&&!l.drag_left)return}if(t.distX>t.distY){var e=o*n*-1+t.distX*t.dirX;e<=0&&e>-1*(i.width()-s.el.width())&&i.css({transform:"translate3d("+e+"px, 0, 0)"})}}function x(t){if(t.distX>l.min_x){var i=o+-1*t.dirX;i>=0&&i<f&&o!==i&&(p(o),o=i,e.trigger(OGX.Carousel.CHANGE,o))}var n=0;o&&(n=100/f*(-1*o)),O(n,o,!0)}function O(t,e,n){n?(i.addClass(_+"_anim"),i.on("transitionend",(function(){i.off("transitionend"),i.removeClass(_+"_anim"),m(e)}))):(i.removeClass(_+"_anim"),m(e)),i.css({transform:"translate3d("+t+"%, 0, 0)"})}function b(){u=!0,clearInterval(a),a=setInterval(w,50),n=Math.floor(e.innerWidth()),i.removeClass(_+"_anim")}function w(){u=!1,clearInterval(a),a=!1}function G(){var t,e,n;f&&(g.clear(),i.children("."+_+"_view").each((function(i,a){t=$(a),(e=t.children().first()).length?(e[0].hasAttribute("data-ogx-id")&&(n=e.data("ogx-id"),e.hasClass("ogx_scroller_outer")&&(n=e.find(".ogx_scroller_inner").first().data("ogx-id"))),void 0!==s.nodes[i]&&(i!==o?s.nodes[i].blur():s.nodes[i].focus(),g.push({index:i,instance:s.nodes.get({id:{eq:String(n)}},null,1),html:!1}))):g.push({index:i,instance:!1,html:t.html()})})))}function X(){for(var t=[],n=0;n<f;n++)i.append('<div class="'+_+'_view" style="width:'+100/f+'%;" data-ogx-panel-id="'+h+'"></div>'),t.push("."+_+'[data-ogx-id="'+s.id+'"] > .'+_+"_views > ."+_+'_view[data-ogx-panel-id="'+h+'"]'),h++;i.css("width",100*f+"%"),s.placeholders(l,t),e.trigger(OGX.Carousel.READY)}this._NAME_=OGX.Carousel.NAME,this.el=null,this.construct=function(){G(),l.index&&this.showPanel(l.index,!1)},this.enable=function(){return l.drag&&this.touch.swipe.enable(),setTimeout((function(){for(var t=0;t<g.length;t++)g[t].instance&&(t!==o?g[t].instance.blur():g[t].instance.focus())}),0),this},this.disable=function(){return l.drag&&this.touch.swipe.disable(),this},this.focus=function(){return this.blured&&(this.blured=!1,this.enabled&&(this.ux(!0),this.enable())),this},this.resize=function(){return setTimeout(b,0),this},this.show=function(t,e){var i=this.getNodeIndex(t,e);return i&&this.showPanel(i.index),this},this.getNodeIndex=function(t,e){var i=g.get({"instance.id":{eq:e},"instance._NAME_":{eq:t}},null,1);return!!i&&{index:i.index}},this.anim=function(t){return void 0===t?l.anim:(l.anim=t,this)},this.drag=function(t){return void 0===t?l.drag:(l.drag!==t&&(l.drag?this.touch.swipe.disable():this.touch.swipe.enable(),l.drag=t),this)},this.dragLeft=function(t){return void 0===t?l.drag_left:(l.drag_left=t,this)},this.dragRight=function(t){return void 0===t?l.drag_right:(l.drag_right=t,this)},this.destroy=function(){a&&clearInterval(a),l.dots&&r.destroy()},this.val=function(t){return void 0===t?o:(this.showPanel(t),this)},this.prev=function(){return o>0&&this.showPanel(o-1),this},this.next=function(){return o+1<f&&this.showPanel(o+1),this},this.panels=function(){return g},this.addNode=function(t,n,a,r){void 0===a&&(a=!1),void 0===r&&(r=!1);var o=function(t){void 0===t&&(t="");return f++,i.append('<div class="'+_+'_view" style="width:'+100/f+'%;" data-ogx-panel-id="'+h+'">'+t+"</div>"),i.css("width",Math.round(100*f)+"%"),i.children("."+_+"_view").css("width",100/f+"%"),++h-1}(),l="."+_+'[data-ogx-id="'+this.id+'"] > .'+_+"_views > ."+_+'_view[data-ogx-panel-id="'+o+'"]',c={},d=l;if(t.hasOwnProperty("_NAME_"));else{for(var u in t){d+=":"+u.split(":")[1],c[d]=t[u];break}var g=null;setTimeout((function(){s.observe(!0,{childList:!0,subtree:!0},(function(){s.observe(!1),g&&clearTimeout(g),g=setTimeout(G,20),a&&s.showPanel(f-1,r)})),OGX.OML.render(s,c,n)}),0)}return e.trigger(OGX.Carousel.ADDED,f),this},this.removeNode=function(t){for(var e=0;e<g.length;e++)if(g[e].instance.id===t)return this.removePanel(e),!0;return!1},this.showPanel=function(t,e,i){if((void 0===i&&(i=!1),t>=0&&t<f&&!u)&&((a=o)!==t||i)){void 0===e&&(e=l.anim),o!==t&&p(o);var n=100/f*(-1*t),a=t;return setTimeout((function(){O(n,a,e)}),0),o=t,l.dots&&r.select(t),!0}return!1},this.getPanel=function(t){return g.get({index:{eq:t}},null,1)},this.swapPanels=function(t,n){var a=i.children("."+_+"_view:eq("+t+")").detach();n>t?i.children("."+_+"_view:eq("+(n-1)+")").after(a):i.children("."+_+"_view:eq("+n+")").before(a);var r=100/f*(-1*n);return i.removeClass(_+"_anim"),i.css({transform:"translate3d("+r+"%, 0, 0)"}),o=n,setTimeout(G,0),e.trigger(OGX.Carousel.CHANGE,o),this},this.removePanel=function(t,n){if(void 0===n&&(n=!0),t>=0&&t<f){var a=null;if(n&&(n="remove"),i.children("."+_+"_view:eq("+t+")").children().data("ogx-id")){var r=g[t];r.instance&&(a=this.find(r.instance._NAME_,r.instance.id,n))&&(n||a.detach()),g.splice(t,1)}return f--,i.children("."+_+"_view:eq("+t+")").remove(),i.removeClass(_+"_anim").css("width",Math.round(100*f)+"%"),i.children("."+_+"_view").css("width",100/f+"%"),t>=o?t--:t=o,t<0&&(t=0),s.showPanel(t,!1,!0),e.trigger(OGX.Carousel.REMOVED,f),a}return!1},this.empty=function(){return this.clear(),i.empty(),i.removeClass(_+"_anim").css("width","100%"),i.css({transform:"translate3d(0%, 0, 0)"}),f=0,g=new OGX.List,l.index=0,l["node:OML"]=[],this},this.render=function(t,e){return l["node:OML"]=t,f=l["node:OML"].length,X(),OGX.OML.render(this,l["node:OML"],e),this},OGX.Data.merge(l,c,!1),l.dots&&("boolean"==typeof l.dots&&(l.dots={}),OGX.Data.merge(l.dots,d)),o=l.index,s.el=e=$(l.el),n=Math.floor(e.innerWidth()),l.hasOwnProperty("node:OML")&&(f=l["node:OML"].length),function(){e.addClass(_);var t="";l.dots&&"top"===l.dots.position&&(t+='<div class="carousel_dots"></div>'),t+='<div class="'+_+'_views" style="width:'+100*f+'%;"></div>',l.dots&&"bottom"===l.dots.position&&(t+='<div class="carousel_dots"></div>'),e.append(t),(i=e.find("."+_+"_views").first()).css({transform:"translate3d("+100/f*(-1*o)+"%, 0, 0)"})}(),l.dots&&(r=s.create("Dots",{el:"."+_+'[data-ogx-id="'+s.id+'"] > .carousel_dots',total:f})).bind("dots",s),X(),s.touch.swipe.set({x:!0,cb_down:v,cb_swipe:y,cb_up:x,capture:l.capture}),l.drag||s.drag(!1)},OGX.Carousel.NAME="Carousel",OGX.Carousel.READY="CarouselReady",OGX.Carousel.DRAG="CarouselDrag",OGX.Carousel.CHANGE="CarouselChange",OGX.Carousel.RESTORE="CarouselRestore",OGX.Carousel.ADDED="CarouselAdded",OGX.Carousel.REMOVED="CarouselRemoved",void 0===OGX)var OGX={};require("Chat","Uxi","Touch"),OGX.Chat=function(__config){construct(this,"Chat");var that=this,config=__config,config_default={placeholder:"Type a message",dot_speed:600,on_keyb_update_delay:300,messages:[],handle_keyboard:!0,hide_keyboard_on_send:!1,emojis:!1,template_left:'<div class="ogx_chat_message ogx_chat_message_left" style="{{$opacity}} data-id="{{$uid}}"><span class="ogx_chat_message_icon" style="{{$bg}}"><span>{{$letter}}</span></span><span class="ogx_chat_message_container"><span class="ogx_chat_message_body">{{$body}}</span><span class="ogx_chat_message_date">{{$date}}</span><span style="clear:both"></span></span></div>',template_right:'<div class="ogx_chat_message ogx_chat_message_right" style="{{$opacity}}" data-id="{{$uid}}"><span class="ogx_chat_message_container"><span class="ogx_chat_message_body">{{$body}}</span><span class="ogx_chat_message_date">{{$date}}</span><span style="clear:both"></span></span></div>',key:"_id",from_key:"from",users:[],user:!1,display_mode:OGX.Chat.DISPLAY_INITIALS,picture_key:"",restrict:{multiline:!1,length:500,allowed:/./},date_format:"YYYY-MM-DD h:mm:ss A",url_encode:!0},emojis_default={template:'<span class="ogx_chat_emoji">{{$emoji}}</span>',button:!1,list:[],map:{emoji:"char",search:"name"}},container,inner,scroller,composer,emojis,emoji_list,intv,oldh=!1,typing={},type=".",enabled=!1;function render(){if(config.messages.length>0){for(var t=0;t<config.messages.length;t++)addMessage(config.messages[t]);scroller.resize(),scroller.bottom()}scroller.vocal()}function addMessage(__msg,__prepend){void 0===__prepend&&(__prepend=!1),scroller.observe(!1),scroller.mute();var u=config.users.find(config.key,__msg[config.from_key],1);if(u){var initals=u.first_name.substr(0,1).toUpperCase()+u.last_name.substr(0,1).toUpperCase();switch(config.display_mode){case OGX.Chat.DISPLAY_INITIALS:__msg.letter=initals,__msg.bg="";break;case OGX.Chat.DISPLAY_PICTURE:__msg.letter="";var e=eval("u."+config.picture_key);"undefined"!==e?__msg.bg="background-image:url('"+e+"')":(__msg.letter=initals,__msg.bg="")}__msg.uid=u[config.key],__msg.opacity=__prepend?"opacity:1;":"",config.url_encode&&(__msg.body=decodeURIComponent(__msg.body));var html=OGX.Templater.make(getTemplate(__msg),__msg);__prepend?inner.prepend(html):inner.append(html);var msg=inner.children(".ogx_chat_message:last");setTimeout((function(){msg.addClass("ogx_chat_message_anim"),scroller.resize(),__prepend||scroller.bottom(),scroller.vocal(),scroller.observe(!0)}),100)}}function addTyping(t){typing[t]=!0;var e='<div class="ogx_chat_typing" data-user="'+t+'"><span class="ogx_chat_typing_body">.</div></div>';inner.append(e),animTyping(!0)}function removeTyping(t){typing[t]=!1,inner.find('.ogx_chat_typing[data-user="'+t+'"]').remove(),0===inner.find(".ogx_chat_typing").length&&animTyping(!1)}function animTyping(t){t?intv||(intv=setInterval(typeDot,config.dot_speed)):(clearInterval(intv),intv=null)}function typeDot(){(type+=".").length>3&&(type="."),inner.find(".ogx_chat_typing_body").html(type)}function getTemplate(t){return t[config.from_key]===config.user?config.template_right:config.template_left}function sendMessage(){var t=composer.find("textarea").val();if(t.length&&(t=(t=(t=t.replace(/^[\r|\n\r]+/,"")).replace(/<\/?[^>]+(>|$)/g,"")).replace(/’/,"'")).length){var e={body:t=t.replace(/[\r\n]/g,"<br>"),date:moment().format(config.date_format)};e[config.from_key]=config.user,addMessage(e);var i=OGX.Data.clone(e);config.url_encode&&(i.body=encodeURIComponent(i.body)),delete i.bg,delete i.letter,composer.find("textarea").val(""),that.el.trigger(OGX.Chat.SEND_MESSAGE,i)}}function handleShowKeyb(t){oldh||(oldh=container.height()),container.height(oldh-t.keyboardHeight),updateScroller()}function handleHideKeyb(){container.height(oldh),updateScroller()}function updateScroller(){setTimeout((function(){scroller.resize(),scroller.bottom()}),config.on_keyb_update_delay)}function renderEmojis(){var t,e=[];config.emojis.list=config.emojis.list.slice(0,250);for(var i=0;i<config.emojis.list.length;i++)for(var n in t=OGX.Data.clone(config.emojis.list[i]),config.emojis.map)t[n]=t[config.emojis.map[n]],e.push(t);(emoji_list=that.create("DynamicList",{el:'.ogx_chat[data-ogx-id="'+that.id+'"] .ogx_chat_emojis_list',key:"codes",scroll:!0,display:{html:"{{$emoji}}",css:"ogx_chat_emoji"},list:e})).bind({object:'.ogx_chat[data-ogx-id="'+that.id+'"] .ogx_chat_emoji_search',property:config.emojis.map.search,mode:"in"})}function showEmojis(t){t?emojis.removeClass("ogx_chat_emojis_hidden"):emojis.addClass("ogx_chat_emojis_hidden"),listenEmojis(t)}function listenEmojis(t){t?emojis.on(that.touch.down,".ogx_chat_emoji",(function(t){var e=that.el.find(".ogx_chat_composer .ogx_chat_composer_input textarea"),i=e.val()+$(this).text();e.val(i)})):emojis.off(that.touch.down,".ogx_chat_emoji")}function listenKeyb(t){t?(window.addEventListener("native.keyboardshow",handleShowKeyb),window.addEventListener("native.keyboardhide",handleHideKeyb)):(window.removeEventListener("native.keyboardshow",handleShowKeyb),window.removeEventListener("native.keyboardhide",handleHideKeyb))}function listenArea(t){t?composer.on("keyup","textarea",(function(t){13===t.which&&(sendMessage(),config.hide_keyboard_on_send&&handleHideKeyb())})):composer.off("keyup","textarea")}function listenComposer(t){t?(composer.on("click",".ogx_chat_composer_send",(function(){sendMessage(),config.hide_keyboard_on_send&&handleHideKeyb()})),config.emojis&&composer.on("click",".ogx_chat_composer_emoji",(function(){showEmojis(emojis.hasClass("ogx_chat_emojis_hidden"))}))):(composer.off("click",".ogx_chat_composer_send"),config.emojis&&composer.off("click",".ogx_chat_composer_emoji"))}function initScroller(){scroller=that.create("Scroller",{el:that.el.find(".ogx_chat_messages")[0],initDelay:100,auto_scroll:!0,trigger:!0}),inner=scroller.inner(),(inner=$(inner)).addClass("ogx_chat_messages_inner"),scroller.mute(),scroller.resize(),render()}function initMarkup(){var t='<div class="ogx_chat_messages"></div>';config.emojis&&(t+='<div class= "ogx_chat_emojis ogx_chat_emojis_hidden"><input class="ogx_chat_emoji_search" type="text" placeholder="search"><span class="ogx_chat_emojis_list"></span></div>'),t+='<div class="ogx_chat_composer">',t+='<span class="ogx_chat_composer_input"><textarea placeholder="'+config.placeholder+'">',t+="</textarea></span>",config.emojis&&(t+='<span class="ogx_chat_composer_emoji"></span>'),t+='<span class="ogx_chat_composer_send"></span></div>',container.append(t),composer=container.find(".ogx_chat_composer"),config.emojis&&(emojis=container.find(".ogx_chat_emojis"),setTimeout(renderEmojis,10))}function initUsers(){for(var t in config.users)typing[t]=!1}function initDefaults(){config.hasOwnProperty("emojis")&&config.emojis&&(OGX.Data.merge(config.emojis,emojis_default,!1),config.emojis.list=new OGX.List(config.emojis.list)),OGX.Data.merge(config,config_default,!1),config.users.hasOwnProperty("find")||(config.users=new OGX.List(config.users)),that.el=container=$(config.el),container.addClass("ogx_chat")}function init(){if(initDefaults(),initMarkup(),initUsers(),initScroller(),config.restrict){var t=OGX.Data.clone(config.restrict);config.restrict.hasOwnProperty("forbidden")&&(t.forbidden=config.restrict.forbidden),config.restrict.hasOwnProperty("allowed")&&(t.allowed=config.restrict.allowed),t.el=that.el.find(".ogx_chat_composer .ogx_chat_composer_input textarea")[0],OGX.Form.restrictField(t)}that.enable()}this._NAME_=OGX.Chat.NAME,this.el=null,this.enable=function(){return enabled||(enabled=!0,config.handle_keyboard&&listenKeyb(!0),listenComposer(!0),listenArea(!0)),this},this.disable=function(){return this.el.find(".ogx_chat_composer .ogx_chat_composer_input textarea").trigger("blur"),enabled&&(enabled=!1,config.handle_keyboard&&listenKeyb(!1),listenComposer(!1),listenArea(!1)),this},this.users=function(t){return void 0!==t?(t.hasOwnProperty("find")||(t=new OGX.List(t)),config.users=t,!0):config.users},this.user=function(t){return void 0===t?config.user:(config.user=t,this)},this.typing=function(t,e){return t&&!typing[e]?addTyping(e):!t&&typing[e]&&removeTyping(e),this},this.compose=function(t){return composer.find("textarea").val(t),this},this.clear=function(){return inner.empty(),this},this.getScroller=function(){return scroller},this.addMessage=function(t){return addMessage(t),this},this.setMessages=function(t){return config.messages=t,render(),this},this.prependMessages=function(t){for(var e=this.el.find(".ogx_scroller_outer").first(),i=inner.height(),n=e.scrollTop(),a=0;a<t.length;a++)addMessage(t[a],!0);config.messages=t.concat(config.messages);var r=inner.height();return this.el.find(".ogx_scroller_outer").scrollTop(n+(r-i)),this},this.destroy=function(){config.restrict&&OGX.Form.unrestrictField(that.el.find(".ogx_chat_composer .ogx_chat_composer_input textarea")[0])},init()},OGX.Chat.NAME="Chat",OGX.Chat.SEND_MESSAGE="ChatSend",OGX.Chat.DISPLAY_INITIALS="ChatDisplayInitials",OGX.Chat.DISPLAY_PICTURE="ChatDisplayPicture",OGX.Color={},OGX.Color.hexToRgb=function(t){"use strict";t=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(t,e,i,n){return e+e+i+i+n+n}));var e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:null},OGX.Color.rgbToHex=function(t,e,i){"use strict";return"#"+((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},OGX.Color.rgbToHsl=function(t){"use strict";var e,i,n,a=new RegExp("rgb\\(([0-9]+)\\, ([0-9 ]+)\\, ([0-9]+)","g").exec(t);if(a){a.shift(),e=a[0],i=a[1],n=a[2],e/=255,i/=255,n/=255;var r,o,s=Math.max(e,i,n),l=Math.min(e,i,n),c=(s+l)/2;if(s===l)r=o=0;else{var d=s-l;switch(o=c>.5?d/(2-s-l):d/(s+l),s){case e:r=(i-n)/d+(i<n?6:0);break;case i:r=(n-e)/d+2;break;case n:r=(e-i)/d+4}r/=6}return[r,o,c]}return!1},OGX.Color.hslToRgb=function(t,e,i){"use strict";var n,a,r;if(0===e)n=a=r=i;else{var o=function(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t},s=i<.5?i*(1+e):i+e-i*e,l=2*i-s;n=o(l,s,t+1/3),a=o(l,s,t),r=o(l,s,t-1/3)}return[Math.round(255*n),Math.round(255*a),Math.round(255*r)]},require("Container","Uxi"),OGX.Container=function(t){construct(this,"Container");var e=this,i={tabs:!0,carousel:{enabled:!0},enabled:!0,reorder:!0,anim:!0,flatten:!1,chromeos:!1,index:0,dots:!1},n=t,a=!1,r="normal",o=0;function s(t){t?(e.tabs.el.on(OGX.Tabs.SELECT,(function(t,i){var n=e.tabs.index();e.carousel.val(n),e.el.trigger(OGX.Container.CHANGE,n)})),e.tabs.el.on(OGX.Tabs.CLOSE,(function(){})),e.tabs.el.on(OGX.Tabs.REORDER,(function(t,i){e.carousel.swapPanels(i.from,i.to)})),e.tabs.el.on(OGX.Tabs.ADD,(function(){})),e.carousel.el.on(OGX.Carousel.CHANGE,(function(t,i){e.tabs.index(i),e.el.trigger(OGX.Container.CHANGE,i)}))):(e.tabs.el.off(OGX.Tabs.SELECT),e.tabs.el.off(OGX.Tabs.CLOSE),e.tabs.el.off(OGX.Tabs.REORDER),e.tabs.el.off(OGX.Tabs.ADD),e.carousel.el.off(OGX.Carousel.CHANGE)),l(t)}function l(t){t?e.tabs.el.on(OGX.Tabs.REMOVE,(function(t,i){l(!1);var n=e.el.parents(".ogx_popup").first().data("ogx-id");n=app.cfind("Popup",n),app.ungroupPopup(n,i.index,i.label),setTimeout((function(){l(!0)}),200)})):e.tabs.el.off(OGX.Tabs.REMOVE)}this.carousel=null,this.tabs=null,this.el=null,this._NAME_=OGX.Container.NAME,this.construct=function(){this.carousel=this.find(OGX.Carousel.NAME,this.id+"_carousel")},this.show=function(t,e){if(this.carousel&&"normal"===r){var i=this.carousel.getNodeIndex(t,e);i&&(this.carousel.val(i.index),n.tabs&&this.tabs.index(i.index))}},this.index=function(t){return this.carousel&&"normal"===r&&(this.carousel.val(t),n.tabs&&this.tabs.index(t)),this},this.enable=function(){return n.tabs&&this.carousel&&s(!0),this},this.disable=function(){return n.tabs&&this.carousel&&s(!1),this},this.resize=function(){var t,e,i;return n.flatten&&(this.carousel&&"flattened"!==r&&this.el.width()>=n.flatten?(r="flattened",n.tabs&&(this.tabs.blur(),this.tabs.hide()),this.carousel.blur(),o=(t=this.carousel.el.children(".ogx_carousel_views"),e=t[0].style.transform,i=/translate3d\(([0-9px%,\.\- ]+)\)/,e=(e=e.match(i))[1].split(","))[0],this.carousel.el.children(".ogx_carousel_views").addClass("ogx_container_flattened").css("transform","translate3d(0px, 0px, 0px)")):this.carousel&&"flattened"===r&&this.el.width()<n.flatten&&(r="normal",n.tabs&&(this.tabs.focus(),this.tabs.show()),this.carousel.focus(),this.carousel.el.children(".ogx_carousel_views").removeClass("ogx_container_flattened").css("transform","translate3d("+o+", 0px, 0px)"))),this},this.empty=function(){return this.carousel.empty(),this.tabs.empty(),this},function(){OGX.Data.merge(n,i,!1),OGX.Data.merge(n.carousel,i.carousel,!1),n.tabs&&"object"!=typeof n.tabs&&(n.tabs={}),e.el=a=$(n.el),a.addClass("ogx_container");var t=!1;n.tabs&&(!function(){var t={el:'.ogx_container[data-ogx-id="'+e.id+'"]',reorder:n.reorder,editable:!1,chromeos:n.chromeos,enabled:n.enabled,index:n.index};if(!0===n.tabs){n.tabs=[];for(var i=0;i<n["node:OML"].length;i++)for(var a in n["node:OML"][i])n["node:OML"][i][a].hasOwnProperty("title")&&n.tabs.push({label:n["node:OML"][i][a].title})}t=OGX.Data.merge(n.tabs,t),e.tabs=e.create("Tabs",t)}(),t="ogx_carousel_shink");var r=n["node:OML"].slice(),o={},s='.ogx_container[data-ogx-id="'+e.id+'"]:Carousel';o["node:OML"]={},o["node:OML"][s]={id:e.id+"_carousel",css:t,anim:n.anim,chromeos:n.chromeos,drag:n.carousel.drag,enabled:n.carousel.enabled,index:n.index,dots:n.dots,"node:OML":r},n["node:OML"]=o["node:OML"],setTimeout((function(){e.resize()}),0)}()},OGX.Container.NAME="Container",OGX.Container.CHANGE="ContainerChange",require("Controller","Touch"),OGX.Controller=function(t){construct(this,"Controller");t=OGX.Data.merge(t,{enabled:!0,blured:!0,always_on:!1}),this.el=!1,this.enabled=t.enabled,this.blured=t.blured,this.floating=!1,this.always_on=t.always_on,this.id=t.id,this._CLASS_=t._sub_,delete t._sub_,this._NAME_=OGX.Controller.NAME},OGX.Controller.prototype.blur=function(){return this.always_on||this.blured||(this.blured=!0,this.ux(!1),this.disable()),this},OGX.Controller.prototype.focus=function(){return this.blured&&(this.blured=!1,this.enabled&&(this.ux(!0),this.enable())),this},OGX.Controller.prototype.construct=function(){},OGX.Controller.prototype.enable=function(){},OGX.Controller.prototype.disable=function(){},OGX.Controller.prototype.ux=function(){},OGX.Controller.prototype.resize=function(){},OGX.Controller.prototype.clear=function(){},OGX.Controller.prototype.destroy=function(){},OGX.Controller.prototype.kill=function(){OGX.Object.destroy(this)},OGX.Controller.NAME="Controller",OGX.Display=function(t){"use strict";var e,i,n={display:!1,displays:!1},a={html:!1,css:!1,oml:!1,placeholder:!1,template:!1,view:!1,bind_css:!1,add_css:!1,calc_css:!1,bind_template:!1,calc_template:!1};function r(t,e){return-1!==t.indexOf("{{")?OGX.OSE.exec(t,e):t}function o(t){if(e.display&&(!e.display.hasOwnProperty("bind")||!e.display.bind))return OGX.Data.merge(e.display,{},!0,!1,!1);if(e.displays&&e.display.hasOwnProperty("bind")&&e.display.bind){if(t.hasOwnProperty(e.display.bind)){var i=t[e.display.bind];return OGX.Data.merge({},e.displays[i],!0,!1,!1)}if(e.displays.hasOwnProperty("__default"))return OGX.Data.clone(e.displays.__default)}return!1}function s(t){var e=OGX.Data.merge(a,t,!0,!0,!1);return e.template&&("object"==typeof e.template?(e.template.hasOwnProperty("conditions")&&(e.calc_template=!0),e.template.hasOwnProperty("bind")&&(e.bind_template=!0)):0===e.template.indexOf("{{")?e.calc_template=!0:(e.html=OGX.Templater.get(e.template),e.template=!1)),e.css&&(e.bind_css="object"==typeof e.css&&e.css.hasOwnProperty("bind"),e.add_css="object"==typeof e.css&&e.css.hasOwnProperty("add"),e.calc_css="object"==typeof e.css&&e.css.hasOwnProperty("conditions")),e}function l(t){if(void 0===t&&(t={}),e=OGX.Data.clone(n),!t.hasOwnProperty("display")&&!t.hasOwnProperty("displays"))return e.display=OGX.Data.merge(a,t,!0,!0,!1),e.display=s(e.display),void(i=o());if(t.hasOwnProperty("display")&&t.display&&!t.display.hasOwnProperty("bind"))return e.display=OGX.Data.merge(a,t.display,!0,!0,!1),e.display=s(e.display),void(i=o());if(t.hasOwnProperty("display")&&t.display&&t.display.hasOwnProperty("bind")&&t.hasOwnProperty("displays")&&t.displays&&(e.display=t.display,e.displays=OGX.Data.clone(t.displays)),e.displays)for(var r in e.displays)e.displays[r]=OGX.Data.merge(a,e.displays[r],!0,!0,!0),e.displays[r]=s(e.displays[r])}this._NAME_=OGX.Display.NAME,this.val=function(t){if(void 0===t)return OGX.Data.clone(e);l(t)},this.display=function(t){return e.displays&&e.displays.hasOwnProperty(t)?(i=e.displays[t],!0):i},this.css=function(t){var e,n="",a=void 0!==t;if((e=a?o(t):i)&&(e.bind_css&&a?n+=t[r(e.css.bind,t)]:e.css&&"string"==typeof e.css&&(n=r(e.css,t)),e.add_css&&(n+=" "+r(e.css.add,t)),e.calc_css&&a))for(var s,l,c=0;c<e.css.conditions.length;c++)if(OGX.OSE.exec(e.css.conditions[c][0],t)&&((s=e.css.conditions[c][1]).hasOwnProperty("css")&&(n=r(s.css,t)),s.hasOwnProperty("add")&&(n+=" "+r(s.add,t)),s.hasOwnProperty("remove"))){l=s.remove.explode(" ");for(var d=0;d<l.length;d++)n=n.replace(r(l[d],t),"")}return n||""},this.html=function(t){var e,n=!1,a=void 0!==t;return(e=a?o(t):i)&&(e.bind_template&&a?n=OGX.Templater.get(t[e.template.bind]):(e.template||e.html)&&(n=e.html),a&&n&&(n=OGX.Templater.make(n,t))),n||(n=""),n},this.oml=function(t,e,n){void 0===n&&(n="&item");var a={},r=o(e);if(r||(r=i),r){if(r.oml)return a=OGX.OML.rename(OGX.Data.clone(r.oml),t),void 0!==n&&OGX.OML.replaceDataRecursive(a,e,n),r.placeholder?function(t,e,i){var n,a,r=OGX.Data.clone(t.oml);for(var o in r){var s,l;for(var c in r[n=o.replace("default",e)]=r[o],r[n]["node:OML"]=[],t.placeholder){l=i[c].length;for(var d=0;d<l;d++){for(var u in s=OGX.Data.clone(t.placeholder[c]),(a=OGX.Data.clone(i))[c]=a[c][d],s){s[u].data=a;break}r[n]["node:OML"].push(s)}return delete r[o],r}}return!1}(r,t,e):a;if(r.template){if("string"==typeof r.template)if(0===r.template.indexOf("{{")){debug(2,"Draft, undocumented features.");var s=OGX.OSE.exec(r.template,e);s&&(a[t+":Templates."+s]={data:e})}else a[t+":Templates."+r.template]={data:e};else r.bind_template&&(a[t+":Templates."+e[r.template.bind]]={data:e});return a}if(r.hasOwnProperty("html"))return a[t+":Html"]={html:this.html(e)},a}return!1},this.hasOML=function(){return!1!==i.oml},this.toJSON=function(){return e},l(t)},OGX.Display.NAME="Display",require("Dots","Uxi","Touch"),OGX.Dots=function(t){construct(this,"Dots");var e,i=this,n=t,a={el:"document",total:0,current:0,clickable:!0},r={};function o(t){switch(r[t]._NAME_){case OGX.Carousel.NAME:r[t].el.off(OGX.Carousel.CHANGE,s),r[t].el.off(OGX.Carousel.ADDED+" "+OGX.Carousel.REMOVED,l),delete r[t];break;case OGX.Iceberg.NAME:r[t].el.off(OGX.Iceberg.SHOW,s),delete r[t]}}function s(t,e){i.select(e)}function l(t,e){n.total=e,d()}function c(t){t?e.on(i.touch.down,".ogx_dots_item",(function(){var t=Number($(this).data("id"));i.select(t),e.trigger(OGX.Dots.SELECT,t),function(t){for(var e in r)switch(r[e]._NAME_){case OGX.Carousel.NAME:r[e].val(t)}}(t)})):e.off(i.touch.down)}function d(){for(var t,i="",a=0;a<n.total;a++)t="",n.current===a&&(t="ogx_dots_selected"),i+='<div class="ogx_dots_item" data-id="'+a+'"><span class="ogx_dots_gfx '+t+'"></span></div>';e.html(i)}this._NAME_=OGX.Dots.NAME,this.el=null,this.enable=function(){n.clickable&&c(!0)},this.disable=function(){n.clickable&&c(!1)},this.bind=function(t,e){return!(r.hasOwnProperty(t)||!e.hasOwnProperty("_NAME_"))&&function(t,e){switch(r[t]=e,e._NAME_){case OGX.Carousel.NAME:n.total=e.panels().length,n.current=e.val(),e.el.on(OGX.Carousel.CHANGE,s),e.el.on(OGX.Carousel.ADDED+" "+OGX.Carousel.REMOVED,l);break;case OGX.Iceberg.NAME:n.total=e.panels().length,n.current=e.val(),e.el.on(OGX.Iceberg.SHOW,s)}return!0}(t,e)},this.unbind=function(t){return!!r.hasOwnProperty(t)&&o(t)},this.select=function(t){e.find(".ogx_dots_selected").removeClass("ogx_dots_selected"),e.children(".ogx_dots_item:eq("+t+")").children(".ogx_dots_gfx").first().addClass("ogx_dots_selected"),n.current=t},this.destroy=function(){!function(){for(var t in r)o(t)}()},OGX.Data.merge(n,a),i.el=e=$(n.el),e.addClass("ogx_dots"),d()},OGX.Dots.NAME="Dots",OGX.Dots.SELECT="DotsSelect",require("DynamicList","Uxi","Bind","Touch"),OGX.DynamicList=function(t){construct(this,"DynamicList");var e,i,n,a,r=this,o=t,s={el:null,key:!1,as:"item",display:!1,displays:!1,reorder:!1,swipe:!1,reselect:!1,chromeos:!1,min_x:30,click_time:100,hold_time:2e3,interval:5,list:[],selection:[],mode:OGX.DynamicList.SELECT_MODE_SINGLE,trigger:!1,scope:!0,swipe_template:'<div class="ogx_dynamic_list_item ogx_dynamic_list_swiper_back_item" style="height:{{$height}}px; z-index:{{$zindex}}; margin-bottom:{{$margin}}px;">{{$template}}</div>',zindex:1},l={mode:OGX.DynamicList.SWIPE_MODE_DELETE,options:{},template:!1,html:""},c=new OGX.List,d=1,u="__id__",h={mode:!1,stime:0,target:0,si:0,ei:0,y:0},f=null,g=null,_=null,p=0,m=new OGX.Display(o),v=!1,y=!1;function x(t,e,i){if(m.hasOML()){var n,a,s=m.oml('.ogx_dynamic_list[data-ogx-id="'+r.id+'"] > .ogx_dynamic_list_item[data-ogx-id="'+i[e]+'"]',i,o.as);$('.ogx_dynamic_list[data-ogx-id="'+r.id+'"] > .ogx_dynamic_list_item[data-ogx-id="'+i[e]+'"]').find(".ogx_uxi").each((function(t,e){n=$(e).data("ogx-id"),(a=r.cfind(!1,n,1))&&r.find(a._NAME_,a.id,"remove")})),OGX.OML.render(r,s,i)}else{var l="";c.length&&c.find(e,i[e],1)&&(l="ogx_dynamic_list_selected_item "),t.attr("class","").addClass("ogx_dynamic_list_item "+l+m.css(i)),t.html(m.html(i))}}function O(){var t=W(),i=c;n&&(c.resetFilters(),c.setFilters(o.list.getFilters()),(i=c.filter()).length!==c.length&&(i.length?e.trigger(OGX.DynamicList.SELECT,i):e.trigger(OGX.DynamicList.UNSELECT)));for(var s,l,d,u="",h=[],f=0;f<t.length;f++)(!o.scope||!t[f].hasOwnProperty("scope")||o.scope&&OGX.Scope.eval(t[f].scope))&&(!1,l="",s=t[f][a],c.find(a,s,1)&&(l="ogx_dynamic_list_selected_item"),m.html(t[f]),u+='<div class="ogx_dynamic_list_item '+l+" "+m.css(t[f])+'" data-ogx-id='+s+"></div>",d=m.oml('.ogx_dynamic_list[data-ogx-id="'+r.id+'"] .ogx_dynamic_list_item[data-ogx-id="'+s+'"]',t[f],o.as),h.push(d));e.html(u),function(t){for(var e=0;e<t.length;e++)r.parse(t[e])}(h),o.trigger&&e.trigger(OGX.DynamicList.RENDER)}function b(t){t?$(document).on(OGX.Scope.CHANGE,w):$(document).off(OGX.Scope.CHANGE,w)}function w(){r.render()}function G(t){void 0!==e&&v&&(t?e.on("click",".ogx_dynamic_list_item",R):e.off("click",".ogx_dynamic_list_item",R))}function X(t){t?e.on(r.touch.down,".ogx_dynamic_list_item",C):e.off(r.touch.down,".ogx_dynamic_list_item",C)}function E(t){t?g=setInterval(S,20):(clearInterval(g),g=null)}function T(t){t?e.on(r.touch.move,".ogx_dynamic_list_item",D):e.off(r.touch.move,".ogx_dynamic_list_item")}function C(t){h.mode=!1,h.target=$(t.currentTarget),h.si=h.target.index(),h.cy=e.offset().top,t=r.event(t),h.startx=t.pageX,h.starty=t.pageY,_&&clearInterval(_),h.stime=(new Date).getTime(),o.reorder&&E(!0),T(!0),$("body").on(r.touch.up,M)}function D(t){t=r.event(t),h.y=-1*(h.starty-t.pageY),h.mx=t.pageX-h.startx,h.px=t.pageX,h.py=t.pageY,h.st=!1,o.swipe&&!h.mode&&Math.abs(h.mx)>o.min_x&&(h.mode="swipe",o.scroll&&!h.st&&(h.st=!0,y.disable(),y.container().css("cssText","height:"+y.container().height()+"px !important;")),o.reorder&&E(!1),L(!0))}function S(){!h.mode&&(new Date).getTime()-h.stime>o.hold_time&&(h.mode="reorder",h.item=o.list.find(a,h.target.data("id").toString(),1),e.trigger(OGX.DynamicList.HOLD,h.item),E(!1),setTimeout(function(){h.tgy=h.target.position().top,h.tgx=h.target.position().left,h.y=0;var t=h.target.outerWidth(),i=h.target.outerHeight();h.clone=h.target.clone().css({position:"absolute",left:h.tgx+"px",top:h.tgy+"px",width:t+"px",height:i+"px"}).addClass("ogx_dynamic_list_reorder").prependTo(e),h.target.addClass("ogx_dynamic_list_frozen"),_=setInterval(P,o.interval),e.on(r.touch.move,Y)}(),0))}function M(t){if($("body").off(r.touch.up,M),(o.reorder||o.swipe)&&(clearInterval(_),_=!1,T(!1)),o.swipe&&L(!1),o.reorder&&E(!1),o.scroll&&(y.enable(),y.container().removeAttr("style")),o.reorder&&"reorder"===h.mode){if(e.off(r.touch.move,Y),h.clone){var i=JSON.parse(JSON.stringify(o.list[h.si]));return o.list.delete(h.si),o.list.insert(i,h.ei),h.clone.remove(),h.clone=!1,h.target.removeClass("ogx_dynamic_list_frozen"),void e.trigger(OGX.DynamicList.DROP,h.item)}if((new Date).getTime()-h.stime<o.click_time){var n=h.target.data("id").toString(),s=o.list.find(a,n,1);e.trigger(OGX.DynamicList.SELECT,s),r.select(a,n)}}else if(o.swipe&&"swipe"===h.mode){var l=h.target.outerWidth(!0),c=Math.abs(100*h.mx/l);c<50?c?(h.target.addClass("ogx_dynamic_list_swiper_trans_item_restore"),h.target.addClass("ogx_dynamic_list_swiper_trans_item").css("transform","translateX(0px)")):(h.target.next(".ogx_dynamic_list_swiper_back_item").remove(),h.target.css("transform","translateX(0px)")):h.mx>0?(h.target.attr("data-side","left"),h.target.addClass("ogx_dynamic_list_swiper_trans_item").css("transform","translateX("+l+"px)")):(h.target.attr("data-side","right"),h.target.addClass("ogx_dynamic_list_swiper_trans_item").css("transform","translateX("+-1*l+"px)"))}h.mode=!1}function L(t){t?f=setInterval(N,o.interval):(clearInterval(f),f=!1)}function N(){if("swipe"===h.mode&&Math.abs(h.mx)>o.min_x){var t=parseInt(h.target.css("border-top-width").split("px")[0]),e=parseInt(h.target.css("border-bottom-width").split("px")[0]),i=h.target.outerHeight();if(!h.target.hasClass("ogx_dynamic_list_swiper_work")){h.target.addClass("ogx_dynamic_list_swiper_work");var n={};n.height=i,n.margin=-2*(t+e),n.top=h.target.position().top,n.zindex=o.zindex;var a="";o.swipe.template?a=OGX.Templater.get(o.swipe.template):o.swipe.html&&(a=o.swipe.html),n.template=a,a=OGX.Templater.make(o.swipe_template,n),h.target.after(a)}if(o.swipe.mode===OGX.DynamicList.SWIPE_MODE_SIDE&&(h.mx<0?(p=1,h.target.next(".ogx_dynamic_list_swiper_back_item").addClass("ogx_dynamic_list_swiper_side_left").removeClass("ogx_dynamic_list_swiper_side_right")):(p=-1,h.target.next(".ogx_dynamic_list_swiper_back_item").addClass("ogx_dynamic_list_swiper_side_right").removeClass("ogx_dynamic_list_swiper_side_left"))),h.py>=h.target.offset().top&&h.py<=h.target.offset().top+i){h.target.css("transform","translateX("+h.mx+"px)");var r=h.target.next(".ogx_dynamic_list_swiper_back_item");h.mx<0?r.addClass("ogx_dynamic_list_swiper_right").removeClass("ogx_dynamic_list_swiper_left"):r.addClass("ogx_dynamic_list_swiper_left").removeClass("ogx_dynamic_list_swiper_right")}else M(h.target)}}function A(t){t?e.on("transitionend",".ogx_dynamic_list_swiper_trans_item",k):e.off("transitionend",".ogx_dynamic_list_swiper_trans_item",k)}function k(t){var i=$(this),n=i.next(".ogx_dynamic_list_swiper_back_item");if(i.hasClass("ogx_dynamic_list_swiper_trans_item_restore"))n.remove(),i.css("transform","translateX(0px)"),i.removeClass("ogx_dynamic_list_swiper_trans_item");else{var a,r=i.index(),s=i.data("ogx-id");switch(o.swipe.mode){case OGX.DynamicList.SWIPE_MODE_DELETE:i.remove(),I(n),a=o.list.findDelete(o.key,String(s),1),e.trigger(OGX.DynamicList.DELETE,{item:a,index:r});break;case OGX.DynamicList.SWIPE_MODE_SIDE:var l;a=o.list.find(o.key,s,1),l=-1===p?"right":"left",e.trigger(OGX.DynamicList.SIDED,{side:l,item:a,index:r});break;case OGX.DynamicList.SWIPE_MODE_CUSTOM:}}i.removeClass("ogx_dynamic_list_swiper_work"),i.removeClass("ogx_dynamic_list_swiper_trans_item_restore")}function I(t,e){t.addClass("ogx_dynamic_list_swiper_delete"),t.on("transitionend",(function(){t.off("transitionend"),t.remove()}))}function Y(t){t.preventDefault(),t.stopImmediatePropagation(),t=r.event(t),h.y=-1*(h.starty-t.pageY)}function P(){if(Math.abs(e.offset().top-h.cy)>1)return clearInterval(_),_=!1,h.clone.remove(),h.clone=!1,h.target.removeClass("ogx_dynamic_list_frozen"),void e.trigger(OGX.DynamicList.RELEASE);var t=!1,i=e.children(".ogx_dynamic_list_item:last"),n=i.offset().top+-1*h.cy;if(h.tgy+h.y<n?h.clone.css({top:h.tgy+h.y}):t=i,!t){var r,s,l,c,d=0;e.children(".ogx_dynamic_list_item").each((function(e,i){if((i=$(i))[0]!==h.clone[0]&&!i.hasClass("ogx_dynamic_list_frozen")){if(r=i.offset().top,s=i.outerHeight(),c=r+s/2,(l=h.clone.offset().top)>r&&l<c)return d=-1,void(t=i);if(l>c&&l<r+s)return d=1,void(t=i)}}))}if(t){switch(h.ei=o.list.findIndex(a,$(t).data("id").toString()).index,d){case-1:t.index()-1!==h.target.index()&&h.target.detach().insertBefore(t);break;case 1:t.index()+1!==h.target.index()&&h.target.detach().insertAfter(t)}t=!1}}function R(t){var i,n=$(this);switch(o.mode){case OGX.DynamicList.SELECT_MODE_SINGLE:!o.reselect&&n.hasClass("ogx_dynamic_list_selected_item")||n.hasClass("ogx_dynamic_list_swiper_trans_item")||(i=z(n.index(),!0),e.trigger(OGX.DynamicList.SELECT,i));break;case OGX.DynamicList.SELECT_MODE_TOGGLE:n.hasClass("ogx_dynamic_list_selected_item")||n.hasClass("ogx_dynamic_list_swiper_trans_item")?(i=z(n.index(),!1),e.trigger(OGX.DynamicList.UNSELECT,i)):(r.resetSelection(),i=z(n.index(),!0),e.trigger(OGX.DynamicList.SELECT,i));break;case OGX.DynamicList.SELECT_MODE_MULTI:n.hasClass("ogx_dynamic_list_selected_item")||n.hasClass("ogx_dynamic_list_swiper_trans_item")?(i=z(n.index(),!1),e.trigger(OGX.DynamicList.UNSELECT,i)):(i=z(n.index(),!0),e.trigger(OGX.DynamicList.SELECT,i));break;case OGX.DynamicList.SELECT_MODE_HIT:var a=W();if(n.hasClass("ogx_dynamic_list_swiper_back_item")){var s="left";n.hasClass("ogx_dynamic_list_swiper_side_right")&&(s="right"),e.trigger(OGX.DynamicList.BACK_HIT,{side:s,item:a[n.index()]})}else e.trigger(OGX.DynamicList.SELECT,a[n.index()])}}function H(t,i,n){var s=null;"single"===o.mode&&(r.resetSelection(),s=1);var l,d=W(),u={};Array.isArray(i)?(u[a]={in:i},sel=d.get(u,null,s)):(u[a]={eq:i},sel=d.get(u)),sel&&!Array.isArray(sel)&&(sel=[sel]);for(var h=0;h<sel.length;h++)(l=e.find('.ogx_dynamic_list_item[data-ogx-id="'+sel[h][a]+'"]'))&&(n?(l.addClass("ogx_dynamic_list_selected_item"),c.push(sel[h])):l.removeClass("ogx_dynamic_list_selected_item"));return"single"===o.mode&&sel.length?sel[0]:sel}function z(t,i){var n,s,l=W();if((n=e.find(".ogx_dynamic_list_item:eq("+t+")")).length>0){o.mode===OGX.DynamicList.SELECT_MODE_SINGLE&&r.resetSelection();var d=n.data("ogx-id");return o.key&&"string"!=typeof l[0][a]||(d=String(d)),s=l.find(a,d,1),i?(n.addClass("ogx_dynamic_list_selected_item"),c.push(l[t])):(n.removeClass("ogx_dynamic_list_selected_item"),c.findDelete(a,d,1)),s}return!1}function W(){return n?i:o.list}function j(){for(var t=0;t<o.list.length;t++)o.list[t][a]=String(d),d++}function U(t){for(var e=0;e<t.length;e++)delete t[e][a];return t}this._NAME_=OGX.DynamicList.NAME,this.el=null,this.enable=function(t){return void 0===t&&(t=!1),(t||o.mode!==OGX.DynamicList.STATIC)&&(this.touch.enable(),G(!0),(o.reorder||o.swipe)&&(X(!0),o.swipe&&A(!0))),this},this.disable=function(t){return void 0===t&&(t=!1),(t||o.mode!==OGX.DynamicList.STATIC)&&(this.touch.disable(),G(!1),(o.reorder||o.swipe)&&(X(!1),o.swipe&&A(!1))),this},this.bindFilter=function(t,e,a){void 0!==a&&(o.list.removeFilter(t),o.list.addFilter(t,e,a)),o.list.getFilters()&&(i=o.list.filter(),n=!0),setTimeout(O,0)},this.unbindFilter=function(t){return o.list.removeFilter(t),i=o.list.filter(),n=!0,setTimeout(O,0),this},this.bindValue=function(){return this.getSelection()},this.destroy=function(){o.scope&&b(!1),this.clearBinds(),e.empty(),e.removeClass("ogx_dynamic_list")},this.val=function(t,e,i){if(void 0===t){if(!o.key){var n=JSON.parse(JSON.stringify(o.list));return U(OGX.List(n))}return o.list}var r;void 0===e&&(e=!1),void 0===i&&(i=!0),t.hasOwnProperty("insert")||(t=new OGX.List(t)),this.resetSelection(),e||(r=o.list.getFilters()),o.list=t,o.key||(d=1,a=u,t=JSON.parse(JSON.stringify(t)),j()),!e&&Object.keys(r).length?(o.list.setFilters(r),setTimeout(this.filter,0)):i?setTimeout(O,0):O()},this.getFilteredList=function(){if(n){if(!o.key){var t=JSON.parse(JSON.stringify(i));return U(OGX.List(t))}return i}return!1},this.display=function(t){return void 0===t?o.display:o.display.val(t)},this.mode=function(t){return void 0===t?o.mode:(o.mode!==t&&(o.mode===OGX.DynamicList.STATIC?this.enable(!0):t===OGX.DynamicList.STATIC&&this.disable(!0),o.mode=t),this)},this.order=function(t,e){return o.list.order(t,e),setTimeout(O,0),this},this.filter=function(){return i=o.list.filter(),n=!0,setTimeout(O,0),i},this.unfilter=function(){return n=!1,setTimeout(O,0),this},this.addFilter=function(t,e,i){return o.list.addFilter(t,e,i)},this.removeFilter=function(t,e,i){return o.list.removeFilter(t,e,i)},this.resetFilters=function(){return o.list.resetFilters()},this.getFilters=function(){return o.list.getFilters()},this.insert=function(t,r){if(!Array.isArray(t)){o.key||(t[a]=d++);var s=!1,l=!0;if(n){var c=new OGX.List(t);c.setFilters(o.list.getFilters()),0===c.filter().length?l=!1:i.push(t)}var u='<div class="ogx_dynamic_list_item '+m.css(t)+'" data-ogx-id='+t[a]+"></div>",h=m.oml('.ogx_dynamic_list[data-ogx-id="'+this.id+'"] .ogx_dynamic_list_item[data-ogx-id="'+t[a]+'"]',t,o.as);if(void 0===r)o.list.push(t),l&&e.append(u);else if(o.list.insert(t,r),l&&(n?s=(i=o.list.filter()).findIndex(a,t[a]):0===r?e.prepend(u):s=o.list.findIndex(a,t[a]),s)){var f=e.children(".ogx_dynamic_list_item:nth-child("+(s.index+1)+")");f.length>0?f.before(u):e.append(u)}return this.parse(h),o.trigger&&e.trigger(OGX.DynamicList.RENDER),l}for(var g=0;g<t.length;g++)void 0!==r?this.insert(t[g],r+g):this.insert(t[g])},this.delete=function(t){var r=W().delete(t);if(r){o.list.findDelete(a,r[a],1),n&&i.findDelete(a,r[a],1);var s=e.children(".ogx_dynamic_list_item:eq("+t+")");return this.remove(r[a]),s.remove(),!0}return!1},this.deleteSelection=function(){for(var t=0;t<c.length;t++)o.list.findDelete(a,c[t][a],1),n&&i.findDelete(a,c[t][a],1),this.remove(c[t][a]),e.children(".ogx_dynamic_list_selected_item").remove();return!0},this.findDelete=function(t,r,s){void 0===s&&1===arguments.length&&(r=t,t=a);var l,c,d=o.list.findDelete(t,r,s);d&&!Array.isArray(d)&&(d=[d]);for(var u=0;u<d.length;u++)n&&i.findDelete(t,r,s),c=(l=e.children('.ogx_dynamic_list_item[data-ogx-id="'+d[u][a]+'"]')).next(".ogx_dynamic_list_swiper_back_item"),l.remove(),this.remove(d[u][a]),I(c);return 1===s?d[0]:d},this.findIndex=function(t,i){var n=arguments.length;1===n&&(i=t,t=a);var r=o.list.find(t,i,1);return r?e.children('.ogx_dynamic_list_item[data-ogx-id="'+r[a]+'"]').index():-1},this.findReplace=function(t,r,s){var l=arguments.length;2===l&&(s=r,r=t,t=a),o.key||(s[a]=d++);var c=o.list.findReplace(t,r,s,1);if(c){n&&i.findReplace(t,r,s,1);var u=e.children('.ogx_dynamic_list_item[data-ogx-id="'+c[a]+'"]').first();return u.length&&(u.attr("data-ogx-id",s[a]),x(u,a,s),o.trigger&&e.trigger(OGX.DynamicList.RENDER)),!0}return!1},this.replaceAt=function(t,e){var i=W();if(void 0===i[t])return!1;if(o.key)i[t]=e;else{var n=i[t][a];i[t]=e,i[t].key=n}return this.refreshAt(t)},this.select=function(t,e){return void 0===e&&(e=t,t=a),H(t,e,!0)},this.selectIndex=function(t){return z(t,!0)},this.index=function(t){if(void 0!==t){var i=W();return this.select(a,i[t][a])}return e.children(".ogx_dynamic_list_selected_item").index()},this.unselect=function(t,e){return H(t,e,!1)},this.unselectIndex=function(t){return z(t,!1)},this.resetSelection=function(){return c=new OGX.List,e.children(".ogx_dynamic_list_selected_item").removeClass("ogx_dynamic_list_selected_item"),this},this.getSelection=function(t){if(void 0===t&&(t=!1),!t){var i;if(o.key)i=c;else i=U(JSON.parse(JSON.stringify(c)));return o.mode===OGX.DynamicList.SELECT_MODE_SINGLE?!!i.length&&i[0]:i=new OGX.List(i)}return e.children(".ogx_dynamic_list_selected_item")},this.getElement=function(t,i){var n=arguments.length;1===n&&(i=t,t=a);var r=o.list.find(t,i,1);return!!r&&e.children('.ogx_dynamic_list_item[data-ogx-id="'+r[a]+'"]')[0]},this.findUpdate=function(t,r,s,l,c,d){var u;"number"==typeof l&&(d=c,Array.prototype.unshift.call(arguments,a)),void 0===d&&(d=!0);var h=o.list.findUpdate.apply(o.list,arguments);if(h&&!Array.isArray(h)&&(h=[h]),h.length&&d){n&&i.findUpdate.apply(i,arguments);for(var f=0;f<h.length;f++)(u=e.children('.ogx_dynamic_list_item[data-ogx-id="'+h[f][a]+'"]').first()).length&&(x(u,a,h[f]),o.trigger&&e.trigger(OGX.DynamicList.RENDER));return h.length}return!1},this.update=function(t,r,s,l,c){void 0===c&&(c=!0);var d=o.list.update(t,r,s,l);if(d&&!Array.isArray(d)&&(d=[d]),d.length&&c){n&&i.update(arguments);for(var u=0;u<d.length;u++)el=e.children('.ogx_dynamic_list_item[data-ogx-id="'+d[u][a]+'"]').first(),el.length&&(x(el,a,d[u]),o.trigger&&e.trigger(OGX.DynamicList.RENDER));return d.length}return!1},this.refresh=function(t,i,n){var r=arguments.length;void 0!==n&&r--,1===r&&(i=t,t=a);var s=o.list.find(t,i,n);if(s&&s.length)for(var l,c=0;c<s.length;c++)(l=e.children('.ogx_dynamic_list_item[data-ogx-id="'+s[c][a]+'"]')).length>0&&x(l,a,s[c]);return this},this.refreshAt=function(t){var i=W();if(void 0!==i[t]){var n=e.children('.ogx_dynamic_list_item[data-ogx-id="'+i[t][a]+'"]');if(n.length>0)return x(n,a,i[t]),!0}return!1},this.restore=function(t,i){var n=arguments.length;1===n&&(i=t,t=a);var r=o.list.find(t,i,1),s=e.children('.ogx_dynamic_list_item[data-ogx-id="'+r[a]+'"]');s.addClass("ogx_dynamic_list_swiper_trans_item_restore"),s.css({transform:"translateX(0px)","z-index":o.zindex+1}),setTimeout((function(){s.next(".ogx_dynamic_list_swiper_back_item").remove()}),200)},this.clear=function(){return e.empty(),this},this.reset=function(){return e.empty(),n=!1,o.list=new OGX.List,c=new OGX.List,i=new OGX.List,this},this.render=function(){return setTimeout(O,0),this},o||(o={}),OGX.Data.merge(o,s),o.list.hasOwnProperty("_NAME_")||(o.list=new OGX.List(o.list)),!o.key&&o.list.length>0?(a=u,j()):a=o.key,o.swipe&&("object"!=typeof o.swipe&&(o.swipe={}),OGX.Data.merge(o.swipe,l)),r.el=e=$(o.el),e.addClass("ogx_dynamic_list"),o.selection.length&&r.observe(!0,{childList:!0,subtree:!0},(function(){r.observe(!1);for(var t=0;t<o.selection.length;t++)r.select(a,o.selection[t])})),r.val(o.list,!1,!1),v=!0,r.blured||G(!0),o.scope&&b(!0),e.trigger(OGX.DynamicList.READY),o.scroll&&(y=r.find(OGX.Scroller.NAME,o.id+"_scroller"))},OGX.DynamicList.NAME="DynamicList",OGX.DynamicList.HOLD="DynamicListHold",OGX.DynamicList.RELEASE="DynamicListRelease",OGX.DynamicList.DROP="DynamicListDrop",OGX.DynamicList.SELECT="DynamicListSelect",OGX.DynamicList.DELETE="DynamicListDelete",OGX.DynamicList.SIDED="DynamicListSided",OGX.DynamicList.BACK_HIT="DynamicListBackHit",OGX.DynamicList.UNSELECT="DynamicListUnselect",OGX.DynamicList.RENDER="DynamicListRender",OGX.DynamicList.SELECT_MODE_SINGLE="single",OGX.DynamicList.SELECT_MODE_TOGGLE="toggle",OGX.DynamicList.SELECT_MODE_MULTI="multi",OGX.DynamicList.SELECT_MODE_HIT="hit",OGX.DynamicList.STATIC="static",OGX.DynamicList.SWIPE_LEFT="DynamicListSwipeLeft",OGX.DynamicList.SWIPE_RIGHT="DynamicListSwipeRight",OGX.DynamicList.SWIPE_MODE_DELETE="DynamicListSwipeModeDelete",OGX.DynamicList.SWIPE_MODE_SIDE="DynamicListSwipeModeSide",OGX.DynamicList.SWIPE_MODE_CUSTOM="DynamicListSwipeModeCustom",OGX.DynamicList.READY="DynamicListReady",OGX.DynamicList.BIND=OGX.DynamicList.SELECT+" "+OGX.DynamicList.UNSELECT,OGX.Form=function(){"use strict";var t=this,e={el:!1,allowed:!1,forbidden:!1,change_cb:!1,submit_cb:!1,validate:!1,diff:!0,params:null,elem_types:["input","select","textarea"],wait:1e3,fields:{},buffer:null},i={el:!1,allowed:/[a-z0-9\\!\\.\\?\\#\\@\\$\\:\\(\\)\\/_,;%'"’ \\-]/,forbidden:/[<>]/,pattern:!1,validate:!1,mask:!1,mask_char:"%",paste:!0,autocomplete:null,multiline:!1,input_cb:!1,change_cb:!1,diff:!0,val:null,last_change:!1,wait:2e3,intv:!1,max:2500,type:"string",params:null},n=new OGX.List,a=new OGX.List,r=!1;function o(e,i){if(!r){var a,o=n.find("el",i,1);if(o&&o.config.change_cb){for(var s in o.fields)if(o.fields[s].intv)return;var c=d(o.form);for(var u in c)o.config.fields.hasOwnProperty(u)&&o.config.fields[u].hasOwnProperty("type")?c[u]=l(o.config.fields[u].type,c[u]):o.config.hasOwnProperty("type")&&(c[u]=l(o.config.type,c[u]));if(a=JSON.stringify(c),!o.diff||o.val!==a){var h;if(o.val=a,o.config.validate){h={obj:c,form:i,valid:!1};var f=t.validate(o.form);!0===f?h.valid=!0:(h.valid=!1,h.error=f)}else h=c;o.config.params&&(h.params=o.config.params),o.buffer&&clearTimeout(o.buffer),o.buffer=setTimeout((function(){o.config.change_cb(h)}),10)}}}}function s(e){var i={el:e.el,config:e,field:$(e.el),intv:!1};i.name=i.field.attr("name"),i.val=i.field.val(),i.field.val(i.val),e.pattern&&i.field.attr("pattern",e.pattern),n.insert(i),$(document).on("input change",i.el,(function(t){if(!r){var e=$(this).val();if(!i.config.diff||i.config.diff&&e!==i.val){if(i.config.input_cb){var n={value:null,obj:{},el:null};e=l(i.config.type,e),n.el=i.field[0],n.value=e,n.property=i.name,n.obj[i.name]=e,i.config.input_cb(n,i.config.params)}i.intv&&clearTimeout(i.intv),i.intv=setTimeout((function(){!function(t){var e=$(t.el).val();if(t.val=e,t.config.change_cb){var i={value:null,obj:{},el:null};e=l(t.config.type,e),i.el=t.field[0],i.property=t.name,i.value=e,i.obj[i.property]=e,t.config.validate&&(i.valid=i.el.checkValidity()),t.config.change_cb(i,t.config.params)}}(i)}),i.config.wait)}}})),e.multiline||$(document).on("keydown",i.el,(function(t){var e=$(this);if(void 0!==t.which&&void 0!==t.key){if(!r){if(i.config.mask&&8===t.which||46===t.which){var n=e[0].selectionStart,a=e.val();return a=8===t.which?a.substr(0,n-1):a.substr(0,n),e.val(a),!1}if(8!==t.which&&13!==t.which&&1===t.key.length){var o=t.key;if(13!==t.which&&i.config.mask){if((a=e.val()).length>=i.config.mask.length)return t.preventDefault(),t.stopImmediatePropagation(),!1;for(var s=i.config.mask,c=0;c<a.length;c++)i.config.mask.substr(c,1)===i.config.mask_char&&(s=s.replace(i.config.mask_char,a.substr(c,1)));var d=s.indexOf(i.config.mask_char),u=!1;return d+1<s.length+1&&(u=s.substr(d+1,1)),-1!==d&&(o===i.config.mask.substr(s.indexOf(i.config.mask_char)-1,1)?s=s.substr(0,s.indexOf(i.config.mask_char)-1):(s=s.substr(0,s.indexOf(i.config.mask_char)),u&&u!==i.config.mask_char&&setTimeout((function(){i.field.val(s+o+u)}),0))),void i.field.val(s)}}if(13===t.which){t.preventDefault(),t.stopImmediatePropagation();a=$(this).val();if(i.intv&&(clearInterval(i.intv),i.intv=null),i.config.change_cb){var h={value:null,obj:{},el:null};a=l(i.config.type,a),h.el=i.field[0],h.property=i.name,h.value=a,h.obj[i.name]=a,i.config.validate&&(h.valid=i.field[0].checkValidity()),i.config.change_cb(h,i.config.params)}else i.field.trigger("change",a)}}}else i.config.mask&&setTimeout((function(){for(var t=e.val(),n="",a=0,r=0;r<i.config.mask.length&&r-a!==t.length;r++)i.config.mask.substr(r,1)===i.config.mask_char||i.config.mask.substr(r,1)===t.substr(r-a,1)?n+=t.substr(r-a,1):i.config.mask.substr(r,1)!==i.config.mask_char&&(n+=i.config.mask.substr(r,1),r&&a++);e.val(n)}),0)})),(i.config.allowed||i.config.forbidden)&&t.restrictField(i.config)}function l(t,e){switch(t){case"string":return String(e);case"number":return Number(e);case"int":return parseInt(e);case"bool":return!![!0,"true",1].includes(e)}}function c(){for(var t=0;t<n.length;t++)n[t].hasOwnProperty("field")&&n[t].field.length&&(n[t].val=$(n[t].field[0]).val())}function d(t){return $(t).serializeArray().map(function(t){return this[t.name]=t.value,this}.bind({}))[0]}this.updateBind=function(t,e){var i=this.getBind(t);return!!i&&(OGX.Data.merge(i.config,e,!0,!1,!1),!0)},this.getBind=function(t){return n.get({el:{in:t}},null,null,1)},this.bindForm=function(a){return OGX.Data.merge(a,e),function(e){for(var a,l,c={el:e.el,config:e,form:$(e.el),fields:new OGX.List,val:""},u=0;u<e.elem_types.length;u++)c.form.find(e.elem_types[u]).each((function(t,n){n.hasAttribute("name")&&(l=n.getAttribute("name"),a=OGX.Data.clone(i),OGX.Data.merge(a,e,!0,!1,!0),e.fields.hasOwnProperty(l)&&(a=OGX.Data.merge(a,e.fields[l],!0)),a.el=e.el+" "+e.elem_types[u]+'[name="'+l+'"]',a.change_cb=o,a.params=e.el,s(a),c.fields.insert({el:a.el}))}));c.form.on("submit",(function(e){if(e.preventDefault(),e.stopImmediatePropagation(),!r){var i={obj:d(c.el),form:c.el};if(c.config.params&&(i.params=c.config.params),c.config.validate){var n=t.validate(c.el);!0===n?i.valid=!0:(i.valid=!1,i.error=n)}c.config.submit_cb?c.config.submit_cb(i):c.form.trigger("submit",i)}})),n.insert(c)}(a),!0},this.enable=function(){r&&(r=!1)},this.disable=function(){r||(r=!0)},this.unbindForm=function(t){if(void 0===t)unbindAll("form");else{var e=n.find("el",t,1);if(e){for(var i in $(document).off("submit",e.el),e.fields)this.unbindField(e.fields[i].el);n.findDelete("el",t,1)}}},this.unbindAll=function(e){void 0===e&&(e="all");for(var i=0;i<n.length;i++)["form","all"].includes(e)&&n[i].hasOwnProperty("fields")?t.unbindForm(n[i].el):["field","all"].includes(e)&&!n[i].hasOwnProperty("fields")&&t.unbindField(n[i].el)},this.bindField=function(t){return OGX.Data.merge(t,i),s(t),!0},this.unbindField=function(t){var e=n.find("el",t,1);e&&($(document).off("input change",e.el),e.config.multiline||$(document).off("keydown",e.el),e.intv&&clearInterval(e.intv),a.find("el",e.el,1)&&this.unrestrictField(e.el),n.findDelete("el",e.el,1))},this.restrictField=function(t){return OGX.Data.merge(t,i),function(t){var e={el:t.el,config:t,field:$(t.el),keys:[],content:null},i=[8,9];null===t.autocomplete&&e.field[0].hasAttribute("autocomplete")&&"on"===e.field.attr("autocomplete")?t.autocomplete=!0:t.autocomplete=!1;t.autocomplete||e.keys.push(229);-1!==["input","texarea"].indexOf(e.field.get(0).tagName.toLowerCase())?e.content="val":e.content="html";e.config.multiline||e.keys.push(13);$(document).on("textInput keydown",e.el,(function(t){if("keydown"===t.type&&8==t.keyCode||46==t.keyCode)$(this).trigger("input");else if("textInput"===t.type){var n=t.originalEvent.data;if(e.config.allowed&&!n.match(e.config.allowed))return t.preventDefault(),t.stopImmediatePropagation(),!1;if(e.config.forbidden&&n.match(e.config.forbidden))return t.preventDefault(),t.stopImmediatePropagation(),!1;if("keydown"===t.type&&-1!==e.keys.indexOf(t.which)&&-1===t.which.indexOf(i))return t.preventDefault(),t.stopImmediatePropagation(),!1;if($(t.originalEvent.target)[e.content]().length>=e.config.max)return t.preventDefault(),t.stopImmediatePropagation(),!1}})),$(document).on("paste",e.el,(function(t){if(!e.config.paste)return t.preventDefault(),t.stopImmediatePropagation(),!1;var i=t.originalEvent.clipboardData.getData("Text");return e.config.forbidden&&i.match(e.config.forbidden)?(t.preventDefault(),t.stopImmediatePropagation(),!1):void 0})),a.insert(e)}(t),!0},this.unrestrictField=function(t){var e=a.find("el",t,1);return!!e&&($(document).off("textInput keydown",e.el),$(document).off("paste",e.el),a.findDelete("el",t,1),!0)},this.toObj=function(t){return d(t)},this.populate=function(t,e,i){var n,a,r;void 0===i&&(i=null),$(t).find("*[name]").each((function(t,o){n=o.getAttribute("name"),r=!1,"string"!=typeof(r=OGX.Data.eval(e,n))&&(r=JSON.stringify(r)),void 0!==r&&(i&&i.hasOwnProperty(n)&&"function"==typeof i[n]&&(r=i[n](r)),(a=$(o)).val(r),o.hasAttribute("type")&&"hidden"===a.attr("type")&&a.trigger("change"))})),setTimeout(c,0)},this.validate=function(t){var i,n=$(t),a=e.elem_types,r=[];return n.find(a.join(",")).each((function(t,e){"submit"!==(i=$(e)).attr("type")&&(e.checkValidity()||r.push(i))})),!r.length||r}},OGX.Form=new OGX.Form,OGX.Geo=function(t){"use strict";var e=this;void 0===t&&(t={});var i,n,a,r={map:null,markers:[],icon:"",browser_loc:null},o=t;function s(t,i){for(var n,a={},r=0;r<t.length;r++){n=!1;for(var o=0;o<i.length;o++){for(var s=0;s<i[o].address_components.length;s++)if(-1!==i[o].address_components[s].types.indexOf(t[r][0])){a.hasOwnProperty(t[r][1])&&a[t[r][1]].length||(a[t[r][1]]=i[o].address_components[s].short_name),n=!0;break}if(n)break}}return a=e.clean(a)}function l(t){return t*(Math.PI/180)}function c(t){return Array.isArray(t)?new google.maps.LatLng(t[0],t[1]):"function"!=typeof t.lat?new google.maps.LatLng(t.lat,t.lng):t}function d(t){var e={gmap:new google.maps.LatLng(t.coords.latitude,t.coords.longitude),raw:{lat:t.coords.latitude,lng:t.coords.longitude}};a?(a(e),a=null):$(document).trigger(OGX.Geo.BROWSER_LOC_SUCCESS,e)}function u(t){$(document).trigger(OGX.Geo.BROWSER_LOC_ERROR,t)}this._NAME_=OGX.Geo.NAME,this.setMap=function(t){o.map=t,google.maps.event.addListenerOnce(o.map,"tilesloaded",(function(){$(document).trigger(OGX.Geo.MAP_LOADED)}))},this.getMap=function(){return o.map},this.getMapRadius=function(){return!!o.map&&function(){if(o.map){var t=o.map.getBounds(),e=t.getCenter(),i=t.getNorthEast(),n=3963,a=e.lat()/57.2958,r=e.lng()/57.2958,s=i.lat()/57.2958,l=i.lng()/57.2958;return n*Math.acos(Math.sin(a)*Math.sin(s)+Math.cos(a)*Math.cos(s)*Math.cos(l-r))}return!1}()},this.getCurrentLocation=function(){return!!o.map&&(t=o.map.getCenter(),new google.maps.LatLng(t.lat(),t.lng()));var t},this.getBrowserLocation=function(t){a=void 0===t?null:t,navigator.geolocation.getCurrentPosition(d,u,{maximumAge:0,timeout:1e4,enableHighAccuracy:!0})},this.getDistance=function(t,e,i,n){var a=l(i-t),r=l(n-e),o=Math.sin(a/2)*Math.sin(a/2)+Math.cos(l(t))*Math.cos(l(i))*Math.sin(r/2)*Math.sin(r/2),s=6371*(2*Math.atan2(Math.sqrt(o),Math.sqrt(1-o)));return Math.round(1e3*s)/1e3},this.addressToLatLng=function(t,e,n){i.geocode({address:t},(function(t,i){i==google.maps.GeocoderStatus.OK?e(t[0].geometry.location,n):e(!1,n)}))},this.getCityBoundaries=function(t,e,n,a,r){i.geocode({address:t+", "+e+", "+n},(function(t,e){e==google.maps.GeocoderStatus.OK?a(t[0].geometry,r):a(!1,r)}))},this.latLngToZip=function(t,e,n){t=c(t),i.geocode({location:t},(function(t,i){if(i===google.maps.GeocoderStatus.OK){var n=s([["postal_code","zip"]],t);e(n)}}))},this.latLngToCountryStateCity=function(t,e,n){t=c(t),i.geocode({location:t},(function(t,i){if(i===google.maps.GeocoderStatus.OK){var a=s([["country","country"],["administrative_area_level_1","state"],["locality","city"],["administrative_area_level_2","city"]],t);e(a,n)}else e(!1,n)}))},this.partialAddressToCountryStateCity=function(t,e,n){i.geocode({address:t},(function(t,i){if(i===google.maps.GeocoderStatus.OK){var a=s([["country","country"],["administrative_area_level_1","state"],["locality","city"],["administrative_area_level_2","city"]],t);e(a,n)}else e(!1,n)}))},this.latLngToAddress=function(t,e,n){t=c(t),i.geocode({location:t},(function(t,i){if(i===google.maps.GeocoderStatus.OK){var a=s([["street_number","number"],["route","street"],["postal_code","zip"],["country","country"],["administrative_area_level_1","state"],["locality","city"],["administrative_area_level_2","city"]],t);t[0].hasOwnProperty("formatted_address")&&(a.formatted=t[0].formatted_address),e(a,n)}else e(!1,n)}))},this.partialAddressToAddress=function(t,e,n){i.geocode({address:t},(function(t,i){if(i===google.maps.GeocoderStatus.OK){var a=s([["street_number","number"],["route","street"],["postal_code","zip"],["country","country"],["administrative_area_level_1","state"],["locality","city"],["administrative_area_level_2","city"]],t);t[0].hasOwnProperty("formatted_address")&&(a.formatted=t[0].formatted_address),a.lat=t[0].geometry.location.lat(),a.lng=t[0].geometry.location.lng(),e(a,n)}else e(!1,n)}))},this.zipToAddress=function(t,e,i){this.partialAddressToAddress(t,e,i)},this.zipToLatLng=function(t,e,n){i.geocode({address:t},(function(t,i){if(i===google.maps.GeocoderStatus.OK){var a={};a.lat=t[0].geometry.location.lat(),a.lng=t[0].geometry.location.lng(),e(a,n)}else e(!1,n)}))},this.getRoute=function(t){var e={start:!1,end:!1,waypoints:!1,optimize:!0,mode:OGX.Geo.TRAVEL_MODE_CAR,callback:!1,params:!1};for(var i in e)t.hasOwnProperty(i)||(t[i]=e[i]);var n=new google.maps.DirectionsService,a={origin:t.start,destination:t.end,travelMode:t.mode};t.waypoints&&(a.waypoints=t.waypoints,t.optimize&&(a.optimizeWaypoints=!0)),n.route(a,(function(e,i){i===google.maps.DirectionsStatus.OK?t.callback(e,t.params):t.callback(!1,t.params)}))},this.calcRouteMinutes=function(t){for(var e=0,i=0;i<t.legs.length;i++)e+=t.legs[i].duration.value;return e=Math.round(e/60)},this.drawRoute=function(t,e){void 0===e&&(e=!0),n||(n=new google.maps.DirectionsRenderer({suppressMarkers:!e})),n.setMap(o.map),n.setDirections(t)},this.clearRoute=function(){o.map&&n&&n.setMap(null)},this.latLngToLoc=function(t,e){return new google.maps.LatLng(t,e)},this.clean=function(t,e){var i;if(void 0===e&&(e=!1),t.hasOwnProperty("city")&&t.hasOwnProperty("vicinity")&&-1!==t.vicinity.indexOf(",")&&(i=new RegExp(", ([a-z -']+)$","gi").exec(t.vicinity))&&i.length>1&&(t.city===i[1]?t.vicinity=t.vicinity.replace(i[0],""):t.city?t.city.length>i[1].length&&(t.city=i[1],t.vicinity=t.vicinity.replace(i[0],"")):t.city=i[1]),e)for(var n in t)-1===e.indexOf(n)&&delete t[n];return t},"undefined"!=typeof google&&void 0!==google.maps?(i=new google.maps.Geocoder,function(){for(var t in r)o.hasOwnProperty(t)||(o[t]=r[t])}(),o.map&&o.markers.length):$(document).trigger(OGX.Geo.ERROR_GMAP)},OGX.Geo.NAME="Geo",OGX.Geo.ERROR="GEO_error",OGX.Geo.ERROR_GMAP="GEO_GMAP_ERROR",OGX.Geo.TRAVEL_MODE_CAR="DRIVING",OGX.Geo.TRAVEL_MODE_TRANSIT="TRANSIT",OGX.Geo.TRAVEL_MODE_WALK="WALKING",OGX.Geo.TRAVEL_MODE_BIKE="BICYCLING",OGX.Geo.BROWSER_LOC_SUCCESS="GEO_BROWSER_LOC_SUCCESS",OGX.Geo.BROWSER_LOC_ERROR="GEO_BROWSER_LOC_ERROR",OGX.Geo.MAP_LOADED="GEO_MAP_LOADED",require("Ghost","Uxi"),OGX.Ghost=function(t){construct(this,"Ghost"),this.el=$(t.el),this._NAME_=OGX.Ghost.NAME,css="ogx_ghost",this.el.addClass(css),delete css},OGX.Ghost.NAME="Ghost",require("GridSwiper","Uxi","Touch"),OGX.GridSwiper=function(t){construct(this,"GridSwiper");var e,i,n,a,r,o,s,l,c,d,u,h,f=this,g=t,_={map:[[!0,!0,!0],[!0,!0,!0],[!0,!0,!0]],axis:{x:!0,y:!0},loop:!0,start:!1,chromeos:!1,capture:!1},p=!1,m={x:null,y:null},v={x:0,y:0},y=".ogx_grid_swiper_cell",x=!1,O=!1,b={x:0,y:0},w={x:0,y:0},G=(new Date).getTime()+Math.round(1e3*Math.random()),X=[];function E(t){t?e.on(f.touch.down,T):e.off(f.touch.down,T)}function T(t){p=!1,r=0,o=0,s=0,l=0,t=Y(t),m.x=t.pageX,m.y=t.pageY,x=!0,M(!0)}function C(t){t?$("body").on(f.touch.up,D):$("body").off(f.touch.up,D)}function D(t){x&&(x=!1,M(!1),S())}function S(t,e,r){var o,s;void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=!0),r&&k(!0),i.addClass("ogx_grid_swiper_anim"),v=I(i),o=-1*Math.round((v.x+t)/n)*n*-1,s=-1*Math.round((v.y+e)/a)*a*-1,i.css({transform:"translate3d("+o+"px, "+s+"px, 0px)"})}function M(t){t?(N(!0),e.on(f.touch.move,L)):(N(!1),e.off(f.touch.move,L))}function L(t){t=Y(t),g.capture&&(t.preventDefault(),t.stopImmediatePropagation()),r=0,o=0,s=0,l=0,p||(g.axis.x&&Math.abs(t.pageX-m.x)>Math.abs(t.pageY-m.y)?p="x":g.axis.y&&Math.abs(t.pageX-m.x)<Math.abs(t.pageY-m.y)&&(p="y")),p&&(g.axis.x&&"x"===p?(r=Math.abs(t.pageX-m.x),s=t.pageX-m.x>0?1:-1):g.axis.y&&"y"===p&&(o=Math.abs(t.pageY-m.y),l=t.pageY-m.y>0?1:-1))}function N(t){t?h||(O=!1,h=setInterval(A,10)):h&&(clearInterval(h),h=null)}function A(){if((r||o)&&(O||e.trigger(OGX.GridSwiper.SWIPE_START),O=!0),g.axis.x&&"x"===p&&r&&s&&r<=n){if(!g.loop&&(b.x+-1*s<0||b.x+-1*s>g.map[0].length-1))return;if((c=(b.x+-1*s)%g.map[0].length)<0&&(c=Math.abs(g.map[0].length+c)),!1===g.map[w.y][c])return;u=r*s,i.css({transform:"translate3d("+(-1*b.x*n+u)+"px, "+v.y+"px, 0px)"})}else if(g.axis.y&&"y"===p&&o&&l&&o<=a){if(!g.loop&&(b.y+-1*l<0||b.y+-1*l>g.map.length-1))return;if((d=(b.y+-1*l)%g.map.length)<0&&(d=Math.abs(g.map.length+d)),!1===g.map[d][w.x])return;u=o*l,i.css({transform:"translate3d("+v.x+"px, "+(-1*b.y*a+u)+"px, 0px)"})}}function k(t){t?(i.off("transitionend"),i.on("transitionend",(function(){O&&(e.trigger(OGX.GridSwiper.SWIPE_END),O=!1),i.off("transitionend"),i.removeClass("ogx_grid_swiper_anim"),v=I(i);var t={x:null,y:null};t.x=-1*Math.round(v.x/n),t.y=-1*Math.round(v.y/a),b.x!==t.x?(s=b.x>t.x?1:-1,b.x=t.x,w.x=P(b).x,-1===s?(i.children(y+"[data-y="+(b.y-1)+"]").attr("data-x",b.x).css("left",b.x*n),i.children(y+"[data-y="+(b.y+1)+"]").attr("data-x",b.x).css("left",b.x*n),i.children(y+"[data-x="+(b.x-2)+"][data-y="+b.y+"]").attr("data-x",b.x+1).css("left",(b.x+1)*n),e.trigger(OGX.GridSwiper.SWIPE_LEFT,{cell:w,point:b}),R(X=[{x:b.x+1,y:b.y},{x:b.x,y:b.y-1},{x:b.x,y:b.y+1}]),z()):(i.children(y+"[data-y="+(b.y-1)+"]").attr("data-x",b.x).css("left",b.x*n),i.children(y+"[data-y="+(b.y+1)+"]").attr("data-x",b.x).css("left",b.x*n),i.children(y+"[data-x="+(b.x+2)+"][data-y="+b.y+"]").attr("data-x",b.x-1).css("left",(b.x-1)*n),e.trigger(OGX.GridSwiper.SWIPE_RIGHT,{cell:w,point:b}),R(X=[{x:b.x-1,y:b.y},{x:b.x,y:b.y-1},{x:b.x,y:b.y+1}]),z())):b.y!==t.y&&(l=b.y>t.y?1:-1,b.y=t.y,w.y=P(b).y,-1===l?(i.children(y+"[data-x="+(b.x-1)+"]").attr("data-y",b.y).css("top",b.y*a),i.children(y+"[data-x="+(b.x+1)+"]").attr("data-y",b.y).css("top",b.y*a),i.children(y+"[data-y="+(b.y-2)+"][data-x="+b.x+"]").attr("data-y",b.y+1).css("top",(b.y+1)*a),e.trigger(OGX.GridSwiper.SWIPE_UP,{cell:w,point:b}),R(X=[{x:b.x,y:b.y+1},{x:b.x-1,y:b.y},{x:b.x+1,y:b.y}]),z()):(i.children(y+"[data-x="+(b.x-1)+"]").attr("data-y",b.y).css("top",b.y*a),i.children(y+"[data-x="+(b.x+1)+"]").attr("data-y",b.y).css("top",b.y*a),i.children(y+"[data-y="+(b.y+2)+"][data-x="+b.x+"]").attr("data-y",b.y-1).css("top",(b.y-1)*a),e.trigger(OGX.GridSwiper.SWIPE_DOWN,{cell:w,point:b}),R(X=[{x:b.x,y:b.y-1},{x:b.x-1,y:b.y},{x:b.x+1,y:b.y}]),z())),p=0}))):i.off("transitionend")}function I(t,e){var i=t.css("transform");return"none"===i?0:(i=(i=(i=i.substr(7)).substr(0,i.length-1)).split(","),{x:Number(i[4]),y:Number(i[5])})}function Y(t){return t.hasOwnProperty("originalEvent")&&void 0!==t.originalEvent.changedTouches?t.originalEvent.changedTouches[0]:t}function P(t){var e={x:0,y:0};return e.x=t.x%g.map[0].length,e.x<0&&(e.x=Math.abs(g.map[0].length+e.x)),e.y=t.y%g.map.length,e.y<0&&(e.y=Math.abs(g.map.length+e.y)),e}function R(t){for(var e,i={x:null,y:null},n=0;n<t.length;n++){if(t[n].y<0||t[n].y>g.map.length-1){if(!g.loop)return!1;i.y=P(t[n]).y}else i.y=t[n].y;if(t[n].x<0||t[n].x>g.map[0].length-1){if(!g.loop)return!1;i.x=P(t[n]).x}else i.x=t[n].x;e=g.map[i.y][i.x],H(t[n],e)}}function H(t,e){var n=!1;switch(typeof e){case"string":i.children(y+'[data-x="'+t.x+'"][data-y="'+t.y+'"]').children(y+"_content").first().html(e);break;case"function":(n=e(t,P(t),{x:t.x-b.x,y:t.y-b.y},i.children(y+'[data-x="'+t.x+'"][data-y="'+t.y+'"]').children(y+"_content").first()[0]))&&i.children(y+'[data-x="'+t.x+'"][data-y="'+t.y+'"]').children(y+"_content").first().html(n);break;case"object":var a='.ogx_grid_swiper[data-ogx-id="'+G+'"] > .ogx_grid_swiper_container > '+y+'[data-x="'+t.x+'"][data-y="'+t.y+'"] > '+y+"_content",r=P(t);for(var o in e){e[o].id="cell_"+r.x+"_"+r.y;break}e=OGX.OML.rename(e,a);var s=f.nodes.find("id","cell_"+r.x+"_"+r.y,1);s&&f.remove(s._NAME_,s.id),$(a).empty(),OGX.OML.render(f,e,{abs:t,rel:P(t)}),z()}}function z(){for(var t=0;t<f.nodes.length;t++)f.nodes[t].id==="cell_"+w.x+"_"+w.y?f.nodes[t].focus():f.nodes[t].blur()}function W(){X=[],g.axis.x&&(X.push({x:g.start.x-1,y:g.start.y}),X.push({x:g.start.x+1,y:g.start.y})),X.push({x:g.start.x,y:g.start.y}),g.axis.y&&(X.push({x:g.start.x,y:g.start.y-1}),X.push({x:g.start.x,y:g.start.y+1})),R(X)}function j(){g.map.length||(g.map=[[]],g.axis.y=!1),g.map.length&&!Array.isArray(g.map[0])&&(g.map=[g.map],g.axis.y=!1),g.start||(g.start={x:null,y:null},g.start.y=Math.floor(g.map.length/2),g.start.x=Math.floor(g.map[0].length/2))}function U(){var t=g.start.x*-n,r=g.start.y*-a,o=g.start.y-1,s=g.start.x,l='<div class="ogx_grid_swiper_container" style="transform:translate3d('+t+"px, "+r+'px, 0px);">',c=-1*t,d=-1*r-a;g.axis.y&&(l+='<div class="ogx_grid_swiper_cell" style="left:'+c+"px; top:"+d+'px;" data-x="'+s+'" data-y="'+o+'"><div class="ogx_grid_swiper_cell_content"></div></div>',l+='<div class="ogx_grid_swiper_cell" style="left:'+c+"px; top:"+(d+2*a)+'px;" data-x="'+s+'" data-y="'+(o+2)+'"><div class="ogx_grid_swiper_cell_content"></div></div>'),l+='<div class="ogx_grid_swiper_cell" style="left:'+c+"px; top:"+(d+a)+'px;" data-x="'+s+'" data-y="'+(o+1)+'"><div class="ogx_grid_swiper_cell_content"></div></div>',g.axis.x&&(l+='<div class="ogx_grid_swiper_cell" style="left:'+(c-n)+"px; top:"+-1*r+'px;" data-x="'+(s-1)+'" data-y="'+g.start.y+'"><div class="ogx_grid_swiper_cell_content"></div></div>',l+='<div class="ogx_grid_swiper_cell" style="left:'+(c+n)+"px; top:"+-1*r+'px;" data-x="'+(s+1)+'" data-y="'+g.start.y+'"><div class="ogx_grid_swiper_cell_content"></div></div>'),l+="</div>",e.html(l),i=e.children(".ogx_grid_swiper_container").first(),b.x=g.start.x,b.y=g.start.y,v.x=t,v.y=r,w.x=g.start.x,w.y=g.start.y}this._NAME_=OGX.GridSwiper.NAME,this.el=null,this.enable=function(){return E(!0),C(!0),z(),this},this.disable=function(){return E(!1),C(!1),N(!1),this},this.focus=function(){return this.blured&&(this.blured=!1,this.enabled&&(this.ux(!0),this.enable())),this},this.resize=function(){k(!1),i.removeClass("ogx_grid_swiper_anim"),n=e.width(),a=e.height();var t=b.x*-n,r=b.y*-a;i.children(y+"[data-y="+(b.y-1)+"]").css({top:(b.y-1)*a,left:b.x*n}),i.children(y+"[data-y="+b.y+"]").css({top:b.y*a,left:b.x*n}),i.children(y+"[data-y="+(b.y+1)+"]").css({top:(b.y+1)*a,left:b.x*n}),i.children(y+"[data-x="+(b.x-1)+"]").css({top:b.y*a,left:(b.x-1)*n}),i.children(y+"[data-x="+(b.x+1)+"]").css({top:b.y*a,left:(b.x+1)*n}),i.css("transform","translate3d("+t+"px, "+r+"px, 0px"),M(!1),setTimeout((function(){S(0,0,!1),i.addClass("ogx_grid_swiper_anim")}),0)},this.setMap=function(t,e){return g.map=t,void 0!==e&&(g.start=e),j(),U(),W(),this},this.setMapCell=function(t,e){return g.map[t.y]||(g.map[t.y]=[]),g.map[t.y][t.x]=e,this},this.getMapCell=function(t){return t.y>0&&g.map.length<t.y&&t.x>0&&g.map[t.y].length<t.x&&g.map[t.y][t.x]},this.getCells=function(){var t,e,n,a,r=[];return i.children(y).each((function(i,o){t=$(o),e={x:Number(t.attr("data-x")),y:Number(t.attr("data-y"))},n=P(e),a={x:e.x-b.x,y:e.y-b.y},r.push({abs:e,rel:n,offset:a,element:o})})),r},this.getCellContent=function(t){return i.children(y+"[data-x="+t.x+"][data-y="+t.y+"]").children(y+"_content").first()[0]},this.getCurrentCell=function(){return w},this.renderCellContent=function(t){return R([t]),this},this.setTopCell=function(t){return this.setOffsetCell({x:0,y:-1},t),this},this.setBottomCell=function(t){return this.setOffsetCell({x:0,y:1},t),this},this.setLeftCell=function(t){return this.setOffsetCell({x:-1,y:0},t),this},this.setRightCell=function(t){return this.setOffsetCell({x:1,y:0},t),this},this.setOffsetCell=function(t,e){var i={x:t.x+b.x,y:t.y+b.y};return this.setMapCell(i,e),this},this.getOffsetCell=function(t){var e={x:t.x+b.x,y:t.y+b.y};return this.getMapCell(e)},this.getOffsetCellContent=function(t){var e={x:t.x+b.x,y:t.y+b.y};return this.getCellContent(e)},this.swipeRight=function(){return S(-n),this},this.swipeLeft=function(){return S(n),this},this.swipeUp=function(){return S(0,-a),this},this.swipeDown=function(){return S(0,a),this},OGX.Data.merge(g,_),(e=$(g.el)).addClass("ogx_grid_swiper"),e.attr("data-ogx-id",G),n=e.width(),a=e.height(),j(),U(),W()},OGX.GridSwiper.NAME="GridSwiper",OGX.GridSwiper.SWIPE_LEFT="GridSwiperSwipeLeft",OGX.GridSwiper.SWIPE_RIGHT="GridSwiperSwipeRight",OGX.GridSwiper.SWIPE_UP="GridSwiperSwipeUp",OGX.GridSwiper.SWIPE_DOWN="GridSwiperSwipeDown",OGX.GridSwiper.SWIPE_START="GridSwiperSwipeStart",OGX.GridSwiper.SWIPE_END="GridSwiperSwipeEnd",require("GroupedList","Uxi","Bind","Touch"),OGX.GroupedList=function(t){construct(this,"GroupedList");var e,i,n,a,r,o=this,s=t,l={group_by:"name",group_mode:null,group_param:null,group_order:null,order:null,list:new OGX.List,key:null,swipe:!1,reorder:!1,display:!1,mode:OGX.DynamicList.SELECT_MODE_HIT,scope:["public"]},c=[];function d(t){t?e.on(o.touch.down,".ogx_grouped_list_item",u):e.off(o.touch.down,".ogx_grouped_list_item",u)}function u(){e.find(".ogx_grouped_list_selected_item").removeClass("ogx_grouped_list_selected_item"),$(this).addClass("ogx_grouped_list_selected_item");var t=s.list[Number($(this).data("id"))];e.trigger(OGX.GroupedList.SELECT,t)}function h(t){var e=s.group_order.indexOf(t);if(-1===e)return e;for(var i=e,n=0;n<e;n++)-1===c.indexOf(s.group_order[n])&&i--;return i}function f(t,e){for(var n,a=0;a<i.nodes.length;a++)if(n=i.nodes[a].val().find(t,e,1))return{list:i.nodes[a],item:n};return!1}function g(){var t=!1,e=!1;if(s.list&&(t=s.list,a&&(t=n),t.length&&(e=r,r=t.group(s.group_by,s.group_mode,s.group_param))),t&&t.length){if(JSON.stringify(e)!==JSON.stringify(r)){o.find(OGX.NestList.NAME,o.id+"_nests","remove");var l=function(){var t='.ogx_grouped_list[data-ogx-id="'+o.id+'"]',e={};e[t+":NestList"]={id:o.id+"_nests",list:[],"node:OML":[]};var i,n=[],a=OGX.Data.clone(s.group_order);for(var l in r)i=s.group_order?s.group_order.indexOf(l):n.length,e[t+":NestList"].list.push({title:l}),c.push(l),n[i]={"default:DynamicList":{list:r[l],key:s.key,mode:s.mode,display:s.display,swipe:s.swipe,reorder:s.reorder,order:s.order}};for(var d=0;d<n.length;d++)void 0===n[d]&&(n.splice(d,1),a.splice(d,1),d--);return e[t+":NestList"]["node:OML"]=n,e[t+":NestList"].order=a,e}();OGX.OML.render(o,l),(i=o.find(OGX.NestList.NAME,o.id+"_nests")).updateNestsHeight()}}else r=!1,o.el.empty()}this._NAME_=OGX.GroupedList.NAME,this.el=null,this.enable=function(){return d(!0),this},this.disable=function(){return d(!1),this},this.bindFilter=function(t,e,i){return s.list.removeFilter(t),void 0!==i&&s.list.addFilter(t,e,i),s.list.getFilters()&&(n=s.list.filter(),a=!0),setTimeout(g,0),this},this.bindValue=function(){return this.getSelection()},this.destroy=function(){this.clearBinds()},this.scope=function(t){return void 0!==t?(s.scope=t,i.scope(t),!0):s.scope},this.val=function(t){if(void 0===t)return s.list;t.hasOwnProperty("insert")||(t=new OGX.List(t));var e=s.list.getFilters();"{}"!==JSON.stringify(e)&&(a=!0,t.setFilters(e),n=t.filter()),s.list=t,setTimeout(g,0)},this.nests=function(){return i||!1},this.filter=function(){return n=s.list.filter(),a=!0,setTimeout(g,0),this},this.unfilter=function(){return a=!1,setTimeout(g,0),this},this.addFilter=function(t,e,i){return s.list.addFilter(t,e,i)},this.removeFilter=function(t,e,i){return s.list.removeFilter(t,e,i)},this.resetFilters=function(){return s.list.resetFilters()},this.getFilters=function(){return s.list.getFilters()},this.addGroup=function(t,e,n){if(s.list.length){var a={title:t,scope:s.scope},r={};void 0===e&&(e=[]),r["default:DynamicList"]={list:e,key:s.key,mode:s.mode,display:s.display,swipe:s.swipe,reorder:s.reorder},i.addNest(a,r,n),s.group_order.insert(t,n),s.list=new OGX.List(s.list.concat(e)),c.push(t)}else s.list.insert(e),g();return this},this.removeGroup=function(t){return!!this.getGroupList(t)&&(i.removeNest(t),s.list.findDelete(s.group_by,t),c.splice(c.indexOf(t),1),!0)},this.addToGroup=function(t,e){var n=this.getGroupList(t);return n&&(n.insert(e),s.list.push(e),setTimeout((function(){i.updateNestHeight(t)}),0)),this},this.removeFromGroup=function(t,e,n){2===arguments.length&&(n=e,e=s.key);var a=this.getGroupList(t);return a&&(a.findDelete(e,n,1),s.list.findDelete(e,n,1),a.val().length?setTimeout((function(){i.updateNestHeight(t)}),0):this.removeGroup(t)),this},this.updateGroupItem=function(t,e,i,n){return this.getGroupList(t).findUpdate(e,i,n,!1,1),s.list.findUpdate(e,i,n,1),this},this.replaceGroupItem=function(t,e,i,n){return this.getGroupList(t).findReplace(e,i,n),s.list.findReplace(e,i,n,1),this},this.getGroupList=function(t){var e=h(t);return-1!==e&&e<i.nodes.length&&i.nodes[e]},this.hasGroup=function(t){return-1!==c.indexOf(t)},this.addItem=function(t){if(s.list.length){var e=t[s.group_by];if(this.hasGroup(e))this.addToGroup(e,t);else{var n=-1;-1!==s.group_order.indexOf(e)&&(n=h(e)),-1!==n?this.addGroup(e,[t],n):this.addGroup(e,[t])}setTimeout((function(){i.updateNestHeight(e)}),0)}else s.list.insert(t),g();return this},this.removeItem=function(t,e){s.key&&1===arguments.length&&(e=t,t=s.key);var n=s.list.find(t,e,1);if(n){var a=n[s.group_by];return this.removeFromGroup(a,t,e),setTimeout((function(){i.updateNestHeight(a)}),0),!0}return!1},this.replaceItem=function(t,e,n){s.key&&2===arguments.length&&(e=t,t=s.key);var a=f(t,e);if(a){var r=null;return a.item[s.group_by]!==n[s.group_by]?(r=a.item[s.group_by],a.list.findDelete(t,e,1),s.list.findDelete(t,e,1),-1===s.list.unique(s.group_by,!1).indexOf(r)&&(this.removeGroup(r),r=!1),this.addItem(n),setTimeout((function(){r&&i.updateNestHeight(a.item[s.group_by]),i.updateNestHeight(n[s.group_by])}),0)):a.list.findReplace(t,e,n),!0}return!1},this.updateItem=function(t,e,n,a){if(s.key){var r=arguments.length;void 0!==a&&(r--,a=!1),2===r&&(n=e,e=t,t=s.key)}var o=f(t,e);if(o){if(n.hasOwnProperty(s.group_by)&&o.item[s.group_by]!==n[s.group_by]){var l=o.item[s.group_by],c=o.list.findDelete(t,e,1);o.list.val().length||this.removeGroup(l),s.list.findDelete(t,e,1),c=OGX.Data.merge(c,n,!0,!1,a),this.addItem(c),o.list.val().length&&setTimeout((function(){i.updateNestHeight(l)}),0)}else o.list.findUpdate(t,e,n,a,1);return!0}return!1},this.render=function(){return setTimeout(g,0),this},this.refresh=function(){var t=e.find(".ogx_grouped_list_selected_item").first();if(t.length>0){var i=t.data("id");t.html(OGX.Templater.make(s.template,s.list[i]))}return this},OGX.Data.merge(s,l),s.list.hasOwnProperty("insert")||(s.list=new OGX.List(s.list)),s.group_order&&!s.group_order.hasOwnProperty("insert")&&(s.group_order=new OGX.List(s.group_order)),s.display&&s.display.hasOwnProperty("css")&&("object"!=typeof s.display.css&&s.display.css?s.display.css+=" ogx_grouped_list_item":s.display.hasOwnProperty("add")?s.display.add="ogx_grouped_list_item "+s.display.add:s.display.add="ogx_grouped_list_item"),r=!1,o.el=e=$(s.el),e.addClass("ogx_grouped_list"),g()},OGX.GroupedList.NAME="GroupedList",OGX.GroupedList.SELECT="GroupedListSelect",OGX.GroupedList.BIND=OGX.GroupedList.SELECT,require("Html","Uxi","Placeholder"),OGX.Html=function(t){construct(this,"Html"),this.rendered=!1,this._NAME_=OGX.Html.NAME,void 0!==t&&t&&(this.el=$(t.el),OGX.HtmlRender(t))},OGX.HtmlRender=function(t){var e=$(t.el),i=new OGX.Display(t);data=!1,t.data&&Object.keys(t.data).length&&(data=t.data),e.html(i.html(data)),t.css&&e.addClass(i.css(data)),t.hasOwnProperty("id")&&t.id&&"#"===t.id.substr(0,1)&&e.attr("id",t.id.substr(1))},OGX.Html.NAME="Html",require("Iceberg","Uxi","Touch"),OGX.Iceberg=function(t){construct(this,"Iceberg");var e,i,n,a,r=this,o={left:0,right:0,top:0,bottom:0,min:50,drag:!0,flatten:!1,"node:OML":{}},s=t,l=!1,c="normal",d="main",u={left:null,main:null,right:null,top:null,bottom:null},h=[0,0,0],f=0,g=0,_=0,p=0;function m(t){for(var e in u)u[e]&&u[e].instance&&(t===e?u[e].instance.focus():u[e].instance.blur())}function v(){l.hasClass("ogx_iceberg_anim")||(l.off("transitionend"),h=b(l))}function y(t){var e=0;return t.dirY&&t.distY>t.distX&&(e=1),e}function x(t){s.drag&&t.dist&&(!(n=y(t))&&["main","left","right"].includes(d)?t.dirX&&t.distX&&(e=h[0]+t.distX*t.dirX)<=g&&e>=f&&l.css({transform:"translate3d("+e+"px, 0, 0)"}):["main","top","bottom"].includes(d)&&t.dirY&&t.distY&&(i=h[1]+t.distY*t.dirY)<=p&&i>=_&&l.css({transform:"translate3d(0, "+i+"px, 0)"}))}function O(t){if(e=0,i=0,n=y(t),t.swipe&&t.dist){var r;switch(t.swipe=!1,d){case"main":-1===t.dirX&&s.right&&!n?(e=-u.right.outerWidth(),r="right",t.swipe=!0):1===t.dirX&&s.left&&!n?(e=u.left.outerWidth(),r="left",t.swipe=!0):1===t.dirY&&s.top&&n?(i=u.top.outerHeight(),r="top",t.swipe=!0):-1===t.dirY&&s.bottom&&n&&(i=-u.bottom.outerHeight(),r="bottom",t.swipe=!0);break;case"left":-1!==t.dirX||n||(e=0,r="main",t.swipe=!0);break;case"right":1!==t.dirX||n||(e=0,r="main",t.swipe=!0);break;case"top":-1===t.dirY&&n&&(i=0,r="main",t.swipe=!0);break;case"bottom":1===t.dirY&&n&&(i=0,r="main",t.swipe=!0)}a=n?1===t.dirY?OGX.Iceberg.SWIPE_DOWN:OGX.Iceberg.SWIPE_UP:1===t.dirX?OGX.Iceberg.SWIPE_RIGHT:OGX.Iceberg.SWIPE_LEFT,t.swipe&&t.dist&&(l.addClass("ogx_iceberg_anim"),l.on("transitionend",(function(){l.off("transitionend"),l.removeClass("ogx_iceberg_anim"),h=b(l),m(d=r),l.trigger(a,d)})),l.css({transform:"translate3d("+e+"px, "+i+"px, 0)"}))}else if(t.dist){switch(e=0,i=0,d){case"left":e=u.left.outerWidth();break;case"right":e=-u.right.outerWidth();break;case"top":i=u.top.outerHeight();break;case"bottom":i=-u.bottom.outerHeight()}l.addClass("ogx_iceberg_anim"),l.on("transitionend",(function(){l.off("transitionend"),l.removeClass("ogx_iceberg_anim"),h=b(l),l.trigger(OGX.Iceberg.RESTORE,d)})),l.css({transform:"translate3d("+e+"px, "+i+"px, 0)"})}}function b(t){var e=t[0].style.transform;if(e=e.match(/translate3d\(([0-9px%,\.\- ]+)\)/)){e=e[1].split(",");for(var i=0;i<e.length;i++)e[i]=Number(e[i].split("px")[0]);return e}return[0,0,0]}function w(){var t;for(var e in u)u[e]&&((t=u[e].children().first()).length&&t[0].hasAttribute("data-ogx-id")?u[e].instance=r.nodes.find("id",String(t.data("ogx-id")),1):u[e].instance=!1)}this._NAME_=OGX.Iceberg.NAME,this.el=null,this.show=function(t,e){if(void 0===t&&(t=!1),"normal"===c)for(var i in u)if(u[i]&&u[i].instance&&u[i].instance.id===e){if(!t)return this.val(i),!0;if(u[i].instance._NAME_===u[i].instance.NAME)return this.val(i),!0}return!1},this.val=function(t){if(void 0===t)return d;if(e=0,i=0,"normal"===c){switch(t){case"left":e=u.left.outerWidth();break;case"top":i=u.top.outerHeight();break;case"main":e=0;break;case"right":e=u.left.outerWidth();break;case"bottom":i=-u.bottom.outerHeight()}u[d].instance&&u[d].instance.blur(),u[d=t].instance&&u[d].instance.focus(),l.css({transform:"translate3d("+e+"px, "+i+"px, 0)"})}},this.enable=function(){return"flattened"!==c&&(this.touch.swipe.enable(),setTimeout((function(){m(d)}),0)),this},this.disable=function(){return this.touch.swipe.disable(),this},this.focus=function(){return this.blured&&(this.blured=!1,this.enabled&&(this.ux(!0),this.enable())),this},this.resize=function(){return u.left&&(g=u.left.outerWidth()),u.right&&(f=-u.right.outerWidth()),u.top&&(p=u.top.outerHeight()),u.bottom&&(_=-u.bottom.outerHeight()),s.flatten&&("flattened"!==c&&this.el.outerWidth()>=s.flatten?(c="flattened",h=b(l),l.addClass("ogx_iceberg_views_flattened").css("transform","translate3d(0px, 0px, 0px)"),l.children(".ogx_iceberg_view").addClass("ogx_iceberg_view_flattened"),this.disable()):"flattened"===c&&this.el.width()<s.flatten&&(c="normal",l.children(".ogx_iceberg_view").removeClass("ogx_iceberg_view_flattened"),l.removeClass("ogx_iceberg_views_flattened").css("transform","translate3d("+h[0]+"px, 0px, 0px)"),this.enable())),this},OGX.Data.merge(s,o),width=Math.round($(s.el).innerWidth()),height=$(s.el).innerHeight(),r.el=$(s.el),r.el.addClass("ogx_iceberg"),function(){var t,e,i='<div class="ogx_iceberg_views ogx_hw">',n={},a='.ogx_iceberg[data-ogx-id="'+r.id+'"] > .ogx_iceberg_views > .ogx_iceberg_view[data-ogx-panel-id="';for(var o in s["node:OML"])for(var c in s["node:OML"][o])0===c.indexOf("left")&&(i+='<div class="ogx_iceberg_view_left ogx_view ogx_iceberg_view" data-ogx-panel-id="left" style="width:'+(isNaN(s.left)?s.left:s.left+"px")+';"></div>',n.left=a+'left"]',u.left=!0),0===c.indexOf("top")&&(i+='<div class="ogx_iceberg_view_top ogx_view ogx_iceberg_view" data-ogx-panel-id="top" style="height:'+(isNaN(s.top)?s.top:s.top+"px")+';"></div>',n.top=a+'top"]',u.top=!0),0===c.indexOf("main")&&(i+='<div class="ogx_iceberg_view_main ogx_view ogx_iceberg_view" data-ogx-panel-id="main"></div>',n.main=a+'main"]'),0===c.indexOf("right")&&(i+='<div class="ogx_iceberg_view_right ogx_view ogx_iceberg_view" data-ogx-panel-id="right" style="width:'+(isNaN(s.right)?s.right:s.right+"px")+';"></div>',n.right=a+'right"]',u.right=!0),0===c.indexOf("bottom")&&(i+='<div class="ogx_iceberg_view_bottom ogx_view ogx_iceberg_view" data-ogx-panel-id="bottom" style="height:'+(isNaN(s.bottom)?s.bottom:s.bottom+"px")+';"></div>',n.bottom=a+'bottom"]',u.bottom=!0);for(r.el.html(i),o=0;o<s["node:OML"].length;o++)for(var c in s["node:OML"][o])t=c.split(":")[0],e=c.replace(t,n[t]),s["node:OML"][o][e]=s["node:OML"][o][c],delete s["node:OML"][o][c];l=r.el.children(".ogx_iceberg_views").first(),u.left&&(u.left=l.children(".ogx_iceberg_view_left").first(),g=u.left.outerWidth()),u.top&&(u.top=l.children(".ogx_iceberg_view_top").first(),p=u.top.outerHeight()),u.main=l.children(".ogx_iceberg_view_main").first(),u.right&&(u.right=l.children(".ogx_iceberg_view_right").first(),f=-u.right.outerWidth()),u.bottom&&(u.bottom=l.children(".ogx_iceberg_view_bottom").first(),_=-u.bottom.outerHeight())}(),setTimeout(w,0),r.touch.swipe.set({x:!0,y:!0,min_x:s.min,min_y:s.min,cb_down:v,cb_swipe:x,cb_up:O}),r.resize()},OGX.Iceberg.NAME="Iceberg",OGX.Iceberg.SHOW="icebergShow",OGX.Iceberg.SWIPE_UP="icebergSwipeUp",OGX.Iceberg.SWIPE_DOWN="icebergSwipeDown",OGX.Iceberg.SWIPE_LEFT="icebergSwipeLeft",OGX.Iceberg.SWIPE_RIGHT="icebergSwipeRight",OGX.Iceberg.RESTORE="icebergRestore",OGX.Loading=function(t){"use strict";var e=!1,i={display:{css:"ogx_loading",html:" ",anim:OGX.Overlay.FADE}};t.hasOwnProperty("loading")&&t.loading&&setTimeout(this.addLoading,0),this.hasLoading=function(){return!!e},this.addLoading=function(t){return e||(e=!0,void 0===t&&(t={}),OGX.Data.merge(t,i),this.addOverlay(t)),this},this.removeLoading=function(t){return e&&(this.removeOverlay(t),e=!1),this}},OGX.Media=function(){"use strict";var t=!1,e={},i=0;function n(t,e,i){var n=$(t),a=n.parent().innerWidth(),r=n.parent().innerHeight(),o=function(t,e){var i={};return t.width/t.height>e.width/e.height?(i.width=e.width,i.height=Math.round(t.height*(e.width/t.width))):(i.width=Math.round(t.width*(e.height/t.height)),i.height=e.height),i}({width:e,height:i},{width:a,height:r}),s=(a-o.width)/2,l=(r-o.height)/2;n.css("left",s+"px"),n.css("top",l+"px"),n.prop("width",o.width),n.prop("height",o.height)}function a(t){var e,i=$(t);i&&(i.find(".ogx_video").each((function(t,i){e=$(i),function(t,e,i){var n=$(t),a=e/i,r=n.parent().innerWidth(),o=n.parent().innerHeight(),s=r,l=Math.ceil(s/a);l<o&&(s=(l=o)*a),n.prop("width",s),n.prop("height",l)}(i,parseInt(e.data("width"),10),parseInt(e.data("height"),10))})),i.find(".ogx_video_resp").each((function(t,i){e=$(i),function(t,e,i){var n=$(t),a=e/i,r=n.parent().innerWidth(),o=n.parent().innerHeight(),s=r,l=Math.ceil(s/a);l<o&&(s=(l=o)*a),n.prop("width",s),n.prop("height",l)}(i,parseInt(e.data("width"),10),parseInt(e.data("height"),10))})),i.find(".ogx_video_poster").each((function(t,i){e=$(i),function(t,e,i){var n=$(t),a=e/i,r=n.parent().innerWidth(),o=n.parent().innerHeight(),s=r,l=Math.ceil(s/a),c=0,d=0;l<o&&(l=o,s=Math.ceil(l*a)),s>r?c=(s-r)/2*-1:s<r&&(c=(r-s)/2*-1),l>o?d=(l-o)/2*-1:l<o&&(d=(o-l)/2*-1),n.css("left",c+"px"),n.css("top",d+"px"),n.prop("width",s),n.prop("height",l)}(i,parseInt(e.data("width"),10),parseInt(e.data("height"),10))})),i.find(".ogx_image_contain").each((function(t,i){e=$(i),n(i,parseInt(e.data("width"),10),parseInt(e.data("height"),10))})),i.find(".ogx_image_cover").each((function(t,i){e=$(i),function(t,e,i){var n=$(t),a=n.parent().innerWidth(),r=a/(e/i),o=(n.parent().innerHeight()-r)/2;o>0&&(o=0),n.parent().css("overflow","hidden"),n.prop("width",a),n.prop("height",r),n.css("top",o+"px")}(i,parseInt(e.data("width"),10),parseInt(e.data("height"),10))})),i.find(".ogx_image_fit").each((function(t,i){e=$(i),function(t,e,i){var n=$(t),a=e/i,r=n.parent().innerWidth(),o=r,s=Math.ceil(o/a),l=0;o>r?l=(o-r)/2*-1:o<r&&(l=(r-o)/2*-1),n.css("left",l+"px"),n.prop("width",o),n.prop("height",s)}(i,parseInt(e.data("width"),10),parseInt(e.data("height"),10))})),i.find(".ogx_image_scale").each((function(t,i){e=$(i),function(t,e,i){var n=$(t),a=e/i,r=n.parent().innerWidth(),o=Math.ceil(r/a);n.prop("width",r),n.prop("height",o)}(i,parseInt(e.data("width"),10),parseInt(e.data("height"),10))})),i.find(".ogx_image_resp").each((function(t,i){e=$(i),function(t,e,i){var n=$(t),a=e/i,r=n.parent().innerWidth();r>e&&(r=e);var o=Math.ceil(r/a);n.prop("width",r),n.prop("height",o)}(i,parseInt(e.data("width"),10),parseInt(e.data("height"),10))})))}function r(t){t?$(window).on("resize",o):$(window).off("resize",o)}function o(){for(var t in e)a(e[t].selector)}function s(t){var e;t.find(".ogx_video, .ogx_video_resp, .ogx_video_poster").each((function(t,i){(e=$(i)).parent().css("overflow","hidden"),i.hasAttribute("data-width")||(e.attr("data-width",e.attr("width")),e.attr("data-height",e.attr("height")))})),t.find(".ogx_image_cover, .ogx_image_contain, .ogx_image_fit, .ogx_image_scale, .ogx_image_resp").each((function(t,i){(e=$(i)).css("position","relative"),i.hasAttribute("data-width")||(e.attr("data-width",e.attr("width")),e.attr("data-height",e.attr("height")))})),a(t)}this.resize=function(t){void 0!==t?a(t):o()},this.bind=function(n,a){return!e.hasOwnProperty(n)&&(e[n]={observer:null,element:a},e[n].observer=(o=a,l=null,(c=new(window.MutationObserver||window.WebKitMutationObserver)((function(t,e){t.forEach((function(t){l&&clearTimeout(l),l=setTimeout((()=>{s($(o))}),10)}))}))).observe(document.querySelector(o),{childList:!0,subtree:!0}),c),e[n].selector=a,i++,t||(t=!0,r(!0)),s($(a)),!0);var o,l,c},this.unbind=function(n){return!(!e.hasOwnProperty(n)||!e[n].observer)&&(e[n].observer.disconnect(),delete e[n],!--i&&t&&(t=!1,r(!1)),!0)}},OGX.Media=new OGX.Media,require("NestList","Uxi","Bind"),OGX.NestList=function(t){construct(this,"NestList");var e,i,n=this,a={scope:["public"],template:'<div class="ogx_nest_list_item {{$dsp}}" data-ogx-nest-id="{{$id}}"><div class="ogx_nest_list_item_head {{$css}}"><span class="ogx_nest_list_item_title">{{$title}}</span><span class="ogx_nest_list_item_icon"></span></div><div class="ogx_nest_list_item_body"><div class="ogx_nest_list_item_content">{{$body}}</div></div></div>',list:new OGX.List,item_default:!1,map:{title:"title",scope:"scope",id:"id"},order:!1},r={title:"",scope:[],open:!0},o={id:0,title:!1,scope:[],height:0,y:0,hidden:!1,open:!0,selector:!1},s=t,l=!1,c=0,d=0,u=1,h={y:0,h:0,way:1},f=!1,g=new OGX.List;function _(t){t?e.on("click",".ogx_nest_list_item_head",p):e.off("click",".ogx_nest_list_item_head",p)}function p(t){l||(l=!0,m($(this)))}function m(t){var i=t.parent(0).data("ogx-nest-id"),n=!1;t.hasClass("ogx_nest_list_item_head_closed")?(h.way=1,t.addClass("ogx_nest_list_item_head_open").removeClass("ogx_nest_list_item_head_closed"),g.findUpdate("id",i,{open:!0},!1,1),n=!0):(h.way=0,t.removeClass("ogx_nest_list_item_head_open").addClass("ogx_nest_list_item_head_closed"),g.findUpdate("id",i,{open:!1},!1,1));var a=g.find("id",i,1);n?(!function(t){var e=v(t);if(e)return e.focus(),!0}(a),e.trigger(OGX.NestList.OPEN,a)):(!function(t){var e=v(t);if(e)return e.blur(),!0}(a),e.trigger(OGX.NestList.CLOSE,a)),setTimeout(x,0)}function v(t){var e=$(t.selector).find(".ogx_uxi").first();if(e.length){var i=String(e.data("ogx-id")),a=n.nodes.find("id",i,1);if(a)return a}return!1}function y(t){if(t.hasOwnProperty("scope"))for(var e=0;e<t.scope.length;e++)if(-1!==s.scope.indexOf(t.scope[e]))return!0;return!1}function x(){var t;!function(){var t=0;d=0,h.y=0,h.h=0;for(var i=0;i<g.length;i++)g[i].y=t,g[i].hidden||(c||(c=e.children(".ogx_nest_list_item:eq("+i+")").children(".ogx_nest_list_item_head").outerHeight(!0)),d+=c,h.y=t,g[i].open&&(h.y+=g[i].height,t+=g[i].height,d+=g[i].height),h.h=g[i].height);d-=h.h}();for(var i=e.children(".ogx_nest_list_mask").first(),a=0;a<g.length;a++)(t=e.children('.ogx_nest_list_item[data-ogx-nest-id="'+g[a].id+'"]')).removeClass("ogx_nest_list_item_noanim"),t.css("transform","translateY("+g[a].y+"px)");var r="height:"+Math.ceil(d+h.h)+"px !important;";i.on("transitionend",(function(){h.way||e.css("cssText",r),l=!1,n.scroller&&n.scroller.resize()})),h.way&&e.css("cssText",r),setTimeout((function(){i.css({transform:"translateY("+h.y+"px)"})}),0)}function O(t,i){OGX.Data.merge(t,r);var a=OGX.Data.merge(o,t,!0,!0);t.hasOwnProperty(s.map.id)?a.id=t[s.map.id]:(a.id=u,u++);var l,c,d=((c={css:"",dsp:"ogx_nest_list_prep",id:(l=a).id})[s.map.title]=l[s.map.title],l.open?c.css="ogx_nest_list_item_head_open":c.css="ogx_nest_list_item_head_closed",OGX.Templater.make(s.template,c));void 0!==i&&i<s.list.length-1?e.children(".ogx_nest_list_item:eq("+i+")").before(d):e.children(".ogx_nest_list_mask").first().before(d),a.selector='.ogx_nest_list[data-ogx-id="'+n.id+'"] > .ogx_nest_list_item[data-ogx-nest-id="'+a.id+'"] > .ogx_nest_list_item_body > .ogx_nest_list_item_content';var h=$('.ogx_nest_list[data-ogx-id="'+n.id+'"] > .ogx_nest_list_item[data-ogx-nest-id="'+a.id+'"]');return a.hidden&&h.addClass("ogx_nest_list_item_hidden"),h.removeClass("ogx_nest_list_prep"),a}function b(){var t=s.list;f&&(t=i),e.empty(),g.clear();var a;e.html('<div class="ogx_nest_list_mask"></div>'),s.hasOwnProperty("node:OML")||(s["node:OML"]=[]);for(var r=0;r<t.length;r++)a=O(t[r]),g.push(a),s["node:OML"][r]=OGX.OML.rename(s["node:OML"][r],a.selector);n.observe(!0,{childList:!0,subtree:!0},(function(){n.updateNestsHeight()}))}function w(){for(var t=[],e=0;e<s.list.length;e++)t[s.order.indexOf(s.list[e][s.map.title])]=s.list[e];return s.list=new OGX.List(t)}function G(){s.list.hasOwnProperty("insert")||(s.list=new OGX.List(s.list));for(var t=0;t<s.list.length;t++)s.item_default?OGX.Data.merge(s.list[t],s.item_default):OGX.Data.merge(s.list[t],r),s.order&&w()}this.el=null,this._NAME_=OGX.NestList.NAME,this.enable=function(){return _(!0),this},this.disable=function(){return _(!1),this},this.show=function(t,e){var i=this.find(t,e);i&&m(i.el.parents(".ogx_nest_list_item").first().children(".ogx_nest_list_item_head").first());return this},this.bindFilter=function(t,e,n){s.list.removeFilter(t),void 0!==n&&s.list.addFilter(t,e,n),s.list.getFilters()&&(i=s.list.filter(),f=!0),setTimeout(b,0)},this.destroy=function(){e.children(".ogx_nest_list_mask").off("transitionend"),n.observe(!1)},this.scope=function(t){return void 0!==t?(s.scope=t,function(){for(var t,i=0;i<g.length;i++)(t=e.children(g[i].selector)).addClass("ogx_nest_list_item_noanim"),y(g[i])?(g[i].hidden=!1,t.removeClass("ogx_nest_list_item_hidden")):(g[i].hidden=!0,t.addClass("ogx_nest_list_item_hidden"));setTimeout(x,0)}(),!0):s.scope},this.val=function(t){if(void 0===t)return s.list;s.list=t,G(),setTimeout(b,0)},this.addNest=function(t,e,i){var n=O(t,i);if(g.insert(n,i),e=OGX.OML.rename(e,n.selector),OGX.OML.render(this,e),void 0!==i){var a=this.nodes.pop();this.nodes.insert(a,i)}},this.removeNest=function(t){var e=g.findIndex(s.map.title,t);e&&(this.nodes[e.index].kill(),this.nodes.splice(e.index,1),$('.ogx_nest_list[data-ogx-id="'+n.id+'"] > .ogx_nest_list_item[data-ogx-nest-id="'+g[e.index].id+'"]').remove(),g.splice(e.index,1),setTimeout(x,0))},this.updateNestHeight=function(t){var e=g.find(s.map.title,t,1);setTimeout((function(){var t,i;t=e,i=$(t.selector).outerHeight(!0),t.height=i,x()}),0)},this.updateNestsHeight=function(){for(var t,e=0;e<g.length;e++)t=g[e],this.updateNestHeight(t[s.map.title])},this.updateMask=function(){x()},OGX.Data.merge(s,a),G(),s.template=s.template.replace("{{$title}}","{{$"+s.map.title+"}}"),n.el=e=$(s.el),e.addClass("ogx_nest_list"),s.list.length&&b()},OGX.NestList.NAME="NestList",OGX.NestList.OPEN="NestListOpen",OGX.NestList.CLOSE="NestListClose",OGX.NestList.READY="NestListReady",OGX.Net=function(t){"use strict";var e=1,i=OGX.Data.merge(t,{file_default:{file:!1,path:!1},extensions:[{ext:"json",path:"/json",type:"json"},{ext:"js",path:"/js",type:"text"},{ext:"html",path:"/html",type:"text"},{ext:"oml",path:"/oml",type:"json"},{ext:"ose",path:"/ose",type:"text"},{ext:"mp3",path:"/snd",type:"mp3"},{ext:"wav",path:"/snd"},{ext:"ogg",path:"/snd"},{ext:"png",path:"/img"},{ext:"jpg",path:"/img"},{ext:"gif",path:"/img"},{ext:"svg",path:"/img"}],ios:!1},!1,!0);function n(t,e,i){switch(t.ext){case"json":case"txt":case"oml":case"ose":case"html":case"snd":"app.json"!==t.file&&OGX.Cache.add(t)}void 0!==e?setTimeout((function(){e(t.data,i)}),0):$(document).trigger(OGX.Net.LOAD_SUCCESS,t)}function a(t,e,a){var r;"/"===(r=t.path+"/"+t.file).substr(0,1)&&(r=r.substr(1)),i.encrypted&&"app.json"===r&&(t.type="text"),$.ajax({dataType:t.type,url:r}).done((function(i){t.data=i,n(t,e,a)}))}i.extensions.hasOwnProperty("insert")||(i.extensions=new OGX.List(i.extensions)),this.preload=function(t,e,i){var n={loaded:0,total:0,files:new OGX.List};for(var a in t)for(var r=0;r<t[a].length;r++)n.total++,this.load(a+"/"+t[a][r],o);function o(t,a){n.loaded++,n.files.insert(t),n.loaded===n.total&&setTimeout((function(){e(n.files,i)}),0)}},this.load=function(t,r,o){var s,l={file:null,path:null};-1!==t.indexOf("/")?(s=t.split("/"),l.file=s.pop(),l.path=s.join("/")):(l.path="",l.file=t),OGX.Data.merge(l,i.file_default);var c=function(t){var e;if(e=/([a-z0-9\_\-]+\.)?([a-z0-9\_\-]+)\.([a-z0-9]{3,4})/gi.exec(t))return e.shift(),e;return!1}(l.file);if(c)switch(l.ext=c[2],l.id=c[1],l.ext){case"json":case"txt":case"oml":case"ose":case"html":l.type=i.extensions.find("ext",l.ext,1).type,a(l,r,o);break;case"mp3":case"ogg":case"wav":!function(t,e,i){var a;function r(){var r=t.path+"/"+t.file;"/"===r.substr(0,1)&&(r=r.substr(1)),a=new Audio(r),t.data=a,t.ext="snd",t.format=t.file.split(".").pop(),n(t,e,i)}r()}(l,r,o);break;case"png":case"gif":case"jpg":case"svg":!function(t,e,i){var a=new Image;function r(){a.onload=function(){t.data=a,n(t,e,i)};var r=t.path+"/"+t.file;"/"===r.substr(0,1)&&(r=r.substr(1)),a.src=r}r()}(l,r,o);break;case"ttf":case"eot":case"woff":case"woff2":!function(t,i,a){function r(){var r,o='<div class="ogx_font_loader" style="font-family:'+t.file.split(".")[0]+';" data-ogx-id="font-loader-'+e+'"><b>ogx</b> <i>font</i> init</div>';$("body").append(o),n(t,i,a),r=e,setTimeout((function(){$('.ogx_font_loader[data-ogx-id="font-loader-'+r+'"]').remove()}),150),e++}r()}(l,r,o);break;case"pak":!function(t,e,i){function r(a){for(var r,o=/<!--\[([a-zA-Z0-9_\-]+)\]-->/gi,s=[];r=o.exec(a);)s.push(r[1]);o=/<!--\[[a-zA-Z0-9_\-]+\]-->/gi;var l,c,d,u=a.split(o);u.shift();for(var h=0;h<s.length;h++){switch(t.path){case"/html":c="template."+s[h]+".html",d=u[h];break;default:c=s[h]+"."+t.path.substr(1),d=JSON.parse(u[h])}l={ext:t.path.substr(1),data:d,path:t.path,id:s[h],file:c},OGX.Cache.add(l)}n(t,e,i)}a(t,r,i)}(l,r,o)}}},OGX.Net.LOAD_SUCCESS="NET_LOAD_SUCCESS",OGX.OSE=function(){"use strict";var charcode,to="__thread_object",lo="__local_object",ro="__route_object",oo="__object";function convertValue(t){if(-1===t.indexOf(":"))return t;var e=t.split(":");switch(e[1]){case"Boolean":return"true"===e[0];case"Number":var i=Number(e[0]);return!isNaN(i)&&i}}function convertToJS(t,e,i,n,a){var r,o,s,l,c,d=0,u="";if(t=(t=t.replace(/^[ \n\r]*{{|}}[\r\n ]*$/g,"")).replace(/(\/\*+((?!\*+\/)[\S\s])*\*+\/)/g,""),(o=/(screen ?([<>=!+]+ ?\d+) ?\? ?([\S\s]+) ?\: ?([\S\s]+);?)/gi.exec(t))&&(l=(l=(l="var a;"+o[0]).replace("screen","screen.width")).replace(o[3],'a="'+o[3].trim()+'"'),l="null"!==o[4]?l.replace(o[4],'a="'+o[4].trim()+'"'):l.replace(o[4],"a=false;"),l+=";if(a){return a;}",c=new Function(l),t=t.replace(o[0],c())),(o=/(scope ([\S ]+) ?\? ?([\S ]+)\: ?([\S ]+);?)/gi.exec(t))&&(l=o[0],t="null"===(l=(s=OGX.Scope.eval(o[2]))?o[3]:o[4])?t.replace(o[0],""):t.replace(o[0],l)),(o=/(uxi *(?:#|\$|&|@)*([a-z0-9_\-]+)):(([a-z0-9]+))/gi.exec(t))&&(s='OGX.Object.get({_NAME_:{eq:"'+o[3]+'"}, id:{eq:"'+o[2]+'"}}, null, 1);')===(t=t.replace(o[0],s)))return"return "+t;if((o=/mongogx ([a-z0-9_\-]+)\.([a-z0-9_\-]+)\.([a-z]+)\(([\S ]+)\)/gi.exec(t))&&(s="mongogx.setDatabase('"+o[1]+"');",s+="mongogx.setCollection('"+o[2]+"');",(s+="return mongogx."+o[3]+"("+o[4]+")[0];")===(t=t.replace(o[0],s))))return s;if(isSingleVar(t))return"return "+replaceVars(t,e,i,n,a)+";";for(t+="\r\n";r=/[\S ]+(\r\n|\n)?/gi.exec(t);){if(l=replaceLoop(l=r[0].replace(/(\r\n|\n)/gi,"").trim(),e,i,n,a),charcode++,l=replaceVars(l,e,i,n,a),/^(app|OGX)\.\S+;?/g.test(l))return"return "+l+";";if(t=t.replace(r[0],""),u+=l+"\n",++d>100)return}return u="var __echo=[];\n"+u+'\nif(!__echo.length){return;}else{return __echo.join("");}'}function runJS(t,e,i,n,a,r){var o;try{o=new Function(oo,to,ro,lo,t)(e,i,n,a)}catch(t){return}if(void 0!==o)return o}function isSingleVar(t){return/^[ ]*\S+( \S+)?[ ]*$/g.test(t)}function getTrueVal(__string,__object,__thread_object,__route_object,__local_object){var e=!1;try{e=eval(__string)}catch(t){}return!e||e&&e instanceof HTMLElement?'"'+__string+'"':e?'"'+e+'"':__string}function replaceLoop(t,e,i,n,a){var r,o,s,l;return(r=/loop (\S+) ?(as (\S+) ?(\S+ )?)?{/gi.exec(t))&&(o="__"+String.fromCharCode(charcode).toLowerCase()+"__",s=(s=r[0]).replace(r[0],"for(var "+o+" in JSON.parse(JSON.stringify("+r[1]+"))){"),r[2]&&(l=r[4]?"&"+r[3]+"="+o+"; &"+r[4]+"="+r[1]+"["+o+"]; ":"&"+r[3]+"="+r[1]+"["+o+"]; "),s+=l,t=t.replace(r[0],s)),t}function replaceVars(t,e,i,n,a){for(var r,o,s,l=0;o=/((&|#|@|\$)([a-z0-9\-_]+))(\.[a-z0-9\-_\.\[\]\$]+|\.\$|\.)?(;)?/gi.exec(t);){switch(s=!1,o[2]){case"&":s=to+"."+o[3];break;case"@":s=lo+"."+o[3];break;case"$":s=oo+"."+o[3];break;case"#":s=o[3]}if(r=o[0].replace(o[1],s),t=t.replace(o[0],r),++l>300)return t}for(;o=/([a-z_\-]+)\((\$|@|&)\)/gi.exec(t);){switch(o[2]){case"&":s=to;break;case"@":s=lo;break;case"$":s=oo}r=o[1]+"("+s+")",t=t.replace(o[0],r)}for(;/^(json|ose|template|oml|crumb) (\S+)/g.test(t);)if((o=/crumb (\S+)?/gi.exec(t))&&(r="__route_object."+o[1],t=t.replace(o[0],r)),(o=/json (\S+)(;)?/gi.exec(t))&&(t=t.replace(o[0],"app.getJSON("+getTrueVal(o[1],e,i,n,a)+")")),(o=/^template (\S+)[ ;]?/gi.exec(t))&&(t=t.replace(o[0],"OGX.Templater.make(OGX.Templater.get("+getTrueVal(o[1],e,i,n,a)+"), "+o[2]+", "+to+","+ro+","+lo+")")),(o=/^ose (\S+)(;)?/gi.exec(t))&&(o[1]=getTrueVal(o[1],e,i,n,a),script=that.get(o[1]),script&&(t=exp.replace(o[0],script.replace(/({{|}})/g,"")))),(o=/^oml (\S+)(;)?/gi.exec(t))&&(t=t.replace(o[0],"app.getOML("+getTrueVal(o[1],e,i,n,a)+")")),++l>300)return t;for(;o=/echo ('|")?(((?![;}\r\n]+|$)([\S\s]))*)(?:'|")?/gi.exec(t);){var c="+$1+",d="'";if(void 0!==o[1]&&(d="\\"+o[1]),c=d+c+d,o[2]=o[2].replace(/(__(?!;\n\r)[a-z0-9_\-\.]+)/gi,c),r="__echo.push("+d+o[2]+d+");",t=t.replace(o[0],r),++l>300)return t}return t}this.get=function(t){return OGX.Cache.read("ose",t)},this.fork=function(t,e){var i,n;if(i=t.split(":")[0],void 0===e.data&&(e.data={}),void 0!==(n=OGX.OSE.exec(i,e.data)))for(var a in e.values)if(convertValue(a)===n)return e.values[a];return!1},this.execScript=function(t,e,i,n){var a=this.get(t);return a&&this.exec(a,e,i,n),!1},this.exec=function(t,e,i,n,a){void 0===e&&(e={}),void 0===i&&(i={}),void 0===n&&(n={}),void 0===a&&(a={}),charcode=65;var r=runJS(convertToJS(t,e,i,n,a),e,i,n,a,t);if(void 0!==r)return r},this.loadExecScript=function(t,e,i,n,a){$.get(t,(function(t){OGX.OSE.exec(t,e,i,n,a)}))}},OGX.OSE=new OGX.OSE,OGX.OSE.SCRIPT_LOADED="OSE_SCRIPT_LOADED",OGX.OSE.SCRIPTS_LOADED="OSE_SCRIPTS_LOADED",OGX.Overlay=function(t){"use strict";var e=this,i=!1,n=!1,a={anim:OGX.Overlay.FADE,display:{css:"",html:" "},index:!1,close_on_click:!1},r=!1,o="mousedown";function s(t){i&&(t?i.on(o,l):i.off(o,l))}function l(){"function"==typeof r.close_on_click&&r.close_on_click.apply(null,e),s(!1),e.removeOverlay()}t.hasOwnProperty("overlay")&&t.overlay&&setTimeout((function(){e.addOverlay(t.overlay)}),0),this.hasOverlay=function(){return!!i},this.addOverlay=function(t){if("object"!=typeof t&&(t={}),OGX.Data.merge(t,a),t.display.hasOwnProperty("_NAME_")||(t.display=new OGX.Display(t.display)),r=t,!this.hasOverlay()){var e=this.el;r.hasOwnProperty("el")&&(e=$(r.el));var n="z-index:"+(r.zindex?r.zindex:this.topIndex(e))+";",o='<div class="ogx_overlay '+r.display.css()+'" style="'+n+'">'+r.display.html()+"</div>";if(e.prepend(o),(i=e.children(".ogx_overlay").first()).off("transitionend"),r.anim)switch(r.anim){case OGX.Overlay.FADE:setTimeout((function(){i&&i.removeClass("ogx_overlay_fade_out").addClass("ogx_overlay_fade_in")}),50)}else i.css("opacity",1)}return t.close_on_click&&s(!0),this},this.removeOverlay=function(t){s(!1);var e=!1;if(void 0===t||!0===t?r.anim&&(e=r.anim):e=t,i){if(e){switch(e){case OGX.Overlay.FADE:i.removeClass("ogx_overlay_fade_in").addClass("ogx_overlay_fade_out"),i.css("opacity")>0?i.on("transitionend",(function(){i&&(i.off("transitionend"),i.remove(),i=!1)})):i&&(i.removeClass("ogx_overlay_fade_in").removeClass("ogx_overlay_fade_out"),i.off("transitionend"),i.remove(),i=!1)}return}return i.remove(),void(i=!1)}return this},this.addGroupOverlay=function(){return n||(this.el.prepend('<div class="ogx_group_overlay" style="z-index:'+(this.topIndex()+1e3)+'"></div>'),n=!0),this},this.removeGroupOverlay=function(){return n&&(this.el.children(".ogx_group_overlay").remove(),n=!1),this}},OGX.Overlay.FADE="fade",OGX.Overlay.REMOVE="OverlayRemove",OGX.Placeholder=function(t){"use strict";this.pholder=null,t.hasOwnProperty("placeholder")&&(this.pholder=t.placeholder),this.placeholder(t)},OGX.Placeholder.prototype.placeholder=function(t){var e;if("object"==typeof t["node:OML"]&&!Array.isArray(t["node:OML"])){var i=this.selector;for(var n in this.pholder&&(i+=" "+this.pholder),t["node:OML"])0===n.indexOf("default")&&(e=n.replace("default",i),t["node:OML"][e]=t["node:OML"][n],delete t["node:OML"][n])}},OGX.Placeholder.prototype.placeholders=function(t,e){if(void 0!==t&&void 0!==e){t.hasOwnProperty("node:OML")||(t["node:OML"]=[]);var i,n,a=t["node:OML"];a&&"string"==typeof a&&(0===a.indexOf("{{")?t["node:OML"]=OGX.OSE.exec(a):t["node:OML"]=OGX.Cache.read("oml",t["node:OML"]));for(var r=0;r<t["node:OML"].length;r++)for(var o in"string"==typeof(n=t["node:OML"][r])&&(n=0===n.indexOf("{{")?OGX.OSE.exec(n):OGX.Cache.read("oml",n)),n)if(0===o.indexOf("default")){i=o.split(":")[1],n[e[r]+":"+i]=n[o],delete n[o];break}return t}return!1},require("Point","Uxi","Placeholder"),OGX.Point=function(t){construct(this,"Point");var e,i=this,n=OGX.Data.merge(t,{live:[],mode:0}),a=new OGX.List,r=0;function o(){var t=function(){var t=i.el.width();if(t&&t!==r&&(r=t),r)for(var e=0;e<i.points.length;e++)if(r>=i.points[e].min&&r<i.points[e].max)return{id:e,oml:i.points[e].oml};return!1}();return!(!t||t.id===i.point)&&(i.point=t.id,!0)}this.points=[],this.point=null,this.el=$(t.el),this._NAME_=OGX.Point.NAME,this.construct=function(t,e){},this.resize=function(){o()&&(!function(t){for(var e,r=0;r<n.live.length;r++)(e=i.find(!1,n.live[r]))&&(e.sleep(),t&&a.push(e),e.parent.nodes.findDelete("id",e.id,1))}(n.live.length&&!a.length),this.nodes.length&&(this.clear(),n.mode||this.el.empty()),OGX.OML.render(this,this.points[this.point].oml,n.data,n.route_data,a),this.el.trigger(OGX.Point.CHANGE,{min:this.points[this.point].min,max:this.points[this.point].max}))},this.oml=function(){return this.point||o(),this.points[this.point].oml},e=!0,n.el||(n.el=n.parent.el,e=!1),i.el=$(n.el),i.el.addClass("ogx_point"),e&&i.el.addClass("ogx_point_uxi"),function(){var t,e=i.id;for(var a in n.mode&&(e=n.parent.id),n)if(/^\d+\-\d+$/gi.test(a)){t=a.split("-");var r=JSON.parse(JSON.stringify(n[a]));for(var o in r)0===o.indexOf("default:")&&(r['.ogx_point[data-ogx-id="'+e+'"]:'+o.split(":")[1]]=r[o],delete r[o]);i.points.push({min:parseInt(t[0],10),max:parseInt(t[1],10),oml:r})}}(),o()},OGX.Point.NAME="Point",OGX.Point.CHANGE="PointChange",require("Popup","Uxi","Placeholder","Touch","Resize"),OGX.Popup=function(t){construct(this,"Popup");var e,i,n=this,a={el:!1,width:"80%",height:"80%",html:!1,template:!1,title:!1,icon:!1,icons:!1,view:!1,drag:!1,resize:!1,maximize:!0,center:!0,x:null,y:null,show:!1,group:!1,data:{},buttons:[],buttons_enabled:!0,anim:OGX.Popup.FADE,anim_param:{scale:.7},responsive:!0,overlay:!1,zindex:!1,chromeos:!1,parent:null},r={label:"",callback:null,params:null,enabled:!0},o=t,s=null,l=null,c=null,d="ogx_popup",u=[],h=[],f={w:0,h:0},g=!1,_=!1,p=null,m=!1,v=null;function O(){_=!0,b(!0)}function b(t){void 0===t&&(t=!1),o.anim&&n.el.removeClass(d+"_"+o.anim);var e=D();u[0]="translate3d("+e.x+"px, "+e.y+"px, 0px)";var i={transform:u.join(" ")};t?(o.width=n.el.width(),o.height=n.el.height()):!t&&o.responsive&&(w(o.width)?i.width=OGX.Data.getBestSize(c.width(),n.el.width()):i.width=o.width,w(o.height)?i.height=OGX.Data.getBestSize(c.height(),n.el.height()):i.height=o.height),n.el.css(i),n.resizeNodes()}function w(t){return"string"==typeof t&&-1!==t.indexOf("|")}function G(){n.blurNodes(),n.front()}function X(){n.focusNodes(),o.anim&&n.el.addClass(d+"_"+o.anim)}function E(){s.addClass(d+"_drag"),n.front()}function T(){if(s.removeClass(d+"_drag"),g){for(var t=0;t<h.length;t++)h[t].removeGroupOverlay();return h=[],void app.groupPopups(n,g,{drag:o.drag,resize:o.resize,anim:o.anim})}"function"==typeof o.drag&&o.drag(n,!1)}function C(t){if(e=n.el.position(),n.x=e.left,n.y=e.top,n.parent&&(h=n.parent.nodes.get({_NAME_:{eq:"Popup"},group:{eq:n.group},blured:{eq:!1}},{z:-1})).length){g=!1;for(var a=0;a<h.length;a++)n.id!==h[a].id&&h[a].group===n.group&&(i={left:h[a].x,top:h[a].y},f.w=h[a].el.width(),f.h=h[a].el.height(),e.left>i.left&&e.left<i.left+f.w&&e.top>i.top&&e.top<i.top+f.h&&(g||(g=h[a],h[a].addGroupOverlay())),g||h[a].removeGroupOverlay())}g||"function"==typeof o.drag&&o.drag(n,t)}function D(){var t=c.width(),e=c.height();t>screen.width&&(t=screen.width),e>screen.height&&(e=screen.height);var i=o.width,n=o.height;if(_||(i=OGX.Data.getBestSize(t,i),n=OGX.Data.getBestSize(e,n)),o.center)"string"==typeof i&&(i=-1!==i.indexOf("%")?Math.round(t*Number(i.substr(0,i.length-1))/100):Number(i)),"string"==typeof n&&(n=-1!==n.indexOf("%")?Math.round(e*Number(n.substr(0,n.length-1))/100):Number(n)),x=Math.round(t/2-i/2),y=Math.round(e/2-n/2),o.drag&&(o.center=!1);else{var a=s.position();x=a.left,y=a.top,x>t&&(x=t-x),x<-i&&(x=0),y>e&&(y=e-n),y<0&&(y=0)}return{x:x,y:y,w:i,h:n}}function S(t,e,i,a,r,l){var c=!1,h=null;if(void 0===l&&(l=!1),void 0!==e&&!0!==e||(e=o.anim),e&&(c=e),!e&&p&&(c=p),e?n.el.removeClass(d+"_notrans"):n.el.addClass(d+"_notrans"),t?(n.front(),l||n.el.trigger(OGX.Popup.SHOW,n)):l||n.el.trigger(OGX.Popup.HIDE,n),c){var f={};switch(h=d+"_"+c,c){case OGX.Popup.SCALE:u[1]=t?"scale(1,1)":"scale("+o.anim_param.scale+", "+o.anim_param.scale+")",f.transform=u.join(" ");break;case OGX.Popup.FADE:f.opacity=t?1:0}t&&(s.css("display","flex"),f.visibility="visible",f.display="flex"),e||t||(f.visibility="hidden",f.display="none"),setTimeout((function(){s.css(f)}),50),e?(p=c,s.on("transitionend",(function(){s.off("transitionend"),t?n.resizeNodes():s.css({display:"none",visibility:"hidden"}),h&&s.removeClass(h),M(i,a,r)})),h&&s.addClass(h)):(s.removeClass(h),M(i,a,r))}else t?s.css({opacity:t,display:"flex",visibility:"visible"}):s.css({display:"none",visibility:"hidden"}),M(i,a,r)}function M(t,e,i){void 0!==t&&t&&t(e),void 0!==i&&i&&i(n.id)}function L(t){t?s.on(n.touch.down,"."+d+"_button",N):s.off(n.touch.down,"."+d+"_button",N)}function N(t){t.preventDefault(),t.stopImmediatePropagation();var e=$(this);if(!e.hasClass(d+"_button_disabled")){var i=e.index();s.trigger(OGX.Popup.CLICK_BUTTON,{index:i,value:o.buttons[i].label}),o.buttons[i].hasOwnProperty("callback")&&o.buttons[i].callback&&(o.buttons[i].hasOwnProperty("params")?o.buttons[i].callback.apply(null,[o.buttons[i].params]):o.buttons[i].callback())}}function A(){for(var t,e="",i=0;i<o.buttons.length;i++)o.buttons.length>0&&(t=o.buttons[i].enabled?"":d+"_button_disabled",e+='<span class="'+d+"_button "+t+'">'+o.buttons[i].label+"</span>");return e}function k(t,e){void 0===e&&(e=!0),o.buttons=new OGX.List(t);for(var i=0;i<t.length;i++)o.buttons[i]=OGX.Data.merge(o.buttons[i],r);if(e){var n=A();l.html(n)}}function I(t){t?n.el.on(n.touch.down,"."+d+"_icons_icon",(function(t){t.preventDefault(),t.stopImmediatePropagation();var e,i=$(this).index(),n=o.icons[i];"object"==typeof n&&n.hasOwnProperty("callback")&&(n.hasOwnProperty("params")&&(e=n.params),n.callback.call(null,e))})):n.el.off(n.touch.down,"."+d+"_icons_icon")}function Y(){for(var t,e="",i=0;i<o.icons.length;i++)t="string"==typeof o.icons[i]?o.icons[i]:o.icons[i].icon,e+='<div class="'+d+'_icons_icon" style="background-image:url(\''+t+"')\"></div>";return e}this.anim=null,this.el=null,this._NAME_=OGX.Popup.NAME,this.group=o.group,this.x=0,this.y=0,this.z=0,this.construct=function(){},this.enable=function(){return this.touch.enable(),this.enableResize(),o.icons&&o.icons.length&&I(!0),o.buttons&&o.buttons.length&&o.buttons_enabled&&L(!0),this},this.disable=function(){return this.touch.disable(),this.disableResize(),o.icons&&o.icons.length&&I(!1),o.buttons&&o.buttons.length&&o.buttons_enabled&&L(!1),this},this.show=function(t,e,i){return S(1,t,e,i),this.focus(1),this},this.hide=function(t,e,i,n,a){return S(0,t,e,i,n,a),this.blur(1),this},this.resize=function(){return b(),this},this.maximize=function(){return o.maximize&&!m&&(m=!0,v={width:o.width,height:o.height,x:this.x,y:this.y},o.width=o.height="100%",b(!1),this.x=this.y=0,this.move(this.x,this.y)),this},this.normalize=function(){return o.maximize&&m&&(m=!1,o.width=v.width,o.height=v.height,b(!1),this.x=v.x,this.y=v.y,v=null,this.move(this.x,this.y)),this},this.destroy=function(){s.off("transitionend")},this.buttons=function(t){if(void 0===t)return o.buttons;k(t)},this.enableButton=function(t){return o.buttons[t].enabled=!0,l.children("."+d+"_button:eq("+t+")").removeClass(d+"_button_disabled"),o.buttons_enabled||(o.buttons_enabled=!0),this},this.disableButton=function(t){return o.buttons[t].enabled=!1,l.children("."+d+"_button:eq("+t+")").addClass(d+"_button_disabled"),this},this.enableButtons=function(){if(o.buttons.length)for(var t=0;t<o.buttons.length;t++)this.enableButton(t);return o.buttons_enabled=!0,this},this.disableButtons=function(){if(o.buttons.length)for(var t=0;t<o.buttons.length;t++)this.disableButton(t);return o.buttons_enabled=!1,this},this.center=function(){var t=D();return u[0]="translate3d("+t.x+"px, "+t.y+"px, 0px)",this.x=t.x,this.y=t.y,n.el.css({transform:u.join(" ")}),this},this.move=function(t,e){return null===t&&(t=n.el.position().left),null===e&&(e=n.el.position().top),u[0]="translate3d("+t+"px, "+e+"px, 0px)",this.x=t,this.y=e,n.el.css({transform:u.join(" ")}),this},this.front=function(){return this.z=o.parent.topIndex(),this.el.css("z-index",this.z),this},this.icon=function(t){if(void 0===t)return o.icon;o.icon=t,this.el.children("."+d+"_head").children("."+d+"_icon").first().css("background-image","url("+t+")")},this.title=function(t){if(void 0===t)return o.title;o.title=t,this.el.find("."+d+"_title").first().html(t)},this.icons=function(t){if(void 0===t)return o.icons;o.icons&&o.icons.length&&I(!1),o.icons=t,this.el.find("."+d+"_icons").first().html(Y()),I(!0)},function(){if(OGX.Data.merge(o,app.getDefaults("popups"),!1),OGX.Data.merge(o,a,!1),k(o.buttons,!1),(s=$(o.el)).addClass(d),c=s.parent(),n.anim=o.anim,n.centered=o.center,function(){o.index?n.z=o.index:n.z=o.parent.topIndex();var t=D();null!==o.x&&null!==o.y?(n.x=t.x=o.x,n.y=t.y=o.y):(n.x=t.x,n.y=t.y);var e=t.w,i=t.h;-1===String(e).indexOf("%")&&(e+="px"),-1===String(i).indexOf("%")&&(i+="px");var a="";(o.icon||o.title||o.icons||o.drag)&&(a+='<div class="'+d+'_head">',o.icon&&(a+='<div class="'+d+'_icon" style="background-image:url(\''+o.icon+"')\"></div>"),o.title&&(a+='<div class="'+d+'_title">'+o.title+"</div>"),a+='<div class="'+d+'_icons">',o.icons&&(a+=Y()),a+="</div></div>");var r,c=1;if(u=["translate3d("+t.x+"px, "+t.y+"px, 0)"],o.anim)switch(o.anim){case OGX.Popup.FADE:c=0,r=d+"_fade";break;case OGX.Popup.SCALE:r=d+"_scale",u[1]="scale("+o.anim_param.scale+", "+o.anim_param.scale+")"}a+='<div class="'+d+'_body ogx_view">',o.html?a+=o.html:o.template&&(a+=OGX.Templater.make(OGX.Templater.get(o.template),o.data)),a+="</div>",o.buttons&&o.buttons.length&&(a+='<div class="'+d+'_buttons">',a+=A(),a+="</div>"),s.html(a),s.css({width:e,height:i,opacity:c,transform:u.join(" "),"z-index":n.z}),o.anim&&s.addClass(r),n.el=s,l=s.children("."+d+"_buttons").first()}(),o.drag){var t={x:!0,y:!0,cb_down:E,cb_up:T,target:"."+d+"_head"};o.group?t.cb_drag=C:"function"==typeof o.drag&&(t.cb_drag=function(t){o.drag(n,t)}),n.touch.drag.set(t)}if(o.resize&&n.setResize({top:!1,cb_resize:O,cb_down:G,cb_up:X}),o.hasOwnProperty("html")&&o.html)o["node:OML"]=[{"default:Html":{html:o.html}}];else if(o.hasOwnProperty("view")&&o.view){var e={};e["default:Views."+o.view.id]=o,o["node:OML"].push(e)}n.placeholders(o,["."+d+'[data-ogx-id="'+o.id+'"] > .'+d+"_body"]),o.overlay&&n.addOverlay(),n.observe(!0,undefined,(function(){n.resizeNodes(),n.observe(!1),o.show&&n.show()}))}()},OGX.Popup.NAME="Popup",OGX.Popup.FADE="fade",OGX.Popup.SCALE="scale",OGX.Popup.HIDE="PopupHide",OGX.Popup.SHOW="PopupShow",OGX.Popup.CLOSE="PopupClose",OGX.Popup.DRAG="PopupDrag",OGX.Popup.GROUP="PopupGroup",OGX.Popup.UNGROUP="PopupUngroup",OGX.Popup.CLICK_BUTTON="PopupClickButton",OGX.Popup.FLOAT=!0,OGX.Resize=function(t){"use strict";var e,i,n,a,r,o,s,l,c=this,d=t,u={enabled:!0,top:!0,left:!0,right:!0,bottom:!0,min_width:100,min_height:100,max_width:0,max_height:0,border:10,cb_up:!1,cb_down:!1,cb_resize:!1},h=!1,f="mousedown",g="mouseup",_="mousemove",p=(d=!1,!1),m=!1,v={w:0,h:0};function y(t){d&&(t?c.el.on(f,x):c.el.off(f,x))}function x(t){var u=E(t);n=u.pageX,a=u.pageY;var h=c.el.position();e=h.left,i=h.top;var f=c.el.offset(),g=n-f.left,_=a-f.top;v.w=c.el.width(),v.h=c.el.height(),r=0,o=0,s=0,l=0,d.top&&_<d.border&&(l=-1),d.bottom&&_>c.el.height()-d.border&&(l=1),d.left&&g<d.border&&(s=-1),d.right&&g>c.el.width()-d.border&&(s=1),p=-1!==window.getComputedStyle(c.el[0],"width"),m=-1!==window.getComputedStyle(c.el[0],"height"),(s||l)&&(t.preventDefault(),c.hasOwnProperty("dragable")&&c.dragable&&c.touch.drag.disable(),O(!0),w(!0),d.cb_down&&d.cb_down())}function O(t){t?h||(h=setInterval(b,5)):h&&(clearInterval(h),h=!1)}function b(){if(-1===s||-1===l){var t=e,n=i;r&&s&&(t+=r),o&&l&&(n+=o),r&&-1===s&&o&&1===l&&(n=i),c.el.css("transform","translate3d("+t+"px, "+n+"px, 0)")}s&&v.w+r*s>d.min_width&&(p?c.el.width(Math.round(100*(v.w+r*s)/c.el.parent().width()*100)/100+"%"):c.el.width(v.w+r*s)),l&&v.h+o*l>d.min_height&&(m?c.el.height(Math.round(100*(v.h+o*l)/c.el.parent().height()*100)/100+"%"):c.el.height(v.h+o*l)),(r||o)&&(d.cb_resize?d.cb_resize():c.el.trigger(OGX.Resize.RESIZING))}function w(t){t?($("body").on(_,G),$("body").on(g,X)):($("body").off(_,G),$("body").off(g,X))}function G(t){t.preventDefault(),t.stopImmediatePropagation(),t=E(t),r=t.pageX-n,o=t.pageY-a}function X(t){O(!1),w(!1),t=E(t),r=t.pageX-n,o=t.pageY-a,d.cb_up&&d.cb_up(),c.hasOwnProperty("dragable")&&c.dragable&&(y(!1),c.touch.drag.enable(),setTimeout((function(){y(!0)}),0))}function E(t){return t.hasOwnProperty("originalEvent")&&void 0!==t.originalEvent.changedTouches?t.originalEvent.changedTouches[0]:t}this.resizable=!0,this.setResize=function(t){OGX.Data.merge(t,u,!1),d=t},this.enableResize=function(){return y(!0),this},this.disableResize=function(){return y(!1),this},OGX.Data.merge(d,u,!1),void 0===window.ontouchstart||d.chromeos||(f="touchstart",_="touchmove",g="touchend")},OGX.Resize.RESIZING="resizeResizing",require("Roulette","Uxi","Bind","Touch"),OGX.Roulette=function(t){construct(this,"Roulette");var e,i,n,a,r,o,s,l=this,c=t,d={force_coef:10,time_coef:.1,min_force_pitch:2,value:null,name:!1,required:!1,display:!1,key:"value",mode:OGX.Roulette.MODE_REWIND,icon:!1,list:new OGX.List,capture:!1},u={template:!1,html:'<span class="ogx_roulette_block_label">{{$label}}</span>',css:!1},h="object",f=0,g=0,_="ogx_roulette";function p(t,e){void 0===e&&(e=!0),l.el.children('input[name="'+c.name+'"]').val(t),e&&l.el.children('input[name="'+c.name+'"]').trigger("change")}function m(t){t?e.on(l.touch.down,"."+_+"_icon",(function(t){t.preventDefault(),t.stopImmediatePropagation(),l.next(!0)})):e.off(l.touch.down,"."+_+"_icon")}function v(t){t?e.on("change","input[type=hidden]",y):e.off("change","input[type=hidden]",y)}function y(t){t.preventDefault(),t.stopImmediatePropagation(),l.loopval(0,OGX.Data.stringToVal(t.target.value),!1)}function x(t){return g+t>c.list.length-1?c.list[0]:g+t<0?c.list[c.list.length-1]:c.list[g+t]}function O(t){a=t.y,G(!0)}function b(t){var e;t.dirY!==r?(e=0,a=t.pt1.y):(e=t.pt1.y-a,a=t.pt1.y),r=t.dirY,i.css({transition:"none",transform:"translate3D(0px, "+(C(i)+e)+"px, 0px)"})}function w(t){G(!1),trans=C(i);var e=Math.round(trans/n)*n,a=Math.round(e/n%c.list.length);if(a=a<=0?Math.abs(a):c.list.length-a,g!==a){switch(g=a,h){case"string":c.value=c.list[g];break;case"object":c.value=c.list[g][c.key]}c.name&&l.el.children('input[name="'+c.name+'"]').val(c.value).trigger("input"),l.el.trigger(OGX.Roulette.CHANGE,c.value)}i.css({transition:"all 0.2s ease-out",transform:"translate3D(0px, "+e+"px, 0px)"})}function G(t){t?o=setInterval(X,10):clearInterval(o)}function X(){var t,e,a;(t=Math.floor((i.position().top+n*r)/(n*c.list.length)*-1))!==f&&(0===i.children("."+_+'_stripe[data-id="'+t+'"]').length&&((e=s.clone()).css("top",t*(n*c.list.length)+"px"),e.attr("data-id",t),i.append(e)),i.children("."+_+"_stripe").each((function(t,e){a=i.position().top+$(e).position().top,(Math.ceil(a+n*c.list.length)<-n||a>n)&&$(e).remove()})),f=t)}function E(){G(!1),i.off("transitionend",E)}function T(){var t="",a="";c.icon&&(a+='<div class="'+_+'_container">'),a+='<div class="'+_+'_stripes">';for(var r=0;r<2;r++){a+='<div class="'+_+'_stripe" style="top:'+r*(c.list.length*n)+'px;" data-id="'+r+'">';for(var o=0;o<c.list.length;o++){switch(h){case"string":t=OGX.Templater.make(c.display.html(),{label:c.list[o]});break;case"object":t=c.display.html(c.list[o])}a+='<div class="'+_+"_block "+c.display.css(c.list[o])+'" style="height:'+n+"px; line-height:"+n+'px;" data-ogx-id="'+o+'">'+t+"</div>"}a+="</div>"}if(a+="</div>",c.icon&&(a+='</div><div class="'+_+'_icon"></div>'),void 0===g&&(g=0),c.name){var l="";switch(c.required&&(l=" required"),h){case"string":a+='<input type="hidden" name="'+c.name+'" value="'+c.list[g]+'" '+l+">";break;case"object":a+='<input type="hidden" name="'+c.name+'" value="'+c.list[g][c.key]+'" '+l+">"}}e.html(a),i=e.children("."+_+"_stripes").first(),c.icon&&(i=e.children("."+_+"_container").children("."+_+"_stripes").first()),s=(s=i.children("."+_+"_stripe:last")).detach();var d=g*n*-1;i.css({transition:"none",transform:"translate3D(0px, "+d+"px, 0px)"})}function C(t){var e=0;return"none"!==t.css("transform")&&(e=Number(t.css("transform").split(",")[5].split(")")[0])),e}function D(t){switch(h){case"string":return{index:c.list.indexOf(t)};case"object":return c.list.findIndex(c.key,t)}}function S(){c.list.length>0&&!c.list.hasOwnProperty("insert")&&(c.list=new OGX.List(c.list)),"string"==typeof c.list[0]&&(h="string"),1===c.list.length&&(c.list[1]=c.list[0])}this._NAME_=OGX.Roulette.NAME,this.el=null,this.enable=function(){return e.removeClass(_+"_disabled"),this.touch.swipe.enable(),c.icon&&m(!0),c.name&&v(!0),this},this.disable=function(){return e.addClass(_+"_disabled"),this.touch.swipe.disable(),c.icon&&m(!1),c.name&&v(!1),G(!1),this},this.bindFilter=function(t,e,i){return c.list.removeFilter(t),c.list.addFilter(t,e,i),c.list.filter(),setTimeout(T,0),this},this.bindRender=function(t,e){},this.val=function(t,e){if(void 0!==t){var a=D(t).index;return a>-1&&(!function(t,e){void 0===e&&(e=!0);i.off("transitionend",E),G(!1),r=-1;var a=C(i),o=Math.round(a/n)*n,s=a-o,l=Math.round(o/n%c.list.length);l=l<=0?Math.abs(l):c.list.length-l;var d=l-t;c.mode===OGX.Roulette.MODE_CLOSEST&&d>c.list.length/2&&(d=-1*(c.list.length-l+t));var u=a+d*n-s,h=20*Math.round(Math.abs(d*n)*c.time_coef);G(!0),i.on("transitionend",E),i.css({transition:"all "+h+"ms ease-out",transform:"translate3D(0px, "+u+"px, 0px)"}),g=t}(a),c.name&&p(t,!1)),this}switch(h){case"string":return c.list[g];case"object":return c.list[g][c.key]}},this.item=function(){return c.list[g]},this.loopval=function(t,e,a){var r=g,o=D(e).index;o>-1&&(g=o);var s=r-o,l=c.time_coef*Math.abs(s+t*c.list.length);return G(!0),i.css({transition:"all "+l+"s ease-out",transform:"translate3D(0px, "+(C(i)+(s*n-c.list.length*n*t))+"px, 0px)"}),i.on("transitionend",E),c.name&&p(e,a),void 0!==a&&a&&this.el.trigger(OGX.Roulette.CHANGE,val),this},this.next=function(t){var e,i=x(1);switch(r=1,h){case"string":e=i;break;case"object":e=i[c.key]}return this.val(e),void 0!==t&&t&&(this.el.trigger(OGX.Roulette.CHANGE,e),c.name&&this.el.children('input[name="'+c.name+'"]').trigger("input")),this},this.prev=function(t){var e,i=x(-1);switch(h){case"string":e=i;break;case"object":e=i[c.key]}return this.val(e),void 0!==t&&t&&(this.el.trigger(OGX.Roulette.CHANGE,e),c.name&&this.el.children('input[name="'+c.name+'"]').trigger("change")),this},this.setData=function(t,e){return c.value=e,c.list=t,S(),g=void 0===e?0:D(e).index,setTimeout(T,0),this},function(){if(OGX.Data.merge(c,d),S(),c.display?c.display=new OGX.Display(c.display):c.display=new OGX.Display(u),(e=l.el=$(c.el)).addClass(_),e.width(),n=e.height(),c.list.length){var t=e.parent();t[0].hasAttribute("data-value")&&(c.value=OGX.Data.stringToVal(t.data("value")),t.removeAttr("data-value")),null===c.value&&(c.value=c.list[0],"object"==typeof c.value&&(c.value=c.value.value)),g=D(c.value).index}}(),c.list.length&&T(),l.touch.swipe.set({x:!1,y:!0,cb_down:O,cb_swipe:b,cb_up:w,target:'ogx_roulette[data-ogx-id="'+l.id+'"] > .ogx_roulette_container',capture:c.capture})},OGX.Roulette.NAME="Roulette",OGX.Roulette.CHANGE="RouletteChange",OGX.Roulette.MODE_REWIND="RouletteModeRewind",OGX.Roulette.MODE_CLOSEST="RouetteModeClosest",OGX.Roulette.BIND=OGX.Roulette.CHANGE,require("RouletteTree","Uxi"),OGX.RouletteTree=function(t){construct(this,"RouletteTree");var e,n,a=this,r=t,o={groups:!1,data:!1,value:!1,required:!1},s=!1;function l(t){t?e.on(OGX.Roulette.CHANGE,d):e.off(OGX.Roulette.CHANGE,d)}function c(){for(var t,e=0;e<s.length;e++)e>0&&(t=s[e-1].roulette.val()),0===e||e-1>=0&&null!==t&&String(t).length>0?s[e].roulette.focus():e>0&&_(s[e].roulette)}function d(t,a){t.stopImmediatePropagation();var r,o=$(t.target).data("ogx-id"),l=s.findIndex("id",String(o)),c=s[l.index].roulette.item().hasOwnProperty("head");if(n=l.index,l.index+1<s.length)for(i=l.index+1;i<s.length;i++)c?(s[i].roulette.val(""),s[i].roulette.blur()):(r=u(i-1,s[i-1].roulette.val()),s[i].roulette.setData(r,r[0].value),i===l.index+1?s[i].roulette.focus():s[i].roulette.blur());var d=h(n);e.trigger(OGX.RouletteTree.CHANGE,d),c&&!n&&(n=-1)}function u(t,e){for(var i=[],n=0;n<t+1;n++)i.push(s[n].roulette.val());return g(i)}function h(t){if(void 0===t&&(t=s.length),t<0)return!1;for(var e={},i=0;i<t+1;i++)e[r.groups[i]]=s[i].roulette.val();return e}function f(t){for(var e,i=[],a=0;a<r.groups.length;a++)t.hasOwnProperty(r.groups[a])&&(e=t[r.groups[a]],String(e).length&&(!isNaN(e)&&(e=String(e)),s[a].roulette.val(e),n=a,a>0&&s[a].roulette.setData(g(i),e),i.push(e)));setTimeout(c,0)}function g(t){for(var e=r.data,i=0;i<t.length;i++)t[i].length&&(e=e[t[i]]);var n=[{label:r.groups[t.length],value:""}];for(var a in e)n.push({label:a,value:a});return n}function _(t){setTimeout((function(){t.blur()}),0)}this._NAME_=OGX.RouletteTree.NAME,this.el=null,this.enable=function(){return s&&(c(),l(!0)),this},this.disable=function(){return s&&l(!1),this},this.val=function(t){if(void 0===t)return n>-1?h(n):{};f(t)},r=OGX.Data.merge(r,o),a.el=e=$(r.el),e.addClass("ogx_roulette_tree"),function(){s=new OGX.List;var t,i,n=0;!function o(l,c){var d;if(!Array.isArray(l)&&"object"==typeof l){if(c>n){for(var u in n=c,e.append('<div class="ogx_roulette_tree_roulette" data-ogx-roulette="'+c+'"></div>'),i=r.groups[c-1],t=[{label:i,value:"",head:!0}],l)t.push({label:u,value:u});d=a.create(OGX.Roulette.NAME,{el:'.ogx_roulette_tree[data-ogx-id="'+a.id+'"] .ogx_roulette_tree_roulette[data-ogx-roulette="'+c+'"]',list:t,icon:r.icon,value:null,name:i,required:r.required}),n>1&&_(d),s.push({roulette:d,group:i,id:d.id})}if(c<r.groups.length)for(var u in l)o(l[u],c+1)}}(r.data,1)}(),n=-1,r.value&&setTimeout((function(){f(r.value)}),0),a.enable()},OGX.RouletteTree.NAME="RouletteTree",OGX.RouletteTree.CHANGE="RouletteTreeChange",OGX.RouletteTree.BIND=OGX.RouletteTree.CHANGE,OGX.Router=function(__routing){"use strict";var that=this,routing=__routing,page=window.location.pathname.split("/").slice(-1)[0],locked=!1,pattern=!1,url=null,request=null,options_default={history:!0,reload:!1};function findRoute(t){var e,i,n,a,r,o=[],s=OGX.Data.clone(routing.routes);for(var l in s){for(-1!==(r=l).indexOf(":OML")&&(r=r.replace(":OML","")),n=r;i=/(?!\/)([a-z0-9_\-]+)\:([^\/]+)/gi.exec(n);)n=n.replace(i[0],i[2]),o.push(i[1]);if((e=t.match("^"+n+"$"))&&e.length){e.shift(),-1!==l.indexOf(":OML")&&(s[r]=OGX.Data.clone(OGX.Cache.read("oml",s[l])),delete s[l],l=r);var c=s[l];a={};for(var d=0;d<e.length;d++)a[o[d]]=e[d];return{stage:t.split("/").shift(),route:c,data:a,pattern:l}}}return!1}function clearStage(t){var e=t.selector+" "+t.pholder,i=$(e),n=app.cfind(null,String(i.find(".ogx_uxi").first().data("ogx-id")));n&&(n._NAME_===OGX.Scroller.NAME&&(n=n.parent),n.kill(),i.empty())}function onBackButton(t){t.preventDefault(),t.stopImmediatePropagation(),locked||navigator.app.backHistory()}function onPopState(t){if(locked)return t.preventDefault(),t.stopImmediatePropagation(),!1;null!==t.originalEvent.state?app.goto(t.originalEvent.state.url,{history:!1}):-1!==window.location.href.indexOf("#")&&app.goto(window.location.href.split("#").pop(),{history:!1})}function captureLink(t){var e=t.originalEvent,i=$(this).attr("href");if(0===i.indexOf("/")){if(t.preventDefault(),t.stopImmediatePropagation(),i=i.slice(1),e.ctrlKey||e.shiftKey||e.metaKey||e.button&&1==e.button)return routing.options.jail?void setTimeout((function(){that.goto(i)}),0):(i=window.location.protocol+"//"+window.location.host+"/app#"+i,window.open(i,"_blank").focus());setTimeout((function(){that.goto(i)}),0)}}function init(){request={route:null,url:""};var t=null;if(-1!==window.location.href.indexOf("#")){t=window.location.href.split("#").pop(),request.url=t;var e=findRoute(t);e&&(request.route=e)}$(document).on("click touchstart mousedown","a",captureLink)}this.start=function(){$(document).on("backbutton",onBackButton),$(window).on("popstate",onPopState)},this.stop=function(){$(document).off("backbutton",onBackButton),$(window).off("popstate",onPopState)},this.lock=function(){locked=!0},this.unlock=function(){locked=!1},this.isLocked=function(){return locked},this.addToHist=function(t){var e={url:t};history.pushState(e,"title"+(new Date).getTime(),page+"#"+t)},this.request=function(){return request},this.goto=function(__url,__options){if(!locked){void 0!==__options&&__options||(__options={}),OGX.Data.merge(__options,options_default);var r=findRoute(__url);if(r){r.route.hasOwnProperty("scope")||(r.route.scope="public");var access=!0;if(OGX.Scope.eval(r.route.scope)||(access=!1),routing.options.hasOwnProperty("eval")&&routing.options.eval){var fnc=eval(routing.options.eval);if(fnc){var res=fnc(r);res||(access=!1)}}if(!access)return routing.errors[403]?setTimeout((function(){app.goto(routing.errors[403],{history:!1})}),0):$(document).trigger(OGX.Router.FORBIDDEN,{url:__url,scope:r.route.scope}),!1;delete r.route.scope;var target_stage=OGX.Object.get({_NAME_:{eq:OGX.Stage.NAME},id:{eq:r.stage}},null,1);if(r.route.hasOwnProperty("origin:Route")){for(var valid=!1,origins=r.route["origin:Route"].split(","),reg,i=0;i<origins.length;i++)if("self"===origins[i]){if(reg=r.pattern.replace(/([a-z]+:)/,""),RegExp(reg).test(target_stage.url)){valid=!0;break}}else if(0===target_stage.url.indexOf(origins[i])){valid=!0;break}if(!valid)return void app.goto(r.route["origin:Route"]);delete r.route["origin:Route"]}url=r.url=__url,pattern=r.pattern;var stage=app.getStage(),render=!0,same=!0,selector,uxi;if(r.stage!==stage.id&&(stage=app.cfind(OGX.Stage.NAME,r.stage),same=!1),stage.url===r.url)if(__options.reload)for(var a in r.route)selector=a.split(":")[0],uxi=stage.nodes.get({selector:{eq:selector}},null,1),uxi&&app.find(uxi._NAME_,uxi.id,"remove");else render=!1;else same&&clearStage(stage);return same||(app.showStage(r.stage),stage=app.getStage()),stage.pattern=pattern,stage.url=r.url,render&&__options.history&&this.addToHist(__url),render&&OGX.OML.render(stage,r.route,__options.data,r.data),!0}return routing.errors[404]?setTimeout((function(){app.goto(routing.errors[404],{history:!1})}),0):$(document).trigger(OGX.Router.NOT_FOUND,{url:__url}),!1}return!1},init()},OGX.Router.BACK="RouterBack",OGX.Router.EXIT="ReouterExit",OGX.Router.FORBIDDEN="403",OGX.Router.NOT_FOUND="404",OGX.Scope=function(t){"use strict";var e=["public"],i=!1,n=t;this.CHANGE="ScopeChange",this.scope=function(t){return void 0===t?e:n?($(document).trigger(OGX.Scope.CHANGE),!1):(e=t,!0)},this.token=function(t,n){if(void 0===t)return!!i;var a=function(t){var e=JSON.parse(atob(t.split(".")[1]));if(e)return e;return!1}(t);return!(!a||a.iss!==n)&&(i=t,e=a.scope.split(" "),$(document).trigger(OGX.Scope.CHANGE),!0)},this.eval=function(t,i){void 0===i&&(i=e),t=function(t){if(-1===t.indexOf("/^"))return t;for(var i,n=t.split(" "),a=e.join(" "),r=0;r<n.length;r++)0===n[r].indexOf("/^")&&(i=(i=n[r].slice(2)).slice(0,-2),i=new RegExp(i,"g"),t=a.match(i)?t.replace(n[r],"1"):t.replace(n[r],"0"));return t}(t);var n=i;"string"==typeof n&&(n=n.split(" "));var a=t.match(/(?!0|1)([a-z0-9_]+)/gi);if(a&&a.length)for(var r=0;r<a.length;r++)t=n.includes(a[r])?t.replace(a[r],"1"):t.replace(a[r],"0");t=t.replace(/ /g,"|");try{var o=new Function("return "+t+";")();return"number"==typeof o&&o>0}catch(t){}return!1},this.fork=function(t){for(var e in t)if(this.eval(e))return t[e];return!1}},require("Scroller","Uxi","Touch"),OGX.Scroller=function(t){construct(this,"Scroller");var e,i,n,a,r,o,s,l,c,d,u,h=this,f=t,g={check_delay:30,fade_delay:300,css:!1,zindex:9999,observe:!0,auto_scroll:!1,scroll_callback:!1,trigger:!0},_=0,p="init",m=!1,v=!1,y=null;function x(t){t?i.on(h.touch.down,O):i.off(h.touch.down,O)}function O(t){t=h.event(t),S(!1),G(!0),b(!0),x(!1),M("in"),C(!0)}function b(t){t?(d=setInterval(T,10),i.on(h.touch.move,w)):(clearInterval(d),i.off(h.touch.move,w))}function w(t){t=h.event(t)}function G(t){t?$(document).on(h.touch.up,X):$(document).off(h.touch.up,X)}function X(){b(!1),G(!1),x(!0),C(!1),M("out")}function E(t){t?(window.addEventListener("resize",A),i.on("scroll",(function(t){t.stopImmediatePropagation(),T()})),i.on("wheel",(function(t){C(!0)})),void 0!==OGX.NestedList&&$(document).on(OGX.NestedList.OPENED+" "+OGX.NestedList.CLOSED,(function(){h.update()}))):(window.removeEventListener("resize",A),i.off("scroll"),i.off("wheel"),void 0!==OGX.NestedList&&$(document).off(OGX.NestedList.OPENED+" "+OGX.NestedList.CLOSED))}function T(){var t,a=(t=i.scrollTop())/s,o=Math.round(r.position().top);r.css("top",a+"px"),f.trigger&&!m&&(h.el.trigger(OGX.Scroller.SCROLL,{top:t,percent:100*t/n}),-1*t==i.outerHeight(!0)-e.outerHeight(!0)?o!==Math.round(a)&&h.el.trigger(OGX.Scroller.BOTTOM):0===t&&(o&&o!==Math.round(a)||!o)&&h.el.trigger(OGX.Scroller.TOP)),f.scroll_callback&&f.scroll_callback()}function C(t){t?(c&&C(!1),l=e.position().top,c=setInterval(D,f.check_delay-10)):(c&&(clearInterval(c),c=null),v=!1,h.el.trigger(OGX.Scroller.END))}function D(){var t=e.position().top;t!==l?(v||(v=!0,h.el.trigger(OGX.Scroller.START)),M("in")):M("out"),l=t}function S(t){t?u=setInterval(T,f.check_delay):clearInterval(u)}function M(t){r.hasClass("ogx_scroller_track_anim")||r.addClass("ogx_scroller_track_anim"),"in"===t?(clearTimeout(y),y=null,r.addClass("ogx_scroller_track_anim_fade_in").removeClass("ogx_scroller_track_anim_fade_out")):y||(y=setTimeout((function(){r.addClass("ogx_scroller_track_anim_fade_out").removeClass("ogx_scroller_track_anim_fade_in")}),f.fade_delay))}function L(t){t?h.observe(!0,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","src","width","height"]},N):h.observe(!1)}function N(){_!==e.height()&&(_=e.height(),A(),f.auto_scroll&&h.bottom())}function A(){if(a=i.innerHeight(),n=e.height(),s=n/a,n>a){var t=Math.round(a/s);r.css("height",t+"px"),o.css("display","block")}else o.css("display","none");"init"===p&&(p=OGX.Scroller.READY,h.el.trigger(OGX.Scroller.READY))}this._NAME_=OGX.Scroller.NAME,this.el=null,this.enable=function(){return A(),E(!0),f.observe&&setTimeout((function(){L(!0)}),0),x(!0),this},this.disable=function(){return E(!1),f.observe&&L(!1),G(!1),b(!1),x(!1),C(!1),S(!1),r.removeClass("ogx_scroller_track_anim_fade_in"),r.removeClass("ogx_scroller_track_anim_fade_out"),this},this.resize=function(){return A(),this},this.destroy=function(){h.el.removeClass("ogx_scroller_outer"),e.remove(),o.remove()},this.top=function(){return n>a&&(i[0].scrollTop=0,A()),this},this.bottom=function(){return n>a&&(i.scrollTop(n),A()),this},this.scroll=function(t){return i[0].scrollTop=t,A(),this},this.mute=function(){return m=!0,this},this.vocal=function(){return m=!1,this},this.container=function(){return e},this.inner=function(){return e[0]},this.outer=function(){return i[0]},this.state=function(){return p},OGX.Data.merge(f,g),function(){h.el=$(f.el),h.el.addClass("ogx_scroller_outer ogx_hw"),(i=h.el).html('<div class="ogx_scroller_inner ogx_hw"></div>'),e=i.children(".ogx_scroller_inner");var t='<div class=ogx_scroller_track ogx_hw" style="z-index:'+f.zindex+';"><div class="ogx_scroller_track_button"></div></div>';i.parent().append(t),o=i.parent().find(".ogx_scroller_track"),r=o.find(".ogx_scroller_track_button")}(),A()},OGX.Scroller.NAME="Scroller",OGX.Scroller.READY="ScrollerReady",OGX.Scroller.TOP="ScrollerTop",OGX.Scroller.BOTTOM="ScrollerBottom",OGX.Scroller.SCROLL="ScrollerScroll",OGX.Scroller.START="ScrollerStart",OGX.Scroller.END="ScrollerEnd",require("StackedTree","Uxi","Touch"),OGX.StackedTree=function(t){construct(this,"StackedTree");var e,i,n,a,r=this,o={scope:["public"],speed:200,list:[],display:{html:"{{$label}}"},displays:!1,chromeos:!1},s=t,l=[],c=[0],d=0,u=!1,h="ogx_stacked_tree";function f(t){t?(e.on(r.touch.down,"."+h+"_level_prev",g),e.on(OGX.DynamicList.SELECT,_)):(e.off(r.touch.down,"."+h+"_level_prev",g),e.off(OGX.DynamicList.SELECT,_))}function g(t){t.preventDefault(),t.stopImmediatePropagation(),y(--d,!0),c.pop(),r.el.trigger(OGX.StackedTree.BACK)}function _(t,e){u=e;var i=l[d].findIndex("__id__",e.__id__);e.hasOwnProperty("items")&&e.items.length&&function(t){if(!t.hasOwnProperty("scope"))return!0;for(var e=0;e<s.scope.length;e++)if(-1!==t.scope.indexOf(s.scope[e]))return!0;return!1}(e)?(c.push(i),v(++d,e.items),r.el.trigger(OGX.StackedTree.ENTER,e),setTimeout((function(){y(d)}),0)):r.el.trigger(OGX.StackedTree.SELECT,e)}function p(t){t?$(window).on("resize",m):$(window).off("resize",m)}function m(){i.removeClass(h+"_anim"),n=i.width(),i.css("transform","translateX("+d*Math.round(n/c.length)*-1+"px)")}function v(t,e){i.removeClass(h+"_anim").css("width",100*(t+1)+"%"),n=i.width();var o,c='<div class="'+h+'_level" data-level="'+t+'">';t>0&&(o=(o=a.css(u)).replace(h+"_door",""),c+='<div class="'+h+"_item ogx_stacked_tree_level_prev "+o+'">'+a.html(u)+"</div>"),c+='<div class="'+h+'_level_list"></div></div>',i.append(c);var d=i.children("."+h+'_level[data-level="'+t+'"]').children("."+h+"_level_list");i.children("."+h+"_level").css("flex-basis",Math.floor(100/(t+1)*100)/100+"%"),function(t,e,i){l[t]&&r.remove(l[t].id,OGX.DynamicList.NAME);var n=r.create("DynamicList",{el:e,mode:"hit",scroll:!0,display:s.display,displays:s.displays,list:i});l[t]=n}(t,d[0],e)}function y(t,e){i.addClass(h+"_anim"),void 0!==e&&e&&(f(!1),i.on("transitionend",(function(){i.off("transitionend"),i.removeClass(h+"_anim").css("width",100*(t+1)+"%"),r.remove(l[t+1].id,OGX.DynamicList.NAME),l.splice(t+1,1),i.children("."+h+'_level[data-level="'+(t+1)+'"]').remove(),i.children("."+h+"_level").css("flex-basis",Math.floor(100/(t+1)*100)/100+"%"),n=i.width(),u=!1,f(!0)}))),n=i.width(),i.css("transform","translateX("+t*Math.round(n/c.length)*-1+"px)")}this._NAME_=OGX.StackedTree.NAME,this.el=null,this.enable=function(){return this.touch.enable(),f(!0),p(!0),this},this.disable=function(){return this.touch.disable(),f(!1),p(!1),this},this.resize=function(){return m(),this},this.destroy=function(){},this.val=function(t){if(t.length){var e=t.slice();return s.list={items:e},!0}return!1},this.scope=function(t){return void 0!==t?(s.scope=t,c=[0],d=0,u=!1,!0):s.scope},function(){s=OGX.Data.merge(s,o,!1,!0);var t=(a=new OGX.Display(s)).val();if(t=function(t){if(t.display&&"object"==typeof t.display&&!t.display.hasOwnProperty("bind")&&(t.display=i(t.display)),t.displays)for(var e in t.displays)t.displays[e]=i(t.displays[e]);function i(t){var e=['{{return typeof($items) !== "undefined" && $items.length > 0}}',{add:"ogx_stacked_tree_door"}];if(t.hasOwnProperty("css"))if("object"==typeof t.css)t.css.hasOwnProperty("add")&&t.css.add?t.css.add+=" ogx_stacked_tree_item":t.css.add="ogx_stacked_tree_item",t.css.hasOwnProperty("conditions")?t.css.conditions.push(e):t.css.conditions=[e];else{var i="";t.css&&(i=t.css),i+=" ogx_stacked_tree_item",t.css={add:i,conditions:[e]}}else t.css={add:"ogx_stacked_tree_item",conditions:[e]};return t}return t}(t),a.val(t),s.display=t.display,s.displays=t.displays,r.el=e=$(s.el),e.addClass(h),s.list.length){var i=s.list.slice();s.list={items:i}}}(),e.html('<div class="'+h+'_container" style="width:100%"></div>'),i=e.children("."+h+"_container").first(),s.list.items.length&&v(c[0],s.list.items)},OGX.StackedTree.NAME="StackedTree",OGX.StackedTree.BACK="StackedTreeBack",OGX.StackedTree.ENTER="StackedTreeEnter",OGX.StackedTree.SELECT="StackedTreeSelect",require("Stage","Uxi","Touch","Placeholder"),OGX.Stage=function(t){construct(this,"Stage");var e=this,i=OGX.Data.merge({id:"stage",anim:null,group_watch:!1},t,!0,!0);function n(t){t?e.el.on(e.touch.down,".ogx_stage_exit",(function(){app.theater.show()})):e.el.off(e.touch.down,".ogx_stage_exit")}this.el=null,this.id=i.id,this.anim=i.anim,this.theater=!1,this.home=null,this.url=null,this.route=null,this._CLASS_=t._sub_,this._NAME_=OGX.Stage.NAME,delete t._sub_,this.enable=function(){return i.closeable&&n(!0),this},this.disable=function(){return i.closeable&&n(!1),this},function(){i.hasOwnProperty("theater")&&(e.theater=i.theater),e.home=i.home;var t=new OGX.Display(i),n="block";i.hasOwnProperty("use")&&i.use||(n="none");var a="";i.closeable&&(a='<div class="ogx_stage_exit"></div>');var r=t.html();i.hasOwnProperty("data")&&(r=OGX.Templater.make(r,i.data)),a+=r,e.el=container=$(i.el),container.html(a),container.addClass("ogx_stage").css("display",n)}()},OGX.Stage.NAME="Stage",OGX.Stage.SWAP="swap",OGX.Stage.FLIP="flip",require("Switch","Uxi","Bind","Touch"),OGX.Switch=function(t){construct(this,"Switch");var e,i=this,n=t,a={el:"document",bind:!1,labels:!0,data:[{label:"OFF",value:!1},{label:"ON",value:!0}],value:!1,name:!1},r="ogx_switch";function o(t){n.value===n.data[0].value?n.value=n.data[1].value:n.value=n.data[0].value,s()}function s(){"undefined"==typeof __trigger?__trigger=!1:__trigger=!0;var t=e.find("."+r+"_dot").first(),i=e.find("."+r+"_label").first(),a=e.find("."+r+"_label").last();n.value==n.data[0].value?(t.removeClass(r+"_dot_right").addClass(r+"_dot_left"),i.removeClass(r+"_label_off").addClass(r+"_label_on").addClass(r+"_selected"),a.removeClass(r+"_label_on").addClass(r+"_label_off").removeClass(r+"_selected")):(t.removeClass(r+"_dot_left").addClass(r+"_dot_right"),a.removeClass(r+"_label_off").addClass(r+"_label_on").addClass(r+"_selected"),i.removeClass(r+"_label_on").addClass(r+"_label_off").removeClass(r+"_selected")),n.name&&e.find('input[type="hidden"]').attr("value",n.value).trigger("input")}function l(t){t?e.on(i.touch.down,c):e.off(i.touch.down,c)}function c(t){t.preventDefault(),t.stopImmediatePropagation(),o(),d(!1),e.trigger(OGX.Switch.CHANGE,n.value),e.children("."+r+"_val").trigger("input"),d(!0)}function d(t){t?e.on("change","input[type=hidden]",u):e.off("change","input[type=hidden]",u)}function u(t){t.preventDefault(),t.stopImmediatePropagation(),n.value=OGX.Data.stringToVal(t.target.value),s()}this._NAME_=OGX.Switch.NAME,this.el=null,this.enable=function(){return l(!0),n.name&&d(!0),e.removeClass(r+"_disabled"),this},this.disable=function(){return l(!1),n.name&&d(!1),e.addClass(r+"_disabled"),this},this.bindRender=function(t,e){},this.val=function(t,i){return void 0===i&&(i=!0),void 0!==t&&n.value!==t&&(o(),i&&e.children("."+r+"_val").first().trigger("input")),n.value},this.toggle=function(t){return o(t=void 0===t),this},function(){var t;void 0===n&&(n={}),n.hasOwnProperty("data")&&!n.hasOwnProperty("value")&&(t=n.data[0].value),OGX.Data.merge(n,a),void 0!==t&&(n.value=t),i.el=e=$(n.el),e.addClass(r+"_disabled");var o=e.parent();o[0].hasAttribute("data-value")&&(n.value=OGX.Data.stringToVal(o.data("value")),o.removeAttr("data-value"))}(),function(){var t="";n.labels&&(t+='<span class="'+r+'_label_on ogx_switch_label">'+n.data[0].label+"</span>");var i="";n.value===n.data[1].value&&(i=r+"_dot_right"),t+='<div class="'+r+'_track"><div class="'+r+'_track_bg"></div><div class="'+r+"_dot "+i+'"></div></div>',n.labels&&(t+='<span class="'+r+'_label_off ogx_switch_label">'+n.data[1].label+"</span>"),n.name&&(t+='<input class="'+r+'_val" type="hidden" name="'+n.name+'" value="'+n.value+'"></div>'),e.html(t),e.addClass(r)}(),setTimeout(s,0)},OGX.Switch.NAME="Switch",OGX.Switch.CHANGE="SwitchChange",OGX.Switch.BIND=OGX.Switch.CHANGE,require("Tabs","Uxi","Touch"),OGX.Tabs=function(t){construct(this,"Tabs");var e,i=this,n=t,a={editable:!0,detachable:!1,detach_min:20,reorder:!0,icons:!1,index:0,list:new OGX.List,display:{html:"",css:""}},r=!1,o=0,s=!1,l=!1,c=!1,d=!1,u=!1,h={x:0,y:0},f="ogx_tabs";function g(){for(var t,i,a='<div class="'+f+'_container">',s=0;s<n.list.length;s++)i=n.display.css(n.list[s]),s===o&&(i+=" ogx_tabs_tab_active"),t=!1,"string"==typeof n.list[s]?t=n.list[s]:(n.list[s].hasOwnProperty("label")&&(t=n.list[s].label),n.list[s].hasOwnProperty("enabled")&&n.list[s].enabled&&(i+=" "+f+"_tab_disabled")),a+='<div class="'+f+"_tab "+i+'">',t&&(a+='<span class="'+f+'_tab_label">'+t+"</span>"),n.editable&&(a+='<span class="'+f+'_tab_close"><span></span></span>'),a+="</div>",i="";a+="</div>",n.editable&&(a+='<div class="'+f+'_tab_add"><span></span></div>',e.addClass(f+"_editable")),e.html(a),r=e.children("."+f+"_container").children("."+f+"_tab:eq("+o+")")}function _(t){s||(u=!1,l=$(t),c={from:l.index()},e.children("."+f+"_container").children("."+f+"_tab_active").first().removeClass(f+"_tab_active"),h.x=l.position().left,h.y=l.position().top,(s={el:$(t).clone(),x:h.x,y:l.position().top}).w=l.width(),s.el.width(s.w),l.addClass(f+"_tab_active").addClass(f+"_frozen"),r=l,s.el.addClass(f+"_tab_active").addClass(f+"_float").css("transform","translate3d("+h.x+"px, "+s.y+"px, 0px)"),e.children("."+f+"_container").prepend(s.el),d=setInterval(m,5))}function p(t,a){if(s)if(u=a,Math.abs(a.x)>Math.abs(a.y)){var r=s.x+a.x;s.el.css("transform","translate3d("+r+"px, "+s.y+"px, 0px)")}else{var o=s.y+a.y;if(s.el.css("transform","translate3d("+s.x+"px, "+o+"px, 0px)"),Math.abs(a.y)>4){c.to=l.index(),v();var d=n.list[c.from];"object"==typeof d&&(d=d.label);var h={label:d,index:c.to};i.removeAt(c.to),e.trigger(OGX.Tabs.REMOVE,h)}}}function m(){var t,i,n;s&&u&&(idx=l.index(),Math.abs(u.x)>Math.abs(u.y)&&e.children("."+f+"_container").children("."+f+"_tab").each((function(e,a){(t=$(a)).hasClass(f+"_tab_active")||(i=t.position(),n=t.width(),idx!==e&&(s.x+u.x>i.left+n/2&&s.x+u.x<i.left+n?(l.detach(),t.after(l)):s.x+u.x>i.left&&s.x+u.x<i.left+n/2&&(l.detach(),t.before(l))))})))}function v(){if(s&&(clearInterval(d),d=!1,u=!1,s.el.remove(),s=!1,l.removeClass(f+"_frozen"),c.to=l.index(),c.to!==c.from)){var t=n.list.splice(c.from,1);n.list.insert(t[0],c.to),o=c.to,i.el.trigger(OGX.Tabs.REORDER,c)}}function y(t){t?(e.on("click","."+f+"_tab",(function(){var t=$(this);t.hasClass(f+"_tab_disabled")||(r&&r.removeClass(f+"_tab_active"),t.addClass(f+"_tab_active"),o!==(r=t).index()&&(o=r.index(),e.trigger(OGX.Tabs.SELECT,n.list[r.index()])))})),n.editable&&e.on("click","."+f+"_tab_close",(function(t){return t.preventDefault(),t.stopImmediatePropagation(),e.trigger(OGX.Tabs.CLOSE,{index:o,tab:n.list[o]}),i.removeCurrent(),updateContainerWidth(),!1}))):(e.off("click","."+f+"_tab"),n.editable&&(e.off("click","."+f+"_tab_add"),e.off("click","."+f+"_tab_close")))}this._NAME_=OGX.Tabs.NAME,this.el=null,this.enable=function(){return y(!0),n.reorder&&this.touch.hold.enable(),this},this.disable=function(){return y(!1),n.reorder&&this.touch.hold.disable(),this},this.empty=function(){return this.clear(),o=0,r=null,n.list=new OGX.List,e.empty(),this},this.val=function(t){if(void 0===t)return r;var e;"string"==typeof t?e=n.list.indexOf(t):t.hasOwnProperty("label")&&(e=(e=n.list.findIndex("label",t.label)).index),this.index(e)},this.set=function(t){return void 0===t?n.list:(t.hasOwnProperty("insert")||(t=new OGX.List(t)),n.list=t,setTimeout(g,0),this)},this.add=function(t){return n.icons&&(t.hasOwnProperty("icon")||(t.icon=n.icon_default)),n.list.push(t),o=n.list.length-1,setTimeout((function(){var t,i,n;g(),t=e.width(),i=e.children("."+f+"_container").first(),(n=i.width())>t&&i.css("transform","translateX("+-1*(n-t)+"px)")}),0),this},this.addAt=function(t,e){return n.icons&&(t.hasOwnProperty("icon")||(t.icon=n.icon_default)),n.list.insert(t,e),o=e,setTimeout(g,0),this},this.removeCurrent=function(){return r&&this.removeTabAt(o),this},this.removeAt=function(t){return n.list.delete(t)&&(e.children("."+f+"_container").first().children("."+f+"_tab:eq("+t+")").remove(),r=null,function(){o>0?o--:o=0;i.index(o)}()),this},this.enableTab=function(t){return e.children("."+f+"_container").first().children("."+f+"_tab:eq("+t+")").removeClass(f+"_tab_disabled"),this},this.disableTab=function(t){return e.children("."+f+"_container").first().children("."+f+"_tab:eq("+t+")").addClass(f+"_tab_disabled"),this},this.index=function(t){return void 0!==t?(r&&(r.removeClass(f+"_tab_active"),r=null),(r=e.children("."+f+"_container").first().children("."+f+"_tab:eq("+t+")")).addClass(f+"_tab_active"),o=t,!0):r?o:-1},this.select=function(t){r&&r.removeClass(f+"_tab_active");var e=n.list.findIndex("label",t);return this.index(e.index),this},n||(n={}),OGX.Data.merge(n,a),n.list.hasOwnProperty("insert")||(n.list=new OGX.List(n.list)),n.display.hasOwnProperty("_NAME_")||(n.display=new OGX.Display(n.display)),i.el=e=$(n.el),e.addClass(f),n.editable&&e.addClass(f+"_editable"),o=n.index,setTimeout(g,0),n.reorder&&i.touch.hold.set({target:".ogx_tabs_tab",cb_hold:_,cb_move:p,cb_up:v})},OGX.Tabs.NAME="Tabs",OGX.Tabs.SELECT="TabsSelect",OGX.Tabs.CLOSE="TabsClose",OGX.Tabs.REORDER="TabsReoroder",OGX.Tabs.ADD="TabsAdded",OGX.Tabs.REMOVE="TabsRemoved",require("Tags","Uxi","Touch"),OGX.Tags=function(__config){construct(this,"Tags");var that=this,config=__config,config_default={remove:!0,add:!0,name:!1,tags:[],current_tags:[],tags_ascii:[],mode:OGX.Tags.MODE_STRING,keycode:13,placeholder:"keywords",restrict:!1,strict:!1,required:!1,max:0,display_max:0,display_more:!1,click_more:!1,hide_input_on_disable:!0,more_word:"other"},container,input,sliced={org:[],rem:[]};function updateHidden(t){var e;e=1===config.max&&config.current_tags.length?config.current_tags[0]:JSON.stringify(config.current_tags),container.find("input[type=hidden]").val(e),t&&container.find("input[type=hidden]").trigger("change")}function addTag(t){var e=!1;switch(config.mode){case OGX.Tags.MODE_STRING:case OGX.Tags.MODE_ASCII:-1===config.current_tags.indexOf(t)&&(config.current_tags.push(t),e=!0);break;case OGX.Tags.MODE_OBJECT:var i=config.current_tags.find("label",t,1);i||((i=config.tags.find("label",t,1))?config.current_tags.push(i):config.current_tags.push({label:t}),e=!0)}if(e){var n="";!0===config.remove&&(n='<span class="ogx_tags_remove"></span>');var a='<span class="ogx_tags_tag"><span>'+t+"</span>"+n+"</span>";container.find(".ogx_tags_tags").first().append(a),listenHidden(!1),updateHidden(!0),listenHidden(!0),container.trigger(OGX.Tags.TAG_ADDED,t),container.trigger(OGX.Tags.CHANGE,[config.current_tags])}container.find(".ogx_tags_input").trigger("focus")}function removeTag(t){var e=!1;switch(config.mode){case OGX.Tags.MODE_STRING:case OGX.Tags.MODE_ASCII:var i=config.current_tags.indexOf(t);i>-1&&(e=config.current_tags.splice(i,1));break;case OGX.Tags.MODE_OBJECT:e=config.current_tags.findDelete("label",t)}return e&&container.find(".ogx_tags_tags").first().find(".ogx_tags_tag").each((function(e,i){if($(i).find("span").first().text()===t)return $(i).remove(),listenHidden(!1),updateHidden(!0),void listenHidden(!0)})),e}function displayTags(t,e){if(t){container.find(".ogx_tags_container").length>0&&(displayTags(!1),listenTagAdd(!1));for(var i='<div class="ogx_tags_container">',n=!1,a=0;a<e.length;a++)if("object"==typeof e[a]&&e[a].hasOwnProperty("__m__"))n=e[a].__m__;else switch(config.mode){case OGX.Tags.MODE_STRING:case OGX.Tags.MODE_ASCII:i+='<span class="ogx_tags_tag ogx_tags_container_tag">'+e[a]+"</span>";break;case OGX.Tags.MODE_OBJECT:i+='<span class="ogx_tags_tag ogx_tags_container_tag">'+e[a].label+"</span>"}n&&(i+='<span class="ogx_tags_tag ogx_tags_more">+'+n+" "+config.more_word+"</span>"),i+="</div>",container.append(i),listenTagAdd(!0)}else container.find(".ogx_tags_container").remove(),listenTagAdd(!1)}function renderTags(t){for(var e="",i="",n=0;n<t.length;n++)switch(i=!0===config.remove?'<span class="ogx_tags_remove"></span>':"",config.mode){case OGX.Tags.MODE_STRING:case OGX.Tags.MODE_ASCII:e+='<span class="ogx_tags_tag"><span>'+t[n]+"</span>"+i+"</span>";break;case OGX.Tags.MODE_OBJECT:e+='<span class="ogx_tags_tag"><span>'+t[n].label+"</span>"+i+"</span>"}return config.current_tags=t,container.find(".ogx_tags_tags").first().html(e),updateHidden(!1),!0}function trimTags(t){return t=OGX.Data.clone(t),sliced={org:OGX.Data.clone(t),rem:[]},Array.isArray(t)&&config.display_max&&t.length>config.display_max&&(sliced.rem=t.slice(config.display_max),t=t.slice(0,config.display_max)),config.display_more&&sliced.rem.length&&t.push({__m__:sliced.rem.length}),new OGX.List(t)}function findTags(t){for(var e,i=[],n=0;n<config.tags.length;n++)if(e=!1,0===config.tags[n].toLowerCase().indexOf(t.toLowerCase())&&-1===config.current_tags.indexOf(config.tags[n])){if(config.display_max){if(!(i.length+1<=config.display_max))return i;e=!0}else e=!0;e&&i.push(config.tags[n])}return trimTags(i)}function findTagsObj(t){var e=new RegExp(t,"gi"),i=config.tags.find("label",e);if(i&&i.length)for(var n=0;n<config.current_tags.length;n++)i.findDelete("label",config.current_tags[n].label);return i&&i.length?trimTags(i):[]}function findTagsAscii(t){var e,i=stringToAscii(t.substr(0,3)),n=[];if(config.tags_ascii[i])for(var a=0;a<config.tags_ascii[i].length;a++)if(e=!1,-1!==config.tags_ascii[i][a].toLowerCase().indexOf(t.toLowerCase())&&-1===config.current_tags.indexOf(config.tags[a])){if(config.display_max){if(!(n.length+1<=config.display_max))return n;e=!0}else e=!0;e&&n.push(config.tags_ascii[i][a])}return n&&n.length?trimTags(n):[]}function stringToAscii(t){for(var e="",i=0;i<t.length;i++)e+=t.toLowerCase().charCodeAt(i).toString();return e}function listenInput(t){t?input.on("keyup",(function(t){var e=$(this).val();if(e.length>=3)if(!config.strict&&t.which===config.keycode&&config.add)addTag(e),input.val(""),displayTags(!1);else{var i;switch(config.mode){case OGX.Tags.MODE_STRING:i=findTags(e);break;case OGX.Tags.MODE_OBJECT:i=findTagsObj(e);break;case OGX.Tags.MODE_ASCII:i=findTagsAscii(e)}i.length>0?displayTags(!0,i):displayTags(!1)}else displayTags(!1)})):input.off("keyup")}function listenSelect(t){t?container.on(that.touch.down,".ogx_tags_tag",onSelect):container.off(that.touch.down,".ogx_tags_tag",onSelect)}function onSelect(t){var e=$(this).text();switch(config.mode){case OGX.Tags.MODE_OBJECT:e=config.current_tags.get({label:{eq:e}},null,1)}that.el.trigger(OGX.Tags.SELECT,e)}function listenMore(t){t?container.on(that.touch.down,".ogx_tags_more",onMore):container.off(that.touch.down,".ogx_tags_more",onMore)}function onMore(t){t.preventDefault(),t.stopImmediatePropagation(),sliced.rem.length&&($(this).remove(),displayTags(!0,sliced.org))}function listenTagAdd(t){t?container.on(that.touch.down,".ogx_tags_container_tag",onAdd):container.off(that.touch.down,".ogx_tags_container_tag",onAdd)}function onAdd(t){addTag($(this).text()),input.val(""),displayTags(!1),config.max&&config.current_tags.length===config.max&&(listenInput(!1),input.css("display","none"))}function listenTagRemove(t){t?container.on(that.touch.down,".ogx_tags_remove",onRemove):container.off(that.touch.down,".ogx_tags_remove",onRemove)}function onRemove(t){t.preventDefault(),t.stopImmediatePropagation();var e=removeTag($(this).parent("span").first().find("span").first().text());container.trigger(OGX.Tags.TAG_REMOVED,e),container.trigger(OGX.Tags.CHANGE,[config.current_tags]),config.max&&config.current_tags.length<config.max&&(listenInput(!0),input.css("display","block")),input.trigger("focus")}function listenHidden(t){t?container.on("change","input[type=hidden]",onHiddenChange):container.off("change","input[type=hidden]",onHiddenChange)}function onHiddenChange(t){t.preventDefault(),t.stopImmediatePropagation(),t.target.value.length?config.current_tags=JSON.parse(t.target.value):config.current_tags=[],renderTags(config.current_tags)}function initInput(){var t='<span class="ogx_tags_tags"></span>';if(config.add&&(t+='<input type="text" class="ogx_tags_input" placeholder="'+config.placeholder+'">'),config.name){var e="";config.required&&(e="required"),t+='<input type="hidden" name="'+config.name+'" '+e+">"}if(container.html(t),input=container.find(".ogx_tags_input").first(),config.restrict){var i={multiline:!1,max:30};"object"==typeof config.restrict&&(i=config.restrict),i.el=input[0],OGX.Form.restrictField(i)}}function initDefaults(){for(var a in config||(config={}),config_default)config.hasOwnProperty(a)||(config[a]=config_default[a]);config.tags.hasOwnProperty("insert")||(config.tags=new OGX.List(config.tags)),config.current_tags.hasOwnProperty("insert")||(config.current_tags=new OGX.List(config.current_tags)),config.restrict&&("string"==typeof config.restrict.allowed&&(config.restrict.allowed=eval(config.restrict.allowed)),"string"==typeof config.restrict.forbidden&&(config.restrict.forbidden=eval(config.restrict.forbidden))),that.el=container=$(config.el),container.addClass("ogx_tags")}function init(){initDefaults(),initInput(),config.current_tags.length>0&&renderTags(config.current_tags)}this._NAME_=OGX.Tags.NAME,this.el=null,this.enable=function(){if(config.remove&&(listenInput(!0),listenTagAdd(!0),listenTagRemove(!0)),config.display_more&&config.click_more&&listenMore(!0),config.name&&listenHidden(!0),listenSelect(!0),config.add){var t=container.find(".ogx_tags_input").first();t.prop("placeholder",config.placeholder),t.prop("disabled",!1),config.hide_input_on_disable&&t.removeClass("ogx_tags_hidden")}return this},this.disable=function(){if(config.remove&&(listenInput(!1),listenTagAdd(!1),listenTagRemove(!1)),config.display_more&&config.click_more&&listenMore(!1),config.name&&listenHidden(!1),listenSelect(!1),config.add){var t=container.find(".ogx_tags_input").first();t.prop("placeholder",""),t.prop("disabled",!0),config.hide_input_on_disable&&t.addClass("ogx_tags_hidden")}return this},this.destroy=function(){config.restrict&&OGX.Form.unrestrictField(container.find(".ogx_tags_input").first()[0])},this.tags=function(t){return void 0!==t?(t.hasOwnProperty("insert")||(t=new OGX.List(t)),config.tags=t,!0):config.tags},this.val=function(t,e){if(displayTags(!1),listenTagAdd(!1),void 0!==t){if(void 0!==e){var i=t,n=config.tags.find(i,e,1);n&&(t=[n])}return t.hasOwnProperty("insert")||(t=new OGX.List(t)),config.current_tags=t,config.max&&config.current_tags.length>=config.max&&container.find(".ogx_tags_input").first().css("display","none"),renderTags(config.current_tags)}return config.current_tags},this.clear=function(){return config.max&&config.current_tags.length===config.max&&(container.find(".ogx_tags_input").first().css("display","block"),listenInput(!0)),config.current_tags=new OGX.List,container.find(".ogx_tags_tags").first().empty(),container.find("input[type=hidden]").first().val(""),this},this.render=function(t){return renderTags(trimTags(t))},this.add=function(t){return addTag(t)},this.remove=function(t){return removeTag(t)},init()},OGX.Tags.prototype.tagDataset=function(t,e,i){"use strict";void 0===i&&(i=!1);for(var n,a=[],r=0;r<t.length;r++)for(var o=0;o<e.length;o++)if(t[r].hasOwnProperty(e[o])){n=t[r][e[o]].split(" ");for(var s=0;s<n.length;s++)i&&-1!==i.indexOf(n[s])||a.includes(n[s])||a.push(n[s])}return a},OGX.Tags.prototype.tagDatatree=function(t,e){"use strict";!function(t,e){var i=[];if(function t(n){if(n.hasOwnProperty("items"))for(var a=0;a<n.items.length;a++){for(var r in n.items[a])e.indexOf(r)>-1&&(i.includes(n.items[a][r])||i.push(n.items[a][r]));return t(n.items[a]),!0}}(t));}(t,e)},OGX.Tags.NAME="Tags",OGX.Tags.CHANGE="TagsChange",OGX.Tags.SELECT="TagsSelect",OGX.Tags.TAG_ADDED="TagsTagAdded",OGX.Tags.TAG_REMOVED="TagsTagRemoved",OGX.Tags.MODE_STRING="string",OGX.Tags.MODE_OBJECT="object",OGX.Tags.MODE_ASCII="ascii",OGX.Tags.BIND=OGX.Tags.CHANGE,OGX.Templater=function(){"use strict";var t,e=this;this.jmake=function(t,e){for(var i,n,a=JSON.stringify(t);m=/({{(\$|#)[a-z0-9_\.]*}})|("{{(\$)}}")/gi.exec(a);)m[0].match(/"{{(\$)}}"/)?(i="<-"+(i=JSON.stringify(e)).substring(1).slice(0,-1)+"->",a=(a=(a=a.replace(m[0],i)).replace(/<\-/,"{")).replace(/\->/,"}")):("object"==typeof(n=OGX.OSE.exec(m[0],e))&&(n=JSON.stringify(n),m[0]='"'+m[0]+'"'),a=a.replace(m[0],n));return JSON.parse(a)},this.make=function(e,i,n,a,r){var o,s;for(t={},void 0===r&&(r={}),OGX.Data.merge(t,r);o=/{{[^{]+(({[^{]+)+)?}}/gi.exec(e);)void 0===(s=OGX.OSE.exec(o[0],i,n,a,t))&&(s=""),e=e.replace(o[0],s);return e},this.get=function(t){var i=OGX.Cache.read("html",t);return!!i&&function(t){var i;for(;i=/{{ ?template (\S+) ?}}/gi.exec(t);)t=t.replace(i[0],e.get(i[1]));return t}(i)}},OGX.Templater=new OGX.Templater,require("Theater","Uxi","Touch"),OGX.Theater=function(t){construct(this,"Theater");var e,i,n,a=this,r=t,o={anim:!1,display:!0,icon_size:50,timeout:30},s={template:!1,html:'<span class="ogx_theater_stage_icon" style="background-image:url(\'{{$icon}}\')"></span><span class="ogx_theater_stage_label">{{$label}}</span>'},l='<div class="list"></div>',c=!0;function d(t){t?($(document).on("backbutton",u),$(window).on("popstate",u),list.el.on(OGX.DynamicList.SELECT,(function(t,e){!function(t){a.el.trigger(OGX.Theater.HIDE);var e=app.find(OGX.Stage.NAME,t);e.wake(),e.resizeNodes();var n,o=list.el.find('.ogx_theater_stage[data-ogx-id="'+e.id+'"]').position();a.observe(!0,{childList:!0},(function(){a.observe(!1),(n=i.children(".ogx_theater_trans")).on("transitionend",(function(){n.off("transitionend"),a.hide(),n.remove(),e.url?(app.showStage(e.id,!1),app.router.addToHist(e.url)):app.goto(e.id+"/"+e.home)})),n.removeClass("ogx_theater_trans_hide"),setTimeout((function(){n.addClass("ogx_theater_trans_grow").css({opacity:1,width:"100%",height:"100%",transform:"translate3d(0px, 0px, 0px)"})}),r.timeout)}),null,i),i.append('<div class="ogx_theater_trans ogx_theater_trans_hide" style="width:'+r.icon_size+"px; height:"+r.icon_size+"px; transform:translate3d("+o.left+"px,"+o.top+'px, 0px);" data-ogx-id="'+e.id+'"><div class="icon" style="background-image:url(\'/img/'+e.theater.icon+"')\"></div></div>")}(e.id)}))):($(document).off("backbutton",u),$(window).off("popstate",u),list.el.off(OGX.DynamicList.SELECT))}function u(){a.hide()}function h(){e.prepend(l);for(var t,i=[],o=0;o<n.length;o++)t={id:n[o].id,name:"",icon:""},"object"==typeof n[o].theater&&n[o].theater.hasOwnProperty("icon")&&(t.icon="./img/"+n[o].theater.icon,t.label=n[o].theater.label),i.push(t);$(".ogx_theater > .list").on(OGX.DynamicList.RENDER,(function(t){$(".ogx_theater > .list").off(OGX.DynamicList.RENDER),setTimeout((function(){l=$(".ogx_theater").detach()}),0)})),list=a.create("DynamicList",{el:".ogx_theater > .list",display:{html:r.display.html,css:"ogx_theater_stage"},key:"id",scroll:!0,mode:"hit",list:i,trigger:!0})}function f(){var t=app.gather(OGX.Stage.NAME);n=[];for(var e=0;e<t.length;e++)t[e].theater&&n.push(t[e])}this._NAME_=OGX.Theater.NAME,this.update=function(){f()},this.show=function(){return c&&(i.prepend(l),function(){a.el.trigger(OGX.Theater.SHOW);var t,n=app.getStage();a.observe(!0,{childList:!0},(function(e){a.observe(!1),n.sleep(),t=i.children(".ogx_theater_trans");var o=list.el.find('.ogx_theater_stage[data-ogx-id="'+n.id+'"]').position();t.removeClass("ogx_theater_trans_hide"),setTimeout((function(){t.on("transitionend",(function(){t.off("transitionend"),setTimeout((function(){t.remove()}),0)})),t.addClass("ogx_theater_trans_show").addClass("ogx_theater_trans_shrink").css({opacity:0,width:r.icon_size+"px",height:r.icon_size+"px",transform:"translate3d("+o.left+"px, "+o.top+"px, 0px)"})}),r.timeout)}),null,i),i.append('<div class="ogx_theater_trans ogx_theater_trans_hide" data-ogx-id="'+n.id+'"><div class="icon" style="background-image:url(\'/img/'+n.theater.icon+"')\"></div></div>"),e.css("visibility","visible")}(),this.focusNodes(),d(!0),c=!1),this},this.hide=function(){return c||(this.blurNodes(),l=e.detach(),d(!1),c=!0),this},this.tile=function(t,e){void 0===e&&(e="x")},OGX.Data.merge(r,o),r.display&&("object"!=typeof r.display&&(r.display={}),OGX.Data.merge(r.display,s),r.display.template&&(r.display.html=OGX.Templater.get(r.display.template))),a.el=e=$(r.el),e.addClass("ogx_theater").css("visibility","hidden"),i=$("body"),f(),$(document).on(OGX.App.READY,h)},OGX.Theater.NAME="Theater",OGX.Theater.ZOOM="TheaterZoom",OGX.Theater.SHOW="TheaterShow",OGX.Theater.HIDE="TheaterHide",OGX.Touch=function(t){"use strict";var e=this;this.touch=!1,this.touch||this.initTouch(t.chromeos),this.touch.swipe=new OGX.Touches.Swipe(this),this.touch.hold=new OGX.Touches.Hold(this),this.touch.drag=new OGX.Touches.Drag(this),this.touch.isRightClick=function(t){var i=e.event(t),n=!1;return i.which?n=3===i.which:i.button&&(n=2===i.button),n},this.touch.enable=function(){e.touch.swipe.enable(),e.touch.hold.enable(),e.touch.drag.enable()},this.touch.disable=function(){e.touch.swipe.disable(),e.touch.hold.disable(),e.touch.drag.disable()}},OGX.Touch.prototype.initTouch=function(t){void 0===t&&(t=!1),this.touch={hold:{}},this.touch.click="click",this.touch.down="mousedown",this.touch.up="mouseup",this.touch.move="mousemove",void 0===window.ontouchstart||t||(this.touch.down="touchstart",this.touch.up="touchend",this.touch.move="touchmove")},OGX.Touch.prototype.touchable=function(){return void 0!==window.ontouchstart},OGX.Touch.prototype.event=function(t){return t.hasOwnProperty("originalEvent")&&void 0!==t.originalEvent.changedTouches?t.originalEvent.changedTouches[0]:t},OGX.Touches={},OGX.Touches.Swipe=function(t){"use strict";var e,i=t,n={speed:10,x:!0,y:!1,min_x:100,min_y:100,cb_down:!1,cb_swipe:!1,cb_up:!1,target:!1,capture:!1},a=!1,r={x:0,y:0},o={x:0,y:0},s=0,l=0,c=0,d=0,u=0,h=!1,f=!1,g=!1;function _(t){g||(g=!0,t=i.event(t),r.x=t.pageX,r.y=t.pageY,c=d=0,s=l=u=0,p(!0),a.cb_down&&a.cb_down(r))}function p(t){t?(m(!0),h=setInterval(O,a.speed)):(m(!1),h&&(clearInterval(h),h=!1))}function m(t){t?e.on(i.touch.move,x):e.off(i.touch.move,x)}function v(t){t?($("body").on(i.touch.up,y),e.on(i.touch.down,_)):($("body").off(i.touch.up,y),e.off(i.touch.down,_))}function y(t,e){f&&(void 0===e&&(e=!1),p(!1),g&&a.cb_up&&a.cb_up({pt0:r,pt1:o,distX:c,distY:d,dist:u,dirX:s,dirY:l,swipe:e}),g=!1)}function x(t){a.capture&&(t.preventDefault(),t.stopImmediatePropagation()),t=i.event(t),o.x=t.pageX,o.y=t.pageY,s=o.x>r.x?1:-1,l=o.y>r.y?1:-1,c=Math.abs(o.x-r.x),d=Math.abs(o.y-r.y),u=Math.sqrt(Math.abs(Math.pow(o.x-r.x,2)-Math.pow(o.y-r.y,2)))}function O(){a.cb_swipe&&(a.x&&a.min_x&&c>=a.min_x||a.y&&a.min_y&&d>=a.min_y?y(0,!0):a.cb_swipe({pt0:r,pt1:o,dirX:s,dirY:l,distX:c,distY:d,dist:u}))}this.set=function(t){a||(a=OGX.Data.clone(n)),OGX.Data.merge(a,t,!0),e=i.el},this.enable=function(){!f&&a&&(f=!0,v(!0))},this.disable=function(){f&&a&&(f=!1,v(!1),p(!1))}},OGX.Touches.Hold=function(t){"use strict";var e={cb_hold:!1,cb_up:!1,cb_move:!1,time:1e3,el:this.el,target:!1,capture:!1},i=!1,n=!1,a=!1,r=!1,o=!1,s=!1,l=t,c={x:0,y:0},d={x:0,y:0},u=!1;function h(t){t=l.event(t),u=t.target.offsetParent,r||(r=!0,n=(new Date).getTime(),c.x=l.el.offset().left+t.pageX,c.y=l.el.offset().top+t.pageY,$("body").on(l.touch.move,f),a=setInterval(g,1))}function f(t){i.capture&&(t.preventDefault(),t.stopImmediatePropagation()),t=l.event(t),d.x=l.el.offset().left+t.pageX,d.y=l.el.offset().top+t.pageY,!o&&Math.abs(c.x-d.x)>5||Math.abs(c.y-d.y)>5?(clearInterval(a),a=!1):i.cb_move&&i.cb_move(d,{x:d.x-c.x,y:d.y-c.y})}function g(){r&&(new Date).getTime()-n>i.time&&(o||(o=!0,i.cb_hold?i.cb_hold(u):l.el.trigger(OGX.Touch.HOLD_START)))}function _(){o=!1,r=!1,$("body").off(l.touch.move,f),clearInterval(a),a=!1,i.cb_up?i.cb_up():l.el.trigger(OGX.Touch.HOLD_END)}this.set=function(t){i=t,OGX.Data.merge(i,e)},this.enable=function(){!s&&i&&(s=!0,l.el.on(l.touch.down,i.target,h),$("body").on(l.touch.up,_))},this.disable=function(){s&&i&&(s=!1,(r||a)&&(o=!1,r=!1,clearInterval(a),a=!1),l.el.off(l.touch.down,i.target,h),$("body").off(l.touch.up,_),$("body").off(l.touch.move,f))}},OGX.Touches.Drag=function(t){"use strict";var e,i,n,a,r,o,s=!1,l={min:10,limit_x:null,limit_y:null,target:!1,cb_down:!1,cb_drag:!1,cb_up:!1,border:10,capture:!1},c=t,d=!1,u=!1;function h(t){var e=[];e=s.target?[c.touch.down,s.target,f]:[c.touch.down,f],t?c.el.on.apply(c.el,e):c.el.off.apply(c.el,e)}function f(l){l=t.event(l),n=l.pageX,a=l.pageY;var d=c.el.position();e=d.left,i=d.top;var u=c.el.offset(),h=n-u.left,f=a-u.top;if(s.border){if(h<s.border||h>c.el.width()-s.border)return;if(f<s.border||f>c.el.height()-s.border)return}r=0,o=0,g(!0),_(!0),s.cb_down&&s.cb_down()}function g(t){t?d||(d=setInterval(v,10)):d&&(clearInterval(d),d=null)}function _(t){t?($("body").on(c.touch.move,m),$("body").on(c.touch.up,p)):($("body").off(c.touch.move,m),$("body").off(c.touch.up,p))}function p(e){g(!1),_(!1),e=t.event(e),s.x&&(r=e.pageX-n),s.y&&(o=e.pageY-a),s.cb_up&&s.cb_up({distX:r,distY:o})}function m(e){s.capture&&(e.preventDefault(),e.stopImmediatePropagation()),e=t.event(e);var i,l=!1;s.x&&(i=e.pageX-n,null!==s.limit_x?i>=s.limit_x.min&&i<=s.limit_x.max&&(s.min?Math.abs(i)>s.min&&(r=i,l=!0):(r=i,l=!0)):s.min?Math.abs(i)>s.min&&(r=i,l=!0):r=i),s.y&&(i=e.pageY-a,null!==s.limit_y?i>=s.limit_y.min&&i<=s.limit_y.max&&(s.min?Math.abs(i)>s.min&&(o=i,l=!0):(o=i,l=!0)):o=i),l&&s.cb_drag&&s.cb_drag({distX:r,distY:o,x:e.pageX,y:e.pageY})}function v(){c.el.css({transform:"translate3d("+(e+r)+"px, "+(i+o)+"px, 0px)"})}this.dragable=!0,this.set=function(t){s=t,OGX.Data.merge(s,l)},this.enable=function(){!u&&s&&(u=!0,h(!0))},this.disable=function(){u&&s&&(u=!1,h(!1),_(!1),g(!1))}},OGX.Touch.HOLD_START="TouchHoldStart",OGX.Touch.HOLD_END="TouchHoldEnd",require("Tree","Uxi","Touch"),OGX.Tree=function(t){construct(this,"Tree");var e,i,n,a,r,o,s,l,c=this,d=t,u={show_root:!0,root_label:"root",editable:!1,sort:{enabled:!0,property:"label",way:1},toggle:!0,drag_after:1e3,icon_size:30,scope:["public"],chromeos:!1,types:{root:{mode:"folder",icons:{open:"folder_open",close:"folder_closed",empty:null}},file:{mode:"file",icon:"file"},folder:{mode:"folder",icons:{open:"folder_open",close:"folder_closed",empty:null}}},data:{id:0,type:"root",label:d.root_label,state:"closed",items:[]},template:'<div class="ogx_tree_item" data-id="{{$_id_}}"><span class="ogx_tree_item_arrow {{$arrow_style}} {{$arrow_display}}"><span style="width:{{$arrow_size}}; height:{{$arrow_size}}"></span></span><span class="ogx_tree_item_icon {{$icon}}" style="width:{{$size}}px; height:{{$size}}px;"></span><div class="ogx_tree_item_label">{{$label}}</div><div class="ogx_tree_item_container {{$container_display}}"></div></div>'};function h(){var t={icon:X({type:"root",state:"open"}),size:d.icon_size,_id_:d.data._id_,label:d.root_label,container_display:"",arrow_display:"",arrow_style:"ogx_tree_item_arrow_open",arrow_size:Math.round(d.icon_size/2)+"px"};e.html(OGX.Templater.make(d.template,t)),d.data.element=e.children(".ogx_tree_item").first()}function f(){h(),g(d.data,d.data.element)}function g(t,e){if(t.hasOwnProperty("items")){var i,n;i=d.sort.enabled?function(t,e,i){return t.sort(function(t,e){return function(i,n){return i[t]<n[t]?-1*e:i[t]>n[t]?e:0}}(e,i)),t}(t.items,d.sort.property,d.sort.way):t.items;for(var a=0;a<i.length;a++)n={icon:null,size:d.icon_size,_id_:t.items[a]._id_,label:t.items[a].label,container_display:"",arrow_display:"",arrow_style:"",arrow_size:Math.round(d.icon_size/2)+"px"},t.items[a].hasOwnProperty("state")||(t.items[a].state="close"),"folder"===E(t.items[a])?(t.items[a].items.length||(t.items[a].state="close",n.arrow_style="ogx_tree_item_arrow_disabled"),"open"===t.items[a].state?n.arrow_style="ogx_tree_item_arrow_open":(n.arrow_style+=" ogx_tree_item_arrow_close",n.container_display="ogx_tree_item_container_hidden"),n.icon=X(t.items[a])):(n.arrow_display="ogx_tree_item_arrow_hidden",n.icon=X(t.items[a])),e.children(".ogx_tree_item_container:last").append(OGX.Templater.make(d.template,n)),t.items[a].element=e.children(".ogx_tree_item_container:last").children(".ogx_tree_item:last"),g(t.items[a],t.items[a].element)}}function _(t){var e=JSON.parse(JSON.stringify(t));return delete e._id_,delete e.element,e}function p(t){"folder"===E(t)&&(t.items.length||(t.state="close",t.element.children(".ogx_tree_item_arrow").addClass("ogx_tree_item_arrow_disabled")),"open"===t.state?(t.element.children(".ogx_tree_item_arrow").removeClass("ogx_tree_item_arrow_close").removeClass("ogx_tree_item_arrow_disabled").addClass("ogx_tree_item_arrow_open"),t.element.children(".ogx_tree_item_container").css("display","block")):(t.element.children(".ogx_tree_item_arrow").removeClass("ogx_tree_item_arrow_open").addClass("ogx_tree_item_arrow_close"),t.element.children(".ogx_tree_item_container").css("display","none")),t.element.children(".ogx_tree_item_icon").attr("class","ogx_tree_item_icon "+X(t)))}function m(){if(s){var t=O(s);t&&(t.children(".ogx_tree_item_icon").removeClass("ogx_tree_selected_item"),s=null)}}function v(t){return G((function(e,i,n,a){return e._id_===t&&(n.items.splice(a,1),n.items.length||(n.state="close"),p(n),!0)}))}function y(t,e){return G((function(i){return i._id_===e&&(i.items.push(t),i.state="open",p(i),!0)}))}function x(t){return G((function(e,i){return e._id_===t&&e}))}function O(t){var e=x(t);return!!e&&e.element}function b(t){var e=function(t){return G((function(e,i){return t===i+"/"+e.label&&e}))}(t);return!!e&&e.element}function w(){l=1,G((function(t){return t._id_=l++,t.hasOwnProperty("type")||(t.hasOwnProperty("items")?t.type="folder":t.type="file"),!1}))}function G(t,e){var i;if(void 0===e&&(e=d.data),i=function e(n,a,r,o){if(i=t(n,a,r,o))return i;if(n.hasOwnProperty("items")&&n.items.length)for(var s=0;s<n.items.length;s++)if(i=e(n.items[s],a+"/"+n.label,n,s))return i;return!1}(e,""))return i}function X(t){return!!d.types.hasOwnProperty(t.type)&&(d.types[t.type].hasOwnProperty("icons")?"close"===t.state&&!t.items.length&&d.types[t.type].icons.hasOwnProperty("empty")?d.types[t.type].icons.empty:d.types[t.type].icons[t.state]:d.types[t.type].icon)}function E(t){return!!d.types.hasOwnProperty(t.type)&&d.types[t.type].mode}function T(t){var i,n;n=_(x(i=t.data("id"))),d.toggle?t.children(".ogx_tree_item_icon").hasClass("ogx_tree_selected_item")?(m(),e.trigger(OGX.Tree.UNSELECT,n)):(m(),t.children(".ogx_tree_item_icon").addClass("ogx_tree_selected_item"),s=i,e.trigger(OGX.Tree.SELECT,n)):(m(),t.children(".ogx_tree_item_icon").addClass("ogx_tree_selected_item"),e.trigger(OGX.Tree.SELECT,n))}function C(t){t?(d.editable?(e.on(c.touch.down,".ogx_tree_item > .ogx_tree_item_icon",(function(t){t.preventDefault(),T($(this).parent(0)),1!==$(this).parent(0).data("id")&&function(){r&&clearInterval(r);o=(new Date).getTime(),r=setInterval(D,50)}()})),$(document).on(c.touch.up,(function(){M(),n&&(S(!1),function(){var t=n.offset().left,r=n.offset().top,o=(s=t,l=r,G((function(t,e){return c=t.element.offset(),d=t.element.children(".ogx_tree_item_icon"),s>=c.left&&s<=c.left+d.width()&&l>=c.top&&l<=c.top+d.height()&&t})));var s,l,c,d;!o||o&&(o._id_===i._id_||"folder"!==E(o))?(a.css("opacity",1),n.remove(),n=null,i=null):(h=o,v((u=i)._id_),y(u,h._id_),h.element.children(".ogx_tree_item_container").empty(),h.state="open",g(h,h.element),p(h),a.remove(),n.remove(),n=null,e.trigger(OGX.Tree.DROP,i),i=null);var u,h}())}))):e.on("click",".ogx_tree_item > .ogx_tree_item_icon",(function(t){t.preventDefault(),T($(this).parent(0))})),e.on(c.touch.down,".ogx_tree_item_arrow",(function(t){if(t.preventDefault(),M(),$(this).parent(0).children(".ogx_tree_item_container").first().children().length>0){var i=x($(this).parent(0).data("id"));"open"===i.state?(i.state="close",e.trigger(OGX.Tree.CLOSE,i)):(i.state="open",e.trigger(OGX.Tree.OPEN,i)),p(i)}}))):(d.editable?e.off(c.touch.down,".ogx_tree_item > .ogx_tree_item_icon"):e.off("click",".ogx_tree_item > .ogx_tree_item_icon"),e.off(c.touch.down,".ogx_tree_item_arrow"))}function D(){var t;(new Date).getTime()-o>=d.drag_after&&(s&&(i=x(s))&&(t=i.element,a=t,(n=t.clone()).children(".ogx_tree_item_arrow").css("display","none"),t.css("opacity",.3),n.addClass("ogx_tree_item_drag"),n.css({top:t.offset().top,left:t.offset().left}),e.prepend(n),S(!0),e.trigger(OGX.Tree.DRAG,i)),M())}function S(t){t?$(document).on(c.touch.move,(function(t){t=function(t){if(t.hasOwnProperty("originalEvent")&&void 0!==t.originalEvent.changedTouches)return t.originalEvent.changedTouches[0];return t}(t),n.css({top:t.pageY+"px",left:t.pageX+"px"})})):$(document).off(c.touch.move)}function M(){r&&(clearInterval(r),r=null)}this._NAME_=OGX.Tree.NAME,this.el=null,this.enable=function(){return C(!0),this},this.disable=function(){return C(!1),this},this.setIconSize=function(t){return d.icon_size=t,e.find(".ogx_tree_item_icon").each((function(e,i){$(i).css({width:t+"px",height:t+"px"})})),$(".ogx_tree_item_arrow span").css({width:Math.round(d.icon_size/2)+"px",height:Math.round(d.icon_size/2)+"px"}),this},this.addItem=function(t){if(s){var e=x(s);return"folder"===E(e)&&(t._id_=++l,y(t,s),e.element.children(".ogx_tree_item_container").empty(),e.state="open",g(e,e.element),e.element.children(".ogx_tree_item_container").css("display","block")),!0}return!1},this.selectItemByPropVal=function(t,e){var i=function(t,e){function i(i,n){return!(!i.data.hasOwnProperty(t)||i.data[t]!==e)&&n+"/"+i.label}return G(i)}(t,e);return!!i&&(m(),function(t){var e=O(t);e&&(s=t,e.children(".ogx_tree_item_icon").addClass("ogx_tree_selected_item"))}(i._id_),!0)},this.selectItemByPath=function(t){var e=b(t);return!!e&&(m(),e.addClass("ogx_tree_selected_item"),s=e.data("id"),!0)},this.updateSelectedItemDataProperty=function(t,e){return!!s&&(x(s).data[t]=e,!0)},this.updateSelectedItemData=function(t){return!!s&&(x(s).data=t,!0)},this.updateSelectedItemLabel=function(t){if(s){var e=x(s);return e.label=t,O(e._id_).children(".ogx_tree_item_label").html(t),!0}return!1},this.deleteItemByPath=function(t){var e=b(t);return!!e&&v(e.data("id"))},this.deleteSelectedItem=function(){return function(){function t(t,e,i,n){if(t._id_===s)return t.element.remove(),i.items.splice(n,1),p(i),!0}if(s)return G(t);return!1}()},this.getSelectedItem=function(){return function(){if(s)return x(s);return!1}()},this.getTree=function(){var t=G(_,JSON.parse(JSON.stringify(d.data)));if(t)return t},this.setData=function(t){t.hasOwnProperty("types")&&this.setTypes(t.types),t.hasOwnProperty("tree")&&this.setTree(t.tree)},this.setTypes=function(t){d.types=t},this.setTree=function(t){d.data=t,d.data.hasOwnProperty("state")||(d.data.state="open"),w(),f()},this.newTree=function(){l=1,d.data={_id_:l,type:"root",state:"open",label:d.root_label,element:null,items:[]},h()},this.filterTree=function(t){!function(t){var e=[];function i(n,a,r,o){if(-1!==(a+n.label).indexOf(t)&&e.push(a+"/"+n.label),n.hasOwnProperty("items")&&n.items.length)for(var s=0;s<n.items.length;s++)i(n.items[s],a+"/"+n.label,n,s)}i(d.data,"")}(t)},function(){if(OGX.Data.merge(d,u),c.el=e=$(d.el),e.addClass("ogx_tree"),e.attr("data-ogx-id",c.id),Array.isArray(d.data)){var t=JSON.stringify(d.data);d.data={type:"root",label:d.root_label,items:JSON.parse(t)}}}(),w(),d.data&&f()},OGX.Tree.NAME="Tree",OGX.Tree.SELECT="TreeSelect",OGX.Tree.UNSELECT="TreeUnselect",OGX.Tree.OPEN="TreeOpen",OGX.Tree.CLOSE="TreeClose",OGX.Tree.DRAG="TreeDrag",OGX.Tree.DROP="TreeDrop",require("TreedList","Uxi"),OGX.TreedList=function(t){construct(this,"TreedList");var e=this,i={renderer:"Tree",list:new OGX.List,types:null,display:null,displays:null,group_by:null,group_mode:null,group_param:null},n=t,a=null,r=null;function o(){switch(s(n.list),n.renderer){case OGX.Tree.NAME:i={el:n.el,data:undefined},n.types&&(i.types=n.types),i.tree=function(){var t={type:"root",label:"root",state:"open",items:[]};function e(t,i){if(Array.isArray(t)){for(var n=0;n<t.length;n++)t[n].type="file";i.items=t}else for(var a in t)i.items.push({type:"folder",label:a,state:"open",items:[]}),e(t[a],i.items[i.items.length-1])}return e(a,t),t}(),r=e.create(n.renderer,i);break;case OGX.StackedTree.NAME:(i=function(){var t={display:!1,displays:!1};n.display&&n.display.hasOwnProperty("bind")?(t.display=OGX.Data.clone(n.display),t.displays=OGX.Data.clone(n.displays)):(t.display={bind:"__type"},t.displays={__default:OGX.Data.clone(n.display)},"object"==typeof t.displays.__default.css?t.displays.__default.css.hasOwnProperty("add")?t.displays.__default.css.add+=" ogx_stacked_tree_item":t.displays.__default.css.add="ogx_stacked_tree_item":t.displays.__default.css={add:t.displays.__default.css+" ogx_stacked_tree_item"});for(var e=0;e<n.group_by.length;e++)grp=n.group_by[e],t.displays[grp]={html:"{{$label}}",css:"ogx_stacked_tree_item"};return t}()).el=n.el;var t=function(){var t={data:[]};function e(t,i,a,r){var o;if(Array.isArray(t)){for(var s=0;s<t.length;s++)t[s].hasOwnProperty("scope")||(t[s].scope=["public"]);i.items=t}else for(var l in t)o={label:l,__type:n.group_by[r],scope:["public"],items:[]},a?(i.data.push(o),e(t[l],i.data[i.data.length-1],!1,r+1)):(i.items.push(o),e(t[l],i.items[i.items.length-1],!1,r+1))}return e(a,t,!0,0),t}();i.list=t.data,n.hasOwnProperty("id")&&(i.id=n.id+"_stacked"),r=e.create(n.renderer,i);break;case OGX.RouletteTree.NAME:var i;(i=OGX.Data.clone(n)).hasOwnProperty("id")&&(i.id=i.id+"_roultree"),i.data=a;for(var o=[],l=0;l<n.group_by.length;l++)o.push(n.group_by[l].split(".").pop());i.groups=o,r=e.create(n.renderer,i)}}function s(t,e,i,r){n.list=t,void 0!==e&&(n.group_by=e),void 0!==i&&(n.group_mode=i),void 0!==r&&(n.group_param=r),a=n.list.group(n.group_by,n.group_mode,n.group_param)}this._NAME_=OGX.TreedList.NAME,this.el=null,this.val=function(t,e,i,n){return void 0!==t?(s(t),a):a},this.getRenderer=function(){return r},this.getTree=function(){return a},n&&void 0!==n||(n={}),OGX.Data.merge(n,i),n.list.hasOwnProperty("insert")||(n.list=new OGX.List(n.list)),$(n.el).addClass("ogx_treedlist"),o()},OGX.TreedList.NAME="TreedList",require("Uxi","Overlay","Loading"),OGX.Uxi=function(t){construct(this,"Uxi"),this.el=null,this.id=null,this.sleeping=!1,this.blured=!0,this.floating=!1,this.scroll=!1,this.scroller=null,this.enabled=!1,this.always_on=!1,this.nodes=new OGX.List,this.points={},this.observer=!1,this.parent=null,this.floats=null,this.group=null,this.always_on=null,this.scroll=null,this.selector=null,this.title=null,config_default={id:(new Date).getTime()+""+Math.round(1e3*Math.random()),title:"",enabled:!0,always_on:!1,scroll:!1,el:!1,css:""},void 0===t&&(t={}),OGX.Data.merge(t,config_default,!1),OGX.Data.merge(this,t,!0,!1,!0);var e="#"===this.id.substr(0,1);if(e&&(this.id=this.id.substr(1)),this.selector='.ogx_uxi[data-ogx-id="'+this.id+'"]',t.el){var i=$(t.el),n="ogx_uxi "+t.css,a='<div class="'+n+'" data-ogx-id="'+this.id+'"';if(e&&(a+=' id="'+this.id+'"'),a+="></div>",t.scroll){this.scroller=this.create("Scroller",{id:this.id+"_scroller",el:t.el}),t.el='.ogx_uxi[data-ogx-id="'+this.id+'_scroller"] > .ogx_scroller_inner',(i=$(t.el)).addClass(n).attr("data-ogx-id",this.id),e&&i.attr("id",this.id);var r=this;setTimeout((function(){r.scroller.resize()}),0)}else i.append(a),t.el='.ogx_uxi[data-ogx-id="'+this.id+'"]'}},OGX.Uxi.prototype.enable=function(){return this},OGX.Uxi.prototype.disable=function(){return this},OGX.Uxi.prototype.ux=function(){},OGX.Uxi.prototype.construct=function(){},OGX.Uxi.prototype.destroy=function(){},OGX.Uxi.prototype.resize=function(){return this},OGX.Uxi.prototype.show=function(){return this.el&&this.el.removeClass("ogx_uxi_hide"),this},OGX.Uxi.prototype.hide=function(){return this.el&&this.el.addClass("ogx_uxi_hide"),this},OGX.Uxi.prototype.render=function(t,e){return OGX.OML.render(this,t,e),this},OGX.Uxi.prototype.empty=function(){return this.clear(),this},OGX.Uxi.prototype.observe=function(t,e,i,n,a){var r=this,o=this.el,s=null;if(void 0!==a&&(o=a),t){if(!this.observer)return void 0===e&&(e={childList:!0,subtree:!0}),this.observer=new MutationObserver((function(t,e){t.forEach((function(t){s&&clearTimeout(s),s=setTimeout((()=>{void 0!==i?i(t,n):r.el.trigger(OGX.View.CHANGED,t)}),10)}))})),this.observer.observe(o[0],e),!0}else if(this.observer)return this.observer.disconnect(),this.observer=null,!0;return!1},OGX.Uxi.prototype.sleep=function(){return this.sleeping||(this.blur(2),this.sleeping=!0,this.scroll?(this.__parent=this.el.parent(".ogx_scroller_outer").first().parent(0),this.el=this.__parent.children(".ogx_scroller_outer").first().detach()):(this.__parent=this.el.parent(0),this.el=this.el.detach())),this},OGX.Uxi.prototype.wake=function(t){return t=void 0===t?this.__parent:$(t),this.sleeping&&(this.sleeping=!1,t.prepend(this.el),this.el=t.find('.ogx_uxi[data-ogx-id="'+this.id+'"]'),this.focus(2),delete this.__parent),this},OGX.Uxi.prototype.detach=function(){return this.sleep(),this.parent.nodes.findDelete("id",this.id,1),this},OGX.Uxi.prototype.attach=function(t,e){return this.parent=t,this.parent.nodes.insert(this),this.wake(e),setTimeout((()=>this.resizeNodes),0),this},OGX.Uxi.prototype.resizeNodes=function(){for(var t=this.gather(),e=0;e<t.length;e++)t[e].resize();return this},OGX.Uxi.prototype.kill=function(){OGX.Object.destroy(this)},OGX.Uxi.prototype.reveal=function(t){var e=this.path();if(e){for(var i=0;i<e.length;i++)i>0&&e[i]._NAME_===OGX.Carousel.NAME&&e[i-1]._NAME_===OGX.Container.NAME||(e[i].floating?e[i].show(t):e[i].show(this._NAME_,this.id));return this}},OGX.Uxi.prototype.focus=function(t){if(void 0===t&&(t=1),this.blured)switch(this.blured=!1,this.enabled&&(this.ux(!0),this.enable()),t){case 1:this.focusNodes();break;case 2:this.focusTree()}return this},OGX.Uxi.prototype.focusTree=function(){for(var t=this.gather(),e=0;e<t.length;e++)"function"==typeof t[e].focus&&t[e].focus(0);return this},OGX.Uxi.prototype.focusNodes=function(){for(var t=0;t<this.nodes.length;t++)"function"==typeof this.nodes[t].focus&&this.nodes[t].focus(1);return this},OGX.Uxi.prototype.blur=function(t){if(void 0===t&&(t=1),!this.always_on&&!this.blured)switch(this.blured=!0,this.ux(!1),this.disable(),t){case 1:this.blurNodes();break;case 2:this.blurTree()}return this},OGX.Uxi.prototype.blurTree=function(){for(var t=this.gather(),e=0;e<t.length;e++)"function"==typeof t[e].blur&&t[e].blur(0);return this},OGX.Uxi.prototype.blurNodes=function(){for(var t=0;t<this.nodes.length;t++)"function"==typeof this.nodes[t].blur&&this.nodes[t].blur(1);return this},OGX.Uxi.prototype.path=function(){for(var t=new OGX.List,e=this;e&&e.hasOwnProperty("parent");)t.insert(e,0),e=e.parent;return t.shift(),t},OGX.Uxi.prototype.gather=function(t){var e=[],i={_NAME_:{eq:""}};return void 0!==t&&(Array.isArray(t)?i={_NAME_:{regex:new RegExp(t.join("|"))}}:-1!==t.indexOf(".")?(comp=t.split("."),i={_NAME_:{regex:new RegExp(comp[0].slice(0,-1))},_CLASS_:{eq:comp[1]}}):i={_NAME_:{regex:new RegExp(t)}}),function t(n){if(void 0!==n&&void 0!==n.nodes&&n.nodes.length){var a=n.nodes.get(i);a&&(e=e.concat(a));for(var r=0;r<n.nodes.length;r++)void 0!==n.nodes[r]&&void 0!==n.nodes[r].nodes&&n.nodes[r].nodes.length&&(a=t(n.nodes[r]))&&a.length&&(e=e.concat(a[0]))}}(this),new OGX.List(e)},OGX.Uxi.prototype.cfind=function(t,e,i){var n={};void 0!==e&&e&&(e instanceof RegExp?n.id={regex:e}:n.id={eq:e}),t&&(n._NAME_={eq:t}),void 0===i&&(i=1);var a=OGX.Object.get(n,null,i);return(1===i||!!a.length)&&a},OGX.Uxi.prototype.find=function(t,e,i){void 0===i&&(i=!1);var n={};if(typeof e==typeof t==="undefined")return!1;return void 0!==e&&e&&(e instanceof RegExp?n.id={regex:e}:n.id={eq:e}),void 0!==t&&(n._NAME_={eq:t}),function t(e){var a;if(void 0!==e.nodes&&e.nodes.length){if(a=e.nodes.get(n,null,1)){if(i)switch(i){case"remove":return a.kill(),a}return a}for(var r=0;r<e.nodes.length;r++)if(a=t(e.nodes[r]))return a}return!1}(this)},OGX.Uxi.prototype.children=function(t,e){isNaN(t)||void 0!==e||(e=t,t=null),void 0===e&&(e=0);var i={};return void 0!==t&&t&&(i._NAME_={eq:t}),this.nodes.get(i,null,e)},OGX.Uxi.prototype.parents=function(t,e){isNaN(t)||void 0!==e||(e=t,t=null),void 0===e&&(e=0);var i=function i(n){var a=[];if("App"!==n._NAME_&&n.parent){if(n.parent._NAME_===t&&(a.push(n.parent),e&&a.length===e&&1===e))return a;var r=i(n.parent);return r.length&&(a=a.concat(r)),a}return[]}(this);return 1===e&&i.length?i[0]:new OGX.List(i)},OGX.Uxi.prototype.clear=function(){for(var t=this.gather(),e=0;e<t.length;e++)OGX.Object.destroy(t[e],!1);return this.nodes=new OGX.List,this},OGX.Uxi.prototype.add=function(t){t.parent=this,this.nodes.insert(t)},OGX.Uxi.prototype.remove=function(t,e){return this.find(t,e,"remove")},OGX.Uxi.prototype.create=function(t,e){"undefined"==typeof __construct&&(__construct=!0);var i=Array.prototype.slice.call(arguments),n=[];e.hasOwnProperty("data")&&n.push(e.data),n=n.concat(i.splice(0,3)),void 0!==OGX[t]&&OGX[t].hasOwnProperty("FLOAT")&&OGX[t].FLOAT&&(e.parent=this,e.el=this.el[0]);var a=OGX.Object.create(t,e);return this.add(a),"function"==typeof a.construct&&a.construct.apply(a,n),e.hasOwnProperty("node:OML")&&OGX.OML.render(a,e["node:OML"]),a.focus(),a},OGX.Uxi.prototype.parse=function(t){t=OGX.OML.parse(t),OGX.OML.render(this,t)},OGX.Uxi.prototype.topIndex=function(){var t,e=0;return this.el.find("*").each((function(i,n){t=$(n).css("z-index"),t=Number(t),isNaN(t)||t>e&&(e=t)})),e+1},OGX.Uxi.prototype.stage=function(){return function t(e){if(e.parent)return e.parent._NAME_!==OGX.Stage.NAME?t(e.parent):e.parent}(this)},OGX.Uxi.prototype.on=function(){this.el&&this.el.on.apply(this.el,arguments)},OGX.Uxi.prototype.off=function(){this.el&&this.el.off.apply(this.el,arguments)},require("View","Uxi","Placeholder","Touch"),OGX.View=function(t){construct(this,"View");var e=this,i=!1,n=t;this.el=null,this._CLASS_=t._sub_,this._NAME_=OGX.View.NAME,delete t._sub_,this.enable=function(){return n.observe&&this.observe(!0),this},this.disable=function(){return n.observe&&this.observe(!1),this},this.container=function(){return i},this.render=function(t){return void 0===t?n.hasOwnProperty("html")&&n.html&&i.html(n.html):i.html(t),i.trigger(OGX.View.RENDER),this},function(){e.el=i=$(n.el);var a=new OGX.Display(t);n.html=a.html(t.data),i.addClass("ogx_view ogx_hw"),e.render()}()},OGX.View.NAME="View",OGX.View.CHANGED="ViewChanged",OGX.View.RENDER="ViewRender",require("Window","Uxi","Placeholder","Touch","Resize"),OGX.Window=function(__config){construct(this,"Window");var that=this,container=!1,config_default={anim:!1,resize:!1,drag:!0,show:!1,width:"100%",height:"100%",min_width:100,min_height:100,max_width:0,max_height:0,head:OGX.Window.HEAD_BACK,icons:[],title:"",win_html:'<div class="ogx_window_head ogx_window_head_{{$head}} ogx_window_head_{{$side}}">$INNER</div><div class="ogx_window_body">{{$html}}</div>',win_inner:['<span class="ogx_window_main_{{$head}} ogx_window_main_icon"></span>','<span class="ogx_window_title">{{$title}}</span>','<span class="ogx_window_icons">$ICONS</span>'],zindex:!1,close_on_click_out:!1,close_dist:100,parent:null},config=__config,pt={x:null,y:null},dir={x:0,y:0},showto=50,user_resized=!1,zd;function genIcons(){for(var t="",e=0;e<config.icons.length;e++)t+='<div class="ogx_window_icon" style="background-image:url(\''+("string"==typeof config.icons[e]?config.icons[e]:config.icons[e].icon)+"')\"></div>";return t}function listenBackIcon(t){t?that.el.on(that.touch.down,".ogx_window_main_back",onBack):that.el.off(that.touch.down,".ogx_window_main_back",onBack)}function onBack(t){t.preventDefault(),t.stopImmediatePropagation(),that.el.trigger(OGX.Window.HIT_BACK,that),that.hide()}function listenIcons(t){t?that.el.on(that.touch.down,".ogx_window_icon",onIcon):that.el.off(that.touch.down,".ogx_window_icon",onIcon)}function onIcon(t){t.preventDefault(),t.stopImmediatePropagation();var e=$(this).index();if("string"==typeof config.icons[e])that.el.trigger(OGX.Window.HIT_ICON,{index:e,id:config.id});else{var i=e;config.icons[e].hasOwnProperty("callback")&&config.icons[e].callback&&(config.icons[e].hasOwnProperty("params")&&(i=config.icons[e].params),config.icons[e].callback.call(null,i))}}function onDrag(t){(t.distX*dir.x>config.close_dist||t.distY*dir.y>config.close_dist)&&that.hide()}function onRelease(t){t.distX*dir.x>config.close_dist||t.distY*dir.y>config.close_dist?that.hide():(t.distX||t.distY)&&(config.anim&&(that.el.addClass("ogx_window_anim_in"),that.el.on("transitionend",(function(){that.el.off("transitionend"),that.el.removeClass("ogx_window_anim_in")}))),that.el.css("transform","translate3d("+pt.x+"px, "+pt.y+"px, 0px)"))}function render(){var t=prepWindow();container.html(t),zd=config.zindex?config.zindex:config.parent.topIndex();var e=getLimitedSize();container.css({width:e.width,height:e.height,"z-index":zd})}function getLimitedSize(){var t,e,i,n=config.parent.el.width(),a=config.parent.el.height();user_resized?(n=config.width,a=config.height):(t=OGX.Data.getBestSize(n,config.width),e=OGX.Data.getBestSize(a,config.height));var r={width:t,height:e};return(config.min_width||config.max_width)&&(-1!==config.width.indexOf("%")?(n=config.parent.el.width(),i=Number(config.width.split("%")[0])*n/100,config.min_width&&i<config.min_width?r.width=config.min_width+"px":config.max_width&&i>config.max_width&&(r.width=config.max_width+"px")):(-1!==(i=config.width).indexOf("px")&&(i=Number(i.split("px")[0])),config.min_width&&i<config.min_width?r.width=config.min_width+"px":config.max_width&&i>config.max_width&&(r.width=config.max_width+"px"))),(config.min_height||config.max_height)&&(-1!==config.height.indexOf("%")?(a=config.parent.el.height(),i=Number(config.height.split("%")[0])*a/100,config.min_height&&i<config.min_height?r.height=config.min_height+"px":config.max_height&&i>config.max_height&&(r.height=config.max_height+"px")):(-1!==(i=config.height).indexOf("px")&&(i=Number(i.split("px")[0])),config.min_height&&i<config.min_height?r.height=config.min_height+"px":config.max_height&&i>config.max_height&&(r.height=config.max_height+"px"))),r}function listenBody(t){t?that.parent.el.on(that.touch.down,".ogx_overlay",onBody):that.parent.el.off(that.touch.down,".ogx_overlay",onBody)}function onBody(t){that.status===OGX.Window.OPEN&&(that.hide(),that.parent.removeOverlay(OGX.Overlay.Fade))}function animWindow(t,e,i,n){void 0===e&&(e=config.anim);var a={opac:1,tX:0,tY:0},r=container.parent().width(),o=container.parent().height(),s=that.el.outerWidth(),l=that.el.outerHeight(),c=that.el.find(".ogx_window_main_icon").first();switch(t&&(placeWindow(!0),c.removeClass("ogx_window_main_icon_left ogx_window_main_icon_right ogx_window_main_icon_top")),e){case OGX.Window.ANIM_NONE:break;case OGX.Window.ANIM_TOP:t?(a.tY=0,c.addClass("ogx_window_main_icon_top")):a.tY=-l-10;break;case OGX.Window.ANIM_BOTTOM:t?(a.tY=0,c.addClass("ogx_window_main_icon_bottom")):a.tY=o+10;break;case OGX.Window.ANIM_RIGHT:t?(a.tX=r-s,c.addClass("ogx_window_main_icon_right")):a.tX=r+10;break;case OGX.Window.ANIM_LEFT:t?(a.tX=0,c.addClass("ogx_window_main_icon_left")):a.tX=-s-10}var d=100;t?(pt.x=a.tX,pt.y=a.tY):d=0,setTimeout((function(){dir.x,that.el.on("transitionend",(function(){that.el.off("transitionend"),t?that.el.removeClass("ogx_window_anim_in").addClass("ogx_window_open"):that.el.removeClass("ogx_window_anim_out ogx_window_open"),"function"==typeof i&&i(n),t?(that.status=OGX.Window.OPEN,that.el.trigger(OGX.Window.OPEN,that)):(that.status=OGX.Window.CLOSED,that.el.trigger(OGX.Window.CLOSED,that))})),t?(that.status=OGX.Window.OPENING,that.el.trigger(OGX.Window.OPENING,that)):(that.status=OGX.Window.CLOSING,that.el.trigger(OGX.Window.CLOSING,that)),config.anim!==OGX.Window.ANIM_NONE&&(t?that.el.addClass("ogx_window_anim_in"):that.el.addClass("ogx_window_anim_out")),that.el.css({transform:"translate3d("+a.tX+"px, "+a.tY+"px, 0px)",opacity:a.opac,visibility:"visible"})}),d)}function placeWindow(t){var e=container.parent().width(),i=container.parent().height(),n=that.el.outerHeight(),a=that.el.outerWidth();that.el.removeClass("ogx_window_anim_in").removeClass("ogx_window_anim_out");var r={x:0,y:0};switch(config.anim){case OGX.Window.ANIM_TOP:r.y=t?-n:n,dir.y=-1;break;case OGX.Window.ANIM_BOTTOM:r.y=t?i:i-n,dir.y=1;break;case OGX.Window.ANIM_RIGHT:r.x=t?e:e-a,dir.x=1;break;case OGX.Window.ANIM_LEFT:t&&(r.x=-a),dir.x=-1}that.el.css({transform:"translate3d("+r.x+"px, "+r.y+"px, 0px)"})}function prepWindow(){var t=new OGX.Display(config),e={};e.head=config.head,e.title=config.title,e.icons=config.icons,e.html=t.html();var i=config.win_html,n="";switch(config.anim){case OGX.Window.ANIM_RIGHT:case OGX.Window.ANIM_TOP:case OGX.Window.ANIM_BOTTOM:n=config.win_inner,e.side="right";break;case OGX.Window.ANIM_LEFT:n=config.win_inner.reverse(),e.side="left"}n=n.toString().replace(/>,</g,"><"),i=i.replace("$INNER",n);var a="";return config.icons&&config.icons.length&&(a=genIcons()),i=i.replace("$ICONS",a),OGX.Templater.make(i,e)}function onResize(){user_resized=!0,that.resizeNodes()}function listenScroll(t){t?(that.el.on(OGX.Scroller.START,(function(){that.disable()})),that.el.on(OGX.Scroller.END,(function(){that.enable()}))):(that.el.off(OGX.Scroller.START),that.el.off(OGX.Scroller.END))}function initPlaceholders(){that.placeholders(config,['.ogx_window[data-ogx-id="'+that.id+'"] > .ogx_window_body'])}function initDefaults(){OGX.Data.merge(config,app.getDefaults("windows")),OGX.Data.merge(config,config_default),-1!==config.head.indexOf(".")&&(config.head=eval(config.head)),-1!==config.anim.indexOf(".")&&(config.anim=eval(config.anim)),that.el=container=$(config.el),container.addClass("ogx_window"),that.dragable=config.drag,that.resizable=config.resize}function init(){if(initDefaults(),render(),initPlaceholders(),placeWindow(!0),config.drag){var t={},e={top:!1,bottom:!1,left:!1,right:!1,cb_resize:onResize};switch(e.min_width=config.min_width,e.min_height=config.min_width,e.max_width=config.max_width,e.max_height=config.max_height,t.cb_drag=onDrag,t.cb_up=onRelease,config.anim){case OGX.Window.ANIM_LEFT:t.x=!0,t.y=!1,t.limit_x={min:-300,max:0},e.right=!0;break;case OGX.Window.ANIM_RIGHT:t.x=!0,t.y=!1,t.limit_x={min:0,max:300},e.left=!0;break;case OGX.Window.ANIM_TOP:t.x=!1,t.y=!0,t.limit_y={min:-300,max:0},e.bottom=!0;break;case OGX.Window.ANIM_BOTTOM:t.x=!1,t.y=!0,t.limit_y={min:0,max:300},e.top=!0}that.touch.drag.set(t)}config.resize&&that.setResize(e),config.show&&that.show(),listenScroll(!0)}this.el=null,this._NAME_=OGX.Window.NAME,this.id=config.id,this.dragable=null,this.resizeable=null,this.status=OGX.Window.CLOSED,this.enable=function(){return config.close_on_click_out&&listenBody(!0),config.head&&listenBackIcon(!0),config.icons&&listenIcons(!0),config.drag&&this.touch.enable(),config.resize&&this.enableResize(),this},this.disable=function(){return config.close_on_click_out&&listenBody(!1),config.head&&listenBackIcon(!1),config.icons&&listenIcons(!1),config.drag&&this.touch.disable(),config.resize&&this.disableResize(),this},this.show=function(t,e,i){return-1===[OGX.Window.OPEN,OGX.Window.OPENING].indexOf(this.status)&&(this.focus(1),this.front(),null==t&&(t=config.anim),setTimeout((function(){animWindow(!0,t,e,i)}),showto),showto&&(showto=0)),this},this.hide=function(t,e,i){return-1===[OGX.Window.CLOSED,OGX.Window.CLOSING].indexOf(this.status)&&(this.blur(1),void 0!==t&&!0!==t||(t=config.anim),animWindow(!1,t,e,i)),this},this.resize=function(){var t=getLimitedSize();return container.css({width:t.width,height:t.height}),this.place(),this},this.destroy=function(){config.drag&&this.touch.disable(),listenScroll(!1)},this.icons=function(t){if(void 0===t)return config.icons;config.icons&&config.icons.length&&listenIcons(!1),config.icons=t,this.el.find(".ogx_window_icons").first().html(genIcons()),listenIcons(!0)},this.front=function(){return zd=config.parent.topIndex(),this.el.css("z-index",zd),this},this.place=function(){placeWindow(this.status===OGX.Window.CLOSED)},this.drag=function(t){t?config.drag||(this.touch.enable(),config.drag=this.dragable=!0):config.drag&&(this.touch.disable(),config.drag=this.dragable=!1)},init()},OGX.Window.NAME="Window",OGX.Window.READY="WindowReady",OGX.Window.ANIM_LEFT="left",OGX.Window.ANIM_RIGHT="right",OGX.Window.ANIM_TOP="top",OGX.Window.ANIM_BOTTOM="bottom",OGX.Window.ANIM_NONE="none",OGX.Window.HEAD_BACK="back",OGX.Window.HEAD_CLOSE="close",OGX.Window.HEAD_NONE="none",OGX.Window.CLOSING="WindowClosing",OGX.Window.CLOSED="WindowClosed",OGX.Window.OPENING="WindowOpening",OGX.Window.OPEN="WindowOpen",OGX.Window.HIT_ICON="WindowHitIcon",OGX.Window.HIT_BACK="WindowHitBack",OGX.Window.FLOAT=!0,String.prototype.hasOwnProperty("substr")||(String.prototype.substr=function(t,e){return t<0&&(t=this.length-t),this.slice(t,t+e)});
|