(function webpackUniversalModuleDefinition(root, factory){
if(typeof exports==='object'&&typeof module==='object')
module.exports=factory();
else if(typeof define==='function'&&define.amd)
define([], factory);
else if(typeof exports==='object')
exports["Handlebars"]=factory();
else
root["Handlebars"]=factory();
})(this, function(){
return  (function(modules){
var installedModules={};
function __webpack_require__(moduleId){
if(installedModules[moduleId])
return installedModules[moduleId].exports;
var module=installedModules[moduleId]={
exports: {},
id: moduleId,
loaded: false
};
modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
module.loaded=true;
return module.exports;
}
__webpack_require__.m=modules;
__webpack_require__.c=installedModules;
__webpack_require__.p="";
return __webpack_require__(0);
})
([
(function(module, exports, __webpack_require__){
'use strict';
var _interopRequireDefault=__webpack_require__(1)['default'];
exports.__esModule=true;
var _handlebarsRuntime=__webpack_require__(2);
var _handlebarsRuntime2=_interopRequireDefault(_handlebarsRuntime);
var _handlebarsCompilerAst=__webpack_require__(45);
var _handlebarsCompilerAst2=_interopRequireDefault(_handlebarsCompilerAst);
var _handlebarsCompilerBase=__webpack_require__(46);
var _handlebarsCompilerCompiler=__webpack_require__(51);
var _handlebarsCompilerJavascriptCompiler=__webpack_require__(52);
var _handlebarsCompilerJavascriptCompiler2=_interopRequireDefault(_handlebarsCompilerJavascriptCompiler);
var _handlebarsCompilerVisitor=__webpack_require__(49);
var _handlebarsCompilerVisitor2=_interopRequireDefault(_handlebarsCompilerVisitor);
var _handlebarsNoConflict=__webpack_require__(44);
var _handlebarsNoConflict2=_interopRequireDefault(_handlebarsNoConflict);
var _create=_handlebarsRuntime2['default'].create;
function create(){
var hb=_create();
hb.compile=function (input, options){
return _handlebarsCompilerCompiler.compile(input, options, hb);
};
hb.precompile=function (input, options){
return _handlebarsCompilerCompiler.precompile(input, options, hb);
};
hb.AST=_handlebarsCompilerAst2['default'];
hb.Compiler=_handlebarsCompilerCompiler.Compiler;
hb.JavaScriptCompiler=_handlebarsCompilerJavascriptCompiler2['default'];
hb.Parser=_handlebarsCompilerBase.parser;
hb.parse=_handlebarsCompilerBase.parse;
hb.parseWithoutProcessing=_handlebarsCompilerBase.parseWithoutProcessing;
return hb;
}
var inst=create();
inst.create=create;
_handlebarsNoConflict2['default'](inst);
inst.Visitor=_handlebarsCompilerVisitor2['default'];
inst['default']=inst;
exports['default']=inst;
module.exports=exports['default'];
}),
(function(module, exports){
"use strict";
exports["default"]=function (obj){
return obj&&obj.__esModule ? obj:{
"default": obj
};};
exports.__esModule=true;
}),
(function(module, exports, __webpack_require__){
'use strict';
var _interopRequireWildcard=__webpack_require__(3)['default'];
var _interopRequireDefault=__webpack_require__(1)['default'];
exports.__esModule=true;
var _handlebarsBase=__webpack_require__(4);
var base=_interopRequireWildcard(_handlebarsBase);
var _handlebarsSafeString=__webpack_require__(37);
var _handlebarsSafeString2=_interopRequireDefault(_handlebarsSafeString);
var _handlebarsException=__webpack_require__(6);
var _handlebarsException2=_interopRequireDefault(_handlebarsException);
var _handlebarsUtils=__webpack_require__(5);
var Utils=_interopRequireWildcard(_handlebarsUtils);
var _handlebarsRuntime=__webpack_require__(38);
var runtime=_interopRequireWildcard(_handlebarsRuntime);
var _handlebarsNoConflict=__webpack_require__(44);
var _handlebarsNoConflict2=_interopRequireDefault(_handlebarsNoConflict);
function create(){
var hb=new base.HandlebarsEnvironment();
Utils.extend(hb, base);
hb.SafeString=_handlebarsSafeString2['default'];
hb.Exception=_handlebarsException2['default'];
hb.Utils=Utils;
hb.escapeExpression=Utils.escapeExpression;
hb.VM=runtime;
hb.template=function (spec){
return runtime.template(spec, hb);
};
return hb;
}
var inst=create();
inst.create=create;
_handlebarsNoConflict2['default'](inst);
inst['default']=inst;
exports['default']=inst;
module.exports=exports['default'];
}),
(function(module, exports){
"use strict";
exports["default"]=function (obj){
if(obj&&obj.__esModule){
return obj;
}else{
var newObj={};
if(obj!=null){
for (var key in obj){
if(Object.prototype.hasOwnProperty.call(obj, key)) newObj[key]=obj[key];
}}
newObj["default"]=obj;
return newObj;
}};
exports.__esModule=true;
}),
(function(module, exports, __webpack_require__){
'use strict';
var _interopRequireDefault=__webpack_require__(1)['default'];
exports.__esModule=true;
exports.HandlebarsEnvironment=HandlebarsEnvironment;
var _utils=__webpack_require__(5);
var _exception=__webpack_require__(6);
var _exception2=_interopRequireDefault(_exception);
var _helpers=__webpack_require__(10);
var _decorators=__webpack_require__(30);
var _logger=__webpack_require__(32);
var _logger2=_interopRequireDefault(_logger);
var _internalProtoAccess=__webpack_require__(33);
var VERSION='4.7.7';
exports.VERSION=VERSION;
var COMPILER_REVISION=8;
exports.COMPILER_REVISION=COMPILER_REVISION;
var LAST_COMPATIBLE_COMPILER_REVISION=7;
exports.LAST_COMPATIBLE_COMPILER_REVISION=LAST_COMPATIBLE_COMPILER_REVISION;
var REVISION_CHANGES={
1: '<=1.0.rc.2',
2: '==1.0.0-rc.3',
3: '==1.0.0-rc.4',
4: '==1.x.x',
5: '==2.0.0-alpha.x',
6: '>=2.0.0-beta.1',
7: '>=4.0.0 <4.3.0',
8: '>=4.3.0'
};
exports.REVISION_CHANGES=REVISION_CHANGES;
var objectType='[object Object]';
function HandlebarsEnvironment(helpers, partials, decorators){
this.helpers=helpers||{};
this.partials=partials||{};
this.decorators=decorators||{};
_helpers.registerDefaultHelpers(this);
_decorators.registerDefaultDecorators(this);
}
HandlebarsEnvironment.prototype={
constructor: HandlebarsEnvironment,
logger: _logger2['default'],
log: _logger2['default'].log,
registerHelper: function registerHelper(name, fn){
if(_utils.toString.call(name)===objectType){
if(fn){
throw new _exception2['default']('Arg not supported with multiple helpers');
}
_utils.extend(this.helpers, name);
}else{
this.helpers[name]=fn;
}},
unregisterHelper: function unregisterHelper(name){
delete this.helpers[name];
},
registerPartial: function registerPartial(name, partial){
if(_utils.toString.call(name)===objectType){
_utils.extend(this.partials, name);
}else{
if(typeof partial==='undefined'){
throw new _exception2['default']('Attempting to register a partial called "' + name + '" as undefined');
}
this.partials[name]=partial;
}},
unregisterPartial: function unregisterPartial(name){
delete this.partials[name];
},
registerDecorator: function registerDecorator(name, fn){
if(_utils.toString.call(name)===objectType){
if(fn){
throw new _exception2['default']('Arg not supported with multiple decorators');
}
_utils.extend(this.decorators, name);
}else{
this.decorators[name]=fn;
}},
unregisterDecorator: function unregisterDecorator(name){
delete this.decorators[name];
},
resetLoggedPropertyAccesses: function resetLoggedPropertyAccesses(){
_internalProtoAccess.resetLoggedProperties();
}};
var log=_logger2['default'].log;
exports.log=log;
exports.createFrame=_utils.createFrame;
exports.logger=_logger2['default'];
}),
(function(module, exports){
'use strict';
exports.__esModule=true;
exports.extend=extend;
exports.indexOf=indexOf;
exports.escapeExpression=escapeExpression;
exports.isEmpty=isEmpty;
exports.createFrame=createFrame;
exports.blockParams=blockParams;
exports.appendContextPath=appendContextPath;
var escape={
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
"'": '&#x27;',
'`': '&#x60;',
'=': '&#x3D;'
};
var badChars=/[&<>"'`=]/g,
possible=/[&<>"'`=]/;
function escapeChar(chr){
return escape[chr];
}
function extend(obj ){
for (var i=1; i < arguments.length; i++){
for (var key in arguments[i]){
if(Object.prototype.hasOwnProperty.call(arguments[i], key)){
obj[key]=arguments[i][key];
}}
}
return obj;
}
var toString=Object.prototype.toString;
exports.toString=toString;
var isFunction=function isFunction(value){
return typeof value==='function';
};
if(isFunction(/x/)){
exports.isFunction=isFunction=function (value){
return typeof value==='function'&&toString.call(value)==='[object Function]';
};}
exports.isFunction=isFunction;
var isArray=Array.isArray||function (value){
return value&&typeof value==='object' ? toString.call(value)==='[object Array]':false;
};
exports.isArray=isArray;
function indexOf(array, value){
for (var i=0, len=array.length; i < len; i++){
if(array[i]===value){
return i;
}}
return -1;
}
function escapeExpression(string){
if(typeof string!=='string'){
if(string&&string.toHTML){
return string.toHTML();
}else if(string==null){
return '';
}else if(!string){
return string + '';
}
string='' + string;
}
if(!possible.test(string)){
return string;
}
return string.replace(badChars, escapeChar);
}
function isEmpty(value){
if(!value&&value!==0){
return true;
}else if(isArray(value)&&value.length===0){
return true;
}else{
return false;
}}
function createFrame(object){
var frame=extend({}, object);
frame._parent=object;
return frame;
}
function blockParams(params, ids){
params.path=ids;
return params;
}
function appendContextPath(contextPath, id){
return (contextPath ? contextPath + '.':'') + id;
}
}),
(function(module, exports, __webpack_require__){
'use strict';
var _Object$defineProperty=__webpack_require__(7)['default'];
exports.__esModule=true;
var errorProps=['description', 'fileName', 'lineNumber', 'endLineNumber', 'message', 'name', 'number', 'stack'];
function Exception(message, node){
var loc=node&&node.loc,
line=undefined,
endLineNumber=undefined,
column=undefined,
endColumn=undefined;
if(loc){
line=loc.start.line;
endLineNumber=loc.end.line;
column=loc.start.column;
endColumn=loc.end.column;
message +=' - ' + line + ':' + column;
}
var tmp=Error.prototype.constructor.call(this, message);
for (var idx=0; idx < errorProps.length; idx++){
this[errorProps[idx]]=tmp[errorProps[idx]];
}
if(Error.captureStackTrace){
Error.captureStackTrace(this, Exception);
}
try {
if(loc){
this.lineNumber=line;
this.endLineNumber=endLineNumber;
if(_Object$defineProperty){
Object.defineProperty(this, 'column', {
value: column,
enumerable: true
});
Object.defineProperty(this, 'endColumn', {
value: endColumn,
enumerable: true
});
}else{
this.column=column;
this.endColumn=endColumn;
}}
} catch (nop){
}}
Exception.prototype=new Error();
exports['default']=Exception;
module.exports=exports['default'];
}),
(function(module, exports, __webpack_require__){
module.exports={ "default": __webpack_require__(8), __esModule: true };
}),
(function(module, exports, __webpack_require__){
var $=__webpack_require__(9);
module.exports=function defineProperty(it, key, desc){
return $.setDesc(it, key, desc);
};
}),
(function(module, exports){
var $Object=Object;
module.exports={
create:     $Object.create,
getProto:   $Object.getPrototypeOf,
isEnum:     {}.propertyIsEnumerable,
getDesc:    $Object.getOwnPropertyDescriptor,
setDesc:    $Object.defineProperty,
setDescs:   $Object.defineProperties,
getKeys:    $Object.keys,
getNames:   $Object.getOwnPropertyNames,
getSymbols: $Object.getOwnPropertySymbols,
each:       [].forEach
};
}),
(function(module, exports, __webpack_require__){
'use strict';
var _interopRequireDefault=__webpack_require__(1)['default'];
exports.__esModule=true;
exports.registerDefaultHelpers=registerDefaultHelpers;
exports.moveHelperToHooks=moveHelperToHooks;
var _helpersBlockHelperMissing=__webpack_require__(11);
var _helpersBlockHelperMissing2=_interopRequireDefault(_helpersBlockHelperMissing);
var _helpersEach=__webpack_require__(12);
var _helpersEach2=_interopRequireDefault(_helpersEach);
var _helpersHelperMissing=__webpack_require__(25);
var _helpersHelperMissing2=_interopRequireDefault(_helpersHelperMissing);
var _helpersIf=__webpack_require__(26);
var _helpersIf2=_interopRequireDefault(_helpersIf);
var _helpersLog=__webpack_require__(27);
var _helpersLog2=_interopRequireDefault(_helpersLog);
var _helpersLookup=__webpack_require__(28);
var _helpersLookup2=_interopRequireDefault(_helpersLookup);
var _helpersWith=__webpack_require__(29);
var _helpersWith2=_interopRequireDefault(_helpersWith);
function registerDefaultHelpers(instance){
_helpersBlockHelperMissing2['default'](instance);
_helpersEach2['default'](instance);
_helpersHelperMissing2['default'](instance);
_helpersIf2['default'](instance);
_helpersLog2['default'](instance);
_helpersLookup2['default'](instance);
_helpersWith2['default'](instance);
}
function moveHelperToHooks(instance, helperName, keepHelper){
if(instance.helpers[helperName]){
instance.hooks[helperName]=instance.helpers[helperName];
if(!keepHelper){
delete instance.helpers[helperName];
}}
}
}),
(function(module, exports, __webpack_require__){
'use strict';
exports.__esModule=true;
var _utils=__webpack_require__(5);
exports['default']=function (instance){
instance.registerHelper('blockHelperMissing', function (context, options){
var inverse=options.inverse,
fn=options.fn;
if(context===true){
return fn(this);
}else if(context===false||context==null){
return inverse(this);
}else if(_utils.isArray(context)){
if(context.length > 0){
if(options.ids){
options.ids=[options.name];
}
return instance.helpers.each(context, options);
}else{
return inverse(this);
}}else{
if(options.data&&options.ids){
var data=_utils.createFrame(options.data);
data.contextPath=_utils.appendContextPath(options.data.contextPath, options.name);
options={ data: data };}
return fn(context, options);
}});
};
module.exports=exports['default'];
}),
(function(module, exports, __webpack_require__){
(function(global){'use strict';
var _Object$keys=__webpack_require__(13)['default'];
var _interopRequireDefault=__webpack_require__(1)['default'];
exports.__esModule=true;
var _utils=__webpack_require__(5);
var _exception=__webpack_require__(6);
var _exception2=_interopRequireDefault(_exception);
exports['default']=function (instance){
instance.registerHelper('each', function (context, options){
if(!options){
throw new _exception2['default']('Must pass iterator to #each');
}
var fn=options.fn,
inverse=options.inverse,
i=0,
ret='',
data=undefined,
contextPath=undefined;
if(options.data&&options.ids){
contextPath=_utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.';
}
if(_utils.isFunction(context)){
context=context.call(this);
}
if(options.data){
data=_utils.createFrame(options.data);
}
function execIteration(field, index, last){
if(data){
data.key=field;
data.index=index;
data.first=index===0;
data.last = !!last;
if(contextPath){
data.contextPath=contextPath + field;
}}
ret=ret + fn(context[field], {
data: data,
blockParams: _utils.blockParams([context[field], field], [contextPath + field, null])
});
}
if(context&&typeof context==='object'){
if(_utils.isArray(context)){
for (var j=context.length; i < j; i++){
if(i in context){
execIteration(i, i, i===context.length - 1);
}}
}else if(global.Symbol&&context[global.Symbol.iterator]){
var newContext=[];
var iterator=context[global.Symbol.iterator]();
for (var it=iterator.next(); !it.done; it=iterator.next()){
newContext.push(it.value);
}
context=newContext;
for (var j=context.length; i < j; i++){
execIteration(i, i, i===context.length - 1);
}}else{
(function (){
var priorKey=undefined;
_Object$keys(context).forEach(function (key){
if(priorKey!==undefined){
execIteration(priorKey, i - 1);
}
priorKey=key;
i++;
});
if(priorKey!==undefined){
execIteration(priorKey, i - 1, true);
}})();
}}
if(i===0){
ret=inverse(this);
}
return ret;
});
};
module.exports=exports['default'];
}.call(exports, (function(){ return this; }())))
}),
(function(module, exports, __webpack_require__){
module.exports={ "default": __webpack_require__(14), __esModule: true };
}),
(function(module, exports, __webpack_require__){
__webpack_require__(15);
module.exports=__webpack_require__(21).Object.keys;
}),
(function(module, exports, __webpack_require__){
var toObject=__webpack_require__(16);
__webpack_require__(18)('keys', function($keys){
return function keys(it){
return $keys(toObject(it));
};});
}),
(function(module, exports, __webpack_require__){
var defined=__webpack_require__(17);
module.exports=function(it){
return Object(defined(it));
};
}),
(function(module, exports){
module.exports=function(it){
if(it==undefined)throw TypeError("Can't call method on  " + it);
return it;
};
}),
(function(module, exports, __webpack_require__){
var $export=__webpack_require__(19)
, core=__webpack_require__(21)
, fails=__webpack_require__(24);
module.exports=function(KEY, exec){
var fn=(core.Object||{})[KEY]||Object[KEY]
, exp={};
exp[KEY]=exec(fn);
$export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp);
};
}),
(function(module, exports, __webpack_require__){
var global=__webpack_require__(20)
, core=__webpack_require__(21)
, ctx=__webpack_require__(22)
, PROTOTYPE='prototype';
var $export=function(type, name, source){
var IS_FORCED=type & $export.F
, IS_GLOBAL=type & $export.G
, IS_STATIC=type & $export.S
, IS_PROTO=type & $export.P
, IS_BIND=type & $export.B
, IS_WRAP=type & $export.W
, exports=IS_GLOBAL ? core:core[name]||(core[name]={})
, target=IS_GLOBAL ? global:IS_STATIC ? global[name]:(global[name]||{})[PROTOTYPE]
, key, own, out;
if(IS_GLOBAL)source=name;
for(key in source){
own = !IS_FORCED&&target&&key in target;
if(own&&key in exports)continue;
out=own ? target[key]:source[key];
exports[key]=IS_GLOBAL&&typeof target[key]!='function' ? source[key]
: IS_BIND&&own ? ctx(out, global)
: IS_WRAP&&target[key]==out ? (function(C){
var F=function(param){
return this instanceof C ? new C(param):C(param);
};
F[PROTOTYPE]=C[PROTOTYPE];
return F;
})(out):IS_PROTO&&typeof out=='function' ? ctx(Function.call, out):out;
if(IS_PROTO)(exports[PROTOTYPE]||(exports[PROTOTYPE]={}))[key]=out;
}};
$export.F=1;
$export.G=2;
$export.S=4;
$export.P=8;
$export.B=16;
$export.W=32;
module.exports=$export;
}),
(function(module, exports){
var global=module.exports=typeof window!='undefined'&&window.Math==Math
? window:typeof self!='undefined'&&self.Math==Math ? self:Function('return this')();
if(typeof __g=='number')__g=global;
}),
(function(module, exports){
var core=module.exports={version: '1.2.6'};
if(typeof __e=='number')__e=core;
}),
(function(module, exports, __webpack_require__){
var aFunction=__webpack_require__(23);
module.exports=function(fn, that, length){
aFunction(fn);
if(that===undefined)return fn;
switch(length){
case 1: return function(a){
return fn.call(that, a);
};
case 2: return function(a, b){
return fn.call(that, a, b);
};
case 3: return function(a, b, c){
return fn.call(that, a, b, c);
};}
return function(){
return fn.apply(that, arguments);
};};
}),
(function(module, exports){
module.exports=function(it){
if(typeof it!='function')throw TypeError(it + ' is not a function!');
return it;
};
}),
(function(module, exports){
module.exports=function(exec){
try {
return !!exec();
} catch(e){
return true;
}};
}),
(function(module, exports, __webpack_require__){
'use strict';
var _interopRequireDefault=__webpack_require__(1)['default'];
exports.__esModule=true;
var _exception=__webpack_require__(6);
var _exception2=_interopRequireDefault(_exception);
exports['default']=function (instance){
instance.registerHelper('helperMissing', function () {
if(arguments.length===1){
return undefined;
}else{
throw new _exception2['default']('Missing helper: "' + arguments[arguments.length - 1].name + '"');
}});
};
module.exports=exports['default'];
}),
(function(module, exports, __webpack_require__){
'use strict';
var _interopRequireDefault=__webpack_require__(1)['default'];
exports.__esModule=true;
var _utils=__webpack_require__(5);
var _exception=__webpack_require__(6);
var _exception2=_interopRequireDefault(_exception);
exports['default']=function (instance){
instance.registerHelper('if', function (conditional, options){
if(arguments.length!=2){
throw new _exception2['default']('#if requires exactly one argument');
}
if(_utils.isFunction(conditional)){
conditional=conditional.call(this);
}
if(!options.hash.includeZero&&!conditional||_utils.isEmpty(conditional)){
return options.inverse(this);
}else{
return options.fn(this);
}});
instance.registerHelper('unless', function (conditional, options){
if(arguments.length!=2){
throw new _exception2['default']('#unless requires exactly one argument');
}
return instance.helpers['if'].call(this, conditional, {
fn: options.inverse,
inverse: options.fn,
hash: options.hash
});
});
};
module.exports=exports['default'];
}),
(function(module, exports){
'use strict';
exports.__esModule=true;
exports['default']=function (instance){
instance.registerHelper('log', function () {
var args=[undefined],
options=arguments[arguments.length - 1];
for (var i=0; i < arguments.length - 1; i++){
args.push(arguments[i]);
}
var level=1;
if(options.hash.level!=null){
level=options.hash.level;
}else if(options.data&&options.data.level!=null){
level=options.data.level;
}
args[0]=level;
instance.log.apply(instance, args);
});
};
module.exports=exports['default'];
}),
(function(module, exports){
'use strict';
exports.__esModule=true;
exports['default']=function (instance){
instance.registerHelper('lookup', function (obj, field, options){
if(!obj){
return obj;
}
return options.lookupProperty(obj, field);
});
};
module.exports=exports['default'];
}),
(function(module, exports, __webpack_require__){
'use strict';
var _interopRequireDefault=__webpack_require__(1)['default'];
exports.__esModule=true;
var _utils=__webpack_require__(5);
var _exception=__webpack_require__(6);
var _exception2=_interopRequireDefault(_exception);
exports['default']=function (instance){
instance.registerHelper('with', function (context, options){
if(arguments.length!=2){
throw new _exception2['default']('#with requires exactly one argument');
}
if(_utils.isFunction(context)){
context=context.call(this);
}
var fn=options.fn;
if(!_utils.isEmpty(context)){
var data=options.data;
if(options.data&&options.ids){
data=_utils.createFrame(options.data);
data.contextPath=_utils.appendContextPath(options.data.contextPath, options.ids[0]);
}
return fn(context, {
data: data,
blockParams: _utils.blockParams([context], [data&&data.contextPath])
});
}else{
return options.inverse(this);
}});
};
module.exports=exports['default'];
}),
(function(module, exports, __webpack_require__){
'use strict';
var _interopRequireDefault=__webpack_require__(1)['default'];
exports.__esModule=true;
exports.registerDefaultDecorators=registerDefaultDecorators;
var _decoratorsInline=__webpack_require__(31);
var _decoratorsInline2=_interopRequireDefault(_decoratorsInline);
function registerDefaultDecorators(instance){
_decoratorsInline2['default'](instance);
}
}),
(function(module, exports, __webpack_require__){
'use strict';
exports.__esModule=true;
var _utils=__webpack_require__(5);
exports['default']=function (instance){
instance.registerDecorator('inline', function (fn, props, container, options){
var ret=fn;
if(!props.partials){
props.partials={};
ret=function (context, options){
var original=container.partials;
container.partials=_utils.extend({}, original, props.partials);
var ret=fn(context, options);
container.partials=original;
return ret;
};}
props.partials[options.args[0]]=options.fn;
return ret;
});
};
module.exports=exports['default'];
}),
(function(module, exports, __webpack_require__){
'use strict';
exports.__esModule=true;
var _utils=__webpack_require__(5);
var logger={
methodMap: ['debug', 'info', 'warn', 'error'],
level: 'info',
lookupLevel: function lookupLevel(level){
if(typeof level==='string'){
var levelMap=_utils.indexOf(logger.methodMap, level.toLowerCase());
if(levelMap >=0){
level=levelMap;
}else{
level=parseInt(level, 10);
}}
return level;
},
log: function log(level){
level=logger.lookupLevel(level);
if(typeof console!=='undefined'&&logger.lookupLevel(logger.level) <=level){
var method=logger.methodMap[level];
if(!console[method]){
method='log';
}
for (var _len=arguments.length, message=Array(_len > 1 ? _len - 1:0), _key=1; _key < _len; _key++){
message[_key - 1]=arguments[_key];
}
console[method].apply(console, message);
}}
};
exports['default']=logger;
module.exports=exports['default'];
}),
(function(module, exports, __webpack_require__){
'use strict';
var _Object$create=__webpack_require__(34)['default'];
var _Object$keys=__webpack_require__(13)['default'];
var _interopRequireWildcard=__webpack_require__(3)['default'];
exports.__esModule=true;
exports.createProtoAccessControl=createProtoAccessControl;
exports.resultIsAllowed=resultIsAllowed;
exports.resetLoggedProperties=resetLoggedProperties;
var _createNewLookupObject=__webpack_require__(36);
var _logger=__webpack_require__(32);
var logger=_interopRequireWildcard(_logger);
var loggedProperties=_Object$create(null);
function createProtoAccessControl(runtimeOptions){
var defaultMethodWhiteList=_Object$create(null);
defaultMethodWhiteList['constructor']=false;
defaultMethodWhiteList['__defineGetter__']=false;
defaultMethodWhiteList['__defineSetter__']=false;
defaultMethodWhiteList['__lookupGetter__']=false;
var defaultPropertyWhiteList=_Object$create(null);
defaultPropertyWhiteList['__proto__']=false;
return {
properties: {
whitelist: _createNewLookupObject.createNewLookupObject(defaultPropertyWhiteList, runtimeOptions.allowedProtoProperties),
defaultValue: runtimeOptions.allowProtoPropertiesByDefault
},
methods: {
whitelist: _createNewLookupObject.createNewLookupObject(defaultMethodWhiteList, runtimeOptions.allowedProtoMethods),
defaultValue: runtimeOptions.allowProtoMethodsByDefault
}};}
function resultIsAllowed(result, protoAccessControl, propertyName){
if(typeof result==='function'){
return checkWhiteList(protoAccessControl.methods, propertyName);
}else{
return checkWhiteList(protoAccessControl.properties, propertyName);
}}
function checkWhiteList(protoAccessControlForType, propertyName){
if(protoAccessControlForType.whitelist[propertyName]!==undefined){
return protoAccessControlForType.whitelist[propertyName]===true;
}
if(protoAccessControlForType.defaultValue!==undefined){
return protoAccessControlForType.defaultValue;
}
logUnexpecedPropertyAccessOnce(propertyName);
return false;
}
function logUnexpecedPropertyAccessOnce(propertyName){
if(loggedProperties[propertyName]!==true){
loggedProperties[propertyName]=true;
logger.log('error', 'Handlebars: Access has been denied to resolve the property "' + propertyName + '" because it is not an "own property" of its parent.\n' + 'You can add a runtime option to disable the check or this warning:\n' + 'See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details');
}}
function resetLoggedProperties(){
_Object$keys(loggedProperties).forEach(function (propertyName){
delete loggedProperties[propertyName];
});
}
}),
(function(module, exports, __webpack_require__){
module.exports={ "default": __webpack_require__(35), __esModule: true };
}),
(function(module, exports, __webpack_require__){
var $=__webpack_require__(9);
module.exports=function create(P, D){
return $.create(P, D);
};
}),
(function(module, exports, __webpack_require__){
'use strict';
var _Object$create=__webpack_require__(34)['default'];
exports.__esModule=true;
exports.createNewLookupObject=createNewLookupObject;
var _utils=__webpack_require__(5);
function createNewLookupObject(){
for (var _len=arguments.length, sources=Array(_len), _key=0; _key < _len; _key++){
sources[_key]=arguments[_key];
}
return _utils.extend.apply(undefined, [_Object$create(null)].concat(sources));
}
}),
(function(module, exports){
'use strict';
exports.__esModule=true;
function SafeString(string){
this.string=string;
}
SafeString.prototype.toString=SafeString.prototype.toHTML=function (){
return '' + this.string;
};
exports['default']=SafeString;
module.exports=exports['default'];
}),
(function(module, exports, __webpack_require__){
'use strict';
var _Object$seal=__webpack_require__(39)['default'];
var _Object$keys=__webpack_require__(13)['default'];
var _interopRequireWildcard=__webpack_require__(3)['default'];
var _interopRequireDefault=__webpack_require__(1)['default'];
exports.__esModule=true;
exports.checkRevision=checkRevision;
exports.template=template;
exports.wrapProgram=wrapProgram;
exports.resolvePartial=resolvePartial;
exports.invokePartial=invokePartial;
exports.noop=noop;
var _utils=__webpack_require__(5);
var Utils=_interopRequireWildcard(_utils);
var _exception=__webpack_require__(6);
var _exception2=_interopRequireDefault(_exception);
var _base=__webpack_require__(4);
var _helpers=__webpack_require__(10);
var _internalWrapHelper=__webpack_require__(43);
var _internalProtoAccess=__webpack_require__(33);
function checkRevision(compilerInfo){
var compilerRevision=compilerInfo&&compilerInfo[0]||1,
currentRevision=_base.COMPILER_REVISION;
if(compilerRevision >=_base.LAST_COMPATIBLE_COMPILER_REVISION&&compilerRevision <=_base.COMPILER_REVISION){
return;
}
if(compilerRevision < _base.LAST_COMPATIBLE_COMPILER_REVISION){
var runtimeVersions=_base.REVISION_CHANGES[currentRevision],
compilerVersions=_base.REVISION_CHANGES[compilerRevision];
throw new _exception2['default']('Template was precompiled with an older version of Handlebars than the current runtime. ' + 'Please update your precompiler to a newer version (' + runtimeVersions + ') or downgrade your runtime to an older version (' + compilerVersions + ').');
}else{
throw new _exception2['default']('Template was precompiled with a newer version of Handlebars than the current runtime. ' + 'Please update your runtime to a newer version (' + compilerInfo[1] + ').');
}}
function template(templateSpec, env){
if(!env){
throw new _exception2['default']('No environment passed to template');
}
if(!templateSpec||!templateSpec.main){
throw new _exception2['default']('Unknown template object: ' + typeof templateSpec);
}
templateSpec.main.decorator=templateSpec.main_d;
env.VM.checkRevision(templateSpec.compiler);
var templateWasPrecompiledWithCompilerV7=templateSpec.compiler&&templateSpec.compiler[0]===7;
function invokePartialWrapper(partial, context, options){
if(options.hash){
context=Utils.extend({}, context, options.hash);
if(options.ids){
options.ids[0]=true;
}}
partial=env.VM.resolvePartial.call(this, partial, context, options);
var extendedOptions=Utils.extend({}, options, {
hooks: this.hooks,
protoAccessControl: this.protoAccessControl
});
var result=env.VM.invokePartial.call(this, partial, context, extendedOptions);
if(result==null&&env.compile){
options.partials[options.name]=env.compile(partial, templateSpec.compilerOptions, env);
result=options.partials[options.name](context, extendedOptions);
}
if(result!=null){
if(options.indent){
var lines=result.split('\n');
for (var i=0, l=lines.length; i < l; i++){
if(!lines[i]&&i + 1===l){
break;
}
lines[i]=options.indent + lines[i];
}
result=lines.join('\n');
}
return result;
}else{
throw new _exception2['default']('The partial ' + options.name + ' could not be compiled when running in runtime-only mode');
}}
var container={
strict: function strict(obj, name, loc){
if(!obj||!(name in obj)){
throw new _exception2['default']('"' + name + '" not defined in ' + obj, {
loc: loc
});
}
return container.lookupProperty(obj, name);
},
lookupProperty: function lookupProperty(parent, propertyName){
var result=parent[propertyName];
if(result==null){
return result;
}
if(Object.prototype.hasOwnProperty.call(parent, propertyName)){
return result;
}
if(_internalProtoAccess.resultIsAllowed(result, container.protoAccessControl, propertyName)){
return result;
}
return undefined;
},
lookup: function lookup(depths, name){
var len=depths.length;
for (var i=0; i < len; i++){
var result=depths[i]&&container.lookupProperty(depths[i], name);
if(result!=null){
return depths[i][name];
}}
},
lambda: function lambda(current, context){
return typeof current==='function' ? current.call(context):current;
},
escapeExpression: Utils.escapeExpression,
invokePartial: invokePartialWrapper,
fn: function fn(i){
var ret=templateSpec[i];
ret.decorator=templateSpec[i + '_d'];
return ret;
},
programs: [],
program: function program(i, data, declaredBlockParams, blockParams, depths){
var programWrapper=this.programs[i],
fn=this.fn(i);
if(data||depths||blockParams||declaredBlockParams){
programWrapper=wrapProgram(this, i, fn, data, declaredBlockParams, blockParams, depths);
}else if(!programWrapper){
programWrapper=this.programs[i]=wrapProgram(this, i, fn);
}
return programWrapper;
},
data: function data(value, depth){
while (value&&depth--){
value=value._parent;
}
return value;
},
mergeIfNeeded: function mergeIfNeeded(param, common){
var obj=param||common;
if(param&&common&&param!==common){
obj=Utils.extend({}, common, param);
}
return obj;
},
nullContext: _Object$seal({}),
noop: env.VM.noop,
compilerInfo: templateSpec.compiler
};
function ret(context){
var options=arguments.length <=1||arguments[1]===undefined ? {}:arguments[1];
var data=options.data;
ret._setup(options);
if(!options.partial&&templateSpec.useData){
data=initData(context, data);
}
var depths=undefined,
blockParams=templateSpec.useBlockParams ? []:undefined;
if(templateSpec.useDepths){
if(options.depths){
depths=context!=options.depths[0] ? [context].concat(options.depths):options.depths;
}else{
depths=[context];
}}
function main(context ){
return '' + templateSpec.main(container, context, container.helpers, container.partials, data, blockParams, depths);
}
main=executeDecorators(templateSpec.main, main, container, options.depths||[], data, blockParams);
return main(context, options);
}
ret.isTop=true;
ret._setup=function (options){
if(!options.partial){
var mergedHelpers=Utils.extend({}, env.helpers, options.helpers);
wrapHelpersToPassLookupProperty(mergedHelpers, container);
container.helpers=mergedHelpers;
if(templateSpec.usePartial){
container.partials=container.mergeIfNeeded(options.partials, env.partials);
}
if(templateSpec.usePartial||templateSpec.useDecorators){
container.decorators=Utils.extend({}, env.decorators, options.decorators);
}
container.hooks={};
container.protoAccessControl=_internalProtoAccess.createProtoAccessControl(options);
var keepHelperInHelpers=options.allowCallsToHelperMissing||templateWasPrecompiledWithCompilerV7;
_helpers.moveHelperToHooks(container, 'helperMissing', keepHelperInHelpers);
_helpers.moveHelperToHooks(container, 'blockHelperMissing', keepHelperInHelpers);
}else{
container.protoAccessControl=options.protoAccessControl;
container.helpers=options.helpers;
container.partials=options.partials;
container.decorators=options.decorators;
container.hooks=options.hooks;
}};
ret._child=function (i, data, blockParams, depths){
if(templateSpec.useBlockParams&&!blockParams){
throw new _exception2['default']('must pass block params');
}
if(templateSpec.useDepths&&!depths){
throw new _exception2['default']('must pass parent depths');
}
return wrapProgram(container, i, templateSpec[i], data, 0, blockParams, depths);
};
return ret;
}
function wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths){
function prog(context){
var options=arguments.length <=1||arguments[1]===undefined ? {}:arguments[1];
var currentDepths=depths;
if(depths&&context!=depths[0]&&!(context===container.nullContext&&depths[0]===null)){
currentDepths=[context].concat(depths);
}
return fn(container, context, container.helpers, container.partials, options.data||data, blockParams&&[options.blockParams].concat(blockParams), currentDepths);
}
prog=executeDecorators(fn, prog, container, depths, data, blockParams);
prog.program=i;
prog.depth=depths ? depths.length:0;
prog.blockParams=declaredBlockParams||0;
return prog;
}
function resolvePartial(partial, context, options){
if(!partial){
if(options.name==='@partial-block'){
partial=options.data['partial-block'];
}else{
partial=options.partials[options.name];
}}else if(!partial.call&&!options.name){
options.name=partial;
partial=options.partials[partial];
}
return partial;
}
function invokePartial(partial, context, options){
var currentPartialBlock=options.data&&options.data['partial-block'];
options.partial=true;
if(options.ids){
options.data.contextPath=options.ids[0]||options.data.contextPath;
}
var partialBlock=undefined;
if(options.fn&&options.fn!==noop){
(function (){
options.data=_base.createFrame(options.data);
var fn=options.fn;
partialBlock=options.data['partial-block']=function partialBlockWrapper(context){
var options=arguments.length <=1||arguments[1]===undefined ? {}:arguments[1];
options.data=_base.createFrame(options.data);
options.data['partial-block']=currentPartialBlock;
return fn(context, options);
};
if(fn.partials){
options.partials=Utils.extend({}, options.partials, fn.partials);
}})();
}
if(partial===undefined&&partialBlock){
partial=partialBlock;
}
if(partial===undefined){
throw new _exception2['default']('The partial ' + options.name + ' could not be found');
}else if(partial instanceof Function){
return partial(context, options);
}}
function noop(){
return '';
}
function initData(context, data){
if(!data||!('root' in data)){
data=data ? _base.createFrame(data):{};
data.root=context;
}
return data;
}
function executeDecorators(fn, prog, container, depths, data, blockParams){
if(fn.decorator){
var props={};
prog=fn.decorator(prog, props, container, depths&&depths[0], data, blockParams, depths);
Utils.extend(prog, props);
}
return prog;
}
function wrapHelpersToPassLookupProperty(mergedHelpers, container){
_Object$keys(mergedHelpers).forEach(function (helperName){
var helper=mergedHelpers[helperName];
mergedHelpers[helperName]=passLookupPropertyOption(helper, container);
});
}
function passLookupPropertyOption(helper, container){
var lookupProperty=container.lookupProperty;
return _internalWrapHelper.wrapHelper(helper, function (options){
return Utils.extend({ lookupProperty: lookupProperty }, options);
});
}
}),
(function(module, exports, __webpack_require__){
module.exports={ "default": __webpack_require__(40), __esModule: true };
}),
(function(module, exports, __webpack_require__){
__webpack_require__(41);
module.exports=__webpack_require__(21).Object.seal;
}),
(function(module, exports, __webpack_require__){
var isObject=__webpack_require__(42);
__webpack_require__(18)('seal', function($seal){
return function seal(it){
return $seal&&isObject(it) ? $seal(it):it;
};});
}),
(function(module, exports){
module.exports=function(it){
return typeof it==='object' ? it!==null:typeof it==='function';
};
}),
(function(module, exports){
'use strict';
exports.__esModule=true;
exports.wrapHelper=wrapHelper;
function wrapHelper(helper, transformOptionsFn){
if(typeof helper!=='function'){
return helper;
}
var wrapper=function wrapper() {
var options=arguments[arguments.length - 1];
arguments[arguments.length - 1]=transformOptionsFn(options);
return helper.apply(this, arguments);
};
return wrapper;
}
}),
(function(module, exports){
(function(global){'use strict';
exports.__esModule=true;
exports['default']=function (Handlebars){
var root=typeof global!=='undefined' ? global:window,
$Handlebars=root.Handlebars;
Handlebars.noConflict=function (){
if(root.Handlebars===Handlebars){
root.Handlebars=$Handlebars;
}
return Handlebars;
};};
module.exports=exports['default'];
}.call(exports, (function(){ return this; }())))
}),
(function(module, exports){
'use strict';
exports.__esModule=true;
var AST={
helpers: {
helperExpression: function helperExpression(node){
return node.type==='SubExpression'||(node.type==='MustacheStatement'||node.type==='BlockStatement')&&!!(node.params&&node.params.length||node.hash);
},
scopedId: function scopedId(path){
return (/^\.|this\b/.test(path.original)
);
},
simpleId: function simpleId(path){
return path.parts.length===1&&!AST.helpers.scopedId(path)&&!path.depth;
}}
};
exports['default']=AST;
module.exports=exports['default'];
}),
(function(module, exports, __webpack_require__){
'use strict';
var _interopRequireDefault=__webpack_require__(1)['default'];
var _interopRequireWildcard=__webpack_require__(3)['default'];
exports.__esModule=true;
exports.parseWithoutProcessing=parseWithoutProcessing;
exports.parse=parse;
var _parser=__webpack_require__(47);
var _parser2=_interopRequireDefault(_parser);
var _whitespaceControl=__webpack_require__(48);
var _whitespaceControl2=_interopRequireDefault(_whitespaceControl);
var _helpers=__webpack_require__(50);
var Helpers=_interopRequireWildcard(_helpers);
var _utils=__webpack_require__(5);
exports.parser=_parser2['default'];
var yy={};
_utils.extend(yy, Helpers);
function parseWithoutProcessing(input, options){
if(input.type==='Program'){
return input;
}
_parser2['default'].yy=yy;
yy.locInfo=function (locInfo){
return new yy.SourceLocation(options&&options.srcName, locInfo);
};
var ast=_parser2['default'].parse(input);
return ast;
}
function parse(input, options){
var ast=parseWithoutProcessing(input, options);
var strip=new _whitespaceControl2['default'](options);
return strip.accept(ast);
}
}),
(function(module, exports){
"use strict";
exports.__esModule=true;
var handlebars=(function (){
var parser={ trace: function trace(){},
yy: {},
symbols_: { "error": 2, "root": 3, "program": 4, "EOF": 5, "program_repetition0": 6, "statement": 7, "mustache": 8, "block": 9, "rawBlock": 10, "partial": 11, "partialBlock": 12, "content": 13, "COMMENT": 14, "CONTENT": 15, "openRawBlock": 16, "rawBlock_repetition0": 17, "END_RAW_BLOCK": 18, "OPEN_RAW_BLOCK": 19, "helperName": 20, "openRawBlock_repetition0": 21, "openRawBlock_option0": 22, "CLOSE_RAW_BLOCK": 23, "openBlock": 24, "block_option0": 25, "closeBlock": 26, "openInverse": 27, "block_option1": 28, "OPEN_BLOCK": 29, "openBlock_repetition0": 30, "openBlock_option0": 31, "openBlock_option1": 32, "CLOSE": 33, "OPEN_INVERSE": 34, "openInverse_repetition0": 35, "openInverse_option0": 36, "openInverse_option1": 37, "openInverseChain": 38, "OPEN_INVERSE_CHAIN": 39, "openInverseChain_repetition0": 40, "openInverseChain_option0": 41, "openInverseChain_option1": 42, "inverseAndProgram": 43, "INVERSE": 44, "inverseChain": 45, "inverseChain_option0": 46, "OPEN_ENDBLOCK": 47, "OPEN": 48, "mustache_repetition0": 49, "mustache_option0": 50, "OPEN_UNESCAPED": 51, "mustache_repetition1": 52, "mustache_option1": 53, "CLOSE_UNESCAPED": 54, "OPEN_PARTIAL": 55, "partialName": 56, "partial_repetition0": 57, "partial_option0": 58, "openPartialBlock": 59, "OPEN_PARTIAL_BLOCK": 60, "openPartialBlock_repetition0": 61, "openPartialBlock_option0": 62, "param": 63, "sexpr": 64, "OPEN_SEXPR": 65, "sexpr_repetition0": 66, "sexpr_option0": 67, "CLOSE_SEXPR": 68, "hash": 69, "hash_repetition_plus0": 70, "hashSegment": 71, "ID": 72, "EQUALS": 73, "blockParams": 74, "OPEN_BLOCK_PARAMS": 75, "blockParams_repetition_plus0": 76, "CLOSE_BLOCK_PARAMS": 77, "path": 78, "dataName": 79, "STRING": 80, "NUMBER": 81, "BOOLEAN": 82, "UNDEFINED": 83, "NULL": 84, "DATA": 85, "pathSegments": 86, "SEP": 87, "$accept": 0, "$end": 1 },
terminals_: { 2: "error", 5: "EOF", 14: "COMMENT", 15: "CONTENT", 18: "END_RAW_BLOCK", 19: "OPEN_RAW_BLOCK", 23: "CLOSE_RAW_BLOCK", 29: "OPEN_BLOCK", 33: "CLOSE", 34: "OPEN_INVERSE", 39: "OPEN_INVERSE_CHAIN", 44: "INVERSE", 47: "OPEN_ENDBLOCK", 48: "OPEN", 51: "OPEN_UNESCAPED", 54: "CLOSE_UNESCAPED", 55: "OPEN_PARTIAL", 60: "OPEN_PARTIAL_BLOCK", 65: "OPEN_SEXPR", 68: "CLOSE_SEXPR", 72: "ID", 73: "EQUALS", 75: "OPEN_BLOCK_PARAMS", 77: "CLOSE_BLOCK_PARAMS", 80: "STRING", 81: "NUMBER", 82: "BOOLEAN", 83: "UNDEFINED", 84: "NULL", 85: "DATA", 87: "SEP" },
productions_: [0, [3, 2], [4, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [13, 1], [10, 3], [16, 5], [9, 4], [9, 4], [24, 6], [27, 6], [38, 6], [43, 2], [45, 3], [45, 1], [26, 3], [8, 5], [8, 5], [11, 5], [12, 3], [59, 5], [63, 1], [63, 1], [64, 5], [69, 1], [71, 3], [74, 3], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [56, 1], [56, 1], [79, 2], [78, 1], [86, 3], [86, 1], [6, 0], [6, 2], [17, 0], [17, 2], [21, 0], [21, 2], [22, 0], [22, 1], [25, 0], [25, 1], [28, 0], [28, 1], [30, 0], [30, 2], [31, 0], [31, 1], [32, 0], [32, 1], [35, 0], [35, 2], [36, 0], [36, 1], [37, 0], [37, 1], [40, 0], [40, 2], [41, 0], [41, 1], [42, 0], [42, 1], [46, 0], [46, 1], [49, 0], [49, 2], [50, 0], [50, 1], [52, 0], [52, 2], [53, 0], [53, 1], [57, 0], [57, 2], [58, 0], [58, 1], [61, 0], [61, 2], [62, 0], [62, 1], [66, 0], [66, 2], [67, 0], [67, 1], [70, 1], [70, 2], [76, 1], [76, 2]],
performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$){
var $0=$$.length - 1;
switch (yystate){
case 1:
return $$[$0 - 1];
break;
case 2:
this.$=yy.prepareProgram($$[$0]);
break;
case 3:
this.$=$$[$0];
break;
case 4:
this.$=$$[$0];
break;
case 5:
this.$=$$[$0];
break;
case 6:
this.$=$$[$0];
break;
case 7:
this.$=$$[$0];
break;
case 8:
this.$=$$[$0];
break;
case 9:
this.$={
type: 'CommentStatement',
value: yy.stripComment($$[$0]),
strip: yy.stripFlags($$[$0], $$[$0]),
loc: yy.locInfo(this._$)
};
break;
case 10:
this.$={
type: 'ContentStatement',
original: $$[$0],
value: $$[$0],
loc: yy.locInfo(this._$)
};
break;
case 11:
this.$=yy.prepareRawBlock($$[$0 - 2], $$[$0 - 1], $$[$0], this._$);
break;
case 12:
this.$={ path: $$[$0 - 3], params: $$[$0 - 2], hash: $$[$0 - 1] };
break;
case 13:
this.$=yy.prepareBlock($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0], false, this._$);
break;
case 14:
this.$=yy.prepareBlock($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0], true, this._$);
break;
case 15:
this.$={ open: $$[$0 - 5], path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) };
break;
case 16:
this.$={ path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) };
break;
case 17:
this.$={ path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) };
break;
case 18:
this.$={ strip: yy.stripFlags($$[$0 - 1], $$[$0 - 1]), program: $$[$0] };
break;
case 19:
var inverse=yy.prepareBlock($$[$0 - 2], $$[$0 - 1], $$[$0], $$[$0], false, this._$),
program=yy.prepareProgram([inverse], $$[$0 - 1].loc);
program.chained=true;
this.$={ strip: $$[$0 - 2].strip, program: program, chain: true };
break;
case 20:
this.$=$$[$0];
break;
case 21:
this.$={ path: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 2], $$[$0]) };
break;
case 22:
this.$=yy.prepareMustache($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0 - 4], yy.stripFlags($$[$0 - 4], $$[$0]), this._$);
break;
case 23:
this.$=yy.prepareMustache($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0 - 4], yy.stripFlags($$[$0 - 4], $$[$0]), this._$);
break;
case 24:
this.$={
type: 'PartialStatement',
name: $$[$0 - 3],
params: $$[$0 - 2],
hash: $$[$0 - 1],
indent: '',
strip: yy.stripFlags($$[$0 - 4], $$[$0]),
loc: yy.locInfo(this._$)
};
break;
case 25:
this.$=yy.preparePartialBlock($$[$0 - 2], $$[$0 - 1], $$[$0], this._$);
break;
case 26:
this.$={ path: $$[$0 - 3], params: $$[$0 - 2], hash: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 4], $$[$0]) };
break;
case 27:
this.$=$$[$0];
break;
case 28:
this.$=$$[$0];
break;
case 29:
this.$={
type: 'SubExpression',
path: $$[$0 - 3],
params: $$[$0 - 2],
hash: $$[$0 - 1],
loc: yy.locInfo(this._$)
};
break;
case 30:
this.$={ type: 'Hash', pairs: $$[$0], loc: yy.locInfo(this._$) };
break;
case 31:
this.$={ type: 'HashPair', key: yy.id($$[$0 - 2]), value: $$[$0], loc: yy.locInfo(this._$) };
break;
case 32:
this.$=yy.id($$[$0 - 1]);
break;
case 33:
this.$=$$[$0];
break;
case 34:
this.$=$$[$0];
break;
case 35:
this.$={ type: 'StringLiteral', value: $$[$0], original: $$[$0], loc: yy.locInfo(this._$) };
break;
case 36:
this.$={ type: 'NumberLiteral', value: Number($$[$0]), original: Number($$[$0]), loc: yy.locInfo(this._$) };
break;
case 37:
this.$={ type: 'BooleanLiteral', value: $$[$0]==='true', original: $$[$0]==='true', loc: yy.locInfo(this._$) };
break;
case 38:
this.$={ type: 'UndefinedLiteral', original: undefined, value: undefined, loc: yy.locInfo(this._$) };
break;
case 39:
this.$={ type: 'NullLiteral', original: null, value: null, loc: yy.locInfo(this._$) };
break;
case 40:
this.$=$$[$0];
break;
case 41:
this.$=$$[$0];
break;
case 42:
this.$=yy.preparePath(true, $$[$0], this._$);
break;
case 43:
this.$=yy.preparePath(false, $$[$0], this._$);
break;
case 44:
$$[$0 - 2].push({ part: yy.id($$[$0]), original: $$[$0], separator: $$[$0 - 1] });this.$=$$[$0 - 2];
break;
case 45:
this.$=[{ part: yy.id($$[$0]), original: $$[$0] }];
break;
case 46:
this.$=[];
break;
case 47:
$$[$0 - 1].push($$[$0]);
break;
case 48:
this.$=[];
break;
case 49:
$$[$0 - 1].push($$[$0]);
break;
case 50:
this.$=[];
break;
case 51:
$$[$0 - 1].push($$[$0]);
break;
case 58:
this.$=[];
break;
case 59:
$$[$0 - 1].push($$[$0]);
break;
case 64:
this.$=[];
break;
case 65:
$$[$0 - 1].push($$[$0]);
break;
case 70:
this.$=[];
break;
case 71:
$$[$0 - 1].push($$[$0]);
break;
case 78:
this.$=[];
break;
case 79:
$$[$0 - 1].push($$[$0]);
break;
case 82:
this.$=[];
break;
case 83:
$$[$0 - 1].push($$[$0]);
break;
case 86:
this.$=[];
break;
case 87:
$$[$0 - 1].push($$[$0]);
break;
case 90:
this.$=[];
break;
case 91:
$$[$0 - 1].push($$[$0]);
break;
case 94:
this.$=[];
break;
case 95:
$$[$0 - 1].push($$[$0]);
break;
case 98:
this.$=[$$[$0]];
break;
case 99:
$$[$0 - 1].push($$[$0]);
break;
case 100:
this.$=[$$[$0]];
break;
case 101:
$$[$0 - 1].push($$[$0]);
break;
}},
table: [{ 3: 1, 4: 2, 5: [2, 46], 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 1: [3] }, { 5: [1, 4] }, { 5: [2, 2], 7: 5, 8: 6, 9: 7, 10: 8, 11: 9, 12: 10, 13: 11, 14: [1, 12], 15: [1, 20], 16: 17, 19: [1, 23], 24: 15, 27: 16, 29: [1, 21], 34: [1, 22], 39: [2, 2], 44: [2, 2], 47: [2, 2], 48: [1, 13], 51: [1, 14], 55: [1, 18], 59: 19, 60: [1, 24] }, { 1: [2, 1] }, { 5: [2, 47], 14: [2, 47], 15: [2, 47], 19: [2, 47], 29: [2, 47], 34: [2, 47], 39: [2, 47], 44: [2, 47], 47: [2, 47], 48: [2, 47], 51: [2, 47], 55: [2, 47], 60: [2, 47] }, { 5: [2, 3], 14: [2, 3], 15: [2, 3], 19: [2, 3], 29: [2, 3], 34: [2, 3], 39: [2, 3], 44: [2, 3], 47: [2, 3], 48: [2, 3], 51: [2, 3], 55: [2, 3], 60: [2, 3] }, { 5: [2, 4], 14: [2, 4], 15: [2, 4], 19: [2, 4], 29: [2, 4], 34: [2, 4], 39: [2, 4], 44: [2, 4], 47: [2, 4], 48: [2, 4], 51: [2, 4], 55: [2, 4], 60: [2, 4] }, { 5: [2, 5], 14: [2, 5], 15: [2, 5], 19: [2, 5], 29: [2, 5], 34: [2, 5], 39: [2, 5], 44: [2, 5], 47: [2, 5], 48: [2, 5], 51: [2, 5], 55: [2, 5], 60: [2, 5] }, { 5: [2, 6], 14: [2, 6], 15: [2, 6], 19: [2, 6], 29: [2, 6], 34: [2, 6], 39: [2, 6], 44: [2, 6], 47: [2, 6], 48: [2, 6], 51: [2, 6], 55: [2, 6], 60: [2, 6] }, { 5: [2, 7], 14: [2, 7], 15: [2, 7], 19: [2, 7], 29: [2, 7], 34: [2, 7], 39: [2, 7], 44: [2, 7], 47: [2, 7], 48: [2, 7], 51: [2, 7], 55: [2, 7], 60: [2, 7] }, { 5: [2, 8], 14: [2, 8], 15: [2, 8], 19: [2, 8], 29: [2, 8], 34: [2, 8], 39: [2, 8], 44: [2, 8], 47: [2, 8], 48: [2, 8], 51: [2, 8], 55: [2, 8], 60: [2, 8] }, { 5: [2, 9], 14: [2, 9], 15: [2, 9], 19: [2, 9], 29: [2, 9], 34: [2, 9], 39: [2, 9], 44: [2, 9], 47: [2, 9], 48: [2, 9], 51: [2, 9], 55: [2, 9], 60: [2, 9] }, { 20: 25, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 36, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 37, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 39: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 4: 38, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 15: [2, 48], 17: 39, 18: [2, 48] }, { 20: 41, 56: 40, 64: 42, 65: [1, 43], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 44, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 5: [2, 10], 14: [2, 10], 15: [2, 10], 18: [2, 10], 19: [2, 10], 29: [2, 10], 34: [2, 10], 39: [2, 10], 44: [2, 10], 47: [2, 10], 48: [2, 10], 51: [2, 10], 55: [2, 10], 60: [2, 10] }, { 20: 45, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 46, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 47, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 41, 56: 48, 64: 42, 65: [1, 43], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 33: [2, 78], 49: 49, 65: [2, 78], 72: [2, 78], 80: [2, 78], 81: [2, 78], 82: [2, 78], 83: [2, 78], 84: [2, 78], 85: [2, 78] }, { 23: [2, 33], 33: [2, 33], 54: [2, 33], 65: [2, 33], 68: [2, 33], 72: [2, 33], 75: [2, 33], 80: [2, 33], 81: [2, 33], 82: [2, 33], 83: [2, 33], 84: [2, 33], 85: [2, 33] }, { 23: [2, 34], 33: [2, 34], 54: [2, 34], 65: [2, 34], 68: [2, 34], 72: [2, 34], 75: [2, 34], 80: [2, 34], 81: [2, 34], 82: [2, 34], 83: [2, 34], 84: [2, 34], 85: [2, 34] }, { 23: [2, 35], 33: [2, 35], 54: [2, 35], 65: [2, 35], 68: [2, 35], 72: [2, 35], 75: [2, 35], 80: [2, 35], 81: [2, 35], 82: [2, 35], 83: [2, 35], 84: [2, 35], 85: [2, 35] }, { 23: [2, 36], 33: [2, 36], 54: [2, 36], 65: [2, 36], 68: [2, 36], 72: [2, 36], 75: [2, 36], 80: [2, 36], 81: [2, 36], 82: [2, 36], 83: [2, 36], 84: [2, 36], 85: [2, 36] }, { 23: [2, 37], 33: [2, 37], 54: [2, 37], 65: [2, 37], 68: [2, 37], 72: [2, 37], 75: [2, 37], 80: [2, 37], 81: [2, 37], 82: [2, 37], 83: [2, 37], 84: [2, 37], 85: [2, 37] }, { 23: [2, 38], 33: [2, 38], 54: [2, 38], 65: [2, 38], 68: [2, 38], 72: [2, 38], 75: [2, 38], 80: [2, 38], 81: [2, 38], 82: [2, 38], 83: [2, 38], 84: [2, 38], 85: [2, 38] }, { 23: [2, 39], 33: [2, 39], 54: [2, 39], 65: [2, 39], 68: [2, 39], 72: [2, 39], 75: [2, 39], 80: [2, 39], 81: [2, 39], 82: [2, 39], 83: [2, 39], 84: [2, 39], 85: [2, 39] }, { 23: [2, 43], 33: [2, 43], 54: [2, 43], 65: [2, 43], 68: [2, 43], 72: [2, 43], 75: [2, 43], 80: [2, 43], 81: [2, 43], 82: [2, 43], 83: [2, 43], 84: [2, 43], 85: [2, 43], 87: [1, 50] }, { 72: [1, 35], 86: 51 }, { 23: [2, 45], 33: [2, 45], 54: [2, 45], 65: [2, 45], 68: [2, 45], 72: [2, 45], 75: [2, 45], 80: [2, 45], 81: [2, 45], 82: [2, 45], 83: [2, 45], 84: [2, 45], 85: [2, 45], 87: [2, 45] }, { 52: 52, 54: [2, 82], 65: [2, 82], 72: [2, 82], 80: [2, 82], 81: [2, 82], 82: [2, 82], 83: [2, 82], 84: [2, 82], 85: [2, 82] }, { 25: 53, 38: 55, 39: [1, 57], 43: 56, 44: [1, 58], 45: 54, 47: [2, 54] }, { 28: 59, 43: 60, 44: [1, 58], 47: [2, 56] }, { 13: 62, 15: [1, 20], 18: [1, 61] }, { 33: [2, 86], 57: 63, 65: [2, 86], 72: [2, 86], 80: [2, 86], 81: [2, 86], 82: [2, 86], 83: [2, 86], 84: [2, 86], 85: [2, 86] }, { 33: [2, 40], 65: [2, 40], 72: [2, 40], 80: [2, 40], 81: [2, 40], 82: [2, 40], 83: [2, 40], 84: [2, 40], 85: [2, 40] }, { 33: [2, 41], 65: [2, 41], 72: [2, 41], 80: [2, 41], 81: [2, 41], 82: [2, 41], 83: [2, 41], 84: [2, 41], 85: [2, 41] }, { 20: 64, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 26: 65, 47: [1, 66] }, { 30: 67, 33: [2, 58], 65: [2, 58], 72: [2, 58], 75: [2, 58], 80: [2, 58], 81: [2, 58], 82: [2, 58], 83: [2, 58], 84: [2, 58], 85: [2, 58] }, { 33: [2, 64], 35: 68, 65: [2, 64], 72: [2, 64], 75: [2, 64], 80: [2, 64], 81: [2, 64], 82: [2, 64], 83: [2, 64], 84: [2, 64], 85: [2, 64] }, { 21: 69, 23: [2, 50], 65: [2, 50], 72: [2, 50], 80: [2, 50], 81: [2, 50], 82: [2, 50], 83: [2, 50], 84: [2, 50], 85: [2, 50] }, { 33: [2, 90], 61: 70, 65: [2, 90], 72: [2, 90], 80: [2, 90], 81: [2, 90], 82: [2, 90], 83: [2, 90], 84: [2, 90], 85: [2, 90] }, { 20: 74, 33: [2, 80], 50: 71, 63: 72, 64: 75, 65: [1, 43], 69: 73, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 72: [1, 79] }, { 23: [2, 42], 33: [2, 42], 54: [2, 42], 65: [2, 42], 68: [2, 42], 72: [2, 42], 75: [2, 42], 80: [2, 42], 81: [2, 42], 82: [2, 42], 83: [2, 42], 84: [2, 42], 85: [2, 42], 87: [1, 50] }, { 20: 74, 53: 80, 54: [2, 84], 63: 81, 64: 75, 65: [1, 43], 69: 82, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 26: 83, 47: [1, 66] }, { 47: [2, 55] }, { 4: 84, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 39: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 47: [2, 20] }, { 20: 85, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 86, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 26: 87, 47: [1, 66] }, { 47: [2, 57] }, { 5: [2, 11], 14: [2, 11], 15: [2, 11], 19: [2, 11], 29: [2, 11], 34: [2, 11], 39: [2, 11], 44: [2, 11], 47: [2, 11], 48: [2, 11], 51: [2, 11], 55: [2, 11], 60: [2, 11] }, { 15: [2, 49], 18: [2, 49] }, { 20: 74, 33: [2, 88], 58: 88, 63: 89, 64: 75, 65: [1, 43], 69: 90, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 65: [2, 94], 66: 91, 68: [2, 94], 72: [2, 94], 80: [2, 94], 81: [2, 94], 82: [2, 94], 83: [2, 94], 84: [2, 94], 85: [2, 94] }, { 5: [2, 25], 14: [2, 25], 15: [2, 25], 19: [2, 25], 29: [2, 25], 34: [2, 25], 39: [2, 25], 44: [2, 25], 47: [2, 25], 48: [2, 25], 51: [2, 25], 55: [2, 25], 60: [2, 25] }, { 20: 92, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 74, 31: 93, 33: [2, 60], 63: 94, 64: 75, 65: [1, 43], 69: 95, 70: 76, 71: 77, 72: [1, 78], 75: [2, 60], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 74, 33: [2, 66], 36: 96, 63: 97, 64: 75, 65: [1, 43], 69: 98, 70: 76, 71: 77, 72: [1, 78], 75: [2, 66], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 74, 22: 99, 23: [2, 52], 63: 100, 64: 75, 65: [1, 43], 69: 101, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 74, 33: [2, 92], 62: 102, 63: 103, 64: 75, 65: [1, 43], 69: 104, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 33: [1, 105] }, { 33: [2, 79], 65: [2, 79], 72: [2, 79], 80: [2, 79], 81: [2, 79], 82: [2, 79], 83: [2, 79], 84: [2, 79], 85: [2, 79] }, { 33: [2, 81] }, { 23: [2, 27], 33: [2, 27], 54: [2, 27], 65: [2, 27], 68: [2, 27], 72: [2, 27], 75: [2, 27], 80: [2, 27], 81: [2, 27], 82: [2, 27], 83: [2, 27], 84: [2, 27], 85: [2, 27] }, { 23: [2, 28], 33: [2, 28], 54: [2, 28], 65: [2, 28], 68: [2, 28], 72: [2, 28], 75: [2, 28], 80: [2, 28], 81: [2, 28], 82: [2, 28], 83: [2, 28], 84: [2, 28], 85: [2, 28] }, { 23: [2, 30], 33: [2, 30], 54: [2, 30], 68: [2, 30], 71: 106, 72: [1, 107], 75: [2, 30] }, { 23: [2, 98], 33: [2, 98], 54: [2, 98], 68: [2, 98], 72: [2, 98], 75: [2, 98] }, { 23: [2, 45], 33: [2, 45], 54: [2, 45], 65: [2, 45], 68: [2, 45], 72: [2, 45], 73: [1, 108], 75: [2, 45], 80: [2, 45], 81: [2, 45], 82: [2, 45], 83: [2, 45], 84: [2, 45], 85: [2, 45], 87: [2, 45] }, { 23: [2, 44], 33: [2, 44], 54: [2, 44], 65: [2, 44], 68: [2, 44], 72: [2, 44], 75: [2, 44], 80: [2, 44], 81: [2, 44], 82: [2, 44], 83: [2, 44], 84: [2, 44], 85: [2, 44], 87: [2, 44] }, { 54: [1, 109] }, { 54: [2, 83], 65: [2, 83], 72: [2, 83], 80: [2, 83], 81: [2, 83], 82: [2, 83], 83: [2, 83], 84: [2, 83], 85: [2, 83] }, { 54: [2, 85] }, { 5: [2, 13], 14: [2, 13], 15: [2, 13], 19: [2, 13], 29: [2, 13], 34: [2, 13], 39: [2, 13], 44: [2, 13], 47: [2, 13], 48: [2, 13], 51: [2, 13], 55: [2, 13], 60: [2, 13] }, { 38: 55, 39: [1, 57], 43: 56, 44: [1, 58], 45: 111, 46: 110, 47: [2, 76] }, { 33: [2, 70], 40: 112, 65: [2, 70], 72: [2, 70], 75: [2, 70], 80: [2, 70], 81: [2, 70], 82: [2, 70], 83: [2, 70], 84: [2, 70], 85: [2, 70] }, { 47: [2, 18] }, { 5: [2, 14], 14: [2, 14], 15: [2, 14], 19: [2, 14], 29: [2, 14], 34: [2, 14], 39: [2, 14], 44: [2, 14], 47: [2, 14], 48: [2, 14], 51: [2, 14], 55: [2, 14], 60: [2, 14] }, { 33: [1, 113] }, { 33: [2, 87], 65: [2, 87], 72: [2, 87], 80: [2, 87], 81: [2, 87], 82: [2, 87], 83: [2, 87], 84: [2, 87], 85: [2, 87] }, { 33: [2, 89] }, { 20: 74, 63: 115, 64: 75, 65: [1, 43], 67: 114, 68: [2, 96], 69: 116, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 33: [1, 117] }, { 32: 118, 33: [2, 62], 74: 119, 75: [1, 120] }, { 33: [2, 59], 65: [2, 59], 72: [2, 59], 75: [2, 59], 80: [2, 59], 81: [2, 59], 82: [2, 59], 83: [2, 59], 84: [2, 59], 85: [2, 59] }, { 33: [2, 61], 75: [2, 61] }, { 33: [2, 68], 37: 121, 74: 122, 75: [1, 120] }, { 33: [2, 65], 65: [2, 65], 72: [2, 65], 75: [2, 65], 80: [2, 65], 81: [2, 65], 82: [2, 65], 83: [2, 65], 84: [2, 65], 85: [2, 65] }, { 33: [2, 67], 75: [2, 67] }, { 23: [1, 123] }, { 23: [2, 51], 65: [2, 51], 72: [2, 51], 80: [2, 51], 81: [2, 51], 82: [2, 51], 83: [2, 51], 84: [2, 51], 85: [2, 51] }, { 23: [2, 53] }, { 33: [1, 124] }, { 33: [2, 91], 65: [2, 91], 72: [2, 91], 80: [2, 91], 81: [2, 91], 82: [2, 91], 83: [2, 91], 84: [2, 91], 85: [2, 91] }, { 33: [2, 93] }, { 5: [2, 22], 14: [2, 22], 15: [2, 22], 19: [2, 22], 29: [2, 22], 34: [2, 22], 39: [2, 22], 44: [2, 22], 47: [2, 22], 48: [2, 22], 51: [2, 22], 55: [2, 22], 60: [2, 22] }, { 23: [2, 99], 33: [2, 99], 54: [2, 99], 68: [2, 99], 72: [2, 99], 75: [2, 99] }, { 73: [1, 108] }, { 20: 74, 63: 125, 64: 75, 65: [1, 43], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 5: [2, 23], 14: [2, 23], 15: [2, 23], 19: [2, 23], 29: [2, 23], 34: [2, 23], 39: [2, 23], 44: [2, 23], 47: [2, 23], 48: [2, 23], 51: [2, 23], 55: [2, 23], 60: [2, 23] }, { 47: [2, 19] }, { 47: [2, 77] }, { 20: 74, 33: [2, 72], 41: 126, 63: 127, 64: 75, 65: [1, 43], 69: 128, 70: 76, 71: 77, 72: [1, 78], 75: [2, 72], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 5: [2, 24], 14: [2, 24], 15: [2, 24], 19: [2, 24], 29: [2, 24], 34: [2, 24], 39: [2, 24], 44: [2, 24], 47: [2, 24], 48: [2, 24], 51: [2, 24], 55: [2, 24], 60: [2, 24] }, { 68: [1, 129] }, { 65: [2, 95], 68: [2, 95], 72: [2, 95], 80: [2, 95], 81: [2, 95], 82: [2, 95], 83: [2, 95], 84: [2, 95], 85: [2, 95] }, { 68: [2, 97] }, { 5: [2, 21], 14: [2, 21], 15: [2, 21], 19: [2, 21], 29: [2, 21], 34: [2, 21], 39: [2, 21], 44: [2, 21], 47: [2, 21], 48: [2, 21], 51: [2, 21], 55: [2, 21], 60: [2, 21] }, { 33: [1, 130] }, { 33: [2, 63] }, { 72: [1, 132], 76: 131 }, { 33: [1, 133] }, { 33: [2, 69] }, { 15: [2, 12], 18: [2, 12] }, { 14: [2, 26], 15: [2, 26], 19: [2, 26], 29: [2, 26], 34: [2, 26], 47: [2, 26], 48: [2, 26], 51: [2, 26], 55: [2, 26], 60: [2, 26] }, { 23: [2, 31], 33: [2, 31], 54: [2, 31], 68: [2, 31], 72: [2, 31], 75: [2, 31] }, { 33: [2, 74], 42: 134, 74: 135, 75: [1, 120] }, { 33: [2, 71], 65: [2, 71], 72: [2, 71], 75: [2, 71], 80: [2, 71], 81: [2, 71], 82: [2, 71], 83: [2, 71], 84: [2, 71], 85: [2, 71] }, { 33: [2, 73], 75: [2, 73] }, { 23: [2, 29], 33: [2, 29], 54: [2, 29], 65: [2, 29], 68: [2, 29], 72: [2, 29], 75: [2, 29], 80: [2, 29], 81: [2, 29], 82: [2, 29], 83: [2, 29], 84: [2, 29], 85: [2, 29] }, { 14: [2, 15], 15: [2, 15], 19: [2, 15], 29: [2, 15], 34: [2, 15], 39: [2, 15], 44: [2, 15], 47: [2, 15], 48: [2, 15], 51: [2, 15], 55: [2, 15], 60: [2, 15] }, { 72: [1, 137], 77: [1, 136] }, { 72: [2, 100], 77: [2, 100] }, { 14: [2, 16], 15: [2, 16], 19: [2, 16], 29: [2, 16], 34: [2, 16], 44: [2, 16], 47: [2, 16], 48: [2, 16], 51: [2, 16], 55: [2, 16], 60: [2, 16] }, { 33: [1, 138] }, { 33: [2, 75] }, { 33: [2, 32] }, { 72: [2, 101], 77: [2, 101] }, { 14: [2, 17], 15: [2, 17], 19: [2, 17], 29: [2, 17], 34: [2, 17], 39: [2, 17], 44: [2, 17], 47: [2, 17], 48: [2, 17], 51: [2, 17], 55: [2, 17], 60: [2, 17] }],
defaultActions: { 4: [2, 1], 54: [2, 55], 56: [2, 20], 60: [2, 57], 73: [2, 81], 82: [2, 85], 86: [2, 18], 90: [2, 89], 101: [2, 53], 104: [2, 93], 110: [2, 19], 111: [2, 77], 116: [2, 97], 119: [2, 63], 122: [2, 69], 135: [2, 75], 136: [2, 32] },
parseError: function parseError(str, hash){
throw new Error(str);
},
parse: function parse(input){
var self=this,
stack=[0],
vstack=[null],
lstack=[],
table=this.table,
yytext="",
yylineno=0,
yyleng=0,
recovering=0,
TERROR=2,
EOF=1;
this.lexer.setInput(input);
this.lexer.yy=this.yy;
this.yy.lexer=this.lexer;
this.yy.parser=this;
if(typeof this.lexer.yylloc=="undefined") this.lexer.yylloc={};
var yyloc=this.lexer.yylloc;
lstack.push(yyloc);
var ranges=this.lexer.options&&this.lexer.options.ranges;
if(typeof this.yy.parseError==="function") this.parseError=this.yy.parseError;
function popStack(n){
stack.length=stack.length - 2 * n;
vstack.length=vstack.length - n;
lstack.length=lstack.length - n;
}
function lex(){
var token;
token=self.lexer.lex()||1;
if(typeof token!=="number"){
token=self.symbols_[token]||token;
}
return token;
}
var symbol,
preErrorSymbol,
state,
action,
a,
r,
yyval={},
p,
len,
newState,
expected;
while (true){
state=stack[stack.length - 1];
if(this.defaultActions[state]){
action=this.defaultActions[state];
}else{
if(symbol===null||typeof symbol=="undefined"){
symbol=lex();
}
action=table[state]&&table[state][symbol];
}
if(typeof action==="undefined"||!action.length||!action[0]){
var errStr="";
if(!recovering){
expected=[];
for (p in table[state]) if(this.terminals_[p]&&p > 2){
expected.push("'" + this.terminals_[p] + "'");
}
if(this.lexer.showPosition){
errStr="Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol]||symbol) + "'";
}else{
errStr="Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol==1 ? "end of input":"'" + (this.terminals_[symbol]||symbol) + "'");
}
this.parseError(errStr, { text: this.lexer.match, token: this.terminals_[symbol]||symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected });
}}
if(action[0] instanceof Array&&action.length > 1){
throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
}
switch (action[0]){
case 1:
stack.push(symbol);
vstack.push(this.lexer.yytext);
lstack.push(this.lexer.yylloc);
stack.push(action[1]);
symbol=null;
if(!preErrorSymbol){
yyleng=this.lexer.yyleng;
yytext=this.lexer.yytext;
yylineno=this.lexer.yylineno;
yyloc=this.lexer.yylloc;
if(recovering > 0) recovering--;
}else{
symbol=preErrorSymbol;
preErrorSymbol=null;
}
break;
case 2:
len=this.productions_[action[1]][1];
yyval.$=vstack[vstack.length - len];
yyval._$={ first_line: lstack[lstack.length - (len||1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len||1)].first_column, last_column: lstack[lstack.length - 1].last_column };
if(ranges){
yyval._$.range=[lstack[lstack.length - (len||1)].range[0], lstack[lstack.length - 1].range[1]];
}
r=this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack);
if(typeof r!=="undefined"){
return r;
}
if(len){
stack=stack.slice(0, -1 * len * 2);
vstack=vstack.slice(0, -1 * len);
lstack=lstack.slice(0, -1 * len);
}
stack.push(this.productions_[action[1]][0]);
vstack.push(yyval.$);
lstack.push(yyval._$);
newState=table[stack[stack.length - 2]][stack[stack.length - 1]];
stack.push(newState);
break;
case 3:
return true;
}}
return true;
}};
var lexer=(function (){
var lexer={ EOF: 1,
parseError: function parseError(str, hash){
if(this.yy.parser){
this.yy.parser.parseError(str, hash);
}else{
throw new Error(str);
}},
setInput: function setInput(input){
this._input=input;
this._more=this._less=this.done=false;
this.yylineno=this.yyleng=0;
this.yytext=this.matched=this.match='';
this.conditionStack=['INITIAL'];
this.yylloc={ first_line: 1, first_column: 0, last_line: 1, last_column: 0 };
if(this.options.ranges) this.yylloc.range=[0, 0];
this.offset=0;
return this;
},
input: function input(){
var ch=this._input[0];
this.yytext +=ch;
this.yyleng++;
this.offset++;
this.match +=ch;
this.matched +=ch;
var lines=ch.match(/(?:\r\n?|\n).*/g);
if(lines){
this.yylineno++;
this.yylloc.last_line++;
}else{
this.yylloc.last_column++;
}
if(this.options.ranges) this.yylloc.range[1]++;
this._input=this._input.slice(1);
return ch;
},
unput: function unput(ch){
var len=ch.length;
var lines=ch.split(/(?:\r\n?|\n)/g);
this._input=ch + this._input;
this.yytext=this.yytext.substr(0, this.yytext.length - len - 1);
this.offset -=len;
var oldLines=this.match.split(/(?:\r\n?|\n)/g);
this.match=this.match.substr(0, this.match.length - 1);
this.matched=this.matched.substr(0, this.matched.length - 1);
if(lines.length - 1) this.yylineno -=lines.length - 1;
var r=this.yylloc.range;
this.yylloc={ first_line: this.yylloc.first_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.first_column,
last_column: lines ? (lines.length===oldLines.length ? this.yylloc.first_column:0) + oldLines[oldLines.length - lines.length].length - lines[0].length:this.yylloc.first_column - len
};
if(this.options.ranges){
this.yylloc.range=[r[0], r[0] + this.yyleng - len];
}
return this;
},
more: function more(){
this._more=true;
return this;
},
less: function less(n){
this.unput(this.match.slice(n));
},
pastInput: function pastInput(){
var past=this.matched.substr(0, this.matched.length - this.match.length);
return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
},
upcomingInput: function upcomingInput(){
var next=this.match;
if(next.length < 20){
next +=this._input.substr(0, 20 - next.length);
}
return (next.substr(0, 20) + (next.length > 20 ? '...':'')).replace(/\n/g, "");
},
showPosition: function showPosition(){
var pre=this.pastInput();
var c=new Array(pre.length + 1).join("-");
return pre + this.upcomingInput() + "\n" + c + "^";
},
next: function next(){
if(this.done){
return this.EOF;
}
if(!this._input) this.done=true;
var token, match, tempMatch, index, col, lines;
if(!this._more){
this.yytext='';
this.match='';
}
var rules=this._currentRules();
for (var i=0; i < rules.length; i++){
tempMatch=this._input.match(this.rules[rules[i]]);
if(tempMatch&&(!match||tempMatch[0].length > match[0].length)){
match=tempMatch;
index=i;
if(!this.options.flex) break;
}}
if(match){
lines=match[0].match(/(?:\r\n?|\n).*/g);
if(lines) this.yylineno +=lines.length;
this.yylloc={ first_line: this.yylloc.last_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.last_column,
last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length:this.yylloc.last_column + match[0].length };
this.yytext +=match[0];
this.match +=match[0];
this.matches=match;
this.yyleng=this.yytext.length;
if(this.options.ranges){
this.yylloc.range=[this.offset, this.offset +=this.yyleng];
}
this._more=false;
this._input=this._input.slice(match[0].length);
this.matched +=match[0];
token=this.performAction.call(this, this.yy, this, rules[index], this.conditionStack[this.conditionStack.length - 1]);
if(this.done&&this._input) this.done=false;
if(token) return token;else return;
}
if(this._input===""){
return this.EOF;
}else{
return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { text: "", token: null, line: this.yylineno });
}},
lex: function lex(){
var r=this.next();
if(typeof r!=='undefined'){
return r;
}else{
return this.lex();
}},
begin: function begin(condition){
this.conditionStack.push(condition);
},
popState: function popState(){
return this.conditionStack.pop();
},
_currentRules: function _currentRules(){
return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
},
topState: function topState(){
return this.conditionStack[this.conditionStack.length - 2];
},
pushState: function begin(condition){
this.begin(condition);
}};
lexer.options={};
lexer.performAction=function anonymous(yy, yy_, $avoiding_name_collisions, YY_START){
function strip(start, end){
return yy_.yytext=yy_.yytext.substring(start, yy_.yyleng - end + start);
}
var YYSTATE=YY_START;
switch ($avoiding_name_collisions){
case 0:
if(yy_.yytext.slice(-2)==="\\\\"){
strip(0, 1);
this.begin("mu");
}else if(yy_.yytext.slice(-1)==="\\"){
strip(0, 1);
this.begin("emu");
}else{
this.begin("mu");
}
if(yy_.yytext) return 15;
break;
case 1:
return 15;
break;
case 2:
this.popState();
return 15;
break;
case 3:
this.begin('raw');return 15;
break;
case 4:
this.popState();
if(this.conditionStack[this.conditionStack.length - 1]==='raw'){
return 15;
}else{
strip(5, 9);
return 'END_RAW_BLOCK';
}
break;
case 5:
return 15;
break;
case 6:
this.popState();
return 14;
break;
case 7:
return 65;
break;
case 8:
return 68;
break;
case 9:
return 19;
break;
case 10:
this.popState();
this.begin('raw');
return 23;
break;
case 11:
return 55;
break;
case 12:
return 60;
break;
case 13:
return 29;
break;
case 14:
return 47;
break;
case 15:
this.popState();return 44;
break;
case 16:
this.popState();return 44;
break;
case 17:
return 34;
break;
case 18:
return 39;
break;
case 19:
return 51;
break;
case 20:
return 48;
break;
case 21:
this.unput(yy_.yytext);
this.popState();
this.begin('com');
break;
case 22:
this.popState();
return 14;
break;
case 23:
return 48;
break;
case 24:
return 73;
break;
case 25:
return 72;
break;
case 26:
return 72;
break;
case 27:
return 87;
break;
case 28:
break;
case 29:
this.popState();return 54;
break;
case 30:
this.popState();return 33;
break;
case 31:
yy_.yytext=strip(1, 2).replace(/\\"/g, '"');return 80;
break;
case 32:
yy_.yytext=strip(1, 2).replace(/\\'/g, "'");return 80;
break;
case 33:
return 85;
break;
case 34:
return 82;
break;
case 35:
return 82;
break;
case 36:
return 83;
break;
case 37:
return 84;
break;
case 38:
return 81;
break;
case 39:
return 75;
break;
case 40:
return 77;
break;
case 41:
return 72;
break;
case 42:
yy_.yytext=yy_.yytext.replace(/\\([\\\]])/g, '$1');return 72;
break;
case 43:
return 'INVALID';
break;
case 44:
return 5;
break;
}};
lexer.rules=[/^(?:[^\x00]*?(?=(\{\{)))/, /^(?:[^\x00]+)/, /^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/, /^(?:\{\{\{\{(?=[^\/]))/, /^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/, /^(?:[^\x00]+?(?=(\{\{\{\{)))/, /^(?:[\s\S]*?--(~)?\}\})/, /^(?:\()/, /^(?:\))/, /^(?:\{\{\{\{)/, /^(?:\}\}\}\})/, /^(?:\{\{(~)?>)/, /^(?:\{\{(~)?#>)/, /^(?:\{\{(~)?#\*?)/, /^(?:\{\{(~)?\/)/, /^(?:\{\{(~)?\^\s*(~)?\}\})/, /^(?:\{\{(~)?\s*else\s*(~)?\}\})/, /^(?:\{\{(~)?\^)/, /^(?:\{\{(~)?\s*else\b)/, /^(?:\{\{(~)?\{)/, /^(?:\{\{(~)?&)/, /^(?:\{\{(~)?!--)/, /^(?:\{\{(~)?![\s\S]*?\}\})/, /^(?:\{\{(~)?\*?)/, /^(?:=)/, /^(?:\.\.)/, /^(?:\.(?=([=~}\s\/.)|])))/, /^(?:[\/.])/, /^(?:\s+)/, /^(?:\}(~)?\}\})/, /^(?:(~)?\}\})/, /^(?:"(\\["]|[^"])*")/, /^(?:'(\\[']|[^'])*')/, /^(?:@)/, /^(?:true(?=([~}\s)])))/, /^(?:false(?=([~}\s)])))/, /^(?:undefined(?=([~}\s)])))/, /^(?:null(?=([~}\s)])))/, /^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/, /^(?:as\s+\|)/, /^(?:\|)/, /^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/, /^(?:\[(\\\]|[^\]])*\])/, /^(?:.)/, /^(?:$)/];
lexer.conditions={ "mu": { "rules": [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44], "inclusive": false }, "emu": { "rules": [2], "inclusive": false }, "com": { "rules": [6], "inclusive": false }, "raw": { "rules": [3, 4, 5], "inclusive": false }, "INITIAL": { "rules": [0, 1, 44], "inclusive": true }};
return lexer;
})();
parser.lexer=lexer;
function Parser(){
this.yy={};}Parser.prototype=parser;parser.Parser=Parser;
return new Parser();
})();exports["default"]=handlebars;
module.exports=exports["default"];
}),
(function(module, exports, __webpack_require__){
'use strict';
var _interopRequireDefault=__webpack_require__(1)['default'];
exports.__esModule=true;
var _visitor=__webpack_require__(49);
var _visitor2=_interopRequireDefault(_visitor);
function WhitespaceControl(){
var options=arguments.length <=0||arguments[0]===undefined ? {}:arguments[0];
this.options=options;
}
WhitespaceControl.prototype=new _visitor2['default']();
WhitespaceControl.prototype.Program=function (program){
var doStandalone = !this.options.ignoreStandalone;
var isRoot = !this.isRootSeen;
this.isRootSeen=true;
var body=program.body;
for (var i=0, l=body.length; i < l; i++){
var current=body[i],
strip=this.accept(current);
if(!strip){
continue;
}
var _isPrevWhitespace=isPrevWhitespace(body, i, isRoot),
_isNextWhitespace=isNextWhitespace(body, i, isRoot),
openStandalone=strip.openStandalone&&_isPrevWhitespace,
closeStandalone=strip.closeStandalone&&_isNextWhitespace,
inlineStandalone=strip.inlineStandalone&&_isPrevWhitespace&&_isNextWhitespace;
if(strip.close){
omitRight(body, i, true);
}
if(strip.open){
omitLeft(body, i, true);
}
if(doStandalone&&inlineStandalone){
omitRight(body, i);
if(omitLeft(body, i)){
if(current.type==='PartialStatement'){
current.indent=/([ \t]+$)/.exec(body[i - 1].original)[1];
}}
}
if(doStandalone&&openStandalone){
omitRight((current.program||current.inverse).body);
omitLeft(body, i);
}
if(doStandalone&&closeStandalone){
omitRight(body, i);
omitLeft((current.inverse||current.program).body);
}}
return program;
};
WhitespaceControl.prototype.BlockStatement=WhitespaceControl.prototype.DecoratorBlock=WhitespaceControl.prototype.PartialBlockStatement=function (block){
this.accept(block.program);
this.accept(block.inverse);
var program=block.program||block.inverse,
inverse=block.program&&block.inverse,
firstInverse=inverse,
lastInverse=inverse;
if(inverse&&inverse.chained){
firstInverse=inverse.body[0].program;
while (lastInverse.chained){
lastInverse=lastInverse.body[lastInverse.body.length - 1].program;
}}
var strip={
open: block.openStrip.open,
close: block.closeStrip.close,
openStandalone: isNextWhitespace(program.body),
closeStandalone: isPrevWhitespace((firstInverse||program).body)
};
if(block.openStrip.close){
omitRight(program.body, null, true);
}
if(inverse){
var inverseStrip=block.inverseStrip;
if(inverseStrip.open){
omitLeft(program.body, null, true);
}
if(inverseStrip.close){
omitRight(firstInverse.body, null, true);
}
if(block.closeStrip.open){
omitLeft(lastInverse.body, null, true);
}
if(!this.options.ignoreStandalone&&isPrevWhitespace(program.body)&&isNextWhitespace(firstInverse.body)){
omitLeft(program.body);
omitRight(firstInverse.body);
}}else if(block.closeStrip.open){
omitLeft(program.body, null, true);
}
return strip;
};
WhitespaceControl.prototype.Decorator=WhitespaceControl.prototype.MustacheStatement=function (mustache){
return mustache.strip;
};
WhitespaceControl.prototype.PartialStatement=WhitespaceControl.prototype.CommentStatement=function (node){
var strip=node.strip||{};
return {
inlineStandalone: true,
open: strip.open,
close: strip.close
};};
function isPrevWhitespace(body, i, isRoot){
if(i===undefined){
i=body.length;
}
var prev=body[i - 1],
sibling=body[i - 2];
if(!prev){
return isRoot;
}
if(prev.type==='ContentStatement'){
return (sibling||!isRoot ? /\r?\n\s*?$/:/(^|\r?\n)\s*?$/).test(prev.original);
}}
function isNextWhitespace(body, i, isRoot){
if(i===undefined){
i=-1;
}
var next=body[i + 1],
sibling=body[i + 2];
if(!next){
return isRoot;
}
if(next.type==='ContentStatement'){
return (sibling||!isRoot ? /^\s*?\r?\n/:/^\s*?(\r?\n|$)/).test(next.original);
}}
function omitRight(body, i, multiple){
var current=body[i==null ? 0:i + 1];
if(!current||current.type!=='ContentStatement'||!multiple&&current.rightStripped){
return;
}
var original=current.value;
current.value=current.value.replace(multiple ? /^\s+/:/^[ \t]*\r?\n?/, '');
current.rightStripped=current.value!==original;
}
function omitLeft(body, i, multiple){
var current=body[i==null ? body.length - 1:i - 1];
if(!current||current.type!=='ContentStatement'||!multiple&&current.leftStripped){
return;
}
var original=current.value;
current.value=current.value.replace(multiple ? /\s+$/:/[ \t]+$/, '');
current.leftStripped=current.value!==original;
return current.leftStripped;
}
exports['default']=WhitespaceControl;
module.exports=exports['default'];
}),
(function(module, exports, __webpack_require__){
'use strict';
var _interopRequireDefault=__webpack_require__(1)['default'];
exports.__esModule=true;
var _exception=__webpack_require__(6);
var _exception2=_interopRequireDefault(_exception);
function Visitor(){
this.parents=[];
}
Visitor.prototype={
constructor: Visitor,
mutating: false,
acceptKey: function acceptKey(node, name){
var value=this.accept(node[name]);
if(this.mutating){
if(value&&!Visitor.prototype[value.type]){
throw new _exception2['default']('Unexpected node type "' + value.type + '" found when accepting ' + name + ' on ' + node.type);
}
node[name]=value;
}},
acceptRequired: function acceptRequired(node, name){
this.acceptKey(node, name);
if(!node[name]){
throw new _exception2['default'](node.type + ' requires ' + name);
}},
acceptArray: function acceptArray(array){
for (var i=0, l=array.length; i < l; i++){
this.acceptKey(array, i);
if(!array[i]){
array.splice(i, 1);
i--;
l--;
}}
},
accept: function accept(object){
if(!object){
return;
}
if(!this[object.type]){
throw new _exception2['default']('Unknown type: ' + object.type, object);
}
if(this.current){
this.parents.unshift(this.current);
}
this.current=object;
var ret=this[object.type](object);
this.current=this.parents.shift();
if(!this.mutating||ret){
return ret;
}else if(ret!==false){
return object;
}},
Program: function Program(program){
this.acceptArray(program.body);
},
MustacheStatement: visitSubExpression,
Decorator: visitSubExpression,
BlockStatement: visitBlock,
DecoratorBlock: visitBlock,
PartialStatement: visitPartial,
PartialBlockStatement: function PartialBlockStatement(partial){
visitPartial.call(this, partial);
this.acceptKey(partial, 'program');
},
ContentStatement: function ContentStatement() {},
CommentStatement: function CommentStatement() {},
SubExpression: visitSubExpression,
PathExpression: function PathExpression() {},
StringLiteral: function StringLiteral() {},
NumberLiteral: function NumberLiteral() {},
BooleanLiteral: function BooleanLiteral() {},
UndefinedLiteral: function UndefinedLiteral() {},
NullLiteral: function NullLiteral() {},
Hash: function Hash(hash){
this.acceptArray(hash.pairs);
},
HashPair: function HashPair(pair){
this.acceptRequired(pair, 'value');
}};
function visitSubExpression(mustache){
this.acceptRequired(mustache, 'path');
this.acceptArray(mustache.params);
this.acceptKey(mustache, 'hash');
}
function visitBlock(block){
visitSubExpression.call(this, block);
this.acceptKey(block, 'program');
this.acceptKey(block, 'inverse');
}
function visitPartial(partial){
this.acceptRequired(partial, 'name');
this.acceptArray(partial.params);
this.acceptKey(partial, 'hash');
}
exports['default']=Visitor;
module.exports=exports['default'];
}),
(function(module, exports, __webpack_require__){
'use strict';
var _interopRequireDefault=__webpack_require__(1)['default'];
exports.__esModule=true;
exports.SourceLocation=SourceLocation;
exports.id=id;
exports.stripFlags=stripFlags;
exports.stripComment=stripComment;
exports.preparePath=preparePath;
exports.prepareMustache=prepareMustache;
exports.prepareRawBlock=prepareRawBlock;
exports.prepareBlock=prepareBlock;
exports.prepareProgram=prepareProgram;
exports.preparePartialBlock=preparePartialBlock;
var _exception=__webpack_require__(6);
var _exception2=_interopRequireDefault(_exception);
function validateClose(open, close){
close=close.path ? close.path.original:close;
if(open.path.original!==close){
var errorNode={ loc: open.path.loc };
throw new _exception2['default'](open.path.original + " doesn't match " + close, errorNode);
}}
function SourceLocation(source, locInfo){
this.source=source;
this.start={
line: locInfo.first_line,
column: locInfo.first_column
};
this.end={
line: locInfo.last_line,
column: locInfo.last_column
};}
function id(token){
if(/^\[.*\]$/.test(token)){
return token.substring(1, token.length - 1);
}else{
return token;
}}
function stripFlags(open, close){
return {
open: open.charAt(2)==='~',
close: close.charAt(close.length - 3)==='~'
};}
function stripComment(comment){
return comment.replace(/^\{\{~?!-?-?/, '').replace(/-?-?~?\}\}$/, '');
}
function preparePath(data, parts, loc){
loc=this.locInfo(loc);
var original=data ? '@':'',
dig=[],
depth=0;
for (var i=0, l=parts.length; i < l; i++){
var part=parts[i].part,
isLiteral=parts[i].original!==part;
original +=(parts[i].separator||'') + part;
if(!isLiteral&&(part==='..'||part==='.'||part==='this')){
if(dig.length > 0){
throw new _exception2['default']('Invalid path: ' + original, { loc: loc });
}else if(part==='..'){
depth++;
}}else{
dig.push(part);
}}
return {
type: 'PathExpression',
data: data,
depth: depth,
parts: dig,
original: original,
loc: loc
};}
function prepareMustache(path, params, hash, open, strip, locInfo){
var escapeFlag=open.charAt(3)||open.charAt(2),
escaped=escapeFlag!=='{'&&escapeFlag!=='&';
var decorator=/\*/.test(open);
return {
type: decorator ? 'Decorator':'MustacheStatement',
path: path,
params: params,
hash: hash,
escaped: escaped,
strip: strip,
loc: this.locInfo(locInfo)
};}
function prepareRawBlock(openRawBlock, contents, close, locInfo){
validateClose(openRawBlock, close);
locInfo=this.locInfo(locInfo);
var program={
type: 'Program',
body: contents,
strip: {},
loc: locInfo
};
return {
type: 'BlockStatement',
path: openRawBlock.path,
params: openRawBlock.params,
hash: openRawBlock.hash,
program: program,
openStrip: {},
inverseStrip: {},
closeStrip: {},
loc: locInfo
};}
function prepareBlock(openBlock, program, inverseAndProgram, close, inverted, locInfo){
if(close&&close.path){
validateClose(openBlock, close);
}
var decorator=/\*/.test(openBlock.open);
program.blockParams=openBlock.blockParams;
var inverse=undefined,
inverseStrip=undefined;
if(inverseAndProgram){
if(decorator){
throw new _exception2['default']('Unexpected inverse block on decorator', inverseAndProgram);
}
if(inverseAndProgram.chain){
inverseAndProgram.program.body[0].closeStrip=close.strip;
}
inverseStrip=inverseAndProgram.strip;
inverse=inverseAndProgram.program;
}
if(inverted){
inverted=inverse;
inverse=program;
program=inverted;
}
return {
type: decorator ? 'DecoratorBlock':'BlockStatement',
path: openBlock.path,
params: openBlock.params,
hash: openBlock.hash,
program: program,
inverse: inverse,
openStrip: openBlock.strip,
inverseStrip: inverseStrip,
closeStrip: close&&close.strip,
loc: this.locInfo(locInfo)
};}
function prepareProgram(statements, loc){
if(!loc&&statements.length){
var firstLoc=statements[0].loc,
lastLoc=statements[statements.length - 1].loc;
if(firstLoc&&lastLoc){
loc={
source: firstLoc.source,
start: {
line: firstLoc.start.line,
column: firstLoc.start.column
},
end: {
line: lastLoc.end.line,
column: lastLoc.end.column
}};}}
return {
type: 'Program',
body: statements,
strip: {},
loc: loc
};}
function preparePartialBlock(open, program, close, locInfo){
validateClose(open, close);
return {
type: 'PartialBlockStatement',
name: open.path,
params: open.params,
hash: open.hash,
program: program,
openStrip: open.strip,
closeStrip: close&&close.strip,
loc: this.locInfo(locInfo)
};}
}),
(function(module, exports, __webpack_require__){
'use strict';
var _Object$create=__webpack_require__(34)['default'];
var _interopRequireDefault=__webpack_require__(1)['default'];
exports.__esModule=true;
exports.Compiler=Compiler;
exports.precompile=precompile;
exports.compile=compile;
var _exception=__webpack_require__(6);
var _exception2=_interopRequireDefault(_exception);
var _utils=__webpack_require__(5);
var _ast=__webpack_require__(45);
var _ast2=_interopRequireDefault(_ast);
var slice=[].slice;
function Compiler(){}
Compiler.prototype={
compiler: Compiler,
equals: function equals(other){
var len=this.opcodes.length;
if(other.opcodes.length!==len){
return false;
}
for (var i=0; i < len; i++){
var opcode=this.opcodes[i],
otherOpcode=other.opcodes[i];
if(opcode.opcode!==otherOpcode.opcode||!argEquals(opcode.args, otherOpcode.args)){
return false;
}}
len=this.children.length;
for (var i=0; i < len; i++){
if(!this.children[i].equals(other.children[i])){
return false;
}}
return true;
},
guid: 0,
compile: function compile(program, options){
this.sourceNode=[];
this.opcodes=[];
this.children=[];
this.options=options;
this.stringParams=options.stringParams;
this.trackIds=options.trackIds;
options.blockParams=options.blockParams||[];
options.knownHelpers=_utils.extend(_Object$create(null), {
helperMissing: true,
blockHelperMissing: true,
each: true,
'if': true,
unless: true,
'with': true,
log: true,
lookup: true
}, options.knownHelpers);
return this.accept(program);
},
compileProgram: function compileProgram(program){
var childCompiler=new this.compiler(),
result=childCompiler.compile(program, this.options),
guid=this.guid++;
this.usePartial=this.usePartial||result.usePartial;
this.children[guid]=result;
this.useDepths=this.useDepths||result.useDepths;
return guid;
},
accept: function accept(node){
if(!this[node.type]){
throw new _exception2['default']('Unknown type: ' + node.type, node);
}
this.sourceNode.unshift(node);
var ret=this[node.type](node);
this.sourceNode.shift();
return ret;
},
Program: function Program(program){
this.options.blockParams.unshift(program.blockParams);
var body=program.body,
bodyLength=body.length;
for (var i=0; i < bodyLength; i++){
this.accept(body[i]);
}
this.options.blockParams.shift();
this.isSimple=bodyLength===1;
this.blockParams=program.blockParams ? program.blockParams.length:0;
return this;
},
BlockStatement: function BlockStatement(block){
transformLiteralToPath(block);
var program=block.program,
inverse=block.inverse;
program=program&&this.compileProgram(program);
inverse=inverse&&this.compileProgram(inverse);
var type=this.classifySexpr(block);
if(type==='helper'){
this.helperSexpr(block, program, inverse);
}else if(type==='simple'){
this.simpleSexpr(block);
this.opcode('pushProgram', program);
this.opcode('pushProgram', inverse);
this.opcode('emptyHash');
this.opcode('blockValue', block.path.original);
}else{
this.ambiguousSexpr(block, program, inverse);
this.opcode('pushProgram', program);
this.opcode('pushProgram', inverse);
this.opcode('emptyHash');
this.opcode('ambiguousBlockValue');
}
this.opcode('append');
},
DecoratorBlock: function DecoratorBlock(decorator){
var program=decorator.program&&this.compileProgram(decorator.program);
var params=this.setupFullMustacheParams(decorator, program, undefined),
path=decorator.path;
this.useDecorators=true;
this.opcode('registerDecorator', params.length, path.original);
},
PartialStatement: function PartialStatement(partial){
this.usePartial=true;
var program=partial.program;
if(program){
program=this.compileProgram(partial.program);
}
var params=partial.params;
if(params.length > 1){
throw new _exception2['default']('Unsupported number of partial arguments: ' + params.length, partial);
}else if(!params.length){
if(this.options.explicitPartialContext){
this.opcode('pushLiteral', 'undefined');
}else{
params.push({ type: 'PathExpression', parts: [], depth: 0 });
}}
var partialName=partial.name.original,
isDynamic=partial.name.type==='SubExpression';
if(isDynamic){
this.accept(partial.name);
}
this.setupFullMustacheParams(partial, program, undefined, true);
var indent=partial.indent||'';
if(this.options.preventIndent&&indent){
this.opcode('appendContent', indent);
indent='';
}
this.opcode('invokePartial', isDynamic, partialName, indent);
this.opcode('append');
},
PartialBlockStatement: function PartialBlockStatement(partialBlock){
this.PartialStatement(partialBlock);
},
MustacheStatement: function MustacheStatement(mustache){
this.SubExpression(mustache);
if(mustache.escaped&&!this.options.noEscape){
this.opcode('appendEscaped');
}else{
this.opcode('append');
}},
Decorator: function Decorator(decorator){
this.DecoratorBlock(decorator);
},
ContentStatement: function ContentStatement(content){
if(content.value){
this.opcode('appendContent', content.value);
}},
CommentStatement: function CommentStatement(){},
SubExpression: function SubExpression(sexpr){
transformLiteralToPath(sexpr);
var type=this.classifySexpr(sexpr);
if(type==='simple'){
this.simpleSexpr(sexpr);
}else if(type==='helper'){
this.helperSexpr(sexpr);
}else{
this.ambiguousSexpr(sexpr);
}},
ambiguousSexpr: function ambiguousSexpr(sexpr, program, inverse){
var path=sexpr.path,
name=path.parts[0],
isBlock=program!=null||inverse!=null;
this.opcode('getContext', path.depth);
this.opcode('pushProgram', program);
this.opcode('pushProgram', inverse);
path.strict=true;
this.accept(path);
this.opcode('invokeAmbiguous', name, isBlock);
},
simpleSexpr: function simpleSexpr(sexpr){
var path=sexpr.path;
path.strict=true;
this.accept(path);
this.opcode('resolvePossibleLambda');
},
helperSexpr: function helperSexpr(sexpr, program, inverse){
var params=this.setupFullMustacheParams(sexpr, program, inverse),
path=sexpr.path,
name=path.parts[0];
if(this.options.knownHelpers[name]){
this.opcode('invokeKnownHelper', params.length, name);
}else if(this.options.knownHelpersOnly){
throw new _exception2['default']('You specified knownHelpersOnly, but used the unknown helper ' + name, sexpr);
}else{
path.strict=true;
path.falsy=true;
this.accept(path);
this.opcode('invokeHelper', params.length, path.original, _ast2['default'].helpers.simpleId(path));
}},
PathExpression: function PathExpression(path){
this.addDepth(path.depth);
this.opcode('getContext', path.depth);
var name=path.parts[0],
scoped=_ast2['default'].helpers.scopedId(path),
blockParamId = !path.depth&&!scoped&&this.blockParamIndex(name);
if(blockParamId){
this.opcode('lookupBlockParam', blockParamId, path.parts);
}else if(!name){
this.opcode('pushContext');
}else if(path.data){
this.options.data=true;
this.opcode('lookupData', path.depth, path.parts, path.strict);
}else{
this.opcode('lookupOnContext', path.parts, path.falsy, path.strict, scoped);
}},
StringLiteral: function StringLiteral(string){
this.opcode('pushString', string.value);
},
NumberLiteral: function NumberLiteral(number){
this.opcode('pushLiteral', number.value);
},
BooleanLiteral: function BooleanLiteral(bool){
this.opcode('pushLiteral', bool.value);
},
UndefinedLiteral: function UndefinedLiteral(){
this.opcode('pushLiteral', 'undefined');
},
NullLiteral: function NullLiteral(){
this.opcode('pushLiteral', 'null');
},
Hash: function Hash(hash){
var pairs=hash.pairs,
i=0,
l=pairs.length;
this.opcode('pushHash');
for (; i < l; i++){
this.pushParam(pairs[i].value);
}
while (i--){
this.opcode('assignToHash', pairs[i].key);
}
this.opcode('popHash');
},
opcode: function opcode(name){
this.opcodes.push({
opcode: name,
args: slice.call(arguments, 1),
loc: this.sourceNode[0].loc
});
},
addDepth: function addDepth(depth){
if(!depth){
return;
}
this.useDepths=true;
},
classifySexpr: function classifySexpr(sexpr){
var isSimple=_ast2['default'].helpers.simpleId(sexpr.path);
var isBlockParam=isSimple&&!!this.blockParamIndex(sexpr.path.parts[0]);
var isHelper = !isBlockParam&&_ast2['default'].helpers.helperExpression(sexpr);
var isEligible = !isBlockParam&&(isHelper||isSimple);
if(isEligible&&!isHelper){
var _name=sexpr.path.parts[0],
options=this.options;
if(options.knownHelpers[_name]){
isHelper=true;
}else if(options.knownHelpersOnly){
isEligible=false;
}}
if(isHelper){
return 'helper';
}else if(isEligible){
return 'ambiguous';
}else{
return 'simple';
}},
pushParams: function pushParams(params){
for (var i=0, l=params.length; i < l; i++){
this.pushParam(params[i]);
}},
pushParam: function pushParam(val){
var value=val.value!=null ? val.value:val.original||'';
if(this.stringParams){
if(value.replace){
value=value.replace(/^(\.?\.\/)*/g, '').replace(/\//g, '.');
}
if(val.depth){
this.addDepth(val.depth);
}
this.opcode('getContext', val.depth||0);
this.opcode('pushStringParam', value, val.type);
if(val.type==='SubExpression'){
this.accept(val);
}}else{
if(this.trackIds){
var blockParamIndex=undefined;
if(val.parts&&!_ast2['default'].helpers.scopedId(val)&&!val.depth){
blockParamIndex=this.blockParamIndex(val.parts[0]);
}
if(blockParamIndex){
var blockParamChild=val.parts.slice(1).join('.');
this.opcode('pushId', 'BlockParam', blockParamIndex, blockParamChild);
}else{
value=val.original||value;
if(value.replace){
value=value.replace(/^this(?:\.|$)/, '').replace(/^\.\//, '').replace(/^\.$/, '');
}
this.opcode('pushId', val.type, value);
}}
this.accept(val);
}},
setupFullMustacheParams: function setupFullMustacheParams(sexpr, program, inverse, omitEmpty){
var params=sexpr.params;
this.pushParams(params);
this.opcode('pushProgram', program);
this.opcode('pushProgram', inverse);
if(sexpr.hash){
this.accept(sexpr.hash);
}else{
this.opcode('emptyHash', omitEmpty);
}
return params;
},
blockParamIndex: function blockParamIndex(name){
for (var depth=0, len=this.options.blockParams.length; depth < len; depth++){
var blockParams=this.options.blockParams[depth],
param=blockParams&&_utils.indexOf(blockParams, name);
if(blockParams&&param >=0){
return [depth, param];
}}
}};
function precompile(input, options, env){
if(input==null||typeof input!=='string'&&input.type!=='Program'){
throw new _exception2['default']('You must pass a string or Handlebars AST to Handlebars.precompile. You passed ' + input);
}
options=options||{};
if(!('data' in options)){
options.data=true;
}
if(options.compat){
options.useDepths=true;
}
var ast=env.parse(input, options),
environment=new env.Compiler().compile(ast, options);
return new env.JavaScriptCompiler().compile(environment, options);
}
function compile(input, options, env){
if(options===undefined) options={};
if(input==null||typeof input!=='string'&&input.type!=='Program'){
throw new _exception2['default']('You must pass a string or Handlebars AST to Handlebars.compile. You passed ' + input);
}
options=_utils.extend({}, options);
if(!('data' in options)){
options.data=true;
}
if(options.compat){
options.useDepths=true;
}
var compiled=undefined;
function compileInput(){
var ast=env.parse(input, options),
environment=new env.Compiler().compile(ast, options),
templateSpec=new env.JavaScriptCompiler().compile(environment, options, undefined, true);
return env.template(templateSpec);
}
function ret(context, execOptions){
if(!compiled){
compiled=compileInput();
}
return compiled.call(this, context, execOptions);
}
ret._setup=function (setupOptions){
if(!compiled){
compiled=compileInput();
}
return compiled._setup(setupOptions);
};
ret._child=function (i, data, blockParams, depths){
if(!compiled){
compiled=compileInput();
}
return compiled._child(i, data, blockParams, depths);
};
return ret;
}
function argEquals(a, b){
if(a===b){
return true;
}
if(_utils.isArray(a)&&_utils.isArray(b)&&a.length===b.length){
for (var i=0; i < a.length; i++){
if(!argEquals(a[i], b[i])){
return false;
}}
return true;
}}
function transformLiteralToPath(sexpr){
if(!sexpr.path.parts){
var literal=sexpr.path;
sexpr.path={
type: 'PathExpression',
data: false,
depth: 0,
parts: [literal.original + ''],
original: literal.original + '',
loc: literal.loc
};}}
}),
(function(module, exports, __webpack_require__){
'use strict';
var _Object$keys=__webpack_require__(13)['default'];
var _interopRequireDefault=__webpack_require__(1)['default'];
exports.__esModule=true;
var _base=__webpack_require__(4);
var _exception=__webpack_require__(6);
var _exception2=_interopRequireDefault(_exception);
var _utils=__webpack_require__(5);
var _codeGen=__webpack_require__(53);
var _codeGen2=_interopRequireDefault(_codeGen);
function Literal(value){
this.value=value;
}
function JavaScriptCompiler(){}
JavaScriptCompiler.prototype={
nameLookup: function nameLookup(parent, name ){
return this.internalNameLookup(parent, name);
},
depthedLookup: function depthedLookup(name){
return [this.aliasable('container.lookup'), '(depths, ', JSON.stringify(name), ')'];
},
compilerInfo: function compilerInfo(){
var revision=_base.COMPILER_REVISION,
versions=_base.REVISION_CHANGES[revision];
return [revision, versions];
},
appendToBuffer: function appendToBuffer(source, location, explicit){
if(!_utils.isArray(source)){
source=[source];
}
source=this.source.wrap(source, location);
if(this.environment.isSimple){
return ['return ', source, ';'];
}else if(explicit){
return ['buffer +=', source, ';'];
}else{
source.appendToBuffer=true;
return source;
}},
initializeBuffer: function initializeBuffer(){
return this.quotedString('');
},
internalNameLookup: function internalNameLookup(parent, name){
this.lookupPropertyFunctionIsUsed=true;
return ['lookupProperty(', parent, ',', JSON.stringify(name), ')'];
},
lookupPropertyFunctionIsUsed: false,
compile: function compile(environment, options, context, asObject){
this.environment=environment;
this.options=options;
this.stringParams=this.options.stringParams;
this.trackIds=this.options.trackIds;
this.precompile = !asObject;
this.name=this.environment.name;
this.isChild = !!context;
this.context=context||{
decorators: [],
programs: [],
environments: []
};
this.preamble();
this.stackSlot=0;
this.stackVars=[];
this.aliases={};
this.registers={ list: [] };
this.hashes=[];
this.compileStack=[];
this.inlineStack=[];
this.blockParams=[];
this.compileChildren(environment, options);
this.useDepths=this.useDepths||environment.useDepths||environment.useDecorators||this.options.compat;
this.useBlockParams=this.useBlockParams||environment.useBlockParams;
var opcodes=environment.opcodes,
opcode=undefined,
firstLoc=undefined,
i=undefined,
l=undefined;
for (i=0, l=opcodes.length; i < l; i++){
opcode=opcodes[i];
this.source.currentLocation=opcode.loc;
firstLoc=firstLoc||opcode.loc;
this[opcode.opcode].apply(this, opcode.args);
}
this.source.currentLocation=firstLoc;
this.pushSource('');
if(this.stackSlot||this.inlineStack.length||this.compileStack.length){
throw new _exception2['default']('Compile completed with content left on stack');
}
if(!this.decorators.isEmpty()){
this.useDecorators=true;
this.decorators.prepend(['var decorators=container.decorators, ', this.lookupPropertyFunctionVarDeclaration(), ';\n']);
this.decorators.push('return fn;');
if(asObject){
this.decorators=Function.apply(this, ['fn', 'props', 'container', 'depth0', 'data', 'blockParams', 'depths', this.decorators.merge()]);
}else{
this.decorators.prepend('function(fn, props, container, depth0, data, blockParams, depths){\n');
this.decorators.push('}\n');
this.decorators=this.decorators.merge();
}}else{
this.decorators=undefined;
}
var fn=this.createFunctionContext(asObject);
if(!this.isChild){
var ret={
compiler: this.compilerInfo(),
main: fn
};
if(this.decorators){
ret.main_d=this.decorators;
ret.useDecorators=true;
}
var _context=this.context;
var programs=_context.programs;
var decorators=_context.decorators;
for (i=0, l=programs.length; i < l; i++){
if(programs[i]){
ret[i]=programs[i];
if(decorators[i]){
ret[i + '_d']=decorators[i];
ret.useDecorators=true;
}}
}
if(this.environment.usePartial){
ret.usePartial=true;
}
if(this.options.data){
ret.useData=true;
}
if(this.useDepths){
ret.useDepths=true;
}
if(this.useBlockParams){
ret.useBlockParams=true;
}
if(this.options.compat){
ret.compat=true;
}
if(!asObject){
ret.compiler=JSON.stringify(ret.compiler);
this.source.currentLocation={ start: { line: 1, column: 0 }};
ret=this.objectLiteral(ret);
if(options.srcName){
ret=ret.toStringWithSourceMap({ file: options.destName });
ret.map=ret.map&&ret.map.toString();
}else{
ret=ret.toString();
}}else{
ret.compilerOptions=this.options;
}
return ret;
}else{
return fn;
}},
preamble: function preamble(){
this.lastContext=0;
this.source=new _codeGen2['default'](this.options.srcName);
this.decorators=new _codeGen2['default'](this.options.srcName);
},
createFunctionContext: function createFunctionContext(asObject){
var _this=this;
var varDeclarations='';
var locals=this.stackVars.concat(this.registers.list);
if(locals.length > 0){
varDeclarations +=', ' + locals.join(', ');
}
var aliasCount=0;
_Object$keys(this.aliases).forEach(function (alias){
var node=_this.aliases[alias];
if(node.children&&node.referenceCount > 1){
varDeclarations +=', alias' + ++aliasCount + '=' + alias;
node.children[0]='alias' + aliasCount;
}});
if(this.lookupPropertyFunctionIsUsed){
varDeclarations +=', ' + this.lookupPropertyFunctionVarDeclaration();
}
var params=['container', 'depth0', 'helpers', 'partials', 'data'];
if(this.useBlockParams||this.useDepths){
params.push('blockParams');
}
if(this.useDepths){
params.push('depths');
}
var source=this.mergeSource(varDeclarations);
if(asObject){
params.push(source);
return Function.apply(this, params);
}else{
return this.source.wrap(['function(', params.join(','), '){\n  ', source, '}']);
}},
mergeSource: function mergeSource(varDeclarations){
var isSimple=this.environment.isSimple,
appendOnly = !this.forceBuffer,
appendFirst=undefined,
sourceSeen=undefined,
bufferStart=undefined,
bufferEnd=undefined;
this.source.each(function (line){
if(line.appendToBuffer){
if(bufferStart){
line.prepend('  + ');
}else{
bufferStart=line;
}
bufferEnd=line;
}else{
if(bufferStart){
if(!sourceSeen){
appendFirst=true;
}else{
bufferStart.prepend('buffer +=');
}
bufferEnd.add(';');
bufferStart=bufferEnd=undefined;
}
sourceSeen=true;
if(!isSimple){
appendOnly=false;
}}
});
if(appendOnly){
if(bufferStart){
bufferStart.prepend('return ');
bufferEnd.add(';');
}else if(!sourceSeen){
this.source.push('return "";');
}}else{
varDeclarations +=', buffer=' + (appendFirst ? '':this.initializeBuffer());
if(bufferStart){
bufferStart.prepend('return buffer + ');
bufferEnd.add(';');
}else{
this.source.push('return buffer;');
}}
if(varDeclarations){
this.source.prepend('var ' + varDeclarations.substring(2) + (appendFirst ? '':';\n'));
}
return this.source.merge();
},
lookupPropertyFunctionVarDeclaration: function lookupPropertyFunctionVarDeclaration(){
return '\n      lookupProperty=container.lookupProperty||function(parent, propertyName){\n        if(Object.prototype.hasOwnProperty.call(parent, propertyName)){\n          return parent[propertyName];\n        }\n        return undefined\n    }\n    '.trim();
},
blockValue: function blockValue(name){
var blockHelperMissing=this.aliasable('container.hooks.blockHelperMissing'),
params=[this.contextName(0)];
this.setupHelperArgs(name, 0, params);
var blockName=this.popStack();
params.splice(1, 0, blockName);
this.push(this.source.functionCall(blockHelperMissing, 'call', params));
},
ambiguousBlockValue: function ambiguousBlockValue(){
var blockHelperMissing=this.aliasable('container.hooks.blockHelperMissing'),
params=[this.contextName(0)];
this.setupHelperArgs('', 0, params, true);
this.flushInline();
var current=this.topStack();
params.splice(1, 0, current);
this.pushSource(['if(!', this.lastHelper, '){ ', current, '=', this.source.functionCall(blockHelperMissing, 'call', params), '}']);
},
appendContent: function appendContent(content){
if(this.pendingContent){
content=this.pendingContent + content;
}else{
this.pendingLocation=this.source.currentLocation;
}
this.pendingContent=content;
},
append: function append(){
if(this.isInline()){
this.replaceStack(function (current){
return ['!=null ? ', current, ':""'];
});
this.pushSource(this.appendToBuffer(this.popStack()));
}else{
var local=this.popStack();
this.pushSource(['if(', local, '!=null){ ', this.appendToBuffer(local, undefined, true), ' }']);
if(this.environment.isSimple){
this.pushSource(['else { ', this.appendToBuffer("''", undefined, true), ' }']);
}}
},
appendEscaped: function appendEscaped(){
this.pushSource(this.appendToBuffer([this.aliasable('container.escapeExpression'), '(', this.popStack(), ')']));
},
getContext: function getContext(depth){
this.lastContext=depth;
},
pushContext: function pushContext(){
this.pushStackLiteral(this.contextName(this.lastContext));
},
lookupOnContext: function lookupOnContext(parts, falsy, strict, scoped){
var i=0;
if(!scoped&&this.options.compat&&!this.lastContext){
this.push(this.depthedLookup(parts[i++]));
}else{
this.pushContext();
}
this.resolvePath('context', parts, i, falsy, strict);
},
lookupBlockParam: function lookupBlockParam(blockParamId, parts){
this.useBlockParams=true;
this.push(['blockParams[', blockParamId[0], '][', blockParamId[1], ']']);
this.resolvePath('context', parts, 1);
},
lookupData: function lookupData(depth, parts, strict){
if(!depth){
this.pushStackLiteral('data');
}else{
this.pushStackLiteral('container.data(data, ' + depth + ')');
}
this.resolvePath('data', parts, 0, true, strict);
},
resolvePath: function resolvePath(type, parts, i, falsy, strict){
var _this2=this;
if(this.options.strict||this.options.assumeObjects){
this.push(strictLookup(this.options.strict&&strict, this, parts, type));
return;
}
var len=parts.length;
for (; i < len; i++){
this.replaceStack(function (current){
var lookup=_this2.nameLookup(current, parts[i], type);
if(!falsy){
return ['!=null ? ', lookup, ':', current];
}else{
return ['&&', lookup];
}});
}},
resolvePossibleLambda: function resolvePossibleLambda(){
this.push([this.aliasable('container.lambda'), '(', this.popStack(), ', ', this.contextName(0), ')']);
},
pushStringParam: function pushStringParam(string, type){
this.pushContext();
this.pushString(type);
if(type!=='SubExpression'){
if(typeof string==='string'){
this.pushString(string);
}else{
this.pushStackLiteral(string);
}}
},
emptyHash: function emptyHash(omitEmpty){
if(this.trackIds){
this.push('{}');
}
if(this.stringParams){
this.push('{}');
this.push('{}');
}
this.pushStackLiteral(omitEmpty ? 'undefined':'{}');
},
pushHash: function pushHash(){
if(this.hash){
this.hashes.push(this.hash);
}
this.hash={ values: {}, types: [], contexts: [], ids: [] };},
popHash: function popHash(){
var hash=this.hash;
this.hash=this.hashes.pop();
if(this.trackIds){
this.push(this.objectLiteral(hash.ids));
}
if(this.stringParams){
this.push(this.objectLiteral(hash.contexts));
this.push(this.objectLiteral(hash.types));
}
this.push(this.objectLiteral(hash.values));
},
pushString: function pushString(string){
this.pushStackLiteral(this.quotedString(string));
},
pushLiteral: function pushLiteral(value){
this.pushStackLiteral(value);
},
pushProgram: function pushProgram(guid){
if(guid!=null){
this.pushStackLiteral(this.programExpression(guid));
}else{
this.pushStackLiteral(null);
}},
registerDecorator: function registerDecorator(paramSize, name){
var foundDecorator=this.nameLookup('decorators', name, 'decorator'),
options=this.setupHelperArgs(name, paramSize);
this.decorators.push(['fn=', this.decorators.functionCall(foundDecorator, '', ['fn', 'props', 'container', options]), '||fn;']);
},
invokeHelper: function invokeHelper(paramSize, name, isSimple){
var nonHelper=this.popStack(),
helper=this.setupHelper(paramSize, name);
var possibleFunctionCalls=[];
if(isSimple){
possibleFunctionCalls.push(helper.name);
}
possibleFunctionCalls.push(nonHelper);
if(!this.options.strict){
possibleFunctionCalls.push(this.aliasable('container.hooks.helperMissing'));
}
var functionLookupCode=['(', this.itemsSeparatedBy(possibleFunctionCalls, '||'), ')'];
var functionCall=this.source.functionCall(functionLookupCode, 'call', helper.callParams);
this.push(functionCall);
},
itemsSeparatedBy: function itemsSeparatedBy(items, separator){
var result=[];
result.push(items[0]);
for (var i=1; i < items.length; i++){
result.push(separator, items[i]);
}
return result;
},
invokeKnownHelper: function invokeKnownHelper(paramSize, name){
var helper=this.setupHelper(paramSize, name);
this.push(this.source.functionCall(helper.name, 'call', helper.callParams));
},
invokeAmbiguous: function invokeAmbiguous(name, helperCall){
this.useRegister('helper');
var nonHelper=this.popStack();
this.emptyHash();
var helper=this.setupHelper(0, name, helperCall);
var helperName=this.lastHelper=this.nameLookup('helpers', name, 'helper');
var lookup=['(', '(helper=', helperName, '||', nonHelper, ')'];
if(!this.options.strict){
lookup[0]='(helper=';
lookup.push('!=null ? helper:', this.aliasable('container.hooks.helperMissing'));
}
this.push(['(', lookup, helper.paramsInit ? ['),(', helper.paramsInit]:[], '),', '(typeof helper===', this.aliasable('"function"'), ' ? ', this.source.functionCall('helper', 'call', helper.callParams), ':helper))']);
},
invokePartial: function invokePartial(isDynamic, name, indent){
var params=[],
options=this.setupParams(name, 1, params);
if(isDynamic){
name=this.popStack();
delete options.name;
}
if(indent){
options.indent=JSON.stringify(indent);
}
options.helpers='helpers';
options.partials='partials';
options.decorators='container.decorators';
if(!isDynamic){
params.unshift(this.nameLookup('partials', name, 'partial'));
}else{
params.unshift(name);
}
if(this.options.compat){
options.depths='depths';
}
options=this.objectLiteral(options);
params.push(options);
this.push(this.source.functionCall('container.invokePartial', '', params));
},
assignToHash: function assignToHash(key){
var value=this.popStack(),
context=undefined,
type=undefined,
id=undefined;
if(this.trackIds){
id=this.popStack();
}
if(this.stringParams){
type=this.popStack();
context=this.popStack();
}
var hash=this.hash;
if(context){
hash.contexts[key]=context;
}
if(type){
hash.types[key]=type;
}
if(id){
hash.ids[key]=id;
}
hash.values[key]=value;
},
pushId: function pushId(type, name, child){
if(type==='BlockParam'){
this.pushStackLiteral('blockParams[' + name[0] + '].path[' + name[1] + ']' + (child ? ' + ' + JSON.stringify('.' + child):''));
}else if(type==='PathExpression'){
this.pushString(name);
}else if(type==='SubExpression'){
this.pushStackLiteral('true');
}else{
this.pushStackLiteral('null');
}},
compiler: JavaScriptCompiler,
compileChildren: function compileChildren(environment, options){
var children=environment.children,
child=undefined,
compiler=undefined;
for (var i=0, l=children.length; i < l; i++){
child=children[i];
compiler=new this.compiler();
var existing=this.matchExistingProgram(child);
if(existing==null){
this.context.programs.push('');
var index=this.context.programs.length;
child.index=index;
child.name='program' + index;
this.context.programs[index]=compiler.compile(child, options, this.context, !this.precompile);
this.context.decorators[index]=compiler.decorators;
this.context.environments[index]=child;
this.useDepths=this.useDepths||compiler.useDepths;
this.useBlockParams=this.useBlockParams||compiler.useBlockParams;
child.useDepths=this.useDepths;
child.useBlockParams=this.useBlockParams;
}else{
child.index=existing.index;
child.name='program' + existing.index;
this.useDepths=this.useDepths||existing.useDepths;
this.useBlockParams=this.useBlockParams||existing.useBlockParams;
}}
},
matchExistingProgram: function matchExistingProgram(child){
for (var i=0, len=this.context.environments.length; i < len; i++){
var environment=this.context.environments[i];
if(environment&&environment.equals(child)){
return environment;
}}
},
programExpression: function programExpression(guid){
var child=this.environment.children[guid],
programParams=[child.index, 'data', child.blockParams];
if(this.useBlockParams||this.useDepths){
programParams.push('blockParams');
}
if(this.useDepths){
programParams.push('depths');
}
return 'container.program(' + programParams.join(', ') + ')';
},
useRegister: function useRegister(name){
if(!this.registers[name]){
this.registers[name]=true;
this.registers.list.push(name);
}},
push: function push(expr){
if(!(expr instanceof Literal)){
expr=this.source.wrap(expr);
}
this.inlineStack.push(expr);
return expr;
},
pushStackLiteral: function pushStackLiteral(item){
this.push(new Literal(item));
},
pushSource: function pushSource(source){
if(this.pendingContent){
this.source.push(this.appendToBuffer(this.source.quotedString(this.pendingContent), this.pendingLocation));
this.pendingContent=undefined;
}
if(source){
this.source.push(source);
}},
replaceStack: function replaceStack(callback){
var prefix=['('],
stack=undefined,
createdStack=undefined,
usedLiteral=undefined;
if(!this.isInline()){
throw new _exception2['default']('replaceStack on non-inline');
}
var top=this.popStack(true);
if(top instanceof Literal){
stack=[top.value];
prefix=['(', stack];
usedLiteral=true;
}else{
createdStack=true;
var _name=this.incrStack();
prefix=['((', this.push(_name), '=', top, ')'];
stack=this.topStack();
}
var item=callback.call(this, stack);
if(!usedLiteral){
this.popStack();
}
if(createdStack){
this.stackSlot--;
}
this.push(prefix.concat(item, ')'));
},
incrStack: function incrStack(){
this.stackSlot++;
if(this.stackSlot > this.stackVars.length){
this.stackVars.push('stack' + this.stackSlot);
}
return this.topStackName();
},
topStackName: function topStackName(){
return 'stack' + this.stackSlot;
},
flushInline: function flushInline(){
var inlineStack=this.inlineStack;
this.inlineStack=[];
for (var i=0, len=inlineStack.length; i < len; i++){
var entry=inlineStack[i];
if(entry instanceof Literal){
this.compileStack.push(entry);
}else{
var stack=this.incrStack();
this.pushSource([stack, '=', entry, ';']);
this.compileStack.push(stack);
}}
},
isInline: function isInline(){
return this.inlineStack.length;
},
popStack: function popStack(wrapped){
var inline=this.isInline(),
item=(inline ? this.inlineStack:this.compileStack).pop();
if(!wrapped&&item instanceof Literal){
return item.value;
}else{
if(!inline){
if(!this.stackSlot){
throw new _exception2['default']('Invalid stack pop');
}
this.stackSlot--;
}
return item;
}},
topStack: function topStack(){
var stack=this.isInline() ? this.inlineStack:this.compileStack,
item=stack[stack.length - 1];
if(item instanceof Literal){
return item.value;
}else{
return item;
}},
contextName: function contextName(context){
if(this.useDepths&&context){
return 'depths[' + context + ']';
}else{
return 'depth' + context;
}},
quotedString: function quotedString(str){
return this.source.quotedString(str);
},
objectLiteral: function objectLiteral(obj){
return this.source.objectLiteral(obj);
},
aliasable: function aliasable(name){
var ret=this.aliases[name];
if(ret){
ret.referenceCount++;
return ret;
}
ret=this.aliases[name]=this.source.wrap(name);
ret.aliasable=true;
ret.referenceCount=1;
return ret;
},
setupHelper: function setupHelper(paramSize, name, blockHelper){
var params=[],
paramsInit=this.setupHelperArgs(name, paramSize, params, blockHelper);
var foundHelper=this.nameLookup('helpers', name, 'helper'),
callContext=this.aliasable(this.contextName(0) + '!=null ? ' + this.contextName(0) + ':(container.nullContext||{})');
return {
params: params,
paramsInit: paramsInit,
name: foundHelper,
callParams: [callContext].concat(params)
};},
setupParams: function setupParams(helper, paramSize, params){
var options={},
contexts=[],
types=[],
ids=[],
objectArgs = !params,
param=undefined;
if(objectArgs){
params=[];
}
options.name=this.quotedString(helper);
options.hash=this.popStack();
if(this.trackIds){
options.hashIds=this.popStack();
}
if(this.stringParams){
options.hashTypes=this.popStack();
options.hashContexts=this.popStack();
}
var inverse=this.popStack(),
program=this.popStack();
if(program||inverse){
options.fn=program||'container.noop';
options.inverse=inverse||'container.noop';
}
var i=paramSize;
while (i--){
param=this.popStack();
params[i]=param;
if(this.trackIds){
ids[i]=this.popStack();
}
if(this.stringParams){
types[i]=this.popStack();
contexts[i]=this.popStack();
}}
if(objectArgs){
options.args=this.source.generateArray(params);
}
if(this.trackIds){
options.ids=this.source.generateArray(ids);
}
if(this.stringParams){
options.types=this.source.generateArray(types);
options.contexts=this.source.generateArray(contexts);
}
if(this.options.data){
options.data='data';
}
if(this.useBlockParams){
options.blockParams='blockParams';
}
return options;
},
setupHelperArgs: function setupHelperArgs(helper, paramSize, params, useRegister){
var options=this.setupParams(helper, paramSize, params);
options.loc=JSON.stringify(this.source.currentLocation);
options=this.objectLiteral(options);
if(useRegister){
this.useRegister('options');
params.push('options');
return ['options=', options];
}else if(params){
params.push(options);
return '';
}else{
return options;
}}
};
(function (){
var reservedWords=('break else new var' + ' case finally return void' + ' catch for switch while' + ' continue function this with' + ' default if throw' + ' delete in try' + ' do instanceof typeof' + ' abstract enum int short' + ' boolean export interface static' + ' byte extends long super' + ' char final native synchronized' + ' class float package throws' + ' const goto private transient' + ' debugger implements protected volatile' + ' double import public let yield await' + ' null true false').split(' ');
var compilerWords=JavaScriptCompiler.RESERVED_WORDS={};
for (var i=0, l=reservedWords.length; i < l; i++){
compilerWords[reservedWords[i]]=true;
}})();
JavaScriptCompiler.isValidJavaScriptVariableName=function (name){
return !JavaScriptCompiler.RESERVED_WORDS[name]&&/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name);
};
function strictLookup(requireTerminal, compiler, parts, type){
var stack=compiler.popStack(),
i=0,
len=parts.length;
if(requireTerminal){
len--;
}
for (; i < len; i++){
stack=compiler.nameLookup(stack, parts[i], type);
}
if(requireTerminal){
return [compiler.aliasable('container.strict'), '(', stack, ', ', compiler.quotedString(parts[i]), ', ', JSON.stringify(compiler.source.currentLocation), ')'];
}else{
return stack;
}}
exports['default']=JavaScriptCompiler;
module.exports=exports['default'];
}),
(function(module, exports, __webpack_require__){
'use strict';
var _Object$keys=__webpack_require__(13)['default'];
exports.__esModule=true;
var _utils=__webpack_require__(5);
var SourceNode=undefined;
try {
if(false){
var SourceMap=require('source-map');
SourceNode=SourceMap.SourceNode;
}} catch (err){}
if(!SourceNode){
SourceNode=function (line, column, srcFile, chunks){
this.src='';
if(chunks){
this.add(chunks);
}};
SourceNode.prototype={
add: function add(chunks){
if(_utils.isArray(chunks)){
chunks=chunks.join('');
}
this.src +=chunks;
},
prepend: function prepend(chunks){
if(_utils.isArray(chunks)){
chunks=chunks.join('');
}
this.src=chunks + this.src;
},
toStringWithSourceMap: function toStringWithSourceMap(){
return { code: this.toString() };},
toString: function toString(){
return this.src;
}};}
function castChunk(chunk, codeGen, loc){
if(_utils.isArray(chunk)){
var ret=[];
for (var i=0, len=chunk.length; i < len; i++){
ret.push(codeGen.wrap(chunk[i], loc));
}
return ret;
}else if(typeof chunk==='boolean'||typeof chunk==='number'){
return chunk + '';
}
return chunk;
}
function CodeGen(srcFile){
this.srcFile=srcFile;
this.source=[];
}
CodeGen.prototype={
isEmpty: function isEmpty(){
return !this.source.length;
},
prepend: function prepend(source, loc){
this.source.unshift(this.wrap(source, loc));
},
push: function push(source, loc){
this.source.push(this.wrap(source, loc));
},
merge: function merge(){
var source=this.empty();
this.each(function (line){
source.add(['  ', line, '\n']);
});
return source;
},
each: function each(iter){
for (var i=0, len=this.source.length; i < len; i++){
iter(this.source[i]);
}},
empty: function empty(){
var loc=this.currentLocation||{ start: {}};
return new SourceNode(loc.start.line, loc.start.column, this.srcFile);
},
wrap: function wrap(chunk){
var loc=arguments.length <=1||arguments[1]===undefined ? this.currentLocation||{ start: {}}:arguments[1];
if(chunk instanceof SourceNode){
return chunk;
}
chunk=castChunk(chunk, this, loc);
return new SourceNode(loc.start.line, loc.start.column, this.srcFile, chunk);
},
functionCall: function functionCall(fn, type, params){
params=this.generateList(params);
return this.wrap([fn, type ? '.' + type + '(':'(', params, ')']);
},
quotedString: function quotedString(str){
return '"' + (str + '').replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/\u2028/g, '\\u2028')
.replace(/\u2029/g, '\\u2029') + '"';
},
objectLiteral: function objectLiteral(obj){
var _this=this;
var pairs=[];
_Object$keys(obj).forEach(function (key){
var value=castChunk(obj[key], _this);
if(value!=='undefined'){
pairs.push([_this.quotedString(key), ':', value]);
}});
var ret=this.generateList(pairs);
ret.prepend('{');
ret.add('}');
return ret;
},
generateList: function generateList(entries){
var ret=this.empty();
for (var i=0, len=entries.length; i < len; i++){
if(i){
ret.add(',');
}
ret.add(castChunk(entries[i], this));
}
return ret;
},
generateArray: function generateArray(entries){
var ret=this.generateList(entries);
ret.prepend('[');
ret.add(']');
return ret;
}};
exports['default']=CodeGen;
module.exports=exports['default'];
})
])
});
;
function preloader(){
jQuery('.wpfd-loading').css('background', "transparent url(" + wpfdfrontend.pluginurl + "/app/site/assets/images/theme/loadingfile.svg) no-repeat center center");
}
function addLoadEvent(func){
var oldonload=window.onload;
if(typeof window.onload!='function'){
window.onload=func;
}else{
window.onload=function (){
if(oldonload){
oldonload();
}
func();
}}
}
function wpfdSendTrackingEventThenDownload(Action, Label, Url){
"use strict";
var rtn=false;
if(typeof (_gaq)!=="undefined"){
_gaq.push(['_trackEvent', 'WPFD', Action, Label]);
rtn=true;
}
if(typeof (ga)!=="undefined"){
try {
var trackers=window.ga.getAll();
trackers.forEach(function (tracker){
var trackerName=tracker.get('name');
if(trackerName){
ga(trackerName + '.send', 'event', 'WPFD', Action, Label);
}});
} catch (error){
console.log(error);
}
rtn=true;
}
if(typeof (gtag)!=="undefined"){
gtag('event', Action, {
'event_category': 'WPFD',
'event_label': Label
});
rtn=true;
}
return rtn;
}
function wpfdTrackDownload(){
if(typeof (wpfdparams)!=="undefined"&&wpfdparams.ga_download_tracking==="1"){
jQuery(document).on('click', 'a.wpfd_downloadlink', function (e){
var href=jQuery(this).attr('href');
var extLink=href.replace(/^https?\:\/\//i, '');
wpfdSendTrackingEventThenDownload('Download', extLink, href);
})
.on('click', 'a.wpfd_previewlink', function (e){
var href=jQuery(this).attr('href');
var extLink=href.replace(/^https?\:\/\//i, '');
wpfdSendTrackingEventThenDownload('Preview', extLink, href);
});
}}
function wpfd_remove_loading(el){
jQuery('.wpfd-loading', el).remove();
}
cleanObj=function (obj){
for (var k in obj){
if(obj.hasOwnProperty(k)){
if(!obj[k]) delete obj[k];
}}
return obj;
};
window.wpfdAjax={};
jQuery(document).ready(function ($){
addLoadEvent(preloader);
wpfdTrackDownload();
$(document).on('click', '.wpfd-open-tree', function (e){
var $this=$(this);
var tree=$this.parent().find('.wpfd-foldertree');
if(tree.hasClass('tree-open')){
tree.slideUp(500).removeClass('tree-open');
}else{
tree.slideDown(500).addClass('tree-open');
}});
$(document).on('wpfd:category-loaded', function (e){
var tree2=$('.wpfd-foldertree');
if(tree2.hasClass('tree-open')){
tree2.slideUp(500).removeClass('tree-open');
}});
var wpfd_category_content=$('.wpfd-all-file-category');
if(wpfd_category_content.length){
var hash_category_id='';
var default_hash=window.location.hash;
default_hash=default_hash.replace('#', '');
if(default_hash!==''&&default_hash.indexOf('-wpfd-')!==-1){
var hasha=default_hash.split('-');
var re=new RegExp("^(p[0-9]+)$");
var page=null;
var stringpage=hasha.pop();
if(re.test(stringpage)){
page=stringpage.replace('p', '');
}
hash_category_id=hasha[0];
}
if(hash_category_id!='all_0'){
wpfd_category_content.each(function (){
var curCatContentTheme=$(this).attr('data-theme');
var atts_shortcode=window["wpfdfrontend_" + curCatContentTheme];
var curCatContent=$(this);
$.ajax({
method: "POST",
url: wpfdparams.wpfdajaxurl + "task=categories.contentAllCat",
data: {
atts_shortcode: atts_shortcode.shortcode_param,
wpfdajaxnone: atts_shortcode.wpfdajaxnone
},
beforeSend: function (){
var htmlToAppend=$('#wpfd-loading-wrap').html();
curCatContent.html(htmlToAppend);
},
success: function (result){
if(result.success){
curCatContent.html(result.content);
var script=document.createElement('script');
script.src=atts_shortcode.wpfdscripturl;
document.body.appendChild(script);
}}
})
})
}}
setTimeout(function (){
if($('.wpfd_root_category_default_open').length > 0){
$('.wpfd_root_category_default_open').each(function (){
$('.wpfdcategory.catlink[data-idcat="' + $(this).val() + '"]').trigger('click');
});
}}, 1000);
function wpfdDownloadFiles(){
if(!wpfdparams.offRedirectLinkDownloadImageFile){
$('.wpfd-single-file.png .wpfd_downloadlink, .wpfd-single-file.jpg .wpfd_downloadlink, .wpfd-single-file.jpeg .wpfd_downloadlink, .wpfd-single-file.gif .wpfd_downloadlink').on('click', function (event){
event.preventDefault();
var fileId=$(this).parents('.wpfd-single-file').data('id');
var categoryId=$(this).parents('.wpfd-single-file').data('catid');
var cloudType=$(this).parents('.wpfd-single-file').find('.wpfd_root_category_type').val();
if(!fileId||!categoryId){
return false;
}
if($(this).find('.wpfd-add-to-cart').length){
return false;
}
window.location.href=wpfdparams.site_url + "?wpfd_action=wpfd_download_file&wpfd_file_id=" + fileId + "&wpfd_category_id=" + categoryId + "&cloudType=" + cloudType;
});
}}
wpfdDownloadFiles();
function wpfdPreviewFileNewName(){
$('.wpfd-button-preview').click(function (e){
var newWindow=$(this).attr('target');
var previewLink=$(this).attr('href');
var fileTitle=$(this).parents('.wpfd-single-file').find('.wpfd_file_preview_link_download').attr('data-filetitle');
var fileExt=$(this).parents('.wpfd-single-file').find('.wpfd_file_ext').val();
var fileName=fileExt ? fileTitle + '.' + fileExt:fileTitle;
fileName=fileName ? fileName:'WPFD Preview File';
if(newWindow==='_blank'&&(previewLink.indexOf('previews')!==-1)&&previewLink.indexOf('docs.google.com')===-1){
e.preventDefault();
var win=window.open(previewLink, '_blank');
win.onload=function (){
setTimeout(function (){
win.document.title=fileName;
}, 100);
setTimeout(function (){
$(win.document.head).append('<title>' + fileName + '</title>');
}, 3000);
};
setTimeout(function (){
if(win.document.title!==fileName){
win.document.title=fileName;
}}, 1000);
setTimeout(function (){
if(win.document.title!==fileName){
win.document.title=fileName;
}}, 3000);
}});
}
wpfdPreviewFileNewName();
if($('.wpfd-single-file .file-custom-field.file-url').length){
var link=typeof (wpfdparams.translates.wpfd_url_custom_field)!=='undefined' ? wpfdparams.translates.wpfd_url_custom_field:'Link';
$('.wpfd-single-file .file-custom-field.file-url').each(function (){
var label=$(this).attr('data-field-label');
var url=$(this).attr('data-field-val');
var urlContents='<div><span>' + label + ': </span><a href="' + url + '" target="_blank">' + link + '</a></div>';
$(this).empty().append(urlContents);
});
}});
(function ($){
var options={
'root': '/',
'script': 'connectors/jaoconnector.php',
'showroot': 'root',
'onclick': function (elem, type, file){
},
'oncheck': function (elem, checked, type, file){
},
'expanded': false,
'expandedParent': false,
'usecheckboxes': true,
'expandSpeed': 0,
'collapseSpeed': 0,
'expandEasing': null,
'collapseEasing': null,
'canselect': true
};
var methods={
init: function (o){
if($(this).length==0){
return;
}
$this=$(this);
$.extend(options, o);
$(this).data('jaofiletree', $.extend({}, options));
if(typeof wpfdparams!=='undefined'&&wpfdparams.hasOwnProperty('allow_category_tree_parent_expanded')){
options.expandedParent=parseInt(wpfdparams.allow_category_tree_parent_expanded)===1 ? true:false;
}
firstload(options.root, $this);
},
open: function (dir, $this){
openfolder(dir, $this);
},
close: function (dir, $this){
closedir(dir, $this);
},
getchecked: function (){
var list=new Array();
var ik=0;
$this.find('input:checked + a').each(function (){
list[ik]={
type: $(this).attr('data-type'),
file: $(this).attr('data-file')
}
ik++;
});
return list;
},
getselected: function (){
var list=new Array();
var ik=0;
$this.find('li.selected > a').each(function (){
list[ik]={
type: $(this).attr('data-type'),
file: $(this).attr('data-file')
}
ik++;
});
return list;
}};
firstload=function (dir, $this){
$.ajax({
url: options.script,
data: {dir: dir},
context: $this,
dataType: 'json',
beforeSend: function (){
this.find('a[data-file="' + dir + '"]').parent().addClass('wait');
}}).done(function (datas){
if(typeof datas!=='undefined'&&datas.success){
if(typeof datas.data!=='undefined'&&datas.data){
var tree=buildtree(datas.data, true, dir);
$this.html(tree);
if(options.expandedParent){
setTimeout(function (){
if($('.icon-open-close[data-parent_id=0]').length){
$this.find('.icon-open-close[data-parent_id=0]').click();
}else{
if(typeof datas.data[0].term_id!=='undefined'&&$('.icon-open-close[data-id=' + datas.data[0].term_id + ']').length){
$this.find('.icon-open-close[data-id=' + datas.data[0].term_id + ']').click();
}}
}, 100);
}
setevents($this);
}else{
$this.html('No cat found');
}}else{
if(typeof datas.message!=='undefined'){
$this.html(datas.message);
}else{
$this.html('Something wrong! Please reload this page.');
}}
});
};
buildtree=function (datas, display, dir){
var sortable=[];
for (var key in datas){
sortable.push(datas[key]);
}
datas=[];
sortable.forEach(function (data){
if(typeof data!=='function'){
datas.push(data);
}});
ret='<ul class="jaofiletree" ';
if(options.expanded){
display===true;
}
if(display){
ret +='>';
}else{
ret +='style="display: none">';
}
for (var id=0; id < datas.length; id++){
classe='directory collapsed';
var parent_id=datas[id].parent;
var cat_id=datas[id].term_id;
if(typeof parent_id==='undefined'){
parent_id=0;
}
if(options.expanded){
classe='directory';
if(typeof dir!=='undefined'){
classe +=' selected';
}
if(typeof datas[id].children!=='undefined'&&datas[id].children.length > 0){
classe +=' expanded';
}}
if(datas[id].term_id===0){
cat_id='all_0';
classe='directory selected';
if(typeof datas[id].children!=='undefined'&&datas[id].children.length > 0){
classe +=' expanded';
}}
ret +='<li class="' + classe + '">';
if(typeof datas[id].children!=='undefined'&&datas[id].children.length > 0){
ret +='<div class="icon-open-close" data-id="' + datas[id].term_id + '" data-parent_id="' + parent_id + '" data-file="' + datas[id].term_id + '" ></div>';
}
var classIcon='';
var color='';
if(typeof (datas[id].color)!=='undefined'&&datas[id].color!==''){
color='color: ' + datas[id].color;
}else{
color='color: #b2b2b2';
}
if(typeof datas[id].cloudType!=='undefined'&&typeof datas[id].cloudType!=='number'&&datas[id].cloudType!==false){
classIcon=' wpfd-icon-cloud wpfd-icon-' + datas[id].cloudType;
}
if(datas[id].term_id===dir){
ret +='<i class="zmdi zmdi-folder zmdi-folder-open' + classIcon + '" style="' + color + '"></i>';
}else{
ret +='<i class="zmdi zmdi-folder' + classIcon + '" style="' + color + '"></i>';
}
ret +='<a href="#" data-file="' + datas[id].term_id + '" data-catid="' + cat_id + '" data-parent_id="' + parent_id + '">' + datas[id].name + '</a>';
if(typeof datas[id].children!=='undefined'){
var display=options.expanded;
if(datas[id].term_id===0){
display=true;
}
ret +=buildtree(datas[id].children, display);
}
ret +='</li>';
}
ret +='</ul>';
return ret;
};
openfolder=function (dir, $this){
if($this.find('a[data-file="' + dir + '"]').parent().hasClass('expanded')){
return;
}
$this.find('a[data-file="' + dir + '"]').parent().removeClass('wait').removeClass('collapsed').addClass('expanded');
$this.find('a[data-file="' + dir + '"]').parent().find(' > .zmdi.zmdi-folder').removeClass('zmdi-folder').addClass('zmdi-folder-outline');
$this.find('a[data-file="' + dir + '"]').next().slideDown(options.expandSpeed, options.expandEasing);
setevents($this);
$this.trigger('afteropen');
$this.trigger('afterupdate');
};
closedir=function (dir, $this){
$this.find('a[data-file="' + dir + '"]').next().slideUp(options.collapseSpeed, options.collapseEasing);
$this.find('a[data-file="' + dir + '"]').parent().removeClass('expanded').addClass('collapsed');
$this.find('a[data-file="' + dir + '"]').parent().find(' > .zmdi.zmdi-folder-outline').removeClass('zmdi-folder-outline').addClass('zmdi-folder');
setevents($this);
$this.trigger('afterclose');
$this.trigger('afterupdate');
};
setevents=function ($this){
var options=$this.data('jaofiletree');
var allow_category_tree_click_scroll_up=false;
if(typeof wpfdparams!=='undefined'&&wpfdparams.hasOwnProperty('allow_category_tree_click_scroll_up')){
allow_category_tree_click_scroll_up=parseInt(wpfdparams.allow_category_tree_click_scroll_up)===1 ? true:false;
}
$this.find('li a, li .icon-open-close').unbind('click');
$this.find('li.directory a').bind('click', function (e){
$this.find('li').removeClass('selected');
$this.find('i.zmdi').removeClass('zmdi-folder-open').addClass("zmdi-folder");
$(this).parent().addClass('selected');
$(this).parents('li.directory.expanded').find(' > i.zmdi').removeClass('zmdi-folder').removeClass('zmdi-folder-outline').addClass('zmdi-folder-outline');
$(this).parent().find(' > i.zmdi').removeClass('zmdi-folder').addClass("zmdi-folder-open").addClass("zmdi-folder-outline");
if($this.find('i.zmdi.zmdi-folder.zmdi-folder-outline').parent().length){
$this.find('i.zmdi.zmdi-folder.zmdi-folder-outline').parent().each(function (){
if($(this).find(' > .jaofiletree li.directory').length){
$(this).find('i.zmdi.zmdi-folder.zmdi-folder-outline').removeClass('zmdi-folder');
}else{
$(this).find('i.zmdi.zmdi-folder-outline').removeClass('zmdi-folder-outline').addClass('zmdi-folder');
}});
}
var $el=$(this);
if($el.data('clicked')){
e.preventDefault();
e.stopPropagation();
}else{
$el.data('clicked', true);
options.onclick(this, $(this).attr('data-file'));
window.setTimeout(function (){
$el.removeData('clicked');
}, 1000)
}
if(allow_category_tree_click_scroll_up){
var offsetTop=$(this).closest(".wpfd-content").offset().top - 200;
$('html, body').animate({
scrollTop: offsetTop
}, 1000);
}
return false;
});
$this.find('li.directory.collapsed .icon-open-close').bind('click', function (e){
e.preventDefault;
var $el=$(this);
if($el.data('clicked')){
e.preventDefault();
e.stopPropagation();
}else{
$el.data('clicked', true);
methods.open($(this).attr('data-file'), $this);
window.setTimeout(function (){
$el.removeData('clicked');
}, 1000)
}});
$this.find('li.directory.expanded .icon-open-close').bind('click', function (e){
e.preventDefault;
var $el=$(this);
if($el.data('clicked')){
e.preventDefault();
e.stopPropagation();
}else{
$el.data('clicked', true);
methods.close($(this).attr('data-file'), $this);
window.setTimeout(function (){
$el.removeData('clicked');
}, 1000)
}});
};
$.fn.jaofiletree=function (method){
if(methods[method]){
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
}else if(typeof method==='object'||!method){
return methods.init.apply(this, arguments);
}else{
}};})(jQuery);
bytesToSize=function(bytes){
var sizes=[];
if(typeof (window.wpfdHelper)!=='undefined'&&typeof (window.wpfdHelper.fileMeasure)!=='undefined'&&window.wpfdHelper.fileMeasure.length > 0){
sizes=window.wpfdHelper.fileMeasure;
}else{
sizes=['B', 'KB', 'MB', 'GB', 'TB', 'PB'];
}
if(bytes <=0) return 'N/A';
var i=parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
return (bytes / Math.pow(1024, i)).toFixed(2) + ' ' + sizes[i];
};
jQuery(document).ready(function ($){
var table_tree=$('.wpfd-foldertree-table');
var table_hash=window.location.hash;
var table_root_cat=$('.wpfd-content-table').data('category');
var allCategoriesBreadcrumbs='<li><a class="catlink" data-idcat="all_0" href="javascript:void(0);">' + wpfdparams.translates.wpfd_all_categories + '</a></li>';
var allCategoriesDividerBreadcrumbs='<li><a class="catlink" data-idcat="all_0" href="javascript:void(0);">' + wpfdparams.translates.wpfd_all_categories + '</a><span class="divider"> &gt; </span></li>';
var table_cParents={};
if(window.wpfdAjax===undefined){
window.wpfdAjax={};}
window.wpfdAjax[table_root_cat]={category: null, file: null};
$(".wpfd-content-table").each(function (){
var table_topCat=$(this).data('category');
var topCatName=$(this).find('.head-category-table li:first-child').text();
var currentCatName=$(this).find("h2").text();
if(currentCatName!==''){
topCatName=currentCatName;
}
if(table_topCat=='all_0'){
table_cParents[table_topCat]={parent: 0, term_id: 0, name: topCatName.trim()};}else{
table_cParents[table_topCat]={parent: 0, term_id: table_topCat, name: topCatName.trim()};}
$(this).find(".wpfdcategory.catlink").each(function (){
var tempidCat=$(this).data('idcat');
table_cParents[tempidCat]={parent: table_topCat, term_id: tempidCat, name: $(this).text().trim()};});
initInputSelected(table_topCat);
initDownloadSelected(table_topCat);
wpfdMailNotifyFileChanges(table_topCat);
});
$('.wpfd-content .mediaTable').mediaTable();
Handlebars.registerHelper('bytesToSize', function (bytes){
if(typeof bytes==="undefined"){
return 'n/a';
}
return bytes.toString().toLowerCase()==='n/a' ? bytes:bytesToSize(parseInt(bytes));
});
function table_initClick(){
$(document).off('click', '.wpfd-content-table .catlink').on('click', '.wpfd-content-table .catlink', function(e){
e.preventDefault();
if($(this).parents('.wpfd-content').find('.wpfd-form-search-file-category').length){
$(this).parents('.wpfd-content').find('.wpfd-form-search-file-category').remove();
}
var ctheme=$(this).parents('.wpfd-content').find('.wpfd_root_category_theme').val();
var c_root_cat=$(this).parents('.wpfd-content').find('.wpfd_root_category_id').val();
var rootCat=".wpfd-content-table.wpfd-content-multi[data-category=" + c_root_cat + "]";
var current_category=$(rootCat).find('#current_category_' + c_root_cat).val();
$(".wpfd-content[data-category=" + $(this).parents('.wpfd-content-' + ctheme).data('category') + "] .wpfd-container-" + ctheme).find('.wpfd-categories .wpfdcategory.catlink').each(function (){
var tempidCat=$(this).data('idcat');
var catName='';
if($(this).attr('title')!==undefined){
catName=$(this).attr('title').trim();
}else if($(this).data('title')!==undefined){
catName=$(this).data('title').trim();
}
table_cParents[tempidCat]={parent: current_category, term_id: tempidCat, name: catName};});
e.preventDefault();
table_load(c_root_cat, $(this).data('idcat'));
})
}
function initInputSelected(sc){
$(document).on('change', ".wpfd-content-table.wpfd-content-multi[data-category=" + sc + "] input.cbox_file_download:not(.cbox_file_mail)", function (){
var rootCat=".wpfd-content-table.wpfd-content-multi[data-category=" + sc + "]";
var selectedFiles=$(rootCat + " input.cbox_file_download:checked");
var mailNotify=parseInt($(rootCat + " .wpfd_category_notify_file_changes").val())===1 ? true:false;
var globalNotify=parseInt($(rootCat + " .wpfd_global_notify_file_changes").val())===1 ? true:false;
var loginUser=parseInt($(rootCat + " .wpfd_user_login").val())===0 ? false:true;
var filesId=[];
if(selectedFiles.length){
selectedFiles.each(function (index, file){
filesId.push($(file).data('id'));
});
}
if(!globalNotify||!loginUser){
mailNotify=false;
}
if(filesId.length > 0){
$(rootCat + " .wpfdSelectedFiles").remove();
$('<input type="hidden" class="wpfdSelectedFiles" value="' + filesId.join(',') + '" />')
.insertAfter($(rootCat).find(" #current_category_slug_" + sc));
hideDownloadAllBtn(sc, true);
$(rootCat + " .table-download-selected").remove();
if(mailNotify){
$(rootCat).find(".wpfd-category-mail-subscribe-selected").remove();
$(rootCat).find(".wpfd-category-mail-subscribe-all").hide();
var mailSelectedBtn=$('<a href="javascript:void(0);" class="wpfd-category-mail-subscribe-selected" style="display: block;">' + wpfdparams.translates.mail_notify_selected + '</a>');
$(rootCat).find("div.wpfd-header-btn-group").append(mailSelectedBtn);
}
var downloadSelectedBtn=$('<a href="javascript:void(0);" class="table-download-selected" style="display: block;">' + wpfdparams.translates.download_selected + '<i class="zmdi zmdi-check-all wpfd-download-category"></i></a>');
$(rootCat).find("div.wpfd-header-btn-group").append(downloadSelectedBtn);
}else{
$(rootCat + " .wpfdSelectedFiles").remove();
$(rootCat + " .table-download-selected").remove();
hideDownloadAllBtn(sc, false);
if(mailNotify){
$(rootCat).find(".wpfd-category-mail-subscribe-selected").remove();
$(rootCat).find(".wpfd-category-mail-subscribe-all").show();
}}
});
}
function hideDownloadAllBtn(sc, hide){
var rootCat=".wpfd-content-table.wpfd-content-multi[data-category=" + sc + "]";
var downloadCatButton=$(rootCat + " .table-download-category");
if(downloadCatButton.length===0||downloadCatButton.hasClass('display-download-category')){
return;
}
if(hide){
$(rootCat + " .table-download-category").hide();
}else{
$(rootCat + " .table-download-category").show();
}}
function initDownloadSelected(sc){
var rootCat=".wpfd-content-table.wpfd-content-multi[data-category=" + sc + "]";
$(document).on('click', rootCat + ' .table-download-selected', function (){
if($(rootCat).find('.wpfdSelectedFiles').length > 0){
var current_category=$(rootCat).find('#current_category_' + sc).val();
var category_name=$(rootCat).find('#current_category_slug_' + sc).val();
var selectedFilesId=$(rootCat).find('.wpfdSelectedFiles').val();
$.ajax({
url: wpfdparams.wpfdajaxurl + "?action=wpfd&task=files.zipSeletedFiles&filesId=" + selectedFilesId + "&wpfd_category_id=" + current_category,
dataType: "json",
}).done(function (results){
if(results.success){
var hash=results.data.hash;
window.location.href=wpfdparams.wpfdajaxurl + "?action=wpfd&task=files.downloadZipedFile&hash=" + hash + "&wpfd_category_id=" + current_category + "&wpfd_category_name=" + category_name;
}else{
alert(results.data.message);
}})
}});
}
function showMailSubscriptions(sc, show){
var rootCat=".wpfd-content.wpfd-content-multi[data-category=" + sc + "]";
var globalNotify=parseInt($(rootCat + " .wpfd_global_notify_file_changes").val())===1 ? true:false;
var loginUser=parseInt($(rootCat + " .wpfd_user_login").val())===0 ? false:true;
var subscribeAll=$(rootCat + " .wpfd-category-mail-subscribe-all");
var subscribeSelected=$(rootCat + " .wpfd-category-mail-subscribe-selected");
if(show){
subscribeAll.show();
subscribeSelected.show();
}else{
subscribeAll.hide();
subscribeSelected.hide();
}
if(!globalNotify||!loginUser){
subscribeAll.hide();
subscribeSelected.hide();
}}
function wpfdMailNotifyFileChanges(sc){
var rootCat=".wpfd-content-table.wpfd-content-multi[data-category=" + sc + "]";
$(document).on('click', rootCat + ' .wpfd-category-mail-subscribe-all', function (e){
e.preventDefault();
var current_category=$(rootCat).find('#current_category_' + sc).val();
var category_name=$(rootCat).find('#current_category_slug_' + sc).val();
var selectedFilesId=$(rootCat).find('.wpfdSelectedFiles').val();
var title=$(rootCat).find('.wpfd-category-mail-subscribe-all').text();
$.ajax({
url: wpfdparams.wpfdajaxurl + "?action=wpfd&task=files.mailNotifyEntireCategoryFiles&wpfd_category_id=" + current_category,
dataType: "json",
beforeSend: function (){
$(rootCat).find('.wpfd-category-mail-subscribe-all').text('Subscribing...');
},
}).done(function (results){
if(results.success){
var hash=results.data.hash;
$(rootCat).find('.wpfd-category-mail-subscribe-all').text('Done!');
setTimeout(function (){
$(rootCat).find('.wpfd-category-mail-subscribe-all').text(title);
}, 1500);
}else{
alert(results.data.message);
}})
});
$(document).on('click', rootCat + ' .wpfd-category-mail-subscribe-selected', function (e){
e.preventDefault();
if($(rootCat).find('.wpfdSelectedFiles').length > 0){
var current_category=$(rootCat).find('#current_category_' + sc).val();
var category_name=$(rootCat).find('#current_category_slug_' + sc).val();
var selectedFilesId=$(rootCat).find('.wpfdSelectedFiles').val();
$.ajax({
url: wpfdparams.wpfdajaxurl + "?action=wpfd&task=files.mailNotifySelectedFiles&filesId=" + selectedFilesId + "&wpfd_category_id=" + current_category,
dataType: "json",
beforeSend: function (){
$(rootCat).find('.wpfd-category-mail-subscribe-selected').text('Subscribing...');
},
}).done(function (results){
if(results.success){
var hash=results.data.hash;
$(rootCat).find('.wpfd-category-mail-subscribe-selected').text('Done!');
setTimeout(function (){
$(rootCat).find('.wpfd-category-mail-subscribe-selected').text(wpfdparams.translates.mail_notify_selected);
}, 1500);
}else{
alert(results.data.message);
}})
}});
}
table_initClick();
if(typeof wpfdColorboxInit!=='undefined'){
wpfdColorboxInit();
}
function wpfd_table_menu_category_link_handlers(){
if($('.wpfd_menu_category_links .elementor-icon-list-item').length){
$('.wpfd_menu_category_links .elementor-icon-list-item').unbind('click').on('click', function (e){
var hashSubUrl=$(this).find('a').attr('href');
var hashGoId='';
if(hashSubUrl.indexOf('/')!==-1){
var hashParams=hashSubUrl.split('/');
hashGoId=hashParams[hashParams.length - 1];
hashGoId=hashGoId.replace('#', '');
if(hashGoId!==''){
var hashGoIda=hashGoId.split('-');
var hashGoIda_sourcecat=hashGoIda[0];
var hashGoIda_category_id=hashGoIda[1];
setTimeout(function (){
table_load(hashGoIda_sourcecat, hashGoIda_category_id, null);
if($('#e-n-menu-content-1872').length){
$('#e-n-menu-content-1872').hide();
}}, 100);
}}
});
}}
wpfd_table_menu_category_link_handlers();
table_hash=table_hash.replace('#', '');
if(table_hash!==''){
var hasha=table_hash.split('-');
var re=new RegExp("^(p[0-9]+)$");
var page=null;
var stringpage=hasha.pop();
if(re.test(stringpage)){
page=stringpage.replace('p', '');
}
var hash_category_id=hasha[1];
var hash_sourcecat=hasha[0];
if(parseInt(hash_category_id) > 0||hash_category_id==='all_0'){
if(hash_category_id=='all_0'){
hash_category_id=0;
}
setTimeout(function (){
table_load(hash_sourcecat, hash_category_id, page);
}, 100);
}}
_wpfd_text=function (text){
if(typeof (l10n)!=='undefined'){
return l10n[text];
}
return text;
};
function toMB(mb){
return mb * 1024 * 1024;
}
var allowedExt=wpfdparams.allowed;
allowedExt=allowedExt.split(',');
allowedExt.sort();
const ultraFilterGetData=function (){
let wpufDataFilter={}
if(window.wpufData){
wpufDataFilter.listId=[]
$.each(window.wpufData, (key, value)=> {
if(/^\d+$/.test(key)){
if(value.postTotal.length > 0){
wpufDataFilter.listId=[...new Set(wpufDataFilter.listId.concat(value.postTotal))];
}}
})
}
return wpufDataFilter;
}
var initUploader=function (currentContainer){
var upload_type='file';
var uploader=new Resumable({
target: wpfdparams.wpfduploadajax + '?action=wpfd&&task=files.upload&upload_from=front',
query: {
id_category: $(currentContainer).find('input[name=id_category]').val(),
},
fileParameterName: 'file_upload',
simultaneousUploads: 1,
maxChunkRetries: 1,
maxFileSize: toMB(wpfdparams.maxFileSize),
maxFileSizeErrorCallback: function (file){
alert(file.name + ' ' + _wpfd_text('is too large, please upload file(s) less than ') + wpfdparams.maxFileSize + 'Mb!');
},
chunkSize: wpfdparams.serverUploadLimit - 50 * 1024,
forceChunkSize: true,
fileType: allowedExt,
fileTypeErrorCallback: function (file){
alert(file.name + ' cannot upload!\n\n' + _wpfd_text('This type of file is not allowed to be uploaded. You can add new file types in the plugin configuration'));
},
generateUniqueIdentifier: function (file, event){
var relativePath=file.webkitRelativePath||file.fileName||file.name;
var size=file.size;
var prefix=Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
return (prefix + size + '-' + relativePath.replace(/[^0-9a-zA-Z_-]/img, ''));
}});
if(!uploader.support){
alert(_wpfd_text('Your browser does not support HTML5 file uploads!'));
}
if(typeof (willUpload)==='undefined'){
var willUpload=true;
}
uploader.on('createFolders', function (files){
upload_type='folder';
var currentRootCat=currentContainer.find('input[name=id_category]').val()
var paths=files.map(function(file){
if(file.hasOwnProperty('catId')){
currentRootCat=file.catId;
}
var filePath=(file.hasOwnProperty('relativePath')) ? file.relativePath:file.webkitRelativePath;
var namePos=filePath.lastIndexOf(file.name);
return filePath.substr(0,namePos);
});
paths=paths.filter(function(item, i, ar){ return item&&ar.indexOf(item)===i });
if(paths.length > 0){
var categoryType=currentContainer.find('input[name=category_type]').val();
$.ajax({
url: wpfdparams.wpfduploadajax + '?action=wpfd&task=categories.createCategoriesDeep',
data: {
paths: paths.join('|'),
category_id: currentRootCat,
type: categoryType
},
method: 'POST',
success: function (data){
}});
}})
uploader.on('filesAdded', function (files){
files.forEach(function (file){
var progressBlock='<div class="wpfd_process_block" id="' + file.uniqueIdentifier + '">'
+ '<div class="wpfd_process_fileinfo">'
+ '<span class="wpfd_process_filename">' + file.fileName + '</span>'
+ '<span class="wpfd_process_cancel">Cancel</span>'
+ '</div>'
+ '<div class="wpfd_process_full" style="display: block;">'
+ '<div class="wpfd_process_run" data-w="0" style="width: 0%;"></div>'
+ '</div></div>';
currentContainer.find('#preview', '.wpreview').before(progressBlock);
$(currentContainer).find('.wpfd_process_cancel').unbind('click').click(function (){
fileID=$(this).parents('.wpfd_process_block').attr('id');
fileObj=uploader.getFromUniqueIdentifier(fileID);
uploader.removeFile(fileObj);
$(this).parents('.wpfd_process_block').fadeOut('normal', function (){
$(this).remove();
});
if(uploader.files.length===0){
$(currentContainer).find('.wpfd_process_pause').fadeOut('normal', function (){
$(this).remove();
});
}
$.ajax({
url: wpfdparams.wpfduploadajax + '?action=wpfd&task=files.upload',
method: 'POST',
dataType: 'json',
data: {
id_category: $('input[name=id_category]').val(),
deleteChunks: fileID
},
success: function (res, stt){
if(res.response===true){
}}
})
});
});
if(files.length > 0){
uploadPauseBtn=$(currentContainer).find('.wpreview').find('.wpfd_process_pause').length;
restableBlock=$(currentContainer).find('.wpfd_process_block');
if(!uploadPauseBtn){
restableBlock.before('<div class="wpfd_process_pause">Pause</div>');
$(currentContainer).find('.wpfd_process_pause').unbind('click').click(function (){
if(uploader.isUploading()){
uploader.pause();
$(this).text('Start');
$(this).addClass('paused');
willUpload=false;
}else{
uploader.upload();
$(this).text('Pause');
$(this).removeClass('paused');
willUpload=true;
}});
}
uploader.opts.query={
id_category: currentContainer.find('input[name=id_category]').val()
};
if(willUpload){
setTimeout(function(){uploader.upload();}, 1000);
}}
});
uploader.on('fileProgress', function (file){
$(currentContainer).find('.wpfd_process_block#' + file.uniqueIdentifier)
.find('.wpfd_process_run').width(Math.floor(file.progress() * 100) + '%');
});
uploader.on('fileSuccess', function (file, res){
var thisUploadBlock=currentContainer.find('.wpfd_process_block#' + file.uniqueIdentifier);
thisUploadBlock.find('.wpfd_process_cancel').addClass('uploadDone').text('OK').unbind('click');
thisUploadBlock.find('.wpfd_process_full').remove();
var response=JSON.parse(res);
if(response.response===false&&typeof(response.datas)!=='undefined'){
if(typeof(response.datas.code)!=='undefined'&&response.datas.code > 20){
alert(response.datas.message);
return false;
}}
if(typeof(response)==='string'){
alert(response);
return false;
}
if(response.response!==true){
alert(response.response);
return false;
}});
uploader.on('fileError', function (file, msg){
thisUploadBlock=currentContainer.find('.wpfd_process_block#' + file.uniqueIdentifier);
thisUploadBlock.find('.wpfd_process_cancel').addClass('uploadError').text('Error').unbind('click');
thisUploadBlock.find('.wpfd_process_full').remove();
});
uploader.on('complete', function (){
var currentRootCat=currentContainer.find('input[name=id_category]').val();
var sourcecat=currentContainer.parents('.wpfd-content.wpfd-content-multi').data('category');
var theme=currentContainer.parents('.wpfd-content.wpfd-content-multi[data-category=' + sourcecat + ']').find('.wpfd_root_category_theme').val();
var cloneThemeName=currentContainer.parents('.wpfd-content.wpfd-content-multi[data-category=' + sourcecat + ']').find('.wpfd_root_category_theme').val();
var wpfd_tree=$('.wpfd-content[data-category="'+sourcecat+'"] .wpfd-foldertree');
wpfd_tree.jaofiletree({
script: wpfdparams.wpfduploadajax + '?juwpfisadmin=false&action=wpfd&task=categories.getCats',
usecheckboxes: false,
root: sourcecat,
expanded: parseInt(wpfdparams.allow_category_tree_expanded)===1 ? true:false
});
var categoryAjaxUrl=wpfdparams.wpfdajaxurl + "task=categories.display&view=categories&id=" + currentRootCat + "&top=" + sourcecat;
if(wpfdTableCategoriesLocalCache.exist(categoryAjaxUrl)){
wpfdTableCategoriesLocalCache.remove(categoryAjaxUrl);
}
var fileCount=$(currentContainer).find('.wpfd_process_cancel').length;
var categoryId=$(currentContainer).find('input[name=id_category]').val();
$.ajax({
url: wpfdparams.wpfduploadajax + '?action=wpfd&task=files.wpfdPendingUploadFiles',
method: 'POST',
dataType: 'json',
data: {
uploadedFiles: fileCount,
id_category: categoryId,
},
success: function (res){
currentContainer.find('.progress').delay(300).fadeIn(300).hide(300, function (){
$(this).remove();
});
currentContainer.find('.uploaded').delay(300).fadeIn(300).hide(300, function (){
$(this).remove();
});
$('#wpreview .file').delay(1200).show(1200, function (){
$(this).removeClass('done placeholder');
});
$('.gritter-item-wrapper ').remove();
$(currentContainer).find('#wpfd-upload-messages').append(wpfdparams.translates.msg_upload_file);
$(currentContainer).find('#wpfd-upload-messages').delay(1200).fadeIn(1200, function (){
$(currentContainer).find('#wpfd-upload-messages').empty();
$(currentContainer).find('.wpfd_process_pause').remove();
$(currentContainer).find('.wpfd_process_block').remove();
});
if(currentContainer.parent('.wpfd-upload-form').length){
var table_sourcecat=currentContainer.parents('.wpfd-content.wpfd-content-multi').data('category');
var current_category=currentContainer.parents('.wpfd-content.wpfd-content-multi').find('#current_category_' + table_sourcecat).val();
var ordering=$(".wpfd-content-multi[data-category=" + table_sourcecat + "]").find('#current_ordering_' + table_sourcecat).val();
var orderingDirection=$(".wpfd-content-multi[data-category=" + table_sourcecat + "]").find('#current_ordering_direction_' + table_sourcecat).val();
var page_limit=$(".wpfd-content-multi[data-category=" + table_sourcecat + "]").find('#page_limit_' + table_sourcecat).val();
var params=$.param({
task: 'files.display',
view: 'files',
id: current_category,
rootcat: table_sourcecat,
page: page,
orderCol: ordering,
orderDir: orderingDirection,
page_limit: page_limit
});
var tableFilesAjaxUrl=wpfdparams.wpfdajaxurl + params;
if(wpfdTableFilesLocalCache.exist(tableFilesAjaxUrl)){
wpfdTableFilesLocalCache.remove(tableFilesAjaxUrl);
}
upload_type='file';
table_load(table_sourcecat, current_category, null, upload_type);
}}
});
});
uploader.assignBrowse($(currentContainer).find('#upload_button'));
uploader.assignBrowse($(currentContainer).find('#upload_folder_button'), true);
uploader.assignDrop($(currentContainer).find('.jsWpfdFrontUpload'));
}
function table_load(sourcecat, catid, page, upload_type){
$(document).trigger('wpfd:category-loading');
var pathname=window.location.href.replace(window.location.hash, '');
var container=$(".wpfd-content-table.wpfd-content-multi[data-category=" + sourcecat + "]");
var table_empty_subcategories=$(".wpfd-content-table.wpfd-content-multi[data-category=" + sourcecat + "] #wpfd_is_empty_subcategories");
var table_empty_files=$(".wpfd-content-table.wpfd-content-multi[data-category=" + sourcecat + "] #wpfd_is_empty_files");
container.find('#current_category_' + sourcecat).val(catid);
container.next('.wpfd-pagination').remove();
$(".wpfd-content-multi[data-category=" + sourcecat + "] table tbody").empty();
wpfd_remove_loading($(".wpfd-content-multi"));
$(".wpfd-content-multi[data-category=" + sourcecat + "] table").after($('#wpfd-loading-wrap').html());
$(".wpfd-content-multi[data-category=" + sourcecat + "] .wpfd-categories").empty();
let loading_message='<div class="wpfd-loading-message-section" style="width: 100%; display: block; margin: 20px 10px; box-sizing: border-box;"><span style="font-size: 16px; color: #ffc107;">' + wpfdparams.translates.msg_loading + '</span></div>';
if(wpfdparams.allow_loading_message){
$(".wpfd-content-multi[data-category=" + sourcecat + "] .wpfd-container-table").prepend(loading_message);
}
if(table_empty_subcategories.length){
table_empty_subcategories.val('1');
}
if(table_empty_files.length){
table_empty_files.val('1');
}
var oldCategoryAjax=window.wpfdAjax[table_root_cat].category;
var tableCategoriesAjaxUrl=wpfdparams.wpfdajaxurl + "task=categories.display&view=categories&id=" + catid + "&top=" + sourcecat;
if(oldCategoryAjax!==null){
oldCategoryAjax.abort();
}
window.wpfdAjax[table_root_cat].category=$.ajax({
url: tableCategoriesAjaxUrl,
dataType: "json",
cache: true,
beforeSend: function (){
if(container.find('.wpfd-form-search-file-category').length){
container.find('.wpfd-form-search-file-category').remove();
}
if(wpfdTableCategoriesLocalCache.exist(tableCategoriesAjaxUrl)&&upload_type!='folder'){
var tableTriggerCategories=wpfdTableCategoriesLocalCache.get(tableCategoriesAjaxUrl);
wpfdTableCategoriesLocalCacheTrigger(tableTriggerCategories, sourcecat, page, pathname, catid, container, table_empty_subcategories, table_empty_files);
if($(".wpfd-content-multi[data-category=" + sourcecat + "] .wpfd-loading-message-section").length){
$(".wpfd-content-multi[data-category=" + sourcecat + "] .wpfd-loading-message-section").remove();
}
return false;
}
return true;
}}).done(function (categories){
if($(".wpfd-content-multi[data-category=" + sourcecat + "] .wpfd-loading-message-section").length){
$(".wpfd-content-multi[data-category=" + sourcecat + "] .wpfd-loading-message-section").remove();
}
wpfdTableCategoriesLocalCache.set(tableCategoriesAjaxUrl, categories);
var $displayFileSearch=container.find('.wpfd_root_category_display_file_search');
if($displayFileSearch.length){
var $themeName=container.find('.wpfd_root_category_theme').val();
if(typeof (categories.category.correctConvertCategoryId)==='undefined'){
categories.category.correctConvertCategoryId=0;
}
var $searchContent='<form action="" id="adminForm-'+ categories.category.term_id +'" class="wpfd-adminForm wpfd-form-search-file-category" name="adminForm" method="post">' +
wpfdparams.wp_nonce_field_localize +
'<div id="loader" style="display:none; text-align: center">' +
'<img src="'+ wpfdparams.wpfd_plugin_url +'/app/site/assets/images/searchloader.svg" style="margin: 0 auto"/>' +
'</div>' +
'<div class="box-search-filter wpfd-category-search-section">' +
'<div class="searchSection">' +
'<div class="only-file input-group clearfix wpfd_search_input" id="Search_container">' +
'<img src="'+ wpfdparams.wpfd_plugin_url +'/app/site/assets/images/search-24.svg" class="material-icons wpfd-icon-search wpfd-search-file-category-icon" />' +
'<input type="text" class="pull-left required txtfilename" name="q" id="txtfilename" autocomplete="off" placeholder="'+ wpfdparams.translates.msg_search_file_category_placeholder +'" value="" />' +
'</div>' +
'<button id="btnsearchbelow" class="btnsearchbelow wpfd-btnsearchbelow" type="button">'+ wpfdparams.translates.msg_search_file_category_search +'</button>' +
'</div>' +
'<input type="hidden" id="filter_catid" class="chzn-select filter_catid" name="catid" value="'+ categories.category.correctConvertCategoryId +'" data-cattype="" data-slug="" />' +
'<input type="hidden" name="theme" value="'+ $themeName +'">' +
'<input type="hidden" name="limit" value="15">' +
'<div id="wpfd-results" class="wpfd-results list-results"></div>' +
'</div>' +
'</form>';
container.prepend($searchContent);
wpfdTableSearchFileCategoryHandle();
}
if(typeof (categories.notify_file_changes)!=='undefined'&&parseInt(categories.notify_file_changes)===1){
$(".wpfd-content.wpfd-content-multi[data-category=" + sourcecat + "]").find('.wpfd_category_notify_file_changes').val('1');
showMailSubscriptions(sourcecat, true);
}else{
$(".wpfd-content.wpfd-content-multi[data-category=" + sourcecat + "]").find('.wpfd_category_notify_file_changes').val('0');
showMailSubscriptions(sourcecat, false);
}
if(page!==null&&page!==undefined){
var stateCatId=catid;
if(sourcecat==='all_0'&&parseInt(catid)===0){
stateCatId='all_0';
}
window.history.pushState('', document.title, pathname + '#' + sourcecat + '-' + stateCatId + '-' + categories.category.slug + '-p' + page);
}else{
window.history.pushState('', document.title, pathname + '#' + sourcecat + '-' + catid + '-' + categories.category.slug);
}
container.find('#current_category_slug_' + sourcecat).val(categories.category.slug);
var tpltable_sourcecategories=container.parents().find("#wpfd-template-table-categories-" + sourcecat).html();
if(tpltable_sourcecategories){
var template=Handlebars.compile(tpltable_sourcecategories);
var html=template(categories);
$(".wpfd-content-multi[data-category=" + sourcecat + "] .wpfd-categories").replaceWith(html);
}
if(categories.category.breadcrumbs!==undefined){
if(sourcecat.toString()==='all_0'&&catid.toString()!=='all_0'&&parseInt(catid)!==0){
categories.category.breadcrumbs=allCategoriesDividerBreadcrumbs + categories.category.breadcrumbs;
}
$(".wpfd-content-multi[data-category=" + sourcecat + "] .breadcrumbs").html(categories.category.breadcrumbs);
}
if(table_tree.length){
var currentTree=container.find('.wpfd-foldertree-table');
currentTree.find('li').removeClass('selected');
currentTree.find('i.md').removeClass('md-folder-open').addClass("md-folder");
currentTree.jaofiletree('open', catid, currentTree);
var el=currentTree.find('a[data-file="' + catid + '"]').parent();
el.find(' > i.md').removeClass("md-folder").addClass("md-folder-open");
if(!el.hasClass('selected')){
el.addClass('selected');
}
var ps=currentTree.find('.icon-open-close');
$.each(ps.get().reverse(), function (i, p){
if(typeof $(p).data()!=='undefined'&&$(p).data('id')==Number(hash_category_id)){
hash_category_id=$(p).data('parent_id');
if(parseInt(wpfdparams.allow_category_tree_expanded)!==1){
$(p).click();
}}
});
}
var ordering=$(".wpfd-content-multi[data-category=" + sourcecat + "]").find('#current_ordering_' + sourcecat).val();
var orderingDirection=$(".wpfd-content-multi[data-category=" + sourcecat + "]").find('#current_ordering_direction_' + sourcecat).val();
var page_limit=$(".wpfd-content-multi[data-category=" + sourcecat + "]").find('#page_limit_' + sourcecat).val();
var themeName=$(".wpfd-content-multi[data-category=" + sourcecat + "]").find('.wpfd_root_category_theme').val();
var show_files=1;
var atts_shortcode=window["wpfdfrontend_" + themeName];
if(atts_shortcode!==undefined&&atts_shortcode.shortcode_param.show_files!==undefined&&sourcecat==='all_0'&&(parseInt(catid)===0||catid==='all_0')){
show_files=atts_shortcode.shortcode_param.show_files;
}
let wpufDataFilter=ultraFilterGetData();
var params=$.param({
task: 'files.display',
view: 'files',
id: catid,
rootcat: sourcecat,
page: page,
orderCol: ordering,
orderDir: orderingDirection,
page_limit: page_limit,
show_files: show_files
});
if(table_empty_subcategories.length){
table_empty_subcategories.val(categories.categories.length);
container.find('table.change_display').removeClass('change_display');
table_fire_empty_category_message(sourcecat);
}
var oldCategoryAjax=window.wpfdAjax[table_root_cat].file;
var tableFilesAjaxUrl=wpfdparams.wpfdajaxurl + params;
if(oldCategoryAjax!==null){
oldCategoryAjax.abort();
}
window.wpfdAjax[table_root_cat].file=$.ajax({
url: tableFilesAjaxUrl,
method: 'POST',
data: {
listFilter: wpufDataFilter.listId||[]
},
dataType: "json",
cache: true,
beforeSend: function (){
if(wpfdTableFilesLocalCache.exist(tableFilesAjaxUrl)&&(upload_type===null||upload_type===undefined)){
var tableFilesTrigger=wpfdTableFilesLocalCache.get(tableFilesAjaxUrl);
wpfdTableFilesLocalCacheTrigger(tableFilesTrigger, sourcecat, table_empty_files, container, categories, catid, tableFilesAjaxUrl);
if($(".wpfd-content-multi[data-category=" + sourcecat + "] .wpfd-loading-message-section").length){
$(".wpfd-content-multi[data-category=" + sourcecat + "] .wpfd-loading-message-section").remove();
}
return false;
}
return true;
}}).done(function (content){
if(typeof (content.pagination)!=='undefined'&&content.pagination.length){
content.cache_pagination=content.pagination;
}
wpfdTableFilesLocalCache.set(tableFilesAjaxUrl, content);
if(typeof (content.categoryPassword)!=='undefined'&&content.categoryPassword.length){
$(".wpfd-content-multi[data-category=" + sourcecat + "] .wpfd-container-table .category-pw-form").remove();
var category_pwf='<div class="category-pw-form">' + content.categoryPassword + '</div>';
$(".wpfd-content-multi[data-category=" + sourcecat + "] .wpfd-container-table .wpfd-categories").hide();
$(".wpfd-content-multi[data-category=" + sourcecat + "] .wpfd-container-table .mediaTableWrapper").hide();
$(".wpfd-content-multi[data-category=" + sourcecat + "] .wpfd-container-table").append(category_pwf);
table_breadcrum(sourcecat, catid, categories.category);
table_initClick();
}else{
if(content.files.length){
container.find(".table-download-category").removeClass("display-download-category");
}else{
container.find(".table-download-category").addClass("display-download-category");
}
if(sourcecat.toString()==='all_0'){
$(".wpfd-content-multi[data-category=" + sourcecat + "]").parent().find('.wpfd-pagination').remove();
$(".wpfd-content-multi[data-category=" + sourcecat + "]").parent().find('.wpfd-content + .wpfd-pagination').remove();
}
$(".wpfd-content-multi[data-category=" + sourcecat + "]").after(content.pagination);
delete content.pagination;
var tpltable_source=container.parents().find("#wpfd-template-table-" + sourcecat).html();
if(typeof (tpltable_source)==='undefined'&&sourcecat.toString()==='all_0'){
tpltable_source=container.parents('.wpfd-all-file-category').find("#wpfd-template-table-" + sourcecat).html();
}
var template_table=Handlebars.compile(tpltable_source);
var html=template_table(content);
$(".wpfd-content-multi[data-category=" + sourcecat + "] table tbody").append(html);
$(".wpfd-content-multi[data-category=" + sourcecat + "] table tbody").trigger('change');
$(".wpfd-content-multi[data-category=" + sourcecat + "] .mediaTableMenu").find('input').trigger('change');
if($(".wpfd-content-multi[data-category=" + sourcecat + "] table .file-custom-field.file-url").length){
var link=typeof (wpfdparams.translates.wpfd_url_custom_field)!=='undefined' ? wpfdparams.translates.wpfd_url_custom_field:'Link';
$(".wpfd-content-multi[data-category=" + sourcecat + "] table .file-custom-field.file-url").each(function (){
var label=$(this).attr('data-field-label');
var url=$(this).attr('data-field-val');
var urlContents='<div><span>' + label + ': </span><a href="' + url + '" target="_blank">' + link + '</a></div>';
$(this).empty().append(urlContents);
});
}
if($(".wpfd-content-multi[data-category=" + sourcecat + "]").find(".wpfd-upload-form").length){
$(".wpfd-content-multi[data-category=" + sourcecat + "]").find(".wpfd-upload-form").remove();
}
if(typeof (content.filepasswords)!=='undefined'){
$.each(content.filepasswords, function(file_id, pw_form){
var content_form='<td class="full-width">' + pw_form + '</td>';
$(".wpfd-content-multi[data-category=" + sourcecat + "]").find('.file[data-id="' + file_id + '"]').empty();
$(".wpfd-content-multi[data-category=" + sourcecat + "]").find('.file[data-id="' + file_id + '"]').addClass('wpfd-password-protection-form');
$(".wpfd-content-multi[data-category=" + sourcecat + "]").find('.file[data-id="' + file_id + '"]').append(content_form);
});
}
if(content.uploadform!==undefined&&content.uploadform.length){
var upload_form_html='<div class="wpfd-upload-form" style="margin: 20px 10px">';
upload_form_html +=content.uploadform;
upload_form_html +='</div>';
$(".wpfd-content-multi[data-category=" + sourcecat + "] .wpfd-container-table").append(upload_form_html);
if(typeof (Wpfd)==='undefined'){
Wpfd={};}
var containers=$(".wpfd-content-multi[data-category=" + sourcecat + "] div[class*=wpfdUploadForm]");
if(containers.length > 0){
containers.each(function(i, el){
initUploader($(el));
});
}}
for (var i=0; i < categories.categories.length; i++){
table_cParents[categories.categories[i].term_id]=categories.categories[i];
}
table_breadcrum(sourcecat, catid, categories.category);
table_initClick();
if(typeof wpfdColorboxInit!=='undefined'){
wpfdColorboxInit();
}
wpfdTrackDownload();
if($(".wpfd-content-multi[data-category=" + sourcecat + "] .category-pw-form").length){
$(".wpfd-content-multi[data-category=" + sourcecat + "] .category-pw-form").remove();
}
$(".wpfd-content-multi[data-category=" + sourcecat + "] .wpfd-container-table .mediaTableWrapper").show();
table_init_pagination($('.wpfd-content-table[data-category=' + sourcecat + '] + .wpfd-pagination'));
wpfd_remove_loading($(".wpfd-content-multi"));
$(".wpfd-content-table.wpfd-content-multi[data-category=" + sourcecat + "] .wpfdSelectedFiles").remove();
$(".wpfd-content-table.wpfd-content-multi[data-category=" + sourcecat + "] .table-download-selected").remove();
$(".wpfd-content-table.wpfd-content-multi[data-category=" + sourcecat + "] .wpfd-category-mail-subscribe-selected").remove();
hideDownloadAllBtn(sourcecat, false);
if(table_empty_files.length){
table_empty_files.val(content.files.length);
container.find('table.change_display').removeClass('change_display');
table_fire_empty_category_message(sourcecat);
}}
if($(".wpfd-content-table.wpfd-content-multi[data-category=" + sourcecat + "] .wpfd-container-table .category-pw-form").length){
hideDownloadAllBtn(sourcecat, true);
$(".wpfd-content-multi[data-category=" + sourcecat + "] .table-download-category").attr('href', '#');
$(".wpfd-content-multi[data-category=" + sourcecat + "] .wpfdcategory").hide();
}
if(content.files.length){
container.find(".wpfd-container-table").removeClass("wpfd-table-hidden");
container.find(".mediaTableWrapper .wpfd-table thead").show();
container.find(".mediaTableWrapper .mediaTableMenu").show();
}else{
container.find(".wpfd-container-table").addClass("wpfd-table-hidden");
container.find(".mediaTableWrapper .wpfd-table thead").css({'display': 'none'});
container.find(".mediaTableWrapper .mediaTableMenu").css({'display': 'none'});
}
if(parseInt(container.find("#wpfd_category_notify_file_changes").val())===0 ||
parseInt(container.find("#wpfd_global_notify_file_changes").val())===0){
container.find('.wpfd_cloud_checkbox_mail').remove();
}
if(typeof (content.notify_file_changes)!=='undefined'&&parseInt(content.notify_file_changes)===1){
$(".wpfd-content-multi[data-category=" + sourcecat + "]").find('.wpfd_mail_checkbox').show();
}
wpfdTableDisplayDownloadedFiles();
wpfdTableDownloadFiles();
wpfdPreviewFileNewName();
});
});
$(document).trigger('wpfd:category-loaded');
}
function table_breadcrum(sourcecat, catid, category){
var links=[];
var current_Cat=table_cParents[catid];
if(!current_Cat){
$(".wpfd-content-table[data-category=" + sourcecat + "] .table-download-category").attr('href', category.linkdownload_cat);
return false;
}
links.unshift(current_Cat);
if(current_Cat.parent!==0){
while (table_cParents[current_Cat.parent]){
current_Cat=table_cParents[current_Cat.parent];
if(links.includes(current_Cat)){
break;
}
links.unshift(current_Cat);
}}
var html='';
if(sourcecat.toString()==='all_0'&&catid.toString()!=='all_0'&&parseInt(catid)!==0){
html=allCategoriesDividerBreadcrumbs;
}else if((sourcecat.toString()==='all_0'&&catid.toString()==='all_0')
|| (sourcecat.toString()==='all_0'&&parseInt(catid)===0)){
html=allCategoriesBreadcrumbs;
}
for (var i=0; i < links.length; i++){
if(parseInt(links[i].term_id)===0){
continue;
}
if(i < links.length - 1){
if(links[i].parent.toString()==='undefined'){
continue;
}
html +='<li><a class="catlink" data-idcat="' + links[i].term_id + '" href="javascript:void(0)">' + links[i].name + '</a><span class="divider"> &gt; </span></li>';
}else{
html +='<li><span>' + links[i].name + '</span></li>';
}}
$(".wpfd-content-table[data-category=" + sourcecat + "] .wpfd-breadcrumbs-table li").remove();
$(".wpfd-content-table[data-category=" + sourcecat + "] .wpfd-breadcrumbs-table").html(html);
$(".wpfd-content-table[data-category=" + sourcecat + "] .table-download-category").attr('href', category.linkdownload_cat);
}
if(table_tree.length){
table_tree.each(function (){
var table_topCat=$(this).parents('.wpfd-content-table.wpfd-content-multi').data('category');
var is_private_category=$(this).parents('.wpfd-content-table.wpfd-content-multi').hasClass('wpfd-private-category-content');
var private_category=is_private_category ? 1:0;
$(this).jaofiletree({
script: wpfdparams.wpfdajaxurl + 'task=categories.getCats&private_category=' + private_category,
usecheckboxes: false,
root: table_topCat,
showroot: table_cParents[table_topCat].name,
expanded: parseInt(wpfdparams.allow_category_tree_expanded)===1 ? true:false,
onclick: function (elem, file){
if(is_private_category){
return false;
}
var table_topCat=$(elem).parents('.wpfd-content-table.wpfd-content-multi').data('category');
if(table_topCat!==file){
$('.directory', $(elem).parents('.wpfd-content-table.wpfd-content-multi')).each(function (){
if(!$(this).hasClass('selected')&&$(this).find('> ul > li').length===0){
$(this).removeClass('expanded');
}});
if(parseInt(wpfdparams.allow_category_tree_expanded)!==1){
$(elem).parents('.directory').each(function (){
var $this=$(this);
var category=$this.find(' > a');
var parent=$this.find('.icon-open-close');
if(parent.length > 0){
if(typeof table_cParents[category.data('file')]==='undefined'){
table_cParents[category.data('file')]={
parent: parent.data('parent_id'),
term_id: category.data('file'),
name: category.text()
};}}
});
}}
table_load(table_topCat, file);
}});
var ele=$(this);
setTimeout(function(){
ele.find("li.directory a").each(function (){
var tempCatID=$(this).data('catid');
var patentCatID=$(this).data('parent_id');
if(tempCatID=='all_0'){
table_cParents[tempCatID]={parent: 0, term_id: 0, name: $(this).text().trim()};}else{
table_cParents[tempCatID]={parent: patentCatID, term_id: tempCatID, name: $(this).text().trim()};}});
}, 1000);
})
}
$('.wpfd-content-table + .wpfd-pagination').each(function (index, elm){
var $this=$(elm);
table_init_pagination($this);
});
$(document).on('wpuf:updated', function (){
$('.wpfd-content-table + .wpfd-pagination').each(function (index, elm){
var $this=$(elm);
table_init_pagination($this);
});
});
function table_init_pagination($this){
var number=$this.find('a:not(.current)');
var wrap=$this.prev('.wpfd-content-table');
var sourcecat=wrap.data('category');
var current_category=wrap.find('#current_category_' + sourcecat).val();
number.unbind('click').bind('click', function (){
var page_number=$(this).attr('data-page');
var current_sourcecat=$(this).attr('data-sourcecat');
var wrap=$(".wpfd-content-multi[data-category=" + current_sourcecat + "]");
var current_category=wrap.find('#current_category_' + sourcecat).val();
if(typeof page_number!=='undefined'){
var pathname=window.location.href.replace(window.location.hash, '');
var category=$(".wpfd-content-multi[data-category=" + current_sourcecat + "]").find('#current_category_' + current_sourcecat).val();
var category_slug=$(".wpfd-content-multi[data-category=" + current_sourcecat + "]").find('#current_category_slug_' + current_sourcecat).val();
var ordering=$(".wpfd-content-multi[data-category=" + current_sourcecat + "]").find('#current_ordering_' + current_sourcecat).val();
var orderingDirection=$(".wpfd-content-multi[data-category=" + current_sourcecat + "]").find('#current_ordering_direction_' + current_sourcecat).val();
var page_limit=$(".wpfd-content-multi[data-category=" + current_sourcecat + "]").find('#page_limit_' + current_sourcecat).val();
var stateCatId=category;
if(current_sourcecat==='all_0'&&parseInt(category)===0){
stateCatId='all_0';
}
window.history.pushState('', document.title, pathname + '#' + current_sourcecat + '-' + stateCatId + '-' + category_slug + '-p' + page_number);
$(".wpfd-content-multi[data-category=" + current_sourcecat + "] table:not(.wpfd-results .wpfd-table) tbody tr:not(.topheader)").remove();
$(".wpfd-content-multi[data-category=" + current_sourcecat + "] table:not(.wpfd-results .wpfd-table)").after($('#wpfd-loading-wrap').html());
var themeName=$(".wpfd-content-multi[data-category=" + sourcecat + "]").find('.wpfd_root_category_theme').val();
var show_files=1;
var atts_shortcode=window["wpfdfrontend_" + themeName];
if(atts_shortcode!==undefined&&atts_shortcode.shortcode_param.show_files!==undefined&&sourcecat==='all_0'&&(parseInt(catid)===0||catid==='all_0')){
show_files=atts_shortcode.shortcode_param.show_files;
}
var params=$.param({
task: 'files.display',
view: 'files',
id: current_category,
rootcat: current_sourcecat,
page: page_number,
orderCol: ordering,
orderDir: orderingDirection,
page_limit: page_limit,
show_files: show_files
});
let wpufDataFilter=ultraFilterGetData();
$.ajax({
url: wpfdparams.wpfdajaxurl + params,
dataType: "json",
method: 'POST',
data: {
listFilter: wpufDataFilter.listId||[]
},
beforeSend: function (){
$('html, body').animate({scrollTop: wrap.offset().top}, 'fast');
}}).done(function (content){
delete content.category;
wrap.next('.wpfd-pagination').remove();
wrap.after(content.pagination);
delete content.pagination;
var tpltable_source=wrap.parents().find("#wpfd-template-table-" + current_sourcecat).html();
var template_table=Handlebars.compile(tpltable_source);
var html=template_table(content);
$(".wpfd-content-multi[data-category=" + current_sourcecat + "] table:not(.wpfd-results .wpfd-table) tbody").append(html);
$(".wpfd-content-multi[data-category=" + current_sourcecat + "] table:not(.wpfd-results .wpfd-table) tbody").trigger('change');
$(".wpfd-content-multi[data-category=" + current_sourcecat + "] .mediaTableMenu").find('input').trigger('change');
if($(".wpfd-content-multi[data-category=" + current_sourcecat + "] table .file-custom-field.file-url").length){
var link=typeof (wpfdparams.translates.wpfd_url_custom_field)!=='undefined' ? wpfdparams.translates.wpfd_url_custom_field:'Link';
$(".wpfd-content-multi[data-category=" + current_sourcecat + "] table .file-custom-field.file-url").each(function (){
var label=$(this).attr('data-field-label');
var url=$(this).attr('data-field-val');
var urlContents='<div><span>' + label + ': </span><a href="' + url + '" target="_blank">' + link + '</a></div>';
$(this).empty().append(urlContents);
});
}
if(typeof (content.filepasswords)!=='undefined'){
$.each(content.filepasswords, function(file_id, pw_form){
var content_form='<td class="full-width">' + pw_form + '</td>';
$(".wpfd-content-multi[data-category=" + current_sourcecat + "]").find('.file[data-id="' + file_id + '"]').empty();
$(".wpfd-content-multi[data-category=" + current_sourcecat + "]").find('.file[data-id="' + file_id + '"]').addClass('wpfd-password-protection-form');
$(".wpfd-content-multi[data-category=" + current_sourcecat + "]").find('.file[data-id="' + file_id + '"]').append(content_form);
});
}
if(typeof wpfdColorboxInit!=='undefined'){
wpfdColorboxInit();
}
table_init_pagination(wrap.next('.wpfd-pagination'));
wpfd_remove_loading($(".wpfd-content-multi"));
wpfdTableDisplayDownloadedFiles();
wpfdTableDownloadFiles();
wpfdPreviewFileNewName();
});
}});
}
function optimize_Show_fields(){
if($('.wpfd-content-table .wpfd-container-table').width() < 600){
$('.mediaTableMenu li').each(function (){
if($(this).find('label').text()=='Description'){
$(this).find('input').prop('checked',false);
}});
$('.wpfd-table .file_desc').hide();
}}
function wpfd_Table_with_foldertree(){
$('.wpfd-content-table').each(function (){
if($(this).children().has('.wpfd-foldertree').length > 0){
$(this).addClass('wpfdcontent_table_folder_tree');
}else{
if($(this).hasClass('wpfdcontent_table_folder_tree')){
$(this).removeClass('wpfdcontent_table_folder_tree');
}}
});
}
optimize_Show_fields();
wpfd_Table_with_foldertree();
function table_fire_empty_category_message(category_id){
if(!category_id){
return;
}
var root_category='.wpfd-content-table.wpfd-content-multi[data-category=' + category_id + ']';
var display_empty_category_message=$(root_category).find('#wpfd_display_empty_category_message').val();
var empty_category_message_val=$(root_category).find('#wpfd_empty_category_message_val').val();
var is_empty_subcategories=$(root_category).find('#wpfd_is_empty_subcategories').val();
var is_empty_files=$(root_category).find('#wpfd_is_empty_files').val();
if(parseInt(display_empty_category_message)!==1
|| parseInt(is_empty_subcategories)!==0||parseInt(is_empty_files)!==0){
return;
}
var code='<tr class="wpfd-empty-category-message-section">';
code +='<td class="wpfd-empty-category-message full-width">';
code +=empty_category_message_val;
code +='</td>';
code +='</tr>';
$(root_category).find('.wpfd-empty-category-message-section').remove();
$(root_category).find('.wpfd-container-table table.wpfd-table').addClass('change_display');
$(root_category).find('.wpfd-container-table table tbody').append(code);
}
var destroy_upload=$('.wpfd-upload-form.destroy');
if(destroy_upload.length){
destroy_upload.remove();
}
function wpfdTableCategoriesLocalCacheTrigger(tableTriggerCategories, sourcecat, page, pathname, catid, container, table_empty_subcategories, table_empty_files){
var $displayFileSearch=container.find('.wpfd_root_category_display_file_search');
if(typeof (tableTriggerCategories.category.correctConvertCategoryId)==='undefined'){
tableTriggerCategories.category.correctConvertCategoryId=0;
}
if($displayFileSearch.length){
var $themeName=$(".wpfd-content-multi[data-category=" + sourcecat + "]").find('.wpfd_root_category_theme').val();
var $searchContent='<form action="" id="adminForm-'+ tableTriggerCategories.category.term_id +'" class="wpfd-adminForm wpfd-form-search-file-category" name="adminForm" method="post">' +
wpfdparams.wp_nonce_field_localize +
'<div id="loader" style="display:none; text-align: center">' +
'<img src="'+ wpfdparams.wpfd_plugin_url +'/app/site/assets/images/searchloader.svg" style="margin: 0 auto"/>' +
'</div>' +
'<div class="box-search-filter wpfd-category-search-section">' +
'<div class="searchSection">' +
'<div class="only-file input-group clearfix wpfd_search_input" id="Search_container">' +
'<img src="'+ wpfdparams.wpfd_plugin_url +'/app/site/assets/images/search-24.svg" class="material-icons wpfd-icon-search wpfd-search-file-category-icon" />' +
'<input type="text" class="pull-left required txtfilename" name="q" id="txtfilename" autocomplete="off" placeholder="'+ wpfdparams.translates.msg_search_file_category_placeholder +'" value="" />' +
'</div>' +
'<button id="btnsearchbelow" class="btnsearchbelow wpfd-btnsearchbelow" type="button">'+ wpfdparams.translates.msg_search_file_category_search +'</button>' +
'</div>' +
'<input type="hidden" id="filter_catid" class="chzn-select filter_catid" name="catid" value="'+ tableTriggerCategories.category.correctConvertCategoryId +'" data-cattype="" data-slug="" />' +
'<input type="hidden" name="theme" value="'+ $themeName +'">' +
'<input type="hidden" name="limit" value="15">' +
'<div id="wpfd-results" class="wpfd-results list-results"></div>' +
'</div>' +
'</form>';
$(".wpfd-content-multi[data-category=" + sourcecat + "]").prepend($searchContent);
wpfdTableSearchFileCategoryHandle();
}
if(typeof (tableTriggerCategories.notify_file_changes)!=='undefined'&&parseInt(tableTriggerCategories.notify_file_changes)===1){
$(".wpfd-content.wpfd-content-multi[data-category=" + sourcecat + "]").find('.wpfd_category_notify_file_changes').val('1');
showMailSubscriptions(sourcecat, true);
$(".wpfd-content-multi[data-category=" + sourcecat + "]").find('.wpfd_mail_checkbox').show();
}else{
$(".wpfd-content.wpfd-content-multi[data-category=" + sourcecat + "]").find('.wpfd_category_notify_file_changes').val('0');
showMailSubscriptions(sourcecat, false);
}
if(page!==null&&page!==undefined){
var stateCatId=catid;
if(sourcecat==='all_0'&&parseInt(catid)===0){
stateCatId='all_0';
}
window.history.pushState('', document.title, pathname + '#' + sourcecat + '-' + stateCatId + '-' + tableTriggerCategories.category.slug + '-p' + page);
}else{
window.history.pushState('', document.title, pathname + '#' + sourcecat + '-' + catid + '-' + tableTriggerCategories.category.slug);
}
container.find('#current_category_slug_' + sourcecat).val(tableTriggerCategories.category.slug);
var tpltable_sourcecategories=container.parents().find("#wpfd-template-table-categories-" + sourcecat).html();
if(tpltable_sourcecategories){
var template=Handlebars.compile(tpltable_sourcecategories);
var html=template(tableTriggerCategories);
$(".wpfd-content-multi[data-category=" + sourcecat + "] .wpfd-categories").replaceWith(html);
}
if(tableTriggerCategories.category.breadcrumbs!==undefined){
$(".wpfd-content-multi[data-category=" + sourcecat + "] .breadcrumbs").html(tableTriggerCategories.category.breadcrumbs);
}
if(table_tree.length){
var currentTree=container.find('.wpfd-foldertree-table');
currentTree.find('li').removeClass('selected');
currentTree.find('i.md').removeClass('md-folder-open').addClass("md-folder");
currentTree.jaofiletree('open', catid, currentTree);
var el=currentTree.find('a[data-file="' + catid + '"]').parent();
el.find(' > i.md').removeClass("md-folder").addClass("md-folder-open");
if(!el.hasClass('selected')){
el.addClass('selected');
}
var ps=currentTree.find('.icon-open-close');
$.each(ps.get().reverse(), function (i, p){
if(typeof $(p).data()!=='undefined'&&$(p).data('id')==Number(hash_category_id)){
hash_category_id=$(p).data('parent_id');
$(p).click();
}});
}
var ordering=$(".wpfd-content-multi[data-category=" + sourcecat + "]").find('#current_ordering_' + sourcecat).val();
var orderingDirection=$(".wpfd-content-multi[data-category=" + sourcecat + "]").find('#current_ordering_direction_' + sourcecat).val();
var page_limit=$(".wpfd-content-multi[data-category=" + sourcecat + "]").find('#page_limit_' + sourcecat).val();
var params=$.param({
task: 'files.display',
view: 'files',
id: catid,
rootcat: sourcecat,
page: page,
orderCol: ordering,
orderDir: orderingDirection,
page_limit: page_limit
});
if(table_empty_subcategories.length){
table_empty_subcategories.val(tableTriggerCategories.categories.length);
container.find('table.change_display').removeClass('change_display');
table_fire_empty_category_message(sourcecat);
}
var oldCategoryAjax=window.wpfdAjax[table_root_cat].file;
var tableFilesAjaxUrl=wpfdparams.wpfdajaxurl + params;
if(oldCategoryAjax!==null){
oldCategoryAjax.abort();
}
window.wpfdAjax[table_root_cat].file=$.ajax({
url: tableFilesAjaxUrl,
dataType: "json",
cache: true,
beforeSend: function (){
if(wpfdTableFilesLocalCache.exist(tableFilesAjaxUrl)){
var tableFilesTrigger=wpfdTableFilesLocalCache.get(tableFilesAjaxUrl);
wpfdTableFilesLocalCacheTrigger(tableFilesTrigger, sourcecat, table_empty_files, container, tableTriggerCategories, catid, tableFilesAjaxUrl);
return false;
}
return true;
}}).done(function (content){
wpfdTableFilesLocalCache.set(tableFilesAjaxUrl, content);
if(typeof (content.categoryPassword)!=='undefined'&&content.categoryPassword.length){
$(".wpfd-content-multi[data-category=" + sourcecat + "] .wpfd-container-table .category-pw-form").remove();
var category_pwf='<div class="category-pw-form">' + content.categoryPassword + '</div>';
$(".wpfd-content-multi[data-category=" + sourcecat + "] .wpfd-container-table .wpfd-categories").hide();
$(".wpfd-content-multi[data-category=" + sourcecat + "] .wpfd-container-table .mediaTableWrapper").hide();
$(".wpfd-content-multi[data-category=" + sourcecat + "] .wpfd-container-table").append(category_pwf);
table_breadcrum(sourcecat, catid, tableTriggerCategories.category);
table_initClick();
}else{
if(content.files.length){
container.find(".table-download-category").removeClass("display-download-category");
}else{
container.find(".table-download-category").addClass("display-download-category");
}
if(sourcecat.toString()==='all_0'){
$(".wpfd-content-multi[data-category=" + sourcecat + "]").parent().find('.wpfd-pagination').remove();
$(".wpfd-content-multi[data-category=" + sourcecat + "]").parent().find('.wpfd-content + .wpfd-pagination').remove();
}
$(".wpfd-content-multi[data-category=" + sourcecat + "]").after(content.pagination);
delete content.pagination;
var tpltable_source=container.parents().find("#wpfd-template-table-" + sourcecat).html();
var template_table=Handlebars.compile(tpltable_source);
var html=template_table(content);
$(".wpfd-content-multi[data-category=" + sourcecat + "] table tbody").append(html);
$(".wpfd-content-multi[data-category=" + sourcecat + "] table tbody").trigger('change');
$(".wpfd-content-multi[data-category=" + sourcecat + "] .mediaTableMenu").find('input').trigger('change');
if($(".wpfd-content-multi[data-category=" + sourcecat + "] table .file-custom-field.file-url").length){
var link=typeof (wpfdparams.translates.wpfd_url_custom_field)!=='undefined' ? wpfdparams.translates.wpfd_url_custom_field:'Link';
$(".wpfd-content-multi[data-category=" + sourcecat + "] table .file-custom-field.file-url").each(function (){
var label=$(this).attr('data-field-label');
var url=$(this).attr('data-field-val');
var urlContents='<div><span>' + label + ': </span><a href="' + url + '" target="_blank">' + link + '</a></div>';
$(this).empty().append(urlContents);
});
}
if($(".wpfd-content-multi[data-category=" + sourcecat + "]").find(".wpfd-upload-form").length){
$(".wpfd-content-multi[data-category=" + sourcecat + "]").find(".wpfd-upload-form").remove();
}
if(typeof (content.filepasswords)!=='undefined'){
$.each(content.filepasswords, function(file_id, pw_form){
var content_form='<td class="full-width">' + pw_form + '</td>';
$(".wpfd-content-multi[data-category=" + sourcecat + "]").find('.file[data-id="' + file_id + '"]').empty();
$(".wpfd-content-multi[data-category=" + sourcecat + "]").find('.file[data-id="' + file_id + '"]').addClass('wpfd-password-protection-form');
$(".wpfd-content-multi[data-category=" + sourcecat + "]").find('.file[data-id="' + file_id + '"]').append(content_form);
});
}
if(content.uploadform!==undefined&&content.uploadform.length){
var upload_form_html='<div class="wpfd-upload-form" style="margin: 20px 10px">';
upload_form_html +=content.uploadform;
upload_form_html +='</div>';
$(".wpfd-content-multi[data-category=" + sourcecat + "] .wpfd-container-table").append(upload_form_html);
if(typeof (Wpfd)==='undefined'){
Wpfd={};}
var containers=$(".wpfd-content-multi[data-category=" + sourcecat + "] div[class*=wpfdUploadForm]");
if(containers.length > 0){
containers.each(function(i, el){
initUploader($(el));
});
}}
for (var i=0; i < tableTriggerCategories.categories.length; i++){
table_cParents[tableTriggerCategories.categories[i].term_id]=tableTriggerCategories.categories[i];
}
table_breadcrum(sourcecat, catid, tableTriggerCategories.category);
table_initClick();
if(typeof wpfdColorboxInit!=='undefined'){
wpfdColorboxInit();
}
wpfdTrackDownload();
if($(".wpfd-content-multi[data-category=" + sourcecat + "] .category-pw-form").length){
$(".wpfd-content-multi[data-category=" + sourcecat + "] .category-pw-form").remove();
}
$(".wpfd-content-multi[data-category=" + sourcecat + "] .wpfd-container-table .mediaTableWrapper").show();
table_init_pagination($('.wpfd-content-table[data-category=' + sourcecat + '] + .wpfd-pagination'));
wpfd_remove_loading($(".wpfd-content-multi"));
$(".wpfd-content-table.wpfd-content-multi[data-category=" + sourcecat + "] .wpfdSelectedFiles").remove();
$(".wpfd-content-table.wpfd-content-multi[data-category=" + sourcecat + "] .table-download-selected").remove();
hideDownloadAllBtn(sourcecat, false);
if(typeof (content.notify_file_changes)!=='undefined'&&parseInt(content.notify_file_changes)===1){
$(".wpfd-content-multi[data-category=" + sourcecat + "]").find('.wpfd_mail_checkbox').show();
}
if(table_empty_files.length){
table_empty_files.val(content.files.length);
container.find('table.change_display').removeClass('change_display');
table_fire_empty_category_message(sourcecat);
}}
if($(".wpfd-content-table.wpfd-content-multi[data-category=" + sourcecat + "] .wpfd-container-table .category-pw-form").length){
hideDownloadAllBtn(sourcecat, true);
$(".wpfd-content-multi[data-category=" + sourcecat + "] .table-download-category").attr('href', '#');
$(".wpfd-content-multi[data-category=" + sourcecat + "] .wpfdcategory").hide();
}
wpfdTableDisplayDownloadedFiles();
wpfdTableDownloadFiles();
wpfdPreviewFileNewName();
});
}
function wpfdTableFilesLocalCacheTrigger(tableFilesTrigger, sourcecat, table_empty_files, container, categories, catid, tableFilesAjaxUrl){
if(typeof (tableFilesTrigger.categoryPassword)!=='undefined'&&tableFilesTrigger.categoryPassword.length){
$(".wpfd-content-multi[data-category=" + sourcecat + "] .wpfd-container-table .category-pw-form").remove();
var category_pwf='<div class="category-pw-form">' + tableFilesTrigger.categoryPassword + '</div>';
$(".wpfd-content-multi[data-category=" + sourcecat + "] .wpfd-container-table .wpfd-categories").hide();
$(".wpfd-content-multi[data-category=" + sourcecat + "] .wpfd-container-table .mediaTableWrapper").hide();
$(".wpfd-content-multi[data-category=" + sourcecat + "] .wpfd-container-table").append(category_pwf);
table_breadcrum(sourcecat, catid, categories.category);
table_initClick();
}else{
if(tableFilesTrigger.files.length){
container.find(".table-download-category").removeClass("display-download-category");
}else{
container.find(".table-download-category").addClass("display-download-category");
}
$(".wpfd-content-multi[data-category=" + sourcecat + "]").after(tableFilesTrigger.cache_pagination);
var tpltable_source=container.parents().find("#wpfd-template-table-" + sourcecat).html();
var template_table=Handlebars.compile(tpltable_source);
var html=template_table(tableFilesTrigger);
$(".wpfd-content-multi[data-category=" + sourcecat + "] table tbody").append(html);
$(".wpfd-content-multi[data-category=" + sourcecat + "] table tbody").trigger('change');
$(".wpfd-content-multi[data-category=" + sourcecat + "] .mediaTableMenu").find('input').trigger('change');
if($(".wpfd-content-multi[data-category=" + sourcecat + "]").find(".wpfd-upload-form").length){
$(".wpfd-content-multi[data-category=" + sourcecat + "]").find(".wpfd-upload-form").remove();
}
if(typeof (tableFilesTrigger.filepasswords)!=='undefined'){
$.each(tableFilesTrigger.filepasswords, function(file_id, pw_form){
var content_form='<td class="full-width">' + pw_form + '</td>';
$(".wpfd-content-multi[data-category=" + sourcecat + "]").find('.file[data-id="' + file_id + '"]').empty();
$(".wpfd-content-multi[data-category=" + sourcecat + "]").find('.file[data-id="' + file_id + '"]').addClass('wpfd-password-protection-form');
$(".wpfd-content-multi[data-category=" + sourcecat + "]").find('.file[data-id="' + file_id + '"]').append(content_form);
});
}
if(tableFilesTrigger.uploadform!==undefined&&tableFilesTrigger.uploadform.length){
var upload_form_html='<div class="wpfd-upload-form" style="margin: 20px 10px">';
upload_form_html +=tableFilesTrigger.uploadform;
upload_form_html +='</div>';
$(".wpfd-content-multi[data-category=" + sourcecat + "] .wpfd-container-table").append(upload_form_html);
if(typeof (Wpfd)==='undefined'){
Wpfd={};}
var containers=$(".wpfd-content-multi[data-category=" + sourcecat + "] div[class*=wpfdUploadForm]");
if(containers.length > 0){
containers.each(function(i, el){
initUploader($(el));
});
}}
for (var i=0; i < categories.categories.length; i++){
table_cParents[categories.categories[i].term_id]=categories.categories[i];
}
table_breadcrum(sourcecat, catid, categories.category);
table_initClick();
if(typeof wpfdColorboxInit!=='undefined'){
wpfdColorboxInit();
}
wpfdTrackDownload();
if($(".wpfd-content-multi[data-category=" + sourcecat + "] .category-pw-form").length){
$(".wpfd-content-multi[data-category=" + sourcecat + "] .category-pw-form").remove();
}
$(".wpfd-content-multi[data-category=" + sourcecat + "] .wpfd-container-table .mediaTableWrapper").show();
table_init_pagination($('.wpfd-content-table[data-category=' + sourcecat + '] + .wpfd-pagination'));
wpfd_remove_loading($(".wpfd-content-multi"));
$(".wpfd-content-table.wpfd-content-multi[data-category=" + sourcecat + "] .wpfdSelectedFiles").remove();
$(".wpfd-content-table.wpfd-content-multi[data-category=" + sourcecat + "] .table-download-selected").remove();
hideDownloadAllBtn(sourcecat, false);
if(table_empty_files.length){
table_empty_files.val(tableFilesTrigger.files.length);
container.find('table.change_display').removeClass('change_display');
table_fire_empty_category_message(sourcecat);
}}
if($(".wpfd-content-table.wpfd-content-multi[data-category=" + sourcecat + "] .wpfd-container-table .category-pw-form").length){
hideDownloadAllBtn(sourcecat, true);
$(".wpfd-content-multi[data-category=" + sourcecat + "] .table-download-category").attr('href', '#');
$(".wpfd-content-multi[data-category=" + sourcecat + "] .wpfdcategory").hide();
}
if(tableFilesTrigger.files.length){
$(".wpfd-content-multi[data-category=" + sourcecat + "]").find(".wpfd-container-table").removeClass("wpfd-table-hidden");
$(".wpfd-content-multi[data-category=" + sourcecat + "]").find(".mediaTableWrapper .wpfd-table thead").show();
$(".wpfd-content-multi[data-category=" + sourcecat + "]").find(".mediaTableWrapper .mediaTableMenu").show();
}else{
$(".wpfd-content-multi[data-category=" + sourcecat + "]").find(".wpfd-container-table").addClass("wpfd-table-hidden");
$(".wpfd-content-multi[data-category=" + sourcecat + "]").find(".mediaTableWrapper .mediaTableMenu").css({'display': 'none'});
}
if(typeof (tableFilesTrigger.notify_file_changes)!=='undefined'&&parseInt(tableFilesTrigger.notify_file_changes)===1){
$(".wpfd-content-multi[data-category=" + sourcecat + "]").find('.wpfd_mail_checkbox').show();
}
wpfdTableDisplayDownloadedFiles();
wpfdTableDownloadFiles();
wpfdPreviewFileNewName();
}
function wpfdTableCategoryAjaxSearch(element, ordering, direction, pushState=true){
var $=jQuery;
var sform=element;
var $key=$(sform).find('input[name=q]').val();
var $placeholder=$(sform).find('input[name=q]').attr('placeholder');
if($key.toString()===$placeholder.toString()){
$key='';
}
var formData={
'q': $key,
'catid': $(sform).find('[name=catid]').val(),
'theme': $(sform).find('[name=theme]').val(),
'limit': $(sform).find('[name=limit]').val(),
'wpfd_search_nonce': $(sform).find('input[name=wpfd_search_nonce]').val(),
'theme_column': $(sform).find('[name=theme_column]').val()
};
formData=cleanObj(formData);
if(jQuery.isEmptyObject(formData) ||
(typeof (formData.q)==='undefined' &&
typeof (formData.catid)!=='undefined' &&
parseInt(formData.catid)===0)||typeof (formData.q)==='undefined'){
$(element).find(".txtfilename").focus();
return false;
}
if((typeof ordering!=='undefined')&&ordering) formData.ordering=ordering;
if((typeof direction!=='undefined')&&direction) formData.dir=direction;
if(pushState){
var filter_url=jQuery.param(formData);
var currentUrl=window.location.search;
var pushUrl;
if(typeof URLSearchParams!=='undefined'){
var currentFilters=new URLSearchParams(currentUrl.substring(1));
Object.keys(formData).forEach(function (key){
if(currentFilters.has(key)){
currentFilters.delete(key);
}});
if(currentUrl.substring(1)==='?'&&currentFilters.toString()!==''){
pushUrl=currentFilters.toString() + '&' + filter_url;
}else{
pushUrl='?' + filter_url;
}
window.history.pushState(formData, "", pushUrl);
}}
$.ajax({
method: "POST",
url: wpfdparams.wpfdajaxurl + "task=search.display",
data: formData,
beforeSend: function (){
$(element).find(".wpfd-results").html('');
$(element).find(".wpfd-results").prepend($(element).find("#loader").clone().show());
},
success: function (result){
$(element).find(".wpfd_search_file_suggestion").html('');
$(element).find(".wpfd_search_file_suggestion").fadeOut(300);
$(element).find(".wpfd-results").html(result);
$(element).find(".wpfd-results .wpfd-table").addClass('wpfd-table-search');
if($(element).find(".wpfd-results .wpfd-form-search-file-category").length){
$(element).find(".wpfd-results .wpfd-form-search-file-category").remove();
}
wpfdTableInitSorting();
if(typeof wpfdColorboxInit!=='undefined'){
wpfdColorboxInit();
}}
});
}
function wpfdTableInitSorting(){
jQuery('.orderingCol').click(function (e){
e.preventDefault();
var ordering=jQuery(this).data('ordering');
var direction=jQuery(this).data('direction');
wpfdTableCategoryAjaxSearch(ordering, direction);
});
jQuery(".list-results #limit").change(function (e){
e.preventDefault();
jQuery('input[name="limit"]').val(jQuery(this).val());
var formID='#' + jQuery(this).closest('form').attr('id');
wpfdTableCategoryAjaxSearch(formID);
return false;
});
}
function wpfdTableSearchFileCategoryHandle(){
$(".wpfd-content .wpfd-adminForm").submit(function (e){
e.preventDefault();
return false;
});
$('.wpfd-content .txtfilename').on('keyup', function(e){
var $this=$(this);
if(e.keyCode===13||e.which===13||e.key==='Enter'){
e.preventDefault();
if($this.val()===''){
return;
}
var formID='#' + $this.closest('form').attr('id');
wpfdTableCategoryAjaxSearch(formID);
return;
}});
$(".wpfd-content .btnsearchbelow").on('click', function (e){
e.preventDefault();
var formID='#' + $(this).closest('form').attr('id');
wpfdTableCategoryAjaxSearch(formID);
return false;
});
}
wpfdTableSearchFileCategoryHandle();
function wpfdTableDisplayDownloadedFiles(){
var fileDownload=$('.wpfd-content.wpfd-content-table .file');
var linkDownload=$('.wpfd-content.wpfd-content-table .wpfd_downloadlink');
var user_login_id=wpfdparams.wpfd_user_login_id;
if(linkDownload.length){
linkDownload.on('click', function (){
var fileId=$(this).parents('.file').data('id');
var isDownloadedFile=localStorage.getItem('wpfd_downloaded_file_' + user_login_id + '_' + fileId);
if(isDownloadedFile===null){
localStorage.setItem('wpfd_downloaded_file_' + user_login_id + '_' + fileId, 'yes');
$(this).parents('.file').addClass('is_downloaded');
}});
}
if(fileDownload.length){
fileDownload.each(function (){
var id=$(this).data('id');
var isFileDownload=localStorage.getItem('wpfd_downloaded_file_' + user_login_id + '_' + id);
if(isFileDownload){
$(this).addClass('is_downloaded');
}});
}}
wpfdTableDisplayDownloadedFiles();
function wpfdTableDownloadFiles(){
if(!wpfdparams.offRedirectLinkDownloadImageFile){
$('.file.png .wpfd_downloadlink, .file.jpg .wpfd_downloadlink, .file.jpeg .wpfd_downloadlink, .file.gif .wpfd_downloadlink').on('click', function (event){
event.preventDefault();
var fileId=$(this).parents('.file').data('id');
var categoryId=$(this).parents('.file').data('catid');
var cloudType=$(this).parents('.wpfd-content-table').find('.wpfd_root_category_type').val();
if(!fileId||!categoryId){
return false;
}
if($(this).find('.wpfd-add-to-cart').length){
return false;
}
window.location.href=wpfdparams.site_url + "?wpfd_action=wpfd_download_file&wpfd_file_id=" + fileId + "&wpfd_category_id=" + categoryId + "&cloudType=" + cloudType;
});
}}
wpfdTableDownloadFiles();
function wpfdTableInitDefaultOption(){
var $=jQuery;
var checkitem=$('.wpfdTableMenu .media-item');
var showList=[];
if(checkitem.length){
checkitem.each(function (){
if($(this).prop("checked")==true){
showList.push($(this).val());
}});
if(showList.length > 0){
jQuery("#total-media-list").val(showList.join(","));
}else{
jQuery("#total-media-list").val("");
}
var desc="";
var category="";
var ver="";
var size="";
var hits="";
var dateadd="";
var download="";
for(var i=0; i<showList.length;i++){
if(showList[i]=="Description"){
desc="Description";
}
if(showList[i]=="Category"){
category="Category";
}
if(showList[i]=="Version"){
ver="Version";
}
if(showList[i]=="Size"){
size="Size";
}
if(showList[i]=="Hits"){
hits="Hits";
}
if(showList[i]=="Date added"){
dateadd="Date added";
}
if(showList[i]=="Download"){
download="Download";
}}
if(desc==="Description"){
jQuery(".file_desc").removeClass('filehidden');
}else{
jQuery(".file_desc").addClass('filehidden');
}
if(category==="Category"){
jQuery(".file_category").removeClass('filehidden');
}else{
jQuery(".file_category").addClass('filehidden');
}
if(ver==="Version"){
jQuery(".file_version").removeClass('filehidden');
}else{
jQuery(".file_version").addClass('filehidden');
}
if(size==="Size"){
jQuery(".file_size").removeClass('filehidden');
}else{
jQuery(".file_size").addClass('filehidden');
}
if(hits==="Hits"){
jQuery(".file_hits").removeClass('filehidden');
}else{
jQuery(".file_hits").addClass('filehidden');
}
if(dateadd==="Date added"){
jQuery(".file_created").removeClass('filehidden');
}else{
jQuery(".file_created").addClass('filehidden');
}
if(download==="Download"){
jQuery(".file_download_tbl").removeClass('filehidden');
}else{
jQuery(".file_download_tbl").addClass('filehidden');
}
var wpfdTable=$('.wpfd-results table.wpfd-search-result');
wpfdTable.each(function(){
var visibleRow=$(this).find('tbody tr');
visibleRow.each(function(){
var visibleColumn=$(this).find('td:not(.filehidden)');
visibleColumn.each(function(){
if($(this).is(visibleColumn.last())){
$(this).attr('colspan', 2);
}else{
$(this).attr('colspan', 1);
}})
})
})
}}
function wpfdTableInitUploadDefaultOption(container){
var $=jQuery;
var checkitem=$(".file-upload-content[data-container='" + container + "'] .wpfdTableMenu .media-item");
var showList=[];
checkitem.each(function (){
if($(this).prop("checked")==true){
showList.push($(this).val());
}});
if(showList.length > 0){
jQuery(".file-upload-content[data-container='" + container + "'] #total-media-list").val(showList.join(","));
}else{
jQuery(".file-upload-content[data-container='" + container + "'] #total-media-list").val("");
}
var desc="";
var category="";
var ver="";
var size="";
var hits="";
var dateadd="";
var download="";
for(var i=0; i<showList.length;i++){
if(showList[i]=="Description"){
desc="Description";
}
if(showList[i]=="Category"){
category="Category";
}
if(showList[i]=="Version"){
ver="Version";
}
if(showList[i]=="Size"){
size="Size";
}
if(showList[i]=="Hits"){
hits="Hits";
}
if(showList[i]=="Date added"){
dateadd="Date added";
}
if(showList[i]=="Download"){
download="Download";
}}
if(desc==="Description"){
jQuery(".file-upload-content[data-container='" + container + "'] .file_desc").removeClass('filehidden');
}else{
jQuery(".file-upload-content[data-container='" + container + "'] .file_desc").addClass('filehidden');
}
if(category==="Category"){
jQuery(".file-upload-content[data-container='" + container + "'] .file_category").removeClass('filehidden');
}else{
jQuery(".file-upload-content[data-container='" + container + "'] .file_category").addClass('filehidden');
}
if(ver==="Version"){
jQuery(".file-upload-content[data-container='" + container + "'] .file_version").removeClass('filehidden');
}else{
jQuery(".file-upload-content[data-container='" + container + "'] .file_version").addClass('filehidden');
}
if(size==="Size"){
jQuery(".file-upload-content[data-container='" + container + "'] .file_size").removeClass('filehidden');
}else{
jQuery(".file-upload-content[data-container='" + container + "'] .file_size").addClass('filehidden');
}
if(hits==="Hits"){
jQuery(".file-upload-content[data-container='" + container + "'] .file_hits").removeClass('filehidden');
}else{
jQuery(".file-upload-content[data-container='" + container + "'] .file_hits").addClass('filehidden');
}
if(dateadd==="Date added"){
jQuery(".file-upload-content[data-container='" + container + "'] .file_created").removeClass('filehidden');
}else{
jQuery(".file-upload-content[data-container='" + container + "'] .file_created").addClass('filehidden');
}
if(download==="Download"){
jQuery(".file-upload-content[data-container='" + container + "'] .file_download_tbl").removeClass('filehidden');
}else{
jQuery(".file-upload-content[data-container='" + container + "'] .file_download_tbl").addClass('filehidden');
}}
function wpfdTableShowViewOption(){
var $=jQuery;
var checkitem=$('.wpfdTableMenu .media-item');
$(document).on("click", ".wpfdTableMenu", function(){
$(this).addClass('showlist');
$(this).removeClass('mediaTableMenuClosed');
$(document).on("click", checkitem, function(){
if(!$(this).parents('.file-upload-content').length){
wpfdTableInitDefaultOption();
if($(".list-results .file_desc").hasClass("filehidden")&&$(".list-results .file_created").hasClass("filehidden")){
$(".list-results .file_download_tbl").addClass("file_download_inline");
}else{
$(".list-results .file_download_tbl").removeClass("file_download_inline");
}
var checkall=$(".list-results .table thead th");
if(!checkall.hasClass("filehidden")){
$(".list-results .file_title").addClass("adv_file_tt");
}else{
$(".list-results .file_title").removeClass("adv_file_tt");
}}else{
var container=$(this).parents('.file-upload-content').data('container');
wpfdTableInitUploadDefaultOption(container);
if($(".file-upload-content[data-container='" + container + "'] .list-results .file_desc").hasClass("filehidden")&&$(".file-upload-content[data-container='" + container + "'] .list-results .file_created").hasClass("filehidden")){
$(".file-upload-content[data-container='" + container + "'] .list-results .file_download_tbl").addClass("file_download_inline");
}else{
$(".file-upload-content[data-container='" + container + "'] .list-results .file_download_tbl").removeClass("file_download_inline");
}
var checkall=$(".file-upload-content[data-container='" + container + "'] .list-results .table thead th");
if(!checkall.hasClass("filehidden")){
$(".file-upload-content[data-container='" + container + "'] .list-results .file_title").addClass("adv_file_tt");
}else{
$(".file-upload-content[data-container='" + container + "'] .list-results .file_title").removeClass("adv_file_tt");
}}
});
$(document).mouseup(e=> {
if(!$(".wpfdTableMenu").is(e.target)
&& $(".wpfdTableMenu").has(e.target).length===0){
$(".wpfdTableMenu").removeClass('showlist');
$(".wpfdTableMenu").show();
}});
$(document).mouseup(function(e){
var container=$(".wpfd-content.wpfd-content-table .mediaTableMenu");
if(!container.is(e.target)&&container.has(e.target).length===0){
if(!container.hasClass('wpfdTableMenu')){
container.hide();
}
container.addClass('mediaTableMenuClosed');
}});
});
}
wpfdTableInitDefaultOption();
wpfdTableShowViewOption();
if(jQuery('.wpfd-results-tooltip').length){
jQuery('.wpfd-results-tooltip').qtip({
content: {
attr: 'title',
},
position: {
my: 'bottom left',
at: 'top left',
},
style: {
tip: {
corner: true,
},
classes: 'wpfd-qtip qtip-rounded wpfd-qtip-dashboard',
},
show: 'mouseover',
hide: {
fixed: true,
delay: 10,
}});
}
function wpfdPreviewFileNewName(){
$('.wpfd_previewlink').click(function (e){
var newWindow=$(this).attr('target');
var previewLink=$(this).attr('href');
var fileTitle=$(this).parents('.file').find('.wpfd_downloadlink').attr('title');
var fileName=fileTitle;
fileName=fileName ? fileName:'WPFD Preview File';
if(newWindow==='_blank'&&(previewLink.indexOf('previews')!==-1)&&previewLink.indexOf('docs.google.com')===-1){
e.preventDefault();
var win=window.open(previewLink, '_blank');
win.onload=function (){
setTimeout(function (){
win.document.title=fileName;
}, 100);
setTimeout(function (){
$(win.document.head).append('<title>'+ fileName +'</title>');
}, 3000);
};
setTimeout(function (){
if(win.document.title!==fileName){
win.document.title=fileName;
}}, 1000);
setTimeout(function (){
if(win.document.title!==fileName){
win.document.title=fileName;
}}, 3000);
}});
}
wpfdPreviewFileNewName();
});
var wpfdTableCategoriesLocalCache={
data: {},
remove: function (url){
delete wpfdTableCategoriesLocalCache.data[url];
},
exist: function (url){
return wpfdTableCategoriesLocalCache.data.hasOwnProperty(url)&&wpfdTableCategoriesLocalCache.data[url]!==null;
},
get: function (url){
return wpfdTableCategoriesLocalCache.data[url];
},
set: function (url, cachedData){
wpfdTableCategoriesLocalCache.remove(url);
wpfdTableCategoriesLocalCache.data[url]=cachedData;
}};
var wpfdTableFilesLocalCache={
data: {},
remove: function (url){
delete wpfdTableFilesLocalCache.data[url];
},
exist: function (url){
return wpfdTableFilesLocalCache.data.hasOwnProperty(url)&&wpfdTableFilesLocalCache.data[url]!==null;
},
get: function (url){
return wpfdTableFilesLocalCache.data[url];
},
set: function(url, cachedData){
wpfdTableFilesLocalCache.remove(url);
wpfdTableFilesLocalCache.data[url]=cachedData;
}};
(function(){
"use strict";
var Resumable=function(opts){
if(!(this instanceof Resumable)){
return new Resumable(opts);
}
this.version=1.0;
this.support=(
(typeof(File)!=='undefined')
&&
(typeof(Blob)!=='undefined')
&&
(typeof(FileList)!=='undefined')
&&
(!!Blob.prototype.webkitSlice||!!Blob.prototype.mozSlice||!!Blob.prototype.slice||false)
);
if(!this.support) return(false);
var $=this;
$.files=[];
$.defaults={
chunkSize:1*1024*1024,
forceChunkSize:false,
simultaneousUploads:3,
fileParameterName:'file',
chunkNumberParameterName: 'resumableChunkNumber',
chunkSizeParameterName: 'resumableChunkSize',
currentChunkSizeParameterName: 'resumableCurrentChunkSize',
totalSizeParameterName: 'resumableTotalSize',
typeParameterName: 'resumableType',
identifierParameterName: 'resumableIdentifier',
fileNameParameterName: 'resumableFilename',
relativePathParameterName: 'resumableRelativePath',
totalChunksParameterName: 'resumableTotalChunks',
dragOverClass: 'dragover',
throttleProgressCallbacks: 0.5,
query:{},
headers:{},
preprocess:null,
preprocessFile:null,
method:'multipart',
uploadMethod: 'POST',
testMethod: 'GET',
prioritizeFirstAndLastChunk:false,
target:'/',
testTarget: null,
parameterNamespace:'',
testChunks:true,
generateUniqueIdentifier:null,
getTarget:null,
maxChunkRetries:100,
chunkRetryInterval:undefined,
permanentErrors:[400, 401, 403, 404, 409, 415, 500, 501],
maxFiles:undefined,
withCredentials:false,
xhrTimeout:0,
clearInput:true,
chunkFormat:'blob',
setChunkTypeFromFile:false,
maxFilesErrorCallback:function (files, errorCount){
var maxFiles=$.getOpt('maxFiles');
alert('Please upload no more than ' + maxFiles + ' file' + (maxFiles===1 ? '':'s') + ' at a time.');
},
minFileSize:1,
minFileSizeErrorCallback:function(file, errorCount){
alert(file.fileName||file.name +' is too small, please upload files larger than ' + $h.formatSize($.getOpt('minFileSize')) + '.');
},
maxFileSize:undefined,
maxFileSizeErrorCallback:function(file, errorCount){
alert(file.fileName||file.name +' is too large, please upload files less than ' + $h.formatSize($.getOpt('maxFileSize')) + '.');
},
fileType: [],
fileTypeErrorCallback: function(file, errorCount){
alert(file.fileName||file.name +' has type not allowed, please upload files of type ' + $.getOpt('fileType') + '.');
}};
$.opts=opts||{};
$.getOpt=function(o){
var $opt=this;
if(o instanceof Array){
var options={};
$h.each(o, function(option){
options[option]=$opt.getOpt(option);
});
return options;
}
if($opt instanceof ResumableChunk){
if(typeof $opt.opts[o]!=='undefined'){ return $opt.opts[o]; }else{ $opt=$opt.fileObj; }}
if($opt instanceof ResumableFile){
if(typeof $opt.opts[o]!=='undefined'){ return $opt.opts[o]; }else{ $opt=$opt.resumableObj; }}
if($opt instanceof Resumable){
if(typeof $opt.opts[o]!=='undefined'){ return $opt.opts[o]; }else{ return $opt.defaults[o]; }}
};
$.indexOf=function(array, obj){
if(array.indexOf){ return array.indexOf(obj); }
for (var i=0; i < array.length; i++){
if(array[i]===obj){ return i; }}
return -1;
}
$.events=[];
$.on=function(event,callback){
$.events.push(event.toLowerCase(), callback);
};
$.fire=function(){
var args=[];
for (var i=0; i<arguments.length; i++) args.push(arguments[i]);
var event=args[0].toLowerCase();
for (var i=0; i<=$.events.length; i+=2){
if($.events[i]==event) $.events[i+1].apply($,args.slice(1));
if($.events[i]=='catchall') $.events[i+1].apply(null,args);
}
if(event=='fileerror') $.fire('error', args[2], args[1]);
if(event=='fileprogress') $.fire('progress');
};
var $h={
stopEvent: function(e){
e.stopPropagation();
e.preventDefault();
},
each: function(o,callback){
if(typeof(o.length)!=='undefined'){
for (var i=0; i<o.length; i++){
if(callback(o[i])===false) return;
}}else{
for (i in o){
if(callback(i,o[i])===false) return;
}}
},
generateUniqueIdentifier:function(file, event){
var custom=$.getOpt('generateUniqueIdentifier');
if(typeof custom==='function'){
return custom(file, event);
}
var relativePath=file.webkitRelativePath||file.relativePath||file.fileName||file.name;
var size=file.size;
return(size + '-' + relativePath.replace(/[^0-9a-zA-Z_-]/img, ''));
},
contains:function(array,test){
var result=false;
$h.each(array, function(value){
if(value==test){
result=true;
return false;
}
return true;
});
return result;
},
formatSize:function(size){
if(size<1024){
return size + ' bytes';
}else if(size<1024*1024){
return (size/1024.0).toFixed(0) + ' KB';
}else if(size<1024*1024*1024){
return (size/1024.0/1024.0).toFixed(1) + ' MB';
}else{
return (size/1024.0/1024.0/1024.0).toFixed(1) + ' GB';
}},
getTarget:function(request, params){
var target=$.getOpt('target');
if(request==='test'&&$.getOpt('testTarget')){
target=$.getOpt('testTarget')==='/' ? $.getOpt('target'):$.getOpt('testTarget');
}
if(typeof target==='function'){
return target(params);
}
var separator=target.indexOf('?') < 0 ? '?':'&';
var joinedParams=params.join('&');
if(joinedParams) target=target + separator + joinedParams;
return target;
}};
var onDrop=function(e){
e.currentTarget.classList.remove($.getOpt('dragOverClass'));
$h.stopEvent(e);
if(e.dataTransfer&&e.dataTransfer.items){
loadFiles(e.dataTransfer.items, e);
}
else if(e.dataTransfer&&e.dataTransfer.files){
loadFiles(e.dataTransfer.files, e);
}};
var onDragLeave=function(e){
e.currentTarget.classList.remove($.getOpt('dragOverClass'));
};
var onDragOverEnter=function(e){
e.preventDefault();
var dt=e.dataTransfer;
if($.indexOf(dt.types, "Files") >=0){
e.stopPropagation();
dt.dropEffect="copy";
dt.effectAllowed="copy";
e.currentTarget.classList.add($.getOpt('dragOverClass'));
}else{
dt.dropEffect="none";
dt.effectAllowed="none";
}};
function processItem(item, path, items, cb){
var entry;
if(item.isFile){
return item.file(function(file){
file.relativePath=path + file.name;
items.push(file);
cb();
});
}else if(item.isDirectory){
entry=item;
}else if(item instanceof File){
items.push(item);
}
if('function'===typeof item.webkitGetAsEntry){
entry=item.webkitGetAsEntry();
}
if(entry&&entry.isDirectory){
return processDirectory(entry, path + entry.name + '/', items, cb);
}
if('function'===typeof item.getAsFile){
item=item.getAsFile();
if(item instanceof File){
item.relativePath=path + item.name;
items.push(item);
}}
cb();
}
function processCallbacks(items, cb){
if(!items||items.length===0){
return cb();
}
items[0](function(){
processCallbacks(items.slice(1), cb);
});
}
function processDirectory (directory, path, items, cb){
var dirReader=directory.createReader();
var allEntries=[];
function readEntries (){
dirReader.readEntries(function(entries){
if(entries.length){
allEntries=allEntries.concat(entries);
return readEntries();
}
processCallbacks(
allEntries.map(function(entry){
return processItem.bind(null, entry, path, items);
}),
cb
);
});
}
readEntries();
}
function loadFiles(items, event){
if(!items.length){
return;
}
$.fire('beforeAdd');
var files=[];
processCallbacks(
Array.prototype.map.call(items, function(item){
var entry=item;
if('function'===typeof item.webkitGetAsEntry){
entry=item.webkitGetAsEntry();
}
return processItem.bind(null, entry, "", files);
}),
function(){
if(files.length){
appendFilesFromFileList(files, event);
}}
);
};
var appendFilesFromFileList=function(fileList, event){
var errorCount=0;
var o=$.getOpt(['maxFiles', 'minFileSize', 'maxFileSize', 'maxFilesErrorCallback', 'minFileSizeErrorCallback', 'maxFileSizeErrorCallback', 'fileType', 'fileTypeErrorCallback']);
if(typeof(o.maxFiles)!=='undefined'&&o.maxFiles<(fileList.length+$.files.length)){
if(o.maxFiles===1&&$.files.length===1&&fileList.length===1){
$.removeFile($.files[0]);
}else{
o.maxFilesErrorCallback(fileList, errorCount++);
return false;
}}
if(!Array.isArray(fileList)){
fileList=Array.from(fileList);
}
$.fire('createFolders', fileList);
var catId=jQuery('input[name=id_category]').val();
fileList=fileList.map(function (file){
if(!file.hasOwnProperty('catId')){
file.catId=catId;
}
return file;
});
var maxFiles=5;
if(fileList.length > maxFiles){
var counter=0;
var loop=Math.ceil(fileList.length / maxFiles);
var myFileList=Array.from(fileList);
function loopFiles(){
setTimeout(function (){
let newFiles=[];
if(myFileList.length < maxFiles){
maxFiles=myFileList.length;
}
for (let i=0; i < maxFiles; i++){
newFiles.push(myFileList[i]);
}
appendFilesFromFileList(newFiles, event);
myFileList=myFileList.slice(maxFiles);
counter++;
if(counter < loop){
loopFiles();
}}, (counter==0)? 3000: 6000);
}
loopFiles();
return ;
}
var files=[], filesSkipped=[], remaining=fileList.length;
var decreaseReamining=function(){
if(!--remaining){
if(!files.length&&!filesSkipped.length){
return;
}
window.setTimeout(function(){
$.fire('filesAdded', files, filesSkipped);
},0);
}};
$h.each(fileList, function(file){
var fileName=file.name;
var fileType=file.type;
if(o.fileType.length > 0){
var fileTypeFound=false;
for(var index in o.fileType){
o.fileType[index]=o.fileType[index].replace(/\s/g, '').toLowerCase();
var extension=((o.fileType[index].match(/^[^.][^/]+$/)) ? '.':'') + o.fileType[index];
if((fileName.substr(-1 * extension.length).toLowerCase()===extension) ||
(extension.indexOf('/')!==-1&&(
(extension.indexOf('*')!==-1&&fileType.substr(0, extension.indexOf('*'))===extension.substr(0, extension.indexOf('*'))) ||
fileType===extension
))
){
fileTypeFound=true;
break;
}}
if(!fileTypeFound){
o.fileTypeErrorCallback(file, errorCount++);
return true;
}}
if(typeof(o.minFileSize)!=='undefined'&&file.size<o.minFileSize){
o.minFileSizeErrorCallback(file, errorCount++);
return true;
}
if(typeof(o.maxFileSize)!=='undefined'&&file.size>o.maxFileSize){
o.maxFileSizeErrorCallback(file, errorCount++);
return true;
}
function addFile(uniqueIdentifier){
if(!$.getFromUniqueIdentifier(uniqueIdentifier)){(function(){
file.uniqueIdentifier=uniqueIdentifier;
var f=new ResumableFile($, file, uniqueIdentifier);
$.files.push(f);
files.push(f);
f.container=(typeof event!='undefined' ? event.srcElement:null);
window.setTimeout(function(){
$.fire('fileAdded', f, event)
},0);
})()}else{
filesSkipped.push(file);
};
decreaseReamining();
}
var uniqueIdentifier=$h.generateUniqueIdentifier(file, event);
if(uniqueIdentifier&&typeof uniqueIdentifier.then==='function'){
uniqueIdentifier
.then(function(uniqueIdentifier){
addFile(uniqueIdentifier);
},
function(){
decreaseReamining();
}
);
}else{
addFile(uniqueIdentifier);
}});
};
function ResumableFile(resumableObj, file, uniqueIdentifier){
var $=this;
$.opts={};
$.getOpt=resumableObj.getOpt;
$._prevProgress=0;
$.resumableObj=resumableObj;
$.file=file;
$.fileName=file.fileName||file.name;
$.size=file.size;
$.relativePath=file.relativePath||file.webkitRelativePath||$.fileName;
$.uniqueIdentifier=uniqueIdentifier;
$._pause=false;
$.container='';
$.preprocessState=0;
var _error=uniqueIdentifier!==undefined;
var chunkEvent=function(event, message){
switch(event){
case 'progress':
$.resumableObj.fire('fileProgress', $, message);
break;
case 'error':
$.abort();
_error=true;
$.chunks=[];
$.resumableObj.fire('fileError', $, message);
break;
case 'success':
if(_error) return;
$.resumableObj.fire('fileProgress', $, message);
if($.isComplete()){
$.resumableObj.fire('fileSuccess', $, message);
}
break;
case 'retry':
$.resumableObj.fire('fileRetry', $);
break;
}};
$.chunks=[];
$.abort=function(){
var abortCount=0;
$h.each($.chunks, function(c){
if(c.status()=='uploading'){
c.abort();
abortCount++;
}});
if(abortCount>0) $.resumableObj.fire('fileProgress', $);
};
$.cancel=function(){
var _chunks=$.chunks;
$.chunks=[];
$h.each(_chunks, function(c){
if(c.status()=='uploading'){
c.abort();
$.resumableObj.uploadNextChunk();
}});
$.resumableObj.removeFile($);
$.resumableObj.fire('fileProgress', $);
};
$.retry=function(){
$.bootstrap();
var firedRetry=false;
$.resumableObj.on('chunkingComplete', function(){
if(!firedRetry) $.resumableObj.upload();
firedRetry=true;
});
};
$.bootstrap=function(){
$.abort();
_error=false;
$.chunks=[];
$._prevProgress=0;
var round=$.getOpt('forceChunkSize') ? Math.ceil:Math.floor;
var maxOffset=Math.max(round($.file.size/$.getOpt('chunkSize')),1);
for (var offset=0; offset<maxOffset; offset++){(function(offset){
$.chunks.push(new ResumableChunk($.resumableObj, $, offset, chunkEvent));
$.resumableObj.fire('chunkingProgress',$,offset/maxOffset);
})(offset)}
window.setTimeout(function(){
$.resumableObj.fire('chunkingComplete',$);
},0);
};
$.progress=function(){
if(_error) return(1);
var ret=0;
var error=false;
$h.each($.chunks, function(c){
if(c.status()=='error') error=true;
ret +=c.progress(true);
});
ret=(error ? 1:(ret>0.99999 ? 1:ret));
ret=Math.max($._prevProgress, ret);
$._prevProgress=ret;
return(ret);
};
$.isUploading=function(){
var uploading=false;
$h.each($.chunks, function(chunk){
if(chunk.status()=='uploading'){
uploading=true;
return(false);
}});
return(uploading);
};
$.isComplete=function(){
var outstanding=false;
if($.preprocessState===1){
return(false);
}
$h.each($.chunks, function(chunk){
var status=chunk.status();
if(status=='pending'||status=='uploading'||chunk.preprocessState===1){
outstanding=true;
return(false);
}});
return(!outstanding);
};
$.pause=function(pause){
if(typeof(pause)==='undefined'){
$._pause=($._pause ? false:true);
}else{
$._pause=pause;
}};
$.isPaused=function(){
return $._pause;
};
$.preprocessFinished=function(){
$.preprocessState=2;
$.upload();
};
$.upload=function (){
var found=false;
if($.isPaused()===false){
var preprocess=$.getOpt('preprocessFile');
if(typeof preprocess==='function'){
switch($.preprocessState){
case 0: $.preprocessState=1; preprocess($); return(true);
case 1: return(true);
case 2: break;
}}
$h.each($.chunks, function (chunk){
if(chunk.status()=='pending'&&chunk.preprocessState!==1){
chunk.send();
found=true;
return(false);
}});
}
return(found);
}
$.markChunksCompleted=function (chunkNumber){
if(!$.chunks||$.chunks.length <=chunkNumber){
return;
}
for (var num=0; num < chunkNumber; num++){
$.chunks[num].markComplete=true;
}};
$.resumableObj.fire('chunkingStart', $);
$.bootstrap();
return(this);
}
function ResumableChunk(resumableObj, fileObj, offset, callback){
var $=this;
$.opts={};
$.getOpt=resumableObj.getOpt;
$.resumableObj=resumableObj;
$.fileObj=fileObj;
$.fileObjSize=fileObj.size;
$.fileObjType=fileObj.file.type;
$.offset=offset;
$.callback=callback;
$.lastProgressCallback=(new Date);
$.tested=false;
$.retries=0;
$.pendingRetry=false;
$.preprocessState=0;
$.markComplete=false;
var chunkSize=$.getOpt('chunkSize');
$.loaded=0;
$.startByte=$.offset*chunkSize;
$.endByte=Math.min($.fileObjSize, ($.offset+1)*chunkSize);
if($.fileObjSize-$.endByte < chunkSize&&!$.getOpt('forceChunkSize')){
$.endByte=$.fileObjSize;
}
$.xhr=null;
$.test=function(){
$.xhr=new XMLHttpRequest();
var testHandler=function(e){
$.tested=true;
var status=$.status();
if(status=='success'){
$.callback(status, $.message());
$.resumableObj.uploadNextChunk();
}else{
$.send();
}};
$.xhr.addEventListener('load', testHandler, false);
$.xhr.addEventListener('error', testHandler, false);
$.xhr.addEventListener('timeout', testHandler, false);
var params=[];
var parameterNamespace=$.getOpt('parameterNamespace');
var customQuery=$.getOpt('query');
if(typeof customQuery=='function') customQuery=customQuery($.fileObj, $);
$h.each(customQuery, function(k,v){
params.push([encodeURIComponent(parameterNamespace+k), encodeURIComponent(v)].join('='));
});
params=params.concat([
['chunkNumberParameterName', $.offset + 1],
['chunkSizeParameterName', $.getOpt('chunkSize')],
['currentChunkSizeParameterName', $.endByte - $.startByte],
['totalSizeParameterName', $.fileObjSize],
['typeParameterName', $.fileObjType],
['identifierParameterName', $.fileObj.uniqueIdentifier],
['fileNameParameterName', $.fileObj.fileName],
['relativePathParameterName', $.fileObj.relativePath],
['totalChunksParameterName', $.fileObj.chunks.length]
].filter(function(pair){
return $.getOpt(pair[0]);
})
.map(function(pair){
return [
parameterNamespace + $.getOpt(pair[0]),
encodeURIComponent(pair[1])
].join('=');
})
);
$.xhr.open($.getOpt('testMethod'), $h.getTarget('test', params));
$.xhr.timeout=$.getOpt('xhrTimeout');
$.xhr.withCredentials=$.getOpt('withCredentials');
var customHeaders=$.getOpt('headers');
if(typeof customHeaders==='function'){
customHeaders=customHeaders($.fileObj, $);
}
$h.each(customHeaders, function(k,v){
$.xhr.setRequestHeader(k, v);
});
$.xhr.send(null);
};
$.preprocessFinished=function(){
$.preprocessState=2;
$.send();
};
$.send=function(){
var preprocess=$.getOpt('preprocess');
if(typeof preprocess==='function'){
switch($.preprocessState){
case 0: $.preprocessState=1; preprocess($); return;
case 1: return;
case 2: break;
}}
if($.getOpt('testChunks')&&!$.tested){
$.test();
return;
}
$.xhr=new XMLHttpRequest();
$.xhr.upload.addEventListener('progress', function(e){
if((new Date) - $.lastProgressCallback > $.getOpt('throttleProgressCallbacks') * 1000){
$.callback('progress');
$.lastProgressCallback=(new Date);
}
$.loaded=e.loaded||0;
}, false);
$.loaded=0;
$.pendingRetry=false;
$.callback('progress');
var doneHandler=function(e){
var status=$.status();
if(status=='success'||status=='error'){
$.callback(status, $.message());
$.resumableObj.uploadNextChunk();
}else{
$.callback('retry', $.message());
$.abort();
$.retries++;
var retryInterval=$.getOpt('chunkRetryInterval');
if(retryInterval!==undefined){
$.pendingRetry=true;
setTimeout($.send, retryInterval);
}else{
$.send();
}}
};
$.xhr.addEventListener('load', doneHandler, false);
$.xhr.addEventListener('error', doneHandler, false);
$.xhr.addEventListener('timeout', doneHandler, false);
var query=[
['chunkNumberParameterName', $.offset + 1],
['chunkSizeParameterName', $.getOpt('chunkSize')],
['currentChunkSizeParameterName', $.endByte - $.startByte],
['totalSizeParameterName', $.fileObjSize],
['typeParameterName', $.fileObjType],
['identifierParameterName', $.fileObj.uniqueIdentifier],
['fileNameParameterName', $.fileObj.fileName],
['relativePathParameterName', $.fileObj.relativePath],
['totalChunksParameterName', $.fileObj.chunks.length],
].filter(function(pair){
return $.getOpt(pair[0]);
})
.reduce(function(query, pair){
query[$.getOpt(pair[0])]=pair[1];
return query;
}, {});
var customQuery=$.getOpt('query');
if(typeof customQuery=='function') customQuery=customQuery($.fileObj, $);
$h.each(customQuery, function(k,v){
query[k]=v;
});
var func=($.fileObj.file.slice ? 'slice':($.fileObj.file.mozSlice ? 'mozSlice':($.fileObj.file.webkitSlice ? 'webkitSlice':'slice')));
var bytes=$.fileObj.file[func]($.startByte, $.endByte, $.getOpt('setChunkTypeFromFile') ? $.fileObj.file.type:"");
var data=null;
var params=[];
var parameterNamespace=$.getOpt('parameterNamespace');
if($.getOpt('method')==='octet'){
data=bytes;
$h.each(query, function (k, v){
params.push([encodeURIComponent(parameterNamespace + k), encodeURIComponent(v)].join('='));
});
}else{
data=new FormData();
$h.each(query, function (k, v){
data.append(parameterNamespace + k, v);
params.push([encodeURIComponent(parameterNamespace + k), encodeURIComponent(v)].join('='));
});
if($.getOpt('chunkFormat')=='blob'){
data.append(parameterNamespace + $.getOpt('fileParameterName'), bytes, $.fileObj.fileName);
}
else if($.getOpt('chunkFormat')=='base64'){
var fr=new FileReader();
fr.onload=function (e){
data.append(parameterNamespace + $.getOpt('fileParameterName'), fr.result);
$.xhr.send(data);
}
fr.readAsDataURL(bytes);
}}
var target=$h.getTarget('upload', params);
var method=$.getOpt('uploadMethod');
$.xhr.open(method, target);
if($.getOpt('method')==='octet'){
$.xhr.setRequestHeader('Content-Type', 'application/octet-stream');
}
$.xhr.timeout=$.getOpt('xhrTimeout');
$.xhr.withCredentials=$.getOpt('withCredentials');
var customHeaders=$.getOpt('headers');
if(typeof customHeaders==='function'){
customHeaders=customHeaders($.fileObj, $);
}
$h.each(customHeaders, function(k,v){
$.xhr.setRequestHeader(k, v);
});
if($.getOpt('chunkFormat')=='blob'){
$.xhr.send(data);
}};
$.abort=function(){
if($.xhr) $.xhr.abort();
$.xhr=null;
};
$.status=function(){
if($.pendingRetry){
return('uploading');
}else if($.markComplete){
return 'success';
}else if(!$.xhr){
return('pending');
}else if($.xhr.readyState<4){
return('uploading');
}else{
if($.xhr.status==200||$.xhr.status==201){
return('success');
}else if($h.contains($.getOpt('permanentErrors'), $.xhr.status)||$.retries >=$.getOpt('maxChunkRetries')){
return('error');
}else{
$.abort();
return('pending');
}}
};
$.message=function(){
return($.xhr ? $.xhr.responseText:'');
};
$.progress=function(relative){
if(typeof(relative)==='undefined') relative=false;
var factor=(relative ? ($.endByte-$.startByte)/$.fileObjSize:1);
if($.pendingRetry) return(0);
if((!$.xhr||!$.xhr.status)&&!$.markComplete) factor*=.95;
var s=$.status();
switch(s){
case 'success':
case 'error':
return(1*factor);
case 'pending':
return(0*factor);
default:
return($.loaded/($.endByte-$.startByte)*factor);
}};
return(this);
}
$.uploadNextChunk=function(){
var found=false;
if($.getOpt('prioritizeFirstAndLastChunk')){
$h.each($.files, function(file){
if(file.chunks.length&&file.chunks[0].status()=='pending'&&file.chunks[0].preprocessState===0){
file.chunks[0].send();
found=true;
return(false);
}
if(file.chunks.length>1&&file.chunks[file.chunks.length-1].status()=='pending'&&file.chunks[file.chunks.length-1].preprocessState===0){
file.chunks[file.chunks.length-1].send();
found=true;
return(false);
}});
if(found) return(true);
}
$h.each($.files, function(file){
found=file.upload();
if(found) return(false);
});
if(found) return(true);
var outstanding=false;
$h.each($.files, function(file){
if(!file.isComplete()){
outstanding=true;
return(false);
}});
if(!outstanding){
$.fire('complete');
}
return(false);
};
$.assignBrowse=function(domNodes, isDirectory){
if(typeof(domNodes.length)=='undefined') domNodes=[domNodes];
$h.each(domNodes, function(domNode){
var input;
if(domNode.tagName==='INPUT'&&domNode.type==='file'){
input=domNode;
}else{
input=document.createElement('input');
input.setAttribute('type', 'file');
input.style.display='none';
domNode.addEventListener('click', function(){
input.style.opacity=0;
input.style.display='block';
input.focus();
input.click();
input.style.display='none';
}, false);
domNode.appendChild(input);
}
var maxFiles=$.getOpt('maxFiles');
if(typeof(maxFiles)==='undefined'||maxFiles!=1){
input.setAttribute('multiple', 'multiple');
}else{
input.removeAttribute('multiple');
}
if(isDirectory){
input.setAttribute('webkitdirectory', 'webkitdirectory');
}else{
input.removeAttribute('webkitdirectory');
}
var fileTypes=$.getOpt('fileType');
if(typeof (fileTypes)!=='undefined'&&fileTypes.length >=1){
input.setAttribute('accept', fileTypes.map(function (e){
e=e.replace(/\s/g, '').toLowerCase();
if(e.match(/^[^.][^/]+$/)){
e='.' + e;
}
return e;
}).join(','));
}else{
input.removeAttribute('accept');
}
if(isDirectory){
input.removeAttribute('accept');
}
input.addEventListener('change', function(e){
appendFilesFromFileList(e.target.files,e);
var clearInput=$.getOpt('clearInput');
if(clearInput){
e.target.value='';
}}, false);
});
};
$.assignDrop=function(domNodes){
if(typeof(domNodes.length)=='undefined') domNodes=[domNodes];
$h.each(domNodes, function(domNode){
domNode.addEventListener('dragover', onDragOverEnter, false);
domNode.addEventListener('dragenter', onDragOverEnter, false);
domNode.addEventListener('dragleave', onDragLeave, false);
domNode.addEventListener('drop', onDrop, false);
});
};
$.unAssignDrop=function(domNodes){
if(typeof(domNodes.length)=='undefined') domNodes=[domNodes];
$h.each(domNodes, function(domNode){
domNode.removeEventListener('dragover', onDragOverEnter);
domNode.removeEventListener('dragenter', onDragOverEnter);
domNode.removeEventListener('dragleave', onDragLeave);
domNode.removeEventListener('drop', onDrop);
});
};
$.isUploading=function(){
var uploading=false;
$h.each($.files, function(file){
if(file.isUploading()){
uploading=true;
return(false);
}});
return(uploading);
};
$.upload=function(){
if($.isUploading()) return;
$.fire('uploadStart');
for (var num=1; num<=$.getOpt('simultaneousUploads'); num++){
$.uploadNextChunk();
}};
$.pause=function(){
$h.each($.files, function(file){
file.abort();
});
$.fire('pause');
};
$.cancel=function(){
$.fire('beforeCancel');
for(var i=$.files.length - 1; i >=0; i--){
$.files[i].cancel();
}
$.fire('cancel');
};
$.progress=function(){
var totalDone=0;
var totalSize=0;
$h.each($.files, function(file){
totalDone +=file.progress()*file.size;
totalSize +=file.size;
});
return(totalSize>0 ? totalDone/totalSize:0);
};
$.addFile=function(file, event){
appendFilesFromFileList([file], event);
};
$.addFiles=function(files, event){
appendFilesFromFileList(files, event);
};
$.removeFile=function(file){
for(var i=$.files.length - 1; i >=0; i--){
if($.files[i]===file){
$.files.splice(i, 1);
}}
};
$.getFromUniqueIdentifier=function(uniqueIdentifier){
var ret=false;
$h.each($.files, function(f){
if(f.uniqueIdentifier==uniqueIdentifier) ret=f;
});
return(ret);
};
$.getSize=function(){
var totalSize=0;
$h.each($.files, function(file){
totalSize +=file.size;
});
return(totalSize);
};
$.handleDropEvent=function (e){
onDrop(e);
};
$.handleChangeEvent=function (e){
appendFilesFromFileList(e.target.files, e);
e.target.value='';
};
$.updateQuery=function(query){
$.opts.query=query;
};
return(this);
};
if(typeof module!='undefined'){
module.exports=Resumable;
module.exports.Resumable=Resumable;
}else if(typeof define==="function"&&define.amd){
define(function(){
return Resumable;
});
}else{
window.Resumable=Resumable;
}})();
;(function ($){
var __loop=function (cfg, i){
var $this=$(this),
wdg=$this.data('MediaTable');
if(!$.isEmptyObject(wdg)) return;
wdg={
$wrap: $('<div>'),
$table: $this,
$menu: false,
cfg: cfg,
id: $this.attr('id')
};
if(!wdg.id){
wdg.id='MediaTable-' + i;
wdg.$table.attr('id', wdg.id);
}
wdg.$table.addClass('activeMediaTable');
wdg.$wrap.addClass('mediaTableWrapper');
wdg.$table.before(wdg.$wrap).appendTo(wdg.$wrap);
if(wdg.cfg.menu) __initMenu(wdg);
wdg.$table.find('thead th').each(function (i){
__thInit.call(this, i, wdg);
});
wdg.$table.data('MediaTable', wdg);
};
var __initMenu=function (wdg){
wdg.$menu=$('<div />');
wdg.$menu.$header=$('<a title="' + wpfdTableTheme.columns + '" />');
wdg.$menu.$list=$('<ul />');
wdg.$menu
.addClass('mediaTableMenu')
.addClass('mediaTableMenuClosed')
.append(wdg.$menu.$header)
.append(wdg.$menu.$list);
wdg.$wrap.addClass('mediaTableWrapperWithMenu');
wdg.$menu.$header.html(wdg.cfg.menuTitle);
wdg.$table.before(wdg.$menu);
$(window).bind('orientationchange resize', function (){
wdg.$menu.find('input').trigger('updateCheck');
});
wdg.$menu.$header.bind('click', function (){
wdg.$menu.toggleClass('mediaTableMenuClosed');
});
wdg.$table.click(function (){
wdg.$menu.addClass('mediaTableMenuClosed');
});
wdg.$menu.$list.bind('mouseleave', function (e){
wdg.$menu.toggleClass('mediaTableMenuClosed');
e.stopPropagation();
});
};
var __thInit=function (i, wdg){
var $th=$(this),
id=$th.attr('id'),
classes=$th.attr('class');
if(!id){
id=wdg.id + '-mediaTableCol-' + i;
$th.attr('id', id);
}
if(wdg.cfg.menu&&!$th.is('.persist')){
var $li=$('<li><input type="checkbox" name="toggle-cols" id="toggle-col-' + wdg.id + '-' + i + '" value="' + id + '" /> <label for="toggle-col-' + wdg.id + '-' + i + '">' + $th.text() + '</label></li>');
wdg.$menu.$list.append($li);
__liInitActions($th, $li.find('input'), wdg);
}
$('tbody tr:not(.nohide)', wdg.$table).each(function (){
__trInit.call(this, i, id, classes);
});
$('tbody', wdg.$table).on('change', function (){
$('tbody tr:not(.nohide)', wdg.$table).each(function (){
__trInit.call(this, i, id, classes);
});
});
};
var __trInit=function (i, id, classes){
var $cell=$(this).find('td,th').eq(i);
$cell.attr('headers', id);
if(classes) $cell.addClass(classes);
};
var __liInitActions=function ($th, $checkbox, wdg){
var change=function (){
var val=$checkbox.val(),
cols=wdg.$table.find("#" + val + ", [headers=" + val + "]");
if($checkbox.is(":checked")){
cols.show();
cols.removeClass('wpfd-col-hidden');
}else{
cols.hide();
cols.addClass('wpfd-col-hidden')
}
;
var wpfdTable=$('.wpfd-container table.wpfd-search-result');
wpfdTable.each(function (){
var visibleRow=$(this).find('thead tr');
visibleRow.each(function (){
var visibleColumn=$(this).find('th.optional:not(.wpfd-col-hidden)');
visibleColumn.each(function (){
if($(this).is(visibleColumn.last())){
$(this).addClass('wpfd-last-col-table');
$(this).addClass('wpfd-padding-right');
}else{
$(this).removeClass('wpfd-last-col-table');
$(this).removeClass('wpfd-padding-right');
}})
})
})
};
var updateCheck=function (){
if($th.is(':visible')||$th.css('display')!=='none'){
$checkbox.attr("checked", true);
}else{
$checkbox.attr("checked", false);
}
;
};
$checkbox
.bind('change', change)
.bind('updateCheck', updateCheck)
.trigger('updateCheck');
}
var __destroy=function (){
var wdg=$(this).data('MediaTable');
if(!wdg) return;
wdg.$wrap.after(wdg.$table).remove();
wdg.$table.removeClass('activeMediaTable');
wdg.$table.data('MediaTable', null);
};
$.fn.mediaTable=function (){
var cfg=false;
if(!arguments.length||$.isPlainObject(arguments[0])) cfg=$.extend({}, {
menu: true,
menuTitle: '<i class="zmdi zmdi-settings"></i>',
t: 'e'
}, arguments[0]);
if(cfg!==false){
$(this).each(function (i){
__loop.call(this, cfg, i);
});
}else if(arguments.length) switch (arguments[0]){
case 'destroy':
$(this).each(function (){
__destroy.call(this);
});
break;
}
return this;
};})(jQuery);