3 lines
9.0 KiB
JavaScript
3 lines
9.0 KiB
JavaScript
|
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t||self).eta={})}(this,function(t){function e(){return e=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},e.apply(this,arguments)}function n(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,i(t,e)}function r(t){return r=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},r(t)}function i(t,e){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},i(t,e)}function a(t,e,n){return a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}()?Reflect.construct.bind():function(t,e,n){var r=[null];r.push.apply(r,e);var a=new(Function.bind.apply(t,r));return n&&i(a,n.prototype),a},a.apply(null,arguments)}function s(t){var e="function"==typeof Map?new Map:void 0;return s=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return a(t,arguments,r(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),i(n,t)},s(t)}var o=/*#__PURE__*/function(){function t(t){this.cache=void 0,this.cache=t}var n=t.prototype;return n.define=function(t,e){this.cache[t]=e},n.get=function(t){return this.cache[t]},n.remove=function(t){delete this.cache[t]},n.reset=function(){this.cache={}},n.load=function(t){this.cache=e({},this.cache,t)},t}(),c=/*#__PURE__*/function(t){function e(e){var n;return(n=t.call(this,e)||this).name="Eta Error",n}return n(e,t),e}(/*#__PURE__*/s(Error)),l=/*#__PURE__*/function(t){function e(e){var n;return(n=t.call(this,e)||this).name="EtaParser Error",n}return n(e,t),e}(c),u=/*#__PURE__*/function(t){function e(e){var n;return(n=t.call(this,e)||this).name="EtaRuntime Error",n}return n(e,t),e}(c),f=/*#__PURE__*/function(t){function e(e){var n;return(n=t.call(this,e)||this).name="EtaNameResolution Error",n}return n(e,t),e}(c);function h(t,e,n){var r=e.slice(0,n).split(/\n/),i=r.length,a=r[i-1].length+1;throw t+=" at line "+i+" col "+a+":\n\n "+e.split(/\n/)[i-1]+"\n "+Array(a).join(" ")+"^",new l(t)}function p(t,e,n,r){var i=e.split("\n"),a=Math.max(n-3,0),s=Math.min(i.length,n+3),o=r,c=i.slice(a,s).map(function(t,e){var r=e+a+1;return(r==n?" >> ":" ")+r+"| "+t}).join("\n"),l=new u((o?o+":"+n+"\n":"line "+n+"\n")+c+"\n\n"+t.message);throw l.name=t.name,l}var d=function(){return Promise.resolve()}.constructor;function g(t,e){var n=this.config,r=e&&e.async?d:Function;try{return new r(n.varName,"options",this.compileToString.call(this,t,e))}catch(n){throw n instanceof SyntaxError?new l("Bad template syntax\n\n"+n.message+"\n"+Array(n.message.length+1).join("=")+"\n"+this.compileToString.call(this,t,e)+"\n"):n}}function y(t,e){var n=this.config,r=e&&e.async,i=this.compileBody,a=this.parse.call(this,t),s=n.functionHeader+'\nlet include = (template, data) => this.render(template, data, options);\nlet includeAsync = (template, data) => this.renderAsync(template, data, options);\n\nlet __eta = {res: "", e: this.config.escapeFunction, f: this.config.filterFunction'+(n.debug?', line: 1, templateStr: "'+t.replace(/\\|"/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n")+'"':"")+"};\n\nfunction layout(path, data) {\n __eta.layout = path;\n __eta.layoutData = data;\n}"+(n.debug?"try {":"")+(n.useWith?"with("+n.varName+"||{}){":"")+"\n\n"+i.call(this,a)+"\nif (__eta.layout) {\n __eta.res = "+(r?"await includeAsync":"include")+" (__eta.layout, {..."+n.varName+", body: __eta.res, ...__eta.layoutData})
|
||
|
//# sourceMappingURL=browser.umd.js.map
|